2023-01-09 21:58:49 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <JuceHeader.h>
|
|
|
|
#include "PluginProcessor.h"
|
2023-08-29 19:47:13 +00:00
|
|
|
#include "SettingsComponent.h"
|
|
|
|
#include "MidiComponent.h"
|
2023-07-10 12:17:04 +00:00
|
|
|
#include "components/VolumeComponent.h"
|
2023-07-25 19:44:18 +00:00
|
|
|
#include "components/MainMenuBarModel.h"
|
2023-07-28 20:10:21 +00:00
|
|
|
#include "LookAndFeel.h"
|
2023-12-20 17:13:38 +00:00
|
|
|
#include "components/ErrorCodeEditorComponent.h"
|
2023-01-09 21:58:49 +00:00
|
|
|
|
2023-07-08 17:59:05 +00:00
|
|
|
|
2023-07-28 12:55:44 +00:00
|
|
|
class OscirenderAudioProcessorEditor : public juce::AudioProcessorEditor, private juce::CodeDocument::Listener, public juce::AsyncUpdater, public juce::ChangeListener {
|
2023-01-09 21:58:49 +00:00
|
|
|
public:
|
2023-07-10 12:17:04 +00:00
|
|
|
OscirenderAudioProcessorEditor(OscirenderAudioProcessor&);
|
2023-01-09 21:58:49 +00:00
|
|
|
~OscirenderAudioProcessorEditor() override;
|
|
|
|
|
2023-07-10 12:17:04 +00:00
|
|
|
void paint(juce::Graphics&) override;
|
2023-01-09 21:58:49 +00:00
|
|
|
void resized() override;
|
2023-07-02 12:09:24 +00:00
|
|
|
|
2023-07-28 12:55:44 +00:00
|
|
|
void initialiseCodeEditors();
|
2023-07-02 12:09:24 +00:00
|
|
|
void addCodeEditor(int index);
|
|
|
|
void removeCodeEditor(int index);
|
2023-07-05 21:45:51 +00:00
|
|
|
void fileUpdated(juce::String fileName);
|
2023-07-22 17:42:30 +00:00
|
|
|
void handleAsyncUpdate() override;
|
2023-07-28 12:55:44 +00:00
|
|
|
void changeListenerCallback(juce::ChangeBroadcaster* source) override;
|
2023-07-22 21:00:59 +00:00
|
|
|
|
|
|
|
void editPerspectiveFunction(bool enabled);
|
|
|
|
|
2023-07-25 19:44:18 +00:00
|
|
|
void newProject();
|
|
|
|
void openProject();
|
|
|
|
void saveProject();
|
|
|
|
void saveProjectAs();
|
|
|
|
void updateTitle();
|
2023-12-20 20:58:08 +00:00
|
|
|
void openAudioSettings();
|
2023-12-21 14:43:15 +00:00
|
|
|
void resetToDefault();
|
2023-07-25 19:44:18 +00:00
|
|
|
|
2023-01-09 21:58:49 +00:00
|
|
|
private:
|
|
|
|
OscirenderAudioProcessor& audioProcessor;
|
2023-12-29 13:01:09 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
OscirenderLookAndFeel lookAndFeel;
|
|
|
|
|
|
|
|
std::atomic<bool> editingPerspective = false;
|
|
|
|
|
|
|
|
VisualiserComponent visualiser{2, audioProcessor};
|
|
|
|
std::atomic<bool> visualiserFullScreen = false;
|
2023-08-29 19:47:13 +00:00
|
|
|
SettingsComponent settings{audioProcessor, *this};
|
2023-07-10 12:17:04 +00:00
|
|
|
VolumeComponent volume{audioProcessor};
|
2023-12-29 13:01:09 +00:00
|
|
|
|
2023-07-02 12:09:24 +00:00
|
|
|
std::vector<std::shared_ptr<juce::CodeDocument>> codeDocuments;
|
2023-12-20 17:13:38 +00:00
|
|
|
std::vector<std::shared_ptr<ErrorCodeEditorComponent>> codeEditors;
|
2023-08-27 16:47:30 +00:00
|
|
|
juce::CodeEditorComponent::ColourScheme colourScheme;
|
2023-03-29 11:51:22 +00:00
|
|
|
juce::LuaTokeniser luaTokeniser;
|
2023-07-02 12:09:24 +00:00
|
|
|
juce::XmlTokeniser xmlTokeniser;
|
2023-03-29 14:02:29 +00:00
|
|
|
juce::ShapeButton collapseButton;
|
2023-07-22 21:00:59 +00:00
|
|
|
std::shared_ptr<juce::CodeDocument> perspectiveCodeDocument = std::make_shared<juce::CodeDocument>();
|
2023-12-20 18:43:03 +00:00
|
|
|
std::shared_ptr<ErrorCodeEditorComponent> perspectiveCodeEditor = std::make_shared<ErrorCodeEditorComponent>(*perspectiveCodeDocument, &luaTokeniser, audioProcessor, PerspectiveEffect::FILE_NAME);
|
2023-01-09 21:58:49 +00:00
|
|
|
|
2023-07-25 19:44:18 +00:00
|
|
|
std::unique_ptr<juce::FileChooser> chooser;
|
|
|
|
MainMenuBarModel menuBarModel{*this};
|
|
|
|
juce::MenuBarComponent menuBar;
|
|
|
|
|
2023-11-25 22:10:36 +00:00
|
|
|
juce::StretchableLayoutManager layout;
|
|
|
|
juce::StretchableLayoutResizerBar resizerBar{&layout, 1, true};
|
|
|
|
|
2023-12-17 21:32:56 +00:00
|
|
|
juce::TooltipWindow tooltipWindow{this, 0};
|
2023-12-12 22:54:36 +00:00
|
|
|
|
2023-09-11 20:28:34 +00:00
|
|
|
std::atomic<bool> updatingDocumentsWithParserLock = false;
|
|
|
|
|
2023-12-20 20:58:08 +00:00
|
|
|
bool usingNativeMenuBar = false;
|
|
|
|
|
2023-12-27 11:30:06 +00:00
|
|
|
#if !JUCE_MAC
|
|
|
|
juce::OpenGLContext openGlContext;
|
|
|
|
#endif
|
|
|
|
|
2023-03-30 16:28:47 +00:00
|
|
|
void codeDocumentTextInserted(const juce::String& newText, int insertIndex) override;
|
|
|
|
void codeDocumentTextDeleted(int startIndex, int endIndex) override;
|
2023-07-04 19:59:47 +00:00
|
|
|
void updateCodeDocument();
|
2023-07-05 21:45:51 +00:00
|
|
|
void updateCodeEditor();
|
2023-03-29 16:19:16 +00:00
|
|
|
|
2023-03-30 20:09:53 +00:00
|
|
|
bool keyPressed(const juce::KeyPress& key) override;
|
|
|
|
|
2023-01-09 21:58:49 +00:00
|
|
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OscirenderAudioProcessorEditor)
|
|
|
|
};
|