[Monodevelop-patches-list] r1078 - in trunk/MonoDevelop: build/data/resources/icons src/AddIns/DisplayBindings/SourceEditor/Gui
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Tue Mar 2 09:34:49 EST 2004
Author: tberman
Date: 2004-03-02 09:34:49 -0500 (Tue, 02 Mar 2004)
New Revision: 1078
Added:
trunk/MonoDevelop/build/data/resources/icons/BreakPoint.png
Modified:
trunk/MonoDevelop/build/data/resources/icons/Makefile.am
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs
Log:
ability to add breakpoints.
Added: trunk/MonoDevelop/build/data/resources/icons/BreakPoint.png
===================================================================
(Binary files differ)
Property changes on: trunk/MonoDevelop/build/data/resources/icons/BreakPoint.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/MonoDevelop/build/data/resources/icons/Makefile.am
===================================================================
--- trunk/MonoDevelop/build/data/resources/icons/Makefile.am 2004-03-02 06:22:04 UTC (rev 1077)
+++ trunk/MonoDevelop/build/data/resources/icons/Makefile.am 2004-03-02 14:34:49 UTC (rev 1078)
@@ -303,6 +303,7 @@
VB.Project.ServiceProject \
VB.Project.UserControl \
VB.Project.WebProject \
-gnome-fs-regular.png
+gnome-fs-regular.png \
+BreakPoint.png
EXTRA_DIST = $(icons_DATA)
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs 2004-03-02 06:22:04 UTC (rev 1077)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs 2004-03-02 14:34:49 UTC (rev 1078)
@@ -15,7 +15,12 @@
using System.Runtime.InteropServices;
namespace MonoDevelop.SourceEditor.Gui {
-
+
+ public enum SourceMarkerType {
+ SourceEditorBookmark,
+ BreakpointMark
+ }
+
// This gives us a nice way to avoid the try/finally
// which is really long.
struct NoUndo : IDisposable {
@@ -222,6 +227,16 @@
public bool IsBookmarked (int linenum)
{
+ return IsMarked (linenum, SourceMarkerType.SourceEditorBookmark);
+ }
+
+ public bool IsBreakpoint (int linenum)
+ {
+ return IsMarked (linenum, SourceMarkerType.BreakpointMark);
+ }
+
+ public bool IsMarked (int linenum, SourceMarkerType type)
+ {
TextIter insert = GetIterAtLine (linenum);
TextIter begin_line = insert, end_line = insert;
begin_line.LineOffset = 0;
@@ -240,7 +255,7 @@
IntPtr nm = gtk_source_marker_get_marker_type (data);
string name = GLibSharp.Marshaller.PtrToStringGFree (nm);
- if (name == "SourceEditorBookmark") {
+ if (name == type.ToString ()) {
fnd_marker = true;
break;
}
@@ -253,9 +268,14 @@
return fnd_marker;
}
-
+
public void ToggleBookmark (int linenum)
{
+ ToggleMark (linenum, SourceMarkerType.SourceEditorBookmark);
+ }
+
+ public void ToggleMark (int linenum, SourceMarkerType type)
+ {
TextIter insert = GetIterAtLine (linenum);
TextIter begin_line = insert, end_line = insert;
begin_line.LineOffset = 0;
@@ -281,7 +301,7 @@
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") {
+ if (name == type.ToString ()) {
gtk_source_buffer_delete_marker (Handle, data);
found_marker = true;
}
@@ -295,7 +315,7 @@
if (found_marker)
return;
- gtk_source_buffer_create_marker (Handle, null, "SourceEditorBookmark", ref begin_line);
+ gtk_source_buffer_create_marker (Handle, null, type.ToString (), ref begin_line);
}
[DllImport("gtksourceview-1.0")]
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2004-03-02 06:22:04 UTC (rev 1077)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2004-03-02 14:34:49 UTC (rev 1078)
@@ -22,6 +22,8 @@
SourceEditorBuffer buf;
public readonly SourceEditor ParentEditor;
+ int lineToMark = -1;
+
CompletionWindow completionWindow;
static SourceEditorView ()
@@ -46,19 +48,50 @@
{
if (!ShowLineMarkers)
return;
-
- if (e.Event.Window == GetWindow (Gtk.TextWindowType.Left) && e.Event.Button == 1) {
+
+ if (e.Event.Window == GetWindow (Gtk.TextWindowType.Left)) {
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);
+
+ if (e.Event.Button == 1) {
+ buf.ToggleBookmark (line.Line);
+ } else if (e.Event.Button == 3) {
+ Gtk.Menu popup = new Gtk.Menu ();
+ Gtk.CheckMenuItem bookmarkItem = Gtk.CheckMenuItem.NewWithLabel ("Bookmark");
+ Gtk.CheckMenuItem breakpointItem = Gtk.CheckMenuItem.NewWithLabel ("Breakpoint");
- buf.ToggleBookmark (line.Line);
+ bookmarkItem.Active = buf.IsBookmarked (line.Line);
+ breakpointItem.Active = buf.IsBreakpoint (line.Line);
+
+ bookmarkItem.Toggled += new EventHandler (bookmarkToggled);
+ breakpointItem.Toggled += new EventHandler (breakpointToggled);
+ popup.Append (bookmarkItem);
+ popup.Append (breakpointItem);
+ popup.ShowAll ();
+ lineToMark = line.Line;
+ popup.Popup (null, null, null, IntPtr.Zero, 3, e.Event.Time);
+ }
}
}
+ public void bookmarkToggled (object o, EventArgs e)
+ {
+ if (lineToMark == -1) return;
+ buf.ToggleMark (lineToMark, SourceMarkerType.SourceEditorBookmark);
+ lineToMark = -1;
+ }
+
+ public void breakpointToggled (object o, EventArgs e)
+ {
+ if (lineToMark == -1) return;
+ buf.ToggleMark (lineToMark, SourceMarkerType.BreakpointMark);
+ lineToMark = -1;
+ }
+
public void SimulateKeyPress (ref Gdk.EventKey evnt)
{
Gtk.Global.PropagateEvent (this, evnt);
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs 2004-03-02 06:22:04 UTC (rev 1077)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs 2004-03-02 14:34:49 UTC (rev 1078)
@@ -25,6 +25,7 @@
Buffer.Highlight = true;
View.SetMarkerPixbuf ("SourceEditorBookmark", new Gdk.Pixbuf (drag_icon_xpm));
+ View.SetMarkerPixbuf ("BreakpointMark", new Gdk.Pixbuf ("../data/resources/icons/BreakPoint.png"));
Add (View);
}
More information about the Monodevelop-patches-list
mailing list