mirror of
https://gitlab.com/square-game-liberation-front/F.E.I.S.git
synced 2024-11-12 02:00:53 +01:00
Add dialog box to change current BPM
This commit is contained in:
parent
03eb055464
commit
6a3f941d95
@ -1278,6 +1278,24 @@ void EditorState::display_sync_menu() {
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void EditorState::display_bpm_change_menu() {
|
||||
if (ImGui::Begin("Insert BPM Change", &show_bpm_change_menu)) {
|
||||
auto bpm = std::visit(
|
||||
[&](const auto& pos){return applicable_timing->bpm_at(pos);},
|
||||
playback_position
|
||||
);
|
||||
ImGui::PushItemWidth(-70.0f);
|
||||
if (feis::InputDecimal("BPM", &bpm, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
||||
if (bpm > 0) {
|
||||
auto new_timing = *applicable_timing;
|
||||
new_timing.insert(better::BPMAtBeat{bpm, current_snaped_beats()});
|
||||
replace_applicable_timing_with(new_timing);
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
bool EditorState::needs_to_save() const {
|
||||
return not history.current_state_is_saved();
|
||||
};
|
||||
|
@ -179,6 +179,9 @@ public:
|
||||
bool show_sync_menu = false;
|
||||
void display_sync_menu();
|
||||
|
||||
bool show_bpm_change_menu = false;
|
||||
void display_bpm_change_menu();
|
||||
|
||||
enum class SaveOutcome {
|
||||
UserSaved,
|
||||
UserDeclindedSaving,
|
||||
|
@ -519,6 +519,9 @@ int main() {
|
||||
if (editor_state->show_sync_menu) {
|
||||
editor_state->display_sync_menu();
|
||||
}
|
||||
if (editor_state->show_bpm_change_menu) {
|
||||
editor_state->display_bpm_change_menu();
|
||||
}
|
||||
} else {
|
||||
bg.render(window);
|
||||
}
|
||||
@ -644,6 +647,9 @@ int main() {
|
||||
if (ImGui::MenuItem("Adjust Sync")) {
|
||||
editor_state->show_sync_menu = true;
|
||||
}
|
||||
if (ImGui::MenuItem("Insert BPM Change")) {
|
||||
editor_state->show_bpm_change_menu = true;
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::BeginMenu("Notes", editor_state.has_value())) {
|
||||
|
Loading…
Reference in New Issue
Block a user