Merge pull request #824 from redtide/cclabel-theme-color

Added missing backcolor to the ccknobs label in theme
This commit is contained in:
JP Cimalando 2021-04-13 22:13:12 +02:00 committed by GitHub
commit 8331ae4a0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 43 additions and 23 deletions

View file

@ -212,7 +212,7 @@ widget_class mainView {open
}
}
}
Fl_Group {subPanels_[kPanelControls]} {
Fl_Group {subPanels_[kPanelControls]} {open
xywh {5 110 790 285} hide
class LogicalGroup
} {
@ -220,8 +220,8 @@ widget_class mainView {open
xywh {5 110 790 285} box ROUNDED_BOX
class RoundedGroup
} {
Fl_Group controlsPanel_ {open
xywh {5 110 790 285} box THIN_DOWN_FRAME
Fl_Group controlsPanel_ {selected
xywh {5 110 790 285} box THIN_DOWN_FRAME labelsize 12
class ControlsPanel
} {}
}
@ -351,7 +351,7 @@ widget_class mainView {open
class ValueLabel
}
Fl_Spinner oscillatorQualitySlider_ {
comment {tag=kTagSetOscillatorQuality} selected
comment {tag=kTagSetOscillatorQuality}
xywh {630 195 80 25} labelsize 12 textsize 12
class ValueMenu
}

View file

@ -17,6 +17,7 @@
<color name="knobLineIndicator">#000000</color>
<color name="knobText">#000000</color>
<color name="knobLabelText">#ffffff</color>
<color name="knobLabelBackground">#006b0b</color>
</palette>
<palette name="inverted">
<color name="boxBackground">#2e3436</color>
@ -34,5 +35,6 @@
<color name="knobLineIndicator">#ffffff</color>
<color name="knobText">#ffffff</color>
<color name="knobLabelText">#ffffff</color>
<color name="knobLabelBackground">#006b0b</color>
</palette>
</sfizz-theme>

View file

@ -675,18 +675,6 @@ void Editor::Impl::createFrameContents()
hline->setBackgroundColor(CColor(0xff, 0xff, 0xff, 0xff));
return hline;
};
auto createKnob48 = [this, &knob48](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) {
return new CAnimKnob(bounds, this, tag, 31, 48, knob48);
};
auto createStyledKnob = [this, &palette](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) {
SStyledKnob* knob = new SStyledKnob(bounds, this, tag);
OnThemeChanged.push_back([knob, palette]() {
knob->setActiveTrackColor(palette->knobActiveTrack);
knob->setInactiveTrackColor(palette->knobInactiveTrack);
knob->setLineIndicatorColor(palette->knobLineIndicator);
});
return knob;
};
auto createValueLabel = [this, &palette](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
CTextLabel* lbl = new CTextLabel(bounds, label);
lbl->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
@ -869,6 +857,18 @@ void Editor::Impl::createFrameContents()
menu->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
return menu;
};
auto createKnob48 = [this, &knob48](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) {
return new CAnimKnob(bounds, this, tag, 31, 48, knob48);
};
auto createStyledKnob = [this, &palette](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) {
SStyledKnob* knob = new SStyledKnob(bounds, this, tag);
OnThemeChanged.push_back([knob, palette]() {
knob->setActiveTrackColor(palette->knobActiveTrack);
knob->setInactiveTrackColor(palette->knobInactiveTrack);
knob->setLineIndicatorColor(palette->knobLineIndicator);
});
return knob;
};
auto createKnobCCBox = [this, &palette](const CRect& bounds, int tag, const char* label, CHoriTxtAlign, int fontsize) {
SKnobCCBox* box = new SKnobCCBox(bounds, this, tag);
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
@ -880,7 +880,7 @@ void Editor::Impl::createFrameContents()
OnThemeChanged.push_back([box, palette]() {
box->setNameLabelFontColor(palette->knobText);
box->setCCLabelFontColor(palette->knobLabelText);
box->setCCLabelBackColor(palette->knobActiveTrack);
box->setCCLabelBackColor(palette->knobLabelBackground);
box->setKnobFontColor(palette->knobText);
box->setKnobLineIndicatorColor(palette->knobLineIndicator);
box->setKnobActiveTrackColor(palette->knobActiveTrack);
@ -897,15 +897,20 @@ void Editor::Impl::createFrameContents()
container->setBackground(background);
return container;
};
auto createControlsPanel = [this, &palette](const CRect& bounds, int, const char*, CHoriTxtAlign, int) {
auto createControlsPanel = [this, &palette](const CRect& bounds, int, const char*, CHoriTxtAlign, int fontsize) {
auto* panel = new SControlsPanel(bounds);
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
panel->setNameLabelFont(font);
panel->setKnobFont(font);
panel->setCCLabelFont(font);
OnThemeChanged.push_back([panel, palette]() {
panel->setNameLabelFontColor(palette->text);
panel->setCCLabelFontColor(palette->valueText);
panel->setKnobFontColor(palette->text);
panel->setNameLabelFontColor(palette->knobText);
panel->setCCLabelFontColor(palette->knobLabelText);
panel->setCCLabelBackColor(palette->knobLabelBackground);
panel->setKnobFontColor(palette->knobText);
panel->setKnobLineIndicatorColor(palette->knobLineIndicator);
panel->setKnobActiveTrackColor(palette->knobActiveTrack);
panel->setKnobInactiveTrackColor(palette->knobInactiveTrack);
panel->setKnobLineIndicatorColor(palette->knobLineIndicator);
});
return panel;
};

View file

@ -795,6 +795,12 @@ void SControlsPanel::setCCLabelFont(CFontRef font)
syncAllSlotStyles();
}
void SControlsPanel::setCCLabelBackColor(CColor color)
{
slots_[0]->box->setCCLabelBackColor(color);
syncAllSlotStyles();
}
void SControlsPanel::setCCLabelFontColor(CColor color)
{
slots_[0]->box->setCCLabelFontColor(color);
@ -935,6 +941,7 @@ void SControlsPanel::syncSlotStyle(uint32_t index)
cur->setCCLabelFont(ref->getCCLabelFont());
cur->setCCLabelFontColor(ref->getCCLabelFontColor());
cur->setCCLabelBackColor(ref->getCCLabelBackColor());
cur->setKnobActiveTrackColor(ref->getKnobActiveTrackColor());
cur->setKnobInactiveTrackColor(ref->getKnobInactiveTrackColor());

View file

@ -214,13 +214,16 @@ public:
const CColor& getActiveTrackColor() const { return activeTrackColor_; }
void setActiveTrackColor(const CColor& color);
const CColor& getInactiveTrackColor() const { return inactiveTrackColor_; }
void setInactiveTrackColor(const CColor& color);
const CColor& getLineIndicatorColor() const { return lineIndicatorColor_; }
void setLineIndicatorColor(const CColor& color);
void setFont(CFontRef font);
CFontRef getFont() const { return font_; }
void setFontColor(CColor fontColor);
CColor getFontColor() const { return fontColor_; }
@ -312,6 +315,7 @@ public:
void setNameLabelFont(CFontRef font);
void setNameLabelFontColor(CColor color);
void setCCLabelFont(CFontRef font);
void setCCLabelBackColor(CColor color);
void setCCLabelFontColor(CColor color);
void setKnobActiveTrackColor(CColor color);
void setKnobInactiveTrackColor(CColor color);

View file

@ -157,6 +157,7 @@ CColor* Theme::getColorFromName(absl::string_view name, bool fromInvertedPalette
PALETTE_COLOR_CASE(knobLabelText);
PALETTE_COLOR_CASE(knobLineIndicator);
PALETTE_COLOR_CASE(knobText);
PALETTE_COLOR_CASE(knobLabelBackground);
PALETTE_COLOR_CASE(text);
PALETTE_COLOR_CASE(titleBoxBackground);
PALETTE_COLOR_CASE(titleBoxText);

View file

@ -31,6 +31,7 @@ struct Palette {
CColor knobLineIndicator;
CColor knobText;
CColor knobLabelText;
CColor knobLabelBackground;
};
struct Theme {

View file

@ -115,7 +115,7 @@ view__0->addView(view__43);
view__43->setVisible(false);
auto* const view__44 = createRoundedGroup(CRect(0, 0, 790, 285), -1, "", kCenterText, 14);
view__43->addView(view__44);
auto* const view__45 = createControlsPanel(CRect(0, 0, 790, 285), -1, "", kCenterText, 14);
auto* const view__45 = createControlsPanel(CRect(0, 0, 790, 285), -1, "", kCenterText, 12);
controlsPanel_ = view__45;
view__44->addView(view__45);
auto* const view__46 = createLogicalGroup(CRect(5, 109, 795, 425), -1, "", kCenterText, 14);