r15611 by fschmid - Fixed loading of custom palettes.

scribus-commit scribus-commit at lists.scribus.net
Thu Oct 21 22:51:24 CEST 2010


Author: fschmid
Date: Thu Oct 21 20:51:23 2010
New Revision: 15611

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15611
Log:
Fixed loading of custom palettes.
Replaced the old colormanager and gradientmanager with the new paintmanager.
Moved the sources of the old colormanager and gradientmanager out of the build.

Modified:
    trunk/Scribus/scribus/CMakeLists.txt
    trunk/Scribus/scribus/actionmanager.cpp
    trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
    trunk/Scribus/scribus/plugins/colorwheel/cwdialog.cpp
    trunk/Scribus/scribus/prefsmanager.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribus.h
    trunk/Scribus/scribus/ui/paintmanager.cpp
    trunk/Scribus/scribus/ui/paintmanager.h
    trunk/Scribus/scribus/util_color.cpp
    trunk/Scribus/scribus/util_color.h

Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15611&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Thu Oct 21 20:51:23 2010
@@ -75,7 +75,6 @@
   ui/docsections.ui
   ui/gradientaddedit.ui
   ui/gradienteditor.ui
-  ui/gradientmanager.ui
   ui/gradientvectorbase.ui
   ui/gtfiledialog.ui
   ui/guidemanager.ui
@@ -191,7 +190,6 @@
   ui/colorchart.h
   ui/colorcombo.h
   ui/colorlistbox.h
-  ui/colorm.h
   commonstrings.h
   ui/contextmenu.h
   ui/cpalette.h
@@ -218,7 +216,6 @@
   ui/fontreplacedialog.h
   ui/gradientaddedit.h
   ui/gradienteditor.h
-  ui/gradientmanager.h
   ui/gradientvectordialog.h
   ui/gradientpreview.h
   ui/gtdialogs.h
@@ -483,7 +480,6 @@
   ui/colorchart.cpp
   ui/colorcombo.cpp
   ui/colorlistbox.cpp
-  ui/colorm.cpp
   colorsetmanager.cpp
   commonstrings.cpp
   ui/contextmenu.cpp
@@ -519,7 +515,6 @@
   fpoptimizer.cpp
   ui/gradientaddedit.cpp
   ui/gradienteditor.cpp
-  ui/gradientmanager.cpp
   ui/gradientvectordialog.cpp
   ui/gradientpreview.cpp
   gtaction.cpp

Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15611&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp (original)
+++ trunk/Scribus/scribus/actionmanager.cpp Thu Oct 21 20:51:23 2010
@@ -232,10 +232,8 @@
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="editPatterns";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
-	name="editGradients";
-	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
-	name="editPaints";
-	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
+//	name="editGradients";
+//	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="editStyles";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="editMasterPages";
@@ -260,11 +258,10 @@
 	connect( (*scrActions)["editSearchReplace"], SIGNAL(triggered()), mainWindow, SLOT(SearchText()) );
 	connect( (*scrActions)["editEditWithImageEditor"], SIGNAL(triggered()), mainWindow, SLOT(callImageEditor()) );
 	connect( (*scrActions)["editEditRenderSource"], SIGNAL(triggered()), mainWindow, SLOT(callImageEditor()) );
-	connect( (*scrActions)["editColors"], SIGNAL(triggered()), mainWindow, SLOT(slotEditColors()) );
+	connect( (*scrActions)["editColors"], SIGNAL(triggered()), mainWindow, SLOT(managePaints()) );
 	connect( (*scrActions)["editReplaceColors"], SIGNAL(triggered()), mainWindow, SLOT(slotReplaceColors()) );
 	connect( (*scrActions)["editPatterns"], SIGNAL(triggered()), mainWindow, SLOT(managePatterns()) );
