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"
|
2024-03-01 15:29:14 +00:00
|
|
|
#include "components/LuaConsole.h"
|
2024-08-21 12:35:26 +00:00
|
|
|
#include "components/VisualiserSettings.h"
|
2023-01-09 21:58:49 +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
|
|
|
|
2024-06-02 14:01:39 +00:00
|
|
|
bool isBinaryFile(juce::String name);
|
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);
|
2024-04-13 16:57:23 +00:00
|
|
|
void fileUpdated(juce::String fileName, bool shouldOpenEditor = false);
|
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;
|
2024-02-12 22:33:06 +00:00
|
|
|
void toggleLayout(juce::StretchableLayoutManager& layout, double prefSize);
|
2024-10-23 10:23:58 +00:00
|
|
|
|
|
|
|
void openVisualiserSettings();
|
|
|
|
void closeVisualiserSettings();
|
2023-07-22 21:00:59 +00:00
|
|
|
|
2024-01-07 19:48:02 +00:00
|
|
|
void editCustomFunction(bool enabled);
|
2023-07-22 21:00:59 +00:00
|
|
|
|
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:
|
|
|
|
|
2024-02-12 22:33:06 +00:00
|
|
|
const double CLOSED_PREF_SIZE = 30.0;
|
|
|
|
const double RESIZER_BAR_SIZE = 7.0;
|
|
|
|
|
2023-12-29 13:01:09 +00:00
|
|
|
OscirenderLookAndFeel lookAndFeel;
|
|
|
|
|
2024-01-07 19:48:02 +00:00
|
|
|
std::atomic<bool> editingCustomFunction = false;
|
2023-12-29 13:01:09 +00:00
|
|
|
|
2024-09-12 22:09:54 +00:00
|
|
|
VisualiserSettings visualiserSettings = VisualiserSettings(audioProcessor.visualiserParameters);
|
2024-08-21 12:35:26 +00:00
|
|
|
SettingsWindow visualiserSettingsWindow = SettingsWindow("Visualiser Settings");
|
2024-10-27 14:30:39 +00:00
|
|
|
VisualiserComponent visualiser{audioProcessor, audioProcessor.threadManager, visualiserSettings, nullptr, audioProcessor.visualiserParameters.legacyVisualiserEnabled->getBoolValue()};
|
2024-08-23 09:53:52 +00:00
|
|
|
|
2023-08-29 19:47:13 +00:00
|
|
|
SettingsComponent settings{audioProcessor, *this};
|
2024-03-14 22:46:54 +00:00
|
|
|
|
|
|
|
juce::ComponentAnimator codeEditorAnimator;
|
2024-02-12 22:33:06 +00:00
|
|
|
LuaComponent lua{audioProcessor, *this};
|
2023-07-10 12:17:04 +00:00
|
|
|
VolumeComponent volume{audioProcessor};
|
2023-12-29 13:01:09 +00:00
|
|
|
|
2024-03-01 15:29:14 +00:00
|
|
|
LuaConsole console;
|
|
|
|
|
2023-07-02 12:09:24 +00:00
|
|
|
std::vector<std::shared_ptr<juce::CodeDocument>> codeDocuments;
|
2024-03-13 23:07:40 +00:00
|
|
|
std::vector<std::shared_ptr<OscirenderCodeEditorComponent>> 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;
|
2024-01-07 19:48:02 +00:00
|
|
|
std::shared_ptr<juce::CodeDocument> customFunctionCodeDocument = std::make_shared<juce::CodeDocument>();
|
2024-03-13 23:07:40 +00:00
|
|
|
std::shared_ptr<OscirenderCodeEditorComponent> customFunctionCodeEditor = std::make_shared<OscirenderCodeEditorComponent>(*customFunctionCodeDocument, &luaTokeniser, audioProcessor, CustomEffect::UNIQUE_ID, CustomEffect::FILE_NAME);
|
2023-01-09 21:58:49 +00:00
|
|
|
|
2023-07-25 19:44:18 +00:00
|
|
|
std::unique_ptr<juce::FileChooser> chooser;
|
2024-08-14 19:27:56 +00:00
|
|
|
MainMenuBarModel menuBarModel{audioProcessor, *this};
|
2023-07-25 19:44:18 +00:00
|
|
|
juce::MenuBarComponent menuBar;
|
|
|
|
|
2023-11-25 22:10:36 +00:00
|
|
|
juce::StretchableLayoutManager layout;
|
|
|
|
juce::StretchableLayoutResizerBar resizerBar{&layout, 1, true};
|
|
|
|
|
2024-02-12 22:33:06 +00:00
|
|
|
juce::StretchableLayoutManager luaLayout;
|
|
|
|
juce::StretchableLayoutResizerBar luaResizerBar{&luaLayout, 1, false};
|
|
|
|
|
2024-08-10 17:36:43 +00:00
|
|
|
juce::TooltipWindow tooltipWindow{nullptr, 0};
|
2024-03-29 21:53:48 +00:00
|
|
|
juce::DropShadower tooltipDropShadow{juce::DropShadow(juce::Colours::black.withAlpha(0.5f), 6, {0,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;
|
|
|
|
|
2024-06-22 11:03:59 +00:00
|
|
|
#if JUCE_LINUX
|
2023-12-27 11:30:06 +00:00
|
|
|
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();
|
2024-06-02 14:01:39 +00:00
|
|
|
void updateCodeEditor(bool binaryFile, bool shouldOpenEditor = false);
|
2023-03-29 16:19:16 +00:00
|
|
|
|
2023-03-30 20:09:53 +00:00
|
|
|
bool keyPressed(const juce::KeyPress& key) override;
|
2024-03-02 18:31:12 +00:00
|
|
|
void mouseDown(const juce::MouseEvent& event) override;
|
|
|
|
void mouseMove(const juce::MouseEvent& event) override;
|
2023-03-30 20:09:53 +00:00
|
|
|
|
2023-01-09 21:58:49 +00:00
|
|
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OscirenderAudioProcessorEditor)
|
|
|
|
};
|