From c5611e692282c98a0dd4af347a1c1e19ef823370 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Tue, 23 Jul 2024 21:37:35 -0400 Subject: Fix up LLWindowShade getChild calls during draw --- indra/llui/llwindowshade.cpp | 46 +++++++++++++++++++++----------------------- indra/llui/llwindowshade.h | 7 +++++++ 2 files changed, 29 insertions(+), 24 deletions(-) (limited to 'indra') diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp index e48bc94b0a..8131a56288 100644 --- a/indra/llui/llwindowshade.cpp +++ b/indra/llui/llwindowshade.cpp @@ -81,8 +81,8 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) panel_p.background_visible = true; panel_p.bg_alpha_image = params.bg_image; panel_p.auto_resize = false; - LLLayoutPanel* notification_panel = LLUICtrlFactory::create(panel_p); - stackp->addChild(notification_panel); + mNotificationsArea = LLUICtrlFactory::create(panel_p); + stackp->addChild(mNotificationsArea); panel_p = LLUICtrlFactory::getDefaultParams(); panel_p.auto_resize = true; @@ -92,15 +92,15 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) panel_p.mouse_opaque = false; panel_p.background_visible = false; panel_p.bg_alpha_color = params.shade_color; - LLLayoutPanel* dummy_panel = LLUICtrlFactory::create(panel_p); - stackp->addChild(dummy_panel); + mBackgroundArea = LLUICtrlFactory::create(panel_p); + stackp->addChild(mBackgroundArea); layout_p = LLUICtrlFactory::getDefaultParams(); layout_p.rect = LLRect(0, 30, 800, 0); layout_p.follows.flags = FOLLOWS_ALL; layout_p.orientation = LLLayoutStack::HORIZONTAL; stackp = LLUICtrlFactory::create(layout_p); - notification_panel->addChild(stackp); + mNotificationsArea->addChild(stackp); panel_p = LLUICtrlFactory::getDefaultParams(); panel_p.rect.height = 30; @@ -121,7 +121,8 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) text_p.name = "notification_text"; text_p.use_ellipses = true; text_p.wrap = true; - panel->addChild(LLUICtrlFactory::create(text_p)); + mNotificationsText = LLUICtrlFactory::create(text_p); + panel->addChild(mNotificationsText); panel_p = LLUICtrlFactory::getDefaultParams(); panel_p.auto_resize = false; @@ -154,11 +155,9 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) void LLWindowShade::draw() { - LLRect message_rect = getChild("notification_text")->getTextBoundingRect(); + LLRect message_rect = mNotificationsText->getTextBoundingRect(); - LLLayoutPanel* notification_area = getChild("notification_area"); - - notification_area->reshape(notification_area->getRect().getWidth(), + mNotificationsArea->reshape(mNotificationsArea->getRect().getWidth(), llclamp(message_rect.getHeight() + 15, llmax(mFormHeight, MIN_NOTIFICATION_AREA_HEIGHT), MAX_NOTIFICATION_AREA_HEIGHT)); @@ -176,21 +175,21 @@ void LLWindowShade::draw() { hide(); } - else if (notification_area->getVisibleAmount() < 0.01f) + else if (mNotificationsArea->getVisibleAmount() < 0.01f) { displayLatestNotification(); } - if (!notification_area->getVisible() && (notification_area->getVisibleAmount() < 0.001f)) + if (!mNotificationsArea->getVisible() && (mNotificationsArea->getVisibleAmount() < 0.001f)) { - getChildRef("background_area").setBackgroundVisible(false); + mBackgroundArea->setBackgroundVisible(false); setMouseOpaque(false); } } void LLWindowShade::hide() { - getChildRef("notification_area").setVisible(false); + mNotificationsArea->setVisible(false); } void LLWindowShade::onCloseNotification() @@ -244,13 +243,12 @@ void LLWindowShade::displayLatestNotification() LLSD payload = notification->getPayload(); LLNotificationFormPtr formp = notification->getForm(); - LLLayoutPanel& notification_area = getChildRef("notification_area"); - notification_area.getChild("notification_icon")->setValue(notification->getIcon()); - notification_area.getChild("notification_text")->setValue(notification->getMessage()); - notification_area.getChild("notification_text")->setToolTip(notification->getMessage()); + mNotificationsArea->getChild("notification_icon")->setValue(notification->getIcon()); + mNotificationsText->setValue(notification->getMessage()); + mNotificationsText->setToolTip(notification->getMessage()); LLNotificationForm::EIgnoreType ignore_type = formp->getIgnoreType(); - LLLayoutPanel& form_elements = notification_area.getChildRef("form_elements"); + LLLayoutPanel& form_elements = mNotificationsArea->getChildRef("form_elements"); form_elements.deleteAllChildren(); form_elements.reshape(form_elements.getRect().getWidth(), MIN_NOTIFICATION_AREA_HEIGHT); @@ -355,25 +353,25 @@ void LLWindowShade::displayLatestNotification() (*it)->translate(0, delta_y); } - getChildRef("notification_area").setVisible(true); - getChildRef("background_area").setBackgroundVisible(mModal); + mNotificationsArea->setVisible(true); + mBackgroundArea->setBackgroundVisible(mModal); setMouseOpaque(mModal); } void LLWindowShade::setBackgroundImage(LLUIImage* image) { - getChild("notification_area")->setTransparentImage(image); + mNotificationsArea->setTransparentImage(image); } void LLWindowShade::setTextColor(LLColor4 color) { - getChild("notification_text")->setColor(color); + mNotificationsText->setColor(color); } bool LLWindowShade::isShown() const { - return getChildRef("notification_area").getVisible(); + return mNotificationsArea->getVisible(); } void LLWindowShade::setCanClose(bool can_close) diff --git a/indra/llui/llwindowshade.h b/indra/llui/llwindowshade.h index a401394d78..da29188943 100644 --- a/indra/llui/llwindowshade.h +++ b/indra/llui/llwindowshade.h @@ -31,6 +31,9 @@ #include "llnotifications.h" #include "lluiimage.h" +class LLLayoutPanel; +class LLTextBox; + class LLWindowShade : public LLUICtrl { public: @@ -68,6 +71,10 @@ private: void onEnterNotificationText(LLUICtrl* ctrl, const std::string& name); void onClickIgnore(LLUICtrl* ctrl); + LLLayoutPanel* mBackgroundArea = nullptr; + LLLayoutPanel* mNotificationsArea = nullptr; + LLTextBox* mNotificationsText = nullptr; + std::vector mNotifications; LLSD mNotificationResponse; bool mModal; -- cgit v1.2.3 From 39a8bba844a6fadf0f528a141c0136a1ae45af42 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Tue, 23 Jul 2024 21:38:06 -0400 Subject: Fix up LLScrollListCtrl getChild during draw --- indra/llui/llscrolllistctrl.cpp | 29 ++++++++++++----------------- indra/llui/llscrolllistctrl.h | 2 +- 2 files changed, 13 insertions(+), 18 deletions(-) (limited to 'indra') diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 8512555b49..10d0ae0678 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -196,7 +196,6 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mHighlightedItem(-1), mBorder(NULL), mSortCallback(NULL), - mCommentTextView(NULL), mNumDynamicWidthColumns(0), mTotalStaticColumnWidth(0), mTotalColumnPadding(0), @@ -288,13 +287,6 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) addColumn(*row_it); } - for (LLInitParam::ParamIterator::const_iterator row_it = p.contents.rows.begin(); - row_it != p.contents.rows.end(); - ++row_it) - { - addRow(*row_it); - } - LLTextBox::Params text_p; text_p.name("comment_text"); text_p.border_visible(false); @@ -302,7 +294,15 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) text_p.follows.flags(FOLLOWS_ALL); // word wrap was added accroding to the EXT-6841 text_p.wrap(true); - addChild(LLUICtrlFactory::create(text_p)); + mCommentText = LLUICtrlFactory::create(text_p); + addChild(mCommentText); + + for (LLInitParam::ParamIterator::const_iterator row_it = p.contents.rows.begin(); + row_it != p.contents.rows.end(); + ++row_it) + { + addRow(*row_it); + } } S32 LLScrollListCtrl::getSearchColumn() @@ -541,12 +541,7 @@ void LLScrollListCtrl::updateLayout() getRect().getWidth() - 2 * mBorderThickness, getRect().getHeight() - (2 * mBorderThickness ) - heading_size ); - if (mCommentTextView == NULL) - { - mCommentTextView = getChildView("comment_text"); - } - - mCommentTextView->setShape(mItemListRect); + mCommentText->setShape(mItemListRect); // how many lines of content in a single "page" S32 page_lines = getLinesPerPage(); @@ -1244,7 +1239,7 @@ void LLScrollListCtrl::deselectAllItems(bool no_commit_on_change) void LLScrollListCtrl::setCommentText(const std::string& comment_text) { - getChild("comment_text")->setValue(comment_text); + mCommentText->setValue(comment_text); } LLScrollListItem* LLScrollListCtrl::addSeparator(EAddPosition pos) @@ -1727,7 +1722,7 @@ void LLScrollListCtrl::draw() updateColumns(); - getChildView("comment_text")->setVisible(mItemList.empty()); + mCommentText->setVisible(mItemList.empty()); drawItems(); diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index f25ba61fd4..1f9f26e08b 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -530,7 +530,7 @@ private: class LLViewBorder* mBorder; LLHandle mPopupMenuHandle; - LLView *mCommentTextView; + LLTextBox* mCommentText = nullptr; LLWString mSearchString; LLFrameTimer mSearchTimer; -- cgit v1.2.3 From 5a3a6c6914b9c7a3b8e9f51075035326329d947d Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Tue, 23 Jul 2024 21:38:43 -0400 Subject: Fix excessive getChild calls from LLScrollBar reshape --- indra/llui/llscrollbar.cpp | 24 ++++++++++++------------ indra/llui/llscrollbar.h | 3 +++ 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index 9c73b1ba3f..d0eec387bd 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -113,7 +113,8 @@ LLScrollbar::LLScrollbar(const Params & p) up_btn.tab_stop(false); up_btn.follows.flags = (mOrientation == VERTICAL ? (FOLLOWS_RIGHT | FOLLOWS_TOP) : (FOLLOWS_LEFT | FOLLOWS_BOTTOM)); - addChild(LLUICtrlFactory::create(up_btn)); + mLineUpBtn = LLUICtrlFactory::create(up_btn); + addChild(mLineUpBtn); LLButton::Params down_btn(mOrientation == VERTICAL ? p.down_button : p.right_button); down_btn.name(std::string("Line Down")); @@ -123,7 +124,8 @@ LLScrollbar::LLScrollbar(const Params & p) down_btn.mouse_held_callback.function(boost::bind(&LLScrollbar::onLineDownBtnPressed, this, _2)); down_btn.tab_stop(false); - addChild(LLUICtrlFactory::create(down_btn)); + mLineDownBtn = LLUICtrlFactory::create(down_btn); + addChild(mLineDownBtn); } @@ -468,22 +470,20 @@ void LLScrollbar::reshape(S32 width, S32 height, bool called_from_parent) { if (width == getRect().getWidth() && height == getRect().getHeight()) return; LLView::reshape( width, height, called_from_parent ); - LLButton* up_button = getChild("Line Up"); - LLButton* down_button = getChild("Line Down"); if (mOrientation == VERTICAL) { - up_button->reshape(up_button->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); - down_button->reshape(down_button->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); - up_button->setOrigin(0, getRect().getHeight() - up_button->getRect().getHeight()); - down_button->setOrigin(0, 0); + mLineUpBtn->reshape(mLineUpBtn->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); + mLineDownBtn->reshape(mLineDownBtn->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); + mLineUpBtn->setOrigin(0, getRect().getHeight() - mLineUpBtn->getRect().getHeight()); + mLineDownBtn->setOrigin(0, 0); } else { - up_button->reshape(llmin(getRect().getWidth() / 2, mThickness), up_button->getRect().getHeight()); - down_button->reshape(llmin(getRect().getWidth() / 2, mThickness), down_button->getRect().getHeight()); - up_button->setOrigin(0, 0); - down_button->setOrigin(getRect().getWidth() - down_button->getRect().getWidth(), 0); + mLineUpBtn->reshape(llmin(getRect().getWidth() / 2, mThickness), mLineUpBtn->getRect().getHeight()); + mLineDownBtn->reshape(llmin(getRect().getWidth() / 2, mThickness), mLineDownBtn->getRect().getHeight()); + mLineUpBtn->setOrigin(0, 0); + mLineDownBtn->setOrigin(getRect().getWidth() - mLineDownBtn->getRect().getWidth(), 0); } updateThumbRect(); } diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h index 7b935aa51b..9607355a9d 100644 --- a/indra/llui/llscrollbar.h +++ b/indra/llui/llscrollbar.h @@ -161,6 +161,9 @@ private: LLUIImagePtr mTrackImageH; S32 mThickness; + + LLButton* mLineUpBtn = nullptr; + LLButton* mLineDownBtn = nullptr; }; -- cgit v1.2.3 From 316d815e7b97091a6ae34d48fc7672c59d613713 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Tue, 23 Jul 2024 21:39:30 -0400 Subject: Fix getChild calls during draw in LLProgressView --- indra/newview/llprogressview.cpp | 15 +++++++++------ indra/newview/llprogressview.h | 4 ++++ 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'indra') 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("login_progress_bar"); + mLogosLabel = getChild("logos_lbl"); + + mProgressText = getChild("progress_text"); + mMessageText = getChild("message_text"); + // media control that is used to play intro video mMediaCtrl = getChild("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("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::const_iterator iter = mLogosList.begin(); std::vector::const_iterator end = mLogosList.end(); for (; iter != end; iter++) @@ -325,7 +329,7 @@ void LLProgressView::draw() void LLProgressView::setText(const std::string& text) { - getChild("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("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("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; -- cgit v1.2.3 From 29c8fb0a76b4271471c5cbdf356d5256cb37e3ea Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Tue, 23 Jul 2024 21:41:27 -0400 Subject: Fix excessive getChild calls during teleport from LLPanelGroup --- indra/newview/llpanelgroup.cpp | 127 ++++++++++++++++++----------------------- indra/newview/llpanelgroup.h | 14 ++++- 2 files changed, 68 insertions(+), 73 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 519f157973..598df0135e 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("groups_accordion")->expandDefaultTab(); + mGroupsAccordion->expandDefaultTab(); return; } @@ -148,24 +148,26 @@ void LLPanelGroup::onOpen(const LLSD& key) bool LLPanelGroup::postBuild() { + mGroupsAccordion = getChild("groups_accordion"); + mDefaultNeedsApplyMesg = getString("default_needs_apply_text"); mWantApplyMesg = getString("want_apply_text"); - LLButton* button; + mButtonApply = getChild("btn_apply"); + mButtonApply->setClickedCallback(onBtnApply, this); + mButtonApply->setVisible(true); + mButtonApply->setEnabled(false); - button = getChild("btn_apply"); - button->setClickedCallback(onBtnApply, this); - button->setVisible(true); - button->setEnabled(false); + mButtonCall = getChild("btn_call"); + mButtonCall->setClickedCallback(onBtnGroupCallClicked, this); - button = getChild("btn_call"); - button->setClickedCallback(onBtnGroupCallClicked, this); + mButtonChat = getChild("btn_chat"); + mButtonChat->setClickedCallback(onBtnGroupChatClicked, this); - button = getChild("btn_chat"); - button->setClickedCallback(onBtnGroupChatClicked, this); + mButtonRefresh = getChild("btn_refresh"); + mButtonRefresh->setClickedCallback(onBtnRefresh, this); - button = getChild("btn_refresh"); - button->setClickedCallback(onBtnRefresh, this); + mButtonCancel = getChild("btn_cancel"); childSetCommitCallback("back",boost::bind(&LLPanelGroup::onBackBtnClick,this),NULL); @@ -184,7 +186,7 @@ bool LLPanelGroup::postBuild() if(panel_general) { panel_general->setupCtrls(this); - button = panel_general->getChild("btn_join"); + LLButton* button = panel_general->getChild("btn_join"); button->setVisible(false); button->setEnabled(true); @@ -199,9 +201,8 @@ bool LLPanelGroup::postBuild() return true; } -void LLPanelGroup::reposButton(const std::string& name) +void LLPanelGroup::reposButton(LLButton* button) { - LLButton* button = findChild(name); if(!button) return; LLRect btn_rect = button->getRect(); @@ -211,23 +212,20 @@ void LLPanelGroup::reposButton(const std::string& name) void LLPanelGroup::reposButtons() { - LLButton* button_refresh = findChild("btn_refresh"); - LLButton* button_cancel = findChild("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 +277,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 +297,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() @@ -372,32 +370,23 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) group_name_ctrl->setToolTip(group_name); } - LLButton* button_apply = findChild("btn_apply"); - LLButton* button_refresh = findChild("btn_refresh"); - - LLButton* button_cancel = findChild("btn_cancel"); - LLButton* button_call = findChild("btn_call"); - LLButton* button_chat = findChild("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("prepend_founded_by")->setVisible(!is_null_group_id); - LLAccordionCtrl* tab_ctrl = getChild("groups_accordion"); - tab_ctrl->reset(); + mGroupsAccordion->reset(); LLAccordionCtrlTab* tab_general = getChild("group_general_tab"); LLAccordionCtrlTab* tab_roles = getChild("group_roles_tab"); @@ -431,10 +420,10 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) getChild("group_name")->setVisible(false); getChild("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 { @@ -463,15 +452,15 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) getChild("group_name")->setVisible(true); getChild("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("btn_apply"); - - if(button_apply && button_apply->getVisible()) + if(mButtonApply && mButtonApply->getVisible()) { bool enable = false; std::string mesg; for(std::vector::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..1dbc8c32ff 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,14 @@ protected: std::vector mTabs; - LLButton* mButtonJoin; + LLAccordionCtrl* mGroupsAccordion = nullptr; + + LLButton* mButtonJoin = nullptr; + LLButton* mButtonApply = nullptr; + LLButton* mButtonCall = nullptr; + LLButton* mButtonChat = nullptr; + LLButton* mButtonRefresh = nullptr; + LLButton* mButtonCancel = nullptr; LLUICtrl* mJoinText; }; -- cgit v1.2.3 From 7dd3f5db0b7da458a49df8ae2f40138a83021dec Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Tue, 23 Jul 2024 21:41:58 -0400 Subject: Fix getChild calls during draw in LLFloaterWorldMap --- indra/newview/llfloaterworldmap.cpp | 122 +++++++++++++++++++++--------------- indra/newview/llfloaterworldmap.h | 30 ++++++++- 2 files changed, 102 insertions(+), 50 deletions(-) (limited to 'indra') 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(getChild("objects_mapview")); mMapView->setPan(0, 0, true); + mTeleportButton = getChild("Teleport"); + mShowDestinationButton = getChild("Show Destination"); + mCopySlurlButton = getChild("copy_slurl"); + mGoHomeButton = getChild("Go Home"); + + mPeopleCheck = getChild("people_chk"); + mInfohubCheck = getChild("infohub_chk"); + mTelehubCheck = getChild("telehub_chk"); + mLandSaleCheck = getChild("land_for_sale_chk"); + mEventsCheck = getChild("event_chk"); + mEventsMatureCheck = getChild("events_mature_chk"); + mEventsAdultCheck = getChild("events_adult_chk"); + + mAvatarIcon = getChild("avatar_icon"); + mLandmarkIcon = getChild("landmark_icon"); + mLocationIcon = getChild("location_icon"); + + mTeleportCoordSpinX = getChild("teleport_coordinate_x"); + mTeleportCoordSpinY = getChild("teleport_coordinate_y"); + mTeleportCoordSpinZ = getChild("teleport_coordinate_z"); + LLComboBox *avatar_combo = getChild("friend combo"); avatar_combo->selectFirstItem(); avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange, this) ); avatar_combo->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) ); mListFriendCombo = dynamic_cast(avatar_combo); - LLSearchEditor *location_editor = getChild("location"); - location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1)); - location_editor->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this)); + mLocationEditor = getChild("location"); + mLocationEditor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1)); + mLocationEditor->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this)); getChild("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(landmark_combo); + mZoomSlider = getChild("zoom slider"); F32 slider_zoom = mMapView->getZoom(); - getChild("zoom slider")->setValue(slider_zoom); + mZoomSlider->setValue(slider_zoom); getChild("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("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("zoom slider")->getValue().asReal(); + F32 old_slider_zoom = (F32) mZoomSlider->getValue().asReal(); F32 slider_zoom = old_slider_zoom + ((F32) clicks * -0.3333f); - getChild("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("avatar_icon")->setColor( map_track_color); + mAvatarIcon->setColor( map_track_color); } else { - getChild("avatar_icon")->setColor( map_track_disabled_color); + mAvatarIcon->setColor( map_track_disabled_color); } if (LLTracker::TRACKING_LANDMARK == tracking_status) { - getChild("landmark_icon")->setColor( map_track_color); + mLandmarkIcon->setColor( map_track_color); } else { - getChild("landmark_icon")->setColor( map_track_disabled_color); + mLandmarkIcon->setColor( map_track_disabled_color); } if (LLTracker::TRACKING_LOCATION == tracking_status) { - getChild("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("location_icon")->setColor( loading_color); + mLocationIcon->setColor( loading_color); } else { - getChild("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("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("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("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("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("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("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("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("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("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("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("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; }; -- cgit v1.2.3 From 2d595bd00cde3c0501ce44b6ab2b11d53347828d Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Tue, 23 Jul 2024 21:42:20 -0400 Subject: Fix findChild calls during draw from LLFloaterSnapshot --- indra/newview/llfloatersnapshot.cpp | 9 +++++---- indra/newview/llfloatersnapshot.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'indra') 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("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("layer_types")->setValue("colors"); getChildView("layer_types")->setEnabled(false); - getChild("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); - childSetCommitCallback("freeze_frame_check", ImplBase::onCommitFreezeFrame, this); + mFreezeFrameCheck = getChild("freeze_frame_check"); + mFreezeFrameCheck->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); + mFreezeFrameCheck->setCommitCallback(&ImplBase::onCommitFreezeFrame, this); getChild("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 -- cgit v1.2.3 From b5491416a0d26261b90fd37edf462fe9b9e0ab36 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Tue, 23 Jul 2024 21:43:09 -0400 Subject: Fix getChild calls during draw from LLFloaterIMSessionTab --- indra/newview/llfloaterimsessiontab.cpp | 4 ++-- indra/newview/llfloaterimsessiontab.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'indra') 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("contents_view"); mBodyStack = getChild("main_stack"); mParticipantListAndHistoryStack = getChild("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("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 -- cgit v1.2.3 From 11448d490faeb0bb979f6296b97252548a9415a6 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Wed, 24 Jul 2024 11:52:47 -0400 Subject: Fix findChild stutter during teleports --- indra/newview/llviewermenu.cpp | 75 +++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 16 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 2687938b35..4fcfe1a120 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 mLandBuyHandle; + LLHandle mLandBuyPassHandle; }; static LLMenuParcelObserver* gMenuParcelObserver = NULL; @@ -359,6 +362,8 @@ static LLUIListener sUIListener; LLMenuParcelObserver::LLMenuParcelObserver() { + mLandBuyHandle = gMenuLand->getChild("Land Buy")->getHandle(); + mLandBuyPassHandle = gMenuLand->getChild("Land Buy Pass")->getHandle(); LLViewerParcelMgr::getInstance()->addObserver(this); } @@ -372,18 +377,17 @@ void LLMenuParcelObserver::changed() LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); if (gMenuLand && parcel) { - LLView* child = gMenuLand->findChild("Land Buy Pass"); - if (child) - { - child->setEnabled(LLPanelLandGeneral::enableBuyPass(NULL) && !(parcel->getOwnerID() == gAgent.getID())); - } + if (!mLandBuyPassHandle.isDead()) + { + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); + static_cast(mLandBuyPassHandle.get())->setEnabled(LLPanelLandGeneral::enableBuyPass(NULL) && !(parcel->getOwnerID() == gAgent.getID())); + } - child = gMenuLand->findChild("Land Buy"); - if (child) - { - bool buyable = enable_buy_land(NULL); - child->setEnabled(buyable); - } + if (!mLandBuyHandle.isDead()) + { + bool buyable = enable_buy_land(NULL); + static_cast(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 mMarketplaceListingsItem; +}; + +static LLSLMMenuUpdater* gSLMMenuUpdater = NULL; + +LLSLMMenuUpdater::LLSLMMenuUpdater() +{ + mMarketplaceListingsItem = gMenuHolder->getChild("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("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("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("menu_login.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); gLoginMenuBarView->arrangeAndClear(); LLRect menuBarRect = gLoginMenuBarView->getRect(); -- cgit v1.2.3 From c8e988e1a16e9b6f7f8befaaf9752250dca25183 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Wed, 24 Jul 2024 12:44:02 -0400 Subject: Fix excessive findChild calls when a docked control is open from LLDockControl::getAllowedRect --- indra/llui/lldockcontrol.cpp | 7 ++++++- indra/llui/lldockcontrol.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index bf0862e8a9..11dbad8c09 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -43,6 +43,8 @@ LLDockControl::LLDockControl(LLView* dockWidget, LLFloater* dockableFloater, mDockWidgetHandle = dockWidget->getHandle(); } + mNonToolbarPanelHandle = mDockableFloater->getRootView()->getChild("non_toolbar_panel")->getHandle(); + if (dockableFloater->isDocked()) { on(); @@ -97,7 +99,10 @@ void LLDockControl::setDock(LLView* dockWidget) void LLDockControl::getAllowedRect(LLRect& rect) { - rect = mDockableFloater->getRootView()->getChild("non_toolbar_panel")->getRect(); + if(!mNonToolbarPanelHandle.isDead()) + { + rect = mNonToolbarPanelHandle.get()->getRect(); + } } void LLDockControl::repositionDockable() diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h index fb0bf7d251..7e31330713 100644 --- a/indra/llui/lldockcontrol.h +++ b/indra/llui/lldockcontrol.h @@ -84,6 +84,7 @@ private: bool mDockWidgetVisible; DocAt mDockAt; LLHandle mDockWidgetHandle; + LLHandle mNonToolbarPanelHandle; LLRect mPrevDockRect; LLRect mRootRect; LLRect mFloaterRect; -- cgit v1.2.3 From 24fb96c9af5cb2d566617a8bef827af29b1d8f58 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Wed, 24 Jul 2024 12:45:06 -0400 Subject: Fix LLViewerEventRecorder triggering findChild events when it's disabled --- indra/llui/llviewereventrecorder.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra') diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp index 1bf3e3c43b..e5e0545dad 100644 --- a/indra/llui/llviewereventrecorder.cpp +++ b/indra/llui/llviewereventrecorder.cpp @@ -98,6 +98,7 @@ void LLViewerEventRecorder::setMouseGlobalCoords(S32 x, S32 y) { } void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 global_x, S32 global_y, std::string mName) { + if (!logEvents) return; LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), xui); if (! target_view) { @@ -126,6 +127,8 @@ void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 g void LLViewerEventRecorder::logVisibilityChange(std::string xui, std::string name, bool visibility, std::string event_subtype) { + if (!logEvents) return; + LLSD event=LLSD::emptyMap(); event.insert("event",LLSD(std::string("visibility"))); @@ -167,6 +170,7 @@ void LLViewerEventRecorder::update_xui(std::string xui) { void LLViewerEventRecorder::logKeyEvent(KEY key, MASK mask) { + if (!logEvents) return; // NOTE: Event recording only logs keydown events - the viewer itself hides keyup events at a fairly low level in the code and does not appear to care about them anywhere LLSD event = LLSD::emptyMap(); -- cgit v1.2.3 From 63d32e8b32b99d511c557f4fd390d974f3672ab7 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Wed, 24 Jul 2024 12:58:01 -0400 Subject: Fix accidental memory leak from gSLMMenuUpdater --- indra/newview/llviewermenu.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 4fcfe1a120..888b607bfb 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2795,6 +2795,9 @@ class LLAdminOnSaveState: public view_listener_t //----------------------------------------------------------------------------- void cleanup_menus() { + delete gSLMMenuUpdater; + gSLMMenuUpdater = nullptr; + delete gMenuParcelObserver; gMenuParcelObserver = NULL; @@ -2811,7 +2814,7 @@ void cleanup_menus() gMenuAttachmentSelf = NULL; delete gMenuAttachmentOther; - gMenuAttachmentSelf = NULL; + gMenuAttachmentOther = NULL; delete gMenuLand; gMenuLand = NULL; -- cgit v1.2.3 From 7e82c1de5242e7dacafe7d69abb753f6fe528e0f Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Wed, 24 Jul 2024 12:59:55 -0400 Subject: Fix performance floater getChild while drawing --- indra/newview/llfloaterperformance.cpp | 17 ++++++++++++----- indra/newview/llfloaterperformance.h | 9 +++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'indra') 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("AutoTuneContinuous"); + mTextWIPDesc = mAutoadjustmentsPanel->getChild("wip_desc"); + mTextDisplayDesc = mAutoadjustmentsPanel->getChild("display_desc"); + + mTextFPSLabel = getChild("fps_lbl"); + mTextFPSValue = getChild("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("fps_value")->setValue(current_fps); + mTextFPSValue->setValue(current_fps); std::string fps_text = getString("fps_text"); static LLCachedControl vsync_enabled(gSavedSettings, "RenderVSyncEnable", true); @@ -521,7 +528,7 @@ void LLFloaterPerformance::setFPSText() { fps_text += getString("max_text"); } - getChild("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 auto_tune_locked(gSavedSettings, "AutoTuneLock"); mStartAutotuneBtn->setEnabled(!autotune_enabled && !auto_tune_locked); mStopAutotuneBtn->setEnabled(autotune_enabled && !auto_tune_locked); - getChild("AutoTuneContinuous")->setEnabled(!autotune_enabled || (autotune_enabled && auto_tune_locked)); + mCheckTuneContinous->setEnabled(!autotune_enabled || (autotune_enabled && auto_tune_locked)); - getChild("wip_desc")->setVisible(autotune_enabled && !auto_tune_locked); - getChild("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; -- cgit v1.2.3 From 0a420e7d9ab54162a04472c756a3994b6597445d Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Wed, 24 Jul 2024 17:45:01 -0400 Subject: Fix find child during draw in texture picker --- indra/newview/lltexturectrl.cpp | 4 ++-- indra/newview/lltexturectrl.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'indra') 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("size_lbl"); mResolutionWarning = getChild("over_limit_lbl"); + mPreviewWidget = getChild("preview_widget"); mDefaultBtn = getChild("Default"); mNoneBtn = getChild("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; -- cgit v1.2.3 From 70f332d02e687c2c3d4806ccda0e1dcd8bde1232 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Wed, 24 Jul 2024 18:47:24 -0400 Subject: Fix findChild during draw in the parcel/region environment panel --- indra/newview/llfloaterland.cpp | 8 +- indra/newview/llfloaterregioninfo.cpp | 12 +-- indra/newview/llpanelenvironment.cpp | 180 +++++++++++++++++++--------------- indra/newview/llpanelenvironment.h | 32 ++++++ 4 files changed, 142 insertions(+), 90 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 41b6025e0f..aebadb36ae 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -3331,10 +3331,10 @@ bool LLPanelLandEnvironment::postBuild() if (!LLPanelEnvironmentInfo::postBuild()) return false; - getChild(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION)); - getChild(CHK_ALLOWOVERRIDE)->setVisible(false); - getChild(PNL_REGION_MSG)->setVisible(false); - getChild(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/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 52eddcfc67..fc6abf4bfe 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -4201,11 +4201,11 @@ bool LLPanelRegionEnvironment::postBuild() if (!LLPanelEnvironmentInfo::postBuild()) return false; - getChild(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT)); - getChild(CHK_ALLOWOVERRIDE)->setVisible(true); - getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(true); + mBtnUseDefault->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT)); + mCheckAllowOverride->setVisible(true); + mPanelEnvAltitudes->setVisible(true); - getChild(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 +4227,7 @@ void LLPanelRegionEnvironment::refresh() LLPanelEnvironmentInfo::refresh(); - getChild(CHK_ALLOWOVERRIDE)->setValue(mAllowOverride); + mCheckAllowOverride->setValue(mAllowOverride); } bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region) @@ -4293,7 +4293,7 @@ bool LLPanelRegionEnvironment::confirmUpdateEstateEnvironment(const LLSD& notifi case 1: mAllowOverride = mAllowOverrideRestore; - getChild(CHK_ALLOWOVERRIDE)->setValue(mAllowOverride); + mCheckAllowOverride->setValue(mAllowOverride); break; default: break; diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index a706e339ea..0c8bbbf308 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,58 @@ LLPanelEnvironmentInfo::~LLPanelEnvironmentInfo() bool LLPanelEnvironmentInfo::postBuild() { + mIconGround = getChild(ICN_GROUND); + mIconWater = getChild(ICN_WATER); - getChild(BTN_USEDEFAULT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnDefault(); }); - getChild(BTN_SELECTINV)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnSelect(); }); - getChild(BTN_EDIT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnEdit(); }); - getChild(BTN_RST_ALTITUDES)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnRstAltitudes(); }); + mPanelEnvAltitudes = getChild(PNL_ENVIRONMENT_ALTITUDES); + mPanelEnvConfig = getChild(PNL_SETTINGS); + mPanelEnvButtons = getChild (PNL_BUTTONS); + mPanelEnvDisabled = getChild(PNL_DISABLED); + mPanelEnvRegionMsg = getChild(PNL_REGION_MSG); - getChild(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged((F32)value.asReal()); }); - getChild(SLD_DAYLENGTH)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); - getChild(SLD_DAYLENGTH)->setSliderEditorCommitCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); - getChild(SLD_DAYOFFSET)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayOffsetChanged((F32)value.asReal()); }); - getChild(SLD_DAYOFFSET)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); - getChild(SLD_DAYOFFSET)->setSliderEditorCommitCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); + mEnvironmentDisabledText = getChild(TXT_DISABLED); + mLabelApparentTime = getChild(LBL_TIMEOFDAY); - getChild(SLD_ALTITUDES)->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); }); - getChild(SLD_ALTITUDES)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onAltSliderMouseUp(); }); + mBtnUseDefault = getChild(BTN_USEDEFAULT); + mBtnUseDefault->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnDefault(); }); + + mBtnSelectInv = getChild(BTN_SELECTINV); + mBtnSelectInv->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnSelect(); }); + + mBtnEdit = getChild(BTN_EDIT); + mBtnEdit->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnEdit(); }); + + mBtnResetAltitudes = getChild(BTN_RST_ALTITUDES); + mBtnResetAltitudes->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnRstAltitudes(); }); + + mCheckAllowOverride = getChild(CHK_ALLOWOVERRIDE); + + mSliderDayLength = getChild(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(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(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(slider_marker_base + llformat("%u", idx)); + } + + for (U32 idx = 0; idx < ALTITUDE_PREFIXERS_COUNT; idx++) + { + mAltitudePrefixers[idx] = findChild("sdt_" + alt_prefixes[idx]); + } + for (U32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; idx++) { LLSettingsDropTarget* drop_target = findChild("sdt_" + alt_prefixes[idx]); @@ -262,8 +294,8 @@ void LLPanelEnvironmentInfo::refresh() if (dayoffset.value() > 12.0f) dayoffset -= F32Hours(24.0); - getChild(SLD_DAYLENGTH)->setValue(daylength.value()); - getChild(SLD_DAYOFFSET)->setValue(dayoffset.value()); + mSliderDayLength->setValue(daylength.value()); + mSliderDayOffset->setValue(dayoffset.value()); udpateApparentTimeOfDay(); @@ -273,40 +305,39 @@ void LLPanelEnvironmentInfo::refresh() if (altitudes.size() > 0) { - LLMultiSliderCtrl *sld = getChild(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 { @@ -316,12 +347,12 @@ void LLPanelEnvironmentInfo::refresh() updateAltLabel(alt_prefixes[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 @@ -455,77 +486,75 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) if (mNoEnvironment || (!LLEnvironment::instance().isExtendedEnvironmentEnabled() && !isRegion())) { is_unavailable = true; - getChild(TXT_DISABLED)->setText(getString(STR_LEGACY)); + mEnvironmentDisabledText->setText(getString(STR_LEGACY)); } else if (mNoSelection) { is_unavailable = true; - getChild(TXT_DISABLED)->setText(getString(STR_NO_PARCEL)); + mEnvironmentDisabledText->setText(getString(STR_NO_PARCEL)); } else if (mCrossRegion) { is_unavailable = true; - getChild(TXT_DISABLED)->setText(getString(STR_CROSS_REGION)); + mEnvironmentDisabledText->setText(getString(STR_CROSS_REGION)); } else if (!isRegion() && !mAllowOverride) { is_unavailable = true; - getChild(TXT_DISABLED)->setText(getString(STR_DISALLOWED)); + mEnvironmentDisabledText->setText(getString(STR_DISALLOWED)); } else if (!is_bigenough) { is_unavailable = true; - getChild(TXT_DISABLED)->setText(getString(STR_TOO_SMALL)); + mEnvironmentDisabledText->setText(getString(STR_TOO_SMALL)); } if (is_unavailable) { - getChild(PNL_SETTINGS)->setVisible(false); - getChild(PNL_BUTTONS)->setVisible(false); - getChild(PNL_DISABLED)->setVisible(true); - getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(false); - getChild(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(PNL_SETTINGS)->setVisible(true); - getChild(PNL_BUTTONS)->setVisible(true); - getChild(PNL_DISABLED)->setVisible(false); - getChild(PNL_REGION_MSG)->setVisible(isRegion()); + mPanelEnvConfig->setVisible(true); + mPanelEnvButtons->setVisible(true); + mPanelEnvDisabled->setVisible(false); + mPanelEnvRegionMsg->setVisible(isRegion()); - getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(LLEnvironment::instance().isExtendedEnvironmentEnabled()); - getChild(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(BTN_SELECTINV)->setEnabled(can_enable); - getChild(BTN_USEDEFAULT)->setEnabled(can_enable); - getChild(BTN_EDIT)->setEnabled(can_enable); - getChild(SLD_DAYLENGTH)->setEnabled(can_enable); - getChild(SLD_DAYOFFSET)->setEnabled(can_enable); - getChild(SLD_ALTITUDES)->setEnabled(can_enable && isRegion()); - getChild(ICN_GROUND)->setColor((can_enable && isRegion()) ? LLColor4::white : LLColor4::grey % 0.8f); - getChild(ICN_WATER)->setColor((can_enable && isRegion()) ? LLColor4::white : LLColor4::grey % 0.8f); - getChild(BTN_RST_ALTITUDES)->setEnabled(can_enable && isRegion()); - getChild(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable); - getChild(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(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("sdt_" + alt_prefixes[idx]); - if (drop_target) + if (mAltitudePrefixers[idx]) { - drop_target->setDndEnabled(can_enable); + mAltitudePrefixers[idx]->setDndEnabled(can_enable); } } @@ -544,13 +573,7 @@ void LLPanelEnvironmentInfo::clearDirtyFlag(U32 flag) void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_prefix, U32 sky_index, F32 alt_value) { - LLMultiSliderCtrl *sld = findChild(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. @@ -596,14 +619,11 @@ void LLPanelEnvironmentInfo::readjustAltLabels() // Very simple "adjust after the fact" method // Note: labels can be in any order - LLMultiSliderCtrl *sld = findChild(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++) @@ -907,10 +927,10 @@ void LLPanelEnvironmentInfo::udpateApparentTimeOfDay() if ((!mCurrentEnvironment) || (mCurrentEnvironment->mDayLength.value() < 1.0) || (mCurrentEnvironment->mDayOffset.value() < 1.0)) { - getChild(LBL_TIMEOFDAY)->setVisible(false); + mLabelApparentTime->setVisible(false); return; } - getChild(LBL_TIMEOFDAY)->setVisible(true); + mLabelApparentTime->setVisible(true); S32Seconds now((S32)LLDate::now().secondsSinceEpoch()); @@ -932,10 +952,10 @@ void LLPanelEnvironmentInfo::udpateApparentTimeOfDay() std::string lblminute(((minutesofhour.value() < 10) ? "0" : "") + LLSD(minutesofhour.value()).asString()); - getChild(LBL_TIMEOFDAY)->setTextArg("[HH]", LLSD(hourofday.value()).asString()); - getChild(LBL_TIMEOFDAY)->setTextArg("[MM]", lblminute); - getChild(LBL_TIMEOFDAY)->setTextArg("[AP]", std::string(am_pm ? "PM" : "AM")); - getChild(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..0544524ece 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; @@ -168,6 +173,33 @@ 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 mAltitudeMarkers; + std::array mAltitudePrefixers; + protected: typedef boost::signals2::connection connection_t; -- cgit v1.2.3 From e3deb8340a5f2e5b1c997e66042f3515f33f5cea Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Wed, 24 Jul 2024 19:30:29 -0400 Subject: Fix excessive findChild calls during about land floater draw --- indra/newview/llfloaterland.cpp | 258 +++++++++++++++++----------------- indra/newview/llfloaterland.h | 18 ++- indra/newview/llfloaterregioninfo.cpp | 1 - indra/newview/llpanelland.cpp | 78 +++++----- indra/newview/llpanelland.h | 21 ++- 5 files changed, 199 insertions(+), 177 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index aebadb36ae..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("limit_payment"); + mPaymentInfoCheck->setCommitCallback(onCommitAny, this); + mAgeVerifiedCheck = getChild("limit_age_verified"); + mAgeVerifiedCheck->setCommitCallback(onCommitAny, this); + mTemporaryPassCheck = getChild("PassCheck"); + mTemporaryPassCheck->setCommitCallback(onCommitAny, this); + mPublicAccessCheck = getChild("public_access"); + mPublicAccessCheck->setCommitCallback(onCommitPublicAccess, this); + mGroupAccessCheck = getChild("GroupCheck"); + mGroupAccessCheck->setCommitCallback(onCommitGroupCheck, this); + mTemporaryPassCombo = getChild("pass_combo"); + mGroupAccessCheck->setCommitCallback(onCommitAny, this); + mTemporaryPassPriceSpin = getChild("PriceSpin"); + mGroupAccessCheck->setCommitCallback(onCommitAny, this); + mTemporaryPassHourSpin = getChild("HoursSpin"); + mGroupAccessCheck->setCommitCallback(onCommitAny, this); + + mAllowText = getChild("AllowedText"); + mBanText = getChild("BanCheck"); + + mBtnAddAllowed = getChild("add_allowed"); + mBtnAddAllowed->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickAddAccess, this)); + mBtnRemoveAllowed = getChild("remove_allowed"); + mBtnRemoveAllowed->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickRemoveAccess, this)); + mBtnAddBanned = getChild("add_banned"); + mBtnAddBanned->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickAddBanned, this)); + mBtnRemoveBanned = getChild("remove_banned"); + mBtnRemoveBanned->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickRemoveBanned, this)); mListAccess = getChild("AccessList"); if (mListAccess) @@ -2494,17 +2509,17 @@ void LLPanelLandAccess::refresh() if (parcel->getRegionAllowAccessOverride()) { - getChild("public_access")->setValue(public_access); - getChild("GroupCheck")->setValue(use_group); + mPublicAccessCheck->setValue(public_access); + mGroupAccessCheck->setValue(use_group); } else { - getChild("public_access")->setValue(true); - getChild("GroupCheck")->setValue(false); + mPublicAccessCheck->setValue(true); + mGroupAccessCheck->setValue(false); } std::string group_name; gCacheName->getGroupName(parcel->getGroupID(), group_name); - getChild("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("AllowedText")->setTextArg("[COUNT]", llformat("%d",count)); - getChild("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("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); - getChild("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("BanCheck")->setTextArg("[COUNT]", llformat("%d",count)); - getChild("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("BannedList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); - getChild("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("limit_payment")->setValue(true); - getChild("limit_payment")->setLabelArg("[ESTATE_PAYMENT_LIMIT]", getString("access_estate_defined") ); + mPaymentInfoCheck->setValue(true); + mPaymentInfoCheck->setLabelArg("[ESTATE_PAYMENT_LIMIT]", getString("access_estate_defined") ); } else { - getChild("limit_payment")->setValue((parcel->getParcelFlag(PF_DENY_ANONYMOUS))); - getChild("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("limit_age_verified")->setValue(true); - getChild("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("limit_age_verified")->setValue((parcel->getParcelFlag(PF_DENY_AGEUNVERIFIED))); - getChild("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("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("PriceSpin")->setValue((F32)pass_price ); + mTemporaryPassPriceSpin->setValue((F32)pass_price); F32 pass_hours = parcel->getPassHours(); - getChild("HoursSpin")->setValue(pass_hours ); + mTemporaryPassHourSpin->setValue(pass_hours); } else { - getChild("public_access")->setValue(false); - getChild("limit_payment")->setValue(false); - getChild("limit_age_verified")->setValue(false); - getChild("GroupCheck")->setValue(false); - getChild("GroupCheck")->setLabelArg("[GROUP]", LLStringUtil::null ); - getChild("PassCheck")->setValue(false); - getChild("PriceSpin")->setValue((F32)PARCEL_PASS_PRICE_DEFAULT); - getChild("HoursSpin")->setValue(PARCEL_PASS_HOURS_DEFAULT ); - getChild("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); - getChild("AccessList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0)); - getChild("BannedList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); - getChild("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("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("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("limit_payment")->getValue().asBoolean() ^ getChild("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("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("public_access")->getValue().asBoolean(); - bool use_access_group = self->getChild("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("public_access")->getValue().asBoolean(); - bool use_access_group = self->getChild("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("limit_payment")->getValue().asBoolean(); - limit_age_verified = self->getChild("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("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("PriceSpin")->getValue().asReal()); - F32 pass_hours = (F32)self->getChild("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("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 names = panelp->mListAccess->getAllSelected(); + std::vector names = mListAccess->getAllSelected(); for (std::vector::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("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 names = panelp->mListBanned->getAllSelected(); + std::vector names = mListBanned->getAllSelected(); for (std::vector::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(); } } } 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& mParcel; }; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index fc6abf4bfe..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("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); 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("button buy land"); + mButtonBuyLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickClaim, this)); + + mButtonAbandonLand = getChild("button abandon land"); + mButtonAbandonLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickRelease, this)); + + mButtonSubdivLand = getChild("button subdivide land"); + mButtonSubdivLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickDivide, this)); + + mButtonJoinLand = getChild("button join land"); + mButtonJoinLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickJoin, this)); + + mButtonAboutLand = getChild("button about land"); + mButtonAboutLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickAbout, this)); mCheckShowOwners = getChild("checkbox show owners"); - getChild("checkbox show owners")->setValue(gSavedSettings.getBOOL("ShowParcelOwners")); + mCheckShowOwners->setValue(gSavedSettings.getBOOL("ShowParcelOwners")); + + mTextArea = getChild("label_area"); + mTextAreaPrice = getChild("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("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("label_area_price")->setTextArg("[PRICE]", llformat("%d",claim_price)); - getChild("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("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 -- cgit v1.2.3 From a067f935358098d57f472a5fb8d475e99dd5c510 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Wed, 24 Jul 2024 19:34:35 -0400 Subject: Fix findChild calls during blocked list draw --- indra/newview/llpanelblockedlist.cpp | 18 ++++++++++++------ indra/newview/llpanelblockedlist.h | 7 ++++++- 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'indra') 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("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("blocked_gear_btn")->setMenu(blocked_gear_menu, LLMenuButton::MP_BOTTOM_LEFT); + mBlockedGearBtn->setMenu(blocked_gear_menu, LLMenuButton::MP_BOTTOM_LEFT); } + mUnblockBtn = getChild("unblock_btn"); + mUnblockBtn->setCommitCallback(boost::bind(&LLPanelBlockedList::unblockItem, this)); - getChild("unblock_btn")->setCommitCallback(boost::bind(&LLPanelBlockedList::unblockItem, this)); getChild("blocked_filter_input")->setCommitCallback(boost::bind(&LLPanelBlockedList::onFilterEdit, this, _2)); + mBlockLimitText = getChild("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("block_limit")->setTextArg("[COUNT]", llformat("%d", mBlockedList->getMuteListSize())); - getChild("block_limit")->setTextArg("[LIMIT]", llformat("%d", gSavedSettings.getS32("MuteListLimit"))); + static LLCachedControl 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 mPicker; }; -- cgit v1.2.3 From 66d2c846b180d58e4e90052d87e27505e2d22736 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Wed, 24 Jul 2024 22:27:10 -0400 Subject: Fix further recursive findChild stalls from environment panel --- indra/newview/llpanelenvironment.cpp | 38 ++++++++++++++++++++---------------- indra/newview/llpanelenvironment.h | 8 ++++++-- 2 files changed, 27 insertions(+), 19 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 0c8bbbf308..51e2c05070 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -214,7 +214,10 @@ bool LLPanelEnvironmentInfo::postBuild() for (U32 idx = 0; idx < ALTITUDE_PREFIXERS_COUNT; idx++) { - mAltitudePrefixers[idx] = findChild("sdt_" + alt_prefixes[idx]); + mAltitudeDropTarget[idx] = findChild("sdt_" + alt_prefixes[idx]); + mAltitudeLabels[idx] = findChild("txt_" + alt_prefixes[idx]); + mAltitudeEditor[idx] = findChild("edt_invname_" + alt_prefixes[idx]); + mAltitudePanels[idx] = findChild("pnl_" + alt_prefixes[idx]); } for (U32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; idx++) @@ -224,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("sdt_" + alt_prefixes[3])->setPanel(this, alt_prefixes[3]); - getChild("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; } @@ -344,7 +348,7 @@ void LLPanelEnvironmentInfo::refresh() // 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 (mMultiSliderAltitudes->getCurNumSliders() != ALTITUDE_SLIDER_COUNT) @@ -355,8 +359,8 @@ void LLPanelEnvironmentInfo::refresh() 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 } @@ -552,9 +556,9 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) for (U32 idx = 0; idx < ALTITUDE_PREFIXERS_COUNT; idx++) { - if (mAltitudePrefixers[idx]) + if (mAltitudeDropTarget[idx]) { - mAltitudePrefixers[idx]->setDndEnabled(can_enable); + mAltitudeDropTarget[idx]->setDndEnabled(can_enable); } } @@ -571,7 +575,7 @@ 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) { LLRect sld_rect = mMultiSliderAltitudes->getRect(); S32 sld_range = sld_rect.getHeight(); @@ -580,9 +584,9 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_prefix, U32 s S32 pos = (S32)((sld_range - sld_offset) * ((alt_value - 100) / (4000 - 100))); // get related views - LLTextBox* text = findChild("txt_" + alt_prefix); - LLLineEditor *field = findChild("edt_invname_" + alt_prefix); - LLView *alt_panel = findChild("pnl_" + alt_prefix); + LLTextBox* text = mAltitudeLabels[alt_index]; + LLLineEditor* field = mAltitudeEditor[alt_index]; + LLView* alt_panel = mAltitudePanels[alt_index]; if (text && (sky_index > 1)) { @@ -628,7 +632,7 @@ void LLPanelEnvironmentInfo::readjustAltLabels() // Find the middle one for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++) { - LLView* cmp_view = findChild(alt_panels[i], true); + LLView* cmp_view = mAltitudePanels[i]; if (!cmp_view) return; LLRect cmp_rect = cmp_view->getRect(); S32 pos = 0; @@ -639,7 +643,7 @@ void LLPanelEnvironmentInfo::readjustAltLabels() { if (i != j) { - LLView* intr_view = findChild(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) @@ -687,7 +691,7 @@ void LLPanelEnvironmentInfo::readjustAltLabels() { if (i != midle_ind) { - LLView* trn_view = findChild(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) @@ -807,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++; } diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index 0544524ece..8942e20119 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -113,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); @@ -198,7 +198,11 @@ protected: LLIconCtrl* mIconWater = nullptr; std::array mAltitudeMarkers; - std::array mAltitudePrefixers; + std::array mAltitudeDropTarget; + + std::array mAltitudeLabels; + std::array mAltitudeEditor; + std::array mAltitudePanels; protected: typedef boost::signals2::connection connection_t; -- cgit v1.2.3 From 6b20d98aaac093e043c6e23fbcf6d4e1f62d13ba Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Wed, 24 Jul 2024 23:12:44 -0400 Subject: Fix one more group findChild stall --- indra/newview/llpanelgroup.cpp | 16 ++++++++-------- indra/newview/llpanelgroup.h | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 598df0135e..3db0f90df8 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -169,6 +169,8 @@ bool LLPanelGroup::postBuild() mButtonCancel = getChild("btn_cancel"); + mGroupNameCtrl = getChild("group_name"); + childSetCommitCallback("back",boost::bind(&LLPanelGroup::onBackBtnClick,this),NULL); LLPanelGroupTab* panel_general = findChild("group_general_tab_panel"); @@ -311,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("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(); @@ -365,9 +366,8 @@ 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("group_name"); - group_name_ctrl->setValue(group_name); - group_name_ctrl->setToolTip(group_name); + mGroupNameCtrl->setValue(group_name); + mGroupNameCtrl->setToolTip(group_name); } bool is_null_group_id = group_id == LLUUID::null; @@ -417,7 +417,7 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) tab_land->setVisible(false); tab_experiences->setVisible(false); - getChild("group_name")->setVisible(false); + mGroupNameCtrl->setVisible(false); getChild("group_name_editor")->setVisible(true); if(mButtonCall) @@ -449,7 +449,7 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) tab_land->setVisible(is_member); tab_experiences->setVisible(is_member); - getChild("group_name")->setVisible(true); + mGroupNameCtrl->setVisible(true); getChild("group_name_editor")->setVisible(false); if(mButtonApply) diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index 1dbc8c32ff..d7dec94c60 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -117,6 +117,7 @@ protected: LLAccordionCtrl* mGroupsAccordion = nullptr; + LLUICtrl* mGroupNameCtrl = nullptr; LLButton* mButtonJoin = nullptr; LLButton* mButtonApply = nullptr; LLButton* mButtonCall = nullptr; -- cgit v1.2.3 From 7bb62fff08942db95805de454b43d006ca47428b Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Thu, 25 Jul 2024 08:44:38 -0400 Subject: Fix precommit whitespace failure --- indra/newview/llviewermenu.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 888b607bfb..cd0b3dbd0c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -377,17 +377,17 @@ void LLMenuParcelObserver::changed() LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); if (gMenuLand && parcel) { - if (!mLandBuyPassHandle.isDead()) - { - LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); - static_cast(mLandBuyPassHandle.get())->setEnabled(LLPanelLandGeneral::enableBuyPass(NULL) && !(parcel->getOwnerID() == gAgent.getID())); - } - - if (!mLandBuyHandle.isDead()) - { - bool buyable = enable_buy_land(NULL); - static_cast(mLandBuyHandle.get())->setEnabled(buyable); - } + if (!mLandBuyPassHandle.isDead()) + { + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); + static_cast(mLandBuyPassHandle.get())->setEnabled(LLPanelLandGeneral::enableBuyPass(NULL) && !(parcel->getOwnerID() == gAgent.getID())); + } + + if (!mLandBuyHandle.isDead()) + { + bool buyable = enable_buy_land(NULL); + static_cast(mLandBuyHandle.get())->setEnabled(buyable); + } } } -- cgit v1.2.3