From b21cc64ca8f5a9d936d6ece7da120bc0bc65b49f Mon Sep 17 00:00:00 2001 From: Dees Troy Date: Tue, 10 Sep 2013 17:36:41 +0000 Subject: Pull ROM info from build.prop for backup names Change-Id: I7847fca22b5d4f0a35da41625b15bd677a1e9768 --- gui/action.cpp | 25 +++++++++++++++++++++++-- gui/button.cpp | 23 ++++++++++------------- gui/devices/1024x600/res/ui.xml | 21 +++++++++++++++------ gui/devices/1024x768/res/ui.xml | 21 +++++++++++++++------ gui/devices/1080x1920/res/ui.xml | 23 ++++++++++++++++------- gui/devices/1280x800/res/ui.xml | 21 +++++++++++++++------ gui/devices/1920x1200/res/ui.xml | 21 +++++++++++++++------ gui/devices/2560x1600/res/ui.xml | 23 ++++++++++++++++------- gui/devices/320x480/res/ui.xml | 23 ++++++++++++++++------- gui/devices/480x800/res/ui.xml | 23 ++++++++++++++++------- gui/devices/480x854/res/ui.xml | 23 ++++++++++++++++------- gui/devices/540x960/res/ui.xml | 23 ++++++++++++++++------- gui/devices/720x1280/res/ui.xml | 23 ++++++++++++++++------- gui/devices/800x1280/res/ui.xml | 23 ++++++++++++++++------- gui/devices/800x480/res/ui.xml | 21 +++++++++++++++------ gui/objects.hpp | 1 + 16 files changed, 237 insertions(+), 101 deletions(-) (limited to 'gui') diff --git a/gui/action.cpp b/gui/action.cpp index d67e697b0..78e862526 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -701,6 +701,27 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) return 0; } + if (function == "appenddatetobackupname") + { + operation_start("AppendDateToBackupName"); + string Backup_Name; + DataManager::GetValue(TW_BACKUP_NAME, Backup_Name); + Backup_Name += TWFunc::Get_Current_Date(); + if (Backup_Name.size() > MAX_BACKUP_NAME_LEN) + Backup_Name.resize(MAX_BACKUP_NAME_LEN); + DataManager::SetValue(TW_BACKUP_NAME, Backup_Name); + operation_end(0, simulate); + return 0; + } + + if (function == "generatebackupname") + { + operation_start("GenerateBackupName"); + TWFunc::Auto_Generate_Backup_Name(); + operation_end(0, simulate); + return 0; + } + if (isThreaded) { if (function == "fileexists") @@ -893,14 +914,14 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) if (arg == "backup") { string Backup_Name; DataManager::GetValue(TW_BACKUP_NAME, Backup_Name); - if (Backup_Name == "(Current Date)" || Backup_Name == "0" || Backup_Name == "(" || PartitionManager.Check_Backup_Name(true) == 0) { + if (Backup_Name == "(Auto Generate)" || Backup_Name == "(Current Date)" || Backup_Name == "0" || Backup_Name == "(" || PartitionManager.Check_Backup_Name(true) == 0) { ret = PartitionManager.Run_Backup(); } else { operation_end(1, simulate); return -1; } - DataManager::SetValue(TW_BACKUP_NAME, "(Current Date)"); + DataManager::SetValue(TW_BACKUP_NAME, "(Auto Generate)"); } else if (arg == "restore") { string Restore_Name; DataManager::GetValue("tw_restore", Restore_Name); diff --git a/gui/button.cpp b/gui/button.cpp index 9fc85a052..3f9c2df1f 100644 --- a/gui/button.cpp +++ b/gui/button.cpp @@ -110,10 +110,11 @@ GUIButton::GUIButton(xml_node<>* node) } 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 @@ int GUIButton::Render(void) 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 @@ int GUIButton::SetRenderPos(int x, int y, int w, int h) 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); } } diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml index 2b7d20e2e..bbcaae1f5 100755 --- a/gui/devices/1024x600/res/ui.xml +++ b/gui/devices/1024x600/res/ui.xml @@ -1733,8 +1733,8 @@ - - tw_backup_name= + + @@ -1776,12 +1776,21 @@ - + + + Append Date + + + + + + + Cancel / Clear - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup @@ -1791,7 +1800,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) main @@ -1799,7 +1808,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml index b625174a4..97b98c049 100644 --- a/gui/devices/1024x768/res/ui.xml +++ b/gui/devices/1024x768/res/ui.xml @@ -1733,8 +1733,8 @@ - - tw_backup_name= + + @@ -1776,12 +1776,21 @@ - + + + Append Date + + + + + + + Cancel / Clear - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup @@ -1791,7 +1800,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) main @@ -1799,7 +1808,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup diff --git a/gui/devices/1080x1920/res/ui.xml b/gui/devices/1080x1920/res/ui.xml index 25d3ed8ef..5ba884b13 100644 --- a/gui/devices/1080x1920/res/ui.xml +++ b/gui/devices/1080x1920/res/ui.xml @@ -1341,7 +1341,7 @@ - + Backup Name: %tw_backup_name% @@ -1459,8 +1459,8 @@ - - tw_backup_name= + + @@ -1502,12 +1502,21 @@ - + + + Append Date + + + + + + + Cancel - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup @@ -1517,7 +1526,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) main @@ -1525,7 +1534,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml index b86f99171..66861f2cb 100644 --- a/gui/devices/1280x800/res/ui.xml +++ b/gui/devices/1280x800/res/ui.xml @@ -1733,8 +1733,8 @@ - - tw_backup_name= + + @@ -1776,12 +1776,21 @@ - + + + Append Date + + + + + + + Cancel / Clear - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup @@ -1791,7 +1800,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) main @@ -1799,7 +1808,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml index 157005f1a..d1a7829ac 100644 --- a/gui/devices/1920x1200/res/ui.xml +++ b/gui/devices/1920x1200/res/ui.xml @@ -1733,8 +1733,8 @@ - - tw_backup_name= + + @@ -1776,12 +1776,21 @@ - + + + Append Date + + + + + + + Cancel / Clear - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup @@ -1791,7 +1800,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) main @@ -1799,7 +1808,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml index 3d6b65f5c..23b7c3e02 100644 --- a/gui/devices/2560x1600/res/ui.xml +++ b/gui/devices/2560x1600/res/ui.xml @@ -169,7 +169,7 @@ - + @@ -1733,8 +1733,8 @@ - - tw_backup_name= + + @@ -1776,12 +1776,21 @@ - + + + Append Date + + + + + + + Cancel / Clear - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup @@ -1791,7 +1800,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) main @@ -1799,7 +1808,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml index 0719a942c..893c90cfd 100644 --- a/gui/devices/320x480/res/ui.xml +++ b/gui/devices/320x480/res/ui.xml @@ -1328,7 +1328,7 @@ - + Backup Name: %tw_backup_name% @@ -1446,8 +1446,8 @@ - - tw_backup_name= + + @@ -1489,12 +1489,21 @@ - + + + Append Date + + + + + + + Cancel - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup @@ -1504,7 +1513,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) main @@ -1512,7 +1521,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml index b7b527bb9..690028106 100644 --- a/gui/devices/480x800/res/ui.xml +++ b/gui/devices/480x800/res/ui.xml @@ -1328,7 +1328,7 @@ - + Backup Name: %tw_backup_name% @@ -1446,8 +1446,8 @@ - - tw_backup_name= + + @@ -1489,12 +1489,21 @@ - + + + Append Date + + + + + + + Cancel - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup @@ -1504,7 +1513,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) main @@ -1512,7 +1521,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml index cb6577f20..09c507767 100644 --- a/gui/devices/480x854/res/ui.xml +++ b/gui/devices/480x854/res/ui.xml @@ -1327,7 +1327,7 @@ - + Backup Name: %tw_backup_name% @@ -1445,8 +1445,8 @@ - - tw_backup_name= + + @@ -1488,12 +1488,21 @@ - + + + Append Date + + + + + + + Cancel - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup @@ -1503,7 +1512,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) main @@ -1511,7 +1520,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml index 078f1ae51..f636e2e0e 100644 --- a/gui/devices/540x960/res/ui.xml +++ b/gui/devices/540x960/res/ui.xml @@ -1328,7 +1328,7 @@ - + Backup Name: %tw_backup_name% @@ -1446,8 +1446,8 @@ - - tw_backup_name= + + @@ -1489,12 +1489,21 @@ - + + + Append Date + + + + + + + Cancel - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup @@ -1504,7 +1513,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) main @@ -1512,7 +1521,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml index d2896cc94..316b20e78 100644 --- a/gui/devices/720x1280/res/ui.xml +++ b/gui/devices/720x1280/res/ui.xml @@ -1341,7 +1341,7 @@ - + Backup Name: %tw_backup_name% @@ -1459,8 +1459,8 @@ - - tw_backup_name= + + @@ -1502,12 +1502,21 @@ - + + + Append Date + + + + + + + Cancel - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup @@ -1517,7 +1526,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) main @@ -1525,7 +1534,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml index ba7dba321..b85084142 100755 --- a/gui/devices/800x1280/res/ui.xml +++ b/gui/devices/800x1280/res/ui.xml @@ -1329,7 +1329,7 @@ - + Backup Name: %tw_backup_name% @@ -1447,8 +1447,8 @@ - - tw_backup_name= + + @@ -1490,12 +1490,21 @@ - + + + Append Date + + + + + + + Cancel - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup @@ -1505,7 +1514,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) main @@ -1513,7 +1522,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml index ba262bcce..cbd3b7da0 100755 --- a/gui/devices/800x480/res/ui.xml +++ b/gui/devices/800x480/res/ui.xml @@ -1741,8 +1741,8 @@ - - tw_backup_name= + + @@ -1784,12 +1784,21 @@ - + + + Append Date + + + + + + + Cancel / Clear - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup @@ -1799,7 +1808,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) main @@ -1807,7 +1816,7 @@ - tw_backup_name=(Current Date) + tw_backup_name=(Auto Generate) backup diff --git a/gui/objects.hpp b/gui/objects.hpp index d37b43e3b..1e272b276 100644 --- a/gui/objects.hpp +++ b/gui/objects.hpp @@ -380,6 +380,7 @@ protected: bool hasFill; COLOR mFillColor; COLOR mHighlightColor; + Placement TextPlacement; }; class GUICheckbox: public RenderObject, public ActionObject, public Conditional -- cgit v1.2.3