From b235c59d60472f818a9142c0886b95a0ff4191d7 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:19 -0500 Subject: Second Life viewer sources 1.18.6.0-RC --- linden/indra/llui/llalertdialog.cpp | 35 +++++++++++++++++++++++---- linden/indra/llui/llalertdialog.h | 24 +++++++++++++++++-- linden/indra/llui/llbutton.cpp | 3 --- linden/indra/llui/llfloater.cpp | 29 +++++++++++++++-------- linden/indra/llui/llfloater.h | 3 ++- linden/indra/llui/lllineeditor.cpp | 14 ++++------- linden/indra/llui/lllineeditor.h | 2 -- linden/indra/llui/llpanel.cpp | 10 ++++++++ linden/indra/llui/llpanel.h | 1 + linden/indra/llui/llscrolllistctrl.cpp | 19 +++++++++++---- linden/indra/llui/llscrolllistctrl.h | 1 + linden/indra/llui/lltextbox.cpp | 43 +++++++++++++++++++++++++++++++++- linden/indra/llui/lltextbox.h | 11 +++++++-- linden/indra/llui/lltexteditor.cpp | 14 ++++------- linden/indra/llui/lltexteditor.h | 2 -- linden/indra/llui/llview.cpp | 18 +++++++------- linden/indra/llui/llview.h | 6 +++-- 17 files changed, 174 insertions(+), 61 deletions(-) (limited to 'linden/indra/llui') diff --git a/linden/indra/llui/llalertdialog.cpp b/linden/indra/llui/llalertdialog.cpp index 258b523..716fffd 100644 --- a/linden/indra/llui/llalertdialog.cpp +++ b/linden/indra/llui/llalertdialog.cpp @@ -58,6 +58,8 @@ const S32 MSG_PAD = 8; /*static*/ LLAlertDialog::display_callback_t LLAlertDialog::sDisplayCallback; /*static*/ LLString LLAlertDialog::sStringSkipNextTime("Skip this dialog next time"); /*static*/ LLString LLAlertDialog::sStringAlwaysChoose("Always choose this option"); +/*static*/ LLAlertDialog::URLLoader* LLAlertDialog::sURLLoader; + //static LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, @@ -147,8 +149,11 @@ LLAlertDialog::LLAlertDialog( const LLAlertDialogTemplate* xml_template, mIgnoreLabel(xml_template->mIgnoreLabel), mButtonData(NULL), mLineEditor(NULL), - mTextCallback(NULL) + mTextCallback(NULL), + mURLOption(0) { + mURL = xml_template->mURL; + mURLOption = xml_template->mURLOption; createDialog(&(xml_template->mOptions), xml_template->mDefaultOption, xml_template->mMessage, args, xml_template->mEditLineText); @@ -237,12 +242,12 @@ bool LLAlertDialog::show() return true; } -//static void LLAlertDialog::format(LLString& msg, const LLString::format_map_t& args) { // XUI:translate! LLString::format_map_t targs = args; targs["[SECOND_LIFE]"] = "Second Life"; + targs["[_URL]"] = mURL; LLString::format(msg, targs); } @@ -288,7 +293,7 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa // Message: create text box using raw string, as text has been structure deliberately // Use size of created text box to generate dialog box size LLString msg = msg_in; - LLAlertDialog::format( msg, args ); + format( msg, args ); llwarns << "Alert: " << msg << llendl; LLTextBox* msg_box = new LLTextBox( "Alert message", msg, (F32)MAX_ALLOWED_MSG_WIDTH, font ); @@ -424,6 +429,15 @@ LLAlertDialog::~LLAlertDialog() mCallback(mOptionChosen, mUserData); } + // If we declared a URL and chose the URL option, go to the url + if (mOptionChosen == mURLOption) + { + if (!mURL.empty() && sURLLoader != NULL) + { + sURLLoader->load(mURL); + } + } + // Only change warn state if we actually warned. if (mCheck && sSettings->getWarning(mIgnoreLabel)) @@ -547,7 +561,7 @@ void LLAlertDialog::setEditTextArgs(const LLString::format_map_t& edit_args) if (mLineEditor) { LLString msg = mLineEditor->getText(); - LLAlertDialog::format(msg, edit_args); + format(msg, edit_args); mLineEditor->setText(msg); } else @@ -790,6 +804,19 @@ bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* se } } } + + // + if (child->hasName("url")) + { + S32 url_option = 0; + child->getAttributeS32("option", url_option); + if (xml_template) + { + xml_template->mURL = child->getTextContents(); + xml_template->mURLOption = url_option; + } + } + } if (xml_template) { diff --git a/linden/indra/llui/llalertdialog.h b/linden/indra/llui/llalertdialog.h index ddf4112..07d20dc 100644 --- a/linden/indra/llui/llalertdialog.h +++ b/linden/indra/llui/llalertdialog.h @@ -50,6 +50,18 @@ public: typedef bool (*display_callback_t)(S32 modal); enum { IGNORE_USE_DEFAULT=1, IGNORE_USE_SAVED=2, IGNORE_SHOW_AGAIN=3 }; + class URLLoader + { + public: + virtual void load(const std::string& url) = 0; + virtual ~URLLoader() {} + }; + + static void setURLLoader(URLLoader* loader) + { + sURLLoader = loader; + }; + protected: struct ButtonData { @@ -98,7 +110,7 @@ public: LLAlertDialog( const LLAlertDialogTemplate* xml_template, const LLString::format_map_t& args, alert_callback_t callback = NULL, void *user_data = NULL); - static void format(LLString& msg, const LLString::format_map_t& args); + void format(LLString& msg, const LLString::format_map_t& args); protected: void createDialog(const std::vector* options, S32 default_option, @@ -126,6 +138,9 @@ protected: // For Dialogs that take a line as text as input: LLLineEditor* mLineEditor; alert_text_callback_t mTextCallback; + // For Dialogs linked to a URL + LLString mURL; // Some alerts will direct the resident to a URL + S32 mURLOption; public: // use LLPointer so they delete themselves when sTemplates is destroyed @@ -138,6 +153,9 @@ public: static LLString sStringSkipNextTime; static LLString sStringAlwaysChoose; + +private: + static URLLoader* sURLLoader; }; //============================================================================ @@ -145,7 +163,7 @@ public: class LLAlertDialogTemplate : public LLRefCount { public: - LLAlertDialogTemplate() : mTitle(), mModal(FALSE), mUnique(FALSE), mIgnorable(0), mDefaultOption(0) {} + LLAlertDialogTemplate() : mTitle(), mURLOption(0), mModal(FALSE), mUnique(FALSE), mIgnorable(0), mDefaultOption(0) {} void addOption(const LLString& label, const LLString& ignore_text, BOOL is_default = FALSE) { @@ -184,6 +202,8 @@ public: LLString mMessage; // Message to display LLString mIgnoreListText; // Text to display in enable/disable dialog (if mIgnorable == TRUE) LLString mIgnoreLabel; // Handle for ignore variable (may be shared by multiple templates) + LLString mURL; // Some alerts will direct the resident to a URL + S32 mURLOption; BOOL mModal; BOOL mUnique; S32 mIgnorable; // 0 = Never Ignore, 1 = Do default option, 2 = Do saved option diff --git a/linden/indra/llui/llbutton.cpp b/linden/indra/llui/llbutton.cpp index 36ccc32..26ce473 100644 --- a/linden/indra/llui/llbutton.cpp +++ b/linden/indra/llui/llbutton.cpp @@ -368,9 +368,6 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask) (*mClickedCallback)( mCallbackUserData ); } } - - mMouseDownTimer.stop(); - mMouseDownTimer.reset(); } return TRUE; diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp index 41a67f2..ab6bc00 100644 --- a/linden/indra/llui/llfloater.cpp +++ b/linden/indra/llui/llfloater.cpp @@ -834,7 +834,7 @@ void LLFloater::setMinimized(BOOL minimize) LLView* viewp = *child_it; if (!viewp->getVisible()) { - mMinimizedHiddenChildren.push_back(viewp); + mMinimizedHiddenChildren.push_back(viewp->mViewHandle); } viewp->setVisible(FALSE); } @@ -897,11 +897,14 @@ void LLFloater::setMinimized(BOOL minimize) viewp->setVisible(TRUE); } - std::vector::iterator itor = mMinimizedHiddenChildren.begin(); - while (itor != mMinimizedHiddenChildren.end()) + std::vector::iterator itor = mMinimizedHiddenChildren.begin(); + for ( ; itor != mMinimizedHiddenChildren.end(); ++itor) { - (*itor)->setVisible(FALSE); - ++itor; + LLView* viewp = LLView::getViewByHandle(*itor); + if(viewp) + { + viewp->setVisible(FALSE); + } } mMinimizedHiddenChildren.clear(); @@ -2220,7 +2223,6 @@ BOOL LLFloaterView::allChildrenClosed() { // see if there are any visible floaters (some floaters "close" // by setting themselves invisible) - S32 visible_count = 0; for (child_list_const_iter_t it = getChildList()->begin(); it != getChildList()->end(); ++it) { LLView* viewp = *it; @@ -2228,11 +2230,10 @@ BOOL LLFloaterView::allChildrenClosed() if (floaterp->getVisible() && floaterp->canClose()) { - visible_count++; + return false; } } - - return (visible_count == 0); + return true; } @@ -2270,14 +2271,22 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out S32 min_height; floater->getResizeLimits( &min_width, &min_height ); + // Make sure floater isn't already smaller than its min height/width? S32 new_width = llmax( min_width, view_width ); S32 new_height = llmax( min_height, view_height ); - if( (new_width > screen_width) || (new_height > screen_height) ) + if( !allow_partial_outside + && ( (new_width > screen_width) + || (new_height > screen_height) ) ) { + // We have to force this window to be inside the screen. new_width = llmin(new_width, screen_width); new_height = llmin(new_height, screen_height); + // Still respect minimum width/height + new_width = llmax(new_width, min_width); + new_height = llmax(new_height, min_height); + floater->reshape( new_width, new_height, TRUE ); // Make sure the damn thing is actually onscreen. diff --git a/linden/indra/llui/llfloater.h b/linden/indra/llui/llfloater.h index d0494ea..1d88501 100644 --- a/linden/indra/llui/llfloater.h +++ b/linden/indra/llui/llfloater.h @@ -286,7 +286,7 @@ protected: typedef std::map::iterator handle_map_iter_t; static handle_map_t sFloaterMap; - std::vector mMinimizedHiddenChildren; + std::vector mMinimizedHiddenChildren; BOOL mHasBeenDraggedWhileMinimized; S32 mPreviousMinimizedBottom; @@ -429,3 +429,4 @@ extern LLFloaterView* gFloaterView; #endif // LL_FLOATER_H + diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp index 78fe29c..420970a 100644 --- a/linden/indra/llui/lllineeditor.cpp +++ b/linden/indra/llui/lllineeditor.cpp @@ -158,8 +158,7 @@ LLLineEditor::LLLineEditor(const LLString& name, const LLRect& rect, mHandleEditKeysDirectly( FALSE ), mSelectAllonFocusReceived( FALSE ), mPassDelete(FALSE), - mReadOnly(FALSE), - mLastIMEPosition( -1, -1 ) + mReadOnly(FALSE) { llassert( max_length_bytes > 0 ); @@ -1638,15 +1637,10 @@ void LLLineEditor::draw() S32 pixels_after_scroll = findPixelNearestPos(); // RCalculcate for IME position LLRect screen_pos = getScreenRect(); LLCoordGL ime_pos( screen_pos.mLeft + pixels_after_scroll, screen_pos.mTop - UI_LINEEDITOR_V_PAD ); - if ( ime_pos.mX != mLastIMEPosition.mX || ime_pos.mY != mLastIMEPosition.mY ) - { - mLastIMEPosition.mX = ime_pos.mX; - mLastIMEPosition.mY = ime_pos.mY; - ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]); - ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]); - getWindow()->setLanguageTextInput( ime_pos ); - } + ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]); + ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]); + getWindow()->setLanguageTextInput( ime_pos ); } } diff --git a/linden/indra/llui/lllineeditor.h b/linden/indra/llui/lllineeditor.h index 2cd2ebf..f1b9fbe 100644 --- a/linden/indra/llui/lllineeditor.h +++ b/linden/indra/llui/lllineeditor.h @@ -279,8 +279,6 @@ protected: S32 mBorderThickness; - LLCoordGL mLastIMEPosition; // Last screen position used for the IME editor - BOOL mIgnoreArrowKeys; BOOL mIgnoreTab; BOOL mDrawAsterixes; diff --git a/linden/indra/llui/llpanel.cpp b/linden/indra/llui/llpanel.cpp index 3a0ee9b..ca1bc9c 100644 --- a/linden/indra/llui/llpanel.cpp +++ b/linden/indra/llui/llpanel.cpp @@ -982,6 +982,16 @@ BOOL LLPanel::childSetLabelArg(const LLString& id, const LLString& key, const LL return FALSE; } +BOOL LLPanel::childSetToolTipArg(const LLString& id, const LLString& key, const LLStringExplicit& text) +{ + LLView* child = getChildByName(id, true); + if (child) + { + return child->setToolTipArg(key, text); + } + return FALSE; +} + void LLPanel::childSetMinValue(const LLString& id, LLSD min_value) { LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); diff --git a/linden/indra/llui/llpanel.h b/linden/indra/llui/llpanel.h index dfd7a51..78aa7cf 100644 --- a/linden/indra/llui/llpanel.h +++ b/linden/indra/llui/llpanel.h @@ -194,6 +194,7 @@ public: // Not implemented for all types, defaults to noop, returns FALSE if not applicaple BOOL childSetTextArg(const LLString& id, const LLString& key, const LLStringExplicit& text); BOOL childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text); + BOOL childSetToolTipArg(const LLString& id, const LLString& key, const LLStringExplicit& text); // LLSlider / LLSpinCtrl void childSetMinValue(const LLString& id, LLSD min_value); diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp index f5eef29..96a7394 100644 --- a/linden/indra/llui/llscrolllistctrl.cpp +++ b/linden/indra/llui/llscrolllistctrl.cpp @@ -701,7 +701,7 @@ BOOL LLScrollListCtrl::addItem( LLScrollListItem* item, EAddPosition pos ) break; } - updateLineHeight(); + updateLineHeightInsert(item); mPageLines = mLineHeight ? mItemListRect.getHeight() / mLineHeight : 0; BOOL scrollbar_visible = mPageLines < getItemCount(); @@ -753,12 +753,11 @@ void LLScrollListCtrl::updateMaxContentWidth(LLScrollListItem* added_item) } } +const S32 SCROLL_LIST_ROW_PAD = 2; // Line height is the max height of all the cells in all the items. void LLScrollListCtrl::updateLineHeight() { - const S32 ROW_PAD = 2; - mLineHeight = 0; item_list::iterator iter; for (iter = mItemList.begin(); iter != mItemList.end(); iter++) @@ -768,11 +767,23 @@ void LLScrollListCtrl::updateLineHeight() S32 i = 0; for (const LLScrollListCell* cell = itemp->getColumn(i); i < num_cols; cell = itemp->getColumn(++i)) { - mLineHeight = llmax( mLineHeight, cell->getHeight() + ROW_PAD ); + mLineHeight = llmax( mLineHeight, cell->getHeight() + SCROLL_LIST_ROW_PAD ); } } } +// when the only change to line height is from an insert, we needn't scan the entire list +void LLScrollListCtrl::updateLineHeightInsert(LLScrollListItem* itemp) +{ + S32 num_cols = itemp->getNumColumns(); + S32 i = 0; + for (const LLScrollListCell* cell = itemp->getColumn(i); i < num_cols; cell = itemp->getColumn(++i)) + { + mLineHeight = llmax( mLineHeight, cell->getHeight() + SCROLL_LIST_ROW_PAD ); + } +} + + void LLScrollListCtrl::updateColumns() { mColumnsIndexed.resize(mColumns.size()); diff --git a/linden/indra/llui/llscrolllistctrl.h b/linden/indra/llui/llscrolllistctrl.h index 5ceee2e..a98a411 100644 --- a/linden/indra/llui/llscrolllistctrl.h +++ b/linden/indra/llui/llscrolllistctrl.h @@ -589,6 +589,7 @@ protected: void selectNextItem(BOOL extend_selection); void drawItems(); void updateLineHeight(); + void updateLineHeightInsert(LLScrollListItem* item); void reportInvalidInput(); BOOL isRepeatedChars(const LLWString& string) const; void selectItem(LLScrollListItem* itemp, BOOL single_select = TRUE); diff --git a/linden/indra/llui/lltextbox.cpp b/linden/indra/llui/lltextbox.cpp index c0b0788..efd4245 100644 --- a/linden/indra/llui/lltextbox.cpp +++ b/linden/indra/llui/lltextbox.cpp @@ -49,6 +49,9 @@ LLTextBox::LLTextBox(const LLString& name, const LLRect& rect, const LLString& t mDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), mBackgroundColor( LLUI::sColorsGroup->getColor( "DefaultBackgroundColor" ) ), mBorderColor( LLUI::sColorsGroup->getColor( "DefaultHighlightLight" ) ), + mHoverColor( LLUI::sColorsGroup->getColor( "LabelSelectedColor" ) ), + mHoverActive( FALSE ), + mHasHover( FALSE ), mBackgroundVisible( FALSE ), mBorderVisible( FALSE ), mFontStyle(LLFontGL::DROP_SHADOW_SOFT), @@ -74,6 +77,9 @@ LLTextBox::LLTextBox(const LLString& name, const LLString& text, F32 max_width, mDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")), mBackgroundColor(LLUI::sColorsGroup->getColor("DefaultBackgroundColor")), mBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")), + mHoverColor( LLUI::sColorsGroup->getColor( "LabelSelectedColor" ) ), + mHoverActive( FALSE ), + mHasHover( FALSE ), mBackgroundVisible(FALSE), mBorderVisible(FALSE), mFontStyle(LLFontGL::DROP_SHADOW_SOFT), @@ -161,6 +167,16 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) return handled; } +BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask) +{ + if(mHoverActive) + { + mHasHover = TRUE; // This should be set every frame during a hover. + return TRUE; + } + return FALSE; +} + void LLTextBox::setText(const LLStringExplicit& text) { mText.assign(text); @@ -334,7 +350,15 @@ void LLTextBox::draw() if ( getEnabled() ) { - drawText( text_x, text_y, mTextColor ); + if(mHasHover) + { + drawText( text_x, text_y, mHoverColor ); + } + else + { + drawText( text_x, text_y, mTextColor ); + } + } else { @@ -346,6 +370,8 @@ void LLTextBox::draw() drawDebugRect(); } } + + mHasHover = FALSE; // This is reset every frame. } void LLTextBox::reshape(S32 width, S32 height, BOOL called_from_parent) @@ -468,5 +494,20 @@ LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f text_box->setColor(color); } + if(node->hasAttribute("hover_color")) + { + LLColor4 color; + LLUICtrlFactory::getAttributeColor(node, "hover_color", color); + text_box->setHoverColor(color); + text_box->setHoverActive(true); + } + + BOOL hover_active = FALSE; + if(node->getAttributeBOOL("hover", hover_active)) + { + text_box->setHoverActive(hover_active); + } + + return text_box; } diff --git a/linden/indra/llui/lltextbox.h b/linden/indra/llui/lltextbox.h index 7e7018a..c7c7946 100644 --- a/linden/indra/llui/lltextbox.h +++ b/linden/indra/llui/lltextbox.h @@ -66,11 +66,16 @@ public: virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleHover(S32 x, S32 y, MASK mask); void setColor( const LLColor4& c ) { mTextColor = c; } void setDisabledColor( const LLColor4& c) { mDisabledColor = c; } void setBackgroundColor( const LLColor4& c) { mBackgroundColor = c; } void setBorderColor( const LLColor4& c) { mBorderColor = c; } + + void setHoverColor( const LLColor4& c ) { mHoverColor = c; } + void setHoverActive( BOOL active ) { mHoverActive = active; } + void setText( const LLStringExplicit& text ); void setWrappedText(const LLStringExplicit& text, F32 max_width = -1.0); // default width means use existing control width @@ -108,10 +113,12 @@ protected: const LLFontGL* mFontGL; LLColor4 mTextColor; LLColor4 mDisabledColor; - LLColor4 mBackgroundColor; LLColor4 mBorderColor; - + LLColor4 mHoverColor; + + BOOL mHoverActive; + BOOL mHasHover; BOOL mBackgroundVisible; BOOL mBorderVisible; diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp index 200cf29..d08997c 100644 --- a/linden/indra/llui/lltexteditor.cpp +++ b/linden/indra/llui/lltexteditor.cpp @@ -310,8 +310,7 @@ LLTextEditor::LLTextEditor( mMouseDownX(0), mMouseDownY(0), mLastSelectionX(-1), - mLastSelectionY(-1), - mLastIMEPosition(-1,-1) + mLastSelectionY(-1) { mSourceID.generate(); @@ -2817,15 +2816,10 @@ void LLTextEditor::drawCursor() // Make sure the IME is in the right place LLRect screen_pos = getScreenRect(); LLCoordGL ime_pos( screen_pos.mLeft + llfloor(cursor_left), screen_pos.mBottom + llfloor(cursor_top) ); - if ( ime_pos.mX != mLastIMEPosition.mX || ime_pos.mY != mLastIMEPosition.mY ) - { - mLastIMEPosition.mX = ime_pos.mX; - mLastIMEPosition.mY = ime_pos.mY; - ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]); - ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]); - getWindow()->setLanguageTextInput( ime_pos ); - } + ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]); + ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]); + getWindow()->setLanguageTextInput( ime_pos ); } } } diff --git a/linden/indra/llui/lltexteditor.h b/linden/indra/llui/lltexteditor.h index 55aba57..d38accc 100644 --- a/linden/indra/llui/lltexteditor.h +++ b/linden/indra/llui/lltexteditor.h @@ -439,8 +439,6 @@ protected: BOOL mParseHTML; LLString mHTML; - - LLCoordGL mLastIMEPosition; // Last position of the IME editor }; class LLTextSegment diff --git a/linden/indra/llui/llview.cpp b/linden/indra/llui/llview.cpp index 9442a5c..a047f99 100644 --- a/linden/indra/llui/llview.cpp +++ b/linden/indra/llui/llview.cpp @@ -224,11 +224,17 @@ void LLView::setMouseOpaque(BOOL b) mMouseOpaque = b; } -void LLView::setToolTip(const LLString& msg) +void LLView::setToolTip(const LLStringExplicit& msg) { mToolTipMsg = msg; } +BOOL LLView::setToolTipArg(const LLStringExplicit& key, const LLStringExplicit& text) +{ + mToolTipMsg.setArg(key, text); + return TRUE; +} + // virtual void LLView::setRect(const LLRect& rect) { @@ -288,7 +294,7 @@ void LLView::setSpanChildren( BOOL span_children ) const LLString& LLView::getToolTip() { - return mToolTipMsg; + return mToolTipMsg.getString(); } // virtual @@ -884,18 +890,14 @@ BOOL LLView::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_scre } } - if (LLUI::sShowXUINames && (mToolTipMsg.find(".xml", 0) == LLString::npos) && + tool_tip = mToolTipMsg.getString(); + if (LLUI::sShowXUINames && (tool_tip.find(".xml", 0) == LLString::npos) && (mName.find("Drag", 0) == LLString::npos)) { tool_tip = getShowNamesToolTip(); } - else - { - tool_tip = mToolTipMsg; - } - BOOL showNamesTextBox = LLUI::sShowXUINames && (getWidgetType() == WIDGET_TYPE_TEXT_BOX); if( !handled && (mMouseOpaque || showNamesTextBox) && pointInView( x, y ) && !tool_tip.empty()) diff --git a/linden/indra/llui/llview.h b/linden/indra/llui/llview.h index 63c1efc..8248d50 100644 --- a/linden/indra/llui/llview.h +++ b/linden/indra/llui/llview.h @@ -45,6 +45,7 @@ #include "llstring.h" #include "llrect.h" #include "llui.h" +#include "lluistring.h" #include "lluixmltags.h" #include "llviewquery.h" #include "llxmlnode.h" @@ -154,7 +155,7 @@ protected: BOOL mEnabled; // Enabled means "accepts input that has an effect on the state of the application." // A disabled view, for example, may still have a scrollbar that responds to mouse events. BOOL mMouseOpaque; // Opaque views handle all mouse events that are over their rect. - LLString mToolTipMsg; // isNull() is true if none. + LLUIString mToolTipMsg; // isNull() is true if none. U8 mSoundFlags; BOOL mSaveToXML; @@ -214,7 +215,8 @@ public: // MANIPULATORS // void setMouseOpaque( BOOL b ); - void setToolTip( const LLString& msg ); + void setToolTip( const LLStringExplicit& msg ); + BOOL setToolTipArg( const LLStringExplicit& key, const LLStringExplicit& text ); virtual void setRect(const LLRect &rect); void setFollows(U32 flags); -- cgit v1.1