Exemplo n.º 1
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) );
}
Exemplo n.º 2
0
/*
*       Routine to handle scrolling the directory window a certain number
*       of file names.
*/
static WORD fs_nscroll(LONG tree, WORD *psel, WORD curr, WORD count, 
                       WORD touchob, WORD n)
{
        register WORD   i, newcurr, diffcurr;
        WORD            sy, dy, neg;
        GRECT           r[2];
                                                /* single scroll n times*/
        newcurr = curr;
        for (i=0; i<n; i++)
          newcurr = fs_1scroll(newcurr, count, touchob);
                                                /* if things changed    */
                                                /*   then redraw        */
        diffcurr = newcurr - curr;
        if (diffcurr)
        {
          curr = newcurr;
          fs_sel(*psel, NORMAL);
          *psel = 0;
          fs_format(tree, curr, count);
          gsx_gclip(&r[1]);
          ob_actxywh(tree, F1NAME, &r[0]);

          if (( neg = (diffcurr < 0)) != 0 )
            diffcurr = -diffcurr;

          if (diffcurr < NM_NAMES)
          {
            sy = r[0].g_y + (r[0].g_h * diffcurr);
            dy = r[0].g_y;

            if (neg)
            {
              dy = sy;
              sy = r[0].g_y;
            }

            bb_screen(S_ONLY, r[0].g_x, sy, r[0].g_x, dy, r[0].g_w, 
                                r[0].g_h * (NM_NAMES - diffcurr) );
            if ( !neg )
              r[0].g_y += r[0].g_h * (NM_NAMES - diffcurr);
          }
          else
            diffcurr = NM_NAMES;

          r[0].g_h *= diffcurr;
          for(i=0; i<2; i++)
          {
            gsx_sclip(&r[i]);
            ob_draw(tree, ((i) ? FSVSLID : FILEBOX), MAX_DEPTH);
          }
        }
        return(curr);
}
Exemplo n.º 3
0
/*
 *  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);
}