[Monodevelop-patches-list] r943 - in trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor: Commands Gui Search Search/DocumentIterator Search/SearchStrategy Search/TextIterator
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Thu Feb 19 02:45:46 EST 2004
Author: tberman
Date: 2004-02-19 02:45:46 -0500 (Thu, 19 Feb 2004)
New Revision: 943
Modified:
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/CurrentDocumentIterator.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/ProvidedDocumentInformation.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceUtilities.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchStrategy/BruteForceSearchStrategy.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchStrategy/WildcardSearchStrategy.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/TextIterator/ForwardTextIterator.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/TextIterator/ITextIterator.cs
Log:
a semi kinda working find (dont use it, its actually broken, but it pretends to work cause it makes me feel better).
Damn hydra...
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs 2004-02-19 03:42:53 UTC (rev 942)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs 2004-02-19 07:45:46 UTC (rev 943)
@@ -68,8 +68,7 @@
public override void Run()
{
- Console.WriteLine ("Not implemented in the new editor");
- /*
+
SetSearchPattern();
if (SearchReplaceManager.ReplaceDialog != null) {
if (SearchReplaceManager.ReplaceDialog.replaceMode == false) {
@@ -83,7 +82,7 @@
} else {
ReplaceDialog rd = new ReplaceDialog(false);
rd.ShowAll();
- }*/
+ }
}
}
@@ -91,7 +90,7 @@
{
public override void Run()
{
- //SearchReplaceManager.FindNext();
+ SearchReplaceManager.FindNext();
}
}
@@ -99,10 +98,9 @@
{
public override void Run()
{
- Console.WriteLine ("Not implemented in the new editor");
- //Find.SetSearchPattern();
+ Find.SetSearchPattern();
- /*if (SearchReplaceManager.ReplaceDialog != null) {
+ if (SearchReplaceManager.ReplaceDialog != null) {
if (SearchReplaceManager.ReplaceDialog.replaceMode == true) {
SearchReplaceManager.ReplaceDialog.SetSearchPattern(SearchReplaceManager.SearchOptions.SearchPattern);
SearchReplaceManager.ReplaceDialog.Present ();
@@ -114,7 +112,7 @@
} else {
ReplaceDialog rd = new ReplaceDialog(true);
rd.ShowAll();
- }*/
+ }
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs 2004-02-19 03:42:53 UTC (rev 942)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs 2004-02-19 07:45:46 UTC (rev 943)
@@ -363,5 +363,32 @@
}
#endregion
+#region ITextBufferStrategy compat interface, this should be removed ASAP
+
+ public int Length
+ {
+ get { return Text.Length; }
+ }
+
+ public char GetCharAt (int offset)
+ {
+ Console.WriteLine ("[GetCharAt] ({0})", offset);
+ return Text[offset];
+ }
+
+ public string GetText (int start, int length)
+ {
+ Console.WriteLine ("[GetText] ({0}) -- ({1})", start, length);
+ return Text.Substring (start, length);
+ }
+
+ public static SourceEditorBuffer CreateTextBufferFromFile (string filename)
+ {
+ SourceEditorBuffer buff = new SourceEditorBuffer ();
+ buff.LoadFile (filename);
+ return buff;
+ }
+
+#endregion
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/CurrentDocumentIterator.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/CurrentDocumentIterator.cs 2004-02-19 03:42:53 UTC (rev 942)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/CurrentDocumentIterator.cs 2004-02-19 07:45:46 UTC (rev 943)
@@ -11,12 +11,14 @@
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.TextEditor;
+using MonoDevelop.SourceEditor.Gui;
+
namespace ICSharpCode.TextEditor.Document
{
public class CurrentDocumentIterator : IDocumentIterator
{
- bool didRead = false;
- //IDocument curDocument = null;
+ bool didRead = false;
+ SourceEditor curDocument = null;
public CurrentDocumentIterator()
{
@@ -40,10 +42,8 @@
if (!SearchReplaceUtilities.IsTextAreaSelected) {
return null;
}
- //curDocument = (((ITextEditorControlProvider)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).TextEditorControl).Document;
- //return new ProvidedDocumentInformation(curDocument,
- // CurrentFileName);
- return null;
+ curDocument = ((SourceEditor) ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Control);
+ return new ProvidedDocumentInformation(curDocument, CurrentFileName);
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/ProvidedDocumentInformation.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/ProvidedDocumentInformation.cs 2004-02-19 03:42:53 UTC (rev 942)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/ProvidedDocumentInformation.cs 2004-02-19 07:45:46 UTC (rev 943)
@@ -11,16 +11,18 @@
using ICSharpCode.SharpDevelop.Gui;
+using MonoDevelop.SourceEditor.Gui;
+
namespace ICSharpCode.TextEditor.Document
{
public class ProvidedDocumentInformation
{
- //IDocument document;
- ITextBufferStrategy textBuffer;
+ SourceEditor document;
+ SourceEditorBuffer textBuffer;
string fileName;
int currentOffset;
- public ITextBufferStrategy TextBuffer {
+ public SourceEditorBuffer TextBuffer {
get {
return textBuffer;
}
@@ -92,15 +94,15 @@
return new DocumentFactory().CreateFromFile(fileName);
}*/
- /*public ProvidedDocumentInformation(IDocument document, string fileName)
+ public ProvidedDocumentInformation (SourceEditor document, string fileName)
{
this.document = document;
- this.textBuffer = document.TextBufferStrategy;
+ this.textBuffer = document.Buffer;
this.fileName = fileName;
// this.currentOffset = document.Caret.Offset;
- }*/
+ }
- public ProvidedDocumentInformation(ITextBufferStrategy textBuffer, string fileName, int currentOffset)
+ public ProvidedDocumentInformation(SourceEditorBuffer textBuffer, string fileName, int currentOffset)
{
this.textBuffer = textBuffer;
this.fileName = fileName;
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs 2004-02-19 03:42:53 UTC (rev 942)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs 2004-02-19 07:45:46 UTC (rev 943)
@@ -15,6 +15,8 @@
using ICSharpCode.SharpDevelop.Services;
using ICSharpCode.TextEditor;
+using MonoDevelop.SourceEditor.Gui;
+
namespace ICSharpCode.TextEditor.Document
{
public class WholeProjectDocumentIterator : IDocumentIterator
@@ -46,20 +48,20 @@
++curIndex;
return Current;
}
- //IDocument document;
+ SourceEditor document;
string fileName = files[curIndex].ToString();
- /*foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
+ foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
// WINDOWS DEPENDENCY : ToUpper
if (content.ContentName != null &&
content.ContentName.ToUpper() == fileName.ToUpper()) {
- document = (((ITextEditorControlProvider)content).TextEditorControl).Document;
+ document = (SourceEditor) (((SourceEditorDisplayBindingWrapper)content).Control);
return new ProvidedDocumentInformation(document,
fileName);
}
- }*/
- ITextBufferStrategy strategy = null;
+ }
+ SourceEditorBuffer strategy = null;
try {
- //strategy = StringTextBufferStrategy.CreateTextBufferFromFile(fileName);
+ strategy = SourceEditorBuffer.CreateTextBufferFromFile (fileName);
} catch (Exception) {
TaskService taskService = (TaskService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(TaskService));
taskService.Tasks.Add(new Task(String.Empty, "can't access " + fileName, -1, -1));
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs 2004-02-19 03:42:53 UTC (rev 942)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs 2004-02-19 07:45:46 UTC (rev 943)
@@ -16,6 +16,8 @@
using ICSharpCode.SharpDevelop.Gui.Dialogs;
using ICSharpCode.TextEditor;
+using MonoDevelop.SourceEditor.Gui;
+
namespace ICSharpCode.TextEditor.Document
{
public enum DocumentIteratorType {
@@ -161,6 +163,8 @@
if (result == null) {
ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
+ //FIXME: This needs to be a msg or whatever
+ Console.WriteLine ("Not Found");
/*MessageBox.Show((Form)WorkbenchSingleton.Workbench,
resourceService.GetString("Dialog.NewProject.SearchReplace.SearchStringNotFound"),
"Not Found",
@@ -168,33 +172,29 @@
MessageBoxIcon.Information);*/
find.Reset();
} else {
- /*TextEditorControl textArea = OpenTextArea(result.FileName);
+ SourceEditor textArea = OpenTextArea(result.FileName);
- if (lastResult != null && lastResult.FileName == result.FileName &&
- textArea.ActiveTextAreaControl.Caret.Offset != lastResult.Offset + lastResult.Length) {
+ if (lastResult != null && lastResult.FileName == result.FileName && textArea.Buffer.GetIterAtMark (textArea.Buffer.InsertMark).Offset != lastResult.Offset + lastResult.Length) {
find.Reset();
}
- int startPos = Math.Min(textArea.Document.TextLength, Math.Max(0, result.Offset));
- int endPos = Math.Min(textArea.Document.TextLength, startPos + result.Length);
+ int startPos = Math.Min(textArea.Buffer.Text.Length, Math.Max(0, result.Offset));
+ int endPos = Math.Min(textArea.Buffer.Text.Length, startPos + result.Length);
- textArea.ActiveTextAreaControl.Caret.Position = textArea.Document.OffsetToPosition(endPos);
- textArea.ActiveTextAreaControl.TextArea.SelectionManager.ClearSelection();
- textArea.ActiveTextAreaControl.TextArea.SelectionManager.SetSelection(new DefaultSelection(textArea.Document, textArea.Document.OffsetToPosition(startPos),
- textArea.Document.OffsetToPosition(endPos)));
- textArea.Refresh();*/
+ textArea.Buffer.MoveMark ("insert", textArea.Buffer.GetIterAtOffset (startPos));
+ textArea.Buffer.MoveMark ("selection_bound", textArea.Buffer.GetIterAtOffset (endPos));
}
lastResult = result;
}
- /*static TextEditorControl OpenTextArea(string fileName)
+ static SourceEditor OpenTextArea(string fileName)
{
if (fileName != null) {
IFileService fileService = (IFileService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IFileService));
fileService.OpenFile(fileName);
}
- return ((ITextEditorControlProvider)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).TextEditorControl;
- }*/
+ return (SourceEditor) ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Control;
+ }
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceUtilities.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceUtilities.cs 2004-02-19 03:42:53 UTC (rev 942)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceUtilities.cs 2004-02-19 07:45:46 UTC (rev 943)
@@ -11,22 +11,22 @@
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.TextEditor;
+using MonoDevelop.SourceEditor.Gui;
+
namespace ICSharpCode.TextEditor.Document
{
public sealed class SearchReplaceUtilities
{
public static bool IsTextAreaSelected {
get {
- /*
- return WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null &&
- WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent is ITextEditorControlProvider;
- */
- return false;
+
+ return WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null && WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent is SourceEditorDisplayBindingWrapper;
+
}
}
- public static bool IsWholeWordAt(ITextBufferStrategy document, int offset, int length)
+ public static bool IsWholeWordAt(SourceEditorBuffer 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)));
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchStrategy/BruteForceSearchStrategy.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchStrategy/BruteForceSearchStrategy.cs 2004-02-19 03:42:53 UTC (rev 942)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchStrategy/BruteForceSearchStrategy.cs 2004-02-19 07:45:46 UTC (rev 943)
@@ -10,6 +10,8 @@
using ICSharpCode.Core.Properties;
using ICSharpCode.SharpDevelop.Internal.Undo;
+using MonoDevelop.SourceEditor.Gui;
+
namespace ICSharpCode.TextEditor.Document
{
/// <summary>
@@ -19,7 +21,7 @@
{
string searchPattern;
- bool MatchCaseSensitive(ITextBufferStrategy document, int offset, string pattern)
+ bool MatchCaseSensitive(SourceEditorBuffer document, int offset, string pattern)
{
for (int i = 0; i < pattern.Length; ++i) {
if (offset + i >= document.Length || document.GetCharAt(offset + i) != pattern[i]) {
@@ -29,7 +31,7 @@
return true;
}
- bool MatchCaseInsensitive(ITextBufferStrategy document, int offset, string pattern)
+ bool MatchCaseInsensitive(SourceEditorBuffer 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]) {
@@ -39,7 +41,7 @@
return true;
}
- bool IsWholeWordAt(ITextBufferStrategy document, int offset, int length)
+ bool IsWholeWordAt(SourceEditorBuffer 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)));
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchStrategy/WildcardSearchStrategy.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchStrategy/WildcardSearchStrategy.cs 2004-02-19 03:42:53 UTC (rev 942)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchStrategy/WildcardSearchStrategy.cs 2004-02-19 07:45:46 UTC (rev 943)
@@ -11,6 +11,8 @@
using ICSharpCode.Core.Properties;
using ICSharpCode.SharpDevelop.Internal.Undo;
+using MonoDevelop.SourceEditor.Gui;
+
namespace ICSharpCode.TextEditor.Document
{
/// <summary>
@@ -82,7 +84,7 @@
}
}
- bool Match(ITextBufferStrategy document,
+ bool Match(SourceEditorBuffer document,
int offset,
bool ignoreCase,
int programStart)
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/TextIterator/ForwardTextIterator.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/TextIterator/ForwardTextIterator.cs 2004-02-19 03:42:53 UTC (rev 942)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/TextIterator/ForwardTextIterator.cs 2004-02-19 07:45:46 UTC (rev 943)
@@ -9,6 +9,8 @@
using System.Diagnostics;
using System.Collections;
+using MonoDevelop.SourceEditor.Gui;
+
namespace ICSharpCode.TextEditor.Document
{
public class ForwardTextIterator : ITextIterator
@@ -21,12 +23,12 @@
TextIteratorState state;
- ITextBufferStrategy textBuffer;
+ SourceEditorBuffer textBuffer;
int currentOffset;
int endOffset;
int oldOffset = -1;
- public ITextBufferStrategy TextBuffer {
+ public SourceEditorBuffer TextBuffer {
get {
return textBuffer;
}
@@ -57,7 +59,7 @@
}
- public ForwardTextIterator(ITextBufferStrategy textBuffer, int endOffset)
+ public ForwardTextIterator(SourceEditorBuffer textBuffer, int endOffset)
{
Debug.Assert(textBuffer != null);
Debug.Assert(endOffset >= 0 && endOffset < textBuffer.Length);
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/TextIterator/ITextIterator.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/TextIterator/ITextIterator.cs 2004-02-19 03:42:53 UTC (rev 942)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/TextIterator/ITextIterator.cs 2004-02-19 07:45:46 UTC (rev 943)
@@ -8,6 +8,8 @@
using System;
using System.Collections;
+using MonoDevelop.SourceEditor.Gui;
+
namespace ICSharpCode.TextEditor.Document
{
/// <summary>
@@ -18,7 +20,7 @@
/// <value>
/// The text buffer strategy
/// </value>
- ITextBufferStrategy TextBuffer {
+ SourceEditorBuffer TextBuffer {
get;
}
More information about the Monodevelop-patches-list
mailing list