diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llbadge.cpp | 12 | ||||
-rw-r--r-- | indra/llui/llbadge.h | 3 | ||||
-rw-r--r-- | indra/llui/llbadgeowner.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llbadgeowner.h | 1 | ||||
-rw-r--r-- | indra/llui/lllineeditor.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llnotifications.h | 2 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 4 | ||||
-rw-r--r-- | indra/llui/lltrans.cpp | 60 | ||||
-rw-r--r-- | indra/llui/lltrans.h | 9 | ||||
-rw-r--r-- | indra/llui/llurlentry.cpp | 11 | ||||
-rw-r--r-- | indra/llui/llurlregistry.cpp | 35 |
11 files changed, 100 insertions, 49 deletions
diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index 42726de0ad..589b75ab5b 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -102,6 +102,7 @@ LLBadge::LLBadge(const LLBadge::Params& p) , mPaddingHoriz(p.padding_horiz) , mPaddingVert(p.padding_vert) , mParentScroller(NULL) + , mDrawAtParentTop(false) { if (mImage.isNull()) { @@ -224,7 +225,7 @@ void LLBadge::draw() { LLView* owner_view = mOwner.get(); - if (owner_view) + if (owner_view && owner_view->isInVisibleChain()) { // // Calculate badge size based on label text @@ -307,7 +308,14 @@ void LLBadge::draw() // Compute y position if (mLocationOffsetVCenter == BADGE_OFFSET_NOT_SPECIFIED) { - badge_center_y = owner_rect.mBottom + owner_rect.getHeight() * mLocationPercentVCenter; + if(mDrawAtParentTop) + { + badge_center_y = owner_rect.mTop - badge_height * 0.5f - 1; + } + else + { + badge_center_y = owner_rect.mBottom + owner_rect.getHeight() * mLocationPercentVCenter; + } } else { diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h index 4b21a71aaa..55f92e6e34 100644 --- a/indra/llui/llbadge.h +++ b/indra/llui/llbadge.h @@ -137,6 +137,8 @@ public: const std::string getLabel() const { return wstring_to_utf8str(mLabel); } void setLabel( const LLStringExplicit& label); + void setDrawAtParentTop(bool draw_at_top) { mDrawAtParentTop = draw_at_top;} + private: LLPointer< LLUIImage > mBorderImage; LLUIColor mBorderColor; @@ -164,6 +166,7 @@ private: F32 mPaddingVert; LLScrollContainer* mParentScroller; + bool mDrawAtParentTop; }; // Build time optimization, generate once in .cpp file diff --git a/indra/llui/llbadgeowner.cpp b/indra/llui/llbadgeowner.cpp index 55e64bb940..0557cd4375 100644 --- a/indra/llui/llbadgeowner.cpp +++ b/indra/llui/llbadgeowner.cpp @@ -64,6 +64,14 @@ void LLBadgeOwner::setBadgeVisibility(bool visible) } } +void LLBadgeOwner::setDrawBadgeAtTop(bool draw_at_top) +{ + if (mBadge) + { + mBadge->setDrawAtParentTop(draw_at_top); + } +} + void LLBadgeOwner::addBadgeToParentHolder() { LLView * owner_view = mBadgeOwnerView.get(); diff --git a/indra/llui/llbadgeowner.h b/indra/llui/llbadgeowner.h index 53c2de95c8..01ed95f3a3 100644 --- a/indra/llui/llbadgeowner.h +++ b/indra/llui/llbadgeowner.h @@ -45,6 +45,7 @@ public: bool hasBadgeHolderParent() const { return mHasBadgeHolderParent; }; void setBadgeVisibility(bool visible); + void setDrawBadgeAtTop(bool draw_at_top); private: diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index becb45fa79..bd6b00d38b 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1630,12 +1630,12 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char) BOOL LLLineEditor::canDoDelete() const { - return ( !mReadOnly && mText.length() > 0 && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) ); + return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) ); } void LLLineEditor::doDelete() { - if (canDoDelete()) + if (canDoDelete() && mText.length() > 0) { // Prepare for possible rollback LLLineEditorRollback rollback( this ); diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index ccdfb90054..1509446920 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -703,7 +703,7 @@ namespace LLNotificationComparators { struct orderByUUID { - bool operator()(LLNotificationPtr lhs, LLNotificationPtr rhs) + bool operator()(LLNotificationPtr lhs, LLNotificationPtr rhs) const { return lhs->id() < rhs->id(); } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 7c1f4a4dca..212e27477b 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1964,6 +1964,10 @@ BOOL LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask) LLScrollListCell* cellp = item->getColumn(column_index); cellp->setValue(item_value); cellp->onCommit(); + if (mLastSelected == NULL) + { + break; + } } } //FIXME: find a better way to signal cell changes diff --git a/indra/llui/lltrans.cpp b/indra/llui/lltrans.cpp index 4d4ff4236d..a1a8feedaa 100644 --- a/indra/llui/lltrans.cpp +++ b/indra/llui/lltrans.cpp @@ -36,6 +36,7 @@ #include <map> LLTrans::template_map_t LLTrans::sStringTemplates; +LLTrans::template_map_t LLTrans::sDefaultStringTemplates; LLStringUtil::format_map_t LLTrans::sDefaultArgs; struct StringDef : public LLInitParam::Block<StringDef> @@ -76,7 +77,7 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& defa LL_ERRS() << "Problem reading strings: " << xml_filename << LL_ENDL; return false; } - + static bool default_strings_init = false; sStringTemplates.clear(); sDefaultArgs.clear(); @@ -86,7 +87,10 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& defa { LLTransTemplate xml_template(it->name, it->value); sStringTemplates[xml_template.mName] = xml_template; - + if (!default_strings_init) + { + sDefaultStringTemplates[xml_template.mName] = xml_template; + } std::set<std::string>::const_iterator iter = default_args.find(xml_template.mName); if (iter != default_args.end()) { @@ -96,6 +100,7 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& defa sDefaultArgs[name] = xml_template.mText; } } + default_strings_init = true; return true; } @@ -138,12 +143,17 @@ bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root) static LLTrace::BlockTimerStatHandle FTM_GET_TRANS("Translate string"); //static -std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args) +std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args, bool def_string) { // Don't care about time as much as call count. Make sure we're not // calling LLTrans::getString() in an inner loop. JC LL_RECORD_BLOCK_TIME(FTM_GET_TRANS); + if (def_string) + { + return getDefString(xml_desc, msg_args); + } + template_map_t::iterator iter = sStringTemplates.find(xml_desc); if (iter != sStringTemplates.end()) { @@ -161,13 +171,38 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil:: } } +//static +std::string LLTrans::getDefString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args) +{ + template_map_t::iterator iter = sDefaultStringTemplates.find(xml_desc); + if (iter != sDefaultStringTemplates.end()) + { + std::string text = iter->second.mText; + LLStringUtil::format_map_t args = sDefaultArgs; + args.insert(msg_args.begin(), msg_args.end()); + LLStringUtil::format(text, args); + + return text; + } + else + { + LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; + return "MissingString(" + xml_desc + ")"; + } +} + //static -std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args) +std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args, bool def_string) { // Don't care about time as much as call count. Make sure we're not // calling LLTrans::getString() in an inner loop. JC LL_RECORD_BLOCK_TIME(FTM_GET_TRANS); + if (def_string) + { + return getDefString(xml_desc, msg_args); + } + template_map_t::iterator iter = sStringTemplates.find(xml_desc); if (iter != sStringTemplates.end()) { @@ -182,6 +217,23 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args } } +//static +std::string LLTrans::getDefString(const std::string &xml_desc, const LLSD& msg_args) +{ + template_map_t::iterator iter = sDefaultStringTemplates.find(xml_desc); + if (iter != sDefaultStringTemplates.end()) + { + std::string text = iter->second.mText; + LLStringUtil::format(text, msg_args); + return text; + } + else + { + LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; + return "MissingString(" + xml_desc + ")"; + } +} + //static bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args) { diff --git a/indra/llui/lltrans.h b/indra/llui/lltrans.h index a47ce94f08..9bd751fc78 100644 --- a/indra/llui/lltrans.h +++ b/indra/llui/lltrans.h @@ -76,8 +76,10 @@ public: * @param args A list of substrings to replace in the string * @returns Translated string */ - static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args); - static std::string getString(const std::string &xml_desc, const LLSD& args); + static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false); + static std::string getDefString(const std::string &xml_desc, const LLStringUtil::format_map_t& args); + static std::string getString(const std::string &xml_desc, const LLSD& args, bool def_string = false); + static std::string getDefString(const std::string &xml_desc, const LLSD& args); static bool findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& args); static bool findString(std::string &result, const std::string &xml_desc, const LLSD& args); @@ -92,7 +94,7 @@ public: * @param xml_desc String's description * @returns Translated string */ - static std::string getString(const std::string &xml_desc) + static std::string getString(const std::string &xml_desc, bool def_string = false) { LLStringUtil::format_map_t empty; return getString(xml_desc, empty); @@ -128,6 +130,7 @@ public: private: typedef std::map<std::string, LLTransTemplate > template_map_t; static template_map_t sStringTemplates; + static template_map_t sDefaultStringTemplates; static LLStringUtil::format_map_t sDefaultArgs; }; diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index a4243ebfa1..a4dc5bcde1 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -190,31 +190,32 @@ bool LLUrlEntryBase::isWikiLinkCorrect(std::string url) std::string LLUrlEntryBase::urlToLabelWithGreyQuery(const std::string &url) const { - LLUriParser up(unescapeUrl(url)); + LLUriParser up(escapeUrl(url)); up.normalize(); std::string label; up.extractParts(); up.glueFirst(label); - return label; + return unescapeUrl(label); } std::string LLUrlEntryBase::urlToGreyQuery(const std::string &url) const { - LLUriParser up(unescapeUrl(url)); + std::string escaped_url = escapeUrl(url); + LLUriParser up(escaped_url); std::string label; up.extractParts(); up.glueFirst(label, false); - size_t pos = url.find(label); + size_t pos = escaped_url.find(label); if (pos == std::string::npos) { return ""; } pos += label.size(); - return url.substr(pos); + return unescapeUrl(escaped_url.substr(pos)); } diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index fa6593267a..ba6fa1e2e9 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -212,7 +212,7 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL } } } - + // did we find a match? if so, return its details in the match object if (match_entry) { @@ -223,33 +223,6 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL // fill in the LLUrlMatch object and return it std::string url = text.substr(match_start, match_end - match_start + 1); - LLUrlEntryBase *stripped_entry = NULL; - if((match_entry != mUrlEntryNoLink) && (match_entry != mUrlEntryHTTPLabel) && (match_entry !=mUrlEntrySLLabel) - && LLStringUtil::containsNonprintable(url)) - { - LLStringUtil::stripNonprintable(url); - - std::vector<LLUrlEntryBase *>::iterator iter; - for (iter = mUrlEntry.begin(); iter != mUrlEntry.end(); ++iter) - { - LLUrlEntryBase *url_entry = *iter; - U32 start = 0, end = 0; - if (matchRegex(url.c_str(), url_entry->getPattern(), start, end)) - { - if (mLLUrlEntryInvalidSLURL == *iter) - { - if(url_entry && url_entry->isSLURLvalid(url)) - { - continue; - } - } - stripped_entry = url_entry; - break; - } - } - } - - if (match_entry == mUrlEntryTrusted) { LLUriParser up(url); @@ -257,12 +230,10 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL url = up.normalizedUri(); } - std::string url_label = stripped_entry? stripped_entry->getLabel(url, cb) : match_entry->getLabel(url, cb); - std::string url_query = stripped_entry? stripped_entry->getQuery(url) : match_entry->getQuery(url); match.setValues(match_start, match_end, match_entry->getUrl(url), - url_label, - url_query, + match_entry->getLabel(url, cb), + match_entry->getQuery(url), match_entry->getTooltip(url), match_entry->getIcon(url), match_entry->getStyle(), |