From 386236abcfc1546f247355581c9f414ae2126a48 Mon Sep 17 00:00:00 2001 From: Vincenzo Sicurella Date: Mon, 3 Jun 2024 22:33:59 -0400 Subject: [PATCH] move rounded corner size calc to a EditorState method --- Source/LumatoneEditorLookAndFeel.h | 8 +++++++- Source/LumatoneEditorState.cpp | 5 +++++ Source/LumatoneEditorState.h | 1 + Source/LumatoneEditorStyleCommon.h | 4 +--- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Source/LumatoneEditorLookAndFeel.h b/Source/LumatoneEditorLookAndFeel.h index 7ad842b..50115ef 100644 --- a/Source/LumatoneEditorLookAndFeel.h +++ b/Source/LumatoneEditorLookAndFeel.h @@ -59,6 +59,11 @@ class LumatoneEditorLookAndFeel : public LookAndFeel_V4 return getAppFont(LumatoneEditorFont::GothamNarrowMedium, height); } + float getRoundedRectCornerToAppHeightRatio() const + { + return 0.00555556f; + } + public: //================================================================== // LookAndFeel_V4 Implementation @@ -1292,7 +1297,8 @@ class LumatoneEditorLookAndFeel : public LookAndFeel_V4 setColour(LumatoneEditorColourIDs::HeaderBackground, Colour(0xff1a1b1c)); setColour(LumatoneEditorColourIDs::MediumBackground, Colour(0xff212529)); setColour(LumatoneEditorColourIDs::LightBackground, Colour(0xff272b2e)); - setColour(LumatoneEditorColourIDs::ControlAreaBackground, Colour(0xff212626)); + setColour(LumatoneEditorColourIDs::ControlAreaHeader, Colour(0xff272b2e)); + setColour(LumatoneEditorColourIDs::ControlAreaBackground, Colour(0xff2d3135)); setColour(LumatoneEditorColourIDs::ActiveText, Colours::white); setColour(LumatoneEditorColourIDs::InactiveText, Colour(0xffb1b1b1)); setColour(LumatoneEditorColourIDs::DescriptionText, Colour(0xffcbcbcb)); diff --git a/Source/LumatoneEditorState.cpp b/Source/LumatoneEditorState.cpp index 9471f89..e412d0c 100644 --- a/Source/LumatoneEditorState.cpp +++ b/Source/LumatoneEditorState.cpp @@ -78,6 +78,11 @@ LumatoneEditorState::~LumatoneEditorState() appFonts = nullptr; } +float LumatoneEditorState::getRoundedRectCornerSize() const +{ + return windowBounds.getHeight() * lookAndFeel->getRoundedRectCornerToAppHeightRatio(); +} + juce::String LumatoneEditorState::getProperty(juce::Identifier propertyId, juce::String fallbackValue) const { return propertiesFile->getValue(propertyId, fallbackValue); diff --git a/Source/LumatoneEditorState.h b/Source/LumatoneEditorState.h index 85c4e07..ca7b742 100644 --- a/Source/LumatoneEditorState.h +++ b/Source/LumatoneEditorState.h @@ -86,6 +86,7 @@ class LumatoneEditorState : public LumatoneApplicationState const juce::String getApplicationVersion() const { return ProjectInfo::versionString; } juce::Rectangle getWindowBounds() const { return windowBounds; } + float getRoundedRectCornerSize() const; bool getHasChangesToSave() const { return hasChangesToSave; } bool getInCalibrationMode() const { return inCalibrationMode; } diff --git a/Source/LumatoneEditorStyleCommon.h b/Source/LumatoneEditorStyleCommon.h index f7f3b18..4686086 100644 --- a/Source/LumatoneEditorStyleCommon.h +++ b/Source/LumatoneEditorStyleCommon.h @@ -27,9 +27,6 @@ #define PATH_PI_2_CW 1.5707963 // pi / 2 #define PATH_PI_2_CCW -1.5707963 -// Rounded corner size over app height ratio for layout elements -#define ROUNDEDCORNERTOAPPHEIGHT 0.00555556f - #if JUCE_MAC #define GLOBALFONTSCALAR 0.9f #define CONTROLBOXFONTHEIGHTSCALAR 0.7f @@ -610,6 +607,7 @@ enum LumatoneEditorColourIDs HeaderBackground, MediumBackground, LightBackground, + ControlAreaHeader, ControlAreaBackground, ControlBoxHighlighted, ActiveText,