From 5b371344624d42e055306491f767416a9a735d24 Mon Sep 17 00:00:00 2001 From: arif Date: Tue, 21 Apr 2009 18:42:21 +0000 Subject: [PATCH] a lot of smyrna changes, --- cmd/smyrna/viewportcamera.c | 124 +++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 59 deletions(-) diff --git a/cmd/smyrna/viewportcamera.c b/cmd/smyrna/viewportcamera.c index a1e24ec4a..682488d8b 100644 --- a/cmd/smyrna/viewportcamera.c +++ b/cmd/smyrna/viewportcamera.c @@ -62,20 +62,21 @@ int delete_camera_from_viewport(ViewInfo * view, viewport_camera * c) { int ind; int found = 0; - for (ind = 0; ind < view->camera_count; ind++) { - if ((view->cameras[ind] == c) && found == 0) - found = 1; - if ((found == 1) && (ind < (view->camera_count - 1))) - view->cameras[ind] = view->cameras[ind + 1]; + for (ind = 0; ind < view->camera_count; ind++) + { + if ((view->cameras[ind] == c) && found == 0) + found = 1; + if ((found == 1) && (ind < (view->camera_count - 1))) + view->cameras[ind] = view->cameras[ind + 1]; } - if (found) { - free(c); - view->camera_count--; - view->cameras = - RALLOC(view->camera_count, view->cameras, viewport_camera *); - viewport_update_camera_indexes(view); - view->active_camera--; - return 1; + if (found) + { + free(c); + view->camera_count--; + view->cameras =RALLOC(view->camera_count, view->cameras, viewport_camera *); + viewport_update_camera_indexes(view); + view->active_camera--; + return 1; } return 0; } @@ -172,19 +173,23 @@ void attach_camera_widget(ViewInfo * view) 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--; + 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; } - } - /*remove panel itself */ - glCompSetRemovePanel(s, s->panels[ind]); - break; - } } @@ -224,45 +229,46 @@ void attach_camera_widget(ViewInfo * 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, + 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, + 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; + 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; } } int show_camera_settings(viewport_camera * c) -- 2.40.0