]> O.S.I.I.S - jp/crow.git/commitdiff
Move Debug LQIs lists to CurrentInterface
authorjpbruyere <jp.bruyere@hotmail.com>
Mon, 22 Aug 2016 19:57:39 +0000 (21:57 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Thu, 1 Sep 2016 11:24:17 +0000 (13:24 +0200)
LQIs visualizer
ItemTemplate expandable may use 'self' keywork
modifié :         CrowIDE/CrowIDE.csproj
modifié :         CrowIDE/src/CrowIDE.cs
nouveau fichier : CrowIDE/src/Extensions.cs
modifié :         CrowIDE/src/ImlVisualEditor.cs
nouveau fichier : CrowIDE/ui/LQIsExplorer.crow
nouveau fichier : CrowIDE/ui/bindingExpITemp.crow
nouveau fichier : CrowIDE/ui/bindingExplorer.crow
modifié :         Templates/DirectoryView.template
modifié :         Templates/Window.template
modifié :         src/GraphicObjects/GraphicObject.cs
modifié :         src/GraphicObjects/Wrapper.cs
modifié :         src/Interface.cs
modifié :         src/ItemTemplate.cs
modifié :         src/LayoutingQueueItem.cs

Templates/DirectoryView.template
Templates/Window.template
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Wrapper.cs
src/Interface.cs
src/ItemTemplate.cs
src/LayoutingQueueItem.cs

index 13f10f1100da5f9feddd327822c23706ebdd7aba..44ee0600f866c0e2f6b20611736ff2e939d2bd61 100755 (executable)
@@ -10,7 +10,7 @@
                                MouseLeave="{Background=Transparent}"/>
                </HorizontalStack>
        </ItemTemplate>
-       <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">             
+       <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">
                <Expandable Caption="{Name}" >
                        <Template>
                                <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}">
index 481c030b119998e31b77797c454eca1a0cda1ff9..6b3932c14c80d1beefc84ef8a6db8b10aa474fec 100755 (executable)
@@ -1,5 +1,7 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}" Height="{./HeightPolicy}" Width="{./WidthPolicy}"
+<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}"
+                               Background="{./Background}"
+                               Height="{./HeightPolicy}" Width="{./WidthPolicy}"
                                MouseEnter="./onBorderMouseEnter"
                                MouseLeave="./onBorderMouseLeave">
        <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}" Spacing="0">
index 026c06bd5d2bc16ba382980ab209633f60d03561..03e8a362647d8e8865af024fb41448038cb30ced 100644 (file)
@@ -748,10 +748,6 @@ namespace Crow
 
                #region Layouting
 
