GUI: add Colorize instrument editor using instrume

nt type option
This commit is contained in:
tildearrow 2022-04-12 21:30:12 -05:00
parent 152d05dbfc
commit 45f14a951a
4 changed files with 20 additions and 4 deletions

View file

@ -117,8 +117,8 @@ enum FurnaceGUIColors {
GUI_COLOR_MACRO_OTHER,
GUI_COLOR_MACRO_WAVE,
GUI_COLOR_INSTR_FM,
GUI_COLOR_INSTR_STD,
GUI_COLOR_INSTR_FM,
GUI_COLOR_INSTR_GB,
GUI_COLOR_INSTR_C64,
GUI_COLOR_INSTR_AMIGA,
@ -130,7 +130,6 @@ enum FurnaceGUIColors {
GUI_COLOR_INSTR_VIC,
GUI_COLOR_INSTR_PET,
GUI_COLOR_INSTR_VRC6,
GUI_COLOR_INSTR_VRC6_SAW,
GUI_COLOR_INSTR_OPLL,
GUI_COLOR_INSTR_OPL,
GUI_COLOR_INSTR_FDS,
@ -144,6 +143,7 @@ enum FurnaceGUIColors {
GUI_COLOR_INSTR_MIKEY,
GUI_COLOR_INSTR_VERA,
GUI_COLOR_INSTR_X1_010,
GUI_COLOR_INSTR_VRC6_SAW,
GUI_COLOR_INSTR_UNKNOWN,
GUI_COLOR_CHANNEL_FM,
@ -807,6 +807,7 @@ class FurnaceGUI {
int oscTakesEntireWindow;
int oscBorder;
int separateFMColors;
int insEditColorize;
unsigned int maxUndoSteps;
String mainFontPath;
String patFontPath;
@ -872,6 +873,7 @@ class FurnaceGUI {
oscTakesEntireWindow(0),
oscBorder(1),
separateFMColors(0),
insEditColorize(0),
maxUndoSteps(100),
mainFontPath(""),
patFontPath(""),

View file

@ -422,8 +422,8 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
D(GUI_COLOR_MACRO_OTHER,"",ImVec4(0.0f,0.9f,1.0f,1.0f)),
D(GUI_COLOR_MACRO_WAVE,"",ImVec4(1.0f,0.4f,0.0f,1.0f)),
D(GUI_COLOR_INSTR_FM,"",ImVec4(0.6f,0.9f,1.0f,1.0f)),
D(GUI_COLOR_INSTR_STD,"",ImVec4(0.6f,1.0f,0.5f,1.0f)),
D(GUI_COLOR_INSTR_FM,"",ImVec4(0.6f,0.9f,1.0f,1.0f)),
D(GUI_COLOR_INSTR_GB,"",ImVec4(1.0f,1.0f,0.5f,1.0f)),
D(GUI_COLOR_INSTR_C64,"",ImVec4(0.85f,0.8f,1.0f,1.0f)),
D(GUI_COLOR_INSTR_AMIGA,"",ImVec4(1.0f,0.5f,0.5f,1.0f)),
@ -435,7 +435,6 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
D(GUI_COLOR_INSTR_VIC,"",ImVec4(0.2f,1.0f,0.6f,1.0f)),
D(GUI_COLOR_INSTR_PET,"",ImVec4(1.0f,1.0f,0.8f,1.0f)),
D(GUI_COLOR_INSTR_VRC6,"",ImVec4(1.0f,0.9f,0.5f,1.0f)),
D(GUI_COLOR_INSTR_VRC6_SAW,"",ImVec4(0.8f,0.3f,0.0f,1.0f)),
D(GUI_COLOR_INSTR_OPLL,"",ImVec4(0.6f,0.7f,1.0f,1.0f)),
D(GUI_COLOR_INSTR_OPL,"",ImVec4(0.3f,1.0f,0.9f,1.0f)),
D(GUI_COLOR_INSTR_FDS,"",ImVec4(0.8f,0.5f,1.0f,1.0f)),
@ -449,6 +448,7 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
D(GUI_COLOR_INSTR_MIKEY,"",ImVec4(0.5f,1.0f,0.3f,1.0f)),
D(GUI_COLOR_INSTR_VERA,"",ImVec4(0.4f,0.6f,1.0f,1.0f)),
D(GUI_COLOR_INSTR_X1_010,"",ImVec4(0.3f,0.5f,1.0f,1.0f)),
D(GUI_COLOR_INSTR_VRC6_SAW,"",ImVec4(0.8f,0.3f,0.0f,1.0f)),
D(GUI_COLOR_INSTR_UNKNOWN,"",ImVec4(0.3f,0.3f,0.3f,1.0f)),
D(GUI_COLOR_CHANNEL_FM,"",ImVec4(0.2f,0.8f,1.0f,1.0f)),

View file

@ -1292,6 +1292,9 @@ void FurnaceGUI::drawInsEdit() {
ImGui::Text("no instrument selected");
} else {
DivInstrument* ins=e->song.ins[curIns];
if (settings.insEditColorize) {
pushAccentColors(uiColors[GUI_COLOR_INSTR_STD+ins->type],uiColors[GUI_COLOR_INSTR_STD+ins->type],uiColors[GUI_COLOR_INSTR_STD+ins->type],ImVec4(0.0f,0.0f,0.0f,0.0f));
}
if (ImGui::BeginTable("InsProp",3)) {
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthFixed);
@ -3050,6 +3053,9 @@ void FurnaceGUI::drawInsEdit() {
}
ImGui::EndTabBar();
}
if (settings.insEditColorize) {
popAccentColors();
}
}
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_INS_EDIT;

View file

@ -834,6 +834,11 @@ void FurnaceGUI::drawSettings() {
ImGui::Separator();
bool insEditColorizeB=settings.insEditColorize;
if (ImGui::Checkbox("Colorize instrument editor using instrument type",&insEditColorizeB)) {
settings.insEditColorize=insEditColorizeB;
}
bool separateFMColorsB=settings.separateFMColors;
if (ImGui::Checkbox("Use separate colors for carriers/modulators in FM editor",&separateFMColorsB)) {
settings.separateFMColors=separateFMColorsB;
@ -1553,6 +1558,7 @@ void FurnaceGUI::syncSettings() {
settings.oscTakesEntireWindow=e->getConfInt("oscTakesEntireWindow",0);
settings.oscBorder=e->getConfInt("oscBorder",1);
settings.separateFMColors=e->getConfInt("separateFMColors",0);
settings.insEditColorize=e->getConfInt("insEditColorize",0);
clampSetting(settings.mainFontSize,2,96);
clampSetting(settings.patFontSize,2,96);
@ -1607,6 +1613,7 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.effectDeletionAltersValue,0,1);
clampSetting(settings.sampleLayout,0,1);
clampSetting(settings.separateFMColors,0,1);
clampSetting(settings.insEditColorize,0,1);
// keybinds
for (int i=0; i<GUI_ACTION_MAX; i++) {
@ -1687,6 +1694,7 @@ void FurnaceGUI::commitSettings() {
e->setConf("oscTakesEntireWindow",settings.oscTakesEntireWindow);
e->setConf("oscBorder",settings.oscBorder);
e->setConf("separateFMColors",settings.separateFMColors);
e->setConf("insEditColorize",settings.insEditColorize);
// colors
for (int i=0; i<GUI_COLOR_MAX; i++) {