From d2587335706f55e80e7f2a7fd94e6f0a852676e8 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 23 Aug 2014 13:05:28 +0000 Subject: [PATCH] InputRoll - some more properties that will be needed --- .../tools/TAStudio/InputRoll.cs | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs index 2bf9a1a7e5..b223017f98 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs @@ -162,6 +162,13 @@ namespace BizHawk.Client.EmuHawk [DefaultValue(true)] public bool MultiSelect { get; set; } + /// + /// Gets or sets whether or not the control is in input painting mode + /// + [Category("Behavior")] + [DefaultValue(false)] + public bool InputPaintingMode { get; set; } + #endregion #region Event Handlers @@ -196,6 +203,12 @@ namespace BizHawk.Client.EmuHawk [Category("Behavior")] public event SelectedIndexChangedHandler SelectedIndexChanged; + /// + /// Occurs whenever the mouse wheel is scrolled while the right mouse button is held + /// + [Category("Behavior")] + public event RightMouseScrollEventHandler RightMouseScrolled; + /// /// Retrieve the text for a cell /// @@ -212,6 +225,8 @@ namespace BizHawk.Client.EmuHawk public delegate void SelectedIndexChangedHandler(object sender, EventArgs e); + public delegate void RightMouseScrollEventHandler(object sender, MouseEventArgs e); + public class CellEventArgs { public CellEventArgs(Cell oldCell, Cell newCell) @@ -232,10 +247,22 @@ namespace BizHawk.Client.EmuHawk [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)] public Cell CurrentCell { get; set; } + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)] + public Cell LastCell { get; set; } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)] + public bool IsPaintDown { get; set; } + [Browsable(false)] [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)] public bool UseCustomBackground { get; set; } + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)] + public bool RightButtonHeld { get; set; } + public string UserSettingsSerialized() { return string.Empty; // TODO @@ -681,6 +708,7 @@ namespace BizHawk.Client.EmuHawk protected override void OnMouseLeave(EventArgs e) { CurrentCell = null; + IsPaintDown = false; Refresh(); base.OnMouseLeave(e); } @@ -724,6 +752,41 @@ namespace BizHawk.Client.EmuHawk base.OnMouseClick(e); } + protected override void OnMouseDown(MouseEventArgs e) + { + if (e.Button == MouseButtons.Left && InputPaintingMode) + { + IsPaintDown = true; + } + + if (e.Button == MouseButtons.Right) + { + RightButtonHeld = true; + } + + base.OnMouseDown(e); + } + + protected override void OnMouseUp(MouseEventArgs e) + { + IsPaintDown = false; + RightButtonHeld = false; + + base.OnMouseUp(e); + } + + protected override void OnMouseWheel(MouseEventArgs e) + { + if (RightButtonHeld) + { + DoRightMouseScroll(this, e); + } + else + { + base.OnMouseWheel(e); + } + } + #endregion #region Change Events @@ -739,6 +802,14 @@ namespace BizHawk.Client.EmuHawk #region Helpers + private void DoRightMouseScroll(object sender, MouseEventArgs e) + { + if (RightMouseScrolled != null) + { + RightMouseScrolled(sender, e); + } + } + private void VerticalBar_ValueChanged(object sender, EventArgs e) { Refresh(); @@ -904,6 +975,7 @@ namespace BizHawk.Client.EmuHawk if (!newCell.Equals(CurrentCell)) { CellChanged(CurrentCell, newCell); + LastCell = CurrentCell; CurrentCell = newCell; if (IsHoveringOnColumnCell ||