aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-04 22:45:22 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-04 22:45:22 +0100
commita705b3d79e7cbeb887353c4e107e32844b13d7a9 (patch)
tree5a699c63b55193a0d7bc94b7911d38126c36d8da /src/GraphicObjects
parent64572f9c6301ddf4ed2921597366ff3ebd3d7c0f (diff)
register LinkedListNode, prevent uneeded cyclic ref
Diffstat (limited to 'src/GraphicObjects')
-rw-r--r--src/GraphicObjects/GenericStack.cs2
-rw-r--r--src/GraphicObjects/GraphicObject.cs24
-rw-r--r--src/GraphicObjects/Grid.cs2
-rw-r--r--src/GraphicObjects/ILayoutable.cs2
4 files changed, 16 insertions, 14 deletions
diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs
index dd27d21a..92e944bb 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 (RegisteredLQIs.Count () <= 0 && bmp==null)
+ if (RegisteredLQINodes.Count () <= 0 && bmp==null)
this.RegisterForRedraw ();
}else
base.UpdateLayout(layoutType);
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index d96bdf29..b9b142c0 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -91,7 +91,7 @@ namespace Crow
#region ILayoutable
- public List<LayoutingQueueItem> RegisteredLQIs { get; } = new List<LayoutingQueueItem>();
+ public List<LinkedListNode<LayoutingQueueItem>> RegisteredLQINodes { get; } = new List<LinkedListNode<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 {
@@ -492,10 +492,10 @@ namespace Crow
return Bounds.Size;
}
void deleteLQI(int lt){
- LayoutingQueueItem[] lqis = this.RegisteredLQIs.Where (lq => (lt & (int)lq.LayoutType) > 0).ToArray ();
+ LinkedListNode<LayoutingQueueItem>[] lqis = this.RegisteredLQINodes.Where (n => (lt & (int)n.Value.LayoutType) > 0).ToArray ();
for (int i = 0; i < lqis.Length; i++) {
- Interface.LayoutingQueue.Remove (lqis [i].Node);
- lqis [i].DeleteLayoutableRef();
+ Interface.LayoutingQueue.Remove (lqis [i]);
+ RegisteredLQINodes.Remove (lqis [i]);
}
}
/// <summary> clear current layoutingQueue items for object and
@@ -514,10 +514,10 @@ namespace Crow
Interface.LayoutingQueue.EnqueueAfterParentSizing (LayoutingType.Width, this);
else if (Bounds.Width < 0) //fit
Interface.LayoutingQueue.EnqueueBeforeParentSizing (LayoutingType.Width, this);
- else {
- LayoutingQueueItem lqi = new LayoutingQueueItem (LayoutingType.Width, this);
- lqi.Node = Interface.LayoutingQueue.AddFirst (lqi);
- }
+ else
+ RegisteredLQINodes.Add(
+ Interface.LayoutingQueue.AddFirst (
+ new LayoutingQueueItem (LayoutingType.Width, this)));
}
if ((layoutType & (int)LayoutingType.Height) > 0) {
@@ -526,8 +526,10 @@ namespace Crow
else if (Bounds.Height < 0) //fit
Interface.LayoutingQueue.EnqueueBeforeParentSizing (LayoutingType.Height, this);
else{
- LayoutingQueueItem lqi = new LayoutingQueueItem (LayoutingType.Height, this);
- lqi.Node = Interface.LayoutingQueue.AddFirst (lqi);
+ RegisteredLQINodes.Add(
+ Interface.LayoutingQueue.AddFirst (
+ new LayoutingQueueItem (LayoutingType.Height, this)));
+
}
}
@@ -707,7 +709,7 @@ namespace Crow
break;
}
//if no layouting remains in queue for item, registre for redraw
- if (this.RegisteredLQIs.Count () <= 0 && bmp == null)
+ if (this.RegisteredLQINodes.Count () <= 0 && bmp == null)
this.RegisterForRedraw ();
}
diff --git a/src/GraphicObjects/Grid.cs b/src/GraphicObjects/Grid.cs
index 08241d9c..1981fc60 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 (RegisteredLQIs.Count () <= 0 && bmp==null)
+ if (RegisteredLQINodes.Count () <= 0 && bmp==null)
this.RegisterForRedraw ();
}else
base.UpdateLayout(layoutType);
diff --git a/src/GraphicObjects/ILayoutable.cs b/src/GraphicObjects/ILayoutable.cs
index 3a7135e0..7bb30bce 100644
--- a/src/GraphicObjects/ILayoutable.cs
+++ b/src/GraphicObjects/ILayoutable.cs
@@ -13,7 +13,7 @@ namespace Crow
IGOLibHost HostContainer { get; }
- List<LayoutingQueueItem> RegisteredLQIs { get; }
+ List<LinkedListNode<LayoutingQueueItem>> RegisteredLQINodes { get; }
void RegisterForLayouting(int layoutType);
void UpdateLayout(LayoutingType layoutType);