diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 583145c806a3dc596fd3f1ba7675f9f4745052d1..a562d756c7967c5d0abf7fcc111362db25384075 100644 (file)
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
#define DEBUG_MESSAGE(key, ...) \
{\
Inkscape::Preferences *prefs = Inkscape::Preferences::get();\
- bool dump = prefs->getBool("options.scislac", #key);\
- bool dumpD = prefs->getBool("options.scislac", #key"D");\
- bool dumpD2 = prefs->getBool("options.scislac", #key"D2");\
+ bool dump = prefs->getBool(Glib::ustring("/options/scislac/") + #key);\
+ bool dumpD = prefs->getBool(Glib::ustring("/options/scislac/") + #key"D");\
+ bool dumpD2 = prefs->getBool(Glib::ustring("/options/scislac/") + #key"D2");\
dumpD &= ( (update_in_progress == 0) || dumpD2 );\
if ( dump )\
{\
//# 1. Get complete URI of document
gchar const *docbase = SP_DOCUMENT_URI( doc );
if (!docbase)
- {
- g_warning("null docbase");
+ {
+ // Normal for files that have not yet been saved.
docbase = "";
- }
+ }
//g_message("docbase:%s\n", docbase);
org::w3c::dom::URI docUri(docbase);
//# 2. Get href of icc file. we don't care if it's rel or abs
//# 3. Resolve the href according the docBase. This follows
// the w3c specs. All absolute and relative issues are considered
org::w3c::dom::URI cprofUri = docUri.resolve(hrefUri);
- gchar* fullname = (gchar *)cprofUri.getNativePath().c_str();
+ gchar* fullname = g_strdup((gchar *)cprofUri.getNativePath().c_str());
cprof->_clearProfile();
cprof->profHandle = cmsOpenProfileFromFile( fullname, "r" );
if ( cprof->profHandle ) {
#ifdef DEBUG_LCMS
DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)cprof->profHandle );
#endif // DEBUG_LCMS
-
+ g_free(fullname);
#endif // ENABLE_LCMS
}
}
return result;
}
+#endif // ENABLE_LCMS
-static void findThings() {
- std::list<gchar *> sources;
+std::list<Glib::ustring> ColorProfile::getProfileDirs() {
+ std::list<Glib::ustring> sources;
gchar* base = profile_path("XXX");
{
sources.push_back(g_build_filename(dataDirs[i], "color", "icc", NULL));
}
- while (!sources.empty()) {
- gchar *dirname = sources.front();
- if ( g_file_test( dirname, G_FILE_TEST_EXISTS ) && g_file_test( dirname, G_FILE_TEST_IS_DIR ) ) {
+ return sources;
+}
+
+#if ENABLE_LCMS
+static void findThings() {
+ std::list<Glib::ustring> sources = ColorProfile::getProfileDirs();
+
+ for ( std::list<Glib::ustring>::const_iterator it = sources.begin(); it != sources.end(); ++it ) {
+ if ( g_file_test( it->c_str(), G_FILE_TEST_EXISTS ) && g_file_test( it->c_str(), G_FILE_TEST_IS_DIR ) ) {
GError *err = 0;
- GDir *dir = g_dir_open(dirname, 0, &err);
+ GDir *dir = g_dir_open(it->c_str(), 0, &err);
if (dir) {
for (gchar const *file = g_dir_read_name(dir); file != NULL; file = g_dir_read_name(dir)) {
- gchar *filepath = g_build_filename(dirname, file, NULL);
+ gchar *filepath = g_build_filename(it->c_str(), file, NULL);
if ( g_file_test( filepath, G_FILE_TEST_IS_DIR ) ) {
}
}
}
-
- // toss the dirname
- g_free(dirname);
- sources.pop_front();
}
}
}
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- Glib::ustring uri = prefs->getString("options.displayprofile", "uri");
+ Glib::ustring uri = prefs->getString("/options/displayprofile/uri");
if ( !uri.empty() ) {
if ( uri != lastURI ) {
}
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- bool which = prefs->getBool( "options.softproof", "enable");
- Glib::ustring uri = prefs->getString("options.softproof", "uri");
+ bool which = prefs->getBool( "/options/softproof/enable");
+ Glib::ustring uri = prefs->getString("/options/softproof/uri");
if ( which && !uri.empty() ) {
if ( lastURI != uri ) {
cmsHTRANSFORM Inkscape::colorprofile_get_display_transform()
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- bool fromDisplay = prefs->getBool( "options.displayprofile", "from_display");
+ bool fromDisplay = prefs->getBool( "/options/displayprofile/from_display");
if ( fromDisplay ) {
if ( transf ) {
cmsDeleteTransform(transf);
return 0;
}
- bool warn = prefs->getBool( "options.softproof", "gamutwarn");
- int intent = prefs->getIntLimited( "options.displayprofile", "intent", 0, 0, 3 );
- int proofIntent = prefs->getIntLimited( "options.softproof", "intent", 0, 0, 3 );
- bool bpc = prefs->getBool( "options.softproof", "bpc");
+ bool warn = prefs->getBool( "/options/softproof/gamutwarn");
+ int intent = prefs->getIntLimited( "/options/displayprofile/intent", 0, 0, 3 );
+ int proofIntent = prefs->getIntLimited( "/options/softproof/intent", 0, 0, 3 );
+ bool bpc = prefs->getBool( "/options/softproof/bpc");
#if defined(cmsFLAGS_PRESERVEBLACK)
- bool preserveBlack = prefs->getBool( "options.softproof", "preserveblack");
+ bool preserveBlack = prefs->getBool( "/options/softproof/preserveblack");
#endif //defined(cmsFLAGS_PRESERVEBLACK)
- Glib::ustring colorStr = prefs->getString("options.softproof", "gamutcolor");
+ Glib::ustring colorStr = prefs->getString("/options/softproof/gamutcolor");
Gdk::Color gamutColor( colorStr.empty() ? "#808080" : colorStr );
if ( (warn != gamutWarn)
dwFlags |= cmsFLAGS_PRESERVEBLACK;
}
#endif // defined(cmsFLAGS_PRESERVEBLACK)
- transf = cmsCreateProofingTransform( ColorProfile::getSRGBProfile(), TYPE_RGB_8, hprof, TYPE_RGB_8, proofProf, intent, proofIntent, dwFlags );
+ transf = cmsCreateProofingTransform( ColorProfile::getSRGBProfile(), TYPE_ARGB_8, hprof, TYPE_ARGB_8, proofProf, intent, proofIntent, dwFlags );
} else if ( hprof ) {
- transf = cmsCreateTransform( ColorProfile::getSRGBProfile(), TYPE_RGB_8, hprof, TYPE_RGB_8, intent, 0 );
+ transf = cmsCreateTransform( ColorProfile::getSRGBProfile(), TYPE_ARGB_8, hprof, TYPE_ARGB_8, intent, 0 );
}
}
@@ -969,14 +972,14 @@ cmsHTRANSFORM Inkscape::colorprofile_get_display_per( Glib::ustring const& id )
if ( id == it2->id ) {
MemProfile& item = *it2;
- bool warn = prefs->getBool( "options.softproof", "gamutwarn");
- int intent = prefs->getIntLimited( "options.displayprofile", "intent", 0, 0, 3 );
- int proofIntent = prefs->getIntLimited( "options.softproof", "intent", 0, 0, 3 );
- bool bpc = prefs->getBool( "options.softproof", "bpc");
+ bool warn = prefs->getBool( "/options/softproof/gamutwarn");
+ int intent = prefs->getIntLimited( "/options/displayprofile/intent", 0, 0, 3 );
+ int proofIntent = prefs->getIntLimited( "/options/softproof/intent", 0, 0, 3 );
+ bool bpc = prefs->getBool( "/options/softproof/bpc");
#if defined(cmsFLAGS_PRESERVEBLACK)
- bool preserveBlack = prefs->getBool( "options.softproof", "preserveblack");
+ bool preserveBlack = prefs->getBool( "/options/softproof/preserveblack");
#endif //defined(cmsFLAGS_PRESERVEBLACK)
- Glib::ustring colorStr = prefs->getString("options.softproof", "gamutcolor");
+ Glib::ustring colorStr = prefs->getString("/options/softproof/gamutcolor");
Gdk::Color gamutColor( colorStr.empty() ? "#808080" : colorStr );
if ( (warn != gamutWarn)
@@ -1017,9 +1020,9 @@ cmsHTRANSFORM Inkscape::colorprofile_get_display_per( Glib::ustring const& id )
dwFlags |= cmsFLAGS_PRESERVEBLACK;
}
#endif // defined(cmsFLAGS_PRESERVEBLACK)
- item.transf = cmsCreateProofingTransform( ColorProfile::getSRGBProfile(), TYPE_RGB_8, item.hprof, TYPE_RGB_8, proofProf, intent, proofIntent, dwFlags );
+ item.transf = cmsCreateProofingTransform( ColorProfile::getSRGBProfile(), TYPE_ARGB_8, item.hprof, TYPE_ARGB_8, proofProf, intent, proofIntent, dwFlags );
} else if ( item.hprof ) {
- item.transf = cmsCreateTransform( ColorProfile::getSRGBProfile(), TYPE_RGB_8, item.hprof, TYPE_RGB_8, intent, 0 );
+ item.transf = cmsCreateTransform( ColorProfile::getSRGBProfile(), TYPE_ARGB_8, item.hprof, TYPE_ARGB_8, intent, 0 );
}
}