r17709 by craig - #10827: Chelen: Apply patch for many undo/redo tasks

scribus-commit scribus-commit at lists.scribus.net
Thu Jul 12 20:32:18 UTC 2012


Author: craig
Date: Thu Jul 12 20:32:18 2012
New Revision: 17709

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17709
Log:
#10827: Chelen: Apply patch for many undo/redo tasks

Modified:
    trunk/Scribus/scribus/canvasmode_drawbezier.cpp
    trunk/Scribus/scribus/canvasmode_drawbezier.h
    trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp
    trunk/Scribus/scribus/canvasmode_drawfreehand.cpp
    trunk/Scribus/scribus/canvasmode_editarc.cpp
    trunk/Scribus/scribus/canvasmode_editgradient.cpp
    trunk/Scribus/scribus/canvasmode_editgradient.h
    trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp
    trunk/Scribus/scribus/canvasmode_editmeshgradient.h
    trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp
    trunk/Scribus/scribus/canvasmode_editmeshpatch.h
    trunk/Scribus/scribus/canvasmode_editpolygon.cpp
    trunk/Scribus/scribus/canvasmode_nodeedit.cpp
    trunk/Scribus/scribus/mesh.cpp
    trunk/Scribus/scribus/mesh.h
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem.h
    trunk/Scribus/scribus/pageitem_imageframe.cpp
    trunk/Scribus/scribus/pageitem_latexframe.cpp
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/styles/paragraphstyle.cpp
    trunk/Scribus/scribus/ui/cpalette.cpp
    trunk/Scribus/scribus/ui/cpalette.h
    trunk/Scribus/scribus/ui/multipleduplicate.ui
    trunk/Scribus/scribus/ui/polygonwidget.cpp
    trunk/Scribus/scribus/ui/polygonwidgetbase.ui
    trunk/Scribus/scribus/ui/propertiespalette.cpp
    trunk/Scribus/scribus/ui/propertiespalette.h
    trunk/Scribus/scribus/ui/propertiespalette_image.cpp
    trunk/Scribus/scribus/ui/transparencypalette.cpp
    trunk/Scribus/scribus/undomanager.cpp
    trunk/Scribus/scribus/undomanager.h

Modified: trunk/Scribus/scribus/canvasmode_drawbezier.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/canvasmode_drawbezier.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawbezier.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_drawbezier.cpp Thu Jul 12 20:32:18 2012
@@ -65,7 +65,6 @@
 	inItemCreation = false;
 	shiftSelItems = false;
 	FirstPoly = true;
-	m_createTransaction = NULL;
 }
 
 
@@ -99,18 +98,6 @@
 	}
 	m_view->resetMousePressed();
 	currItem->checkChanges();
-	if (m_createTransaction)
-	{
-		m_view->resetMousePressed();
-		currItem->checkChanges(true);
-		QString targetName = Um::ScratchSpace;
-		if (currItem->OwnPage > -1)
-			targetName = m_doc->Pages->at(currItem->OwnPage)->getUName();
-		m_createTransaction->commit(targetName, currItem->getUPixmap(),
-									Um::Create + " " + currItem->getUName(),  "", Um::ICreate);
-		delete m_createTransaction;
-		m_createTransaction = NULL;
-	}
 	currItem->update();
 	currItem->emitAllToGUI();
 }
@@ -150,25 +137,17 @@
 //	qDebug() << "BezierMode::deactivate" << flag;
 //	m_view->stopDragTimer();
 	PageItem* currItem = m_doc->m_Selection->itemAt(0);
-	if (m_createTransaction && currItem)
-	{
-		//FIXME : we should call finalizeItem() here, currently some
-		//related code is executed in ScribusMainWindow::keyPressEvent()
-		m_view->resetMousePressed();
-		currItem->checkChanges(true);
-		QString targetName = Um::ScratchSpace;
+	undoManager->setUndoEnabled(true);
+	if (UndoManager::undoEnabled())
+	{
+		ScItemState<PageItem*> *is = new ScItemState<PageItem*>("Create PageItem");
+		is->set("CREATE_ITEM", "create_item");
+		is->setItem(currItem);
+		//Undo target rests with the Page for object specific undo
+		UndoObject *target = m_doc->Pages->at(0);
 		if (currItem->OwnPage > -1)
-			targetName = m_doc->Pages->at(currItem->OwnPage)->getUName();
-		m_createTransaction->commit(targetName, currItem->getUPixmap(),
-									Um::Create + " " + currItem->getUName(),  "", Um::ICreate);
-		delete m_createTransaction;
-		m_createTransaction = NULL;
-	}
-	else if (m_createTransaction)
-	{
-		m_createTransaction->cancel();
-		delete m_createTransaction;
-		m_createTransaction = NULL;
+			target = m_doc->Pages->at(currItem->OwnPage);
+		undoManager->action(target, is);
 	}
 	m_view->redrawMarker->hide();
 }
@@ -313,7 +292,7 @@
 	if (FirstPoly)
 	{
 		selectPage(m);
-		m_createTransaction = new UndoTransaction(UndoManager::instance()->beginTransaction());
+		undoManager->setUndoEnabled(false);
 		z = m_doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, Rxp, Ryp, 1+Rxpd, 1+Rypd, m_doc->itemToolPrefs().lineWidth, CommonStrings::None, m_doc->itemToolPrefs().lineColor, true);
 		currItem = m_doc->Items->at(z);
 		m_doc->m_Selection->clear();
@@ -341,6 +320,7 @@
 	m_doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem, false, false, false);
 	currItem->setPolyClip(qRound(qMax(currItem->lineWidth() / 2, 1.0)));
 	m_canvas->newRedrawPolygon();
+	undoManager->setUndoEnabled(false);
 }
 
 
