1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

Transport Menus

This commit is contained in:
Paul Licameli 2018-10-23 09:30:27 -04:00
parent c65fd0ebe1
commit 903b42f84a
7 changed files with 1261 additions and 1212 deletions

View File

@ -1688,7 +1688,7 @@ void AudacityApp::OnKeyDown(wxKeyEvent &event)
gAudioIO->GetNumCaptureChannels() == 0) || gAudioIO->GetNumCaptureChannels() == 0) ||
scrubbing) scrubbing)
// ESC out of other play (but not record) // ESC out of other play (but not record)
GetMenuCommandHandler(*project).OnStop(*project); TransportActions::DoStop(*project);
else else
event.Skip(); event.Skip();
} }

File diff suppressed because it is too large Load Diff

View File

@ -49,32 +49,6 @@ struct MenuCommandHandler final
MenuCommandHandler(); MenuCommandHandler();
~MenuCommandHandler(); ~MenuCommandHandler();
// Audio I/O Commands
void OnStop(const CommandContext &context );
void OnPause(const CommandContext &context );
void OnRecord(const CommandContext &context );
void OnRecord2ndChoice(const CommandContext &context );
void OnStopSelect(const CommandContext &context );
// Different posibilities for playing sound
bool MakeReadyToPlay(AudacityProject &project,
bool loop = false, bool cutpreview = false); // Helper function that sets button states etc.
void OnPlayStop(const CommandContext &context );
bool DoPlayStopSelect(AudacityProject &project, bool click, bool shift);
void OnPlayStopSelect(const CommandContext &context );
void OnPlayOneSecond(const CommandContext &context );
void OnPlayToSelection(const CommandContext &context );
void OnPlayBeforeSelectionStart(const CommandContext &context );
void OnPlayAfterSelectionStart(const CommandContext &context );
void OnPlayBeforeSelectionEnd(const CommandContext &context );
void OnPlayAfterSelectionEnd(const CommandContext &context );
void OnPlayBeforeAndAfterSelectionStart(const CommandContext &context );
void OnPlayBeforeAndAfterSelectionEnd(const CommandContext &context );
void OnPlayLooped(const CommandContext &context );
void OnPlayCutPreview(const CommandContext &context );
// Wave track control // Wave track control
void OnTrackPan(const CommandContext &context ); void OnTrackPan(const CommandContext &context );
@ -110,15 +84,6 @@ void OnOutputGainDec(const CommandContext &context );
void OnInputGainInc(const CommandContext &context ); void OnInputGainInc(const CommandContext &context );
void OnInputGainDec(const CommandContext &context ); void OnInputGainDec(const CommandContext &context );
// Transcription control
void OnPlayAtSpeed(const CommandContext &context );
void OnPlayAtSpeedLooped(const CommandContext &context );
void OnPlayAtSpeedCutPreview(const CommandContext &context );
void OnSetPlaySpeed(const CommandContext &context );
void OnPlaySpeedInc(const CommandContext &context );
void OnPlaySpeedDec(const CommandContext &context );
// Moving track focus commands // Moving track focus commands
void DoPrevTrack( AudacityProject &project, bool shift ); void DoPrevTrack( AudacityProject &project, bool shift );
@ -135,13 +100,6 @@ void OnShiftDown(const CommandContext &context );
void OnToggle(const CommandContext &context ); void OnToggle(const CommandContext &context );
void OnMoveToNextLabel(const CommandContext &context );
void OnMoveToPrevLabel(const CommandContext &context );
void DoMoveToLabel(AudacityProject &project, bool next);
void OnLockPlayRegion(const CommandContext &context );
void OnUnlockPlayRegion(const CommandContext &context );
void OnSortTime(const CommandContext &context ); void OnSortTime(const CommandContext &context );
void OnSortName(const CommandContext &context ); void OnSortName(const CommandContext &context );
@ -173,22 +131,6 @@ void OnUnmuteAllTracks(const CommandContext &context );
void OnPlotSpectrum(const CommandContext &context ); void OnPlotSpectrum(const CommandContext &context );
void OnContrast(const CommandContext &context ); void OnContrast(const CommandContext &context );
// Transport Menu
void OnSoundActivated(const CommandContext &context );
void OnToggleSoundActivated(const CommandContext &context );
void OnTogglePinnedHead(const CommandContext &context );
void OnTogglePlayRecording(const CommandContext &context );
void OnToggleSWPlaythrough(const CommandContext &context );
#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
void OnToggleAutomatedInputLevelAdjustment(const CommandContext &context );
#endif
void OnRescanDevices(const CommandContext &context );
#ifdef EXPERIMENTAL_PUNCH_AND_ROLL
void OnPunchAndRoll(const CommandContext &context);
#endif
// Import Submenu // Import Submenu
void OnMixAndRender(const CommandContext &context ); void OnMixAndRender(const CommandContext &context );
@ -209,7 +151,6 @@ void OnNewWaveTrack(const CommandContext &context );
void OnNewStereoTrack(const CommandContext &context ); void OnNewStereoTrack(const CommandContext &context );
void OnNewLabelTrack(const CommandContext &context ); void OnNewLabelTrack(const CommandContext &context );
void OnNewTimeTrack(const CommandContext &context ); void OnNewTimeTrack(const CommandContext &context );
void OnTimerRecord(const CommandContext &context );
void OnRemoveTracks(const CommandContext &context ); void OnRemoveTracks(const CommandContext &context );
void OnMoveSelectionWithTracks(const CommandContext &context ); void OnMoveSelectionWithTracks(const CommandContext &context );
void OnSyncLock(const CommandContext &context ); void OnSyncLock(const CommandContext &context );
@ -364,6 +305,17 @@ void DoZoomFit( AudacityProject &project );
void DoZoomFitV( AudacityProject &project ); void DoZoomFitV( AudacityProject &project );
} }
namespace TransportActions {
bool DoPlayStopSelect( AudacityProject &project, bool click, bool shift );
void DoPlayStopSelect( AudacityProject &project );
void DoStop( AudacityProject & );
void DoPause( AudacityProject & );
void DoLockPlayRegion( AudacityProject & );
void DoUnlockPlayRegion( AudacityProject & );
void DoTogglePinnedHead( AudacityProject & );
void DoRecord( AudacityProject & );
}
#endif #endif

