From f87d7c3fce95b33dbfd0cfad155053fe76fc4694 Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Mon, 22 Sep 2014 21:25:41 +0200 Subject: [PATCH] Book formatter: Do not insert last page if it's empty, code cleanup --- apps/openmw/mwgui/formatting.cpp | 5 +++-- apps/openmw/mwgui/formatting.hpp | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/formatting.cpp b/apps/openmw/mwgui/formatting.cpp index f7188c8b6..9c918e626 100644 --- a/apps/openmw/mwgui/formatting.cpp +++ b/apps/openmw/mwgui/formatting.cpp @@ -233,7 +233,8 @@ namespace MWGui } // insert last page - pag << Paginator::Page(pag.getStartTop(), pag.getStartTop() + pag.getPageHeight()); + if (pag.getStartTop() != pag.getCurrentTop()) + pag << Paginator::Page(pag.getStartTop(), pag.getStartTop() + pag.getPageHeight()); paper->setSize(paper->getWidth(), pag.getCurrentTop()); @@ -301,7 +302,7 @@ namespace MWGui mPaginator.setStartTop(newStartTop); } - mPaginator.modifyCurrentTop(getHeight()); + mPaginator.setCurrentTop(newTop); } int GraphicElement::pageSplit() diff --git a/apps/openmw/mwgui/formatting.hpp b/apps/openmw/mwgui/formatting.hpp index f119422c9..cf55b36fb 100644 --- a/apps/openmw/mwgui/formatting.hpp +++ b/apps/openmw/mwgui/formatting.hpp @@ -81,8 +81,6 @@ namespace MWGui void setStartTop(int top) { mStartTop = top; } void setCurrentTop(int top) { mCurrentTop = top; } - void modifyStartTop(int mod) { mStartTop += mod; } - void modifyCurrentTop(int mod) { mCurrentTop += mod; } Paginator & operator<<(const Page & page) {