r14079 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:24 CEST 2009


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

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

Diffs:
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp	(revision 14078)
+++ scribus/pdflib_core.cpp	(revision 14079)
@@ -4975,36 +4975,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 14078)
+++ scribus/scribusdoc.cpp	(revision 14079)
@@ -4346,14 +4346,19 @@
 }
 
 
-void ScribusDoc::getBleeds(Page* page, MarginStruct& bleedData)
+void ScribusDoc::getBleeds(const Page* page, MarginStruct& bleedData)
 {
-	bleedData.Bottom = bleeds.Bottom;
-	bleedData.Top = bleeds.Top;
+	getBleeds(page, bleeds, bleedData);
+}
+
+void ScribusDoc::getBleeds(const Page* page, const MarginStruct& baseValues, MarginStruct& bleedData)
+{
+	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
 	{
@@ -4369,18 +4374,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;
 		}
 	}
 }
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(revision 14078)
+++ scribus/scribusdoc.h	(revision 14079)
@@ -691,7 +691,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 14078)
+++ scribus/pslib.cpp	(revision 14079)
@@ -4383,36 +4383,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