From f280c43d616d013747a9aab05141635868e00136 Mon Sep 17 00:00:00 2001 From: James Cook Date: Sat, 28 Nov 2009 16:51:02 -0800 Subject: Use extern template for common singletons to reduce code bloat/link time. --- indra/newview/llbottomtray.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 9cc7b8c785..4823932951 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -46,6 +46,9 @@ #include "llsyswellwindow.h" #include "llfloatercamera.h" +// Build time optimization, generate this once in .cpp file +template class LLBottomTray* LLSingleton::getInstance(); + LLBottomTray::LLBottomTray(const LLSD&) : mChicletPanel(NULL), mSysWell(NULL), -- cgit v1.2.3 From 7d3b3cc474822db144b623980d08b7addc2f77ff Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 30 Nov 2009 14:41:52 -0800 Subject: Linker optimization - use "extern template" for commonly regenerated templates Also replaced many duplicate calls to LLViewerCamera::getInstance() with local pointer. Reviewed with Ambroff --- indra/newview/llbottomtray.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 4823932951..c44b0b5331 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -31,6 +31,8 @@ */ #include "llviewerprecompiledheaders.h" // must be first include + +#define LLBOTTOMTRAY_CPP #include "llbottomtray.h" #include "llagent.h" @@ -46,7 +48,7 @@ #include "llsyswellwindow.h" #include "llfloatercamera.h" -// Build time optimization, generate this once in .cpp file +// Build time optimization, generate extern template once in .cpp file template class LLBottomTray* LLSingleton::getInstance(); LLBottomTray::LLBottomTray(const LLSD&) -- cgit v1.2.3 From eae60da6839906059d904c12cc155f4c2738c893 Mon Sep 17 00:00:00 2001 From: Yuri Chebotarev Date: Wed, 2 Dec 2009 19:37:33 +0200 Subject: fix for EXT-2886 Context menu for Nearby chat text field should look like context menu for any text editor, should include such items as (cut,copy, paste etc) --HG-- branch : product-engine --- indra/newview/llbottomtray.cpp | 93 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 92 insertions(+), 1 deletion(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 9cc7b8c785..10ebd5d8dc 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -45,6 +45,7 @@ #include "llsplitbutton.h" #include "llsyswellwindow.h" #include "llfloatercamera.h" +#include "lltexteditor.h" LLBottomTray::LLBottomTray(const LLSD&) : mChicletPanel(NULL), @@ -254,7 +255,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); @@ -262,6 +265,33 @@ void LLBottomTray::showBottomTrayContextMenu(S32 x, S32 y, MASK mask) } } +void LLBottomTray::updateContextMenu(S32 x, S32 y, MASK mask) +{ + LLUICtrl* edit_box = mNearbyChatBar->getChild("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("NearbyChatBar_Cut"); + if(menu_item) + menu_item->setVisible(in_edit_box); + menu_item = mBottomTrayContextMenu->findChild("NearbyChatBar_Copy"); + if(menu_item) + menu_item->setVisible(in_edit_box); + menu_item = mBottomTrayContextMenu->findChild("NearbyChatBar_Paste"); + if(menu_item) + menu_item->setVisible(in_edit_box); + menu_item = mBottomTrayContextMenu->findChild("NearbyChatBar_Delete"); + if(menu_item) + menu_item->setVisible(in_edit_box); + menu_item = mBottomTrayContextMenu->findChild("NearbyChatBar_Select_All"); + if(menu_item) + menu_item->setVisible(in_edit_box); +} + void LLBottomTray::showGestureButton(BOOL visible) { setTrayButtonVisibleIfPossible(RS_BUTTON_GESTURES, visible); @@ -293,9 +323,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("menu_bottomtray.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); gMenuHolder->addChild(mBottomTrayContextMenu); + mNearbyChatBar = getChild("chat_bar"); mToolbarStack = getChild("toolbar_stack"); mMovementPanel = getChild("movement_panel"); @@ -328,6 +363,62 @@ BOOL LLBottomTray::postBuild() return TRUE; } +bool LLBottomTray::onContextMenuItemEnabled(const LLSD& userdata) +{ + std::string item = userdata.asString(); + LLLineEditor* edit_box = mNearbyChatBar->findChild("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("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; -- cgit v1.2.3 From f2e4e9efa9e133e20861275f84b015690e6080a4 Mon Sep 17 00:00:00 2001 From: Yuri Chebotarev Date: Thu, 3 Dec 2009 16:10:21 +0200 Subject: fix for low EXT-3090 "Select All" item should be disabled if there is no text in nearby chat's input field --HG-- branch : product-engine --- indra/newview/llbottomtray.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 96c06b1665..6d3d61d4fe 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -391,7 +391,7 @@ bool LLBottomTray::onContextMenuItemEnabled(const LLSD& userdata) } else if (item == "can_select_all") { - return edit_box->canSelectAll(); + return edit_box->canSelectAll() && (edit_box->getLength()>0); } return true; } -- cgit v1.2.3 From 22303da8a61e60dd061b5a63f6d023fd1345b59c Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 3 Dec 2009 13:48:07 +0200 Subject: Work on task EXT-3081 (Separate Message Well on Notifications Well and IM Well) Initial commit -- added two floater classes derived from LLSysWellWindow to work with Notification Well & IM Well -- register two floaters in place of previous sys_well (but with the same xml file) -- replace using of LLSysWellWindow with LLNotificationWellWindow in the out code (except of in LLScreenChannel::updateShowToastsState) -- rename member variable in bottom tray used for Notification Well --HG-- branch : product-engine --- indra/newview/llbottomtray.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 6d3d61d4fe..002af391a6 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -54,7 +54,7 @@ template class LLBottomTray* LLSingleton::getInstance(); LLBottomTray::LLBottomTray(const LLSD&) : mChicletPanel(NULL), - mSysWell(NULL), + mNotificationWell(NULL), mSpeakPanel(NULL), mSpeakBtn(NULL), mNearbyChatBar(NULL), @@ -68,11 +68,11 @@ LLBottomTray::LLBottomTray(const LLSD&) LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml"); mChicletPanel = getChild("chiclet_list"); - mSysWell = getChild("sys_well"); + mNotificationWell = getChild("notification_well"); - // init mSysWell + // init mNotificationWell // set handler for a Click operation - mSysWell->setClickCallback(boost::bind(&LLSysWellWindow::onChicletClick, LLFloaterReg::getTypedInstance("syswell_window"))); + mNotificationWell->setClickCallback(boost::bind(&LLNotificationWellWindow::onChicletClick, LLNotificationWellWindow::getInstance())); mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1)); -- cgit v1.2.3 From 653ebfbe7ca53515d6c83f6ba72cbb1d3e2d9daf Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 4 Dec 2009 12:48:08 +0200 Subject: Work on normal task EXT-3081 (Separate Message Well on Notifications Well and IM Well) Refactored toggle interaction between Notification Well and Notification Well Window: -- set "Button.SetDockableFloaterToggle" init callback to Notification Well -- remove deprecated functionality in code -- update interaction with screen channels to work properly. --HG-- branch : product-engine --- indra/newview/llbottomtray.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 002af391a6..d80aa66257 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -70,10 +70,6 @@ LLBottomTray::LLBottomTray(const LLSD&) mChicletPanel = getChild("chiclet_list"); mNotificationWell = getChild("notification_well"); - // init mNotificationWell - // set handler for a Click operation - mNotificationWell->setClickCallback(boost::bind(&LLNotificationWellWindow::onChicletClick, LLNotificationWellWindow::getInstance())); - mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1)); LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraPresets, _2)); -- cgit v1.2.3 From 1acc52a7e781a7931d1fc6bfc2313c49eb6be2a2 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 4 Dec 2009 14:00:52 +0200 Subject: Work on normal task EXT-3081 (Separate Message Well on Notifications Well and IM Well) -- removed member pointer to Notification Well Icon from the LLBottomTray -- placed Well counter over the Icon, made center-aligned --HG-- branch : product-engine --- indra/newview/llbottomtray.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index d80aa66257..8c793873f4 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -54,21 +54,24 @@ template class LLBottomTray* LLSingleton::getInstance(); LLBottomTray::LLBottomTray(const LLSD&) : mChicletPanel(NULL), - mNotificationWell(NULL), mSpeakPanel(NULL), mSpeakBtn(NULL), mNearbyChatBar(NULL), mToolbarStack(NULL) , mMovementButton(NULL) , mResizeState(RS_NORESIZE) -// Add more members +, mBottomTrayContextMenu(NULL) +, mMovementPanel(NULL) +, mCamPanel(NULL) +, mSnapshotPanel(NULL) +, mGesturePanel(NULL) +, mCamButton(NULL) { mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml"); mChicletPanel = getChild("chiclet_list"); - mNotificationWell = getChild("notification_well"); mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1)); -- cgit v1.2.3