From a7bc078223afd0270f11ee90b0d8879acbd5ec01 Mon Sep 17 00:00:00 2001 From: Timothy Schoen Date: Sun, 29 Oct 2023 01:49:39 +0200 Subject: [PATCH] Use fill instead of outline for generic text buttons --- Source/Dialogs/AboutPanel.h | 14 ++++++++++++++ Source/Dialogs/Deken.h | 10 +++------- Source/Dialogs/Dialogs.cpp | 21 ++++++++++++++++----- Source/Dialogs/SaveDialog.h | 14 +++++++++----- Source/Heavy/DaisyExporter.h | 2 +- Source/Heavy/ExporterBase.h | 2 +- Source/LookAndFeel.cpp | 1 + 7 files changed, 45 insertions(+), 19 deletions(-) diff --git a/Source/Dialogs/AboutPanel.h b/Source/Dialogs/AboutPanel.h index ee37ca1e8..f42cd1edc 100644 --- a/Source/Dialogs/AboutPanel.h +++ b/Source/Dialogs/AboutPanel.h @@ -31,6 +31,20 @@ class AboutPanel : public Component { credits.setLineSpacing(1.1f); addAndMakeVisible(credits); + auto backgroundColour = findColour(PlugDataColour::dialogBackgroundColourId); + viewOnGithub.setColour(TextButton::buttonColourId, backgroundColour.contrasting(0.05f)); + viewOnGithub.setColour(TextButton::buttonOnColourId, backgroundColour.contrasting(0.1f)); + viewOnGithub.setColour(ComboBox::outlineColourId, Colours::transparentBlack); + + reportIssue.setColour(TextButton::buttonColourId, backgroundColour.contrasting(0.05f)); + reportIssue.setColour(TextButton::buttonOnColourId, backgroundColour.contrasting(0.1f)); + reportIssue.setColour(ComboBox::outlineColourId, Colours::transparentBlack); + + sponsor.setColour(TextButton::buttonColourId, backgroundColour.contrasting(0.05f)); + sponsor.setColour(TextButton::buttonOnColourId, backgroundColour.contrasting(0.1f)); + sponsor.setColour(ComboBox::outlineColourId, Colours::transparentBlack); + + viewOnGithub.setButtonText("View on Github"); reportIssue.setButtonText("Report issue"); sponsor.setButtonText("Become a sponsor"); diff --git a/Source/Dialogs/Deken.h b/Source/Dialogs/Deken.h index a548234b5..6f8aa3ca3 100644 --- a/Source/Dialogs/Deken.h +++ b/Source/Dialogs/Deken.h @@ -815,13 +815,9 @@ class Deken : public Component addChildComponent(uninstallButton); addChildComponent(addToPathButton); - installButton.setColour(TextButton::buttonColourId, findColour(PlugDataColour::panelForegroundColourId)); - uninstallButton.setColour(TextButton::buttonColourId, findColour(PlugDataColour::panelForegroundColourId)); - addToPathButton.setColour(TextButton::buttonColourId, findColour(PlugDataColour::panelForegroundColourId)); - - installButton.setColour(TextButton::buttonOnColourId, findColour(PlugDataColour::panelActiveBackgroundColourId)); - uninstallButton.setColour(TextButton::buttonOnColourId, findColour(PlugDataColour::panelActiveBackgroundColourId)); - addToPathButton.setColour(TextButton::buttonOnColourId, findColour(PlugDataColour::panelActiveBackgroundColourId)); + installButton.setColour(ComboBox::outlineColourId, Colours::transparentBlack); + uninstallButton.setColour(ComboBox::outlineColourId, Colours::transparentBlack); + addToPathButton.setColour(ComboBox::outlineColourId, Colours::transparentBlack); installButton.setTooltip("Install package"); uninstallButton.setTooltip("Uninstall package"); diff --git a/Source/Dialogs/Dialogs.cpp b/Source/Dialogs/Dialogs.cpp index e64ddaa21..ea232f7fe 100644 --- a/Source/Dialogs/Dialogs.cpp +++ b/Source/Dialogs/Dialogs.cpp @@ -150,14 +150,25 @@ void Dialogs::showOkayCancelDialog(std::unique_ptr* target, Component* p OkayCancelDialog(Dialog* dialog, String const& title, std::function const& callback) : label("", title) { - setSize(400, 200); + setSize(375, 200); + + label.setJustificationType(Justification::centred); + label.setFont(Fonts::getBoldFont().withHeight(14.0f)); + addAndMakeVisible(label); addAndMakeVisible(cancel); addAndMakeVisible(okay); - - cancel.setColour(TextButton::buttonColourId, Colours::transparentBlack); - okay.setColour(TextButton::buttonColourId, Colours::transparentBlack); - + + auto backgroundColour = findColour(PlugDataColour::dialogBackgroundColourId); + + cancel.setColour(TextButton::buttonColourId, backgroundColour.contrasting(0.05f)); + cancel.setColour(TextButton::buttonOnColourId, backgroundColour.contrasting(0.1f)); + cancel.setColour(ComboBox::outlineColourId, Colours::transparentBlack); + + okay.setColour(TextButton::buttonColourId, backgroundColour.contrasting(0.05f)); + okay.setColour(TextButton::buttonOnColourId, backgroundColour.contrasting(0.1f)); + okay.setColour(ComboBox::outlineColourId, Colours::transparentBlack); + cancel.onClick = [dialog, callback] { callback(false); dialog->closeDialog(); diff --git a/Source/Dialogs/SaveDialog.h b/Source/Dialogs/SaveDialog.h index ede9ca363..cb7ecae60 100644 --- a/Source/Dialogs/SaveDialog.h +++ b/Source/Dialogs/SaveDialog.h @@ -20,7 +20,10 @@ class SaveDialogButton : public TextButton { auto activeColour = findColour(PlugDataColour::toolbarActiveColourId); if (isMouseOver() || isMouseButtonDown()) { - backgroundColour = backgroundColour.contrasting(0.05f); + backgroundColour = backgroundColour.contrasting(0.1f); + } + else { + backgroundColour = backgroundColour.contrasting(0.06f); } g.setColour(backgroundColour); @@ -31,10 +34,11 @@ class SaveDialogButton : public TextButton { g.drawText(getButtonText(), getLocalBounds().reduced(3), Justification::centred); - auto outlineColour = hasKeyboardFocus(false) ? activeColour : findColour(PlugDataColour::outlineColourId); - - g.setColour(outlineColour); - PlugDataLook::drawSmoothedRectangle(g, PathStrokeType(1.0f), bounds, Corners::defaultCornerRadius); + if(hasKeyboardFocus(false)) + { + g.setColour(activeColour); + PlugDataLook::drawSmoothedRectangle(g, PathStrokeType(1.0f), bounds, Corners::defaultCornerRadius); + } } }; diff --git a/Source/Heavy/DaisyExporter.h b/Source/Heavy/DaisyExporter.h index ad3d03538..2368a9e28 100644 --- a/Source/Heavy/DaisyExporter.h +++ b/Source/Heavy/DaisyExporter.h @@ -37,7 +37,7 @@ class DaisyExporter : public ExporterBase { exportButton.setVisible(false); addAndMakeVisible(flashButton); - flashButton.setColour(TextButton::buttonColourId, findColour(PlugDataColour::panelBackgroundColourId)); + flashButton.setColour(ComboBox::outlineColourId, findColour(PlugDataColour::panelBackgroundColourId)); exportTypeValue.addListener(this); targetBoardValue.addListener(this); diff --git a/Source/Heavy/ExporterBase.h b/Source/Heavy/ExporterBase.h index 20379dfb9..8a9e76bdb 100644 --- a/Source/Heavy/ExporterBase.h +++ b/Source/Heavy/ExporterBase.h @@ -47,7 +47,7 @@ struct ExporterBase : public Component { addAndMakeVisible(exportButton); - exportButton.setColour(TextButton::buttonColourId, findColour(PlugDataColour::panelBackgroundColourId)); + exportButton.setColour(ComboBox::outlineColourId, findColour(PlugDataColour::panelBackgroundColourId)); Array properties; diff --git a/Source/LookAndFeel.cpp b/Source/LookAndFeel.cpp index 15b03cd23..75e96c306 100644 --- a/Source/LookAndFeel.cpp +++ b/Source/LookAndFeel.cpp @@ -281,6 +281,7 @@ void PlugDataLook::drawTextButtonBackground(Graphics& g, Button& button, bool sh auto cornerSize = Corners::defaultCornerRadius; g.setColour(backgroundColour); fillSmoothedRectangle(g, button.getLocalBounds().toFloat(), cornerSize); + jassertfalse; // I think we don't use this anymore? } void PlugDataLook::drawToolbarButtonBackground(Graphics& g, Button& button, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown)