home *** CD-ROM | disk | FTP | other *** search
/ Solo Programadores 22 / SOLO_22.iso / packages / win32ada / data.z / zoomin_pkg.adb < prev    next >
Encoding:
Text File  |  1995-12-16  |  20.6 KB  |  652 lines

  1. -- $Source: /home/harp/1/proto/monoBANK/winnt/zoomin_pkg.adb,v $ 
  2. -- $Revision: 1.2 $ $Date: 95/12/15 16:49:42 $ $Author: mg $ 
  3.  
  4. with Interfaces.C;
  5. with System;
  6. with Win32;
  7. with Win32.Windef;
  8. with Win32.Winuser;
  9.  
  10.  
  11. package body Zoomin_Pkg is
  12.  
  13.     use Interfaces.C;
  14.     use Win32;
  15.  
  16.     function CP(S : Win32.CHAR_Array) return Win32.LPCSTR is
  17.         function UC is new Ada.Unchecked_Conversion(System.Address,Win32.LPCSTR);
  18.     begin
  19.         return UC(S(S'First)'Address);
  20.     end CP;
  21.  
  22.     function Is_Null (Addr: System.Address) return Boolean is
  23.         use type System.Address;
  24.     begin
  25.     return Addr = System.Null_Address;
  26.     end Is_Null;
  27.     pragma Inline(Is_Null);
  28.  
  29.  
  30.     --
  31.     -- This function was a macro in zoomin.h.
  32.     --
  33.     function Bound(X   : Win32.LONG;
  34.                    MIN : Win32.LONG;
  35.                    MAX : Win32.LONG) return Win32.LONG is
  36.  
  37.         RETVAL : Win32.LONG;
  38.     begin
  39.         RETVAL := X;
  40.         if X < MIN then
  41.             RETVAL := MIN;
  42.         elsif X > MAX then
  43.             RETVAL := MAX;
  44.         end if;
  45.         return RETVAL;
  46.     end Bound;
  47.  
  48.  
  49. --
  50. --/************************************************************************
  51. --* CalcZoomedSize
  52. --*
  53. --* Calculates some globals.  This routine needs to be called any
  54. --* time that the size of the app or the zoom factor changes.
  55. --*
  56. --* History:
  57. --*
  58. --************************************************************************/
  59. --
  60. procedure CalcZoomedSize is
  61.  
  62.     RC : Win32.WinDef.LPRECT;
  63.  
  64. begin
  65.   RC := new Win32.WinDef.RECT;
  66.   bResult := Win32.WinUser.GetClientRect(GHWNDAPP, RC);
  67.  
  68.   GCXZOOMED := (RC.RIGHT / GNZOOM) + 1;
  69.   GCYZOOMED := (RC.BOTTOM / GNZOOM) + 1;
  70. end CalcZoomedSize;
  71.  
  72. --
  73. --/************************************************************************
  74. --* DoTheZoomIn
  75. --*
  76. --* Does the actual paint of the zoomed image.
  77. --*
  78. --* Arguments:
  79. --*   HDC hdc - If not NULL, this hdc will be used to paint with.
  80. --*             If NULL, a dc for the apps window will be obtained.
  81. --*
  82. --* History:
  83. --*
  84. --************************************************************************/
  85. --
  86. procedure DoTheZoomIn(HDC_IN : WinDef.HDC) is
  87.  
  88.     HDC_P     : WinDef.HDC;
  89.     FRELEASE  : Win32.BOOL;
  90.     HPALOLD   : WinDef.HPALETTE := System.Null_Address;
  91.     HDCSCREEN : WinDef.HDC;
  92.     X         : Win32.LONG;
  93.     Y         : Win32.LONG;
  94.  
  95. begin
  96.   if Is_Null(HDC_IN) then
  97.     HDC_P := WinUser.GetDC(GHWNDAPP);
  98.     FRELEASE := Win32.TRUE;
  99.   else
  100.     HDC_P := HDC_IN;
  101.     FRELEASE := Win32.FALSE;
  102.   end if;
  103.   if not Is_Null(GHPALPHYSICAL) then
  104.     HPALOLD := WinGdi.SelectPalette(HDC_P, GHPALPHYSICAL, Win32.FALSE);
  105.     uResult := WinGdi.RealizePalette(HDC_P);
  106.   end if;
  107.  
  108. --  /*
  109. --   * The point must not include areas outside the screen dimensions.
  110. --   */
  111.   X := BOUND(GPTZOOM.X, GCXZOOMED / 2, GCXSCREENMAX - (GCXZOOMED / 2));
  112.   Y := BOUND(GPTZOOM.Y, GCYZOOMED / 2, GCYSCREENMAX - (GCYZOOMED / 2));
  113.  
  114.   HDCSCREEN := WinUser.GetDC(System.Null_Address);
  115.   siResult := WinGdi.SetStretchBltMode(HDC_P, WinGdi.COLORONCOLOR);
  116.   bResult := WinGdi.StretchBlt(HDC_P, 0, 0, 
  117.                                Win32.INT (GNZOOM * GCXZOOMED), 
  118.                                Win32.INT (GNZOOM * GCYZOOMED),
  119.                                HDCSCREEN, 
  120.                                Win32.INT (X - GCXZOOMED / 2),
  121.                                Win32.INT (Y - GCYZOOMED / 2), 
  122.                                Win32.INT (GCXZOOMED), 
  123.                                Win32.INT (GCYZOOMED), WinGdi.SRCCOPY);
  124.   siResult := WinUser.ReleaseDC(System.Null_Address, HDCSCREEN);
  125.  
  126.   if not Is_Null(HPALOLD) then
  127.     hResult := WinGdi.SelectPalette(HDC_P, HPALOLD, Win32.FALSE);
  128.   end if;
  129.  
  130.   if FRELEASE /= Win32.FALSE then
  131.     siResult := WinUser.ReleaseDC(GHWNDAPP, HDC_P);
  132.   end if;
  133. end DoTheZoomIn;
  134.  
  135. --
  136. --/************************************************************************
  137. --* MoveView
  138. --*
  139. --* This function moves the current view around.
  140. --*
  141. --* Arguments:
  142. --*   INT nDirectionCode - Direction to move.  Must be VK_UP, VK_DOWN,
  143. --*                        VK_LEFT or VK_RIGHT.
  144. --*   BOOL fFast         - TRUE if the move should jump a larger increment.
  145. --*                        If FALSE, the move is just one pixel.
  146. --*   BOOL fPeg          - If TRUE, the view will be pegged to the screen
  147. --*                        boundary in the specified direction.  This overides
  148. --*                        the fFast parameter.
  149. --*
  150. --* History:
  151. --*
  152. --************************************************************************/
  153. --
  154. procedure MoveView(NDIRECTIONCODE : Win32.WPARAM;
  155.                    FFAST          : Win32.BOOL;
  156.                    FPEG           : Win32.BOOL) is
  157.  
  158.     DDELTA : Win32.LONG;
  159.  
  160. begin
  161.   if FFAST /= Win32.FALSE then
  162.     DDELTA := FASTDELTA;
  163.   else
  164.     DDELTA := 1;
  165.   end if;
  166.   case NDIRECTIONCODE is
  167.   when WinUser.VK_UP =>
  168.     if FPEG /= Win32.FALSE then
  169.       GPTZOOM.Y := GCYZOOMED / 2;
  170.     else
  171.       GPTZOOM.Y := GPTZOOM.Y - DDELTA;
  172.     end if;
  173.     GPTZOOM.Y := BOUND(GPTZOOM.Y, 0, GCYSCREENMAX);
  174.  
  175.   when WinUser.VK_DOWN =>
  176.     if FPEG /= Win32.FALSE then
  177.       GPTZOOM.Y := GCYSCREENMAX - (GCYZOOMED / 2);
  178.     else
  179.       GPTZOOM.Y := GPTZOOM.Y + DDELTA;
  180.     end if;
  181.     GPTZOOM.Y := BOUND(GPTZOOM.Y, 0, GCYSCREENMAX);
  182.  
  183.   when WinUser.VK_LEFT =>
  184.     if FPEG /= Win32.FALSE then
  185.       GPTZOOM.X := GCXZOOMED / 2;
  186.     else
  187.       GPTZOOM.X := GPTZOOM.X - DDELTA;
  188.     end if;
  189.     GPTZOOM.X := BOUND(GPTZOOM.X, 0, GCXSCREENMAX);
  190.  
  191.   when WinUser.VK_RIGHT =>
  192.     if FPEG /= Win32.FALSE then
  193.       GPTZOOM.X := GCXSCREENMAX - (GCXZOOMED / 2);
  194.     else
  195.       GPTZOOM.X := GPTZOOM.X + DDELTA;
  196.     end if;
  197.     GPTZOOM.X := BOUND(GPTZOOM.X, 0, GCXSCREENMAX);
  198.  
  199.   when others => null;
  200.   end case;
  201.   DoTheZoomIn(System.Null_Address);
  202. end MoveView;
  203.  
  204. --
  205. --/************************************************************************
  206. --* DrawZoomRect
  207. --*
  208. --* This function draws the tracking rectangle.  The size and shape of
  209. --* the rectangle will be proportional to the size and shape of the
  210. --* app's client, and will be affected by the zoom factor as well.
  211. --*
  212. --* History:
  213. --*
  214. --************************************************************************/
  215. --
  216. procedure DrawZoomRect is
  217.  
  218.     HDC_P : WinDef.HDC;
  219.     RC    : WinDef.LPRECT;
  220.     X     : Win32.LONG;
  221.     Y     : Win32.LONG;
  222.  
  223. begin
  224.   X := BOUND(GPTZOOM.X, GCXZOOMED / 2, GCXSCREENMAX - (GCXZOOMED / 2));
  225.   Y := BOUND(GPTZOOM.Y, GCYZOOMED / 2, GCYSCREENMAX - (GCYZOOMED / 2));
  226.  
  227.   RC := new WinDef.RECT;
  228.  
  229.   RC.LEFT   := X - GCXZOOMED / 2;
  230.   RC.TOP    := Y - GCYZOOMED / 2;
  231.   RC.RIGHT  := RC.LEFT + GCXZOOMED;
  232.   RC.BOTTOM := RC.TOP + GCYZOOMED;
  233.  
  234.   bResult := WinUser.InflateRect(RC, 1, 1);
  235.  
  236.   HDC_P := WinUser.GetDC(System.Null_Address);
  237.  
  238.   bResult := WinGdi.PatBlt(HDC_P, Win32.INT (RC.LEFT), 
  239.                            Win32.INT (RC.TOP), Win32.INT (RC.RIGHT-RC.LEFT), 
  240.                            1, WinGdi.DSTINVERT);
  241.   -- note: input types INT can also be input as Win32.INT
  242.   bResult := WinGdi.PatBlt(HDC_P, Win32.INT (RC.LEFT), 
  243.                            Win32.INT (RC.BOTTOM), 1, 
  244.                            Win32.INT (-(RC.BOTTOM-RC.TOP)), 
  245.                            WinGdi.DSTINVERT);
  246.   bResult := WinGdi.PatBlt(HDC_P, Win32.INT (RC.RIGHT-1), 
  247.                            Win32.INT (RC.TOP), 1, 
  248.                            Win32.INT (RC.BOTTOM-RC.TOP),
  249.                            WinGdi.DSTINVERT);
  250.   bResult := WinGdi.PatBlt(HDC_P, Win32.INT (RC.RIGHT), 
  251.                            Win32.INT (RC.BOTTOM-1), 
  252.                            Win32.INT (-(RC.RIGHT-RC.LEFT)), 1, 
  253.                            WinGdi.DSTINVERT);
  254.  
  255.   siResult := WinUser.ReleaseDC(System.Null_Address, HDC_P);
  256. end DrawZoomRect;
  257.  
  258. --
  259. --/************************************************************************
  260. --* EnableRefresh
  261. --*
  262. --* This function turns on or off the auto-refresh feature.
  263. --*
  264. --* Arguments:
  265. --*   BOOL fEnable - TRUE to turn the refresh feature on, FALSE to
  266. --*                  turn it off.
  267. --*
  268. --* History:
  269. --*
  270. --************************************************************************/
  271. --
  272. procedure EnableRefresh(FENABLE : Win32.BOOL) is
  273.  
  274.     URESULT : Win32.UINT;
  275.  
  276. begin
  277.   if FENABLE = Win32.TRUE then
  278. -- /*
  279. -- * Already enabled.  Do nothing.
  280. -- */
  281.     if GFREFENABLE = Win32.TRUE then
  282.       return;
  283.     end if;
  284.     URESULT := WinUser.SetTimer(GHWNDAPP, idtimer_zoomin, 
  285.                                 GNREFINTERVAL * 100, null);
  286.     if URESULT /= 0 then
  287.       GFREFENABLE := Win32.TRUE;
  288.     end if;
  289.   else
  290. -- /*
  291. -- * Not enabled yet.  Do nothing.
  292. -- */
  293.     if GFREFENABLE = Win32.FALSE then
  294.       return;
  295.     end if;
  296.     bResult := WinUser.KillTimer(GHWNDAPP, idtimer_zoomin);
  297.     GFREFENABLE := Win32.FALSE;
  298.   end if;
  299. end EnableRefresh;
  300.  
  301. --
  302. --/************************************************************************
  303. --* CopyToClipboard
  304. --*
  305. --* This function copies the client area image of the app into the
  306. --* clipboard.
  307. --*
  308. --* History:
  309. --*
  310. --************************************************************************/
  311. --
  312. procedure CopyToClipboard is
  313.  
  314.     HDCSRC  : WinDef.HDC;
  315.     HDCDST  : WinDef.HDC;
  316.     RC      : WinDef.LPRECT;
  317.     HBM     : WinDef.HBITMAP;
  318.     RESULT  : Win32.BOOL;
  319.     DEVCAPS : Win32.INT;
  320.     SIZE_X  : Win32.INT;
  321.     SIZE_Y  : Win32.INT;
  322.  
  323. begin
  324.   RESULT := WinUser.OpenClipboard(GHWNDAPP);
  325.   if RESULT = Win32.TRUE then
  326.     bResult := WinUser.EmptyClipboard;
  327.     HDCSRC := WinUser.GetDC(GHWNDAPP);
  328.     if not Is_Null(HDCSRC) then
  329.       RC := new WinDef.RECT;
  330.       bResult := WinUser.GetClientRect(GHWNDAPP, RC);
  331.       HBM := WinGdi.CreateCompatibleBitmap(HDCSRC, 
  332.                                            Win32.INT (RC.RIGHT - RC.LEFT),
  333.                                            Win32.INT (RC.BOTTOM - RC.TOP));
  334.       if not Is_Null(HBM) then
  335.         HDCDST := WinGdi.CreateCompatibleDC(HDCSRC);
  336.         if not Is_Null(HDCDST) then
  337. -- /*
  338. --  * Calculate the dimensions of the bitmap and
  339. --  * convert them to tenths of a millimeter for
  340. --  * setting the size with the SetBitmapDimensionEx
  341. --  * call.  This allows programs like WinWord to
  342. --  * retrieve the bitmap and know what size to
  343. --  * display it as.
  344. --  */
  345.     
  346.           DEVCAPS := WinGdi.GetDeviceCaps(HDCSRC, WinGdi.LOGPIXELSX);
  347.           SIZE_X  := Win32.INT ((RC.RIGHT-RC.LEFT) * mm10perinch) / DEVCAPS;
  348.           DEVCAPS := WinGdi.GetDeviceCaps(HDCSRC, WinGdi.LOGPIXELSY);
  349.           SIZE_Y  := Win32.INT ((RC.BOTTOM-RC.TOP) * mm10perinch) / DEVCAPS;
  350.           bResult := WinGdi.SetBitmapDimensionEx(HBM, SIZE_X, SIZE_Y, null);
  351.           hgdiResult := WinGdi.SelectObject(HDCDST, WinDef.HGDIOBJ(HBM));
  352.           bResult := WinGdi.BitBlt(HDCDST, 0, 0,
  353.                                    Win32.INT (RC.RIGHT - RC.LEFT), 
  354.                                    Win32.INT (RC.BOTTOM - RC.TOP),
  355.                                    HDCSRC, 
  356.                                    Win32.INT (RC.LEFT), 
  357.                                    Win32.INT (RC.TOP), WinGdi.SRCCOPY);
  358.           bResult := WinGdi.DeleteDC(HDCDST);
  359.           handResult := WinUser.SetClipboardData(WinUser.CF_BITMAP, 
  360.                                                  Winnt.HANDLE (HBM));
  361.         else
  362.           bResult := WinGdi.DeleteObject(WinDef.HGDIOBJ(HBM));
  363.         end if;
  364.       end if;
  365.     end if;
  366.     siResult := WinUser.ReleaseDC(ghwndApp, hdcSrc);
  367.     bResult := WinUser.CloseClipboard;
  368.   else
  369.     bResult := WinUser.MessageBeep(0);
  370.   end if;
  371. end CopyToClipBoard;
  372.  
  373.  
  374.  
  375. --
  376. --/************************************************************************
  377. --* AboutDlgProc
  378. --*
  379. --* This is the About Box dialog procedure.
  380. --*
  381. --* History:
  382. --*
  383. --************************************************************************/
  384. --
  385.  
  386. function AboutDlgProc(HWND_P   : Win32.Windef.HWND;
  387.                       MSG      : Win32.UINT;
  388.                       WPARAM_P : Win32.WPARAM;
  389.                       LPARAM_P : Win32.LPARAM) return Win32.BOOL is
  390.  
  391.   RETVAL : Win32.BOOL;
  392.  
  393. begin
  394.   case MSG is
  395.   when Win32.WinUser.WM_INITDIALOG =>
  396.     RETVAL := Win32.TRUE;
  397.   
  398.   when WinUser.WM_COMMAND =>
  399.     bResult := Win32.Winuser.EndDialog(HWND_P, Win32.Winuser.IDOK);
  400.     RETVAL  := Win32.TRUE;
  401.  
  402.   when others =>
  403.     RETVAL := Win32.FALSE;
  404.  
  405.   end case;
  406.   return RETVAL;
  407. end AboutDlgProc;
  408.  
  409. --
  410. --/************************************************************************
  411. --* RefreshRateDlgProc
  412. --*
  413. --* This is the Refresh Rate dialog procedure.
  414. --*
  415. --* History:
  416. --*
  417. --************************************************************************/
  418. --
  419.  
  420. function RefreshRateDlgProc(HWND_P   : Win32.Windef.HWND;
  421.                             MSG      : Win32.UINT;
  422.                             WPARAM_P : Win32.WPARAM;
  423.                             LPARAM_P : Win32.LPARAM) return Win32.BOOL is
  424.  
  425.   RETVAL      : Win32.BOOL;
  426.  
  427. begin
  428.   RETVAL := Win32.FALSE;
  429.   case MSG is
  430.   when WinUser.WM_INITDIALOG =>
  431.     longResult := Win32.Winuser.SendDlgItemMessage(
  432.                           HWND_P, did_refreshrateinterval, 
  433.                           Win32.Winuser.EM_LIMITTEXT, 3, 0);
  434.     bResult := Win32.Winuser.SetDlgItemInt(HWND_P, did_refreshrateinterval, 
  435.                                      GNREFINTERVAL, Win32.FALSE);
  436.     bResult := Win32.Winuser.CheckDlgButton(HWND_P, did_refreshrateenable, 
  437.                                       Win32.UINT(GFREFENABLE));
  438.     RETVAL := Win32.TRUE;
  439.  
  440.   when WinUser.WM_COMMAND =>
  441.     case Utils.LoWord(DWORD(WPARAM_P)) is
  442.     when Win32.Winuser.IDOK =>
  443.       GNREFINTERVAL := Win32.Winuser.GetDlgItemInt(HWND_P, 
  444.                                         did_refreshrateinterval, 
  445.                                         FTRANSLATED'access, 
  446.                                         Win32.FALSE);
  447. -- /*
  448. --  * Stop any existing timers then start one with the
  449. --  * new interval if requested to.
  450. --  */
  451.       EnableRefresh(Win32.FALSE);
  452.       EnableRefresh(Win32.BOOL(
  453.                Win32.Winuser.IsDlgButtonChecked(
  454.                    HWND_P, did_refreshrateenable)));
  455.       bResult := Win32.Winuser.EndDialog(HWND_P, WinUser.IDOK);
  456.     
  457.     when WinUser.IDCANCEL =>
  458.       bResult := Win32.Winuser.EndDialog(HWND_P, Win32.Winuser.IDCANCEL);
  459.  
  460.     when others =>
  461.       null;
  462.     end case;
  463.  
  464.   when others =>
  465.     null;
  466.   end case;
  467.   return RETVAL;
  468. end RefreshRateDlgProc;
  469.  
  470. --/************************************************************************
  471. --* AppWndProc
  472. --*
  473. --* Main window proc for the zoomin utility.
  474. --*
  475. --* Arguments:
  476. --*   Standard window proc args.
  477. --*
  478. --* History:
  479. --*
  480. --************************************************************************/
  481. --
  482.  
  483. function AppWndProc(HWND_P   : Win32.Windef.HWND;
  484.                     MSG      : Win32.UINT;
  485.                     WPARAM_P : Win32.WPARAM;
  486.                     LPARAM_P : Win32.LPARAM) return Win32.LRESULT is
  487.  
  488.   PS      : Win32.Winuser.LPPAINTSTRUCT;
  489.   HCUROLD : Win32.Windef.HCURSOR;
  490.   RETVAL  : Win32.LRESULT;
  491.  
  492. begin
  493.   RETVAL := 0;
  494.   case MSG is
  495.   when Win32.Winuser.WM_CREATE =>
  496.     bResult := Win32.Winuser.SetScrollRange(hwnd_p, 
  497.                                             Win32.Winuser.SB_VERT, 
  498.                                             MIN_ZOOM, MAX_ZOOM, 
  499.                                             Win32.FALSE);
  500.     siResult := Win32.Winuser.SetScrollPos(hwnd_p, 
  501.                                            Win32.Winuser.SB_VERT, 
  502.                                            Win32.INT (GNZOOM), 
  503.                                            Win32.FALSE);
  504.  
  505.   when Win32.Winuser.WM_TIMER =>
  506. --  /*
  507. --   * Update on every timer message.  The cursor will be
  508. --   * flashed to the hourglash for some visual feedback
  509. --   * of when a snapshot is being taken.
  510. --   */
  511.     HCUROLD := Win32.WinUser.SetCursor(Win32.Winuser.LoadCursor(
  512.                           System.Null_Address, LPCSTR(WinUser.IDC_WAIT)));
  513.     DoTheZoomIn(System.Null_Address);
  514.     hcurResult := Win32.Winuser.SetCursor(HCUROLD);
  515.  
  516.   when Win32.Winuser.WM_PAINT =>
  517.     PS := new Win32.Winuser.PAINTSTRUCT;
  518.     handResult := Win32.Winnt.HANDLE(WinUser.BeginPaint(HWND_P, PS));
  519.     DoTheZoomIn(PS.HDC);
  520.     bResult := Win32.Winuser.EndPaint(HWND_P, Win32.Winuser.ac_PAINTt(PS));
  521.  
  522.   when Win32.Winuser.WM_SIZE =>
  523.     CalcZoomedSize;
  524.  
  525.   when Win32.Winuser.WM_LBUTTONDOWN =>
  526.     GPTZOOM.X := Win32.LONG(Utils.LoWord(DWORD(LPARAM_P)));
  527.     GPTZOOM.Y := Win32.LONG(Utils.HiWord(DWORD(LPARAM_P)));
  528.     bResult := Win32.Winuser.ClientToScreen(HWND_P, GPTZOOM);
  529.     DrawZoomRect;
  530.     DoTheZoomIn(System.Null_Address);
  531.  
  532.     handResult := Win32.Winnt.HANDLE (Win32.Winuser.SetCapture(HWND_P));
  533.     GFTRACKING := Win32.TRUE;
  534.  
  535.   when Win32.Winuser.WM_MOUSEMOVE =>
  536.     if GFTRACKING = Win32.TRUE then
  537.       DrawZoomRect;
  538.       GPTZOOM.X := Win32.LONG(Utils.LoWord(DWORD(LPARAM_P)));
  539.       GPTZOOM.Y := Win32.LONG(Utils.HiWord(DWORD(LPARAM_P)));
  540.       bResult := Win32.Winuser.ClientToScreen(HWND_P, GPTZOOM);
  541.       DrawZoomRect;
  542.       DoTheZoomIn(System.Null_Address);
  543.     end if;
  544.  
  545.   when Win32.Winuser.WM_LBUTTONUP =>
  546.     if gfTracking = Win32.TRUE then
  547.       DrawZoomRect;
  548.       bResult := Win32.Winuser.ReleaseCapture;
  549.       GFTRACKING := Win32.FALSE;
  550.     end if;
  551.  
  552.   when Win32.Winuser.WM_VSCROLL =>
  553.     case Utils.LoWord(DWORD(WPARAM_P)) is
  554.     when Win32.Winuser.SB_LINEDOWN =>
  555.       GNZOOM := GNZOOM + 1;
  556.  
  557.     when Win32.Winuser.SB_LINEUP =>
  558.       GNZOOM := GNZOOM - 1;
  559.  
  560.     when Win32.Winuser.SB_PAGEUP =>
  561.       GNZOOM := GNZOOM - 2;
  562.       
  563.     when Win32.Winuser.SB_PAGEDOWN =>
  564.       GNZOOM := GNZOOM + 2;
  565.       
  566.     when Win32.Winuser.SB_THUMBPOSITION | Win32.Winuser.SB_THUMBTRACK =>
  567.       GNZOOM := Win32.LONG(Utils.HiWord(DWORD(WPARAM_P)));
  568.   
  569.     when others => null;
  570.     end case;
  571.  
  572.     GNZOOM := BOUND(GNZOOM, MIN_ZOOM, MAX_ZOOM);
  573.     siResult := Win32.Winuser.SetScrollPos(HWND_P, Win32.Winuser.SB_VERT, 
  574.                                      Win32.INT (GNZOOM), Win32.TRUE);
  575.     CalcZoomedSize;
  576.     DoTheZoomIn(System.Null_Address);
  577.  
  578.   when Win32.Winuser.WM_KEYDOWN =>
  579.     case WPARAM_P is
  580.     when Win32.Winuser.VK_UP   | 
  581.          Win32.Winuser.VK_DOWN | 
  582.          Win32.Winuser.VK_LEFT | 
  583.          Win32.Winuser.VK_RIGHT =>
  584.       MoveView(WPARAM_P, 
  585.           Win32.BOOL(Win32.USHORT (Win32.USHORT (
  586.                      Win32.Winuser.GetKeyState(Win32.Winuser.VK_SHIFT)) and 
  587.                                          Win32.USHORT(16#8000#))),
  588.           Win32.BOOL(Win32.USHORT (Win32.USHORT (
  589.                      Win32.Winuser.GetKeyState(Win32.Winuser.VK_CONTROL))
  590.                                          and Win32.USHORT(16#8000#))));
  591.     when others => null;
  592.     end case;
  593.  
  594.   when Win32.Winuser.WM_COMMAND =>
  595.     case Utils.LoWord(DWORD(WPARAM_P)) is
  596.     when MENU_EDIT_COPY =>
  597.       CopyToClipBoard;
  598.  
  599.     when MENU_EDIT_REFRESH =>
  600.       DoTheZoomIn(System.Null_Address);
  601.  
  602.     when MENU_OPTIONS_REFRESHRATE =>
  603.       siResult := Win32.Winuser.DialogBox(GHINST, 
  604.                      PCSTR(Win32.Winuser.MAKEINTRESOURCE(DID_REFRESHRATE)),
  605.                      HWND_P, 
  606.                      RefreshRateDlgProc'access);
  607.  
  608.     when MENU_HELP_ABOUT =>
  609.       siResult := Win32.Winuser.DialogBox(GHINST, 
  610.                      LPCSTR(WinUser.MAKEINTRESOURCE(DID_ABOUT)),
  611.                      HWND_P, 
  612.                      AboutDlgProc'access);
  613.  
  614.     when others => null;
  615.     end case;
  616.   
  617.   when Win32.Winuser.WM_CLOSE =>
  618.     if not Is_Null(GHPALPHYSICAL) then
  619.       bResult := Win32.Wingdi.DeleteObject(
  620.                                  Win32.Windef.HGDIOBJ(GHPALPHYSICAL));
  621.     end if;
  622.     bResult := Win32.Winuser.DestroyWindow(HWND_P);
  623.  
  624.   when Win32.Winuser.WM_DESTROY =>
  625.     Win32.Winuser.PostQuitMessage(0);
  626.  
  627.   when others =>
  628.     RETVAL := Win32.Winuser.DefWindowProc(HWND_P, MSG, WPARAM_P, LPARAM_P);
  629.   end case;
  630.   return RETVAL;
  631. end AppWndProc;
  632.  
  633. -------------------------------------------------------------------------------
  634. --
  635. -- THIS FILE AND ANY ASSOCIATED DOCUMENTATION IS PROVIDED "AS IS" WITHOUT 
  636. -- WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT 
  637. -- LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR 
  638. -- A PARTICULAR PURPOSE.  The user assumes the entire risk as to the accuracy 
  639. -- and the use of this file.  This file may be used only by licensees of 
  640. -- Microsoft Corporation's WIN32 Software Development Kit in accordance with 
  641. -- the terms of the licensee's End-User License Agreement for Microsoft 
  642. -- Software for the WIN32 Development Kit.
  643. --
  644. -- Copyright (c) Intermetrics, Inc. 1995
  645. -- Portions (c) 1985-1994 Microsoft Corporation with permission.
  646. -- Microsoft is a registered trademark and Windows and Windows NT are 
  647. -- trademarks of Microsoft Corporation.
  648. --
  649. -------------------------------------------------------------------------------
  650.  
  651. end Zoomin_Pkg;
  652.