diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 61e43dd56..edbde6b45 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -7899,8 +7899,9 @@ void TrackPanel::OnTrackMenu(Track *t) //We need to find the location of the menu rectangle. wxRect rect = FindTrackRect(t,true); + rect.Inflate(1, 1); // TODO remove this wxRect titleRect; - mTrackInfo.GetTitleBarRect(rect,titleRect); + mTrackInfo.GetTitleBarRect(rect, titleRect); PopupMenu(theMenu, titleRect.x + 1, titleRect.y + titleRect.height + 1); @@ -7947,7 +7948,8 @@ void TrackPanel::OnVRulerMenu(Track *t, wxMouseEvent *pEvent) else { // If no event given, pop up the menu at the same height // as for the track control menu - const wxRect rect = FindTrackRect(wt, true); + wxRect rect = FindTrackRect(wt, true); + rect.Inflate(1, 1); // TODO remove this wxRect titleRect; mTrackInfo.GetTitleBarRect(rect, titleRect); x = GetVRulerOffset(), y = titleRect.y + titleRect.height + 1; @@ -9032,13 +9034,15 @@ TrackPanel::FoundCell TrackPanel::FindCell(int mouseX, int mouseY) wxRect TrackPanel::FindTrackRect(Track * target, bool label) { if (!target) { - return wxRect(0,0,0,0); + return { 0, 0, 0, 0 }; } - wxRect rect(0, - target->GetY() - mViewInfo->vpos, - GetSize().GetWidth(), - target->GetHeight()); + wxRect rect{ + 0, + target->GetY() - mViewInfo->vpos, + GetSize().GetWidth(), + target->GetHeight() + }; // The check for a null linked track is necessary because there's // a possible race condition between the time the 2 linked tracks @@ -9048,12 +9052,14 @@ wxRect TrackPanel::FindTrackRect(Track * target, bool label) rect.height += target->GetLink()->GetHeight(); } - if (label) { - rect.x += kLeftInset; - rect.width -= kLeftInset; - rect.y += kTopInset; - rect.height -= kTopInset; - } + rect.x += kLeftMargin; + if (label) + rect.width = GetVRulerOffset() - kLeftMargin; + else + rect.width -= (kLeftMargin + kRightMargin); + + rect.y += kTopMargin; + rect.height -= (kTopMargin + kBottomMargin); return rect; } diff --git a/src/TrackPanel.h b/src/TrackPanel.h index 0f979d37f..b9656ab5e 100644 --- a/src/TrackPanel.h +++ b/src/TrackPanel.h @@ -563,6 +563,9 @@ protected: }; virtual FoundCell FindCell(int mouseX, int mouseY); + // If label, rectangle includes track control panel only. + // If !label, rectangle includes all of that, and the vertical ruler, and + // the proper track area. virtual wxRect FindTrackRect(Track * target, bool label); virtual int GetVRulerWidth() const; diff --git a/src/TrackPanelAx.cpp b/src/TrackPanelAx.cpp index 3f8774428..4a7f95ad8 100644 --- a/src/TrackPanelAx.cpp +++ b/src/TrackPanelAx.cpp @@ -306,7 +306,11 @@ wxAccStatus TrackPanelAx::GetLocation( wxRect& rect, int elementId ) return wxACC_FAIL; } - rect = mTrackPanel->FindTrackRect( t, true ); + rect = mTrackPanel->FindTrackRect( t, false ); + // Inflate the screen reader's rectangle so it overpaints Audacity's own + // yellow focus rectangle. + const int dx = 2; + rect.Inflate(dx, dx); } rect.SetPosition( mTrackPanel->GetParent()->ClientToScreen( rect.GetPosition() ) ); diff --git a/src/commands/ScreenshotCommand.cpp b/src/commands/ScreenshotCommand.cpp index e116fb683..13d52507f 100644 --- a/src/commands/ScreenshotCommand.cpp +++ b/src/commands/ScreenshotCommand.cpp @@ -557,8 +557,10 @@ bool ScreenshotCommand::Apply(CommandExecutionContext context) { auto FindRectangle = []( TrackPanel &panel, Track &t ) { - // This rectangle omits the focus ring about the track - wxRect rect = panel.FindTrackRect( &t, true ); + // This rectangle omits the focus ring about the track, and + // also within that, a narrow black border with a "shadow" below and + // to the right + wxRect rect = panel.FindTrackRect( &t, false ); // Enlarge horizontally. // PRL: perhaps it's one pixel too much each side, including some gray @@ -573,7 +575,8 @@ bool ScreenshotCommand::Apply(CommandExecutionContext context) // rectangle allotted to the track, according to Track::GetY() and // Track::GetHeight(), but also over the margin of the next track.) - int dy = kTopInset - 1; + rect.height += kBottomMargin; + int dy = kTopMargin - 1; rect.Inflate( 0, dy ); // Reposition it relative to parent of panel