Nearby chat working, toolbar layouts mostly behaving.

master
ziree 2012-01-27 23:29:53 +01:00
parent 526eabaf73
commit 906dea62dc
48 changed files with 1995 additions and 2823 deletions

View File

@ -1351,7 +1351,6 @@ const std::string LLToolBarButton::getToolTip() const
// <FS:Zi> Returns the current layout style for saving in XML settings
LLToolBarEnums::LayoutStyle LLToolBar::getLayoutStyle() const
{
llwarns << mLayoutStyle << llendl;
return mLayoutStyle;
}
@ -1359,7 +1358,6 @@ LLToolBarEnums::LayoutStyle LLToolBar::getLayoutStyle() const
void LLToolBar::setLayoutStyle(LLToolBarEnums::LayoutStyle layout_style)
{
mLayoutStyle=layout_style;
llwarns << mLayoutStyle << llendl;
mNeedsLayout=true;
}

View File

@ -238,6 +238,7 @@ set(viewer_SOURCE_FILES
llfloatermodeluploadbase.cpp
llfloatermodelwizard.cpp
llfloaternamedesc.cpp
llfloaternearbychat.cpp
llfloaternotificationsconsole.cpp
llfloaterobjectweights.cpp
llfloateropenobject.cpp
@ -352,11 +353,10 @@ set(viewer_SOURCE_FILES
llnameeditor.cpp
llnamelistctrl.cpp
llnavigationbar.cpp
llnearbychat.cpp
llnearbychatbar.cpp
llnearbychatcontrol.cpp
llnearbychathandler.cpp
llnearbychathub.cpp
llnearbychatbarlistener.cpp
llnearbychatbarmulti.cpp
llnetmap.cpp
llnotificationalerthandler.cpp
llnotificationgrouphandler.cpp
@ -837,6 +837,7 @@ set(viewer_HEADER_FILES
llfloatermodeluploadbase.h
llfloatermodelwizard.h
llfloaternamedesc.h
llfloaternearbychat.h
llfloaternotificationsconsole.h
llfloaterobjectweights.h
llfloateropenobject.h
@ -951,12 +952,10 @@ set(viewer_HEADER_FILES
llnameeditor.h
llnamelistctrl.h
llnavigationbar.h
llnearbychat.h
llnearbychatbar.h
llnearbychatbarbase.h
llnearbychatcontrol.h
llnearbychathandler.h
llnearbychathub.h
llnearbychatbarlistener.h
llnearbychatbarmulti.h
llnetmap.h
llnotificationhandler.h
llnotificationmanager.h

View File

@ -50,9 +50,9 @@
label_ref="Command_Chat_Label"
tooltip_ref="Command_Chat_Tooltip"
execute_function="Floater.ToggleOrBringToFront"
execute_parameters="chat_bar"
execute_parameters="im_container"
is_running_function="Floater.IsOpen"
is_running_parameters="chat_bar"
is_running_parameters="im_container"
/>
<command name="compass"
available_in_toybox="false"

View File

@ -2,7 +2,7 @@
<toolbars>
<bottom_toolbar
button_display_mode="icons_with_text"
button_layout_style="none">
button_layout_style="fill">
<command name="chat"/>
<command name="speak"/>
<command name="destinations"/>

View File

@ -41,7 +41,10 @@
#include "llworld.h"
#include "lluuid.h"
#include "llviewercontrol.h"
#include "llnearbychat.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychat.h"
#include "llfloaternearbychat.h"
// </FS:Zi>
#include "material_codes.h"
#include "llvolume.h"
@ -970,7 +973,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture)
else if(command == std::string(sFSCmdLineClearChat))
{
LLNearbyChat* chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
LLFloaterNearbyChat* chat = LLFloaterReg::getTypedInstance<LLFloaterNearbyChat>("nearby_chat", LLSD());
if(chat)
{
chat->clearChatHistory();

View File

@ -47,7 +47,7 @@
#include "llfoldertype.h"
#include "llhttpclient.h"
#include "llassetuploadresponders.h"
#include "llnearbychatbar.h"
// #include "llnearbychatbar.h" // <FS:Zi> Dead code
#include "llnotificationmanager.h"
#include "llviewerobject.h"

View File

@ -11,7 +11,6 @@
#include "lggbeamcolormapfloater.h"
#include "llvoavatar.h"
#include "llvoavatarself.h"
#include "llnearbychat.h"
#include "llspinctrl.h"
static LLRegisterPanelClassWrapper<PanelPreferenceFirestorm> t_pref_fs("panel_preference_firestorm");

View File

@ -54,9 +54,10 @@
#include "llmorphview.h"
#include "llmoveview.h"
#include "llnavigationbar.h" // to show/hide navigation bar when changing mouse look state
// <FS:Zi> Remove floating chat bar
//#include "llnearbychatbar.h"
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a)
#include "llnearbychatbarbase.h"
#include "llnearbychathub.h"
// </FS:Zi>
#include "llspeakers.h"
// [/SL:KB]
#include "llnotificationsutil.h"
@ -1985,10 +1986,10 @@ void LLAgent::startTyping()
{
sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_START);
}
// LLNearbyChatBar::getInstance()->sendChatFromViewer("", CHAT_TYPE_START, FALSE);
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
LLNearbyChatBarBase::sendChatFromViewer("", CHAT_TYPE_START, FALSE);
// [/SL:KB]
// <FS:Zi> Remove floating chat bar
// LLNearbyChatBar::getInstance()->sendChatFromViewer("", CHAT_TYPE_START, FALSE);
LLNearbyChat::instance().sendChatFromViewer("", CHAT_TYPE_START, FALSE);
// </FS:Zi>
}
//-----------------------------------------------------------------------------
@ -2000,10 +2001,10 @@ void LLAgent::stopTyping()
{
clearRenderState(AGENT_STATE_TYPING);
sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_STOP);
// LLNearbyChatBar::getInstance()->sendChatFromViewer("", CHAT_TYPE_STOP, FALSE);
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
LLNearbyChatBarBase::sendChatFromViewer("", CHAT_TYPE_STOP, FALSE);
// [/SL:KB]
// <FS:Zi> Remove floating chat bar
// LLNearbyChatBar::getInstance()->sendChatFromViewer("", CHAT_TYPE_STOP, FALSE);
LLNearbyChat::instance().sendChatFromViewer("", CHAT_TYPE_STOP, FALSE);
// </FS:Zi>
}
}

View File

@ -62,7 +62,10 @@
#include "llavataractions.h"
#include "lggcontactsets.h"
#include "llnearbychat.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychat.h"
#include "llfloaternearbychat.h"
// </FS:Zi>
#include "llfloaterreg.h"
#include "llnotificationmanager.h"
@ -830,7 +833,7 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id,
args["type"] = LLNotificationsUI::NT_NEARBYCHAT;
if (history_only)
{
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
LLFloaterNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterNearbyChat>("nearby_chat", LLSD());
nearby_chat->addMessage(chat, true, LLSD());
}
else

View File

@ -35,7 +35,7 @@
#include "llfloaterreg.h"
#include "lllocalcliprect.h"
#include "lltrans.h"
#include "llnearbychatbar.h"
// #include "llnearbychatbar.h" // <FS:Zi> Remove floating chat bar
#include "llviewercontrol.h"
#include "llagentdata.h"
@ -46,6 +46,8 @@
#include "rlvhandler.h"
// [/RLVa:KB]
#include "llfloaternearbychat.h" // <FS:Zi> Remove floating chat bar
static const S32 msg_left_offset = 10;
static const S32 msg_right_offset = 10;
static const S32 msg_height_pad = 5;
@ -326,12 +328,18 @@ BOOL LLNearbyChatToastPanel::handleMouseUp (S32 x, S32 y, MASK mask)
return TRUE;
else
{
LLNearbyChatBar::getInstance()->showHistory();
// <FS:Zi> Remove floating chat bar
// LLNearbyChatBar::getInstance()->showHistory();
LLFloaterNearbyChat::getInstance()->setVisible(TRUE);
// </FS:Zi>
return FALSE;
}
}
LLNearbyChatBar::getInstance()->showHistory();
// <FS:Zi> Remove floating chat bar
// LLNearbyChatBar::getInstance()->showHistory();
LLFloaterNearbyChat::getInstance()->setVisible(TRUE);
// </FS:Zi>
return LLPanel::handleMouseUp(x,y,mask);
}

View File

@ -74,7 +74,10 @@ void LLFirstUse::resetFirstUse()
// static
void LLFirstUse::otherAvatarChatFirst(bool enable)
{
firstUseNotification("FirstOtherChatBeforeUser", enable, "HintChat", LLSD(), LLSD().with("target", "chat_bar").with("direction", "top_right").with("distance", 24));
// <FS:Zi> Remove floating chat bar
// firstUseNotification("FirstOtherChatBeforeUser", enable, "HintChat", LLSD(), LLSD().with("target", "chat_bar").with("direction", "top_right").with("distance", 24));
firstUseNotification("FirstOtherChatBeforeUser", enable, "HintChat", LLSD(), LLSD().with("target", "nearby_chat").with("direction", "top_right").with("distance", 24));
// </FS:Zi>
}
// static

View File

