r22897 by jghali - #15603: Image rotation increment down button doesn't go below zero (or wrap to 360)

scribus-commit scribus-commit at lists.scribus.net
Fri Mar 15 15:06:14 UTC 2019


Author: jghali
Date: Fri Mar 15 15:06:14 2019
New Revision: 22897

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22897
Log:
#15603: Image rotation increment down button doesn't go below zero (or wrap to 360)

Modified:
    trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
    trunk/Scribus/scribus/ui/scrspinbox.cpp
    trunk/Scribus/scribus/ui/scrspinbox.h

Modified: trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22897&path=/trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp	(original)
+++ trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp	Fri Mar 15 15:06:14 2019
@@ -72,11 +72,12 @@
 	keepFrameWHRatioButton->setAutoRaise( true );
 	keepFrameWHRatioButton->setMaximumSize( QSize( 15, 32767 ) );
 	keepFrameWHRatioButton->setChecked(false);
+
+	rotationSpin->setNewUnit(6);
 	rotationSpin->setWrapping( true );
 	installSniffer(rotationSpin);
-
-	rotationSpin->setNewUnit(6);
 	rotationLabel->setBuddy(rotationSpin);
+
 	IconManager* im=IconManager::instance();
 	levelUp->setIcon(im->loadIcon("16/go-up.png"));
 	levelDown->setIcon(im->loadIcon("16/go-down.png"));
@@ -114,13 +115,13 @@
 
 	languageChange();
 
-	connect(xposSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewX()));
+	/*connect(xposSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewX()));
 	connect(yposSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewY()));
 	connect(widthSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewW()));
 	connect(heightSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewH()));
 	connect(rotationSpin, SIGNAL(valueChanged(double)), this, SLOT(handleRotation()));
 	connect(flipH, SIGNAL(clicked()), this, SLOT(handleFlipH()));
-	connect(flipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));
+	connect(flipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));*/
 	connect(levelUp, SIGNAL(clicked()), this, SLOT(handleRaise()));
 	connect(levelDown, SIGNAL(clicked()), this, SLOT(handleLower()));
 	connect(levelTop, SIGNAL(clicked()), this, SLOT(handleFront()));
@@ -128,9 +129,9 @@
 	connect(basePointWidget, SIGNAL(buttonClicked(int)), this, SLOT(handleBasePoint(int)));
 
 	connect(nameEdit , SIGNAL(Leaved()) , this, SLOT(handleNewName()));
-	connect(doLock   , SIGNAL(clicked()), this, SLOT(handleLock()));
+	/*connect(doLock   , SIGNAL(clicked()), this, SLOT(handleLock()));
 	connect(noPrint  , SIGNAL(clicked()), this, SLOT(handlePrint()));
-	connect(noResize , SIGNAL(clicked()), this, SLOT(handleLockSize()));
+	connect(noResize , SIGNAL(clicked()), this, SLOT(handleLockSize()));*/
 	connect(doGroup  , SIGNAL(clicked()), this, SLOT(handleGrouping()) );
 	connect(doUnGroup, SIGNAL(clicked()), this, SLOT(handleUngrouping()) );
 
@@ -332,16 +333,16 @@
 	rotationSpin->setValue(fabs(rr));
 
 //CB TODO reconnect PP signals from here
