[glom] PrintLayout: Standard: Do not move to next page unnecessary.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] PrintLayout: Standard: Do not move to next page unnecessary.
- Date: Thu, 13 Oct 2011 19:32:36 +0000 (UTC)
commit a0c887178a6e1d2f78818d6c5f98ee340ff39d6a
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Oct 13 21:32:26 2011 +0200
PrintLayout: Standard: Do not move to next page unnecessary.
* glom/print_layout/canvas_print_layout.cc: get_page_for_y(): Correct this
calculation.
ChangeLog | 7 +++++++
glom/print_layout/canvas_print_layout.cc | 11 +++++------
2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 387d70b..d51af78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2011-10-13 Murray Cumming <murrayc murrayc com>
+ PrintLayout: Standard: Do not move to next page unnecessary.
+
+ * glom/print_layout/canvas_print_layout.cc: get_page_for_y(): Correct this
+ calculation.
+
+2011-10-13 Murray Cumming <murrayc murrayc com>
+
About dialog: Show the version number.
* glom/application.cc: Use set_version().
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index 6e13492..43c0f40 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -1232,7 +1232,6 @@ void Canvas_PrintLayout::move_items_below_item(const Glib::RefPtr<CanvasLayoutIt
//Move it down:
y += offset;
derived->set_xy(x, y);
-
//Move it some more if necessary:
y = move_fully_to_page(derived);
@@ -1254,13 +1253,11 @@ guint Canvas_PrintLayout::get_page_for_y(double y) const
const double page_height = get_page_height();
if(!page_height)
return 0; //Avoid a division by zero.
-
+
const double pages = y / (double)page_height;
double pages_integral = 0;
- const double pages_fractional = modf(pages, &pages_integral);
-
- const guint pages_full = (guint)pages_integral + (pages_fractional ? 1 : 0);
- return pages_full;
+ modf(pages, &pages_integral);
+ return pages_integral;
}
double Canvas_PrintLayout::move_fully_to_page(const Glib::RefPtr<CanvasLayoutItem>& item)
@@ -1285,6 +1282,8 @@ double Canvas_PrintLayout::move_fully_to_page(const Glib::RefPtr<CanvasLayoutIte
bool moved = false;
const guint current_page = get_page_for_y(y);
const double usable_page_start = current_page * page_height + top_margin;
+ //std::cout << G_STRFUNC << ": debug: current_page=" << current_page << ", usable_page_start =" << usable_page_start << std::endl;
+
if(y < usable_page_start) //If it is in the top margin:
{
//Move it to the end of the top margin:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]