void testContainer(glCompSet *s) { glCompPanel* p; p = glCompPanelNew((glCompObj *) s, 100, 100, 500, 500); p = glCompPanelNew((glCompObj *) p, 0, 0, 480, 480); p->common.anchor.leftAnchor=1; p->common.anchor.bottomAnchor=1; p->common.anchor.topAnchor=1; p->common.anchor.rightAnchor=1; p->common.anchor.left=10; p->common.anchor.bottom=50; p->common.anchor.top=10; p->common.anchor.right=10; }
glCompSet *glcreate_gl_topview_menu(void) { /* static char* icondir[512]; */ /* int ind=0; */ GLfloat y = 5; GLfloat off = 43; glCompSet *s = glCompSetNew(view->w, view->h); glCompPanel *p = NULL; glCompButton *b = NULL; /* glCompLabel *l=NULL; */ glCompImage *i = NULL; /* glCompLabel* l; */ glCompColor c; s->common.callbacks.click = CBglCompMouseRightClick; p = glCompPanelNew((glCompObj *) s, 25, 25, 45, 47); p->common.align = glAlignLeft; p->common.data = 0; /*pan */ b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, ""); glCompButtonAddPngGlyph(b, smyrnaPath("pan.png")); b->common.callbacks.click = menu_click_pan; panBtn = b; y = y + off; /*switch to fisheye */ b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, ""); glCompButtonAddPngGlyph(b, smyrnaPath("fisheye.png")); b->common.callbacks.click = menu_switch_to_fisheye; toFisheye = b; /*switch to normal mode */ b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, ""); glCompButtonAddPngGlyph(b, smyrnaPath("no_fisheye.png")); b->common.callbacks.click = menu_switch_to_fisheye; b->common.visible = 0; toNormal = b; y=y+off; b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, ""); glCompButtonAddPngGlyph(b, smyrnaPath("3D.png")); b->common.callbacks.click = switch2D3D; to3DBtn = b; b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, ""); glCompButtonAddPngGlyph(b, smyrnaPath("2D.png")); b->common.callbacks.click = switch2D3D; glCompButtonHide(b); to2DBtn = b; y=y+off; b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, "N"); b->common.callbacks.click = (glcompclickfunc_t)selectnodes; b->groupid=-1; b->status=1; y=y+off; b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, "E"); b->common.callbacks.click = (glcompclickfunc_t)selectedges; b->groupid=-1; p = glCompPanelNew((glCompObj *) p, 1, 325, 45, 180); p->common.align = glAlignTop; p->common.data = 0; p->common.borderWidth = 1; p->shadowwidth = 0; c.R = 0.80; c.G = 0.6; c.B = 0.6; c.A = 1.6; y = 1; b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, ""); glCompButtonAddPngGlyph(b, smyrnaPath("details.png")); b->common.callbacks.click = attrList; copy_glcomp_color(&c, &b->common.color); y = y + off; b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, ""); glCompButtonAddPngGlyph(b, smyrnaPath("zoomin.png")); b->groupid = 0; b->common.callbacks.click = menu_click_zoom_plus; copy_glcomp_color(&c, &b->common.color); y = y + off; b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, ""); glCompButtonAddPngGlyph(b, smyrnaPath("zoomout.png")); b->common.callbacks.click = menu_click_zoom_minus; copy_glcomp_color(&c, &b->common.color); y = y + off; b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, ""); glCompButtonAddPngGlyph(b, smyrnaPath("center.png")); b->common.callbacks.click = menu_click_center; copy_glcomp_color(&c, &b->common.color); p = glCompPanelNew((glCompObj *) s, -250, 550, 150, 175); p->common.borderWidth = 0; p->shadowwidth = 0; p->common.color.R = 0; p->common.color.G = 0; p->common.color.B = 1; p->common.color.A = 0.2; p->common.visible = 0; sel = p; s->common.callbacks.mouseover = glCompMouseMove; s->common.callbacks.mouseup = CBglCompMouseUp; p = glCompPanelNew((glCompObj *) s, 25, 25, 52, 47); p->common.align = glAlignRight; p->common.data = 0; p->common.color.A = 0; p = glCompPanelNew((glCompObj *) p, 25, 0, 52, 110); p->common.align = glAlignTop; p->common.data = 0; p->common.color.A = 0; p->shadowwidth = 0; i = glCompImageNew((glCompObj *) p, 0, 0); glCompImageLoadPng(i, smyrnaPath("mod_fisheye.png"),1); imgFisheye = i; i->common.visible = 0; i = glCompImageNew((glCompObj *) p, 0, 52); glCompImageLoadPng(i, smyrnaPath("mod_3D.png"),1); img3D = i; i->common.visible = 0; return s; }
int load_host_buttons(topview * t, Agraph_t * g, glCompSet * s) { GtkLayout *layout; int btncount = 0; int i = 0; char *str; char hostbtncaption[50]; char hostbtnregex[50]; char hostbtncolorR[50]; char hostbtncolorG[50]; char hostbtncolorB[50]; char hostbtncolorA[50]; int X = 10; int Y = 25; GdkColor color; glCompPanel *p; glCompButton *b; layout = (GtkLayout *) glade_xml_get_widget(xml, "frmHostSelectionFixed"); str = '\0'; str = agget(g, "hostbtncount"); if (str) btncount = atoi(str); // Graph [hostbtncaption1="AT&T",hostbtnregex1="*.ATT*",hostbtncolorR1="1",hostbtncolorG1="0",hostbtncolorB1="0",hostbtncolorA1="1"]; t->TopviewData->hostregex = N_GNEW(btncount, char *); t->TopviewData->gtkhostbtn = N_GNEW(btncount, GtkButton *); t->TopviewData->gtkhostcolor = N_GNEW(btncount, GtkColorButton *); t->TopviewData->gtkhostbtncount = btncount; if (btncount > 0) { p = glCompPanelNew(25, 75, 165, 400); p->data = 2; //data panel p->color.R = (float) 0.80; p->color.B = (float) 0.2; glCompSetAddPanel(s, p); } else return 0; for (i = 0; i < btncount; i++) { sprintf(hostbtncaption, "hostbtncaption%i", i); sprintf(hostbtnregex, "hostbtnregex%i", i); sprintf(hostbtncolorR, "hostbtncolorR%i", i); sprintf(hostbtncolorG, "hostbtncolorG%i", i); sprintf(hostbtncolorB, "hostbtncolorB%i", i); sprintf(hostbtncolorA, "hostbtncolorA%i", i); agget(g, hostbtncaption), agget(g, hostbtnregex), agget(g, hostbtncolorR), agget(g, hostbtncolorG), agget(g, hostbtncolorB), agget(g, hostbtncolorA); t->TopviewData->hostregex[i] = agget(g, hostbtnregex); b = glCompButtonNew((GLfloat) 5, (GLfloat) 7 + ((GLfloat) i + (GLfloat) 1) * (GLfloat) 36, (GLfloat) 150, (GLfloat) 35, agget(g, hostbtncaption), '\0', 0, 0); b->color.R = (float) atof(agget(g, hostbtncolorR)); b->color.G = (float) atof(agget(g, hostbtncolorG)); b->color.B = (float) atof(agget(g, hostbtncolorB)); b->color.A = (float) 1; b->panel = p; b->groupid = -1; b->callbackfunc = glhost_button_clicked_Slot; b->data = i; glCompSetAddButton(s, b); t->TopviewData->gtkhostbtn[i] = (GtkButton *) gtk_button_new_with_label(agget(g, hostbtncaption)); g_signal_connect((gpointer) t->TopviewData->gtkhostbtn[i], "clicked", G_CALLBACK(host_button_clicked_Slot), (gpointer) i); color.blue = 65535 * atoi(agget(g, hostbtncolorB)); color.red = 65535 * atoi(agget(g, hostbtncolorR)); color.green = 65535 * atoi(agget(g, hostbtncolorG)); t->TopviewData->gtkhostcolor[i] = (GtkColorButton *) gtk_color_button_new_with_color(&color); gtk_color_button_set_alpha((GtkColorButton *) t->TopviewData-> gtkhostbtn[i], 65535 * atoi(agget(g, hostbtncolorA))); gtk_layout_put(layout, (GtkWidget *) t->TopviewData->gtkhostbtn[i], X, Y); gtk_widget_set_size_request((GtkWidget *) t->TopviewData-> gtkhostbtn[i], 200, 35); gtk_layout_put(layout, (GtkWidget *) t->TopviewData->gtkhostcolor[i], X + 225, Y); gtk_widget_set_size_request((GtkWidget *) t->TopviewData-> gtkhostcolor[i], 40, 35); gtk_widget_show((GtkWidget *) t->TopviewData->gtkhostbtn[i]); gtk_widget_show((GtkWidget *) t->TopviewData->gtkhostcolor[i]); Y = Y + 40; t->TopviewData->hostactive[i] = 0; } p->height = (GLfloat) 15 + (GLfloat) (btncount + 1) * (GLfloat) 36; for (i = 0; i < btncount; i++) { prepare_nodes_for_groups(t, t->TopviewData, i); } return 1; }
void attach_camera_widget(ViewInfo * view) { #define PANEL_PADDING 5 #define CAMERA_BUTTON_HEIGHT 25 #define CAMERA_BUTTON_WIDTH 75 int ind, ind2; GLfloat x, y; char buf[256]; glCompPanel *p; glCompButton *b; glCompSet *s = view->widgets; int p_height; /*first we need to get rid of the old menu */ for (ind = 0; ind < s->panelcount; ind++) { if (s->panels[ind]->data == 3) { /*remove buttons in the panel */ for (ind2 = 0; ind2 < s->buttoncount; ind2++) { if (s->buttons[ind2]->panel == s->panels[ind]) { glCompSetRemoveButton(s, s->buttons[ind2]); ind2--; } } /*remove panel itself */ glCompSetRemovePanel(s, s->panels[ind]); break; } } /*calculate height of panel */ p_height = 2 * PANEL_PADDING + view->camera_count * (CAMERA_BUTTON_HEIGHT + PANEL_PADDING) + CAMERA_BUTTON_HEIGHT; /*container for camera buttons */ p = glCompPanelNew((GLfloat) 25, (GLfloat) 75, (GLfloat) 4 * PANEL_PADDING + 3 * CAMERA_BUTTON_WIDTH, (GLfloat) p_height, scientific_y); p->data = 3; glCompSetAddPanel(s, p); b = glCompButtonNew((GLfloat) PANEL_PADDING, (GLfloat) PANEL_PADDING, (GLfloat) CAMERA_BUTTON_WIDTH, (GLfloat) CAMERA_BUTTON_HEIGHT, "ADD", '\0', 0, 0, scientific_y); b->panel = p; b->groupid = 0; b->customptr = view; glCompSetAddButton(s, b); b->callbackfunc = menu_click_add_camera; b = glCompButtonNew((GLfloat) PANEL_PADDING * 2 + (GLfloat) CAMERA_BUTTON_WIDTH, (GLfloat) PANEL_PADDING, (GLfloat) CAMERA_BUTTON_WIDTH, (GLfloat) CAMERA_BUTTON_HEIGHT, "2D", '\0', 0, 0, scientific_y); b->panel = p; b->groupid = 4; //4 is assigned to all camera buttons b->customptr = view; glCompSetAddButton(s, b); b->callbackfunc = menu_click_2d; for (ind = 0; ind < view->camera_count; ind++) { y = p->height - ((GLfloat) PANEL_PADDING + (GLfloat) ind * ((GLfloat) CAMERA_BUTTON_HEIGHT + (GLfloat) PANEL_PADDING)) - (GLfloat) CAMERA_BUTTON_HEIGHT; x = PANEL_PADDING; sprintf(buf, "CAM%i", ind + 1); b = glCompButtonNew((GLfloat) x, (GLfloat) y, (GLfloat) CAMERA_BUTTON_WIDTH, (GLfloat) CAMERA_BUTTON_HEIGHT, buf, '\0', 0, 0, scientific_y); b->panel = p; b->groupid = 4; //4 is assigned to all camera buttons b->data = ind; //assign camera id to custom data to use single call back b->customptr = view; glCompSetAddButton(s, b); b->callbackfunc = menu_click_camera_select; x = PANEL_PADDING * 2 + CAMERA_BUTTON_WIDTH; b = glCompButtonNew((GLfloat) x, (GLfloat) y, (GLfloat) CAMERA_BUTTON_WIDTH, (GLfloat) CAMERA_BUTTON_HEIGHT, "Remove", '\0', 0, 0, scientific_y); b->panel = p; b->groupid = 0; b->data = ind; //assign camera id to custom data to use single call back b->customptr = view; glCompSetAddButton(s, b); b->callbackfunc = menu_click_camera_remove; x = PANEL_PADDING * 3 + CAMERA_BUTTON_WIDTH * 2; b = glCompButtonNew((GLfloat) x, (GLfloat) y, (GLfloat) CAMERA_BUTTON_WIDTH, (GLfloat) CAMERA_BUTTON_HEIGHT, "Edit", '\0', 0, 0, scientific_y); b->panel = p; b->groupid = 0; b->data = ind; //assign camera id to custom data to use single call back b->customptr = view; glCompSetAddButton(s, b); b->callbackfunc = menu_click_camera_edit; } }