aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/llalertdialog.cpp35
-rw-r--r--linden/indra/llui/llalertdialog.h24
-rw-r--r--linden/indra/llui/llbutton.cpp3
-rw-r--r--linden/indra/llui/llfloater.cpp29
-rw-r--r--linden/indra/llui/llfloater.h3
-rw-r--r--linden/indra/llui/lllineeditor.cpp14
-rw-r--r--linden/indra/llui/lllineeditor.h2
-rw-r--r--linden/indra/llui/llpanel.cpp10
-rw-r--r--linden/indra/llui/llpanel.h1
-rw-r--r--linden/indra/llui/llscrolllistctrl.cpp19
-rw-r--r--linden/indra/llui/llscrolllistctrl.h1
-rw-r--r--linden/indra/llui/lltextbox.cpp43
-rw-r--r--linden/indra/llui/lltextbox.h11
-rw-r--r--linden/indra/llui/lltexteditor.cpp14
-rw-r--r--linden/indra/llui/lltexteditor.h2
-rw-r--r--linden/indra/llui/llview.cpp18
-rw-r--r--linden/indra/llui/llview.h6
17 files changed, 174 insertions, 61 deletions
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;
58/*static*/ LLAlertDialog::display_callback_t LLAlertDialog::sDisplayCallback; 58/*static*/ LLAlertDialog::display_callback_t LLAlertDialog::sDisplayCallback;
59/*static*/ LLString LLAlertDialog::sStringSkipNextTime("Skip this dialog next time"); 59/*static*/ LLString LLAlertDialog::sStringSkipNextTime("Skip this dialog next time");
60/*static*/ LLString LLAlertDialog::sStringAlwaysChoose("Always choose this option"); 60/*static*/ LLString LLAlertDialog::sStringAlwaysChoose("Always choose this option");
61/*static*/ LLAlertDialog::URLLoader* LLAlertDialog::sURLLoader;
62
61 63
62//static 64//static
63LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, 65LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc,
@@ -147,8 +149,11 @@ LLAlertDialog::LLAlertDialog( const LLAlertDialogTemplate* xml_template,
147 mIgnoreLabel(xml_template->mIgnoreLabel), 149 mIgnoreLabel(xml_template->mIgnoreLabel),
148 mButtonData(NULL), 150 mButtonData(NULL),
149 mLineEditor(NULL), 151 mLineEditor(NULL),
150 mTextCallback(NULL) 152 mTextCallback(NULL),
153 mURLOption(0)
151{ 154{
155 mURL = xml_template->mURL;
156 mURLOption = xml_template->mURLOption;
152 createDialog(&(xml_template->mOptions), xml_template->mDefaultOption, 157 createDialog(&(xml_template->mOptions), xml_template->mDefaultOption,
153 xml_template->mMessage, args, 158 xml_template->mMessage, args,
154 xml_template->mEditLineText); 159 xml_template->mEditLineText);
@@ -237,12 +242,12 @@ bool LLAlertDialog::show()
237 return true; 242 return true;
238} 243}
239 244
240//static
241void LLAlertDialog::format(LLString& msg, const LLString::format_map_t& args) 245void LLAlertDialog::format(LLString& msg, const LLString::format_map_t& args)
242{ 246{
243 // XUI:translate! 247 // XUI:translate!
244 LLString::format_map_t targs = args; 248 LLString::format_map_t targs = args;
245 targs["[SECOND_LIFE]"] = "Second Life"; 249 targs["[SECOND_LIFE]"] = "Second Life";
250 targs["[_URL]"] = mURL;
246 LLString::format(msg, targs); 251 LLString::format(msg, targs);
247} 252}
248 253
@@ -288,7 +293,7 @@ void LLAlertDialog::createDialog(const std::vector<LLString>* optionsp, S32 defa
288 // Message: create text box using raw string, as text has been structure deliberately 293 // Message: create text box using raw string, as text has been structure deliberately
289 // Use size of created text box to generate dialog box size 294 // Use size of created text box to generate dialog box size
290 LLString msg = msg_in; 295 LLString msg = msg_in;
291 LLAlertDialog::format( msg, args ); 296 format( msg, args );
292 llwarns << "Alert: " << msg << llendl; 297 llwarns << "Alert: " << msg << llendl;
293 LLTextBox* msg_box = new LLTextBox( "Alert message", msg, (F32)MAX_ALLOWED_MSG_WIDTH, font ); 298 LLTextBox* msg_box = new LLTextBox( "Alert message", msg, (F32)MAX_ALLOWED_MSG_WIDTH, font );
294 299
@@ -424,6 +429,15 @@ LLAlertDialog::~LLAlertDialog()
424 mCallback(mOptionChosen, mUserData); 429 mCallback(mOptionChosen, mUserData);
425 } 430 }
426 431
432 // If we declared a URL and chose the URL option, go to the url
433 if (mOptionChosen == mURLOption)
434 {
435 if (!mURL.empty() && sURLLoader != NULL)
436 {
437 sURLLoader->load(mURL);
438 }
439 }
440
427 // Only change warn state if we actually warned. 441 // Only change warn state if we actually warned.
428 if (mCheck 442 if (mCheck
429 && sSettings->getWarning(mIgnoreLabel)) 443 && sSettings->getWarning(mIgnoreLabel))
@@ -547,7 +561,7 @@ void LLAlertDialog::setEditTextArgs(const LLString::format_map_t& edit_args)
547 if (mLineEditor) 561 if (mLineEditor)
548 { 562 {
549 LLString msg = mLineEditor->getText(); 563 LLString msg = mLineEditor->getText();
550 LLAlertDialog::format(msg, edit_args); 564 format(msg, edit_args);
551 mLineEditor->setText(msg); 565 mLineEditor->setText(msg);
552 } 566 }
553 else 567 else
@@ -790,6 +804,19 @@ bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* se
790 } 804 }
791 } 805 }
792 } 806 }
807
808 // <url>
809 if (child->hasName("url"))
810 {
811 S32 url_option = 0;
812 child->getAttributeS32("option", url_option);
813 if (xml_template)
814 {
815 xml_template->mURL = child->getTextContents();
816 xml_template->mURLOption = url_option;
817 }
818 }
819
793 } 820 }
794 if (xml_template) 821 if (xml_template)
795 { 822 {
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:
50 typedef bool (*display_callback_t)(S32 modal); 50 typedef bool (*display_callback_t)(S32 modal);
51 enum { IGNORE_USE_DEFAULT=1, IGNORE_USE_SAVED=2, IGNORE_SHOW_AGAIN=3 }; 51 enum { IGNORE_USE_DEFAULT=1, IGNORE_USE_SAVED=2, IGNORE_SHOW_AGAIN=3 };
52 52
53 class URLLoader
54 {
55 public:
56 virtual void load(const std::string& url) = 0;
57 virtual ~URLLoader() {}
58 };
59
60 static void setURLLoader(URLLoader* loader)
61 {
62 sURLLoader = loader;
63 };
64
53protected: 65protected:
54 struct ButtonData 66 struct ButtonData
55 { 67 {
@@ -98,7 +110,7 @@ public:
98 LLAlertDialog( const LLAlertDialogTemplate* xml_template, const LLString::format_map_t& args, 110 LLAlertDialog( const LLAlertDialogTemplate* xml_template, const LLString::format_map_t& args,
99 alert_callback_t callback = NULL, void *user_data = NULL); 111 alert_callback_t callback = NULL, void *user_data = NULL);
100 112
101 static void format(LLString& msg, const LLString::format_map_t& args); 113 void format(LLString& msg, const LLString::format_map_t& args);
102 114
103protected: 115protected:
104 void createDialog(const std::vector<LLString>* options, S32 default_option, 116 void createDialog(const std::vector<LLString>* options, S32 default_option,
@@ -126,6 +138,9 @@ protected:
126 // For Dialogs that take a line as text as input: 138 // For Dialogs that take a line as text as input:
127 LLLineEditor* mLineEditor; 139 LLLineEditor* mLineEditor;
128 alert_text_callback_t mTextCallback; 140 alert_text_callback_t mTextCallback;
141 // For Dialogs linked to a URL
142 LLString mURL; // Some alerts will direct the resident to a URL
143 S32 mURLOption;
129 144
130public: 145public:
131 // use LLPointer so they delete themselves when sTemplates is destroyed 146 // use LLPointer so they delete themselves when sTemplates is destroyed
@@ -138,6 +153,9 @@ public:
138 153
139 static LLString sStringSkipNextTime; 154 static LLString sStringSkipNextTime;
140 static LLString sStringAlwaysChoose; 155 static LLString sStringAlwaysChoose;
156
157private:
158 static URLLoader* sURLLoader;
141}; 159};
142 160
143//============================================================================ 161//============================================================================
@@ -145,7 +163,7 @@ public:
145class LLAlertDialogTemplate : public LLRefCount 163class LLAlertDialogTemplate : public LLRefCount
146{ 164{
147public: 165public:
148 LLAlertDialogTemplate() : mTitle(), mModal(FALSE), mUnique(FALSE), mIgnorable(0), mDefaultOption(0) {} 166 LLAlertDialogTemplate() : mTitle(), mURLOption(0), mModal(FALSE), mUnique(FALSE), mIgnorable(0), mDefaultOption(0) {}
149 167
150 void addOption(const LLString& label, const LLString& ignore_text, BOOL is_default = FALSE) 168 void addOption(const LLString& label, const LLString& ignore_text, BOOL is_default = FALSE)
151 { 169 {
@@ -184,6 +202,8 @@ public:
184 LLString mMessage; // Message to display 202 LLString mMessage; // Message to display
185 LLString mIgnoreListText; // Text to display in enable/disable dialog (if mIgnorable == TRUE) 203 LLString mIgnoreListText; // Text to display in enable/disable dialog (if mIgnorable == TRUE)
186 LLString mIgnoreLabel; // Handle for ignore variable (may be shared by multiple templates) 204 LLString mIgnoreLabel; // Handle for ignore variable (may be shared by multiple templates)
205 LLString mURL; // Some alerts will direct the resident to a URL
206 S32 mURLOption;
187 BOOL mModal; 207 BOOL mModal;
188 BOOL mUnique; 208 BOOL mUnique;
189 S32 mIgnorable; // 0 = Never Ignore, 1 = Do default option, 2 = Do saved option 209 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)
368 (*mClickedCallback)( mCallbackUserData ); 368 (*mClickedCallback)( mCallbackUserData );
369 } 369 }
370 } 370 }
371
372 mMouseDownTimer.stop();
373 mMouseDownTimer.reset();
374 } 371 }
375 372
376 return TRUE; 373 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)
834 LLView* viewp = *child_it; 834 LLView* viewp = *child_it;
835 if (!viewp->getVisible()) 835 if (!viewp->getVisible())
836 { 836 {
837 mMinimizedHiddenChildren.push_back(viewp); 837 mMinimizedHiddenChildren.push_back(viewp->mViewHandle);
838 } 838 }
839 viewp->setVisible(FALSE); 839 viewp->setVisible(FALSE);
840 } 840 }
@@ -897,11 +897,14 @@ void LLFloater::setMinimized(BOOL minimize)
897 viewp->setVisible(TRUE); 897 viewp->setVisible(TRUE);
898 } 898 }
899 899
900 std::vector<LLView*>::iterator itor = mMinimizedHiddenChildren.begin(); 900 std::vector<LLViewHandle>::iterator itor = mMinimizedHiddenChildren.begin();
901 while (itor != mMinimizedHiddenChildren.end()) 901 for ( ; itor != mMinimizedHiddenChildren.end(); ++itor)
902 { 902 {
903 (*itor)->setVisible(FALSE); 903 LLView* viewp = LLView::getViewByHandle(*itor);
904 ++itor; 904 if(viewp)
905 {
906 viewp->setVisible(FALSE);
907 }
905 } 908 }
906 mMinimizedHiddenChildren.clear(); 909 mMinimizedHiddenChildren.clear();
907 910
@@ -2220,7 +2223,6 @@ BOOL LLFloaterView::allChildrenClosed()
2220{ 2223{
2221 // see if there are any visible floaters (some floaters "close" 2224 // see if there are any visible floaters (some floaters "close"
2222 // by setting themselves invisible) 2225 // by setting themselves invisible)
2223 S32 visible_count = 0;
2224 for (child_list_const_iter_t it = getChildList()->begin(); it != getChildList()->end(); ++it) 2226 for (child_list_const_iter_t it = getChildList()->begin(); it != getChildList()->end(); ++it)
2225 { 2227 {
2226 LLView* viewp = *it; 2228 LLView* viewp = *it;
@@ -2228,11 +2230,10 @@ BOOL LLFloaterView::allChildrenClosed()
2228 2230
2229 if (floaterp->getVisible() && floaterp->canClose()) 2231 if (floaterp->getVisible() && floaterp->canClose())
2230 { 2232 {
2231 visible_count++; 2233 return false;
2232 } 2234 }
2233 } 2235 }
2234 2236 return true;
2235 return (visible_count == 0);
2236} 2237}
2237 2238
2238 2239
@@ -2270,14 +2271,22 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
2270 S32 min_height; 2271 S32 min_height;
2271 floater->getResizeLimits( &min_width, &min_height ); 2272 floater->getResizeLimits( &min_width, &min_height );
2272 2273
2274 // Make sure floater isn't already smaller than its min height/width?
2273 S32 new_width = llmax( min_width, view_width ); 2275 S32 new_width = llmax( min_width, view_width );
2274 S32 new_height = llmax( min_height, view_height ); 2276 S32 new_height = llmax( min_height, view_height );
2275 2277
2276 if( (new_width > screen_width) || (new_height > screen_height) ) 2278 if( !allow_partial_outside
2279 && ( (new_width > screen_width)
2280 || (new_height > screen_height) ) )
2277 { 2281 {
2282 // We have to force this window to be inside the screen.
2278 new_width = llmin(new_width, screen_width); 2283 new_width = llmin(new_width, screen_width);
2279 new_height = llmin(new_height, screen_height); 2284 new_height = llmin(new_height, screen_height);
2280 2285
2286 // Still respect minimum width/height
2287 new_width = llmax(new_width, min_width);
2288 new_height = llmax(new_height, min_height);
2289
2281 floater->reshape( new_width, new_height, TRUE ); 2290 floater->reshape( new_width, new_height, TRUE );
2282 2291
2283 // Make sure the damn thing is actually onscreen. 2292 // 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:
286 typedef std::map<LLViewHandle, LLFloater*>::iterator handle_map_iter_t; 286 typedef std::map<LLViewHandle, LLFloater*>::iterator handle_map_iter_t;
287 static handle_map_t sFloaterMap; 287 static handle_map_t sFloaterMap;
288 288
289 std::vector<LLView*> mMinimizedHiddenChildren; 289 std::vector<LLViewHandle> mMinimizedHiddenChildren;
290 290
291 BOOL mHasBeenDraggedWhileMinimized; 291 BOOL mHasBeenDraggedWhileMinimized;
292 S32 mPreviousMinimizedBottom; 292 S32 mPreviousMinimizedBottom;
@@ -429,3 +429,4 @@ extern LLFloaterView* gFloaterView;
429#endif // LL_FLOATER_H 429#endif // LL_FLOATER_H
430 430
431 431
432
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,
158 mHandleEditKeysDirectly( FALSE ), 158 mHandleEditKeysDirectly( FALSE ),
159 mSelectAllonFocusReceived( FALSE ), 159 mSelectAllonFocusReceived( FALSE ),
160 mPassDelete(FALSE), 160 mPassDelete(FALSE),
161 mReadOnly(FALSE), 161 mReadOnly(FALSE)
162 mLastIMEPosition( -1, -1 )
163{ 162{
164 llassert( max_length_bytes > 0 ); 163 llassert( max_length_bytes > 0 );
165 164
@@ -1638,15 +1637,10 @@ void LLLineEditor::draw()
1638 S32 pixels_after_scroll = findPixelNearestPos(); // RCalculcate for IME position 1637 S32 pixels_after_scroll = findPixelNearestPos(); // RCalculcate for IME position
1639 LLRect screen_pos = getScreenRect(); 1638 LLRect screen_pos = getScreenRect();
1640 LLCoordGL ime_pos( screen_pos.mLeft + pixels_after_scroll, screen_pos.mTop - UI_LINEEDITOR_V_PAD ); 1639 LLCoordGL ime_pos( screen_pos.mLeft + pixels_after_scroll, screen_pos.mTop - UI_LINEEDITOR_V_PAD );
1641 if ( ime_pos.mX != mLastIMEPosition.mX || ime_pos.mY != mLastIMEPosition.mY )
1642 {
1643 mLastIMEPosition.mX = ime_pos.mX;
1644 mLastIMEPosition.mY = ime_pos.mY;
1645 1640
1646 ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]); 1641 ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]);
1647 ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]); 1642 ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]);
1648 getWindow()->setLanguageTextInput( ime_pos ); 1643 getWindow()->setLanguageTextInput( ime_pos );
1649 }
1650 } 1644 }
1651 } 1645 }
1652 1646
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:
279 279
280 S32 mBorderThickness; 280 S32 mBorderThickness;
281 281
282 LLCoordGL mLastIMEPosition; // Last screen position used for the IME editor
283
284 BOOL mIgnoreArrowKeys; 282 BOOL mIgnoreArrowKeys;
285 BOOL mIgnoreTab; 283 BOOL mIgnoreTab;
286 BOOL mDrawAsterixes; 284 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
982 return FALSE; 982 return FALSE;
983} 983}
984 984
985BOOL LLPanel::childSetToolTipArg(const LLString& id, const LLString& key, const LLStringExplicit& text)
986{
987 LLView* child = getChildByName(id, true);
988 if (child)
989 {
990 return child->setToolTipArg(key, text);
991 }
992 return FALSE;
993}
994
985void LLPanel::childSetMinValue(const LLString& id, LLSD min_value) 995void LLPanel::childSetMinValue(const LLString& id, LLSD min_value)
986{ 996{
987 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 997 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:
194 // Not implemented for all types, defaults to noop, returns FALSE if not applicaple 194 // Not implemented for all types, defaults to noop, returns FALSE if not applicaple
195 BOOL childSetTextArg(const LLString& id, const LLString& key, const LLStringExplicit& text); 195 BOOL childSetTextArg(const LLString& id, const LLString& key, const LLStringExplicit& text);
196 BOOL childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text); 196 BOOL childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text);
197 BOOL childSetToolTipArg(const LLString& id, const LLString& key, const LLStringExplicit& text);
197 198
198 // LLSlider / LLSpinCtrl 199 // LLSlider / LLSpinCtrl
199 void childSetMinValue(const LLString& id, LLSD min_value); 200 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 )
701 break; 701 break;
702 } 702 }
703 703
704 updateLineHeight(); 704 updateLineHeightInsert(item);
705 mPageLines = mLineHeight ? mItemListRect.getHeight() / mLineHeight : 0; 705 mPageLines = mLineHeight ? mItemListRect.getHeight() / mLineHeight : 0;
706 BOOL scrollbar_visible = mPageLines < getItemCount(); 706 BOOL scrollbar_visible = mPageLines < getItemCount();
707 707
@@ -753,12 +753,11 @@ void LLScrollListCtrl::updateMaxContentWidth(LLScrollListItem* added_item)
753 } 753 }
754} 754}
755 755
756const S32 SCROLL_LIST_ROW_PAD = 2;
756 757
757// Line height is the max height of all the cells in all the items. 758// Line height is the max height of all the cells in all the items.
758void LLScrollListCtrl::updateLineHeight() 759void LLScrollListCtrl::updateLineHeight()
759{ 760{
760 const S32 ROW_PAD = 2;
761
762 mLineHeight = 0; 761 mLineHeight = 0;
763 item_list::iterator iter; 762 item_list::iterator iter;
764 for (iter = mItemList.begin(); iter != mItemList.end(); iter++) 763 for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
@@ -768,11 +767,23 @@ void LLScrollListCtrl::updateLineHeight()
768 S32 i = 0; 767 S32 i = 0;
769 for (const LLScrollListCell* cell = itemp->getColumn(i); i < num_cols; cell = itemp->getColumn(++i)) 768 for (const LLScrollListCell* cell = itemp->getColumn(i); i < num_cols; cell = itemp->getColumn(++i))
770 { 769 {
771 mLineHeight = llmax( mLineHeight, cell->getHeight() + ROW_PAD ); 770 mLineHeight = llmax( mLineHeight, cell->getHeight() + SCROLL_LIST_ROW_PAD );
772 } 771 }
773 } 772 }
774} 773}
775 774
775// when the only change to line height is from an insert, we needn't scan the entire list
776void LLScrollListCtrl::updateLineHeightInsert(LLScrollListItem* itemp)
777{
778 S32 num_cols = itemp->getNumColumns();
779 S32 i = 0;
780 for (const LLScrollListCell* cell = itemp->getColumn(i); i < num_cols; cell = itemp->getColumn(++i))
781 {
782 mLineHeight = llmax( mLineHeight, cell->getHeight() + SCROLL_LIST_ROW_PAD );
783 }
784}
785
786
776void LLScrollListCtrl::updateColumns() 787void LLScrollListCtrl::updateColumns()
777{ 788{
778 mColumnsIndexed.resize(mColumns.size()); 789 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:
589 void selectNextItem(BOOL extend_selection); 589 void selectNextItem(BOOL extend_selection);
590 void drawItems(); 590 void drawItems();
591 void updateLineHeight(); 591 void updateLineHeight();
592 void updateLineHeightInsert(LLScrollListItem* item);
592 void reportInvalidInput(); 593 void reportInvalidInput();
593 BOOL isRepeatedChars(const LLWString& string) const; 594 BOOL isRepeatedChars(const LLWString& string) const;
594 void selectItem(LLScrollListItem* itemp, BOOL single_select = TRUE); 595 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
49 mDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), 49 mDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ),
50 mBackgroundColor( LLUI::sColorsGroup->getColor( "DefaultBackgroundColor" ) ), 50 mBackgroundColor( LLUI::sColorsGroup->getColor( "DefaultBackgroundColor" ) ),
51 mBorderColor( LLUI::sColorsGroup->getColor( "DefaultHighlightLight" ) ), 51 mBorderColor( LLUI::sColorsGroup->getColor( "DefaultHighlightLight" ) ),
52 mHoverColor( LLUI::sColorsGroup->getColor( "LabelSelectedColor" ) ),
53 mHoverActive( FALSE ),
54 mHasHover( FALSE ),
52 mBackgroundVisible( FALSE ), 55 mBackgroundVisible( FALSE ),
53 mBorderVisible( FALSE ), 56 mBorderVisible( FALSE ),
54 mFontStyle(LLFontGL::DROP_SHADOW_SOFT), 57 mFontStyle(LLFontGL::DROP_SHADOW_SOFT),
@@ -74,6 +77,9 @@ LLTextBox::LLTextBox(const LLString& name, const LLString& text, F32 max_width,
74 mDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")), 77 mDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")),
75 mBackgroundColor(LLUI::sColorsGroup->getColor("DefaultBackgroundColor")), 78 mBackgroundColor(LLUI::sColorsGroup->getColor("DefaultBackgroundColor")),
76 mBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")), 79 mBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")),
80 mHoverColor( LLUI::sColorsGroup->getColor( "LabelSelectedColor" ) ),
81 mHoverActive( FALSE ),
82 mHasHover( FALSE ),
77 mBackgroundVisible(FALSE), 83 mBackgroundVisible(FALSE),
78 mBorderVisible(FALSE), 84 mBorderVisible(FALSE),
79 mFontStyle(LLFontGL::DROP_SHADOW_SOFT), 85 mFontStyle(LLFontGL::DROP_SHADOW_SOFT),
@@ -161,6 +167,16 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask)
161 return handled; 167 return handled;
162} 168}
163 169
170BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask)
171{
172 if(mHoverActive)
173 {
174 mHasHover = TRUE; // This should be set every frame during a hover.
175 return TRUE;
176 }
177 return FALSE;
178}
179
164void LLTextBox::setText(const LLStringExplicit& text) 180void LLTextBox::setText(const LLStringExplicit& text)
165{ 181{
166 mText.assign(text); 182 mText.assign(text);
@@ -334,7 +350,15 @@ void LLTextBox::draw()
334 350
335 if ( getEnabled() ) 351 if ( getEnabled() )
336 { 352 {
337 drawText( text_x, text_y, mTextColor ); 353 if(mHasHover)
354 {
355 drawText( text_x, text_y, mHoverColor );
356 }
357 else
358 {
359 drawText( text_x, text_y, mTextColor );
360 }
361
338 } 362 }
339 else 363 else
340 { 364 {
@@ -346,6 +370,8 @@ void LLTextBox::draw()
346 drawDebugRect(); 370 drawDebugRect();
347 } 371 }
348 } 372 }
373
374 mHasHover = FALSE; // This is reset every frame.
349} 375}
350 376
351void LLTextBox::reshape(S32 width, S32 height, BOOL called_from_parent) 377void LLTextBox::reshape(S32 width, S32 height, BOOL called_from_parent)
@@ -468,5 +494,20 @@ LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
468 text_box->setColor(color); 494 text_box->setColor(color);
469 } 495 }
470 496
497 if(node->hasAttribute("hover_color"))
498 {
499 LLColor4 color;
500 LLUICtrlFactory::getAttributeColor(node, "hover_color", color);
501 text_box->setHoverColor(color);
502 text_box->setHoverActive(true);
503 }
504
505 BOOL hover_active = FALSE;
506 if(node->getAttributeBOOL("hover", hover_active))
507 {
508 text_box->setHoverActive(hover_active);
509 }
510
511
471 return text_box; 512 return text_box;
472} 513}
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:
66 66
67 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); 67 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
68 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); 68 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
69 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
69 70
70 void setColor( const LLColor4& c ) { mTextColor = c; } 71 void setColor( const LLColor4& c ) { mTextColor = c; }
71 void setDisabledColor( const LLColor4& c) { mDisabledColor = c; } 72 void setDisabledColor( const LLColor4& c) { mDisabledColor = c; }
72 void setBackgroundColor( const LLColor4& c) { mBackgroundColor = c; } 73 void setBackgroundColor( const LLColor4& c) { mBackgroundColor = c; }
73 void setBorderColor( const LLColor4& c) { mBorderColor = c; } 74 void setBorderColor( const LLColor4& c) { mBorderColor = c; }
75
76 void setHoverColor( const LLColor4& c ) { mHoverColor = c; }
77 void setHoverActive( BOOL active ) { mHoverActive = active; }
78
74 void setText( const LLStringExplicit& text ); 79 void setText( const LLStringExplicit& text );
75 void setWrappedText(const LLStringExplicit& text, F32 max_width = -1.0); 80 void setWrappedText(const LLStringExplicit& text, F32 max_width = -1.0);
76 // default width means use existing control width 81 // default width means use existing control width
@@ -108,10 +113,12 @@ protected:
108 const LLFontGL* mFontGL; 113 const LLFontGL* mFontGL;
109 LLColor4 mTextColor; 114 LLColor4 mTextColor;
110 LLColor4 mDisabledColor; 115 LLColor4 mDisabledColor;
111
112 LLColor4 mBackgroundColor; 116 LLColor4 mBackgroundColor;
113 LLColor4 mBorderColor; 117 LLColor4 mBorderColor;
114 118 LLColor4 mHoverColor;
119
120 BOOL mHoverActive;
121 BOOL mHasHover;
115 BOOL mBackgroundVisible; 122 BOOL mBackgroundVisible;
116 BOOL mBorderVisible; 123 BOOL mBorderVisible;
117 124
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(
310 mMouseDownX(0), 310 mMouseDownX(0),
311 mMouseDownY(0), 311 mMouseDownY(0),
312 mLastSelectionX(-1), 312 mLastSelectionX(-1),
313 mLastSelectionY(-1), 313 mLastSelectionY(-1)
314 mLastIMEPosition(-1,-1)
315{ 314{
316 mSourceID.generate(); 315 mSourceID.generate();
317 316
@@ -2817,15 +2816,10 @@ void LLTextEditor::drawCursor()
2817 // Make sure the IME is in the right place 2816 // Make sure the IME is in the right place
2818 LLRect screen_pos = getScreenRect(); 2817 LLRect screen_pos = getScreenRect();
2819 LLCoordGL ime_pos( screen_pos.mLeft + llfloor(cursor_left), screen_pos.mBottom + llfloor(cursor_top) ); 2818 LLCoordGL ime_pos( screen_pos.mLeft + llfloor(cursor_left), screen_pos.mBottom + llfloor(cursor_top) );
2820 if ( ime_pos.mX != mLastIMEPosition.mX || ime_pos.mY != mLastIMEPosition.mY )
2821 {
2822 mLastIMEPosition.mX = ime_pos.mX;
2823 mLastIMEPosition.mY = ime_pos.mY;
2824 2819
2825 ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]); 2820 ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]);
2826 ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]); 2821 ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]);
2827 getWindow()->setLanguageTextInput( ime_pos ); 2822 getWindow()->setLanguageTextInput( ime_pos );
2828 }
2829 } 2823 }
2830 } 2824 }
2831 } 2825 }
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:
439 439
440 BOOL mParseHTML; 440 BOOL mParseHTML;
441 LLString mHTML; 441 LLString mHTML;
442
443 LLCoordGL mLastIMEPosition; // Last position of the IME editor
444}; 442};
445 443
446class LLTextSegment 444class 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)
224 mMouseOpaque = b; 224 mMouseOpaque = b;
225} 225}
226 226
227void LLView::setToolTip(const LLString& msg) 227void LLView::setToolTip(const LLStringExplicit& msg)
228{ 228{
229 mToolTipMsg = msg; 229 mToolTipMsg = msg;
230} 230}
231 231
232BOOL LLView::setToolTipArg(const LLStringExplicit& key, const LLStringExplicit& text)
233{
234 mToolTipMsg.setArg(key, text);
235 return TRUE;
236}
237
232// virtual 238// virtual
233void LLView::setRect(const LLRect& rect) 239void LLView::setRect(const LLRect& rect)
234{ 240{
@@ -288,7 +294,7 @@ void LLView::setSpanChildren( BOOL span_children )
288 294
289const LLString& LLView::getToolTip() 295const LLString& LLView::getToolTip()
290{ 296{
291 return mToolTipMsg; 297 return mToolTipMsg.getString();
292} 298}
293 299
294// virtual 300// virtual
@@ -884,18 +890,14 @@ BOOL LLView::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_scre
884 } 890 }
885 } 891 }
886 892
887 if (LLUI::sShowXUINames && (mToolTipMsg.find(".xml", 0) == LLString::npos) && 893 tool_tip = mToolTipMsg.getString();
894 if (LLUI::sShowXUINames && (tool_tip.find(".xml", 0) == LLString::npos) &&
888 (mName.find("Drag", 0) == LLString::npos)) 895 (mName.find("Drag", 0) == LLString::npos))
889 { 896 {
890 tool_tip = getShowNamesToolTip(); 897 tool_tip = getShowNamesToolTip();
891 } 898 }
892 else
893 {
894 tool_tip = mToolTipMsg;
895 }
896 899
897 900
898
899 BOOL showNamesTextBox = LLUI::sShowXUINames && (getWidgetType() == WIDGET_TYPE_TEXT_BOX); 901 BOOL showNamesTextBox = LLUI::sShowXUINames && (getWidgetType() == WIDGET_TYPE_TEXT_BOX);
900 902
901 if( !handled && (mMouseOpaque || showNamesTextBox) && pointInView( x, y ) && !tool_tip.empty()) 903 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 @@
45#include "llstring.h" 45#include "llstring.h"
46#include "llrect.h" 46#include "llrect.h"
47#include "llui.h" 47#include "llui.h"
48#include "lluistring.h"
48#include "lluixmltags.h" 49#include "lluixmltags.h"
49#include "llviewquery.h" 50#include "llviewquery.h"
50#include "llxmlnode.h" 51#include "llxmlnode.h"
@@ -154,7 +155,7 @@ protected:
154 BOOL mEnabled; // Enabled means "accepts input that has an effect on the state of the application." 155 BOOL mEnabled; // Enabled means "accepts input that has an effect on the state of the application."
155 // A disabled view, for example, may still have a scrollbar that responds to mouse events. 156 // A disabled view, for example, may still have a scrollbar that responds to mouse events.
156 BOOL mMouseOpaque; // Opaque views handle all mouse events that are over their rect. 157 BOOL mMouseOpaque; // Opaque views handle all mouse events that are over their rect.
157 LLString mToolTipMsg; // isNull() is true if none. 158 LLUIString mToolTipMsg; // isNull() is true if none.
158 159
159 U8 mSoundFlags; 160 U8 mSoundFlags;
160 BOOL mSaveToXML; 161 BOOL mSaveToXML;
@@ -214,7 +215,8 @@ public:
214 // MANIPULATORS 215 // MANIPULATORS
215 // 216 //
216 void setMouseOpaque( BOOL b ); 217 void setMouseOpaque( BOOL b );
217 void setToolTip( const LLString& msg ); 218 void setToolTip( const LLStringExplicit& msg );
219 BOOL setToolTipArg( const LLStringExplicit& key, const LLStringExplicit& text );
218 220
219 virtual void setRect(const LLRect &rect); 221 virtual void setRect(const LLRect &rect);
220 void setFollows(U32 flags); 222 void setFollows(U32 flags);