1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-14 17:14:07 +01:00

Move functions into new file TrackUtilities.cpp ...

... so that other files do not have link dependency on TrackMenus.cpp

The new project enlargest the big s.c.c. by 1, to 25
This commit is contained in:
Paul Licameli
2019-06-21 19:52:19 -04:00
parent 02e620d35f
commit d2f386a329
9 changed files with 318 additions and 280 deletions

View File

@@ -13,7 +13,6 @@ Paul Licameli split from TrackPanel.cpp
#include "PlayableTrackControls.h"
#include "../../../commands/CommandManager.h"
#include "../../../Menus.h"
#include "../../../Project.h"
#include "../../../ProjectSettings.h"
#include "../../../RefreshCode.h"
@@ -21,6 +20,7 @@ Paul Licameli split from TrackPanel.cpp
#include "../../../TrackInfo.h"
#include "../../../TrackPanel.h"
#include "../../../TrackPanelMouseEvent.h"
#include "../../../TrackUtilities.h"
MuteButtonHandle::MuteButtonHandle
( const std::shared_ptr<Track> &pTrack, const wxRect &rect )
@@ -36,7 +36,7 @@ UIHandle::Result MuteButtonHandle::CommitChanges
{
auto pTrack = mpTrack.lock();
if ( dynamic_cast< PlayableTrack* >( pTrack.get() ) )
TrackActions::DoTrackMute(*pProject, pTrack.get(), event.ShiftDown());
TrackUtilities::DoTrackMute(*pProject, pTrack.get(), event.ShiftDown());
return RefreshCode::RefreshNone;
}
@@ -92,7 +92,7 @@ UIHandle::Result SoloButtonHandle::CommitChanges
{
auto pTrack = mpTrack.lock();
if ( dynamic_cast< PlayableTrack* >( pTrack.get() ) )
TrackActions::DoTrackSolo(*pProject, pTrack.get(), event.ShiftDown());
TrackUtilities::DoTrackSolo(*pProject, pTrack.get(), event.ShiftDown());
return RefreshCode::RefreshNone;
}

View File

@@ -13,11 +13,11 @@ Paul Licameli split from TrackControls.cpp
#include "TrackButtonHandles.h"
#include "TrackSelectHandle.h"
#include "../../RefreshCode.h"
#include "../../Menus.h"
#include "../../Project.h"
#include "../../ProjectHistory.h"
#include "../../TrackInfo.h"
#include "../../TrackPanelMouseEvent.h"
#include "../../TrackUtilities.h"
#include <wx/textdlg.h>
#include "../../commands/CommandType.h"
#include "../../commands/CommandManager.h"
@@ -220,21 +220,21 @@ void TrackMenuTable::OnSetName(wxCommandEvent &)
void TrackMenuTable::OnMoveTrack(wxCommandEvent &event)
{
AudacityProject *const project = GetActiveProject();
TrackActions::MoveChoice choice;
TrackUtilities::MoveChoice choice;
switch (event.GetId()) {
default:
wxASSERT(false);
case OnMoveUpID:
choice = TrackActions::OnMoveUpID; break;
choice = TrackUtilities::OnMoveUpID; break;
case OnMoveDownID:
choice = TrackActions::OnMoveDownID; break;
choice = TrackUtilities::OnMoveDownID; break;
case OnMoveTopID:
choice = TrackActions::OnMoveTopID; break;
choice = TrackUtilities::OnMoveTopID; break;
case OnMoveBottomID:
choice = TrackActions::OnMoveBottomID; break;
choice = TrackUtilities::OnMoveBottomID; break;
}
TrackActions::DoMoveTrack(*project, mpData->pTrack, choice);
TrackUtilities::DoMoveTrack(*project, mpData->pTrack, choice);
// MoveTrack already refreshed TrackPanel, which means repaint will happen.
// This is a harmless redundancy:

View File

@@ -20,6 +20,7 @@ Paul Licameli split from TrackPanel.cpp
#include "../../Track.h"
#include "../../TrackInfo.h"
#include "../../TrackPanel.h"
#include "../../TrackUtilities.h"
#include "../../commands/CommandManager.h"
#include "../../tracks/ui/TrackView.h"
@@ -156,7 +157,7 @@ UIHandle::Result CloseButtonHandle::CommitChanges
TransportActions::StopIfPaused( *pProject );
if (!ProjectAudioIO::Get( *pProject ).IsAudioActive()) {
// This pushes an undo item:
TrackActions::DoRemoveTrack(*pProject, pTrack.get());
TrackUtilities::DoRemoveTrack(*pProject, pTrack.get());
// Redraw all tracks when any one of them closes
// (Could we invent a return code that draws only those at or below
// the affected track?)