]> O.S.I.I.S - jp/crow.git/commitdiff
split update registration and user
authorjpbruyere <jp.bruyere@hotmail.com>
Sat, 5 Mar 2016 09:44:15 +0000 (10:44 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Sat, 5 Mar 2016 09:44:15 +0000 (10:44 +0100)
24 files changed:
MonoDevelop.GOLib/src/GOLibGtkHost.cs
Tests/GOLIBTestsOTK.cs
UnitTest/NUnitCrowWindow.cs
src/GraphicObjects/Border.cs
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Grid.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/ILayoutable.cs
src/GraphicObjects/Image.cs
src/GraphicObjects/Label.cs
src/GraphicObjects/NumericControl.cs
src/GraphicObjects/PrivateContainer.cs
src/GraphicObjects/ScrollBar.cs
src/GraphicObjects/Scroller.cs
src/GraphicObjects/Slider.cs
src/GraphicObjects/Splitter.cs
src/GraphicObjects/TabItem.cs
src/GraphicObjects/TabView.cs
src/GraphicObjects/TextBox.cs
src/GraphicObjects/TextRun.cs
src/GraphicObjects/Trend.cs
src/Interface.cs
src/LayoutingQueueItem.cs

index 905d9d2633b34072bb2e1602363250ce06d986e2..0069e3e7a21967cc1bbf18cfad2bf3f8d94285e2 100644 (file)
@@ -41,7 +41,7 @@ namespace MonoDevelop.GOLib
                }
                public void OnChanged (object obj)
                {
-                       (obj as GraphicObject).registerForGraphicUpdate ();
+                       (obj as GraphicObject).RegisterForGraphicUpdate ();
                        QueueDraw ();
                }
                #endregion
@@ -267,8 +267,8 @@ namespace MonoDevelop.GOLib
                        }
 
                        //Debug.WriteLine ("======= Layouting queue start =======");
-                       while (Interface.LayoutingQueue.Count > 0) {
-                               LayoutingQueueItem lqi = Interface.LayoutingQueue.Dequeue ();
+                       while (Interface.CurrentInterface.LayoutingQueue.Count > 0) {
+                               LayoutingQueueItem lqi = Interface.CurrentInterface.LayoutingQueue.Dequeue ();
                                lqi.ProcessLayouting ();
                        }
 
@@ -492,7 +492,7 @@ namespace MonoDevelop.GOLib
                        set { throw new NotImplementedException ();     }
                }
 
-               public void RegisterForLayouting (int layoutType)
+               public void EnqueueForLayouting (int layoutType)
                {
                        throw new NotImplementedException ();
                }
index a9416c207fef4b67bdfd0f66a94262c393c4cdc9..4256120b7bbcaebba87a8da25652440c8e4497c2 100644 (file)
@@ -77,7 +77,7 @@ namespace testOTK
                };
 
 
-               volatile public int intValue = 25;
+               public int intValue = 25;
 
                public int IntValue {
                        get {
@@ -99,7 +99,7 @@ namespace testOTK
                                return;
                        NotifyValueChanged ("alignment", Enum.Parse(typeof(Alignment), rb.Caption));
                }
-               volatile public IList<String> List2 = new List<string>(new string[]
+               public IList<String> List2 = new List<string>(new string[]
                        {
                                "string1",
                                "string2",
@@ -117,7 +117,7 @@ namespace testOTK
                                "string9"
                        }
                );
-               volatile IList<Color> testList = Color.ColorDic.ToList();
+               IList<Color> testList = Color.ColorDic.ToList();
                public IList<Color> TestList {
                        set{
                                testList = value;
@@ -135,9 +135,8 @@ namespace testOTK
                        //this.AddWidget(new test4());
                        KeyboardKeyDown += GOLIBTests_KeyboardKeyDown1;;
 
-                       CrowInterface.LoadInterfaceDelegate.Invoke ("Interfaces/" + testFiles [idx]);
-                       //GraphicObject obj = CrowInterface.LoadInterface("Interfaces/" + testFiles[idx]);
-                       //obj.DataSource = this;
+                       GraphicObject obj = CrowInterface.LoadInterface("Interfaces/" + testFiles[idx]);
+                       obj.DataSource = this;
 
                }
                void GOLIBTests_KeyboardKeyDown1 (object sender, OpenTK.Input.KeyboardKeyEventArgs e)
index 961001e79525bef3f6d9a2b5b45807030cfa0056..0a4a9edcb9c70f02c3b8f4392b8eab8f8a66ff31 100644 (file)
@@ -75,7 +75,7 @@ namespace Crow
                        {
                                GraphicObjects.Remove(g);
                                GraphicObjects.Insert(0, g);
-                               g.RegisterForRedraw ();
+                               g.AddToRedrawList ();
                        }
                }
                public void Quit ()
@@ -153,8 +153,8 @@ namespace Crow
 
                        //Debug.WriteLine ("======= Layouting queue start =======");
 
-                       while (Interface.LayoutingQueue.Count > 0) {
-                               LayoutingQueueItem lqi = Interface.LayoutingQueue.Dequeue ();
+                       while (Interface.CurrentInterface.LayoutingQueue.Count > 0) {
+                               LayoutingQueueItem lqi = Interface.CurrentInterface.LayoutingQueue.Dequeue ();
                                lqi.ProcessLayouting ();
                        }
 
@@ -167,7 +167,7 @@ namespace Crow
                        gobjsToRedraw.CopyTo (gotr);
                        gobjsToRedraw.Clear ();
                        foreach (GraphicObject p in gotr) {
-                               p.IsQueuedForRedraw = false;
+                               p.IsInRedrawList = false;
                                p.Parent.RegisterClip (p.LastPaintedSlot);
                                p.Parent.RegisterClip (p.getSlot());
                        }
@@ -430,7 +430,7 @@ namespace Crow
                public void RegisterClip(Rectangle r){
                        clipping.AddRectangle (r);
                }
-               public void RegisterForLayouting (LayoutingType layoutType)
+               public void EnqueueForLayouting (LayoutingType layoutType)
                {
                        throw new NotImplementedException ();
                }                       
@@ -446,11 +446,11 @@ namespace Crow
                        get { return null; }
                        set { throw new NotImplementedException (); }
                }
-               public LayoutingType RegisteredLayoutings {
+               public LayoutingType QueuedLayoutings {
                        get { return LayoutingType.None; }
                        set { throw new NotImplementedException (); } 
                }
-               public void RegisterForLayouting (int layoutType) { throw new NotImplementedException (); }
+               public void EnqueueForLayouting (int layoutType) { throw new NotImplementedException (); }
                public bool UpdateLayout (LayoutingType layoutType) { throw new NotImplementedException (); }
                public Rectangle ContextCoordinates (Rectangle r) => r;
                public Rectangle ScreenCoordinates (Rectangle r) => r;
index be08a7d81683473115050a7cd10267dea11a70ad..c635572677fd86447a426acf331adb3c445b5625 100644 (file)
@@ -21,7 +21,7 @@ namespace Crow
                        get { return _borderWidth; }
                        set {
                                _borderWidth = value;
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue("White")]
index 2a1da6c311615a79346332a83a9d36e5174db6b0..897343b3f1a650923dd492d278cc120223c7dd96 100644 (file)
@@ -62,7 +62,7 @@ namespace Crow
                                                foreach (GraphicObject c in Children) {
                                                        if (!c.Visible)
                                                                continue;
-                                                       if (c.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                                                       if (c.QueuedLayoutings.HasFlag (LayoutingType.Width))
                                                                return -1;
                                                        tmp += c.Slot.Width + Spacing;
                                                }
@@ -77,7 +77,7 @@ namespace Crow
                                                foreach (GraphicObject c in Children) {
                                                        if (!c.Visible)
                                                                continue;
-                                                       if (c.RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                                                       if (c.QueuedLayoutings.HasFlag (LayoutingType.Height))
                                                                return -1;
                                                        tmp += c.Slot.Height + Spacing;
                                                }
@@ -99,7 +99,7 @@ namespace Crow
                                                continue;
                                        c.Slot.X = d;
                                        d += c.Slot.Width + Spacing;
-                                       c.RegisterForLayouting (LayoutingType.Y);
+                                       c.EnqueueForLayouting (LayoutingType.Y);
                                }
                        } else {
                                foreach (GraphicObject c in Children) {
@@ -107,7 +107,7 @@ namespace Crow
                                                continue;                                       
                                        c.Slot.Y = d;
                                        d += c.Slot.Height + Spacing;
-                                       c.RegisterForLayouting (LayoutingType.X);
+                                       c.EnqueueForLayouting (LayoutingType.X);
                                }
                        }
                        bmp = null;
@@ -115,7 +115,7 @@ namespace Crow
                        
                public override bool UpdateLayout (LayoutingType layoutType)
         {
-                       RegisteredLayoutings &= (~layoutType);
+                       QueuedLayoutings &= (~layoutType);
 
                        if (layoutType == LayoutingType.ArrangeChildren) {
                                //allow 1 child to have size to 0 if stack has fixed or streched size policy,
@@ -130,7 +130,7 @@ namespace Crow
                                                if (!Children [i].Visible)
                                                        continue;
                                                //requeue Positionning if child is not layouted
-                                               if (Children [i].RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                                               if (Children [i].QueuedLayoutings.HasFlag (LayoutingType.Width))
                                                        return false;
                                                cptChildren++;
                                                if (Children [i].Width == 0) {
@@ -169,7 +169,7 @@ namespace Crow
                                        for (int i = 0; i < Children.Count; i++) {
                                                if (!Children [i].Visible)
                                                        continue;
-                                               if (Children [i].RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                                               if (Children [i].QueuedLayoutings.HasFlag (LayoutingType.Height))
                                                        return false;
                                                cptChildren++;
                                                if (Children [i].Height == 0) {
@@ -205,8 +205,8 @@ namespace Crow
                                ComputeChildrenPositions ();
 
                                //if no layouting remains in queue for item, registre for redraw
-                               if (RegisteredLayoutings == LayoutingType.None && bmp==null)
-                                       this.RegisterForRedraw ();
+                               if (QueuedLayoutings == LayoutingType.None && bmp==null)
+                                       this.AddToRedrawList ();
 
                                return true;
                        }
@@ -223,15 +223,15 @@ namespace Crow
                        case LayoutingType.Width:
                                if (Orientation == Orientation.Horizontal) {
                                        if (this.Bounds.Width < 0)
-                                               this.RegisterForLayouting (LayoutingType.Width);
-                                       this.RegisterForLayouting (LayoutingType.ArrangeChildren);
+                                               this.EnqueueForLayouting (LayoutingType.Width);
+                                       this.EnqueueForLayouting (LayoutingType.ArrangeChildren);
                                }
                                break;
                        case LayoutingType.Height:
                                if (Orientation == Orientation.Vertical) {
                                        if (this.Bounds.Height < 0)
-                                               this.RegisterForLayouting (LayoutingType.Height);
-                                       this.RegisterForLayouting (LayoutingType.ArrangeChildren);
+                                               this.EnqueueForLayouting (LayoutingType.Height);
+                                       this.EnqueueForLayouting (LayoutingType.ArrangeChildren);
                                }
                                break;
                        }
index 2bce334921cb45697fb3f6a5bfefe5cddc67238e..1909b07db43e5472255fbe710ca36c27497250a2 100644 (file)
@@ -57,7 +57,7 @@ namespace Crow
                #endregion
 
                #region private fields
-               LayoutingType registeredLayoutings = LayoutingType.None;
+               LayoutingType queuedLayoutings = LayoutingType.None;
                ILayoutable logicalParent;
                ILayoutable _parent;
                string _name = "unamed";
@@ -101,12 +101,13 @@ namespace Crow
                /// IDEA is to add a ScreenCoordinates function that use only lastPaintedSlots
                /// </summary>
                public Rectangle LastPaintedSlot;
+               public LayoutingType RegisteredLayoutings = LayoutingType.None;
                public object Tag;
                public byte[] bmp;
                #endregion
 
                #region ILayoutable
-               [XmlIgnore]public LayoutingType RegisteredLayoutings { get { return registeredLayoutings; } set { registeredLayoutings = value; } }
+               [XmlIgnore]public LayoutingType QueuedLayoutings { get { return queuedLayoutings; } set { queuedLayoutings = value; } }
                //TODO: it would save the recurent cost of a cast in event bubbling if parent type was GraphicObject
                //              or we could add to the interface the mouse events
                /// <summary>
@@ -317,7 +318,7 @@ namespace Crow
                                        return;
                                _background = value;
                                NotifyValueChanged ("Background", _background);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue("White")]
@@ -328,7 +329,7 @@ namespace Crow
                                        return;
                                _foreground = value;
                                NotifyValueChanged ("Foreground", _foreground);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue("droid,10")]
@@ -339,7 +340,7 @@ namespace Crow
                                        return;
                                _font = value;
                                NotifyValueChanged ("Font", _font);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(0.0)]
@@ -350,7 +351,7 @@ namespace Crow
                                        return;
                                _cornerRadius = value;
                                NotifyValueChanged ("CornerRadius", _cornerRadius);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(0)]
@@ -361,7 +362,7 @@ namespace Crow
                                        return;
                                _margin = value;
                                NotifyValueChanged ("Margin", _margin);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(true)]
@@ -381,12 +382,12 @@ namespace Crow
                                        Interface.CurrentInterface.hoverWidget = null;
 
                                if (Parent is GraphicObject)
-                                       Parent.RegisterForLayouting (LayoutingType.Sizing);
+                                       (Parent as GraphicObject).RegisterForLayouting (LayoutingType.Sizing);
                                if (Parent is GenericStack)
-                                       Parent.RegisterForLayouting (LayoutingType.ArrangeChildren);
-                               RegisterForLayouting (LayoutingType.Sizing);
+                                       (Parent as GraphicObject).RegisterForLayouting (LayoutingType.ArrangeChildren);
 
-                               RegisterForRedraw ();
+                               RegisterForLayouting (LayoutingType.Sizing);
+                               RegisterForGraphicUpdate ();
 
                                NotifyValueChanged ("Visible", _isVisible);
                        }
@@ -628,27 +629,25 @@ namespace Crow
                                Clipping.AddRectangle (clip + ClientRectangle.Position);
                        Parent.RegisterClip (clip + Slot.Position + ClientRectangle.Position);
                }
+               public bool IsQueueForGraphicUpdate = false;
                /// <summary>
                /// Clear chached object and add clipping region in redraw list of interface
                /// </summary>
-               public virtual void registerForGraphicUpdate ()
+               public void RegisterForGraphicUpdate ()
                {
-                       bmp = null;
-                       RegisterForRedraw ();
+                       Interface.RegisterForGraphicUpdate (this);
                }
-               public bool IsQueuedForRedraw = false;
+               public void RegisterForLayouting(LayoutingType lt)
+               {
+                       Interface.RegisterForLayouting (this, lt);
+               }
+               internal bool IsInRedrawList = false;
                /// <summary>
                /// Add clipping region in redraw list of interface, dont update cached object content
                /// </summary>
-               public virtual void RegisterForRedraw ()
+               internal void AddToRedrawList ()
                {
-                       if (IsQueuedForRedraw)
-                               return;
-                       if (Interface.CurrentInterface == null)
-                               return;
-                       lock(Interface.CurrentInterface.RenderMutex)
-                               Interface.CurrentInterface.gobjsToRedraw.Add (this);
-                       IsQueuedForRedraw = true;
+                       Interface.AddToRedrawList (this);
                }
 
                #region Layouting
@@ -665,7 +664,7 @@ namespace Crow
 
                }
                public virtual bool ArrangeChildren { get { return false; } }
-               public virtual void RegisterForLayouting(LayoutingType layoutType){
+               public virtual void EnqueueForLayouting(LayoutingType layoutType){
                        if (Parent == null)
                                return;
                        //dont set position for stretched item
@@ -682,7 +681,7 @@ namespace Crow
                                (Parent as GraphicObject).ChildrenLayoutingConstraints (ref layoutType);
 
                        //prevent queueing same LayoutingType for this
-                       layoutType &= (~RegisteredLayoutings);
+                       layoutType &= (~QueuedLayoutings);
 
                        if (layoutType == LayoutingType.None)
                                return;
@@ -691,19 +690,17 @@ namespace Crow
                        Debug.WriteLine ("REGLayout => {1}->{0}", layoutType, this.ToString());
                        #endif
 
-                       lock (Interface.LayoutingQueue) {
-                               //enqueue LQI LayoutingTypes separately
-                               if (layoutType.HasFlag (LayoutingType.Width))
-                                       Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Width, this));
-                               if (layoutType.HasFlag (LayoutingType.Height))
-                                       Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Height, this));
-                               if (layoutType.HasFlag (LayoutingType.X))
-                                       Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.X, this));
-                               if (layoutType.HasFlag (LayoutingType.Y))
-                                       Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Y, this));
-                               if (layoutType.HasFlag (LayoutingType.ArrangeChildren))
-                                       Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.ArrangeChildren, this));
-                       }
+                       //enqueue LQI LayoutingTypes separately
+                       if (layoutType.HasFlag (LayoutingType.Width))
+                               Interface.CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Width, this));
+                       if (layoutType.HasFlag (LayoutingType.Height))
+                               Interface.CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Height, this));
+                       if (layoutType.HasFlag (LayoutingType.X))
+                               Interface.CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.X, this));
+                       if (layoutType.HasFlag (LayoutingType.Y))
+                               Interface.CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Y, this));
+                       if (layoutType.HasFlag (LayoutingType.ArrangeChildren))
+                               Interface.CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.ArrangeChildren, this));               
                }
 
                /// <summary> trigger dependant sizing component update </summary>
@@ -715,10 +712,10 @@ namespace Crow
 
                        switch (layoutType) {
                        case LayoutingType.Width:
-                               this.RegisterForLayouting (LayoutingType.X);
+                               EnqueueForLayouting (LayoutingType.X);
                                break;
                        case LayoutingType.Height:
-                               this.RegisterForLayouting (LayoutingType.Y);
+                               EnqueueForLayouting (LayoutingType.Y);
                                break;
                        }
                        LayoutChanged.Raise (this, new LayoutingEventArgs (layoutType));
