[pitivi/ges] Show a vertical line to indicate clip snapping
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/ges] Show a vertical line to indicate clip snapping
- Date: Wed, 25 Apr 2012 22:08:03 +0000 (UTC)
commit 4c0abcb9843b98dd1c81fba2c460c525441fd283
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Wed Apr 25 12:34:44 2012 -0400
Show a vertical line to indicate clip snapping
Fixes bug #610217
pitivi/timeline/timeline.py | 23 +++++++++++++++++++++++
pitivi/timeline/track.py | 2 --
2 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index e51fa08..3c62108 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -204,10 +204,15 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable, Loggable):
fill_color_rgba=0x000000FF,
stroke_color_rgba=0xFFFFFFFF,
width=3)
+ self._snap_indicator = goocanvas.Rect(
+ parent=root, x=0, y=0, width=3, line_width=0.5,
+ fill_color_rgba=0x85c0e6FF,
+ stroke_color_rgba=0x294f95FF)
self.connect("size-allocate", self._size_allocate_cb)
root.connect("motion-notify-event", self._selectionDrag)
root.connect("button-press-event", self._selectionStart)
root.connect("button-release-event", self._selectionEnd)
+ self.connect("button-release-event", self._snapEndedCb)
self.height = (LAYER_HEIGHT_EXPANDED + TRACK_SPACING +
LAYER_SPACING) * 2
# add some padding for the horizontal scrollbar
@@ -377,6 +382,22 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable, Loggable):
def zoomChanged(self):
self.queue_draw()
+## snapping indicator
+ def _snapCb(self, unused_timeline, obj1, obj2, position):
+ """
+ Display or hide a snapping indicator line
+ """
+ if position == 0:
+ self._snapEndedCb()
+ else:
+ self.debug("Snapping indicator at", position)
+ self._snap_indicator.props.x = Zoomable.nsToPixel(position)
+ self._snap_indicator.props.height = self.height
+ self._snap_indicator.props.visibility = goocanvas.ITEM_VISIBLE
+
+ def _snapEndedCb(self, *args):
+ self._snap_indicator.props.visibility = goocanvas.ITEM_INVISIBLE
+
## settings callbacks
def _setSettings(self):
self.zoomChanged()
@@ -399,6 +420,8 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable, Loggable):
self._trackAddedCb(None, track)
self._timeline.connect("track-added", self._trackAddedCb)
self._timeline.connect("track-removed", self._trackRemovedCb)
+ self._timeline.connect("snapping-started", self._snapCb)
+ self._timeline.connect("snapping-ended", self._snapEndedCb)
self.zoomChanged()
def getTimeline(self):
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index 41c7e2a..39abd1a 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -366,8 +366,6 @@ class TrackObject(View, goocanvas.Group, Zoomable, Loggable):
self.timeline = timeline
self.namewidth = 0
self.nameheight = 0
- self.snapped_before = False
- self.snapped_after = False
self._element = None
self._settings = None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]