Only refresh the audio portion of the audio display when markers are moved. Fixes bug where the timeline would sometimes be bold.

Originally committed to SVN as r5066.
This commit is contained in:
Thomas Goyne 2010-12-30 22:19:12 +00:00
parent a64dc820a4
commit 4684d5c4f8
2 changed files with 13 additions and 3 deletions

View File

@ -551,7 +551,7 @@ AudioDisplay::AudioDisplay(wxWindow *parent, AudioController *controller)
slots.push_back(controller->AddPlaybackPositionListener(&AudioDisplay::OnPlaybackPosition, this));
slots.push_back(controller->AddPlaybackStopListener(&AudioDisplay::RemoveTrackCursor, this));
slots.push_back(controller->AddTimingControllerListener(&AudioDisplay::Refresh, this, true, (const wxRect*)0));
slots.push_back(controller->AddMarkerMovedListener(&AudioDisplay::Refresh, this, true, (const wxRect*)0));
slots.push_back(controller->AddMarkerMovedListener(&AudioDisplay::OnMarkerMoved, this));
slots.push_back(controller->AddSelectionChangedListener(&AudioDisplay::OnSelectionChanged, this));
OPT_SUB("Audio/Spectrum", &AudioDisplay::ReloadRenderingSettings, this);
@ -783,8 +783,8 @@ void AudioDisplay::ReloadRenderingSettings()
BEGIN_EVENT_TABLE(AudioDisplay, wxWindow)
EVT_MOUSE_EVENTS(AudioDisplay::OnMouseEvent)
EVT_PAINT(AudioDisplay::OnPaint)
EVT_MOUSE_EVENTS(AudioDisplay::OnMouseEvent)
EVT_PAINT(AudioDisplay::OnPaint)
EVT_SIZE(AudioDisplay::OnSize)
EVT_SET_FOCUS(AudioDisplay::OnFocus)
EVT_KILL_FOCUS(AudioDisplay::OnFocus)
@ -1199,6 +1199,9 @@ void AudioDisplay::OnPlaybackPosition(int64_t sample_position)
void AudioDisplay::OnSelectionChanged()
{
/// @todo This is all currently completely pointless as the whole thing is
/// refreshed whenever a marker moves anyway
/// @todo Handle rendering style ranges from timing controller instead
SampleRange sel(controller->GetPrimaryPlaybackRange());
scrollbar->SetSelection(AbsoluteXFromSamples(sel.begin()), AbsoluteXFromSamples(sel.length()));
@ -1230,3 +1233,9 @@ void AudioDisplay::OnSelectionChanged()
old_selection = sel;
}
void AudioDisplay::OnMarkerMoved()
{
/// @todo investigate if it's worth refreshing only the changed spots
RefreshRect(wxRect(0, audio_top, GetClientSize().GetWidth(), audio_height));
}

View File

@ -203,6 +203,7 @@ private:
virtual void OnAudioOpen(AudioProvider *provider);
virtual void OnPlaybackPosition(int64_t sample_position);
virtual void OnSelectionChanged();
void OnMarkerMoved();
public: