Minor fix
* Fix selection error when use delete after to delete the last tas unit * Fix sel_rect display error * Add some documents * Fix layout becoming confusing when secondly open file.
This commit is contained in:
@ -38,7 +38,8 @@ namespace BallanceTASEditor.Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long GetPointerIndex() {
|
public long GetPointerIndex() {
|
||||||
if (mPointer == null) throw new Exception("Data is not ready");
|
// return invalid data to prevent error
|
||||||
|
if (mPointer == null) return -1;//throw new Exception("Data is not ready");
|
||||||
return mPointerIndex;
|
return mPointerIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
<sys:String x:Key="ui_MainWindow_StatusBar_Mode_Cursor">选择模式</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_Fill">填充模式</sys:String>
|
||||||
<sys:String x:Key="ui_MainWindow_StatusBar_Mode_Overwritten">画笔模式</sys:String>
|
<sys:String x:Key="ui_MainWindow_StatusBar_Mode_Overwritten">画笔模式</sys:String>
|
||||||
|
<sys:String x:Key="ui_MainWindow_StatusBar_OverwrittenPaste">覆盖式粘贴</sys:String>
|
||||||
<sys:String x:Key="ui_MainWindow_StatusBar_Selected">已选择:</sys:String>
|
<sys:String x:Key="ui_MainWindow_StatusBar_Selected">已选择:</sys:String>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
<sys:String x:Key="ui_MainWindow_StatusBar_Mode_Cursor">Select 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_Fill">Fill mode</sys:String>
|
||||||
<sys:String x:Key="ui_MainWindow_StatusBar_Mode_Overwritten">Draw mode</sys:String>
|
<sys:String x:Key="ui_MainWindow_StatusBar_Mode_Overwritten">Draw mode</sys:String>
|
||||||
|
<sys:String x:Key="ui_MainWindow_StatusBar_OverwrittenPaste">Overwritten paste</sys:String>
|
||||||
<sys:String xml:space="preserve" x:Key="ui_MainWindow_StatusBar_Selected">Selected: </sys:String>
|
<sys:String xml:space="preserve" x:Key="ui_MainWindow_StatusBar_Selected">Selected: </sys:String>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -233,15 +233,19 @@
|
|||||||
</Slider>
|
</Slider>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<StatusBar x:Name="uiStatusbar" Grid.Row="2">
|
<StatusBar x:Name="uiStatusbar" Grid.Row="2">
|
||||||
<TextBlock x:Name="uiStatusbar_Mode_Cursor" Text="{DynamicResource ui_MainWindow_StatusBar_Mode_Cursor}"/>
|
<Grid>
|
||||||
<TextBlock x:Name="uiStatusbar_Mode_Fill" Text="{DynamicResource ui_MainWindow_StatusBar_Mode_Fill}"/>
|
<TextBlock x:Name="uiStatusbar_Mode_Cursor" Text="{DynamicResource ui_MainWindow_StatusBar_Mode_Cursor}"/>
|
||||||
<TextBlock x:Name="uiStatusbar_Mode_Overwrite" Text="{DynamicResource ui_MainWindow_StatusBar_Mode_Overwritten}"/>
|
<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}"/>
|
||||||
|
</Grid>
|
||||||
|
<Separator/>
|
||||||
|
<TextBlock x:Name="uiStatusbar_OverwrittenPaste" Text="{DynamicResource ui_MainWindow_StatusBar_OverwrittenPaste}"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<TextBlock Text="{DynamicResource ui_MainWindow_StatusBar_Selected}"/>
|
<TextBlock Text="{DynamicResource ui_MainWindow_StatusBar_Selected}"/>
|
||||||
<TextBlock x:Name="uiStatusbar_Selected" Text="-"/>
|
<TextBlock x:Name="uiStatusbar_Selected" Text="-"/>
|
||||||
|
|||||||
@ -22,6 +22,7 @@ namespace BallanceTASEditor {
|
|||||||
public partial class MainWindow : Window {
|
public partial class MainWindow : Window {
|
||||||
public MainWindow() {
|
public MainWindow() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
mIsHorizontalLayout = true;
|
||||||
|
|
||||||
// init layout controller
|
// init layout controller
|
||||||
var headers = new List<TextBlock>();
|
var headers = new List<TextBlock>();
|
||||||
@ -56,6 +57,7 @@ namespace BallanceTASEditor {
|
|||||||
TASViewer mViewer;
|
TASViewer mViewer;
|
||||||
TASFlow mFlow;
|
TASFlow mFlow;
|
||||||
TASSlider mSlider;
|
TASSlider mSlider;
|
||||||
|
bool mIsHorizontalLayout;
|
||||||
|
|
||||||
#region ui func
|
#region ui func
|
||||||
|
|
||||||
@ -127,6 +129,7 @@ namespace BallanceTASEditor {
|
|||||||
|
|
||||||
private void funcMenu_Display_OverwrittenPaste(object sender, RoutedEventArgs e) {
|
private void funcMenu_Display_OverwrittenPaste(object sender, RoutedEventArgs e) {
|
||||||
uiMenu_Display_OverwrittenPaste.IsChecked = !uiMenu_Display_OverwrittenPaste.IsChecked;
|
uiMenu_Display_OverwrittenPaste.IsChecked = !uiMenu_Display_OverwrittenPaste.IsChecked;
|
||||||
|
uiStatusbar_OverwrittenPaste.Visibility = uiMenu_Display_OverwrittenPaste.IsChecked ? Visibility.Visible : Visibility.Hidden;
|
||||||
|
|
||||||
GlobalVariable.configManager.Configuration[ConfigManager.CfgNode_IsOverwrittenPaste] = uiMenu_Display_OverwrittenPaste.IsChecked.ToString();
|
GlobalVariable.configManager.Configuration[ConfigManager.CfgNode_IsOverwrittenPaste] = uiMenu_Display_OverwrittenPaste.IsChecked.ToString();
|
||||||
if (mViewer != null)
|
if (mViewer != null)
|
||||||
@ -307,6 +310,7 @@ namespace BallanceTASEditor {
|
|||||||
|
|
||||||
uiMenu_Display_OverwrittenPaste.IsChecked = isOverwrittenPaste;
|
uiMenu_Display_OverwrittenPaste.IsChecked = isOverwrittenPaste;
|
||||||
uiMenu_Display_HorizontalLayout.IsChecked = isHorizontalLayout;
|
uiMenu_Display_HorizontalLayout.IsChecked = isHorizontalLayout;
|
||||||
|
uiStatusbar_OverwrittenPaste.Visibility = isOverwrittenPaste ? Visibility.Visible : Visibility.Hidden;
|
||||||
if (mViewer != null) {
|
if (mViewer != null) {
|
||||||
mViewer.ChangeOverwrittenMode(isOverwrittenPaste);
|
mViewer.ChangeOverwrittenMode(isOverwrittenPaste);
|
||||||
mViewer.ChangeListLength(itemCount);
|
mViewer.ChangeListLength(itemCount);
|
||||||
@ -450,6 +454,9 @@ namespace BallanceTASEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ChangeLayout(bool isHorizontal) {
|
private void ChangeLayout(bool isHorizontal) {
|
||||||
|
if (isHorizontal == mIsHorizontalLayout) return;
|
||||||
|
mIsHorizontalLayout = isHorizontal;
|
||||||
|
|
||||||
// swap window size
|
// swap window size
|
||||||
var swap = this.Width;
|
var swap = this.Width;
|
||||||
this.Width = this.Height;
|
this.Width = this.Height;
|
||||||
|
|||||||
@ -28,8 +28,6 @@ namespace BallanceTASEditor.UI {
|
|||||||
|
|
||||||
public event Action Click;
|
public event Action Click;
|
||||||
|
|
||||||
private const double SELECTION_HEADER_HEIGHT = 10.0f; // header selection height, originally copied from TASFlowItem class
|
|
||||||
|
|
||||||
private readonly TextBlock[] mHeaders;
|
private readonly TextBlock[] mHeaders;
|
||||||
private bool mIsHorizontalLayout;
|
private bool mIsHorizontalLayout;
|
||||||
private Grid uiCoreWindow;
|
private Grid uiCoreWindow;
|
||||||
@ -57,7 +55,7 @@ namespace BallanceTASEditor.UI {
|
|||||||
// column is tas unit
|
// column is tas unit
|
||||||
|
|
||||||
// header
|
// header
|
||||||
layout_row_adder(new GridLength(SELECTION_HEADER_HEIGHT, GridUnitType.Pixel));
|
layout_row_adder(GridLength.Auto);
|
||||||
for (int r = 0; r < lenHeader; r++) {
|
for (int r = 0; r < lenHeader; r++) {
|
||||||
layout_row_adder(GridLength.Auto);
|
layout_row_adder(GridLength.Auto);
|
||||||
}
|
}
|
||||||
@ -74,7 +72,7 @@ namespace BallanceTASEditor.UI {
|
|||||||
// column is header count (use start to split, not auto)
|
// column is header count (use start to split, not auto)
|
||||||
|
|
||||||
// header
|
// header
|
||||||
layout_column_adder(new GridLength(SELECTION_HEADER_HEIGHT, GridUnitType.Pixel));
|
layout_column_adder(GridLength.Auto);
|
||||||
for (int r = 0; r < lenHeader; r++) {
|
for (int r = 0; r < lenHeader; r++) {
|
||||||
if (r == 0 || r == 1)
|
if (r == 0 || r == 1)
|
||||||
layout_column_adder(GridLength.Auto);
|
layout_column_adder(GridLength.Auto);
|
||||||
@ -249,6 +247,7 @@ namespace BallanceTASEditor.UI {
|
|||||||
private static readonly Color COLOR_UNSET = Color.FromArgb(0, 255, 255, 255);
|
private static readonly Color COLOR_UNSET = Color.FromArgb(0, 255, 255, 255);
|
||||||
private static readonly Color COLOR_SELECTED = Colors.OrangeRed;
|
private static readonly Color COLOR_SELECTED = Colors.OrangeRed;
|
||||||
private static readonly Color COLOR_UNSELECTED = Colors.LightGray;
|
private static readonly Color COLOR_UNSELECTED = Colors.LightGray;
|
||||||
|
private const double SELECTION_HEADER_HEIGHT = 10.0f;
|
||||||
private const int KEY_COUNT = 9;
|
private const int KEY_COUNT = 9;
|
||||||
|
|
||||||
public TASFlowUIItem(int column, bool useHorizontalLayout) {
|
public TASFlowUIItem(int column, bool useHorizontalLayout) {
|
||||||
@ -279,7 +278,10 @@ namespace BallanceTASEditor.UI {
|
|||||||
|
|
||||||
sel_rect.StrokeThickness = 2;
|
sel_rect.StrokeThickness = 2;
|
||||||
sel_rect.Stroke = SEL_RECT_STROKE;
|
sel_rect.Stroke = SEL_RECT_STROKE;
|
||||||
//sel_rect.Height = SELECTION_HEADER_HEIGHT; // now sel_rect's size decided by layout
|
if (useHorizontalLayout)
|
||||||
|
sel_rect.Height = SELECTION_HEADER_HEIGHT;
|
||||||
|
else
|
||||||
|
sel_rect.Width = SELECTION_HEADER_HEIGHT;
|
||||||
|
|
||||||
// keystates item
|
// keystates item
|
||||||
keystates = new Rectangle[KEY_COUNT];
|
keystates = new Rectangle[KEY_COUNT];
|
||||||
@ -314,6 +316,11 @@ namespace BallanceTASEditor.UI {
|
|||||||
for (int i = 0; i < KEY_COUNT; i++) {
|
for (int i = 0; i < KEY_COUNT; i++) {
|
||||||
UI.Util.SwapGridItemRC(keystates[i]);
|
UI.Util.SwapGridItemRC(keystates[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// swap sel_rect height and width
|
||||||
|
var swap = sel_rect.Height;
|
||||||
|
sel_rect.Height = sel_rect.Width;
|
||||||
|
sel_rect.Width = swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(Grid target, Dictionary<Rectangle, CellPosition> map, MouseButtonEventHandler func) {
|
public void Add(Grid target, Dictionary<Rectangle, CellPosition> map, MouseButtonEventHandler func) {
|
||||||
|
|||||||
@ -34,8 +34,16 @@ namespace BallanceTASEditor.UI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateRange(TASFile mFile) {
|
public void UpdateRange(TASFile mFile) {
|
||||||
components.mSlider.Maximum = mFile.mFrameCount - 1;
|
components.mSlider.Maximum = mFile.mFrameCount == 0 ? 0 : mFile.mFrameCount - 1;
|
||||||
components.mSlider.Value = mFile.GetPointerIndex();
|
var index = mFile.GetPointerIndex();
|
||||||
|
if (index >= 0) {
|
||||||
|
components.mSlider.Value = mFile.GetPointerIndex();
|
||||||
|
components.mSlider.IsEnabled = true;
|
||||||
|
} else {
|
||||||
|
// invalid index, mean slider is useless, disable it
|
||||||
|
components.mSlider.Value = components.mSlider.Maximum;
|
||||||
|
components.mSlider.IsEnabled = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void func_SliderValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) {
|
private void func_SliderValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) {
|
||||||
|
|||||||
@ -202,12 +202,12 @@ namespace BallanceTASEditor.UI {
|
|||||||
if (oper == OperationEnum.DeleteBefore) pos -= 1; // delete after mean delete current selected item
|
if (oper == OperationEnum.DeleteBefore) pos -= 1; // delete after mean delete current selected item
|
||||||
if (pos < 0 || pos >= mFile.mFrameCount) return;
|
if (pos < 0 || pos >= mFile.mFrameCount) return;
|
||||||
|
|
||||||
// only delete before need shift selection
|
// delete before need shift selection
|
||||||
// delete before couldn't cause empty list, so we just need to directly shift
|
// delete before couldn't cause empty list, so we just need to directly shift
|
||||||
if (oper == OperationEnum.DeleteBefore)
|
if (oper == OperationEnum.DeleteBefore)
|
||||||
mSelectionHelp.ShiftTo(false);
|
mSelectionHelp.ShiftTo(false);
|
||||||
// also, if we use delete after and delete the tail of item list, we also need to shift pos(use `else if` to prevent double shift)
|
// also, if we use delete after and delete the tail of item list, we also need to shift pos(use `else if` to prevent double shift)
|
||||||
else if (oper == OperationEnum.DeleteAfter && pos == mFile.mFrameCount) {
|
else if (oper == OperationEnum.DeleteAfter && pos == mFile.mFrameCount - 1) {
|
||||||
// but delete after may cause empty list error(delete the item within only 1 item list)
|
// but delete after may cause empty list error(delete the item within only 1 item list)
|
||||||
// so we need prevent this situation
|
// so we need prevent this situation
|
||||||
if (mFile.mFrameCount == 1) mSelectionHelp.Reset(); //yes, reset selection to prevent error
|
if (mFile.mFrameCount == 1) mSelectionHelp.Reset(); //yes, reset selection to prevent error
|
||||||
|
|||||||
43
README_ZH.md
43
README_ZH.md
@ -7,19 +7,19 @@
|
|||||||
### 程序菜单
|
### 程序菜单
|
||||||
|
|
||||||
* 文件
|
* 文件
|
||||||
* 打开:打开一个TAS文件
|
* 打开:打开一个TAS文件
|
||||||
* 保存:保存当前改动到TAS文件
|
* 保存:保存当前改动到TAS文件
|
||||||
* 另存为...:将当前改动保存到另一个新地方,保存完毕后文件自动切换成新目标,之后的保存操作将针对新文件来保存
|
* 另存为...:将当前改动保存到另一个新地方,保存完毕后文件自动切换成新目标,之后的保存操作将针对新文件来保存
|
||||||
* 关闭:关闭当前文件
|
* 关闭:关闭当前文件
|
||||||
* 编辑
|
* 编辑
|
||||||
* 撤销:撤销上一步操作
|
* 撤销:撤销上一步操作
|
||||||
* 重做:重做上个撤销的操作
|
* 重做:重做上个撤销的操作
|
||||||
* 项个数:设置一个页面显示多少个TAS操作单元。
|
* 项个数:设置一个页面显示多少个TAS操作单元。
|
||||||
* 覆盖式粘贴:决定粘贴时的操作是插入式还是覆盖式,详情请查看“覆盖式粘贴”章节
|
* 覆盖式粘贴:决定粘贴时的操作是插入式还是覆盖式,详情请查看“覆盖式粘贴”章节
|
||||||
* 横向布局:决定TAS单元的显示方向,选中为横向布局,不选中则为纵向布局
|
* 横向布局:决定TAS单元的显示方向,选中为横向布局,不选中则为纵向布局
|
||||||
* 帮助
|
* 帮助
|
||||||
* 汇报漏洞:打开一个网页来汇报这个程序的Bug
|
* 汇报漏洞:打开一个网页来汇报这个程序的Bug
|
||||||
* 关于:关于此程序
|
* 关于:关于此程序
|
||||||
|
|
||||||
### TAS单元菜单
|
### TAS单元菜单
|
||||||
|
|
||||||
@ -41,13 +41,29 @@
|
|||||||
|
|
||||||
### 状态栏
|
### 状态栏
|
||||||
|
|
||||||
在打开文件后,底部状态栏将显示当前的状态:当前工具模式 和 当前选定的区域
|
在打开文件后,底部状态栏将显示当前的状态,从左至右分别是:当前工具模式,覆盖式粘贴状态 和 当前选定的区域
|
||||||
|
|
||||||
## 移动视图
|
## 视图
|
||||||
|
|
||||||
|
### 基本操作
|
||||||
|
|
||||||
打开文件后,靠近底部有一个滑条,可以快速滑动到希望浏览的位置。
|
打开文件后,靠近底部有一个滑条,可以快速滑动到希望浏览的位置。
|
||||||
滑条左侧有4个按钮,分别是:快退,退一个单元,进一个单元,快进。快进和快退将一次性前进或后退一个页面的单元数量。
|
滑条左侧有4个按钮,分别是:快退,退一个单元,进一个单元,快进。快进和快退将一次性前进或后退一个页面的单元数量。
|
||||||
|
|
||||||
|
如果要控制界面中显示的TAS单元数量,可以选择编辑 - 项个数进行设置
|
||||||
|
|
||||||
|
### 快速操作
|
||||||
|
|
||||||
|
键盘上的ASDF四个键从左至右也分别对应滑条左侧的四个按钮的功能。
|
||||||
|
|
||||||
|
鼠标滚轮一次可以一次向前或向后滚动一个TAS单元。
|
||||||
|
如果按住Shift滚动鼠标滚轮,可以一次向前或向后滚动一整页。
|
||||||
|
如果按住Ctrl滚动鼠标滚轮,可以增加或减少当前页面显示的TAS单元的个数。
|
||||||
|
|
||||||
|
### 横向布局与纵向布局
|
||||||
|
|
||||||
|
打开文档后,通过编辑 - 横向布局的勾选来确定启用的布局,不同的布局适用于不同的人,请根据自身喜好选择。
|
||||||
|
|
||||||
## 模式介绍
|
## 模式介绍
|
||||||
|
|
||||||
### 基本模式
|
### 基本模式
|
||||||
@ -82,7 +98,6 @@
|
|||||||
|
|
||||||
### 快捷键
|
### 快捷键
|
||||||
|
|
||||||
* 键盘上的ASDF四个键从左至右也分别对应滑条左侧的四个按钮的功能。
|
|
||||||
* `Ctrl + O`:打开文件
|
* `Ctrl + O`:打开文件
|
||||||
* `Ctrl + S`:保存文件
|
* `Ctrl + S`:保存文件
|
||||||
* `Ctrl + Z`:撤销
|
* `Ctrl + Z`:撤销
|
||||||
|
|||||||
Reference in New Issue
Block a user