From 71e4e26ebe96a03b63e1dae99bd13ec9c3bd2dbb Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 27 Mar 2019 19:04:49 +0200 Subject: SL-10806 [Legacy Profiles] Classified tab, classifieds contain two scrollbars --- indra/newview/llpanelprofileclassifieds.cpp | 30 +- indra/newview/llpanelprofileclassifieds.h | 6 +- .../default/xui/en/panel_profile_classified.xml | 599 +++++++++++---------- 3 files changed, 333 insertions(+), 302 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelprofileclassifieds.cpp b/indra/newview/llpanelprofileclassifieds.cpp index 67fe17ed70..3a5347018d 100644 --- a/indra/newview/llpanelprofileclassifieds.cpp +++ b/indra/newview/llpanelprofileclassifieds.cpp @@ -62,6 +62,7 @@ const S32 MAX_AVATAR_CLASSIFIEDS = 100; const S32 MINIMUM_PRICE_FOR_LISTING = 50; // L$ +const S32 DEFAULT_EDIT_CLASSIFIED_SCROLL_HEIGHT = 530; //static LLPanelProfileClassified::panel_list_t LLPanelProfileClassified::sAllPanels; @@ -433,7 +434,8 @@ LLPanelProfileClassified* LLPanelProfileClassified::create() BOOL LLPanelProfileClassified::postBuild() { mScrollContainer = getChild("profile_scroll"); - mInfoPanel = getChild("info_panel"); + mInfoPanel = getChild("info_panel"); + mInfoScroll = getChild("info_scroll_content_panel"); mEditPanel = getChild("edit_panel"); mSnapshotCtrl = getChild("classified_snapshot"); @@ -441,7 +443,7 @@ BOOL LLPanelProfileClassified::postBuild() //info mClassifiedNameText = getChild("classified_name"); - mClassifiedDescText = getChild("classified_desc"); + mClassifiedDescText = getChild("classified_desc"); mLocationText = getChild("classified_location"); mCategoryText = getChild("category"); mContentTypeText = getChild("content_type"); @@ -684,6 +686,7 @@ void LLPanelProfileClassified::setEditMode(BOOL edit_mode) scrollToTop(); updateButtons(); + updateInfoRect(); } void LLPanelProfileClassified::updateButtons() @@ -697,6 +700,27 @@ void LLPanelProfileClassified::updateButtons() mEditButton->setVisible(!edit_mode && getSelfProfile()); } +void LLPanelProfileClassified::updateInfoRect() +{ + if (getEditMode()) + { + // info_scroll_content_panel contains both info and edit panel + // info panel can be very large and scroll bar will carry over. + // Resize info panel to prevent scroll carry over when in edit mode. + mInfoScroll->reshape(mInfoScroll->getRect().getWidth(), DEFAULT_EDIT_CLASSIFIED_SCROLL_HEIGHT, FALSE); + } + else + { + // Adjust text height to make description scrollable. + S32 new_height = mClassifiedDescText->getTextBoundingRect().getHeight(); + LLRect visible_rect = mClassifiedDescText->getVisibleDocumentRect(); + S32 delta_height = new_height - visible_rect.getHeight() + 5; + + LLRect rect = mInfoScroll->getRect(); + mInfoScroll->reshape(rect.getWidth(), rect.getHeight() + delta_height, FALSE); + } +} + void LLPanelProfileClassified::enableEditing(bool enable) { mEditButton->setEnabled(enable); @@ -851,6 +875,8 @@ void LLPanelProfileClassified::setDescription(const std::string& desc) { mClassifiedDescText->setValue(desc); mClassifiedDescEdit->setValue(desc); + + updateInfoRect(); } std::string LLPanelProfileClassified::getDescription() diff --git a/indra/newview/llpanelprofileclassifieds.h b/indra/newview/llpanelprofileclassifieds.h index 3766858f42..9bf9ff4a6b 100644 --- a/indra/newview/llpanelprofileclassifieds.h +++ b/indra/newview/llpanelprofileclassifieds.h @@ -210,6 +210,7 @@ protected: void resetControls(); /*virtual*/ void updateButtons(); + void updateInfoRect(); static std::string createLocationText( const std::string& original_name, @@ -303,7 +304,7 @@ private: LLTextureCtrl* mSnapshotCtrl; LLUICtrl* mEditIcon; LLUICtrl* mClassifiedNameText; - LLUICtrl* mClassifiedDescText; + LLTextEditor* mClassifiedDescText; LLLineEditor* mClassifiedNameEdit; LLTextEditor* mClassifiedDescEdit; LLUICtrl* mLocationText; @@ -334,7 +335,8 @@ private: LLPanel* mCancelBtnCnt; LLScrollContainer* mScrollContainer; - LLPanel* mInfoPanel; + LLView* mInfoPanel; + LLPanel* mInfoScroll; LLPanel* mEditPanel; diff --git a/indra/newview/skins/default/xui/en/panel_profile_classified.xml b/indra/newview/skins/default/xui/en/panel_profile_classified.xml index bbbb4e0f4a..6a0489ae97 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_classified.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_classified.xml @@ -8,7 +8,7 @@ follows="all" layout="topleft" help_topic="panel_profile_classified" - min_height="350" + min_height="250" > - - + - [name] - - - - - - - - - - - + + [name] + + + + + + + + + + + + + + [PRICE] + + + - - + + + + - [PRICE] - - - + - - - - + - - - - + + + + - - - - - + allow_scroll="false" + bg_visible="false" + h_pad="0" + max_length="1023" + parse_urls="true" + read_only="true" + v_pad="0" + word_wrap="true" + /> + +