Author: fschmid
Date: Sun May  1 08:28:06 2016
New Revision: 21264

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21264
Log:
Fixed Bug #13996: Grouping text frames will result in a loss of chained text 
arrows

Modified:
    trunk/Scribus/scribus/canvas.cpp
    trunk/Scribus/scribus/canvas.h

Modified: trunk/Scribus/scribus/canvas.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=21264&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp    (original)
+++ trunk/Scribus/scribus/canvas.cpp    Sun May  1 08:28:06 2016
@@ -1529,8 +1529,8 @@
                                currItem->DrawObj(painter, cullingArea);
                                currItem->DrawObj_Decoration(painter);
                        }
-//                     currItem->Redrawn = true;
-                       if ((currItem->asTextFrame()) && 
((currItem->nextInChain() != 0) || (currItem->prevInChain() != 0)))
+                       getLinkedFrames(currItem);
+/*                     if ((currItem->asTextFrame()) && 
((currItem->nextInChain() != 0) || (currItem->prevInChain() != 0)))
                        {
                                PageItem *nextItem = currItem;
                                while (nextItem != 0)
@@ -1542,7 +1542,7 @@
                                }
                                if 
(!m_viewMode.linkedFramesToShow.contains(nextItem))
                                        
m_viewMode.linkedFramesToShow.append(nextItem);
-                       }
+                       }*/
                        /* FIXME:av -
                        what to fix exactly? - pm
                        */
@@ -1692,6 +1692,32 @@
                                painter->drawRect(x, y, w, h);
                        painter->setAntialiasing(true);
                }
+       }
+}
+
+void Canvas::getLinkedFrames(PageItem* currItem)
+{
+       if (currItem->isGroup())
+       {
+               for (int em = 0; em < currItem->groupItemList.count(); ++em)
+               {
+                       PageItem* embedded = currItem->groupItemList.at(em);
+                       getLinkedFrames(embedded);
+               }
+
+       }
+       else if ((currItem->asTextFrame()) && ((currItem->nextInChain() != 0) 
|| (currItem->prevInChain() != 0)))
+       {
+               PageItem *nextItem = currItem;
+               while (nextItem != 0)
+               {
+                       if (nextItem->prevInChain() != 0)
+                               nextItem = nextItem->prevInChain();
+                       else
+                               break;
+               }
+               if (!m_viewMode.linkedFramesToShow.contains(nextItem))
+                       m_viewMode.linkedFramesToShow.append(nextItem);
        }
 }
 
@@ -2289,10 +2315,26 @@
        //Calculate the link points of the frames
        double x11 = pi1->xPos();
        double y11 = pi1->yPos();
-       double x12 = x11+pi1->width();
-       double y12 = y11+pi1->height();
-       double x1mid = x11+(x12-x11)/2;
-       double y1mid = y11+(y12-y11)/2;
+       double x12 = x11 + pi1->width();
+       double y12 = y11 + pi1->height();
+       if (pi1->isGroupChild())
+       {
+               QTransform itemTrans = pi1->getTransform();
+               QPointF itPos = itemTrans.map(QPointF(0, 0));
+               x11 = itPos.x();
+               y11 = itPos.y();
+               double grScXi = 1.0;
+               double grScYi = 1.0;
+               getScaleFromMatrix(itemTrans, grScXi, grScYi);
+               if (itemTrans.m11() < 0)
+                       x11 -= pi1->width() * grScXi;
+               if (itemTrans.m22() < 0)
+                       y11 -= pi1->height() * grScYi;
+               x12 = x11 + pi1->width() * grScXi;
+               y12 = y11 + pi1->height() * grScYi;
+       }
+       double x1mid = x11 + (x12 - x11) / 2.0;
+       double y1mid = y11 + (y12 - y11) / 2.0;
                                        
        if (pi1->rotation()!=0.000)
        {
@@ -2312,10 +2354,27 @@
        a1 = a2 = b1 = b2 = 0;
        double x21 = pi2->xPos();
        double y21 = pi2->yPos();
-       double x22 = x21+pi2->width();
-       double y22 = y21+pi2->height();
-       double x2mid = x21 + pi2->width()/2;
-       double y2mid = y21 + pi2->height()/2;
+       double x22 = x21 + pi2->width();
+       double y22 = y21 + pi2->height();
+       if (pi2->isGroupChild())
+       {
+               QTransform itemTrans = pi2->getTransform();
+               QPointF itPos = itemTrans.map(QPointF(0, 0));
+               x21 = itPos.x();
+               y21 = itPos.y();
+               double grScXi = 1.0;
+               double grScYi = 1.0;
+               getScaleFromMatrix(itemTrans, grScXi, grScYi);
+               if (itemTrans.m11() < 0)
+                       x21 -= pi2->width() * grScXi;
+               if (itemTrans.m22() < 0)
+                       y11 -= pi2->height() * grScYi;
+               x22 = x21 + pi2->width() * grScXi;
+               y22 = y21 + pi2->height() * grScYi;
+       }
+
+       double x2mid = x21 + (x22 - x21) / 2.0;
+       double y2mid = y21 + (y22 - y21) / 2.0;
                                        
        if (pi2->rotation()!=0.000)
        {

Modified: trunk/Scribus/scribus/canvas.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=21264&path=/trunk/Scribus/scribus/canvas.h
==============================================================================
--- trunk/Scribus/scribus/canvas.h      (original)
+++ trunk/Scribus/scribus/canvas.h      Sun May  1 08:28:06 2016
@@ -257,6 +257,7 @@
        void drawControlsMeasurementLine(QPainter* pp);
        void drawControlsDrawLine(QPainter* pp);
        void drawControlsFreehandLine(QPainter* pp);
+       void getLinkedFrames(PageItem* currItem);
        void getClipPathForPages(FPointArray* PoLine);
        void calculateFrameLinkPoints(PageItem* pi1, PageItem* pi2, FPoint& 
start, FPoint& end);
                


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

Reply via email to