1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-26 00:58:37 +02:00

Various appearance changes for scrubbing: ...

This commit is contained in:
Paul Licameli 2016-05-01 15:11:44 -04:00
commit 34c219f917
2 changed files with 46 additions and 27 deletions

View File

@ -1911,11 +1911,23 @@ void AdornedRulerPanel::RegenerateTooltips()
if (mIsRecording) { if (mIsRecording) {
this->SetToolTip(_("Timeline actions disabled during recording")); this->SetToolTip(_("Timeline actions disabled during recording"));
} }
else if (!mQuickPlayEnabled) {
this->SetToolTip(_("Quick-Play disabled"));
}
else { else {
this->SetToolTip(_("Quick-Play enabled")); switch(mPrevZone) {
case StatusChoice::EnteringQP :
if (!mQuickPlayEnabled) {
this->SetToolTip(_("Quick-Play disabled"));
}
else {
this->SetToolTip(_("Quick-Play enabled"));
}
break;
case StatusChoice::EnteringScrubZone :
this->SetToolTip(_("Scrub Bar"));
break;
default:
this->SetToolTip(NULL);
break;
}
} }
} }
else { else {
@ -2145,7 +2157,7 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
} }
// Handle status bar messages // Handle status bar messages
UpdateStatusBar ( UpdateStatusBarAndTooltips (
evt.Leaving() evt.Leaving()
? StatusChoice::Leaving ? StatusChoice::Leaving
: evt.Entering() || changeInZone : evt.Entering() || changeInZone
@ -2153,21 +2165,6 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
: StatusChoice::NoChange : StatusChoice::NoChange
); );
// 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;
}
auto &scrubber = mProject->GetScrubber(); auto &scrubber = mProject->GetScrubber();
if (scrubber.HasStartedScrubbing()) { if (scrubber.HasStartedScrubbing()) {
// If already clicked for scrub, preempt the usual event handling, // If already clicked for scrub, preempt the usual event handling,
@ -2230,7 +2227,7 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
if (HasCapture() && mCaptureState != Button::NoButton) if (HasCapture() && mCaptureState != Button::NoButton)
HandlePushbuttonEvent(evt); HandlePushbuttonEvent(evt);
else if (!HasCapture() && overButtons) { else if (!HasCapture() && overButtons) {
if (evt.LeftDown()) { if (evt.ButtonDown()) {
auto position = evt.GetPosition(); auto position = evt.GetPosition();
for (unsigned ii = 0; ii < static_cast<unsigned>(Button::NumButtons); ++ii) { for (unsigned ii = 0; ii < static_cast<unsigned>(Button::NumButtons); ++ii) {
auto button = static_cast<Button>(ii); auto button = static_cast<Button>(ii);
@ -2243,10 +2240,24 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
} }
} }
} }
// Handle popup menus
else if (!HasCapture() && 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 (!HasCapture() && inScrubZone) { else if (!HasCapture() && inScrubZone) {
if (evt.LeftDown()) { if (evt.LeftDown()) {
scrubber.MarkScrubStart(evt.m_x, false, false); scrubber.MarkScrubStart(evt.m_x, false, false);
UpdateStatusBar(StatusChoice::EnteringScrubZone); UpdateStatusBarAndTooltips(StatusChoice::EnteringScrubZone);
} }
wxClientDC dc(this); wxClientDC dc(this);
DrawQuickPlayIndicator(&dc); DrawQuickPlayIndicator(&dc);
@ -2522,7 +2533,7 @@ void AdornedRulerPanel::HandleQPRelease(wxMouseEvent &evt)
} }
} }
void AdornedRulerPanel::UpdateStatusBar(StatusChoice choice) void AdornedRulerPanel::UpdateStatusBarAndTooltips(StatusChoice choice)
{ {
if (choice == StatusChoice::NoChange) if (choice == StatusChoice::NoChange)
return; return;
@ -2563,6 +2574,8 @@ void AdornedRulerPanel::UpdateStatusBar(StatusChoice choice)
// Display a message, or empty message // Display a message, or empty message
mProject->TP_DisplayStatusMessage(message); mProject->TP_DisplayStatusMessage(message);
RegenerateTooltips();
} }
void AdornedRulerPanel::OnToggleScrubbing() void AdornedRulerPanel::OnToggleScrubbing()
@ -2849,12 +2862,18 @@ void AdornedRulerPanel::DoDrawPushbutton(wxDC *dc, Button button, bool down) con
// Adapted from TrackInfo::DrawMuteSolo() // Adapted from TrackInfo::DrawMuteSolo()
static const wxString labels[static_cast<size_t>(Button::NumButtons)] { static const wxString labels[static_cast<size_t>(Button::NumButtons)] {
XO("Quick Play"), XO("Quick-Play"),
/* i18n-hint: A long screen area (bar) controlling variable speed play (scrubbing) */ /* i18n-hint: A long screen area (bar) controlling variable speed play (scrubbing) */
XO("Scrub Bar"), XO("Scrub Bar"),
}; };
const auto bev = GetButtonRect( button ).Inflate(-1, -1); auto bev = GetButtonRect( button );
// This part corresponds to part of TrackInfo::DrawBordersWithin() :
AColor::Dark(dc, false);
dc->DrawRectangle(bev);
bev.Inflate(-1, -1);
if (down) if (down)
AColor::Solo(dc, true, false); AColor::Solo(dc, true, false);
else else
@ -2875,7 +2894,7 @@ void AdornedRulerPanel::DoDrawPushbutton(wxDC *dc, Button button, bool down) con
void AdornedRulerPanel::HandlePushbuttonEvent(wxMouseEvent &evt) void AdornedRulerPanel::HandlePushbuttonEvent(wxMouseEvent &evt)
{ {
if(evt.LeftUp()) { if(evt.ButtonUp()) {
if(HasCapture()) if(HasCapture())
ReleaseMouse(); ReleaseMouse();
if(InButtonRect(mCaptureState)) if(InButtonRect(mCaptureState))

View File

@ -334,7 +334,7 @@ private:
Leaving, Leaving,
NoChange NoChange
}; };
void UpdateStatusBar(StatusChoice choice); void UpdateStatusBarAndTooltips(StatusChoice choice);
void OnCaptureLost(wxMouseCaptureLostEvent &evt); void OnCaptureLost(wxMouseCaptureLostEvent &evt);