commit 07768eb47acf8355b7c22d10121887d23b2dd64c
parent 8493be12d61081cff554b9b043367acd5d85d0e4
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Tue, 5 Nov 2024 23:12:15 +0100
add context menu for tables list entries
Diffstat:
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/source/xtJucePlugin/weTablesTreeItem.cpp b/source/xtJucePlugin/weTablesTreeItem.cpp
@@ -114,6 +114,35 @@ namespace xtJucePlugin
juce::NativeMessageBox::showMessageBox(juce::AlertWindow::WarningIcon, errorTitle, tables.empty() ? "No Control Table found in files" : "Multiple control tables found in file");
}
+ void TablesTreeItem::itemClicked(const juce::MouseEvent& _mouseEvent)
+ {
+ if(!_mouseEvent.mods.isPopupMenu())
+ {
+ TreeItem::itemClicked(_mouseEvent);
+ return;
+ }
+
+ juce::PopupMenu menu;
+
+ juce::PopupMenu copyToTableSubMenu;
+
+ for(auto i = xt::wave::g_firstRamTableIndex; i < xt::wave::g_tableCount; ++i)
+ {
+ if(i > xt::wave::g_firstRamTableIndex && (i&7) == 0)
+ copyToTableSubMenu.addColumnBreak();
+
+ const auto id = xt::TableId(i);
+ copyToTableSubMenu.addItem(m_editor.getTableName(id), [this, id]
+ {
+ m_editor.getData().copyTable(id, m_index);
+ });
+ }
+
+ menu.addSubMenu("Copy to", copyToTableSubMenu);
+
+ menu.showMenuAsync({});
+ }
+
void TablesTreeItem::onTableChanged(xt::TableId _index)
{
if(_index != m_index)
diff --git a/source/xtJucePlugin/weTablesTreeItem.h b/source/xtJucePlugin/weTablesTreeItem.h
@@ -26,6 +26,8 @@ namespace xtJucePlugin
bool isInterestedInFileDrag(const juce::StringArray& files) override;
void filesDropped(const juce::StringArray& files, int insertIndex) override;
+ void itemClicked(const juce::MouseEvent&) override;
+
const auto& getTableId() const { return m_index; }
private: