Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions hi_backend/backend/ai_tools/RestServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@
#undef Rectangle
#endif

// On Linux, resolv.h (included transitively by httplib.h) defines DELETE as
// ns_uop_delete (= 0), which collides with the RestServer::Method::DELETE enum
// value in switch statements. Undefine it here after all system headers are done.
#ifdef DELETE
#undef DELETE
#endif

namespace hise { using namespace juce;

//==============================================================================
Expand Down
8 changes: 8 additions & 0 deletions hi_core/hi_components/floating_layout/FrontendPanelTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,7 @@ var PresetBrowserPanel::toDynamicObject() const

storePropertyInObject(obj, SpecialPanelIds::ShowSaveButton, options.showSaveButtons);
storePropertyInObject(obj, SpecialPanelIds::ShowExpansionsAsColumn, options.showExpansions);
storePropertyInObject(obj, SpecialPanelIds::ShowExpansionEditButtons, options.showExpansionEditButtons);
storePropertyInObject(obj, SpecialPanelIds::ShowFolderButton, options.showFolderButton);
storePropertyInObject(obj, SpecialPanelIds::ShowNotes, options.showNotesLabel);
storePropertyInObject(obj, SpecialPanelIds::ShowEditButtons, options.showEditButtons);
Expand All @@ -1007,6 +1008,7 @@ var PresetBrowserPanel::toDynamicObject() const
storePropertyInObject(obj, SpecialPanelIds::FavoriteIconOffset, options.favoriteIconOffset);
storePropertyInObject(obj, SpecialPanelIds::ShowFavoriteIcon, options.showFavoriteIcons);
storePropertyInObject(obj, SpecialPanelIds::FullPathFavorites, options.fullPathFavorites);
storePropertyInObject(obj, SpecialPanelIds::FullPathSearch, options.fullPathSearch);
storePropertyInObject(obj, SpecialPanelIds::ButtonsInsideBorder, options.buttonsInsideBorder);
storePropertyInObject(obj, SpecialPanelIds::NumColumns, options.numColumns);
storePropertyInObject(obj, SpecialPanelIds::ColumnWidthRatio, var(options.columnWidthRatios));
Expand Down Expand Up @@ -1034,9 +1036,11 @@ void PresetBrowserPanel::fromDynamicObject(const var& object)
options.showSearchBar = getPropertyWithDefault(object, SpecialPanelIds::ShowSearchBar);
options.favoriteIconOffset = getPropertyWithDefault(object, SpecialPanelIds::FavoriteIconOffset);
options.fullPathFavorites = getPropertyWithDefault(object, SpecialPanelIds::FullPathFavorites);
options.fullPathSearch = getPropertyWithDefault(object, SpecialPanelIds::FullPathSearch);
options.buttonsInsideBorder = getPropertyWithDefault(object, SpecialPanelIds::ButtonsInsideBorder);
options.editButtonOffset = getPropertyWithDefault(object, SpecialPanelIds::EditButtonOffset);
options.showExpansions = getPropertyWithDefault(object, SpecialPanelIds::ShowExpansionsAsColumn);
options.showExpansionEditButtons = getPropertyWithDefault(object, SpecialPanelIds::ShowExpansionEditButtons);
options.numColumns = getPropertyWithDefault(object, SpecialPanelIds::NumColumns);

auto ratios = getPropertyWithDefault(object, SpecialPanelIds::ColumnWidthRatio);
Expand Down Expand Up @@ -1128,6 +1132,7 @@ juce::Identifier PresetBrowserPanel::getDefaultablePropertyId(int index) const
RETURN_DEFAULT_PROPERTY_ID(index, SpecialPanelIds::ColumnRowPadding, "ColumnRowPadding");
RETURN_DEFAULT_PROPERTY_ID(index, SpecialPanelIds::SearchBarBounds, "SearchBarBounds");
RETURN_DEFAULT_PROPERTY_ID(index, SpecialPanelIds::FullPathFavorites, "FullPathFavorites");
RETURN_DEFAULT_PROPERTY_ID(index, SpecialPanelIds::FullPathSearch, "FullPathSearch");
RETURN_DEFAULT_PROPERTY_ID(index, SpecialPanelIds::FavoriteButtonBounds, "FavoriteButtonBounds");
RETURN_DEFAULT_PROPERTY_ID(index, SpecialPanelIds::SaveButtonBounds, "SaveButtonBounds");
RETURN_DEFAULT_PROPERTY_ID(index, SpecialPanelIds::MoreButtonBounds, "MoreButtonBounds");
Expand All @@ -1136,6 +1141,7 @@ juce::Identifier PresetBrowserPanel::getDefaultablePropertyId(int index) const
RETURN_DEFAULT_PROPERTY_ID(index, SpecialPanelIds::ShowExpansionsAsColumn, "ShowExpansionsAsColumn");
RETURN_DEFAULT_PROPERTY_ID(index, SpecialPanelIds::ShowFavoriteIcon, "ShowFavoriteIcon");
RETURN_DEFAULT_PROPERTY_ID(index, SpecialPanelIds::FavoriteIconOffset, "FavoriteIconOffset");
RETURN_DEFAULT_PROPERTY_ID(index, SpecialPanelIds::ShowExpansionEditButtons, "ShowExpansionEditButtons");

return Identifier();
}
Expand All @@ -1157,6 +1163,7 @@ var PresetBrowserPanel::getDefaultProperty(int index) const
RETURN_DEFAULT_PROPERTY(index, SpecialPanelIds::ShowAddButton, true);
RETURN_DEFAULT_PROPERTY(index, SpecialPanelIds::ShowRenameButton, true);
RETURN_DEFAULT_PROPERTY(index, SpecialPanelIds::FullPathFavorites, false);
RETURN_DEFAULT_PROPERTY(index, SpecialPanelIds::FullPathSearch, false);
RETURN_DEFAULT_PROPERTY(index, SpecialPanelIds::FavoriteIconOffset, 0);
RETURN_DEFAULT_PROPERTY(index, SpecialPanelIds::ShowDeleteButton, true);
RETURN_DEFAULT_PROPERTY(index, SpecialPanelIds::ShowSearchBar, true);
Expand All @@ -1169,6 +1176,7 @@ var PresetBrowserPanel::getDefaultProperty(int index) const

