Author: mkrueger
Date: 2008-02-17 12:33:01 -0500 (Sun, 17 Feb 2008)
New Revision: 95985

Added:
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/SearchOptions.cs
Modified:
   trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
   trunk/monodevelop/main/src/addins/Mono.Texteditor/Makefile.am
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Style.cs
   trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp
   trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Document.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/LineSegment.cs
   trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Segment.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorData.cs
   trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextUtil.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
   trunk/monodevelop/main/src/addins/Mono.Texteditor/gtk-gui/objects.xml
Log:
* Mono.TextEditor/TextViewMargin.cs, Mono.TextEditor/Document.cs,
  Mono.TextEditor/SearchOptions.cs, Mono.TextEditor/TextUtil.cs,
  Mono.TextEditor/TextEditorData.cs, Mono.TextEditor/TextEditor.cs,
  Mono.TextEditor/Segment.cs, Mono.TextEditor/LineSegment.cs,
  Mono.TextEditor.Highlighting/Style.cs: Worked on search and
  replace.

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-17 
17:19:10 UTC (rev 95984)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-17 
17:33:01 UTC (rev 95985)
@@ -1,3 +1,11 @@
+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,
+         Mono.TextEditor/Segment.cs, Mono.TextEditor/LineSegment.cs,
+         Mono.TextEditor.Highlighting/Style.cs: Worked on search and replace.
+
 2008-02-16  Mike Krüger <[EMAIL PROTECTED]> 
 
        * Mono.TextEditor/TextViewMargin.cs: Small refactorings.

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/Makefile.am
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/Makefile.am       
2008-02-17 17:19:10 UTC (rev 95984)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/Makefile.am       
2008-02-17 17:33:01 UTC (rev 95985)
@@ -45,6 +45,7 @@
        Mono.TextEditor/LineSplitter.cs \
        Mono.TextEditor/RedBlackTree.cs \
        Mono.TextEditor/ReplaceEventArgs.cs \
+       Mono.TextEditor/SearchOptions.cs \
        Mono.TextEditor/Segment.cs \
        Mono.TextEditor/SelectionMarker.cs \
        Mono.TextEditor/TextEditor.cs \

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Document.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Document.cs   
    2008-02-17 17:19:10 UTC (rev 95984)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Document.cs   
    2008-02-17 17:33:01 UTC (rev 95985)
@@ -494,7 +494,7 @@
                {
                        int line = LogicalToVisualLine (location.Line);
                        int column = 0;
-                       LineSegment lineSegment = this.GetLine (location.Line);
+//                     LineSegment lineSegment = this.GetLine (location.Line);
                        return new DocumentLocation (line, column);
                }
                

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/LineSegment.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/LineSegment.cs
    2008-02-17 17:19:10 UTC (rev 95984)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/LineSegment.cs
    2008-02-17 17:33:01 UTC (rev 95985)
@@ -191,7 +191,7 @@
                }
                public bool Contains (ISegment segment)
                {
-                       return  Offset <= segment.Offset && segment.EndOffset < 
EndOffset;
+                       return  Offset <= segment.Offset && segment.EndOffset 
<= EndOffset;
                }
                
                public override string ToString ()

Added: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/SearchOptions.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/SearchOptions.cs
  2008-02-17 17:19:10 UTC (rev 95984)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/SearchOptions.cs
  2008-02-17 17:33:01 UTC (rev 95985)
@@ -0,0 +1,56 @@
+//
+// SearchOptions.cs
+//
+// Author:
+//   Mike Krüger <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Mono.TextEditor
+{
+       public class SearchOptions
+       {
+               bool isCaseSensitive = true;
+               public bool IsCaseSensitive {
+                       get {
+                               return isCaseSensitive;
+                       }
+                       set {
+                               isCaseSensitive = value;
+                       }
+               }
+               
+               bool isWholeWordOnly = false;
+               public bool IsWholeWordOnly {
+                       get {
+                               return isWholeWordOnly;
+                       }
+                       
+                       set {
+                               isWholeWordOnly = value;
+                       }
+               }
+       }
+}

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Segment.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Segment.cs    
    2008-02-17 17:19:10 UTC (rev 95984)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Segment.cs    
    2008-02-17 17:33:01 UTC (rev 95985)
@@ -74,7 +74,7 @@
                }
                public bool Contains (ISegment segment)
                {
-                       return  Offset <= segment.Offset && segment.EndOffset < 
EndOffset;
+                       return  Offset <= segment.Offset && segment.EndOffset 
<= EndOffset;
                }
                
                public override string ToString ()

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-02-17 17:19:10 UTC (rev 95984)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-02-17 17:33:01 UTC (rev 95985)
@@ -762,6 +762,9 @@
                        get {
                                return this.textEditorData.SelectedText;
                        }
+                       set {
+                               this.textEditorData.SelectedText = value;
+                       }
                }
                
                public IEnumerable<LineSegment> SelectedLines {
@@ -797,6 +800,8 @@
                        action.Run (this.textEditorData);
                }
                
+               
+               
                /// <summary>
                /// Use with care.
                /// </summary>
@@ -814,7 +819,142 @@
                        if (SelectionChanged != null) 
                                SelectionChanged (this, args);
                }
+               #endregion
                
+               #region Search and Replace
+               bool highlightSearchPattern = false;
+               string compiledPattern = "";
+               public string SearchPattern {
+                       get {
+                               return this.textEditorData.SearchPattern;
+                       }
+                       set {
+                               this.textEditorData.SearchPattern = value;
+                               CompilePattern ();
+                               this.QueueDraw ();
+                       }
+               }
+               
+               public bool HighlightSearchPattern {
+                       get {
+                               return highlightSearchPattern;
+                       }
+                       set {
+                               if (highlightSearchPattern != value) {
+                                       this.highlightSearchPattern = value;
+                                       this.QueueDraw ();
+                               }
+                       }
+               }
+               
+               public SearchOptions SearchOptions = new SearchOptions ();
+               internal bool IsMatchAt (int offset)
+               {
+                       if (offset + SearchPattern.Length <= Document.Length && 
compiledPattern.Length > 0) {
+                               if (SearchOptions.IsCaseSensitive) {
+                                       for (int i = 0; i < 
compiledPattern.Length; i++) {
+                                               if (Document.GetCharAt (offset 
+ i) != compiledPattern[i]) 
+                                                       return false;
+                                       }
+                               } else {
+                                       for (int i = 0; i < 
compiledPattern.Length; i++) {
+                                               if (System.Char.ToUpper 
(Document.GetCharAt (offset + i)) != compiledPattern[i]) 
+                                                       return false;
+                                       }
+                               }
+                               if (SearchOptions.IsWholeWordOnly) {
+                                       return TextUtil.IsWholeWordAt 
(Document, offset, compiledPattern.Length);
+                               }
+                               return true;
+                       }
+                       return false;
+               }
+               
+               void CompilePattern ()
+               {
+                       compiledPattern = SearchOptions.IsCaseSensitive ? 
SearchPattern : SearchPattern.ToUpper ();
+               }
+               
+               public int SearchForward (int fromOffset)
+               {
+                       for (int i = 0; i < Document.Length - 
this.SearchPattern.Length; i++) {
+                               int offset = (fromOffset + i) % Document.Length;
+                               if (IsMatchAt (offset)) {
+                                       return offset;
+                               }
+                       }
+                       return -1;
+               }
+               
+               public int SearchBackward (int fromOffset)
+               {
+                       for (int i = 0; i < Document.Length - 
this.SearchPattern.Length; i++) {
+                               int offset = (fromOffset + Document.Length - i) 
% Document.Length;
+                               if (IsMatchAt (offset)) {
+                                       return offset;
+                               }
+                       }
+                       return -1;
+               }
+               
+               public bool FindNext ()
+               {
+                       int offset = SearchForward (Caret.Offset + 1);
+                       if (offset >= 0) {
+                               Segment searchResultRegion = new Segment 
(offset, SearchPattern.Length);
+                               Caret.Offset = searchResultRegion.EndOffset;
+                               SelectionRange = searchResultRegion;
+                               return true;
+                       }
+                       return false;
+               }
+               
+               public bool FindPrevious ()
+               {
+                       int startOffset = Caret.Offset;
+                       if (IsSomethingSelected && SelectionRange.Offset == 
SearchBackward (SelectionRange.Offset)) {
+                               startOffset = SelectionRange.Offset;
+                       }
+                       int offset = SearchBackward ((startOffset + 
Document.Length - 1) % Document.Length);
+                       if (offset >= 0) {
+                               Segment searchResultRegion = new Segment 
(offset, SearchPattern.Length);
+                               Caret.Offset = searchResultRegion.EndOffset;
+                               SelectionRange = searchResultRegion;
+                       }
+                       return false;
+               }
+               
+               public bool Replace (string withPattern)
+               {
+                       bool result = false;
+                       if (this.IsSomethingSelected) {
+                               ISegment selection = this.SelectionRange;
+                               if (IsMatchAt (selection.Offset) && 
selection.Length == compiledPattern.Length) {
+                                       SelectedText = withPattern;
+                                       ClearSelection ();
+                                       result = true;
+                               }
+                       }
+                       return FindNext () || result;
+               }
+               
+               public void ReplaceAll (string withPattern)
+               {
+                       Document.BeginAtomicUndo ();
+                       bool foundAtLeastOnce = false;
+                       for (int i = 0; i < Document.Length - 
compiledPattern.Length; i++) {
+                               if (IsMatchAt (i)) {
+                                       foundAtLeastOnce = true;
+                                       Document.Replace (i, 
SearchPattern.Length, withPattern);
+                                       if (withPattern.Length > 0)
+                                               i += withPattern.Length - 1;
+                               }
+                       }
+                       if (foundAtLeastOnce)
+                               ClearSelection ();
+                       Document.EndAtomicUndo ();
+               }
                #endregion
