enum {
SELECTION_CHANGED,
+ ZOOM_CHANGED,
+ POINTER_MOVED,
+ MODE_CHANGED,
LAST_SIGNAL
};
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");
}
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");
}
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),
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);