From d47452dae48fab61b97f5880e8e2d35039fb35ab Mon Sep 17 00:00:00 2001 From: Raymonf Date: Mon, 7 Nov 2022 22:01:38 -0500 Subject: [PATCH 1/3] ux: update selected note upon insertion of new object --- BAKKA-Editor/MainForm.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BAKKA-Editor/MainForm.cs b/BAKKA-Editor/MainForm.cs index c595a8c..be2bb05 100644 --- a/BAKKA-Editor/MainForm.cs +++ b/BAKKA-Editor/MainForm.cs @@ -1126,6 +1126,8 @@ namespace BAKKA_Editor opManager.Push(new InsertNote(chart, tempNote)); break; } + // new object so update the currently selected note to the new one + UpdateNoteLabels(chart.Notes.Count - 1); } } -- 2.54.0 From 7743ba483ab95a7f3c3c85bb19f88d243c0d77a4 Mon Sep 17 00:00:00 2001 From: Raymonf Date: Tue, 15 Nov 2022 18:12:15 -0500 Subject: [PATCH 2/3] fix: explicitly store and search for last note --- BAKKA-Editor/MainForm.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/BAKKA-Editor/MainForm.cs b/BAKKA-Editor/MainForm.cs index be2bb05..f04ef34 100644 --- a/BAKKA-Editor/MainForm.cs +++ b/BAKKA-Editor/MainForm.cs @@ -27,6 +27,7 @@ namespace BAKKA_Editor int selectedGimmickIndex = -1; int selectedNoteIndex = -1; Note lastNote; + Note? nextSelectedNote; // so that we know the last newly inserted note // Music ISoundEngine soundEngine = new ISoundEngine(); @@ -80,6 +81,13 @@ namespace BAKKA_Editor { chart.Notes = chart.Notes.OrderBy(x => x.Measure).ToList(); chart.Gimmicks = chart.Gimmicks.OrderBy(x => x.Measure).ToList(); + if (nextSelectedNote != null) + { + var nextSelectedIndex = chart.Notes.IndexOf(nextSelectedNote); + if (nextSelectedIndex != -1) + selectedNoteIndex = nextSelectedIndex; + nextSelectedNote = null; + } if (selectedNoteIndex >= chart.Notes.Count) selectedNoteIndex = chart.Notes.Count - 1; else if (selectedNoteIndex == -1 && chart.Notes.Count > 0) @@ -1112,6 +1120,8 @@ namespace BAKKA_Editor default: break; } + // new object so update the temporary last note to the new one + nextSelectedNote = tempNote; chart.Notes.Add(tempNote); chart.IsSaved = false; switch (currentNoteType) @@ -1126,8 +1136,6 @@ namespace BAKKA_Editor opManager.Push(new InsertNote(chart, tempNote)); break; } - // new object so update the currently selected note to the new one - UpdateNoteLabels(chart.Notes.Count - 1); } } -- 2.54.0 From 2c774488059e4dcc297f93ebe57f7f5fe325c9da Mon Sep 17 00:00:00 2001 From: Raymonf Date: Wed, 16 Nov 2022 13:28:03 -0500 Subject: [PATCH 3/3] feature: add option for selection of last inserted note --- BAKKA-Editor/MainForm.Designer.cs | 13 ++++++++++++- BAKKA-Editor/MainForm.cs | 4 +++- BAKKA-Editor/UserSettings.cs | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/BAKKA-Editor/MainForm.Designer.cs b/BAKKA-Editor/MainForm.Designer.cs index cb7aa74..3047fe8 100644 --- a/BAKKA-Editor/MainForm.Designer.cs +++ b/BAKKA-Editor/MainForm.Designer.cs @@ -96,6 +96,7 @@ this.showCursorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.showCursorDuringPlaybackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.highlightViewedNoteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.selectLastInsertedNoteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.chartToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.initialChartSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -960,7 +961,8 @@ this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.showCursorToolStripMenuItem, this.showCursorDuringPlaybackToolStripMenuItem, - this.highlightViewedNoteToolStripMenuItem}); + this.highlightViewedNoteToolStripMenuItem, + this.selectLastInsertedNoteToolStripMenuItem}); this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; this.viewToolStripMenuItem.Size = new System.Drawing.Size(65, 29); this.viewToolStripMenuItem.Text = "View"; @@ -989,6 +991,14 @@ this.highlightViewedNoteToolStripMenuItem.Name = "highlightViewedNoteToolStripMenuItem"; this.highlightViewedNoteToolStripMenuItem.Size = new System.Drawing.Size(348, 34); this.highlightViewedNoteToolStripMenuItem.Text = "Highlight Viewed Note"; + // selectLastInsertedNoteToolStripMenuItem + // + this.selectLastInsertedNoteToolStripMenuItem.Checked = true; + this.selectLastInsertedNoteToolStripMenuItem.CheckOnClick = true; + this.selectLastInsertedNoteToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.selectLastInsertedNoteToolStripMenuItem.Name = "selectLastInsertedNoteToolStripMenuItem"; + this.selectLastInsertedNoteToolStripMenuItem.Size = new System.Drawing.Size(285, 26); + this.selectLastInsertedNoteToolStripMenuItem.Text = "Select Last Inserted Note"; // // chartToolStripMenuItem // @@ -1561,6 +1571,7 @@ private ToolStripMenuItem showCursorToolStripMenuItem; private ToolStripMenuItem showCursorDuringPlaybackToolStripMenuItem; private ToolStripMenuItem highlightViewedNoteToolStripMenuItem; + private ToolStripMenuItem selectLastInsertedNoteToolStripMenuItem; private ToolStripMenuItem chartToolStripMenuItem; private ToolStripMenuItem initialChartSettingsToolStripMenuItem; private ToolStripMenuItem aboutToolStripMenuItem; diff --git a/BAKKA-Editor/MainForm.cs b/BAKKA-Editor/MainForm.cs index f04ef34..f7d6400 100644 --- a/BAKKA-Editor/MainForm.cs +++ b/BAKKA-Editor/MainForm.cs @@ -123,6 +123,7 @@ namespace BAKKA_Editor showCursorToolStripMenuItem.Checked = userSettings.ViewSettings.ShowCursor; showCursorDuringPlaybackToolStripMenuItem.Checked = userSettings.ViewSettings.ShowCursorDuringPlayback; highlightViewedNoteToolStripMenuItem.Checked = userSettings.ViewSettings.HighlightViewedNote; + selectLastInsertedNoteToolStripMenuItem.Checked = userSettings.ViewSettings.SelectLastInsertedNote; autoSaveTimer.Interval = userSettings.SaveSettings.AutoSaveInterval * 60000; autoSaveTimer.Enabled = true; @@ -1121,7 +1122,8 @@ namespace BAKKA_Editor break; } // new object so update the temporary last note to the new one - nextSelectedNote = tempNote; + if (selectLastInsertedNoteToolStripMenuItem.Checked) + nextSelectedNote = tempNote; chart.Notes.Add(tempNote); chart.IsSaved = false; switch (currentNoteType) diff --git a/BAKKA-Editor/UserSettings.cs b/BAKKA-Editor/UserSettings.cs index ab8c009..f1868e4 100644 --- a/BAKKA-Editor/UserSettings.cs +++ b/BAKKA-Editor/UserSettings.cs @@ -17,6 +17,7 @@ namespace BAKKA_Editor public bool ShowCursor { get; set; } = true; public bool ShowCursorDuringPlayback { get; set; } = false; public bool HighlightViewedNote { get; set; } = true; + public bool SelectLastInsertedNote { get; set; } = true; } internal class SaveSettings -- 2.54.0