kopia lustrzana https://github.com/jameshball/osci-render
Add experimental animations to interface
rodzic
d66967285b
commit
faaa049b9d
|
@ -36,19 +36,31 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr
|
||||||
addAndMakeVisible(menuBar);
|
addAndMakeVisible(menuBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addAndMakeVisible(layoutAnimation);
|
||||||
|
layoutAnimation.setBounds(juce::Rectangle<int>(0, 0, 0, 0));
|
||||||
|
|
||||||
addAndMakeVisible(collapseButton);
|
addAndMakeVisible(collapseButton);
|
||||||
collapseButton.onClick = [this] {
|
collapseButton.onClick = [this] {
|
||||||
|
bool codeEditorVisible = false;
|
||||||
|
{
|
||||||
juce::SpinLock::ScopedLockType lock(audioProcessor.parsersLock);
|
juce::SpinLock::ScopedLockType lock(audioProcessor.parsersLock);
|
||||||
int originalIndex = audioProcessor.getCurrentFileIndex();
|
int originalIndex = audioProcessor.getCurrentFileIndex();
|
||||||
int index = editingCustomFunction ? 0 : audioProcessor.getCurrentFileIndex() + 1;
|
int index = editingCustomFunction ? 0 : audioProcessor.getCurrentFileIndex() + 1;
|
||||||
if (originalIndex != -1 || editingCustomFunction) {
|
if (originalIndex != -1 || editingCustomFunction) {
|
||||||
if (codeEditors[index]->isVisible()) {
|
codeEditors[index]->setVisible(!codeEditors[index]->isVisible());
|
||||||
codeEditors[index]->setVisible(false);
|
|
||||||
} else {
|
|
||||||
codeEditors[index]->setVisible(true);
|
|
||||||
updateCodeEditor();
|
updateCodeEditor();
|
||||||
|
codeEditorVisible = codeEditors[index]->isVisible();
|
||||||
}
|
}
|
||||||
triggerAsyncUpdate();
|
}
|
||||||
|
|
||||||
|
if (codeEditorVisible) {
|
||||||
|
layoutAnimation.setBounds(juce::Rectangle<int>(0, 0, getWidth(), 0));
|
||||||
|
auto finalPos = juce::Rectangle<int>(0, 0, 2 * getWidth() / 3, 0);
|
||||||
|
juce::Desktop::getInstance().getAnimator().animateComponent(&layoutAnimation, finalPos, 1.0, 200, false, 0.5, 0);
|
||||||
|
} else {
|
||||||
|
layoutAnimation.setBounds(juce::Rectangle<int>(0, 0, layout.getItemCurrentPosition(1), 0));
|
||||||
|
auto finalPos = juce::Rectangle<int>(0, 0, getWidth(), 0);
|
||||||
|
juce::Desktop::getInstance().getAnimator().animateComponent(&layoutAnimation, finalPos, 1.0, 200, false, 0.5, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
juce::Path path;
|
juce::Path path;
|
||||||
|
@ -92,7 +104,7 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr
|
||||||
|
|
||||||
layout.setItemLayout(0, -0.3, -1.0, -0.7);
|
layout.setItemLayout(0, -0.3, -1.0, -0.7);
|
||||||
layout.setItemLayout(1, RESIZER_BAR_SIZE, RESIZER_BAR_SIZE, RESIZER_BAR_SIZE);
|
layout.setItemLayout(1, RESIZER_BAR_SIZE, RESIZER_BAR_SIZE, RESIZER_BAR_SIZE);
|
||||||
layout.setItemLayout(2, -0.1, -1.0, -0.3);
|
layout.setItemLayout(2, -0.0, -1.0, -0.3);
|
||||||
|
|
||||||
addAndMakeVisible(settings);
|
addAndMakeVisible(settings);
|
||||||
addAndMakeVisible(resizerBar);
|
addAndMakeVisible(resizerBar);
|
||||||
|
|
|
@ -10,6 +10,20 @@
|
||||||
#include "components/ErrorCodeEditorComponent.h"
|
#include "components/ErrorCodeEditorComponent.h"
|
||||||
#include "components/LuaConsole.h"
|
#include "components/LuaConsole.h"
|
||||||
|
|
||||||
|
class ProxyLayoutAnimationComponent : public juce::Component {
|
||||||
|
public:
|
||||||
|
ProxyLayoutAnimationComponent(juce::StretchableLayoutManager& layout, int index) : layout(layout), index(index) {}
|
||||||
|
|
||||||
|
void resized() override {
|
||||||
|
layout.setItemPosition(index, getBounds().getWidth());
|
||||||
|
getParentComponent()->resized();
|
||||||
|
DBG(getBounds().getWidth());
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
juce::StretchableLayoutManager& layout;
|
||||||
|
int index;
|
||||||
|
};
|
||||||
|
|
||||||
class OscirenderAudioProcessorEditor : public juce::AudioProcessorEditor, private juce::CodeDocument::Listener, public juce::AsyncUpdater, public juce::ChangeListener {
|
class OscirenderAudioProcessorEditor : public juce::AudioProcessorEditor, private juce::CodeDocument::Listener, public juce::AsyncUpdater, public juce::ChangeListener {
|
||||||
public:
|
public:
|
||||||
|
@ -51,6 +65,8 @@ public:
|
||||||
VisualiserComponent visualiser{2, audioProcessor};
|
VisualiserComponent visualiser{2, audioProcessor};
|
||||||
std::atomic<bool> visualiserFullScreen = false;
|
std::atomic<bool> visualiserFullScreen = false;
|
||||||
SettingsComponent settings{audioProcessor, *this};
|
SettingsComponent settings{audioProcessor, *this};
|
||||||
|
|
||||||
|
juce::ComponentAnimator codeEditorAnimator;
|
||||||
LuaComponent lua{audioProcessor, *this};
|
LuaComponent lua{audioProcessor, *this};
|
||||||
VolumeComponent volume{audioProcessor};
|
VolumeComponent volume{audioProcessor};
|
||||||
|
|
||||||
|
@ -70,6 +86,7 @@ public:
|
||||||
juce::MenuBarComponent menuBar;
|
juce::MenuBarComponent menuBar;
|
||||||
|
|
||||||
juce::StretchableLayoutManager layout;
|
juce::StretchableLayoutManager layout;
|
||||||
|
ProxyLayoutAnimationComponent layoutAnimation{layout, 1};
|
||||||
juce::StretchableLayoutResizerBar resizerBar{&layout, 1, true};
|
juce::StretchableLayoutResizerBar resizerBar{&layout, 1, true};
|
||||||
|
|
||||||
juce::StretchableLayoutManager luaLayout;
|
juce::StretchableLayoutManager luaLayout;
|
||||||
|
|
|
@ -356,7 +356,6 @@ public:
|
||||||
private:
|
private:
|
||||||
ListBox& owner;
|
ListBox& owner;
|
||||||
OwnedArray<RowComponent> rows;
|
OwnedArray<RowComponent> rows;
|
||||||
int prevFirstIndex = -1, prevLastRow = -1;
|
|
||||||
int firstIndex = 0, firstWholeIndex = 0, lastWholeIndex = 0;
|
int firstIndex = 0, firstWholeIndex = 0, lastWholeIndex = 0;
|
||||||
bool hasUpdated = false;
|
bool hasUpdated = false;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue