manual system recent file tracking

issue #1406
This commit is contained in:
tildearrow 2023-08-25 18:32:34 -05:00
parent 2b0feefe28
commit 16bc35d75b
2 changed files with 30 additions and 4 deletions

View file

@ -2115,6 +2115,7 @@ int FurnaceGUI::save(String path, int dmfVersion) {
showWarning(e->getWarnings(),GUI_WARN_GENERIC); showWarning(e->getWarnings(),GUI_WARN_GENERIC);
} }
pushRecentFile(path); pushRecentFile(path);
pushRecentSys(path.c_str());
logD("save complete."); logD("save complete.");
return 0; return 0;
} }
@ -2222,6 +2223,13 @@ void FurnaceGUI::pushRecentFile(String path) {
} }
} }
void FurnaceGUI::pushRecentSys(const char* path) {
#ifdef _WIN32
WString widePath=utf8To16(path);
SHAddToRecentDocs(SHARD_PATHW,widePath.c_str());
#endif
}
void FurnaceGUI::delFirstBackup(String name) { void FurnaceGUI::delFirstBackup(String name) {
std::vector<String> listOfFiles; std::vector<String> listOfFiles;
#ifdef _WIN32 #ifdef _WIN32
@ -4819,29 +4827,39 @@ bool FurnaceGUI::loop() {
break; break;
case GUI_FILE_INS_SAVE: case GUI_FILE_INS_SAVE:
if (curIns>=0 && curIns<(int)e->song.ins.size()) { if (curIns>=0 && curIns<(int)e->song.ins.size()) {
e->song.ins[curIns]->save(copyOfName.c_str(),false,&e->song); if (e->song.ins[curIns]->save(copyOfName.c_str(),false,&e->song)) {
pushRecentSys(copyOfName.c_str());
}
} }
break; break;
case GUI_FILE_INS_SAVE_DMP: case GUI_FILE_INS_SAVE_DMP:
if (curIns>=0 && curIns<(int)e->song.ins.size()) { if (curIns>=0 && curIns<(int)e->song.ins.size()) {
if (!e->song.ins[curIns]->saveDMP(copyOfName.c_str())) { if (!e->song.ins[curIns]->saveDMP(copyOfName.c_str())) {
showError("error while saving instrument! make sure your instrument is compatible."); showError("error while saving instrument! make sure your instrument is compatible.");
} else {
pushRecentSys(copyOfName.c_str());
} }
} }
break; break;
case GUI_FILE_WAVE_SAVE: case GUI_FILE_WAVE_SAVE:
if (curWave>=0 && curWave<(int)e->song.wave.size()) { if (curWave>=0 && curWave<(int)e->song.wave.size()) {
e->song.wave[curWave]->save(copyOfName.c_str()); if (e->song.wave[curWave]->save(copyOfName.c_str())) {
pushRecentSys(copyOfName.c_str());
}
} }
break; break;
case GUI_FILE_WAVE_SAVE_DMW: case GUI_FILE_WAVE_SAVE_DMW:
if (curWave>=0 && curWave<(int)e->song.wave.size()) { if (curWave>=0 && curWave<(int)e->song.wave.size()) {
e->song.wave[curWave]->saveDMW(copyOfName.c_str()); if (e->song.wave[curWave]->saveDMW(copyOfName.c_str())) {
pushRecentSys(copyOfName.c_str());
}
} }
break; break;
case GUI_FILE_WAVE_SAVE_RAW: case GUI_FILE_WAVE_SAVE_RAW:
if (curWave>=0 && curWave<(int)e->song.wave.size()) { if (curWave>=0 && curWave<(int)e->song.wave.size()) {
e->song.wave[curWave]->saveRaw(copyOfName.c_str()); if (e->song.wave[curWave]->saveRaw(copyOfName.c_str())) {
pushRecentSys(copyOfName.c_str());
}
} }
break; break;
case GUI_FILE_SAMPLE_OPEN: { case GUI_FILE_SAMPLE_OPEN: {
@ -4905,6 +4923,8 @@ bool FurnaceGUI::loop() {
if (curSample>=0 && curSample<(int)e->song.sample.size()) { if (curSample>=0 && curSample<(int)e->song.sample.size()) {
if (!e->song.sample[curSample]->save(copyOfName.c_str())) { if (!e->song.sample[curSample]->save(copyOfName.c_str())) {
showError("could not save sample! open Log Viewer for more information."); showError("could not save sample! open Log Viewer for more information.");
} else {
pushRecentSys(copyOfName.c_str());
} }
} }
break; break;
@ -4912,6 +4932,8 @@ bool FurnaceGUI::loop() {
if (curSample>=0 && curSample<(int)e->song.sample.size()) { if (curSample>=0 && curSample<(int)e->song.sample.size()) {
if (!e->song.sample[curSample]->saveRaw(copyOfName.c_str())) { if (!e->song.sample[curSample]->saveRaw(copyOfName.c_str())) {
showError("could not save sample! open Log Viewer for more information."); showError("could not save sample! open Log Viewer for more information.");
} else {
pushRecentSys(copyOfName.c_str());
} }
} }
break; break;
@ -5061,6 +5083,7 @@ bool FurnaceGUI::loop() {
if (f!=NULL) { if (f!=NULL) {
fwrite(w->getFinalBuf(),1,w->size(),f); fwrite(w->getFinalBuf(),1,w->size(),f);
fclose(f); fclose(f);
pushRecentSys(copyOfName.c_str());
} else { } else {
showError("could not open file!"); showError("could not open file!");
} }
@ -5081,6 +5104,7 @@ bool FurnaceGUI::loop() {
if (f!=NULL) { if (f!=NULL) {
fwrite(w->getFinalBuf(),1,w->size(),f); fwrite(w->getFinalBuf(),1,w->size(),f);
fclose(f); fclose(f);
pushRecentSys(copyOfName.c_str());
} else { } else {
showError("could not open file!"); showError("could not open file!");
} }
@ -5107,6 +5131,7 @@ bool FurnaceGUI::loop() {
if (f!=NULL) { if (f!=NULL) {
fwrite(w->getFinalBuf(),1,w->size(),f); fwrite(w->getFinalBuf(),1,w->size(),f);
fclose(f); fclose(f);
pushRecentSys(copyOfName.c_str());
} else { } else {
showError("could not open file!"); showError("could not open file!");
} }

View file

@ -2342,6 +2342,7 @@ class FurnaceGUI {
int load(String path); int load(String path);
int loadStream(String path); int loadStream(String path);
void pushRecentFile(String path); void pushRecentFile(String path);
void pushRecentSys(const char* path);
void exportAudio(String path, DivAudioExportModes mode); void exportAudio(String path, DivAudioExportModes mode);
void delFirstBackup(String name); void delFirstBackup(String name);