r19889 by craig - #12916 and #12917: Fix undo and GUI for swap pages function
scribus-commit
scribus-commit at lists.scribus.net
Sat Feb 28 19:42:52 UTC 2015
Author: craig
Date: Sat Feb 28 19:42:52 2015
New Revision: 19889
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19889
Log:
#12916 and #12917: Fix undo and GUI for swap pages function
Modified:
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusdoc.h
trunk/Scribus/scribus/ui/movepage.cpp
trunk/Scribus/scribus/undomanager.cpp
trunk/Scribus/scribus/undomanager.h
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19889&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sat Feb 28 19:42:52 2015
@@ -6042,7 +6042,7 @@
int wo = dia->getWherePage();
if (wie == 3)
{
- doc->swapPages(from-1, wo-1);
+ doc->swapPage(from-1, wo-1);
updateGUIAfterPagesChanged();
return;
}
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19889&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sat Feb 28 19:42:52 2015
@@ -1869,6 +1869,8 @@
restoreCopyPage(ss, isUndo);
else if (ss->contains("PAGE_MOVE"))
restoreMovePage(ss, isUndo);
+ else if (ss->contains("PAGE_SWAP"))
+ restoreSwapPage(ss, isUndo);
else if (ss->contains("LEVEL_DOWN"))
restoreLevelDown(ss,isUndo);
else if (ss->contains("LEVEL_UP"))
@@ -2826,13 +2828,31 @@
changed();
}
-void ScribusDoc::swapPages(const int a, const int b)
-{
+void ScribusDoc::swapPage(const int a, const int b)
+{
+ if (UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::SwapPage, "", Um::IDocument);
+ ss->set("PAGE_SWAP", "page_swap");
+ ss->set("PAGE_SWAP_FROM", a);
+ ss->set("PAGE_SWAP_TO", b);
+ undoManager->action(this, ss);
+ }
Pages->swap(a,b);
reformPages();
changed();
}
+void ScribusDoc::restoreSwapPage(SimpleState *state, bool isUndo)
+{
+ int a = state->getInt("PAGE_SWAP_FROM");
+ int b = state->getInt("PAGE_SWAP_TO");
+
+ if (isUndo)
+ swapPage(b,a);
+ else
+ swapPage(a,b);
+}
void ScribusDoc::movePage(const int fromPage, const int toPage, const int dest, const int position)
{
@@ -2870,7 +2890,7 @@
ss->set("PAGE_MOVE_TO", toPage);
ss->set("PAGE_MOVE_DEST", dest);
ss->set("PAGE_MOVE_NEWPOS", position);
- undoManager->action(this, ss, DocName, Um::IDocument);
+ undoManager->action(this, ss);
}
reformPages();
if (m_View && m_ScMW)
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19889&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Sat Feb 28 19:42:52 2015
@@ -275,7 +275,7 @@
* @param a page index
* @param b page index
*/
- void swapPages(const int a, const int b);
+ void swapPage(const int a, const int b);
/**
* @brief Move page(s) within the document
* @param fromPage page index
@@ -754,6 +754,7 @@
void restoreMasterPageRenaming(SimpleState *state, bool isUndo);
void restoreCopyPage(SimpleState *state, bool isUndo);
void restoreMovePage(SimpleState *state, bool isUndo);
+ void restoreSwapPage(SimpleState *state, bool isUndo);
void restoreAddMasterPage(SimpleState *state, bool isUndo);
/**
* @brief Undo function for grouping/ungrouping
Modified: trunk/Scribus/scribus/ui/movepage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19889&path=/trunk/Scribus/scribus/ui/movepage.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/movepage.cpp (original)
+++ trunk/Scribus/scribus/ui/movepage.cpp Sat Feb 28 19:42:52 2015
@@ -137,12 +137,10 @@
void MovePages::mvWherePageDataDisable(int index)
{
- mvWherePageData->setDisabled((index==2));
+ mvWherePageData->setDisabled(index==2);
+ toPageData->setDisabled(index==3);
if (index==3)
- {
- toPageData->setDisabled(true);
toPageData->setValue(fromPageData->value());
- }
}
Modified: trunk/Scribus/scribus/undomanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19889&path=/trunk/Scribus/scribus/undomanager.cpp
==============================================================================
--- trunk/Scribus/scribus/undomanager.cpp (original)
+++ trunk/Scribus/scribus/undomanager.cpp Sat Feb 28 19:42:52 2015
@@ -775,6 +775,7 @@
UndoManager::Copy = tr("Copy");
UndoManager::CopyPage = tr("Copy page");
UndoManager::MovePage = tr("Move page");
+ UndoManager::SwapPage = tr("Swap page");
UndoManager::ImportPage = tr("Import page");
UndoManager::ToOutlines = tr("Convert to outlines");
UndoManager::LinkTextFrame = tr("Link text frame");
@@ -1059,6 +1060,7 @@
QString UndoManager::CopyPage = "";
QString UndoManager::ImportPage = "";
QString UndoManager::MovePage = "";
+QString UndoManager::SwapPage = "";
QString UndoManager::ToOutlines = "";
QString UndoManager::LinkTextFrame = "";
QString UndoManager::UnlinkTextFrame = "";
Modified: trunk/Scribus/scribus/undomanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19889&path=/trunk/Scribus/scribus/undomanager.h
==============================================================================
--- trunk/Scribus/scribus/undomanager.h (original)
+++ trunk/Scribus/scribus/undomanager.h Sat Feb 28 19:42:52 2015
@@ -565,6 +565,7 @@
static QString ChangePageAttrs;
static QString ImportPage;
static QString MovePage;
+ static QString SwapPage;
static QString ToOutlines;
static QString LinkTextFrame;
static QString UnlinkTextFrame;
More information about the scribus-commit
mailing list