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