lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master f36110a 6/8: Record visibility in various int


From: Greg Chicares
Subject: [lmi-commits] [lmi] master f36110a 6/8: Record visibility in various internal data structures
Date: Mon, 6 Aug 2018 18:36:24 -0400 (EDT)

branch: master
commit f36110aa4d3227a1f93ba7666ed85d399aeb8adc
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Record visibility in various internal data structures
    
    Added a (mutable) member of type oenum_visibility to
     - struct column_definition, for group quotes, and to
     - struct illustration_table_column, for illustrations,
    complementing the similar member in struct column_parameters. Perhaps
    these three structs can someday be merged into one; until then, there
    is no good reason to restrict the accessibility of this boolean datum
    to class wx_table_generator.
---
 group_quote_pdf_gen_wx.cpp  |  9 ++++++---
 ledger_pdf_generator_wx.cpp | 20 +++++++++++++++++---
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index 6546fc5..0e6e135 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -36,7 +36,7 @@
 #include "math_functions.hpp"           // outward_quotient()
 #include "mc_enum_types_aux.hpp"        // is_subject_to_ill_reg()
 #include "miscellany.hpp"               // split_into_lines()
-#include "oecumenic_enumerations.hpp"   // oenum_format_style
+#include "oecumenic_enumerations.hpp"
 #include "path_utility.hpp"             // fs::path inserter
 #include "pdf_writer_wx.hpp"
 #include "ssize_lmi.hpp"
@@ -239,12 +239,14 @@ enum_group_quote_columns const e_first_totalled_column = 
e_col_basic_face_amount
 
 struct column_definition
 {
-    char const* header_;
-    char const* widest_text_; // PDF !! Empty string means variable width.
+    char const*              header_;
+    char const*              widest_text_; // PDF !! Empty string means 
variable width.
+    mutable oenum_visibility visibility_ {oe_shown};
 };
 
 // Headers of premium columns include dynamically-determined payment
 // mode, so they're actually format strings.
+// PDF !! This ought not to be a global variable.
 
 column_definition const column_definitions[] =
     {{"Part#"                          ,            "99999"   } // e_col_number
@@ -733,6 +735,7 @@ void group_quote_pdf_generator_wx::save(std::string const& 
output_filename)
                 break;
             }
 
+        cd.visibility_ = visibility;
         vc.push_back({header, cd.widest_text_, alignment, visibility, 
elasticity});
         }
 
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 3b237a9..2241994 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -36,6 +36,7 @@
 #include "ledger_invariant.hpp"
 #include "ledger_variant.hpp"
 #include "miscellany.hpp"               // lmi_tolower(), page_count()
+#include "oecumenic_enumerations.hpp"
 #include "pdf_writer_wx.hpp"
 #include "wx_table_generator.hpp"
 
@@ -324,9 +325,10 @@ class using_illustration_table
     // Description of a single table column.
     struct illustration_table_column
     {
-        std::string const variable_name;
-        std::string const header;
-        std::string const widest_text;
+        std::string const        variable_name;
+        std::string const        header;
+        std::string const        widest_text;
+        mutable oenum_visibility visibility {oe_shown};
     };
 
     using illustration_table_columns = std::vector<illustration_table_column>;
@@ -1460,6 +1462,12 @@ class numeric_summary_table_cell
                 case oe_render:
                     for(std::size_t j = 0; j < columns.size(); ++j)
                         {
+                        columns[j].visibility =
+                            should_hide_column(ledger, j)
+                            ? oe_hidden
+                            : oe_shown
+                            ;
+
                         std::string const variable_name = 
columns[j].variable_name;
 
                         // The illustration reg calls for values at certain
@@ -1597,6 +1605,12 @@ class page_with_tabular_report
                 {
                 for(std::size_t j = 0; j < columns.size(); ++j)
                     {
+                    columns[j].visibility =
+                        should_hide_column(ledger, j)
+                        ? oe_hidden
+                        : oe_shown
+                        ;
+
                     std::string const variable_name = columns[j].variable_name;
 
                     // Special hack for the dummy columns used in some reports,



reply via email to

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