Code

Fixed Win32 code for MS Windows-specific color profile location. Fixes bug #214198.
authorjoncruz <joncruz@users.sourceforge.net>
Sat, 26 Sep 2009 22:30:32 +0000 (22:30 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Sat, 26 Sep 2009 22:30:32 +0000 (22:30 +0000)
build.xml
src/color-profile.cpp

index 19564375181b66b49e7f2d6902566a13c329028b..384251fc6796aa1530483864b9d213fc508de722 100644 (file)
--- a/build.xml
+++ b/build.xml
            -lgc
            -lws2_32 -lintl -lgdi32 -lcomdlg32 -lm
            -lgomp -lpthreadGC2 -laspell
+           -lmscms  <!-- required for color profiles -->
        </libs>
     </link>
   </target>
            -lgc
            -lws2_32 -lintl -lgdi32 -lcomdlg32 -lm
            -lgomp -lpthreadGC2
+           -lmscms  <!-- required for color profiles -->
        </libs>
     </link>
   </target>
            -lgc
            -lws2_32 -lintl -lgdi32 -lcomdlg32 -lm
            -lgomp -lpthreadGC2 
+           -lmscms  <!-- required for color profiles -->
        </libs>
     </link>
   </target>
index 5868a958294f23234d2c1b9ecfedd066fd93a5f8..6e180ab4fe4f39c6e33c1ea01cc5c1bdcab4d2c3 100644 (file)
@@ -1,4 +1,6 @@
-
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 //#define DEBUG_LCMS
 
 
 #include <cstring>
 #include <string>
-// #ifdef WIN32
-// #include <windows.h>
-// #include <Icm.h>
-// #endif
+
+#ifdef WIN32
+#ifndef _WIN32_WINDOWS         // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410
+#endif
+#if ENABLE_LCMS
+#else
+#include <windows.h>
+#endif // ENABLE_LCMS
+#endif
+
 #include "xml/repr.h"
 #include "color-profile.h"
 #include "color-profile-fns.h"
@@ -27,6 +36,9 @@
 #include "dom/uri.h"
 #include "dom/util/digest.h"
 
+#ifdef WIN32
+#include <Icm.h>
+#endif // WIN32
 
 using Inkscape::ColorProfile;
 using Inkscape::ColorProfileClass;
@@ -604,21 +616,21 @@ std::list<Glib::ustring> ColorProfile::getProfileDirs() {
     }
 
 
-// #ifdef WIN32
-//     wchar_t pathBuf[MAX_PATH + 1];
-//     pathBuf[0] = 0;
-//     DWORD pathSize = sizeof(pathBuf);
-//     g_assert(sizeof(wchar_t) == sizeof(gunichar2));
-//     if ( GetColorDirectoryW( NULL, &pathBuf, &pathSize ) ) {
-//         gchar * utf8Path = g_utf16_to_utf8( (gunichar2*)(&pathBuf[0]), -1, NULL, NULL, NULL );
-//         if ( !g_utf8_validate(utf8Path, -1, NULL) ) {
-//             g_warning( "GetColorDirectoryW() resulted in invalid UTF-8" );
-//         } else {
-//             sources.pushback(utf8Path);
-//         }
-//         g_free( utf8Path );
-//     }
-// #endif // WIN32
+#ifdef WIN32
+    wchar_t pathBuf[MAX_PATH + 1];
+    pathBuf[0] = 0;
+    DWORD pathSize = sizeof(pathBuf);
+    g_assert(sizeof(wchar_t) == sizeof(gunichar2));
+    if ( GetColorDirectoryW( NULL, pathBuf, &pathSize ) ) {
+        gchar * utf8Path = g_utf16_to_utf8( (gunichar2*)(&pathBuf[0]), -1, NULL, NULL, NULL );
+        if ( !g_utf8_validate(utf8Path, -1, NULL) ) {
+            g_warning( "GetColorDirectoryW() resulted in invalid UTF-8" );
+        } else {
+            sources.push_back(utf8Path);
+        }
+        g_free( utf8Path );
+    }
+#endif // WIN32
 
     return sources;
 }