mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-23 15:50:05 +02:00
Scrub play button becomes a stop button when pressed...
... also the corresponding menu command can stop as well as start the scrub or seek
This commit is contained in:
parent
fd9d6a8fcf
commit
d1fe0a89b5
@ -427,8 +427,8 @@ void ScrubbingToolBar::Populate()
|
|||||||
MakeButtonBackgroundsSmall();
|
MakeButtonBackgroundsSmall();
|
||||||
|
|
||||||
/* Buttons */
|
/* Buttons */
|
||||||
AddButton(bmpPlay, bmpPlay, bmpPlayDisabled, STBStartID,
|
AddButton(bmpPlay, bmpStop, bmpPlayDisabled, STBStartID,
|
||||||
_("Start scrubbing"), false);
|
_("Start scrubbing"), true);
|
||||||
AddButton(bmpScrub, bmpScrub, bmpScrubDisabled, STBScrubID,
|
AddButton(bmpScrub, bmpScrub, bmpScrubDisabled, STBScrubID,
|
||||||
_("Scrub"), true);
|
_("Scrub"), true);
|
||||||
AddButton(bmpSeek, bmpSeek, bmpSeekDisabled, STBSeekID,
|
AddButton(bmpSeek, bmpSeek, bmpSeekDisabled, STBSeekID,
|
||||||
@ -456,7 +456,23 @@ void ScrubbingToolBar::RegenerateTooltips()
|
|||||||
"Scrubbing" is variable-speed playback, ...
|
"Scrubbing" is variable-speed playback, ...
|
||||||
"Seeking" is normal speed playback but with skips
|
"Seeking" is normal speed playback but with skips
|
||||||
*/
|
*/
|
||||||
mButtons[STBStartID]->SetToolTip(_("Start scrubbing or seeking"));
|
auto project = GetActiveProject();
|
||||||
|
if (project) {
|
||||||
|
auto startStop = mButtons[STBStartID];
|
||||||
|
auto &scrubber = project->GetScrubber();
|
||||||
|
if(scrubber.HasStartedScrubbing() || scrubber.IsScrubbing()) {
|
||||||
|
if (scrubber.Seeks())
|
||||||
|
startStop->SetToolTip(_("Stop seeking"));
|
||||||
|
else
|
||||||
|
startStop->SetToolTip(_("Stop scrubbing"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (scrubber.Seeks())
|
||||||
|
startStop->SetToolTip(_("Start seeking"));
|
||||||
|
else
|
||||||
|
startStop->SetToolTip(_("Start scrubbing"));
|
||||||
|
}
|
||||||
|
}
|
||||||
mButtons[STBScrubID]->SetToolTip(_("Scrub"));
|
mButtons[STBScrubID]->SetToolTip(_("Scrub"));
|
||||||
mButtons[STBSeekID]->SetToolTip(_("Seek"));
|
mButtons[STBSeekID]->SetToolTip(_("Seek"));
|
||||||
#endif
|
#endif
|
||||||
@ -472,8 +488,7 @@ void ScrubbingToolBar::OnButton(wxCommandEvent &event)
|
|||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case STBStartID:
|
case STBStartID:
|
||||||
mButtons[STBStartID]->PopUp();
|
scrubber.OnStartStop(event);
|
||||||
scrubber.OnStart(event);
|
|
||||||
break;
|
break;
|
||||||
case STBScrubID:
|
case STBScrubID:
|
||||||
scrubber.OnScrub(event);
|
scrubber.OnScrub(event);
|
||||||
|
@ -136,6 +136,8 @@ public:
|
|||||||
void EnableDisableButtons();
|
void EnableDisableButtons();
|
||||||
void UpdatePrefs();
|
void UpdatePrefs();
|
||||||
|
|
||||||
|
void RegenerateTooltips();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
AButton *AddButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
AButton *AddButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
||||||
@ -143,8 +145,6 @@ private:
|
|||||||
|
|
||||||
void MakeButtons();
|
void MakeButtons();
|
||||||
|
|
||||||
void RegenerateTooltips();
|
|
||||||
|
|
||||||
AButton *mButtons[STBNumButtons];
|
AButton *mButtons[STBNumButtons];
|
||||||
|
|
||||||
wxImage *upImage;
|
wxImage *upImage;
|
||||||
|
@ -232,8 +232,8 @@ namespace {
|
|||||||
{ wxT("Seek"), XO("See&k"), XO("Seeking"),
|
{ wxT("Seek"), XO("See&k"), XO("Seeking"),
|
||||||
&Scrubber::OnSeek, true, &Scrubber::Seeks },
|
&Scrubber::OnSeek, true, &Scrubber::Seeks },
|
||||||
|
|
||||||
{ wxT("StartScrubSeek"), XO("Star&t"), XO(""),
|
{ wxT("StartStopScrubSeek"), XO("Star&t/Stop"), XO(""),
|
||||||
&Scrubber::OnStart, true, nullptr },
|
&Scrubber::OnStartStop, true, nullptr },
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { nMenuItems = sizeof(menuItems) / sizeof(*menuItems), StartMenuItem = 2 };
|
enum { nMenuItems = sizeof(menuItems) / sizeof(*menuItems), StartMenuItem = 2 };
|
||||||
@ -765,7 +765,7 @@ Scrubber &ScrubbingOverlay::GetScrubber()
|
|||||||
|
|
||||||
void Scrubber::DoScrub()
|
void Scrubber::DoScrub()
|
||||||
{
|
{
|
||||||
const bool wasScrubbing = IsScrubbing();
|
const bool wasScrubbing = HasStartedScrubbing() || IsScrubbing();
|
||||||
const bool scroll = PlaybackPrefs::GetPinnedHeadPreference();
|
const bool scroll = PlaybackPrefs::GetPinnedHeadPreference();
|
||||||
if (!wasScrubbing) {
|
if (!wasScrubbing) {
|
||||||
auto tp = mProject->GetTrackPanel();
|
auto tp = mProject->GetTrackPanel();
|
||||||
@ -779,6 +779,8 @@ void Scrubber::DoScrub()
|
|||||||
|
|
||||||
MarkScrubStart(xx, scroll);
|
MarkScrubStart(xx, scroll);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
mProject->GetControlToolBar()->StopPlaying();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrubber::OnScrubOrSeek(bool &toToggle, bool &other)
|
void Scrubber::OnScrubOrSeek(bool &toToggle, bool &other)
|
||||||
@ -800,6 +802,7 @@ void Scrubber::OnScrubOrSeek(bool &toToggle, bool &other)
|
|||||||
|
|
||||||
auto scrubbingToolBar = mProject->GetScrubbingToolBar();
|
auto scrubbingToolBar = mProject->GetScrubbingToolBar();
|
||||||
scrubbingToolBar->EnableDisableButtons();
|
scrubbingToolBar->EnableDisableButtons();
|
||||||
|
scrubbingToolBar->RegenerateTooltips();
|
||||||
|
|
||||||
CheckMenuItem();
|
CheckMenuItem();
|
||||||
}
|
}
|
||||||
@ -814,7 +817,7 @@ void Scrubber::OnSeek(wxCommandEvent&)
|
|||||||
OnScrubOrSeek(mSeeking, mScrubbing);
|
OnScrubOrSeek(mSeeking, mScrubbing);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrubber::OnStart(wxCommandEvent&)
|
void Scrubber::OnStartStop(wxCommandEvent&)
|
||||||
{
|
{
|
||||||
DoScrub();
|
DoScrub();
|
||||||
}
|
}
|
||||||
@ -824,7 +827,7 @@ enum { CMD_ID = 8000 };
|
|||||||
BEGIN_EVENT_TABLE(Scrubber, wxEvtHandler)
|
BEGIN_EVENT_TABLE(Scrubber, wxEvtHandler)
|
||||||
EVT_MENU(CMD_ID, Scrubber::OnScrub)
|
EVT_MENU(CMD_ID, Scrubber::OnScrub)
|
||||||
EVT_MENU(CMD_ID + 1, Scrubber::OnSeek)
|
EVT_MENU(CMD_ID + 1, Scrubber::OnSeek)
|
||||||
EVT_MENU(CMD_ID + 2, Scrubber::OnStart)
|
EVT_MENU(CMD_ID + 2, Scrubber::OnStartStop)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(Scrubber::Forwarder, wxEvtHandler)
|
BEGIN_EVENT_TABLE(Scrubber::Forwarder, wxEvtHandler)
|
||||||
|
@ -123,7 +123,7 @@ public:
|
|||||||
void OnScrubOrSeek(bool &toToggle, bool &other);
|
void OnScrubOrSeek(bool &toToggle, bool &other);
|
||||||
void OnScrub(wxCommandEvent&);
|
void OnScrub(wxCommandEvent&);
|
||||||
void OnSeek(wxCommandEvent&);
|
void OnSeek(wxCommandEvent&);
|
||||||
void OnStart(wxCommandEvent&);
|
void OnStartStop(wxCommandEvent&);
|
||||||
|
|
||||||
// A string to put in the leftmost part of the status bar
|
// A string to put in the leftmost part of the status bar
|
||||||
// when scrub or seek is in progress, or else empty.
|
// when scrub or seek is in progress, or else empty.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user