diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 42a14b7f6..eeb53a98d 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -103,6 +103,10 @@ LLFastTimerView::LLFastTimerView(const std::string& name, const LLRect& rect) FTV_NUM_TIMERS = LLFastTimer::NamedTimer::instanceCount(); mPrintStats = -1; mAverageCyclesPerTimer = 0; + // Making the ledgend part of fast timers scrollable + mOverLegend = false; + mScrollOffset = 0; + // LLUICtrlFactory::getInstance()->buildFloater(this, "floater_fast_timers.xml"); } @@ -258,6 +262,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) } mHoverTimer = NULL; mHoverID = NULL; + mOverLegend = false; // Making the ledgend part of fast timers scrollable if(LLFastTimer::sPauseHistory && mBarRect.pointInRect(x, y)) { @@ -311,6 +316,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) { mHoverID = timer_id; } + mOverLegend = true; // Making the ledgend part of fast timers scrollable } return LLFloater::handleHover(x, y, mask); @@ -358,10 +364,36 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* stic BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks) { - LLFastTimer::sPauseHistory = TRUE; - mScrollIndex = llclamp( mScrollIndex + clicks, - 0, - llmin(LLFastTimer::getLastFrameIndex(), (S32)LLFastTimer::NamedTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); + //LLFastTimer::sPauseHistory = TRUE; + //mScrollIndex = llclamp( mScrollIndex + clicks, + //0, + //llmin(LLFastTimer::getLastFrameIndex(), (S32)LLFastTimer::NamedTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); + // Making the ledgend part of fast timers scrollable + if(mOverLegend) + { + mScrollOffset += clicks; + S32 count = 0; + for (timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer()); + it != timer_tree_iterator_t(); + ++it) + { + count++; + LLFastTimer::NamedTimer* idp = (*it); + if (idp->getCollapsed()) + { + it.skipDescendants(); + } + } + mScrollOffset = llclamp(mScrollOffset,0,count-5); + } + else + { + LLFastTimer::sPauseHistory = TRUE; + mScrollIndex = llclamp( mScrollIndex + clicks, + 0, + llmin(LLFastTimer::getLastFrameIndex(), (S32)LLFastTimer::NamedTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); + } + // return TRUE; } @@ -479,11 +511,23 @@ void LLFastTimerView::draw() S32 cur_line = 0; ft_display_idx.clear(); std::map display_line; + S32 mScrollOffset_tmp = mScrollOffset; // Making the ledgend part of fast timers scrollable for (timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer()); it != timer_tree_iterator_t(); ++it) { LLFastTimer::NamedTimer* idp = (*it); + // Making the ledgend part of fast timers scrollable + if(mScrollOffset_tmp) + { + --mScrollOffset_tmp; + if (idp->getCollapsed()) + { + it.skipDescendants(); + } + continue; + } + // display_line[idp] = cur_line; ft_display_idx.push_back(idp); cur_line++; diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index 04fa500e1..47972b272 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -99,6 +99,11 @@ private: S32 mPrintStats; S32 mAverageCyclesPerTimer; LLRect mGraphRect; + + // Making the ledgend part of fast timers scrollable + bool mOverLegend; + S32 mScrollOffset; + // }; #endif