Clean up and draw optimization in LLStatusBar.

I saw a 1.7 FPS gain, which is pretty good for my old card ^*^
This commit is contained in:
Inusaito Sayori
2014-10-23 04:28:18 -04:00
parent 3231a7d25f
commit b25643f0bf
2 changed files with 139 additions and 229 deletions

View File

@@ -118,20 +118,11 @@ const F32 ICON_TIMER_EXPIRY = 3.f; // How long the balance and health icons sho
const F32 ICON_FLASH_FREQUENCY = 2.f; const F32 ICON_FLASH_FREQUENCY = 2.f;
const S32 TEXT_HEIGHT = 18; const S32 TEXT_HEIGHT = 18;
static void onClickParcelInfo(void*); static void onClickParcelInfo();
static void onClickBalance(void*); static bool rebakeRegionCallback(const LLSD& n, const LLSD& r);
static void onClickBuyCurrency(void*); static void pf_dirty_click() { LLNotificationsUtil::add("PathfindingDirty", LLSD(), LLSD(), rebakeRegionCallback); }
static void onClickHealth(void*); static void onClickScripts();
static void onClickFly(void*); static void onClickSearch(const std::string& query);
static void onClickPush(void*);
static void onClickVoice(void*);
static void onClickBuild(void*);
static void onClickPFDirty(void*);
static void onClickPFDisabled(void*);
static void onClickSeeAV(void*);
static void onClickScripts(void*);
static void onClickBuyLand(void*);
static void onClickScriptDebug(void*);
std::vector<std::string> LLStatusBar::sDays; std::vector<std::string> LLStatusBar::sDays;
std::vector<std::string> LLStatusBar::sMonths; std::vector<std::string> LLStatusBar::sMonths;
@@ -206,33 +197,48 @@ mIsNavMeshDirty(false)
if (!mUPCSupported) if (!mUPCSupported)
mTextUPC->setVisible(false); mTextUPC->setVisible(false);
childSetAction("scriptout", onClickScriptDebug, this); mScriptOut = getChild<LLUICtrl>("scriptout");
childSetAction("health", onClickHealth, this); mScriptOut->setCommitCallback(boost::bind(LLFloaterScriptDebug::show, LLUUID::null));
childSetAction("no_fly", onClickFly, this); mHealthV = getChild<LLUICtrl>("health");
childSetAction("buyland", onClickBuyLand, this ); mHealthV->setCommitCallback(boost::bind(LLNotificationsUtil::add, "NotSafe"));
childSetAction("buycurrency", onClickBuyCurrency, this ); mNoFly = getChild<LLUICtrl>("no_fly");
childSetAction("no_build", onClickBuild, this ); mNoFly->setCommitCallback(boost::bind(LLNotificationsUtil::add, "NoFly"));
childSetAction("pf_dirty", onClickPFDirty, this); mBuyLand = getChild<LLUICtrl>("buyland");
childSetAction("pf_disabled", onClickPFDisabled, this); mBuyLand->setCommitCallback(boost::bind(&LLViewerParcelMgr::startBuyLand, boost::bind(LLViewerParcelMgr::getInstance), 0));
childSetAction("status_SeeAV", onClickSeeAV, this ); mBuyCurrency = getChild<LLUICtrl>("buycurrency");
childSetAction("no_scripts", onClickScripts, this ); mBuyCurrency->setCommitCallback(boost::bind(LLFloaterBuyCurrency::buyCurrency));
childSetAction("restrictpush", onClickPush, this ); mNoBuild = getChild<LLUICtrl>("no_build");
childSetAction("status_no_voice", onClickVoice, this ); mNoBuild->setCommitCallback(boost::bind(LLNotificationsUtil::add, "NoBuild"));
mPFDirty = getChild<LLUICtrl>("pf_dirty");
mPFDirty->setCommitCallback(boost::bind(pf_dirty_click));
mPFDisabled = getChild<LLUICtrl>("pf_disabled");
mPFDisabled->setCommitCallback(boost::bind(LLNotificationsUtil::add, "DynamicPathfindingDisabled"));
mStatusSeeAV = getChild<LLUICtrl>("status_SeeAV");
mStatusSeeAV->setCommitCallback(boost::bind(LLNotificationsUtil::add, "SeeAvatars"));
mNoScripts = getChild<LLUICtrl>("no_scripts");
mNoScripts->setCommitCallback(boost::bind(onClickScripts));
mRestrictPush = getChild<LLUICtrl>("restrictpush");
mRestrictPush->setCommitCallback(boost::bind(LLNotificationsUtil::add, "PushRestricted"));
mStatusNoVoice = getChild<LLUICtrl>("status_no_voice");
mStatusNoVoice->setCommitCallback(boost::bind(LLNotificationsUtil::add, "NoVoice"));
childSetCommitCallback("search_editor", onCommitSearch, this); mSearchEditor = getChild<LLUICtrl>("search_editor");
childSetAction("search_btn", onClickSearch, this); mSearchEditor->setCommitCallback(boost::bind(onClickSearch, _2));
mSearchBtn = getChild<LLUICtrl>("search_btn");
mSearchBtn->setCommitCallback(boost::bind(onClickSearch, boost::bind(&LLView::getValue, mSearchEditor)));
childSetVisible("search_editor", gSavedSettings.getBOOL("ShowSearchBar")); bool show_search(gSavedSettings.getBOOL("ShowSearchBar"));
childSetVisible("search_btn", gSavedSettings.getBOOL("ShowSearchBar")); mSearchEditor->setVisible(show_search);
childSetVisible("menubar_search_bevel_bg", gSavedSettings.getBOOL("ShowSearchBar")); mSearchBtn->setVisible(show_search);
mSearchBevel = getChildView("menubar_search_bevel_bg");
mSearchBevel->setVisible(show_search);
childSetActionTextbox("ParcelNameText", onClickParcelInfo ); mTextParcelName->setClickedCallback(boost::bind(onClickParcelInfo));
childSetActionTextbox("BalanceText", onClickBalance ); mTextBalance->setClickedCallback(boost::bind(LLFloaterBuyCurrency::buyCurrency));
// TODO: Disable buying currency when connected to non-SL grids // TODO: Disable buying currency when connected to non-SL grids
// that don't support currency yet -- MC // that don't support currency yet -- MC
LLButton* buybtn = getChild<LLButton>("buycurrency"); mBuyCurrency->setLabelArg("[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
buybtn->setLabelArg("[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
mRegionCrossingSlot = gAgent.addRegionChangedCallback(boost::bind(&LLStatusBar::createNavMeshStatusListenerForCurrentRegion, this)); mRegionCrossingSlot = gAgent.addRegionChangedCallback(boost::bind(&LLStatusBar::createNavMeshStatusListenerForCurrentRegion, this));
createNavMeshStatusListenerForCurrentRegion(); createNavMeshStatusListenerForCurrentRegion();
@@ -268,8 +274,8 @@ mIsNavMeshDirty(false)
mSGPacketLoss->mPerSec = FALSE; mSGPacketLoss->mPerSec = FALSE;
addChild(mSGPacketLoss); addChild(mSGPacketLoss);
childSetActionTextbox("stat_btn", onClickStatGraph); mStatBtn = getChild<LLTextBox>("stat_btn");
mStatBtn->setClickedCallback(boost::bind(LLFloaterLagMeter::showInstance, LLSD()));
} }
LLStatusBar::~LLStatusBar() LLStatusBar::~LLStatusBar()
@@ -335,8 +341,9 @@ void LLStatusBar::refresh()
// it's daylight savings time there. // it's daylight savings time there.
internal_time = show_local_time ? std::localtime(&utc_time) : utc_to_pacific_time(utc_time, gPacificDaylightTime); internal_time = show_local_time ? std::localtime(&utc_time) : utc_to_pacific_time(utc_time, gPacificDaylightTime);
static const LLCachedControl<std::string> short_time_fmt(gSavedSettings, "ShortTimeFormat");
std::string t; std::string t;
timeStructToFormattedString(internal_time, gSavedSettings.getString("ShortTimeFormat"), t); timeStructToFormattedString(internal_time, short_time_fmt, t);
if (show_local_time) if (show_local_time)
{ {
static const std::string local(" " + getString("Local")); static const std::string local(" " + getString("Local"));
@@ -352,8 +359,9 @@ void LLStatusBar::refresh()
} }
mTextTime->setText(t); mTextTime->setText(t);
static const LLCachedControl<std::string> long_date_fmt(gSavedSettings, "LongDateFormat");
std::string date; std::string date;
timeStructToFormattedString(internal_time, gSavedSettings.getString("LongDateFormat"), date); timeStructToFormattedString(internal_time, long_date_fmt, date);
mTextTime->setToolTip(date); mTextTime->setToolTip(date);
LLRect r; LLRect r;
@@ -361,8 +369,6 @@ void LLStatusBar::refresh()
S32 x = MENU_RIGHT + MENU_PARCEL_SPACING; S32 x = MENU_RIGHT + MENU_PARCEL_SPACING;
S32 y = 0; S32 y = 0;
bool search_visible = gSavedSettings.getBOOL("ShowSearchBar");
// reshape menu bar to its content's width // reshape menu bar to its content's width
if (MENU_RIGHT != gMenuBarView->getRect().getWidth()) if (MENU_RIGHT != gMenuBarView->getRect().getWidth())
{ {
@@ -372,40 +378,30 @@ void LLStatusBar::refresh()
LLViewerRegion *region = gAgent.getRegion(); LLViewerRegion *region = gAgent.getRegion();
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
LLRect buttonRect;
if (LLHUDIcon::iconsNearby()) if (LLHUDIcon::iconsNearby())
{ {
childGetRect( "scriptout", buttonRect ); const LLRect& buttonRect = mScriptOut->getRect();
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect("scriptout",r); mScriptOut->setRect(r);
childSetVisible("scriptout", true); mScriptOut->setVisible(true);
x += buttonRect.getWidth(); x += buttonRect.getWidth();
} }
else else
{ {
childSetVisible("scriptout", false); mScriptOut->setVisible(false);
} }
if ((region && region->getAllowDamage()) || if ((region && region->getAllowDamage()) ||
(parcel && parcel->getAllowDamage()) ) (parcel && parcel->getAllowDamage()) )
{ {
// set visibility based on flashing // set visibility based on flashing
if( mHealthTimer->hasExpired() ) mHealthV->setVisible(mHealthTimer->hasExpired() || S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1);
{
childSetVisible("health", true);
}
else
{
BOOL flash = S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1;
childSetVisible("health", flash);
}
mTextHealth->setVisible(TRUE); mTextHealth->setVisible(TRUE);
// Health // Health
childGetRect( "health", buttonRect ); const LLRect& buttonRect = mHealthV->getRect();
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect("health", r); mHealthV->setRect(r);
x += buttonRect.getWidth(); x += buttonRect.getWidth();
const S32 health_width = S32( LLFontGL::getFontSansSerifSmall()->getWidth(std::string("100%")) ); const S32 health_width = S32( LLFontGL::getFontSansSerifSmall()->getWidth(std::string("100%")) );
@@ -416,7 +412,7 @@ void LLStatusBar::refresh()
else else
{ {
// invisible if region doesn't allow damage // invisible if region doesn't allow damage
childSetVisible("health", false); mHealthV->setVisible(false);
mTextHealth->setVisible(FALSE); mTextHealth->setVisible(FALSE);
} }
@@ -424,124 +420,112 @@ void LLStatusBar::refresh()
(parcel && !parcel->getAllowFly()) ) (parcel && !parcel->getAllowFly()) )
{ {
// No Fly Zone // No Fly Zone
childGetRect( "no_fly", buttonRect ); mNoFly->setVisible(true);
childSetVisible( "no_fly", true ); const LLRect& buttonRect(mNoFly->getRect());
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect( "no_fly", r ); mNoFly->setRect(r);
x += buttonRect.getWidth(); x += buttonRect.getWidth();
} }
else else
{ {
// Fly Zone // Fly Zone
childSetVisible("no_fly", false); mNoFly->setVisible(false);
} }
BOOL no_build = parcel && !parcel->getAllowModify(); if (parcel && !parcel->getAllowModify())
if (no_build)
{ {
childSetVisible("no_build", TRUE);
childGetRect( "no_build", buttonRect );
// No Build Zone // No Build Zone
mNoBuild->setVisible(true);
const LLRect& buttonRect(mNoBuild->getRect());
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect( "no_build", r ); mNoBuild->setRect(r);
x += buttonRect.getWidth(); x += buttonRect.getWidth();
} }
else else
{ {
childSetVisible("no_build", FALSE); mNoBuild->setVisible(false);
} }
BOOL no_scripts = FALSE; if ((region
if((region
&& (region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS) && (region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS)
|| region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS))) || region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS)))
|| (parcel && !parcel->getAllowOtherScripts())) || (parcel && !parcel->getAllowOtherScripts()))
{
no_scripts = TRUE;
}
if (no_scripts)
{ {
// No scripts // No scripts
childSetVisible("no_scripts", TRUE); mNoScripts->setVisible(true);
childGetRect( "no_scripts", buttonRect ); const LLRect& buttonRect(mNoScripts->getRect());
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect( "no_scripts", r ); mNoScripts->setRect(r);
x += buttonRect.getWidth(); x += buttonRect.getWidth();
} }
else else
{ {
// Yes scripts // Yes scripts
childSetVisible("no_scripts", FALSE); mNoScripts->setVisible(false);
} }
BOOL no_region_push = (region && region->getRestrictPushObject()); if ((region && region->getRestrictPushObject()) || (parcel && parcel->getRestrictPushObject()))
BOOL no_push = no_region_push || (parcel && parcel->getRestrictPushObject());
if (no_push)
{ {
childSetVisible("restrictpush", TRUE); mRestrictPush->setVisible(true);
childGetRect( "restrictpush", buttonRect ); const LLRect& buttonRect(mRestrictPush->getRect());
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect( "restrictpush", r ); mRestrictPush->setRect(r);
x += buttonRect.getWidth(); x += buttonRect.getWidth();
} }
else else
{ {
childSetVisible("restrictpush", FALSE); mRestrictPush->setVisible(false);
} }
BOOL have_voice = parcel && parcel->getParcelFlagAllowVoice(); if (parcel && parcel->getParcelFlagAllowVoice())
if (have_voice)
{ {
childSetVisible("status_no_voice", FALSE); mStatusNoVoice->setVisible(false);
} }
else else
{ {
childSetVisible("status_no_voice", TRUE); mStatusNoVoice->setVisible(true);
childGetRect( "status_no_voice", buttonRect ); const LLRect& buttonRect(mStatusNoVoice->getRect());
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect( "status_no_voice", r ); mStatusNoVoice->setRect(r);
x += buttonRect.getWidth(); x += buttonRect.getWidth();
} }
bool no_see_avs = parcel && !parcel->getSeeAVs(); if (parcel && !parcel->getSeeAVs())
childSetVisible("status_SeeAV", no_see_avs);
if (no_see_avs)
{ {
childGetRect( "status_SeeAV", buttonRect ); mStatusSeeAV->setVisible(true);
const LLRect& buttonRect(mStatusSeeAV->getRect());
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect( "status_SeeAV", r ); mStatusSeeAV->setRect(r);
x += buttonRect.getWidth(); x += buttonRect.getWidth();
} }
else mStatusSeeAV->setVisible(false);
if (region) if (region)
{ {
bool pf_disabled = !region->dynamicPathfindingEnabled(); bool pf_disabled = !region->dynamicPathfindingEnabled();
getChild<LLUICtrl>("pf_dirty")->setVisible(!pf_disabled && mIsNavMeshDirty); mPFDirty->setVisible(!pf_disabled && mIsNavMeshDirty);
getChild<LLUICtrl>("pf_disabled")->setVisible(pf_disabled); mPFDisabled->setVisible(pf_disabled);
const std::string pf_icon = pf_disabled ? "pf_disabled" : mIsNavMeshDirty ? "pf_dirty" : ""; if (LLView* pf_icon = pf_disabled ? mPFDisabled : mIsNavMeshDirty ? mPFDirty : NULL)
if (!pf_icon.empty())
{ {
x += 6; x += 6;
childGetRect(pf_icon, buttonRect); const LLRect& buttonRect(pf_icon->getRect());
r.setOriginAndSize(x, y, buttonRect.getWidth(), buttonRect.getHeight()); r.setOriginAndSize(x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect(pf_icon, r); pf_icon->setRect(r);
x += buttonRect.getWidth(); x += buttonRect.getWidth();
} }
} }
BOOL canBuyLand = parcel if (parcel && !parcel->isPublic() && LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, false))
&& !parcel->isPublic()
&& LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, false);
childSetVisible("buyland", canBuyLand);
if (canBuyLand)
{ {
mBuyLand->setVisible(true);
//HACK: layout tweak until this is all xml //HACK: layout tweak until this is all xml
x += 9; x += 9;
childGetRect( "buyland", buttonRect ); const LLRect& buttonRect(mBuyLand->getRect());
r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
childSetRect( "buyland", r ); mBuyLand->setRect(r);
x += buttonRect.getWidth(); x += buttonRect.getWidth();
} }
else mBuyLand->setVisible(false);
std::string location_name; std::string location_name;
if (region) if (region)
@@ -605,59 +589,56 @@ void LLStatusBar::refresh()
mTextParcelName->setText(location_name); mTextParcelName->setText(location_name);
// x = right edge // x = right edge
// loop through: stat graphs, search btn, search text editor, money, buy money, clock // loop through: stat graphs, search btn, search text editor, money, buy money, clock
// adjust rect // adjust rect
// finally adjust parcel name rect // finally adjust parcel name rect
S32 new_right = getRect().getWidth(); S32 new_right = getRect().getWidth();
static const LLCachedControl<bool> search_visible(gSavedSettings, "ShowSearchBar");
if (search_visible) if (search_visible)
{ {
childGetRect("search_btn", r); new_right -= mSearchBtn->getRect().getWidth();
//r.translate( new_right - r.mRight, 0); new_right -= mSearchEditor->getRect().getWidth() + 6;
//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 else
{ {
childGetRect("stat_btn", r); r = mStatBtn->getRect();
r.translate( new_right - r.mRight, 0); r.translate( new_right - r.mRight, 0);
childSetRect("stat_btn", r); mStatBtn->setRect(r);
new_right -= r.getWidth() + 6; new_right -= r.getWidth() + 6;
} }
// Set search bar visibility
mSearchEditor->setVisible(search_visible);
mSearchBtn->setVisible(search_visible);
mSearchBevel->setVisible(search_visible);
mSGBandwidth->setVisible(! search_visible);
mSGPacketLoss->setVisible(! search_visible);
mStatBtn->setEnabled(!search_visible);
// Set rects of money, buy money, time // Set rects of money, buy money, time
if (mUPCSupported) if (mUPCSupported)
{ {
childGetRect("UPCText", r); r = mTextUPC->getRect();
r.translate( new_right - r.mRight, 0); r.translate( new_right - r.mRight, 0);
childSetRect("UPCText", r); mTextUPC->setRect(r);
new_right -= r.getWidth() - 18; new_right -= r.getWidth() - 18;
} }
childGetRect("BalanceText", r); r = mTextBalance->getRect();
r.translate( new_right - r.mRight, 0); r.translate( new_right - r.mRight, 0);
childSetRect("BalanceText", r); mTextBalance->setRect(r);
new_right -= r.getWidth() - 18; new_right -= r.getWidth() - 18;
childGetRect("buycurrency", r); r = mBuyCurrency->getRect();
r.translate( new_right - r.mRight, 0); r.translate( new_right - r.mRight, 0);
childSetRect("buycurrency", r); mBuyCurrency->setRect(r);
new_right -= r.getWidth() + 6; new_right -= r.getWidth() + 6;
childGetRect("TimeText", r); r = mTextTime->getRect();
// mTextTime->getTextPixelWidth();
r.translate( new_right - r.mRight, 0); r.translate( new_right - r.mRight, 0);
childSetRect("TimeText", r); mTextTime->setRect(r);
// new_right -= r.getWidth() + MENU_PARCEL_SPACING;
// Adjust region name and parcel name // Adjust region name and parcel name
x += 8; x += 8;
@@ -665,14 +646,6 @@ void LLStatusBar::refresh()
const S32 PARCEL_RIGHT = llmin(mTextTime->getRect().mLeft, mTextParcelName->getTextPixelWidth() + x + 5); const S32 PARCEL_RIGHT = llmin(mTextTime->getRect().mLeft, mTextParcelName->getTextPixelWidth() + x + 5);
r.set(x+4, getRect().getHeight() - 2, PARCEL_RIGHT, 0); r.set(x+4, getRect().getHeight() - 2, PARCEL_RIGHT, 0);
mTextParcelName->setRect(r); mTextParcelName->setRect(r);
// Set search bar visibility
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);
} }
void LLStatusBar::setVisibleForMouselook(bool visible) void LLStatusBar::setVisibleForMouselook(bool visible)
@@ -681,9 +654,9 @@ void LLStatusBar::setVisibleForMouselook(bool visible)
if (mUPCSupported) if (mUPCSupported)
mTextUPC->setVisible(visible); mTextUPC->setVisible(visible);
mTextTime->setVisible(visible); mTextTime->setVisible(visible);
childSetVisible("buycurrency", visible); mBuyCurrency->setVisible(visible);
childSetVisible("search_editor", visible); mSearchEditor->setVisible(visible);
childSetVisible("search_btn", visible); mSearchBtn->setVisible(visible);
mSGBandwidth->setVisible(visible); mSGBandwidth->setVisible(visible);
mSGPacketLoss->setVisible(visible); mSGPacketLoss->setVisible(visible);
setBackgroundVisible(visible); setBackgroundVisible(visible);
@@ -810,53 +783,12 @@ S32 LLStatusBar::getSquareMetersLeft() const
return mSquareMetersCredit - mSquareMetersCommitted; return mSquareMetersCredit - mSquareMetersCommitted;
} }
static void onClickParcelInfo(void* data) static void onClickParcelInfo()
{ {
LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal());
LLFloaterLand::showInstance(); LLFloaterLand::showInstance();
} }
static void onClickBalance(void* data)
{
onClickBuyCurrency(data);
}
static void onClickBuyCurrency(void* data)
{
LLFloaterBuyCurrency::buyCurrency();
}
static void onClickHealth(void* )
{
LLNotificationsUtil::add("NotSafe");
}
static void onClickScriptDebug(void*)
{
LLFloaterScriptDebug::show(LLUUID::null);
}
static void onClickFly(void* )
{
LLNotificationsUtil::add("NoFly");
}
static void onClickPush(void* )
{
LLNotificationsUtil::add("PushRestricted");
}
static void onClickVoice(void* )
{
LLNotificationsUtil::add("NoVoice");
}
static void onClickBuild(void*)
{
LLNotificationsUtil::add("NoBuild");
}
static bool rebakeRegionCallback(const LLSD& n, const LLSD& r) static bool rebakeRegionCallback(const LLSD& n, const LLSD& r)
{ {
if(!LLNotificationsUtil::getSelectedOption(n, r)) //0 is Yes if(!LLNotificationsUtil::getSelectedOption(n, r)) //0 is Yes
@@ -867,16 +799,6 @@ static bool rebakeRegionCallback(const LLSD& n, const LLSD& r)
return false; return false;
} }
static void onClickPFDirty(void*)
{
LLNotificationsUtil::add("PathfindingDirty", LLSD(), LLSD(), rebakeRegionCallback);
}
static void onClickPFDisabled(void*)
{
LLNotificationsUtil::add("DynamicPathfindingDisabled");
}
void LLStatusBar::createNavMeshStatusListenerForCurrentRegion() void LLStatusBar::createNavMeshStatusListenerForCurrentRegion()
{ {
if (mNavMeshSlot.connected()) if (mNavMeshSlot.connected())
@@ -898,12 +820,7 @@ void LLStatusBar::onNavMeshStatusChange(const LLPathfindingNavMeshStatus &pNavMe
refresh(); refresh();
} }
static void onClickSeeAV(void*) static void onClickScripts()
{
LLNotificationsUtil::add("SeeAvatars");
}
static void onClickScripts(void*)
{ {
LLViewerRegion* region = gAgent.getRegion(); LLViewerRegion* region = gAgent.getRegion();
if(region && region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS)) if(region && region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS))
@@ -920,11 +837,6 @@ static void onClickScripts(void*)
} }
} }
static void onClickBuyLand(void*)
{
LLViewerParcelMgr::getInstance()->startBuyLand();
}
// sets the static variables necessary for the date // sets the static variables necessary for the date
void LLStatusBar::setupDate() void LLStatusBar::setupDate()
{ {
@@ -988,28 +900,13 @@ void LLStatusBar::setupDate()
} }
} }
// static static void onClickSearch(const std::string& query)
void LLStatusBar::onCommitSearch(LLUICtrl*, void* data)
{ {
// committing is the same as clicking "search"
onClickSearch(data);
}
// static
void LLStatusBar::onClickSearch(void* data)
{
LLStatusBar* self = (LLStatusBar*)data;
LLFloaterSearch::SearchQuery search; LLFloaterSearch::SearchQuery search;
search.query = self->childGetText("search_editor"); search.query = query;
LLFloaterSearch::showInstance(search); LLFloaterSearch::showInstance(search);
} }
// static
void LLStatusBar::onClickStatGraph(void* data)
{
LLFloaterLagMeter::showInstance();
}
BOOL can_afford_transaction(S32 cost) BOOL can_afford_transaction(S32 cost)
{ {
return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost))); return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost)));

