This commit is contained in:
Wiesław Šoltés 2023-09-29 00:26:04 +02:00
Родитель 7222152675
Коммит fc47ff4a9a
13 изменённых файлов: 285 добавлений и 141 удалений

Просмотреть файл

@ -14,6 +14,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Math.Spatial" Version="1.3.0" />
<PackageReference Include="SkiaSharp" Version="$(SkiaSharpVersion)" />

Просмотреть файл

@ -7,6 +7,7 @@ using System.Text;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using CommunityToolkit.Mvvm.Input;
using Draw2D.Presenters;
using Draw2D.Serializer;
using Draw2D.ViewModels;
@ -16,7 +17,7 @@ using Draw2D.ViewModels.Tools;
namespace Draw2D.Editor;
[DataContract(IsReference = true)]
public class EditorToolContext : ToolContext, IEditorToolContext
public partial class EditorToolContext : ToolContext, IEditorToolContext
{
public new static EditMode[] EditModeValues { get; } = (EditMode[])Enum.GetValues(typeof(EditMode));
@ -94,6 +95,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
return null;
}
[RelayCommand]
public void InitContainerView(IContainerView containerView)
{
containerView.ContainerPresenter = new AvaloniaContainerPresenter(this, containerView);
@ -105,6 +107,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
};
}
[RelayCommand]
public void AddContainerView(IContainerView containerView)
{
if (containerView != null)
@ -119,6 +122,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public void CloseContainerView(IContainerView containerView)
{
if (containerView != null)
@ -147,6 +151,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public void NewContainerView(string title)
{
var containerView = _containerFactory?.CreateContainerView(title);
@ -157,6 +162,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public void OpenDocument(string path)
{
var documentContainer = JsonSerializer.FromJsonFile<IDocumentContainer>(path);
@ -170,6 +176,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public void SaveDocument(string path)
{
if (DocumentContainer != null)
@ -178,6 +185,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public void OpenStyles(string path)
{
var styleLibrary = JsonSerializer.FromJsonFile<IStyleLibrary>(path);
@ -188,6 +196,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public void SaveStyles(string path)
{
if (DocumentContainer.StyleLibrary != null)
@ -196,6 +205,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public void OpenGroups(string path)
{
var groupLibrary = JsonSerializer.FromJsonFile<IGroupLibrary>(path);
@ -206,6 +216,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public void SaveGroups(string path)
{
if (DocumentContainer.GroupLibrary != null)
@ -214,6 +225,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void OpenDocumentContainer()
{
var dlg = new OpenFileDialog();
@ -230,6 +242,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void SaveDocumentContainerAs()
{
var dlg = new SaveFileDialog();
@ -245,6 +258,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void OpenStyleLibrary()
{
var dlg = new OpenFileDialog();
@ -261,6 +275,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void SaveStyleLibraryAs()
{
var dlg = new SaveFileDialog();
@ -276,6 +291,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void OpenGroupLibrary()
{
var dlg = new OpenFileDialog();
@ -292,6 +308,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void SaveGroupLibraryAs()
{
var dlg = new SaveFileDialog();
@ -307,6 +324,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public void AddFiles(string path)
{
foreach (var file in Directory.EnumerateFiles(path, "*.json"))
@ -315,11 +333,13 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public void ClearFiles()
{
Files.Clear();
}
[RelayCommand]
public async void ImportFile()
{
var dlg = new OpenFileDialog();
@ -349,6 +369,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void ExportFile()
{
var dlg = new SaveFileDialog();
@ -378,6 +399,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void CopySvgDocument()
{
try
@ -395,6 +417,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void CopySvgPathData()
{
try
@ -415,6 +438,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void PasteSvgPathData()
{
try
@ -445,6 +469,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void CopyGeometryDrawing()
{
try
@ -464,6 +489,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void CopyDrawingGroup()
{
try
@ -483,6 +509,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void CopyDrawingPresenter()
{
try
@ -502,6 +529,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void CopyPath()
{
try
@ -521,6 +549,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public async void CopyCanvas()
{
try
@ -540,6 +569,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public void PathOp(string parameter)
{
if (Enum.TryParse<PathOp>(parameter, true, out var op) == true)
@ -563,6 +593,7 @@ public class EditorToolContext : ToolContext, IEditorToolContext
}
}
[RelayCommand]
public void Exit()
{
if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime)

Просмотреть файл

@ -1,4 +1,5 @@
using System.Collections.Generic;
using CommunityToolkit.Mvvm.Input;
using Draw2D.ViewModels.Containers;
using Draw2D.ViewModels.Tools;
@ -6,6 +7,36 @@ namespace Draw2D.Editor;
public interface IEditorToolContext : IToolContext
{
IRelayCommand<IContainerView> InitContainerViewCommand { get; }
IRelayCommand<IContainerView> AddContainerViewCommand { get; }
IRelayCommand<IContainerView> CloseContainerViewCommand { get; }
IRelayCommand<string> NewContainerViewCommand { get; }
IRelayCommand<string> OpenDocumentCommand { get; }
IRelayCommand<string> SaveDocumentCommand { get; }
IRelayCommand<string> OpenStylesCommand { get; }
IRelayCommand<string> SaveStylesCommand { get; }
IRelayCommand<string> OpenGroupsCommand { get; }
IRelayCommand<string> SaveGroupsCommand { get; }
IRelayCommand OpenDocumentContainerCommand { get; }
IRelayCommand SaveDocumentContainerAsCommand { get; }
IRelayCommand OpenStyleLibraryCommand { get; }
IRelayCommand SaveStyleLibraryAsCommand { get; }
IRelayCommand OpenGroupLibraryCommand { get; }
IRelayCommand SaveGroupLibraryAsCommand { get; }
IRelayCommand<string> AddFilesCommand { get; }
IRelayCommand ClearFilesCommand { get; }
IRelayCommand ImportFileCommand { get; }
IRelayCommand ExportFileCommand { get; }
IRelayCommand CopySvgDocumentCommand { get; }
IRelayCommand CopySvgPathDataCommand { get; }
IRelayCommand PasteSvgPathDataCommand { get; }
IRelayCommand CopyGeometryDrawingCommand { get; }
IRelayCommand CopyDrawingGroupCommand { get; }
IRelayCommand CopyDrawingPresenterCommand { get; }
IRelayCommand CopyPathCommand { get; }
IRelayCommand CopyCanvasCommand { get; }
IRelayCommand<string> PathOpCommand { get; }
IRelayCommand ExitCommand { get; }
IContainerFactory ContainerFactory { get; set; }
IAvaloniaXamlConverter AvaloniaXamlConverter { get; set; }
IContainerImporter ContainerImporter { get; set; }
@ -44,4 +75,4 @@ public interface IEditorToolContext : IToolContext
void CopyCanvas();
void PathOp(string parameter);
void Exit();
}
}

Просмотреть файл

@ -1,8 +1,39 @@

using CommunityToolkit.Mvvm.Input;
namespace Draw2D.ViewModels.Tools;
public interface ISelection : IDirty
{
IRelayCommand<IToolContext> CutCommand { get; }
IRelayCommand<IToolContext> CopyCommand { get; }
IRelayCommand<IToolContext> PasteCommand { get; }
IRelayCommand<IToolContext> DeleteCommand { get; }
IRelayCommand<IToolContext> DuplicateCommand { get; }
IRelayCommand<IToolContext> CreateGroupCommand { get; }
IRelayCommand<IToolContext> CreateReferenceCommand { get; }
IRelayCommand<IToolContext> CreatePathCommand { get; }
IRelayCommand<IToolContext> CreateStrokePathCommand { get; }
IRelayCommand<IToolContext> CreateFillPathCommand { get; }
IRelayCommand<IToolContext> StackHorizontallyCommand { get; }
IRelayCommand<IToolContext> StackVerticallyCommand { get; }
IRelayCommand<IToolContext> DistributeHorizontallyCommand { get; }
IRelayCommand<IToolContext> DistributeVerticallyCommand { get; }
IRelayCommand<IToolContext> AlignLeftCommand { get; }
IRelayCommand<IToolContext> AlignCenteredCommand { get; }
IRelayCommand<IToolContext> AlignRightCommand { get; }
IRelayCommand<IToolContext> AlignTopCommand { get; }
IRelayCommand<IToolContext> AlignCenterCommand { get; }
IRelayCommand<IToolContext> AlignBottomCommand { get; }
IRelayCommand<IToolContext> ArangeBringToFrontCommand { get; }
IRelayCommand<IToolContext> ArangeBringForwardCommand { get; }
IRelayCommand<IToolContext> ArangeSendBackwardCommand { get; }
IRelayCommand<IToolContext> ArangeSendToBackCommand { get; }
IRelayCommand<IToolContext> BreakCommand { get; }
IRelayCommand<IToolContext> ConnectCommand { get; }
IRelayCommand<IToolContext> DisconnectCommand { get; }
IRelayCommand<IToolContext> SelectAllCommand { get; }
IRelayCommand<IToolContext> DeselectAllCommand { get; }
void Cut(IToolContext context);
void Copy(IToolContext context);
void Paste(IToolContext context);
@ -32,4 +63,4 @@ public interface ISelection : IDirty
void Disconnect(IToolContext context);
void SelectAll(IToolContext context);
void DeselectAll(IToolContext context);
}
}

Просмотреть файл

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using CommunityToolkit.Mvvm.Input;
using Core2D.UI.Zoom.Input;
using Draw2D.ViewModels.Containers;
@ -7,6 +8,7 @@ namespace Draw2D.ViewModels.Tools;
public interface IToolContext : IInputTarget, IDisposable
{
IRelayCommand<string> SetToolCommand { get; }
IDocumentContainer DocumentContainer { get; set; }
IHitTest HitTest { get; set; }
IPathConverter PathConverter { get; set; }
@ -14,4 +16,4 @@ public interface IToolContext : IInputTarget, IDisposable
ITool CurrentTool { get; set; }
EditMode EditMode { get; set; }
void SetTool(string title);
}
}

Просмотреть файл

@ -2,13 +2,14 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using CommunityToolkit.Mvvm.Input;
using Core2D.UI.Zoom.Input;
using Draw2D.ViewModels.Containers;
namespace Draw2D.ViewModels.Tools;
[DataContract(IsReference = true)]
public class ToolContext : ViewModelBase, IToolContext
public partial class ToolContext : ViewModelBase, IToolContext
{
public static EditMode[] EditModeValues { get; } = (EditMode[])Enum.GetValues(typeof(EditMode));
@ -79,6 +80,7 @@ public class ToolContext : ViewModelBase, IToolContext
return string.Compare(tool.Title, title, StringComparison.OrdinalIgnoreCase) == 0;
}
[RelayCommand]
public void SetTool(string title)
{
if (CurrentTool is PathTool pathTool && !CompareToolTitle(pathTool.Settings.CurrentTool, title))
@ -151,4 +153,4 @@ public class ToolContext : ViewModelBase, IToolContext
return copy;
}
}
}

Просмотреть файл

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using CommunityToolkit.Mvvm.Input;
using Core2D.UI.Zoom.Input;
using Draw2D.ViewModels.Containers;
using Draw2D.ViewModels.Shapes;
@ -255,6 +256,7 @@ public partial class PathTool : IToolContext
private void SetContext(IToolContext context) => _context = context;
[RelayCommand]
public void SetTool(string title) => _context.SetTool(title);
public double GetWidth() => _context.GetWidth();
@ -487,4 +489,4 @@ public partial class PathTool : BaseTool, ITool
{
CleanInternal(context);
}
}
}

Просмотреть файл

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.Serialization;
using CommunityToolkit.Mvvm.Input;
using Core2D.UI.Zoom.Input;
using Draw2D.ViewModels.Containers;
using Draw2D.ViewModels.Shapes;
@ -11,7 +12,7 @@ using Spatial;
namespace Draw2D.ViewModels.Tools;
[DataContract(IsReference = true)]
public class SelectionTool : BaseTool, ITool, ISelection
public partial class SelectionTool : BaseTool, ITool, ISelection
{
private SelectionToolSettings _settings;
private RectangleShape _rectangle;
@ -422,12 +423,14 @@ public class SelectionTool : BaseTool, ITool, ISelection
CleanInternal(context);
}
[RelayCommand]
public void Cut(IToolContext context)
{
Copy(context);
DeleteOnlyAccepted(context);
}
[RelayCommand]
public void Copy(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -439,6 +442,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void Paste(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -460,6 +464,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
private void DeleteOnlyAccepted(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -478,6 +483,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void Delete(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -496,6 +502,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void Duplicate(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -519,6 +526,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void CreateGroup(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -564,6 +572,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void CreateReference(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -591,6 +600,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void CreatePath(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -636,6 +646,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void CreateStrokePath(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -682,6 +693,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void CreateFillPath(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -728,56 +740,67 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void StackHorizontally(IToolContext context)
{
Layout.Stack(context, StackMode.Horizontal);
}
[RelayCommand]
public void StackVertically(IToolContext context)
{
Layout.Stack(context, StackMode.Vertical);
}
[RelayCommand]
public void DistributeHorizontally(IToolContext context)
{
Layout.Distribute(context, DistributeMode.Horizontal);
}
[RelayCommand]
public void DistributeVertically(IToolContext context)
{
Layout.Distribute(context, DistributeMode.Vertical);
}
[RelayCommand]
public void AlignLeft(IToolContext context)
{
Layout.Align(context, AlignMode.Left);
}
[RelayCommand]
public void AlignCentered(IToolContext context)
{
Layout.Align(context, AlignMode.Centered);
}
[RelayCommand]
public void AlignRight(IToolContext context)
{
Layout.Align(context, AlignMode.Right);
}
[RelayCommand]
public void AlignTop(IToolContext context)
{
Layout.Align(context, AlignMode.Top);
}
[RelayCommand]
public void AlignCenter(IToolContext context)
{
Layout.Align(context, AlignMode.Center);
}
[RelayCommand]
public void AlignBottom(IToolContext context)
{
Layout.Align(context, AlignMode.Bottom);
}
[RelayCommand]
public void ArangeBringToFront(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -797,6 +820,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void ArangeBringForward(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -816,6 +840,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void ArangeSendBackward(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -835,6 +860,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void ArangeSendToBack(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -939,6 +965,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void Break(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -1057,6 +1084,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void Connect(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -1101,6 +1129,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void Disconnect(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -1133,6 +1162,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void SelectAll(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -1154,6 +1184,7 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
}
[RelayCommand]
public void DeselectAll(IToolContext context)
{
if (context.DocumentContainer?.ContainerView?.SelectionState != null)
@ -1493,4 +1524,4 @@ public class SelectionTool : BaseTool, ITool, ISelection
}
return false;
}
}
}

Просмотреть файл

@ -69,103 +69,103 @@
<Border Classes="zoom">
<Border Classes="clip" ClipToBounds="True" Background="Transparent" Focusable="True">
<Border.KeyBindings>
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.Cut}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.CutCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+X" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.Copy}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.CopyCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+C" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.Paste}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.PasteCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+V" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.Delete}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.DeleteCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Delete" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.Duplicate}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.DuplicateCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+D" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.CreateGroup}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.CreateGroupCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+G" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.CreateReference}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.CreateReferenceCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+R" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.CreatePath}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.CreatePathCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+H" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.CreateStrokePath}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.CreateStrokePathCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+J" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.CreateFillPath}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.CreateFillPathCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+K" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.DistributeHorizontally}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.DistributeHorizontallyCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+Shift+H" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.DistributeVertically}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.DistributeVerticallyCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+Shift+V" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignLeft}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignLeftCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+Shift+Left" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignCentered}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignCenteredCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+Shift+OemMinus" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignCentered}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignCenteredCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+Shift+Subtract" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignRight}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignRightCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+Shift+Right" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignTop}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignTopCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+Shift+Up" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignCenter}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignCenterCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+Shift+OemPipe" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignBottom}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.AlignBottomCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+Shift+Down" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.ArangeBringToFront}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.ArangeBringToFrontCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}"
Gesture="Ctrl+Shift+OemCloseBrackets" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.ArangeBringForward}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.ArangeBringForwardCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}"
Gesture="Ctrl+OemCloseBrackets" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.ArangeSendBackward}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.ArangeSendBackwardCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}"
Gesture="Ctrl+OemOpenBrackets" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.ArangeSendToBack}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.ArangeSendToBackCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}"
Gesture="Ctrl+Shift+OemOpenBrackets" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.Break}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.BreakCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+B" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.Connect}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.ConnectCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+OemComma" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.Disconnect}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.DisconnectCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+." />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.SelectAll}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.SelectAllCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+A" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.DeselectAll}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.DeselectAllCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Ctrl+Shift+A" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.DeselectAll}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.Selection.DeselectAllCommand}"
CommandParameter="{Binding $parent[UserControl].DataContext}" Gesture="Escape" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.PathOp}" CommandParameter="Difference"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.PathOpCommand}" CommandParameter="Difference"
Gesture="Ctrl+Shift+D" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.PathOp}" CommandParameter="Intersect"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.PathOpCommand}" CommandParameter="Intersect"
Gesture="Ctrl+Shift+I" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.PathOp}" CommandParameter="Union"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.PathOpCommand}" CommandParameter="Union"
Gesture="Ctrl+Shift+U" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.PathOp}" CommandParameter="Xor"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.PathOpCommand}" CommandParameter="Xor"
Gesture="Ctrl+Shift+X" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.PathOp}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.PathOpCommand}"
CommandParameter="ReverseDifference" Gesture="Ctrl+Shift+R" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetTool}" CommandParameter="None"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetToolCommand}" CommandParameter="None"
Gesture="N" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetTool}" CommandParameter="Selection"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetToolCommand}" CommandParameter="Selection"
Gesture="S" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetTool}" CommandParameter="Line"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetToolCommand}" CommandParameter="Line"
Gesture="L" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetTool}" CommandParameter="Point"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetToolCommand}" CommandParameter="Point"
Gesture="P" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetTool}" CommandParameter="CubicBezier"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetToolCommand}" CommandParameter="CubicBezier"
Gesture="B" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetTool}"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetToolCommand}"
CommandParameter="QuadraticBezier" Gesture="Q" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetTool}" CommandParameter="Path"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetToolCommand}" CommandParameter="Path"
Gesture="H" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetTool}" CommandParameter="Move"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetToolCommand}" CommandParameter="Move"
Gesture="M" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetTool}" CommandParameter="Rectangle"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetToolCommand}" CommandParameter="Rectangle"
Gesture="R" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetTool}" CommandParameter="Circle"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetToolCommand}" CommandParameter="Circle"
Gesture="C" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetTool}" CommandParameter="Arc"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetToolCommand}" CommandParameter="Arc"
Gesture="A" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetTool}" CommandParameter="Oval"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetToolCommand}" CommandParameter="Oval"
Gesture="O" />
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetTool}" CommandParameter="Text"
<KeyBinding Command="{Binding $parent[UserControl].DataContext.SetToolCommand}" CommandParameter="Text"
Gesture="T" />
</Border.KeyBindings>
<zc:ZoomControl InputTarget="{Binding $parent[UserControl].DataContext}"

