home *** CD-ROM | disk | FTP | other *** search
- /* (c) 1985, Phoenix Computer Products Corp. and Novum Organum, Inc. */
- #include "pdefs.h"
- #include "psys.h"
-
- static int *_kbvct;
- static int _kbflag;
-
- /***
- * Name: wndmove -- move or resize the active window
- *
- * Synopsis: int wndmove();
- * int rc, mode, row, col;
- *
- * rc = wndmove( mode, row, col );
- *
- * Description: resets the window's size or position
- *
- * Returns: W_UNCHANGED, W_ALTERED, W_CHANGED, or (W_ALTERED|W_CHANGED)
- *
- * (C) Novum Organum, Inc. 1985
- *
- ***/
- #define WND struct _WND
- #define H_ACT ((WND *)h_act)
-
- int wndmove( mode, row, col )
- int mode, row, col;
- {
- HDL wndgetactv(), h_act;
- int csrupd;
- int savvars[6];
- int rc;
-
- rc = W_UNCHANGED;
- h_act = wndgetactv();
- if ( !h_act ) /* base window has NULLHDL and can't be moved */
- goto end;
-
- mempp( (char *)savvars, (char *)&H_ACT->prow, sizeof(savvars) );
-
- switch( mode )
- {
- case W_POSABS: /* move viewport to absolute pos. on screen */
- H_ACT->prow = 0;
- H_ACT->pcol = 0;
- case W_POSREL: /* move viewport to relative pos. on screen */
- H_ACT->prow += row;
- H_ACT->pcol += col;
- break;
- case W_BUFABS: /* move viewport to absolute pos. on buffer */
- H_ACT->vrow = 0;
- H_ACT->vcol = 0;
- case W_BUFREL: /* move viewport to relative pos. on buffer */
- H_ACT->vrow += row;
- H_ACT->vcol += col;
- break;
- case W_SIZABS: /* size viewport to absolute size on screen */
- H_ACT->pnrows = 0;
- H_ACT->pncols = 0;
- case W_SIZREL: /* size viewport to relative size on screen */
- H_ACT->pnrows += row;
- H_ACT->pncols += col;
- break;
- }
-
- rc = wndbound( W_SIZPRI, h_act );
- if ( memcmpb((char *)savvars,(char *)&H_ACT->prow,sizeof(savvars)) )
- {
- csrupd = wndsetcsrupd( NO );
- wndremap(h_act);
- _waupd();
- _waupdbdr();
- wndsetcsrupd( csrupd );
- rc |= W_CHANGED;
- }
- end:
- return ( rc );
- }
-
-
- #ifdef use
-
- /***
- * Name: wndkbset -- turn on (or off) keystroke interpretation
- *
- * Synopsis: int oldval, newval, wndkbset();
- *
- * oldval = wndkbset( newval );
- *
- * Description: If this flag is set on, keystrokes specified in the vector
- * will cause window movement.
- *
- * Returns: The old flag state.
- *
- * (C) Novum Organum, Inc. 1985
- *
- ***/
-
- int wndkbset( kbflag )
- int kbflag;
- {
- int oldflag, _wakbmov();
-
- oldflag = _kbflag;
- _kbflag = kbflag;
-
- if (_kbflag)
- _kbsetwnd( _wakbmov );
- else
- _kbsetwnd( NULLPFI );
- return ( oldflag );
- }
-
-
- /***
- * Name: wndkbvct -- set the movement-by-keystroke vector
- *
- * Synopsis: int *wndkbvct();
- * int *oldvct, kbvct[24];
- * oldvct = wndkbvct( kbvct );
- *
- * Description: Sets a vector of keystrokes to use in determining how
- * to move a window in response to a keystroke.
- *
- * Returns: The previously installed vector.
- *
- * (C) Novum Organum, Inc. 1985
- *
- ***/
-
- int *wndkbvct( kbvct )
- int *kbvct;
- {
- int *oldvct;
-
- oldvct = _kbvct;
- _kbvct = kbvct;
- return ( oldvct );
- }
-
- int *_wndgkbv()
- {
- return( _kbvct );
- }
-
- #endif
-