r17640 by craig - #10800: Apply gsoc2012ux patch for #5210, #4718, #6220, #9893, #4820, #5173, #5075, #10269, #10685

scribus-commit scribus-commit at lists.scribus.net
Tue Jun 26 20:01:39 UTC 2012


Author: craig
Date: Tue Jun 26 20:01:39 2012
New Revision: 17640

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17640
Log:
#10800: Apply gsoc2012ux patch for #5210,#4718,#6220,#9893,#4820,#5173,#5075,#10269,#10685

Modified:
    trunk/Scribus/scribus/canvasmode_nodeedit.cpp
    trunk/Scribus/scribus/loadsaveplugin.cpp
    trunk/Scribus/scribus/loadsaveplugin.h
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem.h
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    trunk/Scribus/scribus/scpage.cpp
    trunk/Scribus/scribus/scpage.h
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h
    trunk/Scribus/scribus/scribusview.cpp
    trunk/Scribus/scribus/ui/delpages.cpp
    trunk/Scribus/scribus/ui/masterpagepalette.cpp
    trunk/Scribus/scribus/ui/masterpagepalette.h
    trunk/Scribus/scribus/ui/mergedoc.cpp
    trunk/Scribus/scribus/ui/prefs_documentsetupbase.ui
    trunk/Scribus/scribus/undomanager.cpp
    trunk/Scribus/scribus/undomanager.h

Modified: trunk/Scribus/scribus/canvasmode_nodeedit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/canvasmode_nodeedit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_nodeedit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_nodeedit.cpp Tue Jun 26 20:01:39 2012
@@ -1127,7 +1127,56 @@
 						npf = npf.transformPoint(p, false);
 					}
 				}
+
+				//Control Modifier to have parallele shape
+				if (m->modifiers() == Qt::ControlModifier){
+					FPointArray cli;
+					if (m_doc->nodeEdit.isContourLine)
+						cli = currItem->ContourLine;
+					else
+						cli = currItem->PoLine;
+					FPoint npf1(npf);
+					int tmpNode;
+					int curr = (m_doc->nodeEdit.ClRe==0)?cli.size()-2:m_doc->nodeEdit.ClRe;
+					int prev = (curr+cli.size()-4)%cli.size();
+					int next = (curr+4)%cli.size();
+
+					if(abs(cli.point(prev).x()-cli.point(curr).x())<abs(cli.point(next).x()-cli.point(curr).x()))
+						tmpNode=next;
+					else if(abs(cli.point(prev).x()-cli.point(curr).x())==abs(cli.point(next).x()-cli.point(curr).x())){
+						if(cli.point(prev).y()!=cli.point(curr).y())
+							tmpNode=next;
+						else
+							tmpNode=prev;
+					}
+					else
+						tmpNode=prev;
+
+					m_doc->nodeEdit.moveClipPoint(currItem, npf);
+
+					m_doc->nodeEdit.ClRe=tmpNode;
+
+					if (m_doc->nodeEdit.isContourLine)
+						npf1.setX(currItem->ContourLine.point(m_doc->nodeEdit.ClRe).x());
+					else
+						npf1.setX(currItem->PoLine.point(m_doc->nodeEdit.ClRe).x());
+
+					m_doc->nodeEdit.moveClipPoint(currItem, npf1);
+
+					if(m_doc->nodeEdit.ClRe==prev)
+						m_doc->nodeEdit.ClRe=next;
+					else
+						m_doc->nodeEdit.ClRe=prev;
+
+					if (m_doc->nodeEdit.isContourLine)
+						npf.setY(currItem->ContourLine.point(m_doc->nodeEdit.ClRe).y());
+					else
+						npf.setY(currItem->PoLine.point(m_doc->nodeEdit.ClRe).y());
+
+
+				}
 				m_doc->nodeEdit.moveClipPoint(currItem, npf);
+
 				m_canvas->displayXYHUD(m->globalPos(), npf.x(), npf.y());
 			}
 			else

Modified: trunk/Scribus/scribus/loadsaveplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/loadsaveplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/loadsaveplugin.cpp (original)
+++ trunk/Scribus/scribus/loadsaveplugin.cpp Tue Jun 26 20:01:39 2012
@@ -21,7 +21,8 @@
 	m_View(0),
 	m_ScMW(0),
 	m_mwProgressBar(0),
-	m_AvailableFonts(0)
+	m_AvailableFonts(0),
+	undoManager(UndoManager::instance())
 {
 }
 

Modified: trunk/Scribus/scribus/loadsaveplugin.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/loadsaveplugin.h
==============================================================================
--- trunk/Scribus/scribus/loadsaveplugin.h (original)
+++ trunk/Scribus/scribus/loadsaveplugin.h Tue Jun 26 20:01:39 2012
@@ -22,6 +22,7 @@
 class ScribusView;
 #include "scfonts.h"
 #include "scribusdoc.h"
