diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llui/lltabcontainer.cpp | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/linden/indra/llui/lltabcontainer.cpp b/linden/indra/llui/lltabcontainer.cpp index 19dc6ec..0400b50 100644 --- a/linden/indra/llui/lltabcontainer.cpp +++ b/linden/indra/llui/lltabcontainer.cpp | |||
@@ -12,12 +12,12 @@ | |||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlife.com/developers/opensource/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlife.com/developers/opensource/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -156,7 +156,12 @@ void LLTabContainerCommon::lockTabs(S32 num_tabs) | |||
156 | { | 156 | { |
157 | // count current tabs or use supplied value and ensure no new tabs get | 157 | // count current tabs or use supplied value and ensure no new tabs get |
158 | // inserted between them | 158 | // inserted between them |
159 | mLockedTabCount = num_tabs > 0 ? num_tabs : getTabCount(); | 159 | mLockedTabCount = num_tabs > 0 ? llmin(getTabCount(), num_tabs) : getTabCount(); |
160 | } | ||
161 | |||
162 | void LLTabContainerCommon::unlockTabs() | ||
163 | { | ||
164 | mLockedTabCount = 0; | ||
160 | } | 165 | } |
161 | 166 | ||
162 | void LLTabContainerCommon::removeTabPanel(LLPanel* child) | 167 | void LLTabContainerCommon::removeTabPanel(LLPanel* child) |
@@ -557,7 +562,7 @@ void LLTabContainerCommon::setTabImage(LLPanel* child, std::string img_name, con | |||
557 | } | 562 | } |
558 | 563 | ||
559 | void LLTabContainerCommon::setTitle(const LLString& title) | 564 | void LLTabContainerCommon::setTitle(const LLString& title) |
560 | { | 565 | { |
561 | if (mTitleBox) | 566 | if (mTitleBox) |
562 | { | 567 | { |
563 | mTitleBox->setText( title ); | 568 | mTitleBox->setText( title ); |
@@ -721,6 +726,14 @@ void LLTabContainerCommon::insertTuple(LLTabTuple * tuple, eInsertionPoint inser | |||
721 | // insert the new tab in the front of the list | 726 | // insert the new tab in the front of the list |
722 | mTabList.insert(mTabList.begin() + mLockedTabCount, tuple); | 727 | mTabList.insert(mTabList.begin() + mLockedTabCount, tuple); |
723 | break; | 728 | break; |
729 | case LEFT_OF_CURRENT: | ||
730 | // insert the new tab before the current tab (but not before mLockedTabCount) | ||
731 | { | ||
732 | tuple_list_t::iterator current_iter = mTabList.begin() + llmax(mLockedTabCount, mCurrentTabIdx); | ||
733 | mTabList.insert(current_iter, tuple); | ||
734 | } | ||
735 | break; | ||
736 | |||
724 | case RIGHT_OF_CURRENT: | 737 | case RIGHT_OF_CURRENT: |
725 | // insert the new tab after the current tab (but not before mLockedTabCount) | 738 | // insert the new tab after the current tab (but not before mLockedTabCount) |
726 | { | 739 | { |
@@ -946,14 +959,14 @@ void LLTabContainer::addTabPanel(LLPanel* child, | |||
946 | if( LLTabContainer::TOP == mTabPosition ) | 959 | if( LLTabContainer::TOP == mTabPosition ) |
947 | { | 960 | { |
948 | btn_rect.setLeftTopAndSize( 0, mRect.getHeight() - mTopBorderHeight + tab_fudge, button_width, TABCNTR_TAB_HEIGHT ); | 961 | btn_rect.setLeftTopAndSize( 0, mRect.getHeight() - mTopBorderHeight + tab_fudge, button_width, TABCNTR_TAB_HEIGHT ); |
949 | tab_img = "UIImgBtnTabTopOutUUID"; | 962 | tab_img = "tab_top_blue.tga"; |
950 | tab_selected_img = "UIImgBtnTabTopInUUID"; | 963 | tab_selected_img = "tab_top_selected_blue.tga"; |
951 | } | 964 | } |
952 | else | 965 | else |
953 | { | 966 | { |
954 | btn_rect.setOriginAndSize( 0, 0 + tab_fudge, button_width, TABCNTR_TAB_HEIGHT ); | 967 | btn_rect.setOriginAndSize( 0, 0 + tab_fudge, button_width, TABCNTR_TAB_HEIGHT ); |
955 | tab_img = "UIImgBtnTabBottomOutUUID"; | 968 | tab_img = "tab_bottom_blue.tga"; |
956 | tab_selected_img = "UIImgBtnTabBottomInUUID"; | 969 | tab_selected_img = "tab_bottom_selected_blue.tga"; |
957 | } | 970 | } |
958 | 971 | ||
959 | if (placeholder) | 972 | if (placeholder) |
@@ -979,7 +992,7 @@ void LLTabContainer::addTabPanel(LLPanel* child, | |||
979 | LLButton* btn = new LLButton( | 992 | LLButton* btn = new LLButton( |
980 | LLString(child->getName()) + " tab", | 993 | LLString(child->getName()) + " tab", |
981 | btn_rect, | 994 | btn_rect, |
982 | tab_img, tab_selected_img, "", | 995 | "", "", "", |
983 | &LLTabContainer::onTabBtn, NULL, // set userdata below | 996 | &LLTabContainer::onTabBtn, NULL, // set userdata below |
984 | font, | 997 | font, |
985 | trimmed_label, trimmed_label ); | 998 | trimmed_label, trimmed_label ); |
@@ -987,7 +1000,7 @@ void LLTabContainer::addTabPanel(LLPanel* child, | |||
987 | btn->setVisible( FALSE ); | 1000 | btn->setVisible( FALSE ); |
988 | btn->setToolTip( tooltip ); | 1001 | btn->setToolTip( tooltip ); |
989 | btn->setScaleImage(TRUE); | 1002 | btn->setScaleImage(TRUE); |
990 | btn->setFixedBorder(14, 14); | 1003 | btn->setImages(tab_img, tab_selected_img); |
991 | 1004 | ||
992 | // Try to squeeze in a bit more text | 1005 | // Try to squeeze in a bit more text |
993 | btn->setLeftHPad( 4 ); | 1006 | btn->setLeftHPad( 4 ); |
@@ -1139,7 +1152,7 @@ BOOL LLTabContainer::selectTab(S32 which) | |||
1139 | 1152 | ||
1140 | //if( gFocusMgr.childHasKeyboardFocus( this ) ) | 1153 | //if( gFocusMgr.childHasKeyboardFocus( this ) ) |
1141 | //{ | 1154 | //{ |
1142 | // gFocusMgr.setKeyboardFocus( NULL, NULL ); | 1155 | // gFocusMgr.setKeyboardFocus( NULL ); |
1143 | //} | 1156 | //} |
1144 | 1157 | ||
1145 | LLTabTuple* selected_tuple = mTabList[which]; | 1158 | LLTabTuple* selected_tuple = mTabList[which]; |
@@ -1370,7 +1383,7 @@ BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) | |||
1370 | { | 1383 | { |
1371 | LLButton* tab_button = mTabList[getCurrentPanelIndex()]->mButton; | 1384 | LLButton* tab_button = mTabList[getCurrentPanelIndex()]->mButton; |
1372 | gFocusMgr.setMouseCapture(this); | 1385 | gFocusMgr.setMouseCapture(this); |
1373 | gFocusMgr.setKeyboardFocus(tab_button, NULL); | 1386 | gFocusMgr.setKeyboardFocus(tab_button); |
1374 | } | 1387 | } |
1375 | } | 1388 | } |
1376 | return handled; | 1389 | return handled; |
@@ -1475,7 +1488,7 @@ BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) | |||
1475 | BOOL LLTabContainer::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect ) | 1488 | BOOL LLTabContainer::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect ) |
1476 | { | 1489 | { |
1477 | BOOL handled = LLPanel::handleToolTip( x, y, msg, sticky_rect ); | 1490 | BOOL handled = LLPanel::handleToolTip( x, y, msg, sticky_rect ); |
1478 | if (!handled && mTabList.size() > 0 && getVisible() && pointInView( x, y ) ) | 1491 | if (!handled && mTabList.size() > 0) |
1479 | { | 1492 | { |
1480 | LLTabTuple* firsttuple = mTabList[0]; | 1493 | LLTabTuple* firsttuple = mTabList[0]; |
1481 | 1494 | ||
@@ -1645,12 +1658,12 @@ void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, const L | |||
1645 | mTotalTabWidth -= tuple->mButton->getRect().getWidth(); | 1658 | mTotalTabWidth -= tuple->mButton->getRect().getWidth(); |
1646 | 1659 | ||
1647 | S32 image_overlay_width = tuple->mButton->getImageOverlay().notNull() ? | 1660 | S32 image_overlay_width = tuple->mButton->getImageOverlay().notNull() ? |
1648 | tuple->mButton->getImageOverlay()->getWidth(0) : | 1661 | tuple->mButton->getImageOverlay()->getImage()->getWidth(0) : |
1649 | 0; | 1662 | 0; |
1650 | 1663 | ||
1651 | tuple->mPadding = image_overlay_width; | 1664 | tuple->mPadding = image_overlay_width; |
1652 | 1665 | ||
1653 | tuple->mButton->setRightHPad(tuple->mPadding + LLBUTTON_H_PAD); | 1666 | tuple->mButton->setRightHPad(6); |
1654 | tuple->mButton->reshape(llclamp(fontp->getWidth(tuple->mButton->getLabelSelected()) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth), | 1667 | tuple->mButton->reshape(llclamp(fontp->getWidth(tuple->mButton->getLabelSelected()) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth), |
1655 | tuple->mButton->getRect().getHeight()); | 1668 | tuple->mButton->getRect().getHeight()); |
1656 | // add back in button width to total tab strip width | 1669 | // add back in button width to total tab strip width |