r16118 by fschmid - Fixes for group sizes after applying a "Lens" or "Mesh Distortion" effect.

scribus-commit scribus-commit at lists.scribus.net
Mon Dec 20 00:35:35 CET 2010


Author: fschmid
Date: Sun Dec 19 23:35:34 2010
New Revision: 16118

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16118
Log:
Fixes for group sizes after applying a "Lens" or "Mesh Distortion" effect.

Modified:
    trunk/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp
    trunk/Scribus/scribus/plugins/tools/lenseffects/lenseffects.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusview.cpp
    trunk/Scribus/scribus/selection.cpp
    trunk/Scribus/scribus/ui/picstatus.cpp

Modified: trunk/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16118&path=/trunk/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp (original)
+++ trunk/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp Sun Dec 19 23:35:34 2010
@@ -536,9 +536,16 @@
 		currItem->Frame = false;
 		currItem->ClipEdited = true;
 		currItem->FrameType = 3;
+		double oW = currItem->width();
+		double oH = currItem->height();
 		m_doc->AdjustItemSize(currItem, true);
 		currItem->OldB2 = currItem->width();
 		currItem->OldH2 = currItem->height();
+		if (currItem->isGroup())
+		{
+			currItem->groupWidth = currItem->groupWidth * (currItem->OldB2 / oW);
+			currItem->groupHeight = currItem->groupHeight * (currItem->OldH2 / oH);
+		}
 		currItem->updateClip();
 		currItem->ContourLine = currItem->PoLine.copy();
 	}

Modified: trunk/Scribus/scribus/plugins/tools/lenseffects/lenseffects.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16118&path=/trunk/Scribus/scribus/plugins/tools/lenseffects/lenseffects.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/lenseffects/lenseffects.cpp (original)
+++ trunk/Scribus/scribus/plugins/tools/lenseffects/lenseffects.cpp Sun Dec 19 23:35:34 2010
@@ -126,9 +126,16 @@
 				currItem->Frame = false;
 				currItem->ClipEdited = true;
 				currItem->FrameType = 3;
+				double oW = currItem->width();
+				double oH = currItem->height();
 				currDoc->AdjustItemSize(currItem, true);
 				currItem->OldB2 = currItem->width();
 				currItem->OldH2 = currItem->height();
+				if (currItem->isGroup())
+				{
+					currItem->groupWidth = currItem->groupWidth * (currItem->OldB2 / oW);
+					currItem->groupHeight = currItem->groupHeight * (currItem->OldH2 / oH);
+				}
 				currItem->updateClip();
 				currItem->ContourLine = currItem->PoLine.copy();
 			}

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16118&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Dec 19 23:35:34 2010
@@ -3051,7 +3051,7 @@
 
 			if ((currItem->asTextFrame() && (bx->asPolygon() || bx->asPolyLine())) || (bx->asTextFrame() && (currItem->asPolygon() || currItem->asPolyLine())))
 			{
-				if ((currItem->nextInChain() == 0) && (currItem->prevInChain() == 0) && (bx->nextInChain() == 0) && (bx->prevInChain() == 0) && (currItem->Groups.count() == 0) && (bx->Groups.count() == 0))
+				if ((currItem->nextInChain() == 0) && (currItem->prevInChain() == 0) && (bx->nextInChain() == 0) && (bx->prevInChain() == 0) && (!currItem->isGroup()) && (!bx->isGroup()))
 					scrActions["itemAttachTextToPath"]->setEnabled(true);
 			}
 
