[longomatch] Enable selection only with the Selection tool



commit e5b791af14c2cb97faaa3ff7a78884e3e813e70f
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Sep 2 18:38:58 2014 +0200

    Enable selection only with the Selection tool

 LongoMatch.Drawing/Widgets/Blackboard.cs |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/LongoMatch.Drawing/Widgets/Blackboard.cs b/LongoMatch.Drawing/Widgets/Blackboard.cs
index 2fb14a6..c1dc9c7 100644
--- a/LongoMatch.Drawing/Widgets/Blackboard.cs
+++ b/LongoMatch.Drawing/Widgets/Blackboard.cs
@@ -38,7 +38,7 @@ namespace LongoMatch.Drawing.Widgets
                DrawTool tool;
                FrameDrawing drawing;
                ISurface backbuffer;
-               bool handdrawing;
+               bool handdrawing, inObjectCreation;
 
                public Blackboard (IWidget widget): base(widget)
                {
@@ -119,6 +119,7 @@ namespace LongoMatch.Drawing.Widgets
                        set {
                                tool = value;
                                widget.SetCursorForTool (tool);
+                               UpdateSelection (null);
                        }
                }
 
@@ -175,10 +176,14 @@ namespace LongoMatch.Drawing.Widgets
                {
                        Drawable drawable = null;
                        SelectionPosition pos = SelectionPosition.BottomRight;
-                       bool resize = true, copycolor = true;
+                       bool resize = true, copycolor = true, sele = true;
 
-                       if (sel != null || Tool == DrawTool.Selection)
+                       if (Tool == DrawTool.Selection)
                                return;
+                       
+                       if (sel != null) {
+                               ClearSelection ();
+                       }
                                
                        switch (Tool) {
                        case DrawTool.Line:
@@ -249,10 +254,13 @@ namespace LongoMatch.Drawing.Widgets
                                if (Tool == DrawTool.Counter) {
                                        UpdateCounters ();
                                }
-                               if (resize) {
-                                       UpdateSelection (new Selection (selo, pos, 5));
-                               } else {
-                                       UpdateSelection (new Selection (selo, SelectionPosition.All, 5));
+                               if (sele) {
+                                       if (resize) {
+                                               UpdateSelection (new Selection (selo, pos, 5));
+                                       } else {
+                                               UpdateSelection (new Selection (selo, SelectionPosition.All, 
5));
+                                       }
+                                       inObjectCreation = true;
                                }
                                widget.ReDraw ();
                        }
@@ -264,6 +272,10 @@ namespace LongoMatch.Drawing.Widgets
                        if (sel != null) {
                                (sel.Drawable as ICanvasDrawableObject).IDrawableObject.Reorder ();
                        }
+                       if (inObjectCreation) {
+                               UpdateSelection (null);
+                               inObjectCreation = false;
+                       }
                        handdrawing = false;
                }
 


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