diff --git a/doc/2-interface/settings.md b/doc/2-interface/settings.md index 9dd473737..066d34e49 100644 --- a/doc/2-interface/settings.md +++ b/doc/2-interface/settings.md @@ -505,7 +505,10 @@ below all the binds, select a key from the dropdown list to add it. it will appe - **Grid** - **Single (with list)** - **Use classic macro editor vertical slider** -- **Automatic macro step size/horizontal zoom** +- **Macro step size/horizontal zoom:** + - **Manual** + - **Automatic per macro** + - **Automatic (use longest macro)** ### Wave Editor diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index af803a3f1..d137957ff 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -2118,7 +2118,7 @@ void FurnaceGUI::drawMacroEdit(FurnaceGUIMacroDesc& i, int totalFit, float avail if ((i.macro->vScroll+i.macro->vZoom)>(i.max-i.min)) { i.macro->vScroll=(i.max-i.min)-i.macro->vZoom; } - } else if (!settings.autoMacroStepSize) { + } else if (settings.autoMacroStepSize==0) { macroPointSize+=wheelY; if (macroPointSize<1) macroPointSize=1; if (macroPointSize>256) macroPointSize=256; @@ -2486,7 +2486,13 @@ void FurnaceGUI::drawMacroEdit(FurnaceGUIMacroDesc& i, int totalFit, float avail void FurnaceGUI::drawMacros(std::vector& macros, FurnaceGUIMacroEditState& state) { int index=0; + int maxMacroLen=0; float reservedSpace=(settings.oldMacroVSlider)?(20.0f*dpiScale+ImGui::GetStyle().ItemSpacing.x):ImGui::GetStyle().ScrollbarSize; + + for (FurnaceGUIMacroDesc& m: macros) { + if (m.macro->len>maxMacroLen) maxMacroLen=m.macro->len; + } + switch (settings.macroLayout) { case 0: { if (ImGui::BeginTable("MacroSpace",2)) { @@ -2501,7 +2507,7 @@ void FurnaceGUI::drawMacros(std::vector& macros, FurnaceGUI ImGui::TableNextColumn(); float lenAvail=ImGui::GetContentRegionAvail().x; //ImGui::Dummy(ImVec2(120.0f*dpiScale,dpiScale)); - if (!settings.autoMacroStepSize) { + if (settings.autoMacroStepSize==0) { ImGui::SetNextItemWidth(120.0f*dpiScale); if (ImGui::InputInt("##MacroPointSize",¯oPointSize,1,4)) { if (macroPointSize<1) macroPointSize=1; @@ -2512,11 +2518,13 @@ void FurnaceGUI::drawMacros(std::vector& macros, FurnaceGUI float availableWidth=ImGui::GetContentRegionAvail().x-reservedSpace; int totalFit=MIN(255,availableWidth/MAX(1,macroPointSize*dpiScale)); int scrollMax=0; - if (settings.autoMacroStepSize) totalFit=1; + if (settings.autoMacroStepSize!=0) totalFit=1; for (FurnaceGUIMacroDesc& i: macros) { if (i.macro->len>scrollMax) scrollMax=i.macro->len; - if (settings.autoMacroStepSize) { + if (settings.autoMacroStepSize==1) { if ((i.macro->open&6)==0 && totalFitlen) totalFit=i.macro->len; + } else if (settings.autoMacroStepSize==2) { + if ((i.macro->open&6)==0 && totalFit& macros, FurnaceGUI ImGui::TableNextRow(); ImGui::TableNextColumn(); for (size_t i=0; ilen>0) { + snprintf(buf,255,"%s [%d]###%s",macros[i].displayName,macros[i].macro->len,macros[i].displayName); + } else { + snprintf(buf,255,"%s",macros[i].displayName); + } + + ImVec2 size=ImGui::CalcTextSize(buf); + size.x=MAX(stretchX,size.x); + if (ImGui::Selectable(buf,state.selectedMacro==(int)i,0,size)) { state.selectedMacro=i; } } @@ -2697,7 +2720,8 @@ void FurnaceGUI::drawMacros(std::vector& macros, FurnaceGUI for (FurnaceGUIMacroDesc& i: macros) { if (i.macro->len>scrollMax) scrollMax=i.macro->len; } - if (settings.autoMacroStepSize) totalFit=MAX(1,m.macro->len); + if (settings.autoMacroStepSize==1) totalFit=MAX(1,m.macro->len); + else if (settings.autoMacroStepSize==2) totalFit=MAX(1,maxMacroLen); scrollMax-=totalFit; if (scrollMax<0) scrollMax=0; if (macroDragScroll>scrollMax) { @@ -2711,7 +2735,7 @@ void FurnaceGUI::drawMacros(std::vector& macros, FurnaceGUI } ImGui::EndDisabled(); - if (!settings.autoMacroStepSize) { + if (settings.autoMacroStepSize==0) { ImGui::SameLine(); ImGui::Button(ICON_FA_SEARCH_PLUS "##MacroZoomB"); if (ImGui::BeginPopupContextItem("MacroZoomP",ImGuiPopupFlags_MouseButtonLeft)) { diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index e4c19bb49..aa5ed6a72 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -3653,11 +3653,21 @@ void FurnaceGUI::drawSettings() { } ImGui::BeginDisabled(settings.macroLayout==2); - bool autoMacroStepSizeB=settings.autoMacroStepSize; - if (ImGui::Checkbox(_("Automatic macro step size/horizontal zoom"),&autoMacroStepSizeB)) { - settings.autoMacroStepSize=autoMacroStepSizeB; + ImGui::Text(_("Macro step size/horizontal zoom:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Manual"),settings.autoMacroStepSize==0)) { + settings.autoMacroStepSize=0; settingsChanged=true; } + if (ImGui::RadioButton(_("Automatic per macro"),settings.autoMacroStepSize==1)) { + settings.autoMacroStepSize=1; + settingsChanged=true; + } + if (ImGui::RadioButton(_("Automatic (use longest macro)"),settings.autoMacroStepSize==2)) { + settings.autoMacroStepSize=2; + settingsChanged=true; + } + ImGui::Unindent(); ImGui::EndDisabled(); // SUBSECTION WAVE EDITOR @@ -5359,7 +5369,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { clampSetting(settings.backupInterval,10,86400); clampSetting(settings.backupMaxCopies,1,100); clampSetting(settings.autoFillSave,0,1); - clampSetting(settings.autoMacroStepSize,0,1); + clampSetting(settings.autoMacroStepSize,0,2); clampSetting(settings.s3mOPL3,0,1); if (settings.exportLoops<0.0) settings.exportLoops=0.0;