r17045 by fschmid - Fixed in frame rotation of images when scaling mode is "Fixed to Frame"

scribus-commit scribus-commit at lists.scribus.net
Wed Nov 30 22:13:58 UTC 2011


Author: fschmid
Date: Wed Nov 30 22:13:58 2011
New Revision: 17045

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17045
Log:
Fixed in frame rotation of images when scaling mode is "Fixed to Frame"

Modified:
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/ui/propertiespalette_image.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17045&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Wed Nov 30 22:13:58 2011
@@ -6510,7 +6510,7 @@
 
 void PageItem::AdjustPictScale()
 {
-	if (itemType()!=PageItem::ImageFrame)
+	if (itemType() != PageItem::ImageFrame)
 		return;
 	if (ScaleType)
 		return;
@@ -6521,6 +6521,27 @@
 //	LocalRot = 0;
 	double xs = Width / static_cast<double>(OrigW);
 	double ys = Height / static_cast<double>(OrigH);
+	if (LocalRot != 0.0)
+	{
+		QRectF br = QRectF(0, 0, OrigW, OrigH);
+		QTransform m;
+		m.rotate(LocalRot);
+		br = m.mapRect(br);
+		xs = Width / br.width();
+		ys = Height / br.height();
+		QLineF wL = QLineF(0, 0, OrigW, 0);
+		wL.setAngle(-LocalRot);
+		QLineF hL = QLineF(0, 0, 0, OrigH);
+		hL.setAngle(-LocalRot-90);
+		QTransform mm;
+		mm.scale(xs, ys);
+		hL = mm.map(hL);
+		wL = mm.map(wL);
+		xs = wL.length() / static_cast<double>(OrigW);
+		ys = hL.length() / static_cast<double>(OrigH);
+		LocalX = -br.x();
+		LocalY = -br.y();
+	}
 	if (AspectRatio)
 	{
 		LocalScX = qMin(xs, ys);

Modified: trunk/Scribus/scribus/ui/propertiespalette_image.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17045&path=/trunk/Scribus/scribus/ui/propertiespalette_image.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_image.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_image.cpp Wed Nov 30 22:13:58 2011
@@ -56,6 +56,7 @@
 	yposImgLabel->setBuddy(imageYOffsetSpinBox);
 	
 	imageRotation->setWrapping( true );
+	imageRotation->setNewUnit(6);
 	installSniffer(imageRotation);
 	imageRotationLabel->setBuddy(imageRotation);
 
@@ -538,7 +539,11 @@
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
 	if ((m_haveDoc) && (m_haveItem))
+	{
 		m_doc->itemSelection_SetImageRotation(360 - imageRotation->value());
+		if (frameScale->isChecked())
+			m_item->AdjustPictScale();
+	}
 }
 
 void PropertiesPalette_Image::handleScaling()




More information about the scribus-commit mailing list