GUI: prepare for GB envelope view

This commit is contained in:
tildearrow 2022-04-16 23:58:29 -05:00
parent 99d57bf342
commit 003c9c3235
3 changed files with 31 additions and 3 deletions

View file

@ -1078,6 +1078,7 @@ class FurnaceGUI {
void drawWaveform(unsigned char type, bool opz, const ImVec2& size);
void drawAlgorithm(unsigned char alg, FurnaceGUIFMAlgs algType, const ImVec2& size);
void drawFMEnv(unsigned char tl, unsigned char ar, unsigned char dr, unsigned char d2r, unsigned char rr, unsigned char sl, unsigned char sus, unsigned char egt, unsigned char algOrGlobalSus, float maxTl, float maxArDr, const ImVec2& size, unsigned short instType);
void drawGBEnv(unsigned char vol, unsigned char len, unsigned char sLen, bool dir, const ImVec2& size);
void drawSysConf(int i);
// these ones offer ctrl-wheel fine value changes.

View file

@ -1002,6 +1002,27 @@ void FurnaceGUI::drawFMEnv(unsigned char tl, unsigned char ar, unsigned char dr,
}
}
void FurnaceGUI::drawGBEnv(unsigned char vol, unsigned char len, unsigned char sLen, bool dir, const ImVec2& size) {
//ImDrawList* dl=ImGui::GetWindowDrawList();
ImGuiWindow* window=ImGui::GetCurrentWindow();
ImVec2 minArea=window->DC.CursorPos;
ImVec2 maxArea=ImVec2(
minArea.x+size.x,
minArea.y+size.y
);
ImRect rect=ImRect(minArea,maxArea);
ImGuiStyle& style=ImGui::GetStyle();
//ImU32 color=ImGui::GetColorU32(uiColors[GUI_COLOR_FM_ENVELOPE]);
//ImU32 colorS=ImGui::GetColorU32(uiColors[GUI_COLOR_FM_ENVELOPE_SUS_GUIDE]); // Sustain horiz/vert line color
ImGui::ItemSize(size,style.FramePadding.y);
if (ImGui::ItemAdd(rect,ImGui::GetID("alg"))) {
ImGui::RenderFrame(rect.Min,rect.Max,ImGui::GetColorU32(ImGuiCol_FrameBg),true,style.FrameRounding);
// TODO: this whole thing
}
}
#define P(x) if (x) { \
MARK_MODIFIED; \
e->notifyInsChange(curIns); \
@ -2242,6 +2263,8 @@ void FurnaceGUI::drawInsEdit() {
goesUp=false;
ins->gb.envDir=goesUp;
}
drawGBEnv(ins->gb.envVol,ins->gb.envLen,ins->gb.soundLen,ins->gb.envDir,ImVec2(ImGui::GetContentRegionAvail().x,100.0f*dpiScale));
ImGui::EndTabItem();
}
if (ins->type==DIV_INS_C64) if (ImGui::BeginTabItem("C64")) {

View file

@ -1082,15 +1082,19 @@ void FurnaceGUI::drawSettings() {
UI_COLOR_CONFIG(GUI_COLOR_ORDER_INACTIVE,"Inactive patterns");
ImGui::TreePop();
}
if (ImGui::TreeNode("Envelope View")) {
UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE,"Envelope");
UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE_SUS_GUIDE,"Sustain guide");
UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE_RELEASE,"Release");
ImGui::TreePop();
}
if (ImGui::TreeNode("FM Editor")) {
UI_COLOR_CONFIG(GUI_COLOR_FM_ALG_BG,"Algorithm background");
UI_COLOR_CONFIG(GUI_COLOR_FM_ALG_LINE,"Algorithm lines");
UI_COLOR_CONFIG(GUI_COLOR_FM_MOD,"Modulator");
UI_COLOR_CONFIG(GUI_COLOR_FM_CAR,"Carrier");
UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE,"Envelope");
UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE_SUS_GUIDE,"Sustain guide");
UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE_RELEASE,"Release");
UI_COLOR_CONFIG(GUI_COLOR_FM_SSG,"SSG-EG");
UI_COLOR_CONFIG(GUI_COLOR_FM_WAVE,"Waveform");