diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2019-08-06 18:47:32 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2019-08-06 18:47:32 (GMT) |
commit | 0d69794b911194aa91416252cd4687f38e75bbd6 (patch) | |
tree | be69f92ac388ad034dfcb2177dd5389f021d988e /tksao/frame/basecommand.C | |
parent | 9509d93c38781ea6af1b14e8ab0c794b858549cc (diff) | |
download | blt-0d69794b911194aa91416252cd4687f38e75bbd6.zip blt-0d69794b911194aa91416252cd4687f38e75bbd6.tar.gz blt-0d69794b911194aa91416252cd4687f38e75bbd6.tar.bz2 |
clean up code
Diffstat (limited to 'tksao/frame/basecommand.C')
-rw-r--r-- | tksao/frame/basecommand.C | 79 |
1 files changed, 17 insertions, 62 deletions
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); |