GUI: add "new" action

This commit is contained in:
tildearrow 2023-04-02 16:39:06 -05:00
parent 9bc2657965
commit 54c1a8171f
5 changed files with 11 additions and 1 deletions

View file

@ -32,6 +32,13 @@ const unsigned char avRequest[15]={
void FurnaceGUI::doAction(int what) {
switch (what) {
case GUI_ACTION_NEW:
if (modified) {
showWarning("Unsaved changes! Save changes before creating a new song?",GUI_WARN_NEW);
} else {
displayNew=true;
}
break;
case GUI_ACTION_OPEN:
if (modified) {
showWarning("Unsaved changes! Save changes before opening another file?",GUI_WARN_OPEN);

View file

@ -3581,7 +3581,7 @@ bool FurnaceGUI::loop() {
if (!mobileUI) {
ImGui::BeginMainMenuBar();
if (ImGui::BeginMenu("file")) {
if (ImGui::MenuItem("new...")) {
if (ImGui::MenuItem("new...",BIND_FOR(GUI_ACTION_NEW))) {
if (modified) {
showWarning("Unsaved changes! Save changes before creating a new song?",GUI_WARN_NEW);
} else {

View file

@ -416,6 +416,7 @@ enum FurnaceGUIFMAlgs {
enum FurnaceGUIActions {
GUI_ACTION_GLOBAL_MIN=0,
GUI_ACTION_NEW,
GUI_ACTION_OPEN,
GUI_ACTION_OPEN_BACKUP,
GUI_ACTION_SAVE,

View file

@ -462,6 +462,7 @@ const FurnaceGUIColors fxColors[256]={
// format: ("ACTION_ENUM", "Action name", defaultBind)
const FurnaceGUIActionDef guiActions[GUI_ACTION_MAX]={
D("GLOBAL_MIN", "---Global", NOT_AN_ACTION),
D("NEW", "New", FURKMOD_CMD|SDLK_n),
D("OPEN", "Open file", FURKMOD_CMD|SDLK_o),
D("OPEN_BACKUP", "Restore backup", 0),
D("SAVE", "Save file", FURKMOD_CMD|SDLK_s),

View file

@ -2092,6 +2092,7 @@ void FurnaceGUI::drawSettings() {
if (ImGui::TreeNode("Global hotkeys")) {
KEYBIND_CONFIG_BEGIN("keysGlobal");
UI_KEYBIND_CONFIG(GUI_ACTION_NEW);
UI_KEYBIND_CONFIG(GUI_ACTION_OPEN);
UI_KEYBIND_CONFIG(GUI_ACTION_OPEN_BACKUP);
UI_KEYBIND_CONFIG(GUI_ACTION_SAVE);