Tastudio - Branches - show frame buffer when hovering on the branch #, still a lot of tweaking to do

This commit is contained in:
adelikat 2015-07-25 08:40:17 -04:00
parent 3ea0d66785
commit b67fda05f5
8 changed files with 284 additions and 3 deletions

View File

@ -968,6 +968,12 @@
<Compile Include="tools\TAStudio\PatternsForm.Designer.cs">
<DependentUpon>PatternsForm.cs</DependentUpon>
</Compile>
<Compile Include="tools\TAStudio\ScreenshotPopupControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="tools\TAStudio\ScreenshotPopupControl.Designer.cs">
<DependentUpon>ScreenshotPopupControl.cs</DependentUpon>
</Compile>
<Compile Include="tools\TAStudio\TAStudio.Callbacks.cs">
<DependentUpon>TAStudio.cs</DependentUpon>
<SubType>Form</SubType>
@ -1448,6 +1454,9 @@
<EmbeddedResource Include="tools\TAStudio\PlaybackBox.resx">
<DependentUpon>PlaybackBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\TAStudio\ScreenshotPopupControl.resx">
<DependentUpon>ScreenshotPopupControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\TAStudio\TAStudio.resx">
<DependentUpon>TAStudio.cs</DependentUpon>
</EmbeddedResource>

View File

@ -35,7 +35,7 @@
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.AddContextMenu = new System.Windows.Forms.ToolStripMenuItem();
this.RemoveBranchContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.BranchView = new InputRoll();
this.BranchView = new BizHawk.Client.EmuHawk.InputRoll();
this.BookmarksBranchesGroupBox.SuspendLayout();
this.BranchesContextMenu.SuspendLayout();
this.SuspendLayout();
@ -95,19 +95,29 @@
//
// BranchView
//
this.BranchView.AllowColumnReorder = false;
this.BranchView.AllowColumnResize = false;
this.BranchView.AlwaysScroll = false;
this.BranchView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.BranchView.CellHeightPadding = 0;
this.BranchView.ContextMenuStrip = this.BranchesContextMenu;
this.BranchView.FullRowSelect = true;
this.BranchView.GridLines = true;
this.BranchView.HideWasLagFrames = false;
this.BranchView.HorizontalOrientation = false;
this.BranchView.LagFramesToHide = 0;
this.BranchView.Location = new System.Drawing.Point(6, 19);
this.BranchView.MaxCharactersInHorizontal = 1;
this.BranchView.MultiSelect = false;
this.BranchView.Name = "BranchView";
this.BranchView.RowCount = 0;
this.BranchView.ScrollSpeed = 182;
this.BranchView.Size = new System.Drawing.Size(186, 224);
this.BranchView.TabIndex = 0;
this.BranchView.UseCustomBackground = true;
this.BranchView.CellHovered += new BizHawk.Client.EmuHawk.InputRoll.HoverEventHandler(this.BranchView_CellHovered);
this.BranchView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.BranchView_MouseDoubleClick);
this.BranchView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.BranchView_MouseMove);
//
// BookmarksBranchesBox
//

View File

@ -218,5 +218,42 @@ namespace BizHawk.Client.EmuHawk
// TODO: refactor, creating a branch shouldn't be in context menu click event
AddContextMenu_Click(null, null);
}
private void BranchView_CellHovered(object sender, InputRoll.CellEventArgs e)
{
if (e.NewCell != null && e.NewCell.RowIndex.HasValue && e.NewCell.Column != null && e.NewCell.RowIndex < Branches.Count)
{
if (e.NewCell.Column.Name == BranchNumberColumnName)
{
ScreenShotPopUp(Branches[e.NewCell.RowIndex.Value], e.NewCell.RowIndex.Value);
}
}
else
{
CloseScreenShotPopUp();
}
}
private void BranchView_MouseMove(object sender, MouseEventArgs e)
{
if (BranchView.CurrentCell == null || !BranchView.CurrentCell.RowIndex.HasValue || BranchView.CurrentCell.Column == null)
{
CloseScreenShotPopUp();
}
}
private void CloseScreenShotPopUp()
{
Tastudio.ScreenshotControl.Visible = false;
}
private void ScreenShotPopUp(TasBranch branch, int index)
{
Tastudio.ScreenshotControl.Location = new Point(
this.Location.X - branch.OSDFrameBuffer.Width - ScreenshotPopupControl.BorderWidth,
this.Location.Y + ((BranchView.RowHeight * index) + BranchView.RowHeight) - branch.OSDFrameBuffer.Height - ScreenshotPopupControl.BorderWidth);
Tastudio.ScreenshotControl.Visible = true;
Tastudio.ScreenshotControl.Branch = branch;
}
}
}

View File

@ -2257,6 +2257,9 @@ namespace BizHawk.Client.EmuHawk
/// </summary>
private int CellWidth { get; set; }
[Browsable(false)]
public int RowHeight { get { return CellHeight; } }
/// <summary>
/// The height of a cell in Vertical Orientation. Only can be changed by changing the Font or CellPadding.
/// </summary>

View File

@ -0,0 +1,46 @@
namespace BizHawk.Client.EmuHawk
{
partial class ScreenshotPopupControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// ScreenshotPopupControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "ScreenshotPopupControl";
this.Size = new System.Drawing.Size(237, 255);
this.Load += new System.EventHandler(this.ScreenshotPopupControl_Load);
this.ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class ScreenshotPopupControl : UserControl
{
public ScreenshotPopupControl()
{
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.Opaque, true);
this.BackColor = Color.Transparent;
InitializeComponent();
}
public const int BorderWidth = 20;
private TasBranch _branch = null;
public TasBranch Branch
{
get { return _branch; }
set
{
_branch = value;
Size = new Size(Branch.OSDFrameBuffer.Width + (BorderWidth * 2), Branch.OSDFrameBuffer.Height + (BorderWidth * 2));
Refresh();
}
}
private void ScreenshotPopupControl_Load(object sender, EventArgs e)
{
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.DrawRectangle(new Pen(Brushes.Black), 0, 0, Width - 1, Height - 1);
e.Graphics.DrawImage(Branch.OSDFrameBuffer.ToSysdrawingBitmap(), new Point(BorderWidth, BorderWidth));
base.OnPaint(e);
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -36,6 +36,11 @@ namespace BizHawk.Client.EmuHawk
private UndoHistoryForm undoForm;
public ScreenshotPopupControl ScreenshotControl = new ScreenshotPopupControl
{
Size = new System.Drawing.Size(250, 250),
};
[ConfigPersist]
public TAStudioSettings Settings { get; set; }
@ -70,6 +75,10 @@ namespace BizHawk.Client.EmuHawk
public TAStudio()
{
InitializeComponent();
ScreenshotControl.Visible = false;
Controls.Add(ScreenshotControl);
ScreenshotControl.BringToFront();
Settings = new TAStudioSettings();
// TODO: show this at all times or hide it when saving is done?
this.SavingProgressBar.Visible = false;