From 82166c087171ab69a34608465b46515c10a435e7 Mon Sep 17 00:00:00 2001 From: joncruz Date: Mon, 29 Oct 2007 06:31:22 +0000 Subject: [PATCH] Adding function to locate profile by bane --- src/profile-manager.cpp | 17 +++++++++++++++++ src/profile-manager.h | 5 ++++- 2 files changed, 21 insertions(+), 1 deletion(-) 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 -- 2.30.2