35 void setContent(
const std::string& text, Rectangle<int> bounds, BubbleComponent::BubblePlacement placement);
42 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
PopupDisplay)
141 void mouseMove(
const MouseEvent& e)
override;
142 void mouseDrag(
const MouseEvent& e)
override;
143 void mouseExit(
const MouseEvent& e)
override;
152 void mouseUp(
const MouseEvent& e)
override;
166 void mouseWheelMove(
const MouseEvent& e,
const MouseWheelDetails& wheel)
override;
168 void scrollBarMoved(ScrollBar* scroll_bar,
double range_start)
override;
186 listeners_.push_back(listener);
202 int getViewPosition() {
203 int view_height = getHeight();
204 return std::max(0, std::min<int>(selections_.
size() *
getRowHeight() - view_height, view_position_));
207 void moveQuadToRow(
OpenGlQuad& quad,
int row);
209 std::vector<Listener*> listeners_;
215 float view_position_;
216 std::unique_ptr<OpenGlScrollBar> scroll_bar_;
221 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
PopupList)
275 static File
getAllFile() {
return File::getSpecialLocation(File::tempDirectory).getChildFile(
"All"); }
281 static File
getFavoritesFile() {
return File::getSpecialLocation(File::tempDirectory).getChildFile(
"Favorites"); }
290 String first_name = first.getFullPathName().toLowerCase();
291 String second_name = second.getFullPathName().toLowerCase();
292 return first_name.compareNatural(second_name);
317 void mouseWheelMove(
const MouseEvent& e,
const MouseWheelDetails& wheel)
override;
332 void mouseMove(
const MouseEvent& e)
override;
333 void mouseExit(
const MouseEvent& e)
override;
345 void mouseDown(
const MouseEvent& e)
override;
354 void select(
const File& selection);
366 void setSelected(
const File& selection) { selected_ = selection; }
374 void scrollBarMoved(ScrollBar* scroll_bar,
double range_start)
override;
406 void filter(
const String& filter_string);
439 listeners_.push_back(listener);
450 for (File& selection : selections_) {
451 if (selection.exists())
458 void viewPositionChanged();
459 void toggleFavorite(
const File& selection);
460 void toggleOpenFolder(
const File& selection);
461 int getViewPosition() {
462 int view_height = getHeight();
463 return std::max(0, std::min<int>(num_view_selections_ *
getRowHeight() - view_height, view_position_));
465 void loadBrowserCache(
int start_index,
int end_index);
466 void moveQuadToRow(
OpenGlQuad& quad,
int row,
float y_offset);
469 bool favorites_option_;
470 std::vector<Listener*> listeners_;
471 Array<File> selections_;
472 std::string additional_roots_name_;
473 Array<File> additional_roots_;
474 int num_view_selections_;
475 std::vector<File> filtered_selections_;
476 std::set<std::string> favorites_;
477 std::map<std::string, int> open_folders_;
478 std::unique_ptr<OpenGlScrollBar> scroll_bar_;
479 String filter_string_;
484 Component browse_area_;
491 float view_position_;
492 std::string passthrough_name_;
514 if (isShowing() && isVisible())
523 void setPosition(Point<int> position, Rectangle<int> bounds);
545 void setCallback(std::function<
void(
int)> callback) { callback_ = std::move(callback); }
558 popup_list_->setSelections(selections);
565 std::function<void(
int)> callback_;
566 std::function<void()> cancel_;
567 std::unique_ptr<PopupList> popup_list_;
589 if (isShowing() && isVisible())
599 void setPosition(Point<int> position,
int width, Rectangle<int> bounds);
604 void focusLost(FocusChangeType cause)
override { setVisible(
false); }
610 void setCallback(std::function<
void(
int)> callback) { callback_ = std::move(callback); }
617 left_list_->setSelections(selections);
619 for (
int i = 0; i < selections.
size(); ++i) {
620 if (selections.
items[i].selected)
621 right_list_->setSelections(selections.
items[i]);
630 std::function<void(
int)> callback_;
631 std::unique_ptr<PopupList> left_list_;
632 std::unique_ptr<PopupList> right_list_;
663 for (
Listener* listener : listeners_)
664 listener->closingAreaClicked(
this, e);
674 std::vector<Listener*> listeners_;
687 public TextEditor::Listener,
715 bool keyPressed(
const KeyPress &key, Component *origin)
override;
735 void loadPresets(std::vector<File> directories,
const String& extensions,
736 const std::string& passthrough_name,
const std::string& additional_folders_name);
767 std::unique_ptr<SelectionList> folder_list_;
768 std::unique_ptr<SelectionList> selection_list_;
769 std::unique_ptr<OpenGlTextEditor> search_box_;
770 std::unique_ptr<OpenGlShapeButton> exit_button_;
771 std::unique_ptr<OpenGlToggleButton> store_button_;
772 std::unique_ptr<OpenGlToggleButton> download_button_;
773 Rectangle<int> passthrough_bounds_;
774 Rectangle<int> browser_bounds_;
780 std::set<std::string> more_author_presets_;
782 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
PopupBrowser)
Font & proportional_light()
Returns a reference to the proportional light font.
Definition fonts.h:28
static Fonts * instance()
Gets the singleton instance of the Fonts class.
Definition fonts.h:52
A utility class for rendering a single image using OpenGL.
Definition open_gl_image.h:16
A convenience class for a single quad rendered via OpenGL.
Definition open_gl_multi_quad.h:447
A component that draws a shape into an OpenGlImageComponent.
Definition open_gl_image_component.h:417
A text component rendered into an OpenGlImageComponent with configurable font and justification.
Definition open_gl_image_component.h:301
Comparator for sorting files by name ascending.
Definition popup_browser.h:287
static int compareElements(const File &first, const File &second)
Definition popup_browser.h:289
Interface for receiving selection events from SelectionList.
Definition popup_browser.h:238
virtual ~Listener()=default
virtual void favoritesSelected()
Called when "Favorites" special selection is made.
Definition popup_browser.h:256
virtual void doubleClickedSelected(File selection)=0
Called when a file is double-clicked.
virtual void allSelected()
Called when "All" special selection is made.
Definition popup_browser.h:251
virtual void newSelection(File selection)=0
Called when a new File is selected.
A scrollable file/folder selection list that supports nested folders and favorites.
Definition popup_browser.h:232
int getFolderDepth(const File &file)
Gets the depth of a given folder relative to open folders.
Definition popup_browser.cpp:666
int getRowFromPosition(float mouse_position)
Definition popup_browser.cpp:456
void mouseExit(const MouseEvent &e) override
Definition popup_browser.cpp:470
std::string getPassthroughFolderName() const
Definition popup_browser.h:443
static constexpr float kRowHeight
Base row height.
Definition popup_browser.h:266
void scrollBarMoved(ScrollBar *scroll_bar, double range_start) override
Definition popup_browser.cpp:642
File selected() const
Returns the currently selected file.
Definition popup_browser.h:360
static File getAllFile()
Returns a File object representing "All" selection.
Definition popup_browser.h:275
void selectPrev()
Selects the previous item in the list.
Definition popup_browser.cpp:758
void setPassthroughFolderName(const std::string &name)
Definition popup_browser.h:442
void paintBackgroundShadow(Graphics &g) override
Stub for painting background shadows. Overridden by subclasses if needed.
Definition popup_browser.h:300
void resetScrollPosition()
Definition popup_browser.cpp:440
static constexpr float kScrollBarWidth
Scrollbar width.
Definition popup_browser.h:269
void setAdditionalRootsName(const std::string &name)
Sets the name associated with additional roots.
Definition popup_browser.cpp:683
void setScrollBarRange()
Definition popup_browser.cpp:647
void initOpenGlComponents(OpenGlWrapper &open_gl) override
Initializes all OpenGL components in this section and sub-sections.
Definition popup_browser.cpp:767
void addListener(Listener *listener)
Adds a SelectionList::Listener.
Definition popup_browser.h:438
bool hasValidPath()
Checks if at least one displayed path exists.
Definition popup_browser.h:449
void addAdditionalFolder()
Definition popup_browser.cpp:540
static constexpr float kScrollSensitivity
Scroll sensitivity.
Definition popup_browser.h:268
void addFavoritesOption()
Adds a "Favorites" option to the list.
Definition popup_browser.h:306
void selectIcon(const File &selection)
Handles selecting the icon area (favorite toggle).
Definition popup_browser.cpp:605
File getSelection(const MouseEvent &e)
Gets the File at the mouse event position.
Definition popup_browser.cpp:492
void addSubfolderSelections(const File &selection, std::vector< File > &selections)
Adds subfolder selections if a folder is open.
Definition popup_browser.cpp:673
void mouseMove(const MouseEvent &e) override
Definition popup_browser.cpp:460
void removeAdditionalFolder(const File &folder)
Definition popup_browser.cpp:571
void mouseWheelMove(const MouseEvent &e, const MouseWheelDetails &wheel) override
Definition popup_browser.cpp:446
SelectionList()
Constructs a SelectionList.
Definition popup_browser.cpp:388
void filter(const String &filter_string)
Filters the selection list by a given string.
Definition popup_browser.cpp:696
void leftClick(const MouseEvent &e)
Definition popup_browser.cpp:501
void setSelections(Array< File > presets)
Sets the files/folders displayed in this SelectionList.
Definition popup_browser.cpp:434
void mouseDoubleClick(const MouseEvent &e) override
Definition popup_browser.cpp:526
void destroyOpenGlComponents(OpenGlWrapper &open_gl) override
Destroys all OpenGL components in this section and sub-sections.
Definition popup_browser.cpp:947
void setSelected(const File &selection)
Sets the currently selected file.
Definition popup_browser.h:366
int getScrollableRange()
Gets the total scrollable range.
Definition popup_browser.cpp:743
static File getFavoritesFile()
Returns a File object representing "Favorites" selection.
Definition popup_browser.h:281
int getSelectedIndex()
Gets the index of the currently selected file.
Definition popup_browser.cpp:735
void resized() override
Called when the component is resized. Arranges layout of child components.
Definition popup_browser.cpp:411
void redoCache()
Refreshes the cached row images.
Definition popup_browser.cpp:657
void mouseDown(const MouseEvent &e) override
Definition popup_browser.cpp:519
int getIconPadding()
Gets the icon padding.
Definition popup_browser.h:330
void paintBackground(Graphics &g) override
Paints the background of the section. Calls paintContainer, heading, knobs, children.
Definition popup_browser.h:299
void renderOpenGlComponents(OpenGlWrapper &open_gl, bool animate) override
Renders all OpenGL components in this section and sub-sections.
Definition popup_browser.cpp:884
Array< File > getAdditionalFolders()
Definition popup_browser.h:314
void respondToMenuCallback(int result)
Definition popup_browser.cpp:474
void menuClick(const MouseEvent &e)
Definition popup_browser.cpp:481
Array< File > getSelections()
Definition popup_browser.h:313
void selectNext()
Selects the next item in the list.
Definition popup_browser.cpp:749
void select(const File &selection)
Selects a given file.
Definition popup_browser.cpp:584
static constexpr float kStarWidth
Width of the star icon area.
Definition popup_browser.h:267
static constexpr int kNumCachedRows
Number of rows cached for performance.
Definition popup_browser.h:265
int getRowHeight()
Returns the scaled row height.
Definition popup_browser.h:324
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
virtual File getCurrentFile()
Gets the currently loaded file. Overridden by subclasses.
Definition synth_section.h:376
virtual int getPixelMultiple() const
Definition synth_section.cpp:729
float size_ratio_
Definition synth_section.h:821
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