GUI: add pattern cell spacing settings

This commit is contained in:
tildearrow 2022-05-26 22:26:44 -05:00
parent 3a9ef81fe0
commit 33dc18bac2
3 changed files with 78 additions and 10 deletions

View File

@ -943,6 +943,11 @@ class FurnaceGUI {
int noMultiSystem;
int oldMacroVSlider;
int displayAllInsTypes;
int noteCellSpacing;
int insCellSpacing;
int volCellSpacing;
int effectCellSpacing;
int effectValCellSpacing;
unsigned int maxUndoSteps;
String mainFontPath;
String patFontPath;
@ -1036,6 +1041,11 @@ class FurnaceGUI {
noMultiSystem(0),
oldMacroVSlider(0),
displayAllInsTypes(0),
noteCellSpacing(0),
insCellSpacing(0),
volCellSpacing(0),
effectCellSpacing(0),
effectValCellSpacing(0),
maxUndoSteps(100),
mainFontPath(""),
patFontPath(""),
@ -1183,6 +1193,7 @@ class FurnaceGUI {
// pattern view specific
ImVec2 fourChars, threeChars, twoChars;
ImVec2 noteCellSize, insCellSize, volCellSize, effectCellSize, effectValCellSize;
SelectionPoint sel1, sel2;
int dummyRows, demandX;
int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax;

View File

@ -138,12 +138,12 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_CURSOR]);
ImGui::PushStyleColor(ImGuiCol_HeaderActive,uiColors[GUI_COLOR_PATTERN_CURSOR_ACTIVE]);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,uiColors[GUI_COLOR_PATTERN_CURSOR_HOVER]);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,threeChars);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,noteCellSize);
demandX=ImGui::GetCursorPosX();
ImGui::PopStyleColor(3);
} else {
if (selectedNote) ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_SELECTION]);
ImGui::Selectable(id,isPushing || selectedNote,ImGuiSelectableFlags_NoPadWithHalfSpacing,threeChars);
ImGui::Selectable(id,isPushing || selectedNote,ImGuiSelectableFlags_NoPadWithHalfSpacing,noteCellSize);
if (selectedNote) ImGui::PopStyleColor();
}
if (ImGui::IsItemClicked()) {
@ -178,12 +178,12 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_CURSOR]);
ImGui::PushStyleColor(ImGuiCol_HeaderActive,uiColors[GUI_COLOR_PATTERN_CURSOR_ACTIVE]);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,uiColors[GUI_COLOR_PATTERN_CURSOR_HOVER]);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,insCellSize);
demandX=ImGui::GetCursorPosX();
ImGui::PopStyleColor(3);
} else {
if (selectedIns) ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_SELECTION]);
ImGui::Selectable(id,isPushing || selectedIns,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
ImGui::Selectable(id,isPushing || selectedIns,ImGuiSelectableFlags_NoPadWithHalfSpacing,insCellSize);
if (selectedIns) ImGui::PopStyleColor();
}
if (ImGui::IsItemClicked()) {
@ -212,12 +212,12 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_CURSOR]);
ImGui::PushStyleColor(ImGuiCol_HeaderActive,uiColors[GUI_COLOR_PATTERN_CURSOR_ACTIVE]);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,uiColors[GUI_COLOR_PATTERN_CURSOR_HOVER]);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,volCellSize);
demandX=ImGui::GetCursorPosX();
ImGui::PopStyleColor(3);
} else {
if (selectedVol) ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_SELECTION]);
ImGui::Selectable(id,isPushing || selectedVol,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
ImGui::Selectable(id,isPushing || selectedVol,ImGuiSelectableFlags_NoPadWithHalfSpacing,volCellSize);
if (selectedVol) ImGui::PopStyleColor();
}
if (ImGui::IsItemClicked()) {
@ -257,12 +257,12 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_CURSOR]);
ImGui::PushStyleColor(ImGuiCol_HeaderActive,uiColors[GUI_COLOR_PATTERN_CURSOR_ACTIVE]);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,uiColors[GUI_COLOR_PATTERN_CURSOR_HOVER]);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,effectCellSize);
demandX=ImGui::GetCursorPosX();
ImGui::PopStyleColor(3);
} else {
if (selectedEffect) ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_SELECTION]);
ImGui::Selectable(id,isPushing || selectedEffect,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
ImGui::Selectable(id,isPushing || selectedEffect,ImGuiSelectableFlags_NoPadWithHalfSpacing,effectCellSize);
if (selectedEffect) ImGui::PopStyleColor();
}
if (ImGui::IsItemClicked()) {
@ -283,12 +283,12 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_CURSOR]);
ImGui::PushStyleColor(ImGuiCol_HeaderActive,uiColors[GUI_COLOR_PATTERN_CURSOR_ACTIVE]);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,uiColors[GUI_COLOR_PATTERN_CURSOR_HOVER]);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,effectValCellSize);
demandX=ImGui::GetCursorPosX();
ImGui::PopStyleColor(3);
} else {
if (selectedEffectVal) ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_SELECTION]);
ImGui::Selectable(id,isPushing || selectedEffectVal,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
ImGui::Selectable(id,isPushing || selectedEffectVal,ImGuiSelectableFlags_NoPadWithHalfSpacing,effectValCellSize);
if (selectedEffectVal) ImGui::PopStyleColor();
}
if (ImGui::IsItemClicked()) {
@ -549,7 +549,20 @@ void FurnaceGUI::drawPattern() {
threeChars=ImVec2(oneCharSize*3.0f,lineHeight);
twoChars=ImVec2(oneCharSize*2.0f,lineHeight);
//ImVec2 oneChar=ImVec2(oneCharSize,lineHeight);
noteCellSize=threeChars;
noteCellSize.x+=(float)settings.noteCellSpacing*dpiScale;
insCellSize=twoChars;
insCellSize.x+=(float)settings.insCellSpacing*dpiScale;
volCellSize=twoChars;
volCellSize.x+=(float)settings.volCellSpacing*dpiScale;
effectCellSize=twoChars;
effectCellSize.x+=(float)settings.effectCellSpacing*dpiScale;
effectValCellSize=twoChars;
effectValCellSize.x+=(float)settings.effectValCellSpacing*dpiScale;
dummyRows=(ImGui::GetWindowSize().y/lineHeight)/2;
// オップナー2608 i owe you one more for this horrible code
// previous pattern
ImGui::BeginDisabled();

View File

@ -1240,6 +1240,35 @@ void FurnaceGUI::drawSettings() {
ImGui::Separator();
ImGui::Text("Pattern view spacing after:");
if (CWSliderInt("Note",&settings.noteCellSpacing,0,32)) {
if (settings.noteCellSpacing<0) settings.noteCellSpacing=0;
if (settings.noteCellSpacing>32) settings.noteCellSpacing=32;
}
if (CWSliderInt("Instrument",&settings.insCellSpacing,0,32)) {
if (settings.insCellSpacing<0) settings.insCellSpacing=0;
if (settings.insCellSpacing>32) settings.insCellSpacing=32;
}
if (CWSliderInt("Volume",&settings.volCellSpacing,0,32)) {
if (settings.volCellSpacing<0) settings.volCellSpacing=0;
if (settings.volCellSpacing>32) settings.volCellSpacing=32;
}
if (CWSliderInt("Effect",&settings.effectCellSpacing,0,32)) {
if (settings.effectCellSpacing<0) settings.effectCellSpacing=0;
if (settings.effectCellSpacing>32) settings.effectCellSpacing=32;
}
if (CWSliderInt("Effect value",&settings.effectValCellSpacing,0,32)) {
if (settings.effectValCellSpacing<0) settings.effectValCellSpacing=0;
if (settings.effectValCellSpacing>32) settings.effectValCellSpacing=32;
}
ImGui::Separator();
if (ImGui::TreeNode("Color scheme")) {
if (ImGui::Button("Import")) {
openFileDialog(GUI_FILE_IMPORT_COLORS);
@ -1975,6 +2004,11 @@ void FurnaceGUI::syncSettings() {
settings.noMultiSystem=e->getConfInt("noMultiSystem",0);
settings.oldMacroVSlider=e->getConfInt("oldMacroVSlider",0);
settings.displayAllInsTypes=e->getConfInt("displayAllInsTypes",0);
settings.noteCellSpacing=e->getConfInt("noteCellSpacing",0);
settings.insCellSpacing=e->getConfInt("insCellSpacing",0);
settings.volCellSpacing=e->getConfInt("volCellSpacing",0);
settings.effectCellSpacing=e->getConfInt("effectCellSpacing",0);
settings.effectValCellSpacing=e->getConfInt("effectValCellSpacing",0);
clampSetting(settings.mainFontSize,2,96);
clampSetting(settings.patFontSize,2,96);
@ -2052,6 +2086,11 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.noMultiSystem,0,1);
clampSetting(settings.oldMacroVSlider,0,1);
clampSetting(settings.displayAllInsTypes,0,1);
clampSetting(settings.noteCellSpacing,0,32);
clampSetting(settings.insCellSpacing,0,32);
clampSetting(settings.volCellSpacing,0,32);
clampSetting(settings.effectCellSpacing,0,32);
clampSetting(settings.effectValCellSpacing,0,32);
settings.initialSys=e->decodeSysDesc(e->getConfString("initialSys",""));
if (settings.initialSys.size()<4) {
@ -2178,6 +2217,11 @@ void FurnaceGUI::commitSettings() {
e->setConf("noMultiSystem",settings.noMultiSystem);
e->setConf("oldMacroVSlider",settings.oldMacroVSlider);
e->setConf("displayAllInsTypes",settings.displayAllInsTypes);
e->setConf("noteCellSpacing",settings.noteCellSpacing);
e->setConf("insCellSpacing",settings.insCellSpacing);
e->setConf("volCellSpacing",settings.volCellSpacing);
e->setConf("effectCellSpacing",settings.effectCellSpacing);
e->setConf("effectValCellSpacing",settings.effectValCellSpacing);
// colors
for (int i=0; i<GUI_COLOR_MAX; i++) {