GUI: add center pop-up setting
This commit is contained in:
parent
d9cdb787ae
commit
a59b5753bb
|
@ -77,9 +77,13 @@ bool Particle::update(float frameTime) {
|
||||||
return (life>0);
|
return (life>0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void centerNextWindow(float w, float h) {
|
void FurnaceGUI::centerNextWindow(const char* name, float w, float h) {
|
||||||
|
if (ImGui::IsPopupOpen(name)) {
|
||||||
|
if (settings.centerPopup) {
|
||||||
ImGui::SetNextWindowPos(ImVec2(w*0.5,h*0.5),ImGuiCond_Always,ImVec2(0.5,0.5));
|
ImGui::SetNextWindowPos(ImVec2(w*0.5,h*0.5),ImGuiCond_Always,ImVec2(0.5,0.5));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FurnaceGUI::bindEngine(DivEngine* eng) {
|
void FurnaceGUI::bindEngine(DivEngine* eng) {
|
||||||
e=eng;
|
e=eng;
|
||||||
|
@ -4577,7 +4581,6 @@ bool FurnaceGUI::loop() {
|
||||||
ImGui::OpenPopup("System File Dialog Pending");
|
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 (ImGui::BeginPopupModal("System File Dialog Pending",NULL,ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoBackground|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoMove)) {
|
||||||
if (!fileDialog->isOpen()) {
|
if (!fileDialog->isOpen()) {
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
@ -5242,7 +5245,7 @@ bool FurnaceGUI::loop() {
|
||||||
|
|
||||||
MEASURE_BEGIN(popup);
|
MEASURE_BEGIN(popup);
|
||||||
|
|
||||||
centerNextWindow(canvasW,canvasH);
|
centerNextWindow("Rendering...",canvasW,canvasH);
|
||||||
if (ImGui::BeginPopupModal("Rendering...",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::BeginPopupModal("Rendering...",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
ImGui::Text("Please wait...");
|
ImGui::Text("Please wait...");
|
||||||
if (ImGui::Button("Abort")) {
|
if (ImGui::Button("Abort")) {
|
||||||
|
@ -5270,7 +5273,7 @@ bool FurnaceGUI::loop() {
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
centerNextWindow(canvasW,canvasH);
|
centerNextWindow("Error",canvasW,canvasH);
|
||||||
if (ImGui::BeginPopupModal("Error",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::BeginPopupModal("Error",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
ImGui::Text("%s",errorString.c_str());
|
ImGui::Text("%s",errorString.c_str());
|
||||||
if (ImGui::Button("OK")) {
|
if (ImGui::Button("OK")) {
|
||||||
|
@ -5279,7 +5282,7 @@ bool FurnaceGUI::loop() {
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
centerNextWindow(canvasW,canvasH);
|
centerNextWindow("Warning",canvasW,canvasH);
|
||||||
if (ImGui::BeginPopupModal("Warning",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::BeginPopupModal("Warning",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
ImGui::Text("%s",warnString.c_str());
|
ImGui::Text("%s",warnString.c_str());
|
||||||
switch (warnAction) {
|
switch (warnAction) {
|
||||||
|
@ -5661,7 +5664,7 @@ bool FurnaceGUI::loop() {
|
||||||
// TODO:
|
// TODO:
|
||||||
// - multiple selection
|
// - multiple selection
|
||||||
// - replace instrument
|
// - replace instrument
|
||||||
centerNextWindow(canvasW,canvasH);
|
centerNextWindow("Select Instrument",canvasW,canvasH);
|
||||||
if (ImGui::BeginPopupModal("Select Instrument",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::BeginPopupModal("Select Instrument",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
bool quitPlease=false;
|
bool quitPlease=false;
|
||||||
if (pendingInsSingle) {
|
if (pendingInsSingle) {
|
||||||
|
@ -5740,7 +5743,7 @@ bool FurnaceGUI::loop() {
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
centerNextWindow(canvasW,canvasH);
|
centerNextWindow("Import Raw Sample",canvasW,canvasH);
|
||||||
if (ImGui::BeginPopupModal("Import Raw Sample",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::BeginPopupModal("Import Raw Sample",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
ImGui::Text("Data type:");
|
ImGui::Text("Data type:");
|
||||||
for (int i=0; i<DIV_SAMPLE_DEPTH_MAX; i++) {
|
for (int i=0; i<DIV_SAMPLE_DEPTH_MAX; i++) {
|
||||||
|
|
|
@ -1550,6 +1550,7 @@ class FurnaceGUI {
|
||||||
int playOnLoad;
|
int playOnLoad;
|
||||||
int insTypeMenu;
|
int insTypeMenu;
|
||||||
int capitalMenuBar;
|
int capitalMenuBar;
|
||||||
|
int centerPopup;
|
||||||
unsigned int maxUndoSteps;
|
unsigned int maxUndoSteps;
|
||||||
String mainFontPath;
|
String mainFontPath;
|
||||||
String headFontPath;
|
String headFontPath;
|
||||||
|
@ -1714,6 +1715,7 @@ class FurnaceGUI {
|
||||||
playOnLoad(0),
|
playOnLoad(0),
|
||||||
insTypeMenu(1),
|
insTypeMenu(1),
|
||||||
capitalMenuBar(0),
|
capitalMenuBar(0),
|
||||||
|
centerPopup(1),
|
||||||
maxUndoSteps(100),
|
maxUndoSteps(100),
|
||||||
mainFontPath(""),
|
mainFontPath(""),
|
||||||
headFontPath(""),
|
headFontPath(""),
|
||||||
|
@ -2139,6 +2141,8 @@ class FurnaceGUI {
|
||||||
ImVec4 channelColor(int ch);
|
ImVec4 channelColor(int ch);
|
||||||
ImVec4 channelTextColor(int ch);
|
ImVec4 channelTextColor(int ch);
|
||||||
|
|
||||||
|
void centerNextWindow(const char* name, float w, float h);
|
||||||
|
|
||||||
void readOsc();
|
void readOsc();
|
||||||
void calcChanOsc();
|
void calcChanOsc();
|
||||||
|
|
||||||
|
|
|
@ -1667,6 +1667,11 @@ void FurnaceGUI::drawSettings() {
|
||||||
applyUISettings(false);
|
applyUISettings(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool centerPopupB=settings.centerPopup;
|
||||||
|
if (ImGui::Checkbox("Center pop-up windows",¢erPopupB)) {
|
||||||
|
settings.centerPopup=centerPopupB;
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Text("Play/edit controls layout:");
|
ImGui::Text("Play/edit controls layout:");
|
||||||
ImGui::Indent();
|
ImGui::Indent();
|
||||||
if (ImGui::RadioButton("Classic##ecl0",settings.controlLayout==0)) {
|
if (ImGui::RadioButton("Classic##ecl0",settings.controlLayout==0)) {
|
||||||
|
@ -3060,6 +3065,7 @@ void FurnaceGUI::syncSettings() {
|
||||||
settings.playOnLoad=e->getConfInt("playOnLoad",0);
|
settings.playOnLoad=e->getConfInt("playOnLoad",0);
|
||||||
settings.insTypeMenu=e->getConfInt("insTypeMenu",1);
|
settings.insTypeMenu=e->getConfInt("insTypeMenu",1);
|
||||||
settings.capitalMenuBar=e->getConfInt("capitalMenuBar",0);
|
settings.capitalMenuBar=e->getConfInt("capitalMenuBar",0);
|
||||||
|
settings.centerPopup=e->getConfInt("centerPopup",1);
|
||||||
|
|
||||||
clampSetting(settings.mainFontSize,2,96);
|
clampSetting(settings.mainFontSize,2,96);
|
||||||
clampSetting(settings.headFontSize,2,96);
|
clampSetting(settings.headFontSize,2,96);
|
||||||
|
@ -3196,6 +3202,7 @@ void FurnaceGUI::syncSettings() {
|
||||||
clampSetting(settings.playOnLoad,0,2);
|
clampSetting(settings.playOnLoad,0,2);
|
||||||
clampSetting(settings.insTypeMenu,0,1);
|
clampSetting(settings.insTypeMenu,0,1);
|
||||||
clampSetting(settings.capitalMenuBar,0,1);
|
clampSetting(settings.capitalMenuBar,0,1);
|
||||||
|
clampSetting(settings.centerPopup,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;
|
||||||
|
@ -3432,6 +3439,7 @@ void FurnaceGUI::commitSettings() {
|
||||||
e->setConf("playOnLoad",settings.playOnLoad);
|
e->setConf("playOnLoad",settings.playOnLoad);
|
||||||
e->setConf("insTypeMenu",settings.insTypeMenu);
|
e->setConf("insTypeMenu",settings.insTypeMenu);
|
||||||
e->setConf("capitalMenuBar",settings.capitalMenuBar);
|
e->setConf("capitalMenuBar",settings.capitalMenuBar);
|
||||||
|
e->setConf("centerPopup",settings.centerPopup);
|
||||||
|
|
||||||
// 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