Просмотреть файл

@ -11,12 +11,12 @@
d:DataContext="{x:Static app:App.ToolContext}"
d:DesignWidth="1320" d:DesignHeight="690">
<UserControl.KeyBindings>
<KeyBinding Command="{Binding NewContainerView}" CommandParameter="View" Gesture="Ctrl+N" />
<KeyBinding Command="{Binding OpenDocumentContainer}" Gesture="Ctrl+O" />
<KeyBinding Command="{Binding SaveDocumentContainerAs}" Gesture="Ctrl+S" />
<KeyBinding Command="{Binding ImportFile}" Gesture="Ctrl+I" />
<KeyBinding Command="{Binding ExportFile}" Gesture="Ctrl+E" />
<KeyBinding Command="{Binding Exit}" Gesture="Alt+F4" />
<KeyBinding Command="{Binding NewContainerViewCommand}" CommandParameter="View" Gesture="Ctrl+N" />
<KeyBinding Command="{Binding OpenDocumentContainerCommand}" Gesture="Ctrl+O" />
<KeyBinding Command="{Binding SaveDocumentContainerAsCommand}" Gesture="Ctrl+S" />
<KeyBinding Command="{Binding ImportFileCommand}" Gesture="Ctrl+I" />
<KeyBinding Command="{Binding ExportFileCommand}" Gesture="Ctrl+E" />
<KeyBinding Command="{Binding ExitCommand}" Gesture="Alt+F4" />
</UserControl.KeyBindings>
<Grid RowDefinitions="Auto,5,*,5" ColumnDefinitions="250,Auto,*,Auto,250">
<local:MenuView Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" />

