diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llui/llmultisliderctrl.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/llui/llmultisliderctrl.cpp')
-rw-r--r-- | linden/indra/llui/llmultisliderctrl.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/linden/indra/llui/llmultisliderctrl.cpp b/linden/indra/llui/llmultisliderctrl.cpp index c242d18..673887b 100644 --- a/linden/indra/llui/llmultisliderctrl.cpp +++ b/linden/indra/llui/llmultisliderctrl.cpp | |||
@@ -55,8 +55,8 @@ static LLRegisterWidget<LLMultiSliderCtrl> r("multi_slider"); | |||
55 | const U32 MAX_STRING_LENGTH = 10; | 55 | const U32 MAX_STRING_LENGTH = 10; |
56 | 56 | ||
57 | 57 | ||
58 | LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect, | 58 | LLMultiSliderCtrl::LLMultiSliderCtrl(const std::string& name, const LLRect& rect, |
59 | const LLString& label, | 59 | const std::string& label, |
60 | const LLFontGL* font, | 60 | const LLFontGL* font, |
61 | S32 label_width, | 61 | S32 label_width, |
62 | S32 text_left, | 62 | S32 text_left, |
@@ -68,7 +68,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect, | |||
68 | S32 max_sliders, BOOL allow_overlap, | 68 | S32 max_sliders, BOOL allow_overlap, |
69 | BOOL draw_track, | 69 | BOOL draw_track, |
70 | BOOL use_triangle, | 70 | BOOL use_triangle, |
71 | const LLString& control_which) | 71 | const std::string& control_which) |
72 | : LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data ), | 72 | : LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data ), |
73 | mFont(font), | 73 | mFont(font), |
74 | mShowText( show_text ), | 74 | mShowText( show_text ), |
@@ -96,7 +96,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect, | |||
96 | label_width = font->getWidth(label); | 96 | label_width = font->getWidth(label); |
97 | } | 97 | } |
98 | LLRect label_rect( left, top, label_width, bottom ); | 98 | LLRect label_rect( left, top, label_width, bottom ); |
99 | mLabelBox = new LLTextBox( "MultiSliderCtrl Label", label_rect, label.c_str(), font ); | 99 | mLabelBox = new LLTextBox( std::string("MultiSliderCtrl Label"), label_rect, label, font ); |
100 | addChild(mLabelBox); | 100 | addChild(mLabelBox); |
101 | } | 101 | } |
102 | 102 | ||
@@ -109,7 +109,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect, | |||
109 | S32 slider_left = label_width ? label_width + MULTI_SLIDERCTRL_SPACING : 0; | 109 | S32 slider_left = label_width ? label_width + MULTI_SLIDERCTRL_SPACING : 0; |
110 | LLRect slider_rect( slider_left, top, slider_right, bottom ); | 110 | LLRect slider_rect( slider_left, top, slider_right, bottom ); |
111 | mMultiSlider = new LLMultiSlider( | 111 | mMultiSlider = new LLMultiSlider( |
112 | "multi_slider", | 112 | std::string("multi_slider"), |
113 | slider_rect, | 113 | slider_rect, |
114 | LLMultiSliderCtrl::onSliderCommit, this, | 114 | LLMultiSliderCtrl::onSliderCommit, this, |
115 | initial_value, min_value, max_value, increment, | 115 | initial_value, min_value, max_value, increment, |
@@ -124,8 +124,8 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect, | |||
124 | LLRect text_rect( text_left, top, getRect().getWidth(), bottom ); | 124 | LLRect text_rect( text_left, top, getRect().getWidth(), bottom ); |
125 | if( can_edit_text ) | 125 | if( can_edit_text ) |
126 | { | 126 | { |
127 | mEditor = new LLLineEditor( "MultiSliderCtrl Editor", text_rect, | 127 | mEditor = new LLLineEditor( std::string("MultiSliderCtrl Editor"), text_rect, |
128 | "", font, | 128 | LLStringUtil::null, font, |
129 | MAX_STRING_LENGTH, | 129 | MAX_STRING_LENGTH, |
130 | &LLMultiSliderCtrl::onEditorCommit, NULL, NULL, this, | 130 | &LLMultiSliderCtrl::onEditorCommit, NULL, NULL, this, |
131 | &LLLineEditor::prevalidateFloat ); | 131 | &LLLineEditor::prevalidateFloat ); |
@@ -140,7 +140,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect, | |||
140 | } | 140 | } |
141 | else | 141 | else |
142 | { | 142 | { |
143 | mTextBox = new LLTextBox( "MultiSliderCtrl Text", text_rect, "", font); | 143 | mTextBox = new LLTextBox( std::string("MultiSliderCtrl Text"), text_rect, LLStringUtil::null, font); |
144 | mTextBox->setFollowsLeft(); | 144 | mTextBox->setFollowsLeft(); |
145 | mTextBox->setFollowsBottom(); | 145 | mTextBox->setFollowsBottom(); |
146 | addChild(mTextBox); | 146 | addChild(mTextBox); |
@@ -172,20 +172,20 @@ void LLMultiSliderCtrl::setValue(const LLSD& value) | |||
172 | updateText(); | 172 | updateText(); |
173 | } | 173 | } |
174 | 174 | ||
175 | void LLMultiSliderCtrl::setSliderValue(const LLString& name, F32 v, BOOL from_event) | 175 | void LLMultiSliderCtrl::setSliderValue(const std::string& name, F32 v, BOOL from_event) |
176 | { | 176 | { |
177 | mMultiSlider->setSliderValue(name, v, from_event ); | 177 | mMultiSlider->setSliderValue(name, v, from_event ); |
178 | mCurValue = mMultiSlider->getCurSliderValue(); | 178 | mCurValue = mMultiSlider->getCurSliderValue(); |
179 | updateText(); | 179 | updateText(); |
180 | } | 180 | } |
181 | 181 | ||
182 | void LLMultiSliderCtrl::setCurSlider(const LLString& name) | 182 | void LLMultiSliderCtrl::setCurSlider(const std::string& name) |
183 | { | 183 | { |
184 | mMultiSlider->setCurSlider(name); | 184 | mMultiSlider->setCurSlider(name); |
185 | mCurValue = mMultiSlider->getCurSliderValue(); | 185 | mCurValue = mMultiSlider->getCurSliderValue(); |
186 | } | 186 | } |
187 | 187 | ||
188 | BOOL LLMultiSliderCtrl::setLabelArg( const LLString& key, const LLStringExplicit& text ) | 188 | BOOL LLMultiSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) |
189 | { | 189 | { |
190 | BOOL res = FALSE; | 190 | BOOL res = FALSE; |
191 | if (mLabelBox) | 191 | if (mLabelBox) |
@@ -210,13 +210,13 @@ BOOL LLMultiSliderCtrl::setLabelArg( const LLString& key, const LLStringExplicit | |||
210 | return res; | 210 | return res; |
211 | } | 211 | } |
212 | 212 | ||
213 | const LLString& LLMultiSliderCtrl::addSlider() | 213 | const std::string& LLMultiSliderCtrl::addSlider() |
214 | { | 214 | { |
215 | const LLString& name = mMultiSlider->addSlider(); | 215 | const std::string& name = mMultiSlider->addSlider(); |
216 | 216 | ||
217 | // if it returns null, pass it on | 217 | // if it returns null, pass it on |
218 | if(name == LLString::null) { | 218 | if(name == LLStringUtil::null) { |
219 | return LLString::null; | 219 | return LLStringUtil::null; |
220 | } | 220 | } |
221 | 221 | ||
222 | // otherwise, update stuff | 222 | // otherwise, update stuff |
@@ -225,13 +225,13 @@ const LLString& LLMultiSliderCtrl::addSlider() | |||
225 | return name; | 225 | return name; |
226 | } | 226 | } |
227 | 227 | ||
228 | const LLString& LLMultiSliderCtrl::addSlider(F32 val) | 228 | const std::string& LLMultiSliderCtrl::addSlider(F32 val) |
229 | { | 229 | { |
230 | const LLString& name = mMultiSlider->addSlider(val); | 230 | const std::string& name = mMultiSlider->addSlider(val); |
231 | 231 | ||
232 | // if it returns null, pass it on | 232 | // if it returns null, pass it on |
233 | if(name == LLString::null) { | 233 | if(name == LLStringUtil::null) { |
234 | return LLString::null; | 234 | return LLStringUtil::null; |
235 | } | 235 | } |
236 | 236 | ||
237 | // otherwise, update stuff | 237 | // otherwise, update stuff |
@@ -240,7 +240,7 @@ const LLString& LLMultiSliderCtrl::addSlider(F32 val) | |||
240 | return name; | 240 | return name; |
241 | } | 241 | } |
242 | 242 | ||
243 | void LLMultiSliderCtrl::deleteSlider(const LLString& name) | 243 | void LLMultiSliderCtrl::deleteSlider(const std::string& name) |
244 | { | 244 | { |
245 | mMultiSlider->deleteSlider(name); | 245 | mMultiSlider->deleteSlider(name); |
246 | mCurValue = mMultiSlider->getCurSliderValue(); | 246 | mCurValue = mMultiSlider->getCurSliderValue(); |
@@ -253,11 +253,11 @@ void LLMultiSliderCtrl::clear() | |||
253 | setCurSliderValue(0.0f); | 253 | setCurSliderValue(0.0f); |
254 | if( mEditor ) | 254 | if( mEditor ) |
255 | { | 255 | { |
256 | mEditor->setText(LLString("")); | 256 | mEditor->setText(std::string("")); |
257 | } | 257 | } |
258 | if( mTextBox ) | 258 | if( mTextBox ) |
259 | { | 259 | { |
260 | mTextBox->setText(LLString("")); | 260 | mTextBox->setText(std::string("")); |
261 | } | 261 | } |
262 | 262 | ||
263 | // get rid of sliders | 263 | // get rid of sliders |
@@ -279,8 +279,8 @@ void LLMultiSliderCtrl::updateText() | |||
279 | // Don't display very small negative values as -0.000 | 279 | // Don't display very small negative values as -0.000 |
280 | F32 displayed_value = (F32)(floor(getCurSliderValue() * pow(10.0, (F64)mPrecision) + 0.5) / pow(10.0, (F64)mPrecision)); | 280 | F32 displayed_value = (F32)(floor(getCurSliderValue() * pow(10.0, (F64)mPrecision) + 0.5) / pow(10.0, (F64)mPrecision)); |
281 | 281 | ||
282 | LLString format = llformat("%%.%df", mPrecision); | 282 | std::string format = llformat("%%.%df", mPrecision); |
283 | LLString text = llformat(format.c_str(), displayed_value); | 283 | std::string text = llformat(format.c_str(), displayed_value); |
284 | if( mEditor ) | 284 | if( mEditor ) |
285 | { | 285 | { |
286 | mEditor->setText( text ); | 286 | mEditor->setText( text ); |
@@ -302,7 +302,7 @@ void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) | |||
302 | F32 val = self->mCurValue; | 302 | F32 val = self->mCurValue; |
303 | F32 saved_val = self->mCurValue; | 303 | F32 saved_val = self->mCurValue; |
304 | 304 | ||
305 | LLString text = self->mEditor->getText(); | 305 | std::string text = self->mEditor->getText(); |
306 | if( LLLineEditor::postvalidateFloat( text ) ) | 306 | if( LLLineEditor::postvalidateFloat( text ) ) |
307 | { | 307 | { |
308 | LLLocale locale(LLLocale::USER_LOCALE); | 308 | LLLocale locale(LLLocale::USER_LOCALE); |
@@ -484,13 +484,13 @@ void LLMultiSliderCtrl::reportInvalidData() | |||
484 | } | 484 | } |
485 | 485 | ||
486 | //virtual | 486 | //virtual |
487 | LLString LLMultiSliderCtrl::getControlName() const | 487 | std::string LLMultiSliderCtrl::getControlName() const |
488 | { | 488 | { |
489 | return mMultiSlider->getControlName(); | 489 | return mMultiSlider->getControlName(); |
490 | } | 490 | } |
491 | 491 | ||
492 | // virtual | 492 | // virtual |
493 | void LLMultiSliderCtrl::setControlName(const LLString& control_name, LLView* context) | 493 | void LLMultiSliderCtrl::setControlName(const std::string& control_name, LLView* context) |
494 | { | 494 | { |
495 | mMultiSlider->setControlName(control_name, context); | 495 | mMultiSlider->setControlName(control_name, context); |
496 | } | 496 | } |
@@ -529,10 +529,10 @@ LLXMLNodePtr LLMultiSliderCtrl::getXML(bool save_children) const | |||
529 | 529 | ||
530 | LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) | 530 | LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) |
531 | { | 531 | { |
532 | LLString name("multi_slider"); | 532 | std::string name("multi_slider"); |
533 | node->getAttributeString("name", name); | 533 | node->getAttributeString("name", name); |
534 | 534 | ||
535 | LLString label; | 535 | std::string label; |
536 | node->getAttributeString("label", label); | 536 | node->getAttributeString("label", label); |
537 | 537 | ||
538 | LLRect rect; | 538 | LLRect rect; |
@@ -588,13 +588,13 @@ LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa | |||
588 | { | 588 | { |
589 | // calculate the size of the text box (log max_value is number of digits - 1 so plus 1) | 589 | // calculate the size of the text box (log max_value is number of digits - 1 so plus 1) |
590 | if ( max_value ) | 590 | if ( max_value ) |
591 | text_left = font->getWidth("0") * ( static_cast < S32 > ( log10 ( max_value ) ) + precision + 1 ); | 591 | text_left = font->getWidth(std::string("0")) * ( static_cast < S32 > ( log10 ( max_value ) ) + precision + 1 ); |
592 | 592 | ||
593 | if ( increment < 1.0f ) | 593 | if ( increment < 1.0f ) |
594 | text_left += font->getWidth("."); // (mostly) take account of decimal point in value | 594 | text_left += font->getWidth(std::string(".")); // (mostly) take account of decimal point in value |
595 | 595 | ||
596 | if ( min_value < 0.0f || max_value < 0.0f ) | 596 | if ( min_value < 0.0f || max_value < 0.0f ) |
597 | text_left += font->getWidth("-"); // (mostly) take account of minus sign | 597 | text_left += font->getWidth(std::string("-")); // (mostly) take account of minus sign |
598 | 598 | ||
599 | // padding to make things look nicer | 599 | // padding to make things look nicer |
600 | text_left += 8; | 600 | text_left += 8; |