Skip to content

Commit

Permalink
List custom defs after common and in lighter font
Browse files Browse the repository at this point in the history
  • Loading branch information
firthm01 committed Jan 3, 2024
1 parent a09c793 commit 3810fc9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,16 @@ class ValueBoxMain : public Component {
pfDatas.begin(), pfDatas.end(),
[](const std::shared_ptr<AdmPresetDefinitionsHelper::PackFormatData>& a,
const std::shared_ptr<AdmPresetDefinitionsHelper::PackFormatData>& b) {
if (a->isCommonDefinition() != b->isCommonDefinition()) {
return a->isCommonDefinition() > b->isCommonDefinition();
}
return a->relatedChannelFormats.size() <
b->relatedChannelFormats.size();
});

for (auto const& pfData : pfDatas) {
speakerSetupsComboBox_->addTextEntry(pfData->niceName, pfData->idValue);
auto entry = speakerSetupsComboBox_->addTextEntry(pfData->niceName, pfData->idValue);
entry->setLightFont(!pfData->isCommonDefinition());
}
addAndMakeVisible(speakerSetupsComboBox_.get());

Expand Down
13 changes: 12 additions & 1 deletion shared/components/ear_combo_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ EarComboBoxTextEntry::EarComboBoxTextEntry(const String& text, int id)
void EarComboBoxTextEntry::setText(const String& text) { text_ = text; }
String EarComboBoxTextEntry::getText() const { return text_; }

void EarComboBoxTextEntry::setLightFont(bool isLight)
{
lightFont = isLight;
repaint();
}

void EarComboBoxTextEntry::drawEntryInList(Graphics& g,
juce::Rectangle<int> area) {
if (isSelectable_) {
Expand All @@ -69,7 +75,12 @@ void EarComboBoxTextEntry::drawEntryInList(Graphics& g,
else {
g.setColour(findColour(textColourId).withBrightness(0.5));
}
g.setFont(EarFontsSingleton::instance().Items);
if (lightFont) {
g.setFont(EarFontsSingleton::instance().ItemsLight);
}
else {
g.setFont(EarFontsSingleton::instance().Items);
}
g.drawText(text_, area.withTrimmedLeft(14).withTrimmedRight(14),
Justification::left);
}
Expand Down
2 changes: 2 additions & 0 deletions shared/components/ear_combo_box.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class EarComboBoxTextEntry : public EarComboBoxEntry {

void setText(const String& text);
String getText() const;
void setLightFont(bool isLight);

virtual void drawEntryInList(Graphics& g, juce::Rectangle<int> area) override;
virtual void drawEntryInButton(Graphics& g,
Expand All @@ -67,6 +68,7 @@ class EarComboBoxTextEntry : public EarComboBoxEntry {

private:
String text_;
bool lightFont{ false };
};

class EarComboBoxColourEntry : public EarComboBoxEntry {
Expand Down
2 changes: 2 additions & 0 deletions shared/components/look_and_feel/fonts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct EarFonts {
Heading(font::RobotoSingleton::instance().getMedium(16.f)),
Label(font::RobotoSingleton::instance().getRegular(14.f)),
Items(font::RobotoSingleton::instance().getMedium(14.f)),
ItemsLight(font::RobotoSingleton::instance().getLight(14.f)),
Values(font::RobotoSingleton::instance().getMedium(12.f)),
Description(font::RobotoSingleton::instance().getLight(12.f)),
Units(font::RobotoSingleton::instance().getMedium(10.f)),
Expand All @@ -25,6 +26,7 @@ struct EarFonts {
const Font Heading;
const Font Label;
const Font Items;
const Font ItemsLight;
const Font Values;
const Font Description;
const Font Units;
Expand Down

0 comments on commit 3810fc9

Please sign in to comment.