r15192 by jghali - ScribusDoc : use an undo transaction in SizeItem() as that function can potentially create several undo actions
scribus-commit
scribus-commit at lists.scribus.net
Wed Jun 16 01:20:21 CEST 2010
Revision: 15192
Author: jghali
Date: 2010-06-15T23:17:22.477001Z
Commit message: ScribusDoc : use an undo transaction in SizeItem() as that function can potentially create several undo actions
Changeset:
M /branches/Version135/Scribus/scribus/scribusdoc.cpp
Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 15191)
+++ scribus/scribusdoc.cpp (revision 15192)
@@ -22,6 +22,7 @@
***************************************************************************/
+#include <memory>
#include <utility>
#include <QByteArray>
@@ -9540,6 +9541,12 @@
newY = qMax(newY, 1);
}
*/
+ std::auto_ptr<UndoTransaction> activeTransaction;
+ if (UndoManager::undoEnabled())
+ {
+ QString transacDesc = QString(Um::ResizeFromTo).arg(currItem->oldWidth).arg(currItem->oldHeight).arg(newX).arg(newY);
+ activeTransaction.reset( 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));
QMatrix ma;
ma.rotate(currItem->rotation());
@@ -9587,47 +9594,23 @@
// currItem->paintObj();
if (currItem->FrameType == 0 || currItem->asLine())
+ {
+ if (activeTransaction.get())
+ {
+ currItem->checkChanges();
+ activeTransaction->commit();
+ }
return true;
+ }
-// QPainter p;
-// p.begin(m_View->viewport());
-// QPoint in(qRound((currItem->xPos()-minCanvasCoordinate.x())*viewScale), qRound((currItem->yPos()-minCanvasCoordinate.y())*viewScale));
-// QPoint out(m_View->contentsToViewport(in));
-// p.translate(out.x(), out.y());
-// p.scale(viewScale, viewScale);
-// p.rotate(currItem->rotation());
-// p.setCompositionMode(QPainter::CompositionMode_Xor);
-// p.setBrush(Qt::NoBrush);
-// p.setPen(QPen(Qt::white, 1, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
-// p.save();
-// if (currItem->OldB2 < 0.0)
-// {
-// p.scale(-1, 1);
-// p.translate(qRound(-currItem->OldB2), 0);
-// }
-// if (currItem->OldH2 < 0.0)
-// {
-// p.scale(1, -1);
-// p.translate(0, qRound(-currItem->OldH2));
-// }
-// currItem->DrawPolyL(&p, currItem->Clip);
-// p.restore();
currItem->updateClip();
// currItem->updateGradientVectors();
-// p.save();
-// if (currItem->width() < 0.0)
-// {
-// p.scale(-1, 1);
-// p.translate(qRound(-currItem->width()), 0);
-// }
-// if (currItem->height() < 0.0)
-// {
-// p.scale(1, -1);
-// p.translate(0, qRound(-currItem->height()));
-// }
-// currItem->DrawPolyL(&p, currItem->Clip);
-// p.restore();
-// p.end();
+
+ if (activeTransaction.get())
+ {
+ currItem->checkChanges();
+ activeTransaction->commit();
+ }
return true;
}
if (DoUpdateClip)
@@ -9675,6 +9658,11 @@
}
}
currItem->setCornerRadius(qMin(currItem->cornerRadius(), qMin(currItem->width(),currItem->height())/2));
+ if (activeTransaction.get())
+ {
+ currItem->checkChanges();
+ activeTransaction->commit();
+ }
return true;
}
More information about the scribus-commit
mailing list