mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-06 23:51:21 +00:00
Merge remote-tracking branch 'alederer/macro-editor-list-show-modified'
This commit is contained in:
commit
5f78df0cd7
3 changed files with 49 additions and 12 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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<FurnaceGUIMacroDesc>& 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<FurnaceGUIMacroDesc>& 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<FurnaceGUIMacroDesc>& 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 && totalFit<i.macro->len) totalFit=i.macro->len;
|
||||
} else if (settings.autoMacroStepSize==2) {
|
||||
if ((i.macro->open&6)==0 && totalFit<maxMacroLen) totalFit=maxMacroLen;
|
||||
}
|
||||
}
|
||||
scrollMax-=totalFit;
|
||||
|
@ -2671,7 +2679,22 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros, FurnaceGUI
|
|||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
for (size_t i=0; i<macros.size(); i++) {
|
||||
if (ImGui::Selectable(macros[i].displayName,state.selectedMacro==(int)i)) {
|
||||
// include macro len if non-zero, making particularly clear at-a-glance which macros
|
||||
// have non-zero len (i.e. are active). and calculate how big we need to be to leave some
|
||||
// extra space so the column doesn't change size when len is changed under typical
|
||||
// circumstances (really don't want to move buttons while mouse is being clicked or held).
|
||||
char buf[256];
|
||||
float stretchX=ImGui::CalcTextSize(buf).x;
|
||||
|
||||
if (macros[i].macro->len>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<FurnaceGUIMacroDesc>& 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<FurnaceGUIMacroDesc>& 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)) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue