r23368 by jghali - Fix issue where incorrect frame link would be drawn on canvas when using frame link/unlink tool

scribus-commit scribus-commit at lists.scribus.net
Tue Nov 19 11:42:56 UTC 2019


Author: jghali
Date: Tue Nov 19 11:42:56 2019
New Revision: 23368

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23368
Log:
Fix issue where incorrect frame link would be drawn on canvas when using frame link/unlink tool

Modified:
    trunk/Scribus/scribus/canvas.cpp

Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23368&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp	(original)
+++ trunk/Scribus/scribus/canvas.cpp	Tue Nov 19 11:42:56 2019
@@ -2117,48 +2117,24 @@
  */
 void Canvas::drawFrameLinks(ScPainter* painter)
 {
+	PageItem *currItem = nullptr;
+	if ((m_doc->appMode == modeLinkFrames) || (m_doc->appMode == modeUnlinkFrames))
+	{
+		if (m_doc->m_Selection->count() > 0)
+			currItem = m_doc->m_Selection->itemAt(0);
+		else if (m_viewMode.linkedFramesToShow.count() > 0)
+			currItem = m_viewMode.linkedFramesToShow.at(0);
+		if (currItem && (currItem->itemType() != PageItem::TextFrame))
+			currItem = nullptr;
+	}
+
+	//Draw the frame links
 	painter->save();
-	PageItem *currItem;
-	if ((m_doc->guidesPrefs().linkShown || m_viewMode.drawFramelinksWithContents) && (m_viewMode.linkedFramesToShow.count() != 0))
-		currItem = m_viewMode.linkedFramesToShow.at(0);
-	else
-	{
-		if (m_viewMode.linkedFramesToShow.count() != 0)
-			currItem = m_viewMode.linkedFramesToShow.at(0);
-		else
-			currItem = m_doc->m_Selection->itemAt(0);
-	}
-	//Draw the frame links
-	if ((((m_doc->appMode == modeLinkFrames) || (m_doc->appMode == modeUnlinkFrames))
-		 && (currItem->itemType() == PageItem::TextFrame)) || (m_doc->guidesPrefs().linkShown || m_viewMode.drawFramelinksWithContents))
-	{
-		PageItem *nextItem = currItem;
-		if (m_doc->guidesPrefs().linkShown || m_viewMode.drawFramelinksWithContents)
-		{
-			for (int lks = 0; lks < m_viewMode.linkedFramesToShow.count(); ++lks)
-			{
-				nextItem = m_viewMode.linkedFramesToShow.at(lks);
-				while (nextItem != nullptr)
-				{
-					if (nextItem->nextInChain() != nullptr)
-					{
-						FPoint start, end;
-						calculateFrameLinkPoints(nextItem, nextItem->nextInChain(), start, end);
-						drawLinkFrameLine(painter, start, end);
-					}
-					nextItem = nextItem->nextInChain();
-				}
-			}
-		}
-		else
-		{
-			while (nextItem != nullptr)
-			{
-				if (nextItem->prevInChain() != nullptr)
-					nextItem = nextItem->prevInChain();
-				else
-					break;
-			}
+	if (m_doc->guidesPrefs().linkShown || m_viewMode.drawFramelinksWithContents)
+	{
+		for (int i = 0; i < m_viewMode.linkedFramesToShow.count(); ++i)
+		{
+			PageItem* nextItem = m_viewMode.linkedFramesToShow.at(i);
 			while (nextItem != nullptr)
 			{
 				if (nextItem->nextInChain() != nullptr)
@@ -2169,6 +2145,20 @@
 				}
 				nextItem = nextItem->nextInChain();
 			}
+		}
+	}
+	else if ((((m_doc->appMode == modeLinkFrames) || (m_doc->appMode == modeUnlinkFrames)) && (currItem != nullptr)))
+	{
+		PageItem *nextItem = currItem->firstInChain();
+		while (nextItem != nullptr)
+		{
+			if (nextItem->nextInChain() != nullptr)
+			{
+				FPoint start, end;
+				calculateFrameLinkPoints(nextItem, nextItem->nextInChain(), start, end);
+				drawLinkFrameLine(painter, start, end);
+			}
+			nextItem = nextItem->nextInChain();
 		}
 	}
 	painter->setLineWidth(1);




More information about the scribus-commit mailing list