[Monodevelop-patches-list] r468 - trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Gui
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Sun Jan 11 22:53:25 EST 2004
Author: benm
Date: 2004-01-11 22:53:25 -0500 (Sun, 11 Jan 2004)
New Revision: 468
Modified:
trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Gui/TextView.cs
Log:
ive had it with yer allocation
Modified: trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Gui/TextView.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Gui/TextView.cs 2004-01-12 03:14:30 UTC (rev 467)
+++ trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Gui/TextView.cs 2004-01-12 03:53:25 UTC (rev 468)
@@ -105,7 +105,9 @@
public override void Paint(Gdk.Drawable g, System.Drawing.Rectangle rect)
{
using (Gdk.GC backgroundGC = new Gdk.GC(g)) {
- using (Gdk.GC gc = new Gdk.GC(g)) {
+ using (Gdk.GC gc = new Gdk.GC(g)) {
+ using (Gdk.GC text_gc = new Gdk.GC(g)) {
+ text_gc.Copy(gc);
int horizontalDelta = (int)(textArea.VirtualTop.X * GetWidth(g, ' '));
if (horizontalDelta > 0) {
@@ -121,13 +123,13 @@
fontHeight);
if (rect.IntersectsWith(lineRectangle)) {
int currentLine = FirstVisibleLine + y;
- PaintDocumentLine(g, gc, backgroundGC, currentLine, lineRectangle);
+ PaintDocumentLine(g, gc, backgroundGC, text_gc, currentLine, lineRectangle);
}
}
- }} // using
+ }}} // using
}
- void PaintDocumentLine(Gdk.Drawable g, Gdk.GC gc, Gdk.GC backgroundGC, int lineNumber, System.Drawing.Rectangle lineRectangle)
+ void PaintDocumentLine(Gdk.Drawable g, Gdk.GC gc, Gdk.GC backgroundGC, Gdk.GC text_gc, int lineNumber, System.Drawing.Rectangle lineRectangle)
{
HighlightBackground background = (HighlightBackground)textArea.Document.HighlightingStrategy.GetColorFor("DefaultColor");
//Brush backgroundBrush = textArea.Sensitive ? new SolidBrush(background.BackgroundColor) : SystemBrushes.InactiveBorder;
@@ -185,7 +187,7 @@
new Gdk.Rectangle((int) Math.Round(physicalXPos), lineRectangle.Y, (int) Math.Round(spaceWidth), lineRectangle.Height));
}
if (TextEditorProperties.ShowSpaces) {
- DrawSpaceMarker(g, spaceMarkerColor.Color, physicalXPos, lineRectangle.Y);
+ DrawSpaceMarker(g, text_gc, spaceMarkerColor.Color, physicalXPos, lineRectangle.Y);
}
physicalXPos += spaceWidth;
@@ -229,10 +231,10 @@
gc.RgbFgColor = new Gdk.Color(selectionColor.BackgroundColor);
//gc.RgbBgColor = new Gdk.Color(selectionColor.BackgroundColor);
- physicalXPos += DrawDocumentWord(g, word, new PointF(physicalXPos, lineRectangle.Y), currentWord.Font, selectionColor.HasForgeground ? selectionColor.Color : currentWord.Color, gc);
+ physicalXPos += DrawDocumentWord(g, word, new PointF(physicalXPos, lineRectangle.Y), currentWord.Font, selectionColor.HasForgeground ? selectionColor.Color : currentWord.Color, gc, text_gc);
} else {
if (ColumnRange.NoColumn.Equals(selectionRange) /* || selectionRange.StartColumn > logicalColumn + word.Length || selectionRange.EndColumn - 1 <= logicalColumn */) {
- physicalXPos += DrawDocumentWord(g, word, new PointF(physicalXPos, lineRectangle.Y), currentWord.Font, currentWord.Color, backgroundGC);
+ physicalXPos += DrawDocumentWord(g, word, new PointF(physicalXPos, lineRectangle.Y), currentWord.Font, currentWord.Color, backgroundGC, text_gc);
} else {
int offset1 = Math.Min(word.Length, Math.Max(0, selectionRange.StartColumn - logicalColumn ));
int offset2 = Math.Max(offset1, Math.Min(word.Length, selectionRange.EndColumn - logicalColumn));
@@ -246,7 +248,7 @@
new PointF(physicalXPos, lineRectangle.Y),
currentWord.Font,
currentWord.Color,
- backgroundGC);
+ backgroundGC, text_gc);
gc.RgbFgColor = new Gdk.Color(selectionColor.Color);
gc.RgbFgColor = new Gdk.Color(selectionColor.BackgroundColor);
//gc.RgbBgColor = new Gdk.Color(selectionColor.BackgroundColor);
@@ -256,14 +258,14 @@
new PointF(physicalXPos, lineRectangle.Y),
currentWord.Font,
selectionColor.HasForgeground ? selectionColor.Color : currentWord.Color,
- gc);
+ gc, text_gc);
physicalXPos += DrawDocumentWord(g,
word3,
new PointF(physicalXPos, lineRectangle.Y),
currentWord.Font,
currentWord.Color,
- backgroundGC);
+ backgroundGC, text_gc);
}
}
@@ -316,18 +318,16 @@
}
}
- float DrawDocumentWord(Gdk.Drawable g, string word, PointF position, Pango.FontDescription font, System.Drawing.Color foreColor, Gdk.GC gc)
+ float DrawDocumentWord(Gdk.Drawable g, string word, PointF position, Pango.FontDescription font, System.Drawing.Color foreColor, Gdk.GC gc, Gdk.GC text_gc)
{
if (word == null || word.Length == 0) {
return 0f;
}
float wordWidth = MeasureString(font, word);
g.DrawRectangle(gc, true, new Gdk.Rectangle((int) Math.Abs(position.X), (int) Math.Abs(position.Y), (int) Math.Abs(wordWidth), (int) Math.Abs(FontHeight)));
- using (Gdk.GC tgc = new Gdk.GC(g)) {
- tgc.Copy(gc);
- tgc.RgbFgColor = new Gdk.Color(foreColor);
- return DrawString(g, tgc, position.X, position.Y, word);
- }
+
+ text_gc.RgbFgColor = new Gdk.Color(foreColor);
+ return DrawString(g, text_gc, position.X, position.Y, word);
}
void DrawCaret(Gdk.Drawable g, Gdk.GC gc, PointF point) {
TextArea.Caret.PhysicalPosition = new Gdk.Point((int)point.X, (int)point.Y);
@@ -555,15 +555,13 @@
}
}
- void DrawSpaceMarker(Gdk.Drawable g, System.Drawing.Color color, float x, float y)
+ void DrawSpaceMarker(Gdk.Drawable g, Gdk.GC gc, System.Drawing.Color color, float x, float y)
{
HighlightColor spaceMarkerColor = textArea.Document.HighlightingStrategy.GetColorFor("SpaceMarker");
//g.DrawString("\u00B7", spaceMarkerColor.Font, new SolidBrush(color), x, y, measureStringFormat);
- using (Gdk.GC gc = new Gdk.GC(g)) {
- gc.RgbFgColor = new Gdk.Color(spaceMarkerColor.Color);
- //DrawString(g, gc, x, y, "\u00B7");
- DrawString(g, gc, x, y, " ");
- }
+ gc.RgbFgColor = new Gdk.Color(spaceMarkerColor.Color);
+ //DrawString(g, gc, x, y, "\u00B7");
+ DrawString(g, gc, x, y, " ");
}
More information about the Monodevelop-patches-list
mailing list