Skip to content

Commit

Permalink
Add a part dropdown atop group zone sidebar
Browse files Browse the repository at this point in the history
Still not to wireframe, but stops us getting lost as we
start to merge parts into place
  • Loading branch information
baconpaul committed Jul 29, 2024
1 parent a5e97ed commit 72abad9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 12 deletions.
13 changes: 4 additions & 9 deletions doc/NightlyBlurb.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
ShortCircuit XT is a sample-initiated instrument being actively developed
by the Surge Synth Team. The build below is our latest pre-alpha github version, but
it is very incomplete.
ShortCircuit XT is a sample-initiated instrument being actively developed by the Surge Synth Team. The build below is our latest pre-alpha github version, but it is very incomplete.

The instrument has many features incomplete, still has unresolved
crashing bugs, and may have DSP errors which cause unbounded
sound. Still, it is becoming more stable and usable and we
do have testers and developers running it.
The instrument has many features incomplete, still has unresolved crashing bugs, and may have DSP errors which cause unbounded sound. Still, it is becoming more stable and usable and we do have testers and developers running it.

If you use ShortCircuit a few things of note:

- You may want to use a limiter on the SC bus, in case there is a DSP error, and definitely do not use in-ear headphones
- Most of the discussion about what works and doesn't happens on our discord. Please join!
- [This figma document](https://www.figma.com/proto/LWyY0E29tISj1djAp40EDL/ED-SST-Wireframes?node-id=3228-2774&starting-point-node-id=3228%3A2774)
serves as a design guide for where we are going
- [This figma document](https://www.figma.com/proto/LWyY0E29tISj1djAp40EDL/ED-SST-Wireframes?node-id=3228-2774&starting-point-node-id=3228%3A2774) serves as a design guide for where we are going
- The more the merrier! If you are a dev jump in.

47 changes: 44 additions & 3 deletions src-ui/components/multi/PartGroupSidebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ struct GroupZoneSidebarBase : juce::Component, HasEditor, juce::DragAndDropConta
PartGroupSidebar *partGroupSidebar{nullptr};
std::unique_ptr<juce::ListBox> listBox;
std::unique_ptr<detail::GroupZoneListBoxModel<T>> listBoxModel;
std::unique_ptr<jcmp::MenuButton> partSelector;

T *asT() { return static_cast<T *>(this); }

Expand All @@ -140,7 +141,42 @@ struct GroupZoneSidebarBase : juce::Component, HasEditor, juce::DragAndDropConta
listBox->setColour(juce::ListBox::backgroundColourId, juce::Colour(0, 0, 0).withAlpha(0.f));

addAndMakeVisible(*listBox);

partSelector = std::make_unique<jcmp::MenuButton>();
partSelector->setOnCallback([w = juce::Component::SafePointer(this)]() {
if (w)
w->showPartSelectorMenu();
});
partSelector->setLabel("Part 1");
addAndMakeVisible(*partSelector);
}

void showPartSelectorMenu()
{
auto p = juce::PopupMenu();
p.addSectionHeader("Part");
p.addSeparator();
for (int i = 0; i < scxt::numParts; ++i)
{
p.addItem("Part " + std::to_string(i + 1), true, i == editor->selectedPart,
[w = juce::Component::SafePointer(this), index = i]() {
w->sendToSerialization(cmsg::DoSelectPart(index));
});
}
p.showMenuAsync(editor->defaultPopupMenuOptions());
}

void showSelectedPart(int part) { partSelector->setLabel("Part " + std::to_string(part + 1)); }

juce::Rectangle<int> baseResize()
{
auto r = getLocalBounds();
auto pg = r.withHeight(22);
auto res = r.withTrimmedTop(24);
partSelector->setBounds(pg);
return res;
}

void addGroup()
{
auto &mc = partGroupSidebar->editor->msgCont;
Expand Down Expand Up @@ -208,9 +244,10 @@ struct GroupSidebar : GroupZoneSidebarBase<GroupSidebar>

void resized() override
{
auto b = baseResize();
auto ht = 200;
auto lb = getLocalBounds().withTrimmedBottom(ht);
auto cb = getLocalBounds().withY(lb.getBottom()).withHeight(ht);
auto lb = b.withTrimmedBottom(ht);
auto cb = b.withY(lb.getBottom()).withHeight(ht);
listBox->setBounds(lb);
groupControls->setBounds(cb);
}
Expand Down Expand Up @@ -260,7 +297,7 @@ struct ZoneSidebar : GroupZoneSidebarBase<ZoneSidebar>
if (partGroupSidebar->editor->currentLeadZoneSelection.has_value())
lastZoneClicked = *(partGroupSidebar->editor->currentLeadZoneSelection);
}
void resized() override { listBox->setBounds(getLocalBounds()); }
void resized() override { listBox->setBounds(baseResize()); }

void processRowsChanged()
{
Expand Down Expand Up @@ -429,10 +466,14 @@ void PartGroupSidebar::setPartGroupZoneStructure(const engine::Engine::pgzStruct

void PartGroupSidebar::selectedPartChanged()
{
groupSidebar->showSelectedPart(editor->selectedPart);
groupSidebar->listBoxModel->rebuild();
groupSidebar->listBox->updateContent();

zoneSidebar->showSelectedPart(editor->selectedPart);
zoneSidebar->listBoxModel->rebuild();
zoneSidebar->listBox->updateContent();

editorSelectionChanged();
repaint();
}
Expand Down

0 comments on commit 72abad9

Please sign in to comment.