Author: jghali
Date: Sun Mar 22 15:48:52 2020
New Revision: 23527

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23527
Log:
Code style fixes

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23527&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp        (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp        Sun Mar 22 15:48:52 2020
@@ -15915,56 +15915,55 @@
        for (int i = 0; i < selectedItemCount; ++i)
        {
                PageItem *currItem = itemSelection->itemAt(i);
-               if (currItem != nullptr)
-               {
-                       if (currItem->asImageFrame() && 
currItem->imageIsAvailable)
-                       {
-                               double w = currItem->OrigW * 
currItem->imageXScale();
-                               double h = currItem->OrigH * 
currItem->imageYScale();
-                               double x = currItem->imageXOffset() * 
currItem->imageXScale();
-                               double y = currItem->imageYOffset() * 
currItem->imageYScale();
-
-                               // m determines the position of the upper left 
corner of the image relative to
-                               // the current position of the item. 
-                               QTransform m = 
QTransform().rotate(currItem->rotation());
-                               double newRotation = currItem->rotation();
-                               if (currItem->imageFlippedH() && 
currItem->imageFlippedV())
-                               {
-                                       newRotation += 
currItem->imageRotation();
-                                       // Inner rotation happens around the 
lower right corner. m already contains the item rotation.
-                                       // Next we have to translate to the 
rotation point. For flipped images the offsets are subtracted from
-                                       // the opposite edge. Then we have to 
adjust for the inner rotation. Finally, we can translate to
-                                       // to the upper left corner of the 
image. The transformations in the other cases happen analogously.
-                                       m.translate(currItem->width() - x, 
currItem->height() - y).rotate(currItem->imageRotation()).translate(-w, -h);
-                               }
-                               else if (currItem->imageFlippedH() && 
!currItem->imageFlippedV())
-                               {
-                                       newRotation -= 
currItem->imageRotation();
-                                       // Inner rotation happens around the 
upper right corner.
-                                       m.translate(currItem->width() - x, 
y).rotate(-currItem->imageRotation()).translate(-w, 0);
-                               }
-                               else if (!currItem->imageFlippedH() && 
currItem->imageFlippedV())
-                               {
-                                       newRotation -= 
currItem->imageRotation();
-                                       // Inner rotation happens around the 
lower left corner.
-                                       m.translate(x, currItem->height() - 
y).rotate(-currItem->imageRotation()).translate(0, -h);
-                               }
-                               else
-                               {
-                                       /* !FlippedH and !FlippedV */
-                                       newRotation += 
currItem->imageRotation();
-                                       // Inner rotation happens already 
around the upper left corner.
-                                       m.translate(x, y);
-                               }
-                               currItem->setRotation(newRotation);
-                               currItem->setImageRotation(0);
-
-                               sizeItem(w, h, currItem);
-                               QPointF imageUpperLeft = m.map(QPointF(0, 0));
-                               moveItem(imageUpperLeft.x(), 
imageUpperLeft.y(), currItem);
-                               currItem->setImageXYOffset(0.0, 0.0);
-                       }
-               }
+               if (!currItem)
+                       continue;
+               if (!currItem->asImageFrame() || !currItem->imageIsAvailable)
+                       continue;
+
+               double w = currItem->OrigW * currItem->imageXScale();
+               double h = currItem->OrigH * currItem->imageYScale();
+               double x = currItem->imageXOffset() * currItem->imageXScale();
+               double y = currItem->imageYOffset() * currItem->imageYScale();
+
+               // m determines the position of the upper left corner of the 
image relative to
+               // the current position of the item. 
+               QTransform m = QTransform().rotate(currItem->rotation());
+               double newRotation = currItem->rotation();
+               if (currItem->imageFlippedH() && currItem->imageFlippedV())
+               {
+                       newRotation += currItem->imageRotation();
+                       // Inner rotation happens around the lower right 
corner. m already contains the item rotation.
+                       // Next we have to translate to the rotation point. For 
flipped images the offsets are subtracted from
+                       // the opposite edge. Then we have to adjust for the 
inner rotation. Finally, we can translate to
+                       // to the upper left corner of the image. The 
transformations in the other cases happen analogously.
+                       m.translate(currItem->width() - x, currItem->height() - 
y).rotate(currItem->imageRotation()).translate(-w, -h);
+               }
+               else if (currItem->imageFlippedH() && 
!currItem->imageFlippedV())
+               {
+                       newRotation -= currItem->imageRotation();
+                       // Inner rotation happens around the upper right corner.
+                       m.translate(currItem->width() - x, 
y).rotate(-currItem->imageRotation()).translate(-w, 0);
+               }
+               else if (!currItem->imageFlippedH() && 
currItem->imageFlippedV())
+               {
+                       newRotation -= currItem->imageRotation();
+                       // Inner rotation happens around the lower left corner.
+                       m.translate(x, currItem->height() - 
y).rotate(-currItem->imageRotation()).translate(0, -h);
+               }
+               else
+               {
+                       /* !FlippedH and !FlippedV */
+                       newRotation += currItem->imageRotation();
+                       // Inner rotation happens already around the upper left 
corner.
+                       m.translate(x, y);
+               }
+               currItem->setRotation(newRotation);
+               currItem->setImageRotation(0);
+
+               sizeItem(w, h, currItem);
+               QPointF imageUpperLeft = m.map(QPointF(0, 0));
+               moveItem(imageUpperLeft.x(), imageUpperLeft.y(), currItem);
+               currItem->setImageXYOffset(0.0, 0.0);
        }
        if (activeTransaction)
                activeTransaction.commit();


_______________________________________________
scribus-commit mailing list
[email protected]
http://lists.scribus.net/mailman/listinfo/scribus-commit

Reply via email to