summaryrefslogtreecommitdiff
path: root/indra/llui/llstatbar.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llstatbar.h')
-rwxr-xr-xindra/llui/llstatbar.h118
1 files changed, 67 insertions, 51 deletions
diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h
index 513fff3234..5e9255b9eb 100755
--- a/indra/llui/llstatbar.h
+++ b/indra/llui/llstatbar.h
@@ -29,74 +29,90 @@
#include "llview.h"
#include "llframetimer.h"
-
-class LLStat;
+#include "lltracerecording.h"
class LLStatBar : public LLView
{
public:
+
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
- Optional<std::string> label;
- Optional<std::string> unit_label;
- Optional<F32> bar_min;
- Optional<F32> bar_max;
- Optional<F32> tick_spacing;
- Optional<F32> label_spacing;
- Optional<U32> precision;
- Optional<F32> update_rate;
- Optional<bool> show_per_sec;
- Optional<bool> show_bar;
- Optional<bool> show_history;
- Optional<bool> show_mean;
- Optional<std::string> stat;
- Params()
- : label("label"),
- unit_label("unit_label"),
- bar_min("bar_min", 0.0f),
- bar_max("bar_max", 50.0f),
- tick_spacing("tick_spacing", 10.0f),
- label_spacing("label_spacing", 10.0f),
- precision("precision", 0),
- update_rate("update_rate", 5.0f),
- show_per_sec("show_per_sec", TRUE),
- show_bar("show_bar", TRUE),
- show_history("show_history", FALSE),
- show_mean("show_mean", TRUE),
- stat("stat")
- {
- changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT);
- }
+ Optional<std::string> label,
+ unit_label;
+
+ Optional<F32> bar_min,
+ bar_max,
+ tick_spacing;
+
+ Optional<U32> decimal_digits;
+
+ Optional<bool> show_bar,
+ show_history,
+ scale_range;
+
+ Optional<S32> num_frames,
+ num_frames_short,
+ max_height;
+ Optional<std::string> stat;
+ Optional<EOrientation> orientation;
+
+ Params();
};
LLStatBar(const Params&);
virtual void draw();
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
- void setStat(LLStat* stat) { mStatp = stat; }
- void setRange(F32 bar_min, F32 bar_max, F32 tick_spacing, F32 label_spacing);
+ void setStat(const std::string& stat_name);
+
+ void setRange(F32 bar_min, F32 bar_max);
void getRange(F32& bar_min, F32& bar_max) { bar_min = mMinBar; bar_max = mMaxBar; }
/*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;
- 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
-
- LLStat* mStatp;
-
- LLFrameTimer mUpdateTimer;
- LLUIString mLabel;
- std::string mUnitLabel;
- F32 mValue;
+ void drawLabelAndValue( F32 mean, std::string &unit_label, LLRect &bar_rect, S32 decimal_digits );
+ void drawTicks( F32 min, F32 max, F32 value_scale, LLRect &bar_rect );
+
+ F32 mMinBar,
+ mMaxBar,
+ mCurMaxBar,
+ mCurMinBar,
+ mLabelSpacing;
+ F32 mTickValue;
+ U32 mDecimalDigits;
+ S32 mNumHistoryFrames,
+ mNumShortHistoryFrames;
+ S32 mMaxHeight;
+ bool mDisplayBar, // Display the bar graph.
+ mDisplayHistory,
+ mAutoScaleMax,
+ mAutoScaleMin;
+ EOrientation mOrientation;
+ F32 mLastDisplayValue;
+ LLFrameTimer mLastDisplayValueTimer;
+
+ enum
+ {
+ STAT_NONE,
+ STAT_COUNT,
+ STAT_EVENT,
+ STAT_SAMPLE,
+ STAT_MEM
+ } mStatType;
+
+ union
+ {
+ void* valid;
+ const LLTrace::TraceType<LLTrace::CountAccumulator>* countStatp;
+ const LLTrace::TraceType<LLTrace::EventAccumulator>* eventStatp;
+ const LLTrace::TraceType<LLTrace::SampleAccumulator>* sampleStatp;
+ const LLTrace::TraceType<LLTrace::MemStatAccumulator>* memStatp;
+ } mStat;
+
+ LLUIString mLabel;
+ std::string mUnitLabel;
};
#endif