diff --git a/BAKKA-Editor/MainForm.Designer.cs b/BAKKA-Editor/MainForm.Designer.cs index 5c23750..e8a377c 100644 --- a/BAKKA-Editor/MainForm.Designer.cs +++ b/BAKKA-Editor/MainForm.Designer.cs @@ -442,7 +442,7 @@ this.holdButton.Name = "holdButton"; this.holdButton.Size = new System.Drawing.Size(86, 23); this.holdButton.TabIndex = 11; - this.holdButton.Text = "Hold (H)"; + this.holdButton.Text = "Hold"; this.holdButton.UseVisualStyleBackColor = false; this.holdButton.Click += new System.EventHandler(this.holdButton_Click); // @@ -453,7 +453,7 @@ this.chainButton.Name = "chainButton"; this.chainButton.Size = new System.Drawing.Size(86, 23); this.chainButton.TabIndex = 10; - this.chainButton.Text = "Chain (Y)"; + this.chainButton.Text = "Chain"; this.chainButton.UseVisualStyleBackColor = false; this.chainButton.Click += new System.EventHandler(this.chainButton_Click); // @@ -465,7 +465,7 @@ this.blueButton.Name = "blueButton"; this.blueButton.Size = new System.Drawing.Size(86, 23); this.blueButton.TabIndex = 9; - this.blueButton.Text = "↓ Snap (B)"; + this.blueButton.Text = "↓ Snap"; this.blueButton.UseVisualStyleBackColor = false; this.blueButton.Click += new System.EventHandler(this.blueButton_Click); // @@ -477,7 +477,7 @@ this.redButton.Name = "redButton"; this.redButton.Size = new System.Drawing.Size(86, 23); this.redButton.TabIndex = 8; - this.redButton.Text = "↑ Snap (R)"; + this.redButton.Text = "↑ Snap"; this.redButton.UseVisualStyleBackColor = false; this.redButton.Click += new System.EventHandler(this.redButton_Click); // @@ -488,7 +488,7 @@ this.greenButton.Name = "greenButton"; this.greenButton.Size = new System.Drawing.Size(86, 23); this.greenButton.TabIndex = 7; - this.greenButton.Text = "→ Slide (G)"; + this.greenButton.Text = "→ Slide"; this.greenButton.UseVisualStyleBackColor = false; this.greenButton.Click += new System.EventHandler(this.greenButton_Click); // @@ -499,7 +499,7 @@ this.orangeButton.Name = "orangeButton"; this.orangeButton.Size = new System.Drawing.Size(86, 23); this.orangeButton.TabIndex = 6; - this.orangeButton.Text = "← Slide (O)"; + this.orangeButton.Text = "← Slide"; this.orangeButton.UseVisualStyleBackColor = false; this.orangeButton.Click += new System.EventHandler(this.orangeButton_Click); // @@ -510,7 +510,7 @@ this.tapButton.Name = "tapButton"; this.tapButton.Size = new System.Drawing.Size(86, 23); this.tapButton.TabIndex = 5; - this.tapButton.Text = "Touch (T)"; + this.tapButton.Text = "Touch"; this.tapButton.UseVisualStyleBackColor = false; this.tapButton.Click += new System.EventHandler(this.tapButton_Click); // diff --git a/BAKKA-Editor/MainForm.cs b/BAKKA-Editor/MainForm.cs index e0dd31d..977b15d 100644 --- a/BAKKA-Editor/MainForm.cs +++ b/BAKKA-Editor/MainForm.cs @@ -117,6 +117,14 @@ namespace BAKKA_Editor highlightViewedNoteToolStripMenuItem.Checked = userSettings.ViewSettings.HighlightViewedNote; autoSaveTimer.Interval = userSettings.SaveSettings.AutoSaveInterval * 60000; autoSaveTimer.Enabled = true; + // Update hotkey labels + tapButton.AppendHotkey(userSettings.HotkeySettings.TouchHotkey); + orangeButton.AppendHotkey(userSettings.HotkeySettings.SlideLeftHotkey); + greenButton.AppendHotkey(userSettings.HotkeySettings.SlideRightHotkey); + redButton.AppendHotkey(userSettings.HotkeySettings.SnapUpHotkey); + blueButton.AppendHotkey(userSettings.HotkeySettings.SnapDownHotkey); + chainButton.AppendHotkey(userSettings.HotkeySettings.ChainHotkey); + holdButton.AppendHotkey(userSettings.HotkeySettings.HoldHotkey); // Look for temp files from previous runs var tempFile = Directory.GetFiles(Path.GetTempPath(), "*.bakka"); @@ -1682,41 +1690,6 @@ namespace BAKKA_Editor switch (keyData) { - case Keys.T: - if(tapButton.Enabled) - tapButton_Click(sender, e); - tapButton.Focus(); - return true; - case Keys.O: - if (orangeButton.Enabled) - orangeButton_Click(sender, e); - orangeButton.Focus(); - return true; - case Keys.G: - if (greenButton.Enabled) - greenButton_Click(sender, e); - greenButton.Focus(); - return true; - case Keys.R: - if (redButton.Enabled) - redButton_Click(sender, e); - redButton.Focus(); - return true; - case Keys.B: - if (blueButton.Enabled) - blueButton_Click(sender, e); - blueButton.Focus(); - return true; - case Keys.Y: - if (chainButton.Enabled) - chainButton_Click(sender, e); - chainButton.Focus(); - return true; - case Keys.H: - if (holdButton.Enabled) - holdButton_Click(sender, e); - holdButton.Focus(); - return true; case Keys.I: if (insertButton.Enabled) insertButton_Click(sender, e); @@ -1734,6 +1707,55 @@ namespace BAKKA_Editor playbackVolumeChange(keyData == Keys.Up); return true; default: + if (keyData == (Keys)userSettings.HotkeySettings.TouchHotkey) + { + if (tapButton.Enabled) + tapButton_Click(sender, e); + tapButton.Focus(); + return true; + } + else if (keyData == (Keys)userSettings.HotkeySettings.SlideLeftHotkey) + { + if (orangeButton.Enabled) + orangeButton_Click(sender, e); + orangeButton.Focus(); + return true; + } + else if (keyData == (Keys)userSettings.HotkeySettings.SlideRightHotkey) + { + if (greenButton.Enabled) + greenButton_Click(sender, e); + greenButton.Focus(); + return true; + } + else if (keyData == (Keys)userSettings.HotkeySettings.SnapUpHotkey) + { + if (redButton.Enabled) + redButton_Click(sender, e); + redButton.Focus(); + return true; + } + else if (keyData == (Keys)userSettings.HotkeySettings.SnapDownHotkey) + { + if (blueButton.Enabled) + blueButton_Click(sender, e); + blueButton.Focus(); + return true; + } + else if (keyData == (Keys)userSettings.HotkeySettings.ChainHotkey) + { + if (chainButton.Enabled) + chainButton_Click(sender, e); + chainButton.Focus(); + return true; + } + else if (keyData == (Keys)userSettings.HotkeySettings.HoldHotkey) + { + if (holdButton.Enabled) + holdButton_Click(sender, e); + holdButton.Focus(); + return true; + } break; } diff --git a/BAKKA-Editor/UserSettings.cs b/BAKKA-Editor/UserSettings.cs index ab8c009..85c3c73 100644 --- a/BAKKA-Editor/UserSettings.cs +++ b/BAKKA-Editor/UserSettings.cs @@ -10,6 +10,7 @@ namespace BAKKA_Editor { public ViewSettings ViewSettings { get; set; } = new(); public SaveSettings SaveSettings { get; set; } = new(); + public HotkeySettings HotkeySettings { get; set; } = new(); } internal class ViewSettings @@ -26,4 +27,15 @@ namespace BAKKA_Editor /// public int AutoSaveInterval { get; set; } = 1; } + + internal class HotkeySettings + { + public int TouchHotkey { get; set; } = Convert.ToInt32(Keys.D1); + public int SlideLeftHotkey { get; set; } = Convert.ToInt32(Keys.D2); + public int SlideRightHotkey { get; set; } = Convert.ToInt32(Keys.D3); + public int SnapUpHotkey { get; set; } = Convert.ToInt32(Keys.D4); + public int SnapDownHotkey { get; set; } = Convert.ToInt32(Keys.D5); + public int ChainHotkey { get; set; } = Convert.ToInt32(Keys.D6); + public int HoldHotkey { get; set; } = Convert.ToInt32(Keys.D7); + } } diff --git a/BAKKA-Editor/Utils.cs b/BAKKA-Editor/Utils.cs index d09c022..2718a83 100644 --- a/BAKKA-Editor/Utils.cs +++ b/BAKKA-Editor/Utils.cs @@ -10,7 +10,7 @@ namespace BAKKA_Editor { internal static string? GetTag(string input, string tag) { - if(input.Contains(tag)) + if (input.Contains(tag)) { return input.Substring(input.IndexOf(tag) + tag.Length); } @@ -178,5 +178,26 @@ namespace BAKKA_Editor { return (float)Math.Sqrt(Math.Pow(a.X - b.X, 2) + Math.Pow(a.Y - b.Y, 2)); } + + internal static string KeyIntToString(int key) + { + int offset = 0; + char ret = '0'; + if (key >= 48 && key <= 57) + { + offset = key - 48; + } + else if (key >= 65 && key <= 90) + { + offset = key - 65; + ret = 'A'; + } + return ((char)(ret + offset)).ToString(); + } + + internal static void AppendHotkey(this Button button, int key) + { + button.Text += $" ({KeyIntToString(key)})"; + } } }