From: Jean-Philippe Bruyère Date: Sun, 18 Feb 2018 06:14:00 +0000 (+0100) Subject: add some debug msg, prevent mouse evt on label not selectable X-Git-Tag: 0.7.0~11 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=446acf127b5afecf3929c8f6aa65627faab570d4;p=jp%2Fcrow.git add some debug msg, prevent mouse evt on label not selectable --- diff --git a/Crow.csproj b/Crow.csproj index a061ae54..d05f2ae6 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -30,7 +30,7 @@ true full true - DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_LAYOUTING0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0 + DEBUG_UPDATE0;DEBUG_FOCUS;DEBUG_DISPOSE;DEBUG_LAYOUTING0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0 false $(SolutionDir)build\Debug diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 15730905..f0e8a04d 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -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); diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs index de7b7f51..ea68fde0 100644 --- a/src/GraphicObjects/Label.cs +++ b/src/GraphicObjects/Label.cs @@ -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 (); diff --git a/src/Interface.cs b/src/Interface.cs index c573164f..0142f96a 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -686,12 +686,12 @@ namespace Crow /// Set visible state of widget to false and remove if from the graphic tree 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;