From c68ad79f55c9a73834f0c686c0d71865db5d0a01 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 30 Aug 2024 08:24:43 -0400 Subject: [PATCH] Some more VU meter draw tweaking and theme applier for Channel (#1226) 1. Start theme applier for channel strip (but see #1225 for why it is off) 2. Improve the drawing of the vu meter in several ways --- libs/sst/sst-jucegui | 2 +- .../mixer-screen/components/ChannelStrip.cpp | 13 +++- src-ui/theme/ThemeApplier.cpp | 65 ++++++++++++++++++- src-ui/theme/ThemeApplier.h | 2 + 4 files changed, 78 insertions(+), 4 deletions(-) diff --git a/libs/sst/sst-jucegui b/libs/sst/sst-jucegui index 18e109b4..cada9ffa 160000 --- a/libs/sst/sst-jucegui +++ b/libs/sst/sst-jucegui @@ -1 +1 @@ -Subproject commit 18e109b41531d3a3bacfbd9cfe31e682fa6cbee5 +Subproject commit cada9ffa51c81ee54a3d17f700312fb6f2912a86 diff --git a/src-ui/app/mixer-screen/components/ChannelStrip.cpp b/src-ui/app/mixer-screen/components/ChannelStrip.cpp index 40e0c49b..7f4d0d57 100644 --- a/src-ui/app/mixer-screen/components/ChannelStrip.cpp +++ b/src-ui/app/mixer-screen/components/ChannelStrip.cpp @@ -188,6 +188,15 @@ ChannelStrip::ChannelStrip(SCXTEditor *e, MixerScreen *m, int bi, BusType t) addAndMakeVisible(*vuMeter); effectsChanged(); + + if (t == BusType::AUX) + { + editor->themeApplier.applyAuxChannelStripTheme(this); + } + else + { + editor->themeApplier.applyChannelStripTheme(this); + } } ChannelStrip::~ChannelStrip() {} @@ -258,8 +267,8 @@ void ChannelStrip::resized() vcaSlider->setBounds(s); auto vs = fx.withHeight(sliderVUHeight) .withTrimmedLeft(fx.getWidth() * 2.5 / 4) - .withWidth(fx.getWidth() / 4) - .reduced(1); + .withWidth(13) + .reduced(1, 0); vuMeter->setBounds(vs); if (type != BusType::MAIN) diff --git a/src-ui/theme/ThemeApplier.cpp b/src-ui/theme/ThemeApplier.cpp index 385d0ab0..eeae25e0 100644 --- a/src-ui/theme/ThemeApplier.cpp +++ b/src-ui/theme/ThemeApplier.cpp @@ -156,6 +156,32 @@ void init() sheet_t::addClass(GlyphButtonAccent).withBaseClass(GlyphButton); } } // namespace header + +namespace mix +{ +namespace channelstrip +{ +static constexpr sheet_t::Class CSPanel{"channelstrip.namedpanel"}; +static constexpr sheet_t::Class VUMeter{"channelstrip.vumeter"}; +void applyColorsAndFonts(const sheet_t::ptr_t &, const ColorMap &, const ThemeApplier &); +void init() +{ + sheet_t::addClass(CSPanel).withBaseClass(jcmp::NamedPanel::Styles::styleClass); + sheet_t::addClass(VUMeter).withBaseClass(jcmp::VUMeter::Styles::styleClass); +} +} // namespace channelstrip +namespace auxchannelstrip +{ +static constexpr sheet_t::Class AuxPanel{"auxchannelstrip.namedpanel"}; +static constexpr sheet_t::Class VUMeter{"auzchannelstrip.vumeter"}; +void applyColorsAndFonts(const sheet_t::ptr_t &, const ColorMap &, const ThemeApplier &); +void init() +{ + sheet_t::addClass(AuxPanel).withBaseClass(jcmp::NamedPanel::Styles::styleClass); + sheet_t::addClass(VUMeter).withBaseClass(jcmp::VUMeter::Styles::styleClass); +} +} // namespace auxchannelstrip +} // namespace mix namespace util { static constexpr sheet_t::Class LabelHighlight("util.label.highlight"); @@ -175,6 +201,8 @@ ThemeApplier::ThemeApplier() detail::edit::group::init(); detail::header::init(); detail::util::init(); + detail::mix::channelstrip::init(); + detail::mix::auxchannelstrip::init(); detailInitialized = true; } colors = ColorMap::createColorMap(ColorMap::WIREFRAME); @@ -187,6 +215,8 @@ void ThemeApplier::recolorStylesheet(const sst::jucegui::style::StyleSheet::ptr_ detail::edit::zone::applyColors(s, *colors); detail::edit::group::applyColors(s, *colors); detail::header::applyColorsAndFonts(s, *colors, *this); + detail::mix::channelstrip::applyColorsAndFonts(s, *colors, *this); + detail::mix::auxchannelstrip::applyColorsAndFonts(s, *colors, *this); detail::util::applyColors(s, *colors); } @@ -269,6 +299,22 @@ void ThemeApplier::applyHeaderSCButtonTheme(sst::jucegui::style::StyleConsumer * s->setCustomClass(detail::header::GlyphButtonAccent); } +void ThemeApplier::applyChannelStripTheme(juce::Component *toThis) +{ + jstl::CustomTypeMap map; + map.addCustomClass(detail::mix::channelstrip::CSPanel); + map.addCustomClass(detail::mix::channelstrip::VUMeter); + map.applyMapTo(toThis); +} + +void ThemeApplier::applyAuxChannelStripTheme(juce::Component *toThis) +{ + jstl::CustomTypeMap map; + map.addCustomClass(detail::mix::auxchannelstrip::AuxPanel); + map.addCustomClass(detail::mix::auxchannelstrip::VUMeter); + map.applyMapTo(toThis); +} + juce::Font ThemeApplier::interBoldFor(int ht) const { static auto interMed = connectors::resources::loadTypeface("fonts/Inter/static/Inter-Bold.ttf"); @@ -363,7 +409,7 @@ void applyColors(const sheet_t::ptr_t &base, const ColorMap &cols) base->setColour(jcmp::VUMeter::Styles::styleClass, jcmp::VUMeter::Styles::vu_gradend, cols.get(ColorMap::accent_1a)); base->setColour(jcmp::VUMeter::Styles::styleClass, jcmp::VUMeter::Styles::vu_overload, - cols.get(ColorMap::warning_1b)); + cols.get(ColorMap::warning_1a)); base->setColour(jcmp::DraggableTextEditableValue::Styles::styleClass, jcmp::DraggableTextEditableValue::Styles::background, @@ -594,6 +640,23 @@ void applyColorsAndFonts(const sheet_t::ptr_t &base, const ColorMap &cols, const } } // namespace header +namespace mix +{ +namespace channelstrip +{ +void applyColorsAndFonts(const sheet_t::ptr_t &base, const ColorMap &cols, const ThemeApplier &t) +{ + base->setColour(VUMeter, jcmp::VUMeter::Styles::vu_gutter, cols.get(ColorMap::bg_1)); +} +} // namespace channelstrip +namespace auxchannelstrip +{ +void applyColorsAndFonts(const sheet_t::ptr_t &base, const ColorMap &cols, const ThemeApplier &t) +{ + base->setColour(VUMeter, jcmp::VUMeter::Styles::vu_gutter, cols.get(ColorMap::bg_1)); +} +} // namespace auxchannelstrip +} // namespace mix namespace util { void applyColors(const sheet_t::ptr_t &base, const ColorMap &cols) diff --git a/src-ui/theme/ThemeApplier.h b/src-ui/theme/ThemeApplier.h index fc389176..803c623a 100644 --- a/src-ui/theme/ThemeApplier.h +++ b/src-ui/theme/ThemeApplier.h @@ -61,6 +61,8 @@ struct ThemeApplier void applyMixerChannelTheme(juce::Component *toThis); void applyHeaderTheme(juce::Component *toThis); void applyHeaderSCButtonTheme(sst::jucegui::style::StyleConsumer *); + void applyChannelStripTheme(juce::Component *toThis); + void applyAuxChannelStripTheme(juce::Component *toThis); // Some utilities to move single items void setLabelToHighlight(sst::jucegui::style::StyleConsumer *);