r13837 by fschmid - Support for Viva Press color swatches added to the Colormanager.
scribus-commit
scribus-commit at lists.scribus.net
Wed Aug 26 05:29:11 CEST 2009
Revision: 13837
Author: fschmid
Date: 2009-08-10T21:23:26.898959Z
Commit message: Support for Viva Press color swatches added to the Colormanager.
Changeset:
M /trunk/Scribus/scribus/ui/colorm.cpp
M /trunk/Scribus/scribus/util_color.cpp
Diffs:
Index: scribus/ui/colorm.cpp
===================================================================
--- scribus/ui/colorm.cpp (revision 13836)
+++ scribus/ui/colorm.cpp (revision 13837)
@@ -309,7 +309,7 @@
QString docexts("*.sla *.sla.gz *.scd *.scd.gz");
QString aiepsext(FormatsManager::instance()->extensionListForFormat(FormatsManager::EPS|FormatsManager::PS|FormatsManager::AI, 0));
- QString ooexts(" *.soc *.gpl");
+ QString ooexts(" *.soc *.gpl *.xml");
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);
Index: scribus/util_color.cpp
===================================================================
--- scribus/util_color.cpp (revision 13836)
+++ scribus/util_color.cpp (revision 13837)
@@ -763,7 +763,7 @@
bool cus = false;
if (ColorEn.contains("OpenOffice"))
cus = true;
- if (ColorEn.startsWith("<?xml version="))
+ if ((ColorEn.startsWith("<?xml version=")) || (ColorEn.contains("VivaColors")))
{
QByteArray docBytes("");
loadRawText(fileName, docBytes);
@@ -773,6 +773,10 @@
docu.setContent(docText);
ScColor lf = ScColor();
QDomElement elem = docu.documentElement();
+ QString dTag = "";
+ dTag = elem.tagName();
+ QString nameMask = "%1";
+ nameMask = elem.attribute("mask", "%1");
QDomNode PAGE = elem.firstChild();
while(!PAGE.isNull())
{
@@ -804,6 +808,56 @@
if ((!EditColors.contains(nam)) && (!nam.isEmpty()))
EditColors.insert(nam, lf);
}
+ else if (dTag == "VivaColors")
+ {
+ int cVal = 0;
+ int mVal = 0;
+ int yVal = 0;
+ int kVal = 0;
+ QString nam = nameMask.arg(pg.attribute("name"));
+ if (pg.attribute("type") == "cmyk")
+ {
+ QDomNode colNode = pg.firstChild();
+ while(!colNode.isNull())
+ {
+ QDomElement colVal = colNode.toElement();
+ if (colVal.tagName() == "cyan")
+ cVal = colVal.text().toInt();
+ if (colVal.tagName() == "magenta")
+ mVal = colVal.text().toInt();
+ if (colVal.tagName() == "yellow")
+ yVal = colVal.text().toInt();
+ if (colVal.tagName() == "key")
+ kVal = colVal.text().toInt();
+ colNode = colNode.nextSibling();
+ }
+ lf.setColor(qRound(2.55 * cVal), qRound(2.55 * mVal), qRound(2.55 * yVal), qRound(2.55 * kVal));
+ lf.setSpotColor(false);
+ lf.setRegistrationColor(false);
+ if ((!EditColors.contains(nam)) && (!nam.isEmpty()))
+ EditColors.insert(nam, lf);
+ }
+ else if (pg.attribute("type") == "rgb")
+ {
+ QDomNode colNode = pg.firstChild();
+ while(!colNode.isNull())
+ {
+ QDomElement colVal = colNode.toElement();
+ if (colVal.tagName() == "red")
+ cVal = colVal.text().toInt();
+ if (colVal.tagName() == "green")
+ mVal = colVal.text().toInt();
+ if (colVal.tagName() == "blue")
+ yVal = colVal.text().toInt();
+ colNode = colNode.nextSibling();
+ }
+ lf.setColorRGB(cVal, mVal, yVal);
+ lf.setSpotColor(false);
+ lf.setRegistrationColor(false);
+ if ((!EditColors.contains(nam)) && (!nam.isEmpty()))
+ EditColors.insert(nam, lf);
+ }
+ }
PAGE=PAGE.nextSibling();
}
}
More information about the scribus-commit
mailing list