Browse Source

Use the Same Context Menu for Outline View

pull/604/head
jkuehner 11 years ago
parent
commit
1d80551b9e
  1. 4
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.addin
  2. 38
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultCommandsContextMenu.xaml
  3. 43
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultCommandsContextMenu.xaml.cs
  4. 54
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultCommandsContextMenuExtension.cs
  5. 2
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/EditStyleContextMenuExtension.cs
  6. 1
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/RightClickContextMenuExtension.cs
  7. 2
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TextBlockRightClickContextMenuExtension.cs
  8. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.CopyIcon.png
  9. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.CutIcon.png
  10. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.DeleteIcon.png
  11. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.PasteIcon.png
  12. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.RedoIcon.png
  13. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.UndoIcon.png
  14. 8
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineView.xaml
  15. 14
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj

4
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.addin

@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
-->
<Path name="/AddIns/WpfDesign/Designer/ContextMenu">
<MenuItem label="${res:ICSharpCode.WPFDesigner.ContextMenu.ViewXAML}" id="viewXaml" icon="Icons.16x16.XMLFileIcon" class="ICSharpCode.WpfDesign.AddIn.Commands.ViewXaml" />
<MenuItem label="seperator1" type="Separator" />
<!--<MenuItem label="seperator1" type="Separator" />
<Condition name="IsCutCopyEnabled" action="Disable">
<MenuItem id="cut" label="${res:ICSharpCode.WPFDesigner.ContextMenu.Cut}" icon="Icons.16x16.CutIcon" shortcut="Control|X" class="ICSharpCode.WpfDesign.AddIn.Commands.Cut" />
<MenuItem id="copy" label="${res:ICSharpCode.WPFDesigner.ContextMenu.Copy}" icon="Icons.16x16.CopyIcon" shortcut="Control|C" class="ICSharpCode.WpfDesign.AddIn.Commands.Copy" />
@ -66,7 +66,7 @@ @@ -66,7 +66,7 @@
</Condition>
<Condition name="IsRedoEnabled" action="Disable">
<MenuItem id="redo" label="${res:ICSharpCode.WPFDesigner.ContextMenu.Redo}" icon="Icons.16x16.RedoIcon" shortcut="Control|R" class="ICSharpCode.WpfDesign.AddIn.Commands.Redo" />
</Condition>
</Condition>-->
<MenuItem label="seperator3" type="Separator" />
<MenuItem id="tools" label="${res:ICSharpCode.WPFDesigner.ContextMenu.Tools}" icon="PadIcons.Toolbar" shortcut="Control|Alt|X" class="ICSharpCode.WpfDesign.AddIn.Commands.Tools" />
<MenuItem id="properties" label="${res:ICSharpCode.WPFDesigner.ContextMenu.Properties}" icon="Icons.16x16.PropertiesIcon" shortcut="F4" class="ICSharpCode.WpfDesign.AddIn.Commands.Properties" />

38
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultCommandsContextMenu.xaml

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
<ContextMenu x:Class="ICSharpCode.WpfDesign.Designer.Extensions.DefaultCommandsContextMenu"
xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Translation="clr-namespace:ICSharpCode.WpfDesign.Designer"
>
<MenuItem Command="ApplicationCommands.Cut">
<MenuItem.Icon>
<Image Source="/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.CutIcon.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="ApplicationCommands.Copy">
<MenuItem.Icon>
<Image Source="/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.CopyIcon.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="ApplicationCommands.Paste">
<MenuItem.Icon>
<Image Source="/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.PasteIcon.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="ApplicationCommands.Delete">
<MenuItem.Icon>
<Image Source="/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.DeleteIcon.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="ApplicationCommands.Undo">
<MenuItem.Icon>
<Image Source="/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.UndoIcon.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="ApplicationCommands.Redo">
<MenuItem.Icon>
<Image Source="/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.RedoIcon.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>

43
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultCommandsContextMenu.xaml.cs

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using System.Xml;
using ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.FormatedTextEditor;
using ICSharpCode.WpfDesign.Designer.Xaml;
using ICSharpCode.WpfDesign.XamlDom;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
public partial class DefaultCommandsContextMenu
{
private DesignItem designItem;
public DefaultCommandsContextMenu(DesignItem designItem)
{
this.designItem = designItem;
InitializeComponent();
}
}
}

54
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultCommandsContextMenuExtension.cs

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Extensions;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
[ExtensionServer(typeof(PrimarySelectionExtensionServer))]
[ExtensionFor(typeof (UIElement))]
[Extension(Order = 10)]
public class DefaultCommandsContextMenuExtension : SelectionAdornerProvider
{
DesignPanel panel;
ContextMenu contextMenu;
protected override void OnInitialized()
{
base.OnInitialized();
contextMenu = new DefaultCommandsContextMenu(ExtendedItem);
panel = ExtendedItem.Context.Services.DesignPanel as DesignPanel;
if (panel != null)
panel.AddContextMenu(contextMenu);
}
protected override void OnRemove()
{
if (panel != null)
panel.RemoveContextMenu(contextMenu);
base.OnRemove();
}
}
}

