[ocrfeeder] Add zoom control from mouse wheel



commit 9ef02bb502a9ac5e38ded18374f8716fdad4ab32
Author: Joaquim Rocha <jrocha igalia com>
Date:   Fri Mar 5 17:32:30 2010 +0100

    Add zoom control from mouse wheel

 studio/customWidgets.py |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/studio/customWidgets.py b/studio/customWidgets.py
index 73d3481..c55b8b2 100644
--- a/studio/customWidgets.py
+++ b/studio/customWidgets.py
@@ -68,6 +68,7 @@ class SelectableBoxesArea(goocanvas.Canvas):
         self.image.connect('button_release_event', self.endSelectionArea)
         self.image.connect('motion_notify_event', self.updateSelectionArea)
         self.image.connect('key_press_event', self.pressedKeyOnImage)
+        self.connect('scroll-event', self.scrollEventCb)
         self.selected_area = None
         self.currently_created_area = None
     
@@ -271,6 +272,15 @@ class SelectableBoxesArea(goocanvas.Canvas):
                 item.props.y = self.image.props.height - item.props.height
             self.emit('dragged_box', item)
     
+    def scrollEventCb(self, widget, event):
+        if event.state == gtk.gdk.CONTROL_MASK:
+            if event.direction == gtk.gdk.SCROLL_UP or \
+               event.direction == gtk.gdk.SCROLL_RIGHT:
+                self.zoom(0.05)
+            elif event.direction == gtk.gdk.SCROLL_DOWN or \
+                 event.direction == gtk.gdk.SCROLL_LEFT:
+                self.zoom(-0.05)
+    
     def setAreaFillRgba(self, rgba):
         self.area_fill_rgba = rgba
     



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