Пример #1
0
VOID icon_wh(LONG taddr, WORD *w, WORD *h)
{
	ICONBLK	here;
	GRECT	p;

	LBCOPY(ADDR(&here), taddr, sizeof(ICONBLK));
	rc_copy((GRECT *) &here.ib_xchar, &p);
	rc_union((GRECT *) &here.ib_xicon, &p);
	rc_union((GRECT *) &here.ib_xtext, &p);
	*w = p.g_x + p.g_w;
	*h = p.g_y + p.g_h;
}
Пример #2
0
/*
*       Call to move top window.  This involves BLTing the window if
*       none of it that is partially off the screen needs to be redraw,
*       else the whole desktop to just updated.  All uncovered portions
*       of the desktop are redrawn by later by calling w_update.
*/
WORD w_move(WORD w_handle, WORD *pstop, GRECT *prc)
{
        GRECT           s;                      /* source               */
        GRECT           d;                      /* destination          */
        register GRECT  *pc;
        register WORD   sminus1, dminus1;

        w_getsize(WS_PREV, w_handle, &s);
        s.g_w += 2;
        s.g_h += 2;
        w_getsize(WS_TRUE, w_handle, &d);
                                                /* set flags for when   */
                                                /*   part of the source */
                                                /*   is off the screen  */
        if ( ( (s.g_x + s.g_w > gl_width) && (d.g_x < s.g_x) )  ||
             ( (s.g_y + s.g_h > gl_height) && (d.g_y < s.g_y) )   )
        {
          rc_union(&s, &d);
          *pstop = DESKWH;
        }
        else
        {
          *pstop = w_handle;
        }
                                                /* intersect with full  */
                                                /*   screen and align   */
                                                /*   fringes if -1 xpos */
        sminus1 = w_mvfix(&s, &d);
        dminus1 = w_mvfix(&d, &s);
                                                /* blit what we can     */
        if ( *pstop == w_handle )
        {
          gsx_sclip(&gl_rfull);
          bb_screen(S_ONLY, s.g_x, s.g_y, d.g_x, d.g_y, s.g_w, s.g_h);
                                                /* cleanup left edge    */
          if (sminus1 != dminus1)
          {
            if (dminus1)
              s.g_x--;
            if (sminus1)
            {
              d.g_x--;
              d.g_w = 1;
              gsx_sclip(&d);
              w_clipdraw(gl_wtop, 0, 0, 0);
            }
          }
          pc = &s;
        }
        else
        {
          pc = &d;
        }
                                                /* clean up the rest    */
                                                /*   by returning       */
                                                /*   clip rect          */
        rc_copy(pc, prc);
        return( (*pstop == w_handle) );
}
Пример #3
0
/*
*       Walk down ORECT list and accumulate the union of all the owner
*       rectangles.
*/
WORD w_union(ORECT *po, GRECT *pt)
{
        if (!po)
          return(FALSE);

        pt->g_x = po->o_x;
        pt->g_y = po->o_y;
        pt->g_w = po->o_w;
        pt->g_h = po->o_h;

        po = po->o_link;
        while (po)
        {
          rc_union((GRECT *)&po->o_x, pt);  /* FIXME: typecast */
          po = po->o_link;
        }
        return(TRUE);
}
Пример #4
0
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);
}