diff options
author | Rye Mutt <rye@alchemyviewer.org> | 2024-07-24 19:30:29 -0400 |
---|---|---|
committer | Rye Mutt <rye@alchemyviewer.org> | 2024-07-25 08:45:53 -0400 |
commit | e3deb8340a5f2e5b1c997e66042f3515f33f5cea (patch) | |
tree | b18de8c488089c72d2987fc6e6245390b31d5dca /indra/newview/llpanelland.cpp | |
parent | 70f332d02e687c2c3d4806ccda0e1dcd8bde1232 (diff) |
Fix excessive findChild calls during about land floater draw
Diffstat (limited to 'indra/newview/llpanelland.cpp')
-rw-r--r-- | indra/newview/llpanelland.cpp | 78 |
1 files changed, 41 insertions, 37 deletions
diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp index 3e22374294..07f4a710db 100644 --- a/indra/newview/llpanelland.cpp +++ b/indra/newview/llpanelland.cpp @@ -58,14 +58,26 @@ public: bool LLPanelLandInfo::postBuild() { - childSetAction("button buy land",boost::bind(onClickClaim)); - childSetAction("button abandon land", boost::bind(onClickRelease)); - childSetAction("button subdivide land", boost::bind(onClickDivide)); - childSetAction("button join land", boost::bind(onClickJoin)); - childSetAction("button about land", boost::bind(onClickAbout)); + mButtonBuyLand = getChild<LLButton>("button buy land"); + mButtonBuyLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickClaim, this)); + + mButtonAbandonLand = getChild<LLButton>("button abandon land"); + mButtonAbandonLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickRelease, this)); + + mButtonSubdivLand = getChild<LLButton>("button subdivide land"); + mButtonSubdivLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickDivide, this)); + + mButtonJoinLand = getChild<LLButton>("button join land"); + mButtonJoinLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickJoin, this)); + + mButtonAboutLand = getChild<LLButton>("button about land"); + mButtonAboutLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickAbout, this)); mCheckShowOwners = getChild<LLCheckBoxCtrl>("checkbox show owners"); - getChild<LLUICtrl>("checkbox show owners")->setValue(gSavedSettings.getBOOL("ShowParcelOwners")); + mCheckShowOwners->setValue(gSavedSettings.getBOOL("ShowParcelOwners")); + + mTextArea = getChild<LLTextBox>("label_area"); + mTextAreaPrice = getChild<LLTextBox>("label_area_price"); return true; } @@ -119,17 +131,14 @@ void LLPanelLandInfo::refresh() if (!parcel || !regionp) { // nothing selected, disable panel - getChildView("label_area_price")->setVisible(false); - getChildView("label_area")->setVisible(false); - - //mTextPrice->setText(LLStringUtil::null); - getChild<LLUICtrl>("textbox price")->setValue(LLStringUtil::null); - - getChildView("button buy land")->setEnabled(false); - getChildView("button abandon land")->setEnabled(false); - getChildView("button subdivide land")->setEnabled(false); - getChildView("button join land")->setEnabled(false); - getChildView("button about land")->setEnabled(false); + mTextAreaPrice->setVisible(false); + mTextArea->setVisible(false); + + mButtonBuyLand->setEnabled(false); + mButtonAbandonLand->setEnabled(false); + mButtonSubdivLand->setEnabled(false); + mButtonJoinLand->setEnabled(false); + mButtonAboutLand->setEnabled(false); } else { @@ -147,11 +156,11 @@ void LLPanelLandInfo::refresh() if (is_public && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getMultipleOwners()) { - getChildView("button buy land")->setEnabled(true); + mButtonBuyLand->setEnabled(true); } else { - getChildView("button buy land")->setEnabled(can_buy); + mButtonBuyLand->setEnabled(can_buy); } bool owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE); @@ -163,16 +172,16 @@ void LLPanelLandInfo::refresh() bool manager_divideable = ( gAgent.canManageEstate() && ((parcel->getOwnerID() == regionp->getOwner()) || owner_divide) ); - getChildView("button abandon land")->setEnabled(owner_release || manager_releaseable || gAgent.isGodlike()); + mButtonAbandonLand->setEnabled(owner_release || manager_releaseable || gAgent.isGodlike()); // only mainland sims are subdividable by owner if (regionp->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES)) { - getChildView("button subdivide land")->setEnabled(owner_divide || manager_divideable || gAgent.isGodlike()); + mButtonSubdivLand->setEnabled(owner_divide || manager_divideable || gAgent.isGodlike()); } else { - getChildView("button subdivide land")->setEnabled(manager_divideable || gAgent.isGodlike()); + mButtonSubdivLand->setEnabled(manager_divideable || gAgent.isGodlike()); } // To join land, must have something selected, @@ -183,15 +192,15 @@ void LLPanelLandInfo::refresh() //&& LLViewerParcelMgr::getInstance()->getSelfCount() > 1 && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected()) { - getChildView("button join land")->setEnabled(true); + mButtonJoinLand->setEnabled(true); } else { LL_DEBUGS() << "Invalid selection for joining land" << LL_ENDL; - getChildView("button join land")->setEnabled(false); + mButtonJoinLand->setEnabled(false); } - getChildView("button about land")->setEnabled(true); + mButtonAboutLand->setEnabled(true); // show pricing information S32 area; @@ -206,47 +215,42 @@ void LLPanelLandInfo::refresh() &dwell); if(is_public || (is_for_sale && LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected())) { - getChild<LLUICtrl>("label_area_price")->setTextArg("[PRICE]", llformat("%d",claim_price)); - getChild<LLUICtrl>("label_area_price")->setTextArg("[AREA]", llformat("%d",area)); - getChildView("label_area_price")->setVisible(true); - getChildView("label_area")->setVisible(false); + mTextAreaPrice->setTextArg("[PRICE]", llformat("%d",claim_price)); + mTextAreaPrice->setTextArg("[AREA]", llformat("%d",area)); + mTextAreaPrice->setVisible(true); + mTextArea->setVisible(false); } else { - getChildView("label_area_price")->setVisible(false); - getChild<LLUICtrl>("label_area")->setTextArg("[AREA]", llformat("%d",area)); - getChildView("label_area")->setVisible(true); + mTextAreaPrice->setVisible(false); + mTextArea->setTextArg("[AREA]", llformat("%d",area)); + mTextArea->setVisible(true); } } } -//static void LLPanelLandInfo::onClickClaim() { LLViewerParcelMgr::getInstance()->startBuyLand(); } -//static void LLPanelLandInfo::onClickRelease() { LLViewerParcelMgr::getInstance()->startReleaseLand(); } -// static void LLPanelLandInfo::onClickDivide() { LLViewerParcelMgr::getInstance()->startDivideLand(); } -// static void LLPanelLandInfo::onClickJoin() { LLViewerParcelMgr::getInstance()->startJoinLand(); } -//static void LLPanelLandInfo::onClickAbout() { // Promote the rectangle selection to a parcel selection |