r16933 by fschmid - Implement correct behavior when rotating welded items.
scribus-commit
scribus-commit at lists.scribus.net
Tue Oct 25 20:47:47 UTC 2011
Author: fschmid
Date: Tue Oct 25 20:47:47 2011
New Revision: 16933
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16933
Log:
Implement correct behavior when rotating welded items.
Modified:
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/scribusdoc.cpp
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16933&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Tue Oct 25 20:47:47 2011
@@ -924,10 +924,12 @@
void PageItem::setRotation(const double newRotation, bool drawingOnly)
{
- Rot=newRotation;
+ double dR = newRotation - Rot;
+ Rot = newRotation;
if (drawingOnly || m_Doc->isLoading())
return;
checkChanges();
+ rotateWelded(dR);
}
void PageItem::rotateBy(const double dR)
@@ -7146,6 +7148,39 @@
}
}
+void PageItem::rotateWelded(double dR)
+{
+ QTransform ma;
+ ma.translate(xPos(), yPos());
+ ma.scale(1, 1);
+ ma.rotate(rotation());
+ switch (m_Doc->RotMode())
+ {
+ case 2:
+ ma.translate(width()/2.0, height()/2.0);
+ break;
+ case 4:
+ ma.translate(width(), height());
+ break;
+ case 3:
+ ma.translate(0, height());
+ break;
+ case 1:
+ ma.translate(width(), 0);
+ break;
+ }
+ QPointF rotCenter = ma.map(QPointF(0,0));
+ QList<PageItem*> itemList = itemsWeldedTo(this);
+ for (int a = 0; a < itemList.count(); a++)
+ {
+ PageItem *pIt = itemList.at(a);
+ QLineF lin = QLineF(rotCenter, QPointF(pIt->xPos(), pIt->yPos()));
+ lin.setAngle(lin.angle() - dR);
+ pIt->setXYPos(lin.p2().x(), lin.p2().y());
+ pIt->rotateBy(dR);
+ }
+}
+
QList<PageItem*> PageItem::itemsWeldedTo(PageItem* except)
{
QList<PageItem*> ret;
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16933&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Tue Oct 25 20:47:47 2011
@@ -1583,6 +1583,7 @@
void addWelded(PageItem* iPt);
void moveWelded(double DX, double DY, int weld);
void moveWelded(double DX, double DY, PageItem* except = NULL);
+ void rotateWelded(double dR);
};
Q_DECLARE_METATYPE(PageItem*)
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16933&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Tue Oct 25 20:47:47 2011
@@ -12249,7 +12249,9 @@
double y = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
bool oldS = currItem->Sizing;
currItem->Sizing = true;
- MoveItem(x - currItem->xPos(), y - currItem->yPos(), currItem);
+ currItem->moveBy(x - currItem->xPos(), y - currItem->yPos(), true);
+ setRedrawBounding(currItem);
+ currItem->OwnPage = OnPage(currItem);
currItem->Sizing = oldS;
}
else
More information about the scribus-commit
mailing list