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 284bedf9e4148b435204b0aff616c66a1f1d7cd2
parent 333bb824b0cb8b1b1de63baf73ca51b120e8ed5c
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Thu, 21 Nov 2024 21:52:30 +0100

bold root items of patch manager tree views can now be disabled via skin

Diffstat:
Msource/jucePluginEditorLib/patchmanager/treeitem.cpp | 13++++++++++---
Msource/juceUiLib/treeViewStyle.cpp | 9+++++++++
Msource/juceUiLib/treeViewStyle.h | 7+++++++
3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/source/jucePluginEditorLib/patchmanager/treeitem.cpp b/source/jucePluginEditorLib/patchmanager/treeitem.cpp @@ -198,23 +198,30 @@ namespace jucePluginEditorLib::patchManager _g.setColour(color != pluginLib::patchDB::g_invalidColor ? juce::Colour(color) : style ? style->getColor() : juce::Colour(0xffffffff)); bool haveFont = false; + bool antialias = true; + if(style) { if (auto f = style->getFont()) { - f->setBold(getParentItem() == getTree()->getRootItem()); + if (style->boldRootItems() && getParentItem() == getTree()->getRootItem()) + f = f->boldened(); _g.setFont(*f); haveFont = true; } + antialias = style->getAntialiasing(); } + if(!haveFont) { auto fnt = _g.getCurrentFont(); - fnt.setBold(getParentItem() == getTree()->getRootItem()); + if (getParentItem() == getTree()->getRootItem()) + fnt = fnt.boldened(); _g.setFont(fnt); } - + _g.setImageResamplingQuality(antialias ? juce::Graphics::highResamplingQuality : juce::Graphics::lowResamplingQuality); + const juce::String t = juce::String::fromUTF8(m_text.c_str()); _g.drawText(t, 0, 0, _width, _height, style ? style->getAlign() : juce::Justification(juce::Justification::centredLeft)); TreeViewItem::paintItem(_g, _width, _height); diff --git a/source/juceUiLib/treeViewStyle.cpp b/source/juceUiLib/treeViewStyle.cpp @@ -1,7 +1,16 @@ #include "treeViewStyle.h" +#include "uiObject.h" + namespace genericUI { + void TreeViewStyle::apply(Editor& _editor, const UiObject& _object) + { + UiObjectStyle::apply(_editor, _object); + + m_boldRootItems = _object.getPropertyInt("boldRootItems", 1); + } + void TreeViewStyle::apply(juce::TreeView& _target) const { applyColorIfNotZero(_target, juce::TreeView::backgroundColourId, juce::Colour(m_bgColor)); diff --git a/source/juceUiLib/treeViewStyle.h b/source/juceUiLib/treeViewStyle.h @@ -9,6 +9,13 @@ namespace genericUI public: TreeViewStyle(Editor& _editor) : UiObjectStyle(_editor) {} + void apply(Editor& _editor, const UiObject& _object) override; + void apply(juce::TreeView& _target) const; + + bool boldRootItems() const { return m_boldRootItems; } + + private: + bool m_boldRootItems = true; }; }