From 17de6e6e6e94c911261f672f0c51de23a9f8d38e Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Sat, 3 Aug 2024 09:41:15 -0400 Subject: [PATCH] Some more fonts and colors Close to the wireframe now. Moving onto some non-UI stuff for a bit after this. --- resources/CMakeLists.txt | 1 + src-ui/components/multi/MappingPane.cpp | 30 ++++++++++++------- .../multi/detail/GroupZoneTreeControl.h | 11 +++++-- src-ui/theme/ThemeApplier.cpp | 20 +++++++++++++ src-ui/theme/ThemeApplier.h | 3 ++ 5 files changed, 51 insertions(+), 14 deletions(-) diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 44f7d30c..ab162d16 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -2,6 +2,7 @@ project(scxt-resources) cmrc_add_resource_library(${PROJECT_NAME} NAMESPACE scxt_resources + "fonts/Inter/static/Inter-Light.ttf" "fonts/Inter/static/Inter-Regular.ttf" "fonts/Inter/static/Inter-Medium.ttf" "fonts/Inter/static/Inter-Bold.ttf" diff --git a/src-ui/components/multi/MappingPane.cpp b/src-ui/components/multi/MappingPane.cpp index 968ee3d9..1d319b51 100644 --- a/src-ui/components/multi/MappingPane.cpp +++ b/src-ui/components/multi/MappingPane.cpp @@ -829,7 +829,7 @@ void Keyboard::paint(juce::Graphics &g) } constexpr auto lastOctave = 11; - auto font = editor->themeApplier.interMediumFor(13); + auto font = editor->themeApplier.interRegularFor(13); for (int octave = 0; octave < lastOctave; ++octave) { assert(octave <= 10); @@ -1449,15 +1449,23 @@ void MappingZones::paint(juce::Graphics &g) auto r = rectangleForZone(z.second); - auto nonSelZoneColor = editor->themeColor(theme::ColorMap::generic_content_medium); + auto borderColor = editor->themeColor(theme::ColorMap::accent_1b); + auto fillColor = borderColor.withAlpha(0.2f); + auto textColor = editor->themeColor(theme::ColorMap::accent_1b); + if (drawSelected) - nonSelZoneColor = editor->themeColor(theme::ColorMap::accent_1a); - g.setColour(nonSelZoneColor.withAlpha(drawSelected ? 0.5f : 0.2f)); + { + borderColor = editor->themeColor(theme::ColorMap::accent_1a); + fillColor = borderColor.withAlpha(0.5f); + textColor = editor->themeColor(theme::ColorMap::accent_1a); + } + + g.setColour(fillColor); g.fillRect(r); - g.setColour(nonSelZoneColor); - g.drawRect(r, 2.f); - g.setColour(nonSelZoneColor.brighter()); - g.setFont(editor->themeApplier.interMediumFor(11)); + g.setColour(borderColor); + g.drawRect(r, 1.f); + g.setColour(textColor); + g.setFont(editor->themeApplier.interRegularFor(11)); g.drawText(std::get<2>(z.second), r.reduced(5, 3), juce::Justification::topLeft); auto ct = display->voiceCountFor(z.first); @@ -1476,7 +1484,7 @@ void MappingZones::paint(juce::Graphics &g) const auto &[kb, vel, name] = z.second; - auto selZoneColor = editor->themeColor(theme::ColorMap::accent_1b); + auto selZoneColor = editor->themeColor(theme::ColorMap::accent_1a); auto c1{selZoneColor.withAlpha(0.f)}; auto c2{selZoneColor.withAlpha(0.5f)}; @@ -1650,8 +1658,8 @@ void MappingZones::paint(juce::Graphics &g) g.setColour(selZoneColor); g.drawRect(r, 2.f); - g.setColour(editor->themeColor(theme::ColorMap::generic_content_highest)); - g.setFont(editor->themeApplier.interMediumFor(12)); + g.setColour(editor->themeColor(theme::ColorMap::generic_content_high)); + g.setFont(editor->themeApplier.interRegularFor(11)); g.drawText(std::get<2>(z.second), r.reduced(5, 3), juce::Justification::topLeft); auto ct = display->voiceCountFor(z.first); diff --git a/src-ui/components/multi/detail/GroupZoneTreeControl.h b/src-ui/components/multi/detail/GroupZoneTreeControl.h index dda4feca..178bd00f 100644 --- a/src-ui/components/multi/detail/GroupZoneTreeControl.h +++ b/src-ui/components/multi/detail/GroupZoneTreeControl.h @@ -108,11 +108,16 @@ template struct GroupZoneListBoxModel : juce:: bool isLeadZone = isZone() && gsb->isLeadZone(sg.first); + auto editor = gsb->partGroupSidebar->editor; + auto st = gsb->partGroupSidebar->style(); - g.setFont(st->getFont(jcmp::Label::Styles::styleClass, jcmp::Label::Styles::labelfont)); + auto zoneFont = editor->themeApplier.interLightFor(11); + auto groupFont = editor->themeApplier.interRegularFor(11); - // TODO: Style all of these - auto editor = gsb->partGroupSidebar->editor; + if (isZone()) + g.setFont(zoneFont); + else + g.setFont(groupFont); auto borderColor = editor->themeColor(theme::ColorMap::accent_1b, 0.4); auto textColor = editor->themeColor(theme::ColorMap::generic_content_medium); diff --git a/src-ui/theme/ThemeApplier.cpp b/src-ui/theme/ThemeApplier.cpp index 7a745a3d..6752b220 100644 --- a/src-ui/theme/ThemeApplier.cpp +++ b/src-ui/theme/ThemeApplier.cpp @@ -245,6 +245,12 @@ void ThemeApplier::applyHeaderSCButtonTheme(sst::jucegui::style::StyleConsumer * s->setCustomClass(detail::header::GlyphButtonAccent); } +juce::Font ThemeApplier::interBoldFor(int ht) const +{ + static auto interMed = connectors::resources::loadTypeface("fonts/Inter/static/Inter-Bold.ttf"); + return juce::Font(interMed).withHeight(ht); +} + juce::Font ThemeApplier::interMediumFor(int ht) const { static auto interMed = @@ -252,6 +258,20 @@ juce::Font ThemeApplier::interMediumFor(int ht) const return juce::Font(interMed).withHeight(ht); } +juce::Font ThemeApplier::interRegularFor(int ht) const +{ + static auto interMed = + connectors::resources::loadTypeface("fonts/Inter/static/Inter-Regular.ttf"); + return juce::Font(interMed).withHeight(ht); +} + +juce::Font ThemeApplier::interLightFor(int ht) const +{ + static auto interMed = + connectors::resources::loadTypeface("fonts/Inter/static/Inter-Light.ttf"); + return juce::Font(interMed).withHeight(ht); +} + namespace detail { namespace global diff --git a/src-ui/theme/ThemeApplier.h b/src-ui/theme/ThemeApplier.h index 25d7572a..43355715 100644 --- a/src-ui/theme/ThemeApplier.h +++ b/src-ui/theme/ThemeApplier.h @@ -62,7 +62,10 @@ struct ThemeApplier // Some utilities to move single items void setLabelToHighlight(sst::jucegui::style::StyleConsumer *); + juce::Font interBoldFor(int ht) const; juce::Font interMediumFor(int ht) const; + juce::Font interRegularFor(int ht) const; + juce::Font interLightFor(int ht) const; friend scxt::ui::SCXTEditor;