Author: jpobst
Date: 2007-10-09 17:08:57 -0400 (Tue, 09 Oct 2007)
New Revision: 87224
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LineTag.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
Log:
2007-10-09 Jonathan Pobst <[EMAIL PROTECTED]>
* LineTag.cs, RichTextBox.cs, TextBoxBase.cs, TextControl.cs: Refactor
to
store a Color structure and use the ResPool for back color instead of
holding onto brushes.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-10-09 21:01:49 UTC (rev 87223)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-10-09 21:08:57 UTC (rev 87224)
@@ -1,5 +1,11 @@
2007-10-09 Jonathan Pobst <[EMAIL PROTECTED]>
+ * LineTag.cs, RichTextBox.cs, TextBoxBase.cs, TextControl.cs: Refactor
to
+ store a Color structure and use the ResPool for back color instead of
+ holding onto brushes.
+
+2007-10-09 Jonathan Pobst <[EMAIL PROTECTED]>
+
* TextControl.cs: Fix how we calculate the end of the tag we are
drawing.
[Fixes bug #325592]
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LineTag.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LineTag.cs
2007-10-09 21:01:49 UTC (rev 87223)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LineTag.cs
2007-10-09 21:08:57 UTC (rev 87224)
@@ -41,11 +41,10 @@
// In 2.0 tags can have background colours. I'm not going to
#ifdef
// at this level though since I want to reduce code paths
- internal SolidBrush back_color;
+ internal Color back_color;
// Payload; text
internal int start; // start, in chars;
index into Line.text
- internal bool r_to_l; // Which way is the font
// Drawing support
internal int height; // Height in pixels of
the text this tag describes
@@ -244,7 +243,7 @@
/// Removes any previous tags overlapping the same area;
/// returns true if lineheight has changed</summary>
/// <param name="start">1-based character position on
line</param>
- internal static bool FormatText (Line line, int start, int
length, Font font, SolidBrush color, SolidBrush back_color, FormatSpecified
specified)
+ internal static bool FormatText (Line line, int start, int
length, Font font, SolidBrush color, Color back_color, FormatSpecified
specified)
{
LineTag tag;
LineTag start_tag;
@@ -329,7 +328,7 @@
return true;
}
- private static void SetFormat (LineTag tag, Font font,
SolidBrush color, SolidBrush back_color, FormatSpecified specified)
+ private static void SetFormat (LineTag tag, Font font,
SolidBrush color, Color back_color, FormatSpecified specified)
{
if ((FormatSpecified.Font & specified) ==
FormatSpecified.Font)
tag.font = font;
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
2007-10-09 21:01:49 UTC (rev 87223)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
2007-10-09 21:08:57 UTC (rev 87224)
@@ -254,7 +254,7 @@
// Font changes always set the whole
doc to that font
start = document.GetLine(1);
end = document.GetLine(document.Lines);
- document.FormatText(start, 1, end,
end.text.Length + 1, base.Font, null, null, FormatSpecified.Font);
+ document.FormatText(start, 1, end,
end.text.Length + 1, base.Font, null, Color.Empty, FormatSpecified.Font);
}
}
}
@@ -560,7 +560,7 @@
document.FormatText
(document.selection_start.line, document.selection_start.pos + 1,
document.selection_end.line,
document.selection_end.pos + 1, null,
- new SolidBrush (value), null,
FormatSpecified.Color);
+ new SolidBrush (value),
Color.Empty, FormatSpecified.Color);
document.CharIndexToLineTag(sel_start, out
document.selection_start.line, out document.selection_start.tag, out
document.selection_start.pos);
document.CharIndexToLineTag(sel_end, out
document.selection_end.line, out document.selection_end.tag, out
document.selection_end.pos);
@@ -606,7 +606,7 @@
document.FormatText
(document.selection_start.line, document.selection_start.pos + 1,
document.selection_end.line,
document.selection_end.pos + 1, value,
- null, null,
FormatSpecified.Font);
+ null, Color.Empty,
FormatSpecified.Font);
document.CharIndexToLineTag(sel_start, out
document.selection_start.line, out document.selection_start.tag, out
document.selection_start.pos);
document.CharIndexToLineTag(sel_end, out
document.selection_end.line, out document.selection_end.tag, out
document.selection_end.pos);
@@ -1650,7 +1650,7 @@
if (rtf_line.Length > 0) {
document.InsertString(line,
rtf_cursor_x, rtf_line.ToString());
document.FormatText (line, rtf_cursor_x
+ 1, line, rtf_cursor_x + 1 + length,
- font, rtf_color, null,
+ font, rtf_color,
Color.Empty,
FormatSpecified.Font |
FormatSpecified.Color);
}
if (newline) {
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
2007-10-09 21:01:49 UTC (rev 87223)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
2007-10-09 21:08:57 UTC (rev 87224)
@@ -2045,7 +2045,7 @@
line = document.GetLine(i);
LineTag.FormatText(line, 1,
line.text.Length, Font,
ThemeEngine.Current.ResPool.GetSolidBrush(ForeColor),
- null,
FormatSpecified.Font | FormatSpecified.Color);
+ Color.Empty,
FormatSpecified.Font | FormatSpecified.Color);
}
document.ResumeRecalc (false);
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
2007-10-09 21:01:49 UTC (rev 87223)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
2007-10-09 21:08:57 UTC (rev 87224)
@@ -1466,8 +1466,8 @@
continue;
}
- if (tag.back_color != null) {
- g.FillRectangle
(tag.back_color, tag.X + line.X - viewport_x,
+ if (tag.back_color != Color.Empty) {
+ g.FillRectangle
(ThemeEngine.Current.ResPool.GetSolidBrush (tag.back_color), tag.X + line.X -
viewport_x,
line_y +
tag.shift, tag.Width, line.height);
}
@@ -3309,7 +3309,7 @@
/// <param name="start_pos">1-based start position on
start_line</param>
/// <param name="end_pos">1-based end position on end_line
</param>
internal void FormatText (Line start_line, int start_pos, Line
end_line, int end_pos, Font font,
- SolidBrush color, SolidBrush back_color,
FormatSpecified specified)
+ SolidBrush color, Color back_color,
FormatSpecified specified)
{
Line l;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches