From 17b8993e366b82a1086772aed4f4e49362868c83 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Sun, 18 Mar 2018 14:59:37 +0100 Subject: [PATCH] lqi explorer wip --- CrowIDE/CrowIDE.csproj | 2 +- CrowIDE/src/DesignInterface.cs | 4 +- CrowIDE/src/ProjectTree/ImlProjectItem.cs | 2 +- CrowIDE/ui/DockWindows/winLQIs.crow | 41 ++++++++++++++++++- Tests/BasicTests.cs | 2 +- src/GraphicObjects/GraphicObject.cs | 4 +- src/Interface.cs | 6 +-- src/LayoutingQueueItem.cs | 48 +++++++++++++++-------- 8 files changed, 82 insertions(+), 27 deletions(-) diff --git a/CrowIDE/CrowIDE.csproj b/CrowIDE/CrowIDE.csproj index 73687723..70483b52 100644 --- a/CrowIDE/CrowIDE.csproj +++ b/CrowIDE/CrowIDE.csproj @@ -24,7 +24,7 @@ true full false - DEBUG;DBG_EVENTS + DEBUG;DEBUG_LAYOUTING prompt 4 false diff --git a/CrowIDE/src/DesignInterface.cs b/CrowIDE/src/DesignInterface.cs index 04666b11..820cf4d0 100644 --- a/CrowIDE/src/DesignInterface.cs +++ b/CrowIDE/src/DesignInterface.cs @@ -170,9 +170,11 @@ namespace Crow.Coding //Console.WriteLine (lqi.ToString ()); #if DEBUG_LAYOUTING currentLQI = lqi; + currentLQI.ProcessLayouting (); curLQIsTries.Add(currentLQI); - #endif + #else lqi.ProcessLayouting (); + #endif } LayoutingQueue = DiscardQueue; Monitor.Exit (LayoutMutex); diff --git a/CrowIDE/src/ProjectTree/ImlProjectItem.cs b/CrowIDE/src/ProjectTree/ImlProjectItem.cs index b967ce50..55576472 100644 --- a/CrowIDE/src/ProjectTree/ImlProjectItem.cs +++ b/CrowIDE/src/ProjectTree/ImlProjectItem.cs @@ -58,7 +58,7 @@ namespace Crow.Coding } } public List LQIs { - get { return instance == null ? null : instance.IFace.LQIs; } + get { return instance == null ? null : instance.IFace.LQIsTries; } } public Measure DesignWidth { get { return designWidth; } diff --git a/CrowIDE/ui/DockWindows/winLQIs.crow b/CrowIDE/ui/DockWindows/winLQIs.crow index 3581141b..9ad574f1 100644 --- a/CrowIDE/ui/DockWindows/winLQIs.crow +++ b/CrowIDE/ui/DockWindows/winLQIs.crow @@ -1,7 +1,46 @@  - + + + + + + + + + + + + + + + diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs index af624ee5..e37337cb 100644 --- a/Tests/BasicTests.cs +++ b/Tests/BasicTests.cs @@ -215,7 +215,7 @@ namespace Tests Load(testFiles[idx]).DataSource = this; - showTarget = FindByName ("ShowTarget"); +// showTarget = FindByName ("ShowTarget"); // LoadIMLFragment (@"", 0); // LoadIMLFragment (@"", 0); // LoadIMLFragment (@"", 0); diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index d1ae13c9..4ecbe970 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -1463,7 +1463,7 @@ namespace Crow #if DEBUG_LAYOUTING IFace.currentLQI.Slot = LastSlots; IFace.currentLQI.NewSlot = Slot; - Debug.WriteLine ("\t\t{0} => {1}",LastSlots,Slot); + //Debug.WriteLine ("\t\t{0} => {1}",LastSlots,Slot); #endif // #if DESIGN_MODE // if (IFace.GetType().Name == "DesignInterface"){ @@ -1637,7 +1637,7 @@ namespace Crow /// public virtual void LayoutingDiscardCheck (LayoutingType lt) { //#if DEBUG_LAYOUTING - Debug.WriteLine ("LayoutingDiscardCheck for {0}",this.ToString()); + //Debug.WriteLine ("LayoutingDiscardCheck for {0}",this.ToString()); // #endif } #endregion diff --git a/src/Interface.cs b/src/Interface.cs index 7902424d..e6dce137 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -606,11 +606,11 @@ namespace Crow lqi = LayoutingQueue.Dequeue (); #if DEBUG_LAYOUTING currentLQI = lqi; + currentLQI.ProcessLayouting (); curLQIsTries.Add(currentLQI); - if (lqi.graphicObject.Name == BreakingName) - Debugger.Break(); - #endif + #else lqi.ProcessLayouting (); + #endif } LayoutingQueue = DiscardQueue; Monitor.Exit (LayoutMutex); diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs index cf72aeb9..d517bf39 100644 --- a/src/LayoutingQueueItem.cs +++ b/src/LayoutingQueueItem.cs @@ -49,7 +49,7 @@ namespace Crow /// Element class of the LayoutingQueue /// public struct LayoutingQueueItem - { + { /// Instance of widget to be layouted public ILayoutable Layoutable; /// Bitfield containing the element of the layout to performs (x|y|width|height) @@ -58,6 +58,7 @@ namespace Crow public int LayoutingTries, DiscardCount; #if DEBUG_LAYOUTING + public string Message; public Stopwatch LQITime; public GraphicObject graphicObject { get { return Layoutable as GraphicObject; } @@ -87,9 +88,9 @@ namespace Crow DiscardCount = 0; #if DEBUG_LAYOUTING LQITime = new Stopwatch(); - Slot = Rectangle.Empty; - NewSlot = Rectangle.Empty; - Debug.WriteLine ("\tRegister => " + this.ToString ()); + Slot = NewSlot = default(Rectangle); + Message = ""; + //Debug.WriteLine ("\tRegister => " + this.ToString ()); #endif } #endregion @@ -107,7 +108,7 @@ namespace Crow //cancel layouting for object without parent, maybe some were in queue when //removed from a listbox #if DEBUG_UPDATE || DEBUG_LAYOUTING - Debug.WriteLine ("ERROR: processLayouting, no parent for: " + this.ToString ()); + Message = "Parent is null"; #endif go.parentRWLock.ExitReadLock (); return; @@ -115,19 +116,19 @@ namespace Crow #if DEBUG_LAYOUTING LQITime.Start(); - Debug.WriteLine ("=> " + this.ToString ()); + //Debug.WriteLine ("=> " + this.ToString ()); #endif LayoutingTries++; if (!Layoutable.UpdateLayout (LayoutType)) { #if DEBUG_LAYOUTING - Debug.WriteLine ("\t\tRequeued"); + Message = "Requeued"; #endif if (LayoutingTries < Interface.MaxLayoutingTries) { Layoutable.RegisteredLayoutings |= LayoutType; (Layoutable as GraphicObject).IFace.LayoutingQueue.Enqueue (this); } else if (DiscardCount < Interface.MaxDiscardCount) { #if DEBUG_LAYOUTING - Debug.WriteLine ("\t\tDiscarded"); + Message ="Discarded"; #endif go.LayoutingDiscardCheck (LayoutType); LayoutingTries = 0; @@ -135,16 +136,17 @@ namespace Crow Layoutable.RegisteredLayoutings |= LayoutType; (Layoutable as GraphicObject).IFace.DiscardQueue.Enqueue (this); } - //#if DEBUG_LAYOUTING + #if DEBUG_LAYOUTING else - Debug.WriteLine ("\tDELETED => " + this.ToString ()); - //#endif + Message = "Deleted"; + #endif } + //#if DEBUG_LAYOUTING + else + Message = "Succeed"; + //#endif + - else{ - if (LayoutingTries > 2 || DiscardCount > 0) - Debug.WriteLine (this.ToString ()); - } #if DEBUG_LAYOUTING LQITime.Stop(); #endif @@ -162,8 +164,10 @@ namespace Crow public override string ToString () { #if DEBUG_LAYOUTING - return string.Format ("{2};{3};{4} {1}->{0}", LayoutType,Layoutable.ToString(), - LayoutingTries,DiscardCount,LQITime.ElapsedTicks); +// return string.Format ("{2};{3};{4} {1}->{0}", LayoutType,Layoutable.ToString(), +// LayoutingTries,DiscardCount,LQITime.ElapsedTicks); + return string.Format ("{2};{3};{4} {1}->{0};{5}", LayoutType,Layoutable.ToString(), + LayoutingTries,DiscardCount,LQITime.ElapsedTicks, Message); #else return string.Format ("{2};{3} {1}->{0}", LayoutType,Layoutable.ToString(), LayoutingTries, DiscardCount); @@ -176,6 +180,16 @@ namespace Crow // return this.Where (lqi => lqi.wasTriggeredBy == null).ToList (); // } // #endif + public List GetLQIs(){ + return this.ToList(); + } + #if DEBUG_LAYOUTING + public List CompletedLQIs(){ + List tmp = this.Where (lqi => lqi.Message == "Succeed").ToList (); + return tmp; + } + #endif + } } -- 2.47.3