[Monodevelop-patches-list] r923 - trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sun Feb 15 16:46:04 EST 2004


Author: tberman
Date: 2004-02-15 16:46:04 -0500 (Sun, 15 Feb 2004)
New Revision: 923

Modified:
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
Log:
now you can click on the margin and a bookmark will appear.


Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs	2004-02-15 21:37:41 UTC (rev 922)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs	2004-02-15 21:46:04 UTC (rev 923)
@@ -207,7 +207,12 @@
 		
 		public void ToggleBookmark ()
 		{
-			TextIter insert = GetIterAtMark (InsertMark);
+			ToggleBookmark (GetIterAtMark (InsertMark).Line);
+		}
+		
+		public void ToggleBookmark (int linenum)
+		{
+			TextIter insert = GetIterAtLine (linenum);
 			TextIter begin_line = insert, end_line = insert;
 			begin_line.LineOffset = 0;
 			

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs	2004-02-15 21:37:41 UTC (rev 922)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs	2004-02-15 21:46:04 UTC (rev 923)
@@ -38,8 +38,26 @@
 			SmartHomeEnd = true;
 			ShowLineNumbers = true;
 			ShowLineMarkers = true;
+			ButtonPressEvent += new ButtonPressEventHandler (buttonPress);
 		}
 
+		void buttonPress (object o, ButtonPressEventArgs e)
+		{
+			if (!ShowLineMarkers)
+				return;
+
+			if (e.Event.window == GetWindow (Gtk.TextWindowType.Left) && e.Event.Button == 1) {
+				int x, y;
+				WindowToBufferCoords (Gtk.TextWindowType.Left, (int)e.Event.X, (int)e.Event.Y, out x, out y);
+				TextIter line;
+				int top;
+
+				GetLineAtY (out line, y, out top);
+
+				buf.ToggleBookmark (line.Line);
+			}
+		}
+
 		public void SimulateKeyPress (ref Gdk.EventKey evnt)
 		{
 			Glue.SimulateKeyPress (Handle, ref evnt);




More information about the Monodevelop-patches-list mailing list