From: joncruz Date: Mon, 29 Oct 2007 06:31:22 +0000 (+0000) Subject: Adding function to locate profile by bane X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=82166c087171ab69a34608465b46515c10a435e7;p=inkscape.git Adding function to locate profile by bane --- diff --git a/src/profile-manager.cpp b/src/profile-manager.cpp index c2d344629..19655e0a1 100644 --- a/src/profile-manager.cpp +++ b/src/profile-manager.cpp @@ -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(obj); + if ( prof && prof->name && !strcmp(name, prof->name) ) { + match = prof; + break; + } + } + } + return match; +} } diff --git a/src/profile-manager.h b/src/profile-manager.h index c52101ca3..61e22615f 100644 --- a/src/profile-manager.h +++ b/src/profile-manager.h @@ -15,9 +15,10 @@ 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