diff options
Diffstat (limited to 'indra/newview/llstatusbar.cpp')
-rw-r--r-- | indra/newview/llstatusbar.cpp | 592 |
1 files changed, 137 insertions, 455 deletions
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index f36d12d638..c724fb5315 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -43,16 +43,16 @@ #include "llfloaterchat.h" #include "llfloaterdirectory.h" // to spawn search #include "llfloaterlagmeter.h" -#include "llfloaterland.h" #include "llfloaterregioninfo.h" #include "llfloaterscriptdebug.h" #include "llhudicon.h" -#include "llinventoryview.h" +#include "llnavigationbar.h" #include "llkeyboard.h" #include "lllineeditor.h" #include "llmenugl.h" #include "llnotify.h" #include "llimview.h" +#include "llsd.h" #include "lltextbox.h" #include "llui.h" #include "llviewerparceloverlay.h" @@ -60,7 +60,7 @@ #include "llviewerstats.h" #include "llviewerwindow.h" #include "llframetimer.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llresmgr.h" #include "llworld.h" #include "llstatgraph.h" @@ -68,14 +68,14 @@ #include "llviewerparcelmgr.h" #include "llviewerthrottle.h" #include "lluictrlfactory.h" -#include "llvoiceclient.h" // for gVoiceClient #include "lltoolmgr.h" #include "llfocusmgr.h" #include "llappviewer.h" - +#include "lltrans.h" // library includes #include "imageids.h" +#include "llfloaterreg.h" #include "llfontgl.h" #include "llrect.h" #include "llerror.h" @@ -91,7 +91,7 @@ // Globals // LLStatusBar *gStatusBar = NULL; -S32 STATUS_BAR_HEIGHT = 0; +S32 STATUS_BAR_HEIGHT = 26; extern S32 MENU_BAR_HEIGHT; @@ -107,29 +107,23 @@ const F32 ICON_TIMER_EXPIRY = 3.f; // How long the balance and health icons sho const F32 ICON_FLASH_FREQUENCY = 2.f; const S32 TEXT_HEIGHT = 18; -static void onClickParcelInfo(void*); -static void onClickBalance(void*); static void onClickBuyCurrency(void*); static void onClickHealth(void*); -static void onClickFly(void*); -static void onClickPush(void*); -static void onClickVoice(void*); -static void onClickBuild(void*); -static void onClickScripts(void*); -static void onClickBuyLand(void*); static void onClickScriptDebug(void*); std::vector<std::string> LLStatusBar::sDays; std::vector<std::string> LLStatusBar::sMonths; const U32 LLStatusBar::MAX_DATE_STRING_LENGTH = 2000; -LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) -: LLPanel(name, LLRect(), FALSE), // not mouse opaque -mBalance(0), -mHealth(100), -mSquareMetersCredit(0), -mSquareMetersCommitted(0) +LLStatusBar::LLStatusBar(const LLRect& rect) +: LLPanel(), + mBalance(0), + mHealth(100), + mSquareMetersCredit(0), + mSquareMetersCommitted(0) { + setRect(rect); + // status bar can possible overlay menus? setMouseOpaque(FALSE); setIsChrome(TRUE); @@ -149,56 +143,42 @@ mSquareMetersCommitted(0) // build date necessary data (must do after panel built) setupDate(); - mTextParcelName = getChild<LLTextBox>("ParcelNameText" ); - mTextBalance = getChild<LLTextBox>("BalanceText" ); - mTextHealth = getChild<LLTextBox>("HealthText" ); mTextTime = getChild<LLTextBox>("TimeText" ); + + mBtnBuyCurrency = getChild<LLButton>( "buycurrency" ); + mBtnBuyCurrency->setClickedCallback( onClickBuyCurrency, this ); childSetAction("scriptout", onClickScriptDebug, this); childSetAction("health", onClickHealth, this); - childSetAction("no_fly", onClickFly, this); - childSetAction("buyland", onClickBuyLand, this ); - childSetAction("buycurrency", onClickBuyCurrency, this ); - childSetAction("no_build", onClickBuild, this ); - childSetAction("no_scripts", onClickScripts, this ); - childSetAction("restrictpush", onClickPush, this ); - childSetAction("status_no_voice", onClickVoice, this ); - - childSetCommitCallback("search_editor", onCommitSearch, this); - childSetAction("search_btn", onClickSearch, this); - - childSetVisible("search_editor", gSavedSettings.getBOOL("ShowSearchBar")); - childSetVisible("search_btn", gSavedSettings.getBOOL("ShowSearchBar")); - childSetVisible("menubar_search_bevel_bg", gSavedSettings.getBOOL("ShowSearchBar")); - - childSetActionTextbox("ParcelNameText", onClickParcelInfo ); - childSetActionTextbox("BalanceText", onClickBalance ); // Adding Net Stat Graph S32 x = getRect().getWidth() - 2; S32 y = 0; LLRect r; r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); - mSGBandwidth = new LLStatGraph("BandwidthGraph", r); - mSGBandwidth->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); + LLStatGraph::Params sgp; + sgp.name("BandwidthGraph"); + sgp.rect(r); + sgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); + sgp.mouse_opaque(false); + mSGBandwidth = LLUICtrlFactory::create<LLStatGraph>(sgp); mSGBandwidth->setStat(&LLViewerStats::getInstance()->mKBitStat); - std::string text = childGetText("bandwidth_tooltip") + " "; - LLUIString bandwidth_tooltip = text; // get the text from XML until this widget is XML driven - mSGBandwidth->setLabel(bandwidth_tooltip.getString()); mSGBandwidth->setUnits("Kbps"); mSGBandwidth->setPrecision(0); - mSGBandwidth->setMouseOpaque(FALSE); addChild(mSGBandwidth); x -= SIM_STAT_WIDTH + 2; r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); - mSGPacketLoss = new LLStatGraph("PacketLossPercent", r); - mSGPacketLoss->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); + //these don't seem to like being reused + LLStatGraph::Params pgp; + pgp.name("PacketLossPercent"); + pgp.rect(r); + pgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); + pgp.mouse_opaque(false); + + mSGPacketLoss = LLUICtrlFactory::create<LLStatGraph>(pgp); mSGPacketLoss->setStat(&LLViewerStats::getInstance()->mPacketsLostPercentStat); - text = childGetText("packet_loss_tooltip") + " "; - LLUIString packet_loss_tooltip = text; // get the text from XML until this widget is XML driven - mSGPacketLoss->setLabel(packet_loss_tooltip.getString()); mSGPacketLoss->setUnits("%"); mSGPacketLoss->setMin(0.f); mSGPacketLoss->setMax(5.f); @@ -206,7 +186,6 @@ mSquareMetersCommitted(0) mSGPacketLoss->setThreshold(1, 1.f); mSGPacketLoss->setThreshold(2, 3.f); mSGPacketLoss->setPrecision(1); - mSGPacketLoss->setMouseOpaque(FALSE); mSGPacketLoss->mPerSec = FALSE; addChild(mSGPacketLoss); @@ -236,77 +215,76 @@ void LLStatusBar::draw() if (isBackgroundVisible()) { + static LLUICachedControl<S32> drop_shadow_floater ("DropShadowFloater", 0); + static LLUIColor color_drop_shadow = LLUIColorTable::instance().getColor("ColorDropShadow"); gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0, - LLUI::sColorsGroup->getColor("ColorDropShadow"), - LLUI::sConfigGroup->getS32("DropShadowFloater") ); + color_drop_shadow, drop_shadow_floater ); } LLPanel::draw(); } - -// Per-frame updates of visibility -void LLStatusBar::refresh() +BOOL LLStatusBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { - // Adding Net Stat Meter back in - F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; - mSGBandwidth->setMin(0.f); - mSGBandwidth->setMax(bwtotal*1.25f); - mSGBandwidth->setThreshold(0, bwtotal*0.75f); - mSGBandwidth->setThreshold(1, bwtotal); - mSGBandwidth->setThreshold(2, bwtotal); + if (mHideNavbarContextMenu) + { + mHideNavbarContextMenu->buildDrawLabels(); + mHideNavbarContextMenu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(this, mHideNavbarContextMenu, x, y); + } - // *TODO: Localize / translate time + return TRUE; +} - // Get current UTC time, adjusted for the user's clock - // being off. - time_t utc_time; - utc_time = time_corrected(); +BOOL LLStatusBar::postBuild() +{ + mCommitCallbackRegistrar.add("HideNavbarMenu.Action", boost::bind(&LLStatusBar::onHideNavbarContextMenuItemClicked, this, _2)); + mEnableCallbackRegistrar.add("HideNavbarMenu.EnableMenuItem", boost::bind(&LLStatusBar::onHideNavbarContextMenuItemEnabled, this, _2)); - // There's only one internal tm buffer. - struct tm* internal_time; + mHideNavbarContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_hide_navbar.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + gMenuHolder->addChild(mHideNavbarContextMenu); - // Convert to Pacific, based on server's opinion of whether - // it's daylight savings time there. - internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); + gMenuBarView->setRightMouseDownCallback(boost::bind(&LLStatusBar::onMainMenuRightClicked, this, _1, _2, _3, _4)); - S32 hour = internal_time->tm_hour; - S32 min = internal_time->tm_min; + return TRUE; +} - std::string am_pm = "AM"; - if (hour > 11) +// Per-frame updates of visibility +void LLStatusBar::refresh() +{ + bool net_stats_visible = gSavedSettings.getBOOL("ShowNetStats"); + + if (net_stats_visible) { - hour -= 12; - am_pm = "PM"; + // Adding Net Stat Meter back in + F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; + mSGBandwidth->setMin(0.f); + mSGBandwidth->setMax(bwtotal*1.25f); + mSGBandwidth->setThreshold(0, bwtotal*0.75f); + mSGBandwidth->setThreshold(1, bwtotal); + mSGBandwidth->setThreshold(2, bwtotal); } + + // Get current UTC time, adjusted for the user's clock + // being off. + time_t utc_time; + utc_time = time_corrected(); - std::string tz = "PST"; - if (gPacificDaylightTime) - { - tz = "PDT"; - } - // Zero hour is 12 AM - if (hour == 0) hour = 12; - std::ostringstream t; - t << std::setfill(' ') << std::setw(2) << hour << ":" - << std::setfill('0') << std::setw(2) << min - << " " << am_pm << " " << tz; - mTextTime->setText(t.str()); - - // Year starts at 1900, set the tooltip to have the date - std::ostringstream date; - date << sDays[internal_time->tm_wday] << ", " - << std::setfill('0') << std::setw(2) << internal_time->tm_mday << " " - << sMonths[internal_time->tm_mon] << " " - << internal_time->tm_year + 1900; - mTextTime->setToolTip(date.str()); + std::string timeStr = getString("time"); + LLSD substitution; + substitution["datetime"] = (S32) utc_time; + LLStringUtil::format (timeStr, substitution); + mTextTime->setText(timeStr); + + // set the tooltip to have the date + std::string dtStr = getString("timeTooltip"); + LLStringUtil::format (dtStr, substitution); + mTextTime->setToolTip (dtStr); LLRect r; const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); S32 x = MENU_RIGHT + MENU_PARCEL_SPACING; S32 y = 0; - bool search_visible = gSavedSettings.getBOOL("ShowSearchBar"); - // reshape menu bar to its content's width if (MENU_RIGHT != gMenuBarView->getRect().getWidth()) { @@ -331,8 +309,8 @@ void LLStatusBar::refresh() childSetVisible("scriptout", false); } - if ((region && region->getAllowDamage()) || - (parcel && parcel->getAllowDamage()) ) + if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK && + ((region && region->getAllowDamage()) || (parcel && parcel->getAllowDamage()))) { // set visibility based on flashing if( mHealthTimer->hasExpired() ) @@ -364,293 +342,15 @@ void LLStatusBar::refresh() mTextHealth->setVisible(FALSE); } - if ((region && region->getBlockFly()) || - (parcel && !parcel->getAllowFly()) ) - { - // No Fly Zone - childGetRect( "no_fly", buttonRect ); - childSetVisible( "no_fly", true ); - r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); - childSetRect( "no_fly", r ); - x += buttonRect.getWidth(); - } - else - { - // Fly Zone - childSetVisible("no_fly", false); - } - - BOOL no_build = parcel && !parcel->getAllowModify(); - if (no_build) - { - childSetVisible("no_build", TRUE); - childGetRect( "no_build", buttonRect ); - // No Build Zone - r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); - childSetRect( "no_build", r ); - x += buttonRect.getWidth(); - } - else - { - childSetVisible("no_build", FALSE); - } - - BOOL no_scripts = FALSE; - if((region - && ((region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) - || (region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS))) - || (parcel && !parcel->getAllowOtherScripts())) - { - no_scripts = TRUE; - } - if (no_scripts) - { - // No scripts - childSetVisible("no_scripts", TRUE); - childGetRect( "no_scripts", buttonRect ); - r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); - childSetRect( "no_scripts", r ); - x += buttonRect.getWidth(); - } - else - { - // Yes scripts - childSetVisible("no_scripts", FALSE); - } - - BOOL no_region_push = (region && region->getRestrictPushObject()); - BOOL no_push = no_region_push || (parcel && parcel->getRestrictPushObject()); - if (no_push) - { - childSetVisible("restrictpush", TRUE); - childGetRect( "restrictpush", buttonRect ); - r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); - childSetRect( "restrictpush", r ); - x += buttonRect.getWidth(); - } - else - { - childSetVisible("restrictpush", FALSE); - } - - BOOL have_voice = parcel && parcel->getParcelFlagAllowVoice(); - if (have_voice) - { - childSetVisible("status_no_voice", FALSE); - } - else - { - childSetVisible("status_no_voice", TRUE); - childGetRect( "status_no_voice", buttonRect ); - r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); - childSetRect( "status_no_voice", r ); - x += buttonRect.getWidth(); - } - - BOOL canBuyLand = parcel - && !parcel->isPublic() - && LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, false); - childSetVisible("buyland", canBuyLand); - if (canBuyLand) - { - //HACK: layout tweak until this is all xml - x += 9; - childGetRect( "buyland", buttonRect ); - r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); - childSetRect( "buyland", r ); - x += buttonRect.getWidth(); - } - - std::string location_name; - if (region) - { - const LLVector3& agent_pos_region = gAgent.getPositionAgent(); - S32 pos_x = lltrunc( agent_pos_region.mV[VX] ); - S32 pos_y = lltrunc( agent_pos_region.mV[VY] ); - S32 pos_z = lltrunc( agent_pos_region.mV[VZ] ); - - // Round the numbers based on the velocity - LLVector3 agent_velocity = gAgent.getVelocity(); - F32 velocity_mag_sq = agent_velocity.magVecSquared(); - - const F32 FLY_CUTOFF = 6.f; // meters/sec - const F32 FLY_CUTOFF_SQ = FLY_CUTOFF * FLY_CUTOFF; - const F32 WALK_CUTOFF = 1.5f; // meters/sec - const F32 WALK_CUTOFF_SQ = WALK_CUTOFF * WALK_CUTOFF; - - if (velocity_mag_sq > FLY_CUTOFF_SQ) - { - pos_x -= pos_x % 4; - pos_y -= pos_y % 4; - } - else if (velocity_mag_sq > WALK_CUTOFF_SQ) - { - pos_x -= pos_x % 2; - pos_y -= pos_y % 2; - } - - mRegionDetails.mTime = mTextTime->getText(); - mRegionDetails.mBalance = mBalance; - mRegionDetails.mAccessString = region->getSimAccessString(); - mRegionDetails.mPing = region->getNetDetailsForLCD(); - if (parcel) - { - location_name = region->getName() - + llformat(" %d, %d, %d (%s) - %s", - pos_x, pos_y, pos_z, - region->getSimAccessString().c_str(), - parcel->getName().c_str()); - - // keep these around for the LCD to use - mRegionDetails.mRegionName = region->getName(); - mRegionDetails.mParcelName = parcel->getName(); - mRegionDetails.mX = pos_x; - mRegionDetails.mY = pos_y; - mRegionDetails.mZ = pos_z; - - mRegionDetails.mArea = parcel->getArea(); - mRegionDetails.mForSale = parcel->getForSale(); - mRegionDetails.mTraffic = LLViewerParcelMgr::getInstance()->getDwelling(); - - if (parcel->isPublic()) - { - mRegionDetails.mOwner = "Public"; - } - else - { - if (parcel->getIsGroupOwned()) - { - if(!parcel->getGroupID().isNull()) - { - gCacheName->getGroupName(parcel->getGroupID(), mRegionDetails.mOwner); - } - else - { - mRegionDetails.mOwner = "Group Owned"; - } - } - else - { - // Figure out the owner's name - gCacheName->getFullName(parcel->getOwnerID(), mRegionDetails.mOwner); - } - } - } - else - { - location_name = region->getName() - + llformat(" %d, %d, %d (%s)", - pos_x, pos_y, pos_z, - region->getSimAccessString().c_str()); - // keep these around for the LCD to use - mRegionDetails.mRegionName = region->getName(); - mRegionDetails.mParcelName = "Unknown"; - - mRegionDetails.mX = pos_x; - mRegionDetails.mY = pos_y; - mRegionDetails.mZ = pos_z; - mRegionDetails.mArea = 0; - mRegionDetails.mForSale = FALSE; - mRegionDetails.mOwner = "Unknown"; - mRegionDetails.mTraffic = 0.0f; - } - } - else - { - // no region - location_name = "(Unknown)"; - // keep these around for the LCD to use - mRegionDetails.mRegionName = "Unknown"; - mRegionDetails.mParcelName = "Unknown"; - mRegionDetails.mAccessString = "Unknown"; - mRegionDetails.mX = 0; - mRegionDetails.mY = 0; - mRegionDetails.mZ = 0; - mRegionDetails.mArea = 0; - mRegionDetails.mForSale = FALSE; - mRegionDetails.mOwner = "Unknown"; - mRegionDetails.mTraffic = 0.0f; - } - - mTextParcelName->setText(location_name); - - - - // x = right edge - // loop through: stat graphs, search btn, search text editor, money, buy money, clock - // adjust rect - // finally adjust parcel name rect - - S32 new_right = getRect().getWidth(); - if (search_visible) - { - childGetRect("search_btn", r); - //r.translate( new_right - r.mRight, 0); - //childSetRect("search_btn", r); - new_right -= r.getWidth(); - - childGetRect("search_editor", r); - //r.translate( new_right - r.mRight, 0); - //childSetRect("search_editor", r); - new_right -= r.getWidth() + 6; - } - else - { - childGetRect("stat_btn", r); - r.translate( new_right - r.mRight, 0); - childSetRect("stat_btn", r); - new_right -= r.getWidth() + 6; - } - - // Set rects of money, buy money, time - childGetRect("BalanceText", r); - r.translate( new_right - r.mRight, 0); - childSetRect("BalanceText", r); - new_right -= r.getWidth() - 18; - - childGetRect("buycurrency", r); - r.translate( new_right - r.mRight, 0); - childSetRect("buycurrency", r); - new_right -= r.getWidth() + 6; - - childGetRect("TimeText", r); - // mTextTime->getTextPixelWidth(); - r.translate( new_right - r.mRight, 0); - childSetRect("TimeText", r); - // new_right -= r.getWidth() + MENU_PARCEL_SPACING; - - - // Adjust region name and parcel name - x += 8; - - const S32 PARCEL_RIGHT = llmin(mTextTime->getRect().mLeft, mTextParcelName->getTextPixelWidth() + x + 5); - r.set(x+4, getRect().getHeight() - 2, PARCEL_RIGHT, 0); - mTextParcelName->setRect(r); - - // Set search bar visibility - - if (gAgent.getCameraMode() != CAMERA_MODE_MOUSELOOK) - { - // don't monkey with search visibility in mouselook - it will be set - // with setVisibleForMouselook() below - childSetVisible("search_editor", search_visible); - childSetVisible("search_btn", search_visible); - childSetVisible("menubar_search_bevel_bg", search_visible); - } - - mSGBandwidth->setVisible(! search_visible); - mSGPacketLoss->setVisible(! search_visible); - childSetEnabled("stat_btn", ! search_visible); + mSGBandwidth->setVisible(net_stats_visible); + mSGPacketLoss->setVisible(net_stats_visible); + childSetEnabled("stat_btn", net_stats_visible); } void LLStatusBar::setVisibleForMouselook(bool visible) { - mTextBalance->setVisible(visible); mTextTime->setVisible(visible); - childSetVisible("buycurrency", visible); - childSetVisible("search_editor", visible); - childSetVisible("search_btn", visible); - childSetVisible("menubar_search_bevel_bg", visible); + mBtnBuyCurrency->setVisible(visible); mSGBandwidth->setVisible(visible); mSGPacketLoss->setVisible(visible); setBackgroundVisible(visible); @@ -669,9 +369,19 @@ void LLStatusBar::creditBalance(S32 credit) void LLStatusBar::setBalance(S32 balance) { std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance ); - std::string balance_str = "L$"; - balance_str += money_str; - mTextBalance->setText( balance_str ); + + LLStringUtil::format_map_t string_args; + string_args["[AMT]"] = llformat("%s", money_str.c_str()); + std::string labe_str = getString("buycurrencylabel", string_args); + mBtnBuyCurrency->setLabel(labe_str); + + // Resize the balance button so that the label fits it, and the button expands to the left. + // *TODO: LLButton should have an option where to expand. + { + S32 saved_right = mBtnBuyCurrency->getRect().mRight; + mBtnBuyCurrency->autoResize(); + mBtnBuyCurrency->translate(saved_right - mBtnBuyCurrency->getRect().mRight, 0); + } if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold"))) { @@ -775,18 +485,6 @@ S32 LLStatusBar::getSquareMetersLeft() const return mSquareMetersCredit - mSquareMetersCommitted; } -static void onClickParcelInfo(void* data) -{ - LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); - - LLFloaterLand::showInstance(); -} - -static void onClickBalance(void* data) -{ - onClickBuyCurrency(data); -} - static void onClickBuyCurrency(void* data) { LLFloaterBuyCurrency::buyCurrency(); @@ -802,49 +500,6 @@ static void onClickScriptDebug(void*) LLFloaterScriptDebug::show(LLUUID::null); } -static void onClickFly(void* ) -{ - LLNotifications::instance().add("NoFly"); -} - -static void onClickPush(void* ) -{ - LLNotifications::instance().add("PushRestricted"); -} - -static void onClickVoice(void* ) -{ - LLNotifications::instance().add("NoVoice"); -} - -static void onClickBuild(void*) -{ - LLNotifications::instance().add("NoBuild"); -} - -static void onClickScripts(void*) -{ - LLViewerRegion* region = gAgent.getRegion(); - if(region && region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS) - { - LLNotifications::instance().add("ScriptsStopped"); - } - else if(region && region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) - { - LLNotifications::instance().add("ScriptsNotRunning"); - } - else - { - LLNotifications::instance().add("NoOutsideScripts"); - } -} - -static void onClickBuyLand(void*) -{ - LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); - LLViewerParcelMgr::getInstance()->startBuyLand(); -} - // sets the static variables necessary for the date void LLStatusBar::setupDate() { @@ -908,25 +563,52 @@ void LLStatusBar::setupDate() } } -// static -void LLStatusBar::onCommitSearch(LLUICtrl*, void* data) +bool LLStatusBar::onHideNavbarContextMenuItemEnabled(const LLSD& userdata) { - // committing is the same as clicking "search" - onClickSearch(data); + std::string item = userdata.asString(); + + if (item == "show_navbar_navigation_panel") + { + return gSavedSettings.getBOOL("ShowNavbarNavigationPanel"); + } + else if (item == "show_navbar_favorites_panel") + { + return gSavedSettings.getBOOL("ShowNavbarFavoritesPanel"); + } + + return FALSE; } -// static -void LLStatusBar::onClickSearch(void* data) +void LLStatusBar::onHideNavbarContextMenuItemClicked(const LLSD& userdata) +{ + std::string item = userdata.asString(); + + if (item == "show_navbar_navigation_panel") + { + BOOL state = !gSavedSettings.getBOOL("ShowNavbarNavigationPanel"); + + LLNavigationBar::getInstance()->showNavigationPanel(state); + gSavedSettings.setBOOL("ShowNavbarNavigationPanel", state); + } + else if (item == "show_navbar_favorites_panel") + { + BOOL state = !gSavedSettings.getBOOL("ShowNavbarFavoritesPanel"); + + LLNavigationBar::getInstance()->showFavoritesPanel(state); + gSavedSettings.setBOOL("ShowNavbarFavoritesPanel", state); + } +} + + +void LLStatusBar::onMainMenuRightClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask) { - LLStatusBar* self = (LLStatusBar*)data; - std::string search_text = self->childGetText("search_editor"); - LLFloaterDirectory::showFindAll(search_text); + handleRightMouseDown(x, y, mask); } // static void LLStatusBar::onClickStatGraph(void* data) { - LLFloaterLagMeter::showInstance(); + LLFloaterReg::showInstance("lagmeter"); } BOOL can_afford_transaction(S32 cost) @@ -942,7 +624,7 @@ class LLBalanceHandler : public LLCommandHandler public: // Requires "trusted" browser/URL source LLBalanceHandler() : LLCommandHandler("balance", true) { } - bool handle(const LLSD& tokens, const LLSD& query_map, LLWebBrowserCtrl* web) + bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) { if (tokens.size() == 1 && tokens[0].asString() == "request") |