[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 463e8ca 138/156: Fix bug with page numbers in
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 463e8ca 138/156: Fix bug with page numbers in subsequent illustrations |
Date: |
Tue, 30 Jan 2018 17:22:32 -0500 (EST) |
branch: master
commit 463e8ca1b9a512311c0966abd0fc46088fa9c021
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>
Fix bug with page numbers in subsequent illustrations
The page numbers were monotonically growing with each subsequent
illustration due to the use of static last_page_number_ variable.
Fix this by resetting it before each "page 1" and add an assert checking
that this is not forgotten.
---
ledger_pdf_generator_wx.cpp | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index ad08f11..4fcc371 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -1118,6 +1118,19 @@ class attachment_page : public page_with_footer
class numbered_page : public page_with_footer
{
public:
+ // Must be called before creating the first numbered page.
+ static void start_numbering()
+ {
+ last_page_number_ = 0;
+ }
+
+ numbered_page()
+ {
+ // This assert would fail if start_numbering() hadn't been called
+ // before creating a numbered page, as it should be.
+ LMI_ASSERT(last_page_number_ >= 0);
+ }
+
void pre_render
(Ledger const& ledger
,pdf_writer_wx& writer
@@ -1196,7 +1209,8 @@ class numbered_page : public page_with_footer
int extra_pages_ = 0;
};
-int numbered_page::last_page_number_ = 0;
+// Initial value is invalid, use start_numbering() to change it.
+int numbered_page::last_page_number_ = -1;
// Simplest possible page which is entirely defined by its external template
// whose name must be specified when constructing it.
@@ -2039,6 +2053,7 @@ class pdf_illustration_regular : public pdf_illustration
// Add all the pages.
add<cover_page>();
+ numbered_page::start_numbering();
add<standard_page>("narrative_summary");
add<standard_page>("narrative_summary_cont");
add<standard_page>("column_headings");
@@ -2443,6 +2458,7 @@ class pdf_illustration_nasd : public pdf_illustration
// Add all the pages.
add<cover_page>();
+ numbered_page::start_numbering();
add<nasd_basic>();
add<nasd_supplemental>();
add<standard_page>("nasd_column_headings");
@@ -2522,6 +2538,7 @@ class pdf_illustration_reg_d_group : public
pdf_illustration
// Add all the pages.
add<cover_page>();
+ numbered_page::start_numbering();
add<reg_d_group_basic>();
add<standard_page>("reg_d_group_column_headings");
add<standard_page>("reg_d_group_narrative_summary");
@@ -2796,6 +2813,7 @@ class pdf_illustration_reg_d_individual : public
pdf_illustration
add_abbreviated_variable("Insured1", 140);
// Add all the pages.
+ numbered_page::start_numbering();
add<standard_page>("reg_d_individual_cover_page");
add<reg_d_individual_guar_irr>();
add<reg_d_individual_cur_irr>();
- [lmi-commits] [lmi] master 833eef5 086/156: Use std::make_unique<> instead of raw "new", (continued)
- [lmi-commits] [lmi] master 833eef5 086/156: Use std::make_unique<> instead of raw "new", Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 34c088c 073/156: Move footer contents into an external template too, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 0ba1c32 146/156: Consistently use "curr" as abbreviation of "current", Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 29865fc 133/156: Add supplemental report to NASD illustrations too, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 919d796 001/156: Remove old XSL-FO-based PDF generation code, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master cc7fc05 143/156: Change template file extension from .mustache to .mst, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 08984bb 148/156: Recognize Mustache files in the coding rules test, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master de5a5c7 151/156: Fix interpolate_string_test build, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master bb5693e 136/156: Harmonize spacing in header in reg_d_group illustrations too, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 0c85a7a 154/156: Avoid using directive for the "html" namespace, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 463e8ca 138/156: Fix bug with page numbers in subsequent illustrations,
Greg Chicares <=
- [lmi-commits] [lmi] master 830e1fd 130/156: Manually break column titles into lines, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 43859a6 053/156: Add support for "measure only" output mode to wx_table_generator, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 772f4a4 139/156: Refactor: use get_fixed_page_contents_template_name(), Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 81ccdc8 129/156: Remove the never used elements of the columns title map, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 2478fbc 010/156: Start implementing PDF illustrations directly, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 9d24cd9 024/156: Compilation fix for C++11 but not C++14 compilers, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 1229745 020/156: Make add_body_paragraph() even more convenient to use, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 14aca9e 142/156: Replace underscores in title map with explicit line breaks, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 5241f0f 045/156: Fix some typos in wx_table_generator::add_column() comment, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 47bddbf 155/156: Merge branch 'vz-no-xslfo' into gwc-no-xslfo, Greg Chicares, 2018/01/30