diff --git a/indra/newview/rlvfloaters.cpp b/indra/newview/rlvfloaters.cpp index b0b089e138145bce0636156c4e8cc6f12a77a096..92a5e4efb3d88543523424cb2f81dd8d139d24db 100644 --- a/indra/newview/rlvfloaters.cpp +++ b/indra/newview/rlvfloaters.cpp @@ -19,6 +19,7 @@ #include "llagent.h" #include "llappearancemgr.h" #include "llavatarnamecache.h" +#include <llchatentry.h> #include "llclipboard.h" #include "llcombobox.h" #include "llinventoryfunctions.h" @@ -733,7 +734,7 @@ static const char s_strRlvConsoleDisabled[] = "RLVa is disabled"; static const char s_strRlvConsoleInvalid[] = "Invalid command"; RlvFloaterConsole::RlvFloaterConsole(const LLSD& sdKey) - : LLFloater(sdKey), m_pOutputText(nullptr) + : LLFloater(sdKey) { } @@ -743,11 +744,14 @@ RlvFloaterConsole::~RlvFloaterConsole() BOOL RlvFloaterConsole::postBuild() { - LLLineEditor* pInputEdit = getChild<LLLineEditor>("console_input"); - pInputEdit->setEnableLineHistory(true); - pInputEdit->setCommitCallback(boost::bind(&RlvFloaterConsole::onInput, this, _1, _2)); - pInputEdit->setFocus(true); - pInputEdit->setCommitOnFocusLost(false); + m_pInputEdit = getChild<LLChatEntry>("console_input"); + m_pInputEdit->setCommitCallback(boost::bind(&RlvFloaterConsole::onInput, this, _1, _2)); + m_pInputEdit->setTextExpandedCallback(boost::bind(&RlvFloaterConsole::reshapeLayoutPanel, this)); + m_pInputEdit->setFocus(true); + m_pInputEdit->setCommitOnFocusLost(false); + + m_pInputPanel = getChild<LLLayoutPanel>("input_panel"); + m_nInputEditPad = m_pInputPanel->getRect().getHeight() - m_pInputEdit->getRect().getHeight(); m_pOutputText = getChild<LLTextEditor>("console_output"); m_pOutputText->appendText(s_strRlvConsolePrompt, false); @@ -769,12 +773,12 @@ void RlvFloaterConsole::addCommandReply(const std::string& strCommand, const std void RlvFloaterConsole::onInput(LLUICtrl* pCtrl, const LLSD& sdParam) { - LLLineEditor* pInputEdit = static_cast<LLLineEditor*>(pCtrl); + LLChatEntry* pInputEdit = static_cast<LLChatEntry*>(pCtrl); std::string strInput = pInputEdit->getText(); LLStringUtil::trim(strInput); m_pOutputText->appendText(strInput, false); - pInputEdit->clear(); + pInputEdit->setText(LLStringUtil::null); if (!rlv_handler_t::isEnabled()) { @@ -831,4 +835,9 @@ void RlvFloaterConsole::onInput(LLUICtrl* pCtrl, const LLSD& sdParam) m_pOutputText->appendText(s_strRlvConsolePrompt, true); } +void RlvFloaterConsole::reshapeLayoutPanel() +{ + m_pInputPanel->reshape(m_pInputPanel->getRect().getWidth(), m_pInputEdit->getRect().getHeight() + m_nInputEditPad, FALSE); +} + // ============================================================================ diff --git a/indra/newview/rlvfloaters.h b/indra/newview/rlvfloaters.h index f29fa92483d3e24ab1a700f8be33670e521f81da..2ca4adc904de34a7051f59f66f1ce498d7f83e69 100644 --- a/indra/newview/rlvfloaters.h +++ b/indra/newview/rlvfloaters.h @@ -1,21 +1,20 @@ -/** +/** * * Copyright (c) 2009-2011, Kitty Barnett - * - * The source code in this file is provided to you under the terms of the + * + * 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 + * 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 + * you have read and understood your obligations described above, and agree to * abide by those obligations. - * + * */ -#ifndef RLV_FLOATERS_H -#define RLV_FLOATERS_H +#pragma once #include "llfloater.h" @@ -25,7 +24,9 @@ // ============================================================================ // Foward declarations // +class LLChatEntry; class LLComboBox; +class LLLayoutPanel; class LLTextEditor; // ============================================================================ @@ -150,21 +151,23 @@ class RlvFloaterConsole : public LLFloater public: BOOL postBuild() override; void onClose(bool fQuitting) override; - + /* * Member functions */ protected: void addCommandReply(const std::string& strCommand, const std::string& strReply); void onInput(LLUICtrl* ctrl, const LLSD& param); + void reshapeLayoutPanel(); /* * Member variables */ protected: - LLTextEditor* m_pOutputText; + LLTextEditor* m_pOutputText = nullptr; + LLLayoutPanel* m_pInputPanel = nullptr; + LLChatEntry* m_pInputEdit = nullptr; + int m_nInputEditPad = 0; }; // ============================================================================ - -#endif // RLV_FLOATERS_H diff --git a/indra/newview/skins/default/xui/en/floater_rlv_console.xml b/indra/newview/skins/default/xui/en/floater_rlv_console.xml index 8c09e7dacc425fd18eda72106607d968762477bb..928d50cb414286d2a7a485819972f6cf7888f783 100644 --- a/indra/newview/skins/default/xui/en/floater_rlv_console.xml +++ b/indra/newview/skins/default/xui/en/floater_rlv_console.xml @@ -1,43 +1,73 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater - can_resize="true" - height="400" - layout="topleft" - min_height="300" - min_width="300" - name="rlv_console" - title="RLVa console" - width="600" - > - <text_editor + can_resize="true" + height="400" + layout="topleft" + min_height="300" + min_width="300" + name="rlv_console" + title="RLVa console" + width="600" + > + <layout_stack + animate="false" + bottom="-1" + default_tab_group="2" follows="all" - left="10" - length="1" - font="Monospace" - height="366" - ignore_tab="false" + left="5" layout="topleft" - max_length="65536" - name="console_output" - read_only="true" - track_end="true" - type="string" - width="576" - word_wrap="true" + mouse_opaque="false" + name="main_stack" + right="-5" + orientation="vertical" + tab_group="1" + top="1" > - </text_editor> - <line_editor - border_style="line" - border_thickness="1" - bottom_delta="20" - follows="left|right|bottom" - font="SansSerif" - height="19" - layout="topleft" - max_length_chars="127" - name="console_input" - top_delta="0" - width="576" - > - </line_editor> + <layout_panel + name="body_panel" + height="235"> + <text_editor + follows="all" + left="1" + right="-1" + top="0" + length="1" + font="Monospace" + bottom="-1" + ignore_tab="false" + layout="topleft" + max_length="65536" + name="console_output" + read_only="true" + track_end="true" + type="string" + word_wrap="true" + > + </text_editor> + </layout_panel> + + <layout_panel + height="26" + auto_resize="false" + name="input_panel"> + <chat_editor + layout="topleft" + expand_lines_count="5" + follows="left|right|bottom" + font="SansSerifSmall" + height="20" + is_expandable="true" + text_tentative_color="TextFgTentativeColor" + name="console_input" + max_length="1023" + spellcheck="true" + tab_group="3" + bottom_delta="20" + left="1" + top="1" + right="-1" + wrap="true" + /> + </layout_panel> + </layout_stack> </floater>