diff options
Diffstat (limited to 'main')
3 files changed, 31 insertions, 22 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/ValueVisualizerDialog.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/ValueVisualizerDialog.cs index 87683dd53f..8158421700 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/ValueVisualizerDialog.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/ValueVisualizerDialog.cs @@ -54,7 +54,7 @@ namespace MonoDevelop.Debugger.Viewers visualizers.Sort ((v1, v2) => string.Compare (v1.Name, v2.Name, StringComparison.CurrentCultureIgnoreCase)); buttons = new List<ToggleButton> (); - Gtk.Button defaultVis = null; + ToggleButton defaultVis = null; for (int i = 0; i < visualizers.Count; i++) { var button = new ToggleButton (); @@ -64,14 +64,15 @@ namespace MonoDevelop.Debugger.Viewers defaultVis = button; hbox1.PackStart (button, false, false, 0); buttons.Add (button); - button.CanFocus = false; button.Show (); } - if (defaultVis != null) - defaultVis.Click (); - else if (buttons.Count > 0) - buttons [0].Click (); + if (defaultVis == null) + defaultVis = buttons [0]; + + defaultVis.GrabFocus (); + SetToggleState (defaultVis, true); + UpdateVisualizer (defaultVis); if (val.IsReadOnly || !visualizers.Any (v => v.CanEdit (val))) { buttonCancel.Label = Gtk.Stock.Close; @@ -89,24 +90,23 @@ namespace MonoDevelop.Debugger.Viewers return base.OnKeyPressEvent (evnt); } - protected virtual void OnComboVisualizersChanged (object sender, EventArgs e) + void SetToggleState (ToggleButton button, bool value) + { + button.Toggled -= OnComboVisualizersChanged; + button.Active = value; + button.Toggled += OnComboVisualizersChanged; + } + + void UpdateVisualizer (ToggleButton button) { - var button = (ToggleButton)sender; - if (!button.Active) {//Prevent un-toggling - button.Toggled -= OnComboVisualizersChanged; - button.Active = true; - button.Toggled += OnComboVisualizersChanged; - return; - } if (currentWidget != null) mainBox.Remove (currentWidget); + foreach (var b in buttons) { - if (b != button && b.Active) { - b.Toggled -= OnComboVisualizersChanged; - b.Active = false; - b.Toggled += OnComboVisualizersChanged; - } + if (b != button && b.Active) + SetToggleState (b, false); } + currentVisualizer = visualizers [buttons.IndexOf (button)]; currentWidget = currentVisualizer.GetVisualizerWidget (value); buttonSave.Sensitive = currentVisualizer.CanEdit (value); @@ -114,6 +114,18 @@ namespace MonoDevelop.Debugger.Viewers currentWidget.Show (); } + protected virtual void OnComboVisualizersChanged (object sender, EventArgs e) + { + var button = (ToggleButton) sender; + + if (!button.Active) {//Prevent un-toggling + SetToggleState (button, true); + return; + } + + UpdateVisualizer (button); + } + protected virtual void OnSaveClicked (object sender, EventArgs e) { bool saved = false; diff --git a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs index 0d9e6c2395..f5f29f6b08 100644 --- a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs +++ b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs @@ -65,8 +65,6 @@ namespace MonoDevelop.HexEditor window = new ScrollView (hexEditor); await LoadContent (); - hexEditor.SetFocus (); - return new XwtControl (window); } diff --git a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorVisualizer.cs b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorVisualizer.cs index 40c0f444db..74087bbc2a 100644 --- a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorVisualizer.cs +++ b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorVisualizer.cs @@ -135,7 +135,6 @@ namespace MonoDevelop.HexEditor var xwtScrollView = new Xwt.ScrollView (hexEditor); var scrollWidget = (Widget) Xwt.Toolkit.CurrentEngine.GetNativeWidget (xwtScrollView); SetHexEditorOptions (); - hexEditor.SetFocus (); return scrollWidget; } |