forked from miroiu/nodify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
214 lines (199 loc) · 10.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
<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"
mc:Ignorable="d"
Title="MainWindow"
Height="600"
Width="1200">
<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 RANDOM NODES"
ToolTip="Generate nodes using the specified settings."
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 ToggleConnectionsCommand}"
Content="CONNECT / DISCONNECT"
ToolTip="Will add new connections if Connect Nodes is checked, otherwise it will disconnect nodes."
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}" />
</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>
<ScrollViewer>
<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>
<local:PlaygroundSettingsView />
</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>
</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 10 0" />
</Style>
</Grid.Resources>
<StackPanel Orientation="Horizontal">
<TextBlock ToolTip="The number of selected items.">
<TextBlock.Inlines>
<Run Text="Selected: " />
<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 connections.">
<TextBlock.Inlines>
<Run Text="Connections: " />
<Run Foreground="YellowGreen"
Text="{Binding GraphViewModel.Connections.Count, Mode=OneWay}" />
</TextBlock.Inlines>
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Right">
<TextBlock ToolTip="The viewport's Offset.">
<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 scale. Not accurate when trying to zoom outside the MinScale and MaxScale 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>
</StackPanel>
</Grid>
</Border>
</Grid>
</Window>