lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 02b3f47 4/8: Generalize class wx_table_genera


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 02b3f47 4/8: Generalize class wx_table_generator: pen variations
Date: Thu, 17 May 2018 19:07:09 -0400 (EDT)

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

    Generalize class wx_table_generator: pen variations
    
    Previously, a pen appropriate for group quotes was unconditionally set,
    and had to be overridden for illustrations--after construction, and not
    before, whereas the font was set before construction, and not after. Now
    the ctor sets an appropriate pen for each use case.
---
 ledger_pdf_generator_wx.cpp | 11 ++---------
 wx_table_generator.cpp      | 15 ++++++---------
 wx_table_generator.hpp      |  3 +++
 3 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 79bb8f1..3db5eff 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -67,9 +67,6 @@ LMI_FORCE_LINKING_IN_SITU(ledger_pdf_generator_wx)
 namespace
 {
 
-// Color used for rules and borders in illustrations.
-wxColor const rule_color(0x00, 0x2f, 0x6c);
-
 // This function is also provided in <boost/algorithm/string/predicate.hpp>,
 // but it's arguably not worth adding dependency on this Boost library just for
 // this function.
@@ -392,10 +389,6 @@ class using_illustration_table
         table_gen.use_condensed_style();
         table_gen.align_right();
 
-        // But set the highlight color for drawing separator lines after
-        // creating it to override its default pen.
-        pdf_dc.SetPen(rule_color);
-
         return table_gen;
     }
 };
@@ -962,7 +955,7 @@ class cover_page : public page
         // currently, so do it manually.
         auto& pdf_dc = writer.dc();
 
-        pdf_dc.SetPen(wxPen(rule_color, 2));
+        pdf_dc.SetPen(wxPen(illustration_rule_color, 2));
         pdf_dc.SetBrush(*wxTRANSPARENT_BRUSH);
 
         pdf_dc.DrawRectangle
@@ -1058,7 +1051,7 @@ class page_with_footer : public page
             ,get_footer_lower_html(interpolate_html)
             );
 
-        pdf_dc.SetPen(rule_color);
+        pdf_dc.SetPen(illustration_rule_color);
         pdf_dc.DrawLine
             (frame_horz_margin
             ,y
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index 966cb47..c91bdfc 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -255,22 +255,19 @@ wx_table_generator::wx_table_generator
         {
         case e_illustration_style:
             {
-            ; // do nothing yet
+            dc_.SetPen(illustration_rule_color);
             }
             break;
         case e_group_quote_style:
             {
-            ; // do nothing yet
+            // Set a pen with zero width to make grid lines thin,
+            // and round cap style so that they combine seamlessly.
+            wxPen pen(*wxBLACK, 0);
+            pen.SetCap(wxCAP_ROUND);
+            dc_.SetPen(pen);
             }
             break;
         }
-
-    // Set a pen with 0 width to get the thin lines, and round cap style for 
the
-    // different segments drawn in do_output_single_row() to seamlessly combine
-    // into a single line.
-    wxPen pen(*wxBLACK, 0);
-    pen.SetCap(wxCAP_ROUND);
-    dc_.SetPen(pen);
 }
 
 wx_table_generator::wx_table_generator(wx_table_generator const&) = default;
diff --git a/wx_table_generator.hpp b/wx_table_generator.hpp
index 6d5d733..755248f 100644
--- a/wx_table_generator.hpp
+++ b/wx_table_generator.hpp
@@ -51,6 +51,9 @@ enum enum_pdf_table_style
     ,e_group_quote_style
     };
 
+// Color of rules and borders in illustrations.
+wxColor const illustration_rule_color(0x00, 0x2f, 0x6c);
+
 /// Simplifies outputting tabular data on wxDC.
 ///
 /// Several member functions reuse the same pos_y argument (which is



reply via email to

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