r14595 by jghali - #8756 (first round) : fix a few problems which may happen with sections management when deleting pages
scribus-commit
scribus-commit at lists.scribus.net
Mon Feb 1 19:45:06 CET 2010
Revision: 14595
Author: jghali
Date: 2010-01-30T15:34:12.051687Z
Commit message: #8756 (first round) : fix a few problems which may happen with sections management when deleting pages
Changeset:
M /branches/Version135/Scribus/scribus/scribusdoc.cpp
Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 14594)
+++ scribus/scribusdoc.cpp (revision 14595)
@@ -4846,26 +4846,28 @@
void ScribusDoc::removePageFromSection(const uint pageIndex)
{
//Get the section of the new page index.
- bool found=false;
+ bool found = false;
+ uint fromIndex, toIndex;
DocumentSectionMap::Iterator it = sections.begin();
for (; it!= sections.end(); ++it)
{
if (pageIndex>=it.value().fromindex && pageIndex<=it.value().toindex)
{
- found=true;
+ fromIndex = it.value().fromindex;
+ toIndex = it.value().toindex - 1;
+ if (fromIndex > toIndex) // Remove section in that case
+ sections.remove(it.key());
break;
}
}
- //Our page was not in a section
- if (!found)
- return;
- --it.value().toindex;
- ++it;
- while (it!=sections.end())
+ for (it = sections.begin(); it != sections.end(); ++it)
{
- --it.value().fromindex;
- --it.value().toindex;
- ++it;
+ fromIndex = it.value().fromindex;
+ toIndex = it.value().toindex;
+ if (fromIndex > pageIndex)
+ --it.value().fromindex;
+ if (toIndex >= pageIndex)
+ --it.value().toindex;
}
//Now update the Pages' internal storage of their page number
updateSectionPageNumbersToPages();
More information about the scribus-commit
mailing list