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"
|
2024-12-14 18:15:22 +00:00
|
|
|
#include "components/OsciMainMenuBarModel.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-11-09 19:19:36 +00:00
|
|
|
#include "visualiser/VisualiserSettings.h"
|
2024-12-14 18:15:22 +00:00
|
|
|
#include "CommonPluginEditor.h"
|
2023-01-09 21:58:49 +00:00
|
|
|
|
2024-12-14 18:15:22 +00:00
|
|
|
class OscirenderAudioProcessorEditor : public CommonPluginEditor, 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);
|
2025-01-06 11:17:42 +00:00
|
|
|
void openVisualiserSettings();
|
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-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;
|
|
|
|
|
2024-01-07 19:48:02 +00:00
|
|
|
std::atomic<bool> editingCustomFunction = false;
|
2023-12-29 13:01:09 +00:00
|
|
|
|
2023-08-29 19:47:13 +00:00
|
|
|
SettingsComponent settings{audioProcessor, *this};
|
2025-01-04 14:35:10 +00:00
|
|
|
|
|
|
|
#if !SOSCI_FEATURES
|
|
|
|
juce::TextButton upgradeButton{"Upgrade to premium!"};
|
|
|
|
#endif
|
2024-03-14 22:46:54 +00:00
|
|
|
|
|
|
|
juce::ComponentAnimator codeEditorAnimator;
|
2024-02-12 22:33:06 +00:00
|
|
|
LuaComponent lua{audioProcessor, *this};
|
2023-12-29 13:01:09 +00:00
|
|
|
|
2025-01-06 11:17:42 +00:00
|
|
|
SettingsWindow visualiserSettingsWindow = SettingsWindow("Visualiser Settings", visualiserSettings);
|
|
|
|
|
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
|
|
|
|
2024-12-14 18:15:22 +00:00
|
|
|
OsciMainMenuBarModel model{audioProcessor, *this};
|
2023-07-25 19:44:18 +00:00
|
|
|
|
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};
|
|
|
|
|
2023-09-11 20:28:34 +00:00
|
|
|
std::atomic<bool> updatingDocumentsWithParserLock = false;
|
|
|
|
|
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)
|
|
|
|
};
|