Example #1
0
/*
	Returns the visible parts of the box (relative coords within framebuffer),
   	relative to screen coords (normally starting at 0,0 )
*/
static inline bool fbrect_to_screen( GEM_PLOTTER self, GRECT box, GRECT * ret )
{
	GRECT out, vis, screen;

	screen.g_x = 0;
	screen.g_y = 0;
	screen.g_w = vdi_sysinfo.scr_w;
	screen.g_h = vdi_sysinfo.scr_h;

	/* get visible region: */
    vis.g_x = VIEW(self).x;
	vis.g_y = VIEW(self).y;
	vis.g_w = VIEW(self).w;
	vis.g_h = VIEW(self).h;

	if ( !rc_intersect( &screen, &vis ) ) {
		return( false );
	}
	vis.g_x = VIEW(self).w - vis.g_w;
	vis.g_y = VIEW(self).h - vis.g_h;

	/* clip box to visible region: */
	if( !rc_intersect(&vis, &box) ) {
		return( false );
	}
	out.g_x = box.g_x + VIEW(self).x;
	out.g_y = box.g_y + VIEW(self).y;
	out.g_w = box.g_w;
	out.g_h = box.g_h;
	*ret = out;
	return ( true );
}
Example #2
0
void w_redraw(WORD w_handle, GRECT *pt)
{
        GRECT           t, d;
        PD              *ppd;

        ppd = D.w_win[w_handle].w_owner;
                                                /* make sure work rect  */
                                                /*   and word rect      */
                                                /*   intersect          */
        rc_copy(pt, &t);
        w_getsize(WS_WORK, w_handle, &d);
        if ( rc_intersect(&t, &d) )
        {
                                                /* make sure window has */
                                                /*   owns a rectangle   */
          if ( w_union(D.w_win[w_handle].w_rlist, &d) )
          {
                                                /* intersect redraw     */
                                                /*   rect with union    */
                                                /*   of owner rects     */
            if ( rc_intersect(&d, &t) )
              ap_sendmsg(wind_msg, WM_REDRAW, ppd,
                        w_handle, t.g_x, t.g_y, t.g_w, t.g_h);
          }
        }
}
Example #3
0
void do_walk(WORD wh, LONG tree, WORD obj, WORD depth, GRECT *pc)
{
        register ORECT  *po;
        GRECT           t;
        
        if ( wh == NIL )
          return;
                                                /* clip to screen       */
        if (pc)
          rc_intersect(&gl_rfull, pc);
        else
          pc = &gl_rfull;
                                                /* walk owner rect list */
        for(po=D.w_win[wh].w_rlist; po; po=po->o_link)
        {
          t.g_x = po->o_x;
          t.g_y = po->o_y;
          t.g_w = po->o_w;
          t.g_h = po->o_h;
                                                /* intersect owner rect */
                                                /*   with clip rect's   */
          if ( rc_intersect(pc, &t) )
          {
                                                /*  set clip and draw   */
            gsx_sclip(&t);
            ob_draw(tree, obj, depth);
          }
        }
}
Example #4
0
/* because this is an on-screen plotter, this is an screen to screen copy. */
static int copy_rect( GEM_PLOTTER self, GRECT src, GRECT dst )
{
	MFDB devmf;
	MFDB scrmf;
	short pxy[8];
	GRECT vis;

	/* clip to visible rect, only needed for onscreen renderer: */
	plotter_get_visible_grect( self, &vis );

	if( !rc_intersect(&vis, &src) )
		return 1;
	if( !rc_intersect(&vis, &dst) )
		return 1;

	src.g_x = VIEW(self).x + src.g_x;
	src.g_y = VIEW(self).y + src.g_y;
	dst.g_x = VIEW(self).x + dst.g_x;
	dst.g_y = VIEW(self).y + dst.g_y;

	devmf.fd_addr = NULL;
	devmf.fd_w = src.g_w;
	devmf.fd_h = src.g_h;
	devmf.fd_wdwidth = 0;
	devmf.fd_stand = 0;
	devmf.fd_nplanes = 0;
	devmf.fd_r1 = devmf.fd_r2 = devmf.fd_r3 = 0;

	scrmf.fd_addr = NULL;
	scrmf.fd_w = dst.g_w;
	scrmf.fd_h = dst.g_h;
	scrmf.fd_wdwidth = 0 ;
	scrmf.fd_stand = 0;
	scrmf.fd_nplanes = 0;
	scrmf.fd_r1 = scrmf.fd_r2 = scrmf.fd_r3 = 0;

	pxy[0] = src.g_x;
	pxy[1] = src.g_y;
	pxy[2] = pxy[0] + src.g_w-1;
	pxy[3] = pxy[1] + src.g_h-1;
	pxy[4] = dst.g_x;
	pxy[5] = dst.g_y;
	pxy[6] = pxy[4] + dst.g_w-1;
	pxy[7] = pxy[5] + dst.g_h-1;
	self->lock( self );
	vro_cpyfm( self->vdi_handle, S_ONLY, (short*)&pxy, &devmf,  &scrmf);
	self->unlock( self );

	return( 1 );
}
Example #5
0
/* Make_Hot_Spots()
 *==========================================================================
 * Create the # Hot spot rectangles required for scrolling through the
 * filenames.  They are in this order:
 *
 *		______________________
 *		|                    |		ZONE 0 ( Above )
 *		|                    |
 *		+--------------------+
 *		|                    |		ZONE 1 ( LINE0 )
 *		|                    |
 *		+--------------------+
 *		|                    |		ZONE 2 ( LINE1 )
 *		|                    |
 *		+--------------------+
 *		|                    |		ZONE 3 ( LINE2 )
 *		|                    |
 *		+--------------------+
 *		|                    |		ZONE 4 ( LINE3 )
 *		|                    |
 *		+--------------------+
 *		|                    |		ZONE 5 ( LINE4 )
 *		|                    |
 *		+--------------------+
 *		|                    |		ZONE 6 ( LINE5 )
 *		|                    |
 *		+--------------------+
 *		|		     |		ZONE 7 ( BELOW )
 *		|		     |
 *		----------------------
 *
 * NOTE: The widths of the zones are the width of the screen.
 * IN: int top_object:	LINE0
 */
