Allow multiple marker selection, and multiple marker deletion, also dejunkify some hack workarounds that aren't needed anymore, and fix focus issues on input roll

This commit is contained in:
adelikat 2020-08-07 21:02:07 -05:00
parent 05c5148610
commit b101df8235
4 changed files with 9 additions and 23 deletions

View File

@ -85,6 +85,10 @@ namespace BizHawk.Client.EmuHawk
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
// Deep in the bowels of winform documentation we discover these are necessary if you want your control to be able to have focus
SetStyle(ControlStyles.Selectable, true);
SetStyle(ControlStyles.UserMouse, true);
_renderer = new GdiPlusRenderer(Font);
UpdateCellSize();

View File

@ -176,7 +176,7 @@
this.MarkerView.LagFramesToHide = 0;
this.MarkerView.LetKeysModifySelection = false;
this.MarkerView.Location = new System.Drawing.Point(6, 19);
this.MarkerView.MultiSelect = false;
this.MarkerView.MultiSelect = true;
this.MarkerView.Name = "MarkerView";
this.MarkerView.RowCount = 0;
this.MarkerView.ScrollSpeed = 1;
@ -185,7 +185,6 @@
this.MarkerView.TabIndex = 0;
this.MarkerView.TabStop = false;
this.MarkerView.SelectedIndexChanged += new System.EventHandler(this.MarkerView_SelectedIndexChanged);
this.MarkerView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.MarkerView_MouseClick);
this.MarkerView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.MarkerView_MouseDoubleClick);
//
// MarkersGroupBox

View File

@ -167,26 +167,14 @@ namespace BizHawk.Client.EmuHawk
if (MarkerView.AnyRowsSelected)
{
SelectedMarkers.ForEach(i => Markers.Remove(i));
ShrinkSelection();
MarkerView.RowCount = Markers.Count;
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()
public void UpdateMarkerCount()
{
if (MarkerView.AnyRowsSelected)
{
while (MarkerView.SelectedRows.Last() > Markers.Count - 1)
{
MarkerView.SelectRow(Markers.Count, false);
MarkerView.SelectRow(Markers.Count - 1, true);
}
}
MarkerView.RowCount = Markers.Count;
}
public void AddMarker(bool editText = false, int? frame = null)
@ -327,10 +315,5 @@ namespace BizHawk.Client.EmuHawk
return -1;
}
private void MarkerView_MouseClick(object sender, MouseEventArgs e)
{
MarkerContextMenu.Close();
}
}
}

View File

@ -739,7 +739,7 @@ namespace BizHawk.Client.EmuHawk
private void RemoveMarkersMenuItem_Click(object sender, EventArgs e)
{
CurrentTasMovie.Markers.RemoveAll(m => TasView.SelectedRows.Contains(m.Frame));
MarkerControl.ShrinkSelection();
MarkerControl.UpdateMarkerCount();
RefreshDialog();
}