summaryrefslogtreecommitdiff
path: root/indra/newview/llchatitemscontainerctrl.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-08-12 01:12:27 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-08-12 01:12:27 +0000
commit0bf4b5f2222ffb8171be094613363427f3b8470a (patch)
tree4b742d6815f44a85c98113e9c5a3017eafc5968d /indra/newview/llchatitemscontainerctrl.cpp
parent8d7e56f219d0915e2c4a19baf2809dbc6ede7fa5 (diff)
merge https://svn.aws.productengine.com/secondlife/export-from-ll@1277 https://svn.aws.productengine.com/secondlife/pe/stable-1@1297 -> viewer-2-0
Fixes: EXT 208 EXT 366 EXT-211 EXT-245 EXT-246 EXT-278 EXT-279 EXT-280 EXT-298 EXT-301 EXT-304 EXT-311 EXT-317 EXT-318 EXT-319 EXT-339 EXT-343 EXT-344 EXT-346 EXT-349 EXT-350 EXT-351 EXT-354 EXT-355 EXT-358 EXT-360 EXT-362 EXT-369 EXT-372 EXT-374 EXT-381 EXT-382 EXT-383 EXT-395 EXT-396 EXT-412 Other changes: Movement & Caemra controls work Profile and Me panel refactoring Notification refactoring
Diffstat (limited to 'indra/newview/llchatitemscontainerctrl.cpp')
-rw-r--r--indra/newview/llchatitemscontainerctrl.cpp101
1 files changed, 35 insertions, 66 deletions
diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp
index 2b455485ca..a63477a442 100644
--- a/indra/newview/llchatitemscontainerctrl.cpp
+++ b/indra/newview/llchatitemscontainerctrl.cpp
@@ -82,8 +82,10 @@ void LLChatItemCtrl::reshape (S32 width, S32 height, BOOL called_from_parent )
{
LLPanel::reshape(width, height,called_from_parent);
- LLPanel* caption = getChild<LLPanel>("msg_caption",false,false);
- LLChatMsgBox* msg_text = getChild<LLChatMsgBox>("msg_text",false,false);
+ // *NOTE: we must check if child items exist because reshape is called from the
+ // LLView::initFromParams BEFORE postBuild is called and child controls are not exist yet
+ LLPanel* caption = findChild<LLPanel>("msg_caption", false);
+ LLChatMsgBox* msg_text = findChild<LLChatMsgBox>("msg_text" ,false);
if(caption && msg_text)
{
LLRect caption_rect = caption->getRect();
@@ -125,17 +127,14 @@ std::string LLChatItemCtrl::appendTime()
void LLChatItemCtrl::addText (const std::string& message)
{
- LLChatMsgBox* msg_text = getChild<LLChatMsgBox>("msg_text",false,false);
- if(msg_text)
- msg_text->addText(message);
+ LLChatMsgBox* msg_text = getChild<LLChatMsgBox>("msg_text", false);
+ msg_text->addText(message);
mMessages.push_back(message);
}
void LLChatItemCtrl::setMessage (const LLChat& msg)
{
- LLPanel* caption = getChild<LLPanel>("msg_caption",false,false);
- if(!caption)
- return;
+ LLPanel* caption = getChild<LLPanel>("msg_caption", false);
std::string str_sender;
@@ -145,20 +144,19 @@ void LLChatItemCtrl::setMessage (const LLChat& msg)
else
str_sender = LLTrans::getString("You");;
- caption->getChild<LLTextBox>("sender_name",false,false)->setText(str_sender);
+ caption->getChild<LLTextBox>("sender_name", false)->setText(str_sender);
std::string tt = appendTime();
- caption->getChild<LLTextBox>("msg_time",false,false)->setText(tt);
+ caption->getChild<LLTextBox>("msg_time", false)->setText(tt);
- caption->getChild<LLAvatarIconCtrl>("avatar_icon",false,false)->setValue(msg.mFromID);
+ caption->getChild<LLAvatarIconCtrl>("avatar_icon", false)->setValue(msg.mFromID);
mOriginalMessage = msg;
- LLChatMsgBox* msg_text = getChild<LLChatMsgBox>("msg_text",false,false);
- if(msg_text)
- msg_text->setText(msg.mText);
+ LLChatMsgBox* msg_text = getChild<LLChatMsgBox>("msg_text", false);
+ msg_text->setText(msg.mText);
LLUICtrl* msg_inspector = caption->getChild<LLUICtrl>("msg_inspector");
if(mOriginalMessage.mSourceType != CHAT_SOURCE_AGENT)
@@ -170,17 +168,13 @@ void LLChatItemCtrl::setMessage (const LLChat& msg)
void LLChatItemCtrl::snapToMessageHeight ()
{
- LLChatMsgBox* text_box = getChild<LLChatMsgBox>("msg_text",false,false);
- if(!text_box)
- return;///actually assert fits better
+ LLChatMsgBox* text_box = getChild<LLChatMsgBox>("msg_text", false);
S32 new_height = text_box->getTextPixelHeight();
LLRect panel_rect = getRect();
S32 caption_height = 0;
- LLPanel* caption = getChild<LLPanel>("msg_caption",false,false);
- if(caption)
- caption_height = caption->getRect().getHeight();
-
+ LLPanel* caption = getChild<LLPanel>("msg_caption", false);
+ caption_height = caption->getRect().getHeight();
panel_rect.setLeftTopAndSize( panel_rect.mLeft, panel_rect.mTop, panel_rect.getWidth() , caption_height + new_height);
@@ -193,14 +187,11 @@ void LLChatItemCtrl::snapToMessageHeight ()
void LLChatItemCtrl::setWidth(S32 width)
{
- LLChatMsgBox* text_box = getChild<LLChatMsgBox>("msg_text",false,false);
- if(!text_box)
- return;///actually assert fits better
-
+ LLChatMsgBox* text_box = getChild<LLChatMsgBox>("msg_text", false);
text_box->reshape(width - msg_left_offset - msg_right_offset,100/*its not magic number, we just need any number*/);
- LLChatMsgBox* msg_text = getChild<LLChatMsgBox>("msg_text",false,false);
- if(msg_text && mOriginalMessage.mText.length())
+ LLChatMsgBox* msg_text = getChild<LLChatMsgBox>("msg_text", false);
+ if(mOriginalMessage.mText.length())
msg_text->setText(mOriginalMessage.mText);
for(size_t i=0;i<mMessages.size();++i)
@@ -212,58 +203,41 @@ void LLChatItemCtrl::setWidth(S32 width)
void LLChatItemCtrl::onMouseLeave (S32 x, S32 y, MASK mask)
{
- LLPanel* caption = getChild<LLPanel>("msg_caption",false,false);
- if(!caption)
- return;
+ LLPanel* caption = getChild<LLPanel>("msg_caption", false);
LLUICtrl* msg_inspector = caption->getChild<LLUICtrl>("msg_inspector");
- if(msg_inspector)
- msg_inspector->setVisible(false);
+ msg_inspector->setVisible(false);
}
void LLChatItemCtrl::onMouseEnter (S32 x, S32 y, MASK mask)
{
if(mOriginalMessage.mSourceType != CHAT_SOURCE_AGENT)
return;
- LLPanel* caption = getChild<LLPanel>("msg_caption",false,false);
- if(!caption)
- return;
+ LLPanel* caption = getChild<LLPanel>("msg_caption", false);
LLUICtrl* msg_inspector = caption->getChild<LLUICtrl>("msg_inspector");
- if(msg_inspector)
- msg_inspector->setVisible(true);
+ msg_inspector->setVisible(true);
}
BOOL LLChatItemCtrl::handleMouseDown (S32 x, S32 y, MASK mask)
{
if(mOriginalMessage.mSourceType != CHAT_SOURCE_AGENT)
return LLPanel::handleMouseDown(x,y,mask);
- LLPanel* caption = getChild<LLPanel>("msg_caption",false,false);
- if(caption)
+ LLPanel* caption = getChild<LLPanel>("msg_caption", false);
+ LLUICtrl* msg_inspector = caption->getChild<LLUICtrl>("msg_inspector");
+ S32 local_x = x - msg_inspector->getRect().mLeft - caption->getRect().mLeft;
+ S32 local_y = y - msg_inspector->getRect().mBottom - caption->getRect().mBottom;
+ if(msg_inspector->pointInView(local_x, local_y))
{
- LLUICtrl* msg_inspector = caption->getChild<LLUICtrl>("msg_inspector");
- if(msg_inspector)
- {
- S32 local_x = x - msg_inspector->getRect().mLeft - caption->getRect().mLeft;
- S32 local_y = y - msg_inspector->getRect().mBottom - caption->getRect().mBottom;
- if(msg_inspector->pointInView(local_x, local_y))
- {
- LLFloaterReg::showInstance("mini_inspector", mOriginalMessage.mFromID);
- }
- }
+ LLFloaterReg::showInstance("mini_inspector", mOriginalMessage.mFromID);
}
return LLPanel::handleMouseDown(x,y,mask);
}
void LLChatItemCtrl::setHeaderVisibility(EShowItemHeader e)
{
- LLPanel* caption = getChild<LLPanel>("msg_caption",false,false);
- if(!caption)
- return;
+ LLPanel* caption = getChild<LLPanel>("msg_caption", false);
- LLUICtrl* icon = caption->getChild<LLUICtrl>("avatar_icon",false,false);
- LLUICtrl* name = caption->getChild<LLUICtrl>("sender_name",false,false);
-
- if(icon == 0 || name == 0)
- return;
+ LLUICtrl* icon = caption->getChild<LLUICtrl>("avatar_icon", false);
+ LLUICtrl* name = caption->getChild<LLUICtrl>("sender_name", false);
icon->setVisible(e == CHATITEMHEADER_SHOW_ONLY_ICON || e==CHATITEMHEADER_SHOW_BOTH);
name->setVisible(e == CHATITEMHEADER_SHOW_ONLY_NAME || e==CHATITEMHEADER_SHOW_BOTH);
@@ -272,20 +246,15 @@ void LLChatItemCtrl::setHeaderVisibility(EShowItemHeader e)
bool LLChatItemCtrl::canAddText ()
{
- LLChatMsgBox* msg_text = getChild<LLChatMsgBox>("msg_text",false,false);
- if(!msg_text )
- return false;
+ LLChatMsgBox* msg_text = getChild<LLChatMsgBox>("msg_text", false);
return msg_text->getTextLinesNum()<10;
}
BOOL LLChatItemCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- LLPanel* caption = getChild<LLPanel>("msg_caption",false,false);
- if(!caption)
- return LLPanel::handleRightMouseDown(x,y,mask);
- LLUICtrl* avatar_icon = caption->getChild<LLUICtrl>("avatar_icon",false,false);
- if(!avatar_icon)
- return LLPanel::handleRightMouseDown(x,y,mask);
+ LLPanel* caption = getChild<LLPanel>("msg_caption", false);
+ LLUICtrl* avatar_icon = caption->getChild<LLUICtrl>("avatar_icon", false);
+
S32 local_x = x - avatar_icon->getRect().mLeft - caption->getRect().mLeft;
S32 local_y = y - avatar_icon->getRect().mBottom - caption->getRect().mBottom;