Merge remote-tracking branch 'gitlab/main'

This commit is contained in:
Stepland 2024-05-29 22:00:57 +02:00
commit 34f41e648f
8 changed files with 119 additions and 74 deletions

View File

@ -1,8 +1,19 @@
# v2.0.3 # Unreleased
## 🗿 Bugfixes 🗿 ## 🗿 Bugfixes 🗿
- Draw long note tails behind markers - Draw long note tails behind markers
# v2.0.3
## 🚧 Changes 🚧
- Use a table to display data in the History window
- Disable "Save" menu item when the file path has not yet been chosen
## 🗿 Bugfixes 🗿
- 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 # v2.0.2
## 🗿 Bugfixes 🗿 ## 🗿 Bugfixes 🗿

View File

@ -3,7 +3,7 @@ project(
'cpp', 'cpp',
'c', 'c',
meson_version : '>=0.62.0', meson_version : '>=0.62.0',
version : '2.0.2', version : '2.0.3',
default_options : ['cpp_std=c++20'] default_options : ['cpp_std=c++20']
) )

View File

@ -1,5 +1,5 @@
Package: f.e.i.s Package: f.e.i.s
Version: 2.0.2 Version: 2.0.3
Section: misc Section: misc
Priority: optional Priority: optional
Homepage: https://gitlab.com/square-game-liberation-front/F.E.I.S Homepage: https://gitlab.com/square-game-liberation-front/F.E.I.S

View File

@ -1592,6 +1592,7 @@ void EditorState::insert_long_note_just_created() {
reload_sounds_that_depend_on_notes(); reload_sounds_that_depend_on_notes();
reload_editable_range(); reload_editable_range();
reload_colliding_notes(); reload_colliding_notes();
chart_state->density_graph.should_recompute = true;
} }
void EditorState::move_backwards_in_time() { void EditorState::move_backwards_in_time() {
@ -2348,8 +2349,8 @@ void feis::display_shortcuts_help(bool& show) {
) { ) {
table_header(); table_header();
table_shortcut("Play / Pause", "Space"); table_shortcut("Play / Pause", "Space");
table_shortcut("Move Backwards In Time", "Down"); table_shortcut("Move Backwards In Time", "Up");
table_shortcut("Move Forwards In Time", "Up"); table_shortcut("Move Forwards In Time", "Down");
table_shortcut("Decrease Snap", "Left"); table_shortcut("Decrease Snap", "Left");
table_shortcut("Increase Snap", "Right"); table_shortcut("Increase Snap", "Right");
ImGui::EndTable(); ImGui::EndTable();

View File

@ -1,8 +1,9 @@
#include "history.hpp" #include "history.hpp"
#include <imgui/imgui.h> #include <imgui/imgui.h>
#include "colors.hpp"
#include "colors.hpp"
#include "imgui_extras.hpp"
std::optional<History::item> History::pop_previous() { std::optional<History::item> History::pop_previous() {
if (previous_actions.empty()) { if (previous_actions.empty()) {
@ -34,37 +35,61 @@ void History::push(const History::item& elt) {
} }
void History::display(bool& show) { 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)) { if (ImGui::Begin("History", &show)) {
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) { for (const auto& it : next_actions | std::views::reverse) {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(2);
ImGui::TextUnformatted(it->get_message().c_str()); ImGui::TextUnformatted(it->get_message().c_str());
if (last_saved_action and std::holds_alternative<item>(*last_saved_action)) { if (last_saved_action and std::holds_alternative<item>(*last_saved_action)) {
if (std::get<item>(*last_saved_action) == it) { if (std::get<item>(*last_saved_action) == it) {
ImGui::SameLine(); ImGui::TableSetColumnIndex(1);
ImGui::TextColored(colors::green, "saved"); centered_dot(colors::green);
} }
} }
} }
for (const auto& it : previous_actions) { for (const auto& it : previous_actions) {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(2);
ImGui::TextUnformatted(it->get_message().c_str()); ImGui::TextUnformatted(it->get_message().c_str());
if (it == *previous_actions.cbegin()) { if (it == *previous_actions.cbegin()) {
ImGui::SameLine(); ImGui::TableSetColumnIndex(0);
ImGui::TextColored(colors::cyan, "current"); centered_dot(colors::cyan);
} }
if (last_saved_action and std::holds_alternative<item>(*last_saved_action)) { if (last_saved_action and std::holds_alternative<item>(*last_saved_action)) {
if (std::get<item>(*last_saved_action) == it) { if (std::get<item>(*last_saved_action) == it) {
ImGui::SameLine(); ImGui::TableSetColumnIndex(1);
ImGui::TextColored(colors::green, "saved"); centered_dot(colors::green);
} }
} }
} }
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(2);
ImGui::TextUnformatted("(initial state)"); ImGui::TextUnformatted("(initial state)");
if (previous_actions.empty()) { if (previous_actions.empty()) {
ImGui::SameLine(); ImGui::TableSetColumnIndex(0);
ImGui::TextColored(colors::cyan, "current"); centered_dot(colors::cyan);
} }
if (last_saved_action and std::holds_alternative<InitialStateSaved>(*last_saved_action)) { if (last_saved_action
ImGui::SameLine(); and std::holds_alternative<InitialStateSaved>(*last_saved_action)) {
ImGui::TextColored(colors::green, "saved"); ImGui::TableSetColumnIndex(1);
centered_dot(colors::green);
}
ImGui::EndTable();
} }
} }
ImGui::End(); ImGui::End();
@ -90,8 +115,7 @@ bool History::current_state_is_saved() const {
} else { } else {
return false; return false;
} }
} }};
};
return std::visit(is_saved_, *last_saved_action); return std::visit(is_saved_, *last_saved_action);
} }
} }

