![]()
I’m not entirely sure what I’m doing wrong. I’ve written similar code that works fine in OS X, but my component shows this y offset error under windows. Below is the .cpp code for my component. I can provide the .h code upon request.
As a side note (don’t know if this matters) but I’m resizing the component in my MainComponent after I new up the instance of AudioThumbnailComponent.
[code]#include “AudioThumbnailComponent.h”
//[MiscUserDefs] You can add your own user definitions and misc code here…
//[/MiscUserDefs]
//==============================================================================
AudioThumbnailComponent::AudioThumbnailComponent (int numSamples, AudioFormatManager & mgr, AudioThumbnailCache & cache)
: groupComponent (0),
mpThumbnail (0)
{
addAndMakeVisible (groupComponent = new GroupComponent (T(“new group”),
T(“Audio”)));
mpThumbnail = new AudioThumbnail (numSamples, mgr, cache);
//[UserPreSize]
mpThumbnail->addChangeListener(this);
//[/UserPreSize]
setSize (400, 150);
//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}
AudioThumbnailComponent::~AudioThumbnailComponent()
{
//[Destructor_pre]. You can add your own custom destruction code here…
//[/Destructor_pre]
deleteAndZero (groupComponent);
deleteAndZero (mpThumbnail);
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void AudioThumbnailComponent::paint (Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here…
//[/UserPrePaint]
//g.fillAll (Colours::white);
//[UserPaint] Add your own custom painting code here..
mpThumbnail->drawChannel(
g,
(8) + 16, (0) + 24, getWidth() - 44, (getHeight() - 8) - 39,
0, mpThumbnail->getTotalLength(),
0,
1);
//[/UserPaint]
}
void AudioThumbnailComponent::resized()
{
groupComponent->setBounds (8, 0, getWidth() - 14, getHeight() - 8);
//mpThumbnail->setBounds ((8) + 16, (0) + 24, getWidth() - 44, (getHeight() - 8) - 39);
//[UserResized] Add your own custom resize handling here…
//[/UserResized]
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here…
void AudioThumbnailComponent::addChangeListener(ChangeListener* const listener) throw()
{
mpThumbnail->addChangeListener(listener);
}
//[/MiscUserCode]
[/code]
