Tastudio - Make mainform hotkeys out of a bunch of built in hotkeys

This commit is contained in:
adelikat 2019-12-10 19:26:23 -06:00
parent f309c831b3
commit 515f409246
4 changed files with 110 additions and 19 deletions

View File

@ -55,13 +55,7 @@ namespace BizHawk.Client.Common
return GetEnumerator();
}
public Binding this[string index]
{
get
{
return Bindings.FirstOrDefault(b => b.DisplayName == index) ?? new Binding();
}
}
public Binding this[string index] => Bindings.FirstOrDefault(b => b.DisplayName == index) ?? new Binding();
private static Binding Bind(string tabGroup, string displayName, string bindings = "", string defaultBinding = "", string toolTip = "")
{
@ -223,8 +217,14 @@ namespace BizHawk.Client.Common
Bind("TAStudio", "Toggle Follow Cursor", "Shift+F"),
Bind("TAStudio", "Toggle Auto-Restore", "Shift+R"),
Bind("TAStudio", "Toggle Turbo Seek", "Shift+S"),
Bind("TAStudio", "Undo", "Ctrl+Z"), // TODO: these are getting not unique enough
Bind("TAStudio", "Redo", "Ctrl+Y"),
Bind("TAStudio", "Sel. bet. Markers", "Ctrl+A"),
Bind("TAStudio", "Select All", "Ctrl+Shift+A"),
Bind("TAStudio", "Reselect Clip.", "Ctrl+B"),
Bind("TAStudio", "Clear Frames", "Delete"),
Bind("TAStudio", "Insert Frame", "Insert"),
Bind("TAStudio", "Insert # Frames", "Ctrl+Shift+Insert"),
Bind("TAStudio", "Delete Frames", "Ctrl+Delete"),
Bind("TAStudio", "Clone Frames", "Ctrl+Insert"),
Bind("TAStudio", "Analog Increment", "UpArrow"),

View File

@ -500,6 +500,61 @@ namespace BizHawk.Client.EmuHawk
return false;
}
break;
case "Undo":
if (GlobalWin.Tools.IsLoaded<TAStudio>())
{
GlobalWin.Tools.TAStudio.UndoExternal();
}
else
{
return false;
}
break;
case "Redo":
if (GlobalWin.Tools.IsLoaded<TAStudio>())
{
GlobalWin.Tools.TAStudio.RedoExternal();
}
else
{
return false;
}
break;
case "Select between Markers":
if (GlobalWin.Tools.IsLoaded<TAStudio>())
{
GlobalWin.Tools.TAStudio.SelectBetweenMarkersExternal();
}
else
{
return false;
}
break;
case "Select All":
if (GlobalWin.Tools.IsLoaded<TAStudio>())
{
GlobalWin.Tools.TAStudio.SelectAllExternal();
}
else
{
return false;
}
break;
case "Reselect Clip.":
if (GlobalWin.Tools.IsLoaded<TAStudio>())
{
GlobalWin.Tools.TAStudio.SelectAllExternal();
}
else
{
return false;
}
break;
case "Clear Frames":
if (GlobalWin.Tools.IsLoaded<TAStudio>())
@ -522,6 +577,16 @@ namespace BizHawk.Client.EmuHawk
return false;
}
break;
case "Insert # Frames":
if (GlobalWin.Tools.IsLoaded<TAStudio>())
{
GlobalWin.Tools.TAStudio.InsertNumFramesExternal();
}
else
{
return false;
}
break;
case "Delete Frames":
if (GlobalWin.Tools.IsLoaded<TAStudio>())

View File

