r20145 by fschmid - Adding Lab-Color Support + the abiltiy to load Swatchbooker .sbz files.

scribus-commit scribus-commit at lists.scribus.net
Thu Jun 4 07:54:19 UTC 2015


Author: fschmid
Date: Thu Jun  4 07:54:19 2015
New Revision: 20145

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20145
Log:
Adding Lab-Color Support + the abiltiy to load Swatchbooker .sbz files.

Added:
    trunk/Scribus/resources/iconsets/1_5_0/lab.png   (with props)
    trunk/Scribus/scribus/colormgmt/sccolorspacedata_labdbl.h
Modified:
    trunk/Scribus/scribus/colormgmt/sccolormgmtenginedata.cpp
    trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.cpp
    trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.h
    trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp
    trunk/Scribus/scribus/colorsetmanager.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
    trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
    trunk/Scribus/scribus/pslib.cpp
    trunk/Scribus/scribus/sccolor.cpp
    trunk/Scribus/scribus/sccolor.h
    trunk/Scribus/scribus/sccolorengine.cpp
    trunk/Scribus/scribus/sccolorshade.cpp
    trunk/Scribus/scribus/scribuscore.cpp
    trunk/Scribus/scribus/scribuscore.h
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h
    trunk/Scribus/scribus/ui/cmykfw.cpp
    trunk/Scribus/scribus/ui/cmykfw.h
    trunk/Scribus/scribus/ui/colorlistbox.cpp
    trunk/Scribus/scribus/ui/paintmanager.cpp
    trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp
    trunk/Scribus/scribus/ui/propertiespalette_shadow.h
    trunk/Scribus/scribus/ui/proptree.cpp
    trunk/Scribus/scribus/ui/proptree.h
    trunk/Scribus/scribus/util_color.cpp

Modified: trunk/Scribus/scribus/colormgmt/sccolormgmtenginedata.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/colormgmt/sccolormgmtenginedata.cpp
==============================================================================
--- trunk/Scribus/scribus/colormgmt/sccolormgmtenginedata.cpp (original)
+++ trunk/Scribus/scribus/colormgmt/sccolormgmtenginedata.cpp Thu Jun  4 07:54:19 2015
@@ -10,6 +10,7 @@
 #include "sccolorspacedata_cmyka.h"
 #include "sccolorspacedata_gray.h"
 #include "sccolorspacedata_laba.h"
+#include "sccolorspacedata_labdbl.h"
 #include "sccolorspacedata_rgb.h"
 #include "sccolorspacedata_rgba.h"
 
@@ -62,6 +63,8 @@
 	{
 		if (colorFormat == Format_LabA_8)
 			colorSpace = ScColorSpace(new ScColorSpaceData_LabA8(profile));
+		if (colorFormat == Format_Lab_Dbl)
+			colorSpace = ScColorSpace(new ScColorSpaceData_LabD(profile));
 	}
 	return colorSpace;
 }

Modified: trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.cpp
==============================================================================
--- trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.cpp (original)
+++ trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.cpp Thu Jun  4 07:54:19 2015
@@ -47,6 +47,7 @@
 		type = Color_Gray;
 		break;
 	case Format_LabA_8:
+	case Format_Lab_Dbl:
 		type = Color_Lab;
 		break;
 	case Format_Undefined:
@@ -90,6 +91,9 @@
 	case Format_LabA_8:
 		channels = 4;
 		break;
+	case Format_Lab_Dbl:
+		channels = 3;
+		break;
 	default: // For the pure sake of shutting gcc up
 		channels = 0;
 		break;
@@ -123,6 +127,9 @@
 	case Format_GRAY_16:
 		bytes = 2;
 		break;
+	case Format_Lab_Dbl:
+		bytes = 8;
+		break;
 	default: // For the pure sake of shutting gcc up
 		bytes = 0;
 		break;

Modified: trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.h
==============================================================================
--- trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.h (original)
+++ trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.h Thu Jun  4 07:54:19 2015
@@ -31,7 +31,8 @@
 	Format_YMCK_16,
 	Format_GRAY_8,
 	Format_GRAY_16,
-	Format_LabA_8
+	Format_LabA_8,
+	Format_Lab_Dbl
 } eColorFormat;
 
 typedef enum

Modified: trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp
==============================================================================
--- trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp (original)
+++ trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp Thu Jun  4 07:54:19 2015
@@ -462,6 +462,8 @@
 		lFormat = TYPE_GRAY_16;
 	if (format == Format_LabA_8)
 		lFormat = COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1);
+	if (format == Format_Lab_Dbl)
+		lFormat = TYPE_Lab_DBL;
 	return lFormat;
 }
 

