r20276 by jghali - #13243: Attach text to path action is not enabled correctly

scribus-commit scribus-commit at lists.scribus.net
Sat Jul 25 20:43:32 UTC 2015


Author: jghali
Date: Sat Jul 25 20:43:32 2015
New Revision: 20276

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20276
Log:
#13243: Attach text to path action is not enabled correctly

Modified:
    trunk/Scribus/scribus/appmodehelper.cpp

Modified: trunk/Scribus/scribus/appmodehelper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20276&path=/trunk/Scribus/scribus/appmodehelper.cpp
==============================================================================
--- trunk/Scribus/scribus/appmodehelper.cpp (original)
+++ trunk/Scribus/scribus/appmodehelper.cpp Sat Jul 25 20:43:32 2015
@@ -851,14 +851,21 @@
 		{
 			(*a_scrActions)["itemWeld"]->setEnabled(true);
 			//CB swap it around if currItem is not at 0 index from the lastItem loop at start of havenewsel
-			PageItem* it=doc->m_Selection->itemAt(1);
-			if (currItem==it)
-				it=doc->m_Selection->itemAt(0);
-			if ((currItem->asTextFrame() || it->asTextFrame()) && (it->asPolygon() || it->asPolyLine()))
-			{
-				if ((currItem->nextInChain() == 0) && (currItem->prevInChain() == 0) && (it->nextInChain() == 0) && (it->prevInChain() == 0) && (!currItem->isGroup()) && (!it->isGroup()))
-					(*a_scrActions)["itemAttachTextToPath"]->setEnabled(true);
-			}
+			bool canAttachTextToPath = false;
+			PageItem* item1 = doc->m_Selection->itemAt(0);
+			PageItem* item2 = doc->m_Selection->itemAt(1);
+			if (!item1->asTextFrame() || !(item2->asPolygon() || item2->asPolyLine()))
+				std::swap(item1, item2);
+			if (item1->asTextFrame() && (item2->asPolygon() || item2->asPolyLine()))
+			{
+				canAttachTextToPath  = true;
+				canAttachTextToPath &= (item1->nextInChain() == 0);
+				canAttachTextToPath &= (item1->prevInChain() == 0);
+				canAttachTextToPath &= (item2->nextInChain() == 0);
+				canAttachTextToPath &= (item2->prevInChain() == 0);
+				canAttachTextToPath &= (!item1->isGroup() && !item2->isGroup());
+			}
+			(*a_scrActions)["itemAttachTextToPath"]->setEnabled(canAttachTextToPath);
 		}
 		else
 			(*a_scrActions)["itemWeld"]->setEnabled(false);




More information about the scribus-commit mailing list