Просмотреть файл

@ -15,163 +15,163 @@
</UserControl.Resources>
<Menu>
<MenuItem Header="_File">
<MenuItem Header="_New View" Command="{Binding NewContainerView}" CommandParameter="View" />
<MenuItem Header="_New View" Command="{Binding NewContainerViewCommand}" CommandParameter="View" />
<Separator />
<MenuItem Header="_Close View" Command="{Binding CloseContainerView}"
<MenuItem Header="_Close View" Command="{Binding CloseContainerViewCommand}"
CommandParameter="{Binding DocumentContainer.ContainerView, FallbackValue={x:Null}}" />
<Separator />
<MenuItem Header="_Open Document..." Command="{Binding OpenDocumentContainer}" />
<MenuItem Header="_Open Document..." Command="{Binding OpenDocumentContainerCommand}" />
<Separator />
<MenuItem Header="Save Document _As..." Command="{Binding SaveDocumentContainerAs}" />
<MenuItem Header="Save Document _As..." Command="{Binding SaveDocumentContainerAsCommand}" />
<Separator />
<MenuItem Header="S_tyles">
<MenuItem Header="_Open..." Command="{Binding OpenStyleLibrary}" />
<MenuItem Header="_Open..." Command="{Binding OpenStyleLibraryCommand}" />
<Separator />
<MenuItem Header="Save _As..." Command="{Binding SaveStyleLibraryAs}" />
<MenuItem Header="Save _As..." Command="{Binding SaveStyleLibraryAsCommand}" />
</MenuItem>
<Separator />
<MenuItem Header="_Groups">
<MenuItem Header="Open..." Command="{Binding OpenGroupLibrary}" />
<MenuItem Header="Open..." Command="{Binding OpenGroupLibraryCommand}" />
<Separator />
<MenuItem Header="Save _As..." Command="{Binding SaveGroupLibraryAs}" />
<MenuItem Header="Save _As..." Command="{Binding SaveGroupLibraryAsCommand}" />
</MenuItem>
<Separator />
<MenuItem Header="_Import..." Command="{Binding ImportFile}" />
<MenuItem Header="_Import..." Command="{Binding ImportFileCommand}" />
<Separator />
<MenuItem Header="_Export..." Command="{Binding ExportFile}" />
<MenuItem Header="_Export..." Command="{Binding ExportFileCommand}" />
<Separator />
<MenuItem Header="E_xit" Command="{Binding Exit}" />
<MenuItem Header="E_xit" Command="{Binding ExitCommand}" />
</MenuItem>
<MenuItem Header="_Edit">
<MenuItem Header="Cu_t" Command="{Binding Selection.Cut}" CommandParameter="{Binding}" />
<MenuItem Header="_Copy" Command="{Binding Selection.Copy}" CommandParameter="{Binding}" />
<MenuItem Header="_Paste" Command="{Binding Selection.Paste}" CommandParameter="{Binding}" />
<MenuItem Header="_Delete" Command="{Binding Selection.Delete}" CommandParameter="{Binding}" />
<MenuItem Header="Cu_t" Command="{Binding Selection.CutCommand}" CommandParameter="{Binding}" />
<MenuItem Header="_Copy" Command="{Binding Selection.CopyCommand}" CommandParameter="{Binding}" />
<MenuItem Header="_Paste" Command="{Binding Selection.PasteCommand}" CommandParameter="{Binding}" />
<MenuItem Header="_Delete" Command="{Binding Selection.DeleteCommand}" CommandParameter="{Binding}" />
<Separator />
<MenuItem Header="Copy _Special">
<MenuItem Header="_Svg">
<MenuItem Header="_Path Data" Command="{Binding CopySvgPathData}" />
<MenuItem Header="_Document" Command="{Binding CopySvgDocument}" />
<MenuItem Header="_Path Data" Command="{Binding CopySvgPathDataCommand}" />
<MenuItem Header="_Document" Command="{Binding CopySvgDocumentCommand}" />
</MenuItem>
<MenuItem Header="_Xaml">
<MenuItem Header="_Drawing" Command="{Binding CopyGeometryDrawing}" />
<MenuItem Header="_Group" Command="{Binding CopyDrawingGroup}" />
<MenuItem Header="_Presenter" Command="{Binding CopyDrawingPresenter}" />
<MenuItem Header="_Drawing" Command="{Binding CopyGeometryDrawingCommand}" />
<MenuItem Header="_Group" Command="{Binding CopyDrawingGroupCommand}" />
<MenuItem Header="_Presenter" Command="{Binding CopyDrawingPresenterCommand}" />
<Separator />
<MenuItem Header="P_ath" Command="{Binding CopyPath}" />
<MenuItem Header="_Canvas" Command="{Binding CopyCanvas}" />
<MenuItem Header="P_ath" Command="{Binding CopyPathCommand}" />
<MenuItem Header="_Canvas" Command="{Binding CopyCanvasCommand}" />
</MenuItem>
</MenuItem>
<MenuItem Header="Paste Sp_ecial">
<MenuItem Header="_Svg">
<MenuItem Header="Svg _Path Data" Command="{Binding PasteSvgPathData}" />
<MenuItem Header="Svg _Path Data" Command="{Binding PasteSvgPathDataCommand}" />
</MenuItem>
</MenuItem>
<Separator />
<MenuItem Header="Select _All" Command="{Binding Selection.SelectAll}" CommandParameter="{Binding}" />
<MenuItem Header="Deselect A_ll" Command="{Binding Selection.DeselectAll}" CommandParameter="{Binding}" />
<MenuItem Header="Select _All" Command="{Binding Selection.SelectAllCommand}" CommandParameter="{Binding}" />
<MenuItem Header="Deselect A_ll" Command="{Binding Selection.DeselectAllCommand}" CommandParameter="{Binding}" />
</MenuItem>
<MenuItem Header="_View">
<MenuItem Header="_Zoom">
<MenuItem Header="_Center" Command="{Binding DocumentContainer.ContainerView.ZoomService.CenterZoom}"
<MenuItem Header="_Center" Command="{Binding DocumentContainer.ContainerView.ZoomService.CenterZoomCommand}"
CommandParameter="True" />
<Separator />
<MenuItem Header="_Fill" Command="{Binding DocumentContainer.ContainerView.ZoomService.FillZoom}"
<MenuItem Header="_Fill" Command="{Binding DocumentContainer.ContainerView.ZoomService.FillZoomCommand}"
CommandParameter="True" />
<Separator />
<MenuItem Header="_Uniform" Command="{Binding DocumentContainer.ContainerView.ZoomService.UniformZoom}"
<MenuItem Header="_Uniform" Command="{Binding DocumentContainer.ContainerView.ZoomService.UniformZoomCommand}"
CommandParameter="True" />
<Separator />
<MenuItem Header="Uniform _To Fill"
Command="{Binding DocumentContainer.ContainerView.ZoomService.UniformToFillZoom}"
Command="{Binding DocumentContainer.ContainerView.ZoomService.UniformToFillZoomCommand}"
CommandParameter="True" />
</MenuItem>
</MenuItem>
<MenuItem Header="_Tool">
<MenuItem Header="_None" Command="{Binding SetTool}" CommandParameter="None" />
<MenuItem Header="_None" Command="{Binding SetToolCommand}" CommandParameter="None" />
<Separator />
<MenuItem Header="_Selection" Command="{Binding SetTool}" CommandParameter="Selection" />
<MenuItem Header="_Selection" Command="{Binding SetToolCommand}" CommandParameter="Selection" />
<Separator />
<MenuItem Header="_Point" Command="{Binding SetTool}" CommandParameter="Point" />
<MenuItem Header="_Point" Command="{Binding SetToolCommand}" CommandParameter="Point" />
<Separator />
<MenuItem Header="_Line" Command="{Binding SetTool}" CommandParameter="Line" />
<MenuItem Header="Pol_y Line" Command="{Binding SetTool}" CommandParameter="PolyLine" />
<MenuItem Header="Cubic _Bezier" Command="{Binding SetTool}" CommandParameter="CubicBezier" />
<MenuItem Header="_Quadratic Bezier" Command="{Binding SetTool}" CommandParameter="QuadraticBezier" />
<MenuItem Header="Con_ic" Command="{Binding SetTool}" CommandParameter="Conic" />
<MenuItem Header="_Line" Command="{Binding SetToolCommand}" CommandParameter="Line" />
<MenuItem Header="Pol_y Line" Command="{Binding SetToolCommand}" CommandParameter="PolyLine" />
<MenuItem Header="Cubic _Bezier" Command="{Binding SetToolCommand}" CommandParameter="CubicBezier" />
<MenuItem Header="_Quadratic Bezier" Command="{Binding SetToolCommand}" CommandParameter="QuadraticBezier" />
<MenuItem Header="Con_ic" Command="{Binding SetToolCommand}" CommandParameter="Conic" />
<Separator />
<MenuItem Header="Pat_h" Command="{Binding SetTool}" CommandParameter="Path" />
<MenuItem Header="Pat_h" Command="{Binding SetToolCommand}" CommandParameter="Path" />
<MenuItem Header="Path T_ools"
IsEnabled="{Binding CurrentTool.Title, Converter={StaticResource IsEqualStringConverter}, ConverterParameter=Path, Mode=OneWay}">
<MenuItem Header="_Line" Command="{Binding SetTool}" CommandParameter="Line" />
<MenuItem Header="Cubic _Bezier" Command="{Binding SetTool}" CommandParameter="CubicBezier" />
<MenuItem Header="_Quadratic Bezier" Command="{Binding SetTool}" CommandParameter="QuadraticBezier" />
<MenuItem Header="Con_ic" Command="{Binding SetTool}" CommandParameter="Conic" />
<MenuItem Header="_Move" Command="{Binding SetTool}" CommandParameter="Move" />
<MenuItem Header="_Line" Command="{Binding SetToolCommand}" CommandParameter="Line" />
<MenuItem Header="Cubic _Bezier" Command="{Binding SetToolCommand}" CommandParameter="CubicBezier" />
<MenuItem Header="_Quadratic Bezier" Command="{Binding SetToolCommand}" CommandParameter="QuadraticBezier" />
<MenuItem Header="Con_ic" Command="{Binding SetToolCommand}" CommandParameter="Conic" />
<MenuItem Header="_Move" Command="{Binding SetToolCommand}" CommandParameter="Move" />
</MenuItem>
<Separator />
<MenuItem Header="Scr_ibble" Command="{Binding SetTool}" CommandParameter="Scribble" />
<MenuItem Header="Scr_ibble" Command="{Binding SetToolCommand}" CommandParameter="Scribble" />
<Separator />
<MenuItem Header="_Rectangle" Command="{Binding SetTool}" CommandParameter="Rectangle" />
<MenuItem Header="_Circle" Command="{Binding SetTool}" CommandParameter="Circle" />
<MenuItem Header="_Arc" Command="{Binding SetTool}" CommandParameter="Arc" />
<MenuItem Header="O_val" Command="{Binding SetTool}" CommandParameter="Oval" />
<MenuItem Header="_Rectangle" Command="{Binding SetToolCommand}" CommandParameter="Rectangle" />
<MenuItem Header="_Circle" Command="{Binding SetToolCommand}" CommandParameter="Circle" />
<MenuItem Header="_Arc" Command="{Binding SetToolCommand}" CommandParameter="Arc" />
<MenuItem Header="O_val" Command="{Binding SetToolCommand}" CommandParameter="Oval" />
<Separator />
<MenuItem Header="_Text" Command="{Binding SetTool}" CommandParameter="Text" />
<MenuItem Header="_Text" Command="{Binding SetToolCommand}" CommandParameter="Text" />
</MenuItem>
<MenuItem Header="_Shape">
<MenuItem Header="Du_plicate" Command="{Binding Selection.Duplicate}" CommandParameter="{Binding}" />
<MenuItem Header="Du_plicate" Command="{Binding Selection.DuplicateCommand}" CommandParameter="{Binding}" />
<Separator />
<MenuItem Header="Create _Group" Command="{Binding Selection.CreateGroup}" CommandParameter="{Binding}" />
<MenuItem Header="Create _Group" Command="{Binding Selection.CreateGroupCommand}" CommandParameter="{Binding}" />
<Separator />
<MenuItem Header="Create R_eference" Command="{Binding Selection.CreateReference}" CommandParameter="{Binding}" />
<MenuItem Header="Create R_eference" Command="{Binding Selection.CreateReferenceCommand}" CommandParameter="{Binding}" />
<Separator />
<MenuItem Header="Create Pat_h" Command="{Binding Selection.CreatePath}" CommandParameter="{Binding}" />
<MenuItem Header="Create Str_oke Path" Command="{Binding Selection.CreateStrokePath}"
<MenuItem Header="Create Pat_h" Command="{Binding Selection.CreatePathCommand}" CommandParameter="{Binding}" />
<MenuItem Header="Create Str_oke Path" Command="{Binding Selection.CreateStrokePathCommand}"
CommandParameter="{Binding}" />
<MenuItem Header="Create _Fill Path" Command="{Binding Selection.CreateFillPath}" CommandParameter="{Binding}" />
<MenuItem Header="Create _Fill Path" Command="{Binding Selection.CreateFillPathCommand}" CommandParameter="{Binding}" />
<Separator />
<MenuItem Header="Stac_k">
<MenuItem Header="_Horizontally" Command="{Binding Selection.StackHorizontally}" CommandParameter="{Binding}" />
<MenuItem Header="_Vertically" Command="{Binding Selection.StackVertically}" CommandParameter="{Binding}" />
<MenuItem Header="_Horizontally" Command="{Binding Selection.StackHorizontallyCommand}" CommandParameter="{Binding}" />
<MenuItem Header="_Vertically" Command="{Binding Selection.StackVerticallyCommand}" CommandParameter="{Binding}" />
</MenuItem>
<MenuItem Header="Dis_tribute">
<MenuItem Header="_Horizontally" Command="{Binding Selection.DistributeHorizontally}"
<MenuItem Header="_Horizontally" Command="{Binding Selection.DistributeHorizontallyCommand}"
CommandParameter="{Binding}" />
<MenuItem Header="_Vertically" Command="{Binding Selection.DistributeVertically}" CommandParameter="{Binding}" />
<MenuItem Header="_Vertically" Command="{Binding Selection.DistributeVerticallyCommand}" CommandParameter="{Binding}" />
</MenuItem>
<MenuItem Header="Alig_n">
<MenuItem Header="_Left" Command="{Binding Selection.AlignLeft}" CommandParameter="{Binding}" />
<MenuItem Header="_Centered" Command="{Binding Selection.AlignCentered}" CommandParameter="{Binding}" />
<MenuItem Header="_Right" Command="{Binding Selection.AlignRight}" CommandParameter="{Binding}" />
<MenuItem Header="_Left" Command="{Binding Selection.AlignLeftCommand}" CommandParameter="{Binding}" />
<MenuItem Header="_Centered" Command="{Binding Selection.AlignCenteredCommand}" CommandParameter="{Binding}" />
<MenuItem Header="_Right" Command="{Binding Selection.AlignRightCommand}" CommandParameter="{Binding}" />
<Separator />
<MenuItem Header="_Top" Command="{Binding Selection.AlignTop}" CommandParameter="{Binding}" />
<MenuItem Header="C_enter" Command="{Binding Selection.AlignCenter}" CommandParameter="{Binding}" />
<MenuItem Header="_Bottom" Command="{Binding Selection.AlignBottom}" CommandParameter="{Binding}" />
<MenuItem Header="_Top" Command="{Binding Selection.AlignTopCommand}" CommandParameter="{Binding}" />
<MenuItem Header="C_enter" Command="{Binding Selection.AlignCenterCommand}" CommandParameter="{Binding}" />
<MenuItem Header="_Bottom" Command="{Binding Selection.AlignBottomCommand}" CommandParameter="{Binding}" />
</MenuItem>
<MenuItem Header="_Arange">
<MenuItem Header="_Bring to Front" Command="{Binding Selection.ArangeBringToFront}"
<MenuItem Header="_Bring to Front" Command="{Binding Selection.ArangeBringToFrontCommand}"
CommandParameter="{Binding}" />
<MenuItem Header="Bring _Forward" Command="{Binding Selection.ArangeBringForward}" CommandParameter="{Binding}" />
<MenuItem Header="Send Back_ward" Command="{Binding Selection.ArangeSendBackward}" CommandParameter="{Binding}" />
<MenuItem Header="_Send to Back" Command="{Binding Selection.ArangeSendToBack}" CommandParameter="{Binding}" />
<MenuItem Header="Bring _Forward" Command="{Binding Selection.ArangeBringForwardCommand}" CommandParameter="{Binding}" />
<MenuItem Header="Send Back_ward" Command="{Binding Selection.ArangeSendBackwardCommand}" CommandParameter="{Binding}" />
<MenuItem Header="_Send to Back" Command="{Binding Selection.ArangeSendToBackCommand}" CommandParameter="{Binding}" />
</MenuItem>
<Separator />
<MenuItem Header="_Difference" ToolTip.Tip="Subtract the op path from the current path."
Command="{Binding PathOp}" CommandParameter="Difference" />
<MenuItem Header="_Intersect" ToolTip.Tip="Intersect the two paths." Command="{Binding PathOp}"
Command="{Binding PathOpCommand}" CommandParameter="Difference" />
<MenuItem Header="_Intersect" ToolTip.Tip="Intersect the two paths." Command="{Binding PathOpCommand}"
CommandParameter="Intersect" />
<MenuItem Header="_Union" ToolTip.Tip="Union (inclusive-or) the two paths." Command="{Binding PathOp}"
<MenuItem Header="_Union" ToolTip.Tip="Union (inclusive-or) the two paths." Command="{Binding PathOpCommand}"
CommandParameter="Union" />
<MenuItem Header="_Xor" ToolTip.Tip="Exclusive-or the two paths." Command="{Binding PathOp}"
<MenuItem Header="_Xor" ToolTip.Tip="Exclusive-or the two paths." Command="{Binding PathOpCommand}"
CommandParameter="Xor" />
<MenuItem Header="_Reverse Difference" ToolTip.Tip="Subtract the current path from the op path."
Command="{Binding PathOp}" CommandParameter="ReverseDifference" />
Command="{Binding PathOpCommand}" CommandParameter="ReverseDifference" />
<Separator />
<MenuItem Header="_Break" Command="{Binding Selection.Break}" CommandParameter="{Binding}" />
<MenuItem Header="_Break" Command="{Binding Selection.BreakCommand}" CommandParameter="{Binding}" />
<Separator />
<MenuItem Header="_Connect" Command="{Binding Selection.Connect}" CommandParameter="{Binding}" />
<MenuItem Header="Di_sconnect" Command="{Binding Selection.Disconnect}" CommandParameter="{Binding}" />
<MenuItem Header="_Connect" Command="{Binding Selection.ConnectCommand}" CommandParameter="{Binding}" />
<MenuItem Header="Di_sconnect" Command="{Binding Selection.DisconnectCommand}" CommandParameter="{Binding}" />
</MenuItem>
</Menu>
</UserControl>

Просмотреть файл

@ -1,8 +1,15 @@

using CommunityToolkit.Mvvm.Input;
namespace Core2D.UI.Zoom.Input;
public interface IZoomService
{
IRelayCommand<bool> ResetZoomCommand { get; }
IRelayCommand<bool> CenterZoomCommand { get; }
IRelayCommand<bool> FillZoomCommand { get; }
IRelayCommand<bool> UniformZoomCommand { get; }
IRelayCommand<bool> UniformToFillZoomCommand { get; }
IZoomServiceState ZoomServiceState { get; set; }
void Wheel(double delta, double x, double y);
void Pressed(double x, double y);
@ -23,4 +30,4 @@ public interface IZoomService
void FillZoom(bool redraw);
void UniformZoom(bool redraw);
void UniformToFillZoom(bool redraw);
}
}

Просмотреть файл

@ -7,11 +7,12 @@ using Avalonia.Input;
using Avalonia.Media;
using Avalonia.Rendering;
using Avalonia.VisualTree;
using CommunityToolkit.Mvvm.Input;
using Core2D.UI.Zoom.Input;
namespace Core2D.UI.Zoom;
public class ZoomControl : Control, IInputService, IZoomService
public partial class ZoomControl : Control, IInputService, IZoomService
{
private IZoomServiceState _zoomServiceState;
private IInputTarget _inputTarget;
@ -468,6 +469,7 @@ public class ZoomControl : Control, IInputService, IZoomService
}
}
[RelayCommand]
public void ResetZoom(bool redraw)
{
if (_zoomServiceState != null && _inputTarget != null)
@ -477,6 +479,7 @@ public class ZoomControl : Control, IInputService, IZoomService
}
}
[RelayCommand]
public void CenterZoom(bool redraw)
{
if (_zoomServiceState != null && _inputTarget != null)
@ -486,6 +489,7 @@ public class ZoomControl : Control, IInputService, IZoomService
}
}
[RelayCommand]
public void FillZoom(bool redraw)
{
if (_zoomServiceState != null && _inputTarget != null)
@ -495,6 +499,7 @@ public class ZoomControl : Control, IInputService, IZoomService
}
}
[RelayCommand]
public void UniformZoom(bool redraw)
{
if (_zoomServiceState != null && _inputTarget != null)
@ -504,6 +509,7 @@ public class ZoomControl : Control, IInputService, IZoomService
}
}
[RelayCommand]
public void UniformToFillZoom(bool redraw)
{
if (_zoomServiceState != null && _inputTarget != null)