mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-29 23:19:28 +02: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:
parent
062066eb79
commit
c08c17eafa
@ -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
|
||||
|
@ -268,6 +268,7 @@ public:
|
||||
wxRect rect;
|
||||
};
|
||||
virtual FoundCell FindCell(int mouseX, int mouseY) = 0;
|
||||
virtual wxRect FindRect(const TrackPanelCell &cell) = 0;
|
||||
virtual TrackPanelCell *GetFocusedCell() = 0;
|
||||
virtual void SetFocusedCell() = 0;
|
||||
|
||||
@ -467,6 +468,9 @@ protected:
|
||||
// Find track info by coordinate
|
||||
FoundCell FindCell(int mouseX, int mouseY) override;
|
||||
|
||||
// Find rectangle of the given cell
|
||||
wxRect FindRect(const TrackPanelCell &cell) override;
|
||||
|
||||
int GetVRulerWidth() const;
|
||||
int GetVRulerOffset() const { return mTrackInfo.GetTrackInfoWidth(); }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user