├── .github ├── FUNDING.yml ├── workflows │ └── build.yml └── stale.yml ├── src ├── Core2D │ ├── Assets │ │ ├── Core2D.ico │ │ └── Fonts │ │ │ └── RobotoMono-Regular.ttf │ ├── AppBuilderFactory.cs │ ├── Views │ │ ├── MainView.axaml.cs │ │ ├── Renderer │ │ │ ├── RenderType.cs │ │ │ ├── GridView.axaml.cs │ │ │ ├── ShapeStateView.axaml.cs │ │ │ ├── ShapeRendererStateView.axaml.cs │ │ │ ├── RenderState.cs │ │ │ └── RenderView.axaml │ │ ├── Data │ │ │ ├── RecordView.axaml.cs │ │ │ └── DataObjectView.axaml.cs │ │ ├── MainWindow.axaml.cs │ │ ├── Path │ │ │ ├── PathSizeView.axaml.cs │ │ │ ├── PathFigureView.axaml.cs │ │ │ ├── Segments │ │ │ │ ├── ArcSegmentView.axaml.cs │ │ │ │ ├── LineSegmentView.axaml.cs │ │ │ │ ├── CubicBezierSegmentView.axaml.cs │ │ │ │ ├── QuadraticBezierSegmentView.axaml.cs │ │ │ │ ├── LineSegmentView.axaml │ │ │ │ └── QuadraticBezierSegmentView.axaml │ │ │ └── PathSizeView.axaml │ │ ├── Docking │ │ │ ├── Views │ │ │ │ ├── HomeView.axaml.cs │ │ │ │ ├── DashboardView.axaml.cs │ │ │ │ ├── HomeMenuView.axaml.cs │ │ │ │ ├── DashboardMenuView.axaml.cs │ │ │ │ ├── HomeStatusBarView.axaml.cs │ │ │ │ └── HomeMenuView.axaml │ │ │ ├── Documents │ │ │ │ ├── PageView.axaml.cs │ │ │ │ ├── TemplateView.axaml.cs │ │ │ │ ├── BlockDocumentView.axaml.cs │ │ │ │ ├── PageView.axaml │ │ │ │ ├── TemplateView.axaml │ │ │ │ └── BlockDocumentView.axaml │ │ │ └── Tools │ │ │ │ ├── ObjectBrowserView.axaml.cs │ │ │ │ ├── ProjectExplorerView.axaml.cs │ │ │ │ ├── Options │ │ │ │ ├── ImageOptionsView.axaml.cs │ │ │ │ ├── ZoomOptionsView.axaml.cs │ │ │ │ ├── ProjectOptionsView.axaml.cs │ │ │ │ ├── RendererOptionsView.axaml.cs │ │ │ │ ├── ImageOptionsView.axaml │ │ │ │ ├── ProjectOptionsView.axaml │ │ │ │ └── RendererOptionsView.axaml │ │ │ │ ├── Libraries │ │ │ │ ├── BlockLibraryView.axaml.cs │ │ │ │ ├── StyleLibraryView.axaml.cs │ │ │ │ ├── ScriptLibraryView.axaml.cs │ │ │ │ ├── DatabaseLibraryView.axaml.cs │ │ │ │ ├── TemplateLibraryView.axaml.cs │ │ │ │ ├── StyleLibraryView.axaml │ │ │ │ ├── ScriptLibraryView.axaml │ │ │ │ ├── DatabaseLibraryView.axaml │ │ │ │ └── TemplateLibraryView.axaml │ │ │ │ ├── Properties │ │ │ │ ├── DataPropertiesView.axaml.cs │ │ │ │ ├── PagePropertiesView.axaml.cs │ │ │ │ ├── ShapePropertiesView.axaml.cs │ │ │ │ ├── StatePropertiesView.axaml.cs │ │ │ │ ├── StylePropertiesView.axaml.cs │ │ │ │ └── PagePropertiesView.axaml │ │ │ │ └── ProjectExplorerView.axaml │ │ ├── Libraries │ │ │ ├── ImagesView.axaml.cs │ │ │ ├── StylesView.axaml.cs │ │ │ ├── ScriptsView.axaml.cs │ │ │ ├── DatabasesView.axaml.cs │ │ │ ├── TemplatesView.axaml.cs │ │ │ └── BlocksView.axaml.cs │ │ ├── Scripting │ │ │ └── ScriptView.axaml.cs │ │ ├── Shapes │ │ │ ├── ArcShapeView.axaml.cs │ │ │ ├── BlockShapeView.axaml.cs │ │ │ ├── ImageShapeView.axaml.cs │ │ │ ├── LineShapeView.axaml.cs │ │ │ ├── PathShapeView.axaml.cs │ │ │ ├── PointShapeView.axaml.cs │ │ │ ├── TextShapeView.axaml.cs │ │ │ ├── WireShapeView.axaml.cs │ │ │ ├── EllipseShapeView.axaml.cs │ │ │ ├── RectangleShapeView.axaml.cs │ │ │ ├── CubicBezierShapeView.axaml.cs │ │ │ ├── InsertShapeView.axaml.cs │ │ │ └── QuadraticBezierShapeView.axaml.cs │ │ ├── Style │ │ │ ├── ArgbColorView.axaml.cs │ │ │ ├── FillStyleView.axaml.cs │ │ │ ├── TextStyleView.axaml.cs │ │ │ ├── ShapeStyleView.axaml.cs │ │ │ ├── StrokeStyleView.axaml.cs │ │ │ └── FillStyleView.axaml │ │ ├── Containers │ │ │ ├── OptionsView.axaml.cs │ │ │ ├── LayerContainerView.axaml.cs │ │ │ ├── PageContainerView.axaml.cs │ │ │ ├── ProjectContainerView.axaml.cs │ │ │ ├── DocumentContainerView.axaml.cs │ │ │ ├── TemplateContainerView.axaml.cs │ │ │ └── PageContainerView.axaml │ │ ├── Editor │ │ │ └── AboutInfoView.axaml.cs │ │ ├── Editors │ │ │ └── TextBindingEditorView.axaml.cs │ │ └── Wizard │ │ │ └── Export │ │ │ └── ExportWizardView.axaml.cs │ ├── Controls │ │ ├── Editor │ │ │ ├── MenuView.axaml.cs │ │ │ └── ToolsView.axaml.cs │ │ ├── Dialog │ │ │ ├── DialogView.axaml.cs │ │ │ └── DialogPresenterView.axaml.cs │ │ └── ToggleItem.axaml.cs │ ├── Rendering │ │ ├── IRendererProvider.cs │ │ ├── IRenderHost.cs │ │ └── ImmediateRenderHost.cs │ ├── Util │ │ └── Utilities.cs │ ├── Configuration │ │ └── Windows │ │ │ └── WindowConfiguration.cs │ ├── Behaviors │ │ ├── AttachEditorBehavior.cs │ │ └── DragAndDrop │ │ │ ├── ScriptsListBoxDropHandler.cs │ │ │ └── TemplatesListBoxDropHandler.cs │ ├── Converters │ │ ├── IsBlockConverter.cs │ │ ├── ObjectEqualityMultiConverter.cs │ │ ├── IsCurrentToolConverter.cs │ │ ├── SelectedShapesHasItemsValueConverter.cs │ │ ├── ArgbColorToBrushConverter.cs │ │ ├── SelectedShapesIsEmptyValueConverter.cs │ │ ├── FontStyleFlagsConverter.cs │ │ ├── ShapeStateFlagsConverter.cs │ │ ├── SelectedShapesFirstItemValueConverter.cs │ │ ├── ShapeToTypeStringConverter.cs │ │ ├── ContainerToTypeStringConverter.cs │ │ └── SelectedShapesFirstItemStyleValueConverter.cs │ ├── App.axaml │ └── Settings.cs ├── Core2D.Browser │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── wwwroot │ │ ├── favicon.ico │ │ └── main.js │ ├── runtimeconfig.template.json │ ├── Program.cs │ └── Core2D.Browser.csproj ├── Core2D.Generators │ ├── AnalyzerReleases.Shipped.md │ └── AnalyzerReleases.Unshipped.md ├── Core2D.ViewModels │ ├── Model │ │ ├── Editor │ │ │ ├── IPathTool.cs │ │ │ ├── IEditorTool.cs │ │ │ ├── MoveMode.cs │ │ │ ├── IDialogPresenter.cs │ │ │ ├── ITool.cs │ │ │ ├── IEditorCanvasPlatform.cs │ │ │ ├── IShapeEditor.cs │ │ │ └── IBounds.cs │ │ ├── Path │ │ │ ├── FillRule.cs │ │ │ └── SweepDirection.cs │ │ ├── IPickerItem.cs │ │ ├── Renderer │ │ │ ├── IImageKey.cs │ │ │ ├── Nodes │ │ │ │ ├── IArcDrawNode.cs │ │ │ │ ├── IPathDrawNode.cs │ │ │ │ ├── IWireDrawNode.cs │ │ │ │ ├── IEllipseDrawNode.cs │ │ │ │ ├── IRectangleDrawNode.cs │ │ │ │ ├── ICubicBezierDrawNode.cs │ │ │ │ ├── IQuadraticBezierDrawNode.cs │ │ │ │ ├── ITextDrawNode.cs │ │ │ │ ├── IMarker.cs │ │ │ │ ├── IPointDrawNode.cs │ │ │ │ ├── IGridDrawNode.cs │ │ │ │ ├── ILineDrawNode.cs │ │ │ │ ├── IImageDrawNode.cs │ │ │ │ ├── IFillDrawNode.cs │ │ │ │ └── IDrawNode.cs │ │ │ ├── PathOp.cs │ │ │ ├── ICache.cs │ │ │ ├── IContainerPresenter.cs │ │ │ ├── ShapeStateFlags.cs │ │ │ ├── IImageCache.cs │ │ │ ├── IDecorator.cs │ │ │ └── IGrid.cs │ │ ├── IXamlExporter.cs │ │ ├── ISvgExporter.cs │ │ ├── Style │ │ │ ├── LineCap.cs │ │ │ ├── TextHAlignment.cs │ │ │ ├── TextVAlignment.cs │ │ │ ├── ArrowType.cs │ │ │ └── FontStyleFlags.cs │ │ ├── IStringExporter.cs │ │ ├── IImageImporter.cs │ │ ├── ITextFieldReader.cs │ │ ├── IJsonSerializer.cs │ │ ├── IFileWriter.cs │ │ ├── IScriptRunner.cs │ │ ├── ITextFieldWriter.cs │ │ ├── Input │ │ │ ├── ModifierFlags.cs │ │ │ ├── InputSource.cs │ │ │ ├── InputTarget.cs │ │ │ ├── InputArgsObserver.cs │ │ │ └── InputArgs.cs │ │ ├── ITextClipboard.cs │ │ ├── ISelectable.cs │ │ ├── ISelection.cs │ │ ├── History │ │ │ └── IHistory.cs │ │ ├── IConnectable.cs │ │ ├── IProjectExporter.cs │ │ ├── ISvgConverter.cs │ │ ├── IDataObject.cs │ │ ├── IMetafileExporter.cs │ │ ├── IContainerFactory.cs │ │ ├── IDrawable.cs │ │ ├── IFileSystem.cs │ │ ├── ILog.cs │ │ ├── IWmfImporter.cs │ │ ├── IDwgImporter.cs │ │ ├── IVisioImporter.cs │ │ └── IPathConverter.cs │ ├── ViewModels │ │ ├── Layout │ │ │ ├── FlipMode.cs │ │ │ ├── DistributeMode.cs │ │ │ ├── StackMode.cs │ │ │ ├── AlignMode.cs │ │ │ ├── Box.cs │ │ │ └── GraphLayoutEnums.cs │ │ ├── Docking │ │ │ ├── Views │ │ │ │ ├── HomeViewModel.cs │ │ │ │ ├── DashboardViewModel.cs │ │ │ │ ├── HomeMenuViewModel.cs │ │ │ │ ├── DashboardMenuViewModel.cs │ │ │ │ └── HomeStatusBarViewModel.cs │ │ │ ├── Tools │ │ │ │ ├── ObjectBrowserViewModel.cs │ │ │ │ ├── ProjectExplorerViewModel.cs │ │ │ │ ├── Options │ │ │ │ │ ├── ZoomOptionsViewModel.cs │ │ │ │ │ ├── ImageOptionsViewModel.cs │ │ │ │ │ ├── ProjectOptionsViewModel.cs │ │ │ │ │ └── RendererOptionsViewModel.cs │ │ │ │ ├── Libraries │ │ │ │ │ ├── BlockLibraryViewModel.cs │ │ │ │ │ ├── StyleLibraryViewModel.cs │ │ │ │ │ ├── ScriptLibraryViewModel.cs │ │ │ │ │ ├── DatabaseLibraryViewModel.cs │ │ │ │ │ └── TemplateLibraryViewModel.cs │ │ │ │ └── Properties │ │ │ │ │ ├── DataPropertiesViewModel.cs │ │ │ │ │ ├── PagePropertiesViewModel.cs │ │ │ │ │ ├── ShapePropertiesViewModel.cs │ │ │ │ │ ├── StatePropertiesViewModel.cs │ │ │ │ │ └── StylePropertiesViewModel.cs │ │ │ └── Documents │ │ │ │ ├── PageViewModel.cs │ │ │ │ ├── TemplateViewModel.cs │ │ │ │ └── BlockDocumentViewModel.cs │ │ ├── Renderer │ │ │ └── RendererOption.cs │ │ ├── Style │ │ │ └── BaseColorViewModel.cs │ │ ├── Editor │ │ │ ├── IRendererSelectionService.cs │ │ │ ├── History │ │ │ │ └── UndoRedo.cs │ │ │ ├── Tools │ │ │ │ └── Selection │ │ │ │ │ ├── WireSelection.cs │ │ │ │ │ ├── PathSelection.cs │ │ │ │ │ └── PointSelection.cs │ │ │ ├── IClipboardService.cs │ │ │ └── IGraphLayoutService.cs │ │ ├── Containers │ │ │ ├── BaseContainerViewModel.cs │ │ │ └── ProjectContainerViewModelExtensions.cs │ │ ├── Shapes │ │ │ └── PointShapeExtensions.cs │ │ ├── Data │ │ │ ├── Bindings │ │ │ │ └── BindingPart.cs │ │ │ ├── ValueViewModel.cs │ │ │ └── ColumnViewModel.cs │ │ └── Path │ │ │ └── PathSegmentViewModel.cs │ ├── Wizard │ │ └── Export │ │ │ ├── Scopes │ │ │ ├── ExportScopeKind.cs │ │ │ ├── ExportScopeSelection.cs │ │ │ └── ExportScopeFormatter.cs │ │ │ ├── WizardStepState.cs │ │ │ ├── Destination │ │ │ └── DestinationPreviewItem.cs │ │ │ ├── Execution │ │ │ └── ExportJobStatus.cs │ │ │ ├── IWizardStepViewModel.cs │ │ │ ├── WizardNavigationService.cs │ │ │ ├── Exporters │ │ │ └── ExporterCategoryViewModel.cs │ │ │ └── Steps │ │ │ └── SummaryIssueViewModel.cs │ └── Export │ │ ├── IExportOptionsSerializable.cs │ │ ├── ExportOptionsDto.cs │ │ ├── IExportOptionsCatalog.cs │ │ ├── ExportOptionsDescriptor.cs │ │ └── Options │ │ └── DefaultExportOptionsViewModel.cs ├── Core2D.Spatial │ ├── Core2D.Spatial.csproj │ └── Spatial │ │ ├── Sat │ │ ├── MinimumTranslationVector.cs │ │ └── Projection.cs │ │ ├── Size2.cs │ │ └── Polygon2.cs ├── Core2D.Modules.Renderer.Avalonia │ ├── Nodes │ │ └── Markers │ │ │ ├── NoneMarker.cs │ │ │ ├── ArrowMarker.cs │ │ │ ├── EllipseMarker.cs │ │ │ └── RectangleMarker.cs │ ├── AvaloniaRendererViewModel.cs │ └── Core2D.Modules.Renderer.Avalonia.csproj ├── Core2D.Modules.Renderer.SkiaSharp │ ├── Nodes │ │ └── Markers │ │ │ ├── NoneMarker.cs │ │ │ ├── ArrowMarker.cs │ │ │ ├── RectangleMarker.cs │ │ │ └── EllipseMarker.cs │ ├── SkiaSharpRendererViewModel.cs │ └── Core2D.Modules.Renderer.SkiaSharp.csproj ├── Core2D.Modules.Log │ └── Core2D.Modules.Log.csproj ├── Core2D.Modules.FileSystem │ └── Core2D.Modules.FileSystem.csproj ├── Core2D.Modules.SvgExporter │ └── Core2D.Modules.SvgExporter.csproj ├── Core2D.Modules.XamlExporter │ └── Core2D.Modules.XamlExporter.csproj ├── Core2D.Modules.Renderer.OpenXml │ ├── OpenXmlUnits.cs │ ├── OpenXmlColorExtensions.cs │ └── Core2D.Modules.Renderer.OpenXml.csproj ├── Core2D.Controls.Ruler │ └── Core2D.Controls.Ruler.csproj ├── Core2D.Modules.ScriptRunner │ └── Core2D.Modules.ScriptRunner.csproj ├── Core2D.Modules.TextFieldReader │ └── Core2D.Modules.TextFieldReader.csproj ├── Core2D.Modules.TextFieldWriter │ └── Core2D.Modules.TextFieldWriter.csproj ├── Core2D.Modules.Serializer │ └── Core2D.Modules.Serializer.csproj ├── Core2D.Modules.Renderer.SparseStrips │ └── Core2D.Modules.Renderer.SparseStrips.csproj ├── Core2D.Desktop │ ├── app.manifest │ └── Core2D.Desktop.csproj ├── Core2D.Modules.Renderer.WinForms │ └── Core2D.Modules.Renderer.WinForms.csproj ├── Core2D.Modules.Renderer.Common │ └── Core2D.Modules.Renderer.Common.csproj ├── Core2D.Modules.Renderer.VelloSharp │ └── Core2D.Modules.Renderer.VelloSharp.csproj ├── Core2D.Modules.Renderer.Dwg │ └── Core2D.Modules.Renderer.Dwg.csproj └── Core2D.Modules.Renderer.Dxf │ └── Core2D.Modules.Renderer.Dxf.csproj ├── global.json ├── external └── Directory.Packages.props ├── .gitmodules ├── NuGet.Config ├── .gitattributes ├── Directory.Build.props ├── tests └── Core2D.ViewModels.Tests │ └── Core2D.ViewModels.Tests.csproj └── LICENSE.TXT /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [wieslawsoltes] 2 | -------------------------------------------------------------------------------- /src/Core2D/Assets/Core2D.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wieslawsoltes/Core2D/HEAD/src/Core2D/Assets/Core2D.ico -------------------------------------------------------------------------------- /src/Core2D.Browser/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | [assembly:System.Runtime.Versioning.SupportedOSPlatform("browser")] 2 | -------------------------------------------------------------------------------- /src/Core2D.Browser/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wieslawsoltes/Core2D/HEAD/src/Core2D.Browser/wwwroot/favicon.ico -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "9.0.301", 4 | "rollForward": "latestMinor", 5 | "allowPrerelease": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Core2D/Assets/Fonts/RobotoMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wieslawsoltes/Core2D/HEAD/src/Core2D/Assets/Fonts/RobotoMono-Regular.ttf -------------------------------------------------------------------------------- /src/Core2D.Generators/AnalyzerReleases.Shipped.md: -------------------------------------------------------------------------------- 1 | ## Release 0.1.0 2 | 3 | ### New Rules 4 | Rule ID | Category | Severity | Notes 5 | --------|----------|----------|------ 6 | -------------------------------------------------------------------------------- /src/Core2D.Browser/runtimeconfig.template.json: -------------------------------------------------------------------------------- 1 | { 2 | "wasmHostProperties": { 3 | "perHostConfig": [ 4 | { 5 | "name": "browser", 6 | "host": "browser" 7 | } 8 | ] 9 | } 10 | } -------------------------------------------------------------------------------- /external/Directory.Packages.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/ACadSharp"] 2 | path = external/ACadSharp 3 | url = https://github.com/wieslawsoltes/ACadSharp.git 4 | [submodule "external/PdfPig.Rendering.Skia"] 5 | path = external/PdfPig.Rendering.Skia 6 | url = https://github.com/wieslawsoltes/PdfPig.Rendering.Skia.git 7 | -------------------------------------------------------------------------------- /src/Core2D/AppBuilderFactory.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | 3 | namespace Core2D; 4 | 5 | public static class AppBuilderFactory 6 | { 7 | public static AppBuilder BuildAvaloniaApp() 8 | => AppBuilder.Configure() 9 | .UsePlatformDetect() 10 | .LogToTrace(); 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Editor/IPathTool.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Editor; 6 | 7 | public interface IPathTool : ITool 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Editor/IEditorTool.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Editor; 6 | 7 | public interface IEditorTool : ITool 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Layout/FlipMode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | namespace Core2D.ViewModels.Layout; 5 | 6 | public enum FlipMode 7 | { 8 | Horizontal, 9 | Vertical 10 | } 11 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Editor/MoveMode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Editor; 6 | 7 | public enum MoveMode 8 | { 9 | Point, 10 | 11 | Shape 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Path/FillRule.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Path; 6 | 7 | public enum FillRule 8 | { 9 | Nonzero, 10 | 11 | EvenOdd 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Layout/DistributeMode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | namespace Core2D.ViewModels.Layout; 5 | 6 | public enum DistributeMode 7 | { 8 | Horizontal, 9 | Vertical 10 | } 11 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IPickerItem.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | namespace Core2D.Model; 5 | 6 | public interface IPickerItem 7 | { 8 | string Name { get; } 9 | 10 | string Extension { get; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/IImageKey.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Renderer; 6 | 7 | public interface IImageKey 8 | { 9 | string? Key { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IXamlExporter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model; 6 | 7 | public interface IXamlExporter 8 | { 9 | string Create(object item, string? key); 10 | } 11 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Layout/StackMode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.ViewModels.Layout; 6 | 7 | public enum StackMode 8 | { 9 | Horizontal, 10 | Vertical 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Path/SweepDirection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Path; 6 | 7 | public enum SweepDirection 8 | { 9 | Clockwise, 10 | 11 | Counterclockwise 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/ISvgExporter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model; 6 | 7 | public interface ISvgExporter 8 | { 9 | string Create(object? item, double width, double height); 10 | } 11 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Style/LineCap.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Style; 6 | 7 | public enum LineCap 8 | { 9 | Flat = 0, 10 | 11 | Square = 1, 12 | 13 | Round = 2 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Style/TextHAlignment.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Style; 6 | 7 | public enum TextHAlignment 8 | { 9 | Left, 10 | 11 | Center, 12 | 13 | Right 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Style/TextVAlignment.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Style; 6 | 7 | public enum TextVAlignment 8 | { 9 | Top, 10 | 11 | Center, 12 | 13 | Bottom 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IStringExporter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model; 6 | 7 | public interface IStringExporter 8 | { 9 | string ToXamlString(); 10 | 11 | string ToSvgString(); 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Style/ArrowType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Style; 6 | 7 | public enum ArrowType 8 | { 9 | None, 10 | 11 | Rectangle, 12 | 13 | Ellipse, 14 | 15 | Arrow 16 | } 17 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Views/HomeViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Core; 6 | 7 | namespace Core2D.ViewModels.Docking.Views; 8 | 9 | public class HomeViewModel : DockBase 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IImageImporter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Threading.Tasks; 6 | 7 | namespace Core2D.Model; 8 | 9 | public interface IImageImporter 10 | { 11 | Task GetImageKeyAsync(); 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/ITextFieldReader.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.IO; 6 | 7 | namespace Core2D.Model; 8 | 9 | public interface ITextFieldReader : IPickerItem 10 | { 11 | T? Read(Stream stream); 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Layout/AlignMode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | namespace Core2D.ViewModels.Layout; 5 | 6 | public enum AlignMode 7 | { 8 | Left, 9 | Centered, 10 | Right, 11 | Top, 12 | Center, 13 | Bottom 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IJsonSerializer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model; 6 | 7 | public interface IJsonSerializer 8 | { 9 | string Serialize(T? value); 10 | 11 | T? Deserialize(string json); 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Views/DashboardViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Core; 6 | 7 | namespace Core2D.ViewModels.Docking.Views; 8 | 9 | public class DashboardViewModel : DockBase 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Views/HomeMenuViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Core; 6 | 7 | namespace Core2D.ViewModels.Docking.Views; 8 | 9 | public class HomeMenuViewModel : DockBase 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.Spatial/Core2D.Spatial.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Wizard/Export/Scopes/ExportScopeKind.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | 6 | namespace Core2D.ViewModels.Wizard.Export.Scopes; 7 | 8 | public enum ExportScopeKind 9 | { 10 | Project, 11 | Document, 12 | Page 13 | } 14 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Wizard/Export/WizardStepState.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | 6 | namespace Core2D.ViewModels.Wizard.Export; 7 | 8 | public enum WizardStepState 9 | { 10 | Pending, 11 | Ready, 12 | Warning, 13 | Error 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IFileWriter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.IO; 6 | 7 | namespace Core2D.Model; 8 | 9 | public interface IFileWriter: IPickerItem 10 | { 11 | void Save(Stream stream, object item, object? options); 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IScriptRunner.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Threading.Tasks; 6 | 7 | namespace Core2D.Model; 8 | 9 | public interface IScriptRunner 10 | { 11 | Task Execute(string code, object? state); 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/ITextFieldWriter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.IO; 6 | 7 | namespace Core2D.Model; 8 | 9 | public interface ITextFieldWriter: IPickerItem 10 | { 11 | void Write(Stream stream, T? database); 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/ObjectBrowserViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools; 8 | 9 | public class ObjectBrowserViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Views/DashboardMenuViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Core; 6 | 7 | namespace Core2D.ViewModels.Docking.Views; 8 | 9 | public class DashboardMenuViewModel : DockBase 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Views/HomeStatusBarViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Core; 6 | 7 | namespace Core2D.ViewModels.Docking.Views; 8 | 9 | public class HomeStatusBarViewModel : DockBase 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Wizard/Export/Destination/DestinationPreviewItem.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | 6 | namespace Core2D.ViewModels.Wizard.Export.Destination; 7 | 8 | public sealed record DestinationPreviewItem(string Scope, string Exporter, string Path); 9 | -------------------------------------------------------------------------------- /src/Core2D/Views/MainView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views; 7 | 8 | public partial class MainView : UserControl 9 | { 10 | public MainView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Renderer/RenderType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | 6 | namespace Core2D.Views.Renderer; 7 | 8 | public enum RenderType 9 | { 10 | None = 0, 11 | Data = 1, 12 | Template = 2, 13 | Editor = 3, 14 | Export = 4 15 | } 16 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/ProjectExplorerViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools; 8 | 9 | public class ProjectExplorerViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Options/ZoomOptionsViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Options; 8 | 9 | public class ZoomOptionsViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Style/FontStyleFlags.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | 7 | namespace Core2D.Model.Style; 8 | 9 | [Flags] 10 | public enum FontStyleFlags 11 | { 12 | Regular = 0, 13 | 14 | Bold = 1, 15 | 16 | Italic = 2 17 | } 18 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Libraries/BlockLibraryViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Libraries; 8 | 9 | public class BlockLibraryViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Libraries/StyleLibraryViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Libraries; 8 | 9 | public class StyleLibraryViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Options/ImageOptionsViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Options; 8 | 9 | public class ImageOptionsViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Options/ProjectOptionsViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Options; 8 | 9 | public class ProjectOptionsViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Data/RecordView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Data; 7 | 8 | public partial class RecordView : UserControl 9 | { 10 | public RecordView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Renderer/GridView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Renderer; 7 | 8 | public partial class GridView : UserControl 9 | { 10 | public GridView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Libraries/ScriptLibraryViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Libraries; 8 | 9 | public class ScriptLibraryViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Options/RendererOptionsViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Options; 8 | 9 | public class RendererOptionsViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Controls/Editor/MenuView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Controls.Editor; 7 | 8 | public partial class MenuView : UserControl 9 | { 10 | public MenuView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Controls/Editor/ToolsView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Controls.Editor; 7 | 8 | public partial class ToolsView : UserControl 9 | { 10 | public ToolsView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia; 5 | using Avalonia.Controls; 6 | 7 | namespace Core2D.Views; 8 | 9 | public partial class MainWindow : Window 10 | { 11 | public MainWindow() 12 | { 13 | InitializeComponent(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/PathSizeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Path; 7 | 8 | public partial class PathSizeView : UserControl 9 | { 10 | public PathSizeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/IArcDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Model.Renderer.Nodes; 8 | 9 | public interface IArcDrawNode : IDrawNode 10 | { 11 | ArcShapeViewModel Arc { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Libraries/DatabaseLibraryViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Libraries; 8 | 9 | public class DatabaseLibraryViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Libraries/TemplateLibraryViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Libraries; 8 | 9 | public class TemplateLibraryViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Properties/DataPropertiesViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Properties; 8 | 9 | public class DataPropertiesViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Properties/PagePropertiesViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Properties; 8 | 9 | public class PagePropertiesViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Properties/ShapePropertiesViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Properties; 8 | 9 | public class ShapePropertiesViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Properties/StatePropertiesViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Properties; 8 | 9 | public class StatePropertiesViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Tools/Properties/StylePropertiesViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Dock.Model.Mvvm.Controls; 6 | 7 | namespace Core2D.ViewModels.Docking.Tools.Properties; 8 | 9 | public class StylePropertiesViewModel : Tool 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Core2D/Controls/Dialog/DialogView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Controls.Dialog; 7 | 8 | public partial class DialogView : UserControl 9 | { 10 | public DialogView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Data/DataObjectView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Data; 7 | 8 | public partial class DataObjectView : UserControl 9 | { 10 | public DataObjectView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Views/HomeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Views; 7 | 8 | public partial class HomeView : UserControl 9 | { 10 | public HomeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Libraries/ImagesView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Libraries; 7 | 8 | public partial class ImagesView : UserControl 9 | { 10 | public ImagesView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Libraries/StylesView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Libraries; 7 | 8 | public partial class StylesView : UserControl 9 | { 10 | public StylesView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/PathFigureView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Path; 7 | 8 | public partial class PathFigureView : UserControl 9 | { 10 | public PathFigureView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Scripting/ScriptView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Scripting; 7 | 8 | public partial class ScriptView : UserControl 9 | { 10 | public ScriptView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/ArcShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Shapes; 7 | 8 | public partial class ArcShapeView : UserControl 9 | { 10 | public ArcShapeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Style/ArgbColorView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Style; 7 | 8 | public partial class ArgbColorView : UserControl 9 | { 10 | public ArgbColorView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Style/FillStyleView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Style; 7 | 8 | public partial class FillStyleView : UserControl 9 | { 10 | public FillStyleView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Style/TextStyleView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Style; 7 | 8 | public partial class TextStyleView : UserControl 9 | { 10 | public TextStyleView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.Avalonia/Nodes/Markers/NoneMarker.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Modules.Renderer.Avalonia.Nodes.Markers; 6 | 7 | internal class NoneMarker : MarkerBase 8 | { 9 | public override void Draw(object? dc) 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.SkiaSharp/Nodes/Markers/NoneMarker.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Modules.Renderer.SkiaSharp.Nodes.Markers; 6 | 7 | internal class NoneMarker : MarkerBase 8 | { 9 | public override void Draw(object? dc) 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Export/IExportOptionsSerializable.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | 6 | namespace Core2D.ViewModels.Export; 7 | 8 | public interface IExportOptionsSerializable 9 | { 10 | ExportOptionsDto ToDto(); 11 | 12 | void LoadFromDto(ExportOptionsDto dto); 13 | } 14 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/IPathDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Model.Renderer.Nodes; 8 | 9 | public interface IPathDrawNode : IDrawNode 10 | { 11 | PathShapeViewModel Path { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/IWireDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Model.Renderer.Nodes; 8 | 9 | public interface IWireDrawNode : IDrawNode 10 | { 11 | WireShapeViewModel Wire { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/OptionsView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Containers; 7 | 8 | public partial class OptionsView : UserControl 9 | { 10 | public OptionsView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Editor/AboutInfoView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Editor; 7 | 8 | public partial class AboutInfoView : UserControl 9 | { 10 | public AboutInfoView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Libraries/ScriptsView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Libraries; 7 | 8 | public partial class ScriptsView : UserControl 9 | { 10 | public ScriptsView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/BlockShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Shapes; 7 | 8 | public partial class BlockShapeView : UserControl 9 | { 10 | public BlockShapeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/ImageShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Shapes; 7 | 8 | public partial class ImageShapeView : UserControl 9 | { 10 | public ImageShapeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/LineShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Shapes; 7 | 8 | public partial class LineShapeView : UserControl 9 | { 10 | public LineShapeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/PathShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Shapes; 7 | 8 | public partial class PathShapeView : UserControl 9 | { 10 | public PathShapeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/PointShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Shapes; 7 | 8 | public partial class PointShapeView : UserControl 9 | { 10 | public PointShapeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/TextShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Shapes; 7 | 8 | public partial class TextShapeView : UserControl 9 | { 10 | public TextShapeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/WireShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Shapes; 7 | 8 | public partial class WireShapeView : UserControl 9 | { 10 | public WireShapeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Style/ShapeStyleView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Style; 7 | 8 | public partial class ShapeStyleView : UserControl 9 | { 10 | public ShapeStyleView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Style/StrokeStyleView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Style; 7 | 8 | public partial class StrokeStyleView : UserControl 9 | { 10 | public StrokeStyleView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Documents/PageView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Documents; 7 | 8 | public partial class PageView : UserControl 9 | { 10 | public PageView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Libraries/DatabasesView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Libraries; 7 | 8 | public partial class DatabasesView : UserControl 9 | { 10 | public DatabasesView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Libraries/TemplatesView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Libraries; 7 | 8 | public partial class TemplatesView : UserControl 9 | { 10 | public TemplatesView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Renderer/ShapeStateView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Renderer; 7 | 8 | public partial class ShapeStateView : UserControl 9 | { 10 | public ShapeStateView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/EllipseShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Shapes; 7 | 8 | public partial class EllipseShapeView : UserControl 9 | { 10 | public EllipseShapeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Input/ModifierFlags.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | 7 | namespace Core2D.Model.Input; 8 | 9 | [Flags] 10 | public enum ModifierFlags 11 | { 12 | None = 0, 13 | 14 | Alt = 1, 15 | 16 | Control = 2, 17 | 18 | Shift = 4 19 | } 20 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/IEllipseDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Model.Renderer.Nodes; 8 | 9 | public interface IEllipseDrawNode : IDrawNode 10 | { 11 | EllipseShapeViewModel Ellipse { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/PathOp.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Renderer; 6 | 7 | public enum PathOp 8 | { 9 | Difference = 0, 10 | 11 | Intersect = 1, 12 | 13 | Union = 2, 14 | 15 | Xor = 3, 16 | 17 | ReverseDifference = 4 18 | } 19 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Wizard/Export/Execution/ExportJobStatus.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | 6 | namespace Core2D.ViewModels.Wizard.Export.Execution; 7 | 8 | public enum ExportJobStatus 9 | { 10 | Pending, 11 | Running, 12 | Completed, 13 | Failed, 14 | Cancelled 15 | } 16 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Views/DashboardView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Views; 7 | 8 | public partial class DashboardView : UserControl 9 | { 10 | public DashboardView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Views/HomeMenuView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Views; 7 | 8 | public partial class HomeMenuView : UserControl 9 | { 10 | public HomeMenuView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/Segments/ArcSegmentView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Path.Segments; 7 | 8 | public partial class ArcSegmentView : UserControl 9 | { 10 | public ArcSegmentView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/RectangleShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Shapes; 7 | 8 | public partial class RectangleShapeView : UserControl 9 | { 10 | public RectangleShapeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/ICache.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Renderer; 6 | 7 | public interface ICache where TKey : notnull 8 | { 9 | TValue? Get(TKey key); 10 | 11 | void Set(TKey key, TValue? value); 12 | 13 | void Reset(); 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/IRectangleDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Model.Renderer.Nodes; 8 | 9 | public interface IRectangleDrawNode : IDrawNode 10 | { 11 | RectangleShapeViewModel Rectangle { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D/Controls/Dialog/DialogPresenterView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Controls.Dialog; 7 | 8 | public partial class DialogPresenterView : UserControl 9 | { 10 | public DialogPresenterView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/LayerContainerView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Containers; 7 | 8 | public partial class LayerContainerView : UserControl 9 | { 10 | public LayerContainerView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/PageContainerView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Containers; 7 | 8 | public partial class PageContainerView : UserControl 9 | { 10 | public PageContainerView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/Segments/LineSegmentView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Path.Segments; 7 | 8 | public partial class LineSegmentView : UserControl 9 | { 10 | public LineSegmentView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/CubicBezierShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Shapes; 7 | 8 | public partial class CubicBezierShapeView : UserControl 9 | { 10 | public CubicBezierShapeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.Browser/Program.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Versioning; 2 | using System.Threading.Tasks; 3 | using Avalonia; 4 | using Avalonia.Browser; 5 | 6 | namespace Core2D; 7 | 8 | internal static class Program 9 | { 10 | [SupportedOSPlatform("browser")] 11 | private static Task Main(string[] args) 12 | => AppBuilderFactory.BuildAvaloniaApp() 13 | .WithInterFont() 14 | .StartBrowserAppAsync("out"); 15 | } 16 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/ICubicBezierDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Model.Renderer.Nodes; 8 | 9 | public interface ICubicBezierDrawNode : IDrawNode 10 | { 11 | CubicBezierShapeViewModel CubicBezier { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/ProjectContainerView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Containers; 7 | 8 | public partial class ProjectContainerView : UserControl 9 | { 10 | public ProjectContainerView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/ObjectBrowserView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools; 7 | 8 | public partial class ObjectBrowserView : UserControl 9 | { 10 | public ObjectBrowserView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Views/DashboardMenuView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Views; 7 | 8 | public partial class DashboardMenuView : UserControl 9 | { 10 | public DashboardMenuView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Views/HomeStatusBarView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Views; 7 | 8 | public partial class HomeStatusBarView : UserControl 9 | { 10 | public HomeStatusBarView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Editors/TextBindingEditorView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Editors; 7 | 8 | public partial class TextBindingEditorView : UserControl 9 | { 10 | public TextBindingEditorView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/ITextClipboard.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Threading.Tasks; 6 | 7 | namespace Core2D.Model; 8 | 9 | public interface ITextClipboard 10 | { 11 | Task ContainsText(); 12 | 13 | Task GetText(); 14 | 15 | Task SetText(string? text); 16 | } 17 | -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/DocumentContainerView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Containers; 7 | 8 | public partial class DocumentContainerView : UserControl 9 | { 10 | public DocumentContainerView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/TemplateContainerView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Containers; 7 | 8 | public partial class TemplateContainerView : UserControl 9 | { 10 | public TemplateContainerView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/ProjectExplorerView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools; 7 | 8 | public partial class ProjectExplorerView : UserControl 9 | { 10 | public ProjectExplorerView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Renderer/ShapeRendererStateView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Renderer; 7 | 8 | public partial class ShapeRendererStateView : UserControl 9 | { 10 | public ShapeRendererStateView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/InsertShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Avalonia.Controls; 6 | 7 | namespace Core2D.Views.Shapes; 8 | 9 | public partial class InsertShapeView : UserControl 10 | { 11 | public InsertShapeView() 12 | { 13 | InitializeComponent(); 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/Core2D/Views/Shapes/QuadraticBezierShapeView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Shapes; 7 | 8 | public partial class QuadraticBezierShapeView : UserControl 9 | { 10 | public QuadraticBezierShapeView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/ISelectable.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model; 6 | 7 | public interface ISelectable 8 | { 9 | void Move(ISelection? selection, decimal dx, decimal dy); 10 | 11 | void Select(ISelection? selection); 12 | 13 | void Deselect(ISelection? selection); 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/ImageOptionsView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Options; 7 | 8 | public partial class ImageOptionsView : UserControl 9 | { 10 | public ImageOptionsView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/ZoomOptionsView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Options; 7 | 8 | public partial class ZoomOptionsView : UserControl 9 | { 10 | public ZoomOptionsView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Documents/TemplateView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Avalonia.Controls; 6 | 7 | namespace Core2D.Views.Docking.Documents; 8 | 9 | public partial class TemplateView : UserControl 10 | { 11 | public TemplateView() 12 | { 13 | InitializeComponent(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/BlockLibraryView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Libraries; 7 | 8 | public partial class BlockLibraryView : UserControl 9 | { 10 | public BlockLibraryView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/StyleLibraryView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Libraries; 7 | 8 | public partial class StyleLibraryView : UserControl 9 | { 10 | public StyleLibraryView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/Segments/CubicBezierSegmentView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Path.Segments; 7 | 8 | public partial class CubicBezierSegmentView : UserControl 9 | { 10 | public CubicBezierSegmentView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/IQuadraticBezierDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Model.Renderer.Nodes; 8 | 9 | public interface IQuadraticBezierDrawNode : IDrawNode 10 | { 11 | QuadraticBezierShapeViewModel QuadraticBezier { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/ITextDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Model.Renderer.Nodes; 8 | 9 | public interface ITextDrawNode : IDrawNode 10 | { 11 | TextShapeViewModel Text { get; set; } 12 | 13 | string? BoundText { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Renderer/RendererOption.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | 6 | namespace Core2D.ViewModels.Renderer; 7 | 8 | /// 9 | /// Describes a selectable renderer option exposed in the UI. 10 | /// 11 | public sealed record RendererOption(string Id, string Title, string Description); 12 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/ScriptLibraryView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Libraries; 7 | 8 | public partial class ScriptLibraryView : UserControl 9 | { 10 | public ScriptLibraryView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/ProjectOptionsView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Options; 7 | 8 | public partial class ProjectOptionsView : UserControl 9 | { 10 | public ProjectOptionsView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/RendererOptionsView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Options; 7 | 8 | public partial class RendererOptionsView : UserControl 9 | { 10 | public RendererOptionsView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/IMarker.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Style; 6 | 7 | namespace Core2D.Model.Renderer.Nodes; 8 | 9 | public interface IMarker 10 | { 11 | ArrowStyleViewModel? Style { get; set; } 12 | 13 | void Draw(object? dc); 14 | 15 | void UpdateStyle(); 16 | } 17 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/IPointDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Model.Renderer.Nodes; 8 | 9 | public interface IPointDrawNode : IDrawNode 10 | { 11 | PointShapeViewModel Point { get; set; } 12 | 13 | double PointSize { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/DatabaseLibraryView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Libraries; 7 | 8 | public partial class DatabaseLibraryView : UserControl 9 | { 10 | public DatabaseLibraryView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/TemplateLibraryView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Libraries; 7 | 8 | public partial class TemplateLibraryView : UserControl 9 | { 10 | public TemplateLibraryView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/DataPropertiesView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Properties; 7 | 8 | public partial class DataPropertiesView : UserControl 9 | { 10 | public DataPropertiesView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/PagePropertiesView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Properties; 7 | 8 | public partial class PagePropertiesView : UserControl 9 | { 10 | public PagePropertiesView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/ShapePropertiesView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Properties; 7 | 8 | public partial class ShapePropertiesView : UserControl 9 | { 10 | public ShapePropertiesView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/StatePropertiesView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Properties; 7 | 8 | public partial class StatePropertiesView : UserControl 9 | { 10 | public StatePropertiesView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/StylePropertiesView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Docking.Tools.Properties; 7 | 8 | public partial class StylePropertiesView : UserControl 9 | { 10 | public StylePropertiesView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/Segments/QuadraticBezierSegmentView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Views.Path.Segments; 7 | 8 | public partial class QuadraticBezierSegmentView : UserControl 9 | { 10 | public QuadraticBezierSegmentView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Documents/BlockDocumentView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Avalonia.Controls; 6 | 7 | namespace Core2D.Views.Docking.Documents; 8 | 9 | public partial class BlockDocumentView : UserControl 10 | { 11 | public BlockDocumentView() 12 | { 13 | InitializeComponent(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/ISelection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | using Core2D.ViewModels.Shapes; 7 | 8 | namespace Core2D.Model; 9 | 10 | public interface ISelection 11 | { 12 | ISet? SelectedShapes { get; set; } 13 | 14 | BaseShapeViewModel? HoveredShape { get; } 15 | } 16 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Export/ExportOptionsDto.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | 7 | namespace Core2D.ViewModels.Export; 8 | 9 | /// 10 | /// Serializable representation of an export options instance. 11 | /// 12 | public sealed record ExportOptionsDto(string TypeId, IDictionary Values); 13 | -------------------------------------------------------------------------------- /src/Core2D.Browser/wwwroot/main.js: -------------------------------------------------------------------------------- 1 | import { dotnet } from './_framework/dotnet.js' 2 | 3 | const is_browser = typeof window != "undefined"; 4 | if (!is_browser) throw new Error(`Expected to be running in a browser`); 5 | 6 | const dotnetRuntime = await dotnet 7 | .withDiagnosticTracing(false) 8 | .withApplicationArgumentsFromQuery() 9 | .create(); 10 | 11 | const config = dotnetRuntime.getConfig(); 12 | 13 | await dotnetRuntime.runMain(config.mainAssemblyName, [globalThis.location.href]); 14 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/IContainerPresenter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Containers; 6 | 7 | namespace Core2D.Model.Renderer; 8 | 9 | public interface IContainerPresenter 10 | { 11 | void Render(object? dc, IShapeRenderer? renderer, ISelection? selection, FrameContainerViewModel? container, double dx, double dy); 12 | } 13 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Log/Core2D.Modules.Log.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Layout/Box.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | namespace Core2D.ViewModels.Layout; 5 | 6 | public struct Box 7 | { 8 | public decimal Left; 9 | public decimal Top; 10 | public decimal Right; 11 | public decimal Bottom; 12 | public decimal CenterX; 13 | public decimal CenterY; 14 | public decimal Width; 15 | public decimal Height; 16 | } 17 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/IGridDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Renderer.Nodes; 6 | 7 | public interface IGridDrawNode : IDrawNode 8 | { 9 | IGrid Grid { get; set; } 10 | 11 | double X { get; set; } 12 | 13 | double Y { get; set; } 14 | 15 | double Width { get; set; } 16 | 17 | double Height { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /src/Core2D.Modules.FileSystem/Core2D.Modules.FileSystem.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Core2D.Modules.SvgExporter/Core2D.Modules.SvgExporter.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/History/IHistory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | 7 | namespace Core2D.Model.History; 8 | 9 | public interface IHistory 10 | { 11 | void Snapshot(T previous, T next, Action update); 12 | 13 | bool CanUndo(); 14 | 15 | bool CanRedo(); 16 | 17 | bool Undo(); 18 | 19 | bool Redo(); 20 | 21 | void Reset(); 22 | } 23 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/ILineDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Model.Renderer.Nodes; 8 | 9 | public interface ILineDrawNode : IDrawNode 10 | { 11 | LineShapeViewModel Line { get; set; } 12 | 13 | public IMarker? StartMarker { get; set; } 14 | 15 | public IMarker? EndMarker { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Style/BaseColorViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | 8 | namespace Core2D.ViewModels.Style; 9 | 10 | public abstract partial class BaseColorViewModel : ViewModelBase 11 | { 12 | protected BaseColorViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Core2D.Modules.XamlExporter/Core2D.Modules.XamlExporter.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IConnectable.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Shapes; 6 | 7 | namespace Core2D.Model; 8 | 9 | public interface IConnectable 10 | { 11 | bool Connect(PointShapeViewModel? point, PointShapeViewModel? target); 12 | 13 | bool Disconnect(PointShapeViewModel? point, out PointShapeViewModel? result); 14 | 15 | bool Disconnect(); 16 | } 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.OpenXml/OpenXmlUnits.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | 6 | namespace Core2D.Modules.Renderer.OpenXml; 7 | 8 | internal static class OpenXmlUnits 9 | { 10 | private const double EmusPerPixel = 914400.0 / 96.0; 11 | 12 | public static long ToEmus(double value) 13 | => (long)System.Math.Round(value * EmusPerPixel, System.MidpointRounding.AwayFromZero); 14 | } 15 | -------------------------------------------------------------------------------- /src/Core2D.Generators/AnalyzerReleases.Unshipped.md: -------------------------------------------------------------------------------- 1 | ### New Rules 2 | Rule ID | Category | Severity | Notes 3 | --------|----------|----------|------ 4 | C2DGEN001 | AutoNotifyGenerator | Warning | AutoNotify base type not found 5 | C2DGEN002 | AutoNotifyGenerator | Info | AutoNotify does not support nested types 6 | C2DGEN003 | AutoNotifyGenerator | Warning | Invalid property name for field 7 | C2DGEN004 | AutoNotifyGenerator | Warning | Type must be partial 8 | C2DGEN999 | AutoNotifyGenerator | Error | Unexpected generator exception 9 | 10 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Wizard/Export/Scopes/ExportScopeSelection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Containers; 6 | 7 | namespace Core2D.ViewModels.Wizard.Export.Scopes; 8 | 9 | public sealed record class ExportScopeSelection( 10 | ExportScopeKind Kind, 11 | ProjectContainerViewModel Project, 12 | DocumentContainerViewModel? Document, 13 | PageContainerViewModel? Page); 14 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/IImageDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using Core2D.ViewModels.Shapes; 7 | 8 | namespace Core2D.Model.Renderer.Nodes; 9 | 10 | public interface IImageDrawNode : IDrawNode 11 | { 12 | ImageShapeViewModel Image { get; set; } 13 | 14 | IImageCache? ImageCache { get; set; } 15 | 16 | ICache? BitmapCache { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/Core2D.Spatial/Spatial/Sat/MinimumTranslationVector.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using System; 5 | 6 | namespace Core2D.Spatial.Sat; 7 | 8 | public struct MinimumTranslationVector 9 | { 10 | public readonly Vector2 Smallest; 11 | public readonly double Overlap; 12 | 13 | public MinimumTranslationVector(Vector2 smallest, double overlap) 14 | { 15 | Smallest = smallest; 16 | Overlap = overlap; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Export/IExportOptionsCatalog.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | 7 | namespace Core2D.ViewModels.Export; 8 | 9 | public interface IExportOptionsCatalog 10 | { 11 | ExportOptionsBase Create(string writerName); 12 | 13 | bool TryCreate(string writerName, out ExportOptionsBase options); 14 | 15 | IReadOnlyCollection Describe(); 16 | } 17 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Editor/IDialogPresenter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | using Core2D.ViewModels.Editor; 7 | 8 | namespace Core2D.Model.Editor; 9 | 10 | public interface IDialogPresenter 11 | { 12 | IList? Dialogs { get; set; } 13 | 14 | void ShowDialog(DialogViewModel? dialogViewModel); 15 | 16 | void CloseDialog(DialogViewModel? dialogViewModel); 17 | } 18 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/IFillDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Style; 6 | 7 | namespace Core2D.Model.Renderer.Nodes; 8 | 9 | public interface IFillDrawNode : IDrawNode 10 | { 11 | BaseColorViewModel? Color { get; set; } 12 | 13 | double X { get; set; } 14 | 15 | double Y { get; set; } 16 | 17 | double Width { get; set; } 18 | 19 | double Height { get; set; } 20 | } 21 | -------------------------------------------------------------------------------- /src/Core2D/Rendering/IRendererProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Immutable; 6 | using Core2D.Model.Renderer; 7 | using Core2D.ViewModels.Renderer; 8 | 9 | namespace Core2D.Rendering; 10 | 11 | public interface IRendererProvider 12 | { 13 | ImmutableArray Options { get; } 14 | 15 | RendererOption? GetOption(string id); 16 | 17 | IShapeRenderer CreateRenderer(string id); 18 | } 19 | -------------------------------------------------------------------------------- /src/Core2D.Controls.Ruler/Core2D.Controls.Ruler.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | enable 6 | Core2D 7 | Core2D.Controls.Ruler 8 | enable 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IProjectExporter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.IO; 6 | using Core2D.ViewModels.Containers; 7 | 8 | namespace Core2D.Model; 9 | 10 | public interface IProjectExporter 11 | { 12 | void Save(Stream stream, PageContainerViewModel container); 13 | 14 | void Save(Stream stream, DocumentContainerViewModel document); 15 | 16 | void Save(Stream stream, ProjectContainerViewModel project); 17 | } 18 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.Avalonia/AvaloniaRendererViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using Core2D.ViewModels.Renderer; 7 | 8 | namespace Core2D.Modules.Renderer.Avalonia; 9 | 10 | public class AvaloniaRendererViewModel : NodeRendererViewModel 11 | { 12 | public AvaloniaRendererViewModel(IServiceProvider? serviceProvider) 13 | : base(serviceProvider, new AvaloniaDrawNodeFactory()) 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/ISvgConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | using System.IO; 7 | using Core2D.ViewModels.Shapes; 8 | 9 | namespace Core2D.Model; 10 | 11 | public interface ISvgConverter 12 | { 13 | IList? Convert(Stream stream, out double width, out double height); 14 | 15 | IList? FromString(string text, out double width, out double height); 16 | } 17 | -------------------------------------------------------------------------------- /src/Core2D/Util/Utilities.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using System; 5 | using System.Threading.Tasks; 6 | using Avalonia.Threading; 7 | 8 | namespace Core2D.Util; 9 | 10 | public static class Utilities 11 | { 12 | public static async Task RunUiJob(Action action) 13 | { 14 | await Dispatcher.UIThread.InvokeAsync(() => 15 | { 16 | action.Invoke(); 17 | Dispatcher.UIThread.RunJobs(); 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.SkiaSharp/SkiaSharpRendererViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using Core2D.ViewModels.Renderer; 7 | 8 | namespace Core2D.Modules.Renderer.SkiaSharp; 9 | 10 | public class SkiaSharpRendererViewModel : NodeRendererViewModel 11 | { 12 | public SkiaSharpRendererViewModel(IServiceProvider? serviceProvider) 13 | : base(serviceProvider, new SkiaSharpDrawNodeFactory()) 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Core2D/Views/Wizard/Export/ExportWizardView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Avalonia.Controls; 6 | using Avalonia.Markup.Xaml; 7 | 8 | namespace Core2D.Views.Wizard.Export; 9 | 10 | public partial class ExportWizardView : UserControl 11 | { 12 | public ExportWizardView() 13 | { 14 | InitializeComponent(); 15 | } 16 | 17 | private void InitializeComponent() 18 | => AvaloniaXamlLoader.Load(this); 19 | } 20 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Export/ExportOptionsDescriptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | 8 | namespace Core2D.ViewModels.Export; 9 | 10 | public sealed record ExportOptionsDescriptor( 11 | string WriterName, 12 | string DisplayName, 13 | string Description, 14 | string Category, 15 | IReadOnlyList Capabilities, 16 | string Extension, 17 | Func Factory); 18 | -------------------------------------------------------------------------------- /src/Core2D/Configuration/Windows/WindowConfiguration.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | 6 | namespace Core2D.Configuration.Windows; 7 | 8 | public class WindowConfiguration 9 | { 10 | public double X { get; set; } = double.NaN; 11 | public double Y { get; set; } = double.NaN; 12 | public double Width { get; set; } = double.NaN; 13 | public double Height { get; set; } = double.NaN; 14 | public WindowState WindowState { get; set; } = WindowState.Normal; 15 | } 16 | -------------------------------------------------------------------------------- /src/Core2D.Spatial/Spatial/Size2.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using System; 5 | 6 | namespace Core2D.Spatial; 7 | 8 | public struct Size2 9 | { 10 | public readonly double Width; 11 | public readonly double Height; 12 | 13 | public Size2(double width, double height) 14 | { 15 | Width = width; 16 | Height = height; 17 | } 18 | 19 | public void Deconstruct(out double width, out double height) 20 | { 21 | width = Width; 22 | height = Height; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/ShapeStateFlags.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | 7 | namespace Core2D.Model.Renderer; 8 | 9 | [Flags] 10 | public enum ShapeStateFlags 11 | { 12 | Default = 0, 13 | 14 | Visible = 1, 15 | 16 | Printable = 2, 17 | 18 | Locked = 4, 19 | 20 | Size = 8, 21 | 22 | Thickness = 16, 23 | 24 | Connector = 32, 25 | 26 | None = 64, 27 | 28 | Standalone = 128, 29 | 30 | Input = 256, 31 | 32 | Output = 512 33 | } 34 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Documents/PageViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Containers; 6 | using Dock.Model.Core; 7 | using Dock.Model.Mvvm.Controls; 8 | 9 | namespace Core2D.ViewModels.Docking.Documents; 10 | 11 | public class PageViewModel : Document 12 | { 13 | private PageContainerViewModel? _page; 14 | 15 | public PageContainerViewModel? Page 16 | { 17 | get => _page; 18 | set => SetProperty(ref _page, value); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Core2D.Modules.ScriptRunner/Core2D.Modules.ScriptRunner.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IDataObject.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Immutable; 6 | using System.Windows.Input; 7 | using Core2D.ViewModels.Data; 8 | 9 | namespace Core2D.Model; 10 | 11 | public interface IDataObject 12 | { 13 | ImmutableArray Properties { get; set; } 14 | 15 | RecordViewModel? Record { get; set; } 16 | 17 | ICommand AddProperty { get; } 18 | 19 | ICommand RemoveProperty { get; } 20 | 21 | ICommand ResetRecord { get; } 22 | } 23 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Input/InputSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | 7 | namespace Core2D.Model.Input; 8 | 9 | public abstract class InputSource 10 | { 11 | public IObservable? BeginDown { get; set; } 12 | 13 | public IObservable? BeginUp { get; set; } 14 | 15 | public IObservable? EndDown { get; set; } 16 | 17 | public IObservable? EndUp { get; set; } 18 | 19 | public IObservable? Move { get; set; } 20 | } 21 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Documents/TemplateViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Containers; 6 | using Dock.Model.Mvvm.Controls; 7 | 8 | namespace Core2D.ViewModels.Docking.Documents; 9 | 10 | public class TemplateViewModel : Document 11 | { 12 | private TemplateContainerViewModel? _template; 13 | 14 | public TemplateContainerViewModel? Template 15 | { 16 | get => _template; 17 | set => SetProperty(ref _template, value); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IMetafileExporter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using Core2D.Model.Renderer; 7 | using Core2D.ViewModels.Containers; 8 | using Core2D.ViewModels.Shapes; 9 | 10 | namespace Core2D.Model; 11 | 12 | public interface IMetafileExporter 13 | { 14 | MemoryStream? MakeMetafileStream(object bitmap, IEnumerable shapes, IImageCache ic); 15 | MemoryStream? MakeMetafileStream(object bitmap, FrameContainerViewModel container, IImageCache ic); 16 | } 17 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Editor/IRendererSelectionService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Immutable; 6 | using Core2D.Model.Renderer; 7 | using Core2D.ViewModels.Renderer; 8 | 9 | namespace Core2D.ViewModels.Editor; 10 | 11 | public interface IRendererSelectionService 12 | { 13 | ImmutableArray Options { get; } 14 | 15 | RendererOption? SelectedOption { get; } 16 | 17 | IShapeRenderer? Renderer { get; } 18 | 19 | void OnSelectRenderer(object? parameter); 20 | } 21 | -------------------------------------------------------------------------------- /src/Core2D.Browser/Core2D.Browser.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0-browser 4 | Exe 5 | true 6 | enable 7 | true 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Containers/BaseContainerViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | 7 | namespace Core2D.ViewModels.Containers; 8 | 9 | public abstract partial class BaseContainerViewModel : ViewModelBase 10 | { 11 | [AutoNotify] private bool _isVisible; 12 | [AutoNotify] private bool _isExpanded; 13 | 14 | protected BaseContainerViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 15 | { 16 | _isVisible = true; 17 | _isExpanded = false; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Shapes/PointShapeExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using static System.Math; 6 | 7 | namespace Core2D.ViewModels.Shapes; 8 | 9 | public static class PointShapeExtensions 10 | { 11 | public static double DistanceTo(this PointShapeViewModel point, PointShapeViewModel other) 12 | { 13 | var dx = point.X - other.X; 14 | var dy = point.Y - other.Y; 15 | // ReSharper disable once ArrangeRedundantParentheses 16 | return Sqrt((dx * dx) + (dy * dy)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Core2D.Modules.TextFieldReader/Core2D.Modules.TextFieldReader.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Core2D.Modules.TextFieldWriter/Core2D.Modules.TextFieldWriter.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IContainerFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Containers; 6 | 7 | namespace Core2D.Model; 8 | 9 | public interface IContainerFactory 10 | { 11 | TemplateContainerViewModel? GetTemplate(ProjectContainerViewModel project, string name); 12 | 13 | PageContainerViewModel? GetPage(ProjectContainerViewModel project, string name); 14 | 15 | DocumentContainerViewModel? GetDocument(ProjectContainerViewModel project, string name); 16 | 17 | ProjectContainerViewModel? GetProject(); 18 | } 19 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Data/Bindings/BindingPart.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.ViewModels.Data.Bindings; 6 | 7 | internal readonly struct BindingPart 8 | { 9 | public readonly int Start; 10 | public readonly int Length; 11 | public readonly string Path; 12 | public readonly string Value; 13 | 14 | public BindingPart(int start, int length, string path, string value) 15 | { 16 | Start = start; 17 | Length = length; 18 | Path = path; 19 | Value = value; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Core2D/Views/Renderer/RenderState.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.Model; 6 | using Core2D.Model.Renderer; 7 | using Core2D.ViewModels.Containers; 8 | using Core2D.ViewModels.Data; 9 | 10 | namespace Core2D.Views.Renderer; 11 | 12 | public class RenderState 13 | { 14 | public FrameContainerViewModel? Container { get; set; } 15 | public IShapeRenderer? Renderer { get; set; } 16 | public ISelection? Selection { get; set; } 17 | public DataFlow? DataFlow { get; set; } 18 | public RenderType RenderType { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/Nodes/IDrawNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using Core2D.ViewModels.Style; 7 | 8 | namespace Core2D.Model.Renderer.Nodes; 9 | 10 | public interface IDrawNode : IDisposable 11 | { 12 | ShapeStyleViewModel? Style { get; set; } 13 | 14 | bool ScaleThickness { get; set; } 15 | 16 | bool ScaleSize { get; set; } 17 | 18 | void UpdateGeometry(); 19 | 20 | void UpdateStyle(); 21 | 22 | void Draw(object? dc, double zoom); 23 | 24 | void OnDraw(object? dc, double zoom); 25 | } 26 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Editor/History/UndoRedo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | 7 | namespace Core2D.ViewModels.Editor.History; 8 | 9 | public readonly struct UndoRedo 10 | { 11 | public readonly Action? Undo; 12 | 13 | public readonly Action? Redo; 14 | 15 | private UndoRedo(Action? undo, Action? redo) 16 | { 17 | Undo = undo; 18 | Redo = redo; 19 | } 20 | 21 | public static UndoRedo Create(Action? undo, Action? redo) 22 | { 23 | return new UndoRedo(undo, redo); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Serializer/Core2D.Modules.Serializer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/IImageCache.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | using System.ComponentModel; 7 | 8 | namespace Core2D.Model.Renderer; 9 | 10 | public interface IImageCache : INotifyPropertyChanged 11 | { 12 | IEnumerable? Keys { get; } 13 | 14 | string AddImageFromFile(string path, byte[] bytes); 15 | 16 | void AddImage(string key, byte[] bytes); 17 | 18 | byte[]? GetImage(string key); 19 | 20 | void RemoveImage(string key); 21 | 22 | void PurgeUnusedImages(ICollection used); 23 | } 24 | -------------------------------------------------------------------------------- /src/Core2D/Rendering/IRenderHost.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using Avalonia; 7 | using Avalonia.Media; 8 | using Core2D.Model.Renderer; 9 | 10 | namespace Core2D.Rendering; 11 | 12 | internal interface IRenderHost : IDisposable 13 | { 14 | bool Supports(IShapeRenderer? renderer); 15 | 16 | object BeginRender(IShapeRenderer renderer, DrawingContext drawingContext, PixelSize pixelSize, double scaling); 17 | 18 | void EndRender(IShapeRenderer renderer, object renderContext, DrawingContext drawingContext, PixelSize pixelSize, Rect destination); 19 | } 20 | -------------------------------------------------------------------------------- /tests/Core2D.ViewModels.Tests/Core2D.ViewModels.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | false 6 | Core2D.ViewModels.Tests 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IDrawable.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.Model.Renderer; 6 | using Core2D.ViewModels.Style; 7 | 8 | namespace Core2D.Model; 9 | 10 | public interface IDrawable 11 | { 12 | ShapeStyleViewModel? Style { get; set; } 13 | 14 | bool IsStroked { get; set; } 15 | 16 | bool IsFilled { get; set; } 17 | 18 | void DrawShape(object? dc, IShapeRenderer? renderer, ISelection? selection); 19 | 20 | void DrawPoints(object? dc, IShapeRenderer? renderer, ISelection? selection); 21 | 22 | bool Invalidate(IShapeRenderer? renderer); 23 | } 24 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Editor/ITool.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.Model.Input; 6 | using Core2D.ViewModels.Shapes; 7 | 8 | namespace Core2D.Model.Editor; 9 | 10 | public interface ITool 11 | { 12 | string Title { get; } 13 | 14 | void BeginDown(InputArgs args); 15 | 16 | void BeginUp(InputArgs args); 17 | 18 | void EndDown(InputArgs args); 19 | 20 | void EndUp(InputArgs args); 21 | 22 | void Move(InputArgs args); 23 | 24 | void Move(BaseShapeViewModel? shape); 25 | 26 | void Finalize(BaseShapeViewModel? shape); 27 | 28 | void Reset(); 29 | } 30 | -------------------------------------------------------------------------------- /src/Core2D/Views/Renderer/RenderView.axaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | -------------------------------------------------------------------------------- /.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 | - name: Checkout 21 | uses: actions/checkout@v4 22 | with: 23 | submodules: recursive 24 | fetch-depth: 0 25 | - name: Setup .NET Core 26 | uses: actions/setup-dotnet@v1 27 | - name: Install workloads 28 | run: dotnet workload install wasm-tools 29 | - name: Build Release 30 | run: dotnet build -c Release 31 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Wizard/Export/Scopes/ExportScopeFormatter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | 6 | namespace Core2D.ViewModels.Wizard.Export.Scopes; 7 | 8 | public static class ExportScopeFormatter 9 | { 10 | public static string Describe(ExportScopeSelection scope) 11 | { 12 | return scope.Kind switch 13 | { 14 | ExportScopeKind.Page when scope.Page is { } page => $"Page: {page.Name}", 15 | ExportScopeKind.Document when scope.Document is { } document => $"Document: {document.Name}", 16 | _ => $"Project: {scope.Project.Name}" 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Editor/IEditorCanvasPlatform.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | 7 | namespace Core2D.Model.Editor; 8 | 9 | public interface IEditorCanvasPlatform 10 | { 11 | Action? InvalidateControl { get; set; } 12 | 13 | Action? ResetZoom { get; set; } 14 | 15 | Action? FillZoom { get; set; } 16 | 17 | Action? UniformZoom { get; set; } 18 | 19 | Action? UniformToFillZoom { get; set; } 20 | 21 | Action? AutoFitZoom { get; set; } 22 | 23 | Action? InZoom { get; set; } 24 | 25 | Action? OutZoom { get; set; } 26 | 27 | object? Zoom { get; set; } 28 | } 29 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Layout/GraphLayoutEnums.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | 6 | namespace Core2D.ViewModels.Layout; 7 | 8 | public enum GraphLayoutAlgorithm 9 | { 10 | Layered, 11 | FastIncremental, 12 | MultiDimensionalScaling 13 | } 14 | 15 | public enum GraphLayoutDirection 16 | { 17 | TopToBottom, 18 | BottomToTop, 19 | LeftToRight, 20 | RightToLeft 21 | } 22 | 23 | public enum GraphLayoutEdgeRouting 24 | { 25 | Straight, 26 | Spline, 27 | Bundled, 28 | Rectilinear 29 | } 30 | 31 | public enum GraphLayoutScope 32 | { 33 | Selection, 34 | CurrentLayer 35 | } 36 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Views/HomeMenuView.axaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Editor/Tools/Selection/WireSelection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using Core2D.ViewModels.Containers; 7 | using Core2D.ViewModels.Shapes; 8 | using Core2D.ViewModels.Style; 9 | 10 | namespace Core2D.ViewModels.Editor.Tools.Selection; 11 | 12 | public class WireSelection : LineSelection 13 | { 14 | public WireShapeViewModel Wire { get; } 15 | 16 | public WireSelection(IServiceProvider? serviceProvider, LayerContainerViewModel layer, WireShapeViewModel shape, ShapeStyleViewModel style) 17 | : base(serviceProvider, layer, shape, style) 18 | { 19 | Wire = shape; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.OpenXml/OpenXmlColorExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using DocumentFormat.OpenXml.Drawing; 6 | 7 | namespace Core2D.Modules.Renderer.OpenXml; 8 | 9 | internal static class OpenXmlColorExtensions 10 | { 11 | public static SolidFill ToSolidFill(this OpenXmlColor color) 12 | { 13 | var srgb = new RgbColorModelHex 14 | { 15 | Val = $"{color.R:X2}{color.G:X2}{color.B:X2}" 16 | }; 17 | 18 | srgb.AppendChild(new Alpha 19 | { 20 | Val = (int)System.Math.Round(color.A / 255.0 * 100000.0) 21 | }); 22 | 23 | return new SolidFill(srgb); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IFileSystem.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.IO; 6 | 7 | namespace Core2D.Model; 8 | 9 | public interface IFileSystem 10 | { 11 | string? GetBaseDirectory(); 12 | 13 | bool Exists(string path); 14 | 15 | Stream? Open(string path); 16 | 17 | Stream? Create(string path); 18 | 19 | byte[]? ReadBinary(Stream stream); 20 | 21 | void WriteBinary(Stream stream, byte[]? bytes); 22 | 23 | string? ReadUtf8Text(Stream stream); 24 | 25 | void WriteUtf8Text(Stream stream, string? text); 26 | 27 | string? ReadUtf8Text(string path); 28 | 29 | void WriteUtf8Text(string path, string? text); 30 | } 31 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/IDecorator.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | using Core2D.Model.Input; 7 | using Core2D.ViewModels.Containers; 8 | using Core2D.ViewModels.Shapes; 9 | 10 | namespace Core2D.Model.Renderer; 11 | 12 | public interface IDecorator : IDrawable 13 | { 14 | LayerContainerViewModel? Layer { get; set; } 15 | 16 | IList? Shapes { get; set; } 17 | 18 | bool IsVisible { get; } 19 | 20 | void Update(bool rebuild = true); 21 | 22 | void Show(); 23 | 24 | void Hide(); 25 | 26 | bool HitTest(InputArgs args); 27 | 28 | void Move(InputArgs args); 29 | } 30 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Path/PathSegmentViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | using Core2D.ViewModels.Shapes; 8 | 9 | namespace Core2D.ViewModels.Path; 10 | 11 | public abstract partial class PathSegmentViewModel : ViewModelBase 12 | { 13 | [AutoNotify] private bool _isStroked; 14 | 15 | protected PathSegmentViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 16 | { 17 | } 18 | 19 | public abstract void GetPoints(IList points); 20 | 21 | public abstract string ToXamlString(); 22 | 23 | public abstract string ToSvgString(); 24 | } 25 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/ILog.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | 7 | namespace Core2D.Model; 8 | 9 | public interface ILog : IDisposable 10 | { 11 | string? LastMessage { get; } 12 | 13 | void Initialize(string path); 14 | 15 | void Close(); 16 | 17 | void LogInformation(string message); 18 | 19 | void LogInformation(string format, params object[] args); 20 | 21 | void LogWarning(string message); 22 | 23 | void LogWarning(string format, params object[] args); 24 | 25 | void LogError(string message); 26 | 27 | void LogError(string format, params object[] args); 28 | 29 | void LogException(Exception ex); 30 | } 31 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Editor/IShapeEditor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | using Core2D.ViewModels.Path; 7 | using Core2D.ViewModels.Shapes; 8 | using Core2D.ViewModels.Style; 9 | 10 | namespace Core2D.Model.Editor; 11 | 12 | public interface IShapeEditor 13 | { 14 | void BreakPathFigure(PathFigureViewModel pathFigure, ShapeStyleViewModel style, bool isStroked, bool isFilled, List result); 15 | 16 | bool BreakPathShape(PathShapeViewModel pathShape, List result); 17 | 18 | void BreakShape(BaseShapeViewModel shape, List result, List remove); 19 | } 20 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Wizard/Export/IWizardStepViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace Core2D.ViewModels.Wizard.Export; 9 | 10 | public interface IWizardStepViewModel 11 | { 12 | int Order { get; } 13 | 14 | string Title { get; } 15 | 16 | string Description { get; } 17 | 18 | WizardStepState State { get; } 19 | 20 | Task EnterAsync(CancellationToken cancellationToken); 21 | 22 | Task LeaveAsync(CancellationToken cancellationToken); 23 | 24 | Task ValidateAsync(CancellationToken cancellationToken); 25 | 26 | void AttachContext(ExportWizardContext context); 27 | } 28 | -------------------------------------------------------------------------------- /src/Core2D/Views/Style/FillStyleView.axaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IWmfImporter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | using System.IO; 7 | using Core2D.ViewModels.Shapes; 8 | using Core2D.ViewModels.Style; 9 | 10 | namespace Core2D.Model; 11 | 12 | public sealed class WmfImportResult 13 | { 14 | public WmfImportResult(IList shapes, IList styles) 15 | { 16 | Shapes = shapes; 17 | Styles = styles; 18 | } 19 | 20 | public IList Shapes { get; } 21 | 22 | public IList Styles { get; } 23 | } 24 | 25 | public interface IWmfImporter 26 | { 27 | WmfImportResult? Import(Stream stream); 28 | } 29 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.Avalonia/Core2D.Modules.Renderer.Avalonia.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | true 9 | $(BaseIntermediateOutputPath)\GeneratedFiles 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.SkiaSharp/Nodes/Markers/ArrowMarker.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using SkiaSharp; 6 | 7 | namespace Core2D.Modules.Renderer.SkiaSharp.Nodes.Markers; 8 | 9 | internal class ArrowMarker : MarkerBase 10 | { 11 | public SKPoint P11; 12 | public SKPoint P21; 13 | public SKPoint P12; 14 | public SKPoint P22; 15 | 16 | public override void Draw(object? dc) 17 | { 18 | if (dc is not SKCanvas canvas) 19 | { 20 | return; 21 | } 22 | 23 | if (ShapeViewModel is { } && ShapeViewModel.IsStroked) 24 | { 25 | canvas.DrawLine(P11, P21, Pen); 26 | canvas.DrawLine(P12, P22, Pen); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Editor/Tools/Selection/PathSelection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Containers; 6 | using Core2D.ViewModels.Shapes; 7 | using Core2D.ViewModels.Style; 8 | 9 | namespace Core2D.ViewModels.Editor.Tools.Selection; 10 | 11 | public partial class PathSelection 12 | { 13 | private readonly LayerContainerViewModel _layer; 14 | private readonly PathShapeViewModel _path; 15 | private readonly ShapeStyleViewModel _styleViewModel; 16 | 17 | public PathSelection(LayerContainerViewModel layer, PathShapeViewModel shape, ShapeStyleViewModel style) 18 | { 19 | _layer = layer; 20 | _path = shape; 21 | _styleViewModel = style; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Renderer/IGrid.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Style; 6 | 7 | namespace Core2D.Model.Renderer; 8 | 9 | public interface IGrid 10 | { 11 | bool IsGridEnabled { get; set; } 12 | 13 | bool IsBorderEnabled { get; set; } 14 | 15 | double GridOffsetLeft { get; set; } 16 | 17 | double GridOffsetTop { get; set; } 18 | 19 | double GridOffsetRight { get; set; } 20 | 21 | double GridOffsetBottom { get; set; } 22 | 23 | double GridCellWidth { get; set; } 24 | 25 | double GridCellHeight { get; set; } 26 | 27 | BaseColorViewModel? GridStrokeColor { get; set; } 28 | 29 | double GridStrokeThickness { get; set; } 30 | 31 | bool IsDirty(); 32 | } 33 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Input/InputTarget.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Input; 6 | 7 | public abstract class InputTarget 8 | { 9 | public abstract void BeginDown(InputArgs args); 10 | 11 | public abstract void BeginUp(InputArgs args); 12 | 13 | public abstract void EndDown(InputArgs args); 14 | 15 | public abstract void EndUp(InputArgs args); 16 | 17 | public abstract void Move(InputArgs args); 18 | 19 | public abstract bool IsBeginDownAvailable(); 20 | 21 | public abstract bool IsBeginUpAvailable(); 22 | 23 | public abstract bool IsEndDownAvailable(); 24 | 25 | public abstract bool IsEndUpAvailable(); 26 | 27 | public abstract bool IsMoveAvailable(); 28 | } 29 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Editor/IClipboardService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | using System.Threading.Tasks; 7 | using Core2D.ViewModels.Shapes; 8 | 9 | namespace Core2D.ViewModels.Editor; 10 | 11 | public interface IClipboardService 12 | { 13 | IList? Copy(IList shapes); 14 | void OnCopyShapes(IList shapes); 15 | void OnPasteShapes(IEnumerable? shapes); 16 | void OnTryPaste(string text); 17 | bool CanCopy(); 18 | Task CanPaste(); 19 | void OnCut(object? item); 20 | void OnCopy(object? item); 21 | void OnPaste(object? item); 22 | void OnDelete(object? item); 23 | } 24 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Editor/IBounds.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | using Core2D.ViewModels.Shapes; 8 | using Core2D.Spatial; 9 | 10 | namespace Core2D.Model.Editor; 11 | 12 | public interface IBounds 13 | { 14 | Type TargetType { get; } 15 | 16 | PointShapeViewModel? TryToGetPoint(BaseShapeViewModel shape, Point2 target, double radius, double scale, IDictionary registered); 17 | 18 | bool Contains(BaseShapeViewModel shape, Point2 target, double radius, double scale, IDictionary registered); 19 | 20 | bool Overlaps(BaseShapeViewModel shape, Rect2 target, double radius, double scale, IDictionary registered); 21 | } 22 | -------------------------------------------------------------------------------- /src/Core2D/Views/Libraries/BlocksView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using Avalonia.Controls; 5 | using Avalonia.Interactivity; 6 | using Core2D.ViewModels.Containers; 7 | using Core2D.ViewModels.Shapes; 8 | 9 | namespace Core2D.Views.Libraries; 10 | 11 | public partial class BlocksView : UserControl 12 | { 13 | public BlocksView() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | private void OnGroupDoubleTapped(object? sender, RoutedEventArgs e) 19 | { 20 | if (DataContext is ProjectContainerViewModel project && sender is Control control && control.DataContext is BlockShapeViewModel group) 21 | { 22 | project.OnEditGroup(group); 23 | e.Handled = true; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Input/InputArgsObserver.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | 7 | namespace Core2D.Model.Input; 8 | 9 | internal class InputArgsObserver : IObserver 10 | { 11 | private readonly InputTarget _target; 12 | private readonly Action _onNext; 13 | 14 | public InputArgsObserver(InputTarget target, Action onNext) 15 | { 16 | _target = target; 17 | _onNext = onNext; 18 | } 19 | 20 | public void OnCompleted() 21 | { 22 | } 23 | 24 | public void OnError(Exception error) 25 | { 26 | } 27 | 28 | public void OnNext(InputArgs value) 29 | { 30 | _onNext(_target, value); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Docking/Documents/BlockDocumentViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Containers; 6 | using Core2D.ViewModels.Shapes; 7 | using Dock.Model.Mvvm.Controls; 8 | 9 | namespace Core2D.ViewModels.Docking.Documents; 10 | 11 | public class BlockDocumentViewModel : Document 12 | { 13 | private BlockShapeViewModel? _group; 14 | private PageContainerViewModel? _container; 15 | 16 | public BlockShapeViewModel? Group 17 | { 18 | get => _group; 19 | set => SetProperty(ref _group, value); 20 | } 21 | 22 | public PageContainerViewModel? Container 23 | { 24 | get => _container; 25 | set => SetProperty(ref _container, value); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Core2D/Behaviors/AttachEditorBehavior.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Avalonia.Controls; 6 | using Avalonia.Xaml.Interactivity; 7 | 8 | namespace Core2D.Behaviors; 9 | 10 | public class AttachEditorBehavior : Behavior 11 | { 12 | private AttachEditor? _input; 13 | 14 | protected override void OnAttached() 15 | { 16 | base.OnAttached(); 17 | 18 | if (AssociatedObject is { }) 19 | { 20 | _input = new AttachEditor(AssociatedObject); 21 | } 22 | } 23 | 24 | protected override void OnDetaching() 25 | { 26 | base.OnDetaching(); 27 | 28 | if (AssociatedObject is { }) 29 | { 30 | _input?.Detach(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Editor/Tools/Selection/PointSelection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Containers; 6 | using Core2D.ViewModels.Shapes; 7 | using Core2D.ViewModels.Style; 8 | 9 | namespace Core2D.ViewModels.Editor.Tools.Selection; 10 | 11 | public partial class PointSelection 12 | { 13 | private readonly LayerContainerViewModel _layer; 14 | private readonly PointShapeViewModel _shapeViewModel; 15 | private readonly ShapeStyleViewModel _styleViewModel; 16 | 17 | public PointSelection(LayerContainerViewModel layer, PointShapeViewModel shape, ShapeStyleViewModel style) 18 | { 19 | _layer = layer; 20 | _shapeViewModel = shape; 21 | _styleViewModel = style; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Core2D/Converters/IsBlockConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Globalization; 7 | using Avalonia.Data.Converters; 8 | using Core2D.ViewModels.Shapes; 9 | 10 | namespace Core2D.Converters; 11 | 12 | public class IsBlockConverter : IValueConverter 13 | { 14 | public static IsBlockConverter Instance = new(); 15 | 16 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 17 | { 18 | return value is { } && value.GetType() == typeof(BlockShapeViewModel); 19 | } 20 | 21 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Core2D.Spatial/Spatial/Sat/Projection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using System; 5 | 6 | namespace Core2D.Spatial.Sat; 7 | 8 | public struct Projection 9 | { 10 | public readonly double Min; 11 | public readonly double Max; 12 | 13 | public Projection(double min, double max) 14 | { 15 | Min = min; 16 | Max = max; 17 | } 18 | 19 | public bool Overlap(Projection p) 20 | { 21 | return !(Min > p.Max || p.Min > Max); 22 | } 23 | 24 | public double GetOverlap(Projection p) 25 | { 26 | return !Overlap(p) ? 0.0 : Math.Abs(Math.Max(Min, p.Min) - Math.Min(Max, p.Max)); 27 | } 28 | 29 | public bool Contains(Projection p) 30 | { 31 | return Min <= p.Min && Max >= p.Max; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/Input/InputArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | namespace Core2D.Model.Input; 6 | 7 | public readonly struct InputArgs 8 | { 9 | public double X { get; } 10 | 11 | public double Y { get; } 12 | 13 | public ModifierFlags Modifier { get; } 14 | 15 | public InputArgs(double x, double y, ModifierFlags modifier) 16 | { 17 | X = x; 18 | Y = y; 19 | Modifier = modifier; 20 | } 21 | 22 | public void Deconstruct(out double x, out double y) 23 | { 24 | x = X; 25 | y = Y; 26 | } 27 | 28 | public void Deconstruct(out double x, out double y, out ModifierFlags modifier) 29 | { 30 | x = X; 31 | y = Y; 32 | modifier = Modifier; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Documents/PageView.axaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Wizard/Export/WizardNavigationService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | 8 | namespace Core2D.ViewModels.Wizard.Export; 9 | 10 | public sealed class WizardNavigationService 11 | { 12 | public event EventHandler<(int OldIndex, int NewIndex)>? StepChanged; 13 | 14 | public bool CanMoveNext(IReadOnlyList steps, int currentIndex) 15 | => steps.Count > 0 && currentIndex < steps.Count - 1; 16 | 17 | public bool CanMoveBack(IReadOnlyList steps, int currentIndex) 18 | => steps.Count > 0 && currentIndex > 0; 19 | 20 | public void NotifyStepChanged(int oldIndex, int newIndex) 21 | => StepChanged?.Invoke(this, (oldIndex, newIndex)); 22 | } 23 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Documents/TemplateView.axaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.SkiaSharp/Core2D.Modules.Renderer.SkiaSharp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | true 9 | $(BaseIntermediateOutputPath)\GeneratedFiles 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Rendering/ImmediateRenderHost.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Avalonia; 6 | using Avalonia.Media; 7 | using Core2D.Model.Renderer; 8 | 9 | namespace Core2D.Rendering; 10 | 11 | internal sealed class ImmediateRenderHost : IRenderHost 12 | { 13 | public bool Supports(IShapeRenderer? renderer) => true; 14 | 15 | public object BeginRender(IShapeRenderer renderer, DrawingContext drawingContext, PixelSize pixelSize, double scaling) 16 | => drawingContext; 17 | 18 | public void EndRender(IShapeRenderer renderer, object renderContext, DrawingContext drawingContext, PixelSize pixelSize, Rect destination) 19 | { 20 | // No additional presentation work required for immediate renderers. 21 | } 22 | 23 | public void Dispose() 24 | { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Documents/BlockDocumentView.axaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/Segments/LineSegmentView.axaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.Avalonia/Nodes/Markers/ArrowMarker.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using A = Avalonia; 6 | using AM = Avalonia.Media; 7 | using AP = Avalonia.Platform; 8 | 9 | namespace Core2D.Modules.Renderer.Avalonia.Nodes.Markers; 10 | 11 | internal class ArrowMarker : MarkerBase 12 | { 13 | public A.Point P11; 14 | public A.Point P21; 15 | public A.Point P12; 16 | public A.Point P22; 17 | 18 | public override void Draw(object? dc) 19 | { 20 | if (dc is not AM.DrawingContext context) 21 | { 22 | return; 23 | } 24 | 25 | if (ShapeViewModel is { } && ShapeViewModel.IsStroked && Pen is { }) 26 | { 27 | context.DrawLine(Pen, P11, P21); 28 | context.DrawLine(Pen, P12, P22); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Wizard/Export/Exporters/ExporterCategoryViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.ObjectModel; 7 | using Core2D.ViewModels; 8 | 9 | namespace Core2D.ViewModels.Wizard.Export.Exporters; 10 | 11 | public partial class ExporterCategoryViewModel : ViewModelBase 12 | { 13 | public ExporterCategoryViewModel(IServiceProvider? serviceProvider, string title) 14 | : base(serviceProvider) 15 | { 16 | Title = title; 17 | } 18 | 19 | [AutoNotify] private string _title = string.Empty; 20 | 21 | public ObservableCollection Entries { get; } = new(); 22 | 23 | public override object Copy(System.Collections.Generic.IDictionary? shared) 24 | => throw new NotSupportedException(); 25 | } 26 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Wizard/Export/Steps/SummaryIssueViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | 6 | namespace Core2D.ViewModels.Wizard.Export.Steps; 7 | 8 | public enum SummaryIssueSeverity 9 | { 10 | Warning, 11 | Error 12 | } 13 | 14 | public sealed class SummaryIssueViewModel 15 | { 16 | public SummaryIssueViewModel(SummaryIssueSeverity severity, string message) 17 | { 18 | Severity = severity; 19 | Message = message; 20 | } 21 | 22 | public SummaryIssueSeverity Severity { get; } 23 | 24 | public string Message { get; } 25 | 26 | public string Icon => Severity == SummaryIssueSeverity.Error ? "✖" : "⚠"; 27 | 28 | public bool IsError => Severity == SummaryIssueSeverity.Error; 29 | 30 | public bool IsWarning => Severity == SummaryIssueSeverity.Warning; 31 | } 32 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IDwgImporter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | using System.IO; 7 | using Core2D.ViewModels.Shapes; 8 | using Core2D.ViewModels.Style; 9 | 10 | namespace Core2D.Model; 11 | 12 | public sealed class DwgImportResult 13 | { 14 | public DwgImportResult(IList shapes, IList blocks, IList styles) 15 | { 16 | Shapes = shapes; 17 | Blocks = blocks; 18 | Styles = styles; 19 | } 20 | 21 | public IList Shapes { get; } 22 | 23 | public IList Blocks { get; } 24 | 25 | public IList Styles { get; } 26 | } 27 | 28 | public interface IDwgImporter 29 | { 30 | DwgImportResult? Import(Stream stream); 31 | } 32 | -------------------------------------------------------------------------------- /src/Core2D/Converters/ObjectEqualityMultiConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Globalization; 8 | using Avalonia; 9 | using Avalonia.Data.Converters; 10 | 11 | namespace Core2D.Converters; 12 | 13 | public class ObjectEqualityMultiConverter : IMultiValueConverter 14 | { 15 | public static ObjectEqualityMultiConverter Instance = new(); 16 | 17 | public object? Convert(IList? values, Type targetType, object? parameter, CultureInfo culture) 18 | { 19 | if (values is { } && values.Count == 2 && values[0] != AvaloniaProperty.UnsetValue && values[1] != AvaloniaProperty.UnsetValue) 20 | { 21 | return values[0]?.Equals(values[1]); 22 | } 23 | return AvaloniaProperty.UnsetValue; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Export/Options/DefaultExportOptionsViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | 8 | namespace Core2D.ViewModels.Export.Options; 9 | 10 | public partial class DefaultExportOptionsViewModel : ExportOptionsBase 11 | { 12 | [AutoNotify] private string _notes = string.Empty; 13 | 14 | public DefaultExportOptionsViewModel(IServiceProvider? serviceProvider) 15 | : base(serviceProvider, "Exporter", "Default exporter options.") 16 | { 17 | } 18 | 19 | public override object Copy(IDictionary? shared) 20 | => new DefaultExportOptionsViewModel(ServiceProvider) 21 | { 22 | DisplayName = DisplayName, 23 | Description = Description, 24 | Notes = Notes 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IVisioImporter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | using System.IO; 7 | using Core2D.ViewModels.Shapes; 8 | using Core2D.ViewModels.Style; 9 | 10 | namespace Core2D.Model; 11 | 12 | public sealed class VisioImportResult 13 | { 14 | public VisioImportResult(IList shapes, IList blocks, IList styles) 15 | { 16 | Shapes = shapes; 17 | Blocks = blocks; 18 | Styles = styles; 19 | } 20 | 21 | public IList Shapes { get; } 22 | 23 | public IList Blocks { get; } 24 | 25 | public IList Styles { get; } 26 | } 27 | 28 | public interface IVisioImporter 29 | { 30 | VisioImportResult? Import(Stream stream); 31 | } 32 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Data/ValueViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | 8 | namespace Core2D.ViewModels.Data; 9 | 10 | public partial class ValueViewModel : ViewModelBase 11 | { 12 | [AutoNotify] private string? _content; 13 | 14 | public ValueViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 15 | { 16 | } 17 | 18 | public override object Copy(IDictionary? shared) 19 | { 20 | var copy = new ValueViewModel(ServiceProvider) 21 | { 22 | Name = Name, 23 | Content = Content 24 | }; 25 | 26 | return copy; 27 | } 28 | 29 | public override bool IsDirty() 30 | { 31 | var isDirty = base.IsDirty(); 32 | return isDirty; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.Avalonia/Nodes/Markers/EllipseMarker.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using AP = Avalonia.Platform; 6 | using AM = Avalonia.Media; 7 | 8 | namespace Core2D.Modules.Renderer.Avalonia.Nodes.Markers; 9 | 10 | internal class EllipseMarker : MarkerBase 11 | { 12 | public AM.EllipseGeometry? EllipseGeometry { get; set; } 13 | 14 | public override void Draw(object? dc) 15 | { 16 | if (dc is not AM.DrawingContext context) 17 | { 18 | return; 19 | } 20 | 21 | if (ShapeViewModel is { } && EllipseGeometry is { }) 22 | { 23 | using var rotationDisposable = context.PushTransform(Rotation); 24 | context.DrawGeometry(ShapeViewModel.IsFilled ? Brush : null, ShapeViewModel.IsStroked ? Pen : null, EllipseGeometry); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.SparseStrips/Core2D.Modules.Renderer.SparseStrips.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | true 9 | $(BaseIntermediateOutputPath)\GeneratedFiles 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Data/ColumnViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | 8 | namespace Core2D.ViewModels.Data; 9 | 10 | public partial class ColumnViewModel : ViewModelBase 11 | { 12 | [AutoNotify] private bool _isVisible; 13 | 14 | public ColumnViewModel(IServiceProvider? serviceProvider) : base(serviceProvider) 15 | { 16 | } 17 | 18 | public override object Copy(IDictionary? shared) 19 | { 20 | var copy = new ColumnViewModel(ServiceProvider) 21 | { 22 | Name = Name, 23 | IsVisible = IsVisible 24 | }; 25 | 26 | return copy; 27 | } 28 | 29 | public override bool IsDirty() 30 | { 31 | var isDirty = base.IsDirty(); 32 | return isDirty; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Core2D/Converters/IsCurrentToolConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using System; 5 | using System.Globalization; 6 | using Avalonia; 7 | using Avalonia.Data.Converters; 8 | using Core2D.Model.Editor; 9 | 10 | namespace Core2D.Converters; 11 | 12 | public class IsCurrentToolConverter : IValueConverter 13 | { 14 | public static IsCurrentToolConverter Instance = new(); 15 | 16 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 17 | { 18 | if (value is ITool tool && parameter is string title) 19 | { 20 | return tool.Title == title; 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 | } 30 | -------------------------------------------------------------------------------- /src/Core2D/Converters/SelectedShapesHasItemsValueConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Globalization; 8 | using Avalonia; 9 | using Avalonia.Data.Converters; 10 | using Core2D.ViewModels.Shapes; 11 | 12 | namespace Core2D.Converters; 13 | 14 | public class SelectedShapesHasItemsValueConverter : IValueConverter 15 | { 16 | public static SelectedShapesHasItemsValueConverter Instance = new(); 17 | 18 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 19 | { 20 | return value is ISet items && items.Count > 0; 21 | } 22 | 23 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Core2D.Desktop/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.WinForms/Core2D.Modules.Renderer.WinForms.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | true 9 | $(BaseIntermediateOutputPath)\GeneratedFiles 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Core2D/App.axaml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Core2D/Behaviors/DragAndDrop/ScriptsListBoxDropHandler.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Avalonia.Controls; 6 | using Avalonia.Input; 7 | 8 | namespace Core2D.Behaviors.DragAndDrop; 9 | 10 | public class ScriptsListBoxDropHandler : ListBoxDropHandler 11 | { 12 | public override bool Validate(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) 13 | { 14 | if (e.Source is Control && sender is ListBox listBox) 15 | { 16 | // TODO: 17 | } 18 | return false; 19 | } 20 | 21 | public override bool Execute(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) 22 | { 23 | if (e.Source is Control && sender is ListBox listBox) 24 | { 25 | // TODO: 26 | } 27 | return false; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Editor/IGraphLayoutService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Core2D.ViewModels.Layout; 6 | 7 | namespace Core2D.ViewModels.Editor; 8 | 9 | public interface IGraphLayoutService 10 | { 11 | GraphLayoutOptionsViewModel Options { get; } 12 | 13 | void OnApplyLayoutToSelection(); 14 | void OnApplyLayoutToPage(); 15 | void OnSelectAlgorithm(object? parameter); 16 | void OnSelectDirection(object? parameter); 17 | void OnSelectEdgeRouting(object? parameter); 18 | void OnToggleAvoidNodeOverlap(); 19 | void OnToggleRouteEdges(); 20 | void OnToggleAlignToGrid(); 21 | void OnToggleKeepLockedNodesFixed(); 22 | void OnIncreaseNodeSeparation(); 23 | void OnDecreaseNodeSeparation(); 24 | void OnIncreaseLayerSeparation(); 25 | void OnDecreaseLayerSeparation(); 26 | void OnResetLayoutOptions(); 27 | } 28 | -------------------------------------------------------------------------------- /src/Core2D/Behaviors/DragAndDrop/TemplatesListBoxDropHandler.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Avalonia.Controls; 6 | using Avalonia.Input; 7 | 8 | namespace Core2D.Behaviors.DragAndDrop; 9 | 10 | public class TemplatesListBoxDropHandler : ListBoxDropHandler 11 | { 12 | public override bool Validate(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) 13 | { 14 | if (e.Source is Control && sender is ListBox listBox) 15 | { 16 | // TODO: 17 | } 18 | return false; 19 | } 20 | 21 | public override bool Execute(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) 22 | { 23 | if (e.Source is Control && sender is ListBox listBox) 24 | { 25 | // TODO: 26 | } 27 | return false; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Core2D/Converters/ArgbColorToBrushConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Globalization; 7 | using Avalonia; 8 | using Avalonia.Data.Converters; 9 | using Avalonia.Media; 10 | 11 | namespace Core2D.Converters; 12 | 13 | public class ArgbColorToBrushConverter : IValueConverter 14 | { 15 | public static ArgbColorToBrushConverter Instance = new(); 16 | 17 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 18 | { 19 | if (value is uint n) 20 | { 21 | return new SolidColorBrush(Color.FromUInt32(n)); 22 | } 23 | return AvaloniaProperty.UnsetValue; 24 | } 25 | 26 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 27 | { 28 | throw new NotImplementedException(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Core2D/Converters/SelectedShapesIsEmptyValueConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Globalization; 8 | using Avalonia; 9 | using Avalonia.Data.Converters; 10 | using Core2D.ViewModels.Shapes; 11 | 12 | namespace Core2D.Converters; 13 | 14 | public class SelectedShapesIsEmptyValueConverter : IValueConverter 15 | { 16 | public static SelectedShapesIsEmptyValueConverter Instance = new(); 17 | 18 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 19 | { 20 | return value is null || (value is ISet items && items.Count == 0); 21 | } 22 | 23 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Core2D/Settings.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using System.IO; 5 | 6 | namespace Core2D; 7 | 8 | public class Settings 9 | { 10 | public string? Theme { get; set; } = null; 11 | public FileInfo[]? Scripts { get; set; } 12 | public FileInfo? Project { get; set; } 13 | public bool UseSkia { get; set; } 14 | public bool UseGpu { get; set; } = true; 15 | public bool AllowEglInitialization { get; set; } = true; 16 | public bool UseWgl { get; set; } 17 | public bool UseWindowsUIComposition { get; set; } = true; 18 | public bool UseDirectX11 { get; set; } 19 | public bool UseManagedSystemDialogs { get; set; } 20 | public bool UseHeadless { get; set; } 21 | public bool UseHeadlessDrawing { get; set; } 22 | public bool UseHeadlessVnc { get; set; } 23 | public string? VncHost { get; set; } = null; 24 | public int VncPort { get; set; } = 5901; 25 | } 26 | -------------------------------------------------------------------------------- /src/Core2D.Spatial/Spatial/Polygon2.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | using System; 5 | 6 | namespace Core2D.Spatial; 7 | 8 | public struct Polygon2 9 | { 10 | public Point2[] Points; 11 | 12 | public Polygon2(Point2[] points) 13 | { 14 | Points = points; 15 | } 16 | 17 | public bool Contains(double x, double y) 18 | { 19 | bool contains = false; 20 | for (int i = 0, j = Points.Length - 1; i < Points.Length; j = i++) 21 | { 22 | if (((Points[i].Y > y) != (Points[j].Y > y)) 23 | && (x < (((Points[j].X - Points[i].X) * (y - Points[i].Y)) / (Points[j].Y - Points[i].Y)) + Points[i].X)) 24 | { 25 | contains = !contains; 26 | } 27 | } 28 | return contains; 29 | } 30 | 31 | public bool Contains(Point2 point) 32 | { 33 | return Contains(point.X, point.Y); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Core2D/Controls/ToggleItem.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using Avalonia; 6 | using Avalonia.Controls.Primitives; 7 | 8 | namespace Core2D.Controls; 9 | 10 | public class ToggleItem : TemplatedControl 11 | { 12 | public static readonly StyledProperty ToggleContentProperty = 13 | AvaloniaProperty.Register(nameof(ToggleContent)); 14 | 15 | public static readonly StyledProperty PopupContentProperty = 16 | AvaloniaProperty.Register(nameof(PopupContent)); 17 | 18 | public object? ToggleContent 19 | { 20 | get => GetValue(ToggleContentProperty); 21 | set => SetValue(ToggleContentProperty, value); 22 | } 23 | 24 | public object? PopupContent 25 | { 26 | get => GetValue(PopupContentProperty); 27 | set => SetValue(PopupContentProperty, value); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.Common/Core2D.Modules.Renderer.Common.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | true 9 | $(BaseIntermediateOutputPath)\GeneratedFiles 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.VelloSharp/Core2D.Modules.Renderer.VelloSharp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | true 9 | $(BaseIntermediateOutputPath)\GeneratedFiles 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Core2D/Converters/FontStyleFlagsConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Globalization; 7 | using Avalonia; 8 | using Avalonia.Data.Converters; 9 | using Core2D.Model.Style; 10 | 11 | namespace Core2D.Converters; 12 | 13 | public class FontStyleFlagsConverter : IValueConverter 14 | { 15 | public static FontStyleFlagsConverter Instance = new(); 16 | 17 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 18 | { 19 | if (value is FontStyleFlags flags && parameter is FontStyleFlags flag) 20 | { 21 | return flags.HasFlag(flag); 22 | } 23 | return AvaloniaProperty.UnsetValue; 24 | } 25 | 26 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 27 | { 28 | throw new NotImplementedException(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Core2D/Converters/ShapeStateFlagsConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Globalization; 7 | using Avalonia; 8 | using Avalonia.Data.Converters; 9 | using Core2D.Model.Renderer; 10 | 11 | namespace Core2D.Converters; 12 | 13 | public class ShapeStateFlagsConverter : IValueConverter 14 | { 15 | public static ShapeStateFlagsConverter Instance = new(); 16 | 17 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 18 | { 19 | if (value is ShapeStateFlags flags && parameter is ShapeStateFlags flag) 20 | { 21 | return flags.HasFlag(flag); 22 | } 23 | return AvaloniaProperty.UnsetValue; 24 | } 25 | 26 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 27 | { 28 | throw new NotImplementedException(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.OpenXml/Core2D.Modules.Renderer.OpenXml.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | true 9 | $(BaseIntermediateOutputPath)\GeneratedFiles 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Core2D/Views/Containers/PageContainerView.axaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.Dwg/Core2D.Modules.Renderer.Dwg.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | true 9 | $(BaseIntermediateOutputPath)\GeneratedFiles 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Properties/PagePropertiesView.axaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Core2D/Converters/SelectedShapesFirstItemValueConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Globalization; 8 | using System.Linq; 9 | using Avalonia; 10 | using Avalonia.Data.Converters; 11 | using Core2D.ViewModels.Shapes; 12 | 13 | namespace Core2D.Converters; 14 | 15 | public class SelectedShapesFirstItemValueConverter : IValueConverter 16 | { 17 | public static SelectedShapesFirstItemValueConverter Instance = new(); 18 | 19 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 20 | { 21 | return value is ISet items && items.Count == 1 22 | ? items.First() 23 | : AvaloniaProperty.UnsetValue; 24 | } 25 | 26 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 27 | { 28 | throw new NotImplementedException(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Core2D/Converters/ShapeToTypeStringConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Globalization; 8 | using Avalonia; 9 | using Avalonia.Data.Converters; 10 | using Core2D.ViewModels.Shapes; 11 | 12 | namespace Core2D.Converters; 13 | 14 | public class ShapeToTypeStringConverter : IMultiValueConverter 15 | { 16 | public static ShapeToTypeStringConverter Instance = new(); 17 | 18 | public object Convert(IList? values, Type targetType, object? parameter, CultureInfo culture) 19 | { 20 | if (values?.Count == 2 && values[0] is string name && values[1] is BaseShapeViewModel shape) 21 | { 22 | if (string.IsNullOrEmpty(name)) 23 | { 24 | return shape.GetType().Name.Replace("ShapeViewModel", ""); 25 | } 26 | return shape.Name; 27 | } 28 | return AvaloniaProperty.UnsetValue; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/Segments/QuadraticBezierSegmentView.axaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.Dxf/Core2D.Modules.Renderer.Dxf.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | False 6 | True 7 | Core2D 8 | true 9 | $(BaseIntermediateOutputPath)\GeneratedFiles 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.SkiaSharp/Nodes/Markers/RectangleMarker.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using SkiaSharp; 6 | 7 | namespace Core2D.Modules.Renderer.SkiaSharp.Nodes.Markers; 8 | 9 | internal class RectangleMarker : MarkerBase 10 | { 11 | public SKRect Rect { get; set; } 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 null) 21 | { 22 | return; 23 | } 24 | 25 | var count = canvas.Save(); 26 | canvas.SetMatrix(MatrixHelper.Multiply(Rotation, canvas.TotalMatrix)); 27 | 28 | if (ShapeViewModel.IsFilled) 29 | { 30 | canvas.DrawRect(Rect, Brush); 31 | } 32 | 33 | if (ShapeViewModel.IsStroked) 34 | { 35 | canvas.DrawRect(Rect, Pen); 36 | } 37 | 38 | canvas.RestoreToCount(count); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/Model/IPathConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | using Core2D.Model.Renderer; 7 | using Core2D.ViewModels.Shapes; 8 | 9 | namespace Core2D.Model; 10 | 11 | public interface IPathConverter 12 | { 13 | PathShapeViewModel? ToPathShape(ISet? shapes); 14 | 15 | PathShapeViewModel? ToPathShape(BaseShapeViewModel? shape); 16 | 17 | PathShapeViewModel? ToStrokePathShape(BaseShapeViewModel? shape); 18 | 19 | PathShapeViewModel? ToFillPathShape(BaseShapeViewModel? shape); 20 | 21 | PathShapeViewModel? ToWindingPathShape(BaseShapeViewModel? shape); 22 | 23 | PathShapeViewModel? Simplify(BaseShapeViewModel? shape); 24 | 25 | PathShapeViewModel? Op(ISet? shapes, PathOp op); 26 | 27 | public PathShapeViewModel? FromSvgPathData(string? svgPath, bool isStroked, bool isFilled); 28 | 29 | public string? ToSvgPathData(BaseShapeViewModel? shape); 30 | } 31 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.SkiaSharp/Nodes/Markers/EllipseMarker.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using SkiaSharp; 6 | 7 | namespace Core2D.Modules.Renderer.SkiaSharp.Nodes.Markers; 8 | 9 | internal class EllipseMarker : MarkerBase 10 | { 11 | public SKRect Rect { get; set; } 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 null) 21 | { 22 | return; 23 | } 24 | 25 | var count = canvas.Save(); 26 | canvas.SetMatrix(MatrixHelper.Multiply(Rotation, canvas.TotalMatrix)); 27 | 28 | if (ShapeViewModel.IsFilled) 29 | { 30 | canvas.DrawOval(Rect, Brush); 31 | } 32 | 33 | if (ShapeViewModel.IsStroked) 34 | { 35 | canvas.DrawOval(Rect, Pen); 36 | } 37 | 38 | canvas.RestoreToCount(count); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Core2D.Modules.Renderer.Avalonia/Nodes/Markers/RectangleMarker.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using A = Avalonia; 6 | using AM = Avalonia.Media; 7 | using AP = Avalonia.Platform; 8 | 9 | namespace Core2D.Modules.Renderer.Avalonia.Nodes.Markers; 10 | 11 | internal class RectangleMarker : MarkerBase 12 | { 13 | public A.Rect Rect { get; set; } 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 null) 23 | { 24 | return; 25 | } 26 | 27 | using var rotationDisposable = context.PushTransform(Rotation); 28 | 29 | if (ShapeViewModel.IsFilled) 30 | { 31 | context.DrawRectangle(Brush, null, Rect); 32 | } 33 | 34 | if (ShapeViewModel.IsStroked) 35 | { 36 | context.DrawRectangle(null, Pen, Rect); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Core2D.ViewModels/ViewModels/Containers/ProjectContainerViewModelExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using Core2D.ViewModels.Shapes; 8 | 9 | namespace Core2D.ViewModels.Containers; 10 | 11 | public static class ProjectContainerViewModelExtensions 12 | { 13 | public static IEnumerable GetAllShapes(this ProjectContainerViewModel project) 14 | { 15 | var shapes = project.Documents 16 | .SelectMany(d => d.Pages) 17 | .SelectMany(c => c.Layers) 18 | .SelectMany(l => l.Shapes); 19 | 20 | return shapes.GetAllShapes().Where(s => s is T).Cast(); 21 | } 22 | 23 | public static IEnumerable GetAllShapes(this ProjectContainerViewModel project) 24 | { 25 | return project.Documents 26 | .SelectMany(d => d.Pages) 27 | .SelectMany(c => c.Layers) 28 | .SelectMany(l => l.Shapes); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Core2D/Converters/ContainerToTypeStringConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Globalization; 8 | using Avalonia; 9 | using Avalonia.Data.Converters; 10 | using Core2D.ViewModels.Containers; 11 | 12 | namespace Core2D.Converters; 13 | 14 | public class ContainerToTypeStringConverter : IMultiValueConverter 15 | { 16 | public static ContainerToTypeStringConverter Instance = new(); 17 | 18 | public object? Convert(IList? values, Type targetType, object? parameter, CultureInfo culture) 19 | { 20 | if (values?.Count == 2 && values[0] is string name && values[1] is BaseContainerViewModel container) 21 | { 22 | if (string.IsNullOrEmpty(name)) 23 | { 24 | return container.GetType().Name.Replace("ContainerViewModel", ""); 25 | } 26 | return container.Name; 27 | } 28 | return AvaloniaProperty.UnsetValue; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/ImageOptionsView.axaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /LICENSE.TXT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 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 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/ProjectOptionsView.axaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Options/RendererOptionsView.axaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Path/PathSizeView.axaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 20 | 21 | -------------------------------------------------------------------------------- /src/Core2D/Converters/SelectedShapesFirstItemStyleValueConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Wiesław Šoltés. All rights reserved. 2 | // Licensed under the MIT. See LICENSE.TXT file in the project root for details. 3 | 4 | #nullable enable 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Globalization; 8 | using System.Linq; 9 | using Avalonia; 10 | using Avalonia.Data.Converters; 11 | using Core2D.ViewModels.Shapes; 12 | 13 | namespace Core2D.Converters; 14 | 15 | public class SelectedShapesFirstItemStyleValueConverter : IValueConverter 16 | { 17 | public static SelectedShapesFirstItemStyleValueConverter Instance = new(); 18 | 19 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 20 | { 21 | if (value is ISet items && items.Count == 1) 22 | { 23 | return items.First().Style; 24 | } 25 | return AvaloniaProperty.UnsetValue; 26 | } 27 | 28 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 29 | { 30 | throw new NotImplementedException(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/StyleLibraryView.axaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/ScriptLibraryView.axaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/ProjectExplorerView.axaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Core2D.Desktop/Core2D.Desktop.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | net9.0 5 | enable 6 | true 7 | app.manifest 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/DatabaseLibraryView.axaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Core2D/Views/Docking/Tools/Libraries/TemplateLibraryView.axaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | --------------------------------------------------------------------------------