summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-08-15 20:38:02 +0300
committerGitHub <noreply@github.com>2023-08-15 20:38:02 +0300
commit5430efbb31cfc0f57eac7fd130bb43aafa85143a (patch)
tree46d44d8ef7efa3f1b2dbd7658f381509ab8c970e /indra/llui
parent12f18ff4614225093f753b16cfd278880eca0387 (diff)
SL-20139 pressing the Tab key should paste tooltip only when hovering functions in LSL editor
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lltextbase.cpp2
-rw-r--r--indra/llui/lltexteditor.cpp3
-rw-r--r--indra/llui/lltooltip.cpp20
-rw-r--r--indra/llui/lltooltip.h8
4 files changed, 26 insertions, 7 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 8732a7ce45..26a38bd541 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -3431,7 +3431,7 @@ BOOL LLNormalTextSegment::handleToolTip(S32 x, S32 y, MASK mask)
if (mToken && !mToken->getToolTip().empty())
{
const LLWString& wmsg = mToken->getToolTip();
- LLToolTipMgr::instance().show(wstring_to_utf8str(wmsg));
+ LLToolTipMgr::instance().show(wstring_to_utf8str(wmsg), (mToken->getType() == LLKeywordToken::TT_FUNCTION));
return TRUE;
}
// or do we have an explicitly set tooltip (e.g., for Urls)
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 3d2a426913..c83ed4c3e1 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -1779,7 +1779,8 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
else
{
if (mEnableTooltipPaste &&
- LLToolTipMgr::instance().toolTipVisible() &&
+ LLToolTipMgr::instance().toolTipVisible() &&
+ LLToolTipMgr::instance().isTooltipPastable() &&
KEY_TAB == key)
{ // Paste the first line of a tooltip into the editor
std::string message;
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index 2f56a8b1d0..c4b132317f 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -154,7 +154,8 @@ LLToolTip::Params::Params()
text_color("text_color"),
time_based_media("time_based_media", false),
web_based_media("web_based_media", false),
- media_playing("media_playing", false)
+ media_playing("media_playing", false),
+ allow_paste_tooltip("allow_paste_tooltip", false)
{
changeDefault(chrome, true);
}
@@ -166,7 +167,8 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
mTextBox(NULL),
mInfoButton(NULL),
mPlayMediaButton(NULL),
- mHomePageButton(NULL)
+ mHomePageButton(NULL),
+ mIsTooltipPastable(p.allow_paste_tooltip)
{
LLTextBox::Params params;
params.name = params.initial_value().asString();
@@ -308,6 +310,8 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p)
mTextBox->reshape(mTextBox->getRect().getWidth(), llmax(mTextBox->getRect().getHeight(), tooltip_rect.getHeight() - 2 * mPadding));
setShape(tooltip_rect);
+
+ mIsTooltipPastable = p.allow_paste_tooltip;
}
void LLToolTip::setVisible(BOOL visible)
@@ -469,9 +473,9 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params)
}
-void LLToolTipMgr::show(const std::string& msg)
+void LLToolTipMgr::show(const std::string& msg, bool allow_paste_tooltip)
{
- show(LLToolTip::Params().message(msg));
+ show(LLToolTip::Params().message(msg).allow_paste_tooltip(allow_paste_tooltip));
}
void LLToolTipMgr::show(const LLToolTip::Params& params)
@@ -612,5 +616,13 @@ void LLToolTipMgr::getToolTipMessage(std::string & message)
}
}
+bool LLToolTipMgr::isTooltipPastable()
+{
+ if (toolTipVisible())
+ {
+ return mToolTip->isTooltipPastable();
+ }
+ return false;
+ }
// EOF
diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h
index 0b1fbe5367..6ff7c0671a 100644
--- a/indra/llui/lltooltip.h
+++ b/indra/llui/lltooltip.h
@@ -91,6 +91,8 @@ public:
padding;
Optional<bool> wrap;
+ Optional<bool> allow_paste_tooltip;
+
Params();
};
/*virtual*/ void draw();
@@ -106,6 +108,7 @@ public:
void initFromParams(const LLToolTip::Params& params);
void getToolTipMessage(std::string & message);
+ bool isTooltipPastable() { return mIsTooltipPastable; }
private:
class LLTextBox* mTextBox;
@@ -117,6 +120,8 @@ private:
LLFrameTimer mVisibleTimer;
bool mHasClickCallback;
S32 mPadding; // pixels
+
+ bool mIsTooltipPastable;
};
// used for the inspector tooltips which need different background images etc.
@@ -134,7 +139,7 @@ class LLToolTipMgr : public LLSingleton<LLToolTipMgr>
public:
void show(const LLToolTip::Params& params);
- void show(const std::string& message);
+ void show(const std::string& message, bool allow_paste_tooltip = false);
void unblockToolTips();
void blockToolTips();
@@ -146,6 +151,7 @@ public:
void updateToolTipVisibility();
void getToolTipMessage(std::string & message);
+ bool isTooltipPastable();
private:
void createToolTip(const LLToolTip::Params& params);