Ejemplo n.º 1
0
/*{{{  redraw -- redraw screen, restore contents of saved windows*/
int redraw()
   {
   register WINDOW *win;

#ifdef DEBUG
   dprintf(b)(stderr,"\r\n\tREDRAW\r\n");
#endif
   for(win=active;win != (WINDOW *) 0;win=W(next)) {
      if (W(flags)&W_ACTIVE) {
         save_win(win);
         do_event(EVENT_REDRAW,win,E_MAIN);
         }
      }

   erase_win(screen);
   if (active) {
      for(win=ACTIVE(prev);win != active;win=W(prev)) {
         restore_win(win);
         border(win,BLK_BDR,WH_BDR);
         }
      restore_win(active);
      border(active,BLK_BDR,WH_BDR);
      }
   }
Ejemplo n.º 2
0
/*{{{  shape -- reshape a window to specified dimensions*/
int shape(int x, int y, int dx, int dy)
{
  int sx, sy, w, h;
  WINDOW *win;

  if (dx > 0) {
    sx = x;
    w = dx;
  } else {
    sx = x + dx;
    w = -dx;
  }
  if (dy > 0) {
    sy = y;
    h = dy;
  } else {
    sy = y + dy;
    h = -dy;
  }

  if (sx < 0)
    sx = 0;

  if (sx + w >= BIT_WIDE(screen))
    w = BIT_WIDE(screen) - sx;

  if (sy + h >= BIT_HIGH(screen))
    h = BIT_HIGH(screen) - sy;

  if (w < 2 * ACTIVE(borderwid) + ACTIVE(font)->head.wide * MIN_X || h < 2 * ACTIVE(borderwid) + ACTIVE(font)->head.high * MIN_Y)
    return (-1);

#ifdef MGR_ALIGN
  alignwin(screen, &sx, &w, ACTIVE(borderwid));
#endif

  /* remove current window position */
  save_win(active);
  erase_win(ACTIVE(border));
  clip_bad(active); /* invalidate clip lists */

  /* redraw remaining windows */
  repair(active);

  /* adjust window state */
  ACTIVE(x0) = sx;
  ACTIVE(y0) = sy;
  bit_destroy(ACTIVE(window));
  bit_destroy(ACTIVE(border));
  ACTIVE(border) = bit_create(screen, sx, sy, w, h);
  ACTIVE(window) = bit_create(ACTIVE(border),
      ACTIVE(borderwid),
      ACTIVE(borderwid),
      w - ACTIVE(borderwid) * 2,
      h - ACTIVE(borderwid) * 2);

  for (win = ACTIVE(next); win != (WINDOW *)0; win = W(next)) {
    if (W(flags) & W_ACTIVE && intersect(active, win))
      save_win(win);
  }

  CLEAR(ACTIVE(window), PUTOP(BIT_CLR, ACTIVE(style)));

  border(active, BORDER_THIN);
  bit_blit(ACTIVE(border), 0, 0,
      BIT_WIDE(ACTIVE(save)) - ACTIVE(borderwid),
      BIT_HIGH(ACTIVE(save)) - ACTIVE(borderwid),
      BIT_SRC, ACTIVE(save), 0, 0);

  /* make sure character cursor is in a good spot */
  if (ACTIVE(x) > BIT_WIDE(ACTIVE(window))) {
    ACTIVE(x) = 0;
    ACTIVE(y) += ((int)(ACTIVE(font)->head.high));
  }
  if (ACTIVE(y) > BIT_HIGH(ACTIVE(window))) {
#ifdef WIERD
    ACTIVE(y) = BIT_HIGH(ACTIVE(window));
    scroll(ACTIVE(window), 0, BIT_HIGH(ACTIVE(window)),
        ((int)(ACTIVE(font)->head.high)), SWAPCOLOR(ACTIVE(style)));
    bit_blit(ACTIVE(window), 0, BIT_HIGH(ACTIVE(window)) - ((int)(ACTIVE(font)->head.high)),
        BIT_WIDE(ACTIVE(save)), ((int)(ACTIVE(font)->head.high)),
        BIT_SRC, ACTIVE(save),
        ACTIVE(borderwid), BIT_HIGH(ACTIVE(save)) - ((int)(ACTIVE(font)->head.high)) - ACTIVE(borderwid));
#else
    ACTIVE(y) = BIT_HIGH(ACTIVE(window)) - ((int)(ACTIVE(font)->head.high));
#endif
  }

  bit_destroy(ACTIVE(save));
  ACTIVE(save) = (BITMAP *)0;

  /* invalidate clip lists */
  clip_bad(active);
  un_covered();
  set_size(active);
  return (0);
}