mirror of
https://gitlab.com/square-game-liberation-front/F.E.I.S.git
synced 2025-02-28 15:30:32 +01:00
Make preview quick define button only appear when "use separate preview file" is unchecked
This commit is contained in:
parent
76fde952ca
commit
f9a2318f9a
@ -682,6 +682,38 @@ void EditorState::display_file_properties() {
|
||||
));
|
||||
song.metadata.preview_loop.duration = edited_loop_duration;
|
||||
}
|
||||
const bool should_display_quick_define = chart_state and chart_state->time_selection;
|
||||
if (not should_display_quick_define) {
|
||||
ImGui::BeginDisabled();
|
||||
}
|
||||
if (ImGui::Button("Define from time selection")) {
|
||||
stop_music_preview();
|
||||
const auto before = [&]() -> PreviewState {
|
||||
if (song.metadata.use_preview_file) {
|
||||
return song.metadata.preview_file;
|
||||
} else {
|
||||
return song.metadata.preview_loop;
|
||||
}
|
||||
}();
|
||||
const auto start = time_at(chart_state->time_selection->start);
|
||||
const auto end = time_at(chart_state->time_selection->end);
|
||||
const auto duration = end - start;
|
||||
song.metadata.use_preview_file = false;
|
||||
song.metadata.preview_loop.start = Decimal{fmt::format("{:.03}", start.asSeconds())};
|
||||
song.metadata.preview_loop.duration = Decimal{fmt::format("{:.03}", duration.asSeconds())};
|
||||
history.push(std::make_shared<ChangePreview>(before, song.metadata.preview_loop));
|
||||
}
|
||||
if (not should_display_quick_define) {
|
||||
ImGui::EndDisabled();
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::TextUnformatted(
|
||||
"You must define a time selection in the linear view first !\n"
|
||||
"Open up 'View' > 'Linear View' then use the Tab key to set the start, then the end"
|
||||
);
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (music_preview_is_playing()) {
|
||||
if (feis::StopButton("##Stop Mucic Preview")) {
|
||||
@ -719,38 +751,6 @@ void EditorState::display_file_properties() {
|
||||
);
|
||||
ImGui::PopItemFlag();
|
||||
ImGui::PopItemWidth();
|
||||
const bool should_display_quick_define = chart_state and chart_state->time_selection;
|
||||
if (not should_display_quick_define) {
|
||||
ImGui::BeginDisabled();
|
||||
}
|
||||
if (ImGui::Button("Define from time selection")) {
|
||||
stop_music_preview();
|
||||
const auto before = [&]() -> PreviewState {
|
||||
if (song.metadata.use_preview_file) {
|
||||
return song.metadata.preview_file;
|
||||
} else {
|
||||
return song.metadata.preview_loop;
|
||||
}
|
||||
}();
|
||||
const auto start = time_at(chart_state->time_selection->start);
|
||||
const auto end = time_at(chart_state->time_selection->end);
|
||||
const auto duration = end - start;
|
||||
song.metadata.use_preview_file = false;
|
||||
song.metadata.preview_loop.start = Decimal{fmt::format("{:.03}", start.asSeconds())};
|
||||
song.metadata.preview_loop.duration = Decimal{fmt::format("{:.03}", duration.asSeconds())};
|
||||
history.push(std::make_shared<ChangePreview>(before, song.metadata.preview_loop));
|
||||
}
|
||||
if (not should_display_quick_define) {
|
||||
ImGui::EndDisabled();
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::TextUnformatted(
|
||||
"You must define a time selection in the linear view first !\n"
|
||||
"Open up 'View' > 'Linear View' then use the Tab key to set the start, then the end"
|
||||
);
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user