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(layoutAnimation);
|
||||
layoutAnimation.setBounds(juce::Rectangle<int>(0, 0, 0, 0));
|
||||
|
||||
addAndMakeVisible(collapseButton);
|
||||
collapseButton.onClick = [this] {
|
||||
juce::SpinLock::ScopedLockType lock(audioProcessor.parsersLock);
|
||||
int originalIndex = audioProcessor.getCurrentFileIndex();
|
||||
int index = editingCustomFunction ? 0 : audioProcessor.getCurrentFileIndex() + 1;
|
||||
if (originalIndex != -1 || editingCustomFunction) {
|
||||
if (codeEditors[index]->isVisible()) {
|
||||
codeEditors[index]->setVisible(false);
|
||||
} else {
|
||||
codeEditors[index]->setVisible(true);
|
||||
bool codeEditorVisible = false;
|
||||
{
|
||||
juce::SpinLock::ScopedLockType lock(audioProcessor.parsersLock);
|
||||
int originalIndex = audioProcessor.getCurrentFileIndex();
|
||||
int index = editingCustomFunction ? 0 : audioProcessor.getCurrentFileIndex() + 1;
|
||||
if (originalIndex != -1 || editingCustomFunction) {
|
||||
codeEditors[index]->setVisible(!codeEditors[index]->isVisible());
|
||||
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;
|
||||
|
@ -92,7 +104,7 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr
|
|||
|
||||
layout.setItemLayout(0, -0.3, -1.0, -0.7);
|
||||
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(resizerBar);
|
||||
|
|
|
@ -10,6 +10,20 @@
|
|||
#include "components/ErrorCodeEditorComponent.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 {
|
||||
public:
|
||||
|
@ -51,6 +65,8 @@ public:
|
|||
VisualiserComponent visualiser{2, audioProcessor};
|
||||
std::atomic<bool> visualiserFullScreen = false;
|
||||
SettingsComponent settings{audioProcessor, *this};
|
||||
|
||||
juce::ComponentAnimator codeEditorAnimator;
|
||||
LuaComponent lua{audioProcessor, *this};
|
||||
VolumeComponent volume{audioProcessor};
|
||||
|
||||
|
@ -70,6 +86,7 @@ public:
|
|||
juce::MenuBarComponent menuBar;
|
||||
|
||||
juce::StretchableLayoutManager layout;
|
||||
ProxyLayoutAnimationComponent layoutAnimation{layout, 1};
|
||||
juce::StretchableLayoutResizerBar resizerBar{&layout, 1, true};
|
||||
|
||||
juce::StretchableLayoutManager luaLayout;
|
||||
|
|
|
@ -356,7 +356,6 @@ public:
|
|||
private:
|
||||
ListBox& owner;
|
||||
OwnedArray<RowComponent> rows;
|
||||
int prevFirstIndex = -1, prevLastRow = -1;
|
||||
int firstIndex = 0, firstWholeIndex = 0, lastWholeIndex = 0;
|
||||
bool hasUpdated = false;
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue