summaryrefslogtreecommitdiffstats
path: root/ds9/library/colorbar.tcl
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-05-29 20:21:39 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-05-29 20:21:39 (GMT)
commit41505b4129a005e96c6afc3344ccf61097884fbd (patch)
treedc0f4ab45219ca29eccf744a808cddf2c159e038 /ds9/library/colorbar.tcl
parent503ed168603b213005c246edecfdfe77eefcc981 (diff)
downloadblt-41505b4129a005e96c6afc3344ccf61097884fbd.zip
blt-41505b4129a005e96c6afc3344ccf61097884fbd.tar.gz
blt-41505b4129a005e96c6afc3344ccf61097884fbd.tar.bz2
cleanup ProcessCmd code
Diffstat (limited to 'ds9/library/colorbar.tcl')
-rw-r--r--ds9/library/colorbar.tcl233
1 files changed, 8 insertions, 225 deletions
diff --git a/ds9/library/colorbar.tcl b/ds9/library/colorbar.tcl
index a5ee821..8575336 100644
--- a/ds9/library/colorbar.tcl
+++ b/ds9/library/colorbar.tcl
@@ -1188,115 +1188,10 @@ proc ProcessCmapCmd {varname iname} {
# we need to be realized
ProcessRealizeDS9
- global debug
- if {$debug(tcl,parser)} {
- cmap::YY_FLUSH_BUFFER
- cmap::yy_scan_string [lrange $var $i end]
- cmap::yyparse
- incr i [expr $cmap::yycnt-1]
- } else {
-
- global colorbar
- global current
-
- global ds9
- global current
- global rgb
-
- switch -- [string tolower [lindex $var $i]] {
- open {ColormapDialog}
- close {ColormapDestroyDialog}
- match {
- # backward compatibility
- MatchColorCurrent
- }
- lock {
- # backward compatibility
- incr i
- if {!([string range [lindex $var $i] 0 0] == "-")} {
- set colorbar(lock) [FromYesNo [lindex $var $i]]
- } else {
- set colorbar(lock) 1
- incr i -1
- }
- LockColorCurrent
- }
- load -
- file {
- incr i
- set fn [lindex $var $i]
- LoadColormapFile $fn
- FileLast colormapfbox $fn
- }
- save {
- incr i
- set fn [lindex $var $i]
- SaveColormapFile $fn
- FileLast colormapfbox $fn
- }
- invert {
- incr i
- set colorbar(invert) [FromYesNo [lindex $var $i]]
- InvertColorbar
- }
- tag {
- incr i
- set item [string tolower [lindex $var $i]]
- switch $item {
- load {incr i; LoadColorTag [lindex $var $i]}
- save {incr i; $current(colorbar) tag save [lindex $var $i]}
- delete {DeleteColorTag}
- }
- }
- value {
- incr i
- set c [lindex $var $i]
- incr i
- set b [lindex $var $i]
- if {$current(frame) != {}} {
- RGBEvalLockColorbar [list $current(colorbar) adjust $c $b]
- RGBEvalLockCurrent rgb(lock,colorbar) [list $current(frame) colormap begin]
- RGBEvalLockCurrent rgb(lock,colorbar) [list $current(frame) colormap motion [$current(colorbar) get colormap]]
- RGBEvalLockCurrent rgb(lock,colorbar) [list $current(frame) colormap end]
- }
- LockColorCurrent
- UpdateColorDialog
- }
- default {
- switch -- [$current(frame) get type] {
- base -
- 3d {
- set cmap [lindex $var $i]
- # common variants on spellings
- switch -- [string tolower $cmap] {
- gray {set cmap grey}
- }
-
- set id [colorbar list id]
- set found 0
- foreach ii $id {
- set title [colorbar get name $ii]
- if {[string equal -nocase $title $cmap]} {
- set colorbar(map) $title
- colorbar map "{$colorbar(map)}"
- $current(frame) colormap [colorbar get colormap]
- set colorbar(invert) [colorbar get invert]
-
- set found 1
- break
- }
- }
- if {!$found} {
- Error "[msgcat::mc {Unknown Colormap}] $cmap"
- }
- }
- rgb {}
- }
- LockColorCurrent
- UpdateColorDialog
- }
- }
-}
+ cmap::YY_FLUSH_BUFFER
+ cmap::yy_scan_string [lrange $var $i end]
+ cmap::yyparse
+ incr i [expr $cmap::yycnt-1]
}
proc CmapCmd {item} {
@@ -1366,122 +1261,10 @@ proc ProcessColorbarCmd {varname iname} {
upvar $varname var
upvar $iname i
- global debug
- if {$debug(tcl,parser)} {
- colorbar::YY_FLUSH_BUFFER
- colorbar::yy_scan_string [lrange $var $i end]
- colorbar::yyparse
- incr i [expr $colorbar::yycnt-1]
- } else {
-
- global colorbar
- global view
-
- set item [string tolower [lindex $var $i]]
-
- switch -- $item {
- match {
- MatchColorCurrent
- }
- lock {
- incr i
- if {!([string range [lindex $var $i] 0 0] == "-")} {
- set colorbar(lock) [FromYesNo [lindex $var $i]]
- } else {
- set colorbar(lock) 1
- incr i -1
- }
- LockColorCurrent
- }
- numerics {
- incr i
- set yesno [string tolower [lindex $var $i]]
- set colorbar(numerics) [FromYesNo $yesno]
- UpdateView
- }
- space {
- incr i
- switch -- [string tolower [lindex $var $i]] {
- value {set item 1}
- default {set item 0}
- }
- set colorbar(space) $item
- UpdateView
- }
- font {
- incr i
- set item [string tolower [lindex $var $i]]
- set colorbar(font) $item
- UpdateView
- }
- fontsize {
- incr i
- set item [lindex $var $i]
- set colorbar(font,size) $item
- UpdateView
- }
- fontweight {
- incr i
- set item [string tolower [lindex $var $i]]
- set colorbar(font,weight) $item
- UpdateView
- }
- fontslant {
- incr i
- set item [string tolower [lindex $var $i]]
- set colorbar(font,slant) $item
- UpdateView
- }
- fontstyle {
- # backward compatibility
- incr i
- set item [string tolower [lindex $var $i]]
- switch $item {
- normal {
- set colorbar(font,weight) normal
- set colorbar(font,slant) roman
- }
- bold {
- set colorbar(font,weight) bold
- set colorbar(font,slant) roman
- }
- italic {
- set colorbar(font,weight) normal
- set colorbar(font,slant) italic
- }
- }
- UpdateView
- }
- orientation {
- incr i
- set item [string tolower [lindex $var $i]]
- set colorbar(orientation) $item
- UpdateView
- }
- vertical -
- horizontal {
- set colorbar(orientation) $item
- UpdateView
- }
- size {
- incr i
- set item [lindex $var $i]
- set colorbar(size) $item
- UpdateView
- }
- ticks {
- incr i
- set item [lindex $var $i]
- set colorbar(ticks) $item
- UpdateView
- }
- default {
- set yesno [string tolower [lindex $var $i]]
- set view(colorbar) [FromYesNo $yesno]
- UpdateView
- }
- }
-}
+ colorbar::YY_FLUSH_BUFFER
+ colorbar::yy_scan_string [lrange $var $i end]
+ colorbar::yyparse
+ incr i [expr $colorbar::yycnt-1]
}
proc ColorbarCmdSet {which value {cmd {}}} {