r19302 by jghali - #12456: Undo/Redo records Resize always with pt unit

scribus-commit scribus-commit at lists.scribus.net
Mon Jun 30 21:43:04 UTC 2014


Author: jghali
Date: Mon Jun 30 21:43:04 2014
New Revision: 19302

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19302
Log:
#12456: Undo/Redo records Resize always with pt unit
#12457: Undo/Redo records Move always with pt unit

Modified:
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19302&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Mon Jun 30 21:43:04 2014
@@ -4961,9 +4961,17 @@
 			newp = Um::ScratchSpace;
 		else
 			newp = QString(Um::PageNmbr).arg(m_Doc->FirstPnum + OwnPage);
-		SimpleState *ss = new SimpleState(Um::Move,
-                                          QString(Um::MoveFromTo).arg(oldXpos).arg(oldYpos).arg(oldp).
-																  arg(m_xPos).arg(m_yPos).arg(newp), Um::IMove);
+
+		QString unitSuffix = unitGetStrFromIndex(m_Doc->unitIndex());
+		int unitPrecision  = unitGetPrecisionFromIndex(m_Doc->unitIndex());
+		double unitRatio   = m_Doc->unitRatio();
+		QString oxString = QString::number(oldXpos * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
+		QString oyString = QString::number(oldYpos * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
+		QString nxString = QString::number(m_xPos * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
+		QString nyString = QString::number(m_yPos * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
+		QString tooltip  =  QString(Um::MoveFromTo).arg(oxString).arg(oyString).arg(oldp)
+			                                        .arg(nxString).arg(nyString).arg(newp);
+		SimpleState *ss = new SimpleState(Um::Move, tooltip, Um::IMove);
 		ss->set("ITEM_MOVE", "item_move");
 		ss->set("OLD_XPOS", oldXpos);
 		ss->set("OLD_YPOS", oldYpos);
@@ -4988,9 +4996,15 @@
 		doUndo = false;
 	if (doUndo && UndoManager::undoEnabled())
 	{
-		SimpleState *ss = new SimpleState(Um::Resize,
-						   QString(Um::ResizeFromTo).arg(oldWidth).arg(oldHeight).arg(m_width).arg(m_height),
-						           Um::IResize);
+		QString unitSuffix = unitGetStrFromIndex(m_Doc->unitIndex());
+		int unitPrecision  = unitGetPrecisionFromIndex(m_Doc->unitIndex());
+		double unitRatio   = m_Doc->unitRatio();
+		QString owString  = QString::number(oldWidth * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
+		QString ohString  = QString::number(oldHeight * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
+		QString nwString  = QString::number(m_width * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
+		QString nhString  = QString::number(m_height * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
+		QString tooltip   = QString(Um::ResizeFromTo).arg(owString).arg(ohString).arg(nwString).arg(nhString);
+		SimpleState *ss = new SimpleState(Um::Resize, tooltip, Um::IResize);
 		ss->set("ITEM_RESIZE", "item_resize");
 		if (!isNoteFrame() || !asNoteFrame()->isAutoWidth())
 		{

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19302&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Mon Jun 30 21:43:04 2014
@@ -14556,7 +14556,13 @@
 	UndoTransaction *activeTransaction = NULL;
 	if (UndoManager::undoEnabled())
 	{
-		QString transacDesc = QString(Um::ResizeFromTo).arg(currItem->oldWidth).arg(currItem->oldHeight).arg(newX).arg(newY);
+		QString unitSuffix = unitGetStrFromIndex(this->unitIndex());
+		int unitPrecision  = unitGetPrecisionFromIndex(this->unitIndex());
+		QString owString  = QString::number(currItem->oldWidth * docUnitRatio, 'f', unitPrecision) + " " + unitSuffix;
+		QString ohString  = QString::number(currItem->oldHeight * docUnitRatio, 'f', unitPrecision) + " " + unitSuffix;
+		QString nwString  = QString::number(newX * docUnitRatio, 'f', unitPrecision) + " " + unitSuffix;
+		QString nhString  = QString::number(newY * docUnitRatio, 'f', unitPrecision) + " " + unitSuffix;
+		QString transacDesc = QString(Um::ResizeFromTo).arg(owString).arg(ohString).arg(nwString).arg(nhString);
 		activeTransaction = new UndoTransaction(undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(), Um::Resize, transacDesc, Um::IResize));
 	}
 	int ph = static_cast<int>(qMax(1.0, currItem->lineWidth() / 2.0));




More information about the scribus-commit mailing list