Added LLMediaCtrl rightclick context menu. Also added some v3-esque xml handling for menus (*.on_visible, *.on_enable, *.on_click).
This commit is contained in:
@@ -1928,6 +1928,7 @@ LLXMLNodePtr LLMenuGL::getXML(bool save_children) const
|
||||
|
||||
void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory *factory)
|
||||
{
|
||||
std::string name(child->getName()->mString);
|
||||
if (child->hasName(LL_MENU_GL_TAG))
|
||||
{
|
||||
// SUBMENU
|
||||
@@ -2025,7 +2026,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory
|
||||
|
||||
for (call_child = child->getFirstChild(); call_child.notNull(); call_child = call_child->getNextSibling())
|
||||
{
|
||||
if (call_child->hasName("on_check"))
|
||||
if (call_child->hasName("on_check") || call_child->hasName(name+".on_check"))
|
||||
{
|
||||
std::string callback_name;
|
||||
std::string control_name;
|
||||
@@ -2083,7 +2084,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory
|
||||
|
||||
for (call_child = child->getFirstChild(); call_child.notNull(); call_child = call_child->getNextSibling())
|
||||
{
|
||||
if (call_child->hasName("on_click"))
|
||||
if (call_child->hasName("on_click") || call_child->hasName(name+".on_click"))
|
||||
{
|
||||
std::string callback_name;
|
||||
call_child->getAttributeString("function", callback_name);
|
||||
@@ -2104,7 +2105,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory
|
||||
|
||||
new_item->addListener(callback, "on_click", callback_data);
|
||||
}
|
||||
if (call_child->hasName("on_enable"))
|
||||
if (call_child->hasName("on_enable") || call_child->hasName(name+".on_enable"))
|
||||
{
|
||||
std::string callback_name;
|
||||
std::string control_name;
|
||||
@@ -2148,7 +2149,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory
|
||||
}
|
||||
new_item->setEnabledControl(control_name, parent);
|
||||
}
|
||||
if (call_child->hasName("on_visible"))
|
||||
if (call_child->hasName("on_visible") || call_child->hasName(name+".on_visible"))
|
||||
{
|
||||
std::string callback_name;
|
||||
std::string control_name;
|
||||
@@ -2322,7 +2323,7 @@ LLView* LLMenuGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa
|
||||
++token_count;
|
||||
}
|
||||
|
||||
BOOL opaque = FALSE;
|
||||
BOOL opaque = TRUE;
|
||||
node->getAttributeBOOL("opaque", opaque);
|
||||
|
||||
LLMenuGL *menu = new LLMenuGL(name, new_menu_label);
|
||||
|
||||
@@ -102,7 +102,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
|
||||
mHomePageMimeType(p.initial_mime_type),
|
||||
mErrorPageURL(p.error_page_url),
|
||||
mTrusted(p.trusted_content),
|
||||
mHoverTextChanged(false)
|
||||
mHoverTextChanged(false),
|
||||
mContextMenu()
|
||||
{
|
||||
{
|
||||
LLColor4 color = p.caret_color().get();
|
||||
@@ -308,6 +309,14 @@ BOOL LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask )
|
||||
setFocus( TRUE );
|
||||
}
|
||||
|
||||
LLMenuGL* menu = (LLMenuGL*)mContextMenu.get();
|
||||
if (menu)
|
||||
{
|
||||
menu->buildDrawLabels();
|
||||
menu->updateParent(LLMenuGL::sMenuContainer);
|
||||
LLMenuGL::showPopup(this,menu, x, y);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -370,6 +379,12 @@ void LLMediaCtrl::onFocusLost()
|
||||
//
|
||||
BOOL LLMediaCtrl::postBuild ()
|
||||
{
|
||||
LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_media_ctrl.xml",LLMenuGL::sMenuContainer);
|
||||
if(menu)
|
||||
{
|
||||
mContextMenu = menu->getHandle();
|
||||
}
|
||||
|
||||
setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChange, this, _2));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -209,6 +209,7 @@ public:
|
||||
viewer_media_t mMediaSource;
|
||||
S32 mTextureWidth,
|
||||
mTextureHeight;
|
||||
LLHandle<LLView> mContextMenu;
|
||||
};
|
||||
|
||||
#endif // LL_LLMediaCtrl_H
|
||||
|
||||
31
indra/newview/skins/default/xui/en-us/menu_media_ctrl.xml
Normal file
31
indra/newview/skins/default/xui/en-us/menu_media_ctrl.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<menu
|
||||
name="media ctrl context menu">
|
||||
<menu_item_call
|
||||
label="Cut"
|
||||
layout="topleft"
|
||||
name="Cut">
|
||||
<menu_item_call.on_click
|
||||
function="Edit.Cut" />
|
||||
<menu_item_call.on_enable
|
||||
function="Edit.EnableCut" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="Copy"
|
||||
layout="topleft"
|
||||
name="Copy">
|
||||
<menu_item_call.on_click
|
||||
function="Edit.Copy" />
|
||||
<menu_item_call.on_enable
|
||||
function="Edit.EnableCopy" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="Paste"
|
||||
layout="topleft"
|
||||
name="Paste">
|
||||
<menu_item_call.on_click
|
||||
function="Edit.Paste" />
|
||||
<menu_item_call.on_enable
|
||||
function="Edit.EnablePaste" />
|
||||
</menu_item_call>
|
||||
</menu>
|
||||
6
indra/newview/skins/default/xui/es/menu_media_ctrl.xml
Normal file
6
indra/newview/skins/default/xui/es/menu_media_ctrl.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<menu name="media ctrl context menu">
|
||||
<menu_item_call label="Cortar" name="Cut"/>
|
||||
<menu_item_call label="Copiar" name="Copy"/>
|
||||
<menu_item_call label="Pegar" name="Paste"/>
|
||||
</menu>
|
||||
6
indra/newview/skins/default/xui/fr/menu_media_ctrl.xml
Normal file
6
indra/newview/skins/default/xui/fr/menu_media_ctrl.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<menu name="media ctrl context menu">
|
||||
<menu_item_call label="Couper" name="Cut"/>
|
||||
<menu_item_call label="Copier" name="Copy"/>
|
||||
<menu_item_call label="Coller" name="Paste"/>
|
||||
</menu>
|
||||
6
indra/newview/skins/default/xui/pt/menu_media_ctrl.xml
Normal file
6
indra/newview/skins/default/xui/pt/menu_media_ctrl.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<menu name="media ctrl context menu">
|
||||
<menu_item_call label="Cortar" name="Cut"/>
|
||||
<menu_item_call label="Cortar" name="Copy"/>
|
||||
<menu_item_call label="Colar" name="Paste"/>
|
||||
</menu>
|
||||
Reference in New Issue
Block a user