diff options
| -rw-r--r-- | indra/newview/lltoastscripttextbox.cpp | 57 | ||||
| -rw-r--r-- | indra/newview/lltoastscripttextbox.h | 3 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_notify_textbox.xml | 78 | 
3 files changed, 79 insertions, 59 deletions
| diff --git a/indra/newview/lltoastscripttextbox.cpp b/indra/newview/lltoastscripttextbox.cpp index 78d9e92b5c..776ae2ece9 100644 --- a/indra/newview/lltoastscripttextbox.cpp +++ b/indra/newview/lltoastscripttextbox.cpp @@ -28,31 +28,21 @@  #include "lltoastscripttextbox.h" -#include "llfocusmgr.h" - -#include "llbutton.h" +#include "lllslconstants.h"  #include "llnotifications.h" -#include "llviewertexteditor.h" - -#include "llavatarnamecache.h" -#include "lluiconstants.h" -#include "llui.h" -#include "llviewercontrol.h" -#include "lltrans.h"  #include "llstyle.h" +#include "lluiconstants.h" +#include "llviewertexteditor.h" -#include "llglheaders.h" -#include "llagent.h" - -const S32 LLToastScriptTextbox::DEFAULT_MESSAGE_MAX_LINE_COUNT= 7; +const S32 LLToastScriptTextbox::DEFAULT_MESSAGE_MAX_LINE_COUNT= 14;  LLToastScriptTextbox::LLToastScriptTextbox(const LLNotificationPtr& notification)  :	LLToastPanel(notification)  {  	buildFromFile( "panel_notify_textbox.xml"); -	LLTextEditor* text_editorp = getChild<LLTextEditor>("text_editor_box"); -	text_editorp->setValue(notification->getMessage()); +	mInfoText = getChild<LLTextBox>("text_editor_box"); +	mInfoText->setValue(notification->getMessage());  	getChild<LLButton>("ignore_btn")->setClickedCallback(boost::bind(&LLToastScriptTextbox::onClickIgnore, this)); @@ -73,13 +63,7 @@ LLToastScriptTextbox::LLToastScriptTextbox(const LLNotificationPtr& notification  	pSubmitBtn->setClickedCallback((boost::bind(&LLToastScriptTextbox::onClickSubmit, this)));  	setDefaultBtn(pSubmitBtn); -	S32 maxLinesCount; -	std::istringstream ss( getString("message_max_lines_count") ); -	if (!(ss >> maxLinesCount)) -	{ -		maxLinesCount = DEFAULT_MESSAGE_MAX_LINE_COUNT; -	} -	//snapToMessageHeight(pMessageText, maxLinesCount); +	snapToMessageHeight();  }  // virtual @@ -92,7 +76,6 @@ void LLToastScriptTextbox::close()  	die();  } -#include "lllslconstants.h"  void LLToastScriptTextbox::onClickSubmit()  {  	LLViewerTextEditor* pMessageText = getChild<LLViewerTextEditor>("message"); @@ -119,3 +102,29 @@ void LLToastScriptTextbox::onClickIgnore()  	mNotification->respond(response);  	close();  } + +void LLToastScriptTextbox::snapToMessageHeight() +{ +	LLPanel* info_pan = getChild<LLPanel>("info_panel"); +	if (!info_pan) +	{ +		return; +	} + +	S32 maxLinesCount; +	std::istringstream ss( getString("message_max_lines_count") ); +	if (!(ss >> maxLinesCount)) +	{ +		maxLinesCount = DEFAULT_MESSAGE_MAX_LINE_COUNT; +	} + + +	S32 maxTextHeight = (mInfoText->getFont()->getLineHeight() * maxLinesCount); +	S32 oldTextHeight = mInfoText->getRect().getHeight(); +	S32 newTextHeight = llmin(mInfoText->getTextBoundingRect().getHeight(), maxTextHeight); + +	S32 heightDelta = newTextHeight - oldTextHeight; + +	reshape( getRect().getWidth(), llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT)); +	info_pan->reshape(info_pan->getRect().getWidth(),newTextHeight); +} diff --git a/indra/newview/lltoastscripttextbox.h b/indra/newview/lltoastscripttextbox.h index 7d33446248..7aee02dd00 100644 --- a/indra/newview/lltoastscripttextbox.h +++ b/indra/newview/lltoastscripttextbox.h @@ -48,9 +48,12 @@ public:  private: +	LLTextBox* mInfoText; +  	void onClickSubmit();  	void onClickIgnore(); +	void snapToMessageHeight();  	static const S32 DEFAULT_MESSAGE_MAX_LINE_COUNT;  }; diff --git a/indra/newview/skins/default/xui/en/panel_notify_textbox.xml b/indra/newview/skins/default/xui/en/panel_notify_textbox.xml index d5b6057233..a679ca7f8c 100644 --- a/indra/newview/skins/default/xui/en/panel_notify_textbox.xml +++ b/indra/newview/skins/default/xui/en/panel_notify_textbox.xml @@ -1,7 +1,7 @@  <?xml version="1.0" encoding="utf-8" standalone="yes" ?>  <panel     background_visible="true" -   height="220" +   height="215"     label="instant_message"     layout="topleft"     left="0" @@ -10,21 +10,19 @@     width="305">    <string       name="message_max_lines_count" -     value="7" /> +     value="14" />    <panel -   bevel_style="none" -   follows="left|right|top" -   height="185" -   label="info_panel" -   layout="topleft" -   left="0" -   name="info_panel" -   top="0" -   width="305">     -    <text_editor -     bg_readonly_color="0.0 0.0 0.0 0" -     enabled="false" -     follows="left|right|top|bottom" +     bevel_style="none" +     follows="all" +     height="120" +     label="info_panel" +     layout="topleft" +     left="0" +     name="info_panel" +     top="0" +     width="305"> +    <text +     follows="all"       font="SansSerif"       height="110"        layout="topleft" @@ -34,30 +32,40 @@       read_only="true"       text_color="white"       text_readonly_color="white" -     top="10" +     top="0"       width="285"       wrap="true"       parse_highlights="true"       parse_urls="true"/> -    <text_editor -     parse_urls="true" -     enabled="true" -     follows="all" -     height="50" +  </panel>  +  <panel +     bevel_style="none" +     follows="left|right|bottom" +     height="55" +     label="info_panel"       layout="topleft" -     left="10" -     max_length="250" -     name="message" -     parse_highlights="true" -     read_only="false" -     top_pad="10" -     type="string" -     use_ellipses="true" -     value="message" -     width="285" -     word_wrap="true" -     parse_url="false" > -    </text_editor> +     left="0" +     name="textbox_panel" +     top_pad="5" +     width="305">   +     <text_editor +      parse_urls="true" +      enabled="true" +      follows="all" +      height="50" +      layout="topleft" +      left="10" +      max_length="250" +      name="message" +      parse_highlights="true" +      read_only="false" +      top ="0" +      type="string" +      use_ellipses="true" +      value="message" +      width="285" +      word_wrap="true"> +     </text_editor>    </panel>    <panel       background_visible="false" @@ -68,7 +76,7 @@       layout="topleft"       left="10"       name="control_panel" -     top_pad="0"> +     top_pad="5">      <!--   	 Notes:  	 This panel holds the Ignore button and possibly other buttons of notification. | 
