Vital
Loading...
Searching...
No Matches
synth_preset_selector.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include "JuceHeader.h"
7#include "bank_exporter.h"
8#include "preset_selector.h"
9#include "preset_browser.h"
10#include "synth_button.h"
11#include "synth_section.h"
12
26public:
29 class Listener {
30 public:
32 virtual ~Listener() { }
33
36 virtual void setPresetBrowserVisibility(bool visible) = 0;
37
40 virtual void setBankExporterVisibility(bool visible) = 0;
41
44 virtual void deleteRequested(File file) = 0;
45
47 virtual void bankImported() = 0;
48 };
49
69
74
76 void resized() override;
77
80 void paintBackground(Graphics& g) override { selector_->paintBackground(g); }
81
84 void buttonClicked(Button* buttonThatWasClicked) override;
85
88 void newPresetSelected(File preset) override;
89
92 void deleteRequested(File preset) override;
93
95 void hidePresetBrowser() override;
96
98 void hideBankExporter() override;
99
101 void resetText();
102
104 void prevClicked() override;
105
107 void nextClicked() override;
108
111 void textMouseUp(const MouseEvent& e) override;
112
115 void showPopupMenu(Component* anchor);
116
119 void showAlternatePopupMenu(Component* anchor);
120
123 void setModified(bool modified);
124
127 void setSaveSection(SaveSection* save_section) { save_section_ = save_section; }
128
131 void setBrowser(PresetBrowser* browser) {
132 if (browser_ != browser) {
133 browser_ = browser;
134 browser_->addListener(this);
135 }
136 }
137
140 void setBankExporter(BankExporter* bank_exporter) {
141 if (bank_exporter_ != bank_exporter) {
142 bank_exporter_ = bank_exporter;
143 bank_exporter_->addListener(this);
144 }
145 }
146
149 void setPresetBrowserVisibile(bool visible);
150
153
155 void initPreset();
156
158 void savePreset();
159
161 void importPreset();
162
164 void exportPreset();
165
167 void importBank();
168
170 void exportBank();
171
173 void loadTuningFile();
174
176 void clearTuning();
177
180 std::string getTuningName();
181
184 bool hasDefaultTuning();
185
188 std::string loggedInName();
189
191 void signOut();
192
194 void signIn();
195
197 void openSkinDesigner();
198
200 void loadSkin();
201
203 void clearSkin();
204
206 void repaintWithSkin();
207
209 void browsePresets();
210
213 void addListener(Listener* listener) { listeners_.push_back(listener); }
214
215private:
218 void loadFromFile(File& preset);
219
220 std::vector<Listener*> listeners_;
221 std::unique_ptr<Skin> full_skin_;
222 Component::SafePointer<Component> skin_designer_;
223
224 std::unique_ptr<PresetSelector> selector_;
225 std::unique_ptr<OpenGlShapeButton> menu_button_;
226 std::unique_ptr<OpenGlShapeButton> save_button_;
227 BankExporter* bank_exporter_;
228 PresetBrowser* browser_;
229 SaveSection* save_section_;
230 bool modified_;
231
232 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SynthPresetSelector)
233};
Declares the ContentList and BankExporter classes for exporting banks of presets, wavetables,...
Interface for objects that need to respond to the BankExporter being hidden.
Definition bank_exporter.h:261
A UI component for exporting a selection of presets, wavetables, LFOs, and samples as a bank.
Definition bank_exporter.h:257
void addListener(Listener *listener)
Definition bank_exporter.h:310
Interface for events from the PresetBrowser (e.g. preset selected, deleted, or browser hidden).
Definition preset_browser.h:427
A UI for browsing, loading, and organizing presets.
Definition preset_browser.h:413
void addListener(Listener *listener)
Adds a listener to receive events from the PresetBrowser.
Definition preset_browser.cpp:1023
Interface for objects that want to be notified of PresetSelector events.
Definition preset_selector.h:24
A UI overlay for saving presets or other files.
Definition save_section.h:21
Interface for components that need to respond to preset selector events.
Definition synth_preset_selector.h:29
virtual void setBankExporterVisibility(bool visible)=0
virtual ~Listener()
Virtual destructor for proper cleanup.
Definition synth_preset_selector.h:32
virtual void bankImported()=0
Called when a bank is successfully imported.
virtual void deleteRequested(File file)=0
virtual void setPresetBrowserVisibility(bool visible)=0
A UI section that allows the user to select, load, save, and browse presets, and manage associated re...
Definition synth_preset_selector.h:25
void buttonClicked(Button *buttonThatWasClicked) override
Definition synth_preset_selector.cpp:115
void signIn()
Opens the sign-in dialog for the user.
Definition synth_preset_selector.cpp:375
void setModified(bool modified)
Definition synth_preset_selector.cpp:230
void textMouseUp(const MouseEvent &e) override
Definition synth_preset_selector.cpp:180
void addListener(Listener *listener)
Definition synth_preset_selector.h:213
void makeBankExporterVisibile()
Makes the bank exporter visible.
Definition synth_preset_selector.cpp:253
void resetText()
Resets the text displayed in the PresetSelector to reflect current state.
Definition synth_preset_selector.cpp:154
void exportBank()
Exports the current bank.
Definition synth_preset_selector.cpp:337
void loadTuningFile()
Loads a tuning file and applies it to the synthesizer.
Definition synth_preset_selector.cpp:341
void setBankExporter(BankExporter *bank_exporter)
Definition synth_preset_selector.h:140
void setSaveSection(SaveSection *save_section)
Definition synth_preset_selector.h:127
void loadSkin()
Loads a skin from a file.
Definition synth_preset_selector.cpp:398
void nextClicked() override
Called when the next preset button is clicked in the PresetSelector.
Definition synth_preset_selector.cpp:175
void initPreset()
Initializes the current preset to a default state.
Definition synth_preset_selector.cpp:258
~SynthPresetSelector()
Destructor.
Definition synth_preset_selector.cpp:94
void browsePresets()
Shows the preset browser UI.
Definition synth_preset_selector.cpp:422
SynthPresetSelector()
Constructor.
Definition synth_preset_selector.cpp:70
void setPresetBrowserVisibile(bool visible)
Definition synth_preset_selector.cpp:248
void hidePresetBrowser() override
Called when the PresetBrowser is requested to be hidden.
Definition synth_preset_selector.cpp:144
void prevClicked() override
Called when the previous preset button is clicked in the PresetSelector.
Definition synth_preset_selector.cpp:170
void resized() override
Resizes and lays out UI components.
Definition synth_preset_selector.cpp:98
void savePreset()
Saves the current preset.
Definition synth_preset_selector.cpp:268
MenuItems
Menu item IDs for popup menus.
Definition synth_preset_selector.h:51
@ kImportBank
Definition synth_preset_selector.h:57
@ kInitPreset
Definition synth_preset_selector.h:53
@ kLoadSkin
Definition synth_preset_selector.h:63
@ kNumMenuItems
Definition synth_preset_selector.h:67
@ kBrowsePresets
Definition synth_preset_selector.h:59
@ kImportPreset
Definition synth_preset_selector.h:55
@ kCancelled
Definition synth_preset_selector.h:52
@ kExportPreset
Definition synth_preset_selector.h:56
@ kClearTuning
Definition synth_preset_selector.h:61
@ kLoadTuning
Definition synth_preset_selector.h:60
@ kExportBank
Definition synth_preset_selector.h:58
@ kLogIn
Definition synth_preset_selector.h:66
@ kSavePreset
Definition synth_preset_selector.h:54
@ kClearSkin
Definition synth_preset_selector.h:64
@ kOpenSkinDesigner
Definition synth_preset_selector.h:62
@ kLogOut
Definition synth_preset_selector.h:65
void clearTuning()
Clears the currently loaded tuning, reverting to default.
Definition synth_preset_selector.cpp:348
std::string loggedInName()
Definition synth_preset_selector.cpp:363
void showAlternatePopupMenu(Component *anchor)
Definition synth_preset_selector.cpp:218
bool hasDefaultTuning()
Definition synth_preset_selector.cpp:358
void deleteRequested(File preset) override
Definition synth_preset_selector.cpp:139
void clearSkin()
Clears the current skin and reverts to the default.
Definition synth_preset_selector.cpp:408
void importPreset()
Imports a preset from an external file.
Definition synth_preset_selector.cpp:275
void showPopupMenu(Component *anchor)
Definition synth_preset_selector.cpp:187
void openSkinDesigner()
Opens the skin designer tool.
Definition synth_preset_selector.cpp:380
void setBrowser(PresetBrowser *browser)
Definition synth_preset_selector.h:131
void newPresetSelected(File preset) override
Definition synth_preset_selector.cpp:126
void repaintWithSkin()
Repaints the interface with the current skin settings.
Definition synth_preset_selector.cpp:417
void hideBankExporter() override
Called when the BankExporter is requested to be hidden.
Definition synth_preset_selector.cpp:149
std::string getTuningName()
Definition synth_preset_selector.cpp:353
void paintBackground(Graphics &g) override
Definition synth_preset_selector.h:80
void exportPreset()
Exports the current preset to a file.
Definition synth_preset_selector.cpp:296
void importBank()
Imports a bank from an external file.
Definition synth_preset_selector.cpp:311
void signOut()
Signs out the currently logged-in user.
Definition synth_preset_selector.cpp:370
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
Declares the PresetSelector class which provides a UI component for selecting presets.
Declares classes for OpenGL-based buttons used in the Vital synth UI.