r19132 by craig - #12285: Add undo/redo for vertical alignment

scribus-commit scribus-commit at lists.scribus.net
Wed May 21 20:15:57 UTC 2014


Author: craig
Date: Wed May 21 20:15:56 2014
New Revision: 19132

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19132
Log:
#12285: Add undo/redo for vertical alignment

Modified:
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem.h

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19132&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Wed May 21 20:15:56 2014
@@ -1623,6 +1623,14 @@
 {
 	if (val == verticalAlign)
 		return;
+	if(UndoManager::undoEnabled())
+	{
+		SimpleState *ss = new SimpleState(Um::AlignText, "", Um::ITextFrame);
+		ss->set("VERTICAL_ALIGN", "vertical_align");
+		ss->set("OLD_VERTALIGN", verticalAlign);
+		ss->set("NEW_VERTALIGN", val);
+		undoManager->action(this, ss);
+	}
 	verticalAlign = val;
 }
 
@@ -4959,6 +4967,8 @@
 			restoreShade(ss, isUndo);
 		else if (ss->contains("LINE_COLOR"))
 			restoreLineColor(ss, isUndo);
+		else if (ss->contains("VERTICAL_ALIGN"))
+			restoreVerticalAlign(ss, isUndo);
 		else if (ss->contains("COLUMNS"))
 			restoreColumns(ss, isUndo);
 		else if (ss->contains("COLUMNSGAP"))
@@ -7027,6 +7037,15 @@
 		else
 			unlink();
 	}
+}
+
+void PageItem::restoreVerticalAlign(SimpleState *ss, bool isUndo)
+{
+	if (isUndo)
+		verticalAlign = ss->getInt("OLD_VERTALIGN");
+	else
+		verticalAlign = ss->getInt("NEW_VERTALIGN");
+	update();
 }
 
 void PageItem::restoreReverseText(UndoState *state, bool /*isUndo*/)

Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19132&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Wed May 21 20:15:56 2014
@@ -1593,6 +1593,7 @@
 	void restoreUnWeldItem(SimpleState *state, bool isUndo);
 	void restoreUniteItem(SimpleState *state, bool isUndo);
 	void restoreUnlinkTextFrame(UndoState *state, bool isUndo);
+	void restoreVerticalAlign(SimpleState *state, bool isUndo);
 	void restoreWeldItems(SimpleState *state, bool isUndo);
 
 




More information about the scribus-commit mailing list