r16148 by fschmid - Made our internal Picture Browser working again.

scribus-commit scribus-commit at lists.scribus.net
Wed Dec 22 14:46:21 CET 2010


Author: fschmid
Date: Wed Dec 22 13:46:20 2010
New Revision: 16148

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16148
Log:
Made our internal Picture Browser working again.

Modified:
    trunk/Scribus/scribus/collect4output.cpp
    trunk/Scribus/scribus/documentchecker.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/ui/picstatus.cpp
    trunk/Scribus/scribus/ui/picstatus.h

Modified: trunk/Scribus/scribus/collect4output.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16148&path=/trunk/Scribus/scribus/collect4output.cpp
==============================================================================
--- trunk/Scribus/scribus/collect4output.cpp (original)
+++ trunk/Scribus/scribus/collect4output.cpp Wed Dec 22 13:46:20 2010
@@ -212,6 +212,7 @@
 				ite = allItems.at(ii);
 				processItem(ite);
 			}
+			allItems.clear();
 			if (uiCollect)
 				emit itemsCollected(c++);
 		}
@@ -231,6 +232,7 @@
 				ite = allItems.at(ii);
 				processItem(ite);
 			}
+			allItems.clear();
 		}
 		if (uiCollect)
 			emit patternsCollected(c);

Modified: trunk/Scribus/scribus/documentchecker.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16148&path=/trunk/Scribus/scribus/documentchecker.cpp
==============================================================================
--- trunk/Scribus/scribus/documentchecker.cpp (original)
+++ trunk/Scribus/scribus/documentchecker.cpp Wed Dec 22 13:46:20 2010
@@ -349,6 +349,7 @@
 			if (itemError.count() != 0)
 				currDoc->masterItemErrors.insert(currItem, itemError);
 		}
+		allItems.clear();
 	}
 	allItems.clear();
 	uint docItemsCount = currDoc->DocItems.count();
@@ -611,6 +612,7 @@
 			if (itemError.count() != 0)
 				currDoc->docItemErrors.insert(currItem, itemError);
 		}
+		allItems.clear();
 	}
 	return ((currDoc->docItemErrors.count() != 0) || (currDoc->masterItemErrors.count() != 0) || (currDoc->docLayerErrors.count() != 0));
 }

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16148&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Dec 22 13:46:20 2010
@@ -2109,17 +2109,28 @@
 	bool enablePicManager = false;
 	if (HaveDoc)
 	{
+		QList<PageItem*> allItems;
 		for (int i = 0; i < doc->Items->count(); ++i)
 		{
+			PageItem *currItem = doc->Items->at(i);
+			if (currItem->isGroup())
+				allItems = currItem->getItemList();
+			else
+				allItems.append(currItem);
+			for (int ii = 0; ii < allItems.count(); ii++)
+			{
+				PageItem* item = allItems.at(ii);
 #ifdef HAVE_OSG
-			if ((doc->Items->at(i)->itemType() == PageItem::ImageFrame) && (!((doc->Items->at(i)->asLatexFrame()) || (doc->Items->at(i)->asOSGFrame()))))
+				if ((item->itemType() == PageItem::ImageFrame) && (!((item->asLatexFrame()) || (item->asOSGFrame()))))
 #else
-			if ((doc->Items->at(i)->itemType() == PageItem::ImageFrame) && (!(doc->Items->at(i)->asLatexFrame())))
+				if ((item->itemType() == PageItem::ImageFrame) && (!(item->asLatexFrame())))
 #endif
-			{
-				enablePicManager = true;
-				break;
-			}
+				{
+					enablePicManager = true;
+					break;
+				}
+			}
+			allItems.clear();
 		}
 	}
 	scrActions["extrasManageImages"]->setEnabled(enablePicManager);
@@ -9095,7 +9106,7 @@
 		PicStatus *dia = new PicStatus(this, doc);
 		connect(dia, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int)));
 		connect(dia, SIGNAL(selectMasterPage(QString)), this, SLOT(manageMasterPages(QString)));
-		connect(dia, SIGNAL(selectElement(int, int, bool)), this, SLOT(selectItemsFromOutlines(int, int, bool)));
+		connect(dia, SIGNAL(selectElementByItem(PageItem *, bool)), this, SLOT(selectItemsFromOutlines(PageItem *, bool)));
 //		connect(dia, SIGNAL(refreshItem(PageItem*)), view, SLOT(RefreshItem(PageItem*)));
 		dia->exec();
 		delete dia;

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16148&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Wed Dec 22 13:46:20 2010
@@ -500,6 +500,7 @@
 				ScCore->fileWatcher->removeDir(fi.absolutePath());
 			}
 		}
+		allItems.clear();
 	}
 	for (int a = 0; a < MasterItems.count(); ++a)
 	{
@@ -519,6 +520,7 @@
 				ScCore->fileWatcher->removeDir(fi.absolutePath());
 			}
 		}
+		allItems.clear();
 	}
 	for (int a = 0; a < FrameItems.count(); ++a)
 	{
@@ -538,6 +540,7 @@
 				ScCore->fileWatcher->removeDir(fi.absolutePath());
 			}
 		}
+		allItems.clear();
 	}
 	QStringList patterns = docPatterns.keys();
 	for (int c = 0; c < patterns.count(); ++c)
@@ -563,6 +566,7 @@
 					}
 				}
 			}
+			allItems.clear();
 		}
 		while (!pa.items.isEmpty())
 		{
@@ -2597,6 +2601,7 @@
 			if (currItem->LayerID == layerID)
 				return true;
 		}
+		allItems.clear();
 	}
 	uint docItemsCount=DocItems.count();
 	for (uint i = 0; i < docItemsCount; ++i)
@@ -2612,6 +2617,7 @@
 			if (currItem->LayerID == layerID)
 				return true;
 		}
+		allItems.clear();
 	}
 	return false;
 }
@@ -2851,6 +2857,7 @@
 					results.append(currItem->patternMask());
 			}
 		}
+		allItems.clear();
 	}
 	for (int c = 0; c < DocItems.count(); ++c)
 	{
@@ -2875,6 +2882,7 @@
 					results.append(currItem->patternMask());
 			}
 		}
+		allItems.clear();
 	}
 	for (int c = 0; c < FrameItems.count(); ++c)
 	{
@@ -2899,6 +2907,7 @@
 					results.append(currItem->patternMask());
 			}
 		}
+		allItems.clear();
 	}
 	for (QMap<QString, ScPattern>::Iterator it = docPatterns.begin(); it != docPatterns.end(); ++it)
 	{
@@ -2925,6 +2934,7 @@
 				if (!pat3.isEmpty() && !results.contains(pat3))
 					results.append(pat3);
 			}
+			allItems.clear();
 		}
 	}
 	return results;
@@ -3072,6 +3082,7 @@
 			if ((!results.contains(currItem->strokePattern())) && ((!currItem->strokePattern().isEmpty()) && (currItem->patternStrokePath)))
 				results.append(currItem->pattern());
 		}
+		allItems.clear();
 	}
 	for (int c = 0; c < DocItems.count(); ++c)
 	{
@@ -3091,6 +3102,7 @@
 					results.append(currItem->strokePattern());
 			}
 		}
+		allItems.clear();
 	}
 	for (int c = 0; c < FrameItems.count(); ++c)
 	{
@@ -3110,6 +3122,7 @@
 					results.append(currItem->strokePattern());
 			}
 		}
+		allItems.clear();
 	}
 	for (QMap<QString, ScPattern>::Iterator it = docPatterns.begin(); it != docPatterns.end(); ++it)
 	{
@@ -3131,6 +3144,7 @@
 						results.append(currItem->strokePattern());
 				}
 			}
+			allItems.clear();
 		}
 	}
 	return results;
@@ -3220,6 +3234,7 @@
 					}
 				}
 			}
+			allItems.clear();
 		}
 	}
 	QMap<QString,int>::Iterator itfo, itnext;
@@ -3282,6 +3297,7 @@
 				it = allItems.at(ii);
 				checkItemForFonts(it, Really, lc);
 			}
+			allItems.clear();
 		}
 	}
 	QStringList patterns = getUsedPatterns();
@@ -3300,6 +3316,7 @@
 				it = allItems.at(ii);
 				checkItemForFonts(it, Really, 3);
 			}
+			allItems.clear();
 		}
 	}
 }
@@ -3520,6 +3537,7 @@
 					continue;
 				profileNames.append(it->IProfile);
 			}
+			allItems.clear();
 		}
 	}
 
@@ -6218,6 +6236,7 @@
 				}
 			}
 		}
