TAStudio - anchor icons on frames with savestates, proof of concept. InputRoll - add offsetx,y values to queryItemIcon and queryItemText, also support ability to draw icons and text in the same cell
This commit is contained in:
parent
109ee3981b
commit
2a1c9e8602
|
@ -1639,6 +1639,7 @@
|
|||
<None Include="config\ControllerImages\GENController.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="images\tastudio\anchor.png" />
|
||||
<None Include="Resources\HawkInLove.png" />
|
||||
<None Include="images\Circle.png" />
|
||||
<None Include="images\Cross.png" />
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.0
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
@ -100,6 +100,16 @@ namespace BizHawk.Client.EmuHawk.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap anchor {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("anchor", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
|
|
@ -1497,4 +1497,7 @@
|
|||
<data name="BlankCursor" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\images\BlankCursor.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="anchor" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\images\tastudio\anchor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
Binary file not shown.
After Width: | Height: | Size: 233 B |
|
@ -73,7 +73,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private int CurrentBranch = -1;
|
||||
|
||||
private void QueryItemText(int index, InputRoll.RollColumn column, out string text)
|
||||
private void QueryItemText(int index, InputRoll.RollColumn column, out string text, ref int offsetX, ref int offsetY)
|
||||
{
|
||||
text = string.Empty;
|
||||
|
||||
|
|
|
@ -366,7 +366,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <summary>
|
||||
/// Retrieve the text for a cell
|
||||
/// </summary>
|
||||
public delegate void QueryItemTextHandler(int index, RollColumn column, out string text);
|
||||
public delegate void QueryItemTextHandler(int index, RollColumn column, out string text, ref int offsetX, ref int offsetY);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the background color for a cell
|
||||
|
@ -377,7 +377,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <summary>
|
||||
/// Retrive the image for a given cell
|
||||
/// </summary>
|
||||
public delegate void QueryItemIconHandler(int index, RollColumn column, ref Bitmap icon);
|
||||
public delegate void QueryItemIconHandler(int index, RollColumn column, ref Bitmap icon, ref int offsetX, ref int offsetY);
|
||||
|
||||
/// <summary>
|
||||
/// SuuperW: Check if a given frame is a lag frame
|
||||
|
@ -979,9 +979,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (DraggingCell != null)
|
||||
{
|
||||
var text = "";
|
||||
int offsetX = 0;
|
||||
int offsetY = 0;
|
||||
if (QueryItemText != null)
|
||||
{
|
||||
QueryItemText(DraggingCell.RowIndex.Value, DraggingCell.Column, out text);
|
||||
QueryItemText(DraggingCell.RowIndex.Value, DraggingCell.Column, out text, ref offsetX, ref offsetY);
|
||||
}
|
||||
|
||||
Color bgColor = this.BackColor;
|
||||
|
@ -999,7 +1001,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Gdi.SetBrush(bgColor);
|
||||
Gdi.FillRectangle(x1, y1, x2 - x1, y2 - y1);
|
||||
Gdi.PrepDrawString(this.NormalFont, this.ForeColor);
|
||||
Gdi.DrawString(text, new Point(x1 + CellWidthPadding, y1 + CellHeightPadding));
|
||||
Gdi.DrawString(text, new Point(x1 + CellWidthPadding + offsetX, y1 + CellHeightPadding + offsetY));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1079,25 +1081,31 @@ namespace BizHawk.Client.EmuHawk
|
|||
Bitmap image = null;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int bitmapOffsetX = 0;
|
||||
int bitmapOffsetY = 0;
|
||||
|
||||
if (QueryItemIcon != null)
|
||||
QueryItemIcon(f + startRow, columns[j], ref image);
|
||||
{
|
||||
QueryItemIcon(f + startRow, columns[j], ref image, ref bitmapOffsetX, ref bitmapOffsetY);
|
||||
}
|
||||
|
||||
if (image != null)
|
||||
{
|
||||
x = RowsToPixels(i) + CellWidthPadding;
|
||||
y = (j * CellHeight) + (CellHeightPadding * 2);
|
||||
x = RowsToPixels(i) + CellWidthPadding + bitmapOffsetX;
|
||||
y = (j * CellHeight) + (CellHeightPadding * 2) + bitmapOffsetY;
|
||||
Gdi.DrawBitmap(image, new Point(x, y), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
//else
|
||||
//{
|
||||
string text;
|
||||
QueryItemText(f + startRow, columns[j], out text);
|
||||
int strOffsetX = 0;
|
||||
int strOffsetY = 0;
|
||||
QueryItemText(f + startRow, columns[j], out text, ref strOffsetX, ref strOffsetY);
|
||||
|
||||
// Center Text
|
||||
x = RowsToPixels(i) + (CellWidth - text.Length * _charSize.Width) / 2;
|
||||
y = (j * CellHeight) + CellHeightPadding - VBar.Value;
|
||||
var point = new Point(x, y);
|
||||
var point = new Point(x + strOffsetX, y + strOffsetY);
|
||||
|
||||
var rePrep = false;
|
||||
if (SelectedItems.Contains(new Cell { Column = columns[j], RowIndex = i + startRow }))
|
||||
|
@ -1116,7 +1124,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
Gdi.PrepDrawString(this.NormalFont, this.ForeColor);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1136,21 +1144,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
RollColumn col = columns[j];
|
||||
|
||||
string text;
|
||||
int strOffsetX = 0;
|
||||
int strOffsetY = 0;
|
||||
Point point = new Point(col.Left.Value + xPadding, RowsToPixels(i) + CellHeightPadding);
|
||||
|
||||
Bitmap image = null;
|
||||
int bitmapOffsetX = 0;
|
||||
int bitmapOffsetY = 0;
|
||||
|
||||
if (QueryItemIcon != null)
|
||||
{
|
||||
QueryItemIcon(f + startRow, columns[j], ref image);
|
||||
QueryItemIcon(f + startRow, columns[j], ref image, ref bitmapOffsetX, ref bitmapOffsetY);
|
||||
}
|
||||
|
||||
if (image != null)
|
||||
{
|
||||
Gdi.DrawBitmap(image, new Point(point.X, point.Y + CellHeightPadding), true);
|
||||
Gdi.DrawBitmap(image, new Point(point.X + bitmapOffsetX, point.Y + bitmapOffsetY + CellHeightPadding), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
QueryItemText(f + startRow, columns[j], out text);
|
||||
//else
|
||||
//{
|
||||
QueryItemText(f + startRow, columns[j], out text, ref strOffsetX, ref strOffsetY);
|
||||
|
||||
bool rePrep = false;
|
||||
if (SelectedItems.Contains(new Cell { Column = columns[j], RowIndex = f + startRow }))
|
||||
|
@ -1161,14 +1174,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
Gdi.DrawString(text, point);
|
||||
Gdi.DrawString(text, new Point(point.X + strOffsetX, point.Y + strOffsetY));
|
||||
}
|
||||
|
||||
if (rePrep)
|
||||
{
|
||||
Gdi.PrepDrawString(this.NormalFont, this.ForeColor);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
color = Color.White;
|
||||
}
|
||||
|
||||
private void MarkerView_QueryItemText(int index, InputRoll.RollColumn column, out string text)
|
||||
private void MarkerView_QueryItemText(int index, InputRoll.RollColumn column, out string text, ref int offsetX, ref int offsetY)
|
||||
{
|
||||
text = "";
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
#region Query callbacks
|
||||
|
||||
private void TasView_QueryItemIcon(int index, InputRoll.RollColumn column, ref Bitmap bitmap)
|
||||
private void TasView_QueryItemIcon(int index, InputRoll.RollColumn column, ref Bitmap bitmap, ref int offsetX, ref int offsetY)
|
||||
{
|
||||
var overrideIcon = GetIconOverride(index, column);
|
||||
|
||||
|
@ -119,6 +119,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
Properties.Resources.ts_h_arrow_green;
|
||||
}
|
||||
}
|
||||
else if (columnName == FrameColumnName)
|
||||
{
|
||||
TasMovieRecord record = CurrentTasMovie[index];
|
||||
if (record.HasState)
|
||||
{
|
||||
offsetX = -2;
|
||||
offsetY = 2;
|
||||
bitmap = Properties.Resources.anchor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TasView_QueryItemBkColor(int index, InputRoll.RollColumn column, ref Color color)
|
||||
|
@ -183,7 +193,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void TasView_QueryItemText(int index, InputRoll.RollColumn column, out string text)
|
||||
private void TasView_QueryItemText(int index, InputRoll.RollColumn column, out string text, ref int offsetX, ref int offsetY)
|
||||
{
|
||||
var overrideText = GetTextOverride(index, column);
|
||||
if (overrideText != null)
|
||||
|
@ -207,6 +217,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else if (columnName == FrameColumnName)
|
||||
{
|
||||
offsetX = 7;
|
||||
text = (index).ToString().PadLeft(CurrentTasMovie.InputLogLength.ToString().Length, '0');
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue