Introduce a setting for Automatically scrolling to the bottom of a chat when the chat gains focus

Preferences->Adv. Chat->Chat UI, Autoscroll to the end of chats when they regain focus.
This defaults to false, unlike the legacy behavior.

Partial revert of "Feature Removal!: Do not scroll to the end of chats when the corresponding chatbar regains focus!"
This commit is contained in:
Inusaito Sayori
2014-05-22 19:46:15 -04:00
parent 852a8407c8
commit dadbb00b85
10 changed files with 48 additions and 0 deletions

View File

@@ -779,6 +779,17 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>LiruLegacyScrollToEnd</key>
<map>
<key>Comment</key>
<string>Automatically scroll to the end of a chat's history when the chat regains focus.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>LiruLocalTime</key>
<map>
<key>Comment</key>

View File

@@ -262,6 +262,7 @@ void LLPrefsAscentChat::refreshValues()
mOneLineGroupButt = gSavedSettings.getBOOL("UseConciseGroupChatButtons");
mOneLineConfButt = gSavedSettings.getBOOL("UseConciseConferenceButtons");
mOnlyComm = gSavedSettings.getBOOL("CommunicateSpecificShortcut");
mLegacyEndScroll = gSavedSettings.getBOOL("LiruLegacyScrollToEnd");
mItalicizeActions = gSavedSettings.getBOOL("LiruItalicizeActions");
mLegacyLogLaunch = gSavedSettings.getBOOL("LiruLegacyLogLaunch");
mFriendNames = gSavedSettings.getS32("FriendNameSystem");
@@ -497,6 +498,7 @@ void LLPrefsAscentChat::cancel()
gSavedSettings.setBOOL("UseConciseGroupChatButtons", mOneLineGroupButt);
gSavedSettings.setBOOL("UseConciseConferenceButtons", mOneLineConfButt);
gSavedSettings.setBOOL("CommunicateSpecificShortcut", mOnlyComm);
gSavedSettings.setBOOL("LiruLegacyScrollToEnd", mLegacyEndScroll);
gSavedSettings.setBOOL("LiruItalicizeActions", mItalicizeActions);
gSavedSettings.setBOOL("LiruLegacyLogLaunch", mLegacyLogLaunch);
gSavedSettings.setS32("FriendNameSystem", mFriendNames);

View File

@@ -84,6 +84,7 @@ private:
bool mOneLineGroupButt;
bool mOneLineConfButt;
bool mOnlyComm;
bool mLegacyEndScroll;
bool mItalicizeActions;
bool mLegacyLogLaunch;
S32 mFriendNames;

View File

@@ -153,6 +153,7 @@ BOOL LLChatBar::postBuild()
mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5));
mInputEditor->setKeystrokeCallback(boost::bind(&LLChatBar::onInputEditorKeystroke,this));
mInputEditor->setFocusLostCallback(boost::bind(&LLChatBar::onInputEditorFocusLost));
mInputEditor->setFocusReceivedCallback(boost::bind(&LLChatBar::onInputEditorGainFocus));
mInputEditor->setCommitOnFocusLost( FALSE );
mInputEditor->setRevertOnEsc( FALSE );
mInputEditor->setIgnoreTab(TRUE);
@@ -636,6 +637,13 @@ void LLChatBar::onInputEditorFocusLost()
gAgent.stopTyping();
}
// static
void LLChatBar::onInputEditorGainFocus()
{
if (gSavedSettings.getBOOL("LiruLegacyScrollToEnd"))
LLFloaterChat::setHistoryCursorAndScrollToEnd();
}
// static
void LLChatBar::onClickSay( LLUICtrl* ctrl )
{

View File

@@ -86,6 +86,7 @@ public:
void onInputEditorKeystroke();
static void onInputEditorFocusLost();
static void onInputEditorGainFocus();
void onCommitGesture(LLUICtrl* ctrl);

View File

@@ -333,6 +333,20 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file)
}
}
// static
void LLFloaterChat::setHistoryCursorAndScrollToEnd()
{
if (LLViewerTextEditor* editor = getInstance()->findChild<LLViewerTextEditor>("Chat History Editor"))
{
editor->setCursorAndScrollToEnd();
}
if (LLViewerTextEditor* editor = getInstance()->findChild<LLViewerTextEditor>("Chat History Editor with mute"))
{
editor->setCursorAndScrollToEnd();
}
}
//static
void LLFloaterChat::onClickMute(void *data)
{

View File

@@ -69,6 +69,8 @@ public:
void updateConsoleVisibility();
void updateSettings();
static void setHistoryCursorAndScrollToEnd();
// Add chat to console and history list.
// Color based on source, type, distance.
static void addChat(const LLChat& chat, BOOL from_im = FALSE, BOOL local_agent = FALSE);

View File

@@ -468,6 +468,7 @@ BOOL LLFloaterIMPanel::postBuild()
mInputEditor = getChild<LLLineEditor>("chat_editor");
mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5));
mInputEditor->setFocusReceivedCallback( boost::bind(&LLFloaterIMPanel::onInputEditorFocusReceived, this) );
mFocusLostSignal = mInputEditor->setFocusLostCallback(boost::bind(&LLFloaterIMPanel::setTyping, this, false));
mInputEditor->setKeystrokeCallback( boost::bind(&LLFloaterIMPanel::onInputEditorKeystroke, this, _1) );
mInputEditor->setCommitCallback( boost::bind(&LLFloaterIMPanel::onSendMsg,this) );
@@ -1027,6 +1028,12 @@ void LLFloaterIMPanel::onClickToggleActiveSpeakers(const LLSD& value)
childSetVisible("active_speakers_panel", !value);
}
void LLFloaterIMPanel::onInputEditorFocusReceived()
{
if (gSavedSettings.getBOOL("LiruLegacyScrollToEnd"))
mHistoryEditor->setCursorAndScrollToEnd();
}
void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller)
{
// Deleting all text counts as stopping typing.

View File

@@ -97,6 +97,7 @@ public:
BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
void onFocusReceived();
void onInputEditorFocusReceived();
void onInputEditorKeystroke(LLLineEditor* caller);
void onClickHistory();

View File

@@ -96,6 +96,7 @@
<check_box bottom_delta="-20" control_name="UseConciseConferenceButtons" follows="top" height="16" label="Buttons on conference title line (Affects new conferences)" name="conf_concise_butt"/>
<check_box bottom_delta="-20" follows="top" height="16" control_name="LiruLegacyLogLaunch" label="Log button opens external text editor (Windows and Mac only)" name="legacy_log_launch"/>
<check_box bottom_delta="-20" follows="top" height="16" initial_value="false" label="Disallow communicate shortcut opening detached friends list" control_name="CommunicateSpecificShortcut" name="only_comm"/>
<check_box bottom_delta="-20" follows="top" control_name="LiruLegacyScrollToEnd" label="Autoscroll to the end of chats when they regain focus" name="scroll_to_end_on_focus"/>
<check_box bottom_delta="-20" follows="top" height="16" control_name="LiruItalicizeActions" label="Italicize action messages (/me)" name="italicize_actions"/>
</panel>