@@ -731,14 +728,14 @@ namespace Crow
                public virtual bool UpdateLayout (LayoutingType layoutType)
                {
                        //unset bit, it would be reset if LQI is re-queued
-                       registeredLayoutings &= (~layoutType);
+                       queuedLayoutings &= (~layoutType);
 
                        switch (layoutType) {
                        case LayoutingType.X:
                                if (Bounds.X == 0) {
 
-                                       if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width) ||
-                                               RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                                       if (Parent.QueuedLayoutings.HasFlag (LayoutingType.Width) ||
+                                               QueuedLayoutings.HasFlag (LayoutingType.Width))
                                                return false;
 
                                        switch (HorizontalAlignment) {
@@ -767,8 +764,8 @@ namespace Crow
                        case LayoutingType.Y:
                                if (Bounds.Y == 0) {
 
-                                       if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height) ||
-                                               RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                                       if (Parent.QueuedLayoutings.HasFlag (LayoutingType.Height) ||
+                                               QueuedLayoutings.HasFlag (LayoutingType.Height))
                                                return false;
 
                                        switch (VerticalAlignment) {
@@ -799,7 +796,7 @@ namespace Crow
                                        Slot.Width = Width;
                                else if (Width < 0) {
                                        Slot.Width = measureRawSize (LayoutingType.Width);
-                               }else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                               }else if (Parent.QueuedLayoutings.HasFlag (LayoutingType.Width))
                                        return false;
                                else
                                        Slot.Width = Parent.ClientRectangle.Width;
@@ -824,7 +821,7 @@ namespace Crow
                                        Slot.Height = Height;
                                else if (Height < 0){
                                        Slot.Height = measureRawSize (LayoutingType.Height);
-                               }else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                               }else if (Parent.QueuedLayoutings.HasFlag (LayoutingType.Height))
                                        return false;
                                else
                                        Slot.Height = Parent.ClientRectangle.Height;
@@ -847,8 +844,8 @@ namespace Crow
                        }
 
                        //if no layouting remains in queue for item, registre for redraw
-                       if (this.registeredLayoutings == LayoutingType.None && bmp == null)
-                               this.RegisterForRedraw ();
+                       if (this.queuedLayoutings == LayoutingType.None && bmp == null)
+                               this.AddToRedrawList ();
 
                        return true;
                }
index 281f4ae0c51e9aa0bbdb9929c8258f29e748e280..e13690a7999d64f6b68b57a778b961847913accc 100644 (file)
@@ -128,15 +128,15 @@ namespace Crow
 
                public override bool UpdateLayout (LayoutingType layoutType)
                {
-                       RegisteredLayoutings &= (~layoutType);
+                       QueuedLayoutings &= (~layoutType);
 
                        if (layoutType == LayoutingType.ArrangeChildren) {                              
 
                                ComputeChildrenPositions ();
 
                                //if no layouting remains in queue for item, registre for redraw
-                               if (RegisteredLayoutings == LayoutingType.None && bmp==null)
-                                       this.RegisterForRedraw ();
+                               if (QueuedLayoutings == LayoutingType.None && bmp==null)
+                                       this.AddToRedrawList ();
                                
                                return true;
                        }
index 869ec11378a65f7170fb88be6391f0e0ea67dad4..3b2c138022569c1f901fcc59d8b301fb47c0ead6 100644 (file)
@@ -162,14 +162,14 @@ namespace Crow
                                foreach (GraphicObject c in Children) {
                                        if (!c.Visible)
                                                continue;                                       
-                                       c.RegisterForLayouting (LayoutingType.X | LayoutingType.Width);
+                                       c.EnqueueForLayouting (LayoutingType.X | LayoutingType.Width);
                                }
                                break;
                        case LayoutingType.Height:
                                foreach (GraphicObject c in Children) {
                                        if (!c.Visible)
                                                continue;
-                                       c.RegisterForLayouting (LayoutingType.Y | LayoutingType.Height);                                }
+                                       c.EnqueueForLayouting (LayoutingType.Y | LayoutingType.Height);                         }
                                break;
                        }
                }
@@ -182,14 +182,14 @@ namespace Crow
                                        maxChildrenWidth = g.Slot.Width;
                                        largestChild = g;
                                        if (this.Bounds.Width < 0)
-                                               this.RegisterForLayouting (LayoutingType.Width);
+                                               this.EnqueueForLayouting (LayoutingType.Width);
                                } else if (g == largestChild) {
 
                                        largestChild = null;
                                        maxChildrenWidth = 0;
 
                                        if (this.Bounds.Width < 0)
-                                               this.RegisterForLayouting (LayoutingType.Width);
+                                               this.EnqueueForLayouting (LayoutingType.Width);
                                }
                                break;
                        case LayoutingType.Height:
@@ -197,14 +197,14 @@ namespace Crow
                                        maxChildrenHeight = g.Slot.Height;
                                        tallestChild = g;
                                        if (this.Bounds.Height < 0)
-                                               this.RegisterForLayouting (LayoutingType.Height);
+                                               this.EnqueueForLayouting (LayoutingType.Height);
                                } else if (g == tallestChild) {
 
                                        tallestChild = null;
                                        maxChildrenHeight = 0;
 
                                        if (this.Bounds.Height < 0)
-                                               this.RegisterForLayouting (LayoutingType.Height);
+                                               this.EnqueueForLayouting (LayoutingType.Height);
                                }
                                break;
                        }
@@ -226,7 +226,7 @@ namespace Crow
                        for (int i = 0; i < Children.Count; i++) {
                                if (!Children [i].Visible)
                                        continue;
-                               if (children [i].RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                               if (children [i].QueuedLayoutings.HasFlag (LayoutingType.Width))
                                        continue;
                                if (Children [i].Slot.Width > maxChildrenWidth) {
                                        maxChildrenWidth = Children [i].Slot.Width;
@@ -243,7 +243,7 @@ namespace Crow
                        for (int i = 0; i < Children.Count; i++) {
                                if (!Children [i].Visible)
                                        continue;
-                               if (children [i].RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                               if (children [i].QueuedLayoutings.HasFlag (LayoutingType.Height))
                                        continue;
                                if (Children [i].Slot.Height > maxChildrenHeight) {
                                        maxChildrenHeight = Children [i].Slot.Height;
index a8df3ae0a453c320a361f54bc316b9970c0c3a75..77f9409bea0d7db12fbffc137cbb15e7557487b7 100644 (file)
@@ -18,8 +18,8 @@ namespace Crow
                Rectangle getBounds();
 
                bool ArrangeChildren { get; }
-               LayoutingType RegisteredLayoutings { get; set; }
-               void RegisterForLayouting(LayoutingType layoutType);
+               LayoutingType QueuedLayoutings { get; set; }
+               void EnqueueForLayouting(LayoutingType layoutType);
                void RegisterClip(Rectangle clip);
                bool UpdateLayout(LayoutingType layoutType);
 
index 8f02a19e3360b05b62ba4c542a045950f4136035..61b6e0593b90394e3c346f67bc9c00deecf26c97 100644 (file)
@@ -23,7 +23,7 @@ namespace Crow
                                if (_pic == null)
                                        return;
                                _pic.Scaled = scaled;
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                } 
                bool keepProps;
@@ -38,7 +38,7 @@ namespace Crow
                                if (_pic == null)
                                        return;
                                _pic.KeepProportions = keepProps;
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                } 
         [XmlAttributeAttribute("Path")]        
@@ -65,7 +65,7 @@ namespace Crow
                        get { return _svgSub; }
                        set {
                                _svgSub = value;
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                        
@@ -85,7 +85,7 @@ namespace Crow
                                _pic = new BmpPicture ();
 
                        _pic.LoadImage (path);
-                       registerForGraphicUpdate ();
+                       RegisterForGraphicUpdate ();
                        RegisterForLayouting (LayoutingType.Sizing);
                }
                #endregion
index fa2d582803fedc745850730812a61dd2ac022f6a..ebc18f767c294edebb6ca168e3c1d7a47f204a84 100644 (file)
@@ -61,7 +61,7 @@ namespace Crow
                                        return;
                                selColor = value;
                                NotifyValueChanged ("SelectionBackground", selColor);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue("White")]
@@ -72,7 +72,7 @@ namespace Crow
                                        return;
                                selFontColor = value;
                                NotifyValueChanged ("SelectionForeground", selFontColor);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(Alignment.Left)]
@@ -83,8 +83,8 @@ namespace Crow
                                if (value == _textAlignment)
                                        return;
                                _textAlignment = value; 
-                               registerForGraphicUpdate ();
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                                NotifyValueChanged ("TextAlignment", _textAlignment);
                        }
         }
@@ -95,7 +95,7 @@ namespace Crow
                                if (horizontalStretch == value)
                                        return;
                                horizontalStretch = value; 
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                                NotifyValueChanged ("HorizontalStretch", horizontalStretch);
                        }
                }
@@ -129,7 +129,7 @@ namespace Crow
 
                                lines = getLines;
 
-                               this.registerForGraphicUpdate ();
+                               this.RegisterForGraphicUpdate ();
                                this.RegisterForLayouting (LayoutingType.Sizing);
                                NotifyValueChanged ("Text", _text);
             }
@@ -144,7 +144,7 @@ namespace Crow
                                        return;
                                _multiline = value;
                                NotifyValueChanged ("Multiline", _multiline);
-                               registerForGraphicUpdate();
+                               RegisterForGraphicUpdate();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(0)]
@@ -561,7 +561,7 @@ namespace Crow
 
                        SelBegin = new Point(0,0);
                        SelRelease = new Point (lines.LastOrDefault ().Length, lines.Count-1);
-                       registerForGraphicUpdate ();
+                       RegisterForGraphicUpdate ();
                }
                public override void onUnfocused (object sender, EventArgs e)
                {
@@ -569,7 +569,7 @@ namespace Crow
 
                        SelBegin = -1;
                        SelRelease = -1;
-                       registerForGraphicUpdate ();
+                       RegisterForGraphicUpdate ();
                }
                public override void onMouseMove (object sender, MouseMoveEventArgs e)
                {
@@ -580,7 +580,7 @@ namespace Crow
 
                        updatemouseLocalPos (e.Position);
 
-                       registerForGraphicUpdate();
+                       RegisterForGraphicUpdate();
                }
                public override void onMouseDown (object sender, MouseButtonEventArgs e)
                {                       
@@ -589,7 +589,7 @@ namespace Crow
                                SelBegin = -1;
                                SelRelease = -1;
                                SelectionInProgress = true;
-                               registerForGraphicUpdate();//TODO:should put it in properties
+                               RegisterForGraphicUpdate();//TODO:should put it in properties
                        }          
 
                        //done at the end to set 'hasFocus' value after testing it
@@ -604,7 +604,7 @@ namespace Crow
                        
                        updatemouseLocalPos (e.Position);
                        SelectionInProgress = false;
-                       registerForGraphicUpdate ();
+                       RegisterForGraphicUpdate ();
                }
                #endregion
                /// <summary>
index eb01815fb6f39ec2d0692c00e53fc8c3be770f21..0f74eb2dd66280f6890c49d1be6aa3e2ce576ac4 100644 (file)
@@ -30,7 +30,7 @@ namespace Crow
 
                                minValue = value;
                                NotifyValueChanged ("Minimum", minValue);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(100.0)]
@@ -43,7 +43,7 @@ namespace Crow
 
                                maxValue = value;
                                NotifyValueChanged ("Maximum", maxValue);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(1.0)]
@@ -56,7 +56,7 @@ namespace Crow
 
                                smallStep = value;
                                NotifyValueChanged ("SmallIncrement", smallStep);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(5.0)]
@@ -69,7 +69,7 @@ namespace Crow
 
                                bigStep = value;
                                NotifyValueChanged ("LargeIncrement", bigStep);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(0.0)]
@@ -89,7 +89,7 @@ namespace Crow
                                        _actualValue = value;
 
                                NotifyValueChanged("Value",  _actualValue);
-                               registerForGraphicUpdate();
+                               RegisterForGraphicUpdate();
                        }
                }
                #endregion
index 3a3d90671c22a504bd5668c5d07ccd2e80211d9f..1aa39633e7df87018a524854d2d56f8537d98820 100644 (file)
@@ -95,10 +95,10 @@ namespace Crow
                        if (child == null)
                                return base.measureRawSize (lt);
                        if (lt == LayoutingType.Width)
-                               return child.RegisteredLayoutings.HasFlag(LayoutingType.Width) ?
+                               return child.QueuedLayoutings.HasFlag(LayoutingType.Width) ?
                                        -1 : child.Slot.Size.Width + 2 * Margin;
                        else
-                               return child.RegisteredLayoutings.HasFlag(LayoutingType.Height) ?
+                               return child.QueuedLayoutings.HasFlag(LayoutingType.Height) ?
                                        -1 : child.Slot.Size.Height + 2 * Margin;                       
                }
                public override bool UpdateLayout (LayoutingType layoutType)
@@ -127,13 +127,13 @@ namespace Crow
                        case LayoutingType.Width:                                                               
                                if (child != null) {
                                        if (child.Visible)
-                                               child.RegisterForLayouting (LayoutingType.X | LayoutingType.Width);
+                                               child.EnqueueForLayouting (LayoutingType.X | LayoutingType.Width);
                                }
                                break;
                        case LayoutingType.Height:
                                if (child != null) {
                                        if (child.Visible)
-                                               child.RegisterForLayouting (LayoutingType.Y | LayoutingType.Height);
+                                               child.EnqueueForLayouting (LayoutingType.Y | LayoutingType.Height);
                                }
                                break;
                        }                                                       
@@ -148,11 +148,11 @@ namespace Crow
                                break;
                        case LayoutingType.Width:
                                if (this.Bounds.Width < 0)
-                                       this.RegisterForLayouting (LayoutingType.Width);
+                                       this.EnqueueForLayouting (LayoutingType.Width);
                                break;
                        case LayoutingType.Height:
                                if (this.Bounds.Height < 0)
-                                       this.RegisterForLayouting (LayoutingType.Height);
+                                       this.EnqueueForLayouting (LayoutingType.Height);
                                break;
                        }
                }
index d1ef12a34fab117c21060e8a5c393ae1cb17070e..ea75d6d18c4a63c4219dd97416dc68530105916d 100644 (file)
@@ -28,7 +28,7 @@ namespace Crow
                                        return;
                                _orientation = value;
                                NotifyValueChanged ("Orientation", _orientation);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                public void onScrollBack (object sender, MouseButtonEventArgs e)
index 58a0f245a26af5f05c3cd0e09358eaecc4c7046b..83b651033164e5ed7dcdc192c679b448299be078 100644 (file)
@@ -70,7 +70,7 @@ namespace Crow
                                else
                                        _scrollX = value;
                                NotifyValueChanged("ScrollX", _scrollX);
-                               RegisterForRedraw();
+                               RegisterForGraphicUpdate ();
                        }
                }                       
                [XmlAttributeAttribute][DefaultValue(0.0)]
@@ -88,7 +88,7 @@ namespace Crow
                                else
                                        _scrollY = value;
                                NotifyValueChanged("ScrollY", _scrollY);
-                               RegisterForRedraw();
+                               RegisterForGraphicUpdate ();
                        }
                }
 
index a96f2a401bdffbdf85ecaa60c1d57efb2ff4a2be..26720b1de254d98a2ea208ea7ed64d774428e0ef 100644 (file)
@@ -47,7 +47,7 @@ namespace Crow
                                if (_cursorColor == value)
                                        return;
                                _cursorColor = value;
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                                NotifyValueChanged ("CursorColor", _cursorColor);
                        }
                }
@@ -59,7 +59,7 @@ namespace Crow
                                        return;
                                _cursorSize = value;
                                RegisterForLayouting (LayoutingType.Sizing);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                                NotifyValueChanged ("CursorSize", _cursorSize);
                        }
                }
index 9372f1bc6e3079334ca6072edebb2ebeae9869d1..6a1f2254a0badc3c2b28a597533632f2b26c557d 100644 (file)
@@ -42,7 +42,7 @@ namespace Crow
                                thickness = value; 
                                NotifyValueChanged ("Thickness", thickness);
                                RegisterForLayouting (LayoutingType.Sizing);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                } 
                #region GraphicObject override
index c2d863af18e1053da53ea38c29f978ae5b64649c..9fd8180dd61a394d23c717fb3a77fd851cf3628d 100644 (file)
@@ -91,7 +91,7 @@ namespace Crow
                                NotifyValueChanged ("TabOffset", tabOffset);
 
                                RegisterForLayouting (LayoutingType.X);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue("TabItem")]
index 97ac4c6457d9e71ad65efe427ce6d0cb73003f8e..7ae5e3d3e1c231e2f73b9ab794265005d89b4b91 100644 (file)
@@ -77,7 +77,7 @@ namespace Crow
                                        (Children [selectedTab] as TabItem).IsSelected = true;
 
                                NotifyValueChanged ("SelectedTab", selectedTab);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                int tabThickness;
@@ -126,7 +126,7 @@ namespace Crow
                public override bool ArrangeChildren { get { return true; } }
                public override bool UpdateLayout (LayoutingType layoutType)
                {
-                       RegisteredLayoutings &= (~layoutType);
+                       QueuedLayoutings &= (~layoutType);
 
                        if (layoutType == LayoutingType.ArrangeChildren) {
                                int curOffset = Spacing;
@@ -136,19 +136,19 @@ namespace Crow
                                        TabItem ti = Children [i] as TabItem;
                                        ti.TabOffset = curOffset;
                                        if (Orientation == Orientation.Horizontal) {
-                                               if (ti.TabTitle.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                                               if (ti.TabTitle.QueuedLayoutings.HasFlag (LayoutingType.Width))
                                                        return false;
                                                curOffset += ti.TabTitle.Slot.Width + Spacing;
                                        } else {
-                                               if (ti.TabTitle.RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                                               if (ti.TabTitle.QueuedLayoutings.HasFlag (LayoutingType.Height))
                                                        return false;
                                                curOffset += ti.TabTitle.Slot.Height + Spacing;
                                        }
                                }
 
                                //if no layouting remains in queue for item, registre for redraw
-                               if (RegisteredLayoutings == LayoutingType.None && bmp==null)
-                                       this.RegisterForRedraw ();
+                               if (QueuedLayoutings == LayoutingType.None && bmp==null)
+                                       this.AddToRedrawList ();
 
                                return true;
                        }
index 7907eb422238c87c89db207ed5c6bb15a1a2d26b..14cc18304465adde738124e0f685fa83005a5201 100644 (file)
@@ -34,7 +34,7 @@ namespace Crow
             set
             {
                 base.HasFocus = value;
-                registerForGraphicUpdate();
+                RegisterForGraphicUpdate();
             }
         }
                [XmlAttributeAttribute()][DefaultValue(true)]
@@ -201,7 +201,7 @@ namespace Crow
                                RegisterForLayouting (LayoutingType.Width);
                        if (Height < 0)
                                RegisterForLayouting (LayoutingType.Height);
-                       registerForGraphicUpdate();
+                       RegisterForGraphicUpdate();
                }
         #endregion
        } 
