r15709 by fschmid - Added support for importing Sk1 palettes.
scribus-commit
scribus-commit at lists.scribus.net
Sun Oct 31 18:36:57 CET 2010
Author: fschmid
Date: Sun Oct 31 17:36:57 2010
New Revision: 15709
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15709
Log:
Added support for importing Sk1 palettes.
Modified:
trunk/Scribus/scribus/colorsetmanager.cpp
trunk/Scribus/scribus/ui/paintmanager.cpp
trunk/Scribus/scribus/util_color.cpp
Modified: trunk/Scribus/scribus/colorsetmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15709&path=/trunk/Scribus/scribus/colorsetmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/colorsetmanager.cpp (original)
+++ trunk/Scribus/scribus/colorsetmanager.cpp Sun Oct 31 17:36:57 2010
@@ -139,7 +139,7 @@
void ColorSetManager::searchDir(QString path, QMap<QString, QString> &pList, QTreeWidgetItem* parent)
{
QStringList exts;
- exts << "xml" << "gpl" << "eps" << "ai" << "sla" << "soc";
+ exts << "xml" << "gpl" << "eps" << "ai" << "skp" << "sla" << "soc";
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/ui/paintmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15709&path=/trunk/Scribus/scribus/ui/paintmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/paintmanager.cpp (original)
+++ trunk/Scribus/scribus/ui/paintmanager.cpp Sun Oct 31 17:36:57 2010
@@ -812,7 +812,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(" *.soc *.gpl *.xml");
+ QString ooexts(" *.skp *.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);
if (dia.exec() == QDialog::Accepted)
Modified: trunk/Scribus/scribus/util_color.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15709&path=/trunk/Scribus/scribus/util_color.cpp
==============================================================================
--- trunk/Scribus/scribus/util_color.cpp (original)
+++ trunk/Scribus/scribus/util_color.cpp Sun Oct 31 17:36:57 2010
@@ -733,7 +733,72 @@
}
}
}
- else
+ else if (ext == "skp") // Sk1 palette
+ {
+ QFile fiC(fileName);
+ if (fiC.open(QIODevice::ReadOnly))
+ {
+ bool isCMYK = false;
+ QByteArray docBytes("");
+ loadRawText(fileName, docBytes);
+ QString docText("");
+ docText = QString::fromUtf8(docBytes);
+ QDomDocument docu("scridoc");
+ docu.setContent(docText);
+ ScColor lf = ScColor();
+ QDomElement elem = docu.documentElement();
+ QDomNode PAGE = elem.firstChild();
+ while(!PAGE.isNull())
+ {
+ QDomElement pg = PAGE.toElement();
+ if(pg.tagName() == "description")
+ {
+ if (pg.attribute("type", "") == "CMYK")
+ isCMYK = true;
+ }
+ if(pg.tagName() == "color")
+ {
+ QString Cname;
+ if (isCMYK)
+ {
+ double c, m, y, k;
+ c = pg.attribute("c", "0").toDouble();
+ m = pg.attribute("m", "0").toDouble();
+ y = pg.attribute("y", "0").toDouble();
+ k = pg.attribute("k", "0").toDouble();
+ Cname = pg.attribute("name", "");
+ if (!Cname.isEmpty())
+ {
+ lf.setColor(qRound(255 * c), qRound(255 * m), qRound(255 * y), qRound(255 * k));
+ lf.setSpotColor(false);
+ lf.setRegistrationColor(false);
+ if (!EditColors.contains(Cname))
+ EditColors.insert(Cname, lf);
+ }
+ }
+ else
+ {
+ double r, g, b;
+ r = pg.attribute("r", "0").toDouble();
+ g = pg.attribute("g", "0").toDouble();
+ b = pg.attribute("b", "0").toDouble();
+ Cname = pg.attribute("name", "");
+ if (!Cname.isEmpty())
+ {
+ lf.setColorRGB(qRound(255 * r), qRound(255 * g), qRound(255 * b));
+ lf.setSpotColor(false);
+ lf.setRegistrationColor(false);
+ if (!EditColors.contains(Cname))
+ EditColors.insert(Cname, lf);
+ }
+ }
+ }
+ PAGE=PAGE.nextSibling();
+ }
+ }
+ fiC.close();
+ }
+ else // try for OpenOffice, Viva and our own format
{
QFile fiC(fileName);
if (fiC.open(QIODevice::ReadOnly))
More information about the scribus-commit
mailing list