Modified: trunk/Scribus/scribus/colorsetmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/colorsetmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/colorsetmanager.cpp (original)
+++ trunk/Scribus/scribus/colorsetmanager.cpp Thu Jun  4 07:54:19 2015
@@ -80,8 +80,15 @@
 					{
 						if (pg.hasAttribute("CMYK"))
 							lf.setNamedColor(pg.attribute("CMYK"));
+						else if (pg.hasAttribute("RGB"))
+							lf.fromQColor(QColor(pg.attribute("RGB")));
 						else
-							lf.fromQColor(QColor(pg.attribute("RGB")));
+						{
+							double L = pg.attribute("L", 0).toDouble();
+							double a = pg.attribute("A", 0).toDouble();
+							double b = pg.attribute("B", 0).toDouble();
+							lf.setColor(L, a, b);
+						}
 						if (pg.hasAttribute("Spot"))
 							lf.setSpotColor(static_cast<bool>(pg.attribute("Spot").toInt()));
 						else
@@ -146,7 +153,7 @@
 void ColorSetManager::searchDir(QString path, QMap<QString, QString> &pList, QTreeWidgetItem* parent)
 {
 	QStringList exts;
-	exts << "acb" << "aco" << "ai" << "eps" << "gpl" << "skp" << "sla" << "soc" << "xar" << "xml";
+	exts << "acb" << "aco" << "ai" << "eps" << "gpl" << "skp" << "sla" << "soc" << "xar" << "xml" << "sbz";
 	QDir dirs(path, "*", QDir::Name,  QDir::Dirs | QDir::NoDotAndDotDot | QDir::Files | QDir::NoSymLinks);
 	dirs.setSorting(QDir::Name | QDir::DirsFirst);
 	if ((dirs.exists()) && (dirs.count() != 0))

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Thu Jun  4 07:54:19 2015
@@ -2367,8 +2367,15 @@
 	ScColor color;
 	if (attrs.hasAttribute("CMYK"))
 		color.setNamedColor(attrs.valueAsString("CMYK"));
+	else if (attrs.hasAttribute("RGB"))
+		color.fromQColor(QColor(attrs.valueAsString("RGB")));
 	else
-		color.fromQColor(QColor(attrs.valueAsString("RGB")));
+	{
+		double L = attrs.valueAsDouble("L", 0);
+		double a = attrs.valueAsDouble("A", 0);
+		double b = attrs.valueAsDouble("B", 0);
+		color.setColor(L, a, b);
+	}
 	color.setSpotColor( attrs.valueAsBool("Spot", false) );
 	color.setRegistrationColor( attrs.valueAsBool("Register", false) );
 	QString name = attrs.valueAsString("NAME", color.name());

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Thu Jun  4 07:54:19 2015
@@ -568,8 +568,16 @@
 		docu.writeAttribute("NAME",itc.key());
 		if (m_Doc->PageColors[itc.key()].getColorModel() == colorModelRGB)
 			docu.writeAttribute("RGB",m_Doc->PageColors[itc.key()].nameRGB());
+		else if (m_Doc->PageColors[itc.key()].getColorModel() == colorModelCMYK)
+			docu.writeAttribute("CMYK",m_Doc->PageColors[itc.key()].nameCMYK());
 		else
-			docu.writeAttribute("CMYK",m_Doc->PageColors[itc.key()].nameCMYK());
+		{
+			double L, a, b;
+			m_Doc->PageColors[itc.key()].getLab(&L, &a, &b);
+			docu.writeAttribute("L", L);
+			docu.writeAttribute("A", a);
+			docu.writeAttribute("B", b);
+		}
 		if (m_Doc->PageColors[itc.key()].isSpotColor())
 			docu.writeAttribute("Spot",static_cast<int>(m_Doc->PageColors[itc.key()].isSpotColor()));
 		if (m_Doc->PageColors[itc.key()].isRegistrationColor())

Modified: trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp Thu Jun  4 07:54:19 2015
@@ -2858,9 +2858,9 @@
 	ScColor ret;
 	if (m_colorModel == 1)		// RGB
 	{
-		uint r = breader->getUInt(colorPrecision);
-		uint g = breader->getUInt(colorPrecision);
-		uint b = breader->getUInt(colorPrecision);
+		int r = breader->getUInt(colorPrecision);
+		int g = breader->getUInt(colorPrecision);
+		int b = breader->getUInt(colorPrecision);
 		r = qRound(r * (maxColor - minColor) / static_cast<double>(maxColor));
 		g = qRound(g * (maxColor - minColor) / static_cast<double>(maxColor));
 		b = qRound(b * (maxColor - minColor) / static_cast<double>(maxColor));
@@ -2890,9 +2890,9 @@
 		{
 			quint8 ri, gi, bi;
 			ts >> ri >> gi >> bi;
-			uint r = ri;
-			uint g = gi;
-			uint b = bi;
+			int r = ri;
+			int g = gi;
+			int b = bi;
 			r = qRound(r * (maxColor - minColor) / static_cast<double>(maxColor));
 			g = qRound(g * (maxColor - minColor) / static_cast<double>(maxColor));
 			b = qRound(b * (maxColor - minColor) / static_cast<double>(maxColor));
@@ -2902,9 +2902,9 @@
 		{
 			quint16 ri, gi, bi;
 			ts >> ri >> gi >> bi;
-			uint r = ri;
-			uint g = gi;
-			uint b = bi;
+			int r = ri;
+			int g = gi;
+			int b = bi;
 			r = qRound((r * (maxColor - minColor) / static_cast<double>(maxColor)) / static_cast<double>(maxColor) * 255.0);
 			g = qRound((g * (maxColor - minColor) / static_cast<double>(maxColor)) / static_cast<double>(maxColor) * 255.0);
 			b = qRound((b * (maxColor - minColor) / static_cast<double>(maxColor)) / static_cast<double>(maxColor) * 255.0);
@@ -2929,9 +2929,9 @@
 			ts >> p1;
 			bi = p2 << 8;
 			bi |= p1;
-			uint r = ri;
-			uint g = gi;
-			uint b = bi;
+			int r = ri;
+			int g = gi;
+			int b = bi;
 			r = qRound((r * (maxColor - minColor) / static_cast<double>(maxColor)) / static_cast<double>(maxColor) * 255.0);
 			g = qRound((g * (maxColor - minColor) / static_cast<double>(maxColor)) / static_cast<double>(maxColor) * 255.0);
 			b = qRound((b * (maxColor - minColor) / static_cast<double>(maxColor)) / static_cast<double>(maxColor) * 255.0);
@@ -2941,9 +2941,9 @@
 		{
 			quint32 ri, gi, bi;
 			ts >> ri >> gi >> bi;
-			uint r = ri;
-			uint g = gi;
-			uint b = bi;
+			int r = ri;
+			int g = gi;
+			int b = bi;
 			r = qRound((r * (maxColor - minColor) / static_cast<double>(maxColor)) / static_cast<double>(maxColor) * 255.0);
 			g = qRound((g * (maxColor - minColor) / static_cast<double>(maxColor)) / static_cast<double>(maxColor) * 255.0);
 			b = qRound((b * (maxColor - minColor) / static_cast<double>(maxColor)) / static_cast<double>(maxColor) * 255.0);

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Thu Jun  4 07:54:19 2015
@@ -5014,7 +5014,7 @@
 {
 	int h1 = *h, s1 = *s, v1 = *v, k1 = *k;
 	ScColor tmp(farb);
-	if (farb.getColorModel() == colorModelRGB)
+	if (farb.getColorModel() != colorModelCMYK)
 		tmp = ScColorEngine::convertToModel(farb, m_Doc, colorModelCMYK);
 	if ((gcr) && (!farb.isRegistrationColor()))
 		ScColorEngine::applyGCR(tmp, m_Doc);

Modified: trunk/Scribus/scribus/sccolor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/sccolor.cpp
==============================================================================
--- trunk/Scribus/scribus/sccolor.cpp (original)
+++ trunk/Scribus/scribus/sccolor.cpp Thu Jun  4 07:54:19 2015
@@ -57,6 +57,16 @@
 	setColorRGB(r, g, b);
 }
 
+ScColor::ScColor(double l, double a, double b)
+{
+	Spot = false;
+	Regist = false;
+	Model = colorModelLab;
+	L_val = l;
+	a_val = a;
+	b_val = b;
+}
+
 bool ScColor::operator==(const ScColor& other) const
 {
 	if (Model != other.Model)
@@ -85,6 +95,14 @@
 	Model = colorModelCMYK;
 }
 
+void ScColor::setColor(double l, double a, double b)
+{
+	Model = colorModelLab;
+	L_val = l;
+	a_val = a;
+	b_val = b;
+}
+
 void ScColor::setColorRGB(int r, int g, int b)
 {
 	CR = r;
@@ -154,6 +172,15 @@
 	*m = MG;
 	*y = YB;
 	*k = K;
+}
+
+void ScColor::getLab(double *L, double *a, double *b) const
+{
+	if( Model != colorModelLab )
+		qDebug("calling getLab with a non Lab color");
+	*L = L_val;
+	*a = a_val;
+	*b = b_val;
 }
 
 QString ScColor::name()

Modified: trunk/Scribus/scribus/sccolor.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/sccolor.h
==============================================================================
--- trunk/Scribus/scribus/sccolor.h (original)
+++ trunk/Scribus/scribus/sccolor.h Thu Jun  4 07:54:19 2015
@@ -44,7 +44,8 @@
 enum colorModel
 {
 	colorModelRGB,
-	colorModelCMYK
+	colorModelCMYK,
+	colorModelLab
 };
 
 class SCRIBUS_API ScColor 
@@ -59,6 +60,8 @@
 	ScColor(int c, int m, int y, int k);
 	/** \brief Constructs a RGBColor with 3 Components in the range from 0 - 255 */
 	ScColor(int r, int g, int b);
+	/** \brief Constructs a LabColor with 3 Components */
+	ScColor(double l, double a, double b);
 	
 	bool operator==(const ScColor& other) const;
 
@@ -67,6 +70,9 @@
 
 	/** \brief Same as the Constructor but for an existing Color */
 	void setColor(int c, int m, int y, int k);
+
+	/** \brief Same as the Constructor but for an existing Color */
+	void setColor(double l, double a, double b);
 
 	/** \brief Computes a ScColor from an RGB-Color
 	* Applies Gray-Component-Removal to the resulting ScColor
@@ -93,6 +99,11 @@
 	* Returns meaningful results only if color is a rgb color.
 	* Must not be called if color is the None Color. */
 	void getRGB(int *r, int *g, int *b) const;
+
+	/** \brief Returns the 3 Values that form an LabColor
+	* Returns meaningful results only if color is a Lab color.
+	* Must not be called if color is the None Color. */
+	void getLab(double *L, double *a, double *b) const;
 
 	/** \brief Returns the ScColor as an Hex-String in the Form #CCYYMMKK for a CMYK color or ##RRGGBB for a RGB color. 
 	* For the None color return the "None" string. */
@@ -126,6 +137,12 @@
 	int YB;
 	/** \brief Black-Component of Color */
 	int K;
+	/** \brief L component of Color */
+	double L_val;
+	/** \brief a component of Color */
+	double a_val;
+	/** \brief b component of Color */
+	double b_val;
 
 	/** \brief Flag, true if the Color is a Spotcolor */
 	bool Spot;

Modified: trunk/Scribus/scribus/sccolorengine.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/sccolorengine.cpp
==============================================================================
--- trunk/Scribus/scribus/sccolorengine.cpp (original)
+++ trunk/Scribus/scribus/sccolorengine.cpp Thu Jun  4 07:54:19 2015
@@ -39,18 +39,49 @@
 	if( oldModel == model )
 		return ScColor(color);
 	ScColor newCol;
-	if( model == colorModelRGB )
+	if (model == colorModelRGB)
 	{
 		RGBColor rgb;
 		getRGBValues(color, doc, rgb);
 		newCol.setColorRGB(rgb.r, rgb.g, rgb.b);
 	}
-	else
+	else if (model == colorModelCMYK)
 	{
 		CMYKColor cmyk;
 		getCMYKValues(color, doc, cmyk);
 		newCol.setColor(cmyk.c, cmyk.m, cmyk.y, cmyk.k);
 	}
+	else if (model == colorModelLab)
+	{
+		ScColorMgmtEngine engine(ScCore->defaultEngine);
+		if (oldModel == colorModelRGB)
+		{
+			ScColorProfile profRGB = doc ? doc->DocInputRGBProf : ScCore->defaultRGBProfile;
+			ScColorProfile profLab = ScCore->defaultLabProfile;
+			ScColorTransform trans = engine.createTransform(profRGB, Format_RGB_8, profLab, Format_Lab_Dbl, Intent_Perceptual, 0);
+			double outC[3];
+			unsigned short inC[3];
+			inC[0] = color.CR;
+			inC[1] = color.MG;
+			inC[2] = color.YB;
+			trans.apply(inC, outC, 1);
+			newCol.setColor(outC[0], outC[1], outC[2]);
+		}
+		else
+		{
+			ScColorProfile profRGB = doc ? doc->DocInputCMYKProf : ScCore->defaultCMYKProfile;
+			ScColorProfile profLab = ScCore->defaultLabProfile;
+			ScColorTransform trans = engine.createTransform(profRGB, Format_CMYK_8, profLab, Format_Lab_Dbl, Intent_Perceptual, 0);
+			double outC[3];
+			unsigned short inC[4];
+			inC[0] = color.CR;
+			inC[1] = color.MG;
+			inC[2] = color.YB;
+			inC[3] = color.K;
+			trans.apply(inC, outC, 1);
+			newCol.setColor(outC[0], outC[1], outC[2]);
+		}
+	}
 	return newCol;
 }
 
@@ -66,7 +97,7 @@
 			rgb.g = color.MG;
 			rgb.b = color.YB;
 		}
-		else
+		else if (model == colorModelCMYK)
 		{
 			unsigned short inC[4];
 			unsigned short outC[4];
@@ -79,6 +110,19 @@
 			rgb.g = outC[1] / 257;
 			rgb.b = outC[2] / 257;
 		}
+		else if (model == colorModelLab)
+		{
+			ScColorTransform trans = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans;
+			double inC[3];
+			inC[0] = color.L_val;
+			inC[1] = color.a_val;
+			inC[2] = color.b_val;
+			quint8 outC[3];
+			trans.apply(inC, outC, 1);
+			rgb.r = outC[0];
+			rgb.g = outC[1];
+			rgb.b = outC[2];
+		}
 	}
 	else if (model == colorModelCMYK)
 	{
@@ -86,11 +130,24 @@
 		rgb.g = 255 - qMin(255, color.MG + color.K);
 		rgb.b = 255 - qMin(255, color.YB + color.K);
 	}
-	else
+	else if (model == colorModelRGB)
 	{
 		rgb.r = color.CR;
 		rgb.g = color.MG;
 		rgb.b = color.YB;
+	}
+	else if (model == colorModelLab)
+	{
+		ScColorTransform trans = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans;
+		double inC[3];
+		inC[0] = color.L_val;
+		inC[1] = color.a_val;
+		inC[2] = color.b_val;
+		quint8 outC[3];
+		trans.apply(inC, outC, 1);
+		rgb.r = outC[0];
+		rgb.g = outC[1];
+		rgb.b = outC[2];
 	}
 }
 
@@ -122,13 +179,27 @@
 				cmyk.k = outC[3] / 257;
 			}
 		}
-		else
+		else if (model == colorModelCMYK)
 		{
 			cmyk.c = color.CR;
 			cmyk.m = color.MG;
 			cmyk.y = color.YB;
 			cmyk.k = color.K;
 		}
+		else if (model == colorModelLab)
+		{
+			ScColorTransform trans = doc ? doc->stdLabToCMYKTrans : ScCore->defaultLabToCMYKTrans;
+			double inC[3];
+			inC[0] = color.L_val;
+			inC[1] = color.a_val;
+			inC[2] = color.b_val;
+			quint8 outC[4];
+			trans.apply(inC, outC, 1);
+			cmyk.c = outC[0];
+			cmyk.m = outC[1];
+			cmyk.y = outC[2];
+			cmyk.k = outC[3];
+		}
 	}
 	else if (model == colorModelRGB)
 	{
@@ -137,13 +208,27 @@
 		cmyk.m = 255 - color.MG - cmyk.k;
 		cmyk.y = 255 - color.YB - cmyk.k;
 	}
-	else
+	else if (model == colorModelCMYK)
 	{
 		cmyk.c = color.CR;
 		cmyk.m = color.MG;
 		cmyk.y = color.YB;
 		cmyk.k = color.K;
 	}
+	else if (model == colorModelLab)
+	{
+		ScColorTransform trans = doc ? doc->stdLabToCMYKTrans : ScCore->defaultLabToCMYKTrans;
+		double inC[3];
+		inC[0] = color.L_val;
+		inC[1] = color.a_val;
+		inC[2] = color.b_val;
+		quint8 outC[4];
+		trans.apply(inC, outC, 1);
+		cmyk.c = outC[0];
+		cmyk.m = outC[1];
+		cmyk.y = outC[2];
+		cmyk.k = outC[3];
+	}
 }
 
 void ScColorEngine::getShadeColorCMYK(const ScColor& color, const ScribusDoc* doc, 
@@ -156,13 +241,27 @@
 		ScColor tmpR(rgb.r, rgb.g, rgb.b);
 		getCMYKValues(tmpR, doc, cmyk);
 	}
-	else
+	else if (color.getColorModel() == colorModelCMYK)
 	{
 		cmyk.c = qRound(color.CR * level / 100.0);
 		cmyk.m = qRound(color.MG * level / 100.0);
 		cmyk.y = qRound(color.YB * level / 100.0);
 		cmyk.k = qRound(color.K * level / 100.0);
 	}
+	else if (color.getColorModel() == colorModelLab)
+	{
+		ScColorTransform trans = doc ? doc->stdLabToCMYKTrans : ScCore->defaultLabToCMYKTrans;
+		double inC[3];
+		inC[0] = color.L_val * (level / 100.0);
+		inC[1] = color.a_val;
+		inC[2] = color.b_val;
+		quint8 outC[4];
+		trans.apply(inC, outC, 1);
+		cmyk.c = outC[0];
+		cmyk.m = outC[1];
+		cmyk.y = outC[2];
+		cmyk.k = outC[3];
+	}
 }
 
 void ScColorEngine::getShadeColorRGB(const ScColor& color, const ScribusDoc* doc, RGBColor& rgb, double level)
@@ -174,7 +273,7 @@
 		ScColor tmpC(cmyk.c, cmyk.m, cmyk.y, cmyk.k);
 		getRGBValues(tmpC, doc, rgb);
 	}
-	else
+	else if (color.getColorModel() == colorModelRGB)
 	{
 		int h, s, v, snew, vnew;
 		QColor tmpR(color.CR, color.MG, color.YB);
@@ -188,6 +287,19 @@
 		rgb.MG = 255 - ((255 - color.MG) * level / 100);
 		rgb.YB = 255 - ((255 - color.YB) * level / 100);*/
 	}
+	else if (color.getColorModel() == colorModelLab)
+	{
+		ScColorTransform trans = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans;
+		double inC[3];
+		inC[0] = color.L_val * (level / 100.0);
+		inC[1] = color.a_val;
+		inC[2] = color.b_val;
+		quint8 outC[3];
+		trans.apply(inC, outC, 1);
+		rgb.r = outC[0];
+		rgb.g = outC[1];
+		rgb.b = outC[2];
+	}
 }
 
 QColor ScColorEngine::getDisplayColor(const ScColor& color, const ScribusDoc* doc)
@@ -201,7 +313,7 @@
 		rgb.b = color.YB;
 		tmp = getDisplayColor(rgb, doc, color.isSpotColor());
 	}
-	else
+	else if (color.getColorModel() == colorModelCMYK)
 	{
 		CMYKColor cmyk;
 		cmyk.c = color.CR;
@@ -210,6 +322,17 @@
 		cmyk.k = color.K;
 		tmp = getDisplayColor(cmyk, doc, color.isSpotColor());
 	}
+	else if (color.getColorModel() == colorModelLab)
+	{
+		ScColorTransform trans  = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans;
+		double inC[3];
+		inC[0] = color.L_val;
+		inC[1] = color.a_val;
+		inC[2] = color.b_val;
+		quint8 outC[3];
+		trans.apply(inC, outC, 1);
+		tmp = QColor(outC[0], outC[1], outC[2]);
+	}
 	return tmp;
 }
 
@@ -225,7 +348,7 @@
 		getShadeColorRGB(color, doc, rgb, level);
 		tmp = getDisplayColor(rgb, doc, color.isSpotColor());
 	}
-	else
+	else if (color.getColorModel() == colorModelCMYK)
 	{
 		CMYKColor cmyk;
 		cmyk.c = color.CR;
@@ -234,6 +357,17 @@
 		cmyk.k = color.K;
 		getShadeColorCMYK(color, doc, cmyk, level);
 		tmp = getDisplayColor(cmyk, doc, color.isSpotColor());
+	}
+	else if (color.getColorModel() == colorModelLab)
+	{
+		ScColorTransform trans  = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans;
+		double inC[3];
+		inC[0] = color.L_val * (level / 100.0);
+		inC[1] = color.a_val;
+		inC[2] = color.b_val;
+		quint8 outC[3];
+		trans.apply(inC, outC, 1);
+		tmp = QColor(outC[0], outC[1], outC[2]);
 	}
 	return tmp;
 }
@@ -318,7 +452,7 @@
 		else
 			tmp = getColorProof(rgb, doc, color.isSpotColor(), doGC);
 	}
-	else
+	else if (color.getColorModel() == colorModelCMYK)
 	{
 		CMYKColor cmyk;
 		cmyk.c = color.CR;
@@ -327,6 +461,28 @@
 		cmyk.k = color.K;
 		getShadeColorCMYK(color, doc, cmyk, level);
 		tmp = getColorProof(cmyk, doc, color.isSpotColor(), doGC);
+	}
+	else if (color.getColorModel() == colorModelLab)
+	{
+		double inC[3];
+		inC[0] = color.L_val * (level / 100.0);
+		inC[1] = color.a_val;
+		inC[2] = color.b_val;
+		quint8 outC[3];
+		ScColorTransform trans  = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans;
+		ScColorTransform transProof   = doc ? doc->stdProofLab   : ScCore->defaultLabToRGBTrans;
+		ScColorTransform transProofGC = doc ? doc->stdProofLabGC : ScCore->defaultLabToRGBTrans;
+		if (cmsUse & doc->SoftProofing)
+		{
+			ScColorTransform xform = doGC ? transProofGC : transProof;
+			xform.apply(inC, outC, 1);
+			tmp = QColor(outC[0] / 257, outC[1] / 257, outC[2] / 257);
+		}
+		else
+		{
+			trans.apply(inC, outC, 1);
+			tmp = QColor(outC[0], outC[1], outC[2]);
+		}
 	}
 	
 	return tmp;
@@ -477,7 +633,7 @@
 			if ((color.CR == color.MG && color.MG == color.YB))
 				alert = false;
 		}
-		else
+		else if (color.getColorModel() == colorModelCMYK)
 		{
 			inC[0] = color.CR * 257;
 			inC[1] = color.MG * 257;
@@ -491,11 +647,23 @@
 			if ((color.MG == color.CR) && (color.CR == color.YB) && (color.YB == color.K))
 				alert = false;
 		}
-		if (alert)
-		{
+		else if (color.getColorModel() == colorModelLab)
+		{
+			double inC[3];
+			inC[0] = color.L_val;
+			inC[1] = color.a_val;
+			inC[2] = color.b_val;
+			xformProof = doc->stdProofLabGC;
 			xformProof.apply(inC, outC, 1);
 			if ((outC[0]/257 == 0) && (outC[1]/257 == 255) && (outC[2]/257 == 0))
 				outOfGamutFlag = true;
+			alert = false;
+		}
+		if (alert)
+		{
+			xformProof.apply(inC, outC, 1);
+			if ((outC[0]/257 == 0) && (outC[1]/257 == 255) && (outC[2]/257 == 0))
+				outOfGamutFlag = true;
 		}
 	}
 	return outOfGamutFlag;
@@ -504,7 +672,7 @@
 void ScColorEngine::applyGCR(ScColor& color, const ScribusDoc* doc)
 {
 	bool cmsUse = doc ? doc->HasCMS : false;
-	if (!(ScCore->haveCMS() && cmsUse))
+	if (!(ScCore->haveCMS() && cmsUse) && (color.getColorModel() != colorModelLab))
 	{
 		CMYKColor cmyk;
 		getCMYKValues(color, doc, cmyk);

Modified: trunk/Scribus/scribus/sccolorshade.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/sccolorshade.cpp
==============================================================================
--- trunk/Scribus/scribus/sccolorshade.cpp (original)
+++ trunk/Scribus/scribus/sccolorshade.cpp Thu Jun  4 07:54:19 2015
@@ -45,17 +45,23 @@
 ScColor ScColorShade::getShadedColor(void)
 {
 	ScColor value;
-	if( color.getColorModel() == colorModelRGB )
+	if (color.getColorModel() == colorModelRGB)
 	{
 		RGBColor rgb;
 		ScColorEngine::getShadeColorRGB(color, NULL, rgb, shade);
 		value.setColorRGB( rgb.r, rgb.g, rgb.b );
 	}
-	else
+	else if (color.getColorModel() == colorModelCMYK)
 	{
 		CMYKColor cmyk;
 		ScColorEngine::getShadeColorCMYK(color, NULL, cmyk, shade);
 		value.setColor( cmyk.c, cmyk.m, cmyk.y, cmyk.k );
 	}
+	else if (color.getColorModel() == colorModelLab)
+	{
+		double L, a, b;
+		color.getLab(&L, &a, &b);
+		value.setColor(L * (shade / 100.0), a, b);
+	}
 	return value;
 }

Modified: trunk/Scribus/scribus/scribuscore.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/scribuscore.cpp
==============================================================================
--- trunk/Scribus/scribus/scribuscore.cpp (original)
+++ trunk/Scribus/scribus/scribuscore.cpp Thu Jun  4 07:54:19 2015
@@ -420,20 +420,18 @@
 	// Now create default color transforms (used mainly when color management is "disabled")
 	int dcmsFlags        = Ctf_BlackPointCompensation;
 	eRenderIntent intent = Intent_Relative_Colorimetric;
-
-	defaultRGBToScreenSolidTrans  = defaultEngine.createTransform(defaultRGBProfile, Format_RGB_16, 
-	            defaultRGBProfile, Format_RGB_16, intent, dcmsFlags);
-	defaultRGBToScreenImageTrans  = defaultEngine.createTransform(defaultRGBProfile, Format_RGBA_8, 
-	            defaultRGBProfile, Format_RGBA_8, intent, dcmsFlags);
-	defaultCMYKToScreenImageTrans = defaultEngine.createTransform(defaultCMYKProfile, Format_CMYK_8,
-	            defaultRGBProfile, Format_RGBA_8, intent, dcmsFlags);
-	defaultRGBToCMYKTrans = defaultEngine.createTransform(defaultRGBProfile, Format_RGB_16,
-				defaultCMYKProfile, Format_CMYK_16, intent, dcmsFlags);
-	defaultCMYKToRGBTrans = defaultEngine.createTransform(defaultCMYKProfile, Format_CMYK_16,
-				defaultRGBProfile, Format_RGB_16, intent, dcmsFlags);
+	defaultLabProfile = defaultEngine.createProfile_Lab();
+
+	defaultRGBToScreenSolidTrans  = defaultEngine.createTransform(defaultRGBProfile, Format_RGB_16,  defaultRGBProfile, Format_RGB_16, intent, dcmsFlags);
+	defaultRGBToScreenImageTrans  = defaultEngine.createTransform(defaultRGBProfile, Format_RGBA_8,  defaultRGBProfile, Format_RGBA_8, intent, dcmsFlags);
+	defaultCMYKToScreenImageTrans = defaultEngine.createTransform(defaultCMYKProfile, Format_CMYK_8, defaultRGBProfile, Format_RGBA_8, intent, dcmsFlags);
+	defaultRGBToCMYKTrans         = defaultEngine.createTransform(defaultRGBProfile, Format_RGB_16, defaultCMYKProfile, Format_CMYK_16, intent, dcmsFlags);
+	defaultCMYKToRGBTrans         = defaultEngine.createTransform(defaultCMYKProfile, Format_CMYK_16, defaultRGBProfile, Format_RGB_16, intent, dcmsFlags);
+	defaultLabToRGBTrans           = defaultEngine.createTransform(defaultLabProfile, Format_Lab_Dbl, defaultRGBProfile, Format_RGB_8, Intent_Perceptual, dcmsFlags);
+	defaultLabToCMYKTrans         = defaultEngine.createTransform(defaultLabProfile, Format_Lab_Dbl, defaultCMYKProfile, Format_CMYK_8, Intent_Perceptual, dcmsFlags);
 	if (!defaultRGBToScreenSolidTrans  || !defaultRGBToScreenImageTrans || 
 		!defaultCMYKToScreenImageTrans || !defaultRGBToCMYKTrans || 
-		!defaultCMYKToRGBTrans )
+		!defaultCMYKToRGBTrans || !defaultLabToRGBTrans|| !defaultLabToCMYKTrans)
 	{
 		ResetDefaultColorTransforms();
 	}
@@ -448,6 +446,8 @@
 	defaultCMYKToScreenImageTrans = ScColorTransform();
 	defaultRGBToCMYKTrans = ScColorTransform();
 	defaultCMYKToRGBTrans = ScColorTransform();
+	defaultLabToRGBTrans = ScColorTransform();
+	defaultLabToCMYKTrans = ScColorTransform();
 }
 
 void ScribusCore::initCMS()

Modified: trunk/Scribus/scribus/scribuscore.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/scribuscore.h
==============================================================================
--- trunk/Scribus/scribus/scribuscore.h (original)
+++ trunk/Scribus/scribus/scribuscore.h Thu Jun  4 07:54:19 2015
@@ -112,11 +112,14 @@
 	ScColorProfile   monitorProfile;
 	ScColorProfile   defaultRGBProfile;
 	ScColorProfile   defaultCMYKProfile;
+	ScColorProfile   defaultLabProfile;
 	ScColorTransform defaultRGBToScreenSolidTrans;
 	ScColorTransform defaultRGBToScreenImageTrans;
 	ScColorTransform defaultCMYKToScreenImageTrans;
 	ScColorTransform defaultRGBToCMYKTrans;
 	ScColorTransform defaultCMYKToRGBTrans;
+	ScColorTransform defaultLabToRGBTrans;
+	ScColorTransform defaultLabToCMYKTrans;
 	//CB FIXME protect
 // 	QWidget *m_PaletteParent;
 	

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Jun  4 07:54:19 2015
@@ -950,6 +950,10 @@
 	stdTransImg           = ScCore->defaultRGBToScreenImageTrans;
 	stdProofImg           = ScCore->defaultRGBToScreenImageTrans;
 	stdProofImgCMYK       = ScCore->defaultCMYKToScreenImageTrans;
+	stdLabToRGBTrans      = ScCore->defaultLabToRGBTrans;
+	stdLabToCMYKTrans     = ScCore->defaultLabToCMYKTrans;
+	stdProofLab           = ScCore->defaultLabToRGBTrans;
+	stdProofLabGC         = ScCore->defaultLabToRGBTrans;
 }
 
 bool ScribusDoc::OpenCMSProfiles(ProfilesL InPo, ProfilesL InPoCMYK, ProfilesL MoPo, ProfilesL PrPo)
@@ -1039,6 +1043,15 @@
 						DocPrinterProf,
 						IntentColors,
 						Intent_Relative_Colorimetric, dcmsFlags | Ctf_GamutCheck);
+	stdProofLab = colorEngine.createProofingTransform(ScCore->defaultLabProfile, Format_Lab_Dbl,
+						DocDisplayProf, Format_RGB_16,
+						DocPrinterProf,
+						IntentColors,
+						Intent_Relative_Colorimetric, dcmsFlags);
+	stdProofLabGC = colorEngine.createProofingTransform(ScCore->defaultLabProfile, Format_Lab_Dbl,
+						DocDisplayProf, Format_RGB_16,
+						DocPrinterProf, IntentColors,
+						Intent_Relative_Colorimetric, dcmsFlags| Ctf_GamutCheck);
 
 	if (DocInputRGBProf.colorSpace() == ColorSpace_Rgb)
 			docPrefsData.colorPrefs.DCMSset.ComponentsInput2 = 3;
@@ -1046,10 +1059,13 @@
 			docPrefsData.colorPrefs.DCMSset.ComponentsInput2 = 4;
 	if (DocInputRGBProf.colorSpace() == ColorSpace_Cmy)
 			docPrefsData.colorPrefs.DCMSset.ComponentsInput2 = 3;
+	stdLabToRGBTrans   = colorEngine.createTransform(ScCore->defaultLabProfile, Format_Lab_Dbl, DocDisplayProf, Format_RGB_8, Intent_Perceptual, dcmsFlags);
+	stdLabToCMYKTrans = colorEngine.createTransform(ScCore->defaultLabProfile, Format_Lab_Dbl, DocPrinterProf, Format_CMYK_8, Intent_Perceptual, dcmsFlags);
 
 	bool success  = (stdTransRGBMon && stdTransCMYKMon && stdProofImg  && stdProofImgCMYK &&
 		             stdTransImg    && stdTransRGB     && stdTransCMYK && stdProof       &&
-	                 stdProofGC     && stdProofCMYK    && stdProofCMYKGC);
+					 stdProofGC     && stdProofCMYK    && stdProofCMYKGC &&
+					 stdLabToRGBTrans && stdLabToCMYKTrans && stdProofLab && stdProofLabGC);
 	if (!success)
 	{
 		CloseCMSProfiles();

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Thu Jun  4 07:54:19 2015
@@ -1304,6 +1304,10 @@
 	ScColorTransform stdTransRGB;
 	ScColorTransform stdProofGC;
 	ScColorTransform stdProofCMYKGC;
+	ScColorTransform stdLabToRGBTrans;
+	ScColorTransform stdLabToCMYKTrans;
+	ScColorTransform stdProofLab;
+	ScColorTransform stdProofLabGC;
 	bool BlackPoint;
 	bool SoftProofing;
 	bool Gamut;

Modified: trunk/Scribus/scribus/ui/cmykfw.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/ui/cmykfw.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/cmykfw.cpp (original)
+++ trunk/Scribus/scribus/ui/cmykfw.cpp Thu Jun  4 07:54:19 2015
@@ -56,10 +56,6 @@
 	setModal(true);
 	m_doc = doc;
 	isNew = newCol;
-	if (orig.getColorModel () == colorModelCMYK)
-		CMYKmode = true;
-	else
-		CMYKmode = false;
 	dynamic = true;
 	Wsave = false;
 	EColors = Colors;
@@ -78,15 +74,6 @@
 	QPixmap image1 = sliderPix(300);
 	QPixmap image2 = sliderPix(60);
 	QPixmap image3 = sliderBlack();
-	CMYKColor cmyk;
-	double ccd, cmd, cyd, ckd;
-	ScColorEngine::getCMYKValues(orig, m_doc, cmyk);
-	ccd = cmyk.c / 2.55;
-	cmd = cmyk.m / 2.55;
-	cyd = cmyk.y / 2.55;
-	ckd = cmyk.k / 2.55;
-	RGBColor rgb;
-	ScColorEngine::getRGBValues(orig, m_doc, rgb);
 	resize( 498, 306 );
 	setWindowTitle( tr( "Edit Color" ) );
 	setWindowIcon(QIcon(loadIcon("AppIcon.png")));
@@ -115,8 +102,8 @@
 	ComboBox1->addItem( tr( "CMYK" ) );
 	ComboBox1->addItem( tr( "RGB" ) );
 	ComboBox1->addItem( tr( "Web Safe RGB" ) );
-	if (!CMYKmode)
-		ComboBox1->setCurrentIndex( 1 );
+	ComboBox1->addItem( tr( "Lab" ) );
+
 	TextLabel3->setBuddy( ComboBox1 );
 	Layout23->addWidget( ComboBox1 );
 
@@ -241,7 +228,6 @@
 	Layout1_2->setMargin( 0 );
 
 	CyanP = new QLabel( Frame4 );
-//	CyanP->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, CyanP->sizePolicy().hasHeightForWidth() ) );
 	CyanP->setMinimumSize( QSize( 200, 10 ) );
 	CyanP->setPixmap(image0);
 	CyanP->setScaledContents( true );
@@ -257,8 +243,6 @@
 	CyanSp = new ScrSpinBox( 0, 100, Frame4, 0 );
 	CyanSp->setSuffix( tr(" %"));
 	Layout2x->addWidget(CyanSp, 0, 2);
-	CyanSp->setValue(ccd);
-	CyanSL->setValue(qRound(ccd));
 
 	MagentaT = new QLabel( tr( "M:" ), Frame4 );
 	Layout2x->addWidget(MagentaT, 1, 0);
@@ -268,7 +252,6 @@
 	Layout1_2_2->setMargin( 0 );
 
 	MagentaP = new QLabel( Frame4 );
-//	MagentaP->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, MagentaP->sizePolicy().hasHeightForWidth() ) );
 	MagentaP->setMinimumSize( QSize( 200, 10 ) );
 	MagentaP->setPixmap(image1);
 	MagentaP->setScaledContents( true );
@@ -284,8 +267,6 @@
 	MagentaSp = new ScrSpinBox( 0, 100, Frame4, 0 );
 	MagentaSp->setSuffix( tr(" %"));
 	Layout2x->addWidget(MagentaSp, 1, 2);
-	MagentaSp->setValue(cmd);
-	MagentaSL->setValue(qRound(cmd));
 
 	YellowT = new QLabel( tr( "Y:" ), Frame4 );
 	Layout2x->addWidget(YellowT, 2, 0);
@@ -295,7 +276,6 @@
 	Layout1_2_3->setMargin( 0 );
 
 	YellowP = new QLabel( Frame4);
-//	YellowP->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, YellowP->sizePolicy().hasHeightForWidth() ) );
 	YellowP->setMinimumSize( QSize( 200, 10 ) );
 	YellowP->setPixmap(image2);
 	YellowP->setScaledContents( true );
@@ -311,8 +291,6 @@
 	YellowSp = new ScrSpinBox( 0, 100, Frame4, 0 );
 	YellowSp->setSuffix( tr(" %"));
 	Layout2x->addWidget(YellowSp, 2, 2);
-	YellowSp->setValue(cyd);
-	YellowSL->setValue(qRound(cyd));
 
 	BlackT = new QLabel( tr( "K:" ), Frame4 );
 	Layout2x->addWidget(BlackT, 3, 0);
@@ -322,7 +300,6 @@
 	Layout1_2_4->setMargin( 0 );
 
 	BlackP = new QLabel( Frame4 );
-//	BlackP->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, BlackP->sizePolicy().hasHeightForWidth() ) );
 	BlackP->setMinimumSize( QSize( 200, 10 ) );
 	BlackP->setPixmap(image3);
 	BlackP->setScaledContents( true );
@@ -338,13 +315,30 @@
 	BlackSp = new ScrSpinBox( 0, 100, Frame4, 0 );
 	BlackSp->setSuffix( tr(" %"));
 	Layout2x->addWidget(BlackSp, 3, 2);
-	BlackSp->setValue(ckd);
-	BlackSL->setValue(qRound(ckd));
-	BlackComp = cmyk.k;
 	Frame4Layout->addLayout( Layout2x );
 	QSpacerItem* spacer2 = new QSpacerItem( 2, 2, QSizePolicy::Minimum, QSizePolicy::Expanding );
 	Frame4Layout->addItem( spacer2 );
 	CMYKColorLayout->addWidget( Frame4 );
+
+	if (orig.getColorModel () == colorModelCMYK)
+	{
+		double ccd, cmd, cyd, ckd;
+		CMYKColor cmyk;
+		ScColorEngine::getCMYKValues(orig, m_doc, cmyk);
+		ccd = cmyk.c / 2.55;
+		cmd = cmyk.m / 2.55;
+		cyd = cmyk.y / 2.55;
+		ckd = cmyk.k / 2.55;
+		CyanSp->setValue(ccd);
+		CyanSL->setValue(qRound(ccd));
+		MagentaSp->setValue(cmd);
+		MagentaSL->setValue(qRound(cmd));
+		YellowSp->setValue(cyd);
+		YellowSL->setValue(qRound(cyd));
+		BlackSp->setValue(ckd);
+		BlackSL->setValue(qRound(ckd));
+		BlackComp = cmyk.k;
+	}
 	int h, s, v;
 	ScColorEngine::getRGBColor(orig, m_doc).getHsv(&h, &s, &v);
 	ColorMap->drawPalette(v);
@@ -355,6 +349,27 @@
 	TabStack->setCurrentIndex(0);
 	setFixedSize(minimumSizeHint());
 	setContextMenuPolicy(Qt::CustomContextMenu);
+	if (orig.getColorModel () == colorModelRGB)
+	{
+		ComboBox1->setCurrentIndex(1);
+		selModel ( tr( "RGB" ));
+	}
+	else if (orig.getColorModel() == colorModelCMYK)
+	{
+		ComboBox1->setCurrentIndex(0);
+		selModel ( tr( "CMYK" ));
+	}
+	else if (orig.getColorModel() == colorModelLab)
+	{
+		ComboBox1->setCurrentIndex(3);
+		selModel ( tr( "Lab" ));
+	}
+	isRegistration = Farbe.isRegistrationColor();
+	if (Farbe.isRegistrationColor())
+	{
+		ComboBox1->setEnabled(false);
+		Separations->setEnabled(false);
+	}
 	// signals and slots connections
 //	Regist->setToolTip( "<qt>" + tr( "Choosing this will enable printing this on all plates. Registration colors are used for printer marks such as crop marks, registration marks and the like. These are not typically used in the layout itself." ) + "</qt>");
 	Separations->setToolTip( "<qt>" + tr( "Choosing this will make this color a spot color, thus creating another spot when creating plates or separations. This is used most often when a logo or other color needs exact representation or cannot be replicated with CMYK inks. Metallic and fluorescent inks are good examples which cannot be easily replicated with CMYK inks." ) + "</qt>");
@@ -381,14 +396,6 @@
 //	connect(Regist, SIGNAL(clicked()), this, SLOT(setRegist()));
 	connect(this, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(slotRightClick()));
 	layout()->activate();
-	if (!CMYKmode)
-		selModel ( tr( "RGB" ));
-	isRegistration = Farbe.isRegistrationColor();
-	if (Farbe.isRegistrationColor())
-	{
-		ComboBox1->setEnabled(false);
-		Separations->setEnabled(false);
-	}
 }
 
 void CMYKChoose::setValSLiders(double value)
