summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llfloater.cpp7
-rw-r--r--indra/llui/llfloater.h1
-rwxr-xr-xindra/newview/llagent.cpp6
-rw-r--r--indra/newview/llchatitemscontainerctrl.cpp4
-rw-r--r--indra/newview/llfloatertranslationsettings.cpp3
-rw-r--r--indra/newview/llgesturemgr.cpp4
-rw-r--r--indra/newview/llimconversation.cpp31
-rw-r--r--indra/newview/llimview.cpp6
-rw-r--r--indra/newview/llnearbychat.cpp21
-rw-r--r--indra/newview/llnearbychat.h4
-rw-r--r--indra/newview/llnearbychathandler.cpp5
-rw-r--r--indra/newview/llnotificationhandlerutil.cpp5
-rw-r--r--indra/newview/llnotificationtiphandler.cpp3
-rw-r--r--indra/newview/llviewergesture.cpp4
-rw-r--r--indra/newview/llviewerkeyboard.cpp3
-rwxr-xr-xindra/newview/llviewermessage.cpp8
-rwxr-xr-xindra/newview/llviewerwindow.cpp10
17 files changed, 76 insertions, 49 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 52812dc050..029c47c726 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -627,6 +627,13 @@ void LLFloater::setVisible( BOOL visible )
storeVisibilityControl();
}
+
+void LLFloater::setIsSingleInstance(BOOL is_single_instance)
+{
+ mSingleInstance = is_single_instance;
+}
+
+
// virtual
void LLFloater::handleVisibilityChange ( BOOL new_visibility )
{
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index a1cac64a4a..4b738f88ea 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -217,6 +217,7 @@ public:
/*virtual*/ void setFocus( BOOL b );
/*virtual*/ void setIsChrome(BOOL is_chrome);
/*virtual*/ void setRect(const LLRect &rect);
+ void setIsSingleInstance(BOOL is_single_instance);
void initFloater(const Params& p);
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index be6901c36a..bb0dbc7ff0 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -1911,7 +1911,8 @@ void LLAgent::startTyping()
{
sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_START);
}
- (LLNearbyChat::instance()).sendChatFromViewer("", CHAT_TYPE_START, FALSE);
+ (LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat"))->
+ sendChatFromViewer("", CHAT_TYPE_START, FALSE);
}
//-----------------------------------------------------------------------------
@@ -1923,7 +1924,8 @@ void LLAgent::stopTyping()
{
clearRenderState(AGENT_STATE_TYPING);
sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_STOP);
- (LLNearbyChat::instance()).sendChatFromViewer("", CHAT_TYPE_STOP, FALSE);
+ (LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat"))->
+ sendChatFromViewer("", CHAT_TYPE_STOP, FALSE);
}
}
diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp
index e6340e0fa3..f1b5c42ef3 100644
--- a/indra/newview/llchatitemscontainerctrl.cpp
+++ b/indra/newview/llchatitemscontainerctrl.cpp
@@ -323,12 +323,12 @@ BOOL LLNearbyChatToastPanel::handleMouseUp (S32 x, S32 y, MASK mask)
return TRUE;
else
{
- LLNearbyChat::instance().showHistory();
+ (LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat"))->showHistory();
return FALSE;
}
}
- LLNearbyChat::instance().showHistory();
+ (LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat"))->showHistory();
return LLPanel::handleMouseUp(x,y,mask);
}
diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp
index b5b86dadc2..29d7732a68 100644
--- a/indra/newview/llfloatertranslationsettings.cpp
+++ b/indra/newview/llfloatertranslationsettings.cpp
@@ -293,6 +293,7 @@ void LLFloaterTranslationSettings::onBtnOK()
gSavedSettings.setString("TranslationService", getSelectedService());
gSavedSettings.setString("BingTranslateAPIKey", getEnteredBingKey());
gSavedSettings.setString("GoogleTranslateAPIKey", getEnteredGoogleKey());
- LLNearbyChat::instance().showTranslationCheckbox(LLTranslate::isTranslationConfigured());
+ (LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat"))->
+ showTranslationCheckbox(LLTranslate::isTranslationConfigured());
closeFloater(false);
}
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index 0377337af6..0996af6125 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -35,6 +35,7 @@
// library
#include "llaudioengine.h"
#include "lldatapacker.h"
+#include "llfloaterreg.h"
#include "llinventory.h"
#include "llkeyframemotion.h"
#include "llmultigesture.h"
@@ -997,7 +998,8 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step)
const BOOL animate = FALSE;
- LLNearbyChat::instance().sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate);
+ (LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat"))->
+ sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate);
gesture->mCurrentStep++;
break;
diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp
index 7bb29be27b..5a5196fb7e 100644
--- a/indra/newview/llimconversation.cpp
+++ b/indra/newview/llimconversation.cpp
@@ -144,7 +144,7 @@ BOOL LLIMConversation::postBuild()
updateHeaderAndToolbar();
- mSaveRect = isTornOff();
+ mSaveRect = !getHost();
initRectControl();
if (isChatMultiTab())
@@ -267,11 +267,11 @@ void LLIMConversation::hideOrShowTitle()
LLView* floater_contents = getChild<LLView>("contents_view");
LLRect floater_rect = getLocalRect();
- S32 top_border_of_contents = floater_rect.mTop - (isTornOff()? floater_header_size : 0);
+ S32 top_border_of_contents = floater_rect.mTop - (getHost()? 0 : floater_header_size);
LLRect handle_rect (0, floater_rect.mTop, floater_rect.mRight, top_border_of_contents);
LLRect contents_rect (0, top_border_of_contents, floater_rect.mRight, floater_rect.mBottom);
mDragHandle->setShape(handle_rect);
- mDragHandle->setVisible(isTornOff());
+ mDragHandle->setVisible(!getHost());
floater_contents->setShape(contents_rect);
}
@@ -289,8 +289,8 @@ void LLIMConversation::hideAllStandardButtons()
void LLIMConversation::updateHeaderAndToolbar()
{
- bool is_torn_off = !getHost();
- if (!is_torn_off)
+ bool is_hosted = !!getHost();
+ if (is_hosted)
{
hideAllStandardButtons();
}
@@ -299,7 +299,7 @@ void LLIMConversation::updateHeaderAndToolbar()
// Participant list should be visible only in torn off floaters.
bool is_participant_list_visible =
- is_torn_off
+ !is_hosted
&& gSavedSettings.getBOOL("IMShowControlPanel")
&& !mIsP2PChat;
@@ -307,21 +307,21 @@ void LLIMConversation::updateHeaderAndToolbar()
// Display collapse image (<<) if the floater is hosted
// or if it is torn off but has an open control panel.
- bool is_expanded = !is_torn_off || is_participant_list_visible;
+ bool is_expanded = is_hosted || is_participant_list_visible;
mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon"));
// toggle floater's drag handle and title visibility
if (mDragHandle)
{
- mDragHandle->setTitleVisible(is_torn_off);
+ mDragHandle->setTitleVisible(!is_hosted);
}
// The button (>>) should be disabled for torn off P2P conversations.
- mExpandCollapseBtn->setEnabled(!is_torn_off || !mIsP2PChat);
+ mExpandCollapseBtn->setEnabled(is_hosted || !mIsP2PChat);
- mTearOffBtn->setImageOverlay(getString(is_torn_off? "return_icon" : "tear_off_icon"));
+ mTearOffBtn->setImageOverlay(getString(is_hosted? "tear_off_icon" : "return_icon"));
- mCloseBtn->setVisible(!is_torn_off && !mIsNearbyChat);
+ mCloseBtn->setVisible(is_hosted && !mIsNearbyChat);
enableDisableCallBtn();
@@ -358,9 +358,10 @@ void LLIMConversation::processChatHistoryStyleUpdate()
}
}
- if (LLNearbyChat::instanceExists())
+ LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
+ if (nearby_chat)
{
- LLNearbyChat::instance().reloadMessages();
+ nearby_chat->reloadMessages();
}
}
@@ -427,8 +428,8 @@ void LLIMConversation::onClose(bool app_quitting)
void LLIMConversation::onTearOffClicked()
{
- setFollows(isTornOff()? FOLLOWS_ALL : FOLLOWS_NONE);
- mSaveRect = isTornOff();
+ setFollows(getHost()? FOLLOWS_NONE : FOLLOWS_ALL);
+ mSaveRect = !getHost();
initRectControl();
LLFloater::onClickTearOff(this);
updateHeaderAndToolbar();
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index effcc9a826..f5392b442a 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -2486,9 +2486,11 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess
LLChat chat(message);
chat.mSourceType = CHAT_SOURCE_SYSTEM;
- if (LLNearbyChat::instanceExists())
+
+ LLNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLNearbyChat>("nearby_chat");
+ if (nearby_chat)
{
- LLNearbyChat::instance().addMessage(chat);
+ nearby_chat->addMessage(chat);
}
}
else // going to IM session
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index f1518fe825..25bbc82fee 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -134,6 +134,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& llsd)
mKey = LLSD();
mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
setName("nearby_chat");
+ setIsSingleInstance(TRUE);
}
//virtual
@@ -780,20 +781,21 @@ void LLNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType type, BO
// static
void LLNearbyChat::startChat(const char* line)
{
- if (LLNearbyChat::instanceExists())
+ LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
+ if (nearby_chat)
{
- (LLNearbyChat::instance()).show();
- (LLNearbyChat::instance()).setVisible(TRUE);
- (LLNearbyChat::instance()).setFocus(TRUE);
- (LLNearbyChat::instance().mInputEditor)->setFocus(TRUE);
+ nearby_chat->show();
+ nearby_chat->setVisible(TRUE);
+ nearby_chat->setFocus(TRUE);
+ nearby_chat->mInputEditor->setFocus(TRUE);
if (line)
{
std::string line_string(line);
- (LLNearbyChat::instance().mInputEditor)->setText(line_string);
+ nearby_chat->mInputEditor->setText(line_string);
}
- (LLNearbyChat::instance().mInputEditor)->endOfDoc();
+ nearby_chat->mInputEditor->endOfDoc();
}
}
@@ -801,9 +803,10 @@ void LLNearbyChat::startChat(const char* line)
// static
void LLNearbyChat::stopChat()
{
- if (LLNearbyChat::instanceExists())
+ LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
+ if (nearby_chat)
{
- (LLNearbyChat::instance().mInputEditor)->setFocus(FALSE);
+ nearby_chat->mInputEditor->setFocus(FALSE);
gAgent.stopTyping();
}
}
diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h
index 379bfbee4b..4fc5cb7f76 100644
--- a/indra/newview/llnearbychat.h
+++ b/indra/newview/llnearbychat.h
@@ -35,15 +35,13 @@
#include "lloutputmonitorctrl.h"
#include "llspeakers.h"
#include "llscrollbar.h"
-#include "llsingleton.h"
#include "llviewerchat.h"
#include "llpanel.h"
class LLResizeBar;
class LLNearbyChat
- : public LLIMConversation,
- public LLSingleton<LLNearbyChat>
+ : public LLIMConversation
{
public:
// constructor for inline chat-bars (e.g. hosted in chat history window)
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index 37f4cc4c19..ca3fffeffd 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -537,7 +537,8 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg,
}
}
- LLNearbyChat::instance().addMessage(chat_msg, true, args);
+ LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
+ nearby_chat->addMessage(chat_msg, true, args);
if(chat_msg.mSourceType == CHAT_SOURCE_AGENT
&& chat_msg.mFromID.notNull()
@@ -553,7 +554,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg,
// Send event on to LLEventStream
sChatWatcher->post(chat);
- if( LLNearbyChat::instance().isInVisibleChain()
+ if( nearby_chat->isInVisibleChain()
|| ( chat_msg.mSourceType == CHAT_SOURCE_AGENT
&& gSavedSettings.getBOOL("UseChatBubbles") )
|| mChannel.isDead()
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index db8e917435..2484040ac4 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -181,13 +181,14 @@ void LLHandlerUtil::logGroupNoticeToIMGroup(
// static
void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type)
{
- if (LLNearbyChat::instanceExists())
+ LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
+ if (nearby_chat)
{
LLChat chat_msg(notification->getMessage());
chat_msg.mSourceType = type;
chat_msg.mFromName = SYSTEM_FROM;
chat_msg.mFromID = LLUUID::null;
- LLNearbyChat::instance().addMessage(chat_msg);
+ nearby_chat->addMessage(chat_msg);
}
}
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index 67fc9b27dc..ef6668247c 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -85,7 +85,8 @@ bool LLTipHandler::processNotification(const LLNotificationPtr& notification)
LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM);
// don't show toast if Nearby Chat is opened
- if (LLNearbyChat::instance().isChatVisible())
+ LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
+ if (nearby_chat && nearby_chat->isChatVisible())
{
return false;
}
diff --git a/indra/newview/llviewergesture.cpp b/indra/newview/llviewergesture.cpp
index a2dea31d9b..71608b5280 100644
--- a/indra/newview/llviewergesture.cpp
+++ b/indra/newview/llviewergesture.cpp
@@ -33,6 +33,7 @@
#include "llviewerinventory.h"
#include "sound_ids.h" // for testing
+#include "llfloaterreg.h"
#include "llkeyboard.h" // for key shortcuts for testing
#include "llinventorymodel.h"
#include "llvoavatar.h"
@@ -130,7 +131,8 @@ void LLViewerGesture::doTrigger( BOOL send_chat )
{
// Don't play nodding animation, since that might not blend
// with the gesture animation.
- LLNearbyChat::instance().sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE);
+ (LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat"))->
+ sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE);
}
}
diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp
index 7105720eb4..f8e988bc0c 100644
--- a/indra/newview/llviewerkeyboard.cpp
+++ b/indra/newview/llviewerkeyboard.cpp
@@ -27,6 +27,7 @@
#include "llviewerprecompiledheaders.h"
#include "llappviewer.h"
+#include "llfloaterreg.h"
#include "llviewerkeyboard.h"
#include "llmath.h"
#include "llagent.h"
@@ -543,7 +544,7 @@ void start_gesture( EKeystate s )
if (KEYSTATE_UP == s &&
! (focus_ctrlp && focus_ctrlp->acceptsTextInput()))
{
- if (LLNearbyChat::instance().getCurrentChat().empty())
+ if ((LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat"))->getCurrentChat().empty())
{
// No existing chat in chat editor, insert '/'
LLNearbyChat::startChat("/");
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 9abd269f0f..81cbc3b6c3 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2297,9 +2297,10 @@ void god_message_name_cb(const LLAvatarName& av_name, LLChat chat, std::string m
// Treat like a system message and put in chat history.
chat.mText = av_name.getCompleteName() + ": " + message;
- if (LLNearbyChat::instanceExists())
+ LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
+ if (nearby_chat)
{
- LLNearbyChat::instance().addMessage(chat);
+ nearby_chat->addMessage(chat);
}
}
@@ -2895,7 +2896,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
// Note: lie to Nearby Chat, pretending that this is NOT an IM, because
// IMs from obejcts don't open IM sessions.
- if(!chat_from_system && LLNearbyChat::instanceExists())
+ LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
+ if(!chat_from_system && nearby_chat)
{
chat.mOwnerID = from_id;
LLSD args;
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 23d2b1633d..791cadaee4 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2493,12 +2493,14 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
return TRUE;
}
+ LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
+
// Traverses up the hierarchy
if( keyboard_focus )
{
- if (LLNearbyChat::instanceExists())
+ if (nearby_chat)
{
- LLChatEntry* chat_editor = LLNearbyChat::instance().getChatBox();
+ LLChatEntry* chat_editor = nearby_chat->getChatBox();
// arrow keys move avatar while chatting hack
if (chat_editor && chat_editor->hasFocus())
@@ -2562,11 +2564,11 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() &&
!keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) )
{
- LLChatEntry* chat_editor = LLNearbyChat::instance().getChatBox();
+ LLChatEntry* chat_editor = nearby_chat->getChatBox();
if (chat_editor)
{
// passing NULL here, character will be added later when it is handled by character handler.
- LLNearbyChat::instance().startChat(NULL);
+ nearby_chat->startChat(NULL);
return TRUE;
}
}