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