[pitivi/ges] Make the timeline ruler's scroll behavior match with the canvas



commit 7a43698479adfaeaeda28d989cecae376f3f5afe
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Thu Apr 26 16:00:48 2012 -0400

    Make the timeline ruler's scroll behavior match with the canvas
    
    Fixes bug #582648

 pitivi/timeline/ruler.py |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/pitivi/timeline/ruler.py b/pitivi/timeline/ruler.py
index ec400bf..3928154 100644
--- a/pitivi/timeline/ruler.py
+++ b/pitivi/timeline/ruler.py
@@ -156,19 +156,24 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
         return False
 
     def do_scroll_event(self, event):
-        if event.direction == gtk.gdk.SCROLL_UP:
-            Zoomable.zoomIn()
-            self.log("Setting 'zoomed_fitted' to False")
-            self.app.gui.zoomed_fitted = False
-        elif event.direction == gtk.gdk.SCROLL_DOWN:
-            Zoomable.zoomOut()
-            self.log("Setting 'zoomed_fitted' to False")
-            self.app.gui.zoomed_fitted = False
-        # TODO: seek timeline back/forward
-        elif event.direction == gtk.gdk.SCROLL_LEFT:
-            pass
-        elif event.direction == gtk.gdk.SCROLL_RIGHT:
-            pass
+        if event.state & gtk.gdk.CONTROL_MASK:
+            # Control + scroll = zoom
+            if event.direction == gtk.gdk.SCROLL_UP:
+                Zoomable.zoomIn()
+                self.log("Setting 'zoomed_fitted' to False")
+                self.app.gui.zoomed_fitted = False
+            elif event.direction == gtk.gdk.SCROLL_DOWN:
+                Zoomable.zoomOut()
+                self.log("Setting 'zoomed_fitted' to False")
+                self.app.gui.zoomed_fitted = False
+        else:
+            # No modifier key held down, just scroll
+            if event.direction == gtk.gdk.SCROLL_UP or\
+                event.direction == gtk.gdk.SCROLL_LEFT:
+                self.app.gui.timeline_ui.scroll_left()
+            elif event.direction == gtk.gdk.SCROLL_DOWN or\
+                event.direction == gtk.gdk.SCROLL_RIGHT:
+                self.app.gui.timeline_ui.scroll_right()
 
 ## Drawing methods
 



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