]> granicus.if.org Git - graphviz/commitdiff
middle button bug fixed
authorarif <devnull@localhost>
Tue, 10 Nov 2009 16:39:40 +0000 (16:39 +0000)
committerarif <devnull@localhost>
Tue, 10 Nov 2009 16:39:40 +0000 (16:39 +0000)
cmd/smyrna/gltemplate.c
cmd/smyrna/gui/appmouse.c
cmd/smyrna/gui/appmouse.h
cmd/smyrna/gui/beacon.c

index adc2cf09e3b887a8898bb415c87ed94230e54263..fb4d21ea50dca581d7a9ac049ecee581e5277b95 100755 (executable)
@@ -41,9 +41,13 @@ static glMouseButtonType getGlCompMouseType(int n)
     switch (n) {
     case 1:
        return glMouseLeftButton;
+    case 2:
+       return glMouseMiddleButton;
     case 3:
-    default:
        return glMouseRightButton;
+
+    default:
+       return glMouseLeftButton;
     }
 }
 
@@ -280,6 +284,9 @@ static gboolean button_press_event(GtkWidget * widget,
 
     if (event->button == 3)    //right click
        appmouse_right_click_down(view,(int) event->x,(int) event->y);
+    if (event->button == 2)    //middle click
+       appmouse_middle_click_down(view,(int) event->x,(int) event->y);
+
     expose_event(view->drawing_area, NULL, NULL);
     return FALSE;
 }
@@ -301,9 +308,13 @@ static gboolean button_release_event(GtkWidget * widget,
        appmouse_left_click_up(view,(int) event->x,(int) event->y);
     if (event->button == 3)    //right click
        appmouse_right_click_up(view,(int) event->x,(int) event->y);
+    if (event->button == 2)    //right click
+       appmouse_middle_click_up(view,(int) event->x,(int) event->y);
+
     expose_event(view->drawing_area, NULL, NULL);
     dx = 0.0;
     dy = 0.0;
+
     return FALSE;
 }
 static gboolean key_press_event(GtkWidget * widget, GdkEventKey * event, gpointer data)
@@ -311,7 +322,6 @@ static gboolean key_press_event(GtkWidget * widget, GdkEventKey * event, gpointe
     view->keymap.down=1;
     view->keymap.keyVal=event->keyval;
 
-//    printf ("key is pressed:%d\n",event->keyval);
 
 }
 static gboolean key_release_event(GtkWidget * widget, GdkEventKey * event, gpointer data)
@@ -374,6 +384,11 @@ static gboolean motion_notify_event(GtkWidget * widget,
        appmouse_right_drag(view,(int)event->x,(int)event->y);
        redraw = TRUE;
     }
+    if((view->mouse.t==glMouseMiddleButton) && (view->mouse.down))
+    {
+       appmouse_middle_drag(view,(int)event->x,(int)event->y);
+       redraw = TRUE;
+    }
 
 
 
index eb63b0d87e8831972e5876cc1c1021ec8cfa1b4b..1d7146735a43db0769115669a0307604b699b703 100644 (file)
@@ -107,8 +107,8 @@ static void appmouse_down(ViewInfo* v,int x,int y)
     prevX=0;
     prevY=0;
 
-
-
+    view->Selection.X = view->mouse.GLpos.x;
+    view->Selection.Y = view->mouse.GLpos.y;
 }
 static void appmouse_up(ViewInfo* v,int x,int y)
 {
@@ -172,8 +172,6 @@ void appmouse_right_click_down(ViewInfo* v,int x,int y)
     v->mouse.t=glMouseRightButton;
     appmouse_down(v,x,y);
 
-    view->Selection.X = view->mouse.GLpos.x;
-    view->Selection.Y = view->mouse.GLpos.y;
 
 }
 void appmouse_right_click_up(ViewInfo* v,int x,int y)
@@ -189,4 +187,22 @@ void appmouse_right_drag(ViewInfo* v,int x,int y)
 }
 
 
+void appmouse_middle_click_down(ViewInfo* v,int x,int y)
+{
+    v->mouse.t=glMouseMiddleButton;
+    appmouse_down(v,x,y);
+
+
+}
+void appmouse_middle_click_up(ViewInfo* v,int x,int y)
+{
+    appmouse_up(v,x,y);
+}
+void appmouse_middle_drag(ViewInfo* v,int x,int y)
+{
+        
+    appmouse_drag(v,x,y);
+
+}
 
index 0d6490f79543604d978bb5aba0b2d73fcad4ae5d..446a33521116d6238c939be961bad6614c131a6d 100644 (file)
 extern void appmouse_left_click_down(ViewInfo* v,int x,int y);
 extern void appmouse_left_click_up(ViewInfo* v,int x,int y);
 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 void appmouse_middle_click_down(ViewInfo* v,int x,int y);
+extern void appmouse_middle_click_up(ViewInfo* v,int x,int y);
+extern void appmouse_middle_drag(ViewInfo* v,int x,int y);
+
+
 #endif
index 78ebab90a1ca68d9750b7bc5281938bc76872e07..8f7cac6f951b3fc947dbb69db5b1dcd5da9e6f16 100644 (file)
@@ -1,4 +1,3 @@
-/* $Id$Revision: */
 /* vim:set shiftwidth=4 ts=8: */
 
 /**********************************************************
@@ -221,7 +220,7 @@ static void print_node(topview_node * n)
            val=agget(n->Node,l->attributes[ind]->name);
            if (val)
            {
-               printf("%s: %s\n",l->attributes[ind]->name,val);
+               printf("%s:%s\n",l->attributes[ind]->name,val);
 
            }
        }