r14787 by jghali - fix display going awery when dropping master page to trash in page palette

scribus-commit scribus-commit at lists.scribus.net
Sun Feb 21 02:10:19 CET 2010


Revision: 14787
Author: jghali
Date: 2010-02-21T01:05:21.455864Z
Commit message: fix display going awery when dropping master page to trash in page palette

Changeset: 
M  /branches/Version135/Scribus/scribus/pagepalette.cpp

Diffs:
Index: scribus/pagepalette.cpp
===================================================================
--- scribus/pagepalette.cpp	(revision 14786)
+++ scribus/pagepalette.cpp	(revision 14787)
@@ -642,6 +642,10 @@
 	if (exit == QMessageBox::Yes)
 	{
 		bool oldMPMode = currView->Doc->masterPageMode();
+		int  storedPageNum = currView->Doc->currentPageNumber();
+		int  storedViewXCoor = currView->horizontalScrollBar()->value();
+		int  storedViewYCoor = currView->verticalScrollBar()->value();
+
 		currView->Doc->setMasterPageMode(true);
 		currView->Doc->scMW()->DeletePage2(currView->Doc->MasterNames[tmp]);
 		//<<CB TODO Move back into ScribusDoc::deleteMasterPage();
@@ -651,6 +655,11 @@
 		currView->Doc->replaceMasterPage(tmp);
 		currView->Doc->setMasterPageMode(oldMPMode);
 		currView->Doc->setModified(true);
+
+		currView->Doc->setCurrentPage(currView->Doc->DocPages.at(storedPageNum));
+		currView->reformPages(false);
+		currView->setContentsPos(storedViewXCoor, storedViewYCoor);
+		currView->DrawNew();
 	}
 }
 
@@ -750,12 +759,12 @@
 	pageLayout->updateLayoutSelector(currView->Doc->pageSets);
 	pageLayout->selectItem(currView->Doc->currentPageLayout);
 	pageLayout->firstPage->setCurrentIndex(currView->Doc->pageSets[currView->Doc->currentPageLayout].FirstPage);
-	pageView->MaxC = currView->Doc->Pages->count()-1;
+	pageView->MaxC = currView->Doc->DocPages.count()-1;
 	int counter, rowcounter, colmult, rowmult, coladd,rowadd;
 	counter = currView->Doc->pageSets[currView->Doc->currentPageLayout].FirstPage;
 	int cols = currView->Doc->pageSets[currView->Doc->currentPageLayout].Columns;
-	int rows = (currView->Doc->Pages->count()+counter) / currView->Doc->pageSets[currView->Doc->currentPageLayout].Columns;
-	if (((currView->Doc->Pages->count()+counter) % currView->Doc->pageSets[currView->Doc->currentPageLayout].Columns) != 0)
+	int rows = (currView->Doc->DocPages.count()+counter) / currView->Doc->pageSets[currView->Doc->currentPageLayout].Columns;
+	if (((currView->Doc->DocPages.count()+counter) % currView->Doc->pageSets[currView->Doc->currentPageLayout].Columns) != 0)
 		rows++;
 	rowcounter = 0;
 	if (cols == 1)
@@ -792,9 +801,9 @@
 	pageView->firstP = counter;
 	pageView->cols = currView->Doc->pageSets[currView->Doc->currentPageLayout].Columns;
 	pageList.clear();
-	for (int a = 0; a < currView->Doc->Pages->count(); ++a)
+	for (int a = 0; a < currView->Doc->DocPages.count(); ++a)
 	{
-		str = currView->Doc->Pages->at(a)->MPageNam;
+		str = currView->Doc->DocPages.at(a)->MPageNam;
 		SeItem *it = new SeItem(str, a, CreateIcon(a, pix));
 		pageList.append(it);
 		pageView->setItem(rowcounter*rowmult+rowadd, counter*colmult+coladd, (QTableWidgetItem *)it);




More information about the scribus-commit mailing list