@@ -441,10 +448,10 @@
 void CMYKChoose::toggleSL()
 {
 	dynamic = !dynamic;
-	CyanP->setPixmap(sliderPix(CMYKmode ? 180 : 0));
-	MagentaP->setPixmap(sliderPix(CMYKmode? 300 : 120));
-	YellowP->setPixmap(sliderPix(CMYKmode? 60 : 240));
-	if (CMYKmode)
+	CyanP->setPixmap(sliderPix(Farbe.getColorModel() == colorModelCMYK ? 180 : 0));
+	MagentaP->setPixmap(sliderPix(Farbe.getColorModel() == colorModelCMYK? 300 : 120));
+	YellowP->setPixmap(sliderPix(Farbe.getColorModel() == colorModelCMYK? 60 : 240));
+	if (Farbe.getColorModel() == colorModelCMYK)
 		BlackP->setPixmap(sliderBlack());
 }
 
@@ -460,7 +467,7 @@
 	QColor tmp;
 	for (int x = 0; x < 255; x += 5)
 	{
-		if (CMYKmode)
+		if (Farbe.getColorModel() == colorModelCMYK)
 		{
 			ScColorEngine::getCMYKValues(Farbe, m_doc, cmyk);
 			cmyk.getValues(c, m, y, k);
@@ -497,7 +504,7 @@
 				p.setBrush(tmp);
 			}
 		}
-		else
+		else if (Farbe.getColorModel() == colorModelRGB)
 		{
 			ScColorEngine::getRGBValues(Farbe, m_doc, rgb);
 			rgb.getValues(r, g, b);
@@ -529,6 +536,44 @@
 					break;
 				case 240:
 					tmp = ScColorEngine::getDisplayColorGC(ScColor(0, 0, x), m_doc);
+					break;
+				}
+				p.setBrush(tmp);
+			}
+		}
+		else if (Farbe.getColorModel() == colorModelLab)
+		{
+			double L, a, b;
+			double val = static_cast<double>(x) / 255.0;
+			Farbe.getLab(&L, &a, &b);
+			if (dynamic)
+			{
+				switch (farbe)
+				{
+				case 0:
+					tmp = ScColorEngine::getDisplayColorGC(ScColor(100 * val, a, b), m_doc);
+					break;
+				case 120:
+					tmp = ScColorEngine::getDisplayColorGC(ScColor(L, 256 * val - 128.0, b), m_doc);
+					break;
+				case 240:
+					tmp = ScColorEngine::getDisplayColorGC(ScColor(L, a, 256 * val - 128.0), m_doc);
+					break;
+				}
+				p.setBrush(tmp);
+			}
+			else
+			{
+				switch (farbe)
+				{
+				case 0:
+					tmp = ScColorEngine::getDisplayColorGC(ScColor(100 * val, 0.0, 0.0), m_doc);
+					break;
+				case 120:
+					tmp = ScColorEngine::getDisplayColorGC(ScColor(100.0, 256 * val - 128.0, 0.0), m_doc);
+					break;
+				case 240:
+					tmp = ScColorEngine::getDisplayColorGC(ScColor(100.0, 0.0, 256 * val - 128.0), m_doc);
 					break;
 				}
 				p.setBrush(tmp);
@@ -632,7 +677,6 @@
 	disconnect( BlackSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
 	if (mod == tr("CMYK"))
 	{
-		CMYKmode = true;
 		Wsave = false;
 		CyanSL->setMaximum( 100 );
 		MagentaSL->setMaximum( 100 );
@@ -658,20 +702,20 @@
 		CyanT->setText( tr("C:"));
 		MagentaT->setText( tr("M:"));
 		YellowT->setText( tr("Y:"));
-		CyanP->setPixmap(sliderPix(180));
-		MagentaP->setPixmap(sliderPix(300));
-		YellowP->setPixmap(sliderPix(60));
-		BlackP->setPixmap(sliderBlack());
 		BlackP->show();
 		BlackSL->show();
 		BlackSp->show();
 		BlackT->show();
 		Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelCMYK);
+		CyanP->setPixmap(sliderPix(180));
+		MagentaP->setPixmap(sliderPix(300));
+		YellowP->setPixmap(sliderPix(60));
+		BlackP->setPixmap(sliderBlack());
+		ColorMap->setEnabled(true);
 		setValues();
 	}
-	else
-	{
-		CMYKmode = false;
+	else if ((mod == tr("Web Safe RGB")) || (mod == tr("RGB")))
+	{
 		Wsave = false;
 		CyanSL->setMaximum( 255 );
 		MagentaSL->setMaximum( 255 );
@@ -697,9 +741,6 @@
 		CyanT->setText( tr("R:"));
 		MagentaT->setText( tr("G:"));
 		YellowT->setText( tr("B:"));
-		CyanP->setPixmap(sliderPix(0));
-		MagentaP->setPixmap(sliderPix(120));
-		YellowP->setPixmap(sliderPix(240));
 		Layout2x->setSizeConstraint(QLayout::SetFixedSize);
 		BlackP->hide();
 		BlackSL->hide();
@@ -719,7 +760,60 @@
 			YellowSp->setSingleStep(51);
 		}
 		Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelRGB);
+		CyanP->setPixmap(sliderPix(0));
+		MagentaP->setPixmap(sliderPix(120));
+		YellowP->setPixmap(sliderPix(240));
 		setValues();
+		ColorMap->setEnabled(true);
+	}
+	else if (mod == tr("Lab"))
+	{
+		Wsave = false;
+		CyanSL->setSingleStep(1);
+		CyanSL->setPageStep(10);
+		CyanSL->setMaximum( 100 );
+		MagentaSL->setSingleStep(1);
+		MagentaSL->setPageStep(10);
+		MagentaSL->setMaximum( 128 );
+		MagentaSL->setMinimum( -128 );
+		YellowSL->setSingleStep(1);
+		YellowSL->setPageStep(10);
+		YellowSL->setMaximum( 128 );
+		YellowSL->setMinimum( -128 );
+
+		CyanSp->setDecimals(2);
+		CyanSp->setSingleStep(1);
+		CyanSp->setMaximum( 100 );
+		CyanSp->setSuffix( tr(""));
+
+		MagentaSp->setDecimals(2);
+		MagentaSp->setSingleStep(1);
+		MagentaSp->setMaximum( 128);
+		MagentaSp->setMinimum( -128 );
+		MagentaSp->setSuffix("");
+
+		YellowSp->setDecimals(2);
+		YellowSp->setMaximum( 128 );
+		YellowSp->setMinimum( -128 );
+		YellowSp->setSingleStep(1);
+		YellowSp->setSuffix("");
+
+		CyanT->setText( tr("L:"));
+		MagentaT->setText( tr("a:"));
+		YellowT->setText( tr("b:"));
+
+
+		Layout2x->setSizeConstraint(QLayout::SetFixedSize);
+		BlackP->hide();
+		BlackSL->hide();
+		BlackSp->hide();
+		BlackT->hide();
+		Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelLab);
+		CyanP->setPixmap(sliderPix(0));
+		MagentaP->setPixmap(sliderPix(120));
+		YellowP->setPixmap(sliderPix(240));
+		setValues();
+		ColorMap->setEnabled(false);
 	}
 	imageN.fill( ScColorEngine::getDisplayColor(Farbe, m_doc) );
 	if (ScColorEngine::isOutOfGamut(Farbe, m_doc))
