[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 43859a6 053/156: Add support for "measure onl
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 43859a6 053/156: Add support for "measure only" output mode to wx_table_generator |
Date: |
Tue, 30 Jan 2018 17:22:08 -0500 (EST) |
branch: master
commit 43859a67a0faf24a4380eba56c5657ef9fa0bfd3
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>
Add support for "measure only" output mode to wx_table_generator
Allow using some of the methods just to compute the space needed to
display the contents normally output by them, but without actually
outputting it.
This is useful when performing page layout calculations.
---
wx_table_generator.cpp | 23 ++++++++++++++++++-----
wx_table_generator.hpp | 18 ++++++++++--------
2 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index a62d215..5952306 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -299,8 +299,17 @@ void wx_table_generator::output_horz_separator
(std::size_t begin_column
,std::size_t end_column
,int y
+ ,enum_output_mode output_mode
)
{
+ switch(output_mode)
+ {
+ case e_output_normal:
+ break;
+ case e_output_measure_only:
+ return;
+ }
+
LMI_ASSERT(begin_column < end_column);
LMI_ASSERT(end_column <= columns_.size());
@@ -317,13 +326,17 @@ void wx_table_generator::output_horz_separator
do_output_horz_separator(x1, x2, y);
}
-int wx_table_generator::get_header_height() const
+void wx_table_generator::output_header(int* pos_y, enum_output_mode
output_mode)
{
- return max_header_lines_*row_height_;
-}
+ switch(output_mode)
+ {
+ case e_output_normal:
+ break;
+ case e_output_measure_only:
+ *pos_y += max_header_lines_ * row_height_;
+ return;
+ }
-void wx_table_generator::output_header(int* pos_y)
-{
do_compute_column_widths_if_necessary();
wxDCFontChanger set_header_font(dc_);
diff --git a/wx_table_generator.hpp b/wx_table_generator.hpp
index c9cbffb..cf17868 100644
--- a/wx_table_generator.hpp
+++ b/wx_table_generator.hpp
@@ -24,6 +24,8 @@
#include "config.hpp"
+#include "output_mode.hpp"
+
#include <wx/dc.h>
#include <wx/font.h>
@@ -65,7 +67,10 @@ class wx_table_generator
void add_column(std::string const& header, std::string const& widest_text);
// Render the headers at the given position and update it.
- void output_header(int* pos_y);
+ void output_header
+ (int* pos_y
+ ,enum_output_mode output_mode = e_output_normal
+ );
// Render a row with the given values at the given position and update it.
// The values here can be single-line only and there must be exactly the
@@ -80,10 +85,6 @@ class wx_table_generator
,std::string const& value
);
- // Compute and return the height of the header without outputting it as
- // output_header() does.
- int get_header_height() const;
-
// Return the height of a single table row.
int row_height() const {return row_height_;}
@@ -99,9 +100,10 @@ class wx_table_generator
// Output a horizontal separator line across the specified columns,
// using the usual C++ close/open interval convention.
void output_horz_separator
- (std::size_t begin_column
- ,std::size_t end_column
- ,int y
+ (std::size_t begin_column
+ ,std::size_t end_column
+ ,int y
+ ,enum_output_mode output_mode = e_output_normal
);
// Output a vertical separator line before the given column. Notice that
- [lmi-commits] [lmi] master 0ba1c32 146/156: Consistently use "curr" as abbreviation of "current", (continued)
- [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, 2018/01/30
- [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 <=
- [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
- [lmi-commits] [lmi] master a1342a9 106/156: Fix supplemental NASD illustration page for split premiums, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master ec0b298 110/156: Add NASD illustration second explanatory notes page, Greg Chicares, 2018/01/30