gegl r2680 - in trunk: . bin
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2680 - in trunk: . bin
- Date: Sat, 1 Nov 2008 16:57:43 +0000 (UTC)
Author: ok
Date: Sat Nov 1 16:57:43 2008
New Revision: 2680
URL: http://svn.gnome.org/viewvc/gegl?rev=2680&view=rev
Log:
* bin/gegl-view.c: (gegl_view_class_init), (button_press_event),
(button_release_event), (motion_notify_event): do zoom on middle
mouse, since the editor now uses right mouse button for a
context-menu.
Modified:
trunk/ChangeLog
trunk/bin/gegl-view.c
Modified: trunk/bin/gegl-view.c
==============================================================================
--- trunk/bin/gegl-view.c (original)
+++ trunk/bin/gegl-view.c Sat Nov 1 16:57:43 2008
@@ -88,6 +88,8 @@
GdkEventMotion *event);
static gboolean button_press_event (GtkWidget *widget,
GdkEventButton *event);
+static gboolean button_release_event (GtkWidget *widget,
+ GdkEventButton *event);
static gboolean expose_event (GtkWidget *widget,
GdkEventExpose *event);
@@ -104,6 +106,7 @@
widget_class->motion_notify_event = motion_notify_event;
widget_class->button_press_event = button_press_event;
+ widget_class->button_release_event = button_release_event;
widget_class->expose_event = expose_event;
g_object_class_install_property (gobject_class, PROP_X,
@@ -301,6 +304,7 @@
g_signal_emit (self, gegl_view_signals[DETECTED], 0, node, NULL, NULL);
}
+static gboolean drag_started = FALSE;
static gboolean
button_press_event (GtkWidget *widget,
@@ -336,10 +340,19 @@
}
}
+ drag_started = TRUE;
return TRUE;
}
static gboolean
+button_release_event (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ drag_started = FALSE;
+ return FALSE;
+}
+
+static gboolean
motion_notify_event (GtkWidget *widget,
GdkEventMotion *event)
{
@@ -348,6 +361,8 @@
gint x = event->x;
gint y = event->y;
+ if (drag_started)
+ {
if (event->state & GDK_BUTTON1_MASK)
{
gint diff_x = x - priv->prev_x;
@@ -361,40 +376,42 @@
g_object_notify (G_OBJECT (view), "x");
g_object_notify (G_OBJECT (view), "y");
}
- else if (event->state & GDK_BUTTON3_MASK)
+ else if (event->state & GDK_BUTTON2_MASK)
{
- gint diff = priv->prev_y - y;
- gint i;
-
- if (diff < 0)
- {
- for (i=0;i>diff;i--)
- {
- priv->scale /= 1.006;
- }
- }
- else
- {
- for (i=0;i<diff;i++)
- {
- priv->scale *= 1.006;
- }
- }
+ gint diff = priv->prev_y - y;
+ gint i;
- priv->x = (priv->start_buf_x - priv->screen_x / priv->scale) * priv->scale;
- priv->y = (priv->start_buf_y - priv->screen_y / priv->scale) * priv->scale;
+ if (diff < 0)
+ {
+ for (i=0;i>diff;i--)
+ {
+ priv->scale /= 1.006;
+ }
+ }
+ else
+ {
+ for (i=0;i<diff;i++)
+ {
+ priv->scale *= 1.006;
+ }
+ }
+
+ priv->x = (priv->start_buf_x - priv->screen_x / priv->scale) * priv->scale;
+ priv->y = (priv->start_buf_y - priv->screen_y / priv->scale) * priv->scale;
+
+ gtk_widget_queue_draw (GTK_WIDGET (view));
+
+ g_object_notify (G_OBJECT (view), "x");
+ g_object_notify (G_OBJECT (view), "y");
+ g_object_notify (G_OBJECT (view), "scale");
+ }
- gtk_widget_queue_draw (GTK_WIDGET (view));
+ priv->prev_x = x;
+ priv->prev_y = y;
- g_object_notify (G_OBJECT (view), "x");
- g_object_notify (G_OBJECT (view), "y");
- g_object_notify (G_OBJECT (view), "scale");
+ return TRUE;
}
-
- priv->prev_x = x;
- priv->prev_y = y;
-
- return TRUE;
+ return FALSE;
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]