Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 10154 → Rev 10158

/branches/Version133x/Scribus/scribus/scribusdoc.cpp
1100,6 → 1100,22
currentPage = Pages->at(0);
}
 
void ScribusDoc::rebuildMasterNames(void)
{
MasterNames.clear();
for (uint a = 0; a < MasterPages.count(); ++a)
MasterNames[MasterPages.at(a)->pageName()] = MasterPages.at(a)->pageNr();
}
 
void ScribusDoc::replaceMasterPage(const QString& oldMasterPage)
{
for (Page* docPage = DocPages.first(); docPage; docPage = DocPages.next() )
{
if (docPage->MPageNam == oldMasterPage)
docPage->MPageNam = "Normal";
}
}
 
void ScribusDoc::deletePage(const int pageNumber)
{
Q_ASSERT( Pages->count() > 1 && Pages->count() > static_cast<uint>(pageNumber) );
/branches/Version133x/Scribus/scribus/scribusdoc.h
95,6 → 95,10
Page* addPage(const int pageNumber, const QString& masterPageName=QString::null, const bool addAutoFrame=false);
void deleteMasterPage(const int);
//! @brief Rebuild master name list
void rebuildMasterNames(void);
//! @brief Replace a master page by default one
void replaceMasterPage(const QString& oldMasterPage);
//! @brief Rename a master page
bool renameMasterPage(const QString& oldPageName, const QString& newPageName);
void deletePage(const int);
/branches/Version133x/Scribus/scribus/muster.cpp
108,15 → 108,9
ScMW->DeletePage2(currentDoc->MasterNames[sMuster]);
//<<CB TODO Move back into ScribusDoc::deleteMasterPage();
//This must happen after the pages have been reformed (view/doc)
currentDoc->MasterNames.clear();
for (uint a = 0; a < currentDoc->Pages->count(); ++a)
currentDoc->MasterNames[currentDoc->Pages->at(a)->PageNam] = currentDoc->Pages->at(a)->pageNr();
currentDoc->rebuildMasterNames();
// and fix up any pages that refer to the deleted master page
for (Page* docPage = currentDoc->DocPages.first(); docPage; docPage = currentDoc->DocPages.next() )
{
if (docPage->MPageNam == sMuster)
docPage->MPageNam = "Normal";
}
currentDoc->replaceMasterPage(sMuster);
//>>
sMuster = "Normal";
/branches/Version133x/Scribus/scribus/scribus.cpp
5886,6 → 5886,7
SimpleState *ss = new SimpleState(Um::DeletePage, "", Um::ICreate);
ss->set("DELETE_PAGE", "delete_page");
ss->set("PAGENR", pg + 1);
ss->set("PAGENAME", doc->Pages->at(pg)->pageName());
ss->set("MASTERPAGE", doc->Pages->at(pg)->MPageNam);
// 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
5913,6 → 5914,7
scrActions["pageDelete"]->setEnabled(setter);
scrActions["pageMove"]->setEnabled(setter);
slotDocCh();
doc->rebuildMasterNames();
pagePalette->RebuildPage();
if (UndoManager::undoEnabled())
undoManager->commit();
5975,6 → 5977,7
ss->set("DUMMY_ID", id);
undoManager->action(this, ss);
}
bool isMasterPage = !(doc->Pages->at(a)->pageName().isEmpty());
if (doc->masterPageMode())
doc->deleteMasterPage(a);
else
5983,7 → 5986,8
view->pageSelector->setMaxValue(doc->Pages->count());
view->pageSelector->GotoPg(0);
connect(view->pageSelector, SIGNAL(GotoPage(int)), view, SLOT(GotoPa(int)));
doc->removePageFromSection(a);
if (!isMasterPage) // Master pages are not added to sections when created
doc->removePageFromSection(a);
}
undoManager->setUndoEnabled(false); // ugly hack to disable object moving when undoing page deletion
view->reformPages();
5995,6 → 5999,7
scrActions["pageDelete"]->setEnabled(setter);
scrActions["pageMove"]->setEnabled(setter);
slotDocCh();
doc->rebuildMasterNames();
pagePalette->RebuildPage();
if (UndoManager::undoEnabled())
undoManager->commit();
7825,7 → 7830,9
void ScribusMainWindow::restoreDeletePage(SimpleState *state, bool isUndo)
{
uint pagenr = state->getUInt("PAGENR");
QStringList tmpl = state->get("MASTERPAGE");
QStringList tmpl;
tmpl << state->get("MASTERPAGE");
tmpl << state->get("PAGENAME");
int where, wo;
if (pagenr == 1)
{
7844,7 → 7851,14
}
if (isUndo)
{
addNewPages(wo, where, 1, doc->pageHeight, doc->pageWidth, doc->PageOri, doc->PageSize, true, &tmpl);
if (doc->masterPageMode())
{
slotNewMasterPage(wo, tmpl[1]);
}
else
{
addNewPages(wo, where, 1, doc->pageHeight, doc->pageWidth, doc->PageOri, doc->PageSize, true, &tmpl);
}
UndoObject *tmp =
undoManager->replaceObject(state->getUInt("DUMMY_ID"), doc->Pages->at(pagenr - 1));
delete tmp;
7857,6 → 7871,7
state->set("DUMMY_ID", id);
DeletePage(pagenr, pagenr);
}
pagePalette->RebuildPage();
}
 
void ScribusMainWindow::restoreAddPage(SimpleState *state, bool isUndo)