InputRoll - convert SelectedRows from IList to IEnumerable

This commit is contained in:
adelikat 2014-10-13 18:28:29 +00:00
parent 79f36198e9
commit 0b8c9f3db1
3 changed files with 10 additions and 11 deletions

View File

@ -50,14 +50,14 @@ namespace BizHawk.Client.EmuHawk
using (var g = CreateGraphics())
using (var LCK = Gdi.LockGraphics(g))
{
_charSize = Gdi.MeasureString("A", this.Font);//TODO make this a property so changing it updates other values.
_charSize = Gdi.MeasureString("A", this.Font); // TODO make this a property so changing it updates other values.
}
UpdateCellSize();
ColumnWidth = CellWidth;
ColumnHeight = CellHeight + 2;
//TODO Figure out how to use the width and height properties of the scrollbars instead of 17
// TODO Figure out how to use the width and height properties of the scrollbars instead of 17
VBar = new VScrollBar
{
Location = new Point(Width - 17, 0),
@ -506,18 +506,16 @@ namespace BizHawk.Client.EmuHawk
}
}
// TODO: make IEnumerable, IList is for legacy support
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
public IList<int> SelectedRows
public IEnumerable<int> SelectedRows
{
get
{
return SelectedItems
.Where(cell => cell.RowIndex.HasValue)
.Select(cell => cell.RowIndex.Value)
.Distinct()
.ToList();
.Distinct();
}
}

View File

@ -277,7 +277,7 @@ namespace BizHawk.Client.EmuHawk
{
var frame = TasView.CurrentCell.RowIndex.Value;
var buttonName = TasView.CurrentCell.Column.Name;
if (TasView.SelectedRows.IndexOf(frame) != -1 && (buttonName == MarkerColumnName || buttonName == FrameColumnName))
if (TasView.SelectedRows.ToList().IndexOf(frame) != -1 && (buttonName == MarkerColumnName || buttonName == FrameColumnName))
{
RightClickMenu.Show(TasView, e.X, e.Y);
}

View File

@ -450,13 +450,13 @@ namespace BizHawk.Client.EmuHawk
var list = TasView.SelectedRows;
string message = "Selected: ";
if (list.Count > 0)
if (list.Any())
{
message += list.Count + " rows 0 col, Clipboard: ";
message += list.Count() + " rows 0 col, Clipboard: ";
}
else
{
message += list.Count + " none, Clipboard: ";
message += list.Count() + " none, Clipboard: ";
}
message += _tasClipboard.Any() ? _tasClipboard.Count.ToString() + " rows 0 col": "empty";
@ -698,8 +698,9 @@ namespace BizHawk.Client.EmuHawk
if (TasView.SelectedRows.Any())
{
_tasClipboard.Clear();
var list = TasView.SelectedRows;
var list = TasView.SelectedRows.ToList();
var sb = new StringBuilder();
for (var i = 0; i < list.Count; i++)
{
var input = _currentTasMovie.GetInputState(list[i]);