mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-21 06:40:08 +02:00
FindTrackRect omits all margins; better screen reader focus rects...
... Formerly it was outside of the yellow focus at the right side. Now it follows the yellow consistently on four sides. The constant dx in TrackPanelAx::GetLocation might be adjusted. No change of behavior is intended at other uses of FindTrackRect
This commit is contained in:
parent
134c1ff47a
commit
c38efc1fcd
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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() ) );
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user