Exemplo n.º 1
0
void overlay_draw(void **argv)
{
  log_msg("OVERLAY", "draw");
  Overlay *ov = argv[0];
  if (!ov)
    return;
  if (overlay_expire(ov))
    return;
  ov->queued = false;

  int x = ov->ov_size.col;
  int y = ov->ov_size.lnum;

  draw_wide(ov->nc_st, 0, 0, ov->bufno, SZ_BUF+1);
  mvwchgat (ov->nc_st, 0, 0, SZ_BUF+1, A_NORMAL, ov->col_bufno, NULL);

  draw_wide(ov->nc_st, 0, SZ_BUF-1, ov->name, SZ_LBL+1);
  mvwchgat (ov->nc_st, 0, SZ_BUF-1, SZ_LBL+1, A_NORMAL, ov->col_lbl, NULL);

  mvwhline(ov->nc_st, 0, SZ_LBL-1, ' ', x);
  mvwchgat(ov->nc_st, 0, SZ_LBL-1, -1, A_NORMAL, ov->col_ln, NULL);

  if (ov->separator) {
    wattron(ov->nc_sep, COLOR_PAIR(ov->col_sep));
    int i;
    for (i = 0; i < y; i++)
      mvwaddstr(ov->nc_sep, i, 0, sep_char);
    wattroff(ov->nc_sep, COLOR_PAIR(ov->col_sep));
    DRAW_CH(ov, nc_sep, i, 0, ' ', col_ln);
  }

  //TODO: if arg exceeds SZ_USR() then compress /*/*/ to fit
  int pos = ST_LN(x) - 2;
  draw_wide(ov->nc_st, 0, ST_ARG(), ov->arg, SZ_USR(x));
  mvwchgat (ov->nc_st, 0, ST_ARG(), pos, A_NORMAL, ov->col_text, NULL);

  draw_wide(ov->nc_st, 0, pos, ov->lineno, SZ_ARGS+1);
  mvwchgat (ov->nc_st, 0, pos,  -1, A_NORMAL, ov->col_lbl, NULL);
  mvwchgat (ov->nc_st, 0, pos+5, ov->filter, A_NORMAL, ov->col_fil, NULL);

  if (ov->progfin) {
    ov->progfin = false;
    mvwchgat (ov->nc_st, 0, ST_PRG(), SZ_PRG(x), A_REVERSE, ov->col_lbl, NULL);
  }
  else
    mvwchgat (ov->nc_st, 0, ST_PRG(), ov->prog, A_NORMAL, ov->col_prog, NULL);

  wnoutrefresh(ov->nc_st);
  if (ov->separator)
    wnoutrefresh(ov->nc_sep);
}
Exemplo n.º 2
0
static void overlay_draw_separator(Overlay *ov)
{
  ov->redraw = false;
  int y = ov->ov_size.lnum;
  wattron(ov->nc_sep, COLOR_PAIR(ov->col_sep));

  int i;
  for (i = 0; i < y; i++)
    mvwaddstr(ov->nc_sep, i, 0, sep_char);

  wattroff(ov->nc_sep, COLOR_PAIR(ov->col_sep));
  DRAW_CH(ov, nc_sep, i, 0, ' ', col_ln);
  wnoutrefresh(ov->nc_sep);
}