From 68ba63a7c72e61bc0b2f12db9041f4dde4ab47cf Mon Sep 17 00:00:00 2001 From: arif Date: Fri, 6 Nov 2009 18:02:13 +0000 Subject: [PATCH] GLgui layout changes, all buttons are on the left side --- cmd/smyrna/glexpose.c | 2 + cmd/smyrna/gui/appmouse.c | 105 +++++++++++++++----------------------- cmd/smyrna/gui/appmouse.h | 2 - cmd/smyrna/gui/glcompui.c | 66 ++++++++++-------------- cmd/smyrna/main.c | 4 ++ cmd/smyrna/smyrna.vcproj | 8 +++ cmd/smyrna/smyrnadefs.h | 4 -- cmd/smyrna/topview.c | 19 +++---- 8 files changed, 92 insertions(+), 118 deletions(-) diff --git a/cmd/smyrna/glexpose.c b/cmd/smyrna/glexpose.c index 7add58af7..8dcd03891 100644 --- a/cmd/smyrna/glexpose.c +++ b/cmd/smyrna/glexpose.c @@ -163,6 +163,8 @@ int glexpose_main(ViewInfo * view) btnToolZoomFit_clicked(NULL, NULL); } } + else + return; glexpose_grid(view); draw_fisheye_magnifier(view); diff --git a/cmd/smyrna/gui/appmouse.c b/cmd/smyrna/gui/appmouse.c index 06ff992d2..6326f78eb 100644 --- a/cmd/smyrna/gui/appmouse.c +++ b/cmd/smyrna/gui/appmouse.c @@ -63,36 +63,62 @@ static void appmouse_down(ViewInfo* v,int x,int y) } static void appmouse_up(ViewInfo* v,int x,int y) { - v->mouse.down=0; - v->mouse.finalPos.x=x; - v->mouse.finalPos.y=y; - view->mouse.dragX = 0; - view->mouse.dragY = 0; - GetFixedOGLPos((float) x,y,v->GLDepth, &v->mouse.GLfinalPos.x,&v->mouse.GLfinalPos.y,&v->mouse.GLfinalPos.z); - if(singleclick(v)) - { - if (v->mouse.t==glMouseLeftButton) - appmouse_left_click(v,x,y); - if (v->mouse.t==glMouseRightButton) - appmouse_right_click(v,x,y); - } + int a; + v->mouse.down=0; + v->mouse.finalPos.x=x; + v->mouse.finalPos.y=y; + view->mouse.dragX = 0; + view->mouse.dragY = 0; + a=get_mode(v); + GetFixedOGLPos((float) x,y,v->GLDepth, &v->mouse.GLfinalPos.x,&v->mouse.GLfinalPos.y,&v->mouse.GLfinalPos.z); + if(singleclick(v)) + { + if (v->mouse.t==glMouseLeftButton) + appmouse_left_click(v,x,y); + if (v->mouse.t==glMouseRightButton) + appmouse_right_click(v,x,y); + } + if ((a== MM_FISHEYE_MAGNIFIER) || (a == MM_MAGNIFIER)) //fisheye mag mouse release, stop distortion + originate_distorded_coordinates(v->Topview); + + } static void appmouse_drag(ViewInfo* v,int x,int y) { static float x2,y2; + int a=get_mode(v); v->mouse.pos.x=x; v->mouse.pos.y=y; GetFixedOGLPos((float) x,y,v->GLDepth, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z); x2=v->mouse.GLpos.x; y2=v->mouse.GLpos.y; -// v->mouse.dragX=x2-prevX; -// v->mouse.dragY=y2-prevY; prevX=x2; prevY=y2; -// printf ("(%f,%f)->(%f,%f) : %f %f \n",v->mouse.pos.x,v->mouse.GLinitPos.y,v->mouse.GLfinalPos.x,v->mouse.GLfinalPos.y,v->mouse.dragX,v->mouse.dragY); + if (a==MM_ROTATE) + + { + view->arcball->MousePt.s.X = (GLfloat) x; + view->arcball->MousePt.s.Y = (GLfloat) y; + if (!view->arcball->isDragging) { + arcmouseClick(view); + view->arcball->isDragging = 1; + } else + arcmouseDrag(view); + return; + } + if (a==MM_PAN) + glmotion_pan(v); + if (a==MM_MOVE) + move_TVnodes(); + + if(a==MM_RECTANGULAR_SELECT) + { + + } + } @@ -102,32 +128,6 @@ void appmouse_left_click_down(ViewInfo* v,int x,int y) appmouse_down(v,x,y); -} -int get_mode(ViewInfo* v) -{ -/*#define MM_PAN 0 -#define MM_ZOOM 1 -#define MM_ROTATE 2 -#define MM_SINGLE_SELECT 3 -#define MM_RECTANGULAR_SELECT 4 -#define MM_RECTANGULAR_X_SELECT 5 -#define MM_MOVE 10 -#define MM_MAGNIFIER 20 -#define MM_FISHEYE_MAGNIFIER 21*/ - - - if ((view->mouse.t==glMouseLeftButton)&&(view->keymap.down) && (view->keymap.keyVal == B_LSHIFT/*left shift*/) && (view->active_camera==-1)) - return MM_FISHEYE_MAGNIFIER; - if ((view->mouse.t==glMouseLeftButton)&&(view->keymap.down) && (view->keymap.keyVal == B_LSHIFT/*left shift*/) && (view->active_camera>-1)) - return MM_ROTATE; - if ((view->mouse.t==glMouseLeftButton)&&(view->keymap.down) && (view->keymap.keyVal == B_LCTRL/*left CTRL*/)) - return MM_MOVE; - if ((view->mouse.t==glMouseLeftButton)&&(view->mouse.down) ) - return MM_PAN; - - - - } void appmouse_left_click_up(ViewInfo* v,int x,int y) { @@ -135,32 +135,11 @@ void appmouse_left_click_up(ViewInfo* v,int x,int y) appmouse_up(v,x,y); /* if (v->mouse.mouse_mode == MM_MOVE) move_TVnodes();*/ - if ((a== MM_FISHEYE_MAGNIFIER) || (a == MM_MAGNIFIER)) //fisheye mag mouse release, stop distortion - originate_distorded_coordinates(v->Topview); - - } void appmouse_left_drag(ViewInfo* v,int x,int y) { - int a=get_mode(v); appmouse_drag(v,x,y); - if (a==MM_ROTATE) - - { - view->arcball->MousePt.s.X = (GLfloat) x; - view->arcball->MousePt.s.Y = (GLfloat) y; - if (!view->arcball->isDragging) { - arcmouseClick(view); - view->arcball->isDragging = 1; - } else - arcmouseDrag(view); - return; - } - if (a==MM_PAN) - glmotion_pan(v); - if (a==MM_MOVE) - move_TVnodes(); } diff --git a/cmd/smyrna/gui/appmouse.h b/cmd/smyrna/gui/appmouse.h index acfda104f..0d6490f79 100644 --- a/cmd/smyrna/gui/appmouse.h +++ b/cmd/smyrna/gui/appmouse.h @@ -24,6 +24,4 @@ extern void appmouse_left_drag(ViewInfo* v,int x,int y); extern void appmouse_right_click_down(ViewInfo* v,int x,int y); extern void appmouse_right_click_up(ViewInfo* v,int x,int y); extern void appmouse_right_drag(ViewInfo* v,int x,int y); -extern int get_mode(ViewInfo* v); - #endif diff --git a/cmd/smyrna/gui/glcompui.c b/cmd/smyrna/gui/glcompui.c index 6981c6791..9ab4935a3 100644 --- a/cmd/smyrna/gui/glcompui.c +++ b/cmd/smyrna/gui/glcompui.c @@ -198,7 +198,7 @@ glCompSet *glcreate_gl_topview_menu(void) glCompColor c; s->common.callbacks.click = CBglCompMouseRightClick; - p = glCompPanelNew((glCompObj *) s, 25, 25, 53, 47); + p = glCompPanelNew((glCompObj *) s, 25, 25, 51, 47); p->common.align = glAlignLeft; p->common.data = 0; @@ -210,12 +210,37 @@ glCompSet *glcreate_gl_topview_menu(void) 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; - p = glCompPanelNew((glCompObj *) p, 1, 25, 80, 255); + p = glCompPanelNew((glCompObj *) p, 1, 325, 80, 180); p->common.align = glAlignTop; p->common.data = 0; p->common.borderWidth = 1; @@ -240,7 +265,6 @@ glCompSet *glcreate_gl_topview_menu(void) 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; @@ -248,12 +272,6 @@ glCompSet *glcreate_gl_topview_menu(void) b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, ""); glCompButtonAddPngGlyph(b, smyrnaPath("zoomout.png")); b->common.callbacks.click = menu_click_zoom_minus; - - y = y + off; - copy_glcomp_color(&c, &b->common.color); - - b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, ""); - glCompButtonAddPngGlyph(b, smyrnaPath("fit.png")); copy_glcomp_color(&c, &b->common.color); y = y + off; @@ -268,22 +286,7 @@ glCompSet *glcreate_gl_topview_menu(void) - y = y + off; - - - b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, ""); - glCompButtonAddPngGlyph(b, smyrnaPath("3D.png")); - b->common.callbacks.click = switch2D3D; - copy_glcomp_color(&c, &b->common.color); - to3DBtn = b; - - b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, ""); - glCompButtonAddPngGlyph(b, smyrnaPath("2D.png")); - b->common.callbacks.click = switch2D3D; - glCompButtonHide(b); - copy_glcomp_color(&c, &b->common.color); - to2DBtn = b; @@ -308,19 +311,6 @@ glCompSet *glcreate_gl_topview_menu(void) p->common.data = 0; p->common.color.A = 0; - /*switch to fisheye */ - b = glCompButtonNew((glCompObj *) p, 2, 1, 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, 2, 1, 42, 42, ""); - glCompButtonAddPngGlyph(b, smyrnaPath("no_fisheye.png")); - b->common.callbacks.click = menu_switch_to_fisheye; - b->common.visible = 0; - toNormal = b; diff --git a/cmd/smyrna/main.c b/cmd/smyrna/main.c index 052f27d07..e0c58bea5 100755 --- a/cmd/smyrna/main.c +++ b/cmd/smyrna/main.c @@ -218,6 +218,10 @@ int main(int argc, char *argv[]) // gladewidget = glade_xml_get_widget(xml, "vbox2"); gladewidget = glade_xml_get_widget(xml, "hbox11"); + gtk_widget_hide(glade_xml_get_widget(xml, "vbox13")); + gtk_widget_hide(glade_xml_get_widget(xml, "hbox7")); + + create_window(glconfig, gladewidget); change_cursor(GDK_TOP_LEFT_ARROW); diff --git a/cmd/smyrna/smyrna.vcproj b/cmd/smyrna/smyrna.vcproj index 5f436ac1f..bc7604d29 100644 --- a/cmd/smyrna/smyrna.vcproj +++ b/cmd/smyrna/smyrna.vcproj @@ -237,6 +237,10 @@ RelativePath=".\hier.h" > + + @@ -397,6 +401,10 @@ RelativePath=".\hier.c" > + + diff --git a/cmd/smyrna/smyrnadefs.h b/cmd/smyrna/smyrnadefs.h index 75d8c6844..7f74814cc 100644 --- a/cmd/smyrna/smyrnadefs.h +++ b/cmd/smyrna/smyrnadefs.h @@ -70,10 +70,6 @@ typedef struct _ArcBall_t ArcBall_t; #define MM_MAGNIFIER 20 #define MM_FISHEYE_MAGNIFIER 21 -#define B_LSHIFT 65505 -#define B_RSHIFT 65506 -#define B_LCTRL 65507 -#define B_RCTRL 65508 #define GLOBAL_Z_OFFSET 0.001 diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index 3f2b10086..3edbe7b1c 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -476,9 +476,6 @@ void preparetopview(Agraph_t * g, topview * t) t->picked_edge_count = 0; t->picked_edges = '\0'; - /*hide stupid console window */ - gtk_widget_hide(glade_xml_get_widget(xml, "vbox13")); - gtk_widget_hide(glade_xml_get_widget(xml, "hbox7")); /*create attribute list*/ t->attributes=load_attr_list(view->g[view->activeGraph]); t->filtered_attr_list=NULL; @@ -663,17 +660,17 @@ static int drawtopviewnodes(Agraph_t * g) zdepth = (float) Z_BACK_PLANE; if ((view->defaultnodeshape == 0)) { - glVertex3f(v->distorted_x - ddx, - v->distorted_y - ddy, v->distorted_z - ddz); + glVertex3f(v->distorted_x, + v->distorted_y, v->distorted_z); } else if (view->defaultnodeshape == 1) { if (v->size > 0) - drawCircle(v->distorted_x - ddx, v->distorted_y - ddy, + drawCircle(v->distorted_x , v->distorted_y , v->size * view->Topview->init_node_size, - v->distorted_z - ddz); + v->distorted_z ); else - drawCircle(v->distorted_x - ddx, v->distorted_y - ddy, + drawCircle(v->distorted_x , v->distorted_y, view->Topview->init_node_size, - v->distorted_z - ddz); + v->distorted_z); } } else { /* int a=1; */ @@ -823,7 +820,7 @@ void drawTopViewGraph(Agraph_t * g) drawtopviewedges(g); drawtopviewedgelabels(g); enddrawcycle(g); - draw_tv_xdot(view->Topview); + draw_tv_xdot(view->Topview); draw_node_hint_boxes(); if ((view->Selection.Active > 0) && (!view->SignalBlock)) { view->Selection.Active = 0; @@ -1318,7 +1315,7 @@ static void draw_xdot(xdot* x,float base_z) static void draw_tv_xdot(topview* t) { int j; - float basez=0; + float basez=0; draw_xdot(t->xDot,basez); basez= basez+0.01; for (j=0; j < t->Nodecount; j++) -- 2.40.0