View File

@ -528,7 +528,7 @@ int TimerRecordDialog::RunWaitDialog()
return POST_TIMER_RECORD_CANCEL_WAIT; return POST_TIMER_RECORD_CANCEL_WAIT;
} else { } else {
// Record for specified time. // Record for specified time.
GetMenuCommandHandler(*pProject).OnRecord(*pProject); TransportActions::DoRecord(*pProject);
bool bIsRecording = true; bool bIsRecording = true;
wxString sPostAction = m_pTimerAfterCompleteChoiceCtrl->GetString(m_pTimerAfterCompleteChoiceCtrl->GetSelection()); wxString sPostAction = m_pTimerAfterCompleteChoiceCtrl->GetString(m_pTimerAfterCompleteChoiceCtrl->GetSelection());
@ -580,7 +580,7 @@ int TimerRecordDialog::RunWaitDialog()
// Must do this AFTER the timer project dialog has been deleted to ensure the application // Must do this AFTER the timer project dialog has been deleted to ensure the application
// responds to the AUDIOIO events...see not about bug #334 in the ProgressDialog constructor. // responds to the AUDIOIO events...see not about bug #334 in the ProgressDialog constructor.
GetMenuCommandHandler(*pProject).OnStop(*pProject); TransportActions::DoStop(*pProject);
// Let the caller handle cancellation or failure from recording progress. // Let the caller handle cancellation or failure from recording progress.
if (updateResult == ProgressResult::Cancelled || updateResult == ProgressResult::Failed) if (updateResult == ProgressResult::Cancelled || updateResult == ProgressResult::Failed)

File diff suppressed because it is too large Load Diff

View File

@ -620,7 +620,7 @@ void Scrubber::ContinueScrubbingUI()
// Dragging scrub can stop with mouse up // Dragging scrub can stop with mouse up
// Stop and set cursor // Stop and set cursor
bool bShift = state.ShiftDown(); bool bShift = state.ShiftDown();
GetMenuCommandHandler(*mProject).DoPlayStopSelect(*mProject, true, bShift); TransportActions::DoPlayStopSelect(*mProject, true, bShift);
wxCommandEvent evt; wxCommandEvent evt;
mProject->GetControlToolBar()->OnStop(evt); mProject->GetControlToolBar()->OnStop(evt);
return; return;
@ -686,8 +686,7 @@ void Scrubber::StopScrubbing()
const wxMouseState state(::wxGetMouseState()); const wxMouseState state(::wxGetMouseState());
// Stop and set cursor // Stop and set cursor
bool bShift = state.ShiftDown(); bool bShift = state.ShiftDown();
GetMenuCommandHandler(*mProject). TransportActions::DoPlayStopSelect(*mProject, true, bShift);
DoPlayStopSelect(*mProject, true, bShift);
} }
mScrubStartPosition = -1; mScrubStartPosition = -1;

View File

