Save linear view colors in config

This commit is contained in:
Stepland 2022-11-19 01:43:37 +01:00
parent eb16029370
commit 04654e268f
9 changed files with 203 additions and 193 deletions

48
src/colors.hpp Normal file
View File

@ -0,0 +1,48 @@
#pragma once
#include <SFML/Graphics/Color.hpp>
struct ButtonColors {
sf::Color text;
sf::Color button;
sf::Color hover;
sf::Color active;
sf::Color border;
};
struct RectangleColors {
sf::Color fill;
sf::Color border;
};
struct LinearViewColors {
sf::Color cursor = {66, 150, 250, 170};
RectangleColors tab_selection = {
.fill = {153, 255, 153, 92},
.border = {153, 255, 153, 189}
};
sf::Color normal_tap_note = {255, 213, 0};
sf::Color conflicting_tap_note = {255, 167, 0};
sf::Color normal_collision_zone = {230, 179, 0, 80};
sf::Color conflicting_collision_zone = {255, 0, 0, 145};
sf::Color normal_long_note = {255, 90, 0, 223};
sf::Color conflicting_long_note = {255, 26, 0};
sf::Color selected_note_fill = {255, 255, 255, 127};
sf::Color selected_note_outline = sf::Color::White;
sf::Color measure_line = sf::Color::White;
sf::Color measure_number = sf::Color::White;
sf::Color beat_line = {255, 255, 255, 127};
ButtonColors bpm_button = {
.text = {66, 150, 250},
.button = sf::Color::Transparent,
.hover = {66, 150, 250, 64},
.active = {66, 150, 250, 127},
.border = {109, 179, 251}
};
RectangleColors selection_rect = {
.fill = {144, 189, 255, 64},
.border = {144, 189, 255}
};
};
inline const LinearViewColors default_linear_view_colors = {};

View File

@ -3,8 +3,10 @@
#include <SFML/Config.hpp>
#include <filesystem>
#include <fmt/format.h>
#include <toml++/toml.h>
#include "colors.hpp"
#include "marker.hpp"
#include "toml++/impl/node_view.h"
toml::array config::dump_color(const sf::Color& color) {
return toml::array{color.r, color.g, color.b, color.a};
@ -83,59 +85,61 @@ void config::Marker::dump_as_v1_0_0(toml::table &tbl) {
tbl.insert_or_assign("marker", marker_table);
}
void config::LinearViewColors::load_from_v1_0_0_table(const toml::table& linear_view) {
const auto colors = linear_view["colors"];
load_color(colors["cursor"], cursor);
load_color(colors["tab_selection"]["fill"], tab_selection.fill);
load_color(colors["tab_selection"]["border"], tab_selection.border);
load_color(colors["normal_tap_note"], normal_tap_note);
load_color(colors["conflicting_tap_note"], conflicting_tap_note);
load_color(colors["normal_collision_zone"], normal_collision_zone);
load_color(colors["conflicting_collision_zone"], conflicting_collision_zone);
load_color(colors["normal_long_note"], normal_long_note);
load_color(colors["conflicting_long_note"], conflicting_long_note);
load_color(colors["selected_note_fill"], selected_note_fill);
load_color(colors["selected_note_outline"], selected_note_outline);
load_color(colors["measure_line"], measure_line);
load_color(colors["measure_number"], measure_number);
load_color(colors["beat_line"], beat_line);
load_color(colors["bpm_button"]["text"], bpm_button.text);
load_color(colors["bpm_button"]["button"], bpm_button.button);
load_color(colors["bpm_button"]["hover"], bpm_button.hover);
load_color(colors["bpm_button"]["active"], bpm_button.active);
load_color(colors["bpm_button"]["border"], bpm_button.border);
load_color(colors["selection_rect"]["fill"], selection_rect.fill);
load_color(colors["selection_rect"]["border"], selection_rect.border);
LinearViewColors config::load_linear_view_colors_from_v1_0_0_table(const toml::table& linear_view) {
auto colors = default_linear_view_colors;
const auto colors_node = linear_view["colors"];
load_color(colors_node["cursor"], colors.cursor);
load_color(colors_node["tab_selection"]["fill"], colors.tab_selection.fill);
load_color(colors_node["tab_selection"]["border"], colors.tab_selection.border);
load_color(colors_node["normal_tap_note"], colors.normal_tap_note);
load_color(colors_node["conflicting_tap_note"], colors.conflicting_tap_note);
load_color(colors_node["normal_collision_zone"], colors.normal_collision_zone);
load_color(colors_node["conflicting_collision_zone"], colors.conflicting_collision_zone);
load_color(colors_node["normal_long_note"], colors.normal_long_note);
load_color(colors_node["conflicting_long_note"], colors.conflicting_long_note);
load_color(colors_node["selected_note_fill"], colors.selected_note_fill);
load_color(colors_node["selected_note_outline"], colors.selected_note_outline);
load_color(colors_node["measure_line"], colors.measure_line);
load_color(colors_node["measure_number"], colors.measure_number);
load_color(colors_node["beat_line"], colors.beat_line);
load_color(colors_node["bpm_button"]["text"], colors.bpm_button.text);
load_color(colors_node["bpm_button"]["button"], colors.bpm_button.button);
load_color(colors_node["bpm_button"]["hover"], colors.bpm_button.hover);
load_color(colors_node["bpm_button"]["active"], colors.bpm_button.active);
load_color(colors_node["bpm_button"]["border"], colors.bpm_button.border);
load_color(colors_node["selection_rect"]["fill"], colors.selection_rect.fill);
load_color(colors_node["selection_rect"]["border"], colors.selection_rect.border);
return colors;
}
void config::LinearViewColors::dump_as_v1_0_0(toml::table& linear_view) {
void config::dump_linear_view_colors_as_v1_0_0(const LinearViewColors& colors, toml::table& linear_view) {
toml::table colors_table{
{"cursor", dump_color(cursor)},
{"cursor", dump_color(colors.cursor)},
{"tab_selection", toml::table{
{"fill", dump_color(tab_selection.fill)},
{"border", dump_color(tab_selection.border)},
{"fill", dump_color(colors.tab_selection.fill)},
{"border", dump_color(colors.tab_selection.border)},
}},
{"normal_tap_note", dump_color(normal_tap_note)},
{"conflicting_tap_note", dump_color(conflicting_tap_note)},
{"normal_collision_zone", dump_color(normal_collision_zone)},
{"conflicting_collision_zone", dump_color(conflicting_collision_zone)},
{"normal_long_note", dump_color(normal_long_note)},
{"conflicting_long_note", dump_color(conflicting_long_note)},
{"selected_note_fill", dump_color(selected_note_fill)},
{"selected_note_outline", dump_color(selected_note_outline)},
{"measure_line", dump_color(measure_line)},
{"measure_number", dump_color(measure_number)},
{"beat_line", dump_color(beat_line)},
{"normal_tap_note", dump_color(colors.normal_tap_note)},
{"conflicting_tap_note", dump_color(colors.conflicting_tap_note)},
{"normal_collision_zone", dump_color(colors.normal_collision_zone)},
{"conflicting_collision_zone", dump_color(colors.conflicting_collision_zone)},
{"normal_long_note", dump_color(colors.normal_long_note)},
{"conflicting_long_note", dump_color(colors.conflicting_long_note)},
{"selected_note_fill", dump_color(colors.selected_note_fill)},
{"selected_note_outline", dump_color(colors.selected_note_outline)},
{"measure_line", dump_color(colors.measure_line)},
{"measure_number", dump_color(colors.measure_number)},
{"beat_line", dump_color(colors.beat_line)},
{"bpm_button", toml::table{
{"text", dump_color(bpm_button.text)},
{"button", dump_color(bpm_button.button)},
{"hover", dump_color(bpm_button.hover)},
{"active", dump_color(bpm_button.active)},
{"border", dump_color(bpm_button.border)},
{"text", dump_color(colors.bpm_button.text)},
{"button", dump_color(colors.bpm_button.button)},
{"hover", dump_color(colors.bpm_button.hover)},
{"active", dump_color(colors.bpm_button.active)},
{"border", dump_color(colors.bpm_button.border)},
}},
{"selection_rect", toml::table{
{"fill", dump_color(selection_rect.fill)},
{"border", dump_color(selection_rect.border)},
{"fill", dump_color(colors.selection_rect.fill)},
{"border", dump_color(colors.selection_rect.border)},
}}
};
linear_view.insert_or_assign("colors", colors_table);
@ -143,13 +147,13 @@ void config::LinearViewColors::dump_as_v1_0_0(toml::table& linear_view) {
void config::LinearView::load_from_v1_0_0_table(const toml::table& tbl) {
if (tbl["linear_view"].is_table()) {
colors.load_from_v1_0_0_table(tbl["linear_view"].ref<toml::table>());
colors = load_linear_view_colors_from_v1_0_0_table(tbl["linear_view"].ref<toml::table>());
}
}
void config::LinearView::dump_as_v1_0_0(toml::table& tbl) {
toml::table linear_view;
colors.dump_as_v1_0_0(linear_view);
dump_linear_view_colors_as_v1_0_0(colors, linear_view);
tbl.insert_or_assign("linear_view", linear_view);
}

View File

@ -4,8 +4,8 @@
#include <toml++/toml.h>
#include "colors.hpp"
#include "marker.hpp"
#include "widgets/linear_view.hpp"
namespace config {
@ -23,38 +23,8 @@ namespace config {
void dump_as_v1_0_0(toml::table& tbl);
};
struct LinearViewColors {
sf::Color cursor = {66, 150, 250, 170};
RectangleColors tab_selection = {
.fill = {153, 255, 153, 92},
.border = {153, 255, 153, 189}
};
sf::Color normal_tap_note = {255, 213, 0};
sf::Color conflicting_tap_note = {255, 167, 0};
sf::Color normal_collision_zone = {230, 179, 0, 80};
sf::Color conflicting_collision_zone = {255, 0, 0, 145};
sf::Color normal_long_note = {255, 90, 0, 223};
sf::Color conflicting_long_note = {255, 26, 0};
sf::Color selected_note_fill = {255, 255, 255, 127};
sf::Color selected_note_outline = sf::Color::White;
sf::Color measure_line = sf::Color::White;
sf::Color measure_number = sf::Color::White;
sf::Color beat_line = {255, 255, 255, 127};
ButtonColors bpm_button = {
.text = {66, 150, 250},
.button = sf::Color::Transparent,
.hover = {66, 150, 250, 64},
.active = {66, 150, 250, 127},
.border = {109, 179, 251}
};
RectangleColors selection_rect = {
.fill = {144, 189, 255, 64},
.border = {144, 189, 255}
};
void load_from_v1_0_0_table(const toml::table& linear_view);
void dump_as_v1_0_0(toml::table& linear_view);
};
LinearViewColors load_linear_view_colors_from_v1_0_0_table(const toml::table& linear_view);
void dump_linear_view_colors_as_v1_0_0(const LinearViewColors& colors, toml::table& linear_view);
struct LinearView {
LinearViewColors colors;

View File

@ -40,12 +40,13 @@
#include "src/custom_sfml_audio/synced_sound_streams.hpp"
#include "variant_visitor.hpp"
EditorState::EditorState(const std::filesystem::path& assets_) :
EditorState::EditorState(const std::filesystem::path& assets_, config::Config& config_) :
config(config_),
note_claps(std::make_shared<NoteClaps>(nullptr, nullptr, assets_, 1.f)),
chord_claps(std::make_shared<ChordClaps>(nullptr, nullptr, assets_, 1.f)),
beat_ticks(std::make_shared<BeatTicks>(nullptr, assets_, 1.f)),
playfield(assets_),
linear_view(assets_),
linear_view(assets_, config_.linear_view),
applicable_timing(song.timing),
assets(assets_)
{
@ -56,15 +57,17 @@ EditorState::EditorState(const std::filesystem::path& assets_) :
EditorState::EditorState(
const better::Song& song_,
const std::filesystem::path& assets_,
const std::filesystem::path& song_path = {}
const std::filesystem::path& song_path_,
config::Config& config_
) :
config(config_),
song(song_),
song_path(song_path),
song_path(song_path_),
note_claps(std::make_shared<NoteClaps>(nullptr, nullptr, assets_, 1.f)),
chord_claps(std::make_shared<ChordClaps>(nullptr, nullptr, assets_, 1.f)),
beat_ticks(std::make_shared<BeatTicks>(nullptr, assets_, 1.f)),
playfield(assets_),
linear_view(assets_),
linear_view(assets_, config_.linear_view),
applicable_timing(song.timing),
assets(assets_)
{
@ -1524,14 +1527,15 @@ void feis::force_save(
void feis::save_ask_open(
std::optional<EditorState>& ed,
const std::filesystem::path& assets,
const std::filesystem::path& settings
const std::filesystem::path& settings,
config::Config& config
) {
if (ed and ed->save_if_needed_and_user_wants_to() == EditorState::SaveOutcome::UserCanceled) {
return;
}
if (const auto& filepath = feis::open_file_dialog()) {
feis::open_from_file(ed, *filepath, assets, settings);
feis::open_from_file(ed, *filepath, assets, settings, config);
}
};
@ -1540,13 +1544,14 @@ void feis::save_open(
std::optional<EditorState>& ed,
const std::filesystem::path& song_path,
const std::filesystem::path& assets,
const std::filesystem::path& settings
const std::filesystem::path& settings,
config::Config& config
) {
if (ed and ed->save_if_needed_and_user_wants_to() == EditorState::SaveOutcome::UserCanceled) {
return;
}
feis::open_from_file(ed, song_path, assets, settings);
feis::open_from_file(ed, song_path, assets, settings, config);
};
@ -1554,7 +1559,8 @@ void feis::open_from_file(
std::optional<EditorState>& ed,
const std::filesystem::path& song_path,
const std::filesystem::path& assets,
const std::filesystem::path& settings
const std::filesystem::path& settings,
config::Config& config
) {
try {
// force utf-8 song path on windows
@ -1571,7 +1577,7 @@ void feis::open_from_file(
};
const auto json = load_json_preserving_decimals(f);
auto song = better::Song::load_from_memon(json);
ed.emplace(song, assets, song_path);
ed.emplace(song, assets, song_path, config);
Toolbox::pushNewRecentFile(std::filesystem::canonical(song_path), settings);
} catch (const std::exception& e) {
tinyfd_messageBox("Error", e.what(), "ok", "error", 1);

View File

@ -9,6 +9,7 @@
#include <type_traits>
#include "config.hpp"
#include "custom_sfml_audio/beat_ticks.hpp"
#include "custom_sfml_audio/chord_claps.hpp"
#include "custom_sfml_audio/note_claps.hpp"
@ -38,13 +39,19 @@ const std::string beat_tick_stream = "beat_tick";
*/
class EditorState {
public:
explicit EditorState(const std::filesystem::path& assets);
explicit EditorState(
const std::filesystem::path& assets,
config::Config& config
);
EditorState(
const better::Song& song,
const std::filesystem::path& assets,
const std::filesystem::path& save_path
const std::filesystem::path& save_path,
config::Config& config
);
config::Config& config;
History history;
better::Song song;
@ -258,21 +265,24 @@ namespace feis {
void save_ask_open(
std::optional<EditorState>& ed,
const std::filesystem::path& assets,
const std::filesystem::path& settings
const std::filesystem::path& settings,
config::Config& config
);
void save_open(
std::optional<EditorState>& ed,
const std::filesystem::path& file,
const std::filesystem::path& assets,
const std::filesystem::path& settings
const std::filesystem::path& settings,
config::Config& config
);
void open_from_file(
std::optional<EditorState>& ed,
const std::filesystem::path& file,
const std::filesystem::path& assets,
const std::filesystem::path& settings
const std::filesystem::path& settings,
config::Config& config
);
void save_close(std::optional<EditorState>& ed);

View File

@ -11,7 +11,11 @@
#include "special_numeric_types.hpp"
namespace feis {
bool ColorEdit4(const char* label, sf::Color& col, ImGuiColorEditFlags flags = 0);
bool ColorEdit4(
const char* label,
sf::Color& col,
ImGuiColorEditFlags flags = ImGuiColorEditFlags_AlphaPreviewHalf
);
bool InputDecimal(
const char *label,
Decimal* value,

View File

@ -364,7 +364,7 @@ int main() {
break;
case sf::Keyboard::O:
if (event.key.control) {
feis::save_ask_open(editor_state, assets_folder, settings_folder);
feis::save_ask_open(editor_state, assets_folder, settings_folder, config);
}
break;
case sf::Keyboard::P:
@ -508,23 +508,23 @@ int main() {
if (ImGui::BeginMenu("File")) {
if (ImGui::MenuItem("New")) {
if (not editor_state) {
editor_state.emplace(assets_folder);
editor_state.emplace(assets_folder, config);
} else {
if (editor_state->save_if_needed_and_user_wants_to() != EditorState::SaveOutcome::UserCanceled) {
editor_state.emplace(assets_folder);
editor_state.emplace(assets_folder, config);
}
}
}
ImGui::Separator();
if (ImGui::MenuItem("Open", "Ctrl+O")) {
feis::save_ask_open(editor_state, assets_folder, settings_folder);
feis::save_ask_open(editor_state, assets_folder, settings_folder, config);
}
if (ImGui::BeginMenu("Recent Files")) {
int i = 0;
for (const auto& file : Toolbox::getRecentFiles(settings_folder)) {
ImGui::PushID(i);
if (ImGui::MenuItem(file.c_str())) {
feis::save_open(editor_state, file, assets_folder, settings_folder);
feis::save_open(editor_state, file, assets_folder, settings_folder, config);
}
ImGui::PopID();
++i;

View File

@ -20,14 +20,16 @@
#include <imgui_internal.h>
#include <SFML/System/Time.hpp>
#include "../better_timing.hpp"
#include "../better_note.hpp"
#include "../chart_state.hpp"
#include "../colors.hpp"
#include "../imgui_extras.hpp"
#include "../long_note_dummy.hpp"
#include "../special_numeric_types.hpp"
#include "../toolbox.hpp"
#include "../chart_state.hpp"
#include "../long_note_dummy.hpp"
#include "../variant_visitor.hpp"
#include "better_note.hpp"
#include "src/better_timing.hpp"
#include "src/imgui_extras.hpp"
const std::string font_file = "fonts/NotoSans-Medium.ttf";
@ -36,7 +38,8 @@ void SelectionRectangle::reset() {
end = {-1, -1};
}
LinearView::LinearView(std::filesystem::path assets) :
LinearView::LinearView(std::filesystem::path assets, config::LinearView& config_) :
colors(config_.colors),
beats_to_pixels_proportional(0, 1, 0, 100),
lane_order(LaneOrderPresets::Default{})
{}
@ -88,19 +91,19 @@ void LinearView::draw(
const sf::Vector2f beat_line_start = {timeline_left, static_cast<float>(static_cast<double>(next_beat_line_y))};
const sf::Vector2f beat_line_end = beat_line_start + sf::Vector2f{timeline_width, 0};
if (next_beat % 4 == 0) {
draw_list->AddLine(beat_line_start + origin, beat_line_end + origin, ImColor(measure_lines_color));
draw_list->AddLine(beat_line_start + origin, beat_line_end + origin, ImColor(colors.measure_line));
const Fraction measure = next_beat / 4;
const auto measure_string = fmt::format("{}", static_cast<std::int64_t>(measure));
const sf::Vector2f text_size = ImGui::CalcTextSize(measure_string.c_str(), measure_string.c_str()+measure_string.size());
const sf::Vector2f measure_text_pos = {timeline_left - 10, static_cast<float>(static_cast<double>(next_beat_line_y))};
draw_list->AddText(
origin + measure_text_pos - sf::Vector2f{text_size.x, text_size.y * 0.5f},
ImColor(measure_numbers_color),
ImColor(colors.measure_number),
measure_string.c_str(),
measure_string.c_str() + measure_string.size()
);
} else {
draw_list->AddLine(beat_line_start + origin, beat_line_end + origin, ImColor(beat_lines_color));
draw_list->AddLine(beat_line_start + origin, beat_line_end + origin, ImColor(colors.beat_line));
}
}
@ -116,7 +119,7 @@ void LinearView::draw(
const sf::Vector2f bpm_text_raw_pos = {bpm_events_left, static_cast<float>(static_cast<double>(bpm_change_y))};
const auto bpm_at_beat = better::BPMAtBeat{event.get_bpm(), event.get_beats()};
const auto selected = chart_state.selected_stuff.bpm_events.contains(bpm_at_beat);
if (BPMButton(event, selected, bpm_text_raw_pos, bpm_button_colors)) {
if (BPMButton(event, selected, bpm_text_raw_pos, colors.bpm_button)) {
if (selected) {
chart_state.selected_stuff.bpm_events.erase(bpm_at_beat);
} else {
@ -159,11 +162,11 @@ void LinearView::draw(
collizion_zone_width,
static_cast<float>(static_cast<double>(collision_zone_height))
};
auto collision_zone_color = normal_collision_zone_color;
auto tap_note_color = normal_tap_note_color;
auto collision_zone_color = colors.normal_collision_zone;
auto tap_note_color = colors.normal_tap_note;
if (chart_state.chart.notes->is_colliding(tap_note, timing)) {
collision_zone_color = conflicting_collision_zone_color;
tap_note_color = conflicting_tap_note_color;
collision_zone_color = colors.conflicting_collision_zone;
tap_note_color = colors.conflicting_tap_note;
}
draw_rectangle(
draw_list,
@ -186,8 +189,8 @@ void LinearView::draw(
origin + note_pos,
selected_note_size,
{0.5f, 0.5f},
selected_note_fill,
selected_note_outline
colors.selected_note_fill,
colors.selected_note_outline
);
}
},
@ -213,13 +216,13 @@ void LinearView::draw(
collizion_zone_width,
static_cast<float>(static_cast<double>(collision_zone_height))
};
auto collision_zone_color = normal_collision_zone_color;
auto tap_note_color = normal_tap_note_color;
auto long_note_color = normal_long_note_color;
auto collision_zone_color = colors.normal_collision_zone;
auto tap_note_color = colors.normal_tap_note;
auto long_note_color = colors.normal_long_note;
if (chart_state.chart.notes->is_colliding(long_note, timing)) {
collision_zone_color = conflicting_collision_zone_color;
tap_note_color = conflicting_tap_note_color;
long_note_color = conflicting_long_note_color;
collision_zone_color = colors.conflicting_collision_zone;
tap_note_color = colors.conflicting_tap_note;
long_note_color = colors.conflicting_long_note;
}
draw_rectangle(
draw_list,
@ -254,8 +257,8 @@ void LinearView::draw(
origin + note_pos,
selected_note_size,
{0.5f, 0.5f},
selected_note_fill,
selected_note_outline
colors.selected_note_fill,
colors.selected_note_outline
);
}
},
@ -292,7 +295,7 @@ void LinearView::draw(
origin + cursor_pos,
cursor_size,
{0, 0.5},
cursor_color
colors.cursor
);
// Draw the time selection
@ -316,8 +319,8 @@ void LinearView::draw(
origin + selection_pos,
selection_size,
{0, 0},
tab_selection_colors.fill,
tab_selection_colors.border
colors.tab_selection.fill,
colors.tab_selection.border
);
}
}
@ -343,7 +346,7 @@ void LinearView::draw(
draw_list,
selection_rectangle.start,
selection_rectangle.end,
selection_rect_colors
colors.selection_rect
)
) {
chart_state.selected_stuff.clear();
@ -427,37 +430,40 @@ void LinearView::display_settings() {
}
}
if (ImGui::CollapsingHeader("Colors##Linear View Settings")) {
feis::ColorEdit4("Cursor", cursor_color);
feis::ColorEdit4("Measure Lines", measure_lines_color);
feis::ColorEdit4("Measure Numbers", measure_numbers_color);
feis::ColorEdit4("Beat Lines", beat_lines_color);
if (ImGui::Button("Reset##Colors##Linear View Settings")) {
colors = default_linear_view_colors;
}
feis::ColorEdit4("Cursor", colors.cursor);
feis::ColorEdit4("Measure Lines", colors.measure_line);
feis::ColorEdit4("Measure Numbers", colors.measure_number);
feis::ColorEdit4("Beat Lines", colors.beat_line);
if (ImGui::TreeNode("Selection Rectangle")) {
feis::ColorEdit4("Fill##Selection Rectangle Colors", selection_rect_colors.fill);
feis::ColorEdit4("Border##Selection Rectangle Colors", selection_rect_colors.border);
feis::ColorEdit4("Fill##Selection Rectangle Colors", colors.selection_rect.fill);
feis::ColorEdit4("Border##Selection Rectangle Colors", colors.selection_rect.border);
ImGui::TreePop();
}
if (ImGui::TreeNode("BPM Events##Color settings")) {
feis::ColorEdit4("Text##BPM Event Color", bpm_button_colors.text);
feis::ColorEdit4("Button##BPM Event Color", bpm_button_colors.button);
feis::ColorEdit4("Hover##BPM Event Color", bpm_button_colors.hover);
feis::ColorEdit4("Active##BPM Event Color", bpm_button_colors.active);
feis::ColorEdit4("Border##BPM Event Color", bpm_button_colors.border);
feis::ColorEdit4("Text##BPM Event Color", colors.bpm_button.text);
feis::ColorEdit4("Button##BPM Event Color", colors.bpm_button.button);
feis::ColorEdit4("Hover##BPM Event Color", colors.bpm_button.hover);
feis::ColorEdit4("Active##BPM Event Color", colors.bpm_button.active);
feis::ColorEdit4("Border##BPM Event Color", colors.bpm_button.border);
ImGui::TreePop();
}
if (ImGui::TreeNode("Tab Selection##Color settings")) {
feis::ColorEdit4("Fill##Tab Selection", tab_selection_colors.fill);
feis::ColorEdit4("Border##Tab Selection", tab_selection_colors.border);
feis::ColorEdit4("Fill##Tab Selection", colors.tab_selection.fill);
feis::ColorEdit4("Border##Tab Selection", colors.tab_selection.border);
ImGui::TreePop();
}
if (ImGui::TreeNode("Notes##Color settings tree element")) {
feis::ColorEdit4("Note##Color settings", normal_tap_note_color);
feis::ColorEdit4("Note (conflict)##Color settings", conflicting_tap_note_color);
feis::ColorEdit4("Collision Zone##Color settings", normal_collision_zone_color);
feis::ColorEdit4("Collision Zone (conflict)##Color settings", conflicting_collision_zone_color);
feis::ColorEdit4("Long Tail##Color settings", normal_long_note_color);
feis::ColorEdit4("Long Tail (conflict)##Color settings", conflicting_long_note_color);
feis::ColorEdit4("Selected Fill##Color settings", selected_note_fill);
feis::ColorEdit4("Selected Outline##Color settings", selected_note_outline);
feis::ColorEdit4("Note##Color settings", colors.normal_tap_note);
feis::ColorEdit4("Note (conflict)##Color settings", colors.conflicting_tap_note);
feis::ColorEdit4("Collision Zone##Color settings", colors.normal_collision_zone);
feis::ColorEdit4("Collision Zone (conflict)##Color settings", colors.conflicting_collision_zone);
feis::ColorEdit4("Long Tail##Color settings", colors.normal_long_note);
feis::ColorEdit4("Long Tail (conflict)##Color settings", colors.conflicting_long_note);
feis::ColorEdit4("Selected Fill##Color settings", colors.selected_note_fill);
feis::ColorEdit4("Selected Outline##Color settings", colors.selected_note_outline);
ImGui::TreePop();
}
}

View File

@ -9,21 +9,9 @@
#include "../better_timing.hpp"
#include "../chart_state.hpp"
#include "../toolbox.hpp"
#include "config.hpp"
#include "imgui.h"
struct ButtonColors {
sf::Color text;
sf::Color button;
sf::Color hover;
sf::Color active;
sf::Color border;
};
struct RectangleColors {
sf::Color fill;
sf::Color border;
};
struct SelectionRectangle {
sf::Vector2f start = {-1, -1};
sf::Vector2f end = {-1, -1};
@ -33,7 +21,7 @@ struct SelectionRectangle {
class LinearView {
public:
LinearView(std::filesystem::path assets);
LinearView(std::filesystem::path assets, config::LinearView& config);
void draw(
ImDrawList* draw_list,
@ -56,33 +44,7 @@ public:
void display_settings();
private:
sf::Color cursor_color = {66, 150, 250, 170};
RectangleColors tab_selection_colors = {
.fill = {153, 255, 153, 92},
.border = {153, 255, 153, 189}
};
sf::Color normal_tap_note_color = {255, 213, 0};
sf::Color conflicting_tap_note_color = {255, 167, 0};
sf::Color normal_collision_zone_color = {230, 179, 0, 80};
sf::Color conflicting_collision_zone_color = {255, 0, 0, 145};
sf::Color normal_long_note_color = {255, 90, 0, 223};
sf::Color conflicting_long_note_color = {255, 26, 0};
sf::Color selected_note_fill = {255, 255, 255, 127};
sf::Color selected_note_outline = sf::Color::White;
sf::Color measure_lines_color = sf::Color::White;
sf::Color measure_numbers_color = sf::Color::White;
sf::Color beat_lines_color = {255, 255, 255, 127};
ButtonColors bpm_button_colors = {
.text = {66, 150, 250},
.button = sf::Color::Transparent,
.hover = {66, 150, 250, 64},
.active = {66, 150, 250, 127},
.border = {109, 179, 251}
};
RectangleColors selection_rect_colors = {
.fill = {144, 189, 255, 64},
.border = {144, 189, 255}
};
LinearViewColors& colors;
int timeline_margin = 130;
int cursor_height = 100;