Pull ROM info from build.prop for backup names
Change-Id: I7847fca22b5d4f0a35da41625b15bd677a1e9768
diff --git a/gui/button.cpp b/gui/button.cpp
index 9fc85a0..3f9c2df 100644
--- a/gui/button.cpp
+++ b/gui/button.cpp
@@ -110,10 +110,11 @@
}
int x, y, w, h;
+ TextPlacement = TOP_LEFT;
if (mButtonImg) {
mButtonImg->GetRenderPos(x, y, w, h);
} else if (hasFill) {
- LoadPlacement(node->first_node("placement"), &x, &y, &w, &h);
+ LoadPlacement(node->first_node("placement"), &x, &y, &w, &h, &TextPlacement);
}
SetRenderPos(x, y, w, h);
return;
@@ -150,14 +151,12 @@
mButtonLabel->GetCurrentBounds(w, h);
if (w != mTextW) {
mTextW = w;
- // As a special case, we'll allow large text which automatically moves it to the right.
- if (mTextW > mRenderW)
- {
+ if (TextPlacement == CENTER_X_ONLY) {
+ mTextX = ((mRenderW - mRenderX) / 2);
+ } else if (mTextW > mRenderW) { // As a special case, we'll allow large text which automatically moves it to the right.
mTextX = mRenderW + mRenderX + 5;
mRenderW += mTextW + 5;
- }
- else
- {
+ } else {
mTextX = mRenderX + ((mRenderW - mTextW) / 2);
}
mButtonLabel->SetRenderPos(mTextX, mTextY);
@@ -231,14 +230,12 @@
if (mButtonLabel) mButtonLabel->GetCurrentBounds(mTextW, mTextH);
if (mTextW)
{
- // As a special case, we'll allow large text which automatically moves it to the right.
- if (mTextW > mRenderW)
- {
+ if (TextPlacement == CENTER_X_ONLY) {
+ mTextX = ((mRenderW - mRenderX) / 2);
+ } else if (mTextW > mRenderW) { // As a special case, we'll allow large text which automatically moves it to the right.
mTextX = mRenderW + mRenderX + 5;
mRenderW += mTextW + 5;
- }
- else
- {
+ } else {
mTextX = mRenderX + ((mRenderW - mTextW) / 2);
}
}