add setting for choosing whether to save window position

This commit is contained in:
aurora 2022-08-22 22:17:19 +03:00
parent 8b3c4a84a8
commit 0e847dc1aa
3 changed files with 26 additions and 14 deletions

View file

@ -4685,8 +4685,8 @@ bool FurnaceGUI::finish() {
// commit last window size
e->setConf("lastWindowWidth",scrConfW);
e->setConf("lastWindowHeight",scrConfH);
e->setConf("lastWindowX",scrConfX);
e->setConf("lastWindowY",scrConfY);
e->setConf("lastWindowX",settings.saveWindowPos?scrConfX:(int)SDL_WINDOWPOS_CENTERED);
e->setConf("lastWindowY",settings.saveWindowPos?scrConfY:(int)SDL_WINDOWPOS_CENTERED);
e->setConf("lastWindowMax",scrMax);
e->setConf("tempoView",tempoView);

View file

@ -1129,6 +1129,7 @@ class FurnaceGUI {
int dragMovesSelection;
int unsignedDetune;
int noThreadedInput;
int saveWindowPos;
int clampSamples;
int saveUnusedPatterns;
int channelColors;

View file

@ -509,6 +509,14 @@ void FurnaceGUI::drawSettings() {
ImGui::SetTooltip("threaded input processes key presses for note preview on a separate thread (on supported platforms), which reduces latency.\nhowever, crashes have been reported when threaded input is on. enable this option if that is the case.");
}
bool saveWindowPosB=settings.saveWindowPos;
if (ImGui::Checkbox("Remember window location",&saveWindowPosB)) {
settings.saveWindowPos=saveWindowPosB;
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("remembers where window was last located on start-up. When disabled, window will start in a defaul location.");
}
bool blankInsB=settings.blankIns;
if (ImGui::Checkbox("New instruments are blank",&blankInsB)) {
settings.blankIns=blankInsB;
@ -2213,6 +2221,7 @@ void FurnaceGUI::syncSettings() {
settings.dragMovesSelection=e->getConfInt("dragMovesSelection",2);
settings.unsignedDetune=e->getConfInt("unsignedDetune",0);
settings.noThreadedInput=e->getConfInt("noThreadedInput",0);
settings.saveWindowPos=e->getConfInt("saveWindowPos",1);
settings.initialSysName=e->getConfString("initialSysName","");
settings.clampSamples=e->getConfInt("clampSamples",0);
settings.noteOffLabel=e->getConfString("noteOffLabel","OFF");
@ -2313,6 +2322,7 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.dragMovesSelection,0,2);
clampSetting(settings.unsignedDetune,0,1);
clampSetting(settings.noThreadedInput,0,1);
clampSetting(settings.saveWindowPos,0,1);
clampSetting(settings.clampSamples,0,1);
clampSetting(settings.saveUnusedPatterns,0,1);
clampSetting(settings.channelColors,0,2);
@ -2458,6 +2468,7 @@ void FurnaceGUI::commitSettings() {
e->setConf("dragMovesSelection",settings.dragMovesSelection);
e->setConf("unsignedDetune",settings.unsignedDetune);
e->setConf("noThreadedInput",settings.noThreadedInput);
e->setConf("saveWindowPos",settings.saveWindowPos);
e->setConf("clampSamples",settings.clampSamples);
e->setConf("noteOffLabel",settings.noteOffLabel);
e->setConf("noteRelLabel",settings.noteRelLabel);