From efa0d701845542e9ef555260fe6d2ad0beeb0760 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Fri, 11 Sep 2009 00:33:33 -0700 Subject: Backported clickable object names from 1.23 --- linden/indra/newview/llstylemap.cpp | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'linden/indra/newview/llstylemap.cpp') diff --git a/linden/indra/newview/llstylemap.cpp b/linden/indra/newview/llstylemap.cpp index 6a3415f..e3bd3cd 100644 --- a/linden/indra/newview/llstylemap.cpp +++ b/linden/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) -- cgit v1.1