1 # Copyright 1999 Jean-Louis Thirot
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 proc TkW
:dirbrowse
{pattern patternF mode
} {
19 # input arg: initial pattern mode (File or Folder
20 # returns selected folders as a global SelectFolder
21 # or selected file as a global: SelectFile
22 # variable: SelectFolder
24 # You can use WAITbrowse in the calling app to wait
25 # for dirbrowse to exit (set to 0 on exit, or -1 on CANCEL)
29 if {![info exists SelectFile
]} {set SelectFile
""}
30 if {![info exists SelectFolder
]} {set SelectFolder
[pwd]}
31 global ndirs nfiles
;set ndirs
0;set nfiles
0
32 global ModeBrowse Restore
;set Restore
$SelectFolder
34 if {$mode == "local"} {set FTPcd
1} {set FTPcd
0}
36 global DIRBROWSE WinBrowse
40 if {$mode != "local" } {
41 toplevel .dirbrowse
-class Toplevel
\
43 wm focusmodel .dirbrowse passive
44 wm geometry .dirbrowse
464x296
45 wm maxsize .dirbrowse
1265 994
46 wm minsize .dirbrowse
1 1
47 wm overrideredirect .dirbrowse
0
48 wm resizable .dirbrowse
1 1
49 wm deiconify .dirbrowse
50 wm title .dirbrowse
"TkWine: $DIRBROWSE"
51 set WinBrowse dirbrowse
53 set WinBrowse ftp.browsers.local
54 #frame .$WinBrowse -background #feffff -height 300 -width 464
58 global FolderSelection OK CANCEL FILTERFOLD FILTERFILES
59 global RESCAN VIEW HELP
61 global BrowsePattern
;set BrowsePattern
$pattern
62 global BrowsePatternF
;set BrowsePatternF
$patternF
63 global dirscroll MouseY
66 # label and entrybox for selection:
67 label .
$WinBrowse.foldselLab
\
68 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-* \
69 -relief groove
-text $FolderSelection
70 entry .
$WinBrowse.foldsel
\
71 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-* \
72 -textvariable SelectFolder
73 if {$ModeBrowse == "File"} {
74 .
$WinBrowse.foldsel configure
-textvar SelectFile
76 # frame for display of currently available folders:
77 frame .
$WinBrowse.dirframe
\
78 -borderwidth 1 -height 30 -relief sunken
-width 30 \
80 scrollbar .
$WinBrowse.dirframe_scr
-width 10
81 frame .
$WinBrowse.fileframe
\
82 -borderwidth 1 -height 30 -relief sunken
-width 30
83 scrollbar .
$WinBrowse.fileframe_scr
-width 10
84 # label/entry for pattern
85 label .
$WinBrowse.patternLab
\
86 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-* \
87 -relief groove
-text $FILTERFOLD
88 entry .
$WinBrowse.patternF
\
89 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-* \
90 -textvariable BrowsePatternF
91 label .
$WinBrowse.patternLabF
\
92 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-* \
93 -relief groove
-text $FILTERFILES
94 entry .
$WinBrowse.pattern
\
95 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-* \
96 -textvariable BrowsePattern
97 frame .
$WinBrowse.fra25
\
98 -borderwidth 1 -height 30 -relief sunken
-width 30
99 menubutton .
$WinBrowse.fra25.men26
\
100 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-* \
101 -menu .
$WinBrowse.fra25.men26.m
-padx 4 -pady 3 -relief ridge
-text $VIEW
102 menu .
$WinBrowse.fra25.men26.m
\
103 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-*
104 button .
$WinBrowse.fra25.but28
\
105 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-* -padx 9 \
106 -pady 3 -relief ridge
-text $HELP
107 button .
$WinBrowse.butOK
\
108 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-* -padx 9 \
110 -command {destroy .
$WinBrowse
112 return "$SelectFolder $SelectFile"
114 button .
$WinBrowse.butCANCEL
\
115 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-* -padx 9 \
116 -pady 3 -text $CANCEL \
117 -command {destroy .
$WinBrowse
119 return "$SelectFolder $SelectFile"
121 button .
$WinBrowse.butRESCAN
\
122 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-* -padx 9 \
123 -pady 3 -text $RESCAN -command {TkW
:DisplayCurrentDir
$BrowsePattern}
127 global YHeight
;set YHeight
170
128 if {$mode !="local" && $mode != "remote"} {
129 place .
$WinBrowse.foldselLab
\
130 -x 47 -y 270 -width 78 -height 20 -anchor nw
-bordermode ignore
131 place .
$WinBrowse.foldsel
\
132 -x 148 -y 268 -width 290 -height 24 -anchor nw
-bordermode ignore
133 place .
$WinBrowse.dirframe
\
134 -x 5 -y 90 -width 145 -height $YHeight -anchor nw
-bordermode ignore
135 place .
$WinBrowse.dirframe_scr
-x 150 -y 90 -width 17 -height $YHeight
136 place .
$WinBrowse.fileframe
\
137 -x 180 -y 90 -width 175 -height 170 -anchor nw
-bordermode ignore
138 place .
$WinBrowse.fileframe_scr
-x 355 -y 90 -width 17 -height $YHeight
139 place .
$WinBrowse.patternLab
\
140 -x 27 -y 60 -width 143 -height 20 -anchor nw
-bordermode ignore
141 place .
$WinBrowse.pattern
\
142 -x 190 -y 58 -width 150 -height 24 -anchor nw
-bordermode ignore
143 place .
$WinBrowse.patternLabF
\
144 -x 27 -y 35 -width 143 -height 20 -anchor nw
-bordermode ignore
145 place .
$WinBrowse.patternF
\
146 -x 190 -y 32 -width 150 -height 24 -anchor nw
-bordermode ignore
147 place .
$WinBrowse.fra25
\
148 -x 0 -y 1 -width 455 -height 25 -anchor nw
-bordermode ignore
149 place .
$WinBrowse.fra25.men26
\
150 -x -1 -y 0 -width 67 -height 24 -anchor nw
-bordermode ignore
151 place .
$WinBrowse.fra25.but28
\
152 -x 397 -y -3 -width 60 -height 28 -anchor nw
-bordermode ignore
153 place .
$WinBrowse.butOK
\
154 -x 380 -y 115 -width 77 -height 28 -anchor nw
-bordermode ignore
155 place .
$WinBrowse.butCANCEL
\
156 -x 380 -y 155 -width 77 -height 28 -anchor nw
-bordermode ignore
157 place .
$WinBrowse.butRESCAN
\
158 -x 380 -y 195 -width 77 -height 28 -anchor nw
-bordermode ignore
160 # case of ftp filebrowser ....
162 bind .
$WinBrowse.pattern
<Return
> {.
$WinBrowse.butRESCAN invoke
}
163 bind .
$WinBrowse.patternF
<Return
> {.
$WinBrowse.butRESCAN invoke
}
165 place .
$WinBrowse.pattern
-x 0 -y 3 -width 145 -height 25
166 place .
$WinBrowse.patternF
-x 163 -y 3 -width 145 -height 25
168 place .
$WinBrowse.dirframe
-x 0 -y 28 -width 145 -height $YHeight
169 place .
$WinBrowse.dirframe_scr
-x 145 -y 28 -width 17 -height $YHeight
170 place .
$WinBrowse.fileframe
-x 163 -y 28 -width 145 -height $YHeight
171 place .
$WinBrowse.fileframe_scr
-x 308 -y 28 -width 17 -height $YHeight
175 # binding the scrollbar:
176 bind .
$WinBrowse.dirframe_scr
<ButtonPress
> { TkW
:ScrollDirs
%x
%y
}
177 bind .
$WinBrowse.dirframe_scr
<ButtonRelease
> { set dirscroll no
; grab release .
$WinBrowse.dirframe_scr
}
178 bind .
$WinBrowse.dirframe_scr
<Motion
> { set MouseY
%y
}
180 bind .
$WinBrowse.fileframe_scr
<ButtonPress
> { TkW
:ScrollFiles
%x
%y
}
181 bind .
$WinBrowse.fileframe_scr
<ButtonRelease
> { set filescroll no
; grab release .
$WinBrowse.fileframe_scr
}
182 bind .
$WinBrowse.fileframe_scr
<Motion
> { set MouseY
%y
}
185 image create
photo "fold" -file \
186 $TKW/shared
/icons
/smalls
/small_folder_yellow.gif
187 image create
photo "unknown" -file \
188 $TKW/shared
/icons
/smalls
/unknown.gif
189 image create
photo "execfile" -file \
190 $TKW/shared
/icons
/smalls
/exec.gif
191 image create
photo "imgfile" -file \
192 $TKW/shared
/icons
/smalls
/xpaint.gif
193 image create
photo "htmlfile" -file \
194 $TKW/shared
/icons
/smalls
/html.gif
195 #image create photo "up" -file $TKW/shared/icons/up.gif
196 TkW
:DisplayCurrentDir
$BrowsePattern
199 proc TkW
:DisplayCurrentDir
{BrowsePattern
} {
201 global ndirs nfiles Ybase dirlist filelist FYbase specialwhere
202 global FYbase BrowsePatternF ModeBrowse
208 # First we get the directory list:
210 if {$ModeBrowse != "remote"} {
212 set fileList
[glob -nocomplain [pwd]/$BrowsePattern]
213 set fileList
"$fileList [glob -nocomplain [pwd]/.$BrowsePattern]"
215 foreach i
$fileList {
216 if {[file tail
$i] == ".."} {set UpLevel
1}
217 if { [file isdir
$i] } { set dirlist
"$dirlist \"$i\"" }
220 set fileList
[glob -nocomplain [pwd]/$BrowsePatternF]
221 set fileList
"$fileList [glob -nocomplain [pwd]/.$BrowsePatternF]"
222 foreach i
$fileList {
223 if { ![file isdir
$i] } { set filelist
"$filelist \"$i\"" }
225 if {$UpLevel == 0} {set dirlist
".. $dirlist"}
226 set dirlist
[lsort $dirlist]
227 set filelist
[lsort $filelist]
228 } else {set filelist
""; set dirlist
".."}
235 proc TkW
:ShowDirs
{} {
243 set inout
[TkW
:showdir
$i]
244 if {$inout == 0} {set showedIn
[expr $showedIn + 1]}
245 if {$inout == -1} {set showedabove
[expr $showedabove + 1]}
246 if {$inout == 1} {set showedbelow
[expr $showedbelow + 1]}
248 # Scrollbars management:
249 TkW
:DirBrowseScroll
[expr (100.
*$showedabove/$ndirs)/100.
] \
250 [expr 1.
- (100.
*$showedbelow/$ndirs)/100.
]
254 proc TkW
:DirBrowseScroll
{ y1 y2
} {
255 global SliderY1 SliderY2 WinBrowse
258 .
$WinBrowse.dirframe_scr
set $y1 $y2
260 proc TkW
:FileBrowseScroll
{ y1 y2
} {
261 global FSliderY1 FSliderY2 WinBrowse
264 .
$WinBrowse.fileframe_scr
set $y1 $y2
266 proc TkW
:hilightFold
{y
} {
268 global YDIRS ndirs DIRS SelectNum WinBrowse
269 global SelectFolder BrowsePattern FTPcd
271 if { $y > $YDIRS($ndirs)} {set num
$ndirs} else {
277 $y <= $YDIRS([expr $i + 1])} {
280 } else { set i
[expr $i + 1] }
285 if {$SelectFolder == $DIRS($num)} {
287 if {$FTPcd == 1} {FTP_Lcd
$SelectFolder}
288 set SelectFolder
[pwd]
289 TkW
:DisplayCurrentDir
$BrowsePattern
292 .
$WinBrowse.dirframe.
label$num configure
-background #ffffff
293 set SelectFolder
$DIRS($num)
294 if {[info exists SelectNum
]} {
295 .
$WinBrowse.dirframe.
label$SelectNum configure
\
304 proc TkW
:showdir
{fulldirname
} {
305 global TKW ndirs Ybase YHeight YDIRS DIRS Ydecal ModeBrowse WinBrowse
307 set dirname
[file tail
$fulldirname]
308 if {$dirname == "."} return
309 set Y
[expr $Ybase + $ndirs * $Ydecal]
311 if {$Y < 0 } {set In
-1}
312 if {$Y > [expr $YHeight - $Ydecal]} { set In
1 }
315 set ndirs
[expr $ndirs + 1]
317 set DIRS
($ndirs) $fulldirname
318 label .
$WinBrowse.dirframe.icon
$ndirs -image fold
319 label .
$WinBrowse.dirframe.
label$ndirs -text $dirname\
320 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-*
323 place .
$WinBrowse.dirframe.icon
$ndirs -x 5 -y $Y
324 place .
$WinBrowse.dirframe.
label$ndirs -x 30 -y $Y
328 bind .
$WinBrowse.dirframe.icon
$ndirs <Button-1
> {
329 set Y
[expr %Y
- [winfo rooty .
$WinBrowse.dirframe
] -$Ybase]
333 bind .
$WinBrowse.dirframe.
label$ndirs <ButtonPress-1
> {
334 set Y
[expr %Y
- [winfo rooty .
$WinBrowse.dirframe
] -$Ybase]
340 proc TkW
:ScrollDirs
{X Y
} {
342 global Ybase Ydecal ndirs dirscroll
global nextLoop MouseY WinBrowse
343 global SliderY1 SliderY2 YHeight Nabove Nbelow
345 set MinBase
[expr -$Ydecal * ($ndirs - [expr $YHeight/$Ydecal])]
346 set Slider1
$SliderY1
347 set Slider2
$SliderY2
348 set MaxSlide1
[expr 1-($SliderY2-$SliderY1)]
349 set MinSlide2
[expr $SliderY2-$SliderY1]
350 switch [.
$WinBrowse.dirframe_scr identify
$X $Y] {
352 {arrow1
} { set dirscroll UP
; set modeUP
1}
353 {arrow2
} { set dirscroll DOWN
;set modeDOWN
1}
354 {slider
} {set dirscroll SLIDER
}
355 {trough1
} {set dirscroll UP
; set modeUP page
}
356 {trough2
} {set dirscroll DOWN
;set modeDOWN page
}
358 while {$dirscroll == "UP"} {
359 if {$modeUP == "1"} {set XUP
1} {
360 set XUP
[expr ($YHeight/$Ydecal ) -1]
362 set Ybase
[expr $Ybase + $XUP * $Ydecal]
363 if {$Ybase > $Ydecal} {
367 set Slider2
$MinSlide2
370 TkW
:DirBrowseScroll
[expr (100.
*$Nabove/$ndirs)/100.
] \
371 [expr 1.
- (100.
*$Nbelow/$ndirs)/100.
]
373 after 30 {set nextLoop
1}
374 while {$nextLoop == 0} {update}
375 set Slider1
$SliderY1
376 set Slider2
$SliderY2
378 while {$dirscroll == "DOWN"} {
379 if {$modeDOWN == "1"} {set XDOWN
1} {
380 set XDOWN
[expr ($YHeight/$Ydecal ) -1]
382 set Ybase
[expr $Ybase - $XDOWN * $Ydecal]
383 if {$Ybase < $MinBase} {
387 set Slider1
$MaxSlide1
390 TkW
:DirBrowseScroll
[expr (100.
*$Nabove/$ndirs)/100.
] \
391 [expr 1.
- (100.
*$Nbelow/$ndirs)/100.
]
393 after 30 {set nextLoop
1}
394 while {$nextLoop == 0} {update}
395 set Slider1
$SliderY1
396 set Slider2
$SliderY2
398 while {$dirscroll == "SLIDER"} {
400 after 20 {set nextLoop
1}
401 while {$nextLoop == 0} {
402 set Delta
[expr (100.
*($MouseY - $Y)/$YHeight)/100.
]
403 set Slider1
[expr $SliderY1 +$Delta]
404 set Slider2
[expr $SliderY2 +$Delta]
407 set Slider1
$MaxSlide1
411 set Slider2
$MinSlide2
413 .
$WinBrowse.dirframe_scr
set $Slider1 $Slider2
414 set Ybase
[expr 5 - $Slider1 * $ndirs *$Ydecal]
419 set SliderY1
$Slider1
420 set SliderY2
$Slider2
422 proc TkW
:ScrollFiles
{X Y
} {
424 global FYbase Ydecal nfiles filescroll nextLoop MouseY WinBrowse
425 global FSliderY1 FSliderY2 YHeight NFabove NFbelow
427 set MinBase
[expr -$Ydecal * ($nfiles - [expr $YHeight/$Ydecal])]
428 set FSlider1
$FSliderY1
429 set FSlider2
$FSliderY2
430 set MaxSlide1
[expr 1-($FSliderY2-$FSliderY1)]
431 set MinSlide2
[expr $FSliderY2-$FSliderY1]
432 switch [.
$WinBrowse.fileframe_scr identify
$X $Y] {
434 {arrow1
} { set filescroll UP
; set modeUP
1}
435 {arrow2
} { set filescroll DOWN
;set modeDOWN
1}
436 {slider
} {set filescroll SLIDER
}
437 {trough1
} {set filescroll UP
; set modeUP page
}
438 {trough2
} {set filescroll DOWN
;set modeDOWN page
}
440 while {$filescroll == "UP"} {
441 if {$modeUP == "1"} {set XUP
1} {
442 set XUP
[expr ($YHeight/$Ydecal ) -1]
444 set FYbase
[expr $FYbase + $XUP * $Ydecal]
445 if {$FYbase > $Ydecal} {
449 set FSlider2
$MinSlide2
453 TkW
:FileBrowseScroll
[expr (100.
*$NFabove/$nfiles)/100.
] \
454 [expr 1.
- (100.
*$NFbelow/$nfiles)/100.
]
456 TkW
:FileBrowseScroll
0 1
459 after 30 {set nextLoop
1}
460 while {$nextLoop == 0} {update}
461 set FSlider1
$FSliderY1
462 set FSlider2
$FSliderY2
464 while {$filescroll == "DOWN"} {
465 if {$modeDOWN == "1"} {set XDOWN
1} {
466 set XDOWN
[expr ($YHeight/$Ydecal ) -1]
468 set FYbase
[expr $FYbase - $XDOWN * $Ydecal]
469 if {$FYbase < $MinBase} {
473 set FSlider1
$MaxSlide1
477 TkW
:FileBrowseScroll
[expr (100.
*$NFabove/$nfiles)/100.
] \
478 [expr 1.
- (100.
*$NFbelow/$nfiles)/100.
]
480 TkW
:FileBrowseScroll
0 1
483 after 30 {set nextLoop
1}
484 while {$nextLoop == 0} {update}
485 set FSlider1
$FSliderY1
486 set FSlider2
$FSliderY2
488 while {$filescroll == "SLIDER"} {
490 after 20 {set nextLoop
1}
491 while {$nextLoop == 0} {
492 set Delta
[expr (100.
*($MouseY - $Y)/$YHeight)/100.
]
493 set FSlider1
[expr $FSliderY1 +$Delta]
494 set FSlider2
[expr $FSliderY2 +$Delta]
497 set FSlider1
$MaxSlide1
501 set FSlider2
$MinSlide2
503 .
$WinBrowse.fileframe_scr
set $FSlider1 $FSlider2
504 set FYbase
[expr 5 - $FSlider1 * $nfiles *$Ydecal]
509 set FSliderY1
$FSlider1
510 set FSliderY2
$FSlider2
513 proc TkW
:ReShowDirs
{} {
514 global dirlist Ybase Ydecal ndirs YHeight WinBrowse
520 set dirname
[file tail
$i]
521 if {$dirname != "."} {
522 set Y0
[expr $Ybase + $n * $Ydecal]
523 if {$Y0 < -5} {set Nabove
[expr $Nabove + 1]}
524 if {$Y0 > [expr $YHeight - $Ydecal]} { set Nbelow
[expr $Nbelow + 1]}
526 place .
$WinBrowse.dirframe.icon
$n -x 5 -y $Y0
527 place .
$WinBrowse.dirframe.
label$n -x 30 -y $Y0
531 proc TkW
:ReShowFiles
{} {
532 global filelist FYbase Ydecal nfiles YHeight WinBrowse
533 global NFabove NFbelow
537 foreach i
$filelist {
538 set filename [file tail
$i]
539 if {$filename != "."} {
540 set Y0
[expr $FYbase + $n * $Ydecal]
541 if {$Y0 < -5} {set NFabove
[expr $NFabove + 1]}
542 if {$Y0 > [expr $YHeight - $Ydecal]} { set NFbelow
[expr $NFbelow + 1]}
544 place .
$WinBrowse.fileframe.icon
$n -x 5 -y $Y0
545 place .
$WinBrowse.fileframe.
label$n -x 30 -y $Y0
550 proc TkW
:ShowFiles
{} {
551 global filelist nfiles
557 foreach i
$filelist {
558 set inout
[TkW
:showfile
$i]
559 if {$inout == 0} {set FshowedIn
[expr $FshowedIn + 1]}
560 if {$inout == -1} {set NFabove
[expr $NFabove + 1]}
561 if {$inout == 1} {set NFbelow
[expr $NFbelow + 1]}
563 # Scrollbar management:
565 TkW
:FileBrowseScroll
[expr (100.
*$NFabove/$nfiles)/100.
] \
566 [expr 1.
- (100.
*$NFbelow/$nfiles)/100.
]
568 TkW
:FileBrowseScroll
0 1
572 proc TkW
:showfile
{fullfilename
} {
573 global TKW nfiles FYbase YHeight YFILES Ydecal FILES
574 set Y
[expr $FYbase + $nfiles * $Ydecal]
576 if {$Y < 0 } {set In
-1}
577 if {$Y > [expr $YHeight - $Ydecal]} { set In
1 }
580 set nfiles
[expr $nfiles + 1]
581 set YFILES
($nfiles) $Y
582 set FILES
($nfiles) $fullfilename
583 createPlaceFileIcon
$nfiles $Y
586 proc createPlaceFileIcon
{n Y
} {
587 global FILES ModeBrowse WinBrowse
588 set fullfilename
$FILES($n)
590 if {[file executable
$fullfilename]} {set icon execfile
}
591 if {[file extension
$fullfilename] == ".html"} {set icon htmlfile
}
592 if {[file extension
$fullfilename] == ".htm"} {set icon htmlfile
}
593 if {[file extension
$fullfilename] == ".gif"} {set icon imgfile
}
594 if {[file extension
$fullfilename] == ".jpg"} {set icon imgfile
}
595 set filename [file tail
$fullfilename]
596 label .
$WinBrowse.fileframe.icon
$n -image $icon
597 label .
$WinBrowse.fileframe.
label$n -text $filename\
598 -font -Adobe-Helvetica
-Medium
-R
-Normal
-*-*-120-*-*-*-*-*-*\
601 place .
$WinBrowse.fileframe.icon
$n -x 5 -y $Y
602 place .
$WinBrowse.fileframe.
label$n -x 30 -y $Y
604 if {$ModeBrowse == "File"} {
606 bind .
$WinBrowse.fileframe.icon
$n <Button-1
> {
607 set Y
[expr %Y
- [winfo rooty .
$WinBrowse.fileframe
] -$FYbase]
610 bind .
$WinBrowse.fileframe.icon
$n <Double-Button-1
> {
613 return "$SelectFolder $SelectFile"
616 bind .
$WinBrowse.fileframe.
label$n <ButtonPress-1
> {
617 set Y
[expr %Y
- [winfo rooty .
$WinBrowse.fileframe
] -$FYbase]
620 bind .
$WinBrowse.fileframe.
label$n <Double-Button-1
> {
623 return "$SelectFolder $SelectFile"
628 proc DestroyDirs
{} {
629 global ndirs WinBrowse
631 for {set i
1} {$i <= $ndirs} {set i
[expr $i + 1 ]} {
632 if {[winfo exists .
$WinBrowse.dirframe.icon
$i]} {
633 destroy .
$WinBrowse.dirframe.icon
$i
634 destroy .
$WinBrowse.dirframe.
label$i
638 proc DestroyFiles
{} {
639 global nfiles WinBrowse
641 for {set i
1} {$i <= $nfiles} {set i
[expr $i + 1 ]} {
642 if {[winfo exists .
$WinBrowse.fileframe.icon
$i]} {
643 destroy .
$WinBrowse.fileframe.icon
$i
644 destroy .
$WinBrowse.fileframe.
label$i
649 proc TkW
:hilightFile
{y
} {
651 global YFILES nfiles FILES SelectNumF WinBrowse
652 global SelectFile BrowsePattern
654 if { $y > $YFILES($nfiles)} {set num
$nfiles} else {
660 $y <= $YFILES([expr $i + 1])} {
663 } else { set i
[expr $i + 1] }
668 if {$SelectFile == $FILES($num)} {
671 .
$WinBrowse.fileframe.
label$num configure
-background #ffffff
672 set SelectFile
$FILES($num)
673 if {[info exists SelectNumF
]} {
674 .
$WinBrowse.fileframe.
label$SelectNumF configure
-background #dddddd