From 9f0fb244cc9ad50709ff34fde09e72eb958db933 Mon Sep 17 00:00:00 2001 From: Zi Ree Date: Sat, 24 Sep 2022 03:43:08 +0200 Subject: [PATCH] Add parameter to texture picker swatch to allow hiding the label at the bottom, expanding the texture to full height --- indra/newview/lltexturectrl.cpp | 14 ++++++++++---- indra/newview/lltexturectrl.h | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index f73410499d..f79d9b1488 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1389,7 +1389,7 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p) // Mask texture if desired mIsMasked(FALSE) { - + mCaptionHeight = p.show_caption ? BTN_HEIGHT_SMALL : 0; // leave some room underneath the image for the caption // Default of defaults is white image for diff tex // LLUUID whiteImage( gSavedSettings.getString( "UIImgWhiteUUID" ) ); @@ -1408,7 +1408,9 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p) addChild( mCaption ); S32 image_top = getRect().getHeight(); - S32 image_bottom = BTN_HEIGHT_SMALL; + // leave some room underneath the image for the caption + // S32 image_bottom = BTN_HEIGHT_SMALL; + S32 image_bottom = mCaptionHeight; S32 image_middle = (image_top + image_bottom) / 2; S32 line_height = LLFontGL::getFontSansSerifSmall()->getLineHeight(); @@ -1427,7 +1429,9 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p) addChild( mTentativeLabel ); LLRect border_rect = getLocalRect(); - border_rect.mBottom += BTN_HEIGHT_SMALL; + // leave some room underneath the image for the caption + // border_rect.mBottom += BTN_HEIGHT_SMALL; + border_rect.mBottom += mCaptionHeight; LLViewBorder::Params vbparams(p.border); vbparams.name("border"); vbparams.rect(border_rect); @@ -1893,7 +1897,9 @@ void LLTextureCtrl::draw() } // Border - LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); + // leave some room underneath the image for the caption + // LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); + LLRect border( 0, getRect().getHeight(), getRect().getWidth(), mCaptionHeight ); gl_rect_2d( border, mBorderColor.get(), FALSE ); // Interior diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index e3a9b5c1e0..c4334f4ce9 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -98,6 +98,7 @@ public: caption_text; Optional border; + Optional show_caption; // leave some room underneath the image for the caption Params() : image_id("image"), @@ -110,6 +111,7 @@ public: border_color("border_color"), fallback_image("fallback_image"), multiselect_text("multiselect_text"), + show_caption("show_caption", true), // leave some room underneath the image for the caption caption_text("caption_text"), border("border") {} @@ -241,6 +243,7 @@ private: LLHandle mFloaterHandle; LLTextBox* mTentativeLabel; LLTextBox* mCaption; + S32 mCaptionHeight; // leave some room underneath the image for the caption std::string mLabel; BOOL mAllowNoTexture; // If true, the user can select "none" as an option BOOL mAllowLocalTexture;