diff options
Diffstat (limited to 'indra/newview/llstylemap.cpp')
-rw-r--r-- | indra/newview/llstylemap.cpp | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/indra/newview/llstylemap.cpp b/indra/newview/llstylemap.cpp index 2d3fb566e0..bc8c353de0 100644 --- a/indra/newview/llstylemap.cpp +++ b/indra/newview/llstylemap.cpp @@ -47,13 +47,13 @@ LLStyleMap::~LLStyleMap() LLStyleMap &LLStyleMap::instance() { - static LLStyleMap mStyleMap; - return mStyleMap; + static LLStyleMap style_map; + return style_map; } // This is similar to the [] accessor except that if the entry doesn't already exist, // then this will create the entry. -const LLStyleSP &LLStyleMap::lookup(const LLUUID &source) +const LLStyleSP &LLStyleMap::lookupAgent(const LLUUID &source) { // Find this style in the map or add it if not. This map holds links to residents' profiles. if (find(source) == end()) @@ -77,6 +77,37 @@ const LLStyleSP &LLStyleMap::lookup(const LLUUID &source) return (*this)[source]; } +// This is similar to lookupAgent for any generic URL encoded style. +const LLStyleSP &LLStyleMap::lookup(const LLUUID& id, const std::string& link) +{ + // Find this style in the map or add it if not. + iterator iter = find(id); + if (iter == end()) + { + LLStyleSP style(new LLStyle); + style->setVisible(true); + style->setFontName(LLStringUtil::null); + if (id != LLUUID::null && !link.empty()) + { + style->setColor(gSavedSettings.getColor4("HTMLLinkColor")); + style->setLinkHREF(link); + } + else + style->setColor(LLColor4::white); + (*this)[id] = style; + } + else + { + LLStyleSP style = (*iter).second; + if ( style->getLinkHREF() != link ) + { + style->setLinkHREF(link); + } + } + + return (*this)[id]; +} + void LLStyleMap::update() { for (style_map_t::iterator iter = begin(); iter != end(); ++iter) |