diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-04 15:18:14 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-04 15:18:14 +0100 |
| commit | ebaffebe02ecadd003c6bc1a66b92dbc720f9711 (patch) | |
| tree | a4da1b41fbbac0b994089ea6b501f1351f909db6 /src/GraphicObjects | |
| parent | 0cce95c9485bc49ae6a2af31046d1e5b2dcdf81e (diff) | |
| parent | 14c11116a5a53bc8c628b4963ecdfd31ccd41ee0 (diff) | |
Merge branch 'ReferencedLQIs'
Diffstat (limited to 'src/GraphicObjects')
| -rw-r--r-- | src/GraphicObjects/GenericStack.cs | 2 | ||||
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 14 | ||||
| -rw-r--r-- | src/GraphicObjects/Grid.cs | 2 | ||||
| -rw-r--r-- | src/GraphicObjects/ILayoutable.cs | 2 |
4 files changed, 15 insertions, 5 deletions
diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs index 53aff76b..dd27d21a 100644 --- a/src/GraphicObjects/GenericStack.cs +++ b/src/GraphicObjects/GenericStack.cs @@ -166,7 +166,7 @@ namespace Crow } ComputeChildrenPositions (); //if no layouting remains in queue for item, registre for redraw - if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && bmp==null) + if (RegisteredLQIs.Count () <= 0 && bmp==null) this.RegisterForRedraw (); }else base.UpdateLayout(layoutType); diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 8bbf67b0..1a608f36 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -90,6 +90,8 @@ namespace Crow #endregion #region ILayoutable + + public List<LayoutingQueueItem> RegisteredLQIs { get; } = new List<LayoutingQueueItem>(); //TODO: it would save the recurent cost of a cast in event bubbling if parent type was GraphicObject // or we could add to the interface the mouse events [XmlIgnore]public ILayoutable Parent { @@ -486,6 +488,13 @@ namespace Crow { return Bounds.Size; } + void deleteLQI(int lt){ + LayoutingQueueItem[] lqis = this.RegisteredLQIs.Where (lq => (lt & (int)lq.LayoutType) > 0).ToArray (); + for (int i = 0; i < lqis.Length; i++) { + Interface.LayoutingQueue.Remove (lqis [i]); + lqis [i].DeleteLayoutableRef(); + } + } /// <summary> clear current layoutingQueue items for object and /// trigger a new layouting pass for a layoutType </summary> public virtual void RegisterForLayouting(int layoutType) @@ -496,8 +505,7 @@ namespace Crow Debug.WriteLine ("RegisterForLayouting => {1}->{0}", layoutType, this.ToString()); #endif lock (Interface.LayoutingQueue) { - Interface.LayoutingQueue.RemoveAll (lq => lq.GraphicObject == this && (layoutType & (int)lq.LayoutType) > 0); - + deleteLQI (layoutType); if ((layoutType & (int)LayoutingType.Width) > 0) { if (Bounds.Width == 0) //stretch in parent Interface.LayoutingQueue.EnqueueAfterParentSizing (LayoutingType.Width, this); @@ -693,7 +701,7 @@ namespace Crow } lock (Interface.LayoutingQueue) { //if no layouting remains in queue for item, registre for redraw - if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && bmp == null) + if (this.RegisteredLQIs.Count () <= 0 && bmp == null) this.RegisterForRedraw (); } } diff --git a/src/GraphicObjects/Grid.cs b/src/GraphicObjects/Grid.cs index 6ce9a3c5..08241d9c 100644 --- a/src/GraphicObjects/Grid.cs +++ b/src/GraphicObjects/Grid.cs @@ -137,7 +137,7 @@ namespace Crow if (layoutType == LayoutingType.PositionChildren) { ComputeChildrenPositions (); //if no layouting remains in queue for item, registre for redraw - if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && bmp==null) + if (RegisteredLQIs.Count () <= 0 && bmp==null) this.RegisterForRedraw (); }else base.UpdateLayout(layoutType); diff --git a/src/GraphicObjects/ILayoutable.cs b/src/GraphicObjects/ILayoutable.cs index 000d377b..3a7135e0 100644 --- a/src/GraphicObjects/ILayoutable.cs +++ b/src/GraphicObjects/ILayoutable.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; namespace Crow { @@ -12,6 +13,7 @@ namespace Crow IGOLibHost HostContainer { get; } + List<LayoutingQueueItem> RegisteredLQIs { get; } void RegisterForLayouting(int layoutType); void UpdateLayout(LayoutingType layoutType); |