Skip to content

Commit

Permalink
move rounded corner size calc to a EditorState method
Browse files Browse the repository at this point in the history
  • Loading branch information
vsicurella committed Jun 4, 2024
1 parent 8d3ee5d commit 386236a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
8 changes: 7 additions & 1 deletion Source/LumatoneEditorLookAndFeel.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ class LumatoneEditorLookAndFeel : public LookAndFeel_V4
return getAppFont(LumatoneEditorFont::GothamNarrowMedium, height);
}

float getRoundedRectCornerToAppHeightRatio() const
{
return 0.00555556f;
}

public:
//==================================================================
// LookAndFeel_V4 Implementation
Expand Down Expand Up @@ -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));
Expand Down
5 changes: 5 additions & 0 deletions Source/LumatoneEditorState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions Source/LumatoneEditorState.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class LumatoneEditorState : public LumatoneApplicationState
const juce::String getApplicationVersion() const { return ProjectInfo::versionString; }

juce::Rectangle<int> getWindowBounds() const { return windowBounds; }
float getRoundedRectCornerSize() const;

bool getHasChangesToSave() const { return hasChangesToSave; }
bool getInCalibrationMode() const { return inCalibrationMode; }
Expand Down
4 changes: 1 addition & 3 deletions Source/LumatoneEditorStyleCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -610,6 +607,7 @@ enum LumatoneEditorColourIDs
HeaderBackground,
MediumBackground,
LightBackground,
ControlAreaHeader,
ControlAreaBackground,
ControlBoxHighlighted,
ActiveText,
Expand Down

0 comments on commit 386236a

Please sign in to comment.