1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-05 22:28:57 +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) {
this->SetToolTip(_("Timeline actions disabled during recording"));
}
else if (!mQuickPlayEnabled) {
this->SetToolTip(_("Quick-Play disabled"));
}
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 {
@ -2145,7 +2157,7 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
}
// Handle status bar messages
UpdateStatusBar (
UpdateStatusBarAndTooltips (
evt.Leaving()
? StatusChoice::Leaving
: evt.Entering() || changeInZone
@ -2153,21 +2165,6 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
: 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();
if (scrubber.HasStartedScrubbing()) {
// If already clicked for scrub, preempt the usual event handling,
@ -2230,7 +2227,7 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
if (HasCapture() && mCaptureState != Button::NoButton)
HandlePushbuttonEvent(evt);
else if (!HasCapture() && overButtons) {
if (evt.LeftDown()) {
if (evt.ButtonDown()) {
auto position = evt.GetPosition();
for (unsigned ii = 0; ii < static_cast<unsigned>(Button::NumButtons); ++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) {
if (evt.LeftDown()) {
scrubber.MarkScrubStart(evt.m_x, false, false);
UpdateStatusBar(StatusChoice::EnteringScrubZone);
UpdateStatusBarAndTooltips(StatusChoice::EnteringScrubZone);
}
wxClientDC dc(this);
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)
return;
@ -2563,6 +2574,8 @@ void AdornedRulerPanel::UpdateStatusBar(StatusChoice choice)
// Display a message, or empty message
mProject->TP_DisplayStatusMessage(message);
RegenerateTooltips();
}
void AdornedRulerPanel::OnToggleScrubbing()
@ -2849,12 +2862,18 @@ void AdornedRulerPanel::DoDrawPushbutton(wxDC *dc, Button button, bool down) con
// Adapted from TrackInfo::DrawMuteSolo()
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) */
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)
AColor::Solo(dc, true, false);
else
@ -2875,7 +2894,7 @@ void AdornedRulerPanel::DoDrawPushbutton(wxDC *dc, Button button, bool down) con
void AdornedRulerPanel::HandlePushbuttonEvent(wxMouseEvent &evt)
{
if(evt.LeftUp()) {
if(evt.ButtonUp()) {
if(HasCapture())
ReleaseMouse();
if(InButtonRect(mCaptureState))

View File

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