r23809 by jghali - Simplify a bit ScribusDoc's useImageEffects(), useImageColorEffects() and recalcPicturesRes() by using PageItemIterator

scribus-commit scribus-commit at lists.scribus.net
Thu May 14 00:59:18 UTC 2020


Author: jghali
Date: Thu May 14 00:59:17 2020
New Revision: 23809

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23809
Log:
Simplify a bit ScribusDoc's useImageEffects(), useImageColorEffects() and recalcPicturesRes() by using PageItemIterator

Modified:
    trunk/Scribus/scribus/pageitemiterator.cpp
    trunk/Scribus/scribus/pageitemiterator.h
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/pageitemiterator.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23809&path=/trunk/Scribus/scribus/pageitemiterator.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitemiterator.cpp	(original)
+++ trunk/Scribus/scribus/pageitemiterator.cpp	Thu May 14 00:59:17 2020
@@ -10,10 +10,27 @@
 #include "pageitem_group.h"
 #include "pageitem_table.h"
 
+PageItemIterator::PageItemIterator(int options) :
+	m_options(options)
+{
+
+}
+
 PageItemIterator::PageItemIterator(const QList<PageItem*>& itemList, int options) :
 	m_options(options)
 {
+	if (itemList.count() > 0)
+	{
+		State state = { itemList, 0 };
+		m_stateStack.push(state);
+		m_current = next();
+	}
+}
+
+PageItem* PageItemIterator::begin(const QList<PageItem*>& itemList)
+{
 	m_current = nullptr;
+	m_stateStack.resize(0); // Not clear in order to keep the already allocated memory available
 
 	if (itemList.count() > 0)
 	{
@@ -21,6 +38,8 @@
 		m_stateStack.push(state);
 		m_current = next();
 	}
+
+	return m_current;
 }
 
 PageItem* PageItemIterator::next()

Modified: trunk/Scribus/scribus/pageitemiterator.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23809&path=/trunk/Scribus/scribus/pageitemiterator.h
==============================================================================
--- trunk/Scribus/scribus/pageitemiterator.h	(original)
+++ trunk/Scribus/scribus/pageitemiterator.h	Thu May 14 00:59:17 2020
@@ -23,10 +23,13 @@
 		IterateInGroups = 1,
 		IterateInTables = 2
 	};
+	PageItemIterator(int options = IterateInGroups);
 	PageItemIterator(const QList<PageItem*>& itemList, int options = IterateInGroups);
 
 	bool isNull() const { return (m_current == nullptr); }
 	PageItem* current() const { return m_current; }
+	
+	PageItem* begin(const QList<PageItem*>& itemList);
 	PageItem* next();
 
 	inline PageItem*  operator*() const { return m_current; }

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23809&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Thu May 14 00:59:17 2020
@@ -45,6 +45,7 @@
 #include "text/boxes.h"
 #include "canvas.h"
 #include "colorblind.h"
+#include "colormgmt/sccolormgmtenginefactory.h"
 #include "commonstrings.h"
 #include "desaxe/digester.h"
 #include "fileloader.h"
@@ -55,6 +56,7 @@
 #include "notesstyles.h"
 #include "numeration.h"
 #include "pageitem.h"
+#include "pageitemiterator.h"
 #include "pageitem_imageframe.h"
 #include "pageitem_latexframe.h"
 #include "pageitem_line.h"
@@ -67,7 +69,6 @@
 #ifdef HAVE_OSG
 	#include "pageitem_osgframe.h"
 #endif
-#include "colormgmt/sccolormgmtenginefactory.h"
 #include "pageitem_arc.h"
 #include "pageitem_group.h"
 #include "pageitem_regularpolygon.h"
