mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-23 16:08:07 +02:00
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 "ProjectStatus.h"
|
||||||
#include "TimeTrack.h"
|
#include "TimeTrack.h"
|
||||||
#include "TrackPanel.h"
|
#include "TrackPanel.h"
|
||||||
#include "UndoManager.h"
|
|
||||||
#include "ViewInfo.h"
|
#include "ViewInfo.h"
|
||||||
#include "WaveTrack.h"
|
#include "WaveTrack.h"
|
||||||
#include "toolbars/ControlToolBar.h"
|
|
||||||
#include "toolbars/ToolManager.h"
|
#include "toolbars/ToolManager.h"
|
||||||
#include "prefs/TracksPrefs.h"
|
#include "prefs/TracksPrefs.h"
|
||||||
#include "tracks/ui/Scrubbing.h"
|
#include "tracks/ui/Scrubbing.h"
|
||||||
@ -1018,14 +1016,9 @@ void ProjectAudioManager::StopIfPaused()
|
|||||||
|
|
||||||
#include "widgets/AudacityMessageBox.h"
|
#include "widgets/AudacityMessageBox.h"
|
||||||
|
|
||||||
namespace TransportActions {
|
bool ProjectAudioManager::DoPlayStopSelect( bool click, bool shift )
|
||||||
|
|
||||||
// exported helper functions
|
|
||||||
|
|
||||||
bool DoPlayStopSelect
|
|
||||||
(AudacityProject &project, bool click, bool shift)
|
|
||||||
{
|
{
|
||||||
auto &toolbar = ControlToolBar::Get( project );
|
auto &project = mProject;
|
||||||
auto &scrubber = Scrubber::Get( project );
|
auto &scrubber = Scrubber::Get( project );
|
||||||
auto token = ProjectAudioIO::Get( project ).GetAudioIOToken();
|
auto token = ProjectAudioIO::Get( project ).GetAudioIOToken();
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
@ -1035,8 +1028,6 @@ bool DoPlayStopSelect
|
|||||||
//If busy, stop playing, make sure everything is unpaused.
|
//If busy, stop playing, make sure everything is unpaused.
|
||||||
if (scrubber.HasMark() ||
|
if (scrubber.HasMark() ||
|
||||||
gAudioIO->IsStreamActive(token)) {
|
gAudioIO->IsStreamActive(token)) {
|
||||||
toolbar.SetStop(); //Pushes stop down
|
|
||||||
|
|
||||||
// change the selection
|
// change the selection
|
||||||
auto time = gAudioIO->GetStreamTime();
|
auto time = gAudioIO->GetStreamTime();
|
||||||
// Test WasSpeedPlaying(), not IsSpeedPlaying()
|
// Test WasSpeedPlaying(), not IsSpeedPlaying()
|
||||||
@ -1081,22 +1072,19 @@ bool DoPlayStopSelect
|
|||||||
|
|
||||||
// The code for "OnPlayStopSelect" is simply the code of "OnPlayStop" and
|
// The code for "OnPlayStopSelect" is simply the code of "OnPlayStop" and
|
||||||
// "OnStopSelect" merged.
|
// "OnStopSelect" merged.
|
||||||
void DoPlayStopSelect(AudacityProject &project)
|
void ProjectAudioManager::DoPlayStopSelect()
|
||||||
{
|
{
|
||||||
auto &projectAudioManager = ProjectAudioManager::Get( project );
|
|
||||||
auto gAudioIO = AudioIO::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
if (DoPlayStopSelect(project, false, false))
|
if (DoPlayStopSelect(false, false))
|
||||||
projectAudioManager.Stop();
|
Stop();
|
||||||
else if (!gAudioIO->IsBusy()) {
|
else if (!gAudioIO->IsBusy()) {
|
||||||
//Otherwise, start playing (assuming audio I/O isn't busy)
|
//Otherwise, start playing (assuming audio I/O isn't busy)
|
||||||
|
|
||||||
// Will automatically set mLastPlayMode
|
// Will automatically set mLastPlayMode
|
||||||
projectAudioManager.PlayCurrentRegion(false);
|
PlayCurrentRegion(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "CommonCommandFlags.h"
|
#include "CommonCommandFlags.h"
|
||||||
|
|
||||||
static RegisteredMenuItemEnabler stopIfPaused{{
|
static RegisteredMenuItemEnabler stopIfPaused{{
|
||||||
|
@ -110,6 +110,9 @@ public:
|
|||||||
|
|
||||||
void StopIfPaused();
|
void StopIfPaused();
|
||||||
|
|
||||||
|
bool DoPlayStopSelect( bool click, bool shift );
|
||||||
|
void DoPlayStopSelect( );
|
||||||
|
|
||||||
PlayMode GetLastPlayMode() const { return mLastPlayMode; }
|
PlayMode GetLastPlayMode() const { return mLastPlayMode; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -163,10 +166,4 @@ AudioIOStartStreamOptions DefaultSpeedPlayOptions( AudacityProject &project );
|
|||||||
extern const ReservedCommandFlag
|
extern const ReservedCommandFlag
|
||||||
CanStopAudioStreamFlag;
|
CanStopAudioStreamFlag;
|
||||||
|
|
||||||
/// Namespace for functions for Transport menu
|
|
||||||
namespace TransportActions {
|
|
||||||
bool DoPlayStopSelect( AudacityProject &project, bool click, bool shift );
|
|
||||||
void DoPlayStopSelect( AudacityProject &project );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -207,7 +207,7 @@ void OnPlayStop(const CommandContext &context)
|
|||||||
|
|
||||||
void OnPlayStopSelect(const CommandContext &context)
|
void OnPlayStopSelect(const CommandContext &context)
|
||||||
{
|
{
|
||||||
DoPlayStopSelect( context.project );
|
ProjectAudioManager::Get( context.project ).DoPlayStopSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlayLooped(const CommandContext &context)
|
void OnPlayLooped(const CommandContext &context)
|
||||||
|
@ -661,8 +661,9 @@ 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();
|
||||||
TransportActions::DoPlayStopSelect(*mProject, true, bShift);
|
auto &projectAudioManager = ProjectAudioManager::Get( *mProject );
|
||||||
ProjectAudioManager::Get( *mProject ).Stop();
|
projectAudioManager.DoPlayStopSelect( true, bShift );
|
||||||
|
projectAudioManager.Stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -724,7 +725,8 @@ 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();
|
||||||
TransportActions::DoPlayStopSelect(*mProject, true, bShift);
|
auto &projectAudioManager = ProjectAudioManager::Get( *mProject );
|
||||||
|
projectAudioManager.DoPlayStopSelect(true, bShift);
|
||||||
}
|
}
|
||||||
|
|
||||||
mScrubStartPosition = -1;
|
mScrubStartPosition = -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user