lmi-commits
[Top][All Lists]
Advanced

[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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]