[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 4cf72c4 7/8: Establish a mapping from potenti
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 4cf72c4 7/8: Establish a mapping from potential to actual (non-hidden) columns |
Date: |
Mon, 6 Aug 2018 18:36:24 -0400 (EDT) |
branch: master
commit 4cf72c489afbd6c5bd22d18df9ec7efb1b74ff95
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Establish a mapping from potential to actual (non-hidden) columns
For now at least, this mapping is held in parallel with
std::vector<column_parameters> vc;
and passed similarly to class wx_table_generator, but that may change:
it might, for instance, be encapsulated in a member function of each
wx_table_generator client.
---
group_quote_pdf_gen_wx.cpp | 11 +++++++++++
ledger_pdf_generator_wx.cpp | 15 ++++++++++++++-
wx_table_generator.cpp | 8 ++++++--
wx_table_generator.hpp | 4 ++++
4 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index 0e6e135..9382865 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -685,6 +685,8 @@ void group_quote_pdf_generator_wx::save(std::string const&
output_filename)
bool const has_addl_premium = totals_.total(e_col_additional_premium
) != 0.0;
std::vector<column_parameters> vc;
+ std::vector<int> indices;
+ int visible_column_count = 0;
for(int i = 0; i < e_col_max; ++i)
{
column_definition const& cd = column_definitions[i];
@@ -735,13 +737,22 @@ void group_quote_pdf_generator_wx::save(std::string
const& output_filename)
break;
}
+ indices.push_back(visible_column_count);
cd.visibility_ = visibility;
+ if(oe_shown == visibility)
+ {
+ ++visible_column_count;
+ }
vc.push_back({header, cd.widest_text_, alignment, visibility,
elasticity});
}
+ // Add a one-past-the-end index equal to the last value, because
+ // some member functions of class wx_table_generator expect it.
+ indices.push_back(visible_column_count);
wx_table_generator table_gen
(group_quote_style_tag{}
,vc
+ ,indices
,pdf_writer.dc()
,pdf_writer.get_horz_margin()
,pdf_writer.get_page_width()
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 2241994..5007cf4 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -360,17 +360,29 @@ class using_illustration_table
) const
{
std::vector<column_parameters> vc;
+ std::vector<int> indices;
int column = 0;
+ int visible_column_count = 0;
for(auto const& i : get_table_columns())
{
+ indices.push_back(visible_column_count);
+ if(!should_hide_column(ledger, column))
+ {
+ ++visible_column_count;
+ }
vc.push_back
({i.header
,i.widest_text
,oe_right
- ,should_hide_column(ledger, column++) ? oe_hidden : oe_shown
+ ,should_hide_column(ledger, column) ? oe_hidden : oe_shown
,oe_inelastic
});
+ ++column;
}
+ // Add a one-past-the-end index equal to the last value, because
+ // some member functions of class wx_table_generator expect it.
+ indices.push_back(visible_column_count);
+
// Arguably, should_hide_column() should return an enumerator--see:
// https://lists.nongnu.org/archive/html/lmi/2018-05/msg00026.html
@@ -384,6 +396,7 @@ class using_illustration_table
return wx_table_generator
(illustration_style_tag{}
,vc
+ ,indices
,writer.dc()
,writer.get_horz_margin()
,writer.get_page_width()
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index 02911db..c1d18bc 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -35,11 +35,13 @@
wx_table_generator::wx_table_generator
(group_quote_style_tag // tag not referenced
,std::vector<column_parameters> const& vc
+ ,std::vector<int> const& indices
,wxDC& dc
,int left_margin
,int total_width
)
- :dc_ (dc)
+ :indices_ (indices)
+ ,dc_ (dc)
,left_margin_ (left_margin)
,total_width_ (total_width)
,char_height_ (dc_.GetCharHeight())
@@ -66,11 +68,13 @@ wx_table_generator::wx_table_generator
wx_table_generator::wx_table_generator
(illustration_style_tag // tag not referenced
,std::vector<column_parameters> const& vc
+ ,std::vector<int> const& indices
,wxDC& dc
,int left_margin
,int total_width
)
- :dc_ (dc)
+ :indices_ (indices)
+ ,dc_ (dc)
,left_margin_ (left_margin)
,total_width_ (total_width)
,char_height_ (dc_.GetCharHeight())
diff --git a/wx_table_generator.hpp b/wx_table_generator.hpp
index ea93e92..de5c687 100644
--- a/wx_table_generator.hpp
+++ b/wx_table_generator.hpp
@@ -74,6 +74,7 @@ class wx_table_generator
wx_table_generator
(group_quote_style_tag
,std::vector<column_parameters> const& vc
+ ,std::vector<int> const& indices
,wxDC& dc
,int left_margin
,int total_width
@@ -82,6 +83,7 @@ class wx_table_generator
wx_table_generator
(illustration_style_tag
,std::vector<column_parameters> const& vc
+ ,std::vector<int> const& indices
,wxDC& dc
,int left_margin
,int total_width
@@ -152,6 +154,8 @@ class wx_table_generator
wxDC const& dc() const;
std::vector<table_column_info> const& all_columns() const;
+ std::vector<int> const indices_;
+
wxDC& dc_;
int left_margin_;
- [lmi-commits] [lmi] master updated (12a9a3b -> 9b94a39), Greg Chicares, 2018/08/06
- [lmi-commits] [lmi] master 78fe48b 1/8: Assert a precondition, Greg Chicares, 2018/08/06
- [lmi-commits] [lmi] master a889ef0 2/8: Assert some preconditions, Greg Chicares, 2018/08/06
- [lmi-commits] [lmi] master 1e8b575 3/8: Use private interface in implementation, Greg Chicares, 2018/08/06
- [lmi-commits] [lmi] master eb8cff1 5/8: Generally prefer 'int' to other integer types, Greg Chicares, 2018/08/06
- [lmi-commits] [lmi] master f36110a 6/8: Record visibility in various internal data structures, Greg Chicares, 2018/08/06
- [lmi-commits] [lmi] master a95ec51 4/8: Separate public and private interfaces, Greg Chicares, 2018/08/06
- [lmi-commits] [lmi] master 9b94a39 8/8: Don't pass "hidden" columns into class wx_table_generator, Greg Chicares, 2018/08/06
- [lmi-commits] [lmi] master 4cf72c4 7/8: Establish a mapping from potential to actual (non-hidden) columns,
Greg Chicares <=