SL-20139 pressing the Tab key should paste tooltip only when hovering functions in LSL editor
parent
12f18ff461
commit
5430efbb31
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue