[longomatch] Emit different events for camera and time nodes when they move.



commit 3d89b3e003324bd4928ab07ec277bb9b9130c672
Author: Julien Moutte <julien fluendo com>
Date:   Fri Mar 13 18:46:11 2015 +0100

    Emit different events for camera and time nodes when they move.

 LongoMatch.Drawing/Widgets/CamerasTimeline.cs |   31 +++++++++++++++++-------
 1 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/LongoMatch.Drawing/Widgets/CamerasTimeline.cs b/LongoMatch.Drawing/Widgets/CamerasTimeline.cs
index 65c18de..5c10064 100644
--- a/LongoMatch.Drawing/Widgets/CamerasTimeline.cs
+++ b/LongoMatch.Drawing/Widgets/CamerasTimeline.cs
@@ -28,6 +28,9 @@ namespace LongoMatch.Drawing.Widgets
 {
        public class CamerasTimeline: SelectionCanvas
        {
+               // For cameras
+               public event CameraDraggedHandler CameraDragged;
+               // And periods
                public event TimeNodeChangedHandler TimeNodeChanged;
                public event ShowTimerMenuHandler ShowTimerMenuEvent;
 
@@ -142,16 +145,26 @@ namespace LongoMatch.Drawing.Widgets
 
                protected override void SelectionMoved (Selection sel)
                {
-                       if (TimeNodeChanged != null) {
-                               Time moveTime;
-                               TimeNode tn = (sel.Drawable as TimeNodeObject).TimeNode;
-
-                               if (sel.Position == SelectionPosition.Right) {
-                                       moveTime = tn.Stop;
-                               } else {
-                                       moveTime = tn.Start;
+                       if (sel.Drawable is CameraObject) {
+                               if (CameraDragged != null) {
+                                       CameraObject co = sel.Drawable as CameraObject;
+                                       // Adjust offset
+                                       co.MediaFile.Offset = co.TimeNode.Start;
+                                       // And notify
+                                       CameraDragged (co.MediaFile, co.TimeNode);
+                               }
+                       } else {
+                               if (TimeNodeChanged != null) {
+                                       Time moveTime;
+                                       TimeNode tn = (sel.Drawable as TimeNodeObject).TimeNode;
+
+                                       if (sel.Position == SelectionPosition.Right) {
+                                               moveTime = tn.Stop;
+                                       } else {
+                                               moveTime = tn.Start;
+                                       }
+                                       TimeNodeChanged (tn, moveTime);
                                }
-                               TimeNodeChanged (tn, moveTime);
                        }
                }
 


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