View File

@@ -90,10 +90,6 @@ private:
// simple method to setup the part that holds the date // simple method to setup the part that holds the date
void setupDate(); void setupDate();
static void onCommitSearch(LLUICtrl*, void* data);
static void onClickSearch(void* data);
static void onClickStatGraph(void* data);
void onRegionBoundaryCrossed(); void onRegionBoundaryCrossed();
void createNavMeshStatusListenerForCurrentRegion(); void createNavMeshStatusListenerForCurrentRegion();
void onNavMeshStatusChange(const LLPathfindingNavMeshStatus &pNavMeshStatus); void onNavMeshStatusChange(const LLPathfindingNavMeshStatus &pNavMeshStatus);
@@ -111,6 +107,23 @@ private:
LLButton *mBtnBuyCurrency; LLButton *mBtnBuyCurrency;
LLUICtrl* mScriptOut;
LLUICtrl* mHealthV;
LLUICtrl* mNoFly;
LLUICtrl* mBuyLand;
LLUICtrl* mBuyCurrency;
LLUICtrl* mNoBuild;
LLUICtrl* mPFDirty;
LLUICtrl* mPFDisabled;
LLUICtrl* mStatusSeeAV;
LLUICtrl* mNoScripts;
LLUICtrl* mRestrictPush;
LLUICtrl* mStatusNoVoice;
LLUICtrl* mSearchEditor;
LLUICtrl* mSearchBtn;
LLView* mSearchBevel;
LLTextBox* mStatBtn;
S32 mBalance; S32 mBalance;
S32 mUPC; S32 mUPC;
S32 mHealth; S32 mHealth;