From 187a4b638d8648977fa148bd409750096542fad2 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 1 Jul 2010 19:48:39 -0700 Subject: EXT-7654 - About Land Floater> Icons missing fixed layout of embedded icons in text labels --- indra/llrender/llfontgl.cpp | 22 +++++++++++++++++++++ indra/llrender/llfontgl.h | 20 +++++++++++++++++-- indra/llui/lltextbase.cpp | 23 +++++++++++----------- indra/llui/lltextbase.h | 1 + indra/llui/lluictrl.h | 8 ++------ .../skins/default/xui/en/floater_about_land.xml | 10 ++++++++-- .../skins/default/xui/en/widgets/textbase.xml | 2 ++ 7 files changed, 65 insertions(+), 21 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index d9e1976341..f17ea6ca98 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -118,6 +118,28 @@ BOOL LLFontGL::loadFace(const std::string& filename, F32 point_size, F32 vert_dp static LLFastTimer::DeclareTimer FTM_RENDER_FONTS("Fonts"); +S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, + ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_ellipses) const +{ + F32 x = rect.mLeft; + F32 y = 0.f; + + switch(valign) + { + case TOP: + y = rect.mTop; + break; + case VCENTER: + y = rect.getCenterY(); + break; + case BOTTOM: + y = rect.mBottom; + break; + } + return render(wstr, begin_offset, x, y, color, halign, valign, style, shadow, max_chars, rect.getWidth(), right_x, use_ellipses); +} + + S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars, S32 max_pixels, F32* right_x, BOOL use_ellipses) const { diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h index dfa4cf8ce5..f29ac5165c 100644 --- a/indra/llrender/llfontgl.h +++ b/indra/llrender/llfontgl.h @@ -95,8 +95,24 @@ public: BOOL loadFace(const std::string& filename, F32 point_size, const F32 vert_dpi, const F32 horz_dpi, const S32 components, BOOL is_fallback); - S32 render(const LLWString &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign = LEFT, VAlign valign = BASELINE, U8 style = NORMAL, - ShadowType shadow = NO_SHADOW, S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX, F32* right_x=NULL, BOOL use_ellipses = FALSE) const; + S32 render(const LLWString &text, S32 begin_offset, + const LLRect& rect, + const LLColor4 &color, + HAlign halign = LEFT, VAlign valign = BASELINE, + U8 style = NORMAL, ShadowType shadow = NO_SHADOW, + S32 max_chars = S32_MAX, + F32* right_x=NULL, + BOOL use_ellipses = FALSE) const; + + S32 render(const LLWString &text, S32 begin_offset, + F32 x, F32 y, + const LLColor4 &color, + HAlign halign = LEFT, VAlign valign = BASELINE, + U8 style = NORMAL, ShadowType shadow = NO_SHADOW, + S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX, + F32* right_x=NULL, + BOOL use_ellipses = FALSE) const; + S32 render(const LLWString &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color) const; // renderUTF8 does a conversion, so is slower! diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 17e41d9e24..ccd22ee050 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -193,6 +193,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mHPad(p.h_pad), mVPad(p.v_pad), mHAlign(p.font_halign), + mVAlign(p.font_valign), mLineSpacingMult(p.line_spacing.multiple), mLineSpacingPixels(p.line_spacing.pixels), mClipPartial(p.clip_partial && !p.allow_scroll), @@ -482,9 +483,9 @@ void LLTextBase::drawCursor() text_color = mFgColor.get(); fontp = mDefaultFont; } - fontp->render(text, mCursorPos, cursor_rect.mLeft, cursor_rect.mTop, + fontp->render(text, mCursorPos, cursor_rect, LLColor4(1.f - text_color.mV[VRED], 1.f - text_color.mV[VGREEN], 1.f - text_color.mV[VBLUE], alpha), - LLFontGL::LEFT, LLFontGL::TOP, + LLFontGL::LEFT, mVAlign, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, 1); @@ -2435,12 +2436,12 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele S32 end = llmin( selection_start, seg_end ); S32 length = end - start; font->render(text, start, - rect.mLeft, rect.mTop, + rect, color, - LLFontGL::LEFT, LLFontGL::TOP, + LLFontGL::LEFT, mEditor.mVAlign, LLFontGL::NORMAL, mStyle->getShadowType(), - length, rect.getWidth(), + length, &right_x, mEditor.getUseEllipses()); } @@ -2454,12 +2455,12 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele S32 length = end - start; font->render(text, start, - rect.mLeft, rect.mTop, + rect, LLColor4( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], 1.f ), - LLFontGL::LEFT, LLFontGL::TOP, + LLFontGL::LEFT, mEditor.mVAlign, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - length, rect.getWidth(), + length, &right_x, mEditor.getUseEllipses()); } @@ -2471,12 +2472,12 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele S32 end = seg_end; S32 length = end - start; font->render(text, start, - rect.mLeft, rect.mTop, + rect, color, - LLFontGL::LEFT, LLFontGL::TOP, + LLFontGL::LEFT, mEditor.mVAlign, LLFontGL::NORMAL, mStyle->getShadowType(), - length, rect.getWidth(), + length, &right_x, mEditor.getUseEllipses()); } diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index fe8ebb1b80..ff63cc26f5 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -357,6 +357,7 @@ protected: S32 mHPad; // padding on left of text S32 mVPad; // padding above text LLFontGL::HAlign mHAlign; + LLFontGL::VAlign mVAlign; F32 mLineSpacingMult; // multiple of line height used as space for a single line of text (e.g. 1.5 to get 50% padding) S32 mLineSpacingPixels; // padding between lines const LLFontGL* mDefaultFont; // font that is used when none specified diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index b9a4f61e15..1f9d2c9049 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -47,14 +47,10 @@ const BOOL TAKE_FOCUS_YES = TRUE; const BOOL TAKE_FOCUS_NO = FALSE; -// NOTE: the LLFocusableElement class declaration has been moved from here to llfocusmgr.h. - class LLUICtrl : public LLView, public boost::signals2::trackable { public: - - typedef boost::function commit_callback_t; typedef boost::signals2::signal commit_signal_t; // *TODO: add xml support for this type of signal in the future @@ -111,8 +107,8 @@ public: commit_callback; Optional validate_callback; - Optional mouseenter_callback; - Optional mouseleave_callback; + Optional mouseenter_callback, + mouseleave_callback; Optional control_name; Optional enabled_controls; diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml index 14aacafa9f..68e36ff0b3 100644 --- a/indra/newview/skins/default/xui/en/floater_about_land.xml +++ b/indra/newview/skins/default/xui/en/floater_about_land.xml @@ -191,9 +191,10 @@ type="string" length="1" follows="left|top" - height="16" + height="20" layout="topleft" left_pad="2" + valign="center" name="ContentRatingText" top_delta="0" width="250"> @@ -207,7 +208,7 @@ layout="topleft" left="10" name="Owner:" - top_pad="5" + top_pad="1" width="100"> Owner: @@ -729,8 +730,10 @@ Leyla Linden height="16" layout="topleft" left_pad="10" + top_delta="-3" mouse_opaque="false" name="region_maturity_text" + valign="center" width="150"> Adult @@ -743,6 +746,7 @@ Leyla Linden left="10" mouse_opaque="false" name="resellable_lbl" + top_pad="9" width="100"> Resale: @@ -1924,6 +1928,8 @@ Only large parcels can be listed in search. left_delta="0" name="public_access" top_pad="5" + label_text.valign="center" + label_text.v_pad="-7" width="278" /> -- cgit v1.2.3