Liny 2013-04-08 08:41:42 -07:00
commit 1f0de5d3e2
3 changed files with 1 additions and 161 deletions

View File

@ -206,10 +206,6 @@ LLTabContainer::Params::Params()
: tab_width("tab_width"),
tab_min_width("tab_min_width"),
tab_max_width("tab_max_width"),
// <FS:LO> Add proper scrolling to vertical tab
tab_min_height("tab_min_height"),
tab_max_height("tab_max_height"),
// </FS:LO>
tab_height("tab_height"),
label_pad_bottom("label_pad_bottom"),
label_pad_left("label_pad_left"),
@ -248,8 +244,6 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p)
mMinTabWidth(0),
mMaxTabWidth(p.tab_max_width),
mTabHeight(p.tab_height),
mMinTabHeight(0), // <FS:LO> Add proper scrolling to vertical tabs
mMaxTabHeight(p.tab_max_width), // <FS:LO> Add proper scrolling to vertical tabs
mLabelPadBottom(p.label_pad_bottom),
mLabelPadLeft(p.label_pad_left),
mPrevArrowBtn(NULL),
@ -260,7 +254,6 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p)
mJumpNextArrowBtn(NULL),
mRightTabBtnOffset(p.tab_padding_right),
mTotalTabWidth(0),
mTotalTabHeight(0), // <FS:LO> Add proper scrolling to vertical tabs
mTabPosition(p.tab_position),
mFontHalign(p.font_halign),
mFont(p.font),
@ -308,22 +301,6 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p)
mMinTabWidth = tabcntr_vert_tab_min_width;
}
// <FS:LO> Add proper scrolling to vertical tabs
if (p.tab_height.isProvided())
{
mMinTabHeight = p.tab_height;
}
else if (mIsVertical)
{
mMinTabWidth = p.tab_min_height;
}
else
{
mMinTabHeight = 20; // TODO find a more sutable value for this or make it a setting like the above. -Liny
}
// </FS:LO>
initButtons( );
}
@ -431,15 +408,13 @@ void LLTabContainer::draw()
static LLUICachedControl<S32> tabcntr_tab_h_pad ("UITabCntrTabHPad", 0);
static LLUICachedControl<S32> tabcntr_arrow_btn_size ("UITabCntrArrowBtnSize", 0);
static LLUICachedControl<S32> tabcntr_tab_partial_width ("UITabCntrTabPartialWidth", 0);
static LLUICachedControl<S32> tabcntr_tab_partial_height ("UITabCntrTabPartialHeight", 0); // <FS:LO> Add proper scrolling to vertical tabs
S32 target_pixel_scroll = 0;
S32 cur_scroll_pos = getScrollPos();
if (cur_scroll_pos > 0)
{
//S32 available_width_with_arrows = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + tabcntr_arrow_btn_size + tabcntr_arrow_btn_size + 1); // <FS:LO> Add proper scrolling to vertical tabs
S32 available_width_with_arrows = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + tabcntr_arrow_btn_size + tabcntr_arrow_btn_size + 1);
if (!mIsVertical)
{
S32 available_width_with_arrows = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + tabcntr_arrow_btn_size + tabcntr_arrow_btn_size + 1);// <FS:LO> Add proper scrolling to vertical tabs
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
if (cur_scroll_pos == 0)
@ -455,26 +430,6 @@ void LLTabContainer::draw()
// clamp so that rightmost tab never leaves right side of screen
target_pixel_scroll = llmin(mTotalTabWidth - available_width_with_arrows, target_pixel_scroll);
}
// <FS:LO> Add proper scrolling to vertical tabs
else
{
S32 available_height_with_arrows = getRect().getHeight() - 2 * (LLPANEL_BORDER_WIDTH + tabcntrv_arrow_btn_size + tabcntrv_arrow_btn_size + 1);
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
if (cur_scroll_pos == 0)
{
break;
}
target_pixel_scroll += (*iter)->mButton->getRect().getHeight();
cur_scroll_pos--;
}
// Show part of the tab to the bottom of what is fully visible
target_pixel_scroll -= tabcntr_tab_partial_height;
// clamp so that topmost tab never leaves top side of screen
target_pixel_scroll = llmin(mTotalTabHeight - available_height_with_arrows, target_pixel_scroll);
}
// </FS:LO>
}
setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f)));
@ -1082,17 +1037,10 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel)
LLStringUtil::trim(trimmed_label);
S32 button_width = mMinTabWidth;
S32 button_height = mMinTabHeight; // <FS:LO> Add proper scrolling to vertical tabs
if (!mIsVertical)
{
button_width = llclamp(mFont->getWidth(trimmed_label) + tab_padding, mMinTabWidth, mMaxTabWidth);
}
// <FS:LO> Add proper scrolling to vertical tabs
else
{
button_height = llclamp(mTabHeight + tab_padding, mMinTabHeight, mMaxTabHeight);
}
// </FS:LO>
// Tab panel
S32 tab_panel_top;
@ -1141,7 +1089,6 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel)
child->setVisible( FALSE ); // Will be made visible when selected
mTotalTabWidth += button_width;
mTotalTabHeight += button_height; // <FS:LO> Add proper scrolling to vertical tabs
// Tab button
LLRect btn_rect; // Note: btn_rect.mLeft is just a dummy. Will be updated in draw().
@ -1334,18 +1281,6 @@ void LLTabContainer::removeTabPanel(LLPanel* child)
}
tab_count++;
}
// <FS:LO> Add proper scrolling to vertical tabs
// Adjust the total tab height.
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
if( tuple->mTabPanel == child )
{
mTotalTabHeight -= tuple->mButton->getRect().getHeight();
break;
}
}
// </FS:LO>
}
else
{
@ -1823,37 +1758,6 @@ void LLTabContainer::reshapeTuple(LLTabTuple* tuple)
// tabs have changed size, might need to scroll to see current tab
updateMaxScrollPos();
}
// <FS:LO> Add proper scrolling to vertical tabs
else
{
S32 image_overlay_height = 0;
if(mCustomIconCtrlUsed)
{
LLCustomButtonIconCtrl* button = dynamic_cast<LLCustomButtonIconCtrl*>(tuple->mButton);
LLIconCtrl* icon_ctrl = button ? button->getIconCtrl() : NULL;
image_overlay_height = icon_ctrl ? icon_ctrl->getRect().getHeight() : 0;
}
else
{
image_overlay_height = tuple->mButton->getImageOverlay().notNull() ?
tuple->mButton->getImageOverlay()->getImage()->getHeight(0) : 0;
}
// remove current height from total tab strip height
mTotalTabHeight -= tuple->mButton->getRect().getHeight();
tuple->mPadding = image_overlay_height;
tuple->mButton->reshape(tuple->mButton->getRect().getWidth(),
llclamp(mTabHeight + tab_padding + tuple->mPadding, mMinTabHeight, mMaxTabHeight));
// add back in button height to total tab strip height
mTotalTabHeight += tuple->mButton->getRect().getHeight();
// tabs have changed size, might need to scroll to see current tab
updateMaxScrollPos();
}
// </FS:LO>
}
void LLTabContainer::setTitle(const std::string& title)
@ -1900,24 +1804,9 @@ void LLTabContainer::setPanelTitle(S32 index, const std::string& title)
LLTabTuple* tuple = getTab(index);
LLButton* tab_button = tuple->mButton;
const LLFontGL* fontp = LLFontGL::getFontSansSerifSmall();
/* <FS:LO> Add proper scrolling to vertical tabs
mTotalTabWidth -= tab_button->getRect().getWidth();
tab_button->reshape(llclamp(fontp->getWidth(title) + tab_padding + tuple->mPadding, mMinTabWidth, mMaxTabWidth), tab_button->getRect().getHeight());
mTotalTabWidth += tab_button->getRect().getWidth();
*/
if(!mIsVertical)
{
mTotalTabWidth -= tab_button->getRect().getWidth();
tab_button->reshape(llclamp(fontp->getWidth(title) + tab_padding + tuple->mPadding, mMinTabWidth, mMaxTabWidth), tab_button->getRect().getHeight());
mTotalTabWidth += tab_button->getRect().getWidth();
}
else
{
mTotalTabHeight -= tab_button->getRect().getHeight();
tab_button->reshape(tab_button->getRect().getWidth(), llclamp(mTabHeight + tab_padding + tuple->mPadding, mMinTabHeight, mMaxTabHeight));
mTotalTabHeight += tab_button->getRect().getHeight();
}
// </FS:LO>
tab_button->setLabelSelected(title);
tab_button->setLabelUnselected(title);
}
@ -2192,7 +2081,6 @@ void LLTabContainer::updateMaxScrollPos()
BOOL no_scroll = TRUE;
if (mIsVertical)
{
/* <FS:LO> Add proper scrolling to vertical tabs
S32 tab_total_height = (BTN_HEIGHT + tabcntrv_pad) * getTabCount();
S32 available_height = getRect().getHeight() - getTopBorderHeight();
if( tab_total_height > available_height )
@ -2202,36 +2090,6 @@ void LLTabContainer::updateMaxScrollPos()
S32 additional_needed = tab_total_height - available_height_with_arrows;
setMaxScrollPos((S32) ceil(additional_needed / float(BTN_HEIGHT) ) );
no_scroll = FALSE;
}*/
static LLUICachedControl<S32> tabcntr_tab_v_pad ("UITabCntrTabHPad", 0);
static LLUICachedControl<S32> tabcntr_arrow_btn_size ("UITabCntrvArrowBtnSize", 0);
static LLUICachedControl<S32> tabcntr_tab_partial_height ("UITabCntrTabPartialHeight", 0);
S32 tab_space = 0;
S32 available_space = 0;
tab_space = mTotalTabHeight;
available_space = getRect().getHeight() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + tabcntr_tab_v_pad);
if( tab_space > available_space )
{
S32 available_height_with_arrows = getRect().getHeight() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + tabcntr_arrow_btn_size + tabcntr_arrow_btn_size + 1);
// subtract off reserved portion on left
available_height_with_arrows -= tabcntr_tab_partial_height;
S32 running_tab_height = 0;
setMaxScrollPos(getTabCount());
for(tuple_list_t::reverse_iterator tab_it = mTabList.rbegin(); tab_it != mTabList.rend(); ++tab_it)
{
running_tab_height += (*tab_it)->mButton->getRect().getHeight();
if (running_tab_height > available_height_with_arrows)
{
break;
}
setMaxScrollPos(getMaxScrollPos()-1);
}
// in case last tab doesn't actually fit on screen, make it the last scrolling position
setMaxScrollPos(llmin(getMaxScrollPos(), getTabCount() - 1));
// </FS:LO>
no_scroll = FALSE;
}
}
else

