-
-
Notifications
You must be signed in to change notification settings - Fork 99
Expand file tree
/
Copy pathPluginEditor.h
More file actions
214 lines (147 loc) · 5.85 KB
/
PluginEditor.h
File metadata and controls
214 lines (147 loc) · 5.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/*
// Copyright (c) 2021-2025 Timothy Schoen
// For information on usage and redistribution, and for a DISCLAIMER OF ALL
// WARRANTIES, see the file, "LICENSE.txt," in this distribution.
*/
#pragma once
#include <juce_audio_processors/juce_audio_processors.h>
#include <juce_opengl/juce_opengl.h>
#include <map>
#include "Utility/ModifierKeyListener.h"
#include "Components/CheckedTooltip.h"
#include "Utility/OfflineObjectRenderer.h"
#include "Utility/WindowDragger.h"
#include "Canvas.h"
#include "Components/Buttons.h"
#include "Components/SearchEditor.h"
#include "TabComponent.h"
#include "Utility/ObjectThemeManager.h"
#include "NVGSurface.h"
class ConnectionMessageDisplay;
class Sidebar;
class Statusbar;
class AudioToolbar;
class Dialog;
class Canvas;
class TabComponent;
class PluginProcessor;
class Autosave;
class PluginMode;
class TouchSelectionHelper;
class WelcomePanel;
class CalloutArea;
class NVGGraphicsContext;
class ConsoleMessageDisplay;
class PluginEditor final : public AudioProcessorEditor
, public Value::Listener
, public ApplicationCommandTarget
, public FileDragAndDropTarget
, public ModifierKeyBroadcaster
, public ModifierKeyListener
, public DragAndDropContainer
, public AsyncUpdater
, public Timer
, public SettingsFileListener {
public:
explicit PluginEditor(PluginProcessor&);
~PluginEditor() override;
void paint(Graphics& g) override;
void paintOverChildren(Graphics& g) override;
void renderArea(NVGcontext* nvg, Rectangle<int> area);
bool isActiveWindow() override;
void resized() override;
void parentSizeChanged() override;
void parentHierarchyChanged() override;
void broughtToFront() override;
void timerCallback() override;
void lookAndFeelChanged() override;
// For dragging parent window
void mouseDrag(MouseEvent const& e) override;
void mouseDown(MouseEvent const& e) override;
void handleTouchGesture();
void showWelcomePanel(bool shouldShow);
void quit(bool askToSave);
SmallArray<Canvas*> getCanvases();
Canvas* getCurrentCanvas();
float getRenderScale() const;
void modifierKeysChanged(ModifierKeys const& modifiers) override;
void valueChanged(Value& v) override;
void settingsChanged(String const& name, var const& value) override;
void updateCommandStatus();
void handleAsyncUpdate() override;
void updateSelection(Canvas* cnv);
void setCommandButtonObject(Object const* obj);
void installPackage(File const& file);
void updateConsole(SmallString const& message, bool isWarning, int numMessages, bool newWarning);
bool isInterestedInFileDrag(StringArray const& files) override;
void filesDropped(StringArray const& files, int x, int y) override;
void fileDragEnter(StringArray const&, int, int) override;
void fileDragMove(StringArray const& files, int x, int y) override;
void fileDragExit(StringArray const&) override;
void dragOperationEnded (DragAndDropTarget::SourceDetails const& details) override;
TabComponent& getTabComponent();
ApplicationCommandTarget* getNextCommandTarget() override;
void getAllCommands(Array<CommandID>& commands) override;
void getCommandInfo(CommandID commandID, ApplicationCommandInfo& result) override;
bool perform(InvocationInfo const& info) override;
bool wantsRoundedCorners() const;
bool keyPressed(KeyPress const& key) override;
CallOutBox& showCalloutBox(std::unique_ptr<Component> content, Rectangle<int> screenBounds);
static void updateIoletGeometryForAllObjects(PluginProcessor const* pd);
void commandKeyChanged(bool isHeld) override;
void setUseBorderResizer(bool shouldUse);
void showCalloutArea(bool shouldBeVisible);
Component* getCalloutAreaComponent();
Object* highlightSearchTarget(void* target, bool openNewTabIfNeeded);
SmallArray<pd::WeakReference> openTextEditors;
PluginProcessor* pd;
std::unique_ptr<ConnectionMessageDisplay> connectionMessageDisplay;
std::unique_ptr<Sidebar> sidebar;
std::unique_ptr<Statusbar> statusbar;
std::unique_ptr<AudioToolbar> audioToolbar;
Value theme;
Value autoconnect;
NVGSurface nvgSurface;
std::unique_ptr<Dialog> openedDialog;
ComponentBoundsConstrainer constrainer;
ComponentBoundsConstrainer& pluginConstrainer;
ApplicationCommandManager commandManager;
std::unique_ptr<WelcomePanel> welcomePanel;
CheckedTooltip tooltipWindow;
int editorIndex;
bool isInPluginMode() const;
// Return the canvas currently in plugin mode, otherwise return nullptr
Canvas* getPluginModeCanvas() const;
NVGGraphicsContext* getNanoLLGC()
{
return nvgCtx.get();
}
private:
TabComponent tabComponent;
public:
std::unique_ptr<PluginMode> pluginMode;
std::unique_ptr<ConsoleMessageDisplay> consoleMessageDisplay;
private:
std::unique_ptr<TouchSelectionHelper> touchSelectionHelper;
// Used by standalone to handle dragging the window
WindowDragger windowDragger;
int const toolbarHeight = 32;
MainToolbarButton mainMenuButton, undoButton, redoButton, addObjectMenuButton, welcomePanelSearchButton;
SettingsToolbarButton recentlyOpenedPanelSelector, libraryPanelSelector;
SearchEditor welcomePanelSearchInput;
#if JUCE_MAC
Rectangle<int> unmaximisedSize;
#endif
bool isMaximised = false;
bool isDraggingFile = false;
static inline int numEditors = 0;
Rectangle<int> workArea;
std::unique_ptr<CalloutArea> calloutArea;
// Used in plugin
std::unique_ptr<MouseRateReducedComponent<ResizableCornerComponent>> cornerResizer;
// Used in standalone
std::unique_ptr<MouseRateReducedComponent<ResizableBorderComponent>> borderResizer;
std::unique_ptr<NVGGraphicsContext> nvgCtx;
OSUtils::KeyboardLayout keyboardLayout;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginEditor)
};