mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-22 20:45:11 +00:00
Add Ctrl+Q to quit
This commit is contained in:
parent
83b934862a
commit
b2d61b1d3a
5 changed files with 19 additions and 15 deletions
|
@ -83,6 +83,11 @@ void FurnaceGUI::doAction(int what) {
|
|||
doRedo();
|
||||
}
|
||||
break;
|
||||
case GUI_ACTION_QUIT:
|
||||
{
|
||||
requestQuit();
|
||||
}
|
||||
break;
|
||||
case GUI_ACTION_PLAY_TOGGLE:
|
||||
if (e->isPlaying() && !e->isStepping()) {
|
||||
stop();
|
||||
|
|
|
@ -3672,12 +3672,8 @@ bool FurnaceGUI::loop() {
|
|||
// used for MIDI wake up
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
if (modified) {
|
||||
showWarning("Unsaved changes! Save changes before quitting?",GUI_WARN_QUIT);
|
||||
} else {
|
||||
quit=true;
|
||||
if (requestQuit())
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4327,12 +4323,8 @@ bool FurnaceGUI::loop() {
|
|||
doAction(GUI_ACTION_OPEN_BACKUP);
|
||||
}
|
||||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("exit")) {
|
||||
if (modified) {
|
||||
showWarning("Unsaved changes! Save before quitting?",GUI_WARN_QUIT);
|
||||
} else {
|
||||
quit=true;
|
||||
}
|
||||
if (ImGui::MenuItem("exit...",BIND_FOR(GUI_ACTION_QUIT))) {
|
||||
requestQuit();
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::EndMenu();
|
||||
|
@ -7253,8 +7245,13 @@ bool FurnaceGUI::finish() {
|
|||
return true;
|
||||
}
|
||||
|
||||
void FurnaceGUI::requestQuit() {
|
||||
quit=true;
|
||||
bool FurnaceGUI::requestQuit() {
|
||||
if (modified) {
|
||||
showWarning("Unsaved changes! Save changes before quitting?",GUI_WARN_QUIT);
|
||||
} else {
|
||||
quit=true;
|
||||
}
|
||||
return quit;
|
||||
}
|
||||
|
||||
FurnaceGUI::FurnaceGUI():
|
||||
|
|
|
@ -582,6 +582,7 @@ enum FurnaceGUIActions {
|
|||
GUI_ACTION_EXPORT,
|
||||
GUI_ACTION_UNDO,
|
||||
GUI_ACTION_REDO,
|
||||
GUI_ACTION_QUIT,
|
||||
GUI_ACTION_PLAY_TOGGLE,
|
||||
GUI_ACTION_PLAY,
|
||||
GUI_ACTION_STOP,
|
||||
|
@ -2659,7 +2660,7 @@ class FurnaceGUI {
|
|||
bool loop();
|
||||
bool finish();
|
||||
bool init();
|
||||
void requestQuit();
|
||||
bool requestQuit();
|
||||
FurnaceGUI();
|
||||
};
|
||||
|
||||
|
|
|
@ -548,6 +548,7 @@ const FurnaceGUIActionDef guiActions[GUI_ACTION_MAX]={
|
|||
#else
|
||||
D("REDO", "Redo", FURKMOD_CMD|SDLK_y),
|
||||
#endif
|
||||
D("QUIT", "Exit", FURKMOD_CMD|SDLK_q),
|
||||
D("PLAY_TOGGLE", "Play/Stop (toggle)", SDLK_RETURN),
|
||||
D("PLAY", "Play", 0),
|
||||
D("STOP", "Stop", 0),
|
||||
|
|
|
@ -39,7 +39,7 @@ typedef HRESULT (WINAPI *SPDA)(PROCESS_DPI_AWARENESS);
|
|||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
struct sigaction termsa;
|
||||
struct sigaction termsa = {0};
|
||||
#endif
|
||||
|
||||
#include "cli/cli.h"
|
||||
|
|
Loading…
Reference in a new issue