1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-08 09:36:24 +01:00

Bug2242: printing of track imagess (and now, with sub-views)

This commit is contained in:
Paul Licameli
2020-04-19 20:20:29 -04:00
parent bc3a878ba1
commit 0c24d0d47a

View File

@@ -97,21 +97,39 @@ bool AudacityPrintout::OnPrintPage(int WXUNUSED(page))
int y = rulerPageHeight; int y = rulerPageHeight;
for (auto n : mTracks->Any()) { for (auto n : mTracks->Any()) {
auto &view = TrackView::Get( *n );
wxRect r; wxRect r;
r.x = 0; r.x = 0;
r.y = y; r.y = 0;
r.width = width; r.width = width;
r.height = (int)(TrackView::Get( *n ).GetHeight() * scale); auto trackHeight = (int)(view.GetHeight() * scale);
r.height = trackHeight;
TrackPanelDrawingContext context{ const auto subViews = view.GetSubViews( r );
*dc, {}, {}, &artist if (subViews.empty())
}; continue;
TrackView::Get( *n ).Draw( context, r, TrackArtist::PassTracks );
auto iter = subViews.begin(), end = subViews.end(), next = iter;
auto yy = iter->first;
for ( ; iter != end; iter = next ) {
++next;
auto nextY = ( next == end )
? trackHeight
: next->first;
r.y = y + yy;
r.SetHeight( nextY - yy );
yy = nextY;
TrackPanelDrawingContext context{
*dc, {}, {}, &artist
};
iter->second->Draw( context, r, TrackArtist::PassTracks );
}
dc->SetPen(*wxBLACK_PEN); dc->SetPen(*wxBLACK_PEN);
AColor::Line(*dc, 0, r.y, width, r.y); AColor::Line(*dc, 0, y, width, y);
y += r.height; y += trackHeight;
}; };
return true; return true;