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 🗿
- 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
## 🗿 Bugfixes 🗿

View File

@ -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']
)

View File

@ -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

View File

@ -1592,6 +1592,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() {
@ -2348,8 +2349,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();

View File

@ -1,8 +1,9 @@
#include "history.hpp"
#include <imgui/imgui.h>
#include "colors.hpp"
#include "colors.hpp"
#include "imgui_extras.hpp"
std::optional<History::item> 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<item>(*last_saved_action)) {
if (std::get<item>(*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<item>(*last_saved_action)) {
if (std::get<item>(*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<item>(*last_saved_action)) {
if (std::get<item>(*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<item>(*last_saved_action)) {
if (std::get<item>(*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<InitialStateSaved>(*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<InitialStateSaved>(*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);
}
}

View File

@ -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())) {

View File

@ -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,59 @@ void Playfield::draw_tail_and_receptor(
);
}
auto rect = long_note.tail.getTextureRect();
rect.height = static_cast<int>(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<int>(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);
const float scale = square_size / rect.width;
long_note.tail.setScale(scale, scale);
}
{
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);
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.highlight.setScale(scale, scale);
);
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);
}
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);

View File

@ -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;