commit 03f3b1a0d02aeb58aeac7a9745831d75f81b30c5
parent 2ea47d68379bb8d0edac7198e484667e2c4c0929
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Sat, 15 Jun 2024 15:33:08 +0200
draw graphs next to names
Diffstat:
6 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/source/xtJucePlugin/weTree.h b/source/xtJucePlugin/weTree.h
@@ -11,7 +11,7 @@ namespace xtJucePlugin
{
public:
explicit Tree(WaveEditor& _editor);
- ~Tree();
+ ~Tree() override;
WaveEditor& getWaveEditor() const { return m_editor; }
diff --git a/source/xtJucePlugin/weTypes.h b/source/xtJucePlugin/weTypes.h
@@ -12,8 +12,8 @@ namespace xtJucePlugin
Invalid = -1,
Rom,
- Ram,
User,
+ Plugin,
Count
};
diff --git a/source/xtJucePlugin/weWaveTree.cpp b/source/xtJucePlugin/weWaveTree.cpp
@@ -9,7 +9,7 @@ namespace xtJucePlugin
WaveTree::WaveTree(WaveEditor& _editor) : Tree(_editor)
{
addCategory(WaveCategory::Rom);
- addCategory(WaveCategory::Ram);
+ addCategory(WaveCategory::User);
}
void WaveTree::addCategory(WaveCategory _category)
diff --git a/source/xtJucePlugin/weWaveTreeItem.cpp b/source/xtJucePlugin/weWaveTreeItem.cpp
@@ -18,7 +18,7 @@ namespace xtJucePlugin
setText(WaveCategoryTreeItem::getCategoryName(_category) + ' ' + std::to_string(_waveIndex));
}
- void WaveTreeItem::paintWave(const WaveData& _data, juce::Graphics& _g, int _width, int _height, juce::Colour _colour)
+ void WaveTreeItem::paintWave(const WaveData& _data, juce::Graphics& _g, const int _x, const int _y, const int _width, const int _height, const juce::Colour& _colour)
{
_g.setColour(_colour);
@@ -27,11 +27,11 @@ namespace xtJucePlugin
for(uint32_t x=1; x<_data.size(); ++x)
{
- const auto x0 = static_cast<float>(x - 1) * scaleX;
- const auto x1 = static_cast<float>(x ) * scaleX;
+ const auto x0 = static_cast<float>(x - 1) * scaleX + static_cast<float>(_x);
+ const auto x1 = static_cast<float>(x ) * scaleX + static_cast<float>(_x);
- const auto y0 = static_cast<float>(_data[x - 1] + 128) * scaleY;
- const auto y1 = static_cast<float>(_data[x ] + 128) * scaleY;
+ const auto y0 = static_cast<float>(_data[x - 1] + 128) * scaleY + static_cast<float>(_y);
+ const auto y1 = static_cast<float>(_data[x ] + 128) * scaleY + static_cast<float>(_y);
_g.drawLine(x0, y0, x1, y1);
}
@@ -52,7 +52,9 @@ namespace xtJucePlugin
void WaveTreeItem::paintItem(juce::Graphics& g, int width, int height)
{
if(const auto wave = m_editor.getData().getWave(m_waveIndex))
- paintWave(*wave, g, width, height, juce::Colour(0xffffffff));
+ {
+ paintWave(*wave, g, width>>1, 0, width>>1, height, juce::Colour(0xffffffff));
+ }
TreeItem::paintItem(g, width, height);
}
diff --git a/source/xtJucePlugin/weWaveTreeItem.h b/source/xtJucePlugin/weWaveTreeItem.h
@@ -17,7 +17,7 @@ namespace xtJucePlugin
bool mightContainSubItems() override { return false; }
- static void paintWave(const WaveData& _data, juce::Graphics& _g, int _width, int _height, juce::Colour _colour);
+ static void paintWave(const WaveData& _data, juce::Graphics& _g, int _x, int _y, int _width, int _height, const juce::Colour& _colour);
private:
void onWaveChanged(uint32_t _index);
diff --git a/source/xtJucePlugin/xtWaveEditor.cpp b/source/xtJucePlugin/xtWaveEditor.cpp
@@ -17,7 +17,7 @@ namespace xtJucePlugin
addComponentListener(this);
m_waveTree.reset(new WaveTree(*this));
- m_waveTree->setSize(550, getHeight());
+ m_waveTree->setSize(170, getHeight());
addAndMakeVisible(m_waveTree.get());
}