-
-
Notifications
You must be signed in to change notification settings - Fork 255
/
Copy pathMainWindow.xaml
258 lines (244 loc) · 13.3 KB
/
MainWindow.xaml
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<Window x:Class="Nodify.Playground.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:local="clr-namespace:Nodify.Playground"
xmlns:shared="clr-namespace:Nodify;assembly=Nodify.Shared"
xmlns:nodify="https://miroiu.github.io/nodify"
mc:Ignorable="d"
Title="MainWindow"
Height="700"
Width="1300">
<Window.Resources>
<shared:DebugConverter x:Key="DebugConverter" />
<shared:ToStringConverter x:Key="ToStringConverter" />
</Window.Resources>
<Window.DataContext>
<local:PlaygroundViewModel />
</Window.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<local:NodifyEditorView x:Name="EditorView"
DataContext="{Binding GraphViewModel}"
Grid.RowSpan="3" />
<!--ACTIONS-->
<Border VerticalAlignment="Top"
Background="{DynamicResource PanelBackgroundBrush}"
Padding="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<Button Command="{Binding GenerateRandomNodesCommand}"
Content="GENERATE NODES"
ToolTip="Generate nodes using the specified settings."
Style="{StaticResource HollowButton}" />
<Button Command="{Binding ToggleConnectionsCommand}"
Content="{Binding ConnectNodesText}"
ToolTip="Will add new connections if Connect Nodes is checked, otherwise it will disconnect nodes."
Style="{StaticResource HollowButton}" />
<Button Command="{Binding PerformanceTestCommand}"
Content="PERFORMANCE TEST"
ToolTip="You will encounter rendering performance issues. Try disabling the connections to see the difference."
Style="{StaticResource HollowButton}" />
<Button Command="{Binding ResetCommand}"
Content="RESET PLAYGROUND"
ToolTip="Reset the Location, Zoom, Nodes and Connections."
Style="{StaticResource HollowButton}" />
<Button Click="BringIntoView_Click"
Content="BRING INTO VIEW"
ToolTip="Bring a random node into view."
Style="{StaticResource HollowButton}" />
<Button Command="{x:Static nodify:EditorCommands.FitToScreen}"
Content="FIT TO SCREEN"
ToolTip="Scales the viewport to fit all nodes if that's possible."
CommandTarget="{Binding EditorInstance, ElementName=EditorView}"
Style="{StaticResource HollowButton}" />
<Button Command="{Binding GraphViewModel.CommentSelectionCommand}"
Content="COMMENT SELECTION"
ToolTip="Creates a comment node containing the selected nodes."
Style="{StaticResource HollowButton}" />
<Button Click="AnimateConnections_Click"
Content="TOGGLE CONNECTIONS ANIMATION"
ToolTip="Starts or stops animating the directional arrows on all connections (see DirectionalArrowsCount)"
Style="{StaticResource HollowButton}" />
</StackPanel>
<Button Style="{StaticResource IconButton}"
Content="{StaticResource ThemeIcon}"
Command="{Binding Source={x:Static shared:ThemeManager.SetNextThemeCommand}}"
ToolTip="Change theme"
Grid.Column="1" />
</Grid>
</Border>
<!--SETTINGS-->
<Expander Grid.Row="1"
HorizontalContentAlignment="Left"
VerticalContentAlignment="Center"
HorizontalAlignment="Left"
Background="{DynamicResource PanelBackgroundBrush}"
IsExpanded="True"
ExpandDirection="Left"
Padding="0 1 4 3">
<Expander.Style>
<Style TargetType="{x:Type Expander}"
BasedOn="{StaticResource {x:Type Expander}}">
<Setter Property="Tag"
Value="{StaticResource ExpandRightIcon}" />
<Style.Triggers>
<Trigger Property="IsExpanded"
Value="True">
<Setter Property="Tag"
Value="{StaticResource ExpandLeftIcon}" />
</Trigger>
</Style.Triggers>
</Style>
</Expander.Style>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Margin="0 0 5 10">
<TextBlock Margin="0 0 0 3">Search:</TextBlock>
<TextBox Text="{Binding Source={x:Static local:PlaygroundSettings.Instance}, Path=SearchText, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
Padding="4" />
</StackPanel>
<ScrollViewer Grid.Row="1">
<Grid IsSharedSizeScope="True"
Width="330">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Expander Header="Playground Settings"
Padding="0 5 0 0"
BorderThickness="0 0 0 1"
IsExpanded="True"
BorderBrush="{DynamicResource BackgroundBrush}">
<Expander.Style>
<Style TargetType="{x:Type Expander}"
BasedOn="{StaticResource {x:Type Expander}}">
<Setter Property="Tag"
Value="{StaticResource ExpandRightIcon}" />
<Style.Triggers>
<Trigger Property="IsExpanded"
Value="True">
<Setter Property="Tag"
Value="{StaticResource ExpandDownIcon}" />
</Trigger>
</Style.Triggers>
</Style>
</Expander.Style>
<Border BorderThickness="1"
Padding="10"
HorizontalAlignment="Stretch">
<local:SettingsView Items="{Binding Source={x:Static local:PlaygroundSettings.Instance}, Path=Settings}" />
</Border>
</Expander>
<Expander Header="Editor Settings"
Padding="0 5 0 0"
BorderThickness="0 0 0 1"
IsExpanded="True"
BorderBrush="{DynamicResource BackgroundBrush}"
Grid.Row="1">
<Expander.Style>
<Style TargetType="{x:Type Expander}"
BasedOn="{StaticResource {x:Type Expander}}">
<Setter Property="Tag"
Value="{StaticResource ExpandRightIcon}" />
<Style.Triggers>
<Trigger Property="IsExpanded"
Value="True">
<Setter Property="Tag"
Value="{StaticResource ExpandDownIcon}" />
</Trigger>
</Style.Triggers>
</Style>
</Expander.Style>
<local:EditorSettingsView />
</Expander>
</Grid>
</ScrollViewer>
</Grid>
</Expander>
<!--INFORMATION-->
<Border Grid.Row="2"
Background="{DynamicResource PanelBackgroundBrush}"
VerticalAlignment="Bottom"
Padding="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.Resources>
<Style TargetType="{x:Type TextBlock}"
BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Foreground"
Value="{DynamicResource ForegroundBrush}" />
<Setter Property="Margin"
Value="0 0 15 0" />
</Style>
</Grid.Resources>
<StackPanel Orientation="Horizontal">
<TextBlock ToolTip="The number of selected items.">
<TextBlock.Inlines>
<Run Text="Selected nodes: " />
<Run Foreground="YellowGreen"
Text="{Binding GraphViewModel.SelectedNodes.Count, Mode=OneWay}" />
<Run Text="/" />
<Run Text="{Binding GraphViewModel.Nodes.Count, Mode=OneWay}" />
</TextBlock.Inlines>
</TextBlock>
<TextBlock ToolTip="The number of selected connections.">
<TextBlock.Inlines>
<Run Text="Selected connections: " />
<Run Foreground="YellowGreen"
Text="{Binding GraphViewModel.SelectedConnections.Count, Mode=OneWay}" />
<Run Text="/" />
<Run Text="{Binding GraphViewModel.Connections.Count, Mode=OneWay}" />
</TextBlock.Inlines>
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Right">
<TextBlock ToolTip="The viewport's location.">
<TextBlock.Inlines>
<Run Text="Location: " />
<Run Foreground="Orange"
Text="{Binding Location.Value, Mode=OneWay, Converter={StaticResource ToStringConverter}, Source={x:Static local:EditorSettings.Instance}}" />
</TextBlock.Inlines>
</TextBlock>
<TextBlock ToolTip="The viewport's size.">
<TextBlock.Inlines>
<Run Text="Size: " />
<Run Foreground="YellowGreen"
Text="{Binding GraphViewModel.ViewportSize, Mode=OneWay, Converter={StaticResource ToStringConverter}}" />
</TextBlock.Inlines>
</TextBlock>
<TextBlock ToolTip="The viewport's zoom. Not accurate when trying to zoom outside the MinViewportZoom and MaxViewportZoom because of dependency property coercion not updating the binding with the final result.">
<TextBlock.Inlines>
<Run Text="Zoom: " />
<Run Foreground="DodgerBlue"
Text="{Binding Zoom, Mode=OneWay, Converter={StaticResource ToStringConverter}, Source={x:Static local:EditorSettings.Instance}}" />
</TextBlock.Inlines>
</TextBlock>
<TextBlock ToolTip="The estimated frame rate. (my be buggy)">
<TextBlock.Inlines>
<Run Text="FPS: " />
<Run Foreground="LawnGreen"
Name="FPSText" />
</TextBlock.Inlines>
</TextBlock>
</StackPanel>
</Grid>
</Border>
</Grid>
</Window>