r20421 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Thu Sep 24 11:55:42 UTC 2015


Author: jghali
Date: Thu Sep 24 11:55:42 2015
New Revision: 20421

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20421
Log:
#13367: Changing document unit records useless Undo actions

Modified:
    trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp
    trunk/Scribus/scribus/ui/proptree.cpp

Modified: trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20421&path=/trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp	(original)
+++ trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp	Thu Sep 24 11:55:42 2015
@@ -222,9 +222,20 @@
 		return;
 	m_unitRatio = m_doc->unitRatio();
 	m_unitIndex = m_doc->unitIndex();
+
+	bool sigBlocked1 = softShadowXOffset->blockSignals(true);
+	bool sigBlocked2 = softShadowYOffset->blockSignals(true);
+	bool sigBlocked3 = softShadowBlurRadius->blockSignals(true);
+	bool sigBlocked4 = this->model()->blockSignals(true);
+
 	softShadowXOffset->setUnitValue(m_unitIndex);
 	softShadowYOffset->setUnitValue(m_unitIndex);
 	softShadowBlurRadius->setUnitValue(m_unitIndex);
+
+	softShadowXOffset->blockSignals(sigBlocked1);
+	softShadowYOffset->blockSignals(sigBlocked2);
+	softShadowBlurRadius->blockSignals(sigBlocked3);
+	this->model()->blockSignals(sigBlocked4);
 }
 
 void PropertiesPalette_Shadow::updateColorList()

Modified: trunk/Scribus/scribus/ui/proptree.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20421&path=/trunk/Scribus/scribus/ui/proptree.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/proptree.cpp	(original)
+++ trunk/Scribus/scribus/ui/proptree.cpp	Thu Sep 24 11:55:42 2015
@@ -374,9 +374,15 @@
 
 void PropTreeItem::setUnitValue(int unit)
 {
+	int oldUnit = m_unit;
 	m_unit = unit;
 	if (m_type == DoubleSpinBox)
-		setData(1, Qt::DisplayRole, QString("%1 %2").arg(data(1, Qt::UserRole).toDouble(), 0, 'f', m_decimals).arg(unitGetSuffixFromIndex(m_unit)));
+	{
+		double oldUnitRatio = unitGetRatioFromIndex(oldUnit);
+		double newUnitRatio = unitGetRatioFromIndex(unit);
+		double oldVal = data(1, Qt::UserRole).toDouble() / oldUnitRatio;
+		setDoubleValue(oldVal * newUnitRatio);
+	}
 	else
 		setData(1, Qt::DisplayRole, QString("%1 %2").arg(data(1, Qt::UserRole).toString()).arg(unitGetSuffixFromIndex(m_unit)));
 }




More information about the scribus-commit mailing list