RETURN_DEFAULT_PROPERTY(index, SpecialPanelIds::ColumnWidthRatio, var(defaultRatios));
RETURN_DEFAULT_PROPERTY(index, SpecialPanelIds::ShowExpansionsAsColumn, false);
RETURN_DEFAULT_PROPERTY(index, SpecialPanelIds::ShowExpansionEditButtons, false);
RETURN_DEFAULT_PROPERTY(index, SpecialPanelIds::ShowFavoriteIcon, true);

Array<var> defaultListAreaOffset = {0, 0, 0, 0};
Expand Down
2 changes: 2 additions & 0 deletions hi_core/hi_components/floating_layout/FrontendPanelTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,9 @@ class PresetBrowserPanel : public FloatingTileContent,
MoreButtonBounds,
FavoriteButtonBounds,
FullPathFavorites,
FullPathSearch,
FavoriteIconOffset,
ShowExpansionEditButtons,
numSpecialProperties
};

Expand Down
76 changes: 69 additions & 7 deletions hi_core/hi_components/plugin_components/PresetBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,36 @@ Point<int> PresetBrowser::getMouseHoverInformation() const
return p;
}

Array<File> PresetBrowser::getAllSearchRoots() const
{
Array<File> roots;

if (currentlySelectedExpansion != nullptr)
{
auto userPresetsDir = currentlySelectedExpansion->getSubDirectory(FileHandlerBase::UserPresets);
if (userPresetsDir.isDirectory())
roots.add(userPresetsDir);
return roots;
}

if (defaultRoot.isDirectory())
roots.add(defaultRoot);

auto& handler = getMainController()->getExpansionHandler();

for (int i = 0; i < handler.getNumExpansions(); ++i)
{
if (auto e = handler.getExpansion(i))
{
auto userPresetsDir = e->getSubDirectory(FileHandlerBase::UserPresets);
if (userPresetsDir.isDirectory() && !roots.contains(userPresetsDir))
roots.add(userPresetsDir);
}
}

return roots;
}

void PresetBrowser::presetChanged(const File& newPreset)
{
// After we switched the expansions we need to make sure to run this logic so that it ca
Expand Down Expand Up @@ -1093,6 +1123,11 @@ void PresetBrowser::setShowFullPathFavorites(bool shouldShowFullPathFavorites)
fullPathFavorites = shouldShowFullPathFavorites;
}

void PresetBrowser::setShowFullPathSearch(bool shouldShowFullPathSearch)
{
fullPathSearch = shouldShowFullPathSearch;
}

