More banging on things: Finally introduce a "default" parameter for FSNearbyChatControl so we can get rid of string compares on names
parent
1d20db450c
commit
fce74b37e1
|
|
@ -27,14 +27,8 @@
|
|||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
// llui
|
||||
#include "lllineeditor.h"
|
||||
#include "llspinctrl.h"
|
||||
|
||||
// newview
|
||||
#include "fsnearbychatcontrol.h"
|
||||
#include "fsnearbychathub.h"
|
||||
#include "fsfloaternearbychat.h"
|
||||
#include "llagent.h" // gAgent
|
||||
#include "llagentcamera.h" // gAgentCamera
|
||||
#include "llautoreplace.h"
|
||||
|
|
@ -43,7 +37,8 @@
|
|||
static LLDefaultChildRegistry::Register<FSNearbyChatControl> r("fs_nearby_chat_control");
|
||||
|
||||
FSNearbyChatControl::FSNearbyChatControl(const FSNearbyChatControl::Params& p) :
|
||||
LLLineEditor(p)
|
||||
LLLineEditor(p),
|
||||
mDefault(p.is_default)
|
||||
{
|
||||
//<FS:TS> FIRE-11373: Autoreplace doesn't work in nearby chat bar
|
||||
setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5));
|
||||
|
|
@ -93,7 +88,7 @@ void FSNearbyChatControl::setFocus(BOOL focus)
|
|||
|
||||
void FSNearbyChatControl::autohide()
|
||||
{
|
||||
if (getName() == "default_chat_bar")
|
||||
if (isDefault())
|
||||
{
|
||||
if (gSavedSettings.getBOOL("CloseChatOnReturn"))
|
||||
{
|
||||
|
|
@ -142,6 +137,7 @@ BOOL FSNearbyChatControl::handleKeyHere(KEY key, MASK mask)
|
|||
}
|
||||
else if (mask == (MASK_SHIFT | MASK_CONTROL))
|
||||
{
|
||||
// linefeed
|
||||
addChar(llwchar(182));
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,13 +28,20 @@
|
|||
#ifndef FS_NEARBYCHATCONTROL_H
|
||||
#define FS_NEARBYCHATCONTROL_H
|
||||
|
||||
#include "llchat.h"
|
||||
#include "lllineeditor.h"
|
||||
|
||||
class FSNearbyChatControl : public LLLineEditor
|
||||
{
|
||||
public:
|
||||
struct Params : public LLInitParam::Block<Params, LLLineEditor::Params> {};
|
||||
struct Params : public LLInitParam::Block<Params, LLLineEditor::Params>
|
||||
{
|
||||
Optional<bool> is_default;
|
||||
|
||||
Params()
|
||||
: is_default("default", false)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
FSNearbyChatControl(const Params& p);
|
||||
~FSNearbyChatControl();
|
||||
|
|
@ -45,12 +52,16 @@ public:
|
|||
|
||||
virtual BOOL handleKeyHere(KEY key, MASK mask);
|
||||
|
||||
bool isDefault() const { return mDefault; }
|
||||
|
||||
private:
|
||||
// Typing in progress, expand gestures etc.
|
||||
static void onKeystroke(LLLineEditor* caller, void* userdata);
|
||||
|
||||
// Unfocus and autohide chat bar accordingly if we are the default chat bar
|
||||
void autohide();
|
||||
void autohide();
|
||||
|
||||
bool mDefault;
|
||||
};
|
||||
|
||||
#endif // FS_NEARBYCHATCONTROL_H
|
||||
|
|
|
|||
|
|
@ -504,10 +504,9 @@ void FSNearbyChat::sendChat(LLWString text, EChatType type)
|
|||
// all chat bars call this function and we keep the first or one that's seen as the default
|
||||
void FSNearbyChat::registerChatBar(FSNearbyChatControl* chatBar)
|
||||
{
|
||||
// TODO: make this a Param option "is_default"
|
||||
if (!mDefaultChatBar || chatBar->getName() == "default_chat_bar")
|
||||
if (!mDefaultChatBar || chatBar->isDefault())
|
||||
{
|
||||
mDefaultChatBar=chatBar;
|
||||
mDefaultChatBar = chatBar;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -520,7 +519,7 @@ void FSNearbyChat::showDefaultChatBar(BOOL visible, const char* text) const
|
|||
}
|
||||
|
||||
// change settings control to signal button state
|
||||
gSavedSettings.setBOOL("MainChatbarVisible",visible);
|
||||
gSavedSettings.setBOOL("MainChatbarVisible", visible);
|
||||
|
||||
mDefaultChatBar->getParent()->setVisible(visible);
|
||||
mDefaultChatBar->setVisible(visible);
|
||||
|
|
@ -556,11 +555,10 @@ void FSNearbyChat::setFocusedInputEditor(FSNearbyChatControl* inputEditor, BOOL
|
|||
{
|
||||
mFocusedInputEditor = inputEditor;
|
||||
}
|
||||
|
||||
// only remove focus if the request came from the previously active input editor
|
||||
// to avoid races
|
||||
else if (mFocusedInputEditor == inputEditor)
|
||||
{
|
||||
// only remove focus if the request came from the previously active input editor
|
||||
// to avoid races
|
||||
mFocusedInputEditor = NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -569,7 +567,7 @@ void FSNearbyChat::setFocusedInputEditor(FSNearbyChatControl* inputEditor, BOOL
|
|||
// and the hide chat bar feature in mouselook in llagent.cpp
|
||||
BOOL FSNearbyChat::defaultChatBarIsIdle() const
|
||||
{
|
||||
if (mFocusedInputEditor && mFocusedInputEditor->getName() == "default_chat_bar")
|
||||
if (mFocusedInputEditor && mFocusedInputEditor->isDefault())
|
||||
{
|
||||
return mFocusedInputEditor->getText().empty();
|
||||
}
|
||||
|
|
@ -581,7 +579,7 @@ BOOL FSNearbyChat::defaultChatBarIsIdle() const
|
|||
// for the "arrow key moves avatar when chat is empty" hack in llviewerwindow.cpp
|
||||
BOOL FSNearbyChat::defaultChatBarHasFocus() const
|
||||
{
|
||||
if (mFocusedInputEditor && mFocusedInputEditor->getName() == "default_chat_bar")
|
||||
if (mFocusedInputEditor && mFocusedInputEditor->isDefault())
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@
|
|||
|
||||
<nearby_chat_voice_monitor layout="topleft"
|
||||
name="default_chat_bar"
|
||||
default="true"
|
||||
height="22"
|
||||
left_pad="4"
|
||||
top="4"
|
||||
|
|
|
|||
|
|
@ -224,6 +224,7 @@
|
|||
|
||||
<nearby_chat_voice_monitor layout="topleft"
|
||||
name="default_chat_bar"
|
||||
default="true"
|
||||
height="22"
|
||||
left_pad="4"
|
||||
top="4"
|
||||
|
|
|
|||
|
|
@ -260,6 +260,7 @@
|
|||
</button>
|
||||
<fs_nearby_chat_control
|
||||
name="default_chat_bar"
|
||||
default="true"
|
||||
label="To nearby chat"
|
||||
left_pad="8"
|
||||
right="-4"
|
||||
|
|
|
|||
|
|
@ -228,6 +228,7 @@
|
|||
|
||||
<nearby_chat_voice_monitor layout="topleft"
|
||||
name="default_chat_bar"
|
||||
default="true"
|
||||
height="22"
|
||||
left_pad="4"
|
||||
top="4"
|
||||
|
|
|
|||
|
|
@ -224,6 +224,7 @@
|
|||
|
||||
<nearby_chat_voice_monitor layout="topleft"
|
||||
name="default_chat_bar"
|
||||
default="true"
|
||||
height="22"
|
||||
left_pad="4"
|
||||
top="4"
|
||||
|
|
|
|||
|
|
@ -224,6 +224,7 @@
|
|||
|
||||
<nearby_chat_voice_monitor layout="topleft"
|
||||
name="default_chat_bar"
|
||||
default="true"
|
||||
height="22"
|
||||
left_pad="4"
|
||||
top="4"
|
||||
|
|
|
|||
|
|
@ -223,6 +223,7 @@
|
|||
|
||||
<fs_nearby_chat_control layout="topleft"
|
||||
name="default_chat_bar"
|
||||
default="true"
|
||||
label="To nearby chat"
|
||||
left_pad="8"
|
||||
height="20"
|
||||
|
|
|
|||
Loading…
Reference in New Issue