summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2012-03-21 17:50:34 +0200
committerVadim ProductEngine <vsavchuk@productengine.com>2012-03-21 17:50:34 +0200
commitb0ba9364fce6ae3ff132f63729e3d5f9b100afe9 (patch)
tree4c69f7ff702fb6a59e6caca931dfdb2795efa0d3
parent65cad817e828d56015c0dca3f052f2e39caf8b57 (diff)
MAINT-518 FIXED Sometimes nearby chat expand button failed to work.
Made the nearby chat expand/collapse logic work regardless of the previous/saved state.
-rw-r--r--indra/newview/llnearbychatbar.cpp28
-rw-r--r--indra/newview/llnearbychatbar.h3
2 files changed, 19 insertions, 12 deletions
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index 4512c14b7a..c42930f89d 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -103,15 +103,17 @@ BOOL LLNearbyChatBar::postBuild()
mNearbyChat = getChildView("nearby_chat");
- LLUICtrl* show_btn = getChild<LLUICtrl>("show_nearby_chat");
+ gSavedSettings.declareBOOL("nearbychat_history_visibility", mNearbyChat->getVisible(), "Visibility state of nearby chat history", TRUE);
+ BOOL show_nearby_chat = gSavedSettings.getBOOL("nearbychat_history_visibility");
+
+ LLButton* show_btn = getChild<LLButton>("show_nearby_chat");
show_btn->setCommitCallback(boost::bind(&LLNearbyChatBar::onToggleNearbyChatPanel, this));
+ show_btn->setToggleState(show_nearby_chat);
mOutputMonitor = getChild<LLOutputMonitorCtrl>("chat_zone_indicator");
mOutputMonitor->setVisible(FALSE);
- gSavedSettings.declareBOOL("nearbychat_history_visibility", mNearbyChat->getVisible(), "Visibility state of nearby chat history", TRUE);
-
- mNearbyChat->setVisible(gSavedSettings.getBOOL("nearbychat_history_visibility"));
+ showNearbyChatPanel(show_nearby_chat);
// Register for font change notifications
LLViewerChat::setFontChangedCallback(boost::bind(&LLNearbyChatBar::onChatFontChange, this, _1));
@@ -392,26 +394,23 @@ void LLNearbyChatBar::sendChat( EChatType type )
}
}
-
-void LLNearbyChatBar::onToggleNearbyChatPanel()
+void LLNearbyChatBar::showNearbyChatPanel(bool show)
{
- LLView* nearby_chat = getChildView("nearby_chat");
-
- if (nearby_chat->getVisible())
+ if (!show)
{
- if (!isMinimized())
+ if (mNearbyChat->getVisible() && !isMinimized())
{
mExpandedHeight = getRect().getHeight();
}
setResizeLimits(getMinWidth(), COLLAPSED_HEIGHT);
- nearby_chat->setVisible(FALSE);
+ mNearbyChat->setVisible(FALSE);
reshape(getRect().getWidth(), COLLAPSED_HEIGHT);
enableResizeCtrls(true, true, false);
storeRectControl();
}
else
{
- nearby_chat->setVisible(TRUE);
+ mNearbyChat->setVisible(TRUE);
setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT);
reshape(getRect().getWidth(), mExpandedHeight);
enableResizeCtrls(true);
@@ -421,6 +420,11 @@ void LLNearbyChatBar::onToggleNearbyChatPanel()
gSavedSettings.setBOOL("nearbychat_history_visibility", mNearbyChat->getVisible());
}
+void LLNearbyChatBar::onToggleNearbyChatPanel()
+{
+ showNearbyChatPanel(!mNearbyChat->getVisible());
+}
+
void LLNearbyChatBar::setMinimized(BOOL b)
{
LLNearbyChat* nearby_chat = getChild<LLNearbyChat>("nearby_chat");
diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h
index baf12a06ea..0a320942dd 100644
--- a/indra/newview/llnearbychatbar.h
+++ b/indra/newview/llnearbychatbar.h
@@ -37,6 +37,8 @@
class LLNearbyChatBar : public LLFloater
{
+ LOG_CLASS(LLNearbyChatBar);
+
public:
// constructor for inline chat-bars (e.g. hosted in chat history window)
LLNearbyChatBar(const LLSD& key);
@@ -76,6 +78,7 @@ protected:
/* virtual */ bool applyRectControl();
+ void showNearbyChatPanel(bool show);
void onToggleNearbyChatPanel();
static LLWString stripChannelNumber(const LLWString &mesg, S32* channel);