@ -81,6 +81,7 @@ array of Ruler::Label.
#include "../AColor.h" #include "../AColor.h"
#include "../AudioIO.h" #include "../AudioIO.h"
#include "../Internat.h" #include "../Internat.h"
#include "../Menus.h"
#include "../Project.h" #include "../Project.h"
#include "../toolbars/ControlToolBar.h" #include "../toolbars/ControlToolBar.h"
#include "../Theme.h" #include "../Theme.h"
@ -89,7 +90,6 @@ array of Ruler::Label.
#include "../TimeTrack.h" #include "../TimeTrack.h"
#include "../TrackPanel.h" #include "../TrackPanel.h"
#include "../TrackPanelCellIterator.h" #include "../TrackPanelCellIterator.h"
#include "../Menus.h"
#include "../NumberScale.h" #include "../NumberScale.h"
#include "../Prefs.h" #include "../Prefs.h"
#include "../Snap.h" #include "../Snap.h"
@ -2895,7 +2895,7 @@ auto AdornedRulerPanel::QPHandle::Click
if(scrubber.HasMark()) { if(scrubber.HasMark()) {
// We can't stop scrubbing yet (see comments in Bug 1391), // We can't stop scrubbing yet (see comments in Bug 1391),
// but we can pause it. // but we can pause it.
GetMenuCommandHandler(*pProject).OnPause(*pProject); TransportActions::DoPause(*pProject);
} }
// Store the initial play region state // Store the initial play region state
@ -2919,7 +2919,7 @@ void AdornedRulerPanel::HandleQPClick(wxMouseEvent &evt, wxCoord mousePosX)
// Temporarily unlock locked play region // Temporarily unlock locked play region
if (mPlayRegionLock && evt.LeftDown()) { if (mPlayRegionLock && evt.LeftDown()) {
//mPlayRegionLock = true; //mPlayRegionLock = true;
GetMenuCommandHandler(*mProject).OnUnlockPlayRegion(*mProject); TransportActions::DoUnlockPlayRegion(*mProject);
} }
mLeftDownClickUnsnapped = mQuickPlayPosUnsnapped; mLeftDownClickUnsnapped = mQuickPlayPosUnsnapped;
@ -3170,7 +3170,7 @@ void AdornedRulerPanel::HandleQPRelease(wxMouseEvent &evt)
if (mPlayRegionLock) { if (mPlayRegionLock) {
// Restore Locked Play region // Restore Locked Play region
SetPlayRegion(mOldPlayRegionStart, mOldPlayRegionEnd); SetPlayRegion(mOldPlayRegionStart, mOldPlayRegionEnd);
GetMenuCommandHandler(*mProject).OnLockPlayRegion(*mProject); TransportActions::DoLockPlayRegion(*mProject);
// and release local lock // and release local lock
mPlayRegionLock = false; mPlayRegionLock = false;
} }
@ -3192,7 +3192,7 @@ auto AdornedRulerPanel::QPHandle::Cancel
mParent->mOldPlayRegionStart, mParent->mOldPlayRegionEnd); mParent->mOldPlayRegionStart, mParent->mOldPlayRegionEnd);
if (mParent->mPlayRegionLock) { if (mParent->mPlayRegionLock) {
// Restore Locked Play region // Restore Locked Play region
GetMenuCommandHandler(*pProject).OnLockPlayRegion(*pProject); TransportActions::DoLockPlayRegion(*pProject);
// and release local lock // and release local lock
mParent->mPlayRegionLock = false; mParent->mPlayRegionLock = false;
} }
@ -3328,7 +3328,7 @@ void AdornedRulerPanel::UpdateButtonStates()
void AdornedRulerPanel::OnTogglePinnedState(wxCommandEvent & /*event*/) void AdornedRulerPanel::OnTogglePinnedState(wxCommandEvent & /*event*/)
{ {
GetMenuCommandHandler(*mProject).OnTogglePinnedHead(*mProject); TransportActions::DoTogglePinnedHead(*mProject);
UpdateButtonStates(); UpdateButtonStates();
} }
@ -3466,9 +3466,9 @@ void AdornedRulerPanel::OnAutoScroll(wxCommandEvent&)
void AdornedRulerPanel::OnLockPlayRegion(wxCommandEvent&) void AdornedRulerPanel::OnLockPlayRegion(wxCommandEvent&)
{ {
if (mProject->IsPlayRegionLocked()) if (mProject->IsPlayRegionLocked())
GetMenuCommandHandler(*mProject).OnUnlockPlayRegion(*mProject); TransportActions::DoUnlockPlayRegion(*mProject);
else else
GetMenuCommandHandler(*mProject).OnLockPlayRegion(*mProject); TransportActions::DoLockPlayRegion(*mProject);
} }