Again draw file name in waveform component

This commit is contained in:
xenakios 2018-01-20 21:50:24 +02:00
parent 99127c79bb
commit bc3f456485
2 changed files with 6 additions and 5 deletions

View File

@ -42,6 +42,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
addAndMakeVisible(&m_info_label);
m_info_label.setJustificationType(Justification::centredRight);
m_wavecomponent.GetFileCallback = [this]() { return processor.getAudioFile(); };
addAndMakeVisible(&m_wavecomponent);
const auto& pars = processor.getParameters();
for (int i=0;i<pars.size();++i)
@ -372,6 +373,7 @@ void WaveformComponent::changeListenerCallback(ChangeBroadcaster * /*cb*/)
void WaveformComponent::paint(Graphics & g)
{
jassert(GetFileCallback);
//Logger::writeToLog("Waveform component paint");
g.fillAll(Colours::black);
g.setColour(Colours::darkgrey);
@ -454,7 +456,7 @@ void WaveformComponent::paint(Graphics & g)
g.fillRect((int)pos, m_topmargin, 1, getHeight() - m_topmargin);
}
g.setColour(Colours::aqua.darker());
g.drawText(m_curfile.getFullPathName(), 2, m_topmargin + 2, getWidth(), 20, Justification::topLeft);
g.drawText(GetFileCallback().getFileName(), 2, m_topmargin + 2, getWidth(), 20, Justification::topLeft);
}
void WaveformComponent::timerCallback()

View File

@ -86,12 +86,11 @@ public:
~WaveformComponent();
void changeListenerCallback(ChangeBroadcaster* cb) override;
void paint(Graphics& g) override;
const File& getAudioFile() const { return m_curfile; }
bool isUsingAudioBuffer() const { return m_using_audio_buffer; }
void timerCallback() override;
void timerCallback() override;
std::function<double()> CursorPosCallback;
std::function<void(double)> SeekCallback;
std::function<void(Range<double>, int)> TimeSelectionChangedCallback;
std::function<File()> GetFileCallback;
void mouseDown(const MouseEvent& e) override;
void mouseUp(const MouseEvent& e) override;
void mouseDrag(const MouseEvent& e) override;
@ -116,7 +115,7 @@ private:
int m_topmargin = 0;
int getTimeSelectionEdge(int x, int y);
std::pair<Range<double>, Range<double>> m_file_cached;
File m_curfile;
Image m_waveimage;
OpenGLContext m_ogl;
bool m_use_opengl = false;