home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / WINSETP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-10  |  3.3 KB  |  122 lines

  1. /*
  2.     winsetp.c    3/15/88
  3.  
  4.     % window moving routines.
  5.     by Ted.
  6.  
  7.     OWL 1.1
  8.     Copyright (c) 1988, by Oakland Group, Inc.
  9.     ALL RIGHTS RESERVED.
  10.  
  11.     Revision History:
  12.     -----------------
  13.      3/22/88 Ted    Installed linked windows handling
  14.      8/15/88 jmd    Added win_GetPosition
  15.     10/19/88 Ted    Extracted win_Top to wintop.c
  16.     10/19/88 Ted    Extracted win_Get(Pix)PositionTop to wingetp.c
  17.     10/31/88 Ted:    Removed linking.
  18.     12/09/88 ted:    Added ddisp_Cache/Flush calls for mouse.
  19.     12/11/88 ted:    Added dhard_Claim/Release calls for reentrancy.
  20.      5/01/89 ted    Added wmgr_SetNewCurrentFlag call to fix mouse support.
  21.      7/07/89 gam    Changed NULL to FNULL where necessary
  22.      8/08/89 jmd    Added win_Really funcs.
  23.      8/10/89 ted    added allowances for shadows.
  24. */
  25.  
  26. #include "oakhead.h"
  27. #include "disppriv.h"
  28. /* -------------------------------------------------------------------------- */
  29.  
  30. void win_SetPixPosition(win, xpos, ypos)
  31.     win_type win;
  32.     opcoord xpos;
  33.     opcoord ypos;
  34. /*
  35.     Change the position of window.
  36.  
  37.     Sends a WINM_SETPOS message to the window class which, in turn,
  38.     call win_ReallySetPixPosition
  39. */
  40. {
  41.     opoint pnt;
  42.  
  43.     pnt.x = xpos;
  44.     pnt.y = ypos;
  45.  
  46.     win_Do(win, WINM_SETPOS, &pnt, NULL);
  47. }
  48. /* -------------------------------------------------------------------------- */
  49.  
  50. void win_ReallySetPixPosition(win, xpos, ypos)
  51.     win_type win;
  52.     opcoord xpos;
  53.     opcoord ypos;
  54. /*
  55.     Really Change the position of window.
  56. */
  57. {
  58.     int xdisp, ydisp;
  59.     opbox partbox;
  60.     opbox pbox;
  61.  
  62.     if (win == NULL) {
  63.         return;
  64.     }
  65.     if (!disp_TextFree()) {
  66.         opcoord_GridRound(&xpos, &ypos, win_GetFont(win));
  67.     }
  68.     hard_Claim();        /* Here for re-entrancy protection */
  69.  
  70.     /* remember x and y displacements */
  71.     xdisp = xpos - win_GetXmin(win);
  72.     ydisp = ypos - win_GetYmin(win);
  73.  
  74.     /* quit if no work to do */
  75.     if (xdisp == 0 && ydisp == 0) {
  76.         hard_Release();
  77.         return;
  78.     }
  79.  
  80.     if (!win_IsEmployed(win)) {
  81.         opbox_trans(win_pixboxp(win), xdisp, ydisp);
  82.     }
  83.     else {        /* redisplay window */
  84.         disp_Cache();
  85.  
  86.         /* Save in win from part that might get obscured in its new home */
  87.         /* (i.e. everything that's showing.) */
  88.         win_getwinbox(win, &pbox);
  89.         wmgr_SavePixBox(win, &pbox);
  90.  
  91.         /* Save in box from windows below where win is going */
  92.         win_getshadowbox(win, &pbox);            /* pbox gets old location */
  93.         opbox_copy(&partbox, &pbox);
  94.         opbox_trans(&partbox, xdisp, ydisp);    /* partbox gets new location */
  95.         opbox_uncover(&pbox, &partbox);            /* partbox now gets diff box */
  96.         wmgr_SavePixBox(win_GetBelow(win), &partbox);
  97.  
  98.         /* Move the window box */
  99.         opbox_trans(win_pixboxp(win), xdisp, ydisp);
  100.  
  101.         /* Paint in box from windows below where win was */
  102.         opbox_copy(&partbox, &pbox);        /* partbox gets old location */
  103.         win_getshadowbox(win, &pbox);        /* pbox gets new location */
  104.         opbox_uncover(&pbox, &partbox);        /* partbox now gets diff box */
  105.         wmgr_PaintPixBox(win_GetBelow(win), &partbox);
  106.  
  107.     /* Paint in box from window in its new location */
  108.         /* (i.e. everything that's showing.) */
  109.         win_getshadowbox(win, &pbox);
  110.         wmgr_PaintPixBox(win, &pbox);
  111.  
  112.         /* Set flag for kb_Read/Check to wrap up mouse msgs for new mouse win */
  113.         if (wmgr_SMMptr() != FNULL) {
  114.             wmgr_SetNewCurrentFlag(TRUE);
  115.         }
  116.         disp_Flush();
  117.         hard_Release();
  118.     }
  119. }
  120. /* -------------------------------------------------------------------------- */
  121.  
  122.