[Monodevelop-patches-list] r945 - in trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor: Gui Search

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Thu Feb 19 14:20:58 EST 2004


Author: tberman
Date: 2004-02-19 14:20:58 -0500 (Thu, 19 Feb 2004)
New Revision: 945

Modified:
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs
Log:
mark all works now


Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs	2004-02-19 18:58:44 UTC (rev 944)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs	2004-02-19 19:20:58 UTC (rev 945)
@@ -210,6 +210,40 @@
 			ToggleBookmark (GetIterAtMark (InsertMark).Line);
 		}
 		
+		public bool IsBookmarked (int linenum)
+		{
+			TextIter insert = GetIterAtLine (linenum);
+			TextIter begin_line = insert, end_line = insert;
+			begin_line.LineOffset = 0;
+
+			while (! end_line.EndsLine ())
+				end_line.ForwardChar ();
+			
+			IntPtr lst = gtk_source_buffer_get_markers_in_region (Handle, ref begin_line, ref end_line);
+
+			bool fnd_marker = false;
+			
+			IntPtr current = lst;
+			while (current != IntPtr.Zero)
+			{
+				IntPtr data = gtksharp_slist_get_data (current);
+				IntPtr nm = gtk_source_marker_get_marker_type (data);
+
+				string name = GLibSharp.Marshaller.PtrToStringGFree (nm);
+				if (name == "SourceEditorBookmark") {
+					fnd_marker = true;
+					break;
+				}
+				current = gtksharp_slist_get_next (current);
+			}
+
+			if (lst != IntPtr.Zero)
+				g_slist_free (lst);
+
+			return fnd_marker;
+
+		}
+		
 		public void ToggleBookmark (int linenum)
 		{
 			TextIter insert = GetIterAtLine (linenum);

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs	2004-02-19 18:58:44 UTC (rev 944)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs	2004-02-19 19:20:58 UTC (rev 945)
@@ -89,11 +89,11 @@
 		
 		public static void MarkAll()
 		{
-			//TextEditorControl textArea = null;
-			/*if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
-				textArea = ((ITextEditorControlProvider)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).TextEditorControl;
-				textArea.ActiveTextAreaControl.TextArea.SelectionManager.ClearSelection();
-			}*/
+			SourceEditor textArea = null;
+			if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
+				textArea = (SourceEditor) ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Control;
+				textArea.Buffer.PlaceCursor (textArea.Buffer.GetIterAtMark (textArea.Buffer.InsertMark));
+			}
 			find.Reset();
 			find.SearchStrategy.CompilePattern(searchOptions);
 			while (true) {
@@ -104,14 +104,16 @@
 					find.Reset();
 					return;
 				} else {
-					/*textArea = OpenTextArea(result.FileName); 
+					textArea = OpenTextArea(result.FileName); 
 					
-					textArea.ActiveTextAreaControl.Caret.Position = textArea.Document.OffsetToPosition(result.Offset);
-					int lineNr = textArea.Document.GetLineNumberForOffset(result.Offset);
+					Gtk.TextIter resultIter = textArea.Buffer.GetIterAtOffset (result.Offset);
+					textArea.Buffer.PlaceCursor (resultIter);
 					
-					if (!textArea.Document.BookmarkManager.IsMarked(lineNr)) {
-						textArea.Document.BookmarkManager.ToggleMarkAt(lineNr);
-					}*/
+					int lineNr = resultIter.Line;
+					
+					if (!textArea.Buffer.IsBookmarked(lineNr)) {
+						textArea.Buffer.ToggleBookmark(lineNr);
+					}
 				}
 			}
 		}




More information about the Monodevelop-patches-list mailing list