[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 7e64de5 03/12: Make column alignment enumerat
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 7e64de5 03/12: Make column alignment enumerative rather than boolean |
Date: |
Tue, 22 May 2018 17:09:21 -0400 (EDT) |
branch: master
commit 7e64de55cb803a46dba9b9cd2faa8d8f9e571743
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Make column alignment enumerative rather than boolean
This alignment commit, and the preceding elasticity commit, both pass
enumerative arguments into class wx_table_generator::column_info, but
they aren't yet fully used in that nested class and its enclosing class.
---
group_quote_pdf_gen_wx.cpp | 5 ++++-
ledger_pdf_generator_wx.cpp | 1 +
wx_table_generator.cpp | 12 +++++++-----
wx_table_generator.hpp | 1 +
4 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index 2d19be2..2bd49fb 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -678,6 +678,9 @@ void group_quote_pdf_generator_wx::save(std::string const&
output_filename)
oenum_elasticity elasticity = oe_inelastic;
// PDF !! This doesn't fit into the switch logic below.
if(e_col_name == col) {elasticity = oe_elastic;}
+ oenum_alignment_horizontal alignment = oe_center;
+ // PDF !! This doesn't fit into the switch logic below.
+ if(e_col_name == col) {alignment = oe_left;}
// 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
@@ -717,7 +720,7 @@ void group_quote_pdf_generator_wx::save(std::string const&
output_filename)
break;
}
- vc.push_back({header, cd.widest_text_, visibility, elasticity});
+ vc.push_back({header, cd.widest_text_, visibility, elasticity,
alignment});
}
wx_table_generator table_gen
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index b9b781e..39f0028 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -367,6 +367,7 @@ class using_illustration_table
,i.widest_text
,should_hide_column(ledger, column++) ? oe_hidden : oe_shown
,oe_inelastic
+ ,oe_right
});
}
// Arguably, should_hide_column() should return an enumerator--see:
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index 650b2cf..d87c557 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -163,16 +163,18 @@ class wx_table_generator::column_info
{
public:
column_info
- (std::string const& header
- ,int width
- ,oenum_visibility const visibility
- ,oenum_elasticity const elasticity
+ (std::string const& header
+ ,int width
+ ,oenum_visibility const visibility
+ ,oenum_elasticity const elasticity
+ ,oenum_alignment_horizontal const alignment
)
:col_header_ (header)
,col_width_ (width)
,is_hidden_ (oe_hidden == visibility)
,is_variable_width_(oe_elastic == elasticity)
{
+(void)&alignment; // Actually use this, soon.
// Without the 'is_hidden_' condition, this assertion would fire.
// But is_variable_width_ was initialized as (0 == width) before
// this commit, so its meaning has changed. Formerly, all hidden
@@ -361,7 +363,7 @@ LMI_ASSERT(w == dc_.GetMultiLineTextExtent(z.header).x);
all_columns_.push_back
(column_info
- (z.header, width, z.visibility, z.elasticity)
+ (z.header, width, z.visibility, z.elasticity, z.alignment)
);
}
diff --git a/wx_table_generator.hpp b/wx_table_generator.hpp
index 7209ed0..df3b180 100644
--- a/wx_table_generator.hpp
+++ b/wx_table_generator.hpp
@@ -41,6 +41,7 @@ struct column_parameters
std::string const widest_text;
oenum_visibility const visibility;
oenum_elasticity const elasticity;
+ oenum_alignment_horizontal const alignment;
};
/// Specialized styles for first wx_table_generator ctor argument.
- [lmi-commits] [lmi] master updated (a1f29ab -> 40a94aa), Greg Chicares, 2018/05/22
- [lmi-commits] [lmi] master b219dd9 01/12: Note a possible future return-type change, Greg Chicares, 2018/05/22
- [lmi-commits] [lmi] master b725bcb 05/12: Reorder PDF column parameters, Greg Chicares, 2018/05/22
- [lmi-commits] [lmi] master 2c95260 07/12: Prefer 'switch' to 'if' for a two-valued enum, Greg Chicares, 2018/05/22
- [lmi-commits] [lmi] master bd86afe 04/12: Shorten an enumerator's name, Greg Chicares, 2018/05/22
- [lmi-commits] [lmi] master 9e1ac25 09/12: Fold a "ternary" conditional into a switch, Greg Chicares, 2018/05/22
- [lmi-commits] [lmi] master 40a94aa 12/12: Explain why width of an elastic column is initialized to zero, Greg Chicares, 2018/05/22
- [lmi-commits] [lmi] master 6b93e91 11/12: Remove an unneeded auxiliary function, Greg Chicares, 2018/05/22
- [lmi-commits] [lmi] master b232274 02/12: Make column elasticity enumerative rather than boolean, Greg Chicares, 2018/05/22
- [lmi-commits] [lmi] master 7e64de5 03/12: Make column alignment enumerative rather than boolean,
Greg Chicares <=
- [lmi-commits] [lmi] master e2e4ad6 08/12: Remove a temporary assertion that is no longer useful, Greg Chicares, 2018/05/22
- [lmi-commits] [lmi] master 637d535 06/12: Rework PDF column formatting in terms of "elasticity", Greg Chicares, 2018/05/22
- [lmi-commits] [lmi] master 6076b33 10/12: Simplify code; rewrite documentation, Greg Chicares, 2018/05/22