diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 14 | ||||
| -rw-r--r-- | src/GraphicObjects/Wrapper.cs | 4 | ||||
| -rw-r--r-- | src/Interface.cs | 33 | ||||
| -rw-r--r-- | src/ItemTemplate.cs | 15 | ||||
| -rw-r--r-- | src/LayoutingQueueItem.cs | 43 |
5 files changed, 74 insertions, 35 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 026c06bd..03e8a362 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -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) diff --git a/src/GraphicObjects/Wrapper.cs b/src/GraphicObjects/Wrapper.cs index 03251af9..1bfcd92a 100644 --- a/src/GraphicObjects/Wrapper.cs +++ b/src/GraphicObjects/Wrapper.cs @@ -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) { diff --git a/src/Interface.cs b/src/Interface.cs index d01d2e8f..0c1cd766 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -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) { diff --git a/src/ItemTemplate.cs b/src/ItemTemplate.cs index 0e2a98ff..ed3459a8 100644 --- a/src/ItemTemplate.cs +++ b/src/ItemTemplate.cs @@ -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); diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs index 6de5be7b..5ec454c5 100644 --- a/src/LayoutingQueueItem.cs +++ b/src/LayoutingQueueItem.cs @@ -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 } |