r15301 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:49 CEST 2010
Revision: 15301
Author: jghali
Date: 2010-07-01T22:26:03.347880Z
Commit message: #9226 : When moving frame across guide on page border, frame temporarily snaps to border of opposite page
Changeset:
M /trunk/Scribus/scribus/scribusdoc.cpp
M /trunk/Scribus/scribus/scribusdoc.h
Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 15300)
+++ scribus/scribusdoc.cpp (revision 15301)
@@ -10470,20 +10470,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) < (docPrefsData.guidesPrefs.guideRad / viewScale))
- tmpGuidesSel.insert(fabs((*it) + currentPage()->yOffset() - yin), yg);
+ if (fabs((*it) + page->yOffset() - yin) < (docPrefsData.guidesPrefs.guideRad / viewScale))
+ tmpGuidesSel.insert(fabs((*it) + page->yOffset() - yin), yg);
}
if (tmpGuidesSel.count() != 0)
{
@@ -10491,11 +10492,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) < (docPrefsData.guidesPrefs.guideRad / viewScale))
- tmpGuidesSel.insert(fabs((*it) + currentPage()->xOffset() - xin), xg);
+ if (fabs((*it) + page->xOffset() - xin) < (docPrefsData.guidesPrefs.guideRad / viewScale))
+ tmpGuidesSel.insert(fabs((*it) + page->xOffset() - xin), xg);
}
if (tmpGuidesSel.count() != 0)
{
@@ -10505,11 +10506,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) < (docPrefsData.guidesPrefs.guideRad / viewScale))
- tmpGuidesSel.insert(fabs((*it) + currentPage()->yOffset() - yin), yg);
+ if (fabs((*it) + page->yOffset() - yin) < (docPrefsData.guidesPrefs.guideRad / viewScale))
+ tmpGuidesSel.insert(fabs((*it) + page->yOffset() - yin), yg);
}
if (tmpGuidesSel.count() != 0)
{
@@ -10517,11 +10518,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) < (docPrefsData.guidesPrefs.guideRad / viewScale))
- tmpGuidesSel.insert(fabs((*it) + currentPage()->xOffset() - xin), xg);
+ if (fabs((*it) + page->xOffset() - xin) < (docPrefsData.guidesPrefs.guideRad / viewScale))
+ tmpGuidesSel.insert(fabs((*it) + page->xOffset() - xin), xg);
}
if (tmpGuidesSel.count() != 0)
{
@@ -10599,7 +10600,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 15300)
+++ scribus/scribusdoc.h (revision 15301)
@@ -974,7 +974,7 @@
/*! \brief Does this doc have any TOC setups and potentially a TOC to generate */
bool hasTOCSetup() { return !docPrefsData.tocPrefs.defaultToCSetups.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* refPage = 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