[pitivi] Re-enables edition modes



commit b861c5c4bd4bba4ba55a3d25154bd567b2302ade
Author: Mathieu Duponchelle <mathieu duponchelle epitech eu>
Date:   Thu Apr 18 05:04:32 2013 +0200

    Re-enables edition modes

 pitivi/timeline/elements.py |    7 +++++--
 pitivi/timeline/timeline.py |    9 +++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 0fe7737..9fa9ba6 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -261,10 +261,10 @@ class TrimHandle(Clutter.Texture):
         self.props.visible = isSelected
 
     def _dragBeginCb(self, action, actor, event_x, event_y, modifiers):
+        print "trim handle dragged"
         self.dragBeginStartX = event_x
         self.dragBeginStartY = event_y
         elem = self.timelineElement.bElement.get_parent()
-
         self.timelineElement.setDragged(True)
 
         if self.isLeft:
@@ -519,9 +519,10 @@ class URISourceElement(TimelineElement):
         self.timeline.selection.setToObj(self.bElement, SELECT)
 
     def _dragBeginCb(self, action, actor, event_x, event_y, modifiers):
+        mode = self.timeline._container.getEditionMode()
         self._context = EditingContext(self.bElement,
                                        self.timeline.bTimeline,
-                                       GES.EditMode.EDIT_NORMAL,
+                                       mode,
                                        GES.Edge.EDGE_NONE,
                                        self.timeline.selection.getSelectedTrackElements(),
                                        None)
@@ -544,6 +545,8 @@ class URISourceElement(TimelineElement):
 
     def _dragProgressCb(self, action, actor, delta_x, delta_y):
         # We can't use delta_x here because it fluctuates weirdly.
+        mode = self.timeline._container.getEditionMode()
+        self._context.setMode(mode)
         coords = self.dragAction.get_motion_coords()
         delta_x = coords[0] - self.dragBeginStartX
         delta_y = coords[1] - self.dragBeginStartY
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index f5125a8..ad7d7f5 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -615,11 +615,20 @@ class Timeline(Gtk.VBox, Zoomable):
         self.timeline.selection.connect("selection-changed", self._selectionChangedCb)
         self.timeline.setTimeline(bTimeline)
 
+    def getEditionMode(self, isAHandle=False):
+        if self.shiftMask or self.gui._autoripple_active:
+            return GES.EditMode.EDIT_RIPPLE
+        if isAHandle and self.controlMask:
+            return GES.EditMode.EDIT_ROLL
+        return GES.EditMode.EDIT_NORMAL
+
     # Internal API
 
     def _createUi(self):
         self.embed = GtkClutter.Embed()
         self.stage = self.embed.get_stage()
+        self.stage.set_size(200, 200)
+
         self.timeline = TimelineStage(self)
         self.controls = ControlContainer(self.timeline)
         self.zoomBox = ZoomBox(self)


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