Skip to content

Commit ae083a5

Browse files
committed
Improve Gem toggle
1 parent 26ea8bf commit ae083a5

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

Source/Dialogs/PathsSettingsPanel.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -682,28 +682,37 @@ class LibraryLoadPanel final : public Component
682682
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(LibraryLoadPanel)
683683
};
684684

685-
class EnableGemToggle : public PropertiesPanel::BoolComponent
685+
class EnableGemToggle : public Component
686686
{
687687
public:
688-
EnableGemToggle() : PropertiesPanel::BoolComponent("Enable GEM", Value(), {"No", "Yes"})
688+
EnableGemToggle() : boolComponent("Enable GEM", enableGemValue, {"No", "Yes"})
689689
{
690-
toggleStateValue.referTo(SettingsFile::getInstance()->getPropertyAsValue("enable_gem"));
690+
enableGemValue.referTo(SettingsFile::getInstance()->getPropertyAsValue("enable_gem"));
691+
addAndMakeVisible(boolComponent);
691692
}
692693

693694
private:
694695
void paint(Graphics& g) override
695696
{
696-
auto b = getLocalBounds().reduced(2);
697+
Fonts::drawStyledText(g, "GEM", 4, 0, getWidth() - 4, 26, PlugDataColours::panelTextColour, Semibold, 14.5f);
698+
699+
auto b = getLocalBounds().withTrimmedTop(26).reduced(4);
697700
StackShadow::drawShadowForRect(g, b.reduced(3), 8, Corners::largeCornerRadius, 0.4f);
698701

699702
g.setColour(PlugDataColours::panelForegroundColour);
700703
g.fillRoundedRectangle(b.toFloat(), Corners::largeCornerRadius);
701704

702705
g.setColour(PlugDataColours::toolbarOutlineColour);
703706
g.drawRoundedRectangle(b.toFloat(), Corners::largeCornerRadius, 1.0f);
707+
}
704708

705-
PropertiesPanel::BoolComponent::paint(g);
709+
void resized() override
710+
{
711+
boolComponent.setBounds(getLocalBounds().withTrimmedTop(26).reduced(4));
706712
}
713+
714+
Value enableGemValue;
715+
PropertiesPanel::BoolComponent boolComponent;
707716
};
708717

709718
class PathsSettingsPanel final : public SettingsDialogPanel
@@ -737,8 +746,8 @@ class PathsSettingsPanel final : public SettingsDialogPanel
737746
private:
738747
void updateBounds()
739748
{
740-
enableGemToggle.setBounds(getLocalBounds().withTrimmedTop(4).removeFromTop(50).reduced(40, 8));
741-
searchPathsPanel.setBounds(0, 46, getWidth(), 96.0f + (searchPathsPanel.getNumRows() + 1) * 32.0f);
749+
enableGemToggle.setBounds(getLocalBounds().withTrimmedTop(4).removeFromTop(78).reduced(41, 6));
750+
searchPathsPanel.setBounds(0, 74, getWidth(), 96.0f + (searchPathsPanel.getNumRows() + 1) * 32.0f);
742751
libraryLoadPanel.setBounds(libraryLoadPanel.getX(), searchPathsPanel.getBottom() + 4.0f, getWidth(), 52.0f + (libraryLoadPanel.getNumRows() + 1) * 32.0f);
743752

744753
container.setBounds(getLocalBounds().getUnion(searchPathsPanel.getBounds()).getUnion(libraryLoadPanel.getBounds()));

0 commit comments

Comments
 (0)