[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 449287e 1/6: Rename /lines_per_page_*/ variab
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 449287e 1/6: Rename /lines_per_page_*/ variables, all of which denote a maximum |
Date: |
Tue, 4 Sep 2018 20:48:29 -0400 (EDT) |
branch: master
commit 449287e343907b0546b8b51c08ff1e7af93db982
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Rename /lines_per_page_*/ variables, all of which denote a maximum
---
ledger_pdf_generator_wx.cpp | 6 +++---
report_table.cpp | 20 ++++++++++----------
report_table.hpp | 4 ++--
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index b04c6c9..7d9ac47 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -1776,11 +1776,11 @@ class page_with_tabular_report
,oe_only_measure
);
- int const lines_per_page = (get_footer_top() - pos_y) /
table_gen.row_height();
+ int const max_lines_per_page = (get_footer_top() - pos_y) /
table_gen.row_height();
int const rows_per_group = wx_table_generator::rows_per_group;
- if(lines_per_page < rows_per_group)
+ if(max_lines_per_page < rows_per_group)
{
// We can't afford to continue in this case as we can never output
// the table as the template simply doesn't leave enough space for
@@ -1788,7 +1788,7 @@ class page_with_tabular_report
throw std::runtime_error("no space left for tabular report");
}
- paginator z(ledger.GetMaxLength(), rows_per_group, lines_per_page);
+ paginator z(ledger.GetMaxLength(), rows_per_group, max_lines_per_page);
// "- 1": return the number of *extra* pages.
return z.page_count() - 1;
}
diff --git a/report_table.cpp b/report_table.cpp
index 56cf53a..d42c2e3 100644
--- a/report_table.cpp
+++ b/report_table.cpp
@@ -175,17 +175,17 @@ std::vector<int> set_column_widths
return w;
}
-/// Preconditions: 0 <= total_rows && 0 < rows_per_group <= lines_per_page
+/// Preconditions: 0 <= total_rows && 0 < rows_per_group <= max_lines_per_page
-paginator::paginator(int total_rows, int rows_per_group, int lines_per_page)
- :total_rows_ {total_rows}
- ,rows_per_group_ {rows_per_group}
- ,lines_per_page_ {lines_per_page}
- ,page_count_ {1}
+paginator::paginator(int total_rows, int rows_per_group, int
max_lines_per_page)
+ :total_rows_ {total_rows}
+ ,rows_per_group_ {rows_per_group}
+ ,max_lines_per_page_ {max_lines_per_page}
+ ,page_count_ {1}
{
LMI_ASSERT(0 <= total_rows_);
- LMI_ASSERT(0 < rows_per_group_ );
- LMI_ASSERT( rows_per_group_ <= lines_per_page_);
+ LMI_ASSERT(0 < rows_per_group_ );
+ LMI_ASSERT( rows_per_group_ <= max_lines_per_page_);
// If there are zero rows of data, then one empty page is wanted.
if(0 == total_rows_)
@@ -198,7 +198,7 @@ paginator::paginator(int total_rows, int rows_per_group,
int lines_per_page)
int const lines_per_group = rows_per_group_ + 1;
// "+ 1": no blank-line separator after the last group.
- int const groups_per_page = (lines_per_page_ + 1) / lines_per_group;
+ int const groups_per_page = (max_lines_per_page_ + 1) / lines_per_group;
int const rows_per_page = rows_per_group_ * groups_per_page;
@@ -209,7 +209,7 @@ paginator::paginator(int total_rows, int rows_per_group,
int lines_per_page)
if(1 < page_count_)
{
auto const rows_on_last_page = total_rows_ - (page_count_ - 1) *
rows_per_page;
- auto const free_lines = lines_per_page_ - lines_per_group *
groups_per_page;
+ auto const free_lines = max_lines_per_page_ - lines_per_group *
groups_per_page;
LMI_ASSERT(free_lines < rows_per_group_);
if(rows_on_last_page <= free_lines)
{
diff --git a/report_table.hpp b/report_table.hpp
index fb1ad77..1a1f2bd 100644
--- a/report_table.hpp
+++ b/report_table.hpp
@@ -137,14 +137,14 @@ std::vector<int> LMI_SO set_column_widths
class LMI_SO paginator
{
public:
- paginator(int total_rows, int rows_per_group, int lines_per_page);
+ paginator(int total_rows, int rows_per_group, int max_lines_per_page);
int page_count() const;
private:
int const total_rows_;
int const rows_per_group_;
- int const lines_per_page_;
+ int const max_lines_per_page_;
int page_count_;
};
- [lmi-commits] [lmi] master updated (b287dea -> 8c51f22), Greg Chicares, 2018/09/04
- [lmi-commits] [lmi] master 449287e 1/6: Rename /lines_per_page_*/ variables, all of which denote a maximum,
Greg Chicares <=
- [lmi-commits] [lmi] master 614f824 2/6: Fix typographical errors in comments, Greg Chicares, 2018/09/04
- [lmi-commits] [lmi] master 567e5ac 4/6: Specify unused arguments more clearly, Greg Chicares, 2018/09/04
- [lmi-commits] [lmi] master 0a191a7 3/6: Prefer to avoid '/* */' where a good alternative exists, Greg Chicares, 2018/09/04
- [lmi-commits] [lmi] master d9ec2b9 5/6: Temporarily suppress a failing assertion, Greg Chicares, 2018/09/04
- [lmi-commits] [lmi] master 8c51f22 6/6: Remove workarounds for old compilers, Greg Chicares, 2018/09/04