Index: layersel/layersel.c =================================================================== --- layersel/layersel.c (revision 8504) +++ layersel/layersel.c (revision 8505) @@ -2,7 +2,9 @@ #include "lib_gtk_common/compat.h" typedef struct layersel_grp_s { - GtkWidget *grp_row, *grp_closed, *grp_open, *layer[4]; + GtkWidget *grp_row, *grp_closed, *grp_open; + + GtkWidget *layer[4], *vis_on[4], *vis_off[4]; } layersel_grp_t; /*** Layer visibility widget rendering ***/ @@ -84,9 +86,9 @@ /*** Row builder ***/ -static GtkWidget *add_grp(layersel_grp_t *ls, const char *gname) +static GtkWidget *build_grp(layersel_grp_t *ls, const char *gname) { - GtkWidget *gn_vert, *grp_layers; + GtkWidget *gn_vert, *grp_layers, *vlabel; int n; char tmp[32]; @@ -113,15 +115,25 @@ gtk_box_pack_start(GTK_BOX(ls->grp_open), gn_vert, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(ls->grp_open), grp_layers, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(gn_vert), gtk_label_new(gname), TRUE, TRUE, 0); + + /* install group name */ + vlabel = gtk_label_new(gname); + gtk_label_set_angle(GTK_LABEL(vlabel), 90); +/* gtk_label_set_ellipsize(GTK_LABEL(vlabel), PANGO_ELLIPSIZE_END); */ + gtk_box_pack_start(GTK_BOX(gn_vert), vlabel, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(ls->grp_open), gtk_label_new(gname), TRUE, TRUE, 0); + /* install layers */ for(n = 0; n < 4; n++) { ls->layer[n] = gtkc_hbox_new(0, 0); gtk_box_pack_start(GTK_BOX(grp_layers), ls->layer[n], TRUE, TRUE, 0); sprintf(tmp, "layer %d\n", n); - gtk_box_pack_start(GTK_BOX(ls->layer[n]), gtk_label_new("[vis]"), TRUE, TRUE, 0); + + ls->vis_on[n] = layer_vis_box(1, "#ff0000"); + gtk_box_pack_start(GTK_BOX(ls->layer[n]), ls->vis_on[n], FALSE, FALSE, 0); + ls->vis_off[n] = layer_vis_box(0, "#ff0000"); + gtk_box_pack_start(GTK_BOX(ls->layer[n]), ls->vis_off[n], FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ls->layer[n]), gtk_label_new(tmp), TRUE, TRUE, 0); } @@ -132,29 +144,30 @@ GtkWidget *pcb_gtk_layersel_build(void) { GtkWidget *main_box; - GtkWidget *box, *spring; - GtkWidget *label, *image; - GtkWidget *event_box; + GtkWidget *spring; + layersel_grp_t grp[3]; + main_box = gtkc_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(main_box), build_grp(&grp[0], "group0"), FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(main_box), build_grp(&grp[1], "group1"), FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(main_box), build_grp(&grp[2], "group2"), FALSE, FALSE, 0); + + +/* box = gtkc_hbox_new(FALSE, 0); - label = gtk_label_new("group1"); - gtk_label_set_angle(GTK_LABEL(label), 90); - gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); event_box = wrap_bind_click(label, G_CALLBACK(group_button_press_cb), NULL); gtk_box_pack_start(GTK_BOX(box), event_box, FALSE, FALSE, 0); - image = layer_vis_box(0, "#ff0000"); - gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(box), gtk_vseparator_new(), FALSE, FALSE, 2); - image = layer_vis_box(1, "#00ff00"); - gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); label = gtk_label_new("layer_1"); gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), gtkc_hbox_new(FALSE, 0), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(main_box), box, FALSE, FALSE, 0); +*/ + + spring = gtkc_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(main_box), spring, TRUE, TRUE, 0);