r21213 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Mon Apr 18 20:42:30 UTC 2016


Author: jghali
Date: Mon Apr 18 20:42:30 2016
New Revision: 21213

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21213
Log:
when starting measurement mode, initialize if possible measurement widget using doc unit

Modified:
    branches/Version14x/Scribus/scribus/measurements.cpp

Modified: branches/Version14x/Scribus/scribus/measurements.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21213&path=/branches/Version14x/Scribus/scribus/measurements.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/measurements.cpp	(original)
+++ branches/Version14x/Scribus/scribus/measurements.cpp	Mon Apr 18 20:42:30 2016
@@ -4,8 +4,11 @@
 a copyright and/or license notice that predates the release of Scribus 1.3.2
 for which a new license (GPL+exception) is in place.
 */
+#include <cmath>
+
 #include "measurements.h"
-#include <cmath>
+#include "scribusdoc.h"
+#include "scribusview.h"
 #include "units.h"
 
 using namespace std;
@@ -14,6 +17,12 @@
 Measurements::Measurements( QWidget* parent ) : ScrPaletteBase( parent, "MeasurementsPalette", false, 0 )
 {
 	setupUi(this);
+
+	mX1 = mY1 = 0;
+	mX2 = mY2 = 0;
+	mDX = mDY = 0;
+	mLength = 0;
+
 	const QString widthString="10000.0000";
 	int textWidth = fontMetrics().width(widthString);
 	x1Data->setMinimumSize(textWidth, 12);
@@ -31,6 +40,20 @@
 	int minHeight = unitSwitch->minimumSizeHint().height();
 	unitSwitch->setMinimumSize(textWidth, minHeight);
 	resize(minimumSizeHint());
+
+	// Try to start with doc unit if possible
+	ScribusView* view = qobject_cast<ScribusView*>(parent);
+	if (view)
+	{
+		ScribusDoc* doc = view->Doc;
+		if (doc)
+		{
+			int unitIndex = doc->unitIndex();
+			unitSwitch->setCurrentIndex(unitIndex);
+		}
+	}
+	setValues(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+
 	connect(unitSwitch, SIGNAL(currentIndexChanged(int)), this, SLOT(unitChanged()));
 }
 




More information about the scribus-commit mailing list