home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / s / s001 / 1.ddi / PFC / SRC / WNDMOVE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-10  |  3.4 KB  |  147 lines

  1. /* (c) 1985, Phoenix Computer Products Corp. and Novum Organum, Inc. */
  2. #include "pdefs.h"
  3. #include "psys.h"
  4.  
  5. static  int *_kbvct;
  6. static  int _kbflag;
  7.  
  8. /***
  9. * Name:         wndmove -- move or resize the active window
  10. *
  11. * Synopsis:     int     wndmove();
  12. *               int     rc, mode, row, col;
  13. *
  14. *               rc = wndmove( mode, row, col );
  15. *
  16. * Description:  resets the window's size or position
  17. *
  18. * Returns:      W_UNCHANGED, W_ALTERED, W_CHANGED, or (W_ALTERED|W_CHANGED)
  19. *
  20. * (C) Novum Organum, Inc. 1985
  21. *
  22. ***/
  23. #define WND    struct _WND
  24. #define    H_ACT    ((WND *)h_act)
  25.  
  26. int wndmove( mode, row, col )
  27.     int mode, row, col;
  28. {
  29.     HDL wndgetactv(), h_act;
  30.     int csrupd;
  31.     int savvars[6];
  32.     int rc;
  33.  
  34.     rc = W_UNCHANGED;
  35.     h_act = wndgetactv();
  36.     if  ( !h_act )              /* base window has NULLHDL and can't be moved */
  37.         goto end;
  38.  
  39.     mempp( (char *)savvars, (char *)&H_ACT->prow, sizeof(savvars) );
  40.  
  41.     switch( mode )
  42.         {
  43.     case W_POSABS:           /* move viewport to absolute pos. on screen */
  44.         H_ACT->prow = 0;
  45.         H_ACT->pcol = 0;
  46.     case W_POSREL:           /* move viewport to relative pos. on screen */
  47.         H_ACT->prow += row;
  48.         H_ACT->pcol += col;
  49.         break;
  50.     case W_BUFABS:           /* move viewport to absolute pos. on buffer */
  51.         H_ACT->vrow = 0;
  52.         H_ACT->vcol = 0;
  53.     case W_BUFREL:           /* move viewport to relative pos. on buffer */
  54.         H_ACT->vrow += row;
  55.         H_ACT->vcol += col;
  56.         break;
  57.     case W_SIZABS:           /* size viewport to absolute size on screen */
  58.         H_ACT->pnrows = 0;
  59.         H_ACT->pncols = 0;
  60.     case W_SIZREL:           /* size viewport to relative size on screen */
  61.         H_ACT->pnrows += row;
  62.         H_ACT->pncols += col;
  63.         break;
  64.     }
  65.  
  66.     rc = wndbound( W_SIZPRI, h_act );
  67.     if  (  memcmpb((char *)savvars,(char *)&H_ACT->prow,sizeof(savvars)) )
  68.         {
  69.         csrupd = wndsetcsrupd( NO );
  70.         wndremap(h_act);
  71.         _waupd();
  72.         _waupdbdr();
  73.         wndsetcsrupd( csrupd );
  74.         rc |= W_CHANGED;
  75.         }
  76. end:
  77.     return  ( rc );
  78. }
  79.  
  80.  
  81. #ifdef use
  82.  
  83. /***
  84. * Name:         wndkbset -- turn on (or off) keystroke interpretation
  85. *
  86. * Synopsis:     int oldval, newval, wndkbset();
  87. *
  88. *               oldval = wndkbset( newval );
  89. *
  90. * Description:  If this flag is set on, keystrokes specified in the vector
  91. *               will cause window movement.
  92. *
  93. * Returns:      The old flag state.
  94. *
  95. * (C) Novum Organum, Inc. 1985
  96. *
  97. ***/
  98.  
  99. int wndkbset( kbflag )
  100.     int kbflag;
  101. {
  102.     int oldflag, _wakbmov();
  103.  
  104.     oldflag = _kbflag;
  105.     _kbflag = kbflag;
  106.  
  107.     if    (_kbflag)
  108.     _kbsetwnd( _wakbmov );
  109.     else
  110.     _kbsetwnd( NULLPFI );
  111.     return  ( oldflag );
  112. }
  113.  
  114.  
  115. /***
  116. * Name:         wndkbvct -- set the movement-by-keystroke vector
  117. *
  118. * Synopsis:     int     *wndkbvct();
  119. *               int     *oldvct, kbvct[24];
  120. *               oldvct = wndkbvct( kbvct );
  121. *
  122. * Description:  Sets a vector of keystrokes to use in determining how
  123. *               to move a window in response to a keystroke.
  124. *
  125. * Returns:      The previously installed vector.
  126. *
  127. * (C) Novum Organum, Inc. 1985
  128. *
  129. ***/
  130.  
  131. int *wndkbvct( kbvct )
  132.     int *kbvct;
  133. {
  134.     int *oldvct;
  135.  
  136.     oldvct = _kbvct;
  137.     _kbvct = kbvct;
  138.     return  ( oldvct );
  139. }
  140.  
  141. int *_wndgkbv()
  142. {
  143.     return( _kbvct );
  144. }
  145.  
  146. #endif
  147.