zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 79146fe2b2dc84822a5a0219b10ed49cdf520974
parent f8e7820f07a07285f6191196c4bee7c3d6fb0389
Author: fundamental <[email protected]>
Date:   Wed, 27 Jan 2016 22:38:04 -0500

Add 'Delete' Option To Auto Save Reload

Diffstat:
Msrc/Misc/MiddleWare.cpp | 8++++++++
Msrc/UI/Connection.cpp | 9++++++---
2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp @@ -997,6 +997,14 @@ static rtosc::Ports middwareSnoopPorts = { //autosave, but this method should work for non-immediate crashes :-| remove(save_loc.c_str()); rEnd}, + {"delete_auto_save:i", 0, 0, + rBegin + const int save_id = rtosc_argument(msg,0).i; + const string save_dir = string(getenv("HOME")) + "/.local"; + const string save_file = "zynaddsubfx-"+to_s(save_id)+"-autosave.xmz"; + const string save_loc = save_dir + "/" + save_file; + remove(save_loc.c_str()); + rEnd}, {"load_xmz:s", 0, 0, rBegin; const char *file = rtosc_argument(msg, 0).s; diff --git a/src/UI/Connection.cpp b/src/UI/Connection.cpp @@ -158,12 +158,15 @@ rtosc::Ports uiPorts::ports = { fl_alert("%s",a0.s); } END BEGIN("alert-reload:i") { - if(1==fl_choice("Old autosave found, do you want to reload?", - NULL, "Reload", "Ignore")) { - printf("trying to reload...\n"); + int res = fl_choice("Old autosave found, do you want to reload?", + "Delete", "Reload", "Ignore"); + // 0 1 2 + if(1==res) { d.reply("/reload_auto_save", "i", a0.i); ui->refresh_master_ui(); ui->updatepanel(); + } else if(0==res) { + d.reply("/delete_auto_save", "i", a0.i); } } END BEGIN("session-type:s") {