[Monodevelop-patches-list] r2486 - in trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor: . Gui
Lluis Sanchez <lluis@ximian.com>
lluis at mono-cvs.ximian.com
Wed Apr 27 14:04:09 EDT 2005
Author: lluis
Date: 2005-04-27 14:04:08 -0400 (Wed, 27 Apr 2005)
New Revision: 2486
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
Log:
2005-04-27 Lluis Sanchez Gual <lluis at novell.com>
* Gui/SourceEditorView.cs:
* Gui/SourceEditorDisplayBinding.cs: Track changes in breakpoints, and
debug execution location.
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-04-27 18:03:40 UTC (rev 2485)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-04-27 18:04:08 UTC (rev 2486)
@@ -1,3 +1,9 @@
+2005-04-27 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Gui/SourceEditorView.cs:
+ * Gui/SourceEditorDisplayBinding.cs: Track changes in breakpoints, and
+ debug execution location.
+
2005-04-26 Lluis Sanchez Gual <lluis at novell.com>
* texteditoraddin.glade: Added missing stop button in the replace
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-04-27 18:03:40 UTC (rev 2485)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-04-27 18:04:08 UTC (rev 2486)
@@ -100,6 +100,11 @@
HBox reloadBar;
internal FileSystemWatcher fsw;
IProperties properties;
+
+ BreakpointEventHandler breakpointAddedHandler;
+ BreakpointEventHandler breakpointRemovedHandler;
+ EventHandler executionChangedHandler;
+ int currentExecutionLine = -1;
internal SourceEditor se;
@@ -198,6 +203,16 @@
fsw.Changed += new FileSystemEventHandler (OnFileChanged);
UpdateFSW (null, null);
mainBox.PackStart (se, true, true, 0);
+
+ if (Runtime.DebuggingService != null) {
+ breakpointAddedHandler = (BreakpointEventHandler) Runtime.DispatchService.GuiDispatch (new BreakpointEventHandler (OnBreakpointAdded));
+ breakpointRemovedHandler = (BreakpointEventHandler) Runtime.DispatchService.GuiDispatch (new BreakpointEventHandler (OnBreakpointRemoved));
+ executionChangedHandler = (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (OnExecutionLocationChanged));
+
+ Runtime.DebuggingService.BreakpointAdded += breakpointAddedHandler;
+ Runtime.DebuggingService.BreakpointRemoved += breakpointRemovedHandler;
+ Runtime.DebuggingService.ExecutionLocationChanged += executionChangedHandler;
+ }
}
public void JumpTo (int line, int column)
@@ -230,6 +245,10 @@
public override void Dispose()
{
+ Runtime.DebuggingService.BreakpointAdded -= breakpointAddedHandler;
+ Runtime.DebuggingService.BreakpointRemoved -= breakpointRemovedHandler;
+ Runtime.DebuggingService.ExecutionLocationChanged -= executionChangedHandler;
+
mainBox.Remove (se);
properties.PropertyChanged -= new PropertyEventHandler (PropertiesChanged);
se.Buffer.ModifiedChanged -= new EventHandler (OnModifiedChanged);
@@ -282,8 +301,49 @@
se.Buffer.LoadFile (fileName, Gnome.Vfs.MimeType.GetMimeTypeForUri (fileName));
ContentName = fileName;
InitializeFormatter ();
+
+ if (Runtime.DebuggingService != null) {
+ foreach (IBreakpoint b in Runtime.DebuggingService.GetBreakpointsAtFile (fileName))
+ se.View.ShowBreakpointAt (b.Line - 1);
+
+ UpdateExecutionLocation ();
+ }
}
+ void OnBreakpointAdded (object sender, BreakpointEventArgs args)
+ {
+ se.View.ShowBreakpointAt (args.Breakpoint.Line - 1);
+ }
+
+ void OnBreakpointRemoved (object sender, BreakpointEventArgs args)
+ {
+ se.View.ClearBreakpointAt (args.Breakpoint.Line - 1);
+ }
+
+ void OnExecutionLocationChanged (object sender, EventArgs args)
+ {
+ UpdateExecutionLocation ();
+ }
+
+ void UpdateExecutionLocation ()
+ {
+ if (currentExecutionLine != -1)
+ se.View.ClearExecutingAt (currentExecutionLine - 1);
+
+ if (Runtime.DebuggingService.CurrentFilename == ContentName) {
+ currentExecutionLine = Runtime.DebuggingService.CurrentLineNumber;
+ se.View.ExecutingAt (currentExecutionLine - 1);
+
+ TextIter itr = se.Buffer.GetIterAtLine (currentExecutionLine - 1);
+ itr.LineOffset = 0;
+ se.Buffer.PlaceCursor (itr);
+ se.View.ScrollToMark (se.Buffer.InsertMark, 0.3, false, 0, 0);
+ GLib.Timeout.Add (200, new GLib.TimeoutHandler (changeFocus));
+ }
+ else
+ currentExecutionLine = -1;
+ }
+
void ShowFileChangedWarning ()
{
if (reloadBar == null) {
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2005-04-27 18:03:40 UTC (rev 2485)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2005-04-27 18:04:08 UTC (rev 2486)
@@ -139,13 +139,23 @@
if (lineToMark == -1) return;
IDebuggingService dbgr = (IDebuggingService)ServiceManager.GetService (typeof (IDebuggingService));
if (dbgr != null) {
- bool canToggle = dbgr.ToggleBreakpoint (ParentEditor.DisplayBinding.ContentName, lineToMark + 1);
- if (canToggle)
- buf.ToggleMark (lineToMark, SourceMarkerType.BreakpointMark);
+ dbgr.ToggleBreakpoint (ParentEditor.DisplayBinding.ContentName, lineToMark + 1);
lineToMark = -1;
}
}
+ public void ShowBreakpointAt (int linenumber)
+ {
+ if (!buf.IsMarked (linenumber, SourceMarkerType.BreakpointMark))
+ buf.ToggleMark (linenumber, SourceMarkerType.BreakpointMark);
+ }
+
+ public void ClearBreakpointAt (int linenumber)
+ {
+ if (buf.IsMarked (linenumber, SourceMarkerType.BreakpointMark))
+ buf.ToggleMark (linenumber, SourceMarkerType.BreakpointMark);
+ }
+
public void ExecutingAt (int linenumber)
{
buf.ToggleMark (linenumber, SourceMarkerType.ExecutionMark);
More information about the Monodevelop-patches-list
mailing list