r24959 by jghali - Code readability improvement

scribus-commit scribus-commit at lists.scribus.net
Mon Feb 21 23:07:53 UTC 2022


Author: jghali
Date: Mon Feb 21 23:07:52 2022
New Revision: 24959

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24959
Log:
Code readability improvement

Modified:
    branches/Version15x/Scribus/scribus/ui/pagepalette_pages.cpp

Modified: branches/Version15x/Scribus/scribus/ui/pagepalette_pages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24959&path=/branches/Version15x/Scribus/scribus/ui/pagepalette_pages.cpp
==============================================================================
--- branches/Version15x/Scribus/scribus/ui/pagepalette_pages.cpp	(original)
+++ branches/Version15x/Scribus/scribus/ui/pagepalette_pages.cpp	Mon Feb 21 23:07:52 2022
@@ -239,15 +239,16 @@
 		return;
 	}
 
+	const PageSet& currentPageSet = currView->m_doc->pageSets()[currView->m_doc->pagePositioning()];
 	pageLayout->updateLayoutSelector(currView->m_doc->pageSets());
 	pageLayout->selectItem(currView->m_doc->pagePositioning());
-	pageLayout->firstPage->setCurrentIndex(currView->m_doc->pageSets()[currView->m_doc->pagePositioning()].FirstPage);
+	pageLayout->firstPage->setCurrentIndex(currentPageSet.FirstPage);
 	pageView->m_pageCount = currView->m_doc->DocPages.count();
-
-	int counter = currView->m_doc->pageSets()[currView->m_doc->pagePositioning()].FirstPage;
-	int cols = currView->m_doc->pageSets()[currView->m_doc->pagePositioning()].Columns;
-	int rows = (currView->m_doc->DocPages.count()+counter) / currView->m_doc->pageSets()[currView->m_doc->pagePositioning()].Columns;
-	if (((currView->m_doc->DocPages.count()+counter) % currView->m_doc->pageSets()[currView->m_doc->pagePositioning()].Columns) != 0)
+	
+	int counter = currentPageSet.FirstPage;
+	int cols = currentPageSet.Columns;
+	int rows = (currView->m_doc->DocPages.count() + counter) / currentPageSet.Columns;
+	if (((currView->m_doc->DocPages.count() + counter) % currentPageSet.Columns) != 0)
 		rows++;
 	int rowcounter = 0;
 	int colmult, rowmult, coladd, rowadd;
@@ -285,7 +286,7 @@
 	pageView->m_rowadd = rowadd;
 	pageView->m_rowmult = rowmult;
 	pageView->m_firstPage = counter;
-	pageView->m_cols = currView->m_doc->pageSets()[currView->m_doc->pagePositioning()].Columns;
+	pageView->m_cols = currentPageSet.Columns;
 
 	int columnWidth = pix.width() * pageView->devicePixelRatioF();
 	int rowHeight = pix.height() * pageView->devicePixelRatioF();
@@ -308,7 +309,7 @@
 		else
 			pageView->setRowHeight(rowcounter * rowmult + rowadd, rowHeight + rowHeight5);
 		counter++;
-		if (counter > currView->m_doc->pageSets()[currView->m_doc->pagePositioning()].Columns - 1)
+		if (counter > currentPageSet.Columns - 1)
 		{
 			counter = 0;
 			rowcounter++;




More information about the scribus-commit mailing list