diff options
Diffstat (limited to 'linden/indra/llui')
-rw-r--r-- | linden/indra/llui/llbutton.cpp | 12 | ||||
-rw-r--r-- | linden/indra/llui/llcombobox.cpp | 4 | ||||
-rw-r--r-- | linden/indra/llui/llcombobox.h | 2 | ||||
-rw-r--r-- | linden/indra/llui/llfloater.cpp | 17 | ||||
-rw-r--r-- | linden/indra/llui/lllineeditor.cpp | 36 | ||||
-rw-r--r-- | linden/indra/llui/llpanel.cpp | 13 | ||||
-rw-r--r-- | linden/indra/llui/llpanel.h | 1 | ||||
-rw-r--r-- | linden/indra/llui/llscrolllistctrl.cpp | 30 | ||||
-rw-r--r-- | linden/indra/llui/llscrolllistctrl.h | 3 | ||||
-rw-r--r-- | linden/indra/llui/lltexteditor.cpp | 32 |
10 files changed, 58 insertions, 92 deletions
diff --git a/linden/indra/llui/llbutton.cpp b/linden/indra/llui/llbutton.cpp index 9fa1c8e..7513fc2 100644 --- a/linden/indra/llui/llbutton.cpp +++ b/linden/indra/llui/llbutton.cpp | |||
@@ -956,37 +956,37 @@ S32 round_up(S32 grid, S32 value) | |||
956 | 956 | ||
957 | void LLButton::setImageUnselected(const LLString &image_name) | 957 | void LLButton::setImageUnselected(const LLString &image_name) |
958 | { | 958 | { |
959 | setImageUnselected(LLUI::getUIImageByName(image_name)); | 959 | setImageUnselected(image_name.empty() ? NULL : LLUI::getUIImageByName(image_name)); |
960 | mImageUnselectedName = image_name; | 960 | mImageUnselectedName = image_name; |
961 | } | 961 | } |
962 | 962 | ||
963 | void LLButton::setImageSelected(const LLString &image_name) | 963 | void LLButton::setImageSelected(const LLString &image_name) |
964 | { | 964 | { |
965 | setImageSelected(LLUI::getUIImageByName(image_name)); | 965 | setImageSelected(image_name.empty() ? NULL : LLUI::getUIImageByName(image_name)); |
966 | mImageSelectedName = image_name; | 966 | mImageSelectedName = image_name; |
967 | } | 967 | } |
968 | 968 | ||
969 | void LLButton::setImageHoverSelected(const LLString &image_name) | 969 | void LLButton::setImageHoverSelected(const LLString &image_name) |
970 | { | 970 | { |
971 | setImageHoverSelected(LLUI::getUIImageByName(image_name)); | 971 | setImageHoverSelected(image_name.empty() ? NULL : LLUI::getUIImageByName(image_name)); |
972 | mImageHoverSelectedName = image_name; | 972 | mImageHoverSelectedName = image_name; |
973 | } | 973 | } |
974 | 974 | ||
975 | void LLButton::setImageHoverUnselected(const LLString &image_name) | 975 | void LLButton::setImageHoverUnselected(const LLString &image_name) |
976 | { | 976 | { |
977 | setImageHoverUnselected(LLUI::getUIImageByName(image_name)); | 977 | setImageHoverUnselected(image_name.empty() ? NULL : LLUI::getUIImageByName(image_name)); |
978 | mImageHoverUnselectedName = image_name; | 978 | mImageHoverUnselectedName = image_name; |
979 | } | 979 | } |
980 | 980 | ||
981 | void LLButton::setImageDisabled(const LLString &image_name) | 981 | void LLButton::setImageDisabled(const LLString &image_name) |
982 | { | 982 | { |
983 | setImageDisabled(LLUI::getUIImageByName(image_name)); | 983 | setImageDisabled(image_name.empty() ? NULL : LLUI::getUIImageByName(image_name)); |
984 | mImageDisabledName = image_name; | 984 | mImageDisabledName = image_name; |
985 | } | 985 | } |
986 | 986 | ||
987 | void LLButton::setImageDisabledSelected(const LLString &image_name) | 987 | void LLButton::setImageDisabledSelected(const LLString &image_name) |
988 | { | 988 | { |
989 | setImageDisabledSelected(LLUI::getUIImageByName(image_name)); | 989 | setImageDisabledSelected(image_name.empty() ? NULL : LLUI::getUIImageByName(image_name)); |
990 | mImageDisabledSelectedName = image_name; | 990 | mImageDisabledSelectedName = image_name; |
991 | } | 991 | } |
992 | 992 | ||
diff --git a/linden/indra/llui/llcombobox.cpp b/linden/indra/llui/llcombobox.cpp index 96092b4..0e0f5f2 100644 --- a/linden/indra/llui/llcombobox.cpp +++ b/linden/indra/llui/llcombobox.cpp | |||
@@ -1086,6 +1086,10 @@ BOOL LLComboBox::operateOnAll(EOperation op) | |||
1086 | return FALSE; | 1086 | return FALSE; |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | BOOL LLComboBox::selectItemRange( S32 first, S32 last ) | ||
1090 | { | ||
1091 | return mList->selectItemRange(first, last); | ||
1092 | } | ||
1089 | 1093 | ||
1090 | 1094 | ||
1091 | // | 1095 | // |
diff --git a/linden/indra/llui/llcombobox.h b/linden/indra/llui/llcombobox.h index 7511449..db1c251 100644 --- a/linden/indra/llui/llcombobox.h +++ b/linden/indra/llui/llcombobox.h | |||
@@ -156,7 +156,7 @@ public: | |||
156 | virtual BOOL getCanSelect() const { return TRUE; } | 156 | virtual BOOL getCanSelect() const { return TRUE; } |
157 | virtual BOOL selectFirstItem() { return setCurrentByIndex(0); } | 157 | virtual BOOL selectFirstItem() { return setCurrentByIndex(0); } |
158 | virtual BOOL selectNthItem( S32 index ) { return setCurrentByIndex(index); } | 158 | virtual BOOL selectNthItem( S32 index ) { return setCurrentByIndex(index); } |
159 | virtual BOOL selectItemRange( S32 first, S32 last ) { return setCurrentByIndex(first); } | 159 | virtual BOOL selectItemRange( S32 first, S32 last ); |
160 | virtual S32 getFirstSelectedIndex() const { return getCurrentIndex(); } | 160 | virtual S32 getFirstSelectedIndex() const { return getCurrentIndex(); } |
161 | virtual BOOL setCurrentByID( const LLUUID& id ); | 161 | virtual BOOL setCurrentByID( const LLUUID& id ); |
162 | virtual LLUUID getCurrentID(); // LLUUID::null if no items in menu | 162 | virtual LLUUID getCurrentID(); // LLUUID::null if no items in menu |
diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp index 496b67f..6d86652 100644 --- a/linden/indra/llui/llfloater.cpp +++ b/linden/indra/llui/llfloater.cpp | |||
@@ -1434,21 +1434,7 @@ void LLFloater::draw() | |||
1434 | } | 1434 | } |
1435 | } | 1435 | } |
1436 | 1436 | ||
1437 | if( mDefaultBtn) | 1437 | LLPanel::updateDefaultBtn(); |
1438 | { | ||
1439 | if (gFocusMgr.childHasKeyboardFocus( this ) && mDefaultBtn->getEnabled()) | ||
1440 | { | ||
1441 | LLUICtrl* focus_ctrl = gFocusMgr.getKeyboardFocus(); | ||
1442 | // is this button a direct descendent and not a nested widget (e.g. checkbox)? | ||
1443 | BOOL focus_is_child_button = focus_ctrl->getWidgetType() == WIDGET_TYPE_BUTTON && focus_ctrl->getParent() == this; | ||
1444 | // only enable default button when current focus is not a button | ||
1445 | mDefaultBtn->setBorderEnabled(!focus_is_child_button); | ||
1446 | } | ||
1447 | else | ||
1448 | { | ||
1449 | mDefaultBtn->setBorderEnabled(FALSE); | ||
1450 | } | ||
1451 | } | ||
1452 | 1438 | ||
1453 | // draw children | 1439 | // draw children |
1454 | LLView* focused_child = gFocusMgr.getKeyboardFocus(); | 1440 | LLView* focused_child = gFocusMgr.getKeyboardFocus(); |
@@ -1459,6 +1445,7 @@ void LLFloater::draw() | |||
1459 | focused_child->setVisible(FALSE); | 1445 | focused_child->setVisible(FALSE); |
1460 | } | 1446 | } |
1461 | 1447 | ||
1448 | // don't call LLPanel::draw() since we've implemented custom background rendering | ||
1462 | LLView::draw(); | 1449 | LLView::draw(); |
1463 | 1450 | ||
1464 | if( mBgVisible ) | 1451 | if( mBgVisible ) |
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp index 88c8d75..b091bb7 100644 --- a/linden/indra/llui/lllineeditor.cpp +++ b/linden/indra/llui/lllineeditor.cpp | |||
@@ -2418,6 +2418,12 @@ void LLLineEditor::resetPreedit() | |||
2418 | { | 2418 | { |
2419 | if (hasPreeditString()) | 2419 | if (hasPreeditString()) |
2420 | { | 2420 | { |
2421 | if (hasSelection()) | ||
2422 | { | ||
2423 | llwarns << "Preedit and selection!" << llendl; | ||
2424 | deselect(); | ||
2425 | } | ||
2426 | |||
2421 | const S32 preedit_pos = mPreeditPositions.front(); | 2427 | const S32 preedit_pos = mPreeditPositions.front(); |
2422 | mText.erase(preedit_pos, mPreeditPositions.back() - preedit_pos); | 2428 | mText.erase(preedit_pos, mPreeditPositions.back() - preedit_pos); |
2423 | mText.insert(preedit_pos, mPreeditOverwrittenWString); | 2429 | mText.insert(preedit_pos, mPreeditOverwrittenWString); |
@@ -2427,11 +2433,10 @@ void LLLineEditor::resetPreedit() | |||
2427 | mPreeditOverwrittenWString.clear(); | 2433 | mPreeditOverwrittenWString.clear(); |
2428 | mPreeditPositions.clear(); | 2434 | mPreeditPositions.clear(); |
2429 | 2435 | ||
2430 | mKeystrokeTimer.reset(); | 2436 | // Don't reset key stroke timer nor invoke keystroke callback, |
2431 | if (mKeystrokeCallback) | 2437 | // because a call to updatePreedit should be follow soon in |
2432 | { | 2438 | // normal course of operation, and timer and callback will be |
2433 | mKeystrokeCallback(this, mCallbackUserData); | 2439 | // maintained there. Doing so here made an odd sound. (VWR-3410) |
2434 | } | ||
2435 | } | 2440 | } |
2436 | } | 2441 | } |
2437 | 2442 | ||
@@ -2444,27 +2449,10 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string, | |||
2444 | return; | 2449 | return; |
2445 | } | 2450 | } |
2446 | 2451 | ||
2447 | if (hasSelection()) | 2452 | // Note that call to updatePreedit is always preceeded by resetPreedit, |
2448 | { | 2453 | // so we have no existing selection/preedit. |
2449 | if (hasPreeditString()) | ||
2450 | { | ||
2451 | llwarns << "Preedit and selection!" << llendl; | ||
2452 | deselect(); | ||
2453 | } | ||
2454 | else | ||
2455 | { | ||
2456 | deleteSelection(); | ||
2457 | } | ||
2458 | } | ||
2459 | 2454 | ||
2460 | S32 insert_preedit_at = getCursor(); | 2455 | S32 insert_preedit_at = getCursor(); |
2461 | if (hasPreeditString()) | ||
2462 | { | ||
2463 | insert_preedit_at = mPreeditPositions.front(); | ||
2464 | //mText.replace(insert_preedit_at, mPreeditPositions.back() - insert_preedit_at, mPreeditOverwrittenWString); | ||
2465 | mText.erase(insert_preedit_at, mPreeditPositions.back() - insert_preedit_at); | ||
2466 | mText.insert(insert_preedit_at, mPreeditOverwrittenWString); | ||
2467 | } | ||
2468 | 2456 | ||
2469 | mPreeditWString = preedit_string; | 2457 | mPreeditWString = preedit_string; |
2470 | mPreeditPositions.resize(preedit_segment_lengths.size() + 1); | 2458 | mPreeditPositions.resize(preedit_segment_lengths.size() + 1); |
diff --git a/linden/indra/llui/llpanel.cpp b/linden/indra/llui/llpanel.cpp index 7430e50..b72e104 100644 --- a/linden/indra/llui/llpanel.cpp +++ b/linden/indra/llui/llpanel.cpp | |||
@@ -214,6 +214,17 @@ void LLPanel::draw() | |||
214 | } | 214 | } |
215 | } | 215 | } |
216 | 216 | ||
217 | updateDefaultBtn(); | ||
218 | |||
219 | LLView::draw(); | ||
220 | } | ||
221 | |||
222 | void LLPanel::updateDefaultBtn() | ||
223 | { | ||
224 | // This method does not call LLView::draw() so callers will need | ||
225 | // to take care of that themselves at the appropriate place in | ||
226 | // their rendering sequence | ||
227 | |||
217 | if( mDefaultBtn) | 228 | if( mDefaultBtn) |
218 | { | 229 | { |
219 | if (gFocusMgr.childHasKeyboardFocus( this ) && mDefaultBtn->getEnabled()) | 230 | if (gFocusMgr.childHasKeyboardFocus( this ) && mDefaultBtn->getEnabled()) |
@@ -228,8 +239,6 @@ void LLPanel::draw() | |||
228 | mDefaultBtn->setBorderEnabled(FALSE); | 239 | mDefaultBtn->setBorderEnabled(FALSE); |
229 | } | 240 | } |
230 | } | 241 | } |
231 | |||
232 | LLView::draw(); | ||
233 | } | 242 | } |
234 | 243 | ||
235 | void LLPanel::refresh() | 244 | void LLPanel::refresh() |
diff --git a/linden/indra/llui/llpanel.h b/linden/indra/llui/llpanel.h index bcbda2c..aeba6d9 100644 --- a/linden/indra/llui/llpanel.h +++ b/linden/indra/llui/llpanel.h | |||
@@ -119,6 +119,7 @@ public: | |||
119 | void setBackgroundOpaque(BOOL b) { mBgOpaque = b; } | 119 | void setBackgroundOpaque(BOOL b) { mBgOpaque = b; } |
120 | void setDefaultBtn(LLButton* btn = NULL); | 120 | void setDefaultBtn(LLButton* btn = NULL); |
121 | void setDefaultBtn(const LLString& id); | 121 | void setDefaultBtn(const LLString& id); |
122 | void updateDefaultBtn(); | ||
122 | void setLabel(const LLStringExplicit& label) { mLabel = label; } | 123 | void setLabel(const LLStringExplicit& label) { mLabel = label; } |
123 | LLString getLabel() const { return mLabel; } | 124 | LLString getLabel() const { return mLabel; } |
124 | 125 | ||
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp index 36a7b00..043caa9 100644 --- a/linden/indra/llui/llscrolllistctrl.cpp +++ b/linden/indra/llui/llscrolllistctrl.cpp | |||
@@ -220,22 +220,14 @@ LLScrollListText::LLScrollListText( const LLString& text, const LLFontGL* font, | |||
220 | : LLScrollListCell(width), | 220 | : LLScrollListCell(width), |
221 | mText( text ), | 221 | mText( text ), |
222 | mFont( font ), | 222 | mFont( font ), |
223 | mColor(color), | ||
224 | mUseColor(use_color), | ||
223 | mFontStyle( font_style ), | 225 | mFontStyle( font_style ), |
224 | mFontAlignment( font_alignment ), | 226 | mFontAlignment( font_alignment ), |
225 | mVisible( visible ), | 227 | mVisible( visible ), |
226 | mHighlightCount( 0 ), | 228 | mHighlightCount( 0 ), |
227 | mHighlightOffset( 0 ) | 229 | mHighlightOffset( 0 ) |
228 | { | 230 | { |
229 | if (use_color) | ||
230 | { | ||
231 | mColor = new LLColor4(); | ||
232 | mColor->setVec(color); | ||
233 | } | ||
234 | else | ||
235 | { | ||
236 | mColor = NULL; | ||
237 | } | ||
238 | |||
239 | sCount++; | 231 | sCount++; |
240 | 232 | ||
241 | // initialize rounded rect image | 233 | // initialize rounded rect image |
@@ -248,7 +240,6 @@ LLScrollListText::LLScrollListText( const LLString& text, const LLFontGL* font, | |||
248 | LLScrollListText::~LLScrollListText() | 240 | LLScrollListText::~LLScrollListText() |
249 | { | 241 | { |
250 | sCount--; | 242 | sCount--; |
251 | delete mColor; | ||
252 | } | 243 | } |
253 | 244 | ||
254 | S32 LLScrollListText::getContentWidth() const | 245 | S32 LLScrollListText::getContentWidth() const |
@@ -259,11 +250,8 @@ S32 LLScrollListText::getContentWidth() const | |||
259 | 250 | ||
260 | void LLScrollListText::setColor(const LLColor4& color) | 251 | void LLScrollListText::setColor(const LLColor4& color) |
261 | { | 252 | { |
262 | if (!mColor) | 253 | mColor = color; |
263 | { | 254 | mUseColor = TRUE; |
264 | mColor = new LLColor4(); | ||
265 | } | ||
266 | *mColor = color; | ||
267 | } | 255 | } |
268 | 256 | ||
269 | void LLScrollListText::setText(const LLStringExplicit& text) | 257 | void LLScrollListText::setText(const LLStringExplicit& text) |
@@ -273,14 +261,14 @@ void LLScrollListText::setText(const LLStringExplicit& text) | |||
273 | 261 | ||
274 | void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_color) const | 262 | void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_color) const |
275 | { | 263 | { |
276 | const LLColor4* display_color; | 264 | LLColor4 display_color; |
277 | if (mColor) | 265 | if (mUseColor) |
278 | { | 266 | { |
279 | display_color = mColor; | 267 | display_color = mColor; |
280 | } | 268 | } |
281 | else | 269 | else |
282 | { | 270 | { |
283 | display_color = &color; | 271 | display_color = color; |
284 | } | 272 | } |
285 | 273 | ||
286 | if (mHighlightCount > 0) | 274 | if (mHighlightCount > 0) |
@@ -327,7 +315,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col | |||
327 | } | 315 | } |
328 | mFont->render(mText.getWString(), 0, | 316 | mFont->render(mText.getWString(), 0, |
329 | start_x, 2.f, | 317 | start_x, 2.f, |
330 | *display_color, | 318 | display_color, |
331 | mFontAlignment, | 319 | mFontAlignment, |
332 | LLFontGL::BOTTOM, | 320 | LLFontGL::BOTTOM, |
333 | mFontStyle, | 321 | mFontStyle, |
@@ -1070,7 +1058,7 @@ BOOL LLScrollListCtrl::selectItemRange( S32 first_index, S32 last_index ) | |||
1070 | { | 1058 | { |
1071 | if( itemp->getEnabled() ) | 1059 | if( itemp->getEnabled() ) |
1072 | { | 1060 | { |
1073 | selectItem(itemp); | 1061 | selectItem(itemp, FALSE); |
1074 | success = TRUE; | 1062 | success = TRUE; |
1075 | if (!success) | 1063 | if (!success) |
1076 | mOriginalSelection = first_index; | 1064 | mOriginalSelection = first_index; |
diff --git a/linden/indra/llui/llscrolllistctrl.h b/linden/indra/llui/llscrolllistctrl.h index 71ba63d..e9486cb 100644 --- a/linden/indra/llui/llscrolllistctrl.h +++ b/linden/indra/llui/llscrolllistctrl.h | |||
@@ -111,7 +111,8 @@ public: | |||
111 | private: | 111 | private: |
112 | LLUIString mText; | 112 | LLUIString mText; |
113 | const LLFontGL* mFont; | 113 | const LLFontGL* mFont; |
114 | LLColor4* mColor; | 114 | LLColor4 mColor; |
115 | U8 mUseColor; | ||
115 | U8 mFontStyle; | 116 | U8 mFontStyle; |
116 | LLFontGL::HAlign mFontAlignment; | 117 | LLFontGL::HAlign mFontAlignment; |
117 | BOOL mVisible; | 118 | BOOL mVisible; |
diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp index ca9ea0a..9061ca3 100644 --- a/linden/indra/llui/lltexteditor.cpp +++ b/linden/indra/llui/lltexteditor.cpp | |||
@@ -4439,6 +4439,12 @@ void LLTextEditor::resetPreedit() | |||
4439 | { | 4439 | { |
4440 | if (hasPreeditString()) | 4440 | if (hasPreeditString()) |
4441 | { | 4441 | { |
4442 | if (hasSelection()) | ||
4443 | { | ||
4444 | llwarns << "Preedit and selection!" << llendl; | ||
4445 | deselect(); | ||
4446 | } | ||
4447 | |||
4442 | mCursorPos = mPreeditPositions.front(); | 4448 | mCursorPos = mPreeditPositions.front(); |
4443 | removeStringNoUndo(mCursorPos, mPreeditPositions.back() - mCursorPos); | 4449 | removeStringNoUndo(mCursorPos, mPreeditPositions.back() - mCursorPos); |
4444 | insertStringNoUndo(mCursorPos, mPreeditOverwrittenWString); | 4450 | insertStringNoUndo(mCursorPos, mPreeditOverwrittenWString); |
@@ -4447,9 +4453,10 @@ void LLTextEditor::resetPreedit() | |||
4447 | mPreeditOverwrittenWString.clear(); | 4453 | mPreeditOverwrittenWString.clear(); |
4448 | mPreeditPositions.clear(); | 4454 | mPreeditPositions.clear(); |
4449 | 4455 | ||
4450 | updateLineStartList(); | 4456 | // A call to updatePreedit should soon follow under a |
4451 | setCursorPos(mCursorPos); | 4457 | // normal course of operation, so we don't need to |
4452 | // updateScrollFromCursor(); | 4458 | // maintain internal variables such as line start |
4459 | // positions now. | ||
4453 | } | 4460 | } |
4454 | } | 4461 | } |
4455 | 4462 | ||
@@ -4462,28 +4469,9 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string, | |||
4462 | return; | 4469 | return; |
4463 | } | 4470 | } |
4464 | 4471 | ||
4465 | if (hasSelection()) | ||
4466 | { | ||
4467 | if (hasPreeditString()) | ||
4468 | { | ||
4469 | llwarns << "Preedit and selection!" << llendl; | ||
4470 | deselect(); | ||
4471 | } | ||
4472 | else | ||
4473 | { | ||
4474 | deleteSelection(TRUE); | ||
4475 | } | ||
4476 | } | ||
4477 | |||
4478 | getWindow()->hideCursorUntilMouseMove(); | 4472 | getWindow()->hideCursorUntilMouseMove(); |
4479 | 4473 | ||
4480 | S32 insert_preedit_at = mCursorPos; | 4474 | S32 insert_preedit_at = mCursorPos; |
4481 | if (hasPreeditString()) | ||
4482 | { | ||
4483 | insert_preedit_at = mPreeditPositions.front(); | ||
4484 | removeStringNoUndo(insert_preedit_at, mPreeditPositions.back() - insert_preedit_at); | ||
4485 | insertStringNoUndo(insert_preedit_at, mPreeditOverwrittenWString); | ||
4486 | } | ||
4487 | 4475 | ||
4488 | mPreeditWString = preedit_string; | 4476 | mPreeditWString = preedit_string; |
4489 | mPreeditPositions.resize(preedit_segment_lengths.size() + 1); | 4477 | mPreeditPositions.resize(preedit_segment_lengths.size() + 1); |