void PresetBrowser::setHighlightColourAndFont(Colour c, Colour bgColour, Font f)
{
auto& lf = getPresetBrowserLookAndFeel();
Expand Down Expand Up @@ -1313,6 +1348,17 @@ void PresetBrowser::setOptions(const Options& newOptions)
setShowEditButtons(1, newOptions.showAddButton);
setShowEditButtons(2, newOptions.showRenameButton);
setShowEditButtons(3, newOptions.showDeleteButton);

// Override expansion column buttons independently of the other columns.
// We hide individual buttons rather than disabling showButtonsAtBottom so that
// the 28px button area is still reserved, keeping the column height consistent
// with the bank/category/preset columns.
if (expansionColumn != nullptr && !newOptions.showExpansionEditButtons)
{
expansionColumn->setShowButtons(PresetBrowserColumn::AddButton, false);
expansionColumn->setShowButtons(PresetBrowserColumn::RenameButton, false);
expansionColumn->setShowButtons(PresetBrowserColumn::DeleteButton, false);
}
setShowSearchBar(newOptions.showSearchBar);
setButtonsInsideBorder(newOptions.buttonsInsideBorder);
setEditButtonOffset(newOptions.editButtonOffset);
Expand All @@ -1322,7 +1368,8 @@ void PresetBrowser::setOptions(const Options& newOptions)
setShowFavorites(newOptions.showFavoriteIcons);
setFavoriteIconOffset(newOptions.favoriteIconOffset);
setShowFullPathFavorites(newOptions.fullPathFavorites);

setShowFullPathSearch(newOptions.fullPathSearch);

if (expansionColumn != nullptr)
expansionColumn->update();

Expand Down Expand Up @@ -1370,21 +1417,36 @@ void PresetBrowser::selectionChanged(int columnIndex, int /*rowIndex*/, const Fi
}

if(expansionColumn != nullptr)
{
if (file == File())
expansionColumn->setSelectedFile(File());
expansionColumn->repaint();
expansionColumn->updateButtonVisibility(false);
}

bankColumn->setModel(new PresetBrowserColumn::ColumnListModel(this, 0, this), rootFile);
bankColumn->setNewRootDirectory(rootFile);
categoryColumn->setModel(new PresetBrowserColumn::ColumnListModel(this, 1, this), rootFile);
categoryColumn->setNewRootDirectory(currentCategoryFile);
presetColumn->setNewRootDirectory(File());

auto pc = new PresetBrowserColumn::ColumnListModel(this, 2, this);
pc->setDisplayDirectories(false);
presetColumn->setModel(pc, rootFile);


loadPresetDatabase(rootFile);
presetColumn->setDatabase(getDataBase());
rebuildAllPresets();

if (showOnlyPresets)
{
// Keep the existing model so the search wildcard is preserved; just
// refresh the list — getAllSearchRoots() now returns the new expansion.
presetColumn->setNewRootDirectory(rootFile);
}
else
{
presetColumn->setNewRootDirectory(File());

auto pc = new PresetBrowserColumn::ColumnListModel(this, 2, this);
pc->setDisplayDirectories(false);
presetColumn->setModel(pc, rootFile);
}
}

if (columnIndex == 0)
Expand Down
7 changes: 7 additions & 0 deletions hi_core/hi_components/plugin_components/PresetBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ class PresetBrowser : public Component,
bool showFolderButton = true;
bool showFavoriteIcons = true;
bool fullPathFavorites = false;
bool fullPathSearch = false;
bool showExpansions = false;
bool showExpansionEditButtons = false;
};

// ============================================================================================
Expand Down Expand Up @@ -186,6 +188,7 @@ class PresetBrowser : public Component,
void updateFavoriteButton();
bool shouldShowFavoritesButton() { return showFavoritesButton; }
bool shouldShowFullPathFavorites() { return fullPathFavorites; }
bool shouldShowFullPathSearch() { return fullPathSearch; }

void lookAndFeelChanged() override;

Expand Down Expand Up @@ -233,6 +236,8 @@ class PresetBrowser : public Component,

Point<int> getMouseHoverInformation() const;

Array<File> getAllSearchRoots() const;

Component* getColumn(int columnIndex)
{
switch(columnIndex)
Expand All @@ -254,6 +259,7 @@ class PresetBrowser : public Component,
void setShowFavorites(bool shouldShowFavorites);
void setFavoriteIconOffset(int xOffset);
void setShowFullPathFavorites(bool shouldShowFullPathFavorites);
void setShowFullPathSearch(bool shouldShowFullPathSearch);
void setHighlightColourAndFont(Colour c, Colour bgColour, Font f);
void setNumColumns(int numColumns);

Expand Down Expand Up @@ -305,6 +311,7 @@ class PresetBrowser : public Component,

bool showFavoritesButton = true;
bool fullPathFavorites = false;
bool fullPathSearch = false;
bool showOnlyPresets = false;
String currentWildcard = "*";
StringArray currentTagSelection;
Expand Down
Loading