void
Make_Hot_Spots( int top_object )
{
   int i;
   int obj;
   GRECT rect;
      
   for( i = 1; i <= MAX_SLITS; i++ )
   {
      obj = top_object + i - 1;
      hot_spot[ i ] = ObRect( obj );
      objc_offset( tree, obj, &hot_spot[i].g_x, &hot_spot[i].g_y );
      hot_spot[ i ].g_w = desk.g_w;
      hot_spot[ i ].g_x = desk.g_x;
   }
   rect = desk;
   rect.g_y = 0;
   rect.g_h = desk.g_y + desk.g_h;
   
   hot_spot[0] = hot_spot[7] = rect;
   hot_spot[ 0 ].g_h = hot_spot[ 1 ].g_y;
   hot_spot[ 7 ].g_y = hot_spot[ 6 ].g_y + hot_spot[ 6 ].g_h; 
   hot_spot[ 7 ].g_h = rect.g_h - hot_spot[ 7 ].g_y + 1;

   /* Now, adjust the rectangles clipped to the desktop */   
   for( i = 0; i < 8; i++ )
      rc_intersect( &rect, &hot_spot[ i ] );
}
Example #6
0
void scrollup(int hand, short howmany)
{
GRECT box;
GRECT area;
int xy[8],temp;
area.g_x=wn[hand].wwa.g_x;
area.g_y=wn[hand].wwa.g_y;
area.g_w=wn[hand].wwa.g_w-NLW;
area.g_h=wn[hand].wwa.g_h-ith*2-VT+3;
if(wn[hand].stat==WMDONTWRITE)return;
startupdate();
wind_get(wn[hand].hand,WF_FIRSTXYWH,&box.g_x,&box.g_y,&box.g_w,&box.g_h);
while (box.g_w && box.g_h){
if(rc_intersect(&area,&box)){
temp=th*howmany;
if(temp>box.g_h)temp=box.g_h;
xy[0]=box.g_x;xy[1]=box.g_y+temp;
xy[2]=box.g_x+box.g_w-1;xy[3]=box.g_y+box.g_h-1;
xy[4]=box.g_x;xy[5]=box.g_y;
xy[6]=box.g_x+box.g_w-1;xy[7]=box.g_y+box.g_h-temp;
vro_cpyfm(ws.handle,S_ONLY,xy,&scr,&scr);
box.g_y=box.g_y+box.g_h-temp;
box.g_h=temp+1;
dodirty(hand,box);
}
wind_get(wn[hand].hand,WF_NEXTXYWH,&box.g_x,&box.g_y,&box.g_w,&box.g_h);
}
finishupdate();
return;
}
Example #7
0
/* do_redraw();
 * ================================================================
 */
void
do_redraw( int *msg )
{
   GRECT area;
   GRECT rect;

   area.g_x = msg[4];
   area.g_y = msg[5];
   area.g_w = msg[6];
   area.g_h = msg[7];

   graf_mouse( M_OFF, 0L );
   wind_update( BEG_UPDATE );
   wind_get( msg[3], WF_FIRSTXYWH, &rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h );

   while( rect.g_w && rect.g_h )
   {
     if( rc_intersect( &area, &rect ) )
         ObjcDraw( tree, ROOT, MAX_DEPTH, &rect );

     wind_get( msg[3], WF_NEXTXYWH,&rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h );
   }
   wind_update( END_UPDATE );
   graf_mouse( M_ON, 0L );
}
Example #8
0
VOID act_allchg(WORD ex_obj, GRECT *pt, WORD chgvalue, WORD dochg)
{
	WORD		obj, newstate;
	GRECT		o;

	for(obj=F1NAME; obj!=SPOLBOX; obj=the_spol[obj].ob_next) 
	{
		if ( (obj != ex_obj) &&
			(gl_sppfn[obj - F1NAME] != NULL)  )
		{
			objc_offset((OBJECT FAR *)ad_spol, obj, &o.g_x, &o.g_y);
			o.g_w = the_spol[obj].ob_width;
			o.g_h = the_spol[obj].ob_height;
			if ( rc_intersect(pt, &o) )
			{
				/* make change		*/
				newstate = the_spol[obj].ob_state;
				if ( dochg )
					newstate |= chgvalue;
				else
					newstate &= ~chgvalue;
				if (newstate != the_spol[obj].ob_state)
					spol_chg(obj, newstate);
			}
		}
	}
}
Example #9
0
/*
	1. calculate visible area of framebuffer in coords relative to framebuffer position

	result:
	this function should calculates an rectangle relative to the plot origin and
	size.
	If the ploter coords do not fall within the screen region,
	all values of the region are set to zero.
*/
static inline void update_visible_rect( GEM_PLOTTER p )
{
	GRECT screen;
	GRECT common;
	GRECT frame;

	screen.g_x = 0;
	screen.g_y = 0;
	screen.g_w = vdi_sysinfo.scr_w;
	screen.g_h = vdi_sysinfo.scr_h;

    common.g_x = frame.g_x = VIEW(p).x;
	common.g_y = frame.g_y = VIEW(p).y;
	common.g_w = frame.g_w = VIEW(p).w;
	common.g_h = frame.g_h = VIEW(p).h;

	if( rc_intersect( &screen, &common ) ) {
		VIEW(p).vis_w = common.g_w;
		VIEW(p).vis_h = common.g_h;
		if( VIEW(p).x < screen.g_x )
			VIEW(p).vis_x = frame.g_w - common.g_w;
		else
			VIEW(p).vis_x = 0;
		if( VIEW(p).y <screen.g_y )
			VIEW(p).vis_y = frame.g_h - common.g_h;
		else
			VIEW(p).vis_y = 0;
	} else {
		VIEW(p).vis_w = VIEW(p).vis_h = 0;
		VIEW(p).vis_x = VIEW(p).vis_y = 0;
	}
}
Example #10
0
/*
*       Walk down ORECT list looking for the next rect that still has
*       size when clipped with the passed in clip rectangle.
*/
void w_owns(WORD w_handle, ORECT *po, GRECT *pt, WORD *poutwds)
{
        while (po)
        {
          poutwds[0] = po->o_x;
          poutwds[1] = po->o_y;
          poutwds[2] = po->o_w;
          poutwds[3] = po->o_h;
          D.w_win[w_handle].w_rnext = po = po->o_link;
          /* FIXME: GRECT typecasting again */
          if ( (rc_intersect(pt, (GRECT *)&poutwds[0])) &&
               (rc_intersect(&gl_rfull, (GRECT *)&poutwds[0]))  )
            return;
        }
        poutwds[2] = poutwds[3] = 0;
}
Example #11
0
bool gemtk_rc_intersect_ro(GRECT *a, GRECT *b)
{
    GRECT r1, r2;

    r1 = *a;
    r2 = *b;

    return((bool)rc_intersect(&r1, &r2));
}
Example #12
0
VOID outl_obj(LONG tree, WORD obj, GRECT *clprect)
{
	GRECT	p;

	objc_xywh(tree, obj, &p);
	rc_intersect( clprect, &p);
	graf_mouse(M_OFF, NULL);
	gsx_outline(&p);
	graf_mouse(M_ON, NULL);
}
Example #13
0
*cdecl	GetNextRect( void )
{
    GRECT rect;
        
    Wind_get( w.id, WF_NEXTXYWH, ( WARGS *)&rect );
    if( !rc_empty( &rect ))
    {
       rc_intersect( &XRect, &rect );
       return( &rect );
    }
    else
       return( ( GRECT *)NULL );
}
Example #14
0
/*
*       Routine to fix rectangles in preparation for a source to
*       destination blt.  If the source is at -1, then the source
*       and destination left fringes need to be realigned.
*/
WORD w_mvfix(GRECT *ps, GRECT *pd)
{
        register WORD   tmpsx;
        
        tmpsx = ps->g_x;
        rc_intersect(&gl_rfull, ps);
        if (tmpsx == -1)
        {
          pd->g_x++;
          pd->g_w--;
          return(TRUE);
        }
        return(FALSE);
}
Example #15
0
*cdecl GetFirstRect( GRECT *prect )
{
   GRECT rect;
   
   Wind_get( w.id, WF_FIRSTXYWH, ( WARGS *)&rect );
   if( !rc_empty( &rect ) )
   {
      rc_intersect( prect, &rect );
      XRect = *prect;
      return( &rect );
   }
   else
      return( ( GRECT *)NULL );
}
Example #16
0
/* do_redraw()
 *==========================================================================
 * Standard object tree redraw routine for handling object trees
 *
 * IN:  OBJECT *tree:    	object tree
 *      int    object:		object to redraw
 *	GRECT  *prect:		GRECT of dirtied area
 *
 * OUT: void
 *
 * GLOBAL:  WINFO  w:		window structure
 */
void
do_redraw( OBJECT *tree, GRECT *prect )
{
   GRECT rect;
   
   Wind_get( w.id, WF_FIRSTXYWH, ( WARGS *)&rect );
   while( !rc_empty( &rect ) )
   {
       if( rc_intersect( prect, &rect ))
       {
       	  Vsync();
 	  Objc_draw( tree, ROOT, MAX_DEPTH, &rect );
       }
       Wind_get( w.id, WF_NEXTXYWH, ( WARGS *)&rect );
   }
}
Example #17
0
/* ***Dialog neu zeichnen, Rechteckliste beachten*** */
void wdial_redraw(int dwhndl, OBJECT *tree, GRECT *redrwrect)
{
 GRECT clip;               /* F�r Rechtecksliste */

 wind_update(BEG_UPDATE); graf_mouse(M_OFF, 0L);

 wind_get(dwhndl, WF_FIRSTXYWH, &clip.g_x, &clip.g_y, &clip.g_w, &clip.g_h);
 while(clip.g_w!=0 && clip.g_h!=0)
  {
   if( rc_intersect(redrwrect, &clip) )
     objc_draw(tree, ROOT, MAX_DEPTH, clip.g_x, clip.g_y, clip.g_w, clip.g_h);
   wind_get(dwhndl, WF_NEXTXYWH, &clip.g_x, &clip.g_y, &clip.g_w, &clip.g_h);
  }

 graf_mouse(M_ON, 0L); wind_update(END_UPDATE);
}
Example #18
0
void w_update(WORD bottom, GRECT *pt, WORD top, WORD moved, WORD usetrue)
{
    WORD   i, ni;
    WORD   done;

    /* limit to screen */
    rc_intersect(&gl_rfull, pt);
    gsx_moff();
    /* update windows from top to bottom */
    if (bottom == DESKWH)
        bottom = W_TREE[ROOT].ob_head;
    /* if there are windows */
    if (bottom != NIL) {
        /* start at the top     */
        if (top == DESKWH)
            top = W_TREE[ROOT].ob_tail;
        /* draw windows from    */
        /*   top to bottom      */
        do {
            if ( !((moved) && (top == gl_wtop)) ) {
                /* set clip and draw a window's border  */
                gsx_sclip(pt);
                /* CHANGED 1/10/86 LKW  */
                /* w_clipdraw(top, 0, MAX_DEPTH, 2); !* from FALSE to 2      *! */
                //w_clipdraw(top, 0, MAX_DEPTH, usetrue);
//                kprintf("=== WIND_OPEN1 \n");
                w_cpwalk(top, 0, MAX_DEPTH, usetrue);   /* let appl. draw inside*/
                w_redraw(top, pt);
//                kprintf("=== WIND_OPEN2 \n");
            }
            /* scan to find prev    */
            i = bottom;
            done = (i == top);
            //kprintf("=== WIND_OPEN i = %x\n", i);
            while (i != top)
            {
                ni = W_TREE[i].ob_next;
                if (ni == top)
                    top = i;
                else
                    i = ni;
            }
        }
        while( !done );
    }
    gsx_mon();
}
Example #19
0
VOID invert_obj(LONG tree, WORD obj, GRECT *clprect)
{
	GRECT	hot;

	objc_xywh(tree, obj, &hot);
	rc_intersect( clprect, &hot );
	graf_mouse(M_OFF, NULL);
	gsx_invert(&hot);
	graf_mouse(M_ON, NULL);
	if (iconedit_flag)
	{
		if (LWGET(OB_STATE(obj)) == SELECTED)
		    LWSET(OB_STATE(obj), NORMAL);
		else
		    LWSET(OB_STATE(obj), SELECTED);
	}
}
Example #20
0
static void redraw(int start, int depth, int x, int y, int w, int h)
{
	GRECT		r, r1;
	
	r.g_x = x; r.g_y = y; r.g_w = w; r.g_h = h;
	wind_update(BEG_UPDATE);
	hide_mouse_if_needed(&r);
	wind_get_grect(akt_handle, WF_FIRSTXYWH, &r1);
	while (r1.g_w != 0 && r1.g_h != 0)
	{
		if (rc_intersect(&r, &r1))
			objc_draw(aktion, start, depth, r1.g_x, r1.g_y, r1.g_w, r1.g_h);
		wind_get_grect(akt_handle, WF_NEXTXYWH, &r1);
	}
	show_mouse();
	wind_update(END_UPDATE);
}
Example #21
0
/* Do_Redraw();
 * ================================================================
 */
void
Do_Redraw( OBJECT *tree, GRECT *area )
{
   GRECT rect;

   graf_mouse( M_OFF, 0L );
   wind_update( BEG_UPDATE );
   wind_get( wid, WF_FIRSTXYWH, &rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h );

   while( rect.g_w && rect.g_h )
   {
     if( rc_intersect( area, &rect ) )
         ObjcDraw( tree, ROOT, MAX_DEPTH, &rect );

     wind_get( wid, WF_NEXTXYWH,&rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h );
   }
   wind_update( END_UPDATE );
   graf_mouse( M_ON, 0L );
}
Example #22
0
/* driver_redraw()
 * ================================================================
 */
void
driver_redraw( int *msg )
{
   GRECT area;
   GRECT rect;
   int   clip[4];

   area.g_x = msg[4];
   area.g_y = msg[5];
   area.g_w = msg[6];
   area.g_h = msg[7];

   graf_mouse( M_OFF, 0L );
   wind_get( msg[3], WF_FIRSTXYWH, &rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h );

   while( rect.g_w && rect.g_h )
   {
     if( rc_intersect( &area, &rect ) )
     {
	 rc_2xy( &rect, clip );
	 vs_clip( vhandle, 1, clip );

	 /* Redraw Meta Driver */
#if 0
	 if( gl_meta )
	   do_cross_draw( ad_driver, PMETA2 );

	 /* Redraw Memory Driver */
	 if( gl_mem )
	   do_cross_draw( ad_driver, PMEM2 );	 
#endif
     }
     wind_get( msg[3], WF_NEXTXYWH,&rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h );
   }
   vs_clip( vhandle, 0, clip );
   graf_mouse( M_ON, 0L );
}
Example #23
0
/* ................................................................
 * Handle user interaction with a form in open window `w'.
 *
 * Initial conditions are as follows:
 * w->x is the address of the form.
 * window is open, with appropriate WINFO rects & coordinates set
 * form is drawn within window, at correct virtual coordinates
 * ROOT object of form has correct x,y coordinates
 *
 * This routine works just like form_do, but dispatches window
 * events, redrawing and fixing up the object tree as appropriate,
 * and maintaining the various rects and coordinates in the WINFO struct.
 *
 * Returns exit object selected, |= 0x8000 if double clicked a TOUCHEXIT,
 * OR -1 if a message was received which couldn't be handled.
 * In the latter case, the `puntmsg' array is filled with the message buffer
 * which xform_do() couldn't handle, and the application is responsible for
 * picking up where xform_do() left off.  A cop-out, I know.
 *
 * NOTE: form_dial( FMD_START,... ) and form_dial( FMD_FINISH,... )
 *		should NOT be used with xform_do().
 *
 * User defined objects could cause problems with this routine, as
 * the boundary of the object may lie outside the window coordinates.
 * Caveat programmer.
 */
