pitivi r1396 - in trunk/pitivi: timeline ui
- From: edwardrv svn gnome org
- To: svn-commits-list gnome org
- Subject: pitivi r1396 - in trunk/pitivi: timeline ui
- Date: Fri, 28 Nov 2008 17:35:04 +0000 (UTC)
Author: edwardrv
Date: Fri Nov 28 17:35:04 2008
New Revision: 1396
URL: http://svn.gnome.org/viewvc/pitivi?rev=1396&view=rev
Log:
simplified selection interface, added multi-selection, controllers have access to modifier keys, and TimelineController specifies selection mode with modifier keys
Modified:
trunk/pitivi/timeline/timeline.py
trunk/pitivi/ui/controller.py
trunk/pitivi/ui/timelineobject.py
Modified: trunk/pitivi/timeline/timeline.py
==============================================================================
--- trunk/pitivi/timeline/timeline.py (original)
+++ trunk/pitivi/timeline/timeline.py Fri Nov 28 17:35:04 2008
@@ -150,25 +150,24 @@
__selection = None
- def addToSelection(self, objs):
- self.__selection.update(objs)
- for obj in objs:
- obj.selected = True
-
- def removeFromSelection(self, objs):
- self.__selection.difference_update(objs)
- for obj in objs:
- obj.selected = False
+ def setSelectionTo(self, objs, mode=0):
+ if mode == 1:
+ objs |= self.__selection
+ if mode == 2:
+ objs ^= self.__selection
- def setSelectionTo(self, objs):
for obj in self.__selection:
obj.selected = False
for obj in objs:
obj.selected = True
self.__selection = objs
- def setSelectionToObj(self, obj):
- self.setSelectionTo(set((obj,)))
+ def setSelectionToObj(self, obj, mode=0):
+ #TODO: range selection
+ # sort all objects by increasing (start, end)
+ # choose the slice from [last(selection) : obj]
+ # or [obj: first(selection]
+ self.setSelectionTo(set((obj,)), mode)
def deleteSelection(self):
for obj in self.__selection:
Modified: trunk/pitivi/ui/controller.py
==============================================================================
--- trunk/pitivi/ui/controller.py (original)
+++ trunk/pitivi/ui/controller.py Fri Nov 28 17:35:04 2008
@@ -25,6 +25,7 @@
_ptr_within = False
_last_click = None
_mousedown = None
+ _last_event = None
def __init__(self, view=None):
object.__init__(self)
@@ -48,6 +49,7 @@
@handler(_view, "enter_notify_event")
def enter_notify_event(self, item, target, event):
+ self._last_event = event
if self._cursor:
event.window.set_cursor(self._cursor)
self.enter(item, target)
@@ -56,6 +58,7 @@
@handler(_view, "leave_notify_event")
def leave_notify_event(self, item, target, event):
+ self._last_event = event
self._ptr_within = False
if not self._dragging:
self.leave(item, target)
@@ -63,6 +66,7 @@
@handler(_view, "button_press_event")
def button_press_event(self, item, target, event):
+ self._last_event = event
if not self._canvas:
self._canvas = item.get_canvas()
self._mousedown = self.pos(item) - self.transform(self.from_item_event(
@@ -73,6 +77,7 @@
@handler(_view, "motion_notify_event")
def motion_notify_event(self, item, target, event):
+ self._last_event = event
if self._dragging:
self.set_pos(self._dragging,
self.transform(self._mousedown + self.from_item_event(item,
@@ -82,6 +87,7 @@
@handler(_view, "button_release_event")
def button_release_event(self, item, target, event):
+ self._last_event = event
self._drag_end(item, self._dragging, event)
self._dragging = None
return True
Modified: trunk/pitivi/ui/timelineobject.py
==============================================================================
--- trunk/pitivi/ui/timelineobject.py (original)
+++ trunk/pitivi/ui/timelineobject.py Fri Nov 28 17:35:04 2008
@@ -28,10 +28,6 @@
self._view.element.snapStartDurationTime(max(
self._view.pixelToNs(pos[0]), 0))
- def click(self, pos):
- instance.PiTiVi.current.timeline.setSelectionToObj(
- self._view.element)
-
class TrimHandle(View, goocanvas.Rect, Zoomable):
"""A component of a TimelineObject which manage's the source's edit
@@ -81,7 +77,16 @@
__NORMAL__ = 0x709fb899
__SELECTED__ = 0xa6cee3AA
- Controller = TimelineController
+ class Controller(TimelineController):
+
+ def click(self, pos):
+ mode = 0
+ if self._last_event.get_state() & gtk.gdk.SHIFT_MASK:
+ mode = 1
+ elif self._last_event.get_state() & gtk.gdk.CONTROL_MASK:
+ mode = 2
+ instance.PiTiVi.current.timeline.setSelectionToObj(
+ self._view.element, mode)
def __init__(self, element, composition):
goocanvas.Group.__init__(self)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]