-               #if DEBUG_LAYOUTING
-               public List<LayoutingQueueItem> CurrentDrawLQIs = null;
-               public List<List<LayoutingQueueItem>> LQIs = new List<List<LayoutingQueueItem>>();
-               #endif
                /// <summary> return size of content + margins </summary>
                protected virtual int measureRawSize (LayoutingType lt) {
                        return lt == LayoutingType.Width ?
@@ -802,8 +798,8 @@ namespace Crow
                public virtual void OnLayoutChanges(LayoutingType  layoutType)
                {
                        #if DEBUG_LAYOUTING
-                       LayoutingQueueItem.currentLQI.Slot = LastSlots;
-                       LayoutingQueueItem.currentLQI.NewSlot = Slot;
+                       CurrentInterface.currentLQI.Slot = LastSlots;
+                       CurrentInterface.currentLQI.NewSlot = Slot;
                        #endif
 
                        switch (layoutType) {
@@ -1031,12 +1027,6 @@ namespace Crow
                                return;
 
                        LastPaintedSlot = Slot;
-                       #if DEBUG_LAYOUTING
-                       if (CurrentDrawLQIs != null){
-                               LQIs.Add (CurrentDrawLQIs);
-                               CurrentDrawLQIs = null;
-                       }
-                       #endif
 
                        if (cacheEnabled) {
                                if (Slot.Width > Interface.MaxCacheSize || Slot.Height > Interface.MaxCacheSize)
index 03251af99286e3f59a955719ec650ac94401f5e2..1bfcd92a670ed9f52b3eefdfd22eafd6cf3540e9 100644 (file)
@@ -191,8 +191,8 @@ namespace Crow
                public override void OnLayoutChanges (LayoutingType layoutType)
                {
                        #if DEBUG_LAYOUTING
-                       LayoutingQueueItem.currentLQI.Slot = LastSlots;
-                       LayoutingQueueItem.currentLQI.Slot = Slot;
+                       CurrentInterface.currentLQI.Slot = LastSlots;
+                       CurrentInterface.currentLQI.Slot = Slot;
                        #endif
 
                        switch (layoutType) {
index d01d2e8fdcb11f5cbbe19d57fa8306eca397a441..0c1cd766979efcdd0d33694baed35e5a7f947354 100644 (file)
@@ -320,7 +320,16 @@ namespace Crow
                }
                #endregion
 
-
+               #if DEBUG_LAYOUTING
+               public List<LQIList> LQIsTries = new List<LQIList>();
+               public LQIList curLQIsTries = new LQIList();
+               public List<LQIList> LQIs = new List<LQIList>();
+               public LQIList curLQIs = new LQIList();
+//             public static LayoutingQueueItem[] MultipleRunsLQIs {
+//                     get { return curUpdateLQIs.Where(l=>l.LayoutingTries>2 || l.DiscardCount > 0).ToArray(); }
+//             }
+               public LayoutingQueueItem currentLQI = null;
+               #endif
                public void Update(){
                        if (mouseRepeatCount > 0) {
                                int mc = mouseRepeatCount;
@@ -346,6 +355,15 @@ namespace Crow
 
                        processLayouting ();
 
+                       #if DEBUG_LAYOUTING
+                       if (curLQIsTries.Count > 0){
+                               LQIsTries.Add(curLQIsTries);
+                               curLQIsTries = new LQIList();
+                               LQIs.Add(curLQIs);
+                               curLQIs = new LQIList();
+                       }
+                       #endif
+
                        clippingRegistration ();
 
                        processDrawing ();
@@ -366,7 +384,14 @@ namespace Crow
                                LayoutingQueueItem lqi = null;
                                while (LayoutingQueue.Count > 0) {
                                        lqi = LayoutingQueue.Dequeue ();
+                                       #if DEBUG_LAYOUTING
+                                       currentLQI = lqi;
+                                       curLQIsTries.Add(currentLQI);
+                                       #endif
                                        lqi.ProcessLayouting ();
+                                       #if DEBUG_LAYOUTING
+                                       currentLQI = null;
+                                       #endif
                                }
                                LayoutingQueue = DiscardQueue;
                        }
@@ -496,6 +521,12 @@ namespace Crow
                                g.ClearBinding ();
                                GraphicTree.RemoveAt (0);
                        }
+                       #if DEBUG_LAYOUTING
+                       LQIsTries = new List<LQIList>();
+                       curLQIsTries = new LQIList();
+                       LQIs = new List<LQIList>();
+                       curLQIs = new LQIList();
+                       #endif
                }
                public GraphicObject FindByName (string nameToFind)
                {
index 0e2a98ff6fb17c246ca827af3e93f8668278a750..ed3459a8b2a98f7d163868571fadc63ff61b021d 100644 (file)
@@ -51,7 +51,6 @@ namespace Crow
                #endregion
 
                public void CreateExpandDelegate (TemplatedControl host){
-                       Type dataType = Type.GetType(strDataType);
                        Type hostType = typeof(TemplatedControl);//not sure is the best place to put the dyn method
                        Type evtType = typeof(EventHandler);
                        Type listBoxType = typeof(ListBox);
@@ -105,7 +104,10 @@ namespace Crow
                        il.Emit (OpCodes.Ldarg_1);//get the dataSource of the sender
                        il.Emit (OpCodes.Callvirt, typeof(GraphicObject).GetProperty("DataSource").GetGetMethod ());
 
-                       emitGetSubData(il, dataType);
+                       if (fetchMethodName != "self"){//special keyword self allows the use of recurent list<<<
+                               Type dataType = Type.GetType(strDataType);
+                               emitGetSubData(il, dataType);
+                       }
 
                        //set 'return' from the fetch method as 'data' of the list
                        il.Emit (OpCodes.Callvirt, piListData.GetSetMethod ());
@@ -124,8 +126,13 @@ namespace Crow
 
                        if (miGetDatas == null) {//in last resort, search among properties
                                PropertyInfo piDatas = dataType.GetProperty (fetchMethodName);
-                               if (piDatas == null)
-                                       throw new Exception ("Fetch data member not found in ItemTemplate: " + fetchMethodName);
+                               if (piDatas == null) {
+                                       FieldInfo fiDatas = dataType.GetField (fetchMethodName);
+                                       if (fiDatas == null)//and among fields
+                                               throw new Exception ("Fetch data member not found in ItemTemplate: " + fetchMethodName);
+                                       il.Emit (OpCodes.Ldfld, fiDatas);
+                                       return;
+                               }
                                miGetDatas = piDatas.GetGetMethod ();
                                if (miGetDatas == null)
                                        throw new Exception ("Read only property for fetching data in ItemTemplate: " + fetchMethodName);
index 6de5be7b09b6053607802e354a995e0405647ab7..5ec454c54765e81a436337daf8186dca0d66ee91 100644 (file)
@@ -51,17 +51,25 @@ namespace Crow
                public int LayoutingTries, DiscardCount;
 
                #if DEBUG_LAYOUTING
-               public static List<LayoutingQueueItem> processedLQIs = new List<LayoutingQueueItem>();
-               public static LayoutingQueueItem[] MultipleRunsLQIs {
-                       get { return processedLQIs.Where(l=>l.LayoutingTries>2 || l.DiscardCount > 0).ToArray(); }
-               }
-               public static LayoutingQueueItem currentLQI = null;
                public Stopwatch LQITime = new Stopwatch();
-               public List<LayoutingQueueItem> triggeredLQIs = new List<LayoutingQueueItem>();
+               public LQIList triggeredLQIs = new LQIList();
                public LayoutingQueueItem wasTriggeredBy = null;
                public GraphicObject graphicObject {
                        get { return Layoutable as GraphicObject; }
                }
+               public string Name {
+                       get { return graphicObject.Name; }
+               }
+               public string FullName {
+                       get { return graphicObject.ToString(); }
+               }
+               public Measure Width {
+                       get { return graphicObject.Width; }
+               }
+               public Measure Height {
+                       get { return graphicObject.Height; }
+               }
+               public bool HasTriggeredLQIs { get { return triggeredLQIs.Count > 0; }}
                public Rectangle Slot, NewSlot;
                #endif
 
@@ -72,12 +80,11 @@ namespace Crow
                        Layoutable = _graphicObject;
                        Layoutable.RegisteredLayoutings |= LayoutType;
                        #if DEBUG_LAYOUTING
-                       if (graphicObject.CurrentDrawLQIs == null)
-                               graphicObject.CurrentDrawLQIs = new List<LayoutingQueueItem>();
-                       graphicObject.CurrentDrawLQIs.Add(this);
-                       if (currentLQI != null){
-                               wasTriggeredBy = currentLQI;
-                               currentLQI.triggeredLQIs.Add(this);
+                       GraphicObject g = graphicObject;
+                       g.CurrentInterface.curLQIs.Add(this);
+                       if (g.CurrentInterface.currentLQI != null){
+                               wasTriggeredBy = g.CurrentInterface.currentLQI;
+                               g.CurrentInterface.currentLQI.triggeredLQIs.Add(this);
                        }
                        #endif
                }
@@ -93,13 +100,11 @@ namespace Crow
                                return;
                        }
                        #if DEBUG_LAYOUTING
-                       currentLQI = this;
-                       processedLQIs.Add(this);
                        LQITime.Start();
                        #endif
+                       LayoutingTries++;
                        if (!Layoutable.UpdateLayout (LayoutType)) {
                                if (LayoutingTries < Interface.MaxLayoutingTries) {
-                                       LayoutingTries++;
                                        Layoutable.RegisteredLayoutings |= LayoutType;
                                        (Layoutable as GraphicObject).CurrentInterface.LayoutingQueue.Enqueue (this);
                                } else if (DiscardCount < Interface.MaxDiscardCount) {
@@ -114,7 +119,6 @@ namespace Crow
                                #endif
                        }
                        #if DEBUG_LAYOUTING
-                       currentLQI = null;
                        LQITime.Stop();
                        #endif
                }
@@ -138,5 +142,12 @@ namespace Crow
                        #endif
                }
        }
+       #if DEBUG_LAYOUTING
+       public class LQIList : List<LayoutingQueueItem>{
+               public List<LayoutingQueueItem> GetRootLQIs(){
+                       return this.Where (lqi => lqi.wasTriggeredBy == null).ToList ();
+               }
+       }
+       #endif
 }