@ -427,7 +427,6 @@
// UndoMenuItem
//
this.UndoMenuItem.Name = "UndoMenuItem";
this.UndoMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
this.UndoMenuItem.Size = new System.Drawing.Size(280, 22);
this.UndoMenuItem.Text = "&Undo";
this.UndoMenuItem.Click += new System.EventHandler(this.UndoMenuItem_Click);
@ -436,7 +435,6 @@
//
this.RedoMenuItem.Enabled = false;
this.RedoMenuItem.Name = "RedoMenuItem";
this.RedoMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y)));
this.RedoMenuItem.Size = new System.Drawing.Size(280, 22);
this.RedoMenuItem.Text = "&Redo";
this.RedoMenuItem.Click += new System.EventHandler(this.RedoMenuItem_Click);
@ -452,7 +450,6 @@
//
this.SelectionUndoMenuItem.Enabled = false;
this.SelectionUndoMenuItem.Name = "SelectionUndoMenuItem";
this.SelectionUndoMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q)));
this.SelectionUndoMenuItem.Size = new System.Drawing.Size(280, 22);
this.SelectionUndoMenuItem.Text = "Selection Undo";
//
@ -460,7 +457,6 @@
//
this.SelectionRedoMenuItem.Enabled = false;
this.SelectionRedoMenuItem.Name = "SelectionRedoMenuItem";
this.SelectionRedoMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.W)));
this.SelectionRedoMenuItem.Size = new System.Drawing.Size(280, 22);
this.SelectionRedoMenuItem.Text = "Selection Redo";
//
@ -479,7 +475,6 @@
// SelectBetweenMarkersMenuItem
//
this.SelectBetweenMarkersMenuItem.Name = "SelectBetweenMarkersMenuItem";
this.SelectBetweenMarkersMenuItem.ShortcutKeyDisplayString = "Ctrl+A";
this.SelectBetweenMarkersMenuItem.Size = new System.Drawing.Size(280, 22);
this.SelectBetweenMarkersMenuItem.Text = "Select between Markers";
this.SelectBetweenMarkersMenuItem.Click += new System.EventHandler(this.SelectBetweenMarkersMenuItem_Click);
@ -488,8 +483,6 @@
//
this.SelectAllMenuItem.Name = "SelectAllMenuItem";
this.SelectAllMenuItem.ShortcutKeyDisplayString = "";
this.SelectAllMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.A)));
this.SelectAllMenuItem.Size = new System.Drawing.Size(280, 22);
this.SelectAllMenuItem.Text = "Select &All";
this.SelectAllMenuItem.Click += new System.EventHandler(this.SelectAllMenuItem_Click);
@ -497,7 +490,6 @@
// ReselectClipboardMenuItem
//
this.ReselectClipboardMenuItem.Name = "ReselectClipboardMenuItem";
this.ReselectClipboardMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B)));
this.ReselectClipboardMenuItem.Size = new System.Drawing.Size(280, 22);
this.ReselectClipboardMenuItem.Text = "Reselect Clipboard";
this.ReselectClipboardMenuItem.Click += new System.EventHandler(this.ReselectClipboardMenuItem_Click);
@ -578,7 +570,6 @@
//
this.InsertNumFramesMenuItem.Name = "InsertNumFramesMenuItem";
this.InsertNumFramesMenuItem.ShortcutKeyDisplayString = "";
this.InsertNumFramesMenuItem.ShortcutKeyDisplayString = "Ctrl+Shift+Ins";
this.InsertNumFramesMenuItem.Size = new System.Drawing.Size(280, 22);
this.InsertNumFramesMenuItem.Text = "Insert # of Frames";
this.InsertNumFramesMenuItem.Click += new System.EventHandler(this.InsertNumFramesMenuItem_Click);
@ -1377,7 +1368,6 @@
// SelectBetweenMarkersContextMenuItem
//
this.SelectBetweenMarkersContextMenuItem.Name = "SelectBetweenMarkersContextMenuItem";
this.SelectBetweenMarkersContextMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
this.SelectBetweenMarkersContextMenuItem.Size = new System.Drawing.Size(242, 22);
this.SelectBetweenMarkersContextMenuItem.Text = "Select between Markers";
this.SelectBetweenMarkersContextMenuItem.Click += new System.EventHandler(this.SelectBetweenMarkersMenuItem_Click);
@ -1474,8 +1464,6 @@
// InsertNumFramesContextMenuItem
//
this.InsertNumFramesContextMenuItem.Name = "InsertNumFramesContextMenuItem";
this.InsertNumFramesContextMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.Insert)));
this.InsertNumFramesContextMenuItem.Size = new System.Drawing.Size(242, 22);
this.InsertNumFramesContextMenuItem.Text = "Insert # of Frames";
this.InsertNumFramesContextMenuItem.Click += new System.EventHandler(this.InsertNumFramesMenuItem_Click);

View File

@ -357,8 +357,14 @@ namespace BizHawk.Client.EmuHawk
StateHistoryIntegrityCheckMenuItem.Visible =
VersionInfo.DeveloperBuild;
UndoMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Undo"].Bindings;
RedoMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Redo"].Bindings;
SelectBetweenMarkersMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select between Markers"].Bindings;
SelectAllMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select All"].Bindings;
ReselectClipboardMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Reselect Clip."].Bindings;
ClearFramesMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Clear Frames"].Bindings;
InsertFrameMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Insert Frame"].Bindings;
InsertNumFramesMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Insert # Frames"].Bindings;
DeleteFramesMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Delete Frames"].Bindings;
CloneFramesMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Clone Frames"].Bindings;
}
@ -373,6 +379,11 @@ namespace BizHawk.Client.EmuHawk
InsertFrameMenuItem_Click(null, null);
}
public void InsertNumFramesExternal()
{
InsertNumFramesMenuItem_Click(null, null);
}
public void DeleteFramesExternal()
{
DeleteFramesMenuItem_Click(null, null);
@ -383,6 +394,31 @@ namespace BizHawk.Client.EmuHawk
CloneFramesMenuItem_Click(null, null);
}
public void UndoExternal()
{
UndoMenuItem_Click(null, null);
}
public void RedoExternal()
{
RedoMenuItem_Click(null, null);
}
public void SelectBetweenMarkersExternal()
{
SelectBetweenMarkersMenuItem_Click(null, null);
}
public void SelectAllExternal()
{
SelectAllMenuItem_Click(null, null);
}
public void ReselectClipboardExternal()
{
ReselectClipboardMenuItem_Click(null, null);
}
private void UndoMenuItem_Click(object sender, EventArgs e)
{
if (CurrentTasMovie.ChangeLog.Undo() < Emulator.Frame)
@ -1455,6 +1491,8 @@ namespace BizHawk.Client.EmuHawk
CancelSeekContextMenuItem.Enabled = Mainform.PauseOnFrame.HasValue;
BranchContextMenuItem.Visible = TasView.CurrentCell.RowIndex == Emulator.Frame;
SelectBetweenMarkersContextMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Sel. bet. Markers"].Bindings;
InsertNumFramesContextMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Insert # Frames"].Bindings;
ClearContextMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Clear Frames"].Bindings;
InsertFrameContextMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Insert Frame"].Bindings;
DeleteFramesContextMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Delete Frames"].Bindings;