GUI: implement clear recent file list option

This commit is contained in:
tildearrow 2022-10-02 01:36:37 -05:00
parent 0c79280aae
commit 492b1a8347
2 changed files with 16 additions and 0 deletions

View file

@ -3291,6 +3291,11 @@ bool FurnaceGUI::loop() {
} }
if (recentFile.empty()) { if (recentFile.empty()) {
ImGui::Text("nothing here yet"); ImGui::Text("nothing here yet");
} else {
ImGui::Separator();
if (ImGui::MenuItem("clear history")) {
showWarning("Are you sure you want to clear the recent file list?",GUI_WARN_CLEAR_HISTORY);
}
} }
ImGui::EndMenu(); ImGui::EndMenu();
} }
@ -4630,6 +4635,16 @@ bool FurnaceGUI::loop() {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
break; break;
case GUI_WARN_CLEAR_HISTORY:
if (ImGui::Button("Yes")) {
recentFile.clear();
ImGui::CloseCurrentPopup();
}
ImGui::SameLine();
if (ImGui::Button("No")) {
ImGui::CloseCurrentPopup();
}
break;
case GUI_WARN_GENERIC: case GUI_WARN_GENERIC:
if (ImGui::Button("OK")) { if (ImGui::Button("OK")) {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();

View file

@ -355,6 +355,7 @@ enum FurnaceGUIWarnings {
GUI_WARN_CLEAR, GUI_WARN_CLEAR,
GUI_WARN_SUBSONG_DEL, GUI_WARN_SUBSONG_DEL,
GUI_WARN_SYSTEM_DEL, GUI_WARN_SYSTEM_DEL,
GUI_WARN_CLEAR_HISTORY,
GUI_WARN_GENERIC GUI_WARN_GENERIC
}; };