summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp4
-rw-r--r--indra/llui/llcontainerview.cpp8
-rw-r--r--indra/llui/llcontainerview.h4
-rw-r--r--indra/llui/lllayoutstack.cpp14
-rw-r--r--indra/llui/lllayoutstack.h19
-rw-r--r--indra/llui/llmenugl.cpp2
-rw-r--r--indra/llui/llmultifloater.h3
-rw-r--r--indra/llui/llscrollbar.cpp4
-rw-r--r--indra/llui/llscrollbar.h6
-rw-r--r--indra/llui/llscrollcontainer.cpp4
-rw-r--r--indra/llui/llscrollcontainer.h3
-rw-r--r--indra/llui/llslider.h4
-rw-r--r--indra/llui/llstatbar.cpp263
-rw-r--r--indra/llui/llstatbar.h53
-rw-r--r--indra/llui/llstatgraph.cpp17
-rw-r--r--indra/llui/llstatgraph.h4
-rw-r--r--indra/llui/lltabcontainer.cpp2
-rw-r--r--indra/llui/lltoolbar.cpp10
-rw-r--r--indra/llui/lltoolbar.h2
-rw-r--r--indra/llui/llview.cpp10
-rw-r--r--indra/llui/llview.h13
21 files changed, 283 insertions, 166 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 705fe16559..93ffa7b70d 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -758,11 +758,11 @@ void LLButton::draw()
mCurGlowStrength = lerp(mCurGlowStrength,
mFlashing ? (flash? 1.0 : 0.0)
: mHoverGlowStrength,
- LLCriticalDamp::getInterpolant(0.05f));
+ LLSmoothInterpolation::getInterpolant(0.05f));
}
else
{
- mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f));
+ mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f));
}
// Draw button image, if available.
diff --git a/indra/llui/llcontainerview.cpp b/indra/llui/llcontainerview.cpp
index e08ccb0b78..06f8e72c9c 100644
--- a/indra/llui/llcontainerview.cpp
+++ b/indra/llui/llcontainerview.cpp
@@ -49,7 +49,6 @@ LLContainerView::LLContainerView(const LLContainerView::Params& p)
mLabel(p.label),
mDisplayChildren(p.display_children)
{
- mCollapsible = TRUE;
mScrollContainer = NULL;
}
@@ -75,6 +74,11 @@ bool LLContainerView::addChild(LLView* child, S32 tab_group)
return res;
}
+BOOL LLContainerView::handleDoubleClick(S32 x, S32 y, MASK mask)
+{
+ return handleMouseDown(x, y, mask);
+}
+
BOOL LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = FALSE;
@@ -84,7 +88,7 @@ BOOL LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask)
}
if (!handled)
{
- if( mCollapsible && mShowLabel && (y >= getRect().getHeight() - 10) )
+ if( mShowLabel && (y >= getRect().getHeight() - 10) )
{
setDisplayChildren(!mDisplayChildren);
reshape(getRect().getWidth(), getRect().getHeight(), FALSE);
diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h
index e81600fd6c..ac92b19977 100644
--- a/indra/llui/llcontainerview.h
+++ b/indra/llui/llcontainerview.h
@@ -66,6 +66,7 @@ public:
/*virtual*/ BOOL postBuild();
/*virtual*/ bool addChild(LLView* view, S32 tab_group = 0);
+ /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
@@ -87,8 +88,5 @@ public:
protected:
BOOL mDisplayChildren;
std::string mLabel;
-public:
- BOOL mCollapsible;
-
};
#endif // LL_CONTAINERVIEW_
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 4c730286da..d4a310b8cf 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -42,12 +42,6 @@ static const F32 MAX_FRACTIONAL_SIZE = 1.f;
static LLDefaultChildRegistry::Register<LLLayoutStack> register_layout_stack("layout_stack");
static LLLayoutStack::LayoutStackRegistry::Register<LLLayoutPanel> register_layout_panel("layout_panel");
-void LLLayoutStack::OrientationNames::declareValues()
-{
- declare("horizontal", HORIZONTAL);
- declare("vertical", VERTICAL);
-}
-
//
// LLLayoutPanel
//
@@ -141,7 +135,7 @@ S32 LLLayoutPanel::getVisibleDim() const
+ (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt))));
}
-void LLLayoutPanel::setOrientation( LLLayoutStack::ELayoutOrientation orientation )
+void LLLayoutPanel::setOrientation( LLView::EOrientation orientation )
{
mOrientation = orientation;
S32 layout_dim = llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL)
@@ -592,7 +586,7 @@ bool LLLayoutStack::animatePanels()
{
if (!mAnimatedThisFrame)
{
- panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(mOpenTimeConstant));
+ panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLSmoothInterpolation::getInterpolant(mOpenTimeConstant));
if (panelp->mVisibleAmt > 0.99f)
{
panelp->mVisibleAmt = 1.f;
@@ -617,7 +611,7 @@ bool LLLayoutStack::animatePanels()
{
if (!mAnimatedThisFrame)
{
- panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
+ panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant));
if (panelp->mVisibleAmt < 0.001f)
{
panelp->mVisibleAmt = 0.f;
@@ -644,7 +638,7 @@ bool LLLayoutStack::animatePanels()
{
if (!mAnimatedThisFrame)
{
- panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
+ panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant));
}
if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f)
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index 648cd5fdce..f1668d7473 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -37,24 +37,13 @@ class LLLayoutPanel;
class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
{
public:
- typedef enum e_layout_orientation
- {
- HORIZONTAL,
- VERTICAL
- } ELayoutOrientation;
-
- struct OrientationNames
- : public LLInitParam::TypeValuesHelper<ELayoutOrientation, OrientationNames>
- {
- static void declareValues();
- };
struct LayoutStackRegistry : public LLChildRegistry<LayoutStackRegistry>
{};
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
- Mandatory<ELayoutOrientation, OrientationNames> orientation;
+ Mandatory<EOrientation> orientation;
Optional<S32> border_size;
Optional<bool> animate,
clip;
@@ -104,7 +93,7 @@ private:
bool animatePanels();
void createResizeBar(LLLayoutPanel* panel);
- const ELayoutOrientation mOrientation;
+ const EOrientation mOrientation;
typedef std::vector<LLLayoutPanel*> e_panel_list_t;
e_panel_list_t mPanels;
@@ -179,7 +168,7 @@ public:
F32 getVisibleAmount() const;
S32 getVisibleDim() const;
- void setOrientation(LLLayoutStack::ELayoutOrientation orientation);
+ void setOrientation(LLView::EOrientation orientation);
void storeOriginalDim();
void setIgnoreReshape(bool ignore) { mIgnoreReshape = ignore; }
@@ -198,7 +187,7 @@ protected:
F32 mFractionalSize;
S32 mTargetDim;
bool mIgnoreReshape;
- LLLayoutStack::ELayoutOrientation mOrientation;
+ LLView::EOrientation mOrientation;
class LLResizeBar* mResizeBar;
};
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index cd6cc6a75e..13888920f9 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -3673,7 +3673,7 @@ void LLTearOffMenu::draw()
if (getRect().getHeight() != mTargetHeight)
{
// animate towards target height
- reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(0.05f))));
+ reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLSmoothInterpolation::getInterpolant(0.05f))));
}
LLFloater::draw();
}
diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h
index 9fa917eca1..6c97f80e31 100644
--- a/indra/llui/llmultifloater.h
+++ b/indra/llui/llmultifloater.h
@@ -96,6 +96,3 @@ protected:
};
#endif // LL_MULTI_FLOATER_H
-
-
-
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp
index 5d3bf7a670..92a80c73fe 100644
--- a/indra/llui/llscrollbar.cpp
+++ b/indra/llui/llscrollbar.cpp
@@ -493,11 +493,11 @@ void LLScrollbar::draw()
BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
if (hovered)
{
- mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f));
+ mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLSmoothInterpolation::getInterpolant(0.05f));
}
else
{
- mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f));
+ mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f));
}
// Draw background and thumb.
diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h
index ff74f753b9..3f3ca1378b 100644
--- a/indra/llui/llscrollbar.h
+++ b/indra/llui/llscrollbar.h
@@ -40,13 +40,11 @@ class LLScrollbar
{
public:
- enum ORIENTATION { HORIZONTAL, VERTICAL };
-
typedef boost::function<void (S32, LLScrollbar*)> callback_t;
struct Params
: public LLInitParam::Block<Params, LLUICtrl::Params>
{
- Mandatory<ORIENTATION> orientation;
+ Mandatory<EOrientation> orientation;
Mandatory<S32> doc_size;
Mandatory<S32> doc_pos;
Mandatory<S32> page_size;
@@ -131,7 +129,7 @@ private:
callback_t mChangeCallback;
- const ORIENTATION mOrientation;
+ const EOrientation mOrientation;
S32 mDocSize; // Size of the document that the scrollbar is modeling. Units depend on the user. 0 <= mDocSize.
S32 mDocPos; // Position within the doc that the scrollbar is modeling, in "lines" (user size)
S32 mPageSize; // Maximum number of lines that can be seen at one time.
diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index 2fd187a526..2abfb15494 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -140,7 +140,7 @@ LLScrollContainer::~LLScrollContainer( void )
{
// mScrolledView and mScrollbar are child views, so the LLView
// destructor takes care of memory deallocation.
- for( S32 i = 0; i < SCROLLBAR_COUNT; i++ )
+ for( S32 i = 0; i < ORIENTATION_COUNT; i++ )
{
mScrollbar[i] = NULL;
}
@@ -211,7 +211,7 @@ BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask)
{
return TRUE;
}
- for( S32 i = 0; i < SCROLLBAR_COUNT; i++ )
+ for( S32 i = 0; i < ORIENTATION_COUNT; i++ )
{
if( mScrollbar[i]->handleKeyHere(key, mask) )
{
diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h
index d87c95b3d7..f9ce4a74ef 100644
--- a/indra/llui/llscrollcontainer.h
+++ b/indra/llui/llscrollcontainer.h
@@ -56,7 +56,6 @@ class LLScrollContainer : public LLUICtrl
public:
// Note: vertical comes before horizontal because vertical
// scrollbars have priority for mouse and keyboard events.
- enum SCROLL_ORIENTATION { VERTICAL, HORIZONTAL, SCROLLBAR_COUNT };
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
@@ -126,7 +125,7 @@ private:
void updateScroll();
void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const;
- LLScrollbar* mScrollbar[SCROLLBAR_COUNT];
+ LLScrollbar* mScrollbar[ORIENTATION_COUNT];
S32 mSize;
BOOL mIsOpaque;
LLUIColor mBackgroundColor;
diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h
index 700c17ea3e..3b492d8182 100644
--- a/indra/llui/llslider.h
+++ b/indra/llui/llslider.h
@@ -34,8 +34,6 @@
class LLSlider : public LLF32UICtrl
{
public:
- enum ORIENTATION { HORIZONTAL, VERTICAL };
-
struct Params : public LLInitParam::Block<Params, LLF32UICtrl::Params>
{
Optional<std::string> orientation;
@@ -98,7 +96,7 @@ private:
LLPointer<LLUIImage> mTrackHighlightHorizontalImage;
LLPointer<LLUIImage> mTrackHighlightVerticalImage;
- const ORIENTATION mOrientation;
+ const EOrientation mOrientation;
LLRect mThumbRect;
LLUIColor mTrackColor;
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index 954f615210..cda40aac72 100644
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -36,6 +36,7 @@
#include "lluictrlfactory.h"
#include "lltracerecording.h"
+#include "llcriticaldamp.h"
///////////////////////////////////////////////////////////////////////////////////
@@ -45,6 +46,7 @@ LLStatBar::LLStatBar(const Params& p)
mUnitLabel(p.unit_label),
mMinBar(p.bar_min),
mMaxBar(p.bar_max),
+ mCurMaxBar(p.bar_max),
mCountFloatp(LLTrace::CountStatHandle<>::getInstance(p.stat)),
mCountIntp(LLTrace::CountStatHandle<S64>::getInstance(p.stat)),
mMeasurementFloatp(LLTrace::MeasurementStatHandle<>::getInstance(p.stat)),
@@ -54,10 +56,14 @@ LLStatBar::LLStatBar(const Params& p)
mPrecision(p.precision),
mUpdatesPerSec(p.update_rate),
mUnitScale(p.unit_scale),
+ mNumFrames(p.num_frames),
+ mMaxHeight(p.max_height),
mPerSec(p.show_per_sec),
mDisplayBar(p.show_bar),
mDisplayHistory(p.show_history),
- mDisplayMean(p.show_mean)
+ mDisplayMean(p.show_mean),
+ mOrientation(p.orientation),
+ mScaleRange(p.scale_range)
{}
BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -82,7 +88,7 @@ BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask)
LLView* parent = getParent();
parent->reshape(parent->getRect().getWidth(), parent->getRect().getHeight(), FALSE);
- return FALSE;
+ return TRUE;
}
void LLStatBar::draw()
@@ -92,6 +98,7 @@ void LLStatBar::draw()
max = 0.f,
mean = 0.f;
+ S32 num_samples = 0;
LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording();
if (mCountFloatp)
@@ -104,6 +111,7 @@ void LLStatBar::draw()
min = frame_recording.getPeriodMinPerSec(*mCountFloatp);
max = frame_recording.getPeriodMaxPerSec(*mCountFloatp);
mean = frame_recording.getPeriodMeanPerSec(*mCountFloatp);
+ num_samples = frame_recording.getTotalRecording().getSampleCount(*mCountFloatp);
}
else
{
@@ -111,6 +119,7 @@ void LLStatBar::draw()
min = frame_recording.getPeriodMin(*mCountFloatp);
max = frame_recording.getPeriodMax(*mCountFloatp);
mean = frame_recording.getPeriodMean(*mCountFloatp);
+ num_samples = frame_recording.getTotalRecording().getSampleCount(*mCountFloatp);
}
}
else if (mCountIntp)
@@ -123,6 +132,7 @@ void LLStatBar::draw()
min = frame_recording.getPeriodMinPerSec(*mCountIntp);
max = frame_recording.getPeriodMaxPerSec(*mCountIntp);
mean = frame_recording.getPeriodMeanPerSec(*mCountIntp);
+ num_samples = frame_recording.getTotalRecording().getSampleCount(*mCountIntp);
}
else
{
@@ -130,6 +140,7 @@ void LLStatBar::draw()
min = frame_recording.getPeriodMin(*mCountIntp);
max = frame_recording.getPeriodMax(*mCountIntp);
mean = frame_recording.getPeriodMean(*mCountIntp);
+ num_samples = frame_recording.getTotalRecording().getSampleCount(*mCountIntp);
}
}
else if (mMeasurementFloatp)
@@ -139,6 +150,7 @@ void LLStatBar::draw()
min = recording.getMin(*mMeasurementFloatp);
max = recording.getMax(*mMeasurementFloatp);
mean = recording.getMean(*mMeasurementFloatp);
+ num_samples = frame_recording.getTotalRecording().getSampleCount(*mMeasurementFloatp);
}
else if (mMeasurementIntp)
{
@@ -147,6 +159,7 @@ void LLStatBar::draw()
min = recording.getMin(*mMeasurementIntp);
max = recording.getMax(*mMeasurementIntp);
mean = recording.getMean(*mMeasurementIntp);
+ num_samples = frame_recording.getTotalRecording().getSampleCount(*mMeasurementIntp);
}
current *= mUnitScale;
@@ -167,15 +180,41 @@ void LLStatBar::draw()
mUpdateTimer.reset();
}
- S32 width = getRect().getWidth() - 40;
- S32 max_width = width;
- S32 bar_top = getRect().getHeight() - 15; // 16 pixels from top.
- S32 bar_height = bar_top - 20;
- S32 tick_height = 4;
- S32 tick_width = 1;
- S32 left, top, right, bottom;
+ S32 bar_top, bar_left, bar_right, bar_bottom;
+ if (mOrientation == HORIZONTAL)
+ {
+ bar_top = llmax(5, getRect().getHeight() - 15);
+ bar_left = 0;
+ bar_right = getRect().getWidth() - 40;
+ bar_bottom = llmin(bar_top - 5, 0);
+ }
+ else // VERTICAL
+ {
+ bar_top = llmax(5, getRect().getHeight() - 15);
+ bar_left = 0;
+ bar_right = getRect().getWidth();
+ bar_bottom = llmin(bar_top - 5, 20);
+ }
+ const S32 tick_length = 4;
+ const S32 tick_width = 1;
+
+ if (mScaleRange && num_samples)
+ {
+ F32 cur_max = mLabelSpacing;
+ while(max > cur_max)
+ {
+ cur_max += mLabelSpacing;
+ }
+ mCurMaxBar = LLSmoothInterpolation::lerp(mCurMaxBar, cur_max, 0.05f);
+ }
+ else
+ {
+ mCurMaxBar = mMaxBar;
+ }
- F32 value_scale = max_width/(mMaxBar - mMinBar);
+ F32 value_scale = (mOrientation == HORIZONTAL)
+ ? (bar_top - bar_bottom)/(mCurMaxBar - mMinBar)
+ : (bar_right - bar_left)/(mCurMaxBar - mMinBar);
LLFontGL::getFontMonospace()->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f),
LLFontGL::LEFT, LLFontGL::TOP);
@@ -194,9 +233,18 @@ void LLStatBar::draw()
}
// Draw the value.
- LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, width, getRect().getHeight(),
- LLColor4(1.f, 1.f, 1.f, 0.5f),
- LLFontGL::RIGHT, LLFontGL::TOP);
+ if (mOrientation == HORIZONTAL)
+ {
+ LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, bar_right, getRect().getHeight(),
+ LLColor4(1.f, 1.f, 1.f, 0.5f),
+ LLFontGL::RIGHT, LLFontGL::TOP);
+ }
+ else
+ {
+ LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, bar_right, getRect().getHeight(),
+ LLColor4(1.f, 1.f, 1.f, 0.5f),
+ LLFontGL::RIGHT, LLFontGL::TOP);
+ }
value_format = llformat( "%%.%df", mPrecision);
if (mDisplayBar && (mCountFloatp || mCountIntp || mMeasurementFloatp || mMeasurementIntp))
@@ -204,131 +252,197 @@ void LLStatBar::draw()
std::string tick_label;
// Draw the tick marks.
- F32 tick_value;
- top = bar_top;
- bottom = bar_top - bar_height - tick_height/2;
-
LLGLSUIDefault gls_ui;
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- for (tick_value = mMinBar; tick_value <= mMaxBar; tick_value += mTickSpacing)
+ for (F32 tick_value = mMinBar + mLabelSpacing; tick_value <= mCurMaxBar; tick_value += mTickSpacing)
{
- left = llfloor((tick_value - mMinBar)*value_scale);
- right = left + tick_width;
- gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 1.f, 1.f, 0.1f));
+ const S32 begin = llfloor((tick_value - mMinBar)*value_scale);
+ const S32 end = begin + tick_width;
+ if (mOrientation == HORIZONTAL)
+ {
+ gl_rect_2d(bar_left, end, bar_right - tick_length/2, begin, LLColor4(1.f, 1.f, 1.f, 0.1f));
+ }
+ else
+ {
+ gl_rect_2d(begin, bar_top, end, bar_bottom - tick_length/2, LLColor4(1.f, 1.f, 1.f, 0.1f));
+ }
}
// Draw the tick labels (and big ticks).
- bottom = bar_top - bar_height - tick_height;
- for (tick_value = mMinBar; tick_value <= mMaxBar; tick_value += mLabelSpacing)
+ for (F32 tick_value = mMinBar + mLabelSpacing; tick_value <= mCurMaxBar; tick_value += mLabelSpacing)
{
- left = llfloor((tick_value - mMinBar)*value_scale);
- right = left + tick_width;
- gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 1.f, 1.f, 0.25f));
-
+ const S32 begin = llfloor((tick_value - mMinBar)*value_scale);
+ const S32 end = begin + tick_width;
tick_label = llformat( value_format.c_str(), tick_value);
+
// draw labels for the tick marks
- LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, left - 1, bar_top - bar_height - tick_height,
- LLColor4(1.f, 1.f, 1.f, 0.5f),
- LLFontGL::LEFT, LLFontGL::TOP);
+ if (mOrientation == HORIZONTAL)
+ {
+ gl_rect_2d(bar_left, end, bar_right - tick_length, begin, LLColor4(1.f, 1.f, 1.f, 0.25f));
+ LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, bar_right, begin,
+ LLColor4(1.f, 1.f, 1.f, 0.5f),
+ LLFontGL::LEFT, LLFontGL::VCENTER);
+ }
+ else
+ {
+ gl_rect_2d(begin, bar_top, end, bar_bottom - tick_length, LLColor4(1.f, 1.f, 1.f, 0.25f));
+ LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, begin - 1, bar_bottom - tick_length,
+ LLColor4(1.f, 1.f, 1.f, 0.5f),
+ LLFontGL::RIGHT, LLFontGL::TOP);
+ }
}
- // Now, draw the bars
- top = bar_top;
- bottom = bar_top - bar_height;
-
// draw background bar.
- left = 0;
- right = width;
- gl_rect_2d(left, top, right, bottom, LLColor4(0.f, 0.f, 0.f, 0.25f));
+ gl_rect_2d(bar_left, bar_top, bar_right, bar_bottom, LLColor4(0.f, 0.f, 0.f, 0.25f));
if (frame_recording.getNumPeriods() == 0)
{
// No data, don't draw anything...
return;
}
+
// draw min and max
- left = (S32) ((min - mMinBar) * value_scale);
+ S32 begin = (S32) ((min - mMinBar) * value_scale);
- if (left < 0)
+ if (begin < 0)
{
- left = 0;
+ begin = 0;
llwarns << "Min:" << min << llendl;
}
- right = (S32) ((max - mMinBar) * value_scale);
- gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 0.f, 0.f, 0.25f));
+ S32 end = (S32) ((max - mMinBar) * value_scale);
+ if (mOrientation == HORIZONTAL)
+ {
+ gl_rect_2d(bar_left, end, bar_right, begin, LLColor4(1.f, 0.f, 0.f, 0.25f));
+ }
+ else // VERTICAL
+ {
+ gl_rect_2d(begin, bar_top, end, bar_bottom, LLColor4(1.f, 0.f, 0.f, 0.25f));
+ }
+
+ F32 span = (mOrientation == HORIZONTAL)
+ ? (bar_right - bar_left)
+ : (bar_top - bar_bottom);
if (mDisplayHistory && (mCountFloatp || mCountIntp || mMeasurementFloatp || mMeasurementIntp))
{
- S32 num_values = frame_recording.getNumPeriods() - 1;
+ const S32 num_values = frame_recording.getNumPeriods() - 1;
+ F32 begin = 0;
+ F32 end = 0;
S32 i;
- for (i = 1; i <= num_values; i++)
+ gGL.color4f( 1.f, 0.f, 0.f, 1.f );
+ gGL.begin( LLRender::QUADS );
+ const S32 max_frame = llmin(mNumFrames, num_values);
+ U32 num_samples = 0;
+ for (i = 1; i <= max_frame; i++)
{
+ F32 offset = ((F32)i / (F32)mNumFrames) * span;
+ LLTrace::Recording& recording = frame_recording.getPrevRecordingPeriod(i);
if (mPerSec)
{
if (mCountFloatp)
{
- left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountFloatp) - mMinBar) * value_scale);
- right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountFloatp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getPerSec(*mCountFloatp) - mMinBar) * value_scale);
+ end = ((recording.getPerSec(*mCountFloatp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mCountFloatp);
}
else if (mCountIntp)
{
- left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountIntp) - mMinBar) * value_scale);
- right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountIntp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getPerSec(*mCountIntp) - mMinBar) * value_scale);
+ end = ((recording.getPerSec(*mCountIntp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mCountIntp);
}
else if (mMeasurementFloatp)
{
- left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementFloatp) - mMinBar) * value_scale);
- right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementFloatp) - mMinBar) * value_scale) + 1;
+ //rate isn't defined for measurement stats, so use mean
+ begin = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale);
+ end = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mMeasurementFloatp);
}
else if (mMeasurementIntp)
{
- left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementIntp) - mMinBar) * value_scale);
- right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementIntp) - mMinBar) * value_scale) + 1;
+ //rate isn't defined for measurement stats, so use mean
+ begin = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale);
+ end = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mMeasurementIntp);
}
- gl_rect_2d(left, bottom+i+1, right, bottom+i, LLColor4(1.f, 0.f, 0.f, 1.f));
}
else
{
if (mCountFloatp)
{
- left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountFloatp) - mMinBar) * value_scale);
- right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountFloatp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getSum(*mCountFloatp) - mMinBar) * value_scale);
+ end = ((recording.getSum(*mCountFloatp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mCountFloatp);
}
else if (mCountIntp)
{
- left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountIntp) - mMinBar) * value_scale);
- right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountIntp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getSum(*mCountIntp) - mMinBar) * value_scale);
+ end = ((recording.getSum(*mCountIntp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mCountIntp);
}
else if (mMeasurementFloatp)
{
- left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementFloatp) - mMinBar) * value_scale);
- right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementFloatp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale);
+ end = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mMeasurementFloatp);
}
else if (mMeasurementIntp)
{
- left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementIntp) - mMinBar) * value_scale);
- right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementIntp) - mMinBar) * value_scale) + 1;
+ begin = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale);
+ end = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mMeasurementIntp);
}
- gl_rect_2d(left, bottom+i+1, right, bottom+i, LLColor4(1.f, 0.f, 0.f, 1.f));
+ }
+
+ if (!num_samples) continue;
+
+ if (mOrientation == HORIZONTAL)
+ {
+ gGL.vertex2f((F32)bar_right - offset, end);
+ gGL.vertex2f((F32)bar_right - offset, begin);
+ gGL.vertex2f((F32)bar_right - offset - 1.f, begin);
+ gGL.vertex2f((F32)bar_right - offset - 1.f, end);
+ }
+ else
+ {
+ gGL.vertex2i(begin, (F32)bar_bottom+offset+1.f);
+ gGL.vertex2i(begin, (F32)bar_bottom+offset);
+ gGL.vertex2i(end, (F32)bar_bottom+offset);
+ gGL.vertex2i(end, (F32)bar_bottom+offset+1.f);
}
}
+ gGL.end();
}
else
{
+ S32 begin = (S32) ((current - mMinBar) * value_scale) - 1;
+ S32 end = (S32) ((current - mMinBar) * value_scale) + 1;
// draw current
- left = (S32) ((current - mMinBar) * value_scale) - 1;
- right = (S32) ((current - mMinBar) * value_scale) + 1;
- gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 0.f, 0.f, 1.f));
+ if (mOrientation == HORIZONTAL)
+ {
+ gl_rect_2d(bar_left, end, bar_right, begin, LLColor4(1.f, 0.f, 0.f, 1.f));
+ }
+ else
+ {
+ gl_rect_2d(begin, bar_top, end, bar_bottom, LLColor4(1.f, 0.f, 0.f, 1.f));
+ }
}
// draw mean bar
- top = bar_top + 2;
- bottom = bar_top - bar_height - 2;
- left = (S32) ((mean - mMinBar) * value_scale) - 1;
- right = (S32) ((mean - mMinBar) * value_scale) + 1;
- gl_rect_2d(left, top, right, bottom, LLColor4(0.f, 1.f, 0.f, 1.f));
+ {
+ const S32 begin = (S32) ((mean - mMinBar) * value_scale) - 1;
+ const S32 end = (S32) ((mean - mMinBar) * value_scale) + 1;
+ if (mOrientation == HORIZONTAL)
+ {
+ gl_rect_2d(bar_left - 2, begin, bar_right + 2, end, LLColor4(0.f, 1.f, 0.f, 1.f));
+ }
+ else
+ {
+ gl_rect_2d(begin, bar_top + 2, end, bar_bottom - 2, LLColor4(0.f, 1.f, 0.f, 1.f));
+ }
+ }
}
LLView::draw();
@@ -359,7 +473,14 @@ LLRect LLStatBar::getRequiredRect()
{
if (mDisplayHistory)
{
- rect.mTop = 35 + LLTrace::get_frame_recording().getNumPeriods();
+ if (mOrientation == HORIZONTAL)
+ {
+ rect.mTop = mMaxHeight;
+ }
+ else
+ {
+ rect.mTop = 35 + llmin(mMaxHeight, llmin(mNumFrames, (S32)LLTrace::get_frame_recording().getNumPeriods()));
+ }
}
else
{
diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h
index c366fd65db..74a3ebde2f 100644
--- a/indra/llui/llstatbar.h
+++ b/indra/llui/llstatbar.h
@@ -52,9 +52,13 @@ public:
Optional<bool> show_per_sec,
show_bar,
show_history,
- show_mean;
+ show_mean,
+ scale_range;
+ Optional<S32> num_frames,
+ max_height;
Optional<std::string> stat;
+ Optional<EOrientation> orientation;
Params()
: label("label"),
@@ -67,10 +71,14 @@ public:
update_rate("update_rate", 5.0f),
unit_scale("unit_scale", 1.f),
show_per_sec("show_per_sec", true),
- show_bar("show_bar", TRUE),
+ show_bar("show_bar", true),
show_history("show_history", false),
show_mean("show_mean", true),
- stat("stat")
+ scale_range("scale_range", true),
+ num_frames("num_frames", 300),
+ max_height("max_height", 200),
+ stat("stat"),
+ orientation("orientation", VERTICAL)
{
changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT);
}
@@ -88,27 +96,32 @@ public:
/*virtual*/ LLRect getRequiredRect(); // Return the height of this object, given the set options.
private:
- F32 mMinBar;
- F32 mMaxBar;
- F32 mTickSpacing;
- F32 mLabelSpacing;
- U32 mPrecision;
- F32 mUpdatesPerSec;
- F32 mUnitScale;
- BOOL mPerSec; // Use the per sec stats.
- BOOL mDisplayBar; // Display the bar graph.
- BOOL mDisplayHistory;
- BOOL mDisplayMean; // If true, display mean, if false, display current value
-
- LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* mCountFloatp;
- LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* mCountIntp;
+ F32 mMinBar;
+ F32 mMaxBar;
+ F32 mCurMaxBar;
+ F32 mTickSpacing;
+ F32 mLabelSpacing;
+ U32 mPrecision;
+ F32 mUpdatesPerSec;
+ F32 mUnitScale;
+ S32 mNumFrames;
+ S32 mMaxHeight;
+ bool mPerSec; // Use the per sec stats.
+ bool mDisplayBar; // Display the bar graph.
+ bool mDisplayHistory;
+ bool mDisplayMean; // If true, display mean, if false, display current value
+ bool mScaleRange;
+ EOrientation mOrientation;
+
+ LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* mCountFloatp;
+ LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* mCountIntp;
LLTrace::TraceType<LLTrace::MeasurementAccumulator<F64> >* mMeasurementFloatp;
LLTrace::TraceType<LLTrace::MeasurementAccumulator<S64> >* mMeasurementIntp;
LLFrameTimer mUpdateTimer;
- LLUIString mLabel;
- std::string mUnitLabel;
- F32 mValue;
+ LLUIString mLabel;
+ std::string mUnitLabel;
+ F32 mValue;
};
#endif
diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp
index 22c276a018..bdb378c9c5 100644
--- a/indra/llui/llstatgraph.cpp
+++ b/indra/llui/llstatgraph.cpp
@@ -58,14 +58,6 @@ LLStatGraph::LLStatGraph(const Params& p)
{
mThresholds.push_back(Threshold(it->value(), it->color));
}
-
- //mThresholdColors[0] = LLColor4(0.f, 1.f, 0.f, 1.f);
- //mThresholdColors[1] = LLColor4(1.f, 1.f, 0.f, 1.f);
- //mThresholdColors[2] = LLColor4(1.f, 0.f, 0.f, 1.f);
- //mThresholdColors[3] = LLColor4(1.f, 0.f, 0.f, 1.f);
- //mThresholds[0] = 50.f;
- //mThresholds[1] = 75.f;
- //mThresholds[2] = 100.f;
}
void LLStatGraph::draw()
@@ -116,15 +108,6 @@ void LLStatGraph::draw()
LLColor4 color;
- //S32 i;
- //for (i = 0; i < mNumThresholds - 1; i++)
- //{
- // if (mThresholds[i] > mValue)
- // {
- // break;
- // }
- //}
-
threshold_vec_t::iterator it = std::lower_bound(mThresholds.begin(), mThresholds.end(), Threshold(mValue / mMax, LLUIColor()));
if (it != mThresholds.begin())
diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h
index 57856ff6f2..c9e33ed902 100644
--- a/indra/llui/llstatgraph.h
+++ b/indra/llui/llstatgraph.h
@@ -57,8 +57,8 @@ public:
struct StatParams : public LLInitParam::ChoiceBlock<StatParams>
{
- Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* > count_stat_float;
- Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* > count_stat_int;
+ Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* > count_stat_float;
+ Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* > count_stat_int;
Alternative<LLTrace::TraceType<LLTrace::MeasurementAccumulator<F64> >* > measurement_stat_float;
Alternative<LLTrace::TraceType<LLTrace::MeasurementAccumulator<S64> >* > measurement_stat_int;
};
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 5fc2cc350d..4df35f77a5 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -406,7 +406,7 @@ void LLTabContainer::draw()
}
}
- setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f)));
+ setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLSmoothInterpolation::getInterpolant(0.08f)));
BOOL has_scroll_arrows = !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0));
if (!mIsVertical)
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 81ea0ebf0c..2297285c39 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -42,9 +42,9 @@
namespace LLToolBarEnums
{
- LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType)
+ LLView::EOrientation getOrientation(SideType sideType)
{
- LLLayoutStack::ELayoutOrientation orientation = LLLayoutStack::HORIZONTAL;
+ LLView::EOrientation orientation = LLLayoutStack::HORIZONTAL;
if ((sideType == SIDE_LEFT) || (sideType == SIDE_RIGHT))
{
@@ -172,7 +172,7 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p)
// Initialize the base object
LLUICtrl::initFromParams(p);
- LLLayoutStack::ELayoutOrientation orientation = getOrientation(p.side);
+ LLView::EOrientation orientation = getOrientation(p.side);
LLLayoutStack::Params centering_stack_p;
centering_stack_p.name = "centering_stack";
@@ -524,7 +524,7 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y)
int rank = 0;
// Convert the toolbar coord into button panel coords
- LLLayoutStack::ELayoutOrientation orientation = getOrientation(mSideType);
+ LLView::EOrientation orientation = getOrientation(mSideType);
S32 button_panel_x = 0;
S32 button_panel_y = 0;
localPointToOtherView(x, y, &button_panel_x, &button_panel_y, mButtonPanel);
@@ -643,7 +643,7 @@ void LLToolBar::updateLayoutAsNeeded()
{
if (!mNeedsLayout) return;
- LLLayoutStack::ELayoutOrientation orientation = getOrientation(mSideType);
+ LLView::EOrientation orientation = getOrientation(mSideType);
// our terminology for orientation-agnostic layout is such that
// length refers to a distance in the direction we stack the buttons
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index a50c60282c..2ffcc8b574 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -124,7 +124,7 @@ namespace LLToolBarEnums
SIDE_TOP,
};
- LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType);
+ LLView::EOrientation getOrientation(SideType sideType);
}
// NOTE: This needs to occur before Param block declaration for proper compilation.
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 587953477d..ba88396294 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -83,6 +83,16 @@ template class LLView* LLView::getChild<class LLView>(
static LLDefaultChildRegistry::Register<LLView> r("view");
+namespace LLInitParam
+{
+ void TypeValues<LLView::EOrientation>::declareValues()
+ {
+ declare("horizontal", LLView::HORIZONTAL);
+ declare("vertical", LLView::VERTICAL);
+ }
+}
+
+
LLView::Follows::Follows()
: string(""),
flags("flags", FOLLOWS_LEFT | FOLLOWS_TOP)
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index e18cfff8e5..88813da3c6 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -105,6 +105,9 @@ class LLView
public LLTrace::MemTrackable<LLView> // track memory usage
{
public:
+
+ enum EOrientation { HORIZONTAL, VERTICAL, ORIENTATION_COUNT };
+
struct Follows : public LLInitParam::ChoiceBlock<Follows>
{
Alternative<std::string> string;
@@ -676,6 +679,16 @@ public:
static LLTrace::MemStatHandle sMemStat;
};
+namespace LLInitParam
+{
+template<>
+struct TypeValues<LLView::EOrientation> : public LLInitParam::TypeValuesHelper<LLView::EOrientation>
+{
+ static void declareValues();
+};
+}
+
+
class LLCompareByTabOrder
{
public: