[gimp/wip/animation: 88/197] plug-ins: allow zooming in/out with ctrl-scroll up/down.



commit 5fbd2fea076c4f587a7877bc9fe0f14b91fcdaae
Author: Jehan <jehan girinstud io>
Date:   Sun Nov 13 16:29:40 2016 +0100

    plug-ins: allow zooming in/out with ctrl-scroll up/down.

 plug-ins/animation-play/widgets/animation-dialog.c |   32 ++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/animation-play/widgets/animation-dialog.c 
b/plug-ins/animation-play/widgets/animation-dialog.c
index 6589ce6..8b06e3d 100755
--- a/plug-ins/animation-play/widgets/animation-dialog.c
+++ b/plug-ins/animation-play/widgets/animation-dialog.c
@@ -228,6 +228,9 @@ static gboolean    repaint_da                (GtkWidget        *darea,
 static gboolean    da_button_press           (GtkWidget        *widget,
                                               GdkEventButton   *event,
                                               AnimationDialog  *dialog);
+static gboolean    da_scrolled               (GtkWidget        *widget,
+                                              GdkEventScroll   *event,
+                                              AnimationDialog  *dialog);
 static void        da_size_callback          (GtkWidget        *widget,
                                               GtkAllocation    *allocation,
                                               AnimationDialog  *dialog);
@@ -655,6 +658,9 @@ animation_dialog_constructed (GObject *object)
   g_signal_connect (priv->drawing_area, "button-press-event",
                     G_CALLBACK (da_button_press),
                     dialog);
+  g_signal_connect (priv->drawing_area, "scroll-event",
+                    G_CALLBACK (da_scrolled),
+                    dialog);
 
   /*****************/
   /* Play toolbar. */
@@ -803,6 +809,9 @@ animation_dialog_constructed (GObject *object)
   g_signal_connect (priv->shape_drawing_area, "size-allocate",
                     G_CALLBACK(da_size_callback),
                     dialog);
+  g_signal_connect (priv->shape_drawing_area, "scroll-event",
+                    G_CALLBACK (da_scrolled),
+                    dialog);
   g_signal_connect (priv->shape_window, "button-press-event",
                     G_CALLBACK (shape_pressed),
                     dialog);
@@ -2197,6 +2206,29 @@ da_button_press (GtkWidget       *widget,
   return FALSE;
 }
 
+static gboolean
+da_scrolled (GtkWidget       *widget,
+             GdkEventScroll  *event,
+             AnimationDialog *dialog)
+{
+  if (event->state & GDK_CONTROL_MASK)
+    {
+      switch (event->direction)
+        {
+        case GDK_SCROLL_DOWN:
+          zoom_out_callback (NULL, dialog);
+          break;
+        case GDK_SCROLL_UP:
+          zoom_in_callback (NULL, dialog);
+          break;
+        default:
+          break;
+        }
+      return TRUE;
+    }
+  return FALSE;
+}
+
 /*
  * Update the actual drawing area metrics, which may be different from
  * requested, since there is no full control of the WM.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]