@ -0,0 +1,648 @@
/**
* @file llfloaternearbychat.cpp
* @brief Nearby chat history scrolling panel implementation
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
* Copyright (C) 2012, Zi Ree @ Second Life
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llfloaternearbychat.h"
#include "llviewercontrol.h"
#include "llviewerwindow.h"
#include "llrootview.h"
//#include "llchatitemscontainerctrl.h"
#include "lliconctrl.h"
#include "llspinctrl.h"
#include "llfloatersidepanelcontainer.h"
#include "llfocusmgr.h"
#include "lllogchat.h"
#include "llresizebar.h"
#include "llresizehandle.h"
#include "llmenugl.h"
#include "llviewermenu.h"//for gMenuHolder
#include "llnearbychathandler.h"
// #include "llnearbychatbar.h" // <FS:Zi> Remove floating chat bar
#include "llnearbychathub.h"
#include "llchannelmanager.h"
#include "llagent.h" // gAgent
#include "llchathistory.h"
#include "llstylemap.h"
#include "llavatarnamecache.h"
#include "lldraghandle.h"
// #include "llnearbychatbar.h" // <FS:Zi> Remove floating chat bar
#include "llfloaterreg.h"
#include "lltrans.h"
// IM
#include "llbutton.h"
#include "lllayoutstack.h"
#include "llimfloatercontainer.h"
#include "llimfloater.h"
#include "lllineeditor.h"
//AO - includes for textentry
#include "rlvhandler.h"
#include "llcommandhandler.h"
#include "llkeyboard.h"
#include "llgesturemgr.h"
#include "llmultigesture.h"
#include "llconsole.h"
#include "fscontactsfloater.h"
// <FS:Zi> Moved nearby chat functionality here for now
#include "chatbar_as_cmdline.h"
#include "llanimationstates.h" // ANIM_AGENT_WHISPER, ANIM_AGENT_TALK, ANIM_AGENT_SHOUT
#include "llviewerstats.h"
// </FS:Zi>
static const S32 RESIZE_BAR_THICKNESS = 3;
// ## Zi // static LLRegisterPanelClassWrapper<LLNearbyChat> t_panel_nearby_chat("panel_nearby_chat");
LLFloaterNearbyChat::LLFloaterNearbyChat(const LLSD& key)
: LLDockableFloater(NULL, false, false, key)
,mChatHistory(NULL)
,mInputEditor(NULL)
{
}
LLFloaterNearbyChat::~LLFloaterNearbyChat()
{
}
void LLFloaterNearbyChat::updateFSUseNearbyChatConsole(const LLSD &data)
{
FSUseNearbyChatConsole = data.asBoolean();
if (FSUseNearbyChatConsole)
{
LLNotificationsUI::LLScreenChannelBase* chat_channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(LLUUID(gSavedSettings.getString("NearByChatChannelUUID")));
if(chat_channel)
{
chat_channel->removeToastsFromChannel();
}
gConsole->setVisible(!getVisible());
}
else
{
gConsole->setVisible(FALSE);
}
}
BOOL LLFloaterNearbyChat::postBuild()
{
//menu
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
enable_registrar.add("NearbyChat.Check", boost::bind(&LLFloaterNearbyChat::onNearbyChatCheckContextMenuItem, this, _2));
registrar.add("NearbyChat.Action", boost::bind(&LLFloaterNearbyChat::onNearbyChatContextMenuItemClicked, this, _2));
LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_nearby_chat.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
if(menu)
mPopupMenuHandle = menu->getHandle();
gSavedSettings.declareS32("nearbychat_showicons_and_names",2,"NearByChat header settings",true);
mInputEditor = getChild<LLLineEditor>("chat_box");
mInputEditor->setEnabled(TRUE);
gSavedSettings.getControl("FSNearbyChatbar")->getCommitSignal()->connect(boost::bind(&LLFloaterNearbyChat::onChatBarVisibilityChanged, this));
gSavedSettings.getControl("FSShowChatChannel")->getCommitSignal()->connect(boost::bind(&LLFloaterNearbyChat::onChatChannelVisibilityChanged, this));
onChatBarVisibilityChanged();
onChatChannelVisibilityChanged();
// extra icon controls -AO
LLButton* transl = getChild<LLButton>("translate_btn");
transl->setVisible(true);
childSetCommitCallback("chat_history_btn",onHistoryButtonClicked,this);
mChatHistory = getChild<LLChatHistory>("chat_history");
// Nicky D.; FIRE-3066: Force creation or FSFLoaterContacts here, this way it will register with LLAvatarTracker early enough.
// Otherwise it is only create if isChatMultriTab() == true and LLIMFloaterContainer::getInstance is called
LLFloater *pContacts(FSFloaterContacts::getInstance());
// Do something with pContacts so no overzealous optimizer optimzes our neat little call to FSFloaterContacts::getInstance() away.
if( pContacts )
llinfos << "Constructed " << pContacts->getTitle() << llendl;
// Nicky D.; End FIRE-3066
// <vertical tab docking> -AO
if(isChatMultiTab())
{
LLButton* slide_left = getChild<LLButton>("slide_left_btn");
slide_left->setVisible(false);
LLButton* slide_right = getChild<LLButton>("slide_right_btn");
slide_right->setVisible(false);
if (getDockControl() == NULL)
{
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
if (floater_container)
{
if (gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
// first set the tear-off host to this floater
setHost(floater_container);
// clear the tear-off host right after, the "last host used" will still stick
setHost(NULL);
// reparent the floater to the main view
gFloaterView->addChild(this);
}
else
{
floater_container->addFloater(this, FALSE);
}
floater_container->setVisible(FALSE);
}
}
FSUseNearbyChatConsole = gSavedSettings.getBOOL("FSUseNearbyChatConsole");
gSavedSettings.getControl("FSUseNearbyChatConsole")->getSignal()->connect(boost::bind(&LLFloaterNearbyChat::updateFSUseNearbyChatConsole, this, _2));
// <FS:Ansariel> Show window title according to docking state
mDragHandle->setTitleVisible(gSavedSettings.getBOOL("ChatHistoryTornOff"));
return LLDockableFloater::postBuild();
}
if(!LLDockableFloater::postBuild())
return false;
return true;
}
std::string appendTime()
{
time_t utc_time;
utc_time = time_corrected();
std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:["
+LLTrans::getString("TimeMin")+"]";
if (gSavedSettings.getBOOL("FSSecondsinChatTimestamps"))
{
timeStr += ":["
+LLTrans::getString("TimeSec")+"]";
}
LLSD substitution;
substitution["datetime"] = (S32) utc_time;
LLStringUtil::format (timeStr, substitution);
return timeStr;
}
void LLFloaterNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args)
{
LLChat& tmp_chat = const_cast<LLChat&>(chat);
bool use_plain_text_chat_history = gSavedSettings.getBOOL("PlainTextChatHistory");
bool hide_timestamps_nearby_chat = gSavedSettings.getBOOL("FSHideTimestampsNearbyChat");
// [FIRE-1641 : SJ]: Option to hide timestamps in nearby chat - only add Timestamp when hide_timestamps_nearby_chat is not TRUE
if (!hide_timestamps_nearby_chat)
{
if(tmp_chat.mTimeStr.empty())
tmp_chat.mTimeStr = appendTime();
}
if (!chat.mMuted)
{
tmp_chat.mFromName = chat.mFromName;
LLSD chat_args = args;
chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history;
chat_args["hide_timestamps_nearby_chat"] = hide_timestamps_nearby_chat;
mChatHistory->appendMessage(chat, chat_args);
}
if(archive)
{
mMessageArchive.push_back(chat);
if(mMessageArchive.size()>200)
mMessageArchive.erase(mMessageArchive.begin());
}
if (args["do_not_log"].asBoolean())
{
return;
}
// AO: IF tab mode active, flash our tab
if(isChatMultiTab())
{
LLMultiFloater* hostp = getHost();
if( !isInVisibleChain()
&& hostp)
{
hostp->setFloaterFlashing(this, TRUE);
}
}
if (gSavedPerAccountSettings.getBOOL("LogNearbyChat"))
{
std::string from_name = chat.mFromName;
if (chat.mSourceType == CHAT_SOURCE_AGENT)
{
// if the chat is coming from an agent, log the complete name
LLAvatarName av_name;
LLAvatarNameCache::get(chat.mFromID, &av_name);
if (!av_name.mIsDisplayNameDefault)
{
from_name = av_name.getCompleteName();
}
// Ansariel: Handle IMs in nearby chat
if (gSavedSettings.getBOOL("FSShowIMInChatHistory") && chat.mChatType == CHAT_TYPE_IM)
{
if (gSavedSettings.getBOOL("FSLogIMInChatHistory"))
{
from_name = "IM: " + from_name;
}
else return;
}
}
LLLogChat::saveHistory("chat", from_name, chat.mFromID, chat.mText);
}
}
// virtual
BOOL LLFloaterNearbyChat::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash)
{
mInputEditor->setFocus(TRUE);
onTabInto();
if(focus_flash)
{
gFocusMgr.triggerFocusFlash();
}
return TRUE;
}
void LLFloaterNearbyChat::onNearbySpeakers()
{
LLSD param;
param["people_panel_tab_name"] = "nearby_panel";
LLFloaterSidePanelContainer::showPanel("people", "panel_people", param);
}
// static
void LLFloaterNearbyChat::onHistoryButtonClicked(LLUICtrl* ctrl, void* userdata)
{
gViewerWindow->getWindow()->openFile(LLLogChat::makeLogFileName("chat"));
}
void LLFloaterNearbyChat::onNearbyChatContextMenuItemClicked(const LLSD& userdata)
{
}
bool LLFloaterNearbyChat::onNearbyChatCheckContextMenuItem(const LLSD& userdata)
{
std::string str = userdata.asString();
if(str == "nearby_people")
onNearbySpeakers();
return false;
}
void LLFloaterNearbyChat::onChatBarVisibilityChanged()
{
getChild<LLLayoutPanel>("chat_bar_visibility_panel")->setVisible(gSavedSettings.getBOOL("FSNearbyChatbar"));
}
void LLFloaterNearbyChat::onChatChannelVisibilityChanged()
{
getChild<LLLayoutPanel>("channel_spinner_visibility_panel")->setVisible(gSavedSettings.getBOOL("FSShowChatChannel"));
}
void LLFloaterNearbyChat::openFloater(const LLSD& key)
{
// We override this to put nearbychat in the IM floater. -AO
if(isChatMultiTab())
{
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
// only show the floater container if we are actually attached -Zi
if (floater_container && !gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
floater_container->showFloater(this, LLTabContainer::START);
}
setVisible(TRUE);
LLFloater::openFloater(key);
}
}
void LLFloaterNearbyChat::removeScreenChat()
{
LLNotificationsUI::LLScreenChannelBase* chat_channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(LLUUID(gSavedSettings.getString("NearByChatChannelUUID")));
if(chat_channel)
{
chat_channel->removeToastsFromChannel();
}
}
void LLFloaterNearbyChat::setVisible(BOOL visible)
{
if(visible)
{
removeScreenChat();
}
LLDockableFloater::setVisible(visible);
// <Ansariel> Support for chat console
static LLCachedControl<bool> chatHistoryTornOff(gSavedSettings, "ChatHistoryTornOff");
if (FSUseNearbyChatConsole)
{
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
if (floater_container && !chatHistoryTornOff && !floater_container->getVisible())
{
// In case the nearby chat is docked into the IM floater and the
// IM floater is invisible, always show the console.
gConsole->setVisible(TRUE);
}
else
{
// In case the nearby chat is undocked OR docked and the IM floater
// is visible, show console only if nearby chat is not visible.
gConsole->setVisible(!getVisible());
}
}
// </Ansariel> Support for chat console
}
void LLFloaterNearbyChat::onOpen(const LLSD& key )
{
// We override this to put nearbychat in the IM floater. -AO
if(isChatMultiTab() && ! isVisible(this))
{
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
// only show the floater container if we are actually attached -Zi
if (floater_container && !gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
floater_container->showFloater(this, LLTabContainer::START);
}
setVisible(TRUE);
}
LLDockableFloater::onOpen(key);
}
void LLFloaterNearbyChat::setRect (const LLRect &rect)
{
LLDockableFloater::setRect(rect);
}
void LLFloaterNearbyChat::getAllowedRect(LLRect& rect)
{
rect = gViewerWindow->getWorldViewRectScaled();
}
// exported here for "clrchat" command line -Zi
void LLFloaterNearbyChat::clearChatHistory()
{
mChatHistory->clear();
}
void LLFloaterNearbyChat::updateChatHistoryStyle()
{
clearChatHistory();
LLSD do_not_log;
do_not_log["do_not_log"] = true;
for(std::vector<LLChat>::iterator it = mMessageArchive.begin();it!=mMessageArchive.end();++it)
{
// Update the messages without re-writing them to a log file.
addMessage(*it,false, do_not_log);
}
}
//static
void LLFloaterNearbyChat::processChatHistoryStyleUpdate(const LLSD& newvalue)
{
LLFloaterNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterNearbyChat>("nearby_chat", LLSD());
if(nearby_chat)
nearby_chat->updateChatHistoryStyle();
}
bool isWordsName(const std::string& name)
{
// checking to see if it's display name plus username in parentheses
S32 open_paren = name.find(" (", 0);
S32 close_paren = name.find(')', 0);
if (open_paren != std::string::npos &&
close_paren == name.length()-1)
{
return true;
}
else
{
//checking for a single space
S32 pos = name.find(' ', 0);
return std::string::npos != pos && name.rfind(' ', name.length()) == pos && 0 != pos && name.length()-1 != pos;
}
}
// this probably belongs in LLNearbyChatControl
// virtual
BOOL LLFloaterNearbyChat::handleKeyHere( KEY key, MASK mask )
{
BOOL handled = FALSE;
EChatType type = CHAT_TYPE_NORMAL; // won't get used as such
if( KEY_RETURN == key )
{
llinfos << "Handling return key, mask=" << mask << llendl;
if (mask == MASK_CONTROL)
{
// shout
type = CHAT_TYPE_SHOUT;
handled = TRUE;
}
else if (mask == MASK_SHIFT)
{
// whisper
type = CHAT_TYPE_WHISPER;
handled = TRUE;
}
else if (mask == MASK_ALT)
{
// OOC
type = CHAT_TYPE_OOC;
handled = TRUE;
}
// Ansariel: For some reason we don't get an unmasked return here.
// So we use the child commit callback that invokes
// LLNearbyChat::onSendMsg() to handle this case.
//else if (mask == MASK_NONE)
//{
// // say
// type = CHAT_TYPE_NORMAL;
// handled = TRUE;
//}
}
if (handled == TRUE)
{
LLNearbyChat::getInstance()->sendChat(mInputEditor->getConvertedText(),type);
}
return handled;
}
void LLFloaterNearbyChat::loadHistory()
{
LLSD do_not_log;
do_not_log["do_not_log"] = true;
std::list<LLSD> history;
LLLogChat::loadAllHistory("chat", history);
std::list<LLSD>::const_iterator it = history.begin();
while (it != history.end())
{
bool im_type = false;
const LLSD& msg = *it;
std::string from = msg[IM_FROM];
LLUUID from_id;
if (msg[IM_FROM_ID].isDefined())
{
from_id = msg[IM_FROM_ID].asUUID();
}
else
{
// Ansariel: Strip IM prefix so we can properly
// retrieve the UUID in case we got a
// saved IM in nearby chat history.
std::string im_prefix = "IM: ";
size_t im_prefix_found = from.find(im_prefix);
if (im_prefix_found != std::string::npos)
{
from = from.substr(im_prefix.length());
im_type = true;
}
std::string legacy_name = gCacheName->buildLegacyName(from);
gCacheName->getUUID(legacy_name, from_id);
}
LLChat chat;
chat.mFromName = from;
chat.mFromID = from_id;
chat.mText = msg[IM_TEXT].asString();
chat.mTimeStr = msg[IM_TIME].asString();
chat.mChatStyle = CHAT_STYLE_HISTORY;
if (im_type) chat.mChatType = CHAT_TYPE_IM;
chat.mSourceType = CHAT_SOURCE_AGENT;
if (from_id.isNull() && SYSTEM_FROM == from)
{
chat.mSourceType = CHAT_SOURCE_SYSTEM;
}
else if (from_id.isNull())
{
chat.mSourceType = isWordsName(from) ? CHAT_SOURCE_UNKNOWN : CHAT_SOURCE_OBJECT;
}
addMessage(chat, true, do_not_log);
it++;
}
}
//static
LLFloaterNearbyChat* LLFloaterNearbyChat::getInstance()
{
return LLFloaterReg::getTypedInstance<LLFloaterNearbyChat>("nearby_chat", LLSD());
}
bool LLFloaterNearbyChat::isChatMultiTab()
{
// Restart is required in order to change chat window type.
static bool is_single_window = gSavedSettings.getS32("ChatWindow") == 1;
return is_single_window;
}
void LLFloaterNearbyChat::setDocked(bool docked, bool pop_on_undock)
{
if((!isChatMultiTab()) && gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
mDragHandle->setTitleVisible(docked); // <FS:Ansariel> Show window title according to docking state
LLDockableFloater::setDocked(docked, pop_on_undock);
}
}
// <FS:Ansariel> Show window title according to docking state
void LLFloaterNearbyChat::setTornOff(bool torn_off)
{
mDragHandle->setTitleVisible(torn_off);
LLDockableFloater::setTornOff(torn_off);
}
// </FS:Ansariel> Show window title according to docking state
BOOL LLFloaterNearbyChat::getVisible()
{
if(isChatMultiTab())
{
LLIMFloaterContainer* im_container = LLIMFloaterContainer::getInstance();
// Treat inactive floater as invisible.
bool is_active = im_container->getActiveFloater() == this;
//torn off floater is always inactive
if (!is_active && getHost() != im_container)
{
return LLDockableFloater::getVisible();
}
// getVisible() returns TRUE when Tabbed IM window is minimized.
return is_active && !im_container->isMinimized() && im_container->getVisible();
}
else
{
return LLDockableFloater::getVisible();
}
}

View File

@ -0,0 +1,121 @@
/**
* @file llfloaternearbychat.h
* @brief Nearby chat history scrolling panel implementation
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
* Copyright (C) 2012, Zi Ree @ Second Life
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLFLOATERNEARBYCHAT_H
#define LL_LLFLOATERNEARBYCHAT_H
#include "lldockablefloater.h"
#include "llscrollbar.h"
#include "llviewerchat.h"
class LLResizeBar;
class LLChatHistory;
// <FS:Zi> Nearby chat bar class
// class LLLineEditor;
#include "lllineeditor.h"
#include "llsingleton.h"
// </FS:Zi>
class LLFloaterNearbyChat: public LLDockableFloater
{
public:
LLFloaterNearbyChat(const LLSD& key);
~LLFloaterNearbyChat();
BOOL postBuild ();
/** @param archive true - to save a message to the chat history log */
void addMessage (const LLChat& message,bool archive = true, const LLSD &args = LLSD());
void onNearbyChatContextMenuItemClicked(const LLSD& userdata);
bool onNearbyChatCheckContextMenuItem(const LLSD& userdata);
void onChatBarVisibilityChanged();
void onChatChannelVisibilityChanged();
// This doesn't seem to apply anymore? It makes the chat and spin box colors
// appear wrong when focused and unfocused, so disable this. -Zi
#if 0
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual void draw();
// focus overrides
/*virtual*/ void onFocusLost();
/*virtual*/ void onFocusReceived();
#endif
/*virtual*/ void onOpen (const LLSD& key);
/*virtual*/ void setVisible(BOOL visible);
void openFloater(const LLSD& key);
virtual void setRect (const LLRect &rect);
void clearChatHistory();
virtual void updateChatHistoryStyle();
static void processChatHistoryStyleUpdate(const LLSD& newvalue);
void loadHistory();
static LLFloaterNearbyChat* getInstance();
void removeScreenChat();
static bool isChatMultiTab();
void setDocked(bool docked, bool pop_on_undock = true);
/*virtual*/ void setTornOff(bool torn_off); // <FS:Ansariel> Needed to show window title according to docking state
BOOL getVisible();
static void onHistoryButtonClicked(LLUICtrl* ctrl, void* userdata);
// overridden to fix the multitab focus bug -Zi
BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
void updateFSUseNearbyChatConsole(const LLSD &data);
private:
void getAllowedRect (LLRect& rect);
void onNearbySpeakers ();
void setTyping(bool typing);
virtual BOOL handleKeyHere( KEY key, MASK mask );
private:
LLHandle<LLView> mPopupMenuHandle;
LLChatHistory* mChatHistory;
std::vector<LLChat> mMessageArchive;
LLLineEditor* mInputEditor;
BOOL FSUseNearbyChatConsole;
};
#endif

View File

@ -56,7 +56,10 @@
#include "llkeyboard.h"
#include "llmodaldialog.h"
#include "llnavigationbar.h"
#include "llnearbychat.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychat.h"
#include "llfloaternearbychat.h"
// </FS:Zi>
#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "llnotificationtemplate.h"
@ -477,11 +480,11 @@ BOOL LLFloaterPreference::postBuild()
{
gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&LLIMFloater::processChatHistoryStyleUpdate, _2));
gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&LLNearbyChat::processChatHistoryStyleUpdate, _2));
gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&LLFloaterNearbyChat::processChatHistoryStyleUpdate, _2));
gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLIMFloater::processChatHistoryStyleUpdate, _2));
gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLNearbyChat::processChatHistoryStyleUpdate, _2));
gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterNearbyChat::processChatHistoryStyleUpdate, _2));
gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged));

View File

@ -29,7 +29,7 @@
#include "llfloatertranslationsettings.h"
// Viewer includes
#include "llnearbychatbar.h"
// #include "llnearbychatbar.h" // <FS:Zi> Remove floating chat bar
#include "lltranslate.h"
#include "llviewercontrol.h" // for gSavedSettings
@ -293,6 +293,9 @@ void LLFloaterTranslationSettings::onBtnOK()
gSavedSettings.setString("TranslationService", getSelectedService());
gSavedSettings.setString("BingTranslateAPIKey", getEnteredBingKey());
gSavedSettings.setString("GoogleTranslateAPIKey", getEnteredGoogleKey());
LLNearbyChatBar::getInstance()->enableTranslationCheckbox(LLTranslate::isTranslationConfigured());
// <FS:Zi> Remove floating chat bar
// LLNearbyChatBar::getInstance()->enableTranslationCheckbox(LLTranslate::isTranslationConfigured());
// TODO: Add code to make this happen via control callback within LLNearbyChat
// </FS:Zi>
closeFloater(false);
}

View File

@ -51,10 +51,10 @@
#include "llviewermessage.h"
#include "llvoavatarself.h"
#include "llviewerstats.h"
//#include "llnearbychatbar.h"
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a)
#include "llnearbychatbarbase.h"
// [/SL:KB]
// <FS:Zi> Remove floating chat bar
// #include "llnearbychatbar.h"
#include "llnearbychathub.h"
// </FS:Zi>
#include "llappearancemgr.h"
#include "llgesturelistener.h"
@ -1010,10 +1010,10 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step)
const BOOL animate = FALSE;
// LLNearbyChatBar::getInstance()->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate);
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
LLNearbyChatBarBase::sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate);
// [/SL:KB]
// <FS:Zi> Remove floating chat bar
// LLNearbyChatBar::getInstance()->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate);
LLNearbyChat::getInstance()->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate);
// </FS:Zi>
gesture->mCurrentStep++;
break;

View File

@ -34,8 +34,7 @@
#include "llgroupiconctrl.h"
#include "llagent.h"
#include "lltransientfloatermgr.h"
#include "llnearbychat.h"
#include "llfloaternearbychat.h"
#include "fscontactsfloater.h"
#include "llfloater.h"
#include "llviewercontrol.h"
@ -81,26 +80,23 @@ void LLIMFloaterContainer::onOpen(const LLSD& key)
// But only if it hasnt been already so we can reopen it to the same tab -KC
// Improved handling to leave most of the work to the LL tear-off code -Zi
// ND_MERGE
// LLPanel* floater = LLNearbyChat::getInstance();
// if (! LLFloater::isVisible(floater) && (floater->getHost() != this))
// {
// if (gSavedSettings.getBOOL("ChatHistoryTornOff"))
// {
// // first set the tear-off host to this floater
// floater->setHost(this);
// // clear the tear-off host right after, the "last host used" will still stick
// floater->setHost(NULL);
// // reparent to floater view
// gFloaterView->addChild(floater);
// }
// else
// {
// LLMultiFloater::showFloater(floater);
// }
// }
// /ND_MERGE
LLFloater* floater = LLFloaterNearbyChat::getInstance();
if (! LLFloater::isVisible(floater) && (floater->getHost() != this))
{
if (gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
// first set the tear-off host to this floater
floater->setHost(this);
// clear the tear-off host right after, the "last host used" will still stick
floater->setHost(NULL);
// reparent to floater view
gFloaterView->addChild(floater);
}
else
{
LLMultiFloater::showFloater(floater);
}
}
/*
if (key.isDefined())

View File

@ -37,7 +37,10 @@
#include "llavatarnamecache.h"
#include "llconsole.h"
#include "llfloaterreg.h"
#include "llnearbychat.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychat.h"
#include "llfloaternearbychat.h"
// </FS:Zi>
#include "rlvhandler.h"
#include "lggcontactsets.h"
@ -203,6 +206,6 @@ void LLIMHandler::onAvatarNameLookup(const LLUUID& agent_id, const LLAvatarName&
}
gConsole->addConsoleLine("IM: " + senderName + delimiter + message, textColor);
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
LLFloaterNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterNearbyChat>("nearby_chat", LLSD());
gConsole->setVisible(!nearby_chat->getVisible());
}

View File

@ -57,7 +57,10 @@
#include "llviewerwindow.h"
#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "llnearbychat.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychat.h"
#include "llfloaternearbychat.h"
// </FS:Zi>
#include "llspeakers.h" //for LLIMSpeakerMgr
#include "lltextbox.h"
#include "lltoolbarview.h"
@ -852,7 +855,7 @@ bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from,
chat.mSourceType = CHAT_SOURCE_AGENT;
chat.mText = utf8_text;
chat.mTimeStr = timestr;
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
LLFloaterNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterNearbyChat>("nearby_chat", LLSD());
nearby_chat->addMessage(chat, true, LLSD());
}
// </Ansariel>
@ -2603,8 +2606,11 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess
LLChat chat(message);
chat.mSourceType = CHAT_SOURCE_SYSTEM;
LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar");
LLNearbyChat* nearby_chat = chat_bar->findChild<LLNearbyChat>("nearby_chat");
// <FS:Zi> Remove floating chat bar
// LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar");
// LLNearbyChat* nearby_chat = chat_bar->findChild<LLNearbyChat>("nearby_chat");
LLFloaterNearbyChat* nearby_chat = LLFloaterNearbyChat::getInstance();
// </FS:Zi>
if(nearby_chat)
{

View File

@ -1,825 +1,5 @@
/**
* @file LLNearbyChat.cpp
* @brief Nearby chat history scrolling panel implementation
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
/*
#include "llviewerprecompiledheaders.h"
This file is not used by Firestorm. It's being kept in place to track merges.
#include "llnearbychat.h"
#include "llviewercontrol.h"
#include "llviewerwindow.h"
#include "llrootview.h"
//#include "llchatitemscontainerctrl.h"
#include "lliconctrl.h"
#include "llspinctrl.h"
#include "llfloatersidepanelcontainer.h"
#include "llfocusmgr.h"
#include "lllogchat.h"
#include "llresizebar.h"
#include "llresizehandle.h"
#include "llmenugl.h"
#include "llviewermenu.h"//for gMenuHolder
#include "llnearbychathandler.h"
#include "llnearbychatbar.h"
#include "llchannelmanager.h"
#include "llagent.h" // gAgent
#include "llchathistory.h"
#include "llstylemap.h"
#include "llavatarnamecache.h"
#include "lldraghandle.h"
#include "llnearbychatbar.h"
#include "llfloaterreg.h"
#include "lltrans.h"
// IM
#include "llbutton.h"
#include "lllayoutstack.h"
#include "llimfloatercontainer.h"
#include "llimfloater.h"
#include "lllineeditor.h"
//AO - includes for textentry
#include "rlvhandler.h"
#include "llcommandhandler.h"
#include "llkeyboard.h"
#include "llgesturemgr.h"
#include "llmultigesture.h"
#include "llconsole.h"
#include "fscontactsfloater.h"
static const S32 RESIZE_BAR_THICKNESS = 3;
struct LLChatTypeTrigger {
std::string name;
EChatType type;
};
static LLChatTypeTrigger sChatTypeTriggers[] = {
{ "/whisper" , CHAT_TYPE_WHISPER},
{ "/shout" , CHAT_TYPE_SHOUT}
};
// ## Zi // static LLRegisterPanelClassWrapper<LLNearbyChat> t_panel_nearby_chat("panel_nearby_chat");
LLNearbyChat::LLNearbyChat(const LLSD& key)
: LLDockableFloater(NULL, false, false, key)
,mChatHistory(NULL)
,mInputEditor(NULL)
{
}
LLNearbyChat::~LLNearbyChat()
{
}
void LLNearbyChat::updateFSUseNearbyChatConsole(const LLSD &data)
{
FSUseNearbyChatConsole = data.asBoolean();
if (FSUseNearbyChatConsole)
{
LLNotificationsUI::LLScreenChannelBase* chat_channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(LLUUID(gSavedSettings.getString("NearByChatChannelUUID")));
if(chat_channel)
{
chat_channel->removeToastsFromChannel();
}
gConsole->setVisible(!getVisible());
}
else
{
gConsole->setVisible(FALSE);
}
}
BOOL LLNearbyChat::postBuild()
{
//menu
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
enable_registrar.add("NearbyChat.Check", boost::bind(&LLNearbyChat::onNearbyChatCheckContextMenuItem, this, _2));
registrar.add("NearbyChat.Action", boost::bind(&LLNearbyChat::onNearbyChatContextMenuItemClicked, this, _2));
LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_nearby_chat.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
if(menu)
mPopupMenuHandle = menu->getHandle();
gSavedSettings.declareS32("nearbychat_showicons_and_names",2,"NearByChat header settings",true);
// Text Entry - relay to llnearbychatbar
mInputEditor = getChild<LLLineEditor>("chat_box");
//mInputEditor->setMaxTextLength(1023);
mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) );
mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this) );
mInputEditor->setKeystrokeCallback( onInputEditorKeystroke, this );
childSetCommitCallback("chat_box", onSendMsg, this);
mInputEditor->setEnableLineHistory(TRUE);
mInputEditor->setIgnoreArrowKeys( FALSE );
mInputEditor->setCommitOnFocusLost( FALSE );
mInputEditor->setRevertOnEsc( FALSE );
mInputEditor->setIgnoreTab( TRUE );
mInputEditor->setReplaceNewlinesWithSpaces( FALSE );
mInputEditor->setPassDelete( TRUE );
mInputEditor->setEnabled(TRUE);
gSavedSettings.getControl("FSNearbyChatbar")->getCommitSignal()->connect(boost::bind(&LLNearbyChat::onChatBarVisibilityChanged, this));
gSavedSettings.getControl("FSShowChatChannel")->getCommitSignal()->connect(boost::bind(&LLNearbyChat::onChatChannelVisibilityChanged, this));
onChatBarVisibilityChanged();
onChatChannelVisibilityChanged();
// extra icon controls -AO
LLButton* transl = getChild<LLButton>("translate_btn");
transl->setVisible(true);
childSetCommitCallback("chat_history_btn",onHistoryButtonClicked,this);
mChatHistory = getChild<LLChatHistory>("chat_history");
// Nicky D.; FIRE-3066: Force creation or FSFLoaterContacts here, this way it will register with LLAvatarTracker early enough.
// Otherwise it is only create if isChatMultriTab() == true and LLIMFloaterContainer::getInstance is called
LLFloater *pContacts(FSFloaterContacts::getInstance());
// Do something with pContacts so no overzealous optimizer optimzes our neat little call to FSFloaterContacts::getInstance() away.
if( pContacts )
llinfos << "Constructed " << pContacts->getTitle() << llendl;
// Nicky D.; End FIRE-3066
// <vertical tab docking> -AO
if(isChatMultiTab())
{
LLButton* slide_left = getChild<LLButton>("slide_left_btn");
slide_left->setVisible(false);
LLButton* slide_right = getChild<LLButton>("slide_right_btn");
slide_right->setVisible(false);
if (getDockControl() == NULL)
{
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
if (floater_container)
{
if (gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
// first set the tear-off host to this floater
setHost(floater_container);
// clear the tear-off host right after, the "last host used" will still stick
setHost(NULL);
// reparent the floater to the main view
gFloaterView->addChild(this);
}
else
{
floater_container->addFloater(this, FALSE);
}
floater_container->setVisible(FALSE);
}
}
FSUseNearbyChatConsole = gSavedSettings.getBOOL("FSUseNearbyChatConsole");
gSavedSettings.getControl("FSUseNearbyChatConsole")->getSignal()->connect(boost::bind(&LLNearbyChat::updateFSUseNearbyChatConsole, this, _2));
// <FS:Ansariel> Show window title according to docking state
mDragHandle->setTitleVisible(gSavedSettings.getBOOL("ChatHistoryTornOff"));
return LLDockableFloater::postBuild();
}
if(!LLDockableFloater::postBuild())
return false;
return true;
}
std::string appendTime()
{
time_t utc_time;
utc_time = time_corrected();
std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:["
+LLTrans::getString("TimeMin")+"]";
if (gSavedSettings.getBOOL("FSSecondsinChatTimestamps"))
{
timeStr += ":["
+LLTrans::getString("TimeSec")+"]";
}
LLSD substitution;
substitution["datetime"] = (S32) utc_time;
LLStringUtil::format (timeStr, substitution);
return timeStr;
}
void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args)
{
LLChat& tmp_chat = const_cast<LLChat&>(chat);
bool use_plain_text_chat_history = gSavedSettings.getBOOL("PlainTextChatHistory");
bool hide_timestamps_nearby_chat = gSavedSettings.getBOOL("FSHideTimestampsNearbyChat");
// [FIRE-1641 : SJ]: Option to hide timestamps in nearby chat - only add Timestamp when hide_timestamps_nearby_chat is not TRUE
if (!hide_timestamps_nearby_chat)
{
if(tmp_chat.mTimeStr.empty())
tmp_chat.mTimeStr = appendTime();
}
if (!chat.mMuted)
{
tmp_chat.mFromName = chat.mFromName;
LLSD chat_args = args;
chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history;
chat_args["hide_timestamps_nearby_chat"] = hide_timestamps_nearby_chat;
mChatHistory->appendMessage(chat, chat_args);
}
if(archive)
{
mMessageArchive.push_back(chat);
if(mMessageArchive.size()>200)
mMessageArchive.erase(mMessageArchive.begin());
}
if (args["do_not_log"].asBoolean())
{
return;
}
// AO: IF tab mode active, flash our tab
if(isChatMultiTab())
{
LLMultiFloater* hostp = getHost();
if( !isInVisibleChain()
&& hostp)
{
hostp->setFloaterFlashing(this, TRUE);
}
}
if (gSavedPerAccountSettings.getBOOL("LogNearbyChat"))
{
std::string from_name = chat.mFromName;
if (chat.mSourceType == CHAT_SOURCE_AGENT)
{
// if the chat is coming from an agent, log the complete name
LLAvatarName av_name;
LLAvatarNameCache::get(chat.mFromID, &av_name);
if (!av_name.mIsDisplayNameDefault)
{
from_name = av_name.getCompleteName();
}
// Ansariel: Handle IMs in nearby chat
if (gSavedSettings.getBOOL("FSShowIMInChatHistory") && chat.mChatType == CHAT_TYPE_IM)
{
if (gSavedSettings.getBOOL("FSLogIMInChatHistory"))
{
from_name = "IM: " + from_name;
}
else return;
}
}
LLLogChat::saveHistory("chat", from_name, chat.mFromID, chat.mText);
}
}
// virtual
BOOL LLNearbyChat::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash)
{
mInputEditor->setFocus(TRUE);
onTabInto();
if(focus_flash)
{
gFocusMgr.triggerFocusFlash();
}
return TRUE;
}
void LLNearbyChat::onNearbySpeakers()
{
LLSD param;
param["people_panel_tab_name"] = "nearby_panel";
LLFloaterSidePanelContainer::showPanel("people", "panel_people", param);
}
// static
void LLNearbyChat::onHistoryButtonClicked(LLUICtrl* ctrl, void* userdata)
{
gViewerWindow->getWindow()->openFile(LLLogChat::makeLogFileName("chat"));
}
void LLNearbyChat::onNearbyChatContextMenuItemClicked(const LLSD& userdata)
{
}
bool LLNearbyChat::onNearbyChatCheckContextMenuItem(const LLSD& userdata)
{
std::string str = userdata.asString();
if(str == "nearby_people")
onNearbySpeakers();
return false;
}
void LLNearbyChat::onChatBarVisibilityChanged()
{
getChild<LLLayoutPanel>("chat_bar_visibility_panel")->setVisible(gSavedSettings.getBOOL("FSNearbyChatbar"));
}
void LLNearbyChat::onChatChannelVisibilityChanged()
{
getChild<LLLayoutPanel>("channel_spinner_visibility_panel")->setVisible(gSavedSettings.getBOOL("FSShowChatChannel"));
}
void LLNearbyChat::openFloater(const LLSD& key)
{
// We override this to put nearbychat in the IM floater. -AO
if(isChatMultiTab())
{
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
// only show the floater container if we are actually attached -Zi
if (floater_container && !gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
floater_container->showFloater(this, LLTabContainer::START);
}
setVisible(TRUE);
LLFloater::openFloater(key);
}
}
void LLNearbyChat::removeScreenChat()
{
LLNotificationsUI::LLScreenChannelBase* chat_channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(LLUUID(gSavedSettings.getString("NearByChatChannelUUID")));
if(chat_channel)
{
chat_channel->removeToastsFromChannel();
}
}
void LLNearbyChat::setVisible(BOOL visible)
{
if(visible)
{
removeScreenChat();
}
LLDockableFloater::setVisible(visible);
// <Ansariel> Support for chat console
static LLCachedControl<bool> chatHistoryTornOff(gSavedSettings, "ChatHistoryTornOff");
if (FSUseNearbyChatConsole)
{
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
if (floater_container && !chatHistoryTornOff && !floater_container->getVisible())
{
// In case the nearby chat is docked into the IM floater and the
// IM floater is invisible, always show the console.
gConsole->setVisible(TRUE);
}
else
{
// In case the nearby chat is undocked OR docked and the IM floater
// is visible, show console only if nearby chat is not visible.
gConsole->setVisible(!getVisible());
}
}
// </Ansariel> Support for chat console
}
void LLNearbyChat::onOpen(const LLSD& key )
{
// We override this to put nearbychat in the IM floater. -AO
if(isChatMultiTab() && ! isVisible(this))
{
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
// only show the floater container if we are actually attached -Zi
if (floater_container && !gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
floater_container->showFloater(this, LLTabContainer::START);
}
setVisible(TRUE);
}
LLDockableFloater::onOpen(key);
}
void LLNearbyChat::setRect (const LLRect &rect)
{
LLDockableFloater::setRect(rect);
}
void LLNearbyChat::getAllowedRect(LLRect& rect)
{
rect = gViewerWindow->getWorldViewRectScaled();
}
// exported here for "clrchat" command line -Zi
void LLNearbyChat::clearChatHistory()
{
mChatHistory->clear();
}
void LLNearbyChat::updateChatHistoryStyle()
{
clearChatHistory();
LLSD do_not_log;
do_not_log["do_not_log"] = true;
for(std::vector<LLChat>::iterator it = mMessageArchive.begin();it!=mMessageArchive.end();++it)
{
// Update the messages without re-writing them to a log file.
addMessage(*it,false, do_not_log);
}
}
//static
void LLNearbyChat::processChatHistoryStyleUpdate(const LLSD& newvalue)
{
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
if(nearby_chat)
nearby_chat->updateChatHistoryStyle();
}
bool isWordsName(const std::string& name)
{
// checking to see if it's display name plus username in parentheses
S32 open_paren = name.find(" (", 0);
S32 close_paren = name.find(')', 0);
if (open_paren != std::string::npos &&
close_paren == name.length()-1)
{
return true;
}
else
{
//checking for a single space
S32 pos = name.find(' ', 0);
return std::string::npos != pos && name.rfind(' ', name.length()) == pos && 0 != pos && name.length()-1 != pos;
}
}
void LLNearbyChat::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata )
{
// <FS:ND> ND_MERGE code from FS commented out, causes endless recursion
// LLNearbyChatBar::getInstance()->onChatBoxFocusReceived();
// </FS:ND>
}
void LLNearbyChat::onInputEditorFocusLost(LLFocusableElement* caller, void* userdata)
{
// <FS:ND> ND_MERGE code from FS commented out, causes endless recursion
// LLNearbyChatBar::getInstance()->onChatBoxFocusLost();
// </FS:ND>
}
void LLNearbyChat::onInputEditorKeystroke(LLLineEditor* caller, void* userdata)
{
LLNearbyChat* self = (LLNearbyChat*)userdata;
LLWString raw_text = self->mInputEditor->getWText();
// Can't trim the end, because that will cause autocompletion
// to eat trailing spaces that might be part of a gesture.
LLWStringUtil::trimHead(raw_text);
S32 length = raw_text.length();
// Get the currently selected channel from the channel spinner in the nearby chat bar, if present and used.
// NOTE: Parts of the gAgent.startTyping() code are duplicated in 3 places:
// - llnearbychatbar.cpp
// - llchatbar.cpp
// - llnearbychat.cpp
// So be sure to look in all three places if changes are needed. This needs to be addressed at some point.
// -Zi
S32 channel=0;
if (gSavedSettings.getBOOL("FSNearbyChatbar") &&
gSavedSettings.getBOOL("FSShowChatChannel"))
{
channel = (S32)(LLNearbyChat::getInstance()->getChild<LLSpinCtrl>("ChatChannel")->get());
}
// -Zi
// if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences
// [RLVa:KB] - Checked: 2010-03-26 (RLVa-1.2.0b) | Modified: RLVa-1.0.0d
if ( (length > 0) && (raw_text[0] != '/') && (!gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT)) )
// [/RLVa:KB]
{
// only start typing animation if we are chatting without / on channel 0 -Zi
if(channel==0)
gAgent.startTyping();
}
else
{
gAgent.stopTyping();
}
KEY key = gKeyboard->currentKey();
// Ignore "special" keys, like backspace, arrows, etc.
if (length > 1
&& raw_text[0] == '/'
&& key < KEY_SPECIAL)
{
// we're starting a gesture, attempt to autocomplete
std::string utf8_trigger = wstring_to_utf8str(raw_text);
std::string utf8_out_str(utf8_trigger);
if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str))
{
std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
self->mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
S32 outlength = self->mInputEditor->getLength(); // in characters
// Select to end of line, starting from the character
// after the last one the user typed.
self->mInputEditor->setSelection(length, outlength);
}
else if (matchChatTypeTrigger(utf8_trigger, &utf8_out_str))
{
std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
self->mInputEditor->setText(utf8_trigger + rest_of_match + " "); // keep original capitalization for user-entered part
self->mInputEditor->setCursorToEnd();
}
}
}
void LLNearbyChat::doSendMsg( std::string msg, EChatType type )
{
LLNearbyChatBar* masterBar = LLNearbyChatBar::getInstance();
std::string masterText = masterBar->getCurrentChat();
masterBar->setText(msg);
masterBar->sendChat(type);
mInputEditor->setText(LLStringExplicit(""));
masterBar->setText(masterText);
}
void LLNearbyChat::onSendMsg( LLUICtrl* ctrl, void* userdata )
{
LLNearbyChat* self = (LLNearbyChat*)userdata;
std::string sendText = self->mInputEditor->getText();
self->doSendMsg(sendText,CHAT_TYPE_NORMAL);
}
// virtual
BOOL LLNearbyChat::handleKeyHere( KEY key, MASK mask )
{
BOOL handled = FALSE;
EChatType type = CHAT_TYPE_NORMAL; // won't get used as such
if( KEY_RETURN == key )
{
llinfos << "Handling return key, mask=" << mask << llendl;
if (mask == MASK_CONTROL)
{
// shout
type = CHAT_TYPE_SHOUT;
handled = TRUE;
}
else if (mask == MASK_SHIFT)
{
// whisper
type = CHAT_TYPE_WHISPER;
handled = TRUE;
}
else if (mask == MASK_ALT)
{
// OOC
type = CHAT_TYPE_OOC;
handled = TRUE;
}
// Ansariel: For some reason we don't get an unmasked return here.
// So we use the child commit callback that invokes
// LLNearbyChat::onSendMsg() to handle this case.
//else if (mask == MASK_NONE)
//{
// // say
// type = CHAT_TYPE_NORMAL;
// handled = TRUE;
//}
}
if (handled == TRUE)
{
doSendMsg(mInputEditor->getText(),type);
}
return handled;
}
BOOL LLNearbyChat::matchChatTypeTrigger(const std::string& in_str, std::string* out_str)
{
U32 in_len = in_str.length();
S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers);
for (S32 n = 0; n < cnt; n++)
{
if (in_len > sChatTypeTriggers[n].name.length())
continue;
std::string trigger_trunc = sChatTypeTriggers[n].name;
LLStringUtil::truncate(trigger_trunc, in_len);
if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc))
{
*out_str = sChatTypeTriggers[n].name;
return TRUE;
}
}
return FALSE;
}
void LLNearbyChat::loadHistory()
{
LLSD do_not_log;
do_not_log["do_not_log"] = true;
std::list<LLSD> history;
LLLogChat::loadAllHistory("chat", history);
std::list<LLSD>::const_iterator it = history.begin();
while (it != history.end())
{
bool im_type = false;
const LLSD& msg = *it;
std::string from = msg[IM_FROM];
LLUUID from_id;
if (msg[IM_FROM_ID].isDefined())
{
from_id = msg[IM_FROM_ID].asUUID();
}
else
{
// Ansariel: Strip IM prefix so we can properly
// retrieve the UUID in case we got a
// saved IM in nearby chat history.
std::string im_prefix = "IM: ";
size_t im_prefix_found = from.find(im_prefix);
if (im_prefix_found != std::string::npos)
{
from = from.substr(im_prefix.length());
im_type = true;
}
std::string legacy_name = gCacheName->buildLegacyName(from);
gCacheName->getUUID(legacy_name, from_id);
}
LLChat chat;
chat.mFromName = from;
chat.mFromID = from_id;
chat.mText = msg[IM_TEXT].asString();
chat.mTimeStr = msg[IM_TIME].asString();
chat.mChatStyle = CHAT_STYLE_HISTORY;
if (im_type) chat.mChatType = CHAT_TYPE_IM;
chat.mSourceType = CHAT_SOURCE_AGENT;
if (from_id.isNull() && SYSTEM_FROM == from)
{
chat.mSourceType = CHAT_SOURCE_SYSTEM;
}
else if (from_id.isNull())
{
chat.mSourceType = isWordsName(from) ? CHAT_SOURCE_UNKNOWN : CHAT_SOURCE_OBJECT;
}
addMessage(chat, true, do_not_log);
it++;
}
}
//static
LLNearbyChat* LLNearbyChat::getInstance()
{
return LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
}
bool LLNearbyChat::isChatMultiTab()
{
// Restart is required in order to change chat window type.
static bool is_single_window = gSavedSettings.getS32("ChatWindow") == 1;
return is_single_window;
}
void LLNearbyChat::setDocked(bool docked, bool pop_on_undock)
{
if((!isChatMultiTab()) && gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
mDragHandle->setTitleVisible(docked); // <FS:Ansariel> Show window title according to docking state
LLDockableFloater::setDocked(docked, pop_on_undock);
}
}
// <FS:Ansariel> Show window title according to docking state
void LLNearbyChat::setTornOff(bool torn_off)
{
mDragHandle->setTitleVisible(torn_off);
LLDockableFloater::setTornOff(torn_off);
}
// </FS:Ansariel> Show window title according to docking state
BOOL LLNearbyChat::getVisible()
{
if(isChatMultiTab())
{
LLIMFloaterContainer* im_container = LLIMFloaterContainer::getInstance();
// Treat inactive floater as invisible.
bool is_active = im_container->getActiveFloater() == this;
//torn off floater is always inactive
if (!is_active && getHost() != im_container)
{
return LLDockableFloater::getVisible();
}
// getVisible() returns TRUE when Tabbed IM window is minimized.
return is_active && !im_container->isMinimized() && im_container->getVisible();
}
else
{
return LLDockableFloater::getVisible();
}
}
// This doesn't seem to apply anymore? It makes the chat and spin box colors
// appear wrong when focused and unfocused, so disable this. -Zi
#if 0
////////////////////////////////////////////////////////////////////////////////
//
void LLNearbyChat::onFocusReceived()
{
setBackgroundOpaque(true);
LLPanel::onFocusReceived();
}
////////////////////////////////////////////////////////////////////////////////
//
void LLNearbyChat::onFocusLost()
{
setBackgroundOpaque(false);
LLPanel::onFocusLost();
}
BOOL LLNearbyChat::handleMouseDown(S32 x, S32 y, MASK mask)
{
//fix for EXT-6625
//highlight NearbyChat history whenever mouseclick happen in NearbyChat
//setting focus to eidtor will force onFocusLost() call that in its turn will change
//background opaque. This all happenn since NearByChat is "chrome" and didn't process focus change.
if(mChatHistory)
mChatHistory->setFocus(TRUE);
return LLDockableFloater::handleMouseDown(x, y, mask);
}
void LLNearbyChat::draw()
{
// *HACK: Update transparency type depending on whether our children have focus.
// This is needed because this floater is chrome and thus cannot accept focus, so
// the transparency type setting code from LLFloater::setFocus() isn't reached.
if (getTransparencyType() != TT_DEFAULT)
{
setTransparencyType(hasFocus() ? TT_ACTIVE : TT_INACTIVE);
}
LLDockableFloater::draw();
}
#endif
*/

View File

