1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-05 06:09:47 +02:00

More scrub phase 2 improvements...

Context menu for scrub head shows checkmarks, and is available during scrub
  Enable scrubbing only when the scrub bar shows
This commit is contained in:
Paul Licameli 2016-04-27 20:57:24 -04:00
commit 1b4d198b69
2 changed files with 30 additions and 16 deletions

View File

@ -763,9 +763,20 @@ void Scrubber::PopulateMenu(wxMenu &menu)
{
int id = CMD_ID;
auto cm = mProject->GetCommandManager();
const MenuItem *checkedItem =
HasStartedScrubbing()
? &FindMenuItem(mSmoothScrollingScrub, mAlwaysSeeking)
: nullptr;
for (const auto &item : menuItems) {
if (cm->GetEnabled(item.name))
if (cm->GetEnabled(item.name)) {
#ifdef CHECKABLE_SCRUB_MENU_ITEMS
menu.AppendCheckItem(id, item.label);
if(&item == checkedItem)
menu.FindItem(id)->Check();
#else
menu.Append(id, item.label);
#endif
}
++id;
}
}

View File

@ -2115,7 +2115,8 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
const bool inScrubZone =
// only if scrubbing is allowed now
mProject->GetScrubber().CanScrub() &&
evt.m_y < IndicatorBigHeight();
mShowScrubbing &&
mScrubZone.Contains(evt.GetPosition());
const bool changeInScrubZone = (inScrubZone != mPrevInScrubZone);
mPrevInScrubZone = inScrubZone;
@ -2156,6 +2157,21 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
return;
}
// Handle popup menus
if (evt.RightDown() && !(evt.LeftIsDown())) {
if(inScrubZone)
ShowScrubMenu(evt.GetPosition());
else
ShowMenu(evt.GetPosition());
// dismiss and clear Quick-Play indicator
HideQuickPlayIndicator();
if (HasCapture())
ReleaseMouse();
return;
}
if (scrubber.HasStartedScrubbing()) {
// If already clicked for scrub, preempt the usual event handling,
// no matter what the y coordinate.
@ -2216,20 +2232,7 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
return;
}
if (evt.RightDown() && !(evt.LeftIsDown())) {
if(inScrubZone)
ShowScrubMenu(evt.GetPosition());
else
ShowMenu(evt.GetPosition());
// dismiss and clear Quick-Play indicator
HideQuickPlayIndicator();
if (HasCapture())
ReleaseMouse();
return;
}
else if (inScrubZone) {
if (inScrubZone) {
if (evt.LeftDown())
scrubber.MarkScrubStart(evt.m_x, false, false);
UpdateStatusBar(StatusChoice::EnteringScrubZone);