lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 8c87709 4/6: Prepare to number cover pages


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 8c87709 4/6: Prepare to number cover pages
Date: Thu, 25 Apr 2019 16:49:26 -0400 (EDT)

branch: master
commit 8c8770979a15f9222adf701dffc958b83a0a7042
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Prepare to number cover pages
    
    Eventually, option (D) here:
      https://lists.nongnu.org/archive/html/lmi/2018-11/msg00045.html
    will be wanted for all ledger types--though for the moment a legacy
    version of the original class is retained under a different name in
    order to postpone this change for 'finra' illustrations. For option (D),
    the cover page class's place in the inheritance tree needs to change,
    requiring a change in its location in the code. This preparatory commit
    encompasses a block copy of an entire small class, along with changes
    that can trivially be reviewed with '--color-moved=plain' (which doesn't
    detect the block copy, unfortunately). Changing the order of the
    add<cover_page> and start_numbering() lines has no effect yet because
    class cover_page is not yet a numbered_page; and, as explained here:
      https://lists.nongnu.org/archive/html/lmi/2019-04/msg00035.html
    it actually might not matter at all.
---
 pdf_command_wx.cpp | 43 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 38 insertions(+), 5 deletions(-)

diff --git a/pdf_command_wx.cpp b/pdf_command_wx.cpp
index d2de0f4..19778f9 100644
--- a/pdf_command_wx.cpp
+++ b/pdf_command_wx.cpp
@@ -1004,8 +1004,9 @@ class pdf_illustration : protected html_interpolator, 
protected pdf_writer_wx
     std::vector<std::unique_ptr<logical_page>> pages_;
 };
 
-// Cover page used by several different illustration kinds.
-class cover_page : public logical_page
+// Cover page for finra only. PDF !! At the appropriate time, expunge
+// this class altogether, and use class cover_page instead.
+class unnumbered_cover_page : public logical_page
 {
   public:
     using logical_page::logical_page;
@@ -1331,6 +1332,38 @@ class numbered_page : public page_with_marginals
     int               extra_pages_      {0};
 };
 
+/// Generic cover page for most ledger types.
+
+class cover_page : public logical_page
+{
+  public:
+    using logical_page::logical_page;
+
+    void render() override
+    {
+        int const height_contents = writer_.output_html
+            (writer_.get_horz_margin()
+            ,writer_.get_vert_margin()
+            ,writer_.get_page_width()
+            ,interpolator_.expand_template("cover")
+            );
+
+        // There is no way to draw a border around the page contents in wxHTML
+        // currently, so do it manually.
+        auto& pdf_dc = writer_.dc();
+
+        pdf_dc.SetPen(wxPen(illustration_rule_color, 2));
+        pdf_dc.SetBrush(*wxTRANSPARENT_BRUSH);
+
+        pdf_dc.DrawRectangle
+            (writer_.get_horz_margin()
+            ,writer_.get_vert_margin()
+            ,writer_.get_page_width()
+            ,height_contents
+            );
+    }
+};
+
 // Simplest possible page which is entirely defined by its external template
 // whose name must be specified when constructing it.
 class standard_page : public numbered_page
@@ -2287,8 +2320,8 @@ class pdf_illustration_naic : public pdf_illustration
             );
 
         // Add all the pages.
-        add<cover_page>();
         numbered_page::start_numbering();
+        add<cover_page>();
         add<standard_page>("ill_reg_narr_summary");
         add<standard_page>("ill_reg_narr_summary2");
         add<standard_page>("ill_reg_column_headings");
@@ -2839,7 +2872,7 @@ class pdf_illustration_finra : public pdf_illustration
             );
 
         // Add all the pages.
-        add<cover_page>();
+        add<unnumbered_cover_page>();
         numbered_page::start_numbering();
         add<finra_basic>();
         add<finra_supplemental>();
@@ -2924,8 +2957,8 @@ class pdf_illustration_reg_d_group : public 
pdf_illustration
             );
 
         // Add all the pages.
-        add<cover_page>();
         numbered_page::start_numbering();
+        add<cover_page>();
         add<reg_d_group_basic>();
         add<standard_page>("reg_d_group_column_headings");
         add<standard_page>("reg_d_group_narr_summary");



reply via email to

[Prev in Thread] Current Thread [Next in Thread]