diff options
-rw-r--r-- | indra/newview/llbottomtray.cpp | 62 | ||||
-rw-r--r-- | indra/newview/llbottomtray.h | 13 | ||||
-rw-r--r-- | indra/newview/llchiclet.cpp | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_bottomtray.xml | 31 |
4 files changed, 78 insertions, 33 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 diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h index 18c14e5e19..3c45777645 100644 --- a/indra/newview/llbottomtray.h +++ b/indra/newview/llbottomtray.h @@ -83,6 +83,8 @@ public: virtual void setVisible(BOOL visible); + /*virtual*/ S32 notifyParent(const LLSD& info); + // Implements LLVoiceClientStatusObserver::onChange() to enable the speak // button when voice is available /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal); @@ -116,6 +118,8 @@ private: , RS_BUTTON_MOVEMENT = 0x0010 , RS_BUTTON_GESTURES = 0x0020 , RS_BUTTON_SPEAK = 0x0040 + , RS_IM_WELL = 0x0080 + , RS_NOTIFICATION_WELL = 0x0100 /** * Specifies buttons which can be hidden when bottom tray is shrunk. @@ -184,6 +188,15 @@ private: */ bool setVisibleAndFitWidths(EResizeState object_type, bool visible); + /** + * Shows/hides panel with specified well button (IM or Notification) + * + * @param[in] object_type - type of well button to be processed. + * Must be one of RS_IM_WELL or RS_NOTIFICATION_WELL. + * @param[in] visible - flag specified whether button should be shown or hidden. + */ + void showWellButton(EResizeState object_type, bool visible); + MASK mResizeState; typedef std::map<EResizeState, LLPanel*> state_object_map_t; diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 1f92686a43..e39384b7b2 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -229,6 +229,11 @@ void LLSysWellChiclet::setNewMessagesState(bool new_messages) void LLSysWellChiclet::updateWidget(bool is_window_empty) { mButton->setEnabled(!is_window_empty); + + LLSD params; + params["well_empty"] = is_window_empty; + params["well_name"] = getName(); + notifyParent(params); } // virtual BOOL LLSysWellChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml index b6d7bf8dd0..c34a367c32 100644 --- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml @@ -339,8 +339,8 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly. min_height="28" top="0" name="im_well_panel" - width="35" - min_width="35" + width="37" + min_width="37" user_resize="false"> <chiclet_im_well max_displayed_count="99" @@ -388,22 +388,10 @@ image_pressed_selected "Lit" + "Selected" - there are new messages and the Well layout="topleft" min_height="28" top="0" - left_pad="3" name="notification_well_panel" - width="40" - min_width="40" + width="37" + min_width="37" user_resize="false"> - <icon - auto_resize="false" - color="0 0 0 0" - follows="left|right" - height="10" - image_name="spacer24.tga" - layout="topleft" - left="0" - min_width="4" - top="0" - width="5" /> <chiclet_notification flash_period="0.25" follows="right" @@ -434,17 +422,6 @@ image_pressed_selected "Lit" + "Selected" - there are new messages and the Well function="Button.SetDockableFloaterToggle" parameter="notification_well_window" /> </button> - <icon - auto_resize="false" - color="0 0 0 0" - follows="left|right" - height="10" - image_name="spacer24.tga" - layout="topleft" - left="0" - min_width="4" - top="0" - width="5" /> </chiclet_notification> </layout_panel> </layout_stack> |