[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 89b4674 120/156: Add automatic support for mu
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 89b4674 120/156: Add automatic support for multiline super-headers |
Date: |
Tue, 30 Jan 2018 17:22:27 -0500 (EST) |
branch: master
commit 89b467466ea31475e694e6d10525d3257749209e
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>
Add automatic support for multiline super-headers
Handle line feeds in wx_table_generator::output_super_header() as
expected.
This makes it unnecessary to do it manually in the illustration
generation code.
---
ledger_pdf_generator_wx.cpp | 23 ++++++++++-------------
wx_table_generator.cpp | 12 +++++++++---
wx_table_generator.hpp | 1 +
3 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index ba0dd6e..bc98f9b 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -37,7 +37,7 @@
#include "ledger_evaluator.hpp"
#include "ledger_invariant.hpp"
#include "ledger_variant.hpp"
-#include "miscellany.hpp" // lmi_tolower(), split_into_lines()
+#include "miscellany.hpp" // lmi_tolower()
#include "pdf_writer_wx.hpp"
#include "version.hpp"
#include "wx_table_generator.hpp"
@@ -2082,19 +2082,16 @@ class page_with_basic_tabular_report : public
page_with_tabular_report
;
- auto const header_lines = split_into_lines
- (get_two_column_header(suffix_full, suffix_short)
+ auto const header =
+ get_two_column_header(suffix_full, suffix_short)
+ ;
+ table.output_super_header
+ (interpolate_html(header).as_html()
+ ,begin_column
+ ,end_column
+ ,&y
+ ,output_mode
);
- for(auto const& line : header_lines)
- {
- table.output_super_header
- (interpolate_html(line).as_html()
- ,begin_column
- ,end_column
- ,&y
- ,output_mode
- );
- }
y += table.get_separator_line_height();
table.output_horz_separator
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index 078c4be..79d57f3 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -431,12 +431,14 @@ void wx_table_generator::output_super_header
,enum_output_mode output_mode
)
{
+ std::vector<std::string> const lines(split_into_lines(header));
+
switch(output_mode)
{
case e_output_normal:
break;
case e_output_measure_only:
- *pos_y += row_height_;
+ *pos_y += row_height_*lines.size();
return;
}
@@ -447,9 +449,13 @@ void wx_table_generator::output_super_header
auto rect = text_rect(begin_column, *pos_y);
rect.width += do_get_cell_x(end_column) - do_get_cell_x(begin_column + 1);
- dc_.DrawLabel(header, rect, wxALIGN_CENTER_HORIZONTAL);
+ for(auto const& line : lines)
+ {
+ dc_.DrawLabel(line, rect, wxALIGN_CENTER_HORIZONTAL);
- *pos_y += row_height_;
+ rect.y += row_height_;
+ *pos_y += row_height_;
+ }
}
void wx_table_generator::output_row
diff --git a/wx_table_generator.hpp b/wx_table_generator.hpp
index 5b9b19b..1ba0e58 100644
--- a/wx_table_generator.hpp
+++ b/wx_table_generator.hpp
@@ -74,6 +74,7 @@ class wx_table_generator
// Render a super-header, i.e. a header spanning over several columns. The
// columns range is specified as a close/open interval, as usual in C++.
+ // The header string may be multiline, just as with normal headers.
void output_super_header
(std::string const& header
,std::size_t begin_column
- [lmi-commits] [lmi] master 4e76bba 098/156: Add support for comments to the string interpolation function, (continued)
- [lmi-commits] [lmi] master 4e76bba 098/156: Add support for comments to the string interpolation function, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master b5fe850 102/156: Add NASD basic illustration page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 4250de9 104/156: Add first variant of NASD supplemental page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 7a1e1e8 025/156: Include the missing <cstring> header, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 8bfb896 109/156: Add NASD illustration first explanatory notes page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master ea20a31 095/156: Make pdf_illustration dtor virtual, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 61fae89 091/156: Reimplement the contract numbers fragment as an external template, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 0c55621 085/156: Replace trivial PDF page classes with single standard_page one, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master ea2564b 099/156: Split the NASD header template in the upper and lower parts, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master c1bf4a8 032/156: Adjust position of the right hand side of the header manually, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 89b4674 120/156: Add automatic support for multiline super-headers,
Greg Chicares <=
- [lmi-commits] [lmi] master 0f885a2 116/156: Define CorpNameAbbrev60 and Insured1Abbrev30 in common code, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 08559c3 121/156: Factor out base_suffix() and ir_suffix() functions, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 36c84ce 123/156: Add another individual private placement illustration page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 0ecc8ec 036/156: Add support for partials to our ad hoc Mustache parser, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 6f09722 107/156: Add missing words to the narrative summary continuation page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 6510601 150/156: Rename a mute variable to avoid gcc -Wshadow warning, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 048ae05 093/156: Start NASD PDF illustration class implementation, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 5ea5c86 101/156: Simplify and correct current PDF DC font handling, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master ec490eb 153/156: Revise and extend some comments in PDF generation code, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 38cab5e 096/156: Make footer template depend on illustration kind, Greg Chicares, 2018/01/30