From 7959c11e46b7f1227edce9ea4d6de29a786d88bb Mon Sep 17 00:00:00 2001 From: William Joye Date: Mon, 21 Aug 2017 16:40:02 -0400 Subject: clean up code --- ds9/library/frame.tcl | 3 --- ds9/library/manalysis.tcl | 17 ++++------------- ds9/library/mfile.tcl | 41 ++++++++++++++++------------------------- ds9/library/mframe.tcl | 15 +++------------ ds9/library/mzoom.tcl | 17 ++++------------- ds9/library/util.tcl | 19 ------------------- 6 files changed, 27 insertions(+), 85 deletions(-) diff --git a/ds9/library/frame.tcl b/ds9/library/frame.tcl index 25c7fd7..8aa265c 100644 --- a/ds9/library/frame.tcl +++ b/ds9/library/frame.tcl @@ -233,7 +233,6 @@ proc CreateNameNumberFrame {which type} { } UpdateFrameMenuItems - UpdateDS9Static if {$current(frame) != {}} { $current(frame) colorbar tag "\{[$current(colorbar) get tag]\}" @@ -273,7 +272,6 @@ proc DeleteAllFrames {} { UpdateFrameMenuItems UpdateActiveFrames - UpdateDS9Static ClearInfoBox PixelTableClearDialog @@ -285,7 +283,6 @@ proc DeleteSingleFrame {which} { UpdateFrameMenuItems UpdateActiveFrames - UpdateDS9Static PixelTableClearDialog ClearGraphData diff --git a/ds9/library/manalysis.tcl b/ds9/library/manalysis.tcl index 539893a..dbb6c2c 100644 --- a/ds9/library/manalysis.tcl +++ b/ds9/library/manalysis.tcl @@ -425,12 +425,14 @@ proc PrefsDialogButtonbarAnalysis {f} { -command {UpdateButtons buttons(analysis)} } -proc UpdateAnalysisMenuStatic {} { +proc UpdateAnalysisMenu {} { global ds9 + global current + global ianalysis global debug if {$debug(tcl,update)} { - puts stderr "UpdateAnalysisMenuStatic" + puts stderr "UpdateAnalysisMenu" } if {$ds9(active,num) > 0} { @@ -438,17 +440,6 @@ proc UpdateAnalysisMenuStatic {} { } else { $ds9(mb) entryconfig [msgcat::mc {Analysis}] -state disabled } -} - -proc UpdateAnalysisMenu {} { - global ds9 - global current - global ianalysis - - global debug - if {$debug(tcl,update)} { - puts stderr "UpdateAnalysisMenu" - } if {$current(frame) != {}} { for {set ii 0} {$ii<$ianalysis(menu,count)} {incr ii} { diff --git a/ds9/library/mfile.tcl b/ds9/library/mfile.tcl index 2c931de..5da8cc6 100644 --- a/ds9/library/mfile.tcl +++ b/ds9/library/mfile.tcl @@ -487,48 +487,39 @@ proc PrefsDialogButtonbarFile {f} { # Support -proc UpdateFileMenuStatic {} { +proc UpdateFileMenu {} { global ds9 + global current + global samp + global xpa global debug if {$debug(tcl,update)} { - puts stderr "UpdateFileMenuStatic" + puts stderr "UpdateFileMenu" } + set mm $ds9(mb).file + set bb $ds9(buttons).file + if {$ds9(active,num) > 0} { - $ds9(mb).file entryconfig "[msgcat::mc {Open}]..." \ + $mm entryconfig "[msgcat::mc {Open}]..." \ -state normal - $ds9(mb).file entryconfig [msgcat::mc {Open as}] \ + $mm entryconfig [msgcat::mc {Open as}] \ -state normal - $ds9(mb).file entryconfig [msgcat::mc {Import}] \ + $mm entryconfig [msgcat::mc {Import}] \ -state normal - $ds9(buttons).file.open configure -state normal + $bb.open configure -state normal } else { - $ds9(mb).file entryconfig "[msgcat::mc {Open}]..." \ + $mm entryconfig "[msgcat::mc {Open}]..." \ -state disabled - $ds9(mb).file entryconfig [msgcat::mc {Open as}] \ + $mm entryconfig [msgcat::mc {Open as}] \ -state disabled - $ds9(mb).file entryconfig [msgcat::mc {Import}] \ + $mm entryconfig [msgcat::mc {Import}] \ -state disabled - $ds9(buttons).file.open configure -state disabled + $bb.open configure -state disabled } -} - -proc UpdateFileMenu {} { - global ds9 - global current - global samp - global xpa - - global debug - if {$debug(tcl,update)} { - puts stderr "UpdateFileMenu" - } - - set mm $ds9(mb).file - set bb $ds9(buttons).file if {$current(frame) != {}} { if {[$current(frame) has fits]} { diff --git a/ds9/library/mframe.tcl b/ds9/library/mframe.tcl index 65422e7..241149f 100644 --- a/ds9/library/mframe.tcl +++ b/ds9/library/mframe.tcl @@ -1026,12 +1026,13 @@ proc PrefsDialogButtonbarFrame {f} { # Support -proc UpdateFrameMenuStatic {} { +proc UpdateFrameMenu {} { global ds9 + global current global debug if {$debug(tcl,update)} { - puts stderr "UpdateFrameMenuStatic" + puts stderr "UpdateFrameMenu" } $ds9(mb).frame entryconfig [msgcat::mc {New Frame RGB}] -state normal @@ -1122,16 +1123,6 @@ proc UpdateFrameMenuStatic {} { $ds9(buttons).frame.next configure -state disabled $ds9(buttons).frame.last configure -state disabled } -} - -proc UpdateFrameMenu {} { - global ds9 - global current - - global debug - if {$debug(tcl,update)} { - puts stderr "UpdateFrameMenu" - } if {$current(frame) != {}} { $ds9(mb).frame entryconfig "[msgcat::mc {Cube}]..." \ diff --git a/ds9/library/mzoom.tcl b/ds9/library/mzoom.tcl index b9eb6ff..d8d5f03 100644 --- a/ds9/library/mzoom.tcl +++ b/ds9/library/mzoom.tcl @@ -372,12 +372,14 @@ proc PrefsDialogButtonbarZoom {f} { # Support -proc UpdateZoomMenuStatic {} { +proc UpdateZoomMenu {} { global ds9 + global current + global panzoom global debug if {$debug(tcl,update)} { - puts stderr "UpdateZoomMenuStatic" + puts stderr "UpdateZoomMenu" } if {$ds9(active,num) > 0} { @@ -385,17 +387,6 @@ proc UpdateZoomMenuStatic {} { } else { $ds9(mb) entryconfig [msgcat::mc {Zoom}] -state disabled } -} - -proc UpdateZoomMenu {} { - global ds9 - global current - global panzoom - - global debug - if {$debug(tcl,update)} { - puts stderr "UpdateZoomMenu" - } if {$current(frame) == {}} { $ds9(mb).zoom entryconfig [msgcat::mc {Align}] -state disabled diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl index 167a95a..4901c2b 100644 --- a/ds9/library/util.tcl +++ b/ds9/library/util.tcl @@ -66,25 +66,6 @@ proc GetNumCores {} { return 1 } -proc UpdateDS9Static {} { - # This routine is only called when an frame is added or deleted - # we only change menu items which require at least one frame - - global debug - if {$debug(tcl,update)} { - puts stderr "UpdateDS9Static begin..." - } - - UpdateFileMenuStatic - UpdateFrameMenuStatic - UpdateZoomMenuStatic - UpdateAnalysisMenuStatic - - if {$debug(tcl,update)} { - puts stderr "UpdateDS9Static end...\n" - } -} - proc UpdateDS9 {} { global ds9 global current -- cgit v0.12