-	connect( (*scrActions)["editGradients"], SIGNAL(triggered()), mainWindow, SLOT(manageGradients()) );
-	connect( (*scrActions)["editPaints"], SIGNAL(triggered()), mainWindow, SLOT(managePaints()) );
+//	connect( (*scrActions)["editGradients"], SIGNAL(triggered()), mainWindow, SLOT(manageGradients()) );
 	connect( (*scrActions)["editMasterPages"], SIGNAL(triggered()), mainWindow, SLOT(manageMasterPages()) );
 	connect( (*scrActions)["editJavascripts"], SIGNAL(triggered()), mainWindow, SLOT(ManageJava()) );
 }
@@ -1319,8 +1316,7 @@
 	(*scrActions)["editColors"]->setTexts( tr("C&olors..."));
 	(*scrActions)["editReplaceColors"]->setTexts( tr("Replace Colors..."));
 	(*scrActions)["editPatterns"]->setTexts( tr("Patterns..."));
-	(*scrActions)["editGradients"]->setTexts( tr("Gradients..."));
-	(*scrActions)["editPaints"]->setTexts( tr("Paints..."));
+//	(*scrActions)["editGradients"]->setTexts( tr("Gradients..."));
 	(*scrActions)["editStyles"]->setTexts( tr("S&tyles..."));
 	(*scrActions)["editMasterPages"]->setTexts( tr("&Master Pages..."));
 	(*scrActions)["editJavascripts"]->setTexts( tr("&JavaScripts..."));
@@ -1763,7 +1759,7 @@
 	itmenu->second << "fileDocSetup" << "fileDocSetup150" << "filePreferences" << "filePreferences150" << "filePrint" << "PrintPreview" << "fileQuit";
 	++itmenu;
 	//Edit
-	itmenu->second << "editUndoAction" << "editRedoAction" << "editActionMode" << "editCut" << "editCopy" << "editPaste" << "editCopyContents" << "editPasteContents" << "editPasteContentsAbs" << "editClearContents" << "editSelectAll" << "editSelectAllOnLayer" << "editDeselectAll" << "editSearchReplace" << "toolsEditWithStoryEditor" << "editEditWithImageEditor" << "editEditRenderSource" << "editExtendedImageProperties" << "editColors" << "editReplaceColors" << "editPatterns" << "editGradients" << "editPaints" << "editStyles" << "editMasterPages" << "editJavascripts";
+	itmenu->second << "editUndoAction" << "editRedoAction" << "editActionMode" << "editCut" << "editCopy" << "editPaste" << "editCopyContents" << "editPasteContents" << "editPasteContentsAbs" << "editClearContents" << "editSelectAll" << "editSelectAllOnLayer" << "editDeselectAll" << "editSearchReplace" << "toolsEditWithStoryEditor" << "editEditWithImageEditor" << "editEditRenderSource" << "editExtendedImageProperties" << "editColors" << "editReplaceColors" << "editPatterns" << "editStyles" << "editMasterPages" << "editJavascripts";
 	//Style
 	++itmenu;
 	int font_sizes[] = {7, 9, 10, 11, 12, 14, 18, 24, 36, 48, 60, 72};

Modified: trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15611&path=/trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp (original)
+++ trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp Thu Oct 21 20:51:23 2010
@@ -15,7 +15,7 @@
 #include "undomanager.h"
 #include "util_ghostscript.h"
 #include "util_icon.h"
-#include "ui/colorm.h"
+#include "ui/paintmanager.h"
 
 #include <QSharedPointer>
 #include <QTextStream>
