aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llalertdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llui/llalertdialog.cpp')
-rw-r--r--linden/indra/llui/llalertdialog.cpp58
1 files changed, 30 insertions, 28 deletions
diff --git a/linden/indra/llui/llalertdialog.cpp b/linden/indra/llui/llalertdialog.cpp
index e60ef42..4ca9dc8 100644
--- a/linden/indra/llui/llalertdialog.cpp
+++ b/linden/indra/llui/llalertdialog.cpp
@@ -186,7 +186,7 @@ bool LLAlertDialog::show()
186 { 186 {
187 mOptionChosen = mDefaultOption; 187 mOptionChosen = mDefaultOption;
188 llinfos << "Alert: " << mLabel << llendl; 188 llinfos << "Alert: " << mLabel << llendl;
189 delete this; 189 close();
190 return false; 190 return false;
191 } 191 }
192 } 192 }
@@ -208,7 +208,7 @@ bool LLAlertDialog::show()
208 case IGNORE_SHOW_AGAIN: 208 case IGNORE_SHOW_AGAIN:
209 break; 209 break;
210 } 210 }
211 delete this; 211 close();
212 return false; 212 return false;
213 } 213 }
214 } 214 }
@@ -231,7 +231,7 @@ bool LLAlertDialog::show()
231 { 231 {
232 gFloaterView->bringToFront(iter->second); 232 gFloaterView->bringToFront(iter->second);
233 mUnique = FALSE; // don't remove entry from map on destruction 233 mUnique = FALSE; // don't remove entry from map on destruction
234 delete this; 234 close();
235 return false; 235 return false;
236 } 236 }
237 sUniqueActiveMap[mLabel] = this; 237 sUniqueActiveMap[mLabel] = this;
@@ -270,7 +270,7 @@ void LLAlertDialog::createDialog(const std::vector<LLString>* optionsp, S32 defa
270 setBackgroundVisible(TRUE); 270 setBackgroundVisible(TRUE);
271 setBackgroundOpaque(TRUE); 271 setBackgroundOpaque(TRUE);
272 272
273 const LLFontGL* font = gResMgr->getRes( font_name ); 273 const LLFontGL* font = LLResMgr::getInstance()->getRes( font_name );
274 const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f); 274 const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f);
275 const S32 EDITOR_HEIGHT = 20; 275 const S32 EDITOR_HEIGHT = 20;
276 276
@@ -399,7 +399,7 @@ void LLAlertDialog::createDialog(const std::vector<LLString>* optionsp, S32 defa
399 399
400bool LLAlertDialog::setCheckBox( const LLString& check_title, const LLString& check_control ) 400bool LLAlertDialog::setCheckBox( const LLString& check_title, const LLString& check_control )
401{ 401{
402 const LLFontGL* font = gResMgr->getRes( font_name ); 402 const LLFontGL* font = LLResMgr::getInstance()->getRes( font_name );
403 const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f); 403 const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f);
404 404
405 // Extend dialog for "check next time" 405 // Extend dialog for "check next time"
@@ -444,8 +444,23 @@ void LLAlertDialog::setVisible( BOOL visible )
444 } 444 }
445} 445}
446 446
447void LLAlertDialog::onClose(bool app_quitting)
448{
449 LLModalDialog::onClose(app_quitting);
450 handleCallbacks();
451}
452
447LLAlertDialog::~LLAlertDialog() 453LLAlertDialog::~LLAlertDialog()
448{ 454{
455 delete[] mButtonData;
456 if (mUnique)
457 {
458 sUniqueActiveMap.erase(mLabel);
459 }
460}
461
462void LLAlertDialog::handleCallbacks()
463{
449 if (mOptionChosen >= 0) 464 if (mOptionChosen >= 0)
450 { 465 {
451 if (mTextCallback && mLineEditor) 466 if (mTextCallback && mLineEditor)
@@ -465,7 +480,7 @@ LLAlertDialog::~LLAlertDialog()
465 sURLLoader->load(mURL); 480 sURLLoader->load(mURL);
466 } 481 }
467 } 482 }
468 483
469 // Only change warn state if we actually warned. 484 // Only change warn state if we actually warned.
470 if (mCheck 485 if (mCheck
471 && sSettings->getWarning(mIgnoreLabel)) 486 && sSettings->getWarning(mIgnoreLabel))
@@ -490,13 +505,7 @@ LLAlertDialog::~LLAlertDialog()
490 } 505 }
491 } 506 }
492 } 507 }
493 delete[] mButtonData;
494 if (mUnique)
495 {
496 sUniqueActiveMap.erase(mLabel);
497 }
498} 508}
499
500BOOL LLAlertDialog::hasTitleBar() const 509BOOL LLAlertDialog::hasTitleBar() const
501{ 510{
502 return (getTitle() != "" && getTitle() != " ") // has title 511 return (getTitle() != "" && getTitle() != " ") // has title
@@ -504,16 +513,11 @@ BOOL LLAlertDialog::hasTitleBar() const
504 || isCloseable(); 513 || isCloseable();
505} 514}
506 515
507BOOL LLAlertDialog::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent ) 516BOOL LLAlertDialog::handleKeyHere(KEY key, MASK mask )
508{ 517{
509 if( KEY_RETURN == key && mask == MASK_NONE ) 518 if( KEY_RETURN == key && mask == MASK_NONE )
510 { 519 {
511 // Warning: handleKeyHere may result in the default button 520 LLModalDialog::handleKeyHere( key, mask );
512 // being committed, which will destroy this object.
513 // Everything works, but the call stack will pass through
514 // the very end of functions that belong to deleted objects.
515 // Should find a less fragile way to do this.
516 LLModalDialog::handleKeyHere( key, mask , called_from_parent );
517 return TRUE; 521 return TRUE;
518 } 522 }
519 else if (KEY_RIGHT == key) 523 else if (KEY_RIGHT == key)
@@ -538,7 +542,7 @@ BOOL LLAlertDialog::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent )
538 } 542 }
539 else 543 else
540 { 544 {
541 return LLModalDialog::handleKeyHere( key, mask , called_from_parent ); 545 return LLModalDialog::handleKeyHere( key, mask );
542 } 546 }
543} 547}
544 548
@@ -551,16 +555,14 @@ void LLAlertDialog::draw()
551 mDefaultBtnTimer.stop(); // prevent this block from being run more than once 555 mDefaultBtnTimer.stop(); // prevent this block from being run more than once
552 setDefaultBtn(mButtonData[mDefaultOption].mButton); 556 setDefaultBtn(mButtonData[mDefaultOption].mButton);
553 } 557 }
554 if (getVisible())
555 {
556 LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow");
557 S32 shadow_lines = LLUI::sConfigGroup->getS32("DropShadowFloater");
558 558
559 gl_drop_shadow( 0, getRect().getHeight(), getRect().getWidth(), 0, 559 LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow");
560 shadow_color, shadow_lines); 560 S32 shadow_lines = LLUI::sConfigGroup->getS32("DropShadowFloater");
561 561
562 LLModalDialog::draw(); 562 gl_drop_shadow( 0, getRect().getHeight(), getRect().getWidth(), 0,
563 } 563 shadow_color, shadow_lines);
564
565 LLModalDialog::draw();
564} 566}
565 567
566void LLAlertDialog::setOptionEnabled( S32 option, BOOL enable ) 568void LLAlertDialog::setOptionEnabled( S32 option, BOOL enable )