@@ -4017,15 +4017,6 @@
 		for (int azz=0; azz<docItemsCount; ++azz)
 		{
 			PageItem *ite = doc->Items->at(azz);
-			//CB dont need this as we get it from the loading page in 1.2.x docs. 1.3.x items have this anyway.
-			/*
-			if (ite->Groups.count() != 0)
-				doc->GroupOnPage(ite);
-			else
-				ite->OwnPage = doc->OnPage(ite);
-			*/
-			//view->setRedrawBounding(ite);
-//			qDebug() << QString("load D: %1 %2 %3").arg(azz).arg((uint)ite).arg(ite->itemType());
 			if(ite->nextInChain() == NULL)
 				ite->layout();
 /*			if (doc->OldBM)

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16118&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sun Dec 19 23:35:34 2010
@@ -5108,24 +5108,12 @@
 
 void ScribusDoc::GroupOnPage(PageItem* currItem)
 {
-	QList<PageItem*> Objects;
-	PageItem* item;
-	if (currItem->Groups.count() == 0)
+	if (!currItem->isGroup())
 		return;
-	int ObjGroup = currItem->Groups.top();
-	uint docItemCount=Items->count();
-	for (uint a = 0; a < docItemCount; ++a)
-	{
-		item = Items->at(a);
-		if (item->Groups.count() != 0)
-		{
-			if (item->Groups.top() == ObjGroup)
-				Objects.append(item);
-		}
-	}
+	QList<PageItem*> Objects = currItem->getItemList();
 	int Off_Page = -1;
 	int On_Page = 999999;
-	uint objectCount=Objects.count();
+	uint objectCount = Objects.count();
 	for (uint a = 0; a < objectCount; ++a)
 	{
 		int res = OnPage(Objects.at(a));
@@ -5258,7 +5246,7 @@
 			PageItem *item = Items->at(ite);
 			if (item->OwnPage < 0)
 			{
-				if (item->Groups.count() != 0)
+				if (item->isGroup())
 					GroupOnPage(item);
 				else
 					item->OwnPage = OnPage(item);
@@ -5273,7 +5261,7 @@
 				}
 				else
 				{
-					if (item->Groups.count() != 0)
+					if (item->isGroup())
 						GroupOnPage(item);
 					else
 						item->OwnPage = OnPage(item);
@@ -11915,6 +11903,14 @@
 			currItem->moveImageInFrame(0, (currItem->height() - tp.y())/currItem->imageYScale());
 		SizeItem(tp.x(), tp.y(), currItem, true, false);
 		currItem->PoLine = Clip.copy();
+		if (currItem->isGroup() && includeGroup)
+		{
+			for (int em = 0; em < currItem->groupItemList.count(); ++em)
+			{
+				PageItem* embedded = currItem->groupItemList.at(em);
+				MoveItem(-tp2.x(), -tp2.y(), embedded, true);
+			}
+		}
 	}
 	currItem->ClipEdited = true;
 	currItem->OldB2 = currItem->width();
@@ -12608,7 +12604,7 @@
 	if (docSelectionCount > 1)
 	{
 		currItem = m_Selection->itemAt(0);
-		if (currItem->Groups.count() != 0)
+		if (currItem->isGroup())
 			return;
 		m_Selection->delaySignalsOn();
 		currItem->Frame = false;

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16118&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sun Dec 19 23:35:34 2010
@@ -1824,42 +1824,10 @@
 		}
 		else
 		{
-			if (currItem->Groups.count() != 0)
+			Doc->m_Selection->addItem(currItem);
+			if (draw)
 			{
-				if (Doc->m_Selection->count() != 0)
-				{
-					if (Doc->m_Selection->findItem(currItem) == -1)
-						Doc->m_Selection->addItem(currItem);
-				}
-				else
-					Doc->m_Selection->addItem(currItem);
-
-				for (int ga=0; ga<Doc->Items->count(); ++ga)
-				{
-					if (Doc->Items->at(ga)->Groups.count() != 0)
-					{
-						if (Doc->Items->at(ga)->Groups.top() == currItem->Groups.top())
-						{
-							if (Doc->Items->at(ga)->ItemNr != currItem->ItemNr)
-							{
-								if (Doc->m_Selection->findItem(Doc->Items->at(ga)) == -1)
-									Doc->m_Selection->addItem(Doc->Items->at(ga));
-							}
-							if (draw)
-							{
-								updateContents(currItem->getRedrawBounding(m_canvas->scale()));
-							}
-						}
-					}
-				}
-			}
-			else
-			{
-				Doc->m_Selection->addItem(currItem);
-				if (draw)
-				{
-					updateContents(currItem->getRedrawBounding(m_canvas->scale()));
-				}
+				updateContents(currItem->getRedrawBounding(m_canvas->scale()));
 			}
 			//CB FIXME/TODO We are surely prepending here and we have turned off
 			//emitting in prepend below so do it here.

Modified: trunk/Scribus/scribus/selection.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16118&path=/trunk/Scribus/scribus/selection.cpp
==============================================================================
--- trunk/Scribus/scribus/selection.cpp (original)
+++ trunk/Scribus/scribus/selection.cpp Sun Dec 19 23:35:34 2010
@@ -274,44 +274,15 @@
     bool removeOk(false);
 	if (!m_SelList.isEmpty() && m_SelList.contains(item))
 	{
-		bool itemIsGroup(item->Groups.count() > 0);
-		if(itemIsGroup)
-		{
-			QList<PageItem*> gItems;
-			foreach(PageItem *pi, m_SelList)
+		removeOk=(m_SelList.removeAll(item)==1);
+		if (removeOk)
+		{
+			if (m_isGUISelection)
 			{
-				if(!pi->groups().isEmpty() && !item->groups().isEmpty())
-				{
-					if(pi->groups().top() == item->groups().top())
-						gItems << pi;
-				}
+				item->setSelected(false);
+				item->disconnectFromGUI();
 			}
-			foreach(PageItem *gi, gItems)
-			{
-				removeOk=(m_SelList.removeAll(gi)==1);
-				if (removeOk)
-				{
-					if (m_isGUISelection)
-					{
-						gi->setSelected(false);
-						gi->disconnectFromGUI();
-					}
-					gi->isSingleSel = false;
-				}
-			}
-		}
-		else // regular item
-		{
-			removeOk=(m_SelList.removeAll(item)==1);
-			if (removeOk)
-			{
-				if (m_isGUISelection)
-				{
-					item->setSelected(false);
-					item->disconnectFromGUI();
-				}
-				item->isSingleSel = false;
-			}
+			item->isSingleSel = false;
 		}
 
 

Modified: trunk/Scribus/scribus/ui/picstatus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16118&path=/trunk/Scribus/scribus/ui/picstatus.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/picstatus.cpp (original)
+++ trunk/Scribus/scribus/ui/picstatus.cpp Sun Dec 19 23:35:34 2010
@@ -391,7 +391,7 @@
 		return;
 
 	ScCore->primaryMainWindow()->closeActiveWindowMasterPageEditor();
-	if (currItem->Groups.count() == 0)
+	if (!currItem->isGroup())
 		emit selectElement(currItem->OwnPage, currItem->ItemNr, false);
 	else
 	{




More information about the scribus-commit mailing list