+               
        }
 }

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorData.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorData.cs
 2008-02-17 17:19:10 UTC (rev 95984)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorData.cs
 2008-02-17 17:33:01 UTC (rev 95985)
@@ -38,6 +38,8 @@
                Document   document; 
                Caret      caret;
                
+               string searchPattern = "";
+               
                public TextEditorData ()
                {
                        Document = new Document ();
@@ -122,6 +124,15 @@
                                        return null;
                                return this.Document.GetTextAt 
(this.SelectionRange);
                        }
+                       set {
+                               if (!IsSomethingSelected)
+                                       return;
+                               ISegment selection = this.SelectionRange;
+                               Document.Replace (selection.Offset, 
selection.Length, value);
+                               if (this.Caret.Offset > selection.Offset)
+                                       this.Caret.Offset   = selection.Offset 
+ value.Length;
+                               this.SelectionRange = new 
Segment(selection.Offset, value.Length);
+                       }
                }
                
                public IEnumerable<LineSegment> SelectedLines {
@@ -181,6 +192,15 @@
                        }
                }
                
+               public string SearchPattern {
+                       get {
+                               return searchPattern;
+                       }
+                       set {
+                               searchPattern = value;
+                       }
+               }
+               
                public void ClearSelection ()
                {
                        this.selectionStart = this.selectionEnd = null;

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextUtil.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextUtil.cs   
    2008-02-17 17:19:10 UTC (rev 95984)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextUtil.cs   
    2008-02-17 17:33:01 UTC (rev 95985)
@@ -40,6 +40,17 @@
                        return (openBrackets + closingBrackets).IndexOf (ch) >= 
0;
                }
                
+               public static bool IsWordSeparator (char c)
+               {
+                       return Char.IsWhiteSpace (c) || (Char.IsPunctuation (c) 
&& c != '_');
+               }
+               
+               public static bool IsWholeWordAt (Document doc, int offset, int 
length)
+               {
+                       return offset == 0 || IsWordSeparator (doc.GetCharAt 
(offset - 1)) &&
+                                  offset + length == doc.Length || 
IsWordSeparator (doc.GetCharAt (offset + length));
+               }
+               
                public static int GetMatchingBracketOffset (Document document, 
int offset)
                {
                        char ch = document.GetCharAt (offset);
@@ -106,7 +117,7 @@
                                }
                                offset += direction;
                        }
-                       return -1;                      
+                       return -1;
                }
        }
 }

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:19:10 UTC (rev 95984)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
 2008-02-17 17:33:01 UTC (rev 95985)
@@ -60,7 +60,7 @@
                                return lineHeight;
                        }
                }
