From 8c86fc8343478f66c5ee22ad4cd97196843e7120 Mon Sep 17 00:00:00 2001 From: zsliu98 Date: Thu, 26 Dec 2024 17:14:50 -0500 Subject: [PATCH] feat(control setting panel): add control setting import/export --- source/gui/label/name_look_and_feel.hpp | 5 +- .../compact_linear_slider.cpp | 2 + .../two_value_ratary_slider.cpp | 11 +- .../panel/state_panel/comp_setting_panel.cpp | 1 + .../state_panel/conflict_setting_panel.cpp | 1 + .../panel/state_panel/fft_setting_panel.cpp | 1 + .../state_panel/general_setting_panel.cpp | 1 + .../panel/state_panel/match_setting_panel.cpp | 1 + .../ui_setting_panel/colour_setting_panel.cpp | 20 ++- .../ui_setting_panel/colour_setting_panel.hpp | 17 +++ .../control_setting_panel.cpp | 128 +++++++++++++++++- .../control_setting_panel.hpp | 17 +++ .../other_ui_setting_panel.cpp | 5 +- .../other_ui_setting_panel.hpp | 2 + .../ui_setting_panel/ui_setting_panel.cpp | 10 +- 15 files changed, 199 insertions(+), 23 deletions(-) diff --git a/source/gui/label/name_look_and_feel.hpp b/source/gui/label/name_look_and_feel.hpp index 3bf705e..9bebec8 100644 --- a/source/gui/label/name_look_and_feel.hpp +++ b/source/gui/label/name_look_and_feel.hpp @@ -36,7 +36,7 @@ namespace zlInterface { bound.removeFromBottom(dPadding.load()); bound.removeFromLeft(lPadding.load()); bound.removeFromRight(rPadding.load()); - g.drawText(label.getText(), bound, justification.load()); + g.drawText(label.getText(), bound, label.getJustificationType()); } inline void setEditable(const bool f) { editable.store(f); } @@ -45,8 +45,6 @@ namespace zlInterface { inline void setFontScale(const float x) { fontScale.store(x); } - inline void setJustification(const juce::Justification j) { justification.store(j); } - inline void setPadding(const float l, const float r, const float u, const float d) { lPadding.store(l); rPadding.store(r); @@ -58,7 +56,6 @@ namespace zlInterface { std::atomic editable{true}; std::atomic alpha{1.f}; std::atomic fontScale{FontNormal}; - std::atomic justification{juce::Justification::centred}; std::atomic lPadding{0.f}, rPadding{0.f}, uPadding{0.f}, dPadding{0.f}; UIBase *uiBase; diff --git a/source/gui/slider/compact_linear_slider/compact_linear_slider.cpp b/source/gui/slider/compact_linear_slider/compact_linear_slider.cpp index 02d5a66..fcc34c9 100644 --- a/source/gui/slider/compact_linear_slider/compact_linear_slider.cpp +++ b/source/gui/slider/compact_linear_slider/compact_linear_slider.cpp @@ -28,6 +28,7 @@ namespace zlInterface { addAndMakeVisible(slider); text.setText(getDisplayValue(slider), juce::dontSendNotification); + text.setJustificationType(juce::Justification::centred); textLookAndFeel.setAlpha(0.f); textLookAndFeel.setFontScale(FontHuge); text.setLookAndFeel(&textLookAndFeel); @@ -37,6 +38,7 @@ namespace zlInterface { // setup label label.setText(labelText, juce::dontSendNotification); + label.setJustificationType(juce::Justification::centred); label.setLookAndFeel(&nameLookAndFeel); nameLookAndFeel.setFontScale(FontHuge); label.setInterceptsMouseClicks(false, false); diff --git a/source/gui/slider/two_value_rotary_slider/two_value_ratary_slider.cpp b/source/gui/slider/two_value_rotary_slider/two_value_ratary_slider.cpp index 574cd51..06b7bb4 100644 --- a/source/gui/slider/two_value_rotary_slider/two_value_ratary_slider.cpp +++ b/source/gui/slider/two_value_rotary_slider/two_value_ratary_slider.cpp @@ -34,15 +34,16 @@ namespace zlInterface { addAndMakeVisible(slider2); label.setText(labelText, juce::dontSendNotification); + label.setJustificationType(juce::Justification::centred); label1.setText(getDisplayValue(slider1), juce::dontSendNotification); label2.setText(getDisplayValue(slider2), juce::dontSendNotification); labelLookAndFeel.setFontScale(1.75f); labelLookAndFeel1.setFontScale(FontHuge); - labelLookAndFeel1.setJustification(juce::Justification::centredBottom); + label1.setJustificationType(juce::Justification::centredBottom); labelLookAndFeel1.setAlpha(0.f); labelLookAndFeel2.setFontScale(FontHuge); - labelLookAndFeel2.setJustification(juce::Justification::centredTop); + label2.setJustificationType(juce::Justification::centredTop); labelLookAndFeel2.setAlpha(0.f); label.setLookAndFeel(&labelLookAndFeel); @@ -110,14 +111,14 @@ namespace zlInterface { const auto valueBound2 = labelBound; label1.setBounds(valueBound1.toNearestInt()); label2.setBounds(valueBound2.toNearestInt()); - labelLookAndFeel1.setJustification(juce::Justification::centredBottom); - labelLookAndFeel2.setJustification(juce::Justification::centredTop); + label1.setJustificationType(juce::Justification::centredBottom); + label2.setJustificationType(juce::Justification::centredTop); } else { slider2LAF.setEditable(false); labelBound = labelBound.withSizeKeepingCentre(labelBound.getWidth(), labelBound.getHeight() * .5f); label1.setBounds(labelBound.toNearestInt()); label2.setBounds(0, 0, 0, 0); - labelLookAndFeel1.setJustification(juce::Justification::centred); + label1.setJustificationType(juce::Justification::centred); } } diff --git a/source/panel/state_panel/comp_setting_panel.cpp b/source/panel/state_panel/comp_setting_panel.cpp index f68d7a1..3f97a37 100644 --- a/source/panel/state_panel/comp_setting_panel.cpp +++ b/source/panel/state_panel/comp_setting_panel.cpp @@ -94,6 +94,7 @@ namespace zlPanel { name.setLookAndFeel(&nameLAF); name.setEditable(false); name.setInterceptsMouseClicks(false, false); + name.setJustificationType(juce::Justification::centred); addAndMakeVisible(name); } diff --git a/source/panel/state_panel/conflict_setting_panel.cpp b/source/panel/state_panel/conflict_setting_panel.cpp index 9f17efc..7a82838 100644 --- a/source/panel/state_panel/conflict_setting_panel.cpp +++ b/source/panel/state_panel/conflict_setting_panel.cpp @@ -86,6 +86,7 @@ namespace zlPanel { name.setLookAndFeel(&nameLAF); name.setEditable(false); name.setInterceptsMouseClicks(false, false); + name.setJustificationType(juce::Justification::centred); addAndMakeVisible(name); } diff --git a/source/panel/state_panel/fft_setting_panel.cpp b/source/panel/state_panel/fft_setting_panel.cpp index 3233adb..60688a6 100644 --- a/source/panel/state_panel/fft_setting_panel.cpp +++ b/source/panel/state_panel/fft_setting_panel.cpp @@ -91,6 +91,7 @@ namespace zlPanel { name.setLookAndFeel(&nameLAF); name.setEditable(false); name.setInterceptsMouseClicks(false, false); + name.setJustificationType(juce::Justification::centred); addAndMakeVisible(name); } diff --git a/source/panel/state_panel/general_setting_panel.cpp b/source/panel/state_panel/general_setting_panel.cpp index 563b767..e905580 100644 --- a/source/panel/state_panel/general_setting_panel.cpp +++ b/source/panel/state_panel/general_setting_panel.cpp @@ -82,6 +82,7 @@ namespace zlPanel { name.setLookAndFeel(&nameLAF); name.setEditable(false); name.setInterceptsMouseClicks(false, false); + name.setJustificationType(juce::Justification::centred); addAndMakeVisible(name); } diff --git a/source/panel/state_panel/match_setting_panel.cpp b/source/panel/state_panel/match_setting_panel.cpp index 74774ce..6b7dd55 100644 --- a/source/panel/state_panel/match_setting_panel.cpp +++ b/source/panel/state_panel/match_setting_panel.cpp @@ -18,6 +18,7 @@ namespace zlPanel { name.setLookAndFeel(&nameLAF); name.setEditable(false); name.setInterceptsMouseClicks(false, false); + name.setJustificationType(juce::Justification::centred); addAndMakeVisible(name); uiBase.setProperty(zlInterface::settingIdx::matchPanelShow, false); diff --git a/source/panel/ui_setting_panel/colour_setting_panel.cpp b/source/panel/ui_setting_panel/colour_setting_panel.cpp index b62d8a0..1c0b35e 100644 --- a/source/panel/ui_setting_panel/colour_setting_panel.cpp +++ b/source/panel/ui_setting_panel/colour_setting_panel.cpp @@ -36,27 +36,31 @@ namespace zlPanel { if (!settingDirectory.isDirectory()) { settingDirectory.createDirectory(); } - nameLAF.setJustification(juce::Justification::centredRight); nameLAF.setFontScale(zlInterface::FontHuge); for (size_t i = 0; i < numSelectors; ++i) { selectorLabels[i].setText(selectorNames[i], juce::dontSendNotification); + selectorLabels[i].setJustificationType(juce::Justification::centredRight); selectorLabels[i].setLookAndFeel(&nameLAF); addAndMakeVisible(selectorLabels[i]); addAndMakeVisible(selectors[i]); } cMap1Label.setText("Colour Map 1", juce::dontSendNotification); + cMap1Label.setJustificationType(juce::Justification::centredRight); cMap1Label.setLookAndFeel(&nameLAF); addAndMakeVisible(cMap1Label); addAndMakeVisible(cMap1Selector); cMap2Label.setText("Colour Map 2", juce::dontSendNotification); + cMap2Label.setJustificationType(juce::Justification::centredRight); cMap2Label.setLookAndFeel(&nameLAF); addAndMakeVisible(cMap2Label); addAndMakeVisible(cMap2Selector); - importLabel.setText("Import", juce::dontSendNotification); + importLabel.setText("Import Colours", juce::dontSendNotification); + importLabel.setJustificationType(juce::Justification::centred); importLabel.setLookAndFeel(&nameLAF); importLabel.addMouseListener(this, false); addAndMakeVisible(importLabel); - exportLabel.setText("Export", juce::dontSendNotification); + exportLabel.setText("Export Colours", juce::dontSendNotification); + exportLabel.setJustificationType(juce::Justification::centred); exportLabel.setLookAndFeel(&nameLAF); exportLabel.addMouseListener(this, false); addAndMakeVisible(exportLabel); @@ -70,7 +74,7 @@ namespace zlPanel { void ColourSettingPanel::loadSetting() { for (size_t i = 0; i < numSelectors; ++i) { - selectors[i]->setColour(uiBase.getColourByIdx(static_cast(i))); + selectors[i]->setColour(uiBase.getColourByIdx(colourIdx[i])); } cMap1Selector.getBox().setSelectedId(static_cast(uiBase.getCMap1Idx()) + 1); cMap2Selector.getBox().setSelectedId(static_cast(uiBase.getCMap2Idx()) + 1); @@ -78,7 +82,7 @@ namespace zlPanel { void ColourSettingPanel::saveSetting() { for (size_t i = 0; i < numSelectors; ++i) { - uiBase.setColourByIdx(static_cast(i), selectors[i]->getColour()); + uiBase.setColourByIdx(colourIdx[i], selectors[i]->getColour()); } uiBase.setCMap1Idx(static_cast(cMap1Selector.getBox().getSelectedId() - 1)); uiBase.setCMap2Idx(static_cast(cMap2Selector.getBox().getSelectedId() - 1)); @@ -124,7 +128,7 @@ namespace zlPanel { auto localBound = bound.removeFromTop(uiBase.getFontSize() * 3); importLabel.setBounds(localBound.removeFromLeft(bound.getWidth() * .45f).toNearestInt()); localBound.removeFromLeft(bound.getWidth() * .10f); - exportLabel.setBounds(localBound.removeFromLeft(uiBase.getFontSize() * 5.f).toNearestInt()); + exportLabel.setBounds(localBound.toNearestInt()); } } @@ -146,9 +150,11 @@ namespace zlPanel { xmlColour->getIntAttribute("g"), xmlColour->getIntAttribute("b"), static_cast(xmlColour->getDoubleAttribute("o"))); - selectors[i]->setColour(colour); + uiBase.setColourByIdx(colourIdx[i], colour); } } + uiBase.saveToAPVTS(); + loadSetting(); } }); } else if (event.originalComponent == &exportLabel) { diff --git a/source/panel/ui_setting_panel/colour_setting_panel.hpp b/source/panel/ui_setting_panel/colour_setting_panel.hpp index d4fe7a0..ad5fc70 100644 --- a/source/panel/ui_setting_panel/colour_setting_panel.hpp +++ b/source/panel/ui_setting_panel/colour_setting_panel.hpp @@ -16,6 +16,8 @@ namespace zlPanel { class ColourSettingPanel final : public juce::Component { public: + static constexpr float heightP = 52.f; + explicit ColourSettingPanel(PluginProcessor &p, zlInterface::UIBase &base); ~ColourSettingPanel() override; @@ -63,6 +65,20 @@ namespace zlPanel { "Tag Colour", "Gain Colour", }; + + std::array colourIdx { + zlInterface::colourIdx::textColour, + zlInterface::colourIdx::backgroundColour, + zlInterface::colourIdx::shadowColour, + zlInterface::colourIdx::glowColour, + zlInterface::colourIdx::preColour, + zlInterface::colourIdx::postColour, + zlInterface::colourIdx::sideColour, + zlInterface::colourIdx::gridColour, + zlInterface::colourIdx::tagColour, + zlInterface::colourIdx::gainColour + }; + std::array tagNames{ "text_colour", "background_colour", @@ -73,6 +89,7 @@ namespace zlPanel { "side_colour", "grid_colour", }; + juce::Label cMap1Label, cMap2Label; zlInterface::ColourMapSelector cMap1Selector, cMap2Selector; juce::Label importLabel, exportLabel; diff --git a/source/panel/ui_setting_panel/control_setting_panel.cpp b/source/panel/ui_setting_panel/control_setting_panel.cpp index f6ec618..a81839a 100644 --- a/source/panel/ui_setting_panel/control_setting_panel.cpp +++ b/source/panel/ui_setting_panel/control_setting_panel.cpp @@ -26,13 +26,14 @@ namespace zlPanel { rotaryDragSensitivitySlider("Distance", base), sliderDoubleClickBox("", zlState::sliderDoubleClickFunc::choices, base) { juce::ignoreUnused(pRef); - nameLAF.setJustification(juce::Justification::centredRight); nameLAF.setFontScale(zlInterface::FontHuge); wheelLabel.setText("Mouse-Wheel Sensitivity", juce::dontSendNotification); + wheelLabel.setJustificationType(juce::Justification::centredRight); wheelLabel.setLookAndFeel(&nameLAF); addAndMakeVisible(wheelLabel); dragLabel.setText("Mouse-Drag Sensitivity", juce::dontSendNotification); + dragLabel.setJustificationType(juce::Justification::centredRight); dragLabel.setLookAndFeel(&nameLAF); addAndMakeVisible(dragLabel); for (auto &s: sensitivitySliders) { @@ -45,6 +46,7 @@ namespace zlPanel { sensitivitySliders[2].getSlider().setDoubleClickReturnValue(true, 1.0); sensitivitySliders[3].getSlider().setDoubleClickReturnValue(true, 0.25); rotaryStyleLabel.setText("Rotary Slider Style", juce::dontSendNotification); + rotaryStyleLabel.setJustificationType(juce::Justification::centredRight); rotaryStyleLabel.setLookAndFeel(&nameLAF); addAndMakeVisible(rotaryStyleLabel); addAndMakeVisible(rotaryStyleBox); @@ -52,9 +54,21 @@ namespace zlPanel { rotaryDragSensitivitySlider.getSlider().setDoubleClickReturnValue(true, 10.0); addAndMakeVisible(rotaryDragSensitivitySlider); sliderDoubleClickLabel.setText("Slider Double Click", juce::dontSendNotification); + sliderDoubleClickLabel.setJustificationType(juce::Justification::centredRight); sliderDoubleClickLabel.setLookAndFeel(&nameLAF); addAndMakeVisible(sliderDoubleClickLabel); addAndMakeVisible(sliderDoubleClickBox); + + importLabel.setText("Import Controls", juce::dontSendNotification); + importLabel.setJustificationType(juce::Justification::centred); + importLabel.setLookAndFeel(&nameLAF); + importLabel.addMouseListener(this, false); + addAndMakeVisible(importLabel); + exportLabel.setText("Export Controls", juce::dontSendNotification); + exportLabel.setJustificationType(juce::Justification::centred); + exportLabel.setLookAndFeel(&nameLAF); + exportLabel.addMouseListener(this, false); + addAndMakeVisible(exportLabel); } ControlSettingPanel::~ControlSettingPanel() = default; @@ -123,6 +137,118 @@ namespace zlPanel { localBound.removeFromLeft(bound.getWidth() * .05f); const auto sWidth = (bound.getWidth() * .5f - uiBase.getFontSize() * 2.f) * 0.425f; sliderDoubleClickBox.setBounds(localBound.removeFromLeft(sWidth).toNearestInt()); + } { + bound.removeFromTop(uiBase.getFontSize()); + auto localBound = bound.removeFromTop(uiBase.getFontSize() * 3); + importLabel.setBounds(localBound.removeFromLeft(bound.getWidth() * .45f).toNearestInt()); + localBound.removeFromLeft(bound.getWidth() * .10f); + exportLabel.setBounds(localBound.toNearestInt()); } } + + void ControlSettingPanel::mouseDown(const juce::MouseEvent &event) { + if (event.originalComponent == &importLabel) { + importControls(); + } else if (event.originalComponent == &exportLabel) { + exportControls(); + } + } + + void ControlSettingPanel::importControls() { + myChooser = std::make_unique( + "Load the control settings...", settingDirectory, "*.xml", + true, false, nullptr); + constexpr auto settingOpenFlags = juce::FileBrowserComponent::openMode | + juce::FileBrowserComponent::canSelectFiles; + myChooser->launchAsync(settingOpenFlags, [this](const juce::FileChooser &chooser) { + if (chooser.getResults().size() <= 0) { return; } + const juce::File settingFile(chooser.getResult()); + if (const auto xmlInput = juce::XmlDocument::parse(settingFile)) { + if (const auto *xmlElement = xmlInput->getChildByName("drag_fine_sensitivity")) { + const auto x = xmlElement->getDoubleAttribute("value"); + uiBase.setSensitivity(static_cast(x), zlInterface::sensitivityIdx::mouseDragFine); + } + if (const auto *xmlElement = xmlInput->getChildByName("drag_sensitivity")) { + const auto x = xmlElement->getDoubleAttribute("value"); + uiBase.setSensitivity(static_cast(x), zlInterface::sensitivityIdx::mouseDrag); + } + if (const auto *xmlElement = xmlInput->getChildByName("wheel_fine_sensitivity")) { + const auto x = xmlElement->getDoubleAttribute("value"); + uiBase.setSensitivity(static_cast(x), zlInterface::sensitivityIdx::mouseWheelFine); + } + if (const auto *xmlElement = xmlInput->getChildByName("wheel_sensitivity")) { + const auto x = xmlElement->getDoubleAttribute("value"); + uiBase.setSensitivity(static_cast(x), zlInterface::sensitivityIdx::mouseWheel); + } + if (const auto *xmlElement = xmlInput->getChildByName("rotary_drag_sensitivity")) { + const auto x = xmlElement->getDoubleAttribute("value"); + uiBase.setRotaryDragSensitivity(static_cast(x)); + } + if (const auto *xmlElement = xmlInput->getChildByName("rotary_style")) { + const auto x = xmlElement->getDoubleAttribute("value"); + uiBase.setRotaryStyleID(static_cast(x)); + } + if (const auto *xmlElement = xmlInput->getChildByName("slider_double_click_func")) { + const auto x = xmlElement->getDoubleAttribute("value"); + uiBase.setIsSliderDoubleClickOpenEditor(x > 0.5); + } + if (const auto *xmlElement = xmlInput->getChildByName("wheel_shift_reverse")) { + const auto x = xmlElement->getDoubleAttribute("value"); + uiBase.setIsMouseWheelShiftReverse(x > 0.5); + } + uiBase.saveToAPVTS(); + loadSetting(); + } + }); + } + + void ControlSettingPanel::exportControls() { + myChooser = std::make_unique( + "Save the control settings...", settingDirectory.getChildFile("control.xml"), "*.xml", + true, false, nullptr); + constexpr auto settingSaveFlags = juce::FileBrowserComponent::saveMode | + juce::FileBrowserComponent::warnAboutOverwriting; + myChooser->launchAsync(settingSaveFlags, [this](const juce::FileChooser &chooser) { + if (chooser.getResults().size() <= 0) { return; } + juce::File settingFile(chooser.getResult().withFileExtension("xml")); + if (settingFile.create()) { + saveSetting(); + juce::XmlElement xmlOutput{"colour_setting"}; + { + auto *xmlElement = xmlOutput.createNewChildElement("drag_fine_sensitivity"); + xmlElement->setAttribute("value", uiBase.getSensitivity(zlInterface::mouseDragFine)); + } + { + auto *xmlElement = xmlOutput.createNewChildElement("drag_sensitivity"); + xmlElement->setAttribute("value", uiBase.getSensitivity(zlInterface::mouseDrag)); + } + { + auto *xmlElement = xmlOutput.createNewChildElement("wheel_fine_sensitivity"); + xmlElement->setAttribute("value", uiBase.getSensitivity(zlInterface::mouseWheelFine)); + } + { + auto *xmlElement = xmlOutput.createNewChildElement("wheel_sensitivity"); + xmlElement->setAttribute("value", uiBase.getSensitivity(zlInterface::mouseWheel)); + } + { + auto *xmlElement = xmlOutput.createNewChildElement("rotary_drag_sensitivity"); + xmlElement->setAttribute("value", uiBase.getRotaryDragSensitivity()); + } + { + auto *xmlElement = xmlOutput.createNewChildElement("rotary_style"); + xmlElement->setAttribute("value", static_cast(uiBase.getRotaryStyleID())); + } + { + auto *xmlElement = xmlOutput.createNewChildElement("slider_double_click_func"); + xmlElement->setAttribute("value", static_cast(uiBase.getIsSliderDoubleClickOpenEditor())); + } + { + auto *xmlElement = xmlOutput.createNewChildElement("wheel_shift_reverse"); + xmlElement->setAttribute("value", static_cast(uiBase.getIsMouseWheelShiftReverse())); + } + const auto result = xmlOutput.writeTo(settingFile); + juce::ignoreUnused(result); + } + }); + } } // zlPanel diff --git a/source/panel/ui_setting_panel/control_setting_panel.hpp b/source/panel/ui_setting_panel/control_setting_panel.hpp index 1a916e2..c1bab65 100644 --- a/source/panel/ui_setting_panel/control_setting_panel.hpp +++ b/source/panel/ui_setting_panel/control_setting_panel.hpp @@ -17,6 +17,8 @@ namespace zlPanel { class ControlSettingPanel final : public juce::Component { public: + static constexpr float heightP = 20.f; + explicit ControlSettingPanel(PluginProcessor &p, zlInterface::UIBase &base); ~ControlSettingPanel() override; @@ -29,6 +31,8 @@ class ControlSettingPanel final : public juce::Component { void resized() override; + void mouseDown(const juce::MouseEvent &event) override; + private: PluginProcessor &pRef; zlInterface::UIBase &uiBase; @@ -43,6 +47,19 @@ class ControlSettingPanel final : public juce::Component { zlInterface::CompactLinearSlider rotaryDragSensitivitySlider; juce::Label sliderDoubleClickLabel; zlInterface::CompactCombobox sliderDoubleClickBox; + + juce::Label importLabel, exportLabel; + std::unique_ptr myChooser; + inline auto static const settingDirectory = + juce::File::getSpecialLocation(juce::File::userApplicationDataDirectory) + .getChildFile("Audio") + .getChildFile("Presets") + .getChildFile(JucePlugin_Manufacturer) + .getChildFile("Shared Settings"); + + void importControls(); + + void exportControls(); }; } // zlPanel diff --git a/source/panel/ui_setting_panel/other_ui_setting_panel.cpp b/source/panel/ui_setting_panel/other_ui_setting_panel.cpp index a46d006..3affdfe 100644 --- a/source/panel/ui_setting_panel/other_ui_setting_panel.cpp +++ b/source/panel/ui_setting_panel/other_ui_setting_panel.cpp @@ -21,13 +21,14 @@ namespace zlPanel { sumCurveSlider("Sum", base), defaultPassFilterSlopeBox("", zlState::defaultPassFilterSlope::choices, base) { juce::ignoreUnused(pRef); - nameLAF.setJustification(juce::Justification::centredRight); nameLAF.setFontScale(zlInterface::FontHuge); refreshRateLabel.setText("Refresh Rate", juce::dontSendNotification); + refreshRateLabel.setJustificationType(juce::Justification::centredRight); refreshRateLabel.setLookAndFeel(&nameLAF); addAndMakeVisible(refreshRateLabel); addAndMakeVisible(refreshRateBox); fftLabel.setText("FFT", juce::dontSendNotification); + fftLabel.setJustificationType(juce::Justification::centredRight); fftLabel.setLookAndFeel(&nameLAF); addAndMakeVisible(fftLabel); fftTiltSlider.getSlider().setNormalisableRange(zlState::fftExtraTilt::doubleRange); @@ -39,6 +40,7 @@ namespace zlPanel { addAndMakeVisible(fftSpeedSlider); addAndMakeVisible(fftOrderBox); curveThickLabel.setText("Curve Thickness", juce::dontSendNotification); + curveThickLabel.setJustificationType(juce::Justification::centredRight); curveThickLabel.setLookAndFeel(&nameLAF); addAndMakeVisible(curveThickLabel); singleCurveSlider.getSlider().setNormalisableRange(zlState::singleCurveThickness::doubleRange); @@ -48,6 +50,7 @@ namespace zlPanel { addAndMakeVisible(singleCurveSlider); addAndMakeVisible(sumCurveSlider); defaultPassFilterSlopeLabel.setText("Default Pass Filter Slope", juce::dontSendNotification); + defaultPassFilterSlopeLabel.setJustificationType(juce::Justification::centredRight); defaultPassFilterSlopeLabel.setLookAndFeel(&nameLAF); addAndMakeVisible(defaultPassFilterSlopeLabel); addAndMakeVisible(defaultPassFilterSlopeBox); diff --git a/source/panel/ui_setting_panel/other_ui_setting_panel.hpp b/source/panel/ui_setting_panel/other_ui_setting_panel.hpp index d07841d..b6ef3ed 100644 --- a/source/panel/ui_setting_panel/other_ui_setting_panel.hpp +++ b/source/panel/ui_setting_panel/other_ui_setting_panel.hpp @@ -17,6 +17,8 @@ namespace zlPanel { class OtherUISettingPanel final : public juce::Component { public: + static constexpr float heightP = 16.f; + explicit OtherUISettingPanel(PluginProcessor &p, zlInterface::UIBase &base); ~OtherUISettingPanel() override; diff --git a/source/panel/ui_setting_panel/ui_setting_panel.cpp b/source/panel/ui_setting_panel/ui_setting_panel.cpp index cb5b6f4..bebba2c 100644 --- a/source/panel/ui_setting_panel/ui_setting_panel.cpp +++ b/source/panel/ui_setting_panel/ui_setting_panel.cpp @@ -71,23 +71,23 @@ namespace zlPanel { }; panelNameLAF.setFontScale(1.5f); - panelNameLAF.setJustification(juce::Justification::centred); panelLabels[0].setText("Colour", juce::dontSendNotification); panelLabels[1].setText("Control", juce::dontSendNotification); panelLabels[2].setText("Other", juce::dontSendNotification); for (auto &pL: panelLabels) { pL.setInterceptsMouseClicks(true, false); pL.addMouseListener(this, false); + pL.setJustificationType(juce::Justification::centred); pL.setLookAndFeel(&panelNameLAF); addAndMakeVisible(pL); } labelLAF.setFontScale(1.125f); labelLAF.setAlpha(.5f); - labelLAF.setJustification(juce::Justification::bottomLeft); versionLabel.setText( juce::String(ZLEQUALIZER_CURRENT_VERSION) + " " + juce::String(ZLEQUALIZER_CURRENT_HASH), juce::dontSendNotification); + versionLabel.setJustificationType(juce::Justification::bottomLeft); versionLabel.setLookAndFeel(&labelLAF); addAndMakeVisible(versionLabel); } @@ -119,13 +119,13 @@ namespace zlPanel { colourPanel.setBounds(0, 0, juce::roundToInt(bound.getWidth()), - juce::roundToInt(uiBase.getFontSize() * (52.f + 1.f))); + juce::roundToInt(uiBase.getFontSize() * (ColourSettingPanel::heightP + 1.f))); controlPanel.setBounds(0, 0, juce::roundToInt(bound.getWidth()), - juce::roundToInt(uiBase.getFontSize() * (16.f + 1.f))); + juce::roundToInt(uiBase.getFontSize() * (ControlSettingPanel::heightP + 1.f))); otherPanel.setBounds(0, 0, juce::roundToInt(bound.getWidth()), - juce::roundToInt(uiBase.getFontSize() * (16.f + 1.f))); + juce::roundToInt(uiBase.getFontSize() * (OtherUISettingPanel::heightP + 1.f))); viewPort.setBounds(bound.removeFromTop(bound.getHeight() * .9125f).toNearestInt()); const auto leftBound = bound.removeFromLeft(