Input Roll - various things

This commit is contained in:
adelikat 2014-08-19 00:37:38 +00:00
parent 1e64adb6af
commit d04d32d647
2 changed files with 83 additions and 44 deletions

View File

@ -58,6 +58,10 @@ namespace BizHawk.Client.EmuHawk
this.Controls.Add(VBar); this.Controls.Add(VBar);
this.Controls.Add(HBar); this.Controls.Add(HBar);
VBar.ValueChanged += VerticalBar_ValueChanged;
HBar.ValueChanged += HorizontalBar_ValueChanged;
RecalculateScrollBars(); RecalculateScrollBars();
Columns.ChangedCallback = ColumnChangedCallback; Columns.ChangedCallback = ColumnChangedCallback;
} }
@ -342,7 +346,12 @@ namespace BizHawk.Client.EmuHawk
{ {
if (HorizontalOrientation) if (HorizontalOrientation)
{ {
var visibleRows = (Width - _horizontalOrientedColumnWidth) / CellWidth; var visibleRows = ((Width - _horizontalOrientedColumnWidth) / CellWidth) + 1;
if (visibleRows >= ItemCount)
{
visibleRows = ItemCount;
}
Gdi.PrepDrawString(this.Font, this.ForeColor); Gdi.PrepDrawString(this.Font, this.ForeColor);
for (int i = 0; i < visibleRows; i++) for (int i = 0; i < visibleRows; i++)
{ {
@ -359,7 +368,12 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
var visibleRows = (Height / CellHeight) - 1; var visibleRows = (Height / CellHeight);
if (visibleRows >= ItemCount)
{
visibleRows = ItemCount;
}
Gdi.PrepDrawString(this.Font, this.ForeColor); Gdi.PrepDrawString(this.Font, this.ForeColor);
for (int i = 1; i < visibleRows; i++) for (int i = 1; i < visibleRows; i++)
{ {
@ -449,7 +463,6 @@ namespace BizHawk.Client.EmuHawk
Gdi.SetBrush(Color.White); Gdi.SetBrush(Color.White);
Gdi.SetSolidPen(Color.Black); Gdi.SetSolidPen(Color.Black);
Gdi.DrawRectangle(startPoint.X, startPoint.Y, Width, Height); Gdi.DrawRectangle(startPoint.X, startPoint.Y, Width, Height);
Gdi.SetSolidPen(SystemColors.ControlLight); Gdi.SetSolidPen(SystemColors.ControlLight);
@ -459,7 +472,13 @@ namespace BizHawk.Client.EmuHawk
for (int i = 1; i < Width / CellWidth; i++) for (int i = 1; i < Width / CellWidth; i++)
{ {
var x = _horizontalOrientedColumnWidth + 1 + (i * CellWidth); var x = _horizontalOrientedColumnWidth + 1 + (i * CellWidth);
Gdi.Line(x, 1, x, Columns.Count * CellHeight); var y2 = (Columns.Count * CellHeight) - 1;
if (y2 > Height)
{
y2 = Height - 2;
}
Gdi.Line(x, 1, x, y2);
} }
// Rows // Rows
@ -480,7 +499,7 @@ namespace BizHawk.Client.EmuHawk
} }
// Rows // Rows
for (int i = 2; i < Height / CellHeight; i++) for (int i = 2; i < (Height / CellHeight) + 1; i++)
{ {
Gdi.Line(1, (i * CellHeight) + 1, Width - 2, (i * CellHeight) + 1); Gdi.Line(1, (i * CellHeight) + 1, Width - 2, (i * CellHeight) + 1);
} }
@ -495,7 +514,6 @@ namespace BizHawk.Client.EmuHawk
{ {
DoSelectionBG(e); DoSelectionBG(e);
} }
} }
private void DoSelectionBG(PaintEventArgs e) private void DoSelectionBG(PaintEventArgs e)
@ -686,6 +704,16 @@ namespace BizHawk.Client.EmuHawk
#region Helpers #region Helpers
private void VerticalBar_ValueChanged(object sender, EventArgs e)
{
Refresh();
}
private void HorizontalBar_ValueChanged(object sender, EventArgs e)
{
Refresh();
}
private void ColumnChangedCallback() private void ColumnChangedCallback()
{ {
RecalculateScrollBars(); RecalculateScrollBars();
@ -698,11 +726,11 @@ namespace BizHawk.Client.EmuHawk
VBar.Visible = true; VBar.Visible = true;
if (HorizontalOrientation) if (HorizontalOrientation)
{ {
VBar.Maximum = (Columns.Count * CellHeight) - Height; VBar.Maximum = ((Columns.Count * CellHeight) - Height) / CellHeight;
} }
else else
{ {
VBar.Maximum = (ItemCount * CellHeight) - Height; VBar.Maximum = ((ItemCount * CellHeight) - Height) / CellHeight;
} }
} }
else else
@ -715,11 +743,11 @@ namespace BizHawk.Client.EmuHawk
HBar.Visible = true; HBar.Visible = true;
if (HorizontalOrientation) if (HorizontalOrientation)
{ {
HBar.Maximum = (ItemCount * CellHeight) - Height; HBar.Maximum = (Columns.Sum(c => CalcWidth(c)) - Width) / CellWidth;
} }
else else
{ {
HBar.Maximum = (Columns.Count * CellHeight) - Height; HBar.Maximum = ((ItemCount * CellWidth) - Width) / CellWidth;
} }
} }
else else

View File

@ -67,6 +67,8 @@ namespace BizHawk.Client.EmuHawk
private void TasView_QueryItemText(int index, int column, out string text) private void TasView_QueryItemText(int index, int column, out string text)
{ {
text = ""; text = "";
/*
if (columnClicked.HasValue && column == columnClicked) if (columnClicked.HasValue && column == columnClicked)
{ {
text = "!"; text = "!";
@ -78,7 +80,7 @@ namespace BizHawk.Client.EmuHawk
text = r.NextDouble() > .5 ? "_" : ""; text = r.NextDouble() > .5 ? "_" : "";
} }
/*
text = string.Empty; text = string.Empty;
if (index >= Watches.ItemCount || Watches[index].IsSeparator) if (index >= Watches.ItemCount || Watches[index].IsSeparator)
@ -87,36 +89,42 @@ namespace BizHawk.Client.EmuHawk
} }
//var columnName = InputView.Columns[column].Name; //var columnName = InputView.Columns[column].Name;
switch (column)
{
case 0:
text = Watches[index].AddressString;
break;
case 1:
text = Watches[index].ValueString;
break;
case 2:
text = Watches[index].PreviousStr;
break;
case 3:
if (!Watches[index].IsSeparator)
{
text = Watches[index].ChangeCount.ToString();
}
break;
case 4:
text = Watches[index].Diff;
break;
case 5:
text = Watches[index].Domain.Name;
break;
case 6:
text = Watches[index].Notes;
break;
}
*/ */
try
{
switch (column)
{
case 0:
text = Watches[index].AddressString;
break;
case 1:
text = Watches[index].ValueString;
break;
case 2:
text = Watches[index].PreviousStr;
break;
case 3:
if (!Watches[index].IsSeparator)
{
text = Watches[index].ChangeCount.ToString();
}
break;
case 4:
text = Watches[index].Diff;
break;
case 5:
text = Watches[index].Domain.Name;
break;
case 6:
text = Watches[index].Notes;
break;
}
}
catch (Exception ex)
{
var message = ex.Message;
}
} }
private void TasView_QueryItemBkColor(int index, int column, ref Color color) private void TasView_QueryItemBkColor(int index, int column, ref Color color)
@ -129,12 +137,14 @@ namespace BizHawk.Client.EmuHawk
private void TasStudioExperiment_Load(object sender, EventArgs e) private void TasStudioExperiment_Load(object sender, EventArgs e)
{ {
/*
for (int i = 0; i < 20; i++) for (int i = 0; i < 10; i++)
{ {
Watches.Add(new ByteWatch(Watches.Domain, 0x0057, Watch.DisplayType.Signed, false, "Speed")); Watches.Add(new ByteWatch(Watches.Domain, i, Watch.DisplayType.Signed, false, "Speed"));
} }
InputView.ItemCount = Watches.Count;
InputView.AddColumns(new[] InputView.AddColumns(new[]
{ {
new InputRoll.RollColumn new InputRoll.RollColumn
@ -180,8 +190,8 @@ namespace BizHawk.Client.EmuHawk
Text = "Notes" Text = "Notes"
}, },
}); });
*/
/*
InputView.AddColumns(new [] InputView.AddColumns(new []
{ {
new InputRoll.RollColumn new InputRoll.RollColumn
@ -257,6 +267,7 @@ namespace BizHawk.Client.EmuHawk
}); });
InputView.ItemCount = 20; InputView.ItemCount = 20;
*/
} }
private void settingsToolStripMenuItem_DropDownOpened(object sender, EventArgs e) private void settingsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)