internal static ulong currentUid = 0;
internal ulong uid = 0;
-
- internal int layoutingTries = 0;
-
Rectangles clipping = new Rectangles();
public Rectangles Clipping { get { return clipping; }}
#endregion
#region private fields
- LayoutingType registeredLayoutings = LayoutingType.None;
+ LayoutingType registeredLayoutings = LayoutingType.All;
ILayoutable logicalParent;
ILayoutable _parent;
string _name = "unamed";
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) {
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;
{
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
child.Parent = this;
child.LayoutChanged += OnChildLayoutChanges;
contentSize = child.Slot.Size;
+ child.RegisteredLayoutings = LayoutingType.None;
child.RegisterForLayouting (LayoutingType.Sizing);
}
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;
lqi.ProcessLayouting ();
}
}
+
#if MEASURE_TIME
layoutTime.Stop ();
#endif
{
g.Parent = this;
GraphicTree.Insert (0, g);
+ g.RegisteredLayoutings = LayoutingType.None;
g.RegisterForLayouting (LayoutingType.Sizing);
}
public void DeleteWidget(GraphicObject g)
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)
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 ());
#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)