@@ -744,70 +838,83 @@
 
 void CMYKChoose::setColor()
 {
-	int c, m, y, k;
-	if (CMYKmode)
+	int c, m, y;
+	int h, s, v;
+	int k = 0;
+	double L, a, b;
+	ScColor tmp;
+	if (Farbe.getColorModel() == colorModelCMYK)
 	{
 		c = qRound(CyanSp->value() * 2.55);
 		m = qRound(MagentaSp->value() * 2.55);
 		y = qRound(YellowSp->value() * 2.55);
 		k = qRound(BlackSp->value() * 2.55);
-	}
-	else
+		tmp.setColor(c, m, y, k);
+		Farbe = tmp;
+		if (dynamic)
+		{
+			CyanP->setPixmap(sliderPix(180));
+			MagentaP->setPixmap(sliderPix(300));
+			YellowP->setPixmap(sliderPix(60));
+			BlackP->setPixmap(sliderBlack());
+		}
+		BlackComp = k;
+	}
+	else if (Farbe.getColorModel() == colorModelRGB)
 	{
 		c = qRound(CyanSp->value());
 		m = qRound(MagentaSp->value());
 		y = qRound(YellowSp->value());
 		k = qRound(BlackSp->value());
-	}
-	int h, s, v;
-	BlackComp = k;
-	if (Wsave)
-	{
-		blockSignals(true);
-		c = c / 51 * 51;
-		m = m / 51 * 51;
-		y = y / 51 * 51;
-		CyanSp->setValue(c);
-		MagentaSp->setValue(m);
-		YellowSp->setValue(y);
-		CyanSL->setValue(c);
-		MagentaSL->setValue(m);
-		YellowSL->setValue(y);
-		blockSignals(false);
-	}
-	ScColor tmp;
-	if (CMYKmode)
-	{
-		tmp.setColor(c, m, y, k);
-		if (dynamic)
-		{
-			CyanP->setPixmap(sliderPix(180));
-			MagentaP->setPixmap(sliderPix(300));
-			YellowP->setPixmap(sliderPix(60));
-			BlackP->setPixmap(sliderBlack());
-		}
-	}
-	else
-	{
+		if (Wsave)
+		{
+			blockSignals(true);
+			c = c / 51 * 51;
+			m = m / 51 * 51;
+			y = y / 51 * 51;
+			CyanSp->setValue(c);
+			MagentaSp->setValue(m);
+			YellowSp->setValue(y);
+			CyanSL->setValue(c);
+			MagentaSL->setValue(m);
+			YellowSL->setValue(y);
+			blockSignals(false);
+		}
 		tmp.setColorRGB(c, m, y);
 		QColor tmp2 = QColor(c, m, y);
 		tmp2.getHsv(&h, &s, &v);
 		BlackComp = 255 - v;
+		Farbe = tmp;
 		if (dynamic)
 		{
 			CyanP->setPixmap(sliderPix(0));
 			MagentaP->setPixmap(sliderPix(120));
 			YellowP->setPixmap(sliderPix(240));
 		}
+		BlackComp = k;
+	}
+	else if (Farbe.getColorModel() == colorModelLab)
+	{
+		L = CyanSp->value();
+		a = MagentaSp->value();
+		b = YellowSp->value();
+		tmp.setColor(L, a, b);
+		Farbe = tmp;
+		if (dynamic)
+		{
+			CyanP->setPixmap(sliderPix(0));
+			MagentaP->setPixmap(sliderPix(120));
+			YellowP->setPixmap(sliderPix(240));
+		}
+		BlackComp = qRound(L * 2.55);
 	}
 	imageN.fill(ScColorEngine::getDisplayColor(tmp, m_doc) );
 	if ( ScColorEngine::isOutOfGamut(tmp, m_doc) )
 		paintAlert(alertIcon, imageN, 2, 2, false);
 	ScColorEngine::getRGBColor(tmp, m_doc).getHsv(&h, &s, &v);
-	NewC->setPixmap( imageN );
-	Farbe = tmp;
 	ColorMap->drawPalette(v);
 	ColorMap->setMark(h, s);
+	NewC->setPixmap( imageN );
 }
 
 void CMYKChoose::setColor2(int h, int s, bool ende)
@@ -817,12 +924,17 @@
 	tm.getRgb(&r, &g, &b);
 	ScColor tmp;
 	tmp.fromQColor(tm);
-	if (CMYKmode)
+	if (Farbe.getColorModel() == colorModelCMYK)
 	{
 		CMYKColor cmyk;
 		ScColorEngine::getCMYKValues(tmp, m_doc, cmyk);
 		tmp.setColor(cmyk.c, cmyk.m, cmyk.y, cmyk.k);
 	}
+	else if (Farbe.getColorModel() == colorModelLab)
+	{
+		ScColorEngine::convertToModel(tmp, m_doc, colorModelLab);
+	}
+
 	imageN.fill( ScColorEngine::getDisplayColor(tmp, m_doc) );
 	if ( ScColorEngine::isOutOfGamut(tmp, m_doc) )
 		paintAlert(alertIcon, imageN, 2, 2, false);
@@ -877,7 +989,7 @@
 	YellowSL->blockSignals(true);
 	BlackSp->blockSignals(true);
 	BlackSL->blockSignals(true);
-	if (CMYKmode)
+	if (Farbe.getColorModel() == colorModelCMYK)
 	{
 		CMYKColor cmyk;
 		int cc, cm, cy, ck;
@@ -899,7 +1011,7 @@
 			BlackP->setPixmap(sliderBlack());
 		}
 	}
-	else
+	else if (Farbe.getColorModel() == colorModelRGB)
 	{
 		RGBColor rgb;
 		int r, g, b;
@@ -921,6 +1033,17 @@
 			YellowP->setPixmap(sliderPix(240));
 		}
 	}
+	else if (Farbe.getColorModel() == colorModelLab)
+	{
+		double L, a, b;
+		Farbe.getLab(&L, &a, &b);
+		CyanSp->setValue(L);
+		CyanSL->setValue(L);
+		MagentaSp->setValue(a);
+		MagentaSL->setValue(a);
+		YellowSp->setValue(b);
+		YellowSL->setValue(b);
+	}
 	CyanSp->blockSignals(false);
 	CyanSL->blockSignals(false);
 	MagentaSp->blockSignals(false);

Modified: trunk/Scribus/scribus/ui/cmykfw.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/ui/cmykfw.h
==============================================================================
--- trunk/Scribus/scribus/ui/cmykfw.h (original)
+++ trunk/Scribus/scribus/ui/cmykfw.h Thu Jun  4 07:54:19 2015
@@ -79,7 +79,6 @@
 	QPixmap imageN;
 	QPixmap alertIcon;
 	ScColor Farbe;
-	bool CMYKmode;
 	bool Wsave;
 	bool dynamic;
 	bool isNew;

Modified: trunk/Scribus/scribus/ui/colorlistbox.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/ui/colorlistbox.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/colorlistbox.cpp (original)
+++ trunk/Scribus/scribus/ui/colorlistbox.cpp Thu Jun  4 07:54:19 2015
@@ -118,14 +118,17 @@
 	static QPixmap alertIcon;
 	static QPixmap cmykIcon;
 	static QPixmap rgbIcon;
+	static QPixmap labIcon;
 	static QPixmap spotIcon;
 	static QPixmap regIcon;
 	static bool iconsInitialized = false;
 
