[longomatch] Add a property to disable moving objects



commit f823874713fc94839d48527ec302ce04a589d2c7
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Aug 4 13:11:06 2014 +0200

    Add a property to disable moving objects

 LongoMatch.Drawing/Canvas.cs |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.Drawing/Canvas.cs b/LongoMatch.Drawing/Canvas.cs
index bf782dd..8dc4d27 100644
--- a/LongoMatch.Drawing/Canvas.cs
+++ b/LongoMatch.Drawing/Canvas.cs
@@ -91,6 +91,7 @@ namespace LongoMatch.Drawing
                        SelectionMode = MultiSelectionMode.Single;
                        Accuracy = 1;
                        MoveWithoutSelection = false;
+                       ObjectsCanMove = true;
                        
                        widget.ButtonPressEvent += HandleButtonPressEvent;
                        widget.ButtonReleasedEvent += HandleButtonReleasedEvent;
@@ -118,6 +119,11 @@ namespace LongoMatch.Drawing
                        set;
                }
                
+               protected bool ObjectsCanMove {
+                       get;
+                       set;
+               }
+               
                protected virtual void StartMove (Selection sel) {
                }
                
@@ -231,11 +237,16 @@ namespace LongoMatch.Drawing
                                start = coords;
                                UpdateSelection (sel);
                                StartMove (sel);
-                               moving = Selections.Count > 0;
+                               moving = Selections.Count > 0 && ObjectsCanMove;
                        }
+                       widget.ReDraw ();
                }
                
                protected virtual void HandleRightButton (Point coords, ButtonModifier modif) {
+                       if (Selections.Count <= 1) {
+                               ClearSelection ();
+                               UpdateSelection (GetSelection (coords));
+                       }
                        ShowMenu (coords);
                }
                


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