viewer#2411 A bit more coverage for font buffer
parent
5c64e5e13d
commit
57ab1a410f
|
|
@ -34,7 +34,6 @@
|
||||||
#include "llfontbitmapcache.h"
|
#include "llfontbitmapcache.h"
|
||||||
#include "llfontregistry.h"
|
#include "llfontregistry.h"
|
||||||
#include "llgl.h"
|
#include "llgl.h"
|
||||||
#include "llglslshader.h"
|
|
||||||
#include "llimagegl.h"
|
#include "llimagegl.h"
|
||||||
#include "llrender.h"
|
#include "llrender.h"
|
||||||
#include "llstl.h"
|
#include "llstl.h"
|
||||||
|
|
@ -376,6 +375,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
|
||||||
cur_render_x = cur_x;
|
cur_render_x = cur_x;
|
||||||
cur_render_y = cur_y;
|
cur_render_y = cur_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
gGL.begin(LLRender::QUADS);
|
gGL.begin(LLRender::QUADS);
|
||||||
{
|
{
|
||||||
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
|
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
|
||||||
|
|
@ -503,6 +503,7 @@ F32 LLFontGL::getWidthF32(const std::string& utf8text, S32 begin_offset, S32 max
|
||||||
|
|
||||||
F32 LLFontGL::getWidthF32(const llwchar* wchars, S32 begin_offset, S32 max_chars, bool no_padding) const
|
F32 LLFontGL::getWidthF32(const llwchar* wchars, S32 begin_offset, S32 max_chars, bool no_padding) const
|
||||||
{
|
{
|
||||||
|
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
|
||||||
const S32 LAST_CHARACTER = LLFontFreetype::LAST_CHAR_FULL;
|
const S32 LAST_CHARACTER = LLFontFreetype::LAST_CHAR_FULL;
|
||||||
|
|
||||||
F32 cur_x = 0;
|
F32 cur_x = 0;
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,60 @@ void LLFontVertexBuffer::reset()
|
||||||
mBufferList.clear();
|
mBufferList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
S32 LLFontVertexBuffer::render(
|
||||||
|
const LLFontGL* fontp,
|
||||||
|
const LLWString& text,
|
||||||
|
S32 begin_offset,
|
||||||
|
LLRect rect,
|
||||||
|
const LLColor4& color,
|
||||||
|
LLFontGL::HAlign halign, LLFontGL::VAlign valign,
|
||||||
|
U8 style,
|
||||||
|
LLFontGL::ShadowType shadow,
|
||||||
|
S32 max_chars, S32 max_pixels,
|
||||||
|
F32* right_x,
|
||||||
|
bool use_ellipses,
|
||||||
|
bool use_color)
|
||||||
|
{
|
||||||
|
LLRectf rect_float((F32)rect.mLeft, (F32)rect.mTop, (F32)rect.mRight, (F32)rect.mBottom);
|
||||||
|
return render(fontp, text, begin_offset, rect_float, color, halign, valign, style, shadow, max_chars, right_x, use_ellipses, use_color);
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 LLFontVertexBuffer::render(
|
||||||
|
const LLFontGL* fontp,
|
||||||
|
const LLWString& text,
|
||||||
|
S32 begin_offset,
|
||||||
|
LLRectf rect,
|
||||||
|
const LLColor4& color,
|
||||||
|
LLFontGL::HAlign halign, LLFontGL::VAlign valign,
|
||||||
|
U8 style,
|
||||||
|
LLFontGL::ShadowType shadow,
|
||||||
|
S32 max_chars,
|
||||||
|
F32* right_x,
|
||||||
|
bool use_ellipses,
|
||||||
|
bool use_color)
|
||||||
|
{
|
||||||
|
F32 x = rect.mLeft;
|
||||||
|
F32 y = 0.f;
|
||||||
|
|
||||||
|
switch (valign)
|
||||||
|
{
|
||||||
|
case LLFontGL::TOP:
|
||||||
|
y = rect.mTop;
|
||||||
|
break;
|
||||||
|
case LLFontGL::VCENTER:
|
||||||
|
y = rect.getCenterY();
|
||||||
|
break;
|
||||||
|
case LLFontGL::BASELINE:
|
||||||
|
case LLFontGL::BOTTOM:
|
||||||
|
y = rect.mBottom;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
y = rect.mBottom;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return render(fontp, text, begin_offset, x, y, color, halign, valign, style, shadow, max_chars, (S32)rect.getWidth(), right_x, use_ellipses, use_color);
|
||||||
|
}
|
||||||
|
|
||||||
S32 LLFontVertexBuffer::render(
|
S32 LLFontVertexBuffer::render(
|
||||||
const LLFontGL* fontp,
|
const LLFontGL* fontp,
|
||||||
const LLWString& text,
|
const LLWString& text,
|
||||||
|
|
@ -117,6 +171,7 @@ void LLFontVertexBuffer::genBuffers(
|
||||||
bool use_ellipses,
|
bool use_ellipses,
|
||||||
bool use_color)
|
bool use_color)
|
||||||
{
|
{
|
||||||
|
// todo: add a debug build assert if this triggers too often for to long?
|
||||||
mBufferList.clear();
|
mBufferList.clear();
|
||||||
|
|
||||||
gGL.beginList(&mBufferList);
|
gGL.beginList(&mBufferList);
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,32 @@ public:
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
S32 render(const LLFontGL* fontp,
|
||||||
|
const LLWString& text,
|
||||||
|
S32 begin_offset,
|
||||||
|
LLRect rect,
|
||||||
|
const LLColor4& color,
|
||||||
|
LLFontGL::HAlign halign = LLFontGL::LEFT, LLFontGL::VAlign valign = LLFontGL::BASELINE,
|
||||||
|
U8 style = LLFontGL::NORMAL,
|
||||||
|
LLFontGL::ShadowType shadow = LLFontGL::NO_SHADOW,
|
||||||
|
S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX,
|
||||||
|
F32* right_x = NULL,
|
||||||
|
bool use_ellipses = false,
|
||||||
|
bool use_color = true);
|
||||||
|
|
||||||
|
S32 render(const LLFontGL* fontp,
|
||||||
|
const LLWString& text,
|
||||||
|
S32 begin_offset,
|
||||||
|
LLRectf rect,
|
||||||
|
const LLColor4& color,
|
||||||
|
LLFontGL::HAlign halign = LLFontGL::LEFT, LLFontGL::VAlign valign = LLFontGL::BASELINE,
|
||||||
|
U8 style = LLFontGL::NORMAL,
|
||||||
|
LLFontGL::ShadowType shadow = LLFontGL::NO_SHADOW,
|
||||||
|
S32 max_chars = S32_MAX,
|
||||||
|
F32* right_x = NULL,
|
||||||
|
bool use_ellipses = false,
|
||||||
|
bool use_color = true);
|
||||||
|
|
||||||
S32 render(const LLFontGL* fontp,
|
S32 render(const LLFontGL* fontp,
|
||||||
const LLWString& text,
|
const LLWString& text,
|
||||||
S32 begin_offset,
|
S32 begin_offset,
|
||||||
|
|
|
||||||
|
|
@ -1531,6 +1531,7 @@ void LLRender::clearErrors()
|
||||||
|
|
||||||
void LLRender::beginList(std::list<LLVertexBufferData> *list)
|
void LLRender::beginList(std::list<LLVertexBufferData> *list)
|
||||||
{
|
{
|
||||||
|
llassert(LLGLSLShader::sCurBoundShaderPtr == &gUIProgram);
|
||||||
flush();
|
flush();
|
||||||
sBufferDataList = list;
|
sBufferDataList = list;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -574,8 +574,9 @@ void LLVertexBufferData::draw()
|
||||||
{
|
{
|
||||||
if (!mVB)
|
if (!mVB)
|
||||||
{
|
{
|
||||||
// signal for pushUIMatrix
|
llassert(false);
|
||||||
return; // todo: find a better way?
|
// Not supposed to happen, check buffer generation
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mTexName)
|
if (mTexName)
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@
|
||||||
#define LLBADGE_CPP
|
#define LLBADGE_CPP
|
||||||
#include "llbadge.h"
|
#include "llbadge.h"
|
||||||
|
|
||||||
|
#include "llfontgl.h"
|
||||||
|
#include "llfontvertexbuffer.h"
|
||||||
#include "llscrollcontainer.h"
|
#include "llscrollcontainer.h"
|
||||||
#include "lluictrlfactory.h"
|
#include "lluictrlfactory.h"
|
||||||
|
|
||||||
|
|
@ -103,6 +105,7 @@ LLBadge::LLBadge(const LLBadge::Params& p)
|
||||||
, mPaddingVert(p.padding_vert)
|
, mPaddingVert(p.padding_vert)
|
||||||
, mParentScroller(NULL)
|
, mParentScroller(NULL)
|
||||||
, mDrawAtParentTop(false)
|
, mDrawAtParentTop(false)
|
||||||
|
, mFontBuffer(false)
|
||||||
{
|
{
|
||||||
if (mImage.isNull())
|
if (mImage.isNull())
|
||||||
{
|
{
|
||||||
|
|
@ -351,17 +354,17 @@ void LLBadge::draw()
|
||||||
//
|
//
|
||||||
// Draw the label
|
// Draw the label
|
||||||
//
|
//
|
||||||
|
mFontBuffer.render(mGLFont,
|
||||||
mGLFont->render(mLabel.getWString(),
|
mLabel.getWString(),
|
||||||
badge_label_begin_offset,
|
badge_label_begin_offset,
|
||||||
badge_center_x + mLabelOffsetHoriz,
|
badge_center_x + mLabelOffsetHoriz,
|
||||||
badge_center_y + mLabelOffsetVert,
|
badge_center_y + mLabelOffsetVert,
|
||||||
mLabelColor % alpha,
|
mLabelColor % alpha,
|
||||||
LLFontGL::HCENTER, LLFontGL::VCENTER, // centered around the position
|
LLFontGL::HCENTER, LLFontGL::VCENTER, // centered around the position
|
||||||
LLFontGL::NORMAL, // normal text (not bold, italics, etc.)
|
LLFontGL::NORMAL, // normal text (not bold, italics, etc.)
|
||||||
LLFontGL::DROP_SHADOW_SOFT,
|
LLFontGL::DROP_SHADOW_SOFT,
|
||||||
badge_char_length, badge_pixel_length,
|
badge_char_length, badge_pixel_length,
|
||||||
right_position_out, do_not_use_ellipses);
|
right_position_out, do_not_use_ellipses);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,14 @@
|
||||||
#include "llstring.h"
|
#include "llstring.h"
|
||||||
#include "lluiimage.h"
|
#include "lluiimage.h"
|
||||||
#include "llview.h"
|
#include "llview.h"
|
||||||
|
#include "llfontvertexbuffer.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Declarations
|
// Declarations
|
||||||
//
|
//
|
||||||
|
|
||||||
class LLFontGL;
|
class LLFontGL;
|
||||||
|
class LLFontVertexBuffer;
|
||||||
class LLScrollContainer;
|
class LLScrollContainer;
|
||||||
class LLUICtrlFactory;
|
class LLUICtrlFactory;
|
||||||
|
|
||||||
|
|
@ -144,6 +146,7 @@ private:
|
||||||
LLUIColor mBorderColor;
|
LLUIColor mBorderColor;
|
||||||
|
|
||||||
const LLFontGL* mGLFont;
|
const LLFontGL* mGLFont;
|
||||||
|
LLFontVertexBuffer mFontBuffer;
|
||||||
|
|
||||||
LLPointer< LLUIImage > mImage;
|
LLPointer< LLUIImage > mImage;
|
||||||
LLUIColor mImageColor;
|
LLUIColor mImageColor;
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@
|
||||||
#include "llfloater.h"
|
#include "llfloater.h"
|
||||||
#include "llfloaterreg.h"
|
#include "llfloaterreg.h"
|
||||||
#include "llfocusmgr.h"
|
#include "llfocusmgr.h"
|
||||||
|
#include "llfontgl.h"
|
||||||
|
#include "llfontvertexbuffer.h"
|
||||||
#include "llwindow.h"
|
#include "llwindow.h"
|
||||||
#include "llnotificationsutil.h"
|
#include "llnotificationsutil.h"
|
||||||
#include "llrender.h"
|
#include "llrender.h"
|
||||||
|
|
@ -438,18 +440,6 @@ void LLButton::reshape(S32 width, S32 height, bool called_from_parent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLButton::translate(S32 x, S32 y)
|
|
||||||
{
|
|
||||||
LLUICtrl::translate(x, y);
|
|
||||||
mFontBuffer.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLButton::setRect(const LLRect& rect)
|
|
||||||
{
|
|
||||||
LLUICtrl::setRect(rect);
|
|
||||||
mFontBuffer.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLButton::dirtyRect()
|
void LLButton::dirtyRect()
|
||||||
{
|
{
|
||||||
LLUICtrl::dirtyRect();
|
LLUICtrl::dirtyRect();
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,6 @@
|
||||||
#include "lluictrl.h"
|
#include "lluictrl.h"
|
||||||
#include "v4color.h"
|
#include "v4color.h"
|
||||||
#include "llframetimer.h"
|
#include "llframetimer.h"
|
||||||
#include "llfontgl.h"
|
|
||||||
#include "llfontvertexbuffer.h"
|
|
||||||
#include "lluiimage.h"
|
#include "lluiimage.h"
|
||||||
#include "lluistring.h"
|
#include "lluistring.h"
|
||||||
|
|
||||||
|
|
@ -56,6 +54,8 @@ S32 round_up(S32 grid, S32 value);
|
||||||
|
|
||||||
|
|
||||||
class LLUICtrlFactory;
|
class LLUICtrlFactory;
|
||||||
|
class LLFontGL;
|
||||||
|
class LLFontVertexBuffer;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Classes
|
// Classes
|
||||||
|
|
@ -170,8 +170,6 @@ public:
|
||||||
|
|
||||||
void onVisibilityChange(bool visible) override;
|
void onVisibilityChange(bool visible) override;
|
||||||
void reshape(S32 width, S32 height, bool called_from_parent = true) override;
|
void reshape(S32 width, S32 height, bool called_from_parent = true) override;
|
||||||
void translate(S32 x, S32 y) override;
|
|
||||||
void setRect(const LLRect& rect) override;
|
|
||||||
void dirtyRect() override;
|
void dirtyRect() override;
|
||||||
|
|
||||||
virtual void onMouseLeave(S32 x, S32 y, MASK mask) override;
|
virtual void onMouseLeave(S32 x, S32 y, MASK mask) override;
|
||||||
|
|
@ -307,9 +305,6 @@ protected:
|
||||||
commit_signal_t* mMouseUpSignal;
|
commit_signal_t* mMouseUpSignal;
|
||||||
commit_signal_t* mHeldDownSignal;
|
commit_signal_t* mHeldDownSignal;
|
||||||
|
|
||||||
const LLFontGL* mGLFont;
|
|
||||||
LLFontVertexBuffer mFontBuffer;
|
|
||||||
|
|
||||||
S32 mMouseDownFrame;
|
S32 mMouseDownFrame;
|
||||||
S32 mMouseHeldDownCount; // Counter for parameter passed to held-down callback
|
S32 mMouseHeldDownCount; // Counter for parameter passed to held-down callback
|
||||||
F32 mHeldDownDelay; // seconds, after which held-down callbacks get called
|
F32 mHeldDownDelay; // seconds, after which held-down callbacks get called
|
||||||
|
|
@ -392,6 +387,10 @@ protected:
|
||||||
bool mForceFlashing; // Stick flashing color even if button is pressed
|
bool mForceFlashing; // Stick flashing color even if button is pressed
|
||||||
bool mHandleRightMouse;
|
bool mHandleRightMouse;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const LLFontGL* mGLFont;
|
||||||
|
LLFontVertexBuffer mFontBuffer;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual std::string _getSearchText() const
|
virtual std::string _getSearchText() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
#include "llscrolllistcell.h"
|
#include "llscrolllistcell.h"
|
||||||
|
|
||||||
#include "llcheckboxctrl.h"
|
#include "llcheckboxctrl.h"
|
||||||
|
#include "llfontvertexbuffer.h"
|
||||||
#include "llui.h" // LLUIImage
|
#include "llui.h" // LLUIImage
|
||||||
#include "lluictrlfactory.h"
|
#include "lluictrlfactory.h"
|
||||||
|
|
||||||
|
|
@ -156,7 +157,7 @@ S32 LLScrollListIcon::getWidth() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LLScrollListIcon::draw(const LLColor4& color, const LLColor4& highlight_color) const
|
void LLScrollListIcon::draw(const LLColor4& color, const LLColor4& highlight_color)
|
||||||
{
|
{
|
||||||
if (mIcon)
|
if (mIcon)
|
||||||
{
|
{
|
||||||
|
|
@ -236,7 +237,7 @@ S32 LLScrollListBar::getWidth() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LLScrollListBar::draw(const LLColor4& color, const LLColor4& highlight_color) const
|
void LLScrollListBar::draw(const LLColor4& color, const LLColor4& highlight_color)
|
||||||
{
|
{
|
||||||
S32 bar_width = getWidth() - mLeftPad - mRightPad;
|
S32 bar_width = getWidth() - mLeftPad - mRightPad;
|
||||||
S32 left = (S32)(bar_width - bar_width * mRatio);
|
S32 left = (S32)(bar_width - bar_width * mRatio);
|
||||||
|
|
@ -255,6 +256,7 @@ LLScrollListText::LLScrollListText(const LLScrollListCell::Params& p)
|
||||||
mText(p.label.isProvided() ? p.label() : p.value().asString()),
|
mText(p.label.isProvided() ? p.label() : p.value().asString()),
|
||||||
mAltText(p.alt_value().asString()),
|
mAltText(p.alt_value().asString()),
|
||||||
mFont(p.font),
|
mFont(p.font),
|
||||||
|
mFontBuffer(false),
|
||||||
mColor(p.color),
|
mColor(p.color),
|
||||||
mUseColor(p.color.isProvided()),
|
mUseColor(p.color.isProvided()),
|
||||||
mFontAlignment(p.font_halign),
|
mFontAlignment(p.font_halign),
|
||||||
|
|
@ -308,6 +310,19 @@ bool LLScrollListText::needsToolTip() const
|
||||||
return mFont->getWidth(mText.getWString().c_str()) > getWidth();
|
return mFont->getWidth(mText.getWString().c_str()) > getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLScrollListText::setTextWidth(S32 value)
|
||||||
|
{
|
||||||
|
mTextWidth = value;
|
||||||
|
mFontBuffer.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLScrollListText::setWidth(S32 width)
|
||||||
|
{
|
||||||
|
LLScrollListCell::setWidth(width);
|
||||||
|
mTextWidth = width;
|
||||||
|
mFontBuffer.reset();
|
||||||
|
}
|
||||||
|
|
||||||
//virtual
|
//virtual
|
||||||
bool LLScrollListText::getVisible() const
|
bool LLScrollListText::getVisible() const
|
||||||
{
|
{
|
||||||
|
|
@ -341,6 +356,7 @@ void LLScrollListText::setColor(const LLColor4& color)
|
||||||
void LLScrollListText::setText(const LLStringExplicit& text)
|
void LLScrollListText::setText(const LLStringExplicit& text)
|
||||||
{
|
{
|
||||||
mText = text;
|
mText = text;
|
||||||
|
mFontBuffer.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLScrollListText::setFontStyle(const U8 font_style)
|
void LLScrollListText::setFontStyle(const U8 font_style)
|
||||||
|
|
@ -348,6 +364,13 @@ void LLScrollListText::setFontStyle(const U8 font_style)
|
||||||
LLFontDescriptor new_desc(mFont->getFontDesc());
|
LLFontDescriptor new_desc(mFont->getFontDesc());
|
||||||
new_desc.setStyle(font_style);
|
new_desc.setStyle(font_style);
|
||||||
mFont = LLFontGL::getFont(new_desc);
|
mFont = LLFontGL::getFont(new_desc);
|
||||||
|
mFontBuffer.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLScrollListText::setAlignment(LLFontGL::HAlign align)
|
||||||
|
{
|
||||||
|
mFontAlignment = align;
|
||||||
|
mFontBuffer.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
//virtual
|
//virtual
|
||||||
|
|
@ -375,7 +398,7 @@ const LLSD LLScrollListText::getAltValue() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_color) const
|
void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_color)
|
||||||
{
|
{
|
||||||
LLColor4 display_color;
|
LLColor4 display_color;
|
||||||
if (mUseColor)
|
if (mUseColor)
|
||||||
|
|
@ -426,17 +449,18 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
|
||||||
start_x = (F32)getWidth() * 0.5f;
|
start_x = (F32)getWidth() * 0.5f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mFont->render(mText.getWString(), 0,
|
mFontBuffer.render(mFont,
|
||||||
start_x, 0.f,
|
mText.getWString(), 0,
|
||||||
display_color,
|
start_x, 0.f,
|
||||||
mFontAlignment,
|
display_color,
|
||||||
LLFontGL::BOTTOM,
|
mFontAlignment,
|
||||||
0,
|
LLFontGL::BOTTOM,
|
||||||
LLFontGL::NO_SHADOW,
|
0,
|
||||||
string_chars,
|
LLFontGL::NO_SHADOW,
|
||||||
getTextWidth(),
|
string_chars,
|
||||||
&right_x,
|
getTextWidth(),
|
||||||
true);
|
&right_x,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -475,7 +499,7 @@ LLScrollListCheck::~LLScrollListCheck()
|
||||||
mCheckBox = NULL;
|
mCheckBox = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLScrollListCheck::draw(const LLColor4& color, const LLColor4& highlight_color) const
|
void LLScrollListCheck::draw(const LLColor4& color, const LLColor4& highlight_color)
|
||||||
{
|
{
|
||||||
mCheckBox->draw();
|
mCheckBox->draw();
|
||||||
}
|
}
|
||||||
|
|
@ -592,7 +616,7 @@ void LLScrollListIconText::setWidth(S32 width)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight_color) const
|
void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight_color)
|
||||||
{
|
{
|
||||||
LLColor4 display_color;
|
LLColor4 display_color;
|
||||||
if (mUseColor)
|
if (mUseColor)
|
||||||
|
|
@ -650,7 +674,9 @@ void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight
|
||||||
start_icon_x = (S32)(center - (((F32)icon_space + mFont->getWidth(mText.getWString().c_str())) * 0.5f));
|
start_icon_x = (S32)(center - (((F32)icon_space + mFont->getWidth(mText.getWString().c_str())) * 0.5f));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mFont->render(mText.getWString(), 0,
|
mFontBuffer.render(
|
||||||
|
mFont,
|
||||||
|
mText.getWString(), 0,
|
||||||
start_text_x, 0.f,
|
start_text_x, 0.f,
|
||||||
display_color,
|
display_color,
|
||||||
mFontAlignment,
|
mFontAlignment,
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
#define LLSCROLLLISTCELL_H
|
#define LLSCROLLLISTCELL_H
|
||||||
|
|
||||||
#include "llfontgl.h" // HAlign
|
#include "llfontgl.h" // HAlign
|
||||||
|
#include "llfontvertexbuffer.h" // HAlign
|
||||||
#include "llpointer.h" // LLPointer<>
|
#include "llpointer.h" // LLPointer<>
|
||||||
#include "lluistring.h"
|
#include "lluistring.h"
|
||||||
#include "v4color.h"
|
#include "v4color.h"
|
||||||
|
|
@ -96,7 +97,7 @@ public:
|
||||||
LLScrollListCell(const LLScrollListCell::Params&);
|
LLScrollListCell(const LLScrollListCell::Params&);
|
||||||
virtual ~LLScrollListCell() {};
|
virtual ~LLScrollListCell() {};
|
||||||
|
|
||||||
virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const {}; // truncate to given width, if possible
|
virtual void draw(const LLColor4& color, const LLColor4& highlight_color) {}; // truncate to given width, if possible
|
||||||
virtual S32 getWidth() const {return mWidth;}
|
virtual S32 getWidth() const {return mWidth;}
|
||||||
virtual S32 getContentWidth() const { return 0; }
|
virtual S32 getContentWidth() const { return 0; }
|
||||||
virtual S32 getHeight() const { return 0; }
|
virtual S32 getHeight() const { return 0; }
|
||||||
|
|
@ -127,7 +128,7 @@ class LLScrollListSpacer : public LLScrollListCell
|
||||||
public:
|
public:
|
||||||
LLScrollListSpacer(const LLScrollListCell::Params& p) : LLScrollListCell(p) {}
|
LLScrollListSpacer(const LLScrollListCell::Params& p) : LLScrollListCell(p) {}
|
||||||
/*virtual*/ ~LLScrollListSpacer() {};
|
/*virtual*/ ~LLScrollListSpacer() {};
|
||||||
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const {}
|
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -139,7 +140,7 @@ public:
|
||||||
LLScrollListText(const LLScrollListCell::Params&);
|
LLScrollListText(const LLScrollListCell::Params&);
|
||||||
/*virtual*/ ~LLScrollListText();
|
/*virtual*/ ~LLScrollListText();
|
||||||
|
|
||||||
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
|
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color);
|
||||||
/*virtual*/ S32 getContentWidth() const;
|
/*virtual*/ S32 getContentWidth() const;
|
||||||
/*virtual*/ S32 getHeight() const;
|
/*virtual*/ S32 getHeight() const;
|
||||||
/*virtual*/ void setValue(const LLSD& value);
|
/*virtual*/ void setValue(const LLSD& value);
|
||||||
|
|
@ -155,18 +156,20 @@ public:
|
||||||
/*virtual*/ bool needsToolTip() const;
|
/*virtual*/ bool needsToolTip() const;
|
||||||
|
|
||||||
S32 getTextWidth() const { return mTextWidth;}
|
S32 getTextWidth() const { return mTextWidth;}
|
||||||
void setTextWidth(S32 value) { mTextWidth = value;}
|
void setTextWidth(S32 value);
|
||||||
virtual void setWidth(S32 width) { LLScrollListCell::setWidth(width); mTextWidth = width; }
|
virtual void setWidth(S32 width);
|
||||||
|
|
||||||
void setText(const LLStringExplicit& text);
|
void setText(const LLStringExplicit& text);
|
||||||
void setFontStyle(const U8 font_style);
|
void setFontStyle(const U8 font_style);
|
||||||
void setAlignment(LLFontGL::HAlign align) { mFontAlignment = align; }
|
void setAlignment(LLFontGL::HAlign align);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
LLUIString mText;
|
LLUIString mText;
|
||||||
LLUIString mAltText;
|
LLUIString mAltText;
|
||||||
S32 mTextWidth;
|
S32 mTextWidth;
|
||||||
const LLFontGL* mFont;
|
const LLFontGL* mFont;
|
||||||
|
LLFontVertexBuffer mFontBuffer;
|
||||||
LLColor4 mColor;
|
LLColor4 mColor;
|
||||||
LLColor4 mHighlightColor;
|
LLColor4 mHighlightColor;
|
||||||
U8 mUseColor;
|
U8 mUseColor;
|
||||||
|
|
@ -188,7 +191,7 @@ class LLScrollListIcon : public LLScrollListCell
|
||||||
public:
|
public:
|
||||||
LLScrollListIcon(const LLScrollListCell::Params& p);
|
LLScrollListIcon(const LLScrollListCell::Params& p);
|
||||||
/*virtual*/ ~LLScrollListIcon();
|
/*virtual*/ ~LLScrollListIcon();
|
||||||
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
|
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color);
|
||||||
/*virtual*/ S32 getWidth() const;
|
/*virtual*/ S32 getWidth() const;
|
||||||
/*virtual*/ S32 getHeight() const;
|
/*virtual*/ S32 getHeight() const;
|
||||||
/*virtual*/ const LLSD getValue() const;
|
/*virtual*/ const LLSD getValue() const;
|
||||||
|
|
@ -207,7 +210,7 @@ class LLScrollListBar : public LLScrollListCell
|
||||||
public:
|
public:
|
||||||
LLScrollListBar(const LLScrollListCell::Params& p);
|
LLScrollListBar(const LLScrollListCell::Params& p);
|
||||||
/*virtual*/ ~LLScrollListBar();
|
/*virtual*/ ~LLScrollListBar();
|
||||||
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
|
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color);
|
||||||
/*virtual*/ S32 getWidth() const;
|
/*virtual*/ S32 getWidth() const;
|
||||||
/*virtual*/ S32 getHeight() const;
|
/*virtual*/ S32 getHeight() const;
|
||||||
/*virtual*/ const LLSD getValue() const;
|
/*virtual*/ const LLSD getValue() const;
|
||||||
|
|
@ -229,7 +232,7 @@ class LLScrollListCheck : public LLScrollListCell
|
||||||
public:
|
public:
|
||||||
LLScrollListCheck( const LLScrollListCell::Params&);
|
LLScrollListCheck( const LLScrollListCell::Params&);
|
||||||
/*virtual*/ ~LLScrollListCheck();
|
/*virtual*/ ~LLScrollListCheck();
|
||||||
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
|
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color);
|
||||||
/*virtual*/ S32 getHeight() const { return 0; }
|
/*virtual*/ S32 getHeight() const { return 0; }
|
||||||
/*virtual*/ const LLSD getValue() const;
|
/*virtual*/ const LLSD getValue() const;
|
||||||
/*virtual*/ void setValue(const LLSD& value);
|
/*virtual*/ void setValue(const LLSD& value);
|
||||||
|
|
@ -264,13 +267,11 @@ class LLScrollListIconText : public LLScrollListText
|
||||||
public:
|
public:
|
||||||
LLScrollListIconText(const LLScrollListCell::Params& p);
|
LLScrollListIconText(const LLScrollListCell::Params& p);
|
||||||
/*virtual*/ ~LLScrollListIconText();
|
/*virtual*/ ~LLScrollListIconText();
|
||||||
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
|
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color);
|
||||||
/*virtual*/ const LLSD getValue() const;
|
/*virtual*/ const LLSD getValue() const;
|
||||||
/*virtual*/ void setValue(const LLSD& value);
|
/*virtual*/ void setValue(const LLSD& value);
|
||||||
|
|
||||||
|
/*virtual*/ void setWidth(S32 width);
|
||||||
S32 getIconWidth() const;
|
|
||||||
/*virtual*/ void setWidth(S32 width);/* { LLScrollListCell::setWidth(width); mTextWidth = width - ; }*/
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LLPointer<LLUIImage> mIcon;
|
LLPointer<LLUIImage> mIcon;
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,8 @@ LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p)
|
||||||
, mInboxButton(NULL)
|
, mInboxButton(NULL)
|
||||||
, mInventoryPanel(NULL)
|
, mInventoryPanel(NULL)
|
||||||
, mSavedFolderState(NULL)
|
, mSavedFolderState(NULL)
|
||||||
|
, mLastItemCount(-1)
|
||||||
|
, mLastFreshItemCount(-1)
|
||||||
{
|
{
|
||||||
mSavedFolderState = new LLSaveFolderState();
|
mSavedFolderState = new LLSaveFolderState();
|
||||||
mSavedFolderState->setApply(false);
|
mSavedFolderState->setApply(false);
|
||||||
|
|
@ -253,28 +255,40 @@ void LLPanelMarketplaceInbox::draw()
|
||||||
|
|
||||||
llassert(mFreshCountCtrl != NULL);
|
llassert(mFreshCountCtrl != NULL);
|
||||||
|
|
||||||
if (item_count > 0)
|
if (mLastItemCount != item_count)
|
||||||
{
|
{
|
||||||
std::string item_count_str = llformat("%d", item_count);
|
mLastItemCount = item_count;
|
||||||
|
if (item_count > 0)
|
||||||
LLStringUtil::format_map_t args;
|
|
||||||
args["[NUM]"] = item_count_str;
|
|
||||||
mInboxButton->setLabel(getString("InboxLabelWithArg", args));
|
|
||||||
|
|
||||||
// set green text to fresh item count
|
|
||||||
U32 fresh_item_count = getFreshItemCount();
|
|
||||||
mFreshCountCtrl->setVisible((fresh_item_count > 0));
|
|
||||||
|
|
||||||
if (fresh_item_count > 0)
|
|
||||||
{
|
{
|
||||||
mFreshCountCtrl->setTextArg("[NUM]", llformat("%d", fresh_item_count));
|
std::string item_count_str = llformat("%d", item_count);
|
||||||
|
|
||||||
|
LLStringUtil::format_map_t args;
|
||||||
|
args["[NUM]"] = item_count_str;
|
||||||
|
// setLabel is expensive, causes buffer regeneration
|
||||||
|
mInboxButton->setLabel(getString("InboxLabelWithArg", args));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mInboxButton->setLabel(getString("InboxLabelNoArg"));
|
||||||
|
|
||||||
|
mFreshCountCtrl->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
mInboxButton->setLabel(getString("InboxLabelNoArg"));
|
|
||||||
|
|
||||||
mFreshCountCtrl->setVisible(false);
|
if (item_count > 0)
|
||||||
|
{
|
||||||
|
// set green text to fresh item count
|
||||||
|
U32 fresh_item_count = getFreshItemCount();
|
||||||
|
if (mLastFreshItemCount != fresh_item_count)
|
||||||
|
{
|
||||||
|
mLastFreshItemCount = fresh_item_count;
|
||||||
|
mFreshCountCtrl->setVisible((fresh_item_count > 0));
|
||||||
|
|
||||||
|
if (fresh_item_count > 0)
|
||||||
|
{
|
||||||
|
mFreshCountCtrl->setTextArg("[NUM]", llformat("%d", fresh_item_count));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LLPanel::draw();
|
LLPanel::draw();
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ private:
|
||||||
LLButton * mInboxButton;
|
LLButton * mInboxButton;
|
||||||
LLInventoryPanel * mInventoryPanel;
|
LLInventoryPanel * mInventoryPanel;
|
||||||
LLSaveFolderState* mSavedFolderState;
|
LLSaveFolderState* mSavedFolderState;
|
||||||
|
S32 mLastItemCount;
|
||||||
|
S32 mLastFreshItemCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue