[comp.windows.interviews] Zooming on GraphicBlock

doron@corral.leis.bellcore.com (Doron Shalmon) (06/28/91)

I am running InterViews v2.6 and have adjusters operating on
a GraphicBlock.  In particular, I have an Enlarger and a Reducer
for zooming in and out.  I need a "home" button to zoom back
to the graphic's original size.  I created a class, subclassed
from Adjuster, whose AdjustView method (see below) resets the
curwidth and curheight of the GraphicBlock's perpective back
to its width and height, respectively.  This does not seem to
work properly (at least not consistently), and I was wondering
if this was the right way to do this.

Thanks for any suggestions,

Doron

-- 

void HomeZoomer::AdjustView (Event&) {
    register Perspective* s = shown;
    Coord cx, cy;

    *s = *view->GetPerspective();
    cx = s->curx + s->curwidth/2;
    cy = s->cury + s->curheight/2;
    s->curwidth = s->width;
    s->curheight = s->height;
    s->curx = cx - s->curwidth/2;
    s->cury = cy - s->curheight/2;
    view->Adjust(*s);
}

===========================================================================
                               Doron Shalmon
           Bellcore -- Network Planning and Distribution Systems
                  Internet:  doron@yogi.leis.bellcore.com
                      UUCP:  ...!bellcore!yogi!doron

    "All opinions expressed are mine, and do not necessarily represent
      those of my employer, Bell Communications Research (Bellcore)"