diff options
-rw-r--r-- | indra/newview/llfasttimerview.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llfasttimerview.h | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_fast_timers.xml | 13 |
3 files changed, 41 insertions, 6 deletions
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index f68e63cb96..98687282ed 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -43,6 +43,7 @@ #include "llsdserialize.h" #include "lltooltip.h" #include "llbutton.h" +#include "llscrollbar.h" #include "llappviewer.h" #include "llviewertexturelist.h" @@ -128,7 +129,8 @@ void LLFastTimerView::setPauseState(bool pause_state) BOOL LLFastTimerView::postBuild() { LLButton& pause_btn = getChildRef<LLButton>("pause_btn"); - + mScrollBar = getChild<LLScrollbar>("scroll_vert"); + pause_btn.setCommitCallback(boost::bind(&LLFastTimerView::onPause, this)); return TRUE; } @@ -183,7 +185,7 @@ BOOL LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask) BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) { - if (x < mBarRect.mLeft) + if (x < mScrollBar->getRect().mLeft) { BlockTimerStatHandle* idp = getLegendID(y); if (idp) @@ -284,7 +286,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) } } } - else if (x < mBarRect.mLeft) + else if (x < mScrollBar->getRect().mLeft) { BlockTimerStatHandle* timer_id = getLegendID(y); if (timer_id) @@ -335,7 +337,7 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask) else { // tooltips for timer legend - if (x < mBarRect.mLeft) + if (x < mScrollBar->getRect().mLeft) { BlockTimerStatHandle* idp = getLegendID(y); if (idp) @@ -1197,6 +1199,7 @@ void LLFastTimerView::drawLegend() { LLLocalClipRect clip(mLegendRect); S32 cur_line = 0; + S32 scroll_offset = 0; // element's y offset from top of the inner scroll's rect ft_display_idx.clear(); std::map<BlockTimerStatHandle*, S32> display_line; for (block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); @@ -1204,10 +1207,24 @@ void LLFastTimerView::drawLegend() ++it) { BlockTimerStatHandle* idp = (*it); + // Needed to figure out offsets and parenting display_line[idp] = cur_line; - ft_display_idx.push_back(idp); cur_line++; + if (scroll_offset < mScrollBar->getDocPos()) + { + // only offset for visible items + scroll_offset += TEXT_HEIGHT + 2; + if (idp->getTreeNode().mCollapsed) + { + it.skipDescendants(); + } + continue; + } + + // used for mouse clicks + ft_display_idx.push_back(idp); + // Actual draw, first bar (square), then text x = MARGIN; LLRect bar_rect(x, y, x + TEXT_HEIGHT, y - TEXT_HEIGHT); @@ -1281,11 +1298,14 @@ void LLFastTimerView::drawLegend() y -= (TEXT_HEIGHT + 2); + scroll_offset += TEXT_HEIGHT + 2; if (idp->getTreeNode().mCollapsed) { it.skipDescendants(); } } + // Recalculate scroll size + mScrollBar->setDocSize(scroll_offset - mLegendRect.getHeight()); } } diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index 3e30bd86ba..ff65f8da07 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -33,6 +33,8 @@ #include "lltracerecording.h" #include <deque> +class LLScrollbar; + class LLFastTimerView : public LLFloater { public: @@ -142,6 +144,8 @@ private: mLegendRect; LLFrameTimer mHighlightTimer; LLTrace::PeriodicRecording mRecording; + + LLScrollbar* mScrollBar; }; #endif diff --git a/indra/newview/skins/default/xui/en/floater_fast_timers.xml b/indra/newview/skins/default/xui/en/floater_fast_timers.xml index fa7147d9ca..645003cc14 100644 --- a/indra/newview/skins/default/xui/en/floater_fast_timers.xml +++ b/indra/newview/skins/default/xui/en/floater_fast_timers.xml @@ -60,10 +60,21 @@ min_width="100"> <panel top="0" left="0" - width="220" + width="204" height="440" name="legend" follows="all"/> + <scroll_bar + top ="0" + right="-1" + height="440" + width="15" + follows="top|right|bottom" + name="scroll_vert" + orientation="vertical" + step_size="16" + doc_size="3000" + /> </layout_panel> <layout_panel name="timers_panel" auto_resize="true" |