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

Comparing ray/src/util/trad.wsh (file contents):
Revision 2.6 by greg, Sat Nov 5 09:43:29 1994 UTC vs.
Revision 2.17 by greg, Wed May 1 16:47:54 2019 UTC

# Line 1 | Line 1
1 < #!/usr/local/bin/wish -f
2 < # SCCSid "$SunId$ LBL"
1 > #!/usr/bin/wish
2 > # RCSid: $Id$
3 > # the next line restarts using wish in case of shell execution \
4 > exec wish "$0" "$@"
5   #
6   # TCL/TK-based Rad Input File Editor
7   #
# Line 11 | Line 13 | set helplib $radlib
13  
14   set auto_path [linsert $auto_path 0 $radlib]
15  
16 + # Assign global globbing variables
17 +
18 + set myglob(rif) *.rif
19 + set myglob(materials) *.mat
20 + set myglob(illum) *.rad
21 + set myglob(scene) *.rad
22 + set myglob(objects) *
23 +
24   # Create required procedures
25  
26   proc modified {} {      # check for radvar modification
# Line 27 | Line 37 | proc modified {} {     # check for radvar modification
37  
38   proc chksave {} {       # check if RIF is saved and accost user if not
39          global readonly rifname oldradvar curmess
40 <        if $readonly {
41 <                set warnmess "You have modified variables, but the file\
42 < \"[file tail $rifname]\" was opened read-only.
40 >        if [modified] {
41 >                if $readonly {
42 >                        set warnmess "You have modified variables, but the\
43 > file \"[file tail $rifname]\" was opened read-only.
44   Do you wish to save this information somehow?"
45 <                set yesmess {Go to File Screen}
46 <        } else {
47 <                set warnmess "The file \"[file tail $rifname]\" has been\
48 < modified since it was last saved.
45 > set yesmess {Go to File Screen}
46 >                } else {
47 >                        set warnmess "The file \"[file tail $rifname]\" has\
48 > been modified since it was last saved.
49   Do you wish to save it now?"
50 <                set yesmess {Save File}
51 <        }
41 <        if [modified] {
50 >                        set yesmess {Save File}
51 >                }
52                  switch [tk_dialog .dlg {File Modified} $warnmess \
53                                  warning 0 $yesmess {Discard Changes} \
54                                  {Cancel Operation}] {
# Line 46 | Line 56 | Do you wish to save it now?"
56                          2 { return 0 }
57                  }
58                  if $readonly {
49                        .file invoke
59                          set curmess {Rename file or uncheck read-only to save.}
60 +                        .file invoke
61                          return 0
62 <                } else {
63 <                        catch {unset oldradvar}
64 <                        save_vars $rifname
62 >                } elseif {[save_vars $rifname]} {
63 >                        gotfile 1
64 >                        return 1
65                  }
66 <        } else { return 1 }
66 >                return 0
67 >        }
68 >        return 1
69   }
70  
71   # Set global variable default values
# Line 77 | Line 89 | set smallscrn [expr [winfo screenwidth .] < 830]
89  
90   message .mess -relief ridge -font fixed -textvariable curmess -anchor nw
91   if $smallscrn {
92 <        frame .upper -geometry 640x410
93 <        frame .upper.right -geometry 120x410
92 >        frame .upper -width 640 -height 410
93 >        frame .upper.right -width 120 -height 410
94          .mess configure -width 640
95   } else {
96 <        frame .upper -geometry 830x410
97 <        frame .upper.right -geometry 130x410
96 >        frame .upper -width 830 -height 410
97 >        frame .upper.right -width 130 -height 410
98          .mess configure -width 830
99   }
100   pack .upper -side top
# Line 104 | Line 116 | proc changescreen {} {         # switch screen according to c
116          set curscreen $curmode
117          do_$curscreen .upper.left
118          if $smallscrn {
119 <                .upper.left configure -geometry 520x410
119 >                .upper.left configure -width 520 -height 410
120          } else {
121 <                .upper.left configure -geometry 700x410
121 >                .upper.left configure -width 700 -height 410
122          }
123          place .upper.left -x 0 -y 0
124   }
# Line 117 | Line 129 | pack .upper.right.title -side top -pady 10
129   proc setbutt v {
130          radiobutton .$v -text [string toupper $v] \
131                          -variable curmode -value $v \
132 <                        -width 9 -relief groove -anchor w \
132 >                        -width 10 -relief groove -anchor w \
133                          -command changescreen
134          pack .$v -in .upper.right -side top -pady 5
135          helplink .$v trad $v intro
# Line 133 | Line 145 | setbutt results
145   rename setbutt {}
146   button .upper.right.help -text HELP -width 9 \
147                  -command "gethelp trad trad intro"
148 < pack .upper.right.help -side top -pady 10 -anchor se
148 > pack .upper.right.help -side top -pady 5 -anchor se
149   helplink .upper.right.help trad trad help
150   button .upper.right.quit -text QUIT \
151                  -command {if [chksave] {destroy .}} -width 9
152 < pack .upper.right.quit -side top -pady 10 -anchor se
152 > pack .upper.right.quit -side top -pady 5 -anchor se
153   helplink .upper.right.quit trad trad quit
154  
155   if $smallscrn {
# Line 149 | Line 161 | if $smallscrn {
161   }
162   wm iconbitmap . @$radlib/trad.icon
163  
164 < proc gotfile {{o 1}} {          # set file possession state
164 > proc gotfile o {                # set file possession state
165          global oldradvar radvar
166          catch {unset oldradvar}
167          if $o {
# Line 167 | Line 179 | proc gotfile {{o 1}} {         # set file possession state
179  
180   # Decide where to go and start
181  
182 + gotfile 0
183   if {[llength $argv] == 0} {
171        gotfile 0
184          set curmess "Choose a Radiance project file."
185          .file invoke
186   } elseif {[llength $argv] == 1} {
187          cd [file dirname $argv]
188          set curfile [file tail $argv]
189 <        if {! [file exists $curfile]} {
190 <                newnew $curfile
191 <                .scene invoke
189 >        if {! [file isfile $curfile]} {
190 >                if [newnew $curfile] {
191 >                        .scene invoke
192 >                } else {
193 >                        .file invoke
194 >                }
195          } elseif {[newload $curfile]} {
196                  if $alldone {
197                          set curmess "All renderings are finished."

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines