CHUI-509 : Fixed : Add params to inventory widgets to control font colors (required for library items and links).
parent
55bd994b39
commit
a4a2cc62c3
|
|
@ -47,16 +47,14 @@ static LLDefaultChildRegistry::Register<LLFolderViewItem> r("folder_view_item");
|
|||
// statics
|
||||
std::map<U8, LLFontGL*> LLFolderViewItem::sFonts; // map of styles to fonts
|
||||
|
||||
bool LLFolderViewItem::sColorSetInitialized = false;
|
||||
LLUIColor LLFolderViewItem::sFgColor;
|
||||
LLUIColor LLFolderViewItem::sHighlightBgColor;
|
||||
LLUIColor LLFolderViewItem::sHighlightFgColor;
|
||||
LLUIColor LLFolderViewItem::sFocusOutlineColor;
|
||||
LLUIColor LLFolderViewItem::sMouseOverColor;
|
||||
LLUIColor LLFolderViewItem::sFilterBGColor;
|
||||
LLUIColor LLFolderViewItem::sFilterTextColor;
|
||||
LLUIColor LLFolderViewItem::sSuffixColor;
|
||||
LLUIColor LLFolderViewItem::sLibraryColor;
|
||||
LLUIColor LLFolderViewItem::sLinkColor;
|
||||
LLUIColor LLFolderViewItem::sSearchStatusColor;
|
||||
|
||||
// only integers can be initialized in header
|
||||
|
|
@ -106,6 +104,8 @@ LLFolderViewItem::Params::Params()
|
|||
item_top_pad("item_top_pad"),
|
||||
creation_date(),
|
||||
allow_open("allow_open", true),
|
||||
font_color("font_color"),
|
||||
font_highlight_color("font_highlight_color"),
|
||||
left_pad("left_pad", 0),
|
||||
icon_pad("icon_pad", 0),
|
||||
icon_width("icon_width", 0),
|
||||
|
|
@ -113,7 +113,7 @@ LLFolderViewItem::Params::Params()
|
|||
text_pad_right("text_pad_right", 0),
|
||||
arrow_size("arrow_size", 0),
|
||||
max_folder_item_overlap("max_folder_item_overlap", 0)
|
||||
{}
|
||||
{ }
|
||||
|
||||
// Default constructor
|
||||
LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
|
||||
|
|
@ -137,6 +137,8 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
|
|||
mViewModelItem(p.listener),
|
||||
mIsMouseOverTitle(false),
|
||||
mAllowOpen(p.allow_open),
|
||||
mFontColor(p.font_color),
|
||||
mFontHighlightColor(p.font_highlight_color),
|
||||
mLeftPad(p.left_pad),
|
||||
mIconPad(p.icon_pad),
|
||||
mIconWidth(p.icon_width),
|
||||
|
|
@ -145,17 +147,18 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
|
|||
mArrowSize(p.arrow_size),
|
||||
mMaxFolderItemOverlap(p.max_folder_item_overlap)
|
||||
{
|
||||
sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
|
||||
sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE);
|
||||
sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE);
|
||||
sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE);
|
||||
sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE);
|
||||
sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE);
|
||||
sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE);
|
||||
sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE);
|
||||
sLibraryColor = LLUIColorTable::instance().getColor("InventoryItemLibraryColor", DEFAULT_WHITE);
|
||||
sLinkColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE);
|
||||
sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE);
|
||||
if (!sColorSetInitialized)
|
||||
{
|
||||
sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
|
||||
sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE);
|
||||
sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE);
|
||||
sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE);
|
||||
sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE);
|
||||
sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE);
|
||||
sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE);
|
||||
sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE);
|
||||
sColorSetInitialized = true;
|
||||
}
|
||||
|
||||
if (mViewModelItem)
|
||||
{
|
||||
|
|
@ -785,10 +788,6 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo
|
|||
|
||||
void LLFolderViewItem::drawLabel(const LLFontGL * font, const F32 x, const F32 y, const LLColor4& color, F32 &right_x)
|
||||
{
|
||||
//TODO RN: implement this in terms of getColor()
|
||||
//if (highlight_link) color = sLinkColor;
|
||||
//if (gInventory.isObjectDescendentOf(getViewModelItem()->getUUID(), gInventory.getLibraryRootFolderID())) color = sLibraryColor;
|
||||
|
||||
//--------------------------------------------------------------------------------//
|
||||
// Draw the actual label text
|
||||
//
|
||||
|
|
@ -857,7 +856,7 @@ void LLFolderViewItem::draw()
|
|||
box_image->draw(box_rect, sFilterBGColor);
|
||||
}
|
||||
|
||||
LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor;
|
||||
LLColor4 color = (mIsSelected && filled) ? mFontHighlightColor : mFontColor;
|
||||
drawLabel(font, text_left, y, color, right_x);
|
||||
|
||||
//--------------------------------------------------------------------------------//
|
||||
|
|
|
|||
|
|
@ -61,6 +61,9 @@ public:
|
|||
Optional<time_t> creation_date;
|
||||
Optional<bool> allow_open;
|
||||
|
||||
Optional<LLUIColor> font_color;
|
||||
Optional<LLUIColor> font_highlight_color;
|
||||
|
||||
Optional<S32> left_pad,
|
||||
icon_pad,
|
||||
icon_width,
|
||||
|
|
@ -116,19 +119,20 @@ protected:
|
|||
mIsMouseOverTitle,
|
||||
mAllowOpen,
|
||||
mSelectPending;
|
||||
|
||||
LLUIColor mFontColor;
|
||||
LLUIColor mFontHighlightColor;
|
||||
|
||||
// For now assuming all colors are the same in derived classes.
|
||||
static bool sColorSetInitialized;
|
||||
static LLUIColor sFgColor;
|
||||
static LLUIColor sFgDisabledColor;
|
||||
static LLUIColor sHighlightBgColor;
|
||||
static LLUIColor sHighlightFgColor;
|
||||
static LLUIColor sFocusOutlineColor;
|
||||
static LLUIColor sMouseOverColor;
|
||||
static LLUIColor sFilterBGColor;
|
||||
static LLUIColor sFilterTextColor;
|
||||
static LLUIColor sSuffixColor;
|
||||
static LLUIColor sLibraryColor;
|
||||
static LLUIColor sLinkColor;
|
||||
static LLUIColor sSearchStatusColor;
|
||||
|
||||
// this is an internal method used for adding items to folders. A
|
||||
|
|
|
|||
|
|
@ -255,6 +255,11 @@ BOOL LLInvFVBridge::isLink() const
|
|||
return mIsLink;
|
||||
}
|
||||
|
||||
BOOL LLInvFVBridge::isLibraryItem() const
|
||||
{
|
||||
return gInventory.isObjectDescendentOf(getUUID(),gInventory.getLibraryRootFolderID());
|
||||
}
|
||||
|
||||
/*virtual*/
|
||||
/**
|
||||
* @brief Adds this item into clipboard storage
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ public:
|
|||
virtual BOOL isItemMovable() const;
|
||||
virtual BOOL isItemInTrash() const;
|
||||
virtual BOOL isLink() const;
|
||||
virtual BOOL isLibraryItem() const;
|
||||
//virtual BOOL removeItem() = 0;
|
||||
virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch);
|
||||
virtual void move(LLFolderViewModelItem* new_parent_bridge) {}
|
||||
|
|
|
|||
|
|
@ -57,6 +57,15 @@ const std::string LLInventoryPanel::RECENTITEMS_SORT_ORDER = std::string("Recent
|
|||
const std::string LLInventoryPanel::INHERIT_SORT_ORDER = std::string("");
|
||||
static const LLInventoryFolderViewModelBuilder INVENTORY_BRIDGE_BUILDER;
|
||||
|
||||
// statics
|
||||
bool LLInventoryPanel::sColorSetInitialized = false;
|
||||
LLUIColor LLInventoryPanel::sDefaultColor;
|
||||
LLUIColor LLInventoryPanel::sDefaultHighlightColor;
|
||||
LLUIColor LLInventoryPanel::sLibraryColor;
|
||||
LLUIColor LLInventoryPanel::sLinkColor;
|
||||
|
||||
const LLColor4U DEFAULT_WHITE(255, 255, 255);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Class LLInventoryPanelObserver
|
||||
//
|
||||
|
|
@ -140,6 +149,15 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
|
|||
{
|
||||
mInvFVBridgeBuilder = &INVENTORY_BRIDGE_BUILDER;
|
||||
|
||||
if (!sColorSetInitialized)
|
||||
{
|
||||
sDefaultColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
|
||||
sDefaultHighlightColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE);
|
||||
sLibraryColor = LLUIColorTable::instance().getColor("InventoryItemLibraryColor", DEFAULT_WHITE);
|
||||
sLinkColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE);
|
||||
sColorSetInitialized = true;
|
||||
}
|
||||
|
||||
// context menu callbacks
|
||||
mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLInventoryPanel::doToSelected, this, _2));
|
||||
mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH));
|
||||
|
|
@ -705,6 +723,9 @@ LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * br
|
|||
params.listener = bridge;
|
||||
params.tool_tip = params.name;
|
||||
|
||||
params.font_color = (bridge->isLibraryItem() ? sLibraryColor : (bridge->isLink() ? sLinkColor : sDefaultColor));
|
||||
params.font_highlight_color = (bridge->isLibraryItem() ? sLibraryColor : (bridge->isLink() ? sLinkColor : sDefaultHighlightColor));
|
||||
|
||||
return LLUICtrlFactory::create<LLFolderViewFolder>(params);
|
||||
}
|
||||
|
||||
|
|
@ -718,6 +739,9 @@ LLFolderViewItem * LLInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge
|
|||
params.listener = bridge;
|
||||
params.rect = LLRect (0, 0, 0, 0);
|
||||
params.tool_tip = params.name;
|
||||
|
||||
params.font_color = (bridge->isLibraryItem() ? sLibraryColor : (bridge->isLink() ? sLinkColor : sDefaultColor));
|
||||
params.font_highlight_color = (bridge->isLibraryItem() ? sLibraryColor : (bridge->isLink() ? sLinkColor : sDefaultHighlightColor));
|
||||
|
||||
return LLUICtrlFactory::create<LLFolderViewItem>(params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -275,6 +275,13 @@ protected:
|
|||
// Builds the UI. Call this once the inventory is usable.
|
||||
void initializeViews();
|
||||
|
||||
// Specific inventory colors
|
||||
static bool sColorSetInitialized;
|
||||
static LLUIColor sDefaultColor;
|
||||
static LLUIColor sDefaultHighlightColor;
|
||||
static LLUIColor sLibraryColor;
|
||||
static LLUIColor sLinkColor;
|
||||
|
||||
LLFolderViewItem* buildNewViews(const LLUUID& id);
|
||||
BOOL getIsHiddenFolderType(LLFolderType::EType folder_type) const;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue