r15538 by jghali - merge trunk revisions up to r15534

scribus-commit scribus-commit at lists.scribus.net
Thu Oct 14 23:28:41 CEST 2010


Author: jghali
Date: Thu Oct 14 21:28:40 2010
New Revision: 15538

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15538
Log:
merge trunk revisions up to r15534

Added:
    branches/ScribusOIF/resources/icons/folder.png
      - copied unchanged from r15536, trunk/Scribus/resources/icons/folder.png
Modified:
    branches/ScribusOIF/scribus/pageitem.cpp
    branches/ScribusOIF/scribus/pageitem_textframe.cpp
    branches/ScribusOIF/scribus/pagestructs.h
    branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
    branches/ScribusOIF/scribus/scribus.cpp
    branches/ScribusOIF/scribus/scribusdoc.cpp
    branches/ScribusOIF/scribus/scribusdoc.h
    branches/ScribusOIF/scribus/ui/prefs_documentsections.cpp
    branches/ScribusOIF/scribus/ui/prefs_documentsectionsbase.ui
    branches/ScribusOIF/scribus/ui/scrapbookpalette.cpp
    branches/ScribusOIF/scribus/ui/scrapbookpalette.h

Modified: branches/ScribusOIF/scribus/pageitem.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15538&path=/branches/ScribusOIF/scribus/pageitem.cpp
==============================================================================
--- branches/ScribusOIF/scribus/pageitem.cpp (original)
+++ branches/ScribusOIF/scribus/pageitem.cpp Thu Oct 14 21:28:40 2010
@@ -2394,7 +2394,7 @@
 
 QString PageItem::ExpandToken(uint base)
 {
-	uint zae = 0;
+	//uint zae = 0;
 	QChar ch = itemText.text(base);
 	QString chstr = ch;
 	if (ch == SpecialChars::PAGENUMBER)
@@ -2404,9 +2404,11 @@
 			return "";
 		if ((!m_Doc->masterPageMode()) && (OwnPage != -1))
 		{
-			QString out("%1");
 			//CB Section numbering
-			chstr = out.arg(m_Doc->getSectionPageNumberForPageIndex(OwnPage), -(int)zae);
+			//chstr = out.arg(m_Doc->getSectionPageNumberForPageIndex(OwnPage), -(int)zae);
+			chstr = QString("%1").arg(m_Doc->getSectionPageNumberForPageIndex(OwnPage),
+							m_Doc->getSectionPageNumberWidthForPageIndex(OwnPage),
+							m_Doc->getSectionPageNumberFillCharForPageIndex(OwnPage));
 		}
 		else
 			return "#";
@@ -2415,11 +2417,10 @@
 	{
 		if (!m_Doc->masterPageMode())
 		{
-			QString out("%1");
 			int key = m_Doc->getSectionKeyForPageIndex(OwnPage);
 			if (key == -1)
 				return "%";
-			chstr = out.arg(getStringFromSequence(m_Doc->sections()[key].type, m_Doc->sections()[key].toindex - m_Doc->sections()[key].fromindex + 1));
+			chstr = QString("%1").arg(getStringFromSequence(m_Doc->sections()[key].type, m_Doc->sections()[key].toindex - m_Doc->sections()[key].fromindex + 1));
 		}
 		else
 			return "%";
@@ -2470,7 +2471,6 @@
 	{
 		layout.glyph = style.font().char2CMap(chars[0].unicode());
 	}
-	
 	double tracking = 0.0;
 	if ( (style.effects() & ScStyle_StartOfLine) == 0)
 		tracking = style.fontSize() * style.tracking() / 10000.0;

Modified: branches/ScribusOIF/scribus/pageitem_textframe.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15538&path=/branches/ScribusOIF/scribus/pageitem_textframe.cpp
==============================================================================
--- branches/ScribusOIF/scribus/pageitem_textframe.cpp (original)
+++ branches/ScribusOIF/scribus/pageitem_textframe.cpp Thu Oct 14 21:28:40 2010
@@ -1083,7 +1083,6 @@
 //				   .arg(a);
 
 			chstr = ExpandToken(a);
-//			qDebug() << QString("expanded token: '%1'").arg(chstr);
 			if (chstr.isEmpty())
 				chstr = SpecialChars::ZWNBSPACE;
 			if (style.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing)

Modified: branches/ScribusOIF/scribus/pagestructs.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15538&path=/branches/ScribusOIF/scribus/pagestructs.h
==============================================================================
--- branches/ScribusOIF/scribus/pagestructs.h (original)
+++ branches/ScribusOIF/scribus/pagestructs.h Thu Oct 14 21:28:40 2010
@@ -61,6 +61,8 @@
 	uint sectionstartindex; // Start of section, an index in the range of type, eg for type i,ii,iii, this would be 2 for "ii".
 	bool reversed; // Counting 10-1 ?
 	bool active; // Is the section active, ie, if the fromindex is 10, and theres 5 pages, this should be inactive.
+	QChar pageNumberFillChar; //Prefix to be placed before page number
+	int pageNumberWidth; //Minimum width of page number string
 };
 
 typedef QMap<uint, DocumentSection> DocumentSectionMap;

Modified: branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15538&path=/branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Thu Oct 14 21:28:40 2010
@@ -1607,7 +1607,15 @@
 				newSection.type=Type_None;
 			newSection.sectionstartindex = attrs.valueAsInt("Start");
 			newSection.reversed = attrs.valueAsBool("Reversed");
-			newSection.active   = attrs.valueAsBool("Active");
+			newSection.active = attrs.valueAsBool("Active");
+			if (attrs.hasAttribute("FillChar"))
+				newSection.pageNumberFillChar = attrs.valueAsString("FillChar").at(0);
+			else
+				newSection.pageNumberFillChar = QChar();
+			if (attrs.hasAttribute("FieldWidth"))
+				newSection.pageNumberWidth = attrs.valueAsInt("FieldWidth");
+			else
+				newSection.pageNumberWidth = 0;
 			doc->sections().insert(newSection.number, newSection);
 		}
 	}

