├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml ├── stale.yml └── workflows │ └── build.yml ├── .gitignore ├── Core2D.sln ├── Directory.Build.props ├── Directory.Packages.props ├── LICENSE.TXT ├── NuGet.Config ├── README.md ├── global.json └── src ├── Core2D.Generators ├── AutoNotifyGenerator.cs └── Core2D.Generators.csproj └── Core2D ├── App.axaml ├── App.axaml.cs ├── AppModule.cs ├── AppState.cs ├── Assets ├── Core2D.ico └── Fonts │ └── RobotoMono-Regular.ttf ├── Behaviors ├── AttachEditor.cs ├── AttachEditorBehavior.cs ├── CancelContextMenuBehavior.cs └── DragAndDrop │ ├── DefaultDropHandler.cs │ ├── EditorDropHandler.cs │ ├── GroupsListBoxDropHandler.cs │ ├── ListBoxDropHandler.cs │ ├── PageDropHandler.cs │ ├── ScriptsListBoxDropHandler.cs │ ├── StylesListBoxDropHandler.cs │ ├── TemplatesListBoxDropHandler.cs │ └── TreeViewDropHandler.cs ├── Configuration └── Windows │ ├── WindowConfiguration.cs │ └── WindowConfigurationFactory.cs ├── Controls ├── Dialog │ ├── DialogPresenterView.axaml │ ├── DialogPresenterView.axaml.cs │ ├── DialogView.axaml │ └── DialogView.axaml.cs ├── EditableItem.axaml ├── EditableItem.axaml.cs ├── Editor │ ├── MenuView.axaml │ ├── MenuView.axaml.cs │ ├── PageView.axaml │ ├── PageView.axaml.cs │ ├── ToolsView.axaml │ └── ToolsView.axaml.cs ├── ToggleItem.axaml └── ToggleItem.axaml.cs ├── Converters ├── ArgbColorToBrushConverter.cs ├── BaseShapeIconConverter.cs ├── ContainerToTypeStringConverter.cs ├── EditorToTitleMultiConverter.cs ├── FontStyleFlagsConverter.cs ├── HexToColorConverter.cs ├── IsCurrentToolConverter.cs ├── IsGroupConverter.cs ├── ObjectEqualityMultiConverter.cs ├── SelectedShapesFirstItemStyleValueConverter.cs ├── SelectedShapesFirstItemValueConverter.cs ├── SelectedShapesHasItemsValueConverter.cs ├── SelectedShapesIsEmptyValueConverter.cs ├── ShapeStateFlagsConverter.cs ├── ShapeToTypeStringConverter.cs ├── ToolIconConverter.cs ├── UInt32ToColorConverter.cs └── ViewModelToTypeStringConverter.cs ├── Core2D.csproj ├── Editor ├── AvaloniaEditorCanvasPlatform.cs ├── AvaloniaImageImporter.cs ├── AvaloniaInputSource.cs ├── AvaloniaProjectEditorPlatform.cs └── AvaloniaTextClipboard.cs ├── Json └── ListContractResolver.cs ├── Model ├── Editor │ ├── IBounds.cs │ ├── IDialogPresenter.cs │ ├── IEditorCanvasPlatform.cs │ ├── IEditorTool.cs │ ├── IHitTest.cs │ ├── IPathTool.cs │ ├── IProjectEditorPlatform.cs │ ├── IShapeEditor.cs │ ├── ITool.cs │ └── MoveMode.cs ├── History │ └── IHistory.cs ├── IConnectable.cs ├── IContainerFactory.cs ├── IDataObject.cs ├── IDrawable.cs ├── IFileSystem.cs ├── IFileWriter.cs ├── IImageImporter.cs ├── IJsonSerializer.cs ├── ILog.cs ├── IMetafileExporter.cs ├── IPathConverter.cs ├── IPickerItem.cs ├── IProjectExporter.cs ├── IScriptRunner.cs ├── ISelectable.cs ├── ISelection.cs ├── IShapeFactory.cs ├── IStringExporter.cs ├── ISvgConverter.cs ├── ISvgExporter.cs ├── ITextClipboard.cs ├── ITextFieldReader.cs ├── ITextFieldWriter.cs ├── IViewModelFactory.cs ├── IXamlExporter.cs ├── Input │ ├── InputArgs.cs │ ├── InputArgsObserver.cs │ ├── InputProcessor.cs │ ├── InputSource.cs │ ├── InputTarget.cs │ └── ModifierFlags.cs ├── Path │ ├── FillRule.cs │ └── SweepDirection.cs ├── Renderer │ ├── ICache.cs │ ├── IContainerPresenter.cs │ ├── IDecorator.cs │ ├── IGrid.cs │ ├── IImageCache.cs │ ├── IImageKey.cs │ ├── IShapeRenderer.cs │ ├── Nodes │ │ ├── IArcDrawNode.cs │ │ ├── ICubicBezierDrawNode.cs │ │ ├── IDrawNode.cs │ │ ├── IDrawNodeFactory.cs │ │ ├── IEllipseDrawNode.cs │ │ ├── IFillDrawNode.cs │ │ ├── IGridDrawNode.cs │ │ ├── IImageDrawNode.cs │ │ ├── ILineDrawNode.cs │ │ ├── IMarker.cs │ │ ├── IPathDrawNode.cs │ │ ├── IPointDrawNode.cs │ │ ├── IQuadraticBezierDrawNode.cs │ │ ├── IRectangleDrawNode.cs │ │ └── ITextDrawNode.cs │ ├── PathOp.cs │ └── ShapeStateFlags.cs └── Style │ ├── ArrowType.cs │ ├── Colors.cs │ ├── FontStyleFlags.cs │ ├── LineCap.cs │ ├── TextHAlignment.cs │ └── TextVAlignment.cs ├── Modules ├── FileSystem │ └── DotNet │ │ └── DotNetFileSystem.cs ├── FileWriter │ ├── Dxf │ │ └── DxfWriter.cs │ ├── Emf │ │ └── EmfWriter.cs │ ├── PdfSharp │ │ └── PdfSharpWriter.cs │ ├── SkiaSharp │ │ ├── JpegSkiaSharpExporter.cs │ │ ├── JpegSkiaSharpWriter.cs │ │ ├── PdfSkiaSharpExporter.cs │ │ ├── PdfSkiaSharpWriter.cs │ │ ├── PngSkiaSharpExporter.cs │ │ ├── PngSkiaSharpWriter.cs │ │ ├── SkpSkiaSharpExporter.cs │ │ ├── SkpSkiaSharpWriter.cs │ │ ├── SvgSkiaSharpExporter.cs │ │ ├── SvgSkiaSharpWriter.cs │ │ ├── WebpSkiaSharpExporter.cs │ │ └── WebpSkiaSharpWriter.cs │ ├── Svg │ │ └── SvgSvgWriter.cs │ └── Xaml │ │ └── DrawingGroupXamlWriter.cs ├── Log │ └── Trace │ │ └── TraceLog.cs ├── Renderer │ ├── Avalonia │ │ ├── AvaloniaDrawNodeFactory.cs │ │ ├── AvaloniaDrawUtil.cs │ │ ├── AvaloniaRendererViewModel.cs │ │ ├── Nodes │ │ │ ├── ArcDrawNode.cs │ │ │ ├── CubicBezierDrawNode.cs │ │ │ ├── DrawNode.cs │ │ │ ├── EllipseDrawNode.cs │ │ │ ├── FillDrawNode.cs │ │ │ ├── GridDrawNode.cs │ │ │ ├── ImageDrawNode.cs │ │ │ ├── LineDrawNode.cs │ │ │ ├── Markers │ │ │ │ ├── ArrowMarker.cs │ │ │ │ ├── EllipseMarker.cs │ │ │ │ ├── MarkerBase.cs │ │ │ │ ├── NoneMarker.cs │ │ │ │ └── RectangleMarker.cs │ │ │ ├── PathDrawNode.cs │ │ │ ├── PointDrawNode.cs │ │ │ ├── QuadraticBezierDrawNode.cs │ │ │ ├── RectangleDrawNode.cs │ │ │ └── TextDrawNode.cs │ │ └── PathGeometryConverter.cs │ ├── Dxf │ │ ├── DxfRenderer.IProjectExporter.cs │ │ └── DxfRenderer.cs │ ├── PdfSharp │ │ ├── PathGeometryConverter.cs │ │ ├── PdfSharpRenderer.IProjectExporter.cs │ │ └── PdfSharpRenderer.cs │ ├── SkiaSharp │ │ ├── MatrixHelper.cs │ │ ├── Nodes │ │ │ ├── ArcDrawNode.cs │ │ │ ├── CubicBezierDrawNode.cs │ │ │ ├── DrawNode.cs │ │ │ ├── EllipseDrawNode.cs │ │ │ ├── FillDrawNode.cs │ │ │ ├── GridDrawNode.cs │ │ │ ├── ImageDrawNode.cs │ │ │ ├── LineDrawNode.cs │ │ │ ├── Markers │ │ │ │ ├── ArrowMarker.cs │ │ │ │ ├── EllipseMarker.cs │ │ │ │ ├── MarkerBase.cs │ │ │ │ ├── NoneMarker.cs │ │ │ │ └── RectangleMarker.cs │ │ │ ├── PathDrawNode.cs │ │ │ ├── PointDrawNode.cs │ │ │ ├── QuadraticBezierDrawNode.cs │ │ │ ├── RectangleDrawNode.cs │ │ │ └── TextDrawNode.cs │ │ ├── PathGeometryConverter.cs │ │ ├── SkiaSharpDrawNodeFactory.cs │ │ ├── SkiaSharpDrawUtil.cs │ │ ├── SkiaSharpPathConverter.cs │ │ ├── SkiaSharpRendererViewModel.cs │ │ └── SkiaSharpSvgConverter.cs │ └── WinForms │ │ ├── PathGeometryConverter.cs │ │ └── WinFormsRenderer.cs ├── ScriptRunner │ └── Roslyn │ │ └── RoslynScriptRunner.cs ├── Serializer │ └── Newtonsoft │ │ ├── NewtonsoftJsonSerializer.cs │ │ └── ProjectContractResolver.cs ├── ServiceProvider │ └── Autofac │ │ └── AutofacServiceProvider.cs ├── SvgExporter │ └── Svg │ │ └── SvgSvgExporter.cs ├── TextFieldReader │ ├── CsvHelper │ │ └── CsvHelperReader.cs │ └── OpenXml │ │ └── OpenXmlReader.cs ├── TextFieldWriter │ ├── CsvHelper │ │ └── CsvHelperWriter.cs │ └── OpenXml │ │ └── OpenXmlWriter.cs └── XamlExporter │ └── Avalonia │ └── DrawingGroupXamlExporter.cs ├── Program.cs ├── Services └── StorageService.cs ├── Settings.cs ├── Spatial ├── Arc │ ├── GdiArc.cs │ └── WpfArc.cs ├── ConvexHull │ └── MonotoneChain.cs ├── DouglasPeucker │ └── RDP.cs ├── Line2.cs ├── Matrix2.cs ├── MatrixD.cs ├── Point2.cs ├── PointD.cs ├── Polygon2.cs ├── Rect2.cs ├── Sat │ ├── MinimumTranslationVector.cs │ ├── Projection.cs │ └── SeparatingAxisTheorem.cs ├── Size2.cs └── Vector2.cs ├── Styles ├── Common.axaml ├── Dock.axaml ├── Geometry.axaml └── Icons.axaml ├── Themes └── Themes.axaml ├── Util └── Utilities.cs ├── ViewLocator.cs ├── ViewModels ├── Containers │ ├── BaseContainerViewModel.cs │ ├── DocumentContainerViewModel.cs │ ├── FrameContainerViewModel.cs │ ├── LayerContainerViewModel.cs │ ├── LibraryViewModel.cs │ ├── OptionsViewModel.cs │ ├── PageContainerViewModel.cs │ ├── ProjectContainerViewModel.Commands.cs │ ├── ProjectContainerViewModel.IImageCache.cs │ ├── ProjectContainerViewModel.cs │ ├── ProjectContainerViewModelExtensions.cs │ └── TemplateContainerViewModel.cs ├── CopyExtensions.cs ├── Data │ ├── Bindings │ │ ├── BindingParser.cs │ │ ├── BindingPart.cs │ │ └── TextBinding.cs │ ├── ColumnViewModel.cs │ ├── DataFlow.cs │ ├── DatabaseExtensions.cs │ ├── DatabaseViewModel.cs │ ├── PropertyViewModel.cs │ ├── RecordViewModel.cs │ └── ValueViewModel.cs ├── Designer │ └── DesignerContext.cs ├── Docking │ ├── DockFactory.cs │ ├── Docks │ │ └── PageDocumentDock.cs │ ├── Documents │ │ └── PageViewModel.cs │ ├── Tools │ │ ├── Libraries │ │ │ ├── DatabaseLibraryViewModel.cs │ │ │ ├── GroupLibraryViewModel.cs │ │ │ ├── ScriptLibraryViewModel.cs │ │ │ ├── StyleLibraryViewModel.cs │ │ │ └── TemplateLibraryViewModel.cs │ │ ├── ObjectBrowserViewModel.cs │ │ ├── Options │ │ │ ├── ImageOptionsViewModel.cs │ │ │ ├── ProjectOptionsViewModel.cs │ │ │ ├── RendererOptionsViewModel.cs │ │ │ └── ZoomOptionsViewModel.cs │ │ ├── ProjectExplorerViewModel.cs │ │ └── Properties │ │ │ ├── DataPropertiesViewModel.cs │ │ │ ├── PagePropertiesViewModel.cs │ │ │ ├── ShapePropertiesViewModel.cs │ │ │ ├── StatePropertiesViewModel.cs │ │ │ └── StylePropertiesViewModel.cs │ └── Views │ │ ├── DashboardMenuViewModel.cs │ │ ├── DashboardViewModel.cs │ │ ├── HomeMenuViewModel.cs │ │ ├── HomeStatusBarViewModel.cs │ │ └── HomeViewModel.cs ├── Editor │ ├── AboutInfoViewModel.cs │ ├── Bounds │ │ ├── HitTest.cs │ │ ├── HitTestHelper.cs │ │ └── Shapes │ │ │ ├── ArcBounds.cs │ │ │ ├── CubicBezierBounds.cs │ │ │ ├── EllipseBounds.cs │ │ │ ├── GroupBounds.cs │ │ │ ├── ImageBounds.cs │ │ │ ├── LineBounds.cs │ │ │ ├── PathBounds.cs │ │ │ ├── PointBounds.cs │ │ │ ├── QuadraticBezierBounds.cs │ │ │ ├── RectangleBounds.cs │ │ │ └── TextBounds.cs │ ├── DialogViewModel.cs │ ├── Factories │ │ ├── ContainerFactory.cs │ │ └── ShapeFactory.cs │ ├── History │ │ ├── StackHistory.cs │ │ └── UndoRedo.cs │ ├── IClipboardService.cs │ ├── ISelectionService.cs │ ├── IShapeService.cs │ ├── ProjectEditorConfiguration.cs │ ├── ProjectEditorInputTarget.cs │ ├── ProjectEditorViewModel.Clipboard.cs │ ├── ProjectEditorViewModel.Editor.cs │ ├── ProjectEditorViewModel.Properties.cs │ ├── ProjectEditorViewModel.Selection.cs │ ├── ProjectEditorViewModel.Shape.cs │ ├── ProjectEditorViewModel.Tool.cs │ ├── ProjectEditorViewModel.cs │ ├── ProjectExtensions.cs │ ├── ShapeEditor.cs │ ├── StyleEditorViewModel.cs │ └── Tools │ │ ├── ArcToolViewModel.cs │ │ ├── CubicBezierToolViewModel.cs │ │ ├── Decorators │ │ └── BoxDecoratorViewModel.cs │ │ ├── EllipseToolViewModel.cs │ │ ├── ImageToolViewModel.cs │ │ ├── LineToolViewModel.cs │ │ ├── NoneToolViewModel.cs │ │ ├── Path │ │ ├── ArcPathToolViewModel.cs │ │ ├── CubicBezierPathToolViewModel.cs │ │ ├── LinePathToolViewModel.cs │ │ ├── MovePathToolViewModel.cs │ │ └── QuadraticBezierPathToolViewModel.cs │ │ ├── PathToolViewModel.cs │ │ ├── PointToolViewModel.cs │ │ ├── QuadraticBezierToolViewModel.cs │ │ ├── RectangleToolViewModel.cs │ │ ├── Selection │ │ ├── ArcSelection.cs │ │ ├── BezierSelectionSelection.cs │ │ ├── EllipseSelection.cs │ │ ├── ImageSelection.cs │ │ ├── LineSelection.cs │ │ ├── PathSelection.cs │ │ ├── PointSelection.cs │ │ ├── QuadraticBezierSelection.cs │ │ ├── RectangleSelection.cs │ │ └── TextSelection.cs │ │ ├── SelectionToolViewModel.cs │ │ └── TextToolViewModel.cs ├── Editors │ └── TextBindingEditorViewModel.cs ├── Layout │ ├── AlignMode.cs │ ├── Box.cs │ ├── BoxLayout.cs │ ├── DistributeMode.cs │ ├── FlipMode.cs │ ├── GroupBox.cs │ ├── PointUtil.cs │ ├── ShapeBox.cs │ └── StackMode.cs ├── Path │ ├── GeometryContext.cs │ ├── PathFigureViewModel.cs │ ├── PathSegmentViewModel.cs │ ├── PathSizeViewModel.cs │ └── Segments │ │ ├── ArcSegmentViewModel.cs │ │ ├── CubicBezierSegmentViewModel.cs │ │ ├── LineSegmentViewModel.cs │ │ └── QuadraticBezierSegmentViewModel.cs ├── Renderer │ ├── Cache.cs │ ├── ImageKeyViewModel.cs │ ├── NodeRendererViewModel.cs │ ├── Presenters │ │ ├── EditorPresenter.cs │ │ ├── ExportPresenter.cs │ │ └── TemplatePresenter.cs │ └── ShapeRendererStateViewModel.cs ├── Scripting │ └── ScriptViewModel.cs ├── ServiceProviderExtensions.cs ├── Shapes │ ├── ArcShapeViewModel.cs │ ├── BaseShapeViewModel.cs │ ├── BaseShapeViewModelExtensions.cs │ ├── ConnectableShapeExtensions.cs │ ├── ConnectableShapeViewModel.cs │ ├── CubicBezierShapeViewModel.cs │ ├── EllipseShapeViewModel.cs │ ├── GroupShapeExtensions.cs │ ├── GroupShapeViewModel.cs │ ├── ImageShapeViewModel.cs │ ├── LineShapeViewModel.cs │ ├── PathShapeViewModel.cs │ ├── PointShapeExtensions.cs │ ├── PointShapeViewModel.cs │ ├── QuadraticBezierShapeViewModel.cs │ ├── RectangleShapeViewModel.cs │ └── TextShapeViewModel.cs ├── Style │ ├── ArgbColorViewModelViewModel.cs │ ├── ArrowStyleViewModel.cs │ ├── BaseColorViewModel.cs │ ├── FillStyleViewModel.cs │ ├── ShapeStyleViewModel.cs │ ├── StrokeStyleViewModel.cs │ ├── StyleHelper.cs │ └── TextStyleViewModel.cs ├── ViewModelBase.cs └── ViewModelFactory.cs └── Views ├── Containers ├── DocumentContainerView.axaml ├── DocumentContainerView.axaml.cs ├── LayerContainerView.axaml ├── LayerContainerView.axaml.cs ├── OptionsView.axaml ├── OptionsView.axaml.cs ├── PageContainerView.axaml ├── PageContainerView.axaml.cs ├── ProjectContainerView.axaml ├── ProjectContainerView.axaml.cs ├── TemplateContainerView.axaml └── TemplateContainerView.axaml.cs ├── Data ├── DataObjectView.axaml ├── DataObjectView.axaml.cs ├── DatabaseView.axaml ├── DatabaseView.axaml.cs ├── RecordView.axaml └── RecordView.axaml.cs ├── Docking ├── Documents │ ├── PageView.axaml │ └── PageView.axaml.cs ├── Tools │ ├── Libraries │ │ ├── DatabaseLibraryView.axaml │ │ ├── DatabaseLibraryView.axaml.cs │ │ ├── GroupLibraryView.axaml │ │ ├── GroupLibraryView.axaml.cs │ │ ├── ScriptLibraryView.axaml │ │ ├── ScriptLibraryView.axaml.cs │ │ ├── StyleLibraryView.axaml │ │ ├── StyleLibraryView.axaml.cs │ │ ├── TemplateLibraryView.axaml │ │ └── TemplateLibraryView.axaml.cs │ ├── ObjectBrowserView.axaml │ ├── ObjectBrowserView.axaml.cs │ ├── Options │ │ ├── ImageOptionsView.axaml │ │ ├── ImageOptionsView.axaml.cs │ │ ├── ProjectOptionsView.axaml │ │ ├── ProjectOptionsView.axaml.cs │ │ ├── RendererOptionsView.axaml │ │ ├── RendererOptionsView.axaml.cs │ │ ├── ZoomOptionsView.axaml │ │ └── ZoomOptionsView.axaml.cs │ ├── ProjectExplorerView.axaml │ ├── ProjectExplorerView.axaml.cs │ └── Properties │ │ ├── DataPropertiesView.axaml │ │ ├── DataPropertiesView.axaml.cs │ │ ├── PagePropertiesView.axaml │ │ ├── PagePropertiesView.axaml.cs │ │ ├── ShapePropertiesView.axaml │ │ ├── ShapePropertiesView.axaml.cs │ │ ├── StatePropertiesView.axaml │ │ ├── StatePropertiesView.axaml.cs │ │ ├── StylePropertiesView.axaml │ │ └── StylePropertiesView.axaml.cs └── Views │ ├── DashboardMenuView.axaml │ ├── DashboardMenuView.axaml.cs │ ├── DashboardView.axaml │ ├── DashboardView.axaml.cs │ ├── HomeMenuView.axaml │ ├── HomeMenuView.axaml.cs │ ├── HomeStatusBarView.axaml │ ├── HomeStatusBarView.axaml.cs │ ├── HomeView.axaml │ └── HomeView.axaml.cs ├── Editor ├── AboutInfoView.axaml └── AboutInfoView.axaml.cs ├── Editors ├── TextBindingEditorView.axaml └── TextBindingEditorView.axaml.cs ├── Libraries ├── DatabasesView.axaml ├── DatabasesView.axaml.cs ├── GroupsView.axaml ├── GroupsView.axaml.cs ├── ImagesView.axaml ├── ImagesView.axaml.cs ├── ScriptsView.axaml ├── ScriptsView.axaml.cs ├── StylesView.axaml ├── StylesView.axaml.cs ├── TemplatesView.axaml └── TemplatesView.axaml.cs ├── MainView.axaml ├── MainView.axaml.cs ├── MainWindow.axaml ├── MainWindow.axaml.cs ├── Path ├── PathFigureView.axaml ├── PathFigureView.axaml.cs ├── PathSizeView.axaml ├── PathSizeView.axaml.cs └── Segments │ ├── ArcSegmentView.axaml │ ├── ArcSegmentView.axaml.cs │ ├── CubicBezierSegmentView.axaml │ ├── CubicBezierSegmentView.axaml.cs │ ├── LineSegmentView.axaml │ ├── LineSegmentView.axaml.cs │ ├── QuadraticBezierSegmentView.axaml │ └── QuadraticBezierSegmentView.axaml.cs ├── Renderer ├── GridView.axaml ├── GridView.axaml.cs ├── RenderDrawOperation.cs ├── RenderState.cs ├── RenderType.cs ├── RenderView.axaml ├── RenderView.axaml.cs ├── RendererOptions.cs ├── ShapeRendererStateView.axaml ├── ShapeRendererStateView.axaml.cs ├── ShapeStateView.axaml └── ShapeStateView.axaml.cs ├── Scripting ├── ScriptView.axaml └── ScriptView.axaml.cs ├── Shapes ├── ArcShapeView.axaml ├── ArcShapeView.axaml.cs ├── CubicBezierShapeView.axaml ├── CubicBezierShapeView.axaml.cs ├── EllipseShapeView.axaml ├── EllipseShapeView.axaml.cs ├── GroupShapeView.axaml ├── GroupShapeView.axaml.cs ├── ImageShapeView.axaml ├── ImageShapeView.axaml.cs ├── LineShapeView.axaml ├── LineShapeView.axaml.cs ├── PathShapeView.axaml ├── PathShapeView.axaml.cs ├── PointShapeView.axaml ├── PointShapeView.axaml.cs ├── QuadraticBezierShapeView.axaml ├── QuadraticBezierShapeView.axaml.cs ├── RectangleShapeView.axaml ├── RectangleShapeView.axaml.cs ├── TextShapeView.axaml └── TextShapeView.axaml.cs └── Style ├── ArgbColorView.axaml ├── ArgbColorView.axaml.cs ├── FillStyleView.axaml ├── FillStyleView.axaml.cs ├── ShapeStyleView.axaml ├── ShapeStyleView.axaml.cs ├── StrokeStyleView.axaml ├── StrokeStyleView.axaml.cs ├── TextStyleView.axaml └── TextStyleView.axaml.cs /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [wieslawsoltes] 2 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # https://probot.github.io/apps/stale/ 2 | 3 | # Number of days of inactivity before an issue becomes stale 4 | daysUntilStale: 60 5 | 6 | # Number of days of inactivity before a stale issue is closed 7 | daysUntilClose: 7 8 | 9 | # Issues with these labels will never be considered stale 10 | exemptLabels: 11 | - pinned 12 | - security 13 | 14 | # Label to use when marking an issue as stale 15 | staleLabel: stale 16 | 17 | # Comment to post when marking an issue as stale. Set to `false` to disable 18 | markComment: > 19 | This issue has been automatically marked as stale because it has not had 20 | recent activity. It will be closed if no further activity occurs. Thank you 21 | for your contributions. 22 | 23 | # Comment to post when closing a stale issue. Set to `false` to disable 24 | closeComment: true 25 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - release/* 8 | pull_request: 9 | branches: 10 | - master 11 | 12 | jobs: 13 | build: 14 | strategy: 15 | matrix: 16 | os: [ubuntu-latest, windows-latest, macos-latest] 17 | name: Build ${{ matrix.os }} 18 | runs-on: ${{ matrix.os }} 19 | steps: 20 | - uses: actions/checkout@v1 21 | - name: Setup .NET Core 22 | uses: actions/setup-dotnet@v1 23 | - name: Build Release 24 | run: dotnet build -c Release 25 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | true 4 | latest 5 | 6 | 7 | 11.1.0 8 | 9 | Wiesław Šoltés 10 | Wiesław Šoltés 11 | A multi-platform data driven 2D diagram editor. 12 | Copyright © Wiesław Šoltés 2024 13 | 14 | 15 | -------------------------------------------------------------------------------- /LICENSE.TXT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Wiesław Šoltés 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "9.0.100", 4 | "rollForward": "latestMinor", 5 | "allowPrerelease": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Core2D.Generators/Core2D.Generators.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | Library 6 | True 7 | latest 8 | enable 9 | latest 10 | False 11 | False 12 | True 13 | true 14 | True 15 | 16 | 17 | 18 | Core2D.Generators 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/Core2D/App.axaml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Core2D/Assets/Core2D.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wieslawsoltes/Core2D/6076ad962702e470001a6fdbe22f393aebc22f63/src/Core2D/Assets/Core2D.ico -------------------------------------------------------------------------------- /src/Core2D/Assets/Fonts/RobotoMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wieslawsoltes/Core2D/6076ad962702e470001a6fdbe22f393aebc22f63/src/Core2D/Assets/Fonts/RobotoMono-Regular.ttf -------------------------------------------------------------------------------- /src/Core2D/Behaviors/AttachEditorBehavior.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Avalonia.Controls; 3 | using Avalonia.Xaml.Interactivity; 4 | 5 | namespace Core2D.Behaviors; 6 | 7 | public class AttachEditorBehavior : Behavior 8 | { 9 | private AttachEditor? _input; 10 | 11 | protected override void OnAttached() 12 | { 13 | base.OnAttached(); 14 | 15 | if (AssociatedObject is { }) 16 | { 17 | _input = new AttachEditor(AssociatedObject); 18 | } 19 | } 20 | 21 | protected override void OnDetaching() 22 | { 23 | base.OnDetaching(); 24 | 25 | if (AssociatedObject is { }) 26 | { 27 | _input?.Detach(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Core2D/Behaviors/DragAndDrop/GroupsListBoxDropHandler.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Avalonia.Controls; 3 | using Avalonia.Input; 4 | using Core2D.ViewModels.Shapes; 5 | 6 | namespace Core2D.Behaviors.DragAndDrop; 7 | 8 | public class GroupsListBoxDropHandler : ListBoxDropHandler 9 | { 10 | public override bool Validate(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) 11 | { 12 | if (e.Source is Control && sender is ListBox listBox) 13 | { 14 | return ValidateLibrary(listBox, e, sourceContext, targetContext, false); 15 | } 16 | return false; 17 | } 18 | 19 | public override bool Execute(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) 20 | { 21 | if (e.Source is Control && sender is ListBox listBox) 22 | { 23 | return ValidateLibrary(listBox, e, sourceContext, targetContext, true); 24 | } 25 | return false; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Core2D/Behaviors/DragAndDrop/ScriptsListBoxDropHandler.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Avalonia.Controls; 3 | using Avalonia.Input; 4 | 5 | namespace Core2D.Behaviors.DragAndDrop; 6 | 7 | public class ScriptsListBoxDropHandler : ListBoxDropHandler 8 | { 9 | public override bool Validate(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) 10 | { 11 | if (e.Source is Control && sender is ListBox listBox) 12 | { 13 | // TODO: 14 | } 15 | return false; 16 | } 17 | 18 | public override bool Execute(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) 19 | { 20 | if (e.Source is Control && sender is ListBox listBox) 21 | { 22 | // TODO: 23 | } 24 | return false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Core2D/Behaviors/DragAndDrop/StylesListBoxDropHandler.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Avalonia.Controls; 3 | using Avalonia.Input; 4 | using Core2D.ViewModels.Style; 5 | 6 | namespace Core2D.Behaviors.DragAndDrop; 7 | 8 | public class StylesListBoxDropHandler : ListBoxDropHandler 9 | { 10 | public override bool Validate(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) 11 | { 12 | if (e.Source is Control && sender is ListBox listBox) 13 | { 14 | return ValidateLibrary(listBox, e, sourceContext, targetContext, false); 15 | } 16 | return false; 17 | } 18 | 19 | public override bool Execute(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) 20 | { 21 | if (e.Source is Control && sender is ListBox listBox) 22 | { 23 | return ValidateLibrary(listBox, e, sourceContext, targetContext, true); 24 | } 25 | return false; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Core2D/Behaviors/DragAndDrop/TemplatesListBoxDropHandler.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Avalonia.Controls; 3 | using Avalonia.Input; 4 | 5 | namespace Core2D.Behaviors.DragAndDrop; 6 | 7 | public class TemplatesListBoxDropHandler : ListBoxDropHandler 8 | { 9 | public override bool Validate(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) 10 | { 11 | if (e.Source is Control && sender is ListBox listBox) 12 | { 13 | // TODO: 14 | } 15 | return false; 16 | } 17 | 18 | public override bool Execute(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) 19 | { 20 | if (e.Source is Control && sender is ListBox listBox) 21 | { 22 | // TODO: 23 | } 24 | return false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Core2D/Configuration/Windows/WindowConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Configuration.Windows; 4 | 5 | public class WindowConfiguration 6 | { 7 | public double X { get; set; } = double.NaN; 8 | public double Y { get; set; } = double.NaN; 9 | public double Width { get; set; } = double.NaN; 10 | public double Height { get; set; } = double.NaN; 11 | public WindowState WindowState { get; set; } = WindowState.Normal; 12 | } -------------------------------------------------------------------------------- /src/Core2D/Configuration/Windows/WindowConfigurationFactory.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | 4 | namespace Core2D.Configuration.Windows; 5 | 6 | public static class WindowConfigurationFactory 7 | { 8 | public static WindowConfiguration Save(Window window) 9 | { 10 | return new() 11 | { 12 | Width = window.Width, 13 | Height = window.Height, 14 | X = window.Position.X, 15 | Y = window.Position.Y, 16 | WindowState = window.WindowState 17 | }; 18 | } 19 | 20 | public static void Load(Window window, WindowConfiguration settings) 21 | { 22 | if (!double.IsNaN(settings.Width)) 23 | { 24 | window.Width = settings.Width; 25 | } 26 | 27 | if (!double.IsNaN(settings.Height)) 28 | { 29 | window.Height = settings.Height; 30 | } 31 | 32 | if (!double.IsNaN(settings.X) && !double.IsNaN(settings.Y)) 33 | { 34 | window.Position = new PixelPoint((int)settings.X, (int)settings.Y); 35 | window.WindowStartupLocation = WindowStartupLocation.Manual; 36 | } 37 | else 38 | { 39 | window.WindowStartupLocation = WindowStartupLocation.CenterScreen; 40 | } 41 | 42 | window.WindowState = settings.WindowState; 43 | } 44 | } -------------------------------------------------------------------------------- /src/Core2D/Controls/Dialog/DialogPresenterView.axaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Core2D/Controls/Dialog/DialogPresenterView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Controls.Dialog; 4 | 5 | public partial class DialogPresenterView : UserControl 6 | { 7 | public DialogPresenterView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Controls/Dialog/DialogView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Controls.Dialog; 4 | 5 | public partial class DialogView : UserControl 6 | { 7 | public DialogView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Controls/Editor/MenuView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Controls.Editor; 4 | 5 | public partial class MenuView : UserControl 6 | { 7 | public MenuView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Controls/Editor/PageView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Controls.Editor; 4 | 5 | public partial class PageView : UserControl 6 | { 7 | public PageView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Controls/Editor/ToolsView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Controls.Editor; 4 | 5 | public partial class ToolsView : UserControl 6 | { 7 | public ToolsView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Controls/ToggleItem.axaml.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Avalonia; 3 | using Avalonia.Controls.Primitives; 4 | 5 | namespace Core2D.Controls; 6 | 7 | public class ToggleItem : TemplatedControl 8 | { 9 | public static readonly StyledProperty ToggleContentProperty = 10 | AvaloniaProperty.Register(nameof(ToggleContent)); 11 | 12 | public static readonly StyledProperty PopupContentProperty = 13 | AvaloniaProperty.Register(nameof(PopupContent)); 14 | 15 | public object? ToggleContent 16 | { 17 | get => GetValue(ToggleContentProperty); 18 | set => SetValue(ToggleContentProperty, value); 19 | } 20 | 21 | public object? PopupContent 22 | { 23 | get => GetValue(PopupContentProperty); 24 | set => SetValue(PopupContentProperty, value); 25 | } 26 | } -------------------------------------------------------------------------------- /src/Core2D/Converters/ArgbColorToBrushConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Globalization; 4 | using Avalonia; 5 | using Avalonia.Data.Converters; 6 | using Avalonia.Media; 7 | 8 | namespace Core2D.Converters; 9 | 10 | public class ArgbColorToBrushConverter : IValueConverter 11 | { 12 | public static ArgbColorToBrushConverter Instance = new(); 13 | 14 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 15 | { 16 | if (value is uint n) 17 | { 18 | return new SolidColorBrush(Color.FromUInt32(n)); 19 | } 20 | return AvaloniaProperty.UnsetValue; 21 | } 22 | 23 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Core2D/Converters/BaseShapeIconConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Globalization; 4 | using Avalonia; 5 | using Avalonia.Data.Converters; 6 | using Core2D.ViewModels.Shapes; 7 | 8 | namespace Core2D.Converters; 9 | 10 | public class BaseShapeIconConverter : IValueConverter 11 | { 12 | public static BaseShapeIconConverter Instance = new(); 13 | 14 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 15 | { 16 | if (value is BaseShapeViewModel shape) 17 | { 18 | var key = value.GetType().Name.Replace("ShapeViewModel", ""); 19 | 20 | if (Application.Current is { } application) 21 | { 22 | if (application.Styles.TryGetResource(key, null, out var resource)) 23 | { 24 | return resource; 25 | } 26 | } 27 | } 28 | return AvaloniaProperty.UnsetValue; 29 | } 30 | 31 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 32 | { 33 | throw new NotImplementedException(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Core2D/Converters/ContainerToTypeStringConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using Avalonia; 6 | using Avalonia.Data.Converters; 7 | using Core2D.ViewModels.Containers; 8 | 9 | namespace Core2D.Converters; 10 | 11 | public class ContainerToTypeStringConverter : IMultiValueConverter 12 | { 13 | public static ContainerToTypeStringConverter Instance = new(); 14 | 15 | public object? Convert(IList? values, Type targetType, object? parameter, CultureInfo culture) 16 | { 17 | if (values?.Count == 2 && values[0] is string name && values[1] is BaseContainerViewModel container) 18 | { 19 | if (string.IsNullOrEmpty(name)) 20 | { 21 | return container.GetType().Name.Replace("ContainerViewModel", ""); 22 | } 23 | return container.Name; 24 | } 25 | return AvaloniaProperty.UnsetValue; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Core2D/Converters/EditorToTitleMultiConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using Avalonia; 7 | using Avalonia.Data.Converters; 8 | 9 | namespace Core2D.Converters; 10 | 11 | public class EditorToTitleMultiConverter : IMultiValueConverter 12 | { 13 | public static EditorToTitleMultiConverter Instance = new(); 14 | 15 | public static readonly string s_defaultTitle = "Core2D"; 16 | 17 | public object? Convert(IList? values, Type targetType, object? parameter, CultureInfo culture) 18 | { 19 | if (values is { } && values.Count() == 2 && values.All(x => x != AvaloniaProperty.UnsetValue)) 20 | { 21 | if (values[0] is null || values[0]?.GetType() != typeof(string)) 22 | { 23 | return s_defaultTitle; 24 | } 25 | 26 | if (values[1] is null || values[1]?.GetType() != typeof(bool)) 27 | { 28 | return s_defaultTitle; 29 | } 30 | 31 | var name = (string?)values[0]; 32 | var isDirty = (bool?)values[1]; 33 | return string.Concat(name, (isDirty ?? false) ? "*" : "", " - ", s_defaultTitle); 34 | } 35 | 36 | return s_defaultTitle; 37 | } 38 | } -------------------------------------------------------------------------------- /src/Core2D/Converters/FontStyleFlagsConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Globalization; 4 | using Avalonia; 5 | using Avalonia.Data.Converters; 6 | using Core2D.Model.Style; 7 | 8 | namespace Core2D.Converters; 9 | 10 | public class FontStyleFlagsConverter : IValueConverter 11 | { 12 | public static FontStyleFlagsConverter Instance = new(); 13 | 14 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 15 | { 16 | if (value is FontStyleFlags flags && parameter is FontStyleFlags flag) 17 | { 18 | return flags.HasFlag(flag); 19 | } 20 | return AvaloniaProperty.UnsetValue; 21 | } 22 | 23 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Core2D/Converters/HexToColorConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Globalization; 4 | using Avalonia; 5 | using Avalonia.Data.Converters; 6 | using Avalonia.Media; 7 | 8 | namespace Core2D.Converters; 9 | 10 | public class HexToColorConverter : IValueConverter 11 | { 12 | public static HexToColorConverter Instance = new(); 13 | 14 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 15 | { 16 | if (value is string s && (targetType == typeof(Color?) || targetType == typeof(Color))) 17 | { 18 | try 19 | { 20 | if (Color.TryParse(s, out var color)) 21 | { 22 | return color; 23 | } 24 | } 25 | catch (Exception) 26 | { 27 | return AvaloniaProperty.UnsetValue; 28 | } 29 | } 30 | return AvaloniaProperty.UnsetValue; 31 | } 32 | 33 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 34 | { 35 | if (value is Color c && targetType == typeof(string)) 36 | { 37 | try 38 | { 39 | return $"#{c.ToUInt32():x8}"; 40 | } 41 | catch (Exception) 42 | { 43 | return AvaloniaProperty.UnsetValue; 44 | } 45 | } 46 | return AvaloniaProperty.UnsetValue; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Core2D/Converters/IsCurrentToolConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using Avalonia; 4 | using Avalonia.Data.Converters; 5 | using Core2D.Model.Editor; 6 | 7 | namespace Core2D.Converters; 8 | 9 | public class IsCurrentToolConverter : IValueConverter 10 | { 11 | public static IsCurrentToolConverter Instance = new(); 12 | 13 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 14 | { 15 | if (value is ITool tool && parameter is string title) 16 | { 17 | return tool.Title == title; 18 | } 19 | return AvaloniaProperty.UnsetValue; 20 | } 21 | 22 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | } -------------------------------------------------------------------------------- /src/Core2D/Converters/IsGroupConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Globalization; 4 | using Avalonia.Data.Converters; 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Converters; 8 | 9 | public class IsGroupConverter : IValueConverter 10 | { 11 | public static IsGroupConverter Instance = new(); 12 | 13 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 14 | { 15 | return value is { } && value.GetType() == typeof(GroupShapeViewModel); 16 | } 17 | 18 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 19 | { 20 | throw new NotImplementedException(); 21 | } 22 | } -------------------------------------------------------------------------------- /src/Core2D/Converters/ObjectEqualityMultiConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using Avalonia; 6 | using Avalonia.Data.Converters; 7 | 8 | namespace Core2D.Converters; 9 | 10 | public class ObjectEqualityMultiConverter : IMultiValueConverter 11 | { 12 | public static ObjectEqualityMultiConverter Instance = new(); 13 | 14 | public object? Convert(IList? values, Type targetType, object? parameter, CultureInfo culture) 15 | { 16 | if (values is { } && values.Count == 2 && values[0] != AvaloniaProperty.UnsetValue && values[1] != AvaloniaProperty.UnsetValue) 17 | { 18 | return values[0]?.Equals(values[1]); 19 | } 20 | return AvaloniaProperty.UnsetValue; 21 | } 22 | } -------------------------------------------------------------------------------- /src/Core2D/Converters/SelectedShapesFirstItemStyleValueConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using Avalonia; 7 | using Avalonia.Data.Converters; 8 | using Core2D.ViewModels.Shapes; 9 | 10 | namespace Core2D.Converters; 11 | 12 | public class SelectedShapesFirstItemStyleValueConverter : IValueConverter 13 | { 14 | public static SelectedShapesFirstItemStyleValueConverter Instance = new(); 15 | 16 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 17 | { 18 | if (value is ISet items && items.Count == 1) 19 | { 20 | return items.First().Style; 21 | } 22 | return AvaloniaProperty.UnsetValue; 23 | } 24 | 25 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 26 | { 27 | throw new NotImplementedException(); 28 | } 29 | } -------------------------------------------------------------------------------- /src/Core2D/Converters/SelectedShapesFirstItemValueConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using Avalonia; 7 | using Avalonia.Data.Converters; 8 | using Core2D.ViewModels.Shapes; 9 | 10 | namespace Core2D.Converters; 11 | 12 | public class SelectedShapesFirstItemValueConverter : IValueConverter 13 | { 14 | public static SelectedShapesFirstItemValueConverter Instance = new(); 15 | 16 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 17 | { 18 | return value is ISet items && items.Count == 1 19 | ? items.First() 20 | : AvaloniaProperty.UnsetValue; 21 | } 22 | 23 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Core2D/Converters/SelectedShapesHasItemsValueConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using Avalonia; 6 | using Avalonia.Data.Converters; 7 | using Core2D.ViewModels.Shapes; 8 | 9 | namespace Core2D.Converters; 10 | 11 | public class SelectedShapesHasItemsValueConverter : IValueConverter 12 | { 13 | public static SelectedShapesHasItemsValueConverter Instance = new(); 14 | 15 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 16 | { 17 | return value is ISet items && items.Count > 0; 18 | } 19 | 20 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 21 | { 22 | throw new NotImplementedException(); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Core2D/Converters/SelectedShapesIsEmptyValueConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using Avalonia; 6 | using Avalonia.Data.Converters; 7 | using Core2D.ViewModels.Shapes; 8 | 9 | namespace Core2D.Converters; 10 | 11 | public class SelectedShapesIsEmptyValueConverter : IValueConverter 12 | { 13 | public static SelectedShapesIsEmptyValueConverter Instance = new(); 14 | 15 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 16 | { 17 | return value is null || (value is ISet items && items.Count == 0); 18 | } 19 | 20 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 21 | { 22 | throw new NotImplementedException(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Core2D/Converters/ShapeStateFlagsConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Globalization; 4 | using Avalonia; 5 | using Avalonia.Data.Converters; 6 | using Core2D.Model.Renderer; 7 | 8 | namespace Core2D.Converters; 9 | 10 | public class ShapeStateFlagsConverter : IValueConverter 11 | { 12 | public static ShapeStateFlagsConverter Instance = new(); 13 | 14 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 15 | { 16 | if (value is ShapeStateFlags flags && parameter is ShapeStateFlags flag) 17 | { 18 | return flags.HasFlag(flag); 19 | } 20 | return AvaloniaProperty.UnsetValue; 21 | } 22 | 23 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Core2D/Converters/ShapeToTypeStringConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using Avalonia; 6 | using Avalonia.Data.Converters; 7 | using Core2D.ViewModels.Shapes; 8 | 9 | namespace Core2D.Converters; 10 | 11 | public class ShapeToTypeStringConverter : IMultiValueConverter 12 | { 13 | public static ShapeToTypeStringConverter Instance = new(); 14 | 15 | public object Convert(IList? values, Type targetType, object? parameter, CultureInfo culture) 16 | { 17 | if (values?.Count == 2 && values[0] is string name && values[1] is BaseShapeViewModel shape) 18 | { 19 | if (string.IsNullOrEmpty(name)) 20 | { 21 | return shape.GetType().Name.Replace("ShapeViewModel", ""); 22 | } 23 | return shape.Name; 24 | } 25 | return AvaloniaProperty.UnsetValue; 26 | } 27 | } -------------------------------------------------------------------------------- /src/Core2D/Converters/ToolIconConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Globalization; 4 | using Avalonia; 5 | using Avalonia.Data.Converters; 6 | using Core2D.Model.Editor; 7 | 8 | namespace Core2D.Converters; 9 | 10 | public class ToolIconConverter : IValueConverter 11 | { 12 | public static ToolIconConverter Instance = new(); 13 | 14 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 15 | { 16 | if (value is ITool tool) 17 | { 18 | var key = $"{tool.Title}"; 19 | 20 | if (Application.Current is { } application) 21 | { 22 | if (application.Styles.TryGetResource(key, null, out var resource)) 23 | { 24 | return resource; 25 | } 26 | } 27 | } 28 | return AvaloniaProperty.UnsetValue; 29 | } 30 | 31 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 32 | { 33 | throw new NotImplementedException(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Core2D/Converters/UInt32ToColorConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using Avalonia; 4 | using Avalonia.Data.Converters; 5 | using Avalonia.Media; 6 | 7 | namespace Core2D.Converters; 8 | 9 | public class UInt32ToColorConverter : IValueConverter 10 | { 11 | public static UInt32ToColorConverter Instance = new(); 12 | 13 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 14 | { 15 | if (value is uint c && (targetType == typeof(Color?) || targetType == typeof(Color))) 16 | { 17 | try 18 | { 19 | return Color.FromUInt32(c); 20 | } 21 | catch (Exception) 22 | { 23 | return AvaloniaProperty.UnsetValue; 24 | } 25 | } 26 | return AvaloniaProperty.UnsetValue; 27 | } 28 | 29 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 30 | { 31 | if (value is Color c2 && targetType == typeof(uint)) 32 | { 33 | try 34 | { 35 | return c2.ToUInt32(); 36 | } 37 | catch (Exception) 38 | { 39 | return AvaloniaProperty.UnsetValue; 40 | } 41 | } 42 | return AvaloniaProperty.UnsetValue; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Core2D/Converters/ViewModelToTypeStringConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Globalization; 4 | using Avalonia; 5 | using Avalonia.Data.Converters; 6 | using Core2D.ViewModels; 7 | 8 | namespace Core2D.Converters; 9 | 10 | public class ViewModelToTypeStringConverter : IValueConverter 11 | { 12 | public static ViewModelToTypeStringConverter Instance = new(); 13 | 14 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 15 | { 16 | if (value is ViewModelBase viewModel) 17 | { 18 | if (string.IsNullOrEmpty(viewModel.Name)) 19 | { 20 | return viewModel.GetType().Name.Replace("ViewModel", ""); 21 | } 22 | return viewModel.Name; 23 | } 24 | return AvaloniaProperty.UnsetValue; 25 | } 26 | 27 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 28 | { 29 | throw new NotImplementedException(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Core2D/Editor/AvaloniaEditorCanvasPlatform.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using Core2D.Model.Editor; 5 | using Core2D.ViewModels; 6 | 7 | namespace Core2D.Editor; 8 | 9 | public partial class AvaloniaEditorCanvasPlatform : ViewModelBase, IEditorCanvasPlatform 10 | { 11 | [AutoNotify] private Action? _invalidateControl; 12 | [AutoNotify] private Action? _resetZoom; 13 | [AutoNotify] private Action? _fillZoom; 14 | [AutoNotify] private Action? _uniformZoom; 15 | [AutoNotify] private Action? _uniformToFillZoom; 16 | [AutoNotify] private Action? _autoFitZoom; 17 | [AutoNotify] private Action? _inZoom; 18 | [AutoNotify] private Action? _outZoom; 19 | [AutoNotify] private object? _zoom; 20 | 21 | public AvaloniaEditorCanvasPlatform(IServiceProvider? serviceProvider) : base(serviceProvider) 22 | { 23 | } 24 | 25 | public override object Copy(IDictionary? shared) 26 | { 27 | throw new NotImplementedException(); 28 | } 29 | } -------------------------------------------------------------------------------- /src/Core2D/Editor/AvaloniaTextClipboard.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Threading.Tasks; 3 | using Avalonia; 4 | using Avalonia.Controls.ApplicationLifetimes; 5 | using Core2D.Model; 6 | 7 | namespace Core2D.Editor; 8 | 9 | public sealed class AvaloniaTextClipboard : ITextClipboard 10 | { 11 | async Task ITextClipboard.SetText(string? text) 12 | { 13 | if (text is null) 14 | { 15 | return; 16 | } 17 | 18 | if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime lifetime) 19 | { 20 | if (lifetime.MainWindow?.Clipboard is {} clipboard) 21 | { 22 | await clipboard.SetTextAsync(text); 23 | } 24 | } 25 | } 26 | 27 | private async Task GetTextAsync() 28 | { 29 | if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime lifetime) 30 | { 31 | if (lifetime.MainWindow?.Clipboard is {} clipboard) 32 | { 33 | return await clipboard.GetTextAsync(); 34 | } 35 | } 36 | return default; 37 | } 38 | 39 | Task ITextClipboard.GetText() 40 | { 41 | return GetTextAsync(); 42 | } 43 | 44 | private async Task ContainsTextAsync() 45 | { 46 | return !string.IsNullOrEmpty(await GetTextAsync()); 47 | } 48 | 49 | async Task ITextClipboard.ContainsText() 50 | { 51 | return await ContainsTextAsync(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Core2D/Json/ListContractResolver.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Reflection; 6 | using Newtonsoft.Json; 7 | using Newtonsoft.Json.Serialization; 8 | 9 | namespace Core2D.Json; 10 | 11 | public class ListContractResolver : DefaultContractResolver 12 | { 13 | private readonly Type _type; 14 | 15 | public ListContractResolver(Type type) 16 | { 17 | _type = type; 18 | } 19 | 20 | public override JsonContract ResolveContract(Type type) 21 | { 22 | if (type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(IList<>)) 23 | { 24 | return base.ResolveContract(_type.MakeGenericType(type.GenericTypeArguments[0])); 25 | } 26 | return base.ResolveContract(type); 27 | } 28 | 29 | protected override IList CreateProperties(Type type, MemberSerialization memberSerialization) 30 | { 31 | return base.CreateProperties(type, memberSerialization).Where(p => p.Writable).ToList(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Core2D/Model/Editor/IBounds.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using Core2D.ViewModels.Shapes; 5 | using Core2D.Spatial; 6 | 7 | namespace Core2D.Model.Editor; 8 | 9 | public interface IBounds 10 | { 11 | Type TargetType { get; } 12 | 13 | PointShapeViewModel? TryToGetPoint(BaseShapeViewModel shape, Point2 target, double radius, double scale, IDictionary registered); 14 | 15 | bool Contains(BaseShapeViewModel shape, Point2 target, double radius, double scale, IDictionary registered); 16 | 17 | bool Overlaps(BaseShapeViewModel shape, Rect2 target, double radius, double scale, IDictionary registered); 18 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Editor/IDialogPresenter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using Core2D.ViewModels.Editor; 4 | 5 | namespace Core2D.Model.Editor; 6 | 7 | public interface IDialogPresenter 8 | { 9 | IList? Dialogs { get; set; } 10 | 11 | void ShowDialog(DialogViewModel? dialogViewModel); 12 | 13 | void CloseDialog(DialogViewModel? dialogViewModel); 14 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Editor/IEditorCanvasPlatform.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Core2D.Model.Editor; 5 | 6 | public interface IEditorCanvasPlatform 7 | { 8 | Action? InvalidateControl { get; set; } 9 | 10 | Action? ResetZoom { get; set; } 11 | 12 | Action? FillZoom { get; set; } 13 | 14 | Action? UniformZoom { get; set; } 15 | 16 | Action? UniformToFillZoom { get; set; } 17 | 18 | Action? AutoFitZoom { get; set; } 19 | 20 | Action? InZoom { get; set; } 21 | 22 | Action? OutZoom { get; set; } 23 | 24 | object? Zoom { get; set; } 25 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Editor/IEditorTool.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Editor; 3 | 4 | public interface IEditorTool : ITool 5 | { 6 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Editor/IHitTest.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using Core2D.ViewModels.Shapes; 5 | using Core2D.Spatial; 6 | 7 | namespace Core2D.Model.Editor; 8 | 9 | public interface IHitTest 10 | { 11 | IDictionary Registered { get; } 12 | 13 | void Register(IBounds hitTest); 14 | 15 | void Register(IEnumerable hitTests); 16 | 17 | PointShapeViewModel? TryToGetPoint(BaseShapeViewModel shape, Point2 target, double radius, double scale); 18 | 19 | PointShapeViewModel? TryToGetPoint(IEnumerable shapes, Point2 target, double radius, double scale); 20 | 21 | bool Contains(BaseShapeViewModel shape, Point2 target, double radius, double scale); 22 | 23 | bool Overlaps(BaseShapeViewModel shape, Rect2 target, double radius, double scale); 24 | 25 | BaseShapeViewModel? TryToGetShape(IEnumerable shapes, Point2 target, double radius, double scale); 26 | 27 | ISet? TryToGetShapes(IEnumerable shapes, Rect2 target, double radius, double scale); 28 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Editor/IPathTool.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Editor; 3 | 4 | public interface IPathTool : ITool 5 | { 6 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Editor/IProjectEditorPlatform.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace Core2D.Model.Editor; 4 | 5 | public interface IProjectEditorPlatform 6 | { 7 | void OnOpen(); 8 | 9 | void OnSave(); 10 | 11 | void OnSaveAs(); 12 | 13 | void OnClose(); 14 | 15 | void OnImportJson(object? param); 16 | 17 | void OnImportSvg(object? param); 18 | 19 | void OnExportJson(object? param); 20 | 21 | void OnExport(object? param); 22 | 23 | void OnExecuteScriptFile(object? param); 24 | 25 | void OnExit(); 26 | 27 | void OnCopyAsXaml(object? param); 28 | 29 | void OnCopyAsSvg(object? param); 30 | 31 | void OnPasteSvg(); 32 | 33 | void OnCopyAsEmf(object? param); 34 | 35 | void OnCopyAsPathData(object? param); 36 | 37 | void OnPastePathDataStroked(); 38 | 39 | void OnPastePathDataFilled(); 40 | 41 | void OnImportData(object? param); 42 | 43 | void OnExportData(object? param); 44 | 45 | void OnUpdateData(object? param); 46 | 47 | void OnAboutDialog(); 48 | 49 | void OnZoomReset(); 50 | 51 | void OnZoomFill(); 52 | 53 | void OnZoomUniform(); 54 | 55 | void OnZoomUniformToFill(); 56 | 57 | void OnZoomAutoFit(); 58 | 59 | void OnZoomIn(); 60 | 61 | void OnZoomOut(); 62 | } 63 | -------------------------------------------------------------------------------- /src/Core2D/Model/Editor/IShapeEditor.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using Core2D.ViewModels.Path; 4 | using Core2D.ViewModels.Shapes; 5 | using Core2D.ViewModels.Style; 6 | 7 | namespace Core2D.Model.Editor; 8 | 9 | public interface IShapeEditor 10 | { 11 | void BreakPathFigure(PathFigureViewModel pathFigure, ShapeStyleViewModel style, bool isStroked, bool isFilled, List result); 12 | 13 | bool BreakPathShape(PathShapeViewModel pathShape, List result); 14 | 15 | void BreakShape(BaseShapeViewModel shape, List result, List remove); 16 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Editor/ITool.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model.Input; 3 | using Core2D.ViewModels.Shapes; 4 | 5 | namespace Core2D.Model.Editor; 6 | 7 | public interface ITool 8 | { 9 | string Title { get; } 10 | 11 | void BeginDown(InputArgs args); 12 | 13 | void BeginUp(InputArgs args); 14 | 15 | void EndDown(InputArgs args); 16 | 17 | void EndUp(InputArgs args); 18 | 19 | void Move(InputArgs args); 20 | 21 | void Move(BaseShapeViewModel? shape); 22 | 23 | void Finalize(BaseShapeViewModel? shape); 24 | 25 | void Reset(); 26 | } 27 | -------------------------------------------------------------------------------- /src/Core2D/Model/Editor/MoveMode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Editor; 3 | 4 | public enum MoveMode 5 | { 6 | Point, 7 | 8 | Shape 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/History/IHistory.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Core2D.Model.History; 5 | 6 | public interface IHistory 7 | { 8 | void Snapshot(T previous, T next, Action update); 9 | 10 | bool CanUndo(); 11 | 12 | bool CanRedo(); 13 | 14 | bool Undo(); 15 | 16 | bool Redo(); 17 | 18 | void Reset(); 19 | } 20 | -------------------------------------------------------------------------------- /src/Core2D/Model/IConnectable.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Shapes; 3 | 4 | namespace Core2D.Model; 5 | 6 | public interface IConnectable 7 | { 8 | bool Connect(PointShapeViewModel? point, PointShapeViewModel? target); 9 | 10 | bool Disconnect(PointShapeViewModel? point, out PointShapeViewModel? result); 11 | 12 | bool Disconnect(); 13 | } -------------------------------------------------------------------------------- /src/Core2D/Model/IContainerFactory.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Containers; 3 | 4 | namespace Core2D.Model; 5 | 6 | public interface IContainerFactory 7 | { 8 | TemplateContainerViewModel? GetTemplate(ProjectContainerViewModel project, string name); 9 | 10 | PageContainerViewModel? GetPage(ProjectContainerViewModel project, string name); 11 | 12 | DocumentContainerViewModel? GetDocument(ProjectContainerViewModel project, string name); 13 | 14 | ProjectContainerViewModel? GetProject(); 15 | } -------------------------------------------------------------------------------- /src/Core2D/Model/IDataObject.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Immutable; 3 | using System.Windows.Input; 4 | using Core2D.ViewModels.Data; 5 | 6 | namespace Core2D.Model; 7 | 8 | public interface IDataObject 9 | { 10 | ImmutableArray Properties { get; set; } 11 | 12 | RecordViewModel? Record { get; set; } 13 | 14 | ICommand AddProperty { get; } 15 | 16 | ICommand RemoveProperty { get; } 17 | 18 | ICommand ResetRecord { get; } 19 | } -------------------------------------------------------------------------------- /src/Core2D/Model/IDrawable.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model.Renderer; 3 | using Core2D.ViewModels.Style; 4 | 5 | namespace Core2D.Model; 6 | 7 | public interface IDrawable 8 | { 9 | ShapeStyleViewModel? Style { get; set; } 10 | 11 | bool IsStroked { get; set; } 12 | 13 | bool IsFilled { get; set; } 14 | 15 | void DrawShape(object? dc, IShapeRenderer? renderer, ISelection? selection); 16 | 17 | void DrawPoints(object? dc, IShapeRenderer? renderer, ISelection? selection); 18 | 19 | bool Invalidate(IShapeRenderer? renderer); 20 | } -------------------------------------------------------------------------------- /src/Core2D/Model/IFileSystem.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.IO; 3 | 4 | namespace Core2D.Model; 5 | 6 | public interface IFileSystem 7 | { 8 | string? GetBaseDirectory(); 9 | 10 | bool Exists(string path); 11 | 12 | Stream? Open(string path); 13 | 14 | Stream? Create(string path); 15 | 16 | byte[]? ReadBinary(Stream stream); 17 | 18 | void WriteBinary(Stream stream, byte[]? bytes); 19 | 20 | string? ReadUtf8Text(Stream stream); 21 | 22 | void WriteUtf8Text(Stream stream, string? text); 23 | 24 | string? ReadUtf8Text(string path); 25 | 26 | void WriteUtf8Text(string path, string? text); 27 | } -------------------------------------------------------------------------------- /src/Core2D/Model/IFileWriter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.IO; 3 | 4 | namespace Core2D.Model; 5 | 6 | public interface IFileWriter: IPickerItem 7 | { 8 | void Save(Stream stream, object item, object? options); 9 | } 10 | -------------------------------------------------------------------------------- /src/Core2D/Model/IImageImporter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Threading.Tasks; 3 | 4 | namespace Core2D.Model; 5 | 6 | public interface IImageImporter 7 | { 8 | Task GetImageKeyAsync(); 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/IJsonSerializer.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model; 3 | 4 | public interface IJsonSerializer 5 | { 6 | string Serialize(T? value); 7 | 8 | T? Deserialize(string json); 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/ILog.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Core2D.Model; 5 | 6 | public interface ILog : IDisposable 7 | { 8 | string? LastMessage { get; } 9 | 10 | void Initialize(string path); 11 | 12 | void Close(); 13 | 14 | void LogInformation(string message); 15 | 16 | void LogInformation(string format, params object[] args); 17 | 18 | void LogWarning(string message); 19 | 20 | void LogWarning(string format, params object[] args); 21 | 22 | void LogError(string message); 23 | 24 | void LogError(string format, params object[] args); 25 | 26 | void LogException(Exception ex); 27 | } -------------------------------------------------------------------------------- /src/Core2D/Model/IMetafileExporter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using Core2D.Model.Renderer; 4 | using Core2D.ViewModels.Containers; 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Model; 8 | 9 | public interface IMetafileExporter 10 | { 11 | MemoryStream? MakeMetafileStream(object bitmap, IEnumerable shapes, IImageCache ic); 12 | MemoryStream? MakeMetafileStream(object bitmap, FrameContainerViewModel container, IImageCache ic); 13 | } 14 | -------------------------------------------------------------------------------- /src/Core2D/Model/IPathConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using Core2D.Model.Renderer; 4 | using Core2D.ViewModels.Shapes; 5 | 6 | namespace Core2D.Model; 7 | 8 | public interface IPathConverter 9 | { 10 | PathShapeViewModel? ToPathShape(ISet? shapes); 11 | 12 | PathShapeViewModel? ToPathShape(BaseShapeViewModel? shape); 13 | 14 | PathShapeViewModel? ToStrokePathShape(BaseShapeViewModel? shape); 15 | 16 | PathShapeViewModel? ToFillPathShape(BaseShapeViewModel? shape); 17 | 18 | PathShapeViewModel? ToWindingPathShape(BaseShapeViewModel? shape); 19 | 20 | PathShapeViewModel? Simplify(BaseShapeViewModel? shape); 21 | 22 | PathShapeViewModel? Op(ISet? shapes, PathOp op); 23 | 24 | public PathShapeViewModel? FromSvgPathData(string? svgPath, bool isStroked, bool isFilled); 25 | 26 | public string? ToSvgPathData(BaseShapeViewModel? shape); 27 | } 28 | -------------------------------------------------------------------------------- /src/Core2D/Model/IPickerItem.cs: -------------------------------------------------------------------------------- 1 | namespace Core2D.Model; 2 | 3 | public interface IPickerItem 4 | { 5 | string Name { get; } 6 | 7 | string Extension { get; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/Model/IProjectExporter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.IO; 3 | using Core2D.ViewModels.Containers; 4 | 5 | namespace Core2D.Model; 6 | 7 | public interface IProjectExporter 8 | { 9 | void Save(Stream stream, PageContainerViewModel container); 10 | 11 | void Save(Stream stream, DocumentContainerViewModel document); 12 | 13 | void Save(Stream stream, ProjectContainerViewModel project); 14 | } -------------------------------------------------------------------------------- /src/Core2D/Model/IScriptRunner.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Threading.Tasks; 3 | 4 | namespace Core2D.Model; 5 | 6 | public interface IScriptRunner 7 | { 8 | Task Execute(string code, object? state); 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/ISelectable.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model; 3 | 4 | public interface ISelectable 5 | { 6 | void Move(ISelection? selection, decimal dx, decimal dy); 7 | 8 | void Select(ISelection? selection); 9 | 10 | void Deselect(ISelection? selection); 11 | } -------------------------------------------------------------------------------- /src/Core2D/Model/ISelection.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using Core2D.ViewModels.Shapes; 4 | 5 | namespace Core2D.Model; 6 | 7 | public interface ISelection 8 | { 9 | ISet? SelectedShapes { get; set; } 10 | } -------------------------------------------------------------------------------- /src/Core2D/Model/IStringExporter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model; 3 | 4 | public interface IStringExporter 5 | { 6 | string ToXamlString(); 7 | 8 | string ToSvgString(); 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/ISvgConverter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using Core2D.ViewModels.Shapes; 5 | 6 | namespace Core2D.Model; 7 | 8 | public interface ISvgConverter 9 | { 10 | IList? Convert(Stream stream, out double width, out double height); 11 | 12 | IList? FromString(string text, out double width, out double height); 13 | } 14 | -------------------------------------------------------------------------------- /src/Core2D/Model/ISvgExporter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model; 3 | 4 | public interface ISvgExporter 5 | { 6 | string Create(object? item, double width, double height); 7 | } -------------------------------------------------------------------------------- /src/Core2D/Model/ITextClipboard.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Threading.Tasks; 3 | 4 | namespace Core2D.Model; 5 | 6 | public interface ITextClipboard 7 | { 8 | Task ContainsText(); 9 | 10 | Task GetText(); 11 | 12 | Task SetText(string? text); 13 | } -------------------------------------------------------------------------------- /src/Core2D/Model/ITextFieldReader.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.IO; 3 | 4 | namespace Core2D.Model; 5 | 6 | public interface ITextFieldReader : IPickerItem 7 | { 8 | T? Read(Stream stream); 9 | } 10 | -------------------------------------------------------------------------------- /src/Core2D/Model/ITextFieldWriter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.IO; 3 | 4 | namespace Core2D.Model; 5 | 6 | public interface ITextFieldWriter: IPickerItem 7 | { 8 | void Write(Stream stream, T? database); 9 | } 10 | -------------------------------------------------------------------------------- /src/Core2D/Model/IXamlExporter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model; 3 | 4 | public interface IXamlExporter 5 | { 6 | string Create(object item, string? key); 7 | } 8 | -------------------------------------------------------------------------------- /src/Core2D/Model/Input/InputArgs.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Input; 3 | 4 | public readonly struct InputArgs 5 | { 6 | public double X { get; } 7 | 8 | public double Y { get; } 9 | 10 | public ModifierFlags Modifier { get; } 11 | 12 | public InputArgs(double x, double y, ModifierFlags modifier) 13 | { 14 | X = x; 15 | Y = y; 16 | Modifier = modifier; 17 | } 18 | 19 | public void Deconstruct(out double x, out double y) 20 | { 21 | x = X; 22 | y = Y; 23 | } 24 | 25 | public void Deconstruct(out double x, out double y, out ModifierFlags modifier) 26 | { 27 | x = X; 28 | y = Y; 29 | modifier = Modifier; 30 | } 31 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Input/InputArgsObserver.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Core2D.Model.Input; 5 | 6 | internal class InputArgsObserver : IObserver 7 | { 8 | private readonly InputTarget _target; 9 | private readonly Action _onNext; 10 | 11 | public InputArgsObserver(InputTarget target, Action onNext) 12 | { 13 | _target = target; 14 | _onNext = onNext; 15 | } 16 | 17 | public void OnCompleted() 18 | { 19 | } 20 | 21 | public void OnError(Exception error) 22 | { 23 | } 24 | 25 | public void OnNext(InputArgs value) 26 | { 27 | _onNext(_target, value); 28 | } 29 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Input/InputSource.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Core2D.Model.Input; 5 | 6 | public abstract class InputSource 7 | { 8 | public IObservable? BeginDown { get; set; } 9 | 10 | public IObservable? BeginUp { get; set; } 11 | 12 | public IObservable? EndDown { get; set; } 13 | 14 | public IObservable? EndUp { get; set; } 15 | 16 | public IObservable? Move { get; set; } 17 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Input/InputTarget.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Input; 3 | 4 | public abstract class InputTarget 5 | { 6 | public abstract void BeginDown(InputArgs args); 7 | 8 | public abstract void BeginUp(InputArgs args); 9 | 10 | public abstract void EndDown(InputArgs args); 11 | 12 | public abstract void EndUp(InputArgs args); 13 | 14 | public abstract void Move(InputArgs args); 15 | 16 | public abstract bool IsBeginDownAvailable(); 17 | 18 | public abstract bool IsBeginUpAvailable(); 19 | 20 | public abstract bool IsEndDownAvailable(); 21 | 22 | public abstract bool IsEndUpAvailable(); 23 | 24 | public abstract bool IsMoveAvailable(); 25 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Input/ModifierFlags.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Core2D.Model.Input; 5 | 6 | [Flags] 7 | public enum ModifierFlags 8 | { 9 | None = 0, 10 | 11 | Alt = 1, 12 | 13 | Control = 2, 14 | 15 | Shift = 4 16 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Path/FillRule.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Path; 3 | 4 | public enum FillRule 5 | { 6 | Nonzero, 7 | 8 | EvenOdd 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Path/SweepDirection.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Path; 3 | 4 | public enum SweepDirection 5 | { 6 | Clockwise, 7 | 8 | Counterclockwise 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/ICache.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Renderer; 3 | 4 | public interface ICache where TKey : notnull 5 | { 6 | TValue? Get(TKey key); 7 | 8 | void Set(TKey key, TValue? value); 9 | 10 | void Reset(); 11 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/IContainerPresenter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Containers; 3 | 4 | namespace Core2D.Model.Renderer; 5 | 6 | public interface IContainerPresenter 7 | { 8 | void Render(object? dc, IShapeRenderer? renderer, ISelection? selection, FrameContainerViewModel? container, double dx, double dy); 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/IDecorator.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using Core2D.Model.Input; 4 | using Core2D.ViewModels.Containers; 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Model.Renderer; 8 | 9 | public interface IDecorator : IDrawable 10 | { 11 | LayerContainerViewModel? Layer { get; set; } 12 | 13 | IList? Shapes { get; set; } 14 | 15 | bool IsVisible { get; } 16 | 17 | void Update(bool rebuild = true); 18 | 19 | void Show(); 20 | 21 | void Hide(); 22 | 23 | bool HitTest(InputArgs args); 24 | 25 | void Move(InputArgs args); 26 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/IGrid.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Style; 3 | 4 | namespace Core2D.Model.Renderer; 5 | 6 | public interface IGrid 7 | { 8 | bool IsGridEnabled { get; set; } 9 | 10 | bool IsBorderEnabled { get; set; } 11 | 12 | double GridOffsetLeft { get; set; } 13 | 14 | double GridOffsetTop { get; set; } 15 | 16 | double GridOffsetRight { get; set; } 17 | 18 | double GridOffsetBottom { get; set; } 19 | 20 | double GridCellWidth { get; set; } 21 | 22 | double GridCellHeight { get; set; } 23 | 24 | BaseColorViewModel? GridStrokeColor { get; set; } 25 | 26 | double GridStrokeThickness { get; set; } 27 | 28 | bool IsDirty(); 29 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/IImageCache.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | 5 | namespace Core2D.Model.Renderer; 6 | 7 | public interface IImageCache : INotifyPropertyChanged 8 | { 9 | IEnumerable? Keys { get; } 10 | 11 | string AddImageFromFile(string path, byte[] bytes); 12 | 13 | void AddImage(string key, byte[] bytes); 14 | 15 | byte[]? GetImage(string key); 16 | 17 | void RemoveImage(string key); 18 | 19 | void PurgeUnusedImages(ICollection used); 20 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/IImageKey.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Renderer; 3 | 4 | public interface IImageKey 5 | { 6 | string? Key { get; set; } 7 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/IShapeRenderer.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Renderer; 3 | using Core2D.ViewModels.Shapes; 4 | using Core2D.ViewModels.Style; 5 | 6 | namespace Core2D.Model.Renderer; 7 | 8 | public interface IShapeRenderer 9 | { 10 | ShapeRendererStateViewModel? State { get; set; } 11 | 12 | void ClearCache(); 13 | 14 | void Fill(object? dc, double x, double y, double width, double height, BaseColorViewModel? color); 15 | 16 | void Grid(object? dc, IGrid grid, double x, double y, double width, double height); 17 | 18 | void DrawPoint(object? dc, PointShapeViewModel point, ShapeStyleViewModel? style); 19 | 20 | void DrawLine(object? dc, LineShapeViewModel line, ShapeStyleViewModel? style); 21 | 22 | void DrawRectangle(object? dc, RectangleShapeViewModel rectangle, ShapeStyleViewModel? style); 23 | 24 | void DrawEllipse(object? dc, EllipseShapeViewModel ellipse, ShapeStyleViewModel? style); 25 | 26 | void DrawArc(object? dc, ArcShapeViewModel arc, ShapeStyleViewModel? style); 27 | 28 | void DrawCubicBezier(object? dc, CubicBezierShapeViewModel cubicBezier, ShapeStyleViewModel? style); 29 | 30 | void DrawQuadraticBezier(object? dc, QuadraticBezierShapeViewModel quadraticBezier, ShapeStyleViewModel? style); 31 | 32 | void DrawText(object? dc, TextShapeViewModel text, ShapeStyleViewModel? style); 33 | 34 | void DrawImage(object? dc, ImageShapeViewModel image, ShapeStyleViewModel? style); 35 | 36 | void DrawPath(object? dc, PathShapeViewModel path, ShapeStyleViewModel? style); 37 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/IArcDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Shapes; 3 | 4 | namespace Core2D.Model.Renderer.Nodes; 5 | 6 | public interface IArcDrawNode : IDrawNode 7 | { 8 | ArcShapeViewModel Arc { get; set; } 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/ICubicBezierDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Shapes; 3 | 4 | namespace Core2D.Model.Renderer.Nodes; 5 | 6 | public interface ICubicBezierDrawNode : IDrawNode 7 | { 8 | CubicBezierShapeViewModel CubicBezier { get; set; } 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/IDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using Core2D.ViewModels.Style; 4 | 5 | namespace Core2D.Model.Renderer.Nodes; 6 | 7 | public interface IDrawNode : IDisposable 8 | { 9 | ShapeStyleViewModel? Style { get; set; } 10 | 11 | bool ScaleThickness { get; set; } 12 | 13 | bool ScaleSize { get; set; } 14 | 15 | void UpdateGeometry(); 16 | 17 | void UpdateStyle(); 18 | 19 | void Draw(object? dc, double zoom); 20 | 21 | void OnDraw(object? dc, double zoom); 22 | } 23 | -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/IDrawNodeFactory.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using Core2D.ViewModels.Shapes; 4 | using Core2D.ViewModels.Style; 5 | 6 | namespace Core2D.Model.Renderer.Nodes; 7 | 8 | public interface IDrawNodeFactory 9 | { 10 | IFillDrawNode CreateFillDrawNode(double x, double y, double width, double height, BaseColorViewModel colorViewModel); 11 | 12 | IGridDrawNode CreateGridDrawNode(IGrid grid, double x, double y, double width, double height); 13 | 14 | IPointDrawNode CreatePointDrawNode(PointShapeViewModel point, ShapeStyleViewModel? pointStyleViewModel, double pointSize); 15 | 16 | ILineDrawNode CreateLineDrawNode(LineShapeViewModel line, ShapeStyleViewModel? style); 17 | 18 | IRectangleDrawNode CreateRectangleDrawNode(RectangleShapeViewModel rectangle, ShapeStyleViewModel? style); 19 | 20 | IEllipseDrawNode CreateEllipseDrawNode(EllipseShapeViewModel ellipse, ShapeStyleViewModel? style); 21 | 22 | IArcDrawNode CreateArcDrawNode(ArcShapeViewModel arc, ShapeStyleViewModel? style); 23 | 24 | ICubicBezierDrawNode CreateCubicBezierDrawNode(CubicBezierShapeViewModel cubicBezier, ShapeStyleViewModel? style); 25 | 26 | IQuadraticBezierDrawNode CreateQuadraticBezierDrawNode(QuadraticBezierShapeViewModel quadraticBezier, ShapeStyleViewModel? style); 27 | 28 | ITextDrawNode CreateTextDrawNode(TextShapeViewModel text, ShapeStyleViewModel? style); 29 | 30 | IImageDrawNode CreateImageDrawNode(ImageShapeViewModel image, ShapeStyleViewModel? style, IImageCache? imageCache, ICache? bitmapCache); 31 | 32 | IPathDrawNode CreatePathDrawNode(PathShapeViewModel path, ShapeStyleViewModel? style); 33 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/IEllipseDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Shapes; 3 | 4 | namespace Core2D.Model.Renderer.Nodes; 5 | 6 | public interface IEllipseDrawNode : IDrawNode 7 | { 8 | EllipseShapeViewModel Ellipse { get; set; } 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/IFillDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Style; 3 | 4 | namespace Core2D.Model.Renderer.Nodes; 5 | 6 | public interface IFillDrawNode : IDrawNode 7 | { 8 | BaseColorViewModel? Color { get; set; } 9 | 10 | double X { get; set; } 11 | 12 | double Y { get; set; } 13 | 14 | double Width { get; set; } 15 | 16 | double Height { get; set; } 17 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/IGridDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Renderer.Nodes; 3 | 4 | public interface IGridDrawNode : IDrawNode 5 | { 6 | IGrid Grid { get; set; } 7 | 8 | double X { get; set; } 9 | 10 | double Y { get; set; } 11 | 12 | double Width { get; set; } 13 | 14 | double Height { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/IImageDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using Core2D.ViewModels.Shapes; 4 | 5 | namespace Core2D.Model.Renderer.Nodes; 6 | 7 | public interface IImageDrawNode : IDrawNode 8 | { 9 | ImageShapeViewModel Image { get; set; } 10 | 11 | IImageCache? ImageCache { get; set; } 12 | 13 | ICache? BitmapCache { get; set; } 14 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/ILineDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Shapes; 3 | 4 | namespace Core2D.Model.Renderer.Nodes; 5 | 6 | public interface ILineDrawNode : IDrawNode 7 | { 8 | LineShapeViewModel Line { get; set; } 9 | 10 | public IMarker? StartMarker { get; set; } 11 | 12 | public IMarker? EndMarker { get; set; } 13 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/IMarker.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Style; 3 | 4 | namespace Core2D.Model.Renderer.Nodes; 5 | 6 | public interface IMarker 7 | { 8 | ArrowStyleViewModel? Style { get; set; } 9 | 10 | void Draw(object? dc); 11 | 12 | void UpdateStyle(); 13 | } 14 | -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/IPathDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Shapes; 3 | 4 | namespace Core2D.Model.Renderer.Nodes; 5 | 6 | public interface IPathDrawNode : IDrawNode 7 | { 8 | PathShapeViewModel Path { get; set; } 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/IPointDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Shapes; 3 | 4 | namespace Core2D.Model.Renderer.Nodes; 5 | 6 | public interface IPointDrawNode : IDrawNode 7 | { 8 | PointShapeViewModel Point { get; set; } 9 | 10 | double PointSize { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/IQuadraticBezierDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Shapes; 3 | 4 | namespace Core2D.Model.Renderer.Nodes; 5 | 6 | public interface IQuadraticBezierDrawNode : IDrawNode 7 | { 8 | QuadraticBezierShapeViewModel QuadraticBezier { get; set; } 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/IRectangleDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Shapes; 3 | 4 | namespace Core2D.Model.Renderer.Nodes; 5 | 6 | public interface IRectangleDrawNode : IDrawNode 7 | { 8 | RectangleShapeViewModel Rectangle { get; set; } 9 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/Nodes/ITextDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Shapes; 3 | 4 | namespace Core2D.Model.Renderer.Nodes; 5 | 6 | public interface ITextDrawNode : IDrawNode 7 | { 8 | TextShapeViewModel Text { get; set; } 9 | 10 | string? BoundText { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/PathOp.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Renderer; 3 | 4 | public enum PathOp 5 | { 6 | Difference = 0, 7 | 8 | Intersect = 1, 9 | 10 | Union = 2, 11 | 12 | Xor = 3, 13 | 14 | ReverseDifference = 4 15 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Renderer/ShapeStateFlags.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Core2D.Model.Renderer; 5 | 6 | [Flags] 7 | public enum ShapeStateFlags 8 | { 9 | Default = 0, 10 | 11 | Visible = 1, 12 | 13 | Printable = 2, 14 | 15 | Locked = 4, 16 | 17 | Size = 8, 18 | 19 | Thickness = 16, 20 | 21 | Connector = 32, 22 | 23 | None = 64, 24 | 25 | Standalone = 128, 26 | 27 | Input = 256, 28 | 29 | Output = 512 30 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Style/ArrowType.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Style; 3 | 4 | public enum ArrowType 5 | { 6 | None, 7 | 8 | Rectangle, 9 | 10 | Ellipse, 11 | 12 | Arrow 13 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Style/FontStyleFlags.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Core2D.Model.Style; 5 | 6 | [Flags] 7 | public enum FontStyleFlags 8 | { 9 | Regular = 0, 10 | 11 | Bold = 1, 12 | 13 | Italic = 2 14 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Style/LineCap.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Style; 3 | 4 | public enum LineCap 5 | { 6 | Flat = 0, 7 | 8 | Square = 1, 9 | 10 | Round = 2 11 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Style/TextHAlignment.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Style; 3 | 4 | public enum TextHAlignment 5 | { 6 | Left, 7 | 8 | Center, 9 | 10 | Right 11 | } -------------------------------------------------------------------------------- /src/Core2D/Model/Style/TextVAlignment.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Model.Style; 3 | 4 | public enum TextVAlignment 5 | { 6 | Top, 7 | 8 | Center, 9 | 10 | Bottom 11 | } -------------------------------------------------------------------------------- /src/Core2D/Modules/FileWriter/SkiaSharp/SvgSkiaSharpExporter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.IO; 4 | using Core2D.Model; 5 | using Core2D.Model.Renderer; 6 | using Core2D.ViewModels.Containers; 7 | using SkiaSharp; 8 | 9 | namespace Core2D.Modules.FileWriter.SkiaSharp; 10 | 11 | public sealed class SvgSkiaSharpExporter : IProjectExporter 12 | { 13 | private readonly IShapeRenderer _renderer; 14 | private readonly IContainerPresenter _presenter; 15 | 16 | public SvgSkiaSharpExporter(IShapeRenderer renderer, IContainerPresenter presenter) 17 | { 18 | _renderer = renderer; 19 | _presenter = presenter; 20 | } 21 | 22 | public void Save(Stream stream, PageContainerViewModel container) 23 | { 24 | if (container.Template is null) 25 | { 26 | return; 27 | } 28 | var width = (int)container.Template.Width; 29 | var height = (int)container.Template.Height; 30 | using var wstream = new SKManagedWStream(stream); 31 | using var canvas = SKSvgCanvas.Create(SKRect.Create(0, 0, width, height), stream); 32 | _presenter.Render(canvas, _renderer, null, container, 0, 0); 33 | } 34 | 35 | public void Save(Stream stream, DocumentContainerViewModel document) 36 | { 37 | throw new NotSupportedException("Saving documents as svg drawing is not supported."); 38 | } 39 | 40 | public void Save(Stream stream, ProjectContainerViewModel project) 41 | { 42 | throw new NotSupportedException("Saving projects as svg drawing is not supported."); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/Avalonia/AvaloniaRendererViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using Core2D.ViewModels.Renderer; 4 | 5 | namespace Core2D.Modules.Renderer.Avalonia; 6 | 7 | public class AvaloniaRendererViewModel : NodeRendererViewModel 8 | { 9 | public AvaloniaRendererViewModel(IServiceProvider? serviceProvider) 10 | : base(serviceProvider, new AvaloniaDrawNodeFactory()) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/Avalonia/Nodes/ArcDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model.Renderer; 3 | using Core2D.Model.Renderer.Nodes; 4 | using Core2D.ViewModels.Shapes; 5 | using Core2D.ViewModels.Style; 6 | using A = Avalonia; 7 | using AM = Avalonia.Media; 8 | using AP = Avalonia.Platform; 9 | 10 | namespace Core2D.Modules.Renderer.Avalonia.Nodes; 11 | 12 | internal class ArcDrawNode : DrawNode, IArcDrawNode 13 | { 14 | public ArcShapeViewModel Arc { get; set; } 15 | public AM.Geometry? Geometry { get; set; } 16 | 17 | public ArcDrawNode(ArcShapeViewModel arc, ShapeStyleViewModel? style) 18 | { 19 | Style = style; 20 | Arc = arc; 21 | UpdateGeometry(); 22 | } 23 | 24 | public sealed override void UpdateGeometry() 25 | { 26 | ScaleThickness = Arc.State.HasFlag(ShapeStateFlags.Thickness); 27 | ScaleSize = Arc.State.HasFlag(ShapeStateFlags.Size); 28 | Geometry = PathGeometryConverter.ToGeometryImpl(Arc); 29 | Center = Geometry is { } ? Geometry.Bounds.Center : new A.Point(); 30 | } 31 | 32 | public override void OnDraw(object? dc, double zoom) 33 | { 34 | if (dc is not AM.DrawingContext context) 35 | { 36 | return; 37 | } 38 | 39 | if (Geometry is { }) 40 | { 41 | context.DrawGeometry(Arc.IsFilled ? Fill : null, Arc.IsStroked ? Stroke : null, Geometry); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/Avalonia/Nodes/CubicBezierDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model.Renderer; 3 | using Core2D.Model.Renderer.Nodes; 4 | using Core2D.ViewModels.Shapes; 5 | using Core2D.ViewModels.Style; 6 | using A = Avalonia; 7 | using AM = Avalonia.Media; 8 | using AP = Avalonia.Platform; 9 | 10 | namespace Core2D.Modules.Renderer.Avalonia.Nodes; 11 | 12 | internal class CubicBezierDrawNode : DrawNode, ICubicBezierDrawNode 13 | { 14 | public CubicBezierShapeViewModel CubicBezier { get; set; } 15 | public AM.Geometry? Geometry { get; set; } 16 | 17 | public CubicBezierDrawNode(CubicBezierShapeViewModel cubicBezier, ShapeStyleViewModel? style) 18 | { 19 | Style = style; 20 | CubicBezier = cubicBezier; 21 | UpdateGeometry(); 22 | } 23 | 24 | public sealed override void UpdateGeometry() 25 | { 26 | ScaleThickness = CubicBezier.State.HasFlag(ShapeStateFlags.Thickness); 27 | ScaleSize = CubicBezier.State.HasFlag(ShapeStateFlags.Size); 28 | Geometry = PathGeometryConverter.ToGeometryImpl(CubicBezier); 29 | Center = Geometry is { } ? Geometry.Bounds.Center : new A.Point(); 30 | } 31 | 32 | public override void OnDraw(object? dc, double zoom) 33 | { 34 | if (dc is not AM.DrawingContext context) 35 | { 36 | return; 37 | } 38 | 39 | if (Geometry is { }) 40 | { 41 | context.DrawGeometry(CubicBezier.IsFilled ? Fill : null, CubicBezier.IsStroked ? Stroke : null, Geometry); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/Avalonia/Nodes/Markers/ArrowMarker.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using A = Avalonia; 3 | using AM = Avalonia.Media; 4 | using AP = Avalonia.Platform; 5 | 6 | namespace Core2D.Modules.Renderer.Avalonia.Nodes.Markers; 7 | 8 | internal class ArrowMarker : MarkerBase 9 | { 10 | public A.Point P11; 11 | public A.Point P21; 12 | public A.Point P12; 13 | public A.Point P22; 14 | 15 | public override void Draw(object? dc) 16 | { 17 | if (dc is not AM.DrawingContext context) 18 | { 19 | return; 20 | } 21 | 22 | if (ShapeViewModel is { } && ShapeViewModel.IsStroked && Pen is { }) 23 | { 24 | context.DrawLine(Pen, P11, P21); 25 | context.DrawLine(Pen, P12, P22); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/Avalonia/Nodes/Markers/EllipseMarker.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using AP = Avalonia.Platform; 3 | using AM = Avalonia.Media; 4 | 5 | namespace Core2D.Modules.Renderer.Avalonia.Nodes.Markers; 6 | 7 | internal class EllipseMarker : MarkerBase 8 | { 9 | public AM.EllipseGeometry? EllipseGeometry { get; set; } 10 | 11 | public override void Draw(object? dc) 12 | { 13 | if (dc is not AM.DrawingContext context) 14 | { 15 | return; 16 | } 17 | 18 | if (ShapeViewModel is { } && EllipseGeometry is { }) 19 | { 20 | using var rotationDisposable = context.PushTransform(Rotation); 21 | context.DrawGeometry(ShapeViewModel.IsFilled ? Brush : null, ShapeViewModel.IsStroked ? Pen : null, EllipseGeometry); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/Avalonia/Nodes/Markers/MarkerBase.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model.Renderer.Nodes; 3 | using Core2D.ViewModels.Shapes; 4 | using Core2D.ViewModels.Style; 5 | using A = Avalonia; 6 | using AM = Avalonia.Media; 7 | 8 | namespace Core2D.Modules.Renderer.Avalonia.Nodes.Markers; 9 | 10 | internal abstract class MarkerBase : IMarker 11 | { 12 | public BaseShapeViewModel? ShapeViewModel { get; set; } 13 | public ShapeStyleViewModel? ShapeStyleViewModel { get; set; } 14 | public ArrowStyleViewModel? Style { get; set; } 15 | public AM.IBrush? Brush { get; set; } 16 | public AM.IPen? Pen { get; set; } 17 | public A.Matrix Rotation { get; set; } 18 | public A.Point Point { get; set; } 19 | 20 | public abstract void Draw(object? dc); 21 | 22 | public virtual void UpdateStyle() 23 | { 24 | if (ShapeStyleViewModel?.Fill?.Color is { }) 25 | { 26 | Brush = AvaloniaDrawUtil.ToBrush(ShapeStyleViewModel.Fill.Color); 27 | } 28 | 29 | if (ShapeStyleViewModel?.Stroke is { }) 30 | { 31 | Pen = AvaloniaDrawUtil.ToPen(ShapeStyleViewModel, ShapeStyleViewModel.Stroke.Thickness); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/Avalonia/Nodes/Markers/NoneMarker.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Modules.Renderer.Avalonia.Nodes.Markers; 3 | 4 | internal class NoneMarker : MarkerBase 5 | { 6 | public override void Draw(object? dc) 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/Avalonia/Nodes/Markers/RectangleMarker.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using A = Avalonia; 3 | using AM = Avalonia.Media; 4 | using AP = Avalonia.Platform; 5 | 6 | namespace Core2D.Modules.Renderer.Avalonia.Nodes.Markers; 7 | 8 | internal class RectangleMarker : MarkerBase 9 | { 10 | public A.Rect Rect { get; set; } 11 | 12 | public override void Draw(object? dc) 13 | { 14 | if (dc is not AM.DrawingContext context) 15 | { 16 | return; 17 | } 18 | 19 | if (ShapeViewModel is null) 20 | { 21 | return; 22 | } 23 | 24 | using var rotationDisposable = context.PushTransform(Rotation); 25 | 26 | if (ShapeViewModel.IsFilled) 27 | { 28 | context.DrawRectangle(Brush, null, Rect); 29 | } 30 | 31 | if (ShapeViewModel.IsStroked) 32 | { 33 | context.DrawRectangle(null, Pen, Rect); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/Avalonia/Nodes/PathDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model.Renderer; 3 | using Core2D.Model.Renderer.Nodes; 4 | using Core2D.ViewModels.Shapes; 5 | using Core2D.ViewModels.Style; 6 | using A = Avalonia; 7 | using AM = Avalonia.Media; 8 | using AP = Avalonia.Platform; 9 | 10 | namespace Core2D.Modules.Renderer.Avalonia.Nodes; 11 | 12 | internal class PathDrawNode : DrawNode, IPathDrawNode 13 | { 14 | public PathShapeViewModel Path { get; set; } 15 | public AM.Geometry? Geometry { get; set; } 16 | 17 | public PathDrawNode(PathShapeViewModel path, ShapeStyleViewModel? style) 18 | { 19 | Style = style; 20 | Path = path; 21 | UpdateGeometry(); 22 | } 23 | 24 | public sealed override void UpdateGeometry() 25 | { 26 | ScaleThickness = Path.State.HasFlag(ShapeStateFlags.Thickness); 27 | ScaleSize = Path.State.HasFlag(ShapeStateFlags.Size); 28 | Geometry = PathGeometryConverter.ToGeometryImpl(Path, Path.IsFilled); 29 | Center = Geometry is { } ? Geometry.Bounds.Center : new A.Point(); 30 | } 31 | 32 | public override void OnDraw(object? dc, double zoom) 33 | { 34 | if (dc is not AM.DrawingContext context) 35 | { 36 | return; 37 | } 38 | 39 | if (Geometry is { }) 40 | { 41 | context.DrawGeometry(Path.IsFilled ? Fill : null, Path.IsStroked ? Stroke : null, Geometry); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/Avalonia/Nodes/PointDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model.Renderer.Nodes; 3 | using Core2D.Spatial; 4 | using Core2D.ViewModels.Shapes; 5 | using Core2D.ViewModels.Style; 6 | using A = Avalonia; 7 | using AM = Avalonia.Media; 8 | using AP = Avalonia.Platform; 9 | 10 | namespace Core2D.Modules.Renderer.Avalonia.Nodes; 11 | 12 | internal class PointDrawNode : DrawNode, IPointDrawNode 13 | { 14 | public PointShapeViewModel Point { get; set; } 15 | public double PointSize { get; set; } 16 | public A.Rect Rect { get; set; } 17 | 18 | public PointDrawNode(PointShapeViewModel point, ShapeStyleViewModel? pointStyleViewModel, double pointSize) 19 | { 20 | Style = pointStyleViewModel; 21 | Point = point; 22 | PointSize = pointSize; 23 | UpdateGeometry(); 24 | } 25 | 26 | public sealed override void UpdateGeometry() 27 | { 28 | ScaleThickness = true; // Point.State.HasFlag(ShapeStateFlags.Thickness); 29 | ScaleSize = true; // Point.State.HasFlag(ShapeStateFlags.Size); 30 | var rect2 = Rect2.FromPoints(Point.X - PointSize, Point.Y - PointSize, Point.X + PointSize, Point.Y + PointSize); 31 | Rect = new A.Rect(rect2.X, rect2.Y, rect2.Width, rect2.Height); 32 | Center = Rect.Center; 33 | } 34 | 35 | public override void OnDraw(object? dc, double zoom) 36 | { 37 | if (dc is not AM.DrawingContext context) 38 | { 39 | return; 40 | } 41 | 42 | context.DrawRectangle(Fill, null, Rect); 43 | context.DrawRectangle(null, Stroke, Rect); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/Avalonia/Nodes/QuadraticBezierDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model.Renderer; 3 | using Core2D.Model.Renderer.Nodes; 4 | using Core2D.ViewModels.Shapes; 5 | using Core2D.ViewModels.Style; 6 | using A = Avalonia; 7 | using AM = Avalonia.Media; 8 | using AP = Avalonia.Platform; 9 | 10 | namespace Core2D.Modules.Renderer.Avalonia.Nodes; 11 | 12 | internal class QuadraticBezierDrawNode : DrawNode, IQuadraticBezierDrawNode 13 | { 14 | public QuadraticBezierShapeViewModel QuadraticBezier { get; set; } 15 | public AM.Geometry? Geometry { get; set; } 16 | 17 | public QuadraticBezierDrawNode(QuadraticBezierShapeViewModel quadraticBezier, ShapeStyleViewModel? style) 18 | { 19 | Style = style; 20 | QuadraticBezier = quadraticBezier; 21 | UpdateGeometry(); 22 | } 23 | 24 | public sealed override void UpdateGeometry() 25 | { 26 | ScaleThickness = QuadraticBezier.State.HasFlag(ShapeStateFlags.Thickness); 27 | ScaleSize = QuadraticBezier.State.HasFlag(ShapeStateFlags.Size); 28 | Geometry = PathGeometryConverter.ToGeometryImpl(QuadraticBezier); 29 | Center = Geometry is { } ? Geometry.Bounds.Center : new A.Point(); 30 | } 31 | 32 | public override void OnDraw(object? dc, double zoom) 33 | { 34 | if (dc is not AM.DrawingContext context) 35 | { 36 | return; 37 | } 38 | 39 | if (Geometry is { }) 40 | { 41 | context.DrawGeometry(QuadraticBezier.IsFilled ? Fill : null, QuadraticBezier.IsStroked ? Stroke : null, Geometry); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/SkiaSharp/Nodes/ArcDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model.Renderer; 3 | using Core2D.Model.Renderer.Nodes; 4 | using Core2D.ViewModels.Shapes; 5 | using Core2D.ViewModels.Style; 6 | using SkiaSharp; 7 | 8 | namespace Core2D.Modules.Renderer.SkiaSharp.Nodes; 9 | 10 | internal class ArcDrawNode : DrawNode, IArcDrawNode 11 | { 12 | public ArcShapeViewModel Arc { get; set; } 13 | public SKPath? Geometry { get; set; } 14 | 15 | public ArcDrawNode(ArcShapeViewModel arc, ShapeStyleViewModel? style) 16 | { 17 | Style = style; 18 | Arc = arc; 19 | UpdateGeometry(); 20 | } 21 | 22 | public sealed override void UpdateGeometry() 23 | { 24 | ScaleThickness = Arc.State.HasFlag(ShapeStateFlags.Thickness); 25 | ScaleSize = Arc.State.HasFlag(ShapeStateFlags.Size); 26 | Geometry = PathGeometryConverter.ToSKPath(Arc); 27 | if (Geometry is { }) 28 | { 29 | Center = new SKPoint(Geometry.Bounds.MidX, Geometry.Bounds.MidY); 30 | } 31 | else 32 | { 33 | Center = SKPoint.Empty; 34 | } 35 | } 36 | 37 | public override void OnDraw(object? dc, double zoom) 38 | { 39 | if (dc is not SKCanvas canvas) 40 | { 41 | return; 42 | } 43 | 44 | if (Arc.IsFilled) 45 | { 46 | canvas.DrawPath(Geometry, Fill); 47 | } 48 | 49 | if (Arc.IsStroked) 50 | { 51 | canvas.DrawPath(Geometry, Stroke); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/SkiaSharp/Nodes/Markers/ArrowMarker.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using SkiaSharp; 3 | 4 | namespace Core2D.Modules.Renderer.SkiaSharp.Nodes.Markers; 5 | 6 | internal class ArrowMarker : MarkerBase 7 | { 8 | public SKPoint P11; 9 | public SKPoint P21; 10 | public SKPoint P12; 11 | public SKPoint P22; 12 | 13 | public override void Draw(object? dc) 14 | { 15 | if (dc is not SKCanvas canvas) 16 | { 17 | return; 18 | } 19 | 20 | if (ShapeViewModel is { } && ShapeViewModel.IsStroked) 21 | { 22 | canvas.DrawLine(P11, P21, Pen); 23 | canvas.DrawLine(P12, P22, Pen); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/SkiaSharp/Nodes/Markers/EllipseMarker.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using SkiaSharp; 3 | 4 | namespace Core2D.Modules.Renderer.SkiaSharp.Nodes.Markers; 5 | 6 | internal class EllipseMarker : MarkerBase 7 | { 8 | public SKRect Rect { get; set; } 9 | 10 | public override void Draw(object? dc) 11 | { 12 | if (dc is not SKCanvas canvas) 13 | { 14 | return; 15 | } 16 | 17 | if (ShapeViewModel is null) 18 | { 19 | return; 20 | } 21 | 22 | var count = canvas.Save(); 23 | canvas.SetMatrix(MatrixHelper.Multiply(Rotation, canvas.TotalMatrix)); 24 | 25 | if (ShapeViewModel.IsFilled) 26 | { 27 | canvas.DrawOval(Rect, Brush); 28 | } 29 | 30 | if (ShapeViewModel.IsStroked) 31 | { 32 | canvas.DrawOval(Rect, Pen); 33 | } 34 | 35 | canvas.RestoreToCount(count); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/SkiaSharp/Nodes/Markers/MarkerBase.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model.Renderer.Nodes; 3 | using Core2D.ViewModels.Shapes; 4 | using Core2D.ViewModels.Style; 5 | using SkiaSharp; 6 | 7 | namespace Core2D.Modules.Renderer.SkiaSharp.Nodes.Markers; 8 | 9 | internal abstract class MarkerBase : IMarker 10 | { 11 | public BaseShapeViewModel? ShapeViewModel { get; set; } 12 | public ShapeStyleViewModel? ShapeStyleViewModel { get; set; } 13 | public ArrowStyleViewModel? Style { get; set; } 14 | public SKPaint? Brush { get; set; } 15 | public SKPaint? Pen { get; set; } 16 | public SKMatrix Rotation { get; set; } 17 | public SKPoint Point { get; set; } 18 | 19 | public abstract void Draw(object? dc); 20 | 21 | public virtual void UpdateStyle() 22 | { 23 | if (ShapeStyleViewModel?.Fill?.Color is { }) 24 | { 25 | Brush = SkiaSharpDrawUtil.ToSKPaintBrush(ShapeStyleViewModel.Fill.Color); 26 | } 27 | 28 | if (ShapeStyleViewModel?.Stroke is { }) 29 | { 30 | Pen = SkiaSharpDrawUtil.ToSKPaintPen(ShapeStyleViewModel, ShapeStyleViewModel.Stroke.Thickness); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/SkiaSharp/Nodes/Markers/NoneMarker.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.Modules.Renderer.SkiaSharp.Nodes.Markers; 3 | 4 | internal class NoneMarker : MarkerBase 5 | { 6 | public override void Draw(object? dc) 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/SkiaSharp/Nodes/Markers/RectangleMarker.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using SkiaSharp; 3 | 4 | namespace Core2D.Modules.Renderer.SkiaSharp.Nodes.Markers; 5 | 6 | internal class RectangleMarker : MarkerBase 7 | { 8 | public SKRect Rect { get; set; } 9 | 10 | public override void Draw(object? dc) 11 | { 12 | if (dc is not SKCanvas canvas) 13 | { 14 | return; 15 | } 16 | 17 | if (ShapeViewModel is null) 18 | { 19 | return; 20 | } 21 | 22 | var count = canvas.Save(); 23 | canvas.SetMatrix(MatrixHelper.Multiply(Rotation, canvas.TotalMatrix)); 24 | 25 | if (ShapeViewModel.IsFilled) 26 | { 27 | canvas.DrawRect(Rect, Brush); 28 | } 29 | 30 | if (ShapeViewModel.IsStroked) 31 | { 32 | canvas.DrawRect(Rect, Pen); 33 | } 34 | 35 | canvas.RestoreToCount(count); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/SkiaSharp/Nodes/PathDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model.Renderer; 3 | using Core2D.Model.Renderer.Nodes; 4 | using Core2D.ViewModels.Shapes; 5 | using Core2D.ViewModels.Style; 6 | using SkiaSharp; 7 | 8 | namespace Core2D.Modules.Renderer.SkiaSharp.Nodes; 9 | 10 | internal class PathDrawNode : DrawNode, IPathDrawNode 11 | { 12 | public PathShapeViewModel Path { get; set; } 13 | public SKPath? Geometry { get; set; } 14 | 15 | public PathDrawNode(PathShapeViewModel path, ShapeStyleViewModel? style) 16 | { 17 | Style = style; 18 | Path = path; 19 | UpdateGeometry(); 20 | } 21 | 22 | public sealed override void UpdateGeometry() 23 | { 24 | ScaleThickness = Path.State.HasFlag(ShapeStateFlags.Thickness); 25 | ScaleSize = Path.State.HasFlag(ShapeStateFlags.Size); 26 | Geometry = PathGeometryConverter.ToSKPath(Path); 27 | if (Geometry is { }) 28 | { 29 | Center = new SKPoint(Geometry.Bounds.MidX, Geometry.Bounds.MidY); 30 | } 31 | else 32 | { 33 | Center = SKPoint.Empty; 34 | } 35 | } 36 | 37 | public override void OnDraw(object? dc, double zoom) 38 | { 39 | if (dc is not SKCanvas canvas) 40 | { 41 | return; 42 | } 43 | 44 | if (Path.IsFilled) 45 | { 46 | canvas.DrawPath(Geometry, Fill); 47 | } 48 | 49 | if (Path.IsStroked) 50 | { 51 | canvas.DrawPath(Geometry, Stroke); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/SkiaSharp/Nodes/PointDrawNode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model.Renderer.Nodes; 3 | using Core2D.ViewModels.Shapes; 4 | using Core2D.ViewModels.Style; 5 | using SkiaSharp; 6 | using Core2D.Spatial; 7 | 8 | namespace Core2D.Modules.Renderer.SkiaSharp.Nodes; 9 | 10 | internal class PointDrawNode : DrawNode, IPointDrawNode 11 | { 12 | public PointShapeViewModel Point { get; set; } 13 | public double PointSize { get; set; } 14 | public SKRect Rect { get; set; } 15 | 16 | public PointDrawNode(PointShapeViewModel point, ShapeStyleViewModel? pointStyleViewModel, double pointSize) 17 | { 18 | Style = pointStyleViewModel; 19 | Point = point; 20 | PointSize = pointSize; 21 | UpdateGeometry(); 22 | } 23 | 24 | public sealed override void UpdateGeometry() 25 | { 26 | ScaleThickness = true; // Point.State.HasFlag(ShapeStateFlags.Thickness); 27 | ScaleSize = true; // Point.State.HasFlag(ShapeStateFlags.Size); 28 | var rect2 = Rect2.FromPoints(Point.X - PointSize, Point.Y - PointSize, Point.X + PointSize, Point.Y + PointSize); 29 | Rect = SKRect.Create((float)rect2.X, (float)rect2.Y, (float)rect2.Width, (float)rect2.Height); 30 | Center = new SKPoint(Rect.MidX, Rect.MidY); 31 | } 32 | 33 | public override void OnDraw(object? dc, double zoom) 34 | { 35 | if (dc is not SKCanvas canvas) 36 | { 37 | return; 38 | } 39 | 40 | canvas.DrawRect(Rect, Fill); 41 | canvas.DrawRect(Rect, Stroke); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Core2D/Modules/Renderer/SkiaSharp/SkiaSharpRendererViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using Core2D.ViewModels.Renderer; 4 | 5 | namespace Core2D.Modules.Renderer.SkiaSharp; 6 | 7 | public class SkiaSharpRendererViewModel : NodeRendererViewModel 8 | { 9 | public SkiaSharpRendererViewModel(IServiceProvider? serviceProvider) 10 | : base(serviceProvider, new SkiaSharpDrawNodeFactory()) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Core2D/Modules/ScriptRunner/Roslyn/RoslynScriptRunner.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Threading.Tasks; 4 | using Core2D.Model; 5 | using Core2D.ViewModels; 6 | using Core2D.ViewModels.Editor; 7 | using Microsoft.CodeAnalysis.CSharp.Scripting; 8 | using Microsoft.CodeAnalysis.Scripting; 9 | 10 | namespace Core2D.Modules.ScriptRunner.Roslyn; 11 | 12 | public class RoslynScriptRunner : IScriptRunner 13 | { 14 | private readonly IServiceProvider? _serviceProvider; 15 | 16 | public RoslynScriptRunner(IServiceProvider? serviceProvider) 17 | { 18 | _serviceProvider = serviceProvider; 19 | } 20 | 21 | public async Task Execute(string code, object? state) 22 | { 23 | try 24 | { 25 | if (state is ScriptState previousState) 26 | { 27 | return await previousState.ContinueWithAsync(code); 28 | } 29 | var options = ScriptOptions.Default.WithImports("System"); 30 | var editor = _serviceProvider.GetService(); 31 | return await CSharpScript.RunAsync(code, options, editor); 32 | } 33 | catch (CompilationErrorException ex) 34 | { 35 | var log = _serviceProvider.GetService(); 36 | log?.LogException(ex); 37 | log?.LogError($"{Environment.NewLine}{ex.Diagnostics}"); 38 | } 39 | return null; 40 | } 41 | } -------------------------------------------------------------------------------- /src/Core2D/Modules/Serializer/Newtonsoft/NewtonsoftJsonSerializer.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.ObjectModel; 3 | using Autofac; 4 | using Core2D.Model; 5 | using Newtonsoft.Json; 6 | using Newtonsoft.Json.Converters; 7 | 8 | namespace Core2D.Modules.Serializer.Newtonsoft; 9 | 10 | public sealed class NewtonsoftJsonSerializer : IJsonSerializer 11 | { 12 | private readonly JsonSerializerSettings _settings; 13 | 14 | public NewtonsoftJsonSerializer(ILifetimeScope lifetimeScope) 15 | { 16 | _settings = new JsonSerializerSettings 17 | { 18 | Formatting = Formatting.Indented, 19 | TypeNameHandling = TypeNameHandling.Objects, 20 | PreserveReferencesHandling = PreserveReferencesHandling.Objects, 21 | ReferenceLoopHandling = ReferenceLoopHandling.Serialize, 22 | ContractResolver = new ProjectContractResolver(lifetimeScope, typeof(ObservableCollection<>)), 23 | NullValueHandling = NullValueHandling.Ignore, 24 | Converters = 25 | { 26 | new KeyValuePairConverter() 27 | } 28 | }; 29 | } 30 | 31 | string IJsonSerializer.Serialize(T? value) where T : default 32 | { 33 | return JsonConvert.SerializeObject(value, _settings); 34 | } 35 | 36 | T? IJsonSerializer.Deserialize(string json) where T : default 37 | { 38 | return JsonConvert.DeserializeObject(json, _settings); 39 | } 40 | } -------------------------------------------------------------------------------- /src/Core2D/Modules/ServiceProvider/Autofac/AutofacServiceProvider.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using Autofac; 4 | 5 | namespace Core2D.Modules.ServiceProvider.Autofac; 6 | 7 | public class AutofacServiceProvider : IServiceProvider 8 | { 9 | private readonly ILifetimeScope _scope; 10 | 11 | public AutofacServiceProvider(ILifetimeScope scope) 12 | { 13 | _scope = scope; 14 | } 15 | 16 | object IServiceProvider.GetService(Type serviceType) 17 | { 18 | return _scope.Resolve(serviceType); 19 | } 20 | } -------------------------------------------------------------------------------- /src/Core2D/Settings.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Core2D; 4 | 5 | public class Settings 6 | { 7 | public string? Theme { get; set; } = null; 8 | public FileInfo[]? Scripts { get; set; } 9 | public FileInfo? Project { get; set; } 10 | public bool UseSkia { get; set; } 11 | public bool UseGpu { get; set; } = true; 12 | public bool AllowEglInitialization { get; set; } = true; 13 | public bool UseWgl { get; set; } 14 | public bool UseWindowsUIComposition { get; set; } = true; 15 | public bool UseDirectX11 { get; set; } 16 | public bool UseManagedSystemDialogs { get; set; } 17 | public bool UseHeadless { get; set; } 18 | public bool UseHeadlessDrawing { get; set; } 19 | public bool UseHeadlessVnc { get; set; } 20 | public string? VncHost { get; set; } = null; 21 | public int VncPort { get; set; } = 5901; 22 | } 23 | -------------------------------------------------------------------------------- /src/Core2D/Spatial/ConvexHull/MonotoneChain.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Core2D.Spatial.ConvexHull; 4 | 5 | public class MonotoneChain 6 | { 7 | public double Cross(Vector2 p1, Vector2 p2, Vector2 p3) 8 | { 9 | return ((p2.X - p1.X) * (p3.Y - p1.Y)) - ((p2.Y - p1.Y) * (p3.X - p1.X)); 10 | } 11 | 12 | public void ConvexHull(Vector2[] vertices, out Vector2[] hull, out int k) 13 | { 14 | int n = vertices.Length; 15 | int i, t; 16 | 17 | k = 0; 18 | hull = new Vector2[2 * n]; 19 | 20 | Array.Sort(vertices); 21 | 22 | for (i = 0; i < n; i++) 23 | { 24 | while (k >= 2 && Cross(hull[k - 2], hull[k - 1], vertices[i]) <= 0) 25 | k--; 26 | 27 | hull[k++] = vertices[i]; 28 | } 29 | 30 | for (i = n - 2, t = k + 1; i >= 0; i--) 31 | { 32 | while (k >= t && Cross(hull[k - 2], hull[k - 1], vertices[i]) <= 0) 33 | k--; 34 | 35 | hull[k++] = vertices[i]; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/Core2D/Spatial/Polygon2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Core2D.Spatial; 4 | 5 | public struct Polygon2 6 | { 7 | public Point2[] Points; 8 | 9 | public Polygon2(Point2[] points) 10 | { 11 | Points = points; 12 | } 13 | 14 | public bool Contains(double x, double y) 15 | { 16 | bool contains = false; 17 | for (int i = 0, j = Points.Length - 1; i < Points.Length; j = i++) 18 | { 19 | if (((Points[i].Y > y) != (Points[j].Y > y)) 20 | && (x < (((Points[j].X - Points[i].X) * (y - Points[i].Y)) / (Points[j].Y - Points[i].Y)) + Points[i].X)) 21 | { 22 | contains = !contains; 23 | } 24 | } 25 | return contains; 26 | } 27 | 28 | public bool Contains(Point2 point) 29 | { 30 | return Contains(point.X, point.Y); 31 | } 32 | } -------------------------------------------------------------------------------- /src/Core2D/Spatial/Sat/MinimumTranslationVector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Core2D.Spatial.Sat; 4 | 5 | public struct MinimumTranslationVector 6 | { 7 | public readonly Vector2 Smallest; 8 | public readonly double Overlap; 9 | 10 | public MinimumTranslationVector(Vector2 smallest, double overlap) 11 | { 12 | Smallest = smallest; 13 | Overlap = overlap; 14 | } 15 | } -------------------------------------------------------------------------------- /src/Core2D/Spatial/Sat/Projection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Core2D.Spatial.Sat; 4 | 5 | public struct Projection 6 | { 7 | public readonly double Min; 8 | public readonly double Max; 9 | 10 | public Projection(double min, double max) 11 | { 12 | Min = min; 13 | Max = max; 14 | } 15 | 16 | public bool Overlap(Projection p) 17 | { 18 | return !(Min > p.Max || p.Min > Max); 19 | } 20 | 21 | public double GetOverlap(Projection p) 22 | { 23 | return !Overlap(p) ? 0.0 : Math.Abs(Math.Max(Min, p.Min) - Math.Min(Max, p.Max)); 24 | } 25 | 26 | public bool Contains(Projection p) 27 | { 28 | return Min <= p.Min && Max >= p.Max; 29 | } 30 | } -------------------------------------------------------------------------------- /src/Core2D/Spatial/Size2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Core2D.Spatial; 4 | 5 | public struct Size2 6 | { 7 | public readonly double Width; 8 | public readonly double Height; 9 | 10 | public Size2(double width, double height) 11 | { 12 | Width = width; 13 | Height = height; 14 | } 15 | 16 | public void Deconstruct(out double width, out double height) 17 | { 18 | width = Width; 19 | height = Height; 20 | } 21 | } -------------------------------------------------------------------------------- /src/Core2D/Styles/Dock.axaml: -------------------------------------------------------------------------------- 1 |  4 | 20 | 27 | 28 | -------------------------------------------------------------------------------- /src/Core2D/Util/Utilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Avalonia.Threading; 4 | 5 | namespace Core2D.Util; 6 | 7 | public static class Utilities 8 | { 9 | public static async Task RunUiJob(Action action) 10 | { 11 | await Dispatcher.UIThread.InvokeAsync(() => 12 | { 13 | action.Invoke(); 14 | Dispatcher.UIThread.RunJobs(); 15 | }); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Core2D/ViewLocator.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using Avalonia.Controls; 4 | using Avalonia.Controls.Templates; 5 | using Core2D.ViewModels; 6 | using Dock.Model.Mvvm.Core; 7 | using StaticViewLocator; 8 | 9 | namespace Core2D; 10 | 11 | [StaticViewLocator] 12 | public partial class ViewLocator : IDataTemplate 13 | { 14 | public Control? Build(object? data) 15 | { 16 | if (data is null) 17 | { 18 | return null; 19 | } 20 | 21 | var type = data.GetType(); 22 | 23 | if (s_views.TryGetValue(type, out var func)) 24 | { 25 | return func.Invoke(); 26 | } 27 | 28 | throw new Exception($"Unable to create view for type: {type}"); 29 | } 30 | 31 | public bool Match(object? data) 32 | { 33 | return data is ViewModelBase or DockableBase; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Containers/BaseContainerViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Core2D.ViewModels.Containers; 5 | 6 | public abstract partial class BaseContainerViewModel : ViewModelBase 7 | { 8 | [AutoNotify] private bool _isVisible; 9 | [AutoNotify] private bool _isExpanded; 10 | 11 | protected BaseContainerViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 12 | { 13 | _isVisible = true; 14 | _isExpanded = false; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Containers/ProjectContainerViewModelExtensions.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Core2D.ViewModels.Shapes; 5 | 6 | namespace Core2D.ViewModels.Containers; 7 | 8 | public static class ProjectContainerViewModelExtensions 9 | { 10 | public static IEnumerable GetAllShapes(this ProjectContainerViewModel project) 11 | { 12 | var shapes = project.Documents 13 | .SelectMany(d => d.Pages) 14 | .SelectMany(c => c.Layers) 15 | .SelectMany(l => l.Shapes); 16 | 17 | return shapes.GetAllShapes().Where(s => s is T).Cast(); 18 | } 19 | 20 | public static IEnumerable GetAllShapes(this ProjectContainerViewModel project) 21 | { 22 | return project.Documents 23 | .SelectMany(d => d.Pages) 24 | .SelectMany(c => c.Layers) 25 | .SelectMany(l => l.Shapes); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Data/Bindings/BindingParser.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | 4 | namespace Core2D.ViewModels.Data.Bindings; 5 | 6 | internal static class BindingParser 7 | { 8 | private const char StartChar = '{'; 9 | private const char EndChar = '}'; 10 | 11 | public static List Parse(string text) 12 | { 13 | var bindings = new List(); 14 | 15 | for (int i = 0; i < text.Length; i++) 16 | { 17 | var start = text.IndexOf(StartChar, i); 18 | if (start >= 0) 19 | { 20 | var end = text.IndexOf(EndChar, start); 21 | if (end >= start) 22 | { 23 | var length = end - start + 1; 24 | var path = text.Substring(start + 1, length - 2); 25 | var value = text.Substring(start, length); 26 | var binding = new BindingPart(start, length, path, value); 27 | bindings.Add(binding); 28 | i = end; 29 | } 30 | } 31 | } 32 | 33 | return bindings; 34 | } 35 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Data/Bindings/BindingPart.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.ViewModels.Data.Bindings; 3 | 4 | internal readonly struct BindingPart 5 | { 6 | public readonly int Start; 7 | public readonly int Length; 8 | public readonly string Path; 9 | public readonly string Value; 10 | 11 | public BindingPart(int start, int length, string path, string value) 12 | { 13 | Start = start; 14 | Length = length; 15 | Path = path; 16 | Value = value; 17 | } 18 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Data/ColumnViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace Core2D.ViewModels.Data; 6 | 7 | public partial class ColumnViewModel : ViewModelBase 8 | { 9 | [AutoNotify] private bool _isVisible; 10 | 11 | public ColumnViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 12 | { 13 | } 14 | 15 | public override object Copy(IDictionary? shared) 16 | { 17 | var copy = new ColumnViewModel(ServiceProvider) 18 | { 19 | Name = Name, 20 | IsVisible = IsVisible 21 | }; 22 | 23 | return copy; 24 | } 25 | 26 | public override bool IsDirty() 27 | { 28 | var isDirty = base.IsDirty(); 29 | return isDirty; 30 | } 31 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Data/PropertyViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | using System.Windows.Input; 6 | using CommunityToolkit.Mvvm.Input; 7 | using Core2D.ViewModels.Containers; 8 | using Core2D.ViewModels.Editor; 9 | 10 | namespace Core2D.ViewModels.Data; 11 | 12 | public partial class PropertyViewModel : ViewModelBase 13 | { 14 | [AutoNotify] private string? _value; 15 | 16 | public PropertyViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 17 | { 18 | AddProperty = new RelayCommand(x => GetProject()?.OnAddProperty(x)); 19 | 20 | RemoveProperty = new RelayCommand(x => GetProject()?.OnRemoveProperty(x)); 21 | 22 | ProjectContainerViewModel? GetProject() => ServiceProvider.GetService()?.Project; 23 | } 24 | 25 | [IgnoreDataMember] 26 | public ICommand AddProperty { get; } 27 | 28 | [IgnoreDataMember] 29 | public ICommand RemoveProperty { get; } 30 | 31 | public override object Copy(IDictionary? shared) 32 | { 33 | var copy = new PropertyViewModel(ServiceProvider) 34 | { 35 | Name = Name, 36 | Value = Value 37 | }; 38 | 39 | return copy; 40 | } 41 | 42 | public override bool IsDirty() 43 | { 44 | var isDirty = base.IsDirty(); 45 | return isDirty; 46 | } 47 | 48 | public override string ToString() => _value ?? ""; 49 | } 50 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Data/ValueViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace Core2D.ViewModels.Data; 6 | 7 | public partial class ValueViewModel : ViewModelBase 8 | { 9 | [AutoNotify] private string? _content; 10 | 11 | public ValueViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 12 | { 13 | } 14 | 15 | public override object Copy(IDictionary? shared) 16 | { 17 | var copy = new ValueViewModel(ServiceProvider) 18 | { 19 | Name = Name, 20 | Content = Content 21 | }; 22 | 23 | return copy; 24 | } 25 | 26 | public override bool IsDirty() 27 | { 28 | var isDirty = base.IsDirty(); 29 | return isDirty; 30 | } 31 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Docks/PageDocumentDock.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using CommunityToolkit.Mvvm.Input; 4 | using Core2D.ViewModels.Docking.Documents; 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Docks; 8 | 9 | public class PageDocumentDock : DocumentDock 10 | { 11 | public PageDocumentDock() 12 | { 13 | CreateDocument = new RelayCommand(CreatePage); 14 | } 15 | 16 | private void CreatePage() 17 | { 18 | if (!CanCreateDocument) 19 | { 20 | return; 21 | } 22 | 23 | var page = new PageViewModel() 24 | { 25 | Id = "PageDocument", 26 | Title = "Page" 27 | }; 28 | 29 | Factory?.AddDockable(this, page); 30 | Factory?.SetActiveDockable(page); 31 | Factory?.SetFocusedDockable(this, page); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Documents/PageViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Documents; 5 | 6 | public class PageViewModel : Document 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Libraries/DatabaseLibraryViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Libraries; 5 | 6 | public class DatabaseLibraryViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Libraries/GroupLibraryViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Libraries; 5 | 6 | public class GroupLibraryViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Libraries/ScriptLibraryViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Libraries; 5 | 6 | public class ScriptLibraryViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Libraries/StyleLibraryViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Libraries; 5 | 6 | public class StyleLibraryViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Libraries/TemplateLibraryViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Libraries; 5 | 6 | public class TemplateLibraryViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/ObjectBrowserViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools; 5 | 6 | public class ObjectBrowserViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Options/ImageOptionsViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Options; 5 | 6 | public class ImageOptionsViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Options/ProjectOptionsViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Options; 5 | 6 | public class ProjectOptionsViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Options/RendererOptionsViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Options; 5 | 6 | public class RendererOptionsViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Options/ZoomOptionsViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Options; 5 | 6 | public class ZoomOptionsViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/ProjectExplorerViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools; 5 | 6 | public class ProjectExplorerViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Properties/DataPropertiesViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Properties; 5 | 6 | public class DataPropertiesViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Properties/PagePropertiesViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Properties; 5 | 6 | public class PagePropertiesViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Properties/ShapePropertiesViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Properties; 5 | 6 | public class ShapePropertiesViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Properties/StatePropertiesViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Properties; 5 | 6 | public class StatePropertiesViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Tools/Properties/StylePropertiesViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Controls; 3 | 4 | namespace Core2D.ViewModels.Docking.Tools.Properties; 5 | 6 | public class StylePropertiesViewModel : Tool 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Views/DashboardMenuViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Core; 3 | 4 | namespace Core2D.ViewModels.Docking.Views; 5 | 6 | public class DashboardMenuViewModel : DockBase 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Views/DashboardViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Core; 3 | 4 | namespace Core2D.ViewModels.Docking.Views; 5 | 6 | public class DashboardViewModel : DockBase 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Views/HomeMenuViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Core; 3 | 4 | namespace Core2D.ViewModels.Docking.Views; 5 | 6 | public class HomeMenuViewModel : DockBase 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Views/HomeStatusBarViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Core; 3 | 4 | namespace Core2D.ViewModels.Docking.Views; 5 | 6 | public class HomeStatusBarViewModel : DockBase 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Docking/Views/HomeViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Dock.Model.Mvvm.Core; 3 | 4 | namespace Core2D.ViewModels.Docking.Views; 5 | 6 | public class HomeViewModel : DockBase 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Editor/AboutInfoViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace Core2D.ViewModels.Editor; 6 | 7 | public class AboutInfoViewModel : ViewModelBase 8 | { 9 | public string? Title { get; set; } 10 | 11 | public string? Version { get; set; } 12 | 13 | public string? Description { get; set; } 14 | 15 | public string? Copyright { get; set; } 16 | 17 | public string? License { get; set; } 18 | 19 | public AboutInfoViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 20 | { 21 | } 22 | 23 | public override object Copy(IDictionary? shared) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | 28 | public override string ToString() => 29 | $"{nameof(Title)}: {Title}{Environment.NewLine}" + 30 | $"{nameof(Version)}: {Version}{Environment.NewLine}" + 31 | $"{nameof(Description)}: {Description}{Environment.NewLine}" + 32 | $"{nameof(Copyright)}: {Copyright}{Environment.NewLine}" + 33 | $"{nameof(License)}: {License}{Environment.NewLine}"; 34 | } 35 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Editor/DialogViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using Core2D.Model.Editor; 5 | 6 | namespace Core2D.ViewModels.Editor; 7 | 8 | public partial class DialogViewModel : ViewModelBase 9 | { 10 | private readonly IDialogPresenter _dialogPresenter; 11 | 12 | [AutoNotify] private string? _title; 13 | [AutoNotify] private bool _isOverlayVisible; 14 | [AutoNotify] private bool _isTitleBarVisible; 15 | [AutoNotify] private bool _isCloseButtonVisible; 16 | [AutoNotify] private ViewModelBase? _viewModel; 17 | 18 | public DialogViewModel(IServiceProvider? serviceProvider, IDialogPresenter dialogPresenter) : base(serviceProvider) 19 | { 20 | _dialogPresenter = dialogPresenter; 21 | } 22 | 23 | public override object Copy(IDictionary? shared) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | 28 | public void Show() 29 | { 30 | _dialogPresenter.ShowDialog(this); 31 | } 32 | 33 | public void Close() 34 | { 35 | _dialogPresenter.CloseDialog(this); 36 | } 37 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Editor/History/UndoRedo.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Core2D.ViewModels.Editor.History; 5 | 6 | public readonly struct UndoRedo 7 | { 8 | public readonly Action? Undo; 9 | 10 | public readonly Action? Redo; 11 | 12 | private UndoRedo(Action? undo, Action? redo) 13 | { 14 | Undo = undo; 15 | Redo = redo; 16 | } 17 | 18 | public static UndoRedo Create(Action? undo, Action? redo) 19 | { 20 | return new UndoRedo(undo, redo); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Editor/IClipboardService.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using Core2D.ViewModels.Shapes; 5 | 6 | namespace Core2D.ViewModels.Editor; 7 | 8 | public interface IClipboardService 9 | { 10 | IList? Copy(IList shapes); 11 | void OnCopyShapes(IList shapes); 12 | void OnPasteShapes(IEnumerable? shapes); 13 | void OnTryPaste(string text); 14 | bool CanCopy(); 15 | Task CanPaste(); 16 | void OnCut(object? item); 17 | void OnCopy(object? item); 18 | void OnPaste(object? item); 19 | void OnDelete(object? item); 20 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Editor/ProjectEditorConfiguration.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.ViewModels.Editor; 3 | 4 | public class ProjectEditorConfiguration 5 | { 6 | public static string DefaultLayerName = "Layer"; 7 | 8 | public static string DefaultTemplateName = "Template"; 9 | 10 | public static string DefaultPageName = "Page"; 11 | 12 | public static string DefaultDocumentName = "Document"; 13 | 14 | public static string DefaultScriptName = "Script"; 15 | 16 | public static string DefaultDatabaseName = "Database"; 17 | 18 | public static string DefaultColumnName = "Column"; 19 | 20 | public static string DefaultPropertyName = "Property"; 21 | 22 | public static string DefaultValue = ""; 23 | 24 | public static string DefaultGroupLibraryName = "Groups"; 25 | 26 | public static string DefaultGroupName = "Group"; 27 | 28 | public static string DefaultStyleLibraryName = "Styles"; 29 | 30 | public static string DefaultStyleName = "Style"; 31 | 32 | public static string DefaultImportedDatabaseName = "Imported"; 33 | 34 | public static string DefaultProjectExtension = ".project"; 35 | 36 | public static string DefaultCsvExtension = ".csv"; 37 | 38 | public static string DefaultXlsxExtension = ".xlsx"; 39 | 40 | public static string DefaultJsonExtension = ".json"; 41 | 42 | public static string DefaultScriptExtension = ".csx"; 43 | 44 | public static string DefaultSvgExtension = ".svg"; 45 | 46 | public static string[] DefaultImageExtensions = { ".jpg", ".jpeg", ".png", "webp" }; 47 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Editor/Tools/NoneToolViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using Core2D.Model.Editor; 5 | using Core2D.Model.Input; 6 | using Core2D.ViewModels.Shapes; 7 | 8 | namespace Core2D.ViewModels.Editor.Tools; 9 | 10 | public partial class NoneToolViewModel : ViewModelBase, IEditorTool 11 | { 12 | public string Title => "None"; 13 | 14 | public NoneToolViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 15 | { 16 | } 17 | 18 | public override object Copy(IDictionary? shared) 19 | { 20 | throw new NotImplementedException(); 21 | } 22 | 23 | public void BeginDown(InputArgs args) 24 | { 25 | } 26 | 27 | public void BeginUp(InputArgs args) 28 | { 29 | } 30 | 31 | public void EndDown(InputArgs args) 32 | { 33 | } 34 | 35 | public void EndUp(InputArgs args) 36 | { 37 | } 38 | 39 | public void Move(InputArgs args) 40 | { 41 | } 42 | 43 | public void Move(BaseShapeViewModel? shape) 44 | { 45 | } 46 | 47 | public void Finalize(BaseShapeViewModel? shape) 48 | { 49 | } 50 | 51 | public void Reset() 52 | { 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Editor/Tools/Selection/PathSelection.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Containers; 3 | using Core2D.ViewModels.Shapes; 4 | using Core2D.ViewModels.Style; 5 | 6 | namespace Core2D.ViewModels.Editor.Tools.Selection; 7 | 8 | public partial class PathSelection 9 | { 10 | private readonly LayerContainerViewModel _layer; 11 | private readonly PathShapeViewModel _path; 12 | private readonly ShapeStyleViewModel _styleViewModel; 13 | 14 | public PathSelection(LayerContainerViewModel layer, PathShapeViewModel shape, ShapeStyleViewModel style) 15 | { 16 | _layer = layer; 17 | _path = shape; 18 | _styleViewModel = style; 19 | } 20 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Editor/Tools/Selection/PointSelection.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.ViewModels.Containers; 3 | using Core2D.ViewModels.Shapes; 4 | using Core2D.ViewModels.Style; 5 | 6 | namespace Core2D.ViewModels.Editor.Tools.Selection; 7 | 8 | public partial class PointSelection 9 | { 10 | private readonly LayerContainerViewModel _layer; 11 | private readonly PointShapeViewModel _shapeViewModel; 12 | private readonly ShapeStyleViewModel _styleViewModel; 13 | 14 | public PointSelection(LayerContainerViewModel layer, PointShapeViewModel shape, ShapeStyleViewModel style) 15 | { 16 | _layer = layer; 17 | _shapeViewModel = shape; 18 | _styleViewModel = style; 19 | } 20 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Layout/AlignMode.cs: -------------------------------------------------------------------------------- 1 | namespace Core2D.ViewModels.Layout; 2 | 3 | public enum AlignMode 4 | { 5 | Left, 6 | Centered, 7 | Right, 8 | Top, 9 | Center, 10 | Bottom 11 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Layout/Box.cs: -------------------------------------------------------------------------------- 1 | namespace Core2D.ViewModels.Layout; 2 | 3 | public struct Box 4 | { 5 | public decimal Left; 6 | public decimal Top; 7 | public decimal Right; 8 | public decimal Bottom; 9 | public decimal CenterX; 10 | public decimal CenterY; 11 | public decimal Width; 12 | public decimal Height; 13 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Layout/DistributeMode.cs: -------------------------------------------------------------------------------- 1 | namespace Core2D.ViewModels.Layout; 2 | 3 | public enum DistributeMode 4 | { 5 | Horizontal, 6 | Vertical 7 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Layout/FlipMode.cs: -------------------------------------------------------------------------------- 1 | namespace Core2D.ViewModels.Layout; 2 | 3 | public enum FlipMode 4 | { 5 | Horizontal, 6 | Vertical 7 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Layout/PointUtil.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using Core2D.ViewModels.Shapes; 4 | 5 | namespace Core2D.ViewModels.Layout; 6 | 7 | public static class PointUtil 8 | { 9 | public static decimal Snap(decimal value, decimal snap) 10 | { 11 | if (snap == 0m) 12 | { 13 | return value; 14 | } 15 | decimal c = value % snap; 16 | decimal r = c >= snap / 2m ? value + snap - c : value - c; 17 | return r; 18 | } 19 | 20 | public static int CompareX(PointShapeViewModel point1, PointShapeViewModel point2) 21 | { 22 | return (point1.X > point2.X) ? 1 : ((point1.X < point2.X) ? -1 : 0); 23 | } 24 | 25 | public static int CompareY(PointShapeViewModel point1, PointShapeViewModel point2) 26 | { 27 | return (point1.Y > point2.Y) ? 1 : ((point1.Y < point2.Y) ? -1 : 0); 28 | } 29 | 30 | public static void Rotate(PointShapeViewModel point, decimal radians, decimal centerX, decimal centerY, out decimal x, out decimal y) 31 | { 32 | x = ((decimal)point.X - centerX) * (decimal)Math.Cos((double)radians) - ((decimal)point.Y - centerY) * (decimal)Math.Sin((double)radians) + centerX; 33 | y = ((decimal)point.X - centerX) * (decimal)Math.Sin((double)radians) + ((decimal)point.Y - centerY) * (decimal)Math.Cos((double)radians) + centerY; 34 | } 35 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Layout/StackMode.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Core2D.ViewModels.Layout; 3 | 4 | public enum StackMode 5 | { 6 | Horizontal, 7 | Vertical 8 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Path/PathSegmentViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using Core2D.ViewModels.Shapes; 5 | 6 | namespace Core2D.ViewModels.Path; 7 | 8 | public abstract partial class PathSegmentViewModel : ViewModelBase 9 | { 10 | [AutoNotify] private bool _isStroked; 11 | 12 | protected PathSegmentViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 13 | { 14 | } 15 | 16 | public abstract void GetPoints(IList points); 17 | 18 | public abstract string ToXamlString(); 19 | 20 | public abstract string ToSvgString(); 21 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Path/PathSizeViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | 6 | namespace Core2D.ViewModels.Path; 7 | 8 | public partial class PathSizeViewModel : ViewModelBase 9 | { 10 | [AutoNotify] private double _width; 11 | [AutoNotify] private double _height; 12 | 13 | public PathSizeViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 14 | { 15 | } 16 | 17 | public override object Copy(IDictionary? shared) 18 | { 19 | var copy = new PathSizeViewModel(ServiceProvider) 20 | { 21 | Width = _width, 22 | Height = _height 23 | }; 24 | 25 | return copy; 26 | } 27 | 28 | public override bool IsDirty() 29 | { 30 | var isDirty = base.IsDirty(); 31 | return isDirty; 32 | } 33 | 34 | public string ToXamlString() 35 | => $"{_width.ToString(CultureInfo.InvariantCulture)},{Height.ToString(CultureInfo.InvariantCulture)}"; 36 | 37 | public string ToSvgString() 38 | => $"{_height.ToString(CultureInfo.InvariantCulture)},{Height.ToString(CultureInfo.InvariantCulture)}"; 39 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Renderer/Cache.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using Core2D.Model.Renderer; 5 | 6 | namespace Core2D.ViewModels.Renderer; 7 | 8 | public class Cache : ICache where TKey : notnull 9 | { 10 | private IDictionary _storage; 11 | private readonly Action? _dispose; 12 | 13 | public Cache(Action? dispose = null) 14 | { 15 | _dispose = dispose; 16 | _storage = new Dictionary(); 17 | } 18 | 19 | public TValue? Get(TKey key) 20 | { 21 | return _storage.TryGetValue(key, out var data) ? data : default; 22 | } 23 | 24 | public void Set(TKey key, TValue? value) 25 | { 26 | if (_storage.ContainsKey(key)) 27 | { 28 | _storage[key] = value; 29 | } 30 | else 31 | { 32 | _storage.Add(key, value); 33 | } 34 | } 35 | 36 | public void Reset() 37 | { 38 | if (_dispose is { }) 39 | { 40 | foreach (var data in _storage) 41 | { 42 | if (data.Value is not null) 43 | { 44 | _dispose(data.Value); 45 | } 46 | } 47 | } 48 | _storage.Clear(); 49 | _storage = new Dictionary(); 50 | } 51 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Renderer/ImageKeyViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | using System.Windows.Input; 6 | using CommunityToolkit.Mvvm.Input; 7 | using Core2D.Model.Renderer; 8 | using Core2D.ViewModels.Containers; 9 | using Core2D.ViewModels.Editor; 10 | 11 | namespace Core2D.ViewModels.Renderer; 12 | 13 | public partial class ImageKeyViewModel : ViewModelBase, IImageKey 14 | { 15 | [AutoNotify] private string? _key; 16 | 17 | public ImageKeyViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 18 | { 19 | RemoveImageKey = new RelayCommand(x => GetProject()?.OnRemoveImageKey(x)); 20 | 21 | ProjectContainerViewModel? GetProject() => ServiceProvider.GetService()?.Project; 22 | } 23 | 24 | 25 | [IgnoreDataMember] 26 | public ICommand RemoveImageKey { get; } 27 | 28 | public override object Copy(IDictionary? shared) 29 | { 30 | throw new NotImplementedException(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Core2D/ViewModels/ServiceProviderExtensions.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Core2D.ViewModels; 5 | 6 | public static class ServiceProviderExtensions 7 | { 8 | public static T? GetService(this IServiceProvider? serviceProvider) 9 | { 10 | return (T?)serviceProvider?.GetService(typeof(T)); 11 | } 12 | 13 | public static TR? GetService(this IServiceProvider? serviceProvider, Func transform) 14 | { 15 | return transform((T?)serviceProvider?.GetService(typeof(T))); 16 | } 17 | 18 | public static Lazy GetServiceLazily(this IServiceProvider? serviceProvider) 19 | { 20 | return new Lazy(() => (T?)serviceProvider?.GetService(typeof(T))); 21 | } 22 | 23 | public static Lazy GetServiceLazily(this IServiceProvider? serviceProvider, Action initialize) 24 | { 25 | return new Lazy(() => 26 | { 27 | var result = (T?)serviceProvider?.GetService(typeof(T)); 28 | initialize(result); 29 | return result; 30 | }); 31 | } 32 | 33 | public static Lazy GetServiceLazily(this IServiceProvider? serviceProvider, Func transform) 34 | { 35 | return new Lazy(() => transform((T?)serviceProvider?.GetService(typeof(T)))); 36 | } 37 | 38 | public static Lazy GetServiceLazily(this IServiceProvider? serviceProvider, Type type) 39 | { 40 | return new Lazy(() => serviceProvider?.GetService(type)); 41 | } 42 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Shapes/BaseShapeViewModelExtensions.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace Core2D.ViewModels.Shapes; 6 | 7 | public static class BaseShapeViewModelExtensions 8 | { 9 | public static IEnumerable GetAllShapes(this IEnumerable? shapes) 10 | { 11 | if (shapes is null) 12 | { 13 | yield break; 14 | } 15 | 16 | foreach (var shape in shapes) 17 | { 18 | if (shape is GroupShapeViewModel groupShape) 19 | { 20 | foreach (var s in GetAllShapes(groupShape.Shapes)) 21 | { 22 | yield return s; 23 | } 24 | 25 | yield return shape; 26 | } 27 | else 28 | { 29 | yield return shape; 30 | } 31 | } 32 | } 33 | 34 | public static IEnumerable GetAllShapes(this IEnumerable? shapes) 35 | { 36 | return GetAllShapes(shapes).Where(s => s is T).Cast(); 37 | } 38 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Shapes/ConnectableShapeExtensions.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model.Renderer; 3 | 4 | namespace Core2D.ViewModels.Shapes; 5 | 6 | public static class ConnectableShapeExtensions 7 | { 8 | public static void AddConnectorAsNone(this ConnectableShapeViewModel shape, PointShapeViewModel point) 9 | { 10 | point.Owner = shape; 11 | point.State |= ShapeStateFlags.Connector | ShapeStateFlags.None; 12 | point.State &= ~ShapeStateFlags.Standalone; 13 | shape.Connectors = shape.Connectors.Add(point); 14 | } 15 | 16 | public static void AddConnectorAsInput(this ConnectableShapeViewModel shape, PointShapeViewModel point) 17 | { 18 | point.Owner = shape; 19 | point.State |= ShapeStateFlags.Connector | ShapeStateFlags.Input; 20 | point.State &= ~ShapeStateFlags.Standalone; 21 | shape.Connectors = shape.Connectors.Add(point); 22 | } 23 | 24 | public static void AddConnectorAsOutput(this ConnectableShapeViewModel shape, PointShapeViewModel point) 25 | { 26 | point.Owner = shape; 27 | point.State |= ShapeStateFlags.Connector | ShapeStateFlags.Output; 28 | point.State &= ~ShapeStateFlags.Standalone; 29 | shape.Connectors = shape.Connectors.Add(point); 30 | } 31 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Shapes/PointShapeExtensions.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using static System.Math; 3 | 4 | namespace Core2D.ViewModels.Shapes; 5 | 6 | public static class PointShapeExtensions 7 | { 8 | public static double DistanceTo(this PointShapeViewModel point, PointShapeViewModel other) 9 | { 10 | var dx = point.X - other.X; 11 | var dy = point.Y - other.Y; 12 | // ReSharper disable once ArrangeRedundantParentheses 13 | return Sqrt((dx * dx) + (dy * dy)); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Style/ArrowStyleViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using Core2D.Model.Style; 5 | 6 | namespace Core2D.ViewModels.Style; 7 | 8 | public partial class ArrowStyleViewModel : ViewModelBase 9 | { 10 | [AutoNotify] private ArrowType _arrowType; 11 | [AutoNotify] private double _radiusX; 12 | [AutoNotify] private double _radiusY; 13 | 14 | public ArrowStyleViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 15 | { 16 | } 17 | 18 | public override object Copy(IDictionary? shared) 19 | { 20 | var copy = new ArrowStyleViewModel(ServiceProvider) 21 | { 22 | Name = Name, 23 | ArrowType = _arrowType, 24 | RadiusX = _radiusX, 25 | RadiusY = _radiusY 26 | }; 27 | 28 | return copy; 29 | } 30 | 31 | public override bool IsDirty() 32 | { 33 | var isDirty = base.IsDirty(); 34 | return isDirty; 35 | } 36 | } -------------------------------------------------------------------------------- /src/Core2D/ViewModels/Style/BaseColorViewModel.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace Core2D.ViewModels.Style; 6 | 7 | public abstract partial class BaseColorViewModel : ViewModelBase 8 | { 9 | protected BaseColorViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/DocumentContainerView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Containers; 4 | 5 | public partial class DocumentContainerView : UserControl 6 | { 7 | public DocumentContainerView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/LayerContainerView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Containers; 4 | 5 | public partial class LayerContainerView : UserControl 6 | { 7 | public LayerContainerView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/OptionsView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Containers; 4 | 5 | public partial class OptionsView : UserControl 6 | { 7 | public OptionsView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/PageContainerView.axaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/PageContainerView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Containers; 4 | 5 | public partial class PageContainerView : UserControl 6 | { 7 | public PageContainerView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/ProjectContainerView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Containers; 4 | 5 | public partial class ProjectContainerView : UserControl 6 | { 7 | public ProjectContainerView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/TemplateContainerView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Containers; 4 | 5 | public partial class TemplateContainerView : UserControl 6 | { 7 | public TemplateContainerView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Data/DataObjectView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Data; 4 | 5 | public partial class DataObjectView : UserControl 6 | { 7 | public DataObjectView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Data/RecordView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Data; 4 | 5 | public partial class RecordView : UserControl 6 | { 7 | public RecordView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Documents/PageView.axaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Documents/PageView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Documents; 4 | 5 | public partial class PageView : UserControl 6 | { 7 | public PageView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/DatabaseLibraryView.axaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/DatabaseLibraryView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Libraries; 4 | 5 | public partial class DatabaseLibraryView : UserControl 6 | { 7 | public DatabaseLibraryView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/GroupLibraryView.axaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/GroupLibraryView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Libraries; 4 | 5 | public partial class GroupLibraryView : UserControl 6 | { 7 | public GroupLibraryView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/ScriptLibraryView.axaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/ScriptLibraryView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Libraries; 4 | 5 | public partial class ScriptLibraryView : UserControl 6 | { 7 | public ScriptLibraryView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/StyleLibraryView.axaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/StyleLibraryView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Libraries; 4 | 5 | public partial class StyleLibraryView : UserControl 6 | { 7 | public StyleLibraryView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/TemplateLibraryView.axaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/TemplateLibraryView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Libraries; 4 | 5 | public partial class TemplateLibraryView : UserControl 6 | { 7 | public TemplateLibraryView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/ObjectBrowserView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools; 4 | 5 | public partial class ObjectBrowserView : UserControl 6 | { 7 | public ObjectBrowserView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/ImageOptionsView.axaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/ImageOptionsView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Options; 4 | 5 | public partial class ImageOptionsView : UserControl 6 | { 7 | public ImageOptionsView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/ProjectOptionsView.axaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/ProjectOptionsView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Options; 4 | 5 | public partial class ProjectOptionsView : UserControl 6 | { 7 | public ProjectOptionsView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/RendererOptionsView.axaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/RendererOptionsView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Options; 4 | 5 | public partial class RendererOptionsView : UserControl 6 | { 7 | public RendererOptionsView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/ZoomOptionsView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Options; 4 | 5 | public partial class ZoomOptionsView : UserControl 6 | { 7 | public ZoomOptionsView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/ProjectExplorerView.axaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/ProjectExplorerView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools; 4 | 5 | public partial class ProjectExplorerView : UserControl 6 | { 7 | public ProjectExplorerView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/DataPropertiesView.axaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 18 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/DataPropertiesView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Properties; 4 | 5 | public partial class DataPropertiesView : UserControl 6 | { 7 | public DataPropertiesView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/PagePropertiesView.axaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/PagePropertiesView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Properties; 4 | 5 | public partial class PagePropertiesView : UserControl 6 | { 7 | public PagePropertiesView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/ShapePropertiesView.axaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/ShapePropertiesView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Properties; 4 | 5 | public partial class ShapePropertiesView : UserControl 6 | { 7 | public ShapePropertiesView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/StatePropertiesView.axaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 18 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/StatePropertiesView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Properties; 4 | 5 | public partial class StatePropertiesView : UserControl 6 | { 7 | public StatePropertiesView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/StylePropertiesView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Tools.Properties; 4 | 5 | public partial class StylePropertiesView : UserControl 6 | { 7 | public StylePropertiesView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Views/DashboardMenuView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Views; 4 | 5 | public partial class DashboardMenuView : UserControl 6 | { 7 | public DashboardMenuView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Views/DashboardView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Views; 4 | 5 | public partial class DashboardView : UserControl 6 | { 7 | public DashboardView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Views/HomeMenuView.axaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Views/HomeMenuView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Views; 4 | 5 | public partial class HomeMenuView : UserControl 6 | { 7 | public HomeMenuView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Views/HomeStatusBarView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Views; 4 | 5 | public partial class HomeStatusBarView : UserControl 6 | { 7 | public HomeStatusBarView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Views/HomeView.axaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Views/HomeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Docking.Views; 4 | 5 | public partial class HomeView : UserControl 6 | { 7 | public HomeView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Editor/AboutInfoView.axaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 14 | 15 | 18 | 31 | 32 | -------------------------------------------------------------------------------- /src/Core2D/Views/Editor/AboutInfoView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Editor; 4 | 5 | public partial class AboutInfoView : UserControl 6 | { 7 | public AboutInfoView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Editors/TextBindingEditorView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Editors; 4 | 5 | public partial class TextBindingEditorView : UserControl 6 | { 7 | public TextBindingEditorView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Libraries/DatabasesView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Libraries; 4 | 5 | public partial class DatabasesView : UserControl 6 | { 7 | public DatabasesView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Libraries/GroupsView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Libraries; 4 | 5 | public partial class GroupsView : UserControl 6 | { 7 | public GroupsView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Libraries/ImagesView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Libraries; 4 | 5 | public partial class ImagesView : UserControl 6 | { 7 | public ImagesView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Libraries/ScriptsView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Libraries; 4 | 5 | public partial class ScriptsView : UserControl 6 | { 7 | public ScriptsView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Libraries/StylesView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Libraries; 4 | 5 | public partial class StylesView : UserControl 6 | { 7 | public StylesView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Libraries/TemplatesView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Libraries; 4 | 5 | public partial class TemplatesView : UserControl 6 | { 7 | public TemplatesView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/MainView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views; 4 | 5 | public partial class MainView : UserControl 6 | { 7 | public MainView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | 4 | namespace Core2D.Views; 5 | 6 | public partial class MainWindow : Window 7 | { 8 | public MainWindow() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/PathFigureView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Path; 4 | 5 | public partial class PathFigureView : UserControl 6 | { 7 | public PathFigureView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/PathSizeView.axaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 20 | 21 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/PathSizeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Path; 4 | 5 | public partial class PathSizeView : UserControl 6 | { 7 | public PathSizeView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/Segments/ArcSegmentView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Path.Segments; 4 | 5 | public partial class ArcSegmentView : UserControl 6 | { 7 | public ArcSegmentView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/Segments/CubicBezierSegmentView.axaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/Segments/CubicBezierSegmentView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Path.Segments; 4 | 5 | public partial class CubicBezierSegmentView : UserControl 6 | { 7 | public CubicBezierSegmentView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/Segments/LineSegmentView.axaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/Segments/LineSegmentView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Path.Segments; 4 | 5 | public partial class LineSegmentView : UserControl 6 | { 7 | public LineSegmentView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/Segments/QuadraticBezierSegmentView.axaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/Segments/QuadraticBezierSegmentView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Path.Segments; 4 | 5 | public partial class QuadraticBezierSegmentView : UserControl 6 | { 7 | public QuadraticBezierSegmentView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Renderer/GridView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Renderer; 4 | 5 | public partial class GridView : UserControl 6 | { 7 | public GridView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Renderer/RenderState.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Core2D.Model; 3 | using Core2D.Model.Renderer; 4 | using Core2D.ViewModels.Containers; 5 | using Core2D.ViewModels.Data; 6 | 7 | namespace Core2D.Views.Renderer; 8 | 9 | public class RenderState 10 | { 11 | public FrameContainerViewModel? Container { get; set; } 12 | public IShapeRenderer? Renderer { get; set; } 13 | public ISelection? Selection { get; set; } 14 | public DataFlow? DataFlow { get; set; } 15 | public RenderType RenderType { get; set; } 16 | } -------------------------------------------------------------------------------- /src/Core2D/Views/Renderer/RenderType.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace Core2D.Views.Renderer; 4 | 5 | public enum RenderType 6 | { 7 | None = 0, 8 | Data = 1, 9 | Template = 2, 10 | Editor = 3, 11 | Export = 4 12 | } -------------------------------------------------------------------------------- /src/Core2D/Views/Renderer/RenderView.axaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | -------------------------------------------------------------------------------- /src/Core2D/Views/Renderer/ShapeRendererStateView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Renderer; 4 | 5 | public partial class ShapeRendererStateView : UserControl 6 | { 7 | public ShapeRendererStateView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Renderer/ShapeStateView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Renderer; 4 | 5 | public partial class ShapeStateView : UserControl 6 | { 7 | public ShapeStateView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Scripting/ScriptView.axaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 16 | 17 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/Core2D/Views/Scripting/ScriptView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Scripting; 4 | 5 | public partial class ScriptView : UserControl 6 | { 7 | public ScriptView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/ArcShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Shapes; 4 | 5 | public partial class ArcShapeView : UserControl 6 | { 7 | public ArcShapeView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/CubicBezierShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Shapes; 4 | 5 | public partial class CubicBezierShapeView : UserControl 6 | { 7 | public CubicBezierShapeView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/EllipseShapeView.axaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/EllipseShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Shapes; 4 | 5 | public partial class EllipseShapeView : UserControl 6 | { 7 | public EllipseShapeView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/GroupShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Shapes; 4 | 5 | public partial class GroupShapeView : UserControl 6 | { 7 | public GroupShapeView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/ImageShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Shapes; 4 | 5 | public partial class ImageShapeView : UserControl 6 | { 7 | public ImageShapeView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/LineShapeView.axaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/LineShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Shapes; 4 | 5 | public partial class LineShapeView : UserControl 6 | { 7 | public LineShapeView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/PathShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Shapes; 4 | 5 | public partial class PathShapeView : UserControl 6 | { 7 | public PathShapeView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/PointShapeView.axaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 18 | 23 | 24 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/PointShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Shapes; 4 | 5 | public partial class PointShapeView : UserControl 6 | { 7 | public PointShapeView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/QuadraticBezierShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Shapes; 4 | 5 | public partial class QuadraticBezierShapeView : UserControl 6 | { 7 | public QuadraticBezierShapeView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/RectangleShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Shapes; 4 | 5 | public partial class RectangleShapeView : UserControl 6 | { 7 | public RectangleShapeView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/TextShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Shapes; 4 | 5 | public partial class TextShapeView : UserControl 6 | { 7 | public TextShapeView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Style/ArgbColorView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Style; 4 | 5 | public partial class ArgbColorView : UserControl 6 | { 7 | public ArgbColorView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Style/FillStyleView.axaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Core2D/Views/Style/FillStyleView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Style; 4 | 5 | public partial class FillStyleView : UserControl 6 | { 7 | public FillStyleView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Style/ShapeStyleView.axaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/Core2D/Views/Style/ShapeStyleView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Style; 4 | 5 | public partial class ShapeStyleView : UserControl 6 | { 7 | public ShapeStyleView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Style/StrokeStyleView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Style; 4 | 5 | public partial class StrokeStyleView : UserControl 6 | { 7 | public StrokeStyleView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Style/TextStyleView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace Core2D.Views.Style; 4 | 5 | public partial class TextStyleView : UserControl 6 | { 7 | public TextStyleView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | --------------------------------------------------------------------------------