r14080 by jghali - #8417 : bleed is not handled correctly on master pages - additional fix for ps and pdf export - reduce code duplication

scribus-commit scribus-commit at lists.scribus.net
Thu Oct 1 20:55:47 CEST 2009


Revision: 14080
Author: jghali
Date: 2009-10-01T18:55:45.080963Z
Commit message: #8417 : bleed is not handled correctly on master pages
- additional fix for ps and pdf export
- reduce code duplication

Changeset: 
M  /trunk/Scribus/scribus/pdflib_core.cpp
M  /trunk/Scribus/scribus/pslib.cpp
M  /trunk/Scribus/scribus/scribusdoc.cpp
M  /trunk/Scribus/scribus/scribusdoc.h

Diffs:
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp	(revision 14079)
+++ scribus/pdflib_core.cpp	(revision 14080)
@@ -5130,36 +5130,20 @@
 
 void PDFLibCore::getBleeds(const Page* page, double &left, double &right)
 {
-	if (doc.pageSets[doc.currentPageLayout].Columns == 1)
-	{
-		right = Options.bleeds.Right;
-		left  = Options.bleeds.Left;
-	}
-	else
-	{
-		if (doc.locationOfPage(page->pageNr()) == LeftPage)
-		{
-			right = Options.bleeds.Left;
-			left = Options.bleeds.Right;
-		}
-		else if (doc.locationOfPage(page->pageNr()) == RightPage)
-		{
-			right = Options.bleeds.Right;
-			left = Options.bleeds.Left;
-		}
-		else
-		{
-			right = Options.bleeds.Left;
-			left = Options.bleeds.Left;
-		}
-	}
+	MarginStruct values;
+	doc.getBleeds(page, Options.bleeds, values);
+	left   = values.Left;
+	right  = values.Right;
 }
 
 void PDFLibCore::getBleeds(const Page* page, double &left, double &right, double &bottom, double& top)
 {
-	getBleeds(page, left, right);
-	bottom = Options.bleeds.Bottom;
-	top    = Options.bleeds.Top;
+	MarginStruct values;
+	doc.getBleeds(page, Options.bleeds, values);
+	left   = values.Left;
+	right  = values.Right;
+	bottom = values.Bottom;
+	top    = values.Top;
 }
 
 QString PDFLibCore::PDF_TransparenzFill(PageItem *currItem)
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 14079)
+++ scribus/scribusdoc.cpp	(revision 14080)
@@ -4361,7 +4361,6 @@
 	return -1.0;
 }
 
-
 void ScribusDoc::getBleeds(int pageNumber, MarginStruct &bleedData)
 {
 	if (pageNumber >= 0 && pageNumber < Pages->size())
@@ -4370,15 +4369,19 @@
 		qCritical() << "Attempting to get bleeds for non-existant page";
 }
 
+void ScribusDoc::getBleeds(const Page* page, MarginStruct& bleedData)
+{
+	getBleeds(page, bleeds, bleedData);
+}
 
-void ScribusDoc::getBleeds(Page* page, MarginStruct& bleedData)
+void ScribusDoc::getBleeds(const Page* page, const MarginStruct& baseValues, MarginStruct& bleedData)
 {
-	bleedData.Bottom = bleeds.Bottom;
-	bleedData.Top = bleeds.Top;
+	bleedData.Bottom = baseValues.Bottom;
+	bleedData.Top    = baseValues.Top;
 	if (pageSets[currentPageLayout].Columns == 1)
 	{
-		bleedData.Right = bleeds.Right;
-		bleedData.Left = bleeds.Left;
+		bleedData.Right = baseValues.Right;
+		bleedData.Left  = baseValues.Left;
 	}
 	else
 	{
@@ -4394,18 +4397,18 @@
 
 		if (pageLocation == LeftPage)
 		{
-			bleedData.Right = bleeds.Left;
-			bleedData.Left = bleeds.Right;
+			bleedData.Right = baseValues.Left;
+			bleedData.Left  = baseValues.Right;
 		}
 		else if (pageLocation == RightPage)
 		{
-			bleedData.Right = bleeds.Right;
-			bleedData.Left = bleeds.Left;
+			bleedData.Right = baseValues.Right;
+			bleedData.Left  = baseValues.Left;
 		}
 		else
 		{
-			bleedData.Right = bleeds.Left;
-			bleedData.Left = bleeds.Left;
+			bleedData.Right = baseValues.Left;
+			bleedData.Left  = baseValues.Left;
 		}
 	}
 }
@@ -11158,3 +11161,4 @@
 	emit rotationMode(rotMode);
 }
 
+
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(revision 14079)
+++ scribus/scribusdoc.h	(revision 14080)
@@ -692,7 +692,8 @@
 	double getXOffsetForPage(const int);
 	double getYOffsetForPage(const int);
 	void getBleeds(int pageNumber, MarginStruct& bleedData);
-	void getBleeds(Page* page, MarginStruct& bleedData);
+	void getBleeds(const Page* page, MarginStruct& bleedData);
+	void getBleeds(const Page* page, const MarginStruct& baseValues, MarginStruct& bleedData);
 	
 	/**
 	 * @brief Item type conversion functions
Index: scribus/pslib.cpp
===================================================================
--- scribus/pslib.cpp	(revision 14079)
+++ scribus/pslib.cpp	(revision 14080)
@@ -4537,36 +4537,20 @@
 
 void PSLib::GetBleeds(Page* page, double& left, double& right)
 {
-	if (m_Doc->pageSets[m_Doc->currentPageLayout].Columns == 1)
-	{
-		right = Options.bleeds.Right;
-		left  = Options.bleeds.Left;
-	}
-	else
-	{
-		if (m_Doc->locationOfPage(page->pageNr()) == LeftPage)
-		{
-			right = Options.bleeds.Right;
-			left  = Options.bleeds.Left;
-		}
-		else if (m_Doc->locationOfPage(page->pageNr()) == RightPage)
-		{
-			right = Options.bleeds.Left;
-			left  = Options.bleeds.Right;
-		}
-		else
-		{
-			right = Options.bleeds.Left;
-			left  = Options.bleeds.Left;
-		}
-	}
+	MarginStruct values;
+	m_Doc->getBleeds(page, Options.bleeds, values);
+	left   = values.Left;
+	right  = values.Right;
 }
 
 void PSLib::GetBleeds(Page* page, double& left, double& right, double& bottom, double& top)
 {
-	GetBleeds(page, left, right);
-	bottom = Options.bleeds.Bottom;
-	top    = Options.bleeds.Top;
+	MarginStruct values;
+	m_Doc->getBleeds(page, Options.bleeds, values);
+	left   = values.Left;
+	right  = values.Right;
+	bottom = values.Bottom;
+	top    = values.Top;
 }
 
 void PSLib::SetClipPath(FPointArray *c, bool poly)




More information about the scribus-commit mailing list