View File

@ -79,10 +79,6 @@ public:
tab_min_width,
tab_max_width,
tab_height,
// <FS:LO> Add proper scrolling to vertical tabs
tab_min_height,
tab_max_height,
// </FS:LO>
label_pad_bottom,
label_pad_left;
@ -291,7 +287,6 @@ private:
TabPosition mTabPosition;
S32 mLockedTabCount;
S32 mMinTabWidth;
S32 mMinTabHeight; // <FS:LO> Add proper scrolling to vertical tabs
LLButton* mPrevArrowBtn;
LLButton* mNextArrowBtn;
@ -304,9 +299,7 @@ private:
S32 mRightTabBtnOffset; // Extra room to the right of the tab buttons.
S32 mMaxTabWidth;
S32 mMaxTabHeight; // <FS:LO> Add proper scrolling to vertical tabs
S32 mTotalTabWidth;
S32 mTotalTabHeight; // <FS:LO> Add proper scrolling to vertical tabs
S32 mTabHeight;
// Padding under the text labels of tab buttons

View File

@ -15052,17 +15052,6 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>12</integer>
</map>
<key>UITabCntrTabPartialHeight</key>
<map>
<key>Comment</key>
<string>UI Tab Container Tab Partial Height</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>5</integer>
</map>
<key>UITabCntrVertTabMinWidth</key>
<map>
<key>Comment</key>