r19355 by jghali - #12535: Wrong unit in Document Setup/Prefences > Printer

scribus-commit scribus-commit at lists.scribus.net
Fri Jul 18 18:01:13 UTC 2014


Author: jghali
Date: Fri Jul 18 18:01:13 2014
New Revision: 19355

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19355
Log:
#12535: Wrong unit in Document Setup/Prefences > Printer

Modified:
    trunk/Scribus/scribus/ui/newmarginwidget.cpp
    trunk/Scribus/scribus/ui/prefs_printer.cpp

Modified: trunk/Scribus/scribus/ui/newmarginwidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19355&path=/trunk/Scribus/scribus/ui/newmarginwidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/newmarginwidget.cpp (original)
+++ trunk/Scribus/scribus/ui/newmarginwidget.cpp Fri Jul 18 18:01:13 2014
@@ -19,6 +19,8 @@
 {
 	setupUi(this);
 
+	pageWidth  = 0;
+	pageHeight = 0;
 }
 
 NewMarginWidget::~NewMarginWidget()
@@ -89,8 +91,8 @@
 
 void NewMarginWidget::setPageWidth(double newWidth)
 {
-	leftMarginSpinBox->setMaximum(qMax(0.0, newWidth * m_unitRatio - leftMarginSpinBox->value()));
-	rightMarginSpinBox->setMaximum(qMax(0.0,newWidth * m_unitRatio - rightMarginSpinBox->value()));
+	leftMarginSpinBox->setMaximum(qMax(0.0, newWidth * m_unitRatio - rightMarginSpinBox->value()));
+	rightMarginSpinBox->setMaximum(qMax(0.0, newWidth * m_unitRatio - leftMarginSpinBox->value()));
 	pageWidth = newWidth;
 	setPreset();
 }
@@ -237,26 +239,29 @@
 
 void NewMarginWidget::updateMarginSpinValues()
 {
-	leftMarginSpinBox->blockSignals(true);
-	rightMarginSpinBox->blockSignals(true);
-	topMarginSpinBox->blockSignals(true);
-	bottomMarginSpinBox->blockSignals(true);
+	bool leftBlocked = leftMarginSpinBox->blockSignals(true);
+	bool rightBlocked = rightMarginSpinBox->blockSignals(true);
+	bool topBlocked = topMarginSpinBox->blockSignals(true);
+	bool bottomBlocked = bottomMarginSpinBox->blockSignals(true);
+
 	topMarginSpinBox->setValue(marginData.Top * m_unitRatio);
 	rightMarginSpinBox->setValue(marginData.Right * m_unitRatio);
 	bottomMarginSpinBox->setValue(marginData.Bottom * m_unitRatio);
 	leftMarginSpinBox->setValue(marginData.Left * m_unitRatio);
-	leftMarginSpinBox->blockSignals(false);
-	rightMarginSpinBox->blockSignals(false);
-	topMarginSpinBox->blockSignals(false);
-	bottomMarginSpinBox->blockSignals(false);
+
+	leftMarginSpinBox->blockSignals(leftBlocked);
+	rightMarginSpinBox->blockSignals(rightBlocked);
+	topMarginSpinBox->blockSignals(topBlocked);
+	bottomMarginSpinBox->blockSignals(bottomBlocked);
 }
 
 void NewMarginWidget::slotLinkMargins()
 {
-	leftMarginSpinBox->blockSignals(true);
-	rightMarginSpinBox->blockSignals(true);
-	topMarginSpinBox->blockSignals(true);
-	bottomMarginSpinBox->blockSignals(true);
+	bool leftBlocked = leftMarginSpinBox->blockSignals(true);
+	bool rightBlocked = rightMarginSpinBox->blockSignals(true);
+	bool topBlocked = topMarginSpinBox->blockSignals(true);
+	bool bottomBlocked = bottomMarginSpinBox->blockSignals(true);
+
 	if (marginLinkCheckBox->isChecked())
 	{
 		bottomMarginSpinBox->setValue(leftMarginSpinBox->value());
@@ -265,10 +270,11 @@
 		double newVal=leftMarginSpinBox->value() / m_unitRatio;
 		marginData.set(newVal, newVal, newVal, newVal);
 	}
-	leftMarginSpinBox->blockSignals(false);
-	rightMarginSpinBox->blockSignals(false);
-	topMarginSpinBox->blockSignals(false);
-	bottomMarginSpinBox->blockSignals(false);
+
+	leftMarginSpinBox->blockSignals(leftBlocked);
+	rightMarginSpinBox->blockSignals(rightBlocked);
+	topMarginSpinBox->blockSignals(topBlocked);
+	bottomMarginSpinBox->blockSignals(bottomBlocked);
 }
 
 void NewMarginWidget::setMarginPreset(int p)

