mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 04:55:13 +00:00
GUI: work around layout import crash?
not very well tested... may mess up layout issue #1629
This commit is contained in:
parent
be35b50ec8
commit
68ee5167ee
2 changed files with 60 additions and 9 deletions
|
@ -3426,6 +3426,10 @@ bool FurnaceGUI::detectOutOfBoundsWindow(SDL_Rect& failing) {
|
||||||
_x; \
|
_x; \
|
||||||
MEASURE_END(_n)
|
MEASURE_END(_n)
|
||||||
|
|
||||||
|
#define IMPORT_CLOSE(x) \
|
||||||
|
if (x) pendingLayoutImportReopen.push(&x); \
|
||||||
|
x=false;
|
||||||
|
|
||||||
bool FurnaceGUI::loop() {
|
bool FurnaceGUI::loop() {
|
||||||
DECLARE_METRIC(calcChanOsc)
|
DECLARE_METRIC(calcChanOsc)
|
||||||
DECLARE_METRIC(mobileControls)
|
DECLARE_METRIC(mobileControls)
|
||||||
|
@ -4002,7 +4006,59 @@ bool FurnaceGUI::loop() {
|
||||||
layoutTimeBegin=SDL_GetPerformanceCounter();
|
layoutTimeBegin=SDL_GetPerformanceCounter();
|
||||||
|
|
||||||
if (pendingLayoutImport!=NULL) {
|
if (pendingLayoutImport!=NULL) {
|
||||||
|
if (pendingLayoutImportStep==0) {
|
||||||
|
IMPORT_CLOSE(editControlsOpen);
|
||||||
|
IMPORT_CLOSE(ordersOpen);
|
||||||
|
IMPORT_CLOSE(insListOpen);
|
||||||
|
IMPORT_CLOSE(songInfoOpen);
|
||||||
|
IMPORT_CLOSE(patternOpen);
|
||||||
|
IMPORT_CLOSE(insEditOpen);
|
||||||
|
IMPORT_CLOSE(waveListOpen);
|
||||||
|
IMPORT_CLOSE(waveEditOpen);
|
||||||
|
IMPORT_CLOSE(sampleListOpen);
|
||||||
|
IMPORT_CLOSE(sampleEditOpen);
|
||||||
|
IMPORT_CLOSE(aboutOpen);
|
||||||
|
IMPORT_CLOSE(settingsOpen);
|
||||||
|
IMPORT_CLOSE(mixerOpen);
|
||||||
|
IMPORT_CLOSE(debugOpen);
|
||||||
|
IMPORT_CLOSE(inspectorOpen);
|
||||||
|
IMPORT_CLOSE(oscOpen);
|
||||||
|
IMPORT_CLOSE(volMeterOpen);
|
||||||
|
IMPORT_CLOSE(statsOpen);
|
||||||
|
IMPORT_CLOSE(compatFlagsOpen);
|
||||||
|
IMPORT_CLOSE(pianoOpen);
|
||||||
|
IMPORT_CLOSE(notesOpen);
|
||||||
|
IMPORT_CLOSE(channelsOpen);
|
||||||
|
IMPORT_CLOSE(regViewOpen);
|
||||||
|
IMPORT_CLOSE(logOpen);
|
||||||
|
IMPORT_CLOSE(effectListOpen);
|
||||||
|
IMPORT_CLOSE(chanOscOpen);
|
||||||
|
IMPORT_CLOSE(subSongsOpen);
|
||||||
|
IMPORT_CLOSE(findOpen);
|
||||||
|
IMPORT_CLOSE(spoilerOpen);
|
||||||
|
IMPORT_CLOSE(patManagerOpen);
|
||||||
|
IMPORT_CLOSE(sysManagerOpen);
|
||||||
|
IMPORT_CLOSE(clockOpen);
|
||||||
|
IMPORT_CLOSE(speedOpen);
|
||||||
|
IMPORT_CLOSE(groovesOpen);
|
||||||
|
IMPORT_CLOSE(xyOscOpen);
|
||||||
|
} else if (pendingLayoutImportStep==1) {
|
||||||
|
// let the UI settle
|
||||||
|
} else if (pendingLayoutImportStep==2) {
|
||||||
ImGui::LoadIniSettingsFromMemory((const char*)pendingLayoutImport,pendingLayoutImportLen);
|
ImGui::LoadIniSettingsFromMemory((const char*)pendingLayoutImport,pendingLayoutImportLen);
|
||||||
|
} else if (pendingLayoutImportStep==3) {
|
||||||
|
// restore open windows
|
||||||
|
while (!pendingLayoutImportReopen.empty()) {
|
||||||
|
bool* next=pendingLayoutImportReopen.front();
|
||||||
|
*next=true;
|
||||||
|
pendingLayoutImportReopen.pop();
|
||||||
|
}
|
||||||
|
} else if (pendingLayoutImportStep==4) {
|
||||||
|
delete[] pendingLayoutImport;
|
||||||
|
pendingLayoutImport=NULL;
|
||||||
|
}
|
||||||
|
pendingLayoutImportStep++;
|
||||||
|
if (pendingLayoutImport==NULL) pendingLayoutImportStep=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rend->newFrame()) {
|
if (!rend->newFrame()) {
|
||||||
|
@ -4011,14 +4067,6 @@ bool FurnaceGUI::loop() {
|
||||||
ImGui_ImplSDL2_NewFrame(sdlWin);
|
ImGui_ImplSDL2_NewFrame(sdlWin);
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
if (pendingLayoutImport!=NULL) {
|
|
||||||
WAKE_UP;
|
|
||||||
ImGui::Render();
|
|
||||||
delete[] pendingLayoutImport;
|
|
||||||
pendingLayoutImport=NULL;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// one second counter
|
// one second counter
|
||||||
secondTimer+=ImGui::GetIO().DeltaTime;
|
secondTimer+=ImGui::GetIO().DeltaTime;
|
||||||
if (secondTimer>=1.0f) secondTimer=fmod(secondTimer,1.0f);
|
if (secondTimer>=1.0f) secondTimer=fmod(secondTimer,1.0f);
|
||||||
|
@ -7277,6 +7325,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
prevInsData(NULL),
|
prevInsData(NULL),
|
||||||
pendingLayoutImport(NULL),
|
pendingLayoutImport(NULL),
|
||||||
pendingLayoutImportLen(0),
|
pendingLayoutImportLen(0),
|
||||||
|
pendingLayoutImportStep(0),
|
||||||
curIns(0),
|
curIns(0),
|
||||||
curWave(0),
|
curWave(0),
|
||||||
curSample(0),
|
curSample(0),
|
||||||
|
|
|
@ -1978,6 +1978,8 @@ class FurnaceGUI {
|
||||||
|
|
||||||
unsigned char* pendingLayoutImport;
|
unsigned char* pendingLayoutImport;
|
||||||
size_t pendingLayoutImportLen;
|
size_t pendingLayoutImportLen;
|
||||||
|
int pendingLayoutImportStep;
|
||||||
|
FixedQueue<bool*,64> pendingLayoutImportReopen;
|
||||||
|
|
||||||
int curIns, curWave, curSample, curOctave, curOrder, playOrder, prevIns, oldRow, editStep, exportLoops, soloChan, orderEditMode, orderCursor;
|
int curIns, curWave, curSample, curOctave, curOrder, playOrder, prevIns, oldRow, editStep, exportLoops, soloChan, orderEditMode, orderCursor;
|
||||||
int loopOrder, loopRow, loopEnd, isClipping, newSongCategory, latchTarget;
|
int loopOrder, loopRow, loopEnd, isClipping, newSongCategory, latchTarget;
|
||||||
|
|
Loading…
Reference in a new issue