summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gui/Android.mk6
-rw-r--r--gui/devices/portrait/res/portrait.xml4
-rw-r--r--gui/devices/watch/res/watch.xml4
-rw-r--r--gui/gui.cpp2
-rw-r--r--gui/objects.hpp7
-rw-r--r--gui/pages.cpp19
6 files changed, 37 insertions, 5 deletions
diff --git a/gui/Android.mk b/gui/Android.mk
index b8a8de837..e75c5214a 100644
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -56,6 +56,12 @@ endif
ifeq ($(TW_DISABLE_TTF), true)
LOCAL_CFLAGS += -DTW_DISABLE_TTF
endif
+ifneq ($(TW_X_OFFSET),)
+ LOCAL_CFLAGS += -DTW_X_OFFSET=$(TW_X_OFFSET)
+endif
+ifneq ($(TW_Y_OFFSET),)
+ LOCAL_CFLAGS += -DTW_Y_OFFSET=$(TW_Y_OFFSET)
+endif
ifeq ($(DEVICE_RESOLUTION),)
$(warning ********************************************************************************)
diff --git a/gui/devices/portrait/res/portrait.xml b/gui/devices/portrait/res/portrait.xml
index b73297411..bb8e37217 100644
--- a/gui/devices/portrait/res/portrait.xml
+++ b/gui/devices/portrait/res/portrait.xml
@@ -1041,7 +1041,7 @@
<object type="button">
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
- <placement x="%col1_x%" y="%wipe_button_row1%" w="%button_fill_full_width%" h="%button_fill_half_height%" placement="5" />
+ <placement x="%col1_x%" y="%wipe_button_row1%" w="%button_fill_full_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>Repair or Change File System</text>
<actions>
@@ -1494,7 +1494,7 @@
<object type="button">
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
- <placement x="%col1_x%" y="%row1_header_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" placement="5" />
+ <placement x="%col1_x%" y="%row1_header_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Backup Name: %tw_backup_name%</text>
<actions>
diff --git a/gui/devices/watch/res/watch.xml b/gui/devices/watch/res/watch.xml
index 03effde31..dc787b37c 100644
--- a/gui/devices/watch/res/watch.xml
+++ b/gui/devices/watch/res/watch.xml
@@ -994,7 +994,7 @@
<object type="button">
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
- <placement x="%col1_x%" y="%wipe_button_row1%" w="%button_fill_full_width%" h="%button_fill_half_height%" placement="5" />
+ <placement x="%col1_x%" y="%wipe_button_row1%" w="%button_fill_full_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>Repair or Change File System</text>
<actions>
@@ -1439,7 +1439,7 @@
<object type="button">
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
- <placement x="%col1_x%" y="%row1_header_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" placement="5" />
+ <placement x="%col1_x%" y="%row1_header_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Backup Name: %tw_backup_name%</text>
<actions>
diff --git a/gui/gui.cpp b/gui/gui.cpp
index d07c49ff4..db6e23f84 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -106,7 +106,7 @@ static void curtainSet()
{
gr_color(0, 0, 0, 255);
gr_fill(0, 0, gr_fb_width(), gr_fb_height());
- gr_blit(gCurtain, 0, 0, gr_get_width(gCurtain), gr_get_height(gCurtain), 0, 0);
+ gr_blit(gCurtain, 0, 0, gr_get_width(gCurtain), gr_get_height(gCurtain), TW_X_OFFSET, TW_Y_OFFSET);
gr_flip();
}
diff --git a/gui/objects.hpp b/gui/objects.hpp
index a89f48680..99b585507 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -35,6 +35,13 @@ using namespace rapidxml;
#include "pages.hpp"
#include "../partitions.hpp"
+#ifndef TW_X_OFFSET
+#define TW_X_OFFSET 0
+#endif
+#ifndef TW_Y_OFFSET
+#define TW_Y_OFFSET 0
+#endif
+
class RenderObject
{
public:
diff --git a/gui/pages.cpp b/gui/pages.cpp
index bea39e902..a1a6346a4 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -60,6 +60,9 @@ PageSet* PageManager::mBaseSet = NULL;
MouseCursor *PageManager::mMouseCursor = NULL;
HardwareKeyboard *PageManager::mHardwareKeyboard = NULL;
+int tw_x_offset = 0;
+int tw_y_offset = 0;
+
// Helper routine to convert a string to a color declaration
int ConvertStrToColor(std::string str, COLOR* color)
{
@@ -115,6 +118,7 @@ bool LoadPlacement(xml_node<>* node, int* x, int* y, int* w /* = NULL */, int* h
value = node->first_attribute("x")->value();
DataManager::GetValue(value, value);
*x = atol(value.c_str());
+ *x += tw_x_offset;
}
if (node->first_attribute("y"))
@@ -122,6 +126,7 @@ bool LoadPlacement(xml_node<>* node, int* x, int* y, int* w /* = NULL */, int* h
value = node->first_attribute("y")->value();
DataManager::GetValue(value, value);
*y = atol(value.c_str());
+ *y += tw_y_offset;
}
if (w && node->first_attribute("w"))
@@ -785,6 +790,16 @@ int PageSet::LoadVariables(xml_node<>* vars)
persist = child->first_attribute("persist");
if(name && value)
{
+ if (strcmp(name->value(), "tw_x_offset") == 0) {
+ tw_x_offset = atoi(value->value());
+ child = child->next_sibling("variable");
+ continue;
+ }
+ if (strcmp(name->value(), "tw_y_offset") == 0) {
+ tw_y_offset = atoi(value->value());
+ child = child->next_sibling("variable");
+ continue;
+ }
p = persist ? atoi(persist->value()) : 0;
string temp = value->value();
string valstr = gui_parse_text(temp);
@@ -928,6 +943,8 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string
if (package.size() > 4 && package.substr(package.size() - 4) != ".zip")
{
LOGINFO("Load XML directly\n");
+ tw_x_offset = TW_X_OFFSET;
+ tw_y_offset = TW_Y_OFFSET;
// We can try to load the XML directly...
struct stat st;
if(stat(package.c_str(),&st) != 0)
@@ -948,6 +965,8 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string
else
{
LOGINFO("Loading zip theme\n");
+ tw_x_offset = 0;
+ tw_y_offset = 0;
if (!TWFunc::Path_Exists(package))
return -1;
if (sysMapFile(package.c_str(), &map) != 0) {