+		allItems.clear();
 	}
 	for (int c = 0; c < MasterItems.count(); ++c)
 	{
@@ -6241,6 +6260,7 @@
 				}
 			}
 		}
+		allItems.clear();
 	}
 	for (int c = 0; c < FrameItems.count(); ++c)
 	{
@@ -6264,6 +6284,7 @@
 				}
 			}
 		}
+		allItems.clear();
 	}
 	QStringList patterns = docPatterns.keys();
 	for (int c = 0; c < patterns.count(); ++c)
@@ -6291,6 +6312,7 @@
 					}
 				}
 			}
+			allItems.clear();
 		}
 	}
 }
@@ -6339,6 +6361,7 @@
 					loadPict(it->Pfile, it, true);
 				}
 			}
+			allItems.clear();
 			if (usingGUI)
 			{
 				++counter;
@@ -7846,6 +7869,7 @@
 				currItem->setImageFlippedV(fvo);
 			}
 		}
+		allItems.clear();
 	}
 	for (int a = 0; a < MasterItems.count(); ++a)
 	{
@@ -7866,6 +7890,7 @@
 				currItem->setImageFlippedV(fvo);
 			}
 		}
+		allItems.clear();
 	}
 	for (int a = 0; a <FrameItems.count(); ++a)
 	{
@@ -7886,6 +7911,7 @@
 				currItem->setImageFlippedV(fvo);
 			}
 		}
+		allItems.clear();
 	}
 	QStringList patterns = docPatterns.keys();
 	for (int c = 0; c < patterns.count(); ++c)
@@ -7910,6 +7936,7 @@
 					currItem->setImageFlippedV(fvo);
 				}
 			}
+			allItems.clear();
 		}
 		PageItem *ite = pa.items.at(0);
 		docPatterns[patterns[c]].pattern = ite->DrawObj_toImage(pa.items);
@@ -7951,6 +7978,7 @@
 				}
 			}
 		}
+		allItems.clear();
 	}
 	for (int a = 0; a < MasterItems.count(); ++a)
 	{
@@ -7982,6 +8010,7 @@
 				}
 			}
 		}
+		allItems.clear();
 	}
 	for (int a = 0; a <FrameItems.count(); ++a)
 	{
@@ -8013,6 +8042,7 @@
 				}
 			}
 		}
+		allItems.clear();
 	}
 	QStringList patterns = docPatterns.keys();
 	for (int c = 0; c < patterns.count(); ++c)
@@ -8048,6 +8078,7 @@
 					}
 				}
 			}
+			allItems.clear();
 			PageItem *ite = pa.items.at(0);
 			docPatterns[patterns[c]].pattern = ite->DrawObj_toImage(pa.items);
 		}
@@ -8077,6 +8108,7 @@
 			if (currItem->PictureIsAvailable)
 				cc++;
 		}
+		allItems.clear();
 	}
 	for (int a = 0; a < MasterItems.count(); ++a)
 	{
@@ -8091,6 +8123,7 @@
 			if (currItem->PictureIsAvailable)
 				cc++;
 		}
+		allItems.clear();
 	}
 	for (int a = 0; a < FrameItems.count(); ++a)
 	{
@@ -8105,6 +8138,7 @@
 			if (currItem->PictureIsAvailable)
 				cc++;
 		}
+		allItems.clear();
 	}
 	QStringList patterns = docPatterns.keys();
 	for (int c = 0; c < patterns.count(); ++c)
@@ -8123,6 +8157,7 @@
 				if (currItem->PictureIsAvailable)
 					cc++;
 			}
+			allItems.clear();
 		}
 	}
 	m_ScMW->mainWindowProgressBar->setMaximum((cc > 0) ? cc : 1);
@@ -8155,6 +8190,7 @@
 				if (!docPtr) return;
 			}
 		}
+		allItems.clear();
 	}
 	for (int a = 0; a < MasterItems.count(); ++a)
 	{
@@ -8185,6 +8221,7 @@
 				if (!docPtr) return;
 			}
 		}
+		allItems.clear();
 	}
 	for (int a = 0; a < FrameItems.count(); ++a)
 	{
@@ -8215,6 +8252,7 @@
 				if (!docPtr) return;
 			}
 		}
+		allItems.clear();
 	}
 	for (int c = 0; c < patterns.count(); ++c)
 	{
@@ -8248,6 +8286,7 @@
 					if (!docPtr) return;
 				}
 			}
