diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-08-19 09:41:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-19 09:41:02 +0300 |
commit | c04fae068bae2bfc4b126ee9742c7cf364959268 (patch) | |
tree | 9bb8cf7c4c80ae036613551b4ed82a9508892664 | |
parent | 4c61461883e6f90b1cdccf6b626ae3f289c257b1 (diff) | |
parent | ec7db659faf0420f5d3cd1f0be108c5aaeb53dd9 (diff) |
Merge pull request #2334 from RyeMutt/ui-stutter-fixes
Fix various findChild calls causing frame drops and ui stutter
25 files changed, 525 insertions, 519 deletions
diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index 0596a8fe7d..53da9826ed 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -119,7 +119,7 @@ void LLDebugView::draw() { if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } LLRect debug_rect; diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index e9cd912ca9..c920a3c898 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -286,7 +286,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } LLRect channel_rect; mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &channel_rect, gFloaterView); @@ -376,7 +376,7 @@ void LLFloaterIMNearbyChatScreenChannel::arrangeToasts() if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } if (!getParent()) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 5e5cfcecbf..3441fff7e8 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -430,6 +430,13 @@ void LLFloaterPreference::saveAvatarPropertiesCoro(const std::string cap_url, bo bool LLFloaterPreference::postBuild() { + mDeleteTranscriptsBtn = getChild<LLButton>("delete_transcripts"); + + mEnabledPopups = getChild<LLScrollListCtrl>("enabled_popups"); + mDisabledPopups = getChild<LLScrollListCtrl>("disabled_popups"); + mEnablePopupBtn = getChild<LLButton>("enable_this_popup"); + mDisablePopupBtn = getChild<LLButton>("disable_this_popup"); + gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false)); gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged)); @@ -519,7 +526,7 @@ bool LLFloaterPreference::postBuild() void LLFloaterPreference::updateDeleteTranscriptsButton() { - getChild<LLButton>("delete_transcripts")->setEnabled(LLLogChat::transcriptFilesExist()); + mDeleteTranscriptsBtn->setEnabled(LLLogChat::transcriptFilesExist()); } void LLFloaterPreference::onDoNotDisturbResponseChanged() @@ -540,11 +547,11 @@ LLFloaterPreference::~LLFloaterPreference() void LLFloaterPreference::draw() { - bool has_first_selected = (getChildRef<LLScrollListCtrl>("disabled_popups").getFirstSelected()!=NULL); - gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected); + bool has_first_selected = (mDisabledPopups->getFirstSelected()!=NULL); + mEnablePopupBtn->setEnabled(has_first_selected); - has_first_selected = (getChildRef<LLScrollListCtrl>("enabled_popups").getFirstSelected()!=NULL); - gSavedSettings.setBOOL("FirstSelectedEnabledPopups", has_first_selected); + has_first_selected = (mEnabledPopups->getFirstSelected()!=NULL); + mDisablePopupBtn->setEnabled(has_first_selected); LLFloater::draw(); } @@ -1171,13 +1178,8 @@ void LLFloaterPreference::refreshSkin(void* data) void LLFloaterPreference::buildPopupLists() { - LLScrollListCtrl& disabled_popups = - getChildRef<LLScrollListCtrl>("disabled_popups"); - LLScrollListCtrl& enabled_popups = - getChildRef<LLScrollListCtrl>("enabled_popups"); - - disabled_popups.deleteAllItems(); - enabled_popups.deleteAllItems(); + mDisabledPopups->deleteAllItems(); + mEnabledPopups->deleteAllItems(); for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); iter != LLNotifications::instance().templatesEnd(); @@ -1219,11 +1221,11 @@ void LLFloaterPreference::buildPopupLists() } } } - item = disabled_popups.addElement(row); + item = mDisabledPopups->addElement(row); } else { - item = enabled_popups.addElement(row); + item = mEnabledPopups->addElement(row); } if (item) @@ -1324,9 +1326,7 @@ void LLFloaterPreference::onClickSetSounds() void LLFloaterPreference::onClickEnablePopup() { - LLScrollListCtrl& disabled_popups = getChildRef<LLScrollListCtrl>("disabled_popups"); - - std::vector<LLScrollListItem*> items = disabled_popups.getAllSelected(); + std::vector<LLScrollListItem*> items = mDisabledPopups->getAllSelected(); std::vector<LLScrollListItem*>::iterator itor; for (itor = items.begin(); itor != items.end(); ++itor) { @@ -1345,9 +1345,7 @@ void LLFloaterPreference::onClickEnablePopup() void LLFloaterPreference::onClickDisablePopup() { - LLScrollListCtrl& enabled_popups = getChildRef<LLScrollListCtrl>("enabled_popups"); - - std::vector<LLScrollListItem*> items = enabled_popups.getAllSelected(); + std::vector<LLScrollListItem*> items = mEnabledPopups->getAllSelected(); std::vector<LLScrollListItem*>::iterator itor; for (itor = items.begin(); itor != items.end(); ++itor) { @@ -1796,11 +1794,9 @@ void LLFloaterPreference::onDeleteTranscriptsResponse(const LLSD& notification, void LLFloaterPreference::onLogChatHistorySaved() { - LLButton * delete_transcripts_buttonp = getChild<LLButton>("delete_transcripts"); - - if (!delete_transcripts_buttonp->getEnabled()) + if (!mDeleteTranscriptsBtn->getEnabled()) { - delete_transcripts_buttonp->setEnabled(true); + mDeleteTranscriptsBtn->setEnabled(true); } } @@ -2334,7 +2330,6 @@ bool LLPanelPreferenceGraphics::postBuild() void LLPanelPreferenceGraphics::draw() { - setPresetText(); LLPanelPreference::draw(); } @@ -3315,8 +3310,8 @@ void LLFloaterPreference::onUpdateFilterTerm(bool force) void LLFloaterPreference::filterIgnorableNotifications() { - bool visible = getChildRef<LLScrollListCtrl>("enabled_popups").highlightMatchingItems(mFilterEdit->getValue()); - visible |= getChildRef<LLScrollListCtrl>("disabled_popups").highlightMatchingItems(mFilterEdit->getValue()); + bool visible = mEnabledPopups->highlightMatchingItems(mFilterEdit->getValue()); + visible |= mDisabledPopups->highlightMatchingItems(mFilterEdit->getValue()); if (visible) { diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index c8b98d8e1b..51ed3d8179 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -225,7 +225,12 @@ private: std::string mSavedGraphicsPreset; LOG_CLASS(LLFloaterPreference); - LLSearchEditor *mFilterEdit; + LLSearchEditor* mFilterEdit = nullptr; + LLScrollListCtrl* mEnabledPopups = nullptr; + LLScrollListCtrl* mDisabledPopups = nullptr; + LLButton* mDeleteTranscriptsBtn = nullptr; + LLButton* mEnablePopupBtn = nullptr; + LLButton* mDisablePopupBtn = nullptr; std::unique_ptr< ll::prefs::SearchData > mSearchData; bool mSearchDataDirty; diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 525317304d..8cc01f6dc6 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -51,6 +51,18 @@ bool LLFloaterSettingsDebug::postBuild() { enableResizeCtrls(true, false, true); + mValSpinner1 = getChild<LLSpinCtrl>("val_spinner_1"); + mValSpinner2 = getChild<LLSpinCtrl>("val_spinner_2"); + mValSpinner3 = getChild<LLSpinCtrl>("val_spinner_3"); + mValSpinner4 = getChild<LLSpinCtrl>("val_spinner_4"); + mBooleanCombo = getChild<LLUICtrl>("boolean_combo"); + mValText = getChild<LLUICtrl>("val_text"); + + mColorSwatch = getChild<LLColorSwatchCtrl>("val_color_swatch"); + + mDefaultButton = getChild<LLUICtrl>("default_btn"); + mSettingNameText = getChild<LLTextBox>("setting_name_txt"); + mComment = getChild<LLTextEditor>("comment_text"); getChild<LLFilterEditor>("filter_input")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::setSearchFilter, this, _2)); @@ -104,56 +116,56 @@ void LLFloaterSettingsDebug::onCommitSettings() switch(controlp->type()) { case TYPE_U32: - controlp->set(getChild<LLUICtrl>("val_spinner_1")->getValue()); + controlp->set(mValSpinner1->getValue()); break; case TYPE_S32: - controlp->set(getChild<LLUICtrl>("val_spinner_1")->getValue()); + controlp->set(mValSpinner1->getValue()); break; case TYPE_F32: - controlp->set(LLSD(getChild<LLUICtrl>("val_spinner_1")->getValue().asReal())); + controlp->set(LLSD(mValSpinner1->getValue().asReal())); break; case TYPE_BOOLEAN: - controlp->set(getChild<LLUICtrl>("boolean_combo")->getValue()); + controlp->set(mBooleanCombo->getValue()); break; case TYPE_STRING: - controlp->set(LLSD(getChild<LLUICtrl>("val_text")->getValue().asString())); + controlp->set(LLSD(mValText->getValue().asString())); break; case TYPE_VEC3: - vector.mV[VX] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asReal(); - vector.mV[VY] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal(); - vector.mV[VZ] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal(); + vector.mV[VX] = (F32)mValSpinner1->getValue().asReal(); + vector.mV[VY] = (F32)mValSpinner2->getValue().asReal(); + vector.mV[VZ] = (F32)mValSpinner3->getValue().asReal(); controlp->set(vector.getValue()); break; case TYPE_VEC3D: - vectord.mdV[VX] = getChild<LLUICtrl>("val_spinner_1")->getValue().asReal(); - vectord.mdV[VY] = getChild<LLUICtrl>("val_spinner_2")->getValue().asReal(); - vectord.mdV[VZ] = getChild<LLUICtrl>("val_spinner_3")->getValue().asReal(); + vectord.mdV[VX] = mValSpinner1->getValue().asReal(); + vectord.mdV[VY] = mValSpinner2->getValue().asReal(); + vectord.mdV[VZ] = mValSpinner3->getValue().asReal(); controlp->set(vectord.getValue()); break; case TYPE_QUAT: - quat.mQ[VX] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asReal(); - quat.mQ[VY] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal(); - quat.mQ[VZ] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal(); - quat.mQ[VS] = (F32)getChild<LLUICtrl>("val_spinner_4")->getValue().asReal();; + quat.mQ[VX] = mValSpinner1->getValueF32(); + quat.mQ[VY] = mValSpinner2->getValueF32(); + quat.mQ[VZ] = mValSpinner3->getValueF32(); + quat.mQ[VS] = mValSpinner4->getValueF32(); controlp->set(quat.getValue()); break; case TYPE_RECT: - rect.mLeft = getChild<LLUICtrl>("val_spinner_1")->getValue().asInteger(); - rect.mRight = getChild<LLUICtrl>("val_spinner_2")->getValue().asInteger(); - rect.mBottom = getChild<LLUICtrl>("val_spinner_3")->getValue().asInteger(); - rect.mTop = getChild<LLUICtrl>("val_spinner_4")->getValue().asInteger(); + rect.mLeft = mValSpinner1->getValue().asInteger(); + rect.mRight = mValSpinner2->getValue().asInteger(); + rect.mBottom = mValSpinner3->getValue().asInteger(); + rect.mTop = mValSpinner4->getValue().asInteger(); controlp->set(rect.getValue()); break; case TYPE_COL4: - col3.setValue(getChild<LLUICtrl>("val_color_swatch")->getValue()); - col4 = LLColor4(col3, (F32)getChild<LLUICtrl>("val_spinner_4")->getValue().asReal()); + col3.setValue(mColorSwatch->getValue()); + col4 = LLColor4(col3, (F32)mValSpinner4->getValue().asReal()); controlp->set(col4.getValue()); break; case TYPE_COL3: - controlp->set(getChild<LLUICtrl>("val_color_swatch")->getValue()); - //col3.mV[VRED] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_1")->getValue().asC(); - //col3.mV[VGREEN] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_2")->getValue().asReal(); - //col3.mV[VBLUE] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_3")->getValue().asReal(); + controlp->set(mColorSwatch->getValue()); + //col3.mV[VRED] = (F32)floaterp->mValSpinner1->getValue().asC(); + //col3.mV[VGREEN] = (F32)floaterp->mValSpinner2->getValue().asReal(); + //col3.mV[VBLUE] = (F32)floaterp->mValSpinner3->getValue().asReal(); //controlp->set(col3.getValue()); break; default: @@ -181,19 +193,6 @@ void LLFloaterSettingsDebug::onClickDefault() // we've switched controls, or doing per-frame update, so update spinners, etc. void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { - LLSpinCtrl* spinner1 = getChild<LLSpinCtrl>("val_spinner_1"); - LLSpinCtrl* spinner2 = getChild<LLSpinCtrl>("val_spinner_2"); - LLSpinCtrl* spinner3 = getChild<LLSpinCtrl>("val_spinner_3"); - LLSpinCtrl* spinner4 = getChild<LLSpinCtrl>("val_spinner_4"); - LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("val_color_swatch"); - - if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch) - { - LL_WARNS() << "Could not find all desired controls by name" - << LL_ENDL; - return; - } - hideUIControls(); if (controlp && !isSettingHidden(controlp)) @@ -201,11 +200,11 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) eControlType type = controlp->type(); //hide combo box only for non booleans, otherwise this will result in the combo box closing every frame - getChildView("boolean_combo")->setVisible( type == TYPE_BOOLEAN); - getChildView("default_btn")->setVisible(true); - getChildView("setting_name_txt")->setVisible(true); - getChild<LLTextBox>("setting_name_txt")->setText(controlp->getName()); - getChild<LLTextBox>("setting_name_txt")->setToolTip(controlp->getName()); + mBooleanCombo->setVisible( type == TYPE_BOOLEAN); + mDefaultButton->setVisible(true); + mSettingNameText->setVisible(true); + mSettingNameText->setText(controlp->getName()); + mSettingNameText->setToolTip(controlp->getName()); mComment->setVisible(true); std::string old_text = mComment->getText(); @@ -218,111 +217,111 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) mComment->setText(controlp->getComment()); } - spinner1->setMaxValue(F32_MAX); - spinner2->setMaxValue(F32_MAX); - spinner3->setMaxValue(F32_MAX); - spinner4->setMaxValue(F32_MAX); - spinner1->setMinValue(-F32_MAX); - spinner2->setMinValue(-F32_MAX); - spinner3->setMinValue(-F32_MAX); - spinner4->setMinValue(-F32_MAX); - if (!spinner1->hasFocus()) + mValSpinner1->setMaxValue(F32_MAX); + mValSpinner2->setMaxValue(F32_MAX); + mValSpinner3->setMaxValue(F32_MAX); + mValSpinner4->setMaxValue(F32_MAX); + mValSpinner1->setMinValue(-F32_MAX); + mValSpinner2->setMinValue(-F32_MAX); + mValSpinner3->setMinValue(-F32_MAX); + mValSpinner4->setMinValue(-F32_MAX); + if (!mValSpinner1->hasFocus()) { - spinner1->setIncrement(0.1f); + mValSpinner1->setIncrement(0.1f); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setIncrement(0.1f); + mValSpinner2->setIncrement(0.1f); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setIncrement(0.1f); + mValSpinner3->setIncrement(0.1f); } - if (!spinner4->hasFocus()) + if (!mValSpinner4->hasFocus()) { - spinner4->setIncrement(0.1f); + mValSpinner4->setIncrement(0.1f); } LLSD sd = controlp->get(); switch(type) { case TYPE_U32: - spinner1->setVisible(true); - spinner1->setLabel(std::string("value")); // Debug, don't translate - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("value")); // Debug, don't translate + if (!mValSpinner1->hasFocus()) { - spinner1->setValue(sd); - spinner1->setMinValue((F32)U32_MIN); - spinner1->setMaxValue((F32)U32_MAX); - spinner1->setIncrement(1.f); - spinner1->setPrecision(0); + mValSpinner1->setValue(sd); + mValSpinner1->setMinValue((F32)U32_MIN); + mValSpinner1->setMaxValue((F32)U32_MAX); + mValSpinner1->setIncrement(1.f); + mValSpinner1->setPrecision(0); } break; case TYPE_S32: - spinner1->setVisible(true); - spinner1->setLabel(std::string("value")); // Debug, don't translate - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("value")); // Debug, don't translate + if (!mValSpinner1->hasFocus()) { - spinner1->setValue(sd); - spinner1->setMinValue((F32)S32_MIN); - spinner1->setMaxValue((F32)S32_MAX); - spinner1->setIncrement(1.f); - spinner1->setPrecision(0); + mValSpinner1->setValue(sd); + mValSpinner1->setMinValue((F32)S32_MIN); + mValSpinner1->setMaxValue((F32)S32_MAX); + mValSpinner1->setIncrement(1.f); + mValSpinner1->setPrecision(0); } break; case TYPE_F32: - spinner1->setVisible(true); - spinner1->setLabel(std::string("value")); // Debug, don't translate - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("value")); // Debug, don't translate + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(3); - spinner1->setValue(sd); + mValSpinner1->setPrecision(3); + mValSpinner1->setValue(sd); } break; case TYPE_BOOLEAN: - if (!getChild<LLUICtrl>("boolean_combo")->hasFocus()) + if (!mBooleanCombo->hasFocus()) { if (sd.asBoolean()) { - getChild<LLUICtrl>("boolean_combo")->setValue(LLSD("true")); + mBooleanCombo->setValue(LLSD("true")); } else { - getChild<LLUICtrl>("boolean_combo")->setValue(LLSD("")); + mBooleanCombo->setValue(LLSD("")); } } break; case TYPE_STRING: - getChildView("val_text")->setVisible( true); - if (!getChild<LLUICtrl>("val_text")->hasFocus()) + mValText->setVisible( true); + if (!mValText->hasFocus()) { - getChild<LLUICtrl>("val_text")->setValue(sd); + mValText->setValue(sd); } break; case TYPE_VEC3: { LLVector3 v; v.setValue(sd); - spinner1->setVisible(true); - spinner1->setLabel(std::string("X")); - spinner2->setVisible(true); - spinner2->setLabel(std::string("Y")); - spinner3->setVisible(true); - spinner3->setLabel(std::string("Z")); - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("X")); + mValSpinner2->setVisible(true); + mValSpinner2->setLabel(std::string("Y")); + mValSpinner3->setVisible(true); + mValSpinner3->setLabel(std::string("Z")); + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(3); - spinner1->setValue(v[VX]); + mValSpinner1->setPrecision(3); + mValSpinner1->setValue(v[VX]); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setPrecision(3); - spinner2->setValue(v[VY]); + mValSpinner2->setPrecision(3); + mValSpinner2->setValue(v[VY]); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setPrecision(3); - spinner3->setValue(v[VZ]); + mValSpinner3->setPrecision(3); + mValSpinner3->setValue(v[VZ]); } break; } @@ -330,26 +329,26 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLVector3d v; v.setValue(sd); - spinner1->setVisible(true); - spinner1->setLabel(std::string("X")); - spinner2->setVisible(true); - spinner2->setLabel(std::string("Y")); - spinner3->setVisible(true); - spinner3->setLabel(std::string("Z")); - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("X")); + mValSpinner2->setVisible(true); + mValSpinner2->setLabel(std::string("Y")); + mValSpinner3->setVisible(true); + mValSpinner3->setLabel(std::string("Z")); + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(3); - spinner1->setValue(v[VX]); + mValSpinner1->setPrecision(3); + mValSpinner1->setValue(v[VX]); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setPrecision(3); - spinner2->setValue(v[VY]); + mValSpinner2->setPrecision(3); + mValSpinner2->setValue(v[VY]); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setPrecision(3); - spinner3->setValue(v[VZ]); + mValSpinner3->setPrecision(3); + mValSpinner3->setValue(v[VZ]); } break; } @@ -357,33 +356,33 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLQuaternion q; q.setValue(sd); - spinner1->setVisible(true); - spinner1->setLabel(std::string("X")); - spinner2->setVisible(true); - spinner2->setLabel(std::string("Y")); - spinner3->setVisible(true); - spinner3->setLabel(std::string("Z")); - spinner4->setVisible(true); - spinner4->setLabel(std::string("S")); - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("X")); + mValSpinner2->setVisible(true); + mValSpinner2->setLabel(std::string("Y")); + mValSpinner3->setVisible(true); + mValSpinner3->setLabel(std::string("Z")); + mValSpinner4->setVisible(true); + mValSpinner4->setLabel(std::string("S")); + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(4); - spinner1->setValue(q.mQ[VX]); + mValSpinner1->setPrecision(4); + mValSpinner1->setValue(q.mQ[VX]); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setPrecision(4); - spinner2->setValue(q.mQ[VY]); + mValSpinner2->setPrecision(4); + mValSpinner2->setValue(q.mQ[VY]); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setPrecision(4); - spinner3->setValue(q.mQ[VZ]); + mValSpinner3->setPrecision(4); + mValSpinner3->setValue(q.mQ[VZ]); } - if (!spinner4->hasFocus()) + if (!mValSpinner4->hasFocus()) { - spinner4->setPrecision(4); - spinner4->setValue(q.mQ[VS]); + mValSpinner4->setPrecision(4); + mValSpinner4->setValue(q.mQ[VS]); } break; } @@ -391,70 +390,70 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLRect r; r.setValue(sd); - spinner1->setVisible(true); - spinner1->setLabel(std::string("Left")); - spinner2->setVisible(true); - spinner2->setLabel(std::string("Right")); - spinner3->setVisible(true); - spinner3->setLabel(std::string("Bottom")); - spinner4->setVisible(true); - spinner4->setLabel(std::string("Top")); - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("Left")); + mValSpinner2->setVisible(true); + mValSpinner2->setLabel(std::string("Right")); + mValSpinner3->setVisible(true); + mValSpinner3->setLabel(std::string("Bottom")); + mValSpinner4->setVisible(true); + mValSpinner4->setLabel(std::string("Top")); + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(0); - spinner1->setValue(r.mLeft); + mValSpinner1->setPrecision(0); + mValSpinner1->setValue(r.mLeft); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setPrecision(0); - spinner2->setValue(r.mRight); + mValSpinner2->setPrecision(0); + mValSpinner2->setValue(r.mRight); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setPrecision(0); - spinner3->setValue(r.mBottom); + mValSpinner3->setPrecision(0); + mValSpinner3->setValue(r.mBottom); } - if (!spinner4->hasFocus()) + if (!mValSpinner4->hasFocus()) { - spinner4->setPrecision(0); - spinner4->setValue(r.mTop); + mValSpinner4->setPrecision(0); + mValSpinner4->setValue(r.mTop); } - spinner1->setMinValue((F32)S32_MIN); - spinner1->setMaxValue((F32)S32_MAX); - spinner1->setIncrement(1.f); + mValSpinner1->setMinValue((F32)S32_MIN); + mValSpinner1->setMaxValue((F32)S32_MAX); + mValSpinner1->setIncrement(1.f); - spinner2->setMinValue((F32)S32_MIN); - spinner2->setMaxValue((F32)S32_MAX); - spinner2->setIncrement(1.f); + mValSpinner2->setMinValue((F32)S32_MIN); + mValSpinner2->setMaxValue((F32)S32_MAX); + mValSpinner2->setIncrement(1.f); - spinner3->setMinValue((F32)S32_MIN); - spinner3->setMaxValue((F32)S32_MAX); - spinner3->setIncrement(1.f); + mValSpinner3->setMinValue((F32)S32_MIN); + mValSpinner3->setMaxValue((F32)S32_MAX); + mValSpinner3->setIncrement(1.f); - spinner4->setMinValue((F32)S32_MIN); - spinner4->setMaxValue((F32)S32_MAX); - spinner4->setIncrement(1.f); + mValSpinner4->setMinValue((F32)S32_MIN); + mValSpinner4->setMaxValue((F32)S32_MAX); + mValSpinner4->setIncrement(1.f); break; } case TYPE_COL4: { LLColor4 clr; clr.setValue(sd); - color_swatch->setVisible(true); + mColorSwatch->setVisible(true); // only set if changed so color picker doesn't update - if(clr != LLColor4(color_swatch->getValue())) + if(clr != LLColor4(mColorSwatch->getValue())) { - color_swatch->set(LLColor4(sd), true, false); + mColorSwatch->set(LLColor4(sd), true, false); } - spinner4->setVisible(true); - spinner4->setLabel(std::string("Alpha")); - if (!spinner4->hasFocus()) + mValSpinner4->setVisible(true); + mValSpinner4->setLabel(std::string("Alpha")); + if (!mValSpinner4->hasFocus()) { - spinner4->setPrecision(3); - spinner4->setMinValue(0.0); - spinner4->setMaxValue(1.f); - spinner4->setValue(clr.mV[VALPHA]); + mValSpinner4->setPrecision(3); + mValSpinner4->setMinValue(0.0); + mValSpinner4->setMaxValue(1.f); + mValSpinner4->setValue(clr.mV[VALPHA]); } break; } @@ -462,8 +461,8 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLColor3 clr; clr.setValue(sd); - color_swatch->setVisible(true); - color_swatch->setValue(sd); + mColorSwatch->setVisible(true); + mColorSwatch->setValue(sd); break; } default: @@ -624,15 +623,15 @@ void LLFloaterSettingsDebug::updateDefaultColumn(LLControlVariable* control) void LLFloaterSettingsDebug::hideUIControls() { - getChildView("val_spinner_1")->setVisible(false); - getChildView("val_spinner_2")->setVisible(false); - getChildView("val_spinner_3")->setVisible(false); - getChildView("val_spinner_4")->setVisible(false); - getChildView("val_color_swatch")->setVisible(false); - getChildView("val_text")->setVisible(false); - getChildView("default_btn")->setVisible(false); - getChildView("boolean_combo")->setVisible(false); - getChildView("setting_name_txt")->setVisible(false); + mValSpinner1->setVisible(false); + mValSpinner2->setVisible(false); + mValSpinner3->setVisible(false); + mValSpinner4->setVisible(false); + mColorSwatch->setVisible(false); + mValText->setVisible(false); + mDefaultButton->setVisible(false); + mBooleanCombo->setVisible(false); + mSettingNameText->setVisible(false); mComment->setVisible(false); } diff --git a/indra/newview/llfloatersettingsdebug.h b/indra/newview/llfloatersettingsdebug.h index 4df0dc8dd2..b813cf4a74 100644 --- a/indra/newview/llfloatersettingsdebug.h +++ b/indra/newview/llfloatersettingsdebug.h @@ -30,9 +30,12 @@ #include "llcontrol.h" #include "llfloater.h" +class LLColorSwatchCtrl; class LLScrollListCtrl; +class LLSpinCtrl; +class LLTextBox; -class LLFloaterSettingsDebug +class LLFloaterSettingsDebug final : public LLFloater { friend class LLFloaterReg; @@ -67,6 +70,16 @@ private: protected: class LLTextEditor* mComment; + LLSpinCtrl* mValSpinner1 = nullptr; + LLSpinCtrl* mValSpinner2 = nullptr; + LLSpinCtrl* mValSpinner3 = nullptr; + LLSpinCtrl* mValSpinner4 = nullptr; + LLUICtrl* mBooleanCombo = nullptr; + LLUICtrl* mValText = nullptr; + LLUICtrl* mDefaultButton = nullptr; + LLTextBox* mSettingNameText = nullptr; + + LLColorSwatchCtrl* mColorSwatch = nullptr; std::string mSearchFilter; }; diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index 6c5d2570f2..7bc95c2884 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -53,31 +53,39 @@ LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer() LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this); } +bool LLFloaterSidePanelContainer::postBuild() +{ + mMainPanel = getChild<LLPanel>(sMainPanelName); + return TRUE; +} + void LLFloaterSidePanelContainer::onOpen(const LLSD& key) { - getChild<LLPanel>(sMainPanelName)->onOpen(key); + mMainPanel->onOpen(key); } void LLFloaterSidePanelContainer::closeFloater(bool app_quitting) { - LLPanelOutfitEdit* panel_outfit_edit = - dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::findPanel("appearance", "panel_outfit_edit")); - if (panel_outfit_edit) + if(getInstanceName() == "appearance") { - LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit); - if (parent == this ) + LLPanelOutfitEdit* panel_outfit_edit = findChild<LLPanelOutfitEdit>("panel_outfit_edit"); + if (panel_outfit_edit) { - LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(getPanel("appearance")); - if (panel_appearance) + LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit); + if (parent == this) { - LLPanelEditWearable *edit_wearable_ptr = panel_appearance->getWearable(); - if (edit_wearable_ptr) - { - edit_wearable_ptr->onClose(); - } - if (!app_quitting) + LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(mMainPanel); + if (panel_appearance) { - panel_appearance->showOutfitsInventoryPanel(); + LLPanelEditWearable *edit_wearable_ptr = panel_appearance->getWearable(); + if (edit_wearable_ptr) + { + edit_wearable_ptr->onClose(); + } + if(!app_quitting) + { + panel_appearance->showOutfitsInventoryPanel(); + } } } } @@ -93,10 +101,9 @@ void LLFloaterSidePanelContainer::closeFloater(bool app_quitting) void LLFloaterSidePanelContainer::onClickCloseBtn(bool app_quitting) { - if (!app_quitting) + if (!app_quitting && getInstanceName() == "appearance") { - LLPanelOutfitEdit* panel_outfit_edit = - dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::findPanel("appearance", "panel_outfit_edit")); + LLPanelOutfitEdit* panel_outfit_edit = findChild<LLPanelOutfitEdit>("panel_outfit_edit"); if (panel_outfit_edit) { LLFloater* parent = gFloaterView->getParentFloater(panel_outfit_edit); @@ -206,10 +213,16 @@ void LLFloaterSidePanelContainer::showPanel(std::string_view floater_name, std:: LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, std::string_view panel_name) { LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name); - if (floaterp) { - return floaterp->findChild<LLPanel>(panel_name, true); + if (panel_name == sMainPanelName) + { + return floaterp->mMainPanel; + } + else + { + return floaterp->findChild<LLPanel>(panel_name, true); + } } return NULL; @@ -218,10 +231,16 @@ LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, st LLPanel* LLFloaterSidePanelContainer::findPanel(std::string_view floater_name, std::string_view panel_name) { LLFloaterSidePanelContainer* floaterp = LLFloaterReg::findTypedInstance<LLFloaterSidePanelContainer>(floater_name); - if (floaterp) { - return floaterp->findChild<LLPanel>(panel_name, true); + if (panel_name == sMainPanelName) + { + return floaterp->mMainPanel; + } + else + { + return floaterp->findChild<LLPanel>(panel_name, true); + } } return NULL; diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h index d7f6c309c4..4b9d0e34a7 100644 --- a/indra/newview/llfloatersidepanelcontainer.h +++ b/indra/newview/llfloatersidepanelcontainer.h @@ -49,6 +49,8 @@ public: LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams()); ~LLFloaterSidePanelContainer(); + bool postBuild() override; + void onOpen(const LLSD& key) override; void closeFloater(bool app_quitting = false) override; @@ -77,6 +79,11 @@ public: * @returns a pointer to the panel of given type T. */ template <typename T> + static T* findPanel(std::string_view floater_name, std::string_view panel_name = sMainPanelName) + { + return dynamic_cast<T*>(findPanel(floater_name, panel_name)); + } + template <typename T> static T* getPanel(std::string_view floater_name, std::string_view panel_name = sMainPanelName) { T* panel = dynamic_cast<T*>(getPanel(floater_name, panel_name)); @@ -89,6 +96,8 @@ public: protected: void onCloseMsgCallback(const LLSD& notification, const LLSD& response); + + LLPanel* mMainPanel = nullptr; }; #endif // LL_LLFLOATERSIDEPANELCONTAINER_H diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index aadc5b9580..f6d8fcab36 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -284,6 +284,15 @@ bool LLFloaterTools::postBuild() // the setting stores the actual force multiplier, but the slider is logarithmic, so we convert here getChild<LLUICtrl>("slider force")->setValue(log10(gSavedSettings.getF32("LandBrushForce"))); + mTextBulldozer = getChild<LLTextBox>("Bulldozer:"); + mTextDozerSize = getChild<LLTextBox>("Dozer Size:"); + mTextDozerStrength = getChild<LLTextBox>("Strength:"); + mSliderZoom = getChild<LLSlider>("slider zoom"); + + mTextSelectionCount = getChild<LLTextBox>("selection_count"); + mTextSelectionEmpty = getChild<LLTextBox>("selection_empty"); + mTextSelectionFaces = getChild<LLTextBox>("selection_faces"); + mCostTextBorder = getChild<LLViewBorder>("cost_text_border"); mTab = getChild<LLTabContainer>("Object Info Tabs"); @@ -450,10 +459,10 @@ void LLFloaterTools::refresh() { std::string obj_count_string; LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount()); - getChild<LLUICtrl>("selection_count")->setTextArg("[OBJ_COUNT]", obj_count_string); + mTextSelectionCount->setTextArg("[OBJ_COUNT]", obj_count_string); std::string prim_count_string; LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount()); - getChild<LLUICtrl>("selection_count")->setTextArg("[PRIM_COUNT]", prim_count_string); + mTextSelectionCount->setTextArg("[PRIM_COUNT]", prim_count_string); // calculate selection rendering cost if (sShowObjectCost) @@ -521,23 +530,18 @@ void LLFloaterTools::refresh() } } } - - childSetTextArg("selection_faces", "[FACES_STRING]", faces_str); + mTextSelectionFaces->setTextArg("[FACES_STRING]", faces_str); } bool show_faces = (object_count == 1) && LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool(); - getChildView("selection_faces")->setVisible(show_faces); + mTextSelectionFaces->setVisible(show_faces); LLStringUtil::format_map_t selection_args; selection_args["OBJ_COUNT"] = llformat("%.1d", link_count); selection_args["LAND_IMPACT"] = llformat("%.1d", (S32)link_cost); - std::ostringstream selection_info; - - selection_info << getString("status_selectcount", selection_args); - - getChild<LLTextBox>("selection_count")->setText(selection_info.str()); + mTextSelectionCount->setText(getString("status_selectcount", selection_args)); } @@ -618,8 +622,9 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) mBtnFocus ->setToggleState( focus_visible ); mRadioGroupFocus->setVisible( focus_visible ); - getChildView("slider zoom")->setVisible( focus_visible); - getChildView("slider zoom")->setEnabled(gCameraBtnZoom); + + mSliderZoom->setVisible( focus_visible); + mSliderZoom->setEnabled(gCameraBtnZoom); if (!gCameraBtnOrbit && !gCameraBtnPan && @@ -644,7 +649,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } // multiply by correction factor because volume sliders go [0, 0.5] - getChild<LLUICtrl>("slider zoom")->setValue(gAgentCamera.getCameraZoomFraction() * 0.5f); + mSliderZoom->setValue(gAgentCamera.getCameraZoomFraction() * 0.5f); // Move buttons bool move_visible = (tool == LLToolGrab::getInstance()); @@ -832,22 +837,22 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } if (mSliderDozerSize) { - mSliderDozerSize ->setVisible( land_visible ); - getChildView("Bulldozer:")->setVisible( land_visible); - getChildView("Dozer Size:")->setVisible( land_visible); + mSliderDozerSize->setVisible( land_visible ); + mTextBulldozer->setVisible( land_visible); + mTextDozerSize->setVisible( land_visible); } if (mSliderDozerForce) { - mSliderDozerForce ->setVisible( land_visible ); - getChildView("Strength:")->setVisible( land_visible); + mSliderDozerForce->setVisible( land_visible ); + mTextDozerStrength->setVisible( land_visible); } bool have_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty(); - getChildView("selection_count")->setVisible(!land_visible && have_selection); - getChildView("selection_faces")->setVisible(LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool() + mTextSelectionCount->setVisible(!land_visible && have_selection); + mTextSelectionFaces->setVisible(LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool() && LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1); - getChildView("selection_empty")->setVisible(!land_visible && !have_selection); + mTextSelectionEmpty->setVisible(!land_visible && !have_selection); mTab->setVisible(!land_visible); mPanelLandInfo->setVisible(land_visible); diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h index f9c3b401bb..0f7a61b733 100644 --- a/indra/newview/llfloatertools.h +++ b/indra/newview/llfloatertools.h @@ -148,6 +148,11 @@ public: LLButton *mBtnDuplicate; LLButton *mBtnDuplicateInPlace; + LLTextBox* mTextSelectionCount = nullptr; + LLTextBox* mTextSelectionEmpty = nullptr; + LLTextBox* mTextSelectionFaces = nullptr; + LLSlider* mSliderZoom = nullptr; + // Create buttons LLCheckBoxCtrl *mCheckSticky; LLCheckBoxCtrl *mCheckCopySelection; @@ -155,9 +160,12 @@ public: LLCheckBoxCtrl *mCheckCopyRotates; // Land buttons - LLRadioGroup* mRadioGroupLand; - LLSlider *mSliderDozerSize; - LLSlider *mSliderDozerForce; + LLRadioGroup* mRadioGroupLand = nullptr; + LLSlider *mSliderDozerSize = nullptr; + LLSlider *mSliderDozerForce = nullptr; + LLTextBox* mTextBulldozer = nullptr; + LLTextBox* mTextDozerSize = nullptr; + LLTextBox* mTextDozerStrength = nullptr; LLButton *mBtnApplyToSelection; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index fd7085c452..8334da1836 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -239,6 +239,11 @@ bool LLPanelMainInventory::postBuild() } } + mParentSidepanel = getParentSidepanelInventory(); + if (mParentSidepanel) + { + mInboxPanel = mParentSidepanel->getChild<LLPanelMarketplaceInbox>("marketplace_inbox"); + } mFilterEditor = getChild<LLFilterEditor>("inventory search editor"); if (mFilterEditor) @@ -303,31 +308,29 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) // for example, LLParamSDParser doesn't know about U64, // so some FilterOps params should be revised. LLSD filterRoot; - LLInventoryPanel* all_items_panel = getChild<LLInventoryPanel>(ALL_ITEMS); - if (all_items_panel) + if (mAllItemsPanel) { LLSD filterState; LLInventoryPanel::InventoryState p; - all_items_panel->getFilter().toParams(p.filter); - all_items_panel->getRootViewModel().getSorter().toParams(p.sort); + mAllItemsPanel->getFilter().toParams(p.filter); + mAllItemsPanel->getRootViewModel().getSorter().toParams(p.sort); if (p.validateBlock(false)) { LLParamSDParser().writeSD(filterState, p); - filterRoot[all_items_panel->getName()] = filterState; + filterRoot[mAllItemsPanel->getName()] = filterState; } } - LLInventoryPanel* panel = findChild<LLInventoryPanel>(RECENT_ITEMS); - if (panel) + if (mRecentPanel) { LLSD filterState; LLInventoryPanel::InventoryState p; - panel->getFilter().toParams(p.filter); - panel->getRootViewModel().getSorter().toParams(p.sort); + mRecentPanel->getFilter().toParams(p.filter); + mRecentPanel->getRootViewModel().getSorter().toParams(p.sort); if (p.validateBlock(false)) { LLParamSDParser().writeSD(filterState, p); - filterRoot[panel->getName()] = filterState; + filterRoot[mRecentPanel->getName()] = filterState; } } @@ -761,14 +764,9 @@ void LLPanelMainInventory::onClearSearch() } mFilterSubString = ""; - LLSidepanelInventory * sidepanel_inventory = getParentSidepanelInventory(); - if (sidepanel_inventory) + if (mInboxPanel) { - LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox"); - if (inbox_panel) - { - inbox_panel->onClearSearch(); - } + mInboxPanel->onClearSearch(); } } @@ -818,14 +816,9 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string ) // set new filter string setFilterSubString(mFilterSubString); - LLSidepanelInventory * sidepanel_inventory = getParentSidepanelInventory(); - if (sidepanel_inventory) + if (mInboxPanel) { - LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox"); - if (inbox_panel) - { - inbox_panel->onFilterEdit(search_string); - } + mInboxPanel->onFilterEdit(search_string); } } @@ -1530,17 +1523,13 @@ void LLPanelMainInventory::onAddButtonClick() void LLPanelMainInventory::setActivePanel() { // Todo: should cover gallery mode in some way - if(mSingleFolderMode && isListViewMode()) - { - mActivePanel = getChild<LLInventoryPanel>("comb_single_folder_inv"); - } - else if(mSingleFolderMode && isCombinationViewMode()) + if(mSingleFolderMode && (isListViewMode() || isCombinationViewMode())) { - mActivePanel = getChild<LLInventoryPanel>("comb_single_folder_inv"); + mActivePanel = mCombinationInventoryPanel; } else { - mActivePanel = (LLInventoryPanel*)getChild<LLTabContainer>("inventory filter tabs")->getCurrentPanel(); + mActivePanel = (LLInventoryPanel*)mFilterTabs->getCurrentPanel(); } mViewModeBtn->setEnabled(mSingleFolderMode || (getAllItemsPanel() == getActivePanel())); } @@ -1578,16 +1567,15 @@ void LLPanelMainInventory::toggleViewMode() updateTitle(); onFilterSelected(); - LLSidepanelInventory* sidepanel_inventory = getParentSidepanelInventory(); - if (sidepanel_inventory) + if (mParentSidepanel) { if(mSingleFolderMode) { - sidepanel_inventory->hideInbox(); + mParentSidepanel->hideInbox(); } else { - sidepanel_inventory->toggleInbox(); + mParentSidepanel->toggleInbox(); } } } diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 68ac3410d8..c1c7e9a7ab 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -49,6 +49,8 @@ class LLSidepanelInventory; class LLToggleableMenu; class LLFloater; class LLFloaterSidePanelContainer; +class LLSidepanelInventory; +class LLPanelMarketplaceInbox; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLPanelMainInventory @@ -244,6 +246,9 @@ protected: void setUploadCostIfNeeded(); void disableAddIfNeeded(); private: + LLSidepanelInventory* mParentSidepanel = nullptr; + LLPanelMarketplaceInbox* mInboxPanel = nullptr; + LLToggleableMenu* mMenuGearDefault; LLToggleableMenu* mMenuViewDefault; LLToggleableMenu* mMenuVisibility; diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 2f0a8f7656..107b1cf6cd 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -727,12 +727,14 @@ bool LLPanelPeople::postBuild() LL_WARNS() << "People->Groups list menu not found" << LL_ENDL; } - LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>("tab_all"); - accordion_tab->setDropDownStateChangedCallback( + mFriendsAccordion = friends_tab->getChild<LLAccordionCtrl>("friends_accordion"); + + mFriendsAllTab = mFriendsAccordion->getChild<LLAccordionCtrlTab>("tab_all"); + mFriendsAllTab->setDropDownStateChangedCallback( boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mAllFriendList)); - accordion_tab = getChild<LLAccordionCtrlTab>("tab_online"); - accordion_tab->setDropDownStateChangedCallback( + mFriendsOnlineTab = mFriendsAccordion->getChild<LLAccordionCtrlTab>("tab_online"); + mFriendsOnlineTab->setDropDownStateChangedCallback( boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mOnlineFriendList)); // Must go after setting commit callback and initializing all pointers to children. @@ -1064,8 +1066,8 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) mOnlineFriendList->setNameFilter(filter); mAllFriendList->setNameFilter(filter); - setAccordionCollapsedByUser("tab_online", false); - setAccordionCollapsedByUser("tab_all", false); + setAccordionCollapsedByUser(mFriendsOnlineTab, false); + setAccordionCollapsedByUser(mFriendsAllTab, false); showFriendsAccordionsIfNeeded(); // restore accordion tabs state _after_ all manipulations @@ -1108,7 +1110,6 @@ void LLPanelPeople::onGroupLimitInfo() void LLPanelPeople::onTabSelected(const LLSD& param) { - std::string tab_name = getChild<LLPanel>(param.asString())->getName(); updateButtons(); showFriendsAccordionsIfNeeded(); @@ -1142,9 +1143,9 @@ void LLPanelPeople::onAvatarListCommitted(LLAvatarList* list) uuid_vec_t selected_uuids; getCurrentItemIDs(selected_uuids); mMiniMap->setSelected(selected_uuids); - } else + } // Make sure only one of the friends lists (online/all) has selection. - if (getActiveTabName() == FRIENDS_TAB_NAME) + else if (getActiveTabName() == FRIENDS_TAB_NAME) { if (list == mOnlineFriendList) mAllFriendList->resetSelection(true); @@ -1169,12 +1170,9 @@ void LLPanelPeople::onAddFriendButtonClicked() bool LLPanelPeople::isItemsFreeOfFriends(const uuid_vec_t& uuids) { const LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); - for ( uuid_vec_t::const_iterator - id = uuids.begin(), - id_end = uuids.end(); - id != id_end; ++id ) + for (const LLUUID& uuid : uuids) { - if (av_tracker.isBuddy (*id)) + if (av_tracker.isBuddy(uuid)) { return false; } @@ -1479,15 +1477,8 @@ bool LLPanelPeople::notifyChildren(const LLSD& info) return LLPanel::notifyChildren(info); } -void LLPanelPeople::showAccordion(const std::string name, bool show) +void LLPanelPeople::showAccordion(LLAccordionCtrlTab* tab, bool show) { - if(name.empty()) - { - LL_WARNS() << "No name provided" << LL_ENDL; - return; - } - - LLAccordionCtrlTab* tab = getChild<LLAccordionCtrlTab>(name); tab->setVisible(show); if(show) { @@ -1505,12 +1496,11 @@ void LLPanelPeople::showFriendsAccordionsIfNeeded() if(FRIENDS_TAB_NAME == getActiveTabName()) { // Expand and show accordions if needed, else - hide them - showAccordion("tab_online", mOnlineFriendList->filterHasMatches()); - showAccordion("tab_all", mAllFriendList->filterHasMatches()); + showAccordion(mFriendsOnlineTab, mOnlineFriendList->filterHasMatches()); + showAccordion(mFriendsAllTab, mAllFriendList->filterHasMatches()); // Rearrange accordions - LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("friends_accordion"); - accordion->arrange(); + mFriendsAccordion->arrange(); // *TODO: new no_matched_tabs_text attribute was implemented in accordion (EXT-7368). // this code should be refactored to use it @@ -1523,11 +1513,11 @@ void LLPanelPeople::onFriendListRefreshComplete(LLUICtrl*ctrl, const LLSD& param { if(ctrl == mOnlineFriendList) { - showAccordion("tab_online", param.asInteger()); + showAccordion(mFriendsOnlineTab, param.asInteger()); } else if(ctrl == mAllFriendList) { - showAccordion("tab_all", param.asInteger()); + showAccordion(mFriendsAllTab, param.asInteger()); } } diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 445bc4c081..aef66db980 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -40,6 +40,8 @@ class LLGroupList; class LLMenuButton; class LLTabContainer; class LLNetMap; +class LLAccordionCtrl; +class LLAccordionCtrlTab; class LLPanelPeople : public LLPanel @@ -120,7 +122,7 @@ private: void onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list); - void showAccordion(const std::string name, bool show); + void showAccordion(LLAccordionCtrlTab* tab, bool show); void showFriendsAccordionsIfNeeded(); @@ -139,6 +141,10 @@ private: LLGroupList* mGroupList; LLNetMap* mMiniMap; + LLAccordionCtrl* mFriendsAccordion = nullptr; + LLAccordionCtrlTab* mFriendsAllTab = nullptr; + LLAccordionCtrlTab* mFriendsOnlineTab = nullptr; + LLButton* mNearbyGearBtn = nullptr; LLButton* mFriendsGearBtn = nullptr; LLButton* mRecentGearBtn = nullptr; diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 620b7c8b2d..9a991727b2 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -67,8 +67,7 @@ // Default constructor LLPreviewNotecard::LLPreviewNotecard(const LLSD& key) //const LLUUID& item_id, - : LLPreview( key ), - mLiveFile(NULL) + : LLPreview( key ) { const LLInventoryItem *item = getItem(); if (item) @@ -88,24 +87,30 @@ bool LLPreviewNotecard::postBuild() mEditor->setNotecardInfo(mItemUUID, mObjectID, getKey()); mEditor->makePristine(); - childSetAction("Save", onClickSave, this); - getChildView("lock")->setVisible( false); + mSaveBtn = getChild<LLButton>("Save"); + mSaveBtn->setCommitCallback(boost::bind(&LLPreviewNotecard::saveIfNeeded, this, nullptr, true)); - childSetAction("Delete", onClickDelete, this); - getChildView("Delete")->setEnabled(false); + mLockBtn = getChild<LLUICtrl>("lock"); + mLockBtn->setVisible(false); - childSetAction("Edit", onClickEdit, this); + mDeleteBtn = getChild<LLButton>("Delete"); + mDeleteBtn->setCommitCallback(boost::bind(&LLPreviewNotecard::deleteNotecard, this)); + mDeleteBtn->setEnabled(false); + + mEditBtn = getChild<LLButton>("Edit"); + mEditBtn->setCommitCallback(boost::bind(&LLPreviewNotecard::openInExternalEditor, this)); const LLInventoryItem* item = getItem(); - childSetCommitCallback("desc", LLPreview::onText, this); + mDescEditor = getChild<LLLineEditor>("desc"); + mDescEditor->setCommitCallback(boost::bind(&LLPreview::onText, mDescEditor, this)); if (item) { - getChild<LLUICtrl>("desc")->setValue(item->getDescription()); + mDescEditor->setValue(item->getDescription()); bool source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID()); - getChildView("Delete")->setEnabled(!source_library); + mDeleteBtn->setEnabled(!source_library); } - getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); + mDescEditor->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); return LLPreview::postBuild(); } @@ -118,22 +123,30 @@ bool LLPreviewNotecard::saveItem() void LLPreviewNotecard::setEnabled(bool enabled) { - - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - getChildView("Notecard Editor")->setEnabled(enabled); - getChildView("lock")->setVisible( !enabled); - getChildView("desc")->setEnabled(enabled); - getChildView("Save")->setEnabled(enabled && editor && (!editor->isPristine())); + if (mEditor) + { + mEditor->setEnabled(enabled); + } + if (mLockBtn) + { + mLockBtn->setVisible(!enabled); + } + if (mDescEditor) + { + mDescEditor->setEnabled(enabled); + } + if (mSaveBtn) + { + mSaveBtn->setEnabled(enabled && mEditor && (!mEditor->isPristine())); + } } void LLPreviewNotecard::draw() { - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - bool changed = !editor->isPristine(); + bool changed = !mEditor->isPristine(); - getChildView("Save")->setEnabled(changed && getEnabled()); + mSaveBtn->setEnabled(changed && getEnabled()); LLPreview::draw(); } @@ -153,9 +166,7 @@ bool LLPreviewNotecard::handleKeyHere(KEY key, MASK mask) // virtual bool LLPreviewNotecard::canClose() { - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - if(mForceClose || editor->isPristine()) + if(mForceClose || mEditor->isPristine()) { return true; } @@ -176,28 +187,18 @@ void LLPreviewNotecard::setObjectID(const LLUUID& object_id) { LLPreview::setObjectID(object_id); - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - editor->setNotecardObjectID(mObjectUUID); - editor->makePristine(); + mEditor->setNotecardObjectID(mObjectUUID); + mEditor->makePristine(); } const LLInventoryItem* LLPreviewNotecard::getDragItem() { - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - if(editor) - { - return editor->getDragItem(); - } - return NULL; + return mEditor->getDragItem(); } bool LLPreviewNotecard::hasEmbeddedInventory() { - LLViewerTextEditor* editor = NULL; - editor = getChild<LLViewerTextEditor>("Notecard Editor"); - if (!editor) return false; - return editor->hasEmbeddedInventory(); + return mEditor->hasEmbeddedInventory(); } void LLPreviewNotecard::refreshFromInventory(const LLUUID& new_item_id) @@ -215,10 +216,9 @@ void LLPreviewNotecard::updateTitleButtons() { LLPreview::updateTitleButtons(); - LLUICtrl* lock_btn = getChild<LLUICtrl>("lock"); - if(lock_btn->getVisible() && !isMinimized()) // lock button stays visible if floater is minimized. + if(mLockBtn && mLockBtn->getVisible() && !isMinimized()) // lock button stays visible if floater is minimized. { - LLRect lock_rc = lock_btn->getRect(); + LLRect lock_rc = mLockBtn->getRect(); LLRect buttons_rect = getDragHandle()->getButtonsRect(); buttons_rect.mLeft = lock_rc.mLeft; getDragHandle()->setButtonsRect(buttons_rect); @@ -229,11 +229,6 @@ void LLPreviewNotecard::loadAsset() { // request the asset. const LLInventoryItem* item = getItem(); - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - if (!editor) - return; - bool fail = false; if(item) @@ -249,9 +244,9 @@ void LLPreviewNotecard::loadAsset() mAssetID = item->getAssetUUID(); if(mAssetID.isNull()) { - editor->setText(LLStringUtil::null); - editor->makePristine(); - editor->setEnabled(true); + mEditor->setText(LLStringUtil::null); + mEditor->makePristine(); + mEditor->setEnabled(true); mAssetStatus = PREVIEW_ASSET_LOADED; } else @@ -270,9 +265,9 @@ void LLPreviewNotecard::loadAsset() // The object that we're trying to look at disappeared, bail. LL_WARNS() << "Can't find object " << mObjectUUID << " associated with notecard." << LL_ENDL; mAssetID.setNull(); - editor->setText(getString("no_object")); - editor->makePristine(); - editor->setEnabled(false); + mEditor->setText(getString("no_object")); + mEditor->makePristine(); + mEditor->setEnabled(false); mAssetStatus = PREVIEW_ASSET_LOADED; return; } @@ -301,22 +296,22 @@ void LLPreviewNotecard::loadAsset() else { mAssetID.setNull(); - editor->setText(getString("not_allowed")); - editor->makePristine(); - editor->setEnabled(false); + mEditor->setText(getString("not_allowed")); + mEditor->makePristine(); + mEditor->setEnabled(false); mAssetStatus = PREVIEW_ASSET_LOADED; } if(!allow_modify) { - editor->setEnabled(false); - getChildView("lock")->setVisible( true); - getChildView("Edit")->setEnabled(false); + mEditor->setEnabled(false); + mLockBtn->setVisible( true); + mEditBtn->setEnabled(false); } if((allow_modify || is_owner) && !source_library) { - getChildView("Delete")->setEnabled(true); + mDeleteBtn->setEnabled(true); } } else if (mObjectUUID.notNull() && mItemUUID.notNull()) @@ -345,9 +340,9 @@ void LLPreviewNotecard::loadAsset() if (fail) { - editor->setText(LLStringUtil::null); - editor->makePristine(); - editor->setEnabled(true); + mEditor->setText(LLStringUtil::null); + mEditor->makePristine(); + mEditor->setEnabled(true); // Don't set asset status here; we may not have set the item id yet // (e.g. when this gets called initially) //mAssetStatus = PREVIEW_ASSET_LOADED; @@ -377,7 +372,7 @@ void LLPreviewNotecard::onLoadComplete(const LLUUID& asset_uuid, buffer[file_length] = 0; - LLViewerTextEditor* previewEditor = preview->getChild<LLViewerTextEditor>("Notecard Editor"); + LLViewerTextEditor* previewEditor = preview->mEditor; if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) ) { @@ -421,38 +416,6 @@ void LLPreviewNotecard::onLoadComplete(const LLUUID& asset_uuid, delete floater_key; } -// static -void LLPreviewNotecard::onClickSave(void* user_data) -{ - //LL_INFOS() << "LLPreviewNotecard::onBtnSave()" << LL_ENDL; - LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data; - if(preview) - { - preview->saveIfNeeded(); - } -} - - -// static -void LLPreviewNotecard::onClickDelete(void* user_data) -{ - LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data; - if(preview) - { - preview->deleteNotecard(); - } -} - -// static -void LLPreviewNotecard::onClickEdit(void* user_data) -{ - LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data; - if (preview) - { - preview->openInExternalEditor(); - } -} - struct LLSaveNotecardInfo { LLPreviewNotecard* mSelf; @@ -515,23 +478,15 @@ void LLPreviewNotecard::finishTaskUpload(LLUUID itemId, LLUUID newAssetId, LLUUI bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync) { - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - if(!editor) - { - LL_WARNS() << "Cannot get handle to the notecard editor." << LL_ENDL; - return false; - } - - if(!editor->isPristine()) + if(!mEditor->isPristine()) { std::string buffer; - if (!editor->exportBuffer(buffer)) + if (!mEditor->exportBuffer(buffer)) { return false; } - editor->makePristine(); + mEditor->makePristine(); const LLInventoryItem* item = getItem(); // save it out to database if (item) @@ -692,11 +647,7 @@ void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data // Perform item copy to inventory if (info->mCopyItem.notNull()) { - LLViewerTextEditor* editor = info->mSelf->getChild<LLViewerTextEditor>("Notecard Editor"); - if (editor) - { - editor->copyInventory(info->mCopyItem); - } + info->mSelf->mEditor->copyInventory(info->mCopyItem); } // Find our window and close it if requested. @@ -731,7 +682,7 @@ bool LLPreviewNotecard::handleSaveChangesDialog(const LLSD& notification, const { case 0: // "Yes" mCloseAfterSave = true; - LLPreviewNotecard::onClickSave((void*)this); + saveIfNeeded(); break; case 1: // "No" diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h index db677b1cf9..be3c804f9b 100644 --- a/indra/newview/llpreviewnotecard.h +++ b/indra/newview/llpreviewnotecard.h @@ -41,6 +41,7 @@ class LLViewerTextEditor; class LLButton; +class LLLineEditor; class LLPreviewNotecard : public LLPreview, public LLVOInventoryListener { @@ -93,12 +94,6 @@ protected: LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status); - static void onClickSave(void* data); - - static void onClickDelete(void* data); - - static void onClickEdit(void* data); - static void onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status); @@ -116,14 +111,18 @@ protected: std::string getTmpFileName(); protected: - LLViewerTextEditor* mEditor; - LLButton* mSaveBtn; + LLViewerTextEditor* mEditor = nullptr; + LLLineEditor* mDescEditor = nullptr; + LLButton* mSaveBtn = nullptr; + LLButton* mEditBtn = nullptr; + LLButton* mDeleteBtn = nullptr; + LLUICtrl* mLockBtn = nullptr; LLUUID mAssetID; LLUUID mObjectID; - LLLiveLSLFile* mLiveFile; + LLLiveLSLFile* mLiveFile = nullptr; }; diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index b7c929f0b5..02a4c7fb26 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -435,7 +435,7 @@ void LLLiveLSLEditor::experienceChanged() if(mScriptEd->getAssociatedExperience() != mExperiences->getSelectedValue().asUUID()) { mScriptEd->enableSave(getIsModifiable()); - //getChildView("Save_btn")->setEnabled(true); + //mSaveBtn->setEnabled(true); mScriptEd->setAssociatedExperience(mExperiences->getSelectedValue().asUUID()); updateExperiencePanel(); } @@ -481,6 +481,7 @@ void LLLiveLSLEditor::onToggleExperience( LLUICtrl *ui, void* userdata ) bool LLScriptEdCore::postBuild() { + mLineCol = getChild<LLTextBox>("line_col"); mErrorList = getChild<LLScrollListCtrl>("lsl errors"); mFunctions = getChild<LLComboBox>("Insert..."); @@ -490,7 +491,8 @@ bool LLScriptEdCore::postBuild() mEditor = getChild<LLScriptEditor>("Script Editor"); childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this); - childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,false)); + mSaveBtn = getChild<LLButton>("Save_btn"); + mSaveBtn->setCommitCallback(boost::bind(&LLScriptEdCore::doSave, this, false)); childSetAction("Edit_btn", boost::bind(&LLScriptEdCore::openInExternalEditor, this)); initMenu(); @@ -711,7 +713,7 @@ bool LLScriptEdCore::hasChanged() void LLScriptEdCore::draw() { bool script_changed = hasChanged(); - getChildView("Save_btn")->setEnabled(script_changed && !mScriptRemoved); + mSaveBtn->setEnabled(script_changed && !mScriptRemoved); if( mEditor->hasFocus() ) { @@ -723,11 +725,11 @@ void LLScriptEdCore::draw() args["[LINE]"] = llformat ("%d", line); args["[COLUMN]"] = llformat ("%d", column); cursor_pos = LLTrans::getString("CursorPos", args); - getChild<LLUICtrl>("line_col")->setValue(cursor_pos); + mLineCol->setValue(cursor_pos); } else { - getChild<LLUICtrl>("line_col")->setValue(LLStringUtil::null); + mLineCol->setValue(LLStringUtil::null); } updateDynamicHelp(); diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 9a3bc35f12..70ee1a4274 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -195,6 +195,8 @@ private: bool mScriptRemoved; bool mSaveDialogShown; LLUUID mAssetID; + LLTextBox* mLineCol = nullptr; + LLButton* mSaveBtn = nullptr; LLScriptEdContainer* mContainer; // parent view diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 2a5d7f2450..1b657d9ea1 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -129,6 +129,10 @@ void LLPreviewTexture::populateRatioList() // virtual bool LLPreviewTexture::postBuild() { + mButtonsPanel = getChild<LLLayoutPanel>("buttons_panel"); + mDimensionsText = getChild<LLUICtrl>("dimensions"); + mAspectRatioText = getChild<LLUICtrl>("aspect_ratio"); + if (mCopyToInv) { getChild<LLButton>("Keep")->setLabel(getString("Copy")); @@ -346,15 +350,20 @@ void LLPreviewTexture::reshape(S32 width, S32 height, bool called_from_parent) { LLPreview::reshape(width, height, called_from_parent); - LLRect dim_rect(getChildView("dimensions")->getRect()); - S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE; // add space for dimensions and aspect ratio - S32 info_height = dim_rect.mTop + CLIENT_RECT_VPAD; - if (getChild<LLLayoutPanel>("buttons_panel")->getVisible()) + S32 info_height = CLIENT_RECT_VPAD; + + if (mDimensionsText) + { + LLRect dim_rect(mDimensionsText->getRect()); + info_height += dim_rect.mTop; + } + + if (mButtonsPanel && mButtonsPanel->getVisible()) { - info_height += getChild<LLLayoutPanel>("buttons_panel")->getRect().getHeight(); + info_height += mButtonsPanel->getRect().getHeight(); } LLRect client_rect(horiz_pad, getRect().getHeight(), getRect().getWidth() - horiz_pad, 0); client_rect.mTop -= (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD); @@ -404,8 +413,8 @@ void LLPreviewTexture::hideCtrlButtons() { getChildView("desc txt")->setVisible(false); getChildView("desc")->setVisible(false); - getChild<LLLayoutStack>("preview_stack")->collapsePanel(getChild<LLLayoutPanel>("buttons_panel"), true); - getChild<LLLayoutPanel>("buttons_panel")->setVisible(false); + getChild<LLLayoutStack>("preview_stack")->collapsePanel(mButtonsPanel, true); + mButtonsPanel->setVisible(false); getChild<LLComboBox>("combo_aspect_ratio")->setCurrentByIndex(0); //unconstrained reshape(getRect().getWidth(), getRect().getHeight()); } @@ -538,8 +547,8 @@ void LLPreviewTexture::updateDimensions() // Update the width/height display every time - getChild<LLUICtrl>("dimensions")->setTextArg("[WIDTH]", llformat("%d", img_width)); - getChild<LLUICtrl>("dimensions")->setTextArg("[HEIGHT]", llformat("%d", img_height)); + mDimensionsText->setTextArg("[WIDTH]", llformat("%d", img_width)); + mDimensionsText->setTextArg("[HEIGHT]", llformat("%d", img_height)); mLastHeight = img_height; mLastWidth = img_width; @@ -554,9 +563,9 @@ void LLPreviewTexture::updateDimensions() gFloaterView->adjustToFitScreen(this, false); - LLRect dim_rect(getChildView("dimensions")->getRect()); - LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect()); - getChildView("aspect_ratio")->setVisible( dim_rect.mRight < aspect_label_rect.mLeft); + LLRect dim_rect(mDimensionsText->getRect()); + LLRect aspect_label_rect(mAspectRatioText->getRect()); + mAspectRatioText->setVisible( dim_rect.mRight < aspect_label_rect.mLeft); } } diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index e55d61ef10..44f3f07339 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -34,6 +34,7 @@ class LLComboBox; class LLImageRaw; +class LLLayoutPanel; class LLPreviewTexture : public LLPreview { @@ -105,5 +106,9 @@ private: LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; std::vector<std::string> mRatiosList; + + LLLayoutPanel* mButtonsPanel = nullptr; + LLUICtrl* mDimensionsText = nullptr; + LLUICtrl* mAspectRatioText = nullptr; }; #endif // LL_LLPREVIEWTEXTURE_H diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index f75e48c728..44c2a8fdaf 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -55,12 +55,12 @@ LLRect LLScreenChannelBase::getChannelRect() if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } if (mChicletRegion == NULL) { - mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container"); + mChicletRegion = gViewerWindow->getChicletContainer(); } LLRect channel_rect; @@ -103,12 +103,12 @@ bool LLScreenChannelBase::postBuild() { if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } if (mChicletRegion == NULL) { - mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container"); + mChicletRegion = gViewerWindow->getChicletContainer(); } return true; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 529d6f97ca..97d5781566 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -10125,7 +10125,6 @@ void initialize_menus() commit.add("Object.Buy", boost::bind(&handle_buy)); commit.add("Object.Edit", boost::bind(&handle_object_edit)); - commit.add("Object.Edit", boost::bind(&handle_object_edit)); commit.add("Object.EditGLTFMaterial", boost::bind(&handle_object_edit_gltf_material)); commit.add("Object.Inspect", boost::bind(&handle_object_inspect)); commit.add("Object.Open", boost::bind(&handle_object_open)); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index b13ccda5e0..8ea8fbf905 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2064,6 +2064,9 @@ void LLViewerWindow::initBase() mPopupView = main_view->getChild<LLPopupView>("popup_holder"); mHintHolder = main_view->getChild<LLView>("hint_holder")->getHandle(); mLoginPanelHolder = main_view->getChild<LLView>("login_panel_holder")->getHandle(); + mStatusBarContainer = main_view->getChild<LLPanel>("status_bar_container"); + mNavBarContainer = mStatusBarContainer->getChild<LLView>("nav_bar_container"); + mTopInfoContainer = main_view->getChild<LLPanel>("topinfo_bar_container"); // Create the toolbar view // Get a pointer to the toolbar view holder @@ -2079,6 +2082,8 @@ void LLViewerWindow::initBase() // Hide the toolbars for the moment: we'll make them visible after logging in world (see LLViewerWindow::initWorldUI()) gToolBarView->setVisible(false); + mFloaterSnapRegion = gToolBarView->getChild<LLView>("floater_snap_region"); + mChicletContainer = gToolBarView->getChild<LLPanel>("chiclet_container"); // Constrain floaters to inside the menu and status bar regions. gFloaterView = main_view->getChild<LLFloaterView>("Floater View"); for (S32 i = 0; i < LLToolBarEnums::TOOLBAR_COUNT; ++i) @@ -2089,7 +2094,7 @@ void LLViewerWindow::initBase() toolbarp->getCenterLayoutPanel()->setReshapeCallback(boost::bind(&LLFloaterView::setToolbarRect, gFloaterView, _1, _2)); } } - gFloaterView->setFloaterSnapView(main_view->getChild<LLView>("floater_snap_region")->getHandle()); + gFloaterView->setFloaterSnapView(mFloaterSnapRegion->getHandle()); gSnapshotFloaterView = main_view->getChild<LLSnapshotFloaterView>("Snapshot Floater View"); const F32 CHAT_PERSIST_TIME = 20.f; @@ -2155,12 +2160,11 @@ void LLViewerWindow::initWorldUI() if (!gNonInteractive) { - LLPanel* chiclet_container = getRootView()->getChild<LLPanel>("chiclet_container"); LLChicletBar* chiclet_bar = LLChicletBar::getInstance(); - chiclet_bar->setShape(chiclet_container->getLocalRect()); + chiclet_bar->setShape(mChicletContainer->getLocalRect()); chiclet_bar->setFollowsAll(); - chiclet_container->addChild(chiclet_bar); - chiclet_container->setVisible(true); + mChicletContainer->addChild(chiclet_bar); + mChicletContainer->setVisible(true); } LLRect morph_view_rect = full_window; @@ -2185,30 +2189,25 @@ void LLViewerWindow::initWorldUI() if (!gStatusBar) { // Status bar - LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); - gStatusBar = new LLStatusBar(status_bar_container->getLocalRect()); + gStatusBar = new LLStatusBar(mStatusBarContainer->getLocalRect()); gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_RIGHT); - gStatusBar->setShape(status_bar_container->getLocalRect()); + gStatusBar->setShape(mStatusBarContainer->getLocalRect()); // sync bg color with menu bar gStatusBar->setBackgroundColor(gMenuBarView->getBackgroundColor()); // add InBack so that gStatusBar won't be drawn over menu - status_bar_container->addChildInBack(gStatusBar, 2/*tab order, after menu*/); - status_bar_container->setVisible(true); + mStatusBarContainer->addChildInBack(gStatusBar, 2/*tab order, after menu*/); + mStatusBarContainer->setVisible(true); // Navigation bar - LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); - - navbar->setShape(nav_bar_container->getLocalRect()); + navbar->setShape(mNavBarContainer->getLocalRect()); navbar->setBackgroundColor(gMenuBarView->getBackgroundColor()); - nav_bar_container->addChild(navbar); - nav_bar_container->setVisible(true); + mNavBarContainer->addChild(navbar); + mNavBarContainer->setVisible(true); } else { - LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); - LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); - status_bar_container->setVisible(true); - nav_bar_container->setVisible(true); + mStatusBarContainer->setVisible(true); + mNavBarContainer->setVisible(true); } if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel")) @@ -2222,13 +2221,11 @@ void LLViewerWindow::initWorldUI() // Top Info bar - LLPanel* topinfo_bar_container = getRootView()->getChild<LLPanel>("topinfo_bar_container"); LLPanelTopInfoBar* topinfo_bar = LLPanelTopInfoBar::getInstance(); + topinfo_bar->setShape(mTopInfoContainer->getLocalRect()); - topinfo_bar->setShape(topinfo_bar_container->getLocalRect()); - - topinfo_bar_container->addChild(topinfo_bar); - topinfo_bar_container->setVisible(true); + mTopInfoContainer->addChild(topinfo_bar); + mTopInfoContainer->setVisible(true); if (!gSavedSettings.getBOOL("ShowMiniLocationPanel")) { @@ -2248,7 +2245,7 @@ void LLViewerWindow::initWorldUI() getRootView()->sendChildToBack(gHUDView); } - LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container"); + LLPanel* panel_ssf_container = gToolBarView->getChild<LLPanel>("state_management_buttons_container"); LLPanelStandStopFlying* panel_stand_stop_flying = LLPanelStandStopFlying::getInstance(); panel_ssf_container->addChild(panel_stand_stop_flying); @@ -2571,12 +2568,11 @@ void LLViewerWindow::setNormalControlsVisible( bool visible ) gStatusBar->setEnabled( visible ); } - LLNavigationBar* navbarp = LLUI::getInstance()->getRootView()->findChild<LLNavigationBar>("navigation_bar"); - if (navbarp) + if (mNavBarContainer) { // when it's time to show navigation bar we need to ensure that the user wants to see it // i.e. ShowNavbarNavigationPanel option is true - navbarp->setVisible( visible && gSavedSettings.getBOOL("ShowNavbarNavigationPanel") ); + mNavBarContainer->setVisible( visible && gSavedSettings.getBOOL("ShowNavbarNavigationPanel") ); } } @@ -5954,23 +5950,20 @@ LLRect LLViewerWindow::getChatConsoleRect() void LLViewerWindow::reshapeStatusBarContainer() { - LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); - LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); - - S32 new_height = status_bar_container->getRect().getHeight(); - S32 new_width = status_bar_container->getRect().getWidth(); + S32 new_height = mStatusBarContainer->getRect().getHeight(); + S32 new_width = mStatusBarContainer->getRect().getWidth(); if (gSavedSettings.getBOOL("ShowNavbarNavigationPanel")) { // Navigation bar is outside visible area, expand status_bar_container to show it - new_height += nav_bar_container->getRect().getHeight(); + new_height += mNavBarContainer->getRect().getHeight(); } else { // collapse status_bar_container - new_height -= nav_bar_container->getRect().getHeight(); + new_height -= mNavBarContainer->getRect().getHeight(); } - status_bar_container->reshape(new_width, new_height, true); + mStatusBarContainer->reshape(new_width, new_height, true); } void LLViewerWindow::resetStatusBarContainer() @@ -5979,12 +5972,10 @@ void LLViewerWindow::resetStatusBarContainer() if (gSavedSettings.getBOOL("ShowNavbarNavigationPanel") || navbar->getVisible()) { // was previously showing navigation bar - LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); - LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); - S32 new_height = status_bar_container->getRect().getHeight(); - S32 new_width = status_bar_container->getRect().getWidth(); - new_height -= nav_bar_container->getRect().getHeight(); - status_bar_container->reshape(new_width, new_height, true); + S32 new_height = mStatusBarContainer->getRect().getHeight(); + S32 new_width = mStatusBarContainer->getRect().getWidth(); + new_height -= mNavBarContainer->getRect().getHeight(); + mStatusBarContainer->reshape(new_width, new_height, true); } } //---------------------------------------------------------------------------- @@ -6011,7 +6002,7 @@ void LLViewerWindow::setUIVisibility(bool visible) LLNavigationBar::getInstance()->setVisible(visible ? gSavedSettings.getBOOL("ShowNavbarNavigationPanel") : false); LLPanelTopInfoBar::getInstance()->setVisible(visible? gSavedSettings.getBOOL("ShowMiniLocationPanel") : false); - mRootView->getChildView("status_bar_container")->setVisible(visible); + mStatusBarContainer->setVisible(visible); } bool LLViewerWindow::getUIVisibility() diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index ba59ce4141..395d8c78da 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -463,6 +463,9 @@ public: static std::string getLastSnapshotDir(); + LLView* getFloaterSnapRegion() { return mFloaterSnapRegion; } + LLPanel* getChicletContainer() { return mChicletContainer; } + private: bool shouldShowToolTipFor(LLMouseHandler *mh); @@ -491,6 +494,11 @@ private: LLRect mWorldViewRectRaw; // area of screen for 3D world LLRect mWorldViewRectScaled; // area of screen for 3D world scaled by UI size LLRootView* mRootView; // a view of size mWindowRectRaw, containing all child views + LLView* mFloaterSnapRegion = nullptr; + LLView* mNavBarContainer = nullptr; + LLPanel* mStatusBarContainer = nullptr; + LLPanel* mChicletContainer = nullptr; + LLPanel* mTopInfoContainer = nullptr; LLVector2 mDisplayScale; LLCoordGL mCurrentMousePoint; // last mouse position in GL coords diff --git a/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml b/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml index fb528bf98f..425cbb6f44 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml @@ -69,7 +69,6 @@ sort_ascending="true" width="495" /> <button - enabled_control="FirstSelectedDisabledPopups" follows="top|left" height="23" image_overlay="Arrow_Up" @@ -83,7 +82,6 @@ function="Pref.ClickEnablePopup" /> </button> <button - enabled_control="FirstSelectedEnabledPopups" follows="top|left" height="23" image_overlay="Arrow_Down" |