[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [6585] Refactor: move total table cells drawing into wx_ta
From: |
gchicares |
Subject: |
[lmi-commits] [6585] Refactor: move total table cells drawing into wx_table_generator (VZ ) |
Date: |
Fri, 13 May 2016 13:52:34 +0000 (UTC) |
Revision: 6585
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6585
Author: chicares
Date: 2016-05-13 13:52:34 +0000 (Fri, 13 May 2016)
Log Message:
-----------
Refactor: move total table cells drawing into wx_table_generator (VZ)
Modified Paths:
--------------
lmi/trunk/group_quote_pdf_gen_wx.cpp
lmi/trunk/wx_table_generator.cpp
lmi/trunk/wx_table_generator.hpp
Modified: lmi/trunk/group_quote_pdf_gen_wx.cpp
===================================================================
--- lmi/trunk/group_quote_pdf_gen_wx.cpp 2016-05-13 13:49:15 UTC (rev
6584)
+++ lmi/trunk/group_quote_pdf_gen_wx.cpp 2016-05-13 13:52:34 UTC (rev
6585)
@@ -1341,32 +1341,12 @@
);
std::pair<int, oenum_format_style> const f(num_dec, oe_format_normal);
- wxRect const cell_rect = table_gen.cell_rect(col, y);
- {
- wxDCPenChanger set_transparent_pen(pdf_dc, *wxTRANSPARENT_PEN);
- wxDCBrushChanger set_grey_brush(pdf_dc, *wxLIGHT_GREY_BRUSH);
- pdf_dc.DrawRectangle(cell_rect);
- }
-
- wxRect const text_rect
- (cell_rect.x + cell_margin_x
- ,y_text
- ,cell_rect.width - 2 * cell_margin_x
- ,cell_rect.height
+ table_gen.output_highlighted_cell
+ (col
+ ,y
+ ,"$"
+ ,ledger_format(totals_.total(col), f)
);
-
- pdf_dc.DrawLabel
- ("$"
- ,text_rect
- ,wxALIGN_LEFT
- );
- pdf_dc.DrawLabel
- (ledger_format(totals_.total(col), f)
- ,text_rect
- ,wxALIGN_RIGHT
- );
-
- table_gen.output_vert_separator(col, y);
}
table_gen.output_vert_separator(e_col_max, y);
Modified: lmi/trunk/wx_table_generator.cpp
===================================================================
--- lmi/trunk/wx_table_generator.cpp 2016-05-13 13:49:15 UTC (rev 6584)
+++ lmi/trunk/wx_table_generator.cpp 2016-05-13 13:52:34 UTC (rev 6585)
@@ -319,3 +319,33 @@
do_output_horz_separator(left_margin_, x, *pos_y);
}
+void wx_table_generator::output_highlighted_cell
+ (std::size_t column
+ ,int y
+ ,std::string const& lhs
+ ,std::string const& rhs
+ )
+{
+ wxRect const total_rect = cell_rect(column, y);
+ {
+ wxDCPenChanger set_transparent_pen(dc_, *wxTRANSPARENT_PEN);
+ wxDCBrushChanger set_grey_brush(dc_, *wxLIGHT_GREY_BRUSH);
+ dc_.DrawRectangle(total_rect);
+ }
+
+ wxRect text_rect = total_rect.Deflate(dc_.GetCharWidth(), 0);
+ text_rect.Offset(0, char_height_);
+
+ dc_.DrawLabel
+ (lhs
+ ,text_rect
+ ,wxALIGN_LEFT
+ );
+ dc_.DrawLabel
+ (rhs
+ ,text_rect
+ ,wxALIGN_RIGHT
+ );
+
+ output_vert_separator(column, y);
+}
Modified: lmi/trunk/wx_table_generator.hpp
===================================================================
--- lmi/trunk/wx_table_generator.hpp 2016-05-13 13:49:15 UTC (rev 6584)
+++ lmi/trunk/wx_table_generator.hpp 2016-05-13 13:52:34 UTC (rev 6585)
@@ -66,6 +66,17 @@
// same number of them as the number of columns.
void output_row(int* pos_y, std::string const* values);
+ // Render a single highlighted (by shading its background) cell with the
+ // given strings displayed in it left and right-aligned respectively.
+ // This is used for aggregate amounts display currently, so the LHS string
+ // is always just "$" currently.
+ void output_highlighted_cell
+ (std::size_t column
+ ,int y
+ ,std::string const& lhs
+ ,std::string const& rhs
+ );
+
// Return the height of a single table row.
int row_height() const {return row_height_;}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [6585] Refactor: move total table cells drawing into wx_table_generator (VZ ),
gchicares <=