@@ -218,8 +218,7 @@
 
 void BarcodeGenerator::bgColorButton_pressed()
 {
-	ColorManager d(this, ScCore->primaryMainWindow()->doc->PageColors, ScCore->primaryMainWindow()->doc, "", QStringList());
-
+	paintManagerDialog d(this, &ScCore->primaryMainWindow()->doc->docGradients, ScCore->primaryMainWindow()->doc->PageColors, "", QStringList(), ScCore->primaryMainWindow()->doc, ScCore->primaryMainWindow());
 	if (!d.exec())
 		return;
 	bgColor = d.selectedColor();
@@ -230,8 +229,7 @@
 
 void BarcodeGenerator::lnColorButton_pressed()
 {
-	ColorManager d(this, ScCore->primaryMainWindow()->doc->PageColors, ScCore->primaryMainWindow()->doc, "", QStringList());
-
+	paintManagerDialog d(this, &ScCore->primaryMainWindow()->doc->docGradients, ScCore->primaryMainWindow()->doc->PageColors, "", QStringList(), ScCore->primaryMainWindow()->doc, ScCore->primaryMainWindow());
 	if (!d.exec())
 		return;
 	lnColor = d.selectedColor();
@@ -242,7 +240,7 @@
 
 void BarcodeGenerator::txtColorButton_pressed()
 {
-	ColorManager d(this, ScCore->primaryMainWindow()->doc->PageColors, ScCore->primaryMainWindow()->doc, "", QStringList());
+	paintManagerDialog d(this, &ScCore->primaryMainWindow()->doc->docGradients, ScCore->primaryMainWindow()->doc->PageColors, "", QStringList(), ScCore->primaryMainWindow()->doc, ScCore->primaryMainWindow());
 
 	if (!d.exec())
 		return;

Modified: trunk/Scribus/scribus/plugins/colorwheel/cwdialog.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15611&path=/trunk/Scribus/scribus/plugins/colorwheel/cwdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/colorwheel/cwdialog.cpp (original)
+++ trunk/Scribus/scribus/plugins/colorwheel/cwdialog.cpp Thu Oct 21 20:51:23 2010
@@ -335,7 +335,7 @@
 	if (err)
 	{
 		QMessageBox::information(this, tr("Color Merging"), status);
-		m_Doc->scMW()->slotEditColors();
+		m_Doc->scMW()->managePaints();
 		return;
 	}
 	m_Doc->scMW()->propertiesPalette->updateColorList();

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15611&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp (original)
+++ trunk/Scribus/scribus/prefsmanager.cpp Thu Oct 21 20:51:23 2010
@@ -1656,7 +1656,7 @@
 	for (int ccs=0; ccs<appPrefs.colorPrefs.CustomColorSets.count(); ++ccs)
 	{
 		QDomElement cos=docu.createElement("ColorSet");
-		cos.setAttribute("NAME",appPrefs.colorPrefs.CustomColorSets[ccs]);
+		cos.setAttribute("Name",appPrefs.colorPrefs.CustomColorSets[ccs]);
 		elem.appendChild(cos);
 	}
 	QDomElement cosd=docu.createElement("DefaultColorSet");

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15611&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Oct 21 20:51:23 2010
@@ -92,7 +92,6 @@
 #include "ui/cmsprefs.h"
 #include "ui/collectforoutput_ui.h"
 #include "ui/colorcombo.h"
-#include "ui/colorm.h"
 #include "commonstrings.h"
 #include "ui/contextmenu.h"
 #include "ui/cpalette.h"
@@ -113,7 +112,6 @@
 #include "fpoint.h"
 #include "fpointarray.h"
 #include "gtgettext.h"
-#include "ui/gradientmanager.h"
 #include "ui/guidemanager.h"
 #include "ui/helpbrowser.h"
 #include "ui/hruler.h"
@@ -690,8 +688,7 @@
 	scrMenuMgr->addMenuSeparator("Edit");
 	scrMenuMgr->addMenuItem(scrActions["editColors"], "Edit", true);
 	scrMenuMgr->addMenuItem(scrActions["editReplaceColors"], "Edit", false);
-	scrMenuMgr->addMenuItem(scrActions["editGradients"], "Edit", false);
-	scrMenuMgr->addMenuItem(scrActions["editPaints"], "Edit", true);
+//	scrMenuMgr->addMenuItem(scrActions["editGradients"], "Edit", false);
 	scrMenuMgr->addMenuItem(scrActions["editPatterns"], "Edit", false);
 	scrMenuMgr->addMenuItem(scrActions["editStyles"], "Edit", false);
 	scrMenuMgr->addMenuItem(scrActions["editMasterPages"], "Edit", false);
@@ -2343,7 +2340,7 @@
 	scrActions["editDeselectAll"]->setEnabled(false);
 	scrActions["editReplaceColors"]->setEnabled(true);
 	scrActions["editPatterns"]->setEnabled(true);
-	scrActions["editGradients"]->setEnabled(true);
+//	scrActions["editGradients"]->setEnabled(true);
  	scrActions["editStyles"]->setEnabled(true);
 	scrActions["editMasterPages"]->setEnabled(true);
 	scrActions["editJavascripts"]->setEnabled(true);
@@ -4489,8 +4486,8 @@
 		scrActions["editDeselectAll"]->setEnabled(false);
 		scrActions["editReplaceColors"]->setEnabled(false);
 		scrActions["editPatterns"]->setEnabled(false);
-		scrActions["editGradients"]->setEnabled(false);
- 		scrActions["editStyles"]->setEnabled(false);
+//		scrActions["editGradients"]->setEnabled(false);
+		scrActions["editStyles"]->setEnabled(false);
 		scrActions["editSearchReplace"]->setEnabled(false);
 		scrActions["editMasterPages"]->setEnabled(false);
 		scrActions["editJavascripts"]->setEnabled(false);
@@ -9981,60 +9978,15 @@
 			// Update tools colors if needed
 			prefsManager->replaceToolColors(dia->replaceColorMap);
 			prefsManager->setColorSet(dia->m_colorList);
-			prefsManager->setColorSetName(dia->getColorSetName());
 			propertiesPalette->Cpal->SetColors(prefsManager->colorSet());
 			prefsManager->appPrefs.defaultGradients = dia->dialogGradients;
 		}
 	}
-	if (!HaveDoc)
-		prefsManager->appPrefs.colorPrefs.CustomColorSets = dia->customColSet;
+	prefsManager->setColorSetName(dia->getColorSetName());
+//	if (!HaveDoc)
+	prefsManager->appPrefs.colorPrefs.CustomColorSets = dia->customColSet;
 	delete dia;
 	undoManager->setUndoEnabled(true);
-}
-
-void ScribusMainWindow::manageGradients()
-{
-	if (HaveDoc)
-	{
-		undoManager->setUndoEnabled(false);
-		gradientManagerDialog *dia = new gradientManagerDialog(this, &doc->docGradients, doc->PageColors, doc, this);
-		if (dia->exec())
-		{
-			doc->setGradients(dia->dialogGradients);
-			if (!dia->replaceMap.isEmpty())
-			{
-				ResourceCollection gradrsc;
-				gradrsc.mapPatterns(dia->replaceMap);
-				doc->replaceNamedResources(gradrsc);
-			}
-			if (dia->hasImportedColors)
-			{
-				doc->PageColors = dia->m_colorList;
-				doc->recalculateColors();
-				doc->recalcPicturesRes();
-				propertiesPalette->SetLineFormats(doc);
-				styleManager->updateColorList();
-			}
-			propertiesPalette->updateColorList();
-			view->DrawNew();
-			if (doc->m_Selection->count() != 0)
-				doc->m_Selection->itemAt(0)->emitAllToGUI();
-			slotDocCh();
-		}
-		delete dia;
-		undoManager->setUndoEnabled(true);
-	}
-	else
-	{
-		gradientManagerDialog *dia = new gradientManagerDialog(this, &prefsManager->appPrefs.defaultGradients, prefsManager->colorSet(), NULL, this);
-		if (dia->exec())
-		{
-			prefsManager->appPrefs.defaultGradients = dia->dialogGradients;
-			if (dia->hasImportedColors)
-				prefsManager->setColorSet(dia->m_colorList);
-		}
-		delete dia;
-	}
 }
 
 void ScribusMainWindow::slotReplaceColors()
