diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-11-29 20:40:36 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-11-29 20:40:36 (GMT) |
commit | 88e89bb5360cd136fe6adc5e2acd4c0cab63937b (patch) | |
tree | 2bb7c49ccca53dee240f4b25cc1cc712e6bf82c6 /ds9 | |
parent | 0d8f331b170e7ef0b795dee958e439acea146688 (diff) | |
download | blt-88e89bb5360cd136fe6adc5e2acd4c0cab63937b.zip blt-88e89bb5360cd136fe6adc5e2acd4c0cab63937b.tar.gz blt-88e89bb5360cd136fe6adc5e2acd4c0cab63937b.tar.bz2 |
enable/disable buttons if no frame
Diffstat (limited to 'ds9')
-rw-r--r-- | ds9/library/manalysis.tcl | 2 | ||||
-rw-r--r-- | ds9/library/marker.tcl | 20 | ||||
-rw-r--r-- | ds9/library/mbin.tcl | 4 | ||||
-rw-r--r-- | ds9/library/menu.tcl | 9 | ||||
-rw-r--r-- | ds9/library/mregion.tcl | 123 | ||||
-rw-r--r-- | ds9/library/mscale.tcl | 3 | ||||
-rw-r--r-- | ds9/library/mwcs.tcl | 2 | ||||
-rw-r--r-- | ds9/library/mzoom.tcl | 2 |
8 files changed, 128 insertions, 37 deletions
diff --git a/ds9/library/manalysis.tcl b/ds9/library/manalysis.tcl index df282c0..cc49586 100644 --- a/ds9/library/manalysis.tcl +++ b/ds9/library/manalysis.tcl @@ -335,8 +335,10 @@ proc UpdateAnalysisMenu {} { if {$ds9(active,num) > 0} { $ds9(mb) entryconfig [msgcat::mc {Analysis}] -state normal + ConfigureButtons analysis normal } else { $ds9(mb) entryconfig [msgcat::mc {Analysis}] -state disabled + ConfigureButtons analysis disabled } if {$current(frame) != {}} { diff --git a/ds9/library/marker.tcl b/ds9/library/marker.tcl index a696df0..38dfb0d 100644 --- a/ds9/library/marker.tcl +++ b/ds9/library/marker.tcl @@ -1247,26 +1247,6 @@ proc MarkerSave {} { } } -proc MarkerMask {} { - global current - - if {$current(frame) == {}} { - return - } - if {![$current(frame) has fits]} { - return - } - - if {[MaskParamsDialog]} { - $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) - - $current(frame) marker create mask - } -} - proc MarkerInfo {} { global current global marker diff --git a/ds9/library/mbin.tcl b/ds9/library/mbin.tcl index 9ada431..a0c8afd 100644 --- a/ds9/library/mbin.tcl +++ b/ds9/library/mbin.tcl @@ -323,11 +323,14 @@ proc UpdateBinMenu {} { if {[$current(frame) has fits]} { if {[$current(frame) has fits bin]} { $ds9(mb) entryconfig [msgcat::mc {Bin}] -state normal + ConfigureButtons bin normal } else { $ds9(mb) entryconfig [msgcat::mc {Bin}] -state disabled + ConfigureButtons bin disabled } } else { $ds9(mb) entryconfig [msgcat::mc {Bin}] -state normal + ConfigureButtons bin normal } set bin(function) [$current(frame) get bin function] @@ -336,6 +339,7 @@ proc UpdateBinMenu {} { set bin(buffersize) [$current(frame) get bin buffer size] } else { $ds9(mb) entryconfig [msgcat::mc {Bin}] -state disabled + ConfigureButtons bin disabled } } diff --git a/ds9/library/menu.tcl b/ds9/library/menu.tcl index b51626f..122ee06 100644 --- a/ds9/library/menu.tcl +++ b/ds9/library/menu.tcl @@ -658,3 +658,12 @@ proc PrefsDialogMenu {} { PrefsDialogHelpMenu $w.menu } +proc ConfigureButtons {menu state} { + global ds9 + global pbuttons + + foreach aa [array names pbuttons "$menu,*"] { + set bb [lindex [split $aa {,}] 1] + $ds9(buttons).$menu.$bb configure -state $state + } +} diff --git a/ds9/library/mregion.tcl b/ds9/library/mregion.tcl index 088a7e3..08a1539 100644 --- a/ds9/library/mregion.tcl +++ b/ds9/library/mregion.tcl @@ -67,9 +67,6 @@ proc RegionMainMenu {} { $ds9(mb).region add command -label "[msgcat::mc {Save Regions}]..." \ -command MarkerSave $ds9(mb).region add separator - $ds9(mb).region add command -label [msgcat::mc {Convert to Mask}] \ - -command MarkerMask - $ds9(mb).region add separator $ds9(mb).region add cascade -label [msgcat::mc {Region Parameters}] \ -menu $ds9(mb).region.params @@ -957,10 +954,6 @@ proc PrefsDialogButtonbarRegion {f} { -variable pbuttons(region,save) \ -command {UpdateButtons buttons(region)} $m add separator - $m add checkbutton -label [msgcat::mc {Convert to Mask}] \ - -variable pbuttons(region,mask) \ - -command {UpdateButtons buttons(region)} - $m add separator $m add cascade -label [msgcat::mc {Region Parameters}] -menu $m.params menu $m.shape @@ -1065,6 +1058,7 @@ proc UpdateRegionMenu {} { if {$current(frame) != {}} { $ds9(mb) entryconfig [msgcat::mc {Region}] -state normal + ConfigureButtons region normal set marker(show) [$current(frame) get marker show] set marker(show,text) [$current(frame) get marker show text] @@ -1126,18 +1120,113 @@ proc UpdateRegionMenu {} { } } - switch [$current(frame) get type] { - base { - $mm entryconfig [msgcat::mc {Convert to Mask}] -state normal - $bb.mask configure -state normal - } - rgb - - 3d { - $mm entryconfig [msgcat::mc {Convert to Mask}] -state disabled - $bb.mask configure -state disabled - } + if {[$current(frame) has fits]} { + $mm entryconfig "[msgcat::mc {Get Information}]..." -state normal + + $mm entryconfig [msgcat::mc {Composite Region}] -state normal + $mm entryconfig [msgcat::mc {Instrument FOV}] -state normal + $mm entryconfig [msgcat::mc {Template}] -state normal + + $mm entryconfig [msgcat::mc {Centroid}] -state normal + $mm entryconfig [msgcat::mc {Move to Front}] -state normal + $mm entryconfig [msgcat::mc {Move to Back}] -state normal + + $mm entryconfig [msgcat::mc {New Group}] -state normal + $mm entryconfig "[msgcat::mc {Groups}]..." -state normal + + $mm entryconfig [msgcat::mc {Select All}] -state normal + $mm entryconfig [msgcat::mc {Select None}] -state normal + $mm entryconfig [msgcat::mc {Invert Selection}] -state normal + + $mm entryconfig [msgcat::mc {Delete Selected Regions}] -state normal + $mm entryconfig [msgcat::mc {Delete All Regions}] -state normal + + $mm entryconfig "[msgcat::mc {List Regions}]..." -state normal + $mm entryconfig "[msgcat::mc {Load Regions}]..." -state normal + $mm entryconfig "[msgcat::mc {Delete and Load Regions}]..." -state normal + $mm entryconfig "[msgcat::mc {Save Regions}]..." -state normal + + $bb.info configure -state normal + + $bb.create configure -state normal + $bb.dissolve configure -state normal + + $bb.loadtemplate configure -state normal + $bb.savetemplate configure -state normal + + $bb.centroid configure -state normal + $bb.front configure -state normal + $bb.back configure -state normal + + $bb.newgroup configure -state normal + $bb.group configure -state normal + + $bb.all configure -state normal + $bb.none configure -state normal + $bb.invert configure -state normal + + $bb.delete configure -state normal + $bb.deleteall configure -state normal + + $bb.list configure -state normal + $bb.load configure -state normal + $bb.deleteload configure -state normal + $bb.save configure -state normal + } else { + $mm entryconfig "[msgcat::mc {Get Information}]..." -state disabled + + $mm entryconfig [msgcat::mc {Composite Region}] -state disabled + $mm entryconfig [msgcat::mc {Instrument FOV}] -state disabled + $mm entryconfig [msgcat::mc {Template}] -state disabled + + $mm entryconfig [msgcat::mc {Centroid}] -state disabled + $mm entryconfig [msgcat::mc {Move to Front}] -state disabled + $mm entryconfig [msgcat::mc {Move to Back}] -state disabled + + $mm entryconfig [msgcat::mc {New Group}] -state disabled + $mm entryconfig "[msgcat::mc {Groups}]..." -state disabled + + $mm entryconfig [msgcat::mc {Select All}] -state disabled + $mm entryconfig [msgcat::mc {Select None}] -state disabled + $mm entryconfig [msgcat::mc {Invert Selection}] -state disabled + + $mm entryconfig [msgcat::mc {Delete Selected Regions}] -state disabled + $mm entryconfig [msgcat::mc {Delete All Regions}] -state disabled + + $mm entryconfig "[msgcat::mc {List Regions}]..." -state disabled + $mm entryconfig "[msgcat::mc {Load Regions}]..." -state disabled + $mm entryconfig "[msgcat::mc {Delete and Load Regions}]..." -state disabled + $mm entryconfig "[msgcat::mc {Save Regions}]..." -state disabled + + $bb.info configure -state disabled + + $bb.create configure -state disabled + $bb.dissolve configure -state disabled + + $bb.loadtemplate configure -state disabled + $bb.savetemplate configure -state disabled + + $bb.centroid configure -state disabled + $bb.front configure -state disabled + $bb.back configure -state disabled + + $bb.newgroup configure -state disabled + $bb.group configure -state disabled + + $bb.all configure -state disabled + $bb.none configure -state disabled + $bb.invert configure -state disabled + + $bb.delete configure -state disabled + $bb.deleteall configure -state disabled + + $bb.list configure -state disabled + $bb.load configure -state disabled + $bb.deleteload configure -state disabled + $bb.save configure -state disabled } } else { $ds9(mb) entryconfig [msgcat::mc {Region}] -state disabled + ConfigureButtons region disabled } } diff --git a/ds9/library/mscale.tcl b/ds9/library/mscale.tcl index 564d027..ce5b50f 100644 --- a/ds9/library/mscale.tcl +++ b/ds9/library/mscale.tcl @@ -395,6 +395,7 @@ proc UpdateScaleMenu {} { if {$current(frame) != {}} { if {![$current(frame) has iis]} { $ds9(mb) entryconfig [msgcat::mc {Scale}] -state normal + ConfigureButtons scale normal set scale(type) [$current(frame) get colorscale] set scale(log) [$current(frame) get colorscale log] @@ -433,9 +434,11 @@ proc UpdateScaleMenu {} { } else { $ds9(mb) entryconfig [msgcat::mc {Scale}] -state disabled + ConfigureButtons scale disabled } } else { $ds9(mb) entryconfig [msgcat::mc {Scale}] -state disabled + ConfigureButtons scale disabled } } diff --git a/ds9/library/mwcs.tcl b/ds9/library/mwcs.tcl index b9c6755..e9b0c6c 100644 --- a/ds9/library/mwcs.tcl +++ b/ds9/library/mwcs.tcl @@ -29,6 +29,7 @@ proc UpdateWCSMenu {} { if {$current(frame) != {}} { $ds9(mb) entryconfig [msgcat::mc {WCS}] -state normal + ConfigureButtons wcs normal set ww [$current(frame) get wcs] set wcs(system) [lindex $ww 0] @@ -44,6 +45,7 @@ proc UpdateWCSMenu {} { LayoutWCSInfoBox $current(frame) } else { $ds9(mb) entryconfig [msgcat::mc {WCS}] -state disabled + ConfigureButtons wcs disabled } } diff --git a/ds9/library/mzoom.tcl b/ds9/library/mzoom.tcl index 1c7829b..a1235c8 100644 --- a/ds9/library/mzoom.tcl +++ b/ds9/library/mzoom.tcl @@ -384,8 +384,10 @@ proc UpdateZoomMenu {} { if {$ds9(active,num) > 0} { $ds9(mb) entryconfig [msgcat::mc {Zoom}] -state normal + ConfigureButtons zoom normal } else { $ds9(mb) entryconfig [msgcat::mc {Zoom}] -state disabled + ConfigureButtons zoom disabled } if {$current(frame) == {}} { |