2
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/EditStyleContextMenuExtension.cs

@ -26,7 +26,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -26,7 +26,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
{
[ExtensionServer(typeof (OnlyOneItemSelectedExtensionServer))]
[ExtensionFor(typeof (Control))]
[Extension(Order = 10)]
[Extension(Order = 30)]
public class EditStyleContextMenuExtension : PrimarySelectionAdornerProvider
{
DesignPanel panel;

1
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/RightClickContextMenuExtension.cs

@ -30,6 +30,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -30,6 +30,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
/// </summary>
[ExtensionServer(typeof(OnlyOneItemSelectedExtensionServer))]
[ExtensionFor(typeof(UIElement))]
[Extension(Order = 20)]
public sealed class RightClickContextMenuExtension : PrimarySelectionAdornerProvider
{
DesignPanel panel;

2
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TextBlockRightClickContextMenuExtension.cs

@ -26,7 +26,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -26,7 +26,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
{
[ExtensionServer(typeof (OnlyOneItemSelectedExtensionServer))]
[ExtensionFor(typeof (TextBlock))]
[Extension(Order = 10)]
[Extension(Order = 40)]
public class TextBlockRightClickContextMenuExtension : PrimarySelectionAdornerProvider
{
DesignPanel panel;

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.CopyIcon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 B

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.CutIcon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.DeleteIcon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.PasteIcon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.RedoIcon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.UndoIcon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

8
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineView.xaml

@ -97,7 +97,7 @@ @@ -97,7 +97,7 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type Default:DragTreeViewItem}">
<DockPanel Background="White">
<DockPanel Background="White" ContextMenu="{Binding DesignItem.Services.DesignPanel.ContextMenu}">
<Grid x:Name="bg"
Margin="{TemplateBinding Level, Converter={StaticResource LevelConverter}}"
DockPanel.Dock="Top"
@ -112,8 +112,8 @@ @@ -112,8 +112,8 @@
ContentSource="Header" />
</Border>
</Grid>
<ItemsPresenter x:Name="itemsHost" />
<DockPanel.ContextMenu>
<ItemsPresenter x:Name="itemsHost" />
<!-- <DockPanel.ContextMenu>
<ContextMenu>
<MenuItem Command="ApplicationCommands.Cut" />
<MenuItem Command="ApplicationCommands.Copy" />
@ -121,7 +121,7 @@ @@ -121,7 +121,7 @@
<Separator />
<MenuItem Command="ApplicationCommands.Delete" />
</ContextMenu>
</DockPanel.ContextMenu>
</DockPanel.ContextMenu>-->
<DockPanel.ToolTip>
<ToolTip Background="White">
<Rectangle Width="50" Height="50">

14
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj

@ -86,6 +86,11 @@ @@ -86,6 +86,11 @@
<Compile Include="ArrangeDirection.cs" />
<Compile Include="Controls\RenderTransformOriginThumb.cs" />
<Compile Include="Extensions\BorderForImageControl.cs" />
<Compile Include="Extensions\DefaultCommandsContextMenu.xaml.cs">
<DependentUpon>DefaultCommandsContextMenu.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Extensions\DefaultCommandsContextMenuExtension.cs" />
<Compile Include="Extensions\PartialPanelSelectionHandler.cs" />
<Compile Include="Extensions\EditStyleContextMenu.xaml.cs">
<DependentUpon>EditStyleContextMenu.xaml</DependentUpon>
@ -289,6 +294,7 @@ @@ -289,6 +294,7 @@
<Resource Include="Images\Tag.png" />
</ItemGroup>
<ItemGroup>
<Page Include="Extensions\DefaultCommandsContextMenu.xaml" />
<Page Include="Extensions\EditStyleContextMenu.xaml">
<SubType>Designer</SubType>
</Page>
@ -468,4 +474,12 @@ @@ -468,4 +474,12 @@
<ItemGroup>
<Resource Include="Images\Icons.32x32.EmptyProjectIcon.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Icons.16x16.CopyIcon.png" />
<Resource Include="Images\Icons.16x16.CutIcon.png" />
<Resource Include="Images\Icons.16x16.DeleteIcon.png" />
<Resource Include="Images\Icons.16x16.PasteIcon.png" />
<Resource Include="Images\Icons.16x16.RedoIcon.png" />
<Resource Include="Images\Icons.16x16.UndoIcon.png" />
</ItemGroup>
</Project>
Loading…
Cancel
Save