[pitivi] Update the stage size when dragging objects



commit b5704b0d35f8e157f8813f624edbcee70c35316b
Author: Mathieu Duponchelle <mathieu duponchelle epitech eu>
Date:   Thu Apr 18 05:25:24 2013 +0200

    Update the stage size when dragging objects

 pitivi/timeline/elements.py |    3 +++
 pitivi/timeline/timeline.py |    6 +++++-
 2 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 8745703..96c2701 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -560,6 +560,7 @@ class URISourceElement(TimelineElement):
         # 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
@@ -577,6 +578,8 @@ class URISourceElement(TimelineElement):
             self._context.editTo(new_start, self.bElement.get_parent().get_layer().get_priority())
         else:
             self._context.editTo(self._dragBeginStart, self.bElement.get_parent().get_layer().get_priority())
+
+        self.timeline._updateSize(self.ghostclip)
         return False
 
     def _dragEndCb(self, action, actor, event_x, event_y, modifiers):
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index ad7d7f5..a6c02ff 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -244,6 +244,7 @@ class TimelineStage(Clutter.ScrollActor, Zoomable):
                     ghostclip.update(priority, y, False)
                     if x >= 0:
                         ghostclip.props.x = x
+                        self._updateSize(ghostclip)
 
     def convertGhostClips(self):
         for ghostCouple in self.ghostClips:
@@ -383,10 +384,13 @@ class TimelineStage(Clutter.ScrollActor, Zoomable):
         element.props.y = y
         element.restore_easing_state()
 
-    def _updateSize(self):
+    def _updateSize(self, ghostclip=None):
         self.save_easing_state()
         self.set_easing_duration(0)
         self.props.width = self.nsToPixel(self.bTimeline.get_duration()) + 250
+        if ghostclip is not None:
+            ghostEnd = ghostclip.props.x + ghostclip.props.width + 250
+            self.props.width = max(ghostEnd, self.props.width)
         self.props.height = (len(self.bTimeline.get_layers()) + 1) * (EXPANDED_SIZE + SPACING) * 2 + SPACING
         self.restore_easing_state()
         self._container.vadj.props.upper = self.props.height


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