aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llnotify.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llnotify.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llnotify.cpp60
1 files changed, 40 insertions, 20 deletions
diff --git a/linden/indra/newview/llnotify.cpp b/linden/indra/newview/llnotify.cpp
index f486ca5..0bd039a 100644
--- a/linden/indra/newview/llnotify.cpp
+++ b/linden/indra/newview/llnotify.cpp
@@ -35,6 +35,7 @@
35 35
36#include "llchat.h" 36#include "llchat.h"
37#include "llfocusmgr.h" 37#include "llfocusmgr.h"
38#include "llglimmediate.h"
38 39
39#include "llbutton.h" 40#include "llbutton.h"
40#include "llfocusmgr.h" 41#include "llfocusmgr.h"
@@ -212,7 +213,7 @@ LLNotifyBox::LLNotifyBox(LLPointer<LLNotifyBoxTemplate> xml_template, const LLSt
212 // initialize 213 // initialize
213 214
214 mIsTip = xml_template->mIsTip; 215 mIsTip = xml_template->mIsTip;
215 mIsFocusRoot = !mIsTip; 216 setFocusRoot(!mIsTip);
216 217
217 // caution flag can be set explicitly by specifying it in the 218 // caution flag can be set explicitly by specifying it in the
218 // call to the c'tor, or it can be set implicitly if the 219 // call to the c'tor, or it can be set implicitly if the
@@ -241,7 +242,7 @@ LLNotifyBox::LLNotifyBox(LLPointer<LLNotifyBoxTemplate> xml_template, const LLSt
241 LLIconCtrl* icon; 242 LLIconCtrl* icon;
242 LLTextEditor* text; 243 LLTextEditor* text;
243 244
244 const S32 TOP = mRect.getHeight() - (mIsTip ? (S32)sFont->getLineHeight() : 32); 245 const S32 TOP = getRect().getHeight() - (mIsTip ? (S32)sFont->getLineHeight() : 32);
245 const S32 BOTTOM = (S32)sFont->getLineHeight(); 246 const S32 BOTTOM = (S32)sFont->getLineHeight();
246 S32 x = HPAD + HPAD; 247 S32 x = HPAD + HPAD;
247 S32 y = TOP; 248 S32 y = TOP;
@@ -274,7 +275,7 @@ LLNotifyBox::LLNotifyBox(LLPointer<LLNotifyBoxTemplate> xml_template, const LLSt
274 S32 caution_height = ((S32)sFont->getLineHeight() * 2) + VPAD; 275 S32 caution_height = ((S32)sFont->getLineHeight() * 2) + VPAD;
275 caution_box = new LLTextBox( 276 caution_box = new LLTextBox(
276 "caution_box", 277 "caution_box",
277 LLRect(x, y, mRect.getWidth() - 2, caution_height), 278 LLRect(x, y, getRect().getWidth() - 2, caution_height),
278 "", 279 "",
279 sFont, 280 sFont,
280 FALSE); 281 FALSE);
@@ -303,7 +304,7 @@ LLNotifyBox::LLNotifyBox(LLPointer<LLNotifyBoxTemplate> xml_template, const LLSt
303 DB_INV_ITEM_NAME_BUF_SIZE; // For script dialogs: add space for title. 304 DB_INV_ITEM_NAME_BUF_SIZE; // For script dialogs: add space for title.
304 305
305 text = new LLTextEditor("box", 306 text = new LLTextEditor("box",
306 LLRect(x, y, mRect.getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16), 307 LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16),
307 MAX_LENGTH, 308 MAX_LENGTH,
308 mMessage, 309 mMessage,
309 sFont, 310 sFont,
@@ -333,7 +334,7 @@ LLNotifyBox::LLNotifyBox(LLPointer<LLNotifyBoxTemplate> xml_template, const LLSt
333 { 334 {
334 LLButton* btn; 335 LLButton* btn;
335 btn = new LLButton("next", 336 btn = new LLButton("next",
336 LLRect(mRect.getWidth()-18, BOTTOM_PAD+16, mRect.getWidth()-2, BOTTOM_PAD+2), 337 LLRect(getRect().getWidth()-18, BOTTOM_PAD+16, getRect().getWidth()-2, BOTTOM_PAD+2),
337 "notify_next.tga", 338 "notify_next.tga",
338 "notify_next.tga", 339 "notify_next.tga",
339 "", 340 "",
@@ -418,7 +419,7 @@ LLNotifyBox::~LLNotifyBox()
418 419
419 if (mUnique) 420 if (mUnique)
420 { 421 {
421 sOpenUniqueNotifyBoxes.erase(mName + mMessage); 422 sOpenUniqueNotifyBoxes.erase(getName() + mMessage);
422 } 423 }
423} 424}
424 425
@@ -474,7 +475,7 @@ void LLNotifyBox::draw()
474 glMatrixMode(GL_MODELVIEW); 475 glMatrixMode(GL_MODELVIEW);
475 LLUI::pushMatrix(); 476 LLUI::pushMatrix();
476 477
477 S32 height = mRect.getHeight(); 478 S32 height = getRect().getHeight();
478 F32 fraction = display_time / ANIMATION_TIME; 479 F32 fraction = display_time / ANIMATION_TIME;
479 F32 voffset = (1.f - fraction) * height; 480 F32 voffset = (1.f - fraction) * height;
480 if (mIsTip) voffset *= -1.f; 481 if (mIsTip) voffset *= -1.f;
@@ -509,7 +510,6 @@ void LLNotifyBox::drawBackground() const
509 LLViewerImage* imagep = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); 510 LLViewerImage* imagep = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
510 if (imagep) 511 if (imagep)
511 { 512 {
512 LLGLSTexture texture_enabled;
513 LLViewerImage::bindTexture(imagep); 513 LLViewerImage::bindTexture(imagep);
514 // set proper background color depending on whether notify box is a caution or not 514 // set proper background color depending on whether notify box is a caution or not
515 LLColor4 color = mIsCaution? gColors.getColor("NotifyCautionBoxColor") : gColors.getColor("NotifyBoxColor"); 515 LLColor4 color = mIsCaution? gColors.getColor("NotifyCautionBoxColor") : gColors.getColor("NotifyBoxColor");
@@ -517,27 +517,27 @@ void LLNotifyBox::drawBackground() const
517 { 517 {
518 const S32 focus_width = 2; 518 const S32 focus_width = 2;
519 color = gColors.getColor("FloaterFocusBorderColor"); 519 color = gColors.getColor("FloaterFocusBorderColor");
520 glColor4fv(color.mV); 520 gGL.color4fv(color.mV);
521 gl_segmented_rect_2d_tex(-focus_width, mRect.getHeight() + focus_width, 521 gl_segmented_rect_2d_tex(-focus_width, getRect().getHeight() + focus_width,
522 mRect.getWidth() + focus_width, -focus_width, 522 getRect().getWidth() + focus_width, -focus_width,
523 imagep->getWidth(), imagep->getHeight(), 523 imagep->getWidth(), imagep->getHeight(),
524 16, mIsTip ? ROUNDED_RECT_TOP : ROUNDED_RECT_BOTTOM); 524 16, mIsTip ? ROUNDED_RECT_TOP : ROUNDED_RECT_BOTTOM);
525 color = gColors.getColor("ColorDropShadow"); 525 color = gColors.getColor("ColorDropShadow");
526 glColor4fv(color.mV); 526 gGL.color4fv(color.mV);
527 gl_segmented_rect_2d_tex(0, mRect.getHeight(), mRect.getWidth(), 0, imagep->getWidth(), imagep->getHeight(), 16, mIsTip ? ROUNDED_RECT_TOP : ROUNDED_RECT_BOTTOM); 527 gl_segmented_rect_2d_tex(0, getRect().getHeight(), getRect().getWidth(), 0, imagep->getWidth(), imagep->getHeight(), 16, mIsTip ? ROUNDED_RECT_TOP : ROUNDED_RECT_BOTTOM);
528 528
529 if( mIsCaution ) 529 if( mIsCaution )
530 color = gColors.getColor("NotifyCautionBoxColor"); 530 color = gColors.getColor("NotifyCautionBoxColor");
531 else 531 else
532 color = gColors.getColor("NotifyBoxColor"); 532 color = gColors.getColor("NotifyBoxColor");
533 533
534 glColor4fv(color.mV); 534 gGL.color4fv(color.mV);
535 gl_segmented_rect_2d_tex(1, mRect.getHeight()-1, mRect.getWidth()-1, 1, imagep->getWidth(), imagep->getHeight(), 16, mIsTip ? ROUNDED_RECT_TOP : ROUNDED_RECT_BOTTOM); 535 gl_segmented_rect_2d_tex(1, getRect().getHeight()-1, getRect().getWidth()-1, 1, imagep->getWidth(), imagep->getHeight(), 16, mIsTip ? ROUNDED_RECT_TOP : ROUNDED_RECT_BOTTOM);
536 } 536 }
537 else 537 else
538 { 538 {
539 glColor4fv(color.mV); 539 gGL.color4fv(color.mV);
540 gl_segmented_rect_2d_tex(0, mRect.getHeight(), mRect.getWidth(), 0, imagep->getWidth(), imagep->getHeight(), 16, mIsTip ? ROUNDED_RECT_TOP : ROUNDED_RECT_BOTTOM); 540 gl_segmented_rect_2d_tex(0, getRect().getHeight(), getRect().getWidth(), 0, imagep->getWidth(), imagep->getHeight(), 16, mIsTip ? ROUNDED_RECT_TOP : ROUNDED_RECT_BOTTOM);
541 } 541 }
542 } 542 }
543} 543}
@@ -561,9 +561,9 @@ void LLNotifyBox::close()
561 gNotifyBoxView->showOnly(front); 561 gNotifyBoxView->showOnly(front);
562 // we're assuming that close is only called by user action (for non-tips), 562 // we're assuming that close is only called by user action (for non-tips),
563 // so we then give focus to the next close button 563 // so we then give focus to the next close button
564 if (front->mDefaultBtn) 564 if (front->getDefaultButton())
565 { 565 {
566 front->mDefaultBtn->setFocus(TRUE); 566 front->getDefaultButton()->setFocus(TRUE);
567 } 567 }
568 gFocusMgr.triggerFocusFlash(); // TODO it's ugly to call this here 568 gFocusMgr.triggerFocusFlash(); // TODO it's ugly to call this here
569 } 569 }
@@ -619,7 +619,10 @@ void LLNotifyBox::moveToBack(bool getfocus)
619 { 619 {
620 // if are called from a user interaction 620 // if are called from a user interaction
621 // we give focus to the next next button 621 // we give focus to the next next button
622 front->mNextBtn->setFocus(TRUE); 622 if (front->mNextBtn != NULL)
623 {
624 front->mNextBtn->setFocus(TRUE);
625 }
623 gFocusMgr.triggerFocusFlash(); // TODO: it's ugly to call this here 626 gFocusMgr.triggerFocusFlash(); // TODO: it's ugly to call this here
624 } 627 }
625 } 628 }
@@ -1002,3 +1005,20 @@ void LLNotifyBoxView::showOnly(LLView * view)
1002 sendChildToFront(shown); 1005 sendChildToFront(shown);
1003 } 1006 }
1004} 1007}
1008
1009void LLNotifyBoxView::purgeMessagesMatching(const Matcher& matcher)
1010{
1011 // Make a *copy* of the child list to iterate over
1012 // since we'll be removing items from the real list as we go.
1013 LLView::child_list_t notification_queue(*getChildList());
1014 for(LLView::child_list_iter_t iter = notification_queue.begin();
1015 iter != notification_queue.end();
1016 iter++)
1017 {
1018 LLNotifyBox* notification = (LLNotifyBox*)*iter;
1019 if(matcher.matches(notification->getNotifyCallback(), notification->getUserData()))
1020 {
1021 removeChild(notification);
1022 }
1023 }
1024}