Code

Adding function to locate profile by bane
authorjoncruz <joncruz@users.sourceforge.net>
Mon, 29 Oct 2007 06:31:22 +0000 (06:31 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Mon, 29 Oct 2007 06:31:22 +0000 (06:31 +0000)
src/profile-manager.cpp
src/profile-manager.h

index c2d3446296ed450f20e41e2526a15fa262922766..19655e0a1b42a54eb7acb5724f40865e20021388 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "profile-manager.h"
 #include "document.h"
+#include "color-profile.h"
 
 namespace Inkscape {
 
@@ -62,6 +63,22 @@ void ProfileManager::_resourcesChanged()
     }
 }
 
+ColorProfile* ProfileManager::find(gchar const* name)
+{
+    ColorProfile* match = 0;
+    if ( name ) {
+        unsigned int howMany = childCount(NULL);
+        for ( unsigned int index = 0; index < howMany; index++ ) {
+            SPObject *obj = nthChildOf(NULL, index);
+            ColorProfile* prof = reinterpret_cast<ColorProfile*>(obj);
+            if ( prof && prof->name && !strcmp(name, prof->name) ) {
+                match = prof;
+                break;
+            }
+        }
+    }
+    return match;
+}
 
 }
 
index c52101ca3c8b2e88686b33298477064ad5cbaed6..61e22615fd080d270876b40df97d024aa78e8296 100644 (file)
 
 class SPDocument;
 
-
 namespace Inkscape {
 
+class ColorProfile;
+
 class ProfileManager : public DocumentSubset,
                        public GC::Finalized
 {
@@ -25,6 +26,8 @@ public:
     ProfileManager(SPDocument *document);
     ~ProfileManager();
 
+    ColorProfile* find(gchar const* name);
+
 private:
     ProfileManager(ProfileManager const &); // no copy
     void operator=(ProfileManager const &); // no assign