Merge branch 'master' of https://github.com/tildearrow/furnace into es5506_alt

This commit is contained in:
cam900 2023-02-05 10:00:27 +09:00
commit dd79ae401b
52 changed files with 578 additions and 329 deletions

View file

@ -1782,14 +1782,22 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros, FurnaceGUI
ImGui::TableNextColumn();
float availableWidth=ImGui::GetContentRegionAvail().x-reservedSpace;
int totalFit=MIN(255,availableWidth/MAX(1,macroPointSize*dpiScale));
if (macroDragScroll>255-totalFit) {
macroDragScroll=255-totalFit;
int scrollMax=0;
for (FurnaceGUIMacroDesc& i: macros) {
if (i.macro->len>scrollMax) scrollMax=i.macro->len;
}
scrollMax-=totalFit;
if (scrollMax<0) scrollMax=0;
if (macroDragScroll>scrollMax) {
macroDragScroll=scrollMax;
}
ImGui::BeginDisabled(scrollMax<1);
ImGui::SetNextItemWidth(availableWidth);
if (CWSliderInt("##MacroScroll",&macroDragScroll,0,255-totalFit,"")) {
if (CWSliderInt("##MacroScroll",&macroDragScroll,0,scrollMax,"")) {
if (macroDragScroll<0) macroDragScroll=0;
if (macroDragScroll>255-totalFit) macroDragScroll=255-totalFit;
if (macroDragScroll>scrollMax) macroDragScroll=scrollMax;
}
ImGui::EndDisabled();
// draw macros
for (FurnaceGUIMacroDesc& i: macros) {
@ -1838,11 +1846,13 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros, FurnaceGUI
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TableNextColumn();
ImGui::BeginDisabled(scrollMax<1);
ImGui::SetNextItemWidth(availableWidth);
if (CWSliderInt("##MacroScroll",&macroDragScroll,0,255-totalFit,"")) {
if (CWSliderInt("##MacroScroll",&macroDragScroll,0,scrollMax,"")) {
if (macroDragScroll<0) macroDragScroll=0;
if (macroDragScroll>255-totalFit) macroDragScroll=255-totalFit;
if (macroDragScroll>scrollMax) macroDragScroll=scrollMax;
}
ImGui::EndDisabled();
ImGui::EndTable();
}
break;