WORD
cdecl
xform_do( OBJECT *tree, WORD start_field, WORD puntmsg[] )
{
	WORD	next_obj, edit_obj, idx;
	BOOLEAN	cont, doedit;
	WORD	event;
	MRETS	m;
	WORD	key, clicks;
	DIRS	direction; /* form_keybd */
	GRECT	rect;
		
	cpx_tree = tree;
	SetAccCloseState( FALSE );
	SetWmCloseState( FALSE );
	/*
	 * Get the next editable object
	 */
	if( start_field == 0 )
		next_obj = find_obj( tree, 0, FORWARD );
	else
		next_obj = start_field;

	edit_obj = 0;
	cont = TRUE;
	
	cursor = FALSE;
	
	while( cont ) {

		/*
		 * Put the cursor in the edit field
		 * Note: This is skipped if there is only one field.
		 */
		if( (next_obj != 0) && (edit_obj != next_obj) ) {
			edit_obj = next_obj;
			next_obj = 0;
			doedit = can_edit( tree, edit_obj );
			if( doedit && !cursor )
			{
				objc_edit( tree, edit_obj, 0, (int *)&idx, ED_INIT );
				cursor = TRUE;
			}	
		}
		wind_update( FALSE );
		/*
		 * Wait...
		 */
		event = Evnt_multi( MU_KEYBD|MU_BUTTON|MU_MESAG, 2, 1, 1,
							NULL, NULL, msg, 0L, &m, &key, &clicks );
		wind_update( TRUE );

		if( EvMessage() ) {
			switch( MsgType(msg) ) {
				case AC_OPEN:   acc_open( (int *)msg );
						break;
						
				case WM_TOPPED:
				case WM_NEWTOP:
					        Wm_Topped( ( int *)msg );
						doedit = can_edit( tree, edit_obj );
					        if( doedit && !cursor )
					        {
					           objc_edit( tree, edit_obj, 0, (int *)&idx, ED_INIT );
						   cursor = TRUE;
					        }
						break;
						
				case WM_SIZED:
					doedit = can_edit( tree, edit_obj );
					
				/* fall through */
				case WM_MOVED:	/* if moving, that means we are on top, therefore, cursor is already on */
						doedit = can_edit( tree, edit_obj );
						if( !doedit )
							cursor = FALSE;
				case WM_REDRAW:
				case WM_FULLED:
				case WM_ARROWED:
				case WM_HSLID:
				case WM_VSLID:
				/* redraw 'n' shit */
						
					if( edit_obj && ( msg[0] == WM_REDRAW ))
					{
					    NoEdit( edit_obj );
					    rect = ObRect( edit_obj );
					    objc_offset( tree, edit_obj, &rect.g_x, &rect.g_y );

					    /* The offsets will take care of the blinking cursor
					     * area that needs to be redraw to erase it.
					     */
					    rect.g_y -= 3;
					    rect.g_w += 3;
					    rect.g_h += 6;

					    /* Clip the rectangle to the work area of the form.*/
					    rc_intersect( &w.work, &rect ); 

					    /* The redraw is necessary to turn off the blinking cursor.
					     * We are going to need to send a redraw message to the calling
					     * cpx in case they have any custom redraws that need to be done.
					     */
					    Redraw_XForm_Do( &rect );
					    
					    if( msg[0] == WM_REDRAW )
					    {	
					       for( idx = 0; idx < 8; idx++ )
						   puntmsg[idx] = msg[idx];
					    }

					}
					/* Here we redraw/move the area that is dirtied */    
					do_windows( (int *)msg, (int *)&event );
					if( edit_obj )
					    MakeEditable( edit_obj );
					doedit = can_edit( tree, edit_obj );
					if( !doedit )
						cursor = FALSE;
					if( msg[0] == WM_REDRAW )
					{	
					   for( idx = 0; idx < 8; idx++ )
						   puntmsg[idx] = msg[idx];
					   return -1;
					}
				break;

				default:if( msg[0] == AC_CLOSE )
						SetAccCloseState( TRUE );
					if( msg[0] == AP_TERM )
					{
					    SetAccCloseState( TRUE );
					    msg[0] = AC_CLOSE;
					}
					if( msg[0] == WM_CLOSED )
					        SetWmCloseState( TRUE );
					for( idx = 0; idx < 8; idx++ )
						puntmsg[idx] = msg[idx];
					return -1;
			}
		}


/*
 * What about hot keys?? AIEEE!!
 */
		if( EvKey() ) {

			/*
			 * form_keybd() encapsulated here
			 */
			direction = NODIR;
			switch( key ) {

				case K_RETURN:
				case K_ENTER:
					next_obj = 0;
					direction = DEFAULTDIR;
					break;

				case K_BACKTAB:
				case K_UP:
					direction = BACKWARD;
					break;

				case K_TAB:
				case K_DOWN:
					direction = FORWARD;
					break;
			}

			if( direction != NODIR ) {
				key = 0;
				next_obj = find_obj( tree, edit_obj, direction );
				if( (direction == DEFAULTDIR) && (next_obj != 0) ) {
					Objc_change( tree, next_obj, &w.work,
 				        ObState(next_obj)|SELECTED, TRUE );
					cont = FALSE;
				}
			}
			/*
			 * End of form_keybd()
			 */

			/* The above code clears 'key', therefore, we'll
			 * check key FIRST, then test the ASCII and 
			 * scancode
			 */
			if( key && ( !( key & 0xff ) )  )
			{
			  if( ( key != K_UP     )  &&
			      ( key != K_DOWN   )  &&
			      ( key != K_RIGHT  )  &&
			      ( key != K_LEFT   )  &&
			      ( key != K_RETURN )  &&
			      ( key != K_ENTER  )  &&
			      ( key != K_TAB )	   &&
			      ( key != K_BACKTAB)
			    )
			    {
			      puntmsg[0] = CT_KEY;
			      puntmsg[3] = key;
			      return -1;
			    }  
			}

			if( key && doedit )
				objc_edit( tree, edit_obj, key, (int *)&idx, ED_CHAR );
		}

		if( EvButton() ) {
			next_obj = objc_find( tree, ROOT, MAX_DEPTH, m.x, m.y );
			if( next_obj == NIL ) {
				Bconout( 2, 7 );
				next_obj = 0;
			} else {
				cont = fm_button( tree, next_obj, clicks, &next_obj );
			}
		}

		if(  doedit && (!cont || (next_obj != 0)) && ( next_obj != edit_obj) )
		{
		   objc_edit( tree, edit_obj, 0, (int *)&idx, ED_END );
		   cursor = FALSE;
		}   		
	}

	return next_obj;
}
Example #24
0
short main(int argc, char *argv[])
{
	MFDB dest;
	short my_AppId, x, y, w, h;
	short work_in[11] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2};
	short work_out[57], msg[16], w_id1;
	short open_windows = 1, dummy;
	short wx, wy, ww, wh, clip[4], pnt[4];
	char win1_name[20];
	unsigned short logo_trnfrm[LOGO_DATASIZE];
	GRECT dirty, walk;
	short e = 0, evx, evy, a, kc_shstate, kc_key, click_count;

	my_AppId = appl_init();
	my_handle = graf_handle(&x, &y, &w, &h);		/* Open a virtual workstation */
	v_opnvwk(work_in, &my_handle, work_out);

	logo_bm.fd_w = LOGO_W;
	logo_bm.fd_h = LOGO_H;
	logo_bm.fd_wdwidth = 12;
	logo_bm.fd_nplanes = 4;
	logo_bm.fd_stand = 1;
	dest = logo_bm;
	dest.fd_stand = 0;

	logo_bm.fd_addr = (void *)x_logo;
	dest.fd_addr = (void *)logo_trnfrm;
	vr_trnfm(my_handle, &logo_bm, &dest);
	logo_bm.fd_addr = (void *)logo_trnfrm;

	w_id1 = wind_create(NAME|CLOSE|MOVER, 0, 0, LOGO_W + 40, LOGO_H + 40);

	if (argc > 1)
		sprintf(win1_name,"%s", argv[1]);
	else
		sprintf(win1_name,"Welcome to...", argv[1]);
		
	wind_set(w_id1, WF_NAME, ADDR(win1_name));

	x = (work_out[0] - (LOGO_W + 40)) / 2;
	y = (work_out[1] - (LOGO_H + 40)) / 2;
	wind_open(w_id1, x, y, LOGO_W + 40, LOGO_H + 40);

	while((open_windows) && (!(e & MU_TIMER))) {
		e = evnt_multi(MU_MESAG|MU_TIMER, 258, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			msg, 15000, 0, &evx, &evy, &a, &kc_shstate, &kc_key, &click_count);

		if (e & MU_MESAG) {
			dummy = msg[0];
			switch(dummy) {
			case WM_CLOSED:	/* Did someone close one of our windows? */
				wind_close(msg[3]);
				open_windows--;
				break;
			case WM_MOVED:
				wind_set(msg[3], WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7]);
				break;
			case WM_REDRAW:
				dirty.g_x = msg[4];
				dirty.g_y = msg[5];
				dirty.g_w = msg[6];
				dirty.g_h = msg[7];
				wind_update(BEG_UPDATE);
				wind_get(msg[3], WF_WORKXYWH, &wx, &wy, &ww, &wh);
				walk.g_x = wx;
				walk.g_y = wy;
				walk.g_w = ww;
				walk.g_h = wh;
				pnt[0] = wx;
				pnt[1] = wy;
				pnt[2] = wx + ww;
				pnt[3] = wy + wh;
				wind_get(msg[3], WF_FIRSTXYWH, &x, &y, &w, &h);
				rc_intersect(&walk, &dirty);
				graf_mouse(M_OFF, NULL);
				while(h) {
					walk.g_x = x;
					walk.g_y = y;
					walk.g_w = w;
					walk.g_h = h;
					if (rc_intersect(&dirty, &walk)) {
						clip[0] = walk.g_x;
						clip[1] = walk.g_y;
						clip[2] = walk.g_x + walk.g_w;
						clip[3] = walk.g_y + walk.g_h;
						vs_clip(my_handle, 1, clip);
						vsf_color(my_handle, LWHITE);
						v_bar(my_handle, pnt);
						display_bitmap(wx, wy);
					}
					wind_get(msg[3], WF_NEXTXYWH, &x, &y, &w, &h);
				}
				vs_clip(my_handle, 0, clip);
				graf_mouse(M_ON, NULL);
				wind_update(END_UPDATE);
				break;
			case WM_TOPPED:
				wind_set(msg[3], WF_TOP, 0, 0, 0, 0);
				break;
			case WM_BOTTOMED:
				wind_set(msg[3], WF_BOTTOM, 0, 0, 0, 0);
				break;
			}
		}
	}
	
	v_clsvwk(my_handle);
	
	appl_exit();
	
	return 0;
}
Example #25
0
/* blit_slots()
 *==========================================================================
 * Handle the scrolling of the slots.  Worst case is to redraw all four
 * slots. Otherwise, we blit three, two or one slots, and redraw the 
 * remaining.
 *
 * IN:   int oldnum:		Old node number
 *       int newnum:		new node number
 *				Note: the node nunber is the node
 *				that is in the first slot.
 * OUT: void
 */
