diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-04 15:45:02 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-04 15:45:02 +0200 |
| commit | e2d351c9de4ee9c8b04376228f3ab5b9310392c9 (patch) | |
| tree | c6071ae81222ee037aa14c4e762e3e16c43826ff /src | |
| parent | 3a01c455e09af25109239ab7ca32e66ea1ebc99b (diff) | |
Set regLayout.ALL to new object to prevent queuing in layout or
drawing, set to regLayout.None just before adding parent
LayoutingTries moved into LQI
Diffstat (limited to 'src')
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 15 | ||||
| -rw-r--r-- | src/GraphicObjects/Group.cs | 1 | ||||
| -rw-r--r-- | src/GraphicObjects/ILayoutable.cs | 2 | ||||
| -rw-r--r-- | src/GraphicObjects/PrivateContainer.cs | 1 | ||||
| -rw-r--r-- | src/Interface.cs | 5 | ||||
| -rw-r--r-- | src/LayoutingQueueItem.cs | 13 |
6 files changed, 19 insertions, 18 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 3bdc354d..20173172 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -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) { diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index 3323a9b4..4d851b1a 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -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; diff --git a/src/GraphicObjects/ILayoutable.cs b/src/GraphicObjects/ILayoutable.cs index b48e815a..33153935 100644 --- a/src/GraphicObjects/ILayoutable.cs +++ b/src/GraphicObjects/ILayoutable.cs @@ -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 diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs index 14c2a680..93bae7fa 100644 --- a/src/GraphicObjects/PrivateContainer.cs +++ b/src/GraphicObjects/PrivateContainer.cs @@ -63,6 +63,7 @@ namespace Crow child.Parent = this; child.LayoutChanged += OnChildLayoutChanges; contentSize = child.Slot.Size; + child.RegisteredLayoutings = LayoutingType.None; child.RegisterForLayouting (LayoutingType.Sizing); } diff --git a/src/Interface.cs b/src/Interface.cs index 3cfed981..6d532164 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -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) diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs index 82673444..8ffb7dbf 100644 --- a/src/LayoutingQueueItem.cs +++ b/src/LayoutingQueueItem.cs @@ -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) |