Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 15299 → Rev 15300

/branches/Version135/Scribus/scribus/scribusdoc.cpp
9371,12 → 9371,13
}
 
 
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;
9383,8 → 9384,8
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();
/branches/Version135/Scribus/scribus/scribusdoc.h
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);