void
blit_slots( int oldnum, int newnum )
{
    OBJECT *tree = ( OBJECT *)rs_trindex[ XCONTROL ];
    
    GRECT srcbase;
    GRECT dstbase;
    GRECT clip;
    GRECT rect;
    int   pxy[16];
    GRECT clip2;
            
    int   offset;
    long  location = 0L;
    int   dummy;
    int   ypos1;
    int   ypos2;
        
    clip = ObRect( SLOT0 );
    objc_offset( tree, SLOT0, &clip.g_x, &clip.g_y );
    clip.g_h = ( clip.g_h * MAX_SLOTS ) + MAX_SLOTS;
    clip2 = srcbase = dstbase = rect = clip;
    offset = newnum - oldnum;


    /* Serious Kludge - This will do a blit, when we shouldn't.
     * The code following kludges the height comparisons to 
     * force a total redraw instead of a blit when we are
     * 8 pixels too close to the edge
     */
    ypos1 = desk.g_y + desk.g_h - 1;
    objc_offset( tree, SLOTBASE, &dummy, &ypos2 );
    ypos2 = ypos2 + ObH( SLOTBASE ) + 8;
    
                   
    if( !offset )			/* went nowhere fast...*/
    	   return;
    	   
    if( !open_vwork() )
       return;

    rc_intersect( &desk, &clip2 );
    if(  ( abs( offset )  <  MAX_SLOTS ) &&
    	 rc_equal( &clip2, &clip ) && ( ypos2 < ypos1 )
      )
    {
       rect.g_h    = ( abs( offset ) * ObH( SLOT0 ) );
       dstbase.g_h = srcbase.g_h = (MAX_SLOTS - abs(offset )) * ObH( SLOT0 ) + ( MAX_SLOTS - abs( offset) );
       if( offset > 0 )
       {
          objc_offset( tree, slots[ abs( MAX_SLOTS - offset ) ].obj,
                       &dummy, &rect.g_y );
	  objc_offset( tree, slots[ abs( offset ) ].obj, &dummy, &srcbase.g_y );
       }
       else
	  objc_offset( tree, slots[ abs( offset ) ].obj, &dummy, &dstbase.g_y );

       rc_intersect( &desk, &srcbase );
       rc_intersect( &desk, &dstbase );
       
       rc_2xy( &srcbase, ( WORD *) &pxy[0] );
       rc_2xy( &dstbase, ( WORD *)&pxy[4] );
       rc_2xy( &clip, ( WORD *)&pxy[8] );
       vs_clip( vhandle, 1, &pxy[8] );
       graf_mouse( M_OFF, 0L );
       Vsync();
       vro_cpyfm( vhandle, 3, pxy, ( MFDB *)&location,
                                   ( MFDB *)&location );
       graf_mouse( M_ON, 0L );
    }
    else
    {
       rc_2xy( &clip, ( WORD *)&pxy[0] );
       vs_clip( vhandle, 1, &pxy[0] );
    }
    
    Vsync();
    Objc_draw( tree, SLOTBASE, MAX_DEPTH, &rect );

    close_vwork();
}
Example #26
0
/*----------------------------------------------------------------------------------------*/
int16	objc_scroll( OBJECT *tree, int16 vdihandle, int16 obj, int16 whdl, int32 yscroll, int16 xscroll, int16 ydraw )
{
	MFDB		s, d;
	GRECT		r, w, obr;
	int16		xy[8];
	int16		ca[8];
	int16		dy;
	boolean	draw;

	draw = FALSE;
	wind_get_grect( whdl, WF_FIRSTXYWH, &r );
	wind_get_grect( whdl, WF_WORKXYWH, &w );
	objc_rect( tree, obj, &obr );

	if( !rc_intersect( &obr, &r ) || !rc_intersect( &gl_desk, &r ) )
		return 0;

	if( r.g_w != obr.g_w || r.g_h != obr.g_h )
		draw = TRUE;

	if( labs(yscroll) >= (int32)obr.g_h || abs(xscroll) >= obr.g_w )
		draw = TRUE;

	if( !draw )
	{
		grect_to_array( &r, xy );						/* Quelle f�r vro_cpyfm */
		grect_to_array( &w, ca );						/* Array f�r clipping */
		xy[4] = xy[0];										/* Ziel f�r vro_cpyfm */
		xy[5] = xy[1];
		xy[6] = xy[2];
		xy[7] = xy[3];

		if( xscroll )										/* Horizontales Scrolling */
		{
			if( xscroll > 0 )								/* Links Scrolling */
			{
				xy[0] += (int16) xscroll;
				xy[6] -= (int16) xscroll;

				r.g_x += r.g_w - (int16)xscroll;		/* Rechter Bereich nicht gescrollt, */
				r.g_w  = (int16)xscroll;				/* mu� neu gezeichnet werden */
			}
			else												/* Rechts Scrolling */
			{
				xy[2] += (int16)xscroll;
				xy[4] -= (int16)xscroll;

				r.g_w = (int16)(-xscroll);				/* Linken Bereich noch neu zeichnen */
			}
		}
	
		dy = (int16)yscroll;
		dy = -dy;
	
		if( dy )												/* Vertikales Scrolling */
		{
			if( dy > 0 )									/* Aufw�rts Scrolling */
			{
				xy[1] += (int16)dy;						/* Werte f�r vro_cpyfm */
				xy[7] -= (int16)dy;

				r.g_y += r.g_h - (int16)dy - ydraw;	/* Unterer Bereich nicht gescrollt, */
				r.g_h  = (int16)dy + ydraw;			/* mu� neu gezeichnet werden */
			}
			else												/* Abw�rts Scrolling */
			{
				xy[3] += (int16)dy;						/* Werte f�r vro_cpyfm */
				xy[5] -= (int16)dy;

				r.g_h = (int)(-dy) + ydraw;			/* Oberen Bereich noch neu zeichnen */
			}
		}
		s.fd_addr = d.fd_addr = NULL;					/* Erzwinge Bildschirmadresse */
		vs_clip( vdihandle, 1, ca );
		hide_mouse();
		vro_cpyfm(vdihandle, S_ONLY, xy, &s, &d);
		show_mouse();
		objc_draw( tree, 0, MAX_DEPTH, &r );
	}

	return !draw;
}
Example #27
0
/* Pop_Blit()
 *==========================================================================
 * Blit from screen to buffer or buffer to screen for Popup Box redraws.
 *
 * IN: long *PopPtr:	Pointer to memory buffer...
 *     GRECT *area:	GRECT of blit PXY area
 *     GRECT *clip:	GRECT of clip blit area
 *     int   flag:	0 - blit from screen to buffer
 *                      1 - blit from buffer to screen
 *
 * OUT: returns true if successful, false if failed.
 */
