From 7efc84592bec21603733dfcd0cb9c597fe44f062 Mon Sep 17 00:00:00 2001 From: YohananDiamond Date: Mon, 3 Jul 2023 17:43:00 -0300 Subject: [PATCH 1/2] Exit with ESC --- extern/igfd/ImGuiFileDialogConfig.h | 4 ++-- src/gui/newSong.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extern/igfd/ImGuiFileDialogConfig.h b/extern/igfd/ImGuiFileDialogConfig.h index 4a212b600..8f06588a8 100644 --- a/extern/igfd/ImGuiFileDialogConfig.h +++ b/extern/igfd/ImGuiFileDialogConfig.h @@ -36,8 +36,8 @@ //#define IGFD_KEY_BACKSPACE GLFW_KEY_BACKSPACE // by ex you can quit the dialog by pressing the key excape -//#define USE_DIALOG_EXIT_WITH_KEY -//#define IGFD_EXIT_KEY GLFW_KEY_ESCAPE +#define USE_DIALOG_EXIT_WITH_KEY +#define IGFD_EXIT_KEY ImGuiKey_Escape // widget // filter combobox width diff --git a/src/gui/newSong.cpp b/src/gui/newSong.cpp index 735f8bfb0..fd7eace75 100644 --- a/src/gui/newSong.cpp +++ b/src/gui/newSong.cpp @@ -140,7 +140,7 @@ void FurnaceGUI::drawNewSong() { ImGui::SameLine(); - if (ImGui::Button("Cancel")) { + if (ImGui::Button("Cancel") || ImGui::IsKeyPressed(ImGuiKey_Escape)) { ImGui::CloseCurrentPopup(); } From f0e7be79d594a4aaa050ccdfe3436a2cca74f137 Mon Sep 17 00:00:00 2001 From: YohananDiamond Date: Tue, 11 Jul 2023 11:14:35 -0300 Subject: [PATCH 2/2] dialog nitpicks: more close-with-esc --- src/gui/gui.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 6eefb6913..4399c4606 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -5252,7 +5252,7 @@ bool FurnaceGUI::loop() { quit=true; } ImGui::SameLine(); - if (ImGui::Button("Cancel")) { + if (ImGui::Button("Cancel") || ImGui::IsKeyPressed(ImGuiKey_Escape)) { ImGui::CloseCurrentPopup(); } break; @@ -5276,7 +5276,7 @@ bool FurnaceGUI::loop() { displayNew=true; } ImGui::SameLine(); - if (ImGui::Button("Cancel")) { + if (ImGui::Button("Cancel") || ImGui::IsKeyPressed(ImGuiKey_Escape)) { ImGui::CloseCurrentPopup(); } break; @@ -5300,7 +5300,7 @@ bool FurnaceGUI::loop() { openFileDialog(GUI_FILE_OPEN); } ImGui::SameLine(); - if (ImGui::Button("Cancel")) { + if (ImGui::Button("Cancel") || ImGui::IsKeyPressed(ImGuiKey_Escape)) { ImGui::CloseCurrentPopup(); } break; @@ -5324,7 +5324,7 @@ bool FurnaceGUI::loop() { openFileDialog(GUI_FILE_OPEN_BACKUP); } ImGui::SameLine(); - if (ImGui::Button("Cancel")) { + if (ImGui::Button("Cancel") || ImGui::IsKeyPressed(ImGuiKey_Escape)) { ImGui::CloseCurrentPopup(); } break; @@ -5355,7 +5355,7 @@ bool FurnaceGUI::loop() { nextFile=""; } ImGui::SameLine(); - if (ImGui::Button("Cancel")) { + if (ImGui::Button("Cancel") || ImGui::IsKeyPressed(ImGuiKey_Escape)) { ImGui::CloseCurrentPopup(); nextFile=""; } @@ -5409,7 +5409,7 @@ bool FurnaceGUI::loop() { syncSettings(); } ImGui::SameLine(); - if (ImGui::Button("Cancel")) { + if (ImGui::Button("Cancel") || ImGui::IsKeyPressed(ImGuiKey_Escape)) { ImGui::CloseCurrentPopup(); } break; @@ -5496,7 +5496,7 @@ bool FurnaceGUI::loop() { ImGui::CloseCurrentPopup(); } - if (ImGui::Button("Wait! What am I doing? Cancel!")) { + if (ImGui::Button("Wait! What am I doing? Cancel!") || ImGui::IsKeyPressed(ImGuiKey_Escape)) { ImGui::CloseCurrentPopup(); } break; @@ -5647,7 +5647,7 @@ bool FurnaceGUI::loop() { ImGui::EndDisabled(); ImGui::SameLine(); } - if (ImGui::Button("Cancel")) { + if (ImGui::Button("Cancel") || ImGui::IsKeyPressed(ImGuiKey_Escape)) { for (std::pair& i: pendingIns) { i.second=false; } @@ -5719,7 +5719,7 @@ bool FurnaceGUI::loop() { ImGui::CloseCurrentPopup(); } ImGui::SameLine(); - if (ImGui::Button("Cancel")) { + if (ImGui::Button("Cancel") || ImGui::IsKeyPressed(ImGuiKey_Escape)) { ImGui::CloseCurrentPopup(); } ImGui::EndPopup();