diff options
Diffstat (limited to 'indra/newview/llnearbychatbar.cpp')
-rw-r--r-- | indra/newview/llnearbychatbar.cpp | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 3e4228cfb6..114472ba56 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -47,12 +47,15 @@ #include "llviewerwindow.h" #include "llrootview.h" #include "llviewerchat.h" +#include "llnearbychat.h" #include "llresizehandle.h" S32 LLNearbyChatBar::sLastSpecialChatChannel = 0; const S32 EXPANDED_HEIGHT = 300; +const S32 COLLAPSED_HEIGHT = 60; +const S32 EXPANDED_MIN_HEIGHT = 150; // legacy callback glue void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); @@ -102,7 +105,7 @@ BOOL LLNearbyChatBar::postBuild() // Register for font change notifications LLViewerChat::setFontChangedCallback(boost::bind(&LLNearbyChatBar::onChatFontChange, this, _1)); - mExpandedHeight = getMinHeight() + EXPANDED_HEIGHT; + mExpandedHeight = COLLAPSED_HEIGHT + EXPANDED_HEIGHT; enableResizeCtrls(true, true, false); @@ -112,14 +115,19 @@ BOOL LLNearbyChatBar::postBuild() bool LLNearbyChatBar::applyRectControl() { bool rect_controlled = LLFloater::applyRectControl(); - - if (getRect().getHeight() > getMinHeight()) + + LLView* nearby_chat = getChildView("nearby_chat"); + if (!nearby_chat->getVisible()) + { + reshape(getRect().getWidth(), getMinHeight()); + enableResizeCtrls(true, true, false); + } + else { - getChildView("nearby_chat")->setVisible(true); - mExpandedHeight = getRect().getHeight(); enableResizeCtrls(true); + setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT); } - + return rect_controlled; } @@ -140,12 +148,12 @@ LLNearbyChatBar* LLNearbyChatBar::getInstance() void LLNearbyChatBar::showHistory() { + openFloater(); + if (!getChildView("nearby_chat")->getVisible()) { onToggleNearbyChatPanel(); } - - openFloater(); } void LLNearbyChatBar::draw() @@ -372,17 +380,35 @@ void LLNearbyChatBar::onToggleNearbyChatPanel() if (nearby_chat->getVisible()) { - mExpandedHeight = getRect().getHeight(); + if (!isMinimized()) + { + mExpandedHeight = getRect().getHeight(); + } + setResizeLimits(getMinWidth(), COLLAPSED_HEIGHT); nearby_chat->setVisible(FALSE); - reshape(getRect().getWidth(), getMinHeight()); + reshape(getRect().getWidth(), COLLAPSED_HEIGHT); enableResizeCtrls(true, true, false); + storeRectControl(); } else { nearby_chat->setVisible(TRUE); + setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT); reshape(getRect().getWidth(), mExpandedHeight); enableResizeCtrls(true); + storeRectControl(); + } +} + +void LLNearbyChatBar::setMinimized(BOOL b) +{ + LLNearbyChat* nearby_chat = getChild<LLNearbyChat>("nearby_chat"); + // when unminimizing with nearby chat visible, go ahead and kill off screen chats + if (!b && nearby_chat->getVisible()) + { + nearby_chat->removeScreenChat(); } + LLFloater::setMinimized(b); } void LLNearbyChatBar::onChatBoxCommit() |