r14399 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:28 CET 2009
Revision: 14399
Author: jghali
Date: 2009-12-11T14:57:00.584015Z
Commit message: #8627: convert to outline then to image frames, click undo - page content disappears
Changeset:
M /branches/Version135/Scribus/scribus/pageitem.cpp
M /branches/Version135/Scribus/scribus/pageitem.h
M /branches/Version135/Scribus/scribus/scribusdoc.cpp
Diffs:
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp (revision 14398)
+++ scribus/pageitem.cpp (revision 14399)
@@ -2727,6 +2727,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())
@@ -3191,6 +3203,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"))
@@ -3626,6 +3640,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 =
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 14398)
+++ scribus/scribusdoc.cpp (revision 14399)
@@ -4614,7 +4614,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 14398)
+++ scribus/pageitem.h (revision 14399)
@@ -518,7 +518,7 @@
bool isSingleSel;
bool isGroupControl;
PageItem *groupsLastItem;
- void setGroupsLastItem(PageItem* lnk) { groupsLastItem = lnk; }
+ void setGroupsLastItem(PageItem* item);
double BoundingX;
double BoundingY;
double BoundingW;
@@ -1046,6 +1046,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);
More information about the scribus-commit
mailing list