Fix layout issue of inventory item bounding box if folder item height differs from default

master
Ansariel 2018-01-13 15:59:44 +01:00
parent b66ae23c30
commit 963e699a3c
5 changed files with 69 additions and 7 deletions

View File

@ -122,10 +122,6 @@ LLFolderViewItem::Params::Params()
// <FS:Ansariel> Inventory specials
for_inventory("for_inventory", false)
{
// <FS:Ansariel> User-definable item height in folder views
static LLCachedControl<S32> FolderViewItemHeight(*LLUI::sSettingGroups["config"], "FSFolderViewItemHeight");
item_height = (S32)FolderViewItemHeight;
// </FS:Ansariel>
}
// Default constructor
@ -164,7 +160,8 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
mArrowSize(p.arrow_size),
mMaxFolderItemOverlap(p.max_folder_item_overlap),
// <FS:Ansariel> Inventory specials
mForInventory(p.for_inventory)
mForInventory(p.for_inventory),
mItemTopPad(p.item_top_pad)
{
if (!sColorSetInitialized)
{
@ -745,7 +742,9 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L
//--------------------------------------------------------------------------------//
// Draw open folder arrow
//
const S32 TOP_PAD = default_params.item_top_pad;
// <FS:Ansariel> Inventory specials
//const S32 TOP_PAD = default_params.item_top_pad;
const S32 TOP_PAD = mItemTopPad;
if (hasVisibleChildren() || !isFolderComplete())
{
@ -905,7 +904,9 @@ void LLFolderViewItem::draw()
const BOOL filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : FALSE); // If we have keyboard focus, draw selection filled
const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
const S32 TOP_PAD = default_params.item_top_pad;
// <FS:Ansariel> Inventory specials
//const S32 TOP_PAD = default_params.item_top_pad;
const S32 TOP_PAD = mItemTopPad;
const LLFontGL* font = getLabelFontForStyle(mLabelStyle);

View File

@ -135,6 +135,7 @@ protected:
// <FS:Ansariel> Inventory specials
bool mForInventory;
S32 mItemTopPad;
// For now assuming all colors are the same in derived classes.
static bool sColorSetInitialized;

View File

@ -211,6 +211,12 @@ LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id )
// <FS:Ansariel> Inventory specials
p.for_inventory = true;
static LLCachedControl<S32> fsFolderViewItemHeight(*LLUI::sSettingGroups["config"], "FSFolderViewItemHeight");
const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
p.item_height = fsFolderViewItemHeight;
p.item_top_pad = default_params.item_top_pad - (default_params.item_height - fsFolderViewItemHeight) / 2 - 1;
// </FS:Ansariel>
return LLUICtrlFactory::create<LLFolderView>(p);
}
@ -857,6 +863,12 @@ LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * br
// <FS:Ansariel> Inventory specials
params.for_inventory = true;
static LLCachedControl<S32> fsFolderViewItemHeight(*LLUI::sSettingGroups["config"], "FSFolderViewItemHeight");
const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
params.item_height = fsFolderViewItemHeight;
params.item_top_pad = default_params.item_top_pad - (default_params.item_height - fsFolderViewItemHeight) / 2 - 1;
// </FS:Ansariel>
return LLUICtrlFactory::create<LLFolderViewFolder>(params);
}
@ -876,6 +888,12 @@ LLFolderViewItem * LLInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge
// <FS:Ansariel> Inventory specials
params.for_inventory = true;
static LLCachedControl<S32> fsFolderViewItemHeight(*LLUI::sSettingGroups["config"], "FSFolderViewItemHeight");
const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
params.item_height = fsFolderViewItemHeight;
params.item_top_pad = default_params.item_top_pad - (default_params.item_height - fsFolderViewItemHeight) / 2 - 1;
// </FS:Ansariel>
return LLUICtrlFactory::create<LLFolderViewItem>(params);
}

View File

