init i18n, config. add Cut oper
This commit is contained in:
@ -4,6 +4,11 @@
|
||||
xmlns:local="clr-namespace:BallanceTASEditor"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Language/DefaultLanguage.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -25,6 +26,17 @@ namespace BallanceTASEditor {
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
// init configure manager
|
||||
GlobalVariable.configManager = new Core.ConfigManager("ballance-tas-editor.cfg", new Dictionary<string, string>() {
|
||||
{"Language", CultureInfo.CurrentCulture.ThreeLetterWindowsLanguageName},
|
||||
{"ItemCount", "15"},
|
||||
{"IsHorizonLayout", "True"}
|
||||
});
|
||||
|
||||
// init i18n
|
||||
Core.I18NProcessor.ChangeLanguage(GlobalVariable.configManager.Configuration["Language"]);
|
||||
|
||||
}
|
||||
|
||||
private void UncatchedErrorHandle(string message, string stackTrace) {
|
||||
@ -50,7 +62,10 @@ namespace BallanceTASEditor {
|
||||
;//skip
|
||||
}
|
||||
|
||||
MessageBox.Show("A fatal error occurs. The application should exit. Please send the error log, reproduce step and corresponding TAS file(is possible) to use to help fixing this problem.", "Ballance TAS Editor", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show("A fatal error occurs. The application should exit. Please send the error log, reproduce step and corresponding TAS file(if possible) to developer to help fixing this problem.",
|
||||
"Ballance TAS Editor",
|
||||
MessageBoxButton.OK, MessageBoxImage.Error
|
||||
);
|
||||
App.Current.Shutdown();
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +38,9 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
@ -61,9 +64,12 @@
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Core\ClipboardUtil.cs" />
|
||||
<Compile Include="Core\ConfigManager.cs" />
|
||||
<Compile Include="Core\FileOperation.cs" />
|
||||
<Compile Include="Core\I18NProcessor.cs" />
|
||||
<Compile Include="Core\KeyboardState.cs" />
|
||||
<Compile Include="Core\LimitedStack.cs" />
|
||||
<Compile Include="GlobalVariable.cs" />
|
||||
<Compile Include="UI\AddItem.xaml.cs">
|
||||
<DependentUpon>AddItem.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -75,6 +81,14 @@
|
||||
</Compile>
|
||||
<Compile Include="UI\TASViewer.cs" />
|
||||
<Compile Include="UI\Util.cs" />
|
||||
<Page Include="Language\CHS.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Language\DefaultLanguage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@ -126,5 +140,6 @@
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
52
BallanceTASEditor/Core/ConfigManager.cs
Normal file
52
BallanceTASEditor/Core/ConfigManager.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BallanceTASEditor.Core {
|
||||
public class ConfigManager {
|
||||
|
||||
public ConfigManager(string fileName, Dictionary<string, string> defaultValue) {
|
||||
_fileName = fileName;
|
||||
_defaultValue = JsonConvert.SerializeObject(defaultValue);
|
||||
|
||||
Configuration = Read();
|
||||
}
|
||||
|
||||
string _fileName;
|
||||
string _defaultValue;
|
||||
public Dictionary<string, string> Configuration;
|
||||
|
||||
Dictionary<string, string> Read() {
|
||||
if (!File.Exists(Path.Combine(Environment.CurrentDirectory, _fileName)))
|
||||
Init();
|
||||
|
||||
Dictionary<string, string> data;
|
||||
using (StreamReader fs = new StreamReader(Path.Combine(Environment.CurrentDirectory, _fileName), Encoding.UTF8)) {
|
||||
data = JsonConvert.DeserializeObject<Dictionary<string, string>>(fs.ReadToEnd());
|
||||
fs.Close();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void Init() {
|
||||
using (StreamWriter fs = new StreamWriter(Path.Combine(Environment.CurrentDirectory, _fileName), false, Encoding.UTF8)) {
|
||||
fs.Write(_defaultValue);
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Save() {
|
||||
using (StreamWriter fs = new StreamWriter(Path.Combine(Environment.CurrentDirectory, _fileName), false, Encoding.UTF8)) {
|
||||
fs.Write(JsonConvert.SerializeObject(this.Configuration));
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
40
BallanceTASEditor/Core/I18NProcessor.cs
Normal file
40
BallanceTASEditor/Core/I18NProcessor.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace BallanceTASEditor.Core {
|
||||
public static class I18NProcessor {
|
||||
|
||||
public static string GetI18N(string key, params string[] parameters) {
|
||||
try {
|
||||
var cache = (string)(App.Current.Resources[key]);
|
||||
return string.Format(cache, parameters);
|
||||
} catch (Exception) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static void ChangeLanguage(string target) {
|
||||
ResourceDictionary langRd = null;
|
||||
try {
|
||||
langRd =
|
||||
Application.LoadComponent(
|
||||
new Uri(@"Language/" + target + ".xaml", UriKind.Relative))
|
||||
as ResourceDictionary;
|
||||
} catch {
|
||||
;
|
||||
}
|
||||
|
||||
if (langRd != null) {
|
||||
if (App.Current.Resources.MergedDictionaries.Count > 0) {
|
||||
App.Current.Resources.MergedDictionaries.Clear();
|
||||
}
|
||||
App.Current.Resources.MergedDictionaries.Add(langRd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
13
BallanceTASEditor/GlobalVariable.cs
Normal file
13
BallanceTASEditor/GlobalVariable.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BallanceTASEditor {
|
||||
public class GlobalVariable {
|
||||
|
||||
public static Core.ConfigManager configManager;
|
||||
|
||||
}
|
||||
}
|
||||
55
BallanceTASEditor/Language/CHS.xaml
Normal file
55
BallanceTASEditor/Language/CHS.xaml
Normal file
@ -0,0 +1,55 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:BallanceTASEditor.Language"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib">
|
||||
<!-- ui data-->
|
||||
<sys:String x:Key="ui_MainWindow_Title">Ballance TAS 编辑器</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_MainWindow_Menu_File">文件</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_File_Open">打开</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_File_Save">保存</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_File_SaveAs">另存为...</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_File_Close">关闭</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Display">编辑</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Display_Undo">撤销</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Display_Redo">重做</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Display_ItemCount">项个数</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Display_OverwrittenPaste">覆盖式粘贴</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Help">帮助</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Help_ReportBugs">汇报漏洞</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Help_About">关于</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_MainWindow_EditorNote">打开一个 TAS 文件以编辑</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_MainWindow_Tools_Cursor">选择模式</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Tools_Fill">填充模式</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Tools_Overwritten">画笔模式</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_MainWindow_StatusBar_Mode_Cursor">选择模式</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_StatusBar_Mode_Fill">填充模式</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_StatusBar_Mode_Overwritten">画笔模式</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_StatusBar_Selected">已选择:</sys:String>
|
||||
|
||||
|
||||
<sys:String x:Key="ui_TASFlow_Sheet_Frame">帧</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Sheet_DeltaTime">间隔时间</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_TASFlow_Menu_Set">设置</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_Unset">不设置</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_Cut">剪切</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_Copy">复制</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_PasteAfter">粘贴于后方</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_PasterBefore">粘贴于前方</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_Delete">删除</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_DeleteAfter">向后删除</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_DeleteBefore">向前删除</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_AddAfter">在后方添加新项</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_AddBefore">在前方添加新项</sys:String>
|
||||
|
||||
<!-- code data-->
|
||||
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
55
BallanceTASEditor/Language/DefaultLanguage.xaml
Normal file
55
BallanceTASEditor/Language/DefaultLanguage.xaml
Normal file
@ -0,0 +1,55 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:BallanceTASEditor.Language"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib">
|
||||
<!-- ui data-->
|
||||
<sys:String x:Key="ui_MainWindow_Title">Ballance TAS Editor</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_MainWindow_Menu_File">File</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_File_Open">Open</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_File_Save">Save</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_File_SaveAs">Save As ...</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_File_Close">Close</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Display">Edit</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Display_Undo">Undo</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Display_Redo">Redo</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Display_ItemCount">Item Count</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Display_OverwrittenPaste">Overwritten Paste</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Help">Help</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Help_ReportBugs">Report Bugs</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Menu_Help_About">About</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_MainWindow_EditorNote">Open a TAS file for editing</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_MainWindow_Tools_Cursor">Select mode</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Tools_Fill">Fill mode</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_Tools_Overwritten">Draw mode</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_MainWindow_StatusBar_Mode_Cursor">Select mode</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_StatusBar_Mode_Fill">Fill mode</sys:String>
|
||||
<sys:String x:Key="ui_MainWindow_StatusBar_Mode_Overwritten">Draw mode</sys:String>
|
||||
<sys:String xml:space="preserve" x:Key="ui_MainWindow_StatusBar_Selected">Selected: </sys:String>
|
||||
|
||||
|
||||
<sys:String x:Key="ui_TASFlow_Sheet_Frame">Frame</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Sheet_DeltaTime">Delta Time</sys:String>
|
||||
|
||||
<sys:String x:Key="ui_TASFlow_Menu_Set">Set</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_Unset">Unset</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_Cut">Cut</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_Copy">Copy</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_PasteAfter">Paste after this</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_PasterBefore">Paste before this</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_Delete">Delete</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_DeleteAfter">Delete next frame</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_DeleteBefore">Delete last frame</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_AddAfter">Add blank item after this</sys:String>
|
||||
<sys:String x:Key="ui_TASFlow_Menu_AddBefore">Add blank item before this</sys:String>
|
||||
|
||||
<!-- code data-->
|
||||
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
@ -7,7 +7,7 @@
|
||||
xmlns:controls="clr-namespace:BallanceTASEditor.UI"
|
||||
xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
|
||||
mc:Ignorable="d"
|
||||
Title="Ballance TAS Editor" Height="500" Width="800" KeyUp="funcWindow_KeyUp"
|
||||
Title="{DynamicResource ui_MainWindow_Title}" Height="500" Width="800" KeyUp="funcWindow_KeyUp"
|
||||
input:InputMethod.IsInputMethodEnabled="False">
|
||||
|
||||
<Grid>
|
||||
@ -18,25 +18,25 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Menu Grid.Row="0">
|
||||
<MenuItem Header="File">
|
||||
<MenuItem x:Name="uiMenu_File_Open" Header="Open" Click="funcMenu_File_Open"/>
|
||||
<MenuItem x:Name="uiMenu_File_Save" Header="Save" Click="funcMenu_File_Save"/>
|
||||
<MenuItem x:Name="uiMenu_File_SaveAs" Header="Save As..." Click="funcMenu_File_SaveAs"/>
|
||||
<MenuItem x:Name="uiMenu_File_Close" Header="Close" Click="funcMenu_File_Close"/>
|
||||
<MenuItem Header="{DynamicResource ui_MainWindow_Menu_File}">
|
||||
<MenuItem x:Name="uiMenu_File_Open" Header="{DynamicResource ui_MainWindow_Menu_File_Open}" Click="funcMenu_File_Open" InputGestureText="Ctrl + O"/>
|
||||
<MenuItem x:Name="uiMenu_File_Save" Header="{DynamicResource ui_MainWindow_Menu_File_Save}" Click="funcMenu_File_Save" InputGestureText="Ctrl + S"/>
|
||||
<MenuItem x:Name="uiMenu_File_SaveAs" Header="{DynamicResource ui_MainWindow_Menu_File_SaveAs}" Click="funcMenu_File_SaveAs"/>
|
||||
<MenuItem x:Name="uiMenu_File_Close" Header="{DynamicResource ui_MainWindow_Menu_File_Close}" Click="funcMenu_File_Close"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Display">
|
||||
<MenuItem x:Name="uiMenu_Display_Undo" Header="Undo" Click="funcMenu_Display_Undo"/>
|
||||
<MenuItem x:Name="uiMenu_Display_Redo" Header="Redo" Click="funcMenu_Display_Redo"/>
|
||||
<MenuItem x:Name="uiMenu_Display_ItemCount" Header="Item Count" Click="funcMenu_Display_ItemCount"/>
|
||||
<MenuItem x:Name="uiMenu_Display_OverwrittenPaste" Header="Overwritten Paste" IsCheckable="True" Checked="funcMenu_Display_OverwrittenPaste" Unchecked="funcMenu_Display_OverwrittenPaste"/>
|
||||
<MenuItem Header="{DynamicResource ui_MainWindow_Menu_Display}">
|
||||
<MenuItem x:Name="uiMenu_Display_Undo" Header="{DynamicResource ui_MainWindow_Menu_Display_Undo}" Click="funcMenu_Display_Undo" InputGestureText="Ctrl + Z"/>
|
||||
<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>
|
||||
<MenuItem Header="Help">
|
||||
<MenuItem x:Name="uiMenu_Help_ReportBugs" Header="Report bugs" Click="funcMenu_Help_ReportBugs"/>
|
||||
<MenuItem x:Name="uiMenu_Help_About" Header="About" Click="funcMenu_Help_About"/>
|
||||
<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_About" Header="{DynamicResource ui_MainWindow_Menu_Help_About}" Click="funcMenu_Help_About"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
|
||||
<TextBlock x:Name="uiEditorNote" Grid.Row="1" Text="Open a TAS file for editing" Opacity="0.5" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="16"/>
|
||||
<TextBlock x:Name="uiEditorNote" Grid.Row="1" Text="{DynamicResource ui_MainWindow_EditorNote}" Opacity="0.5" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="16"/>
|
||||
|
||||
<Grid x:Name="uiEditorPanel" Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
@ -53,7 +53,7 @@
|
||||
<Path Fill="Black" Data="M10.07,14.27C10.57,14.03 11.16,14.25 11.4,14.75L13.7,19.74L15.5,18.89L13.19,13.91C12.95,13.41 13.17,12.81 13.67,12.58L13.95,12.5L16.25,12.05L8,5.12V15.9L9.82,14.43L10.07,14.27M13.64,21.97C13.14,22.21 12.54,22 12.31,21.5L10.13,16.76L7.62,18.78C7.45,18.92 7.24,19 7,19A1,1 0 0,1 6,18V3A1,1 0 0,1 7,2C7.24,2 7.47,2.09 7.64,2.23L7.65,2.22L19.14,11.86C19.57,12.22 19.62,12.85 19.27,13.27C19.12,13.45 18.91,13.57 18.7,13.61L15.54,14.23L17.74,18.96C18,19.46 17.76,20.05 17.26,20.28L13.64,21.97Z" />
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
<TextBlock Text="Select mode" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{DynamicResource ui_MainWindow_Tools_Cursor}" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button x:Name="uiBtn_Fill" Margin="5" Padding="5" Click="funcBtn_Fill">
|
||||
@ -63,7 +63,7 @@
|
||||
<Path Fill="Black" Data="M19,11.5C19,11.5 17,13.67 17,15A2,2 0 0,0 19,17A2,2 0 0,0 21,15C21,13.67 19,11.5 19,11.5M5.21,10L10,5.21L14.79,10M16.56,8.94L7.62,0L6.21,1.41L8.59,3.79L3.44,8.94C2.85,9.5 2.85,10.47 3.44,11.06L8.94,16.56C9.23,16.85 9.62,17 10,17C10.38,17 10.77,16.85 11.06,16.56L16.56,11.06C17.15,10.47 17.15,9.5 16.56,8.94Z" />
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
<TextBlock Text="Fill mode" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{DynamicResource ui_MainWindow_Tools_Fill}" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button x:Name="uiBtn_Overwrite" Margin="5" Padding="5" Click="funcBtn_Overwrite">
|
||||
@ -73,7 +73,7 @@
|
||||
<Path Fill="Black" Data="M18.62,1.5C18.11,1.5 17.6,1.69 17.21,2.09L10.75,8.55L14.95,12.74L21.41,6.29C22.2,5.5 22.2,4.24 21.41,3.46L20.04,2.09C19.65,1.69 19.14,1.5 18.62,1.5M9.8,9.5L3.23,16.07L3.93,16.77C3.4,17.24 2.89,17.78 2.38,18.29C1.6,19.08 1.6,20.34 2.38,21.12C3.16,21.9 4.42,21.9 5.21,21.12C5.72,20.63 6.25,20.08 6.73,19.58L7.43,20.27L14,13.7" />
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
<TextBlock Text="Draw mode" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{DynamicResource ui_MainWindow_Tools_Overwritten}" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
@ -133,11 +133,11 @@
|
||||
</Grid>
|
||||
|
||||
<StatusBar x:Name="uiStatusbar" Grid.Row="2">
|
||||
<TextBlock x:Name="uiStatusbar_Mode_Cursor" Text="Select mode"/>
|
||||
<TextBlock x:Name="uiStatusbar_Mode_Fill" Text="Fill mode"/>
|
||||
<TextBlock x:Name="uiStatusbar_Mode_Overwrite" Text="Draw mode"/>
|
||||
<TextBlock x:Name="uiStatusbar_Mode_Cursor" Text="{DynamicResource ui_MainWindow_StatusBar_Mode_Cursor}"/>
|
||||
<TextBlock x:Name="uiStatusbar_Mode_Fill" Text="{DynamicResource ui_MainWindow_StatusBar_Mode_Fill}"/>
|
||||
<TextBlock x:Name="uiStatusbar_Mode_Overwrite" Text="{DynamicResource ui_MainWindow_StatusBar_Mode_Overwritten}"/>
|
||||
<Separator/>
|
||||
<TextBlock Text="Selected: "/>
|
||||
<TextBlock Text="{DynamicResource ui_MainWindow_StatusBar_Selected}"/>
|
||||
<TextBlock x:Name="uiStatusbar_Selected" Text="-"/>
|
||||
</StatusBar>
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ namespace BallanceTASEditor.UI {
|
||||
public enum OperationEnum {
|
||||
Set,
|
||||
Unset,
|
||||
Cut,
|
||||
Copy,
|
||||
PasteAfter,
|
||||
PasteBefore,
|
||||
|
||||
@ -9,19 +9,20 @@
|
||||
<Grid x:Name="uiCoreWindow" Background="#ffffff">
|
||||
<Grid.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem x:Name="uiDataMenu_Set" Header="Set" Click="uiDataMenu_Set_Click"/>
|
||||
<MenuItem x:Name="uiDataMenu_Unset" Header="Unset" Click="uiDataMenu_Unset_Click"/>
|
||||
<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"/>
|
||||
<Separator/>
|
||||
<MenuItem x:Name="uiDataMenu_Copy" Header="Copy" Click="uiDataMenu_Copy_Click"/>
|
||||
<MenuItem x:Name="uiDataMenu_PasteAfter" Header="Paste after this" Click="uiDataMenu_PasteAfter_Click"/>
|
||||
<MenuItem x:Name="uiDataMenu_PasteBefore" Header="Paste before this" Click="uiDataMenu_PasteBefore_Click"/>
|
||||
<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"/>
|
||||
<Separator/>
|
||||
<MenuItem x:Name="uiDataMenu_Delete" Header="Delete" Click="uiDataMenu_Delete_Click"/>
|
||||
<MenuItem x:Name="uiDataMenu_DeleteAfter" Header="Delete next frame" Click="uiDataMenu_DeleteAfter_Click"/>
|
||||
<MenuItem x:Name="uiDataMenu_DeleteBefore" Header="Delete last frame" Click="uiDataMenu_DeleteBefore_Click"/>
|
||||
<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"/>
|
||||
<Separator/>
|
||||
<MenuItem x:Name="uiDataMenu_AddAfter" Header="Add blank item after this" Click="uiDataMenu_AddAfter_Click"/>
|
||||
<MenuItem x:Name="uiDataMenu_AddBefore" Header="Add blank item before this" Click="uiDataMenu_AddBefore_Click"/>
|
||||
<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"/>
|
||||
</ContextMenu>
|
||||
</Grid.ContextMenu>
|
||||
|
||||
@ -44,8 +45,8 @@
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Padding="2" Background="#afafaf" Grid.Column="0" Grid.Row="1" Text="Frame"/>
|
||||
<TextBlock Padding="2" Background="#afafaf" Grid.Column="0" Grid.Row="2" Text="Delta Time"/>
|
||||
<TextBlock Padding="2" Background="#afafaf" Grid.Column="0" Grid.Row="1" Text="{DynamicResource ui_TASFlow_Sheet_Frame}"/>
|
||||
<TextBlock Padding="2" Background="#afafaf" Grid.Column="0" Grid.Row="2" Text="{DynamicResource ui_TASFlow_Sheet_DeltaTime}"/>
|
||||
<TextBlock Padding="2" Background="#afafaf" Grid.Column="0" Grid.Row="3" Text="^"/>
|
||||
<TextBlock Padding="2" Background="#afafaf" Grid.Column="0" Grid.Row="4" Text="v"/>
|
||||
<TextBlock Padding="2" Background="#afafaf" Grid.Column="0" Grid.Row="5" Text="<"/>
|
||||
|
||||
@ -88,6 +88,7 @@ namespace BallanceTASEditor.UI {
|
||||
|
||||
uiDataMenu_Set.IsEnabled = showFill;
|
||||
uiDataMenu_Unset.IsEnabled = showFill;
|
||||
uiDataMenu_Cut.IsEnabled = showCursorCopyDelete;
|
||||
uiDataMenu_Copy.IsEnabled = showCursorCopyDelete;
|
||||
uiDataMenu_Delete.IsEnabled = showCursorCopyDelete;
|
||||
uiDataMenu_DeleteAfter.IsEnabled = showCursorPasteAddDeleteOne;
|
||||
@ -180,6 +181,10 @@ namespace BallanceTASEditor.UI {
|
||||
NewOperation?.Invoke(OperationEnum.Unset);
|
||||
}
|
||||
|
||||
private void uiDataMenu_Cut_Click(object sender, RoutedEventArgs e) {
|
||||
NewOperation?.Invoke(OperationEnum.Cut);
|
||||
}
|
||||
|
||||
private void uiDataMenu_Copy_Click(object sender, RoutedEventArgs e) {
|
||||
NewOperation?.Invoke(OperationEnum.Copy);
|
||||
}
|
||||
|
||||
@ -161,6 +161,25 @@ namespace BallanceTASEditor.UI {
|
||||
RefreshDisplay();
|
||||
}
|
||||
break;
|
||||
case OperationEnum.Cut: {
|
||||
// cut is a hybrid operation, first, do copy
|
||||
// then delete selected item
|
||||
// due to copy is not affect TASFile and only delete oper affect it
|
||||
// so this is a revocable oper
|
||||
var data = new LinkedList<FrameData>();
|
||||
mFile.Copy(mSelectionHelp.GetRange(), data);
|
||||
if (!ClipboardUtil.SetFrameData(data)) {
|
||||
MessageBox.Show("Fail to cut due to unknow reason!");
|
||||
break; // if fail to cut, do not delete selected items.
|
||||
}
|
||||
|
||||
// do delete
|
||||
mFile.Remove(mSelectionHelp.GetRange());
|
||||
mSelectionHelp.Reset();
|
||||
updateSliderRange();
|
||||
RefreshDisplay();
|
||||
}
|
||||
break;
|
||||
case OperationEnum.Copy: {
|
||||
var data = new LinkedList<FrameData>();
|
||||
mFile.Copy(mSelectionHelp.GetRange(), data);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
|
||||
<package id="zlib.net" version="1.0.4.0" targetFramework="net40" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user