r19533 by jghali - #12728: "Orientation" is not correctly managed when changing "Default Unit" in new doc dialog

scribus-commit scribus-commit at lists.scribus.net
Wed Sep 24 19:13:06 UTC 2014


Author: jghali
Date: Wed Sep 24 19:13:06 2014
New Revision: 19533

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19533
Log:
#12728: "Orientation" is not correctly managed when changing "Default Unit" in new doc dialog

Modified:
    trunk/Scribus/scribus/ui/newfile.cpp

Modified: trunk/Scribus/scribus/ui/newfile.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19533&path=/trunk/Scribus/scribus/ui/newfile.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/newfile.cpp (original)
+++ trunk/Scribus/scribus/ui/newfile.cpp Wed Sep 24 19:13:06 2014
@@ -521,42 +521,12 @@
 	m_unitIndex = newUnitIndex;
 	widthSpinBox->setValue(m_pageWidth * m_unitRatio);
 	heightSpinBox->setValue(m_pageHeight * m_unitRatio);
-/*	
-double oldUnitRatio = unitRatio;
-	double val, oldB, oldBM, oldH, oldHM;
-	int decimals;
-	widthSpinBox->getValues(&oldB, &oldBM, &decimals, &val);
-	oldB /= oldUnitRatio;
-	oldBM /= oldUnitRatio;
-	heightSpinBox->getValues(&oldH, &oldHM, &decimals, &val);
-	oldH /= oldUnitRatio;
-	oldHM /= oldUnitRatio;
-
-	unitIndex = newUnitIndex;
-	unitRatio = unitGetRatioFromIndex(newUnitIndex);
-	decimals = unitGetDecimalsFromIndex(newUnitIndex);
-	if (pageOrientationComboBox->currentItem() == portraitPage)
-	{
-		widthSpinBox->setValues(oldB * unitRatio, oldBM * unitRatio, decimals, pageWidth * unitRatio);
-		heightSpinBox->setValues(oldH * unitRatio, oldHM * unitRatio, decimals, pageHeight * unitRatio);
-	}
-	else
-	{
-		widthSpinBox->setValues(oldB * unitRatio, oldBM * unitRatio, decimals, pageHeight * unitRatio);
-		heightSpinBox->setValues(oldH * unitRatio, oldHM * unitRatio, decimals, pageWidth * unitRatio);
-	}
-	Distance->setValue(Dist * unitRatio);
-	unitSuffix = unitGetSuffixFromIndex(newUnitIndex);
-	widthSpinBox->setSuffix(unitSuffix);
-	heightSpinBox->setSuffix(unitSuffix);
-	Distance->setSuffix( unitSuffix );
-*/
+
 	marginGroup->setNewUnit(m_unitIndex);
 	marginGroup->setPageHeight(m_pageHeight);
 	marginGroup->setPageWidth(m_pageWidth);
 	connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 	connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
-
 }
 
 void NewDoc::ExitOK()
@@ -605,9 +575,12 @@
 	disconnect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
 	if (ori != m_orientation)
 	{
-		double w = widthSpinBox->value(), h = heightSpinBox->value();
+		double w  = widthSpinBox->value(), h = heightSpinBox->value();
+		double pw = m_pageWidth, ph = m_pageHeight;
 		widthSpinBox->setValue((ori == portraitPage) ? qMin(w, h) : qMax(w, h));
 		heightSpinBox->setValue((ori == portraitPage) ? qMax(w, h) : qMin(w, h));
+		m_pageWidth  = (ori == portraitPage) ? qMin(pw, ph) : qMax(pw, ph);
+		m_pageHeight = (ori == portraitPage) ? qMax(pw, ph) : qMin(pw, ph);
 	}
 	// #869 pv - defined constants added + code repeat (check w/h)
 	(ori == portraitPage) ? m_orientation = portraitPage : m_orientation = landscapePage;




More information about the scribus-commit mailing list