From a2c2607b207a1ce5c2d090a295253dcdc42eb3b8 Mon Sep 17 00:00:00 2001 From: Ivan Shumilin Date: Mon, 8 Sep 2008 17:10:35 +0000 Subject: [PATCH] - Designer commands now work in OutlineViewPad - Shortcut for Delete command git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3519 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- AddIns/ICSharpCode.SharpDevelop.addin | 1 + .../WpfDesign.AddIn/Src/OutlineViewPad.cs | 1 + .../Src/SharpDevelopElementHost.cs | 18 ++++++------------ .../WpfDesign.AddIn/Src/WpfViewContent.cs | 4 ++-- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/AddIns/ICSharpCode.SharpDevelop.addin b/AddIns/ICSharpCode.SharpDevelop.addin index 7d42727046..9a998ddab5 100644 --- a/AddIns/ICSharpCode.SharpDevelop.addin +++ b/AddIns/ICSharpCode.SharpDevelop.addin @@ -1280,6 +1280,7 @@ label = "${res:XML.MainMenu.EditMenu.Delete}" icon = "Icons.16x16.DeleteIcon" type = "Item" + shortcut = "Delete" loadclasslazy = "false" class = "ICSharpCode.SharpDevelop.Commands.Delete"/> diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/OutlineViewPad.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/OutlineViewPad.cs index d150b2d6b7..0101f9ddba 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/OutlineViewPad.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/OutlineViewPad.cs @@ -31,6 +31,7 @@ namespace ICSharpCode.WpfDesign.AddIn void WorkbenchActiveViewContentChanged(object sender, EventArgs e) { WpfViewContent wpfView = WorkbenchSingleton.Workbench.ActiveViewContent as WpfViewContent; + host.ViewContent = wpfView; if (wpfView != null) { host.Child = wpfView.Outline; } else { diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/SharpDevelopElementHost.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/SharpDevelopElementHost.cs index fddce2f0bf..0c18c97a8f 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/SharpDevelopElementHost.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/SharpDevelopElementHost.cs @@ -29,15 +29,9 @@ namespace ICSharpCode.WpfDesign.AddIn Dispatcher.CurrentDispatcher.UnhandledException += CurrentDispatcher_UnhandledException; } } - - public SharpDevelopElementHost(WpfViewContent viewContent, UIElement child) - : this() - { - this.viewContent = viewContent; - this.Child = child; - } - WpfViewContent viewContent; + //needed for command routing (SharpDevelopElementHost -> DesignSurface) + internal WpfViewContent ViewContent; static void CurrentDispatcher_UnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { @@ -49,8 +43,8 @@ namespace ICSharpCode.WpfDesign.AddIn { if (command.CanExecute(null, null)) return true; - else if (viewContent != null) - return command.CanExecute(null, viewContent.DesignSurface); + else if (ViewContent != null) + return command.CanExecute(null, ViewContent.DesignSurface); else return false; } @@ -59,8 +53,8 @@ namespace ICSharpCode.WpfDesign.AddIn { if (command.CanExecute(null, null)) { command.Execute(null, null); - } else if (viewContent != null) { - command.Execute(null, viewContent.DesignSurface); + } else if (ViewContent != null) { + command.Execute(null, ViewContent.DesignSurface); } } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs index a23673dd6e..0d13031c45 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs @@ -63,7 +63,7 @@ namespace ICSharpCode.WpfDesign.AddIn // initialize designer on first load DragDropExceptionHandler.HandleException = ICSharpCode.Core.MessageService.ShowError; designer = new DesignSurface(); - wpfHost = new SharpDevelopElementHost(this, designer); + wpfHost = new SharpDevelopElementHost() { ViewContent = this, Child = designer }; this.UserControl = wpfHost; InitPropertyEditor(); } @@ -147,7 +147,7 @@ namespace ICSharpCode.WpfDesign.AddIn void InitPropertyEditor() { propertyGridView = new PropertyGridView(); - propertyEditorHost = new SharpDevelopElementHost(this, propertyGridView); + propertyEditorHost = new SharpDevelopElementHost() { ViewContent = this, Child = propertyGridView}; propertyContainer.PropertyGridReplacementControl = propertyEditorHost; }