diff options
| -rw-r--r-- | indra/newview/llbottomtray.cpp | 93 | ||||
| -rw-r--r-- | indra/newview/llbottomtray.h | 4 | ||||
| -rw-r--r-- | indra/newview/llpanelgroupnotices.cpp | 3 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_bottomtray.xml | 53 | 
4 files changed, 152 insertions, 1 deletions
| diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index c44b0b5331..96c06b1665 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -47,6 +47,7 @@  #include "llsplitbutton.h"  #include "llsyswellwindow.h"  #include "llfloatercamera.h" +#include "lltexteditor.h"  // Build time optimization, generate extern template once in .cpp file  template class LLBottomTray* LLSingleton<class LLBottomTray>::getInstance(); @@ -259,7 +260,9 @@ void LLBottomTray::showBottomTrayContextMenu(S32 x, S32 y, MASK mask)  	// We should show BottomTrayContextMenu in last  turn  	if (mBottomTrayContextMenu && !LLMenuGL::sMenuContainer->getVisibleMenu())  	{ -		//there are no other context menu (IM chiclet etc ), so we can show BottomTrayContextMenu +		    //there are no other context menu (IM chiclet etc ), so we can show BottomTrayContextMenu + +		    updateContextMenu(x, y, mask);  			mBottomTrayContextMenu->buildDrawLabels();  			mBottomTrayContextMenu->updateParent(LLMenuGL::sMenuContainer);  			LLMenuGL::showPopup(this, mBottomTrayContextMenu, x, y); @@ -267,6 +270,33 @@ void LLBottomTray::showBottomTrayContextMenu(S32 x, S32 y, MASK mask)  	}  } +void LLBottomTray::updateContextMenu(S32 x, S32 y, MASK mask) +{ +	LLUICtrl* edit_box = mNearbyChatBar->getChild<LLUICtrl>("chat_box"); + +	S32 local_x = x - mNearbyChatBar->getRect().mLeft - edit_box->getRect().mLeft; +	S32 local_y = y - mNearbyChatBar->getRect().mBottom - edit_box->getRect().mBottom; + +	bool in_edit_box = edit_box->pointInView(local_x, local_y); + +	LLMenuItemGL* menu_item; +	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Cut"); +	if(menu_item) +		menu_item->setVisible(in_edit_box); +	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Copy"); +	if(menu_item) +		menu_item->setVisible(in_edit_box); +	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Paste"); +	if(menu_item) +		menu_item->setVisible(in_edit_box); +	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Delete"); +	if(menu_item) +		menu_item->setVisible(in_edit_box); +	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Select_All"); +	if(menu_item) +		menu_item->setVisible(in_edit_box); +} +  void LLBottomTray::showGestureButton(BOOL visible)  {  	setTrayButtonVisibleIfPossible(RS_BUTTON_GESTURES, visible); @@ -298,9 +328,14 @@ namespace  BOOL LLBottomTray::postBuild()  { + +	LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("NearbyChatBar.Action", boost::bind(&LLBottomTray::onContextMenuItemClicked, this, _2)); +	LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("NearbyChatBar.EnableMenuItem", boost::bind(&LLBottomTray::onContextMenuItemEnabled, this, _2)); +  	mBottomTrayContextMenu =  LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_bottomtray.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());  	gMenuHolder->addChild(mBottomTrayContextMenu); +  	mNearbyChatBar = getChild<LLNearbyChatBar>("chat_bar");  	mToolbarStack = getChild<LLLayoutStack>("toolbar_stack");  	mMovementPanel = getChild<LLPanel>("movement_panel"); @@ -333,6 +368,62 @@ BOOL LLBottomTray::postBuild()  	return TRUE;  } +bool LLBottomTray::onContextMenuItemEnabled(const LLSD& userdata) +{ +	std::string item = userdata.asString(); +	LLLineEditor* edit_box = mNearbyChatBar->findChild<LLLineEditor>("chat_box"); +	 +	if (item == "can_cut") +	{ +		return edit_box->canCut(); +	} +	else if (item == "can_copy") +	{ +		return edit_box->canCopy(); +	} +	else if (item == "can_paste") +	{ +		return edit_box->canPaste(); +	} +	else if (item == "can_delete") +	{ +		return edit_box->canDoDelete(); +	} +	else if (item == "can_select_all") +	{ +		return edit_box->canSelectAll(); +	} +	return true; +} + + +void LLBottomTray::onContextMenuItemClicked(const LLSD& userdata) +{ +	std::string item = userdata.asString(); +	LLLineEditor* edit_box = mNearbyChatBar->findChild<LLLineEditor>("chat_box"); + +	if (item == "cut") +	{ +		edit_box->cut(); +	} +	else if (item == "copy") +	{ +		edit_box->copy(); +	} +	else if (item == "paste") +	{ +		edit_box->paste(); +	} +	else if (item == "delete") +	{ +		edit_box->doDelete(); +	} +	else if (item == "select_all") +	{ +		edit_box->selectAll(); +	} +} +  void LLBottomTray::log(LLView* panel, const std::string& descr)  {  	if (NULL == panel) return; diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h index 728a420324..91ec01654b 100644 --- a/indra/newview/llbottomtray.h +++ b/indra/newview/llbottomtray.h @@ -179,6 +179,10 @@ protected:  	static void* createNearbyChatBar(void* userdata); +	void updateContextMenu(S32 x, S32 y, MASK mask); +	void onContextMenuItemClicked(const LLSD& userdata); +	bool onContextMenuItemEnabled(const LLSD& userdata); +  	/**  	 * Creates IM Chiclet based on session type (IM chat or Group chat)  	 */ diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index e04c830036..5834c50fbb 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -510,6 +510,9 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)  	S32 i=0;  	S32 count = msg->getNumberOfBlocks("Data"); + +	mNoticesList->setEnabled(TRUE); +  	for (;i<count;++i)  	{  		msg->getUUID("Data","NoticeID",id,i); diff --git a/indra/newview/skins/default/xui/en/menu_bottomtray.xml b/indra/newview/skins/default/xui/en/menu_bottomtray.xml index a7abb223ba..7ef91a1d85 100644 --- a/indra/newview/skins/default/xui/en/menu_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/menu_bottomtray.xml @@ -52,4 +52,57 @@               function="CheckControl"               parameter="ShowSnapshotButton" />      </menu_item_check>         +    <menu_item_separator +     name="Separator" /> +    <menu_item_call +     label="Cut" +     name="NearbyChatBar_Cut"> +        <menu_item_call.on_click +         function="NearbyChatBar.Action" +         parameter="cut" /> +        <menu_item_call.on_enable +         function="NearbyChatBar.EnableMenuItem" +         parameter="can_cut" /> +    </menu_item_call> +    <menu_item_call +     label="Copy" +     name="NearbyChatBar_Copy"> +        <menu_item_call.on_click +         function="NearbyChatBar.Action" +         parameter="copy" /> +        <menu_item_call.on_enable +         function="NearbyChatBar.EnableMenuItem" +         parameter="can_copy" /> +    </menu_item_call> +    <menu_item_call +     label="Paste" +     name="NearbyChatBar_Paste"> +        <menu_item_call.on_click +         function="NearbyChatBar.Action" +         parameter="paste" /> +        <menu_item_call.on_enable +         function="NearbyChatBar.EnableMenuItem" +         parameter="can_paste" /> +    </menu_item_call> +    <menu_item_call +     label="Delete" +     name="NearbyChatBar_Delete"> +        <menu_item_call.on_click +         function="NearbyChatBar.Action" +         parameter="delete" /> +        <menu_item_call.on_enable +         function="NearbyChatBar.EnableMenuItem" +         parameter="can_delete" /> +    </menu_item_call> +    <menu_item_call +     label="Select All" +     name="NearbyChatBar_Select_All"> +        <menu_item_call.on_click +         function="NearbyChatBar.Action" +         parameter="select_all" /> +        <menu_item_call.on_enable +         function="NearbyChatBar.EnableMenuItem" +         parameter="can_select_all" /> +    </menu_item_call> +  </menu> | 