+#include "undomanager.h"
 
 /*!
  * @brief Superclass for all file import/export/load/save plugins
@@ -141,6 +142,7 @@
 		QProgressBar*      m_mwProgressBar;
 		SCFonts*           m_AvailableFonts;
 		QString            m_lastSavedFile;
+		UndoManager * const undoManager;
 
 	private:
 		// A list of all supported formats. This is maintained by plugins

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Tue Jun 26 20:01:39 2012
@@ -4428,6 +4428,10 @@
 			restoreContourLine(ss, isUndo);
 		else if (ss->contains("CHANGE_SHAPE_TYPE"))
 			restoreShapeType(ss, isUndo);
+		else if (ss->contains("UNITEITEM"))
+			restoreUniteItem(ss, isUndo);
+		else if (ss->contains("SPLITITEM"))
+			restoreSplitItem(ss, isUndo);
 		else if (ss->contains("MIRROR_PATH_H"))
 		{
 			bool editContour = m_Doc->nodeEdit.isContourLine;
@@ -4917,6 +4921,55 @@
 	}
 	view->TransformPoly(mode, rot, scaling);
 	m_Doc->nodeEdit.isContourLine = editContour;
+}
+
+void PageItem::restoreUniteItem(SimpleState *state, bool isUndo)
+{
+	ScItemState< QPair<QList<PageItem*>,QList<QTransform> > > *is = dynamic_cast<ScItemState< QPair<QList<PageItem*>,QList<QTransform> > >*>(state);
+	if (is)
+	{
+		if (isUndo){
+			int pts = 0;
+			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;
+			}
+			PoLine.resize(PoLine.size()-pts);
+			Segments.clear();
+			Frame = is->getBool("FRAME");
+			FrameType = is->getInt("FRAMETYPE");
+			ClipEdited = is->getBool("CLIPEDITED");
+			m_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();
+		}
+	}
+}
+
+void PageItem::restoreSplitItem(SimpleState *state, bool isUndo)
+{
+	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();
+		}
+	}
 }
 
 void PageItem::restoreContourLine(SimpleState *state, bool isUndo)
@@ -7184,8 +7237,8 @@
 				OldH2 = height();
 				ContourLine = PoLine.copy();
 			}
-			if ((OldB2 == 0) || (OldH2 == 0) || (width() == 0) || (height() == 0))
-				return;
+			OldB2 = (OldB2==0)?1:OldB2;
+			OldH2 = (OldH2==0)?1:OldH2;
 			double scx = width() / OldB2;
 			double scy = height() / OldH2;
 			QTransform ma;

Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Tue Jun 26 20:01:39 2012
@@ -1236,6 +1236,8 @@
 	void restoreClearImage(UndoState *state, bool isUndo);
 	void restoreGetImage(UndoState *state, bool isUndo);
 	void restorePoly(SimpleState *state, bool isUndo, bool isContour);
+	void restoreUniteItem(SimpleState *state, bool isUndo);
+	void restoreSplitItem(SimpleState *state, bool isUndo);
 	void restoreContourLine(SimpleState *state, bool isUndo);
 	void restoreShapeType(SimpleState *state, bool isUndo);
 	void restoreLayer(SimpleState *state, bool isUndo);

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Tue Jun 26 20:01:39 2012
@@ -4190,7 +4190,6 @@
 		break;
 	}
 
-	UndoManager::instance()->setUndoEnabled(false);
 	currItem->FrameType = attrs.valueAsInt("FRTYPE", 0);
 	int startArrowIndex = attrs.valueAsInt("startArrowIndex", 0);
 	if ((startArrowIndex < 0) || (startArrowIndex > static_cast<int>(doc->arrowStyles().size())))
@@ -4783,7 +4782,6 @@
 
 	//currItem->setRedrawBounding();
 	//currItem->OwnPage = view->OnPage(currItem);
-	UndoManager::instance()->setUndoEnabled(true);
 	return currItem;
 }
 
@@ -5136,7 +5134,6 @@
 
 	ScPage* newPage = NULL;
 	
-	QString tmp;
 	QMap<int,PageItem*> TableID;
 	QList<PageItem*> TableItems;
 	QMap<int,PageItem*> WeldID;
@@ -5280,10 +5277,37 @@
 				continue;
 			a = m_Doc->currentPage()->pageNr();
 			newPage = m_Doc->Pages->at(a);
+			SimpleState *ss = NULL;
+			if (UndoManager::undoEnabled())
+			{
+				ss = new SimpleState(Um::ChangePageAttrs, "", Um::ICreate);
+				ss->set("PAGE_ATTRS", "page_attrs");
+				ss->set("LEFT_OLD", newPage->LeftPg);
+				ss->set("NAME_OLD", newPage->pageName());
+				ss->set("ORIENTATION_OLD", newPage->orientation());
+				ss->set("SIZE_OLD", newPage->m_pageSize);
+				ss->set("WIDTH_OLD", newPage->width());
+				ss->set("HEIGHT_OLD", newPage->height());
+				ss->set("INIT_HEIGHT_OLD", newPage->initialHeight());
+				ss->set("INIT_WIDTH_OLD", newPage->initialWidth());
+				ss->set("INIT_MARGINTOP_OLD", newPage->initialMargins.Top);
+				ss->set("INIT_MARGINBOTTOM_OLD", newPage->initialMargins.Bottom);
+				ss->set("INIT_MARGINRIGHT_OLD", newPage->initialMargins.Right);
+				ss->set("INIT_MARGINLEFT_OLD", newPage->initialMargins.Left);
+				ss->set("MARGINTOP_OLD", newPage->Margins.Top);
+				ss->set("MARGINBOTTOM_OLD", newPage->Margins.Bottom);
+				ss->set("MARGINPRESET_OLD", newPage->marginPreset);
+				ss->set("HORIZONTAL_AUTOGAP_OLD", newPage->guides.horizontalAutoGap());
+				ss->set("VERTICAL_AUTOGAP_OLD", newPage->guides.verticalAutoGap());
+				ss->set("HORIZONTAL_AUTOCOUNT_OLD", newPage->guides.horizontalAutoCount());
+				ss->set("VERTICAL_AUTOCOUNT_OLD", newPage->guides.verticalAutoCount());
+				ss->set("HORIZONTAL_AUTOREFER_OLD", newPage->guides.horizontalAutoRefer());
+				ss->set("VERTICAL_AUTOREFER_OLD", newPage->guides.verticalAutoRefer());
+			}
 			if (Mpage)
 			{
 				newPage->LeftPg = attrs.valueAsInt("LEFT", 0);
-				
+
 				if (!renamedPageName.isEmpty())
 					newPage->setPageName(renamedPageName);
 				else
@@ -5309,8 +5333,8 @@
 			newPage->Margins.Bottom = newPage->initialMargins.Bottom;
 			pageX = attrs.valueAsDouble( attrs.valueAsString("PAGEXPOS"));
 			pageY = attrs.valueAsDouble( attrs.valueAsString("PAGEYPOS"));
+
 			// guides reading
-			tmp = "";
 			newPage->guides.setHorizontalAutoGap(attrs.valueAsDouble("AGhorizontalAutoGap", 0.0));
 			newPage->guides.setVerticalAutoGap(attrs.valueAsDouble("AGverticalAutoGap", 0.0));
 			newPage->guides.setHorizontalAutoCount(attrs.valueAsInt("AGhorizontalAutoCount", 0));
@@ -5329,6 +5353,31 @@
 
 			newPage->guides.addHorizontals(newPage->guides.getAutoHorizontals(newPage), GuideManagerCore::Auto);
 			newPage->guides.addVerticals(newPage->guides.getAutoVerticals(newPage), GuideManagerCore::Auto);
+			if (UndoManager::undoEnabled())
+			{
+				ss->set("LEFT", newPage->LeftPg);
+				ss->set("NAME", newPage->pageName());
+				ss->set("ORIENTATION", newPage->orientation());
+				ss->set("SIZE", newPage->m_pageSize);
+				ss->set("WIDTH", newPage->width());
+				ss->set("HEIGHT", newPage->height());
+				ss->set("INIT_HEIGHT", newPage->initialHeight());
+				ss->set("INIT_WIDTH", newPage->initialWidth());
+				ss->set("INIT_MARGINTOP", newPage->initialMargins.Top);
+				ss->set("INIT_MARGINBOTTOM", newPage->initialMargins.Bottom);
+				ss->set("INIT_MARGINRIGHT", newPage->initialMargins.Right);
+				ss->set("INIT_MARGINLEFT", newPage->initialMargins.Left);
+				ss->set("MARGINTOP", newPage->Margins.Top);
+				ss->set("MARGINBOTTOM", newPage->Margins.Bottom);
+				ss->set("MARGINPRESET", newPage->marginPreset);
+				ss->set("HORIZONTAL_AUTOGAP", newPage->guides.horizontalAutoGap());
+				ss->set("VERTICAL_AUTOGAP", newPage->guides.verticalAutoGap());
+				ss->set("HORIZONTAL_AUTOCOUNT", newPage->guides.horizontalAutoCount());
+				ss->set("VERTICAL_AUTOCOUNT", newPage->guides.verticalAutoCount());
+				ss->set("HORIZONTAL_AUTOREFER", newPage->guides.horizontalAutoRefer());
+				ss->set("VERTICAL_AUTOREFER", newPage->guides.verticalAutoRefer());
+				undoManager->action(newPage, ss);
+			}
 		}
 		if ((tagName == "PAGEOBJECT") || (tagName == "MASTEROBJECT") || (tagName == "FRAMEOBJECT"))
 		{

Modified: trunk/Scribus/scribus/scpage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/scpage.cpp
==============================================================================
--- trunk/Scribus/scribus/scpage.cpp (original)
+++ trunk/Scribus/scribus/scpage.cpp Tue Jun 26 20:01:39 2012
@@ -205,6 +205,103 @@
 			restorePageItemDeletion(dynamic_cast<ScItemState< QList<PageItem*> >*>(ss), isUndo);
 		else if (ss->contains("CONVERT_ITEM"))
 			restorePageItemConversion(dynamic_cast<ScItemState<std::pair<PageItem*, PageItem*> >*>(ss), isUndo);
+		else if (ss->contains("PAGE_ATTRS"))
+			restorePageAttributes(ss, isUndo);
+	}
+}
+
+void ScPage::restorePageAttributes(SimpleState *state, bool isUndo)
+{
+	int left_old = state->getInt("LEFT_OLD");
+	QString name_old = state->get("NAME_OLD");
+	int orientation_old = state->getInt("ORIENTATION_OLD");
+	QString size_old =state->get("SIZE_OLD");
+	double width_old = state->getDouble("WIDTH_OLD");
+	double height_old = state->getDouble("HEIGHT_OLD");
+	double init_height_old = state->getDouble("INIT_HEIGHT_OLD");
+	double init_width_old = state->getDouble("INIT_WIDTH_OLD");
+	double init_margin_top_old = state->getDouble("INIT_MARGINTOP_OLD");
+	double init_margin_bottom_old = state->getDouble("INIT_MARGINBOTTOM_OLD");
+	double init_margin_right_old = state->getDouble("INIT_MARGINRIGHT_OLD");
+	double init_margin_left_old = state->getDouble("INIT_MARGINLEFT_OLD");
+	double margin_top_old = state->getDouble("MARGINTOP_OLD");
+	double margin_bottom_old = state->getDouble("MARGINBOTTOM_OLD");
+	int margin_preset_old = state->getInt("MARGINPRESET_OLD");
+	int left = state->getInt("LEFT");
+	QString name = state->get("NAME");
+	int orientation = state->getInt("ORIENTATION");
+	QString size =state->get("SIZE");
+	double width = state->getDouble("WIDTH");
+	double height = state->getDouble("HEIGHT");
+	double init_height = state->getDouble("INIT_HEIGHT");
+	double init_width = state->getDouble("INIT_WIDTH");
+	double init_margin_top = state->getDouble("INIT_MARGINTOP");
+	double init_margin_bottom = state->getDouble("INIT_MARGINBOTTOM");
+	double init_margin_right = state->getDouble("INIT_MARGINRIGHT");
+	double init_margin_left = state->getDouble("INIT_MARGINLEFT");
+	double margin_top = state->getDouble("MARGINTOP");
+	double margin_bottom = state->getDouble("MARGINBOTTOM");
+	int margin_preset = state->getInt("MARGINPRESET");
+	double horizontal_autogap_old = state->getDouble("HORIZONTAL_AUTOGAP");
+	double vertical_autogap_old = state->getDouble("VERTICAL_AUTOGAP");
+	double horizontal_autocount_old = state->getDouble("HORIZONTAL_AUTOCOUNT");
+	double vertical_autocount_old = state->getDouble("VERTICAL_AUTOCOUNT");
+	double horizontal_autorefer_old = state->getDouble("HORIZONTAL_AUTOREFER");
+	double vertical_autorefer_old = state->getDouble("VERTICAL_AUTOREFER");
+	double horizontal_autogap = state->getDouble("HORIZONTAL_AUTOGAP");
+	double vertical_autogap = state->getDouble("VERTICAL_AUTOGAP");
+	double horizontal_autocount = state->getDouble("HORIZONTAL_AUTOCOUNT");
+	double vertical_autocount = state->getDouble("VERTICAL_AUTOCOUNT");
+	double horizontal_autorefer = state->getDouble("HORIZONTAL_AUTOREFER");
+	double vertical_autorefer = state->getDouble("VERTICAL_AUTOREFER");
+
+	if (isUndo)
+	{
+		this->LeftPg = left_old;
+		this->setPageName(name_old);
+		this->m_pageSize = size_old;
+		this->setOrientation(orientation_old);
+		this->setWidth(width_old);
+		this->setHeight(height_old);
+		this->setInitialHeight(init_height_old);
+		this->setInitialWidth(init_width_old);
+		this->initialMargins.Top    = init_margin_top_old;
+		this->initialMargins.Bottom = init_margin_bottom_old;
+		this->initialMargins.Left   = init_margin_left_old;
+		this->initialMargins.Right  = init_margin_right_old;
+		this->marginPreset = margin_preset_old;
+		this->Margins.Top = margin_top_old;
+		this->Margins.Bottom = margin_bottom_old;
+		this->guides.setHorizontalAutoGap(horizontal_autogap_old);
+		this->guides.setVerticalAutoGap(vertical_autogap_old);
+		this->guides.setHorizontalAutoCount(horizontal_autocount_old);
+		this->guides.setVerticalAutoCount(vertical_autocount_old);
+		this->guides.setHorizontalAutoRefer(horizontal_autorefer_old);
+		this->guides.setVerticalAutoRefer(vertical_autorefer_old);
+	}
+	else
+	{
+		this->LeftPg = left;
+		this->setPageName(name);
+		this->m_pageSize = size;
+		this->setOrientation(orientation);
+		this->setWidth(width);
+		this->setHeight(height);
+		this->setInitialHeight(init_height);
+		this->setInitialWidth(init_width);
+		this->initialMargins.Top    = init_margin_top;
+		this->initialMargins.Bottom = init_margin_bottom;
+		this->initialMargins.Left   = init_margin_left;
+		this->initialMargins.Right  = init_margin_right;
+		this->marginPreset = margin_preset;
+		this->Margins.Top = margin_top;
+		this->Margins.Bottom = margin_bottom;
+		this->guides.setHorizontalAutoGap(horizontal_autogap);
+		this->guides.setVerticalAutoGap(vertical_autogap);
+		this->guides.setHorizontalAutoCount(horizontal_autocount);
+		this->guides.setVerticalAutoCount(vertical_autocount);
+		this->guides.setHorizontalAutoRefer(horizontal_autorefer);
+		this->guides.setVerticalAutoRefer(vertical_autorefer);
 	}
 }
 
@@ -241,6 +338,7 @@
 		if ((stateCode == 0) || (stateCode == 1))
 			m_Doc->view()->Deselect(true);
 		m_Doc->Items->append(ite);
+		ite->OwnPage = m_Doc->OnPage(ite);
 		if ((stateCode == 0) || (stateCode == 2))
 			update();
 	}
@@ -254,6 +352,7 @@
 		return;
 	QList<PageItem*> itemList = state->getItem();
 	int id = state->getInt("ITEMID");
+	int id2 = state->getInt("ID");
 	if (itemList.count() <= 0) 
 		return;
 	m_Doc->view()->Deselect(true);
@@ -265,27 +364,26 @@
 	if (isUndo)
 	{
 		//CB #3373 reinsert at old position and renumber items
+		PageItem* ite = itemList.at(id2);
+		m_Doc->Items->insert(id, ite);
 		for (int i = 0; i < itemList.count(); ++i)
 		{
 			PageItem* ite = itemList.at(i);
-			m_Doc->Items->insert(id, ite);
+			m_Doc->view()->SelectItem(ite);
 		}
  		update();
 	}
 	else
 	{
 		Selection tmpSelection(m_Doc, false);
-		for (int i = 0; i < itemList.count(); ++i)
-		{
-			PageItem* ite = itemList.at(i);
-			if (m_Doc->m_Selection->findItem(ite)!=-1)
-			{
-				if (m_Doc->appMode == modeEdit)
-					m_Doc->view()->requestMode(modeNormal);
-				m_Doc->m_Selection->removeItem(ite);
-			}
-			tmpSelection.addItem(ite);
-		}
+		PageItem* ite = itemList.at(id2);
+		if (m_Doc->m_Selection->findItem(ite)!=-1)
+		{
+			if (m_Doc->appMode == modeEdit)
+				m_Doc->view()->requestMode(modeNormal);
+			m_Doc->m_Selection->removeItem(ite);
+		}
+		tmpSelection.addItem(ite);
 		m_Doc->itemSelection_DeleteItem(&tmpSelection);
 	}
 	m_Doc->m_Selection->delaySignalsOff();

Modified: trunk/Scribus/scribus/scpage.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/scpage.h
==============================================================================
--- trunk/Scribus/scribus/scpage.h (original)
+++ trunk/Scribus/scribus/scpage.h Tue Jun 26 20:01:39 2012
@@ -102,6 +102,7 @@
 	UndoManager * const undoManager;
 	void restorePageItemCreation(ScItemState<PageItem*> *state, bool isUndo);
 	void restorePageItemDeletion(ScItemState< QList<PageItem*> > *state, bool isUndo);
+	void restorePageAttributes(SimpleState *state, bool isUndo);
 	void restorePageItemConversion(ScItemState<std::pair<PageItem*, PageItem*> >*state, bool isUndo);
 	
 	double m_xOffset;

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Tue Jun 26 20:01:39 2012
@@ -3597,6 +3597,10 @@
 	Q_ASSERT(!doc->masterPageMode());
 	bool ret = false;
 	MergeDoc *dia = new MergeDoc(this, false, doc->DocPages.count(), doc->currentPage()->pageNr() + 1);
+	UndoTransaction* activeTransaction = NULL;
+	if(UndoManager::undoEnabled())
+		activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::ImportPage, Um::IGroup, Um::ImportPage, 0, Um::ILock));
+
 	if (dia->exec())
 	{
 		mainWindowStatusLabel->setText( tr("Importing Pages..."));
@@ -3680,6 +3684,12 @@
 		}
 		qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
 		ret = doIt;
+	}
+	if (activeTransaction)
+	{
+		activeTransaction->commit();
+		delete activeTransaction;
+		activeTransaction = NULL;
 	}
 	delete dia;
 	return ret;

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Tue Jun 26 20:01:39 2012
@@ -40,6 +40,7 @@
 #include <qtconcurrentmap.h>
 
 #include "canvas.h"
+#include "ui/masterpagepalette.h"
 #include "colorblind.h"
 #include "commonstrings.h"
 #include "desaxe/digester.h"
@@ -48,6 +49,7 @@
 #include "filewatcher.h"
 #include "fpoint.h"
 #include "ui/guidemanager.h"
+#include "ui/outlinepalette.h"
 #include "hyphenator.h"
 #include "ui/inserttablecolumnsdialog.h"
 #include "ui/inserttablerowsdialog.h"
@@ -1758,10 +1760,20 @@
 		}
 		else if (ss->contains("OLD_MASTERPAGE"))
 			restoreMasterPageApplying(ss, isUndo);
+		else if (ss->contains("MASTERPAGE_ADD"))
+			restoreAddMasterPage(ss, isUndo);
 		else if (ss->contains("PAGE_COPY"))
 			restoreCopyPage(ss, isUndo);
 		else if (ss->contains("PAGE_MOVE"))
 			restoreMovePage(ss, isUndo);
+		else if (ss->contains("LEVEL_DOWN"))
+			restoreLevelDown(ss,isUndo);
+		else if (ss->contains("LEVEL_UP"))
+			restoreLevelDown(ss,!isUndo);
+		else if (ss->contains("LEVEL_BOTTOM"))
+			restoreLevelBottom(ss,isUndo);
+		else if (ss->contains("LEVEL_TOP"))
+			restoreLevelBottom(ss,!isUndo);
 		else if (ss->contains("PAGE_CHANGEPROPS"))
 		{
 			if (isUndo)
@@ -1789,6 +1801,63 @@
 				m_ScMW->layerPalette->rebuildList();
 			}
 		}
+	}
+}
+
+void ScribusDoc::restoreLevelDown(SimpleState *ss, bool isUndo)
+{
+	ScItemState<QList<QPointer<PageItem> > > *is = dynamic_cast<ScItemState<QList<QPointer<PageItem> > > *>(ss);
+	QList<QPointer<PageItem> > listItem = is->getItem();
+	m_Selection->clear();
+	for(int i = 0; i<listItem.size();i++)
+		m_Selection->addItem(listItem.at(i));
+	if(isUndo)
+		itemSelection_RaiseItem();
+	else
+		itemSelection_LowerItem();
+}
+
+void ScribusDoc::restoreLevelBottom(SimpleState *ss, bool isUndo)
+{
+	ScItemState<QList<QPointer<PageItem> > > *is = dynamic_cast<ScItemState<QList<QPointer<PageItem> > > *>(ss);
+	QList<QPointer<PageItem> > listItem = is->getItem();
+	m_Selection->clear();
+	for(int i = 0; i<listItem.size();i++)
+		m_Selection->addItem(listItem.at(i));
+	if(isUndo)
+		bringItemSelectionToFront();
+	else
+		sendItemSelectionToBack();
+}
+
+void ScribusDoc::restoreAddMasterPage(SimpleState *ss, bool isUndo)
+{
+	QString pageName = ss->get("MASTERPAGE_NAME");
+	int pageNr = ss->getInt("MASTERPAGE_NR");
+
+	bool oldMPMode=masterPageMode();
+	setMasterPageMode(true);
+	if(isUndo)
+	{
+		DummyUndoObject *duo = new DummyUndoObject();
+		uint did = static_cast<uint>(duo->getUId());
+		undoManager->replaceObject(Pages->at(MasterNames[pageName])->getUId(), duo);
+		ss->set("DUMMY_ID", did);
+
+		scMW()->deletePage2(MasterNames[pageName]);
+		rebuildMasterNames();
+		scMW()->pagePalette->updateMasterPageList();
+	} 
+	else 
+	{
+		ScPage* Mpage = addMasterPage(pageNr, pageName);
+		setCurrentPage(Mpage);
+		UndoObject *tmp = undoManager->replaceObject(
+					ss->getUInt("DUMMY_ID"), Pages->at(MasterNames[pageName]));
+		delete tmp;
+		scMW()->pagePalette->updateMasterPageList();
+		m_View->reformPages();
+		setMasterPageMode(oldMPMode);
 	}
 }
 
@@ -2108,6 +2177,14 @@
 	assert(MasterPages.at(pageNumber)!=NULL);
 	if  (!isLoading())
 		changed();
+	if(UndoManager::undoEnabled())
+	{
+		SimpleState *ss = new SimpleState(Um::NewMasterPage, "", Um::IDocument);
+		ss->set("MASTERPAGE_ADD", "masterpage_add");
+		ss->set("MASTERPAGE_NAME", pageName);
+		ss->set("MASTERPAGE_NBR", pageNumber);
+		undoManager->action(this, ss);
+	}
 	return addedPage;
 }
 
@@ -4308,8 +4385,11 @@
 				--destLocation;
 		}
 	}
-	else
+	else{
 		copyPage(pnum, extPage, whereTo, copyCount);
+		if(m_ScMW->outlinePalette->isVisible())
+			m_ScMW->outlinePalette->BuildTree();
+	}
 
 }
 
@@ -6467,15 +6547,20 @@
 
 void ScribusDoc::copyPage(int pageNumberToCopy, int existingPage, int whereToInsert, int copyCount)
 {
-	UndoTransaction copyTransaction(undoManager->beginTransaction(getUName(), Um::IDocument, Um::CopyPage, "", Um::ICreate));
-	SimpleState *ss = new SimpleState(Um::Copy, "", Um::ICreate);
-	ss->set("PAGE_COPY", "copy_page");
-	ss->set("PAGE_NUM", pageNumberToCopy);
-	ss->set("EXISTING_PAGE", existingPage);
-	ss->set("WHERE_TO", whereToInsert);
-	ss->set("COPY_COUNT", copyCount);
-	undoManager->action(this, ss);
-
+	UndoTransaction *copyTransaction = NULL;
+	if(UndoManager::undoEnabled())
+	{
+		copyTransaction = new UndoTransaction(undoManager->beginTransaction(getUName(), Um::IDocument, Um::CopyPage, "", Um::ICreate));
+		SimpleState *ss = new SimpleState(Um::Copy, "", Um::ICreate);
+		ss->set("PAGE_COPY", "copy_page");
+		ss->set("PAGE_NUM", pageNumberToCopy);
+		ss->set("EXISTING_PAGE", existingPage);
+		ss->set("WHERE_TO", whereToInsert);
+		ss->set("COPY_COUNT", copyCount);
+		undoManager->action(this, ss);
+	}
+
+	undoManager->setUndoEnabled(false);
 	//CB Should we really be disabling auto text frames here?
 	bool autoText = usesAutomaticTextFrames();
 	setUsesAutomaticTextFrames(false);
@@ -6608,7 +6693,13 @@
 	else
 		setCurrentPage(from);
 	changed();
-	copyTransaction.commit();
+	undoManager->setUndoEnabled(true);
+	if(copyTransaction)
+	{
+		copyTransaction->commit();
+		delete copyTransaction;
+		copyTransaction = NULL;
+	}
 }
 
 
@@ -6837,6 +6928,13 @@
 	int docSelectionCount = m_Selection->count();
 	if (docSelectionCount == 0)
 		return;
+	if (UndoManager::undoEnabled())
+	{
+		ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(Um::LevelBottom);
+		is->set("LEVEL_BOTTOM","level_bottom");
+		is->setItem(m_Selection->selectionList());
+		undoManager->action(this, is);
+	}
 	if (docSelectionCount > 1)
 	{
 		PageItem *firstItem = m_Selection->itemAt(0);
@@ -6894,6 +6992,13 @@
 	int docSelectionCount = m_Selection->count();
 	if (docSelectionCount == 0)
 		return;
+	if (UndoManager::undoEnabled())
+	{
+		ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(Um::LevelTop);
+		is->set("LEVEL_TOP","level_top");
+		is->setItem(m_Selection->selectionList());
+		undoManager->action(this, is);
+	}
 	if (docSelectionCount > 1)
 	{
 		PageItem *firstItem = m_Selection->itemAt(0);
@@ -6951,6 +7056,13 @@
 	int docSelectionCount = m_Selection->count();
 	if (docSelectionCount == 0)
 		return;
+	if (UndoManager::undoEnabled())
+	{
+		ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(Um::LevelDown);
+		is->set("LEVEL_DOWN","level_down");
+		is->setItem(m_Selection->selectionList());
+		undoManager->action(this, is);
+	}
 	if (docSelectionCount > 1)
 	{
 		PageItem *firstItem = m_Selection->itemAt(0);
@@ -7016,6 +7128,13 @@
 	int docSelectionCount = m_Selection->count();
 	if (docSelectionCount == 0)
 		return;
+	if (UndoManager::undoEnabled())
+	{
+		ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(Um::LevelUp);
+		is->set("LEVEL_UP","level_up");
+		is->setItem(m_Selection->selectionList());
+		undoManager->action(this, is);
+	}
 	if (docSelectionCount > 1)
 	{
 		PageItem *firstItem = m_Selection->itemAt(0);
@@ -10483,6 +10602,7 @@
 			ScItemState< QList<PageItem*> > *is = new ScItemState< QList<PageItem*> >(Um::Delete + " " + currItem->getUName(), "", Um::IDelete);
 			is->setItem(delItems);
 			is->set("ITEMID", itemList->indexOf(currItem));
+			is->set("ID", selectedItemCount - (de + 1));
 			is->set("DELETE_ITEM", "delete_item");
 			undoManager->action(Pages->at(0), is, currItem->getUPixmap());
 		}
@@ -14181,15 +14301,26 @@
 {
 	PageItem *currItem;
 	PageItem *bb;
+	QList<QTransform> transform;
 	QList<PageItem *> toDel;
 	toDel.clear();
 	uint docSelectionCount = m_Selection->count();
 	if (docSelectionCount > 1)
 	{
+		UndoTransaction* transaction = NULL;
+		if (UndoManager::undoEnabled())
+		{
+			transaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::UniteItem, "", Um::IGroup));
+			transform.clear();
+		}
+		undoManager->setUndoEnabled(false);
 		currItem = m_Selection->itemAt(0);
 		if (currItem->isGroup())
 			return;
 		m_Selection->delaySignalsOn();
+		bool currFrame = currItem->Frame;
+		bool currClipEdited = currItem->ClipEdited;
+		int currFrameType = currItem->FrameType;
 		currItem->Frame = false;
 		currItem->ClipEdited = true;
 		currItem->FrameType = 3;
@@ -14200,25 +14331,46 @@
 			QTransform ma;
 			ma.translate(bb->xPos(), bb->yPos());
 			ma.rotate(bb->rotation());
-			bb->PoLine.map(ma);
 			QTransform ma2;
 			ma2.translate(currItem->xPos(), currItem->yPos());
 			ma2.rotate(currItem->rotation());
 			ma2 = ma2.inverted();
-			bb->PoLine.map(ma2);
+			ma=ma*ma2;
+			bb->PoLine.map(ma);
+			undoManager->setUndoEnabled(true);
+			if (UndoManager::undoEnabled())
+				transform.append(ma);
+			undoManager->setUndoEnabled(false);
 			currItem->PoLine.setMarker();
 			currItem->PoLine.putPoints(currItem->PoLine.size(), bb->PoLine.size(), bb->PoLine);
 		}
 //		currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
 		AdjustItemSize(currItem);
 		currItem->ContourLine = currItem->PoLine.copy();
+		undoManager->setUndoEnabled(true);
 		//FIXME: stop using m_View
+		if (UndoManager::undoEnabled())
+		{
+			ScItemState< QPair<QList<PageItem*> , QList<QTransform> > > *is = new ScItemState< QPair<QList<PageItem*> , QList<QTransform> > >(Um::UniteItem, "", Um::IGroup);
+			is->setItem(QPair<QList<PageItem*>,QList<QTransform> >(toDel,transform));
+			is->set("UNITEITEM", "uniteitem");
+			is->set("FRAME",currFrame);
+			is->set("FRAMETYPE",currFrameType);
+			is->set("CLIPEDITED",currClipEdited);
+			undoManager->action(currItem, is);
+		}
 		m_View->Deselect(true);
 		for (int c = 0; c < toDel.count(); ++c)
 			m_View->SelectItem(toDel.at(c));
 		m_Selection->delaySignalsOff();
 		itemSelection_DeleteItem();
 		regionsChanged()->update(QRectF());
+		if(transaction)
+		{
+			transaction->commit();
+			delete transaction;
+			transaction = NULL;
+		}
 	}
 }
 
@@ -14226,8 +14378,14 @@
 {
 	PageItem *bb;
 	m_Selection->delaySignalsOn();
+	UndoTransaction* transaction = NULL;
+	if (UndoManager::undoEnabled())
+		transaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::SplitItem, "", Um::IGroup));
+	undoManager->setUndoEnabled(false);
 	for (int i = 0; i < m_Selection->count(); ++i)
 	{
+		QList< int> itemsList;
+		itemsList.clear();
 		PageItem *currItem = m_Selection->itemAt(i);
 		if (!currItem->isPolygon() || currItem->Segments.count() <= 0)
 			continue;
@@ -14241,6 +14399,7 @@
 				StartInd = a + 1;
 				bb = new PageItem_Polygon(*currItem);
 				currItemNr++;
+				itemsList.append(currItemNr);
 				Items->insert(currItemNr, bb);
 				bb->convertTo(PageItem::Polygon);
 				bb->Frame = false;
@@ -14260,11 +14419,27 @@
 		AdjustItemSize(currItem);
 		currItem->ContourLine = currItem->PoLine.copy();
 		currItem->ClipEdited = true;
-	}
+		undoManager->setUndoEnabled(true);
+		if (UndoManager::undoEnabled())
+		{
+			ScItemState< QList<int> > *is = new ScItemState< QList<int> >(Um::SplitItem, "", Um::IGroup);
+			is->setItem(QList<int>(itemsList));
+			is->set("SPLITITEM", "split_item");
+			undoManager->action(currItem, is);
+		}
+		undoManager->setUndoEnabled(false);
+	}
+	undoManager->setUndoEnabled(true);
 	m_Selection->delaySignalsOff();
 	//FIXME: stop using m_View
 	m_View->Deselect(true);
 	regionsChanged()->update(QRectF());
+	if(transaction)
+	{
+		transaction->commit();
+		delete transaction;
+		transaction = NULL;
+	}
 }
 
 void ScribusDoc::itemSelection_convertItemsTo(const PageItem::ItemType newType, Selection* restoredSelection, Selection* customSelection)

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Tue Jun 26 20:01:39 2012
@@ -734,11 +734,17 @@
 	void restoreMasterPageApplying(SimpleState *state, bool isUndo);
 	void restoreCopyPage(SimpleState *state, bool isUndo);
 	void restoreMovePage(SimpleState *state, bool isUndo);
+	void restoreAddMasterPage(SimpleState *state, bool isUndo);
 	/**
 	 * @brief Undo function for grouping/ungrouping
 	 */
 	void restoreGrouping(SimpleState *state, bool isUndo);
 	void restoreUngrouping(SimpleState *state, bool isUndo);