int
Pop_Blit( long *PopPtr, GRECT *clip, int flag )
{
    long location = 0L;				/* SCREEN MFDB		*/
    static int  nplanes;				/* Number of planes	*/
    int  pxy[8];					/* pxy for blit		*/
    static MFDB PopMFDB;				/* buffer MFDB		*/

    unsigned long size;				/* size of malloc	*/

    if( !open_vwork() )
        return( FALSE );

    clip->g_w = clip->g_w + 2;
    clip->g_h = clip->g_h + 2;
    rc_2xy( clip, ( WORD *)&pxy[0] );
    vs_clip( vhandle, 1, pxy );

    if( !flag )					/* screen to buffer blit*/
    {
        vq_extnd( vhandle, 1, work_out );
        nplanes = work_out[4];

        size = (unsigned long)(((long)clip->g_w + 7L )/8L) *
               (long)clip->g_h * (long)nplanes;
        size = size * 2L;
        *PopPtr = (long)Malloc( (unsigned long ) size );
        if( !*PopPtr )
        {
            close_vwork();
            return( FALSE );
        }

        PopMFDB.fd_addr 	= (long *)*PopPtr;	/* Setup the MFDB      */
        PopMFDB.fd_w	= clip->g_w;
        PopMFDB.fd_h	= clip->g_h;
        PopMFDB.fd_wdwidth = ( clip->g_w + 15 ) / 16;
        PopMFDB.fd_stand 	= 0;
        PopMFDB.fd_nplanes = nplanes;
        PopMFDB.fd_r1 	= PopMFDB.fd_r2 = PopMFDB.fd_r3 = 0;
    }

    graf_mouse( M_OFF, 0L );

    if(!flag )
    {
        /* Screen to buffer blit */
        rc_intersect( &desk, clip );
        rc_2xy( clip, ( WORD *)&pxy[0] );
        pxy[4] = pxy[5] = 0;
        pxy[6] = clip->g_w - 1;
        pxy[7] = clip->g_h - 1;
        vro_cpyfm( vhandle, 3, pxy, (MFDB *)&location, &PopMFDB );
    }
    else
    {
        /* Buffer to screen blit */
        rc_intersect( &desk, clip );
        pxy[0] = pxy[1] = 0;
        pxy[2] = clip->g_w - 1;
        pxy[3] = clip->g_h - 1;
        rc_2xy( clip, ( WORD *)&pxy[4] );
        vro_cpyfm( vhandle, 3, pxy, &PopMFDB, (MFDB *)&location );
        if( *PopPtr )
            Mfree( (long)*PopPtr );
    }
    graf_mouse( M_ON, 0L );

    close_vwork();
    return( TRUE );
}
Example #28
0
/* blit_slits()
 *==========================================================================
 * Perform the blitting when the slits are scrolling.
 * IN: BOOLEAN flag:	either Active or Inactive
 *     int old_slit:	The previous slit
 *     int new_slit:	The current slit to work on.
 */
