summaryrefslogtreecommitdiffstats
path: root/gui/text.cpp
diff options
context:
space:
mode:
authorthat <github@that.at>2015-03-05 20:25:39 +0100
committerEthan Yonker <dees_troy@teamw.in>2015-03-11 13:38:37 +0100
commitb2e8f672f310276e7009895c0ac4e58fcfeb35ac (patch)
tree44efb3ac558764f7faa95e509d6e4f19477ea505 /gui/text.cpp
parentgui: allow specifying resource type in element name (diff)
downloadandroid_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.tar
android_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.tar.gz
android_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.tar.bz2
android_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.tar.lz
android_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.tar.xz
android_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.tar.zst
android_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.zip
Diffstat (limited to 'gui/text.cpp')
-rw-r--r--gui/text.cpp41
1 files changed, 4 insertions, 37 deletions
diff --git a/gui/text.cpp b/gui/text.cpp
index 3487f7a82..effb9359b 100644
--- a/gui/text.cpp
+++ b/gui/text.cpp
@@ -55,7 +55,7 @@ GUIText::GUIText(xml_node<>* node)
if (child) mText = child->value();
// Simple way to check for static state
- mLastValue = parseText();
+ mLastValue = gui_parse_text(mText);
if (mLastValue != mText) mIsStatic = 0;
mFontHeight = mFont->GetHeight();
@@ -70,7 +70,7 @@ int GUIText::Render(void)
if (mFont)
fontResource = mFont->GetResource();
- mLastValue = parseText();
+ mLastValue = gui_parse_text(mText);
string displayValue = mLastValue;
if (charSkip)
@@ -126,7 +126,7 @@ int GUIText::Update(void)
if (mIsStatic || !mVarChanged)
return 0;
- std::string newValue = parseText();
+ std::string newValue = gui_parse_text(mText);
if (mLastValue == newValue)
return 0;
else
@@ -142,44 +142,11 @@ int GUIText::GetCurrentBounds(int& w, int& h)
fontResource = mFont->GetResource();
h = mFontHeight;
- mLastValue = parseText();
+ mLastValue = gui_parse_text(mText);
w = gr_measureEx(mLastValue.c_str(), fontResource);
return 0;
}
-std::string GUIText::parseText(void)
-{
- static int counter = 0;
- std::string str = mText;
- size_t pos = 0;
- size_t next = 0, end = 0;
-
- while (1)
- {
- next = str.find('%', pos);
- if (next == std::string::npos) return str;
- end = str.find('%', next + 1);
- if (end == std::string::npos) return str;
-
- // We have a block of data
- std::string var = str.substr(next + 1, (end - next) - 1);
- str.erase(next, (end - next) + 1);
-
- if (next + 1 == end)
- {
- str.insert(next, 1, '%');
- }
- else
- {
- std::string value;
- if (DataManager::GetValue(var, value) == 0)
- str.insert(next, value);
- }
-
- pos = next + 1;
- }
-}
-
int GUIText::NotifyVarChange(const std::string& varName, const std::string& value)
{
GUIObject::NotifyVarChange(varName, value);