r14995 by jghali - #9002: Resize points undraggable when object is aligned to a guide
scribus-commit
scribus-commit at lists.scribus.net
Thu Apr 22 01:30:20 CEST 2010
Revision: 14995
Author: jghali
Date: 2010-04-21T23:26:22.631730Z
Commit message: #9002: Resize points undraggable when object is aligned to a guide
Changeset:
M /branches/Version135/Scribus/scribus/canvasmode_normal.cpp
Diffs:
Index: scribus/canvasmode_normal.cpp
===================================================================
--- scribus/canvasmode_normal.cpp (revision 14994)
+++ scribus/canvasmode_normal.cpp (revision 14995)
@@ -257,8 +257,22 @@
m_mouseCurrentPoint = mousePointDoc;
if ((m_doc->guidesSettings.guidesShown) && (!m_doc->GuideLock) && (m_doc->OnPage(mousePointDoc.x(), mousePointDoc.y()) != -1) )
{
- if( ((m_doc->guidesSettings.before) && (m_canvas->itemUnderCursor(m->globalPos()))) == false )
+ // #9002: Resize points undraggable when object is aligned to a guide
+ // Allow item resize when guides are aligned to item while preserving
+ // ability to drag guide when guis is in foreground and inside selection
+ bool enableGuideGesture(false);
+ Canvas::FrameHandle frameResizeHandle(Canvas::OUTSIDE);
+ if (m_doc->m_Selection->count() > 0)
{
+ double gx(0.0), gy(0.0), gw(0.0), gh(0.0);
+ m_doc->m_Selection->setGroupRect();
+ m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
+ frameResizeHandle = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), QRectF(gx, gy, gw, gh));
+ }
+ enableGuideGesture |= (frameResizeHandle == Canvas::OUTSIDE);
+ enableGuideGesture |= ((!m_doc->guidesSettings.before) && (frameResizeHandle == Canvas::INSIDE));
+ if (enableGuideGesture)
+ {
if (!guideMoveGesture)
{
guideMoveGesture = new RulerGesture(m_view, RulerGesture::HORIZONTAL);
@@ -1027,28 +1041,43 @@
if(!m_doc->guidesSettings.before) // guides are on foreground and want to be processed first
{
- if ((m_doc->guidesSettings.guidesShown) /*&& (!m_doc->GuideLock)*/ && (m_doc->OnPage(MxpS, MypS) != -1))
+ if ((m_doc->guidesSettings.guidesShown) && (m_doc->OnPage(MxpS, MypS) != -1))
{
- if (!guideMoveGesture)
+ // #9002: Resize points undraggable when object is aligned to a guide
+ // Allow item resize when guides are aligned to item while preserving
+ // ability to drag guide when guis is in foreground and inside selection
+ bool enableGuideGesture(true);
+ if (m_doc->m_Selection->count() > 0)
{
- guideMoveGesture = new RulerGesture(m_view, RulerGesture::HORIZONTAL);
- connect(guideMoveGesture,SIGNAL(guideInfo(int, qreal)), m_ScMW->alignDistributePalette,SLOT(setGuide(int, qreal)));
+ double gx(0.0), gy(0.0), gw(0.0), gh(0.0);
+ m_doc->m_Selection->setGroupRect();
+ m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
+ Canvas::FrameHandle frameResizeHandle = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), QRectF(gx, gy, gw, gh));
+ enableGuideGesture = (frameResizeHandle == Canvas::INSIDE);
}
- if ( (!m_doc->GuideLock) && (guideMoveGesture->mouseHitsGuide(mousePointDoc)) )
+ if (enableGuideGesture)
{
- m_view->startGesture(guideMoveGesture);
- guideMoveGesture->mouseMoveEvent(m);
- m_doc->m_Selection->connectItemToGUI();
-// qDebug()<<"Out Of SeleItem"<<__LINE__;
- return true;
+ if (!guideMoveGesture)
+ {
+ guideMoveGesture = new RulerGesture(m_view, RulerGesture::HORIZONTAL);
+ connect(guideMoveGesture,SIGNAL(guideInfo(int, qreal)), m_ScMW->alignDistributePalette,SLOT(setGuide(int, qreal)));
+ }
+ if ( (!m_doc->GuideLock) && (guideMoveGesture->mouseHitsGuide(mousePointDoc)) )
+ {
+ m_view->startGesture(guideMoveGesture);
+ guideMoveGesture->mouseMoveEvent(m);
+ m_doc->m_Selection->connectItemToGUI();
+ // qDebug()<<"Out Of SeleItem"<<__LINE__;
+ return true;
+ }
+ else
+ {
+ // If we call startGesture now, a new guide is created each time.
+ // ### could be a weakness to avoid calling it tho.
+ // m_view->startGesture(guideMoveGesture);
+ guideMoveGesture->mouseSelectGuide(m);
+ }
}
- else
- {
- // If we call startGesture now, a new guide is created each time.
- // ### could be a weakness to avoid calling it tho.
-// m_view->startGesture(guideMoveGesture);
- guideMoveGesture->mouseSelectGuide(m);
- }
}
}
bool pageChanged(false);
More information about the scribus-commit
mailing list