diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-07-25 15:51:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-25 15:51:34 +0300 |
commit | 6e7c6a3842c077b97b3d9fb04c818613efa06f6f (patch) | |
tree | c91d4184295feb92de63946b0f064074da53071e /indra/newview | |
parent | ca70244339291b2a06aab55e865339c534433372 (diff) | |
parent | 7bb62fff08942db95805de454b43d006ca47428b (diff) |
Merge pull request #2099 from RyeMutt/fix-findchild-stutter
Fix various sources of stutter from findChild during draw
Diffstat (limited to 'indra/newview')
24 files changed, 665 insertions, 451 deletions
diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index a0b56b14f0..2eebb6cc64 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -262,6 +262,7 @@ bool LLFloaterIMSessionTab::postBuild() { bool result; + mContentsView = getChild<LLView>("contents_view"); mBodyStack = getChild<LLLayoutStack>("main_stack"); mParticipantListAndHistoryStack = getChild<LLLayoutStack>("im_panels"); @@ -861,7 +862,6 @@ void LLFloaterIMSessionTab::hideOrShowTitle() { const LLFloater::Params& default_params = LLFloater::getDefaultParams(); S32 floater_header_size = default_params.header_height; - LLView* floater_contents = getChild<LLView>("contents_view"); LLRect floater_rect = getLocalRect(); S32 top_border_of_contents = floater_rect.mTop - (isTornOff()? floater_header_size : 0); @@ -869,7 +869,7 @@ void LLFloaterIMSessionTab::hideOrShowTitle() LLRect contents_rect (0, top_border_of_contents, floater_rect.mRight, floater_rect.mBottom); mDragHandle->setShape(handle_rect); mDragHandle->setVisible(isTornOff()); - floater_contents->setShape(contents_rect); + mContentsView->setShape(contents_rect); } void LLFloaterIMSessionTab::updateSessionName(const std::string& name) diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index 0a8502cfc5..29e10184b1 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -164,6 +164,7 @@ protected: LLConversationViewParticipant* createConversationViewParticipant(LLConversationItem* item); LLUUID mSessionID; + LLView* mContentsView; LLLayoutStack* mBodyStack; LLLayoutStack* mParticipantListAndHistoryStack; LLLayoutPanel* mParticipantListPanel; // add the widgets to that see mConversationsListPanel diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 41b6025e0f..bec76fe5e4 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2443,19 +2443,34 @@ LLPanelLandAccess::LLPanelLandAccess(LLParcelSelectionHandle& parcel) bool LLPanelLandAccess::postBuild() { - childSetCommitCallback("public_access", onCommitPublicAccess, this); - childSetCommitCallback("limit_payment", onCommitAny, this); - childSetCommitCallback("limit_age_verified", onCommitAny, this); - childSetCommitCallback("GroupCheck", onCommitGroupCheck, this); - childSetCommitCallback("PassCheck", onCommitAny, this); - childSetCommitCallback("pass_combo", onCommitAny, this); - childSetCommitCallback("PriceSpin", onCommitAny, this); - childSetCommitCallback("HoursSpin", onCommitAny, this); - - childSetAction("add_allowed", boost::bind(&LLPanelLandAccess::onClickAddAccess, this)); - childSetAction("remove_allowed", onClickRemoveAccess, this); - childSetAction("add_banned", boost::bind(&LLPanelLandAccess::onClickAddBanned, this)); - childSetAction("remove_banned", onClickRemoveBanned, this); + mPaymentInfoCheck = getChild<LLUICtrl>("limit_payment"); + mPaymentInfoCheck->setCommitCallback(onCommitAny, this); + mAgeVerifiedCheck = getChild<LLUICtrl>("limit_age_verified"); + mAgeVerifiedCheck->setCommitCallback(onCommitAny, this); + mTemporaryPassCheck = getChild<LLUICtrl>("PassCheck"); + mTemporaryPassCheck->setCommitCallback(onCommitAny, this); + mPublicAccessCheck = getChild<LLUICtrl>("public_access"); + mPublicAccessCheck->setCommitCallback(onCommitPublicAccess, this); + mGroupAccessCheck = getChild<LLUICtrl>("GroupCheck"); + mGroupAccessCheck->setCommitCallback(onCommitGroupCheck, this); + mTemporaryPassCombo = getChild<LLComboBox>("pass_combo"); + mGroupAccessCheck->setCommitCallback(onCommitAny, this); + mTemporaryPassPriceSpin = getChild<LLUICtrl>("PriceSpin"); + mGroupAccessCheck->setCommitCallback(onCommitAny, this); + mTemporaryPassHourSpin = getChild<LLUICtrl>("HoursSpin"); + mGroupAccessCheck->setCommitCallback(onCommitAny, this); + + mAllowText = getChild<LLUICtrl>("AllowedText"); + mBanText = getChild<LLUICtrl>("BanCheck"); + + mBtnAddAllowed = getChild<LLButton>("add_allowed"); + mBtnAddAllowed->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickAddAccess, this)); + mBtnRemoveAllowed = getChild<LLButton>("remove_allowed"); + mBtnRemoveAllowed->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickRemoveAccess, this)); + mBtnAddBanned = getChild<LLButton>("add_banned"); + mBtnAddBanned->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickAddBanned, this)); + mBtnRemoveBanned = getChild<LLButton>("remove_banned"); + mBtnRemoveBanned->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickRemoveBanned, this)); mListAccess = getChild<LLNameListCtrl>("AccessList"); if (mListAccess) @@ -2494,17 +2509,17 @@ void LLPanelLandAccess::refresh() if (parcel->getRegionAllowAccessOverride()) { - getChild<LLUICtrl>("public_access")->setValue(public_access); - getChild<LLUICtrl>("GroupCheck")->setValue(use_group); + mPublicAccessCheck->setValue(public_access); + mGroupAccessCheck->setValue(use_group); } else { - getChild<LLUICtrl>("public_access")->setValue(true); - getChild<LLUICtrl>("GroupCheck")->setValue(false); + mPublicAccessCheck->setValue(true); + mGroupAccessCheck->setValue(false); } std::string group_name; gCacheName->getGroupName(parcel->getGroupID(), group_name); - getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", group_name ); + mGroupAccessCheck->setLabelArg("[GROUP]", group_name ); // Allow list if (mListAccess) @@ -2513,11 +2528,11 @@ void LLPanelLandAccess::refresh() mListAccess->clearSortOrder(); mListAccess->deleteAllItems(); auto count = parcel->mAccessList.size(); - getChild<LLUICtrl>("AllowedText")->setTextArg("[COUNT]", llformat("%d",count)); - getChild<LLUICtrl>("AllowedText")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); + mAllowText->setTextArg("[COUNT]", llformat("%d", count)); + mAllowText->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); - getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); - getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); + mListAccess->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); + mListAccess->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); for (LLAccessEntry::map::const_iterator cit = parcel->mAccessList.begin(); cit != parcel->mAccessList.end(); ++cit) @@ -2561,11 +2576,11 @@ void LLPanelLandAccess::refresh() mListBanned->clearSortOrder(); mListBanned->deleteAllItems(); auto count = parcel->mBanList.size(); - getChild<LLUICtrl>("BanCheck")->setTextArg("[COUNT]", llformat("%d",count)); - getChild<LLUICtrl>("BanCheck")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); + mBanText->setTextArg("[COUNT]", llformat("%d",count)); + mBanText->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); - getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); - getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); + mListBanned->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); + mListBanned->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); for (LLAccessEntry::map::const_iterator cit = parcel->mBanList.begin(); cit != parcel->mBanList.end(); ++cit) @@ -2622,75 +2637,74 @@ void LLPanelLandAccess::refresh() if(parcel->getRegionDenyAnonymousOverride()) { - getChild<LLUICtrl>("limit_payment")->setValue(true); - getChild<LLUICtrl>("limit_payment")->setLabelArg("[ESTATE_PAYMENT_LIMIT]", getString("access_estate_defined") ); + mPaymentInfoCheck->setValue(true); + mPaymentInfoCheck->setLabelArg("[ESTATE_PAYMENT_LIMIT]", getString("access_estate_defined") ); } else { - getChild<LLUICtrl>("limit_payment")->setValue((parcel->getParcelFlag(PF_DENY_ANONYMOUS))); - getChild<LLUICtrl>("limit_payment")->setLabelArg("[ESTATE_PAYMENT_LIMIT]", std::string() ); + mPaymentInfoCheck->setValue((parcel->getParcelFlag(PF_DENY_ANONYMOUS))); + mPaymentInfoCheck->setLabelArg("[ESTATE_PAYMENT_LIMIT]", std::string() ); } if(parcel->getRegionDenyAgeUnverifiedOverride()) { - getChild<LLUICtrl>("limit_age_verified")->setValue(true); - getChild<LLUICtrl>("limit_age_verified")->setLabelArg("[ESTATE_AGE_LIMIT]", getString("access_estate_defined") ); + mAgeVerifiedCheck->setValue(true); + mAgeVerifiedCheck->setLabelArg("[ESTATE_AGE_LIMIT]", getString("access_estate_defined") ); } else { - getChild<LLUICtrl>("limit_age_verified")->setValue((parcel->getParcelFlag(PF_DENY_AGEUNVERIFIED))); - getChild<LLUICtrl>("limit_age_verified")->setLabelArg("[ESTATE_AGE_LIMIT]", std::string() ); + mAgeVerifiedCheck->setValue((parcel->getParcelFlag(PF_DENY_AGEUNVERIFIED))); + mAgeVerifiedCheck->setLabelArg("[ESTATE_AGE_LIMIT]", std::string() ); } bool use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST); - getChild<LLUICtrl>("PassCheck")->setValue(use_pass); - LLCtrlSelectionInterface* passcombo = childGetSelectionInterface("pass_combo"); - if (passcombo) + mTemporaryPassCheck->setValue(use_pass); + if (mTemporaryPassCombo) { if (public_access || !use_pass) { - passcombo->selectByValue("anyone"); + mTemporaryPassCombo->selectByValue("anyone"); } } S32 pass_price = parcel->getPassPrice(); - getChild<LLUICtrl>("PriceSpin")->setValue((F32)pass_price ); + mTemporaryPassPriceSpin->setValue((F32)pass_price); F32 pass_hours = parcel->getPassHours(); - getChild<LLUICtrl>("HoursSpin")->setValue(pass_hours ); + mTemporaryPassHourSpin->setValue(pass_hours); } else { - getChild<LLUICtrl>("public_access")->setValue(false); - getChild<LLUICtrl>("limit_payment")->setValue(false); - getChild<LLUICtrl>("limit_age_verified")->setValue(false); - getChild<LLUICtrl>("GroupCheck")->setValue(false); - getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", LLStringUtil::null ); - getChild<LLUICtrl>("PassCheck")->setValue(false); - getChild<LLUICtrl>("PriceSpin")->setValue((F32)PARCEL_PASS_PRICE_DEFAULT); - getChild<LLUICtrl>("HoursSpin")->setValue(PARCEL_PASS_HOURS_DEFAULT ); - getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); - getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0)); - getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); - getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0)); + mPublicAccessCheck->setValue(false); + mPaymentInfoCheck->setValue(false); + mAgeVerifiedCheck->setValue(false); + mGroupAccessCheck->setValue(false); + mGroupAccessCheck->setLabelArg("[GROUP]", LLStringUtil::null ); + mTemporaryPassCheck->setValue(false); + mTemporaryPassPriceSpin->setValue((F32)PARCEL_PASS_PRICE_DEFAULT); + mTemporaryPassHourSpin->setValue(PARCEL_PASS_HOURS_DEFAULT ); + mListAccess->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); + mListAccess->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0)); + mListBanned->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); + mListBanned->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0)); } } void LLPanelLandAccess::refresh_ui() { - getChildView("public_access")->setEnabled(false); - getChildView("limit_payment")->setEnabled(false); - getChildView("limit_age_verified")->setEnabled(false); - getChildView("GroupCheck")->setEnabled(false); - getChildView("PassCheck")->setEnabled(false); - getChildView("pass_combo")->setEnabled(false); - getChildView("PriceSpin")->setEnabled(false); - getChildView("HoursSpin")->setEnabled(false); - getChildView("AccessList")->setEnabled(false); - getChildView("BannedList")->setEnabled(false); - getChildView("add_allowed")->setEnabled(false); - getChildView("remove_allowed")->setEnabled(false); - getChildView("add_banned")->setEnabled(false); - getChildView("remove_banned")->setEnabled(false); + mPublicAccessCheck->setEnabled(false); + mPaymentInfoCheck->setEnabled(false); + mAgeVerifiedCheck->setEnabled(false); + mGroupAccessCheck->setEnabled(false); + mTemporaryPassCheck->setEnabled(false); + mTemporaryPassCombo->setEnabled(false); + mTemporaryPassPriceSpin->setEnabled(false); + mTemporaryPassHourSpin->setEnabled(false); + mListAccess->setEnabled(false); + mListBanned->setEnabled(false); + mBtnAddAllowed->setEnabled(false); + mBtnRemoveAllowed->setEnabled(false); + mBtnAddBanned->setEnabled(false); + mBtnRemoveBanned->setEnabled(false); LLParcel *parcel = mParcel->getParcel(); if (parcel && !gDisconnected) @@ -2703,73 +2717,64 @@ void LLPanelLandAccess::refresh_ui() can_manage_allowed = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_ALLOWED); } - getChildView("public_access")->setEnabled(can_manage_allowed); - bool public_access = getChild<LLUICtrl>("public_access")->getValue().asBoolean(); + mPublicAccessCheck->setEnabled(can_manage_allowed); + bool public_access = mPublicAccessCheck->getValue().asBoolean(); if (public_access) { bool override = false; if(parcel->getRegionDenyAnonymousOverride()) { override = true; - getChildView("limit_payment")->setEnabled(false); + mPaymentInfoCheck->setEnabled(false); } else { - getChildView("limit_payment")->setEnabled(can_manage_allowed); + mPaymentInfoCheck->setEnabled(can_manage_allowed); } if(parcel->getRegionDenyAgeUnverifiedOverride()) { override = true; - getChildView("limit_age_verified")->setEnabled(false); + mAgeVerifiedCheck->setEnabled(false); } else { - getChildView("limit_age_verified")->setEnabled(can_manage_allowed); + mAgeVerifiedCheck->setEnabled(can_manage_allowed); } - if (override) - { - getChildView("Only Allow")->setToolTip(getString("estate_override")); - } - else - { - getChildView("Only Allow")->setToolTip(std::string()); - } - getChildView("PassCheck")->setEnabled(false); - getChildView("pass_combo")->setEnabled(false); - getChildView("AccessList")->setEnabled(false); + mTemporaryPassCheck->setEnabled(false); + mTemporaryPassCombo->setEnabled(false); + mListAccess->setEnabled(false); } else { - getChildView("limit_payment")->setEnabled(false); - getChildView("limit_age_verified")->setEnabled(false); + mPaymentInfoCheck->setEnabled(false); + mAgeVerifiedCheck->setEnabled(false); - - bool sell_passes = getChild<LLUICtrl>("PassCheck")->getValue().asBoolean(); - getChildView("PassCheck")->setEnabled(can_manage_allowed); + bool sell_passes = mTemporaryPassCheck->getValue().asBoolean(); + mTemporaryPassCheck->setEnabled(can_manage_allowed); if (sell_passes) { - getChildView("pass_combo")->setEnabled(can_manage_allowed); - getChildView("PriceSpin")->setEnabled(can_manage_allowed); - getChildView("HoursSpin")->setEnabled(can_manage_allowed); + mTemporaryPassCombo->setEnabled(can_manage_allowed); + mTemporaryPassPriceSpin->setEnabled(can_manage_allowed); + mTemporaryPassHourSpin->setEnabled(can_manage_allowed); } } std::string group_name; if (gCacheName->getGroupName(parcel->getGroupID(), group_name)) { - bool can_allow_groups = !public_access || (public_access && (getChild<LLUICtrl>("limit_payment")->getValue().asBoolean() ^ getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean())); - getChildView("GroupCheck")->setEnabled(can_manage_allowed && can_allow_groups); + bool can_allow_groups = !public_access || (public_access && (mPaymentInfoCheck->getValue().asBoolean() ^ mAgeVerifiedCheck->getValue().asBoolean())); + mGroupAccessCheck->setEnabled(can_manage_allowed && can_allow_groups); } - getChildView("AccessList")->setEnabled(can_manage_allowed); + mListAccess->setEnabled(can_manage_allowed); auto allowed_list_count = parcel->mAccessList.size(); - getChildView("add_allowed")->setEnabled(can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST); + mBtnAddAllowed->setEnabled(can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST); bool has_selected = (mListAccess && mListAccess->getSelectionInterface()->getFirstSelectedIndex() >= 0); - getChildView("remove_allowed")->setEnabled(can_manage_allowed && has_selected); + mBtnRemoveAllowed->setEnabled(can_manage_allowed && has_selected); - getChildView("BannedList")->setEnabled(can_manage_banned); + mListBanned->setEnabled(can_manage_banned); auto banned_list_count = parcel->mBanList.size(); - getChildView("add_banned")->setEnabled(can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST); + mBtnAddBanned->setEnabled(can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST); has_selected = (mListBanned && mListBanned->getSelectionInterface()->getFirstSelectedIndex() >= 0); - getChildView("remove_banned")->setEnabled(can_manage_banned && has_selected); + mBtnRemoveBanned->setEnabled(can_manage_banned && has_selected); } } @@ -2783,7 +2788,7 @@ void LLPanelLandAccess::refreshNames() { gCacheName->getGroupName(parcel->getGroupID(), group_name); } - getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", group_name); + mGroupAccessCheck->setLabelArg("[GROUP]", group_name); } @@ -2817,9 +2822,9 @@ void LLPanelLandAccess::onCommitGroupCheck(LLUICtrl *ctrl, void *userdata) return; } - bool use_pass_list = !self->getChild<LLUICtrl>("public_access")->getValue().asBoolean(); - bool use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean(); - LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo"); + bool use_pass_list = !self->mPublicAccessCheck->getValue().asBoolean(); + bool use_access_group = self->mGroupAccessCheck->getValue().asBoolean(); + LLCtrlSelectionInterface* passcombo = self->mTemporaryPassCombo; if (passcombo) { if (use_access_group && use_pass_list) @@ -2846,8 +2851,8 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) } // Extract data from UI - bool public_access = self->getChild<LLUICtrl>("public_access")->getValue().asBoolean(); - bool use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean(); + bool public_access = self->mPublicAccessCheck->getValue().asBoolean(); + bool use_access_group = self->mGroupAccessCheck->getValue().asBoolean(); if (use_access_group) { std::string group_name; @@ -2864,14 +2869,14 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) if (public_access) { use_access_list = false; - limit_payment = self->getChild<LLUICtrl>("limit_payment")->getValue().asBoolean(); - limit_age_verified = self->getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean(); + limit_payment = self->mPaymentInfoCheck->getValue().asBoolean(); + limit_age_verified = self->mAgeVerifiedCheck->getValue().asBoolean(); } else { use_access_list = true; - use_pass_list = self->getChild<LLUICtrl>("PassCheck")->getValue().asBoolean(); - LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo"); + use_pass_list = self->mTemporaryPassCheck->getValue().asBoolean(); + LLCtrlSelectionInterface* passcombo = self->mTemporaryPassCombo; if (passcombo) { if (use_access_group && use_pass_list) @@ -2884,8 +2889,8 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) } } - S32 pass_price = llfloor((F32)self->getChild<LLUICtrl>("PriceSpin")->getValue().asReal()); - F32 pass_hours = (F32)self->getChild<LLUICtrl>("HoursSpin")->getValue().asReal(); + S32 pass_price = llfloor((F32)self->mTemporaryPassPriceSpin->getValue().asReal()); + F32 pass_hours = (F32)self->mTemporaryPassHourSpin->getValue().asReal(); // Push data into current parcel parcel->setParcelFlag(PF_USE_ACCESS_GROUP, use_access_group); @@ -2907,10 +2912,9 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) void LLPanelLandAccess::onClickAddAccess() { - LLView * button = findChild<LLButton>("add_allowed"); LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1), false, false, false, root_floater->getName(), button); + boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1), false, false, false, root_floater->getName(), mBtnAddAllowed); if (picker) { root_floater->addDependentFloater(picker); @@ -2938,16 +2942,14 @@ void LLPanelLandAccess::callbackAvatarCBAccess(const uuid_vec_t& ids) } } -// static -void LLPanelLandAccess::onClickRemoveAccess(void* data) +void LLPanelLandAccess::onClickRemoveAccess() { - LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; - if (panelp && panelp->mListAccess) + if (mListAccess) { - LLParcel* parcel = panelp->mParcel->getParcel(); + LLParcel* parcel = mParcel->getParcel(); if (parcel) { - std::vector<LLScrollListItem*> names = panelp->mListAccess->getAllSelected(); + std::vector<LLScrollListItem*> names = mListAccess->getAllSelected(); for (std::vector<LLScrollListItem*>::iterator iter = names.begin(); iter != names.end(); ) { @@ -2956,18 +2958,16 @@ void LLPanelLandAccess::onClickRemoveAccess(void* data) parcel->removeFromAccessList(agent_id); } LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_ACCESS); - panelp->refresh(); + refresh(); } } } -// static void LLPanelLandAccess::onClickAddBanned() { - LLView * button = findChild<LLButton>("add_banned"); LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), true, false, false, root_floater->getName(), button); + boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), true, false, false, root_floater->getName(), mBtnAddBanned); if (picker) { root_floater->addDependentFloater(picker); @@ -3014,16 +3014,14 @@ void LLPanelLandAccess::callbackAvatarCBBanned2(const uuid_vec_t& ids, S32 durat } } -// static -void LLPanelLandAccess::onClickRemoveBanned(void* data) +void LLPanelLandAccess::onClickRemoveBanned() { - LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; - if (panelp && panelp->mListBanned) + if (mListBanned) { - LLParcel* parcel = panelp->mParcel->getParcel(); + LLParcel* parcel = mParcel->getParcel(); if (parcel) { - std::vector<LLScrollListItem*> names = panelp->mListBanned->getAllSelected(); + std::vector<LLScrollListItem*> names = mListBanned->getAllSelected(); for (std::vector<LLScrollListItem*>::iterator iter = names.begin(); iter != names.end(); ) { @@ -3032,7 +3030,7 @@ void LLPanelLandAccess::onClickRemoveBanned(void* data) parcel->removeFromBanList(agent_id); } LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_BAN); - panelp->refresh(); + refresh(); } } } @@ -3331,10 +3329,10 @@ bool LLPanelLandEnvironment::postBuild() if (!LLPanelEnvironmentInfo::postBuild()) return false; - getChild<LLUICtrl>(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION)); - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(false); - getChild<LLUICtrl>(PNL_REGION_MSG)->setVisible(false); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(true); + mBtnUseDefault->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION)); + mCheckAllowOverride->setVisible(false); + mPanelEnvRegionMsg->setVisible(false); + mPanelEnvAltitudes->setVisible(true); return true; } diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index 3560304566..95f6a44a94 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -375,13 +375,13 @@ public: static void onCommitPublicAccess(LLUICtrl* ctrl, void *userdata); static void onCommitAny(LLUICtrl* ctrl, void *userdata); static void onCommitGroupCheck(LLUICtrl* ctrl, void *userdata); - static void onClickRemoveAccess(void*); - static void onClickRemoveBanned(void*); virtual bool postBuild(); void onClickAddAccess(); void onClickAddBanned(); + void onClickRemoveAccess(); + void onClickRemoveBanned(); void callbackAvatarCBBanned(const uuid_vec_t& ids); void callbackAvatarCBBanned2(const uuid_vec_t& ids, S32 duration); void callbackAvatarCBAccess(const uuid_vec_t& ids); @@ -389,6 +389,20 @@ public: protected: LLNameListCtrl* mListAccess; LLNameListCtrl* mListBanned; + LLUICtrl* mAllowText = nullptr; + LLUICtrl* mBanText = nullptr; + LLUICtrl* mPublicAccessCheck = nullptr; + LLUICtrl* mGroupAccessCheck = nullptr; + LLUICtrl* mPaymentInfoCheck = nullptr; + LLUICtrl* mAgeVerifiedCheck = nullptr; + LLUICtrl* mTemporaryPassCheck = nullptr; + LLComboBox* mTemporaryPassCombo = nullptr; + LLUICtrl* mTemporaryPassPriceSpin = nullptr; + LLUICtrl* mTemporaryPassHourSpin = nullptr; + LLButton* mBtnAddAllowed = nullptr; + LLButton* mBtnRemoveAllowed = nullptr; + LLButton* mBtnAddBanned = nullptr; + LLButton* mBtnRemoveBanned = nullptr; LLSafeHandle<LLParcelSelection>& mParcel; }; diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index 3a633a7ff8..d5782accef 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -152,6 +152,13 @@ bool LLFloaterPerformance::postBuild() mStartAutotuneBtn->setCommitCallback(boost::bind(&LLFloaterPerformance::startAutotune, this)); mStopAutotuneBtn->setCommitCallback(boost::bind(&LLFloaterPerformance::stopAutotune, this)); + mCheckTuneContinous = mAutoadjustmentsPanel->getChild<LLCheckBoxCtrl>("AutoTuneContinuous"); + mTextWIPDesc = mAutoadjustmentsPanel->getChild<LLTextBox>("wip_desc"); + mTextDisplayDesc = mAutoadjustmentsPanel->getChild<LLTextBox>("display_desc"); + + mTextFPSLabel = getChild<LLTextBox>("fps_lbl"); + mTextFPSValue = getChild<LLTextBox>("fps_value"); + gSavedPerAccountSettings.declareBOOL("HadEnabledAutoFPS", false, "User had enabled AutoFPS at least once", LLControlVariable::PERSIST_ALWAYS); return true; @@ -512,7 +519,7 @@ void LLFloaterPerformance::setFPSText() { const S32 NUM_PERIODS = 50; S32 current_fps = (S32)llround(LLTrace::get_frame_recording().getPeriodMedianPerSec(LLStatViewer::FPS, NUM_PERIODS)); - getChild<LLTextBox>("fps_value")->setValue(current_fps); + mTextFPSValue->setValue(current_fps); std::string fps_text = getString("fps_text"); static LLCachedControl<bool> vsync_enabled(gSavedSettings, "RenderVSyncEnable", true); @@ -521,7 +528,7 @@ void LLFloaterPerformance::setFPSText() { fps_text += getString("max_text"); } - getChild<LLTextBox>("fps_lbl")->setValue(fps_text); + mTextFPSLabel->setValue(fps_text); } void LLFloaterPerformance::detachItem(const LLUUID& item_id) @@ -722,10 +729,10 @@ void LLFloaterPerformance::updateAutotuneCtrls(bool autotune_enabled) static LLCachedControl<bool> auto_tune_locked(gSavedSettings, "AutoTuneLock"); mStartAutotuneBtn->setEnabled(!autotune_enabled && !auto_tune_locked); mStopAutotuneBtn->setEnabled(autotune_enabled && !auto_tune_locked); - getChild<LLCheckBoxCtrl>("AutoTuneContinuous")->setEnabled(!autotune_enabled || (autotune_enabled && auto_tune_locked)); + mCheckTuneContinous->setEnabled(!autotune_enabled || (autotune_enabled && auto_tune_locked)); - getChild<LLTextBox>("wip_desc")->setVisible(autotune_enabled && !auto_tune_locked); - getChild<LLTextBox>("display_desc")->setVisible(LLPerfStats::tunables.vsyncEnabled); + mTextWIPDesc->setVisible(autotune_enabled && !auto_tune_locked); + mTextDisplayDesc->setVisible(LLPerfStats::tunables.vsyncEnabled); } void LLFloaterPerformance::enableAutotuneWarning() diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h index 089a508455..a7100eb350 100644 --- a/indra/newview/llfloaterperformance.h +++ b/indra/newview/llfloaterperformance.h @@ -30,7 +30,9 @@ #include "lllistcontextmenu.h" class LLCharacter; +class LLCheckBoxCtrl; class LLNameListCtrl; +class LLTextBox; class LLFloaterPerformance : public LLFloater { @@ -90,6 +92,13 @@ private: LLButton* mStartAutotuneBtn; LLButton* mStopAutotuneBtn; + LLTextBox* mTextWIPDesc = nullptr; + LLTextBox* mTextDisplayDesc = nullptr; + LLTextBox* mTextFPSLabel = nullptr; + LLTextBox* mTextFPSValue = nullptr; + + LLCheckBoxCtrl* mCheckTuneContinous = nullptr; + LLListContextMenu* mContextMenu; LLTimer* mUpdateTimer; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 52eddcfc67..cc9aca1338 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -2331,7 +2331,6 @@ void LLPanelEstateInfo::refresh() // Disable access restriction controls if they make no sense. bool public_access = ("estate_public_access" == getChild<LLUICtrl>("externally_visible_radio")->getValue().asString()); - getChildView("Only Allow")->setEnabled(public_access); getChildView("limit_payment")->setEnabled(public_access); getChildView("limit_age_verified")->setEnabled(public_access); getChildView("limit_bots")->setEnabled(public_access); @@ -4201,11 +4200,11 @@ bool LLPanelRegionEnvironment::postBuild() if (!LLPanelEnvironmentInfo::postBuild()) return false; - getChild<LLUICtrl>(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT)); - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(true); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(true); + mBtnUseDefault->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT)); + mCheckAllowOverride->setVisible(true); + mPanelEnvAltitudes->setVisible(true); - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setCommitCallback([this](LLUICtrl *, const LLSD &value){ onChkAllowOverride(value.asBoolean()); }); + mCheckAllowOverride->setCommitCallback([this](LLUICtrl *, const LLSD &value){ onChkAllowOverride(value.asBoolean()); }); mCommitConnect = estate_info.setCommitCallback(boost::bind(&LLPanelRegionEnvironment::refreshFromEstate, this)); return true; @@ -4227,7 +4226,7 @@ void LLPanelRegionEnvironment::refresh() LLPanelEnvironmentInfo::refresh(); - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setValue(mAllowOverride); + mCheckAllowOverride->setValue(mAllowOverride); } bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region) @@ -4293,7 +4292,7 @@ bool LLPanelRegionEnvironment::confirmUpdateEstateEnvironment(const LLSD& notifi case 1: mAllowOverride = mAllowOverrideRestore; - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setValue(mAllowOverride); + mCheckAllowOverride->setValue(mAllowOverride); break; default: break; diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index e03b11e572..ddc567c029 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -192,7 +192,7 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate } } - bool use_freeze_frame = floaterp->getChild<LLUICtrl>("freeze_frame_check")->getValue().asBoolean(); + bool use_freeze_frame = floaterp->mFreezeFrameCheck && floaterp->mFreezeFrameCheck->getValue().asBoolean(); if (use_freeze_frame) { @@ -720,7 +720,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, bool new_width = spanel->getTypedPreviewWidth(); new_height = spanel->getTypedPreviewHeight(); - // Limit custom size for inventory snapshots to 512x512 px. + // Limit custom size for inventory snapshots to 2048x2048 px. if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE) { new_width = llmin(new_width, MAX_TEXTURE_SIZE); @@ -1002,8 +1002,9 @@ bool LLFloaterSnapshot::postBuild() getChild<LLUICtrl>("layer_types")->setValue("colors"); getChildView("layer_types")->setEnabled(false); - getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); - childSetCommitCallback("freeze_frame_check", ImplBase::onCommitFreezeFrame, this); + mFreezeFrameCheck = getChild<LLUICtrl>("freeze_frame_check"); + mFreezeFrameCheck->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); + mFreezeFrameCheck->setCommitCallback(&ImplBase::onCommitFreezeFrame, this); getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot")); childSetCommitCallback("auto_snapshot_check", ImplBase::onClickAutoSnap, this); diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index ac5a472b03..6df851b839 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -72,6 +72,7 @@ protected: LLUICtrl* mThumbnailPlaceholder; LLUICtrl *mRefreshBtn, *mRefreshLabel; LLUICtrl *mSucceessLblPanel, *mFailureLblPanel; + LLUICtrl* mFreezeFrameCheck = nullptr; }; class LLFloaterSnapshotBase::ImplBase diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 2a72a361d6..d459716fc4 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -39,6 +39,8 @@ #include "llbutton.h" #include "llcallingcard.h" #include "llcombobox.h" +#include "llcheckboxctrl.h" +#include "llsliderctrl.h" #include "llviewercontrol.h" #include "llcommandhandler.h" #include "lldraghandle.h" @@ -317,15 +319,36 @@ bool LLFloaterWorldMap::postBuild() mMapView = dynamic_cast<LLWorldMapView*>(getChild<LLPanel>("objects_mapview")); mMapView->setPan(0, 0, true); + mTeleportButton = getChild<LLButton>("Teleport"); + mShowDestinationButton = getChild<LLButton>("Show Destination"); + mCopySlurlButton = getChild<LLButton>("copy_slurl"); + mGoHomeButton = getChild<LLButton>("Go Home"); + + mPeopleCheck = getChild<LLCheckBoxCtrl>("people_chk"); + mInfohubCheck = getChild<LLCheckBoxCtrl>("infohub_chk"); + mTelehubCheck = getChild<LLCheckBoxCtrl>("telehub_chk"); + mLandSaleCheck = getChild<LLCheckBoxCtrl>("land_for_sale_chk"); + mEventsCheck = getChild<LLCheckBoxCtrl>("event_chk"); + mEventsMatureCheck = getChild<LLCheckBoxCtrl>("events_mature_chk"); + mEventsAdultCheck = getChild<LLCheckBoxCtrl>("events_adult_chk"); + + mAvatarIcon = getChild<LLUICtrl>("avatar_icon"); + mLandmarkIcon = getChild<LLUICtrl>("landmark_icon"); + mLocationIcon = getChild<LLUICtrl>("location_icon"); + + mTeleportCoordSpinX = getChild<LLUICtrl>("teleport_coordinate_x"); + mTeleportCoordSpinY = getChild<LLUICtrl>("teleport_coordinate_y"); + mTeleportCoordSpinZ = getChild<LLUICtrl>("teleport_coordinate_z"); + LLComboBox *avatar_combo = getChild<LLComboBox>("friend combo"); avatar_combo->selectFirstItem(); avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange, this) ); avatar_combo->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) ); mListFriendCombo = dynamic_cast<LLCtrlListInterface *>(avatar_combo); - LLSearchEditor *location_editor = getChild<LLSearchEditor>("location"); - location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1)); - location_editor->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this)); + mLocationEditor = getChild<LLSearchEditor>("location"); + mLocationEditor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1)); + mLocationEditor->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this)); getChild<LLScrollListCtrl>("search_results")->setDoubleClickCallback( boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this)); mListSearchResults = childGetListInterface("search_results"); @@ -336,8 +359,9 @@ bool LLFloaterWorldMap::postBuild() landmark_combo->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) ); mListLandmarkCombo = dynamic_cast<LLCtrlListInterface *>(landmark_combo); + mZoomSlider = getChild<LLSliderCtrl>("zoom slider"); F32 slider_zoom = mMapView->getZoom(); - getChild<LLUICtrl>("zoom slider")->setValue(slider_zoom); + mZoomSlider->setValue(slider_zoom); getChild<LLPanel>("expand_btn_panel")->setMouseDownCallback(boost::bind(&LLFloaterWorldMap::onExpandCollapseBtn, this)); @@ -414,7 +438,7 @@ void LLFloaterWorldMap::onOpen(const LLSD& key) const LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); LLInventoryModelBackgroundFetch::instance().start(landmark_folder_id); - getChild<LLUICtrl>("location")->setFocus( true); + mLocationEditor->setFocus( true); gFocusMgr.triggerFocusFlash(); buildAvatarIDList(); @@ -452,9 +476,9 @@ bool LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks) S32 map_y = y - mMapView->getRect().mBottom; if (mMapView->pointInView(map_x, map_y)) { - F32 old_slider_zoom = (F32) getChild<LLUICtrl>("zoom slider")->getValue().asReal(); + F32 old_slider_zoom = (F32) mZoomSlider->getValue().asReal(); F32 slider_zoom = old_slider_zoom + ((F32) clicks * -0.3333f); - getChild<LLUICtrl>("zoom slider")->setValue(LLSD(slider_zoom)); + mZoomSlider->setValue(LLSD(slider_zoom)); mMapView->zoomWithPivot(slider_zoom, map_x, map_y); return true; } @@ -483,32 +507,32 @@ void LLFloaterWorldMap::draw() LLViewerRegion* regionp = gAgent.getRegion(); bool agent_on_prelude = (regionp && regionp->isPrelude()); bool enable_go_home = gAgent.isGodlike() || !agent_on_prelude; - getChildView("Go Home")->setEnabled(enable_go_home); + mGoHomeButton->setEnabled(enable_go_home); updateLocation(); LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); if (LLTracker::TRACKING_AVATAR == tracking_status) { - getChild<LLUICtrl>("avatar_icon")->setColor( map_track_color); + mAvatarIcon->setColor( map_track_color); } else { - getChild<LLUICtrl>("avatar_icon")->setColor( map_track_disabled_color); + mAvatarIcon->setColor( map_track_disabled_color); } if (LLTracker::TRACKING_LANDMARK == tracking_status) { - getChild<LLUICtrl>("landmark_icon")->setColor( map_track_color); + mLandmarkIcon->setColor( map_track_color); } else { - getChild<LLUICtrl>("landmark_icon")->setColor( map_track_disabled_color); + mLandmarkIcon->setColor( map_track_disabled_color); } if (LLTracker::TRACKING_LOCATION == tracking_status) { - getChild<LLUICtrl>("location_icon")->setColor( map_track_color); + mLocationIcon->setColor( map_track_color); } else { @@ -518,11 +542,11 @@ void LLFloaterWorldMap::draw() double value = fmod(seconds, 2); value = 0.5 + 0.5*cos(value * F_PI); LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0); - getChild<LLUICtrl>("location_icon")->setColor( loading_color); + mLocationIcon->setColor( loading_color); } else { - getChild<LLUICtrl>("location_icon")->setColor( map_track_disabled_color); + mLocationIcon->setColor( map_track_disabled_color); } } @@ -532,27 +556,27 @@ void LLFloaterWorldMap::draw() centerOnTarget(true); } - getChildView("Teleport")->setEnabled((bool)tracking_status); + mTeleportButton->setEnabled((bool)tracking_status); // getChildView("Clear")->setEnabled((bool)tracking_status); - getChildView("Show Destination")->setEnabled((bool)tracking_status || LLWorldMap::getInstance()->isTracking()); - getChildView("copy_slurl")->setEnabled((mSLURL.isValid()) ); + mShowDestinationButton->setEnabled((bool)tracking_status || LLWorldMap::getInstance()->isTracking()); + mCopySlurlButton->setEnabled((mSLURL.isValid()) ); setMouseOpaque(true); getDragHandle()->setMouseOpaque(true); - mMapView->zoom((F32)getChild<LLUICtrl>("zoom slider")->getValue().asReal()); + mMapView->zoom((F32)mZoomSlider->getValue().asReal()); // Enable/disable checkboxes depending on the zoom level // If above threshold level (i.e. low res) -> Disable all checkboxes // If under threshold level (i.e. high res) -> Enable all checkboxes bool enable = mMapView->showRegionInfo(); - getChildView("people_chk")->setEnabled(enable); - getChildView("infohub_chk")->setEnabled(enable); - getChildView("telehub_chk")->setEnabled(enable); - getChildView("land_for_sale_chk")->setEnabled(enable); - getChildView("event_chk")->setEnabled(enable); - getChildView("events_mature_chk")->setEnabled(enable); - getChildView("events_adult_chk")->setEnabled(enable); + mPeopleCheck->setEnabled(enable); + mInfohubCheck->setEnabled(enable); + mTelehubCheck->setEnabled(enable); + mLandSaleCheck->setEnabled(enable); + mEventsCheck->setEnabled(enable); + mEventsMatureCheck->setEnabled(enable); + mEventsAdultCheck->setEnabled(enable); LLFloater::draw(); } @@ -576,7 +600,7 @@ void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string& // convenience. if(gAgent.isGodlike()) { - getChild<LLUICtrl>("teleport_coordinate_z")->setValue(LLSD(200.f)); + mTeleportCoordSpinZ->setValue(LLSD(200.f)); } // Don't re-request info if we already have it or we won't have it in time to teleport if (mTrackedStatus != LLTracker::TRACKING_AVATAR || avatar_id != mTrackedAvatarID) @@ -711,9 +735,9 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) // enable/disable teleport destination coordinates void LLFloaterWorldMap::enableTeleportCoordsDisplay( bool enabled ) { - childSetEnabled("teleport_coordinate_x", enabled ); - childSetEnabled("teleport_coordinate_y", enabled ); - childSetEnabled("teleport_coordinate_z", enabled ); + mTeleportCoordSpinX->setEnabled(enabled); + mTeleportCoordSpinY->setEnabled(enabled); + mTeleportCoordSpinZ->setEnabled(enabled); } // update display of teleport destination coordinates - pos is in global coordinates @@ -728,9 +752,9 @@ void LLFloaterWorldMap::updateTeleportCoordsDisplay( const LLVector3d& pos ) F32 region_local_z = (F32)llclamp( pos.mdV[VZ], 0.0, (F64)REGION_HEIGHT_METERS ); // write in the values - childSetValue("teleport_coordinate_x", region_local_x ); - childSetValue("teleport_coordinate_y", region_local_y ); - childSetValue("teleport_coordinate_z", region_local_z ); + mTeleportCoordSpinX->setValue(region_local_x); + mTeleportCoordSpinY->setValue(region_local_y); + mTeleportCoordSpinZ->setValue(region_local_z); } void LLFloaterWorldMap::updateLocation() @@ -757,7 +781,7 @@ void LLFloaterWorldMap::updateLocation() mSetToUserPosition = false; // Fill out the location field - getChild<LLUICtrl>("location")->setValue(agent_sim_name); + mLocationEditor->setValue(agent_sim_name); // update the coordinate display with location of avatar in region updateTeleportCoordsDisplay( agentPos ); @@ -790,7 +814,7 @@ void LLFloaterWorldMap::updateLocation() } } - getChild<LLUICtrl>("location")->setValue(sim_name); + mLocationEditor->setValue(sim_name); // refresh coordinate display to reflect where user clicked. LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal(); @@ -825,17 +849,17 @@ void LLFloaterWorldMap::trackURL(const std::string& region_name, S32 x_coord, S3 else { // fill in UI based on URL - gFloaterWorldMap->getChild<LLUICtrl>("location")->setValue(region_name); + mLocationEditor->setValue(region_name); // Save local coords to highlight position after region global // position is returned. - gFloaterWorldMap->mCompletingRegionPos.set( + mCompletingRegionPos.set( (F32)x_coord, (F32)y_coord, (F32)z_coord); // pass sim name to combo box - gFloaterWorldMap->mCompletingRegionName = region_name; + mCompletingRegionName = region_name; LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name); - LLStringUtil::toLower(gFloaterWorldMap->mCompletingRegionName); + LLStringUtil::toLower(mCompletingRegionName); LLWorldMap::getInstance()->setTrackingCommit(); } } @@ -1067,7 +1091,7 @@ void LLFloaterWorldMap::adjustZoomSliderBounds() F32 min_power = log(pixels_per_region/256.f)/log(2.f); - getChild<LLSliderCtrl>("zoom slider")->setMinValue(min_power); + mZoomSlider->setMinValue(min_power); } @@ -1229,7 +1253,7 @@ void LLFloaterWorldMap::onLocationFocusChanged( LLFocusableElement* focus ) void LLFloaterWorldMap::updateSearchEnabled() { if (childHasKeyboardFocus("location") && - getChild<LLUICtrl>("location")->getValue().asString().length() > 0) + mLocationEditor->getValue().asString().length() > 0) { setDefaultBtn("DoSearch"); } @@ -1250,14 +1274,14 @@ void LLFloaterWorldMap::onLocationCommit() mCompletingRegionName = ""; mLastRegionName = ""; - std::string str = getChild<LLUICtrl>("location")->getValue().asString(); + std::string str = mLocationEditor->getValue().asString(); // Trim any leading and trailing spaces in the search target std::string saved_str = str; LLStringUtil::trim( str ); if ( str != saved_str ) { // Set the value in the UI if any spaces were removed - getChild<LLUICtrl>("location")->setValue(str); + mLocationEditor->setValue(str); } // Don't try completing empty name (STORM-1427). @@ -1287,11 +1311,11 @@ void LLFloaterWorldMap::onCoordinatesCommit() return; } - S32 x_coord = (S32)childGetValue("teleport_coordinate_x").asReal(); - S32 y_coord = (S32)childGetValue("teleport_coordinate_y").asReal(); - S32 z_coord = (S32)childGetValue("teleport_coordinate_z").asReal(); + S32 x_coord = (S32)mTeleportCoordSpinX->getValue().asReal(); + S32 y_coord = (S32)mTeleportCoordSpinY->getValue().asReal(); + S32 z_coord = (S32)mTeleportCoordSpinZ->getValue().asReal(); - const std::string region_name = childGetValue("location").asString(); + const std::string region_name = mLocationEditor->getValue().asString(); trackURL( region_name, x_coord, y_coord, z_coord ); } @@ -1420,7 +1444,7 @@ void LLFloaterWorldMap::teleport() && av_tracker.haveTrackingInfo() ) { pos_global = av_tracker.getGlobalPos(); - pos_global.mdV[VZ] = getChild<LLUICtrl>("teleport_coordinate_z")->getValue(); + pos_global.mdV[VZ] = mTeleportCoordSpinZ->getValue(); } else if ( LLTracker::TRACKING_LANDMARK == tracking_status) { @@ -1654,7 +1678,7 @@ void LLFloaterWorldMap::onCommitSearchResult() pos_global.mdV[VY] += (F64)pos_local.mV[VY]; pos_global.mdV[VZ] = (F64)pos_local.mV[VZ]; - getChild<LLUICtrl>("location")->setValue(sim_name); + mLocationEditor->setValue(sim_name); trackLocation(pos_global); setDefaultBtn("Teleport"); break; diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 6765157e55..269b231e37 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -45,6 +45,11 @@ class LLItemInfo; class LLLineEditor; class LLTabContainer; class LLWorldMapView; +class LLButton; +class LLCheckBoxCtrl; +class LLSliderCtrl; +class LLSpinCtrl; +class LLSearchEditor; class LLFloaterWorldMap : public LLFloater { @@ -142,7 +147,6 @@ protected: void buildLandmarkIDLists(); void flyToLandmark(); void teleportToLandmark(); - void setLandmarkVisited(); void buildAvatarIDList(); void flyToAvatar(); @@ -195,6 +199,30 @@ private: LLCtrlListInterface * mListLandmarkCombo; LLCtrlListInterface * mListSearchResults; + LLButton* mTeleportButton = nullptr; + LLButton* mShowDestinationButton = nullptr; + LLButton* mCopySlurlButton = nullptr; + LLButton* mGoHomeButton = nullptr; + + LLCheckBoxCtrl* mPeopleCheck = nullptr; + LLCheckBoxCtrl* mInfohubCheck = nullptr; + LLCheckBoxCtrl* mTelehubCheck = nullptr; + LLCheckBoxCtrl* mLandSaleCheck = nullptr; + LLCheckBoxCtrl* mEventsCheck = nullptr; + LLCheckBoxCtrl* mEventsMatureCheck = nullptr; + LLCheckBoxCtrl* mEventsAdultCheck = nullptr; + + LLUICtrl* mAvatarIcon = nullptr; + LLUICtrl* mLandmarkIcon = nullptr; + LLUICtrl* mLocationIcon = nullptr; + + LLSearchEditor* mLocationEditor = nullptr; + LLUICtrl* mTeleportCoordSpinX = nullptr; + LLUICtrl* mTeleportCoordSpinY = nullptr; + LLUICtrl* mTeleportCoordSpinZ = nullptr; + + LLSliderCtrl* mZoomSlider = nullptr; + boost::signals2::connection mTeleportFinishConnection; }; diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 0de22fce25..7d55ba3265 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -94,16 +94,21 @@ bool LLPanelBlockedList::postBuild() break; } + mBlockedGearBtn = getChild<LLMenuButton>("blocked_gear_btn"); + // Use the context menu of the Block list for the Block tab gear menu. LLToggleableMenu* blocked_gear_menu = mBlockedList->getContextMenu(); if (blocked_gear_menu) { - getChild<LLMenuButton>("blocked_gear_btn")->setMenu(blocked_gear_menu, LLMenuButton::MP_BOTTOM_LEFT); + mBlockedGearBtn->setMenu(blocked_gear_menu, LLMenuButton::MP_BOTTOM_LEFT); } + mUnblockBtn = getChild<LLButton>("unblock_btn"); + mUnblockBtn->setCommitCallback(boost::bind(&LLPanelBlockedList::unblockItem, this)); - getChild<LLButton>("unblock_btn")->setCommitCallback(boost::bind(&LLPanelBlockedList::unblockItem, this)); getChild<LLFilterEditor>("blocked_filter_input")->setCommitCallback(boost::bind(&LLPanelBlockedList::onFilterEdit, this, _2)); + mBlockLimitText = getChild<LLUICtrl>("block_limit"); + return LLPanel::postBuild(); } @@ -140,11 +145,12 @@ void LLPanelBlockedList::showPanelAndSelect(const LLUUID& idToSelect) void LLPanelBlockedList::updateButtons() { bool hasSelected = NULL != mBlockedList->getSelectedItem(); - getChildView("unblock_btn")->setEnabled(hasSelected); - getChildView("blocked_gear_btn")->setEnabled(hasSelected); + mUnblockBtn->setEnabled(hasSelected); + mBlockedGearBtn->setEnabled(hasSelected); - getChild<LLUICtrl>("block_limit")->setTextArg("[COUNT]", llformat("%d", mBlockedList->getMuteListSize())); - getChild<LLUICtrl>("block_limit")->setTextArg("[LIMIT]", llformat("%d", gSavedSettings.getS32("MuteListLimit"))); + static LLCachedControl<S32> mute_list_limit(gSavedSettings, "MuteListLimit"); + mBlockLimitText->setTextArg("[COUNT]", llformat("%d", mBlockedList->getMuteListSize())); + mBlockLimitText->setTextArg("[LIMIT]", llformat("%d", mute_list_limit())); } void LLPanelBlockedList::unblockItem() diff --git a/indra/newview/llpanelblockedlist.h b/indra/newview/llpanelblockedlist.h index 446f3d4bad..1f470199ce 100644 --- a/indra/newview/llpanelblockedlist.h +++ b/indra/newview/llpanelblockedlist.h @@ -33,6 +33,8 @@ class LLAvatarName; class LLBlockList; +class LLMenuButton; +class LLButton; class LLPanelBlockedList : public LLPanel { @@ -78,7 +80,10 @@ private: static void callbackBlockByName(const std::string& text); private: - LLBlockList* mBlockedList; + LLBlockList* mBlockedList = nullptr; + LLUICtrl* mBlockLimitText = nullptr; + LLMenuButton* mBlockedGearBtn = nullptr; + LLButton* mUnblockBtn = nullptr; LLHandle<LLFloater> mPicker; }; diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index a706e339ea..51e2c05070 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -41,6 +41,7 @@ #include "llfloater.h" #include "llfloaterreg.h" #include "llfloatereditextdaycycle.h" +#include "lliconctrl.h" #include "llmultisliderctrl.h" #include "llnotificationsutil.h" #include "llsettingsvo.h" @@ -109,10 +110,7 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET | LLPanelEnvironmentInfo::DIRTY_FLAG_ALTITUDES); -const U32 ALTITUDE_SLIDER_COUNT = 3; const F32 ALTITUDE_DEFAULT_HEIGHT_STEP = 1000; -const U32 ALTITUDE_MARKERS_COUNT = 3; -const U32 ALTITUDE_PREFIXERS_COUNT = 5; const std::string slider_marker_base = "mark"; @@ -167,24 +165,61 @@ LLPanelEnvironmentInfo::~LLPanelEnvironmentInfo() bool LLPanelEnvironmentInfo::postBuild() { + mIconGround = getChild<LLIconCtrl>(ICN_GROUND); + mIconWater = getChild<LLIconCtrl>(ICN_WATER); - getChild<LLUICtrl>(BTN_USEDEFAULT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnDefault(); }); - getChild<LLUICtrl>(BTN_SELECTINV)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnSelect(); }); - getChild<LLUICtrl>(BTN_EDIT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnEdit(); }); - getChild<LLUICtrl>(BTN_RST_ALTITUDES)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnRstAltitudes(); }); + mPanelEnvAltitudes = getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES); + mPanelEnvConfig = getChild<LLUICtrl>(PNL_SETTINGS); + mPanelEnvButtons = getChild <LLUICtrl>(PNL_BUTTONS); + mPanelEnvDisabled = getChild<LLUICtrl>(PNL_DISABLED); + mPanelEnvRegionMsg = getChild<LLUICtrl>(PNL_REGION_MSG); - getChild<LLUICtrl>(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged((F32)value.asReal()); }); - getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); - getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setSliderEditorCommitCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); - getChild<LLUICtrl>(SLD_DAYOFFSET)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayOffsetChanged((F32)value.asReal()); }); - getChild<LLSliderCtrl>(SLD_DAYOFFSET)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); - getChild<LLSliderCtrl>(SLD_DAYOFFSET)->setSliderEditorCommitCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); + mEnvironmentDisabledText = getChild<LLTextBox>(TXT_DISABLED); + mLabelApparentTime = getChild<LLTextBox>(LBL_TIMEOFDAY); - getChild<LLMultiSliderCtrl>(SLD_ALTITUDES)->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); }); - getChild<LLMultiSliderCtrl>(SLD_ALTITUDES)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onAltSliderMouseUp(); }); + mBtnUseDefault = getChild<LLButton>(BTN_USEDEFAULT); + mBtnUseDefault->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnDefault(); }); + + mBtnSelectInv = getChild<LLButton>(BTN_SELECTINV); + mBtnSelectInv->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnSelect(); }); + + mBtnEdit = getChild<LLButton>(BTN_EDIT); + mBtnEdit->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnEdit(); }); + + mBtnResetAltitudes = getChild<LLButton>(BTN_RST_ALTITUDES); + mBtnResetAltitudes->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnRstAltitudes(); }); + + mCheckAllowOverride = getChild<LLCheckBoxCtrl>(CHK_ALLOWOVERRIDE); + + mSliderDayLength = getChild<LLSliderCtrl>(SLD_DAYLENGTH); + mSliderDayLength->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged((F32)value.asReal()); }); + mSliderDayLength->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); + mSliderDayLength->setSliderEditorCommitCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); + + mSliderDayOffset = getChild<LLSliderCtrl>(SLD_DAYOFFSET); + mSliderDayOffset->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayOffsetChanged((F32)value.asReal()); }); + mSliderDayOffset->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); + mSliderDayOffset->setSliderEditorCommitCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); + + mMultiSliderAltitudes = getChild<LLMultiSliderCtrl>(SLD_ALTITUDES); + mMultiSliderAltitudes->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); }); + mMultiSliderAltitudes->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onAltSliderMouseUp(); }); mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version) { onEnvironmentChanged(env, version); }); + for (U32 idx = 0; idx < ALTITUDE_MARKERS_COUNT; idx++) + { + mAltitudeMarkers[idx] = findChild<LLUICtrl>(slider_marker_base + llformat("%u", idx)); + } + + for (U32 idx = 0; idx < ALTITUDE_PREFIXERS_COUNT; idx++) + { + mAltitudeDropTarget[idx] = findChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[idx]); + mAltitudeLabels[idx] = findChild<LLTextBox>("txt_" + alt_prefixes[idx]); + mAltitudeEditor[idx] = findChild<LLLineEditor>("edt_invname_" + alt_prefixes[idx]); + mAltitudePanels[idx] = findChild<LLView>("pnl_" + alt_prefixes[idx]); + } + for (U32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; idx++) { LLSettingsDropTarget* drop_target = findChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[idx]); @@ -192,11 +227,12 @@ bool LLPanelEnvironmentInfo::postBuild() { drop_target->setPanel(this, alt_sliders[idx]); } + // set initial values to prevent [ALTITUDE] from displaying - updateAltLabel(alt_prefixes[idx], idx + 2, (F32)(idx * 1000)); + updateAltLabel(idx, idx + 2, (F32)(idx * 1000)); } - getChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[3])->setPanel(this, alt_prefixes[3]); - getChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[4])->setPanel(this, alt_prefixes[4]); + mAltitudeDropTarget[3]->setPanel(this, alt_prefixes[3]); + mAltitudeDropTarget[4]->setPanel(this, alt_prefixes[4]); return true; } @@ -262,8 +298,8 @@ void LLPanelEnvironmentInfo::refresh() if (dayoffset.value() > 12.0f) dayoffset -= F32Hours(24.0); - getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setValue(daylength.value()); - getChild<LLSliderCtrl>(SLD_DAYOFFSET)->setValue(dayoffset.value()); + mSliderDayLength->setValue(daylength.value()); + mSliderDayOffset->setValue(dayoffset.value()); udpateApparentTimeOfDay(); @@ -273,59 +309,58 @@ void LLPanelEnvironmentInfo::refresh() if (altitudes.size() > 0) { - LLMultiSliderCtrl *sld = getChild<LLMultiSliderCtrl>(SLD_ALTITUDES); - sld->clear(); + mMultiSliderAltitudes->clear(); for (S32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; ++idx) { // make sure values are in range, server is supposed to validate them, // but issues happen, try to fix values in such case - F32 altitude = llclamp(altitudes[idx + 1], sld->getMinValue(), sld->getMaxValue()); - bool res = sld->addSlider(altitude, alt_sliders[idx]); + F32 altitude = llclamp(altitudes[idx + 1], mMultiSliderAltitudes->getMinValue(), mMultiSliderAltitudes->getMaxValue()); + bool res = mMultiSliderAltitudes->addSlider(altitude, alt_sliders[idx]); if (!res) { LL_WARNS_ONCE("ENVPANEL") << "Failed to validate altitude from server for parcel id" << getParcelId() << LL_ENDL; // Find a spot to insert altitude. // Assuming everything alright with slider, we should find new place in 11 steps top (step 25m, no overlap 100m) - F32 alt_step = (altitude > (sld->getMaxValue() / 2)) ? -sld->getIncrement() : sld->getIncrement(); + F32 alt_step = (altitude > (mMultiSliderAltitudes->getMaxValue() / 2)) ? -mMultiSliderAltitudes->getIncrement() : mMultiSliderAltitudes->getIncrement(); for (U32 i = 0; i < 30; i++) { altitude += alt_step; - if (altitude > sld->getMaxValue()) + if (altitude > mMultiSliderAltitudes->getMaxValue()) { - altitude = sld->getMinValue(); + altitude = mMultiSliderAltitudes->getMinValue(); } - else if (altitude < sld->getMinValue()) + else if (altitude < mMultiSliderAltitudes->getMinValue()) { - altitude = sld->getMaxValue(); + altitude = mMultiSliderAltitudes->getMaxValue(); } - res = sld->addSlider(altitude, alt_sliders[idx]); + res = mMultiSliderAltitudes->addSlider(altitude, alt_sliders[idx]); if (res) break; } } if (res) { // slider has some auto correction that might have kicked in - altitude = sld->getSliderValue(alt_sliders[idx]); + altitude = mMultiSliderAltitudes->getSliderValue(alt_sliders[idx]); } else { // Something is very very wrong LL_WARNS_ONCE("ENVPANEL") << "Failed to set up altitudes for parcel id " << getParcelId() << LL_ENDL; } - updateAltLabel(alt_prefixes[idx], idx + 2, altitude); + updateAltLabel(idx, idx + 2, altitude); mAltitudes[alt_sliders[idx]] = AltitudeData(idx + 2, idx, altitude); } - if (sld->getCurNumSliders() != ALTITUDE_SLIDER_COUNT) + if (mMultiSliderAltitudes->getCurNumSliders() != ALTITUDE_SLIDER_COUNT) { LL_WARNS("ENVPANEL") << "Failed to add altitude sliders!" << LL_ENDL; } readjustAltLabels(); - sld->resetCurSlider(); + mMultiSliderAltitudes->resetCurSlider(); } - updateAltLabel(alt_prefixes[3], 1, 0); // ground - updateAltLabel(alt_prefixes[4], 0, 0); // water + updateAltLabel(3, 1, 0); // ground + updateAltLabel(4, 0, 0); // water } @@ -455,77 +490,75 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) if (mNoEnvironment || (!LLEnvironment::instance().isExtendedEnvironmentEnabled() && !isRegion())) { is_unavailable = true; - getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_LEGACY)); + mEnvironmentDisabledText->setText(getString(STR_LEGACY)); } else if (mNoSelection) { is_unavailable = true; - getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_NO_PARCEL)); + mEnvironmentDisabledText->setText(getString(STR_NO_PARCEL)); } else if (mCrossRegion) { is_unavailable = true; - getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_CROSS_REGION)); + mEnvironmentDisabledText->setText(getString(STR_CROSS_REGION)); } else if (!isRegion() && !mAllowOverride) { is_unavailable = true; - getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_DISALLOWED)); + mEnvironmentDisabledText->setText(getString(STR_DISALLOWED)); } else if (!is_bigenough) { is_unavailable = true; - getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_TOO_SMALL)); + mEnvironmentDisabledText->setText(getString(STR_TOO_SMALL)); } if (is_unavailable) { - getChild<LLUICtrl>(PNL_SETTINGS)->setVisible(false); - getChild<LLUICtrl>(PNL_BUTTONS)->setVisible(false); - getChild<LLUICtrl>(PNL_DISABLED)->setVisible(true); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(false); - getChild<LLUICtrl>(PNL_REGION_MSG)->setVisible(false); + mPanelEnvConfig->setVisible(false); + mPanelEnvButtons->setVisible(false); + mPanelEnvDisabled->setVisible(true); + mPanelEnvAltitudes->setVisible(false); + mPanelEnvRegionMsg->setVisible(false); updateEditFloater(mCurrentEnvironment, false); return false; } - getChild<LLUICtrl>(PNL_SETTINGS)->setVisible(true); - getChild<LLUICtrl>(PNL_BUTTONS)->setVisible(true); - getChild<LLUICtrl>(PNL_DISABLED)->setVisible(false); - getChild<LLUICtrl>(PNL_REGION_MSG)->setVisible(isRegion()); + mPanelEnvConfig->setVisible(true); + mPanelEnvButtons->setVisible(true); + mPanelEnvDisabled->setVisible(false); + mPanelEnvRegionMsg->setVisible(isRegion()); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(LLEnvironment::instance().isExtendedEnvironmentEnabled()); - getChild<LLUICtrl>(BTN_RST_ALTITUDES)->setVisible(isRegion()); + mPanelEnvAltitudes->setVisible(LLEnvironment::instance().isExtendedEnvironmentEnabled()); + mBtnResetAltitudes->setVisible(isRegion()); bool can_enable = enabled && !is_legacy && mCurrentEnvironment && (mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION); - getChild<LLUICtrl>(BTN_SELECTINV)->setEnabled(can_enable); - getChild<LLUICtrl>(BTN_USEDEFAULT)->setEnabled(can_enable); - getChild<LLUICtrl>(BTN_EDIT)->setEnabled(can_enable); - getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(can_enable); - getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(can_enable); - getChild<LLUICtrl>(SLD_ALTITUDES)->setEnabled(can_enable && isRegion()); - getChild<LLUICtrl>(ICN_GROUND)->setColor((can_enable && isRegion()) ? LLColor4::white : LLColor4::grey % 0.8f); - getChild<LLUICtrl>(ICN_WATER)->setColor((can_enable && isRegion()) ? LLColor4::white : LLColor4::grey % 0.8f); - getChild<LLUICtrl>(BTN_RST_ALTITUDES)->setEnabled(can_enable && isRegion()); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable); - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setEnabled(can_enable && isRegion()); + mBtnSelectInv->setEnabled(can_enable); + mBtnUseDefault->setEnabled(can_enable); + mBtnEdit->setEnabled(can_enable); + mSliderDayLength->setEnabled(can_enable); + mSliderDayOffset->setEnabled(can_enable); + mMultiSliderAltitudes->setEnabled(can_enable && isRegion()); + mIconGround->setColor((can_enable && isRegion()) ? LLColor4::white : LLColor4::grey % 0.8f); + mIconWater->setColor((can_enable && isRegion()) ? LLColor4::white : LLColor4::grey % 0.8f); + mBtnResetAltitudes->setEnabled(can_enable && isRegion()); + mPanelEnvAltitudes->setEnabled(can_enable); + mCheckAllowOverride->setEnabled(can_enable && isRegion()); for (U32 idx = 0; idx < ALTITUDE_MARKERS_COUNT; idx++) { - LLUICtrl* marker = findChild<LLUICtrl>(slider_marker_base + llformat("%u", idx)); - if (marker) + if (mAltitudeMarkers[idx]) { static LLColor4 marker_color(0.75f, 0.75f, 0.75f, 1.f); - marker->setColor((can_enable && isRegion()) ? marker_color : marker_color % 0.3f); + mAltitudeMarkers[idx]->setColor((can_enable && isRegion()) ? marker_color : marker_color % 0.3f); } } for (U32 idx = 0; idx < ALTITUDE_PREFIXERS_COUNT; idx++) { - LLSettingsDropTarget* drop_target = findChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[idx]); - if (drop_target) + if (mAltitudeDropTarget[idx]) { - drop_target->setDndEnabled(can_enable); + mAltitudeDropTarget[idx]->setDndEnabled(can_enable); } } @@ -542,24 +575,18 @@ void LLPanelEnvironmentInfo::clearDirtyFlag(U32 flag) mDirtyFlag &= ~flag; } -void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_prefix, U32 sky_index, F32 alt_value) +void LLPanelEnvironmentInfo::updateAltLabel(U32 alt_index, U32 sky_index, F32 alt_value) { - LLMultiSliderCtrl *sld = findChild<LLMultiSliderCtrl>(SLD_ALTITUDES); - if (!sld) - { - LL_WARNS() << "Failed to find slider " << SLD_ALTITUDES << LL_ENDL; - return; - } - LLRect sld_rect = sld->getRect(); + LLRect sld_rect = mMultiSliderAltitudes->getRect(); S32 sld_range = sld_rect.getHeight(); S32 sld_bottom = sld_rect.mBottom; S32 sld_offset = sld_rect.getWidth(); // Roughly identical to thumb's width in slider. S32 pos = (S32)((sld_range - sld_offset) * ((alt_value - 100) / (4000 - 100))); // get related views - LLTextBox* text = findChild<LLTextBox>("txt_" + alt_prefix); - LLLineEditor *field = findChild<LLLineEditor>("edt_invname_" + alt_prefix); - LLView *alt_panel = findChild<LLView>("pnl_" + alt_prefix); + LLTextBox* text = mAltitudeLabels[alt_index]; + LLLineEditor* field = mAltitudeEditor[alt_index]; + LLView* alt_panel = mAltitudePanels[alt_index]; if (text && (sky_index > 1)) { @@ -596,19 +623,16 @@ void LLPanelEnvironmentInfo::readjustAltLabels() // Very simple "adjust after the fact" method // Note: labels can be in any order - LLMultiSliderCtrl *sld = findChild<LLMultiSliderCtrl>(SLD_ALTITUDES); - if (!sld) return; - LLView* view_midle = NULL; U32 midle_ind = 0; S32 shift_up = 0; S32 shift_down = 0; - LLRect sld_rect = sld->getRect(); + LLRect sld_rect = mMultiSliderAltitudes->getRect(); // Find the middle one for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++) { - LLView* cmp_view = findChild<LLView>(alt_panels[i], true); + LLView* cmp_view = mAltitudePanels[i]; if (!cmp_view) return; LLRect cmp_rect = cmp_view->getRect(); S32 pos = 0; @@ -619,7 +643,7 @@ void LLPanelEnvironmentInfo::readjustAltLabels() { if (i != j) { - LLView* intr_view = findChild<LLView>(alt_panels[j], true); + LLView* intr_view = mAltitudePanels[j]; if (!intr_view) return; LLRect intr_rect = intr_view->getRect(); if (cmp_rect.mBottom >= intr_rect.mBottom) @@ -667,7 +691,7 @@ void LLPanelEnvironmentInfo::readjustAltLabels() { if (i != midle_ind) { - LLView* trn_view = findChild<LLView>(alt_panels[i], true); + LLView* trn_view = mAltitudePanels[i]; LLRect trn_rect = trn_view->getRect(); if (trn_rect.mBottom <= midle_rect.mTop && trn_rect.mBottom >= midle_rect.mBottom) @@ -787,7 +811,7 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da } iter->second.mTrackIndex = new_index; - updateAltLabel(alt_prefixes[iter->second.mLabelIndex], iter->second.mTrackIndex, iter->second.mAltitude); + updateAltLabel(iter->second.mLabelIndex, iter->second.mTrackIndex, iter->second.mAltitude); iter++; } @@ -907,10 +931,10 @@ void LLPanelEnvironmentInfo::udpateApparentTimeOfDay() if ((!mCurrentEnvironment) || (mCurrentEnvironment->mDayLength.value() < 1.0) || (mCurrentEnvironment->mDayOffset.value() < 1.0)) { - getChild<LLUICtrl>(LBL_TIMEOFDAY)->setVisible(false); + mLabelApparentTime->setVisible(false); return; } - getChild<LLUICtrl>(LBL_TIMEOFDAY)->setVisible(true); + mLabelApparentTime->setVisible(true); S32Seconds now((S32)LLDate::now().secondsSinceEpoch()); @@ -932,10 +956,10 @@ void LLPanelEnvironmentInfo::udpateApparentTimeOfDay() std::string lblminute(((minutesofhour.value() < 10) ? "0" : "") + LLSD(minutesofhour.value()).asString()); - getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[HH]", LLSD(hourofday.value()).asString()); - getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[MM]", lblminute); - getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[AP]", std::string(am_pm ? "PM" : "AM")); - getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[PRC]", LLSD((S32)(100 * perc)).asString()); + mLabelApparentTime->setTextArg("[HH]", LLSD(hourofday.value()).asString()); + mLabelApparentTime->setTextArg("[MM]", lblminute); + mLabelApparentTime->setTextArg("[AP]", std::string(am_pm ? "PM" : "AM")); + mLabelApparentTime->setTextArg("[PRC]", LLSD((S32)(100 * perc)).asString()); } diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index b478142987..8942e20119 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -39,6 +39,7 @@ #include "llestateinfomodel.h" class LLViewerRegion; +class LLIconCtrl; class LLPanelEnvironmentInfo : public LLPanel { @@ -63,6 +64,10 @@ public: protected: LOG_CLASS(LLPanelEnvironmentInfo); + static constexpr U32 ALTITUDE_SLIDER_COUNT = 3; + static constexpr U32 ALTITUDE_MARKERS_COUNT = 3; + static constexpr U32 ALTITUDE_PREFIXERS_COUNT = 5; + static const std::string BTN_SELECTINV; static const std::string BTN_EDIT; static const std::string BTN_USEDEFAULT; @@ -108,7 +113,7 @@ protected: bool getIsDirty() const { return (mDirtyFlag != 0); } bool getIsDirtyFlag(U32 flag) const { return ((mDirtyFlag & flag) != 0); } U32 getDirtyFlag() const { return mDirtyFlag; } - void updateAltLabel(const std::string &alt_prefix, U32 sky_index, F32 alt_value); + void updateAltLabel(U32 alt_index, U32 sky_index, F32 alt_value); void readjustAltLabels(); void onSldDayLengthChanged(F32 value); @@ -168,6 +173,37 @@ protected: altitudes_data_t mAltitudes; S32 mCurEnvVersion; // used to filter duplicate callbacks/refreshes + LLUICtrl* mPanelEnvAltitudes = nullptr; + LLUICtrl* mPanelEnvConfig = nullptr; + LLUICtrl* mPanelEnvButtons = nullptr; + LLUICtrl* mPanelEnvDisabled = nullptr; + LLUICtrl* mPanelEnvRegionMsg = nullptr; + + LLButton* mBtnSelectInv = nullptr; + LLButton* mBtnEdit = nullptr; + LLButton* mBtnUseDefault = nullptr; + LLButton* mBtnResetAltitudes = nullptr; + + LLMultiSliderCtrl* mMultiSliderAltitudes = nullptr; + + LLSliderCtrl* mSliderDayLength = nullptr; + LLSliderCtrl* mSliderDayOffset = nullptr; + + LLTextBox* mEnvironmentDisabledText = nullptr; + LLTextBox* mLabelApparentTime = nullptr; + + LLCheckBoxCtrl* mCheckAllowOverride = nullptr; + + LLIconCtrl* mIconGround = nullptr; + LLIconCtrl* mIconWater = nullptr; + + std::array<LLUICtrl*, ALTITUDE_MARKERS_COUNT> mAltitudeMarkers; + std::array<LLSettingsDropTarget*, ALTITUDE_PREFIXERS_COUNT> mAltitudeDropTarget; + + std::array<LLTextBox*, ALTITUDE_PREFIXERS_COUNT> mAltitudeLabels; + std::array<LLLineEditor*, ALTITUDE_PREFIXERS_COUNT> mAltitudeEditor; + std::array<LLView*, ALTITUDE_PREFIXERS_COUNT> mAltitudePanels; + protected: typedef boost::signals2::connection connection_t; diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 519f157973..3db0f90df8 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -113,7 +113,7 @@ void LLPanelGroup::onOpen(const LLSD& key) if(!key.has("action")) { setGroupID(group_id); - getChild<LLAccordionCtrl>("groups_accordion")->expandDefaultTab(); + mGroupsAccordion->expandDefaultTab(); return; } @@ -148,24 +148,28 @@ void LLPanelGroup::onOpen(const LLSD& key) bool LLPanelGroup::postBuild() { + mGroupsAccordion = getChild<LLAccordionCtrl>("groups_accordion"); + mDefaultNeedsApplyMesg = getString("default_needs_apply_text"); mWantApplyMesg = getString("want_apply_text"); - LLButton* button; + mButtonApply = getChild<LLButton>("btn_apply"); + mButtonApply->setClickedCallback(onBtnApply, this); + mButtonApply->setVisible(true); + mButtonApply->setEnabled(false); + + mButtonCall = getChild<LLButton>("btn_call"); + mButtonCall->setClickedCallback(onBtnGroupCallClicked, this); - button = getChild<LLButton>("btn_apply"); - button->setClickedCallback(onBtnApply, this); - button->setVisible(true); - button->setEnabled(false); + mButtonChat = getChild<LLButton>("btn_chat"); + mButtonChat->setClickedCallback(onBtnGroupChatClicked, this); - button = getChild<LLButton>("btn_call"); - button->setClickedCallback(onBtnGroupCallClicked, this); + mButtonRefresh = getChild<LLButton>("btn_refresh"); + mButtonRefresh->setClickedCallback(onBtnRefresh, this); - button = getChild<LLButton>("btn_chat"); - button->setClickedCallback(onBtnGroupChatClicked, this); + mButtonCancel = getChild<LLButton>("btn_cancel"); - button = getChild<LLButton>("btn_refresh"); - button->setClickedCallback(onBtnRefresh, this); + mGroupNameCtrl = getChild<LLUICtrl>("group_name"); childSetCommitCallback("back",boost::bind(&LLPanelGroup::onBackBtnClick,this),NULL); @@ -184,7 +188,7 @@ bool LLPanelGroup::postBuild() if(panel_general) { panel_general->setupCtrls(this); - button = panel_general->getChild<LLButton>("btn_join"); + LLButton* button = panel_general->getChild<LLButton>("btn_join"); button->setVisible(false); button->setEnabled(true); @@ -199,9 +203,8 @@ bool LLPanelGroup::postBuild() return true; } -void LLPanelGroup::reposButton(const std::string& name) +void LLPanelGroup::reposButton(LLButton* button) { - LLButton* button = findChild<LLButton>(name); if(!button) return; LLRect btn_rect = button->getRect(); @@ -211,23 +214,20 @@ void LLPanelGroup::reposButton(const std::string& name) void LLPanelGroup::reposButtons() { - LLButton* button_refresh = findChild<LLButton>("btn_refresh"); - LLButton* button_cancel = findChild<LLButton>("btn_cancel"); - - if(button_refresh && button_cancel && button_refresh->getVisible() && button_cancel->getVisible()) + if(mButtonRefresh && mButtonCancel && mButtonRefresh->getVisible() && mButtonCancel->getVisible()) { - LLRect btn_refresh_rect = button_refresh->getRect(); - LLRect btn_cancel_rect = button_cancel->getRect(); + LLRect btn_refresh_rect = mButtonRefresh->getRect(); + LLRect btn_cancel_rect = mButtonCancel->getRect(); btn_refresh_rect.setLeftTopAndSize( btn_cancel_rect.mLeft + btn_cancel_rect.getWidth() + 2, btn_refresh_rect.getHeight() + 2, btn_refresh_rect.getWidth(), btn_refresh_rect.getHeight()); - button_refresh->setRect(btn_refresh_rect); + mButtonRefresh->setRect(btn_refresh_rect); } - reposButton("btn_apply"); - reposButton("btn_refresh"); - reposButton("btn_cancel"); - reposButton("btn_chat"); - reposButton("btn_call"); + reposButton(mButtonApply); + reposButton(mButtonRefresh); + reposButton(mButtonCancel); + reposButton(mButtonChat); + reposButton(mButtonCall); } void LLPanelGroup::reshape(S32 width, S32 height, bool called_from_parent ) @@ -279,9 +279,9 @@ void LLPanelGroup::onBtnJoin() } else { - LL_DEBUGS() << "joining group: " << mID << LL_ENDL; - LLGroupActions::join(mID); -} + LL_DEBUGS() << "joining group: " << mID << LL_ENDL; + LLGroupActions::join(mID); + } } void LLPanelGroup::changed(LLGroupChange gc) @@ -299,7 +299,7 @@ void LLPanelGroup::onChange(EStatusType status, const LLSD& channelInfo, bool pr return; } - childSetEnabled("btn_call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking()); + mButtonCall->setEnabled(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking()); } void LLPanelGroup::notifyObservers() @@ -313,9 +313,8 @@ void LLPanelGroup::update(LLGroupChange gc) if(gdatap) { std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName; - LLUICtrl* group_name_ctrl = getChild<LLUICtrl>("group_name"); - group_name_ctrl->setValue(group_name); - group_name_ctrl->setToolTip(group_name); + mGroupNameCtrl->setValue(group_name); + mGroupNameCtrl->setToolTip(group_name); LLGroupData agent_gdatap; bool is_member = gAgent.getGroupData(mID,agent_gdatap) || gAgent.isGodlikeWithoutAdminMenuFakery(); @@ -367,37 +366,27 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) if(gdatap) { std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName; - LLUICtrl* group_name_ctrl = getChild<LLUICtrl>("group_name"); - group_name_ctrl->setValue(group_name); - group_name_ctrl->setToolTip(group_name); + mGroupNameCtrl->setValue(group_name); + mGroupNameCtrl->setToolTip(group_name); } - LLButton* button_apply = findChild<LLButton>("btn_apply"); - LLButton* button_refresh = findChild<LLButton>("btn_refresh"); - - LLButton* button_cancel = findChild<LLButton>("btn_cancel"); - LLButton* button_call = findChild<LLButton>("btn_call"); - LLButton* button_chat = findChild<LLButton>("btn_chat"); - - bool is_null_group_id = group_id == LLUUID::null; - if(button_apply) - button_apply->setVisible(!is_null_group_id); - if(button_refresh) - button_refresh->setVisible(!is_null_group_id); + if(mButtonApply) + mButtonApply->setVisible(!is_null_group_id); + if(mButtonRefresh) + mButtonRefresh->setVisible(!is_null_group_id); - if(button_cancel) - button_cancel->setVisible(!is_null_group_id); + if(mButtonCancel) + mButtonCancel->setVisible(!is_null_group_id); - if(button_call) - button_call->setVisible(!is_null_group_id); - if(button_chat) - button_chat->setVisible(!is_null_group_id); + if(mButtonCall) + mButtonCall->setVisible(!is_null_group_id); + if(mButtonChat) + mButtonChat->setVisible(!is_null_group_id); getChild<LLUICtrl>("prepend_founded_by")->setVisible(!is_null_group_id); - LLAccordionCtrl* tab_ctrl = getChild<LLAccordionCtrl>("groups_accordion"); - tab_ctrl->reset(); + mGroupsAccordion->reset(); LLAccordionCtrlTab* tab_general = getChild<LLAccordionCtrlTab>("group_general_tab"); LLAccordionCtrlTab* tab_roles = getChild<LLAccordionCtrlTab>("group_roles_tab"); @@ -428,13 +417,13 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) tab_land->setVisible(false); tab_experiences->setVisible(false); - getChild<LLUICtrl>("group_name")->setVisible(false); + mGroupNameCtrl->setVisible(false); getChild<LLUICtrl>("group_name_editor")->setVisible(true); - if(button_call) - button_call->setVisible(false); - if(button_chat) - button_chat->setVisible(false); + if(mButtonCall) + mButtonCall->setVisible(false); + if(mButtonChat) + mButtonChat->setVisible(false); } else { @@ -460,18 +449,18 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) tab_land->setVisible(is_member); tab_experiences->setVisible(is_member); - getChild<LLUICtrl>("group_name")->setVisible(true); + mGroupNameCtrl->setVisible(true); getChild<LLUICtrl>("group_name_editor")->setVisible(false); - if(button_apply) - button_apply->setVisible(is_member); - if(button_call) - button_call->setVisible(is_member); - if(button_chat) - button_chat->setVisible(is_member); + if(mButtonApply) + mButtonApply->setVisible(is_member); + if(mButtonCall) + mButtonCall->setVisible(is_member); + if(mButtonChat) + mButtonChat->setVisible(is_member); } - tab_ctrl->arrange(); + mGroupsAccordion->arrange(); reposButtons(); update(GC_ALL);//show/hide "join" button if data is already ready @@ -539,20 +528,18 @@ void LLPanelGroup::draw() if (mRefreshTimer.hasExpired()) { mRefreshTimer.stop(); - childEnable("btn_refresh"); - childEnable("groups_accordion"); + if(mButtonRefresh) mButtonRefresh->setEnabled(true); + mGroupsAccordion->setEnabled(true); } - LLButton* button_apply = findChild<LLButton>("btn_apply"); - - if(button_apply && button_apply->getVisible()) + if(mButtonApply && mButtonApply->getVisible()) { bool enable = false; std::string mesg; for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it) enable = enable || (*it)->needsApply(mesg); - childSetEnabled("btn_apply", enable); + mButtonApply->setEnabled(enable); } } @@ -568,8 +555,8 @@ void LLPanelGroup::refreshData() setGroupID(getID()); // 5 second timeout - childDisable("btn_refresh"); - childDisable("groups_accordion"); + if(mButtonRefresh) mButtonRefresh->setEnabled(false); + mGroupsAccordion->setEnabled(false); mRefreshTimer.start(); mRefreshTimer.setTimerExpirySec(5); diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index ede8118720..d7dec94c60 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -33,11 +33,12 @@ class LLOfferInfo; -const F32 UPDATE_MEMBERS_SECONDS_PER_FRAME = 0.005; // 5ms +const F32 UPDATE_MEMBERS_SECONDS_PER_FRAME = 0.005f; // 5ms // Forward declares class LLPanelGroupTab; class LLTabContainer; +class LLAccordionCtrl; class LLAgent; @@ -98,7 +99,7 @@ protected: static void onBtnGroupCallClicked(void*); static void onBtnGroupChatClicked(void*); - void reposButton(const std::string& name); + void reposButton(LLButton* button); void reposButtons(); @@ -114,7 +115,15 @@ protected: std::vector<LLPanelGroupTab* > mTabs; - LLButton* mButtonJoin; + LLAccordionCtrl* mGroupsAccordion = nullptr; + + LLUICtrl* mGroupNameCtrl = nullptr; + LLButton* mButtonJoin = nullptr; + LLButton* mButtonApply = nullptr; + LLButton* mButtonCall = nullptr; + LLButton* mButtonChat = nullptr; + LLButton* mButtonRefresh = nullptr; + LLButton* mButtonCancel = nullptr; LLUICtrl* mJoinText; }; 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 diff --git a/indra/newview/llpanelland.h b/indra/newview/llpanelland.h index 7d0c6936bd..aeadee4085 100644 --- a/indra/newview/llpanelland.h +++ b/indra/newview/llpanelland.h @@ -46,20 +46,27 @@ public: void refresh() override; static void refreshAll(); - LLCheckBoxCtrl *mCheckShowOwners; - protected: - static void onClickClaim(); - static void onClickRelease(); - static void onClickDivide(); - static void onClickJoin(); - static void onClickAbout(); + void onClickClaim(); + void onClickRelease(); + void onClickDivide(); + void onClickJoin(); + void onClickAbout(); protected: bool postBuild() override; static LLPanelLandSelectObserver* sObserver; static LLPanelLandInfo* sInstance; +private: + LLCheckBoxCtrl *mCheckShowOwners = nullptr; + LLButton* mButtonBuyLand = nullptr; + LLButton* mButtonAbandonLand = nullptr; + LLButton* mButtonSubdivLand = nullptr; + LLButton* mButtonJoinLand = nullptr; + LLButton* mButtonAboutLand = nullptr; + LLTextBox* mTextArea = nullptr; + LLTextBox* mTextAreaPrice = nullptr; }; #endif diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index 7bef0339c5..135e42437a 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -81,6 +81,11 @@ bool LLProgressView::postBuild() { mProgressBar = getChild<LLProgressBar>("login_progress_bar"); + mLogosLabel = getChild<LLTextBox>("logos_lbl"); + + mProgressText = getChild<LLTextBox>("progress_text"); + mMessageText = getChild<LLTextBox>("message_text"); + // media control that is used to play intro video mMediaCtrl = getChild<LLMediaCtrl>("login_media_panel"); mMediaCtrl->setVisible( false ); // hidden initially @@ -238,9 +243,8 @@ void LLProgressView::drawLogos(F32 alpha) // logos are tied to label, // due to potential resizes we have to figure offsets out on draw or resize - LLTextBox *logos_label = getChild<LLTextBox>("logos_lbl"); S32 offset_x, offset_y; - logos_label->localPointToScreen(0, 0, &offset_x, &offset_y); + mLogosLabel->localPointToScreen(0, 0, &offset_x, &offset_y); std::vector<TextureData>::const_iterator iter = mLogosList.begin(); std::vector<TextureData>::const_iterator end = mLogosList.end(); for (; iter != end; iter++) @@ -325,7 +329,7 @@ void LLProgressView::draw() void LLProgressView::setText(const std::string& text) { - getChild<LLUICtrl>("progress_text")->setValue(text); + mProgressText->setValue(text); } void LLProgressView::setPercent(const F32 percent) @@ -336,7 +340,7 @@ void LLProgressView::setPercent(const F32 percent) void LLProgressView::setMessage(const std::string& msg) { mMessage = msg; - getChild<LLUICtrl>("message_text")->setValue(mMessage); + mMessageText->setValue(mMessage); } void LLProgressView::loadLogo(const std::string &path, @@ -387,8 +391,7 @@ void LLProgressView::initLogos() S32 icon_width, icon_height; // We don't know final screen rect yet, so we can't precalculate position fully - LLTextBox *logos_label = getChild<LLTextBox>("logos_lbl"); - S32 texture_start_x = (S32)logos_label->getFont()->getWidthF32(logos_label->getText()) + default_pad; + S32 texture_start_x = (S32)mLogosLabel->getFont()->getWidthF32(mLogosLabel->getText()) + default_pad; S32 texture_start_y = -7; // Normally we would just preload these textures from textures.xml, diff --git a/indra/newview/llprogressview.h b/indra/newview/llprogressview.h index db3f4a2e32..15b04a8eb9 100644 --- a/indra/newview/llprogressview.h +++ b/indra/newview/llprogressview.h @@ -36,6 +36,7 @@ class LLImageRaw; class LLButton; class LLProgressBar; class LLViewerTexture; +class LLTextBox; class LLProgressView : public LLPanel, @@ -85,6 +86,9 @@ public: protected: LLProgressBar* mProgressBar; LLMediaCtrl* mMediaCtrl; + LLTextBox* mLogosLabel = nullptr; + LLTextBox* mProgressText = nullptr; + LLTextBox* mMessageText = nullptr; F32 mPercentDone; std::string mMessage; LLButton* mCancelBtn; diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index e154777aef..35057a910a 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -558,6 +558,7 @@ bool LLFloaterTexturePicker::postBuild() mResolutionLabel = getChild<LLTextBox>("size_lbl"); mResolutionWarning = getChild<LLTextBox>("over_limit_lbl"); + mPreviewWidget = getChild<LLView>("preview_widget"); mDefaultBtn = getChild<LLButton>("Default"); mNoneBtn = getChild<LLButton>("None"); @@ -653,7 +654,6 @@ void LLFloaterTexturePicker::draw() bool valid_dims = updateImageStats(); // if we're inactive, gray out "apply immediate" checkbox - getChildView("show_folders_check")->setEnabled(mActive && mCanApplyImmediately && !mNoCopyTextureSelected); mSelectBtn->setEnabled(mActive && mCanApply && valid_dims); mPipetteBtn->setEnabled(mActive); mPipetteBtn->setValue(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); @@ -731,7 +731,7 @@ void LLFloaterTexturePicker::draw() } // Border - LLRect border = getChildView("preview_widget")->getRect(); + LLRect border = mPreviewWidget->getRect(); gl_rect_2d( border, LLColor4::black, false ); diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 3c6cff4eaa..df5e763139 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -437,6 +437,7 @@ protected: LLButton* mPipetteBtn; LLButton* mSelectBtn; LLButton* mCancelBtn; + LLView* mPreviewWidget = nullptr; private: bool mCanApply; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 2687938b35..cd0b3dbd0c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -350,7 +350,10 @@ class LLMenuParcelObserver : public LLParcelObserver public: LLMenuParcelObserver(); ~LLMenuParcelObserver(); - virtual void changed(); + void changed() override; +private: + LLHandle<LLUICtrl> mLandBuyHandle; + LLHandle<LLUICtrl> mLandBuyPassHandle; }; static LLMenuParcelObserver* gMenuParcelObserver = NULL; @@ -359,6 +362,8 @@ static LLUIListener sUIListener; LLMenuParcelObserver::LLMenuParcelObserver() { + mLandBuyHandle = gMenuLand->getChild<LLMenuItemCallGL>("Land Buy")->getHandle(); + mLandBuyPassHandle = gMenuLand->getChild<LLMenuItemCallGL>("Land Buy Pass")->getHandle(); LLViewerParcelMgr::getInstance()->addObserver(this); } @@ -372,17 +377,16 @@ void LLMenuParcelObserver::changed() LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); if (gMenuLand && parcel) { - LLView* child = gMenuLand->findChild<LLView>("Land Buy Pass"); - if (child) + if (!mLandBuyPassHandle.isDead()) { - child->setEnabled(LLPanelLandGeneral::enableBuyPass(NULL) && !(parcel->getOwnerID() == gAgent.getID())); + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); + static_cast<LLMenuItemCallGL*>(mLandBuyPassHandle.get())->setEnabled(LLPanelLandGeneral::enableBuyPass(NULL) && !(parcel->getOwnerID() == gAgent.getID())); } - child = gMenuLand->findChild<LLView>("Land Buy"); - if (child) + if (!mLandBuyHandle.isDead()) { bool buyable = enable_buy_land(NULL); - child->setEnabled(buyable); + static_cast<LLMenuItemCallGL*>(mLandBuyHandle.get())->setEnabled(buyable); } } } @@ -402,10 +406,34 @@ void initialize_menus(); // Break up groups of more than 6 items with separators //----------------------------------------------------------------------------- -void set_merchant_SLM_menu() +void set_merchant_SLM_menu(); + +class LLSLMMenuUpdater +{ +public: + LLSLMMenuUpdater(); + ~LLSLMMenuUpdater() = default; + + void setMerchantMenu(); + void checkMerchantStatus(bool force); + +private: + LLHandle<LLView> mMarketplaceListingsItem; +}; + +static LLSLMMenuUpdater* gSLMMenuUpdater = NULL; + +LLSLMMenuUpdater::LLSLMMenuUpdater() +{ + mMarketplaceListingsItem = gMenuHolder->getChild<LLView>("MarketplaceListings")->getHandle(); +} +void LLSLMMenuUpdater::setMerchantMenu() { // All other cases (new merchant, not merchant, migrated merchant): show the new Marketplace Listings menu and enable the tool - gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(true); + if(!mMarketplaceListingsItem.isDead()) + { + mMarketplaceListingsItem.get()->setVisible(true); + } LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings"); gToolBarView->enableCommand(command->id(), true); @@ -422,7 +450,7 @@ void set_merchant_SLM_menu() } } -void check_merchant_status(bool force) +void LLSLMMenuUpdater::checkMerchantStatus(bool force) { if (force) { @@ -430,7 +458,10 @@ void check_merchant_status(bool force) LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED); } // Hide SLM related menu item - gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(false); + if(!mMarketplaceListingsItem.isDead()) + { + mMarketplaceListingsItem.get()->setVisible(false); + } // Also disable the toolbar button for Marketplace Listings LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings"); @@ -440,6 +471,16 @@ void check_merchant_status(bool force) LLMarketplaceData::instance().initializeSLM(boost::bind(&set_merchant_SLM_menu)); } +void set_merchant_SLM_menu() +{ + if(gSLMMenuUpdater) gSLMMenuUpdater->setMerchantMenu(); +} + +void check_merchant_status(bool force) +{ + if(gSLMMenuUpdater) gSLMMenuUpdater->checkMerchantStatus(force); +} + void init_menus() { // Initialize actions @@ -555,6 +596,8 @@ void init_menus() // Let land based option enable when parcel changes gMenuParcelObserver = new LLMenuParcelObserver(); + gSLMMenuUpdater = new LLSLMMenuUpdater(); + gLoginMenuBarView = LLUICtrlFactory::getInstance()->createFromFile<LLMenuBarGL>("menu_login.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); gLoginMenuBarView->arrangeAndClear(); LLRect menuBarRect = gLoginMenuBarView->getRect(); @@ -2752,6 +2795,9 @@ class LLAdminOnSaveState: public view_listener_t //----------------------------------------------------------------------------- void cleanup_menus() { + delete gSLMMenuUpdater; + gSLMMenuUpdater = nullptr; + delete gMenuParcelObserver; gMenuParcelObserver = NULL; @@ -2768,7 +2814,7 @@ void cleanup_menus() gMenuAttachmentSelf = NULL; delete gMenuAttachmentOther; - gMenuAttachmentSelf = NULL; + gMenuAttachmentOther = NULL; delete gMenuLand; gMenuLand = NULL; |