-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathNotepadWindow.xaml
More file actions
341 lines (316 loc) · 17.3 KB
/
NotepadWindow.xaml
File metadata and controls
341 lines (316 loc) · 17.3 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
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
<?xml version="1.0" encoding="utf-8"?>
<Window
x:Class="NoteUI.NotepadWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ctk="using:CommunityToolkit.WinUI.Controls"
Title="Bloc-notes">
<Grid x:Name="RootGrid" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Row 0: Title bar with integrated tabs -->
<Grid x:Name="TitleBar" Grid.Row="0" Height="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Tab strip in title bar -->
<ScrollViewer Grid.Column="0" Margin="4,0,0,0"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Disabled"
HorizontalScrollMode="Enabled"
VerticalScrollMode="Disabled">
<StackPanel x:Name="TabStrip" Orientation="Horizontal" Spacing="1"
VerticalAlignment="Bottom"/>
</ScrollViewer>
<TextBlock x:Name="TitleText" Visibility="Collapsed"/>
<StackPanel Grid.Column="1" Orientation="Horizontal"
VerticalAlignment="Center" Spacing="0" Margin="0,0,4,0">
<Button x:Name="PinButton" Background="Transparent" BorderThickness="0"
Padding="8,6" Click="Pin_Click">
<FontIcon x:Name="PinIcon" Glyph="" FontSize="12"/>
</Button>
<Button x:Name="NpCloseButton" Background="Transparent" BorderThickness="0"
Padding="8,6" Click="Close_Click">
<FontIcon Glyph="" FontSize="12"/>
</Button>
</StackPanel>
<!-- Drag bar: rendered last = top z-order, thin strip at top of title bar -->
<Grid x:Name="DragBar" Background="Transparent"
Grid.ColumnSpan="2"
Height="12" VerticalAlignment="Top"
PointerPressed="DragBar_PointerPressed"
PointerMoved="DragBar_PointerMoved"
PointerReleased="DragBar_PointerReleased"/>
</Grid>
<!-- Row 1: Menu bar -->
<MenuBar Grid.Row="1" Padding="2,0">
<MenuBarItem x:Name="FileMenu" Title="_">
<MenuFlyoutItem x:Name="MenuNew" Click="New_Click"
KeyboardAcceleratorTextOverride="Ctrl+N">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Modifiers="Control" Key="N"/>
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
<MenuFlyoutItem x:Name="MenuNewTab" Click="NewTab_Click"
KeyboardAcceleratorTextOverride="Ctrl+T">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Modifiers="Control" Key="T"/>
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
<MenuFlyoutItem x:Name="MenuCloseTab" Click="CloseTab_Click"
KeyboardAcceleratorTextOverride="Ctrl+W">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Modifiers="Control" Key="W"/>
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
<MenuFlyoutSeparator/>
<MenuFlyoutItem x:Name="MenuOpen" Click="Open_Click"
KeyboardAcceleratorTextOverride="Ctrl+O">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Modifiers="Control" Key="O"/>
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
<MenuFlyoutItem x:Name="MenuSave" Click="Save_Click"
KeyboardAcceleratorTextOverride="Ctrl+S">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Modifiers="Control" Key="S"/>
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
<MenuFlyoutItem x:Name="MenuSaveAs" Click="SaveAs_Click"
KeyboardAcceleratorTextOverride="Ctrl+Shift+S">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Modifiers="Control,Shift" Key="S"/>
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
<MenuFlyoutSeparator/>
<MenuFlyoutItem x:Name="MenuSaveToNotes" Click="SaveToNotes_Click"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem x:Name="MenuOpenNote" Click="OpenNote_Click"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem x:Name="MenuClose" Click="CloseMenu_Click"/>
</MenuBarItem>
<MenuBarItem x:Name="EditMenu" Title="_">
<MenuFlyoutItem x:Name="MenuUndo" Click="Undo_Click"
KeyboardAcceleratorTextOverride="Ctrl+Z"/>
<MenuFlyoutItem x:Name="MenuRedo" Click="Redo_Click"
KeyboardAcceleratorTextOverride="Ctrl+Y"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem x:Name="MenuCut" Click="Cut_Click"
KeyboardAcceleratorTextOverride="Ctrl+X"/>
<MenuFlyoutItem x:Name="MenuCopy" Click="Copy_Click"
KeyboardAcceleratorTextOverride="Ctrl+C"/>
<MenuFlyoutItem x:Name="MenuPaste" Click="Paste_Click"
KeyboardAcceleratorTextOverride="Ctrl+V"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem x:Name="MenuSelectAll" Click="SelectAll_Click"
KeyboardAcceleratorTextOverride="Ctrl+A"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem x:Name="MenuDateTime" Click="InsertDateTime_Click"
KeyboardAcceleratorTextOverride="F5">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Key="F5"/>
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
<MenuFlyoutSeparator/>
<MenuFlyoutItem x:Name="MenuSnippet" Click="Snippet_Click">
<MenuFlyoutItem.Icon>
<FontIcon Glyph=""/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuBarItem>
<MenuBarItem x:Name="ViewMenu" Title="_">
<ToggleMenuFlyoutItem x:Name="WordWrapItem"
IsChecked="True"
Click="WordWrap_Click"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem x:Name="MenuZoomIn" Click="ZoomIn_Click"
KeyboardAcceleratorTextOverride="Ctrl++"/>
<MenuFlyoutItem x:Name="MenuZoomOut" Click="ZoomOut_Click"
KeyboardAcceleratorTextOverride="Ctrl+-"/>
<MenuFlyoutItem x:Name="MenuZoomDefault" Click="ZoomReset_Click"
KeyboardAcceleratorTextOverride="Ctrl+0"/>
<MenuFlyoutSeparator/>
<ToggleMenuFlyoutItem x:Name="AutoResizeItem"
IsChecked="False"
Click="AutoResize_Click"/>
<MenuFlyoutSeparator/>
<ToggleMenuFlyoutItem x:Name="SplitViewItem"
IsChecked="False"
Click="SplitView_Click"/>
<MenuFlyoutSeparator/>
<ToggleMenuFlyoutItem x:Name="FocusModeItem"
IsChecked="False"
Click="FocusMode_Click"
KeyboardAcceleratorTextOverride="F11">
<ToggleMenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Key="F11"/>
</ToggleMenuFlyoutItem.KeyboardAccelerators>
</ToggleMenuFlyoutItem>
</MenuBarItem>
</MenuBar>
<!-- Row 2: Formatting toolbar -->
<Border Grid.Row="2"
BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}"
BorderThickness="0,0,0,1"
Padding="8,4">
<StackPanel Orientation="Horizontal" Spacing="2" VerticalAlignment="Center">
<!-- Heading dropdown -->
<DropDownButton x:Name="HeadingButton" Content="Normal"
Padding="10,4" FontSize="12" CornerRadius="4">
<DropDownButton.Flyout>
<MenuFlyout Placement="Bottom">
<MenuFlyoutItem x:Name="MenuHeadingNormal" Click="Heading_Normal_Click"/>
<MenuFlyoutItem x:Name="MenuHeadingH1" Click="Heading_H1_Click"/>
<MenuFlyoutItem x:Name="MenuHeadingH2" Click="Heading_H2_Click"/>
<MenuFlyoutItem x:Name="MenuHeadingH3" Click="Heading_H3_Click"/>
</MenuFlyout>
</DropDownButton.Flyout>
</DropDownButton>
<!-- Separator -->
<Border Width="1"
Background="{ThemeResource DividerStrokeColorDefaultBrush}"
Margin="4,2" VerticalAlignment="Stretch"/>
<!-- Bold -->
<ToggleButton x:Name="BoldButton"
Padding="10,4" CornerRadius="4"
Click="Bold_Click">
<TextBlock Text="B" FontWeight="Bold" FontSize="13"/>
</ToggleButton>
<!-- Italic -->
<ToggleButton x:Name="ItalicButton"
Padding="10,4" CornerRadius="4"
Click="Italic_Click">
<TextBlock Text="I" FontStyle="Italic" FontSize="13"/>
</ToggleButton>
<!-- Strikethrough -->
<ToggleButton x:Name="StrikethroughButton"
Padding="10,4" CornerRadius="4"
Click="Strikethrough_Click">
<TextBlock Text="S" TextDecorations="Strikethrough" FontSize="13"/>
</ToggleButton>
<!-- Underline -->
<ToggleButton x:Name="UnderlineButton"
Padding="10,4" CornerRadius="4"
Click="Underline_Click">
<TextBlock Text="U" TextDecorations="Underline" FontSize="13"/>
</ToggleButton>
<!-- Separator -->
<Border Width="1"
Background="{ThemeResource DividerStrokeColorDefaultBrush}"
Margin="4,2" VerticalAlignment="Stretch"/>
<!-- Link -->
<Button x:Name="LinkButton"
Padding="10,4" CornerRadius="4"
Click="Link_Click">
<FontIcon Glyph="" FontSize="13"/>
</Button>
</StackPanel>
</Border>
<!-- Row 3: Editor / Markdown preview -->
<Grid x:Name="EditorGrid" Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition x:Name="SplitColumn" Width="0"/>
</Grid.ColumnDefinitions>
<RichEditBox x:Name="Editor"
Grid.Column="0"
AcceptsReturn="True"
TextWrapping="Wrap"
FontSize="14"
Padding="16,12"
BorderThickness="0"
ScrollViewer.VerticalScrollBarVisibility="Auto"
TextChanged="Editor_TextChanged"
SelectionChanged="Editor_SelectionChanged">
<RichEditBox.Resources>
<SolidColorBrush x:Key="TextControlBackground" Color="Transparent"/>
<SolidColorBrush x:Key="TextControlBackgroundPointerOver" Color="Transparent"/>
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="Transparent"/>
<SolidColorBrush x:Key="TextControlBorderBrush" Color="Transparent"/>
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="Transparent"/>
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="Transparent"/>
</RichEditBox.Resources>
</RichEditBox>
<!-- Split view: markdown preview panel (right half) -->
<Border x:Name="SplitPreviewPanel" Grid.Column="1"
Visibility="Collapsed"
BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}"
BorderThickness="1,0,0,0">
<ScrollViewer Padding="16,12"
VerticalScrollBarVisibility="Auto">
<ctk:MarkdownTextBlock x:Name="SplitPreviewMarkdown"
IsTextSelectionEnabled="True"
UsePipeTables="True"
UseTaskLists="True"
UseAutoLinks="True"/>
</ScrollViewer>
</Border>
<!-- Markdown rendered view (overlays editor when active) -->
<ScrollViewer x:Name="PreviewScroll"
Grid.ColumnSpan="2"
Padding="16,12"
VerticalScrollBarVisibility="Auto"
Visibility="Collapsed">
<ctk:MarkdownTextBlock x:Name="PreviewMarkdown"
IsTextSelectionEnabled="True"
UsePipeTables="True"
UseTaskLists="True"
UseAutoLinks="True"/>
</ScrollViewer>
</Grid>
<!-- Row 4: Status bar -->
<Border Grid.Row="4"
BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}"
BorderThickness="0,1,0,0"
Padding="12,5">
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Spacing="20">
<Button x:Name="AiButton"
Background="Transparent" BorderThickness="0"
Padding="6,2" CornerRadius="4"
Click="AiMenu_Click">
<FontIcon Glyph="" FontSize="11"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
</Button>
<TextBlock x:Name="LineColText" Text="Ln 1, Col 1"
FontSize="11"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
<TextBlock x:Name="CharCountText"
FontSize="11"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
<TextBlock x:Name="WordCountText"
FontSize="11"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
<TextBlock x:Name="RichTextLabel"
FontSize="11"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="12">
<Button x:Name="MarkdownToggle"
Background="Transparent" BorderThickness="0"
Padding="6,2" CornerRadius="4"
Click="MarkdownToggle_Click">
<TextBlock x:Name="MarkdownToggleText" Text="Markdown"
FontSize="11"
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"/>
</Button>
<TextBlock x:Name="ZoomText" Text="100%"
FontSize="11"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
<TextBlock Text="Windows (CRLF)"
FontSize="11"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
<TextBlock Text="UTF-8"
FontSize="11"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
</StackPanel>
</Grid>
</Border>
</Grid>
</Window>