Skip to content

Commit

Permalink
Do some release work
Browse files Browse the repository at this point in the history
* Add Crtl + V for paste after
* Finish english readme
* Add icon designed plaer_2
* Update I18N
  • Loading branch information
yyc12345 committed Sep 25, 2021
1 parent b506daf commit 5971069
Show file tree
Hide file tree
Showing 10 changed files with 191 additions and 22 deletions.
7 changes: 6 additions & 1 deletion BallanceTASEditor/BallanceTASEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
Expand Down Expand Up @@ -135,6 +138,8 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Resource Include="icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
19 changes: 19 additions & 0 deletions BallanceTASEditor/Language/CHS.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,27 @@
<sys:String x:Key="ui_TASFlow_Menu_AddAfter">在后方添加新项</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_AddBefore">在前方添加新项</sys:String>

<sys:String x:Key="ui_AddItem_Title">添加项</sys:String>
<sys:String x:Key="ui_AddItem_Count">个数</sys:String>
<sys:String x:Key="ui_AddItem_FPS">帧率</sys:String>
<sys:String x:Key="ui_AddItem_DeltaTime">间隔时间</sys:String>
<sys:String x:Key="ui_AddItem_OK">好</sys:String>
<sys:String x:Key="ui_AddItem_Cancel">取消</sys:String>

<!-- code data-->

<sys:String x:Key="code_Shared_ProgramName">Ballance TAS 编辑器</sys:String>

<sys:String x:Key="code_MainWindow_Menu_Help_About" xml:space="preserve">基于 MIT 开源许可证发布
版本:1.0 stable
程序:yyc12345.
图标设计:plAer_2</sys:String>
<sys:String x:Key="code_MainWindow_Menu_File_Close">您想要关闭这个TAS文件吗?</sys:String>
<sys:String x:Key="code_MainWindow_Menu_File_Open_Fail">无法打开文件,文件可能不是合法的TAS文件。</sys:String>
<sys:String x:Key="code_MainWindow_Menu_Display_ItemCount">输入新的数量(&lt;=5 &amp;&amp; &gt;=30)</sys:String>
<sys:String x:Key="code_DialogUtil_Warning">警告</sys:String>
<sys:String x:Key="code_DialogUtil_FileFilter">TAS 文件(*.tas)|*.tas|所有文件(*.*)|*.*</sys:String>
<sys:String x:Key="code_DialogUtil_InputNumber_Title">输入数字</sys:String>
<sys:String x:Key="code_DialogUtil_InputNumber_Wrong">无效的数字,请再试一次。</sys:String>

</ResourceDictionary>
25 changes: 22 additions & 3 deletions BallanceTASEditor/Language/DefaultLanguage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,32 @@
<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_DeleteAfter">Delete this 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>


<sys:String x:Key="ui_AddItem_Title">Add Item</sys:String>
<sys:String x:Key="ui_AddItem_Count">Count</sys:String>
<sys:String x:Key="ui_AddItem_FPS">FPS</sys:String>
<sys:String x:Key="ui_AddItem_DeltaTime">Delta Time</sys:String>
<sys:String x:Key="ui_AddItem_OK">OK</sys:String>
<sys:String x:Key="ui_AddItem_Cancel">Cancel</sys:String>

<!-- code data-->

<sys:String x:Key="code_Shared_ProgramName">Ballance TAS Editor</sys:String>


<sys:String x:Key="code_MainWindow_Menu_Help_About" xml:space="preserve">Under MIT License
Version: 1.0 stable
Program: yyc12345.
Icon design: plAer_2</sys:String>
<sys:String x:Key="code_MainWindow_Menu_File_Close">Do you want to close this TAS file?</sys:String>
<sys:String x:Key="code_MainWindow_Menu_File_Open_Fail">Fail to open file. This file might not a legal TAS file.</sys:String>
<sys:String x:Key="code_MainWindow_Menu_Display_ItemCount">Input new count (&lt;=5 &amp;&amp; &gt;=30)</sys:String>
<sys:String x:Key="code_DialogUtil_Warning">Warning</sys:String>
<sys:String x:Key="code_DialogUtil_FileFilter">TAS file(*.tas)|*.tas|All file(*.*)|*.*</sys:String>
<sys:String x:Key="code_DialogUtil_InputNumber_Title">Input number</sys:String>
<sys:String x:Key="code_DialogUtil_InputNumber_Wrong">Invalid number. Please input again.</sys:String>

</ResourceDictionary>
7 changes: 5 additions & 2 deletions BallanceTASEditor/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
mc:Ignorable="d"
Title="{DynamicResource ui_MainWindow_Title}" Height="500" Width="800" KeyUp="funcWindow_KeyUp"
input:InputMethod.IsInputMethodEnabled="False" MouseWheel="funcWindow_MouseWheel">
input:InputMethod.IsInputMethodEnabled="False" MouseWheel="funcWindow_MouseWheel" Icon="icon.ico">

<!-- shortcut defination-->
<Window.Resources>
Expand All @@ -18,6 +18,7 @@
<RoutedUICommand x:Key="commandMenu_Display_Redo"/>
<RoutedUICommand x:Key="commandDataMenu_Cut"/>
<RoutedUICommand x:Key="commandDataMenu_Copy"/>
<RoutedUICommand x:Key="commandDataMenu_PasteAfter"/>
<RoutedUICommand x:Key="commandDataMenu_DeleteAfter"/>
<RoutedUICommand x:Key="commandDataMenu_DeleteBefore"/>
</Window.Resources>
Expand All @@ -29,6 +30,7 @@
<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="Ctrl+V" Command="{StaticResource commandDataMenu_PasteAfter}"/>
<KeyBinding Gesture="Delete" Command="{StaticResource commandDataMenu_DeleteAfter}"/>
<KeyBinding Gesture="Back" Command="{StaticResource commandDataMenu_DeleteBefore}"/>
</Window.InputBindings>
Expand All @@ -40,6 +42,7 @@
<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_PasteAfter}" Executed="funcCommand_DataMenu_PasteAfter" CanExecute="funcCanExeCmd_DataMenu_PasteAfter"/>
<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>
Expand Down Expand Up @@ -141,7 +144,7 @@
<Separator/>
<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_PasteAfter" Header="{DynamicResource ui_TASFlow_Menu_PasteAfter}" Click="funcDataMenu_PasteAfter" InputGestureText="Ctrl + V"/>
<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="funcDataMenu_Delete"/>
Expand Down
14 changes: 10 additions & 4 deletions BallanceTASEditor/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public MainWindow() {
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_PasteAfter(object sender, ExecutedRoutedEventArgs e) => funcDataMenu_PasteAfter(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;
Expand All @@ -77,6 +78,7 @@ public MainWindow() {
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_PasteAfter(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = mViewer != null && uiDataMenu_PasteAfter.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;

Expand All @@ -88,7 +90,9 @@ private void funcMenu_Help_ReportBugs(object sender, RoutedEventArgs e) {
}

private void funcMenu_Help_About(object sender, RoutedEventArgs e) {
MessageBox.Show("Under MIT License\nVersion: 1.0 beta\nyyc12345.", "Ballance TAS Editor", MessageBoxButton.OK, MessageBoxImage.Information);
MessageBox.Show(I18NProcessor.GetI18N("code_MainWindow_Menu_Help_About"),
I18NProcessor.GetI18N("code_Shared_ProgramName"),
MessageBoxButton.OK, MessageBoxImage.Information);
}

private void funcMenu_File_Open(object sender, RoutedEventArgs e) {
Expand All @@ -108,7 +112,7 @@ private void funcMenu_File_SaveAs(object sender, RoutedEventArgs e) {
}

private void funcMenu_File_Close(object sender, RoutedEventArgs e) {
if (!DialogUtil.ConfirmDialog("Do you want to close this TAS file?")) return;
if (!DialogUtil.ConfirmDialog(I18NProcessor.GetI18N("code_MainWindow_Menu_File_Close"))) return;

mViewer.UpdateDataUI -= RefreshDataUI;
mViewer.UpdateSelection -= RefreshSelection;
Expand All @@ -122,7 +126,7 @@ private void funcMenu_File_Close(object sender, RoutedEventArgs e) {

private void funcMenu_Display_ItemCount(object sender, RoutedEventArgs e) {
int newvalue = 0;
if (DialogUtil.InputNumber("Input new count (>=5 && <=30)", 5, 30, ref newvalue)) {
if (DialogUtil.InputNumber(I18NProcessor.GetI18N("code_MainWindow_Menu_Display_ItemCount"), 5, 30, ref newvalue)) {
ChangeItemCount(newvalue);
}
}
Expand Down Expand Up @@ -322,7 +326,9 @@ 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);
MessageBox.Show(I18NProcessor.GetI18N("code_MainWindow_Menu_File_Open_Fail"),
I18NProcessor.GetI18N("code_Shared_ProgramName"),
MessageBoxButton.OK, MessageBoxImage.Error);
mFile = null;
return;
}
Expand Down
12 changes: 6 additions & 6 deletions BallanceTASEditor/UI/AddItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:local="clr-namespace:BallanceTASEditor.UI"
xmlns:converter="clr-namespace:BallanceTASEditor.UI"
mc:Ignorable="d"
Title="Add Item" Height="200" Width="400" WindowStyle="ToolWindow" WindowStartupLocation="CenterOwner">
Title="{DynamicResource ui_AddItem_Title}" Height="200" Width="400" WindowStyle="ToolWindow" WindowStartupLocation="CenterOwner" Icon="/BallanceTASEditor;component/icon.ico">
<Window.Resources>
<converter:AddItemConverter x:Key="conv_addItem"/>
<converter:FPS2DeltaTimeConverter x:Key="conv_fps2DeltaTime"/>
Expand All @@ -25,25 +25,25 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<TextBlock Margin="5" Grid.Column="0" Grid.Row="0" Text="Count" VerticalAlignment="Center"/>
<TextBlock Margin="5" Grid.Column="0" Grid.Row="1" Text="FPS" VerticalAlignment="Center"/>
<TextBlock Margin="5" Grid.Column="0" Grid.Row="2" Text="Delta Time" VerticalAlignment="Center"/>
<TextBlock Margin="5" Grid.Column="0" Grid.Row="0" Text="{DynamicResource ui_AddItem_Count}" VerticalAlignment="Center"/>
<TextBlock Margin="5" Grid.Column="0" Grid.Row="1" Text="{DynamicResource ui_AddItem_FPS}" VerticalAlignment="Center"/>
<TextBlock Margin="5" Grid.Column="0" Grid.Row="2" Text="{DynamicResource ui_AddItem_DeltaTime}" VerticalAlignment="Center"/>

<TextBox x:Name="uiTextbox_Count" Margin="5" Padding="5" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center"/>
<TextBox x:Name="uiTextbox_FPS" Margin="5" Padding="5" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center"/>
<TextBlock x:Name="uiText_DeltaTime" Margin="5" Padding="5" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center"
Text="{Binding Converter={StaticResource conv_fps2DeltaTime}, Mode=OneWay, ElementName=uiTextbox_FPS, Path=Text}"/>

<StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Right" Grid.ColumnSpan="2" Grid.Row="4">
<Button x:Name="uiBtn_OK" Margin="5" Padding="5" Content="OK" MinWidth="50" Click="funcBtn_OK">
<Button x:Name="uiBtn_OK" Margin="5" Padding="5" Content="{DynamicResource ui_AddItem_OK}" MinWidth="50" Click="funcBtn_OK">
<Button.IsEnabled>
<MultiBinding Converter="{StaticResource conv_addItem}" Mode="OneWay">
<Binding ElementName="uiTextbox_Count" Path="Text"/>
<Binding ElementName="uiTextbox_FPS" Path="Text"/>
</MultiBinding>
</Button.IsEnabled>
</Button>
<Button x:Name="uiBtn_Cancel" Margin="5" Padding="5" Content="Cancel" MinWidth="50" Click="funcBtn_Cancel"/>
<Button x:Name="uiBtn_Cancel" Margin="5" Padding="5" Content="{DynamicResource ui_AddItem_Cancel}" MinWidth="50" Click="funcBtn_Cancel"/>
</StackPanel>
</Grid>
</Window>
13 changes: 8 additions & 5 deletions BallanceTASEditor/UI/DialogUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Text;
using System.Windows;
using BallanceTASEditor.Core;

namespace BallanceTASEditor.UI {
public class DialogUtil {
Expand All @@ -12,32 +13,34 @@ public static string OpenFileDialog() {
Microsoft.Win32.OpenFileDialog op = new Microsoft.Win32.OpenFileDialog();
op.RestoreDirectory = true;
op.Multiselect = false;
op.Filter = "TAS file(*.tas)|*.tas|All file(*.*)|*.*";
op.Filter = I18NProcessor.GetI18N("code_DialogUtil_FileFilter");
if (!(bool)op.ShowDialog()) return "";
return op.FileName;
}

public static string SaveFileDialog() {
Microsoft.Win32.SaveFileDialog op = new Microsoft.Win32.SaveFileDialog();
op.RestoreDirectory = true;
op.Filter = "TAS file(*.tas)|*.tas|All file(*.*)|*.*";
op.Filter = I18NProcessor.GetI18N("code_DialogUtil_FileFilter");
if (!(bool)op.ShowDialog()) return "";
return op.FileName;
}

public static bool ConfirmDialog(string str) {
var result = MessageBox.Show(str, "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning);
var result = MessageBox.Show(str, I18NProcessor.GetI18N("code_DialogUtil_Warning"), MessageBoxButton.YesNo, MessageBoxImage.Warning);
return (result == MessageBoxResult.Yes);
}

public static bool InputNumber(string title, int min, int max, ref int result) {
while (true) {
var dialog = Interaction.InputBox(title, "Input number", "");
var dialog = Interaction.InputBox(title, I18NProcessor.GetI18N("code_DialogUtil_InputNumber_Title"), "");
if (dialog == "") return false;
if (int.TryParse(dialog, out result)) {
if (result <= max && result >= min) break;
}
MessageBox.Show("Invalid number. Please input again", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
MessageBox.Show(I18NProcessor.GetI18N("code_DialogUtil_InputNumber_Wrong"),
I18NProcessor.GetI18N("code_DialogUtil_Warning"),
MessageBoxButton.OK, MessageBoxImage.Warning);
}
return true;
}
Expand Down
Binary file added BallanceTASEditor/icon.ico
Binary file not shown.
Loading

0 comments on commit 5971069

Please sign in to comment.