r15300 by jghali - #9226 : When moving frame across guide on page border, frame temporarily snaps to border of opposite page

scribus-commit scribus-commit at lists.scribus.net
Fri Jul 2 00:30:27 CEST 2010


Revision: 15300
Author: jghali
Date: 2010-07-01T22:25:02.999448Z
Commit message: #9226 : When moving frame across guide on page border, frame temporarily snaps to border of opposite page

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

Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 15299)
+++ scribus/scribusdoc.cpp	(revision 15300)
@@ -9371,20 +9371,21 @@
 }
 
 
-void ScribusDoc::getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM)
+void ScribusDoc::getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, Page* refPage)
 {
 	*GxM = -1;
 	*GyM = -1;
+	Page* page = (refPage == NULL) ? currentPage() : refPage;
 	QMap<double, uint> tmpGuidesSel;
-	Guides tmpGuides = currentPage()->guides.horizontals(GuideManagerCore::Standard);
+	Guides tmpGuides = page->guides.horizontals(GuideManagerCore::Standard);
 	Guides::iterator it;
 	uint yg = 0;
 	uint xg = 0;
 	double viewScale=m_View->scale();
 	for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg)
 	{
-		if (fabs((*it) + currentPage()->yOffset() - yin) < (guidesSettings.guideRad / viewScale))
-			tmpGuidesSel.insert(fabs((*it) + currentPage()->yOffset() - yin), yg);
+		if (fabs((*it) + page->yOffset() - yin) < (guidesSettings.guideRad / viewScale))
+			tmpGuidesSel.insert(fabs((*it) + page->yOffset() - yin), yg);
 	}
 	if (tmpGuidesSel.count() != 0)
 	{
@@ -9392,11 +9393,11 @@
 		*yout = tmpGuides[*GyM];
 	}
 	tmpGuidesSel.clear();
-	tmpGuides = currentPage()->guides.verticals(GuideManagerCore::Standard);
+	tmpGuides = page->guides.verticals(GuideManagerCore::Standard);
 	for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg)
 	{
-		if (fabs((*it) + currentPage()->xOffset() - xin) < (guidesSettings.guideRad / viewScale))
-			tmpGuidesSel.insert(fabs((*it) + currentPage()->xOffset() - xin), xg);
+		if (fabs((*it) + page->xOffset() - xin) < (guidesSettings.guideRad / viewScale))
+			tmpGuidesSel.insert(fabs((*it) + page->xOffset() - xin), xg);
 	}
 	if (tmpGuidesSel.count() != 0)
 	{
@@ -9406,11 +9407,11 @@
 	yg = 0;
 	xg = 0;
 	tmpGuidesSel.clear();
-	tmpGuides = currentPage()->guides.horizontals(GuideManagerCore::Auto);
+	tmpGuides = page->guides.horizontals(GuideManagerCore::Auto);
 	for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg)
 	{
-		if (fabs((*it)+currentPage()->yOffset() - yin) < (guidesSettings.guideRad / viewScale))
-			tmpGuidesSel.insert(fabs((*it) + currentPage()->yOffset() - yin), yg);
+		if (fabs((*it) + page->yOffset() - yin) < (guidesSettings.guideRad / viewScale))
+			tmpGuidesSel.insert(fabs((*it) + page->yOffset() - yin), yg);
 	}
 	if (tmpGuidesSel.count() != 0)
 	{
@@ -9418,11 +9419,11 @@
 		*yout = tmpGuides[*GyM];
 	}
 	tmpGuidesSel.clear();
-	tmpGuides = currentPage()->guides.verticals(GuideManagerCore::Auto);
+	tmpGuides = page->guides.verticals(GuideManagerCore::Auto);
 	for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg)
 	{
-		if (fabs((*it) + currentPage()->xOffset() - xin) < (guidesSettings.guideRad / viewScale))
-			tmpGuidesSel.insert(fabs((*it) + currentPage()->xOffset() - xin), xg);
+		if (fabs((*it) + page->xOffset() - xin) < (guidesSettings.guideRad / viewScale))
+			tmpGuidesSel.insert(fabs((*it) + page->xOffset() - xin), xg);
 	}
 	if (tmpGuidesSel.count() != 0)
 	{
@@ -9500,7 +9501,7 @@
 	if (SnapGuides)
 	{
 //		m_SnapCounter = 0;
-		getClosestGuides(*x, *y, &xout, &yout, &GxM, &GyM);
+		getClosestGuides(*x, *y, &xout, &yout, &GxM, &GyM, page);
 		if (GxM != -1)
 		{
 			*x = xout+page->xOffset();
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(revision 15299)
+++ scribus/scribusdoc.h	(revision 15300)
@@ -884,7 +884,7 @@
 	/*! \brief Does this doc have any TOC setups and potentially a TOC to generate */
 	bool hasTOCSetup() { return !docToCSetups.empty(); }
 	//! \brief Get the closest guide to the given point
-	void getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM);
+	void getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, Page* pg = NULL);
 	//! \brief Snap an item to the guides
 	void SnapToGuides(PageItem *currItem);
 	bool ApplyGuides(double *x, double *y);




More information about the scribus-commit mailing list