cleanups in Bookmarks and Marker Controls
This commit is contained in:
parent
9a54a461b5
commit
ea6b67ac39
|
@ -30,25 +30,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public Action<int> LoadedCallback { get; set; }
|
public Action<int> LoadedCallback { get; set; }
|
||||||
|
|
||||||
private void CallLoadedCallback(int index)
|
|
||||||
{
|
|
||||||
LoadedCallback?.Invoke(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action<int> SavedCallback { get; set; }
|
public Action<int> SavedCallback { get; set; }
|
||||||
|
|
||||||
private void CallSavedCallback(int index)
|
|
||||||
{
|
|
||||||
SavedCallback?.Invoke(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action<int> RemovedCallback { get; set; }
|
public Action<int> RemovedCallback { get; set; }
|
||||||
|
|
||||||
private void CallRemovedCallback(int index)
|
|
||||||
{
|
|
||||||
RemovedCallback?.Invoke(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TAStudio Tastudio { get; set; }
|
public TAStudio Tastudio { get; set; }
|
||||||
|
|
||||||
public int HoverInterval
|
public int HoverInterval
|
||||||
|
@ -234,7 +219,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private void AddBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
private void AddBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Branch();
|
Branch();
|
||||||
CallSavedCallback(Movie.Branches.Count - 1);
|
SavedCallback?.Invoke(Movie.Branches.Count - 1);
|
||||||
GlobalWin.OSD.AddMessage($"Added branch {Movie.CurrentBranch}");
|
GlobalWin.OSD.AddMessage($"Added branch {Movie.CurrentBranch}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +227,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
Branch();
|
Branch();
|
||||||
EditBranchTextPopUp(Movie.CurrentBranch);
|
EditBranchTextPopUp(Movie.CurrentBranch);
|
||||||
CallSavedCallback(Movie.Branches.Count - 1);
|
SavedCallback?.Invoke(Movie.Branches.Count - 1);
|
||||||
GlobalWin.OSD.AddMessage($"Added branch {Movie.CurrentBranch}");
|
GlobalWin.OSD.AddMessage($"Added branch {Movie.CurrentBranch}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,14 +250,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (BranchView.AnyRowsSelected)
|
if (BranchView.AnyRowsSelected)
|
||||||
{
|
{
|
||||||
LoadSelectedBranch();
|
LoadSelectedBranch();
|
||||||
CallLoadedCallback(BranchView.SelectedRows.First());
|
LoadedCallback?.Invoke(BranchView.SelectedRows.First());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
private void UpdateBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (SelectedBranch != null)
|
if (SelectedBranch == null)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Movie.CurrentBranch = BranchView.SelectedRows.First();
|
Movie.CurrentBranch = BranchView.SelectedRows.First();
|
||||||
|
|
||||||
_backupBranch = SelectedBranch.Clone();
|
_backupBranch = SelectedBranch.Clone();
|
||||||
|
@ -282,15 +270,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_branchUndo = BranchUndo.Update;
|
_branchUndo = BranchUndo.Update;
|
||||||
|
|
||||||
UpdateBranch(SelectedBranch);
|
UpdateBranch(SelectedBranch);
|
||||||
CallSavedCallback(Movie.CurrentBranch);
|
SavedCallback?.Invoke(Movie.CurrentBranch);
|
||||||
GlobalWin.OSD.AddMessage($"Saved branch {Movie.CurrentBranch}");
|
GlobalWin.OSD.AddMessage($"Saved branch {Movie.CurrentBranch}");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void EditBranchTextToolStripMenuItem_Click(object sender, EventArgs e)
|
private void EditBranchTextToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (SelectedBranch != null)
|
if (SelectedBranch == null)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int index = BranchView.SelectedRows.First();
|
int index = BranchView.SelectedRows.First();
|
||||||
string oldText = SelectedBranch.UserText;
|
string oldText = SelectedBranch.UserText;
|
||||||
|
|
||||||
|
@ -306,22 +296,26 @@ namespace BizHawk.Client.EmuHawk
|
||||||
GlobalWin.OSD.AddMessage($"Edited branch {index}");
|
GlobalWin.OSD.AddMessage($"Edited branch {index}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void JumpToBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
private void JumpToBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (SelectedBranch != null)
|
if (SelectedBranch == null)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int index = BranchView.SelectedRows.First();
|
int index = BranchView.SelectedRows.First();
|
||||||
TasBranch branch = Movie.GetBranch(index);
|
TasBranch branch = Movie.GetBranch(index);
|
||||||
Tastudio.GoToFrame(branch.Frame);
|
Tastudio.GoToFrame(branch.Frame);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void RemoveBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
private void RemoveBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (SelectedBranch != null)
|
if (SelectedBranch == null)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int index = BranchView.SelectedRows.First();
|
int index = BranchView.SelectedRows.First();
|
||||||
if (index == Movie.CurrentBranch)
|
if (index == Movie.CurrentBranch)
|
||||||
{
|
{
|
||||||
|
@ -347,24 +341,23 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Select(Movie.Branches.Count - 1, true);
|
Select(Movie.Branches.Count - 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
CallRemovedCallback(index);
|
RemovedCallback?.Invoke(index);
|
||||||
Tastudio.RefreshDialog();
|
Tastudio.RefreshDialog();
|
||||||
GlobalWin.OSD.AddMessage($"Removed branch {index}");
|
GlobalWin.OSD.AddMessage($"Removed branch {index}");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void UndoBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
private void UndoBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_branchUndo == BranchUndo.Load)
|
if (_branchUndo == BranchUndo.Load)
|
||||||
{
|
{
|
||||||
LoadBranch(_backupBranch);
|
LoadBranch(_backupBranch);
|
||||||
CallLoadedCallback(Movie.Branches.IndexOf(_backupBranch));
|
LoadedCallback?.Invoke(Movie.Branches.IndexOf(_backupBranch));
|
||||||
GlobalWin.OSD.AddMessage("Branch Load canceled");
|
GlobalWin.OSD.AddMessage("Branch Load canceled");
|
||||||
}
|
}
|
||||||
else if (_branchUndo == BranchUndo.Update)
|
else if (_branchUndo == BranchUndo.Update)
|
||||||
{
|
{
|
||||||
Movie.UpdateBranch(Movie.GetBranch(_backupBranch.UniqueIdentifier), _backupBranch);
|
Movie.UpdateBranch(Movie.GetBranch(_backupBranch.UniqueIdentifier), _backupBranch);
|
||||||
CallSavedCallback(Movie.Branches.IndexOf(_backupBranch));
|
SavedCallback?.Invoke(Movie.Branches.IndexOf(_backupBranch));
|
||||||
GlobalWin.OSD.AddMessage("Branch Update canceled");
|
GlobalWin.OSD.AddMessage("Branch Update canceled");
|
||||||
}
|
}
|
||||||
else if (_branchUndo == BranchUndo.Text)
|
else if (_branchUndo == BranchUndo.Text)
|
||||||
|
@ -376,7 +369,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
Movie.AddBranch(_backupBranch);
|
Movie.AddBranch(_backupBranch);
|
||||||
BranchView.RowCount = Movie.Branches.Count;
|
BranchView.RowCount = Movie.Branches.Count;
|
||||||
CallSavedCallback(Movie.Branches.IndexOf(_backupBranch));
|
SavedCallback?.Invoke(Movie.Branches.IndexOf(_backupBranch));
|
||||||
GlobalWin.OSD.AddMessage("Branch Removal canceled");
|
GlobalWin.OSD.AddMessage("Branch Removal canceled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,7 +636,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void BranchView_CellDropped(object sender, InputRoll.CellEventArgs e)
|
private void BranchView_CellDropped(object sender, InputRoll.CellEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.NewCell != null && e.NewCell.IsDataCell && e.OldCell.RowIndex.Value < Movie.Branches.Count)
|
if (e.NewCell != null && e.NewCell.IsDataCell && e.OldCell.RowIndex < Movie.Branches.Count)
|
||||||
{
|
{
|
||||||
var guid = Movie.BranchGuidByIndex(Movie.CurrentBranch);
|
var guid = Movie.BranchGuidByIndex(Movie.CurrentBranch);
|
||||||
Movie.SwapBranches(e.OldCell.RowIndex.Value, e.NewCell.RowIndex.Value);
|
Movie.SwapBranches(e.OldCell.RowIndex.Value, e.NewCell.RowIndex.Value);
|
||||||
|
@ -673,7 +666,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
_screenshot.UpdateValues(branch, location, width, height,
|
_screenshot.UpdateValues(branch, location, width, height,
|
||||||
(int)Graphics.FromHwnd(this.Handle).MeasureString(
|
(int)Graphics.FromHwnd(Handle).MeasureString(
|
||||||
branch.UserText, _screenshot.Font, width).Height);
|
branch.UserText, _screenshot.Font, width).Height);
|
||||||
|
|
||||||
_screenshot.FadeIn();
|
_screenshot.FadeIn();
|
||||||
|
|
|
@ -238,7 +238,6 @@
|
||||||
this.Controls.Add(this.MarkersGroupBox);
|
this.Controls.Add(this.MarkersGroupBox);
|
||||||
this.Name = "MarkerControl";
|
this.Name = "MarkerControl";
|
||||||
this.Size = new System.Drawing.Size(198, 278);
|
this.Size = new System.Drawing.Size(198, 278);
|
||||||
this.Load += new System.EventHandler(this.MarkerControl_Load);
|
|
||||||
this.MarkerContextMenu.ResumeLayout(false);
|
this.MarkerContextMenu.ResumeLayout(false);
|
||||||
this.MarkersGroupBox.ResumeLayout(false);
|
this.MarkersGroupBox.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
|
@ -39,10 +39,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
MarkerView.QueryItemText += MarkerView_QueryItemText;
|
MarkerView.QueryItemText += MarkerView_QueryItemText;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MarkerControl_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public InputRoll MarkerInputRoll => MarkerView;
|
public InputRoll MarkerInputRoll => MarkerView;
|
||||||
|
|
||||||
private void MarkerView_QueryItemBkColor(int index, RollColumn column, ref Color color)
|
private void MarkerView_QueryItemBkColor(int index, RollColumn column, ref Color color)
|
||||||
|
@ -259,16 +255,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
MarkerInputRoll.AnyRowsSelected;
|
MarkerInputRoll.AnyRowsSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TasMovieMarker> SelectedMarkers
|
private List<TasMovieMarker> SelectedMarkers => MarkerView
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return MarkerView
|
|
||||||
.SelectedRows
|
.SelectedRows
|
||||||
.Select(index => Markers[index])
|
.Select(index => Markers[index])
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// SuuperW: Marker renaming can be done with a right-click.
|
// SuuperW: Marker renaming can be done with a right-click.
|
||||||
// A much more useful feature would be to easily jump to it.
|
// A much more useful feature would be to easily jump to it.
|
||||||
|
|
Loading…
Reference in New Issue