mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 08:38:39 +02:00
New alternative appearance for the transport toolbar play button, for scrubbing
This commit is contained in:
parent
1ef1c0620d
commit
01001fdea9
@ -67,6 +67,8 @@ from there. Audacity will look for a file called "Pause.png".
|
|||||||
DEFINE_IMAGE( bmpCutPreviewDisabled, wxImage( 16, 16 ), wxT("CutPreviewDisabled"));
|
DEFINE_IMAGE( bmpCutPreviewDisabled, wxImage( 16, 16 ), wxT("CutPreviewDisabled"));
|
||||||
DEFINE_IMAGE( bmpAppendRecord, wxImage( 16, 16 ), wxT("AppendRecord"));
|
DEFINE_IMAGE( bmpAppendRecord, wxImage( 16, 16 ), wxT("AppendRecord"));
|
||||||
DEFINE_IMAGE( bmpAppendRecordDisabled, wxImage( 16, 16 ), wxT("AppendRecordDisabled"));
|
DEFINE_IMAGE( bmpAppendRecordDisabled, wxImage( 16, 16 ), wxT("AppendRecordDisabled"));
|
||||||
|
DEFINE_IMAGE( bmpScrubDisabled, wxImage( 16, 16 ), wxT("ScrubDisabled"));
|
||||||
|
DEFINE_IMAGE( bmpScrub, wxImage( 16, 16 ), wxT("Scrub"));
|
||||||
|
|
||||||
SET_THEME_FLAGS( resFlagNewLine );
|
SET_THEME_FLAGS( resFlagNewLine );
|
||||||
DEFINE_IMAGE( bmpUpButtonLarge, wxImage( 48, 48 ), wxT("UpButtonLarge"));
|
DEFINE_IMAGE( bmpUpButtonLarge, wxImage( 48, 48 ), wxT("UpButtonLarge"));
|
||||||
|
@ -2071,7 +2071,11 @@ bool AudacityProject::MakeReadyToPlay(bool loop, bool cutpreview)
|
|||||||
if (gAudioIO->IsBusy())
|
if (gAudioIO->IsBusy())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
toolbar->SetPlay(true, loop, cutpreview);
|
ControlToolBar::PlayAppearance appearance =
|
||||||
|
cutpreview ? ControlToolBar::PlayAppearance::CutPreview
|
||||||
|
: loop ? ControlToolBar::PlayAppearance::Looped
|
||||||
|
: ControlToolBar::PlayAppearance::Straight;
|
||||||
|
toolbar->SetPlay(true, appearance);
|
||||||
toolbar->SetStop(false);
|
toolbar->SetStop(false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -166,6 +166,8 @@ void ControlToolBar::Populate()
|
|||||||
MakeAlternateImages(*mPlay, 1, bmpLoop, bmpLoop, bmpLoopDisabled);
|
MakeAlternateImages(*mPlay, 1, bmpLoop, bmpLoop, bmpLoopDisabled);
|
||||||
MakeAlternateImages(*mPlay, 2,
|
MakeAlternateImages(*mPlay, 2,
|
||||||
bmpCutPreview, bmpCutPreview, bmpCutPreviewDisabled);
|
bmpCutPreview, bmpCutPreview, bmpCutPreviewDisabled);
|
||||||
|
MakeAlternateImages(*mPlay, 3,
|
||||||
|
bmpScrub, bmpScrub, bmpScrubDisabled);
|
||||||
mPlay->FollowModifierKeys();
|
mPlay->FollowModifierKeys();
|
||||||
|
|
||||||
mStop = MakeButton( bmpStop, bmpStop, bmpStopDisabled ,
|
mStop = MakeButton( bmpStop, bmpStop, bmpStopDisabled ,
|
||||||
@ -361,7 +363,10 @@ void ControlToolBar::ReCreateButtons()
|
|||||||
|
|
||||||
if (playDown)
|
if (playDown)
|
||||||
{
|
{
|
||||||
SetPlay(playDown, playShift, false);
|
ControlToolBar::PlayAppearance appearance =
|
||||||
|
playShift ? ControlToolBar::PlayAppearance::Looped
|
||||||
|
: ControlToolBar::PlayAppearance::Straight;
|
||||||
|
SetPlay(playDown, appearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pauseDown)
|
if (pauseDown)
|
||||||
@ -432,12 +437,12 @@ void ControlToolBar::EnableDisableButtons()
|
|||||||
pProject->GetScrubber().HasStartedScrubbing()));
|
pProject->GetScrubber().HasStartedScrubbing()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlToolBar::SetPlay(bool down, bool looped, bool cutPreview)
|
void ControlToolBar::SetPlay(bool down, PlayAppearance appearance)
|
||||||
{
|
{
|
||||||
if (down) {
|
if (down) {
|
||||||
mPlay->SetShift(looped);
|
mPlay->SetShift(appearance == PlayAppearance::Looped);
|
||||||
mPlay->SetControl(cutPreview);
|
mPlay->SetControl(appearance == PlayAppearance::CutPreview);
|
||||||
mPlay->SetAlternateIdx(cutPreview ? 2 : looped ? 1 : 0);
|
mPlay->SetAlternateIdx(static_cast<int>(appearance));
|
||||||
mPlay->PushDown();
|
mPlay->PushDown();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -483,7 +488,7 @@ bool ControlToolBar::IsRecordDown()
|
|||||||
int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
|
int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
|
||||||
const AudioIOStartStreamOptions &options,
|
const AudioIOStartStreamOptions &options,
|
||||||
PlayMode mode,
|
PlayMode mode,
|
||||||
bool cutpreview, /* = false */
|
PlayAppearance appearance, /* = PlayOption::Straight */
|
||||||
bool backwards, /* = false */
|
bool backwards, /* = false */
|
||||||
bool playWhiteSpace /* = false */)
|
bool playWhiteSpace /* = false */)
|
||||||
{
|
{
|
||||||
@ -502,13 +507,14 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
|
|||||||
if (backwards)
|
if (backwards)
|
||||||
std::swap(t0, t1);
|
std::swap(t0, t1);
|
||||||
|
|
||||||
SetPlay(true, looped, cutpreview);
|
SetPlay(true, appearance);
|
||||||
|
|
||||||
if (gAudioIO->IsBusy()) {
|
if (gAudioIO->IsBusy()) {
|
||||||
SetPlay(false);
|
SetPlay(false);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool cutpreview = appearance == PlayAppearance::CutPreview;
|
||||||
if (cutpreview && t0==t1) {
|
if (cutpreview && t0==t1) {
|
||||||
SetPlay(false);
|
SetPlay(false);
|
||||||
return -1; /* msmeyer: makes no sense */
|
return -1; /* msmeyer: makes no sense */
|
||||||
@ -691,10 +697,14 @@ void ControlToolBar::PlayCurrentRegion(bool looped /* = false */,
|
|||||||
options.playLooped = looped;
|
options.playLooped = looped;
|
||||||
if (cutpreview)
|
if (cutpreview)
|
||||||
options.timeTrack = NULL;
|
options.timeTrack = NULL;
|
||||||
|
ControlToolBar::PlayAppearance appearance =
|
||||||
|
cutpreview ? ControlToolBar::PlayAppearance::CutPreview
|
||||||
|
: looped ? ControlToolBar::PlayAppearance::Looped
|
||||||
|
: ControlToolBar::PlayAppearance::Straight;
|
||||||
PlayPlayRegion(SelectedRegion(playRegionStart, playRegionEnd),
|
PlayPlayRegion(SelectedRegion(playRegionStart, playRegionEnd),
|
||||||
options,
|
options,
|
||||||
(looped ? PlayMode::loopedPlay : PlayMode::normalPlay),
|
(looped ? PlayMode::loopedPlay : PlayMode::normalPlay),
|
||||||
cutpreview);
|
appearance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,8 +60,13 @@ class ControlToolBar final : public ToolBar {
|
|||||||
void OnFF(wxCommandEvent & evt);
|
void OnFF(wxCommandEvent & evt);
|
||||||
void OnPause(wxCommandEvent & evt);
|
void OnPause(wxCommandEvent & evt);
|
||||||
|
|
||||||
|
// Choice among the appearances of the play button:
|
||||||
|
enum class PlayAppearance {
|
||||||
|
Straight, Looped, CutPreview, Scrub
|
||||||
|
};
|
||||||
|
|
||||||
//These allow buttons to be controlled externally:
|
//These allow buttons to be controlled externally:
|
||||||
void SetPlay(bool down, bool looped=false, bool cutPreview = false);
|
void SetPlay(bool down, PlayAppearance appearance = PlayAppearance::Straight);
|
||||||
void SetStop(bool down);
|
void SetStop(bool down);
|
||||||
void SetRecord(bool down, bool append=false);
|
void SetRecord(bool down, bool append=false);
|
||||||
|
|
||||||
@ -78,7 +83,8 @@ class ControlToolBar final : public ToolBar {
|
|||||||
int PlayPlayRegion(const SelectedRegion &selectedRegion,
|
int PlayPlayRegion(const SelectedRegion &selectedRegion,
|
||||||
const AudioIOStartStreamOptions &options,
|
const AudioIOStartStreamOptions &options,
|
||||||
PlayMode playMode,
|
PlayMode playMode,
|
||||||
bool cutpreview = false, bool backwards = false,
|
PlayAppearance appearance = PlayAppearance::Straight,
|
||||||
|
bool backwards = false,
|
||||||
// Allow t0 and t1 to be beyond end of tracks
|
// Allow t0 and t1 to be beyond end of tracks
|
||||||
bool playWhiteSpace = false);
|
bool playWhiteSpace = false);
|
||||||
void PlayDefault();
|
void PlayDefault();
|
||||||
|
@ -110,6 +110,8 @@ void SelectionBar::Create(wxWindow * parent)
|
|||||||
|
|
||||||
void SelectionBar::Populate()
|
void SelectionBar::Populate()
|
||||||
{
|
{
|
||||||
|
mLeftTime = mRightTime = mAudioTime = nullptr;
|
||||||
|
|
||||||
// This will be inherited by all children:
|
// This will be inherited by all children:
|
||||||
SetFont(wxFont(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
|
SetFont(wxFont(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
|
||||||
|
|
||||||
|
@ -459,11 +459,15 @@ void TranscriptionToolBar::PlayAtSpeed(bool looped, bool cutPreview)
|
|||||||
AudioIOStartStreamOptions options(p->GetDefaultPlayOptions());
|
AudioIOStartStreamOptions options(p->GetDefaultPlayOptions());
|
||||||
options.playLooped = looped;
|
options.playLooped = looped;
|
||||||
options.timeTrack = mTimeTrack.get();
|
options.timeTrack = mTimeTrack.get();
|
||||||
|
ControlToolBar::PlayAppearance appearance =
|
||||||
|
cutPreview ? ControlToolBar::PlayAppearance::CutPreview
|
||||||
|
: looped ? ControlToolBar::PlayAppearance::Looped
|
||||||
|
: ControlToolBar::PlayAppearance::Straight;
|
||||||
p->GetControlToolBar()->PlayPlayRegion
|
p->GetControlToolBar()->PlayPlayRegion
|
||||||
(SelectedRegion(playRegionStart, playRegionEnd),
|
(SelectedRegion(playRegionStart, playRegionEnd),
|
||||||
options,
|
options,
|
||||||
PlayMode::normalPlay,
|
PlayMode::normalPlay,
|
||||||
cutPreview);
|
appearance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,6 +211,8 @@ bool Scrubber::MaybeStartScrubbing(const wxMouseEvent &event)
|
|||||||
mMaxScrubSpeed = options.maxScrubSpeed = 1.0;
|
mMaxScrubSpeed = options.maxScrubSpeed = 1.0;
|
||||||
#endif
|
#endif
|
||||||
options.maxScrubTime = mProject->GetTracks()->GetEndTime();
|
options.maxScrubTime = mProject->GetTracks()->GetEndTime();
|
||||||
|
ControlToolBar::PlayAppearance appearance =
|
||||||
|
ControlToolBar::PlayAppearance::Scrub;
|
||||||
const bool cutPreview = false;
|
const bool cutPreview = false;
|
||||||
const bool backwards = time1 < time0;
|
const bool backwards = time1 < time0;
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
|
#ifdef EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
|
||||||
@ -223,7 +225,7 @@ bool Scrubber::MaybeStartScrubbing(const wxMouseEvent &event)
|
|||||||
mScrubSpeedDisplayCountdown = 0;
|
mScrubSpeedDisplayCountdown = 0;
|
||||||
mScrubToken =
|
mScrubToken =
|
||||||
ctb->PlayPlayRegion(SelectedRegion(time0, time1), options,
|
ctb->PlayPlayRegion(SelectedRegion(time0, time1), options,
|
||||||
PlayMode::normalPlay, cutPreview, backwards);
|
PlayMode::normalPlay, appearance, backwards);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2288,9 +2288,13 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
else
|
else
|
||||||
options.timeTrack = NULL;
|
options.timeTrack = NULL;
|
||||||
|
|
||||||
|
ControlToolBar::PlayAppearance appearance =
|
||||||
|
evt.ControlDown() ? ControlToolBar::PlayAppearance::CutPreview
|
||||||
|
: loopEnabled ? ControlToolBar::PlayAppearance::Looped
|
||||||
|
: ControlToolBar::PlayAppearance::Straight;
|
||||||
ctb->PlayPlayRegion((SelectedRegion(start, end)),
|
ctb->PlayPlayRegion((SelectedRegion(start, end)),
|
||||||
options, PlayMode::normalPlay,
|
options, PlayMode::normalPlay,
|
||||||
evt.ControlDown(),
|
appearance,
|
||||||
false,
|
false,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user