aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-03-05 10:44:15 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-03-05 10:44:15 +0100
commit3d9e22120b40a0a4eb470bc6ceb3de8879f74c8d (patch)
treef7de48e66b09ad9427faa155be1829347b46f8b7
parentb7e8ad35f6f8ce7db30f9dde5cd2628c82f34f8b (diff)
split update registration and user
-rw-r--r--MonoDevelop.GOLib/src/GOLibGtkHost.cs8
-rw-r--r--Tests/GOLIBTestsOTK.cs11
-rw-r--r--UnitTest/NUnitCrowWindow.cs14
-rw-r--r--src/GraphicObjects/Border.cs2
-rw-r--r--src/GraphicObjects/GenericStack.cs26
-rw-r--r--src/GraphicObjects/GraphicObject.cs95
-rw-r--r--src/GraphicObjects/Grid.cs6
-rw-r--r--src/GraphicObjects/Group.cs16
-rw-r--r--src/GraphicObjects/ILayoutable.cs4
-rw-r--r--src/GraphicObjects/Image.cs8
-rw-r--r--src/GraphicObjects/Label.cs24
-rw-r--r--src/GraphicObjects/NumericControl.cs10
-rw-r--r--src/GraphicObjects/PrivateContainer.cs12
-rw-r--r--src/GraphicObjects/ScrollBar.cs2
-rw-r--r--src/GraphicObjects/Scroller.cs4
-rw-r--r--src/GraphicObjects/Slider.cs4
-rw-r--r--src/GraphicObjects/Splitter.cs2
-rw-r--r--src/GraphicObjects/TabItem.cs2
-rw-r--r--src/GraphicObjects/TabView.cs12
-rw-r--r--src/GraphicObjects/TextBox.cs4
-rw-r--r--src/GraphicObjects/TextRun.cs8
-rw-r--r--src/GraphicObjects/Trend.cs16
-rw-r--r--src/Interface.cs111
-rw-r--r--src/LayoutingQueueItem.cs6
24 files changed, 219 insertions, 188 deletions
diff --git a/MonoDevelop.GOLib/src/GOLibGtkHost.cs b/MonoDevelop.GOLib/src/GOLibGtkHost.cs
index 905d9d26..0069e3e7 100644
--- a/MonoDevelop.GOLib/src/GOLibGtkHost.cs
+++ b/MonoDevelop.GOLib/src/GOLibGtkHost.cs
@@ -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 ();
}
diff --git a/Tests/GOLIBTestsOTK.cs b/Tests/GOLIBTestsOTK.cs
index a9416c20..4256120b 100644
--- a/Tests/GOLIBTestsOTK.cs
+++ b/Tests/GOLIBTestsOTK.cs
@@ -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)
diff --git a/UnitTest/NUnitCrowWindow.cs b/UnitTest/NUnitCrowWindow.cs
index 961001e7..0a4a9edc 100644
--- a/UnitTest/NUnitCrowWindow.cs
+++ b/UnitTest/NUnitCrowWindow.cs
@@ -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;
diff --git a/src/GraphicObjects/Border.cs b/src/GraphicObjects/Border.cs
index be08a7d8..c6355726 100644
--- a/src/GraphicObjects/Border.cs
+++ b/src/GraphicObjects/Border.cs
@@ -21,7 +21,7 @@ namespace Crow
get { return _borderWidth; }
set {
_borderWidth = value;
- registerForGraphicUpdate ();
+ RegisterForGraphicUpdate ();
}
}
[XmlAttributeAttribute()][DefaultValue("White")]
diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs
index 2a1da6c3..897343b3 100644
--- a/src/GraphicObjects/GenericStack.cs
+++ b/src/GraphicObjects/GenericStack.cs
@@ -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;
}
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 2bce3349..1909b07d 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -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;
}
diff --git a/src/GraphicObjects/Grid.cs b/src/GraphicObjects/Grid.cs
index 281f4ae0..e13690a7 100644
--- a/src/GraphicObjects/Grid.cs
+++ b/src/GraphicObjects/Grid.cs
@@ -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;
}
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs
index 869ec113..3b2c1380 100644
--- a/src/GraphicObjects/Group.cs
+++ b/src/GraphicObjects/Group.cs
@@ -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;
diff --git a/src/GraphicObjects/ILayoutable.cs b/src/GraphicObjects/ILayoutable.cs
index a8df3ae0..77f9409b 100644
--- a/src/GraphicObjects/ILayoutable.cs
+++ b/src/GraphicObjects/ILayoutable.cs
@@ -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);
diff --git a/src/GraphicObjects/Image.cs b/src/GraphicObjects/Image.cs
index 8f02a19e..61b6e059 100644
--- a/src/GraphicObjects/Image.cs
+++ b/src/GraphicObjects/Image.cs
@@ -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
diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs
index fa2d5828..ebc18f76 100644
--- a/src/GraphicObjects/Label.cs
+++ b/src/GraphicObjects/Label.cs
@@ -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>
diff --git a/src/GraphicObjects/NumericControl.cs b/src/GraphicObjects/NumericControl.cs
index eb01815f..0f74eb2d 100644
--- a/src/GraphicObjects/NumericControl.cs
+++ b/src/GraphicObjects/NumericControl.cs
@@ -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
diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs
index 3a3d9067..1aa39633 100644
--- a/src/GraphicObjects/PrivateContainer.cs
+++ b/src/GraphicObjects/PrivateContainer.cs
@@ -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;
}
}
diff --git a/src/GraphicObjects/ScrollBar.cs b/src/GraphicObjects/ScrollBar.cs
index d1ef12a3..ea75d6d1 100644
--- a/src/GraphicObjects/ScrollBar.cs
+++ b/src/GraphicObjects/ScrollBar.cs
@@ -28,7 +28,7 @@ namespace Crow
return;
_orientation = value;
NotifyValueChanged ("Orientation", _orientation);
- registerForGraphicUpdate ();
+ RegisterForGraphicUpdate ();
}
}
public void onScrollBack (object sender, MouseButtonEventArgs e)
diff --git a/src/GraphicObjects/Scroller.cs b/src/GraphicObjects/Scroller.cs
index 58a0f245..83b65103 100644
--- a/src/GraphicObjects/Scroller.cs
+++ b/src/GraphicObjects/Scroller.cs
@@ -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 ();
}
}
diff --git a/src/GraphicObjects/Slider.cs b/src/GraphicObjects/Slider.cs
index a96f2a40..26720b1d 100644
--- a/src/GraphicObjects/Slider.cs
+++ b/src/GraphicObjects/Slider.cs
@@ -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);
}
}
diff --git a/src/GraphicObjects/Splitter.cs b/src/GraphicObjects/Splitter.cs
index 9372f1bc..6a1f2254 100644
--- a/src/GraphicObjects/Splitter.cs
+++ b/src/GraphicObjects/Splitter.cs
@@ -42,7 +42,7 @@ namespace Crow
thickness = value;
NotifyValueChanged ("Thickness", thickness);
RegisterForLayouting (LayoutingType.Sizing);
- registerForGraphicUpdate ();
+ RegisterForGraphicUpdate ();
}
}
#region GraphicObject override
diff --git a/src/GraphicObjects/TabItem.cs b/src/GraphicObjects/TabItem.cs
index c2d863af..9fd8180d 100644
--- a/src/GraphicObjects/TabItem.cs
+++ b/src/GraphicObjects/TabItem.cs
@@ -91,7 +91,7 @@ namespace Crow
NotifyValueChanged ("TabOffset", tabOffset);
RegisterForLayouting (LayoutingType.X);
- registerForGraphicUpdate ();
+ RegisterForGraphicUpdate ();
}
}
[XmlAttributeAttribute()][DefaultValue("TabItem")]
diff --git a/src/GraphicObjects/TabView.cs b/src/GraphicObjects/TabView.cs
index 97ac4c64..7ae5e3d3 100644
--- a/src/GraphicObjects/TabView.cs
+++ b/src/GraphicObjects/TabView.cs
@@ -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;
}
diff --git a/src/GraphicObjects/TextBox.cs b/src/GraphicObjects/TextBox.cs
index 7907eb42..14cc1830 100644
--- a/src/GraphicObjects/TextBox.cs
+++ b/src/GraphicObjects/TextBox.cs
@@ -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
}
diff --git a/src/GraphicObjects/TextRun.cs b/src/GraphicObjects/TextRun.cs
index 0fa463af..15f024af 100644
--- a/src/GraphicObjects/TextRun.cs
+++ b/src/GraphicObjects/TextRun.cs
@@ -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();
}
}
diff --git a/src/GraphicObjects/Trend.cs b/src/GraphicObjects/Trend.cs
index 4813f3d6..e9ff4c06 100644
--- a/src/GraphicObjects/Trend.cs
+++ b/src/GraphicObjects/Trend.cs
@@ -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)
diff --git a/src/Interface.cs b/src/Interface.cs
index 6ff7f346..f1b01fd0 100644
--- a/src/Interface.cs
+++ b/src/Interface.cs
@@ -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;
diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs
index ef56d6c6..b9a25677 100644
--- a/src/LayoutingQueueItem.cs
+++ b/src/LayoutingQueueItem.cs
@@ -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;