mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 17:30:17 +01:00
Another override of CellularPanel::FindRect taking a predicate
This commit is contained in:
@@ -1043,6 +1043,21 @@ wxRect CellularPanel::FindRect( const TrackPanelCell &cell )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxRect CellularPanel::FindRect(
|
||||||
|
const std::function< bool( TrackPanelNode& ) > &pred)
|
||||||
|
{
|
||||||
|
wxRect result;
|
||||||
|
|
||||||
|
struct Stop{};
|
||||||
|
try { VisitPreorder( [&]( const wxRect &rect, TrackPanelNode &visited ) {
|
||||||
|
if ( pred( visited ) )
|
||||||
|
result = rect, throw Stop{};
|
||||||
|
} ); }
|
||||||
|
catch ( const Stop& ) {}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
UIHandlePtr CellularPanel::Target()
|
UIHandlePtr CellularPanel::Target()
|
||||||
{
|
{
|
||||||
auto &state = *mState;
|
auto &state = *mState;
|
||||||
|
|||||||
@@ -97,6 +97,12 @@ public:
|
|||||||
// is not specified which rectangle is returned.
|
// is not specified which rectangle is returned.
|
||||||
wxRect FindRect(const TrackPanelCell &cell);
|
wxRect FindRect(const TrackPanelCell &cell);
|
||||||
|
|
||||||
|
// Search the tree of subdivisions of the panel area for a node (group or
|
||||||
|
// cell) satisfying the predicate. If more than one sub-area is associated
|
||||||
|
// with some node satisfying the predicate, it is not specified which
|
||||||
|
// rectangle is returned.
|
||||||
|
wxRect FindRect(const std::function< bool( TrackPanelNode& ) > &pred);
|
||||||
|
|
||||||
UIHandlePtr Target();
|
UIHandlePtr Target();
|
||||||
|
|
||||||
std::shared_ptr<TrackPanelCell> LastCell() const;
|
std::shared_ptr<TrackPanelCell> LastCell() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user