]> git.sur5r.net Git - glabels/commitdiff
Added additional signals to view object to support a status bar in future releases.
authorJim Evins <evins@snaught.com>
Fri, 20 Sep 2002 18:14:07 +0000 (18:14 +0000)
committerJim Evins <evins@snaught.com>
Fri, 20 Sep 2002 18:14:07 +0000 (18:14 +0000)
git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@127 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/src/marshal.list
glabels2/src/view.c
glabels2/src/view.h

index 9a1941c16a1fe30434fa7f455de3816d2a3f3c32..333c5af41afb55f981dd474ed11799c55ace1e97 100644 (file)
@@ -2,5 +2,7 @@ VOID:VOID
 VOID:BOOLEAN
 VOID:INT
 VOID:INT,INT
+VOID:DOUBLE
 VOID:DOUBLE,DOUBLE
+VOID:STRING
 BOOLEAN:OBJECT
index 9f3e36af460cc868d6a89b0cd3f4536fb9ac0596..a3eb8e83ae0050e49a3d41bbc60ba41204ffdb77 100644 (file)
@@ -55,6 +55,9 @@
 
 enum {
        SELECTION_CHANGED,
+       ZOOM_CHANGED,
+       POINTER_MOVED,
+       MODE_CHANGED,
        LAST_SIGNAL
 };
 
@@ -206,6 +209,36 @@ gl_view_class_init (glViewClass *class)
                              G_TYPE_NONE,
                              0);
 
+       signals[ZOOM_CHANGED] =
+               g_signal_new ("zoom_changed",
+                             G_OBJECT_CLASS_TYPE (object_class),
+                             G_SIGNAL_RUN_LAST,
+                             G_STRUCT_OFFSET (glViewClass, zoom_changed),
+                             NULL, NULL,
+                             gl_marshal_VOID__DOUBLE,
+                             G_TYPE_NONE,
+                             1, G_TYPE_DOUBLE);
+
+       signals[POINTER_MOVED] =
+               g_signal_new ("pointer_moved",
+                             G_OBJECT_CLASS_TYPE (object_class),
+                             G_SIGNAL_RUN_LAST,
+                             G_STRUCT_OFFSET (glViewClass, pointer_moved),
+                             NULL, NULL,
+                             gl_marshal_VOID__DOUBLE_DOUBLE,
+                             G_TYPE_NONE,
+                             2, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
+
+       signals[MODE_CHANGED] =
+               g_signal_new ("mode_changed",
+                             G_OBJECT_CLASS_TYPE (object_class),
+                             G_SIGNAL_RUN_LAST,
+                             G_STRUCT_OFFSET (glViewClass, mode_changed),
+                             NULL, NULL,
+                             gl_marshal_VOID__STRING,
+                             G_TYPE_NONE,
+                             1, G_TYPE_STRING);
+
        gl_debug (DEBUG_VIEW, "END");
 }
 
@@ -1648,6 +1681,8 @@ gl_view_set_zoom (glView  *view,
        gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (view->canvas),
                                          scale * HOME_SCALE);
 
+       g_signal_emit (G_OBJECT(view), signals[ZOOM_CHANGED], 0, scale);
+
        gl_debug (DEBUG_VIEW, "END");
 }
 
@@ -1814,11 +1849,11 @@ canvas_event_arrow_mode (GnomeCanvas *canvas,
 
        case GDK_MOTION_NOTIFY:
                gl_debug (DEBUG_VIEW, "MOTION_NOTIFY");
+               gnome_canvas_window_to_world (canvas,
+                                             event->motion.x,
+                                             event->motion.y, &x, &y);
+               g_signal_emit (G_OBJECT(view), signals[ZOOM_CHANGED], 0, x, y);
                if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) {
-                       gnome_canvas_window_to_world (canvas,
-                                                     event->button.x,
-                                                     event->button.y, &x, &y);
-
                        gnome_canvas_item_set (item,
                                               "x1", MIN (x, x0),
                                               "y1", MIN (y, y0),
index cc4ac22ed7de4f68c82f5bf256bffe9e1e60803f..4ad4a09439db4df3ebafb75a1ed3d10fa44f4f3a 100644 (file)
@@ -73,7 +73,16 @@ struct _glView {
 struct _glViewClass {
        GtkVBoxClass      parent_class;
 
+       /* Selection changed signal */
        void (*selection_changed) (glView *view, gpointer user_data);
+
+       /* Signals to support a status bar */
+       void (*zoom_changed)      (glView *view,
+                                  gdouble zoom,  gpointer user_data);
+       void (*pointer_moved)     (glView *view,
+                                  gdouble x, gdouble y, gpointer user_data);
+       void (*mode_changed)      (glView *view,
+                                  gchar *modeline, gpointer user_data);
 };
 
 extern guint     gl_view_get_type           (void);