Worn items have bold text in inventory. Also made label text for worn items more legible.

This commit is contained in:
Shyotl
2012-02-27 19:04:47 -06:00
parent 2bf940e15d
commit 2f632d3324
3 changed files with 41 additions and 21 deletions

View File

@@ -253,7 +253,7 @@ LLFolderView::LLFolderView( const std::string& name,
// just make sure the label ("Inventory Folder") never shows up
mLabel = LLStringUtil::null;
mRenamer = new LLLineEditor(std::string("ren"), getRect(), LLStringUtil::null, sFont,
mRenamer = new LLLineEditor(std::string("ren"), getRect(), LLStringUtil::null, getLabelFontForStyle(LLFontGL::NORMAL),
DB_INV_ITEM_NAME_STR_LEN,
&LLFolderView::commitRename,
NULL,
@@ -466,7 +466,7 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen
getRoot()->getFilter()->getShowFolderState();
S32 total_width = LEFT_PAD;
S32 running_height = mDebugFilters ? llceil(sSmallFont->getLineHeight()) : 0;
S32 running_height = mDebugFilters ? llceil(LLFontGL::getFontMonospace()->getLineHeight()) : 0;
S32 target_height = running_height;
S32 parent_item_height = getRect().getHeight();
@@ -921,8 +921,8 @@ void LLFolderView::draw()
{
std::string current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d",
mFilter->getCurrentGeneration(), mFilter->getMinRequiredGeneration(), mFilter->getMustPassGeneration());
sSmallFont->renderUTF8(current_filter_string, 0, 2,
getRect().getHeight() - sSmallFont->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f),
LLFontGL::getFontMonospace()->renderUTF8(current_filter_string, 0, 2,
getRect().getHeight() - LLFontGL::getFontMonospace()->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f),
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
}
@@ -964,16 +964,17 @@ void LLFolderView::draw()
}
else if (mShowEmptyMessage)
{
const LLFontGL* font = getLabelFontForStyle(mLabelStyle);
static LLCachedControl<LLColor4> sSearchStatusColor(gColors, "InventorySearchStatusColor", LLColor4::white );
if (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() || mCompletedFilterGeneration < mFilter->getMinRequiredGeneration())
{
mStatusText = std::string("Searching..."); // *TODO:translate
sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
font->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
}
else
{
mStatusText = std::string("No matching items found in inventory."); // *TODO:translate
sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
font->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
}
}
@@ -1997,7 +1998,7 @@ void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constr
LLRect visible_doc_rect = mScrollContainer->getVisibleContentRect();
S32 icon_height = mIcon.isNull() ? 0 : mIcon->getHeight();
S32 label_height = llround(sFont->getLineHeight());
S32 label_height = llround(getLabelFontForStyle(mLabelStyle)->getLineHeight());
// when navigating with keyboard, only move top of opened folder on screen, otherwise show whole folder
S32 max_height_to_show = item->isOpen() && mScrollContainer->hasFocus() ? (llmax( icon_height, label_height ) + ICON_PAD) : local_rect.getHeight();

View File

@@ -44,9 +44,9 @@
#include "llfocusmgr.h" // gFocusMgr
#include "lltrans.h"
// statics
const LLFontGL* LLFolderViewItem::sFont = NULL;
const LLFontGL* LLFolderViewItem::sSmallFont = NULL;
std::map<U8, LLFontGL*> LLFolderViewItem::sFonts; // map of styles to fonts
// only integers can be initialized in header
const F32 LLFolderViewItem::FOLDER_CLOSE_TIME_CONSTANT = 0.02f;
const F32 LLFolderViewItem::FOLDER_OPEN_TIME_CONSTANT = 0.03f;
@@ -57,11 +57,26 @@ LLUIImagePtr LLFolderViewItem::sBoxImage;
// avoid a crash bug due to a race condition (see in doIdle()).
std::set<LLFolderViewItem*> sFolderViewItems;
//static
LLFontGL* LLFolderViewItem::getLabelFontForStyle(U8 style)
{
LLFontGL* rtn = sFonts[style];
if (!rtn) // grab label font with this style, lazily
{
LLFontDescriptor labelfontdesc("SansSerif", "Small", style);
rtn = LLFontGL::getFont(labelfontdesc);
if (!rtn)
{
rtn = LLFontGL::getFontMonospace();
}
sFonts[style] = rtn;
}
return rtn;
}
//static
void LLFolderViewItem::initClass()
{
sFont = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL );
sSmallFont = LLResMgr::getInstance()->getRes( LLFONT_SMALL );
sArrowImage = LLUI::getUIImage("folder_arrow.tga");
sBoxImage = LLUI::getUIImage("rounded_square.tga");
}
@@ -69,6 +84,7 @@ void LLFolderViewItem::initClass()
//static
void LLFolderViewItem::cleanupClass()
{
sFonts.clear();
sArrowImage = NULL;
sBoxImage = NULL;
}
@@ -411,7 +427,7 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation)
: 0;
if (mLabelWidthDirty)
{
mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + sFont->getWidth(mSearchableLabel);
mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + getLabelFontForStyle(mLabelStyle)->getWidth(mSearchableLabel);
mLabelWidthDirty = false;
}
@@ -876,9 +892,9 @@ void LLFolderViewItem::draw()
static LLCachedControl<LLColor4> sSuffixColor(gColors, "InventoryItemSuffixColor", LLColor4::white );
static LLCachedControl<LLColor4> sSearchStatusColor(gColors, "InventorySearchStatusColor", LLColor4::white );
const S32 TOP_PAD = 0;
const S32 FOCUS_LEFT = 0;
const LLFontGL* font = sFont;
const S32 TOP_PAD = 4;
const S32 FOCUS_LEFT = 1;
const LLFontGL* font = getLabelFontForStyle(mLabelStyle);
const BOOL in_inventory = getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(), gInventory.getRootFolderID());
const BOOL in_library = getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(), gInventory.getLibraryRootFolderID());
@@ -1016,7 +1032,7 @@ void LLFolderViewItem::draw()
LLColor4 filter_color = mLastFilterGeneration >= getRoot()->getFilter()->getCurrentGeneration() ?
LLColor4(0.5f, 0.8f, 0.5f, 1.f) :
LLColor4(0.8f, 0.5f, 0.5f, 1.f);
sSmallFont->renderUTF8(mStatusText, 0, text_left, y, filter_color,
LLFontGL::getFontMonospace()->renderUTF8(mStatusText, 0, text_left, y, filter_color,
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
S32_MAX, S32_MAX, &right_x, FALSE );
text_left = right_x;
@@ -1048,7 +1064,7 @@ void LLFolderViewItem::draw()
{
std::string load_string = " ( Loading... ) ";
font->renderUTF8(load_string, 0, right_x, y, sSearchStatusColor,
LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, LLFontGL::NO_SHADOW,
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
S32_MAX, S32_MAX, &right_x, FALSE);
}
@@ -1058,7 +1074,7 @@ void LLFolderViewItem::draw()
if (!mLabelSuffix.empty())
{
font->renderUTF8( mLabelSuffix, 0, right_x, y, sSuffixColor,
LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, LLFontGL::NO_SHADOW,
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
S32_MAX, S32_MAX, &right_x, FALSE );
}
@@ -1081,7 +1097,7 @@ void LLFolderViewItem::draw()
F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD;
font->renderUTF8( combined_string, mStringMatchOffset, match_string_left, yy,
sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, LLFontGL::NO_SHADOW,
sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
filter_string_length, S32_MAX, &right_x, FALSE );
}
}

View File

@@ -108,8 +108,6 @@ private:
BOOL mIsSelected;
protected:
static const LLFontGL* sFont;
static const LLFontGL* sSmallFont;
static LLUIImagePtr sArrowImage;
static LLUIImagePtr sBoxImage;
@@ -159,6 +157,8 @@ protected:
virtual BOOL addItem(LLFolderViewItem*) { return FALSE; }
virtual BOOL addFolder(LLFolderViewFolder*) { return FALSE; }
static LLFontGL* getLabelFontForStyle(U8 style);
virtual void setCreationDate(time_t creation_date_utc) { mCreationDate = creation_date_utc; }
public:
@@ -329,6 +329,9 @@ public:
void* cargo_data,
EAcceptance* accept,
std::string& tooltip_msg);
private:
static std::map<U8, LLFontGL*> sFonts; // map of styles to fonts
};