r14400 by jghali - #8627: convert to outline then to image frames, click undo - page content disappears

scribus-commit scribus-commit at lists.scribus.net
Sat Dec 12 02:55:52 CET 2009


Revision: 14400
Author: jghali
Date: 2009-12-11T14:57:37.884945Z
Commit message: #8627: convert to outline then to image frames, click undo - page content disappears

Changeset: 
M  /trunk/Scribus/scribus/pageitem.cpp
M  /trunk/Scribus/scribus/pageitem.h
M  /trunk/Scribus/scribus/scribusdoc.cpp

Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 14399)
+++ scribus/scribusdoc.cpp	(revision 14400)
@@ -4683,7 +4683,11 @@
 			if (currItem->isGroupControl)
 			{
 				if (currItem->groupsLastItem == oldItem)
-					currItem->groupsLastItem = newItem;
+				{
+					if (UndoManager::undoEnabled() && !transactionConversion)
+						transactionConversion = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::ConvertTo, "", Um::IGroup));
+					currItem->setGroupsLastItem(newItem);
+				}
 			}
 		}
 	}
Index: scribus/pageitem.h
===================================================================
--- scribus/pageitem.h	(revision 14399)
+++ scribus/pageitem.h	(revision 14400)
@@ -537,7 +537,7 @@
 	bool isSingleSel;
 	bool isGroupControl;
 	PageItem *groupsLastItem;
-	void setGroupsLastItem(PageItem* lnk) { groupsLastItem = lnk; }
+	void setGroupsLastItem(PageItem* item);
 	double BoundingX;
 	double BoundingY;
 	double BoundingW;
@@ -1129,6 +1129,7 @@
 	void restoreShapeType(SimpleState *state, bool isUndo);
 	void restoreLayer(SimpleState *state, bool isUndo);
 	void restoreGetImage(SimpleState *state, bool isUndo);
+	void restoreGroupsLastItem(SimpleState *state, bool isUndo);
 
 	void restoreShapeContour(UndoState *state, bool isUndo);
 	void restoreImageEffects(UndoState *state, bool isUndo);
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp	(revision 14399)
+++ scribus/pageitem.cpp	(revision 14400)
@@ -3210,6 +3210,18 @@
 		toggleLock();
 }
 
+void PageItem::setGroupsLastItem(PageItem* item)
+{
+	if (UndoManager::undoEnabled())
+	{
+		ItemState<std::pair<PageItem*, PageItem*> > *is = new ItemState<std::pair<PageItem*, PageItem*> >("GroupsLastItem");
+		is->set("GROUPS_LASTITEM", "groups_lastitem");
+		is->setItem(std::pair<PageItem*, PageItem*>(this->groupsLastItem, item));
+		undoManager->action(this, is);
+	}
+	groupsLastItem = item;
+}
+
 void PageItem::toggleSizeLock()
 {
 	if (UndoManager::undoEnabled())
@@ -3674,6 +3686,8 @@
 			restoreLayer(ss, isUndo);
 		else if (ss->contains("GET_IMAGE"))
 			restoreGetImage(ss, isUndo);
+		else if (ss->contains("GROUPS_LASTITEM"))
+			restoreGroupsLastItem(ss, isUndo);
 		else if (ss->contains("EDIT_SHAPE_OR_CONTOUR"))
 			restoreShapeContour(ss, isUndo);
 		else if (ss->contains("APPLY_IMAGE_EFFECTS"))
@@ -4109,6 +4123,18 @@
 		loadImage(fn, false);
 }
 
+void PageItem::restoreGroupsLastItem(SimpleState *state, bool isUndo)
+{
+	ItemState<std::pair<PageItem*, PageItem*> > *is = dynamic_cast<ItemState<std::pair<PageItem*, PageItem*> > *>(state);
+	if (is)
+	{
+		if (isUndo)
+			this->groupsLastItem = is->getItem().first;
+		else
+			this->groupsLastItem = is->getItem().second;
+	}
+}
+
 void PageItem::restoreShapeContour(UndoState *state, bool isUndo)
 {
 	ItemState<QPair<FPointArray,FPointArray> > *istate =




More information about the scribus-commit mailing list