]> O.S.I.I.S - jp/crow.git/commitdiff
add some debug msg, prevent mouse evt on label not selectable
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 18 Feb 2018 06:14:00 +0000 (07:14 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 18 Feb 2018 06:14:00 +0000 (07:14 +0100)
Crow.csproj
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Label.cs
src/Interface.cs

index a061ae54e995fddba548c2808925398534e4f611..d05f2ae654d7ec04d334ef3e94a4b89ff13df94a 100644 (file)
@@ -30,7 +30,7 @@
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
-    <DefineConstants>DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_LAYOUTING0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
+    <DefineConstants>DEBUG_UPDATE0;DEBUG_FOCUS;DEBUG_DISPOSE;DEBUG_LAYOUTING0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
     <Optimize>false</Optimize>
     <OutputPath>$(SolutionDir)build\Debug</OutputPath>
   </PropertyGroup>
index 15730905e6193e8eb7d86edebbded0283e32c9a3..f0e8a04dfff257d45de889729df91438c66dc00b 100644 (file)
@@ -1553,6 +1553,9 @@ namespace Crow
                        MouseMove.Raise (this, e);
                }
                public virtual void onMouseDown(object sender, MouseButtonEventArgs e){
+                       #if DEBUG_FOCUS
+                       Debug.WriteLine("MOUSE DOWN => " + this.ToString());
+                       #endif
                        if (CurrentInterface.eligibleForDoubleClick == this && CurrentInterface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick)
                                onMouseDoubleClick (this, e);
                        else
@@ -1578,6 +1581,10 @@ namespace Crow
                        MouseDown.Raise (this, e);
                }
                public virtual void onMouseUp(object sender, MouseButtonEventArgs e){
+                       #if DEBUG_FOCUS
+                       Debug.WriteLine("MOUSE UP => " + this.ToString());
+                       #endif
+
                        if (IsDragged){
                                bool dropOK = false;
                                if (CurrentInterface.HoverWidget!=null) {
@@ -1604,12 +1611,18 @@ namespace Crow
                        }
                }
                public virtual void onMouseClick(object sender, MouseButtonEventArgs e){
+                       #if DEBUG_FOCUS
+                       Debug.WriteLine("CLICK => " + this.ToString());
+                       #endif
                        GraphicObject p = focusParent;
                        if (p != null)
                                p.onMouseClick(sender,e);
                        MouseClick.Raise (this, e);
                }
                public virtual void onMouseDoubleClick(object sender, MouseButtonEventArgs e){
+                       #if DEBUG_FOCUS
+                       Debug.WriteLine("DOUBLE CLICK => " + this.ToString());
+                       #endif
                        GraphicObject p = focusParent;
                        if (p != null)
                                p.onMouseDoubleClick(sender,e);
index de7b7f510a5e2ab26366e93ffd4ba1ca78be6a26..ea68fde006d1f9d72353026bfcd74c904c08d5df 100644 (file)
@@ -740,7 +740,8 @@ namespace Crow
                public override void onMouseUp (object sender, MouseButtonEventArgs e)
                {
                        base.onMouseUp (sender, e);
-
+                       if (!(this.HasFocus || _selectable))
+                               return;
                        if (!SelectionInProgress)
                                return;
 
@@ -751,7 +752,9 @@ namespace Crow
                public override void onMouseDoubleClick (object sender, MouseButtonEventArgs e)
                {
                        base.onMouseDoubleClick (sender, e);
-
+                       if (!(this.HasFocus || _selectable))
+                               return;
+                       
                        GotoWordStart ();
                        SelBegin = CurrentPosition;
                        GotoWordEnd ();
index c573164ff5ea5154de1952b13e9d58e676ce7612..0142f96a8befb56a62591318f9cfa293844097c7 100644 (file)
@@ -686,12 +686,12 @@ namespace Crow
                /// <summary>Set visible state of widget to false and remove if from the graphic tree</summary>
                public void RemoveWidget(GraphicObject g)
                {
-                       if (g.Contains(HoverWidget)) {
-                               while (HoverWidget != g.LogicalParent) {
-                                       HoverWidget.onMouseLeave (HoverWidget, null);
-                                       HoverWidget = HoverWidget.LogicalParent as GraphicObject;
-                               }
-                       }
+//                     if (g.Contains(HoverWidget)) {
+//                             while (HoverWidget != g.focusParent) {
+//                                     HoverWidget.onMouseLeave (HoverWidget, null);
+//                                     HoverWidget = HoverWidget.focusParent;
+//                             }
+//                     }
                        lock (UpdateMutex) {
                                RegisterClip (g.ScreenCoordinates (g.LastPaintedSlot));
                                GraphicTree.Remove (g);
@@ -882,7 +882,6 @@ namespace Crow
                {
                        Mouse.DisableBit (button);
                        MouseButtonEventArgs e = new MouseButtonEventArgs ((Crow.MouseButton)button) { Mouse = Mouse };
-
                        if (_activeWidget == null)
                                return false;