@ -1,124 +1,5 @@
/**
* @file llnearbychat.h
* @brief nearby chat history scrolling panel implementation
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
/*
#ifndef LL_LLNEARBYCHAT_H_
#define LL_LLNEARBYCHAT_H_
This file is not used by Firestorm. It's being kept in place to track merges.
#include "lldockablefloater.h"
#include "llscrollbar.h"
#include "llviewerchat.h"
class LLResizeBar;
class LLChatHistory;
class LLLineEditor;
class LLNearbyChat: public LLDockableFloater
{
public:
LLNearbyChat(const LLSD& key);
~LLNearbyChat();
BOOL postBuild ();
/** @param archive true - to save a message to the chat history log */
void addMessage (const LLChat& message,bool archive = true, const LLSD &args = LLSD());
void onNearbyChatContextMenuItemClicked(const LLSD& userdata);
bool onNearbyChatCheckContextMenuItem(const LLSD& userdata);
void onChatBarVisibilityChanged();
void onChatChannelVisibilityChanged();
// This doesn't seem to apply anymore? It makes the chat and spin box colors
// appear wrong when focused and unfocused, so disable this. -Zi
#if 0
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual void draw();
// focus overrides
/*virtual*/ void onFocusLost();
/*virtual*/ void onFocusReceived();
#endif
/*virtual*/ void onOpen (const LLSD& key);
/*virtual*/ void setVisible(BOOL visible);
void openFloater(const LLSD& key);
virtual void setRect (const LLRect &rect);
void clearChatHistory();
virtual void updateChatHistoryStyle();
static void processChatHistoryStyleUpdate(const LLSD& newvalue);
void loadHistory();
static LLNearbyChat* getInstance();
void removeScreenChat();
static bool isChatMultiTab();
void setDocked(bool docked, bool pop_on_undock = true);
/*virtual*/ void setTornOff(bool torn_off); // <FS:Ansariel> Needed to show window title according to docking state
BOOL getVisible();
void doSendMsg( std::string msg, EChatType type);
static void onSendMsg( LLUICtrl*, void*);
void sendMsg();
static void onHistoryButtonClicked(LLUICtrl* ctrl, void* userdata);
// overridden to fix the multitab focus bug -Zi
BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
void updateFSUseNearbyChatConsole(const LLSD &data);
private:
void getAllowedRect (LLRect& rect);
void onNearbySpeakers ();
void setTyping(bool typing);
static void onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata );
static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str);
virtual BOOL handleKeyHere( KEY key, MASK mask );
private:
LLHandle<LLView> mPopupMenuHandle;
LLChatHistory* mChatHistory;
std::vector<LLChat> mMessageArchive;
LLLineEditor* mInputEditor;
BOOL FSUseNearbyChatConsole;
};
#endif
*/

File diff suppressed because it is too large Load Diff

View File

@ -1,169 +1,5 @@
/**
* @file llnearbychatbar.h
* @brief LLNearbyChatBar class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
/*
#ifndef LL_LLNEARBYCHATBAR_H
#define LL_LLNEARBYCHATBAR_H
This file is not used by Firestorm. It's being kept in place to track merges.
#include "llfloater.h"
#include "llcombobox.h"
#include "llgesturemgr.h"
#include "llchat.h"
#include "llvoiceclient.h"
#include "lloutputmonitorctrl.h"
#include "llspeakers.h"
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-08-20 (Catznip-3.2.0a)
#include "llnearbychatbarbase.h"
class LLNearbyChat;
// [/SL:KB]
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
class LLNearbyChatBarSingle
: public LLPanel
, public LLNearbyChatBarBase
{
public:
LLNearbyChatBarSingle();
/*virtual*/ ~LLNearbyChatBarSingle() {}
public:
/*virtual*/ void draw();
/*virtual*/ BOOL postBuild();
protected:
void displaySpeakingIndicator();
void onChatBoxCommit();
void onChatFontChange(LLFontGL* fontp);
// LLNearbyChatBarBase overrides
public:
/*virtual*/ LLUICtrl* getChatBoxCtrl() { return mChatBox; }
/*virtual*/ LLWString getChatBoxText() { return mChatBox->getConvertedText(); }
/*virtual*/ void setChatBoxText(const LLStringExplicit& text) { mChatBox->setText(text); }
/*virtual*/ void setChatBoxCursorToEnd() { mChatBox->setCursorToEnd(); }
protected:
LLLineEditor* mChatBox;
LLOutputMonitorCtrl* mOutputMonitor;
LLLocalSpeakerMgr* mSpeakerMgr;
};
// [/SL:KB]
class LLNearbyChatBar : public LLFloater
{
public:
// constructor for inline chat-bars (e.g. hosted in chat history window)
LLNearbyChatBar(const LLSD& key);
~LLNearbyChatBar() {}
virtual BOOL postBuild();
static LLNearbyChatBar* getInstance();
// LLLineEditor* getChatBox() { return mChatBox; }
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
LLNearbyChatBarBase* getChatBarImpl() const { return mChatBarImpl; }
// [/SL:KB]
// virtual void draw();
std::string getCurrentChat();
virtual BOOL handleKeyHere( KEY key, MASK mask );
static void startChat(const char* line);
static void stopChat();
// static void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate);
// static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate);
// <AO>, moved to public so we can relay from other textentries.
void onChatBoxFocusLost()
{ mChatBarImpl->onChatBoxFocusLost(); }
void onChatBoxFocusReceived()
{ mChatBarImpl->onChatBoxFocusReceived(); }
void onChatBoxCommit();
// </AO>
void setText(const LLStringExplicit &new_text);
void showHistory();
void enableTranslationCheckbox(BOOL enable);
// /*virtual*/void setMinimized(BOOL b);
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-11-17 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
/*virtual*/ BOOL canClose();
/*virtual*/ void onOpen(const LLSD& sdKey);
// [/SL:KB]
void sendChat( EChatType type )
{ mChatBarImpl->sendChat( type ); }
protected:
// static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str);
// static void onChatBoxKeystroke(LLLineEditor* caller, void* userdata);
// static void onChatBoxFocusLost(LLFocusableElement* caller, void* userdata);
// void onChatBoxFocusReceived();
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-11-12 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
bool onNewNearbyChatMsg(const LLSD& sdEvent);
void onTearOff(const LLSD& sdData);
// [/SL:KB]
//void onChatBoxCommit(); // moved to public
// void onChatFontChange(LLFontGL* fontp);
/* virtual */ bool applyRectControl();
void onToggleNearbyChatPanel();
// static LLWString stripChannelNumber(const LLWString &mesg, S32* channel);
// EChatType processChatTypeTriggers(EChatType type, std::string &str);
// void displaySpeakingIndicator();
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
public:
static const std::string& getFloaterXMLFile();
static bool isTabbedNearbyChat();
static void processFloaterTypeChanged();
protected:
static void* createChatBarSingle(void*);
static void* createChatBarMulti(void*);
// [/SL:KB]
// // Which non-zero channel did we last chat on?
// static S32 sLastSpecialChatChannel;
//
// LLLineEditor* mChatBox;
// LLOutputMonitorCtrl* mOutputMonitor;
// LLLocalSpeakerMgr* mSpeakerMgr;
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
LLPanel* mNearbyChatContainer; // "panel_nearby_chat" is the parent panel containing "nearby_chat"
LLNearbyChat* mNearbyChat; // "nearby_chat"
LLNearbyChatBarBase* mChatBarImpl;
// [/SL:KB]
S32 mExpandedHeight;
};
#endif
*/

View File

@ -1,67 +1,5 @@
/**
*
* Copyright (c) 2011, Kitty Barnett
*
* The source code in this file is provided to you under the terms of the
* GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt
* in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt
*
* By copying, modifying or distributing this software, you acknowledge that
* you have read and understood your obligations described above, and agree to
* abide by those obligations.
*
*/
#ifndef LL_LLNEARBYCHATBARBASE_H
#define LL_LLNEARBYCHATBARBASE_H
/*
#include "llchat.h"
#include "lluictrl.h"
This file is not used by Firestorm. It's being kept in place to track merges.
class LLNearbyChatBarBase
{
public:
LLNearbyChatBarBase();
static LLNearbyChatBarBase* findInstance();
static void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate);
static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate);
public:
void sendChat(EChatType type);
virtual LLUICtrl* getChatBoxCtrl() = 0;
virtual LLWString getChatBoxText() = 0;
virtual void setChatBoxText(const LLStringExplicit& text) = 0;
virtual void setChatBoxCursorToEnd() = 0;
// <FS:ND> moved from nearbychatbar
BOOL playChatAnimations() const
{ return FSPlayChatAnimation; }
// <FS:ND>
//protected: // <FS:ND> need this for nearbychatbar
void onChatBoxFocusLost();
void onChatBoxFocusReceived();
protected:
void onChatBoxKeystroke();
static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str);
static EChatType processChatTypeTriggers(EChatType type, std::string &str);
static LLWString stripChannelNumber(const LLWString &mesg, S32* channel);
protected:
// Which non-zero channel did we last chat on?
static S32 sLastSpecialChatChannel;
private:
// <FS:ND> moved from nearbychatbar
void updateFSPlayChatAnimation(const LLSD &data);
BOOL FSPlayChatAnimation;
// </FS:ND>
};
#endif // LL_LLNEARBYCHATBARBASE_H
*/

View File

@ -29,22 +29,24 @@
#include "llviewerprecompiledheaders.h"
#include "llnearbychatbarlistener.h"
#include "llnearbychatbar.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychatbar.h"
#include "llnearbychathub.h"
// </FS:Zi>
#include "llagent.h"
#include "llchat.h"
//LLNearbyChatBarListener::LLNearbyChatBarListener(LLNearbyChatBar & chatbar)
// <FS:Zi> Remove floating chat bar
// LLNearbyChatBarListener::LLNearbyChatBarListener(LLNearbyChatBar & chatbar)
// : LLEventAPI("LLChatBar",
// "LLChatBar listener to (e.g.) sendChat, etc."),
// mChatbar(chatbar)
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
LLNearbyChatBarListener::LLNearbyChatBarListener(LLNearbyChatBar& chatbar)
LLNearbyChatBarListener::LLNearbyChatBarListener()
: LLEventAPI("LLChatBar",
"LLChatBar listener to (e.g.) sendChat, etc.")
// [/SL:KB]
// </FS:Zi>
{
add("sendChat",
"Send chat to the simulator:\n"
@ -100,9 +102,9 @@ void LLNearbyChatBarListener::sendChat(LLSD const & chat_data) const
}
// Send it as if it was typed in
// mChatbar.sendChatFromViewer(chat_to_send, type_o_chat, (BOOL)(channel == 0));
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
LLNearbyChatBarBase::sendChatFromViewer(chat_to_send, type_o_chat, (BOOL)(channel == 0));
// [/SL:KB]
// <FS:Zi> Remove floating chat bar
// mChatbar.sendChatFromViewer(chat_to_send, type_o_chat, (BOOL)(channel == 0));
LLNearbyChat::getInstance()->sendChatFromViewer(chat_to_send, type_o_chat, (BOOL)(channel == 0));
// <FS:Zi>
}

View File

@ -33,12 +33,15 @@
#include "lleventapi.h"
class LLSD;
class LLNearbyChatBar;
// class LLNearbyChatBar; // <FS:Zi> Remove floating chat bar
class LLNearbyChatBarListener : public LLEventAPI
{
public:
LLNearbyChatBarListener(LLNearbyChatBar & chatbar);
// <FS:Zi> Remove floating chat bar
// LLNearbyChatBarListener(LLNearbyChatBar & chatbar);
LLNearbyChatBarListener();
// </FS:Zi>
private:
void sendChat(LLSD const & chat_data) const;

View File

@ -1,152 +1,5 @@
/**
*
* Copyright (c) 2011, Kitty Barnett
*
* The source code in this file is provided to you under the terms of the
* GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt
* in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt
*
* By copying, modifying or distributing this software, you acknowledge that
* you have read and understood your obligations described above, and agree to
* abide by those obligations.
*
*/
#include "llviewerprecompiledheaders.h"
/*
#include "llagent.h"
#include "llfirstuse.h"
#include "llfloater.h"
#include "llgesturemgr.h"
#include "llkeyboard.h"
#include "llnearbychatbarmulti.h"
#include "llviewercontrol.h"
This file is not used by Firestorm. It's being kept in place to track merges.
LLNearbyChatBarMulti::LLNearbyChatBarMulti()
{
// Initialize current history line iterator
mCurrentHistoryLine = mLineHistory.begin();
}
BOOL LLNearbyChatBarMulti::postBuild()
{
m_pChatEditor = findChild<LLTextEditor>("chat_editor");
m_pChatEditor->setCommitCallback(boost::bind(&LLNearbyChatBarMulti::onChatBoxCommit, this, CHAT_TYPE_NORMAL));
m_pChatEditor->setKeystrokeCallback(boost::bind(&LLNearbyChatBarMulti::onChatBoxKeystroke, this));
m_pChatEditor->setFocusLostCallback(boost::bind(&LLNearbyChatBarMulti::onChatBoxFocusLost, this));
m_pChatEditor->setFocusReceivedCallback(boost::bind(&LLNearbyChatBarMulti::onChatBoxFocusReceived, this));
m_pChatEditor->setCommitOnFocusLost(FALSE);
return TRUE;
}
// virtual
BOOL LLNearbyChatBarMulti::handleKeyHere(KEY key, MASK mask)
{
BOOL handled = FALSE;
if (KEY_RETURN == key)
{
if (MASK_CONTROL == mask)
{
onChatBoxCommit(CHAT_TYPE_SHOUT);
handled = TRUE;
}
else if (MASK_SHIFT == mask)
{
onChatBoxCommit(CHAT_TYPE_WHISPER);
handled = TRUE;
}
}
else if ( (KEY_UP == key) && (MASK_CONTROL == mask) )
{
if (mCurrentHistoryLine > mLineHistory.begin())
{
m_pChatEditor->setText(*(--mCurrentHistoryLine));
m_pChatEditor->endOfDoc();
}
else
{
LLUI::reportBadKeystroke();
}
handled = TRUE;
}
else if ( (KEY_DOWN == key) && (MASK_CONTROL == mask) )
{
if ( (!mLineHistory.empty()) && (mCurrentHistoryLine < mLineHistory.end() - 1) )
{
m_pChatEditor->setText(*(++mCurrentHistoryLine));
m_pChatEditor->endOfDoc();
}
else
{
LLUI::reportBadKeystroke();
}
handled = TRUE;
}
return handled;
}
void LLNearbyChatBarMulti::onChatBoxCommit(EChatType eChatType)
{
if (m_pChatEditor->getLength() > 0)
{
if (!mLineHistory.empty())
{
// When not empty, last line of history should always be blank.
if (mLineHistory.back().empty())
{
// discard the empty line
mLineHistory.pop_back();
}
else
{
LL_WARNS("") << "Last line of history was not blank." << LL_ENDL;
}
}
// Add text to history, ignoring duplicates
if ( (mLineHistory.empty()) || (m_pChatEditor->getText() != mLineHistory.back()) )
{
mLineHistory.push_back(m_pChatEditor->getText());
}
// Restore the blank line and set mCurrentHistoryLine to point at it
mLineHistory.push_back("");
mCurrentHistoryLine = mLineHistory.end() - 1;
// Send the chat
LLNearbyChatBarBase::sendChat(eChatType);
}
else if (gSavedSettings.getBOOL("CloseChatOnEmptyReturn"))
{
// Close if we're the child of a floater
LLFloater* pFloater = getParentByType<LLFloater>();
if (pFloater)
pFloater->closeFloater();
}
gAgent.stopTyping();
}
LLWString LLNearbyChatBarMulti::getChatBoxText()
{
return m_pChatEditor->getWText();
}
void LLNearbyChatBarMulti::setChatBoxText(const LLStringExplicit& text)
{
m_pChatEditor->setText(text);
// Set current history line to end of history.
if (mLineHistory.empty())
{
mCurrentHistoryLine = mLineHistory.end();
}
else
{
mCurrentHistoryLine = mLineHistory.end() - 1;
}
}
*/

View File

@ -1,55 +1,5 @@
/**
*
* Copyright (c) 2011, Kitty Barnett
*
* The source code in this file is provided to you under the terms of the
* GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt
* in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt
*
* By copying, modifying or distributing this software, you acknowledge that
* you have read and understood your obligations described above, and agree to
* abide by those obligations.
*
*/
#ifndef LL_LLNEARBYCHATBARMULTI_H
#define LL_LLNEARBYCHATBARMULTI_H
/*
#include "lllayoutstack.h"
#include "llnearbychatbarbase.h"
#include "lltexteditor.h"
This file is not used by Firestorm. It's being kept in place to track merges.
class LLNearbyChatBarMulti
: public LLPanel
, public LLNearbyChatBarBase
{
public:
LLNearbyChatBarMulti();
/*virtual*/ ~LLNearbyChatBarMulti() {}
virtual BOOL postBuild();
/*virtual*/ LLUICtrl* getChatBoxCtrl() { return m_pChatEditor; }
/*virtual*/ LLWString getChatBoxText();
/*virtual*/ void setChatBoxText(const LLStringExplicit& text);
/*virtual*/ void setChatBoxCursorToEnd() { m_pChatEditor->endOfDoc(); }
protected:
void onChatBoxCommit(EChatType eChatType);
/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
/*
* Member variables
*/
protected:
// Controls
LLTextEditor* m_pChatEditor;
// Line history support
typedef std::vector<std::string> line_history_t;
line_history_t mLineHistory;
line_history_t::iterator mCurrentHistoryLine;
};
#endif // LL_LLNEARBYCHATBARMULTI_H
*/

