diff options
author | Bryan O'Sullivan <bos@lindenlab.com> | 2009-09-08 14:49:49 -0700 |
---|---|---|
committer | Bryan O'Sullivan <bos@lindenlab.com> | 2009-09-08 14:49:49 -0700 |
commit | 1018b36b87d0d19e020c1e416c33c76b06125633 (patch) | |
tree | ef111a3f5b634ddc3aa23f6e6c3505142e54261a /indra/newview/llbottomtray.cpp | |
parent | 91aa2f37f409b7755d460c5a8e9c8d6a9a50557c (diff) | |
parent | 76001ce3f0b53391c674f315855017b78a3a2873 (diff) |
Merge
Diffstat (limited to 'indra/newview/llbottomtray.cpp')
-rw-r--r-- | indra/newview/llbottomtray.cpp | 105 |
1 files changed, 91 insertions, 14 deletions
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 2403e891f6..861f23abb7 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -40,13 +40,12 @@ #include "lllayoutstack.h" #include "llnearbychatbar.h" #include "llsplitbutton.h" +#include "llsyswellwindow.h" #include "llfloatercamera.h" #include "llimpanel.h" -#include "llactiveimwindow.h" LLBottomTray::LLBottomTray(const LLSD&) : mChicletPanel(NULL), - mIMWell(NULL), mSysWell(NULL), mTalkBtn(NULL), mNearbyChatBar(NULL), @@ -58,10 +57,10 @@ LLBottomTray::LLBottomTray(const LLSD&) LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml"); mChicletPanel = getChild<LLChicletPanel>("chiclet_list"); - mIMWell = getChild<LLNotificationChiclet>("im_well"); mSysWell = getChild<LLNotificationChiclet>("sys_well"); mSysWell->setNotificationChicletWindow(LLFloaterReg::getInstance("syswell_window")); + mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1)); LLSplitButton* presets = getChild<LLSplitButton>("presets"); @@ -76,14 +75,20 @@ LLBottomTray::LLBottomTray(const LLSD&) // Necessary for focus movement among child controls setFocusRoot(TRUE); - - LLActiveIMWindow::init(mIMWell); } BOOL LLBottomTray::postBuild() { + mCommitCallbackRegistrar.add("ShowCamMoveCtrls.Action", boost::bind(&LLBottomTray::onShowCamMoveCtrlsContextMenuItemClicked, this, _2)); + mEnableCallbackRegistrar.add("ShowCamMoveCtrls.EnableMenuItem", boost::bind(&LLBottomTray::onShowCamMoveCtrlsContextMenuItemEnabled, this, _2)); + + mShowCamMoveCtrlsContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_hide_camera_move_controls.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + gMenuHolder->addChild(mShowCamMoveCtrlsContextMenu); + mNearbyChatBar = getChild<LLNearbyChatBar>("chat_bar"); mToolbarStack = getChild<LLLayoutStack>("toolbar_stack"); + mMovementPanel = getChild<LLPanel>("movement_panel"); + mCamPanel = getChild<LLPanel>("cam_panel"); return TRUE; } @@ -119,6 +124,34 @@ void* LLBottomTray::createNearbyChatBar(void* userdata) return new LLNearbyChatBar(); } +LLIMChiclet* LLBottomTray::createIMChiclet(const LLUUID& session_id) +{ + if(session_id.isNull()) + { + return NULL; + } + + LLFloaterIMPanel* im = LLIMMgr::getInstance()->findFloaterBySession(session_id); + if (!im) + { + return NULL; //should never happen + } + + switch(im->getDialogType()) + { + case IM_NOTHING_SPECIAL: + return getChicletPanel()->createChiclet<LLIMP2PChiclet>(session_id); + break; + case IM_SESSION_GROUP_START: + case IM_SESSION_INVITE: + return getChicletPanel()->createChiclet<LLIMGroupChiclet>(session_id); + break; + default: + return NULL; + break; + } +} + //virtual void LLBottomTray::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { @@ -130,12 +163,18 @@ void LLBottomTray::sessionAdded(const LLUUID& session_id, const std::string& nam } else { - LLIMChiclet* chiclet = getChicletPanel()->createChiclet<LLIMChiclet>(session_id); - chiclet->setIMSessionName(name); - chiclet->setOtherParticipantId(other_participant_id); + LLIMChiclet* chiclet = createIMChiclet(session_id); + if(chiclet) + { + chiclet->setIMSessionName(name); + chiclet->setOtherParticipantId(other_participant_id); + } + else + { + llerrs << "Could not create chiclet" << llendl; + } } } - updateImChicletCount(); } //virtual @@ -145,7 +184,6 @@ void LLBottomTray::sessionRemoved(const LLUUID& session_id) { getChicletPanel()->removeChiclet(session_id); } - updateImChicletCount(); } //virtual @@ -174,8 +212,9 @@ void LLBottomTray::setVisible(BOOL visible) child_it != mToolbarStack->getChildList()->end(); child_it++) { LLView* viewp = *child_it; + std::string name = viewp->getName(); - if ("chat_bar" == viewp->getName()) + if ("chat_bar" == name || "movement_panel" == name || "cam_panel" == name) continue; else { @@ -185,7 +224,45 @@ void LLBottomTray::setVisible(BOOL visible) } } -void LLBottomTray::updateImChicletCount() { - U32 chicletCount = mChicletPanel->getChicletCount(); - mIMWell->setCounter(chicletCount); +BOOL LLBottomTray::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + if (mShowCamMoveCtrlsContextMenu) + { + mShowCamMoveCtrlsContextMenu->buildDrawLabels(); + mShowCamMoveCtrlsContextMenu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(this, mShowCamMoveCtrlsContextMenu, x, y); + } + + return TRUE; +} + +bool LLBottomTray::onShowCamMoveCtrlsContextMenuItemEnabled(const LLSD& userdata) +{ + std::string item = userdata.asString(); + + if (item == "show_camera_move_controls") + { + return gSavedSettings.getBOOL("ShowCameraAndMoveControls"); + } + + return FALSE; +} + +void LLBottomTray::onShowCamMoveCtrlsContextMenuItemClicked(const LLSD& userdata) +{ + std::string item = userdata.asString(); + + if (item == "show_camera_move_controls") + { + BOOL state = !gSavedSettings.getBOOL("ShowCameraAndMoveControls"); + + showCameraAndMoveControls(state); + gSavedSettings.setBOOL("ShowCameraAndMoveControls", state); + } +} + +void LLBottomTray::showCameraAndMoveControls(BOOL visible) +{ + mCamPanel->setVisible(visible); + mMovementPanel->setVisible(visible); } |