diff options
Diffstat (limited to 'linden/indra/newview/llstatusbar.cpp')
-rw-r--r-- | linden/indra/newview/llstatusbar.cpp | 110 |
1 files changed, 61 insertions, 49 deletions
diff --git a/linden/indra/newview/llstatusbar.cpp b/linden/indra/newview/llstatusbar.cpp index f0c6ea5..9d6434f 100644 --- a/linden/indra/newview/llstatusbar.cpp +++ b/linden/indra/newview/llstatusbar.cpp | |||
@@ -70,11 +70,14 @@ | |||
70 | #include "llviewerparcelmgr.h" | 70 | #include "llviewerparcelmgr.h" |
71 | #include "llviewerthrottle.h" | 71 | #include "llviewerthrottle.h" |
72 | #include "llvieweruictrlfactory.h" | 72 | #include "llvieweruictrlfactory.h" |
73 | #include "llvoiceclient.h" // for gVoiceClient | ||
73 | 74 | ||
74 | #include "lltoolmgr.h" | 75 | #include "lltoolmgr.h" |
75 | #include "llfocusmgr.h" | 76 | #include "llfocusmgr.h" |
76 | #include "viewer.h" | 77 | #include "viewer.h" |
77 | 78 | ||
79 | //#include "llfirstuse.h" | ||
80 | |||
78 | // | 81 | // |
79 | // Globals | 82 | // Globals |
80 | // | 83 | // |
@@ -96,6 +99,18 @@ const F32 ICON_FLASH_FREQUENCY = 2.f; | |||
96 | const S32 GRAPHIC_FUDGE = 4; | 99 | const S32 GRAPHIC_FUDGE = 4; |
97 | const S32 TEXT_HEIGHT = 18; | 100 | const S32 TEXT_HEIGHT = 18; |
98 | 101 | ||
102 | static void onClickParcelInfo(void*); | ||
103 | static void onClickBalance(void*); | ||
104 | static void onClickBuyCurrency(void*); | ||
105 | static void onClickHealth(void*); | ||
106 | static void onClickFly(void*); | ||
107 | static void onClickPush(void*); | ||
108 | static void onClickVoice(void*); | ||
109 | static void onClickBuild(void*); | ||
110 | static void onClickScripts(void*); | ||
111 | static void onClickBuyLand(void*); | ||
112 | static void onClickScriptDebug(void*); | ||
113 | |||
99 | std::vector<std::string> LLStatusBar::sDays; | 114 | std::vector<std::string> LLStatusBar::sDays; |
100 | std::vector<std::string> LLStatusBar::sMonths; | 115 | std::vector<std::string> LLStatusBar::sMonths; |
101 | const U32 LLStatusBar::MAX_DATE_STRING_LENGTH = 2000; | 116 | const U32 LLStatusBar::MAX_DATE_STRING_LENGTH = 2000; |
@@ -126,15 +141,6 @@ LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) | |||
126 | // build date necessary data (must do after panel built) | 141 | // build date necessary data (must do after panel built) |
127 | setupDate(); | 142 | setupDate(); |
128 | 143 | ||
129 | mBtnScriptOut = LLUICtrlFactory::getButtonByName( this, "scriptout" ); | ||
130 | mBtnHealth = LLUICtrlFactory::getButtonByName( this, "health" ); | ||
131 | mBtnFly = LLUICtrlFactory::getButtonByName( this, "fly" ); | ||
132 | mBtnBuild = LLUICtrlFactory::getButtonByName( this, "build" ); | ||
133 | mBtnScripts = LLUICtrlFactory::getButtonByName( this, "scripts" ); | ||
134 | mBtnPush = LLUICtrlFactory::getButtonByName( this, "restrictpush" ); | ||
135 | mBtnBuyLand = LLUICtrlFactory::getButtonByName( this, "buyland" ); | ||
136 | mBtnBuyCurrency = LLUICtrlFactory::getButtonByName( this, "buycurrency" ); | ||
137 | |||
138 | mTextParcelName = LLUICtrlFactory::getTextBoxByName( this, "ParcelNameText" ); | 144 | mTextParcelName = LLUICtrlFactory::getTextBoxByName( this, "ParcelNameText" ); |
139 | mTextBalance = LLUICtrlFactory::getTextBoxByName( this, "BalanceText" ); | 145 | mTextBalance = LLUICtrlFactory::getTextBoxByName( this, "BalanceText" ); |
140 | 146 | ||
@@ -196,6 +202,7 @@ BOOL LLStatusBar::postBuild() | |||
196 | childSetAction("build", onClickBuild, this ); | 202 | childSetAction("build", onClickBuild, this ); |
197 | childSetAction("scripts", onClickScripts, this ); | 203 | childSetAction("scripts", onClickScripts, this ); |
198 | childSetAction("restrictpush", onClickPush, this ); | 204 | childSetAction("restrictpush", onClickPush, this ); |
205 | childSetAction("status_voice", onClickVoice, this ); | ||
199 | 206 | ||
200 | childSetActionTextbox("ParcelNameText", onClickParcelInfo ); | 207 | childSetActionTextbox("ParcelNameText", onClickParcelInfo ); |
201 | childSetActionTextbox("BalanceText", onClickBalance ); | 208 | childSetActionTextbox("BalanceText", onClickBalance ); |
@@ -305,13 +312,13 @@ void LLStatusBar::refresh() | |||
305 | { | 312 | { |
306 | childGetRect( "scriptout", buttonRect ); | 313 | childGetRect( "scriptout", buttonRect ); |
307 | r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); | 314 | r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); |
308 | mBtnScriptOut->setRect(r); | 315 | childSetRect("scriptout",r); |
309 | mBtnScriptOut->setVisible(TRUE); | 316 | childSetVisible("scriptout", true); |
310 | x += buttonRect.getWidth(); | 317 | x += buttonRect.getWidth(); |
311 | } | 318 | } |
312 | else | 319 | else |
313 | { | 320 | { |
314 | mBtnScriptOut->setVisible(FALSE); | 321 | childSetVisible("scriptout", false); |
315 | } | 322 | } |
316 | 323 | ||
317 | if ((region && region->getAllowDamage()) || | 324 | if ((region && region->getAllowDamage()) || |
@@ -320,19 +327,19 @@ void LLStatusBar::refresh() | |||
320 | // set visibility based on flashing | 327 | // set visibility based on flashing |
321 | if( mHealthTimer->hasExpired() ) | 328 | if( mHealthTimer->hasExpired() ) |
322 | { | 329 | { |
323 | mBtnHealth->setVisible( TRUE ); | 330 | childSetVisible("health", true); |
324 | } | 331 | } |
325 | else | 332 | else |
326 | { | 333 | { |
327 | BOOL flash = S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1; | 334 | BOOL flash = S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1; |
328 | mBtnHealth->setVisible( flash ); | 335 | childSetVisible("health", flash); |
329 | } | 336 | } |
330 | mTextHealth->setVisible(TRUE); | 337 | mTextHealth->setVisible(TRUE); |
331 | 338 | ||
332 | // Health | 339 | // Health |
333 | childGetRect( "health", buttonRect ); | 340 | childGetRect( "health", buttonRect ); |
334 | r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); | 341 | r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); |
335 | mBtnHealth->setRect(r); | 342 | childSetRect("health", r); |
336 | x += buttonRect.getWidth(); | 343 | x += buttonRect.getWidth(); |
337 | 344 | ||
338 | const S32 health_width = S32( LLFontGL::sSansSerifSmall->getWidth("100%") ); | 345 | const S32 health_width = S32( LLFontGL::sSansSerifSmall->getWidth("100%") ); |
@@ -343,7 +350,7 @@ void LLStatusBar::refresh() | |||
343 | else | 350 | else |
344 | { | 351 | { |
345 | // invisible if region doesn't allow damage | 352 | // invisible if region doesn't allow damage |
346 | mBtnHealth->setVisible(FALSE); | 353 | childSetVisible("health", false); |
347 | mTextHealth->setVisible(FALSE); | 354 | mTextHealth->setVisible(FALSE); |
348 | } | 355 | } |
349 | 356 | ||
@@ -352,24 +359,24 @@ void LLStatusBar::refresh() | |||
352 | { | 359 | { |
353 | // No Fly Zone | 360 | // No Fly Zone |
354 | childGetRect( "fly", buttonRect ); | 361 | childGetRect( "fly", buttonRect ); |
355 | mBtnFly->setVisible(TRUE); | 362 | childSetVisible( "fly", true ); |
356 | r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); | 363 | r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); |
357 | mBtnFly->setRect(r); | 364 | childSetRect( "fly", r ); |
358 | x += buttonRect.getWidth(); | 365 | x += buttonRect.getWidth(); |
359 | } | 366 | } |
360 | else | 367 | else |
361 | { | 368 | { |
362 | mBtnFly->setVisible(FALSE); | 369 | childSetVisible("fly", false); |
363 | } | 370 | } |
364 | 371 | ||
365 | BOOL no_build = parcel && !parcel->getAllowModify(); | 372 | BOOL no_build = parcel && !parcel->getAllowModify(); |
366 | mBtnBuild->setVisible( no_build ); | 373 | childSetVisible("build", no_build); |
367 | if (no_build) | 374 | if (no_build) |
368 | { | 375 | { |
369 | childGetRect( "build", buttonRect ); | 376 | childGetRect( "build", buttonRect ); |
370 | // No Build Zone | 377 | // No Build Zone |
371 | r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); | 378 | r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); |
372 | mBtnBuild->setRect(r); | 379 | childSetRect( "build", r ); |
373 | x += buttonRect.getWidth(); | 380 | x += buttonRect.getWidth(); |
374 | } | 381 | } |
375 | 382 | ||
@@ -381,37 +388,46 @@ void LLStatusBar::refresh() | |||
381 | { | 388 | { |
382 | no_scripts = TRUE; | 389 | no_scripts = TRUE; |
383 | } | 390 | } |
384 | mBtnScripts->setVisible( no_scripts ); | 391 | childSetVisible("scripts", no_scripts); |
385 | if (no_scripts) | 392 | if (no_scripts) |
386 | { | 393 | { |
387 | // No scripts | 394 | // No scripts |
388 | childGetRect( "scripts", buttonRect ); | 395 | childGetRect( "scripts", buttonRect ); |
389 | r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); | 396 | r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); |
390 | mBtnScripts->setRect(r); | 397 | childSetRect( "scripts", r ); |
391 | x += buttonRect.getWidth(); | 398 | x += buttonRect.getWidth(); |
392 | } | 399 | } |
393 | 400 | ||
394 | BOOL no_region_push = (region && region->getRestrictPushObject()); | 401 | BOOL no_region_push = (region && region->getRestrictPushObject()); |
395 | BOOL no_push = no_region_push || (parcel && parcel->getRestrictPushObject()); | 402 | BOOL no_push = no_region_push || (parcel && parcel->getRestrictPushObject()); |
396 | mBtnPush->setVisible( no_push ); | 403 | childSetVisible("restrictpush", no_push); |
397 | if (no_push) | 404 | if (no_push) |
398 | { | 405 | { |
399 | childGetRect( "restrictpush", buttonRect ); | 406 | childGetRect( "restrictpush", buttonRect ); |
400 | // No Push Zone | ||
401 | r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); | 407 | r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); |
402 | mBtnPush->setRect(r); | 408 | childSetRect( "restrictpush", r ); |
409 | x += buttonRect.getWidth(); | ||
410 | } | ||
411 | |||
412 | BOOL have_voice = gVoiceClient->getAreaVoiceDisabled() ? FALSE : TRUE; | ||
413 | childSetVisible("status_voice", have_voice); | ||
414 | if (have_voice) | ||
415 | { | ||
416 | childGetRect( "status_voice", buttonRect ); | ||
417 | r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); | ||
418 | childSetRect( "status_voice", r ); | ||
403 | x += buttonRect.getWidth(); | 419 | x += buttonRect.getWidth(); |
404 | } | 420 | } |
405 | 421 | ||
406 | BOOL canBuyLand = parcel | 422 | BOOL canBuyLand = parcel |
407 | && !parcel->isPublic() | 423 | && !parcel->isPublic() |
408 | && gParcelMgr->canAgentBuyParcel(parcel, false); | 424 | && gParcelMgr->canAgentBuyParcel(parcel, false); |
409 | mBtnBuyLand->setVisible(canBuyLand); | 425 | childSetVisible("buyland", canBuyLand); |
410 | if (canBuyLand) | 426 | if (canBuyLand) |
411 | { | 427 | { |
412 | childGetRect( "buyland", buttonRect ); | 428 | childGetRect( "buyland", buttonRect ); |
413 | r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); | 429 | r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); |
414 | mBtnBuyLand->setRect(r); | 430 | childSetRect( "buyland", r ); |
415 | x += buttonRect.getWidth(); | 431 | x += buttonRect.getWidth(); |
416 | } | 432 | } |
417 | 433 | ||
@@ -480,7 +496,7 @@ void LLStatusBar::setVisibleForMouselook(bool visible) | |||
480 | mTextTime->setVisible(visible); | 496 | mTextTime->setVisible(visible); |
481 | mSGBandwidth->setVisible(visible); | 497 | mSGBandwidth->setVisible(visible); |
482 | mSGPacketLoss->setVisible(visible); | 498 | mSGPacketLoss->setVisible(visible); |
483 | mBtnBuyCurrency->setVisible(visible); | 499 | childSetVisible("buycurrency", visible); |
484 | setBackgroundVisible(visible); | 500 | setBackgroundVisible(visible); |
485 | } | 501 | } |
486 | 502 | ||
@@ -589,58 +605,55 @@ S32 LLStatusBar::getSquareMetersLeft() const | |||
589 | return mSquareMetersCredit - mSquareMetersCommitted; | 605 | return mSquareMetersCredit - mSquareMetersCommitted; |
590 | } | 606 | } |
591 | 607 | ||
592 | // static | 608 | static void onClickParcelInfo(void* data) |
593 | void LLStatusBar::onClickParcelInfo(void* data) | ||
594 | { | 609 | { |
595 | gParcelMgr->selectParcelAt(gAgent.getPositionGlobal()); | 610 | gParcelMgr->selectParcelAt(gAgent.getPositionGlobal()); |
596 | 611 | ||
597 | LLFloaterLand::show(); | 612 | LLFloaterLand::show(); |
598 | } | 613 | } |
599 | 614 | ||
600 | // static | 615 | static void onClickBalance(void* data) |
601 | void LLStatusBar::onClickBalance(void* data) | ||
602 | { | 616 | { |
603 | LLFloaterBuyCurrency::buyCurrency(); | 617 | LLFloaterBuyCurrency::buyCurrency(); |
604 | } | 618 | } |
605 | 619 | ||
606 | // static | 620 | static void onClickBuyCurrency(void* data) |
607 | void LLStatusBar::onClickBuyCurrency(void* data) | ||
608 | { | 621 | { |
609 | LLFloaterBuyCurrency::buyCurrency(); | 622 | LLFloaterBuyCurrency::buyCurrency(); |
610 | } | 623 | } |
611 | 624 | ||
612 | // static | 625 | static void onClickHealth(void* ) |
613 | void LLStatusBar::onClickHealth(void* ) | ||
614 | { | 626 | { |
615 | LLNotifyBox::showXml("NotSafe"); | 627 | LLNotifyBox::showXml("NotSafe"); |
616 | } | 628 | } |
617 | 629 | ||
618 | // static | 630 | static void onClickScriptDebug(void*) |
619 | void LLStatusBar::onClickScriptDebug(void*) | ||
620 | { | 631 | { |
621 | LLFloaterScriptDebug::show(LLUUID::null); | 632 | LLFloaterScriptDebug::show(LLUUID::null); |
622 | } | 633 | } |
623 | 634 | ||
624 | // static | 635 | static void onClickFly(void* ) |
625 | void LLStatusBar::onClickFly(void* ) | ||
626 | { | 636 | { |
627 | LLNotifyBox::showXml("NoFly"); | 637 | LLNotifyBox::showXml("NoFly"); |
628 | } | 638 | } |
629 | 639 | ||
630 | // static | 640 | static void onClickPush(void* ) |
631 | void LLStatusBar::onClickPush(void* ) | ||
632 | { | 641 | { |
633 | LLNotifyBox::showXml("PushRestricted"); | 642 | LLNotifyBox::showXml("PushRestricted"); |
634 | } | 643 | } |
635 | 644 | ||
636 | // static | 645 | static void onClickVoice(void* ) |
637 | void LLStatusBar::onClickBuild(void*) | 646 | { |
647 | LLNotifyBox::showXml("VoiceAvailablity"); | ||
648 | //LLFirstUse::useVoice(); | ||
649 | } | ||
650 | |||
651 | static void onClickBuild(void*) | ||
638 | { | 652 | { |
639 | LLNotifyBox::showXml("NoBuild"); | 653 | LLNotifyBox::showXml("NoBuild"); |
640 | } | 654 | } |
641 | 655 | ||
642 | // static | 656 | static void onClickScripts(void*) |
643 | void LLStatusBar::onClickScripts(void*) | ||
644 | { | 657 | { |
645 | LLViewerRegion* region = gAgent.getRegion(); | 658 | LLViewerRegion* region = gAgent.getRegion(); |
646 | if(region && region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS) | 659 | if(region && region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS) |
@@ -657,8 +670,7 @@ void LLStatusBar::onClickScripts(void*) | |||
657 | } | 670 | } |
658 | } | 671 | } |
659 | 672 | ||
660 | // static | 673 | static void onClickBuyLand(void*) |
661 | void LLStatusBar::onClickBuyLand(void*) | ||
662 | { | 674 | { |
663 | gParcelMgr->selectParcelAt(gAgent.getPositionGlobal()); | 675 | gParcelMgr->selectParcelAt(gAgent.getPositionGlobal()); |
664 | gParcelMgr->startBuyLand(); | 676 | gParcelMgr->startBuyLand(); |