]> O.S.I.I.S - jp/crow.git/commitdiff
Set regLayout.ALL to new object to prevent queuing in layout or
authorjpbruyere <jp.bruyere@hotmail.com>
Thu, 4 Aug 2016 13:45:02 +0000 (15:45 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Thu, 4 Aug 2016 13:45:02 +0000 (15:45 +0200)
drawing, set to regLayout.None just before adding parent
LayoutingTries moved into LQI

src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/ILayoutable.cs
src/GraphicObjects/PrivateContainer.cs
src/Interface.cs
src/LayoutingQueueItem.cs

index 3bdc354d53e1cf95c0216e92ff5afb8238eb861e..20173172a3dde548a459d7cbfe629ecab880738c 100644 (file)
@@ -25,9 +25,6 @@ namespace Crow
                internal static ulong currentUid = 0;
                internal ulong uid = 0;
 
-
-               internal int layoutingTries = 0;
-
                Rectangles clipping = new Rectangles();
                public Rectangles Clipping { get { return clipping; }}
 
@@ -62,7 +59,7 @@ namespace Crow
                #endregion
 
                #region private fields
-               LayoutingType registeredLayoutings = LayoutingType.None;
+               LayoutingType registeredLayoutings = LayoutingType.All;
                ILayoutable logicalParent;
                ILayoutable _parent;
                string _name = "unamed";
@@ -742,20 +739,18 @@ namespace Crow
                        bmp = null;
                        if (Width == Measure.Fit || Height == Measure.Fit)
                                RegisterForLayouting (LayoutingType.Sizing);
-                       Interface.CurrentInterface.EnqueueForRepaint (this);
+                       else if (RegisteredLayoutings == LayoutingType.None)
+                               Interface.CurrentInterface.EnqueueForRepaint (this);
                }
                /// <summary> query an update of the content, a redraw </summary>
                [MethodImpl(MethodImplOptions.AggressiveInlining)]
                public void RegisterForRedraw ()
                {
                        bmp = null;
-                       Interface.CurrentInterface.EnqueueForRepaint (this);
+                       if (RegisteredLayoutings == LayoutingType.None)
+                               Interface.CurrentInterface.EnqueueForRepaint (this);
                }
                #region Layouting
-               [XmlIgnore]public int LayoutingTries {
-                       get { return layoutingTries; }
-                       set { layoutingTries = value; }
-               }
                internal Size contentSize;
                /// <summary> return size of content + margins </summary>
                protected virtual int measureRawSize (LayoutingType lt) {
index 3323a9b452b9134e41855c635b9a10f7fdc78b98..4d851b1ab10a7dbdc24b2d75b10c255660266f25 100644 (file)
@@ -46,6 +46,7 @@ namespace Crow
                        Children.Add(g);
                        g.Parent = this as GraphicObject;
                        g.ResolveBindings ();
+                       g.RegisteredLayoutings = LayoutingType.None;
                        g.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
                        g.LayoutChanged += OnChildLayoutChanges;
             return (T)child;
index b48e815a11a6f1cc0607a019118d7a6daf015268..3315393576d33ceef31d65688d8250b8f6453831 100644 (file)
@@ -5,8 +5,6 @@ namespace Crow
 {
        public interface ILayoutable
        {
-               /// <summary> Unsuccessfull UpdateLayout and requeueing count </summary>
-               int LayoutingTries { get; set; }
                /// <summary> Parent in the graphic tree </summary>
                ILayoutable Parent { get; set; }
                /// <summary> The logical parent (used mainly for bindings) as opposed
index 14c2a68019bf992b396361a88b107c7490f88cfe..93bae7faf7172b83738994696d6445b0301b8a4b 100644 (file)
@@ -63,6 +63,7 @@ namespace Crow
                                child.Parent = this;
                                child.LayoutChanged += OnChildLayoutChanges;
                                contentSize = child.Slot.Size;
+                               child.RegisteredLayoutings = LayoutingType.None;
                                child.RegisterForLayouting (LayoutingType.Sizing);
                        }
 
index 3cfed98167fc5b9ce93ba5394b0ca408798994a8..6d532164cd0c7b88ad5689ea3e9c935172f3fcf6 100644 (file)
@@ -89,10 +89,13 @@ namespace Crow
                internal bool XmlLoading = false;
 
                public Queue<LayoutingQueueItem> LayoutingQueue = new Queue<LayoutingQueueItem> ();
+               public Queue<LayoutingQueueItem> ProcessedLayoutingQueue;
                public Queue<GraphicObject> DrawingQueue = new Queue<GraphicObject>();
                public string Clipboard;//TODO:use object instead for complex copy paste
                public void EnqueueForRepaint(GraphicObject g)
                {
+//                     if (g.RegisteredLayoutings != LayoutingType.None)
+//                             return;
                        lock (DrawingQueue) {
                                if (g.IsQueueForRedraw)
                                        return;
@@ -405,6 +408,7 @@ namespace Crow
                                        lqi.ProcessLayouting ();
                                }
                        }
+
                        #if MEASURE_TIME
                        layoutTime.Stop ();
                        #endif
@@ -499,6 +503,7 @@ namespace Crow
                {
                        g.Parent = this;
                        GraphicTree.Insert (0, g);
+                       g.RegisteredLayoutings = LayoutingType.None;
                        g.RegisterForLayouting (LayoutingType.Sizing);
                }
                public void DeleteWidget(GraphicObject g)
index 826734449783cbfe5473ac59bea4a69f1de0b256..8ffb7dbf74e93a96872fbabd841c9784ae7a07ab 100644 (file)
@@ -45,6 +45,8 @@ namespace Crow
                public ILayoutable GraphicObject;
                /// <summary> Bitfield containing the element of the layout to performs (x|y|width|height)</summary>
                public LayoutingType LayoutType;
+               /// <summary> Unsuccessfull UpdateLayout and requeueing count </summary>
+               public int LayoutingTries;
 
                #region CTOR
                public LayoutingQueueItem (LayoutingType _layoutType, ILayoutable _graphicObject)
@@ -58,7 +60,7 @@ namespace Crow
 
                public void ProcessLayouting()
                {
-                       if (GraphicObject.Parent == null) {
+                       if (GraphicObject.Parent == null) {//TODO:improve this
                                //cancel layouting for object without parent, maybe some were in queue when
                                //removed from a listbox
                                Debug.WriteLine ("ERROR: processLayouting, no parent for: " + this.ToString ());
@@ -71,14 +73,13 @@ namespace Crow
                                #if DEBUG_LAYOUTING
                                Debug.WriteLine ("\tRequeuing => " + this.ToString ());
                                #endif
-                               GraphicObject.LayoutingTries ++;
-                               if (GraphicObject.LayoutingTries < Interface.MaxLayoutingTries) {
+                               LayoutingTries ++;
+                               if (LayoutingTries < Interface.MaxLayoutingTries) {
                                        GraphicObject.RegisteredLayoutings |= LayoutType;
                                        Interface.CurrentInterface.LayoutingQueue.Enqueue (this);
                                }
-                       } else {
-                               GraphicObject.LayoutingTries = 0;
-                       }
+                       } else
+                               LayoutingTries = 0;
                }
 
                public static implicit operator GraphicObject(LayoutingQueueItem queueItem)