-
+               
                public override int Width {
                        get {
                                return -1;
@@ -283,17 +283,38 @@
                StringBuilder wordBuilder = new StringBuilder ();
                void OutputWordBuilder (Gdk.Drawable win, LineSegment line, 
bool selected, ChunkStyle style, ref int visibleColumn, ref int xPos, int y, 
int curOffset)
                {
-                       int oldxPos = xPos;
-                       
+                       int oldxPos     = xPos;
+                       int startOffset = curOffset - wordBuilder.Length;
+                       string text = wordBuilder.ToString ();
                        if (selected) {
-                               DrawText (win, ColorStyle.SelectedFg, 
ColorStyle.SelectedBg, ref xPos, y);
+                               DrawText (win, text, ColorStyle.SelectedFg, 
ColorStyle.SelectedBg, ref xPos, y);
                        } else {
-                               DrawText (win, style.Color, 
ColorStyle.Background, ref xPos, y);
+                               ISegment firstSearch;
+                               int offset = startOffset;
+                               int s;
+                               while ((firstSearch = GetFirstSearchResult 
(offset, curOffset)) != null) {
+                                       // 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);
+                                               offset += firstSearch.Offset - 
offset;
+                                       }
+                                       // Draw text within the search result
+                                       s = offset - startOffset;
+                                       int len = System.Math.Min 
(firstSearch.EndOffset - offset, text.Length - s);
+                                       if (len > 0)
+                                               DrawText (win, text.Substring 
(s, len), style.Color, ColorStyle.SearchTextBg, ref xPos, y);
+                                       offset = System.Math.Max 
(firstSearch.EndOffset, offset + 1);
+                               }
+                               s = offset - startOffset;
+                               if (s < wordBuilder.Length) {
+                                       DrawText (win, text.Substring (s, 
wordBuilder.Length - s), style.Color, ColorStyle.Background, ref xPos, y);
+                               }
                        }
                        
                        if (line.Markers != null) {
                                foreach (TextMarker marker in line.Markers) {
-                                       marker.Draw (textEditor, win, selected, 
curOffset - wordBuilder.Length, curOffset, y, oldxPos, xPos);
+                                       marker.Draw (textEditor, win, selected, 
startOffset, curOffset, y, oldxPos, xPos);
                                }
                        }
                        
@@ -301,6 +322,29 @@
                        wordBuilder.Length = 0;
                }
                
+               ISegment GetFirstSearchResult (int startOffset, int endOffset)
+               {
+                       if (startOffset < endOffset) {
+                               ISegment region = new Segment (startOffset, 
endOffset - startOffset);
+                               foreach (ISegment segment in 
this.selectedRegions) {
+                                       if (segment.Contains (startOffset) || 
segment.Contains (endOffset) || 
+                                           region.Contains (segment)) {
+                                               return segment;
+                                       }
+                               }
+                       }
+                       return null;
+               }
+               
+               bool IsSearchResultAt (int offset)
+               {
+                       foreach (ISegment segment in this.selectedRegions) {
+                               if (segment.Contains (offset))
+                                       return true;
+                       }
+                       return false;
+               }
+               
                void DrawStyledText (Gdk.Drawable win, LineSegment line, bool 
selected, ChunkStyle style, ref int visibleColumn, ref int xPos, int y, int 
startOffset, int endOffset)
                {
                        int caretOffset = Caret.Offset;
@@ -335,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 : ColorStyle.Background);
+                                       DrawRectangleWithRuler (win, 
this.XOffset, new Gdk.Rectangle (xPos, y, charWidth, LineHeight), selected ? 
ColorStyle.SelectedBg : (IsSearchResultAt (offset) ? ColorStyle.SearchTextBg : 
ColorStyle.Background));
                                        
                                        if 
(TextEditorOptions.Options.ShowSpaces) 
                                                DrawSpaceMarker (win, selected, 
xPos, y);
@@ -356,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 : ColorStyle.Background);
+                                       DrawRectangleWithRuler (win, 
this.XOffset, new Gdk.Rectangle (xPos, y, delta, LineHeight), selected ? 
ColorStyle.SelectedBg : (IsSearchResultAt (offset) ? ColorStyle.SearchTextBg : 
ColorStyle.Background));
                                        if (TextEditorOptions.Options.ShowTabs) 
                                                DrawTabMarker (win, selected, 
xPos, y);
                                        if (offset == caretOffset) 
@@ -385,9 +429,9 @@
                                SetVisibleCaretPosition (win, 
Document.GetCharAt (caretOffset), drawCaretAt, y);
                }
                
-               void DrawText (Gdk.Drawable win, Gdk.Color foreColor, Gdk.Color 
backgroundColor, ref int xPos, int y)
+               void DrawText (Gdk.Drawable win, string text, Gdk.Color 
foreColor, Gdk.Color backgroundColor, ref int xPos, int y)
                {
-                       layout.SetText (wordBuilder.ToString ());
+                       layout.SetText (text);
                        
                        int width, height;
                        layout.GetPixelSize (out width, out height);
@@ -568,6 +612,7 @@
                        win.DrawRectangle (gc, true, area);
                }
                
+               List<ISegment> selectedRegions = new List<ISegment> ();
                public override void Draw (Gdk.Drawable win, Gdk.Rectangle 
area, int lineNr, int x, int y)
                {
                        this.caretX = -1;
@@ -591,6 +636,13 @@
                                }
                                return;
                        }
+                       selectedRegions.Clear ();
+                       if (textEditor.HighlightSearchPattern) {
+                               for (int i = line.Offset; i < line.EndOffset; 
i++) {
+                                       if (this.textEditor.IsMatchAt (i))
+                                               selectedRegions.Add (new 
Segment (i, textEditor.SearchPattern.Length));
+                               }
+                       }
                        
                        List<FoldSegment> foldings = Document.GetStartFoldings 
(line);
                        int offset = line.Offset;

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Style.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Style.cs
     2008-02-17 17:19:10 UTC (rev 95984)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Style.cs
     2008-02-17 17:33:01 UTC (rev 95985)
@@ -38,6 +38,7 @@
                string description;
                
                Color def, background, selectedBg, selectedFg;
+               Color searchTextBg;
                Color caret;
                Color lineMarker, ruler, whitespaceMarker, invalidLineMarker;
                Color caretForeground;
@@ -201,6 +202,15 @@
                                return caretForeground;
                        }
                }
+
+               public Color SearchTextBg {
+                       get {
+                               return searchTextBg;
+                       }
+                       set {
+                               searchTextBg = value;
+                       }
+               }
                
                public Style ()
                {
@@ -227,6 +237,8 @@
                        whitespaceMarker  = new Gdk.Color (187, 187, 187);
                        invalidLineMarker = new Gdk.Color (210, 0, 0);
                        
+                       searchTextBg = new Gdk.Color (250, 250, 0);
+                       
                        bracketHighlightBg        = new Gdk.Color (196, 196, 
196);
                        bracketHighlightRectangle = new Gdk.Color (128, 128, 
128);
                        
@@ -319,6 +331,7 @@
                        case "bracketHighlightBg":
                        case "bookmarkColor1":
                        case "bookmarkColor2":
+                       case "searchTextBg":
                                return false;
                        }
                        return true;
@@ -409,6 +422,9 @@
                        case "bookmarkColor2":
                                this.bookmarkColor2 = color;
                                break;
+                       case "searchTextBg":
+                               this.searchTextBg = color;
+                               break;
                        default:
                                throw new Exception ("color  " + name + " 
invalid.");
                        }

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp       
2008-02-17 17:19:10 UTC (rev 95984)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp       
2008-02-17 17:33:01 UTC (rev 95985)
@@ -72,6 +72,7 @@
     <File name="Mono.TextEditor/TextViewMargin.cs" subtype="Code" 
buildaction="Compile" />
     <File name="Mono.TextEditor.Highlighting/SemanticRule.cs" subtype="Code" 
buildaction="Compile" />
     <File name="VisualStudioStyle.xml" subtype="Code" 
buildaction="EmbedAsResource" />
+    <File name="Mono.TextEditor/SearchOptions.cs" subtype="Code" 
buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/gtk-gui/objects.xml
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/gtk-gui/objects.xml       
2008-02-17 17:19:10 UTC (rev 95984)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/gtk-gui/objects.xml       
2008-02-17 17:33:01 UTC (rev 95985)
@@ -1,6 +1,11 @@
 <objects>
   <object type="Mono.TextEditor.TextEditor" palette-category="Mono.TextEditor" 
allow-children="false" base-type="Gtk.DrawingArea">
     <itemgroups>
+      <itemgroup label="TextEditor Properties">
+        <property name="SearchPattern" />
+        <property name="HighlightSearchPattern" />
+        <property name="SelectedText" />
+      </itemgroup>
     </itemgroups>
     <signals>
       <itemgroup label="TextEditor Signals">

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to