This file is indexed.

/usr/lib/grass64/bwidget/panedw.tcl is in grass-gui 6.4.3-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# ------------------------------------------------------------------------------
#  panedw.tcl
#  This file is part of Unifix BWidget Toolkit
# ------------------------------------------------------------------------------
#  Index of commands:
#     - PanedWindow::create
#     - PanedWindow::configure
#     - PanedWindow::cget
#     - PanedWindow::add
#     - PanedWindow::getframe
#     - PanedWindow::_destroy
#     - PanedWindow::_beg_move_sash
#     - PanedWindow::_move_sash
#     - PanedWindow::_end_move_sash
#     - PanedWindow::_realize
# ------------------------------------------------------------------------------

namespace eval PanedWindow {
    namespace eval Pane {
        Widget::declare PanedWindow::Pane {
            {-minsize Int 0 0 {=0}}
            {-weight  Int 1 0 {=0}}
        }
    }

    Widget::declare PanedWindow {
        {-side       Enum       top 1 {top left bottom right}}
        {-width      Int        10  1 {=6 ""}}
        {-pad        Int        4   1 {=0 ""}}
        {-background TkResource ""  0 frame}
        {-bg         Synonym    -background}
    }

    variable _panedw

    proc ::PanedWindow { path args } { return [eval PanedWindow::create $path $args] }
    proc use {} {}
}



# ------------------------------------------------------------------------------
#  Command PanedWindow::create
# ------------------------------------------------------------------------------
proc PanedWindow::create { path args } {
    variable _panedw

    Widget::init PanedWindow $path $args

    frame $path -background [Widget::getoption $path -background]
    set _panedw($path,nbpanes) 0

    bind $path <Configure> "PanedWindow::_realize $path %w %h"
    bind $path <Destroy>   "PanedWindow::_destroy $path"

    rename $path ::$path:cmd
    proc ::$path { cmd args } "return \[eval PanedWindow::\$cmd $path \$args\]"

    return $path
}


# ------------------------------------------------------------------------------
#  Command PanedWindow::configure
# ------------------------------------------------------------------------------
proc PanedWindow::configure { path args } {
    variable _panedw

    set res [Widget::configure $path $args]

    if { [Widget::hasChanged $path -background bg] && $_panedw($path,nbpanes) > 0 } {
        $path:cmd configure -background $bg
        $path.f0 configure -background $bg
        for {set i 1} {$i < $_panedw($path,nbpanes)} {incr i} {
            set frame $path.sash$i
            $frame configure -background $bg
            $frame.sep configure -background $bg
            $frame.but configure -background $bg
            $path.f$i configure -background $bg
            $path.f$i.frame configure -background $bg
        }
    }
    return $res
}


# ------------------------------------------------------------------------------
#  Command PanedWindow::cget
# ------------------------------------------------------------------------------
proc PanedWindow::cget { path option } {
    return [Widget::cget $path $option]
}


# ------------------------------------------------------------------------------
#  Command PanedWindow::add
# ------------------------------------------------------------------------------
proc PanedWindow::add { path args } {
    variable _panedw

    set num $_panedw($path,nbpanes)
    Widget::init PanedWindow::Pane $path.f$num $args
    set bg [Widget::getoption $path -background]

    set wbut  [Widget::getoption $path -width]
    set pad   [Widget::getoption $path -pad]
    set width [expr {$wbut+2*$pad}]
    set side  [Widget::getoption $path -side]
    if { $num > 0 } {
        set frame [frame $path.sash$num -relief flat -bd 0 -highlightthickness 0 \
                       -width $width -height $width -bg $bg]
        set sep   [frame $frame.sep -bd 1 -relief raised -highlightthickness 0 -bg $bg]
        set but   [frame $frame.but -bd 1 -relief raised -highlightthickness 0 -bg $bg \
                       -width $wbut -height $wbut]
        if { ![string compare $side "top"] || ![string compare $side "bottom"] } {
            place $sep -relx 0.5 -y 0 -width 2 -relheight 1.0 -anchor n
            if { ![string compare $side "top"] } {
                place $but -relx 0.5 -y [expr {6+$wbut/2}] -anchor c
            } else {
                place $but -relx 0.5 -rely 1.0 -y [expr {-6-$wbut/2}] -anchor c
            }
            $but configure -cursor sb_h_double_arrow 
            grid $frame -column [expr 2*$num-1] -row 0 -sticky ns
            grid columnconfigure $path [expr 2*$num-1] -weight 0
        } else {
            place $sep -x 0 -rely 0.5 -height 2 -relwidth 1.0 -anchor w
            if { ![string compare $side "left"] } {
                place $but -rely 0.5 -x [expr {6+$wbut/2}] -anchor c
            } else {
                place $but -rely 0.5 -relx 1.0 -x [expr {-6-$wbut/2}] -anchor c
            }
            $but configure -cursor sb_v_double_arrow 
            grid $frame -row [expr 2*$num-1] -column 0 -sticky ew
            grid rowconfigure $path [expr 2*$num-1] -weight 0
        }
        bind $but <ButtonPress-1> "PanedWindow::_beg_move_sash $path $num %X %Y"
    } else {
        if { ![string compare $side "top"] || ![string compare $side "bottom"] } {
            grid rowconfigure $path 0 -weight 1
        } else {
            grid columnconfigure $path 0 -weight 1
        }
    }

    set pane [frame $path.f$num -bd 0 -relief flat -highlightthickness 0 -bg $bg]
    set user [frame $path.f$num.frame  -bd 0 -relief flat -highlightthickness 0 -bg $bg]
    if { ![string compare $side "top"] || ![string compare $side "bottom"] } {
        grid $pane -column [expr 2*$num] -row 0 -sticky nsew
        grid columnconfigure $path [expr 2*$num] \
            -weight  [Widget::getoption $path.f$num -weight]
    } else {
        grid $pane -row [expr 2*$num] -column 0 -sticky nsew
        grid rowconfigure $path [expr 2*$num] \
            -weight  [Widget::getoption $path.f$num -weight]
    }
    pack $user -fill both -expand yes
    incr _panedw($path,nbpanes)

    return $user
}


