/* * rc_equal( Rcvar r1, Rcvar r2 ) * * Returns AL_TRUE if r1 and r2 and equivilant, AL_FALSE otherwise. */ static ALboolean rc_equal( Rcvar r1, Rcvar r2 ) { if( rc_type(r1) != rc_type(r2) ) { return AL_FALSE; } switch( rc_type(r1) ) { case ALRC_INVALID: return AL_FALSE; case ALRC_PRIMITIVE: return rc_toprim(r1) == rc_toprim(r2); case ALRC_INTEGER: return rc_toint(r1) == rc_toint(r2); case ALRC_FLOAT: return rc_tofloat(r1) == rc_tofloat(r2); case ALRC_BOOL: return rc_tobool(r1) == rc_tobool(r2); case ALRC_SYMBOL: case ALRC_STRING: return rc_strequal(r1, r2); case ALRC_CONSCELL: return rc_equal( rc_car(r1), rc_car(r2) ) && rc_equal( rc_cdr(r1), rc_cdr(r2) ); default: break; } return AL_FALSE; }
/* * rc_member( Rcvar ls, Rcvar sym ) * * Returns a list with the first conscell to have a matching car with sym as * its head, NULL otherwise. */ static Rcvar rc_member( Rcvar ls, Rcvar symp ) { if( rc_type(symp) != ALRC_CONSCELL ) { return NULL; } if( rc_equal( rc_car( ls ), symp ) ) { return ls; } return rc_member( rc_cdr(ls), symp ); }
/* * Routine to blt the contents of a window based on a new current row */ static void win_blt(WNODE *pw, WORD newcv) { WORD delcv, pn; WORD sx, sy, dx, dy, wblt, hblt, revblt, tmp; GRECT c, t; newcv = max(0, newcv); newcv = min(pw->w_vnrow - pw->w_pnrow, newcv); pn = pw->w_pnrow; delcv = newcv - pw->w_cvrow; pw->w_cvrow += delcv; if (!delcv) return; wind_get_grect(pw->w_id, WF_WXYWH, &c); win_bldview(pw, c.g_x, c.g_y, c.g_w, c.g_h); /* see if any part is off the screen */ wind_get_grect(pw->w_id, WF_FIRSTXYWH, &t); if (rc_equal(&c, &t)) { /* blt as much as we can, adjust clip & draw the rest */ if ((revblt = (delcv < 0)) != 0) delcv = -delcv; if (pn > delcv) { /* see how much there is, pretend blt up */ sx = dx = 0; sy = delcv * G.g_ihspc; dy = 0; wblt = c.g_w; hblt = c.g_h - sy; if (revblt) { tmp = sx; sx = dx; dx = tmp; tmp = sy; sy = dy; dy = tmp; } gsx_sclip(&c); bb_screen(S_ONLY, sx+c.g_x, sy+c.g_y, dx+c.g_x, dy+c.g_y, wblt, hblt); if (!revblt) c.g_y += hblt; c.g_h -= hblt; } } do_wredraw(pw->w_id, c.g_x, c.g_y, c.g_w, c.g_h); }
static WORD gr_wait(GRECT *po, GRECT *poff) { register WORD have2box; register WORD down; have2box = !rc_equal(&gl_rzero, poff); /* draw/erase old */ gsx_moff(); gr_draw(have2box, po, poff); gsx_mon(); /* wait for change */ down = gr_stilldn(TRUE, xrat, yrat, 1, 1); /* draw/erase old */ gsx_moff(); gr_draw(have2box, po, poff); gsx_mon(); /* return exit event */ return(down); }
/* 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(); }
/* 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(); }
void draw_change(WORD w_handle, GRECT *pt) { GRECT c, pprev; register GRECT *pw; register WORD start; WORD stop, moved; WORD oldtop, clrold, diffbord, wasclr; wasclr = !(D.w_win[w_handle].w_flags & VF_BROKEN); /* save old size */ w_getsize(WS_CURR, w_handle, &c); w_setsize(WS_PREV, w_handle, &c); /* set new size's */ w_setsize(WS_CURR, w_handle, pt); pw = (GRECT *) w_getxptr(WS_WORK, w_handle); wm_calc(WC_WORK, D.w_win[w_handle].w_kind, pt->g_x, pt->g_y, pt->g_w, pt->g_h, &pw->g_x, &pw->g_y, &pw->g_w, &pw->g_h); /* update rect. lists */ everyobj(gl_wtree, ROOT, NIL, (void(*)())newrect, 0, 0, MAX_DEPTH); /* remember oldtop */ oldtop = gl_wtop; gl_wtop = W_TREE[ROOT].ob_tail; /* if new top then */ /* change men */ if (gl_wtop != oldtop) w_menufix(); /* set ctrl rect and */ /* mouse owner */ w_setactive(); /* init. starting window*/ start = w_handle; /* stop at the top */ stop = DESKWH; /* set flag to say we */ /* haven't moved */ /* the top window */ moved = FALSE; /* if same upper left */ /* corner and not */ /* zero size window */ /* then its a size or */ /* top request, else */ /* its a move, grow, */ /* open or close. */ if ( (!rc_equal(&gl_rzero, pt)) && (pt->g_x == c.g_x) && (pt->g_y == c.g_y) ) { /* size or top request */ if ( (pt->g_w == c.g_w) && (pt->g_h == c.g_h) ) { /* sizes of prev and */ /* current are the same*/ /* so its a top request*/ /* return if this isn't */ /* a top request */ if ( (w_handle != W_TREE[ROOT].ob_tail) || (w_handle == oldtop) ) return; /* say when borders will*/ /* change */ diffbord = !( (D.w_win[oldtop].w_flags & VF_SUBWIN) && (D.w_win[gl_wtop].w_flags & VF_SUBWIN) ); /* draw oldtop covered */ /* with deactivated */ /* borders */ if (oldtop != NIL) { if (diffbord) w_clipdraw(oldtop, 0, MAX_DEPTH, 2); clrold = !(D.w_win[oldtop].w_flags & VF_BROKEN); } else clrold = TRUE; /* if oldtop isn't */ /* overlapped and new */ /* top was clear then */ /* just draw activated*/ /* borders */ if ( (clrold) && (wasclr) ) { w_clipdraw(gl_wtop, 0, MAX_DEPTH, 1); return; } } else /* size change */ { /* stop before current */ /* window if shrink */ /* was a pure subset */ if ( (pt->g_w <= c.g_w) && (pt->g_h <= c.g_h) ) { stop = w_handle; w_clipdraw(gl_wtop, 0, MAX_DEPTH, 2); moved = TRUE; } /* start at bottom if */ /* a shrink occurred */ if ( (pt->g_w < c.g_w) || (pt->g_h < c.g_h) ) start = DESKWH; /* update rect. is the */ /* union of two sizes */ /* + the drop shadow */ c.g_w = max(pt->g_w, c.g_w) + 2; c.g_h = max(pt->g_h, c.g_h) + 2; } } else { /* move or grow or open */ /* or close */ if ( !(c.g_w && c.g_h) || ( (pt->g_x <= c.g_x) && (pt->g_y <= c.g_y) && (pt->g_x+pt->g_w >= c.g_x+c.g_w) && (pt->g_y+pt->g_h >= c.g_y+c.g_h))) { /* a grow that is a */ /* superset or an open */ rc_copy(pt, &c); } else { /* move, close or shrink*/ /* do a move of top guy */ if ( (pt->g_w == c.g_w) && (pt->g_h == c.g_h) && (gl_wtop == w_handle) ) { moved = w_move(w_handle, &stop, &c); start = DESKWH; } /* check for a close */ if ( !(pt->g_w && pt->g_h) ) start = DESKWH; /* handle other moves */ /* and shrinks */ if ( start != DESKWH ) { rc_union(pt, &c); if ( !rc_equal(pt, &c) ) start = DESKWH; } } } /* update gl_wtop */ /* after close, */ /* or open */ if ( oldtop != W_TREE[ROOT].ob_tail ) { if (gl_wtop != NIL) { /* open or close with */ /* other windows open */ w_getsize(WS_CURR, gl_wtop, pt); rc_union(pt, &c); /* if it was an open */ /* then draw the */ /* old top guy */ /* covered */ if ( (oldtop != NIL ) && (oldtop != w_handle) ) { /* BUGFIX 2/20/86 LKW */ /* only an open if prev */ /* size was zero. */ w_getsize(WS_PREV, gl_wtop, &pprev); if (rc_equal(&pprev, &gl_rzero)) w_clipdraw(oldtop, 0, MAX_DEPTH, 2); /* */ } } } c.g_w += 2; /* account for drop shadow*/ c.g_h += 2; /* BUGFIX in 2.1 */ /* update the desktop */ /* background */ if (start == DESKWH) w_drawdesk(&c); /* start the redrawing */ w_update(start, &c, stop, moved, TRUE); }