commit 3e1941ba8f880e2a93177392ee08bb5b75148b7a
parent 7ea315fe4bc0da6a758c382a2f612feec09571a5
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Sat, 28 Sep 2024 23:11:52 +0200
disable drag & drop in control table if its read only
Diffstat:
4 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/source/xtJucePlugin/weControlTreeItem.cpp b/source/xtJucePlugin/weControlTreeItem.cpp
@@ -54,7 +54,7 @@ namespace xtJucePlugin
juce::var ControlTreeItem::getDragSourceDescription()
{
- if(m_wave == g_invalidWaveIndex)
+ if(m_wave == g_invalidWaveIndex || WaveEditorData::isReadOnly(m_table))
return TreeViewItem::getDragSourceDescription();
auto* desc = new WaveDesc();
@@ -66,6 +66,8 @@ namespace xtJucePlugin
bool ControlTreeItem::isInterestedInDragSource(const juce::DragAndDropTarget::SourceDetails& _dragSourceDetails)
{
+ if(WaveEditorData::isReadOnly(m_table))
+ return false;
return WaveDesc::fromDragSource(_dragSourceDetails) != nullptr;
}
diff --git a/source/xtJucePlugin/weData.cpp b/source/xtJucePlugin/weData.cpp
@@ -238,4 +238,9 @@ namespace xtJucePlugin
}
return false;
}
+
+ bool WaveEditorData::isReadOnly(const xt::TableId _table)
+ {
+ return _table.rawId() < xt::Wave::g_firstRamTableIndex;
+ }
}
diff --git a/source/xtJucePlugin/weData.h b/source/xtJucePlugin/weData.h
@@ -44,6 +44,7 @@ namespace xtJucePlugin
static uint16_t toIndex(const pluginLib::MidiPacket::Data& _data);
static bool isAlgorithmicTable(xt::TableId _index);
+ static bool isReadOnly(xt::TableId _table);
private:
diff --git a/source/xtLib/xtMidiTypes.h b/source/xtLib/xtMidiTypes.h
@@ -194,6 +194,7 @@ namespace xt
static constexpr uint16_t g_tableCount = 128;
static constexpr uint16_t g_wavesPerTable = 64;
+ static constexpr uint16_t g_firstRamTableIndex = 96;
// these are either algorithmic or invalid, we cannot request them via MIDI
static constexpr uint32_t g_algorithmicWavetables[] = {28, 29,