| 12 | #include "BinaryData.h" |
| 13 | |
| 14 | PluginEditor::PluginEditor(PluginProcessor& p) : |
| 15 | AudioProcessorEditor(&p), |
| 16 | p_ref_(p), |
| 17 | state_(dummy_processor_, nullptr, |
| 18 | juce::Identifier("ZLEqualizerState"), |
| 19 | zlstate::getStateParameterLayout()), |
| 20 | property_(state_), |
| 21 | base_(state_), |
| 22 | main_panel_(p, base_, static_cast<zlpanel::multilingual::TooltipLanguage>(std::round( |
| 23 | zlpanel::getValue(state_, zlstate::PTooltipLang::kID)))) { |
| 24 | // set font |
| 25 | #if defined(JUCE_WINDOWS) |
| 26 | base_.font_ = juce::Typeface::createSystemTypefaceFor( |
| 27 | BinaryData::InterSubsetMediumNoHinting_ttf, BinaryData::InterSubsetMediumNoHinting_ttfSize); |
| 28 | #else |
| 29 | base_.font_ = juce::Typeface::createSystemTypefaceFor( |
| 30 | BinaryData::InterSubsetMedium_ttf, BinaryData::InterSubsetMedium_ttfSize); |
| 31 | #endif |
| 32 | juce::LookAndFeel::getDefaultLookAndFeel().setDefaultSansSerifTypeface(base_.font_); |
| 33 | // add the main panel |
| 34 | addAndMakeVisible(main_panel_); |
| 35 | main_panel_.getControlPanel().addMouseListener(this, true); |
| 36 | main_panel_.getOutputPanel().addMouseListener(this, true); |
| 37 | |
| 38 | // set size & size listener |
| 39 | setResizeLimits(static_cast<int>(zlstate::PWindowW::kMinV - 1), |
| 40 | static_cast<int>(zlstate::PWindowH::kMinV - 1), |
| 41 | static_cast<int>(zlstate::PWindowW::kMaxV + 1), |
| 42 | static_cast<int>(zlstate::PWindowH::kMaxV + 1)); |
| 43 | setResizable(true, p.wrapperType != PluginProcessor::wrapperType_AudioUnitv3); |
| 44 | |
| 45 | this->resizableCorner = std::make_unique<zlgui::ResizeCorner>(base_, this, getConstrainer(), |
| 46 | zlgui::ResizeCorner::kScaleWithFontSize, 1.25f); |
| 47 | addChildComponent(this->resizableCorner.get()); |
| 48 | this->resizableCorner->setAlwaysOnTop(true); |
| 49 | this->resizableCorner->resized(); |
| 50 | |
| 51 | last_ui_width_.referTo(state_.getParameterAsValue(zlstate::PWindowW::kID)); |
| 52 | last_ui_height_.referTo(state_.getParameterAsValue(zlstate::PWindowH::kID)); |
| 53 | setSize(last_ui_width_.getValue(), last_ui_height_.getValue()); |
| 54 | |
| 55 | startTimerHz(1); |
| 56 | updateIsShowing(); |
| 57 | |
| 58 | base_.setPanelProperty(zlgui::kUISettingChanged, true); |
| 59 | base_.getPanelValueTree().addListener(this); |
| 60 | |
| 61 | sendLookAndFeelChange(); |
| 62 | } |
| 63 | |
| 64 | PluginEditor::~PluginEditor() { |
| 65 | base_.getPanelValueTree().removeListener(this); |
nothing calls this directly
no test coverage detected