1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Define drawing function of CellularPanel, which visits nodes

This commit is contained in:
Paul Licameli
2018-11-03 00:04:50 -04:00
parent 040decf9e3
commit cb2ea25afc
12 changed files with 157 additions and 43 deletions

View File

@@ -1122,3 +1122,32 @@ std::shared_ptr<TrackPanelCell> CellularPanel::LastCell() const
auto &state = *mState;
return state.mLastCell.lock();
}
void CellularPanel::Draw( TrackPanelDrawingContext &context, unsigned nPasses )
{
const auto panelRect = GetClientRect();
auto lastCell = LastCell();
for ( unsigned iPass = 0; iPass < nPasses; ++iPass ) {
VisitPostorder( [&]( const wxRect &rect, TrackPanelNode &node ) {
// Draw the node
const auto newRect = node.DrawingArea( rect, panelRect, iPass );
if ( newRect.Intersects( panelRect ) )
node.Draw( context, newRect, iPass );
// Draw the current handle if it is associated with the node
if ( &node == lastCell.get() ) {
auto target = Target();
if ( target ) {
const auto targetRect =
target->DrawingArea( rect, panelRect, iPass );
if ( targetRect.Intersects( panelRect ) )
target->Draw( context, targetRect, iPass );
}
}
} ); // nodes
} // passes
}