View File

@ -568,7 +568,7 @@ int main() {
feis::save_close(editor_state); feis::save_close(editor_state);
} }
ImGui::Separator(); 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); feis::force_save(editor_state, notificationsQueue);
} }
if (ImGui::MenuItem("Save As", "", false, editor_state.has_value())) { if (ImGui::MenuItem("Save As", "", false, editor_state.has_value())) {

View File

@ -106,7 +106,7 @@ void Playfield::draw_tail_and_receptor(
long_note.triangle.setTexture(*tex, true); long_note.triangle.setTexture(*tex, true);
} }
if (auto tex = long_note.marker.background_at(note_offset)) { 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)) { if (auto tex = long_note.marker.outline_at(note_offset)) {
long_note.outline.setTexture(*tex, true); long_note.outline.setTexture(*tex, true);
@ -147,13 +147,17 @@ void Playfield::draw_tail_and_receptor(
); );
} }
{
auto rect = long_note.tail.getTextureRect(); auto rect = long_note.tail.getTextureRect();
rect.height = static_cast<int>(rect.height * tail_length_factor); rect.height = static_cast<int>(rect.height * tail_length_factor);
long_note.tail.setTextureRect(rect); long_note.tail.setTextureRect(rect);
long_note.tail.setOrigin(rect.width / 2.f, -rect.width / 2.f); long_note.tail.setOrigin(rect.width / 2.f, -rect.width / 2.f);
long_note.tail.setRotation(note.get_tail_angle() + 180); long_note.tail.setRotation(note.get_tail_angle() + 180);
const float scale = square_size / rect.width;
rect = long_note.triangle.getTextureRect(); long_note.tail.setScale(scale, scale);
}
{
auto rect = long_note.triangle.getTextureRect();
long_note.triangle.setOrigin( long_note.triangle.setOrigin(
rect.width / 2.f, rect.width / 2.f,
rect.width * ( rect.width * (
@ -164,33 +168,38 @@ void Playfield::draw_tail_and_receptor(
) )
); );
long_note.triangle.setRotation(note.get_tail_angle()); long_note.triangle.setRotation(note.get_tail_angle());
const float scale = square_size / rect.width;
rect = long_note.backgroud.getTextureRect(); long_note.triangle.setScale(scale, scale);
long_note.backgroud.setOrigin(rect.width / 2.f, rect.height / 2.f); }
long_note.backgroud.setRotation(note.get_tail_angle()); {
auto rect = long_note.background.getTextureRect();
rect = long_note.outline.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.setOrigin(rect.width / 2.f, rect.height / 2.f);
long_note.outline.setRotation(note.get_tail_angle()); 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);
const float scale = square_size / rect.width; 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.outline.setScale(scale, scale); 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); long_note.highlight.setScale(scale, scale);
}
long_note.tail.setPosition((x + 0.5f) * square_size, (y + 0.5f) * square_size); 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.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.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.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.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.outline);
long_note.layer.draw(long_note.triangle); long_note.layer.draw(long_note.triangle);
long_note.layer.draw(long_note.highlight); long_note.layer.draw(long_note.highlight);

View File

@ -34,7 +34,7 @@ public:
LNMarker marker; LNMarker marker;
sf::RenderTexture layer; sf::RenderTexture layer;
sf::Sprite backgroud; sf::Sprite background;
sf::Sprite outline; sf::Sprite outline;
sf::Sprite highlight; sf::Sprite highlight;
sf::Sprite tail; sf::Sprite tail;