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

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


Revision: 14684
Author: jghali
Date: 2010-02-11T22:51:24.763859Z
Commit message: #8786: click on frame resizes it 

Changeset: 
M  /trunk/Scribus/scribus/canvasgesture_resize.cpp
M  /trunk/Scribus/scribus/canvasgesture_resize.h

Diffs:
Index: scribus/canvasgesture_resize.h
===================================================================
--- scribus/canvasgesture_resize.h	(revision 14683)
+++ scribus/canvasgesture_resize.h	(revision 14684)
@@ -77,6 +77,7 @@
 	double m_origRatio;
 	QRectF m_bounds;
 	QRectF m_origBounds;
+	QPoint m_mousePressPoint;
 	UndoTransaction* m_transactionStarted;
 	double m_extraWidth;
 	double m_extraHeight;
Index: scribus/canvasgesture_resize.cpp
===================================================================
--- scribus/canvasgesture_resize.cpp	(revision 14683)
+++ scribus/canvasgesture_resize.cpp	(revision 14684)
@@ -148,17 +148,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)
@@ -324,6 +330,11 @@
 	// 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 
@@ -526,6 +537,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