summaryrefslogtreecommitdiff
path: root/indra/newview/llbottomtray.cpp
diff options
context:
space:
mode:
authorMike Antipov <mantipov@productengine.com>2010-03-30 17:42:05 +0300
committerMike Antipov <mantipov@productengine.com>2010-03-30 17:42:05 +0300
commit67a7112a7cfae8633cfd903e24cec8b003a3cee9 (patch)
tree763f50638a9ba48924705b6f912a543f75a3cd27 /indra/newview/llbottomtray.cpp
parentc73dcb079991bad12458386274cec409013ad76b (diff)
Completed normal task EXT-3397 (Hide well buttons if there are no active IM sessions and unresolved notifications)
* Implemented hiding of bottom tray's wells if there are no active IMs or unresolved notifications (via LLBottomTray::notifyParent) * Also refactored initializing code to init a pointer to a chiclet panel and map with bottomtray parts in postBuild BEFORE initializing start wells' visibility. For now minimal viewer width when all buttons are still visible (and have non-truncated labels in the 'EN' locale) with opened sidetray is 1041 px; with short Speak button (without text label) is 990 px. (with implemented patch in https://codereview.productengine.com/secondlife/r/126/) Each well button takes 37 px (with a padding). So, they can free up to 74 px when invisible. reviewed by Vadim at https://codereview.productengine.com/secondlife/r/136/ --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llbottomtray.cpp')
-rw-r--r--indra/newview/llbottomtray.cpp62
1 files changed, 56 insertions, 6 deletions
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 34cb6fd2eb..41bee540fc 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -160,10 +160,6 @@ LLBottomTray::LLBottomTray(const LLSD&)
LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml");
- mChicletPanel = getChild<LLChicletPanel>("chiclet_list");
-
- mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1));
-
LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraPresets, _2));
//this is to fix a crash that occurs because LLBottomTray is a singleton
@@ -171,8 +167,6 @@ LLBottomTray::LLBottomTray(const LLSD&)
//destroyed LLBottomTray requires some subsystems that are long gone
//LLUI::getRootView()->addChild(this);
- initStateProcessedObjectMap();
-
// Necessary for focus movement among child controls
setFocusRoot(TRUE);
@@ -371,6 +365,23 @@ void LLBottomTray::setVisible(BOOL visible)
gFloaterView->setSnapOffsetBottom(0);
}
+S32 LLBottomTray::notifyParent(const LLSD& info)
+{
+ if(info.has("well_empty")) // implementation of EXT-3397
+ {
+ const std::string chiclet_name = info["well_name"];
+
+ // only "im_well" or "notification_well" names are expected.
+ // They are set in panel_bottomtray.xml in <chiclet_im_well> & <chiclet_notification>
+ llassert("im_well" == chiclet_name || "notification_well" == chiclet_name);
+
+ BOOL should_be_visible = !info["well_empty"];
+ showWellButton("im_well" == chiclet_name ? RS_IM_WELL : RS_NOTIFICATION_WELL, should_be_visible);
+ return 1;
+ }
+ return LLPanel::notifyParent(info);
+}
+
void LLBottomTray::showBottomTrayContextMenu(S32 x, S32 y, MASK mask)
{
// We should show BottomTrayContextMenu in last turn
@@ -487,6 +498,15 @@ BOOL LLBottomTray::postBuild()
mNearbyChatBar->getChatBox()->setContextMenu(NULL);
+ mChicletPanel = getChild<LLChicletPanel>("chiclet_list");
+ mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1));
+
+ initStateProcessedObjectMap();
+
+ // update wells visibility:
+ showWellButton(RS_IM_WELL, !LLIMWellWindow::getInstance()->isWindowEmpty());
+ showWellButton(RS_NOTIFICATION_WELL, !LLNotificationWellWindow::getInstance()->isWindowEmpty());
+
return TRUE;
}
@@ -855,6 +875,7 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* available_width)
{
lldebugs << "Trying to show object type: " << shown_object_type << llendl;
+ llassert(mStateProcessedObjectMap[shown_object_type] != NULL);
LLPanel* panel = mStateProcessedObjectMap[shown_object_type];
if (NULL == panel)
@@ -886,6 +907,7 @@ bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* availa
void LLBottomTray::processHideButton(EResizeState processed_object_type, S32* required_width, S32* buttons_freed_width)
{
lldebugs << "Trying to hide object type: " << processed_object_type << llendl;
+ llassert(mStateProcessedObjectMap[processed_object_type] != NULL);
LLPanel* panel = mStateProcessedObjectMap[processed_object_type];
if (NULL == panel)
@@ -963,6 +985,7 @@ void LLBottomTray::processShrinkButtons(S32* required_width, S32* buttons_freed_
void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32* required_width)
{
+ llassert(mStateProcessedObjectMap[processed_object_type] != NULL);
LLPanel* panel = mStateProcessedObjectMap[processed_object_type];
if (NULL == panel)
{
@@ -1046,6 +1069,7 @@ void LLBottomTray::processExtendButtons(S32* available_width)
void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32* available_width)
{
+ llassert(mStateProcessedObjectMap[processed_object_type] != NULL);
LLPanel* panel = mStateProcessedObjectMap[processed_object_type];
if (NULL == panel)
{
@@ -1126,6 +1150,7 @@ void LLBottomTray::initStateProcessedObjectMap()
void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool visible)
{
+ llassert(mStateProcessedObjectMap[shown_object_type] != NULL);
LLPanel* panel = mStateProcessedObjectMap[shown_object_type];
if (NULL == panel)
{
@@ -1264,4 +1289,29 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible
return is_set;
}
+void LLBottomTray::showWellButton(EResizeState object_type, bool visible)
+{
+ llassert( ((RS_NOTIFICATION_WELL | RS_IM_WELL) & object_type) == object_type );
+
+ const std::string panel_name = RS_IM_WELL == object_type ? "im_well_panel" : "notification_well_panel";
+
+ LLView * panel = getChild<LLView>(panel_name);
+
+ // if necessary visibility is set nothing to do here
+ if (panel->getVisible() == (BOOL)visible) return;
+
+ S32 panel_width = panel->getRect().getWidth();
+ panel->setVisible(visible);
+
+ if (visible)
+ {
+ // method assumes that input param is a negative value
+ processWidthDecreased(-panel_width);
+ }
+ else
+ {
+ processWidthIncreased(panel_width);
+ }
+}
+
//EOF