From 3e84087d50d735e399b9c48e5b25e12294f676c6 Mon Sep 17 00:00:00 2001 From: Siana Gearz Date: Wed, 13 Jul 2011 04:39:42 +0200 Subject: [PATCH] Modified fasttimer view, by Henri --- indra/llui/llfloater.h | 2 + indra/newview/lldebugview.cpp | 5 ++- indra/newview/llfasttimerview.cpp | 68 +++++++++++++++++++++++++------ indra/newview/llfasttimerview.h | 1 + 4 files changed, 61 insertions(+), 15 deletions(-) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 096fb3e61..08373830c 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -297,7 +297,9 @@ private: bool mDragOnLeft; BOOL mButtonsEnabled[BUTTON_COUNT]; +protected: LLButton* mButtons[BUTTON_COUNT]; +private: F32 mButtonScale; BOOL mAutoFocus; LLHandle mSnappedTo; diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index 8b2aac6e9..e6fed3c30 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -75,8 +75,9 @@ LLDebugView::LLDebugView(const std::string& name, const LLRect &rect) mFrameStatView->setVisible(FALSE); // start invisible addChild(mFrameStatView); - r.set(25, rect.getHeight() - 50, (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f), - (S32) (gViewerWindow->getVirtualWindowRect().getHeight() * 0.75f)); + r.setLeftTopAndSize(25, rect.getHeight() - 50, + (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f), + (S32) (gViewerWindow->getVirtualWindowRect().getHeight() * 0.75f)); mFastTimerView = new LLFastTimerView("fast timers", r); mFastTimerView->setFollowsTop(); mFastTimerView->setFollowsLeft(); diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index ab0868237..431510fb9 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -233,7 +233,7 @@ static const int FTV_DISPLAY_NUM = LL_ARRAY_SIZE(ft_display_table); S32 ft_display_idx[FTV_DISPLAY_NUM]; // line of table entry for display purposes (for collapse) LLFastTimerView::LLFastTimerView(const std::string& name, const LLRect& rect) - : LLFloater(name, rect, std::string("Fast Timers")) + : LLFloater(name, rect, std::string(), FALSE, 1, 1, FALSE, FALSE, TRUE) { setVisible(FALSE); mDisplayMode = 0; @@ -320,6 +320,15 @@ S32 LLFastTimerView::getLegendIndex(S32 y) BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) { + { + S32 local_x = x - mButtons[BUTTON_CLOSE]->getRect().mLeft; + S32 local_y = y - mButtons[BUTTON_CLOSE]->getRect().mBottom; + if (mButtons[BUTTON_CLOSE]->getVisible() && + mButtons[BUTTON_CLOSE]->pointInView(local_x, local_y)) + { + return LLFloater::handleMouseDown(x, y, mask); + } + } if (x < mBarRect.mLeft) { S32 legend_index = getLegendIndex(y); @@ -381,6 +390,15 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask) { + { + S32 local_x = x - mButtons[BUTTON_CLOSE]->getRect().mLeft; + S32 local_y = y - mButtons[BUTTON_CLOSE]->getRect().mBottom; + if (mButtons[BUTTON_CLOSE]->getVisible() && + mButtons[BUTTON_CLOSE]->pointInView(local_x, local_y)) + { + return LLFloater::handleMouseUp(x, y, mask); + } + } return FALSE; } @@ -429,6 +447,18 @@ BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks) return TRUE; } +void LLFastTimerView::onClose(bool app_quitting) +{ + if (app_quitting) + { + LLFloater::close(app_quitting); + } + else + { + setVisible(FALSE); + } +} + void LLFastTimerView::draw() { LLFastTimer t(LLFastTimer::FTM_RENDER_TIMER); @@ -442,8 +472,9 @@ void LLFastTimerView::draw() S32 height = (S32) (gViewerWindow->getVirtualWindowRect().getHeight()*0.75f); S32 width = (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f); - // HACK: casting away const. Should use setRect or some helper function instead. - const_cast(getRect()).setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); + LLRect new_rect; + new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); + setRect(new_rect); S32 left, top, right, bottom; S32 x, y, barw, barh, dx, dy; @@ -591,11 +622,14 @@ void LLFastTimerView::draw() left = x; right = x + texth; top = y; bottom = y - texth; S32 scale_offset = 0; - if (i == mHoverIndex) + if (y > 3 * texth) { - scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 2.f); + if (i == mHoverIndex) + { + scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 2.f); + } + gl_rect_2d(left - scale_offset, top + scale_offset, right + scale_offset, bottom - scale_offset, *ft_display_table[i].color); } - gl_rect_2d(left - scale_offset, top + scale_offset, right + scale_offset, bottom - scale_offset, *ft_display_table[i].color); int tidx = ft_display_table[i].timer; F32 ms = 0; @@ -625,7 +659,7 @@ void LLFastTimerView::draw() dx = (texth+4) + level*8; LLColor4 color = disabled > 1 ? LLColor4::grey : LLColor4::white; - if (level > 0) + if (level > 0 && y > 3 * texth) { S32 line_start_y = (top + bottom) / 2; S32 line_end_y = line_start_y + ((texth + 2) * (display_line[i] - display_line[parent])) - (texth / 2); @@ -647,13 +681,16 @@ void LLFastTimerView::draw() next_parent = ft_display_table[next_parent].parent; } - if (is_child_of_hover_item) + if (y > 3 * texth) { - LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::BOLD); - } - else - { - LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, color, LLFontGL::LEFT, LLFontGL::TOP); + if (is_child_of_hover_item) + { + LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::BOLD); + } + else + { + LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, color, LLFontGL::LEFT, LLFontGL::TOP); + } } y -= (texth + 2); @@ -661,6 +698,11 @@ void LLFastTimerView::draw() if (textw > legendwidth) legendwidth = textw; } + if (y <= 3 * texth) + { + LLFontGL::getFontMonospace()->renderUTF8("", 0, 3 * texth, 2 * texth, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::BOLD); + } + for (S32 i=cur_line; i