Skip to content

Commit

Permalink
Some more VU meter draw tweaking and theme applier for Channel (#1226)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
baconpaul authored Aug 30, 2024
1 parent 87577b6 commit c68ad79
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libs/sst/sst-jucegui
13 changes: 11 additions & 2 deletions src-ui/app/mixer-screen/components/ChannelStrip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down Expand Up @@ -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)
Expand Down
65 changes: 64 additions & 1 deletion src-ui/theme/ThemeApplier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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);
Expand All @@ -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);
}

Expand Down Expand Up @@ -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<jcmp::NamedPanel>(detail::mix::channelstrip::CSPanel);
map.addCustomClass<jcmp::VUMeter>(detail::mix::channelstrip::VUMeter);
map.applyMapTo(toThis);
}

void ThemeApplier::applyAuxChannelStripTheme(juce::Component *toThis)
{
jstl::CustomTypeMap map;
map.addCustomClass<jcmp::NamedPanel>(detail::mix::auxchannelstrip::AuxPanel);
map.addCustomClass<jcmp::VUMeter>(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");
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src-ui/theme/ThemeApplier.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down

0 comments on commit c68ad79

Please sign in to comment.