@@ -349,7 +329,7 @@
 {
 	const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
 	
-
+	undoManager->setUndoEnabled(true);
 	PageItem *currItem;
 	m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();

Modified: trunk/Scribus/scribus/canvasmode_drawbezier.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/canvasmode_drawbezier.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawbezier.h (original)
+++ trunk/Scribus/scribus/canvasmode_drawbezier.h Thu Jul 12 20:32:18 2012
@@ -52,7 +52,6 @@
 	void finalizeItem(PageItem* item);
 	void selectPage(QMouseEvent *m);
 
-	UndoTransaction* m_createTransaction;
 	bool inItemCreation, shiftSelItems, FirstPoly;
 	bool m_MouseButtonPressed;
 	double Mxp, Myp, Dxp, Dyp;

Modified: trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp Thu Jul 12 20:32:18 2012
@@ -225,12 +225,14 @@
 	SeRx = Mxp;
 	SeRy = Myp;
 	m_canvas->setRenderModeFillBuffer();
+	undoManager->setUndoEnabled(false);
 }
 
 
 
 void CalligraphicMode::mouseReleaseEvent(QMouseEvent *m)
 {
+	undoManager->setUndoEnabled(true);
 	PageItem *currItem;
 	m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();

Modified: trunk/Scribus/scribus/canvasmode_drawfreehand.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/canvasmode_drawfreehand.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawfreehand.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_drawfreehand.cpp Thu Jul 12 20:32:18 2012
@@ -214,12 +214,14 @@
 	SeRx = Mxp;
 	SeRy = Myp;
 	m_canvas->setRenderModeFillBuffer();
+	undoManager->setUndoEnabled(false);
 }
 
 
 
 void FreehandMode::mouseReleaseEvent(QMouseEvent *m)
 {
+	undoManager->setUndoEnabled(true);
 	PageItem *currItem;
 	m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();

Modified: trunk/Scribus/scribus/canvasmode_editarc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/canvasmode_editarc.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editarc.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editarc.cpp Thu Jul 12 20:32:18 2012
@@ -227,6 +227,15 @@
 	QRectF upRect2 = QRectF(mPoint.x() - item->arcWidth / 2.0, mPoint.y() - item->arcHeight / 2.0, item->arcWidth, item->arcHeight);
 	upRect = upRect2.united(upRect);
 	upRect.translate(currItem->xPos(), currItem->yPos());
+	ScItemState<QPair<FPointArray, FPointArray> > *ss = new ScItemState<QPair<FPointArray, FPointArray> >(Um::Selection);
+	FPointArray old = item->PoLine;
+	ss->set("ARC","arc");
+	ss->set("OLD_WIDTH",item->arcWidth);
+	ss->set("NEW_WIDTH",width);
+	ss->set("OLD_XPOS",item->xPos());
+	ss->set("OLD_YPOS",item->yPos());
+	ss->set("OLD_HEIGHT",item->arcHeight);
+	ss->set("NEW_HEIGHT",height);
 	item->arcWidth = width;
 	item->arcHeight = height;
 	QTransform bb;
@@ -246,9 +255,19 @@
 	pp.arcTo(QRectF(mPoint.x() - item->arcWidth / 2.0, mPoint.y() - item->arcHeight / 2.0, item->arcWidth, item->arcHeight), startAngle, nSweep);
 	pp.closeSubpath();
 	currItem->PoLine.fromQPainterPath(pp);
+	undoManager->setUndoEnabled(false);
 	m_doc->AdjustItemSize(currItem);
+	undoManager->setUndoEnabled(true);
+	ss->set("OLD_START",item->arcStartAngle);
+	ss->set("NEW_START",startAngle);
+	ss->set("OLD_SWEEP",item->arcSweepAngle);
+	ss->set("NEW_SWEEP",nSweep);
+	ss->setItem(qMakePair(old,item->PoLine));
 	item->arcStartAngle = startAngle;
-	item->arcSweepAngle = endAngle - startAngle;
+	item->arcSweepAngle = nSweep;
+	ss->set("NEW_XPOS",item->xPos());
+	ss->set("NEW_YPOS",item->yPos());
+	undoManager->action(currItem,ss);
 	startPoint = currItem->PoLine.pointQF(2);
 	endPoint = currItem->PoLine.pointQF(currItem->PoLine.size() - 4);
 	centerPoint = currItem->PoLine.pointQF(0);

Modified: trunk/Scribus/scribus/canvasmode_editgradient.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/canvasmode_editgradient.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editgradient.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editgradient.cpp Thu Jul 12 20:32:18 2012
@@ -329,7 +329,7 @@
 				currItem->GrStrokeStartY -= np.y(); // (Myp - newY); // / m_canvas->scale();
 				currItem->GrStrokeFocalX -= np.x();
 				currItem->GrStrokeFocalY -= np.y();
-				if (currItem->GrTypeStroke == 7)
+				if (currItem->strokeGradientType() == 7)
 				{
 					double radEnd = distance(currItem->GrStrokeEndX - currItem->GrStrokeStartX, currItem->GrStrokeEndY - currItem->GrStrokeStartY);
 					double radFoc = distance(currItem->GrStrokeFocalX - currItem->GrStrokeStartX, currItem->GrStrokeFocalY - currItem->GrStrokeStartY);
@@ -368,7 +368,7 @@
 				QPointF shRe = m.map(shR - np);
 				currItem->GrStrokeFocalX = shRe.x();
 				currItem->GrStrokeFocalY = shRe.y();
-				if (currItem->GrTypeStroke == 7)
+				if (currItem->strokeGradientType() == 7)
 				{
 					double radEnd = distance(currItem->GrStrokeEndX - currItem->GrStrokeStartX, currItem->GrStrokeEndY - currItem->GrStrokeStartY);
 					double radFoc = distance(currItem->GrStrokeFocalX - currItem->GrStrokeStartX, currItem->GrStrokeFocalY - currItem->GrStrokeStartY);
@@ -404,7 +404,7 @@
 			{
 				currItem->GrStrokeEndX -= np.x(); // (Mxp - newX); // / m_canvas->scale();
 				currItem->GrStrokeEndY -= np.y(); // (Myp - newY); // / m_canvas->scale();
-				if (currItem->GrTypeStroke == 7)
+				if (currItem->strokeGradientType() == 7)
 				{
 					double radEnd = distance(currItem->GrStrokeEndX - currItem->GrStrokeStartX, currItem->GrStrokeEndY - currItem->GrStrokeStartY);
 					double radFoc = distance(currItem->GrStrokeFocalX - currItem->GrStrokeStartX, currItem->GrStrokeFocalY - currItem->GrStrokeStartY);
@@ -519,7 +519,7 @@
 				currItem->GrStartY -= np.y();
 				currItem->GrFocalX -= np.x();
 				currItem->GrFocalY -= np.y();
-				if ((currItem->GrType == 7) || (currItem->GrType == 13))
+				if ((currItem->gradientType() == 7) || (currItem->gradientType() == 13))
 				{
 					double radEnd = distance(currItem->GrEndX - currItem->GrStartX, currItem->GrEndY - currItem->GrStartY);
 					double radFoc = distance(currItem->GrFocalX - currItem->GrStartX, currItem->GrFocalY - currItem->GrStartY);
@@ -889,6 +889,37 @@
 			m_gradientPoint = useGradientSkew;
 	}
 	m_canvas->m_viewMode.m_MouseButtonPressed = true;
+	if(m_gradientPoint != noPointDefined){
+		OldGrStartX = currItem->gradientStartX();
+		OldGrStartY = currItem->gradientStartY();
+		OldGrEndX = currItem->gradientEndX();
+		OldGrEndY = currItem->gradientEndY();
+		OldGrFocalX = currItem->gradientFocalX();
+		OldGrFocalY = currItem->gradientFocalY();
+		OldGrScale = currItem->gradientScale();
+		OldGrSkew = currItem->gradientSkew();
+		OldGrControl1 = currItem->gradientControl1();
+		OldGrControl2 = currItem->gradientControl2();
+		OldGrControl3 = currItem->gradientControl3();
+		OldGrControl4 = currItem->gradientControl4();
+		OldGrControl5 = currItem->gradientControl5();
+		OldGrStrokeStartX = currItem->gradientStrokeStartX();
+		OldGrStrokeStartY = currItem->gradientStrokeStartY();
+		OldGrStrokeEndX = currItem->gradientStrokeEndX();
+		OldGrStrokeEndY = currItem->gradientStrokeEndY();
+		OldGrStrokeFocalX = currItem->gradientStrokeFocalX();
+		OldGrStrokeFocalY = currItem->gradientStrokeFocalY();
+		OldGrStrokeScale = currItem->gradientStrokeScale();
+		OldGrStrokeSkew = currItem->gradientStrokeSkew();
+		OldGrMaskStartX = currItem->GrMaskStartX;
+		OldGrMaskStartY = currItem->GrMaskStartY;
+		OldGrMaskEndX = currItem->GrMaskEndX;
+		OldGrMaskEndY = currItem->GrMaskEndY;
+		OldGrMaskFocalX = currItem->GrMaskFocalX;
+		OldGrMaskFocalY = currItem->GrMaskFocalY;
+		OldGrMaskScale = currItem->GrMaskScale;
+		OldGrMaskSkew = currItem->GrMaskSkew;
+	}
 	qApp->changeOverrideCursor(QCursor(Qt::CrossCursor));
 }
 
@@ -900,6 +931,72 @@
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m->accept();
+	PageItem* currItem = m_doc->m_Selection->itemAt(0);
+	if(m_gradientPoint != noPointDefined){
+		QList<FPoint> tmp;
+		ScItemState<QList<FPoint> > *is = new ScItemState<QList<FPoint> >(Um::GradPos + "i");
+		is->set("GRAD_POS","grad_pos");
+		is->set("OLDSTARTX",OldGrStartX);
+		is->set("STARTX",currItem->gradientStartX());
+		is->set("OLDSTARTY",OldGrStartY);
+		is->set("STARTY",currItem->gradientStartY());
+		is->set("OLDENDX",OldGrEndX);
+		is->set("ENDX",currItem->gradientEndX());
+		is->set("OLDENDY",OldGrEndY);
+		is->set("ENDY",currItem->gradientEndY());
+		is->set("OLDFOCALX",OldGrFocalX);
+		is->set("FOCALX",currItem->gradientFocalX());
+		is->set("OLDFOCALY",OldGrFocalY);
+		is->set("FOCALY",currItem->gradientFocalY());
+		is->set("OLDSCALE",OldGrScale);
+		is->set("SCALE",currItem->gradientScale());
+		is->set("OLDSKEW",OldGrSkew);
+		is->set("SKEW",currItem->gradientSkew());
+		tmp.append(OldGrControl1);
+		tmp.append(currItem->gradientControl1());
+		tmp.append(OldGrControl2);
+		tmp.append(currItem->gradientControl2());
+		tmp.append(OldGrControl3);
+		tmp.append(currItem->gradientControl3());
+		tmp.append(OldGrControl4);
+		tmp.append(currItem->gradientControl4());
+		tmp.append(OldGrControl5);
+		tmp.append(currItem->gradientControl5());
+		is->setItem(tmp);
+		is->set("OLDSTROKESTARTX",OldGrStrokeStartX);
+		is->set("STROKESTARTX",currItem->gradientStrokeStartX());
+		is->set("OLDSTROKESTARTY",OldGrStrokeStartY);
+		is->set("STROKESTARTY",currItem->gradientStrokeStartY());
+		is->set("OLDSTROKEENDX",OldGrStrokeEndX);
+		is->set("STROKEENDX",currItem->gradientStrokeEndX());
+		is->set("OLDSTROKEENDY",OldGrStrokeEndY);
+		is->set("STROKEENDY",currItem->gradientStrokeEndY());
+		is->set("OLDSTROKEFOCALX",OldGrStrokeFocalX);
+		is->set("STROKEFOCALX",currItem->gradientStrokeFocalX());
+		is->set("OLDSTROKEFOCALY",OldGrStrokeFocalY);
+		is->set("STROKEFOCALY",currItem->gradientStrokeFocalY());
+		is->set("OLDSTROKESCALE",OldGrStrokeScale);
+		is->set("STROKESCALE",currItem->gradientStrokeScale());
+		is->set("OLDSTROKESKEW",OldGrStrokeSkew);
+		is->set("STROKESKEW",currItem->gradientStrokeSkew());
+		is->set("OLDMARKSTARTX",OldGrMaskStartX);
+		is->set("MARKSTARTX",currItem->GrMaskStartX);
+		is->set("OLDMARKSTARTY",OldGrMaskStartY);
+		is->set("MARKSTARTY",currItem->GrMaskStartY);
+		is->set("OLDMARKENDX",OldGrMaskEndX);
+		is->set("MARKENDX",currItem->GrMaskEndX);
+		is->set("OLDMARKENDY",OldGrMaskEndY);
+		is->set("MARKENDY",currItem->GrMaskEndY);
+		is->set("OLDMARKFOCALX",OldGrMaskFocalX);
+		is->set("MARKFOCALX",currItem->GrMaskFocalX);
+		is->set("OLDMARKFOCALY",OldGrMaskFocalY);
+		is->set("MARKFOCALY",currItem->GrMaskFocalY);
+		is->set("OLDMARKSCALE",OldGrMaskScale);
+		is->set("MARKSCALE",currItem->GrMaskScale);
+		is->set("OLDMARKSKEW",OldGrMaskSkew);
+		is->set("MARKSKEW",currItem->GrMaskSkew);
+		undoManager->action(currItem,is);
+	}
 	m_gradientPoint = noPointDefined;
 //	m_view->stopDragTimer();
 }

Modified: trunk/Scribus/scribus/canvasmode_editgradient.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/canvasmode_editgradient.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editgradient.h (original)
+++ trunk/Scribus/scribus/canvasmode_editgradient.h Thu Jul 12 20:32:18 2012
@@ -71,6 +71,37 @@
 	double Mxp, Myp;
 	ScribusMainWindow* m_ScMW;
 	eGradientPoint m_gradientPoint;
+
+	//save of previous state
+	double OldGrStartX;
+	double OldGrStartY;
+	double OldGrEndX;
+	double OldGrEndY;
+	double OldGrFocalX;
+	double OldGrFocalY;
+	double OldGrScale;
+	double OldGrSkew;
+	FPoint OldGrControl1;
+	FPoint OldGrControl2;
+	FPoint OldGrControl3;
+	FPoint OldGrControl4;
+	FPoint OldGrControl5;
+	double OldGrStrokeStartX;
+	double OldGrStrokeStartY;
+	double OldGrStrokeEndX;
+	double OldGrStrokeEndY;
+	double OldGrStrokeFocalX;
+	double OldGrStrokeFocalY;
+	double OldGrStrokeScale;
+	double OldGrStrokeSkew;
+	double OldGrMaskStartX;
+	double OldGrMaskStartY;
+	double OldGrMaskEndX;
+	double OldGrMaskEndY;
+	double OldGrMaskFocalX;
+	double OldGrMaskFocalY;
+	double OldGrMaskScale;
+	double OldGrMaskSkew;
 };
 
 

Modified: trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp Thu Jul 12 20:32:18 2012
@@ -65,6 +65,13 @@
 	Mxp = Myp = -1;
 	selectedMeshPoints.clear();
 	m_gradientPoint = noPointDefined;
+	old_mesh = new meshPoint();
+}
+
+CanvasMode_EditMeshGradient::~CanvasMode_EditMeshGradient()
+{
+	delete old_mesh;
+	old_mesh = NULL;
 }
 
 inline bool CanvasMode_EditMeshGradient::GetItem(PageItem** pi)
@@ -398,25 +405,13 @@
 			double moveY = 0.0;
 			bool isMoving = false;
 			bool doUpdate = false;
-			if (m_doc->unitIndex()!=SC_INCHES)
-			{
-				if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=0.1;
-				else if (!(buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=10.0;
-				else if ((buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=0.01;
-				moveBy/=m_doc->unitRatio();//Lets allow movement by the current doc ratio, not only points
-			}
-			else
-			{
-				if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=0.1/m_doc->unitRatio();
-				else if (!(buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=1.0/m_doc->unitRatio();
-				else if ((buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=0.01/m_doc->unitRatio();
-			}
+			if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
+				moveBy=0.1;
+			else if (!(buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
+				moveBy=10.0;
+			else if ((buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
+				moveBy=0.01;
+			moveBy/=m_doc->unitRatio();//Lets allow movement by the current doc ratio, not only points
 			moveBy /= m_canvas->m_viewMode.scale;
 			PageItem *currItem = m_doc->m_Selection->itemAt(0);
 			switch (kk)
@@ -677,6 +672,7 @@
 					selPoint.first = grow;
 					selPoint.second = gcol;
 					found = true;
+					*old_mesh = mp;
 					break;
 				}
 			}
@@ -703,6 +699,7 @@
 					selPoint.second = gcol;
 					currItem->selectedMeshPointX = grow;
 					currItem->selectedMeshPointY = gcol;
+					*old_mesh = mp;
 					found = true;
 					break;
 				}
@@ -903,6 +900,7 @@
 				{
 					selPoint.first = grow;
 					selPoint.second = gcol;
+					*old_mesh = mp1;
 					break;
 				}
 			}
@@ -974,6 +972,23 @@
 	m_canvas->resetRenderMode();
 	m->accept();
 	PageItem *currItem = m_doc->m_Selection->itemAt(0);
+	if (currItem->selectedMeshPointX >=0 && currItem->selectedMeshPointY >=0)
+	{
+		ScItemState<QPair<meshPoint,meshPoint> > *ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
+		ss->set("MOVE_MESH_PATCH","move_mesh_patch");
+		ss->set("ARRAY",true);
+		ss->set("X",currItem->selectedMeshPointX);
+		ss->set("Y",currItem->selectedMeshPointY);
+		if((*old_mesh) == currItem->meshGradientArray[currItem->selectedMeshPointX][currItem->selectedMeshPointY])
+		{
+			delete ss;
+			ss=NULL;
+		}
+		else
+			ss->setItem(qMakePair(*old_mesh,currItem->meshGradientArray[currItem->selectedMeshPointX][currItem->selectedMeshPointY]));
+		if(ss)
+			undoManager->action(currItem,ss);
+	}
 	currItem->update();
 	QTransform itemMatrix = currItem->getTransform();
 	m_doc->regionsChanged()->update(itemMatrix.mapRect(QRectF(0, 0, currItem->width(), currItem->height())).adjusted(-currItem->width() / 2.0, -currItem->height() / 2.0, currItem->width(), currItem->height()));

Modified: trunk/Scribus/scribus/canvasmode_editmeshgradient.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/canvasmode_editmeshgradient.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editmeshgradient.h (original)
+++ trunk/Scribus/scribus/canvasmode_editmeshgradient.h Thu Jul 12 20:32:18 2012
@@ -33,6 +33,7 @@
 class PageItem_TextFrame;
 class ScribusMainWindow;
 class ScribusView;
+class meshPoint;
 
 
 // This class encapsulate the old code for mouse interaction from scribusview.cpp
@@ -41,7 +42,7 @@
 {	
 public:
 	explicit CanvasMode_EditMeshGradient(ScribusView* view);
-	virtual ~CanvasMode_EditMeshGradient() {}
+	virtual ~CanvasMode_EditMeshGradient();
 
 	virtual void enterEvent(QEvent *);
 	virtual void leaveEvent(QEvent *);
@@ -70,6 +71,7 @@
 
 	inline bool GetItem(PageItem** pi);
 
+	meshPoint *old_mesh;
 	double Mxp, Myp;
 	ScribusMainWindow* m_ScMW;
 	eMGradientPoint m_gradientPoint;

Modified: trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp Thu Jul 12 20:32:18 2012
@@ -67,6 +67,13 @@
 	m_patchPoint = noPointDefined;
 	m_gradientPoint = noControlPointDefined;
 	m_click_count = 0;
+	old_mesh = new meshPoint();
+}
+
+CanvasMode_EditMeshPatch::~CanvasMode_EditMeshPatch()
+{
+	delete old_mesh;
+	old_mesh = NULL;
 }
 
 inline bool CanvasMode_EditMeshPatch::GetItem(PageItem** pi)
@@ -343,25 +350,13 @@
 			double moveY = 0.0;
 			bool isMoving = false;
 			bool doUpdate = false;
-			if (m_doc->unitIndex()!=SC_INCHES)
-			{
-				if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=0.1;
-				else if (!(buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=10.0;
-				else if ((buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=0.01;
-				moveBy/=m_doc->unitRatio();//Lets allow movement by the current doc ratio, not only points
-			}
-			else
-			{
-				if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=0.1/m_doc->unitRatio();
-				else if (!(buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=1.0/m_doc->unitRatio();
-				else if ((buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=0.01/m_doc->unitRatio();
-			}
+			if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
+				moveBy=0.1;
+			else if (!(buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
+				moveBy=10.0;
+			else if ((buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
+				moveBy=0.01;
+			moveBy/=m_doc->unitRatio();//Lets allow movement by the current doc ratio, not only points
 			moveBy /= m_canvas->m_viewMode.scale;
 			PageItem *currItem = m_doc->m_Selection->itemAt(0);
 			switch (kk)
@@ -813,13 +808,25 @@
 				meshPoint mp3 = patch.BR;
 				meshPoint mp4 = patch.BL;
 				if ((m_canvas->hitsCanvasPoint(mousePointDoc, itemMatrix.map(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y())))) || (m_canvas->hitsCanvasPoint(mousePointDoc, itemMatrix.map(QPointF(mp1.controlColor.x(), mp1.controlColor.y())))))
+				{
 					m_patchPoint = useTL;
+					*old_mesh = mp1;
+				}
 				else if ((m_canvas->hitsCanvasPoint(mousePointDoc, itemMatrix.map(QPointF(mp2.gridPoint.x(), mp2.gridPoint.y())))) || (m_canvas->hitsCanvasPoint(mousePointDoc, itemMatrix.map(QPointF(mp2.controlColor.x(), mp2.controlColor.y())))))
+				{
+					*old_mesh = mp2;
 					m_patchPoint = useTR;
+				}
 				else if ((m_canvas->hitsCanvasPoint(mousePointDoc, itemMatrix.map(QPointF(mp3.gridPoint.x(), mp3.gridPoint.y())))) || (m_canvas->hitsCanvasPoint(mousePointDoc, itemMatrix.map(QPointF(mp3.controlColor.x(), mp3.controlColor.y())))))
+				{
+					*old_mesh = mp3;
 					m_patchPoint = useBR;
+				}
 				else if ((m_canvas->hitsCanvasPoint(mousePointDoc, itemMatrix.map(QPointF(mp4.gridPoint.x(), mp4.gridPoint.y())))) || (m_canvas->hitsCanvasPoint(mousePointDoc, itemMatrix.map(QPointF(mp4.controlColor.x(), mp4.controlColor.y())))))
+				{
+					*old_mesh = mp4;
 					m_patchPoint = useBL;
+				}
 				else
 					m_patchPoint = noPointDefined;
 			}
@@ -831,13 +838,25 @@
 				meshPoint mp3 = patch.BR;
 				meshPoint mp4 = patch.BL;
 				if (m_canvas->hitsCanvasPoint(mousePointDoc, itemMatrix.map(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()))))
+				{
+					*old_mesh = mp1;
 					m_patchPoint = useTL;
+				}
 				else if (m_canvas->hitsCanvasPoint(mousePointDoc, itemMatrix.map(QPointF(mp2.gridPoint.x(), mp2.gridPoint.y()))))
+				{
+					*old_mesh = mp2;
 					m_patchPoint = useTR;
+				}
 				else if (m_canvas->hitsCanvasPoint(mousePointDoc, itemMatrix.map(QPointF(mp3.gridPoint.x(), mp3.gridPoint.y()))))
+				{
+					*old_mesh = mp3;
 					m_patchPoint = useBR;
+				}
 				else if (m_canvas->hitsCanvasPoint(mousePointDoc, itemMatrix.map(QPointF(mp4.gridPoint.x(), mp4.gridPoint.y()))))
+				{
+					*old_mesh = mp4;
 					m_patchPoint = useBL;
+				}
 				else
 					m_patchPoint = noPointDefined;
 			}
@@ -953,6 +972,54 @@
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m->accept();
+	if (m_view->editStrokeGradient != 11 && currItem->selectedMeshPointX >=0 && m_patchPoint != noPointDefined)
+	{
+		ScItemState<QPair<meshPoint,meshPoint> > *ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
+		ss->set("MOVE_MESH_PATCH","move_mesh_patch");
+		ss->set("X",currItem->selectedMeshPointX);
+		ss->set("Y",currItem->selectedMeshPointY);
+		ss->set("ARRAY",false);
+		switch(currItem->selectedMeshPointY){
+			case 1:
+				if((*old_mesh) == currItem->meshGradientPatches[currItem->selectedMeshPointX].TL)
+				{
+					delete ss;
+					ss=NULL;
+				}
+				else
+					ss->setItem(qMakePair(*old_mesh,currItem->meshGradientPatches[currItem->selectedMeshPointX].TL));
+				break;
+			case 2:
+				if((*old_mesh) == currItem->meshGradientPatches[currItem->selectedMeshPointX].TR)
+				{
+					delete ss;
+					ss=NULL;
+				}
+				else
+					ss->setItem(qMakePair(*old_mesh,currItem->meshGradientPatches[currItem->selectedMeshPointX].TR));
+				break;
+			case 3:
+				if((*old_mesh) == currItem->meshGradientPatches[currItem->selectedMeshPointX].BR)
+				{
+					delete ss;
+					ss=NULL;
+				}
+				else
+					ss->setItem(qMakePair(*old_mesh,currItem->meshGradientPatches[currItem->selectedMeshPointX].BR));
+				break;
+			case 4:
+				if((*old_mesh) == currItem->meshGradientPatches[currItem->selectedMeshPointX].BL)
+				{
+					delete ss;
+					ss=NULL;
+				}
+				else
+					ss->setItem(qMakePair(*old_mesh,currItem->meshGradientPatches[currItem->selectedMeshPointX].BL));
+				break;
+		}
+		if(ss)
+			undoManager->action(currItem,ss);
+	}
 	currItem = m_doc->m_Selection->itemAt(0);
 	currItem->update();
 	QTransform itemMatrix = currItem->getTransform();

Modified: trunk/Scribus/scribus/canvasmode_editmeshpatch.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/canvasmode_editmeshpatch.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editmeshpatch.h (original)
+++ trunk/Scribus/scribus/canvasmode_editmeshpatch.h Thu Jul 12 20:32:18 2012
@@ -43,7 +43,7 @@
 {
 public:
 	explicit CanvasMode_EditMeshPatch(ScribusView* view);
-	virtual ~CanvasMode_EditMeshPatch() {}
+	virtual ~CanvasMode_EditMeshPatch();
 
 	virtual void enterEvent(QEvent *);
 	virtual void leaveEvent(QEvent *);
@@ -83,6 +83,7 @@
 
 	inline bool GetItem(PageItem** pi);
 
+	meshPoint* old_mesh;
 	double Mxp, Myp;
 	ScribusMainWindow* m_ScMW;
 	eMPatchPoint m_patchPoint;

Modified: trunk/Scribus/scribus/canvasmode_editpolygon.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/canvasmode_editpolygon.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editpolygon.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editpolygon.cpp Thu Jul 12 20:32:18 2012
@@ -44,6 +44,7 @@
 #include "fpointarray.h"
 #include "pageitem_regularpolygon.h"
 #include "ui/pageselector.h"
+#include "ui/polygonwidget.h"
 #include "prefscontext.h"
 #include "prefsfile.h"
 #include "prefsmanager.h"
@@ -157,6 +158,9 @@
 	polyCurvature = item->polyCurvature;
 	polyInnerRot = item->polyInnerRot;
 	polyOuterCurvature = item->polyOuterCurvature;
+	VectorDialog->polyWidget->blockSignals(true);
+	VectorDialog->setValues(polyCorners, polyFactor, polyUseFactor, polyRotation, polyCurvature, polyInnerRot, polyOuterCurvature);
+	VectorDialog->polyWidget->blockSignals(false);
 	uint cx = polyUseFactor ? polyCorners * 2 : polyCorners;
 	double seg = 360.0 / cx;
 	double trueLength = sqrt(pow(sin(seg / 180.0 * M_PI) * (item->width() / 2.0), 2) + pow(cos(seg / 180.0 * M_PI) * (item->height() / 2.0) + (item->height()/2.0) - item->height(), 2));
@@ -246,6 +250,23 @@
 	polyCurvature = polyCur;
 	polyInnerRot = polyIRot;
 	polyOuterCurvature = polyOCur;
+	SimpleState *ss = new SimpleState(Um::EditPolygon,"",Um::IPolygon);
+	ss->set("POLYGON","polygon");
+	ss->set("NEW_CORNER",polyC);
+	ss->set("NEW_USEFACTOR",polyUseCF);
+	ss->set("NEW_FACTOR",polyFactor);
+	ss->set("NEW_ROTATION",polyRotation);
+	ss->set("NEW_CURV",polyCurvature);
+	ss->set("NEW_INNER",polyInnerRot);
+	ss->set("NEW_OUTER",polyOuterCurvature);
+	ss->set("OLD_CORNER",item->polyCorners);
+	ss->set("OLD_USEFACTOR",item->polyUseFactor);
+	ss->set("OLD_FACTOR",item->polyFactor);
+	ss->set("OLD_ROTATION",item->polyRotation);
+	ss->set("OLD_CURV",item->polyCurvature);
+	ss->set("OLD_INNER",item->polyInnerRot);
+	ss->set("OLD_OUTER",item->polyOuterCurvature);
+	undoManager->action(currItem,ss);
 	item->polyCorners = polyC;
 	item->polyUseFactor = polyUseCF;
 	item->polyFactor = polyFactor;

Modified: trunk/Scribus/scribus/canvasmode_nodeedit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/canvasmode_nodeedit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_nodeedit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_nodeedit.cpp Thu Jul 12 20:32:18 2012
@@ -372,15 +372,15 @@
 	Mxp = m->x();
 	Myp = m->y();
 
-	if (((m->buttons() & Qt::RightButton) && (m->modifiers() & Qt::ControlModifier)) || ((!(m->modifiers() & Qt::ControlModifier)) && (m->buttons() & Qt::MidButton)))
-	{
-		if (!m_panGesture)
-		{
-			m_panGesture = new PanGesture(this);
-		}
-		m_view->startGesture(m_panGesture);
-		m_panGesture->mousePressEvent(m); // Not an error, this is used to register current canvas point
-		return;
+	if (((m->buttons() & Qt::RightButton) && (m->modifiers() & Qt::ControlModifier)) || ((!(m->modifiers() & Qt::ControlModifier)) && (m->buttons() & Qt::MidButton)))
+	{
+		if (!m_panGesture)
+		{
+			m_panGesture = new PanGesture(this);
+		}
+		m_view->startGesture(m_panGesture);
+		m_panGesture->mousePressEvent(m); // Not an error, this is used to register current canvas point
+		return;
 	}
 	
 	if (m_doc->m_Selection->count() != 0)
@@ -460,7 +460,9 @@
 			m_doc->nodeEdit.moveClipPoint(currItem, npf);
 		}
 
+		undoManager->setUndoEnabled(false);
 		m_doc->AdjustItemSize(currItem, true, true);
+		undoManager->setUndoEnabled(true);
 		if (!m_doc->nodeEdit.isContourLine)
 			currItem->ContourLine.translate(xposOrig - currItem->xPos(), yposOrig - currItem->yPos());
 		m_doc->regionsChanged()->update(QRectF());

Modified: trunk/Scribus/scribus/mesh.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/mesh.cpp
==============================================================================
--- trunk/Scribus/scribus/mesh.cpp (original)
+++ trunk/Scribus/scribus/mesh.cpp Thu Jul 12 20:32:18 2012
@@ -76,3 +76,11 @@
 	controlBottom = gridPoint;
 	controlColor = gridPoint;
 }
+
+bool meshPoint::operator ==(meshPoint p)
+{
+	return ((gridPoint == p.gridPoint) && (controlTop == p.controlTop) && (controlBottom == p.controlBottom)
+			&& (controlLeft == p.controlLeft) && (controlRight == p.controlRight) &&
+			(controlColor == p.controlColor) && (color == p.color) && (colorName == p.colorName) &&
+			(transparency == p.transparency) && (shade == p.shade));
+}

Modified: trunk/Scribus/scribus/mesh.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/mesh.h
==============================================================================
--- trunk/Scribus/scribus/mesh.h (original)
+++ trunk/Scribus/scribus/mesh.h Thu Jul 12 20:32:18 2012
@@ -38,6 +38,7 @@
 	void moveAbs(double x, double y);
 	void transform(QTransform t);
 	void resetTo(FPoint p);
+	bool operator ==(meshPoint p);
 	FPoint gridPoint;
 	FPoint controlTop;
 	FPoint controlBottom;

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Thu Jul 12 20:32:18 2012
@@ -43,6 +43,8 @@
 #include "commonstrings.h"
 
 #include "pageitem_group.h"
+#include "pageitem_regularpolygon.h"
+#include "pageitem_arc.h"
 #include "pageitem_textframe.h"
 #include "pageitem_latexframe.h"
 #include "prefsmanager.h"
@@ -1028,6 +1030,13 @@
 
 void PageItem::setImageRotation(const double newRotation)
 {
+	if(LocalRot == newRotation)
+		return;
+	SimpleState *ss = new SimpleState(Um::Rotate,"",Um::IRotate);
+	ss->set("IMAGE_ROTATION","image_rotation");
+	ss->set("OLD_ROT",LocalRot);
+	ss->set("NEW_ROT",newRotation);
+	undoManager->action(this,ss);
 	LocalRot = newRotation;
 	if (m_Doc->isLoading())
 		return;
@@ -2705,6 +2714,36 @@
 		gradientVal = newGradient;
 }
 
+void PageItem::setMaskGradient(VGradient grad){
+	if(mask_gradient==grad)
+		return;
+	ScItemState<QPair<VGradient,VGradient> > *is = new ScItemState<QPair<VGradient,VGradient> >(Um::GradVal);
+	is->set("MASK_GRAD","mask_grad");
+	is->setItem(qMakePair(mask_gradient,grad));
+	undoManager->action(this,is);
+	mask_gradient=grad;
+}
+
+void PageItem::setFillGradient(VGradient grad){
+	if(fill_gradient==grad)
+		return;
+	ScItemState<QPair<VGradient,VGradient> > *is = new ScItemState<QPair<VGradient,VGradient> >(Um::GradVal);
+	is->set("FILL_GRAD","fill_grad");
+	is->setItem(qMakePair(fill_gradient,grad));
+	undoManager->action(this,is);
+	fill_gradient=grad;
+}
+
+void PageItem::setStrokeGradient(VGradient grad){
+	if(stroke_gradient==grad)
+		return;
+	ScItemState<QPair<VGradient,VGradient> > *is = new ScItemState<QPair<VGradient,VGradient> >(Um::GradVal);
+	is->set("STROKE_GRAD","STROKE_grad");
+	is->setItem(qMakePair(stroke_gradient,grad));
+	undoManager->action(this,is);
+	stroke_gradient=grad;
+}
+
 void PageItem::setPattern(const QString &newPattern)
 {
 	if (patternVal != newPattern)
@@ -2730,23 +2769,29 @@
 
 void PageItem::set4ColorTransparency(double t1, double t2, double t3, double t4)
 {
-	GrCol1transp = t1;
-	GrCol2transp = t2;
-	GrCol3transp = t3;
-	GrCol4transp = t4;
+	UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
+	setGradientTransp1(t1);
+	setGradientTransp2(t2);
+	setGradientTransp3(t3);
+	setGradientTransp4(t4);
+	trans.commit();
 }
 
 void PageItem::set4ColorShade(int t1, int t2, int t3, int t4)
 {
-	GrCol1Shade = t1;
-	GrCol2Shade = t2;
-	GrCol3Shade = t3;
-	GrCol4Shade = t4;
+	UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
+	setGradientShade1(t1);
+	setGradientShade2(t2);
+	setGradientShade3(t3);
+	setGradientShade4(t4);
+	trans.commit();
 }
 
 void PageItem::set4ColorColors(QString col1, QString col2, QString col3, QString col4)
 {
-	GrColorP1 = col1;
+	QColor tmp;
+	UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
+	setGradientCol1(col1);
 	if (GrColorP1 != CommonStrings::None)
 	{
 		if (!m_Doc->PageColors.contains(GrColorP1))
@@ -2756,10 +2801,10 @@
 				case ImageFrame:
 				case LatexFrame:
 				case OSGFrame:
-					GrColorP1 = m_Doc->itemToolPrefs().imageFillColor;
+					setGradientCol1(m_Doc->itemToolPrefs().imageFillColor);
 				case TextFrame:
 				case PathText:
-					GrColorP1 = m_Doc->itemToolPrefs().textFillColor;
+					setGradientCol1(m_Doc->itemToolPrefs().textFillColor);
 					break;
 				case Line:
 				case PolyLine:
@@ -2767,24 +2812,25 @@
 				case RegularPolygon:
 				case Arc:
 				case Spiral:
-					GrColorP1 = m_Doc->itemToolPrefs().shapeFillColor;
+					setGradientCol1(m_Doc->itemToolPrefs().shapeFillColor);
 					break;
 				default:
 					break;
 			}
 		}
 		const ScColor& col = m_Doc->PageColors[GrColorP1];
-		GrColorP1QColor = ScColorEngine::getShadeColorProof(col, m_Doc, GrCol1Shade);
-		GrColorP1QColor.setAlphaF(GrCol1transp);
-	}
-	else
-		GrColorP1QColor = QColor(255, 255, 255, 0);
+		tmp = ScColorEngine::getShadeColorProof(col, m_Doc, GrCol1Shade);
+		tmp.setAlphaF(GrCol1transp);
+		setGradientColor1(tmp);
+	}
+	else
+		setGradientColor1(QColor(255, 255, 255, 0));
 	if (m_Doc->viewAsPreview)
 	{
 		VisionDefectColor defect;
-		GrColorP1QColor = defect.convertDefect(GrColorP1QColor, m_Doc->previewVisual);
-	}
-	GrColorP2 = col2;
+		setGradientColor1(defect.convertDefect(GrColorP1QColor, m_Doc->previewVisual));
+	}
+	setGradientCol2(col2);
 	if (GrColorP2 != CommonStrings::None)
 	{
 		if (!m_Doc->PageColors.contains(GrColorP2))
@@ -2794,10 +2840,10 @@
 				case ImageFrame:
 				case LatexFrame:
 				case OSGFrame:
-					GrColorP2 = m_Doc->itemToolPrefs().imageFillColor;
+					setGradientCol2(m_Doc->itemToolPrefs().imageFillColor);
 				case TextFrame:
 				case PathText:
-					GrColorP2 = m_Doc->itemToolPrefs().textFillColor;
+					setGradientCol2(m_Doc->itemToolPrefs().textFillColor);
 					break;
 				case Line:
 				case PolyLine:
@@ -2805,24 +2851,25 @@
 				case RegularPolygon:
 				case Arc:
 				case Spiral:
-					GrColorP2 = m_Doc->itemToolPrefs().shapeFillColor;
+					setGradientCol2(m_Doc->itemToolPrefs().shapeFillColor);
 					break;
 				default:
 					break;
 			}
 		}
 		const ScColor& col = m_Doc->PageColors[GrColorP2];
-		GrColorP2QColor = ScColorEngine::getShadeColorProof(col, m_Doc, GrCol2Shade);
-		GrColorP2QColor.setAlphaF(GrCol2transp);
-	}
-	else
-		GrColorP2QColor = QColor(255, 255, 255, 0);
+		tmp = ScColorEngine::getShadeColorProof(col, m_Doc, GrCol2Shade);
+		tmp.setAlphaF(GrCol2transp);
+		setGradientColor2(tmp);
+	}
+	else
+		setGradientColor2(QColor(255, 255, 255, 0));
 	if (m_Doc->viewAsPreview)
 	{
 		VisionDefectColor defect;
-		GrColorP2QColor = defect.convertDefect(GrColorP2QColor, m_Doc->previewVisual);
-	}
-	GrColorP3 = col3;
+		setGradientColor2(defect.convertDefect(GrColorP2QColor, m_Doc->previewVisual));
+	}
+	setGradientCol3(col3);
 	if (GrColorP3 != CommonStrings::None)
 	{
 		if (!m_Doc->PageColors.contains(GrColorP3))
@@ -2832,10 +2879,10 @@
 				case ImageFrame:
 				case LatexFrame:
 				case OSGFrame:
-					GrColorP3 = m_Doc->itemToolPrefs().imageFillColor;
+					setGradientCol3(m_Doc->itemToolPrefs().imageFillColor);
 				case TextFrame:
 				case PathText:
-					GrColorP3 = m_Doc->itemToolPrefs().textFillColor;
+					setGradientCol3(m_Doc->itemToolPrefs().textFillColor);
 					break;
 				case Line:
 				case PolyLine:
@@ -2843,24 +2890,25 @@
 				case RegularPolygon:
 				case Arc:
 				case Spiral:
-					GrColorP3 = m_Doc->itemToolPrefs().shapeFillColor;
+					setGradientCol3(m_Doc->itemToolPrefs().shapeFillColor);
 					break;
 				default:
 					break;
 			}
 		}
 		const ScColor& col = m_Doc->PageColors[GrColorP3];
-		GrColorP3QColor = ScColorEngine::getShadeColorProof(col, m_Doc, GrCol3Shade);
-		GrColorP3QColor.setAlphaF(GrCol3transp);
-	}
-	else
-		GrColorP3QColor = QColor(255, 255, 255, 0);
+		tmp = ScColorEngine::getShadeColorProof(col, m_Doc, GrCol3Shade);
+		tmp.setAlphaF(GrCol3transp);
+		setGradientColor3(tmp);
+	}
+	else
+		setGradientColor3(QColor(255, 255, 255, 0));
 	if (m_Doc->viewAsPreview)
 	{
 		VisionDefectColor defect;
-		GrColorP3QColor = defect.convertDefect(GrColorP3QColor, m_Doc->previewVisual);
-	}
-	GrColorP4 = col4;
+		setGradientColor3(defect.convertDefect(GrColorP3QColor, m_Doc->previewVisual));
+	}
+	setGradientCol4(col4);
 	if (GrColorP4 != CommonStrings::None)
 	{
 		if (!m_Doc->PageColors.contains(GrColorP4))
@@ -2870,10 +2918,10 @@
 				case ImageFrame:
 				case LatexFrame:
 				case OSGFrame:
-					GrColorP4 = m_Doc->itemToolPrefs().imageFillColor;
+					setGradientCol4(m_Doc->itemToolPrefs().imageFillColor);
 				case TextFrame:
 				case PathText:
-					GrColorP4 = m_Doc->itemToolPrefs().textFillColor;
+					setGradientCol4(m_Doc->itemToolPrefs().textFillColor);
 					break;
 				case Line:
 				case PolyLine:
@@ -2881,23 +2929,25 @@
 				case RegularPolygon:
 				case Arc:
 				case Spiral:
-					GrColorP4 = m_Doc->itemToolPrefs().shapeFillColor;
+					setGradientCol4(m_Doc->itemToolPrefs().shapeFillColor);
 					break;
 				default:
 					break;
 			}
 		}
 		const ScColor& col = m_Doc->PageColors[GrColorP4];
-		GrColorP4QColor = ScColorEngine::getShadeColorProof(col, m_Doc, GrCol4Shade);
-		GrColorP4QColor.setAlphaF(GrCol4transp);
-	}
-	else
-		GrColorP4QColor = QColor(255, 255, 255, 0);
+		tmp = ScColorEngine::getShadeColorProof(col, m_Doc, GrCol4Shade);
+		tmp.setAlphaF(GrCol4transp);
+		setGradientColor4(tmp);
+	}
+	else
+		setGradientColor4(QColor(255, 255, 255, 0));
 	if (m_Doc->viewAsPreview)
 	{
 		VisionDefectColor defect;
-		GrColorP4QColor = defect.convertDefect(GrColorP4QColor, m_Doc->previewVisual);
-	}
+		setGradientColor4(defect.convertDefect(GrColorP4QColor, m_Doc->previewVisual));
+	}
+	trans.commit();
 }
 
 void PageItem::get4ColorGeometry(FPoint &c1, FPoint &c2, FPoint &c3, FPoint &c4)
@@ -2965,86 +3015,158 @@
 		VisionDefectColor defect;
 		MQColor = defect.convertDefect(MQColor, m_Doc->previewVisual);
 	}
+	meshPoint *mp;
 	if (forPatch)
 	{
-		meshGradientPatch patch = meshGradientPatches[x];
-		meshPoint mp;
+		UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
+		ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
+		ss->set("GRAD_MESH_COLOR","grad_mesh_color");
+		ss->set("X",x);
+		ss->set("Y",y);
+		ss->set("PATCH",true);
+		meshGradientPatch *patch = &meshGradientPatches[x];
 		switch (y)
 		{
 			case 1:
-				mp = meshGradientPatches[x].TL;
-				meshGradientPatches[x].TL.colorName = MColor;
-				meshGradientPatches[x].TL.color = MQColor;
-				meshGradientPatches[x].TL.shade = shade;
-				meshGradientPatches[x].TL.transparency = transparency;
+				mp = &(patch->TL);
 				break;
 			case 2:
-				mp = meshGradientPatches[x].TR;
-				meshGradientPatches[x].TR.colorName = MColor;
-				meshGradientPatches[x].TR.color = MQColor;
-				meshGradientPatches[x].TR.shade = shade;
-				meshGradientPatches[x].TR.transparency = transparency;
+				mp = &(patch->TR);
 				break;
 			case 3:
-				mp = meshGradientPatches[x].BR;
-				meshGradientPatches[x].BR.colorName = MColor;
-				meshGradientPatches[x].BR.color = MQColor;
-				meshGradientPatches[x].BR.shade = shade;
-				meshGradientPatches[x].BR.transparency = transparency;
+				mp = &(patch->BR);
 				break;
 			case 4:
-				mp = meshGradientPatches[x].BL;
-				meshGradientPatches[x].BL.colorName = MColor;
-				meshGradientPatches[x].BL.color = MQColor;
-				meshGradientPatches[x].BL.shade = shade;
-				meshGradientPatches[x].BL.transparency = transparency;
+				mp = &(patch->BL);
 				break;
 		}
-		FPoint xx = mp.gridPoint;
+		ss->set("OLD_COLOR_NAME",mp->colorName);
+		ss->set("NEW_COLOR_NAME",MColor);
+		ss->setItem(qMakePair(mp->color,MQColor));
+		ss->set("OLD_SHADE",mp->shade);
+		ss->set("NEW_SHADE",shade);
+		ss->set("OLD_TRANSP",mp->transparency);
+		ss->set("NEW_TRANSP",transparency);
+		mp->colorName = MColor;
+		mp->color = MQColor;
+		mp->shade = shade;
+		mp->transparency = transparency;
+		undoManager->action(this,ss);
+		FPoint xx = mp->gridPoint;
 		for (int col = 0; col < meshGradientPatches.count(); col++)
 		{
 			if (col != x)
 			{
 				if (meshGradientPatches[col].TL.gridPoint == xx)
 				{
-					meshGradientPatches[col].TL.colorName = MColor;
-					meshGradientPatches[col].TL.color = MQColor;
-					meshGradientPatches[col].TL.shade = shade;
-					meshGradientPatches[col].TL.transparency = transparency;
+					ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
+					ss->set("GRAD_MESH_COLOR","grad_mesh_color");
+					ss->set("X",col);
+					ss->set("Y",1);
+					ss->set("PATCH",true);
+					mp = &(meshGradientPatches[col].TL);
+					ss->set("OLD_COLOR_NAME",mp->colorName);
+					ss->set("NEW_COLOR_NAME",MColor);
+					ss->setItem(qMakePair(mp->color,MQColor));
+					ss->set("OLD_SHADE",mp->shade);
+					ss->set("NEW_SHADE",shade);
+					ss->set("OLD_TRANSP",mp->transparency);
+					ss->set("NEW_TRANSP",transparency);
+					mp->colorName = MColor;
+					mp->color = MQColor;
+					mp->shade = shade;
+					mp->transparency = transparency;
+					undoManager->action(this,ss);
 				}
 				if (meshGradientPatches[col].TR.gridPoint == xx)
 				{
-					meshGradientPatches[col].TR.colorName = MColor;
-					meshGradientPatches[col].TR.color = MQColor;
-					meshGradientPatches[col].TR.shade = shade;
-					meshGradientPatches[col].TR.transparency = transparency;
+					ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
+					ss->set("GRAD_MESH_COLOR","grad_mesh_color");
+					ss->set("X",col);
+					ss->set("Y",2);
+					ss->set("PATCH",true);
+					mp = &(meshGradientPatches[col].TR);
+					ss->set("OLD_COLOR_NAME",mp->colorName);
+					ss->set("NEW_COLOR_NAME",MColor);
+					ss->setItem(qMakePair(mp->color,MQColor));
+					ss->set("OLD_SHADE",mp->shade);
+					ss->set("NEW_SHADE",shade);
+					ss->set("OLD_TRANSP",mp->transparency);
+					ss->set("NEW_TRANSP",transparency);
+					mp->colorName = MColor;
+					mp->color = MQColor;
+					mp->shade = shade;
+					mp->transparency = transparency;
+					undoManager->action(this,ss);
 				}
 				if (meshGradientPatches[col].BR.gridPoint == xx)
 				{
-					meshGradientPatches[col].BR.colorName = MColor;
-					meshGradientPatches[col].BR.color = MQColor;
-					meshGradientPatches[col].BR.shade = shade;
-					meshGradientPatches[col].BR.transparency = transparency;
+					ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
+					ss->set("GRAD_MESH_COLOR","grad_mesh_color");
+					ss->set("X",col);
+					ss->set("Y",3);
+					ss->set("PATCH",true);
+					mp = &(meshGradientPatches[col].BR);
+					ss->set("OLD_COLOR_NAME",mp->colorName);
+					ss->set("NEW_COLOR_NAME",MColor);
+					ss->setItem(qMakePair(mp->color,MQColor));
+					ss->set("OLD_SHADE",mp->shade);
+					ss->set("NEW_SHADE",shade);
+					ss->set("OLD_TRANSP",mp->transparency);
+					ss->set("NEW_TRANSP",transparency);
+					mp->colorName = MColor;
+					mp->color = MQColor;
+					mp->shade = shade;
+					mp->transparency = transparency;
+					undoManager->action(this,ss);
 				}
 				if (meshGradientPatches[col].BL.gridPoint == xx)
 				{
-					meshGradientPatches[col].BL.colorName = MColor;
-					meshGradientPatches[col].BL.color = MQColor;
-					meshGradientPatches[col].BL.shade = shade;
-					meshGradientPatches[col].BL.transparency = transparency;
+					ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
+					ss->set("GRAD_MESH_COLOR","grad_mesh_color");
+					ss->set("X",col);
+					ss->set("Y",4);
+					ss->set("PATCH",true);
+					mp = &(meshGradientPatches[col].BL);
+					ss->set("OLD_COLOR_NAME",mp->colorName);
+					ss->set("NEW_COLOR_NAME",MColor);
+					ss->setItem(qMakePair(mp->color,MQColor));
+					ss->set("OLD_SHADE",mp->shade);
+					ss->set("NEW_SHADE",shade);
+					ss->set("OLD_TRANSP",mp->transparency);
+					ss->set("NEW_TRANSP",transparency);
+					mp->colorName = MColor;
+					mp->color = MQColor;
+					mp->shade = shade;
+					mp->transparency = transparency;
+					undoManager->action(this,ss);
 				}
 			}
 		}
-
+		trans.commit();
 	}
 	else
 	{
 		if ((x > -1) && (y > -1))
 		{
-			meshGradientArray[x][y].colorName = MColor;
-			meshGradientArray[x][y].color = MQColor;
-			meshGradientArray[x][y].shade = shade;
-			meshGradientArray[x][y].transparency = transparency;
+			ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradVal);
+			ss->set("GRAD_MESH_COLOR","grad_mesh_color");
+			ss->set("X",x);
+			ss->set("Y",y);
+			ss->set("PATCH",false);
+			mp = &(meshGradientArray[x][y]);
+			ss->set("OLD_COLOR_NAME",mp->colorName);
+			ss->set("NEW_COLOR_NAME",MColor);
+			ss->setItem(qMakePair(mp->color,MQColor));
+			ss->set("OLD_SHADE",mp->shade);
+			ss->set("NEW_SHADE",shade);
+			ss->set("OLD_TRANSP",mp->transparency);
+			ss->set("NEW_TRANSP",transparency);
+			mp->colorName = MColor;
+			mp->color = MQColor;
+			mp->shade = shade;
+			mp->transparency = transparency;
+			undoManager->action(this,ss);
 		}
 	}
 }
@@ -3090,6 +3212,12 @@
 		VisionDefectColor defect;
 		MQColor = defect.convertDefect(MQColor, m_Doc->previewVisual);
 	}
+	ScItemState<QList<QList<meshPoint> > > *is = new ScItemState<QList<QList<meshPoint> > >(Um::MeshGradient);
+	is->set("CREATE_MESH_GRAD","create_mesh_grad");
+	is->set("ROW",rows);
+	is->set("COL",cols);
+	is->setItem(meshGradientArray);
+	undoManager->action(this,is);
 	meshGradientArray.clear();
 	double xoffs = Width / static_cast<double>(cols);
 	double yoffs = Height / static_cast<double>(rows);
@@ -3099,12 +3227,7 @@
 		for (int y = 0; y < cols + 1; y++)
 		{
 			meshPoint mgP;
-			mgP.gridPoint = FPoint(y * xoffs, x * yoffs);
-			mgP.controlTop = mgP.gridPoint;
-			mgP.controlBottom = mgP.gridPoint;
-			mgP.controlLeft = mgP.gridPoint;
-			mgP.controlRight = mgP.gridPoint;
-			mgP.controlColor = mgP.gridPoint;
+			mgP.resetTo(FPoint(y * xoffs, x * yoffs));
 			mgP.transparency = 1.0;
 			mgP.shade = 100;
 			mgP.colorName = MColor;
@@ -3119,20 +3242,15 @@
 {
 	int rows = meshGradientArray.count();
 	int cols = meshGradientArray[0].count();
+	ScItemState<QList<QList<meshPoint> > > *is = new ScItemState<QList<QList<meshPoint> > >(Um::ResetControlPoints);
+	is->set("RESET_MESH_GRAD","reset_mesh_grad");
+	is->setItem(meshGradientArray);
+	undoManager->action(this,is);
 	double xoffs = Width / static_cast<double>(cols-1);
 	double yoffs = Height / static_cast<double>(rows-1);
 	for (int x = 0; x < rows; x++)
-	{
 		for (int y = 0; y < cols; y++)
-		{
-			meshGradientArray[x][y].gridPoint = FPoint(y * xoffs, x * yoffs);
-			meshGradientArray[x][y].controlTop = meshGradientArray[x][y].gridPoint;
-			meshGradientArray[x][y].controlBottom = meshGradientArray[x][y].gridPoint;
-			meshGradientArray[x][y].controlLeft = meshGradientArray[x][y].gridPoint;
-			meshGradientArray[x][y].controlRight = meshGradientArray[x][y].gridPoint;
-			meshGradientArray[x][y].controlColor = meshGradientArray[x][y].gridPoint;
-		}
-	}
+			meshGradientArray[x][y].resetTo(FPoint(y * xoffs, x * yoffs));
 }
 
 void PageItem::meshToShape()
@@ -3171,6 +3289,15 @@
 								meshGradientArray[m-1][0].gridPoint.x(), meshGradientArray[m-1][0].gridPoint.y());
 	}
 	
+	UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::ChangeMeshGradient,"",Um::IFill));
+	ScItemState<QPair<QList<QList<meshPoint> >,FPointArray> > *ism = new ScItemState<QPair<QList<QList<meshPoint> >,FPointArray> >(Um::ChangeMeshGradient, "",Um::IFill);
+	ism->set("MOVE_MESH_GRAD", "move_mesh_grad");
+	ism->setItem(qMakePair(meshGradientArray,PoLine));
+	ism->set("OLDB",OldB2);
+	ism->set("OLDH",OldH2);
+	ism->set("FRAME_TYPE",FrameType);
+	undoManager->action(this, ism);
+
 	QList<QList<meshPoint> > meshGradientArrayOld = meshGradientArray;
 	PoLine = Coords.copy();
 	double oldX = Xpos;
@@ -3187,13 +3314,14 @@
 	double dx = oldX - Xpos;
 	double dy = oldY - Ypos;
 	for (int x = 0; x < rows+1; x++)
-	{
 		for (int y = 0; y < cols+1; y++)
-		{
 			meshGradientArray[x][y].moveRel(dx, dy);
-		}
-	}
+	ScItemState<FPointArray> *is = new ScItemState<FPointArray>(Um::ResetContourLine, "",Um::IBorder);
+	is->set("RESET_CONTOUR", "reset_contour");
+	is->setItem(ContourLine);
+	undoManager->action(this, is);
 	ContourLine = PoLine.copy();
+	trans.commit();
 }
 
 void PageItem::createConicalMesh()
@@ -3473,6 +3601,18 @@
 	flipY = patternMirrorY;
 }
 
+void PageItem::setMaskType(int val)
+{
+	if(GrMask==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradTypeMask,"",Um::IFill);
+	ss->set("MASKTYPE","masktype");
+	ss->set("NEW",val);
+	ss->set("OLD",GrMask);
+	undoManager->action(this,ss);
+	GrMask = val;
+}
+
 void PageItem::setGradientMask(const QString &newMask)
 {
 	if (gradientMaskVal != newMask)
@@ -3992,6 +4132,11 @@
 {
 	if (m_startArrowScale == newScale)
 		return; // nothing to do -> return
+	SimpleState *ss = new SimpleState(Um::StartArrowScale,"",Um::IArrow);
+	ss->set("START_ARROWSCALE","start_arrowscale");
+	ss->set("OLD_SCALE",m_startArrowScale);
+	ss->set("NEW_SCALE",newScale);
+	undoManager->action(this,ss);
 	m_startArrowScale = newScale;
 }
 
@@ -3999,6 +4144,11 @@
 {
 	if (m_endArrowScale == newScale)
 		return; // nothing to do -> return
+	SimpleState *ss = new SimpleState(Um::EndArrowScale,"",Um::IArrow);
+	ss->set("END_ARROWSCALE","end_arrowscale");
+	ss->set("OLD_SCALE",m_endArrowScale);
+	ss->set("NEW_SCALE",newScale);
+	undoManager->action(this,ss);
 	m_endArrowScale = newScale;
 }
 
@@ -4501,12 +4651,134 @@
 	}
 	if (ss)
 	{
-		if (ss->contains("OLD_XPOS"))
-			restoreMove(ss, isUndo);
+		if (ss->contains("GRAD_COL1"))
+			restoreGradientCol1(ss, isUndo);
+		else if (ss->contains("ARC"))
+			restoreArc(ss, isUndo);
+		else if (ss->contains("MASKTYPE"))
+			restoreMaskType(ss, isUndo);
+		else if (ss->contains("SNAP_TO_PATCH"))
+			restoreSnapToPatchGrid(ss, isUndo);
+		else if ((ss->contains("UNDO_UPDATE_CONICAL") && isUndo) || (ss->contains("REDO_UPDATE_CONICAL") && !isUndo))
+			createConicalMesh();
+		else if (ss->contains("GRAD_COL2"))
+			restoreGradientCol2(ss, isUndo);
+		else if (ss->contains("GRAD_COL3"))
+			restoreGradientCol3(ss, isUndo);
+		else if (ss->contains("GRAD_COL4"))
+			restoreGradientCol4(ss, isUndo);
+		else if (ss->contains("GRAD_POS"))
+			restoreGradPos(ss, isUndo);
+		else if (ss->contains("GRAD_QCOLOR1"))
+			restoreGradientColor1(ss, isUndo);
+		else if (ss->contains("GRAD_QCOLOR2"))
+			restoreGradientColor2(ss, isUndo);
+		else if (ss->contains("GRAD_QCOLOR3"))
+			restoreGradientColor3(ss, isUndo);
+		else if (ss->contains("GRAD_QCOLOR4"))
+			restoreGradientColor4(ss, isUndo);
+		else if (ss->contains("POLYGON"))
+			restorePolygon(ss, isUndo);
+		else if (ss->contains("GRAD_TRANSP1"))
+			restoreGradientTrans1(ss, isUndo);
+		else if (ss->contains("GRAD_TRANSP2"))
+			restoreGradientTrans2(ss, isUndo);
+		else if (ss->contains("GRAD_TRANSP3"))
+			restoreGradientTrans3(ss, isUndo);
+		else if (ss->contains("GRAD_TRANSP4"))
+			restoreGradientTrans4(ss, isUndo);
+		else if (ss->contains("GRAD_SHADE1"))
+			restoreGradientShade1(ss, isUndo);
+		else if (ss->contains("GRAD_SHADE2"))
+			restoreGradientShade2(ss, isUndo);
+		else if (ss->contains("GRAD_SHADE3"))
+			restoreGradientShade3(ss, isUndo);
+		else if (ss->contains("GRAD_SHADE4"))
+			restoreGradientShade4(ss, isUndo);
+		else if (ss->contains("MOVE_MESH_PATCH"))
+			restoreMoveMeshPatch(ss, isUndo);
+		else if (ss->contains("FILL_GRAD"))
+			restoreFillGradient(ss, isUndo);
+		else if (ss->contains("MASK_GRAD"))
+			restoreMaskGradient(ss, isUndo);
+		else if (ss->contains("STROKE_GRAD"))
+			restoreStrokeGradient(ss, isUndo);
+		else if (ss->contains("GRAD_MESH_COLOR"))
+			restoreGradientMeshColor(ss, isUndo);
+		else if (ss->contains("GRADSTROKE_STARTX"))
+			restoreGradientStrokeStartX(ss, isUndo);
+		else if (ss->contains("GRADSTROKE_ENDX"))
+			restoreGradientStrokeEndX(ss, isUndo);
+		else if (ss->contains("GRADSTROKE_STARTY"))
+			restoreGradientStrokeStartY(ss, isUndo);
+		else if (ss->contains("GRADSTROKE_ENDY"))
+			restoreGradientStrokeEndY(ss, isUndo);
+		else if (ss->contains("GRADSTROKE_FOCALX"))
+			restoreGradientStrokeFocalX(ss, isUndo);
+		else if (ss->contains("GRADSTROKE_FOCALY"))
+			restoreGradientStrokeFocalY(ss, isUndo);
+		else if (ss->contains("GRAD_FOCALX"))
+			restoreGradientFocalX(ss, isUndo);
+		else if (ss->contains("GRAD_FOCALY"))
+			restoreGradientFocalY(ss, isUndo);
+		else if (ss->contains("GRAD_MASKFOCALX"))
+			restoreGradientMaskFocalX(ss, isUndo);
+		else if (ss->contains("GRAD_MASKFOCALY"))
+			restoreGradientMaskFocalY(ss, isUndo);
+		else if (ss->contains("GRADSTROKE_SCALE"))
+			restoreGradientStrokeScale(ss, isUndo);
+		else if (ss->contains("GRADSTROKE_SKEW"))
+			restoreGradientStrokeSkew(ss, isUndo);
+		else if (ss->contains("GRAD_CONTROL1"))
+			restoreGradientControl1(ss, isUndo);
+		else if (ss->contains("GRAD_CONTROL2"))
+			restoreGradientControl2(ss, isUndo);
+		else if (ss->contains("GRAD_CONTROL3"))
+			restoreGradientControl3(ss, isUndo);
+		else if (ss->contains("GRAD_CONTROL4"))
+			restoreGradientControl4(ss, isUndo);
+		else if (ss->contains("GRAD_CONTROL5"))
+			restoreGradientControl5(ss, isUndo);
+		else if (ss->contains("GRAD_SCALE"))
+			restoreGradientScale(ss, isUndo);
+		else if (ss->contains("GRAD_SKEW"))
+			restoreGradientSkew(ss, isUndo);
+		else if (ss->contains("GRAD_STARTX"))
+			restoreGradientStartX(ss, isUndo);
+		else if (ss->contains("GRAD_ENDX"))
+			restoreGradientEndX(ss, isUndo);
+		else if (ss->contains("GRAD_STARTY"))
+			restoreGradientStartY(ss, isUndo);
+		else if (ss->contains("GRAD_ENDY"))
+			restoreGradientEndY(ss, isUndo);
+		else if (ss->contains("GRAD_MASKSCALE"))
+			restoreGradientMaskScale(ss, isUndo);
+		else if (ss->contains("GRAD_MASKSKEW"))
+			restoreGradientMaskSkew(ss, isUndo);
+		else if (ss->contains("GRAD_MASKSTARTX"))
+			restoreGradientMaskStartX(ss, isUndo);
+		else if (ss->contains("GRAD_MASKENDX"))
+			restoreGradientMaskEndX(ss, isUndo);
+		else if (ss->contains("GRAD_MASKSTARTY"))
+			restoreGradientMaskStartY(ss, isUndo);
+		else if (ss->contains("GRAD_MASKENDY"))
+			restoreGradientMaskEndY(ss, isUndo);
+		else if (ss->contains("GRAD_TYPE"))
+			restoreGradientType(ss, isUndo);
+		else if (ss->contains("GRAD_TYPESTROKE"))
+			restoreGradientTypeStroke(ss, isUndo);
+		else if (ss->contains("END_ARROWSCALE"))
+			restoreEndArrowScale(ss, isUndo);
+		else if (ss->contains("START_ARROWSCALE"))
+			restoreStartArrowScale(ss, isUndo);
+		else if (ss->contains("IMAGE_ROTATION"))
+			restoreImageRotation(ss, isUndo);
 		else if (ss->contains("OLD_HEIGHT"))
 			restoreResize(ss, isUndo);
 		else if (ss->contains("OLD_ROT"))
 			restoreRotate(ss, isUndo);
+		else if (ss->contains("OLD_XPOS"))
+			restoreMove(ss, isUndo);
 		else if (ss->contains("FILL"))
 			restoreFill(ss, isUndo);
 		else if (ss->contains("SHADE"))
@@ -4657,6 +4929,14 @@
 			restoreUniteItem(ss, isUndo);
 		else if (ss->contains("SPLITITEM"))
 			restoreSplitItem(ss, isUndo);
+		else if (ss->contains("CREATE_MESH_GRAD"))
+			restoreCreateMeshGrad(ss, isUndo);
+		else if (ss->contains("MOVE_MESH_GRAD"))
+			restoreMoveMeshGrad(ss, isUndo);
+		else if (ss->contains("RESET_MESH_GRAD"))
+			restoreResetMeshGrad(ss, isUndo);
+		else if (ss->contains("REMOVE_MESH_PATCH"))
+			restoreRemoveMeshPatch(ss, isUndo);
 		else if (ss->contains("MIRROR_PATH_H"))
 		{
 			bool editContour = m_Doc->nodeEdit.isContourLine;
@@ -4691,8 +4971,14 @@
 			restoreClearImage(ss,isUndo);
 		else if (ss->contains("PASTE_INLINE"))
 			restorePasteInline(ss,isUndo);
+		else if (ss->contains("TRANSFORM"))
+			restoreTransform(ss, isUndo);
 		else if (ss->contains("PATH_OPERATION"))
 			restorePathOperation(ss, isUndo);
+		else if (ss->contains("IMAGE_NBR"))
+			restoreImageNbr(ss, isUndo);
+		else if (ss->contains("CHANGE_MODE"))
+			restoreAppMode(ss, isUndo);
 	}
 	if (!OnMasterPage.isEmpty())
 		m_Doc->setCurrentPage(oldCurrentPage);
@@ -4701,6 +4987,815 @@
 	m_Doc->SnapGuides = SnapGuidesBackup;
 }
 
+void PageItem::restoreAppMode(SimpleState *state, bool isUndo)
+{
+	doc()->m_Selection->clear();
+	select();
+	if(isUndo)
+		doc()->view()->requestMode(state->getInt("OLD"));
+	else
+		doc()->view()->requestMode(state->getInt("NEW"));
+}
+
+void PageItem::restorePolygon(SimpleState *ss, bool isUndo)
+{
+	PageItem_RegularPolygon *item = asRegularPolygon();
+	if (isUndo)
+	{
+		item->polyCorners = ss->getInt("OLD_CORNER");
+		item->polyUseFactor = ss->getBool("OLD_USEFACTOR");
+		item->polyFactor = ss->getDouble("OLD_FACTOR");
+		item->polyRotation = ss->getDouble("OLD_ROTATION");
+		item->polyCurvature = ss->getDouble("OLD_CURV");
+		item->polyInnerRot = ss->getDouble("OLD_INNER");
+		item->polyOuterCurvature = ss->getDouble("OLD_OUTER");
+	}
+	else
+	{
+		item->polyCorners = ss->getInt("NEW_CORNER");
+		item->polyUseFactor = ss->getBool("NEW_USEFACTOR");
+		item->polyFactor = ss->getDouble("NEW_FACTOR");
+		item->polyRotation = ss->getDouble("NEW_ROTATION");
+		item->polyCurvature = ss->getDouble("NEW_CURV");
+		item->polyInnerRot = ss->getDouble("NEW_INNER");
+		item->polyOuterCurvature = ss->getDouble("NEW_OUTER");
+	}
+	item->recalcPath();
+	update();
+	doc()->changed();
+}
+
+void PageItem::restoreArc(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<FPointArray, FPointArray> > *ss = dynamic_cast<ScItemState<QPair<FPointArray, FPointArray> > *>(state);
+	PageItem_Arc *item = asArc();
+	if (isUndo)
+	{
+		item->arcHeight = ss->getDouble("OLD_HEIGHT");
+		item->arcWidth = ss->getDouble("OLD_WIDTH");
+		item->arcStartAngle = ss->getDouble("OLD_START");
+		item->arcSweepAngle = ss->getDouble("OLD_SWEEP");
+		item->PoLine = ss->getItem().first;
+		doc()->AdjustItemSize(item);
+		moveBy(ss->getDouble("OLD_XPOS") - xPos(),ss->getDouble("OLD_YPOS") - yPos());
+	}
+	else
+	{
+		item->arcHeight = ss->getDouble("NEW_HEIGHT");
+		item->arcWidth = ss->getDouble("NEW_WIDTH");
+		item->arcStartAngle = ss->getDouble("NEW_START");
+		item->arcSweepAngle = ss->getDouble("NEW_SWEEP");
+		item->PoLine = ss->getItem().second;
+		doc()->AdjustItemSize(item);
+		moveBy(ss->getDouble("NEW_XPOS") - xPos(),ss->getDouble("NEW_YPOS") - yPos());
+	}
+	update();
+	//doc()->changed();
+}
+
+void PageItem::restoreImageNbr(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		pixm.imgInfo.actualPageNumber = state->getInt("OLD");
+	else
+		pixm.imgInfo.actualPageNumber = state->getInt("NEW");
+	loadImage(externalFile(), true);
+	update();
+}
+
+void PageItem::restoreTransform(SimpleState *ss, bool isUndo)
+{
+	ScItemState<QList<QTransform> > *is = dynamic_cast<ScItemState<QList<QTransform > >*>(ss);
+	int x = is->getDouble("DX");
+	int y = is->getDouble("DY");
+	if (isUndo)
+	{
+		PoLine.translate(x,y);
+		PoLine.map(is->getItem().at(2).inverted());
+		PoLine.map(is->getItem().at(1).inverted());
+		PoLine.map(is->getItem().at(0).inverted());
+		PoLine.translate(-x,-y);
+		ContourLine.translate(x,y);
+		ContourLine.map(is->getItem().at(2).inverted());
+		ContourLine.map(is->getItem().at(1).inverted());
+		ContourLine.map(is->getItem().at(0).inverted());
+		ContourLine.translate(-x,-y);
+		doc()->AdjustItemSize(this);
+		moveBy(is->getDouble("POSX") - xPos(),is->getDouble("POSY") - yPos());
+	}
+	else
+	{
+		PoLine.translate(x,y);
+		PoLine.map(is->getItem().at(0));
+		PoLine.map(is->getItem().at(1));
+		PoLine.map(is->getItem().at(2));
+		PoLine.translate(-x,-y);
+		ContourLine.translate(x,y);
+		ContourLine.map(is->getItem().at(0));
+		ContourLine.map(is->getItem().at(1));
+		ContourLine.map(is->getItem().at(2));
+		ContourLine.translate(-x,-y);
+		doc()->AdjustItemSize(this);
+	}
+}
+
+void PageItem::restoreSnapToPatchGrid(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		snapToPatchGrid = state->getBool("OLD");
+	else
+		snapToPatchGrid = !state->getBool("OLD");
+	update();
+}
+
+
+void PageItem::restoreMaskType(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		GrMask = state->getInt("OLD");
+	else
+		GrMask = state->getInt("NEW");
+	update();
+}
+
+void PageItem::restoreGradientCol1(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		GrColorP1 = state->get("OLD");
+	else
+		GrColorP1 = state->get("NEW");
+	update();
+}
+
+void PageItem::restoreGradientCol2(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		GrColorP2 = state->get("OLD");
+	else
+		GrColorP2 = state->get("NEW");
+	update();
+}
+
+void PageItem::restoreGradientCol3(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		GrColorP3 = state->get("OLD");
+	else
+		GrColorP3 = state->get("NEW");
+	update();
+}
+
+void PageItem::restoreGradientCol4(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		GrColorP4 = state->get("OLD");
+	else
+		GrColorP4 = state->get("NEW");
+	update();
+}
+
+void PageItem::restoreGradientShade1(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		GrCol1Shade = state->getInt("OLD");
+	else
+		GrCol1Shade = state->getInt("NEW");
+	update();
+}
+
+void PageItem::restoreGradientShade2(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		GrCol2Shade = state->getInt("OLD");
+	else
+		GrCol2Shade = state->getInt("NEW");
+	update();
+}
+
+void PageItem::restoreGradientShade3(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		GrCol3Shade = state->getInt("OLD");
+	else
+		GrCol3Shade = state->getInt("NEW");
+	update();
+}
+
+void PageItem::restoreGradientShade4(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		GrCol4Shade = state->getInt("OLD");
+	else
+		GrCol4Shade = state->getInt("NEW");
+	update();
+}
+
+void PageItem::restoreGradientTrans1(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		GrCol1transp = state->getDouble("OLD");
+	else
+		GrCol1transp = state->getDouble("NEW");
+	update();
+}
+
+void PageItem::restoreGradientTrans2(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		GrCol2transp = state->getDouble("OLD");
+	else
+		GrCol2transp = state->getDouble("NEW");
+	update();
+}
+
+void PageItem::restoreGradientTrans3(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		GrCol3transp = state->getDouble("OLD");
+	else
+		GrCol3transp = state->getDouble("NEW");
+	update();
+}
+
+void PageItem::restoreGradientTrans4(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		GrCol4transp = state->getDouble("OLD");
+	else
+		GrCol4transp = state->getDouble("NEW");
+	update();
+}
+
+void PageItem::restoreGradPos(SimpleState *state, bool isUndo)
+{
+	ScItemState<QList<FPoint> > *is = dynamic_cast<ScItemState<QList<FPoint> > *>(state);
+	if (isUndo)
+	{
+		GrStartX = is->getDouble("OLDSTARTX");
+		GrStartY = is->getDouble("OLDSTARTY");
+		GrEndX = is->getDouble("OLDENDX");
+		GrEndY = is->getDouble("OLDENDY");
+		GrFocalX = is->getDouble("OLDFOCALX");
+		GrFocalY = is->getDouble("OLDFOCALY");
+		GrScale = is->getDouble("OLDSCALE");
+		GrSkew = is->getDouble("OLDSKEW");
+		GrControl1 = is->getItem().at(0);
+		GrControl2 = is->getItem().at(2);
+		GrControl3 = is->getItem().at(4);
+		GrControl4 = is->getItem().at(6);
+		GrControl5 = is->getItem().at(8);
+		GrStrokeStartX = is->getDouble("OLDSTROKESTARTX");
+		GrStrokeStartY = is->getDouble("OLDSTROKESTARTY");
+		GrStrokeEndX = is->getDouble("OLDSTROKEENDX");
+		GrStrokeEndY = is->getDouble("OLDSTROKEENDY");
+		GrStrokeFocalX = is->getDouble("OLDSTROKEFOCALX");
+		GrStrokeFocalY = is->getDouble("OLDSTROKEFOCALY");
+		GrStrokeScale = is->getDouble("OLDSTROKESCALE");
+		GrStrokeSkew = is->getDouble("OLDSTROKESKEW");
+		GrMaskStartX = is->getDouble("OLDMARKSTARTX");
+		GrMaskStartY = is->getDouble("OLDMARKSTARTY");
+		GrMaskEndX = is->getDouble("OLDMARKENDX");
+		GrMaskEndY = is->getDouble("OLDMARKENDY");
+		GrMaskFocalX = is->getDouble("OLDMARKFOCALX");
+		GrMaskFocalY = is->getDouble("OLDMARKFOCALY");
+		GrMaskScale = is->getDouble("OLDMARKSCALE");
+		GrMaskSkew = is->getDouble("OLDMARKSKEW");
+	}
+	else
+	{
+		GrStartX = is->getDouble("STARTX");
+		GrStartY = is->getDouble("STARTY");
+		GrEndX = is->getDouble("ENDX");
+		GrEndY = is->getDouble("ENDY");
+		GrFocalX = is->getDouble("FOCALX");
+		GrFocalY = is->getDouble("FOCALY");
+		GrScale = is->getDouble("SCALE");
+		GrSkew = is->getDouble("SKEW");
+		GrControl1 = is->getItem().at(1);
+		GrControl2 = is->getItem().at(3);
+		GrControl3 = is->getItem().at(5);
+		GrControl4 = is->getItem().at(7);
+		GrControl5 = is->getItem().at(9);
+		GrStrokeStartX = is->getDouble("STROKESTARTX");
+		GrStrokeStartY = is->getDouble("STROKESTARTY");
+		GrStrokeEndX = is->getDouble("STROKEENDX");
+		GrStrokeEndY = is->getDouble("STROKEENDY");
+		GrStrokeFocalX = is->getDouble("STROKEFOCALX");
+		GrStrokeFocalY = is->getDouble("STROKEFOCALY");
+		GrStrokeScale = is->getDouble("STROKESCALE");
+		GrStrokeSkew = is->getDouble("STROKESKEW");
+		GrMaskStartX = is->getDouble("MARKSTARTX");
+		GrMaskStartY = is->getDouble("MARKSTARTY");
+		GrMaskEndX = is->getDouble("MARKENDX");
+		GrMaskEndY = is->getDouble("MARKENDY");
+		GrMaskFocalX = is->getDouble("MARKFOCALX");
+		GrMaskFocalY = is->getDouble("MARKFOCALY");
+		GrMaskScale = is->getDouble("MARKSCALE");
+		GrMaskSkew = is->getDouble("MARKSKEW");
+	}
+	if (GrType == 13)
+		createConicalMesh();
+	update();
+}
+
+void PageItem::restoreGradientColor1(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<QColor,QColor> > *is = dynamic_cast<ScItemState<QPair<QColor,QColor> > *>(state);
+	if (isUndo)
+		GrColorP1QColor = is->getItem().first;
+	else
+		GrColorP1QColor = is->getItem().second;
+	update();
+}
+
+void PageItem::restoreRemoveMeshPatch(SimpleState *state, bool isUndo)
+{
+	ScItemState<meshGradientPatch> *is = dynamic_cast<ScItemState<meshGradientPatch> *>(state);
+	if (isUndo)
+	{
+		selectedMeshPointX = is->getInt("POS");
+		meshGradientPatches.insert(selectedMeshPointX,is->getItem());
+	}
+	else
+	{
+		meshGradientPatches.removeAt(selectedMeshPointX);
+		selectedMeshPointX = -1;
+	}
+	update();
+}
+
+void PageItem::restoreCreateMeshGrad(SimpleState *state, bool isUndo)
+{
+	ScItemState<QList<QList<meshPoint> > > *is = dynamic_cast<ScItemState<QList<QList<meshPoint> > > *>(state);
+	if (isUndo)
+		meshGradientArray = is->getItem();
+	else
+		createGradientMesh(is->getInt("ROW"),is->getInt("COL"));
+	update();
+}
+
+void PageItem::restoreMoveMeshGrad(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<QList<QList<meshPoint> >,FPointArray> > *is = dynamic_cast<ScItemState<QPair<QList<QList<meshPoint> >,FPointArray> > *>(state);
+	if(isUndo)
+	{
+		PoLine = is->getItem().second;
+		ClipEdited = true;
+		FrameType = is->getInt("FRAME_TYPE");
+		FPoint wh = getMaxClipF(&PoLine);
+		setWidthHeight(wh.x(),wh.y());
+		m_Doc->AdjustItemSize(this);
+		OldB2 = is->getInt("OLDB");
+		OldH2 = is->getInt("OLDH");
+		updateClip();
+		meshGradientArray = is->getItem().first;
+	}
+	else
+		meshToShape();
+	update();
+}
+
+void PageItem::restoreResetMeshGrad(SimpleState *state, bool isUndo)
+{
+	ScItemState<QList<QList<meshPoint> > > *is = dynamic_cast<ScItemState<QList<QList<meshPoint> > > *>(state);
+	if (isUndo)
+		meshGradientArray = is->getItem();
+	else
+		resetGradientMesh();
+	update();
+}
+
+void PageItem::restoreGradientColor2(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<QColor,QColor> > *is = dynamic_cast<ScItemState<QPair<QColor,QColor> > *>(state);
+	if (isUndo)
+		GrColorP2QColor = is->getItem().first;
+	else
+		GrColorP2QColor = is->getItem().second;
+	update();
+}
+
+void PageItem::restoreGradientColor3(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<QColor,QColor> > *is = dynamic_cast<ScItemState<QPair<QColor,QColor> > *>(state);
+	if (isUndo)
+		GrColorP3QColor = is->getItem().first;
+	else
+		GrColorP3QColor = is->getItem().second;
+	update();
+}
+
+void PageItem::restoreGradientColor4(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<QColor,QColor> > *is = dynamic_cast<ScItemState<QPair<QColor,QColor> > *>(state);
+	if (isUndo)
+		GrColorP4QColor = is->getItem().first;
+	else
+		GrColorP4QColor = is->getItem().second;
+	update();
+}
+
+void PageItem::restoreMoveMeshPatch(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<meshPoint,meshPoint> > *is = dynamic_cast<ScItemState<QPair<meshPoint,meshPoint> > *>(state);
+	int x = is->getInt("X");
+	int y = is->getInt("Y");
+	if (isUndo)
+	{
+		if(is->getBool("ARRAY"))
+			meshGradientArray[x][y] = is->getItem().first;
+		else
+			switch(y){
+				case 1:
+					meshGradientPatches[x].TL = is->getItem().first;
+					break;
+				case 2:
+					meshGradientPatches[x].TR = is->getItem().first;
+					break;
+				case 3:
+					meshGradientPatches[x].BR = is->getItem().first;
+					break;
+				case 4:
+					meshGradientPatches[x].BL = is->getItem().first;
+					break;
+			}
+	}
+	else
+	{
+		if(is->getBool("ARRAY"))
+			meshGradientArray[x][y] = is->getItem().second;
+		else
+			switch(y){
+				case 1:
+					meshGradientPatches[x].TL = is->getItem().second;
+					break;
+				case 2:
+					meshGradientPatches[x].TR = is->getItem().second;
+					break;
+				case 3:
+					meshGradientPatches[x].BR = is->getItem().second;
+					break;
+				case 4:
+					meshGradientPatches[x].BL = is->getItem().second;
+					break;
+			}
+	}
+	update();
+}
+
+void PageItem::restoreFillGradient(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<VGradient,VGradient> > *is = dynamic_cast<ScItemState<QPair<VGradient,VGradient> > *>(state);
+	if (isUndo)
+		fill_gradient = is->getItem().first;
+	else
+		fill_gradient = is->getItem().second;
+	if(gradientType()==13)
+		createConicalMesh();
+	update();
+}
+
+void PageItem::restoreMaskGradient(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<VGradient,VGradient> > *is = dynamic_cast<ScItemState<QPair<VGradient,VGradient> > *>(state);
+	if (isUndo)
+		mask_gradient = is->getItem().first;
+	else
+		mask_gradient = is->getItem().second;
+	update();
+}
+
+
+void PageItem::restoreStrokeGradient(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<VGradient,VGradient> > *is = dynamic_cast<ScItemState<QPair<VGradient,VGradient> > *>(state);
+	if (isUndo)
+		stroke_gradient = is->getItem().first;
+	else
+		stroke_gradient = is->getItem().second;
+	update();
+}
+
+void PageItem::restoreGradientMeshColor(SimpleState *ss, bool isUndo)
+{
+	ScItemState<QPair<QColor,QColor> > *is = dynamic_cast<ScItemState<QPair<QColor,QColor> > *>(ss);
+	int x = is->getInt("X");
+	int y = is->getInt("Y");
+	meshPoint *mp;
+	if(is->getBool("PATCH"))
+	{
+		meshGradientPatch *patch = &meshGradientPatches[x];
+		switch (y)
+		{
+			case 1:
+				mp = &(patch->TL);
+				break;
+			case 2:
+				mp = &(patch->TR);
+				break;
+			case 3:
+				mp = &(patch->BR);
+				break;
+			case 4:
+				mp = &(patch->BL);
+				break;
+		}
+	}
+	else
+		mp = &meshGradientArray[x][y];
+	if (isUndo)
+	{
+		mp->colorName = is->get("OLD_COLOR_NAME");
+		mp->color = is->getItem().first;
+		mp->shade = is->getInt("OLD_SHADE");
+		mp->transparency = is->getDouble("OLD_TRANS");
+	}
+	else
+	{
+		mp->colorName = is->get("NEW_COLOR_NAME");
+		mp->color = is->getItem().second;
+		mp->shade = is->getInt("NEW_SHADE");
+		mp->transparency = is->getDouble("NEW_TRANS");
+	}
+}
+
+void PageItem::restoreGradientStartX(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrStartX = is->getDouble("OLD");
+	else
+		GrStartX = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientStartY(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrStartY = is->getDouble("OLD");
+	else
+		GrStartY = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientEndX(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrEndX = is->getDouble("OLD");
+	else
+		GrEndX = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientEndY(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrEndY= is->getDouble("OLD");
+	else
+		GrEndY = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientFocalX(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrFocalX= is->getDouble("OLD");
+	else
+		GrFocalX = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientFocalY(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrFocalY= is->getDouble("OLD");
+	else
+		GrFocalY = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientScale(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrScale= is->getDouble("OLD");
+	else
+		GrScale = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientSkew(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrSkew = is->getDouble("OLD");
+	else
+		GrSkew = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientMaskStartX(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrMaskStartX = is->getDouble("OLD");
+	else
+		GrMaskStartX = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientMaskStartY(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrMaskStartY = is->getDouble("OLD");
+	else
+		GrMaskStartY = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientMaskEndX(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrMaskEndX = is->getDouble("OLD");
+	else
+		GrMaskEndX = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientMaskEndY(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrMaskEndY= is->getDouble("OLD");
+	else
+		GrMaskEndY = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientMaskFocalX(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrMaskFocalX= is->getDouble("OLD");
+	else
+		GrMaskFocalX = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientMaskFocalY(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrMaskFocalY= is->getDouble("OLD");
+	else
+		GrMaskFocalY = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientMaskScale(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrMaskScale= is->getDouble("OLD");
+	else
+		GrMaskScale = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientMaskSkew(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrMaskSkew = is->getDouble("OLD");
+	else
+		GrMaskSkew = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientControl1(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<FPoint,FPoint> > *is = dynamic_cast<ScItemState<QPair<FPoint,FPoint> > *>(state);
+	if (isUndo)
+		GrControl1= is->getItem().first;
+	else
+		GrControl1= is->getItem().second;
+}
+
+void PageItem::restoreGradientControl2(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<FPoint,FPoint> > *is = dynamic_cast<ScItemState<QPair<FPoint,FPoint> > *>(state);
+	if (isUndo)
+		GrControl2= is->getItem().first;
+	else
+		GrControl2= is->getItem().second;
+}
+
+void PageItem::restoreGradientControl3(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<FPoint,FPoint> > *is = dynamic_cast<ScItemState<QPair<FPoint,FPoint> > *>(state);
+	if (isUndo)
+		GrControl3= is->getItem().first;
+	else
+		GrControl3= is->getItem().second;
+}
+
+void PageItem::restoreGradientControl4(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<FPoint,FPoint> > *is = dynamic_cast<ScItemState<QPair<FPoint,FPoint> > *>(state);
+	if (isUndo)
+		GrControl4= is->getItem().first;
+	else
+		GrControl4= is->getItem().second;
+}
+
+void PageItem::restoreGradientControl5(SimpleState *state, bool isUndo)
+{
+	ScItemState<QPair<FPoint,FPoint> > *is = dynamic_cast<ScItemState<QPair<FPoint,FPoint> > *>(state);
+	if (isUndo)
+		GrControl5= is->getItem().first;
+	else
+		GrControl5= is->getItem().second;
+}
+
+void PageItem::restoreGradientStrokeScale(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrStrokeScale= is->getDouble("OLD");
+	else
+		GrStrokeScale = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientStrokeSkew(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrStrokeSkew= is->getDouble("OLD");
+	else
+		GrStrokeSkew = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientStrokeFocalX(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrStrokeFocalX= is->getDouble("OLD");
+	else
+		GrStrokeFocalX = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientStrokeFocalY(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrStrokeFocalY= is->getDouble("OLD");
+	else
+		GrStrokeFocalY = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientStrokeStartX(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrStrokeStartX = is->getDouble("OLD");
+	else
+		GrStrokeStartX = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientStrokeStartY(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrStrokeStartY = is->getDouble("OLD");
+	else
+		GrStrokeStartY = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientStrokeEndX(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrStrokeEndX = is->getDouble("OLD");
+	else
+		GrStrokeEndX = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientStrokeEndY(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrStrokeEndY= is->getDouble("OLD");
+	else
+		GrStrokeEndY = is->getDouble("NEW");
+}
+
+void PageItem::restoreGradientType(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrType = is->getInt("OLD");
+	else
+		GrType = is->getInt("NEW");
+}
+
+void PageItem::restoreGradientTypeStroke(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		GrTypeStroke = is->getInt("OLD");
+	else
+		GrTypeStroke = is->getInt("NEW");
+}
+
+void PageItem::restoreEndArrowScale(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		m_endArrowScale = is->getInt("OLD_SCALE");
+	else
+		m_endArrowScale = is->getInt("NEW_SCALE");
+}
+
+void PageItem::restoreStartArrowScale(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		m_startArrowScale = is->getInt("OLD_SCALE");
+	else
+		m_startArrowScale = is->getInt("NEW_SCALE");
+}
+
+void PageItem::restoreImageRotation(SimpleState *is, bool isUndo)
+{
+	if (isUndo)
+		LocalRot = is->getInt("OLD_ROT");
+	else
+		LocalRot = is->getInt("NEW_ROT");
+}
+
 void PageItem::restorePasteInline(SimpleState *is, bool isUndo)
 {
 	int start = is->getInt("START");
@@ -4860,10 +5955,14 @@
 
 void PageItem::restoreDeleteFrameText(SimpleState *ss, bool isUndo)
 {
-	QString text = ss->get("TEXT_STR");
-	int start = ss->getInt("START");
+	ScItemState<CharStyle> *is = dynamic_cast<ScItemState<CharStyle> *>(ss);
+	QString text = is->get("TEXT_STR");
+	int start = is->getInt("START");
 	if (isUndo){
 		itemText.insertChars(start,text);
+		itemText.applyCharStyle(start, text.length(), is->getItem());
+		invalid = true;
+		invalidateLayout();
 	} else {
 		itemText.select(start,text.length());
 		asTextFrame()->deleteSelectedTextFromFrame();
@@ -5202,6 +6301,13 @@
 			tempSelection.addItem(this, true);
 			m_Doc->itemSelection_SetImageScale(oscx, oscy, &tempSelection);
 			m_Doc->itemSelection_SetImageOffset(ox, oy, &tempSelection);
+		}
+		else
+		{
+			state->set("OLD_IMAGEXOFFSET", LocalX);
+			state->set("OLD_IMAGEYOFFSET", LocalY);
+			state->set("OLD_IMAGEXSCALE", LocalScX);
+			state->set("OLD_IMAGEYSCALE", LocalScY);
 		}
 	}
 
@@ -5426,27 +6532,30 @@
 	ScItemState< QPair<QList<PageItem*>,QList<QTransform> > > *is = dynamic_cast<ScItemState< QPair<QList<PageItem*>,QList<QTransform> > >*>(state);
 	if (is)
 	{
+		m_Doc->view()->Deselect(true);
 		if (isUndo){
 			int pts = 0;
-			for (int i = 0; i < is->getItem().first.size(); ++i) {
+			select();
+			for (int i = 0; i < is->getItem().first.size(); ++i)
+			{
 				PageItem* myItem = is->getItem().first.at(i);
 				myItem->PoLine.map(is->getItem().second.at(i).inverted());
 				pts += myItem->PoLine.size();
 				pts+=4;
+				doc()->m_Selection->addItem(myItem);
 			}
 			PoLine.resize(PoLine.size()-pts);
 			Segments.clear();
 			Frame = is->getBool("FRAME");
 			FrameType = is->getInt("FRAMETYPE");
 			ClipEdited = is->getBool("CLIPEDITED");
-			m_Doc->AdjustItemSize(this);
+			doc()->AdjustItemSize(this);
 		} else {
-			m_Doc->view()->Deselect(true);
-			m_Doc->view()->SelectItem(this);
-			for (int i = 0; i < is->getItem().first.size(); ++i) {
-				m_Doc->view()->SelectItem(is->getItem().first.at(i));
-			}
-			m_Doc->itemSelection_UniteItems();
+			select();
+			for (int i = 0; i < is->getItem().first.size(); ++i)
+				doc()->view()->SelectItem(is->getItem().first.at(i));
+			doc()->itemSelection_UniteItems();
+			select();
 		}
 	}
 }
@@ -5456,17 +6565,17 @@
 	ScItemState< QList<int> > *is = dynamic_cast<ScItemState< QList<int> >*>(state);
 	if (is)
 	{
-
 		QList<int> itemsList = is->getItem();
 		select();
-		for (int i = 0; i < itemsList.size(); ++i) {
-			m_Doc->view()->SelectItem(m_Doc->Items->at(itemsList.at(i)));
-		}
-		if (isUndo){
-			m_Doc->itemSelection_UniteItems();
-		} else {
-			m_Doc->itemSelection_SplitItems();
-		}
+		if (isUndo)
+		{
+			for (int i = 0; i < itemsList.size(); ++i)
+				doc()->view()->SelectItem(doc()->Items->at(itemsList.at(i)));
+			doc()->itemSelection_UniteItems();
+			select();
+		}
+		else
+			doc()->itemSelection_SplitItems();
 	}
 }
 
@@ -5564,8 +6673,6 @@
 		double oldY = istate->getDouble("OLD_Y");
 		double newX = istate->getDouble("NEW_X");
 		double newY = istate->getDouble("NEW_Y");
-		double mx = oldX - newX;
-		double my = oldY - newY;
 
 		if (isUndo)
 		{
@@ -5573,18 +6680,18 @@
 				ContourLine = oldClip;
 			else
 				PoLine = oldClip;
+			m_Doc->AdjustItemSize(this);
+			m_Doc->MoveItem(oldX - xPos(), oldY - yPos(), this, false);
 		}
 		else
 		{
-			mx = -mx;
-			my = -my;
 			if (isContour)
 				ContourLine = newClip;
 			else
 				PoLine = newClip;
-		}
-		m_Doc->AdjustItemSize(this);
-		m_Doc->MoveItem(mx, my, this, false);
+			m_Doc->AdjustItemSize(this);
+			m_Doc->MoveItem(newX - xPos(), newY - yPos(), this, false);
+		}
 		m_Doc->regionsChanged()->update(QRectF());
 	}
 
@@ -5949,6 +7056,542 @@
 		itemText.replaceNamedResources(newNames);
 }
 
+void PageItem::setGradientType(int val)
+{
+	if(GrType==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradType,"",Um::IFill);
+	ss->set("GRAD_TYPE","grad_type");
+	ss->set("OLD",GrType);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrType = val;
+}
+
+void PageItem::setStrokeGradientType(int val)
+{
+	if(GrTypeStroke==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradTypeStroke,"",Um::ILineStyle);
+	ss->set("GRAD_TYPESTROKE","grad_typestroke");
+	ss->set("OLD",GrTypeStroke);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrTypeStroke = val;
+}
+
+void PageItem::setGradientCol1(QString val)
+{
+	if(GrColorP1==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_COL1","grad_col1");
+	ss->set("OLD",GrColorP1);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrColorP1 = val;
+}
+
+void PageItem::setGradientCol2(QString val)
+{
+	if(GrColorP2==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_COL2","grad_col2");
+	ss->set("OLD",GrColorP2);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrColorP2 = val;
+}
+
+void PageItem::setGradientCol3(QString val)
+{
+	if(GrColorP3==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_COL3","grad_col3");
+	ss->set("OLD",GrColorP3);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrColorP3 = val;
+}
+
+void PageItem::setGradientCol4(QString val)
+{
+	if(GrColorP4==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_COL4","grad_col4");
+	ss->set("OLD",GrColorP4);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrColorP4 = val;
+}
+
+void PageItem::setGradientShade1(int val)
+{
+	if(GrCol1Shade==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_SHADE1","grad_shade1");
+	ss->set("OLD",GrCol1Shade);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrCol1Shade = val;
+}
+
+void PageItem::setGradientShade2(int val)
+{
+	if(GrCol1Shade==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_SHADE2","grad_shade2");
+	ss->set("OLD",GrCol2Shade);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrCol2Shade = val;
+}
+
+void PageItem::setGradientShade3(int val)
+{
+	if(GrCol1Shade==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_SHADE3","grad_shade3");
+	ss->set("OLD",GrCol3Shade);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrCol3Shade = val;
+}
+
+void PageItem::setGradientShade4(int val)
+{
+	if(GrCol1Shade==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_SHADE4","grad_shade4");
+	ss->set("OLD",GrCol4Shade);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrCol4Shade = val;
+}
+
+void PageItem::setGradientTransp1(double val)
+{
+	if(GrCol1transp==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_TRANSP1","grad_transp1");
+	ss->set("OLD",GrCol1transp);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrCol1transp = val;
+}
+
+void PageItem::setGradientTransp2(double val)
+{
+	if(GrCol2transp==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_TRANSP2","grad_transp2");
+	ss->set("OLD",GrCol2transp);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrCol2transp = val;
+}
+
+void PageItem::setGradientTransp3(double val)
+{
+	if(GrCol3transp==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_TRANSP3","grad_transp3");
+	ss->set("OLD",GrCol3transp);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrCol3transp = val;
+}
+
+void PageItem::setGradientTransp4(double val)
+{
+	if(GrCol4transp==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_TRANSP4","grad_transp4");
+	ss->set("OLD",GrCol4transp);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrCol4transp = val;
+}
+
+void PageItem::setGradientColor1(QColor val)
+{
+	if(GrColorP1QColor ==val)
+		return;
+	ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_QCOLOR1","grad_qcolor1");
+	ss->setItem(qMakePair(GrColorP1QColor,val));
+	undoManager->action(this,ss);
+	GrColorP1QColor = val;
+}
+
+void PageItem::setGradientColor2(QColor val)
+{
+	if(GrColorP2QColor ==val)
+		return;
+	ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_QCOLOR2","grad_qcolor2");
+	ss->setItem(qMakePair(GrColorP2QColor,val));
+	undoManager->action(this,ss);
+	GrColorP2QColor = val;
+}
+
+void PageItem::setGradientColor3(QColor val)
+{
+	if(GrColorP3QColor ==val)
+		return;
+	ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_QCOLOR3","grad_qcolor3");
+	ss->setItem(qMakePair(GrColorP3QColor,val));
+	undoManager->action(this,ss);
+	GrColorP3QColor = val;
+}
+
+void PageItem::setGradientColor4(QColor val)
+{
+	if(GrColorP4QColor ==val)
+		return;
+	ScItemState<QPair<QColor,QColor> > *ss = new ScItemState<QPair<QColor,QColor> >(Um::GradCol,"",Um::IFill);
+	ss->set("GRAD_QCOLOR4","grad_qcolor4");
+	ss->setItem(qMakePair(GrColorP4QColor,val));
+	undoManager->action(this,ss);
+	GrColorP4QColor = val;
+}
+
+void PageItem::setSnapToPatchGrid(bool val)
+{
+	if(snapToPatchGrid ==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("SNAP_TO_PATCH","snap_to_patch");
+	ss->set("OLD",val);
+	undoManager->action(this,ss);
+	snapToPatchGrid = val;
+}
+
+void PageItem::setGradientStartX(double val){
+	if(GrStartX==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_STARTX","grad_startx");
+	ss->set("OLD",GrStartX);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrStartX = val;
+}
+
+void PageItem::setGradientStartY(double val){
+	if(GrStartY==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_STARTY","grad_starty");
+	ss->set("OLD",GrStartY);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrStartY = val;
+}
+
+void PageItem::setGradientEndX(double val){
+	if(GrEndX==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_ENDX","grad_endx");
+	ss->set("OLD",GrEndX);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrEndX = val;
+}
+
+void PageItem::setGradientEndY(double val){
+	if(GrEndY==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_ENDY","grad_endy");
+	ss->set("OLD",GrEndY);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrEndY = val;
+}
+
+void PageItem::setGradientFocalX(double val){
+	if(GrFocalX==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_FOCALX","grad_focalx");
+	ss->set("OLD",GrFocalX);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrFocalX = val;
+}
+
+void PageItem::setGradientFocalY(double val){
+	if(GrFocalY==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_FOCALY","grad_focaly");
+	ss->set("OLD",GrFocalY);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrFocalY = val;
+}
+
+void PageItem::setGradientScale(double val){
+	if(GrScale==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_SCALE","grad_scale");
+	ss->set("OLD",GrScale);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrScale = val;
+}
+
+void PageItem::setGradientSkew(double val){
+	if(GrSkew==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_SKEW","grad_skew");
+	ss->set("OLD",GrSkew);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrSkew = val;
+}
+
+void PageItem::setGradientMaskStartX(double val){
+	if(GrMaskStartX==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_MASKSTARTX","grad_maskstartx");
+	ss->set("OLD",GrMaskStartX);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrMaskStartX = val;
+}
+
+void PageItem::setGradientMaskStartY(double val){
+	if(GrMaskStartY==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_MASKSTARTY","grad_maskstarty");
+	ss->set("OLD",GrMaskStartY);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrMaskStartY = val;
+}
+
+void PageItem::setGradientMaskEndX(double val){
+	if(GrMaskEndX==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_MASKENDX","grad_maskendx");
+	ss->set("OLD",GrMaskEndX);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrMaskEndX = val;
+}
+
+void PageItem::setGradientMaskEndY(double val){
+	if(GrMaskEndY==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_MASKENDY","grad_maskendy");
+	ss->set("OLD",GrMaskEndY);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrMaskEndY = val;
+}
+
+void PageItem::setGradientMaskFocalX(double val){
+	if(GrMaskFocalX==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_MASKFOCALX","grad_maskfocalx");
+	ss->set("OLD",GrMaskFocalX);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrMaskFocalX = val;
+}
+
+void PageItem::setGradientMaskFocalY(double val){
+	if(GrMaskFocalY==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_MASKFOCALY","grad_maskfocaly");
+	ss->set("OLD",GrMaskFocalY);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrMaskFocalY = val;
+}
+
+void PageItem::setGradientMaskScale(double val){
+	if(GrMaskScale==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_MASKSCALE","grad_maskscale");
+	ss->set("OLD",GrMaskScale);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrMaskScale = val;
+}
+
+void PageItem::setGradientMaskSkew(double val){
+	if(GrMaskSkew==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_MASKSKEW","grad_maskskew");
+	ss->set("OLD",GrMaskSkew);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrMaskSkew = val;
+}
+
+void PageItem::setGradientControl1(FPoint val){
+	if(GrControl1==val)
+		return;
+	ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_CONTROL1","grad_control1");
+	ss->setItem(qMakePair(GrControl1,val));
+	undoManager->action(this,ss);
+	GrControl1 = val;
+}
+
+void PageItem::setGradientControl2(FPoint val){
+	if(GrControl2==val)
+		return;
+	ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_CONTROL2","grad_control2");
+	ss->setItem(qMakePair(GrControl2,val));
+	undoManager->action(this,ss);
+	GrControl2 = val;
+}
+
+void PageItem::setGradientControl3(FPoint val){
+	if(GrControl3==val)
+		return;
+	ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_CONTROL3","grad_control3");
+	ss->setItem(qMakePair(GrControl3,val));
+	undoManager->action(this,ss);
+	GrControl3 = val;
+}
+
+void PageItem::setGradientControl4(FPoint val){
+	if(GrControl4==val)
+		return;
+	ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_CONTROL4","grad_control4");
+	ss->setItem(qMakePair(GrControl4,val));
+	undoManager->action(this,ss);
+	GrControl4 = val;
+}
+
+void PageItem::setGradientControl5(FPoint val){
+	if(GrControl5==val)
+		return;
+	ScItemState<QPair<FPoint,FPoint> > *ss = new ScItemState<QPair<FPoint,FPoint> >(Um::GradPos,"",Um::IFill);
+	ss->set("GRAD_CONTROL5","grad_control5");
+	ss->setItem(qMakePair(GrControl5,val));
+	undoManager->action(this,ss);
+	GrControl5 = val;
+}
+
+void PageItem::setGradientStrokeScale(double val){
+	if(GrStrokeScale==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+	ss->set("GRADSTROKE_SCALE","gradstroke_scale");
+	ss->set("OLD",GrStrokeScale);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrStrokeScale = val;
+}
+
+void PageItem::setGradientStrokeSkew(double val){
+	if(GrStrokeSkew==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+	ss->set("GRADSTROKE_SKEW","gradstroke_skew");
+	ss->set("OLD",GrStrokeSkew);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrStrokeSkew = val;
+}
+
+void PageItem::setGradientStrokeFocalX(double val){
+	if(GrStrokeFocalX==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+	ss->set("GRADSTROKE_FOCALX","gradstroke_focalx");
+	ss->set("OLD",GrStrokeFocalX);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrStrokeFocalX = val;
+}
+
+void PageItem::setGradientStrokeFocalY(double val){
+	if(GrStrokeFocalY==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+	ss->set("GRADSTROKE_FOCALY","gradstroke_focaly");
+	ss->set("OLD",GrStrokeFocalY);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrStrokeFocalY = val;
+}
+
+void PageItem::setGradientStrokeStartX(double val){
+	if(GrStrokeStartX==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+	ss->set("GRADSTROKE_STARTX","gradstroke_startx");
+	ss->set("OLD",GrStrokeStartX);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrStrokeStartX = val;
+}
+
+void PageItem::setGradientStrokeStartY(double val){
+	if(GrStrokeStartY==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+	ss->set("GRADSTROKE_STARTY","gradstroke_starty");
+	ss->set("OLD",GrStrokeStartY);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrStrokeStartY = val;
+}
+
+void PageItem::setGradientStrokeEndX(double val){
+	if(GrStrokeEndX==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+	ss->set("GRADSTROKE_ENDX","gradstroke_endx");
+	ss->set("OLD",GrStrokeEndX);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrStrokeEndX = val;
+}
+
+void PageItem::setGradientStrokeEndY(double val){
+	if(GrStrokeEndY==val)
+		return;
+	SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine);
+	ss->set("GRADSTROKE_ENDY","gradstroke_endy");
+	ss->set("OLD",GrStrokeEndY);
+	ss->set("NEW",val);
+	undoManager->action(this,ss);
+	GrStrokeEndY = val;
+}
 
 void PageItem::getNamedResources(ResourceCollection& lists) const
 {
@@ -7311,41 +8954,41 @@
 	{
 		case 0:
 		case 1:
-			GrStartX = 0;
-			GrStartY = Height / 2.0;
-			GrEndX = Width;
-			GrEndY = Height / 2.0;
+			setGradientStartX(0);
+			setGradientStartY(Height / 2.0);
+			setGradientEndX(Width);
+			setGradientEndY(Height / 2.0);
 			break;
 		case 2:
-			GrStartX = Width / 2.0;
-			GrStartY = 0;
-			GrEndX = Width / 2.0;
-			GrEndY = Height;
+			setGradientStartX(Width / 2.0);
+			setGradientStartY(0);
+			setGradientEndX(Width / 2.0);
+			setGradientEndY(Height);
 			break;
 		case 3:
-			GrStartX = 0;
-			GrStartY = 0;
-			GrEndX = Width;
-			GrEndY = Height;
+			setGradientStartX(0);
+			setGradientStartY(0);
+			setGradientEndX(Width);
+			setGradientEndY(Height);
 			break;
 		case 4:
-			GrStartX = 0;
-			GrStartY = Height;
-			GrEndX = Width;
-			GrEndY = 0;
+			setGradientStartX(0);
+			setGradientStartY(Height);
+			setGradientEndX(Width);
+			setGradientEndY(0);
 			break;
 		case 5:
-			GrStartX = Width / 2.0;
-			GrStartY = Height / 2.0;
+			setGradientStartX(Width / 2.0);
+			setGradientStartY(Height / 2.0);
 			if (Width >= Height)
 			{
-				GrEndX = Width;
-				GrEndY = Height / 2.0;
+				setGradientEndX(Width);
+				setGradientEndY(Height / 2.0);
 			}
 			else
 			{
-				GrEndX = Width / 2.0;
-				GrEndY = Height;
+				setGradientEndX(Width / 2.0);
+				setGradientEndY(Height);
 			}
 			break;
 		default:

Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Thu Jul 12 20:32:18 2012
@@ -662,9 +662,104 @@
 	// PDF bookmark
 	bool isPDFBookmark() const { return isBookmark; }
 	void setIsPDFBookmark(bool val) { isBookmark = val; }
-	// 0=none, 1,2,3,4=linear, 5=radial, 6=free linear, 7=free radial, 8=pattern 
+	// 0=none, 1,2,3,4=linear, 5=radial, 6=free linear, 7=free radial, 8=pattern
 	int gradientType() const { return GrType; }
-	void setGradientType(int val) { GrType = val; }
+	void setGradientType(int val);
+	double gradientStartX() const { return GrStartX; }
+	void setGradientStartX(double val);
+	double gradientStartY() const { return GrStartY; }
+	void setGradientStartY(double val);
+	double gradientEndX() const { return GrEndX; }
+	void setGradientEndX(double val);
+	double gradientEndY() const { return GrEndY; }
+	void setGradientEndY(double val);
+	double gradientFocalX() const { return GrFocalX; }
+	void setGradientFocalX(double val);
+	double gradientFocalY() const { return GrFocalY; }
+	void setGradientFocalY(double val);
+	double gradientScale() const { return GrScale; }
+	void setGradientScale(double val);
+	double gradientSkew() const { return GrSkew; }
+	void setGradientSkew(double val);
+	double gradientMaskStartX() const { return GrMaskStartX; }
+	void setGradientMaskStartX(double val);
+	double gradientMaskStartY() const { return GrMaskStartY; }
+	void setGradientMaskStartY(double val);
+	double gradientMaskEndX() const { return GrMaskEndX; }
+	void setGradientMaskEndX(double val);
+	double gradientMaskEndY() const { return GrMaskEndY; }
+	void setGradientMaskEndY(double val);
+	double gradientMaskFocalX() const { return GrMaskFocalX; }
+	void setGradientMaskFocalX(double val);
+	double gradientMaskFocalY() const { return GrMaskFocalY; }
+	void setGradientMaskFocalY(double val);
+	double gradientMaskScale() const { return GrMaskScale; }
+	void setGradientMaskScale(double val);
+	double gradientMaskSkew() const { return GrMaskSkew; }
+	void setGradientMaskSkew(double val);
+	FPoint gradientControl1() const { return GrControl1; }
+	void setGradientControl1(FPoint val);
+	FPoint gradientControl2() const { return GrControl2; }
+	void setGradientControl2(FPoint val);
+	FPoint gradientControl3() const { return GrControl3; }
+	void setGradientControl3(FPoint val);
+	FPoint gradientControl4() const { return GrControl4; }
+	void setGradientControl4(FPoint val);
+	FPoint gradientControl5() const { return GrControl5; }
+	void setGradientControl5(FPoint val);
+	double gradientStrokeScale() const { return GrStrokeScale; }
+	void setGradientStrokeScale(double val);
+	double gradientStrokeSkew() const { return GrStrokeSkew; }
+	void setGradientStrokeSkew(double val);
+	double gradientStrokeFocalX() const { return GrStrokeFocalX; }
+	void setGradientStrokeFocalX(double val);
+	double gradientStrokeFocalY() const { return GrStrokeFocalY; }
+	void setGradientStrokeFocalY(double val);
+	double gradientStrokeStartX() const { return GrStrokeStartX; }
+	void setGradientStrokeStartX(double val);
+	double gradientStrokeStartY() const { return GrStrokeStartY; }
+	void setGradientStrokeStartY(double val);
+	double gradientStrokeEndX() const { return GrStrokeEndX; }
+	void setGradientStrokeEndX(double val);
+	double gradientStrokeEndY() const { return GrStrokeEndY; }
+	void setGradientStrokeEndY(double val);
+	QString gradientCol1() const { return GrColorP1; }
+	void setGradientCol1(QString val);
+	QString gradientCol2() const { return GrColorP2; }
+	void setGradientCol2(QString val);
+	QString gradientCol3() const { return GrColorP3; }
+	void setGradientCol3(QString val);
+	QString gradientCol4() const { return GrColorP4; }
+	void setGradientCol4(QString val);
+	double gradientTransp1() const { return GrCol1transp; }
+	void setGradientTransp1(double val);
+	double gradientTransp2() const { return GrCol2transp; }
+	void setGradientTransp2(double val);
+	double gradientTransp3() const { return GrCol3transp; }
+	void setGradientTransp3(double val);
+	double gradientTransp4() const { return GrCol4transp; }
+	void setGradientTransp4(double val);
+	int gradientShade1() const { return GrCol1Shade; }
+	void setGradientShade1(int val);
+	int gradientShade2() const { return GrCol2Shade; }
+	void setGradientShade2(int val);
+	int gradientShade3() const { return GrCol3Shade; }
+	void setGradientShade3(int val);
+	int gradientShade4() const { return GrCol4Shade; }
+	void setGradientShade4(int val);
+	QColor gradientColor1() const { return GrColorP1QColor; }
+	void setGradientColor1(QColor val);
+	QColor gradientColor2() const { return GrColorP2QColor; }
+	void setGradientColor2(QColor val);
+	QColor gradientColor3() const { return GrColorP3QColor; }
+	void setGradientColor3(QColor val);
+	QColor gradientColor4() const { return GrColorP4QColor; }
+	void setGradientColor4(QColor val);
+	bool getSnapToPatchGrid() const { return snapToPatchGrid; }
+	void setSnapToPatchGrid(bool val);
+	void setMaskGradient(VGradient grad);
+	void setFillGradient(VGradient grad);
+	void setStrokeGradient(VGradient grad);
 	void set4ColorGeometry(FPoint c1, FPoint c2, FPoint c3, FPoint c4);
 	void set4ColorTransparency(double t1, double t2, double t3, double t4);
 	void set4ColorShade(int t1, int t2, int t3, int t4);
@@ -683,12 +778,12 @@
 	void setGradientVector(double startX, double startY, double endX, double endY, double focalX, double focalY, double scale, double skew);
 
 	int strokeGradientType() const { return GrTypeStroke; }
-	void setStrokeGradientType(int val) { GrTypeStroke = val; }
+	void setStrokeGradientType(int val);
 	void strokeGradientVector(double& startX, double& startY, double& endX, double& endY, double &focalX, double &focalY, double &scale, double &skew) const;
 	void setStrokeGradientVector(double startX, double startY, double endX, double endY, double focalX, double focalY, double scale, double skew);
 
 	int maskType() const { return GrMask; }
-	void setMaskType(int val) { GrMask = val; }
+	void setMaskType(int val);
 	void setGradientMask(const QString &newMask);
 	void setPatternMask(const QString &newMask);
 	QString gradientMask() const { return gradientMaskVal; }
@@ -1211,6 +1306,73 @@
 	 * @author Riku Leino
 	 */
 	/*@{*/
+	void restoreAppMode(SimpleState *state, bool isUndo);
+	void restoreArc(SimpleState *state,bool isUndo);
+	void restorePolygon(SimpleState *state,bool isUndo);
+	void restoreImageNbr(SimpleState *state,bool isUndo);
+	void restoreTransform(SimpleState *state,bool isUndo);
+	void restoreMaskType(SimpleState *state,bool isUndo);
+	void restoreGradPos(SimpleState *state,bool isUndo);
+	void restoreSnapToPatchGrid(SimpleState *state, bool isUndo);
+	void restoreRemoveMeshPatch(SimpleState *state, bool isUndo);
+	void restoreCreateMeshGrad(SimpleState *state, bool isUndo);
+	void restoreMoveMeshGrad(SimpleState *state, bool isUndo);
+	void restoreResetMeshGrad(SimpleState *state, bool isUndo);
+	void restoreGradientColor1(SimpleState *state, bool isUndo);
+	void restoreGradientColor2(SimpleState *state, bool isUndo);
+	void restoreGradientColor3(SimpleState *state, bool isUndo);
+	void restoreGradientColor4(SimpleState *state, bool isUndo);
+	void restoreGradientCol1(SimpleState *state, bool isUndo);
+	void restoreGradientCol2(SimpleState *state, bool isUndo);
+	void restoreGradientCol3(SimpleState *state, bool isUndo);
+	void restoreGradientCol4(SimpleState *state, bool isUndo);
+	void restoreGradientShade1(SimpleState *state, bool isUndo);
+	void restoreGradientShade2(SimpleState *state, bool isUndo);
+	void restoreGradientShade3(SimpleState *state, bool isUndo);
+	void restoreGradientShade4(SimpleState *state, bool isUndo);
+	void restoreGradientTrans1(SimpleState *state, bool isUndo);
+	void restoreGradientTrans2(SimpleState *state, bool isUndo);
+	void restoreGradientTrans3(SimpleState *state, bool isUndo);
+	void restoreGradientTrans4(SimpleState *state, bool isUndo);
+	void restoreMoveMeshPatch(SimpleState *state, bool isUndo);
+	void restoreMaskGradient(SimpleState *state, bool isUndo);
+	void restoreFillGradient(SimpleState *state, bool isUndo);
+	void restoreStrokeGradient(SimpleState *state, bool isUndo);
+	void restoreGradientMeshColor(SimpleState *state, bool isUndo);
+	void restoreGradientStartX(SimpleState *state, bool isUndo);
+	void restoreGradientStartY(SimpleState *state, bool isUndo);
+	void restoreGradientEndX(SimpleState *state, bool isUndo);
+	void restoreGradientEndY(SimpleState *state, bool isUndo);
+	void restoreGradientFocalX(SimpleState *state, bool isUndo);
+	void restoreGradientFocalY(SimpleState *state, bool isUndo);
+	void restoreGradientScale(SimpleState *state, bool isUndo);
+	void restoreGradientSkew(SimpleState *state, bool isUndo);
+	void restoreGradientMaskStartX(SimpleState *state, bool isUndo);
+	void restoreGradientMaskStartY(SimpleState *state, bool isUndo);
+	void restoreGradientMaskEndX(SimpleState *state, bool isUndo);
+	void restoreGradientMaskEndY(SimpleState *state, bool isUndo);
+	void restoreGradientMaskFocalX(SimpleState *state, bool isUndo);
+	void restoreGradientMaskFocalY(SimpleState *state, bool isUndo);
+	void restoreGradientMaskScale(SimpleState *state, bool isUndo);
+	void restoreGradientMaskSkew(SimpleState *state, bool isUndo);
+	void restoreGradientControl1(SimpleState *state, bool isUndo);
+	void restoreGradientControl2(SimpleState *state, bool isUndo);
+	void restoreGradientControl3(SimpleState *state, bool isUndo);
+	void restoreGradientControl4(SimpleState *state, bool isUndo);
+	void restoreGradientControl5(SimpleState *state, bool isUndo);
+	void restoreGradientStrokeScale(SimpleState *state, bool isUndo);
+	void restoreGradientStrokeSkew(SimpleState *state, bool isUndo);
+	void restoreGradientStrokeFocalX(SimpleState *state, bool isUndo);
+	void restoreGradientStrokeFocalY(SimpleState *state, bool isUndo);
+	void restoreGradientStrokeStartX(SimpleState *state, bool isUndo);
+	void restoreGradientStrokeStartY(SimpleState *state, bool isUndo);
+	void restoreGradientStrokeEndX(SimpleState *state, bool isUndo);
+	void restoreGradientStrokeEndY(SimpleState *state, bool isUndo);
+	void restoreGradientType(SimpleState *state, bool isUndo);
+	void restoreGradientTypeStroke(SimpleState *state, bool isUndo);
+	void restoreStartArrowScale(SimpleState *state, bool isUndo);
+	void restoreEndArrowScale(SimpleState *state, bool isUndo);
+	void restoreImageRotation(SimpleState *state, bool isUndo);
 	void restorePasteInline(SimpleState *state, bool isUndo);
 	void restorePasteText(SimpleState *state, bool isUndo);
 	void restoreFirstLineOffset(SimpleState *state, bool isUndo);

Modified: trunk/Scribus/scribus/pageitem_imageframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/pageitem_imageframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_imageframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_imageframe.cpp Thu Jul 12 20:32:18 2012
@@ -242,7 +242,7 @@
 	setImageFlippedV(false);
 	EmProfile = "";
 	ScaleType = true;
-	AspectRatio = true;
+	AspectRatio = false;
 	setFillTransparency(0.0);
 	setLineTransparency(0.0);
 	imageClip.resize(0);

Modified: trunk/Scribus/scribus/pageitem_latexframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/pageitem_latexframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_latexframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_latexframe.cpp Thu Jul 12 20:32:18 2012
@@ -514,11 +514,11 @@
 		return;
 	}
 	if (ss->contains("CHANGE_FORMULA")) {
-		if (isUndo) {
+		if (isUndo)
 			setFormula(ss->get("OLD_FORMULA"), false);
-		} else {
+		else
 			setFormula(ss->get("NEW_FORMULA"), false);
-		}
+		rerunApplication(true);
 	} else {
 		PageItem_ImageFrame::restore(state, isUndo);
 	}

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Thu Jul 12 20:32:18 2012
@@ -3928,23 +3928,67 @@
 void PageItem_TextFrame::deleteSelectedTextFromFrame()
 {
 	if (itemText.lengthOfSelection() > 0) {
-		if (UndoManager::undoEnabled())
-		{
-			SimpleState *ss = dynamic_cast<SimpleState*>(undoManager->getLastUndo());
-			if(ss && ss->get("ETEA") == "delete_frametext"){
-				if(itemText.startOfSelection()<ss->getInt("START")){
-					ss->set("START",itemText.startOfSelection());
-					ss->set("TEXT_STR",itemText.text(itemText.startOfSelection(),itemText.lengthOfSelection()) + ss->get("TEXT_STR"));
-				} else
-					ss->set("TEXT_STR",ss->get("TEXT_STR") + itemText.text(itemText.startOfSelection(),itemText.lengthOfSelection()));
-			}else {
-				ss = new SimpleState(Um::DeleteText,"",Um::IDelete);
-				ss->set("DELETE_FRAMETEXT", "delete_frametext");
-				ss->set("ETEA", QString("delete_frametext"));
-				ss->set("TEXT_STR",itemText.text(itemText.startOfSelection(),itemText.lengthOfSelection()));
-				ss->set("START", itemText.startOfSelection());
-				undoManager->action(this, ss);
-			}
+		if(UndoManager::undoEnabled()){
+			int start = itemText.startOfSelection();
+			int stop = itemText.endOfSelection();
+			int lastPos = start;
+			CharStyle lastParent = itemText.charStyle(start);
+			UndoState* state = undoManager->getLastUndo();
+			ScItemState<CharStyle> *is = NULL;
+			TransactionState *ts = NULL;
+			bool added = false;
+			bool lastIsDelete = false;
+			while(state && state->isTransaction()){
+				ts = dynamic_cast<TransactionState*>(state);
+				is = dynamic_cast<ScItemState<CharStyle>*>(ts->at(ts->sizet()-1));
+				state = ts->at(0);
+			}
+			UndoTransaction trans = undoManager->beginTransaction(Um::Selection,Um::IDelete,Um::Delete,"",Um::IDelete);
+			for (int i=start; i <= stop; ++i)
+			{
+				const CharStyle& curParent(itemText.charStyle(i));
+				if (!curParent.equiv(lastParent) || i==stop)
+					{
+						added = false;
+						lastIsDelete = false;
+						if(is && dynamic_cast<ScItemState<CharStyle>*>(ts->at(0))->get("ETEA") == "delete_frametext" && lastPos<is->getInt("START"))
+						{
+							if(is->getItem().equiv(lastParent))
+							{
+								is->set("START",start);
+								is->set("TEXT_STR",itemText.text(lastPos,i - lastPos) + is->get("TEXT_STR"));
+								added = true;
+							}
+							lastIsDelete = true;
+						}
+						else if(is && dynamic_cast<ScItemState<CharStyle>*>(ts->at(0))->get("ETEA") == "delete_frametext"  && lastPos>=is->getInt("START"))
+						{
+							if(is && is->getItem().equiv(lastParent)){
+								is->set("TEXT_STR",is->get("TEXT_STR") + itemText.text(lastPos,i - lastPos));
+								added = true;
+							}
+							lastIsDelete = true;
+						}
+						if(!added)
+						{
+							is = new ScItemState<CharStyle>(Um::DeleteText,"",Um::IDelete);
+							is->set("DELETE_FRAMETEXT", "delete_frametext");
+							is->set("ETEA", QString("delete_frametext"));
+							is->set("TEXT_STR",itemText.text(lastPos,i - lastPos));
+							is->set("START", start);
+							is->setItem(lastParent);
+							if(!ts || !lastIsDelete){
+								undoManager->action(this, is);
+								ts = NULL;
+							}
+							else
+								ts->pushBack(this,is);
+						}
+						lastPos = i;
+						lastParent = curParent;
+					}
+			}
+			trans.commit();
 		}
 		itemText.setCursorPosition( itemText.startOfSelection() );
 		itemText.removeSelection();

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Jul 12 20:32:18 2012
@@ -6466,6 +6466,16 @@
 			NoFrameEdit();
 		else if (oldMode != modeEditClip && mode == modeEditClip)
 			ToggleFrameEdit();
+
+		//Ugly hack but I have absolutly no idea about how to do this in another way
+		if(currItem && oldMode != mode && (mode == modeEditMeshPatch || mode == modeEditMeshGradient || mode == modeEditGradientVectors || oldMode == modeEditMeshPatch || oldMode == modeEditMeshGradient || oldMode == modeEditGradientVectors || oldMode == modeEditPolygon || mode == modeEditPolygon || oldMode == modeEditArc || mode == modeEditArc))
+		{
+			SimpleState *ss = new SimpleState(Um::Mode);
+			ss->set("CHANGE_MODE","change_mode");
+			ss->set("OLD",oldMode);
+			ss->set("NEW",mode);
+			undoManager->action(currItem,ss);
+		}
 		doc->appMode = mode;
 //		if (oldMode == modeMeasurementTool)
 //			disconnect(view, SIGNAL(MVals(double, double, double, double, double, double, int )), measurementPalette, SLOT(setValues(double, double, double, double, double, double, int )));
@@ -7479,12 +7489,14 @@
 	doc->SnapGuides = false;
 	slotEditCopy();
 	view->Deselect(true);
+	UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::Duplicate,"",Um::IMultipleDuplicate));
 	slotEditPaste();
 	for (int b=0; b<doc->m_Selection->count(); ++b)
 	{
 		doc->m_Selection->itemAt(b)->setLocked(false);
 		doc->MoveItem(doc->opToolPrefs().dispX, doc->opToolPrefs().dispY, doc->m_Selection->itemAt(b));
 	}
+	trans.commit();
 	doc->useRaster = savedAlignGrid;
 	doc->SnapGuides = savedAlignGuides;
 	internalCopy = false;
@@ -9943,12 +9955,14 @@
 		TransformDialog td(this, doc);
 		if (td.exec())
 		{
+			UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::Transform,"",Um::IMove));
 			qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
 			int count=td.getCount();
 			QTransform matrix(td.getTransformMatrix());
 			int basepoint=td.getBasepoint();
 			doc->itemSelection_Transform(count, matrix, basepoint);
 			qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+			trans.commit();
 		}
 	}
 }

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Jul 12 20:32:18 2012
@@ -1797,6 +1797,8 @@
 		{
 			if (ScCore->usingGUI())
 			{
+				if(ss->contains("ACTIVE"))
+					scMW()->layerPalette->setActiveLayer(layerLevelFromID(ss->getInt("ACTIVE")),0);
 				m_ScMW->changeLayer(ss->getInt("ACTIVE"));
 				m_ScMW->layerPalette->rebuildList();
 			}
@@ -2973,7 +2975,7 @@
 	{
 		SimpleState *ss = new SimpleState(Um::LowerLayer, "", Um::IDown);
 		ss->set("DOWN_LAYER", "down_layer");
-		ss->set("ACTIVE", layerLevel-1);
+		ss->set("ACTIVE", layerIDFromLevel(layerLevel));
 		undoManager->action(this, ss, DocName, Um::ILayer);
 	}
 
@@ -3020,7 +3022,7 @@
 	{
 		SimpleState *ss = new SimpleState(Um::RaiseLayer, "", Um::IUp);
 		ss->set("UP_LAYER", "up_layer");
-		ss->set("ACTIVE", layerLevel+1);
+		ss->set("ACTIVE", layerIDFromLevel(layerLevel));
 		undoManager->action(this, ss, DocName, Um::ILayer);
 	}
 
@@ -7573,14 +7575,16 @@
 	{
 		m_updateManager.setUpdatesDisabled();
 		PageItem *currItem;
+		UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradTypeMask,"",Um::IFill));
 		for (uint a = 0; a < selectedItemCount; ++a)
 		{
 			currItem = m_Selection->itemAt(a);
-			currItem->GrMask = typ;
+			currItem->setMaskType(typ);
 			if ((typ > 0) && (typ < 9))
 				currItem->updateGradientVectors();
 			currItem->update();
 		}
+		trans.commit();
 		m_updateManager.setUpdatesEnabled();
 		changed();
 	}
@@ -7593,11 +7597,12 @@
 	{
 		m_updateManager.setUpdatesDisabled();
 		PageItem *currItem;
+		UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradTypeMask,"",Um::IFill));
 		for (uint a = 0; a < selectedItemCount; ++a)
 		{
 			currItem = m_Selection->itemAt(a);
-			currItem->GrTypeStroke = typ;
-			if (currItem->GrTypeStroke == 0)
+			currItem->setStrokeGradientType(typ);
+			if (currItem->strokeGradientType() == 0)
 			{
 				if (currItem->lineColor() != CommonStrings::None)
 				{
@@ -7627,6 +7632,7 @@
 				currItem->updateGradientVectors();
 			currItem->update();
 		}
+		trans.commit();
 		m_updateManager.setUpdatesEnabled();
 		changed();
 	}
@@ -7639,11 +7645,12 @@
 	{
 		m_updateManager.setUpdatesDisabled();
 		PageItem *currItem;
+		UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::SetFill,"",Um::IFill));
 		for (uint a = 0; a < selectedItemCount; ++a)
 		{
 			currItem = m_Selection->itemAt(a);
-			currItem->GrType = typ;
-			switch (currItem->GrType)
+			currItem->setGradientType(typ);
+			switch (currItem->gradientType())
 			{
 				case 0:
 					if (currItem->fillColor() != CommonStrings::None)
@@ -7672,41 +7679,41 @@
 					}
 					break;
 				case 1:
-					currItem->GrStartX = 0;
-					currItem->GrStartY = currItem->height() / 2.0;
-					currItem->GrEndX = currItem->width();
-					currItem->GrEndY = currItem->height() / 2.0;
+					currItem->setGradientStartX(0);
+					currItem->setGradientStartY(currItem->height() / 2.0);
+					currItem->setGradientEndX(currItem->width());
+					currItem->setGradientEndY(currItem->height() / 2.0);
 					break;
 				case 2:
-					currItem->GrStartX = currItem->width() / 2.0;
-					currItem->GrStartY = 0;
-					currItem->GrEndX = currItem->width() / 2.0;
-					currItem->GrEndY = currItem->height();
+					currItem->setGradientStartX(currItem->width() / 2.0);
+					currItem->setGradientStartY(0);
+					currItem->setGradientEndX(currItem->width() / 2.0);
+					currItem->setGradientEndY(currItem->height());
 					break;
 				case 3:
-					currItem->GrStartX = 0;
-					currItem->GrStartY = 0;
-					currItem->GrEndX = currItem->width();
-					currItem->GrEndY = currItem->height();
+					currItem->setGradientStartX(0);
+					currItem->setGradientStartY(0);
+					currItem->setGradientEndX(currItem->width());
+					currItem->setGradientEndY(currItem->height());
 					break;
 				case 4:
-					currItem->GrStartX = 0;
-					currItem->GrStartY = currItem->height();
-					currItem->GrEndX = currItem->width();
-					currItem->GrEndY = 0;
+					currItem->setGradientStartX(0);
+					currItem->setGradientStartY(currItem->height());
+					currItem->setGradientEndX(currItem->width());
+					currItem->setGradientEndY(0);
 					break;
 				case 5:
-					currItem->GrStartX = currItem->width() / 2.0;
-					currItem->GrStartY = currItem->height() / 2.0;
+					currItem->setGradientStartX(currItem->width() / 2.0);
+					currItem->setGradientStartY(currItem->height() / 2.0);
 					if (currItem->width() >= currItem->height())
 					{
-						currItem->GrEndX = currItem->width();
-						currItem->GrEndY = currItem->height() / 2.0;
+						currItem->setGradientEndX(currItem->width());
+						currItem->setGradientEndY(currItem->height() / 2.0);
 					}
 					else
 					{
-						currItem->GrEndX = currItem->width() / 2.0;
-						currItem->GrEndY = currItem->height();
+						currItem->setGradientEndX(currItem->width() / 2.0);
+						currItem->setGradientEndY(currItem->height());
 					}
 					break;
 				default:
@@ -7714,10 +7721,11 @@
 			}
 			if ((typ > 0) && (typ < 8))
 				currItem->updateGradientVectors();
-			if (currItem->GrType == 13)
+			if (currItem->gradientType() == 13)
 				currItem->createConicalMesh();
 			currItem->update();
 		}
+		trans.commit();
 		m_updateManager.setUpdatesEnabled();
 		changed();
 	}
@@ -10032,6 +10040,19 @@
 				matrixAft.translate(gw, 0);
 				break;
 			}
+			ScItemState<QList<QTransform> > *state = new ScItemState<QList<QTransform> >(Um::Transform);
+			state->set("TRANSFORM", "TRANSFORM");
+			state->set("DX",deltaX);
+			state->set("DY",deltaY);
+			state->set("POSX",currItem->xPos());
+			state->set("POSY",currItem->yPos());
+			QList<QTransform> l;
+			l.append(matrixPre);
+			l.append(matrix);
+			l.append(matrixAft);
+			state->setItem(l);
+			undoManager->action(currItem, state);
+
 			currItem->PoLine.translate(deltaX, deltaY);
 			currItem->PoLine.map(matrixPre);
 			currItem->PoLine.map(matrix);
@@ -10045,7 +10066,9 @@
 //			currItem->Frame = false;
 			currItem->ClipEdited = true;
 //			currItem->FrameType = 3;
+			undoManager->setUndoEnabled(false);
 			AdjustItemSize(currItem);
+			undoManager->setUndoEnabled(true);
 		}
 	}
 	else
@@ -10106,6 +10129,20 @@
 					matrixAft.translate(gw, 0);
 					break;
 				}
+
+				ScItemState<QList<QTransform> > *state = new ScItemState<QList<QTransform> >(Um::Transform);
+				state->set("TRANSFORM", "TRANSFORM");
+				state->set("DX",deltaX);
+				state->set("DY",deltaY);
+				state->set("POSX",currItem->xPos());
+				state->set("POSY",currItem->yPos());
+				QList<QTransform> l;
+				l.append(matrixPre);
+				l.append(matrix);
+				l.append(matrixAft);
+				state->setItem(l);
+				undoManager->action(currItem, state);
+
 				currItem->PoLine.translate(deltaX, deltaY);
 				currItem->PoLine.map(matrixPre);
 				currItem->PoLine.map(comulatedMatrix);
@@ -10119,7 +10156,9 @@
 //				currItem->Frame = false;
 				currItem->ClipEdited = true;
 //				currItem->FrameType = 3;
+				undoManager->setUndoEnabled(false);
 				AdjustItemSize(currItem);
+				undoManager->setUndoEnabled(true);
 				Elements.append(currItem);
 			}
 			comulatedMatrix *= matrix;
@@ -10914,7 +10953,7 @@
 	{
 		PageItem *currItem;
 		currItem = itemSelection->itemAt(i);
-		currItem->stroke_gradient = newGradient;
+		currItem->setStrokeGradient(newGradient);
 		currItem->update();
 	}
 	/*if (selectedItemCount>1)
@@ -10936,8 +10975,8 @@
 	{
 		PageItem *currItem;
 		currItem = itemSelection->itemAt(i);
-		currItem->fill_gradient = newGradient;
-		if (currItem->GrType == 13)
+		currItem->setFillGradient(newGradient);
+		if (currItem->gradientType() == 13)
 			currItem->createConicalMesh();
 		currItem->update();
 	}
@@ -10957,7 +10996,7 @@
 	{
 		PageItem *currItem;
 		currItem = itemSelection->itemAt(i);
-		currItem->mask_gradient = newGradient;
+		currItem->setMaskGradient(newGradient);
 		currItem->update();
 	}
 	m_updateManager.setUpdatesEnabled();
@@ -11231,6 +11270,7 @@
 	uint selectedItemCount=itemSelection->count();
 	if (selectedItemCount != 0)
 	{
+		UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IImageFrame,Um::Rotate,"",Um::IRotate));
 		for (uint a = 0; a < selectedItemCount; ++a)
 		{
 			PageItem *currItem = itemSelection->itemAt(a);
@@ -11246,6 +11286,7 @@
 			}
 			currItem->update();
 		}
+		trans.commit();
 		changed();
 	}
 }
@@ -14512,6 +14553,7 @@
 			delete transaction;
 			transaction = NULL;
 		}
+		m_Selection->addItem(currItem);
 	}
 }
 
@@ -14533,6 +14575,8 @@
 		uint StartInd = 0;
 		int currItemNr = Items->indexOf(currItem);
 		uint EndInd = currItem->PoLine.size();
+		m_Selection->clear();
+		m_Selection->addItem(currItem);
 		for (uint a = EndInd-1; a > 0; --a)
 		{
 			if (currItem->PoLine.point(a).x() > 900000)
@@ -14715,6 +14759,7 @@
 	
 	if (selectedItemCount > 0)
 	{
+		UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::ITextFrame,Um::Resize,"",Um::IResize));
 		for (uint i = 0; i < selectedItemCount; ++i)
 		{
 			PageItem *currItem = itemSelection->itemAt(i);
@@ -14724,6 +14769,7 @@
 					currItem ->asTextFrame()->setTextFrameHeight();
 			}
 		}
+		trans.commit();
 		regionsChanged()->update(QRectF());
 		changed();
 		itemSelection->itemAt(0)->emitAllToGUI();
@@ -14914,7 +14960,7 @@
 void NodeEditContext::finishTransaction2(PageItem* currItem, ScItemState<QPair<FPointArray, FPointArray> >* state)
 {
 	UndoManager* undoManager = UndoManager::instance();
-	
+
 	state->set("OLD_X", oldItemX);
 	state->set("OLD_Y", oldItemY);
 	state->set("NEW_X", currItem->xPos());

Modified: trunk/Scribus/scribus/styles/paragraphstyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/styles/paragraphstyle.cpp
==============================================================================
--- trunk/Scribus/scribus/styles/paragraphstyle.cpp (original)
+++ trunk/Scribus/scribus/styles/paragraphstyle.cpp Thu Jul 12 20:32:18 2012
@@ -12,6 +12,7 @@
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
+#include <QDebug>
 
 #include "commonstrings.h"
 #include "styles/style.h"
@@ -219,7 +220,7 @@
 {
 	other.validate();
 	setParent(other.parent());
-	m_contextversion = -1; 
+	m_contextversion = -1;
 	cstyle.setStyle(other.charStyle());
 	cstyleContext.invalidate();
 #define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \

Modified: trunk/Scribus/scribus/ui/cpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/ui/cpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/cpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/cpalette.cpp Thu Jul 12 20:32:18 2012
@@ -59,6 +59,7 @@
 #include "scpattern.h"
 #include "scribus.h"
 #include "selection.h"
+#include "undomanager.h"
 #include "units.h"
 #include "util_icon.h"
 #include "util.h"
@@ -66,6 +67,7 @@
 
 Cpalette::Cpalette(QWidget* parent) : QWidget(parent)
 {
+	undoManager = UndoManager::instance();
 	m_blockUpdates = 0;
 	currentItem = NULL;
 	patternList = NULL;
@@ -265,7 +267,8 @@
 	updateCList();
 	displayOverprint(currentItem->doOverprint ? 1 : 0);
 	displayColorValues(currentItem->lineColor(), currentItem->fillColor(), currentItem->lineShade(), currentItem->fillShade());
-	displayGradient(currentItem->GrType);
+	displayGradient(currentItem->gradientType());
+	displayGradientStroke(currentItem->strokeGradientType());
 	gradEdit->setGradient(currentItem->fill_gradient);
 	gradEditStroke->setGradient(currentItem->stroke_gradient);
 	if (!currentItem->gradient().isEmpty())
@@ -312,10 +315,16 @@
 		strokeModeCombo->setCurrentIndex(1);
 	else
 		strokeModeCombo->setCurrentIndex(0);
-	if (currentItem->GrType == 12)
+	if (currentItem->gradientType() == 12)
 		setMeshPatchPoint();
 	else
 		setMeshPoint();
+	if(CGradDia && gradEditButton->isChecked())
+		if(tabFillStroke->currentIndex() == 0)
+			CGradDia->setValues(currentItem->gradientStartX(), currentItem->gradientStartY(), currentItem->gradientEndX(), currentItem->gradientEndY(), currentItem->GrFocalX, currentItem->GrFocalY, currentItem->GrScale, currentItem->GrSkew, 0, 0);
+		else
+			CGradDia->setValues(currentItem->GrStrokeStartX, currentItem->GrStrokeStartY, currentItem->GrStrokeEndX, currentItem->GrStrokeEndY, currentItem->GrStrokeFocalX, currentItem->GrStrokeFocalY, currentItem->GrStrokeScale, currentItem->GrStrokeSkew, 0, 0);
+
 	editMeshColors->setEnabled(!CGradDia->isVisible());
 	gradEditButton->setEnabled(true);
 
@@ -658,9 +667,11 @@
 	double t2 = color2Alpha->value() / 100.0;
 	double t3 = color3Alpha->value() / 100.0;
 	double t4 = color4Alpha->value() / 100.0;
+	UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill));
 	currentItem->set4ColorShade(static_cast<int>(color1Shade->value()), static_cast<int>(color2Shade->value()), static_cast<int>(color3Shade->value()), static_cast<int>(color4Shade->value()));
 	currentItem->set4ColorTransparency(t1, t2, t3, t4);
 	currentItem->set4ColorColors(color1, color2, color3, color4);
+	trans.commit();
 	currentItem->update();
 }
 
@@ -958,6 +969,33 @@
 	connect(fillModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotGrad(int)));
 }
 
+void Cpalette::displayGradientStroke(int number)
+{
+	disconnect(strokeModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotGradStroke(int)));
+	if (number==-1 || number == 0)
+		strokeModeCombo->setCurrentIndex(0);
+	else if (number > 0 && number < 8)
+	{
+		if (number == 7)
+			gradientTypeStroke->setCurrentIndex(1);
+		else
+			gradientTypeStroke->setCurrentIndex(0);
+		strokeModeCombo->setCurrentIndex(1);
+	}
+	else
+	{
+		if (patternList->count() == 0)
+		{
+			strokeModeCombo->setCurrentIndex(0);
+			emit NewGradient(0);
+		}
+		else
+			strokeModeCombo->setCurrentIndex(0);
+	}
+	strokeModeStack->setCurrentIndex( strokeModeCombo->currentIndex() );
+	connect(strokeModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotGradStroke(int)));
+}
+
 void Cpalette::slotGrad(int number)
 {
 	if (number == 1)
@@ -1136,9 +1174,9 @@
 {
 	if (editMeshColors->isChecked())
 	{
-		if (currentItem->GrType == 11)
+		if (currentItem->gradientType() == 11)
 			editStrokeGradient = 6;
-		else if (currentItem->GrType == 12)
+		else if (currentItem->gradientType() == 12)
 			editStrokeGradient = 8;
 		else
 			editStrokeGradient = 0;
@@ -1184,50 +1222,78 @@
 	int grow = currentItem->selectedMeshPointX;
 	int gcol = currentItem->selectedMeshPointY;
 	int cont = currentItem->selectedMeshControlPoint;
-	if (currentItem->GrType == 12)
+	meshPoint tmp;
+	if (currentItem->gradientType() == 12)
 	{
 		if ((grow == -1) || (gcol == 0))
 			return;
+		ScItemState<QPair<meshPoint,meshPoint> > *ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
+		ss->set("MOVE_MESH_PATCH","move_mesh_patch");
+		ss->set("ARRAY",false);
+		ss->set("X",grow);
+		ss->set("Y",gcol);
 		switch (gcol)
 		{
 			case 1:
+				tmp = currentItem->meshGradientPatches[grow].TL;
 				if (cont == 2)
-					currentItem->meshGradientPatches[grow].TL.controlBottom    = currentItem->meshGradientPatches[grow].TL.gridPoint;
+					tmp.controlBottom = tmp.gridPoint;
 				if (cont == 4)
-					currentItem->meshGradientPatches[grow].TL.controlRight  = currentItem->meshGradientPatches[grow].TL.gridPoint;
+					tmp.controlRight  = tmp.gridPoint;
+				ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TL,tmp));
+				currentItem->meshGradientPatches[grow].TL = tmp;
 				break;
 			case 2:
+				tmp = currentItem->meshGradientPatches[grow].TR;
 				if (cont == 2)
-					currentItem->meshGradientPatches[grow].TR.controlBottom = currentItem->meshGradientPatches[grow].TR.gridPoint;
+					tmp.controlBottom = tmp.gridPoint;
 				if (cont == 3)
-					currentItem->meshGradientPatches[grow].TR.controlLeft   = currentItem->meshGradientPatches[grow].TR.gridPoint;
+					tmp.controlLeft   = tmp.gridPoint;
+				ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TR,tmp));
+				currentItem->meshGradientPatches[grow].TR = tmp;
 				break;
 			case 3:
+				tmp = currentItem->meshGradientPatches[grow].BR;
 				if (cont == 1)
-					currentItem->meshGradientPatches[grow].BR.controlTop    = currentItem->meshGradientPatches[grow].BR.gridPoint;
+					tmp.controlTop  = tmp.gridPoint;
 				if (cont == 3)
-					currentItem->meshGradientPatches[grow].BR.controlLeft   = currentItem->meshGradientPatches[grow].BR.gridPoint;
+					tmp.controlLeft = tmp.gridPoint;
+				ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BR,tmp));
+				currentItem->meshGradientPatches[grow].BR = tmp;
 				break;
 			case 4:
+				tmp = currentItem->meshGradientPatches[grow].BL;
 				if (cont == 1)
-					currentItem->meshGradientPatches[grow].BL.controlTop    = currentItem->meshGradientPatches[grow].BL.gridPoint;
+					tmp.controlTop   = tmp.gridPoint;
 				if (cont == 4)
-					currentItem->meshGradientPatches[grow].BL.controlRight  = currentItem->meshGradientPatches[grow].BL.gridPoint;
+					tmp.controlRight = tmp.gridPoint;
+				ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BL,tmp));
+				currentItem->meshGradientPatches[grow].BL = tmp;
 				break;
 		}
+		undoManager->action(currentItem,ss);
 	}
 	else
 	{
 		if ((grow == -1) || (gcol == -1))
 			return;
+		ScItemState<QPair<meshPoint,meshPoint> > *ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
+		ss->set("MOVE_MESH_PATCH","move_mesh_patch");
+		ss->set("ARRAY",true);
+		ss->set("X",grow);
+		ss->set("Y",gcol);
+		tmp = currentItem->meshGradientArray[grow][gcol];
 		if (cont == 1)
-			currentItem->meshGradientArray[grow][gcol].controlTop    = currentItem->meshGradientArray[grow][gcol].gridPoint;
+			tmp.controlTop    = tmp.gridPoint;
 		else if (cont == 2)
-			currentItem->meshGradientArray[grow][gcol].controlBottom = currentItem->meshGradientArray[grow][gcol].gridPoint;
+			tmp.controlBottom = tmp.gridPoint;
 		else if (cont == 3)
-			currentItem->meshGradientArray[grow][gcol].controlLeft   = currentItem->meshGradientArray[grow][gcol].gridPoint;
+			tmp.controlLeft   = tmp.gridPoint;
 		else if (cont == 4)
-			currentItem->meshGradientArray[grow][gcol].controlRight  = currentItem->meshGradientArray[grow][gcol].gridPoint;
+			tmp.controlRight  = tmp.gridPoint;
+		ss->setItem(qMakePair(currentItem->meshGradientArray[grow][gcol],tmp));
+		currentItem->meshGradientArray[grow][gcol] = tmp;
+		undoManager->action(currentItem,ss);
 	}
 	currentItem->update();
 	currentDoc->regionsChanged()->update(QRect());
@@ -1237,46 +1303,74 @@
 {
 	int grow = currentItem->selectedMeshPointX;
 	int gcol = currentItem->selectedMeshPointY;
-	if (currentItem->GrType == 12)
+	meshPoint tmp;
+	if (currentItem->gradientType() == 12)
 	{
 		if ((grow == -1) || (gcol == 0))
 			return;
+		ScItemState<QPair<meshPoint,meshPoint> > *ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
+		ss->set("MOVE_MESH_PATCH","move_mesh_patch");
+		ss->set("ARRAY",false);
+		ss->set("X",grow);
+		ss->set("Y",gcol);
 		switch (gcol)
 		{
 			case 1:
-				currentItem->meshGradientPatches[grow].TL.controlTop    = currentItem->meshGradientPatches[grow].TL.gridPoint;
-				currentItem->meshGradientPatches[grow].TL.controlLeft   = currentItem->meshGradientPatches[grow].TL.gridPoint;
-				currentItem->meshGradientPatches[grow].TL.controlRight  = currentItem->meshGradientPatches[grow].TL.gridPoint;
-				currentItem->meshGradientPatches[grow].TL.controlBottom = currentItem->meshGradientPatches[grow].TL.gridPoint;
-				break;
+				tmp = currentItem->meshGradientPatches[grow].TL;
+				tmp.controlTop    = tmp.gridPoint;
+				tmp.controlLeft   = tmp.gridPoint;
+				tmp.controlRight  = tmp.gridPoint;
+				tmp.controlBottom = tmp.gridPoint;
+				ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TL,tmp));
+				currentItem->meshGradientPatches[grow].TL = tmp;
+		break;
 			case 2:
-				currentItem->meshGradientPatches[grow].TR.controlTop    = currentItem->meshGradientPatches[grow].TR.gridPoint;
-				currentItem->meshGradientPatches[grow].TR.controlLeft   = currentItem->meshGradientPatches[grow].TR.gridPoint;
-				currentItem->meshGradientPatches[grow].TR.controlRight  = currentItem->meshGradientPatches[grow].TR.gridPoint;
-				currentItem->meshGradientPatches[grow].TR.controlBottom = currentItem->meshGradientPatches[grow].TR.gridPoint;
-				break;
+				tmp = currentItem->meshGradientPatches[grow].TR;
+				tmp.controlTop    = tmp.gridPoint;
+				tmp.controlLeft   = tmp.gridPoint;
+				tmp.controlRight  = tmp.gridPoint;
+				tmp.controlBottom = tmp.gridPoint;
+				ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TR,tmp));
+				currentItem->meshGradientPatches[grow].TR = tmp;
+		break;
 			case 3:
-				currentItem->meshGradientPatches[grow].BR.controlTop    = currentItem->meshGradientPatches[grow].BR.gridPoint;
-				currentItem->meshGradientPatches[grow].BR.controlLeft   = currentItem->meshGradientPatches[grow].BR.gridPoint;
-				currentItem->meshGradientPatches[grow].BR.controlRight  = currentItem->meshGradientPatches[grow].BR.gridPoint;
-				currentItem->meshGradientPatches[grow].BR.controlBottom = currentItem->meshGradientPatches[grow].BR.gridPoint;
-				break;
+				tmp = currentItem->meshGradientPatches[grow].BR;
+				tmp.controlTop    = tmp.gridPoint;
+				tmp.controlLeft   = tmp.gridPoint;
+				tmp.controlRight  = tmp.gridPoint;
+				tmp.controlBottom = tmp.gridPoint;
+				ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BR,tmp));
+				currentItem->meshGradientPatches[grow].BR = tmp;
+		break;
 			case 4:
-				currentItem->meshGradientPatches[grow].BL.controlTop    = currentItem->meshGradientPatches[grow].BL.gridPoint;
-				currentItem->meshGradientPatches[grow].BL.controlLeft   = currentItem->meshGradientPatches[grow].BL.gridPoint;
-				currentItem->meshGradientPatches[grow].BL.controlRight  = currentItem->meshGradientPatches[grow].BL.gridPoint;
-				currentItem->meshGradientPatches[grow].BL.controlBottom = currentItem->meshGradientPatches[grow].BL.gridPoint;
-				break;
-		}
+				tmp = currentItem->meshGradientPatches[grow].BL;
+				tmp.controlTop    = tmp.gridPoint;
+				tmp.controlLeft   = tmp.gridPoint;
+				tmp.controlRight  = tmp.gridPoint;
+				tmp.controlBottom = tmp.gridPoint;
+				ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BL,tmp));
+				currentItem->meshGradientPatches[grow].BL = tmp;
+		break;
+		}
+		undoManager->action(currentItem,ss);
 	}
 	else
 	{
 		if ((grow == -1) || (gcol == -1))
 			return;
-		currentItem->meshGradientArray[grow][gcol].controlTop    = currentItem->meshGradientArray[grow][gcol].gridPoint;
-		currentItem->meshGradientArray[grow][gcol].controlLeft   = currentItem->meshGradientArray[grow][gcol].gridPoint;
-		currentItem->meshGradientArray[grow][gcol].controlRight  = currentItem->meshGradientArray[grow][gcol].gridPoint;
-		currentItem->meshGradientArray[grow][gcol].controlBottom = currentItem->meshGradientArray[grow][gcol].gridPoint;
+		ScItemState<QPair<meshPoint,meshPoint> > *ss = new ScItemState<QPair<meshPoint,meshPoint> >(Um::GradPos);
+		ss->set("MOVE_MESH_PATCH","move_mesh_patch");
+		ss->set("ARRAY",true);
+		ss->set("X",grow);
+		ss->set("Y",gcol);
+		tmp = currentItem->meshGradientArray[grow][gcol];
+		tmp.controlTop    = tmp.gridPoint;
+		tmp.controlLeft   = tmp.gridPoint;
+		tmp.controlRight  = tmp.gridPoint;
+		tmp.controlBottom = tmp.gridPoint;
+		ss->setItem(qMakePair(currentItem->meshGradientArray[grow][gcol],tmp));
+		currentItem->meshGradientArray[grow][gcol] = tmp;
+		undoManager->action(currentItem,ss);
 	}
 	currentItem->update();
 	currentDoc->regionsChanged()->update(QRect());
@@ -1287,32 +1381,32 @@
 	if (gradEditButton->isChecked())
 	{
 		CGradDia->unitChange(currentDoc->unitIndex());
-		CGradDia->setValues(currentItem->GrStartX, currentItem->GrStartY, currentItem->GrEndX, currentItem->GrEndY, currentItem->GrFocalX, currentItem->GrFocalY, currentItem->GrScale, currentItem->GrSkew, 0, 0);
-		if (currentItem->GrType == 6)
+		CGradDia->setValues(currentItem->gradientStartX(), currentItem->gradientStartY(), currentItem->gradientEndX(), currentItem->gradientEndY(), currentItem->GrFocalX, currentItem->GrFocalY, currentItem->GrScale, currentItem->GrSkew, 0, 0);
+		if (currentItem->gradientType() == 6)
 			CGradDia->selectLinear();
-		else if (currentItem->GrType == 7)
+		else if (currentItem->gradientType() == 7)
 			CGradDia->selectRadial();
-		else if (currentItem->GrType == 9)
+		else if (currentItem->gradientType() == 9)
 		{
 			CGradDia->setValues(currentItem->GrControl1.x(), currentItem->GrControl1.y(), currentItem->GrControl2.x(), currentItem->GrControl2.y(), currentItem->GrControl3.x(), currentItem->GrControl3.y(), currentItem->GrControl4.x(), currentItem->GrControl4.y(), 0, 0);
 			CGradDia->selectFourColor();
 		}
-		else if (currentItem->GrType == 10)
+		else if (currentItem->gradientType() == 10)
 		{
 			CGradDia->setValues(currentItem->GrControl1.x(), currentItem->GrControl1.y(), currentItem->GrControl2.x(), currentItem->GrControl2.y(), currentItem->GrControl3.x(), currentItem->GrControl3.y(), currentItem->GrControl4.x(), currentItem->GrControl4.y(), currentItem->GrControl5.x(), currentItem->GrControl5.y());
 			CGradDia->selectDiamond();
 		}
-		else if (currentItem->GrType == 11)
+		else if (currentItem->gradientType() == 11)
 		{
 			CGradDia->selectMesh();
 			editMeshColors->setEnabled(false);
 		}
-		else if (currentItem->GrType == 12)
+		else if (currentItem->gradientType() == 12)
 		{
 			CGradDia->selectPatchMesh();
 			editMeshColors->setEnabled(false);
 		}
-		else if (currentItem->GrType == 13)
+		else if (currentItem->gradientType() == 13)
 			CGradDia->selectConical();
 		CGradDia->show();
 	}
@@ -1321,13 +1415,13 @@
 		CGradDia->hide();
 		editMeshColors->setEnabled(true);
 	}
-	if (currentItem->GrType == 9)
+	if (currentItem->gradientType() == 9)
 		editStrokeGradient = 3;
-	else if (currentItem->GrType == 10)
+	else if (currentItem->gradientType() == 10)
 		editStrokeGradient = 4;
-	else if (currentItem->GrType == 11)
+	else if (currentItem->gradientType() == 11)
 		editStrokeGradient = 5;
-	else if (currentItem->GrType == 12)
+	else if (currentItem->gradientType() == 12)
 		editStrokeGradient = 9;
 	else
 		editStrokeGradient = 0;
@@ -1340,7 +1434,7 @@
 	{
 		CGradDia->unitChange(currentDoc->unitIndex());
 		CGradDia->setValues(currentItem->GrStrokeStartX, currentItem->GrStrokeStartY, currentItem->GrStrokeEndX, currentItem->GrStrokeEndY, currentItem->GrStrokeFocalX, currentItem->GrStrokeFocalY, currentItem->GrStrokeScale, currentItem->GrStrokeSkew, 0, 0);
-		if (currentItem->GrTypeStroke == 6)
+		if (currentItem->strokeGradientType() == 6)
 			CGradDia->selectLinear();
 		else
 			CGradDia->selectRadial();
@@ -1400,14 +1494,18 @@
 
 void Cpalette::snapToPatchGrid(bool val)
 {
-	currentItem->snapToPatchGrid = val;
+	currentItem->setSnapToPatchGrid(val);
 }
 
 void Cpalette::handleRemovePatch()
 {
 	if ((currentItem->selectedMeshPointX > -1) && (currentItem->meshGradientPatches.count() > 1))
 	{
-		currentItem->meshGradientPatches.removeAt(currentItem->selectedMeshPointX);
+		ScItemState<meshGradientPatch> *ss = new ScItemState<meshGradientPatch>(Um::RemoveMeshPatch,"",Um::ILine);
+		ss->set("REMOVE_MESH_PATCH","remove_mesh_patch");
+		ss->setItem(currentItem->meshGradientPatches.takeAt(currentItem->selectedMeshPointX));
+		ss->set("POS",currentItem->selectedMeshPointX);
+		undoManager->action(currentItem,ss);
 		currentItem->selectedMeshPointX = -1;
 		CGradDia->changebuttonRemovePatch((currentItem->selectedMeshPointX > -1) && (currentItem->meshGradientPatches.count() > 1));
 		currentItem->update();

Modified: trunk/Scribus/scribus/ui/cpalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/ui/cpalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/cpalette.h (original)
+++ trunk/Scribus/scribus/ui/cpalette.h Thu Jul 12 20:32:18 2012
@@ -42,6 +42,7 @@
 class ScrSpinBox;
 class ScComboBox;
 class ScPattern;
+class UndoManager;
 
 /**
   *@author Franz Schmid
@@ -72,6 +73,7 @@
 private:
 
 	PageItem* currentItemFromSelection();
+	UndoManager * undoManager;
 
 public slots:
 
@@ -83,6 +85,7 @@
 	void fillStrokeSelector(int /*index*/);
 	void displayColorValues(QString stroke, QString fille, int sShade, int fShade);
 	void displayGradient(int nr);
+	void displayGradientStroke(int nr);
 	void displayOverprint(int);
 	void handleFillShade(double);
 	void handleStrokeShade(double);

Modified: trunk/Scribus/scribus/ui/multipleduplicate.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/ui/multipleduplicate.ui
==============================================================================
--- trunk/Scribus/scribus/ui/multipleduplicate.ui (original)
+++ trunk/Scribus/scribus/ui/multipleduplicate.ui Thu Jul 12 20:32:18 2012
@@ -27,6 +27,9 @@
      </property>
      <property name="currentIndex">
       <number>0</number>
+     </property>
+     <property name="usesScrollButtons">
+      <bool>false</bool>
      </property>
      <widget class="QWidget" name="tab">
       <attribute name="title">

Modified: trunk/Scribus/scribus/ui/polygonwidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/ui/polygonwidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/polygonwidget.cpp (original)
+++ trunk/Scribus/scribus/ui/polygonwidget.cpp Thu Jul 12 20:32:18 2012
@@ -26,6 +26,7 @@
 	setupUi(this);
 	factorSpinBox->setDecimals(0);
 	rotationSpinBox->setDecimals(0);
+	cornersSpinBox->setDecimals(0);
 	cornersSpinBox->setDecimals(0);
 	curvatureSpinBox->setDecimals(0);
 	innerRotationspinBox->setDecimals(0);

Modified: trunk/Scribus/scribus/ui/polygonwidgetbase.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/ui/polygonwidgetbase.ui
==============================================================================
--- trunk/Scribus/scribus/ui/polygonwidgetbase.ui (original)
+++ trunk/Scribus/scribus/ui/polygonwidgetbase.ui Thu Jul 12 20:32:18 2012
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>470</width>
-    <height>353</height>
+    <width>510</width>
+    <height>365</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -42,6 +42,9 @@
          <property name="toolTip">
           <string>Number of corners for polygons</string>
          </property>
+         <property name="suffix">
+          <string notr="true"> </string>
+         </property>
          <property name="minimum">
           <number>3</number>
          </property>

Modified: trunk/Scribus/scribus/ui/propertiespalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/ui/propertiespalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.cpp Thu Jul 12 20:32:18 2012
@@ -71,6 +71,7 @@
 
 PropertiesPalette::PropertiesPalette( QWidget* parent) : ScDockPalette( parent, "PropertiesPalette", 0)
 {
+	undoManager = UndoManager::instance();
 	m_ScMW=0;
 	m_doc=0;
 	m_haveDoc = false;
@@ -636,89 +637,102 @@
 	if ((m_haveDoc) && (m_haveItem))
 	{
 		QRectF upRect;
+		UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::ILine,Um::GradPos + "p","",Um::ILine));
 		if (m_ScMW->view->editStrokeGradient == 1)
 		{
-			m_item->GrStrokeStartX = x1 / m_unitRatio;
-			m_item->GrStrokeStartY = y1 / m_unitRatio;
-			m_item->GrStrokeEndX = x2 / m_unitRatio;
-			m_item->GrStrokeEndY = y2 / m_unitRatio;
-			m_item->GrStrokeFocalX = fx / m_unitRatio;
-			m_item->GrStrokeFocalY = fy / m_unitRatio;
-			m_item->GrStrokeScale = sg;
-			m_item->GrStrokeSkew = sk;
-			if (m_item->GrTypeStroke == 6)
+			m_item->setGradientStrokeStartX(x1 / m_unitRatio);
+			m_item->setGradientStrokeStartY(y1 / m_unitRatio);
+			m_item->setGradientStrokeEndX(x2 / m_unitRatio);
+			m_item->setGradientStrokeEndY(y2 / m_unitRatio);
+			m_item->setGradientStrokeFocalX(fx / m_unitRatio);
+			m_item->setGradientStrokeFocalY(fy / m_unitRatio);
+			m_item->setGradientStrokeScale(sg);
+			m_item->setGradientStrokeSkew(sk);
+			if (m_item->strokeGradientType() == 6)
 			{
-				m_item->GrStrokeFocalX = m_item->GrStrokeStartX;
-				m_item->GrStrokeFocalY = m_item->GrStrokeStartY;
+				m_item->setGradientStrokeFocalX(m_item->gradientStrokeStartX());
+				m_item->setGradientStrokeFocalY(m_item->gradientStrokeStartY());
 			}
 			m_item->update();
-			upRect = QRectF(QPointF(m_item->GrStrokeStartX, m_item->GrStrokeStartY), QPointF(m_item->GrStrokeEndX, m_item->GrStrokeEndY));
-			double radEnd = distance(m_item->GrStrokeEndX - m_item->GrStrokeStartX, m_item->GrStrokeEndY - m_item->GrStrokeStartY);
-			double rotEnd = xy2Deg(m_item->GrStrokeEndX - m_item->GrStrokeStartX, m_item->GrStrokeEndY - m_item->GrStrokeStartY);
+			upRect = QRectF(QPointF(m_item->gradientStrokeStartX(), m_item->gradientStrokeStartY()), QPointF(m_item->gradientStrokeEndX(), m_item->gradientStrokeEndY()));
+			double radEnd = distance(m_item->gradientStrokeEndX() - m_item->gradientStrokeStartX(), m_item->gradientStrokeEndY() - m_item->gradientStrokeStartY());
+			double rotEnd = xy2Deg(m_item->gradientStrokeEndX() - m_item->gradientStrokeStartX(), m_item->gradientStrokeEndY() - m_item->gradientStrokeStartY());
 			QTransform m;
-			m.translate(m_item->GrStrokeStartX, m_item->GrStrokeStartY);
+			m.translate(m_item->gradientStrokeStartX(), m_item->gradientStrokeStartY());
 			m.rotate(rotEnd);
 			m.rotate(-90);
-			m.rotate(m_item->GrStrokeSkew);
-			m.translate(radEnd * m_item->GrStrokeScale, 0);
+			m.rotate(m_item->gradientStrokeSkew());
+			m.translate(radEnd * m_item->gradientStrokeScale(), 0);
 			QPointF shP = m.map(QPointF(0,0));
-			upRect = upRect.united(QRectF(shP, QPointF(m_item->GrStrokeEndX, m_item->GrStrokeEndY)).normalized());
-			upRect = upRect.united(QRectF(shP, QPointF(m_item->GrStrokeStartX, m_item->GrStrokeStartY)).normalized());
+			upRect = upRect.united(QRectF(shP, QPointF(m_item->gradientStrokeEndX(), m_item->gradientStrokeEndY())).normalized());
+			upRect = upRect.united(QRectF(shP, QPointF(m_item->gradientStrokeStartX(), m_item->gradientStrokeStartY())).normalized());
 			upRect |= QRectF(shP, QPointF(0, 0)).normalized();
 			upRect |= QRectF(shP, QPointF(m_item->width(), m_item->height())).normalized();
 		}
 		else if (m_ScMW->view->editStrokeGradient == 3)
 		{
-			m_item->GrControl1 = FPoint(x1 / m_unitRatio, y1 / m_unitRatio);
-			m_item->GrControl2 = FPoint(x2 / m_unitRatio, y2 / m_unitRatio);
-			m_item->GrControl3 = FPoint(fx / m_unitRatio, fy / m_unitRatio);
-			m_item->GrControl4 = FPoint(sg / m_unitRatio, sk / m_unitRatio);
+			m_item->setGradientControl1(FPoint(x1 / m_unitRatio, y1 / m_unitRatio));
+			m_item->setGradientControl2(FPoint(x2 / m_unitRatio, y2 / m_unitRatio));
+			m_item->setGradientControl3(FPoint(fx / m_unitRatio, fy / m_unitRatio));
+			m_item->setGradientControl4(FPoint(sg / m_unitRatio, sk / m_unitRatio));
 			m_item->update();
 			upRect = QRectF(QPointF(-m_item->width(), -m_item->height()), QPointF(m_item->width() * 2, m_item->height() * 2)).normalized();
 		}
 		else if (m_ScMW->view->editStrokeGradient == 4)
 		{
-			m_item->GrControl1 = FPoint(x1 / m_unitRatio, y1 / m_unitRatio);
-			m_item->GrControl2 = FPoint(x2 / m_unitRatio, y2 / m_unitRatio);
-			m_item->GrControl3 = FPoint(fx / m_unitRatio, fy / m_unitRatio);
-			m_item->GrControl4 = FPoint(sg / m_unitRatio, sk / m_unitRatio);
-			m_item->GrControl5 = FPoint(cx / m_unitRatio, cy / m_unitRatio);
+			m_item->setGradientControl1(FPoint(x1 / m_unitRatio, y1 / m_unitRatio));
+			m_item->setGradientControl2(FPoint(x2 / m_unitRatio, y2 / m_unitRatio));
+			m_item->setGradientControl3(FPoint(fx / m_unitRatio, fy / m_unitRatio));
+			m_item->setGradientControl4(FPoint(sg / m_unitRatio, sk / m_unitRatio));
+			m_item->setGradientControl5(FPoint(cx / m_unitRatio, cy / m_unitRatio));
 			m_item->update();
 			upRect = QRectF(QPointF(-m_item->width(), -m_item->height()), QPointF(m_item->width() * 2, m_item->height() * 2)).normalized();
 		}
 		else
 		{
-			m_item->GrStartX = x1 / m_unitRatio;
-			m_item->GrStartY = y1 / m_unitRatio;
-			m_item->GrEndX = x2 / m_unitRatio;
-			m_item->GrEndY = y2 / m_unitRatio;
-			m_item->GrFocalX = fx / m_unitRatio;
-			m_item->GrFocalY = fy / m_unitRatio;
-			m_item->GrScale = sg;
-			m_item->GrSkew = sk;
-			if (m_item->GrTypeStroke == 6)
+			if (m_item->gradientType() == 13)
 			{
-				m_item->GrFocalX = m_item->GrStartX;
-				m_item->GrFocalY = m_item->GrStartY;
+				SimpleState *ss= new SimpleState("Refresh");
+				ss->set("UNDO_UPDATE_CONICAL","undo_update_conical");
+				undoManager->action(m_item,ss);
 			}
-			if (m_item->GrType == 13)
+			m_item->setGradientStartX(x1 / m_unitRatio);
+			m_item->setGradientStartY(y1 / m_unitRatio);
+			m_item->setGradientEndX(x2 / m_unitRatio);
+			m_item->setGradientEndY(y2 / m_unitRatio);
+			m_item->setGradientFocalX(fx / m_unitRatio);
+			m_item->setGradientFocalY(fy / m_unitRatio);
+			m_item->setGradientScale(sg);
+			m_item->setGradientSkew(sk);
+			if (m_item->strokeGradientType() == 6)
+			{
+				m_item->setGradientFocalX(m_item->gradientStartX());
+				m_item->setGradientFocalY(m_item->gradientStartY());
+			}
+			if (m_item->gradientType() == 13)
+			{
 				m_item->createConicalMesh();
+				SimpleState *ss= new SimpleState("Refresh");
+				ss->set("REDO_UPDATE_CONICAL","redo_update_conical");
+				undoManager->action(m_item,ss);
+			}
 			m_item->update();
-			upRect = QRectF(QPointF(m_item->GrStartX, m_item->GrStartY), QPointF(m_item->GrEndX, m_item->GrEndY));
-			double radEnd = distance(m_item->GrEndX - m_item->GrStartX, m_item->GrEndY - m_item->GrStartY);
-			double rotEnd = xy2Deg(m_item->GrEndX - m_item->GrStartX, m_item->GrEndY - m_item->GrStartY);
+			upRect = QRectF(QPointF(m_item->gradientStartX(), m_item->gradientStartY()), QPointF(m_item->gradientEndX(), m_item->gradientEndY()));
+			double radEnd = distance(m_item->gradientEndX() - m_item->gradientStartX(), m_item->gradientEndY() - m_item->gradientStartY());
+			double rotEnd = xy2Deg(m_item->gradientEndX() - m_item->gradientStartX(), m_item->gradientEndY() - m_item->gradientStartY());
 			QTransform m;
-			m.translate(m_item->GrStartX, m_item->GrStartY);
+			m.translate(m_item->gradientStartX(), m_item->gradientStartY());
 			m.rotate(rotEnd);
 			m.rotate(-90);
-			m.rotate(m_item->GrSkew);
-			m.translate(radEnd * m_item->GrScale, 0);
+			m.rotate(m_item->gradientSkew());
+			m.translate(radEnd * m_item->gradientScale(), 0);
 			QPointF shP = m.map(QPointF(0,0));
-			upRect |= QRectF(shP, QPointF(m_item->GrEndX, m_item->GrEndY)).normalized();
-			upRect |= QRectF(shP, QPointF(m_item->GrStartX, m_item->GrStartY)).normalized();
+			upRect |= QRectF(shP, QPointF(m_item->gradientEndX(), m_item->gradientEndY())).normalized();
+			upRect |= QRectF(shP, QPointF(m_item->gradientStartX(), m_item->gradientStartY())).normalized();
 			upRect |= QRectF(shP, QPointF(0, 0)).normalized();
 			upRect |= QRectF(shP, QPointF(m_item->width(), m_item->height())).normalized();
 		}
+		trans.commit();
 		upRect.translate(m_item->xPos(), m_item->yPos());
 		m_doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0));
 		m_doc->changed();
@@ -764,20 +778,22 @@
 	if ((m_haveDoc) && (m_haveItem))
 	{
 		QRectF upRect;
-		m_item->GrMaskStartX = x1 / m_unitRatio;
-		m_item->GrMaskStartY = y1 / m_unitRatio;
-		m_item->GrMaskEndX = x2 / m_unitRatio;
-		m_item->GrMaskEndY = y2 / m_unitRatio;
-		m_item->GrMaskFocalX = fx / m_unitRatio;
-		m_item->GrMaskFocalY = fy / m_unitRatio;
-		m_item->GrMaskScale = sg;
-		m_item->GrMaskSkew = sk;
+		UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::ILine,Um::GradPos + "o","",Um::ILine));
+		m_item->setGradientMaskStartX(x1 / m_unitRatio);
+		m_item->setGradientMaskStartY(y1 / m_unitRatio);
+		m_item->setGradientMaskEndX(x2 / m_unitRatio);
+		m_item->setGradientMaskEndY(y2 / m_unitRatio);
+		m_item->setGradientMaskFocalX(fx / m_unitRatio);
+		m_item->setGradientMaskFocalY(fy / m_unitRatio);
+		m_item->setGradientMaskScale(sg);
+		m_item->setGradientMaskSkew(sk);
 		if ((m_item->GrMask == 1) || (m_item->GrMask == 4))
 		{
-			m_item->GrMaskFocalX = m_item->GrMaskStartX;
-			m_item->GrMaskFocalY = m_item->GrMaskStartY;
+			m_item->setGradientMaskFocalX(m_item->GrMaskStartX);
+			m_item->setGradientMaskFocalY(m_item->GrMaskStartY);
 		}
 		m_item->update();
+		trans.commit();
 		upRect = QRectF(QPointF(m_item->GrMaskStartX, m_item->GrMaskStartY), QPointF(m_item->GrMaskEndX, m_item->GrMaskEndY));
 		double radEnd = distance(m_item->GrMaskEndX - m_item->GrMaskStartX, m_item->GrMaskEndY - m_item->GrMaskStartY);
 		double rotEnd = xy2Deg(m_item->GrMaskEndX - m_item->GrMaskStartX, m_item->GrMaskEndY - m_item->GrMaskStartY);
@@ -933,4 +949,4 @@
 		VGradient vg(Tpal->gradEdit->gradient());
 		m_doc->itemSelection_SetMaskGradient(vg);
 	}
-}
+}

Modified: trunk/Scribus/scribus/ui/propertiespalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/ui/propertiespalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.h (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.h Thu Jul 12 20:32:18 2012
@@ -44,6 +44,7 @@
 class ScribusDoc;
 class ScribusMainWindow;
 class Selection;
+class UndoManager;
 class Tpalette;
 
 class SCRIBUS_API PropertiesPalette : public ScDockPalette
@@ -121,6 +122,7 @@
 	double    m_unitRatio;
 	int       m_unitIndex;
 	PageItem* m_item;
+	UndoManager *undoManager;
 	
 	ScGuardedPtr<ScribusDoc> m_doc;
 	

Modified: trunk/Scribus/scribus/ui/propertiespalette_image.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/ui/propertiespalette_image.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_image.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_image.cpp Thu Jul 12 20:32:18 2012
@@ -487,6 +487,9 @@
 			cbProportional->setChecked(m_item->AspectRatio);
 			freeScale->setEnabled(true);
 			frameScale->setEnabled(true);
+			//Necessary for undo action
+			keepImageWHRatioButton->setEnabled(setter);
+			keepImageDPIRatioButton->setEnabled(setter);
 		}
 //CB Why do we need this? Setting it too much here
 // 		if (setter == true)
@@ -716,6 +719,11 @@
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
 	bool reallynew = (m_item->pixm.imgInfo.actualPageNumber != imagePageNumber->value());
+	SimpleState *ss = new SimpleState(Um::PageNmbr.arg(static_cast<int>(imagePageNumber->value())),"",Um::IImageFrame);
+	ss->set("IMAGE_NBR","image_nbr");
+	ss->set("OLD",m_item->pixm.imgInfo.actualPageNumber);
+	ss->set("NEW",imagePageNumber->value());
+	UndoManager::instance()->action(m_item,ss);
 	m_item->pixm.imgInfo.actualPageNumber = static_cast<int>(imagePageNumber->value());
 	if (reallynew)
 		m_item->loadImage(m_item->externalFile(), true);

Modified: trunk/Scribus/scribus/ui/transparencypalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/ui/transparencypalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/transparencypalette.cpp (original)
+++ trunk/Scribus/scribus/ui/transparencypalette.cpp Thu Jul 12 20:32:18 2012
@@ -154,9 +154,9 @@
 		namedGradient->setCurrentIndex(0);
 		gradEdit->setGradientEditable(true);
 	}
-	if (currentItem->GrMask == 0)
+	if (currentItem->maskType() == 0)
 		tabWidget->setCurrentIndex(0);
-	else if ((currentItem->GrMask == 1) || (currentItem->GrMask == 2) || (currentItem->GrMask == 4) || (currentItem->GrMask == 5))
+	else if ((currentItem->maskType() == 1) || (currentItem->maskType() == 2) || (currentItem->maskType() == 4) || (currentItem->maskType() == 5))
 		tabWidget->setCurrentIndex(1);
 	else
 		tabWidget->setCurrentIndex(2);
@@ -167,17 +167,18 @@
 	transpCalcGradient->setChecked(false);
 	transpCalcPattern->setChecked(false);
 	usePatternInverted->setChecked(false);
-	if ((currentItem->GrMask == 4) || (currentItem->GrMask == 5))
+	if ((currentItem->maskType() == 4) || (currentItem->maskType() == 5))
 		transpCalcGradient->setChecked(true);
-	if ((currentItem->GrMask == 6) || (currentItem->GrMask == 7))
+	if ((currentItem->maskType() == 6) || (currentItem->maskType() == 7))
 		transpCalcPattern->setChecked(true);
-	if ((currentItem->GrMask == 7) || (currentItem->GrMask == 8))
+	if ((currentItem->maskType() == 7) || (currentItem->maskType() == 8))
 		usePatternInverted->setChecked(true);
-	if ((currentItem->GrMask == 1) || (currentItem->GrMask == 4))
+	if ((currentItem->maskType() == 1) || (currentItem->maskType() == 4))
 		gradientType->setCurrentIndex(0);
-	else if ((currentItem->GrMask == 2) || (currentItem->GrMask == 5))
+	else if ((currentItem->maskType() == 2) || (currentItem->maskType() == 5))
 		gradientType->setCurrentIndex(1);
-
+	if(TGradDia && gradEditButton->isChecked())
+		TGradDia->setValues(currentItem->GrMaskStartX, currentItem->GrMaskStartY, currentItem->GrMaskEndX, currentItem->GrMaskEndY, currentItem->GrMaskFocalX, currentItem->GrMaskFocalY, currentItem->GrMaskScale, currentItem->GrMaskSkew, 0, 0);
 	double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
 	bool mirrorX, mirrorY;
 	currentItem->maskTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);

Modified: trunk/Scribus/scribus/undomanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/undomanager.cpp
==============================================================================
--- trunk/Scribus/scribus/undomanager.cpp (original)
+++ trunk/Scribus/scribus/undomanager.cpp Thu Jul 12 20:32:18 2012
@@ -886,6 +886,7 @@
 	UndoManager::ResTyp             = tr("Change image resolution");
 	UndoManager::UnLock             = tr("Unlock");
 	UndoManager::SizeLock           = tr("Lock size");
+	UndoManager::GradTypeMask       = tr("Set mask gradient type");
 	UndoManager::SizeUnLock         = tr("Unlock size");
 	UndoManager::EnablePrint        = tr("Enable Item Printing");
 	UndoManager::DisablePrint       = tr("Disable Item Printing");
@@ -913,8 +914,16 @@
 	UndoManager::RowsCols           = tr("Rows: %1, Cols: %2");
 	UndoManager::SetFont            = tr("Set font");
 	UndoManager::SetFontSize        = tr("Set font size");
+	UndoManager::StartArrowScale    = tr("Set start arrow scale");
+	UndoManager::EndArrowScale      = tr("Set end arrow scale");
+	UndoManager::SetFontSize        = tr("Set font size");
 	UndoManager::SetFontWidth       = tr("Set font width");
-	UndoManager::SetFontHeight       = tr("Set font height");
+	UndoManager::SetFontHeight      = tr("Set font height");
+	UndoManager::GradType           = tr("Change fill gradient type");
+	UndoManager::GradVal            = tr("Change fill gradient values");
+	UndoManager::GradValStroke      = tr("Change stroke gradient values");
+	UndoManager::GradCol            = tr("Change gradient color");
+	UndoManager::GradTypeStroke     = tr("Change stroke gradient type");
 	UndoManager::SetFontFill        = tr("Set font fill color");
 	UndoManager::SetFontStroke      = tr("Set font stroke color");
 	UndoManager::SetFontFillShade   = tr("Set font fill color shade");
@@ -929,6 +938,7 @@
 	UndoManager::TextFrame          = tr("Text frame");
 	UndoManager::LatexFrame         = tr("Render frame");
 	UndoManager::Polygon            = tr("Polygon");
+	UndoManager::EditPolygon        = tr("Edit polygon");
 	UndoManager::BezierCurve        = tr("Bezier curve");
 	UndoManager::Polyline           = tr("Polyline");
 	UndoManager::PathText           = tr("Text on a Path");
@@ -949,7 +959,7 @@
 	UndoManager::ObjectFrame        = tr("Text flows around the frame");
 	UndoManager::BoundingBox        = tr("Text flows around bounding box");
 	UndoManager::ContourLine        = tr("Text flows around contour line");
-	UndoManager::ImageClip        = tr("Text flows around image clipping path");
+	UndoManager::ImageClip          = tr("Text flows around image clipping path");
 	UndoManager::NoTextFlow         = tr("No text flow");
 	UndoManager::NoObjectFrame      = tr("No object frame");
 	UndoManager::NoBoundingBox      = tr("No bounding box");
@@ -958,6 +968,9 @@
 	UndoManager::PageNmbr           = tr("Page %1");
 	UndoManager::ImageScaling       = tr("Set image scaling");
 	UndoManager::FrameSize          = tr("Frame size");
+	UndoManager::MeshGradient       = tr("Create mesh gradient");
+	UndoManager::ChangeMeshGradient = tr("Change mesh gradient");
+	UndoManager::Mode               = tr("Change Mode");
 	UndoManager::FreeScaling        = tr("Free scaling");
 	UndoManager::KeepRatio          = tr("Keep aspect ratio");
 	UndoManager::BreakRatio         = tr("Break aspect ratio");
@@ -979,10 +992,11 @@
 	UndoManager::DeletePages        = tr("Delete pages");
 	UndoManager::ChangePageProps    = tr("Change page properties");
 	UndoManager::AddLayer           = tr("Add layer");
-	UndoManager::DuplicateLayer	= tr("Duplicate layer %1");
+	UndoManager::DuplicateLayer	    = tr("Duplicate layer %1");
 	UndoManager::DeleteLayer        = tr("Delete layer");
 	UndoManager::RenameLayer        = tr("Rename layer");
 	UndoManager::RaiseLayer         = tr("Raise layer");
+	UndoManager::GradPos            = tr("Change gradient position");
 	UndoManager::LowerLayer         = tr("Lower layer");
 	UndoManager::SendToLayer        = tr("Send to layer");
 	UndoManager::PrintLayer         = tr("Enable printing of layer");
@@ -996,7 +1010,9 @@
 	UndoManager::SetLayerUnlocked   =tr("Unlock layer");
 	UndoManager::GetImage           = tr("Get image");
 	UndoManager::ChangeFormula      = tr("Change formula");
+	UndoManager::Duplicate          = tr("Duplicate");
 	UndoManager::MultipleDuplicate  = tr("Multiple duplicate");
+	UndoManager::RemoveMeshPatch    = tr("Remove mesh patch");
 	UndoManager::ApplyTextStyle     = tr("Apply text style");
 	UndoManager::RemoveTextStyle    = tr("Remove text style");
 	UndoManager::MenuUndo           = tr("&Undo: %1", "f.e. Undo: Move");
@@ -1010,7 +1026,7 @@
 	UndoManager::InsertFrame        = tr("Insert frame");
 	UndoManager::AdjustFrameToImage = tr("Adjust frame to the image size");
 	UndoManager::RemoveAllGuides    = tr("Remove all guides");
-	UndoManager::RemoveAllPageGuides = tr("Remove page guides");
+	UndoManager::RemoveAllPageGuides= tr("Remove page guides");
 	UndoManager::Copy               = tr("Copy");
 	UndoManager::CopyPage           = tr("Copy page");
 	UndoManager::MovePage           = tr("Move page");
@@ -1021,6 +1037,7 @@
 	UndoManager::ClearImage         = tr("Clear image frame content");
 	UndoManager::PathOperation		= tr("Path Operation");
 	UndoManager::ChangePageAttrs    = tr("Change Page Attributes");
+	UndoManager::Transform          = tr("Transform");
 }
 
 void UndoManager::initIcons()
@@ -1083,6 +1100,7 @@
 QString UndoManager::DelHGuide          = "";
 QString UndoManager::DelVAGuide         = "";
 QString UndoManager::DelHAGuide         = "";
+QString UndoManager::Mode               = "";
 QString UndoManager::MoveVGuide         = "";
 QString UndoManager::MoveHGuide         = "";
 QString UndoManager::UniteItem          = "";
@@ -1094,6 +1112,12 @@
 QString UndoManager::ActionPDF          = "";
 QString UndoManager::Move               = "";
 QString UndoManager::NewMasterPage      = "";
+QString UndoManager::GradType           = "";
+QString UndoManager::GradPos            = "";
+QString UndoManager::GradVal            = "";
+QString UndoManager::GradValStroke      = "";
+QString UndoManager::GradCol            = "";
+QString UndoManager::GradTypeStroke     = "";
 QString UndoManager::ImportMasterPage   = "";
 QString UndoManager::DuplicateMasterPage= "";
 QString UndoManager::DelMasterPage      = "";
@@ -1104,6 +1128,9 @@
 QString UndoManager::ImageScale         = "";
 QString UndoManager::ResTyp             = "";
 QString UndoManager::ShowImage          = "";
+QString UndoManager::RemoveMeshPatch    = "";
+QString UndoManager::StartArrowScale    = "";
+QString UndoManager::EndArrowScale      = "";
 QString UndoManager::ImageOffsetFromTo  = "";
 QString UndoManager::ImageScaleFromTo   = "";
 QString UndoManager::ResizeFromTo       = "";
@@ -1176,6 +1203,7 @@
 QString UndoManager::TextFrame          = "";
 QString UndoManager::LatexFrame         = "";
 QString UndoManager::Polygon            = "";
+QString UndoManager::EditPolygon        = "";
 QString UndoManager::BezierCurve        = "";
 QString UndoManager::Polyline           = "";
 QString UndoManager::PathText           = "";
@@ -1191,6 +1219,8 @@
 QString UndoManager::ScratchSpace       = "";
 QString UndoManager::ObjectFrame        = "";
 QString UndoManager::BoundingBox        = "";
+QString UndoManager::MeshGradient       = "";
+QString UndoManager::ChangeMeshGradient = "";
 QString UndoManager::ContourLine        = "";
 QString UndoManager::ImageClip          = "";
 QString UndoManager::NoTextFlow         = "";
@@ -1207,6 +1237,7 @@
 QString UndoManager::EditShape          = "";
 QString UndoManager::ChangeShapeType    = "";
 QString UndoManager::ResetContourLine   = "";
+QString UndoManager::GradTypeMask       = "";
 QString UndoManager::AddPage            = "";
 QString UndoManager::AddPages           = "";
 QString UndoManager::DeleteText         = "";
@@ -1237,6 +1268,7 @@
 QString UndoManager::SetLayerUnlocked   = "";
 QString UndoManager::GetImage           = "";
 QString UndoManager::ChangeFormula      = "";
+QString UndoManager::Duplicate          = "";
 QString UndoManager::MultipleDuplicate  = "";
 QString UndoManager::ApplyTextStyle     = "";
 QString UndoManager::RemoveTextStyle    = "";
@@ -1264,6 +1296,7 @@
 QString UndoManager::ClearImage         = "";
 QString UndoManager::PathOperation      = "";
 QString UndoManager::ChangePageAttrs    = "";
+QString UndoManager::Transform          = "";
 
 /*** Icons for UndoObjects *******************************************/
 QPixmap *UndoManager::IImageFrame      = 0;

Modified: trunk/Scribus/scribus/undomanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17709&path=/trunk/Scribus/scribus/undomanager.h
==============================================================================
--- trunk/Scribus/scribus/undomanager.h (original)
+++ trunk/Scribus/scribus/undomanager.h Thu Jul 12 20:32:18 2012
@@ -75,7 +75,7 @@
 	~TransactionState();
 	/** @brief To know if the state is a Transaction */
 	bool isTransaction(){return true;};
-	
+
 	/**
 	 * @brief Add a new <code>UndoState</code> object to the transaction.
 	 * @param state state to be added to the transaction
@@ -501,6 +501,7 @@
 	static QString Delete;
 	static QString Rename;
 	static QString FromTo;
+	static QString Mode;
 	static QString ApplyMasterPage;
 	static QString Paste;
 	static QString Cut;
@@ -537,6 +538,7 @@
 	static QString LatexFrame;
 	static QString ResTyp;
 	static QString Polygon;
+	static QString EditPolygon;
 	static QString BezierCurve;
 	static QString ShowImage;
 	static QString Polyline;
@@ -598,11 +600,25 @@
 	static QString DisableFlowLayer;
 	static QString SetLayerBlendMode;
 	static QString SetLayerTransparency;
+	static QString MeshGradient;
+	static QString ChangeMeshGradient;
 	static QString SetLayerLocked;
 	static QString SetLayerUnlocked;
+	static QString RemoveMeshPatch;
+	static QString StartArrowScale;
+	static QString EndArrowScale;
 	static QString GetImage;
 	static QString ChangeFormula;
+	static QString GradType;
+	static QString GradTypeMask;
+	static QString GradPos;
+	static QString GradVal;
+	static QString GradValStroke;
+	static QString GradCol;
+	static QString GradTypeStroke;
 	static QString MultipleDuplicate;
+	static QString Duplicate;
+	static QString Transform;
 	static QString ApplyTextStyle;
 	static QString RemoveTextStyle;
 	static QString Columns;




More information about the scribus-commit mailing list