[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
- [lmi-commits] [lmi] master updated (a738b9f -> d31fa0f), Greg Chicares, 2018/05/17
- [lmi-commits] [lmi] master 2fd74af 3/8: Generalize class wx_table_generator, Greg Chicares, 2018/05/17
- [lmi-commits] [lmi] master 02b3f47 4/8: Generalize class wx_table_generator: pen variations,
Greg Chicares <=
- [lmi-commits] [lmi] master d31fa0f 8/8: Calculate header dimensions OAOO, Greg Chicares, 2018/05/17
- [lmi-commits] [lmi] master 6d8e0ea 1/8: Move most members from derived to base class, Greg Chicares, 2018/05/17
- [lmi-commits] [lmi] master 5ad29f9 6/8: Generalize class wx_table_generator more robustly, Greg Chicares, 2018/05/17
- [lmi-commits] [lmi] master 8d75fd0 2/8: Eradicate unneeded class illustration_table_generator, Greg Chicares, 2018/05/17
- [lmi-commits] [lmi] master 3c9cc09 5/8: Generalize class wx_table_generator: row height and boolean flags, Greg Chicares, 2018/05/17
- [lmi-commits] [lmi] master d270b21 7/8: Generally avoid regex /, $/, Greg Chicares, 2018/05/17