# ------------------------------------------------------------------------------
#  Command PanedWindow::getframe
# ------------------------------------------------------------------------------
proc PanedWindow::getframe { path index } {
    if { [winfo exists $path.f$index.frame] } {
        return $path.f$index.frame
    }
}


# ------------------------------------------------------------------------------
#  Command PanedWindow::_destroy
# ------------------------------------------------------------------------------
proc PanedWindow::_destroy { path } {
    variable _panedw

    for {set i 0} {$i < $_panedw($path,nbpanes)} {incr i} {
        Widget::destroy $path.f$i
    }
    unset _panedw($path,nbpanes)
    Widget::destroy $path
    rename $path {}
}
    

# ------------------------------------------------------------------------------
#  Command PanedWindow::_beg_move_sash
# ------------------------------------------------------------------------------
proc PanedWindow::_beg_move_sash { path num x y } {
    variable _panedw

    set fprev $path.f[expr $num-1]
    set fnext $path.f$num
    set wsash [expr [Widget::getoption $path -width] + 2*[Widget::getoption $path -pad]]

    $path.sash$num.but configure -relief sunken
    set top  [toplevel $path.sash -borderwidth 1 -relief raised]

    set minszg [Widget::getoption $fprev -minsize]
    set minszd [Widget::getoption $fnext -minsize]
    set side   [Widget::getoption $path -side]

    if { ![string compare $side "top"] || ![string compare $side "bottom"] } {
        $top configure -cursor sb_h_double_arrow
        set h    [winfo height $path]
        set yr   [winfo rooty $path.sash$num]
        set xmin [expr $wsash/2+[winfo rootx $fprev]+$minszg]
        set xmax [expr -$wsash/2-1+[winfo rootx $fnext]+[winfo width $fnext]-$minszd]
        wm overrideredirect $top 1
        wm geom $top "2x${h}+$x+$yr"

        update idletasks
        grab set $top
        bind $top <ButtonRelease-1> "PanedWindow::_end_move_sash $path $top $num $xmin $xmax %X rootx width"
        bind $top <Motion>          "PanedWindow::_move_sash $top $xmin $xmax %X +%%d+$yr"
        _move_sash $top $xmin $xmax $x "+%d+$yr"
    } else {
        $top configure -cursor sb_v_double_arrow
        set w    [winfo width $path]
        set xr   [winfo rootx $path.sash$num]
        set ymin [expr $wsash/2+[winfo rooty $fprev]+$minszg]
        set ymax [expr -$wsash/2-1+[winfo rooty $fnext]+[winfo height $fnext]-$minszd]
        wm overrideredirect $top 1
        wm geom $top "${w}x2+$xr+$y"

        update idletasks
        grab set $top
        bind $top <ButtonRelease-1> "PanedWindow::_end_move_sash $path $top $num $ymin $ymax %Y rooty height"
        bind $top <Motion>          "PanedWindow::_move_sash $top $ymin $ymax %Y +$xr+%%d"
        _move_sash $top $ymin $ymax $y "+$xr+%d"
    }
}


# ------------------------------------------------------------------------------
#  Command PanedWindow::_move_sash
# ------------------------------------------------------------------------------
proc PanedWindow::_move_sash { top min max v form } {

    if { $v < $min } {
	set v $min
    } elseif { $v > $max } {
	set v $max
    }
    wm geom $top [format $form $v]
}


# ------------------------------------------------------------------------------
#  Command PanedWindow::_end_move_sash
# ------------------------------------------------------------------------------
proc PanedWindow::_end_move_sash { path top num min max v rootv size } {
    variable _panedw

    destroy $top
    if { $v < $min } {
	set v $min
    } elseif { $v > $max } {
	set v $max
    }
    set fprev $path.f[expr $num-1]
    set fnext $path.f$num

    $path.sash$num.but configure -relief raised

    set wsash [expr [Widget::getoption $path -width] + 2*[Widget::getoption $path -pad]]
    set dv    [expr $v-[winfo $rootv $path.sash$num]-$wsash/2]
    set w1    [winfo $size $fprev]
    set w2    [winfo $size $fnext]

    for {set i 0} {$i < $_panedw($path,nbpanes)} {incr i} {
        if { $i == $num-1} {
            $fprev configure -$size [expr [winfo $size $fprev]+$dv]
        } elseif { $i == $num } {
            $fnext configure -$size [expr [winfo $size $fnext]-$dv]
        } else {
            $path.f$i configure -$size [winfo $size $path.f$i]
        }
    }
}


# ------------------------------------------------------------------------------
#  Command PanedWindow::_realize
# ------------------------------------------------------------------------------
proc PanedWindow::_realize { path width height } {
    variable _panedw

    set x    0
    set y    0
    set hc   [winfo reqheight $path]
    set hmax 0
    for {set i 0} {$i < $_panedw($path,nbpanes)} {incr i} {
        $path.f$i configure \
            -width  [winfo reqwidth  $path.f$i.frame] \
            -height [winfo reqheight $path.f$i.frame]
        place $path.f$i.frame -x 0 -y 0 -relwidth 1 -relheight 1
    }

    bind $path <Configure> {}
}