2023-01-15 17:01:27 +00:00
|
|
|
#include "MainComponent.h"
|
|
|
|
#include "parser/FileParser.h"
|
|
|
|
#include "parser/FrameProducer.h"
|
2023-03-29 16:19:16 +00:00
|
|
|
#include "PluginEditor.h"
|
2023-01-15 17:01:27 +00:00
|
|
|
|
2023-03-29 16:19:16 +00:00
|
|
|
MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcessorEditor& editor) : audioProcessor(p), pluginEditor(editor) {
|
2023-01-15 17:01:27 +00:00
|
|
|
setText("Main Settings");
|
|
|
|
|
|
|
|
addAndMakeVisible(fileButton);
|
|
|
|
|
|
|
|
fileButton.setButtonText("Choose File");
|
|
|
|
|
|
|
|
fileButton.onClick = [this] {
|
|
|
|
chooser = std::make_unique<juce::FileChooser>("Open", juce::File::getSpecialLocation(juce::File::userHomeDirectory), "*.obj;*.svg;*.lua;*.txt");
|
|
|
|
auto flags = juce::FileBrowserComponent::openMode;
|
|
|
|
|
|
|
|
chooser->launchAsync(flags, [this](const juce::FileChooser& chooser) {
|
|
|
|
if (chooser.getURLResult().isLocalFile()) {
|
|
|
|
auto file = chooser.getResult();
|
2023-03-30 16:28:47 +00:00
|
|
|
audioProcessor.addFile(file);
|
|
|
|
pluginEditor.updateCodeEditor();
|
2023-01-15 17:01:27 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
MainComponent::~MainComponent() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainComponent::resized() {
|
|
|
|
auto xPadding = 10;
|
|
|
|
auto yPadding = 20;
|
|
|
|
auto buttonWidth = 100;
|
|
|
|
auto buttonHeight = 40;
|
|
|
|
fileButton.setBounds(xPadding, yPadding, buttonWidth, buttonHeight);
|
|
|
|
}
|