| 27 |
|
|
| 28 |
|
proc chksave {} { # check if RIF is saved and accost user if not |
| 29 |
|
global readonly rifname oldradvar curmess |
| 30 |
< |
if $readonly { |
| 31 |
< |
set warnmess "You have modified variables, but the file\ |
| 32 |
< |
\"[file tail $rifname]\" was opened read-only. |
| 30 |
> |
if [modified] { |
| 31 |
> |
if $readonly { |
| 32 |
> |
set warnmess "You have modified variables, but the\ |
| 33 |
> |
file \"[file tail $rifname]\" was opened read-only. |
| 34 |
|
Do you wish to save this information somehow?" |
| 35 |
< |
set yesmess {Go to File Screen} |
| 36 |
< |
} else { |
| 37 |
< |
set warnmess "The file \"[file tail $rifname]\" has been\ |
| 38 |
< |
modified since it was last saved. |
| 35 |
> |
set yesmess {Go to File Screen} |
| 36 |
> |
} else { |
| 37 |
> |
set warnmess "The file \"[file tail $rifname]\" has\ |
| 38 |
> |
been modified since it was last saved. |
| 39 |
|
Do you wish to save it now?" |
| 40 |
< |
set yesmess {Save File} |
| 41 |
< |
} |
| 41 |
< |
if [modified] { |
| 40 |
> |
set yesmess {Save File} |
| 41 |
> |
} |
| 42 |
|
switch [tk_dialog .dlg {File Modified} $warnmess \ |
| 43 |
|
warning 0 $yesmess {Discard Changes} \ |
| 44 |
|
{Cancel Operation}] { |
| 46 |
|
2 { return 0 } |
| 47 |
|
} |
| 48 |
|
if $readonly { |
| 49 |
– |
.file invoke |
| 49 |
|
set curmess {Rename file or uncheck read-only to save.} |
| 50 |
+ |
.file invoke |
| 51 |
|
return 0 |
| 52 |
< |
} else { |
| 53 |
< |
catch {unset oldradvar} |
| 54 |
< |
save_vars $rifname |
| 52 |
> |
} elseif {[save_vars $rifname]} { |
| 53 |
> |
gotfile 1 |
| 54 |
> |
return 1 |
| 55 |
|
} |
| 56 |
< |
} else { return 1 } |
| 56 |
> |
return 0 |
| 57 |
> |
} |
| 58 |
> |
return 1 |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
# Set global variable default values |
| 161 |
|
} |
| 162 |
|
} else { |
| 163 |
|
set mode disabled |
| 164 |
+ |
.file invoke |
| 165 |
|
} |
| 166 |
|
foreach b {scene zone views options action results} { |
| 167 |
|
.$b configure -state $mode |
| 171 |
|
# Decide where to go and start |
| 172 |
|
|
| 173 |
|
if {[llength $argv] == 0} { |
| 171 |
– |
gotfile 0 |
| 174 |
|
set curmess "Choose a Radiance project file." |
| 175 |
< |
.file invoke |
| 175 |
> |
gotfile 0 |
| 176 |
|
} elseif {[llength $argv] == 1} { |
| 177 |
|
cd [file dirname $argv] |
| 178 |
|
set curfile [file tail $argv] |