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