-	connect(xposSpin    , SIGNAL(valueChanged(double)), this, SLOT(handleNewX()));
-	connect(yposSpin    , SIGNAL(valueChanged(double)), this, SLOT(handleNewY()));
-	connect(widthSpin   , SIGNAL(valueChanged(double)), this, SLOT(handleNewW()));
-	connect(heightSpin  , SIGNAL(valueChanged(double)), this, SLOT(handleNewH()));
-	connect(doLock  , SIGNAL(clicked()), this, SLOT(handleLock()));
-	connect(noPrint , SIGNAL(clicked()), this, SLOT(handlePrint()));
-	connect(noResize, SIGNAL(clicked()), this, SLOT(handleLockSize()));
-	connect(flipH   , SIGNAL(clicked()), this, SLOT(handleFlipH()));
-	connect(flipV   , SIGNAL(clicked()), this, SLOT(handleFlipV()));
-	connect(rotationSpin, SIGNAL(valueChanged(double)), this, SLOT(handleRotation()));
+	connect(xposSpin    , SIGNAL(valueChanged(double)), this, SLOT(handleNewX()), Qt::UniqueConnection);
+	connect(yposSpin    , SIGNAL(valueChanged(double)), this, SLOT(handleNewY()), Qt::UniqueConnection);
+	connect(widthSpin   , SIGNAL(valueChanged(double)), this, SLOT(handleNewW()), Qt::UniqueConnection);
+	connect(heightSpin  , SIGNAL(valueChanged(double)), this, SLOT(handleNewH()), Qt::UniqueConnection);
+	connect(doLock  , SIGNAL(clicked()), this, SLOT(handleLock()), Qt::UniqueConnection);
+	connect(noPrint , SIGNAL(clicked()), this, SLOT(handlePrint()), Qt::UniqueConnection);
+	connect(noResize, SIGNAL(clicked()), this, SLOT(handleLockSize()), Qt::UniqueConnection);
+	connect(flipH   , SIGNAL(clicked()), this, SLOT(handleFlipH()), Qt::UniqueConnection);
+	connect(flipV   , SIGNAL(clicked()), this, SLOT(handleFlipV()), Qt::UniqueConnection);
+	connect(rotationSpin, SIGNAL(valueChanged(double)), this, SLOT(handleRotation()), Qt::UniqueConnection);
 
 	bool setter = false;
 	xposSpin->setEnabled(!setter);
@@ -660,9 +661,9 @@
 	double rr = r;
 	if (r > 0)
 		rr = 360 - rr;
-	bool sigBlocked = rotationSpin->blockSignals(true);
-	rotationSpin->setValue(fabs(rr));
-	rotationSpin->blockSignals(sigBlocked);
+	//bool sigBlocked = rotationSpin->blockSignals(true);
+	rotationSpin->showValue(fabs(rr));
+	//rotationSpin->blockSignals(sigBlocked);
 }
 
 void PropertiesPalette_XYZ::handleNewX()

Modified: trunk/Scribus/scribus/ui/scrspinbox.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22897&path=/trunk/Scribus/scribus/ui/scrspinbox.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrspinbox.cpp	(original)
+++ trunk/Scribus/scribus/ui/scrspinbox.cpp	Fri Mar 15 15:06:14 2019
@@ -73,6 +73,21 @@
 	this->blockSignals(sigBlocked);
 }
 
+void ScrSpinBox::stepBy(int steps)
+{
+	if (m_unitIndex == SC_DEGREES)
+	{
+		double angle = this->value();
+		angle += steps * singleStep();
+		while (angle < 0.0)
+			angle += 360.0;
+		while (angle > 360)
+			angle -= 360.0;
+		setValue(angle);
+		return;
+	}
+	QDoubleSpinBox::stepBy(steps);
+}
 
 void ScrSpinBox::setParameters( int s )
 {

Modified: trunk/Scribus/scribus/ui/scrspinbox.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22897&path=/trunk/Scribus/scribus/ui/scrspinbox.h
==============================================================================
--- trunk/Scribus/scribus/ui/scrspinbox.h	(original)
+++ trunk/Scribus/scribus/ui/scrspinbox.h	Fri Mar 15 15:06:14 2019
@@ -44,6 +44,9 @@
 
 		uint   unitIndex() const { return m_unitIndex; }
 		double unitRatio() const;
+
+		// Reimplement QDoubleSpinBox::stepBy() for angle wrapping
+		void stepBy(int steps) override;
 		
 	public slots:
 		void setValues(double min, double max, int deci, double val);




More information about the scribus-commit mailing list