r14361 by cbradney - Unit conversion fixes for new guides pane

scribus-commit scribus-commit at lists.scribus.net
Fri Nov 27 00:20:21 CET 2009


Revision: 14361
Author: cbradney
Date: 2009-11-26T13:56:46.231978Z
Commit message: Unit conversion fixes for new guides pane

Changeset: 
M  /trunk/Scribus/scribus/ui/prefs_guides.cpp
M  /trunk/Scribus/scribus/ui/prefs_guides.h

Diffs:
Index: scribus/ui/prefs_guides.cpp
===================================================================
--- scribus/ui/prefs_guides.cpp	(revision 14360)
+++ scribus/ui/prefs_guides.cpp	(revision 14361)
@@ -37,12 +37,23 @@
 	guidePlacementComboBox->setCurrentIndex(i<0?0:i);
 }
 
+void Prefs_Guides::unitChange(int unitIndex)
+{
+	double unitRatio = unitGetRatioFromIndex(unitIndex);
+	majorGridSpacingSpinBox->setNewUnit(unitIndex);
+	minorGridSpacingSpinBox->setNewUnit(unitIndex);
+
+	majorGridSpacingSpinBox->setMinimum(10 * unitRatio);
+	minorGridSpacingSpinBox->setMinimum(10 * unitRatio);
+	majorGridSpacingSpinBox->setMaximum(1000 * unitRatio);
+	minorGridSpacingSpinBox->setMaximum(1000 * unitRatio);
+}
+
 void Prefs_Guides::restoreDefaults(struct ApplicationPrefs *prefsData)
 {
 	int docUnitIndex = prefsData->docSetupPrefs.docUnitIndex;
-	QString unitSuffix(unitGetSuffixFromIndex(docUnitIndex));
+	unitChange(docUnitIndex);
 	double unitRatio = unitGetRatioFromIndex(docUnitIndex);
-	int decimals = unitGetPrecisionFromIndex(docUnitIndex);
 	guidePlacementComboBox->setCurrentIndex(prefsData->guidesPrefs.guidePlacement ?0:1);
 	guideSnapDistanceSpinBox->setValue(prefsData->guidesPrefs.guideRad);
 	guideGrabRadiusSpinBox->setValue(prefsData->guidesPrefs.grabRadius);
@@ -50,16 +61,9 @@
 	visibilityMarginsCheckBox->setChecked(prefsData->guidesPrefs.marginsShown);
 	visibilityGridCheckBox->setChecked(prefsData->guidesPrefs.gridShown);
 	visibilityBaselineGridCheckBox->setChecked(prefsData->guidesPrefs.baselineGridShown);
-	majorGridSpacingSpinBox->setMinimum(10 * unitRatio);
-	minorGridSpacingSpinBox->setMinimum(10 * unitRatio);
-	majorGridSpacingSpinBox->setMaximum(1000 * unitRatio);
-	minorGridSpacingSpinBox->setMaximum(1000 * unitRatio);
-	majorGridSpacingSpinBox->setDecimals( decimals );
-	minorGridSpacingSpinBox->setDecimals( decimals );
-	majorGridSpacingSpinBox->setSuffix( unitSuffix );
-	minorGridSpacingSpinBox->setSuffix( unitSuffix );
-	majorGridSpacingSpinBox->setValue(prefsData->guidesPrefs.majorGridSpacing  * unitRatio);
-	minorGridSpacingSpinBox->setValue(prefsData->guidesPrefs.minorGridSpacing  * unitRatio);
+
+	majorGridSpacingSpinBox->setValue(prefsData->guidesPrefs.majorGridSpacing * unitRatio);
+	minorGridSpacingSpinBox->setValue(prefsData->guidesPrefs.minorGridSpacing * unitRatio);
 	baselineGridSpacingSpinBox->setValue(prefsData->guidesPrefs.valueBaselineGrid);
 	baselineGridOffsetSpinBox->setValue(prefsData->guidesPrefs.offsetBaselineGrid);
 
Index: scribus/ui/prefs_guides.h
===================================================================
--- scribus/ui/prefs_guides.h	(revision 14360)
+++ scribus/ui/prefs_guides.h	(revision 14361)
@@ -24,6 +24,7 @@
 
 	public slots:
 		void languageChange();
+		void unitChange(int);
 
 	protected slots:
 		virtual void changeMajorColor();




More information about the scribus-commit mailing list