57 String first_name = first.getFileNameWithoutExtension().toLowerCase();
58 String second_name = second.getFileNameWithoutExtension().toLowerCase();
59 return first_name.compareNatural(second_name);
73 RelativeTime relative_time = first.getCreationTime() - second.getCreationTime();
74 double days = relative_time.inDays();
75 return days < 0.0 ? 1 : (days > 0.0f ? -1 : 0);
90 selected_(std::move(selected)), ascending_(ascending) { }
93 return selected_.count(file.getFullPathName().toStdString());
97 int order_value = ascending_ ? 1 : -1;
109 std::set<std::string> selected_;
133 void mouseWheelMove(
const MouseEvent& e,
const MouseWheelDetails& wheel)
override;
145 void mouseMove(
const MouseEvent& e)
override;
148 void mouseExit(
const MouseEvent& e)
override;
151 void mouseDown(
const MouseEvent& e)
override;
156 void scrollBarMoved(ScrollBar* scroll_bar,
double range_start)
override;
184 listeners_.push_back(listener);
193 void viewPositionChanged();
197 int getViewPosition() {
199 return std::max(0, std::min<int>(contents_.size() *
getRowHeight() - view_height, view_position_));
205 void loadBrowserCache(
int start_index,
int end_index);
212 void moveQuadToRow(
OpenGlMultiQuad* quad,
int index,
int row,
float y_offset);
219 void selectHighlighted(
int clicked_index);
224 void highlightClick(
const MouseEvent& e,
int clicked_index);
228 void selectRange(
int clicked_index);
230 std::vector<Listener*> listeners_;
231 Array<File> contents_;
233 std::set<std::string> selected_files_;
234 std::set<std::string> highlighted_files_;
235 std::unique_ptr<OpenGlScrollBar> scroll_bar_;
236 int last_selected_index_;
239 Component browse_area_;
241 float view_position_;
243 bool sort_ascending_;
289 bool keyPressed(
const KeyPress &key, Component *origin)
override;
314 void setButtonColors();
322 std::unique_ptr<ContentList> preset_list_;
323 std::unique_ptr<ContentList> wavetable_list_;
324 std::unique_ptr<ContentList> lfo_list_;
325 std::unique_ptr<ContentList> sample_list_;
327 std::unique_ptr<OpenGlTextEditor> bank_name_box_;
328 std::unique_ptr<OpenGlToggleButton> export_bank_button_;
330 std::vector<Listener*> listeners_;
332 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
BankExporter)
Interface for objects that need to respond to the BankExporter being hidden.
Definition bank_exporter.h:261
virtual void hideBankExporter()=0
Called when the BankExporter should be hidden.
virtual ~Listener()=default
A UI component for exporting a selection of presets, wavetables, LFOs, and samples as a bank.
Definition bank_exporter.h:257
void visibilityChanged() override
Called when visibility changes, loads files if becoming visible.
Definition bank_exporter.cpp:538
bool keyPressed(const KeyPress &key, Component *origin) override
Definition bank_exporter.cpp:640
void addListener(Listener *listener)
Definition bank_exporter.h:310
bool keyStateChanged(bool is_key_down, Component *origin) override
Definition bank_exporter.cpp:648
void textEditorTextChanged(TextEditor &editor) override
Definition bank_exporter.cpp:544
~BankExporter()
Destructor.
void paintBackgroundShadow(Graphics &g) override
Definition bank_exporter.cpp:486
void paintBackground(Graphics &g) override
Definition bank_exporter.cpp:465
void resized() override
Resizes and lays out child components.
Definition bank_exporter.cpp:498
void buttonClicked(Button *clicked_button) override
Definition bank_exporter.cpp:635
BankExporter()
Constructor.
Definition bank_exporter.cpp:429
Definition bank_exporter.h:70
static int compareElements(const File &first, const File &second)
Definition bank_exporter.h:72
Definition bank_exporter.h:79
static int compareElements(const File &first, const File &second)
Definition bank_exporter.h:81
Comparator classes for sorting files by name or date.
Definition bank_exporter.h:54
static int compareElements(const File &first, const File &second)
Definition bank_exporter.h:56
Definition bank_exporter.h:63
static int compareElements(const File &first, const File &second)
Definition bank_exporter.h:65
Interface for objects that need to respond to changes in selected presets.
Definition bank_exporter.h:23
virtual void selectedPresetsChanged()=0
Called when the user selection of presets changes.
virtual ~Listener()
Definition bank_exporter.h:25
Comparator for sorting by whether a file is selected or not.
Definition bank_exporter.h:87
bool isSelected(const File &file)
Definition bank_exporter.h:92
int compareElements(const File &first, const File &second)
Definition bank_exporter.h:96
SelectedComparator(std::set< std::string > selected, bool ascending)
Definition bank_exporter.h:89
Displays a list of files (presets, wavetables, LFOs, samples) that can be selected and exported as a ...
Definition bank_exporter.h:19
static constexpr float kScrollSensitivity
Scroll sensitivity factor.
Definition bank_exporter.h:51
void scrollBarMoved(ScrollBar *scroll_bar, double range_start) override
Definition bank_exporter.cpp:190
void addListener(Listener *listener)
Definition bank_exporter.h:183
ContentList(const std::string &name)
Definition bank_exporter.cpp:33
void setContent(Array< File > presets)
Definition bank_exporter.cpp:115
static constexpr float kDateWidthRatio
Width ratio allocated to the date column.
Definition bank_exporter.h:49
static constexpr float kNameWidthRatio
Width ratio allocated to the name column.
Definition bank_exporter.h:47
std::set< std::string > selectedFiles()
Definition bank_exporter.h:189
void mouseWheelMove(const MouseEvent &e, const MouseWheelDetails &wheel) override
Handles mouse wheel events for scrolling.
Definition bank_exporter.cpp:122
int getScrollableRange()
Definition bank_exporter.cpp:266
int getRowFromPosition(float mouse_position)
Definition bank_exporter.cpp:133
void setScrollBarRange()
Updates the scrollbar range based on content size and view position.
Definition bank_exporter.cpp:195
static constexpr float kRowHeight
Height of each row.
Definition bank_exporter.h:43
void resized() override
Resizes and lays out child components.
Definition bank_exporter.cpp:87
void renderOpenGlComponents(OpenGlWrapper &open_gl, bool animate) override
Definition bank_exporter.cpp:365
void paintBackgroundShadow(Graphics &g) override
Definition bank_exporter.h:123
void destroyOpenGlComponents(OpenGlWrapper &open_gl) override
Definition bank_exporter.cpp:420
int getRowHeight()
Definition bank_exporter.h:142
void mouseMove(const MouseEvent &e) override
Handles mouse move events for hover effects.
Definition bank_exporter.cpp:139
void mouseDown(const MouseEvent &e) override
Handles mouse down events for selection and sorting actions.
Definition bank_exporter.cpp:149
void redoCache()
Reloads cached rows after content changes.
Definition bank_exporter.cpp:257
void mouseExit(const MouseEvent &e) override
Handles mouse exit events to clear hover state.
Definition bank_exporter.cpp:145
void paintBackground(Graphics &g) override
Definition bank_exporter.cpp:50
static constexpr float kAddWidthRatio
Width ratio allocated to the "add" (selection) column.
Definition bank_exporter.h:45
void initOpenGlComponents(OpenGlWrapper &open_gl) override
Definition bank_exporter.cpp:273
static constexpr int kNumCachedRows
Number of rows to keep cached.
Definition bank_exporter.h:41
Column
Columns used in the list for sorting and display.
Definition bank_exporter.h:32
@ kDate
Column representing file date.
Definition bank_exporter.h:36
@ kAdded
Column representing selection status.
Definition bank_exporter.h:34
@ kNumColumns
Definition bank_exporter.h:37
@ kNone
No column.
Definition bank_exporter.h:33
@ kName
Column representing file name.
Definition bank_exporter.h:35
A utility class for rendering a single image using OpenGL.
Definition open_gl_image.h:16
A component for rendering multiple quads using OpenGL, with customizable colors, rounding,...
Definition open_gl_multi_quad.h:16
A convenience class for a single quad rendered via OpenGL.
Definition open_gl_multi_quad.h:447
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
virtual void animate(bool animate)
Triggers animation state change in sub-sections if needed.
Definition synth_section.cpp:822
float size_ratio_
Definition synth_section.h:821
float getTitleWidth()
Definition synth_section.cpp:629
virtual void paintTabShadow(Graphics &g)
Paints a tab-like shadow effect around the component.
Definition synth_section.cpp:188
Declares the DeleteSection class, which provides a confirmation overlay for deleting a preset file.
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174