index 0fa463af14fead0ffcc05c10c923ee9c01b9f1dc..15f024afc5f4ec8db0413dbe387d467dc69344d3 100644 (file)
@@ -55,7 +55,7 @@ namespace Crow
                                if (horizontalStretch == value)
                                        return;
                                horizontalStretch = value; 
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                                NotifyValueChanged ("HorizontalStretch", horizontalStretch);
                        }
                }
@@ -82,7 +82,7 @@ namespace Crow
                 if (_text == value)
                     return;
                                                        
-                registerForGraphicUpdate();
+                RegisterForGraphicUpdate();
                                this.RegisterForLayouting (LayoutingType.Sizing);
 
 
@@ -101,7 +101,7 @@ namespace Crow
                        set
                        {
                                _multiline = value;
-                               registerForGraphicUpdate();
+                               RegisterForGraphicUpdate();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(false)]
@@ -113,7 +113,7 @@ namespace Crow
                                if (wordWrap == value)
                                        return;
                                wordWrap = value;
-                               registerForGraphicUpdate();
+                               RegisterForGraphicUpdate();
                        }
                }
 
index 4813f3d6b84a50139f7e728c30907ed7682c25d6..e9ff4c0621f0e9d7eb6aacf304ff9e4098389620 100644 (file)
@@ -41,7 +41,7 @@ namespace Crow
                        values.Add (_value);
                        while (values.Count > nbValues)
                                values.RemoveAt (0);
-                       registerForGraphicUpdate ();
+                       RegisterForGraphicUpdate ();
                }
 
                public Trend ()
@@ -61,7 +61,7 @@ namespace Crow
 
                                nbValues = value;
                                NotifyValueChanged ("NbValues", minValue);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(0.0)]
@@ -73,7 +73,7 @@ namespace Crow
 
                                minValue = value;
                                NotifyValueChanged ("Minimum", minValue);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(100.0)]
@@ -86,7 +86,7 @@ namespace Crow
 
                                maxValue = value;
                                NotifyValueChanged ("Maximum", maxValue);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(20.0)]
@@ -97,7 +97,7 @@ namespace Crow
                                        return;
                                lowThreshold = value;
                                NotifyValueChanged ("LowThreshold", lowThreshold);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(80.0)]
@@ -108,7 +108,7 @@ namespace Crow
                                        return;
                                highThreshold = value;
                                NotifyValueChanged ("HighThreshold", highThreshold);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue("DarkRed")]
@@ -119,7 +119,7 @@ namespace Crow
                                        return;
                                lowThresholdFill = value;
                                NotifyValueChanged ("LowThresholdFill", lowThresholdFill);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                [XmlAttributeAttribute()][DefaultValue("DarkGreen")]
@@ -130,7 +130,7 @@ namespace Crow
                                        return;
                                highThresholdFill = value;
                                NotifyValueChanged ("HighThresholdFill", highThresholdFill);
-                               registerForGraphicUpdate ();
+                               RegisterForGraphicUpdate ();
                        }
                }
                protected override void onDraw (Cairo.Context gr)
index 6ff7f34695668f6f8f0a30f363504e5076da92fb..f1b01fd005b58a7bf1e0759ccb33804408ce995e 100644 (file)
@@ -77,7 +77,41 @@ namespace Crow
                public const int MaxLayoutingTries = 50;
                #endregion
 
-               public static Queue<LayoutingQueueItem> LayoutingQueue = new Queue<LayoutingQueueItem>();
+               public Queue<LayoutingQueueItem> LayoutingQueue = new Queue<LayoutingQueueItem>();
+               public Queue<GraphicObject> GraphicUpdateQueue = new Queue<GraphicObject>();
+               public Queue<GraphicObject> UpdateLayoutQueue = new Queue<GraphicObject>();
+
+               public static void RegisterForLayouting(GraphicObject g, LayoutingType lt){
+                       
+                       lock (CurrentInterface.UpdateLayoutQueue) {
+                               if (CurrentInterface == null)
+                                       return;
+                               if (g.RegisteredLayoutings == LayoutingType.None)
+                                       CurrentInterface.UpdateLayoutQueue.Enqueue (g);                         
+                               g.RegisteredLayoutings |= lt;
+                       }
+               }
+               public static void RegisterForGraphicUpdate(GraphicObject g)
+               {
+                       lock (CurrentInterface.GraphicUpdateQueue) {
+                               if (g.IsQueueForGraphicUpdate)
+                                       return;                 
+                               if (CurrentInterface == null)
+                                       return;
+                               CurrentInterface.GraphicUpdateQueue.Enqueue (g);
+                               g.IsQueueForGraphicUpdate = true;
+                       }
+               }
+               public static void AddToRedrawList(GraphicObject g)
+               {
+                       if (g.IsInRedrawList)
+                               return;
+                       if (Interface.CurrentInterface == null)
+                               return;
+                       Interface.CurrentInterface.RedrawList.Add (g);
+                       g.IsInRedrawList = true;        
+               }
+
                #region default values loading helpers
                public delegate void loadDefaultInvoker(object instance);
                public static Dictionary<String, loadDefaultInvoker> DefaultValuesLoader = new Dictionary<string, loadDefaultInvoker>();
@@ -204,12 +238,12 @@ namespace Crow
                }
 
                public GraphicObject LoadInterface (string path)
