diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 6437ecab7..2994c3573 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -77,6 +77,10 @@ bool Particle::update(float frameTime) { return (life>0); } +void centerNextWindow(float w, float h) { + ImGui::SetNextWindowPos(ImVec2(w*0.5,h*0.5),ImGuiCond_Always,ImVec2(0.5,0.5)); +} + void FurnaceGUI::bindEngine(DivEngine* eng) { e=eng; wavePreview.setEngine(e); @@ -4526,6 +4530,7 @@ bool FurnaceGUI::loop() { ImGui::OpenPopup("System File Dialog Pending"); } + centerNextWindow(canvasW,canvasH); if (ImGui::BeginPopupModal("System File Dialog Pending",NULL,ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoBackground|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoMove)) { if (!fileDialog->isOpen()) { ImGui::CloseCurrentPopup(); @@ -5194,6 +5199,7 @@ bool FurnaceGUI::loop() { MEASURE_BEGIN(popup); + centerNextWindow(canvasW,canvasH); if (ImGui::BeginPopupModal("Rendering...",NULL,ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::Text("Please wait..."); if (ImGui::Button("Abort")) { @@ -5221,6 +5227,7 @@ bool FurnaceGUI::loop() { ImGui::EndPopup(); } + centerNextWindow(canvasW,canvasH); if (ImGui::BeginPopupModal("Error",NULL,ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::Text("%s",errorString.c_str()); if (ImGui::Button("OK")) { @@ -5229,6 +5236,7 @@ bool FurnaceGUI::loop() { ImGui::EndPopup(); } + centerNextWindow(canvasW,canvasH); if (ImGui::BeginPopupModal("Warning",NULL,ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::Text("%s",warnString.c_str()); switch (warnAction) { @@ -5597,6 +5605,7 @@ bool FurnaceGUI::loop() { // TODO: // - multiple selection // - replace instrument + centerNextWindow(canvasW,canvasH); if (ImGui::BeginPopupModal("Select Instrument",NULL,ImGuiWindowFlags_AlwaysAutoResize)) { bool quitPlease=false; if (pendingInsSingle) { @@ -5674,6 +5683,7 @@ bool FurnaceGUI::loop() { ImGui::EndPopup(); } + centerNextWindow(canvasW,canvasH); if (ImGui::BeginPopupModal("Import Raw Sample",NULL,ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::Text("Data type:"); for (int i=0; i