Tastudio branches - tweaks to hover effect

This commit is contained in:
adelikat 2015-07-25 12:01:26 -04:00
parent 59c7349900
commit 1a5814b7a8
4 changed files with 41 additions and 4 deletions

View File

@ -106,17 +106,19 @@
this.BranchView.FullRowSelect = true;
this.BranchView.HideWasLagFrames = false;
this.BranchView.HorizontalOrientation = false;
this.BranchView.HoverInterval = 500;
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.ScrollSpeed = 13;
this.BranchView.Size = new System.Drawing.Size(186, 224);
this.BranchView.TabIndex = 0;
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.MouseLeave += new System.EventHandler(this.BranchView_MouseLeave);
this.BranchView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.BranchView_MouseMove);
//
// BookmarksBranchesBox

View File

@ -6,7 +6,7 @@ using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Media;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Common;
@ -99,6 +99,15 @@ namespace BizHawk.Client.EmuHawk
{
if (index == CurrentBranch)
color = SystemColors.HotTrack;
// Highlight the branch cell a little, if hovering over it
if (BranchView.CurrentCellIsDataCell &&
BranchView.CurrentCell.Column.Name == BranchNumberColumnName &&
column.Name == BranchNumberColumnName &&
index == BranchView.CurrentCell.RowIndex)
{
color = Color.FromArgb((byte)(color.A - 24), (byte)(color.R - 24), (byte)(color.G - 24), (byte)(color.B - 24));
}
}
private void AddContextMenu_Click(object sender, EventArgs e)
@ -227,6 +236,10 @@ namespace BizHawk.Client.EmuHawk
{
ScreenShotPopUp(Branches[e.NewCell.RowIndex.Value], e.NewCell.RowIndex.Value);
}
else
{
CloseScreenShotPopUp();
}
}
else
{
@ -240,6 +253,10 @@ namespace BizHawk.Client.EmuHawk
{
CloseScreenShotPopUp();
}
else if (BranchView.CurrentCell.Column.Name == BranchNumberColumnName)
{
BranchView.Refresh();
}
}
private void CloseScreenShotPopUp()
@ -247,6 +264,11 @@ namespace BizHawk.Client.EmuHawk
Tastudio.ScreenshotControl.Visible = false;
}
private void BranchView_MouseLeave(object sender, EventArgs e)
{
Tastudio.ScreenshotControl.Visible = false;
}
private void ScreenShotPopUp(TasBranch branch, int index)
{
int x = this.Location.X - Tastudio.ScreenshotControl.Width;

View File

@ -525,6 +525,16 @@ namespace BizHawk.Client.EmuHawk
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
public Cell CurrentCell { get; set; }
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
public bool CurrentCellIsDataCell
{
get
{
return CurrentCell != null && CurrentCell.RowIndex.HasValue && CurrentCell.Column != null;
}
}
/// <summary>
/// The previous Cell that the mouse was in.
/// </summary>
@ -1616,7 +1626,10 @@ namespace BizHawk.Client.EmuHawk
// But we went from selected to unselected, that is a change, so catch it here
if (hadIndex && CurrentCell.RowIndex.HasValue && CurrentCell.RowIndex > RowCount)
{
SelectedIndexChanged(this, new EventArgs());
if (SelectedIndexChanged != null)
{
SelectedIndexChanged(this, new EventArgs());
}
}
}

View File

@ -39,7 +39,7 @@ namespace BizHawk.Client.EmuHawk
public ScreenshotPopupControl ScreenshotControl = new ScreenshotPopupControl
{
Size = new Size(200, 200),
Size = new Size(256, 240),
};
[ConfigPersist]