summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorVojtech Bocek <vbocek@gmail.com>2013-04-01 22:11:33 +0200
committerDees_Troy <dees_troy@teamw.in>2013-04-04 20:59:08 +0200
commit85932344cd9a84d8586b4f9839855c730c8e8ebc (patch)
treeced1604b4e8baf7b711ebc4f30c3f15ead4ff67a /gui
parentMove all AOSP code out of recovery binary (diff)
downloadandroid_bootable_recovery-85932344cd9a84d8586b4f9839855c730c8e8ebc.tar
android_bootable_recovery-85932344cd9a84d8586b4f9839855c730c8e8ebc.tar.gz
android_bootable_recovery-85932344cd9a84d8586b4f9839855c730c8e8ebc.tar.bz2
android_bootable_recovery-85932344cd9a84d8586b4f9839855c730c8e8ebc.tar.lz
android_bootable_recovery-85932344cd9a84d8586b4f9839855c730c8e8ebc.tar.xz
android_bootable_recovery-85932344cd9a84d8586b4f9839855c730c8e8ebc.tar.zst
android_bootable_recovery-85932344cd9a84d8586b4f9839855c730c8e8ebc.zip
Diffstat (limited to 'gui')
-rw-r--r--gui/Android.mk6
-rw-r--r--gui/action.cpp27
-rwxr-xr-xgui/devices/1024x600/res/ui.xml123
-rw-r--r--gui/devices/1024x768/res/ui.xml123
-rw-r--r--gui/devices/1080x1920/res/ui.xml122
-rw-r--r--gui/devices/1280x800/res/ui.xml123
-rw-r--r--gui/devices/1920x1200/res/ui.xml123
-rw-r--r--gui/devices/2560x1600/res/ui.xml8
-rw-r--r--gui/devices/320x480/res/ui.xml122
-rw-r--r--gui/devices/480x800/res/ui.xml122
-rw-r--r--gui/devices/480x854/res/ui.xml122
-rw-r--r--gui/devices/540x960/res/ui.xml122
-rw-r--r--gui/devices/720x1280/res/ui.xml122
-rwxr-xr-xgui/devices/800x1280/res/ui.xml122
-rwxr-xr-xgui/devices/800x480/res/ui.xml123
-rw-r--r--gui/objects.hpp66
-rw-r--r--gui/pages.cpp6
-rw-r--r--gui/slidervalue.cpp418
18 files changed, 992 insertions, 1008 deletions
diff --git a/gui/Android.mk b/gui/Android.mk
index 748c5ec81..35d877bc1 100644
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -17,6 +17,7 @@ LOCAL_SRC_FILES := \
animation.cpp \
conditional.cpp \
slider.cpp \
+ slidervalue.cpp \
listbox.cpp \
keyboard.cpp \
input.cpp \
@@ -52,6 +53,11 @@ endif
ifneq ($(TW_BRIGHTNESS_PATH),)
LOCAL_CFLAGS += -DTW_BRIGHTNESS_PATH=$(TW_BRIGHTNESS_PATH)
endif
+ifneq ($(TW_MAX_BRIGHTNESS),)
+ LOCAL_CFLAGS += -DTW_MAX_BRIGHTNESS=$(TW_MAX_BRIGHTNESS)
+else
+ LOCAL_CFLAGS += -DTW_MAX_BRIGHTNESS=255
+endif
ifneq ($(TW_NO_SCREEN_BLANK),)
LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
endif
diff --git a/gui/action.cpp b/gui/action.cpp
index b35074cf0..64049b2c1 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -540,6 +540,33 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
DataManager::SetValue(varName, value);
return 0;
}
+ if (arg.find("*") != string::npos)
+ {
+ string varName = arg.substr(0, arg.find('*'));
+ string multiply_by_str = gui_parse_text(arg.substr(arg.find('*') + 1, string::npos));
+ int multiply_by = atoi(multiply_by_str.c_str());
+ int value;
+
+ DataManager::GetValue(varName, value);
+ DataManager::SetValue(varName, value*multiply_by);
+ return 0;
+ }
+ if (arg.find("/") != string::npos)
+ {
+ string varName = arg.substr(0, arg.find('/'));
+ string divide_by_str = gui_parse_text(arg.substr(arg.find('/') + 1, string::npos));
+ int divide_by = atoi(divide_by_str.c_str());
+ int value;
+
+ if(divide_by != 0)
+ {
+ DataManager::GetValue(varName, value);
+ DataManager::SetValue(varName, value/divide_by);
+ }
+ return 0;
+ }
+ LOGERR("Unable to perform compute '%s'\n", arg.c_str());
+ return -1;
}
if (function == "setguitimezone")
diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml
index 1615ee9c1..b24bda381 100755
--- a/gui/devices/1024x600/res/ui.xml
+++ b/gui/devices/1024x600/res/ui.xml
@@ -197,6 +197,14 @@
<variable name="mount_storage_row" value="500" />
<variable name="wipe_list_height" value="300" />
<variable name="wipe_button_y" value="190" />
+ <variable name="slidervalue_x" value="256" />
+ <variable name="slidervalue_w" value="512" />
+ <variable name="slidervalue_line_clr" value="#FFFFFF" />
+ <variable name="slidervalue_slider_clr" value="#33B5E5" />
+ <variable name="slidervalue_lineh" value="2" />
+ <variable name="slidervalue_padding" value="0" />
+ <variable name="slidervalue_sliderw" value="10" />
+ <variable name="slidervalue_sliderh" value="50" />
</variables>
<templates>
@@ -2289,100 +2297,47 @@
<text>Screen Settings</text>
</object>
- <object type="text" color="%text_color%">
- <font resource="font" />
- <placement x="%center_x%" y="%row4_text_y%" placement="5" />
- <text>Screen Timeout: %tw_screen_timeout_secs% seconds</text>
- </object>
-
<object type="button">
- <placement x="%col1_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>None</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=0</action>
- </object>
-
- <object type="button">
- <placement x="%col2_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>60</text>
- <image resource="medium_button" />
+ <placement x="%slidervalue_x%" y="%row3_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_false" />
<action function="set">tw_screen_timeout_secs=60</action>
</object>
<object type="button">
- <placement x="%col3_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>120</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=120</action>
- </object>
-
- <object type="button">
- <placement x="%col4_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>180</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=180</action>
- </object>
-
- <object type="text" color="%text_color%">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <font resource="font" />
- <placement x="%center_x%" y="%row12_text_y%" placement="5" />
- <text>Brightness: %tw_brightness_display%</text>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col1_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>25%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_25% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=25%</action>
- <action function="set">tw_brightness=%tw_brightness_25%</action>
- </actions>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col2_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>50%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_50% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=50%</action>
- <action function="set">tw_brightness=%tw_brightness_50%</action>
- </actions>
+ <placement x="%slidervalue_x%" y="%row3_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_true" />
+ <action function="set">tw_screen_timeout_secs=0</action>
</object>
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col3_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>75%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_75% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=75%</action>
- <action function="set">tw_brightness=%tw_brightness_75%</action>
- </actions>
+ <object type="slidervalue">
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <placement x="slidervalue_x" y="%row5_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Screen timeout in seconds:</text>
+ <data variable="tw_screen_timeout_secs" min="15" max="300" />
</object>
- <object type="button">
+ <object type="slidervalue">
<condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col4_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>100%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_100% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=100%</action>
- <action function="set">tw_brightness=%tw_brightness_100%</action>
+ <placement x="slidervalue_x" y="%row12_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Brightness: %tw_brightness_pct%%</text>
+ <data variable="tw_brightness_pct" min="10" max="100" />
+ <actions>
+ <action function="set">tw_brightness=%tw_brightness_max%</action>
+ <action function="compute">tw_brightness*%tw_brightness_pct%</action>
+ <action function="compute">tw_brightness/100</action>
+ <action function="cmd">echo %tw_brightness% > &quot;%tw_brightness_file%&quot;</action>
</actions>
</object>
diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml
index d16056220..5b9c3fcc5 100644
--- a/gui/devices/1024x768/res/ui.xml
+++ b/gui/devices/1024x768/res/ui.xml
@@ -197,6 +197,14 @@
<variable name="mount_storage_row" value="500" />
<variable name="wipe_list_height" value="400" />
<variable name="wipe_button_y" value="190" />
+ <variable name="slidervalue_x" value="256" />
+ <variable name="slidervalue_w" value="512" />
+ <variable name="slidervalue_line_clr" value="#FFFFFF" />
+ <variable name="slidervalue_slider_clr" value="#33B5E5" />
+ <variable name="slidervalue_lineh" value="2" />
+ <variable name="slidervalue_padding" value="0" />
+ <variable name="slidervalue_sliderw" value="10" />
+ <variable name="slidervalue_sliderh" value="50" />
</variables>
<templates>
@@ -2289,100 +2297,47 @@
<text>Screen Settings</text>
</object>
- <object type="text" color="%text_color%">
- <font resource="font" />
- <placement x="%center_x%" y="%row4_text_y%" placement="5" />
- <text>Screen Timeout: %tw_screen_timeout_secs% seconds</text>
- </object>
-
<object type="button">
- <placement x="%col1_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>None</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=0</action>
- </object>
-
- <object type="button">
- <placement x="%col2_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>60</text>
- <image resource="medium_button" />
+ <placement x="%slidervalue_x%" y="%row3_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_false" />
<action function="set">tw_screen_timeout_secs=60</action>
</object>
<object type="button">
- <placement x="%col3_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>120</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=120</action>
- </object>
-
- <object type="button">
- <placement x="%col4_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>180</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=180</action>
- </object>
-
- <object type="text" color="%text_color%">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <font resource="font" />
- <placement x="%center_x%" y="%row12_text_y%" placement="5" />
- <text>Brightness: %tw_brightness_display%</text>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col1_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>25%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_25% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=25%</action>
- <action function="set">tw_brightness=%tw_brightness_25%</action>
- </actions>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col2_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>50%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_50% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=50%</action>
- <action function="set">tw_brightness=%tw_brightness_50%</action>
- </actions>
+ <placement x="%slidervalue_x%" y="%row3_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_true" />
+ <action function="set">tw_screen_timeout_secs=0</action>
</object>
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col3_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>75%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_75% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=75%</action>
- <action function="set">tw_brightness=%tw_brightness_75%</action>
- </actions>
+ <object type="slidervalue">
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <placement x="slidervalue_x" y="%row5_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Screen timeout in seconds:</text>
+ <data variable="tw_screen_timeout_secs" min="15" max="300" />
</object>
- <object type="button">
+ <object type="slidervalue">
<condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col4_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>100%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_100% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=100%</action>
- <action function="set">tw_brightness=%tw_brightness_100%</action>
+ <placement x="slidervalue_x" y="%row12_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Brightness: %tw_brightness_pct%%</text>
+ <data variable="tw_brightness_pct" min="10" max="100" />
+ <actions>
+ <action function="set">tw_brightness=%tw_brightness_max%</action>
+ <action function="compute">tw_brightness*%tw_brightness_pct%</action>
+ <action function="compute">tw_brightness/100</action>
+ <action function="cmd">echo %tw_brightness% > &quot;%tw_brightness_file%&quot;</action>
</actions>
</object>
diff --git a/gui/devices/1080x1920/res/ui.xml b/gui/devices/1080x1920/res/ui.xml
index 93d539ca0..625cad83d 100644
--- a/gui/devices/1080x1920/res/ui.xml
+++ b/gui/devices/1080x1920/res/ui.xml
@@ -182,6 +182,13 @@
<variable name="storage_list_height" value="1313" />
<variable name="wipe_list_height" value="1305" />
<variable name="wipe_button_y" value="975" />
+ <variable name="slidervalue_w" value="1060" />
+ <variable name="slidervalue_line_clr" value="#FFFFFF" />
+ <variable name="slidervalue_slider_clr" value="#33B5E5" />
+ <variable name="slidervalue_lineh" value="3" />
+ <variable name="slidervalue_padding" value="30" />
+ <variable name="slidervalue_sliderw" value="15" />
+ <variable name="slidervalue_sliderh" value="90" />
</variables>
<templates>
@@ -2266,100 +2273,47 @@
<text>Screen Settings</text>
</object>
- <object type="text" color="%text_color%">
- <font resource="font" />
- <placement x="%center_x%" y="%row3_text_y%" placement="5" />
- <text>Screen Timeout: %tw_screen_timeout_secs% seconds</text>
- </object>
-
<object type="button">
- <placement x="%col1_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>None</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=0</action>
- </object>
-
- <object type="button">
- <placement x="%col2_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>60</text>
- <image resource="medium_button" />
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_false" />
<action function="set">tw_screen_timeout_secs=60</action>
</object>
<object type="button">
- <placement x="%col3_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>120</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=120</action>
- </object>
-
- <object type="button">
- <placement x="%col4_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>180</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=180</action>
- </object>
-
- <object type="text" color="%text_color%">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <font resource="font" />
- <placement x="%center_x%" y="%row12_text_y%" placement="5" />
- <text>Brightness: %tw_brightness_display%</text>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col1_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>25%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_25% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=25%</action>
- <action function="set">tw_brightness=%tw_brightness_25%</action>
- </actions>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col2_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>50%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_50% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=50%</action>
- <action function="set">tw_brightness=%tw_brightness_50%</action>
- </actions>
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_true" />
+ <action function="set">tw_screen_timeout_secs=0</action>
</object>
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col3_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>75%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_75% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=75%</action>
- <action function="set">tw_brightness=%tw_brightness_75%</action>
- </actions>
+ <object type="slidervalue">
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Screen timeout in seconds:</text>
+ <data variable="tw_screen_timeout_secs" min="15" max="300" />
</object>
- <object type="button">
+ <object type="slidervalue">
<condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col4_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>100%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_100% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=100%</action>
- <action function="set">tw_brightness=%tw_brightness_100%</action>
+ <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Brightness: %tw_brightness_pct%%</text>
+ <data variable="tw_brightness_pct" min="10" max="100" />
+ <actions>
+ <action function="set">tw_brightness=%tw_brightness_max%</action>
+ <action function="compute">tw_brightness*%tw_brightness_pct%</action>
+ <action function="compute">tw_brightness/100</action>
+ <action function="cmd">echo %tw_brightness% > &quot;%tw_brightness_file%&quot;</action>
</actions>
</object>
diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml
index 5ba47009e..3ffa79dee 100644
--- a/gui/devices/1280x800/res/ui.xml
+++ b/gui/devices/1280x800/res/ui.xml
@@ -197,6 +197,14 @@
<variable name="mount_storage_row" value="550" />
<variable name="wipe_list_height" value="420" />
<variable name="wipe_button_y" value="250" />
+ <variable name="slidervalue_x" value="320" />
+ <variable name="slidervalue_w" value="640" />
+ <variable name="slidervalue_line_clr" value="#FFFFFF" />
+ <variable name="slidervalue_slider_clr" value="#33B5E5" />
+ <variable name="slidervalue_lineh" value="2" />
+ <variable name="slidervalue_padding" value="0" />
+ <variable name="slidervalue_sliderw" value="15" />
+ <variable name="slidervalue_sliderh" value="60" />
</variables>
<templates>
@@ -2289,100 +2297,47 @@
<text>Screen Settings</text>
</object>
- <object type="text" color="%text_color%">
- <font resource="font" />
- <placement x="%center_x%" y="%row4_text_y%" placement="5" />
- <text>Screen Timeout: %tw_screen_timeout_secs% seconds</text>
- </object>
-
<object type="button">
- <placement x="%col1_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>None</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=0</action>
- </object>
-
- <object type="button">
- <placement x="%col2_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>60</text>
- <image resource="medium_button" />
+ <placement x="%slidervalue_x%" y="%row3_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_false" />
<action function="set">tw_screen_timeout_secs=60</action>
</object>
<object type="button">
- <placement x="%col3_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>120</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=120</action>
- </object>
-
- <object type="button">
- <placement x="%col4_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>180</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=180</action>
- </object>
-
- <object type="text" color="%text_color%">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <font resource="font" />
- <placement x="%center_x%" y="%row12_text_y%" placement="5" />
- <text>Brightness: %tw_brightness_display%</text>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col1_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>25%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_25% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=25%</action>
- <action function="set">tw_brightness=%tw_brightness_25%</action>
- </actions>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col2_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>50%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_50% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=50%</action>
- <action function="set">tw_brightness=%tw_brightness_50%</action>
- </actions>
+ <placement x="%slidervalue_x%" y="%row3_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_true" />
+ <action function="set">tw_screen_timeout_secs=0</action>
</object>
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col3_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>75%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_75% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=75%</action>
- <action function="set">tw_brightness=%tw_brightness_75%</action>
- </actions>
+ <object type="slidervalue">
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <placement x="slidervalue_x" y="%row5_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Screen timeout in seconds:</text>
+ <data variable="tw_screen_timeout_secs" min="15" max="300" />
</object>
- <object type="button">
+ <object type="slidervalue">
<condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col4_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>100%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_100% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=100%</action>
- <action function="set">tw_brightness=%tw_brightness_100%</action>
+ <placement x="slidervalue_x" y="%row12_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Brightness: %tw_brightness_pct%%</text>
+ <data variable="tw_brightness_pct" min="10" max="100" />
+ <actions>
+ <action function="set">tw_brightness=%tw_brightness_max%</action>
+ <action function="compute">tw_brightness*%tw_brightness_pct%</action>
+ <action function="compute">tw_brightness/100</action>
+ <action function="cmd">echo %tw_brightness% > &quot;%tw_brightness_file%&quot;</action>
</actions>
</object>
diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml
index 935080ae6..af9aba6a7 100644
--- a/gui/devices/1920x1200/res/ui.xml
+++ b/gui/devices/1920x1200/res/ui.xml
@@ -197,6 +197,14 @@
<variable name="mount_storage_row" value="850" />
<variable name="wipe_list_height" value="850" />
<variable name="wipe_button_y" value="375" />
+ <variable name="slidervalue_x" value="540" />
+ <variable name="slidervalue_w" value="960" />
+ <variable name="slidervalue_line_clr" value="#FFFFFF" />
+ <variable name="slidervalue_slider_clr" value="#33B5E5" />
+ <variable name="slidervalue_lineh" value="3" />
+ <variable name="slidervalue_padding" value="0" />
+ <variable name="slidervalue_sliderw" value="20" />
+ <variable name="slidervalue_sliderh" value="80" />
</variables>
<templates>
@@ -2289,100 +2297,47 @@
<text>Screen Settings</text>
</object>
- <object type="text" color="%text_color%">
- <font resource="font" />
- <placement x="%center_x%" y="%row4_text_y%" placement="5" />
- <text>Screen Timeout: %tw_screen_timeout_secs% seconds</text>
- </object>
-
<object type="button">
- <placement x="%col1_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>None</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=0</action>
- </object>
-
- <object type="button">
- <placement x="%col2_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>60</text>
- <image resource="medium_button" />
+ <placement x="%slidervalue_x%" y="%row3_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_false" />
<action function="set">tw_screen_timeout_secs=60</action>
</object>
<object type="button">
- <placement x="%col3_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>120</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=120</action>
- </object>
-
- <object type="button">
- <placement x="%col4_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>180</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=180</action>
- </object>
-
- <object type="text" color="%text_color%">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <font resource="font" />
- <placement x="%center_x%" y="%row12_text_y%" placement="5" />
- <text>Brightness: %tw_brightness_display%</text>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col1_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>25%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_25% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=25%</action>
- <action function="set">tw_brightness=%tw_brightness_25%</action>
- </actions>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col2_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>50%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_50% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=50%</action>
- <action function="set">tw_brightness=%tw_brightness_50%</action>
- </actions>
+ <placement x="%slidervalue_x%" y="%row3_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_true" />
+ <action function="set">tw_screen_timeout_secs=0</action>
</object>
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col3_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>75%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_75% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=75%</action>
- <action function="set">tw_brightness=%tw_brightness_75%</action>
- </actions>
+ <object type="slidervalue">
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <placement x="slidervalue_x" y="%row5_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Screen timeout in seconds:</text>
+ <data variable="tw_screen_timeout_secs" min="15" max="300" />
</object>
- <object type="button">
+ <object type="slidervalue">
<condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col4_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>100%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_100% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=100%</action>
- <action function="set">tw_brightness=%tw_brightness_100%</action>
+ <placement x="slidervalue_x" y="%row12_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Brightness: %tw_brightness_pct%%</text>
+ <data variable="tw_brightness_pct" min="10" max="100" />
+ <actions>
+ <action function="set">tw_brightness=%tw_brightness_max%</action>
+ <action function="compute">tw_brightness*%tw_brightness_pct%</action>
+ <action function="compute">tw_brightness/100</action>
+ <action function="cmd">echo %tw_brightness% > &quot;%tw_brightness_file%&quot;</action>
</actions>
</object>
diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml
index 7c46a9944..12c032bd0 100644
--- a/gui/devices/2560x1600/res/ui.xml
+++ b/gui/devices/2560x1600/res/ui.xml
@@ -197,6 +197,14 @@
<variable name="mount_storage_row" value="1100" />
<variable name="wipe_list_height" value="1100" />
<variable name="wipe_button_y" value="500" />
+ <variable name="slidervalue_x" value="640" />
+ <variable name="slidervalue_w" value="1280" />
+ <variable name="slidervalue_line_clr" value="#FFFFFF" />
+ <variable name="slidervalue_slider_clr" value="#33B5E5" />
+ <variable name="slidervalue_lineh" value="4" />
+ <variable name="slidervalue_padding" value="0" />
+ <variable name="slidervalue_sliderw" value="30" />
+ <variable name="slidervalue_sliderh" value="90" />
</variables>
<templates>
diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml
index c85db3a23..66865a7c4 100644
--- a/gui/devices/320x480/res/ui.xml
+++ b/gui/devices/320x480/res/ui.xml
@@ -177,6 +177,13 @@
<variable name="storage_list_height" value="340" />
<variable name="wipe_list_height" value="330" />
<variable name="wipe_button_y" value="270" />
+ <variable name="slidervalue_w" value="304" />
+ <variable name="slidervalue_line_clr" value="#FFFFFF" />
+ <variable name="slidervalue_slider_clr" value="#33B5E5" />
+ <variable name="slidervalue_lineh" value="1" />
+ <variable name="slidervalue_padding" value="8" />
+ <variable name="slidervalue_sliderw" value="4" />
+ <variable name="slidervalue_sliderh" value="20" />
</variables>
<templates>
@@ -2253,100 +2260,47 @@
<text>Screen Settings</text>
</object>
- <object type="text" color="%text_color%">
- <font resource="font" />
- <placement x="%center_x%" y="%row3_text_y%" placement="5" />
- <text>Screen Timeout: %tw_screen_timeout_secs% seconds</text>
- </object>
-
<object type="button">
- <placement x="%col1_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>None</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=0</action>
- </object>
-
- <object type="button">
- <placement x="%col2_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>60</text>
- <image resource="medium_button" />
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_false" />
<action function="set">tw_screen_timeout_secs=60</action>
</object>
<object type="button">
- <placement x="%col3_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>120</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=120</action>
- </object>
-
- <object type="button">
- <placement x="%col4_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>180</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=180</action>
- </object>
-
- <object type="text" color="%text_color%">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <font resource="font" />
- <placement x="%center_x%" y="%row12_text_y%" placement="5" />
- <text>Brightness: %tw_brightness_display%</text>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col1_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>25%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_25% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=25%</action>
- <action function="set">tw_brightness=%tw_brightness_25%</action>
- </actions>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col2_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>50%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_50% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=50%</action>
- <action function="set">tw_brightness=%tw_brightness_50%</action>
- </actions>
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_true" />
+ <action function="set">tw_screen_timeout_secs=0</action>
</object>
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col3_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>75%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_75% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=75%</action>
- <action function="set">tw_brightness=%tw_brightness_75%</action>
- </actions>
+ <object type="slidervalue">
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Screen timeout in seconds:</text>
+ <data variable="tw_screen_timeout_secs" min="15" max="300" />
</object>
- <object type="button">
+ <object type="slidervalue">
<condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col4_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>100%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_100% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=100%</action>
- <action function="set">tw_brightness=%tw_brightness_100%</action>
+ <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Brightness: %tw_brightness_pct%%</text>
+ <data variable="tw_brightness_pct" min="10" max="100" />
+ <actions>
+ <action function="set">tw_brightness=%tw_brightness_max%</action>
+ <action function="compute">tw_brightness*%tw_brightness_pct%</action>
+ <action function="compute">tw_brightness/100</action>
+ <action function="cmd">echo %tw_brightness% > &quot;%tw_brightness_file%&quot;</action>
</actions>
</object>
diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml
index 6efca350c..e33e5b1dd 100644
--- a/gui/devices/480x800/res/ui.xml
+++ b/gui/devices/480x800/res/ui.xml
@@ -177,6 +177,13 @@
<variable name="storage_list_height" value="400" />
<variable name="wipe_list_height" value="550" />
<variable name="wipe_button_y" value="400" />
+ <variable name="slidervalue_w" value="460" />
+ <variable name="slidervalue_line_clr" value="#FFFFFF" />
+ <variable name="slidervalue_slider_clr" value="#33B5E5" />
+ <variable name="slidervalue_lineh" value="1" />
+ <variable name="slidervalue_padding" value="13" />
+ <variable name="slidervalue_sliderw" value="7" />
+ <variable name="slidervalue_sliderh" value="40" />
</variables>
<templates>
@@ -2253,100 +2260,47 @@
<text>Screen Settings</text>
</object>
- <object type="text" color="%text_color%">
- <font resource="font" />
- <placement x="%center_x%" y="%row3_text_y%" placement="5" />
- <text>Screen Timeout: %tw_screen_timeout_secs% seconds</text>
- </object>
-
<object type="button">
- <placement x="%col1_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>None</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=0</action>
- </object>
-
- <object type="button">
- <placement x="%col2_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>60</text>
- <image resource="medium_button" />
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_false" />
<action function="set">tw_screen_timeout_secs=60</action>
</object>
<object type="button">
- <placement x="%col3_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>120</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=120</action>
- </object>
-
- <object type="button">
- <placement x="%col4_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>180</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=180</action>
- </object>
-
- <object type="text" color="%text_color%">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <font resource="font" />
- <placement x="%center_x%" y="%row12_text_y%" placement="5" />
- <text>Brightness: %tw_brightness_display%</text>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col1_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>25%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_25% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=25%</action>
- <action function="set">tw_brightness=%tw_brightness_25%</action>
- </actions>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col2_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>50%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_50% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=50%</action>
- <action function="set">tw_brightness=%tw_brightness_50%</action>
- </actions>
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_true" />
+ <action function="set">tw_screen_timeout_secs=0</action>
</object>
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col3_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>75%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_75% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=75%</action>
- <action function="set">tw_brightness=%tw_brightness_75%</action>
- </actions>
+ <object type="slidervalue">
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Screen timeout in seconds:</text>
+ <data variable="tw_screen_timeout_secs" min="15" max="300" />
</object>
- <object type="button">
+ <object type="slidervalue">
<condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col4_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>100%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_100% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=100%</action>
- <action function="set">tw_brightness=%tw_brightness_100%</action>
+ <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Brightness: %tw_brightness_pct%%</text>
+ <data variable="tw_brightness_pct" min="10" max="100" />
+ <actions>
+ <action function="set">tw_brightness=%tw_brightness_max%</action>
+ <action function="compute">tw_brightness*%tw_brightness_pct%</action>
+ <action function="compute">tw_brightness/100</action>
+ <action function="cmd">echo %tw_brightness% > &quot;%tw_brightness_file%&quot;</action>
</actions>
</object>
diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml
index de4d15944..e4487f65c 100644
--- a/gui/devices/480x854/res/ui.xml
+++ b/gui/devices/480x854/res/ui.xml
@@ -176,6 +176,13 @@
<variable name="storage_list_height" value="400" />
<variable name="wipe_list_height" value="550" />
<variable name="wipe_button_y" value="400" />
+ <variable name="slidervalue_w" value="460" />
+ <variable name="slidervalue_line_clr" value="#FFFFFF" />
+ <variable name="slidervalue_slider_clr" value="#33B5E5" />
+ <variable name="slidervalue_lineh" value="1" />
+ <variable name="slidervalue_padding" value="13" />
+ <variable name="slidervalue_sliderw" value="7" />
+ <variable name="slidervalue_sliderh" value="40" />
</variables>
<templates>
@@ -2252,100 +2259,47 @@
<text>Screen Settings</text>
</object>
- <object type="text" color="%text_color%">
- <font resource="font" />
- <placement x="%center_x%" y="%row3_text_y%" placement="5" />
- <text>Screen Timeout: %tw_screen_timeout_secs% seconds</text>
- </object>
-
<object type="button">
- <placement x="%col1_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>None</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=0</action>
- </object>
-
- <object type="button">
- <placement x="%col2_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>60</text>
- <image resource="medium_button" />
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_false" />
<action function="set">tw_screen_timeout_secs=60</action>
</object>
<object type="button">
- <placement x="%col3_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>120</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=120</action>
- </object>
-
- <object type="button">
- <placement x="%col4_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>180</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=180</action>
- </object>
-
- <object type="text" color="%text_color%">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <font resource="font" />
- <placement x="%center_x%" y="%row12_text_y%" placement="5" />
- <text>Brightness: %tw_brightness_display%</text>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col1_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>25%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_25% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=25%</action>
- <action function="set">tw_brightness=%tw_brightness_25%</action>
- </actions>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col2_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>50%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_50% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=50%</action>
- <action function="set">tw_brightness=%tw_brightness_50%</action>
- </actions>
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_true" />
+ <action function="set">tw_screen_timeout_secs=0</action>
</object>
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col3_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>75%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_75% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=75%</action>
- <action function="set">tw_brightness=%tw_brightness_75%</action>
- </actions>
+ <object type="slidervalue">
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Screen timeout in seconds:</text>
+ <data variable="tw_screen_timeout_secs" min="15" max="300" />
</object>
- <object type="button">
+ <object type="slidervalue">
<condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col4_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>100%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_100% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=100%</action>
- <action function="set">tw_brightness=%tw_brightness_100%</action>
+ <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Brightness: %tw_brightness_pct%%</text>
+ <data variable="tw_brightness_pct" min="10" max="100" />
+ <actions>
+ <action function="set">tw_brightness=%tw_brightness_max%</action>
+ <action function="compute">tw_brightness*%tw_brightness_pct%</action>
+ <action function="compute">tw_brightness/100</action>
+ <action function="cmd">echo %tw_brightness% > &quot;%tw_brightness_file%&quot;</action>
</actions>
</object>
diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml
index febc3db14..6ea2e1c64 100644
--- a/gui/devices/540x960/res/ui.xml
+++ b/gui/devices/540x960/res/ui.xml
@@ -177,6 +177,13 @@
<variable name="storage_list_height" value="675" />
<variable name="wipe_list_height" value="670" />
<variable name="wipe_button_y" value="475" />
+ <variable name="slidervalue_w" value="520" />
+ <variable name="slidervalue_line_clr" value="#FFFFFF" />
+ <variable name="slidervalue_slider_clr" value="#33B5E5" />
+ <variable name="slidervalue_lineh" value="2" />
+ <variable name="slidervalue_padding" value="15" />
+ <variable name="slidervalue_sliderw" value="8" />
+ <variable name="slidervalue_sliderh" value="45" />
</variables>
<templates>
@@ -2253,100 +2260,47 @@
<text>Screen Settings</text>
</object>
- <object type="text" color="%text_color%">
- <font resource="font" />
- <placement x="%center_x%" y="%row3_text_y%" placement="5" />
- <text>Screen Timeout: %tw_screen_timeout_secs% seconds</text>
- </object>
-
<object type="button">
- <placement x="%col1_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>None</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=0</action>
- </object>
-
- <object type="button">
- <placement x="%col2_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>60</text>
- <image resource="medium_button" />
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_false" />
<action function="set">tw_screen_timeout_secs=60</action>
</object>
<object type="button">
- <placement x="%col3_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>120</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=120</action>
- </object>
-
- <object type="button">
- <placement x="%col4_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>180</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=180</action>
- </object>
-
- <object type="text" color="%text_color%">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <font resource="font" />
- <placement x="%center_x%" y="%row12_text_y%" placement="5" />
- <text>Brightness: %tw_brightness_display%</text>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col1_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>25%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_25% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=25%</action>
- <action function="set">tw_brightness=%tw_brightness_25%</action>
- </actions>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col2_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>50%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_50% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=50%</action>
- <action function="set">tw_brightness=%tw_brightness_50%</action>
- </actions>
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_true" />
+ <action function="set">tw_screen_timeout_secs=0</action>
</object>
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col3_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>75%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_75% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=75%</action>
- <action function="set">tw_brightness=%tw_brightness_75%</action>
- </actions>
+ <object type="slidervalue">
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Screen timeout in seconds:</text>
+ <data variable="tw_screen_timeout_secs" min="15" max="300" />
</object>
- <object type="button">
+ <object type="slidervalue">
<condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col4_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>100%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_100% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=100%</action>
- <action function="set">tw_brightness=%tw_brightness_100%</action>
+ <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Brightness: %tw_brightness_pct%%</text>
+ <data variable="tw_brightness_pct" min="10" max="100" />
+ <actions>
+ <action function="set">tw_brightness=%tw_brightness_max%</action>
+ <action function="compute">tw_brightness*%tw_brightness_pct%</action>
+ <action function="compute">tw_brightness/100</action>
+ <action function="cmd">echo %tw_brightness% > &quot;%tw_brightness_file%&quot;</action>
</actions>
</object>
diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml
index e2a02b1e8..d43aae95d 100644
--- a/gui/devices/720x1280/res/ui.xml
+++ b/gui/devices/720x1280/res/ui.xml
@@ -182,6 +182,13 @@
<variable name="storage_list_height" value="875" />
<variable name="wipe_list_height" value="870" />
<variable name="wipe_button_y" value="650" />
+ <variable name="slidervalue_w" value="700" />
+ <variable name="slidervalue_line_clr" value="#FFFFFF" />
+ <variable name="slidervalue_slider_clr" value="#33B5E5" />
+ <variable name="slidervalue_lineh" value="2" />
+ <variable name="slidervalue_padding" value="20" />
+ <variable name="slidervalue_sliderw" value="10" />
+ <variable name="slidervalue_sliderh" value="60" />
</variables>
<templates>
@@ -2266,100 +2273,47 @@
<text>Screen Settings</text>
</object>
- <object type="text" color="%text_color%">
- <font resource="font" />
- <placement x="%center_x%" y="%row3_text_y%" placement="5" />
- <text>Screen Timeout: %tw_screen_timeout_secs% seconds</text>
- </object>
-
<object type="button">
- <placement x="%col1_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>None</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=0</action>
- </object>
-
- <object type="button">
- <placement x="%col2_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>60</text>
- <image resource="medium_button" />
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_false" />
<action function="set">tw_screen_timeout_secs=60</action>
</object>
<object type="button">
- <placement x="%col3_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>120</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=120</action>
- </object>
-
- <object type="button">
- <placement x="%col4_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>180</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=180</action>
- </object>
-
- <object type="text" color="%text_color%">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <font resource="font" />
- <placement x="%center_x%" y="%row12_text_y%" placement="5" />
- <text>Brightness: %tw_brightness_display%</text>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col1_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>25%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_25% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=25%</action>
- <action function="set">tw_brightness=%tw_brightness_25%</action>
- </actions>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col2_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>50%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_50% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=50%</action>
- <action function="set">tw_brightness=%tw_brightness_50%</action>
- </actions>
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_true" />
+ <action function="set">tw_screen_timeout_secs=0</action>
</object>
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col3_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>75%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_75% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=75%</action>
- <action function="set">tw_brightness=%tw_brightness_75%</action>
- </actions>
+ <object type="slidervalue">
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Screen timeout in seconds:</text>
+ <data variable="tw_screen_timeout_secs" min="15" max="300" />
</object>
- <object type="button">
+ <object type="slidervalue">
<condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col4_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>100%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_100% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=100%</action>
- <action function="set">tw_brightness=%tw_brightness_100%</action>
+ <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Brightness: %tw_brightness_pct%%</text>
+ <data variable="tw_brightness_pct" min="10" max="100" />
+ <actions>
+ <action function="set">tw_brightness=%tw_brightness_max%</action>
+ <action function="compute">tw_brightness*%tw_brightness_pct%</action>
+ <action function="compute">tw_brightness/100</action>
+ <action function="cmd">echo %tw_brightness% > &quot;%tw_brightness_file%&quot;</action>
</actions>
</object>
diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml
index 7282c929b..f7226f0fa 100755
--- a/gui/devices/800x1280/res/ui.xml
+++ b/gui/devices/800x1280/res/ui.xml
@@ -178,6 +178,13 @@
<variable name="storage_list_height" value="875" />
<variable name="wipe_list_height" value="870" />
<variable name="wipe_button_y" value="650" />
+ <variable name="slidervalue_w" value="780" />
+ <variable name="slidervalue_line_clr" value="#FFFFFF" />
+ <variable name="slidervalue_slider_clr" value="#33B5E5" />
+ <variable name="slidervalue_lineh" value="2" />
+ <variable name="slidervalue_padding" value="20" />
+ <variable name="slidervalue_sliderw" value="10" />
+ <variable name="slidervalue_sliderh" value="60" />
</variables>
<templates>
@@ -2254,100 +2261,47 @@
<text>Screen Settings</text>
</object>
- <object type="text" color="%text_color%">
- <font resource="font" />
- <placement x="%center_x%" y="%row3_text_y%" placement="5" />
- <text>Screen Timeout: %tw_screen_timeout_secs% seconds</text>
- </object>
-
<object type="button">
- <placement x="%col1_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>None</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=0</action>
- </object>
-
- <object type="button">
- <placement x="%col2_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>60</text>
- <image resource="medium_button" />
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_false" />
<action function="set">tw_screen_timeout_secs=60</action>
</object>
<object type="button">
- <placement x="%col3_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>120</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=120</action>
- </object>
-
- <object type="button">
- <placement x="%col4_medium_x%" y="%row2_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>180</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=180</action>
- </object>
-
- <object type="text" color="%text_color%">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <font resource="font" />
- <placement x="%center_x%" y="%row12_text_y%" placement="5" />
- <text>Brightness: %tw_brightness_display%</text>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col1_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>25%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_25% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=25%</action>
- <action function="set">tw_brightness=%tw_brightness_25%</action>
- </actions>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col2_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>50%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_50% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=50%</action>
- <action function="set">tw_brightness=%tw_brightness_50%</action>
- </actions>
+ <placement x="%col1_x%" y="%row2_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_true" />
+ <action function="set">tw_screen_timeout_secs=0</action>
</object>
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col3_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>75%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_75% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=75%</action>
- <action function="set">tw_brightness=%tw_brightness_75%</action>
- </actions>
+ <object type="slidervalue">
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Screen timeout in seconds:</text>
+ <data variable="tw_screen_timeout_secs" min="15" max="300" />
</object>
- <object type="button">
+ <object type="slidervalue">
<condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col4_medium_x%" y="%row4_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>100%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_100% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=100%</action>
- <action function="set">tw_brightness=%tw_brightness_100%</action>
+ <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Brightness: %tw_brightness_pct%%</text>
+ <data variable="tw_brightness_pct" min="10" max="100" />
+ <actions>
+ <action function="set">tw_brightness=%tw_brightness_max%</action>
+ <action function="compute">tw_brightness*%tw_brightness_pct%</action>
+ <action function="compute">tw_brightness/100</action>
+ <action function="cmd">echo %tw_brightness% > &quot;%tw_brightness_file%&quot;</action>
</actions>
</object>
diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml
index 97fdf44cd..bb324dffd 100755
--- a/gui/devices/800x480/res/ui.xml
+++ b/gui/devices/800x480/res/ui.xml
@@ -197,6 +197,14 @@
<variable name="mount_storage_row" value="500" />
<variable name="wipe_list_height" value="300" />
<variable name="wipe_button_y" value="150" />
+ <variable name="slidervalue_x" value="200" />
+ <variable name="slidervalue_w" value="400" />
+ <variable name="slidervalue_line_clr" value="#FFFFFF" />
+ <variable name="slidervalue_slider_clr" value="#33B5E5" />
+ <variable name="slidervalue_lineh" value="1" />
+ <variable name="slidervalue_padding" value="0" />
+ <variable name="slidervalue_sliderw" value="7" />
+ <variable name="slidervalue_sliderh" value="40" />
</variables>
<templates>
@@ -2297,100 +2305,47 @@
<text>Screen Settings</text>
</object>
- <object type="text" color="%text_color%">
- <font resource="font" />
- <placement x="%center_x%" y="%row4_text_y%" placement="5" />
- <text>Screen Timeout: %tw_screen_timeout_secs% seconds</text>
- </object>
-
<object type="button">
- <placement x="%col1_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>None</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=0</action>
- </object>
-
- <object type="button">
- <placement x="%col2_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>60</text>
- <image resource="medium_button" />
+ <placement x="%slidervalue_x%" y="%row3_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_false" />
<action function="set">tw_screen_timeout_secs=60</action>
</object>
<object type="button">
- <placement x="%col3_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>120</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=120</action>
- </object>
-
- <object type="button">
- <placement x="%col4_medium_x%" y="%row2_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>180</text>
- <image resource="medium_button" />
- <action function="set">tw_screen_timeout_secs=180</action>
- </object>
-
- <object type="text" color="%text_color%">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <font resource="font" />
- <placement x="%center_x%" y="%row12_text_y%" placement="5" />
- <text>Brightness: %tw_brightness_display%</text>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col1_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>25%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_25% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=25%</action>
- <action function="set">tw_brightness=%tw_brightness_25%</action>
- </actions>
- </object>
-
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col2_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>50%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_50% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=50%</action>
- <action function="set">tw_brightness=%tw_brightness_50%</action>
- </actions>
+ <placement x="%slidervalue_x%" y="%row3_text_y%" />
+ <font resource="font" color="%text_color%" />
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <text>Enable screen timeout.</text>
+ <image resource="checkbox_true" />
+ <action function="set">tw_screen_timeout_secs=0</action>
</object>
- <object type="button">
- <condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col3_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>75%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_75% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=75%</action>
- <action function="set">tw_brightness=%tw_brightness_75%</action>
- </actions>
+ <object type="slidervalue">
+ <condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
+ <placement x="slidervalue_x" y="%row5_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Screen timeout in seconds:</text>
+ <data variable="tw_screen_timeout_secs" min="15" max="300" />
</object>
- <object type="button">
+ <object type="slidervalue">
<condition var1="tw_has_brightnesss_file" var2="1" />
- <placement x="%col4_medium_x%" y="%row4_medium_y%" />
- <font resource="font" color="%button_text_color%" />
- <text>100%</text>
- <image resource="medium_button" />
- <actions>
- <action function="cmd">echo %tw_brightness_100% > &quot;%tw_brightness_file%&quot;</action>
- <action function="set">tw_brightness_display=100%</action>
- <action function="set">tw_brightness=%tw_brightness_100%</action>
+ <placement x="slidervalue_x" y="%row12_text_y%" w="%slidervalue_w%" />
+ <font resource="font" color="%text_color%" />
+ <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
+ <dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
+ <text>Brightness: %tw_brightness_pct%%</text>
+ <data variable="tw_brightness_pct" min="10" max="100" />
+ <actions>
+ <action function="set">tw_brightness=%tw_brightness_max%</action>
+ <action function="compute">tw_brightness*%tw_brightness_pct%</action>
+ <action function="compute">tw_brightness/100</action>
+ <action function="cmd">echo %tw_brightness% > &quot;%tw_brightness_file%&quot;</action>
</actions>
</object>
diff --git a/gui/objects.hpp b/gui/objects.hpp
index 973c3cfe9..ff5429a9c 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -909,6 +909,72 @@ public:
virtual int KeyRepeat(void);
};
+class GUISliderValue: public RenderObject, public ActionObject, public Conditional
+{
+public:
+ GUISliderValue(xml_node<>* node);
+ virtual ~GUISliderValue();
+
+public:
+ // Render - Render the full object to the GL surface
+ // Return 0 on success, <0 on error
+ virtual int Render(void);
+
+ // Update - Update any UI component animations (called <= 30 FPS)
+ // Return 0 if nothing to update, 1 on success and contiue, >1 if full render required, and <0 on error
+ virtual int Update(void);
+
+ // SetPos - Update the position of the render object
+ // Return 0 on success, <0 on error
+ virtual int SetRenderPos(int x, int y, int w = 0, int h = 0);
+
+ // NotifyTouch - Notify of a touch event
+ // Return 0 on success, >0 to ignore remainder of touch, and <0 on error
+ virtual int NotifyTouch(TOUCH_STATE state, int x, int y);
+
+ // Notify of a variable change
+ virtual int NotifyVarChange(std::string varName, std::string value);
+
+ // SetPageFocus - Notify when a page gains or loses focus
+ virtual void SetPageFocus(int inFocus);
+
+protected:
+ int measureText(const std::string& str);
+ int valueFromPct(float pct);
+ float pctFromValue(int value);
+ void loadValue(bool force = false);
+
+ std::string mVariable;
+ int mMax;
+ int mMin;
+ int mValue;
+ char *mValueStr;
+ float mValuePct;
+ std::string mMaxStr;
+ std::string mMinStr;
+ Resource *mFont;
+ GUIText* mLabel;
+ int mLabelW;
+ COLOR mTextColor;
+ COLOR mLineColor;
+ COLOR mSliderColor;
+ bool mShowRange;
+ bool mShowCurr;
+ int mLineX;
+ int mLineY;
+ int mLineH;
+ int mLinePadding;
+ int mPadding;
+ int mSliderY;
+ int mSliderW;
+ int mSliderH;
+ bool mRendered;
+ int mFontHeight;
+ GUIAction *mAction;
+ bool mChangeOnDrag;
+ int lineW;
+};
+
// Helper APIs
bool LoadPlacement(xml_node<>* node, int* x, int* y, int* w = NULL, int* h = NULL, RenderObject::Placement* placement = NULL);
diff --git a/gui/pages.cpp b/gui/pages.cpp
index bf44b3856..11fe9b080 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -273,6 +273,12 @@ bool Page::ProcessNode(xml_node<>* page, xml_node<>* templates /* = NULL */, int
mRenders.push_back(element);
mActions.push_back(element);
}
+ else if (type == "slidervalue")
+ {
+ GUISliderValue *element = new GUISliderValue(child);
+ mRenders.push_back(element);
+ mActions.push_back(element);
+ }
else if (type == "listbox")
{
GUIListBox* element = new GUIListBox(child);
diff --git a/gui/slidervalue.cpp b/gui/slidervalue.cpp
new file mode 100644
index 000000000..d369aceb9
--- /dev/null
+++ b/gui/slidervalue.cpp
@@ -0,0 +1,418 @@
+// slidervalue.cpp - GUISliderValue object
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/reboot.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <time.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <string>
+
+extern "C" {
+#include "../twcommon.h"
+#include "../minuitwrp/minui.h"
+}
+
+#include "rapidxml.hpp"
+#include "objects.hpp"
+
+GUISliderValue::GUISliderValue(xml_node<>* node) : Conditional(node)
+{
+ xml_attribute<>* attr;
+ xml_node<>* child;
+
+ mMin = 0;
+ mMax = 100;
+ mValue = 0;
+ mLineH = 2;
+ mLinePadding = 10;
+ mSliderW = 5;
+ mSliderH = 30;
+ mLineX = 0;
+ mLineY = 0;
+ mValueStr = NULL;
+ mAction = NULL;
+ mShowCurr = true;
+ mShowRange = false;
+ mChangeOnDrag = false;
+ mRendered = false;
+
+ mLabel = NULL;
+ ConvertStrToColor("white", &mTextColor);
+ ConvertStrToColor("white", &mLineColor);
+ ConvertStrToColor("blue", &mSliderColor);
+
+ if (!node)
+ {
+ LOGERR("GUISliderValue created without XML node\n");
+ return;
+ }
+
+ mLabel = new GUIText(node);
+ if(mLabel->Render() < 0)
+ {
+ delete mLabel;
+ mLabel = NULL;
+ }
+
+ mAction = new GUIAction(node);
+
+ child = node->first_node("font");
+ if (child)
+ {
+ attr = child->first_attribute("resource");
+ if (attr)
+ mFont = PageManager::FindResource(attr->value());
+
+ attr = child->first_attribute("color");
+ if (attr)
+ {
+ std::string color = attr->value();
+ ConvertStrToColor(color, &mTextColor);
+ }
+ }
+
+ // Load the placement
+ LoadPlacement(node->first_node("placement"), &mRenderX, &mRenderY, &mRenderW);
+
+ child = node->first_node("colors");
+ if (child)
+ {
+ attr = child->first_attribute("line");
+ if (attr)
+ ConvertStrToColor(attr->value(), &mLineColor);
+
+ attr = child->first_attribute("slider");
+ if (attr)
+ ConvertStrToColor(attr->value(), &mSliderColor);
+ }
+
+ child = node->first_node("data");
+ if (child)
+ {
+ attr = child->first_attribute("variable");
+ if (attr)
+ mVariable = attr->value();
+
+ attr = child->first_attribute("min");
+ if (attr)
+ {
+ mMinStr = gui_parse_text(attr->value());
+ mMin = atoi(mMinStr.c_str());
+ }
+
+ attr = child->first_attribute("max");
+ if (attr)
+ {
+ mMaxStr = gui_parse_text(attr->value());
+ mMax = atoi(mMaxStr.c_str());
+ }
+
+ if (mMin > mMax)
+ mMin = mMax;
+
+ attr = child->first_attribute("default");
+ if (attr)
+ {
+ string parsevalue = gui_parse_text(attr->value());
+ int def = atoi(parsevalue.c_str());
+
+ if (def < mMin) def = mMin;
+ else if (def > mMax) def = mMax;
+ DataManager::SetValue(mVariable, def);
+ }
+
+ attr = child->first_attribute("showrange");
+ if (attr)
+ mShowRange = atoi(attr->value());
+
+ attr = child->first_attribute("showcurr");
+ if (attr)
+ mShowCurr = atoi(attr->value());
+
+ attr = child->first_attribute("changeondrag");
+ if (attr)
+ mChangeOnDrag = atoi(attr->value());
+ }
+
+ child = node->first_node("dimensions");
+ if (child)
+ {
+ attr = child->first_attribute("lineh");
+ if (attr)
+ {
+ string parsevalue = gui_parse_text(attr->value());
+ mLineH = atoi(parsevalue.c_str());
+ }
+
+ attr = child->first_attribute("linepadding");
+ if (attr)
+ {
+ string parsevalue = gui_parse_text(attr->value());
+ mPadding = atoi(parsevalue.c_str());
+ }
+
+ attr = child->first_attribute("sliderw");
+ if (attr)
+ {
+ string parsevalue = gui_parse_text(attr->value());
+ mSliderW = atoi(parsevalue.c_str());
+ }
+
+ attr = child->first_attribute("sliderh");
+ if (attr)
+ {
+ string parsevalue = gui_parse_text(attr->value());
+ mSliderH = atoi(parsevalue.c_str());
+ }
+ }
+
+ gr_getFontDetails(mFont ? mFont->GetResource() : NULL, (unsigned*) &mFontHeight, NULL);
+
+ if(mShowCurr)
+ {
+ int maxLen = std::max(strlen(mMinStr.c_str()), strlen(mMaxStr.c_str()));
+ mValueStr = new char[maxLen+1];
+ }
+
+ loadValue(true);
+
+ mLinePadding = mPadding;
+ if (mShowRange)
+ {
+ int textW = std::max(measureText(mMaxStr), measureText(mMinStr));
+ mLinePadding += textW;
+ }
+
+ SetRenderPos(mRenderX, mRenderY, mRenderW);
+}
+
+GUISliderValue::~GUISliderValue()
+{
+ delete mLabel;
+ delete mAction;
+ delete[] mValueStr;
+}
+
+void GUISliderValue::loadValue(bool force)
+{
+ if(!mVariable.empty())
+ {
+ int value = DataManager::GetIntValue(mVariable);
+ if(mValue == value && !force)
+ return;
+
+ mValue = value;
+ }
+
+ mValue = std::max(mValue, mMin);
+ mValue = std::min(mValue, mMax);
+ mValuePct = pctFromValue(mValue);
+ mRendered = false;
+}
+
+int GUISliderValue::SetRenderPos(int x, int y, int w, int h)
+{
+ mRenderX = x;
+ mRenderY = y;
+ if (w || h)
+ {
+ mRenderW = w;
+ mRenderH = h;
+ }
+
+ mRenderH = mSliderH;
+ if(mShowCurr)
+ mRenderH += mFontHeight;
+
+ if (mLabel)
+ {
+ int lw, lh;
+ mLabel->GetCurrentBounds(lw, lh);
+ int textX = mRenderX + (mRenderW/2 - lw/2);
+
+ mLabel->SetRenderPos(textX, mRenderY);
+
+ y += lh;
+ mRenderH += lh;
+ }
+
+ mSliderY = y;
+ mLineY = (y + mSliderH/2) - (mLineH/2);
+
+ mLineX = mRenderX + mLinePadding;
+
+ mActionX = mRenderX;
+ mActionY = mRenderY;
+ mActionW = mRenderW;
+ mActionH = mRenderH;
+ lineW = mRenderW - (mLinePadding * 2);
+
+ return 0;
+}
+
+int GUISliderValue::measureText(const std::string& str)
+{
+ void* fontResource = NULL;
+ if (mFont) fontResource = mFont->GetResource();
+
+ return gr_measureEx(str.c_str(), fontResource);
+}
+
+int GUISliderValue::Render(void)
+{
+ if (!isConditionTrue())
+ {
+ mRendered = false;
+ return 0;
+ }
+
+ if(mLabel)
+ {
+ int w, h;
+ mLabel->GetCurrentBounds(w, h);
+ if (w != mLabelW) {
+ mLabelW = w;
+ int textX = mRenderX + (mRenderW/2 - mLabelW/2);
+ mLabel->SetRenderPos(textX, mRenderY);
+ }
+ int res = mLabel->Render();
+ if(res < 0)
+ return res;
+ }
+
+ // line
+ gr_color(mLineColor.red, mLineColor.green, mLineColor.blue, mLineColor.alpha);
+ gr_fill(mLineX, mLineY, lineW, mLineH);
+
+ // slider
+ uint32_t sliderX = (mValuePct*lineW)/100 + mLineX;
+ sliderX -= mSliderW/2;
+
+ gr_color(mSliderColor.red, mSliderColor.green, mSliderColor.blue, mSliderColor.alpha);
+ gr_fill(sliderX, mSliderY, mSliderW, mSliderH);
+
+ void *fontResource = NULL;
+ if(mFont) fontResource = mFont->GetResource();
+ gr_color(mTextColor.red, mTextColor.green, mTextColor.blue, mTextColor.alpha);
+ if(mShowRange)
+ {
+ int rangeY = (mLineY - mLineH/2) - mFontHeight/2;
+ gr_textEx(mRenderX + mPadding/2, rangeY, mMinStr.c_str(), fontResource);
+ gr_textEx(mLineX + lineW + mPadding/2, rangeY, mMaxStr.c_str(), fontResource);
+ }
+
+ if(mValueStr && mShowCurr)
+ {
+ sprintf(mValueStr, "%d", mValue);
+ int textW = measureText(mValueStr);
+ gr_textEx(mRenderX + (mRenderW/2 - textW/2), mSliderY+mSliderH, mValueStr, fontResource);
+ }
+
+ mRendered = true;
+ return 0;
+}
+
+int GUISliderValue::Update(void)
+{
+ if (!isConditionTrue()) return mRendered ? 2 : 0;
+ if (!mRendered) return 2;
+
+ if(mLabel)
+ return mLabel->Update();
+ return 0;
+}
+
+int GUISliderValue::valueFromPct(float pct)
+{
+ int range = abs(mMax - mMin);
+ return mMin + (pct * range) / 100;
+}
+
+float GUISliderValue::pctFromValue(int value)
+{
+ return float((value - mMin) * 100) / abs(mMax - mMin);
+}
+
+int GUISliderValue::NotifyTouch(TOUCH_STATE state, int x, int y)
+{
+ if (!isConditionTrue()) return -1;
+
+ static bool dragging = false;
+ switch (state)
+ {
+ case TOUCH_START:
+ if (x >= mRenderX && x <= mRenderX + mRenderW &&
+ y >= mRenderY && y <= mRenderY + mRenderH)
+ {
+ dragging = true;
+ }
+ // no break
+ case TOUCH_DRAG:
+ {
+ if (!dragging) return 0;
+
+ x = std::max(mLineX, x);
+ x = std::min(mLineX + lineW, x);
+
+ mValuePct = float(((x - mLineX) * 100) / lineW);
+ int newVal = valueFromPct(mValuePct);
+ if (newVal != mValue) {
+ mRendered = false;
+ mValue = newVal;
+ if (mChangeOnDrag) {
+ if (!mVariable.empty())
+ DataManager::SetValue(mVariable, mValue);
+ if (mAction)
+ mAction->doActions();
+ }
+ }
+ break;
+ }
+ case TOUCH_RELEASE:
+ {
+ if (!dragging) return 0;
+ dragging = false;
+
+ if (!mVariable.empty())
+ DataManager::SetValue(mVariable, mValue);
+ if (mAction)
+ mAction->doActions();
+ break;
+ }
+ case TOUCH_REPEAT:
+ case TOUCH_HOLD:
+ break;
+ }
+ return 0;
+}
+
+int GUISliderValue::NotifyVarChange(std::string varName, std::string value)
+{
+ if (mLabel)
+ mLabel->NotifyVarChange(varName, value);
+ if (varName == mVariable) {
+ int newVal = atoi(value.c_str());
+ if(newVal != mValue) {
+ mValue = newVal;
+ mValuePct = pctFromValue(mValue);
+ mRendered = false;
+ }
+ }
+ return 0;
+}
+
+void GUISliderValue::SetPageFocus(int inFocus)
+{
+ if (inFocus)
+ loadValue();
+}