diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llstatbar.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/newview/llstatbar.cpp')
-rw-r--r-- | linden/indra/newview/llstatbar.cpp | 54 |
1 files changed, 45 insertions, 9 deletions
diff --git a/linden/indra/newview/llstatbar.cpp b/linden/indra/newview/llstatbar.cpp index 2673166..86a790b 100644 --- a/linden/indra/newview/llstatbar.cpp +++ b/linden/indra/newview/llstatbar.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -42,8 +43,10 @@ | |||
42 | 43 | ||
43 | /////////////////////////////////////////////////////////////////////////////////// | 44 | /////////////////////////////////////////////////////////////////////////////////// |
44 | 45 | ||
45 | LLStatBar::LLStatBar(const std::string& name, const LLRect& rect) | 46 | LLStatBar::LLStatBar(const std::string& name, const LLRect& rect, const std::string& setting, |
46 | : LLView(name, rect, TRUE) | 47 | BOOL default_bar, BOOL default_history) |
48 | : LLView(name, rect, TRUE), | ||
49 | mSetting(setting) | ||
47 | { | 50 | { |
48 | mMinBar = 0.f; | 51 | mMinBar = 0.f; |
49 | mMaxBar = 50.f; | 52 | mMaxBar = 50.f; |
@@ -55,9 +58,25 @@ LLStatBar::LLStatBar(const std::string& name, const LLRect& rect) | |||
55 | mLabel = name; | 58 | mLabel = name; |
56 | mPerSec = TRUE; | 59 | mPerSec = TRUE; |
57 | mValue = 0.f; | 60 | mValue = 0.f; |
58 | mDisplayBar = TRUE; | ||
59 | mDisplayHistory = FALSE; | ||
60 | mDisplayMean = TRUE; | 61 | mDisplayMean = TRUE; |
62 | |||
63 | S32 mode = -1; | ||
64 | if (mSetting.length() > 0) | ||
65 | { | ||
66 | mode = gSavedSettings.getS32(mSetting); | ||
67 | |||
68 | } | ||
69 | |||
70 | if (mode != -1) | ||
71 | { | ||
72 | mDisplayBar = (mode & STAT_BAR_FLAG) ? TRUE : FALSE; | ||
73 | mDisplayHistory = (mode & STAT_HISTORY_FLAG) ? TRUE : FALSE; | ||
74 | } | ||
75 | else | ||
76 | { | ||
77 | mDisplayBar = default_bar; | ||
78 | mDisplayHistory = default_history; | ||
79 | } | ||
61 | } | 80 | } |
62 | 81 | ||
63 | BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) | 82 | BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) |
@@ -82,7 +101,24 @@ BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) | |||
82 | LLView* parent = getParent(); | 101 | LLView* parent = getParent(); |
83 | parent->reshape(parent->getRect().getWidth(), parent->getRect().getHeight(), FALSE); | 102 | parent->reshape(parent->getRect().getWidth(), parent->getRect().getHeight(), FALSE); |
84 | 103 | ||
85 | return FALSE; | 104 | // save view mode |
105 | if (mSetting.length() > 0) | ||
106 | { | ||
107 | S32 mode = 0; | ||
108 | if (mDisplayBar) | ||
109 | { | ||
110 | mode |= STAT_BAR_FLAG; | ||
111 | } | ||
112 | if (mDisplayHistory) | ||
113 | { | ||
114 | mode |= STAT_HISTORY_FLAG; | ||
115 | } | ||
116 | |||
117 | gSavedSettings.setS32(mSetting, mode); | ||
118 | } | ||
119 | |||
120 | |||
121 | return TRUE; | ||
86 | } | 122 | } |
87 | 123 | ||
88 | void LLStatBar::draw() | 124 | void LLStatBar::draw() |
@@ -134,7 +170,7 @@ void LLStatBar::draw() | |||
134 | 170 | ||
135 | F32 value_scale = max_width/(mMaxBar - mMinBar); | 171 | F32 value_scale = max_width/(mMaxBar - mMinBar); |
136 | 172 | ||
137 | LLFontGL::sMonospace->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f), | 173 | LLFontGL::getFontMonospace()->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f), |
138 | LLFontGL::LEFT, LLFontGL::TOP); | 174 | LLFontGL::LEFT, LLFontGL::TOP); |
139 | 175 | ||
140 | std::string value_format; | 176 | std::string value_format; |
@@ -151,7 +187,7 @@ void LLStatBar::draw() | |||
151 | } | 187 | } |
152 | 188 | ||
153 | // Draw the value. | 189 | // Draw the value. |
154 | LLFontGL::sMonospace->renderUTF8(value_str, 0, width, getRect().getHeight(), | 190 | LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, width, getRect().getHeight(), |
155 | LLColor4(1.f, 1.f, 1.f, 0.5f), | 191 | LLColor4(1.f, 1.f, 1.f, 0.5f), |
156 | LLFontGL::RIGHT, LLFontGL::TOP); | 192 | LLFontGL::RIGHT, LLFontGL::TOP); |
157 | 193 | ||
@@ -184,7 +220,7 @@ void LLStatBar::draw() | |||
184 | 220 | ||
185 | tick_label = llformat( value_format.c_str(), tick_value); | 221 | tick_label = llformat( value_format.c_str(), tick_value); |
186 | // draw labels for the tick marks | 222 | // draw labels for the tick marks |
187 | LLFontGL::sMonospace->renderUTF8(tick_label, 0, left - 1, bar_top - bar_height - tick_height, | 223 | LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, left - 1, bar_top - bar_height - tick_height, |
188 | LLColor4(1.f, 1.f, 1.f, 0.5f), | 224 | LLColor4(1.f, 1.f, 1.f, 0.5f), |
189 | LLFontGL::LEFT, LLFontGL::TOP); | 225 | LLFontGL::LEFT, LLFontGL::TOP); |
190 | } | 226 | } |