TAStudio - Fix InputRoll background callback logic, fix marker list background drawing logic

This commit is contained in:
adelikat 2014-08-29 00:04:42 +00:00
parent d38ca10cf6
commit a86897e5ba
3 changed files with 28 additions and 15 deletions

View File

@ -743,12 +743,21 @@ namespace BizHawk.Client.EmuHawk
{
if (HorizontalOrientation)
{
for (int i = 0; i < VisibleRows; i++)
int startIndex = NeedsHScrollbar ? HBar.Value : 0;
int endIndex = startIndex + (Width / CellWidth);
if (endIndex >= ItemCount)
{
endIndex = ItemCount;
}
int range = endIndex - startIndex;
for (int i = 0; i < range; i++)
{
for (int j = 0; j < _columns.Count; j++)
{
Color color = Color.White;
QueryItemBkColor(i, j, ref color);
QueryItemBkColor(i + startIndex, j, ref color);
// TODO: refactor to use DrawCellBG
if (color != Color.White) // An easy optimization, don't draw unless the user specified something other than the default
@ -765,19 +774,29 @@ namespace BizHawk.Client.EmuHawk
}
else
{
for (int i = 1; i < VisibleRows; i++)
int startIndex = NeedsVScrollbar ? VBar.Value : 0;
int endIndex = startIndex + (Height / CellHeight);
if (endIndex >= ItemCount)
{
endIndex = ItemCount;
}
int range = endIndex - startIndex;
for (int i = 0; i < range; i++)
{
int x = 1;
for (int j = 0; j < _columns.Count; j++)
{
Color color = Color.White;
QueryItemBkColor(i, j, ref color);
QueryItemBkColor(i + startIndex, j, ref color);
var width = CalcWidth(_columns[j]);
if (color != Color.White) // An easy optimization, don't draw unless the user specified something other than the default
{
Gdi.SetBrush(color);
Gdi.FillRectangle(x, (i * CellHeight) + 2, width - 1, CellHeight - 1);
Gdi.FillRectangle(x, ((i + 1) * CellHeight) + 2, width - 1, CellHeight - 1);
}
x += width;

View File

@ -44,12 +44,6 @@ namespace BizHawk.Client.EmuHawk
}
public void UpdateValues()
{
MarkerView.ItemCount = Tastudio.CurrentMovie.Markers.Count;
MarkerView.Refresh();
}
private void MarkerView_QueryItemBkColor(int index, int column, ref Color color)
{
var prev = Markers.PreviousOrCurrent(Global.Emulator.Frame);
@ -100,14 +94,14 @@ namespace BizHawk.Client.EmuHawk
MarkerView_SelectedIndexChanged(sender, e);
}
public new void Refresh()
public void UpdateValues()
{
if (MarkerView != null && Markers != null)
{
MarkerView.ItemCount = Markers.Count;
}
base.Refresh();
MarkerView.Refresh();
}
private void MarkerView_SelectedIndexChanged(object sender, EventArgs e)

View File

@ -157,7 +157,7 @@ namespace BizHawk.Client.EmuHawk
if (MarkerControl != null)
{
MarkerControl.Refresh();
MarkerControl.UpdateValues();
}
}
@ -385,7 +385,7 @@ namespace BizHawk.Client.EmuHawk
if (result == DialogResult.OK)
{
_currentTasMovie.Markers.Add(markerFrame, i.PromptText);
MarkerControl.Refresh();
MarkerControl.UpdateValues();
}
}