r14683 by jghali - #8786: click on frame resizes it

scribus-commit scribus-commit at lists.scribus.net
Fri Feb 12 00:00:25 CET 2010


Revision: 14683
Author: jghali
Date: 2010-02-11T22:50:52.229513Z
Commit message: #8786: click on frame resizes it 

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

Diffs:
Index: scribus/canvasgesture_resize.h
===================================================================
--- scribus/canvasgesture_resize.h	(revision 14682)
+++ scribus/canvasgesture_resize.h	(revision 14683)
@@ -75,6 +75,7 @@
 	Canvas::FrameHandle m_handle;
 	double m_rotation;
 	double m_origRatio;
+	QPoint m_mousePressPoint;
 	QRectF m_bounds;
 	QRectF m_origBounds;
 	UndoTransaction* m_transactionStarted;
Index: scribus/canvasgesture_resize.cpp
===================================================================
--- scribus/canvasgesture_resize.cpp	(revision 14682)
+++ scribus/canvasgesture_resize.cpp	(revision 14683)
@@ -143,17 +143,23 @@
 	{
 		PageItem* currItem = m_doc->m_Selection->itemAt(0);
 //		qDebug() << "ResizeGesture::release: new bounds" << m_bounds;
-		doResize(m->modifiers() & Qt::AltModifier);
-		m_doc->setRedrawBounding(currItem);
-		if (currItem->asImageFrame())
-			currItem->AdjustPictScale();
+		if (m_bounds != m_origBounds)
+		{
+			doResize(m->modifiers() & Qt::AltModifier);
+			m_doc->setRedrawBounding(currItem);
+			if (currItem->asImageFrame())
+				currItem->AdjustPictScale();
+		}
 		m_view->resetMousePressed();
 		// necessary since mousebutton is still recorded pressed, and otherwise checkchanges() will do nothing
 		// we must check changes on whole selection otherwise resize operation won't undo correctly on groups
-		for (int i = 0; i < m_doc->m_Selection->count(); ++i)
-			m_doc->m_Selection->itemAt(i)->checkChanges();
-		currItem->invalidateLayout();
-		currItem->update();
+		if (m_bounds != m_origBounds)
+		{
+			for (int i = 0; i < m_doc->m_Selection->count(); ++i)
+				m_doc->m_Selection->itemAt(i)->checkChanges();
+			currItem->invalidateLayout();
+			currItem->update();
+		}
 	}
 //	qDebug() << "ResizeGesture::release: transaction" << m_transactionStarted;
 	if (m_transactionStarted)
@@ -318,8 +324,13 @@
 	QPointF oldXY = m_bounds.topLeft();
 	// proportional resize
 	bool constrainRatio = ((m->modifiers() & Qt::ControlModifier) != Qt::NoModifier);
-	
 
+	if (m_mousePressPoint == m->globalPos())
+	{
+		m_bounds = m_origBounds;
+		return;
+	}
+
 	// snap to grid	+ snap to guides
 	bool isCorner = m_handle == Canvas::NORTHWEST || m_handle == Canvas::NORTHEAST 
 		|| m_handle == Canvas::SOUTHWEST || m_handle == Canvas::SOUTHEAST;
@@ -521,6 +532,7 @@
 void ResizeGesture::mousePressEvent(QMouseEvent *m)
 {
 	FPoint point = m_canvas->globalToCanvas(m->globalPos());
+	m_mousePressPoint = m->globalPos();
 	if (m_doc->m_Selection->count() == 0)
 	{
 		m_handle = Canvas::OUTSIDE;




More information about the scribus-commit mailing list