Browse Source

fixing Shortcuts and Toolbar Commands

formsdesignerappdomain
Siegfried Pammer 14 years ago
parent
commit
bd0727609d
  1. 10
      src/AddIns/DisplayBindings/FormsDesigner/FormsDesigner.AddIn/Commands/FormsCommands.cs
  2. 32
      src/AddIns/DisplayBindings/FormsDesigner/FormsDesigner.AddIn/FormsDesignerViewContent.cs
  3. 7
      src/Main/Base/Project/Src/Util/SDWindowsFormsHost.cs

10
src/AddIns/DisplayBindings/FormsDesigner/FormsDesigner.AddIn/Commands/FormsCommands.cs

@ -29,7 +29,7 @@ namespace ICSharpCode.FormsDesigner.Commands @@ -29,7 +29,7 @@ namespace ICSharpCode.FormsDesigner.Commands
return true;
}
protected FormsDesignerViewContent FormDesigner {
protected FormsDesignerViewContent FormsDesigner {
get {
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
if (window == null) {
@ -41,10 +41,10 @@ namespace ICSharpCode.FormsDesigner.Commands @@ -41,10 +41,10 @@ namespace ICSharpCode.FormsDesigner.Commands
public override void Run()
{
try {
FormsDesignerViewContent formDesigner = FormDesigner;
if (formDesigner != null && CanExecuteCommand(formDesigner.AppDomainHost)) {
IMenuCommandService menuCommandService = formDesigner.AppDomainHost.MenuCommandService;
menuCommandService.GlobalInvoke(CommandIDEnumConverter.ToCommandID(CommandID));
FormsDesignerViewContent formsDesigner = FormsDesigner;
if (formsDesigner != null && CanExecuteCommand(formsDesigner.AppDomainHost)) {
IMenuCommandServiceProxy menuCommandService = (IMenuCommandServiceProxy)formsDesigner.AppDomainHost.MenuCommandService;
menuCommandService.GlobalInvoke(CommandID);
}
} catch (Exception e) {
MessageService.ShowException(e);

32
src/AddIns/DisplayBindings/FormsDesigner/FormsDesigner.AddIn/FormsDesignerViewContent.cs

@ -273,7 +273,9 @@ namespace ICSharpCode.FormsDesigner @@ -273,7 +273,9 @@ namespace ICSharpCode.FormsDesigner
CustomWindowsFormsHost WrapInCustomHost(Control control, bool enableFontInheritance = true)
{
var host = new CustomWindowsFormsHost(appDomain);
var host = new SDWindowsFormsHost(appDomain, true);
host.DisposeChild = false;
host.ServiceObject = this;
host.EnableFontInheritance = enableFontInheritance;
host.Child = control;
return host;
@ -847,32 +849,32 @@ namespace ICSharpCode.FormsDesigner @@ -847,32 +849,32 @@ namespace ICSharpCode.FormsDesigner
public void Cut()
{
IMenuCommandService menuCommandService = (IMenuCommandService)appDomainHost.GetService(typeof(IMenuCommandService));
menuCommandService.GlobalInvoke(StandardCommands.Cut);
IMenuCommandServiceProxy menuCommandService = (IMenuCommandServiceProxy)appDomainHost.MenuCommandService;
menuCommandService.GlobalInvoke(CommandIDEnum.Cut);
}
public void Copy()
{
IMenuCommandService menuCommandService = (IMenuCommandService)appDomainHost.GetService(typeof(IMenuCommandService));
menuCommandService.GlobalInvoke(StandardCommands.Copy);
IMenuCommandServiceProxy menuCommandService = (IMenuCommandServiceProxy)appDomainHost.MenuCommandService;
menuCommandService.GlobalInvoke(CommandIDEnum.Copy);
}
public void Paste()
{
IMenuCommandService menuCommandService = (IMenuCommandService)appDomainHost.GetService(typeof(IMenuCommandService));
menuCommandService.GlobalInvoke(StandardCommands.Paste);
IMenuCommandServiceProxy menuCommandService = (IMenuCommandServiceProxy)appDomainHost.MenuCommandService;
menuCommandService.GlobalInvoke(CommandIDEnum.Paste);
}
public void Delete()
{
IMenuCommandService menuCommandService = (IMenuCommandService)appDomainHost.GetService(typeof(IMenuCommandService));
menuCommandService.GlobalInvoke(StandardCommands.Delete);
IMenuCommandServiceProxy menuCommandService = (IMenuCommandServiceProxy)appDomainHost.MenuCommandService;
menuCommandService.GlobalInvoke(CommandIDEnum.Delete);
}
public void SelectAll()
{
IMenuCommandService menuCommandService = (IMenuCommandService)appDomainHost.GetService(typeof(IMenuCommandService));
menuCommandService.GlobalInvoke(StandardCommands.SelectAll);
IMenuCommandServiceProxy menuCommandService = (IMenuCommandServiceProxy)appDomainHost.MenuCommandService;
menuCommandService.GlobalInvoke(CommandIDEnum.SelectAll);
}
#endregion
@ -887,8 +889,8 @@ namespace ICSharpCode.FormsDesigner @@ -887,8 +889,8 @@ namespace ICSharpCode.FormsDesigner
public virtual void ShowTabOrder()
{
if (!IsTabOrderMode) {
IMenuCommandService menuCommandService = (IMenuCommandService)appDomainHost.GetService(typeof(IMenuCommandService));
menuCommandService.GlobalInvoke(StandardCommands.TabOrder);
IMenuCommandServiceProxy menuCommandService = (IMenuCommandServiceProxy)appDomainHost.MenuCommandService;
menuCommandService.GlobalInvoke(CommandIDEnum.TabOrder);
tabOrderMode = true;
}
}
@ -896,8 +898,8 @@ namespace ICSharpCode.FormsDesigner @@ -896,8 +898,8 @@ namespace ICSharpCode.FormsDesigner
public virtual void HideTabOrder()
{
if (IsTabOrderMode) {
IMenuCommandService menuCommandService = (IMenuCommandService)appDomainHost.GetService(typeof(IMenuCommandService));
menuCommandService.GlobalInvoke(StandardCommands.TabOrder);
IMenuCommandServiceProxy menuCommandService = (IMenuCommandServiceProxy)appDomainHost.MenuCommandService;
menuCommandService.GlobalInvoke(CommandIDEnum.TabOrder);
tabOrderMode = false;
}
}

7
src/Main/Base/Project/Src/Util/SDWindowsFormsHost.cs

@ -31,6 +31,13 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -31,6 +31,13 @@ namespace ICSharpCode.SharpDevelop.Gui
CreateBindings(processShortcutsInWPF);
}
public SDWindowsFormsHost(AppDomain childDomain, bool processShortcutsInWPF = false)
: base(childDomain)
{
this.DisposeChild = true;
CreateBindings(processShortcutsInWPF);
}
#region Binding
void CreateBindings(bool processShortcutsInWPF)
{

Loading…
Cancel
Save