-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
218 lines (218 loc) · 17 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
<Window x:Class="PenTabletNotebook.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:PenTabletNotebook"
mc:Ignorable="d"
Title="PenTabletNotebook" Height="800" Width="1280" Loaded="Window_Loaded" KeyUp="Window_KeyUp" MouseWheel="Window_MouseWheel">
<Window.CommandBindings>
<CommandBinding Command="ApplicationCommands.New" Executed="MenuItemFileNew_Click" CanExecute="FileNewCmdCanExecute"/>
<CommandBinding Command="ApplicationCommands.Open" Executed="MenuItemFileOpen_Click" CanExecute="FileOpenCmdCanExecute"/>
<CommandBinding Command="ApplicationCommands.Save" Executed="MenuItemFileSave_Click" CanExecute="FileSaveCmdCanExecute"/>
<CommandBinding Command="ApplicationCommands.SaveAs" Executed="MenuItemFileSaveAs_Click" CanExecute="FileOpenCmdCanExecute"/>
<CommandBinding Command="ApplicationCommands.Close" Executed="MenuItemFileExit_Click" CanExecute="FileExitCmdCanExecute"/>
<CommandBinding Command="ApplicationCommands.Undo" Executed="MenuItemEditUndo_Click" CanExecute="EditUndoCmdCanExecute"/>
<CommandBinding Command="ApplicationCommands.Redo" Executed="MenuItemEditRedo_Click" CanExecute="EditRedoCmdCanExecute"/>
</Window.CommandBindings>
<Grid Background="#FFF0F0F0">
<Grid.RowDefinitions>
<RowDefinition Height="22"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="53"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="205"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Menu x:Name="mMenu" >
<MenuItem x:Name="mMenuItemFile" Header="_File" >
<MenuItem x:Name="mMenuItemFileNew" Command="New" Header="_New" />
<MenuItem x:Name="mMenuItemFileOpen" Command="Open" Header="_Open file ..." />
<MenuItem x:Name="mMenuItemFileAddImg" Header="Add images..." Click="MenuItemFileAddImg_Click" />
<MenuItem x:Name="mMenuItemFileSave" Command="Save" Header="_Save" />
<MenuItem x:Name="mMenuItemFileSaveAs" Command="SaveAs" Header="Save _As ..." />
<Separator/>
<MenuItem x:Name="mMenuItemFileExit" Command="Close" Header="E_xit" Click="MenuItemFileExit_Click" />
</MenuItem>
<MenuItem x:Name="mMenuItemEdit" Header="_Edit" >
<MenuItem x:Name="mMenuItemEditUndo" Command="Undo" Header="_Undo" />
<MenuItem x:Name="mMenuItemEditRedo" Command="Redo" Header="_Redo" />
</MenuItem>
</Menu>
<GridSplitter Grid.Column="0" Grid.RowSpan="3" Width="5" ResizeDirection="Columns" Background="#FFD4D4D4" >
<GridSplitter.Template>
<ControlTemplate TargetType="{x:Type GridSplitter}">
<Grid>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="⁞" FontSize="16" Foreground="#FF919191" />
<Rectangle Fill="#00FFFFFF" />
</Grid>
</ControlTemplate>
</GridSplitter.Template>
</GridSplitter>
<GroupBox x:Name="mGroupBoxSettings" Grid.Row="1" Header="Settings" Margin="4,0,5,4" Grid.RowSpan="2" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="80" />
<RowDefinition Height="100"/>
<RowDefinition Height="195" />
<RowDefinition Height="118" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<GroupBox x:Name="mGroupBoxPenMode" Grid.Row="0" Header="Pen Mode" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<RadioButton Grid.Row="0" x:Name="mRBPenEraser" Content="Pen / Eraser" Margin="4,0,4,0" VerticalAlignment="Center" IsChecked="True" Checked="RBPen_Checked"/>
<RadioButton Grid.Row="1" x:Name="mRBEraser" Content="Eraser" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBEraser_Checked"/>
</Grid>
</GroupBox>
<GroupBox x:Name="mGroupBoxPenThickness" Grid.Row="1" Header="Pen Thickness" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<RadioButton Grid.Row="0" Grid.Column="0" x:Name="mRBT1" Content="1" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBT1_Checked"/>
<RadioButton Grid.Row="1" Grid.Column="0" x:Name="mRBT2" Content="2" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBT2_Checked" />
<RadioButton Grid.Row="2" Grid.Column="0" x:Name="mRBT4" Content="4" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBT4_Checked" />
<RadioButton Grid.Row="0" Grid.Column="1" x:Name="mRBT6" Content="6" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBT6_Checked" />
<RadioButton Grid.Row="1" Grid.Column="1" x:Name="mRBT8" Content="8" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBT8_Checked" />
<RadioButton Grid.Row="2" Grid.Column="1" x:Name="mRBT12" Content="12" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBT12_Checked" />
</Grid>
</GroupBox>
<GroupBox x:Name="mGroupBoxColor" Grid.Row="2" Header="Color" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<RadioButton Grid.Row="0" Grid.Column="0" x:Name="mRBCWhite" Content="White" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBCWhite_Checked"/>
<RadioButton Grid.Row="1" Grid.Column="0" x:Name="mRBCCyan" Content="Cyan" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBCCyan_Checked" />
<RadioButton Grid.Row="2" Grid.Column="0" x:Name="mRBCMagenta" Content="Magenta" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBCMagenta_Checked" />
<RadioButton Grid.Row="3" Grid.Column="0" x:Name="mRBCYellow" Content="Yellow" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBCYellow_Checked" />
<RadioButton Grid.Row="0" Grid.Column="1" x:Name="mRBCRed" Content="Red" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBCRed_Checked" />
<RadioButton Grid.Row="1" Grid.Column="1" x:Name="mRBCGreen" Content="Green" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBCGreen_Checked" />
<RadioButton Grid.Row="2" Grid.Column="1" x:Name="mRBCBlue" Content="Blue" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBCBlue_Checked" />
<RadioButton Grid.Row="3" Grid.Column="1" x:Name="mRBCBlack" Content="Black" Margin="4,0,4,0" VerticalAlignment="Center" Checked="RBCBlack_Checked" />
</Grid>
</GroupBox>
<GroupBox x:Name="mGroupBoxDisplay" Grid.Row="3" Header="Display" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<CheckBox x:Name="mCBDispHLine" Grid.Row="0" Margin="4,0,0,0" VerticalAlignment="Center" Content="H.Line" IsChecked="False" Checked="CBDispHLine_Checked" Unchecked="CBDispHLine_Unchecked" />
<Slider Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" Name="mSliderHLine" Margin="0,0,4,0" Maximum="25" Value="14" Minimum="12" SmallChange="1" LargeChange="2" TickPlacement="Both" ValueChanged="SliderHLine_ValueChanged" />
<CheckBox x:Name="mCBDispVLine" Grid.Row="1" Margin="4,0,0,0" VerticalAlignment="Center" Content="V.Line" IsChecked="False" Checked="CBDispVLine_Checked" Unchecked="CBDispVLine_Unchecked" />
<Slider Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" Name="mSliderVLine" Margin="0,0,4,0" Maximum="10" Value="5" Minimum="2" SmallChange="1" LargeChange="2" TickPlacement="Both" ValueChanged="SliderVLine_ValueChanged" />
<CheckBox x:Name="mCBDispDrawings" Grid.Row="2" Grid.ColumnSpan="2" Margin="4,0,0,0" VerticalAlignment="Center" Content="Display Drawings" IsChecked="True" Checked="CBDispDrawings_Checked" Unchecked="CBDispDrawings_Unchecked" />
<Label x:Name="mLabelScale" Content="Scale:" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center" />
<Slider Grid.Column="1" Grid.Row="3" VerticalAlignment="Center" Name="mSliderScaling" Margin="0,0,4,0" Maximum="2.0" Value="0.5" Minimum="0.25" Ticks="0.25 0.375 0.5 0.625 0.75 0.875 1.0 1.25 1.5 1.75 2.0" SmallChange="0.125" LargeChange="0.125" TickFrequency="0.125" TickPlacement="Both" IsMoveToPointEnabled="True" />
<Button Grid.Row="4" Grid.ColumnSpan="2" x:Name="mButtonScaleToImageW" Margin="4,0,4,0" Content="Scale to Image Width" VerticalAlignment="Center" Click="ButtonScaleToImageW_Click" />
<Button Grid.Row="5" Grid.ColumnSpan="2" x:Name="mButtonScaleToFit" Margin="4,0,4,0" Content="Scale to Fit" VerticalAlignment="Center" Click="ButtonScaleToFit_Click" />
</Grid>
</GroupBox>
<GroupBox x:Name="mGroupBoxPageControl" Grid.Row="4" Header="Page Control" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Button x:Name="mButtonSetImage" Grid.Row="0" Grid.ColumnSpan="3" Margin="4,0,4,0" VerticalAlignment="Center" Content="Set Image" Click="ButtonSetImage_Click" />
<Button x:Name="mButtonDeletePage" Grid.Row="1" Grid.ColumnSpan="3" Margin="4,0,4,0" VerticalAlignment="Center" Content="Delete Page" Click="ButtonDeletePage_Click" />
<Button x:Name="mButtonAddNewPage" Grid.Row="2" Grid.ColumnSpan="3" Margin="4,0,4,0" VerticalAlignment="Center" Content="Add New Page" Click="ButtonAddNewPage_Click" />
<Button x:Name="mButtonClearDrawings" Grid.Row="3" Grid.ColumnSpan="3" Margin="4,0,4,0" VerticalAlignment="Center" Content="Clear Drawings" Click="ButtonClearDrawings_Click" />
</Grid>
</GroupBox>
<GroupBox x:Name="mGroupBoxPageTags" Grid.Row="5" Header="Page Tags" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="23" />
<RowDefinition Height="24" />
<RowDefinition Height="23" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Button Margin="4,0,4,0" x:Name="mButtonTagBack" Content="Back to the pg before jump" VerticalAlignment="Center" Click="ButtonTagBack_Click" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2.5*" />
</Grid.ColumnDefinitions>
<Label x:Name="mLabelName" Content="Name:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox x:Name="mTBTagName" Grid.Column="1" Margin="0,0,4,0" Text="Untitled tag" VerticalContentAlignment="Center" VerticalAlignment="Center" />
</Grid>
<Button Grid.Row="2" Margin="4,0,4,0" x:Name="mButtonAddTag" Content="New or Update Tag" VerticalAlignment="Center" Click="ButtonAddTag_Click" />
<ListBox Grid.Row="3" Margin="0,4,0,0" x:Name="mLBPageTags" SelectionChanged="LBPageTags_SelectionChanged" MouseRightButtonUp="LBPageTags_MouseRightButtonUp" ScrollViewer.VerticalScrollBarVisibility="Visible" />
</Grid>
</GroupBox>
</Grid>
</GroupBox>
<GroupBox x:Name="mGroupBoxCanvas" Grid.RowSpan="2" Grid.Column="1" Header="Canvas" Margin="0,0,4,0" >
<ScrollViewer x:Name="mSVCanvas" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" >
<Grid x:Name="mGridCanvas" Background="#FFC0C0C0">
<Grid.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleY="{Binding Path=Value, ElementName=mSliderScaling}"
ScaleX="{Binding Path=Value, ElementName=mSliderScaling}"/>
</TransformGroup>
</Grid.LayoutTransform>
<Image x:Name="mImage" HorizontalAlignment="Left" VerticalAlignment="Top" Width="2048" Height="2048" RenderOptions.BitmapScalingMode="HighQuality" />
<Canvas x:Name="mCanvas" Background="#00FFFFFF" />
<InkCanvas x:Name="mInkCanvas" Background="#01FFFFFF" />
</Grid>
</ScrollViewer>
</GroupBox>
<GroupBox x:Name="mGroupBoxPageNumber" Margin="0,0,4,4" Grid.Column="1" Grid.Row="2" Header="Page Number" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label x:Name="mLabelPage" Content="Page:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Grid.Column="1" Text="1" Name="mTBPageNr" VerticalAlignment="Center" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" TextChanged="TBPageNr_TextChanged" />
<Label Grid.Column="2" Content="/ 0" Name="mLabelTotalPages" VerticalAlignment="Center" />
<Button Grid.Column="3" x:Name="mButtonPrev" IsEnabled="False" Content="Prev" Margin="0,0,4,0" VerticalAlignment="Center" Click="ButtonPrevPage_Click"/>
<Button Grid.Column="4" x:Name="mButtonNext" IsEnabled="False" Content="Next" Margin="0,0,4,0" VerticalAlignment="Center" Click="ButtonNextPage_Click"/>
<Slider Grid.Column="5" x:Name="mSliderPageNr" VerticalAlignment="Center" ValueChanged="SliderPageNr_ValueChanged" SmallChange="1" LargeChange="10" IsSnapToTickEnabled="True" TickFrequency="1" IsMoveToPointEnabled="True" />
</Grid>
</GroupBox>
</Grid>
</Window>