-               {
-                       lock (RenderMutex) {
+               {               
+                       lock (this) {   
                                GraphicObject tmp = Interface.Load (path, this);
                                AddWidget (tmp);
                                return tmp;
-                       }
+                       }               
                }
 
                #endregion
@@ -296,13 +330,13 @@ namespace Crow
                        updateTime.Restart ();
                        #endif
 
+                       lock (this) {
+                               processLayouting ();
 
-                       processLayouting ();
-
-                       clippingRegistration ();
-
-                       processDrawing ();
+                               clippingRegistration ();
 
+                               processDrawing ();
+                       }
                        #if MEASURE_TIME
                        updateTime.Stop ();
                        #endif
@@ -328,46 +362,45 @@ namespace Crow
                        #if MEASURE_TIME
                        layoutTime.Restart();
                        #endif
-
+                       lock (Interface.CurrentInterface.UpdateLayoutQueue) {
+                               while(Interface.CurrentInterface.UpdateLayoutQueue.Count>0){
+                                       GraphicObject g = Interface.CurrentInterface.UpdateLayoutQueue.Dequeue();
+                                       g.EnqueueForLayouting (g.RegisteredLayoutings);
+                                       g.RegisteredLayoutings = LayoutingType.None;
+                               }
+                       }
                        //Debug.WriteLine ("======= Layouting queue start =======");
-                       int queueCount = 0;
                        LayoutingQueueItem lqi = null;
-
-                       lock (Interface.LayoutingQueue)
-                               queueCount = Interface.LayoutingQueue.Count;
-
-                       while (queueCount > 0) {
-                               lock (Interface.LayoutingQueue)
-                                       lqi = Interface.LayoutingQueue.Dequeue ();
-                               if (lqi!=null)
+                       while (Interface.CurrentInterface.LayoutingQueue.Count > 0) {                           
+                                       lqi = Interface.CurrentInterface.LayoutingQueue.Dequeue ();
                                        lqi.ProcessLayouting ();
-                               lock (Interface.LayoutingQueue)
-                                       queueCount = Interface.LayoutingQueue.Count;
                        }
                        #if MEASURE_TIME
                        layoutTime.Stop ();
                        #endif
                }
                void clippingRegistration(){
+                       lock (CurrentInterface.GraphicUpdateQueue) {
+                               while (CurrentInterface.GraphicUpdateQueue.Count > 0) {
+                                       GraphicObject g = CurrentInterface.GraphicUpdateQueue.Dequeue ();
+                                       g.bmp = null;
+                                       g.IsQueueForGraphicUpdate = false;
+                                       AddToRedrawList (g);
+                               }
+                       }
                        //Debug.WriteLine ("otd:" + gobjsToRedraw.Count.ToString () + "-");
                        //final redraw clips should be added only when layout is completed among parents,
                        //that's why it take place in a second pass
-                       lock (Interface.CurrentInterface.RenderMutex) {
-                               GraphicObject[] gotr = null;
-                               gotr = new GraphicObject[gobjsToRedraw.Count];
-                               gobjsToRedraw.CopyTo (gotr);
-                               gobjsToRedraw.Clear ();
-
-                               foreach (GraphicObject p in gotr) {
-                                       try {
-                                               p.IsQueuedForRedraw = false;
-                                               p.Parent.RegisterClip (p.LastPaintedSlot);
-                                               p.Parent.RegisterClip (p.getSlot ());
-                                       } catch (Exception ex) {
-                                               Debug.WriteLine ("Error Register Clip: " + ex.ToString ());
-                                       }
+                       foreach (GraphicObject p in RedrawList) {
+                               try {
+                                       p.IsInRedrawList = false;
+                                       p.Parent.RegisterClip (p.LastPaintedSlot);
+                                       p.Parent.RegisterClip (p.getSlot ());
+                               } catch (Exception ex) {
+                                       Debug.WriteLine ("Error Register Clip: " + ex.ToString ());
                                }
                        }
+                       RedrawList.Clear ();
                }
                void processDrawing(){
                        #if MEASURE_TIME
@@ -408,6 +441,8 @@ namespace Crow
                                                        DirtyRect.Top = Math.Max (0, DirtyRect.Top);
                                                        DirtyRect.Width = Math.Min (ClientRectangle.Width - DirtyRect.Left, DirtyRect.Width);
                                                        DirtyRect.Height = Math.Min (ClientRectangle.Height - DirtyRect.Top, DirtyRect.Height);
+                                                       DirtyRect.Width = Math.Max (0, DirtyRect.Width);
+                                                       DirtyRect.Height = Math.Max (0, DirtyRect.Height);
                                                }
                                                clipping.Reset ();
                                        }
@@ -423,7 +458,7 @@ namespace Crow
                        get { return _redrawClip; }
                        set { _redrawClip = value; }
                }
-               public List<GraphicObject> gobjsToRedraw {
+               public List<GraphicObject> RedrawList {
                        get { return _gobjsToRedraw; }
                        set { _gobjsToRedraw = value; }
                }
@@ -647,11 +682,11 @@ namespace Crow
                        get { throw new NotImplementedException (); }
                        set { throw new NotImplementedException (); }
                }
-               public LayoutingType RegisteredLayoutings {
+               public LayoutingType QueuedLayoutings {
                        get { return LayoutingType.None; }
                        set { throw new NotImplementedException (); }
                }
-               public void RegisterForLayouting (LayoutingType layoutType) { throw new NotImplementedException (); }
+               public void EnqueueForLayouting (LayoutingType layoutType) { throw new NotImplementedException (); }
                public bool UpdateLayout (LayoutingType layoutType) { throw new NotImplementedException (); }
                public Rectangle ContextCoordinates (Rectangle r) => r;
                public Rectangle ScreenCoordinates (Rectangle r) => r;
index ef56d6c6194bdaaad4045034ce30ac030cfe4318..b9a256775d9189663931cff8d45ca70851ca45fc 100644 (file)
@@ -45,7 +45,7 @@ namespace Crow
                {
                        LayoutType = _layoutType;
                        GraphicObject = _graphicObject;
-                       GraphicObject.RegisteredLayoutings |= LayoutType;
+                       GraphicObject.QueuedLayoutings |= LayoutType;
                }
        
                public void ProcessLayouting()
@@ -65,8 +65,8 @@ namespace Crow
                                #endif
                                GraphicObject.LayoutingTries ++;
                                if (GraphicObject.LayoutingTries < Interface.MaxLayoutingTries) {
-                                       GraphicObject.RegisteredLayoutings |= LayoutType;
-                                       Interface.LayoutingQueue.Enqueue (this);
+                                       GraphicObject.QueuedLayoutings |= LayoutType;
+                                       Interface.CurrentInterface.LayoutingQueue.Enqueue (this);
                                }
                        } else {
                                GraphicObject.LayoutingTries = 0;