[longomatch] Fix another regression on dragging.
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Fix another regression on dragging.
- Date: Wed, 18 Mar 2015 14:38:51 +0000 (UTC)
commit ecef223b8964eb4b4e5459730844aef19297c5fb
Author: Julien Moutte <julien fluendo com>
Date: Wed Mar 11 15:27:28 2015 +0100
Fix another regression on dragging.
We need to be able to configure both dragging and selecting of nodes in the timeline. Achieve this
introducing another enum.
LongoMatch.Core/Common/Enums.cs | 22 ++++++++++++++++++++
LongoMatch.Drawing/CanvasObjects/CameraObject.cs | 3 +-
LongoMatch.Drawing/CanvasObjects/PlayObject.cs | 3 +-
LongoMatch.Drawing/CanvasObjects/TimeNodeObject.cs | 21 +++++++++++++++++++
4 files changed, 47 insertions(+), 2 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Enums.cs b/LongoMatch.Core/Common/Enums.cs
index 49b0840..30a870e 100644
--- a/LongoMatch.Core/Common/Enums.cs
+++ b/LongoMatch.Core/Common/Enums.cs
@@ -178,6 +178,28 @@ namespace LongoMatch.Core.Common
/// </summary>
All,
}
+
+ /// <summary>
+ /// Node dragging mode.
+ /// </summary>
+ public enum NodeDraggingMode {
+ /// <summary>
+ /// The node is not draggable at all.
+ /// </summary>
+ None,
+ /// <summary>
+ /// Only borders of the node can be dragged.
+ /// </summary>
+ Borders,
+ /// <summary>
+ /// Only the inner segment of the node can be dragged.
+ /// </summary>
+ Segment,
+ /// <summary>
+ /// Both borders and inner segment can be dragged.
+ /// </summary>
+ All,
+ }
public enum SelectionPosition {
TopLeft,
diff --git a/LongoMatch.Drawing/CanvasObjects/CameraObject.cs
b/LongoMatch.Drawing/CanvasObjects/CameraObject.cs
index 7f07458..c6e9274 100644
--- a/LongoMatch.Drawing/CanvasObjects/CameraObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/CameraObject.cs
@@ -30,7 +30,8 @@ namespace LongoMatch.Drawing.CanvasObjects
base (new TimeNode () { Start = mf.Offset, Stop = mf.Duration + mf.Offset, Name =
mf.Name })
{
mediaFile = mf;
- SelectionMode = NodeSelectionMode.Segment;
+ // Video boundaries can't be changed, only the segment can move.
+ DraggingMode = NodeDraggingMode.Segment;
}
public override string Description {
diff --git a/LongoMatch.Drawing/CanvasObjects/PlayObject.cs b/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
index ffe6a24..4d6ccbc 100644
--- a/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
@@ -27,7 +27,8 @@ namespace LongoMatch.Drawing.CanvasObjects
public PlayObject (TimelineEvent play, Project project):base (play)
{
Project = project;
- SelectionMode = NodeSelectionMode.Borders;
+ // Only event boundaries can be dragged
+ DraggingMode = NodeDraggingMode.Borders;
}
public ISurface SelectionLeft {
diff --git a/LongoMatch.Drawing/CanvasObjects/TimeNodeObject.cs
b/LongoMatch.Drawing/CanvasObjects/TimeNodeObject.cs
index 13c8aea..594f157 100644
--- a/LongoMatch.Drawing/CanvasObjects/TimeNodeObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/TimeNodeObject.cs
@@ -35,6 +35,7 @@ namespace LongoMatch.Drawing.CanvasObjects
{
TimeNode = node;
SelectionMode = NodeSelectionMode.All;
+ DraggingMode = NodeDraggingMode.All;
LineColor = Config.Style.PaletteBackgroundLight;
}
@@ -61,6 +62,11 @@ namespace LongoMatch.Drawing.CanvasObjects
set;
}
+ public NodeDraggingMode DraggingMode {
+ get;
+ set;
+ }
+
public Color LineColor {
get;
set;
@@ -144,6 +150,21 @@ namespace LongoMatch.Drawing.CanvasObjects
public void Move (Selection sel, Point p, Point start)
{
+ // Apply dragging restrictions
+ if (DraggingMode == NodeDraggingMode.None)
+ return;
+ switch (sel.Position) {
+ case SelectionPosition.Left:
+ case SelectionPosition.Right:
+ if (DraggingMode == NodeDraggingMode.Segment)
+ return;
+ break;
+ case SelectionPosition.All:
+ if (DraggingMode == NodeDraggingMode.Borders)
+ return;
+ break;
+ }
+
Time newTime = Utils.PosToTime (p, SecondsPerPixel);
if (p.X < 0) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]