From c681ac507e1f7a38c968a0e854bc045bedaacdc6 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Wed, 12 Nov 2025 20:33:41 +0400 Subject: [PATCH] chan color on chanosc channels todo: gradient. storing a gradient per channel would be absurd. my idea is when the bg is set to chan color, make the gradient bg transparent, then mix the grad with the color in get() --- src/gui/chanOsc.cpp | 5 ++++- src/gui/gui.cpp | 3 +++ src/gui/gui.h | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/chanOsc.cpp b/src/gui/chanOsc.cpp index 30c854520..429cef6c2 100644 --- a/src/gui/chanOsc.cpp +++ b/src/gui/chanOsc.cpp @@ -360,7 +360,10 @@ void FurnaceGUI::drawChanOsc() { } } else { ImGui::SetNextItemWidth(400.0f*dpiScale); + ImGui::BeginDisabled(chanOscUseChanColor); ImGui::ColorPicker4(_("Color"),(float*)&chanOscColor); + ImGui::EndDisabled(); + ImGui::Checkbox(_("Set to channel color"), &chanOscUseChanColor); } ImGui::AlignTextToFramePadding(); @@ -793,7 +796,7 @@ void FurnaceGUI::drawChanOsc() { } } } - ImU32 color=ImGui::GetColorU32(chanOscColor); + ImU32 color=ImGui::GetColorU32(chanOscUseChanColor?channelColor(oscChans[i]):chanOscColor); if (chanOscUseGrad) { float xVal=computeGradPos(chanOscColorX,ch); float yVal=computeGradPos(chanOscColorY,ch); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 16376718a..db0c78d0e 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -8402,6 +8402,7 @@ void FurnaceGUI::syncState() { chanOscTextColor.z=e->getConfFloat("chanOscTextColorB",1.0f); chanOscTextColor.w=e->getConfFloat("chanOscTextColorA",0.75f); chanOscUseGrad=e->getConfBool("chanOscUseGrad",false); + chanOscUseChanColor=e->getConfBool("chanOscUseChanColor", false); chanOscGrad.fromString(e->getConfString("chanOscGrad","")); chanOscGrad.render(); @@ -8576,6 +8577,7 @@ void FurnaceGUI::commitState(DivConfig& conf) { conf.set("chanOscTextColorA",chanOscTextColor.w); conf.set("chanOscUseGrad",chanOscUseGrad); conf.set("chanOscGrad",chanOscGrad.toString()); + conf.set("chanOscUseChanColor",chanOscUseChanColor); // commit x-y osc state conf.set("xyOscXChannel",xyOscXChannel); @@ -9200,6 +9202,7 @@ FurnaceGUI::FurnaceGUI(): chanOscUseGrad(false), chanOscNormalize(false), chanOscRandomPhase(false), + chanOscUseChanColor(false), chanOscTextFormat("%c"), chanOscColor(1.0f,1.0f,1.0f,1.0f), chanOscTextColor(1.0f,1.0f,1.0f,0.75f), diff --git a/src/gui/gui.h b/src/gui/gui.h index ec2cb5766..78049de8d 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -2698,7 +2698,7 @@ class FurnaceGUI { // per-channel oscilloscope int chanOscCols, chanOscAutoColsType, chanOscColorX, chanOscColorY, chanOscCenterStrat; float chanOscWindowSize, chanOscTextX, chanOscTextY, chanOscAmplify, chanOscLineSize; - bool chanOscWaveCorr, chanOscOptions, updateChanOscGradTex, chanOscUseGrad, chanOscNormalize, chanOscRandomPhase; + bool chanOscWaveCorr, chanOscOptions, updateChanOscGradTex, chanOscUseGrad, chanOscNormalize, chanOscRandomPhase, chanOscUseChanColor; String chanOscTextFormat; ImVec4 chanOscColor, chanOscTextColor; Gradient2D chanOscGrad;