[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 7d278ef 011/156: Add footer to the cover page
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 7d278ef 011/156: Add footer to the cover page |
Date: |
Tue, 30 Jan 2018 17:21:51 -0500 (EST) |
branch: master
commit 7d278ef11f865f7e0f698663ed8338bcbf9b7448
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>
Add footer to the cover page
Position it manually near the bottom of the frame as we can't just draw
the frame around the table contents easily with wxHTML.
---
ledger_pdf_generator_wx.cpp | 54 +++++++++++++++++++++++++++++++++++++++------
1 file changed, 47 insertions(+), 7 deletions(-)
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index dba5e2c..6863d11 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -169,11 +169,17 @@ class cover_page : public page
{
dc.SetPen(wxPen(*wxBLUE, 2));
dc.SetBrush(*wxTRANSPARENT_BRUSH);
+
+ auto const frame_horz_margin = writer.get_horz_margin();
+ auto const frame_vert_margin = writer.get_vert_margin();
+ auto const frame_width = writer.get_page_width();
+ auto const frame_height = writer.get_page_height();
+
dc.DrawRectangle
- (writer.get_horz_margin()
- ,writer.get_vert_margin()
- ,writer.get_page_width()
- ,writer.get_page_height()
+ (frame_horz_margin
+ ,frame_vert_margin
+ ,frame_width
+ ,frame_height
);
auto const& invar = ledger.GetLedgerInvariant();
@@ -276,12 +282,46 @@ class cover_page : public page
)
;
+ auto const text_horz_margin = 2*frame_horz_margin;
+ auto const text_width = frame_width - 2*frame_horz_margin;
writer.output_html
- (writer.get_horz_margin()
- ,4*writer.get_vert_margin()
- ,writer.get_page_width()
+ (text_horz_margin
+ ,4*frame_vert_margin
+ ,text_width
,cover_html
);
+
+ auto const footer_html = tag::p[attr::align("center")]
+ (text::from
+ (invar.InsCoShortName
+ +"Financial Group is a marketing name for "
+ +invar.InsCoName
+ +"("
+ +invar.InsCoShortName
+ +") and its affiliated company and sales representatives, "
+ +invar.InsCoAddr
+ +"."
+ )
+ );
+
+ // Compute the footer height (which depends on how long it is, as it
+ // can be wrapped to take more than one line)...
+ int const footer_height = writer.output_html
+ (text_horz_margin
+ ,0
+ ,text_width
+ ,footer_html
+ ,e_output_measure_only
+ );
+
+ // ... in order to be able to position it precisely at the bottom of
+ // our blue frame.
+ writer.output_html
+ (text_horz_margin
+ ,frame_vert_margin + frame_height - footer_height
+ ,text_width
+ ,footer_html
+ );
}
};
- [lmi-commits] [lmi] master updated (70fb246 -> 408ba18), Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master cfdf224 016/156: Use raw multiline string instead of concatenating several strings, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 1d99e76 008/156: Make pdf_writer_wx::output_html() type safe by taking html::text, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master e43a485 005/156: Further improve wxPdfDocument API encapsulation and reuse, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 7d278ef 011/156: Add footer to the cover page,
Greg Chicares <=
- [lmi-commits] [lmi] master d5d8185 057/156: Add tabular_details page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master bb64784 013/156: Add a helper allowing to interpolate variables in strings, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master b72ced6 014/156: Replace ad hoc illustration properties with HTML interpolator, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master e7d763d 066/156: Add company logo display to the PDF illustration header, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master f575c94 003/156: Refactor more group_quote_pdf_gen_wx code to allow its reuse, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 5e2fc70 007/156: Make HTML generation utilities more type-safe, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 7ed2bbf 027/156: Simplify footer generation code by moving font tag outside, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master d7244c1 043/156: Change the colour used for lines and borders, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 41ae40d 089/156: Fix wrong "<br>" tag in the header template, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master acb7aae 049/156: Add numbered_page::get_extra_pages_needed() hook, Greg Chicares, 2018/01/30