DoPlayStopSelect into ProjectAudioManager; remove button push-down...
... which was redundant with what happens in the yield to idle events in ProjectAudioManager::Stop. This removes direct dependency of ProjectAudioManager on ControlToolBar. And remove another #include we don't need
This commit is contained in:
parent
ca8740b510
commit
b6cd9a2b36
|
@ -30,10 +30,8 @@ Paul Licameli split from ProjectManager.cpp
|
|||
#include "ProjectStatus.h"
|
||||
#include "TimeTrack.h"
|
||||
#include "TrackPanel.h"
|
||||
#include "UndoManager.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "WaveTrack.h"
|
||||
#include "toolbars/ControlToolBar.h"
|
||||
#include "toolbars/ToolManager.h"
|
||||
#include "prefs/TracksPrefs.h"
|
||||
#include "tracks/ui/Scrubbing.h"
|
||||
|
@ -1018,14 +1016,9 @@ void ProjectAudioManager::StopIfPaused()
|
|||
|
||||
#include "widgets/AudacityMessageBox.h"
|
||||
|
||||
namespace TransportActions {
|
||||
|
||||
// exported helper functions
|
||||
|
||||
bool DoPlayStopSelect
|
||||
(AudacityProject &project, bool click, bool shift)
|
||||
bool ProjectAudioManager::DoPlayStopSelect( bool click, bool shift )
|
||||
{
|
||||
auto &toolbar = ControlToolBar::Get( project );
|
||||
auto &project = mProject;
|
||||
auto &scrubber = Scrubber::Get( project );
|
||||
auto token = ProjectAudioIO::Get( project ).GetAudioIOToken();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
@ -1035,8 +1028,6 @@ bool DoPlayStopSelect
|
|||
//If busy, stop playing, make sure everything is unpaused.
|
||||
if (scrubber.HasMark() ||
|
||||
gAudioIO->IsStreamActive(token)) {
|
||||
toolbar.SetStop(); //Pushes stop down
|
||||
|
||||
// change the selection
|
||||
auto time = gAudioIO->GetStreamTime();
|
||||
// Test WasSpeedPlaying(), not IsSpeedPlaying()
|
||||
|
@ -1081,22 +1072,19 @@ bool DoPlayStopSelect
|
|||
|
||||
// The code for "OnPlayStopSelect" is simply the code of "OnPlayStop" and
|
||||
// "OnStopSelect" merged.
|
||||
void DoPlayStopSelect(AudacityProject &project)
|
||||
void ProjectAudioManager::DoPlayStopSelect()
|
||||
{
|
||||
auto &projectAudioManager = ProjectAudioManager::Get( project );
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (DoPlayStopSelect(project, false, false))
|
||||
projectAudioManager.Stop();
|
||||
if (DoPlayStopSelect(false, false))
|
||||
Stop();
|
||||
else if (!gAudioIO->IsBusy()) {
|
||||
//Otherwise, start playing (assuming audio I/O isn't busy)
|
||||
|
||||
// Will automatically set mLastPlayMode
|
||||
projectAudioManager.PlayCurrentRegion(false);
|
||||
PlayCurrentRegion(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "CommonCommandFlags.h"
|
||||
|
||||
static RegisteredMenuItemEnabler stopIfPaused{{
|
||||
|
|
|
@ -110,6 +110,9 @@ public:
|
|||
|
||||
void StopIfPaused();
|
||||
|
||||
bool DoPlayStopSelect( bool click, bool shift );
|
||||
void DoPlayStopSelect( );
|
||||
|
||||
PlayMode GetLastPlayMode() const { return mLastPlayMode; }
|
||||
|
||||
private:
|
||||
|
@ -163,10 +166,4 @@ AudioIOStartStreamOptions DefaultSpeedPlayOptions( AudacityProject &project );
|
|||
extern const ReservedCommandFlag
|
||||
CanStopAudioStreamFlag;
|
||||
|
||||
/// Namespace for functions for Transport menu
|
||||
namespace TransportActions {
|
||||
bool DoPlayStopSelect( AudacityProject &project, bool click, bool shift );
|
||||
void DoPlayStopSelect( AudacityProject &project );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -207,7 +207,7 @@ void OnPlayStop(const CommandContext &context)
|
|||
|
||||
void OnPlayStopSelect(const CommandContext &context)
|
||||
{
|
||||
DoPlayStopSelect( context.project );
|
||||
ProjectAudioManager::Get( context.project ).DoPlayStopSelect();
|
||||
}
|
||||
|
||||
void OnPlayLooped(const CommandContext &context)
|
||||
|
|
|
@ -661,8 +661,9 @@ void Scrubber::ContinueScrubbingUI()
|
|||
// Dragging scrub can stop with mouse up
|
||||
// Stop and set cursor
|
||||
bool bShift = state.ShiftDown();
|
||||
TransportActions::DoPlayStopSelect(*mProject, true, bShift);
|
||||
ProjectAudioManager::Get( *mProject ).Stop();
|
||||
auto &projectAudioManager = ProjectAudioManager::Get( *mProject );
|
||||
projectAudioManager.DoPlayStopSelect( true, bShift );
|
||||
projectAudioManager.Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -724,7 +725,8 @@ void Scrubber::StopScrubbing()
|
|||
const wxMouseState state(::wxGetMouseState());
|
||||
// Stop and set cursor
|
||||
bool bShift = state.ShiftDown();
|
||||
TransportActions::DoPlayStopSelect(*mProject, true, bShift);
|
||||
auto &projectAudioManager = ProjectAudioManager::Get( *mProject );
|
||||
projectAudioManager.DoPlayStopSelect(true, bShift);
|
||||
}
|
||||
|
||||
mScrubStartPosition = -1;
|
||||
|
|
Loading…
Reference in New Issue