diff options
author | Andrey Lihatskiy <andreylproductengine@lindenlab.com> | 2018-06-22 12:55:19 +0300 |
---|---|---|
committer | Andrey Lihatskiy <andreylproductengine@lindenlab.com> | 2018-06-22 12:55:19 +0300 |
commit | 5f432147e373c3223ac06797ecff147d447ed79f (patch) | |
tree | 942f163ad33ad3997aee3000cae321f5f693ad57 /indra/llui | |
parent | 99d9befb629c97f7c778c8a9ddfb9d0060d54de9 (diff) | |
parent | dc07de2f4a4c49d1877bf743b6f0d209392f6eb6 (diff) |
Merged lindenlab/viewer-release into default
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llbadge.cpp | 10 | ||||
-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/llcombobox.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llcombobox.h | 1 | ||||
-rw-r--r-- | indra/llui/lllineeditor.cpp | 9 | ||||
-rw-r--r-- | indra/llui/lllineeditor.h | 2 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 4 | ||||
-rw-r--r-- | indra/llui/lltexteditor.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 | 5 | ||||
-rw-r--r-- | indra/llui/llurlentry.h | 1 | ||||
-rw-r--r-- | indra/llui/llviewereventrecorder.cpp | 4 |
15 files changed, 113 insertions, 16 deletions
diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index 15b6899d74..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()) { @@ -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/llcombobox.cpp b/indra/llui/llcombobox.cpp index 559895da1a..00a933a0bb 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -845,6 +845,14 @@ void LLComboBox::setTextEntry(const LLStringExplicit& text) } } +void LLComboBox::setKeystrokeOnEsc(BOOL enable) +{ + if (mTextEntry) + { + mTextEntry->setKeystrokeOnEsc(enable); + } +} + void LLComboBox::onTextEntry(LLLineEditor* line_editor) { if (mTextEntryCallback != NULL) diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index c9b1212b70..7d38c051a5 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -126,6 +126,7 @@ public: virtual LLSD getValue() const; void setTextEntry(const LLStringExplicit& text); + void setKeystrokeOnEsc(BOOL enable); LLScrollListItem* add(const std::string& name, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); // add item "name" to menu LLScrollListItem* add(const std::string& name, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index becb45fa79..cfab6b7fc8 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -125,6 +125,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mTextLeftEdge(0), // computed in updateTextPadding() below mTextRightEdge(0), // computed in updateTextPadding() below mCommitOnFocusLost( p.commit_on_focus_lost ), + mKeystrokeOnEsc(FALSE), mRevertOnEsc( p.revert_on_esc ), mKeystrokeCallback( p.keystroke_callback() ), mIsSelecting( FALSE ), @@ -1494,6 +1495,10 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) { setText(mPrevText); // Note, don't set handled, still want to loose focus (won't commit becase text is now unchanged) + if (mKeystrokeOnEsc) + { + onKeystroke(); + } } break; @@ -1630,12 +1635,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/lllineeditor.h b/indra/llui/lllineeditor.h index 88468503df..287837a15c 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -214,6 +214,7 @@ public: void setCommitOnFocusLost( BOOL b ) { mCommitOnFocusLost = b; } void setRevertOnEsc( BOOL b ) { mRevertOnEsc = b; } + void setKeystrokeOnEsc(BOOL b) { mKeystrokeOnEsc = b; } void setCursorColor(const LLColor4& c) { mCursorColor = c; } const LLColor4& getCursorColor() const { return mCursorColor.get(); } @@ -338,6 +339,7 @@ protected: BOOL mCommitOnFocusLost; BOOL mRevertOnEsc; + BOOL mKeystrokeOnEsc; keystroke_callback_t mKeystrokeCallback; 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/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 1a49b94c23..134b76c720 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2493,11 +2493,11 @@ void LLTextEditor::updateLinkSegments() } } } - + // if the link's label (what the user can edit) is a valid Url, // then update the link's HREF to be the same as the label text. // This lets users edit Urls in-place. - if (LLUrlRegistry::instance().hasUrl(url_label)) + if (acceptsTextInput() && LLUrlRegistry::instance().hasUrl(url_label)) { std::string new_url = wstring_to_utf8str(url_label); LLStringUtil::trim(new_url); 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 a4dc5bcde1..cd9b52d164 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -298,7 +298,7 @@ std::string LLUrlEntryHTTPLabel::getUrl(const std::string &string) const LLUrlEntryInvalidSLURL::LLUrlEntryInvalidSLURL() : LLUrlEntryBase() { - mPattern = boost::regex("(http://(maps.secondlife.com|slurl.com)/secondlife/|secondlife://(/app/(worldmap|teleport)/)?)[^ /]+(/-?[0-9]+){1,3}(/?(\\?title|\\?img|\\?msg)=\\S*)?/?", + mPattern = boost::regex("(https?://(maps.secondlife.com|slurl.com)/secondlife/|secondlife://(/app/(worldmap|teleport)/)?)[^ /]+(/-?[0-9]+){1,3}(/?(\\?title|\\?img|\\?msg)=\\S*)?/?", boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_http.xml"; mTooltip = LLTrans::getString("TooltipHttpUrl"); @@ -385,8 +385,9 @@ bool LLUrlEntryInvalidSLURL::isSLURLvalid(const std::string &url) const LLUrlEntrySLURL::LLUrlEntrySLURL() { // see http://slurl.com/about.php for details on the SLURL format - mPattern = boost::regex("http://(maps.secondlife.com|slurl.com)/secondlife/[^ /]+(/\\d+){0,3}(/?(\\?title|\\?img|\\?msg)=\\S*)?/?", + mPattern = boost::regex("https?://(maps.secondlife.com|slurl.com)/secondlife/[^ /]+(/\\d+){0,3}(/?(\\?title|\\?img|\\?msg)=\\S*)?/?", boost::regex::perl|boost::regex::icase); + mIcon = "Hand"; mMenuName = "menu_url_slurl.xml"; mTooltip = LLTrans::getString("TooltipSLURL"); } diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 28e9931718..78c149d9fd 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -175,6 +175,7 @@ class LLUrlEntrySLURL : public LLUrlEntryBase { public: LLUrlEntrySLURL(); + /*virtual*/ bool isTrusted() const { return true; } /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); /*virtual*/ std::string getLocation(const std::string &url) const; }; diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp index 9fe6a542b4..8754cfebbb 100644 --- a/indra/llui/llviewereventrecorder.cpp +++ b/indra/llui/llviewereventrecorder.cpp @@ -34,11 +34,11 @@ LLViewerEventRecorder::LLViewerEventRecorder() { logEvents = false; // Remove any previous event log file std::string old_log_ui_events_to_llsd_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "SecondLife_Events_log.old"); - LLFile::remove(old_log_ui_events_to_llsd_file); + LLFile::remove(old_log_ui_events_to_llsd_file, ENOENT); mLogFilename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "SecondLife_Events_log.llsd"); - LLFile::rename(mLogFilename, old_log_ui_events_to_llsd_file); + LLFile::rename(mLogFilename, old_log_ui_events_to_llsd_file, ENOENT); } |