diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 989ccaf17c..33116a1b34 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -228,6 +228,9 @@ LLTabContainer::Params::Params() LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) : LLPanel(p), mCurrentTabIdx(-1), +// [SL:KB] - Checked: UI-TabDndButtonCommit | Checked: 2011-06-16 (Catznip-2.6.0c) | Added: Catznip-2.6.0c + mDragAndDropHoverIdx(-1), +// [/SL:KB] mTabsHidden(p.hide_tabs), mScrolled(FALSE), mScrollPos(0), @@ -834,6 +837,30 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag { BOOL has_scroll_arrows = (getMaxScrollPos() > 0); +// [SL:KB] - Checked: UI-TabDndButtonCommit | Checked: 2011-06-16 (Catznip-2.6.0c) | Added: Catznip-2.6.0c + S32 curHoverIdx = -1; + if (!getTabsHidden()) + { + for(tuple_list_t::const_iterator itTab = mTabList.begin(); itTab != mTabList.end(); ++itTab) + { + const LLTabTuple* pTuple = *itTab; + S32 local_x = x - pTuple->mButton->getRect().mLeft; + S32 local_y = y - pTuple->mButton->getRect().mBottom; + if ( (pTuple->mButton->getEnabled()) && (pTuple->mButton->pointInView(local_x, local_y)) ) + curHoverIdx = itTab - mTabList.begin(); + } + } + + if (-1 == curHoverIdx) + mDragAndDropDelayTimer.stop(); // Mouse not hovering over a tab button + else if ( (mCurrentTabIdx != curHoverIdx) && (!mDragAndDropDelayTimer.getStarted()) ) + mDragAndDropDelayTimer.start(); // Mouse hovering over a tab button + else if ( (mDragAndDropHoverIdx != curHoverIdx) && (mDragAndDropDelayTimer.getStarted()) ) + mDragAndDropDelayTimer.reset(); // Mouse hovering over a different tab button + + mDragAndDropHoverIdx = curHoverIdx; +// [/SL:KB] + if( mDragAndDropDelayTimer.getStarted() && mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME ) { if (has_scroll_arrows) @@ -864,18 +891,29 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag } } - for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) +// [SL:KB] - Checked: UI-TabDndButtonCommit | Checked: 2011-06-16 (Catznip-2.6.0c) | Added: Catznip-2.6.0c + if (-1 != mDragAndDropHoverIdx) { - 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()) + const LLTabTuple* pTuple = mTabList[mDragAndDropHoverIdx]; + if (!pTuple->mTabPanel->getVisible()) { - tuple->mButton->onCommit(); + pTuple->mButton->onCommit(); mDragAndDropDelayTimer.stop(); } } +// [/SL:KB] +// 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(); +// mDragAndDropDelayTimer.stop(); +// } +// } } return LLView::handleDragAndDrop(x, y, mask, drop, type, cargo_data, accept, tooltip); diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index eaa2fd54e0..6bd2e19bfc 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -291,6 +291,9 @@ private: S32 mLabelPadLeft; LLFrameTimer mDragAndDropDelayTimer; +// [SL:KB] - Checked: UI-TabDndButtonCommit | Checked: 2011-06-16 (Catznip-2.6.0c) | Added: Catznip-2.6.0c + S32 mDragAndDropHoverIdx; +// [/SL:KB] LLFontGL::HAlign mFontHalign; const LLFontGL* mFont;