Modified: trunk/Scribus/scribus/ui/prefs_printer.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19355&path=/trunk/Scribus/scribus/ui/prefs_printer.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_printer.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_printer.cpp Fri Jul 18 18:01:13 2014
@@ -41,6 +41,7 @@
 {
 	bleedsWidget->setNewUnitIndex(newIndex);
 	markOffsetSpinBox->setNewUnit(newIndex);
+	markLengthSpinBox->setNewUnit(newIndex);
 }
 
 void Prefs_Printer::restoreDefaults(struct ApplicationPrefs *prefsData)
@@ -48,7 +49,6 @@
 	int docUnitIndex = prefsData->docSetupPrefs.docUnitIndex;
 	unitChange(docUnitIndex);
 	double unitRatio = unitGetRatioFromIndex(docUnitIndex);
-	QString unitSuffix = unitGetSuffixFromIndex(docUnitIndex);
 
 	QString Pcap;
 	QString printerName;
@@ -85,13 +85,15 @@
 	clipToPrinterMarginsCheckBox->setChecked(prefs->getBool("Clip", false));
 	convertSpotsToProcessCheckBox->setChecked(!prefs->getBool("doSpot", true));
 	MarginStruct bleeds;
-	bleeds.set(prefs->getDouble("BleedTop",0.0)*unitRatio,
-			   prefs->getDouble("BleedBottom",0.0)*unitRatio,
-			   prefs->getDouble("BleedRight",0.0)*unitRatio,
-			   prefs->getDouble("BleedLeft",0.0)*unitRatio);
-	bleedsWidget->setup(bleeds, 0, 0, false, false);
-	markLengthSpinBox->setValue(prefs->getDouble("markLength", 20.0)*unitRatio);
-	markOffsetSpinBox->setValue(prefs->getDouble("markOffset", 0.0)*unitRatio);
+	bleeds.set(prefs->getDouble("BleedTop",0.0),
+			   prefs->getDouble("BleedBottom", 0.0),
+			   prefs->getDouble("BleedRight", 0.0),
+			   prefs->getDouble("BleedLeft", 0.0));
+	bleedsWidget->setup(bleeds, 0, docUnitIndex, false, false);
+	bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
+	bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
+	markLengthSpinBox->setValue(prefs->getDouble("markLength", 20.0) * unitRatio);
+	markOffsetSpinBox->setValue(prefs->getDouble("markOffset", 0.0) * unitRatio);
 	cropMarksCheckBox->setChecked(prefs->getBool("cropMarks", false));
 	bleedMarksCheckBox->setChecked(prefs->getBool("bleedMarks", false));
 	registrationMarksCheckBox->setChecked(prefs->getBool("registrationMarks", false));
@@ -124,10 +126,10 @@
 	prefs->set("ICCinUse", applyICCProfilesCheckBox->isChecked());
 	double unitRatio = unitGetRatioFromIndex(prefsData->docSetupPrefs.docUnitIndex);
 	MarginStruct bleeds(bleedsWidget->margins());
-	prefs->set("BleedTop", bleeds.Left / unitRatio);
-	prefs->set("BleedBottom", bleeds.Bottom / unitRatio);
-	prefs->set("BleedRight", bleeds.Right / unitRatio);
-	prefs->set("BleedLeft", bleeds.Left / unitRatio);
+	prefs->set("BleedTop", bleeds.Left);
+	prefs->set("BleedBottom", bleeds.Bottom);
+	prefs->set("BleedRight", bleeds.Right);
+	prefs->set("BleedLeft", bleeds.Left);
 	prefs->set("markLength", markLengthSpinBox->value() / unitRatio);
 	prefs->set("markOffset", markOffsetSpinBox->value() / unitRatio);
 	prefs->set("cropMarks", cropMarksCheckBox->isChecked());




More information about the scribus-commit mailing list