[Monodevelop-patches-list] r474 - in trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src: Document/HighlightingStrategy Gui
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Mon Jan 12 18:27:22 EST 2004
Author: benm
Date: 2004-01-12 18:27:21 -0500 (Mon, 12 Jan 2004)
New Revision: 474
Modified:
trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightColor.cs
trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Gui/FoldMargin.cs
Log:
bash out more allocs
Modified: trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightColor.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightColor.cs 2004-01-12 21:30:13 UTC (rev 473)
+++ trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightColor.cs 2004-01-12 23:27:21 UTC (rev 474)
@@ -23,11 +23,11 @@
public class HighlightColor
{
bool systemColor = false;
- string systemColorName = null;
+ KnownColor systemColorKnownColor;
double systemColorFactor = 1.0;
bool systemBgColor = false;
- string systemBgColorName = null;
+ KnownColor systemBgColorKnownColor;
double systemBgColorFactor = 1.0;
Color color;
@@ -77,7 +77,7 @@
if (!systemBgColor) {
return backgroundcolor;
}
- return ParseColorString(systemBgColorName, systemBgColorFactor);
+ return ParseColorString(systemBgColorKnownColor, systemBgColorFactor);
}
}
@@ -89,7 +89,7 @@
if (!systemColor) {
return color;
}
- return ParseColorString(systemColorName, systemColorFactor);
+ return ParseColorString(systemColorKnownColor, systemColorFactor);
}
}
@@ -105,9 +105,9 @@
}
}
- Color ParseColorString(string colorName, double factor)
+ Color ParseColorString(KnownColor color, double factor)
{
- Color c = Color.FromName (colorName);
+ Color c = Color.FromKnownColor (color);
c = Color.FromArgb((int)((double)c.R * factor), (int)((double)c.G * factor), (int)((double)c.B * factor));
return c;
@@ -134,7 +134,7 @@
} else if (c.StartsWith("SystemColors.")) {
systemColor = true;
string [] cNames = c.Substring ("SystemColors.".Length).Split('*');
- systemColorName = cNames [0];
+ systemColorKnownColor = (KnownColor) Enum.Parse (typeof (KnownColor), cNames [0]);
// hack : can't figure out how to parse doubles with '.' (culture info might set the '.' to ',')
if (cNames.Length == 2) systemColorFactor = Double.Parse(cNames[1]) / 100;
} else {
@@ -152,7 +152,7 @@
} else if (c.StartsWith("SystemColors.")) {
systemBgColor = true;
string [] cNames = c.Substring ("SystemColors.".Length).Split('*');
- systemBgColorName = cNames [0];
+ systemBgColorKnownColor = (KnownColor) Enum.Parse (typeof (KnownColor), cNames [0]);
// hack : can't figure out how to parse doubles with '.' (culture info might set the '.' to ',')
if (cNames.Length == 2) systemBgColorFactor = Double.Parse(cNames[1]) / 100;
} else {
@@ -187,7 +187,7 @@
} else if (c.StartsWith("SystemColors.")) {
systemColor = true;
string [] cNames = c.Substring ("SystemColors.".Length).Split('*');
- systemColorName = cNames [0];
+ systemColorKnownColor = (KnownColor) Enum.Parse (typeof (KnownColor), cNames [0]);
// hack : can't figure out how to parse doubles with '.' (culture info might set the '.' to ',')
if (cNames.Length == 2) systemColorFactor = Double.Parse(cNames[1]) / 100;
} else {
@@ -204,7 +204,7 @@
} else if (c.StartsWith("SystemColors.")) {
systemBgColor = true;
string [] cNames = c.Substring ("SystemColors.".Length).Split('*');
- systemBgColorName = cNames [0];
+ systemBgColorKnownColor = (KnownColor) Enum.Parse (typeof (KnownColor), cNames [0]);
// hack : can't figure out how to parse doubles with '.' (culture info might set the '.' to ',')
if (cNames.Length == 2) systemBgColorFactor = Double.Parse(cNames[1]) / 100;
@@ -251,13 +251,13 @@
this.systemColor = true;
string [] cNames = systemColor.Split('*');
- systemColorName = cNames [0];
+ systemColorKnownColor = (KnownColor) Enum.Parse (typeof (KnownColor), cNames [0]);
// hack : can't figure out how to parse doubles with '.' (culture info might set the '.' to ',')
if (cNames.Length == 2) systemColorFactor = Double.Parse(cNames[1]) / 100;
systemBgColor = true;
cNames = systemBackgroundColor.Split('*');
- systemBgColorName = cNames [0];
+ systemBgColorKnownColor = (KnownColor) Enum.Parse (typeof (KnownColor), cNames [0]);
// hack : can't figure out how to parse doubles with '.' (culture info might set the '.' to ',')
if (cNames.Length == 2) systemBgColorFactor = Double.Parse(cNames[1]) / 100;
Modified: trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Gui/FoldMargin.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Gui/FoldMargin.cs 2004-01-12 21:30:13 UTC (rev 473)
+++ trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Gui/FoldMargin.cs 2004-01-12 23:27:21 UTC (rev 474)
@@ -48,12 +48,15 @@
public override void Paint(Gdk.Drawable wnd, System.Drawing.Rectangle rect)
{
HighlightColor lineNumberPainterColor = textArea.Document.HighlightingStrategy.GetColorFor("LineNumbers");
- HighlightColor foldLineColor = textArea.Document.HighlightingStrategy.GetColorFor("FoldLine");
+
+ Gdk.Color rect_fg = TextArea.Style.White;
+ Gdk.Color text_fg = new Gdk.Color (lineNumberPainterColor.Color);
+ Gdk.Color text_bg = new Gdk.Color (lineNumberPainterColor.BackgroundColor);
using (Gdk.GC gc = new Gdk.GC(wnd)) {
for (int y = 0; y < (DrawingPosition.Height + textArea.TextView.VisibleLineDrawingRemainder) / textArea.TextView.FontHeight + 1; ++y) {
- gc.RgbFgColor = TextArea.Style.White;
+ gc.RgbFgColor = rect_fg;
System.Drawing.Rectangle markerRectangle = new System.Drawing.Rectangle(DrawingPosition.X, DrawingPosition.Top + y * textArea.TextView.FontHeight - textArea.TextView.VisibleLineDrawingRemainder, DrawingPosition.Width, textArea.TextView.FontHeight);
if (rect.IntersectsWith(markerRectangle)) {
@@ -61,8 +64,8 @@
if (textArea.Document.TextEditorProperties.ShowLineNumbers) {
wnd.DrawRectangle (gc, true, new System.Drawing.Rectangle (markerRectangle.X + 1, markerRectangle.Y, markerRectangle.Width - 1, markerRectangle.Height));
- gc.RgbFgColor = new Gdk.Color (lineNumberPainterColor.Color);
- gc.RgbBgColor = new Gdk.Color (lineNumberPainterColor.BackgroundColor);
+ gc.RgbFgColor = text_fg;
+ gc.RgbBgColor = text_bg;
gc.SetLineAttributes (1, LineStyle.OnOffDash, CapStyle.NotLast, JoinStyle.Miter);
wnd.DrawLine (gc, base.drawingPosition.X, markerRectangle.Y, base.drawingPosition.X, markerRectangle.Bottom);
} else {
More information about the Monodevelop-patches-list
mailing list