View File

@ -0,0 +1,234 @@
/**
* @file llnearbychatcontrol.cpp
* @brief Nearby chat input control implementation
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
* Copyright (C) 2012, Zi Ree @ Second Life
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llnearbychatcontrol.h"
#include "llnearbychathub.h"
#include "llfloaternearbychat.h"
// #include "llviewercontrol.h"
// #include "llviewerwindow.h"
// #include "llrootview.h"
//#include "llchatitemscontainerctrl.h"
// #include "lliconctrl.h"
#include "llspinctrl.h"
// #include "llfloatersidepanelcontainer.h"
// #include "llfocusmgr.h"
// #include "lllogchat.h"
// #include "llresizebar.h"
// #include "llresizehandle.h"
#include "llmenugl.h"
#include "llviewermenu.h"//for gMenuHolder
// #include "llnearbychathandler.h"
// #include "llnearbychatbar.h" // <FS:Zi> Remove floating chat bar
// #include "llchannelmanager.h"
#include "llagent.h" // gAgent
// #include "llchathistory.h"
// #include "llstylemap.h"
// #include "llavatarnamecache.h"
// #include "lldraghandle.h"
// #include "llnearbychatbar.h" // <FS:Zi> Remove floating chat bar
// #include "llfloaterreg.h"
// #include "lltrans.h"
// IM
// #include "llbutton.h"
// #include "lllayoutstack.h"
// #include "llimfloatercontainer.h"
// #include "llimfloater.h"
#include "lllineeditor.h"
//AO - includes for textentry
#include "rlvhandler.h"
#include "llcommandhandler.h"
#include "llkeyboard.h"
#include "llgesturemgr.h"
#include "llmultigesture.h"
// #include "llconsole.h"
// #include "fscontactsfloater.h"
// <FS:Zi> Moved nearby chat functionality here for now
// #include "chatbar_as_cmdline.h"
// #include "llanimationstates.h" // ANIM_AGENT_WHISPER, ANIM_AGENT_TALK, ANIM_AGENT_SHOUT
// #include "llviewerstats.h"
// </FS:Zi>
static LLDefaultChildRegistry::Register<LLNearbyChatControl> r("nearby_chat_control");
struct LLChatTypeTrigger {
std::string name;
EChatType type;
};
static LLChatTypeTrigger sChatTypeTriggers[] = {
{ "/whisper" , CHAT_TYPE_WHISPER},
{ "/shout" , CHAT_TYPE_SHOUT}
};
LLNearbyChatControl::LLNearbyChatControl(const LLNearbyChatControl::Params& p) :
LLLineEditor(p)
{
setKeystrokeCallback(onKeystroke,this);
LLNearbyChat::getInstance()->registerChatBar(this);
setEnableLineHistory(TRUE);
setIgnoreArrowKeys( FALSE );
setCommitOnFocusLost( FALSE );
setRevertOnEsc( FALSE );
setIgnoreTab( TRUE );
setReplaceNewlinesWithSpaces( FALSE );
setPassDelete( TRUE );
}
LLNearbyChatControl::~LLNearbyChatControl()
{
}
void LLNearbyChatControl::onCommit()
{
LLNearbyChat::getInstance()->sendChat(getConvertedText(),CHAT_TYPE_NORMAL);
setText(LLStringExplicit(""));
if(gSavedSettings.getBOOL("CloseChatOnReturn"))
{
setFocus(FALSE);
}
if(gSavedSettings.getBOOL("AutohideChatBar") && getName()=="default_chat_bar")
{
setVisible(FALSE);
getParent()->setVisible(FALSE);
}
LLUICtrl::onCommit();
}
void LLNearbyChatControl::onKeystroke(LLLineEditor* caller,void* userdata)
{
LLWString raw_text = caller->getWText();
// Can't trim the end, because that will cause autocompletion
// to eat trailing spaces that might be part of a gesture.
LLWStringUtil::trimHead(raw_text);
S32 length = raw_text.length();
// Get the currently selected channel from the channel spinner in the nearby chat bar, if present and used.
// NOTE: Parts of the gAgent.startTyping() code are duplicated in 3 places:
// - llnearbychatbar.cpp
// - llchatbar.cpp
// - llnearbychat.cpp
// So be sure to look in all three places if changes are needed. This needs to be addressed at some point.
// -Zi
S32 channel=0;
if (gSavedSettings.getBOOL("FSNearbyChatbar") &&
gSavedSettings.getBOOL("FSShowChatChannel"))
{
channel = (S32)(LLFloaterNearbyChat::getInstance()->getChild<LLSpinCtrl>("ChatChannel")->get());
}
// -Zi
// if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences
// [RLVa:KB] - Checked: 2010-03-26 (RLVa-1.2.0b) | Modified: RLVa-1.0.0d
if ( (length > 0) && (raw_text[0] != '/') && (!gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT)) )
// [/RLVa:KB]
{
// only start typing animation if we are chatting without / on channel 0 -Zi
if(channel==0)
gAgent.startTyping();
}
else
{
gAgent.stopTyping();
}
KEY key = gKeyboard->currentKey();
// Ignore "special" keys, like backspace, arrows, etc.
if (length > 1
&& raw_text[0] == '/'
&& key < KEY_SPECIAL)
{
// we're starting a gesture, attempt to autocomplete
std::string utf8_trigger = wstring_to_utf8str(raw_text);
std::string utf8_out_str(utf8_trigger);
if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str))
{
std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
caller->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
S32 outlength = caller->getLength(); // in characters
// Select to end of line, starting from the character
// after the last one the user typed.
caller->setSelection(length, outlength);
}
else if (matchChatTypeTrigger(utf8_trigger, &utf8_out_str))
{
std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
caller->setText(utf8_trigger + rest_of_match + " "); // keep original capitalization for user-entered part
caller->setCursorToEnd();
}
}
}
BOOL LLNearbyChatControl::matchChatTypeTrigger(const std::string& in_str, std::string* out_str)
{
U32 in_len = in_str.length();
S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers);
for (S32 n = 0; n < cnt; n++)
{
if (in_len > sChatTypeTriggers[n].name.length())
continue;
std::string trigger_trunc = sChatTypeTriggers[n].name;
LLStringUtil::truncate(trigger_trunc, in_len);
if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc))
{
*out_str = sChatTypeTriggers[n].name;
return TRUE;
}
}
return FALSE;
}
// send our focus status to the LLNearbyChat hub
void LLNearbyChatControl::setFocus(BOOL focus)
{
LLNearbyChat::instance().setFocusedInputEditor(this,focus);
LLLineEditor::setFocus(focus);
}

View File

@ -0,0 +1,53 @@
/**
* @file llnearbychatcontrol.h
* @brief Nearby chat input control implementation
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
* Copyright (C) 2012, Zi Ree @ Second Life
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLNEARBYCHATCONTROL_H
#define LL_LLNEARBYCHATCONTROL_H
#include "lllineeditor.h"
class LLNearbyChatControl : public LLLineEditor
{
public:
struct Params : public LLInitParam::Block<Params, LLLineEditor::Params> {};
LLNearbyChatControl(const Params& p);
~LLNearbyChatControl();
virtual void setFocus(BOOL focus);
static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str);
private:
// Typing in progress, expand gestures etc.
static void onKeystroke(LLLineEditor* caller,void* userdata);
// Chat data entered to be sent to nearby chat
void onCommit();
};
#endif

View File

@ -34,14 +34,17 @@
#include "llfirstuse.h"
#include "llfloaterscriptdebug.h"
#include "llhints.h"
#include "llnearbychat.h"
// #include "llnearbychat.h" // <FS:Zi> Remove floating chat bar
#include "llrecentpeople.h"
#include "llviewercontrol.h"
#include "llfloaterreg.h"//for LLFloaterReg::getTypedInstance
#include "llviewerwindow.h"//for screen channel position
#include "llnearbychatbar.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychatbar.h"
#include "llfloaternearbychat.h"
// </FS:Zi>
#include "llrootview.h"
#include "lllayoutstack.h"
@ -555,7 +558,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg,
// ## Zi - Post merge fixup ## // LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar");
// ## Zi - Post merge fixup ## // LLNearbyChat* nearby_chat = chat_bar->findChild<LLNearbyChat>("nearby_chat");
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); // ## Zi - Post merge fixup ##
LLFloaterNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterNearbyChat>("nearby_chat", LLSD()); // ## Zi - Post merge fixup ##
// Build notification data
LLSD notification;
@ -823,7 +826,7 @@ void LLNearbyChatHandler::onAvatarNameLookup(const LLUUID& agent_id, const LLAva
LLColor4 chatcolor;
LLViewerChat::getChatColor(chat_msg, chatcolor);
gConsole->addConsoleLine(consoleChat, chatcolor);
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
LLFloaterNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterNearbyChat>("nearby_chat", LLSD());
if( nearby_chat )
gConsole->setVisible(!nearby_chat->getVisible());
}

View File

@ -0,0 +1,479 @@
/**
* @file llnearbychat.cpp
* @brief @brief Nearby chat central class for handling multiple chat input controls
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
* Copyright (C) 2012, Zi Ree @ Second Life
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llnearbychathub.h"
#include "llnearbychatcontrol.h"
#include "llfloaternearbychat.h"
#include "llviewercontrol.h"
#include "llviewerwindow.h"
#include "llrootview.h"
#include "llspinctrl.h"
#include "llfocusmgr.h"
#include "lllogchat.h"
#include "llmenugl.h"
#include "llviewermenu.h"//for gMenuHolder
#include "llnearbychathandler.h"
#include "llchannelmanager.h"
#include "llagent.h" // gAgent
//AO - includes for textentry
#include "rlvhandler.h"
#include "llcommandhandler.h"
#include "llkeyboard.h"
#include "llgesturemgr.h"
#include "llmultigesture.h"
#include "llconsole.h"
// <FS:Zi> Moved nearby chat functionality here
#include "chatbar_as_cmdline.h"
#include "llanimationstates.h" // ANIM_AGENT_WHISPER, ANIM_AGENT_TALK, ANIM_AGENT_SHOUT
#include "llviewerstats.h"
// </FS:Zi>
struct LLChatTypeTrigger {
std::string name;
EChatType type;
};
static LLChatTypeTrigger sChatTypeTriggers[] = {
{ "/whisper" , CHAT_TYPE_WHISPER},
{ "/shout" , CHAT_TYPE_SHOUT}
};
S32 LLNearbyChat::sLastSpecialChatChannel = 0;
LLNearbyChat::LLNearbyChat() :
mDefaultChatBar(NULL),
mFocusedInputEditor(NULL)
{
}
LLNearbyChat::~LLNearbyChat()
{
}
//void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel)
// [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b) | Modified: RLVa-0.2.2a
void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel)
// [/RLVa:KB]
{
// [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b) | Modified: RLVa-1.2.0a
// Only process chat messages (ie not CHAT_TYPE_START, CHAT_TYPE_STOP, etc)
if ( (rlv_handler_t::isEnabled()) && ( (CHAT_TYPE_WHISPER == type) || (CHAT_TYPE_NORMAL == type) || (CHAT_TYPE_SHOUT == type) ) )
{
if (0 == channel)
{
// (We already did this before, but LLChatHandler::handle() calls this directly)
if ( ((CHAT_TYPE_SHOUT == type) || (CHAT_TYPE_NORMAL == type)) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATNORMAL)) )
type = CHAT_TYPE_WHISPER;
else if ( (CHAT_TYPE_SHOUT == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATSHOUT)) )
type = CHAT_TYPE_NORMAL;
else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATWHISPER)) )
type = CHAT_TYPE_NORMAL;
// Redirect chat if needed
if ( ( (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT) || (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE)) ) &&
(gRlvHandler.redirectChatOrEmote(utf8_out_text)) ) )
{
return;
}
// Filter public chat if sendchat restricted
if (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHAT))
gRlvHandler.filterChat(utf8_out_text, true);
}
else
{
// Don't allow chat on a non-public channel if sendchannel restricted (unless the channel is an exception)
if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHANNEL)) && (!gRlvHandler.isException(RLV_BHVR_SENDCHANNEL, channel)) )
return;
// Don't allow chat on debug channel if @sendchat, @redirchat or @rediremote restricted (shows as public chat on viewers)
if (CHAT_CHANNEL_DEBUG == channel)
{
bool fIsEmote = RlvUtil::isEmote(utf8_out_text);
if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHAT)) ||
((!fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT))) ||
((fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE))) )
{
return;
}
}
}
}
// [/RLVa:KB]
LLMessageSystem* msg = gMessageSystem;
if(channel >= 0)
{
msg->newMessageFast(_PREHASH_ChatFromViewer);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ChatData);
msg->addStringFast(_PREHASH_Message, utf8_out_text);
msg->addU8Fast(_PREHASH_Type, type);
msg->addS32("Channel", channel);
}
else
{
msg->newMessage("ScriptDialogReply");
msg->nextBlock("AgentData");
msg->addUUID("AgentID", gAgent.getID());
msg->addUUID("SessionID", gAgent.getSessionID());
msg->nextBlock("Data");
msg->addUUID("ObjectID", gAgent.getID());
msg->addS32("ChatChannel", channel);
msg->addS32("ButtonIndex", 0);
msg->addString("ButtonLabel", utf8_out_text);
}
gAgent.sendReliableMessage();
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT);
}
void LLNearbyChat::sendChatFromViewer(const std::string& utf8text, EChatType type, BOOL animate)
{
sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate);
}
void LLNearbyChat::sendChatFromViewer(const LLWString& wtext, EChatType type, BOOL animate)
{
// Look for "/20 foo" channel chats.
S32 channel = 0;
LLWString out_text = stripChannelNumber(wtext, &channel);
// If "/<number>" is not specified, see if a channel has been set in
// the spinner.
if (gSavedSettings.getBOOL("FSNearbyChatbar") &&
gSavedSettings.getBOOL("FSShowChatChannel") &&
(channel == 0))
{
channel = (S32)(LLFloaterNearbyChat::getInstance()->getChild<LLSpinCtrl>("ChatChannel")->get());
}
std::string utf8_out_text = wstring_to_utf8str(out_text);
std::string utf8_text = wstring_to_utf8str(wtext);
utf8_text = utf8str_trim(utf8_text);
if (!utf8_text.empty())
{
utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1);
}
// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.2.0b) | Modified: RLVa-1.2.0b
if ( (0 == channel) && (rlv_handler_t::isEnabled()) )
{
// Adjust the (public) chat "volume" on chat and gestures (also takes care of playing the proper animation)
if ( ((CHAT_TYPE_SHOUT == type) || (CHAT_TYPE_NORMAL == type)) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATNORMAL)) )
type = CHAT_TYPE_WHISPER;
else if ( (CHAT_TYPE_SHOUT == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATSHOUT)) )
type = CHAT_TYPE_NORMAL;
else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATWHISPER)) )
type = CHAT_TYPE_NORMAL;
animate &= !gRlvHandler.hasBehaviour( (!RlvUtil::isEmote(utf8_text)) ? RLV_BHVR_REDIRCHAT : RLV_BHVR_REDIREMOTE );
}
// [/RLVa:KB]
// Don't animate for chats people can't hear (chat to scripts)
if (animate && (channel == 0))
{
if (type == CHAT_TYPE_WHISPER)
{
lldebugs << "You whisper " << utf8_text << llendl;
gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START);
}
else if (type == CHAT_TYPE_NORMAL)
{
lldebugs << "You say " << utf8_text << llendl;
gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START);
}
else if (type == CHAT_TYPE_SHOUT)
{
lldebugs << "You shout " << utf8_text << llendl;
gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START);
}
else
{
llinfos << "send_chat_from_viewer() - invalid volume" << llendl;
return;
}
}
else
{
if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP)
{
lldebugs << "Channel chat: " << utf8_text << llendl;
}
}
send_chat_from_viewer(utf8_out_text, type, channel);
}
EChatType LLNearbyChat::processChatTypeTriggers(EChatType type, std::string &str)
{
U32 length = str.length();
S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers);
for (S32 n = 0; n < cnt; n++)
{
if (length >= sChatTypeTriggers[n].name.length())
{
std::string trigger = str.substr(0, sChatTypeTriggers[n].name.length());
if (!LLStringUtil::compareInsensitive(trigger, sChatTypeTriggers[n].name))
{
U32 trigger_length = sChatTypeTriggers[n].name.length();
// It's to remove space after trigger name
if (length > trigger_length && str[trigger_length] == ' ')
trigger_length++;
str = str.substr(trigger_length, length);
if (CHAT_TYPE_NORMAL == type)
return sChatTypeTriggers[n].type;
else
break;
}
}
}
return type;
}
// If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20.
// Otherwise returns input and channel 0.
LLWString LLNearbyChat::stripChannelNumber(const LLWString &mesg, S32* channel)
{
if (mesg[0] == '/'
&& mesg[1] == '/')
{
// This is a "repeat channel send"
*channel = sLastSpecialChatChannel;
return mesg.substr(2, mesg.length() - 2);
}
else if (mesg[0] == '/'
&& mesg[1]
&& ( LLStringOps::isDigit(mesg[1])
|| (mesg[1] == '-'
&& LLStringOps::isDigit(mesg[2]))))
{
// This a special "/20" speak on a channel
S32 pos = 0;
if(mesg[1] == '-')
pos++;
// Copy the channel number into a string
LLWString channel_string;
llwchar c;
do
{
c = mesg[pos+1];
channel_string.push_back(c);
pos++;
}
while(c && pos < 64 && LLStringOps::isDigit(c));
// Move the pointer forward to the first non-whitespace char
// Check isspace before looping, so we can handle "/33foo"
// as well as "/33 foo"
while(c && iswspace(c))
{
c = mesg[pos+1];
pos++;
}
sLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10);
if(mesg[1] == '-')
sLastSpecialChatChannel = -sLastSpecialChatChannel;
*channel = sLastSpecialChatChannel;
return mesg.substr(pos, mesg.length() - pos);
}
else
{
// This is normal chat.
*channel = 0;
return mesg;
}
}
void LLNearbyChat::sendChat(LLWString text,EChatType type)
{
LLWStringUtil::trim(text);
if (!text.empty())
{
if(type == CHAT_TYPE_OOC)
{
std::string tempText = wstring_to_utf8str( text );
tempText = gSavedSettings.getString("FSOOCPrefix") + " " + tempText + " " + gSavedSettings.getString("FSOOCPostfix");
text = utf8str_to_wstring(tempText);
}
// Check if this is destined for another channel
S32 channel = 0;
stripChannelNumber(text, &channel);
// If "/<number>" is not specified, see if a channel has been set in
// the spinner.
if (gSavedSettings.getBOOL("FSNearbyChatbar") &&
gSavedSettings.getBOOL("FSShowChatChannel") &&
(channel == 0))
{
channel = (S32)(LLFloaterNearbyChat::getInstance()->getChild<LLSpinCtrl>("ChatChannel")->get());
}
std::string utf8text = wstring_to_utf8str(text);
// Try to trigger a gesture, if not chat to a script.
std::string utf8_revised_text;
if (0 == channel)
{
//-TT Satomi Ahn - Patch MU_OOC
if (gSavedSettings.getBOOL("AutoCloseOOC"))
{
// Try to find any unclosed OOC chat (i.e. an opening
// double parenthesis without a matching closing double
// parenthesis.
if (utf8text.find("(( ") != -1 && utf8text.find("))") == -1)
{
// add the missing closing double parenthesis.
utf8text += " ))";
}
else if (utf8text.find("((") != -1 && utf8text.find("))") == -1)
{
if (utf8text.at(utf8text.length() - 1) == ')')
{
// cosmetic: add a space first to avoid a closing triple parenthesis
utf8text += " ";
}
// add the missing closing double parenthesis.
utf8text += "))";
}
else if (utf8text.find("[[ ") != -1 && utf8text.find("]]") == -1)
{
// add the missing closing double parenthesis.
utf8text += " ]]";
}
else if (utf8text.find("[[") != -1 && utf8text.find("]]") == -1)
{
if (utf8text.at(utf8text.length() - 1) == ']')
{
// cosmetic: add a space first to avoid a closing triple parenthesis
utf8text += " ";
}
// add the missing closing double parenthesis.
utf8text += "]]";
}
}
// Convert MU*s style poses into IRC emotes here.
if (gSavedSettings.getBOOL("AllowMUpose") && utf8text.find(":") == 0 && utf8text.length() > 3)
{
if (utf8text.find(":'") == 0)
{
utf8text.replace(0, 1, "/me");
}
else if (isalpha(utf8text.at(1))) // Do not prevent smileys and such.
{
utf8text.replace(0, 1, "/me ");
}
}
//-TT Satomi Ahn - Patch MU_OOC
// discard returned "found" boolean
LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text);
}
else
{
utf8_revised_text = utf8text;
}
utf8_revised_text = utf8str_trim(utf8_revised_text);
EChatType nType;
if(type == CHAT_TYPE_OOC)
nType = CHAT_TYPE_NORMAL;
else
nType = type;
type = processChatTypeTriggers(nType, utf8_revised_text);
if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, type))
{
// Chat with animation
sendChatFromViewer(utf8_revised_text, type, gSavedSettings.getBOOL("FSPlayChatAnimation"));
}
}
gAgent.stopTyping();
}
// all chat bars call this function and we keep the first or one that's seen as the default
void LLNearbyChat::registerChatBar(LLNearbyChatControl* chatBar)
{
// TODO: make this a Param option "is_default"
if(!mDefaultChatBar || chatBar->getName()=="default_chat_bar")
{
mDefaultChatBar=chatBar;
}
}
// unhide the default nearby chat bar on request (pressing Enter or a letter key)
void LLNearbyChat::showDefaultChatBar(BOOL visible) const
{
if(!mDefaultChatBar)
return;
mDefaultChatBar->getParent()->setVisible(visible);
mDefaultChatBar->setVisible(visible);
mDefaultChatBar->setFocus(visible);
}
// We want to know which nearby chat editor (if any) currently has focus
void LLNearbyChat::setFocusedInputEditor(LLNearbyChatControl* inputEditor,BOOL focus)
{
if(focus)
mFocusedInputEditor=inputEditor;
// only remove focus if the request came from the previously active input editor
// to avoid races
else if(mFocusedInputEditor==inputEditor)
mFocusedInputEditor=NULL;
}
// for the "arrow key moves avatar when chat is empty" hack in llviewerwindow.cpp
BOOL LLNearbyChat::chatIsEmpty() const
{
if(mFocusedInputEditor)
return mFocusedInputEditor->getText().empty();
return TRUE;
}

View File

@ -0,0 +1,66 @@
/**
* @file llnearbychat.h
* @brief Nearby chat central class for handling multiple chat input controls
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
* Copyright (C) 2012, Zi Ree @ Second Life
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLNEARBYCHAT_H
#define LL_LLNEARBYCHAT_H
#include "llsingleton.h"
#include "llviewerchat.h"
class LLNearbyChatControl;
class LLNearbyChat : public LLSingleton<LLNearbyChat>
{
friend class LLSingleton<LLNearbyChat>;
private:
LLNearbyChat();
~LLNearbyChat();
void sendMsg();
static S32 sLastSpecialChatChannel;
LLNearbyChatControl* mDefaultChatBar;
public:
void registerChatBar(LLNearbyChatControl* chatBar);
void showDefaultChatBar(BOOL visible) const;
void sendChat(LLWString text,EChatType type);
LLWString stripChannelNumber(const LLWString &mesg, S32* channel);
EChatType processChatTypeTriggers(EChatType type, std::string &str);
void sendChatFromViewer(const std::string& utf8text, EChatType type, BOOL animate);
void sendChatFromViewer(const LLWString& wtext, EChatType type, BOOL animate);
void setFocusedInputEditor(LLNearbyChatControl* inputEditor,BOOL focus);
BOOL chatIsEmpty() const;
LLNearbyChatControl* mFocusedInputEditor;
};
#endif

View File

@ -36,7 +36,10 @@
#include "llagent.h"
#include "llimfloater.h"
#include "llimview.h"
#include "llnearbychat.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychat.h"
#include "llfloaternearbychat.h"
// </FS:Zi>
#include "llnotificationhandler.h"
#include "llnotifications.h"
// [SL:KB] - Patch: Chat-Logs | Checked: 2010-11-18 (Catznip-2.4.0c) | Added: Catznip-2.4.0c
@ -464,7 +467,7 @@ void LLHandlerUtil::logGroupNoticeToIMGroup(
// static
void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type)
{
LLNearbyChat* nearby_chat = LLNearbyChat::getInstance();
LLFloaterNearbyChat* nearby_chat = LLFloaterNearbyChat::getInstance();
if(nearby_chat)
{
LLChat chat_msg(notification->getMessage());

View File

@ -28,8 +28,11 @@
#include "llviewerprecompiledheaders.h" // must be first include
#include "llfloaterreg.h"
#include "llnearbychat.h"
#include "llnearbychatbar.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychat.h"
// #include "llnearbychatbar.h"
#include "llfloaternearbychat.h"
// </FS:Zi>
#include "llnotificationhandler.h"
#include "llnotifications.h"
#include "lltoastnotifypanel.h"
@ -94,9 +97,12 @@ bool LLTipHandler::processNotification(const LLSD& notify)
LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM);
// don't show toast if Nearby Chat is opened
LLNearbyChat* nearby_chat = LLNearbyChat::getInstance();
LLNearbyChatBar* nearby_chat_bar = LLNearbyChatBar::getInstance();
if (!nearby_chat_bar->isMinimized() && nearby_chat_bar->getVisible() && nearby_chat->getVisible())
LLFloaterNearbyChat* nearby_chat = LLFloaterNearbyChat::getInstance();
// <FS:Zi> Remove floating chat bar
// LLNearbyChatBar* nearby_chat_bar = LLNearbyChatBar::getInstance();
// if (!nearby_chat_bar->isMinimized() && nearby_chat_bar->getVisible() && nearby_chat->getVisible())
if (nearby_chat->getVisible())
// </FS:Zi>
{
return false;
}

View File

@ -77,7 +77,7 @@
#include <time.h>
#include "llnotificationmanager.h"
#include "lllayoutstack.h"
#include "llnearbychatbar.h"
// #include "llnearbychatbar.h" // <FS:Zi> Remove floating chat bar
#include <algorithm>
#include <boost/algorithm/string.hpp>
#include "llcontrol.h"

View File

@ -63,7 +63,10 @@
#include "llmemorystream.h"
#include "llmessageconfig.h"
#include "llmoveview.h"
#include "llnearbychat.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychat.h"
#include "llfloaternearbychat.h"
// </FS:Zi>
#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "llteleporthistory.h"
@ -1568,7 +1571,7 @@ bool idle_startup()
//so I just moved nearby history loading a few states further
if (gSavedPerAccountSettings.getBOOL("LogShowHistory"))
{
LLNearbyChat* nearby_chat = LLNearbyChat::getInstance();
LLFloaterNearbyChat* nearby_chat = LLFloaterNearbyChat::getInstance();
if (nearby_chat) nearby_chat->loadHistory();
}
display_startup();

View File

@ -67,9 +67,6 @@
#include "llvowlsky.h"
#include "llrender.h"
#include "llnavigationbar.h"
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-09-24 (Catznip-3.2.0a)
#include "llnearbychatbar.h"
// [/SL:KB]
#include "llfloatertools.h"
#include "llpaneloutfitsinventory.h"
#include "llpanellogin.h"
@ -808,11 +805,6 @@ void settings_setup_listeners()
gSavedSettings.getControl("_NACL_AntiSpamTime")->getSignal()->connect(boost::bind(&handleNaclAntiSpamTimeChanged, _2));
gSavedSettings.getControl("_NACL_AntiSpamAmount")->getSignal()->connect(boost::bind(&handleNaclAntiSpamAmountChanged, _2));
// NaCl End
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-09-24 (Catznip-3.2.0a) | Added: Catznip-3.0.0a
gSavedSettings.getControl("NearbyChatFloaterBarType")->getSignal()->connect(boost::bind(&LLNearbyChatBar::processFloaterTypeChanged));
gSavedSettings.getControl("NearbyChatFloaterWindow")->getSignal()->connect(boost::bind(&LLNearbyChatBar::processFloaterTypeChanged));
// [/SL:KB]
}
#if TEST_CACHED_CONTROL

View File

@ -119,7 +119,10 @@
#include "llinspectremoteobject.h"
#include "llinspecttoast.h"
#include "llmoveview.h"
#include "llnearbychat.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychat.h"
#include "llfloaternearbychat.h"
// <//FS:Zi>
#include "llpanelblockedlist.h"
#include "llpanelclassified.h"
#include "llpreviewanim.h"
@ -132,7 +135,7 @@
#include "llscriptfloater.h"
#include "llfloatermodelpreview.h"
#include "llcommandhandler.h"
#include "llnearbychatbar.h"
// #include "llnearbychatbar.h" // <FS:Zi> Remove floating chat bar
// *NOTE: Please add files in alphabetical order to keep merges easy.
// ND: And for FS please put yours after this line, for easier merges too
@ -213,12 +216,10 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBump>);
LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCamera>);
LLFloaterReg::add("nearby_chat", "floater_nearby_chat.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLNearbyChat>);
// LLFloaterReg::add("chat_bar", "floater_chat_bar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLNearbyChatBar>);
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-08-24 (Catznip-3.2.0a) | Added: Catznip-2.8.0a
LLFloaterReg::addWithFileCallback("chat_bar", &LLNearbyChatBar::getFloaterXMLFile, (LLFloaterBuildFunc)&LLFloaterReg::build<LLNearbyChatBar>);
// [/SL:KB]
// <FS:Zi> Remove floating chat bar
// LLFloaterReg::add("chat_bar", "floater_chat_bar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLNearbyChatBar>);
LLFloaterReg::add("nearby_chat", "floater_nearby_chat.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNearbyChat>);
// </FS:Zi>
LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCompileQueue>);

View File

@ -40,10 +40,10 @@
#include "llviewermessage.h" // send_guid_sound_trigger
#include "llviewernetwork.h"
#include "llagent.h"
//#include "llnearbychatbar.h"
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a)
#include "llnearbychatbarbase.h"
// [/SL:KB]
// <FS:Zi> Remove floating chat bar
// #include "llnearbychatbar.h"
#include "llnearbychathub.h"
// </FS:Zi>
// Globals
LLViewerGestureList gGestureList;
@ -133,10 +133,9 @@ void LLViewerGesture::doTrigger( BOOL send_chat )
{
// Don't play nodding animation, since that might not blend
// with the gesture animation.
// LLNearbyChatBar::getInstance()->sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE);
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
LLNearbyChatBarBase::sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE);
// [/SL:KB]
// <FS:Zi> Remove floating chat bar
// LLNearbyChatBar::getInstance()->sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE);
LLNearbyChat::getInstance()->sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE);
}
}

View File

@ -31,7 +31,11 @@
#include "llmath.h"
#include "llagent.h"
#include "llagentcamera.h"
#include "llnearbychatbar.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychatbar.h"
#include "llnearbychathub.h"
#include "lllineeditor.h"
// </FS:Zi>
#include "llviewercontrol.h"
#include "llfocusmgr.h"
#include "llmorphview.h"
@ -545,7 +549,10 @@ void stop_moving( EKeystate s )
void start_chat( EKeystate s )
{
// start chat
LLNearbyChatBar::startChat(NULL);
// <FS:Zi> Remove floating chat bar
// LLNearbyChatBar::startChat(NULL);
LLNearbyChat::getInstance()->showDefaultChatBar(TRUE);
// </FS:Zi>
}
void start_gesture( EKeystate s )
@ -570,19 +577,19 @@ void start_gesture( EKeystate s )
if (KEYSTATE_UP == s &&
! (focus_ctrlp && focus_ctrlp->acceptsTextInput()))
{
// if (LLNearbyChatBar::getInstance()->getCurrentChat().empty())
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
if (LLNearbyChatBar::getInstance()->getChatBarImpl()->getChatBoxText().empty())
// [/SL:KB]
// <FS:Zi> Remove floating chat bar
// TODO: This needs the new bottom chat bar to work at all
/* if (LLNearbyChat::getInstance()->getCurrentChat().empty())
{
// No existing chat in chat editor, insert '/'
LLNearbyChatBar::startChat("/");
LLNearbyChat::startChat("/");
}
else
{
// Don't overwrite existing text in chat editor
LLNearbyChatBar::startChat(NULL);
}
LLNearbyChat::startChat(NULL);
}*/
// </FS:Zi>
}
}

View File

@ -67,7 +67,10 @@
#include "llinventoryfunctions.h"
#include "llinventoryobserver.h"
#include "llinventorypanel.h"
#include "llnearbychat.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychat.h"
#include "llfloaternearbychat.h"
// </FS:Zi>
#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "llpanelgrouplandmoney.h"
@ -2340,7 +2343,7 @@ 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;
LLNearbyChat* nearby_chat = LLNearbyChat::getInstance();
LLFloaterNearbyChat* nearby_chat = LLFloaterNearbyChat::getInstance();
if(nearby_chat)
{
nearby_chat->addMessage(chat);
@ -3089,7 +3092,9 @@ 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.
LLNearbyChat* nearby_chat = LLNearbyChat::getInstance();
// <FS:Zi> Can anyone elaborate on this and add to the comment what this
// code is supposed to do exactly?
LLFloaterNearbyChat* nearby_chat = LLFloaterNearbyChat::getInstance();
if(SYSTEM_FROM != name && nearby_chat)
{
chat.mOwnerID = from_id;

View File

@ -189,7 +189,7 @@
#include "llviewerjoystick.h"
#include "llviewernetwork.h"
#include "llpostprocess.h"
#include "llnearbychatbar.h"
// #include "llnearbychatbar.h" // <FS:Zi> Remove floating chat bar
#include "llagentui.h"
#include "llwearablelist.h"
@ -199,7 +199,10 @@
#include "llfloaternotificationsconsole.h"
#include "llnearbychat.h"
// <FS:Zi> Remove floating chat bar
// #include "llnearbychat.h"
#include "llnearbychathub.h"
// </FS:Zi>
#include "llwindowlistener.h"
#include "llviewerwindowlistener.h"
#include "llpaneltopinfobar.h"
@ -2508,28 +2511,23 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
// Traverses up the hierarchy
if( keyboard_focus )
{
LLNearbyChatBar* nearby_chat = LLFloaterReg::findTypedInstance<LLNearbyChatBar>("chat_bar");
// <FS:Zi> Remove floating chat bar
// LLNearbyChatBar* nearby_chat = LLFloaterReg::findTypedInstance<LLNearbyChatBar>("chat_bar");
// if (nearby_chat)
// {
// LLLineEditor* chat_editor = nearby_chat->getChatBox();
//
// // arrow keys move avatar while chatting hack
// if (chat_editor && chat_editor->hasFocus())
// {
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
LLNearbyChatBarBase* pChatBarImpl = (nearby_chat) ? nearby_chat->getChatBarImpl() : NULL;
if ( (pChatBarImpl) && (pChatBarImpl->getChatBoxCtrl()) && (pChatBarImpl->getChatBoxCtrl()->hasFocus()) )
{
// [/SL:KB]
// If text field is empty, there's no point in trying to move
// cursor with arrow keys, so allow movement
// if (chat_editor->getText().empty()
// || gSavedSettings.getBOOL("ArrowKeysAlwaysMove"))
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
if (pChatBarImpl->getChatBoxText().empty()
// if (nearby_chat)
// {
// LLLineEditor* chat_editor = nearby_chat->getChatBox();
// arrow keys move avatar while chatting hack
// if (chat_editor && chat_editor->hasFocus())
// {
// // If text field is empty, there's no point in trying to move
// // cursor with arrow keys, so allow movement
// if (chat_editor->getText().empty()
if(LLNearbyChat::instance().chatIsEmpty()
// </FS:Zi>
|| gSavedSettings.getBOOL("ArrowKeysAlwaysMove"))
// [/SL:KB]
{
// let Control-Up and Control-Down through for chat line history,
if (!(key == KEY_UP && mask == MASK_CONTROL)
@ -2551,8 +2549,10 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
break;
}
}
}
// }
// <FS:Zi> Remove floating chat bar
// }
// }
// </FS:Zi>
}
if (keyboard_focus->handleKey(key, mask, FALSE))
{
@ -2581,23 +2581,22 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
// If "Pressing letter keys starts local chat" option is selected, we are not in mouselook,
// no view has keyboard focus, this is a printable character key (and no modifier key is
// pressed except shift), then give focus to nearby chat (STORM-560)
if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() &&
!keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) )
{
// LLLineEditor* chat_editor = LLFloaterReg::getTypedInstance<LLNearbyChatBar>("chat_bar")->getChatBox();
// if (chat_editor)
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
LLNearbyChatBar* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChatBar>("chat_bar");
if (nearby_chat)
// [/SL:KB]
{
// passing NULL here, character will be added later when it is handled by character handler.
// LLNearbyChatBar::getInstance()->startChat(NULL);
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-10-26 (Catznip-3.2.0a) | Added: Catznip-3.2.0a
nearby_chat->startChat(NULL);
// [/SL:KB]
return TRUE;
}
// <FS:Zi> Remove floating chat bar
// LLLineEditor* chat_editor = LLFloaterReg::getTypedInstance<LLNearbyChatBar>("chat_bar")->getChatBox();
// if (chat_editor)
// {
// // passing NULL here, character will be added later when it is handled by character handler.
// LLNearbyChatBar::getInstance()->startChat(NULL);
// return TRUE;
// }
LLNearbyChat::getInstance()->showDefaultChatBar(TRUE);
return TRUE;
// </FS:Zi>
}
// give menus a chance to handle unmodified accelerator keys

View File

@ -127,7 +127,7 @@
user_resize="false"
width="300">
<line_editor
<nearby_chat_control
layout="topleft"
top="0"
left="0"
@ -139,7 +139,7 @@
label="To nearby chat"
spellcheck="true"
name="chat_box"
tab_group="3" />
tab_group="3" />
</layout_panel>
<layout_panel

View File

@ -130,18 +130,83 @@
</layout_panel>
</layout_stack>
</layout_panel>
<layout_panel name="bottom_toolbar_panel"
auto_resize="false"
user_resize="false"
height="30"
width="1024"
mouse_opaque="false">
<layout_stack name="chat_bar_stack"
orientation="horizontal"
left="0"
top="0"
width="1024"
height="30"
follows="all"
border_width="0"
mouse_opaque="false">
<layout_panel name="chat_bar_layout_panel"
auto_resize="true"
user_resize="true"
height="30"
width="280"
mouse_opaque="false">
<panel
name="chat_bar_layout_panel"
layout="topleft"
follows="all"
left="0"
top="2"
width="280"
height="29"
bg_opaque_image="Rounded_Rect"
background_visible="true"
bg_opaque_image_overlay="MouseGray"
background_opaque="true">
<button name="local_chat_button"
tool_tip="Shows/hides nearby chat window"
label="Local Chat"
follows="left|top"
layout="topleft"
height="24"
left="5"
top="3"
width="80">
<commit_callback
function="Floater.Toggle"
parameter="nearby_chat" />
</button>
<nearby_chat_control layout="topleft"
name="default_chat_bar"
height="22"
left_pad="4"
top="4"
width="184"
follows="left|right|bottom"
spellcheck="true"
visible="true" />
</panel>
</layout_panel>
<layout_panel name="toolbar_panel"
auto_resize="false"
user_resize="true"
height="30"
width="804"
mouse_opaque="false">
<toolbar layout="topleft"
button_panel.bg_opaque_image="Rounded_Rect_Top"
name="toolbar_bottom"
height="30"
left="40"
right="-40"
left="0"
right="-1"
top="0"
side="bottom"
follows="left|right|bottom"
@ -159,6 +224,11 @@
image_name="Caret_Bottom_Icon"
name="caret" />
</toolbar>
</layout_panel>
</layout_stack>
</layout_panel>
</layout_stack>
</toolbar_view>

View File

@ -3724,7 +3724,7 @@ Try enclosing path to the editor with double quotes.
<string name="Command_Appearance_Label">Appearance</string>
<string name="Command_Avatar_Label">Avatar</string>
<string name="Command_Build_Label">Build</string>
<string name="Command_Chat_Label">Chat</string>
<string name="Command_Chat_Label">Conversations</string>
<string name="Command_Compass_Label">Compass</string>
<string name="Command_Destinations_Label">Destinations</string>
<string name="Command_Gestures_Label">Gestures</string>

View File

@ -10,6 +10,7 @@
mouse_opaque="false"
tab_stop="false"
visible="true">
<layout_stack name="bottom_toolbar_stack"
orientation="vertical"
left="0"
@ -17,6 +18,7 @@
width="1024"
height="500"
follows="all"
border_size="0"
mouse_opaque="false">
<layout_panel name="vertical_toolbar_panel"
auto_resize="true"
@ -130,6 +132,77 @@
</layout_panel>
</layout_stack>
</layout_panel>
<!-- Nearby chat panel, resting on top of the bottom toolbar -->
<layout_panel name="bottom_chat_bar_panel"
auto_resize="false"
user_resize="false"
height="26"
width="1024"
mouse_opaque="false">
<!-- Layout stack to make showing and hiding easy -->
<layout_stack name="bottom_chat_stack"
orientation="vertical"
top="0"
left="0"
width="1024"
height="26"
follows="all"
border_size="0"
mouse_opaque="false">
<!-- Empty panel to take up the space when chat bar panel gets hidden -->
<layout_panel name="bottom_chat_bar_upper_padding_panel"
auto_resize="true"
user_resize="false"
width="1024"
height="26"
mouse_opaque="false" />
<!-- Panel to house the chat bar in, will be set visible/invisible in code
as parent of the chat control -->
<layout_panel name="bottom_chat_bar_panel"
auto_resize="false"
user_resize="false"
bg_visible="true"
bg_opaque_color="DkGray"
background_opaque="true"
height="26"
width="1024"
mouse_opaque="false">
<button name="local_chat_button"
tool_tip="Shows/hides nearby chat window"
control_name="floater_vis_nearby_chat"
label="Local Chat"
height="20"
left="5"
top="4"
width="80">
<commit_callback function="Floater.Toggle"
parameter="nearby_chat" />
</button>
<nearby_chat_control layout="topleft"
name="default_chat_bar"
label="To nearby chat"
max_length_bytes="1024"
left_pad="8"
height="20"
right="-4"
follows="all"
spellcheck="true" />
</layout_panel>
<!-- Panel to house the chat bar in, will be set visible/invisible in code
as parent of the chat control -->
</layout_stack>
<!-- Layout stack to make showing and hiding easy -->
</layout_panel>
<!-- Nearby chat panel, resting on top of the bottom toolbar -->
<layout_panel name="bottom_toolbar_panel"
auto_resize="false"
user_resize="false"
@ -165,4 +238,5 @@
</toolbar>
</layout_panel>
</layout_stack>
</toolbar_view>

View File

@ -43,9 +43,9 @@
image_selected="PushButton_Selected_Press"
image_disabled_selected="PushButton_Selected_Disabled"
image_disabled="PushButton_Disabled"
desired_height="24"
button_width.min="24"
button_width.max="24"
desired_height="20"
button_width.min="20"
button_width.max="20"
follows="left|top"
label=""
halign="left"