r16703 by jghali - #9894: Undoing reversing write direction
scribus-commit
scribus-commit at lists.scribus.net
Sat Jul 2 22:14:49 UTC 2011
Author: jghali
Date: Sat Jul 2 22:14:49 2011
New Revision: 16703
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16703
Log:
#9894: Undoing reversing write direction
Modified:
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/scribusdoc.cpp
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16703&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Sat Jul 2 22:14:49 2011
@@ -1015,10 +1015,10 @@
{
if (dX==0.0 && dY==0.0)
return;
- if (dX!=0.0)
- LocalX+=dX;
- if (dY!=0.0)
- LocalY+=dY;
+ if (dX != 0.0)
+ LocalX += dX;
+ if (dY != 0.0)
+ LocalY += dY;
if (m_Doc->isLoading())
return;
checkChanges();
@@ -1034,13 +1034,15 @@
void PageItem::setReversed(bool newReversed)
{
+ if (Reverse == newReversed)
+ return;
if (UndoManager::undoEnabled())
{
SimpleState *ss = new SimpleState(Um::FlipH, 0, Um::IFlipH);
- ss->set("REVERSE_TEXT", "REVERSE_TEXT");
+ ss->set("REVERSE_TEXT", newReversed);
undoManager->action(this, ss);
}
- Reverse=newReversed;
+ Reverse = newReversed;
}
//return frame where is text end
@@ -4131,6 +4133,8 @@
restoreLinkTextFrame(ss,isUndo);
else if (ss->contains("UNLINK_TEXT_FRAME"))
restoreUnlinkTextFrame(ss,isUndo);
+ else if (ss->contains("REVERSE_TEXT"))
+ restoreReverseText(ss, isUndo);
}
if (!OnMasterPage.isEmpty())
m_Doc->setCurrentPage(oldCurrentPage);
@@ -4483,6 +4487,13 @@
{
unlink();
}
+}
+
+void PageItem::restoreReverseText(UndoState *state, bool /*isUndo*/)
+{
+ if (!isTextFrame())
+ return;
+ Reverse = !Reverse;
}
void PageItem::restorePoly(SimpleState *state, bool isUndo, bool isContour)
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16703&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Sat Jul 2 22:14:49 2011
@@ -1225,6 +1225,7 @@
void restoreImageEffects(UndoState *state, bool isUndo);
void restoreLinkTextFrame(UndoState *state, bool isUndo);
void restoreUnlinkTextFrame(UndoState *state, bool isUndo);
+ void restoreReverseText(UndoState *state, bool isUndo);
/*@}*/
/**
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16703&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sat Jul 2 22:14:49 2011
@@ -9131,14 +9131,27 @@
void ScribusDoc::itemSelection_SetItemTextReversed(bool reversed)
{
- uint selectedItemCount=m_Selection->count();
+ uint selectedItemCount = m_Selection->count();
if (selectedItemCount != 0)
{
+ UndoTransaction *activeTransaction = NULL;
+ if (UndoManager::undoEnabled())
+ activeTransaction = new UndoTransaction(undoManager->beginTransaction());
for (uint i = 0; i < selectedItemCount; ++i)
{
PageItem *currItem = m_Selection->itemAt(i);
currItem->setImageFlippedH(reversed);
currItem->setReversed(reversed);
+ }
+ if (activeTransaction)
+ {
+ activeTransaction->commit(Um::Selection,
+ Um::IGroup,
+ Um::FlipH,
+ 0,
+ Um::IFlipH);
+ delete activeTransaction;
+ activeTransaction = NULL;
}
regionsChanged()->update(QRectF());
changed();
More information about the scribus-commit
mailing list