[pitivi: 4/12] ui.trackobject.py: fix SHIFT/CONTROL + click:



commit 90c9ef73fc588fd91260c875580826e20bf5b202
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Wed Nov 25 10:49:05 2009 -0800

    ui.trackobject.py: fix SHIFT/CONTROL + click:
    SHIFT + click selects rectangular area
    CONTROL + toggles selected state
    closes bugs 590784 and 587378

 pitivi/ui/trackobject.py |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/ui/trackobject.py b/pitivi/ui/trackobject.py
index 81504a1..7f37924 100644
--- a/pitivi/ui/trackobject.py
+++ b/pitivi/ui/trackobject.py
@@ -13,7 +13,7 @@ import controller
 from zoominterface import Zoomable
 from pitivi.timeline.track import TrackError
 from pitivi.timeline.timeline import SELECT, SELECT_ADD, UNSELECT, \
-    MoveContext, TrimStartContext, TrimEndContext
+    SELECT_BETWEEN, MoveContext, TrimStartContext, TrimEndContext
 from preview import Preview
 from pitivi.ui.curve import Curve
 import gst
@@ -218,16 +218,21 @@ class TrackObject(View, goocanvas.Group, Zoomable):
             return self._context.DEFAULT
 
         def click(self, pos):
-            mode = SELECT
+            timeline = self._view.timeline
+            element = self._view.element
+            element_end = element.start + element.duration
             if self._last_event.get_state() & gtk.gdk.SHIFT_MASK:
-                mode = SELECT_ADD
+                timeline.setSelectionToObj(element, SELECT_BETWEEN)
             elif self._last_event.get_state() & gtk.gdk.CONTROL_MASK:
-                mode = UNSELECT
+                if element.selected:
+                    mode = UNSELECT
+                else:
+                    mode = SELECT_ADD
+                timeline.setSelectionToObj(element, mode)
             else:
                 self._view.app.current.pipeline.seek(
                     Zoomable.pixelToNs(pos[0]))
-            self._view.timeline.setSelectionToObj(
-                self._view.element, mode)
+                timeline.setSelectionToObj(element, SELECT)
 
     def __init__(self, instance, element, track, timeline):
         goocanvas.Group.__init__(self)



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