Author: mkrueger
Date: 2008-02-17 12:39:47 -0500 (Sun, 17 Feb 2008)
New Revision: 95988

Modified:
   trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
Log:
* Mono.TextEditor/TextViewMargin.cs: Caret line highlighting works
  again.

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-17 
17:34:27 UTC (rev 95987)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-17 
17:39:47 UTC (rev 95988)
@@ -1,5 +1,9 @@
 2008-02-17  Mike Krüger <[EMAIL PROTECTED]> 
 
+       * Mono.TextEditor/TextViewMargin.cs: Caret line highlighting works 
again.
+
+2008-02-17  Mike Krüger <[EMAIL PROTECTED]> 
+
        * Mono.TextEditor/TextViewMargin.cs, Mono.TextEditor/Document.cs,
          Mono.TextEditor/SearchOptions.cs, Mono.TextEditor/TextUtil.cs,
          Mono.TextEditor/TextEditorData.cs, Mono.TextEditor/TextEditor.cs,

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
 2008-02-17 17:34:27 UTC (rev 95987)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
 2008-02-17 17:39:47 UTC (rev 95988)
@@ -296,7 +296,7 @@
                                        // Draw text before the search result 
(if any)
                                        if (firstSearch.Offset > offset) {
                                                s = offset - startOffset;
-                                               DrawText (win, text.Substring 
(s, firstSearch.Offset - offset), style.Color, ColorStyle.Background, ref xPos, 
y);
+                                               DrawText (win, text.Substring 
(s, firstSearch.Offset - offset), style.Color, defaultBgColor, ref xPos, y);
                                                offset += firstSearch.Offset - 
offset;
                                        }
                                        // Draw text within the search result
@@ -308,7 +308,7 @@
                                }
                                s = offset - startOffset;
                                if (s < wordBuilder.Length) {
-                                       DrawText (win, text.Substring (s, 
wordBuilder.Length - s), style.Color, ColorStyle.Background, ref xPos, y);
+                                       DrawText (win, text.Substring (s, 
wordBuilder.Length - s), style.Color, defaultBgColor, ref xPos, y);
                                }
                        }
                        
@@ -379,7 +379,7 @@
                                        visibleColumn++;
                                } else if (ch == ' ') {
                                        OutputWordBuilder (win, line, selected, 
style, ref visibleColumn, ref xPos, y, offset);
-                                       DrawRectangleWithRuler (win, 
this.XOffset, new Gdk.Rectangle (xPos, y, charWidth, LineHeight), selected ? 
ColorStyle.SelectedBg : (IsSearchResultAt (offset) ? ColorStyle.SearchTextBg : 
ColorStyle.Background));
+                                       DrawRectangleWithRuler (win, 
this.XOffset, new Gdk.Rectangle (xPos, y, charWidth, LineHeight), selected ? 
ColorStyle.SelectedBg : (IsSearchResultAt (offset) ? ColorStyle.SearchTextBg : 
defaultBgColor));
                                        
                                        if 
(TextEditorOptions.Options.ShowSpaces) 
                                                DrawSpaceMarker (win, selected, 
xPos, y);
@@ -400,7 +400,7 @@
                                        int delta = (newColumn - visibleColumn) 
* this.charWidth;
                                        visibleColumn = newColumn;
                                        
-                                       DrawRectangleWithRuler (win, 
this.XOffset, new Gdk.Rectangle (xPos, y, delta, LineHeight), selected ? 
ColorStyle.SelectedBg : (IsSearchResultAt (offset) ? ColorStyle.SearchTextBg : 
ColorStyle.Background));
+                                       DrawRectangleWithRuler (win, 
this.XOffset, new Gdk.Rectangle (xPos, y, delta, LineHeight), selected ? 
ColorStyle.SelectedBg : (IsSearchResultAt (offset) ? ColorStyle.SearchTextBg : 
defaultBgColor));
                                        if (TextEditorOptions.Options.ShowTabs) 
                                                DrawTabMarker (win, selected, 
xPos, y);
                                        if (offset == caretOffset) 
@@ -613,6 +613,8 @@
                }
                
                List<ISegment> selectedRegions = new List<ISegment> ();
+               
+               Gdk.Color      defaultBgColor;
                public override void Draw (Gdk.Drawable win, Gdk.Rectangle 
area, int lineNr, int x, int y)
                {
                        this.caretX = -1;
@@ -621,13 +623,19 @@
                        int xStart = System.Math.Max (area.X, XOffset);
                        gc.ClipRectangle = new Gdk.Rectangle (xStart, y, 
area.Right - xStart, LineHeight);
                        
+                       if (TextEditorOptions.Options.HighlightCaretLine && 
Caret.Line == lineNr) {
+                               defaultBgColor = ColorStyle.LineMarker;
+                       } else {
+                               defaultBgColor = ColorStyle.Background;
+                       }
+                               
                        Gdk.Rectangle lineArea = new Gdk.Rectangle (XOffset, y, 
textEditor.Allocation.Width - XOffset, LineHeight);
                        int width, height;
                        int xPos = (int)(x - textEditor.HAdjustment.Value);
                        
                        if (line == null) {
                                if (TextEditorOptions.Options.ShowInvalidLines) 
{
-                                       DrawRectangleWithRuler (win, x, 
lineArea, this.ColorStyle.Background);
+                                       DrawRectangleWithRuler (win, x, 
lineArea, defaultBgColor);
                                        DrawInvalidLineMarker (win, xPos, y);
                                }
                                if (TextEditorOptions.Options.ShowRuler) { // 
warning: code duplication, look at the method end.
@@ -666,7 +674,7 @@
                                        layout.SetText (folding.Description);
                                        layout.GetPixelSize (out width, out 
height);
                                        bool isFoldingSelected = 
textEditor.IsSomethingSelected && textEditor.SelectionRange.Contains (folding);
-                                       gc.RgbFgColor = isFoldingSelected ? 
ColorStyle.SelectedBg : ColorStyle.Background;
+                                       gc.RgbFgColor = isFoldingSelected ? 
ColorStyle.SelectedBg : defaultBgColor;
                                        win.DrawRectangle (gc, true, new 
Rectangle (xPos, y, width - 1, this.LineHeight - 1));
                                        gc.RgbFgColor = isFoldingSelected ? 
ColorStyle.SelectedFg : ColorStyle.FoldLine;
                                        win.DrawRectangle (gc, false, new 
Rectangle (xPos, y, width - 1, this.LineHeight - 1));
@@ -699,7 +707,7 @@
                        
                        lineArea.X     = xPos;
                        lineArea.Width = textEditor.Allocation.Width - xPos;
-                       DrawRectangleWithRuler (win, x, lineArea, isEolSelected 
? this.ColorStyle.SelectedBg : this.ColorStyle.Background);
+                       DrawRectangleWithRuler (win, x, lineArea, isEolSelected 
? this.ColorStyle.SelectedBg : defaultBgColor);
                        
                        if (TextEditorOptions.Options.ShowEolMarkers)
                                DrawEolMarker (win, isEolSelected, xPos, y);

_______________________________________________
Mono-patches maillist  -  Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to