diff options
-rw-r--r-- | ds9/library/frame.tcl | 18 | ||||
-rw-r--r-- | ds9/parsers/tileparser.tac | 22 |
2 files changed, 29 insertions, 11 deletions
diff --git a/ds9/library/frame.tcl b/ds9/library/frame.tcl index 8c52282..5fc879f 100644 --- a/ds9/library/frame.tcl +++ b/ds9/library/frame.tcl @@ -2210,6 +2210,15 @@ proc ProcessFrameCmd {varname iname} { } } +proc CurrentCmdSet {which value {cmd {}}} { + global current + + set current($which) $value + if {$cmd != {}} { + eval $cmd + } +} + proc ProcessSendFrameCmd {proc id param} { global ds9 global current @@ -2387,6 +2396,15 @@ proc ProcessTileCmd {varname iname} { } } +proc TileCmdSet {which value {cmd {}}} { + global tile + + set tile($which) $value + if {$cmd != {}} { + eval $cmd + } +} + proc ProcessSendTileCmd {proc id param} { global current global tile diff --git a/ds9/parsers/tileparser.tac b/ds9/parsers/tileparser.tac index 4ef0cef..0f2e453 100644 --- a/ds9/parsers/tileparser.tac +++ b/ds9/parsers/tileparser.tac @@ -36,13 +36,13 @@ command : tile | tile {yyclearin; YYACCEPT} STRING_ ; -tile: {global current; set current(display) tile; DisplayMode} - | yes {global current; set current(display) tile; DisplayMode} - | no {global current; set current(display) single; DisplayMode} - | MODE_ tileMode {global tile; set tile(mode) $2; DisplayMode} +tile: {CurrentCmdSet display tile DisplayMode} + | yes {CurrentCmdSet display tile DisplayMode} + | no {CurrentCmdSet display single DisplayMode} + | MODE_ tileMode {TileCmdSet mode $2 DisplayMode} | GRID_ tileGrid - | COLUMN_ {global tile; set tile(mode) column; DisplayMode} - | ROW_ {global tile; set tile(mode) row; DisplayMode} + | COLUMN_ {TileCmdSet mode column DisplayMode} + | ROW_ {TileCmdSet mode row DisplayMode} ; tileMode : GRID_ {set _ grid} @@ -50,11 +50,11 @@ tileMode : GRID_ {set _ grid} | ROW_ {set _ row} ; -tileGrid : {global tile; set tile(mode) grid; DisplayMode} - | MODE_ tileGridMode {global tile; set tile(grid,mode) $2; DisplayMode} - | DIRECTION_ tileGridDir {global tile; set tile(grid,dir) $2; DisplayMode} - | LAYOUT_ INT_ INT_ {global tile; set tile(grid,col) $2; set tile(grid,row) $3; set tile(grid,mode) manual; DisplayMode} - | GAP_ INT_ {global tile; set tile(grid,gap) $2; DisplayMode} +tileGrid : {TileCmdSet mode grid DisplayMode} + | MODE_ tileGridMode {TileCmdSet grid,mode $2 DisplayMode} + | DIRECTION_ tileGridDir {TileCmdSet grid,dir $2 DisplayMode} + | LAYOUT_ INT_ INT_ {TileCmdSet grid,col $2; TileCmdSet grid,row $3; TileCmdSetgrid,mode manual DisplayMode} + | GAP_ INT_ {TileCmdSet grid,gap $2 DisplayMode} ; tileGridMode : AUTOMATIC_ {set _ automatic} |