[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master dbaf3c4 048/156: Render PDF illustrations in
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master dbaf3c4 048/156: Render PDF illustrations in two passes |
Date: |
Tue, 30 Jan 2018 17:22:07 -0500 (EST) |
branch: master
commit dbaf3c44f49776c32b3e3c2bb92a03dc4d1241f2
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>
Render PDF illustrations in two passes
Single pass rendering doesn't work for the logical pages that need to
dynamically determine how many physical pages their contents will take,
so prepare for implementing this by adding a new pre_render() method and
calling it for all pages before calling render() itself.
---
ledger_pdf_generator_wx.cpp | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 6027aa3..bade62d 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -254,6 +254,24 @@ class page
// virtual dtor, if only to avoid gcc warnings about not having it.
virtual ~page() = default;
+ // Called before rendering any pages to prepare for doing this, e.g. by
+ // computing the number of pages needed.
+ //
+ // This method must not draw anything on the wxDC, it is provided only for
+ // measurement purposes.
+ virtual void pre_render
+ (Ledger const& ledger
+ ,pdf_writer_wx& writer
+ ,wxDC& dc
+ ,html_interpolator const& interpolate_html
+ )
+ {
+ stifle_warning_for_unused_value(ledger);
+ stifle_warning_for_unused_value(writer);
+ stifle_warning_for_unused_value(dc);
+ stifle_warning_for_unused_value(interpolate_html);
+ }
+
// Render this page contents.
virtual void render
(Ledger const& ledger
@@ -288,6 +306,11 @@ class pdf_illustration : protected html_interpolator
// Render all pages.
void render_all()
{
+ for(auto const& page : pages_)
+ {
+ page->pre_render(ledger_, writer_, dc_, *this);
+ }
+
bool first = true;
for(auto const& page : pages_)
{
- [lmi-commits] [lmi] master 5f6dc89 131/156: Use string objects for illustration_table_column fields, (continued)
- [lmi-commits] [lmi] master 5f6dc89 131/156: Use string objects for illustration_table_column fields, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master fb01571 035/156: Pass what is being expanded to interpolation function, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master fc6d8b7 034/156: Implement the "Columns Headings" page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 46788b8 119/156: Start implementing individual private placement illustration kind, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 1287474 114/156: Start private group placement illustration class implementation, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 0f78daf 050/156: Compute the footer size in page_with_footer::pre_render(), Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 6b3b5b2 054/156: Factor out illustration_table_generator from tabular_detail2_page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 23d26f8 055/156: Factor out reusable page_with_tabular_report class, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master f484622 044/156: Only show numeric summary if not in force, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 67db94b 042/156: Implement more of numeric summary page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master dbaf3c4 048/156: Render PDF illustrations in two passes,
Greg Chicares <=
- [lmi-commits] [lmi] master de9567e 152/156: Fix misplaced commas in ledger PDF generator code, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 783befa 006/156: Add separate class for representing HTML contents, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 8c5be11 128/156: Use proper types for get_two_column_header() parameters, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 257ff4b 065/156: Add numeric summary table to PDF illustrations, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master ef38c9d 141/156: Revert the title map related changes, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master b1ab0fa 126/156: Leave a gap between upper footer part and main page contents, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 940198c 059/156: Add numeric summary attachment page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master b341a2a 061/156: Factor out using_illustration_table helper class, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 1b46585 076/156: Use MarketingNameFootnote & StateMarketingImprimatur on cover page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 234cd39 012/156: Use custom font sizes to be closer to the existing illustrations, Greg Chicares, 2018/01/30