From 3d30bd082e0b732a670ee9af1c2d4fc8eed0f86e Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 25 Oct 2014 14:10:32 +0000 Subject: [PATCH] InputRoll - slight tweak to the SelectedIndexChanged event logic --- BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs | 8 ++++++++ .../tools/TAStudio/MarkerControl.cs | 13 ++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs index 50fb8f9c17..9984409560 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs @@ -1316,8 +1316,16 @@ namespace BizHawk.Client.EmuHawk } else { + var hadIndex = SelectedItems.Any(); SelectedItems.Clear(); SelectCell(CurrentCell); + + // In this case the SelectCell did not invoke the change event since there was nothing to select + // But we went from selected to unselected, that is a change, so catch it here + if (hadIndex && CurrentCell.RowIndex.HasValue && CurrentCell.RowIndex > RowCount) + { + SelectedIndexChanged(this, new EventArgs()); + } } Refresh(); diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs index 42b691fd65..5f7c952d3e 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs @@ -113,7 +113,7 @@ namespace BizHawk.Client.EmuHawk private void MarkerView_SelectedIndexChanged(object sender, EventArgs e) { - RemoveBtn.Enabled = SelectedIndices.Any(i => i < Tastudio.CurrentTasMovie.Markers.Count); + RemoveBtn.Enabled = MarkerView.SelectedRows.Any(i => i < Tastudio.CurrentTasMovie.Markers.Count); } private void RemoveBtn_Click(object sender, EventArgs e) @@ -123,20 +123,11 @@ namespace BizHawk.Client.EmuHawk MarkerView_SelectedIndexChanged(sender, e); } - private IEnumerable SelectedIndices - { - get - { - return MarkerView.SelectedRows - .OfType(); - } - } - private List SelectedMarkers { get { - return SelectedIndices + return MarkerView.SelectedRows .Select(index => Tastudio.CurrentTasMovie.Markers[index]) .ToList(); }