static RobWidget * toplevel (BITui* ui, void * const top) { ui->vbox = rob_vbox_new (FALSE, 2); robwidget_make_toplevel (ui->vbox, top); ROBWIDGET_SETNAME(ui->vbox, "bitmeter"); /* main drawing area */ ui->m0 = robwidget_new (ui); ROBWIDGET_SETNAME (ui->m0, "sigco (m0)"); robwidget_set_alignment (ui->m0, .5, .5); robwidget_set_expose_event (ui->m0, expose_event); robwidget_set_size_request (ui->m0, size_request); robwidget_set_size_allocate (ui->m0, m0_size_allocate); robwidget_set_size_default (ui->vbox, size_default); /* info - box */ ui->tbl_nfo = rob_table_new (/*rows*/3, /*cols*/5, FALSE); ui->lbl_desc[0] = robtk_lbl_new ("Not a number:"); ui->lbl_desc[1] = robtk_lbl_new ("Infinity:"); ui->lbl_desc[2] = robtk_lbl_new ("Denormal:"); ui->lbl_desc[3] = robtk_lbl_new ("Time window:"); ui->lbl_desc[4] = robtk_lbl_new ("Smallest non zero sample:"); ui->lbl_desc[5] = robtk_lbl_new ("Largest sample:"); for (int i = 0; i < 6; ++i) { ui->lbl_data[i] = robtk_lbl_new ("XXXXXXXXXX"); robtk_lbl_set_alignment(ui->lbl_desc[i], 1, .5); robtk_lbl_set_alignment(ui->lbl_data[i], 0, .5); } #define GLB_W(PTR) robtk_lbl_widget(PTR) rob_table_attach_defaults (ui->tbl_nfo, GLB_W(ui->lbl_desc[3]), 0, 1, 0, 1); rob_table_attach_defaults (ui->tbl_nfo, GLB_W(ui->lbl_data[3]), 1, 2, 0, 1); rob_table_attach_defaults (ui->tbl_nfo, GLB_W(ui->lbl_desc[4]), 0, 1, 1, 2); rob_table_attach_defaults (ui->tbl_nfo, GLB_W(ui->lbl_data[4]), 1, 2, 1, 2); rob_table_attach_defaults (ui->tbl_nfo, GLB_W(ui->lbl_desc[5]), 0, 1, 2, 3); rob_table_attach_defaults (ui->tbl_nfo, GLB_W(ui->lbl_data[5]), 1, 2, 2, 3); rob_table_attach_defaults (ui->tbl_nfo, GLB_W(ui->lbl_desc[0]), 2, 3, 0, 1); rob_table_attach_defaults (ui->tbl_nfo, GLB_W(ui->lbl_data[0]), 3, 4, 0, 1); rob_table_attach_defaults (ui->tbl_nfo, GLB_W(ui->lbl_desc[1]), 2, 3, 1, 2); rob_table_attach_defaults (ui->tbl_nfo, GLB_W(ui->lbl_data[1]), 3, 4, 1, 2); rob_table_attach_defaults (ui->tbl_nfo, GLB_W(ui->lbl_desc[2]), 2, 3, 2, 3); rob_table_attach_defaults (ui->tbl_nfo, GLB_W(ui->lbl_data[2]), 3, 4, 2, 3); /* controls */ ui->box_btn = rob_hbox_new (TRUE, 2); ui->btn_freeze = robtk_cbtn_new ("Freeze", GBT_LED_OFF, false); ui->btn_avg = robtk_cbtn_new ("Integrate", GBT_LED_OFF, false); ui->btn_reset = robtk_pbtn_new ("Reset"); robtk_cbtn_set_color_checked (ui->btn_freeze, .8, .1, .1); robtk_pbtn_set_alignment (ui->btn_reset, 0.5, 0.5); robtk_cbtn_set_alignment (ui->btn_avg, 0.5, 0.5); robtk_cbtn_set_alignment (ui->btn_freeze, 0.5, 0.5); /* button packing */ rob_hbox_child_pack (ui->box_btn, robtk_cbtn_widget (ui->btn_freeze), TRUE, TRUE); rob_hbox_child_pack (ui->box_btn, robtk_cbtn_widget (ui->btn_avg), TRUE, TRUE); rob_hbox_child_pack (ui->box_btn, robtk_pbtn_widget (ui->btn_reset), TRUE, TRUE); /* global packing */ rob_vbox_child_pack (ui->vbox, ui->tbl_nfo, FALSE, TRUE); rob_vbox_child_pack (ui->vbox, ui->m0, TRUE, TRUE); rob_vbox_child_pack (ui->vbox, ui->box_btn, FALSE, TRUE); /* signals */ robtk_cbtn_set_callback (ui->btn_freeze, cb_btn_freeze, ui); robtk_cbtn_set_callback (ui->btn_avg, cb_btn_avg, ui); robtk_pbtn_set_callback (ui->btn_reset, cb_btn_reset, ui); initialize_font_cache (ui); update_minmax (ui, 0, 0); update_minmax (ui, 1, 0); update_oops (ui, 0, 0); update_oops (ui, 1, 0); update_oops (ui, 2, 0); return ui->vbox; }
static RobWidget * toplevel(SFSUI* ui, void * const top) { /* main widget: layout */ ui->rw = rob_vbox_new(FALSE, 0); robwidget_make_toplevel(ui->rw, top); ui->hbox1 = rob_hbox_new(FALSE, 0); ui->hbox2 = rob_hbox_new(FALSE, 0); ui->sep2 = robtk_sep_new(true); rob_vbox_child_pack(ui->rw, ui->hbox1, FALSE, FALSE); rob_vbox_child_pack(ui->rw, robtk_sep_widget(ui->sep2), FALSE, FALSE); rob_vbox_child_pack(ui->rw, ui->hbox2, FALSE, FALSE); ui->font[0] = pango_font_description_from_string("Mono 7"); ui->font[1] = pango_font_description_from_string("Mono 8"); get_color_from_theme(0, ui->c_fg); get_color_from_theme(1, ui->c_bg); create_surfaces(ui); /* main drawing area */ ui->m0 = robwidget_new(ui); ROBWIDGET_SETNAME(ui->m0, "stsco (m0)"); robwidget_set_expose_event(ui->m0, expose_event); robwidget_set_size_request(ui->m0, size_request); rob_hbox_child_pack(ui->hbox1, ui->m0, FALSE, FALSE); /* screen persistence dial */ ui->lbl_screen = robtk_lbl_new("Persistence:"); ui->screen = robtk_dial_new_with_size(0.0, 100.0, 1, 22, 22, 10.5, 10.5, 10); robtk_dial_set_alignment(ui->screen, 1.0, 0.5); robtk_dial_set_value(ui->screen, 50); robtk_dial_set_default(ui->screen, 50.0); robtk_dial_set_callback(ui->screen, cb_set_persistence, ui); /* fft bins */ ui->lbl_fft = robtk_lbl_new("FFT Samples:"); ui->sel_fft = robtk_select_new(); robtk_select_add_item(ui->sel_fft, 128, "256"); robtk_select_add_item(ui->sel_fft, 256, "512"); robtk_select_add_item(ui->sel_fft, 512, "1024"); robtk_select_add_item(ui->sel_fft, 1024, "2048"); robtk_select_add_item(ui->sel_fft, 2048, "4096"); robtk_select_add_item(ui->sel_fft, 4096, "8192"); robtk_select_add_item(ui->sel_fft, 6144, "12288"); robtk_select_add_item(ui->sel_fft, 8192, "16384"); robtk_select_set_default_item(ui->sel_fft, 3); robtk_select_set_value(ui->sel_fft, 512); robtk_select_set_callback(ui->sel_fft, cb_set_fft, ui); /* N/octave */ ui->btn_oct = robtk_cbtn_new("N/Octave Bands", GBT_LED_LEFT, false); robtk_cbtn_set_active(ui->btn_oct, false); robtk_cbtn_set_callback(ui->btn_oct, cb_set_oct, ui); robtk_cbtn_set_color_on(ui->btn_oct, .2, .8, .1); robtk_cbtn_set_color_off(ui->btn_oct, .1, .3, .1); /* explicit alignment */ ui->sep0 = robtk_sep_new(true); robtk_sep_set_linewidth(ui->sep0, 0); rob_hbox_child_pack(ui->hbox2, robtk_lbl_widget(ui->lbl_screen), FALSE, FALSE); rob_hbox_child_pack(ui->hbox2, robtk_dial_widget(ui->screen), FALSE, FALSE); rob_hbox_child_pack(ui->hbox2, robtk_lbl_widget(ui->lbl_fft), FALSE, FALSE); rob_hbox_child_pack(ui->hbox2, robtk_select_widget(ui->sel_fft), FALSE, FALSE); rob_hbox_child_pack(ui->hbox2, robtk_sep_widget(ui->sep0), TRUE, FALSE); rob_hbox_child_pack(ui->hbox2, robtk_cbtn_widget(ui->btn_oct), FALSE, FALSE); return ui->rw; }
static RobWidget * toplevel(MF2UI* ui, void * const top) { /* main widget: layout */ ui->rw = rob_vbox_new(FALSE, 0); robwidget_make_toplevel(ui->rw, top); ui->hbox1 = rob_hbox_new(FALSE, 0); ui->hbox2 = rob_hbox_new(FALSE, 0); ui->hbox3 = rob_hbox_new(FALSE, 0); ui->sep2 = robtk_sep_new(true); rob_vbox_child_pack(ui->rw, ui->hbox1, TRUE, TRUE); rob_vbox_child_pack(ui->rw, ui->hbox2, FALSE, TRUE); rob_vbox_child_pack(ui->rw, robtk_sep_widget(ui->sep2), FALSE, TRUE); rob_vbox_child_pack(ui->rw, ui->hbox3, FALSE, TRUE); ui->font[0] = pango_font_description_from_string("Mono 9px"); ui->font[1] = pango_font_description_from_string("Mono 10px"); get_color_from_theme(0, ui->c_fg); get_color_from_theme(1, ui->c_bg); m1_create_surfaces(ui); m2_create_surfaces(ui); /* main drawing area */ ui->m0 = robwidget_new(ui); ROBWIDGET_SETNAME(ui->m0, "mphase (m0)"); robwidget_set_expose_event(ui->m0, expose_event); robwidget_set_size_request(ui->m0, size_request); robwidget_set_size_allocate(ui->m0, m0_size_allocate); rob_hbox_child_pack(ui->hbox1, ui->m0, TRUE, TRUE); /* phase correlation */ ui->m1 = robwidget_new(ui); ROBWIDGET_SETNAME(ui->m1, "phase (m1)"); robwidget_set_expose_event(ui->m1, pc_expose_event); robwidget_set_size_request(ui->m1, pc_size_request); robwidget_set_size_allocate(ui->m1, pc_size_allocate); rob_hbox_child_pack(ui->hbox1, ui->m1, FALSE, TRUE); /* gain box */ ui->sep3 = robtk_sep_new(true); ui->sep4 = robtk_sep_new(true); robtk_sep_set_linewidth(ui->sep3, 0); robtk_sep_set_linewidth(ui->sep4, 0); /* gain annotation */ ui->m2 = robwidget_new(ui); ROBWIDGET_SETNAME(ui->m2, "gain (m2)"); robwidget_set_expose_event(ui->m2, ga_expose_event); robwidget_set_size_request(ui->m2, ga_size_request); rob_hbox_child_pack(ui->hbox2, robtk_sep_widget(ui->sep3), TRUE, TRUE); rob_hbox_child_pack(ui->hbox2, ui->m2, FALSE, FALSE); rob_hbox_child_pack(ui->hbox2, robtk_sep_widget(ui->sep4), TRUE, TRUE); robwidget_set_mousedown(ui->m2, m2_mousedown); robwidget_set_mouseup(ui->m2, m2_mouseup); robwidget_set_mousemove(ui->m2, m2_mousemove); robwidget_set_enter_notify(ui->m2, m2_enter); robwidget_set_leave_notify(ui->m2, m2_leave); /* gain dial */ ui->gain = robtk_dial_new_with_size(-40.0, 40.0, .01, 60, 40, 30.5, 16.5, 10); robtk_dial_set_alignment(ui->gain, 1.0, 0.5); robtk_dial_set_value(ui->gain, 0); robtk_dial_set_default(ui->gain, 20.0); robtk_dial_set_callback(ui->gain, cb_set_gain, ui); robtk_dial_set_surface(ui->gain,ui->sf_dial); robtk_dial_annotation_callback(ui->gain, dial_annotation_db, ui); rob_hbox_child_pack(ui->hbox2, robtk_dial_widget(ui->gain), FALSE, FALSE); /* fft bins */ ui->lbl_fft = robtk_lbl_new("FFT:"); ui->sel_fft = robtk_select_new(); robtk_select_add_item(ui->sel_fft, 64, "128"); robtk_select_add_item(ui->sel_fft, 128, "256"); robtk_select_add_item(ui->sel_fft, 256, "512"); robtk_select_add_item(ui->sel_fft, 512, "1024"); robtk_select_add_item(ui->sel_fft, 1024, "2048"); robtk_select_add_item(ui->sel_fft, 2048, "4096"); robtk_select_add_item(ui->sel_fft, 4096, "8192"); robtk_select_add_item(ui->sel_fft, 6144, "12288"); robtk_select_add_item(ui->sel_fft, 8192, "16384"); robtk_select_set_default_item(ui->sel_fft, 3); robtk_select_set_value(ui->sel_fft, 512); robtk_select_set_callback(ui->sel_fft, cb_set_fft, ui); /* N/octave */ ui->btn_oct = robtk_cbtn_new("N/Octave Bands", GBT_LED_LEFT, false); robtk_cbtn_set_active(ui->btn_oct, false); robtk_cbtn_set_callback(ui->btn_oct, cb_set_oct, ui); robtk_cbtn_set_color_on(ui->btn_oct, .2, .8, .1); robtk_cbtn_set_color_off(ui->btn_oct, .1, .3, .1); /* Normalize */ ui->btn_norm = robtk_cbtn_new("Normalize", GBT_LED_LEFT, false); robtk_cbtn_set_active(ui->btn_norm, false); robtk_cbtn_set_callback(ui->btn_norm, cb_set_norm, ui); robtk_cbtn_set_color_on(ui->btn_norm, .2, .8, .1); robtk_cbtn_set_color_off(ui->btn_norm, .1, .3, .1); /* screen persistence dial */ ui->lbl_screen = robtk_lbl_new("Persistence:"); ui->screen = robtk_dial_new_with_size(0.0, 100.0, 1, 22, 22, 10.5, 10.5, 10); robtk_dial_set_alignment(ui->screen, 1.0, 0.5); robtk_dial_set_value(ui->screen, 33); robtk_dial_set_default(ui->screen, 33.0); robtk_dial_set_callback(ui->screen, cb_set_persistence, ui); /* explicit alignment */ ui->sep0 = robtk_sep_new(true); robtk_sep_set_linewidth(ui->sep0, 0); ui->sep1 = robtk_sep_new(true); robtk_sep_set_linewidth(ui->sep1, 0); rob_hbox_child_pack(ui->hbox3, robtk_lbl_widget(ui->lbl_screen), FALSE, FALSE); rob_hbox_child_pack(ui->hbox3, robtk_dial_widget(ui->screen), FALSE, FALSE); rob_hbox_child_pack(ui->hbox3, robtk_lbl_widget(ui->lbl_fft), FALSE, FALSE); rob_hbox_child_pack(ui->hbox3, robtk_select_widget(ui->sel_fft), FALSE, FALSE); rob_hbox_child_pack(ui->hbox3, robtk_sep_widget(ui->sep0), TRUE, FALSE); rob_hbox_child_pack(ui->hbox3, robtk_cbtn_widget(ui->btn_oct), FALSE, FALSE); rob_hbox_child_pack(ui->hbox3, robtk_sep_widget(ui->sep1), TRUE, FALSE); rob_hbox_child_pack(ui->hbox3, robtk_cbtn_widget(ui->btn_norm), FALSE, FALSE); update_annotations(ui); return ui->rw; }