kopia lustrzana https://github.com/jameshball/osci-render
Add arrows to change the currently open file
rodzic
6802455301
commit
da6ffb082a
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z" /></svg>
|
Po Szerokość: | Wysokość: | Rozmiar: 140 B |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" /></svg>
|
Po Szerokość: | Wysokość: | Rozmiar: 138 B |
|
@ -48,9 +48,39 @@ MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess
|
|||
inputEnabled.onClick = [this] {
|
||||
audioProcessor.inputEnabled->setBoolValueNotifyingHost(!audioProcessor.inputEnabled->getBoolValue());
|
||||
};
|
||||
inputEnabled.setTooltip("Enable to use input audio, instead of osci-render's generated audio.");
|
||||
|
||||
addAndMakeVisible(fileLabel);
|
||||
updateFileLabel();
|
||||
|
||||
addAndMakeVisible(leftArrow);
|
||||
leftArrow.onClick = [this] {
|
||||
juce::SpinLock::ScopedLockType parserLock(audioProcessor.parsersLock);
|
||||
juce::SpinLock::ScopedLockType effectsLock(audioProcessor.effectsLock);
|
||||
|
||||
int index = audioProcessor.getCurrentFileIndex();
|
||||
|
||||
if (index > 0) {
|
||||
audioProcessor.changeCurrentFile(index - 1);
|
||||
pluginEditor.fileUpdated(audioProcessor.getCurrentFileName());
|
||||
}
|
||||
};
|
||||
leftArrow.setTooltip("Change to previous file (k).");
|
||||
|
||||
addAndMakeVisible(rightArrow);
|
||||
rightArrow.onClick = [this] {
|
||||
juce::SpinLock::ScopedLockType parserLock(audioProcessor.parsersLock);
|
||||
juce::SpinLock::ScopedLockType effectsLock(audioProcessor.effectsLock);
|
||||
|
||||
int index = audioProcessor.getCurrentFileIndex();
|
||||
|
||||
if (index < audioProcessor.numFiles() - 1) {
|
||||
audioProcessor.changeCurrentFile(index + 1);
|
||||
pluginEditor.fileUpdated(audioProcessor.getCurrentFileName());
|
||||
}
|
||||
};
|
||||
rightArrow.setTooltip("Change to next file (j).");
|
||||
|
||||
|
||||
addAndMakeVisible(fileName);
|
||||
fileType.addItem(".lua", 1);
|
||||
|
@ -138,6 +168,9 @@ MainComponent::~MainComponent() {
|
|||
}
|
||||
|
||||
void MainComponent::updateFileLabel() {
|
||||
showLeftArrow = audioProcessor.getCurrentFileIndex() > 0;
|
||||
showRightArrow = audioProcessor.getCurrentFileIndex() < audioProcessor.numFiles() - 1;
|
||||
|
||||
if (audioProcessor.objectServerRendering) {
|
||||
fileLabel.setText("Rendering from Blender", juce::dontSendNotification);
|
||||
} else if (audioProcessor.getCurrentFileIndex() == -1) {
|
||||
|
@ -145,6 +178,8 @@ void MainComponent::updateFileLabel() {
|
|||
} else {
|
||||
fileLabel.setText(audioProcessor.getCurrentFileName(), juce::dontSendNotification);
|
||||
}
|
||||
|
||||
resized();
|
||||
}
|
||||
|
||||
void MainComponent::resized() {
|
||||
|
@ -169,6 +204,20 @@ void MainComponent::resized() {
|
|||
closeFileButton.setBounds(juce::Rectangle<int>());
|
||||
}
|
||||
|
||||
if (showLeftArrow) {
|
||||
leftArrow.setBounds(row.removeFromLeft(15));
|
||||
row.removeFromLeft(rowPadding);
|
||||
} else {
|
||||
row.removeFromLeft(15 + rowPadding);
|
||||
leftArrow.setBounds(0, 0, 0, 0);
|
||||
}
|
||||
if (showRightArrow) {
|
||||
rightArrow.setBounds(row.removeFromRight(15));
|
||||
row.removeFromRight(rowPadding);
|
||||
} else {
|
||||
rightArrow.setBounds(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
fileLabel.setBounds(row);
|
||||
|
||||
bounds.removeFromTop(padding);
|
||||
|
|
|
@ -28,6 +28,10 @@ private:
|
|||
SvgButton closeFileButton{"closeFile", juce::String(BinaryData::delete_svg), juce::Colours::red};
|
||||
SvgButton inputEnabled{"inputEnabled", juce::String(BinaryData::microphone_svg), juce::Colours::white, juce::Colours::red, audioProcessor.inputEnabled};
|
||||
juce::Label fileLabel;
|
||||
SvgButton leftArrow{"leftArrow", juce::String(BinaryData::left_arrow_svg), juce::Colours::white};
|
||||
SvgButton rightArrow{"rightArrow", juce::String(BinaryData::right_arrow_svg), juce::Colours::white};
|
||||
bool showLeftArrow = false;
|
||||
bool showRightArrow = false;
|
||||
|
||||
juce::TextEditor fileName;
|
||||
juce::ComboBox fileType;
|
||||
|
|
|
@ -127,25 +127,22 @@ void OscirenderAudioProcessorEditor::initialiseCodeEditors() {
|
|||
void OscirenderAudioProcessorEditor::paint(juce::Graphics& g) {
|
||||
g.fillAll(getLookAndFeel().findColour(juce::ResizableWindow::backgroundColourId));
|
||||
|
||||
auto ds = juce::DropShadow(juce::Colours::black, 5, juce::Point<int>(0, 0));
|
||||
|
||||
if (!usingNativeMenuBar) {
|
||||
// add drop shadow to the menu bar
|
||||
auto ds = juce::DropShadow(juce::Colours::black, 5, juce::Point<int>(0, 0));
|
||||
ds.drawForRectangle(g, menuBar.getBounds());
|
||||
}
|
||||
|
||||
// draw drop shadow around code editor if visible
|
||||
juce::SpinLock::ScopedLockType lock(audioProcessor.parsersLock);
|
||||
|
||||
int originalIndex = audioProcessor.getCurrentFileIndex();
|
||||
int index = editingCustomFunction ? 0 : audioProcessor.getCurrentFileIndex() + 1;
|
||||
if ((originalIndex != -1 || editingCustomFunction) && index < codeEditors.size() && codeEditors[index]->isVisible()) {
|
||||
auto ds = juce::DropShadow(juce::Colours::black, 5, juce::Point<int>(0, 0));
|
||||
ds.drawForRectangle(g, codeEditors[index]->getBounds());
|
||||
|
||||
if (editingCustomFunction || audioProcessor.getFileName(originalIndex).fromLastOccurrenceOf(".", true, false) == ".lua") {
|
||||
ds.drawForRectangle(g, lua.getBounds());
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < codeEditors.size(); i++) {
|
||||
if (codeEditors[i]->getBounds().getWidth() > 0 && codeEditors[i]->getBounds().getHeight() > 0) {
|
||||
ds.drawForRectangle(g, codeEditors[i]->getBounds());
|
||||
}
|
||||
}
|
||||
|
||||
if (lua.getBounds().getWidth() > 0 && lua.getBounds().getHeight() > 0) {
|
||||
ds.drawForRectangle(g, lua.getBounds());
|
||||
}
|
||||
}
|
||||
|
||||
void OscirenderAudioProcessorEditor::resized() {
|
||||
|
|
|
@ -54,11 +54,14 @@ Point FileParser::nextSample(lua_State*& L, const LuaVariables vars, long& step,
|
|||
|
||||
if (lua != nullptr) {
|
||||
auto values = lua->run(L, vars, step, phase);
|
||||
if (values.size() < 2) {
|
||||
return Point();
|
||||
}
|
||||
return Point(values[0], values[1], values[2]);
|
||||
if (values.size() == 2) {
|
||||
return Point(values[0], values[1], 0);
|
||||
} else if (values.size() > 2) {
|
||||
return Point(values[0], values[1], values[2]);
|
||||
}
|
||||
}
|
||||
|
||||
return Point();
|
||||
}
|
||||
|
||||
void FileParser::closeLua(lua_State*& L) {
|
||||
|
|
|
@ -20,11 +20,13 @@
|
|||
<FILE id="IqXIZW" name="demo.svg" compile="0" resource="1" file="Resources/svg/demo.svg"/>
|
||||
<FILE id="YwkQpy" name="fixed_rotate.svg" compile="0" resource="1"
|
||||
file="Resources/svg/fixed_rotate.svg"/>
|
||||
<FILE id="n1esUp" name="left_arrow.svg" compile="0" resource="1" file="Resources/svg/left_arrow.svg"/>
|
||||
<FILE id="PxYKbt" name="microphone.svg" compile="0" resource="1" file="Resources/svg/microphone.svg"/>
|
||||
<FILE id="pSc1mq" name="osci.svg" compile="0" resource="1" file="Resources/svg/osci.svg"/>
|
||||
<FILE id="D2AI1b" name="pencil.svg" compile="0" resource="1" file="Resources/svg/pencil.svg"/>
|
||||
<FILE id="PFc2q2" name="random.svg" compile="0" resource="1" file="Resources/svg/random.svg"/>
|
||||
<FILE id="n79IAy" name="record.svg" compile="0" resource="1" file="Resources/svg/record.svg"/>
|
||||
<FILE id="OaqZb1" name="right_arrow.svg" compile="0" resource="1" file="Resources/svg/right_arrow.svg"/>
|
||||
<FILE id="rXjNlx" name="threshold.svg" compile="0" resource="1" file="Resources/svg/threshold.svg"/>
|
||||
<FILE id="rFYmV8" name="timer.svg" compile="0" resource="1" file="Resources/svg/timer.svg"/>
|
||||
<FILE id="qC6QiP" name="volume.svg" compile="0" resource="1" file="Resources/svg/volume.svg"/>
|
||||
|
|
Ładowanie…
Reference in New Issue