]> O.S.I.I.S - jp/crow.git/commitdiff
simpler layouting queue test
authorjpbruyere <jp.bruyere@hotmail.com>
Sat, 6 Feb 2016 14:46:32 +0000 (15:46 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Sat, 6 Feb 2016 14:46:32 +0000 (15:46 +0100)
13 files changed:
Crow.csproj
Crow.sln
Crow.userprefs
MonoDevelop.GOLib/MonoDevelop.GOLib.csproj
Tests/Interfaces/0.crow
src/GraphicObjects/ComboBox.cs
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Grid.cs
src/GraphicObjects/ILayoutable.cs
src/Interface.cs
src/LayoutingQueueItem.cs
src/OpenTKGameWindow.cs

index 3b142f7572b5ce8f596a071dd357c78b7bfbbe72..f44744924c62363b40f161aea4efc2e3f90e9505 100644 (file)
     <Compile Include="src\ExtensionsMethods.cs" />
     <Compile Include="src\Interface.cs" />
     <Compile Include="src\LayoutingQueueItem.cs" />
-    <Compile Include="src\LayoutingQueue.cs" />
     <Compile Include="src\GraphicObjects\Spinner.cs" />
     <Compile Include="src\DynAttribute.cs" />
     <Compile Include="src\GraphicObjects\IValueChange.cs" />
index 794d208c5650650dcd9f3622c0de338e6db0e324..4f8d22f916bf89dbec6863f89d720b0d0669de23 100644 (file)
--- a/Crow.sln
+++ b/Crow.sln
@@ -24,15 +24,12 @@ Global
                {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Linux_x86.ActiveCfg = Release|Any CPU
                {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Linux_x86.Build.0 = Release|Any CPU
                {7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}.Debug|Linux_x86.ActiveCfg = Debug|Any CPU
-               {7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}.Debug|Linux_x86.Build.0 = Debug|Any CPU
                {7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}.Release|Linux_x86.ActiveCfg = Release|Any CPU
-               {7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}.Release|Linux_x86.Build.0 = Release|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Linux_x86.ActiveCfg = Debug|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Linux_x86.Build.0 = Debug|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Linux_x86.ActiveCfg = Release|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Linux_x86.Build.0 = Release|Any CPU
                {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Debug|Linux_x86.ActiveCfg = Debug|Any CPU
-               {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Debug|Linux_x86.Build.0 = Debug|Any CPU
                {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Release|Linux_x86.ActiveCfg = Release|Any CPU
        EndGlobalSection
        GlobalSection(MonoDevelopProperties) = preSolution
index d17e4d365f0f5abcf8af743ae81f28968f7d03cd..1b24c0fae486b64a5ae20cae572c545c5fec91e3 100644 (file)
@@ -1,18 +1,38 @@
 <Properties GitUserInfo="UsingGIT" StartupItem="Tests/Tests.csproj">
-  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|Linux_x86" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="src/LayoutingQueueItem.cs">
+  <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|Linux_x86" />
+  <MonoDevelop.Ide.Workbench ActiveDocument="src/GraphicObjects/GenericStack.cs">
     <Files>
-      <File FileName="src/GraphicObjects/GraphicObject.cs" Line="589" Column="47" />
-      <File FileName="Tests/Interfaces/0.crow" Line="13" Column="49" />
-      <File FileName="src/LayoutingQueueItem.cs" Line="54" Column="57" />
-      <File FileName="src/LayoutingQueue.cs" Line="50" Column="48" />
-      <File FileName="Tests/Interfaces/testWindow.goml" Line="9" Column="55" />
-      <File FileName="Templates/CheckBox.goml" Line="10" Column="46" />
-      <File FileName="src/GraphicObjects/Group.cs" Line="152" Column="45" />
-      <File FileName="src/OpenTKGameWindow.cs" Line="411" Column="43" />
-      <File FileName="src/GraphicObjects/Slider.cs" Line="75" Column="41" />
-      <File FileName="src/GraphicObjects/GenericStack.cs" Line="107" Column="7" />
+      <File FileName="src/GraphicObjects/GraphicObject.cs" Line="532" Column="1" />
+      <File FileName="src/GraphicObjects/GenericStack.cs" Line="116" Column="4" />
+      <File FileName="src/GraphicObjects/Grid.cs" Line="129" Column="24" />
+      <File FileName="src/OpenTKGameWindow.cs" Line="548" Column="35" />
+      <File FileName="src/LayoutingQueueItem.cs" Line="63" Column="1" />
+      <File FileName="src/GraphicObjects/ILayoutable.cs" Line="17" Column="50" />
+      <File FileName="src/GraphicObjects/ComboBox.cs" Line="167" Column="1" />
     </Files>
+    <Pads>
+      <Pad Id="ProjectPad">
+        <State name="__root__">
+          <Node name="Crow" expanded="True" selected="True">
+            <Node name="Crow" expanded="True">
+              <Node name="src" expanded="True">
+                <Node name="GraphicObjects" expanded="True" />
+              </Node>
+            </Node>
+            <Node name="MonoDevelop.Diagram" expanded="True">
+              <Node name="src" expanded="True" />
+            </Node>
+            <Node name="MonoDevelop.GOLib" expanded="True">
+              <Node name="src" expanded="True" />
+            </Node>
+            <Node name="Tests" expanded="True">
+              <Node name="Interfaces" expanded="True" />
+            </Node>
+            <Node name="UnitTest" expanded="True" />
+          </Node>
+        </State>
+      </Pad>
+    </Pads>
   </MonoDevelop.Ide.Workbench>
   <MonoDevelop.Ide.DebuggingService.Breakpoints>
     <BreakpointStore />
index fdf16c9334a19bc0598a30f798550022170421f1..3fa91fbb757a7216df43d3f6da846323743be741 100644 (file)
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <ConsolePause>false</ConsolePause>
+    <CustomCommands>
+      <CustomCommands>
+        <Command type="Execute" command="/usr/local/lib/monodevelop/bin/MonoDevelop.exe --no-redirect" workingdir="/usr/local/lib/monodevelop/bin" />
+      </CustomCommands>
+    </CustomCommands>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>none</DebugType>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <ConsolePause>false</ConsolePause>
+    <CustomCommands>
+      <CustomCommands>
+        <Command type="Execute" command="/usr/local/lib/monodevelop/bin/MonoDevelop.exe --no-redirect" workingdir="/usr/local/lib/monodevelop/bin" />
+      </CustomCommands>
+    </CustomCommands>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
index 3fbc5e5fab6ebce02bf0133f527e159d7d7db21d..1b4bc645aec9ff16b6fd71938d00c16a251a7b43 100755 (executable)
@@ -1,21 +1,8 @@
 <?xml version="1.0"?>
-<!--<GroupBox Height="-1" Width="0" Margin="5">
-       <VerticalStack  Height="-1" Width="0" >
-               <RadioButton  Caption="Radio 1" Background="Red" Width="0"/>
-               <RadioButton  Caption="Radio 2" IsChecked="true" />
-               <RadioButton  Caption="Radio 3" />
-               <RadioButton  Caption="Radio 1" Background="SkyBlue" Width="0"/>
-       </VerticalStack>
-</GroupBox>-->
-<GroupBox Height="-1" Width="0" Margin="5">
-       <VerticalStack  Height="-1" Width="0" >
-<!--           <RadioButton  Caption="Radio 1" Background="Red" Width="0"/>-->
-               <CheckBox  Caption="Radio 1" Background="Red" Width="0"/>
-<!--           <Button Background="Red" Width="0"/>-->
-<!--                   <Popper  Caption="Radio 1" Background="Red" Width="0"/>-->
-
-<!--           <GraphicObject Height="20" Background="Red" Width="0"/>-->
-<!--           <RadioButton  Caption="Radio 3" />-->
-
-       </VerticalStack>
-</GroupBox>
\ No newline at end of file
+<VerticalStack Fit="true" Background="Green" Margin="5">
+       <GraphicObject Height="20" Background="Red" Width="20"/>
+       <GraphicObject Height="20" Background="Red" Width="20"/>
+       <GraphicObject Height="20" Background="Red" Width="20"/>
+       <GraphicObject Height="20" Background="Red" Width="20"/>
+       <GraphicObject Height="20" Background="Red" Width="20"/>
+</VerticalStack>
\ No newline at end of file
index 181131b4237c6630f5391564128d5244897b830f..aee7da9b6dfbf25b60b6c2f5fbc93d0be2e8682f 100644 (file)
@@ -164,11 +164,7 @@ namespace Crow
 
                        }
                }
-               public override void UpdateLayout (LayoutingType layoutType)
-               {
-                       CheckPendingChildrenAddition ();
-                       base.UpdateLayout (layoutType);
-               }
+
                internal void CheckPendingChildrenAddition()
                {
                        if (pendingChildrenAddition == null)
index c49c5307ea287a23498cc894e5f6036dbc194916..5de21fac2272b2dfa8be55cd16f539569858a6da 100644 (file)
@@ -109,19 +109,11 @@ namespace Crow
                        }
                        bmp = null;
                }
+                       
+               public override bool UpdateLayout (LayoutingType layoutType)
+        {
+                       RegisteredLayoutings &= (~layoutType);
 
-               public override void EnqueueForLayouting ()
-               {                       
-                       if (Parent == null)
-                               return;
-
-                       base.EnqueueForLayouting ();
-
-                       if (RegisteredLayoutings.HasFlag(LayoutingType.PositionChildren))
-                               Interface.LayoutingQueue.Enqueue (LayoutingType.PositionChildren, this);
-               }
-               public override void UpdateLayout (LayoutingType layoutType)
-        {            
                        if (layoutType == LayoutingType.PositionChildren) {
                                //allow 1 child to have size to 0 if stack has fixed or streched size,
                                //this child will occupy remaining space
@@ -165,13 +157,18 @@ namespace Crow
                                                        }
                                                }
                                        }
-                               }                               
+                               }
+
                                ComputeChildrenPositions ();
+
                                //if no layouting remains in queue for item, registre for redraw
-                               if (RegisteredLQINodes.Count () <= 0 && bmp==null)
+                               if (RegisteredLayoutings == LayoutingType.None && bmp==null)
                                        this.RegisterForRedraw ();
-                       }else
-                               base.UpdateLayout(layoutType);
+
+                               return true;
+                       }
+
+                       return base.UpdateLayout(layoutType);
         }
                public override void OnLayoutChanges (LayoutingType layoutType)
                {
index 1f437021be6115e982feb911605ecfe46ee91908..4d00b99aae9361197692b47c244ad0677e9d95a9 100644 (file)
@@ -64,6 +64,7 @@ namespace Crow
                #endregion
 
                #region private fields
+               LayoutingType registeredLayoutings = LayoutingType.None;
                ILayoutable _parent;
                string _name = "unamed";
                Fill _background = Color.Transparent;
@@ -111,8 +112,7 @@ namespace Crow
                #endregion
 
                #region ILayoutable
-
-               public List<LinkedListNode<LayoutingQueueItem>> RegisteredLQINodes { get; } = new List<LinkedListNode<LayoutingQueueItem>>();
+               [XmlIgnore]public LayoutingType RegisteredLayoutings { get { return registeredLayoutings; } set { registeredLayoutings = value; } }
                //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
                /// <summary>
@@ -501,21 +501,14 @@ namespace Crow
                protected virtual Size measureRawSize () {
                        return Bounds.Size;
                }
-
-               void deleteLQI(int lt){
-                       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]);
-                               RegisteredLQINodes.Remove (lqis [i]);
-                       }
-               }
-               public LayoutingType RegisteredLayoutings = 0;
-
+                       
                public virtual void RegisterForLayouting(LayoutingType layoutType){
+                       //dont set position for stretched item
                        if (Width == 0)
                                layoutType &= (~LayoutingType.X);
                        if (Height == 0)
                                layoutType &= (~LayoutingType.Y);
+
                        //Prevent child repositionning in a stack
                        //TODO:this should be done inside GenericStack
                        GenericStack gs = Parent as GenericStack;
@@ -525,66 +518,36 @@ namespace Crow
                                else
                                        layoutType &= (~LayoutingType.Y);
                        }