+	/**
+	 * @brief Undo function for level
+	 */
+	void restoreLevelDown(SimpleState *state, bool isUndo);
+	void restoreLevelBottom(SimpleState *state, bool isUndo);
 	/**
 	 * @brief Save function
 	 */

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Tue Jun 26 20:01:39 2012
@@ -1382,6 +1382,7 @@
 	PageItem *currItem = Doc->m_Selection->itemAt(0);
 	currItem->ClipEdited = true;
 	QTransform ma;
+	undoManager->setUndoEnabled(false);
 	if (Doc->nodeEdit.isContourLine)
 	{
 		FPoint tp2(getMinClipF(&currItem->ContourLine));
@@ -1462,6 +1463,7 @@
 		updateContents();
 		currItem->FrameOnly = true;
 		updateContents(currItem->getRedrawBounding(m_canvas->scale()));
+		undoManager->setUndoEnabled(true);
 		if (UndoManager::undoEnabled())
 		{
 			undoManager->setUndoEnabled(false);
@@ -1566,6 +1568,7 @@
 	currItem->update();
 //	MarkClip(currItem, currItem->PoLine, true);
 	currItem->FrameType = 3;
+	undoManager->setUndoEnabled(true);
 	if (UndoManager::undoEnabled())
 	{
 		undoManager->setUndoEnabled(false);

Modified: trunk/Scribus/scribus/ui/delpages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/ui/delpages.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/delpages.cpp (original)
+++ trunk/Scribus/scribus/ui/delpages.cpp Tue Jun 26 20:01:39 2012
@@ -27,6 +27,7 @@
 	fromToLayout->addWidget( fromLabel );
 	fromPageData = new ScrSpinBox(this);
 	fromPageData->setDecimals(0);
+	fromPageData->setSuffix("");
 	fromPageData->setMinimum(1);
 	fromPageData->setMaximum(maxPage);
 	fromPageData->setSuffix("");
@@ -41,6 +42,7 @@
 	toPageData->setMaximum(maxPage);
 	toPageData->setSuffix("");
 	toPageData->setValue( currentPage );
+	toPageData->setSuffix("");
 	fromToLayout->addWidget( toPageData );
 	dialogLayout->addLayout( fromToLayout );
 

Modified: trunk/Scribus/scribus/ui/masterpagepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/ui/masterpagepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/masterpagepalette.cpp (original)
+++ trunk/Scribus/scribus/ui/masterpagepalette.cpp Tue Jun 26 20:01:39 2012
@@ -31,12 +31,14 @@
 #include "scribusview.h"
 #include "scribusXml.h"
 #include "selection.h"
+#include "undomanager.h"
 #include "util_icon.h"
 
 MasterPagesPalette::MasterPagesPalette( QWidget* parent, ScribusDoc *pCurrentDoc, ScribusView *pCurrentView, QString masterPageName) : ScrPaletteBase( parent, "MasterPages", false, 0 )
 {
 	setAttribute(Qt::WA_DeleteOnClose);
 	setModal(false);
+	undoManager = UndoManager::instance();
 	setWindowIcon(QIcon(loadIcon ( "AppIcon.png" )));
 	currentDoc = pCurrentDoc;
 	currentView = pCurrentView;
@@ -114,7 +116,9 @@
 void MasterPagesPalette::deleteMasterPage()
 {
 	bool forceDelete = false;
-
+	UndoTransaction* activeTransaction = NULL;
+	if (UndoManager::undoEnabled())
+		activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Group, Um::IGroup, Um::DelMasterPage, "", Um::IDelete));
 	// allow to delete multiple pages in one step
 	foreach (QListWidgetItem * delItem, masterPageListBox->selectedItems())
 	{
@@ -163,11 +167,20 @@
 	QMap<QString,int>::Iterator it = currentDoc->MasterNames.begin();
 	sMuster = it.key();
 	updateMasterPageList(sMuster);
+	if (activeTransaction)
+	{
+		activeTransaction->commit();
+		delete activeTransaction;
+		activeTransaction = NULL;
+	}
 }
 
 void MasterPagesPalette::duplicateMasterPage()
 {
 	int copyC = 1;
+	UndoTransaction* activeTransaction = NULL;
+	if (UndoManager::undoEnabled())
+		activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Group, Um::IGroup, Um::DuplicateMasterPage, "", Um::IGroup));
 	QString potentialMasterPageName(sMuster);
 	while (currentDoc->MasterNames.contains(potentialMasterPageName))
 		potentialMasterPageName = tr("Copy #%1 of %2").arg(copyC++).arg(sMuster);
@@ -291,12 +304,21 @@
 		currentView->reformPages();
 		currentView->DrawNew();
 	}
+	if (activeTransaction)
+	{
+		activeTransaction->commit();
+		delete activeTransaction;
+		activeTransaction = NULL;
+	}
 	delete dia;
 }
 
 void MasterPagesPalette::newMasterPage()
 {
 	QString MasterPageName;
+	UndoTransaction* activeTransaction = NULL;
+	if (UndoManager::undoEnabled())
+		activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Group, Um::IGroup, Um::NewMasterPage, "", Um::IGroup));
 	int nr = currentDoc->Pages->count();
 	NewTm *dia = new NewTm(this, tr("Name:"), tr("New MasterPage"), currentDoc, tr("New Master Page %1").arg(nr));
 	if (dia->exec())
@@ -345,11 +367,20 @@
 		selectMasterPage(MasterPageName);
 		currentView->reformPages();
 	}
+	if (activeTransaction)
+	{
+		activeTransaction->commit();
+		delete activeTransaction;
+		activeTransaction = NULL;
+	}
 	delete dia;
 }
 
 void MasterPagesPalette::importPage()
 {
+	UndoTransaction* activeTransaction = NULL;
+	if (UndoManager::undoEnabled())
+		activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Group, Um::IGroup, Um::ImportMasterPage, "", Um::IGroup));
 	//bool atf;
 	MergeDoc *dia = new MergeDoc(this, true);
 	if (dia->exec())
@@ -395,6 +426,12 @@
 		qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
 		//currentDoc->MasterPages = currentDoc->Pages;
 	}
+	if (activeTransaction)
+	{
+		activeTransaction->commit();
+		delete activeTransaction;
+		activeTransaction = NULL;
+	}
 	delete dia;
 }
 

Modified: trunk/Scribus/scribus/ui/masterpagepalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/ui/masterpagepalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/masterpagepalette.h (original)
+++ trunk/Scribus/scribus/ui/masterpagepalette.h Tue Jun 26 20:01:39 2012
@@ -8,6 +8,7 @@
 #define MUSTERPAGES_H
 
 class QCloseEvent;
+class UndoManager;
 class QHBoxLayout;
 class QListWidget;
 class QListWidgetItem;
@@ -52,6 +53,7 @@
 	QToolButton* importButton;
 	QToolButton* newButton;
 	ScribusDoc *currentDoc;
+	UndoManager *undoManager;
 	ScribusView *currentView;
 
 protected:

Modified: trunk/Scribus/scribus/ui/mergedoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/ui/mergedoc.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/mergedoc.cpp (original)
+++ trunk/Scribus/scribus/ui/mergedoc.cpp Tue Jun 26 20:01:39 2012
@@ -47,6 +47,7 @@
 	fromInfoLayout->setMargin(0);
 	fromInfoLayout->setSpacing(5);
 	fromDocData = new QLineEdit( this );
+	fromDocData->setMinimumWidth(QWidget::fontMetrics().width('a')*50);
 	fromDocLabel = new QLabel( tr( "&From Document:"), this );
 	fromDocLabel->setBuddy( fromDocData );
 	fromInfoLayout->addWidget( fromDocLabel, 0, 0 );

Modified: trunk/Scribus/scribus/ui/prefs_documentsetupbase.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/ui/prefs_documentsetupbase.ui
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_documentsetupbase.ui (original)
+++ trunk/Scribus/scribus/ui/prefs_documentsetupbase.ui Tue Jun 26 20:01:39 2012
@@ -217,7 +217,11 @@
           </widget>
          </item>
          <item row="4" column="1">
-          <widget class="QComboBox" name="layoutFirstPageIsComboBox"/>
+          <widget class="QComboBox" name="layoutFirstPageIsComboBox">
+           <property name="sizeAdjustPolicy">
+            <enum>QComboBox::AdjustToContents</enum>
+           </property>
+          </widget>
          </item>
          <item row="3" column="1">
           <widget class="QRadioButton" name="fourFoldRadioButton">
@@ -303,8 +307,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>428</width>
-            <height>525</height>
+            <width>252</width>
+            <height>206</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_5">

Modified: trunk/Scribus/scribus/undomanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/undomanager.cpp
==============================================================================
--- trunk/Scribus/scribus/undomanager.cpp (original)
+++ trunk/Scribus/scribus/undomanager.cpp Tue Jun 26 20:01:39 2012
@@ -601,6 +601,18 @@
 			tmpState->setUndoObject(newUndoObject);
 		}
 	}
+	for (uint i = 0; i < stacks_[currentDoc_].redoActions_.size(); ++i)
+	{
+		UndoState *tmpState = stacks_[currentDoc_].redoActions_[i];
+		TransactionState *ts = dynamic_cast<TransactionState*>(tmpState);
+		if (ts)
+			tmp = ts->replace(uid, newUndoObject);
+		else if (tmpState->undoObject() && tmpState->undoObject()->getUId() == uid)
+		{
+			tmp = tmpState->undoObject();
+			tmpState->setUndoObject(newUndoObject);
+		}
+	}
 	if (transaction_) // replace also in the currently open transaction
 		tmp = transaction_->replace(uid, newUndoObject);
 	return tmp;
@@ -826,6 +838,12 @@
 	UndoManager::LockGuides         = tr("Lock guides");
 	UndoManager::UnlockGuides       = tr("Unlock guides");
 	UndoManager::Move               = tr("Move");
+	UndoManager::NewMasterPage      = tr("Add master page");
+	UndoManager::DelMasterPage      = tr("Del master page");
+	UndoManager::ImportMasterPage   = tr("Import master page");
+	UndoManager::DuplicateMasterPage= tr("Duplicate master page");
+	UndoManager::UniteItem          = tr("Combine Polygons");
+	UndoManager::SplitItem          = tr("Split Polygons");
 	UndoManager::Resize             = tr("Resize");
 	UndoManager::Rotate             = tr("Rotate");
 	UndoManager::MoveFromTo         = tr("X1: %1, Y1: %2, %3\nX2: %4, Y2: %5, %6");
@@ -838,6 +856,10 @@
 	UndoManager::Group              = tr("Group");
 	UndoManager::SelectionGroup     = tr("Selection/Group");
 	UndoManager::Create             = tr("Create");
+	UndoManager::LevelUp            = tr("Level up");
+	UndoManager::LevelDown          = tr("Level up");
+	UndoManager::LevelTop           = tr("Send to bottom");
+	UndoManager::LevelBottom        = tr("Send to front");
 	UndoManager::CreateTo           = tr("X: %1, Y: %2\nW: %3, H: %4");
 	UndoManager::AlignDistribute    = tr("Align/Distribute");
 	UndoManager::ItemsInvolved      = tr("Items involved");
@@ -967,11 +989,13 @@
 	UndoManager::Copy               = tr("Copy");
 	UndoManager::CopyPage           = tr("Copy page");
 	UndoManager::MovePage           = tr("Move page");
+	UndoManager::ImportPage         = tr("Import page");
 	UndoManager::ToOutlines         = tr("Convert to outlines");
 	UndoManager::LinkTextFrame		= tr("Link text frame");
 	UndoManager::UnlinkTextFrame	= tr("Unlink text frame");
 	UndoManager::ClearImage         = tr("Clear image frame content");
 	UndoManager::PathOperation		= tr("Path Operation");
+	UndoManager::ChangePageAttrs    = tr("Change Page Attributes");
 }
 
 void UndoManager::initIcons()
@@ -1036,9 +1060,15 @@
 QString UndoManager::DelHAGuide         = "";
 QString UndoManager::MoveVGuide         = "";
 QString UndoManager::MoveHGuide         = "";
+QString UndoManager::UniteItem          = "";
+QString UndoManager::SplitItem          = "";
 QString UndoManager::LockGuides         = "";
 QString UndoManager::UnlockGuides       = "";
 QString UndoManager::Move               = "";
+QString UndoManager::NewMasterPage      = "";
+QString UndoManager::ImportMasterPage   = "";
+QString UndoManager::DuplicateMasterPage= "";
+QString UndoManager::DelMasterPage      = "";
 QString UndoManager::Resize             = "";
 QString UndoManager::Rotate             = "";
 QString UndoManager::MoveFromTo         = "";
@@ -1065,6 +1095,10 @@
 QString UndoManager::FlipH              = "";
 QString UndoManager::FlipV              = "";
 QString UndoManager::Lock               = "";
+QString UndoManager::LevelUp            = "";
+QString UndoManager::LevelTop           = "";
+QString UndoManager::LevelBottom        = "";
+QString UndoManager::LevelDown          = "";
 QString UndoManager::UnLock             = "";
 QString UndoManager::SizeLock           = "";
 QString UndoManager::SizeUnLock         = "";
@@ -1179,12 +1213,14 @@
 QString UndoManager::RemoveAllPageGuides = "";
 QString UndoManager::Copy               = "";
 QString UndoManager::CopyPage           = "";
+QString UndoManager::ImportPage         = "";
 QString UndoManager::MovePage           = "";
 QString UndoManager::ToOutlines         = "";
 QString UndoManager::LinkTextFrame      = "";
 QString UndoManager::UnlinkTextFrame    = "";
 QString UndoManager::ClearImage         = "";
 QString UndoManager::PathOperation      = "";
+QString UndoManager::ChangePageAttrs    = "";
 
 /*** Icons for UndoObjects *******************************************/
 QPixmap *UndoManager::IImageFrame      = 0;

Modified: trunk/Scribus/scribus/undomanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17640&path=/trunk/Scribus/scribus/undomanager.h
==============================================================================
--- trunk/Scribus/scribus/undomanager.h (original)
+++ trunk/Scribus/scribus/undomanager.h Tue Jun 26 20:01:39 2012
@@ -448,11 +448,17 @@
 	static QString DelHAGuide;
 	static QString MoveVGuide;
 	static QString MoveHGuide;
+	static QString UniteItem;
+	static QString SplitItem;
 	static QString RemoveAllGuides;
 	static QString RemoveAllPageGuides;
 	static QString LockGuides;
 	static QString UnlockGuides;
 	static QString Move;
+	static QString NewMasterPage;
+	static QString DelMasterPage;
+	static QString ImportMasterPage;
+	static QString DuplicateMasterPage;
 	static QString Resize;
 	static QString Rotate;
 	static QString MoveFromTo;
@@ -588,10 +594,16 @@
 	static QString ResetControlPoint;
 	static QString ResetControlPoints;
 	static QString ImageEffects;
+	static QString LevelUp;
+	static QString LevelDown;
+	static QString LevelBottom;
+	static QString LevelTop;
 	static QString InsertFrame;
 	static QString AdjustFrameToImage;
 	static QString Copy;
 	static QString CopyPage;
+	static QString ChangePageAttrs;
+	static QString ImportPage;
 	static QString MovePage;
 	static QString ToOutlines;
 	static QString LinkTextFrame;




More information about the scribus-commit mailing list