From: jpbruyere Date: Sun, 7 Feb 2016 15:57:05 +0000 (+0100) Subject: code clean X-Git-Tag: 0.3~42^2~1 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=d78137f051fb9e5435b6c0288fca0e0a759af8b1;p=jp%2Fcrow.git code clean --- diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index d04c94d7..88af16dd 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -469,7 +469,7 @@ namespace Crow public virtual void registerClipRect() { HostContainer.redrawClip.AddRectangle (ScreenCoordinates(Slot)); - //this clipping should take only last painted slots in ancestor tree which + //this clipping should take only last painted slots on each level in ancestor tree which //is not the case for now. HostContainer.redrawClip.AddRectangle (ScreenCoordinates(LastPaintedSlot)); } @@ -531,6 +531,7 @@ namespace Crow Debug.WriteLine ("RegisterForLayouting => {1}->{0}", layoutType, this.ToString()); #endif + //enqueue LQI LayoutingTypes separately if (layoutType.HasFlag (LayoutingType.Width)) Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Width, this)); if (layoutType.HasFlag (LayoutingType.Height)) @@ -728,7 +729,6 @@ namespace Crow onDraw (gr); } draw.Flush (); - //draw.WriteToPng ("/mnt/data/test.png"); } } /// Chained painting routine on the parent context of the actual cached version diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index 9006191d..8737b866 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -14,9 +14,7 @@ namespace Crow { #region CTOR public Group() - : base() - { - } + : base(){} #endregion #region EVENT HANDLERS @@ -35,7 +33,6 @@ namespace Crow public virtual List Children { get { return children; } - set { children = value; } } [XmlAttributeAttribute()][DefaultValue(false)] public bool MultiSelect @@ -64,14 +61,12 @@ namespace Crow } public virtual void ClearChildren() { - int cpt = children.Count; - while(cpt > 0){ - GraphicObject g = children[cpt-1]; + while(children.Count > 0){ + GraphicObject g = children[children.Count-1]; g.LayoutChanged -= OnChildLayoutChanges; g.ClearBinding (); g.Parent = null; - Children.RemoveAt(cpt-1); - cpt = children.Count; + Children.RemoveAt(children.Count-1); } this.RegisterForLayouting (LayoutingType.Sizing); ChildrenCleared.Raise (this, new EventArgs ()); diff --git a/src/GraphicObjects/ListBox.cs b/src/GraphicObjects/ListBox.cs index 788d835f..dfa248cf 100644 --- a/src/GraphicObjects/ListBox.cs +++ b/src/GraphicObjects/ListBox.cs @@ -100,9 +100,9 @@ namespace Crow foreach (var item in data) { ms.Seek(0,SeekOrigin.Begin); GraphicObject g = Interface.Load (ms, t); - g.DataSource = item; g.MouseClick += itemClick; _list.addChild (g); + g.DataSource = item; } ms.Dispose (); diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs index ef787d35..a263f5fc 100644 --- a/src/LayoutingQueueItem.cs +++ b/src/LayoutingQueueItem.cs @@ -51,18 +51,21 @@ namespace Crow public void ProcessLayouting() { - #if DEBUG_LAYOUTING - Debug.WriteLine ("Layouting => " + this.ToString ()); - #endif - if (GraphicObject.Parent == null) { //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 ()); return; } - if (!GraphicObject.UpdateLayout (LayoutType)) - Interface.LayoutingQueue.Enqueue(this); + if (!GraphicObject.UpdateLayout (LayoutType)) { + #if DEBUG_LAYOUTING + Debug.WriteLine ("Requeuing => " + this.ToString ()); + #endif + Interface.LayoutingQueue.Enqueue (this); + }else + #if DEBUG_LAYOUTING + Debug.WriteLine ("Layouting => " + this.ToString ()); + #endif } public static implicit operator GraphicObject(LayoutingQueueItem queueItem)