From: Jim Evins Date: Fri, 20 Sep 2002 18:14:07 +0000 (+0000) Subject: Added additional signals to view object to support a status bar in future releases. X-Git-Tag: glabels-2_3_0~758 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=eb61824324658f2711ae5c832a5ec954913c990c;p=glabels Added additional signals to view object to support a status bar in future releases. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@127 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/src/marshal.list b/glabels2/src/marshal.list index 9a1941c1..333c5af4 100644 --- a/glabels2/src/marshal.list +++ b/glabels2/src/marshal.list @@ -2,5 +2,7 @@ VOID:VOID VOID:BOOLEAN VOID:INT VOID:INT,INT +VOID:DOUBLE VOID:DOUBLE,DOUBLE +VOID:STRING BOOLEAN:OBJECT diff --git a/glabels2/src/view.c b/glabels2/src/view.c index 9f3e36af..a3eb8e83 100644 --- a/glabels2/src/view.c +++ b/glabels2/src/view.c @@ -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), diff --git a/glabels2/src/view.h b/glabels2/src/view.h index cc4ac22e..4ad4a094 100644 --- a/glabels2/src/view.h +++ b/glabels2/src/view.h @@ -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);