diff options
Diffstat (limited to 'ds9/library')
-rw-r--r-- | ds9/library/backup.tcl | 141 | ||||
-rw-r--r-- | ds9/library/frame.tcl | 32 | ||||
-rw-r--r-- | ds9/library/load.tcl | 40 | ||||
-rw-r--r-- | ds9/library/mask.tcl | 16 |
4 files changed, 150 insertions, 79 deletions
diff --git a/ds9/library/backup.tcl b/ds9/library/backup.tcl index 993ad79..ac15743 100644 --- a/ds9/library/backup.tcl +++ b/ds9/library/backup.tcl @@ -295,78 +295,109 @@ proc BackupFrame {ch which dir} { proc BackupFrameLoad {ch which fdir rdir channel} { set base $which$channel - set seq 1 - + + # regular loadParams set varname $base global $varname - if {![info exists $varname]} { - # special case - set varname "$base.$seq" + BackupFrameLoadParam $varname $ch $which $fdir $rdir $channel + + # file,mode loadParams + set cnt [$which get fits count] + for {set ii 2} {$ii<=$cnt} {incr ii} { + set varname "$base.$ii" global $varname + if {[info exists $varname]} { + BackupFrameLoadParam $varname $ch $which $fdir $rdir $channel + } else { + break + } } - while {[info exists $varname]} { - if {$channel != {}} { - puts $ch "$which rgb channel $channel" + # mask loadParams + set cnt [$which get mask count] + for {set ii 1} {$ii<=$cnt} {incr ii} { + set varname "$base.m${ii}" + global $varname + if {[info exists $varname]} { + BackupFrameLoadParam $varname $ch $which $fdir $rdir {} + } else { + break } + } +} - array set param [array get $varname] - switch $param(load,type) { - mmap - - mmapincr - - smmap - - shared - - sshared { - if {![BackupFrameLoadMMap param $fdir $rdir]} { - Error [msgcat::mc {An error has occurred during backup}] - return - } +proc BackupFrameLoadParam {varname ch which fdir rdir channel} { + global $varname + + if {![info exists $varname]} { + return + } + + if {$channel != {}} { + puts $ch "$which rgb channel $channel" + } + + array set param [array get $varname] + switch $param(load,type) { + mmap - + mmapincr - + smmap - + shared - + sshared { + if {![BackupFrameLoadMMap param $fdir $rdir]} { + Error [msgcat::mc {An error has occurred during backup}] + return } - alloc - - allocgz { - if {![BackupFrameLoadMMap param $fdir $rdir]} { - BackupFrameLoadAlloc $which param $fdir $rdir - } + } + alloc - + allocgz { + if {![BackupFrameLoadMMap param $fdir $rdir]} { + BackupFrameLoadAlloc $which param $fdir $rdir } - channel - - socket - - socketgz - - var {BackupFrameLoadAlloc $which param $fdir $rdir} - photo { - if {[BackupFrameLoadMMap param $fdir $rdir]} { - puts $ch "global bcktmp" - puts $ch "if {\[catch {image create photo -file $param(file,name)} bcktmp\]} {" - puts $ch "Error \[msgcat::mc {An error has occurred during restore}\]" - puts $ch "return" - puts $ch "}" - } else { - BackupFrameLoadAlloc $which param $fdir $rdir - } + } + channel - + socket - + socketgz - + var {BackupFrameLoadAlloc $which param $fdir $rdir} + photo { + if {[BackupFrameLoadMMap param $fdir $rdir]} { + puts $ch "global bcktmp" + puts $ch "if {\[catch {image create photo -file $param(file,name)} bcktmp\]} {" + puts $ch "Error \[msgcat::mc {An error has occurred during restore}\]" + puts $ch "return" + puts $ch "}" + } else { + BackupFrameLoadAlloc $which param $fdir $rdir } } + } - puts $ch "global loadParam" - puts $ch "array set loadParam \[list [array get param]\]" + puts $ch "global loadParam" + puts $ch "array set loadParam \[list [array get param]\]" - switch $param(load,type) { - photo { - puts $ch "set loadParam(var,name) \$bcktmp" - } + switch $param(load,layer) { + mask { + puts $ch "MaskDialog" + puts $ch "$which mask color $param(mask,color)" + puts $ch "$which mask mark $param(mask,mark)" + puts $ch "$which mask range $param(mask,low) $param(mask,high)" } + } + + switch $param(load,type) { + photo { + puts $ch "set loadParam(var,name) \$bcktmp" + } + } - puts $ch "if \[BackupFindFile loadParam\] {" - puts $ch " ProcessLoad" - puts $ch "}" + puts $ch "if \[BackupFindFile loadParam\] {" + puts $ch " ProcessLoad" + puts $ch "}" - switch $param(load,type) { - photo { - puts $ch "image delete \$bcktmp" - } + switch $param(load,type) { + photo { + puts $ch "image delete \$bcktmp" } - - incr seq - set varname "$base.$seq" - global $varname } } diff --git a/ds9/library/frame.tcl b/ds9/library/frame.tcl index f953076..c2648fc 100644 --- a/ds9/library/frame.tcl +++ b/ds9/library/frame.tcl @@ -1834,10 +1834,7 @@ proc ClearFrame {which} { return } - DestroyHeader $which - $which clear - - # delete saved loadParams + # delete saved regular loadParams foreach cc {{} red green blue} { set varname $which$cc global $varname @@ -1845,6 +1842,33 @@ proc ClearFrame {which} { unset $varname } } + + # delete saved file,mode loadParams + set cnt [$which get fits count] + for {set ii 2} {$ii<=$cnt} {incr ii} { + set varname $which.$ii + global $varname + if {[info exists $varname]} { + unset $varname + } else { + break + } + } + + # delete saved mask loadParams + set cnt [$which get mask count] + for {set ii 1} {$ii<=$cnt} {incr ii} { + set varname $which.m${ii} + global $varname + if {[info exists $varname]} { + unset $varname + } else { + break + } + } + + DestroyHeader $which + $which clear } # Private Procedures diff --git a/ds9/library/load.tcl b/ds9/library/load.tcl index ef9a085..f3095da 100644 --- a/ds9/library/load.tcl +++ b/ds9/library/load.tcl @@ -181,18 +181,16 @@ proc ProcessLoad {{err 1}} { } # save loadParam - if {$loadParam(load,layer) == {}} { - switch -- [$current(frame) get type] { - base - - 3d {ProcessLoadSaveParams $current(frame)} - rgb { - switch -- $loadParam(file,mode) { - {rgb image} - - {rgb cube} {ProcessLoadSaveParams $current(frame)} - default { - ProcessLoadSaveParams \ - "$current(frame)[$current(frame) get rgb channel]" - } + switch -- [$current(frame) get type] { + base - + 3d {ProcessLoadSaveParams $current(frame)} + rgb { + switch -- $loadParam(file,mode) { + {rgb image} - + {rgb cube} {ProcessLoadSaveParams $current(frame)} + default { + ProcessLoadSaveParams \ + "$current(frame)[$current(frame) get rgb channel]" } } } @@ -206,11 +204,18 @@ proc ProcessLoadSaveParams {varname} { global loadParam global current + switch $loadParam(load,layer) { + mask { + global $varname + if {[info exists $varname]} { + set varname "$varname.m[$current(frame) get mask count]" + } + } + } switch $loadParam(file,mode) { slice - {mosaic wcs} - {mosaic iraf} { - # special case global $varname if {[info exists $varname]} { set varname "$varname.[$current(frame) get fits count]" @@ -224,6 +229,15 @@ proc ProcessLoadSaveParams {varname} { } array set $varname [array get loadParam] + switch $loadParam(load,layer) { + mask { + global mask + set ${varname}(mask,color) $mask(color) + set ${varname}(mask,mark) $mask(mark) + set ${varname}(mask,low) $mask(low) + set ${varname}(mask,high) $mask(high) + } + } # always save absolute path upvar #0 $varname var diff --git a/ds9/library/mask.tcl b/ds9/library/mask.tcl index 07c267a..6d30215 100644 --- a/ds9/library/mask.tcl +++ b/ds9/library/mask.tcl @@ -12,12 +12,13 @@ proc MaskDef {} { set imask(top) .msk set imask(mb) .mskmb + set mask(transparency) 0 set mask(system) physical + set mask(color) red set mask(mark) nonzero set mask(low) 0 set mask(high) 0 - set mask(transparency) 0 array set pmask [array get mask] } @@ -77,6 +78,7 @@ proc MaskClear {} { } } +# used in Backup proc MaskDialog {} { global mask global imask @@ -186,13 +188,14 @@ proc UpdateMaskMenu {} { return } + set mask(transparency) [$current(frame) get mask transparency] + set mask(system) [$current(frame) get mask system] + set mask(color) [$current(frame) get mask color] set mask(mark) [$current(frame) get mask mark] set range [$current(frame) get mask range] set mask(low) [lindex $range 0] set mask(high) [lindex $range 1] - set mask(system) [$current(frame) get mask system] - set mask(transparency) [$current(frame) get mask transparency] switch -- [$current(frame) get type] { base { @@ -217,7 +220,6 @@ proc MaskLoad {} { $current(frame) mask color $mask(color) $current(frame) mask mark $mask(mark) $current(frame) mask range $mask(low) $mask(high) - $current(frame) mask system $mask(system) } } return $rr @@ -297,11 +299,12 @@ proc MaskParamsDialog {} { } proc MaskBackup {ch which} { + puts $ch "$which mask transparency [$which get mask transparency]" + puts $ch "$which mask system [$which get mask system]" + puts $ch "$which mask color [$which get mask color]" puts $ch "$which mask mark [$which get mask mark]" puts $ch "$which mask range [$which get mask range]" - puts $ch "$which mask system [$which get mask system]" - puts $ch "$which mask transparency [$which get mask transparency]" } proc ProcessMaskCmd {varname iname} { @@ -331,4 +334,3 @@ proc ProcessSendMaskCmd {proc id param {sock {}} {fn {}}} { masksend::yy_scan_string $param masksend::yyparse } - |