tastudio: MarkerView.ShrinkSelection()

This commit is contained in:
vadosnaprimer 2018-01-10 22:06:10 +03:00
parent 5bff769fe9
commit d074880242
2 changed files with 20 additions and 2 deletions

View File

@ -150,11 +150,28 @@ namespace BizHawk.Client.EmuHawk
if (MarkerView.AnyRowsSelected)
{
SelectedMarkers.ForEach(i => Markers.Remove(i));
ShrinkSelection();
Tastudio.RefreshDialog();
MarkerView_SelectedIndexChanged(null, null);
}
}
// feos: not the same as InputRoll.TruncateSelection(), since multiple selection of markers is forbidden
// moreover, when the last marker is removed, we need its selection to move to the previous marker
// still iterate, so things don't break if multiple selection is allowed someday
public void ShrinkSelection()
{
if (MarkerView.AnyRowsSelected)
{
while (MarkerView.SelectedRows.Last() > Markers.Count() - 1)
{
MarkerView.SelectRow(Markers.Count(), false);
MarkerView.SelectRow(Markers.Count() - 1, true);
}
}
}
public void AddMarker(bool editText = false, int? frame = null)
{
// feos: we specify the selected frame if we call this from TasView, otherwise marker should be added to the emulated frame
@ -252,7 +269,8 @@ namespace BizHawk.Client.EmuHawk
{
get
{
return MarkerView.SelectedRows
return MarkerView
.SelectedRows
.Select(index => Markers[index])
.ToList();
}

View File

@ -742,7 +742,7 @@ namespace BizHawk.Client.EmuHawk
{
CurrentTasMovie.Markers.Remove(m);
}
MarkerControl.ShrinkSelection();
RefreshDialog();
}