+
+                       //prevent queueing same LayoutingType for this
+                       layoutType &= (~RegisteredLayoutings);
+
                        if (layoutType == LayoutingType.None)
                                return;
-                       if (RegisteredLayoutings == LayoutingType.None)
-                               Interface.RegisteredGOForLayouting.Enqueue (this);
-                       RegisteredLayoutings |= (LayoutingType)layoutType;
-               }
-               /// <summary> clear current layoutingQueue items for object and
-               /// trigger a new layouting pass for a layoutType </summary>
-               public virtual void EnqueueForLayouting()
-               {
-                       if (Parent == null)
-                               return;
+
                        #if DEBUG_LAYOUTING
-                       Debug.WriteLine ("RegisterForLayouting => {1}->{0}", RegisteredLayoutings.ToString(), this.ToString());
+                       Debug.WriteLine ("RegisterForLayouting => {1}->{0}", layoutType, this.ToString());
                        #endif
 
-                       //deleteLQI (RegisteredLayoutings);
-                       if (RegisteredLayoutings.HasFlag(LayoutingType.Width)) {
-                               if (Bounds.Width == 0) //stretch in parent
-                                               Interface.LayoutingQueue.EnqueueAfterParentSizing (LayoutingType.Width, this);
-                               else if (Bounds.Width < 0) //fit 
-                                               Interface.LayoutingQueue.EnqueueBeforeParentSizing (LayoutingType.Width, this);
-                               else                                    
-                                       RegisteredLQINodes.Add(
-                                               Interface.LayoutingQueue.AddFirst (
-                                                       new LayoutingQueueItem (LayoutingType.Width, this)));                           
-                       }
-
-                       if (RegisteredLayoutings.HasFlag(LayoutingType.Height)) {
-                               if (Bounds.Height == 0) //stretch in parent
-                                               Interface.LayoutingQueue.EnqueueAfterParentSizing (LayoutingType.Height, this);
-                               else if (Bounds.Height < 0) //fit 
-                                               Interface.LayoutingQueue.EnqueueBeforeParentSizing (LayoutingType.Height, this);
-                               else{
-                                       RegisteredLQINodes.Add(
-                                               Interface.LayoutingQueue.AddFirst (
-                                                       new LayoutingQueueItem (LayoutingType.Height, this)));                          
-                                       
-                               }
-                       }
-
-                       if (RegisteredLayoutings.HasFlag(LayoutingType.X))
-                                       //for x positionning, sizing of parent and this have to be done
-                                       Interface.LayoutingQueue.EnqueueAfterThisAndParentSizing (LayoutingType.X, this);
-
-                       if (RegisteredLayoutings.HasFlag(LayoutingType.Y))
-                                       //for x positionning, sizing of parent and this have to be done
-                                       Interface.LayoutingQueue.EnqueueAfterThisAndParentSizing (LayoutingType.Y, this);
+                       if (layoutType.HasFlag (LayoutingType.Width))
+                               Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Width, this));
+                       if (layoutType.HasFlag (LayoutingType.Height))
+                               Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Height, this));
+                       if (layoutType.HasFlag (LayoutingType.X))
+                               Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.X, this));
+                       if (layoutType.HasFlag (LayoutingType.Y))
+                               Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Y, this));
+                       if (layoutType.HasFlag (LayoutingType.PositionChildren))
+                               Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.PositionChildren, this));
                }
 
