GUI: add option to toggle save compression
This commit is contained in:
parent
dae87a4980
commit
347d35be19
|
@ -1968,8 +1968,6 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
||||||
//ImGui::GetIO().ConfigFlags|=ImGuiConfigFlags_NavEnableKeyboard;
|
//ImGui::GetIO().ConfigFlags|=ImGuiConfigFlags_NavEnableKeyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FURNACE_ZLIB_COMPRESS
|
|
||||||
|
|
||||||
int FurnaceGUI::save(String path, int dmfVersion) {
|
int FurnaceGUI::save(String path, int dmfVersion) {
|
||||||
SafeWriter* w;
|
SafeWriter* w;
|
||||||
logD("saving file...");
|
logD("saving file...");
|
||||||
|
@ -1992,7 +1990,7 @@ int FurnaceGUI::save(String path, int dmfVersion) {
|
||||||
w->finish();
|
w->finish();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#ifdef FURNACE_ZLIB_COMPRESS
|
if (settings.compress) {
|
||||||
unsigned char zbuf[131072];
|
unsigned char zbuf[131072];
|
||||||
int ret;
|
int ret;
|
||||||
z_stream zl;
|
z_stream zl;
|
||||||
|
@ -2051,7 +2049,7 @@ int FurnaceGUI::save(String path, int dmfVersion) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deflateEnd(&zl);
|
deflateEnd(&zl);
|
||||||
#else
|
} else {
|
||||||
if (fwrite(w->getFinalBuf(),1,w->size(),outFile)!=w->size()) {
|
if (fwrite(w->getFinalBuf(),1,w->size(),outFile)!=w->size()) {
|
||||||
logE("did not write entirely: %s!",strerror(errno));
|
logE("did not write entirely: %s!",strerror(errno));
|
||||||
lastError=strerror(errno);
|
lastError=strerror(errno);
|
||||||
|
@ -2059,7 +2057,7 @@ int FurnaceGUI::save(String path, int dmfVersion) {
|
||||||
w->finish();
|
w->finish();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
fclose(outFile);
|
fclose(outFile);
|
||||||
w->finish();
|
w->finish();
|
||||||
backupLock.lock();
|
backupLock.lock();
|
||||||
|
|
|
@ -1424,6 +1424,7 @@ class FurnaceGUI {
|
||||||
int alwaysPlayIntro;
|
int alwaysPlayIntro;
|
||||||
int iCannotWait;
|
int iCannotWait;
|
||||||
int orderButtonPos;
|
int orderButtonPos;
|
||||||
|
int compress;
|
||||||
unsigned int maxUndoSteps;
|
unsigned int maxUndoSteps;
|
||||||
String mainFontPath;
|
String mainFontPath;
|
||||||
String patFontPath;
|
String patFontPath;
|
||||||
|
@ -1569,6 +1570,7 @@ class FurnaceGUI {
|
||||||
alwaysPlayIntro(0),
|
alwaysPlayIntro(0),
|
||||||
iCannotWait(0),
|
iCannotWait(0),
|
||||||
orderButtonPos(2),
|
orderButtonPos(2),
|
||||||
|
compress(1),
|
||||||
maxUndoSteps(100),
|
maxUndoSteps(100),
|
||||||
mainFontPath(""),
|
mainFontPath(""),
|
||||||
patFontPath(""),
|
patFontPath(""),
|
||||||
|
|
|
@ -654,6 +654,15 @@ void FurnaceGUI::drawSettings() {
|
||||||
settings.saveUnusedPatterns=saveUnusedPatternsB;
|
settings.saveUnusedPatterns=saveUnusedPatternsB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool compressB=settings.compress;
|
||||||
|
if (ImGui::Checkbox("Compress when saving",&compressB)) {
|
||||||
|
settings.compress=compressB;
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("use zlib to compress saved songs.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool cursorFollowsOrderB=settings.cursorFollowsOrder;
|
bool cursorFollowsOrderB=settings.cursorFollowsOrder;
|
||||||
if (ImGui::Checkbox("Cursor follows current order when moving it",&cursorFollowsOrderB)) {
|
if (ImGui::Checkbox("Cursor follows current order when moving it",&cursorFollowsOrderB)) {
|
||||||
settings.cursorFollowsOrder=cursorFollowsOrderB;
|
settings.cursorFollowsOrder=cursorFollowsOrderB;
|
||||||
|
@ -2673,6 +2682,7 @@ void FurnaceGUI::syncSettings() {
|
||||||
settings.cursorFollowsOrder=e->getConfInt("cursorFollowsOrder",1);
|
settings.cursorFollowsOrder=e->getConfInt("cursorFollowsOrder",1);
|
||||||
settings.iCannotWait=e->getConfInt("iCannotWait",0);
|
settings.iCannotWait=e->getConfInt("iCannotWait",0);
|
||||||
settings.orderButtonPos=e->getConfInt("orderButtonPos",2);
|
settings.orderButtonPos=e->getConfInt("orderButtonPos",2);
|
||||||
|
settings.compress=e->getConfInt("compress",1);
|
||||||
|
|
||||||
clampSetting(settings.mainFontSize,2,96);
|
clampSetting(settings.mainFontSize,2,96);
|
||||||
clampSetting(settings.patFontSize,2,96);
|
clampSetting(settings.patFontSize,2,96);
|
||||||
|
@ -2793,6 +2803,7 @@ void FurnaceGUI::syncSettings() {
|
||||||
clampSetting(settings.cursorFollowsOrder,0,1);
|
clampSetting(settings.cursorFollowsOrder,0,1);
|
||||||
clampSetting(settings.iCannotWait,0,1);
|
clampSetting(settings.iCannotWait,0,1);
|
||||||
clampSetting(settings.orderButtonPos,0,2);
|
clampSetting(settings.orderButtonPos,0,2);
|
||||||
|
clampSetting(settings.compress,0,1);
|
||||||
|
|
||||||
if (settings.exportLoops<0.0) settings.exportLoops=0.0;
|
if (settings.exportLoops<0.0) settings.exportLoops=0.0;
|
||||||
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
|
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
|
||||||
|
@ -3008,6 +3019,7 @@ void FurnaceGUI::commitSettings() {
|
||||||
e->setConf("cursorFollowsOrder",settings.cursorFollowsOrder);
|
e->setConf("cursorFollowsOrder",settings.cursorFollowsOrder);
|
||||||
e->setConf("iCannotWait",settings.iCannotWait);
|
e->setConf("iCannotWait",settings.iCannotWait);
|
||||||
e->setConf("orderButtonPos",settings.orderButtonPos);
|
e->setConf("orderButtonPos",settings.orderButtonPos);
|
||||||
|
e->setConf("compress",settings.compress);
|
||||||
|
|
||||||
// colors
|
// colors
|
||||||
for (int i=0; i<GUI_COLOR_MAX; i++) {
|
for (int i=0; i<GUI_COLOR_MAX; i++) {
|
||||||
|
|
Loading…
Reference in a new issue