void
Blit_Slits( int old_slit, int new_slit )
{
    GRECT srcbase;
    GRECT dstbase;
    GRECT clip;
    GRECT rect;
    int   pxy[16];
    GRECT clip2;
                
    int   offset;
    long  location = 0L;
    int   dummy;
    int   obj;
    int   base;
    
    obj  = First_Obj;
    base = Base_Obj;
    clip = ObRect( base );
    objc_offset( tree, obj, &clip.g_x, &clip.g_y );
    clip2 = srcbase = dstbase = rect = clip;  
    offset = new_slit - old_slit;
               
    if( !offset )			/* went nowhere fast...*/
    	   return;
    	   
    if( !open_vwork())
    {
        return;
    }

    rc_intersect( &desk, &clip2 );
    if(  ( abs( offset )  <  MAX_SLITS ) &&
    	 rc_equal( &clip2, &clip ) 
      )
    {
       rect.g_h    = ( abs( offset ) * ObH( obj ) );
       dstbase.g_h = srcbase.g_h = ( MAX_SLITS - abs( offset ) ) * ObH( obj );
       if( offset > 0 )
       {
          objc_offset( tree, obj + abs( MAX_SLITS - offset ),
                       &dummy, &rect.g_y );
	  objc_offset( tree, obj + abs( offset ), &dummy, &srcbase.g_y );
       }
       else
	  objc_offset( tree, obj + abs( offset ), &dummy, &dstbase.g_y );

       rc_intersect( &desk, &srcbase );
       rc_intersect( &desk, &dstbase );
       
       rc_2xy( &srcbase, ( WORD *) &pxy[0] );
       rc_2xy( &dstbase, ( WORD *)&pxy[4] );
       rc_2xy( &clip, ( WORD *)&pxy[8] );
       
       vs_clip( vhandle, 1, &pxy[8] );

       graf_mouse( M_OFF, 0L );
       Vsync();
       vro_cpyfm( vhandle, 3, pxy, ( MFDB *)&location,
                                   ( MFDB *)&location );
       graf_mouse( M_ON, 0L );
    }
    else
    {
       rc_2xy( &clip, ( WORD *)&pxy[0] );
       vs_clip( vhandle, 1, &pxy[0] );
    }

    Vsync();
    Objc_draw( tree, base, MAX_DEPTH, &rect );

    close_vwork();
}
Example #29
0
void browser_redraw( struct gui_window * gw )
{
	LGRECT bwrect;
	struct s_browser * b = gw->browser;
	short todo[4];
	struct rect clip;
	/* used for clipping of content redraw: */
	struct rect redraw_area;

	if( b->attached == false || b->bw->current_content == NULL ) {
		return;
	}

	browser_get_rect(gw, BR_CONTENT, &bwrect);

	plotter->resize(plotter, bwrect.g_w, bwrect.g_h);
	plotter->move(plotter, bwrect.g_x, bwrect.g_y );
	clip.x0 = 0;
	clip.y0 = 0;
	clip.x1 = bwrect.g_w;
	clip.y1 = bwrect.g_h;
	plotter->set_clip( plotter, &clip );
	if( plotter->lock(plotter) == 0 )
		return;

	if( b->scroll.required == true && b->bw->current_content != NULL) {
		browser_process_scroll( gw, bwrect );
		b->scroll.required = false;
	}

	if ((b->redraw.areas_used > 0) && b->bw->current_content != NULL ) {
		if( (plotter->flags & PLOT_FLAG_OFFSCREEN) == 0 ) {

			int i;
			GRECT area;
			GRECT fbwork;
			short wf_top[4];
			todo[0] = bwrect.g_x;
			todo[1] = bwrect.g_y;
			todo[2] = todo[0] + bwrect.g_w-1;
			todo[3] = todo[1] + bwrect.g_h-1;
			vs_clip(plotter->vdi_handle, 1, (short*)&todo[0]);

			wind_get( 0, WF_TOP, &wf_top[0], &wf_top[1],
						&wf_top[2], &wf_top[3] );

			if( wf_top[0] == gw->root->handle->handle
				&& wf_top[1] == _AESapid ){
				/* The window is on top, so there is no need to walk the 	*/
				/* AES rectangle list. 										*/
				for( i=0; i<b->redraw.areas_used; i++ ){
					fbwork.g_x = todo[0] - bwrect.g_x;
					fbwork.g_y = todo[1] - bwrect.g_y;
					if( fbwork.g_x < 0 ){
						fbwork.g_w = todo[2] + todo[0];
						fbwork.g_x = 0;
					} else {
						fbwork.g_w = todo[2];
					}
					if( fbwork.g_y < 0 ){
						fbwork.g_h = todo[3] + todo[1];
						fbwork.g_y = 0;
					} else {
						fbwork.g_h = todo[3];
					}
					area.g_x = b->redraw.areas[i].x0;
					area.g_y = b->redraw.areas[i].y0;
					area.g_w = b->redraw.areas[i].x1 - b->redraw.areas[i].x0;
					area.g_h = b->redraw.areas[i].y1 - b->redraw.areas[i].y0;
					if (rc_intersect((GRECT *)&fbwork,(GRECT *)&area)) {
						redraw_area.x0 = area.g_x;
						redraw_area.y0 = area.g_y;
						redraw_area.x1 = area.g_x + area.g_w;
						redraw_area.y1 = area.g_y + area.g_h;
						browser_redraw_content( gw, 0, 0, &redraw_area );
					} else {
						/* the area should be kept scheduled for later redraw,*/
						/* but because this is onscreen plotter, it doesn't   */
						/* make much sense anyway...						  */
					}
				}
			} else {
				/* walk the AES rectangle list: */
				if( wind_get(gw->root->handle->handle, WF_FIRSTXYWH,
								&todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
					while (todo[2] && todo[3]) {
						/* convert screen to framebuffer coords: */
						fbwork.g_x = todo[0] - bwrect.g_x;
						fbwork.g_y = todo[1] - bwrect.g_y;
						if( fbwork.g_x < 0 ){
							fbwork.g_w = todo[2] + todo[0];
							fbwork.g_x = 0;
						} else {
							fbwork.g_w = todo[2];
						}
						if( fbwork.g_y < 0 ){
							fbwork.g_h = todo[3] + todo[1];
							fbwork.g_y = 0;
						} else {
							fbwork.g_h = todo[3];
						}
						/* walk the redraw requests: */
						for( i=0; i<b->redraw.areas_used; i++ ){
							area.g_x = b->redraw.areas[i].x0;
							area.g_y = b->redraw.areas[i].y0;
							area.g_w = b->redraw.areas[i].x1 - b->redraw.areas[i].x0;
							area.g_h = b->redraw.areas[i].y1 - b->redraw.areas[i].y0;
							if (rc_intersect((GRECT *)&fbwork,(GRECT *)&area)) {
								redraw_area.x0 = area.g_x;
								redraw_area.y0 = area.g_y;
								redraw_area.x1 = area.g_x + area.g_w;
								redraw_area.y1 = area.g_y + area.g_h;
								browser_redraw_content( gw, 0, 0, &redraw_area );
							} else {
								/* the area should be kept scheduled for later redraw,*/
								/* but because this is onscreen plotter, it doesn't   */
								/* make much sense anyway...						  */
							}

						}
						if (wind_get(gw->root->handle->handle, WF_NEXTXYWH,
								&todo[0], &todo[1], &todo[2], &todo[3])==0) {
							break;
						}
					}
				}
			}


			vs_clip(plotter->vdi_handle, 0, (short*)&todo);
		} else {

			/* its save to do a complete redraw without knowledge about GEM windows :) */
			/* walk the redraw requests: */
			int i;
			for( i=0; i<b->redraw.areas_used; i++ ){
				struct redraw_context ctx = {
					.interactive = true,
					.background_images = true,
					.plot = &atari_plotters
				};
				browser_window_redraw( b->bw, -b->scroll.current.x,
						-b->scroll.current.y, &b->redraw.areas[i], &ctx );
			}
			GRECT area;
			area.g_x = bwrect.g_x;
			area.g_y = bwrect.g_y;
			area.g_w = bwrect.g_w;
			area.g_h = bwrect.g_h;
			//plotter->blit( plotter, &area );
		}
		b->redraw.areas_used = 0;
	}
	if( b->caret.redraw == true && 	b->bw->current_content != NULL ) {
		LGRECT area;
		todo[0] = bwrect.g_x;
		todo[1] = bwrect.g_y;
		todo[2] = todo[0] + bwrect.g_w;
		todo[3] = todo[1] + bwrect.g_h;
		area.g_x = bwrect.g_x;
		area.g_y = bwrect.g_y;
		area.g_w = bwrect.g_w;
		area.g_h = bwrect.g_h;
		vs_clip(plotter->vdi_handle, 1, (short*)&todo[0]);
		browser_redraw_caret( gw, &area );
		vs_clip(plotter->vdi_handle, 0, (short*)&todo[0]);
		b->caret.redraw = false;
	}
	plotter->unlock(plotter);
	/* TODO: if we use offscreen bitmap, trigger content redraw here */
}

static void __CDECL browser_evnt_redraw( COMPONENT * c, long buff[8], void * data)
{
	struct gui_window * gw = (struct gui_window *) data;
	CMP_BROWSER b = gw->browser;
	LGRECT work, lclip;

	browser_get_rect( gw, BR_CONTENT, &work );
	lclip = work;
	if ( !rc_lintersect( (LGRECT*)&buff[4], &lclip ) ) return;

	if( b->bw->current_content == NULL ){
		short pxy[4];
		pxy[0] = lclip.g_x;
		pxy[1] = lclip.g_y;
		pxy[2] = lclip.g_x + lclip.g_w - 1;
		pxy[3] = lclip.g_y + lclip.g_h - 1;
		vsf_color( gw->root->handle->graf->handle, WHITE );
		vsf_perimeter( gw->root->handle->graf->handle, 0);
		vsf_interior( gw->root->handle->graf->handle, FIS_SOLID );
		vsf_style( gw->root->handle->graf->handle, 1);
		v_bar( gw->root->handle->graf->handle, (short*)&pxy );
		return;
	}

	/* convert redraw coords to framebuffer coords: */
	lclip.g_x -= work.g_x;
	lclip.g_y -= work.g_y;

	if( lclip.g_x < 0 ) {
		lclip.g_w = work.g_w + lclip.g_x;
		lclip.g_x = 0;
	}

	if( lclip.g_y < 0 ) {
		lclip.g_h = work.g_h + lclip.g_y;
		lclip.g_y = 0;
	}

	if( lclip.g_h > 0 && lclip.g_w > 0 ) {

		if( gw->browser->reformat_pending == true ){
			LGRECT newsize;
			gw->browser->reformat_pending = false;
			browser_get_rect(gw, BR_CONTENT, &newsize);
			/* this call will also schedule an redraw for the complete */
			/* area. */
			/* Resize must be handled here, because otherwise */
			/* a redraw is scheduled twice (1. by the frontend, 2. by AES) */
			browser_window_reformat(b->bw, false, newsize.g_w, newsize.g_h );
		} else {
			browser_schedule_redraw( gw, lclip.g_x, lclip.g_y,
				lclip.g_x + lclip.g_w, lclip.g_y + lclip.g_h
			);
		}
	}

	return;
}
Example #30
0
WORD fm_alert(WORD defbut, LONG palstr)
{
        register WORD   i;
        WORD            inm, nummsg, mlenmsg, numbut, mlenbut, image;
        LONG            tree;
        GRECT           d, t;
        OBJECT          *obj;

                                                /* init tree pointer    */
        tree = (LONG) rs_trees[DIALERT];

        gsx_mfset(ad_armice);

        fm_parse(tree, palstr, &inm, &nummsg, &mlenmsg, &numbut, &mlenbut);
        fm_build(tree, (inm != 0), nummsg, mlenmsg, numbut, mlenbut);

        if (defbut)
        {
          obj = ((OBJECT *)tree) + BUTOFF + defbut - 1;
          obj->ob_flags |= DEFAULT;
        }

        obj = ((OBJECT *)tree) + 1;

        if (inm != 0)
        {
          switch(inm) {
            case 1:
              image = NOTEBB;
              break;
            case 2:
              image = QUESTBB;
              break;
            default:
              image = STOPBB;
              break;
          }
          obj->ob_spec = (LONG) &rs_bitblk[image];
        }
                                                /* convert to pixels    */
        for(i=0; i<NUM_ALOBJS; i++)
          rs_obfix(tree, i);
                                                /* fix up icon, 32x32   */
        obj->ob_type = G_IMAGE;
        obj->ob_width = obj->ob_height = 32;
                                                /* center tree on screen*/
        ob_center(tree, &d);

        /* Fix 2003-09-25: Limit drawing to the screen! */
        rc_intersect(&gl_rscreen, &d);
                                                /* save screen under-   */
                                                /*   neath the alert    */
        wm_update(TRUE);
        gsx_gclip(&t);
        bb_save(&d);
                                                /* draw the alert       */
        gsx_sclip(&d);
        ob_draw(tree, ROOT, MAX_DEPTH);
                                                /* turn on the mouse    */
        ct_mouse(TRUE);
                                                /* let user pick button */
        i = fm_do(tree, 0);
                                                /* turn off mouse if necessary */
        ct_mouse(FALSE);
                                                /* restore saved screen */
        gsx_sclip(&d);
        bb_restore(&d);
        gsx_sclip(&t);
        wm_update(FALSE);
                                                /* return selection     */
        return( i - BUTOFF + 1 );
}