[Monodevelop-patches-list] r2497 - in trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor: . Gui
Lluis Sanchez <lluis@ximian.com>
lluis at mono-cvs.ximian.com
Sat Apr 30 10:23:31 EDT 2005
Author: lluis
Date: 2005-04-30 10:23:31 -0400 (Sat, 30 Apr 2005)
New Revision: 2497
Modified:
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/MonoDevelopEditor.addin.xml
Log:
2005-04-30 Lluis Sanchez Gual <lluis at novell.com>
* Gui/SourceEditorWidget.cs: Handler toggle breakpoint command.
* Gui/SourceEditorView.cs: Use the new command system to show
the contextual menu.
* Gui/SourceEditorDisplayBinding.cs: Show only breakpoints for the
file being edited. Catch exceptions when reloading the file.
* MonoDevelopEditor.addin.xml: Added some command descriptions.
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-04-30 14:23:09 UTC (rev 2496)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-04-30 14:23:31 UTC (rev 2497)
@@ -1,3 +1,12 @@
+2005-04-30 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Gui/SourceEditorWidget.cs: Handler toggle breakpoint command.
+ * Gui/SourceEditorView.cs: Use the new command system to show
+ the contextual menu.
+ * Gui/SourceEditorDisplayBinding.cs: Show only breakpoints for the
+ file being edited. Catch exceptions when reloading the file.
+ * MonoDevelopEditor.addin.xml: Added some command descriptions.
+
2005-04-27 Lluis Sanchez Gual <lluis at novell.com>
* Gui/SourceEditorDisplayBinding.cs: Don't crash if the debugger
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-04-30 14:23:09 UTC (rev 2496)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-04-30 14:23:31 UTC (rev 2497)
@@ -314,12 +314,14 @@
void OnBreakpointAdded (object sender, BreakpointEventArgs args)
{
- se.View.ShowBreakpointAt (args.Breakpoint.Line - 1);
+ if (args.Breakpoint.FileName == ContentName)
+ se.View.ShowBreakpointAt (args.Breakpoint.Line - 1);
}
void OnBreakpointRemoved (object sender, BreakpointEventArgs args)
{
- se.View.ClearBreakpointAt (args.Breakpoint.Line - 1);
+ if (args.Breakpoint.FileName == ContentName)
+ se.View.ClearBreakpointAt (args.Breakpoint.Line - 1);
}
void OnExecutionLocationChanged (object sender, EventArgs args)
@@ -375,9 +377,13 @@
void ClickedReload (object sender, EventArgs args)
{
- editorBar.Remove (reloadBar);
- Load (ContentName);
- WorkbenchWindow.ShowNotification = false;
+ try {
+ Load (ContentName);
+ editorBar.Remove (reloadBar);
+ WorkbenchWindow.ShowNotification = false;
+ } catch (Exception ex) {
+ Runtime.MessageService.ShowError (ex, "Could not reload the file.");
+ }
}
void ClickedIgnore (object sender, EventArgs args)
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2005-04-30 14:23:09 UTC (rev 2496)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2005-04-30 14:23:31 UTC (rev 2497)
@@ -18,6 +18,8 @@
using MonoDevelop.Gui.Utils;
using MonoDevelop.Gui;
using MonoDevelop.Services;
+using MonoDevelop.Commands;
+using MonoDevelop.DefaultEditor;
using GtkSourceView;
@@ -100,50 +102,25 @@
int top;
GetLineAtY (out line, y, out top);
+ buf.PlaceCursor (line);
if (e.Button == 1) {
buf.ToggleBookmark (line.Line);
} else if (e.Button == 3) {
- Gtk.Menu popup = new Gtk.Menu ();
- Gtk.CheckMenuItem bookmarkItem = new Gtk.CheckMenuItem (GettextCatalog.GetString ("Bookmark"));
- bookmarkItem.Active = buf.IsBookmarked (line.Line);
- bookmarkItem.Toggled += new EventHandler (bookmarkToggled);
- popup.Append (bookmarkItem);
-
- if (ServiceManager.GetService (typeof (IDebuggingService)) != null) {
- Gtk.CheckMenuItem breakpointItem = new Gtk.CheckMenuItem (GettextCatalog.GetString ("Breakpoint"));
-
- breakpointItem.Active = buf.IsBreakpoint (line.Line);
-
- breakpointItem.Toggled += new EventHandler (breakpointToggled);
- popup.Append (breakpointItem);
- }
-
- popup.ShowAll ();
- lineToMark = line.Line;
- popup.Popup (null, null, null, IntPtr.Zero, 3, e.Time);
+ CommandEntrySet cset = new CommandEntrySet ();
+ cset.AddItem (EditorCommands.ToggleBookmark);
+ cset.AddItem (EditorCommands.ClearBookmarks);
+ cset.AddItem (Command.Separator);
+ cset.AddItem (DebugCommands.ToggleBreakpoint);
+ cset.AddItem (DebugCommands.ClearAllBreakpoints);
+ Gtk.Menu menu = Runtime.Gui.CommandService.CreateMenu (cset);
+
+ menu.Popup (null, null, null, IntPtr.Zero, 3, e.Time);
}
}
return base.OnButtonPressEvent (e);
}
- 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;
- IDebuggingService dbgr = (IDebuggingService)ServiceManager.GetService (typeof (IDebuggingService));
- if (dbgr != null) {
- dbgr.ToggleBreakpoint (ParentEditor.DisplayBinding.ContentName, lineToMark + 1);
- lineToMark = -1;
- }
- }
-
public void ShowBreakpointAt (int linenumber)
{
if (!buf.IsMarked (linenumber, SourceMarkerType.BreakpointMark))
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs 2005-04-30 14:23:09 UTC (rev 2496)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs 2005-04-30 14:23:31 UTC (rev 2497)
@@ -8,6 +8,7 @@
using MonoDevelop.Gui.Dialogs;
using GtkSourceView;
using MonoDevelop.DefaultEditor;
+using MonoDevelop.Services;
namespace MonoDevelop.SourceEditor.Gui
{
@@ -186,6 +187,24 @@
{
Buffer.ClearBookmarks ();
}
+
+ [CommandHandler (DebugCommands.ToggleBreakpoint)]
+ public void ToggleBreakpoint ()
+ {
+ if (Runtime.DebuggingService != null && DisplayBinding.ContentName != null) {
+ int line = Buffer.GetIterAtMark (Buffer.InsertMark).Line + 1;
+ Runtime.DebuggingService.ToggleBreakpoint (DisplayBinding.ContentName, line);
+ }
+ }
+
+ [CommandUpdateHandler (DebugCommands.ToggleBreakpoint)]
+ public void UpdateToggleBreakpoint (CommandInfo info)
+ {
+ if (Runtime.DebuggingService == null)
+ info.Visible = false;
+ else
+ info.Enabled = DisplayBinding.ContentName != null;
+ }
private static readonly string [] drag_icon_xpm = new string [] {
"36 48 9 1",
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/MonoDevelopEditor.addin.xml
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/MonoDevelopEditor.addin.xml 2005-04-30 14:23:09 UTC (rev 2496)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/MonoDevelopEditor.addin.xml 2005-04-30 14:23:31 UTC (rev 2497)
@@ -63,25 +63,29 @@
<Command id = "MonoDevelop.DefaultEditor.EditorCommands.ToggleBookmark"
icon = "Icons.16x16.ToggleBookmark"
shortcut = "Control|F2"
+ description = "Toggle Bookmark"
_label = "Toggle Bookmark" />
<Command id = "MonoDevelop.DefaultEditor.EditorCommands.PrevBookmark"
icon = "Icons.16x16.GotoPrevbookmark"
shortcut = "Shift|F2"
+ description = "Previous Bookmark"
_label = "Previous Bookmark" />
<Command id = "MonoDevelop.DefaultEditor.EditorCommands.NextBookmark"
icon = "Icons.16x16.GotoNextbookmark"
shortcut = "F2"
+ description = "Next Bookmark"
_label = "Next Bookmark" />
<Command id = "MonoDevelop.DefaultEditor.EditorCommands.ClearBookmarks"
icon = "Icons.16x16.ClearAllBookmarks"
+ description = "Clear Bookmarks"
_label = "Clear Bookmarks" />
<Command id = "MonoDevelop.DefaultEditor.EditorCommands.GotoLineNumber"
_label = "_Goto Line..."
- description = "${res:XML.MainMenu.SearchMenu.GotoLineNr.Description}"
+ description = "Goto line"
shortcut = "Control|G" />
<Command id = "MonoDevelop.DefaultEditor.EditorCommands.GotoMatchingBrace"
_label = "Goto Matching _Brace"
- description = "${res:XML.MainMenu.SearchMenu.GotoBrace.Description}"
+ description = "Goto Matching Brace"
shortcut = "Control|B" />
<!-- SearchCommands -->
@@ -89,36 +93,37 @@
<Command id = "MonoDevelop.Commands.SearchCommands.Find"
_label = "_Find..."
icon = "Icons.16x16.FindIcon"
- description = "${res:XML.MainMenu.SearchMenu.Find.Description}"
+ description = "Find"
shortcut = "Control|F" />
<Command id = "MonoDevelop.Commands.SearchCommands.FindNext"
_label = "Find _Next"
icon = "Icons.16x16.FindNextIcon"
- description = "${res:XML.MainMenu.SearchMenu.FindNext.Description}"
+ description = "Find next"
shortcut = "F3" />
<Command id = "MonoDevelop.Commands.SearchCommands.FindSelection"
_label = "Find Selection"
+ description = "Find selection"
shortcut = "Control|F3" />
<Command id = "MonoDevelop.Commands.SearchCommands.FindPrevious"
_label = "Find _Previous"
icon = "Icons.16x16.FindPrevIcon"
- description = "${res:XML.MainMenu.SearchMenu.FindPrevious.Description}"
+ description = "Find previous"
shortcut = "Shift|F3" />
<Command id = "MonoDevelop.Commands.SearchCommands.Replace"
_label = "_Replace..."
icon = "Icons.16x16.ReplaceIcon"
- description = "${res:XML.MainMenu.SearchMenu.Replace.Description}"
+ description = "Replace"
shortcut = "Control|H" />
<Command id = "MonoDevelop.Commands.SearchCommands.FindInFiles"
defaultHandler = "MonoDevelop.Commands.FindInFilesHandler"
_label = "F_ind In Files..."
icon = "Icons.16x16.FindInFiles"
- description = "${res:XML.MainMenu.SearchMenu.FindInFiles.Description}" />
+ description = "Find in files" />
<Command id = "MonoDevelop.Commands.SearchCommands.ReplaceInFiles"
defaultHandler = "MonoDevelop.Commands.ReplaceInFilesHandler"
_label = "R_eplace In Files..."
icon = "Icons.16x16.ReplaceInFiles"
- description = "${res:XML.MainMenu.SearchMenu.ReplaceInFiles.Description}" />
+ description = "Replace in files" />
</Extension>
<Extension path = "/SharpDevelop/ViewContent/DefaultTextEditor/ContextMenu">
More information about the Monodevelop-patches-list
mailing list