From 4e5b3dbca5166fd751b7660268217ac68c904577 Mon Sep 17 00:00:00 2001 From: Stepland <10530295-Buggyroom@users.noreply.gitlab.com> Date: Sun, 24 Mar 2024 21:46:14 +0100 Subject: [PATCH 1/8] Fix misslabeled keys in shortcut dialog --- src/editor_state.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/editor_state.cpp b/src/editor_state.cpp index dd1a105..86137bf 100644 --- a/src/editor_state.cpp +++ b/src/editor_state.cpp @@ -2347,8 +2347,8 @@ void feis::display_shortcuts_help(bool& show) { ) { table_header(); table_shortcut("Play / Pause", "Space"); - table_shortcut("Move Backwards In Time", "Down"); - table_shortcut("Move Forwards In Time", "Up"); + table_shortcut("Move Backwards In Time", "Up"); + table_shortcut("Move Forwards In Time", "Down"); table_shortcut("Decrease Snap", "Left"); table_shortcut("Increase Snap", "Right"); ImGui::EndTable(); From c902cd54f8a46b6fb176fef7a8b78da55435e70f Mon Sep 17 00:00:00 2001 From: Stepland <10530295-Buggyroom@users.noreply.gitlab.com> Date: Sun, 24 Mar 2024 22:36:07 +0100 Subject: [PATCH 2/8] Grey out "Save' dialog when filepath not yet chosen --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 1fae599..2ac27df 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -568,7 +568,7 @@ int main() { feis::save_close(editor_state); } ImGui::Separator(); - if (ImGui::MenuItem("Save", "Ctrl+S", false, editor_state.has_value())) { + if (ImGui::MenuItem("Save", "Ctrl+S", false, editor_state.has_value() && editor_state->song_path.has_value())) { feis::force_save(editor_state, notificationsQueue); } if (ImGui::MenuItem("Save As", "", false, editor_state.has_value())) { From accfbc525751b52d50832ec68fe7152933c1823f Mon Sep 17 00:00:00 2001 From: Stepland <10530295-Buggyroom@users.noreply.gitlab.com> Date: Sun, 24 Mar 2024 22:36:18 +0100 Subject: [PATCH 3/8] Turn history view into a table --- src/history.cpp | 84 +++++++++++++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 30 deletions(-) diff --git a/src/history.cpp b/src/history.cpp index 1b4eac4..17f961c 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -1,8 +1,9 @@ #include "history.hpp" #include -#include "colors.hpp" +#include "colors.hpp" +#include "imgui_extras.hpp" std::optional History::pop_previous() { if (previous_actions.empty()) { @@ -34,37 +35,61 @@ void History::push(const History::item& elt) { } void History::display(bool& show) { + const auto dot_columns_width = 60.f; + const auto centered_dot = [&](const sf::Color& c){ + const auto sz = ImGui::GetTextLineHeight(); + const auto pos = ImGui::GetCursorPosX(); + ImGui::SetCursorPosX(pos + (dot_columns_width / 2.f) - (sz / 2.f)); + feis::ColorDot(c); + }; if (ImGui::Begin("History", &show)) { - for (const auto& it : next_actions | std::views::reverse) { - ImGui::TextUnformatted(it->get_message().c_str()); - if (last_saved_action and std::holds_alternative(*last_saved_action)) { - if (std::get(*last_saved_action) == it) { - ImGui::SameLine(); - ImGui::TextColored(colors::green, "saved"); + if (ImGui::BeginTable("History", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg)) { + ImGui::TableSetupColumn("Current", ImGuiTableColumnFlags_WidthFixed, 60.f); + ImGui::TableSetupColumn("Saved", ImGuiTableColumnFlags_WidthFixed, 60.f); + ImGui::TableSetupColumn("Action", ImGuiTableColumnFlags_WidthFixed); + ImGui::TableHeadersRow(); + + for (const auto& it : next_actions | std::views::reverse) { + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(2); + ImGui::TextUnformatted(it->get_message().c_str()); + if (last_saved_action and std::holds_alternative(*last_saved_action)) { + if (std::get(*last_saved_action) == it) { + ImGui::TableSetColumnIndex(1); + centered_dot(colors::green); + } } } - } - for (const auto& it : previous_actions) { - ImGui::TextUnformatted(it->get_message().c_str()); - if (it == *previous_actions.cbegin()) { - ImGui::SameLine(); - ImGui::TextColored(colors::cyan, "current"); - } - if (last_saved_action and std::holds_alternative(*last_saved_action)) { - if (std::get(*last_saved_action) == it) { - ImGui::SameLine(); - ImGui::TextColored(colors::green, "saved"); + + for (const auto& it : previous_actions) { + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(2); + ImGui::TextUnformatted(it->get_message().c_str()); + if (it == *previous_actions.cbegin()) { + ImGui::TableSetColumnIndex(0); + centered_dot(colors::cyan); + } + if (last_saved_action and std::holds_alternative(*last_saved_action)) { + if (std::get(*last_saved_action) == it) { + ImGui::TableSetColumnIndex(1); + centered_dot(colors::green); + } } } - } - ImGui::TextUnformatted("(initial state)"); - if (previous_actions.empty()) { - ImGui::SameLine(); - ImGui::TextColored(colors::cyan, "current"); - } - if (last_saved_action and std::holds_alternative(*last_saved_action)) { - ImGui::SameLine(); - ImGui::TextColored(colors::green, "saved"); + + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(2); + ImGui::TextUnformatted("(initial state)"); + if (previous_actions.empty()) { + ImGui::TableSetColumnIndex(0); + centered_dot(colors::cyan); + } + if (last_saved_action + and std::holds_alternative(*last_saved_action)) { + ImGui::TableSetColumnIndex(1); + centered_dot(colors::green); + } + ImGui::EndTable(); } } ImGui::End(); @@ -74,7 +99,7 @@ void History::mark_as_saved() { if (not previous_actions.empty()) { last_saved_action = previous_actions.front(); } else { - last_saved_action = InitialStateSaved{}; + last_saved_action = InitialStateSaved {}; } } @@ -90,8 +115,7 @@ bool History::current_state_is_saved() const { } else { return false; } - } - }; + }}; return std::visit(is_saved_, *last_saved_action); } } From ea8eb37486705d80a308cab51018ab0e775af83e Mon Sep 17 00:00:00 2001 From: Stepland <10530295-Buggyroom@users.noreply.gitlab.com> Date: Sun, 24 Mar 2024 22:44:33 +0100 Subject: [PATCH 4/8] Update density graph after long note is inserted --- src/editor_state.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/editor_state.cpp b/src/editor_state.cpp index 86137bf..7dd129b 100644 --- a/src/editor_state.cpp +++ b/src/editor_state.cpp @@ -1591,6 +1591,7 @@ void EditorState::insert_long_note_just_created() { reload_sounds_that_depend_on_notes(); reload_editable_range(); reload_colliding_notes(); + chart_state->density_graph.should_recompute = true; } void EditorState::move_backwards_in_time() { From d8eec1064a1d770179482a217d8832d864f91535 Mon Sep 17 00:00:00 2001 From: Stepland <10530295-Buggyroom@users.noreply.gitlab.com> Date: Sun, 24 Mar 2024 22:48:52 +0100 Subject: [PATCH 5/8] changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a3ee24..7580ab1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# v2.0.3 + +## 🚧 Changes 🚧 +- Use a table to display history +- Disable "Save" menu item when the file path has not yet been chosen + +## 🗿 Bugfixes 🗿 +- Fix density graph not updating hen inserting a long note +- Fix some misslabled keys in the Shortcuts window + # v2.0.2 ## 🗿 Bugfixes 🗿 From df3a00a00c619d43c89bcb3424035d0ff011b1a3 Mon Sep 17 00:00:00 2001 From: Stepland <10530295-Buggyroom@users.noreply.gitlab.com> Date: Sun, 24 Mar 2024 23:18:16 +0100 Subject: [PATCH 6/8] Fix typo in data member name --- src/playfield.cpp | 69 ++++++++++++++++++++++++++--------------------- src/playfield.hpp | 2 +- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/playfield.cpp b/src/playfield.cpp index 495cc03..38c6ab4 100644 --- a/src/playfield.cpp +++ b/src/playfield.cpp @@ -106,7 +106,7 @@ void Playfield::draw_tail_and_receptor( long_note.triangle.setTexture(*tex, true); } if (auto tex = long_note.marker.background_at(note_offset)) { - long_note.backgroud.setTexture(*tex, true); + long_note.background.setTexture(*tex, true); } if (auto tex = long_note.marker.outline_at(note_offset)) { long_note.outline.setTexture(*tex, true); @@ -147,50 +147,57 @@ void Playfield::draw_tail_and_receptor( ); } - auto rect = long_note.tail.getTextureRect(); - rect.height = static_cast(rect.height * tail_length_factor); - long_note.tail.setTextureRect(rect); - long_note.tail.setOrigin(rect.width / 2.f, -rect.width / 2.f); - long_note.tail.setRotation(note.get_tail_angle() + 180); - - rect = long_note.triangle.getTextureRect(); - long_note.triangle.setOrigin( - rect.width / 2.f, - rect.width * ( - 0.5f - + OffsetToTriangleDistance.clampedTransform( - note_offset.asSeconds() + { + auto rect = long_note.tail.getTextureRect(); + rect.height = static_cast(rect.height * tail_length_factor); + long_note.tail.setTextureRect(rect); + long_note.tail.setOrigin(rect.width / 2.f, -rect.width / 2.f); + long_note.tail.setRotation(note.get_tail_angle() + 180); + } + { + auto rect = long_note.triangle.getTextureRect(); + long_note.triangle.setOrigin( + rect.width / 2.f, + rect.width * ( + 0.5f + + OffsetToTriangleDistance.clampedTransform( + note_offset.asSeconds() + ) ) - ) - ); - long_note.triangle.setRotation(note.get_tail_angle()); - - rect = long_note.backgroud.getTextureRect(); - long_note.backgroud.setOrigin(rect.width / 2.f, rect.height / 2.f); - long_note.backgroud.setRotation(note.get_tail_angle()); - - rect = long_note.outline.getTextureRect(); - long_note.outline.setOrigin(rect.width / 2.f, rect.height / 2.f); - long_note.outline.setRotation(note.get_tail_angle()); - - rect = long_note.highlight.getTextureRect(); - long_note.highlight.setOrigin(rect.width / 2.f, rect.height / 2.f); + ); + long_note.triangle.setRotation(note.get_tail_angle()); + } + { + auto rect = long_note.background.getTextureRect(); + long_note.background.setOrigin(rect.width / 2.f, rect.height / 2.f); + long_note.background.setRotation(note.get_tail_angle()); + } + { + auto rect = long_note.outline.getTextureRect(); + long_note.outline.setOrigin(rect.width / 2.f, rect.height / 2.f); + long_note.outline.setRotation(note.get_tail_angle()); + } + { + auto rect = long_note.highlight.getTextureRect(); + long_note.highlight.setOrigin(rect.width / 2.f, rect.height / 2.f); + } + auto rect = long_note.highlight.getTextureRect(); const float scale = square_size / rect.width; long_note.tail.setScale(scale, scale); long_note.triangle.setScale(scale, scale); - long_note.backgroud.setScale(scale, scale); + long_note.background.setScale(scale, scale); long_note.outline.setScale(scale, scale); long_note.highlight.setScale(scale, scale); long_note.tail.setPosition((x + 0.5f) * square_size, (y + 0.5f) * square_size); long_note.triangle.setPosition((x + 0.5f) * square_size, (y + 0.5f) * square_size); - long_note.backgroud.setPosition((x + 0.5f) * square_size, (y + 0.5f) * square_size); + long_note.background.setPosition((x + 0.5f) * square_size, (y + 0.5f) * square_size); long_note.outline.setPosition((x + 0.5f) * square_size, (y + 0.5f) * square_size); long_note.highlight.setPosition((x + 0.5f) * square_size, (y + 0.5f) * square_size); long_note.layer.draw(long_note.tail); - long_note.layer.draw(long_note.backgroud); + long_note.layer.draw(long_note.background); long_note.layer.draw(long_note.outline); long_note.layer.draw(long_note.triangle); long_note.layer.draw(long_note.highlight); diff --git a/src/playfield.hpp b/src/playfield.hpp index 526bca3..388c5e1 100644 --- a/src/playfield.hpp +++ b/src/playfield.hpp @@ -34,7 +34,7 @@ public: LNMarker marker; sf::RenderTexture layer; - sf::Sprite backgroud; + sf::Sprite background; sf::Sprite outline; sf::Sprite highlight; sf::Sprite tail; From 4b79c49daf032b5934afb133aada6675cdb08631 Mon Sep 17 00:00:00 2001 From: Stepland <10530295-Buggyroom@users.noreply.gitlab.com> Date: Sun, 24 Mar 2024 23:39:36 +0100 Subject: [PATCH 7/8] Fix long note tail not appearing the very first time a long note is displayed --- CHANGELOG.md | 5 +++-- src/playfield.cpp | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7580ab1..a0033c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,12 @@ # v2.0.3 ## 🚧 Changes 🚧 -- Use a table to display history +- Use a table to display data in the History window - Disable "Save" menu item when the file path has not yet been chosen ## 🗿 Bugfixes 🗿 -- Fix density graph not updating hen inserting a long note +- The first time a chart was viewed, the very first long note tail would not display before playback got past the hit frame, not anymore ! +- Density graph now updates when inserting a long note - Fix some misslabled keys in the Shortcuts window # v2.0.2 diff --git a/src/playfield.cpp b/src/playfield.cpp index 38c6ab4..e242157 100644 --- a/src/playfield.cpp +++ b/src/playfield.cpp @@ -153,6 +153,8 @@ void Playfield::draw_tail_and_receptor( long_note.tail.setTextureRect(rect); long_note.tail.setOrigin(rect.width / 2.f, -rect.width / 2.f); long_note.tail.setRotation(note.get_tail_angle() + 180); + const float scale = square_size / rect.width; + long_note.tail.setScale(scale, scale); } { auto rect = long_note.triangle.getTextureRect(); @@ -166,30 +168,30 @@ void Playfield::draw_tail_and_receptor( ) ); long_note.triangle.setRotation(note.get_tail_angle()); + const float scale = square_size / rect.width; + long_note.triangle.setScale(scale, scale); } { auto rect = long_note.background.getTextureRect(); long_note.background.setOrigin(rect.width / 2.f, rect.height / 2.f); long_note.background.setRotation(note.get_tail_angle()); + const float scale = square_size / rect.width; + long_note.background.setScale(scale, scale); } { auto rect = long_note.outline.getTextureRect(); long_note.outline.setOrigin(rect.width / 2.f, rect.height / 2.f); long_note.outline.setRotation(note.get_tail_angle()); + const float scale = square_size / rect.width; + long_note.outline.setScale(scale, scale); } { auto rect = long_note.highlight.getTextureRect(); long_note.highlight.setOrigin(rect.width / 2.f, rect.height / 2.f); + const float scale = square_size / rect.width; + long_note.highlight.setScale(scale, scale); } - auto rect = long_note.highlight.getTextureRect(); - const float scale = square_size / rect.width; - long_note.tail.setScale(scale, scale); - long_note.triangle.setScale(scale, scale); - long_note.background.setScale(scale, scale); - long_note.outline.setScale(scale, scale); - long_note.highlight.setScale(scale, scale); - long_note.tail.setPosition((x + 0.5f) * square_size, (y + 0.5f) * square_size); long_note.triangle.setPosition((x + 0.5f) * square_size, (y + 0.5f) * square_size); long_note.background.setPosition((x + 0.5f) * square_size, (y + 0.5f) * square_size); From 9f120a488c23b8d07ea12f3e9af565f43f6690e0 Mon Sep 17 00:00:00 2001 From: Stepland <10530295-Buggyroom@users.noreply.gitlab.com> Date: Sun, 24 Mar 2024 23:41:05 +0100 Subject: [PATCH 8/8] bump to v2.0.3 --- meson.build | 2 +- packaging/debian/f.e.i.s-control | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index aa6a615..8eb156f 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,7 @@ project( 'cpp', 'c', meson_version : '>=0.62.0', - version : '2.0.2', +version : '2.0.3', default_options : ['cpp_std=c++20'] ) diff --git a/packaging/debian/f.e.i.s-control b/packaging/debian/f.e.i.s-control index cd779d4..5ea6fed 100644 --- a/packaging/debian/f.e.i.s-control +++ b/packaging/debian/f.e.i.s-control @@ -1,5 +1,5 @@ Package: f.e.i.s -Version: 2.0.2 +Version: 2.0.3 Section: misc Priority: optional Homepage: https://gitlab.com/square-game-liberation-front/F.E.I.S