Пример #1
0
static void vcd_main_gui(gui *g, event_handler *h, void *database)
{
  int i, j;
  int n;
  int nb_functions = 0;
  char **ids;
  widget *win;
  widget *container;
  widget *w;
  view *timeview;
  view *subview;
  logger *timelog;

  /* get number of vcd functions - look for all events VCD_FUNCTION_xxx */
  n = database_get_ids(database, &ids);
  for (i = 0; i < n; i++) {
    if (strncmp(ids[i], "VCD_FUNCTION_", 13) != 0) continue;
    nb_functions++;
  }

  win = new_toplevel_window(g, 1000, 5 * nb_functions, "VCD tracer");
  container = new_container(g, VERTICAL);
  widget_add_child(g, win, container, -1);

  w = new_timeline(g, 1000, nb_functions, 5);
  widget_add_child(g, container, w, -1);
  for (i = 0; i < nb_functions; i++)
    timeline_set_subline_background_color(g, w, i,
        new_color(g, i & 1 ? "#ddd" : "#eee"));
  timeview = new_view_time(3600, 10, g, w);
  i = 0;
  for (j = 0; j < n; j++) {
    if (strncmp(ids[j], "VCD_FUNCTION_", 13) != 0) continue;
    timelog = new_timelog(h, database, ids[j]);
    subview = new_subview_time(timeview, i, FOREGROUND_COLOR, 3600*1000);
    logger_add_view(timelog, subview);
    i++;
  }

  free(ids);
}
Пример #2
0
int main(void)
{
  gui *g;
  widget *w, *c1, *c2, *l, *plot, *tl;
  int tlcol;

  g = gui_init();

  c1 = new_container(g, VERTICAL);
  c2 = new_container(g, HORIZONTAL);

  l = new_label(g, "this is a good label");
  widget_add_child(g, c2, l, 0);
  l = new_label(g, "this is another good label");
  widget_add_child(g, c2, l, -1);

  l = new_label(g, "OH! WHAT A LABEL!");
  widget_add_child(g, c1, l, -1);

  widget_add_child(g, c1, c2, 0);

  plot = new_xy_plot(g, 100, 100, "xy plot test", 30);
#if 0
  c2 = new_container(g, HORIZONTAL);
  widget_add_child(g, c2, plot, -1);
  widget_add_child(g, c1, c2, -1);
#else
  widget_add_child(g, c1, plot, -1);
#endif

  tlcol = new_color(g, "#ddf");
  tl = new_textlist(g, 300, 10, tlcol);
  widget_add_child(g, c1, tl, -1);

  textlist_add(g, tl, "hello", -1, FOREGROUND_COLOR);
  textlist_add(g, tl, "world", -1, FOREGROUND_COLOR);

  w = new_toplevel_window(g, 500, 400, "test window");
  widget_add_child(g, w, c1, 0);

  gui_loop(g);

  return 0;
}
Пример #3
0
void
listbox_add_item(widget_t* lb, widget_t* item)
{
  listbox_t* l = widget_get_instance_data(lb);
  widget_add_child(l->item_container, item);

  rect_t container_rect = widget_get_rect(l->item_container);
  rect_t rect = widget_get_rect(item);
  rect.x = 0;
  rect.y = 0;
  rect.width = MIN(rect.width, container_rect.width);
  rect.height = MIN(rect.height, l->item_height);
  widget_set_rect(item, rect);
  widget_invalidate(lb);
}
Пример #4
0
widget_t*
widget_create(widget_t* parent, const widget_class_t* widget_class, void* instance_data, rect_t rect)
{
  widget_t* w = calloc(1, sizeof(widget_t));

  w->widget_class = widget_class;
  w->instance_data = instance_data;

  w->rect = rect;
  w->needs_layout = true;
  w->needs_paint = true;
  w->visible = true;
  w->enabled = true;
  w->bg_color = (parent == NULL) ? BLACK : TRANSPARENT;

  if (parent != NULL)
    widget_add_child(parent, w);

  return w;
}
Пример #5
0
void t_gui_start(void)
{
  gui *g = gui_init();

  widget *win = new_toplevel_window(g, 550, 140, "input signal");
  widget *plot = new_xy_plot(g, 512, 100, "eNB 0 input signal", 20);
  widget_add_child(g, win, plot, -1);
  xy_plot_set_range(g, plot, 0, 76800, 30, 70);
  xy_plot_new_plot(g, plot, FOREGROUND_COLOR);

  eNB_data.input_signal = plot;
  eNB_data.input_signal_length = 76800 * 4;
  eNB_data.input_signal_iq = calloc(1, 76800 * 4);
  if (eNB_data.input_signal_iq == NULL) abort();
  pthread_mutex_init(&eNB_data.input_signal_lock, NULL);

  eNB_data.g = g;

  new_thread(gui_thread, g);
  new_thread(input_signal_plotter, NULL);
}