@ -77,6 +77,15 @@ LLFolderViewFolder * LLInboxInventoryPanel::createFolderViewFolder(LLInvFVBridge
params.font_color = item_color;
params.font_highlight_color = item_color;
params.allow_drop = allow_drop;
// <FS:Ansariel> Inventory specials
params.for_inventory = true;
static LLCachedControl<S32> fsFolderViewItemHeight(*LLUI::sSettingGroups["config"], "FSFolderViewItemHeight");
const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
params.item_height = fsFolderViewItemHeight;
params.item_top_pad = default_params.item_top_pad - (default_params.item_height - fsFolderViewItemHeight) / 2 - 1;
// </FS:Ansariel>
return LLUICtrlFactory::create<LLInboxFolderViewFolder>(params);
}
@ -96,6 +105,15 @@ LLFolderViewItem * LLInboxInventoryPanel::createFolderViewItem(LLInvFVBridge * b
params.font_color = item_color;
params.font_highlight_color = item_color;
// <FS:Ansariel> Inventory specials
params.for_inventory = true;
static LLCachedControl<S32> fsFolderViewItemHeight(*LLUI::sSettingGroups["config"], "FSFolderViewItemHeight");
const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
params.item_height = fsFolderViewItemHeight;
params.item_top_pad = default_params.item_top_pad - (default_params.item_height - fsFolderViewItemHeight) / 2 - 1;
// </FS:Ansariel>
return LLUICtrlFactory::create<LLInboxFolderViewItem>(params);
}

View File

@ -1736,6 +1736,12 @@ void LLPanelObjectInventory::reset()
// <FS:Ansariel> Inventory specials
p.for_inventory = true;
static LLCachedControl<S32> fsFolderViewItemHeight(*LLUI::sSettingGroups["config"], "FSFolderViewItemHeight");
const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
p.item_height = fsFolderViewItemHeight;
p.item_top_pad = default_params.item_top_pad - (default_params.item_height - fsFolderViewItemHeight) / 2 - 1;
// </FS:Ansariel>
mFolders = LLUICtrlFactory::create<LLFolderView>(p);
mFolders->setCallbackRegistrar(&mCommitCallbackRegistrar);
@ -1900,6 +1906,12 @@ void LLPanelObjectInventory::createFolderViews(LLInventoryObject* inventory_root
// <FS:Ansariel> Inventory specials
p.for_inventory = true;
static LLCachedControl<S32> fsFolderViewItemHeight(*LLUI::sSettingGroups["config"], "FSFolderViewItemHeight");
const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
p.item_height = fsFolderViewItemHeight;
p.item_top_pad = default_params.item_top_pad - (default_params.item_height - fsFolderViewItemHeight) / 2 - 1;
// </FS:Ansariel>
LLFolderViewFolder* new_folder = LLUICtrlFactory::create<LLFolderViewFolder>(p);
new_folder->addToFolder(mFolders);
new_folder->toggleOpen();
@ -1950,6 +1962,12 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li
// <FS:Ansariel> Inventory specials
p.for_inventory = true;
static LLCachedControl<S32> fsFolderViewItemHeight(*LLUI::sSettingGroups["config"], "FSFolderViewItemHeight");
const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
p.item_height = fsFolderViewItemHeight;
p.item_top_pad = default_params.item_top_pad - (default_params.item_height - fsFolderViewItemHeight) / 2 - 1;
// </FS:Ansariel>
view = LLUICtrlFactory::create<LLFolderViewFolder>(p);
child_categories.push_back(new obj_folder_pair(obj,
(LLFolderViewFolder*)view));
@ -1969,6 +1987,12 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li
// <FS:Ansariel> Inventory specials
params.for_inventory = true;
static LLCachedControl<S32> fsFolderViewItemHeight(*LLUI::sSettingGroups["config"], "FSFolderViewItemHeight");
const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
params.item_height = fsFolderViewItemHeight;
params.item_top_pad = default_params.item_top_pad - (default_params.item_height - fsFolderViewItemHeight) / 2 - 1;
// </FS:Ansariel>
view = LLUICtrlFactory::create<LLFolderViewItem> (params);
}
view->addToFolder(folder);