[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 13f9424 7/7: Make column visibility enumerati
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 13f9424 7/7: Make column visibility enumerative rather than boolean |
Date: |
Sat, 19 May 2018 12:54:41 -0400 (EDT) |
branch: master
commit 13f942441d6dd61f0520a90d91912c9508283302
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Make column visibility enumerative rather than boolean
---
group_quote_pdf_gen_wx.cpp | 8 ++++----
ledger_pdf_generator_wx.cpp | 2 +-
wx_table_generator.cpp | 12 ++++++++----
wx_table_generator.hpp | 6 +++---
4 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index b85b606..812e73a 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -674,7 +674,7 @@ void group_quote_pdf_generator_wx::save(std::string const&
output_filename)
{
column_definition const& cd = column_definitions[col];
std::string header;
- bool hidden = false;
+ oenum_visibility visibility = oe_shown;
// The cast is only used to ensure that if any new elements are added
// to the enum, the compiler would warn about their values not being
@@ -683,7 +683,7 @@ void group_quote_pdf_generator_wx::save(std::string const&
output_filename)
{
case e_col_supplemental_face_amount:
case e_col_total_face_amount:
- if(!has_suppl_amount) {hidden = true;}
+ if(!has_suppl_amount) {visibility = oe_hidden;}
// Fall through
case e_col_number:
case e_col_name:
@@ -695,7 +695,7 @@ void group_quote_pdf_generator_wx::save(std::string const&
output_filename)
break;
case e_col_additional_premium:
case e_col_total_premium:
- if(!has_addl_premium) {hidden = true;}
+ if(!has_addl_premium) {visibility = oe_hidden;}
// Fall through
case e_col_basic_premium:
{
@@ -714,7 +714,7 @@ void group_quote_pdf_generator_wx::save(std::string const&
output_filename)
break;
}
- vc.push_back({header, cd.widest_text_, hidden});
+ vc.push_back({header, cd.widest_text_, visibility});
}
wx_table_generator table_gen
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index f02a000..526d5f3 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -365,7 +365,7 @@ class using_illustration_table
vc.push_back
({i.header
,i.widest_text
- ,hide_column(ledger, column++)
+ ,hide_column(ledger, column++) ? oe_hidden : oe_shown
});
}
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index cac45e6..6212012 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -162,10 +162,14 @@
class wx_table_generator::column_info
{
public:
- column_info(std::string const& header, int width, bool hidden)
+ column_info
+ (std::string const& header
+ ,int width
+ ,oenum_visibility const visibility
+ )
:col_header_ (header)
,col_width_ (width)
- ,is_hidden_ (hidden)
+ ,is_hidden_ (oe_hidden == visibility)
,is_variable_width_(0 == width)
{
}
@@ -313,7 +317,7 @@ void wx_table_generator::enroll_column(column_parameters
const& z)
// other member functions calculate total width by accumulating
// the widths of all columns, whether hidden or not.
int width = 0;
- if(!z.hidden)
+ if(oe_shown == z.visibility)
{
wxDCFontChanger header_font_setter(dc_);
if(use_bold_headers_)
@@ -347,7 +351,7 @@ LMI_ASSERT(w == dc_.GetMultiLineTextExtent(z.header).x);
}
}
- all_columns_.push_back(column_info(z.header, width, z.hidden));
+ all_columns_.push_back(column_info(z.header, width, z.visibility));
}
/// Return the font used for the headers.
diff --git a/wx_table_generator.hpp b/wx_table_generator.hpp
index 81d2ef3..b89ac1d 100644
--- a/wx_table_generator.hpp
+++ b/wx_table_generator.hpp
@@ -37,9 +37,9 @@
struct column_parameters
{
- std::string const header;
- std::string const widest_text;
- bool const hidden;
+ std::string const header;
+ std::string const widest_text;
+ oenum_visibility const visibility;
};
/// Specialized styles for first wx_table_generator ctor argument.
- [lmi-commits] [lmi] master updated (b8170c7 -> 13f9424), Greg Chicares, 2018/05/19
- [lmi-commits] [lmi] master 0b44727 2/7: Improve const correctness, Greg Chicares, 2018/05/19
- [lmi-commits] [lmi] master 448b5fe 6/7: Add several enumerations for column styles, Greg Chicares, 2018/05/19
- [lmi-commits] [lmi] master c665c1d 4/7: Refine documentation, Greg Chicares, 2018/05/19
- [lmi-commits] [lmi] master ac83c23 5/7: Spell 'center' one way only, Greg Chicares, 2018/05/19
- [lmi-commits] [lmi] master 49ae301 3/7: Reverse sense of certain conditionals for readability, Greg Chicares, 2018/05/19
- [lmi-commits] [lmi] master 13f9424 7/7: Make column visibility enumerative rather than boolean,
Greg Chicares <=
- [lmi-commits] [lmi] master 02fec5a 1/7: Pluralize name s/output_header/output_headers/, Greg Chicares, 2018/05/19