Merge branch 'V2MultiWear' of git://github.com/Shyotl/SingularityViewer into V2MultiWear
This commit is contained in:
@@ -101,8 +101,6 @@ LLTabContainer::LLTabContainer(const std::string& name, const LLRect& rect, TabP
|
|||||||
mScrollPos(0),
|
mScrollPos(0),
|
||||||
mScrollPosPixels(0),
|
mScrollPosPixels(0),
|
||||||
mMaxScrollPos(0),
|
mMaxScrollPos(0),
|
||||||
mCloseCallback( NULL ),
|
|
||||||
mCallbackUserdata( NULL ),
|
|
||||||
mTitleBox(NULL),
|
mTitleBox(NULL),
|
||||||
mTopBorderHeight(LLPANEL_BORDER_WIDTH),
|
mTopBorderHeight(LLPANEL_BORDER_WIDTH),
|
||||||
mTabPosition(pos),
|
mTabPosition(pos),
|
||||||
@@ -217,9 +215,9 @@ void LLTabContainer::draw()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f)));
|
setScrollPosPixels(mIsVertical ? target_pixel_scroll : lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f)));
|
||||||
|
|
||||||
BOOL has_scroll_arrows = (mMaxScrollPos > 0) || (mScrollPosPixels > 0);
|
BOOL has_scroll_arrows = !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0));
|
||||||
if (!mIsVertical)
|
if (!mIsVertical)
|
||||||
{
|
{
|
||||||
mJumpPrevArrowBtn->setVisible( has_scroll_arrows );
|
mJumpPrevArrowBtn->setVisible( has_scroll_arrows );
|
||||||
@@ -242,7 +240,7 @@ void LLTabContainer::draw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Hide all the buttons
|
// Hide all the buttons
|
||||||
if (getTabsHidden())
|
if (getTabsHidden() || mIsVertical)
|
||||||
{
|
{
|
||||||
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
|
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
|
||||||
{
|
{
|
||||||
@@ -251,7 +249,13 @@ void LLTabContainer::draw()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LLPanel::draw();
|
{
|
||||||
|
LLRect clip_rect = getLocalRect();
|
||||||
|
clip_rect.mLeft+=(LLPANEL_BORDER_WIDTH + 2);
|
||||||
|
clip_rect.mRight-=(LLPANEL_BORDER_WIDTH + 2);
|
||||||
|
LLLocalClipRect clip(clip_rect);
|
||||||
|
LLPanel::draw();
|
||||||
|
}
|
||||||
|
|
||||||
// if tabs are hidden, don't draw them and leave them in the invisible state
|
// if tabs are hidden, don't draw them and leave them in the invisible state
|
||||||
if (!getTabsHidden())
|
if (!getTabsHidden())
|
||||||
@@ -265,19 +269,10 @@ void LLTabContainer::draw()
|
|||||||
|
|
||||||
// Draw some of the buttons...
|
// Draw some of the buttons...
|
||||||
LLRect clip_rect = getLocalRect();
|
LLRect clip_rect = getLocalRect();
|
||||||
if (has_scroll_arrows)
|
if (has_scroll_arrows && mIsVertical)
|
||||||
{
|
{
|
||||||
// ...but clip them.
|
clip_rect.mTop = top - getScrollPosPixels();
|
||||||
if (mIsVertical)
|
clip_rect.mBottom = TABCNTR_ARROW_BTN_SIZE+1;
|
||||||
{
|
|
||||||
clip_rect.mBottom = mNextArrowBtn->getRect().mTop + 3*TABCNTRV_PAD;
|
|
||||||
clip_rect.mTop = mPrevArrowBtn->getRect().mBottom - 3*TABCNTRV_PAD;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
clip_rect.mLeft = mPrevArrowBtn->getRect().mRight;
|
|
||||||
clip_rect.mRight = mNextArrowBtn->getRect().mLeft;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
LLLocalClipRect clip(clip_rect);
|
LLLocalClipRect clip(clip_rect);
|
||||||
|
|
||||||
@@ -309,12 +304,13 @@ void LLTabContainer::draw()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LLUI::pushMatrix();
|
else
|
||||||
{
|
{
|
||||||
|
LLUI::pushMatrix();
|
||||||
LLUI::translate((F32)tuple->mButton->getRect().mLeft, (F32)tuple->mButton->getRect().mBottom, 0.f);
|
LLUI::translate((F32)tuple->mButton->getRect().mLeft, (F32)tuple->mButton->getRect().mBottom, 0.f);
|
||||||
tuple->mButton->draw();
|
tuple->mButton->draw();
|
||||||
|
LLUI::popMatrix();
|
||||||
}
|
}
|
||||||
LLUI::popMatrix();
|
|
||||||
|
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
@@ -404,6 +400,7 @@ BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask )
|
|||||||
LLButton* tab_button = getTab(index)->mButton;
|
LLButton* tab_button = getTab(index)->mButton;
|
||||||
gFocusMgr.setMouseCapture(this);
|
gFocusMgr.setMouseCapture(this);
|
||||||
tab_button->setFocus(TRUE);
|
tab_button->setFocus(TRUE);
|
||||||
|
gFocusMgr.setKeyboardFocus(tab_button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return handled;
|
return handled;
|
||||||
@@ -570,7 +567,7 @@ BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask)
|
|||||||
{
|
{
|
||||||
if (getCurrentPanel())
|
if (getCurrentPanel())
|
||||||
{
|
{
|
||||||
getCurrentPanel()->setFocus(TRUE);
|
getCurrentPanel()->setFocus(TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,59 +648,63 @@ LLXMLNodePtr LLTabContainer::getXML(bool save_children) const
|
|||||||
// virtual
|
// virtual
|
||||||
BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip)
|
BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip)
|
||||||
{
|
{
|
||||||
bool const has_scroll_arrows = (getMaxScrollPos() > 0);
|
BOOL has_scroll_arrows = (getMaxScrollPos() > 0);
|
||||||
|
|
||||||
LLButton* button = NULL;
|
if(!getTabsHidden())
|
||||||
if (has_scroll_arrows)
|
|
||||||
{
|
{
|
||||||
// We're dragging an inventory item. Check if we're hovering over scroll arrows of this tab container.
|
// In that case, we'll open the hovered tab while dragging and dropping items.
|
||||||
if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y))
|
// This allows for drilling through tabs.
|
||||||
|
if (mDragAndDropDelayTimer.getStarted())
|
||||||
{
|
{
|
||||||
button = mJumpPrevArrowBtn;
|
if (mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME)
|
||||||
}
|
|
||||||
else if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y))
|
|
||||||
{
|
|
||||||
button = mJumpNextArrowBtn;
|
|
||||||
}
|
|
||||||
else if (mPrevArrowBtn->getRect().pointInRect(x, y))
|
|
||||||
{
|
|
||||||
button = mPrevArrowBtn;
|
|
||||||
}
|
|
||||||
else if (mNextArrowBtn->getRect().pointInRect(x, y))
|
|
||||||
{
|
|
||||||
button = mNextArrowBtn;
|
|
||||||
}
|
|
||||||
if (button)
|
|
||||||
{
|
|
||||||
if (mDragAndDropDelayTimer.getStarted() && mDragAndDropDelayTimer.hasExpired())
|
|
||||||
{
|
{
|
||||||
// We've been hovering (another) SCROLL_DELAY_TIME seconds. Emulate a button press.
|
if (has_scroll_arrows)
|
||||||
button->onCommit();
|
{
|
||||||
// Reset the timer.
|
if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y))
|
||||||
mDragAndDropDelayTimer.start(SCROLL_DELAY_TIME);
|
{
|
||||||
}
|
S32 local_x = x - mJumpPrevArrowBtn->getRect().mLeft;
|
||||||
else if (!mDragAndDropDelayTimer.getStarted())
|
S32 local_y = y - mJumpPrevArrowBtn->getRect().mBottom;
|
||||||
{
|
mJumpPrevArrowBtn->handleHover(local_x, local_y, mask);
|
||||||
// We just entered the arrow. Start the timer.
|
}
|
||||||
mDragAndDropDelayTimer.start(SCROLL_DELAY_TIME);
|
if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y))
|
||||||
|
{
|
||||||
|
S32 local_x = x - mJumpNextArrowBtn->getRect().mLeft;
|
||||||
|
S32 local_y = y - mJumpNextArrowBtn->getRect().mBottom;
|
||||||
|
mJumpNextArrowBtn->handleHover(local_x, local_y, mask);
|
||||||
|
}
|
||||||
|
if (mPrevArrowBtn->getRect().pointInRect(x, y))
|
||||||
|
{
|
||||||
|
S32 local_x = x - mPrevArrowBtn->getRect().mLeft;
|
||||||
|
S32 local_y = y - mPrevArrowBtn->getRect().mBottom;
|
||||||
|
mPrevArrowBtn->handleHover(local_x, local_y, mask);
|
||||||
|
}
|
||||||
|
else if (mNextArrowBtn->getRect().pointInRect(x, y))
|
||||||
|
{
|
||||||
|
S32 local_x = x - mNextArrowBtn->getRect().mLeft;
|
||||||
|
S32 local_y = y - mNextArrowBtn->getRect().mBottom;
|
||||||
|
mNextArrowBtn->handleHover(local_x, local_y, mask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
|
||||||
|
{
|
||||||
|
LLTabTuple* tuple = *iter;
|
||||||
|
tuple->mButton->setVisible( TRUE );
|
||||||
|
S32 local_x = x - tuple->mButton->getRect().mLeft;
|
||||||
|
S32 local_y = y - tuple->mButton->getRect().mBottom;
|
||||||
|
if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
|
||||||
|
{
|
||||||
|
tuple->mButton->onCommit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Stop the timer whether successful or not. Don't let it run forever.
|
||||||
|
mDragAndDropDelayTimer.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We're not on an arrow or just left it. Stop the time (in case it was running).
|
// Start a timer so we don't open tabs as soon as we hover on them
|
||||||
mDragAndDropDelayTimer.stop();
|
mDragAndDropDelayTimer.start();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
|
|
||||||
{
|
|
||||||
LLTabTuple* tuple = *iter;
|
|
||||||
tuple->mButton->setVisible( TRUE );
|
|
||||||
S32 local_x = x - tuple->mButton->getRect().mLeft;
|
|
||||||
S32 local_y = y - tuple->mButton->getRect().mBottom;
|
|
||||||
if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
|
|
||||||
{
|
|
||||||
tuple->mButton->onCommit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -717,6 +718,7 @@ void LLTabContainer::addTabPanel(LLPanel* child,
|
|||||||
BOOL placeholder,
|
BOOL placeholder,
|
||||||
eInsertionPoint insertion_point)
|
eInsertionPoint insertion_point)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (child->getParent() == this)
|
if (child->getParent() == this)
|
||||||
{
|
{
|
||||||
// already a child of mine
|
// already a child of mine
|
||||||
@@ -761,7 +763,7 @@ void LLTabContainer::addTabPanel(LLPanel* child,
|
|||||||
LLRect tab_panel_rect;
|
LLRect tab_panel_rect;
|
||||||
if (!getTabsHidden() && mIsVertical)
|
if (!getTabsHidden() && mIsVertical)
|
||||||
{
|
{
|
||||||
tab_panel_rect = LLRect(mMinTabWidth + (LLPANEL_BORDER_WIDTH * 2) + TABCNTRV_PAD,
|
tab_panel_rect = LLRect(mMinTabWidth + mRightTabBtnOffset + (LLPANEL_BORDER_WIDTH * 2) + TABCNTRV_PAD,
|
||||||
getRect().getHeight() - LLPANEL_BORDER_WIDTH,
|
getRect().getHeight() - LLPANEL_BORDER_WIDTH,
|
||||||
getRect().getWidth() - LLPANEL_BORDER_WIDTH,
|
getRect().getWidth() - LLPANEL_BORDER_WIDTH,
|
||||||
LLPANEL_BORDER_WIDTH);
|
LLPANEL_BORDER_WIDTH);
|
||||||
@@ -881,21 +883,30 @@ void LLTabContainer::addTabPanel(LLPanel* child,
|
|||||||
LLTabTuple* tuple = new LLTabTuple( this, child, btn, textbox );
|
LLTabTuple* tuple = new LLTabTuple( this, child, btn, textbox );
|
||||||
insertTuple( tuple, insertion_point );
|
insertTuple( tuple, insertion_point );
|
||||||
|
|
||||||
if (textbox)
|
//Don't add button and textbox if tab buttons are invisible(EXT - 576)
|
||||||
|
if (!getTabsHidden())
|
||||||
{
|
{
|
||||||
textbox->setSaveToXML(false);
|
if (textbox)
|
||||||
addChild( textbox, 0 );
|
{
|
||||||
|
textbox->setSaveToXML(false);
|
||||||
|
addChild( textbox, 0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (btn)
|
if (btn)
|
||||||
{
|
{
|
||||||
btn->setSaveToXML(false);
|
btn->setSaveToXML(false);
|
||||||
btn->setClickedCallback(&LLTabContainer::onTabBtn, tuple);
|
btn->setClickedCallback(boost::bind(&LLTabContainer::onTabBtn, this, _2, child));
|
||||||
addChild( btn, 0 );
|
addChild( btn, 0 );
|
||||||
}
|
}
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
addChild(child, 1);
|
addChild(child, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendChildToFront(mPrevArrowBtn);
|
||||||
|
sendChildToFront(mNextArrowBtn);
|
||||||
|
sendChildToFront(mJumpPrevArrowBtn);
|
||||||
|
sendChildToFront(mJumpNextArrowBtn);
|
||||||
|
|
||||||
if( select )
|
if( select )
|
||||||
{
|
{
|
||||||
@@ -1008,6 +1019,10 @@ void LLTabContainer::enableTabButton(S32 which, BOOL enable)
|
|||||||
{
|
{
|
||||||
mTabList[which]->mButton->setEnabled(enable);
|
mTabList[which]->mButton->setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
// Stop the DaD timer as it might run forever
|
||||||
|
// enableTabButton() is typically called on refresh and draw when anything changed
|
||||||
|
// in the tab container so it's a good time to reset that.
|
||||||
|
mDragAndDropDelayTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLTabContainer::deleteAllTabs()
|
void LLTabContainer::deleteAllTabs()
|
||||||
@@ -1239,7 +1254,7 @@ BOOL LLTabContainer::setTab(S32 which)
|
|||||||
// Make sure selected tab is within scroll region
|
// Make sure selected tab is within scroll region
|
||||||
if (mIsVertical)
|
if (mIsVertical)
|
||||||
{
|
{
|
||||||
S32 num_visible = getTabCount() - getMaxScrollPos();
|
/*S32 num_visible = getTabCount() - getMaxScrollPos();
|
||||||
if( i >= getScrollPos() && i <= getScrollPos() + num_visible)
|
if( i >= getScrollPos() && i <= getScrollPos() + num_visible)
|
||||||
{
|
{
|
||||||
setCurrentPanelIndex(which);
|
setCurrentPanelIndex(which);
|
||||||
@@ -1248,6 +1263,25 @@ BOOL LLTabContainer::setTab(S32 which)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
is_visible = FALSE;
|
is_visible = FALSE;
|
||||||
|
}*/
|
||||||
|
if (getMaxScrollPos() > 0)
|
||||||
|
{
|
||||||
|
if( i < getScrollPos() )
|
||||||
|
{
|
||||||
|
setScrollPos(i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
S32 available_height_with_arrows = getRect().getHeight() - getTopBorderHeight() - (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
|
||||||
|
S32 min_scroll_pos = llmax(i-llfloor(((F32)available_height_with_arrows)/((F32)BTN_HEIGHT))+1,0);
|
||||||
|
setScrollPos(llclamp(getScrollPos(), min_scroll_pos, i));
|
||||||
|
setScrollPos(llmin(getScrollPos(), getMaxScrollPos()));
|
||||||
|
}
|
||||||
|
is_visible = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
is_visible = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (getMaxScrollPos() > 0)
|
else if (getMaxScrollPos() > 0)
|
||||||
@@ -1289,12 +1323,12 @@ BOOL LLTabContainer::setTab(S32 which)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mIsVertical && getCurrentPanelIndex() >= 0)
|
/*if (mIsVertical && getCurrentPanelIndex() >= 0)
|
||||||
{
|
{
|
||||||
LLTabTuple* tuple = getTab(getCurrentPanelIndex());
|
LLTabTuple* tuple = getTab(getCurrentPanelIndex());
|
||||||
tuple->mTabPanel->setVisible( TRUE );
|
tuple->mTabPanel->setVisible( TRUE );
|
||||||
tuple->mButton->setToggleState( TRUE );
|
tuple->mButton->setToggleState( TRUE );
|
||||||
}
|
}*/
|
||||||
return is_visible;
|
return is_visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1337,28 +1371,44 @@ void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, const L
|
|||||||
if( tuple )
|
if( tuple )
|
||||||
{
|
{
|
||||||
tuple->mButton->setImageOverlay(image_name, LLFontGL::RIGHT, color);
|
tuple->mButton->setImageOverlay(image_name, LLFontGL::RIGHT, color);
|
||||||
|
reshapeTuple(tuple);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!mIsVertical)
|
void LLTabContainer::setTabImage(LLPanel* child, const LLUUID& image_id, const LLColor4& color)
|
||||||
{
|
{
|
||||||
const LLFontGL* fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL );
|
LLTabTuple* tuple = getTabByPanel(child);
|
||||||
// remove current width from total tab strip width
|
if( tuple )
|
||||||
mTotalTabWidth -= tuple->mButton->getRect().getWidth();
|
{
|
||||||
|
tuple->mButton->setImageOverlay(image_id, LLFontGL::LEFT, color);
|
||||||
|
reshapeTuple(tuple);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
S32 image_overlay_width = tuple->mButton->getImageOverlay().notNull() ?
|
void LLTabContainer::reshapeTuple(LLTabTuple* tuple)
|
||||||
tuple->mButton->getImageOverlay()->getImage()->getWidth(0) :
|
{
|
||||||
0;
|
|
||||||
|
|
||||||
tuple->mPadding = image_overlay_width;
|
if (!mIsVertical)
|
||||||
|
{
|
||||||
|
const LLFontGL* fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL );
|
||||||
|
S32 image_overlay_width = 0;
|
||||||
|
image_overlay_width = tuple->mButton->getImageOverlay().notNull() ?
|
||||||
|
tuple->mButton->getImageOverlay()->getImage()->getWidth(0) : 0;
|
||||||
|
// remove current width from total tab strip width
|
||||||
|
mTotalTabWidth -= tuple->mButton->getRect().getWidth();
|
||||||
|
|
||||||
tuple->mButton->setRightHPad(6);
|
|
||||||
tuple->mButton->reshape(llclamp(fontp->getWidth(tuple->mButton->getLabelSelected()) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth),
|
|
||||||
|
tuple->mPadding = image_overlay_width;
|
||||||
|
|
||||||
|
tuple->mButton->setRightHPad(6);
|
||||||
|
tuple->mButton->reshape(llclamp(fontp->getWidth(tuple->mButton->getLabelSelected()) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth),
|
||||||
tuple->mButton->getRect().getHeight());
|
tuple->mButton->getRect().getHeight());
|
||||||
// add back in button width to total tab strip width
|
// add back in button width to total tab strip width
|
||||||
mTotalTabWidth += tuple->mButton->getRect().getWidth();
|
mTotalTabWidth += tuple->mButton->getRect().getWidth();
|
||||||
|
|
||||||
// tabs have changed size, might need to scroll to see current tab
|
// tabs have changed size, might need to scroll to see current tab
|
||||||
updateMaxScrollPos();
|
updateMaxScrollPos();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1403,7 +1453,7 @@ void LLTabContainer::setPanelTitle(S32 index, const std::string& title)
|
|||||||
{
|
{
|
||||||
LLTabTuple* tuple = getTab(index);
|
LLTabTuple* tuple = getTab(index);
|
||||||
LLButton* tab_button = tuple->mButton;
|
LLButton* tab_button = tuple->mButton;
|
||||||
const LLFontGL* fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL );
|
const LLFontGL* fontp = LLFontGL::getFontSansSerifSmall();
|
||||||
mTotalTabWidth -= tab_button->getRect().getWidth();
|
mTotalTabWidth -= tab_button->getRect().getWidth();
|
||||||
tab_button->reshape(llclamp(fontp->getWidth(title) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth), tab_button->getRect().getHeight());
|
tab_button->reshape(llclamp(fontp->getWidth(title) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth), tab_button->getRect().getHeight());
|
||||||
mTotalTabWidth += tab_button->getRect().getWidth();
|
mTotalTabWidth += tab_button->getRect().getWidth();
|
||||||
@@ -1414,84 +1464,62 @@ void LLTabContainer::setPanelTitle(S32 index, const std::string& title)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// static
|
void LLTabContainer::onTabBtn( const LLSD& data, LLPanel* panel )
|
||||||
void LLTabContainer::onTabBtn( void* userdata )
|
|
||||||
{
|
{
|
||||||
LLTabTuple* tuple = (LLTabTuple*) userdata;
|
LLTabTuple* tuple = getTabByPanel(panel);
|
||||||
LLTabContainer* self = tuple->mTabContainer;
|
selectTabPanel( panel );
|
||||||
self->selectTabPanel( tuple->mTabPanel );
|
|
||||||
|
|
||||||
tuple->mTabPanel->setFocus(TRUE);
|
if (tuple)
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
void LLTabContainer::onCloseBtn( void* userdata )
|
|
||||||
{
|
|
||||||
LLTabContainer* self = (LLTabContainer*) userdata;
|
|
||||||
if( self->mCloseCallback )
|
|
||||||
{
|
{
|
||||||
self->mCloseCallback( self->mCallbackUserdata );
|
tuple->mTabPanel->setFocus(TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
void LLTabContainer::onNextBtn( const LLSD& data )
|
||||||
void LLTabContainer::onNextBtn( void* userdata )
|
|
||||||
{
|
{
|
||||||
// Scroll tabs to the left
|
if (!mScrolled)
|
||||||
LLTabContainer* self = (LLTabContainer*) userdata;
|
|
||||||
if (!self->mScrolled)
|
|
||||||
{
|
{
|
||||||
self->scrollNext();
|
scrollNext();
|
||||||
}
|
}
|
||||||
self->mScrolled = FALSE;
|
mScrolled = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
void LLTabContainer::onNextBtnHeld( const LLSD& data )
|
||||||
void LLTabContainer::onNextBtnHeld( void* userdata )
|
|
||||||
{
|
{
|
||||||
LLTabContainer* self = (LLTabContainer*) userdata;
|
if (mScrollTimer.getElapsedTimeF32() > SCROLL_STEP_TIME)
|
||||||
if (self->mScrollTimer.getElapsedTimeF32() > SCROLL_STEP_TIME)
|
|
||||||
{
|
{
|
||||||
self->mScrollTimer.reset();
|
mScrollTimer.reset();
|
||||||
self->scrollNext();
|
scrollNext();
|
||||||
self->mScrolled = TRUE;
|
mScrolled = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
void LLTabContainer::onPrevBtn( const LLSD& data )
|
||||||
void LLTabContainer::onPrevBtn( void* userdata )
|
|
||||||
{
|
{
|
||||||
LLTabContainer* self = (LLTabContainer*) userdata;
|
if (!mScrolled)
|
||||||
if (!self->mScrolled)
|
|
||||||
{
|
{
|
||||||
self->scrollPrev();
|
scrollPrev();
|
||||||
}
|
}
|
||||||
self->mScrolled = FALSE;
|
mScrolled = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
void LLTabContainer::onJumpFirstBtn( const LLSD& data )
|
||||||
void LLTabContainer::onJumpFirstBtn( void* userdata )
|
|
||||||
{
|
{
|
||||||
LLTabContainer* self = (LLTabContainer*) userdata;
|
mScrollPos = 0;
|
||||||
self->mScrollPos = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
void LLTabContainer::onJumpLastBtn( const LLSD& data )
|
||||||
void LLTabContainer::onJumpLastBtn( void* userdata )
|
|
||||||
{
|
{
|
||||||
LLTabContainer* self = (LLTabContainer*) userdata;
|
mScrollPos = mMaxScrollPos;
|
||||||
self->mScrollPos = self->mMaxScrollPos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
void LLTabContainer::onPrevBtnHeld( const LLSD& data )
|
||||||
void LLTabContainer::onPrevBtnHeld( void* userdata )
|
|
||||||
{
|
{
|
||||||
LLTabContainer* self = (LLTabContainer*) userdata;
|
if (mScrollTimer.getElapsedTimeF32() > SCROLL_STEP_TIME)
|
||||||
if (self->mScrollTimer.getElapsedTimeF32() > SCROLL_STEP_TIME)
|
|
||||||
{
|
{
|
||||||
self->mScrollTimer.reset();
|
mScrollTimer.reset();
|
||||||
self->scrollPrev();
|
scrollPrev();
|
||||||
self->mScrolled = TRUE;
|
mScrolled = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1608,7 +1636,7 @@ void LLTabContainer::initButtons()
|
|||||||
{
|
{
|
||||||
// Left and right scroll arrows (for when there are too many tabs to show all at once).
|
// Left and right scroll arrows (for when there are too many tabs to show all at once).
|
||||||
S32 btn_top = getRect().getHeight();
|
S32 btn_top = getRect().getHeight();
|
||||||
S32 btn_top_lower = getRect().mBottom+TABCNTRV_ARROW_BTN_SIZE;
|
S32 btn_top_lower = TABCNTRV_ARROW_BTN_SIZE;
|
||||||
|
|
||||||
LLRect up_arrow_btn_rect;
|
LLRect up_arrow_btn_rect;
|
||||||
up_arrow_btn_rect.setLeftTopAndSize( mMinTabWidth/2 , btn_top, TABCNTRV_ARROW_BTN_SIZE, TABCNTRV_ARROW_BTN_SIZE );
|
up_arrow_btn_rect.setLeftTopAndSize( mMinTabWidth/2 , btn_top, TABCNTRV_ARROW_BTN_SIZE, TABCNTRV_ARROW_BTN_SIZE );
|
||||||
@@ -1619,18 +1647,20 @@ void LLTabContainer::initButtons()
|
|||||||
out_id = "UIImgBtnScrollUpOutUUID";
|
out_id = "UIImgBtnScrollUpOutUUID";
|
||||||
in_id = "UIImgBtnScrollUpInUUID";
|
in_id = "UIImgBtnScrollUpInUUID";
|
||||||
mPrevArrowBtn = new LLButton(std::string("Up Arrow"), up_arrow_btn_rect,
|
mPrevArrowBtn = new LLButton(std::string("Up Arrow"), up_arrow_btn_rect,
|
||||||
out_id, in_id, LLStringUtil::null,
|
out_id, in_id, LLStringUtil::null, NULL );
|
||||||
&onPrevBtn, this, NULL );
|
|
||||||
mPrevArrowBtn->setFollowsTop();
|
mPrevArrowBtn->setFollowsTop();
|
||||||
mPrevArrowBtn->setFollowsLeft();
|
mPrevArrowBtn->setFollowsLeft();
|
||||||
|
mPrevArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onPrevBtn,this,_2));
|
||||||
|
mPrevArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onPrevBtnHeld, this, _2));
|
||||||
|
|
||||||
out_id = "UIImgBtnScrollDownOutUUID";
|
out_id = "UIImgBtnScrollDownOutUUID";
|
||||||
in_id = "UIImgBtnScrollDownInUUID";
|
in_id = "UIImgBtnScrollDownInUUID";
|
||||||
mNextArrowBtn = new LLButton(std::string("Down Arrow"), down_arrow_btn_rect,
|
mNextArrowBtn = new LLButton(std::string("Down Arrow"), down_arrow_btn_rect,
|
||||||
out_id, in_id, LLStringUtil::null,
|
out_id, in_id, LLStringUtil::null, NULL );
|
||||||
&onNextBtn, this, NULL );
|
|
||||||
mNextArrowBtn->setFollowsBottom();
|
mNextArrowBtn->setFollowsBottom();
|
||||||
mNextArrowBtn->setFollowsLeft();
|
mNextArrowBtn->setFollowsLeft();
|
||||||
|
mNextArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onNextBtn,this,_2));
|
||||||
|
mNextArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onNextBtnHeld, this, _2));
|
||||||
}
|
}
|
||||||
else // Horizontal
|
else // Horizontal
|
||||||
{
|
{
|
||||||
@@ -1668,31 +1698,35 @@ void LLTabContainer::initButtons()
|
|||||||
in_id = "UIImgBtnJumpLeftInUUID";
|
in_id = "UIImgBtnJumpLeftInUUID";
|
||||||
mJumpPrevArrowBtn = new LLButton(std::string("Jump Left Arrow"), jump_left_arrow_btn_rect,
|
mJumpPrevArrowBtn = new LLButton(std::string("Jump Left Arrow"), jump_left_arrow_btn_rect,
|
||||||
out_id, in_id, LLStringUtil::null,
|
out_id, in_id, LLStringUtil::null,
|
||||||
&LLTabContainer::onJumpFirstBtn, this, LLFontGL::getFontSansSerif() );
|
NULL, NULL, LLFontGL::getFontSansSerif() );
|
||||||
|
mJumpPrevArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onJumpFirstBtn, this, _2));
|
||||||
mJumpPrevArrowBtn->setFollowsLeft();
|
mJumpPrevArrowBtn->setFollowsLeft();
|
||||||
|
|
||||||
out_id = "UIImgBtnScrollLeftOutUUID";
|
out_id = "UIImgBtnScrollLeftOutUUID";
|
||||||
in_id = "UIImgBtnScrollLeftInUUID";
|
in_id = "UIImgBtnScrollLeftInUUID";
|
||||||
mPrevArrowBtn = new LLButton(std::string("Left Arrow"), left_arrow_btn_rect,
|
mPrevArrowBtn = new LLButton(std::string("Left Arrow"), left_arrow_btn_rect,
|
||||||
out_id, in_id, LLStringUtil::null,
|
out_id, in_id, LLStringUtil::null,
|
||||||
&LLTabContainer::onPrevBtn, this, LLFontGL::getFontSansSerif() );
|
NULL, NULL, LLFontGL::getFontSansSerif() );
|
||||||
mPrevArrowBtn->setHeldDownCallback(boost::bind(LLTabContainer::onPrevBtnHeld, this));
|
|
||||||
|
mPrevArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onPrevBtn, this, _2));
|
||||||
|
mPrevArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onPrevBtnHeld, this, _2));
|
||||||
mPrevArrowBtn->setFollowsLeft();
|
mPrevArrowBtn->setFollowsLeft();
|
||||||
|
|
||||||
out_id = "UIImgBtnJumpRightOutUUID";
|
out_id = "UIImgBtnJumpRightOutUUID";
|
||||||
in_id = "UIImgBtnJumpRightInUUID";
|
in_id = "UIImgBtnJumpRightInUUID";
|
||||||
mJumpNextArrowBtn = new LLButton(std::string("Jump Right Arrow"), jump_right_arrow_btn_rect,
|
mJumpNextArrowBtn = new LLButton(std::string("Jump Right Arrow"), jump_right_arrow_btn_rect,
|
||||||
out_id, in_id, LLStringUtil::null,
|
out_id, in_id, LLStringUtil::null,
|
||||||
&LLTabContainer::onJumpLastBtn, this,
|
NULL, NULL, LLFontGL::getFontSansSerif());
|
||||||
LLFontGL::getFontSansSerif());
|
mJumpNextArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onJumpLastBtn, this, _2));
|
||||||
mJumpNextArrowBtn->setFollowsRight();
|
mJumpNextArrowBtn->setFollowsRight();
|
||||||
|
|
||||||
out_id = "UIImgBtnScrollRightOutUUID";
|
out_id = "UIImgBtnScrollRightOutUUID";
|
||||||
in_id = "UIImgBtnScrollRightInUUID";
|
in_id = "UIImgBtnScrollRightInUUID";
|
||||||
mNextArrowBtn = new LLButton(std::string("Right Arrow"), right_arrow_btn_rect,
|
mNextArrowBtn = new LLButton(std::string("Right Arrow"), right_arrow_btn_rect,
|
||||||
out_id, in_id, LLStringUtil::null,
|
out_id, in_id, LLStringUtil::null,
|
||||||
&LLTabContainer::onNextBtn, this,
|
NULL, NULL, LLFontGL::getFontSansSerif());
|
||||||
LLFontGL::getFontSansSerif());
|
mNextArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onNextBtn, this, _2));
|
||||||
|
mNextArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onNextBtnHeld, this, _2));
|
||||||
mNextArrowBtn->setFollowsRight();
|
mNextArrowBtn->setFollowsRight();
|
||||||
|
|
||||||
if( getTabPosition() == TOP )
|
if( getTabPosition() == TOP )
|
||||||
@@ -1711,12 +1745,10 @@ void LLTabContainer::initButtons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mPrevArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onPrevBtnHeld, this));
|
|
||||||
mPrevArrowBtn->setSaveToXML(false);
|
mPrevArrowBtn->setSaveToXML(false);
|
||||||
mPrevArrowBtn->setTabStop(FALSE);
|
mPrevArrowBtn->setTabStop(FALSE);
|
||||||
addChild(mPrevArrowBtn);
|
addChild(mPrevArrowBtn);
|
||||||
|
|
||||||
mNextArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onNextBtnHeld, this));
|
|
||||||
mNextArrowBtn->setSaveToXML(false);
|
mNextArrowBtn->setSaveToXML(false);
|
||||||
mNextArrowBtn->setTabStop(FALSE);
|
mNextArrowBtn->setTabStop(FALSE);
|
||||||
addChild(mNextArrowBtn);
|
addChild(mNextArrowBtn);
|
||||||
@@ -1788,11 +1820,11 @@ void LLTabContainer::updateMaxScrollPos()
|
|||||||
BOOL no_scroll = TRUE;
|
BOOL no_scroll = TRUE;
|
||||||
if (mIsVertical)
|
if (mIsVertical)
|
||||||
{
|
{
|
||||||
S32 tab_total_height = (BTN_HEIGHT + TABCNTRV_PAD) * getTabCount();
|
S32 tab_total_height = (BTN_HEIGHT + TABCNTRV_PAD) * getTabCount() + TABCNTRV_PAD;
|
||||||
S32 available_height = getRect().getHeight() - getTopBorderHeight();
|
S32 available_height = getRect().getHeight() - getTopBorderHeight() - 2 * LLPANEL_BORDER_WIDTH;
|
||||||
if( tab_total_height > available_height )
|
if( tab_total_height > available_height )
|
||||||
{
|
{
|
||||||
S32 available_height_with_arrows = getRect().getHeight() - 2*(TABCNTRV_ARROW_BTN_SIZE + 3*TABCNTRV_PAD);
|
S32 available_height_with_arrows = getRect().getHeight() - getTopBorderHeight() - (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
|
||||||
S32 additional_needed = tab_total_height - available_height_with_arrows;
|
S32 additional_needed = tab_total_height - available_height_with_arrows;
|
||||||
setMaxScrollPos((S32) ceil(additional_needed / float(BTN_HEIGHT) ) );
|
setMaxScrollPos((S32) ceil(additional_needed / float(BTN_HEIGHT) ) );
|
||||||
no_scroll = FALSE;
|
no_scroll = FALSE;
|
||||||
@@ -1845,7 +1877,7 @@ void LLTabContainer::commitHoveredButton(S32 x, S32 y)
|
|||||||
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
|
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
|
||||||
{
|
{
|
||||||
LLTabTuple* tuple = *iter;
|
LLTabTuple* tuple = *iter;
|
||||||
tuple->mButton->setVisible( TRUE );
|
//tuple->mButton->setVisible( TRUE );
|
||||||
S32 local_x = x - tuple->mButton->getRect().mLeft;
|
S32 local_x = x - tuple->mButton->getRect().mLeft;
|
||||||
S32 local_y = y - tuple->mButton->getRect().mBottom;
|
S32 local_y = y - tuple->mButton->getRect().mBottom;
|
||||||
if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
|
if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ public:
|
|||||||
BOOL getTabPanelFlashing(LLPanel* child);
|
BOOL getTabPanelFlashing(LLPanel* child);
|
||||||
void setTabPanelFlashing(LLPanel* child, BOOL state);
|
void setTabPanelFlashing(LLPanel* child, BOOL state);
|
||||||
void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white);
|
void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white);
|
||||||
|
void setTabImage(LLPanel* child, const LLUUID& img_id, const LLColor4& color = LLColor4::white);
|
||||||
void setTitle( const std::string& title );
|
void setTitle( const std::string& title );
|
||||||
const std::string getPanelTitle(S32 index);
|
const std::string getPanelTitle(S32 index);
|
||||||
|
|
||||||
@@ -128,14 +129,13 @@ public:
|
|||||||
|
|
||||||
void startDragAndDropDelayTimer() { mDragAndDropDelayTimer.start(); }
|
void startDragAndDropDelayTimer() { mDragAndDropDelayTimer.start(); }
|
||||||
|
|
||||||
static void onCloseBtn(void* userdata);
|
void onTabBtn( const LLSD& data, LLPanel* panel );
|
||||||
static void onTabBtn(void* userdata);
|
void onNextBtn(const LLSD& data);
|
||||||
static void onNextBtn(void* userdata);
|
void onNextBtnHeld(const LLSD& data);
|
||||||
static void onNextBtnHeld(void* userdata);
|
void onPrevBtn(const LLSD& data);
|
||||||
static void onPrevBtn(void* userdata);
|
void onPrevBtnHeld(const LLSD& data);
|
||||||
static void onPrevBtnHeld(void* userdata);
|
void onJumpFirstBtn( const LLSD& data );
|
||||||
static void onJumpFirstBtn( void* userdata );
|
void onJumpLastBtn( const LLSD& data );
|
||||||
static void onJumpLastBtn( void* userdata );
|
|
||||||
|
|
||||||
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
|
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
|
||||||
|
|
||||||
@@ -167,13 +167,13 @@ private:
|
|||||||
void updateMaxScrollPos();
|
void updateMaxScrollPos();
|
||||||
void commitHoveredButton(S32 x, S32 y);
|
void commitHoveredButton(S32 x, S32 y);
|
||||||
|
|
||||||
|
void reshapeTuple(LLTabTuple* tuple);
|
||||||
// Variables
|
// Variables
|
||||||
|
|
||||||
typedef std::vector<LLTabTuple*> tuple_list_t;
|
typedef std::vector<LLTabTuple*> tuple_list_t;
|
||||||
tuple_list_t mTabList;
|
tuple_list_t mTabList;
|
||||||
|
|
||||||
S32 mCurrentTabIdx;
|
S32 mCurrentTabIdx;
|
||||||
S32 mNextTabIdx;
|
|
||||||
BOOL mTabsHidden;
|
BOOL mTabsHidden;
|
||||||
|
|
||||||
BOOL mScrolled;
|
BOOL mScrolled;
|
||||||
@@ -182,9 +182,6 @@ private:
|
|||||||
S32 mScrollPosPixels;
|
S32 mScrollPosPixels;
|
||||||
S32 mMaxScrollPos;
|
S32 mMaxScrollPos;
|
||||||
|
|
||||||
void (*mCloseCallback)(void*);
|
|
||||||
void* mCallbackUserdata;
|
|
||||||
|
|
||||||
LLTextBox* mTitleBox;
|
LLTextBox* mTitleBox;
|
||||||
|
|
||||||
S32 mTopBorderHeight;
|
S32 mTopBorderHeight;
|
||||||
|
|||||||
@@ -1183,7 +1183,8 @@ void LLViewerWindow::handleFocusLost(LLWindow *window)
|
|||||||
BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated)
|
BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated)
|
||||||
{
|
{
|
||||||
// Let the voice chat code check for its PTT key. Note that this never affects event processing.
|
// Let the voice chat code check for its PTT key. Note that this never affects event processing.
|
||||||
gVoiceClient->keyDown(key, mask);
|
if(gVoiceClient)
|
||||||
|
gVoiceClient->keyDown(key, mask);
|
||||||
|
|
||||||
if (gAwayTimer.getElapsedTimeF32() > MIN_AFK_TIME)
|
if (gAwayTimer.getElapsedTimeF32() > MIN_AFK_TIME)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user