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:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user