diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index e939cd411..83e532a65 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -263,8 +263,8 @@ void LLLayoutStack::draw() // only force drawing invisible children if visible amount is non-zero drawChild(panelp, 0, 0, !clip_rect.isEmpty()); - //if (sDebugRects) - /*{ + if (sDebugRects) + { LLUI::pushMatrix(); { // drawing solids requires texturing be disabled @@ -280,11 +280,11 @@ void LLLayoutStack::draw() } } LLUI::popMatrix(); - }*/ + } } } - //if (sDebugRects) - /*{ + if (sDebugRects) + { drawDebugRect(); // Check for bogus rectangle @@ -292,7 +292,7 @@ void LLLayoutStack::draw() { llwarns << "Bogus rectangle for " << getName() << " with " << getRect() << llendl; } - }*/ + } } void LLLayoutStack::removeChild(LLView* view) diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 6fdd7d0f9..95e39ee89 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -509,7 +509,7 @@ void LLChatBar::sendChat( EChatType type ) // static void LLChatBar::startChat(const char* line) { - gChatBar->setVisible(TRUE); + gChatBar->getParent()->setVisible(TRUE); gChatBar->setKeyboardFocus(TRUE); gSavedSettings.setBOOL("ChatVisible", TRUE); @@ -540,7 +540,7 @@ void LLChatBar::stopChat() gAgent.stopTyping(); // hide chat bar so it doesn't grab focus back - gChatBar->setVisible(FALSE); + gChatBar->getParent()->setVisible(FALSE); gSavedSettings.setBOOL("ChatVisible", FALSE); } diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index 12077f379..7fbf65fb7 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -87,11 +87,6 @@ LLOverlayBar *gOverlayBar = NULL; -extern S32 MENU_BAR_HEIGHT; -extern ImportTracker gImportTracker; - -BOOL LLOverlayBar::sChatVisible; - // // Functions // @@ -153,33 +148,30 @@ LLOverlayBar::LLOverlayBar() LLUICtrlFactory::getInstance()->buildPanel(this, "panel_overlaybar.xml", &factory_map); } -bool LLOverlayBar::updateAdvSettingsPopup() +bool LLOverlayBar::updateAdvSettingsPopup(const LLSD &data) { - bool wfl_adv_settings_popup = gSavedSettings.getBOOL("wlfAdvSettingsPopup"); + bool wfl_adv_settings_popup = data.asBoolean(); wlfPanel_AdvSettings::updateClass(); - if(LLLayoutStack* layout_stack = findChild("overlay_layout_panel")) + LLLayoutPanel* layout_panel = dynamic_cast((LLPanel*)mAdvSettingsContainer); + if(layout_panel) { - LLLayoutPanel* layout_panel = layout_stack->findChild("AdvSettings_container"); - if(layout_panel) - { - layout_stack->collapsePanel(layout_panel,!wfl_adv_settings_popup); - if(wfl_adv_settings_popup) - layout_panel->setTargetDim(layout_panel->getChild("Adv_Settings")->getBoundingRect().getWidth()); - } + ((LLLayoutStack*)layout_panel->getParent())->collapsePanel(layout_panel,!wfl_adv_settings_popup); + if(wfl_adv_settings_popup) + layout_panel->setTargetDim(layout_panel->getChild("Adv_Settings")->getBoundingRect().getWidth()); } return true; } -bool updateChatVisible(const LLSD &data) +bool LLOverlayBar::updateChatVisible(const LLSD &data) { - LLOverlayBar::sChatVisible = data.asBoolean(); + mChatBar->getParent()->setVisible(data.asBoolean()); return true; } -bool updateAORemote(const LLSD &data) +bool LLOverlayBar::updateAORemoteVisible(const LLSD &data) { - gOverlayBar->childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote")); + mAORemoteContainer->setVisible(data.asBoolean()); return true; } @@ -189,6 +181,7 @@ bool updateNearbyMediaFloater(const LLSD &data) return true; } + BOOL LLOverlayBar::postBuild() { childSetAction("New IM",onClickIMReceived,this); @@ -197,12 +190,13 @@ BOOL LLOverlayBar::postBuild() childSetAction("Stand Up",onClickStandUp,this); childSetAction("Cancel TP",onClickCancelTP,this); childSetAction("Flycam",onClickFlycam,this); - childSetVisible("chat_bar", gSavedSettings.getBOOL("ChatVisible")); mCancelBtn = getChild("Cancel TP"); setFocusRoot(TRUE); mBuilt = true; + mUnreadCountStringPlural = getString("unread_count_string_plural"); + mChatbarAndButtons.connect(this,"chatbar_and_buttons"); mNewIM.connect(this,"New IM"); mNotBusy.connect(this,"Set Not Busy"); @@ -211,21 +205,27 @@ BOOL LLOverlayBar::postBuild() mFlyCam.connect(this,"Flycam"); mChatBar.connect(this,"chat_bar"); mVoiceRemoteContainer.connect(this,"voice_remote_container"); + mStateManagementContainer.connect(this,"state_management_buttons_container"); + mAORemoteContainer.connect(this,"ao_remote_container"); + mAdvSettingsContainer.connect(this,"AdvSettings_container"); + mMediaRemoteContainer.connect(this,"media_remote_container"); + + updateAdvSettingsPopup(gSavedSettings.getBOOL("wlfAdvSettingsPopup")); + updateChatVisible(gSavedSettings.getBOOL("ChatVisible")); + updateAORemoteVisible(gSavedSettings.getBOOL("EnableAORemote")); mOriginalIMLabel = mNewIM->getLabelSelected(); layoutButtons(); - sChatVisible = gSavedSettings.getBOOL("ChatVisible"); - - gSavedSettings.getControl("wlfAdvSettingsPopup")->getSignal()->connect(boost::bind(&LLOverlayBar::updateAdvSettingsPopup,this)); - gSavedSettings.getControl("ChatVisible")->getSignal()->connect(boost::bind(&updateChatVisible,_2)); - gSavedSettings.getControl("EnableAORemote")->getSignal()->connect(boost::bind(&updateAORemote,_2)); + gSavedSettings.getControl("wlfAdvSettingsPopup")->getSignal()->connect(boost::bind(&LLOverlayBar::updateAdvSettingsPopup,this,_2)); + gSavedSettings.getControl("ChatVisible")->getSignal()->connect(boost::bind(&LLOverlayBar::updateChatVisible,this,_2)); + gSavedSettings.getControl("EnableAORemote")->getSignal()->connect(boost::bind(&LLOverlayBar::updateAORemoteVisible,this,_2)); gSavedSettings.getControl("ShowNearbyMediaFloater")->getSignal()->connect(boost::bind(&updateNearbyMediaFloater,_2)); - childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote")); + mAORemoteContainer->setVisible(gSavedSettings.getBOOL("EnableAORemote")); + - updateAdvSettingsPopup(); return TRUE; } @@ -254,12 +254,10 @@ void LLOverlayBar::reshape(S32 width, S32 height, BOOL called_from_parent) void LLOverlayBar::layoutButtons() { - LLView* state_buttons_panel = getChildView("state_management_buttons_container"); - - if (state_buttons_panel->getVisible()) + if (mStateManagementContainer->getVisible()) { U32 button_count = 0; - const child_list_t& view_list = *(state_buttons_panel->getChildList()); + const child_list_t& view_list = *(mStateManagementContainer->getChildList()); BOOST_FOREACH(LLView* viewp, view_list) { if(!viewp->getEnabled()) @@ -267,7 +265,7 @@ void LLOverlayBar::layoutButtons() ++button_count; } const S32 MAX_BAR_WIDTH = 600; - S32 bar_width = llclamp(state_buttons_panel->getRect().getWidth(), 0, MAX_BAR_WIDTH); + S32 bar_width = llclamp(mStateManagementContainer->getRect().getWidth(), 0, MAX_BAR_WIDTH); // calculate button widths const S32 MAX_BUTTON_WIDTH = 150; @@ -318,7 +316,7 @@ void LLOverlayBar::refresh() if (unread_count > 1) { std::stringstream ss; - ss << unread_count << " " << getString("unread_count_string_plural"); + ss << unread_count << " " << mUnreadCountStringPlural; button->setLabel(ss.str()); } else @@ -349,31 +347,17 @@ void LLOverlayBar::refresh() if(last_mouselook != in_mouselook) { last_mouselook = in_mouselook; - if (in_mouselook) - { - childSetVisible("media_remote_container", FALSE); - childSetVisible("voice_remote_container", FALSE); - childSetVisible("AdvSettings_container", FALSE); - childSetVisible("ao_remote_container", FALSE); - childSetVisible("state_management_buttons_container", FALSE); - } - else - { - // update "remotes" - childSetVisible("media_remote_container", TRUE); - childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled()); - childSetVisible("AdvSettings_container", TRUE); - childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote")); - childSetVisible("state_management_buttons_container", TRUE); - } + + static const LLCachedControl enable_ao_remote("EnableAORemote", true); + mMediaRemoteContainer->setVisible(!in_mouselook); + mVoiceRemoteContainer->setVisible(!in_mouselook && LLVoiceClient::voiceEnabled()); + mAdvSettingsContainer->setVisible(!in_mouselook); + mAORemoteContainer->setVisible(!in_mouselook && enable_ao_remote); + mStateManagementContainer->setVisible(!in_mouselook); } if(!in_mouselook) mVoiceRemoteContainer->setVisible(LLVoiceClient::voiceEnabled()); - // always let user toggle into and out of chatbar - static const LLCachedControl chat_visible("ChatVisible",true); - mChatBar->setVisible(chat_visible); - if (buttons_changed) { layoutButtons(); diff --git a/indra/newview/lloverlaybar.h b/indra/newview/lloverlaybar.h index 03ac7ed72..a02977538 100644 --- a/indra/newview/lloverlaybar.h +++ b/indra/newview/lloverlaybar.h @@ -98,7 +98,6 @@ public: void setCancelTPButtonVisible(BOOL b, const std::string& label); - static BOOL sChatVisible; protected: static void* createMediaRemote(void* userdata); static void* createVoiceRemote(void* userdata); @@ -118,6 +117,7 @@ protected: enum { STOPPED=0, PLAYING=1, PAUSED=2 }; S32 mMusicState; std::string mOriginalIMLabel; + std::string mUnreadCountStringPlural; CachedUICtrl mChatbarAndButtons; CachedUICtrl mNewIM; @@ -127,12 +127,14 @@ protected: CachedUICtrl mFlyCam; CachedUICtrl mChatBar; CachedUICtrl mVoiceRemoteContainer; + CachedUICtrl mStateManagementContainer; + CachedUICtrl mAORemoteContainer; + CachedUICtrl mAdvSettingsContainer; + CachedUICtrl mMediaRemoteContainer; private: - - - bool updateAdvSettingsPopup(); - //static void updateChatVisible(const LLSD &data); - + bool updateChatVisible(const LLSD &data); + bool updateAORemoteVisible(const LLSD &data); + bool updateAdvSettingsPopup(const LLSD &data); }; extern LLOverlayBar* gOverlayBar; diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 888d77d8e..f8532d7b0 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -5865,7 +5865,9 @@ void LLVoiceClient::setVoiceEnabled(bool enabled) bool LLVoiceClient::voiceEnabled() { - return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice"); + static const LLCachedControl enable_voice_chat("EnableVoiceChat",true); + static const LLCachedControl cmdline_disable_voce("CmdLineDisableVoice",false); + return enable_voice_chat && !cmdline_disable_voce; } void LLVoiceClient::setLipSyncEnabled(BOOL enabled)