diff --git a/Debugger/ILSpy.Debugger/DebuggerSettings.cs b/Debugger/ILSpy.Debugger/DebuggerSettings.cs index d723f0998..7072d3901 100644 --- a/Debugger/ILSpy.Debugger/DebuggerSettings.cs +++ b/Debugger/ILSpy.Debugger/DebuggerSettings.cs @@ -11,6 +11,7 @@ namespace ICSharpCode.ILSpy.Debugger bool showWarnings = true; bool askArguments = true; bool debugWholeTypesOnly = false; + bool showAllBookmarks = false; /// /// Show warnings messages. @@ -56,6 +57,20 @@ namespace ICSharpCode.ILSpy.Debugger } } + /// + /// Show all bookmarks in breakpoints window. + /// + [DefaultValue(false)] + public bool ShowAllBookmarks { + get { return showAllBookmarks; } + set { + if (showAllBookmarks != value) { + showAllBookmarks = value; + OnPropertyChanged("ShowAllBookmarks"); + } + } + } + public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) diff --git a/Debugger/ILSpy.Debugger/UI/BreakpointPanel.xaml.cs b/Debugger/ILSpy.Debugger/UI/BreakpointPanel.xaml.cs index b4695105b..81579ea93 100644 --- a/Debugger/ILSpy.Debugger/UI/BreakpointPanel.xaml.cs +++ b/Debugger/ILSpy.Debugger/UI/BreakpointPanel.xaml.cs @@ -2,6 +2,8 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; @@ -9,8 +11,11 @@ using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; + using ICSharpCode.ILSpy; using ICSharpCode.ILSpy.Bookmarks; +using ICSharpCode.ILSpy.Debugger.Bookmarks; +using ICSharpCode.ILSpy.Options; namespace ILSpyPlugin { @@ -36,9 +41,11 @@ namespace ILSpyPlugin private BreakpointPanel() { InitializeComponent(); - view.ItemsSource = BookmarkManager.Bookmarks; - BookmarkManager.Added += new BookmarkEventHandler(OnAdded); - BookmarkManager.Removed += new BookmarkEventHandler(OnRemoved); + SetItemSource(); + BookmarkManager.Added += delegate { SetItemSource(); }; + BookmarkManager.Removed += delegate { SetItemSource(); }; + DebuggerSettingsPanel.CurrentDebuggerSettings.PropertyChanged += + delegate(object s, PropertyChangedEventArgs e) { if (e.PropertyName == "ShowAllBookmarks") SetItemSource(); }; } public void Show() @@ -46,21 +53,22 @@ namespace ILSpyPlugin if (!IsVisible) MainWindow.Instance.ShowInBottomPane("Breakpoints", this); } - - private void OnAdded(object sender, BookmarkEventArgs e) - { - view.ItemsSource = null; - view.ItemsSource = BookmarkManager.Bookmarks; - } - private void OnRemoved(object sender, BookmarkEventArgs e) - { - view.ItemsSource = null; - view.ItemsSource = BookmarkManager.Bookmarks; - } - + private void SetItemSource() + { + view.ItemsSource = null; + if (DebuggerSettingsPanel.CurrentDebuggerSettings.ShowAllBookmarks) + view.ItemsSource = BookmarkManager.Bookmarks; + else + view.ItemsSource = BookmarkManager.Bookmarks.Where(b => b is BreakpointBookmark); + } + public void Closed() { + BookmarkManager.Added -= delegate { SetItemSource(); }; + BookmarkManager.Removed -= delegate { SetItemSource(); }; + DebuggerSettingsPanel.CurrentDebuggerSettings.PropertyChanged -= + delegate(object s, PropertyChangedEventArgs e) { if (e.PropertyName == "ShowAllBookmarks") SetItemSource(); }; } void view_MouseDoubleClick(object sender, MouseButtonEventArgs e) @@ -70,7 +78,6 @@ namespace ILSpyPlugin var selectedItem = view.SelectedItem as BookmarkBase; if (null == selectedItem) return; - // TODO: Line should be part of jump target MainWindow.Instance.JumpToReference(selectedItem.MemberReference); MainWindow.Instance.TextView.UnfoldAndScroll(selectedItem.LineNumber); e.Handled = true; diff --git a/Debugger/ILSpy.Debugger/UI/CallStackPanel.xaml.cs b/Debugger/ILSpy.Debugger/UI/CallStackPanel.xaml.cs index f421d921f..d7594d730 100644 --- a/Debugger/ILSpy.Debugger/UI/CallStackPanel.xaml.cs +++ b/Debugger/ILSpy.Debugger/UI/CallStackPanel.xaml.cs @@ -187,6 +187,8 @@ namespace ILSpyPlugin if (mr == null) return; MainWindow.Instance.JumpToReference(mr); + // TODO: jump to associated line + // MainWindow.Instance.TextView.UnfoldAndScroll(selectedItem.LineNumber); e.Handled = true; } } diff --git a/Debugger/ILSpy.Debugger/UI/DebuggerSettingsPanel.xaml b/Debugger/ILSpy.Debugger/UI/DebuggerSettingsPanel.xaml index 37581e90c..92acbd1c9 100644 --- a/Debugger/ILSpy.Debugger/UI/DebuggerSettingsPanel.xaml +++ b/Debugger/ILSpy.Debugger/UI/DebuggerSettingsPanel.xaml @@ -6,6 +6,7 @@ Show warning messages Ask for arguments and working directory before executing a process + Show all bookmarks in breakpoints window \ No newline at end of file diff --git a/Debugger/ILSpy.Debugger/UI/DebuggerSettingsPanel.xaml.cs b/Debugger/ILSpy.Debugger/UI/DebuggerSettingsPanel.xaml.cs index 0c30e14d6..2f01e5ed9 100644 --- a/Debugger/ILSpy.Debugger/UI/DebuggerSettingsPanel.xaml.cs +++ b/Debugger/ILSpy.Debugger/UI/DebuggerSettingsPanel.xaml.cs @@ -19,9 +19,10 @@ namespace ICSharpCode.ILSpy.Options [ExportOptionPage(Title = "Debugger", Order = 2)] partial class DebuggerSettingsPanel : UserControl, IOptionPage { - private const string DEBUGGER_SETTINGS = "DebuggerSettings"; - private const string SHOW_WARNINGS = "showWarnings"; - private const string ASK_ARGUMENTS = "askForArguments"; + private static readonly string DEBUGGER_SETTINGS = "DebuggerSettings"; + private static readonly string SHOW_WARNINGS = "showWarnings"; + private static readonly string ASK_ARGUMENTS = "askForArguments"; + private static readonly string SHOW_BOOKMARKS = "showAllBookmarks"; public DebuggerSettingsPanel() { @@ -30,7 +31,7 @@ namespace ICSharpCode.ILSpy.Options public void Load(ILSpySettings settings) { - this.DataContext = LoadDebuggerSettings(settings); + this.DataContext = CurrentDebuggerSettings; } static DebuggerSettings currentDebuggerSettings; @@ -47,7 +48,7 @@ namespace ICSharpCode.ILSpy.Options DebuggerSettings s = new DebuggerSettings(); s.ShowWarnings = (bool?)e.Attribute(SHOW_WARNINGS) ?? s.ShowWarnings; s.AskForArguments = (bool?)e.Attribute(ASK_ARGUMENTS) ?? s.AskForArguments; - + s.ShowAllBookmarks = (bool?)e.Attribute(SHOW_BOOKMARKS) ?? s.ShowAllBookmarks; return s; } @@ -57,14 +58,13 @@ namespace ICSharpCode.ILSpy.Options XElement section = new XElement(DEBUGGER_SETTINGS); section.SetAttributeValue(SHOW_WARNINGS, s.ShowWarnings); section.SetAttributeValue(ASK_ARGUMENTS, s.AskForArguments); - + section.SetAttributeValue(SHOW_BOOKMARKS, s.ShowAllBookmarks); + XElement existingElement = root.Element(DEBUGGER_SETTINGS); if (existingElement != null) existingElement.ReplaceWith(section); else root.Add(section); - - currentDebuggerSettings = null; // invalidate cached settings } } } \ No newline at end of file