@@ -10063,6 +10015,51 @@
 		delete dia2;
 	}
 }
+/*
+void ScribusMainWindow::manageGradients()
+{
+	if (HaveDoc)
+	{
+		undoManager->setUndoEnabled(false);
+		gradientManagerDialog *dia = new gradientManagerDialog(this, &doc->docGradients, doc->PageColors, doc, this);
+		if (dia->exec())
+		{
+			doc->setGradients(dia->dialogGradients);
+			if (!dia->replaceMap.isEmpty())
+			{
+				ResourceCollection gradrsc;
+				gradrsc.mapPatterns(dia->replaceMap);
+				doc->replaceNamedResources(gradrsc);
+			}
+			if (dia->hasImportedColors)
+			{
+				doc->PageColors = dia->m_colorList;
+				doc->recalculateColors();
+				doc->recalcPicturesRes();
+				propertiesPalette->SetLineFormats(doc);
+				styleManager->updateColorList();
+			}
+			propertiesPalette->updateColorList();
+			view->DrawNew();
+			if (doc->m_Selection->count() != 0)
+				doc->m_Selection->itemAt(0)->emitAllToGUI();
+			slotDocCh();
+		}
+		delete dia;
+		undoManager->setUndoEnabled(true);
+	}
+	else
+	{
+		gradientManagerDialog *dia = new gradientManagerDialog(this, &prefsManager->appPrefs.defaultGradients, prefsManager->colorSet(), NULL, this);
+		if (dia->exec())
+		{
+			prefsManager->appPrefs.defaultGradients = dia->dialogGradients;
+			if (dia->hasImportedColors)
+				prefsManager->setColorSet(dia->m_colorList);
+		}
+		delete dia;
+	}
+}
 
 void ScribusMainWindow::slotEditColors()
 {
@@ -10099,12 +10096,6 @@
 			doc->recalculateColors();
 			doc->recalcPicturesRes();
 			updateColorLists();
-			/*
-			propertiesPalette->updateColorList();
-			//3102: update the line styles in PP too
-			propertiesPalette->SetLineFormats(doc);
-			styleManager->updateColorList();
-			*/
 			if (doc->m_Selection->count() != 0)
 				doc->m_Selection->itemAt(0)->emitAllToGUI();
 			view->DrawNew();
@@ -10122,6 +10113,7 @@
 		prefsManager->appPrefs.colorPrefs.CustomColorSets = dia->customColSet;
 	delete dia;
 }
+*/
 
 void ScribusMainWindow::enableTextActions(QMap<QString, QPointer<ScrAction> > *actionMap, bool enabled, const QString& fontName)
 {

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15611&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Thu Oct 21 20:51:23 2010
@@ -447,7 +447,7 @@
 	/** Setz die Zeichensatzgroesse */
 	void setItemFSize(int id);
 	/** Farbeditor */
-	void slotEditColors();
+//	void slotEditColors();
 	/** Color Replacement */
 	void slotReplaceColors();
 	/** Style Manager */
@@ -554,7 +554,7 @@
 	//! \brief manages the documents patterns
 	void managePatterns();
 	//! \brief manages the documents gradients
-	void manageGradients();
+//	void manageGradients();
 	//! \brief manages paints
 	void managePaints();
 	//! \brief enable or disable the unicode actions and their menus

Modified: trunk/Scribus/scribus/ui/paintmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15611&path=/trunk/Scribus/scribus/ui/paintmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/paintmanager.cpp (original)
+++ trunk/Scribus/scribus/ui/paintmanager.cpp Thu Oct 21 20:51:23 2010
@@ -87,7 +87,7 @@
 		realEx.clear();
 		for (int m = 0; m < custColSet.count(); ++m)
 		{
-			QString Cpfad = QDir::convertSeparators(ScPaths::getApplicationDataDir() + custColSet[m]);
+			QString Cpfad = QDir::convertSeparators(ScPaths::getApplicationDataDir() + custColSet[m] + ".xml");
 			QFileInfo cfi(Cpfad);
 			if (cfi.exists())
 			{
@@ -826,7 +826,11 @@
 {
 	int c = LoadColSet->currentIndex();
 	setCurrentComboItem(LoadColSet, txt);
-	m_colorList.clear();
+	if (m_doc == NULL)
+	{
+		m_colorList.clear();
+		dialogGradients.clear();
+	}
 	QString pfadC2 = "";
 	if (txt == "Scribus Small")
 	{
@@ -861,7 +865,7 @@
 	}
 	if (txt != "Scribus Small")
 	{
-		if (importColorsFromFile(pfadC2, m_colorList, &dialogGradients))
+		if (importColorsFromFile(pfadC2, m_colorList, &dialogGradients, (m_doc!=0)))
 		{
 			m_colorList.insert("White", ScColor(0, 0, 0, 0));
 			m_colorList.insert("Black", ScColor(0, 0, 0, 255));
@@ -965,3 +969,25 @@
 {
 	return LoadColSet->currentText();
 }
+
+ScColor paintManagerDialog::selectedColor()
+{
+	QTreeWidgetItem* it = dataTree->currentItem();
+	if (it)
+	{
+		if (it->parent() == colorItems)
+			return m_colorList[it->text(0)];
+	}
+	return ScColor();
+}
+
+QString paintManagerDialog::selectedColorName()
+{
+	QTreeWidgetItem* it = dataTree->currentItem();
+	if (it)
+	{
+		if (it->parent() == colorItems)
+			return it->text(0);
+	}
+	return CommonStrings::None;
+}

Modified: trunk/Scribus/scribus/ui/paintmanager.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15611&path=/trunk/Scribus/scribus/ui/paintmanager.h
==============================================================================
--- trunk/Scribus/scribus/ui/paintmanager.h (original)
+++ trunk/Scribus/scribus/ui/paintmanager.h Thu Oct 21 20:51:23 2010
@@ -43,6 +43,14 @@
 		/*! \brief Returns the name of the current/selected color set.
 		\retval QString selected name. */
 		QString getColorSetName();
+		/*! \brief Returns currently selected ScColor.
+		It's used e.g. in BarcodeGenerator plugin.
+		*/
+		ScColor selectedColor();
+		/*! \brief Returns name of the currently selected color.
+		It's used e.g. in BarcodeGenerator plugin.
+		*/
+		QString selectedColorName();
 		ScribusDoc *m_doc;
 		ScribusMainWindow *mainWin;
 		QMap<QString, VGradient> dialogGradients;

Modified: trunk/Scribus/scribus/util_color.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15611&path=/trunk/Scribus/scribus/util_color.cpp
==============================================================================
--- trunk/Scribus/scribus/util_color.cpp (original)
+++ trunk/Scribus/scribus/util_color.cpp Thu Oct 21 20:51:23 2010
@@ -595,7 +595,7 @@
 	return CommonStrings::trUnknownCS;
 }
 
-bool importColorsFromFile(QString fileName, ColorList &EditColors, QMap<QString,VGradient> *dialogGradients)
+bool importColorsFromFile(QString fileName, ColorList &EditColors, QMap<QString,VGradient> *dialogGradients, bool merge)
 {
 	int oldCount = EditColors.count();
 	if (!fileName.isEmpty())
@@ -805,7 +805,7 @@
 										gra.addStop(color, ramp, 0.5, opa, name, shade);
 										grad = grad.nextSibling();
 									}
-									if (!dialogGradients->contains(pg.attribute("Name")))
+									if ((!dialogGradients->contains(pg.attribute("Name"))) || (merge))
 										dialogGradients->insert(pg.attribute("Name"), gra);
 									else
 									{

Modified: trunk/Scribus/scribus/util_color.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15611&path=/trunk/Scribus/scribus/util_color.h
==============================================================================
--- trunk/Scribus/scribus/util_color.h (original)
+++ trunk/Scribus/scribus/util_color.h Thu Oct 21 20:51:23 2010
@@ -111,6 +111,6 @@
  * \param EditColors Color list to store the imported colors
  * \return true if any colors have been found
 */
-bool SCRIBUS_API importColorsFromFile(QString fileName, ColorList &EditColors, QMap<QString,VGradient> *dialogGradients = NULL);
+bool SCRIBUS_API importColorsFromFile(QString fileName, ColorList &EditColors, QMap<QString,VGradient> *dialogGradients = NULL, bool merge = false);
 
 #endif




More information about the scribus-commit mailing list