From a8d57c5631d0c11cdc034593e64aaac15fceb1ac Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 2 Aug 2024 19:24:45 -0400 Subject: [PATCH] Some upgrades on the sidebar and selections and so on (#1065) Closer to the wireframe, but the wireframe is a bit sparse on some of the choices. --- src-ui/components/multi/MappingPane.cpp | 6 +- src-ui/components/multi/PartGroupSidebar.cpp | 19 ++++-- .../multi/detail/GroupZoneTreeControl.h | 66 +++++++++++++------ src-ui/theme/ThemeApplier.cpp | 7 +- 4 files changed, 67 insertions(+), 31 deletions(-) diff --git a/src-ui/components/multi/MappingPane.cpp b/src-ui/components/multi/MappingPane.cpp index a7b88226..968ee3d9 100644 --- a/src-ui/components/multi/MappingPane.cpp +++ b/src-ui/components/multi/MappingPane.cpp @@ -526,7 +526,7 @@ struct MappingDisplay : juce::Component, void resized() override { - static constexpr int mapSize{620}; + static constexpr int controlSize{140}; static constexpr int headerSize{20}; // Header @@ -535,7 +535,7 @@ struct MappingDisplay : juce::Component, // Mapping Display auto z = b.withTrimmedTop(headerSize); - auto viewArea = z.withWidth(mapSize); + auto viewArea = z.withWidth(getWidth() - controlSize - 5); mappingViewport->setBounds(viewArea); auto kbdY = viewArea.getBottom() - mappingViewport->viewport->getScrollBarThickness() - Keyboard::keyboardHeight; @@ -546,7 +546,7 @@ struct MappingDisplay : juce::Component, static constexpr int rowHeight{16}, rowMargin{4}; static constexpr int typeinWidth{32}; static constexpr int typeinPad{4}, typeinMargin{2}; - auto r = z.withLeft(mapSize + 2); + auto r = z.withLeft(getWidth() - controlSize); auto cr = r.withHeight(rowHeight); auto co2 = [=](auto &c) { diff --git a/src-ui/components/multi/PartGroupSidebar.cpp b/src-ui/components/multi/PartGroupSidebar.cpp index 8d7d99a8..78988d16 100644 --- a/src-ui/components/multi/PartGroupSidebar.cpp +++ b/src-ui/components/multi/PartGroupSidebar.cpp @@ -113,12 +113,12 @@ struct PartSidebar : juce::Component, HasEditor } }; -template +template struct GroupZoneSidebarBase : juce::Component, HasEditor, juce::DragAndDropContainer { PartGroupSidebar *partGroupSidebar{nullptr}; std::unique_ptr listBox; - std::unique_ptr> listBoxModel; + std::unique_ptr> listBoxModel; std::unique_ptr partSelector; T *asT() { return static_cast(this); } @@ -133,7 +133,7 @@ struct GroupZoneSidebarBase : juce::Component, HasEditor, juce::DragAndDropConta void postInit() { - listBoxModel = std::make_unique>(asT()); + listBoxModel = std::make_unique>(asT()); listBoxModel->rebuild(); listBox = std::make_unique(); listBox->setModel(listBoxModel.get()); @@ -230,10 +230,10 @@ struct GroupControls : juce::Component, HasEditor } }; -struct GroupSidebar : GroupZoneSidebarBase +struct GroupSidebar : GroupZoneSidebarBase { - GroupSidebar(PartGroupSidebar *p) : GroupZoneSidebarBase(p) + GroupSidebar(PartGroupSidebar *p) : GroupZoneSidebarBase(p) { groupControls = std::make_unique(this); addAndMakeVisible(*groupControls); @@ -286,9 +286,9 @@ struct GroupSidebar : GroupZoneSidebarBase std::unique_ptr groupControls; }; -struct ZoneSidebar : GroupZoneSidebarBase +struct ZoneSidebar : GroupZoneSidebarBase { - ZoneSidebar(PartGroupSidebar *p) : GroupZoneSidebarBase(p) {} + ZoneSidebar(PartGroupSidebar *p) : GroupZoneSidebarBase(p) {} ~ZoneSidebar() = default; void updateSelection() @@ -411,6 +411,11 @@ PartGroupSidebar::PartGroupSidebar(SCXTEditor *e) w->editor->multiScreen->setSelectionMode(g ? MultiScreen::SelectionMode::GROUP : MultiScreen::SelectionMode::ZONE); + + if (g) + w->editor->themeApplier.applyGroupMultiScreenTheme(w); + else + w->editor->themeApplier.applyZoneMultiScreenTheme(w); }; resetTabState(); diff --git a/src-ui/components/multi/detail/GroupZoneTreeControl.h b/src-ui/components/multi/detail/GroupZoneTreeControl.h index 1ec4380b..dda4feca 100644 --- a/src-ui/components/multi/detail/GroupZoneTreeControl.h +++ b/src-ui/components/multi/detail/GroupZoneTreeControl.h @@ -40,8 +40,9 @@ namespace scxt::ui::multi::detail namespace jcmp = sst::jucegui::components; namespace cmsg = scxt::messaging::client; -template struct GroupZoneListBoxModel : juce::ListBoxModel +template struct GroupZoneListBoxModel : juce::ListBoxModel { + static constexpr bool forZone{fz}; SidebarParent *sidebar{nullptr}; engine::Engine::pgzStructure_t thisGroup; GroupZoneListBoxModel(SidebarParent *sb) : sidebar(sb) { rebuild(); } @@ -81,7 +82,7 @@ template struct GroupZoneListBoxModel : juce::ListBoxMo { int rowNumber{-1}; bool isSelected{false}; - GroupZoneListBoxModel *lbm{nullptr}; + GroupZoneListBoxModel *lbm{nullptr}; SidebarParent *gsb{nullptr}; std::unique_ptr renameEditor; @@ -92,7 +93,8 @@ template struct GroupZoneListBoxModel : juce::ListBoxMo renameEditor->addListener(this); } - int zonePad = 20; + int zonePad = 16; + int grouplabelPad = zonePad; void paint(juce::Graphics &g) override { @@ -110,18 +112,42 @@ template struct GroupZoneListBoxModel : juce::ListBoxMo g.setFont(st->getFont(jcmp::Label::Styles::styleClass, jcmp::Label::Styles::labelfont)); // TODO: Style all of these - auto borderColor = juce::Colour(0xFF, 0x90, 0x00).darker(0.4); - auto textColor = juce::Colour(190, 190, 190); - auto lowTextColor = textColor.darker(0.4); - auto fillColor = juce::Colour(0, 0, 0).withAlpha(0.f); - - if (isSelected) - fillColor = juce::Colour(0x40, 0x20, 0x00); - if (isLeadZone) + auto editor = gsb->partGroupSidebar->editor; + + auto borderColor = editor->themeColor(theme::ColorMap::accent_1b, 0.4); + auto textColor = editor->themeColor(theme::ColorMap::generic_content_medium); + auto lowTextColor = editor->themeColor(theme::ColorMap::generic_content_low); + auto fillColor = editor->themeColor(theme::ColorMap::bg_2); + if (!forZone || isGroup()) + fillColor = editor->themeColor(theme::ColorMap::bg_3); + + if (forZone) + { + if (isSelected && isZone()) + { + fillColor = editor->themeColor(theme::ColorMap::accent_1b, 0.2); + textColor = editor->themeColor(theme::ColorMap::generic_content_high); + } + if (isLeadZone && isZone()) + { + fillColor = editor->themeColor(theme::ColorMap::accent_1b, 0.3); + textColor = editor->themeColor(theme::ColorMap::generic_content_highest); + } + if (isGroup()) + { + textColor = editor->themeColor(theme::ColorMap::generic_content_high); + } + } + else { - fillColor = juce::Colour(0x15, 0x15, 0x50); - textColor = juce::Colour(170, 170, 220); + if (isSelected && isGroup()) + { + fillColor = editor->themeColor(theme::ColorMap::accent_1b, 0.4); + textColor = editor->themeColor(theme::ColorMap::generic_content_highest); + lowTextColor = editor->themeColor(theme::ColorMap::accent_1a); + } } + if (sg.first.zone < 0) { g.setColour(fillColor); @@ -130,8 +156,8 @@ template struct GroupZoneListBoxModel : juce::ListBoxMo g.setColour(borderColor); g.drawLine(0, getHeight(), getWidth(), getHeight()); - auto bx = getLocalBounds().withWidth(zonePad); - auto nb = getLocalBounds().withTrimmedLeft(zonePad); + auto bx = getLocalBounds().withWidth(grouplabelPad); + auto nb = getLocalBounds().withTrimmedLeft(grouplabelPad); g.setColour(lowTextColor); g.drawText(std::to_string(sg.first.group + 1), bx, juce::Justification::centredLeft); @@ -153,11 +179,11 @@ template struct GroupZoneListBoxModel : juce::ListBoxMo if (isLeadZone) { - g.drawText("*", - getLocalBounds() - .translated(zonePad + 2, 0) - .withWidth(getWidth() - zonePad - 5), - juce::Justification::centredRight); + auto b = getLocalBounds().withWidth(zonePad).withTrimmedLeft(2); + auto q = b.getHeight() - b.getWidth(); + b = b.withTrimmedTop(q / 2).withTrimmedBottom(q / 2); + jcmp::GlyphPainter::paintGlyph(g, b, jcmp::GlyphPainter::JOG_RIGHT, + textColor.withAlpha(0.5f)); } } } diff --git a/src-ui/theme/ThemeApplier.cpp b/src-ui/theme/ThemeApplier.cpp index 00c71374..7a745a3d 100644 --- a/src-ui/theme/ThemeApplier.cpp +++ b/src-ui/theme/ThemeApplier.cpp @@ -199,7 +199,12 @@ void ThemeApplier::applyZoneMultiScreenModulationTheme(juce::Component *toThis) populateSharedGroupZoneMultiModulation(map); map.applyMapTo(toThis); } -void ThemeApplier::applyZoneMultiScreenTheme(juce::Component *toThis) {} +void ThemeApplier::applyZoneMultiScreenTheme(juce::Component *toThis) +{ + jstl::CustomTypeMap map; + map.addCustomClass(jcmp::NamedPanel::Styles::styleClass); + map.applyMapTo(toThis); +} void ThemeApplier::applyGroupMultiScreenModulationTheme(juce::Component *toThis) {