diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-04-18 23:42:39 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-04-18 23:42:39 +0300 |
commit | ce4c694b66b1e4ed479e5143b10616a76f2da18b (patch) | |
tree | ac4bd223fae0764c2c86e34283871f8cfafdafd8 /indra/llui | |
parent | e33f23f58a2caa561dfe4b3b114786f40983d136 (diff) | |
parent | d031662435d97101411ae990ed85d6e001ab668a (diff) |
Merge branch master (D540) into DRTVWR-546
# Conflicts:
# indra/llcommon/llsdutil.cpp
# indra/newview/VIEWER_VERSION.txt
# indra/newview/lldrawpoolalpha.cpp
# indra/newview/lldrawpoolwater.cpp
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/lllineeditor.cpp | 17 | ||||
-rw-r--r-- | indra/llui/lllineeditor.h | 2 | ||||
-rw-r--r-- | indra/llui/llmenugl.cpp | 52 | ||||
-rw-r--r-- | indra/llui/llmenugl.h | 5 | ||||
-rw-r--r-- | indra/llui/llurlentry.cpp | 18 | ||||
-rw-r--r-- | indra/llui/llurlentry.h | 11 | ||||
-rw-r--r-- | indra/llui/llurlregistry.cpp | 2 |
7 files changed, 98 insertions, 9 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 1badd54fca..33037b5001 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -175,6 +175,14 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mTripleClickTimer.reset(); setText(p.default_text()); + if (p.initial_value.isProvided() + && !p.control_name.isProvided()) + { + // Initial value often is descriptive, like "Type some ID here" + // and can be longer than size limitation, ignore size + setText(p.initial_value.getValue().asString(), false); + } + // Initialize current history line iterator mCurrentHistoryLine = mLineHistory.begin(); @@ -390,6 +398,11 @@ void LLLineEditor::updateTextPadding() void LLLineEditor::setText(const LLStringExplicit &new_text) { + setText(new_text, true); +} + +void LLLineEditor::setText(const LLStringExplicit &new_text, bool use_size_limit) +{ // If new text is identical, don't copy and don't move insertion point if (mText.getString() == new_text) { @@ -407,13 +420,13 @@ void LLLineEditor::setText(const LLStringExplicit &new_text) all_selected = all_selected || (len == 0 && hasFocus() && mSelectAllonFocusReceived); std::string truncated_utf8 = new_text; - if (truncated_utf8.size() > (U32)mMaxLengthBytes) + if (use_size_limit && truncated_utf8.size() > (U32)mMaxLengthBytes) { truncated_utf8 = utf8str_truncate(new_text, mMaxLengthBytes); } mText.assign(truncated_utf8); - if (mMaxLengthChars) + if (use_size_limit && mMaxLengthChars) { mText.assign(utf8str_symbol_truncate(truncated_utf8, mMaxLengthChars)); } diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index f84625bea7..ae4e05c065 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -320,6 +320,8 @@ private: virtual S32 getPreeditFontSize() const; virtual LLWString getPreeditString() const { return getWText(); } + void setText(const LLStringExplicit &new_text, bool use_size_limit); + void setContextMenu(LLContextMenu* new_context_menu); protected: diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index cdaf03ebde..76fd789bec 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -2362,6 +2362,16 @@ void LLMenuGL::arrange( void ) (*item_iter)->setRect( rect ); } } + + + if (getTornOff()) + { + LLTearOffMenu * torn_off_menu = dynamic_cast<LLTearOffMenu*>(getParent()); + if (torn_off_menu) + { + torn_off_menu->updateSize(); + } + } } if (mKeepFixedSize) { @@ -3879,7 +3889,8 @@ void LLMenuHolderGL::setActivatedItem(LLMenuItemGL* item) /// Class LLTearOffMenu ///============================================================================ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) : - LLFloater(LLSD()) + LLFloater(LLSD()), + mQuitRequested(false) { S32 floater_header_size = getHeaderHeight(); @@ -3894,7 +3905,7 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) : LLRect rect; menup->localRectToOtherView(LLRect(-1, menup->getRect().getHeight(), menup->getRect().getWidth() + 3, 0), &rect, gFloaterView); // make sure this floater is big enough for menu - mTargetHeight = (F32)(rect.getHeight() + floater_header_size); + mTargetHeight = rect.getHeight() + floater_header_size; reshape(rect.getWidth(), rect.getHeight()); setRect(rect); @@ -3926,19 +3937,24 @@ LLTearOffMenu::~LLTearOffMenu() void LLTearOffMenu::draw() { mMenu->setBackgroundVisible(isBackgroundOpaque()); - mMenu->needsArrange(); if (getRect().getHeight() != mTargetHeight) { // animate towards target height - reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLSmoothInterpolation::getInterpolant(0.05f)))); + reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), (F32)mTargetHeight, LLSmoothInterpolation::getInterpolant(0.05f)))); + mMenu->needsArrange(); } LLFloater::draw(); } void LLTearOffMenu::onFocusReceived() { - // if nothing is highlighted, just highlight first item + if (mQuitRequested) + { + return; + } + + // if nothing is highlighted, just highlight first item if (!mMenu->getHighlightedItem()) { mMenu->highlightNextItem(NULL); @@ -4014,6 +4030,31 @@ LLTearOffMenu* LLTearOffMenu::create(LLMenuGL* menup) return tearoffp; } +void LLTearOffMenu::updateSize() +{ + if (mMenu) + { + S32 floater_header_size = getHeaderHeight(); + const LLRect &floater_rect = getRect(); + LLRect new_rect; + mMenu->localRectToOtherView(LLRect(-1, mMenu->getRect().getHeight() + floater_header_size, mMenu->getRect().getWidth() + 3, 0), &new_rect, gFloaterView); + + if (floater_rect.getWidth() != new_rect.getWidth() + || mTargetHeight != new_rect.getHeight()) + { + // make sure this floater is big enough for menu + mTargetHeight = new_rect.getHeight(); + reshape(new_rect.getWidth(), mTargetHeight); + + // Restore menu position + LLRect menu_rect = mMenu->getRect(); + menu_rect.setOriginAndSize(1, 1, + menu_rect.getWidth(), menu_rect.getHeight()); + mMenu->setRect(menu_rect); + } + } +} + void LLTearOffMenu::closeTearOff() { removeChild(mMenu); @@ -4024,6 +4065,7 @@ void LLTearOffMenu::closeTearOff() mMenu->setVisible(FALSE); mMenu->setTornOff(FALSE); mMenu->setDropShadowed(TRUE); + mQuitRequested = true; } LLContextMenuBranch::LLContextMenuBranch(const LLContextMenuBranch::Params& p) diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 273bd789c4..abbfd9a24a 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -873,6 +873,8 @@ public: virtual BOOL handleKeyHere(KEY key, MASK mask); virtual void translate(S32 x, S32 y); + void updateSize(); + private: LLTearOffMenu(LLMenuGL* menup); @@ -880,7 +882,8 @@ private: LLView* mOldParent; LLMenuGL* mMenu; - F32 mTargetHeight; + S32 mTargetHeight; + bool mQuitRequested; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 38495e1e0b..1547a4ba5c 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -1017,6 +1017,24 @@ std::string LLUrlEntryObjectIM::getLocation(const std::string &url) const return LLUrlEntryBase::getLocation(url); } +// +// LLUrlEntryChat Describes a Second Life chat Url, e.g., +// secondlife:///app/chat/42/This%20Is%20a%20test +// + +LLUrlEntryChat::LLUrlEntryChat() +{ + mPattern = boost::regex("secondlife:///app/chat/\\d+/\\S+", + boost::regex::perl|boost::regex::icase); + mMenuName = "menu_url_slapp.xml"; + mTooltip = LLTrans::getString("TooltipSLAPP"); +} + +std::string LLUrlEntryChat::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +{ + return unescapeUrl(url); +} + // LLUrlEntryParcel statics. LLUUID LLUrlEntryParcel::sAgentID(LLUUID::null); LLUUID LLUrlEntryParcel::sSessionID(LLUUID::null); diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 102e0a4fd9..63a1506731 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -370,6 +370,17 @@ public: private: }; +// +// LLUrlEntryChat Describes a Second Life chat Url, e.g., +// secondlife:///app/chat/42/This%20Is%20a%20test +// +class LLUrlEntryChat : public LLUrlEntryBase +{ +public: + LLUrlEntryChat(); + /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); +}; + /// /// LLUrlEntryParcel Describes a Second Life parcel Url, e.g., /// secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index bfcd970529..c9d7013a11 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -63,6 +63,7 @@ LLUrlRegistry::LLUrlRegistry() // LLUrlEntryAgent*Name must appear before LLUrlEntryAgent since // LLUrlEntryAgent is a less specific (catchall for agent urls) registerUrl(new LLUrlEntryAgent()); + registerUrl(new LLUrlEntryChat()); registerUrl(new LLUrlEntryGroup()); registerUrl(new LLUrlEntryParcel()); registerUrl(new LLUrlEntryTeleport()); @@ -71,7 +72,6 @@ LLUrlRegistry::LLUrlRegistry() registerUrl(new LLUrlEntryObjectIM()); registerUrl(new LLUrlEntryPlace()); registerUrl(new LLUrlEntryInventory()); - registerUrl(new LLUrlEntryObjectIM()); registerUrl(new LLUrlEntryExperienceProfile()); //LLUrlEntrySL and LLUrlEntrySLLabel have more common pattern, //so it should be registered in the end of list |