ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/getfile3.6.tcl
(Generate patch)

Comparing ray/src/util/getfile3.6.tcl (file contents):
Revision 2.2 by greg, Fri Oct 28 10:43:36 1994 UTC vs.
Revision 2.7 by greg, Wed Nov 30 16:47:00 1994 UTC

# Line 1 | Line 1
1   # SCCSid "$SunId$ LBL"
2   #
3 < # Usage: getfile [-win w] [-perm] [-glob pattern] [-view proc] [-send proc]
3 > # Usage: getfile [-win w] [-grab] [-perm] [-glob pattern] [-view proc] [-send proc]
4   #
5   # Create a dialog box (in window w if given) to get file name.
6 + # If -grab option is given, then getfile does a local grab on its window.
7   # Normally, a single file name and return as value.
8   # If perm switch is given, keep window up for multiple file entries.
9   # If pattern is given, start with list of all the specified files,
# Line 19 | Line 20 | proc getfile args {            # get filename interactively
20          # Set defaults
21          set w .fpwin
22          set topwin 1
23 +        set dograb 0
24          set curdir .
25          set curpat *
26          set transient 1
# Line 30 | Line 32 | proc getfile args {            # get filename interactively
32                                  set topwin 0
33                                  set args [lreplace $args 1 1]
34                                  }
35 +                        -grab {
36 +                                set dograb 1
37 +                                }
38                          -perm* {
39                                  set transient 0
40                                  }
# Line 63 | Line 68 | proc getfile args {            # get filename interactively
68                  frame $w -geometry 400x410
69                  pack $w
70          }
71 +        if $dograb { grab $w }
72 +        $w configure -cursor top_left_arrow
73          label $w.dt -text Directory:
74 <        place $w.dt -relx .0625 -rely .03125 -relwidth .15625 -relheight .0625
74 >        place $w.dt -relx .025 -rely .03125
75          helplink $w.dt file directory intro
76          button $w.ls -text List -command "update_dir $w"
77 <        place $w.ls -relx .0625 -rely .125 -relwidth .125 -relheight .0625
77 >        place $w.ls -relx .025 -rely .125 -relwidth .15 -relheight .0625
78          helplink $w.ls file directory list
79          entry $w.de -textvariable curdir -relief sunken
80          place $w.de -relx .25 -rely .03125 -relwidth .6875 -relheight .0625
# Line 95 | Line 102 | proc getfile args {            # get filename interactively
102          } else {
103                  bind $w.fm.fl <Double-Button-1> "set_curfile $w"
104                  label $w.fl -text File:
105 <                place $w.fl -relx .10625 -rely .875 \
99 <                                -relwidth .10625 -relheight .0625
105 >                place $w.fl -relx .10625 -rely .875
106                  entry $w.fn -relief sunken -textvariable curfile
107                  place $w.fn -relx .25 -rely .875 \
108                                  -relwidth .6875 -relheight .0625
# Line 110 | Line 116 | proc getfile args {            # get filename interactively
116          }
117          if {$transient != [info exists sendproc]} {
118                  button $w.ok -text OK -command "destroy $w"
119 <                place $w.ok -relx .0625 -rely .28125 \
120 <                                -relwidth .125 -relheight .0625
119 >                place $w.ok -relx .025 -rely .28125 \
120 >                                -relwidth .15 -relheight .0625
121          }
122          if {$transient || [info exists sendproc]} {
123                  button $w.cancel -text Cancel \
124                                  -command "destroy $w; unset curdir"
125 <                place $w.cancel -relx .0625 -rely .375 \
126 <                                -relwidth .125 -relheight .0625
125 >                place $w.cancel -relx .025 -rely .375 \
126 >                                -relwidth .15 -relheight .0625
127          }
128          if [info exists viewproc] {
129                  button $w.vi -text View -state disabled \
130                  -command "$viewproc \[$w.fm.fl get \[$w.fm.fl curselection\]\]"
131 <                place $w.vi -relx .0625 -rely .46875 \
132 <                                -relwidth .125 -relheight .0625
131 >                place $w.vi -relx .025 -rely .46875 \
132 >                                -relwidth .15 -relheight .0625
133                  bind $w.fm.fl <ButtonRelease-1> "+chk_select $w"
134                  helplink $w.vi file file view
135          }
# Line 157 | Line 163 | proc update_dir w {                    # Update working directory
163          if {"$curpat" == ""} {
164                  set curpat *
165          }
166 +        if {"$curdir" == {}} {set curdir {~}}
167          if [catch {cd $curdir} curdir] {
168                  set oldcol [lindex [$w.de config -foreground] 4]
169                  $w.de config -foreground Red
# Line 165 | Line 172 | proc update_dir w {                    # Update working directory
172                  $w.de config -foreground $oldcol
173          }
174          set curdir [pwd]
175 +        set offset [expr [string length $curdir] - 32]
176 +        if {$offset > 0} {
177 +                $w.de view [expr $offset + \
178 +                        [string first / [string range $curdir $offset end]] \
179 +                                + 1]
180 +        }
181          $w.fm.fl delete 0 end
182          set ls ../
183 <        foreach f [glob *] {
183 >        foreach f [glob -nocomplain *] {
184                  if [file isdirectory $f] {
185                          lappend ls $f/
186                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines