r19191 by craig - #12356: Save and use master page mode when adding/deleting pages
scribus-commit
scribus-commit at lists.scribus.net
Mon Jun 9 07:02:53 UTC 2014
Author: craig
Date: Mon Jun 9 07:02:52 2014
New Revision: 19191
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19191
Log:
#12356: Save and use master page mode when adding/deleting pages
Modified:
trunk/Scribus/scribus/scribus.cpp
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19191&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Mon Jun 9 07:02:52 2014
@@ -5695,6 +5695,7 @@
ss->set("PAGE", wo);
ss->set("WHERE", where);
ss->set("COUNT", numPages);
+ ss->set("MASTER_PAGE_MODE", doc->masterPageMode());
if (basedOn != NULL)
ss->set("BASED", basedOn->join("|"));
else
@@ -6902,6 +6903,7 @@
ss->set("PAGENR", a + 1);
ss->set("PAGENAME", doc->Pages->at(a)->pageName());
ss->set("MASTERPAGE", doc->Pages->at(a)->MPageNam);
+ ss->set("MASTER_PAGE_MODE", doc->masterPageMode());
// replace the deleted page in the undostack by a dummy object that will
// replaced with the "undone" page if user choose to undo the action
DummyUndoObject *duo = new DummyUndoObject();
@@ -8534,9 +8536,10 @@
QStringList tmpl;
tmpl << state->get("MASTERPAGE");
QString pageName = state->get("PAGENAME");
- bool oldPageMode = doc->masterPageMode();
- if (!pageName.isEmpty() && !oldPageMode) // We try do undo a master page deletion in standard mode
- doc->setMasterPageMode(true);
+ bool savedMasterPageMode = state->getBool("MASTER_PAGE_MODE");
+ bool currMasterPageMode=doc->masterPageMode();
+ if (currMasterPageMode!=savedMasterPageMode)
+ doc->setMasterPageMode(savedMasterPageMode);
if (pagenr == 1)
{
where = 0;
@@ -8552,9 +8555,10 @@
where = 1;
wo = pagenr - 1;
}
+
if (isUndo)
{
- if (doc->masterPageMode())
+ if (savedMasterPageMode)
{
slotNewMasterPage(wo, pageName);
}
@@ -8574,15 +8578,14 @@
state->set("DUMMY_ID", id);
deletePage(pagenr, pagenr);
}
- if (!pageName.isEmpty() && !oldPageMode)
- {
- doc->setMasterPageMode(oldPageMode);
- doc->rebuildMasterNames();
- pagePalette->rebuildMasters();
- }
- if (doc->masterPageMode() && !pageName.isEmpty())
- pagePalette->updateMasterPageList();
+ if (currMasterPageMode!=savedMasterPageMode)
+ doc->setMasterPageMode(currMasterPageMode);
+ doc->rebuildMasterNames();
+ pagePalette->updateMasterPageList();
pagePalette->rebuildPages();
+ if (outlinePalette->isVisible())
+ outlinePalette->BuildTree();
+
}
void ScribusMainWindow::restoreAddPage(SimpleState *state, bool isUndo)
@@ -8596,9 +8599,13 @@
int orient = state->getInt("ORIENT");
QString siz = state->get("SIZE");
bool mov = static_cast<bool>(state->getInt("MOVED"));
+ bool savedMasterPageMode = state->getBool("MASTER_PAGE_MODE");
int delFrom = 0;
int delTo = 0;
+ bool currMasterPageMode=doc->masterPageMode();
+ if (currMasterPageMode!=savedMasterPageMode)
+ doc->setMasterPageMode(savedMasterPageMode);
switch (where)
{
case 0:
@@ -8619,6 +8626,7 @@
}
break;
}
+
if (isUndo)
{
for (int i = delFrom - 1; i < delTo; ++i)
@@ -8635,7 +8643,7 @@
}
else
{
- if (doc->masterPageMode())
+ if (savedMasterPageMode)
{
assert (count == 1);
slotNewMasterPage(wo, based[0]);
@@ -8651,6 +8659,13 @@
delete tmp;
}
}
+ if (currMasterPageMode!=savedMasterPageMode)
+ doc->setMasterPageMode(currMasterPageMode);
+ doc->rebuildMasterNames();
+ pagePalette->updateMasterPageList();
+ pagePalette->rebuildPages();
+ if (outlinePalette->isVisible())
+ outlinePalette->BuildTree();
}
void ScribusMainWindow::restoreGrouping(SimpleState *state, bool isUndo)
More information about the scribus-commit
mailing list