+			allItems.clear();
 		}
 		PageItem *ite = pa.items.at(0);
 		docPatterns[patterns[c]].pattern = ite->DrawObj_toImage(pa.items);
@@ -8277,6 +8316,7 @@
 				currItem->pixm = ScImage();
 			}
 		}
+		allItems.clear();
 	}
 	for (int a = 0; a < MasterItems.count(); ++a)
 	{
@@ -8294,6 +8334,7 @@
 				currItem->pixm = ScImage();
 			}
 		}
+		allItems.clear();
 	}
 	for (int a = 0; a < FrameItems.count(); ++a)
 	{
@@ -8311,6 +8352,7 @@
 				currItem->pixm = ScImage();
 			}
 		}
+		allItems.clear();
 	}
 	QStringList patterns = docPatterns.keys();
 	for (int c = 0; c < patterns.count(); ++c)
@@ -8332,6 +8374,7 @@
 					currItem->pixm = ScImage();
 				}
 			}
+			allItems.clear();
 		}
 		PageItem *ite = pa.items.at(0);
 		docPatterns[patterns[c]].pattern = ite->DrawObj_toImage(pa.items);
@@ -8443,6 +8486,7 @@
 					currItem->setLayer(newLayerID);
 			}
 		}
+		allItems.clear();
 	}
 	if (tmpSelection.count() != 0)
 		itemSelection_DeleteItem(&tmpSelection);
@@ -8930,6 +8974,7 @@
 				}
 			}
 		}
+		allItems.clear();
 	}
 	for (int c=0; c<MasterItems.count(); ++c)
 	{
@@ -8951,6 +8996,7 @@
 				}
 			}
 		}
+		allItems.clear();
 	}
 	for (int c=0; c<FrameItems.count(); ++c)
 	{
@@ -8972,6 +9018,7 @@
 				}
 			}
 		}
+		allItems.clear();
 	}
 	
 	if (!found) //No image frames in the current selection!
@@ -10942,6 +10989,7 @@
 			ite = allItems.at(ii);
 			ite->invalidateLayout();
 		}
+		allItems.clear();
 	}
 	for (int c=0; c < MasterItems.count(); ++c)
 	{
@@ -10955,6 +11003,7 @@
 			ite = allItems.at(ii);
 			ite->invalidateLayout();
 		}
+		allItems.clear();
 	}
 	// for now hope that frameitems get invalidated by their parents layout() method.
 }
@@ -10975,6 +11024,7 @@
 			if (ite->LayerID == layerID)
 				ite->invalidateLayout();
 		}
+		allItems.clear();
 	}
 	if (this->masterPageMode())
 	{
@@ -10991,6 +11041,7 @@
 				if (ite->LayerID == layerID)
 					ite->invalidateLayout();
 			}
+			allItems.clear();
 		}
 	}
 	// for now hope that frameitems get invalidated by their parents layout() method.
@@ -11012,6 +11063,7 @@
 			if (ite->getBoundingRect().intersects(region))
 				ite->invalidateLayout();
 		}
+		allItems.clear();
 	}
 	for (int c=0; c<MasterItems.count(); ++c)
 	{
@@ -11026,6 +11078,7 @@
 		// for now invalidate all masteritems, should be only necessary in masterpagemode
 			ite->invalidateLayout();
 		}
+		allItems.clear();
 	}
 	// for now hope that frameitems get invalidated by their parents layout() method.
 }
@@ -13395,6 +13448,7 @@
 			if (ite->itemType() == itemType && ite->nextInChain()==NULL && !ite->isAutoFrame())
 				namesMap.insert(ite, ite->itemName());
 		}
+		allItems.clear();
 	}
 	return namesMap;
 }

Modified: trunk/Scribus/scribus/ui/picstatus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16148&path=/trunk/Scribus/scribus/ui/picstatus.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/picstatus.cpp (original)
+++ trunk/Scribus/scribus/ui/picstatus.cpp Wed Dec 22 13:46:20 2010
@@ -119,36 +119,55 @@
 	QListWidgetItem *firstItem=0;
 	QListWidgetItem *tempItem=0;
 
