Add more features
* Support full shortcut. * Fix the crash when open invalid TAS documents. * Support frag file to open.
This commit is contained in:
@ -31,7 +31,8 @@ namespace BallanceTASEditor {
|
|||||||
GlobalVariable.configManager = new Core.ConfigManager("ballance-tas-editor.cfg", new Dictionary<string, string>() {
|
GlobalVariable.configManager = new Core.ConfigManager("ballance-tas-editor.cfg", new Dictionary<string, string>() {
|
||||||
{Core.ConfigManager.CfgNode_Language, CultureInfo.CurrentCulture.ThreeLetterWindowsLanguageName},
|
{Core.ConfigManager.CfgNode_Language, CultureInfo.CurrentCulture.ThreeLetterWindowsLanguageName},
|
||||||
{Core.ConfigManager.CfgNode_ItemCount, "15"},
|
{Core.ConfigManager.CfgNode_ItemCount, "15"},
|
||||||
{Core.ConfigManager.CfgNode_IsHorizonLayout, "True"}
|
{Core.ConfigManager.CfgNode_IsHorizonLayout, "True"},
|
||||||
|
{Core.ConfigManager.CfgNode_IsOverwrittenPaste, "False"}
|
||||||
});
|
});
|
||||||
|
|
||||||
// init i18n
|
// init i18n
|
||||||
|
|||||||
@ -23,6 +23,7 @@ namespace BallanceTASEditor.Core {
|
|||||||
public static readonly string CfgNode_Language = "Language";
|
public static readonly string CfgNode_Language = "Language";
|
||||||
public static readonly string CfgNode_ItemCount = "ItemCount";
|
public static readonly string CfgNode_ItemCount = "ItemCount";
|
||||||
public static readonly string CfgNode_IsHorizonLayout = "IsHorizonLayout";
|
public static readonly string CfgNode_IsHorizonLayout = "IsHorizonLayout";
|
||||||
|
public static readonly string CfgNode_IsOverwrittenPaste = "IsOverwrittenPaste";
|
||||||
|
|
||||||
Dictionary<string, string> Read() {
|
Dictionary<string, string> Read() {
|
||||||
if (!File.Exists(Path.Combine(Environment.CurrentDirectory, _fileName)))
|
if (!File.Exists(Path.Combine(Environment.CurrentDirectory, _fileName)))
|
||||||
|
|||||||
@ -16,6 +16,10 @@
|
|||||||
<RoutedUICommand x:Key="commandMenu_File_Save"/>
|
<RoutedUICommand x:Key="commandMenu_File_Save"/>
|
||||||
<RoutedUICommand x:Key="commandMenu_Display_Undo"/>
|
<RoutedUICommand x:Key="commandMenu_Display_Undo"/>
|
||||||
<RoutedUICommand x:Key="commandMenu_Display_Redo"/>
|
<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.Resources>
|
||||||
|
|
||||||
<Window.InputBindings>
|
<Window.InputBindings>
|
||||||
@ -23,6 +27,10 @@
|
|||||||
<KeyBinding Gesture="Ctrl+S" Command="{StaticResource commandMenu_File_Save}"/>
|
<KeyBinding Gesture="Ctrl+S" Command="{StaticResource commandMenu_File_Save}"/>
|
||||||
<KeyBinding Gesture="Ctrl+Z" Command="{StaticResource commandMenu_Display_Undo}"/>
|
<KeyBinding Gesture="Ctrl+Z" Command="{StaticResource commandMenu_Display_Undo}"/>
|
||||||
<KeyBinding Gesture="Ctrl+Y" Command="{StaticResource commandMenu_Display_Redo}"/>
|
<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.InputBindings>
|
||||||
|
|
||||||
<Window.CommandBindings>
|
<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_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_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 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>
|
</Window.CommandBindings>
|
||||||
|
|
||||||
<!-- real ui elements-->
|
<!-- 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_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_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_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>
|
||||||
<MenuItem Header="{DynamicResource ui_MainWindow_Menu_Help}">
|
<MenuItem Header="{DynamicResource ui_MainWindow_Menu_Help}">
|
||||||
<MenuItem x:Name="uiMenu_Help_ReportBugs" Header="{DynamicResource ui_MainWindow_Menu_Help_ReportBugs}" Click="funcMenu_Help_ReportBugs"/>
|
<MenuItem x:Name="uiMenu_Help_ReportBugs" Header="{DynamicResource ui_MainWindow_Menu_Help_ReportBugs}" Click="funcMenu_Help_ReportBugs"/>
|
||||||
@ -59,9 +72,20 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</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 x:Name="uiEditorPanel" Grid.Row="1">
|
</Grid>
|
||||||
|
|
||||||
|
<Grid x:Name="uiEditorPanel" Grid.Row="1" Visibility="Collapsed">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="auto"/>
|
<RowDefinition Height="auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
@ -105,20 +129,20 @@
|
|||||||
<Grid x:Name="uiTASData">
|
<Grid x:Name="uiTASData">
|
||||||
<Grid.ContextMenu>
|
<Grid.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<MenuItem x:Name="uiDataMenu_Set" Header="{DynamicResource ui_TASFlow_Menu_Set}" Click="uiDataMenu_Set_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="uiDataMenu_Unset_Click"/>
|
<MenuItem x:Name="uiDataMenu_Unset" Header="{DynamicResource ui_TASFlow_Menu_Unset}" Click="funcDataMenu_Unset"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem x:Name="uiDataMenu_Cut" Header="{DynamicResource ui_TASFlow_Menu_Cut}" Click="uiDataMenu_Cut_Click" InputGestureText="Ctrl + X"/>
|
<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="uiDataMenu_Copy_Click" InputGestureText="Ctrl + C"/>
|
<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="uiDataMenu_PasteAfter_Click"/>
|
<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="uiDataMenu_PasteBefore_Click"/>
|
<MenuItem x:Name="uiDataMenu_PasteBefore" Header="{DynamicResource ui_TASFlow_Menu_PasterBefore}" Click="funcDataMenu_PasteBefore"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem x:Name="uiDataMenu_Delete" Header="{DynamicResource ui_TASFlow_Menu_Delete}" Click="uiDataMenu_Delete_Click"/>
|
<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="uiDataMenu_DeleteAfter_Click" InputGestureText="Del"/>
|
<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="uiDataMenu_DeleteBefore_Click" InputGestureText="Backspace"/>
|
<MenuItem x:Name="uiDataMenu_DeleteBefore" Header="{DynamicResource ui_TASFlow_Menu_PasterBefore}" Click="funcDataMenu_DeleteBefore" InputGestureText="Backspace"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem x:Name="uiDataMenu_AddAfter" Header="{DynamicResource ui_TASFlow_Menu_AddAfter}" Click="uiDataMenu_AddAfter_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="uiDataMenu_AddBefore_Click"/>
|
<MenuItem x:Name="uiDataMenu_AddBefore" Header="{DynamicResource ui_TASFlow_Menu_AddBefore}" Click="funcDataMenu_AddBefore"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Grid.ContextMenu>
|
</Grid.ContextMenu>
|
||||||
|
|
||||||
|
|||||||
@ -40,10 +40,18 @@ namespace BallanceTASEditor {
|
|||||||
private void funcCommand_Menu_File_Save(object sender, ExecutedRoutedEventArgs e) => funcMenu_File_Save(sender, e);
|
private void funcCommand_Menu_File_Save(object sender, ExecutedRoutedEventArgs e) => funcMenu_File_Save(sender, e);
|
||||||
private void funcCommand_Menu_Display_Undo(object sender, ExecutedRoutedEventArgs e) => funcMenu_Display_Undo(sender, e);
|
private void funcCommand_Menu_Display_Undo(object sender, ExecutedRoutedEventArgs e) => funcMenu_Display_Undo(sender, e);
|
||||||
private void funcCommand_Menu_Display_Redo(object sender, ExecutedRoutedEventArgs e) => funcMenu_Display_Redo(sender, e);
|
private void funcCommand_Menu_Display_Redo(object sender, ExecutedRoutedEventArgs e) => funcMenu_Display_Redo(sender, e);
|
||||||
|
private void funcCommand_DataMenu_Cut(object sender, ExecutedRoutedEventArgs e) => funcDataMenu_Cut(sender, e);
|
||||||
|
private void funcCommand_DataMenu_Copy(object sender, ExecutedRoutedEventArgs e) => funcDataMenu_Copy(sender, e);
|
||||||
|
private void funcCommand_DataMenu_DeleteAfter(object sender, ExecutedRoutedEventArgs e) => funcDataMenu_DeleteAfter(sender, e);
|
||||||
|
private void funcCommand_DataMenu_DeleteBefore(object sender, ExecutedRoutedEventArgs e) => funcDataMenu_DeleteBefore(sender, e);
|
||||||
private void funcCanExeCmd_Menu_File_Open(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = uiMenu_File_Open.IsEnabled;
|
private void funcCanExeCmd_Menu_File_Open(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = uiMenu_File_Open.IsEnabled;
|
||||||
private void funcCanExeCmd_Menu_File_Save(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = uiMenu_File_Save.IsEnabled;
|
private void funcCanExeCmd_Menu_File_Save(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = uiMenu_File_Save.IsEnabled;
|
||||||
private void funcCanExeCmd_Menu_Display_Undo(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = uiMenu_Display_Undo.IsEnabled;
|
private void funcCanExeCmd_Menu_Display_Undo(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = uiMenu_Display_Undo.IsEnabled;
|
||||||
private void funcCanExeCmd_Menu_Display_Redo(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = uiMenu_Display_Redo.IsEnabled;
|
private void funcCanExeCmd_Menu_Display_Redo(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = uiMenu_Display_Redo.IsEnabled;
|
||||||
|
private void funcCanExeCmd_DataMenu_Cut(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = mViewer != null && uiDataMenu_Cut.IsEnabled;
|
||||||
|
private void funcCanExeCmd_DataMenu_Copy(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = mViewer != null && uiDataMenu_Copy.IsEnabled;
|
||||||
|
private void funcCanExeCmd_DataMenu_DeleteAfter(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = mViewer != null && uiDataMenu_DeleteAfter.IsEnabled;
|
||||||
|
private void funcCanExeCmd_DataMenu_DeleteBefore(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = mViewer != null && uiDataMenu_DeleteBefore.IsEnabled;
|
||||||
|
|
||||||
// =========================== menu
|
// =========================== menu
|
||||||
#region window menu
|
#region window menu
|
||||||
@ -53,23 +61,13 @@ namespace BallanceTASEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void funcMenu_Help_About(object sender, RoutedEventArgs e) {
|
private void funcMenu_Help_About(object sender, RoutedEventArgs e) {
|
||||||
MessageBox.Show("Under MIT License\nVersion: 1.0 alpha\nyyc12345.", "Ballance TAS Editor");
|
MessageBox.Show("Under MIT License\nVersion: 1.0 beta\nyyc12345.", "Ballance TAS Editor", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void funcMenu_File_Open(object sender, RoutedEventArgs e) {
|
private void funcMenu_File_Open(object sender, RoutedEventArgs e) {
|
||||||
var file = DialogUtil.OpenFileDialog();
|
var file = DialogUtil.OpenFileDialog();
|
||||||
if (file == "") return;
|
if (file == "") return;
|
||||||
mFile = new TASFile(file);
|
OpenFile(file);
|
||||||
mViewer = new TASViewer(mFile, mSlider, mFlow);
|
|
||||||
|
|
||||||
mViewer.UpdateDataUI += RefreshDataUI;
|
|
||||||
mViewer.UpdateSelection += RefreshSelection;
|
|
||||||
mViewer.UpdateToolMode += RefreshToolMode;
|
|
||||||
|
|
||||||
RefreshUI(true);
|
|
||||||
|
|
||||||
mViewer.ChangeToolMode(ToolMode.Cursor);
|
|
||||||
mViewer.ChangeOverwrittenMode(uiMenu_Display_OverwrittenPaste.IsChecked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void funcMenu_File_Save(object sender, RoutedEventArgs e) {
|
private void funcMenu_File_Save(object sender, RoutedEventArgs e) {
|
||||||
@ -118,49 +116,49 @@ namespace BallanceTASEditor {
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region menu operation
|
#region datamenu operation
|
||||||
|
|
||||||
private void uiDataMenu_Set_Click(object sender, RoutedEventArgs e) {
|
private void funcDataMenu_Set(object sender, RoutedEventArgs e) {
|
||||||
mViewer.ProcessOperation(OperationEnum.Set);
|
mViewer.ProcessOperation(OperationEnum.Set);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiDataMenu_Unset_Click(object sender, RoutedEventArgs e) {
|
private void funcDataMenu_Unset(object sender, RoutedEventArgs e) {
|
||||||
mViewer.ProcessOperation(OperationEnum.Unset);
|
mViewer.ProcessOperation(OperationEnum.Unset);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiDataMenu_Cut_Click(object sender, RoutedEventArgs e) {
|
private void funcDataMenu_Cut(object sender, RoutedEventArgs e) {
|
||||||
mViewer.ProcessOperation(OperationEnum.Cut);
|
mViewer.ProcessOperation(OperationEnum.Cut);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiDataMenu_Copy_Click(object sender, RoutedEventArgs e) {
|
private void funcDataMenu_Copy(object sender, RoutedEventArgs e) {
|
||||||
mViewer.ProcessOperation(OperationEnum.Copy);
|
mViewer.ProcessOperation(OperationEnum.Copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiDataMenu_PasteAfter_Click(object sender, RoutedEventArgs e) {
|
private void funcDataMenu_PasteAfter(object sender, RoutedEventArgs e) {
|
||||||
mViewer.ProcessOperation(OperationEnum.PasteAfter);
|
mViewer.ProcessOperation(OperationEnum.PasteAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiDataMenu_PasteBefore_Click(object sender, RoutedEventArgs e) {
|
private void funcDataMenu_PasteBefore(object sender, RoutedEventArgs e) {
|
||||||
mViewer.ProcessOperation(OperationEnum.PasteBefore);
|
mViewer.ProcessOperation(OperationEnum.PasteBefore);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiDataMenu_Delete_Click(object sender, RoutedEventArgs e) {
|
private void funcDataMenu_Delete(object sender, RoutedEventArgs e) {
|
||||||
mViewer.ProcessOperation(OperationEnum.Delete);
|
mViewer.ProcessOperation(OperationEnum.Delete);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiDataMenu_DeleteAfter_Click(object sender, RoutedEventArgs e) {
|
private void funcDataMenu_DeleteAfter(object sender, RoutedEventArgs e) {
|
||||||
mViewer.ProcessOperation(OperationEnum.DeleteAfter);
|
mViewer.ProcessOperation(OperationEnum.DeleteAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiDataMenu_DeleteBefore_Click(object sender, RoutedEventArgs e) {
|
private void funcDataMenu_DeleteBefore(object sender, RoutedEventArgs e) {
|
||||||
mViewer.ProcessOperation(OperationEnum.DeleteBefore);
|
mViewer.ProcessOperation(OperationEnum.DeleteBefore);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiDataMenu_AddAfter_Click(object sender, RoutedEventArgs e) {
|
private void funcDataMenu_AddAfter(object sender, RoutedEventArgs e) {
|
||||||
mViewer.ProcessOperation(OperationEnum.AddAfter);
|
mViewer.ProcessOperation(OperationEnum.AddAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiDataMenu_AddBefore_Click(object sender, RoutedEventArgs e) {
|
private void funcDataMenu_AddBefore(object sender, RoutedEventArgs e) {
|
||||||
mViewer.ProcessOperation(OperationEnum.AddBefore);
|
mViewer.ProcessOperation(OperationEnum.AddBefore);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,8 +249,46 @@ namespace BallanceTASEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// drop file to open
|
||||||
|
private void funcDrop_Drop(object sender, DragEventArgs e) {
|
||||||
|
string fileName = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
|
||||||
|
OpenFile(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void funcDrop_DragEnter(object sender, DragEventArgs e) {
|
||||||
|
// only accept one file
|
||||||
|
if (e.Data.GetDataPresent(DataFormats.FileDrop)) {
|
||||||
|
var arr = (System.Array)e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
if (arr.Length != 1) e.Effects = DragDropEffects.None;
|
||||||
|
else e.Effects = DragDropEffects.Link;
|
||||||
|
}
|
||||||
|
else e.Effects = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private void OpenFile(string file) {
|
||||||
|
try {
|
||||||
|
mFile = new TASFile(file);
|
||||||
|
} catch {
|
||||||
|
MessageBox.Show("Fail to open file. This file might not a legal TAS file.", "Ballance TAS Editor", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
mFile = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mViewer = new TASViewer(mFile, mSlider, mFlow);
|
||||||
|
|
||||||
|
mViewer.UpdateDataUI += RefreshDataUI;
|
||||||
|
mViewer.UpdateSelection += RefreshSelection;
|
||||||
|
mViewer.UpdateToolMode += RefreshToolMode;
|
||||||
|
|
||||||
|
RefreshUI(true);
|
||||||
|
|
||||||
|
mViewer.ChangeToolMode(ToolMode.Cursor);
|
||||||
|
mViewer.ChangeOverwrittenMode(uiMenu_Display_OverwrittenPaste.IsChecked);
|
||||||
|
}
|
||||||
|
|
||||||
private void RefreshToolMode(ToolMode mode) {
|
private void RefreshToolMode(ToolMode mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case ToolMode.Cursor:
|
case ToolMode.Cursor:
|
||||||
|
|||||||
@ -6,7 +6,6 @@ using System.Text;
|
|||||||
|
|
||||||
namespace BallanceTASEditor.UI {
|
namespace BallanceTASEditor.UI {
|
||||||
|
|
||||||
|
|
||||||
public enum ToolMode {
|
public enum ToolMode {
|
||||||
Cursor,
|
Cursor,
|
||||||
Fill,
|
Fill,
|
||||||
|
|||||||
Reference in New Issue
Block a user