Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ PluginEditor::PluginEditor (PluginProcessor& p)
processorRef (p),
apvts (p.getApvts()),
header ("BandGate", accentColour, processorRef.getPresetManager(), apvts),
abCompare (apvts),
migrationBanner (processorRef.getPresetManager()),
tooltipWindow (this, 450),
globalControls (apvts, spectrumViz),
Expand All @@ -61,6 +62,12 @@ PluginEditor::PluginEditor (PluginProcessor& p)
addAndMakeVisible (header);
header.onPresetLabelClicked = [this] { showPresetBrowserPopup(); };

// UI6-M8: A/B compare snapshot toggle, sits on the right end of the header strip.
addAndMakeVisible (abCompare);
abCompare.setTooltip ("A/B compare — clicking the inactive slot saves current "
"parameters to the active slot and recalls the other; "
"the arrow copies the active snapshot to the inactive slot.");

Comment on lines +65 to +70
addChildComponent (presetPopup);
presetBrowser = std::make_unique<DirektDSP::DirektPresetBrowser> (processorRef.getPresetManager(), accentColour);
presetBrowser->onPresetLoaded = [safe = juce::Component::SafePointer<PluginEditor> (this)]
Expand Down Expand Up @@ -385,7 +392,24 @@ void PluginEditor::resized()
presetPopup.setBounds (getLocalBounds());

auto area = getLocalBounds().reduced (Layout::margin);
header.setBounds (area.removeFromTop (headerHeight));
{
auto headerRow = area.removeFromTop (headerHeight);
// UI6-M8: AB compare takes a fixed slice on the right; header gets the
// remainder. The header lays out its own children inside its bounds.
constexpr int abW = 132;
constexpr int abGap = 8;
if (headerRow.getWidth() > abW + abGap + 80)
{
abCompare.setBounds (headerRow.removeFromRight (abW).reduced (0, 2));
headerRow.removeFromRight (abGap);
}
Comment on lines +397 to +405
else
{
// Editor too narrow: hide the strip to avoid stealing space from the header.
abCompare.setBounds (juce::Rectangle<int>{});
}
header.setBounds (headerRow);
}

const int bannerH = migrationBanner.desiredHeight();
if (bannerH > 0)
Expand Down
2 changes: 2 additions & 0 deletions source/PluginEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "chrome/DirektHeader.h"
#include "chrome/DirektPopupPanel.h"
#include "chrome/DirektPresetBrowser.h"
#include "controls/DirektABCompare.h"
#include "theme/DirektColours.h"
#include "theme/DirektLookAndFeel.h"
#include "melatonin_inspector/melatonin_inspector.h"
Expand Down Expand Up @@ -53,6 +54,7 @@ class PluginEditor : public juce::AudioProcessorEditor,

DirektDSP::DirektLookAndFeel lookAndFeel;
DirektDSP::DirektHeader header;
DirektDSP::DirektABCompare abCompare;
DirektDSP::DirektPopupPanel presetPopup;
std::unique_ptr<DirektDSP::DirektPresetBrowser> presetBrowser;

Expand Down