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



Author: blewis
Date: Mon Jul 28 17:12:00 2008
New Revision: 1223
URL: http://svn.gnome.org/viewvc/pitivi?rev=1223&view=rev

Log:
* pitivi/ui/complextimeline.py:
when splitting clips, setMediaStartDuration is called before
setStartDuration.
zoom controls now use discrete zoom values specified in list


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	Mon Jul 28 17:12:00 2008
@@ -553,16 +553,16 @@
         b_media_start = a_media_start + a_dur
 
         # trim source a
-        element.setStartDurationTime(a_start, a_dur)
         element.setMediaStartDurationTime(a_media_start, a_dur)
+        element.setStartDurationTime(a_start, a_dur)
 
         # add source b
         # TODO: for linked sources, split linked and create brother
         # TODO: handle other kinds of sources
         new = TimelineFileSource(factory=element.factory,
             media_type=comp.media_type)
-        new.setStartDurationTime(b_start, b_dur)
         new.setMediaStartDurationTime(b_media_start, b_dur)
+        new.setStartDurationTime(b_start, b_dur)
         comp.addSource(new, 0, True)
 
     def selectBeforeCurrent(self, unused_action):
@@ -654,14 +654,21 @@
 
 class ComplexTimelineWidget(gtk.VBox):
 
+    # the screen width of the current unit
+    unit_width = 10 
+    # specific levels of zoom, in (multiplier, unit) pairs which 
+    # from zoomed out to zoomed in
+    zoom_levels = (1, 5, 10, 20, 50, 100, 150) 
+
     def __init__(self):
         gst.log("Creating ComplexTimelineWidget")
         gtk.VBox.__init__(self)
 
         self._zoom_adj = gtk.Adjustment()
-        self._zoom_adj.lower = 0.1
-        self._zoom_adj.upper = 1000
-        self._zoom_adj.set_value(10)
+        self._zoom_adj.lower = self._computeZoomRatio(0)
+        self._zoom_adj.upper = self._computeZoomRatio(-1)
+        self._cur_zoom = 2
+        self._zoom_adj.set_value(self._computeZoomRatio(self._cur_zoom))
  
         # common LayerInfoList
         self.layerInfoList = LayerInfoList()
@@ -747,13 +754,16 @@
         self.actiongroup.set_visible(False)
         super(ComplexTimelineWidget, self).hide()
 
-    def _zoomOutCb(self, unused_action):
-        r = self._zoom_adj.get_value() * 0.5
-        self._zoom_adj.set_value(r)
+    def _computeZoomRatio(self, index):
+        return self.zoom_levels[index]
 
     def _zoomInCb(self, unused_action):
-        r = self._zoom_adj.get_value() * 2
-        self._zoom_adj.set_value(r)
+        self._cur_zoom = min(len(self.zoom_levels) - 1, self._cur_zoom + 1)
+        self._zoom_adj.set_value(self._computeZoomRatio(self._cur_zoom))
+
+    def _zoomOutCb(self, unused_action):
+        self._cur_zoom = max(0, self._cur_zoom - 1)
+        self._zoom_adj.set_value(self._computeZoomRatio(self._cur_zoom))
 
 ## PlayGround timeline position callback
 



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