1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-31 16:09:28 +02:00

Eliminate GetActiveProject from MixerBoard, Snap, Meter

This commit is contained in:
Paul Licameli 2020-01-06 14:04:10 -05:00
parent 0c2c6c5da3
commit 32d2d2390f
3 changed files with 8 additions and 9 deletions

View File

@ -303,7 +303,7 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
mMeter.Release(); mMeter.Release();
if (GetWave()) { if (GetWave()) {
mMeter = mMeter =
safenew MeterPanel(GetActiveProject(), // AudacityProject* project, safenew MeterPanel(mProject, // AudacityProject* project,
this, -1, // wxWindow* parent, wxWindowID id, this, -1, // wxWindow* parent, wxWindowID id,
false, // bool isInput false, // bool isInput
ctrlPos, ctrlSize, // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, ctrlPos, ctrlSize, // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
@ -1462,7 +1462,7 @@ void MixerBoardFrame::OnSize(wxSizeEvent & WXUNUSED(event))
void MixerBoardFrame::OnKeyEvent(wxKeyEvent & event) void MixerBoardFrame::OnKeyEvent(wxKeyEvent & event)
{ {
AudacityProject *project = GetActiveProject(); AudacityProject *project = mMixerBoard->mProject;
auto &commandManager = CommandManager::Get( *project ); auto &commandManager = CommandManager::Get( *project );
commandManager.FilterKeyEvent(project, event, true); commandManager.FilterKeyEvent(project, event, true);
} }

View File

@ -54,7 +54,7 @@ SnapManager::SnapManager(const TrackList *tracks,
mPixelTolerance = pixelTolerance; mPixelTolerance = pixelTolerance;
mNoTimeSnap = noTimeSnap; mNoTimeSnap = noTimeSnap;
mProject = GetActiveProject(); mProject = tracks->GetOwner();
wxASSERT(mProject); wxASSERT(mProject);
mSnapTo = 0; mSnapTo = 0;
@ -333,7 +333,7 @@ SnapResults SnapManager::Snap
// Find where it would snap time to the grid // Find where it would snap time to the grid
mConverter.ValueToControls( mConverter.ValueToControls(
t, t,
ProjectSettings::Get( *GetActiveProject() ).GetSnapTo() == SNAP_NEAREST ProjectSettings::Get( *mProject ).GetSnapTo() == SNAP_NEAREST
); );
mConverter.ControlsToValue(); mConverter.ControlsToValue();
results.timeSnappedTime = mConverter.GetValue(); results.timeSnappedTime = mConverter.GetValue();

View File

@ -758,14 +758,14 @@ void MeterPanel::OnMouse(wxMouseEvent &evt)
#if wxUSE_TOOLTIPS // Not available in wxX11 #if wxUSE_TOOLTIPS // Not available in wxX11
if (evt.Leaving()){ if (evt.Leaving()){
ProjectStatus::Get( *GetActiveProject() ).Set({}); ProjectStatus::Get( *mProject ).Set({});
} }
else if (evt.Entering()) { else if (evt.Entering()) {
// Display the tooltip in the status bar // Display the tooltip in the status bar
wxToolTip * pTip = this->GetToolTip(); wxToolTip * pTip = this->GetToolTip();
if( pTip ) { if( pTip ) {
auto tipText = Verbatim( pTip->GetTip() ); auto tipText = Verbatim( pTip->GetTip() );
ProjectStatus::Get( *GetActiveProject() ).Set(tipText); ProjectStatus::Get( *mProject ).Set(tipText);
} }
} }
#endif #endif
@ -1875,7 +1875,7 @@ void MeterPanel::StartMonitoring()
} }
if (start && !gAudioIO->IsBusy()){ if (start && !gAudioIO->IsBusy()){
AudacityProject *p = GetActiveProject(); AudacityProject *p = mProject;
if (p){ if (p){
gAudioIO->StartMonitoring( DefaultPlayOptions( *p ) ); gAudioIO->StartMonitoring( DefaultPlayOptions( *p ) );
} }
@ -1994,8 +1994,7 @@ void MeterPanel::OnPreferences(wxCommandEvent & WXUNUSED(event))
// Dialog is a child of the project, rather than of the toolbar. // Dialog is a child of the project, rather than of the toolbar.
// This determines where it pops up. // This determines where it pops up.
wxDialogWrapper dlg( FindProjectFrame( GetActiveProject() ), wxDialogWrapper dlg( FindProjectFrame( mProject ), wxID_ANY, title);
wxID_ANY, title );
dlg.SetName(); dlg.SetName();
ShuttleGui S(&dlg, eIsCreating); ShuttleGui S(&dlg, eIsCreating);
S.StartVerticalLay(); S.StartVerticalLay();