maybe all ui and funcs has been attached
This commit is contained in:
@ -64,6 +64,7 @@
|
|||||||
<Compile Include="UI\AddItem.xaml.cs">
|
<Compile Include="UI\AddItem.xaml.cs">
|
||||||
<DependentUpon>AddItem.xaml</DependentUpon>
|
<DependentUpon>AddItem.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="UI\OperationEnum.cs" />
|
||||||
<Compile Include="UI\SelectionHelp.cs" />
|
<Compile Include="UI\SelectionHelp.cs" />
|
||||||
<Compile Include="UI\StyleConverter.cs" />
|
<Compile Include="UI\StyleConverter.cs" />
|
||||||
<Compile Include="UI\TASFlow.xaml.cs">
|
<Compile Include="UI\TASFlow.xaml.cs">
|
||||||
|
|||||||
@ -25,7 +25,10 @@
|
|||||||
<MenuItem x:Name="uiMenu_File_Close" Header="Close" Click="funcMenu_File_Close"/>
|
<MenuItem x:Name="uiMenu_File_Close" Header="Close" Click="funcMenu_File_Close"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="Display">
|
<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_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>
|
</MenuItem>
|
||||||
<MenuItem Header="Help">
|
<MenuItem Header="Help">
|
||||||
<MenuItem x:Name="uiMenu_Help_ReportBugs" Header="Report bugs" Click="funcMenu_Help_ReportBugs"/>
|
<MenuItem x:Name="uiMenu_Help_ReportBugs" Header="Report bugs" Click="funcMenu_Help_ReportBugs"/>
|
||||||
|
|||||||
@ -46,6 +46,7 @@ namespace BallanceTASEditor {
|
|||||||
mViewer = new TASViewer(mFile, uiTASSlider, uiTASData, uiStatusbar_Selected);
|
mViewer = new TASViewer(mFile, uiTASSlider, uiTASData, uiStatusbar_Selected);
|
||||||
RefreshUI(true);
|
RefreshUI(true);
|
||||||
ChangeToolMode(ToolMode.Cursor);
|
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) {
|
||||||
@ -73,6 +74,20 @@ namespace BallanceTASEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void funcMenu_Display_OverwrittenPaste(object sender, RoutedEventArgs e) {
|
||||||
|
//uiMenu_Display_OverwrittenPaste.IsChecked = !uiMenu_Display_OverwrittenPaste.IsChecked;
|
||||||
|
if (mViewer != null)
|
||||||
|
mViewer.ChangeOverwrittenMode(uiMenu_Display_OverwrittenPaste.IsChecked);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void funcMenu_Display_Redo(object sender, RoutedEventArgs e) {
|
||||||
|
mViewer.ProcessOperation(OperationEnum.Redo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void funcMenu_Display_Undo(object sender, RoutedEventArgs e) {
|
||||||
|
mViewer.ProcessOperation(OperationEnum.Undo);
|
||||||
|
}
|
||||||
|
|
||||||
// =========================== btn
|
// =========================== btn
|
||||||
private void funcBtn_Cursor(object sender, RoutedEventArgs e) {
|
private void funcBtn_Cursor(object sender, RoutedEventArgs e) {
|
||||||
ChangeToolMode(ToolMode.Cursor);
|
ChangeToolMode(ToolMode.Cursor);
|
||||||
@ -173,6 +188,9 @@ namespace BallanceTASEditor {
|
|||||||
uiMenu_File_Close.IsEnabled = true;
|
uiMenu_File_Close.IsEnabled = true;
|
||||||
|
|
||||||
uiMenu_Display_ItemCount.IsEnabled = true;
|
uiMenu_Display_ItemCount.IsEnabled = true;
|
||||||
|
uiMenu_Display_OverwrittenPaste.IsEnabled = true;
|
||||||
|
uiMenu_Display_Undo.IsEnabled = true;
|
||||||
|
uiMenu_Display_Redo.IsEnabled = true;
|
||||||
|
|
||||||
uiStatusbar.Visibility = Visibility.Visible;
|
uiStatusbar.Visibility = Visibility.Visible;
|
||||||
} else {
|
} else {
|
||||||
@ -185,6 +203,9 @@ namespace BallanceTASEditor {
|
|||||||
uiMenu_File_Close.IsEnabled = false;
|
uiMenu_File_Close.IsEnabled = false;
|
||||||
|
|
||||||
uiMenu_Display_ItemCount.IsEnabled = false;
|
uiMenu_Display_ItemCount.IsEnabled = false;
|
||||||
|
uiMenu_Display_OverwrittenPaste.IsEnabled = false;
|
||||||
|
uiMenu_Display_Undo.IsEnabled = false;
|
||||||
|
uiMenu_Display_Redo.IsEnabled = false;
|
||||||
|
|
||||||
uiStatusbar.Visibility = Visibility.Collapsed;
|
uiStatusbar.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|||||||
21
UI/OperationEnum.cs
Normal file
21
UI/OperationEnum.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BallanceTASEditor.UI {
|
||||||
|
public enum OperationEnum {
|
||||||
|
Set,
|
||||||
|
Unset,
|
||||||
|
Copy,
|
||||||
|
PasteAfter,
|
||||||
|
PasteBefore,
|
||||||
|
Delete,
|
||||||
|
DeleteAfter,
|
||||||
|
DeleteBefore,
|
||||||
|
AddAfter,
|
||||||
|
AddBefore,
|
||||||
|
Undo,
|
||||||
|
Redo
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -72,6 +72,12 @@ namespace BallanceTASEditor.UI {
|
|||||||
SetMode(mMode);
|
SetMode(mMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// onnly used for delete prev one / next one shift.
|
||||||
|
public void ShiftTo(bool toNext) {
|
||||||
|
if (!IsDataPartialReady()) throw new Exception("Shift operation with wrong condition.");
|
||||||
|
FirstClick(GetPoint() + (toNext ? 1 : -1), mStartField);
|
||||||
|
}
|
||||||
|
|
||||||
public SelectionRange GetRange() {
|
public SelectionRange GetRange() {
|
||||||
if (mMode == ToolMode.Overwrite) throw new Exception("Read with wrong mode.");
|
if (mMode == ToolMode.Overwrite) throw new Exception("Read with wrong mode.");
|
||||||
if (!(mIsStartConfirmed && mIsEndConfirmed)) throw new Exception("Data is not ready to read");
|
if (!(mIsStartConfirmed && mIsEndConfirmed)) throw new Exception("Data is not ready to read");
|
||||||
|
|||||||
@ -9,17 +9,19 @@
|
|||||||
<Grid x:Name="uiCoreWindow" Background="#ffffff">
|
<Grid x:Name="uiCoreWindow" Background="#ffffff">
|
||||||
<Grid.ContextMenu>
|
<Grid.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<MenuItem x:Name="uiDataMenu_Set" Header="Set"/>
|
<MenuItem x:Name="uiDataMenu_Set" Header="Set" Click="uiDataMenu_Set_Click"/>
|
||||||
<MenuItem x:Name="uiDataMenu_Unset" Header="Unset"/>
|
<MenuItem x:Name="uiDataMenu_Unset" Header="Unset" Click="uiDataMenu_Unset_Click"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem x:Name="uiDataMenu_Copy" Header="Copy"/>
|
<MenuItem x:Name="uiDataMenu_Copy" Header="Copy" Click="uiDataMenu_Copy_Click"/>
|
||||||
<MenuItem x:Name="uiDataMenu_Delete" Header="Delete"/>
|
<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"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem x:Name="uiDataMenu_PasteAfter" Header="Paste after this"/>
|
<MenuItem x:Name="uiDataMenu_Delete" Header="Delete" Click="uiDataMenu_Delete_Click"/>
|
||||||
<MenuItem x:Name="uiDataMenu_PasteBefore" Header="Paste before this"/>
|
<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"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem x:Name="uiDataMenu_AddAfter" Header="Add blank item after this"/>
|
<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"/>
|
<MenuItem x:Name="uiDataMenu_AddBefore" Header="Add blank item before this" Click="uiDataMenu_AddBefore_Click"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Grid.ContextMenu>
|
</Grid.ContextMenu>
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ namespace BallanceTASEditor.UI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public event Action Click;
|
public event Action Click;
|
||||||
|
public event Action<OperationEnum> NewOperation;
|
||||||
|
|
||||||
private int mItemCount;
|
private int mItemCount;
|
||||||
private List<TASFlowUIItem> mItemList;
|
private List<TASFlowUIItem> mItemList;
|
||||||
@ -81,7 +82,7 @@ namespace BallanceTASEditor.UI {
|
|||||||
if (SelectionHelp == null) return;
|
if (SelectionHelp == null) return;
|
||||||
|
|
||||||
ToolMode mode = SelectionHelp.GetToolMode();
|
ToolMode mode = SelectionHelp.GetToolMode();
|
||||||
bool showCursorPasteAdd = mode == ToolMode.Cursor && SelectionHelp.IsDataPartialReady();
|
bool showCursorPasteAddDeleteOne = mode == ToolMode.Cursor && SelectionHelp.IsDataPartialReady();
|
||||||
bool showFill = mode == ToolMode.Fill && SelectionHelp.IsDataReady();
|
bool showFill = mode == ToolMode.Fill && SelectionHelp.IsDataReady();
|
||||||
bool showCursorCopyDelete = mode == ToolMode.Cursor && SelectionHelp.IsDataReady();
|
bool showCursorCopyDelete = mode == ToolMode.Cursor && SelectionHelp.IsDataReady();
|
||||||
|
|
||||||
@ -89,10 +90,12 @@ namespace BallanceTASEditor.UI {
|
|||||||
uiDataMenu_Unset.IsEnabled = showFill;
|
uiDataMenu_Unset.IsEnabled = showFill;
|
||||||
uiDataMenu_Copy.IsEnabled = showCursorCopyDelete;
|
uiDataMenu_Copy.IsEnabled = showCursorCopyDelete;
|
||||||
uiDataMenu_Delete.IsEnabled = showCursorCopyDelete;
|
uiDataMenu_Delete.IsEnabled = showCursorCopyDelete;
|
||||||
uiDataMenu_PasteAfter.IsEnabled = showCursorPasteAdd;
|
uiDataMenu_DeleteAfter.IsEnabled = showCursorPasteAddDeleteOne;
|
||||||
uiDataMenu_PasteBefore.IsEnabled = showCursorPasteAdd;
|
uiDataMenu_DeleteBefore.IsEnabled = showCursorPasteAddDeleteOne;
|
||||||
uiDataMenu_AddAfter.IsEnabled = showCursorPasteAdd;
|
uiDataMenu_PasteAfter.IsEnabled = showCursorPasteAddDeleteOne;
|
||||||
uiDataMenu_AddBefore.IsEnabled = showCursorPasteAdd;
|
uiDataMenu_PasteBefore.IsEnabled = showCursorPasteAddDeleteOne;
|
||||||
|
uiDataMenu_AddAfter.IsEnabled = showCursorPasteAddDeleteOne;
|
||||||
|
uiDataMenu_AddBefore.IsEnabled = showCursorPasteAddDeleteOne;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshSelectionHighlight() {
|
public void RefreshSelectionHighlight() {
|
||||||
@ -167,6 +170,50 @@ namespace BallanceTASEditor.UI {
|
|||||||
Click?.Invoke();
|
Click?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region menu operation
|
||||||
|
|
||||||
|
private void uiDataMenu_Set_Click(object sender, RoutedEventArgs e) {
|
||||||
|
NewOperation?.Invoke(OperationEnum.Set);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uiDataMenu_Unset_Click(object sender, RoutedEventArgs e) {
|
||||||
|
NewOperation?.Invoke(OperationEnum.Unset);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uiDataMenu_Copy_Click(object sender, RoutedEventArgs e) {
|
||||||
|
NewOperation?.Invoke(OperationEnum.Copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uiDataMenu_PasteAfter_Click(object sender, RoutedEventArgs e) {
|
||||||
|
NewOperation?.Invoke(OperationEnum.PasteAfter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uiDataMenu_PasteBefore_Click(object sender, RoutedEventArgs e) {
|
||||||
|
NewOperation?.Invoke(OperationEnum.PasteBefore);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uiDataMenu_Delete_Click(object sender, RoutedEventArgs e) {
|
||||||
|
NewOperation?.Invoke(OperationEnum.Delete);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uiDataMenu_DeleteAfter_Click(object sender, RoutedEventArgs e) {
|
||||||
|
NewOperation?.Invoke(OperationEnum.DeleteAfter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uiDataMenu_DeleteBefore_Click(object sender, RoutedEventArgs e) {
|
||||||
|
NewOperation?.Invoke(OperationEnum.DeleteBefore);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uiDataMenu_AddAfter_Click(object sender, RoutedEventArgs e) {
|
||||||
|
NewOperation?.Invoke(OperationEnum.AddAfter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uiDataMenu_AddBefore_Click(object sender, RoutedEventArgs e) {
|
||||||
|
NewOperation?.Invoke(OperationEnum.AddBefore);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TASFlowUIItem {
|
public class TASFlowUIItem {
|
||||||
|
|||||||
146
UI/TASViewer.cs
146
UI/TASViewer.cs
@ -28,20 +28,14 @@ namespace BallanceTASEditor.UI {
|
|||||||
INVALID_FRAME_DATA = new FrameData(-1f, 0);
|
INVALID_FRAME_DATA = new FrameData(-1f, 0);
|
||||||
mDataSource = new List<FrameDataDisplay>();
|
mDataSource = new List<FrameDataDisplay>();
|
||||||
mListLength = 0;
|
mListLength = 0;
|
||||||
|
mOverwrittenPaste = false;
|
||||||
|
|
||||||
// bind event and source
|
// bind event and source
|
||||||
mDataGrid.DataSources = mDataSource;
|
mDataGrid.DataSources = mDataSource;
|
||||||
mDataGrid.SelectionHelp = mSelectionHelp;
|
mDataGrid.SelectionHelp = mSelectionHelp;
|
||||||
|
|
||||||
mDataGrid.uiDataMenu_Set.Click += funcDataMenu_Set;
|
|
||||||
mDataGrid.uiDataMenu_Unset.Click += funcDataMenu_Unset;
|
|
||||||
mDataGrid.uiDataMenu_Copy.Click += funcDataMenu_Copy;
|
|
||||||
mDataGrid.uiDataMenu_Delete.Click += funcDataMenu_Delete;
|
|
||||||
mDataGrid.uiDataMenu_PasteAfter.Click += funcDataMenu_PasteAfter;
|
|
||||||
mDataGrid.uiDataMenu_PasteBefore.Click += funcDataMenu_PasteBefore;
|
|
||||||
mDataGrid.uiDataMenu_AddAfter.Click += funcDataMenu_AddAfter;
|
|
||||||
mDataGrid.uiDataMenu_AddBefore.Click += funcDataMenu_AddBefore;
|
|
||||||
mDataGrid.Click += funcDataMenu_Click;
|
mDataGrid.Click += funcDataMenu_Click;
|
||||||
|
mDataGrid.NewOperation += funcDataMenu_NewOperation;
|
||||||
|
|
||||||
mSlider.ValueChanged += sliderValueChanged;
|
mSlider.ValueChanged += sliderValueChanged;
|
||||||
|
|
||||||
@ -52,15 +46,8 @@ namespace BallanceTASEditor.UI {
|
|||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
mDataGrid.DataSources = null;
|
mDataGrid.DataSources = null;
|
||||||
|
|
||||||
mDataGrid.uiDataMenu_Set.Click -= funcDataMenu_Set;
|
|
||||||
mDataGrid.uiDataMenu_Unset.Click -= funcDataMenu_Unset;
|
|
||||||
mDataGrid.uiDataMenu_Copy.Click -= funcDataMenu_Copy;
|
|
||||||
mDataGrid.uiDataMenu_Delete.Click -= funcDataMenu_Delete;
|
|
||||||
mDataGrid.uiDataMenu_PasteAfter.Click -= funcDataMenu_PasteAfter;
|
|
||||||
mDataGrid.uiDataMenu_PasteBefore.Click -= funcDataMenu_PasteBefore;
|
|
||||||
mDataGrid.uiDataMenu_AddAfter.Click -= funcDataMenu_AddAfter;
|
|
||||||
mDataGrid.uiDataMenu_AddBefore.Click -= funcDataMenu_AddBefore;
|
|
||||||
mDataGrid.Click -= funcDataMenu_Click;
|
mDataGrid.Click -= funcDataMenu_Click;
|
||||||
|
mDataGrid.NewOperation -= funcDataMenu_NewOperation;
|
||||||
|
|
||||||
mSlider.ValueChanged -= sliderValueChanged;
|
mSlider.ValueChanged -= sliderValueChanged;
|
||||||
}
|
}
|
||||||
@ -74,6 +61,7 @@ namespace BallanceTASEditor.UI {
|
|||||||
SelectionHelp mSelectionHelp;
|
SelectionHelp mSelectionHelp;
|
||||||
int mListLength;
|
int mListLength;
|
||||||
List<FrameDataDisplay> mDataSource;
|
List<FrameDataDisplay> mDataSource;
|
||||||
|
bool mOverwrittenPaste;
|
||||||
|
|
||||||
private void sliderValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) {
|
private void sliderValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) {
|
||||||
long pos = e.NewValue.ToInt64();
|
long pos = e.NewValue.ToInt64();
|
||||||
@ -123,6 +111,10 @@ namespace BallanceTASEditor.UI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ChangeOverwrittenMode(bool isOverwritten) {
|
||||||
|
mOverwrittenPaste = isOverwritten;
|
||||||
|
}
|
||||||
|
|
||||||
public void ChangeListLength(int newLen) {
|
public void ChangeListLength(int newLen) {
|
||||||
if (newLen < 5 || newLen > 30) return;
|
if (newLen < 5 || newLen > 30) return;
|
||||||
int offset = newLen - mListLength;
|
int offset = newLen - mListLength;
|
||||||
@ -163,71 +155,83 @@ namespace BallanceTASEditor.UI {
|
|||||||
return mListLength;
|
return mListLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region data menu
|
public void ProcessOperation(OperationEnum oper) {
|
||||||
|
switch (oper) {
|
||||||
private void funcDataMenu_AddBefore(object sender, RoutedEventArgs e) {
|
case OperationEnum.Set:
|
||||||
if (!DialogUtil.AddItemDialog(out int count, out float deltaTime)) return;
|
case OperationEnum.Unset: {
|
||||||
|
mFile.Set(mSelectionHelp.GetFieldRange(), mSelectionHelp.GetRange(), oper == OperationEnum.Set);
|
||||||
var pos = mSelectionHelp.GetPoint();
|
|
||||||
mFile.Add(pos, count, deltaTime, true);
|
|
||||||
mSelectionHelp.Reset();
|
|
||||||
updateSliderRange();
|
|
||||||
RefreshDisplay();
|
RefreshDisplay();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
private void funcDataMenu_AddAfter(object sender, RoutedEventArgs e) {
|
case OperationEnum.Copy: {
|
||||||
if (!DialogUtil.AddItemDialog(out int count, out float deltaTime)) return;
|
|
||||||
|
|
||||||
var pos = mSelectionHelp.GetPoint();
|
|
||||||
mFile.Add(pos, count, deltaTime, false);
|
|
||||||
mSelectionHelp.Reset();
|
|
||||||
updateSliderRange();
|
|
||||||
RefreshDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void funcDataMenu_PasteBefore(object sender, RoutedEventArgs e) {
|
|
||||||
var data = new LinkedList<FrameData>();
|
|
||||||
if (ClipboardUtil.GetFrameData(data)) {
|
|
||||||
mFile.Insert(mSelectionHelp.GetPoint(), data, true);
|
|
||||||
mSelectionHelp.Reset();
|
|
||||||
updateSliderRange();
|
|
||||||
RefreshDisplay();
|
|
||||||
} else MessageBox.Show("Fail to paste due to unknow reason or blank clipboard!");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void funcDataMenu_PasteAfter(object sender, RoutedEventArgs e) {
|
|
||||||
var data = new LinkedList<FrameData>();
|
|
||||||
if (ClipboardUtil.GetFrameData(data)) {
|
|
||||||
mFile.Insert(mSelectionHelp.GetPoint(), data, false);
|
|
||||||
mSelectionHelp.Reset();
|
|
||||||
updateSliderRange();
|
|
||||||
RefreshDisplay();
|
|
||||||
} else MessageBox.Show("Fail to paste due to unknow reason or blank clipboard!");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void funcDataMenu_Delete(object sender, RoutedEventArgs e) {
|
|
||||||
mFile.Remove(mSelectionHelp.GetRange());
|
|
||||||
mSelectionHelp.Reset();
|
|
||||||
updateSliderRange();
|
|
||||||
RefreshDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void funcDataMenu_Copy(object sender, RoutedEventArgs e) {
|
|
||||||
var data = new LinkedList<FrameData>();
|
var data = new LinkedList<FrameData>();
|
||||||
mFile.Copy(mSelectionHelp.GetRange(), data);
|
mFile.Copy(mSelectionHelp.GetRange(), data);
|
||||||
if (!ClipboardUtil.SetFrameData(data))
|
if (!ClipboardUtil.SetFrameData(data))
|
||||||
MessageBox.Show("Fail to copy due to unknow reason!");
|
MessageBox.Show("Fail to copy due to unknow reason!");
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
private void funcDataMenu_Unset(object sender, RoutedEventArgs e) {
|
case OperationEnum.PasteAfter:
|
||||||
mFile.Set(mSelectionHelp.GetFieldRange(), mSelectionHelp.GetRange(), false);
|
case OperationEnum.PasteBefore: {
|
||||||
|
var data = new LinkedList<FrameData>();
|
||||||
|
if (ClipboardUtil.GetFrameData(data)) {
|
||||||
|
mFile.Insert(mSelectionHelp.GetPoint(), data, oper == OperationEnum.PasteBefore, mOverwrittenPaste);
|
||||||
|
mSelectionHelp.Reset();
|
||||||
|
updateSliderRange();
|
||||||
|
RefreshDisplay();
|
||||||
|
} else MessageBox.Show("Fail to paste due to unknow reason or blank clipboard!");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OperationEnum.Delete: {
|
||||||
|
mFile.Remove(mSelectionHelp.GetRange());
|
||||||
|
mSelectionHelp.Reset();
|
||||||
|
updateSliderRange();
|
||||||
RefreshDisplay();
|
RefreshDisplay();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case OperationEnum.DeleteAfter:
|
||||||
|
case OperationEnum.DeleteBefore: {
|
||||||
|
var pos = mSelectionHelp.GetPoint();
|
||||||
|
pos += oper == OperationEnum.DeleteBefore ? -1 : 1;
|
||||||
|
if (pos < 0 || pos > mFile.mFrameCount) return;
|
||||||
|
mFile.Remove(new SelectionRange(pos, pos));
|
||||||
|
|
||||||
private void funcDataMenu_Set(object sender, RoutedEventArgs e) {
|
// only delete before need shift selection
|
||||||
mFile.Set(mSelectionHelp.GetFieldRange(), mSelectionHelp.GetRange(), true);
|
if (oper == OperationEnum.DeleteBefore)
|
||||||
|
mSelectionHelp.ShiftTo(false);
|
||||||
|
|
||||||
|
updateSliderRange();
|
||||||
RefreshDisplay();
|
RefreshDisplay();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case OperationEnum.AddAfter:
|
||||||
|
case OperationEnum.AddBefore: {
|
||||||
|
if (!DialogUtil.AddItemDialog(out int count, out float deltaTime)) return;
|
||||||
|
|
||||||
|
var pos = mSelectionHelp.GetPoint();
|
||||||
|
mFile.Add(pos, count, deltaTime, oper == OperationEnum.AddBefore);
|
||||||
|
mSelectionHelp.Reset();
|
||||||
|
updateSliderRange();
|
||||||
|
RefreshDisplay();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OperationEnum.Undo: {
|
||||||
|
mFile.Undo();
|
||||||
|
mSelectionHelp.Reset();
|
||||||
|
updateSliderRange();
|
||||||
|
RefreshDisplay();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OperationEnum.Redo: {
|
||||||
|
mFile.Redo();
|
||||||
|
mSelectionHelp.Reset();
|
||||||
|
updateSliderRange();
|
||||||
|
RefreshDisplay();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region data menu
|
||||||
|
|
||||||
private void funcDataMenu_Click() {
|
private void funcDataMenu_Click() {
|
||||||
var data = mSelectionHelp.GetPoint();
|
var data = mSelectionHelp.GetPoint();
|
||||||
@ -236,6 +240,10 @@ namespace BallanceTASEditor.UI {
|
|||||||
RefreshDisplay();
|
RefreshDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void funcDataMenu_NewOperation(OperationEnum obj) {
|
||||||
|
ProcessOperation(obj);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user