r22437 by jghali - enable import of spectral and Lab colors from CxF files

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 14 22:37:21 UTC 2018


Author: jghali
Date: Wed Mar 14 22:37:21 2018
New Revision: 22437

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22437
Log:
enable import of spectral and Lab colors from CxF files

Modified:
    trunk/Scribus/scribus/palettes/paletteloader_cxf.cpp
    trunk/Scribus/scribus/ui/colorsandfills.cpp
    trunk/Scribus/scribus/util_color.cpp

Modified: trunk/Scribus/scribus/palettes/paletteloader_cxf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22437&path=/trunk/Scribus/scribus/palettes/paletteloader_cxf.cpp
==============================================================================
--- trunk/Scribus/scribus/palettes/paletteloader_cxf.cpp	(original)
+++ trunk/Scribus/scribus/palettes/paletteloader_cxf.cpp	Wed Mar 14 22:37:21 2018
@@ -61,6 +61,17 @@
 {
 	ScColor color;
 
+	const CxfReflectanceSpectrum* spectrum = dynamic_cast<const CxfReflectanceSpectrum*>(object->color(cxfReflectanceSpectrum));
+	if (spectrum)
+	{
+		ScLab labVal = m_spectrumConvertor.toLab(spectrum->wavelengths(), spectrum->values());
+		color.setLabColor(labVal.L, labVal.a, labVal.b);
+		color.setSpotColor(false);
+		color.setRegistrationColor(false);
+		m_colors->tryAddColor(object->name(), color);
+		return true;
+	}
+
 	const CxfColorCIELab* cxfLabColor = dynamic_cast<const CxfColorCIELab*>(object->color(cxfColorCIELab));
 	if (cxfLabColor)
 	{
@@ -110,16 +121,5 @@
 		}
 	}
 
-	const CxfReflectanceSpectrum* spectrum = dynamic_cast<const CxfReflectanceSpectrum*>(object->color(cxfReflectanceSpectrum));
-	if (spectrum)
-	{
-		ScLab labVal = m_spectrumConvertor.toLab(spectrum->wavelengths(), spectrum->values());
-		color.setLabColor(labVal.L, labVal.a, labVal.b);
-		color.setSpotColor(false);
-		color.setRegistrationColor(false);
-		m_colors->tryAddColor(object->name(), color);
-		return true;
-	}
-
 	return false;
 }

Modified: trunk/Scribus/scribus/ui/colorsandfills.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22437&path=/trunk/Scribus/scribus/ui/colorsandfills.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/colorsandfills.cpp	(original)
+++ trunk/Scribus/scribus/ui/colorsandfills.cpp	Wed Mar 14 22:37:21 2018
@@ -1069,7 +1069,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 *.ase *.skp *.soc *.gpl *.xml *.sbz");
+			QString ooexts(" *.acb *.aco *.ase *.cxf *.gpl *.sbz *.skp *.soc *.xml");
 			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 | fdDisableOk);

Modified: trunk/Scribus/scribus/util_color.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22437&path=/trunk/Scribus/scribus/util_color.cpp
==============================================================================
--- trunk/Scribus/scribus/util_color.cpp	(original)
+++ trunk/Scribus/scribus/util_color.cpp	Wed Mar 14 22:37:21 2018
@@ -32,6 +32,7 @@
 #include "palettes/paletteloader_adobe_aco.h"
 #include "palettes/paletteloader_adobe_ase.h"
 #include "palettes/paletteloader_autocad_acb.h"
+#include "palettes/paletteloader_cxf.h"
 #include "palettes/paletteloader_ps.h"
 #include "palettes/paletteloader_sk1.h"
 #include "palettes/paletteloader_swatchbook.h"
@@ -697,6 +698,16 @@
 			{
 				adobePalLoader.setupTargets(&EditColors, dialogGradients);
 				return adobePalLoader.importFile(fileName, merge);
+			}
+			return false;
+		}
+		else if (ext == "cxf")			// Adobe swatch exchange format
+		{
+			PaletteLoader_CxF cxfLoader;
+			if (cxfLoader.isFileSupported(fileName))
+			{
+				cxfLoader.setupTargets(&EditColors, dialogGradients);
+				return cxfLoader.importFile(fileName, merge);
 			}
 			return false;
 		}




More information about the scribus-commit mailing list