Modified: branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15538&path=/branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Thu Oct 14 21:28:40 2010
@@ -845,6 +845,8 @@
 		docu.writeAttribute("Start", (*it).sectionstartindex);
 		docu.writeAttribute("Reversed", (*it).reversed);
 		docu.writeAttribute("Active", (*it).active);
+		docu.writeAttribute("FillChar", (*it).pageNumberFillChar);
+		docu.writeAttribute("FieldWidth", (*it).pageNumberWidth);
 	}
 	docu.writeEndElement();
 }

Modified: branches/ScribusOIF/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15538&path=/branches/ScribusOIF/scribus/scribus.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribus.cpp (original)
+++ branches/ScribusOIF/scribus/scribus.cpp Thu Oct 14 21:28:40 2010
@@ -3224,48 +3224,88 @@
 {
 	if (HaveDoc)
 	{
-		UndoTransaction pasteAction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::Create,"",Um::ICreate));
 		QFileInfo fi(data);
-		if (fi.suffix().toLower() == "sml")
-		{
-			QString f = "";
-			loadText(data, &f);
-			StencilReader *pre = new StencilReader();
-			data = pre->createObjects(f);
-			delete pre;
-		}
-		else if (fi.suffix().toLower() == "shape")
-		{
-			QString f = "";
-			loadText(data, &f);
-			StencilReader *pre = new StencilReader();
-			data = pre->createShape(f);
-			delete pre;
-		}
-		view->Deselect(true);
-		uint ac = doc->Items->count();
-		bool savedAlignGrid = doc->useRaster;
-		bool savedAlignGuides = doc->SnapGuides;
-		doc->useRaster = false;
-		doc->SnapGuides = false;
-		if (fi.suffix().toLower() == "sce")
-			slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), true, true, doc, view);
+		QString formatD(FormatsManager::instance()->extensionListForFormat(FormatsManager::RASTORIMAGES, 1));
+		QStringList rasterFiles = formatD.split("|");
+		QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
+		if (vectorFiles.contains(fi.suffix().toLower()))
+		{
+			FileLoader *fileLoader = new FileLoader(data);
+			int testResult = fileLoader->TestFile();
+			delete fileLoader;
+			if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+			{
+				const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
+				if( fmt )
+					fmt->loadFile(data, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
+			}
+			if (doc->m_Selection->count() > 0)
+			{
+				double x2, y2, w, h;
+				doc->m_Selection->getGroupRect(&x2, &y2, &w, &h);
+				doc->moveGroup(doc->currentPage()->xOffset() - x2, doc->currentPage()->yOffset() - y2);
+				propertiesPalette->updateColorList();
+				propertiesPalette->paraStyleCombo->updateFormatList();
+				propertiesPalette->charStyleCombo->updateFormatList();
+				propertiesPalette->SetLineFormats(doc);
+			}
+		}
+		else if (rasterFiles.contains(fi.suffix().toLower()))
+		{
+			int z = doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), 1, 1, doc->itemToolPrefs().shapeLineWidth, doc->itemToolPrefs().imageFillColor, CommonStrings::None, true);
+			PageItem *b = doc->Items->at(z);
+			b->LayerID = doc->activeLayer();
+			doc->LoadPict(data, b->ItemNr);
+			b->setWidth(static_cast<double>(b->OrigW * 72.0 / b->pixm.imgInfo.xres));
+			b->setHeight(static_cast<double>(b->OrigH * 72.0 / b->pixm.imgInfo.yres));
+			b->OldB2 = b->width();
+			b->OldH2 = b->height();
+			b->updateClip();
+		}
 		else
