Category : Files from Magazines
Archive   : PJ94.ZIP
Filename : V_MOVE.C

 
Output of file : V_MOVE.C contained in archive : PJ94.ZIP
/* v_move.c- Move Viewport */

#include
#include
#include
#include

int v_move( viewport *v, unsigned row, unsigned col )
{
/* Move the viewport to indicated absolute row and column. The
* viewport must be closed or hidden to move it. If the viewport
* is open and active, it's deactivated, moved, then reopened.
* You may not move the viewport past the edge of the screen.
* Return true if the viewport ended up where specified, false if
* it bumped up against the side of the screen.
*/

int rval = 1 ; /* return value */
int was_active = !v->inactive;
struct text_info info;

if( v->magic != VMAGIC )
return 0;

gettextinfo( &info );

if( row+v->nrows > info.screenheight ) /* Truncate row and col */
{ /* so that the viewport */
row = info.screenheight - v->nrows ; /* stays on the screen. */
rval = 0;
}
if( col+v->ncols > info.screenwidth )
{
col = info.screenwidth - v->ncols ;
rval = 0;
}

if( was_active )
v_deactivate( v, 1 );

v->row = row;
v->col = col;

if( was_active )
v_open( v );

return rval;
}


  3 Responses to “Category : Files from Magazines
Archive   : PJ94.ZIP
Filename : V_MOVE.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/