diff options
Diffstat (limited to 'tksao/frame')
-rw-r--r-- | tksao/frame/base.C | 12 | ||||
-rw-r--r-- | tksao/frame/base.h | 17 | ||||
-rw-r--r-- | tksao/frame/basecommand.C | 79 | ||||
-rw-r--r-- | tksao/frame/fr3dcommand.C | 29 | ||||
-rw-r--r-- | tksao/frame/frame3dbase.h | 12 | ||||
-rw-r--r-- | tksao/frame/framebase.h | 12 | ||||
-rw-r--r-- | tksao/frame/frcommand.C | 41 |
7 files changed, 56 insertions, 146 deletions
diff --git a/tksao/frame/base.C b/tksao/frame/base.C index aca84a2..1337204 100644 --- a/tksao/frame/base.C +++ b/tksao/frame/base.C @@ -79,9 +79,6 @@ Base::Base(Tcl_Interp* i, Tk_Canvas c, Tk_Item* item) preservePan = 0; - panPM = 0; - panGCXOR = XCreateGC(display, Tk_WindowId(tkwin), 0, NULL); - pannerPixmap = 0; pannerXImage = NULL; pannerWidth = 0; @@ -198,12 +195,6 @@ Base::~Base() if (pannerXImage) XDestroyImage(pannerXImage); - if (panPM) - Tk_FreePixmap(display, panPM); - - if (panGCXOR) - XFreeGC(display, panGCXOR); - if (pannerGC) XFreeGC(display, pannerGC); @@ -1410,9 +1401,6 @@ void Base::updateGCs() // highliteGC XSetClipRectangles(display, highliteGC, 0, 0, rectWidget, 1, Unsorted); - // panGCXOR - XSetClipRectangles(display, panGCXOR, 0, 0, rectWindow, 1, Unsorted); - // markerGC XSetClipRectangles(display, markerGC_, 0, 0, rectWidget, 1, Unsorted); XSetClipRectangles(display, markerGCXOR_, 0, 0, rectWindow, 1, Unsorted); diff --git a/tksao/frame/base.h b/tksao/frame/base.h index 5e10ea8..02f9bd4 100644 --- a/tksao/frame/base.h +++ b/tksao/frame/base.h @@ -182,9 +182,8 @@ public: Vector zoom_; // current image zoom value - Pixmap panPM; // tmp pixmap for pan motion - Vector panCursor; // cursor for interactive panning - GC panGCXOR; // GC for interactive panning + Vector panCursor; // tmp cursor for interactive panning + Vector panStart; // tmp pan start Pixmap pannerPixmap; // pixmap for panner XImage* pannerXImage; // ximage for panner @@ -1580,15 +1579,15 @@ public: virtual void panCmd(const Vector&, Coord::CoordSystem, Coord::SkyFrame) =0; virtual void panToCmd(const Vector&) =0; virtual void panToCmd(const Vector&, Coord::CoordSystem, Coord::SkyFrame) =0; - void panBeginCmd(const Vector&); - void panMotionCmd(const Vector&); - virtual void panEndCmd(const Vector&) =0; + virtual void panBeginCmd(const Vector&) =0; + virtual void panMotionCmd(const Vector&) =0; + void panEndCmd(const Vector& vv) {panMotionCmd(vv);} virtual void panBBoxCmd(const Vector&) =0; void panPreserveCmd(int r) {preservePan = r;} void rotateCmd(double); - virtual void rotateBeginCmd() {} - virtual void rotateMotionCmd(double) {} - virtual void rotateEndCmd() {} + void rotateBeginCmd(); + void rotateMotionCmd(double); + void rotateEndCmd(); void rotateToCmd(double); void getIRAFAlignCmd(); void irafAlignCmd(int); diff --git a/tksao/frame/basecommand.C b/tksao/frame/basecommand.C index f91af32..81872ff 100644 --- a/tksao/frame/basecommand.C +++ b/tksao/frame/basecommand.C @@ -2564,68 +2564,6 @@ void Base::orientCmd(Coord::Orientation which) update(MATRIX); } -void Base::panBeginCmd(const Vector& vv) -{ - // vv and panCursor are in CANVAS coords - panCursor = vv; - - // copy tmp pixmap - panPM = Tk_GetPixmap(display, Tk_WindowId(tkwin), - options->width, options->height, depth); - if (!panPM) { - internalError("Unable to Create Pan Motion Pixmap"); - return; - } - XCopyArea(display, pixmap, panPM, widgetGC, 0, 0, options->width, - options->height, 0,0); -} - -void Base::panMotionCmd(const Vector& vv) -{ - // vv and panCursor are in CANVAS coords - - // Clear - Vector diff = (vv*canvasToWidget) - (panCursor*canvasToWidget); - - BBox hh,ww; - if (diff[0]>0 && diff[1]>0) { - hh = BBox(Vector(0,0), Vector(options->width, diff[1])); - ww = BBox(Vector(0,0), Vector(diff[0], options->height)); - } else if (diff[0]>0 && diff[1]<0) { - hh = BBox(Vector(options->width,options->height), - Vector(0,options->height+diff[1])); - ww = BBox(Vector(0,0), Vector(diff[0], options->height)); - } else if (diff[0]<0 && diff[1]>0) { - hh = BBox(Vector(0,0), Vector(options->width, diff[1])); - ww = BBox(Vector(options->width,options->height), - Vector(options->width+diff[0], 0)); - } else if (diff[0]<0 && diff[1]<0) { - hh = BBox(Vector(options->width,options->height), - Vector(0,options->height+diff[1])); - ww = BBox(Vector(options->width,options->height), - Vector(options->width+diff[0], 0)); - } - - hh = hh * widgetToWindow; - ww = ww * widgetToWindow; - - XSetForeground(display, widgetGC, getColor(bgColorName)); - - Vector hs = hh.size(); - XFillRectangle(display, Tk_WindowId(tkwin), widgetGC, - (int)hh.ll[0], (int)hh.ll[1], (int)hs[0], (int)hs[1]); - - Vector ws = ww.size(); - XFillRectangle(display, Tk_WindowId(tkwin), widgetGC, - (int)ww.ll[0], (int)ww.ll[1], (int)ws[0], (int)ws[1]); - - // display tmp pixmap at new location - Vector dd = ((vv * canvasToWidget) - (panCursor * canvasToWidget)) * - widgetToWindow; - XCopyArea(display, panPM, Tk_WindowId(tkwin), panGCXOR, - 0, 0, options->width, options->height, dd[0], dd[1]); -} - void Base::pannerCmd(int s) { usePanner = s; @@ -2707,6 +2645,23 @@ void Base::rotateToCmd(double r) update(MATRIX); } +void Base::rotateBeginCmd() +{ + // save the current rotation + rotateRotation = rotation; +} + +void Base::rotateMotionCmd(double angle) +{ + rotation = rotateRotation + angle; + update(MATRIX); +} + +void Base::rotateEndCmd() +{ + update(MATRIX); +} + void Base::saveFitsFileCmd(const char* fn) { OutFitsFile str(fn); diff --git a/tksao/frame/fr3dcommand.C b/tksao/frame/fr3dcommand.C index 178ed49..b91e663 100644 --- a/tksao/frame/fr3dcommand.C +++ b/tksao/frame/fr3dcommand.C @@ -419,32 +419,17 @@ void Frame3dBase::panBBoxCmd(const Vector& vv) update(MATRIX); } -void Frame3dBase::panEndCmd(const Vector& vv) +void Frame3dBase::panBeginCmd(const Vector& vv) { - if (panPM) - Tk_FreePixmap(display, panPM); - panPM = 0; - - Vector dd = vv*canvasToWidget - panCursor*canvasToWidget; - viewCursor_ += dd*Scale(1/zoom_[0],1/zoom_[1]); - - update(MATRIX); -} - -void Frame3dBase::rotateBeginCmd() -{ - // save the current rotation - rotateRotation = rotation; -} - -void Frame3dBase::rotateMotionCmd(double angle) -{ - rotation = rotateRotation + angle; - update(MATRIX); + // vv and panCursor are in CANVAS coords + panCursor = viewCursor_; + panStart = vv; } -void Frame3dBase::rotateEndCmd() +void Frame3dBase::panMotionCmd(const Vector& vv) { + Vector dd = vv*canvasToWidget - panStart*canvasToWidget; + viewCursor_ = panCursor + dd*Scale(1/zoom_[0],1/zoom_[1]); update(MATRIX); } diff --git a/tksao/frame/frame3dbase.h b/tksao/frame/frame3dbase.h index 30f029d..0489718 100644 --- a/tksao/frame/frame3dbase.h +++ b/tksao/frame/frame3dbase.h @@ -179,14 +179,14 @@ class Frame3dBase : public Base { void panToCmd(const Vector&); void panToCmd(const Vector&, Coord::CoordSystem, Coord::SkyFrame); void panBBoxCmd(const Vector&); - void panEndCmd(const Vector&); - void rotateBeginCmd(); - void rotateMotionCmd(double); - void rotateEndCmd(); + void panBeginCmd(const Vector&); + void panMotionCmd(const Vector&); void zoomAboutCmd(const Vector&, const Vector&); - void zoomAboutCmd(const Vector&, const Vector&, Coord::CoordSystem, Coord::SkyFrame); + void zoomAboutCmd(const Vector&, const Vector&, + Coord::CoordSystem, Coord::SkyFrame); void zoomToAboutCmd(const Vector&, const Vector&); - void zoomToAboutCmd(const Vector&, const Vector&, Coord::CoordSystem, Coord::SkyFrame); + void zoomToAboutCmd(const Vector&, const Vector&, + Coord::CoordSystem, Coord::SkyFrame); void zoomToFitCmd(double); // 3d Commands diff --git a/tksao/frame/framebase.h b/tksao/frame/framebase.h index 9aa10a5..e58167a 100644 --- a/tksao/frame/framebase.h +++ b/tksao/frame/framebase.h @@ -95,14 +95,14 @@ public: void panToCmd(const Vector&); void panToCmd(const Vector&, Coord::CoordSystem, Coord::SkyFrame); void panBBoxCmd(const Vector&); - void panEndCmd(const Vector&); - void rotateBeginCmd(); - void rotateMotionCmd(double); - void rotateEndCmd(); + void panBeginCmd(const Vector&); + void panMotionCmd(const Vector&); void zoomAboutCmd(const Vector&, const Vector&); - void zoomAboutCmd(const Vector&, const Vector&, Coord::CoordSystem, Coord::SkyFrame); + void zoomAboutCmd(const Vector&, const Vector&, + Coord::CoordSystem, Coord::SkyFrame); void zoomToAboutCmd(const Vector&, const Vector&); - void zoomToAboutCmd(const Vector&, const Vector&, Coord::CoordSystem, Coord::SkyFrame); + void zoomToAboutCmd(const Vector&, const Vector&, + Coord::CoordSystem, Coord::SkyFrame); void zoomToFitCmd(double); // 3d diff --git a/tksao/frame/frcommand.C b/tksao/frame/frcommand.C index c711dfe..1e7e7e8 100644 --- a/tksao/frame/frcommand.C +++ b/tksao/frame/frcommand.C @@ -292,7 +292,8 @@ void FrameBase::panCmd(const Vector& vv) update(MATRIX); } -void FrameBase::panCmd(const Vector& vv, Coord::CoordSystem sys, Coord::SkyFrame sky) +void FrameBase::panCmd(const Vector& vv, Coord::CoordSystem sys, + Coord::SkyFrame sky) { if (!currentContext->cfits) return; @@ -313,7 +314,8 @@ void FrameBase::panToCmd(const Vector& vv) update(MATRIX); } -void FrameBase::panToCmd(const Vector& vv, Coord::CoordSystem sys, Coord::SkyFrame sky) +void FrameBase::panToCmd(const Vector& vv, Coord::CoordSystem sys, + Coord::SkyFrame sky) { if (!currentContext->cfits) return; @@ -337,38 +339,19 @@ void FrameBase::panBBoxCmd(const Vector& vv) update(MATRIX); } -void FrameBase::panEndCmd(const Vector& vv) +void FrameBase::panBeginCmd(const Vector& vv) { - // vv and panCursor are in Coord::CANVAS coords - // delete tmp pixmap - if (panPM) - Tk_FreePixmap(display, panPM); - panPM = 0; - - // use matrix, not map() for 3d? - Vector start = panCursor * canvasToRef; - Vector stop = vv * canvasToRef; - cursor -= stop - start; - - setBinCursor(); - update(MATRIX); + // vv and panCursor are in CANVAS coords + panCursor = cursor; + panStart = vv; } -void FrameBase::rotateBeginCmd() -{ - // save the current rotation - rotateRotation = rotation; -} - -void FrameBase::rotateMotionCmd(double angle) -{ - rotation = rotateRotation + angle; - update(MATRIX); -} - -void FrameBase::rotateEndCmd() +void FrameBase::panMotionCmd(const Vector& vv) { + Vector dd = vv -panStart; + cursor = panCursor + Vector(-dd[0],dd[1]); update(MATRIX); + setBinCursor(); } void FrameBase::saveFitsResampleFileCmd(const char* fn) |