-			slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
-		doc->useRaster = savedAlignGrid;
-		doc->SnapGuides = savedAlignGuides;
-		Selection tmpSelection(this, false);
-		tmpSelection.copy(*doc->m_Selection, true);
-		for (int as = ac; as < doc->Items->count(); ++as)
-		{
-			PageItem* currItem = doc->Items->at(as);
-			doc->setRedrawBounding(currItem);
-			tmpSelection.addItem(currItem, true);
-			if (currItem->isBookmark)
-				AddBookMark(currItem);
-		}
-		doc->m_Selection->copy(tmpSelection, false);
-		pasteAction.commit();
+		{
+			UndoTransaction pasteAction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::Create,"",Um::ICreate));
+			if (fi.suffix().toLower() == "sml")
+			{
+				QString f = "";
+				loadText(data, &f);
+				StencilReader *pre = new StencilReader();
+				data = pre->createObjects(f);
+				delete pre;
+			}
+			else if (fi.suffix().toLower() == "shape")
+			{
+				QString f = "";
+				loadText(data, &f);
+				StencilReader *pre = new StencilReader();
+				data = pre->createShape(f);
+				delete pre;
+			}
+			view->Deselect(true);
+			uint ac = doc->Items->count();
+			bool savedAlignGrid = doc->useRaster;
+			bool savedAlignGuides = doc->SnapGuides;
+			doc->useRaster = false;
+			doc->SnapGuides = false;
+			if (fi.suffix().toLower() == "sce")
+				slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), true, true, doc, view);
+			else
+				slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
+			doc->useRaster = savedAlignGrid;
+			doc->SnapGuides = savedAlignGuides;
+			Selection tmpSelection(this, false);
+			tmpSelection.copy(*doc->m_Selection, true);
+			for (int as = ac; as < doc->Items->count(); ++as)
+			{
+				PageItem* currItem = doc->Items->at(as);
+				doc->setRedrawBounding(currItem);
+				tmpSelection.addItem(currItem, true);
+				if (currItem->isBookmark)
+					AddBookMark(currItem);
+			}
+			doc->m_Selection->copy(tmpSelection, false);
+			pasteAction.commit();
+		}
 		slotDocCh(false);
 		doc->regionsChanged()->update(QRectF());
 	}

Modified: branches/ScribusOIF/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15538&path=/branches/ScribusOIF/scribus/scribusdoc.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribusdoc.cpp (original)
+++ branches/ScribusOIF/scribus/scribusdoc.cpp Thu Oct 14 21:28:40 2010
@@ -3134,10 +3134,15 @@
 				//Our page number collection string
 				QString pageNumberText(QString::null);
 				if (chr == 30)
-				{
+				{//ch == SpecialChars::PAGENUMBER
 					//If not on a master page just get the page number for the page and the text
 					if (lc!=0)
-						pageNumberText=getSectionPageNumberForPageIndex(it->OwnPage);
+					{
+//						pageNumberText=getSectionPageNumberForPageIndex(it->OwnPage);
+						pageNumberText = QString("%1").arg(getSectionPageNumberForPageIndex(it->OwnPage),
+										getSectionPageNumberWidthForPageIndex(it->OwnPage),
+										getSectionPageNumberFillCharForPageIndex(it->OwnPage));
+					}
 					else
 					{
 						//Else, for a page number in a text frame on a master page we must scan
@@ -3150,7 +3155,10 @@
 						{
 							if (DocPages.at(a)->MPageNam == it->OnMasterPage)
 							{
-								newText=getSectionPageNumberForPageIndex(a);
+//								newText=getSectionPageNumberForPageIndex(a);
+								newText = QString("%1").arg(getSectionPageNumberForPageIndex(a),
+												getSectionPageNumberWidthForPageIndex(a),
+												getSectionPageNumberFillCharForPageIndex(a));
 								for (int nti=0;nti<newText.length();++nti)
 									if (pageNumberText.indexOf(newText[nti])==-1)
 										pageNumberText+=newText[nti];
@@ -3159,15 +3167,14 @@
 					}
 				}
 				else
-				{
+				{//ch == SpecialChars::PAGECOUNT
 					if (lc!=0)
 					{
-						QString out("%1");
 						int key = getSectionKeyForPageIndex(it->OwnPage);
 						if (key == -1)
 							pageNumberText = "";
 						else
-							pageNumberText = out.arg(getStringFromSequence(docPrefsData.docSectionMap[key].type, docPrefsData.docSectionMap[key].toindex - docPrefsData.docSectionMap[key].fromindex + 1));
+							pageNumberText = QString("%1").arg(getStringFromSequence(docPrefsData.docSectionMap[key].type, docPrefsData.docSectionMap[key].toindex - docPrefsData.docSectionMap[key].fromindex + 1));
 					}
 					else
 					{
@@ -3177,12 +3184,11 @@
 						{
 							if (DocPages.at(a)->MPageNam == it->OnMasterPage)
 							{
-								QString out("%1");
 								int key = getSectionKeyForPageIndex(a);
 								if (key == -1)
 									newText = "";
 								else
-									newText = out.arg(getStringFromSequence(docPrefsData.docSectionMap[key].type, docPrefsData.docSectionMap[key].toindex - docPrefsData.docSectionMap[key].fromindex + 1));
+									newText = QString("%1").arg(getStringFromSequence(docPrefsData.docSectionMap[key].type, docPrefsData.docSectionMap[key].toindex - docPrefsData.docSectionMap[key].fromindex + 1));
 								for (int nti=0;nti<newText.length();++nti)
 									if (pageNumberText.indexOf(newText[nti])==-1)
 										pageNumberText+=newText[nti];
@@ -5365,7 +5371,7 @@
 }
 
 
-void ScribusDoc::addSection(const int number, const QString& name, const uint fromindex, const uint toindex, const DocumentSectionType type, const uint sectionstartindex, const bool reversed, const bool active)
+void ScribusDoc::addSection(const int number, const QString& name, const uint fromindex, const uint toindex, const DocumentSectionType type, const uint sectionstartindex, const bool reversed, const bool active, const QChar fillChar, int fieldWidth)
 {
 	struct DocumentSection newSection;
 	uint docPageCount=DocPages.count();
@@ -5380,6 +5386,8 @@
 		newSection.sectionstartindex=1;
 		newSection.reversed=false;
 		newSection.active=true;
+		newSection.pageNumberFillChar=QChar();
+		newSection.pageNumberWidth=0;
 		docPrefsData.docSectionMap.insert(newSection.number, newSection);
 	}
 	else if (number!=-1)
@@ -5394,6 +5402,8 @@
 		newSection.sectionstartindex=sectionstartindex;
 		newSection.reversed=reversed;
 		newSection.active=active;
+		newSection.pageNumberFillChar=fillChar;
+		newSection.pageNumberWidth=fieldWidth;
 		docPrefsData.docSectionMap.insert(newSection.number, newSection);
 	}
 }
@@ -5457,15 +5467,41 @@
 	int key=getSectionKeyForPageIndex(pageIndex);
 	if (key==-1)
 		return retVal;
-
-	uint sectionIndexOffset=pageIndex-docPrefsData.docSectionMap[key].fromindex+docPrefsData.docSectionMap[key].sectionstartindex;
 	//If a section is inactive, theres no page numbers printed
 	if (docPrefsData.docSectionMap[key].active==false)
 		return "";
+	uint sectionIndexOffset=pageIndex-docPrefsData.docSectionMap[key].fromindex+docPrefsData.docSectionMap[key].sectionstartindex;
 	retVal=getStringFromSequence(docPrefsData.docSectionMap[key].type, sectionIndexOffset);
 	return retVal;
 }
 
+const QChar ScribusDoc::getSectionPageNumberFillCharForPageIndex(const uint pageIndex) const
+{
+	QChar retVal;
+	int key=getSectionKeyForPageIndex(pageIndex);
+	if (key==-1)
+		return retVal;
+
+	//If a section is inactive, theres no page numbers printed
+	if (docPrefsData.docSectionMap[key].active==false)
+		return retVal;
+	retVal=docPrefsData.docSectionMap[key].pageNumberFillChar;
+	return retVal;
+}
+
+int ScribusDoc::getSectionPageNumberWidthForPageIndex(const uint pageIndex) const
+{
+	int retVal=0;
+	int key=getSectionKeyForPageIndex(pageIndex);
+	if (key==-1)
+		return retVal;
+
+	//If a section is inactive, theres no page numbers printed
+	if (docPrefsData.docSectionMap[key].active==false)
+		return retVal;
+	retVal=docPrefsData.docSectionMap[key].pageNumberWidth;
+	return retVal;
+}
 
 void ScribusDoc::updateSectionPageNumbersToPages()
 {

Modified: branches/ScribusOIF/scribus/scribusdoc.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15538&path=/branches/ScribusOIF/scribus/scribusdoc.h
==============================================================================
--- branches/ScribusOIF/scribus/scribusdoc.h (original)
+++ branches/ScribusOIF/scribus/scribusdoc.h Thu Oct 14 21:28:40 2010
@@ -826,7 +826,7 @@
 	 * @brief Add a section to the document sections list
 	 * Set number to -1 to add in the default section if the map is empty
 	 */
-	void addSection(const int number=0, const QString& name=QString::null, const uint fromindex=0, const uint toindex=0, const  DocumentSectionType type=Type_1_2_3, const uint sectionstartindex=0, const bool reversed=false, const bool active=true);
+	void addSection(const int number=0, const QString& name=QString::null, const uint fromindex=0, const uint toindex=0, const  DocumentSectionType type=Type_1_2_3, const uint sectionstartindex=0, const bool reversed=false, const bool active=true, const QChar fillChar=QChar(), int fieldWidth=0);
 	/**
 	 * @brief Delete a section from the document sections list
 	 */
@@ -836,6 +836,16 @@
 	 * Returns QString::null on failure to find the pageIndex
 	 */
 	const QString getSectionPageNumberForPageIndex(const uint) const;
+	/**
+	 * @brief Gets the page number fill character to be printed based on the section it is in.
+	 * Returns QString::null on failure to find the pageIndex
+	 */
+	const QChar getSectionPageNumberFillCharForPageIndex(const uint) const;
+	/**
+	 * @brief Gets the page number fill character to be printed based on the section it is in.
+	 * Returns QString::null on failure to find the pageIndex
+	 */
+	int getSectionPageNumberWidthForPageIndex(const uint) const;
 	/**
 	 * @brief Gets the key of the sections map based on the section the page index is in.
 	 * Returns -1 on failure to find the pageIndex

Modified: branches/ScribusOIF/scribus/ui/prefs_documentsections.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15538&path=/branches/ScribusOIF/scribus/ui/prefs_documentsections.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/prefs_documentsections.cpp (original)
+++ branches/ScribusOIF/scribus/ui/prefs_documentsections.cpp Thu Oct 14 21:28:40 2010
@@ -57,35 +57,42 @@
 	{
 		uint i=0;
 		//Name
-		QTableWidgetItem *item1 = new QTableWidgetItem((*it).name);
-		sectionsTable->setItem(row, i++, item1);
+		QTableWidgetItem *item0 = new QTableWidgetItem((*it).name);
+		sectionsTable->setItem(row, i++, item0);
 		//Active
-		QCheckBox *item2 = new QCheckBox();
-		item2->setChecked((*it).active);
-		sectionsTable->setCellWidget(row, i++, item2);
+		QCheckBox *item1 = new QCheckBox();
+		item1->setChecked((*it).active);
+		sectionsTable->setCellWidget(row, i++, item1);
 		//FromIndex
-		QTableWidgetItem *item3 = new QTableWidgetItem(QString::number((*it).fromindex+1));
+		QTableWidgetItem *item2 = new QTableWidgetItem(QString::number((*it).fromindex+1));
+		sectionsTable->setItem(row, i++, item2);
+		//ToIndex
+		QTableWidgetItem *item3 = new QTableWidgetItem(QString::number((*it).toindex+1));
 		sectionsTable->setItem(row, i++, item3);
-		//ToIndex
-		QTableWidgetItem *item4 = new QTableWidgetItem(QString::number((*it).toindex+1));
-		sectionsTable->setItem(row, i++, item4);
 		//Style
-		QComboBox *item5 = new QComboBox();
-		item5->addItems(styles);
-		sectionsTable->setCellWidget(row, i++, item5);
+		QComboBox *item4 = new QComboBox();
+		item4->addItems(styles);
+		sectionsTable->setCellWidget(row, i++, item4);
 		if ((*it).type==Type_None)
-			item5->setCurrentIndex(styles.count()-1);
+			item4->setCurrentIndex(styles.count()-1);
 		else
-			item5->setCurrentIndex((*it).type);
+			item4->setCurrentIndex((*it).type);
 		//Start Page Number
-		QTableWidgetItem *item6 = new QTableWidgetItem(QString::number((*it).sectionstartindex));
-		sectionsTable->setItem(row, i++, item6);
+		QTableWidgetItem *item5 = new QTableWidgetItem(QString::number((*it).sectionstartindex));
+		sectionsTable->setItem(row, i++, item5);
 		//End Page Number
 		/*
 		QTableItem *item7 = new QTableItem(sectionsTable, QTableItem::WhenCurrent, QString::number((*it).sectionstartindex + (*it).toindex - (*it).fromindex));
 		item7->setEnabled(false);
 		sectionsTable->setItem(row, i++, item7);
 		*/
+		//Field Width
+		QTableWidgetItem *item6 = new QTableWidgetItem(QString::number((*it).pageNumberWidth));
+		sectionsTable->setItem(row, i++, item6);
+		//Fill Char
+		QTableWidgetItem *item7 = new QTableWidgetItem(QString((*it).pageNumberFillChar));
+		sectionsTable->setItem(row, i++, item7);
+		//
 		QTableWidgetItem *t=sectionsTable->verticalHeaderItem(row);
 		if (t!=NULL)
 			t->setText(QString("%1").arg(row));
@@ -150,6 +157,18 @@
 		break;
 	case 5:
 		localSections[row].sectionstartindex=sectionsTable->item(row, col)->text().toUInt();
+		break;
+	case 6:
+		localSections[row].pageNumberWidth=sectionsTable->item(row, col)->text().toInt();
+		break;
+	case 7:
+		{
+			QString ch=sectionsTable->item(row, col)->text();
+			if (ch.length()>0)
+				localSections[row].pageNumberFillChar=sectionsTable->item(row, col)->text().at(0);
+			else
+				localSections[row].pageNumberFillChar=QChar();
+		}
 		break;
 	default:
 		break;

Modified: branches/ScribusOIF/scribus/ui/prefs_documentsectionsbase.ui
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15538&path=/branches/ScribusOIF/scribus/ui/prefs_documentsectionsbase.ui
==============================================================================
--- branches/ScribusOIF/scribus/ui/prefs_documentsectionsbase.ui (original)
+++ branches/ScribusOIF/scribus/ui/prefs_documentsectionsbase.ui Thu Oct 14 21:28:40 2010
@@ -73,6 +73,16 @@
        <string>Start</string>
       </property>
      </column>
+     <column>
+      <property name="text">
+       <string>Field Width</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>Fill Character</string>
+      </property>
+     </column>
     </widget>
    </item>
    <item>

Modified: branches/ScribusOIF/scribus/ui/scrapbookpalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15538&path=/branches/ScribusOIF/scribus/ui/scrapbookpalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/scrapbookpalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/scrapbookpalette.cpp Thu Oct 14 21:28:40 2010
@@ -60,7 +60,7 @@
 	setDragEnabled(true);
 	setViewMode(QListView::IconMode);
 	setFlow(QListView::LeftToRight);
-	setSortingEnabled(true);
+//	setSortingEnabled(true);
 	setWrapping(true);
 	setAcceptDrops(true);
 	setDropIndicatorShown(true);
@@ -188,8 +188,8 @@
 void BibView::AddObj(QString name, QString daten, QPixmap Bild, bool isDir, bool isRaster)
 {
 	struct Elem DrElem;
-	DrElem.isDir = false;
-	DrElem.isRaster = false;
+	DrElem.isDir = isDir;
+	DrElem.isRaster = isRaster;
 	DrElem.Data = daten;
 	DrElem.Preview = Bild;
 	objectMap.insert(name, DrElem);
@@ -312,7 +312,7 @@
 	s.writeRawData(cs.data(), cs.length());
 	f.close();
 }
-
+/*
 void BibView::SaveContents(QString name, QString oldName)
 {
 	QDir thumbs(name);
@@ -504,7 +504,7 @@
 		}
 	}
 }
-
+*/
 void BibView::ReadOldContents(QString name, QString newName)
 {
 	bool isUtf8 = false;
@@ -560,6 +560,8 @@
 			thumbs.mkdir(".ScribusThumbs");
 		thumbs.cd(".ScribusThumbs");
 	}
+	QDir dd(name, "*", QDir::Name, QDir::Dirs | QDir::NoDotAndDotDot | QDir::Readable | QDir::NoSymLinks);
+	fileCount += dd.count();
 	QDir d(name, "*.sce", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
 	fileCount += d.count();
 	QDir d2(name, "*.sml", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
@@ -588,6 +590,19 @@
 	{
 		pgDia = new QProgressDialog("Reading Files...", QString(), 0, fileCount, this);
 		pgDia->setWindowModality(Qt::WindowModal);
+	}
+	if ((dd.exists()) && (dd.count() != 0))
+	{
+		for (uint dc = 0; dc < dd.count(); ++dc)
+		{
+			if (pgDia)
+			{
+				pgDia->setValue(readCount);
+				readCount++;
+			}
+			QPixmap pm = loadIcon("folder.png");
+			AddObj(dd[dc], "", pm, true);
+		}
 	}
 	if ((d.exists()) && (d.count() != 0))
 	{
@@ -801,16 +816,33 @@
 	QMap<QString,Elem>::Iterator itf;
 	for (itf = objectMap.begin(); itf != objectMap.end(); ++itf)
 	{
-		itf.value().Preview = itf.value().Preview.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-		QPixmap pm(60, 60);
-		pm.fill(palette().color(QPalette::Base));
-		QPainter p;
-		p.begin(&pm);
-		p.drawPixmap(30 - itf.value().Preview.width() / 2, 30 - itf.value().Preview.height() / 2, itf.value().Preview);
-		p.end();
-		new QListWidgetItem(QIcon(pm), itf.key(), this);
-	}
-	sortItems();
+		if (itf.value().isDir)
+		{
+			itf.value().Preview = itf.value().Preview.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+			QPixmap pm(60, 60);
+			pm.fill(palette().color(QPalette::Base));
+			QPainter p;
+			p.begin(&pm);
+			p.drawPixmap(30 - itf.value().Preview.width() / 2, 30 - itf.value().Preview.height() / 2, itf.value().Preview);
+			p.end();
+			QListWidgetItem *item = new QListWidgetItem(QIcon(pm), itf.key(), this);
+			item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+		}
+	}
+	for (itf = objectMap.begin(); itf != objectMap.end(); ++itf)
+	{
+		if (!itf.value().isDir)
+		{
+			itf.value().Preview = itf.value().Preview.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+			QPixmap pm(60, 60);
+			pm.fill(palette().color(QPalette::Base));
+			QPainter p;
+			p.begin(&pm);
+			p.drawPixmap(30 - itf.value().Preview.width() / 2, 30 - itf.value().Preview.height() / 2, itf.value().Preview);
+			p.end();
+			new QListWidgetItem(QIcon(pm), itf.key(), this);
+		}
+	}
 }
 
 /* This is the main Dialog-Class for the Scrapbook */
@@ -828,14 +860,10 @@
 	newButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
 	newButton->setIcon(loadIcon("16/document-new.png"));
 	newButton->setIconSize(QSize(16, 16));
-//	loadButton = new QToolButton(this);
-//	loadButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
-//	loadButton->setIcon(loadIcon("16/document-open.png"));
-//	loadButton->setIconSize(QSize(16, 16));
-	saveAsButton = new QToolButton(this);
-	saveAsButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
-	saveAsButton->setIcon(loadIcon("16/document-save-as.png"));
-	saveAsButton->setIconSize(QSize(16, 16));
+	upButton = new QToolButton(this);
+	upButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+	upButton->setIcon(loadIcon("16/go-up.png"));
+	upButton->setIconSize(QSize(16, 16));
 	importButton = new QToolButton(this);
 	importButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
 	importButton->setIcon(loadIcon("compfile16.png"));
@@ -845,8 +873,7 @@
 	closeButton->setIcon(loadIcon("16/close.png"));
 	closeButton->setIconSize(QSize(16, 16));
 	buttonLayout->addWidget( newButton );
-//	buttonLayout->addWidget( loadButton );
-	buttonLayout->addWidget( saveAsButton );
+	buttonLayout->addWidget( upButton );
 	buttonLayout->addWidget( importButton );
 	buttonLayout->addWidget( closeButton );
 	QSpacerItem* spacer = new QSpacerItem( 1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum );
@@ -867,8 +894,7 @@
 	languageChange();
 
 	connect(newButton, SIGNAL(clicked()), this, SLOT(NewLib()));
-//	connect(loadButton, SIGNAL(clicked()), this, SLOT(Load()));
-	connect(saveAsButton, SIGNAL(clicked()), this, SLOT(SaveAs()));
+	connect(upButton, SIGNAL(clicked()), this, SLOT(goOneDirUp()));
 	connect(importButton, SIGNAL(clicked()), this, SLOT(Import()));
 	connect(closeButton, SIGNAL(clicked()), this, SLOT(closeLib()));
 	connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
@@ -904,6 +930,7 @@
 	}
 	activeBView = (BibView*)Frame3->widget(0);
 	Frame3->setCurrentIndex(0);
+	upButton->setEnabled(false);
 	connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
 	connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
 	connect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
@@ -1012,6 +1039,7 @@
 		d.cdUp();
 		dirs->set("scrap_load", d.absolutePath());
 		activeBView->scrollToTop();
+		upButton->setEnabled(!((Frame3->currentIndex() == 0) || (Frame3->currentIndex() == 1)));
 		connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
 		connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
 		connect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
@@ -1019,49 +1047,7 @@
 		connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
 	}
 }
-/*
-void Biblio::Load()
-{
-	PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
-	QString fileName = QFileDialog::getExistingDirectory(this, tr("Choose a Scrapbook Directory"), dirs->get("scrap_load", "."));
-	if (!fileName.isEmpty())
-	{
-		for (int a = 0; a < Frame3->count(); a++)
-		{
-			BibView* bv = (BibView*)Frame3->widget(a);
-			if (fileName == bv->ScFilename)
-				return;
-		}
-		disconnect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
-		disconnect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
-		disconnect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
-		disconnect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
-		disconnect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
-		QDir d(fileName);
-		activeBView = new BibView(this);
-		QFileInfo fd(fileName);
-		activeBView->canWrite = fd.isWritable();
-		activeBView->setAcceptDrops(activeBView->canWrite);
-		if (activeBView->canWrite)
-			Frame3->addItem(activeBView, d.dirName());
-		else
-			Frame3->addItem(activeBView, QIcon(loadIcon("16/lock.png")), d.dirName());
-		activeBView->ReadContents(fileName);
-		activeBView->ScFilename = fileName;
-		activeBView->visibleName = d.dirName();
-		Frame3->setCurrentWidget(activeBView);
-		ScCore->fileWatcher->addDir(d.absolutePath());
-		d.cdUp();
-		dirs->set("scrap_load", d.absolutePath());
-		activeBView->scrollToTop();
-		connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
-		connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
-		connect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
-		connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
-		connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
-	}
-}
-*/
+
 void Biblio::Import()
 {
 	PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
@@ -1082,26 +1068,6 @@
 			readContents(activeBView->ScFilename);
 		}
 		activeBView->scrollToTop();
-	}
-}
-
-void Biblio::SaveAs()
-{
-	PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
-	QString fn = QFileDialog::getExistingDirectory(this, tr("Choose a Directory"), dirs->get("scrap_saveas", "."));
-	if (!fn.isEmpty())
-	{
-		for (int a = 0; a < Frame3->count(); a++)
-		{
-			BibView* bv = (BibView*)Frame3->widget(a);
-			if (fn == bv->ScFilename)
-				return;
-		}
-		QDir d(fn);
-		dirs->set("scrap_saveas", fn);
-		activeBView->SaveContents(fn, activeBView->ScFilename);
-		d.cdUp();
-		dirs->set("scrap_saveas", d.absolutePath());
 	}
 }
 
@@ -1124,6 +1090,7 @@
 		delete activeBView;  // currently disabled as the whole TabWidget vanishes when executing that delete????? -> seems to be fixed in Qt-4.3.3
 		activeBView = (BibView*)Frame3->widget(0);
 		Frame3->setCurrentIndex(0);
+		upButton->setEnabled(!((Frame3->currentIndex() == 0) || (Frame3->currentIndex() == 1)));
 		connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
 		connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
 		connect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
@@ -1139,6 +1106,7 @@
 	disconnect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
 	disconnect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
 	activeBView = (BibView*)Frame3->widget(index);
+	upButton->setEnabled(!((Frame3->currentIndex() == 0) || (Frame3->currentIndex() == 1)));
 	connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
 	connect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
 	connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
@@ -1191,9 +1159,56 @@
 
 void Biblio::handleDoubleClick(QListWidgetItem *ite)
 {
-	emit pasteToActualPage(ite->text());
-	activeBView->clearSelection();
-	actItem = 0;
+	if (activeBView->objectMap[ite->text()].isDir)
+	{
+		QFileInfo fi(activeBView->ScFilename);
+		ScCore->fileWatcher->removeDir(fi.absolutePath());
+		QString fileName = activeBView->ScFilename + "/" + ite->text();
+		QDir d(fileName);
+		QFileInfo fd(fileName);
+		activeBView->canWrite = fd.isWritable();
+		activeBView->setAcceptDrops(activeBView->canWrite);
+		activeBView->ReadContents(fileName);
+		activeBView->ScFilename = fileName;
+		activeBView->visibleName = d.dirName();
+		Frame3->setItemText(Frame3->indexOf(activeBView), d.dirName());
+		if (!activeBView->canWrite)
+			Frame3->setItemIcon(Frame3->indexOf(activeBView), QIcon(loadIcon("16/lock.png")));
+		ScCore->fileWatcher->addDir(d.absolutePath(), true);
+		d.cdUp();
+		PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
+		dirs->set("scrap_load", d.absolutePath());
+		activeBView->scrollToTop();
+	}
+	else
+	{
+		emit pasteToActualPage(ite->text());
+		activeBView->clearSelection();
+		actItem = 0;
+	}
+}
+
+void Biblio::goOneDirUp()
+{
+	QFileInfo fi(activeBView->ScFilename);
+	ScCore->fileWatcher->removeDir(fi.absolutePath());
+	QDir d(activeBView->ScFilename);
+	d.cdUp();
+	QString fileName = d.absolutePath();
+	QFileInfo fd(fileName);
+	activeBView->canWrite = fd.isWritable();
+	activeBView->setAcceptDrops(activeBView->canWrite);
+	activeBView->ReadContents(fileName);
+	activeBView->ScFilename = fileName;
+	activeBView->visibleName = d.dirName();
+	Frame3->setItemText(Frame3->indexOf(activeBView), d.dirName());
+	if (!activeBView->canWrite)
+		Frame3->setItemIcon(Frame3->indexOf(activeBView), QIcon(loadIcon("16/lock.png")));
+	ScCore->fileWatcher->addDir(d.absolutePath(), true);
+	d.cdUp();
+	PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
+	dirs->set("scrap_load", d.absolutePath());
+	activeBView->scrollToTop();
 }
 
 void Biblio::handlePasteToPage()
@@ -1391,7 +1406,6 @@
 				ite = itL.at(0);
 				delete tempBView->takeItem(tempBView->row(ite));
 			}
-			tempBView->sortItems();
 		}
 		emit updateRecentMenue();
 	}
@@ -1432,7 +1446,6 @@
 	}
 	activeBView->objectMap.remove(name);
 	delete activeBView->takeItem(activeBView->row(ite));
-	activeBView->sortItems();
 	if (activeBView == tempBView)
 		emit updateRecentMenue();
 	actItem = 0;
@@ -1517,7 +1530,6 @@
 	}
 	activeBView->objectMap.remove(OldName);
 	activeBView->AddObj(ite->text(), QDir::cleanPath(QDir::convertSeparators(activeBView->ScFilename + "/" + ite->text() + ".sce")), ObjPreview);
-	activeBView->sortItems();
 	if (activeBView == tempBView)
 		emit updateRecentMenue();
 }
@@ -1715,7 +1727,6 @@
 					QListWidgetItem *ite = itL.at(0);
 					delete tempBView->takeItem(tempBView->row(ite));
 				}
-				tempBView->sortItems();
 			}
 			emit updateRecentMenue();
 		}
@@ -1818,7 +1829,6 @@
 				QListWidgetItem *ite = itL.at(0);
 				delete tempBView->takeItem(tempBView->row(ite));
 			}
-			tempBView->sortItems();
 		}
 		emit updateRecentMenue();
 	}
@@ -1892,7 +1902,6 @@
 			QListWidgetItem *ite = itL.at(0);
 			delete tempBView->takeItem(tempBView->row(ite));
 		}
-		tempBView->sortItems();
 	}
 }
 
@@ -1993,8 +2002,7 @@
 {
 	setWindowTitle( tr( "Scrapbook" ) );
  	newButton->setToolTip( tr( "Create a new scrapbook page" ) );
- //	loadButton->setToolTip( tr( "Load an existing scrapbook" ) );
- 	saveAsButton->setToolTip( tr( "Save the selected scrapbook" ) );
+ 	upButton->setToolTip( tr( "Go up one Directory" ) );
  	importButton->setToolTip( tr( "Import a scrapbook file from Scribus <=1.3.2" ) );
  	closeButton->setToolTip( tr( "Close the selected scrapbook" ) );
 }

Modified: branches/ScribusOIF/scribus/ui/scrapbookpalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15538&path=/branches/ScribusOIF/scribus/ui/scrapbookpalette.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/scrapbookpalette.h (original)
+++ branches/ScribusOIF/scribus/ui/scrapbookpalette.h Thu Oct 14 21:28:40 2010
@@ -34,7 +34,6 @@
 	~BibView() {};
 	void AddObj(QString name, QString daten, QPixmap Bild, bool isDir = false, bool isRaster = false);
 	void checkAndChange(QString &text, QString nam, QString dir);
-	void SaveContents(QString name, QString oldName);
 	void ReadOldContents(QString, QString newName);
 	void ReadContents(QString name);
 	struct Elem
@@ -110,8 +109,7 @@
 	void deleteAllObj();
 	void renameObj();
 	void NewLib();
-//	void Load();
-	void SaveAs();
+	void goOneDirUp();
 	void closeLib();
 	void libChanged(int index);
 	void Import();
@@ -127,8 +125,7 @@
 	QString OldName;
 	QHBoxLayout* buttonLayout;
 	QToolButton* newButton;
-//	QToolButton* loadButton;
-	QToolButton* saveAsButton;
+	QToolButton* upButton;
 	QToolButton* importButton;
 	QToolButton* closeButton;
 };




More information about the scribus-commit mailing list