diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-07 17:17:40 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-07 17:17:40 +0100 |
| commit | bdbb1ebbffd96735b901e77b07d0e586270b0469 (patch) | |
| tree | 43a24ade2006bfe1712fc54904c17b6801864d0f /src | |
| parent | 31a67ec22a1d083ffaee818ad18b6b1ab26426fb (diff) | |
debug
Diffstat (limited to 'src')
| -rw-r--r-- | src/LayoutingQueueItem.cs | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs index 80d04dc6..a558efd2 100644 --- a/src/LayoutingQueueItem.cs +++ b/src/LayoutingQueueItem.cs @@ -24,8 +24,9 @@ using System.Collections.Generic; namespace Crow { - public enum LayoutingType + public enum LayoutingType : byte { + None = 0x00, X = 0x01, Y = 0x02, Width = 0x04, @@ -45,21 +46,26 @@ namespace Crow { LayoutType = _layoutType; GraphicObject = _graphicObject; + GraphicObject.RegisteredLayoutings |= LayoutType; } public void ProcessLayouting() { - #if DEBUG_LAYOUTING - Debug.WriteLine ("Layouting => " + this.ToString ()); - #endif - try { - if (GraphicObject.Parent == null){ - Debug.WriteLine("ERROR: processLayouting, no parent for: " + GraphicObject.ToString()); - return; - } - GraphicObject.UpdateLayout (LayoutType); - } catch (Exception ex) { - Debug.WriteLine ("Layouting error: " + ex.ToString ()); + 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)) { + #if DEBUG_LAYOUTING + Debug.WriteLine ("Requeuing => " + this.ToString ()); + #endif + Interface.LayoutingQueue.Enqueue (this); + } else { + #if DEBUG_LAYOUTING + Debug.WriteLine ("Layouting => " + this.ToString ()); + #endif } } |