[longomatch] Add a new property to set the selection mode



commit 89686e1c84d7addd460c3164f28a65e1af961c01
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue May 27 18:45:27 2014 +0200

    Add a new property to set the selection mode

 LongoMatch.Drawing/Canvas.cs                |   11 ++++++++---
 LongoMatch.Drawing/Widgets/PlaysTimeline.cs |    2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/LongoMatch.Drawing/Canvas.cs b/LongoMatch.Drawing/Canvas.cs
index f3316c1..3c1eca4 100644
--- a/LongoMatch.Drawing/Canvas.cs
+++ b/LongoMatch.Drawing/Canvas.cs
@@ -73,6 +73,8 @@ namespace LongoMatch.Drawing
                
                public SelectionCanvas (IWidget widget): base (widget) {
                        Selections = new List<Selection>();
+                       SelectionMode = MultiSelectionMode.Single;
+                       
                        widget.ButtonPressEvent += HandleButtonPressEvent;
                        widget.ButtonReleasedEvent += HandleButtonReleasedEvent;
                        widget.MotionEvent += HandleMotionEvent;
@@ -83,7 +85,7 @@ namespace LongoMatch.Drawing
                        set;
                }
                
-               public bool MultipleSelection {
+               public MultiSelectionMode SelectionMode {
                        get;
                        set;
                }
@@ -134,8 +136,11 @@ namespace LongoMatch.Drawing
                                }
                        }
 
-                       if (MultipleSelection && (modif == ButtonModifier.Control ||
-                                                 modif == ButtonModifier.Shift)) {
+                       if ((SelectionMode == MultiSelectionMode.Multiple) ||
+                           (SelectionMode == MultiSelectionMode.MultipleWithModifier &&
+                           (modif == ButtonModifier.Control ||
+                           modif == ButtonModifier.Shift)))
+                       {
                                if (sel != null) {
                                        sel.Position = SelectionPosition.All;
                                        UpdateSelection (sel);
diff --git a/LongoMatch.Drawing/Widgets/PlaysTimeline.cs b/LongoMatch.Drawing/Widgets/PlaysTimeline.cs
index 128b393..b294f0c 100644
--- a/LongoMatch.Drawing/Widgets/PlaysTimeline.cs
+++ b/LongoMatch.Drawing/Widgets/PlaysTimeline.cs
@@ -53,7 +53,7 @@ namespace LongoMatch.Drawing.Widgets
                        categories = new Dictionary<Category, CategoryTimeline> ();
                        secondsPerPixel = 0.1;
                        Accuracy = Common.TIMELINE_ACCURACY;
-                       MultipleSelection = true;
+                       SelectionMode = MultiSelectionMode.MultipleWithModifier;
                }
 
                public void LoadProject (Project project, PlaysFilter filter) {


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