IMLStream itemStream = null;
Type dataType = data [i].GetType ();
- if (itemTemplates.ContainsKey (dataType.FullName)) {
+ if (itemTemplates.ContainsKey (dataType.FullName))
itemStream = itemTemplates [dataType.FullName];
- } else {
+ else
itemStream = itemTemplates ["default"];
- }
- lock (Interface.CurrentInterface.UpdateMutex) {
+ lock (Interface.CurrentInterface.LayoutMutex) {
g = Interface.Load (itemStream);
page.AddChild (g);
g.DataSource = data [i];
//g.LogicalParent = this;
}
- lock (Interface.CurrentInterface.UpdateMutex)
+ lock (Interface.CurrentInterface.LayoutMutex)
_list.AddChild (page);
#if DEBUG_LOAD
public const int MaxCacheSize = 2048;
/// <summary> Above this count, the layouting is discard for the widget and it
/// will not be rendered on screen </summary>
- public const int MaxLayoutingTries = 50;
+ public const int MaxLayoutingTries = 5;
+ public const int MaxDiscardCount = 10;
/// <summary> Global font rendering settings for Cairo </summary>
public static FontOptions FontRenderingOptions;
#endregion
internal bool XmlLoading = false;
public Queue<LayoutingQueueItem> LayoutingQueue = new Queue<LayoutingQueueItem> ();
+ public Queue<LayoutingQueueItem> DiscardQueue;
public Queue<LayoutingQueueItem> ProcessedLayoutingQueue;
public Queue<GraphicObject> DrawingQueue = new Queue<GraphicObject>();
public string Clipboard;//TODO:use object instead for complex copy paste
{
// if (g.RegisteredLayoutings != LayoutingType.None)
// return;
+ ILayoutable l = g;
+ while (l.Parent != null)
+ l = l.Parent;
+ if (!(l is Interface))
+ return;
+
lock (DrawingQueue) {
if (g.IsQueueForRedraw)
return;
#if MEASURE_TIME
layoutTime.Restart();
#endif
+ DiscardQueue = new Queue<LayoutingQueueItem> ();
lock (LayoutMutex) {
//Debug.WriteLine ("======= Layouting queue start =======");
LayoutingQueueItem lqi = null;
- while (Interface.CurrentInterface.LayoutingQueue.Count > 0) {
- lqi = Interface.CurrentInterface.LayoutingQueue.Dequeue ();
+ while (LayoutingQueue.Count > 0) {
+ lqi = LayoutingQueue.Dequeue ();
lqi.ProcessLayouting ();
}
+ LayoutingQueue = DiscardQueue;
}
+ DiscardQueue = null;
#if MEASURE_TIME
layoutTime.Stop ();
/// <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;
+ public int LayoutingTries, DiscardCount;
#region CTOR
public LayoutingQueueItem (LayoutingType _layoutType, ILayoutable _graphicObject)
Debug.WriteLine ("Layouting => " + this.ToString ());
#endif
if (!GraphicObject.UpdateLayout (LayoutType)) {
- #if DEBUG_LAYOUTING
- Debug.WriteLine ("\tRequeuing => " + this.ToString ());
- #endif
- LayoutingTries ++;
if (LayoutingTries < Interface.MaxLayoutingTries) {
+ #if DEBUG_LAYOUTING
+ Debug.WriteLine ("\tRequeuing => " + this.ToString ());
+ #endif
+ LayoutingTries++;
GraphicObject.RegisteredLayoutings |= LayoutType;
Interface.CurrentInterface.LayoutingQueue.Enqueue (this);
+ } else if (DiscardCount < Interface.MaxDiscardCount) {
+ #if DEBUG_LAYOUTING
+ Debug.WriteLine ("\tDiscarding => " + this.ToString ());
+ #endif
+ LayoutingTries = 0;
+ DiscardCount++;
+ GraphicObject.RegisteredLayoutings |= LayoutType;
+ Interface.CurrentInterface.DiscardQueue.Enqueue (this);
}
- } else
+ //#if DEBUG_LAYOUTING
+ else
+ Debug.WriteLine ("\tDELETED => " + this.ToString ());
+ //#endif
+ } else {
+ DiscardCount = 0;
LayoutingTries = 0;
+ }
}
public static implicit operator GraphicObject(LayoutingQueueItem queueItem)