diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index fd82df209e..7fc0668217 100644 --- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -968,6 +968,12 @@ PatternsForm.cs + + UserControl + + + ScreenshotPopupControl.cs + TAStudio.cs Form @@ -1448,6 +1454,9 @@ PlaybackBox.cs + + ScreenshotPopupControl.cs + TAStudio.cs diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.Designer.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.Designer.cs index 3a789e1b5e..d465fa86a5 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.Designer.cs @@ -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 // diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs index a96485b3c1..0e41fe2f06 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs @@ -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; + } } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs index 8720e5b89d..d7a05bb853 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs @@ -2257,6 +2257,9 @@ namespace BizHawk.Client.EmuHawk /// private int CellWidth { get; set; } + [Browsable(false)] + public int RowHeight { get { return CellHeight; } } + /// /// The height of a cell in Vertical Orientation. Only can be changed by changing the Font or CellPadding. /// diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/ScreenshotPopupControl.Designer.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/ScreenshotPopupControl.Designer.cs new file mode 100644 index 0000000000..39f6bfd220 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/ScreenshotPopupControl.Designer.cs @@ -0,0 +1,46 @@ +namespace BizHawk.Client.EmuHawk +{ + partial class ScreenshotPopupControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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 + } +} diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/ScreenshotPopupControl.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/ScreenshotPopupControl.cs new file mode 100644 index 0000000000..6707e67291 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/ScreenshotPopupControl.cs @@ -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); + } + } +} diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/ScreenshotPopupControl.resx b/BizHawk.Client.EmuHawk/tools/TAStudio/ScreenshotPopupControl.resx new file mode 100644 index 0000000000..1af7de150c --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/ScreenshotPopupControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 47d71c995b..40a8fe9e03 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -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;