1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-16 06:03:49 +01:00

Add a method to find the rectangle of a given cell...

... Cells are not responsible to remember that; the cells' container determines
that.
This commit is contained in:
Paul Licameli
2018-06-26 23:36:34 -04:00
parent 062066eb79
commit c08c17eafa
2 changed files with 18 additions and 0 deletions

View File

@@ -2829,6 +2829,20 @@ auto TrackPanel::FindCell(int mouseX, int mouseY) -> FoundCell
};
}
wxRect TrackPanel::FindRect( const TrackPanelCell &cell )
{
auto range = Cells();
auto end = range.second,
iter = std::find_if( range.first, end,
[&]( const decltype(*end) &pair )
{ return pair.first.get() == &cell; }
);
if (iter == end)
return {};
else
return (*iter).second;
}
// This finds the rectangle of a given track (including all channels),
// either that of the label 'adornment' or the track itself
// The given track is assumed to be the first channel