|
From: <Pi...@us...> - 2010-11-21 00:05:31
|
Revision: 1631
http://cs-sdl.svn.sourceforge.net/cs-sdl/?rev=1631&view=rev
Author: Pikablu
Date: 2010-11-21 00:05:24 +0000 (Sun, 21 Nov 2010)
Log Message:
-----------
Modified Paths:
--------------
branches/experimental/src/Widgets/ContainerWidget.cs
branches/experimental/src/Widgets/Label.cs
branches/experimental/src/Widgets/ListBoxTextItem.cs
branches/experimental/src/Widgets/Panel.cs
branches/experimental/src/Widgets/TextRenderer.cs
branches/experimental/src/Widgets/VScrollBar.cs
branches/experimental/src/Widgets/Widget.cs
Modified: branches/experimental/src/Widgets/ContainerWidget.cs
===================================================================
--- branches/experimental/src/Widgets/ContainerWidget.cs 2010-11-17 19:06:47 UTC (rev 1630)
+++ branches/experimental/src/Widgets/ContainerWidget.cs 2010-11-21 00:05:24 UTC (rev 1631)
@@ -47,8 +47,7 @@
#region Constructors
public ContainerWidget(string name)
- : base(name)
- {
+ : base(name) {
childWidgets = new WidgetCollection();
components = new ComponentCollection();
@@ -67,26 +66,22 @@
#region Properties
- public Widget ActiveWidget
- {
+ public Widget ActiveWidget {
get { return activeWidget; }
set {
SetActiveWidget(value);
}
}
- public WidgetCollection ChildWidgets
- {
+ public WidgetCollection ChildWidgets {
get { return childWidgets; }
}
- public ComponentCollection Components
- {
+ public ComponentCollection Components {
get { return components; }
}
- public bool UpdateParentContainer
- {
+ public bool UpdateParentContainer {
get {
return updateParentContainer;
}
@@ -99,8 +94,7 @@
#region Methods
- public void AddWidget(string name, Widget widget)
- {
+ public void AddWidget(string name, Widget widget) {
if (widget != null && !string.IsNullOrEmpty(name)) {
widget.Parent = this;
widget.ParentContainer = this;
@@ -118,39 +112,58 @@
}
}
- public void AddWidget(Widget widget)
- {
+ public void AddWidget(Widget widget) {
if (widget != null) {
AddWidget(widget.Name, widget);
}
}
- public void AddWidget(string name, Component component)
- {
+ public void AddWidget(string name, Component component) {
if (component != null && !string.IsNullOrEmpty(name)) {
components.AddComponent(name, component);
}
}
- public void AddWidget(Component component)
- {
+ public void AddWidget(Component component) {
if (component != null) {
AddWidget(component.Name, component);
}
}
- public override void BlitToScreen(SdlDotNet.Graphics.Surface destinationSurface)
- {
+ public override void BlitToScreen(SdlDotNet.Graphics.Surface destinationSurface) {
+ CheckWidgets();
base.BlitToScreen(destinationSurface);
}
- public void ClearRegion(Rectangle bounds, Widget widgetToSkip)
- {
+ public void CheckWidgets() {
+ for (int i = 0; i < childWidgets.Count; i++) {
+ if (childWidgets[i].RedrawRequested && childWidgets[i].Visible) {
+ ClearRegion(childWidgets[i].Bounds, childWidgets[i]);
+ UpdateWidget(childWidgets[i]);
+ }
+ if (childWidgets[i] is ContainerWidget) {
+ //((ContainerWidget)childWidgets[i]).CheckWidgets();
+ CheckContainerWidgets((ContainerWidget)childWidgets[i]);
+ }
+ }
+ }
+
+ public void CheckContainerWidgets(ContainerWidget container) {
+ for (int i = 0; i < container.childWidgets.Count; i++) {
+ if (container.childWidgets[i].RedrawRequested) {
+ container.RequestRedraw();
+ }
+ if (container.childWidgets[i] is ContainerWidget) {
+ CheckContainerWidgets((ContainerWidget)container.childWidgets[i]);
+ }
+ }
+ }
+
+ public void ClearRegion(Rectangle bounds, Widget widgetToSkip) {
ClearRegion(bounds, widgetToSkip, true);
}
- public void ClearRegion(Rectangle bounds, Widget widgetToSkip, bool updateParent)
- {
+ public void ClearRegion(Rectangle bounds, Widget widgetToSkip, bool updateParent) {
lock (lockObject) {
DrawBackgroundRegion(bounds);
base.DrawBackgroundImageRegion(bounds);
@@ -166,19 +179,19 @@
// TriggerRedrawEvent();
if (updateParentContainer && updateParent) {
if (ParentContainer != null && ParentContainer != this) {
- ParentContainer.UpdateWidget(this);
+ base.RequestRedraw();
+ //RequestRedraw();
+ //ParentContainer.UpdateWidget(this);
}
}
}
}
- public bool ContainsWidget(string name)
- {
+ public bool ContainsWidget(string name) {
return (childWidgets.FindWidget(name) > -1);
}
- public override void FreeResources()
- {
+ public override void FreeResources() {
base.FreeResources();
if (childWidgets != null) {
for (int i = 0; i < childWidgets.Count; i++) {
@@ -192,8 +205,7 @@
}
}
- public Widget GetWidget(string name)
- {
+ public Widget GetWidget(string name) {
int index = childWidgets.FindWidget(name);
if (index > -1) {
return childWidgets[index];
@@ -202,8 +214,7 @@
}
}
- public void LoadComplete()
- {
+ public void LoadComplete() {
loaded = true;
for (int i = 0; i < childWidgets.Count; i++) {
//childWidgets[i].SelectiveDrawBuffer();
@@ -213,8 +224,7 @@
//DrawBuffer();
}
- public override void OnKeyboardDown(SdlDotNet.Input.KeyboardEventArgs e)
- {
+ public override void OnKeyboardDown(SdlDotNet.Input.KeyboardEventArgs e) {
if (activeWidget != null) {
activeWidget.OnKeyboardDown(e);
} else {
@@ -222,8 +232,7 @@
}
}
- public override void OnKeyboardUp(SdlDotNet.Input.KeyboardEventArgs e)
- {
+ public override void OnKeyboardUp(SdlDotNet.Input.KeyboardEventArgs e) {
if (activeWidget != null) {
activeWidget.OnKeyboardUp(e);
} else {
@@ -231,8 +240,7 @@
}
}
- public override void OnMouseDown(MouseButtonEventArgs e)
- {
+ public override void OnMouseDown(MouseButtonEventArgs e) {
base.OnMouseDown(e);
e.Position = new Point(e.Position.X - this.Location.X, e.Position.Y - this.Location.Y);
//Point location = this.ScreenLocation;
@@ -251,8 +259,7 @@
activeWidget = null;
}
- public override void OnMouseMotion(SdlDotNet.Input.MouseMotionEventArgs e)
- {
+ public override void OnMouseMotion(SdlDotNet.Input.MouseMotionEventArgs e) {
base.OnMouseMotion(e);
Point location = this.ScreenLocation;
Point relPoint = new Point(e.Position.X - location.X, e.Position.Y - location.Y);
@@ -266,8 +273,7 @@
}
}
- public override void OnMouseUp(MouseButtonEventArgs e)
- {
+ public override void OnMouseUp(MouseButtonEventArgs e) {
base.OnMouseUp(e);
e.Position = new Point(e.Position.X - this.Location.X, e.Position.Y - this.Location.Y);
//Point location = this.ScreenLocation;
@@ -282,9 +288,7 @@
}
}
- public override void OnTick(SdlDotNet.Core.TickEventArgs e)
- {
- base.OnTick(e);
+ public override void OnTick(SdlDotNet.Core.TickEventArgs e) {
if (components != null) {
for (int i = 0; i < components.Count; i++) {
components[i].OnTick(e);
@@ -295,16 +299,10 @@
childWidgets[i].OnTick(e);
}
}
- for (int i = 0; i < childWidgets.Count; i++) {
- if (childWidgets[i].Visible && childWidgets[i].RedrawRequested) {
- ClearRegion(childWidgets[i].Bounds, childWidgets[i]);
- UpdateWidget(childWidgets[i]);
- }
- }
+ base.OnTick(e);
}
- public void RemoveWidget(string name)
- {
+ public void RemoveWidget(string name) {
lock (lockObject) {
int index = childWidgets.FindWidget(name);
if (index > -1) {
@@ -321,21 +319,18 @@
}
}
- public void SetActiveWidget(Widget widget)
- {
+ public void SetActiveWidget(Widget widget) {
int index = childWidgets.FindWidget(widget.Name);
if (index > -1) {
activeWidget = widget;
}
}
- public void UpdateBuffer()
- {
+ public void UpdateBuffer() {
UpdateBuffer(true);
}
- public void UpdateBuffer(bool resetBackground)
- {
+ public void UpdateBuffer(bool resetBackground) {
lock (lockObject) {
if (!base.Updating) {
if (resetBackground) {
@@ -354,8 +349,7 @@
}
}
- public void UpdateWidget(Widget widget)
- {
+ public void UpdateWidget(Widget widget) {
lock (lockObject) {
if (!base.Updating) {
if (!string.IsNullOrEmpty(widget.Name)) {
@@ -378,7 +372,9 @@
if (updateParentContainer) {
if (ParentContainer != null && ParentContainer != this) {
base.RequestRedraw();
- ParentContainer.UpdateWidget(this);
+ //ParentContainer.RequestRedraw();
+ //base.RequestRedraw();
+ //ParentContainer.UpdateWidget(this);
}
}
}
@@ -386,15 +382,13 @@
}
}
- protected virtual void DrawBackgroundRegion(Rectangle region)
- {
+ protected virtual void DrawBackgroundRegion(Rectangle region) {
lock (lockObject) {
base.Buffer.Fill(region, this.BackColor);
}
}
- private Rectangle CalculateRegion(Rectangle parentBounds, Rectangle childBounds)
- {
+ private Rectangle CalculateRegion(Rectangle parentBounds, Rectangle childBounds) {
int width = 0;
int height = 0;
int x = 0;
Modified: branches/experimental/src/Widgets/Label.cs
===================================================================
--- branches/experimental/src/Widgets/Label.cs 2010-11-17 19:06:47 UTC (rev 1630)
+++ branches/experimental/src/Widgets/Label.cs 2010-11-21 00:05:24 UTC (rev 1631)
@@ -44,6 +44,8 @@
string text;
VScrollBar vScroll;
bool wordWrap;
+ bool autoScrollSet = false;
+ bool scrollToBottom;
#endregion Fields
@@ -233,8 +235,9 @@
}
public void ScrollToBottom() {
- if (vScroll.Visible) {
- vScroll.Value = vScroll.Maximum;
+ if (vScroll != null && vScroll.Visible) {
+ //vScroll.Value = vScroll.Maximum;
+ scrollToBottom = true;
}
}
@@ -264,53 +267,99 @@
}
protected override void DrawBuffer() {
- if (this.Updating == false) {
- if (string.IsNullOrEmpty(text)) {
- base.DrawBuffer();
- }
- if (!string.IsNullOrEmpty(text)) {
- CheckFont();
+ lock (lockObject) {
+ if (this.Updating == false) {
+ this.Updating = true;
+ if (string.IsNullOrEmpty(text)) {
+ base.DrawBuffer();
+ }
+ if (!string.IsNullOrEmpty(text)) {
+ CheckFont();
- //if (autoSize) {
- // Size newSize = TextRenderer.SizeText(font, text, antiAlias, maxWidth);
- // if (this.Size != newSize) {
- // ResizeInternal(new Size(newSize.Width + 10, newSize.Height));
- // }
- //}
- base.DrawBuffer();
+ //if (autoSize) {
+ // Size newSize = TextRenderer.SizeText(font, text, antiAlias, maxWidth);
+ // if (this.Size != newSize) {
+ // ResizeInternal(new Size(newSize.Width + 10, newSize.Height));
+ // }
+ //}
+ base.DrawBuffer();
- SdlDotNet.Graphics.Surface textSurface;
- Color textColor;
- if (hoverColor != Color.Empty && MouseInBounds) {
- textColor = hoverColor;
- } else {
- textColor = this.ForeColor;
- }
- if (vScroll != null && vScroll.Visible && hScroll != null && hScroll.Visible) {
- textSurface = TextRenderer.RenderTextBasic2(this.font, text, charRenderOptions.ToArray(), textColor, false, this.Width - vScroll.Width - 5, this.Height - hScroll.Height, 0, 0);
- } else if (vScroll != null && vScroll.Visible) {
- textSurface = TextRenderer.RenderTextBasic2(this.font, text, charRenderOptions.ToArray(), textColor, false, this.Width - vScroll.Width - 5, this.Height, 0, vScroll.Value);
- } else if (hScroll != null && hScroll.Visible) {
- textSurface = TextRenderer.RenderTextBasic2(this.font, text, charRenderOptions.ToArray(), textColor, false, this.Width - 5, this.Height - hScroll.Height, 0, 0);
- } else {
- textSurface = TextRenderer.RenderTextBasic2(this.font, text, charRenderOptions.ToArray(), textColor, false, this.Width - 5, this.Height, 0, 0);
- }
+ //string escapedText = System.Text.RegularExpressions.Regex.Escape(text);
+ //if (escapedText.Length != charRenderOptions.Count) {
+ // charRenderOptions.Clear();
- if (textSurface != null) {
- Point drawPoint;
- if (!centered) {
- drawPoint = new Point(5, 0);
+ // for (int i = 0; i < escapedText.Length; i++) {
+ // charRenderOptions.Add(new CharRenderOptions(this.ForeColor));
+ // }
+ //}
+
+ if (autoScroll && autoScrollSet) {
+ int width = this.Width;
+ //Size textSize1 = TextRenderer.SizeText2(font, text, antiAlias, width);
+ Size textSize2 = TextRenderer.SizeText2(font, text, antiAlias, width - 12);//vScroll.Width);
+ Size goodSize = new Size();
+
+ //if (textSize2.Height > this.Height) {
+ // goodSize = textSize2;
+ //} else if (textSize1.Height > this.Height) {
+ // goodSize = textSize1;
+ //}
+ goodSize = textSize2;
+
+ if (goodSize.Height > this.Height) {
+ CheckVScrollBar();
+ vScroll.Location = new Point(this.Width - 12, 0);
+ vScroll.Size = new Size(12, this.Height);
+ vScroll.Minimum = 0;
+ //vScroll.Value = 0;
+ vScroll.Maximum = RoundToMultiple((goodSize.Height / font.Height), 1) - (this.Height / font.Height) + 1;
+ vScroll.Visible = true;
+ if (scrollToBottom) {
+ vScroll.Value = vScroll.Maximum;
+ scrollToBottom = false;
+ }
+ } else {
+ if (vScroll != null && vScroll.Visible) {
+ vScroll.Visible = false;
+ }
+ }
+ autoScrollSet = false;
+ }
+
+ SdlDotNet.Graphics.Surface textSurface;
+ Color textColor;
+ if (hoverColor != Color.Empty && IsMouseInBounds()) {
+ textColor = hoverColor;
} else {
- drawPoint = DrawingSupport.GetCenter(this.Size, textSurface.Size);
+ textColor = this.ForeColor;
}
- base.Buffer.Blit(textSurface, drawPoint);
- textSurface.Close();
+ if (vScroll != null && vScroll.Visible && hScroll != null && hScroll.Visible) {
+ textSurface = TextRenderer.RenderTextBasic2(this.font, text, charRenderOptions.ToArray(), textColor, false, this.Width - vScroll.Width - 5, this.Height - hScroll.Height, 0, 0);
+ } else if (vScroll != null && vScroll.Visible) {
+ textSurface = TextRenderer.RenderTextBasic2(this.font, text, charRenderOptions.ToArray(), textColor, false, this.Width - vScroll.Width - 5, this.Height, 0, vScroll.Value);
+ } else if (hScroll != null && hScroll.Visible) {
+ textSurface = TextRenderer.RenderTextBasic2(this.font, text, charRenderOptions.ToArray(), textColor, false, this.Width - 5, this.Height - hScroll.Height, 0, 0);
+ } else {
+ textSurface = TextRenderer.RenderTextBasic2(this.font, text, charRenderOptions.ToArray(), textColor, false, this.Width - 5, this.Height, 0, 0);
+ }
+
+ if (textSurface != null) {
+ Point drawPoint;
+ if (!centered) {
+ drawPoint = new Point(5, 0);
+ } else {
+ drawPoint = DrawingSupport.GetCenter(this.Size, textSurface.Size);
+ }
+ base.Buffer.Blit(textSurface, drawPoint);
+ textSurface.Close();
+ }
}
+ if (vScroll != null) {
+ vScroll.BlitToScreen(base.Buffer);
+ }
+ base.DrawBorder();
+ this.Updating = false;
}
- if (vScroll != null) {
- vScroll.BlitToScreen(base.Buffer);
- }
- base.DrawBorder();
}
}
@@ -366,7 +415,7 @@
vScroll.Location = new Point(this.Width - 12, 0);
vScroll.Size = new Size(12, this.Height);
vScroll.Minimum = 0;
- vScroll.Maximum = RoundToMultiple((textSize.Height / font.Height), 1) - (this.Height / font.Height) + 1;
+ vScroll.Maximum = RoundToMultiple((textSize.Height / font.Height), 1) - (this.Height / font.Height);
vScroll.Visible = true;
} else {
if (vScroll != null) {
@@ -392,8 +441,8 @@
}
}
- CheckFont();
if (autoSize) {
+ CheckFont();
Size newSize = TextRenderer.SizeText2(font, text, antiAlias, maxWidth);
if (this.Size != newSize) {
//this.updatingText = true;
@@ -407,32 +456,10 @@
if (vScroll != null && vScroll.Visible) {
vScroll.Hide();
}
- } else if (autoScroll) {
- int width = this.Width;
- Size textSize1 = TextRenderer.SizeText2(font, text, antiAlias, width);
- Size textSize2 = TextRenderer.SizeText2(font, text, antiAlias, width - 12);//vScroll.Width);
- Size goodSize = new Size();
-
- if (textSize2.Height > this.Height) {
- goodSize = textSize2;
- } else if (textSize1.Height > this.Height) {
- goodSize = textSize1;
- }
-
- if (goodSize.Height > this.Height) {
- CheckVScrollBar();
- vScroll.Location = new Point(this.Width - 12, 0);
- vScroll.Size = new Size(12, this.Height);
- vScroll.Minimum = 0;
- //vScroll.Value = 0;
- vScroll.Maximum = RoundToMultiple((goodSize.Height / font.Height), 1) - (this.Height / font.Height) + 1;
- vScroll.Visible = true;
- } else {
- if (vScroll != null && vScroll.Visible) {
- vScroll.Visible = false;
- }
- }
}
+ if (autoScroll) {
+ autoScrollSet = true;
+ }
base.RequestRedraw();
}
Modified: branches/experimental/src/Widgets/ListBoxTextItem.cs
===================================================================
--- branches/experimental/src/Widgets/ListBoxTextItem.cs 2010-11-17 19:06:47 UTC (rev 1630)
+++ branches/experimental/src/Widgets/ListBoxTextItem.cs 2010-11-21 00:05:24 UTC (rev 1631)
@@ -40,6 +40,8 @@
bool selected;
string text;
+ Object lockObject = new object();
+
#endregion Fields
#region Constructors
@@ -126,22 +128,24 @@
}
private void DrawBuffer() {
- if (buffer != null) {
- buffer.Close();
+ lock (lockObject) {
+ if (buffer != null) {
+ buffer.Close();
+ }
+ Surface textSurface = TextRenderer.RenderTextBasic2(font, text, null, foreColor, false, 0, 0, 0, 0);
+ if (image != null) {
+ Surface newBuffer = new Surface(new Size(image.Width + (5 * 2) + textSurface.Width, image.Height + (5 * 2)));
+ newBuffer.Transparent = true;
+ newBuffer.TransparentColor = Color.Transparent;
+ newBuffer.Fill(Color.Transparent);
+ newBuffer.Blit(image, new Point(5, 5));
+ newBuffer.Blit(textSurface, new Point(5 + image.Width + 5, 5));
+ buffer = newBuffer;
+ textSurface.Close();
+ } else {
+ buffer = textSurface;
+ }
}
- Surface textSurface = TextRenderer.RenderTextBasic(font, text, null, foreColor, false, 0, 0, 0, 0);
- if (image != null) {
- Surface newBuffer = new Surface(new Size(image.Width + (5 * 2) + textSurface.Width, image.Height + (5 * 2)));
- newBuffer.Transparent = true;
- newBuffer.TransparentColor = Color.Transparent;
- newBuffer.Fill(Color.Transparent);
- newBuffer.Blit(image, new Point(5, 5));
- newBuffer.Blit(textSurface, new Point(5 + image.Width + 5, 5));
- buffer = newBuffer;
- textSurface.Close();
- } else {
- buffer = textSurface;
- }
}
#endregion Methods
Modified: branches/experimental/src/Widgets/Panel.cs
===================================================================
--- branches/experimental/src/Widgets/Panel.cs 2010-11-17 19:06:47 UTC (rev 1630)
+++ branches/experimental/src/Widgets/Panel.cs 2010-11-21 00:05:24 UTC (rev 1631)
@@ -32,6 +32,8 @@
Object lockObject = new object();
+ public event EventHandler Paint;
+
#endregion Fields
#region Constructors
@@ -47,7 +49,9 @@
protected override void DrawBuffer() {
lock (lockObject) {
base.DrawBuffer();
- base.UpdateBuffer(true);
+ if (Paint != null)
+ Paint(this, EventArgs.Empty);
+ base.UpdateBuffer(false);
base.DrawBorder();
}
}
Modified: branches/experimental/src/Widgets/TextRenderer.cs
===================================================================
--- branches/experimental/src/Widgets/TextRenderer.cs 2010-11-17 19:06:47 UTC (rev 1630)
+++ branches/experimental/src/Widgets/TextRenderer.cs 2010-11-21 00:05:24 UTC (rev 1631)
@@ -1183,6 +1183,7 @@
int width = 0;
int height = font.Height;
int longestWidth = 0;
+ GlyphData[] glyphDataCache = new GlyphData[textItem.Length];
for (int i = 0; i < textItem.Length; i++) {
if (textItem[i] != '\n') {
bool moved = false;
@@ -1194,19 +1195,27 @@
if (wordWidth > maxWidth - 5) {
height += font.Height;
width = 0;
- i = z;
+ i = z - 1;
moved = true;
}
break;
}
- wordWidth += font.SizeText(textItem[z].ToString()).Width;
+ if (glyphDataCache[z].Advance == 0) {
+ glyphDataCache[z] = font.GetGlyphMetrics(textItem[z]);
+ }
+ //wordWidth += font.SizeText(textItem[z].ToString()).Width;
+ wordWidth += glyphDataCache[z].Advance;
z++;
}
}
if (!moved) {
- width += font.SizeText(textItem[i].ToString()).Width;
+ if (glyphDataCache[i].Advance == 0) {
+ glyphDataCache[i] = font.GetGlyphMetrics(textItem[i]);
+ }
+ width += glyphDataCache[i].Advance;
+ //width += font.SizeText(textItem[i].ToString()).Width;
if (width > longestWidth) {
longestWidth = width;
}
Modified: branches/experimental/src/Widgets/VScrollBar.cs
===================================================================
--- branches/experimental/src/Widgets/VScrollBar.cs 2010-11-17 19:06:47 UTC (rev 1630)
+++ branches/experimental/src/Widgets/VScrollBar.cs 2010-11-21 00:05:24 UTC (rev 1631)
@@ -120,26 +120,30 @@
public int Maximum {
get { return maximum; }
set {
- maximum = value;
- if (maximum < 0)
- maximum = 0;
- if (this.value > maximum)
- this.value = maximum;
- RecalculateScrollButton();
- RequestRedraw();
+ if (this.maximum != value) {
+ maximum = value;
+ if (maximum < 0)
+ maximum = 0;
+ if (this.value > maximum)
+ this.value = maximum;
+ RecalculateScrollButton();
+ RequestRedraw();
+ }
}
}
public int Minimum {
get { return minimum; }
set {
- minimum = value;
- if (this.value < minimum)
- this.value = minimum;
- if (minimum > maximum)
- minimum = maximum;
- RecalculateScrollButton();
- RequestRedraw();
+ if (this.minimum != value) {
+ minimum = value;
+ if (this.value < minimum)
+ this.value = minimum;
+ if (minimum > maximum)
+ minimum = maximum;
+ RecalculateScrollButton();
+ RequestRedraw();
+ }
}
}
@@ -156,10 +160,12 @@
public new Size Size {
get { return base.Size; }
set {
- base.Size = value;
- RecalculateButtonPositions();
- RecalculateScrollButton();
- RequestRedraw();
+ if (base.Size != value) {
+ base.Size = value;
+ RecalculateButtonPositions();
+ RecalculateScrollButton();
+ RequestRedraw();
+ }
}
}
Modified: branches/experimental/src/Widgets/Widget.cs
===================================================================
--- branches/experimental/src/Widgets/Widget.cs 2010-11-17 19:06:47 UTC (rev 1630)
+++ branches/experimental/src/Widgets/Widget.cs 2010-11-21 00:05:24 UTC (rev 1631)
@@ -582,6 +582,7 @@
get { return this.Size.Width; }
set {
if (bounds.Width != value) {
+ ClearWidget();
bounds.Width = value;
ResizeBuffer();
}
@@ -657,6 +658,7 @@
BlitToScreen(destinationSurface, Rectangle.Empty, location);
}
+ bool blitting = false;
/// <summary>
/// Blits to screen.
/// </summary>
@@ -664,7 +666,8 @@
/// <param name="sourceRectangle">The source rectangle.</param>
/// <param name="location">The location.</param>
public virtual void BlitToScreen(SdlDotNet.Graphics.Surface destinationSurface, Rectangle sourceRectangle, Point location) {
- lock (lockObject) {
+ if (blitting == false) {
+ blitting = true;
if (!disposed) {
if (redrawRequested) {
redrawRequested = false;
@@ -693,6 +696,9 @@
}
//}
}
+ blitting = false;
+ } else {
+ Console.WriteLine("break");
}
}
@@ -909,6 +915,10 @@
this.redrawRequested = true;
}
+ public void CancelRedrawRequest() {
+ this.redrawRequested = false;
+ }
+
[Obsolete]
public void SelectiveDrawBuffer() {
if (topLevel || (!topLevel && parent != null)) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|