gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 81aea591dbeb04eb55564a02d1d70d8f86b15420
parent 0d1fd4c583cacfbcabccc314ccce1e618b02565a
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Thu, 21 Nov 2024 19:33:47 +0100

add option "antialiasing" for texts to disable any filtering

Diffstat:
Msource/jucePluginEditorLib/patchmanager/listmodel.cpp | 5+++--
Msource/juceUiLib/uiObjectStyle.cpp | 13+++++++++++++
Msource/juceUiLib/uiObjectStyle.h | 6++++++
3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/source/jucePluginEditorLib/patchmanager/listmodel.cpp b/source/jucePluginEditorLib/patchmanager/listmodel.cpp @@ -313,11 +313,11 @@ namespace jucePluginEditorLib::patchManager void ListModel::paintListBoxItem(const int _rowNumber, juce::Graphics& _g, const int _width, const int _height, const bool _rowIsSelected) { - const auto* style = dynamic_cast<const genericUI::UiObjectStyle*>(&getStyle()); - if (_rowNumber >= getNumRows()) return; // Juce what are you up to? + const auto* style = dynamic_cast<const genericUI::UiObjectStyle*>(&getStyle()); + const auto& patch = getPatch(_rowNumber); const auto text = patch->getName(); @@ -333,6 +333,7 @@ namespace jucePluginEditorLib::patchManager if (style) { + _g.setImageResamplingQuality(style->getAntialiasing() ? juce::Graphics::highResamplingQuality : juce::Graphics::lowResamplingQuality); if (const auto f = style->getFont()) _g.setFont(*f); } diff --git a/source/juceUiLib/uiObjectStyle.cpp b/source/juceUiLib/uiObjectStyle.cpp @@ -82,6 +82,7 @@ namespace genericUI m_bold = _object.getPropertyInt("bold") != 0; m_italic = _object.getPropertyInt("italic") != 0; + m_antialiasing = _object.getPropertyInt("antialiasing", 1) != 0; m_url = _object.getProperty("url"); @@ -128,6 +129,18 @@ namespace genericUI return true; } + void UiObjectStyle::drawLabel(juce::Graphics& _graphics, juce::Label& _label) + { + _graphics.setImageResamplingQuality(m_antialiasing ? juce::Graphics::highResamplingQuality : juce::Graphics::lowResamplingQuality); + LookAndFeel_V4::drawLabel(_graphics, _label); + } + + void UiObjectStyle::drawButtonText(juce::Graphics& _graphics, juce::TextButton& _textButton, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) + { + _graphics.setImageResamplingQuality(m_antialiasing ? juce::Graphics::highResamplingQuality : juce::Graphics::lowResamplingQuality); + LookAndFeel_V4::drawButtonText(_graphics, _textButton, shouldDrawButtonAsHighlighted, shouldDrawButtonAsDown); + } + juce::Font UiObjectStyle::getComboBoxFont(juce::ComboBox& _comboBox) { if (const auto f = getFont()) diff --git a/source/juceUiLib/uiObjectStyle.h b/source/juceUiLib/uiObjectStyle.h @@ -26,8 +26,13 @@ namespace genericUI std::optional<juce::Font> getFont() const; + bool getAntialiasing() const { return m_antialiasing; } + static bool parseColor(juce::Colour& _color, const std::string& _colorString); + void drawLabel(juce::Graphics&, juce::Label&) override; + void drawButtonText(juce::Graphics&, juce::TextButton&, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override; + protected: juce::Font getComboBoxFont(juce::ComboBox&) override; juce::Font getLabelFont(juce::Label&) override; @@ -51,6 +56,7 @@ namespace genericUI std::string m_fontName; int m_textHeight = 0; std::string m_text; + bool m_antialiasing = true; juce::Colour m_color = juce::Colour(0xffffffff); juce::Colour m_bgColor = juce::Colour(0);