summaryrefslogtreecommitdiffstats
path: root/gui/text.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2016-03-14 21:47:09 +0100
committerDees Troy <dees_troy@teamw.in>2016-03-29 21:05:35 +0200
commita5db7121ab731d3d725ce77da46658dc098cfe45 (patch)
treecf2af66f5b4427818f1cc5f3bf7ab0f96bcd17ae /gui/text.cpp
parentDetect and install custom themes as part of zip installs (diff)
downloadandroid_bootable_recovery-a5db7121ab731d3d725ce77da46658dc098cfe45.tar
android_bootable_recovery-a5db7121ab731d3d725ce77da46658dc098cfe45.tar.gz
android_bootable_recovery-a5db7121ab731d3d725ce77da46658dc098cfe45.tar.bz2
android_bootable_recovery-a5db7121ab731d3d725ce77da46658dc098cfe45.tar.lz
android_bootable_recovery-a5db7121ab731d3d725ce77da46658dc098cfe45.tar.xz
android_bootable_recovery-a5db7121ab731d3d725ce77da46658dc098cfe45.tar.zst
android_bootable_recovery-a5db7121ab731d3d725ce77da46658dc098cfe45.zip
Diffstat (limited to '')
-rw-r--r--gui/text.cpp35
1 files changed, 24 insertions, 11 deletions
diff --git a/gui/text.cpp b/gui/text.cpp
index 6498af62c..49e27a104 100644
--- a/gui/text.cpp
+++ b/gui/text.cpp
@@ -1,3 +1,21 @@
+/*
+ Copyright 2012 to 2016 bigbiff/Dees_Troy TeamWin
+ This file is part of TWRP/TeamWin Recovery Project.
+
+ TWRP is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ TWRP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with TWRP. If not, see <http://www.gnu.org/licenses/>.
+*/
+
// text.cpp - GUIText object
#include <stdarg.h>
@@ -33,7 +51,6 @@ GUIText::GUIText(xml_node<>* node)
mVarChanged = 0;
mFontHeight = 0;
maxWidth = 0;
- charSkip = 0;
scaleWidth = true;
isHighlighted = false;
mText = "";
@@ -94,22 +111,18 @@ int GUIText::Render(void)
return -1;
mLastValue = gui_parse_text(mText);
- string displayValue = mLastValue;
-
- if (charSkip)
- displayValue.erase(0, charSkip);
mVarChanged = 0;
int x = mRenderX, y = mRenderY;
- int width = gr_ttf_measureEx(displayValue.c_str(), fontResource);
+ int width = gr_ttf_measureEx(mLastValue.c_str(), fontResource);
if (isHighlighted)
gr_color(mHighlightColor.red, mHighlightColor.green, mHighlightColor.blue, mHighlightColor.alpha);
else
gr_color(mColor.red, mColor.green, mColor.blue, mColor.alpha);
- gr_textEx_scaleW(mRenderX, mRenderY, displayValue.c_str(), fontResource, maxWidth, mPlacement, scaleWidth);
+ gr_textEx_scaleW(mRenderX, mRenderY, mLastValue.c_str(), fontResource, maxWidth, mPlacement, scaleWidth);
return 0;
}
@@ -164,13 +177,13 @@ int GUIText::NotifyVarChange(const std::string& varName, const std::string& valu
int GUIText::SetMaxWidth(unsigned width)
{
maxWidth = width;
+ if (!maxWidth)
+ scaleWidth = false;
mVarChanged = 1;
return 0;
}
-int GUIText::SkipCharCount(unsigned skip)
+void GUIText::SetText(string newtext)
{
- charSkip = skip;
- mVarChanged = 1;
- return 0;
+ mText = newtext;
}