Add more features

* Support full shortcut.
* Fix the crash when open invalid TAS documents.
* Support frag file to open.
This commit is contained in:
2021-09-20 15:01:34 +08:00
parent 1c57481f84
commit 9d8f4b1727
5 changed files with 100 additions and 39 deletions

View File

@ -16,6 +16,10 @@
<RoutedUICommand x:Key="commandMenu_File_Save"/>
<RoutedUICommand x:Key="commandMenu_Display_Undo"/>
<RoutedUICommand x:Key="commandMenu_Display_Redo"/>
<RoutedUICommand x:Key="commandDataMenu_Cut"/>
<RoutedUICommand x:Key="commandDataMenu_Copy"/>
<RoutedUICommand x:Key="commandDataMenu_DeleteAfter"/>
<RoutedUICommand x:Key="commandDataMenu_DeleteBefore"/>
</Window.Resources>
<Window.InputBindings>
@ -23,6 +27,10 @@
<KeyBinding Gesture="Ctrl+S" Command="{StaticResource commandMenu_File_Save}"/>
<KeyBinding Gesture="Ctrl+Z" Command="{StaticResource commandMenu_Display_Undo}"/>
<KeyBinding Gesture="Ctrl+Y" Command="{StaticResource commandMenu_Display_Redo}"/>
<KeyBinding Gesture="Ctrl+X" Command="{StaticResource commandDataMenu_Cut}"/>
<KeyBinding Gesture="Ctrl+C" Command="{StaticResource commandDataMenu_Copy}"/>
<KeyBinding Gesture="Delete" Command="{StaticResource commandDataMenu_DeleteAfter}"/>
<KeyBinding Gesture="Back" Command="{StaticResource commandDataMenu_DeleteBefore}"/>
</Window.InputBindings>
<Window.CommandBindings>
@ -30,6 +38,10 @@
<CommandBinding Command="{StaticResource commandMenu_File_Save}" Executed="funcCommand_Menu_File_Save" CanExecute="funcCanExeCmd_Menu_File_Save"/>
<CommandBinding Command="{StaticResource commandMenu_Display_Undo}" Executed="funcCommand_Menu_Display_Undo" CanExecute="funcCanExeCmd_Menu_Display_Undo"/>
<CommandBinding Command="{StaticResource commandMenu_Display_Redo}" Executed="funcCommand_Menu_Display_Redo" CanExecute="funcCanExeCmd_Menu_Display_Redo"/>
<CommandBinding Command="{StaticResource commandDataMenu_Cut}" Executed="funcCommand_DataMenu_Cut" CanExecute="funcCanExeCmd_DataMenu_Cut"/>
<CommandBinding Command="{StaticResource commandDataMenu_Copy}" Executed="funcCommand_DataMenu_Copy" CanExecute="funcCanExeCmd_DataMenu_Copy"/>
<CommandBinding Command="{StaticResource commandDataMenu_DeleteAfter}" Executed="funcCommand_DataMenu_DeleteAfter" CanExecute="funcCanExeCmd_DataMenu_DeleteAfter"/>
<CommandBinding Command="{StaticResource commandDataMenu_DeleteBefore}" Executed="funcCommand_DataMenu_DeleteBefore" CanExecute="funcCanExeCmd_DataMenu_DeleteBefore"/>
</Window.CommandBindings>
<!-- real ui elements-->
@ -52,6 +64,7 @@
<MenuItem x:Name="uiMenu_Display_Redo" Header="{DynamicResource ui_MainWindow_Menu_Display_Redo}" Click="funcMenu_Display_Redo" InputGestureText="Ctrl + Y"/>
<MenuItem x:Name="uiMenu_Display_ItemCount" Header="{DynamicResource ui_MainWindow_Menu_Display_ItemCount}" Click="funcMenu_Display_ItemCount"/>
<MenuItem x:Name="uiMenu_Display_OverwrittenPaste" Header="{DynamicResource ui_MainWindow_Menu_Display_OverwrittenPaste}" IsCheckable="True" Checked="funcMenu_Display_OverwrittenPaste" Unchecked="funcMenu_Display_OverwrittenPaste"/>
<MenuItem x:Name="uiMenu_Display_HorizontalLayout" Header="???" IsCheckable="True"/>
</MenuItem>
<MenuItem Header="{DynamicResource ui_MainWindow_Menu_Help}">
<MenuItem x:Name="uiMenu_Help_ReportBugs" Header="{DynamicResource ui_MainWindow_Menu_Help_ReportBugs}" Click="funcMenu_Help_ReportBugs"/>
@ -59,9 +72,20 @@
</MenuItem>
</Menu>
<TextBlock x:Name="uiEditorNote" Grid.Row="1" Text="{DynamicResource ui_MainWindow_EditorNote}" Opacity="0.5" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="16"/>
<Grid x:Name="uiEditorNote" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" AllowDrop="True" Drop="funcDrop_Drop" DragEnter="funcDrop_DragEnter">
<Rectangle StrokeThickness="4" Stroke="Gray" StrokeDashArray="4 4" Fill="#ffffff"/>
<StackPanel Orientation="Horizontal">
<Viewbox Width="24" Height="24" Margin="20, 20, 0, 20" VerticalAlignment="Center">
<Canvas Width="24" Height="24">
<Path Fill="Gray" Data="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" />
</Canvas>
</Viewbox>
<TextBlock Margin="20" Text="{DynamicResource ui_MainWindow_EditorNote}" Foreground="Gray" FontSize="16" VerticalAlignment="Center"/>
</StackPanel>
</Grid>
<Grid x:Name="uiEditorPanel" Grid.Row="1">
<Grid x:Name="uiEditorPanel" Grid.Row="1" Visibility="Collapsed">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
@ -105,20 +129,20 @@
<Grid x:Name="uiTASData">
<Grid.ContextMenu>
<ContextMenu>
<MenuItem x:Name="uiDataMenu_Set" Header="{DynamicResource ui_TASFlow_Menu_Set}" Click="uiDataMenu_Set_Click"/>
<MenuItem x:Name="uiDataMenu_Unset" Header="{DynamicResource ui_TASFlow_Menu_Unset}" Click="uiDataMenu_Unset_Click"/>
<MenuItem x:Name="uiDataMenu_Set" Header="{DynamicResource ui_TASFlow_Menu_Set}" Click="funcDataMenu_Set"/>
<MenuItem x:Name="uiDataMenu_Unset" Header="{DynamicResource ui_TASFlow_Menu_Unset}" Click="funcDataMenu_Unset"/>
<Separator/>
<MenuItem x:Name="uiDataMenu_Cut" Header="{DynamicResource ui_TASFlow_Menu_Cut}" Click="uiDataMenu_Cut_Click" InputGestureText="Ctrl + X"/>
<MenuItem x:Name="uiDataMenu_Copy" Header="{DynamicResource ui_TASFlow_Menu_Copy}" Click="uiDataMenu_Copy_Click" InputGestureText="Ctrl + C"/>
<MenuItem x:Name="uiDataMenu_PasteAfter" Header="{DynamicResource ui_TASFlow_Menu_PasteAfter}" Click="uiDataMenu_PasteAfter_Click"/>
<MenuItem x:Name="uiDataMenu_PasteBefore" Header="{DynamicResource ui_TASFlow_Menu_PasterBefore}" Click="uiDataMenu_PasteBefore_Click"/>
<MenuItem x:Name="uiDataMenu_Cut" Header="{DynamicResource ui_TASFlow_Menu_Cut}" Click="funcDataMenu_Cut" InputGestureText="Ctrl + X"/>
<MenuItem x:Name="uiDataMenu_Copy" Header="{DynamicResource ui_TASFlow_Menu_Copy}" Click="funcDataMenu_Copy" InputGestureText="Ctrl + C"/>
<MenuItem x:Name="uiDataMenu_PasteAfter" Header="{DynamicResource ui_TASFlow_Menu_PasteAfter}" Click="funcDataMenu_PasteAfter"/>
<MenuItem x:Name="uiDataMenu_PasteBefore" Header="{DynamicResource ui_TASFlow_Menu_PasterBefore}" Click="funcDataMenu_PasteBefore"/>
<Separator/>
<MenuItem x:Name="uiDataMenu_Delete" Header="{DynamicResource ui_TASFlow_Menu_Delete}" Click="uiDataMenu_Delete_Click"/>
<MenuItem x:Name="uiDataMenu_DeleteAfter" Header="{DynamicResource ui_TASFlow_Menu_DeleteAfter}" Click="uiDataMenu_DeleteAfter_Click" InputGestureText="Del"/>
<MenuItem x:Name="uiDataMenu_DeleteBefore" Header="{DynamicResource ui_TASFlow_Menu_PasterBefore}" Click="uiDataMenu_DeleteBefore_Click" InputGestureText="Backspace"/>
<MenuItem x:Name="uiDataMenu_Delete" Header="{DynamicResource ui_TASFlow_Menu_Delete}" Click="funcDataMenu_Delete"/>
<MenuItem x:Name="uiDataMenu_DeleteAfter" Header="{DynamicResource ui_TASFlow_Menu_DeleteAfter}" Click="funcDataMenu_DeleteAfter" InputGestureText="Del"/>
<MenuItem x:Name="uiDataMenu_DeleteBefore" Header="{DynamicResource ui_TASFlow_Menu_PasterBefore}" Click="funcDataMenu_DeleteBefore" InputGestureText="Backspace"/>
<Separator/>
<MenuItem x:Name="uiDataMenu_AddAfter" Header="{DynamicResource ui_TASFlow_Menu_AddAfter}" Click="uiDataMenu_AddAfter_Click"/>
<MenuItem x:Name="uiDataMenu_AddBefore" Header="{DynamicResource ui_TASFlow_Menu_AddBefore}" Click="uiDataMenu_AddBefore_Click"/>
<MenuItem x:Name="uiDataMenu_AddAfter" Header="{DynamicResource ui_TASFlow_Menu_AddAfter}" Click="funcDataMenu_AddAfter"/>
<MenuItem x:Name="uiDataMenu_AddBefore" Header="{DynamicResource ui_TASFlow_Menu_AddBefore}" Click="funcDataMenu_AddBefore"/>
</ContextMenu>
</Grid.ContextMenu>