diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/FormKeyHandler.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/FormKeyHandler.cs index e90069ed6a..67487577c3 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/FormKeyHandler.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/FormKeyHandler.cs @@ -103,27 +103,6 @@ namespace ICSharpCode.FormsDesigner return false; } -// if (AbstractMenuEditorControl.MenuEditorFocused) { -// return false; -// } - -// if (m.Msg == leftMouseButtonDownMessage) { -// if (formDesigner.IsTabOrderMode) { -// Point p = new Point(m.LParam.ToInt32()); -// Control c = Control.FromHandle(m.HWnd); -// try { -// if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) { -// formDesigner.SetPrevTabIndex(c.PointToScreen(p)); -// } else { -// formDesigner.SetNextTabIndex(c.PointToScreen(p)); -// } -// } catch (Exception e) { -// MessageService.ShowError(e); -// } -// } -// return false; -// } - Keys keyPressed = (Keys)m.WParam.ToInt32() | Control.ModifierKeys; if (keyPressed == Keys.Escape) { @@ -135,9 +114,18 @@ namespace ICSharpCode.FormsDesigner CommandWrapper commandWrapper = (CommandWrapper)keyTable[keyPressed]; if (commandWrapper != null) { + LoggingService.Debug("Run menu command: " + commandWrapper.CommandID); + Control ctl = WorkbenchSingleton.ActiveControl; + IMenuCommandService menuCommandService = (IMenuCommandService)formDesigner.Host.GetService(typeof(IMenuCommandService)); ISelectionService selectionService = (ISelectionService)formDesigner.Host.GetService(typeof(ISelectionService)); ICollection components = selectionService.GetSelectedComponents(); + if (components.Count == 1) { + foreach (Component component in components) { + if (HandleMenuCommand(formDesigner, component, keyPressed)) + return false; + } + } menuCommandService.GlobalInvoke(commandWrapper.CommandID); @@ -150,6 +138,44 @@ namespace ICSharpCode.FormsDesigner return false; } + bool HandleMenuCommand(FormsDesignerViewContent formDesigner, Component activeComponent, Keys keyPressed) + { + Assembly asm = typeof(WindowsFormsDesignerOptionService).Assembly; + // Microsoft made ToolStripKeyboardHandlingService internal, so we need Reflection + Type keyboardType = asm.GetType("System.Windows.Forms.Design.ToolStripKeyboardHandlingService"); + object keyboardService = formDesigner.Host.GetService(keyboardType); + if (keyboardService == null) { + LoggingService.Debug("no ToolStripKeyboardHandlingService found"); + return false; // handle command normally + } + if (activeComponent is ToolStripItem) { + if (keyPressed == Keys.Up) { + keyboardType.InvokeMember("ProcessUpDown", + BindingFlags.Instance + | BindingFlags.Public + | BindingFlags.InvokeMethod, + null, keyboardService, new object[] { false }); + return true; // command was handled specially + } else if (keyPressed == Keys.Down) { + keyboardType.InvokeMember("ProcessUpDown", + BindingFlags.Instance + | BindingFlags.Public + | BindingFlags.InvokeMethod, + null, keyboardService, new object[] { true }); + return true; // command was handled specially + } + } + bool active = (bool)keyboardType.InvokeMember("TemplateNodeActive", + BindingFlags.Instance + | BindingFlags.NonPublic + | BindingFlags.GetProperty, + null, keyboardService, null); + if (active) { + return true; // command will handled specially by the text box, don't invoke the CommandID + } + return false; // invoke the CommandID + } + class CommandWrapper { CommandID commandID; diff --git a/src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs b/src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs index 2c49954c48..ded8a7f83e 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs @@ -102,6 +102,9 @@ namespace ICSharpCode.SharpDevelop.Gui textEditorControl.Dock = DockStyle.Fill; textEditorControl.BorderStyle = BorderStyle.FixedSingle; textEditorControl.BackColor = SystemColors.Window; + textEditorControl.LinkClicked += delegate(object sender, LinkClickedEventArgs e) { + FileService.OpenFile("browser://" + e.LinkText); + }; /*textEditorControl.ShowLineNumbers = false; textEditorControl.ShowInvalidLines = false; textEditorControl.EnableFolding = false; diff --git a/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Commands/SearchToolbarCommands.cs b/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Commands/SearchToolbarCommands.cs index adca0b0f26..2bc58b6998 100644 --- a/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Commands/SearchToolbarCommands.cs +++ b/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Commands/SearchToolbarCommands.cs @@ -42,25 +42,26 @@ namespace SearchAndReplace comboBox.Items.Add(findItem); } comboBox.Text = SearchOptions.FindPattern; - - comboBox.KeyDown += new System.Windows.Forms.KeyEventHandler(ComboBoxKeyDown); + } + + void OnKeyPress(object sender, KeyPressEventArgs e) + { + if (e.KeyChar == '\r') { + CommitSearch(); + e.Handled = true; + } } void CommitSearch() { if (comboBox.Text.Length > 0) { + LoggingService.Debug("FindComboBox.CommitSearch()"); + SearchOptions.DocumentIteratorType = DocumentIteratorType.CurrentDocument; SearchOptions.FindPattern = comboBox.Text; SearchReplaceManager.FindNext(); comboBox.Focus(); } } - - void ComboBoxKeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.ControlKey) { - CommitSearch(); - } - } void SearchOptionsChanged(object sender, PropertyChangedEventArgs e) { @@ -75,6 +76,7 @@ namespace SearchAndReplace ToolBarComboBox toolbarItem = (ToolBarComboBox)Owner; comboBox = toolbarItem.ComboBox; comboBox.DropDownStyle = ComboBoxStyle.DropDown; + comboBox.KeyPress += OnKeyPress; SearchOptions.Properties.PropertyChanged += new PropertyChangedEventHandler(SearchOptionsChanged); RefreshComboBox();