GUI: this sucks...

This commit is contained in:
tildearrow 2024-07-25 19:59:21 -05:00
parent 4774a38669
commit fc772388b7
3 changed files with 161 additions and 145 deletions

View file

@ -2751,6 +2751,7 @@ class FurnaceGUI {
void drawMacros(std::vector<FurnaceGUIMacroDesc>& macros, FurnaceGUIMacroEditState& state); void drawMacros(std::vector<FurnaceGUIMacroDesc>& macros, FurnaceGUIMacroEditState& state);
void alterSampleMap(int column, int val); void alterSampleMap(int column, int val);
void insTabFMModernHeader(DivInstrument* ins);
void insTabFM(DivInstrument* ins); void insTabFM(DivInstrument* ins);
void insTabSample(DivInstrument* ins); void insTabSample(DivInstrument* ins);

View file

@ -3078,6 +3078,151 @@ void FurnaceGUI::insTabSample(DivInstrument* ins) {
} }
} }
void FurnaceGUI::insTabFMModernHeader(DivInstrument* ins) {
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
ImGui::TableNextColumn();
if (ins->type==DIV_INS_ESFM) {
ImGui::TableNextColumn();
CENTER_TEXT(ESFM_SHORT_NAME(ESFM_MODIN));
ImGui::TextUnformatted(ESFM_SHORT_NAME(ESFM_MODIN));
TOOLTIP_TEXT(ESFM_LONG_NAME(ESFM_MODIN));
ImGui::TableNextColumn();
ImGui::TableNextColumn();
CENTER_TEXT(ESFM_SHORT_NAME(ESFM_DELAY));
ImGui::TextUnformatted(ESFM_SHORT_NAME(ESFM_DELAY));
TOOLTIP_TEXT(ESFM_LONG_NAME(ESFM_DELAY));
}
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_AR));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_AR));
TOOLTIP_TEXT(FM_NAME(FM_AR));
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_DR));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_DR));
TOOLTIP_TEXT(FM_NAME(FM_DR));
if (settings.susPosition==0) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_SL));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_SL));
TOOLTIP_TEXT(FM_NAME(FM_SL));
}
if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPZ || ins->type==DIV_INS_OPM) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_D2R));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_D2R));
TOOLTIP_TEXT(FM_NAME(FM_D2R));
}
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_RR));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_RR));
TOOLTIP_TEXT(FM_NAME(FM_RR));
if (settings.susPosition==1) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_SL));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_SL));
TOOLTIP_TEXT(FM_NAME(FM_SL));
}
ImGui::TableNextColumn();
if (settings.susPosition==2) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_SL));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_SL));
TOOLTIP_TEXT(FM_NAME(FM_SL));
}
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_TL));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_TL));
TOOLTIP_TEXT(FM_NAME(FM_TL));
if (settings.susPosition==3) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_SL));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_SL));
TOOLTIP_TEXT(FM_NAME(FM_SL));
}
ImGui::TableNextColumn();
if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPZ || ins->type==DIV_INS_OPM) {
CENTER_TEXT(FM_SHORT_NAME(FM_RS));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_RS));
TOOLTIP_TEXT(FM_NAME(FM_RS));
} else {
CENTER_TEXT(FM_SHORT_NAME(FM_KSL));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_KSL));
TOOLTIP_TEXT(FM_NAME(FM_KSL));
}
if (ins->type==DIV_INS_OPZ) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_EGSHIFT));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_EGSHIFT));
TOOLTIP_TEXT(FM_NAME(FM_EGSHIFT));
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_REV));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_REV));
TOOLTIP_TEXT(FM_NAME(FM_REV));
}
if (ins->type==DIV_INS_ESFM) {
ImGui::TableNextColumn();
CENTER_TEXT(ESFM_SHORT_NAME(ESFM_OUTLVL));
ImGui::TextUnformatted(ESFM_SHORT_NAME(ESFM_OUTLVL));
TOOLTIP_TEXT(ESFM_LONG_NAME(ESFM_OUTLVL));
}
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_MULT));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_MULT));
TOOLTIP_TEXT(FM_NAME(FM_MULT));
if (ins->type==DIV_INS_OPZ) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_FINE));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_FINE));
TOOLTIP_TEXT(FM_NAME(FM_FINE));
}
if (ins->type==DIV_INS_ESFM) {
ImGui::TableNextColumn();
CENTER_TEXT(ESFM_SHORT_NAME(ESFM_CT));
ImGui::TextUnformatted(ESFM_SHORT_NAME(ESFM_CT));
TOOLTIP_TEXT(ESFM_LONG_NAME(ESFM_CT));
}
ImGui::TableNextColumn();
if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPZ || ins->type==DIV_INS_OPM) {
CENTER_TEXT(FM_SHORT_NAME(FM_DT));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_DT));
TOOLTIP_TEXT(FM_NAME(FM_DT));
ImGui::TableNextColumn();
}
if (ins->type==DIV_INS_ESFM) {
CENTER_TEXT(ESFM_SHORT_NAME(ESFM_DT));
ImGui::TextUnformatted(ESFM_SHORT_NAME(ESFM_DT));
TOOLTIP_TEXT(ESFM_LONG_NAME(ESFM_DT));
ImGui::TableNextColumn();
}
if (ins->type==DIV_INS_OPZ || ins->type==DIV_INS_OPM) {
CENTER_TEXT(FM_SHORT_NAME(FM_DT2));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_DT2));
TOOLTIP_TEXT(FM_NAME(FM_DT2));
ImGui::TableNextColumn();
}
if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPM) {
CENTER_TEXT(FM_SHORT_NAME(FM_AM));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_AM));
TOOLTIP_TEXT(FM_NAME(FM_AM));
} else {
CENTER_TEXT("Other");
ImGui::TextUnformatted("Other");
}
ImGui::TableNextColumn();
if (ins->type==DIV_INS_OPL || ins->type==DIV_INS_OPL_DRUMS || ins->type==DIV_INS_OPZ || ins->type==DIV_INS_ESFM) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_NAME(FM_WS));
ImGui::TextUnformatted(FM_NAME(FM_WS));
} else if (ins->type!=DIV_INS_OPLL && ins->type!=DIV_INS_OPM) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_NAME(FM_SSG));
ImGui::TextUnformatted(FM_NAME(FM_SSG));
}
ImGui::TableNextColumn();
CENTER_TEXT(_("Envelope"));
ImGui::TextUnformatted(_("Envelope"));
}
void FurnaceGUI::insTabFM(DivInstrument* ins) { void FurnaceGUI::insTabFM(DivInstrument* ins) {
int opCount=4; int opCount=4;
if (ins->type==DIV_INS_OPLL) opCount=2; if (ins->type==DIV_INS_OPLL) opCount=2;
@ -3374,7 +3519,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
} }
ImGui::BeginDisabled(!willDisplayOps); ImGui::BeginDisabled(!willDisplayOps);
if (settings.fmLayout==0) { if (settings.fmLayout==0 || settings.fmLayout==7) {
int numCols=15; int numCols=15;
if (ins->type==DIV_INS_OPL ||ins->type==DIV_INS_OPL_DRUMS) numCols=13; if (ins->type==DIV_INS_OPL ||ins->type==DIV_INS_OPL_DRUMS) numCols=13;
if (ins->type==DIV_INS_OPLL) numCols=12; if (ins->type==DIV_INS_OPLL) numCols=12;
@ -3429,156 +3574,23 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
} }
ImGui::TableSetupColumn("c14",ImGuiTableColumnFlags_WidthStretch,0.3f); // env ImGui::TableSetupColumn("c14",ImGuiTableColumnFlags_WidthStretch,0.3f); // env
float sliderHeight=((ImGui::GetContentRegionAvail().y-ImGui::GetFrameHeightWithSpacing()*(settings.fmLayout==7?4.0f:1.0f))/opCount)-ImGui::GetStyle().ItemSpacing.y;
// header // header
ImGui::TableNextRow(ImGuiTableRowFlags_Headers); if (settings.fmLayout==0) {
ImGui::TableNextColumn(); insTabFMModernHeader(ins);
if (ins->type==DIV_INS_ESFM) {
ImGui::TableNextColumn();
CENTER_TEXT(ESFM_SHORT_NAME(ESFM_MODIN));
ImGui::TextUnformatted(ESFM_SHORT_NAME(ESFM_MODIN));
TOOLTIP_TEXT(ESFM_LONG_NAME(ESFM_MODIN));
ImGui::TableNextColumn();
ImGui::TableNextColumn();
CENTER_TEXT(ESFM_SHORT_NAME(ESFM_DELAY));
ImGui::TextUnformatted(ESFM_SHORT_NAME(ESFM_DELAY));
TOOLTIP_TEXT(ESFM_LONG_NAME(ESFM_DELAY));
} }
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_AR));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_AR));
TOOLTIP_TEXT(FM_NAME(FM_AR));
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_DR));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_DR));
TOOLTIP_TEXT(FM_NAME(FM_DR));
if (settings.susPosition==0) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_SL));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_SL));
TOOLTIP_TEXT(FM_NAME(FM_SL));
}
if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPZ || ins->type==DIV_INS_OPM) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_D2R));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_D2R));
TOOLTIP_TEXT(FM_NAME(FM_D2R));
}
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_RR));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_RR));
TOOLTIP_TEXT(FM_NAME(FM_RR));
if (settings.susPosition==1) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_SL));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_SL));
TOOLTIP_TEXT(FM_NAME(FM_SL));
}
ImGui::TableNextColumn();
if (settings.susPosition==2) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_SL));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_SL));
TOOLTIP_TEXT(FM_NAME(FM_SL));
}
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_TL));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_TL));
TOOLTIP_TEXT(FM_NAME(FM_TL));
if (settings.susPosition==3) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_SL));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_SL));
TOOLTIP_TEXT(FM_NAME(FM_SL));
}
ImGui::TableNextColumn();
if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPZ || ins->type==DIV_INS_OPM) {
CENTER_TEXT(FM_SHORT_NAME(FM_RS));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_RS));
TOOLTIP_TEXT(FM_NAME(FM_RS));
} else {
CENTER_TEXT(FM_SHORT_NAME(FM_KSL));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_KSL));
TOOLTIP_TEXT(FM_NAME(FM_KSL));
}
if (ins->type==DIV_INS_OPZ) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_EGSHIFT));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_EGSHIFT));
TOOLTIP_TEXT(FM_NAME(FM_EGSHIFT));
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_REV));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_REV));
TOOLTIP_TEXT(FM_NAME(FM_REV));
}
if (ins->type==DIV_INS_ESFM) {
ImGui::TableNextColumn();
CENTER_TEXT(ESFM_SHORT_NAME(ESFM_OUTLVL));
ImGui::TextUnformatted(ESFM_SHORT_NAME(ESFM_OUTLVL));
TOOLTIP_TEXT(ESFM_LONG_NAME(ESFM_OUTLVL));
}
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_MULT));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_MULT));
TOOLTIP_TEXT(FM_NAME(FM_MULT));
if (ins->type==DIV_INS_OPZ) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_SHORT_NAME(FM_FINE));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_FINE));
TOOLTIP_TEXT(FM_NAME(FM_FINE));
}
if (ins->type==DIV_INS_ESFM) {
ImGui::TableNextColumn();
CENTER_TEXT(ESFM_SHORT_NAME(ESFM_CT));
ImGui::TextUnformatted(ESFM_SHORT_NAME(ESFM_CT));
TOOLTIP_TEXT(ESFM_LONG_NAME(ESFM_CT));
}
ImGui::TableNextColumn();
if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPZ || ins->type==DIV_INS_OPM) {
CENTER_TEXT(FM_SHORT_NAME(FM_DT));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_DT));
TOOLTIP_TEXT(FM_NAME(FM_DT));
ImGui::TableNextColumn();
}
if (ins->type==DIV_INS_ESFM) {
CENTER_TEXT(ESFM_SHORT_NAME(ESFM_DT));
ImGui::TextUnformatted(ESFM_SHORT_NAME(ESFM_DT));
TOOLTIP_TEXT(ESFM_LONG_NAME(ESFM_DT));
ImGui::TableNextColumn();
}
if (ins->type==DIV_INS_OPZ || ins->type==DIV_INS_OPM) {
CENTER_TEXT(FM_SHORT_NAME(FM_DT2));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_DT2));
TOOLTIP_TEXT(FM_NAME(FM_DT2));
ImGui::TableNextColumn();
}
if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPM) {
CENTER_TEXT(FM_SHORT_NAME(FM_AM));
ImGui::TextUnformatted(FM_SHORT_NAME(FM_AM));
TOOLTIP_TEXT(FM_NAME(FM_AM));
} else {
CENTER_TEXT("Other");
ImGui::TextUnformatted("Other");
}
ImGui::TableNextColumn();
if (ins->type==DIV_INS_OPL || ins->type==DIV_INS_OPL_DRUMS || ins->type==DIV_INS_OPZ || ins->type==DIV_INS_ESFM) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_NAME(FM_WS));
ImGui::TextUnformatted(FM_NAME(FM_WS));
} else if (ins->type!=DIV_INS_OPLL && ins->type!=DIV_INS_OPM) {
ImGui::TableNextColumn();
CENTER_TEXT(FM_NAME(FM_SSG));
ImGui::TextUnformatted(FM_NAME(FM_SSG));
}
ImGui::TableNextColumn();
CENTER_TEXT(_("Envelope"));
ImGui::TextUnformatted(_("Envelope"));
float sliderHeight=32.0f*dpiScale;
// main view
for (int i=0; i<opCount; i++) { for (int i=0; i<opCount; i++) {
DivInstrumentFM::Operator& op=fmOrigin.op[(opCount==4 && ins->type!=DIV_INS_OPL_DRUMS && ins->type!=DIV_INS_ESFM)?opOrder[i]:i]; DivInstrumentFM::Operator& op=fmOrigin.op[(opCount==4 && ins->type!=DIV_INS_OPL_DRUMS && ins->type!=DIV_INS_ESFM)?opOrder[i]:i];
DivInstrumentESFM::Operator& opE=ins->esfm.op[i]; DivInstrumentESFM::Operator& opE=ins->esfm.op[i];
// modern with more labels
if (settings.fmLayout==7) {
insTabFMModernHeader(ins);
}
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
@ -3630,7 +3642,6 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
} }
if (i==0) { if (i==0) {
sliderHeight=(ImGui::GetContentRegionAvail().y/opCount)-ImGui::GetStyle().ItemSpacing.y;
float sliderMinHeightOPL=ImGui::GetFrameHeight()*4.0+ImGui::GetStyle().ItemSpacing.y*3.0; float sliderMinHeightOPL=ImGui::GetFrameHeight()*4.0+ImGui::GetStyle().ItemSpacing.y*3.0;
float sliderMinHeightESFM=ImGui::GetFrameHeight()*5.0+ImGui::GetStyle().ItemSpacing.y*4.0; float sliderMinHeightESFM=ImGui::GetFrameHeight()*5.0+ImGui::GetStyle().ItemSpacing.y*4.0;
if ((ins->type==DIV_INS_OPL || ins->type==DIV_INS_OPL_DRUMS || ins->type==DIV_INS_OPLL) && sliderHeight<sliderMinHeightOPL) { if ((ins->type==DIV_INS_OPL || ins->type==DIV_INS_OPL_DRUMS || ins->type==DIV_INS_OPLL) && sliderHeight<sliderMinHeightOPL) {

View file

@ -3654,6 +3654,10 @@ void FurnaceGUI::drawSettings() {
settings.fmLayout=0; settings.fmLayout=0;
settingsChanged=true; settingsChanged=true;
} }
if (ImGui::RadioButton(_("Modern with more labels##fml7"),settings.fmLayout==7)) {
settings.fmLayout=7;
settingsChanged=true;
}
if (ImGui::RadioButton(_("Compact (2x2, classic)##fml1"),settings.fmLayout==1)) { if (ImGui::RadioButton(_("Compact (2x2, classic)##fml1"),settings.fmLayout==1)) {
settings.fmLayout=1; settings.fmLayout=1;
settingsChanged=true; settingsChanged=true;