kopia lustrzana https://github.com/jameshball/osci-render
Restrict to only one additional component in EffectComponent and make code less hacky
rodzic
3db0a94254
commit
1b974b9706
|
@ -103,9 +103,9 @@ ObjComponent::ObjComponent(OscirenderAudioProcessor& p, OscirenderAudioProcessor
|
|||
fixedRotateY->onClick = onRotationChange;
|
||||
fixedRotateZ->onClick = onRotationChange;
|
||||
|
||||
rotateX.addComponent(fixedRotateX);
|
||||
rotateY.addComponent(fixedRotateY);
|
||||
rotateZ.addComponent(fixedRotateZ);
|
||||
rotateX.setComponent(fixedRotateX);
|
||||
rotateY.setComponent(fixedRotateY);
|
||||
rotateZ.setComponent(fixedRotateZ);
|
||||
|
||||
fixedRotateX->setToggleState(audioProcessor.fixedRotateX, juce::NotificationType::dontSendNotification);
|
||||
fixedRotateY->setToggleState(audioProcessor.fixedRotateY, juce::NotificationType::dontSendNotification);
|
||||
|
@ -143,10 +143,6 @@ void ObjComponent::resized() {
|
|||
rotateZ.setBounds(area.removeFromTop(rowHeight));
|
||||
rotateSpeed.setBounds(area.removeFromTop(rowHeight));
|
||||
|
||||
// TODO this is a bit of a hack
|
||||
focalLength.setRightPadding(25);
|
||||
rotateSpeed.setRightPadding(25);
|
||||
|
||||
area.removeFromTop(10);
|
||||
auto row = area.removeFromTop(rowHeight);
|
||||
resetRotation.setBounds(row.removeFromLeft(120));
|
||||
|
|
|
@ -33,10 +33,9 @@ void EffectComponent::resized() {
|
|||
auto sliderRight = getWidth() - 140;
|
||||
auto bounds = getLocalBounds();
|
||||
bounds.removeFromRight(10);
|
||||
bounds.removeFromRight(rightPadding);
|
||||
|
||||
for (auto& component : components) {
|
||||
component->setBounds(bounds.removeFromRight(25));
|
||||
auto componentBounds = bounds.removeFromRight(25);
|
||||
if (component != nullptr) {
|
||||
component->setBounds(componentBounds);
|
||||
}
|
||||
|
||||
slider.setBounds(bounds.removeFromRight(sliderRight));
|
||||
|
@ -57,15 +56,11 @@ void EffectComponent::paint(juce::Graphics& g) {
|
|||
g.drawText(name, textBounds, juce::Justification::left);
|
||||
}
|
||||
|
||||
void EffectComponent::addComponent(std::shared_ptr<juce::Component> component) {
|
||||
components.push_back(component);
|
||||
void EffectComponent::setComponent(std::shared_ptr<juce::Component> component) {
|
||||
this->component = component;
|
||||
addAndMakeVisible(component.get());
|
||||
}
|
||||
|
||||
void EffectComponent::setRightPadding(double padding) {
|
||||
rightPadding = padding;
|
||||
}
|
||||
|
||||
void EffectComponent::setCheckboxVisible(bool visible) {
|
||||
checkboxVisible = visible;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@ public:
|
|||
void paint(juce::Graphics& g) override;
|
||||
|
||||
void setCheckboxVisible(bool visible);
|
||||
void addComponent(std::shared_ptr<juce::Component> component);
|
||||
void setRightPadding(double padding);
|
||||
void setComponent(std::shared_ptr<juce::Component> component);
|
||||
|
||||
juce::Slider slider;
|
||||
juce::String id;
|
||||
|
@ -27,8 +26,7 @@ private:
|
|||
void componentSetup();
|
||||
bool checkboxVisible = true;
|
||||
juce::Rectangle<int> textBounds;
|
||||
std::vector<std::shared_ptr<juce::Component>> components;
|
||||
double rightPadding = 0;
|
||||
std::shared_ptr<juce::Component> component;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(EffectComponent)
|
||||
};
|
||||
|
|
Ładowanie…
Reference in New Issue