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;
|
||||
}
|
||||
|
||||
#define FURNACE_ZLIB_COMPRESS
|
||||
|
||||
int FurnaceGUI::save(String path, int dmfVersion) {
|
||||
SafeWriter* w;
|
||||
logD("saving file...");
|
||||
|
@ -1992,7 +1990,7 @@ int FurnaceGUI::save(String path, int dmfVersion) {
|
|||
w->finish();
|
||||
return 1;
|
||||
}
|
||||
#ifdef FURNACE_ZLIB_COMPRESS
|
||||
if (settings.compress) {
|
||||
unsigned char zbuf[131072];
|
||||
int ret;
|
||||
z_stream zl;
|
||||
|
@ -2051,7 +2049,7 @@ int FurnaceGUI::save(String path, int dmfVersion) {
|
|||
}
|
||||
}
|
||||
deflateEnd(&zl);
|
||||
#else
|
||||
} else {
|
||||
if (fwrite(w->getFinalBuf(),1,w->size(),outFile)!=w->size()) {
|
||||
logE("did not write entirely: %s!",strerror(errno));
|
||||
lastError=strerror(errno);
|
||||
|
@ -2059,7 +2057,7 @@ int FurnaceGUI::save(String path, int dmfVersion) {
|
|||
w->finish();
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
fclose(outFile);
|
||||
w->finish();
|
||||
backupLock.lock();
|
||||
|
|
|
@ -1424,6 +1424,7 @@ class FurnaceGUI {
|
|||
int alwaysPlayIntro;
|
||||
int iCannotWait;
|
||||
int orderButtonPos;
|
||||
int compress;
|
||||
unsigned int maxUndoSteps;
|
||||
String mainFontPath;
|
||||
String patFontPath;
|
||||
|
@ -1569,6 +1570,7 @@ class FurnaceGUI {
|
|||
alwaysPlayIntro(0),
|
||||
iCannotWait(0),
|
||||
orderButtonPos(2),
|
||||
compress(1),
|
||||
maxUndoSteps(100),
|
||||
mainFontPath(""),
|
||||
patFontPath(""),
|
||||
|
|
|
@ -654,6 +654,15 @@ void FurnaceGUI::drawSettings() {
|
|||
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;
|
||||
if (ImGui::Checkbox("Cursor follows current order when moving it",&cursorFollowsOrderB)) {
|
||||
settings.cursorFollowsOrder=cursorFollowsOrderB;
|
||||
|
@ -2673,6 +2682,7 @@ void FurnaceGUI::syncSettings() {
|
|||
settings.cursorFollowsOrder=e->getConfInt("cursorFollowsOrder",1);
|
||||
settings.iCannotWait=e->getConfInt("iCannotWait",0);
|
||||
settings.orderButtonPos=e->getConfInt("orderButtonPos",2);
|
||||
settings.compress=e->getConfInt("compress",1);
|
||||
|
||||
clampSetting(settings.mainFontSize,2,96);
|
||||
clampSetting(settings.patFontSize,2,96);
|
||||
|
@ -2793,6 +2803,7 @@ void FurnaceGUI::syncSettings() {
|
|||
clampSetting(settings.cursorFollowsOrder,0,1);
|
||||
clampSetting(settings.iCannotWait,0,1);
|
||||
clampSetting(settings.orderButtonPos,0,2);
|
||||
clampSetting(settings.compress,0,1);
|
||||
|
||||
if (settings.exportLoops<0.0) settings.exportLoops=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("iCannotWait",settings.iCannotWait);
|
||||
e->setConf("orderButtonPos",settings.orderButtonPos);
|
||||
e->setConf("compress",settings.compress);
|
||||
|
||||
// colors
|
||||
for (int i=0; i<GUI_COLOR_MAX; i++) {
|
||||
|
|
Loading…
Reference in a new issue