lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 4cfcfe4 07/15: Refactor: remove render_page_t


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 4cfcfe4 07/15: Refactor: remove render_page_template() helper function
Date: Fri, 27 Jul 2018 17:23:16 -0400 (EDT)

branch: master
commit 4cfcfe4e1918231d5b0459ac163a922977802b18
Author: Vadim Zeitlin <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Refactor: remove render_page_template() helper function
    
    No real changes, just remove a trivial helper function as is not
    actually that useful and while it's being used in two places right now,
    this won't be the case any longer with the upcoming pagination changes
    and it's not worth keeping it to just call it from a single place.
---
 ledger_pdf_generator_wx.cpp | 35 +++++++++++------------------------
 1 file changed, 11 insertions(+), 24 deletions(-)

diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 9c57b1b..5cc4a56 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -669,25 +669,6 @@ class page
         ) = 0;
 
   protected:
-    // Helper method for rendering the contents of the given external template,
-    // which is expected to be found in the file with the provided name and
-    // ".mst" extension in the data directory.
-    //
-    // Return the height of the page contents.
-    int render_page_template
-        (std::string const& template_name
-        ,pdf_writer_wx& writer
-        ,html_interpolator const& interpolate_html
-        )
-    {
-        return writer.output_html
-            (writer.get_horz_margin()
-            ,writer.get_vert_margin()
-            ,writer.get_page_width()
-            ,interpolate_html.expand_template(template_name)
-            );
-    }
-
     // The associated illustration, which will be non-null by the time our
     // virtual methods such as pre_render() and render() are called.
     pdf_illustration const* illustration_ = nullptr;
@@ -931,10 +912,11 @@ class cover_page : public page
         ,html_interpolator const& interpolate_html
         ) override
     {
-        int const height_contents = render_page_template
-            ("cover"
-            ,writer
-            ,interpolate_html
+        int const height_contents = writer.output_html
+            (writer.get_horz_margin()
+            ,writer.get_vert_margin()
+            ,writer.get_page_width()
+            ,interpolate_html.expand_template("cover")
             );
 
         // There is no way to draw a border around the page contents in wxHTML
@@ -1229,7 +1211,12 @@ class standard_page : public numbered_page
     {
         numbered_page::render(ledger, writer, interpolate_html);
 
-        render_page_template(page_template_name_, writer, interpolate_html);
+        writer.output_html
+            (writer.get_horz_margin()
+            ,writer.get_vert_margin()
+            ,writer.get_page_width()
+            ,interpolate_html.expand_template(page_template_name_)
+            );
     }
 
   private:



reply via email to

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