+	QList<PageItem*> allItems;
 	for (int i = 0; i < m_Doc->MasterItems.count(); ++i)
 	{
-		item = m_Doc->MasterItems.at(i);
-		QFileInfo fi = QFileInfo(item->Pfile);
-		QString Iname = "";
-		if (item->isInlineImage)
-			Iname = tr("Embedded Image");
+		PageItem *currItem = m_Doc->MasterItems.at(i);
+		if (currItem->isGroup())
+			allItems = currItem->getItemList();
 		else
-			Iname = fi.fileName();
-		if ((item->itemType() == PageItem::ImageFrame) && (!item->asLatexFrame()))
-			tempItem = new PicItem(imageViewArea, Iname, createImgIcon(item), item);
-		if (firstItem == 0)
-			firstItem = tempItem;
-	}
-
+			allItems.append(currItem);
+		for (int ii = 0; ii < allItems.count(); ii++)
+		{
+			item = allItems.at(ii);
+			QFileInfo fi = QFileInfo(item->Pfile);
+			QString Iname = "";
+			if (item->isInlineImage)
+				Iname = tr("Embedded Image");
+			else
+				Iname = fi.fileName();
+			if ((item->itemType() == PageItem::ImageFrame) && (!item->asLatexFrame()))
+				tempItem = new PicItem(imageViewArea, Iname, createImgIcon(item), item);
+			if (firstItem == 0)
+				firstItem = tempItem;
+		}
+		allItems.clear();
+	}
+	allItems.clear();
 	for (int i = 0; i < m_Doc->DocItems.count(); ++i)
 	{
-		item = m_Doc->DocItems.at(i);
-		QFileInfo fi = QFileInfo(item->Pfile);
-		QString Iname = "";
-		if (item->isInlineImage)
-			Iname = tr("Embedded Image");
+		PageItem *currItem = m_Doc->DocItems.at(i);
+		if (currItem->isGroup())
+			allItems = currItem->getItemList();
 		else
-			Iname = fi.fileName();
-		if ((item->itemType() == PageItem::ImageFrame) && (!item->asLatexFrame()))
-			tempItem = new PicItem(imageViewArea, Iname, createImgIcon(item), item);
-		// if an image is selected in a doc, Manage Pictures should
-		// display the selected image and its values
-		if (firstItem == 0 || item->isSelected())
-			firstItem = tempItem;
+			allItems.append(currItem);
+		for (int ii = 0; ii < allItems.count(); ii++)
+		{
+			item = allItems.at(ii);
+			QFileInfo fi = QFileInfo(item->Pfile);
+			QString Iname = "";
+			if (item->isInlineImage)
+				Iname = tr("Embedded Image");
+			else
+				Iname = fi.fileName();
+			if ((item->itemType() == PageItem::ImageFrame) && (!item->asLatexFrame()))
+				tempItem = new PicItem(imageViewArea, Iname, createImgIcon(item), item);
+			// if an image is selected in a doc, Manage Pictures should
+			// display the selected image and its values
+			if (firstItem == 0 || item->isSelected())
+				firstItem = tempItem;
+		}
+		allItems.clear();
 	}
 	imageViewArea->setCurrentItem(firstItem);
 	if (firstItem!=0)
@@ -391,15 +410,7 @@
 		return;
 
 	ScCore->primaryMainWindow()->closeActiveWindowMasterPageEditor();
-	if (!currItem->isGroup())
-		emit selectElement(currItem->OwnPage, currItem->ItemNr, false);
-	else
-	{
-		if (currItem->isGroup())
-			emit selectElement(currItem->OwnPage, currItem->ItemNr, false);
-		else
-			emit selectElement(currItem->OwnPage, currItem->ItemNr, true);
-	}
+	emit selectElementByItem(currItem, true);
 }
 
 bool PicStatus::loadPict(const QString & newFilePath)

Modified: trunk/Scribus/scribus/ui/picstatus.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16148&path=/trunk/Scribus/scribus/ui/picstatus.h
==============================================================================
--- trunk/Scribus/scribus/ui/picstatus.h (original)
+++ trunk/Scribus/scribus/ui/picstatus.h Wed Dec 22 13:46:20 2010
@@ -86,7 +86,7 @@
 signals:
 	void selectPage(int);
 	void selectMasterPage(QString);
-	void selectElement(int, int, bool);
+	void selectElementByItem(PageItem *, bool);
 	void refreshItem(PageItem*);
 
 protected:




More information about the scribus-commit mailing list