-	if ( !iconsInitialized ) {
+	if ( !iconsInitialized )
+	{
 		alertIcon = loadIcon("alert.png", true);
 		cmykIcon = loadIcon("cmyk.png", true);
 		rgbIcon = loadIcon("rgb.png", true);
+		labIcon = loadIcon("lab.png", true);
 		spotIcon = loadIcon("spot.png", true);
 		regIcon = loadIcon("register.png", true);
 		iconsInitialized = true;
@@ -153,8 +156,10 @@
 			paintAlert(alertIcon, *pPixmap, 15, 0);
 		if (item.m_color.getColorModel() == colorModelCMYK)
 			paintAlert(cmykIcon, *pPixmap, 30, 0);
-		else
+		else if (item.m_color.getColorModel() == colorModelRGB)
 			paintAlert(rgbIcon, *pPixmap, 30, 0);
+		else if (item.m_color.getColorModel() == colorModelLab)
+			paintAlert(labIcon, *pPixmap, 30, 0);
 		if (item.m_color.isSpotColor())
 			paintAlert(spotIcon, *pPixmap, 45, 0);
 		if (item.m_color.isRegistrationColor())

Modified: trunk/Scribus/scribus/ui/paintmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/ui/paintmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/paintmanager.cpp (original)
+++ trunk/Scribus/scribus/ui/paintmanager.cpp Thu Jun  4 07:54:19 2015
@@ -1055,7 +1055,7 @@
 			QString wdir = dirs->get("colors", ".");
 			QString docexts("*.sla *.sla.gz *.scd *.scd.gz");
 			QString aiepsext(FormatsManager::instance()->extensionListForFormat(FormatsManager::EPS|FormatsManager::PS|FormatsManager::AI, 0));
-			QString ooexts(" *.acb *.aco *.skp *.soc *.gpl *.xml");
+			QString ooexts(" *.acb *.aco *.skp *.soc *.gpl *.xml *.sbz");
 			ooexts += extra;
 			QString filter = tr("All Supported Formats (%1);;Documents (%2);;Other Files (%3);;All Files (*)").arg(docexts+" "+aiepsext+ooexts).arg(docexts).arg(aiepsext+ooexts);
 			CustomFDialog dia(this, wdir, tr("Import Colors"), filter, fdHidePreviewCheckBox);

Modified: trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp Thu Jun  4 07:54:19 2015
@@ -54,7 +54,7 @@
 	softShadowBlurRadius->setMinMaxValues(-20.0, 20.0);
 	softShadowBlurRadius->setDoubleValue(2.0);
 
-	softShadowColor = new PropTreeItem(this, PropTreeItem::ColorCombo, tr( "Color:"));
+	softShadowColor = new PropTreeItem(this, PropTreeItem::ColorComboBox, tr( "Color:"));
 	softShadowColor->setStringValue( tr( "Black"));
 
 	softShadowShade = new PropTreeItem(this, PropTreeItem::IntSpinBox, tr( "Shade:"));
@@ -83,16 +83,16 @@
 	languageChange();
 	m_haveItem = false;
 	setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
-	connect(hasSoftShadow, SIGNAL(valueChanged(bool)), this, SLOT(handleShadow(bool)));
-	connect(softShadowXOffset, SIGNAL(valueChanged(double)), this, SLOT(handleNewXOffset(double)));
-	connect(softShadowYOffset, SIGNAL(valueChanged(double)), this, SLOT(handleNewYOffset(double)));
-	connect(softShadowBlurRadius, SIGNAL(valueChanged(double)), this, SLOT(handleNewBlur(double)));
-	connect(softShadowColor, SIGNAL(valueChanged(QString)), this, SLOT(handleNewColor(QString)));
-	connect(softShadowShade, SIGNAL(valueChanged(double)), this, SLOT(handleNewShade(double)));
-	connect(softShadowOpacity, SIGNAL(valueChanged(double)), this, SLOT(handleNewOpacity(double)));
-	connect(softShadowBlendMode, SIGNAL(valueChanged(int)), this, SLOT(handleNewBlendmode(int)));
-	connect(softShadowErase, SIGNAL(valueChanged(bool)), this, SLOT(handleNewErase(bool)));
-	connect(softShadowObjTrans, SIGNAL(valueChanged(bool)), this, SLOT(handleNewObjTrans(bool)));
+	connect(hasSoftShadow, SIGNAL(valueChanged(bool)), this, SLOT(handleNewValues()));
+	connect(softShadowXOffset, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
+	connect(softShadowYOffset, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
+	connect(softShadowBlurRadius, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
+	connect(softShadowColor, SIGNAL(valueChanged(QString)), this, SLOT(handleNewValues()));
+	connect(softShadowShade, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
+	connect(softShadowOpacity, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
+	connect(softShadowBlendMode, SIGNAL(valueChanged(int)), this, SLOT(handleNewValues()));
+	connect(softShadowErase, SIGNAL(valueChanged(bool)), this, SLOT(handleNewValues()));
+	connect(softShadowObjTrans, SIGNAL(valueChanged(bool)), this, SLOT(handleNewValues()));
 
 	m_haveItem = false;
 }
@@ -259,206 +259,6 @@
 		if (m_haveDoc)
 		{
 			m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
-		}
-	}
-}
-
-void PropertiesPalette_Shadow::handleShadow(bool value)
-{
-	if (m_haveItem)
-	{
-		double x = softShadowXOffset->valueAsDouble() / m_unitRatio;
-		double y = softShadowYOffset->valueAsDouble() / m_unitRatio;
-		double r = softShadowBlurRadius->valueAsDouble() / m_unitRatio;
-		QString color = softShadowColor->valueAsString();
-		if (color == CommonStrings::tr_NoneColor)
-			color = CommonStrings::None;
-		int b = softShadowBlendMode->valueAsInt();
-		double o = (100 - softShadowOpacity->valueAsDouble()) / 100.0;
-		int s = softShadowShade->valueAsInt();
-		if (m_haveDoc)
-		{
-			m_doc->itemSelection_SetSoftShadow(value, color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
-		}
-	}
-}
-
-void PropertiesPalette_Shadow::handleNewXOffset(double value)
-{
-	if (m_haveItem)
-	{
-		double x = value / m_unitRatio;
-		double y = softShadowYOffset->valueAsDouble() / m_unitRatio;
-		double r = softShadowBlurRadius->valueAsDouble() / m_unitRatio;
-		QString color = softShadowColor->valueAsString();
-		if (color == CommonStrings::tr_NoneColor)
-			color = CommonStrings::None;
-		int b = softShadowBlendMode->valueAsInt();
-		double o = (100 - softShadowOpacity->valueAsInt()) / 100.0;
-		int s = softShadowShade->valueAsInt();
-		if (m_haveDoc)
-		{
-			m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
-		}
-	}
-}
-
-void PropertiesPalette_Shadow::handleNewYOffset(double value)
-{
-	if (m_haveItem)
-	{
-		double x = softShadowXOffset->valueAsDouble() / m_unitRatio;
-		double y = value / m_unitRatio;
-		double r = softShadowBlurRadius->valueAsDouble() / m_unitRatio;
-		QString color = softShadowColor->valueAsString();
-		if (color == CommonStrings::tr_NoneColor)
-			color = CommonStrings::None;
-		int b = softShadowBlendMode->valueAsInt();
-		double o = (100 - softShadowOpacity->valueAsInt()) / 100.0;
-		int s = softShadowShade->valueAsInt();
-		if (m_haveDoc)
-		{
-			m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
-		}
-	}
-}
-
-void PropertiesPalette_Shadow::handleNewBlur(double value)
-{
-	if (m_haveItem)
-	{
-		double x = softShadowXOffset->valueAsDouble() / m_unitRatio;
-		double y = softShadowYOffset->valueAsDouble() / m_unitRatio;
-		double r = value / m_unitRatio;
-		QString color = softShadowColor->valueAsString();
-		if (color == CommonStrings::tr_NoneColor)
-			color = CommonStrings::None;
-		int b = softShadowBlendMode->valueAsInt();
-		double o = (100 - softShadowOpacity->valueAsDouble()) / 100.0;
-		int s = softShadowShade->valueAsInt();
-		if (m_haveDoc)
-		{
-			m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
-		}
-	}
-}
-
-void PropertiesPalette_Shadow::handleNewColor(QString value)
-{
-	if (m_haveItem)
-	{
-		double x = softShadowXOffset->valueAsDouble() / m_unitRatio;
-		double y = softShadowYOffset->valueAsDouble() / m_unitRatio;
-		double r = softShadowBlurRadius->valueAsDouble() / m_unitRatio;
-		QString color = value;
-		if (color == CommonStrings::tr_NoneColor)
-			color = CommonStrings::None;
-		int b = softShadowBlendMode->valueAsInt();
-		double o = (100 - softShadowOpacity->valueAsDouble()) / 100.0;
-		int s = softShadowShade->valueAsInt();
-		if (m_haveDoc)
-		{
-			m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
-		}
-	}
-}
-
-void PropertiesPalette_Shadow::handleNewShade(double value)
-{
-	if (m_haveItem)
-	{
-		double x = softShadowXOffset->valueAsDouble() / m_unitRatio;
-		double y = softShadowYOffset->valueAsDouble() / m_unitRatio;
-		double r = softShadowBlurRadius->valueAsDouble() / m_unitRatio;
-		QString color = softShadowColor->valueAsString();
-		if (color == CommonStrings::tr_NoneColor)
-			color = CommonStrings::None;
-		int b = softShadowBlendMode->valueAsInt();
-		double o = (100 - softShadowOpacity->valueAsDouble()) / 100.0;
-		int s = qRound(value);
-		if (m_haveDoc)
-		{
-			m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
-		}
-	}
-}
-
-void PropertiesPalette_Shadow::handleNewOpacity(double value)
-{
-	if (m_haveItem)
-	{
-		double x = softShadowXOffset->valueAsDouble() / m_unitRatio;
-		double y = softShadowYOffset->valueAsDouble() / m_unitRatio;
-		double r = softShadowBlurRadius->valueAsDouble() / m_unitRatio;
-		QString color = softShadowColor->valueAsString();
-		if (color == CommonStrings::tr_NoneColor)
-			color = CommonStrings::None;
-		int b = softShadowBlendMode->valueAsInt();
-		double o = (100 - value) / 100.0;
-		int s = softShadowShade->valueAsInt();
-		if (m_haveDoc)
-		{
-			m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
-		}
-	}
-}
-
-void PropertiesPalette_Shadow::handleNewBlendmode(int value)
-{
-	if (m_haveItem)
-	{
-		double x = softShadowXOffset->valueAsDouble() / m_unitRatio;
-		double y = softShadowYOffset->valueAsDouble() / m_unitRatio;
-		double r = softShadowBlurRadius->valueAsDouble() / m_unitRatio;
-		QString color = softShadowColor->valueAsString();
-		if (color == CommonStrings::tr_NoneColor)
-			color = CommonStrings::None;
-		int b = value;
-		double o = (100 - softShadowOpacity->valueAsDouble()) / 100.0;
-		int s = softShadowShade->valueAsInt();
-		if (m_haveDoc)
-		{
-			m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
-		}
-	}
-}
-
-void PropertiesPalette_Shadow::handleNewErase(bool value)
-{
-	if (m_haveItem)
-	{
-		double x = softShadowXOffset->valueAsDouble() / m_unitRatio;
-		double y = softShadowYOffset->valueAsDouble() / m_unitRatio;
-		double r = softShadowBlurRadius->valueAsDouble() / m_unitRatio;
-		QString color = softShadowColor->valueAsString();
-		if (color == CommonStrings::tr_NoneColor)
-			color = CommonStrings::None;
-		int b = softShadowBlendMode->valueAsInt();
-		double o = (100 - softShadowOpacity->valueAsDouble()) / 100.0;
-		int s = softShadowShade->valueAsInt();
-		if (m_haveDoc)
-		{
-			m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, value, softShadowObjTrans->valueAsBool());
-		}
-	}
-}
-
-void PropertiesPalette_Shadow::handleNewObjTrans(bool value)
-{
-	if (m_haveItem)
-	{
-		double x = softShadowXOffset->valueAsDouble() / m_unitRatio;
-		double y = softShadowYOffset->valueAsDouble() / m_unitRatio;
-		double r = softShadowBlurRadius->valueAsDouble() / m_unitRatio;
-		QString color = softShadowColor->valueAsString();
-		if (color == CommonStrings::tr_NoneColor)
-			color = CommonStrings::None;
-		int b = softShadowBlendMode->valueAsInt();
-		double o = (100 - softShadowOpacity->valueAsDouble()) / 100.0;
-		int s = softShadowShade->valueAsInt();
-		if (m_haveDoc)
-		{
-			m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), value);
 		}
 	}
 }
@@ -512,7 +312,4 @@
 		return;
 	if(m_doc->m_Selection->count()==0)
 		return;
-//	softShadowXOffset->setConstants(&m_doc->constants());
-//	softShadowYOffset->setConstants(&m_doc->constants());
-
-}
+}

Modified: trunk/Scribus/scribus/ui/propertiespalette_shadow.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/ui/propertiespalette_shadow.h
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_shadow.h (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_shadow.h Thu Jun  4 07:54:19 2015
@@ -11,7 +11,6 @@
 #include "scguardedptr.h"
 
 #include "proptree.h"
-#include <QVBoxLayout>
 
 class PageItem;
 class ScribusDoc;
@@ -48,16 +47,6 @@
 
 private slots:
 	void handleNewValues();
-	void handleShadow(bool value);
-	void handleNewXOffset(double value);
-	void handleNewYOffset(double value);
-	void handleNewBlur(double value);
-	void handleNewColor(QString value);
-	void handleNewShade(double value);
-	void handleNewOpacity(double value);
-	void handleNewBlendmode(int value);
-	void handleNewErase(bool value);
-	void handleNewObjTrans(bool value);
 
 protected slots:
 	void updateSpinBoxConstants();
@@ -84,75 +73,4 @@
 	ScGuardedPtr<ScribusDoc> m_doc;
 };
 
