diff --git a/Source/Components/ScaleComponent.h b/Source/Components/ScaleComponent.h index 8eb3159..98a28ed 100644 --- a/Source/Components/ScaleComponent.h +++ b/Source/Components/ScaleComponent.h @@ -15,6 +15,8 @@ class ObxdAudioProcessor; + + //============================================================================== class ScalableComponent { @@ -39,3 +41,22 @@ private: bool isHighResolutionDisplay; }; + + +//============================================================================== +class CustomLookAndFeel : public LookAndFeel_V3, + public ScalableComponent +{ +public: + CustomLookAndFeel(ObxdAudioProcessor* owner_):LookAndFeel_V3(), ScalableComponent(owner_) { + this->setColour(PopupMenu::backgroundColourId, Colour(20, 20, 20)); + this->setColour(PopupMenu::textColourId, Colour(245, 245, 245)); + this->setColour(PopupMenu::highlightedBackgroundColourId, Colour(60, 60, 60)); + }; + + PopupMenu::Options getOptionsForComboBoxPopupMenu (ComboBox& box, Label& label) override + { + PopupMenu::Options option = LookAndFeel_V3::getOptionsForComboBoxPopupMenu(box, label); + return option.withStandardItemHeight (label.getHeight()/ getScaleFactor()); + }; +}; diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index adf6ed7..a401066 100755 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -122,6 +122,7 @@ void ObxdAudioProcessorEditor::resized() { } else if (dynamic_cast(mappingComps[name])){ mappingComps[name]->setBounds(transformBounds(x, y, w, h)); + //((ButtonList *)mappingComps[name])->getRootMenu()->setLookAndFeel(& getLookAndFeel()); } else if (dynamic_cast(mappingComps[name])){ @@ -477,12 +478,16 @@ void ObxdAudioProcessorEditor::loadSkin (ObxdAudioProcessor& ownerFilter) if (name == "voiceSwitch"){ voiceSwitch = addList (x, y, w, h, ownerFilter, VOICE_COUNT, "VoiceCount", "voices"); + CustomLookAndFeel *lf = new CustomLookAndFeel(&this->processor); + voiceSwitch->setLookAndFeel(lf); mappingComps["voiceSwitch"] = voiceSwitch; } if (name == "legatoSwitch"){ legatoSwitch = addList (x, y, w, h, ownerFilter, LEGATOMODE, "Legato", "legato"); + CustomLookAndFeel *lf = new CustomLookAndFeel(&this->processor); + legatoSwitch->setLookAndFeel(lf); mappingComps["legatoSwitch"] = legatoSwitch; } @@ -587,10 +592,17 @@ void ObxdAudioProcessorEditor::scaleFactorChanged() { object->setScaleFactor(scaleFactor, highResolutionDisplay); } + + // update look and feel + CustomLookAndFeel* laf = + dynamic_cast(&getChildComponent(i)->getLookAndFeel()); + if (laf != nullptr) + { + laf->setScaleFactor(scaleFactor, highResolutionDisplay); + } } - - // update look and feel - + + // redraw everything backgroundImage = getScaledImageFromCache("main", scaleFactor, highResolutionDisplay);