-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
295 lines (267 loc) · 15.5 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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<Window x:Class="Ghost.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:ghost="clr-namespace:Ghost.Controls"
xmlns:main="clr-namespace:Ghost"
Title="Ghost"
x:Name="main_window"
WindowStyle="None"
AllowsTransparency="True"
MinWidth="950"
Width="950"
Height="600"
SnapsToDevicePixels="True"
MinHeight="600"
SizeToContent="Manual"
HorizontalAlignment="Left"
VerticalAlignment="Top"
ResizeMode="CanResizeWithGrip"
Background="{x:Null}"
MouseLeftButtonDown="OnMouseLeftButtonDown"
Loaded="main_window_Loaded">
<Window.Resources>
<ghost:ArithmeticConverter x:Key="arithConverter" />
</Window.Resources>
<Window.CommandBindings>
<CommandBinding Command="{x:Static main:MainWindow.AK_OpenClipBoardImage}" Executed="AK_OpenClipBoardImage_execute" CanExecute="AK_OpenClipBoardImage_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_OpenNewFile}" Executed="AK_OpenNewFile_execute" CanExecute="AK_OpenNewFile_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_TopMost}" Executed="AK_TopMost_execute" CanExecute="AK_TopMost_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_UpKey}" Executed="AK_UpKey_execute" CanExecute="AK_UpKey_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_DownKey}" Executed="AK_DownKey_execute" CanExecute="AK_DownKey_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_LeftKey}" Executed="AK_LeftKey_execute" CanExecute="AK_LeftKey_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_RightKey}" Executed="AK_RightKey_execute" CanExecute="AK_RightKey_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_Opacity_1}" Executed="AK_Opacity_1_execute" CanExecute="AK_Opacity_1_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_Opacity_2}" Executed="AK_Opacity_2_execute" CanExecute="AK_Opacity_2_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_Opacity_3}" Executed="AK_Opacity_3_execute" CanExecute="AK_Opacity_3_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_Opacity_4}" Executed="AK_Opacity_4_execute" CanExecute="AK_Opacity_4_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_Opacity_5}" Executed="AK_Opacity_5_execute" CanExecute="AK_Opacity_5_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_Opacity_6}" Executed="AK_Opacity_6_execute" CanExecute="AK_Opacity_6_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_Opacity_7}" Executed="AK_Opacity_7_execute" CanExecute="AK_Opacity_7_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_Opacity_8}" Executed="AK_Opacity_8_execute" CanExecute="AK_Opacity_8_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_Opacity_9}" Executed="AK_Opacity_9_execute" CanExecute="AK_Opacity_9_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_Opacity_0}" Executed="AK_Opacity_0_execute" CanExecute="AK_Opacity_0_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_Quit}" Executed="AK_Quit_execute" CanExecute="AK_Quit_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_Minimize}" Executed="AK_Minimize_execute" CanExecute="AK_Minimize_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_Color}" Executed="AK_Color_execute" CanExecute="AK_Color_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_HRuler}" Executed="AK_HRuler_execute" CanExecute="AK_HRuler_canExecute" />
<CommandBinding Command="{x:Static main:MainWindow.AK_VRuler}" Executed="AK_VRuler_execute" CanExecute="AK_VRuler_canExecute" />
</Window.CommandBindings>
<Canvas>
<Border BorderThickness="1"
x:Name="border_window_outer"
Background="{x:Null}"
BorderBrush="#000000"
MinWidth="950"
MinHeight="600"
Width="{Binding Path=ActualWidth, ElementName=main_window}"
Height="{Binding Path=ActualHeight, ElementName=main_window}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
SnapsToDevicePixels="True">
<Border BorderThickness="1"
x:Name="border_window_inner"
Width="{Binding Path=ActualWidth, ElementName=main_window,Converter={StaticResource arithConverter}, ConverterParameter=Int32.Parse(values[0])-2}"
Height="{Binding Path=ActualHeight, ElementName=main_window,Converter={StaticResource arithConverter}, ConverterParameter=Int32.Parse(values[0])-2}"
Background="{x:Null}"
MinWidth="948"
MinHeight="598"
BorderBrush="#ffffff"
HorizontalAlignment="Left"
VerticalAlignment="Top"
SnapsToDevicePixels="True">
<Grid x:Name="grid_main" SnapsToDevicePixels="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="55"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition x:Name="row_image" Height="55"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<!-- TOOLBAR BACKGROUND IMAGE -->
<Image
Grid.Column="0"
Grid.Row="0"
Grid.RowSpan="2"
Grid.ColumnSpan="3"
Stretch="Fill"
Source="images/img_toolbarbackground.png" />
<!-- LOGO -->
<Canvas Margin="10,5,0,0">
<ghost:Bitmap
Grid.Column="0"
MouseLeftButtonDown="Image_MouseLeftButtonDown"
Grid.Row="0"
Grid.RowSpan="2"
Source="images/img_logo.png" />
</Canvas>
<!-- TITLE BAR -->
<ghost:ToolBarTop
SnapsToDevicePixels="True"
x:Name="toolbar_top"
Grid.Column="1"
Grid.Row="0"
MaximizeWorkSpaceClicked="toolbar_top_MaximizeWorkSpaceClicked"
MinimizedWindowClicked="toolbar_top_MinimizedWindowClicked"
Height="20"
HorizontalAlignment="Stretch"
Background="{x:Null}" />
<!-- TOOLS AND IMAGE LIST -->
<!-- MAIN TOOLBAR -->
<StackPanel
SnapsToDevicePixels="True"
Grid.Column="1"
Grid.Row="1"
x:Name="toolbar_main"
Orientation="Horizontal"
Height="55"
Background="{x:Null}">
<Canvas SnapsToDevicePixels="True" Width="450" />
<!-- SPACER -->
<Canvas Margin="15,0,15,0">
<ghost:Bitmap Source="images/toolbar_spacer.png" />
</Canvas>
<!-- OPACITY EDITOR -->
<ghost:OpacityEditor
SnapsToDevicePixels="True"
x:Name="opacity_editor"
OpacityUpClicked="Clicked_Up_OpacityEditor"
OpacityDownClicked="Clicked_Down_OpacityEditor"
Margin="0,3,0,0" />
<!-- SPACER -->
<Canvas Margin="15,0,15,0">
<ghost:Bitmap Source="images/toolbar_spacer.png" />
</Canvas>
<!-- OTHER TOOLS -->
<Grid
Margin="0,2,0,0"
SnapsToDevicePixels="True"
Width="250">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="21"></RowDefinition>
<RowDefinition Height="21"></RowDefinition>
</Grid.RowDefinitions>
<!-- TOP MOST -->
<CheckBox
SnapsToDevicePixels="True"
x:Name="buttonSelect_topMost"
Style="{StaticResource SelectButton}"
Content="Topmost Window"
Click="buttonSelect_topMost_Click"
Margin="0,0,0,0"
Grid.Column="0"
Grid.Row="0" />
<!--ClickButton="buttonSelect_topMost_ClickButton"-->
<!-- EYE DROPPER -->
<CheckBox
SnapsToDevicePixels="True"
x:Name="buttonSelect_eyeDrop"
Click="buttonSelect_eyeDrop_Click"
Style="{StaticResource SelectButton}"
Content="Color Picker"
Grid.Column="0"
Margin="0,0,0,0"
Grid.Row="1" />
<!-- HORIZONTAL RULER -->
<ghost:ButtonText
SnapsToDevicePixels="True"
x:Name="buttonSelect_horizontalMeasure"
Text="Horizontal Ruler"
Grid.Column="1"
ClickButton="buttonSelect_horizontalMeasure_ClickButton"
ActiveImageFileName="icon_plus_click_blue.png"
HoverImageFileName="icon_plus_hover_blue.png"
InactiveImageFileName="icon_plus_blue.png"
Grid.Row="0" />
<!-- VERTICAL RULER -->
<ghost:ButtonText
SnapsToDevicePixels="True"
x:Name="buttonSelect_verticalMeasure"
Text="Vertical Ruler"
Grid.Column="1"
ClickButton="buttonSelect_verticalMeasure_ClickButton"
ActiveImageFileName="icon_plus_click_blue.png"
HoverImageFileName="icon_plus_hover_blue.png"
InactiveImageFileName="icon_plus_blue.png"
Grid.Row="1" />
</Grid>
</StackPanel>
<!-- MAIN CANVAS
canvas is wrapping frame because the ToolBarFiles control needs to
be positioned.
-->
<Canvas
x:Name="canvas_image"
SnapsToDevicePixels="True"
Grid.Column="0"
Grid.Row="2"
Grid.ColumnSpan="3">
<Canvas.Background>
<ImageBrush ImageSource="images/img_transparentBG.png" Stretch="Fill" />
</Canvas.Background>
<Canvas.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1" />
<SkewTransform AngleX="0" AngleY="0" />
<RotateTransform Angle="0" />
<TranslateTransform X="0" Y="0" />
</TransformGroup>
</Canvas.RenderTransform>
<ghost:Home
Visibility="Hidden"
Width="{Binding Path=ActualWidth,ElementName=canvas_image}"
Height="{Binding Path=ActualHeight,ElementName=canvas_image}" />
<ScrollViewer
Visibility="Visible"
x:Name="scroll_image"
CanContentScroll="True"
SnapsToDevicePixels="True"
DockPanel.Dock="Top"
VerticalScrollBarVisibility="Auto"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
HorizontalAlignment="Left"
VerticalAlignment="Top"
HorizontalScrollBarVisibility="Auto"
MinWidth="946"
Focusable="False"
MinHeight="521">
<!-- IMAGE -->
<ghost:Bitmap
MouseMove="image_main_MouseMove"
MouseRightButtonDown="image_main_MouseRightButtonDown"
Source="images/img_main.png"
MouseLeftButtonDown="OnMouseLeftButtonDown"
x:Name="image_main"
SnapsToDevicePixels="True"
Width="{Binding Source.PixelWidth,RelativeSource={RelativeSource Self}}"
Height="{Binding Source.PixelHeight,RelativeSource={RelativeSource Self}}">
<ghost:Bitmap.ContextMenu>
<ContextMenu Name="cm">
<MenuItem x:Name="menuItem_copyColor" Click="menuItem_copyColor_Click" Header="Copy HEX Color to clipboard" />
<MenuItem x:Name="menuItem_copyColorRGB" Click="menuItem_copyColorRGB_Click" Header="Copy RGB Color to clipboard" />
<MenuItem x:Name="menuItem_copyImage" Header="Copy image" Click="menuItem_copyImage_Click" />
</ContextMenu>
</ghost:Bitmap.ContextMenu>
</ghost:Bitmap>
</ScrollViewer>
<ghost:ColorPicker SnapsToDevicePixels="True" x:Name="ColorPicker" Canvas.Top="10" Canvas.Right="200" Visibility="Hidden" />
</Canvas>
</Grid>
</Border>
</Border>
<ghost:PhotoListBox
x:Name="PhotoListBoxControl"
Canvas.Top="23"
Canvas.Left="55"
PhotoSelect="toolbar_files_Click_PhotoSelected"
SnapsToDevicePixels="True" />
</Canvas>
</Window>