[pitivi] effects: make trimming possible in any case for effects



commit 4db5b9243b9900b2795de0bc31721f5c1c759731
Author: Thibault Saunier <thibault saunier collabora co uk>
Date:   Mon May 30 13:20:54 2011 -0400

    effects: make trimming possible in any case for effects
    
    Inpoint of effects doesn't matter since effects are operations that are always
    equal independently of the time, so when we want to trim the start of an effect,
    we should just make it possible, and not care about the inpoint of the effect.

 pitivi/timeline/track.py |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index 27339b1..f5bce4e 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -571,15 +571,21 @@ class TrackObject(Signallable, Loggable):
         else:
             self.trimObjectStart(position)
 
-    def trimObjectStart(self, position):
+    def _getTrimInpointAndPosition(self, position):
         # clamp position to be inside the object
         position = max(self.start - self.in_point, position)
         position = min(position, self.start + self.duration)
-        new_duration = max(0, self.start + self.duration - position)
 
         delta = position - self.start
         in_point = self.in_point
         in_point += delta
+
+        return in_point, position
+
+    def trimObjectStart(self, position):
+        in_point, position = self._getTrimInpointAndPosition(position)
+        new_duration = max(0, self.start + self.duration - position)
+
         self.setObjectStart(position)
         self.setObjectDuration(new_duration)
         self.setObjectInPoint(in_point)
@@ -749,6 +755,11 @@ class TrackEffect(TrackObject):
         TrackEffect.numobjs += 1
         return effect
 
+    def _getTrimInpointAndPosition(self, position):
+        # Effect inpoint is meaningless, and we can resize theme
+        # as needed
+        return 0, position
+
     def copy(self):
         other = TrackObject.copy(self)
 



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