pitivi r1213 - in branches/SOC_2008_BLEWIS: . pitivi/ui



Author: blewis
Date: Tue Jul 22 21:06:57 2008
New Revision: 1213
URL: http://svn.gnome.org/viewvc/pitivi?rev=1213&view=rev

Log:
* pitivi/ui/complextimeline.py:
it is now impossible to stretch a source beyond its actual native
duration.


Modified:
   branches/SOC_2008_BLEWIS/ChangeLog
   branches/SOC_2008_BLEWIS/pitivi/ui/complextimeline.py

Modified: branches/SOC_2008_BLEWIS/pitivi/ui/complextimeline.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/ui/complextimeline.py	(original)
+++ branches/SOC_2008_BLEWIS/pitivi/ui/complextimeline.py	Tue Jul 22 21:06:57 2008
@@ -263,8 +263,14 @@
     def _trim_source_start_cb(self, item, pos):
         element = item.element
         cur_end = element.start + element.duration
-        new_start = min(cur_end, max(0,
-            self.canvas.snap_time_to_edit(self.pixel_to_ns(pos[0]))))
+        # Invariant:
+        #  max(duration) = element.factory.getDuration()
+        #  start = end - duration
+        # Therefore
+        #  min(start) = end - element.factory.getDuration()
+        new_start =  max(0,
+            cur_end - element.factory.getDuration(), 
+            self.canvas.snap_time_to_edit(self.pixel_to_ns(pos[0])))
         new_duration = cur_end - new_start
         new_media_start = element.media_start + (new_start - element.media_start)
         element.setStartDurationTime(new_start, new_duration)
@@ -274,8 +280,10 @@
     def _trim_source_end_cb(self, item, pos):
         element = item.element
         cur_start = element.start
-        new_end = max(cur_start, self.canvas.snap_time_to_edit(
-            self.pixel_to_ns(pos[0] + width(item))))
+        new_end = min(cur_start + element.factory.getDuration(),
+            max(cur_start, 
+                self.canvas.snap_time_to_edit(
+                    self.pixel_to_ns(pos[0] + width(item)))))
         new_duration = new_end - element.start
 
         element.setStartDurationTime(gst.CLOCK_TIME_NONE, new_duration)



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