diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index b6279a468..9916c9465 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -178,18 +178,9 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect, sImage = LLUI::getUIImage("sm_rounded_corners_simple.tga"); } mImage = sImage; + // make the popup menu available - //LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_texteditor.xml", parent_view); - LLMenuGL* menu = new LLMenuGL("wot"); - /*if (!menu) - { - menu = new LLMenuGL(LLStringUtil::null); - }*/ - menu->addChild(new LLMenuItemCallGL("Cut", context_cut, NULL, this)); - menu->addChild(new LLMenuItemCallGL("Copy", context_copy, NULL, this)); - menu->addChild(new LLMenuItemCallGL("Paste", context_paste, NULL, this)); - menu->addChild(new LLMenuItemCallGL("Delete", context_delete, NULL, this)); - menu->addChild(new LLMenuItemCallGL("Select All", context_selectall, NULL, this)); + LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_texteditor.xml", LLMenuGL::sMenuContainer); menu->addSeparator(); //menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); menu->setCanTearOff(FALSE); @@ -452,18 +443,6 @@ void LLLineEditor::deselect() } -void LLLineEditor::context_cut(void* data) -{ - LLLineEditor* line = (LLLineEditor*)data; - if(line)line->cut(); -} -void LLLineEditor::context_copy(void* data) -{ - LLLineEditor* line = (LLLineEditor*)data; - if(line)line->copy(); -} - - void LLLineEditor::spell_correct(void* data) { SpellMenuBind* tempBind = (SpellMenuBind*)data; @@ -545,25 +524,6 @@ void LLLineEditor::spell_add(void* data) } } - -void LLLineEditor::context_paste(void* data) -{ - LLLineEditor* line = (LLLineEditor*)data; - if(line)line->paste(); -} - -void LLLineEditor::context_delete(void* data) -{ - LLLineEditor* line = (LLLineEditor*)data; - if(line)line->doDelete(); -} - -void LLLineEditor::context_selectall(void* data) -{ - LLLineEditor* line = (LLLineEditor*)data; - if(line)line->selectAll(); -} - void LLLineEditor::startSelection() { mIsSelecting = TRUE; @@ -3113,7 +3073,6 @@ void LLLineEditor::showContextMenu(S32 x, S32 y) tempStruct->wordPositionStart=wordStart; LLMenuItemCallGL * suggMenuItem = new LLMenuItemCallGL( tempStruct->word, spell_correct, NULL, tempStruct); - //new LLMenuItemCallGL("Select All", context_selectall, NULL, this)); tempStruct->menuItem = suggMenuItem; suggestionMenuItems.push_back(tempStruct); menu->addChild(suggMenuItem); diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 23cb6333a..c6712b7cf 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -137,11 +137,6 @@ public: virtual void deselect(); virtual BOOL canDeselect() const; - static void context_cut(void* data); - static void context_copy(void* data); - static void context_paste(void* data); - static void context_delete(void* data); - static void context_selectall(void* data); static void spell_correct(void* data); static void spell_show(void* data); static void spell_add(void* data); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 2e1c70baf..d58249de0 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -397,18 +397,20 @@ static LLTextEditor* get_focused_text_editor() return te; } -class ContextText : public LLMemberListener +class CopyRawText : public LLMemberListener { bool handleEvent(LLPointer, const LLSD& userdata) override { - auto text = get_focused_text_editor(); - const auto& op = userdata.asStringRef(); - if (op == "Cut") text->cut(); - else if (op == "Copy") text->copy(); - else if (op == "CopyRaw") text->copyRaw(); - else if (op == "Paste") text->paste(); - else if (op == "Delete") text->doDelete(); - else if (op == "SelectAll") text->selectAll(); + get_focused_text_editor()->copyRaw(); + return true; + } +}; + +class TextEditorVisible : public LLMemberListener +{ + bool handleEvent(LLPointer, const LLSD& userdata) override + { + LLMenuGL::sMenuContainer->findControl(userdata["control"].asString())->setValue(!!dynamic_cast(gFocusMgr.getKeyboardFocus())); return true; } }; @@ -583,7 +585,8 @@ void LLTextEditor::spell_add(void* data) //static void LLTextEditor::addMenuListeners(ext_slurl_cb cb, ext_slurl_visible_cb vcb) { - (new ContextText)->registerListener(LLMenuGL::sMenuContainer, "Text"); + (new CopyRawText)->registerListener(LLMenuGL::sMenuContainer, "CopyRawText"); + (new TextEditorVisible)->registerListener(LLMenuGL::sMenuContainer, "TextEditorVisible"); (new ContextUrl)->registerListener(LLMenuGL::sMenuContainer, "Text.Url"); (new ContextUrlCopy)->registerListener(LLMenuGL::sMenuContainer, "Text.Url.CopyUUID"); (new ContextUrlExt(cb))->registerListener(LLMenuGL::sMenuContainer, "Text.Url.Ext"); diff --git a/indra/newview/skins/default/xui/en-us/menu_texteditor.xml b/indra/newview/skins/default/xui/en-us/menu_texteditor.xml index 425eef2d4..8292d8d91 100644 --- a/indra/newview/skins/default/xui/en-us/menu_texteditor.xml +++ b/indra/newview/skins/default/xui/en-us/menu_texteditor.xml @@ -1,21 +1,26 @@ - + - + + - + + - + + - + + - + + - +