1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 08:09:32 +02: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;
for (auto n : mTracks->Any()) {
auto &view = TrackView::Get( *n );
wxRect r;
r.x = 0;
r.y = y;
r.y = 0;
r.width = width;
r.height = (int)(TrackView::Get( *n ).GetHeight() * scale);
auto trackHeight = (int)(view.GetHeight() * scale);
r.height = trackHeight;
const auto subViews = view.GetSubViews( r );
if (subViews.empty())
continue;
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
};
TrackView::Get( *n ).Draw( context, r, TrackArtist::PassTracks );
iter->second->Draw( context, r, TrackArtist::PassTracks );
}
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;