Esempio n. 1
0
/* render dashboard bars (graph) */
void
render_bars (WINDOW * win, GDashModule * module_data, int y, int *x, int idx,
             int w, int selected)
{
   GDashStyle *style = module_style;
   GModule module = module_data->module;
   char *bar;

   if (style[module].color_bars == -1)
      return;

   bar = get_bars (module_data->data[idx].hits, module_data->max_hits, *x);
   if (selected) {
      if (conf.color_scheme == MONOCHROME)
         init_pair (1, COLOR_BLACK, COLOR_WHITE);
      else
         init_pair (1, COLOR_BLACK, COLOR_GREEN);

      wattron (win, COLOR_PAIR (HIGHLIGHT));
      mvwhline (win, y, *x, ' ', w);
      mvwprintw (win, y, *x, "%s", bar);
      wattroff (win, COLOR_PAIR (HIGHLIGHT));
   } else {
      mvwprintw (win, y, *x, "%s", bar);
   }
   free (bar);
}
Esempio n. 2
0
/* render dashboard bars (graph) */
static void
render_bars (GDashModule * data, GDashRender render, int *x)
{
  WINDOW *win = render.win;
  GModule module = data->module;
  const GDashStyle *style = module_style;

  char *bar;
  int y = render.y, w = render.w, idx = render.idx, sel = render.sel;

  if (style[module].color_bars == -1)
    return;

  bar = get_bars (data->data[idx].metrics->hits, data->max_hits, *x);
  if (sel)
    draw_header (win, bar, "%s", y, *x, w, HIGHLIGHT, 0);
  else
    mvwprintw (win, y, *x, "%s", bar);
  free (bar);
}