@@ -4626,70 +4627,34 @@
 
 bool ScribusDoc::useImageEffects() const
 {
-	QList<PageItem*> allItems;
-	const QList<PageItem*>* itemLists[] = { &MasterItems, &DocItems };
-
-	for (int i = 0; i < 2; ++i)
+	QList<PageItem*> frameItemList = FrameItems.values();
+	const QList<PageItem*>* itemLists[] = { &MasterItems, &DocItems, &frameItemList };
+	PageItemIterator it;
+
+	for (int i = 0; i < 3; ++i)
 	{
 		const auto& itemList = *(itemLists[i]);
-		for (int j = 0; j < itemList.count(); ++j)
-		{
-			PageItem *currItem = itemList.at(j);
-			if (currItem->isGroup())
-				allItems = currItem->getAllChildren();
-			else
-				allItems.append(currItem);
-			for (int k = 0; k < allItems.count(); k++)
-			{
-				currItem = allItems.at(k);
-				if (!currItem->isImageFrame() || !currItem->imageIsAvailable)
-					continue;
-				if (currItem->effectsInUse.count() > 0)
-					return true;
-			}
-			allItems.clear();
-		}
-	}
-
-	for (auto it = FrameItems.begin(); it != FrameItems.end(); ++it)
-	{
-		PageItem *currItem = it.value();
-		if (currItem->isGroup())
-			allItems = currItem->getAllChildren();
-		else
-			allItems.append(currItem);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			currItem = allItems.at(ii);
+		for (it.begin(itemList); *it; ++it)
+		{
+			PageItem *currItem = *it;
 			if (!currItem->isImageFrame() || !currItem->imageIsAvailable)
 				continue;
 			if (currItem->effectsInUse.count() > 0)
 				return true;
 		}
-		allItems.clear();
 	}
 
 	QStringList patterns = docPatterns.keys();
 	for (int i = 0; i < patterns.count(); ++i)
 	{
 		ScPattern pa = docPatterns[patterns[i]];
-		for (int j = 0; j < pa.items.count(); j++)
-		{
-			PageItem *currItem = pa.items.at(j);
-			if (currItem->isGroup())
-				allItems = currItem->getAllChildren();
-			else
-				allItems.append(currItem);
-
-			for (int k = 0; k < allItems.count(); k++)
-			{
-				currItem = allItems.at(k);
-				if (!currItem->isImageFrame() || !currItem->imageIsAvailable)
-					continue;
-				if (currItem->effectsInUse.count() > 0)
-					return true;
-			}
-			allItems.clear();
+		for (it.begin(pa.items); *it; ++it)
+		{
+			PageItem *currItem = *it;
+			if (!currItem->isImageFrame() || !currItem->imageIsAvailable)
+				continue;
+			if (currItem->effectsInUse.count() > 0)
+				return true;
 		}
 	}
 
@@ -4698,72 +4663,34 @@
 
 bool ScribusDoc::useImageColorEffects() const
 {
-	QList<PageItem*> allItems;
-	const QList<PageItem*>* itemLists[] = { &MasterItems, &DocItems };
-
-	for (int i = 0; i < 2; ++i)
+	QList<PageItem*> frameItemList = FrameItems.values();
+	const QList<PageItem*>* itemLists[] = { &MasterItems, &DocItems, &frameItemList };
+	PageItemIterator it;
+
+	for (int i = 0; i < 3; ++i)
 	{
 		const auto& itemList = *(itemLists[i]);
-		for (int j = 0; j < itemList.count(); ++j)
-		{
-			PageItem *currItem = itemList.at(j);
-			if (currItem->isGroup())
-				allItems = currItem->getAllChildren();
-			else
-				allItems.append(currItem);
-
-			for (int k = 0; k < allItems.count(); k++)
-			{
-				currItem = allItems.at(k);
-				if (!currItem->isImageFrame() || !currItem->imageIsAvailable)
-					continue;
-				if (currItem->effectsInUse.useColorEffect())
-					return true;
-			}
-			allItems.clear();
-		}
-	}
-
-	for (auto it = FrameItems.begin(); it != FrameItems.end(); ++it)
-	{
-		PageItem *currItem = it.value();
-		if (currItem->isGroup())
-			allItems = currItem->getAllChildren();
-		else
-			allItems.append(currItem);
-
-		for (int j = 0; j < allItems.count(); j++)
-		{
-			currItem = allItems.at(j);
+		for (it.begin(itemList); *it; ++it)
+		{
+			PageItem *currItem = *it;
 			if (!currItem->isImageFrame() || !currItem->imageIsAvailable)
 				continue;
 			if (currItem->effectsInUse.useColorEffect())
 				return true;
 		}
-		allItems.clear();
 	}
 
 	QStringList patterns = docPatterns.keys();
 	for (int i = 0; i < patterns.count(); ++i)
 	{
 		ScPattern pa = docPatterns[patterns[i]];
-		for (int j = 0; j < pa.items.count(); j++)
-		{
-			PageItem *currItem = pa.items.at(j);
-			if (currItem->isGroup())
-				allItems = currItem->getAllChildren();
-			else
-				allItems.append(currItem);
-
-			for (int k = 0; k < allItems.count(); k++)
-			{
-				currItem = allItems.at(k);
-				if (!currItem->isImageFrame() || !currItem->imageIsAvailable)
-					continue;
-				if (currItem->effectsInUse.useColorEffect())
-					return true;
-			}
-			allItems.clear();
+		for (it.begin(pa.items); *it; ++it)
+		{
+			PageItem *currItem = *it;
+			if (!currItem->isImageFrame() || !currItem->imageIsAvailable)
+				continue;
+			if (currItem->effectsInUse.useColorEffect())
+				return true;
 		}
 	}
 
@@ -10240,89 +10167,164 @@
 //CB Same as updatePict apart from the name checking, this should be able to be removed
 void ScribusDoc::recalcPicturesRes(int recalcFlags)
 {
-	int ca = 0;
+	int imageCount = 0;
+	int progress = 0;
+	PageItemIterator itemIt;
 	ScGuardedPtr<ScribusDoc> docPtr = guardedPtr();
+	QList<PageItem*> frameItemList = FrameItems.values();
+	QStringList patterns = docPatterns.keys();
+
+	for (itemIt.begin(DocItems); *itemIt; ++itemIt)
+	{
+		PageItem *currItem = *itemIt;
+		if (currItem->imageIsAvailable)
+			imageCount++;
+	}
+	for (itemIt.begin(MasterItems); *itemIt; ++itemIt)
+	{
+		PageItem *currItem = *itemIt;
+		if (currItem->imageIsAvailable)
+			imageCount++;
+	}
+	for (itemIt.begin(frameItemList); *itemIt; ++itemIt)
+	{
+		PageItem *currItem = *itemIt;
+		if (currItem->imageIsAvailable)
+			imageCount++;
+	}
+	for (int c = 0; c < patterns.count(); ++c)
+	{
+		ScPattern pa = docPatterns[patterns[c]];
+		for (itemIt.begin(pa.items); *itemIt; ++itemIt)
+		{
+			PageItem *currItem = *itemIt;
+			if (currItem->imageIsAvailable)
+				imageCount++;
+		}
+	}
+	
+	if (imageCount <= 0)
+		return;
+
 	m_ScMW->mainWindowProgressBar->reset();
-	QList<PageItem*> allItems;
-	QStringList patterns = docPatterns.keys();
-	int cc = 0;
-	for (int a = 0; a < DocItems.count(); ++a)
-	{
-		PageItem *currItem = DocItems.at(a);
-		if (currItem->isGroup())
-			allItems = currItem->getAllChildren();
+	m_ScMW->mainWindowProgressBar->setMaximum((imageCount > 0) ? imageCount : 1);
+
+	for (itemIt.begin(DocItems); *itemIt; ++itemIt)
+	{
+		PageItem *currItem = *itemIt;
+		if (!currItem->imageIsAvailable)
+			continue;
+		if (recalcFlags & (RecalcPicRes_ImageWithEffectsOnly | RecalcPicRes_ImageWithColorEffectsOnly))
+		{
+			if (currItem->effectsInUse.count() <= 0)
+				continue;
+		}
+		if (recalcFlags & RecalcPicRes_ImageWithColorEffectsOnly)
+		{
+			if (!currItem->effectsInUse.useColorEffect())
+				continue;
+		}
+		bool fho = currItem->imageFlippedH();
+		bool fvo = currItem->imageFlippedV();
+		double imgX = currItem->imageXOffset();
+		double imgY = currItem->imageYOffset();
+		if (recalcFlags & RecalcPicRes_ApplyNewRes)
+			currItem->pixm.imgInfo.lowResType = m_docPrefsData.itemToolPrefs.imageLowResType;
+		if (currItem->isLatexFrame())
+			currItem->asLatexFrame()->rerunApplication(false);
 		else
-			allItems.append(currItem);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			currItem = allItems.at(ii);
-			if (currItem->imageIsAvailable)
-				cc++;
-		}
-		allItems.clear();
-	}
-	for (int a = 0; a < MasterItems.count(); ++a)
-	{
-		PageItem *currItem = MasterItems.at(a);
-		if (currItem->isGroup())
-			allItems = currItem->getAllChildren();
+			loadPict(currItem->Pfile, currItem, true);
+		currItem->setImageFlippedH(fho);
+		currItem->setImageFlippedV(fvo);
+		currItem->setImageXOffset(imgX);
+		currItem->setImageYOffset(imgY);
+		currItem->adjustPictScale();
+		progress++;
+		m_ScMW->mainWindowProgressBar->setValue(progress);
+		qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+		if (!docPtr) return;
+	}
+
+	for (itemIt.begin(MasterItems); *itemIt; ++itemIt)
+	{
+		PageItem *currItem = *itemIt;
+		if (!currItem->imageIsAvailable)
+			continue;
+		if (recalcFlags & (RecalcPicRes_ImageWithEffectsOnly | RecalcPicRes_ImageWithColorEffectsOnly))
+		{
+			if (currItem->effectsInUse.count() <= 0)
+				continue;
+		}
+		if (recalcFlags & RecalcPicRes_ImageWithColorEffectsOnly)
+		{
+			if (!currItem->effectsInUse.useColorEffect())
+				continue;
+		}
+		bool fho = currItem->imageFlippedH();
+		bool fvo = currItem->imageFlippedV();
+		double imgX = currItem->imageXOffset();
+		double imgY = currItem->imageYOffset();
+		if (recalcFlags & RecalcPicRes_ApplyNewRes)
+			currItem->pixm.imgInfo.lowResType = m_docPrefsData.itemToolPrefs.imageLowResType;
+		if (currItem->isLatexFrame())
+			currItem->asLatexFrame()->rerunApplication(false);
 		else
-			allItems.append(currItem);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			currItem = allItems.at(ii);
-			if (currItem->imageIsAvailable)
-				cc++;
-		}
-		allItems.clear();
-	}
-	for (auto it = FrameItems.begin(); it != FrameItems.end(); ++it)
-	{
-		PageItem *currItem = it.value();
-		if (currItem->isGroup())
-			allItems = currItem->getAllChildren();
+			loadPict(currItem->Pfile, currItem, true);
+		currItem->setImageFlippedH(fho);
+		currItem->setImageFlippedV(fvo);
+		currItem->setImageXOffset(imgX);
+		currItem->setImageYOffset(imgY);
+		currItem->adjustPictScale();
+		progress++;
+		m_ScMW->mainWindowProgressBar->setValue(progress);
+		qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+		if (!docPtr) return;
+	}
+
+	for (itemIt.begin(frameItemList); *itemIt; ++itemIt)
+	{
+		PageItem *currItem = *itemIt;
+		if (!currItem->imageIsAvailable)
+			continue;
+		if (recalcFlags & (RecalcPicRes_ImageWithEffectsOnly | RecalcPicRes_ImageWithColorEffectsOnly))
+		{
+			if (currItem->effectsInUse.count() <= 0)
+				continue;
+		}
+		if (recalcFlags & RecalcPicRes_ImageWithColorEffectsOnly)
+		{
+			if (!currItem->effectsInUse.useColorEffect())
+				continue;
+		}
+		bool fho = currItem->imageFlippedH();
+		bool fvo = currItem->imageFlippedV();
+		double imgX = currItem->imageXOffset();
+		double imgY = currItem->imageYOffset();
+		if (recalcFlags & RecalcPicRes_ApplyNewRes)
+			currItem->pixm.imgInfo.lowResType = m_docPrefsData.itemToolPrefs.imageLowResType;
+		if (currItem->isLatexFrame())
+			currItem->asLatexFrame()->rerunApplication(false);
 		else
-			allItems.append(currItem);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			currItem = allItems.at(ii);
-			if (currItem->imageIsAvailable)
-				cc++;
-		}
-		allItems.clear();
-	}
-	for (int c = 0; c < patterns.count(); ++c)
-	{
-		ScPattern pa = docPatterns[patterns[c]];
-		for (int o = 0; o < pa.items.count(); o++)
-		{
-			PageItem *currItem = pa.items.at(o);
-			if (currItem->isGroup())
-				allItems = currItem->getAllChildren();
-			else
-				allItems.append(currItem);
-			for (int ii = 0; ii < allItems.count(); ii++)
-			{
-				currItem = allItems.at(ii);
-				if (currItem->imageIsAvailable)
-					cc++;
-			}
-			allItems.clear();
-		}
-	}
-
-	m_ScMW->mainWindowProgressBar->setMaximum((cc > 0) ? cc : 1);
-
-	for (int a = 0; a < DocItems.count(); ++a)
-	{
-		PageItem *currItem = DocItems.at(a);
-		if (currItem->isGroup())
-			allItems = currItem->getAllChildren();
-		else
-			allItems.append(currItem);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			currItem = allItems.at(ii);
+			loadPict(currItem->Pfile, currItem, true);
+		currItem->setImageFlippedH(fho);
+		currItem->setImageFlippedV(fvo);
+		currItem->setImageXOffset(imgX);
+		currItem->setImageYOffset(imgY);
+		currItem->adjustPictScale();
+		progress++;
+		m_ScMW->mainWindowProgressBar->setValue(progress);
+		qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+		if (!docPtr) return;
+	}
+
+	for (int i = 0; i < patterns.count(); ++i)
+	{
+		ScPattern pa = docPatterns[patterns[i]];
+		if (pa.items.count() <= 0)
+			continue;
+		for (itemIt.begin(pa.items); *itemIt; ++itemIt)
+		{
+			PageItem *currItem = *itemIt;
 			if (!currItem->imageIsAvailable)
 				continue;
 			if (recalcFlags & (RecalcPicRes_ImageWithEffectsOnly | RecalcPicRes_ImageWithColorEffectsOnly))
@@ -10350,151 +10352,10 @@
 			currItem->setImageXOffset(imgX);
 			currItem->setImageYOffset(imgY);
 			currItem->adjustPictScale();
-			ca++;
-			m_ScMW->mainWindowProgressBar->setValue(ca);
+			progress++;
+			m_ScMW->mainWindowProgressBar->setValue(progress);
 			qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
 			if (!docPtr) return;
-		}
-		allItems.clear();
-	}
-
-	for (int a = 0; a < MasterItems.count(); ++a)
-	{
-		PageItem *currItem = MasterItems.at(a);
-		if (currItem->isGroup())
-			allItems = currItem->getAllChildren();
-		else
-			allItems.append(currItem);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			currItem = allItems.at(ii);
-			if (!currItem->imageIsAvailable)
-				continue;
-			if (recalcFlags & (RecalcPicRes_ImageWithEffectsOnly | RecalcPicRes_ImageWithColorEffectsOnly))
-			{
-				if (currItem->effectsInUse.count() <= 0)
-					continue;
-			}
-			if (recalcFlags & RecalcPicRes_ImageWithColorEffectsOnly)
-			{
-				if (!currItem->effectsInUse.useColorEffect())
-					continue;
-			}
-			bool fho = currItem->imageFlippedH();
-			bool fvo = currItem->imageFlippedV();
-			double imgX = currItem->imageXOffset();
-			double imgY = currItem->imageYOffset();
-			if (recalcFlags & RecalcPicRes_ApplyNewRes)
-				currItem->pixm.imgInfo.lowResType = m_docPrefsData.itemToolPrefs.imageLowResType;
-			if (currItem->isLatexFrame())
-				currItem->asLatexFrame()->rerunApplication(false);
-			else
-				loadPict(currItem->Pfile, currItem, true);
-			currItem->setImageFlippedH(fho);
-			currItem->setImageFlippedV(fvo);
-			currItem->setImageXOffset(imgX);
-			currItem->setImageYOffset(imgY);
-			currItem->adjustPictScale();
-			ca++;
-			m_ScMW->mainWindowProgressBar->setValue(ca);
-			qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
-			if (!docPtr) return;
-		}
-		allItems.clear();
-	}
-
-	for (auto it = FrameItems.begin(); it != FrameItems.end(); ++it)
-	{
-		PageItem *currItem = it.value();
-		if (currItem->isGroup())
-			allItems = currItem->getAllChildren();
-		else
-			allItems.append(currItem);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			currItem = allItems.at(ii);
-			if (!currItem->imageIsAvailable)
-				continue;
-			if (recalcFlags & (RecalcPicRes_ImageWithEffectsOnly | RecalcPicRes_ImageWithColorEffectsOnly))
-			{
-				if (currItem->effectsInUse.count() <= 0)
-					continue;
-			}
-			if (recalcFlags & RecalcPicRes_ImageWithColorEffectsOnly)
-			{
-				if (!currItem->effectsInUse.useColorEffect())
-					continue;
-			}
-			bool fho = currItem->imageFlippedH();
-			bool fvo = currItem->imageFlippedV();
-			double imgX = currItem->imageXOffset();
-			double imgY = currItem->imageYOffset();
-			if (recalcFlags & RecalcPicRes_ApplyNewRes)
-				currItem->pixm.imgInfo.lowResType = m_docPrefsData.itemToolPrefs.imageLowResType;
-			if (currItem->isLatexFrame())
-				currItem->asLatexFrame()->rerunApplication(false);
-			else
-				loadPict(currItem->Pfile, currItem, true);
-			currItem->setImageFlippedH(fho);
-			currItem->setImageFlippedV(fvo);
-			currItem->setImageXOffset(imgX);
-			currItem->setImageYOffset(imgY);
-			currItem->adjustPictScale();
-			ca++;
-			m_ScMW->mainWindowProgressBar->setValue(ca);
-			qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
-			if (!docPtr) return;
-		}
-		allItems.clear();
-	}
-	for (int c = 0; c < patterns.count(); ++c)
-	{
-		ScPattern pa = docPatterns[patterns[c]];
-		if (pa.items.count() <= 0)
-			continue;
-		for (int o = 0; o < pa.items.count(); o++)
-		{
-			PageItem *currItem = pa.items.at(o);
-			if (currItem->isGroup())
-				allItems = currItem->getAllChildren();
-			else
-				allItems.append(currItem);
-			for (int ii = 0; ii < allItems.count(); ii++)
-			{
-				currItem = allItems.at(ii);
-				if (!currItem->imageIsAvailable)
-					continue;
-				if (recalcFlags & (RecalcPicRes_ImageWithEffectsOnly | RecalcPicRes_ImageWithColorEffectsOnly))
-				{
-					if (currItem->effectsInUse.count() <= 0)
-						continue;
-				}
-				if (recalcFlags & RecalcPicRes_ImageWithColorEffectsOnly)
-				{
-					if (!currItem->effectsInUse.useColorEffect())
-						continue;
-				}
-				bool fho = currItem->imageFlippedH();
-				bool fvo = currItem->imageFlippedV();
-				double imgX = currItem->imageXOffset();
-				double imgY = currItem->imageYOffset();
-				if (recalcFlags & RecalcPicRes_ApplyNewRes)
-					currItem->pixm.imgInfo.lowResType = m_docPrefsData.itemToolPrefs.imageLowResType;
-				if (currItem->isLatexFrame())
-					currItem->asLatexFrame()->rerunApplication(false);
-				else
-					loadPict(currItem->Pfile, currItem, true);
-				currItem->setImageFlippedH(fho);
-				currItem->setImageFlippedV(fvo);
-				currItem->setImageXOffset(imgX);
-				currItem->setImageYOffset(imgY);
-				currItem->adjustPictScale();
-				ca++;
-				m_ScMW->mainWindowProgressBar->setValue(ca);
-				qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
-				if (!docPtr) return;
-			}
-			allItems.clear();
 		}
 		PageItem *ite = pa.items.at(0);
 		double minx =  std::numeric_limits<double>::max();
@@ -10507,7 +10368,7 @@
 		miny = qMin(miny, y1);
 		maxx = qMax(maxx, x2);
 		maxy = qMax(maxy, y2);
-		docPatterns[patterns[c]].pattern = ite->DrawObj_toImage(qMin(qMax(maxx - minx, maxy - miny), 500.0));
+		docPatterns[patterns[i]].pattern = ite->DrawObj_toImage(qMin(qMax(maxx - minx, maxy - miny), 500.0));
 	}
 	regionsChanged()->update(QRectF());
 	changed();




More information about the scribus-commit mailing list