-
                /// <summary> trigger dependant sizing component update </summary>
                public virtual void OnLayoutChanges(LayoutingType  layoutType)
                {
-                       if (Parent==null)
-                               return;
                        #if DEBUG_LAYOUTING
                        Debug.WriteLine ("Layout change: " + this.ToString () + ":" + LastSlots.ToString() + "=>" + Slot.ToString ());
                        #endif
-                       
+
                        switch (layoutType) {
                        case LayoutingType.Width:                               
                                if (Width != 0 && Parent.getBounds().Width >=0) //update position in parent
@@ -597,13 +560,23 @@ namespace Crow
                        }
                        LayoutChanged.Raise (this, new LayoutingEventArgs (layoutType));
                }
+
                /// <summary> Update layout component, this is where the computation of alignement
                /// and size take place </summary>
-               public virtual void UpdateLayout (LayoutingType layoutType)
-               {               
+               /// <returns><c>true</c>, if layouting was possible, <c>false</c> if conditions were not
+               /// met and LQI has to be re-queued</returns>
+               public virtual bool UpdateLayout (LayoutingType layoutType)
+               {
+                       //unset bit, it would be reset if LQI is re-queued
+                       registeredLayoutings &= (~layoutType);
+
                        switch (layoutType) {
                        case LayoutingType.X:
                                if (Bounds.X == 0) {
+
+                                       if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                                               return false;
+                                       
                                        switch (HorizontalAlignment) {
                                        case HorizontalAlignment.Left:
                                                Slot.X = 0;
@@ -629,8 +602,12 @@ namespace Crow
                                break;
                        case LayoutingType.Y:
                                if (Bounds.Y == 0) {
+
+                                       if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                                               return false;
+                                       
                                        switch (VerticalAlignment) {
-                                       case VerticalAlignment.Top:
+                                       case VerticalAlignment.Top://this could be processed even if parent Height is not known
                                                Slot.Y = 0;
                                                break;
                                        case VerticalAlignment.Bottom:
@@ -662,6 +639,8 @@ namespace Crow
                                        Slot.Width = Width;
                                else if (Width < 0)
                                        Slot.Width = measureRawSize ().Width;
+                               else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                                       return false;
                                else
                                        Slot.Width = Parent.ClientRectangle.Width;
 
@@ -689,6 +668,8 @@ namespace Crow
                                        Slot.Height = Height;
                                else if (Height < 0)
                                        Slot.Height = measureRawSize ().Height;
+                               else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                                       return false;
                                else
                                        Slot.Height = Parent.ClientRectangle.Height;
 
@@ -698,7 +679,6 @@ namespace Crow
                                else if (Slot.Height > MaximumSize.Height && MaximumSize.Height > 0)
                                        Slot.Height = MaximumSize.Height;
 
-
                                if (LastSlots.Height == Slot.Height)
                                        break;
 
@@ -709,9 +689,12 @@ namespace Crow
                                LastSlots.Height = Slot.Height;
                                break;
                        }
+
                        //if no layouting remains in queue for item, registre for redraw
-                       if (this.RegisteredLQINodes.Count () <= 0 && bmp == null)
+                       if (this.registeredLayoutings == LayoutingType.None && bmp == null)
                                this.RegisterForRedraw ();
+
+                       return true;
                }
                #endregion
 
index 171abd61c8851283377436654fcb71c7d8b50306..fc3d89889742ab3da53e0e2d94d228aab2f47145 100644 (file)
@@ -125,22 +125,23 @@ namespace Crow
                        }
                }
 
-               public override void EnqueueForLayouting ()
-               {                       
-                       base.EnqueueForLayouting ();
 
-                       if (RegisteredLayoutings.HasFlag(LayoutingType.PositionChildren))
-                               Interface.LayoutingQueue.Enqueue (LayoutingType.PositionChildren, this);                        
-               }
-               public override void UpdateLayout (LayoutingType layoutType)
-               {            
+               public override bool UpdateLayout (LayoutingType layoutType)
+               {
+                       RegisteredLayoutings &= (~layoutType);
+
                        if (layoutType == LayoutingType.PositionChildren) {                             
+
                                ComputeChildrenPositions ();
+
                                //if no layouting remains in queue for item, registre for redraw
-                               if (RegisteredLQINodes.Count () <= 0 && bmp==null)
+                               if (RegisteredLayoutings == LayoutingType.None && bmp==null)
                                        this.RegisterForRedraw ();
-                       }else
-                               base.UpdateLayout(layoutType);
+                               
+                               return true;
+                       }
+
+                       return base.UpdateLayout(layoutType);
                }
                #endregion
 
index 01d62365757f6f64f584d9226f8077dd9059e9c8..b9a97b0ec3e8c223d4e914359186df47d96278e2 100644 (file)
@@ -13,9 +13,9 @@ namespace Crow
 
                IGOLibHost HostContainer { get; }
 
-               List<LinkedListNode<LayoutingQueueItem>> RegisteredLQINodes { get; }
+               LayoutingType RegisteredLayoutings { get; set; }
                void RegisterForLayouting(LayoutingType layoutType);
-               void UpdateLayout(LayoutingType layoutType);
+               bool UpdateLayout(LayoutingType layoutType);
 
 
                Rectangle ContextCoordinates(Rectangle r);
index cf86ecf3039f09a8064d581a60f8d267f2ac0fe8..5ecd7a88d0801b555f273dc56bf656e5c2f0c977 100644 (file)
@@ -53,12 +53,9 @@ namespace Crow
                /// <summary> Threshold to catch borders for sizing </summary>
                public static int BorderThreshold = 5;
 
-               public static LayoutingQueue LayoutingQueue = new LayoutingQueue ();
-               public static Queue<GraphicObject> RegisteredGOForLayouting = new Queue<GraphicObject>();
+               public static Queue<LayoutingQueueItem> LayoutingQueue = new Queue<LayoutingQueueItem>();
 
                #region Load/Save
-               //internal static List<DynAttribute> Bindings;
-
 
                public static void Save<T> (string file, T graphicObject)
                {            
index 8fbd95caf2cedee67820f87bddb63ad840a25353..d5ad7fcc57afc75fdf59c8492a06f91bb20c407a 100644 (file)
@@ -46,6 +46,7 @@ namespace Crow
                {
                        LayoutType = _layoutType;
                        GraphicObject = _graphicObject;
+                       GraphicObject.RegisteredLayoutings |= LayoutType;
                }
        
                public void ProcessLayouting()
@@ -53,12 +54,14 @@ namespace Crow
                        #if DEBUG_LAYOUTING
                        Debug.WriteLine ("Layouting => " + this.ToString ());
                        #endif
+
                        try {
                                if (GraphicObject.Parent == null){
                                        Debug.WriteLine("ERROR: processLayouting, no parent for: " + GraphicObject.ToString());
                                        return;
                                }
-                               GraphicObject.UpdateLayout (LayoutType);
+                               if (!GraphicObject.UpdateLayout (LayoutType))
+                                       Interface.LayoutingQueue.Enqueue(this);
                        } catch (Exception ex) {
                                Debug.WriteLine ("Layouting error: " + ex.ToString ());
                        }
index bb5b67e632649b52e4e0d017da588b29355c9b1b..12099e484de0460aee65a9b2d17144244a889133 100644 (file)
@@ -261,16 +261,9 @@ namespace Crow
                        #endif
                        //Debug.WriteLine ("======= Layouting queue start =======");
 
-                       while (Interface.RegisteredGOForLayouting.Count > 0){
-                               while (Interface.RegisteredGOForLayouting.Count > 0){
-                                       GraphicObject go = Interface.RegisteredGOForLayouting.Dequeue ();
-                                       go.EnqueueForLayouting ();
-                                       go.RegisteredLayoutings = LayoutingType.None;
-                               }
-                               while (Interface.LayoutingQueue.First != null) {
-                                       LayoutingQueueItem lqi = Interface.LayoutingQueue.Dequeue ();
-                                       lqi.ProcessLayouting ();
-                               }
+                       while (Interface.LayoutingQueue.Count > 0) {
+                               LayoutingQueueItem lqi = Interface.LayoutingQueue.Dequeue ();
+                               lqi.ProcessLayouting ();
                        }
 
                        #if MEASURE_TIME
@@ -551,11 +544,12 @@ namespace Crow
         #endregion
 
                #region ILayoutable implementation
-
-               //TODO:uneeded list, should be removed
-               public List<LinkedListNode<LayoutingQueueItem>> RegisteredLQINodes { get; } = new List<LinkedListNode<LayoutingQueueItem>>();
+               public LayoutingType RegisteredLayoutings {
+                       get { return LayoutingType.None; }
+                       set { throw new NotImplementedException (); } 
+               }
                public void RegisterForLayouting (LayoutingType layoutType) { throw new NotImplementedException (); }
-               public void UpdateLayout (LayoutingType layoutType) { throw new NotImplementedException (); }
+               public bool UpdateLayout (LayoutingType layoutType) { throw new NotImplementedException (); }
                public Rectangle ContextCoordinates (Rectangle r)
                {
                        return r;