home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / gpiimage.zip / IMG_SIZE.C < prev    next >
C/C++ Source or Header  |  1998-04-20  |  20KB  |  617 lines

  1. /**************************************************************************
  2.  *  File name  :  img_size.c
  3.  *
  4.  *  Description:  This module contains the code for sizing the main window,
  5.  *                and scrolling the image inside the window.
  6.  *                Functions contained here:
  7.  *
  8.  *                SizeMainWindow()
  9.  *                SizeCalculateMaxWindow(prclBound)
  10.  *                SizePositionImage(mp2)
  11.  *                SizeVScroll(mp2, rcl, ptl)
  12.  *                SizeHScroll(mp2, rcl, ptl)
  13.  *                ScrollBars(usWidth, usHeight)
  14.  *                Scroll(lThmbpos, lDeltaSc, sScrollType, prclInvalid)
  15.  *
  16.  *  Concepts   :  sizable windows
  17.  *
  18.  *  API's      :  WinSetWindowPos
  19.  *                WinQueryWindowRect
  20.  *                GpiSetCurrentPosition
  21.  *                WinSendMsg
  22.  *                WinWindowFromID
  23.  *                WinScrollWindow
  24.  *                WinInvalidateRect
  25.  *                GpiQueryCurrentPosition
  26.  *
  27.  *  Required
  28.  *    Files    :  OS2.H, STRING.H, STDLIB.H, IMG_MAIN.H, IMG_XTRN.H
  29.  *
  30.  *  Copyright (C) 1991 IBM Corporation
  31.  *
  32.  *      DISCLAIMER OF WARRANTIES.  The following [enclosed] code is
  33.  *      sample code created by IBM Corporation. This sample code is not
  34.  *      part of any standard or IBM product and is provided to you solely
  35.  *      for  the purpose of assisting you in the development of your
  36.  *      applications.  The code is provided "AS IS", without
  37.  *      warranty of any kind.  IBM shall not be liable for any damages
  38.  *      arising out of your use of the sample code, even if they have been
  39.  *      advised of the possibility of such damages.                                                    *
  40.  *************************************************************************/
  41. /*
  42.  *  Include files, macros, defined constants, and externs
  43.  */
  44. #define INCL_WINSCROLLBARS
  45. #define INCL_WINFRAMEMGR
  46. #define INCL_WINSTDFILE
  47. #define INCL_GPIPRIMITIVES
  48.  
  49. #include <os2.h>
  50. #include <string.h>
  51. #include <stdlib.h>
  52.  
  53. #include "img_main.h"
  54. #include "img_xtrn.h"
  55.  
  56. /*
  57.  *  Static variables
  58.  */
  59. ULONG ulScrollXPage;
  60. ULONG ulScrollYPage;
  61. ULONG ulScrollYLine  = LINESCROLL;
  62. ULONG ulScrollXLine  = LINESCROLL;
  63.  
  64. /*
  65.  *  Entry point declarations
  66.  */
  67. VOID ScrollBars(USHORT usWidth, USHORT usHeight);
  68. VOID Scroll(LONG lThmbpos, LONG lDeltaSc, SHORT sScrollType,
  69.             PRECTL prclInvalid);
  70.  
  71. /**************************************************************************
  72.  *
  73.  *  Name       : SizeMainWindow()
  74.  *
  75.  *  Description: Maximizes the amount of the image that is
  76.  *               visible . This can only be done after the image
  77.  *               has been loaded, as the size of the window is
  78.  *               directly related to the size of the image.
  79.  *
  80.  *  Concepts   : Routine is called whenever a WM_COMMAND message
  81.  *               is posted to the main window as a result of
  82.  *               selecting the 'Detail' item on the 'View'
  83.  *               pulldown.
  84.  *
  85.  *                Sets the size and position of the main window
  86.  *                whenever 'Detail' mode is selected.
  87.  *
  88.  *  API's      :  WinSetWindowPos
  89.  *                WinQueryWindowRect
  90.  *                GpiSetCurrentPosition
  91.  *
  92.  *  Parameters :  [none]
  93.  *
  94.  *  Return     :  [none]
  95.  *
  96.  *************************************************************************/
  97. VOID SizeMainWindow(void)
  98. {
  99.     RECTL  rcl, rclCWM;
  100.  
  101.     /* limit the window size */
  102.     SizeCalculateMaxWindow(&rclCWM);
  103.     WinSetWindowPos(vhwndFrame, (HWND)NULL,
  104.                     (SHORT)rclCWM.xLeft,
  105.                     (SHORT)rclCWM.yBottom,
  106.                     (SHORT)(rclCWM.xRight - rclCWM.xLeft),
  107.                     (SHORT)(rclCWM.yTop - rclCWM.yBottom),
  108.                     SWP_MOVE | SWP_SIZE);
  109.  
  110.    /*
  111.     * The position of the top-left corner of the window rectangle is
  112.     * recorded and selected as the current position before the image is
  113.     * drawn.
  114.     */
  115.  
  116.     WinQueryWindowRect(vhwndClient, &rcl);
  117.     vptlSave.x = rcl.xLeft;
  118.     vptlSave.y = rcl.yTop;
  119.     GpiSetCurrentPosition(vhps, &vptlSave);
  120.  
  121.    /*
  122.     * set the scroll-bar range and slider position and size
  123.     */
  124.     ScrollBars((USHORT)(rcl.xRight - rcl.xLeft),
  125.                (USHORT)(rcl.yTop - rcl.yBottom));
  126.  
  127. }   /* End of SizeMainWindow */
  128.  
  129. /**************************************************************************
  130.  *
  131.  *  Name       : Scroll()
  132.  *
  133.  *  Description: Scrolls the window contents horizontally or
  134.  *               vertically.
  135.  *
  136.  *  Concepts   : Routine is called from SizeVScroll() and
  137.  *               SizeHScroll()
  138.  *               - reposition slider
  139.  *               - scroll the window contents in the required
  140.  *                 direction by the required amount.
  141.  *
  142.  *  API's      :  WinSendMsg
  143.  *                WinWindowFromID
  144.  *                WinScrollWindow
  145.  *
  146.  *  Parameters :  lThmbPos =  new thumb position
  147.  *                lDeltaSc =  scrolled amount
  148.  *                sScrollType =  horizontal/vertical scroll ?
  149.  *                prclInvalid) = invalidated area
  150.  *
  151.  *  Return     :  [none]
  152.  *
  153.  *************************************************************************/
  154. VOID Scroll(
  155.             LONG   lThmbPos,        /* new thumb position */
  156.             LONG   lDeltaSc,        /* scrolled amount */
  157.             SHORT  sScrollType,     /* horizontal/vertical scroll ? */
  158.             PRECTL prclInvalid)     /* invalidated area */
  159. {
  160.    unsigned Fid;
  161.  
  162.    /* determine type of scroll operation */
  163.    Fid = sScrollType == VERTSCROLL ? FID_VERTSCROLL : FID_HORZSCROLL;
  164.  
  165.   /*
  166.    * reposition the slider
  167.    */
  168.    WinSendMsg(WinWindowFromID(vhwndFrame, Fid),
  169.               SBM_SETPOS,
  170.               MPFROMLONG(lThmbPos),
  171.               (MPARAM)NULL);
  172.  
  173.   /*
  174.    * scroll the window contents
  175.    */
  176.  
  177.    if (sScrollType == VERTSCROLL)
  178.  
  179.        /* vertical scroll */
  180.        WinScrollWindow(vhwndClient,
  181.                        0,
  182.                        (SHORT)lDeltaSc,
  183.                        (PRECTL)NULL,
  184.                        (PRECTL)NULL,
  185.                        (HRGN)NULL,
  186.                        (PRECTL)prclInvalid,
  187.                        0);
  188.    else
  189.  
  190.        /* horizontal scroll */
  191.        WinScrollWindow(vhwndClient,
  192.                        (SHORT)lDeltaSc,
  193.                        0,
  194.                        (PRECTL)NULL,
  195.                        (PRECTL)NULL,
  196.                        (HRGN)NULL,
  197.                        (PRECTL)prclInvalid,
  198.                        0);
  199.  
  200. }   /* End of Scroll */
  201.  
  202.  
  203. /**************************************************************************
  204.  *
  205.  *  Name       : ScrollBars()
  206.  *
  207.  *  Description: Prepares the main window for scrolling (i.e.
  208.  *               set up the scrollbars appropriately)
  209.  *
  210.  *  Concepts   : Routine is called from WndSize() and SizeMain()
  211.  *               - set scrollbar ranges
  212.  *               - set slider size relative to the current window
  213.  *                 size
  214.  *
  215.  *  API's      :  WinSendMsg
  216.  *                GpiQueryCurrentPosition
  217.  *
  218.  *  Parameters :  usWidth  =  width
  219.  *                usHeight =  height
  220.  *
  221.  *  Return     :  [none]
  222.  *
  223.  *************************************************************************/
  224. VOID ScrollBars(USHORT usWidth, USHORT usHeight)
  225. {
  226.    POINTL ptlCur;
  227.  
  228.   /*
  229.    * calculate the full scrolling range
  230.    */
  231.    vulScrollXMax = vsizlImg.cx - usWidth;
  232.    vulScrollYMax = vsizlImg.cy - usHeight;
  233.  
  234.   /*
  235.    * The page-scrolling action scrolls the image by half of the window
  236.    * extent in both axes.
  237.    */
  238.    ulScrollXPage = usWidth  / 2;
  239.    ulScrollYPage = usHeight / 2;
  240.  
  241.   /*
  242.    * get current position, which is at the top-left of the image
  243.    */
  244.    GpiQueryCurrentPosition(vhps, &ptlCur);
  245.  
  246.   /*
  247.    * The scroll-bar slider is positioned according to the position
  248.    * of the image in the newly-sized window.
  249.    */
  250.    WinSendMsg(vhwndHScroll,
  251.               SBM_SETSCROLLBAR,
  252.               MPFROMLONG(-ptlCur.x),                  /* slider position */
  253.               MPFROM2SHORT(0, (SHORT)vulScrollXMax));   /* range         */
  254.  
  255.    WinSendMsg(vhwndVScroll,
  256.               SBM_SETSCROLLBAR,
  257.               MPFROMLONG(ptlCur.y - usHeight),        /* slider position */
  258.               MPFROM2SHORT(0, (SHORT)vulScrollYMax));   /* range         */
  259.  
  260.    WinSendMsg(vhwndHScroll,
  261.               SBM_SETTHUMBSIZE,
  262.               MPFROM2SHORT(usWidth, (SHORT)(vsizlImg.cx)),
  263.               (MPARAM)0L);
  264.  
  265.    WinSendMsg(vhwndVScroll,
  266.               SBM_SETTHUMBSIZE,
  267.               MPFROM2SHORT(usHeight, (SHORT)(vsizlImg.cy)),
  268.               (MPARAM)0L);
  269.  
  270. }  /* End of ScrollBars */
  271.  
  272. /**************************************************************************
  273.  *
  274.  *  Name       : SizeCalculateMaxWindow()
  275.  *
  276.  *  Description: Calculates the maximized window size, which
  277.  *               must not exceed the size of the loaded image.
  278.  *
  279.  *  Concepts   : Routine is called from SizeMain(), LoadImage(),
  280.  *               MainWndProc() and FrameWndProc()
  281.  *
  282.  *               max_window_size = min(screen_size, image_size)
  283.  *
  284.  *  API's      :  [none]
  285.  *
  286.  *  Parameters :  prclBound = points to the bounding rectangle
  287.  *
  288.  *  Return     :   TRUE  - if image loaded and in 'Detail' mode
  289.  *                 FALSE - if either the image isn't loaded or
  290.  *                       the application is not in 'Detail' mode
  291.  *
  292.  *************************************************************************/
  293. BOOL SizeCalculateMaxWindow(prclBound)
  294. PRECTL prclBound;
  295. {
  296.   /*
  297.    * Calculate the maximized window size. If an image has been loaded
  298.    * in 'Detail' mode, the maximized window is the smaller of the
  299.    * screen and the image.
  300.    */
  301.  
  302.    if (vfImgLoaded && vfDetail)
  303.    {
  304.        if (vsizlImg.cx > (vlYScreen - vlcxVScroll))
  305.        {
  306.            prclBound->xLeft  = -vlcxBorder;
  307.            prclBound->xRight = prclBound->xLeft + vlYScreen +
  308.                                (2*vlcxBorder);
  309.        }
  310.        else
  311.        {
  312.            prclBound->xLeft  = 0;
  313.            prclBound->xRight = prclBound->xLeft +
  314.                                vsizlImg.cx + vlcxVScroll +
  315.                                (2*vlcxBorder);
  316.        }
  317.  
  318.        if (vsizlImg.cy >
  319.            (vlYScreen - vlcyHScroll - vlcyMenu - vlcyTitle))
  320.        {
  321.            prclBound->yBottom = -vlcyBorder;
  322.            prclBound->yTop = prclBound->yBottom + vlYScreen +
  323.                              (2*vlcyBorder);
  324.        }
  325.        else
  326.        {
  327.            prclBound->yTop = vlYScreen;
  328.            prclBound->yBottom = prclBound->yTop -
  329.                                 (vsizlImg.cy + vlcyTitle + vlcyMenu +
  330.                                  vlcyHScroll + (2*vlcyBorder));
  331.        }
  332.        return  TRUE;
  333.    }
  334.    else
  335.        /* error if not in 'Detail' mode */
  336.        return FALSE;
  337. }   /* End of SizeCalculateMaxWindow */
  338.  
  339. /**************************************************************************
  340.  *
  341.  *  Name       : SizeVScroll(mp2, rcl, ptl)
  342.  *
  343.  *  Description: Implements vertical scrolling in 'Detail' mode
  344.  *
  345.  *  Concepts   : Routine is called MainWndProc() and it invokes
  346.  *               Scroll().
  347.  *
  348.  *               -adjust current position
  349.  *               -redraw image at new position
  350.  *
  351.  *  API's      : GpiSetCurrentPosition
  352.  *               WinInvalidateRect
  353.  *
  354.  *  Parameters :  mp2 = second message parameter
  355.  *                rcl = rectangle
  356.  *                ptl = new position
  357.  *
  358.  *  Return     :  [none]
  359.  *
  360.  *************************************************************************/
  361. VOID SizeVScroll(MPARAM mp2, RECTL rcl, POINTL ptl)
  362. {
  363.    LONG   lDeltaScr;
  364.  
  365.    /* act on the type of vertical scroll message */
  366.    switch (SHORT2FROMMP(mp2))
  367.    {
  368.        case SB_LINEDOWN:
  369.  
  370.           /*
  371.            * line-down processing
  372.            */
  373.            if ((ULONG)(ptl.y - rcl.yTop) < vulScrollYMax)
  374.            {
  375.                lDeltaScr = ptl.y;
  376.                ptl.y +=
  377.                    ((ULONG)(ptl.y - rcl.yTop) + ulScrollYLine < vulScrollYMax) ?
  378.                    ulScrollYLine : vulScrollYMax - (ptl.y - rcl.yTop);
  379.                lDeltaScr = ptl.y - lDeltaScr;
  380.                GpiSetCurrentPosition(vhps, &ptl);
  381.                Scroll((ptl.y-rcl.yTop), lDeltaScr, VERTSCROLL, &rcl);
  382.                WinInvalidateRect(vhwndClient, &rcl, FALSE);
  383.            }
  384.            break;
  385.  
  386.        case SB_LINEUP:
  387.  
  388.           /*
  389.            * line-up processing
  390.            */
  391.            if (ptl.y > rcl.yTop)
  392.            {
  393.                lDeltaScr = ptl.y;
  394.                ptl.y -= (ptl.y > rcl.yTop + ulScrollYLine) ?
  395.                          ulScrollYLine : ptl.y - rcl.yTop;
  396.                lDeltaScr = ptl.y - lDeltaScr;
  397.                GpiSetCurrentPosition(vhps, &ptl);
  398.                Scroll((ptl.y-rcl.yTop), lDeltaScr, VERTSCROLL, &rcl);
  399.                WinInvalidateRect(vhwndClient, &rcl, FALSE);
  400.            }
  401.            break;
  402.  
  403.        case SB_PAGEDOWN:
  404.  
  405.           /*
  406.            * page-down processing
  407.            */
  408.            if ((ULONG)(ptl.y - rcl.yTop) < vulScrollYMax)
  409.            {
  410.                lDeltaScr =
  411.                    ((ULONG)(ptl.y - rcl.yTop) + ulScrollYPage < vulScrollYMax) ?
  412.                     ulScrollYPage : vulScrollYMax -
  413.                     (SHORT)(ptl.y - rcl.yTop);
  414.                ptl.y += lDeltaScr;
  415.                GpiSetCurrentPosition(vhps, &ptl);
  416.                Scroll((ptl.y-rcl.yTop), lDeltaScr, VERTSCROLL, &rcl);
  417.                WinInvalidateRect(vhwndClient, &rcl, FALSE);
  418.            }
  419.            break;
  420.  
  421.        case SB_PAGEUP:
  422.  
  423.           /*
  424.            * page-up processing
  425.            */
  426.            if (ptl.y > rcl.yTop)
  427.            {
  428.                lDeltaScr = (ptl.y > rcl.yTop + ulScrollYPage) ?
  429.                             ulScrollYPage : (SHORT)(ptl.y - rcl.yTop);
  430.                ptl.y -= lDeltaScr;
  431.                GpiSetCurrentPosition(vhps, &ptl);
  432.                Scroll((ptl.y-rcl.yTop), -lDeltaScr, VERTSCROLL, &rcl);
  433.                WinInvalidateRect(vhwndClient, &rcl, FALSE);
  434.            }
  435.            break;
  436.  
  437.        case SB_SLIDERPOSITION:
  438.  
  439.           /*
  440.            * adjust the slider position
  441.            */
  442.            lDeltaScr = ptl.y;
  443.            ptl.y = rcl.yTop + SHORT1FROMMP(mp2);
  444.            lDeltaScr = ptl.y - lDeltaScr;
  445.            GpiSetCurrentPosition(vhps, &ptl);
  446.            Scroll((LONG)(SHORT1FROMMP(mp2)), lDeltaScr, VERTSCROLL, &rcl);
  447.            WinInvalidateRect(vhwndClient, &rcl, FALSE);
  448.            break;
  449.  
  450.    }
  451. }   /* End of SizeVScroll() */
  452.  
  453. /**************************************************************************
  454.  *
  455.  *  Name       : SizeHScroll(mp2, rcl, ptl)
  456.  *
  457.  *  Description: Implements horizontal scrolling in 'Detail' mode
  458.  *
  459.  *  Concepts   : Routine is called MainWndProc() and it invokes
  460.  *               Scroll().
  461.  *
  462.  *               -adjust current position
  463.  *               -redraw image at new position
  464.  *
  465.  *  API's      : GpiSetCurrentPosition
  466.  *               WinInvalidateRect
  467.  *
  468.  *  Parameters :  mp2 = second message parameter
  469.  *                rcl = rectangle
  470.  *                ptl = new position
  471.  *
  472.  *  Return     :  [none]
  473.  *
  474.  *************************************************************************/
  475. VOID SizeHScroll(MPARAM mp2, RECTL rcl, POINTL ptl)
  476. {
  477.    LONG   lDeltaScr;
  478.  
  479.    /* act on the type of horizontal scroll message */
  480.    switch(SHORT2FROMMP(mp2))
  481.    {
  482.        case SB_LINERIGHT:
  483.  
  484.           /*
  485.            * line-right processing
  486.            */
  487.            if ((vsizlImg.cx + ptl.x) > rcl.xRight)
  488.            {
  489.                lDeltaScr = ptl.x;
  490.                ptl.x -=
  491.                    ((vsizlImg.cx + ptl.x) > rcl.xRight+ulScrollXLine) ?
  492.                    ulScrollXLine : ptl.x + vsizlImg.cx - rcl.xRight;
  493.                lDeltaScr = ptl.x - lDeltaScr;
  494.                GpiSetCurrentPosition(vhps, &ptl);
  495.                Scroll(-ptl.x, lDeltaScr, HORZSCROLL, &rcl);
  496.                WinInvalidateRect(vhwndClient, &rcl, FALSE);
  497.            }
  498.            break;
  499.  
  500.        case SB_LINELEFT:
  501.  
  502.           /*
  503.            * line-left processing
  504.            */
  505.            if (ptl.x < rcl.xLeft)
  506.            {
  507.                lDeltaScr = ptl.x;
  508.                ptl.x += ((ULONG)(rcl.xLeft - ptl.x) > ulScrollXLine) ?
  509.                          ulScrollXLine : rcl.xLeft - ptl.x;
  510.                lDeltaScr = ptl.x - lDeltaScr;
  511.                GpiSetCurrentPosition(vhps, &ptl);
  512.                Scroll(-ptl.x, lDeltaScr, HORZSCROLL, &rcl);
  513.                WinInvalidateRect(vhwndClient, &rcl, FALSE);
  514.            }
  515.            break;
  516.  
  517.        case SB_PAGERIGHT:
  518.  
  519.           /*
  520.            * page-right processing
  521.            */
  522.            if ((vsizlImg.cx + ptl.x) > rcl.xRight)
  523.            {
  524.                lDeltaScr =
  525.                   ((vsizlImg.cx+(LONG)ptl.x) > rcl.xRight+ulScrollXPage) ?
  526.                   ulScrollXPage : (vsizlImg.cx + ptl.x - rcl.xRight);
  527.                ptl.x -= (LONG)lDeltaScr;
  528.                GpiSetCurrentPosition(vhps, &ptl);
  529.                Scroll(-ptl.x, -lDeltaScr, HORZSCROLL, &rcl);
  530.                WinInvalidateRect(vhwndClient, &rcl, FALSE);
  531.            }
  532.            break;
  533.  
  534.        case SB_PAGELEFT:
  535.  
  536.           /*
  537.            * page-left processing
  538.            */
  539.            if (ptl.x < rcl.xLeft)
  540.            {
  541.                lDeltaScr = ((ULONG)(rcl.xLeft - ptl.x) > ulScrollXPage) ?
  542.                             ulScrollXPage : (SHORT)(rcl.xLeft - ptl.x);
  543.                ptl.x += lDeltaScr;
  544.                GpiSetCurrentPosition(vhps, &ptl);
  545.                Scroll(-ptl.x, lDeltaScr, HORZSCROLL, &rcl);
  546.                WinInvalidateRect(vhwndClient, &rcl, FALSE);
  547.            }
  548.            break;
  549.  
  550.        case SB_SLIDERPOSITION:
  551.  
  552.           /*
  553.            * adjust the slider position
  554.            */
  555.            lDeltaScr = ptl.x;
  556.            ptl.x = (LONG)rcl.xLeft - (LONG)SHORT1FROMMP(mp2);
  557.            lDeltaScr = ptl.x - lDeltaScr;
  558.            GpiSetCurrentPosition(vhps, &ptl);
  559.            Scroll((LONG)(SHORT1FROMMP(mp2)), lDeltaScr, HORZSCROLL, &rcl);
  560.            WinInvalidateRect(vhwndClient, &rcl, FALSE);
  561.            break;
  562.  
  563.        default:
  564.            break;
  565.    }
  566. }   /* End of SizeHScroll */
  567.  
  568. /**************************************************************************
  569.  *
  570.  *  Name       : SizePositionImage(mp2)
  571.  *
  572.  *  Description: Positions the image correctly within a sized window.
  573.  
  574.  *  Concepts   : Routine is called MainWndProc() and it invokes
  575.  *               ScrollBars().
  576.  *
  577.  *               - adjust current position of image
  578.  *               - adjust range & position of scrollbars
  579.  *
  580.  *  API's      : GpiSetCurrentPosition
  581.  *               WinQueryWindowRect
  582.  *               GpiQueryCurrentPosition
  583.  *
  584.  *  Parameters :  mp2 = second message parameter
  585.  *
  586.  *  Return     :  [none]
  587.  *
  588.  *************************************************************************/
  589. VOID SizePositionImage(MPARAM mp2)
  590. {
  591.    RECTL  rcl;            /* new window rectangle              */
  592.    POINTL ptl;            /* new current position              */
  593.  
  594.    WinQueryWindowRect(vhwndClient, &rcl);
  595.    GpiQueryCurrentPosition(vhps, &ptl);
  596.  
  597.   /*
  598.    * The WM_QUERYTRACKINFO processing ensures that window size never
  599.    * exceeds image size. Here, however, image position in relation to
  600.    * window limits is checked.
  601.    *
  602.    * Set current position such that the image top and right edges are
  603.    * at least at the window limits.
  604.    */
  605.  
  606.    ptl.y = (ptl.y < rcl.yTop) ? rcl.yTop : ptl.y;
  607.    ptl.x = ((ptl.x + vsizlImg.cx) < rcl.xRight) ?
  608.             (rcl.xRight - rcl.xLeft) - vsizlImg.cx : ptl.x;
  609.    GpiSetCurrentPosition(vhps, &ptl);
  610.  
  611.   /*
  612.    * adjust scroll-bar positioning and range to new window size
  613.    */
  614.    ScrollBars(SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
  615. }  /* End of SizePositionImage() */
  616. /***************************  End of img_size.c  *************************/
  617.