From cdcf02d1a4703d7c146b5479a751ae18180abac6 Mon Sep 17 00:00:00 2001 From: Andreas Butti Date: Mon, 18 Feb 2019 18:25:25 +0100 Subject: [PATCH] fixes #906 --- src/gui/Layout.cpp | 59 ++++++++++++++++++++++++++++++---------- src/gui/LayoutMapper.cpp | 5 ---- 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/src/gui/Layout.cpp b/src/gui/Layout.cpp index d8b15535..c6a6d84a 100644 --- a/src/gui/Layout.cpp +++ b/src/gui/Layout.cpp @@ -9,6 +9,27 @@ #include "gui/LayoutMapper.h" +/** + * Padding outside the pages, including shadow + */ +const int XOURNAL_PADDING = 10; + +/** + * Padding outside the pages, if additional padding is set + */ +const int XOURNAL_PADDING_FREE_SPACE = 150; + +/** + * Allowance for shadow between page pairs in paired page mode + */ +const int XOURNAL_ROOM_FOR_SHADOW = 3; + +/** + * Padding between the pages + */ +const int XOURNAL_PADDING_BETWEEN = 15; + + Layout::Layout(XournalView* view, ScrollHandling* scrollHandling) : view(view), scrollHandling(scrollHandling), @@ -174,21 +195,6 @@ double Layout::getLayoutWidth() return layoutWidth; } -/** - * Padding outside the pages, including shadow - */ -const int XOURNAL_PADDING = 10; - -/** - * Allowance for shadow between page pairs in paired page mode - */ -const int XOURNAL_ROOM_FOR_SHADOW = 3; - -/** - * Padding between the pages - */ -const int XOURNAL_PADDING_BETWEEN = 15; - void Layout::layoutPages() { XOJ_CHECK_TYPE(Layout); @@ -238,6 +244,19 @@ void Layout::layoutPages() int x = XOURNAL_PADDING; int y = XOURNAL_PADDING; + bool verticalSpace = settings->getAddVerticalSpace(); + bool horizontalSpace = settings->getAddHorizontalSpace(); + + if (verticalSpace) + { + x += XOURNAL_PADDING_FREE_SPACE; + } + + if (horizontalSpace) + { + y += XOURNAL_PADDING_FREE_SPACE; + } + // Iterate over ALL possible rows and columns and let the mapper tell us what page, if any, is found there. for (int r = 0; r < rows; r++) { @@ -308,6 +327,16 @@ void Layout::layoutPages() totalHeight += sizeRow[r]; } + if (verticalSpace) + { + totalWidth += XOURNAL_PADDING_FREE_SPACE * 2; + } + + if (horizontalSpace) + { + totalHeight += XOURNAL_PADDING_FREE_SPACE * 2; + } + this->setLayoutSize(totalWidth, totalHeight); this->view->pagePosition->update(this->view->viewPages, len, totalHeight); } diff --git a/src/gui/LayoutMapper.cpp b/src/gui/LayoutMapper.cpp index 8d97147d..4cf079a0 100644 --- a/src/gui/LayoutMapper.cpp +++ b/src/gui/LayoutMapper.cpp @@ -41,11 +41,6 @@ LayoutMapper::LayoutMapper(int numPages, Settings* settings) int pages = numPages; // get from user settings: - - // TODO: Use these again? - bool verticalSpace = settings->getAddVerticalSpace(); - // TODO: Use these again? - bool horizontalSpace = settings->getAddHorizontalSpace(); bool isPairedPages = settings->isShowPairedPages(); int numCols = settings->getViewColumns(); int numRows = settings->getViewRows();