Skip to content

Commit

Permalink
add back accessibility order feature
Browse files Browse the repository at this point in the history
  • Loading branch information
shih1 committed Jan 10, 2025
1 parent fd33c7e commit 4fdda4e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
21 changes: 11 additions & 10 deletions src/surge-fx/ParameterPanel.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include "ParameterPanel.h"

ParameterPanel::ParameterPanel(SurgefxAudioProcessor &p)
ParameterPanel::ParameterPanel(SurgefxAudioProcessor &p,
std::vector<juce::Component *> &accessibleOrder)
: processor(p), styleSheet(sst::jucegui::style::StyleSheet::getBuiltInStyleSheet(
sst::jucegui::style::StyleSheet ::DARK))

sst::jucegui::style::StyleSheet::DARK)),
accessibleOrderWeakRefs(accessibleOrder)
{
sst::jucegui::style ::StyleSheet::initializeStyleSheets([]() {});

Expand All @@ -28,7 +29,7 @@ ParameterPanel::ParameterPanel(SurgefxAudioProcessor &p)

knob->setSource(knobSource.get());

addAndMakeVisible(knob.get());
addAndMakeVisibleRecordOrder(knob.get());
knobs.push_back(std::move(knob));
sources.push_back(std::move(knobSource));

Expand All @@ -47,7 +48,7 @@ ParameterPanel::ParameterPanel(SurgefxAudioProcessor &p)
};

fxTempoSync[i].setTitle("Parameter " + std::to_string(i) + " TempoSync");
addAndMakeVisible(&(fxTempoSync[i]));
addAndMakeVisibleRecordOrder(&(fxTempoSync[i]));

fxDeactivated[i].setOnOffImage(BinaryData::DE_Act_svg, BinaryData::DE_Act_svgSize,
BinaryData::DE_Deact_svg, BinaryData::DE_Deact_svgSize);
Expand All @@ -63,7 +64,7 @@ ParameterPanel::ParameterPanel(SurgefxAudioProcessor &p)
this->processor.setUserEditingParamFeature(i, false);
};
fxDeactivated[i].setTitle("Parameter " + std::to_string(i) + " Deactivate");
addAndMakeVisible(&(fxDeactivated[i]));
addAndMakeVisibleRecordOrder(&(fxDeactivated[i]));

fxExtended[i].setOnOffImage(BinaryData::EX_Act_svg, BinaryData::EX_Act_svgSize,
BinaryData::EX_Deact_svg, BinaryData::EX_Deact_svgSize);
Expand All @@ -79,7 +80,7 @@ ParameterPanel::ParameterPanel(SurgefxAudioProcessor &p)
this->processor.setUserEditingParamFeature(i, false);
};
fxExtended[i].setTitle("Parameter " + std::to_string(i) + " Extended");
addAndMakeVisible(&(fxExtended[i]));
addAndMakeVisibleRecordOrder(&(fxExtended[i]));

fxAbsoluted[i].setOnOffImage(BinaryData::AB_Act_svg, BinaryData::AB_Act_svgSize,
BinaryData::AB_Deact_svg, BinaryData::AB_Deact_svgSize);
Expand All @@ -97,7 +98,7 @@ ParameterPanel::ParameterPanel(SurgefxAudioProcessor &p)
};

fxAbsoluted[i].setTitle("Parameter " + std::to_string(i) + " Absoluted");
addAndMakeVisible(&(fxAbsoluted[i]));
addAndMakeVisibleRecordOrder(&(fxAbsoluted[i]));

processor.prepareParametersAbsentAudio();
fxParamDisplay[i].setGroup(processor.getParamGroup(i).c_str());
Expand All @@ -108,7 +109,7 @@ ParameterPanel::ParameterPanel(SurgefxAudioProcessor &p)
processor.setParameterByString(i, s);
};

addAndMakeVisible(&(fxParamDisplay[i]));
addAndMakeVisibleRecordOrder(&(fxParamDisplay[i]));
}
}

Expand Down Expand Up @@ -146,7 +147,7 @@ void ParameterPanel::reset()
knob->setSource(knobSource.get());
knob->setEnabled(processor.getParamEnabled(i));

addAndMakeVisible(*knob);
addAndMakeVisibleRecordOrder(knob.get());
knobs.push_back(std::move(knob));
sources.push_back(std::move(knobSource));

Expand Down
9 changes: 8 additions & 1 deletion src/surge-fx/ParameterPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class ParameterPanel : public juce::Component
{
public:
ParameterPanel(SurgefxAudioProcessor &);
ParameterPanel(SurgefxAudioProcessor &, std::vector<juce::Component *> &accessibleOrder);

~ParameterPanel() override;

Expand Down Expand Up @@ -50,8 +50,15 @@ class ParameterPanel : public juce::Component

juce::Colour backgroundColour = juce::Colour(205, 206, 212);
juce::Colour surgeOrange = juce::Colour(255, 144, 0);
std::vector<juce::Component *> &accessibleOrderWeakRefs; // Reference to the vector

juce::Font projectFont;

void addAndMakeVisibleRecordOrder(juce::Component *c)
{
accessibleOrderWeakRefs.push_back(c);
addAndMakeVisible(c);
}

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ParameterPanel);
};
2 changes: 1 addition & 1 deletion src/surge-fx/SurgeFXEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ SurgefxAudioProcessorEditor::SurgefxAudioProcessorEditor(SurgefxAudioProcessor &
picker = std::make_unique<Picker>(this);
addAndMakeVisibleRecordOrder(picker.get());

deafultParameterPanel = std::make_unique<ParameterPanel>(p);
deafultParameterPanel = std::make_unique<ParameterPanel>(p, accessibleOrderWeakRefs);
addAndMakeVisibleRecordOrder(deafultParameterPanel.get());

fxNameLabel = std::make_unique<juce::Label>("fxlabel", "Surge XT Effects");
Expand Down

0 comments on commit 4fdda4e

Please sign in to comment.