From cfccf4d5145274f7bfe1c88b7e51c000461226e8 Mon Sep 17 00:00:00 2001 From: angela Date: Tue, 24 Nov 2009 11:54:33 +0800 Subject: EXT-2780 allow_scroll = false in LLTextEditor will crash the viewer --- indra/llui/lltexteditor.cpp | 26 ++++++++++++++++------ indra/newview/llchathistory.cpp | 11 ++++----- indra/newview/llpanelprofileview.cpp | 3 +-- .../skins/default/xui/en/panel_chat_header.xml | 7 +++--- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 224f066968..3f4ef24f82 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -750,8 +750,10 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) { if( mIsSelecting ) { - mScroller->autoScroll(x, y); - + if(mScroller) + { + mScroller->autoScroll(x, y); + } S32 clamped_x = llclamp(x, mTextRect.mLeft, mTextRect.mRight); S32 clamped_y = llclamp(y, mTextRect.mBottom, mTextRect.mTop); setCursorAtLocalPos( clamped_x, clamped_y, true ); @@ -799,7 +801,10 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) { if( mIsSelecting ) { - mScroller->autoScroll(x, y); + if(mScroller) + { + mScroller->autoScroll(x, y); + } S32 clamped_x = llclamp(x, mTextRect.mLeft, mTextRect.mRight); S32 clamped_y = llclamp(y, mTextRect.mBottom, mTextRect.mTop); setCursorAtLocalPos( clamped_x, clamped_y, true ); @@ -1696,7 +1701,15 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) */ if (mReadOnly) { - handled = mScroller->handleKeyHere( key, mask ); + if(mScroller) + { + handled = mScroller->handleKeyHere( key, mask ); + } + else + { + handled = handleNavigationKey( key, mask ); + } + } else { @@ -2135,9 +2148,8 @@ void LLTextEditor::drawPreeditMarker() void LLTextEditor::drawLineNumbers() { LLGLSUIDefault gls_ui; - - LLRect scrolled_view_rect = mScroller->getVisibleContentRect(); - LLRect content_rect = mScroller->getContentWindowRect(); + LLRect scrolled_view_rect = getVisibleDocumentRect(); + LLRect content_rect = getTextRect(); LLLocalClipRect clip(content_rect); S32 first_line = getFirstVisibleLine(); S32 num_lines = getLineCount(); diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index a95234099c..24fa28c6cd 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -33,12 +33,10 @@ #include "llviewerprecompiledheaders.h" #include "llchathistory.h" #include "llpanel.h" -#include "lltextbox.h" -#include "lltexteditor.h" #include "lluictrlfactory.h" #include "llscrollcontainer.h" #include "llavatariconctrl.h" - +#include "lltexteditor.h" #include "llimview.h" #include "llcallingcard.h" //for LLAvatarTracker #include "llagentdata.h" @@ -188,9 +186,8 @@ public: LLTextEditor* userName = getChild("user_name"); - LLUIColor color = style_params.color; - userName->setReadOnlyColor(color); - userName->setColor(color); + userName->setReadOnlyColor(style_params.readonly_color()); + userName->setColor(style_params.color()); if(!chat.mFromName.empty()) { @@ -204,7 +201,7 @@ public: } - LLTextBox* timeBox = getChild("time_box"); + LLUICtrl* timeBox = getChild("time_box"); timeBox->setValue(chat.mTimeStr); LLAvatarIconCtrl* icon = getChild("avatar_icon"); diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp index c7c2484be3..bcf5b16aa6 100644 --- a/indra/newview/llpanelprofileview.cpp +++ b/indra/newview/llpanelprofileview.cpp @@ -43,7 +43,6 @@ #include "llpanelpicks.h" #include "llpanelprofile.h" #include "llsidetraypanelcontainer.h" -#include "lltexteditor.h" static LLRegisterPanelClassWrapper t_panel_target_profile("panel_profile_view"); @@ -191,7 +190,7 @@ void LLPanelProfileView::processOnlineStatus(bool online) void LLPanelProfileView::onAvatarNameCached(const LLUUID& id, const std::string& first_name, const std::string& last_name, BOOL is_group) { llassert(getAvatarId() == id); - getChild("user_name", FALSE)->setValue(first_name + " " + last_name); + getChild("user_name", FALSE)->setValue(first_name + " " + last_name); } void LLPanelProfileView::togglePanel(LLPanel* panel) diff --git a/indra/newview/skins/default/xui/en/panel_chat_header.xml b/indra/newview/skins/default/xui/en/panel_chat_header.xml index da175a75cd..692461b1a2 100644 --- a/indra/newview/skins/default/xui/en/panel_chat_header.xml +++ b/indra/newview/skins/default/xui/en/panel_chat_header.xml @@ -20,18 +20,19 @@ top="3" width="18" /> + value="Ericag Vader" />