kopia lustrzana https://github.com/jameshball/osci-render
Reorganise Line Art Settings and make double box lose focus when clicking off it
rodzic
23bfcaee7d
commit
d1ae93f75a
|
@ -12,14 +12,11 @@ LineArtComponent::LineArtComponent(OscirenderAudioProcessor& p, OscirenderAudioP
|
||||||
addAndMakeVisible(offsetBox);
|
addAndMakeVisible(offsetBox);
|
||||||
|
|
||||||
rateLabel.setText("Framerate", juce::dontSendNotification);
|
rateLabel.setText("Framerate", juce::dontSendNotification);
|
||||||
rateBox.setValue(audioProcessor.animationRate->getValueUnnormalised(), false, 2);
|
|
||||||
rateBox.setJustification(juce::Justification::left);
|
rateBox.setJustification(juce::Justification::left);
|
||||||
|
|
||||||
offsetLabel.setText("Offset", juce::dontSendNotification);
|
offsetLabel.setText("Offset", juce::dontSendNotification);
|
||||||
offsetBox.setValue(audioProcessor.animationOffset->getValueUnnormalised(), false, 2);
|
|
||||||
offsetBox.setJustification(juce::Justification::left);
|
offsetBox.setJustification(juce::Justification::left);
|
||||||
|
|
||||||
audioProcessor.openFile(audioProcessor.currentFile);
|
|
||||||
update();
|
update();
|
||||||
|
|
||||||
auto updateAnimation = [this]() {
|
auto updateAnimation = [this]() {
|
||||||
|
@ -31,8 +28,8 @@ LineArtComponent::LineArtComponent(OscirenderAudioProcessor& p, OscirenderAudioP
|
||||||
|
|
||||||
animate.onClick = updateAnimation;
|
animate.onClick = updateAnimation;
|
||||||
sync.onClick = updateAnimation;
|
sync.onClick = updateAnimation;
|
||||||
rateBox.onTextChange = updateAnimation;
|
rateBox.onFocusLost = updateAnimation;
|
||||||
offsetBox.onTextChange = updateAnimation;
|
offsetBox.onFocusLost = updateAnimation;
|
||||||
|
|
||||||
audioProcessor.animateLineArt->addListener(this);
|
audioProcessor.animateLineArt->addListener(this);
|
||||||
audioProcessor.syncMIDIAnimation->addListener(this);
|
audioProcessor.syncMIDIAnimation->addListener(this);
|
||||||
|
@ -49,32 +46,28 @@ LineArtComponent::~LineArtComponent() {
|
||||||
|
|
||||||
void LineArtComponent::resized() {
|
void LineArtComponent::resized() {
|
||||||
auto area = getLocalBounds().withTrimmedTop(20).reduced(20);
|
auto area = getLocalBounds().withTrimmedTop(20).reduced(20);
|
||||||
double rowHeight = 30;
|
double rowHeight = 20;
|
||||||
double rowSpace = 5;
|
double rowSpace = 10;
|
||||||
auto animateBounds = area.removeFromTop(rowHeight);
|
auto animateBounds = area.removeFromTop(rowHeight);
|
||||||
animate.setBounds(animateBounds);
|
animate.setBounds(animateBounds.removeFromLeft(100));
|
||||||
|
sync.setBounds(animateBounds.removeFromLeft(100));
|
||||||
area.removeFromTop(rowSpace);
|
area.removeFromTop(rowSpace);
|
||||||
|
|
||||||
animateBounds = area.removeFromTop(rowHeight);
|
animateBounds = area.removeFromTop(rowHeight);
|
||||||
sync.setBounds(animateBounds);
|
rateLabel.setBounds(animateBounds.removeFromLeft(80));
|
||||||
|
rateBox.setBounds(animateBounds.removeFromLeft(60));
|
||||||
area.removeFromTop(rowSpace);
|
area.removeFromTop(rowSpace);
|
||||||
|
|
||||||
animateBounds = area.removeFromTop(rowHeight);
|
animateBounds = area.removeFromTop(rowHeight);
|
||||||
rateLabel.setBounds(animateBounds.removeFromLeft(100));
|
offsetLabel.setBounds(animateBounds.removeFromLeft(80));
|
||||||
rateBox.setBounds(animateBounds);
|
offsetBox.setBounds(animateBounds.removeFromLeft(60));
|
||||||
area.removeFromTop(rowSpace);
|
|
||||||
|
|
||||||
animateBounds = area.removeFromTop(rowHeight);
|
|
||||||
offsetLabel.setBounds(animateBounds.removeFromLeft(100));
|
|
||||||
offsetBox.setBounds(animateBounds);
|
|
||||||
area.removeFromTop(rowSpace);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineArtComponent::update() {
|
void LineArtComponent::update() {
|
||||||
rateBox.setValue(audioProcessor.animationRate->getValueUnnormalised(), true, 2);
|
rateBox.setValue(audioProcessor.animationRate->getValueUnnormalised(), false, 2);
|
||||||
offsetBox.setValue(audioProcessor.animationOffset->getValueUnnormalised(), true, 2);
|
offsetBox.setValue(audioProcessor.animationOffset->getValueUnnormalised(), false, 2);
|
||||||
animate.setToggleState(audioProcessor.animateLineArt->getValue(), true);
|
animate.setToggleState(audioProcessor.animateLineArt->getValue(), false);
|
||||||
sync.setToggleState(audioProcessor.syncMIDIAnimation->getValue(), true);
|
sync.setToggleState(audioProcessor.syncMIDIAnimation->getValue(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineArtComponent::parameterValueChanged(int parameterIndex, float newValue) {
|
void LineArtComponent::parameterValueChanged(int parameterIndex, float newValue) {
|
||||||
|
|
|
@ -23,8 +23,8 @@ private:
|
||||||
juce::ToggleButton sync{"MIDI Sync"};
|
juce::ToggleButton sync{"MIDI Sync"};
|
||||||
juce::Label rateLabel{ "Framerate","Framerate"};
|
juce::Label rateLabel{ "Framerate","Framerate"};
|
||||||
juce::Label offsetLabel{ "Offset","Offset" };
|
juce::Label offsetLabel{ "Offset","Offset" };
|
||||||
DoubleTextBox rateBox{ -256, 256 };
|
DoubleTextBox rateBox{ audioProcessor.animationRate->min, audioProcessor.animationRate->max };
|
||||||
DoubleTextBox offsetBox{ -8192, 8192 };
|
DoubleTextBox offsetBox{ audioProcessor.animationOffset->min, audioProcessor.animationRate->max };
|
||||||
|
|
||||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(LineArtComponent)
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(LineArtComponent)
|
||||||
};
|
};
|
|
@ -54,7 +54,7 @@ void SettingsComponent::resized() {
|
||||||
auto dummyBounds = dummy.getBounds();
|
auto dummyBounds = dummy.getBounds();
|
||||||
|
|
||||||
if (effectSettings != nullptr) {
|
if (effectSettings != nullptr) {
|
||||||
effectSettings->setBounds(dummyBounds.removeFromBottom(200));
|
effectSettings->setBounds(dummyBounds.removeFromBottom(140));
|
||||||
dummyBounds.removeFromBottom(pluginEditor.RESIZER_BAR_SIZE);
|
dummyBounds.removeFromBottom(pluginEditor.RESIZER_BAR_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ public:
|
||||||
onTextChange = [this]() {
|
onTextChange = [this]() {
|
||||||
setText(getText(), false);
|
setText(getText(), false);
|
||||||
};
|
};
|
||||||
|
juce::Desktop::getInstance().addGlobalMouseListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
double getValue() {
|
double getValue() {
|
||||||
|
@ -48,9 +49,22 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
juce::TextEditor::setText(text, sendChangeMessage);
|
juce::TextEditor::setText(text, sendChangeMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mouseDown(const juce::MouseEvent& e) override {
|
||||||
|
if (getScreenBounds().contains(e.getScreenPosition())) {
|
||||||
|
// Delegate mouse clicks inside the editor to the TextEditor
|
||||||
|
// class so as to not break its functionality.
|
||||||
|
juce::TextEditor::mouseDown(e);
|
||||||
|
} else {
|
||||||
|
// Lose focus when mouse clicks occur outside the editor.
|
||||||
|
giveAwayKeyboardFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~DoubleTextBox() override {}
|
~DoubleTextBox() override {
|
||||||
|
juce::Desktop::getInstance().removeGlobalMouseListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double minValue;
|
double minValue;
|
||||||
|
|
Ładowanie…
Reference in New Issue