Browse Source

Fixed SD2-732: Closing pad context menu's using escape key

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1331 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
40cb6ff96f
  1. 4
      src/Main/Base/Project/Src/Commands/AutostartCommands.cs
  2. 19
      src/Main/Core/Project/Src/Services/MenuService/MenuService.cs

4
src/Main/Base/Project/Src/Commands/AutostartCommands.cs

@ -49,7 +49,7 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -49,7 +49,7 @@ namespace ICSharpCode.SharpDevelop.Commands
{
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
if (!WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent.Control.ContainsFocus) {
if (Form.ActiveForm == (Form)WorkbenchSingleton.Workbench) {
if (Form.ActiveForm == WorkbenchSingleton.MainForm) {
WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent.Control.Focus();
}
}
@ -75,7 +75,7 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -75,7 +75,7 @@ namespace ICSharpCode.SharpDevelop.Commands
Keys keyPressed = (Keys)m.WParam.ToInt32() | Control.ModifierKeys;
if (keyPressed == Keys.Escape) {
if (PadHasFocus()) {
if (PadHasFocus() && !MenuService.IsContextMenuOpen) {
SelectActiveWorkbenchWindow();
return true;
}

19
src/Main/Core/Project/Src/Services/MenuService/MenuService.cs

@ -55,7 +55,8 @@ namespace ICSharpCode.Core @@ -55,7 +55,8 @@ namespace ICSharpCode.Core
}
}
};
contextMenu.Opened += new EventHandler(ContextMenuPopupHandler);
contextMenu.Opened += ContextMenuOpened;
contextMenu.Closed += ContextMenuClosed;
return contextMenu;
} catch (TreePathNotFoundException) {
MessageService.ShowError("Warning tree path '" + addInTreePath +"' not found.");
@ -63,8 +64,17 @@ namespace ICSharpCode.Core @@ -63,8 +64,17 @@ namespace ICSharpCode.Core
}
}
static void ContextMenuPopupHandler(object sender, EventArgs e)
static bool isContextMenuOpen;
public static bool IsContextMenuOpen {
get {
return isContextMenuOpen;
}
}
static void ContextMenuOpened(object sender, EventArgs e)
{
isContextMenuOpen = true;
ContextMenuStrip contextMenu = (ContextMenuStrip)sender;
foreach (object o in contextMenu.Items) {
if (o is IStatusUpdate) {
@ -73,6 +83,11 @@ namespace ICSharpCode.Core @@ -73,6 +83,11 @@ namespace ICSharpCode.Core
}
}
static void ContextMenuClosed(object sender, EventArgs e)
{
isContextMenuOpen = false;
}
public static void ShowContextMenu(object owner, string addInTreePath, Control parent, int x, int y)
{
CreateContextMenu(owner, addInTreePath).Show(parent, new Point(x, y));

Loading…
Cancel
Save