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;
|
fixedRotateY->onClick = onRotationChange;
|
||||||
fixedRotateZ->onClick = onRotationChange;
|
fixedRotateZ->onClick = onRotationChange;
|
||||||
|
|
||||||
rotateX.addComponent(fixedRotateX);
|
rotateX.setComponent(fixedRotateX);
|
||||||
rotateY.addComponent(fixedRotateY);
|
rotateY.setComponent(fixedRotateY);
|
||||||
rotateZ.addComponent(fixedRotateZ);
|
rotateZ.setComponent(fixedRotateZ);
|
||||||
|
|
||||||
fixedRotateX->setToggleState(audioProcessor.fixedRotateX, juce::NotificationType::dontSendNotification);
|
fixedRotateX->setToggleState(audioProcessor.fixedRotateX, juce::NotificationType::dontSendNotification);
|
||||||
fixedRotateY->setToggleState(audioProcessor.fixedRotateY, juce::NotificationType::dontSendNotification);
|
fixedRotateY->setToggleState(audioProcessor.fixedRotateY, juce::NotificationType::dontSendNotification);
|
||||||
|
@ -143,10 +143,6 @@ void ObjComponent::resized() {
|
||||||
rotateZ.setBounds(area.removeFromTop(rowHeight));
|
rotateZ.setBounds(area.removeFromTop(rowHeight));
|
||||||
rotateSpeed.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);
|
area.removeFromTop(10);
|
||||||
auto row = area.removeFromTop(rowHeight);
|
auto row = area.removeFromTop(rowHeight);
|
||||||
resetRotation.setBounds(row.removeFromLeft(120));
|
resetRotation.setBounds(row.removeFromLeft(120));
|
||||||
|
|
|
@ -33,10 +33,9 @@ void EffectComponent::resized() {
|
||||||
auto sliderRight = getWidth() - 140;
|
auto sliderRight = getWidth() - 140;
|
||||||
auto bounds = getLocalBounds();
|
auto bounds = getLocalBounds();
|
||||||
bounds.removeFromRight(10);
|
bounds.removeFromRight(10);
|
||||||
bounds.removeFromRight(rightPadding);
|
auto componentBounds = bounds.removeFromRight(25);
|
||||||
|
if (component != nullptr) {
|
||||||
for (auto& component : components) {
|
component->setBounds(componentBounds);
|
||||||
component->setBounds(bounds.removeFromRight(25));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
slider.setBounds(bounds.removeFromRight(sliderRight));
|
slider.setBounds(bounds.removeFromRight(sliderRight));
|
||||||
|
@ -57,15 +56,11 @@ void EffectComponent::paint(juce::Graphics& g) {
|
||||||
g.drawText(name, textBounds, juce::Justification::left);
|
g.drawText(name, textBounds, juce::Justification::left);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectComponent::addComponent(std::shared_ptr<juce::Component> component) {
|
void EffectComponent::setComponent(std::shared_ptr<juce::Component> component) {
|
||||||
components.push_back(component);
|
this->component = component;
|
||||||
addAndMakeVisible(component.get());
|
addAndMakeVisible(component.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectComponent::setRightPadding(double padding) {
|
|
||||||
rightPadding = padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EffectComponent::setCheckboxVisible(bool visible) {
|
void EffectComponent::setCheckboxVisible(bool visible) {
|
||||||
checkboxVisible = visible;
|
checkboxVisible = visible;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,7 @@ public:
|
||||||
void paint(juce::Graphics& g) override;
|
void paint(juce::Graphics& g) override;
|
||||||
|
|
||||||
void setCheckboxVisible(bool visible);
|
void setCheckboxVisible(bool visible);
|
||||||
void addComponent(std::shared_ptr<juce::Component> component);
|
void setComponent(std::shared_ptr<juce::Component> component);
|
||||||
void setRightPadding(double padding);
|
|
||||||
|
|
||||||
juce::Slider slider;
|
juce::Slider slider;
|
||||||
juce::String id;
|
juce::String id;
|
||||||
|
@ -27,8 +26,7 @@ private:
|
||||||
void componentSetup();
|
void componentSetup();
|
||||||
bool checkboxVisible = true;
|
bool checkboxVisible = true;
|
||||||
juce::Rectangle<int> textBounds;
|
juce::Rectangle<int> textBounds;
|
||||||
std::vector<std::shared_ptr<juce::Component>> components;
|
std::shared_ptr<juce::Component> component;
|
||||||
double rightPadding = 0;
|
|
||||||
|
|
||||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(EffectComponent)
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(EffectComponent)
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue