r15667 by jghali - merge trunk revisions up to r15665

scribus-commit scribus-commit at lists.scribus.net
Thu Oct 28 01:36:58 CEST 2010


Author: jghali
Date: Wed Oct 27 23:36:57 2010
New Revision: 15667

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

Added:
    branches/ScribusOIF/resources/templates/pres_backgr_1/
      - copied from r15665, trunk/Scribus/resources/templates/pres_backgr_1/
    branches/ScribusOIF/resources/templates/pres_backgr_2/
      - copied from r15665, trunk/Scribus/resources/templates/pres_backgr_2/
    branches/ScribusOIF/resources/templates/pres_backgr_3/
      - copied from r15665, trunk/Scribus/resources/templates/pres_backgr_3/
    branches/ScribusOIF/resources/templates/pres_backgr_4/
      - copied from r15665, trunk/Scribus/resources/templates/pres_backgr_4/
Removed:
    branches/ScribusOIF/resources/templates/sc_presentation/
Modified:
    branches/ScribusOIF/resources/keysets/scribus15.xml
    branches/ScribusOIF/resources/templates/CMakeLists.txt
    branches/ScribusOIF/resources/templates/template.de.xml
    branches/ScribusOIF/resources/templates/template.xml
    branches/ScribusOIF/scribus/colorsetmanager.cpp
    branches/ScribusOIF/scribus/prefsmanager.cpp
    branches/ScribusOIF/scribus/scribus.cpp
    branches/ScribusOIF/scribus/ui/colorlistbox.cpp
    branches/ScribusOIF/scribus/ui/colorlistbox.h
    branches/ScribusOIF/scribus/ui/paintmanager.cpp
    branches/ScribusOIF/scribus/ui/paintmanager.h

Modified: branches/ScribusOIF/resources/keysets/scribus15.xml
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15667&path=/branches/ScribusOIF/resources/keysets/scribus15.xml
==============================================================================
--- branches/ScribusOIF/resources/keysets/scribus15.xml (original)
+++ branches/ScribusOIF/resources/keysets/scribus15.xml Wed Oct 27 23:36:57 2010
@@ -35,7 +35,6 @@
     <function shortcut="" name="editEditRenderSource"/>
     <function shortcut="" name="editEditWithImageEditor"/>
     <function shortcut="" name="editExtendedImageProperties"/>
-    <function shortcut="" name="editGradients"/>
     <function shortcut="" name="editJavascripts"/>
     <function shortcut="" name="editMasterPages"/>
     <function shortcut="Ctrl+V" name="editPaste"/>

Modified: branches/ScribusOIF/resources/templates/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15667&path=/branches/ScribusOIF/resources/templates/CMakeLists.txt
==============================================================================
--- branches/ScribusOIF/resources/templates/CMakeLists.txt (original)
+++ branches/ScribusOIF/resources/templates/CMakeLists.txt Wed Oct 27 23:36:57 2010
@@ -47,10 +47,31 @@
 )
 
 INSTALL(FILES
-sc_presentation/presentation.png
-sc_presentation/presentation.sla.gz
-sc_presentation/presentationtn.png
-  DESTINATION ${TEMPLATEDIR}sc_presentation
+pres_backgr_1/blue_orange_vector.sla.gz
+pres_backgr_1/blue_orange_vectortn.png
+pres_backgr_1/blue_orange_vector.png
+  DESTINATION ${TEMPLATEDIR}pres_backgr_1
+)
+
+INSTALL(FILES
+pres_backgr_2/flood_light.sla.gz
+pres_backgr_2/flood_lighttn.png
+pres_backgr_2/flood_light.png
+  DESTINATION ${TEMPLATEDIR}pres_backgr_2
+)
+
+INSTALL(FILES
+pres_backgr_3/glass_ripples.sla.gz
+pres_backgr_3/glass_ripplestn.png
+pres_backgr_3/glass_ripples.png
+  DESTINATION ${TEMPLATEDIR}pres_backgr_3
+)
+
+INSTALL(FILES
+pres_backgr_4/bokeh.sla.gz
+pres_backgr_4/Bokehtn.png
+pres_backgr_4/Bokeh.png
+  DESTINATION ${TEMPLATEDIR}pres_backgr_4
 )
 
 INSTALL(FILES

Modified: branches/ScribusOIF/resources/templates/template.de.xml
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15667&path=/branches/ScribusOIF/resources/templates/template.de.xml
==============================================================================
--- branches/ScribusOIF/resources/templates/template.de.xml (original)
+++ branches/ScribusOIF/resources/templates/template.de.xml Wed Oct 27 23:36:57 2010
@@ -57,18 +57,60 @@
 		<email>petr at yarpen.cz</email>
 	</template>
 	<template category="PDF Präsentationen">
-		<name>Scribus-Präsentation</name>
-		<file>sc_presentation/presentation.sla.gz</file>
-		<tnail>sc_presentation/presentationtn.png</tnail>
-		<img>sc_presentation/presentation.png</img>
-		<psize>custom, 760x620</psize>
-		<color>color - Scribus website (or team Rabobank jersey ;))</color>
-		<descr>Based on the Maciej Hanski's presentation layout. I made it more simple because I like simple things. Used often in my office presentations.</descr>
-		<usage>Right click on text replace what's inside with your own. (Beware the management newspeak! ;)</usage>
-		<scribus_version>1.2RC1cvs</scribus_version>
-		<date>2004-07-1</date>
-		<author>Petr Vaněk</author>
-		<email>petr at yarpen.cz</email>
+		<name>Blau_Orange</name>
+		<file>pres_backgr_1/blue_orange_vector.sla.gz</file>
+		<tnail>pres_backgr_1/blue_orange_vectortn.png</tnail>
+		<img>pres_backgr_1/blue_orange_vector.png</img>
+		<psize>Benutzerdefiniert, 842x632</psize>
+		<color>RGB</color>
+		<descr></descr>
+		<usage></usage>
+		<scribus_version>1.3.9.svn</scribus_version>
+		<date>2010-10-25</date>
+		<author>Dhananjay Garg</author>
+		<email></email>
+	</template>
+	<template category="PDF Präsentationen">
+		<name>Flutlicht</name>
+		<file>pres_backgr_2/flood_light.sla.gz</file>
+		<tnail>pres_backgr_2/flood_lighttn.png</tnail>
+		<img>pres_backgr_2/flood_light.png</img>
+		<psize>Benutzerdefiniert, 842x632</psize>
+		<color>RGB</color>
+		<descr>Presentation Background</descr>
+		<usage></usage>
+		<scribus_version>1.3.9.svn</scribus_version>
+		<date>2010-10-25</date>
+		<author>Dhananjay Garg</author>
+		<email></email>
+	</template>
+	<template category="PDF Präsentationen">
+		<name>Glaswellen</name>
+		<file>pres_backgr_3/glass_ripples.sla.gz</file>
+		<tnail>pres_backgr_3/glass_ripplestn.png</tnail>
+		<img>pres_backgr_3/glass_ripples.png</img>
+		<psize>Benutzerdefiniert, 842x632</psize>
+		<color>RGB</color>
+		<descr></descr>
+		<usage></usage>
+		<scribus_version>1.3.9.svn</scribus_version>
+		<date>2010-10-27</date>
+		<author>Dhananjay Garg</author>
+		<email></email>
+	</template>
+	<template category="PDF Präsentationen">
+		<name>Bokeh</name>
+		<file>pres_backgr_4/bokeh.sla.gz</file>
+		<tnail>pres_backgr_4/Bokehtn.png</tnail>
+		<img>pres_backgr_4/Bokeh.png</img>
+		<psize>Benutzerdefiniert, 842x632</psize>
+		<color>RGB</color>
+		<descr></descr>
+		<usage></usage>
+		<scribus_version>1.3.9.svn</scribus_version>
+		<date>2010-10-27</date>
+		<author>Dhananjay Garg</author>
+		<email></email>
 	</template>
 	<template category="Verpackung">
 		<name>Cheat_Cube</name>
@@ -287,7 +329,8 @@
 		<img>grid_br_55x86in_p/Brochure_Grid_55x85in_Portraoit.png</img>
 		<psize>custom, 792x613</psize>
 		<color>RGB</color>
-		<descr>Erzeugen Sie den Dokumentinhalt auf der Ebene &quot;Content&quot; und setzen Sie für das Drucken oder den PDF-Export die Ebene &quot;Background&quot; auf nicht-druckbar.</usage>
+		<descr>Ein Gestaltungsraster für 5,5x8,5-Zoll-Broschüren</descr>
+		<usage>Erzeugen Sie den Dokumentinhalt auf der Ebene &quot;Content&quot; und setzen Sie für das Drucken oder den PDF-Export die Ebene &quot;Background&quot; auf nicht-druckbar.</usage>
 		<scribus_version>1.3.9.svn</scribus_version>
 		<date>2010-10-24</date>
 		<author>Christoph Schäfer</author>
@@ -449,9 +492,9 @@
 	</template>
 	<template category="Visitenkarten">
 		<name>Business_Card_Collection</name>
-		<file>business_card_collection.sla.gz</file>
-		<tnail>Business_Card_Collectiontn.png</tnail>
-		<img>Business_Card_Collection.png</img>
+		<file>buscard_coll/business_card_collection.sla.gz</file>
+		<tnail>buscard_coll/Business_Card_Collectiontn.png</tnail>
+		<img>buscard_coll/Business_Card_Collection.png</img>
 		<psize>custom, 1436x1709</psize>
 		<color>RGB</color>
 		<descr>Ein Sammlung Visitenkarten</descr>

Modified: branches/ScribusOIF/resources/templates/template.xml
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15667&path=/branches/ScribusOIF/resources/templates/template.xml
==============================================================================
--- branches/ScribusOIF/resources/templates/template.xml (original)
+++ branches/ScribusOIF/resources/templates/template.xml Wed Oct 27 23:36:57 2010
@@ -57,18 +57,60 @@
 		<email>petr at yarpen.cz</email>
 	</template>
 	<template category="PDF Presentations">
-		<name>ScPresentation</name>
-		<file>sc_presentation/presentation.sla.gz</file>
-		<tnail>sc_presentation/presentationtn.png</tnail>
-		<img>sc_presentation/presentation.png</img>
-		<psize>custom, 760x620</psize>
-		<color>color - Scribus website (or team Rabobank jersey ;))</color>
-		<descr>Based on the Maciej Hanski's presentation layout. I made it more simple because I like simple things. Used often in my office presentations.</descr>
-		<usage>Right click on text replace what's inside with your own. (Beware the management newspeak! ;)</usage>
-		<scribus_version>1.2RC1cvs</scribus_version>
-		<date>2004-07-1</date>
-		<author>Petr Vaněk</author>
-		<email>petr at yarpen.cz</email>
+		<name>Blue_Orange</name>
+		<file>pres_backgr_1/blue_orange_vector.sla.gz</file>
+		<tnail>pres_backgr_1/blue_orange_vectortn.png</tnail>
+		<img>pres_backgr_1/blue_orange_vector.png</img>
+		<psize>custom, 842x632</psize>
+		<color>RGB</color>
+		<descr></descr>
+		<usage></usage>
+		<scribus_version>1.3.9.svn</scribus_version>
+		<date>2010-10-25</date>
+		<author>Dhananjay Garg</author>
+		<email></email>
+	</template>
+	<template category="PDF Presentations">
+		<name>Flood_Light</name>
+		<file>pres_backgr_2/flood_light.sla.gz</file>
+		<tnail>pres_backgr_2/flood_lighttn.png</tnail>
+		<img>pres_backgr_2/flood_light.png</img>
+		<psize>custom, 842x632</psize>
+		<color>RGB</color>
+		<descr>Presentation Background</descr>
+		<usage></usage>
+		<scribus_version>1.3.9.svn</scribus_version>
+		<date>2010-10-25</date>
+		<author>Dhananjay Garg</author>
+		<email></email>
+	</template>
+	<template category="PDF Presentations">
+		<name>Glass_Ripples</name>
+		<file>pres_backgr_3/glass_ripples.sla.gz</file>
+		<tnail>pres_backgr_3/glass_ripplestn.png</tnail>
+		<img>pres_backgr_3/glass_ripples.png</img>
+		<psize>custom, 842x632</psize>
+		<color>RGB</color>
+		<descr></descr>
+		<usage></usage>
+		<scribus_version>1.3.9.svn</scribus_version>
+		<date>2010-10-27</date>
+		<author>Dhananjay Garg</author>
+		<email></email>
+	</template>
+	<template category="PDF Presentations">
+		<name>Bokeh</name>
+		<file>pres_backgr_4/bokeh.sla.gz</file>
+		<tnail>pres_backgr_4/Bokehtn.png</tnail>
+		<img>pres_backgr_4/Bokeh.png</img>
+		<psize>custom, 842x632</psize>
+		<color>RGB</color>
+		<descr></descr>
+		<usage></usage>
+		<scribus_version>1.3.9.svn</scribus_version>
+		<date>2010-10-27</date>
+		<author>Dhananjay Garg</author>
+		<email></email>
 	</template>
 	<template category="Packaging">
 		<name>Cheat_Cube</name>

Modified: branches/ScribusOIF/scribus/colorsetmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15667&path=/branches/ScribusOIF/scribus/colorsetmanager.cpp
==============================================================================
--- branches/ScribusOIF/scribus/colorsetmanager.cpp (original)
+++ branches/ScribusOIF/scribus/colorsetmanager.cpp Wed Oct 27 23:36:57 2010
@@ -149,10 +149,15 @@
 			{
 				QString setName = fi.baseName();
 				setName.replace("_", " ");
-				QTreeWidgetItem* item = new QTreeWidgetItem(parent);
-				item->setFlags(Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-				item->setText(0, setName);
-				searchDir(path + dirs[dc] + "/", item);
+				if (parent != NULL)
+				{
+					QTreeWidgetItem* item = new QTreeWidgetItem(parent);
+					item->setFlags(Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+					item->setText(0, setName);
+					searchDir(path + dirs[dc] + "/", item);
+				}
+				else
+					searchDir(path + dirs[dc] + "/", parent);
 			}
 			else
 			{
@@ -161,9 +166,12 @@
 					QString setName = fi.baseName();
 					setName.replace("_", " ");
 					palettes.insert(setName, fi.absoluteFilePath());
-					QTreeWidgetItem* item = new QTreeWidgetItem(parent);
-					item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-					item->setText(0, setName);
+					if (parent != 0)
+					{
+						QTreeWidgetItem* item = new QTreeWidgetItem(parent);
+						item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+						item->setText(0, setName);
+					}
 				}
 			}
 		}
@@ -177,22 +185,7 @@
 	for ( QStringList::Iterator it = paletteLocations.begin(); it != paletteLocations.end(); ++it )
 	{
 		path = (*it);
-		if (parent != NULL)
-			searchDir(path, parent);
-		else
-		{
-			QDir dir(path , "*.xml *.gpl *.eps *.ai *.sla *.soc", QDir::Name, QDir::Files | QDir::NoSymLinks);
-			if (dir.exists() && (dir.count() != 0))
-			{
-				for (uint i = 0; i < dir.count(); ++i) 
-				{
-					QFileInfo file(path + dir[i]);
-					QString setName=file.baseName();
-					setName.replace("_", " ");
-					palettes.insert(setName, file.absoluteFilePath());
-				}
-			}
-		}
+		searchDir(path, parent);
 	}
 }
 

Modified: branches/ScribusOIF/scribus/prefsmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15667&path=/branches/ScribusOIF/scribus/prefsmanager.cpp
==============================================================================
--- branches/ScribusOIF/scribus/prefsmanager.cpp (original)
+++ branches/ScribusOIF/scribus/prefsmanager.cpp Wed Oct 27 23:36:57 2010
@@ -52,6 +52,7 @@
 #include "scribusstructs.h"
 #include "scribuscore.h"
 #include "ui/modetoolbar.h"
+#include "util_color.h"
 #include "util_file.h"
 #include "util_ghostscript.h"
 
@@ -1605,6 +1606,7 @@
 		rde.appendChild(hyelm2);
 	}
 	elem.appendChild(rde);
+/*
 	ColorList::Iterator itc;
 	for (itc = appPrefs.colorPrefs.DColors.begin(); itc != appPrefs.colorPrefs.DColors.end(); ++itc)
 	{
@@ -1636,6 +1638,7 @@
 		}
 		elem.appendChild(grad);
 	}
+*/
 	for (int rd=0; rd<appPrefs.uiPrefs.RecentDocs.count(); ++rd)
 	{
 		QDomElement rde=docu.createElement("Recent");
@@ -1828,6 +1831,10 @@
 		return false;
 	appPrefs.colorPrefs.DColors.clear();
 	appPrefs.extToolPrefs.latexCommands.clear();
+	ColorSetManager csm;
+	csm.initialiseDefaultPrefs(appPrefs);
+	csm.findPaletteLocations();
+	csm.findPalettes();
 	ScColor lf = ScColor();
 	QDomNode DOC=elem.firstChild();
 	if (!DOC.namedItem("CheckProfile").isNull())
@@ -2328,6 +2335,7 @@
 				face.subset(static_cast<bool>(dc.attribute("Subset", "0").toInt()));
 			}
 		}
+/*
 		if (dc.tagName()=="Color")
 		{
 			if (dc.hasAttribute("CMYK"))
@@ -2369,12 +2377,41 @@
 			}
 			appPrefs.defaultGradients.insert(dc.attribute("Name"), gra);
 		}
+*/
 		if (dc.tagName()=="Substitute")
 		  appPrefs.fontPrefs.GFontSub[dc.attribute("Name")] = dc.attribute("Replace");
 		if (dc.tagName()=="ColorSet")
 			appPrefs.colorPrefs.CustomColorSets.append(dc.attribute("Name"));
 		if (dc.tagName()=="DefaultColorSet")
+		{
+			QString pfadC = "";
 			appPrefs.colorPrefs.DColorSet = dc.attribute("Name");
+			if (appPrefs.colorPrefs.CustomColorSets.contains(appPrefs.colorPrefs.DColorSet))
+			{
+				QString Fname = appPrefs.colorPrefs.DColorSet;
+				Fname.replace(" ", "_");
+				Fname += ".xml";
+				pfadC = QDir::convertSeparators(ScPaths::getApplicationDataDir()+Fname);
+			}
+			else
+				pfadC = csm.paletteFileFromName(appPrefs.colorPrefs.DColorSet);
+			if (appPrefs.colorPrefs.DColorSet != "Scribus Small")
+				importColorsFromFile(pfadC, appPrefs.colorPrefs.DColors, &appPrefs.defaultGradients, false);
+			else
+			{
+				appPrefs.colorPrefs.DColors.insert("White", ScColor(0, 0, 0, 0));
+				appPrefs.colorPrefs.DColors.insert("Black", ScColor(0, 0, 0, 255));
+				ScColor cc = ScColor(255, 255, 255, 255);
+				cc.setRegistrationColor(true);
+				appPrefs.colorPrefs.DColors.insert("Registration", cc);
+				appPrefs.colorPrefs.DColors.insert("Blue", ScColor(255, 255, 0, 0));
+				appPrefs.colorPrefs.DColors.insert("Cyan", ScColor(255, 0, 0, 0));
+				appPrefs.colorPrefs.DColors.insert("Green", ScColor(255, 0, 255, 0));
+				appPrefs.colorPrefs.DColors.insert("Red", ScColor(0, 255, 255, 0));
+				appPrefs.colorPrefs.DColors.insert("Yellow", ScColor(0, 0, 255, 0));
+				appPrefs.colorPrefs.DColors.insert("Magenta", ScColor(0, 255, 0, 0));
+			}
+		}
 		if(dc.tagName()=="PDF")
 		{
 			appPrefs.pdfPrefs.Articles = static_cast<bool>(dc.attribute("Articles").toInt());

Modified: branches/ScribusOIF/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15667&path=/branches/ScribusOIF/scribus/scribus.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribus.cpp (original)
+++ branches/ScribusOIF/scribus/scribus.cpp Wed Oct 27 23:36:57 2010
@@ -9932,9 +9932,9 @@
 			prefsManager->setColorSet(dia->m_colorList);
 			propertiesPalette->Cpal->SetColors(prefsManager->colorSet());
 			prefsManager->appPrefs.defaultGradients = dia->dialogGradients;
-		}
-		prefsManager->setColorSetName(dia->getColorSetName());
-		prefsManager->appPrefs.colorPrefs.CustomColorSets = dia->customColSet;
+			prefsManager->setColorSetName(dia->getColorSetName());
+			prefsManager->appPrefs.colorPrefs.CustomColorSets = dia->customColSet;
+		}
 	}
 	delete dia;
 	undoManager->setUndoEnabled(true);

Modified: branches/ScribusOIF/scribus/ui/colorlistbox.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15667&path=/branches/ScribusOIF/scribus/ui/colorlistbox.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/colorlistbox.cpp (original)
+++ branches/ScribusOIF/scribus/ui/colorlistbox.cpp Wed Oct 27 23:36:57 2010
@@ -12,6 +12,8 @@
 #include <QToolTip>
 #include <QEvent>
 #include <QHelpEvent>
+#include <QMenu>
+#include <QCursor>
 
 #include "commonstrings.h"
 #include "sccolorengine.h"
@@ -190,7 +192,9 @@
 	: QListWidget(parent)
 {
 	cList = NULL;
+	sortRule = 0;
 	setItemDelegate(new ColorWideItemDelegate());
+	connect(this, SIGNAL(showContextMenue()), this, SLOT(slotRightClick()));
 }
 
 
@@ -202,17 +206,58 @@
 		return CommonStrings::tr_NoneColor;
 }
 
+void ColorListBox::slotRightClick()
+{
+	blockSignals(true);
+	QString currentSel = QString();
+	QListWidgetItem* itc = currentItem();
+	if (itc)
+		currentSel = itc->text();
+	QListWidgetItem* it = item(0);
+	if (it)
+	{
+		QString first = QString();
+		QMenu *pmen = new QMenu();
+		qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+		pmen->addAction( tr("Sort by Name"));
+		pmen->addAction( tr("Sort by Color"));
+		pmen->addAction( tr("Sort by Type"));
+		sortRule = pmen->actions().indexOf(pmen->exec(QCursor::pos()));
+		delete pmen;
+		if (it->text() == CommonStrings::None || it->text() == CommonStrings::tr_NoneColor)
+			first = it->text();
+		clear();
+		reset();
+		if (!first.isEmpty())
+			addItem(first);
+		if (m_type == ColorListBox::fancyPixmap)
+			insertFancyPixmapItems( *cList );
+		else if (m_type == ColorListBox::widePixmap)
+			insertWidePixmapItems( *cList );
+		else if (m_type == ColorListBox::smallPixmap)
+			insertSmallPixmapItems( *cList );
+		if (!currentSel.isEmpty())
+		{
+			QList<QListWidgetItem *> items = findItems(currentSel, Qt::MatchExactly);
+			if (items.count() > 0)
+				setCurrentItem(items[0]);
+		}
+	}
+	blockSignals(false);
+}
 
 void ColorListBox::updateBox(ColorList& list, ColorListBox::PixmapType type)
 {
 	clear();
 	reset();
+	m_type = type;
 	insertItems(list, type);
 }
 
 void ColorListBox::insertItems(ColorList& list, ColorListBox::PixmapType type)
 {
 	cList = &list;
+	m_type = type;
 	if (type == ColorListBox::fancyPixmap)
 		insertFancyPixmapItems( list );
 	else if (type == ColorListBox::widePixmap)
@@ -248,11 +293,46 @@
 {
 	ColorList::Iterator it;
 	ScribusDoc* doc = list.document();
-	for (it = list.begin(); it != list.end(); ++it)
-	{
-		if (it.key() == CommonStrings::None || it.key() == CommonStrings::tr_NoneColor)
-			continue;
-		addItem( new ColorPixmapItem(it.value(), doc, it.key()) );
+	if (sortRule > 0)
+	{
+		QMap<QString, QString> sortMap;
+		for (it = list.begin(); it != list.end(); ++it)
+		{
+			if (it.key() == CommonStrings::None || it.key() == CommonStrings::tr_NoneColor)
+				continue;
+			if (sortRule == 1)
+			{
+				QColor c = it.value().getRawRGBColor();
+				QString sortString = QString("%1-%2-%3-%4").arg(c.hue(), 3, 10, QChar('0')).arg(c.saturation(), 3, 10, QChar('0')).arg(c.value(), 3, 10, QChar('0')).arg(it.key());
+				sortMap.insert(sortString, it.key());
+			}
+			else if (sortRule == 2)
+			{
+				QString sortString = QString("%1-%2");
+				if (it.value().isRegistrationColor())
+					sortMap.insert(sortString.arg("A").arg(it.key()), it.key());
+				else if (it.value().isSpotColor())
+					sortMap.insert(sortString.arg("B").arg(it.key()), it.key());
+				else if (it.value().getColorModel() == colorModelCMYK)
+					sortMap.insert(sortString.arg("C").arg(it.key()), it.key());
+				else
+					sortMap.insert(sortString.arg("D").arg(it.key()), it.key());
+			}
+		}
+		QMap<QString, QString>::Iterator itc;
+		for (itc = sortMap.begin(); itc != sortMap.end(); ++itc)
+		{
+			addItem( new ColorPixmapItem(list[itc.value()], doc, itc.value()) );
+		}
+	}
+	else
+	{
+		for (it = list.begin(); it != list.end(); ++it)
+		{
+			if (it.key() == CommonStrings::None || it.key() == CommonStrings::tr_NoneColor)
+				continue;
+			addItem( new ColorPixmapItem(it.value(), doc, it.key()) );
+		}
 	}
 	if (itemDelegate())
 		delete itemDelegate();
@@ -263,11 +343,46 @@
 {
 	ColorList::Iterator it;
 	ScribusDoc* doc = list.document();
-	for (it = list.begin(); it != list.end(); ++it)
-	{
-		if (it.key() == CommonStrings::None || it.key() == CommonStrings::tr_NoneColor)
-			continue;
-		addItem( new ColorPixmapItem(it.value(), doc, it.key()) );
+	if (sortRule > 0)
+	{
+		QMap<QString, QString> sortMap;
+		for (it = list.begin(); it != list.end(); ++it)
+		{
+			if (it.key() == CommonStrings::None || it.key() == CommonStrings::tr_NoneColor)
+				continue;
+			if (sortRule == 1)
+			{
+				QColor c = it.value().getRawRGBColor();
+				QString sortString = QString("%1-%2-%3-%4").arg(c.hue(), 3, 10, QChar('0')).arg(c.saturation(), 3, 10, QChar('0')).arg(c.value(), 3, 10, QChar('0')).arg(it.key());
+				sortMap.insert(sortString, it.key());
+			}
+			else if (sortRule == 2)
+			{
+				QString sortString = QString("%1-%2");
+				if (it.value().isRegistrationColor())
+					sortMap.insert(sortString.arg("A").arg(it.key()), it.key());
+				else if (it.value().isSpotColor())
+					sortMap.insert(sortString.arg("B").arg(it.key()), it.key());
+				else if (it.value().getColorModel() == colorModelCMYK)
+					sortMap.insert(sortString.arg("C").arg(it.key()), it.key());
+				else
+					sortMap.insert(sortString.arg("D").arg(it.key()), it.key());
+			}
+		}
+		QMap<QString, QString>::Iterator itc;
+		for (itc = sortMap.begin(); itc != sortMap.end(); ++itc)
+		{
+			addItem( new ColorPixmapItem(list[itc.value()], doc, itc.value()) );
+		}
+	}
+	else
+	{
+		for (it = list.begin(); it != list.end(); ++it)
+		{
+			if (it.key() == CommonStrings::None || it.key() == CommonStrings::tr_NoneColor)
+				continue;
+			addItem( new ColorPixmapItem(it.value(), doc, it.key()) );
+		}
 	}
 	if (itemDelegate())
 		delete itemDelegate();
@@ -278,18 +393,53 @@
 {
 	ColorList::Iterator it;
 	ScribusDoc* doc = list.document();
-	for (it = list.begin(); it != list.end(); ++it)
-	{
-		if (it.key() == CommonStrings::None || it.key() == CommonStrings::tr_NoneColor)
-			continue;
-		addItem( new ColorPixmapItem(it.value(), doc, it.key()) );
+	if (sortRule > 0)
+	{
+		QMap<QString, QString> sortMap;
+		for (it = list.begin(); it != list.end(); ++it)
+		{
+			if (it.key() == CommonStrings::None || it.key() == CommonStrings::tr_NoneColor)
+				continue;
+			if (sortRule == 1)
+			{
+				QColor c = it.value().getRawRGBColor();
+				QString sortString = QString("%1-%2-%3-%4").arg(c.hue(), 3, 10, QChar('0')).arg(c.saturation(), 3, 10, QChar('0')).arg(c.value(), 3, 10, QChar('0')).arg(it.key());
+				sortMap.insert(sortString, it.key());
+			}
+			else if (sortRule == 2)
+			{
+				QString sortString = QString("%1-%2");
+				if (it.value().isRegistrationColor())
+					sortMap.insert(sortString.arg("A").arg(it.key()), it.key());
+				else if (it.value().isSpotColor())
+					sortMap.insert(sortString.arg("B").arg(it.key()), it.key());
+				else if (it.value().getColorModel() == colorModelCMYK)
+					sortMap.insert(sortString.arg("C").arg(it.key()), it.key());
+				else
+					sortMap.insert(sortString.arg("D").arg(it.key()), it.key());
+			}
+		}
+		QMap<QString, QString>::Iterator itc;
+		for (itc = sortMap.begin(); itc != sortMap.end(); ++itc)
+		{
+			addItem( new ColorPixmapItem(list[itc.value()], doc, itc.value()) );
+		}
+	}
+	else
+	{
+		for (it = list.begin(); it != list.end(); ++it)
+		{
+			if (it.key() == CommonStrings::None || it.key() == CommonStrings::tr_NoneColor)
+				continue;
+			addItem( new ColorPixmapItem(it.value(), doc, it.key()) );
+		}
 	}
 	if (itemDelegate())
 		delete itemDelegate();
 	setItemDelegate(new ColorFancyItemDelegate());
 }
 
-bool ColorListBox::event(QEvent *event)
+bool ColorListBox::viewportEvent(QEvent *event)
 {
 	if (event->type() == QEvent::ToolTip)
 	{
@@ -322,5 +472,20 @@
 			}
 		}
 	}
-	return QListWidget::event(event);
-}
+	else if (event->type() == QEvent::MouseButtonPress)
+	{
+		QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
+		if (mouseEvent->button() == Qt::RightButton)
+			return true;
+	}
+	else if (event->type() == QEvent::MouseButtonRelease)
+	{
+		QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
+		if (mouseEvent->button() == Qt::RightButton)
+		{
+			emit showContextMenue();
+			return true;
+		}
+	}
+	return QListWidget::viewportEvent(event);
+}

Modified: branches/ScribusOIF/scribus/ui/colorlistbox.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15667&path=/branches/ScribusOIF/scribus/ui/colorlistbox.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/colorlistbox.h (original)
+++ branches/ScribusOIF/scribus/ui/colorlistbox.h Wed Oct 27 23:36:57 2010
@@ -81,12 +81,12 @@
 		Just there are initialized pixmaps for icon drawing. */
 		ColorListBox(QWidget * parent = 0);
 
-		QString currentColor() const; 
+		QString currentColor() const;
 
 		/*! \brief Fill the list box with values taken from list.
 		The list is cleared itself. Then is rendered an icon with
 		color attributes (RGB/CMYK/Spot etc.).
-		\param list a ColorList to present. 
+		\param list a ColorList to present.
 		\param the pixmap type to use */
 		void updateBox(ColorList& list, ColorListBox::PixmapType type);
 
@@ -114,10 +114,15 @@
 				
 		/*! \brief Pointer to the color list displayed by this box */
 		ColorList *cList;
-protected:
-		bool event(QEvent *event);
-		
+	private slots:
+		void slotRightClick();
+	signals:
+		void showContextMenue();
+	protected:
+		bool viewportEvent(QEvent *event);
+		int sortRule;
 		int m_selectedRow;
+		ColorListBox::PixmapType m_type;
 };
 
 #endif

Modified: branches/ScribusOIF/scribus/ui/paintmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15667&path=/branches/ScribusOIF/scribus/ui/paintmanager.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/paintmanager.cpp (original)
+++ branches/ScribusOIF/scribus/ui/paintmanager.cpp Wed Oct 27 23:36:57 2010
@@ -28,6 +28,8 @@
 #include <QCheckBox>
 #include <QMessageBox>
 #include <QDomDocument>
+#include <QMenu>
+#include <QCursor>
 #include "cmykfw.h"
 #include "colorlistbox.h"
 #include "commonstrings.h"
@@ -51,16 +53,19 @@
 #include "util_color.h"
 #include "util_formats.h"
 #include "util_icon.h"
+#include <QDebug>
 
 PaintManagerDialog::PaintManagerDialog(QWidget* parent, QMap<QString, VGradient> *docGradients, ColorList doco, QString docColSet, QStringList custColSet, ScribusDoc *doc, ScribusMainWindow *scMW) : QDialog(parent)
 {
 	setupUi(this);
 	setModal(true);
 	paletteLocked = false;
+	sortRule = 0;
 	m_doc = doc;
 	m_colorList = doco;
 	mainWin = scMW;
 	setWindowIcon(QIcon(loadIcon ( "AppIcon.png" )));
+	dataTree->setContextMenuPolicy(Qt::CustomContextMenu);
 	dataTree->setIconSize(QSize(60, 15));
 	colorItems = new QTreeWidgetItem(dataTree);
 	colorItems->setText(0, tr("Solid Colors"));
@@ -101,8 +106,10 @@
 	userSwatches->setExpanded(true);
 	LoadColSet->setCurrentComboItem(docColSet);
 	if (m_doc != 0)
+	{
+		label->setText( tr("Merge Color Set"));
 		m_doc->getUsedColors(inDocUsedColors);
-
+	}
 	importButton->setEnabled(false);
 	newButton->setEnabled(false);
 	editButton->setEnabled(false);
@@ -117,6 +124,7 @@
 	connect(dataTree, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(itemSelected(QTreeWidgetItem*)));
 	connect(dataTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(selEditColor(QTreeWidgetItem*)));
 	connect(dataTree, SIGNAL(itemSelectionChanged()), this, SLOT(itemSelectionChanged()));
+	connect(dataTree, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(slotRightClick(QPoint)));
 	connect(newButton, SIGNAL(clicked()), this, SLOT(createNew()));
 	connect(editButton, SIGNAL(clicked()), this, SLOT(editColorItem()));
 	connect(duplicateButton, SIGNAL(clicked()), this, SLOT(duplicateColorItem()));
@@ -174,18 +182,77 @@
 		delete lg[a];
 	}
 	QTreeWidgetItem* ret = 0;
-	ColorList::Iterator it;
-	for (it = m_colorList.begin(); it != m_colorList.end(); ++it)
-	{
-		QTreeWidgetItem *item = new QTreeWidgetItem(colorItems);
-		item->setText(0, it.key());
-		if (it.key() == addedName)
-			ret = item;
-		QPixmap* pPixmap = getFancyPixmap(it.value(), m_doc);
-		item->setIcon(0, *pPixmap);
-		item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+	if (sortRule > 0)
+	{
+		QMap<QString, QString> sortMap;
+		ColorList::Iterator it;
+		for (it = m_colorList.begin(); it != m_colorList.end(); ++it)
+		{
+			if (sortRule == 1)
+			{
+				QColor c = it.value().getRawRGBColor();
+				QString sortString = QString("%1-%2-%3-%4").arg(c.hue(), 3, 10, QChar('0')).arg(c.saturation(), 3, 10, QChar('0')).arg(c.value(), 3, 10, QChar('0')).arg(it.key());
+				sortMap.insert(sortString, it.key());
+			}
+			else if (sortRule == 2)
+			{
+				QString sortString = QString("%1-%2");
+				if (it.value().isRegistrationColor())
+					sortMap.insert(sortString.arg("A").arg(it.key()), it.key());
+				else if (it.value().isSpotColor())
+					sortMap.insert(sortString.arg("B").arg(it.key()), it.key());
+				else if (it.value().getColorModel() == colorModelCMYK)
+					sortMap.insert(sortString.arg("C").arg(it.key()), it.key());
+				else
+					sortMap.insert(sortString.arg("D").arg(it.key()), it.key());
+			}
+		}
+		QMap<QString, QString>::Iterator itc;
+		for (itc = sortMap.begin(); itc != sortMap.end(); ++itc)
+		{
+			QTreeWidgetItem *item = new QTreeWidgetItem(colorItems);
+			item->setText(0, itc.value());
+			if (itc.value() == addedName)
+				ret = item;
+			QPixmap* pPixmap = getFancyPixmap(m_colorList[itc.value()], m_doc);
+			item->setIcon(0, *pPixmap);
+			item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+		}
+	}
+	else
+	{
+		ColorList::Iterator it;
+		for (it = m_colorList.begin(); it != m_colorList.end(); ++it)
+		{
+			QTreeWidgetItem *item = new QTreeWidgetItem(colorItems);
+			item->setText(0, it.key());
+			if (it.key() == addedName)
+				ret = item;
+			QPixmap* pPixmap = getFancyPixmap(it.value(), m_doc);
+			item->setIcon(0, *pPixmap);
+			item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+		}
 	}
 	return ret;
+}
+
+void PaintManagerDialog::slotRightClick(QPoint p)
+{
+	QTreeWidgetItem* it = dataTree->itemAt(p);
+	if (it)
+	{
+		if ((it->parent() == colorItems) || (it == colorItems))
+		{
+			QMenu *pmen = new QMenu();
+			qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+			pmen->addAction( tr("Sort by Name"));
+			pmen->addAction( tr("Sort by Color"));
+			pmen->addAction( tr("Sort by Type"));
+			sortRule = pmen->actions().indexOf(pmen->exec(QCursor::pos()));
+			delete pmen;
+			updateColorList();
+		}
+	}
 }
 
 void PaintManagerDialog::selEditColor(QTreeWidgetItem *it)

Modified: branches/ScribusOIF/scribus/ui/paintmanager.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15667&path=/branches/ScribusOIF/scribus/ui/paintmanager.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/paintmanager.h (original)
+++ branches/ScribusOIF/scribus/ui/paintmanager.h Wed Oct 27 23:36:57 2010
@@ -63,6 +63,7 @@
 		QStringList customColSet;
 		bool hasImportedColors;
 	private slots:
+		void slotRightClick(QPoint p);
 		void selEditColor(QTreeWidgetItem *it);
 		void itemSelectionChanged();
 		void itemSelected(QTreeWidgetItem* it);
@@ -84,6 +85,7 @@
 		void loadScribusFormat(QString fileName);
 		ColorSetManager csm;
 		bool paletteLocked;
+		int sortRule;
 		QTreeWidgetItem *colorItems;
 		QTreeWidgetItem *gradientItems;
 		QTreeWidgetItem *systemSwatches;




More information about the scribus-commit mailing list