Permalink
Browse files

Fix for scrolllist columns not resizing when header width is adjusted.

  • Loading branch information...
Shyotl committed May 2, 2016
1 parent 62ee456 commit abb4b1ac7c277e55fa662d78e12e58bdf9bdf778
Showing with 12 additions and 9 deletions.
  1. +2 −2 indra/llui/llscrolllistcolumn.cpp
  2. +9 −6 indra/llui/llscrolllistctrl.cpp
  3. +1 −1 indra/llui/llscrolllistctrl.h
@@ -249,8 +249,8 @@ void LLScrollColumnHeader::handleReshape(const LLRect& new_rect, bool by_user)
// tell scroll list to layout columns again
// do immediate update to get proper feedback to resize handle
// which needs to know how far the resize actually went
mColumn->mParentCtrl->dirtyColumns(); //Must flag as dirty, else updateColumns will probably be a noop.
mColumn->mParentCtrl->updateColumns();
const bool force_update = true;
mColumn->mParentCtrl->updateColumns(force_update);
}
}
@@ -570,7 +570,6 @@ S32 LLScrollListCtrl::calcMaxContentWidth()
if (mColumnWidthsDirty)
{
mColumnWidthsDirty = false;
// update max content width for this column, by looking at all items
column->mMaxContentWidth = column->mHeader ? LLFontGL::getFontSansSerifSmall()->getWidth(column->mLabel.getWString()) + mColumnPadding + HEADING_TEXT_PADDING : 0;
item_list::iterator iter;
@@ -584,8 +583,8 @@ S32 LLScrollListCtrl::calcMaxContentWidth()
}
max_item_width += column->mMaxContentWidth;
}
mColumnWidthsDirty = false;
mMaxContentWidth = max_item_width;
return max_item_width;
}
@@ -599,7 +598,7 @@ bool LLScrollListCtrl::updateColumnWidths()
if (!column) continue;
// update column width
S32 new_width = column->getWidth();
S32 new_width = 0;
if (column->mRelWidth >= 0)
{
new_width = (S32)ll_round(column->mRelWidth*mItemListRect.getWidth());
@@ -608,6 +607,10 @@ bool LLScrollListCtrl::updateColumnWidths()
{
new_width = (mItemListRect.getWidth() - mTotalStaticColumnWidth - mTotalColumnPadding) / mNumDynamicWidthColumns;
}
else
{
new_width = column->getWidth();
}
if (column->getWidth() != new_width)
{
@@ -650,9 +653,9 @@ void LLScrollListCtrl::updateLineHeightInsert(LLScrollListItem* itemp)
}
void LLScrollListCtrl::updateColumns()
void LLScrollListCtrl::updateColumns(bool force_update)
{
if (!mColumnsDirty)
if (!mColumnsDirty && !force_update)
return;
mColumnsDirty = false;
@@ -706,7 +709,7 @@ void LLScrollListCtrl::updateColumns()
}
// propagate column widths to individual cells
if (columns_changed_width)
if (columns_changed_width || force_update)
{
item_list::iterator iter;
for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
@@ -288,7 +288,7 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler,
static void onClickColumn(void *userdata);
virtual void updateColumns();
virtual void updateColumns(bool force_update = false);
S32 calcMaxContentWidth();
bool updateColumnWidths();
S32 getMaxContentWidth() { return mMaxContentWidth; }

0 comments on commit abb4b1a

Please sign in to comment.