diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2019-10-24 17:55:54 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2019-10-24 17:55:54 (GMT) |
commit | a262051adaa2874690dac4f91665f71fc0e29e78 (patch) | |
tree | 546fb9b74cd7ff81abd2165b71eb7129d4525df9 /tksao | |
parent | c96e3c3541337a1f98597ed64174e7c4ba3ad4cb (diff) | |
download | blt-a262051adaa2874690dac4f91665f71fc0e29e78.zip blt-a262051adaa2874690dac4f91665f71fc0e29e78.tar.gz blt-a262051adaa2874690dac4f91665f71fc0e29e78.tar.bz2 |
clean up widget code
Diffstat (limited to 'tksao')
-rw-r--r-- | tksao/frame/base.C | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/tksao/frame/base.C b/tksao/frame/base.C index d4fd8f6..a61930b 100644 --- a/tksao/frame/base.C +++ b/tksao/frame/base.C @@ -1427,10 +1427,21 @@ void Base::updateMagnifier() void Base::updateMagnifier(const Vector& vv) { + if (!useMagnifier) + return; + + if (!doRender()) { + ostringstream str; + str << magnifierName << " clear"; + Tcl_Eval(interp, str.str().c_str()); + return; + } + // vv is in CANVAS coords // save it, we may need it later magnifierCursor = vv; + // just in case if (!(magnifierXImage && magnifierPixmap)) return; @@ -1438,57 +1449,46 @@ void Base::updateMagnifier(const Vector& vv) if (!widgetGC) widgetGC = XCreateGC(display, Tk_WindowId(tkwin), 0, NULL); - if (useMagnifier) { - updateMagnifierMatrices(); - - if (doRender()) { - ximageToPixmapMagnifier(); + // do this first + updateMagnifierMatrices(); + ximageToPixmapMagnifier(); - if (useMagnifierGraphics) { - // render markers - // markers bounding box is in canvas coords - // map the magnifier to a bounding box in canvas coords - Matrix mm = magnifierToRef * refToCanvas; + if (useMagnifierGraphics) { + // render markers + // markers bounding box is in canvas coords + // map the magnifier to a bounding box in canvas coords + Matrix mm = magnifierToRef * refToCanvas; - Vector ll = Vector(0,0) * mm; - Vector ur = Vector(magnifierWidth,magnifierHeight) * mm; - BBox bb = BBox(vv,vv); - bb.bound(ll); - bb.bound(ur); + Vector ll = Vector(0,0) * mm; + Vector ur = Vector(magnifierWidth,magnifierHeight) * mm; + BBox bb = BBox(vv,vv); + bb.bound(ll); + bb.bound(ur); - // render contours - // needs to before markers if marker is filled - currentContext->contourX11(magnifierPixmap, Coord::MAGNIFIER, - BBox(0,0,magnifierWidth,magnifierHeight)); - - if (showMarkers) { - x11MagnifierMarkers(&userMarkers, bb); - x11MagnifierMarkers(&catalogMarkers, bb); - } + // render contours + // needs to before markers if marker is filled + currentContext->contourX11(magnifierPixmap, Coord::MAGNIFIER, + BBox(0,0,magnifierWidth,magnifierHeight)); - // render crosshair - if (useCrosshair) - x11Crosshair(magnifierPixmap, Coord::MAGNIFIER, - magnifierWidth, magnifierHeight); - } + if (showMarkers) { + x11MagnifierMarkers(&userMarkers, bb); + x11MagnifierMarkers(&catalogMarkers, bb); + } - // render cursor - if (useMagnifierCursor) - x11MagnifierCursor(vv); + // render crosshair + if (useCrosshair) + x11Crosshair(magnifierPixmap, Coord::MAGNIFIER, + magnifierWidth, magnifierHeight); + } - // notify the magnifier widget - ostringstream str; - str << magnifierName << " update " << (void*)magnifierPixmap << ends; - Tcl_Eval(interp, str.str().c_str()); + // render cursor + if (useMagnifierCursor) + x11MagnifierCursor(vv); - } - else { - // clear the magnifier widget - ostringstream str; - str << magnifierName << " clear " << (void*)magnifierPixmap << ends; - Tcl_Eval(interp, str.str().c_str()); - } - } + // notify the magnifier widget + ostringstream str; + str << magnifierName << " update " << (void*)magnifierPixmap << ends; + Tcl_Eval(interp, str.str().c_str()); } void Base::updateMatrices() |