-/*
-#include "ui_propertiespalette_shadowbase.h"
-
-#include "scribusapi.h"
-#include "scrspinbox.h"
-#include "sclistboxpixmap.h"
-#include "scguardedptr.h"
-
-class PageItem;
-class ScribusDoc;
-class Selection;
-class ScribusMainWindow;
-class UserActionSniffer;
-
-class SCRIBUS_API PropertiesPalette_Shadow : public QWidget, public Ui::PropertiesPalette_ShadowBase
-{
-	Q_OBJECT
-
-public:
-	PropertiesPalette_Shadow(QWidget* parent);
-	~PropertiesPalette_Shadow() {};
-
-	virtual void changeEvent(QEvent *e);
-
-//	 @brief Returns true if there is a user action going on at the moment of call.
-	bool userActionOn(); // not yet implemented!!! This is needed badly.
-                         // When user releases the mouse button or arrow key, changes must be checked
-                         // and if in ScribusView a groupTransaction has been started it must be also
-						 // commmited
-	void updateColorList();
-
-private:
-
-	PageItem* currentItemFromSelection();
-
-public slots:
-	void setMainWindow(ScribusMainWindow *mw);
-
-	void setDoc(ScribusDoc *d);
-	void setCurrentItem(PageItem *i);
-	void unsetDoc();
-	void unsetItem();
-
-	void languageChange();
-	void unitChange();
-	void handleSelectionChanged();
-	void handleUpdateRequest(int);
-
-private slots:
-	void handleNewValues();
-
-protected slots:
-	void spinboxStartUserAction();
-	void spinboxFinishUserAction();
-	void updateSpinBoxConstants();
-
-protected:
-	ScribusMainWindow *m_ScMW;
-
-	bool      m_haveDoc;
-	bool      m_haveItem;
-	double    m_unitRatio;
-	int       m_unitIndex;
-	PageItem *m_item;
-	ScGuardedPtr<ScribusDoc> m_doc;
-
-	bool _userActionOn;
-	UserActionSniffer *userActionSniffer;
-	void installSniffer(ScrSpinBox *spinBox);
-};
-*/
 #endif

Modified: trunk/Scribus/scribus/ui/proptree.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/ui/proptree.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/proptree.cpp (original)
+++ trunk/Scribus/scribus/ui/proptree.cpp Thu Jun  4 07:54:19 2015
@@ -156,7 +156,7 @@
 		connect(editor, SIGNAL(clicked(bool)), item, SIGNAL(valueChanged(bool)));
 		connect(editor, SIGNAL(clicked(bool)), this, SLOT(valueHasChanged()));
 	}
-	else if (item->m_type == PropTreeItem::ColorCombo)
+	else if (item->m_type == PropTreeItem::ColorComboBox)
 	{
 		ColorCombo *editor = new ColorCombo(parent);
 		editor->updateBox(item->m_colors, ColorCombo::fancyPixmaps, false);
@@ -197,7 +197,7 @@
 		QCheckBox *checkBox = static_cast<QCheckBox*>(editor);
 		checkBox->setChecked(index.model()->data(index, Qt::UserRole).toBool());
 	}
-	else if (item->m_type == PropTreeItem::ColorCombo)
+	else if (item->m_type == PropTreeItem::ColorComboBox)
 	{
 		ColorCombo *comboBox = static_cast<ColorCombo*>(editor);
 		setCurrentComboItem(comboBox ,index.model()->data(index, Qt::UserRole).toString());
@@ -241,7 +241,7 @@
 		model->setData(index, value, Qt::UserRole);
 		model->setData(index, value, Qt::DisplayRole);
 	}
-	else if (item->m_type == PropTreeItem::ColorCombo)
+	else if (item->m_type == PropTreeItem::ColorComboBox)
 	{
 		ColorCombo *comboBox = static_cast<ColorCombo*>(editor);
 		QString value = comboBox->currentText();

Modified: trunk/Scribus/scribus/ui/proptree.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/ui/proptree.h
==============================================================================
--- trunk/Scribus/scribus/ui/proptree.h (original)
+++ trunk/Scribus/scribus/ui/proptree.h Thu Jun  4 07:54:19 2015
@@ -74,7 +74,7 @@
 		DoubleSpinBox = 2,
 		ComboBox      = 3,
 		CheckBox      = 4,
-		ColorCombo    = 5
+		ColorComboBox = 5
 	};
 
 	int valueAsInt();

Modified: trunk/Scribus/scribus/util_color.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20145&path=/trunk/Scribus/scribus/util_color.cpp
==============================================================================
--- trunk/Scribus/scribus/util_color.cpp (original)
+++ trunk/Scribus/scribus/util_color.cpp Thu Jun  4 07:54:19 2015
@@ -34,6 +34,7 @@
 #include "fileloader.h"
 #include "loadsaveplugin.h"
 #include "plugins/formatidlist.h"
+#include "third_party/zip/scribus_zip.h"
 #include "util.h"
 #include "util_formats.h"
 #include "util_icon.h"
@@ -181,21 +182,36 @@
 	return pm;
 }
 
-static quint64 code64(const ScColor & col) {
-	int C, M, Y, K, R, G, B;
-	quint64 result=0;
+static quint64 code64(const ScColor & col)
+{
+	int C = 0;
+	int M = 0;
+	int Y = 0;
+	int K = 0;
+	int R = 0;
+	int G = 0;
+	int B = 0;
+	quint64 result = 0;
 	if (col.getColorModel() == colorModelRGB)
 	{
 		col.getRGB( &R, &G, &B );
 		QColor color = QColor(R, G, B);
 		color.getCmyk(&C, &M, &Y, &K);
 	}
-	else
+	else if (col.getColorModel() == colorModelCMYK)
 	{
 		col.getCMYK( &C, &M, &Y, &K );
 		R = 255-qMin(255, C + K);
 		G = 255-qMin(255, M + K);
 		B = 255-qMin(255, Y + K);
+	}
+	else
+	{
+		double L, a, b;
+		col.getLab(&L, &a, &b);
+		R = qRound(L);
+		G = qRound(a);
+		B = qRound(b);
 	}
 	result |= col.getColorModel() == colorModelRGB ? 1 : 0;
 	result |= col.isSpotColor() ? 64 : 0;
@@ -217,31 +233,35 @@
 	return result;
 }
 
-QPixmap * getFancyPixmap(const ScColor& col, ScribusDoc* doc) {
+QPixmap * getFancyPixmap(const ScColor& col, ScribusDoc* doc)
+{
 	static ScPixmapCache<quint64> pxCache;
 
 	static QPixmap alertIcon;
 	static QPixmap cmykIcon;
 	static QPixmap rgbIcon;
+	static QPixmap labIcon;
 	static QPixmap spotIcon;
 	static QPixmap regIcon;
 	static bool iconsInitialized = false;
 
-	if ( !iconsInitialized ) {
+	if ( !iconsInitialized )
+	{
 		alertIcon = loadIcon("alert.png");
 		cmykIcon = loadIcon("cmyk.png");
 		rgbIcon = loadIcon("rgb.png");
+		labIcon = loadIcon("lab.png");
 		spotIcon = loadIcon("spot.png");
 		regIcon = loadIcon("register.png");
 		iconsInitialized = true;
 	}
 
-	quint64 res=code64(col);
+	quint64 res = code64(col);
 	if (pxCache.contains(res))
 		return pxCache[res];
 
-	QPixmap *pa=new QPixmap(60, 15);
-	QPixmap *pm=getSmallPixmap(ScColorEngine::getDisplayColor(col, doc));
+	QPixmap *pa = new QPixmap(60, 15);
+	QPixmap *pm = getSmallPixmap(ScColorEngine::getDisplayColor(col, doc));
 //	QPixmap *pm=getSmallPixmap(col.getRawRGBColor());
 	pa->fill(Qt::white);
 	paintAlert(*pm, *pa, 0, 0);
@@ -249,8 +269,10 @@
 		paintAlert(alertIcon, *pa, 15, 0);
 	if (col.getColorModel() == colorModelCMYK)   // || (col.isSpotColor()))
 		paintAlert(cmykIcon, *pa, 30, 0);
-	else
+	else if (col.getColorModel() == colorModelRGB)
 		paintAlert(rgbIcon, *pa, 30, 0);
+	else if (col.getColorModel() == colorModelLab)
+		paintAlert(labIcon, *pa, 30, 0);
 	if (col.isSpotColor())
 		paintAlert(spotIcon, *pa, 46, 2);
 	if (col.isRegistrationColor())
@@ -1063,6 +1085,85 @@
 				}
 				fiC.close();
 			}
+			else if (ext == "sbz")
+			{
+				ScZipHandler *uz = new ScZipHandler();
+				if (uz->open(fileName))
+				{
+					if (uz->contains("swatchbook.xml"))
+					{
+						QByteArray docBytes;
+						if (uz->read("swatchbook.xml", docBytes))
+						{
+							QString docText("");
+							docText = QString::fromUtf8(docBytes);
+							QDomDocument docu("scridoc");
+							if (docu.setContent(docText))
+							{
+								QDomElement docElem = docu.documentElement();
+								for(QDomElement drawPag = docElem.firstChildElement(); !drawPag.isNull(); drawPag = drawPag.nextSiblingElement())
+								{
+									if (drawPag.tagName() == "materials")
+									{
+										for(QDomElement spf = drawPag.firstChildElement(); !spf.isNull(); spf = spf.nextSiblingElement() )
+										{
+											if (spf.tagName() == "color")
+											{
+												bool isSpot = spf.attribute("usage") == "spot";
+												QString colorName = "";
+												ScColor tmp;
+												tmp.setRegistrationColor(false);
+												for(QDomElement spp = spf.firstChildElement(); !spp.isNull(); spp = spp.nextSiblingElement() )
+												{
+													if (spp.tagName() == "metadata")
+													{
+														for(QDomElement spm = spp.firstChildElement(); !spm.isNull(); spm = spm.nextSiblingElement() )
+														{
+															if (spm.tagName() == "dc:identifier")
+																colorName = spm.text();
+														}
+													}
+													else if (spp.tagName() == "values")
+													{
+														QString colorVals = spp.text();
+														ScTextStream CoE(&colorVals, QIODevice::ReadOnly);
+														if (spp.attribute("model") == "Lab")
+														{
+															double inC[3];
+															CoE >> inC[0];
+															CoE >> inC[1];
+															CoE >> inC[2];
+															tmp.setColor(inC[0], inC[1], inC[2]);
+															tmp.setSpotColor(isSpot);
+														}
+														else if (spp.attribute("model") == "CMYK")
+														{
+															double c, m, y, k;
+															CoE >> c >> m >> y >> k;
+															tmp.setColor(qRound(255 * c), qRound(255 * m), qRound(255 * y), qRound(255 * k));
+															tmp.setSpotColor(isSpot);
+														}
+														else if (spp.attribute("model") == "RGB")
+														{
+															double r, g, b;
+															CoE >> r >> g >> b;
+															tmp.setColorRGB(qRound(255 * r), qRound(255 * g), qRound(255 * b));
+															tmp.setSpotColor(false);
+														}
+													}
+												}
+												if (!colorName.isEmpty())
+													EditColors.tryAddColor(colorName, tmp);
+											}
+										}
+									}
+								}
+							}
+						}
+					}
+				}
+				delete uz;
+			}
 			else							// try for OpenOffice, Viva and our own format
 			{
 				QFile fiC(fileName);




More information about the scribus-commit mailing list