From 07ca462f509e1942ec22c5e6d19545bf4016dd59 Mon Sep 17 00:00:00 2001 From: William Joye Date: Fri, 2 Mar 2018 11:56:39 -0500 Subject: add ds9 parsers --- ds9/library/frame.tcl | 8 ++++---- ds9/library/panzoom.tcl | 22 +++++++++++++++++----- ds9/library/util.tcl | 4 ++-- ds9/make.include | 2 +- ds9/parsers/panlex.fcl | 5 ----- ds9/parsers/panparser.tac | 12 +++++------- ds9/parsers/zoomlex.fcl | 5 ----- ds9/parsers/zoomparser.tac | 8 +++----- 8 files changed, 32 insertions(+), 34 deletions(-) diff --git a/ds9/library/frame.tcl b/ds9/library/frame.tcl index 27fc888..2c83e75 100644 --- a/ds9/library/frame.tcl +++ b/ds9/library/frame.tcl @@ -1425,13 +1425,13 @@ proc KeyFrame {which K A xx yy} { pan { switch -- $K { Up - - k {Pan 0 1 canvas} + k {PanCanvas 0 1} Down - - j {Pan 0 -1 canvas} + j {PanCanvas 0 -1} Left - - h {Pan 1 0 canvas} + h {PanCanvas 1 0} Right - - l {Pan -1 0 canvas} + l {PanCanvas -1 0} } UpdateMagnifier $which $xx $yy } diff --git a/ds9/library/panzoom.tcl b/ds9/library/panzoom.tcl index 0dceff2..9d9f77d 100644 --- a/ds9/library/panzoom.tcl +++ b/ds9/library/panzoom.tcl @@ -66,15 +66,20 @@ proc CenterFrame {which} { } } -proc Pan {x y sys {sky {}}} { +proc PanCanvas {x y} { global current if {$current(frame) != {}} { - switch -- $sys { - canvas {$current(frame) pan $x $y} - default {$current(frame) pan $sys $sky $x $y} - } + $current(frame) pan $x $y + UpdatePan $current(frame) + } +} + +proc Pan {x y sys sky} { + global current + if {$current(frame) != {}} { + $current(frame) pan $sys $sky $x $y UpdatePan $current(frame) } } @@ -219,6 +224,13 @@ proc ChangeZoom {} { } } +proc ZoomTo {zx zy} { + global current + + set current(zoom) "$zx $zy" + ChangeZoom +} + proc Zoom {zx zy} { global current diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl index cac8702..29cfecd 100644 --- a/ds9/library/util.tcl +++ b/ds9/library/util.tcl @@ -1364,7 +1364,7 @@ proc ProcessCursorCmd {varname iname} { catalog {MarkerArrowKey $current(frame) $x $y} crosshair {CrosshairArrowKey $current(frame) $x $y} colorbar {} - pan {Pan $x $y canvas} + pan {PanCanvas $x $y} zoom - rotate - crop {} @@ -1386,7 +1386,7 @@ proc CursorCmd {x y} { catalog {MarkerArrowKey $current(frame) $x $y} crosshair {CrosshairArrowKey $current(frame) $x $y} colorbar {} - pan {Pan $x $y canvas} + pan {PanCanvas $x $y} zoom - rotate - crop {} diff --git a/ds9/make.include b/ds9/make.include index 892f71e..7306abc 100644 --- a/ds9/make.include +++ b/ds9/make.include @@ -22,7 +22,7 @@ $(LIBDIR)/library : $(SRCP:.tac=.tcl) $(SRCP:.tac=.tab.tcl) $(SRCL:.fcl=.tcl) $( echo "pkg_mkIndex . *.tcl; exit" | tclsh touch "$@" -#--------------------------supportt +#--------------------------support $(LIBDIR)/msgs : $(prefix)/ds9/msgs cp -prf $? "$@" diff --git a/ds9/parsers/panlex.fcl b/ds9/parsers/panlex.fcl index 7d4ec06..413499b 100644 --- a/ds9/parsers/panlex.fcl +++ b/ds9/parsers/panlex.fcl @@ -15,11 +15,6 @@ E [Ee][+-]?{D}+ %% --pan {return $pan::CMD_} --rotate {return $pan::CMD_} --zscale {return $pan::CMD_} --zoom {return $pan::CMD_} - close {return $pan::CLOSE_} open {return $pan::OPEN_} to {return $pan::TO_} diff --git a/ds9/parsers/panparser.tac b/ds9/parsers/panparser.tac index 42c2ad0..3fe0106 100644 --- a/ds9/parsers/panparser.tac +++ b/ds9/parsers/panparser.tac @@ -3,8 +3,6 @@ %start command -%token CMD_ - %token INT_ %token REAL_ %token STRING_ @@ -58,7 +56,7 @@ %% command : pan -| pan {pan::yyclearin; YYACCEPT} CMD_ +| pan {pan::yyclearin; YYACCEPT} STRING_ ; numeric : INT_ {set _ $1} @@ -127,8 +125,8 @@ skyframe : FK4_ {set _ fk4} pan : OPEN_ {PanZoomDialog} | CLOSE_ {PanZoomDestroyDialog} | TO_ panto - | numeric numeric {Pan $1 $2 physical} - | numeric numeric coordsys {Pan $1 $2 $3} + | numeric numeric {Pan $1 $2 physical fk5} + | numeric numeric coordsys {Pan $1 $2 $3 fk5} | numeric numeric wcssys {Pan $1 $2 $3 fk5} | numeric numeric skyframe {Pan $1 $2 wcs $3} | numeric numeric wcssys skyframe {Pan $1 $2 $3 $4} @@ -138,8 +136,8 @@ pan : OPEN_ {PanZoomDialog} | SEXSTR_ SEXSTR_ wcssys skyframe {Pan $1 $2 $3 $4} ; -panto : numeric numeric {PanTo $1 $2 physical} - | numeric numeric coordsys {PanTo $1 $2 $3} +panto : numeric numeric {PanTo $1 $2 physical fk5} + | numeric numeric coordsys {PanTo $1 $2 $3 fk5} | numeric numeric wcssys {PanTo $1 $2 $3 fk5} | numeric numeric skyframe {PanTo $1 $2 wcs $3} | numeric numeric wcssys skyframe {PanTo $1 $2 $3 $4} diff --git a/ds9/parsers/zoomlex.fcl b/ds9/parsers/zoomlex.fcl index 0c2637f..79ff034 100644 --- a/ds9/parsers/zoomlex.fcl +++ b/ds9/parsers/zoomlex.fcl @@ -15,11 +15,6 @@ E [Ee][+-]?{D}+ %% --pan {return $zoom::CMD_} --rotate {return $zoom::CMD_} --zscale {return $zoom::CMD_} --zoom {return $zoom::CMD_} - close {return $zoom::CLOSE_} in {return $zoom::IN_} fit {return $zoom::FIT_} diff --git a/ds9/parsers/zoomparser.tac b/ds9/parsers/zoomparser.tac index 4dcc856..4a342c6 100644 --- a/ds9/parsers/zoomparser.tac +++ b/ds9/parsers/zoomparser.tac @@ -7,8 +7,6 @@ %start command -%token CMD_ - %token CLOSE_ %token IN_ %token FIT_ @@ -19,7 +17,7 @@ %% command : zoom - | zoom {zoom::yyclearin; YYACCEPT} CMD_ + | zoom {zoom::yyclearin; YYACCEPT} STRING_ ; numeric : INT_ {set _ $1} @@ -36,8 +34,8 @@ zoom : numeric {Zoom $1 $1} ; zoomTo: FIT_ {ZoomToFit} - | numeric {global zoom; set current(zoom) "$1 $1"; ChangeZoom} - | numeric numeric {global zoom; set current(zoom) "$1 $2"; ChangeZoom} + | numeric {ZoomTo $1 $1} + | numeric numeric {ZoomTo $1 $2} ; %% -- cgit v0.12