-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.axaml
More file actions
143 lines (142 loc) · 9.52 KB
/
MainWindow.axaml
File metadata and controls
143 lines (142 loc) · 9.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<Window
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vector_editor="clr-namespace:vector_editor"
xmlns:converters="using:Avalonia.Controls.Converters"
xmlns:commonControls="clr-namespace:Classic.CommonControls;assembly=Classic.CommonControls.Avalonia"
xmlns:classic="clr-namespace:Classic.Avalonia;assembly=Classic.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="vector_editor.MainWindow"
x:DataType="vector_editor:ViewModelBase"
Title="vector_editor"
xmlns:avaloniaControls="clr-namespace:Avalonia.Controls;assembly=Avalonia.Controls">
<Window.Resources>
<converters:EnumToBoolConverter x:Key="EnumToBoolConverter" x:Shared="False"/>
</Window.Resources>
<Grid Grid.Row="0" RowDefinitions="18,*,40">
<DockPanel>
<Menu>
<MenuItem Header="_File">
<MenuItem Header="_New" InputGesture="Ctrl+N" Command="{Binding ClearCanvasCommand}" HotKey="Ctrl+O" />
<Separator />
<MenuItem Header="_Save" x:Name="SaveMenuItem" InputGesture="Ctrl+S" HotKey="Ctrl+S" />
<MenuItem Header="_Open" x:Name="OpenMenuItem" InputGesture="Ctrl+O" HotKey="Ctrl+O" />
<MenuItem Header="Export as S_VG" x:Name="ExportSvgMenuItem" InputGesture="Ctrl+E" HotKey="Ctrl+E" />
<Separator />
<MenuItem Header="Quit" x:Name="ExitMenuItem" InputGesture="Alt+F4" />
</MenuItem>
<MenuItem Header="_Help">
<MenuItem Header="_About" Click="AboutMenuItem_Click"/>
</MenuItem>
</Menu>
</DockPanel>
<Grid ColumnDefinitions="70,*" Grid.Row="1">
<StackPanel Spacing="2" Margin="2">
<WrapPanel Margin="2">
<commonControls:ToolBarButton
SmallIcon="/assets/elements/points.png"
IsToggleButton="true"
IsChecked="{Binding SelectedElement, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static vector_editor:Elements.points}, Mode=TwoWay}" />
<commonControls:ToolBarButton
SmallIcon="/assets/elements/polygonal.png"
IsToggleButton="true"
IsChecked="{Binding SelectedElement, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static vector_editor:Elements.polygonal}, Mode=TwoWay}" />
<commonControls:ToolBarButton
SmallIcon="/assets/elements/bezier.png"
IsToggleButton="true"
IsChecked="{Binding SelectedElement, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static vector_editor:Elements.bezier}, Mode=TwoWay}" />
<commonControls:ToolBarButton
SmallIcon="/assets/elements/polygon.png"
IsToggleButton="true"
IsChecked="{Binding SelectedElement, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static vector_editor:Elements.polygon}, Mode=TwoWay}" />
<commonControls:ToolBarButton
SmallIcon="/assets/elements/polygon.png"
IsToggleButton="true"
IsChecked="{Binding SelectedElement, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static vector_editor:Elements.regularPolygon}, Mode=TwoWay}" />
<avaloniaControls:NumericUpDown Minimum="3" Maximum="12" Value="{Binding RegularPolygonSides, Mode=TwoWay}" Width="60"/>
<commonControls:ToolBarButton
SmallIcon="/assets/elements/ellipse.png"
IsToggleButton="true"
IsChecked="{Binding SelectedElement, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static vector_editor:Elements.ellipse}, Mode=TwoWay}" />
<commonControls:ToolBarButton
SmallIcon="/assets/elements/new.png"
Command="{Binding NewLineCommand}" />
<commonControls:ToolBarButton
SmallIcon="/assets/effects/move.png"
IsToggleButton="true"
IsChecked="{Binding SelectedEffect, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static vector_editor:Effects.transform}, Mode=TwoWay}" />
<commonControls:ToolBarButton
SmallIcon="/assets/effects/rotate.png"
IsToggleButton="true"
IsChecked="{Binding SelectedEffect, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static vector_editor:Effects.rotate}, Mode=TwoWay}" />
<commonControls:ToolBarButton
SmallIcon="/assets/effects/scale.png"
IsToggleButton="true"
IsChecked="{Binding SelectedEffect, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static vector_editor:Effects.scale}, Mode=TwoWay}" />
<commonControls:ToolBarButton
SmallIcon="/assets/effects/done.png"
IsToggleButton="true"
IsChecked="{Binding SelectedEffect, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static vector_editor:Effects.none}, Mode=TwoWay}" />
</WrapPanel>
<ListBox x:Name="Figures"
SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}"
ItemsSource="{Binding DrawnElements}">
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="Delete" Command="{Binding DeleteLineCommand}" />
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
</StackPanel>
<Border BorderBrush="Red" Grid.Column="1">
<Image x:Name="OutputImage" Stretch="None" />
</Border>
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Margin="10,0,10,0">
<Border Width="40" Height="40" BorderBrush="Black" BorderThickness="0">
<Grid>
<ColorPicker Color="{Binding Color}" Margin="0,0,0,0"
Width="25" Height="25"
HorizontalAlignment="Left" VerticalAlignment="Top" />
<ColorPicker Color="{Binding FillColor}" Margin="0,0,0,0"
Width="25" Height="25"
HorizontalAlignment="Right" VerticalAlignment="Bottom" />
</Grid>
</Border>
</StackPanel>
<StackPanel x:Name="ColorGrid" Grid.Column="1" Margin="0">
<StackPanel Orientation="Horizontal">
<Button Background="#000000" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#7F7F7F" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#880015" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#ED1C24" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#FF7F27" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#FFF200" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#22B14C" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#00A2E8" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#3F48CC" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#A349A4" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0">
<Button Background="#FFFFFF" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#C3C3C3" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#B97A57" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#FFAEC9" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#FFFF88" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#A4C2F4" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#7092BE" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#C8BFE7" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#B5E61D" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
<Button Background="#E6B8AF" Width="20" Height="20" PointerPressed="CellRightClick" Click="CellLeftClick"/>
</StackPanel>
</StackPanel>
</Grid>
</Grid>
</Window>