r15305 by jghali - #9230 (first round) : changing baseline grid settings in doc prefs does not update the text alignement

scribus-commit scribus-commit at lists.scribus.net
Sun Jul 4 23:30:47 CEST 2010


Revision: 15305
Author: jghali
Date: 2010-07-04T21:25:51.697946Z
Commit message: #9230 (first round) : changing baseline grid settings in doc prefs does not update the text alignement

Changeset: 
M  /trunk/Scribus/scribus/ui/reformdoc.cpp
M  /trunk/Scribus/scribus/scribusdoc.cpp
M  /trunk/Scribus/scribus/scribusdoc.h

Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 15304)
+++ scribus/scribusdoc.cpp	(revision 15305)
@@ -10108,6 +10108,21 @@
 	}
 }
 
+void ScribusDoc::invalidateAll()
+{
+	for (int c = 0; c < DocItems.count(); ++c)
+	{
+		PageItem *ite = DocItems.at(c);
+		ite->invalidateLayout();
+	}
+	for (int c=0; c < MasterItems.count(); ++c)
+	{
+		PageItem *ite = MasterItems.at(c);
+		ite->invalidateLayout();
+	}
+	// for now hope that frameitems get invalidated by their parents layout() method.
+}
+
 void ScribusDoc::invalidateLayer(int layerID)
 {
 	for (int c = 0; c < DocItems.count(); ++c)
@@ -12398,12 +12413,9 @@
 	for (it3a = uf.begin(); it3a != it3aend; ++it3a)
 		AddFont(*it3a);
 
-
-
 //	currDoc->documentInfo = docInfos->getDocInfo();
 //	currDoc->sections = tabDocSections->getNewSections();
 
-
 	uint itemCount=Items->count();
 	for (uint b=0; b<itemCount; ++b)
 	{
@@ -12411,6 +12423,13 @@
 			Items->at(b)->setImageShown(docPrefsData.guidesPrefs.showPic);
 	}
 
+	double oldBaseGridValue  = oldPrefsData.guidesPrefs.valueBaselineGrid;
+	double oldBaseGridOffset = oldPrefsData.guidesPrefs.offsetBaselineGrid;
+	if (oldBaseGridValue  != prefsData.guidesPrefs.valueBaselineGrid ||
+		oldBaseGridOffset != prefsData.guidesPrefs.offsetBaselineGrid )
+	{
+		this->invalidateAll();
+	}
 }
 
 void ScribusDoc::applyPrefsPageSizingAndMargins(bool resizePages, bool resizeMasterPages, bool resizePageMargins, bool resizeMasterPageMargins)
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(revision 15304)
+++ scribus/scribusdoc.h	(revision 15305)
@@ -143,6 +143,7 @@
 	MassObservable<Page*>     * pagesChanged() { return &m_pagesChanged; }
 	MassObservable<QRectF>    * regionsChanged() { return &m_regionsChanged; }
 	
+	void invalidateAll();
 	void invalidateLayer(int layerID);
 	void invalidateRegion(QRectF region);
 
Index: scribus/ui/reformdoc.cpp
===================================================================
--- scribus/ui/reformdoc.cpp	(revision 15304)
+++ scribus/ui/reformdoc.cpp	(revision 15305)
@@ -222,6 +222,9 @@
 {
 	MarginStruct updatedMargins(tabPage->marginGroup->margins());
 	int fp = tabPage->choosenLayout;
+	double oldBaselineGridValue  = currDoc->guidesPrefs().valueBaselineGrid;
+	double oldBaselineGridOffset = currDoc->guidesPrefs().offsetBaselineGrid;
+
 	currDoc->setPageSetFirstPage(fp, tabPage->docLayout->firstPage->currentIndex());
 //	currDoc->pageSets[fp].GapHorizontal = tabView->gapHorizontal->value() / currDoc->unitRatio();
 	currDoc->setPageGapHorizontal(tabView->gapHorizontal->value() / currDoc->unitRatio());
@@ -641,6 +644,12 @@
 		if (currDoc->Items->at(b)->itemType() == PageItem::ImageFrame)
 			currDoc->Items->at(b)->setImageShown(currDoc->guidesPrefs().showPic);
 	}
+
+	if (oldBaselineGridValue  != currDoc->guidesPrefs().valueBaselineGrid ||
+		oldBaselineGridOffset != currDoc->guidesPrefs().offsetBaselineGrid )
+	{
+		currDoc->invalidateAll();
+	}
 }
 
 void ReformDoc::applyChangesButton_clicked()




More information about the scribus-commit mailing list