1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-04 15:50:10 +01:00

Persist meter state across toolbar resets and fix clipping indicator

This will fix the clipping indicator turning on after a toolbar reset
and, as a bonus, the timers now only run if playing, capturing, or
monitoring.  Will (slightly) reduce the CPU consumption.
This commit is contained in:
lllucius
2015-01-01 23:29:08 +00:00
parent 2e6e110a34
commit bec5866653
4 changed files with 83 additions and 14 deletions

View File

@@ -81,6 +81,36 @@ void MeterToolBar::Create(wxWindow * parent)
OnSize(dummy);
}
void MeterToolBar::ReCreateButtons()
{
void *playState = NULL;
void *recordState = NULL;
if (mPlayMeter && mProject->GetPlaybackMeter() == mPlayMeter)
{
mProject->SetPlaybackMeter( NULL );
playState = mPlayMeter->SaveState();
}
if (mRecordMeter && mProject->GetCaptureMeter() == mRecordMeter)
{
mProject->SetCaptureMeter( NULL );
recordState = mRecordMeter->SaveState();
}
ToolBar::ReCreateButtons();
if (playState)
{
mPlayMeter->RestoreState(playState);
}
if (recordState)
{
mRecordMeter->RestoreState(recordState);
}
}
void MeterToolBar::Populate()
{
mSizer = new wxGridBagSizer();

View File

@@ -39,6 +39,7 @@ class MeterToolBar:public ToolBar {
void Create(wxWindow *parent);
virtual void Populate();
virtual void ReCreateButtons();
virtual void Repaint(wxDC * WXUNUSED(dc)) {};
virtual void EnableDisableButtons() {};
virtual void UpdatePrefs();