[Monodevelop-patches-list] r757 - in trunk/MonoDevelop/src/AddIns/DisplayBindings: EditorBindings EditorBindings/Search EditorBindings/Search/SearchStrategy EditorBindings/Search/TextIterator TextEditor TextEditor/Gui/Dialogs TextEditor/Search TextEditor/Search/TextIterator
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Mon Feb 2 18:55:01 EST 2004
Author: benm
Date: 2004-02-02 18:55:01 -0500 (Mon, 02 Feb 2004)
New Revision: 757
Added:
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchOptions.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/BruteForceSearchStrategy.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/KMPSearchStrategy.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/RegExSearchStrategy.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/WildcardSearchStrategy.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/TextIterator/
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/TextIterator/ITextIterator.cs
Removed:
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/BruteForceSearchStrategy.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/KMPSearchStrategy.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/RegExSearchStrategy.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/WildcardSearchStrategy.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchOptions.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ITextIterator.cs
Modified:
trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/ISearchStrategy.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Dialogs/ReplaceDialog.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Makefile
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/DefaultFind.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/IFind.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchReplaceInFilesManager.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchReplaceManager.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchReplaceUtilities.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ForwardTextIterator.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ForwardTextIteratorBuilder.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ITextIteratorBuilder.cs
Log:
refactorize
Copied: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchOptions.cs (from rev 755, trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchOptions.cs)
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchOptions.cs 2004-02-02 19:40:02 UTC (rev 755)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchOptions.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -0,0 +1,154 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.IO;
+
+using ICSharpCode.Core.Services;
+using ICSharpCode.Core.Properties;
+
+namespace MonoDevelop.EditorBindings.Search {
+
+ public enum DocumentIteratorType {
+ None,
+ CurrentDocument,
+ AllOpenFiles,
+ WholeCombine,
+ Directory // only used for search in files
+ }
+
+ public enum SearchStrategyType {
+ None,
+ Normal,
+ RegEx,
+ Wildcard
+ }
+
+ public class SearchOptions
+ {
+ static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
+ IProperties properties;
+
+ public bool IgnoreCase {
+ get {
+ return properties.GetProperty("IgnoreCase", false);
+ }
+ set {
+ properties.SetProperty("IgnoreCase", value);
+ }
+ }
+
+ public bool SearchWholeWordOnly {
+ get {
+ return properties.GetProperty("SearchWholeWordOnly", false);
+ }
+
+ set {
+ properties.SetProperty("SearchWholeWordOnly", value);
+ }
+ }
+
+ public string SearchPattern {
+ get {
+ return properties.GetProperty("SearchPattern", String.Empty);
+ }
+ set {
+ properties.SetProperty("SearchPattern", value);
+ }
+ }
+
+ public string ReplacePattern {
+ get {
+ return properties.GetProperty("ReplacePattern", String.Empty);
+ }
+ set {
+ properties.SetProperty("ReplacePattern", value);
+ }
+ }
+
+ public DocumentIteratorType DocumentIteratorType {
+ get {
+ return (DocumentIteratorType)propertyService.GetProperty("DocumentIteratorType", DocumentIteratorType.CurrentDocument);
+ }
+ set {
+ if (DocumentIteratorType != value) {
+ propertyService.SetProperty("DocumentIteratorType", value);
+ OnDocumentIteratorTypeChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public SearchStrategyType SearchStrategyType {
+ get {
+ return (SearchStrategyType)propertyService.GetProperty("SearchStrategyType", SearchStrategyType.Normal);
+ }
+ set {
+ if (SearchStrategyType != value) {
+ propertyService.SetProperty("SearchStrategyType", value);
+ OnSearchStrategyTypeChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public string FileMask {
+ get {
+ return propertyService.GetProperty("FileMask", String.Empty);
+ }
+ set {
+ propertyService.SetProperty("FileMask", value);
+ }
+ }
+
+ public string SearchDirectory {
+ get {
+ return propertyService.GetProperty("SearchDirectory", String.Empty);
+ }
+ set {
+ propertyService.SetProperty("SearchDirectory", value);
+ }
+ }
+
+ public bool SearchSubdirectories {
+ get {
+ return propertyService.GetProperty("SearchSubdirectories", true);
+ }
+ set {
+ propertyService.SetProperty("SearchSubdirectories", value);
+ }
+ }
+
+ /// <remarks>
+ /// For unit testing purposes
+ /// </remarks>
+ public SearchOptions(IProperties properties)
+ {
+ this.properties = properties;
+ }
+
+ public SearchOptions(string propertyName)
+ {
+ properties = (IProperties)propertyService.GetProperty(propertyName, new DefaultProperties());
+ }
+
+ protected void OnDocumentIteratorTypeChanged(EventArgs e)
+ {
+ if (DocumentIteratorTypeChanged != null) {
+ DocumentIteratorTypeChanged(this, e);
+ }
+ }
+
+ protected void OnSearchStrategyTypeChanged(EventArgs e)
+ {
+ if (SearchStrategyTypeChanged != null) {
+ SearchStrategyTypeChanged(this, e);
+ }
+ }
+
+ public event EventHandler DocumentIteratorTypeChanged;
+ public event EventHandler SearchStrategyTypeChanged;
+ }
+}
Copied: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy (from rev 755, trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy)
Deleted: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/BruteForceSearchStrategy.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/BruteForceSearchStrategy.cs 2004-02-02 19:40:02 UTC (rev 755)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/BruteForceSearchStrategy.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -1,72 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-
-using ICSharpCode.Core.Properties;
-using ICSharpCode.SharpDevelop.Internal.Undo;
-
-namespace ICSharpCode.TextEditor.Document
-{
- /// <summary>
- /// Only for fallback purposes.
- /// </summary>
- public class BruteForceSearchStrategy : ISearchStrategy
- {
- string searchPattern;
-
- bool MatchCaseSensitive(ITextBufferStrategy document, int offset, string pattern)
- {
- for (int i = 0; i < pattern.Length; ++i) {
- if (offset + i >= document.Length || document.GetCharAt(offset + i) != pattern[i]) {
- return false;
- }
- }
- return true;
- }
-
- bool MatchCaseInsensitive(ITextBufferStrategy document, int offset, string pattern)
- {
- for (int i = 0; i < pattern.Length; ++i) {
- if (offset + i >= document.Length || Char.ToUpper(document.GetCharAt(offset + i)) != pattern[i]) {
- return false;
- }
- }
- return true;
- }
-
- bool IsWholeWordAt(ITextBufferStrategy document, int offset, int length)
- {
- return (offset - 1 < 0 || Char.IsWhiteSpace(document.GetCharAt(offset - 1))) &&
- (offset + length + 1 >= document.Length || Char.IsWhiteSpace(document.GetCharAt(offset + length)));
- }
-
- int InternalFindNext(ITextIterator textIterator, SearchOptions options)
- {
- while (textIterator.MoveAhead(1)) {
- if (options.IgnoreCase ? MatchCaseInsensitive(textIterator.TextBuffer, textIterator.Position, searchPattern) :
- MatchCaseSensitive(textIterator.TextBuffer, textIterator.Position, searchPattern)) {
- if (!options.SearchWholeWordOnly || IsWholeWordAt(textIterator.TextBuffer, textIterator.Position, searchPattern.Length)) {
- return textIterator.Position;
- }
- }
- }
- return -1;
- }
-
- public void CompilePattern(SearchOptions options)
- {
- searchPattern = options.IgnoreCase ? options.SearchPattern.ToUpper() : options.SearchPattern;
- }
-
- public ISearchResult FindNext(ITextIterator textIterator, SearchOptions options)
- {
- int offset = InternalFindNext(textIterator, options);
- return offset >= 0 ? new DefaultSearchResult(offset, searchPattern.Length) : null;
- }
- }
-}
Copied: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/BruteForceSearchStrategy.cs (from rev 756, trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/BruteForceSearchStrategy.cs)
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/BruteForceSearchStrategy.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/BruteForceSearchStrategy.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -0,0 +1,64 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+
+using ICSharpCode.Core.Properties;
+
+namespace MonoDevelop.EditorBindings.Search {
+ /// <summary>
+ /// Only for fallback purposes.
+ /// </summary>
+ public class BruteForceSearchStrategy : ISearchStrategy
+ {
+ string searchPattern;
+
+ bool MatchCaseSensitive(ITextIterator iter, int offset, string pattern)
+ {
+ for (int i = 0; i < pattern.Length; ++i) {
+ if (offset + i >= iter.Length || iter.GetCharAt(offset + i) != pattern[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ bool MatchCaseInsensitive(ITextIterator iter, int offset, string pattern)
+ {
+ for (int i = 0; i < pattern.Length; ++i) {
+ if (offset + i >= iter.Length || Char.ToUpper(iter.GetCharAt(offset + i)) != pattern[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ int InternalFindNext(ITextIterator textIterator, SearchOptions options)
+ {
+ while (textIterator.MoveAhead(1)) {
+ if (options.IgnoreCase ? MatchCaseInsensitive(textIterator, textIterator.Position, searchPattern) :
+ MatchCaseSensitive(textIterator, textIterator.Position, searchPattern)) {
+ if (!options.SearchWholeWordOnly || textIterator.IsWholeWordAt (textIterator.Position, searchPattern.Length)) {
+ return textIterator.Position;
+ }
+ }
+ }
+ return -1;
+ }
+
+ public void CompilePattern(SearchOptions options)
+ {
+ searchPattern = options.IgnoreCase ? options.SearchPattern.ToUpper() : options.SearchPattern;
+ }
+
+ public SearchResult FindNext(ITextIterator textIterator, SearchOptions options)
+ {
+ int offset = InternalFindNext (textIterator, options);
+ return offset >= 0 ? new SearchResult (offset, searchPattern.Length) : null;
+ }
+ }
+}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/ISearchStrategy.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/ISearchStrategy.cs 2004-02-02 19:40:02 UTC (rev 755)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/ISearchStrategy.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -6,13 +6,8 @@
// </file>
using System;
-using System.Drawing;
-using ICSharpCode.Core.Properties;
-using ICSharpCode.SharpDevelop.Internal.Undo;
-
-namespace ICSharpCode.TextEditor.Document
-{
+namespace MonoDevelop.EditorBindings.Search {
/// <summary>
/// This interface is the basic interface which all
/// search algorithms must implement.
@@ -24,12 +19,21 @@
/// update their pattern information. This method will be called
/// before the FindNext function.
/// </remarks>
- void CompilePattern(SearchOptions options);
+ void CompilePattern (SearchOptions options);
/// <remarks>
/// The find next method should search the next occurrence of the
/// compiled pattern in the text using the textIterator and options.
/// </remarks>
- ISearchResult FindNext(ITextIterator textIterator, SearchOptions options);
+ SearchResult FindNext (ITextIterator textIterator, SearchOptions options);
}
+
+ public class SearchResult {
+ public readonly int Position, Length;
+ public SearchResult (int pos, int len)
+ {
+ this.Position = pos;
+ this.Length = len;
+ }
+ }
}
Deleted: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/KMPSearchStrategy.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/KMPSearchStrategy.cs 2004-02-02 19:40:02 UTC (rev 755)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/KMPSearchStrategy.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -1,78 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Andrea Paatz" email="andrea at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-
-namespace ICSharpCode.TextEditor.Document
-{
- /// <summary>
- /// Implements the Knuth, Morris, Pratt searching algorithm.
- /// </summary>
- public class KMPSearchStrategy : ISearchStrategy
- {
- string searchPattern;
- int[] overlap;
-
- public void CompilePattern(SearchOptions options)
- {
- if (searchPattern != (options.IgnoreCase ? options.SearchPattern.ToUpper() : options.SearchPattern)) {
- searchPattern = options.IgnoreCase ? options.SearchPattern.ToUpper() : options.SearchPattern;
- overlap = new int[searchPattern.Length + 1];
- Preprocessing();
- }
- }
-
- void Preprocessing()
- {
- overlap[0] = -1;
- for (int i = 0, j = -1; i < searchPattern.Length;) {
- while (j >= 0 && searchPattern[i] != searchPattern[j]) {
- j = overlap[j];
- }
- ++i;
- ++j;
- overlap[i] = j;
- }
- }
-
- int InternalFindNext(ITextIterator textIterator, SearchOptions options)
- {
- int j = 0;
- if (!textIterator.MoveAhead(1)) {
- return -1;
- }
- while (true) { // until pattern found or Iterator finished
- while (j >= 0 && searchPattern[j] != (options.IgnoreCase ? Char.ToUpper(textIterator.GetCharRelative(j)) : textIterator.GetCharRelative(j))) {
- if (!textIterator.MoveAhead(j - overlap[j])) {
- return -1;
- }
- j = overlap[j];
- }
- if (++j >= searchPattern.Length) {
- if ((!options.SearchWholeWordOnly || SearchReplaceUtilities.IsWholeWordAt(textIterator.TextBuffer, textIterator.Position, searchPattern.Length))) {
- return textIterator.Position;
- }
- if (!textIterator.MoveAhead(j - overlap[j])) {
- return -1;
- }
- j = overlap[j];
- }
- }
- }
-
- public ISearchResult FindNext(ITextIterator textIterator, SearchOptions options)
- {
- int offset = InternalFindNext(textIterator, options);
-
- if (offset + searchPattern.Length >= textIterator.TextBuffer.Length) {
- return FindNext(textIterator, options);
- }
-
- return offset >= 0 ? new DefaultSearchResult(offset, searchPattern.Length) : null;
- }
- }
-}
Copied: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/KMPSearchStrategy.cs (from rev 756, trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/KMPSearchStrategy.cs)
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/KMPSearchStrategy.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/KMPSearchStrategy.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -0,0 +1,77 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Andrea Paatz" email="andrea at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+
+namespace MonoDevelop.EditorBindings.Search {
+ /// <summary>
+ /// Implements the Knuth, Morris, Pratt searching algorithm.
+ /// </summary>
+ public class KMPSearchStrategy : ISearchStrategy
+ {
+ string searchPattern;
+ int[] overlap;
+
+ public void CompilePattern(SearchOptions options)
+ {
+ if (searchPattern != (options.IgnoreCase ? options.SearchPattern.ToUpper() : options.SearchPattern)) {
+ searchPattern = options.IgnoreCase ? options.SearchPattern.ToUpper() : options.SearchPattern;
+ overlap = new int[searchPattern.Length + 1];
+ Preprocessing();
+ }
+ }
+
+ void Preprocessing()
+ {
+ overlap[0] = -1;
+ for (int i = 0, j = -1; i < searchPattern.Length;) {
+ while (j >= 0 && searchPattern[i] != searchPattern[j]) {
+ j = overlap[j];
+ }
+ ++i;
+ ++j;
+ overlap[i] = j;
+ }
+ }
+
+ int InternalFindNext(ITextIterator textIterator, SearchOptions options)
+ {
+ int j = 0;
+ if (!textIterator.MoveAhead(1)) {
+ return -1;
+ }
+ while (true) { // until pattern found or Iterator finished
+ while (j >= 0 && searchPattern[j] != (options.IgnoreCase ? Char.ToUpper(textIterator.GetCharRelative(j)) : textIterator.GetCharRelative(j))) {
+ if (!textIterator.MoveAhead(j - overlap[j])) {
+ return -1;
+ }
+ j = overlap[j];
+ }
+ if (++j >= searchPattern.Length) {
+ if ((!options.SearchWholeWordOnly || textIterator.IsWholeWordAt (textIterator.Position, searchPattern.Length))) {
+ return textIterator.Position;
+ }
+ if (!textIterator.MoveAhead(j - overlap[j])) {
+ return -1;
+ }
+ j = overlap[j];
+ }
+ }
+ }
+
+ public SearchResult FindNext(ITextIterator textIterator, SearchOptions options)
+ {
+ int offset = InternalFindNext(textIterator, options);
+
+ if (offset + searchPattern.Length >= textIterator.Length) {
+ return FindNext(textIterator, options);
+ }
+
+ return offset >= 0 ? new SearchResult (offset, searchPattern.Length) : null;
+ }
+ }
+}
Deleted: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/RegExSearchStrategy.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/RegExSearchStrategy.cs 2004-02-02 19:40:02 UTC (rev 755)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/RegExSearchStrategy.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -1,50 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.Text.RegularExpressions;
-
-using ICSharpCode.Core.Properties;
-using ICSharpCode.SharpDevelop.Internal.Undo;
-
-namespace ICSharpCode.TextEditor.Document
-{
- public class RegExSearchStrategy : ISearchStrategy
- {
- Regex regex = null;
-
- public void CompilePattern(SearchOptions options)
- {
- RegexOptions regexOptions = RegexOptions.Compiled;
- if (options.IgnoreCase) {
- regexOptions |= RegexOptions.IgnoreCase;
- }
- regex = new Regex(options.SearchPattern, regexOptions);
- }
-
- public ISearchResult FindNext(ITextIterator textIterator, SearchOptions options)
- {
- string document = textIterator.TextBuffer.GetText(0, textIterator.TextBuffer.Length);
-
- while (textIterator.MoveAhead(1)) {
- Match m = regex.Match(document, textIterator.Position);
- if (m == null || m.Index <= 0 || m.Length <= 0) {
-
- } else {
- int delta = m.Index - textIterator.Position;
- if (delta <= 0 || textIterator.MoveAhead(delta)) {
- return new DefaultSearchResult(m.Index, m.Length);
- } else {
- return null;
- }
- }
- }
-
- return null;
- }
- }
-}
Copied: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/RegExSearchStrategy.cs (from rev 756, trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/RegExSearchStrategy.cs)
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/RegExSearchStrategy.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/RegExSearchStrategy.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -0,0 +1,48 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Text.RegularExpressions;
+
+using ICSharpCode.Core.Properties;
+
+namespace MonoDevelop.EditorBindings.Search {
+ public class RegExSearchStrategy : ISearchStrategy
+ {
+ Regex regex = null;
+
+ public void CompilePattern(SearchOptions options)
+ {
+ RegexOptions regexOptions = RegexOptions.Compiled;
+ if (options.IgnoreCase) {
+ regexOptions |= RegexOptions.IgnoreCase;
+ }
+ regex = new Regex(options.SearchPattern, regexOptions);
+ }
+
+ public SearchResult FindNext(ITextIterator textIterator, SearchOptions options)
+ {
+ string document = textIterator.FullDocumentText;
+
+ while (textIterator.MoveAhead(1)) {
+ Match m = regex.Match(document, textIterator.Position);
+ if (m == null || m.Index <= 0 || m.Length <= 0) {
+
+ } else {
+ int delta = m.Index - textIterator.Position;
+ if (delta <= 0 || textIterator.MoveAhead(delta)) {
+ return new SearchResult (m.Index, m.Length);
+ } else {
+ return null;
+ }
+ }
+ }
+
+ return null;
+ }
+ }
+}
Deleted: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/WildcardSearchStrategy.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/WildcardSearchStrategy.cs 2004-02-02 19:40:02 UTC (rev 755)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/WildcardSearchStrategy.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -1,157 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.Collections;
-
-using ICSharpCode.Core.Properties;
-using ICSharpCode.SharpDevelop.Internal.Undo;
-
-namespace ICSharpCode.TextEditor.Document
-{
- /// <summary>
- /// Implements a wildcard search strategy.
- ///
- /// Wildcard search has following pattern code :
- /// * = Zero or more of any character
- /// ? = Any single character
- /// # = Any single digit
- /// [...] = Any one character in the set
- /// [!...] = Any one character not in the set
- /// </summary>
- public class WildcardSearchStrategy : ISearchStrategy
- {
- enum CommandType {
- Match,
- AnyZeroOrMore,
- AnySingle,
- AnyDigit,
- AnyInList,
- NoneInList
- }
-
- class Command {
- public CommandType CommandType = CommandType.Match;
- public char SingleChar = '\0';
- public string CharList = String.Empty;
- }
-
- ArrayList patternProgram = null;
- int curMatchEndOffset = -1;
-
- void CompilePattern(string pattern, bool ignoreCase)
- {
- patternProgram = new ArrayList();
- for (int i = 0; i < pattern.Length; ++i) {
- Command newCommand = new Command();
- switch (pattern[i]) {
- case '#':
- newCommand.CommandType = CommandType.AnyDigit;
- break;
- case '*':
- newCommand.CommandType = CommandType.AnyZeroOrMore;
- break;
- case '?':
- newCommand.CommandType = CommandType.AnySingle;
- break;
- case '[':
- int index = pattern.IndexOf(']', i);
- if (index > 0) {
- newCommand.CommandType = CommandType.AnyInList;
- string list = pattern.Substring(i + 1, index - i - 1);
- if (list[0] == '!') {
- newCommand.CommandType = CommandType.NoneInList;
- list = list.Substring(1);
- }
- newCommand.CharList = ignoreCase ? list.ToUpper() : list;
- i = index;
- } else {
- goto default;
- }
- break;
- default:
- newCommand.CommandType = CommandType.Match;
- newCommand.SingleChar = ignoreCase ? Char.ToUpper(pattern[i]) : pattern[i];
- break;
- }
- patternProgram.Add(newCommand);
- }
- }
-
- bool Match(ITextBufferStrategy document,
- int offset,
- bool ignoreCase,
- int programStart)
- {
- int curOffset = offset;
- curMatchEndOffset = -1;
-
- for (int pc = programStart; pc < patternProgram.Count; ++pc) {
- if (curOffset >= document.Length) {
- return false;
- }
-
- char ch = ignoreCase ? Char.ToUpper(document.GetCharAt(curOffset)) : document.GetCharAt(curOffset);
- Command cmd = (Command)patternProgram[pc];
-
- switch (cmd.CommandType) {
- case CommandType.Match:
- if (ch != cmd.SingleChar) {
- return false;
- }
- break;
- case CommandType.AnyZeroOrMore:
- return Match(document, curOffset, ignoreCase, pc + 1) ||
- Match(document, curOffset + 1, ignoreCase, pc);
- case CommandType.AnySingle:
- break;
- case CommandType.AnyDigit:
- if (!Char.IsDigit(ch)) {
- return false;
- }
- break;
- case CommandType.AnyInList:
- if (cmd.CharList.IndexOf(ch) < 0) {
- return false;
- }
- break;
- case CommandType.NoneInList:
- if (cmd.CharList.IndexOf(ch) >= 0) {
- return false;
- }
- break;
- }
- ++curOffset;
- }
- curMatchEndOffset = curOffset;
- return true;
- }
-
- int InternalFindNext(ITextIterator textIterator, SearchOptions options)
- {
- while (textIterator.MoveAhead(1)) {
- if (Match(textIterator.TextBuffer, textIterator.Position, options.IgnoreCase, 0)) {
- if (!options.SearchWholeWordOnly || SearchReplaceUtilities.IsWholeWordAt(textIterator.TextBuffer, textIterator.Position, curMatchEndOffset - textIterator.Position)) {
- return textIterator.Position;
- }
- }
- }
- return -1;
- }
-
- public void CompilePattern(SearchOptions options)
- {
- CompilePattern(options.SearchPattern, options.IgnoreCase);
- }
-
- public ISearchResult FindNext(ITextIterator textIterator, SearchOptions options)
- {
- int offset = InternalFindNext(textIterator, options);
- return offset >= 0 ? new DefaultSearchResult(offset, curMatchEndOffset - offset) : null;
- }
- }
-}
Copied: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/WildcardSearchStrategy.cs (from rev 756, trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/WildcardSearchStrategy.cs)
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchStrategy/WildcardSearchStrategy.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/SearchStrategy/WildcardSearchStrategy.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -0,0 +1,155 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Collections;
+
+using ICSharpCode.Core.Properties;
+
+namespace MonoDevelop.EditorBindings.Search {
+ /// <summary>
+ /// Implements a wildcard search strategy.
+ ///
+ /// Wildcard search has following pattern code :
+ /// * = Zero or more of any character
+ /// ? = Any single character
+ /// # = Any single digit
+ /// [...] = Any one character in the set
+ /// [!...] = Any one character not in the set
+ /// </summary>
+ public class WildcardSearchStrategy : ISearchStrategy
+ {
+ enum CommandType {
+ Match,
+ AnyZeroOrMore,
+ AnySingle,
+ AnyDigit,
+ AnyInList,
+ NoneInList
+ }
+
+ class Command {
+ public CommandType CommandType = CommandType.Match;
+ public char SingleChar = '\0';
+ public string CharList = String.Empty;
+ }
+
+ ArrayList patternProgram = null;
+ int curMatchEndOffset = -1;
+
+ void CompilePattern(string pattern, bool ignoreCase)
+ {
+ patternProgram = new ArrayList();
+ for (int i = 0; i < pattern.Length; ++i) {
+ Command newCommand = new Command();
+ switch (pattern[i]) {
+ case '#':
+ newCommand.CommandType = CommandType.AnyDigit;
+ break;
+ case '*':
+ newCommand.CommandType = CommandType.AnyZeroOrMore;
+ break;
+ case '?':
+ newCommand.CommandType = CommandType.AnySingle;
+ break;
+ case '[':
+ int index = pattern.IndexOf(']', i);
+ if (index > 0) {
+ newCommand.CommandType = CommandType.AnyInList;
+ string list = pattern.Substring(i + 1, index - i - 1);
+ if (list[0] == '!') {
+ newCommand.CommandType = CommandType.NoneInList;
+ list = list.Substring(1);
+ }
+ newCommand.CharList = ignoreCase ? list.ToUpper() : list;
+ i = index;
+ } else {
+ goto default;
+ }
+ break;
+ default:
+ newCommand.CommandType = CommandType.Match;
+ newCommand.SingleChar = ignoreCase ? Char.ToUpper(pattern[i]) : pattern[i];
+ break;
+ }
+ patternProgram.Add(newCommand);
+ }
+ }
+
+ bool Match(ITextIterator iter,
+ int offset,
+ bool ignoreCase,
+ int programStart)
+ {
+ int curOffset = offset;
+ curMatchEndOffset = -1;
+
+ for (int pc = programStart; pc < patternProgram.Count; ++pc) {
+ if (curOffset >= iter.Length) {
+ return false;
+ }
+
+ char ch = ignoreCase ? Char.ToUpper(iter.GetCharAt(curOffset)) : iter.GetCharAt(curOffset);
+ Command cmd = (Command)patternProgram[pc];
+
+ switch (cmd.CommandType) {
+ case CommandType.Match:
+ if (ch != cmd.SingleChar) {
+ return false;
+ }
+ break;
+ case CommandType.AnyZeroOrMore:
+ return Match(iter, curOffset, ignoreCase, pc + 1) ||
+ Match(iter, curOffset + 1, ignoreCase, pc);
+ case CommandType.AnySingle:
+ break;
+ case CommandType.AnyDigit:
+ if (!Char.IsDigit(ch)) {
+ return false;
+ }
+ break;
+ case CommandType.AnyInList:
+ if (cmd.CharList.IndexOf(ch) < 0) {
+ return false;
+ }
+ break;
+ case CommandType.NoneInList:
+ if (cmd.CharList.IndexOf(ch) >= 0) {
+ return false;
+ }
+ break;
+ }
+ ++curOffset;
+ }
+ curMatchEndOffset = curOffset;
+ return true;
+ }
+
+ int InternalFindNext(ITextIterator textIterator, SearchOptions options)
+ {
+ while (textIterator.MoveAhead(1)) {
+ if (Match(textIterator, textIterator.Position, options.IgnoreCase, 0)) {
+ if (!options.SearchWholeWordOnly || textIterator.IsWholeWordAt (textIterator.Position, curMatchEndOffset - textIterator.Position)) {
+ return textIterator.Position;
+ }
+ }
+ }
+ return -1;
+ }
+
+ public void CompilePattern(SearchOptions options)
+ {
+ CompilePattern(options.SearchPattern, options.IgnoreCase);
+ }
+
+ public SearchResult FindNext(ITextIterator textIterator, SearchOptions options)
+ {
+ int offset = InternalFindNext(textIterator, options);
+ return offset >= 0 ? new SearchResult (offset, curMatchEndOffset - offset) : null;
+ }
+ }
+}
Copied: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/TextIterator/ITextIterator.cs (from rev 756, trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ITextIterator.cs)
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ITextIterator.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Search/TextIterator/ITextIterator.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -0,0 +1,71 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Collections;
+
+namespace MonoDevelop.EditorBindings.Search {
+ /// <summary>
+ /// This iterator iterates on a text buffer strategy.
+ /// </summary>
+ public interface ITextIterator
+ {
+ /// <value>
+ /// Gets the current char this is the same as
+ /// GetCharRelative(0)
+ /// </value>
+ /// <exception cref="System.InvalidOperationException">
+ /// If this method is called before the first MoveAhead or after
+ /// MoveAhead or after MoveAhead returns false.
+ /// </exception>
+ char Current {
+ get;
+ }
+
+ /// <value>
+ /// The current position=offset of the text iterator cursor
+ /// </value>
+ int Position {
+ get;
+ set;
+ }
+
+ int Length { get; }
+
+ string FullDocumentText { get; }
+
+ bool IsWholeWordAt (int offset, int length);
+ char GetCharAt (int p);
+
+ /// <remarks>
+ /// Gets a char relative to the current position (negative values
+ /// will work too).
+ /// </remarks>
+ /// <exception cref="System.InvalidOperationException">
+ /// If this method is called before the first MoveAhead or after
+ /// MoveAhead or after MoveAhead returns false.
+ /// </exception>
+ char GetCharRelative(int offset);
+
+ /// <remarks>
+ /// Moves the iterator position numChars
+ /// </remarks>
+ bool MoveAhead(int numChars);
+
+ /// <remarks>
+ /// Rests the iterator
+ /// </remarks>
+ void Reset();
+
+ /// <remarks>
+ /// The find object calls the InformReplace method to inform the text iterator
+ /// about the replace operation on the TextBuffer. The text iterator must update
+ /// all internal offsets to the new offsets (if neccessary)
+ /// </remarks>
+ void InformReplace(int offset, int length, int newLength);
+ }
+}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Dialogs/ReplaceDialog.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Dialogs/ReplaceDialog.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Dialogs/ReplaceDialog.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -21,6 +21,7 @@
//using ICSharpCode.XmlForms;
//using ICSharpCode.SharpDevelop.Gui.XmlForms;
using ICSharpCode.TextEditor;
+using MonoDevelop.EditorBindings.Search;
using Gtk;
using Glade;
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Makefile
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Makefile 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Makefile 2004-02-02 23:55:01 UTC (rev 757)
@@ -41,20 +41,13 @@
./Search/DocumentIterator/ReverseDocumentIterator.cs \
./Search/DocumentIterator/WholeProjectDocumentIterator.cs \
./Search/DocumentIterator/CurrentDocumentIterator.cs \
-./Search/SearchStrategy/KMPSearchStrategy.cs \
-./Search/SearchStrategy/ISearchStrategy.cs \
-./Search/SearchStrategy/BruteForceSearchStrategy.cs \
-./Search/SearchStrategy/RegExSearchStrategy.cs \
-./Search/SearchStrategy/WildcardSearchStrategy.cs \
./Search/SearchReplaceManager.cs \
./Search/DefaultFind.cs \
./Search/SearchResult/DefaultSearchResult.cs \
./Search/SearchResult/ISearchResult.cs \
-./Search/SearchOptions.cs \
./Search/SearchReplaceInFilesManager.cs \
./Search/SearchReplaceUtilities.cs \
./Search/IFind.cs \
-./Search/TextIterator/ITextIterator.cs \
./Search/TextIterator/ITextIteratorBuilder.cs \
./Search/TextIterator/ForwardTextIteratorBuilder.cs \
./Search/TextIterator/ForwardTextIterator.cs \
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/DefaultFind.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/DefaultFind.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/DefaultFind.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -9,6 +9,7 @@
using System.Diagnostics;
using ICSharpCode.SharpDevelop.Gui;
+using MonoDevelop.EditorBindings.Search;
namespace ICSharpCode.TextEditor.Document
{
@@ -59,13 +60,14 @@
}
}
- ISearchResult CreateNamedSearchResult(ISearchResult pos)
+ ISearchResult CreateNamedSearchResult(SearchResult pos)
{
- if (info == null || pos == null) {
+ if (info == null || pos == null)
return null;
- }
- pos.ProvidedDocumentInformation = info;
- return pos;
+
+ DefaultSearchResult res = new DefaultSearchResult (pos.Position, pos.Length);
+ res.ProvidedDocumentInformation = info;
+ return res;
}
public void Reset()
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/IFind.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/IFind.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/IFind.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -10,6 +10,7 @@
using System.Diagnostics;
using ICSharpCode.SharpDevelop.Gui;
+using MonoDevelop.EditorBindings.Search;
namespace ICSharpCode.TextEditor.Document
{
Deleted: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchOptions.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchOptions.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchOptions.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -1,141 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.IO;
-using System.Drawing;
-
-using ICSharpCode.Core.Services;
-using ICSharpCode.Core.Properties;
-using ICSharpCode.SharpDevelop.Internal.Undo;
-
-namespace ICSharpCode.TextEditor.Document
-{
- public class SearchOptions
- {
- static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
- IProperties properties;
-
- public bool IgnoreCase {
- get {
- return properties.GetProperty("IgnoreCase", false);
- }
- set {
- properties.SetProperty("IgnoreCase", value);
- }
- }
-
- public bool SearchWholeWordOnly {
- get {
- return properties.GetProperty("SearchWholeWordOnly", false);
- }
-
- set {
- properties.SetProperty("SearchWholeWordOnly", value);
- }
- }
-
- public string SearchPattern {
- get {
- return properties.GetProperty("SearchPattern", String.Empty);
- }
- set {
- properties.SetProperty("SearchPattern", value);
- }
- }
-
- public string ReplacePattern {
- get {
- return properties.GetProperty("ReplacePattern", String.Empty);
- }
- set {
- properties.SetProperty("ReplacePattern", value);
- }
- }
-
- public DocumentIteratorType DocumentIteratorType {
- get {
- return (DocumentIteratorType)propertyService.GetProperty("DocumentIteratorType", DocumentIteratorType.CurrentDocument);
- }
- set {
- if (DocumentIteratorType != value) {
- propertyService.SetProperty("DocumentIteratorType", value);
- OnDocumentIteratorTypeChanged(EventArgs.Empty);
- }
- }
- }
-
- public SearchStrategyType SearchStrategyType {
- get {
- return (SearchStrategyType)propertyService.GetProperty("SearchStrategyType", SearchStrategyType.Normal);
- }
- set {
- if (SearchStrategyType != value) {
- propertyService.SetProperty("SearchStrategyType", value);
- OnSearchStrategyTypeChanged(EventArgs.Empty);
- }
- }
- }
-
- public string FileMask {
- get {
- return propertyService.GetProperty("FileMask", String.Empty);
- }
- set {
- propertyService.SetProperty("FileMask", value);
- }
- }
-
- public string SearchDirectory {
- get {
- return propertyService.GetProperty("SearchDirectory", String.Empty);
- }
- set {
- propertyService.SetProperty("SearchDirectory", value);
- }
- }
-
- public bool SearchSubdirectories {
- get {
- return propertyService.GetProperty("SearchSubdirectories", true);
- }
- set {
- propertyService.SetProperty("SearchSubdirectories", value);
- }
- }
-
- /// <remarks>
- /// For unit testing purposes
- /// </remarks>
- public SearchOptions(IProperties properties)
- {
- this.properties = properties;
- }
-
- public SearchOptions(string propertyName)
- {
- properties = (IProperties)propertyService.GetProperty(propertyName, new DefaultProperties());
- }
-
- protected void OnDocumentIteratorTypeChanged(EventArgs e)
- {
- if (DocumentIteratorTypeChanged != null) {
- DocumentIteratorTypeChanged(this, e);
- }
- }
-
- protected void OnSearchStrategyTypeChanged(EventArgs e)
- {
- if (SearchStrategyTypeChanged != null) {
- SearchStrategyTypeChanged(this, e);
- }
- }
-
- public event EventHandler DocumentIteratorTypeChanged;
- public event EventHandler SearchStrategyTypeChanged;
- }
-}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchReplaceInFilesManager.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchReplaceInFilesManager.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchReplaceInFilesManager.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -17,6 +17,7 @@
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
using ICSharpCode.SharpDevelop.Gui.Pads;
+using MonoDevelop.EditorBindings.Search;
namespace ICSharpCode.TextEditor.Document
{
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchReplaceManager.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchReplaceManager.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchReplaceManager.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -16,24 +16,10 @@
using ICSharpCode.SharpDevelop.Gui.Dialogs;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
+using MonoDevelop.EditorBindings.Search;
namespace ICSharpCode.TextEditor.Document
{
- public enum DocumentIteratorType {
- None,
- CurrentDocument,
- AllOpenFiles,
- WholeCombine,
- Directory // only used for search in files
- }
-
- public enum SearchStrategyType {
- None,
- Normal,
- RegEx,
- Wildcard
- }
-
public class SearchReplaceManager
{
public static ReplaceDialog ReplaceDialog = null;
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchReplaceUtilities.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchReplaceUtilities.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/SearchReplaceUtilities.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -11,6 +11,7 @@
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
+using MonoDevelop.EditorBindings.Search;
namespace ICSharpCode.TextEditor.Document
{
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ForwardTextIterator.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ForwardTextIterator.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ForwardTextIterator.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -9,6 +9,8 @@
using System.Diagnostics;
using System.Collections;
+using MonoDevelop.EditorBindings.Search;
+
namespace ICSharpCode.TextEditor.Document
{
public class ForwardTextIterator : ITextIterator
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ForwardTextIteratorBuilder.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ForwardTextIteratorBuilder.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ForwardTextIteratorBuilder.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -8,6 +8,7 @@
using System;
using System.Diagnostics;
using System.Collections;
+using MonoDevelop.EditorBindings.Search;
namespace ICSharpCode.TextEditor.Document
{
Deleted: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ITextIterator.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ITextIterator.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ITextIterator.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -1,72 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.Collections;
-
-namespace ICSharpCode.TextEditor.Document
-{
- /// <summary>
- /// This iterator iterates on a text buffer strategy.
- /// </summary>
- public interface ITextIterator
- {
- /// <value>
- /// Gets the current char this is the same as
- /// GetCharRelative(0)
- /// </value>
- /// <exception cref="System.InvalidOperationException">
- /// If this method is called before the first MoveAhead or after
- /// MoveAhead or after MoveAhead returns false.
- /// </exception>
- char Current {
- get;
- }
-
- /// <value>
- /// The current position=offset of the text iterator cursor
- /// </value>
- int Position {
- get;
- set;
- }
-
- int Length { get; }
-
- string FullDocumentText { get; }
-
- bool IsWholeWordAt (int offset, int length);
- char GetCharAt (int p);
-
- /// <remarks>
- /// Gets a char relative to the current position (negative values
- /// will work too).
- /// </remarks>
- /// <exception cref="System.InvalidOperationException">
- /// If this method is called before the first MoveAhead or after
- /// MoveAhead or after MoveAhead returns false.
- /// </exception>
- char GetCharRelative(int offset);
-
- /// <remarks>
- /// Moves the iterator position numChars
- /// </remarks>
- bool MoveAhead(int numChars);
-
- /// <remarks>
- /// Rests the iterator
- /// </remarks>
- void Reset();
-
- /// <remarks>
- /// The find object calls the InformReplace method to inform the text iterator
- /// about the replace operation on the TextBuffer. The text iterator must update
- /// all internal offsets to the new offsets (if neccessary)
- /// </remarks>
- void InformReplace(int offset, int length, int newLength);
- }
-}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ITextIteratorBuilder.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ITextIteratorBuilder.cs 2004-02-02 23:21:20 UTC (rev 756)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Search/TextIterator/ITextIteratorBuilder.cs 2004-02-02 23:55:01 UTC (rev 757)
@@ -7,6 +7,7 @@
using System;
using System.Collections;
+using MonoDevelop.EditorBindings.Search;
namespace ICSharpCode.TextEditor.Document
{
More information about the Monodevelop-patches-list
mailing list