diff options
42 files changed, 1303 insertions, 58 deletions
@@ -55,7 +55,7 @@ extern "C" #include "twcommon.h" #include "data.h" #include "gui/pages.h" - + #include "minuitwrp/minui.h" void gui_notifyVarChange(const char *name, const char* value); } @@ -583,6 +583,9 @@ void DataManager::SetDefaultValues() mConstValues.insert(make_pair(TW_VERSION_VAR, TW_VERSION_STR)); mValues.insert(make_pair("tw_storage_path", make_pair("/", 1))); + mValues.insert(make_pair("tw_button_vibrate", make_pair("80", 1))); + mValues.insert(make_pair("tw_keyboard_vibrate", make_pair("40", 1))); + mValues.insert(make_pair("tw_action_vibrate", make_pair("160", 1))); #ifdef TW_FORCE_CPUINFO_FOR_DEVICE_ID printf("TW_FORCE_CPUINFO_FOR_DEVICE_ID := true\n"); @@ -1240,3 +1243,11 @@ extern "C" void DataManager_ReadSettingsFile(void) { return DataManager::ReadSettingsFile(); } +void DataManager::Vibrate(const string varName) +{ + int vib_value = 0; + GetValue(varName, vib_value); + if (vib_value) { + vibrate(vib_value); + } +} @@ -55,6 +55,7 @@ public: static void DumpValues(); static void update_tz_environment_variables(); + static void Vibrate(const string varName); static void SetBackupFolder(); static void SetDefaultValues(); static void Output_Version(void); // Outputs the version to a file in the TWRP folder diff --git a/gui/Android.mk b/gui/Android.mk index ac0b2037c..29d99f7f8 100644 --- a/gui/Android.mk +++ b/gui/Android.mk @@ -22,7 +22,8 @@ LOCAL_SRC_FILES := \ keyboard.cpp \ input.cpp \ blanktimer.cpp \ - partitionlist.cpp + partitionlist.cpp \ + mousecursor.cpp ifneq ($(TWRP_CUSTOM_KEYBOARD),) LOCAL_SRC_FILES += $(TWRP_CUSTOM_KEYBOARD) diff --git a/gui/action.cpp b/gui/action.cpp index 5536c82b1..9c785d169 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -314,6 +314,7 @@ void* GUIAction::thread_start(void *cookie) void GUIAction::operation_start(const string operation_name) { + time(&Start); DataManager::SetValue(TW_ACTION_BUSY, 1); DataManager::SetValue("ui_progress", 0); DataManager::SetValue("tw_operation", operation_name); @@ -323,6 +324,7 @@ void GUIAction::operation_start(const string operation_name) void GUIAction::operation_end(const int operation_status, const int simulate) { + time_t Stop; int simulate_fail; DataManager::SetValue("ui_progress", 100); if (simulate) { @@ -344,6 +346,9 @@ void GUIAction::operation_end(const int operation_status, const int simulate) #ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); #endif + time(&Stop); + if ((int) difftime(Stop, Start) > 10) + DataManager::Vibrate("tw_action_vibrate"); } int GUIAction::doAction(Action action, int isThreaded /* = 0 */) @@ -920,6 +925,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) else { operation_end(1, simulate); return -1; + } DataManager::SetValue(TW_BACKUP_NAME, "(Auto Generate)"); } else if (arg == "restore") { diff --git a/gui/button.cpp b/gui/button.cpp index be52c277e..b14e6754c 100644 --- a/gui/button.cpp +++ b/gui/button.cpp @@ -30,6 +30,7 @@ #include <time.h> #include <unistd.h> #include <stdlib.h> +#include "../data.hpp" #include <string> @@ -280,6 +281,7 @@ int GUIButton::NotifyTouch(TOUCH_STATE state, int x, int y) } else { if (last_state == 0) { last_state = 1; + DataManager::Vibrate("tw_button_vibrate"); if (mButtonLabel != NULL) mButtonLabel->isHighlighted = true; if (mButtonImg != NULL) diff --git a/gui/devices/1024x600/res/images/cursor.png b/gui/devices/1024x600/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/1024x600/res/images/cursor.png diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml index 569a5bd1f..4597fb3a3 100755 --- a/gui/devices/1024x600/res/ui.xml +++ b/gui/devices/1024x600/res/ui.xml @@ -38,6 +38,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -205,6 +206,12 @@ <variable name="slidervalue_sliderh" value="50" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="2" /> + </mousecursor> + <templates> <template name="header"> <background color="#000000FF" /> @@ -2430,20 +2437,29 @@ <object type="button"> <highlight color="%highlight_color%" /> - <placement x="%col4_x%" y="%row2_y%" /> + <placement x="%col2_x%" y="%row2_y%" /> <font resource="font" color="%button_text_color%" /> - <text>Screen</text> + <text>Restore Defaults</text> <image resource="main_button" /> - <action function="page">screen</action> + <action function="restoredefaultsettings"></action> </object> <object type="button"> <highlight color="%highlight_color%" /> - <placement x="%col_center_x%" y="%slider_y%" /> + <placement x="%col3_x%" y="%row2_y%" /> <font resource="font" color="%button_text_color%" /> - <text>Restore Defaults</text> + <text>Vibration Duration</text> <image resource="main_button" /> - <action function="restoredefaultsettings"></action> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <highlight color="%highlight_color%" /> + <placement x="%col4_x%" y="%row2_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Screen</text> + <image resource="main_button" /> + <action function="page">screen</action> </object> <object type="action"> @@ -2652,6 +2668,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_text_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row3_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row7_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row11_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/devices/1024x768/res/images/cursor.png b/gui/devices/1024x768/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/1024x768/res/images/cursor.png diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml index 6f8797a74..84f470298 100644 --- a/gui/devices/1024x768/res/ui.xml +++ b/gui/devices/1024x768/res/ui.xml @@ -38,6 +38,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -205,6 +206,12 @@ <variable name="slidervalue_sliderh" value="50" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="2" /> + </mousecursor> + <templates> <template name="header"> <background color="#000000FF" /> @@ -2430,20 +2437,29 @@ <object type="button"> <highlight color="%highlight_color%" /> - <placement x="%col4_x%" y="%row2_y%" /> + <placement x="%col2_x%" y="%row2_y%" /> <font resource="font" color="%button_text_color%" /> - <text>Screen</text> + <text>Restore Defaults</text> <image resource="main_button" /> - <action function="page">screen</action> + <action function="restoredefaultsettings"></action> </object> <object type="button"> <highlight color="%highlight_color%" /> - <placement x="%col_center_x%" y="%slider_y%" /> + <placement x="%col3_x%" y="%row2_y%" /> <font resource="font" color="%button_text_color%" /> - <text>Restore Defaults</text> + <text>Vibration Duration</text> <image resource="main_button" /> - <action function="restoredefaultsettings"></action> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <highlight color="%highlight_color%" /> + <placement x="%col4_x%" y="%row2_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Screen</text> + <image resource="main_button" /> + <action function="page">screen</action> </object> <object type="action"> @@ -2652,6 +2668,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_text_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row3_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row7_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row11_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/devices/1080x1920/res/images/cursor.png b/gui/devices/1080x1920/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/1080x1920/res/images/cursor.png diff --git a/gui/devices/1080x1920/res/ui.xml b/gui/devices/1080x1920/res/ui.xml index beaf37325..3ab69a6ed 100644 --- a/gui/devices/1080x1920/res/ui.xml +++ b/gui/devices/1080x1920/res/ui.xml @@ -39,6 +39,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -191,6 +192,12 @@ <variable name="slidervalue_sliderh" value="90" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="2.5" /> + </mousecursor> + <templates> <template name="header"> <background color="#000000FF" /> @@ -2456,7 +2463,16 @@ </object> <object type="button"> - <placement x="%col_center_x%" y="%row4_y%" /> + <highlight color="%highlight_color%" /> + <placement x="%col2_x%" y="%row4_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Vibration Duration</text> + <image resource="main_button" /> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <placement x="%col_x%" y="%row4_y%" /> <font resource="font" color="%button_text_color%" /> <text>Restore Defaults</text> <image resource="main_button" /> @@ -2663,6 +2679,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_header_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row8_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/devices/1200x1920/res/images/cursor.png b/gui/devices/1200x1920/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/1200x1920/res/images/cursor.png diff --git a/gui/devices/1200x1920/res/ui.xml b/gui/devices/1200x1920/res/ui.xml index a83c30bb7..5aedca8b1 100644 --- a/gui/devices/1200x1920/res/ui.xml +++ b/gui/devices/1200x1920/res/ui.xml @@ -39,6 +39,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -194,6 +195,12 @@ <variable name="slidervalue_sliderh" value="90" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="2.5" /> + </mousecursor> + <templates> <template name="header"> <background color="#000000FF" /> @@ -2459,7 +2466,16 @@ </object> <object type="button"> - <placement x="%col_center_x%" y="%row4_y%" /> + <highlight color="%highlight_color%" /> + <placement x="%col2_x%" y="%row4_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Vibration Duration</text> + <image resource="main_button" /> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <placement x="%col_x%" y="%row4_y%" /> <font resource="font" color="%button_text_color%" /> <text>Restore Defaults</text> <image resource="main_button" /> @@ -2666,6 +2682,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_header_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row8_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/devices/1280x800/res/images/cursor.png b/gui/devices/1280x800/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/1280x800/res/images/cursor.png diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml index 115a391eb..c7d914893 100644 --- a/gui/devices/1280x800/res/ui.xml +++ b/gui/devices/1280x800/res/ui.xml @@ -38,6 +38,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -205,6 +206,12 @@ <variable name="slidervalue_sliderh" value="60" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="2" /> + </mousecursor> + <templates> <template name="header"> <background color="#000000FF" /> @@ -2430,20 +2437,29 @@ <object type="button"> <highlight color="%highlight_color%" /> - <placement x="%col4_x%" y="%row2_y%" /> + <placement x="%col2_x%" y="%row2_y%" /> <font resource="font" color="%button_text_color%" /> - <text>Screen</text> + <text>Restore Defaults</text> <image resource="main_button" /> - <action function="page">screen</action> + <action function="restoredefaultsettings"></action> </object> <object type="button"> <highlight color="%highlight_color%" /> - <placement x="%col_center_x%" y="%slider_y%" /> + <placement x="%col3_x%" y="%row2_y%" /> <font resource="font" color="%button_text_color%" /> - <text>Restore Defaults</text> + <text>Vibration Duration</text> <image resource="main_button" /> - <action function="restoredefaultsettings"></action> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <highlight color="%highlight_color%" /> + <placement x="%col4_x%" y="%row2_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Screen</text> + <image resource="main_button" /> + <action function="page">screen</action> </object> <object type="action"> @@ -2652,6 +2668,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_text_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row3_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row7_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row11_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/devices/1920x1200/res/images/cursor.png b/gui/devices/1920x1200/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/1920x1200/res/images/cursor.png diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml index fb615c135..dbd6a0b2d 100644 --- a/gui/devices/1920x1200/res/ui.xml +++ b/gui/devices/1920x1200/res/ui.xml @@ -38,6 +38,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -205,6 +206,12 @@ <variable name="slidervalue_sliderh" value="80" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="2.5" /> + </mousecursor> + <templates> <template name="header"> <background color="#000000FF" /> @@ -2430,20 +2437,29 @@ <object type="button"> <highlight color="%highlight_color%" /> - <placement x="%col4_x%" y="%row2_y%" /> + <placement x="%col2_x%" y="%row2_y%" /> <font resource="font" color="%button_text_color%" /> - <text>Screen</text> + <text>Restore Defaults</text> <image resource="main_button" /> - <action function="page">screen</action> + <action function="restoredefaultsettings"></action> </object> <object type="button"> <highlight color="%highlight_color%" /> - <placement x="%col_center_x%" y="%slider_y%" /> + <placement x="%col3_x%" y="%row2_y%" /> <font resource="font" color="%button_text_color%" /> - <text>Restore Defaults</text> + <text>Vibration Duration</text> <image resource="main_button" /> - <action function="restoredefaultsettings"></action> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <highlight color="%highlight_color%" /> + <placement x="%col4_x%" y="%row2_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Screen</text> + <image resource="main_button" /> + <action function="page">screen</action> </object> <object type="action"> @@ -2652,6 +2668,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_text_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row3_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row7_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row11_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/devices/2560x1600/res/images/cursor.png b/gui/devices/2560x1600/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/2560x1600/res/images/cursor.png diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml index 9ce330a44..0a501afc0 100644 --- a/gui/devices/2560x1600/res/ui.xml +++ b/gui/devices/2560x1600/res/ui.xml @@ -38,6 +38,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -205,6 +206,12 @@ <variable name="slidervalue_sliderh" value="90" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="2.5" /> + </mousecursor> + <templates> <template name="header"> <background color="#000000FF" /> @@ -2430,20 +2437,29 @@ <object type="button"> <highlight color="%highlight_color%" /> - <placement x="%col4_x%" y="%row2_y%" /> + <placement x="%col2_x%" y="%row2_y%" /> <font resource="font" color="%button_text_color%" /> - <text>Screen</text> + <text>Restore Defaults</text> <image resource="main_button" /> - <action function="page">screen</action> + <action function="restoredefaultsettings"></action> </object> <object type="button"> <highlight color="%highlight_color%" /> - <placement x="%col_center_x%" y="%slider_y%" /> + <placement x="%col3_x%" y="%row2_y%" /> <font resource="font" color="%button_text_color%" /> - <text>Restore Defaults</text> + <text>Vibration Duration</text> <image resource="main_button" /> - <action function="restoredefaultsettings"></action> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <highlight color="%highlight_color%" /> + <placement x="%col4_x%" y="%row2_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Screen</text> + <image resource="main_button" /> + <action function="page">screen</action> </object> <object type="action"> @@ -2652,6 +2668,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_text_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row3_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row7_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row11_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/devices/320x480/res/images/cursor.png b/gui/devices/320x480/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/320x480/res/images/cursor.png diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml index dbee885a7..3c3b73d26 100644 --- a/gui/devices/320x480/res/ui.xml +++ b/gui/devices/320x480/res/ui.xml @@ -39,6 +39,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -186,6 +187,12 @@ <variable name="slidervalue_sliderh" value="20" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="1" /> + </mousecursor> + <templates> <template name="header"> <background color="#000000FF" /> @@ -2443,7 +2450,16 @@ </object> <object type="button"> - <placement x="%col_center_x%" y="%row4_y%" /> + <highlight color="%highlight_color%" /> + <placement x="%col2_x%" y="%row4_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Vibration Duration</text> + <image resource="main_button" /> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <placement x="%col_x%" y="%row4_y%" /> <font resource="font" color="%button_text_color%" /> <text>Restore Defaults</text> <image resource="main_button" /> @@ -2650,6 +2666,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_header_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row8_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/devices/480x800/res/images/cursor.png b/gui/devices/480x800/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/480x800/res/images/cursor.png diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml index bb90e70b4..32c90d936 100644 --- a/gui/devices/480x800/res/ui.xml +++ b/gui/devices/480x800/res/ui.xml @@ -39,6 +39,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -186,6 +187,12 @@ <variable name="slidervalue_sliderh" value="40" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="1.5" /> + </mousecursor> + <templates> <template name="header"> <background color="%backgroundcolor%" /> @@ -2443,7 +2450,16 @@ </object> <object type="button"> - <placement x="%col_center_x%" y="%row4_y%" /> + <highlight color="%highlight_color%" /> + <placement x="%col2_x%" y="%row4_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Vibration Duration</text> + <image resource="main_button" /> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <placement x="%col_x%" y="%row4_y%" /> <font resource="font" color="%button_text_color%" /> <text>Restore Defaults</text> <image resource="main_button" /> @@ -2650,6 +2666,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_header_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row8_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/devices/480x854/res/images/cursor.png b/gui/devices/480x854/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/480x854/res/images/cursor.png diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml index 08c3ddcfe..a8357703c 100644 --- a/gui/devices/480x854/res/ui.xml +++ b/gui/devices/480x854/res/ui.xml @@ -39,6 +39,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -185,6 +186,12 @@ <variable name="slidervalue_sliderh" value="40" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="1.5" /> + </mousecursor> + <templates> <template name="header"> <background color="%backgroundcolor%" /> @@ -2442,7 +2449,16 @@ </object> <object type="button"> - <placement x="%col_center_x%" y="%row4_y%" /> + <highlight color="%highlight_color%" /> + <placement x="%col2_x%" y="%row4_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Vibration Duration</text> + <image resource="main_button" /> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <placement x="%col_x%" y="%row4_y%" /> <font resource="font" color="%button_text_color%" /> <text>Restore Defaults</text> <image resource="main_button" /> @@ -2649,6 +2665,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_header_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row8_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/devices/540x960/res/images/cursor.png b/gui/devices/540x960/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/540x960/res/images/cursor.png diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml index e03704eef..0a43bebc2 100644 --- a/gui/devices/540x960/res/ui.xml +++ b/gui/devices/540x960/res/ui.xml @@ -39,6 +39,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -186,6 +187,12 @@ <variable name="slidervalue_sliderh" value="45" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="1.5" /> + </mousecursor> + <templates> <template name="header"> <background color="#000000FF" /> @@ -2443,7 +2450,16 @@ </object> <object type="button"> - <placement x="%col_center_x%" y="%row4_y%" /> + <highlight color="%highlight_color%" /> + <placement x="%col2_x%" y="%row4_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Vibration Duration</text> + <image resource="main_button" /> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <placement x="%col_x%" y="%row4_y%" /> <font resource="font" color="%button_text_color%" /> <text>Restore Defaults</text> <image resource="main_button" /> @@ -2650,6 +2666,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_header_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row8_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/devices/720x1280/res/images/cursor.png b/gui/devices/720x1280/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/720x1280/res/images/cursor.png diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml index c9a4c0a69..37003da45 100644 --- a/gui/devices/720x1280/res/ui.xml +++ b/gui/devices/720x1280/res/ui.xml @@ -39,6 +39,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -191,6 +192,12 @@ <variable name="slidervalue_sliderh" value="60" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="2" /> + </mousecursor> + <templates> <template name="header"> <background color="#000000FF" /> @@ -2456,7 +2463,16 @@ </object> <object type="button"> - <placement x="%col_center_x%" y="%row4_y%" /> + <highlight color="%highlight_color%" /> + <placement x="%col2_x%" y="%row4_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Vibration Duration</text> + <image resource="main_button" /> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <placement x="%col_x%" y="%row4_y%" /> <font resource="font" color="%button_text_color%" /> <text>Restore Defaults</text> <image resource="main_button" /> @@ -2663,6 +2679,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_header_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row8_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/devices/800x1280/res/images/cursor.png b/gui/devices/800x1280/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/800x1280/res/images/cursor.png diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml index 9b7a06315..31006e6fa 100755 --- a/gui/devices/800x1280/res/ui.xml +++ b/gui/devices/800x1280/res/ui.xml @@ -39,6 +39,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -187,6 +188,12 @@ <variable name="slidervalue_sliderh" value="60" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="2.5" /> + </mousecursor> + <templates> <template name="header"> <background color="#000000FF" /> @@ -2444,7 +2451,16 @@ </object> <object type="button"> - <placement x="%col_center_x%" y="%row4_y%" /> + <highlight color="%highlight_color%" /> + <placement x="%col2_x%" y="%row4_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Vibration Duration</text> + <image resource="main_button" /> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <placement x="%col_x%" y="%row4_y%" /> <font resource="font" color="%button_text_color%" /> <text>Restore Defaults</text> <image resource="main_button" /> @@ -2651,6 +2667,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_header_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row4_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row8_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="col1_x" y="%row12_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/devices/800x480/res/images/cursor.png b/gui/devices/800x480/res/images/cursor.png Binary files differnew file mode 100644 index 000000000..32c8ae1ca --- /dev/null +++ b/gui/devices/800x480/res/images/cursor.png diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml index 9c391b33e..8f881d779 100755 --- a/gui/devices/800x480/res/ui.xml +++ b/gui/devices/800x480/res/ui.xml @@ -38,6 +38,7 @@ <resource name="keyboard2" type="image" filename="keyboard2" /> <resource name="keyboard3" type="image" filename="keyboard3" /> <resource name="keyboard4" type="image" filename="keyboard4" /> + <resource name="cursor" type="image" filename="cursor" /> </resources> <variables> @@ -205,6 +206,12 @@ <variable name="slidervalue_sliderh" value="40" /> </variables> + <mousecursor> + <placement w="15" h="15" /> + <background color="#FFFF00FF" resource="cursor" /> + <speed multiplier="1.5" /> + </mousecursor> + <templates> <template name="header"> <background color="#000000FF" /> @@ -2438,20 +2445,29 @@ <object type="button"> <highlight color="%highlight_color%" /> - <placement x="%col4_x%" y="%row2_y%" /> + <placement x="%col2_x%" y="%row2_y%" /> <font resource="font" color="%button_text_color%" /> - <text>Screen</text> + <text>Restore Defaults</text> <image resource="main_button" /> - <action function="page">screen</action> + <action function="restoredefaultsettings"></action> </object> <object type="button"> <highlight color="%highlight_color%" /> - <placement x="%col_center_x%" y="%slider_y%" /> + <placement x="%col3_x%" y="%row2_y%" /> <font resource="font" color="%button_text_color%" /> - <text>Restore Defaults</text> + <text>Vibration Duration</text> <image resource="main_button" /> - <action function="restoredefaultsettings"></action> + <action function="page">Vibrate</action> + </object> + + <object type="button"> + <highlight color="%highlight_color%" /> + <placement x="%col4_x%" y="%row2_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Screen</text> + <image resource="main_button" /> + <action function="page">screen</action> </object> <object type="action"> @@ -2660,6 +2676,52 @@ <object type="template" name="footer" /> </page> + <page name="Vibrate"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_text_y%" placement="5" /> + <text>Vibration Settings :</text> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row3_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Button Vibration:</text> + <data variable="tw_button_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row7_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Keyboard Vibration:</text> + <data variable="tw_keyboard_vibrate" min="0" max="300" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="slidervalue"> + <placement x="slidervalue_x" y="%row11_text_y%" w="%slidervalue_w%" /> + <font resource="font" color="%text_color%" /> + <text>Action Vibration:</text> + <data variable="tw_action_vibrate" min="0" max="500" /> + <colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" /> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">settings</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="advanced"> <object type="template" name="header" /> diff --git a/gui/gui.cpp b/gui/gui.cpp index e9efc1db9..2098342b0 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -186,6 +186,7 @@ static void * input_thread(void *cookie) static struct timeval touchStart; HardwareKeyboard kb; string seconds; + MouseCursor *cursor = PageManager::GetMouseCursor(); #ifndef TW_NO_SCREEN_TIMEOUT //start screen timeout threads @@ -329,7 +330,47 @@ static void * input_thread(void *cookie) #ifdef _EVENT_LOGGING LOGERR("TOUCH_KEY: %d\n", ev.code); #endif - if (ev.value != 0) + // Left mouse button + if(ev.code == BTN_LEFT) + { + if(ev.value == 1) + { + cursor->GetPos(x, y); + + if (PageManager::NotifyTouch(TOUCH_START, x, y) > 0) + state = 1; + drag = 1; + touch_and_hold = 1; + dontwait = 1; + key_repeat = 0; + gettimeofday(&touchStart, NULL); + } + else if(drag == 1) + { + if (state == 0) + { + cursor->GetPos(x, y); + + PageManager::NotifyTouch(TOUCH_RELEASE, x, y); + + touch_and_hold = 0; + touch_repeat = 0; + if (!key_repeat) + dontwait = 0; + } + state = 0; + drag = 0; + } + } + // side mouse button, often used for "back" function + else if(ev.code == BTN_SIDE) + { + if(ev.value == 1) + kb.KeyDown(KEY_BACK); + else + kb.KeyUp(KEY_BACK); + } + else if (ev.value != 0) { // This is a key press if (kb.KeyDown(ev.code)) @@ -367,6 +408,26 @@ static void * input_thread(void *cookie) #endif } } + else if(ev.type == EV_REL) + { +#ifdef _EVENT_LOGGING + LOGERR("EV_REL %d %d\n", ev.code, ev.value); +#endif + if(ev.code == REL_X) + cursor->Move(ev.value, 0); + else if(ev.code == REL_Y) + cursor->Move(0, ev.value); + + if(drag == 1) { + cursor->GetPos(x, y); +#ifdef _EVENT_LOGGING + LOGERR("TOUCH_DRAG: %d, %d\n", x, y); +#endif + if (PageManager::NotifyTouch(TOUCH_DRAG, x, y) > 0) + state = 1; + key_repeat = 0; + } + } } return NULL; } diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp index 95cdbf1c8..36106c7c1 100644 --- a/gui/keyboard.cpp +++ b/gui/keyboard.cpp @@ -30,6 +30,7 @@ #include <time.h> #include <unistd.h> #include <stdlib.h> +#include "../data.hpp" #include <string> @@ -475,6 +476,7 @@ int GUIKeyboard::NotifyTouch(TOUCH_STATE state, int x, int y) startSelection = 0; break; } else if (state == TOUCH_RELEASE && was_held == 0) { + DataManager::Vibrate("tw_keyboard_vibrate"); if ((int)keyboard_keys[currentLayout - 1][rowIndex][indexx].key < KEYBOARD_SPECIAL_KEYS && (int)keyboard_keys[currentLayout - 1][rowIndex][indexx].key > 0) { // Regular key PageManager::NotifyKeyboard(keyboard_keys[currentLayout - 1][rowIndex][indexx].key); @@ -500,6 +502,7 @@ int GUIKeyboard::NotifyTouch(TOUCH_STATE state, int x, int y) PageManager::NotifyKeyboard(keyboard_keys[currentLayout - 1][rowIndex][indexx].key); } else if ((int)keyboard_keys[currentLayout - 1][rowIndex][indexx].longpresskey < KEYBOARD_SPECIAL_KEYS && (int)keyboard_keys[currentLayout - 1][rowIndex][indexx].longpresskey > 0) { // Long Press Key + DataManager::Vibrate("tw_keyboard_vibrate"); PageManager::NotifyKeyboard(keyboard_keys[currentLayout - 1][rowIndex][indexx].longpresskey); } } else if (state == TOUCH_REPEAT) { diff --git a/gui/mousecursor.cpp b/gui/mousecursor.cpp new file mode 100644 index 000000000..1c22356f9 --- /dev/null +++ b/gui/mousecursor.cpp @@ -0,0 +1,154 @@ +#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" + +MouseCursor::MouseCursor(int resX, int resY) +{ + ResetData(resX, resY); +} + +MouseCursor::~MouseCursor() +{ +} + +void MouseCursor::ResetData(int resX, int resY) +{ + m_resX = resX; + m_resY = resY; + m_moved = false; + m_speedMultiplier = 2.5f; + m_image = NULL; + m_present = false; + + ConvertStrToColor("red", &m_color); + + SetRenderPos(resX/2, resY/2, 10, 10); +} + +void MouseCursor::LoadData(xml_node<>* node) +{ + xml_attribute<>* attr; + xml_node<>* child; + + child = node->first_node("placement"); + if(child) + LoadPlacement(child, &mRenderX, &mRenderY, &mRenderW, &mRenderH); + + child = node->first_node("background"); + if(child) + { + attr = child->first_attribute("color"); + if(attr) + ConvertStrToColor(attr->value(), &m_color); + + attr = child->first_attribute("resource"); + if(attr) + { + m_image = PageManager::FindResource(attr->value()); + if(m_image) + { + mRenderW = gr_get_width(m_image->GetResource()); + mRenderH = gr_get_height(m_image->GetResource()); + } + } + } + + child = node->first_node("speed"); + if(child) + { + attr = child->first_attribute("multiplier"); + if(attr) + m_speedMultiplier = atof(attr->value()); + } +} + +int MouseCursor::Render(void) +{ + if(!m_present) + return 0; + + if(m_image) + { + gr_blit(m_image->GetResource(), 0, 0, mRenderW, mRenderH, mRenderX, mRenderY); + } + else + { + gr_color(m_color.red, m_color.green, m_color.blue, m_color.alpha); + gr_fill(mRenderX, mRenderY, mRenderW, mRenderH); + } + return 0; +} + +int MouseCursor::Update(void) +{ + if(m_present != ev_has_mouse()) + { + m_present = ev_has_mouse(); + if(m_present) + SetRenderPos(m_resX/2, m_resY/2); + return 2; + } + + if(m_present && m_moved) + { + m_moved = false; + return 2; + } + return 0; +} + +int MouseCursor::SetRenderPos(int x, int y, int w, int h) +{ + if(x == mRenderX && y == mRenderY) + m_moved = true; + + return RenderObject::SetRenderPos(x, y, w, h); +} + +void MouseCursor::Move(int deltaX, int deltaY) +{ + if(deltaX != 0) + { + mRenderX += deltaX*m_speedMultiplier; + mRenderX = (std::min)(mRenderX, m_resX); + mRenderX = (std::max)(mRenderX, 0); + + m_moved = true; + } + + if(deltaY != 0) + { + mRenderY += deltaY*m_speedMultiplier; + mRenderY = (std::min)(mRenderY, m_resY); + mRenderY = (std::max)(mRenderY, 0); + + m_moved = true; + } +} + +void MouseCursor::GetPos(int& x, int& y) +{ + x = mRenderX; + y = mRenderY; +} diff --git a/gui/objects.hpp b/gui/objects.hpp index e7bb2a0ee..e8110b016 100644 --- a/gui/objects.hpp +++ b/gui/objects.hpp @@ -25,6 +25,7 @@ #include <vector> #include <string> #include <map> +#include <time.h> extern "C" { #ifdef HAVE_SELINUX @@ -285,6 +286,7 @@ protected: void operation_start(const string operation_name); void operation_end(const int operation_status, const int simulate); static void* command_thread(void *cookie); + time_t Start; }; class GUIConsole : public RenderObject, public ActionObject @@ -976,6 +978,31 @@ protected: int lineW; }; +class MouseCursor : public RenderObject +{ +public: + MouseCursor(int posX, int posY); + virtual ~MouseCursor(); + + virtual int Render(void); + virtual int Update(void); + virtual int SetRenderPos(int x, int y, int w = 0, int h = 0); + + void Move(int deltaX, int deltaY); + void GetPos(int& x, int& y); + void LoadData(xml_node<>* node); + void ResetData(int resX, int resY); + +private: + int m_resX; + int m_resY; + bool m_moved; + float m_speedMultiplier; + COLOR m_color; + Resource *m_image; + bool m_present; +}; + // 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 d662f18f8..dc9edc798 100644 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -54,6 +54,7 @@ extern blanktimer blankTimer; std::map<std::string, PageSet*> PageManager::mPageSets; PageSet* PageManager::mCurrentSet; PageSet* PageManager::mBaseSet = NULL; +MouseCursor *PageManager::mMouseCursor = NULL; // Helper routine to convert a string to a color declaration int ConvertStrToColor(std::string str, COLOR* color) @@ -550,6 +551,11 @@ int PageSet::Load(ZipArchive* package) if (child) LoadVariables(child); + LOGINFO("Loading mouse cursor...\n"); + child = parent->first_node("mousecursor"); + if(child) + PageManager::LoadCursorData(child); + LOGINFO("Loading pages...\n"); // This may be NULL if no templates are present templates = parent->first_node("templates"); @@ -849,6 +855,9 @@ int PageManager::ReloadPackage(std::string name, std::string package) if (iter == mPageSets.end()) return -1; + if(mMouseCursor) + mMouseCursor->ResetData(gr_fb_width(), gr_fb_height()); + PageSet* set = (*iter).second; mPageSets.erase(iter); @@ -924,7 +933,25 @@ int PageManager::IsCurrentPage(Page* page) int PageManager::Render(void) { - return (mCurrentSet ? mCurrentSet->Render() : -1); + int res = (mCurrentSet ? mCurrentSet->Render() : -1); + if(mMouseCursor) + mMouseCursor->Render(); + return res; +} + +MouseCursor *PageManager::GetMouseCursor() +{ + if(!mMouseCursor) + mMouseCursor = new MouseCursor(gr_fb_width(), gr_fb_height()); + return mMouseCursor; +} + +void PageManager::LoadCursorData(xml_node<>* node) +{ + if(!mMouseCursor) + mMouseCursor = new MouseCursor(gr_fb_width(), gr_fb_height()); + + mMouseCursor->LoadData(node); } int PageManager::Update(void) @@ -933,7 +960,16 @@ int PageManager::Update(void) if(blankTimer.IsScreenOff()) return 0; #endif - return (mCurrentSet ? mCurrentSet->Update() : -1); + + int res = (mCurrentSet ? mCurrentSet->Update() : -1); + + if(mMouseCursor) + { + int c_res = mMouseCursor->Update(); + if(c_res > res) + res = c_res; + } + return res; } int PageManager::NotifyTouch(TOUCH_STATE state, int x, int y) diff --git a/gui/pages.hpp b/gui/pages.hpp index a37cdb9f2..2a2ef2c32 100644 --- a/gui/pages.hpp +++ b/gui/pages.hpp @@ -28,6 +28,7 @@ class ResourceManager; class RenderObject; class ActionObject; class InputObject; +class MouseCursor; class Page { @@ -130,6 +131,9 @@ public: static int SetKeyBoardFocus(int inFocus); static int NotifyVarChange(std::string varName, std::string value); + static MouseCursor *GetMouseCursor(); + static void LoadCursorData(xml_node<>* node); + protected: static PageSet* FindPackage(std::string name); @@ -137,6 +141,7 @@ protected: static std::map<std::string, PageSet*> mPageSets; static PageSet* mCurrentSet; static PageSet* mBaseSet; + static MouseCursor *mMouseCursor; }; #endif // _PAGES_HEADER_HPP diff --git a/gui/slider.cpp b/gui/slider.cpp index b46d156f6..af0c542de 100644 --- a/gui/slider.cpp +++ b/gui/slider.cpp @@ -15,6 +15,7 @@ #include <time.h> #include <unistd.h> #include <stdlib.h> +#include "../data.hpp" #include <string> @@ -156,8 +157,10 @@ int GUISlider::NotifyTouch(TOUCH_STATE state, int x, int y) if (!dragging) return 0; - if (sCurTouchX >= mRenderX + mRenderW - sTouchW) + if (sCurTouchX >= mRenderX + mRenderW - sTouchW) { + DataManager::Vibrate("tw_button_vibrate"); sAction->doActions(); + } sCurTouchX = mRenderX; dragging = false; diff --git a/minuitwrp/events.c b/minuitwrp/events.c index 73369a2cc..94942ba7b 100644 --- a/minuitwrp/events.c +++ b/minuitwrp/events.c @@ -20,8 +20,11 @@ #include <dirent.h> #include <sys/poll.h> #include <limits.h> - #include <linux/input.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + #include "../common.h" @@ -95,6 +98,9 @@ struct ev { static struct pollfd ev_fds[MAX_DEVICES]; static struct ev evs[MAX_DEVICES]; static unsigned ev_count = 0; +static struct timeval lastInputStat; +static unsigned long lastInputMTime; +static int has_mouse = 0; static inline int ABS(int x) { return x<0?-x:x; @@ -106,6 +112,8 @@ int vibrate(int timeout_ms) int fd; int ret; + if (timeout_ms > 10000) timeout_ms = 1000; + fd = open(VIBRATOR_TIMEOUT_FILE, O_WRONLY); if (fd < 0) return -1; @@ -237,12 +245,41 @@ static int vk_init(struct ev *e) return 0; } +#define BITS_PER_LONG (sizeof(long) * 8) +#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) +#define OFF(x) ((x)%BITS_PER_LONG) +#define LONG(x) ((x)/BITS_PER_LONG) +#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) +static void check_mouse(int fd) +{ + if(has_mouse) + return; + + unsigned long bit[EV_MAX][NBITS(KEY_MAX)]; + memset(bit, 0, sizeof(bit)); + ioctl(fd, EVIOCGBIT(0, EV_MAX), bit[0]); + + if(!test_bit(EV_REL, bit[0])) + return; + + ioctl(fd, EVIOCGBIT(EV_REL, KEY_MAX), bit[EV_REL]); + if(test_bit(REL_X, bit[EV_REL]) && test_bit(REL_Y, bit[EV_REL])) + has_mouse = 1; +} + +int ev_has_mouse(void) +{ + return has_mouse; +} + int ev_init(void) { DIR *dir; struct dirent *de; int fd; + has_mouse = 0; + dir = opendir("/dev/input"); if(dir != 0) { while((de = readdir(dir))) { @@ -258,23 +295,32 @@ int ev_init(void) /* Load virtualkeys if there are any */ vk_init(&evs[ev_count]); + check_mouse(fd); + ev_count++; if(ev_count == MAX_DEVICES) break; } + closedir(dir); } + struct stat st; + if(stat("/dev/input", &st) >= 0) + lastInputMTime = st.st_mtime; + gettimeofday(&lastInputStat, NULL); + return 0; } void ev_exit(void) { - while (ev_count-- > 0) { - if (evs[ev_count].vk_count) { - free(evs[ev_count].vks); - evs[ev_count].vk_count = 0; + while (ev_count-- > 0) { + if (evs[ev_count].vk_count) { + free(evs[ev_count].vks); + evs[ev_count].vk_count = 0; + } + close(ev_fds[ev_count].fd); } - close(ev_fds[ev_count].fd); - } + ev_count = 0; } static int vk_inside_display(__s32 value, struct input_absinfo *info, int screen_size) @@ -627,9 +673,25 @@ int ev_get(struct input_event *ev, unsigned dont_wait) { int r; unsigned n; + struct timeval curr; do { - r = poll(ev_fds, ev_count, dont_wait ? 0 : -1); + gettimeofday(&curr, NULL); + if(curr.tv_sec - lastInputStat.tv_sec >= 2) + { + struct stat st; + stat("/dev/input", &st); + if (st.st_mtime > lastInputMTime) + { + LOGI("Reloading input devices\n"); + ev_exit(); + ev_init(); + lastInputMTime = st.st_mtime; + } + lastInputStat = curr; + } + + r = poll(ev_fds, ev_count, 0); if(r > 0) { for(n = 0; n < ev_count; n++) { @@ -642,6 +704,8 @@ int ev_get(struct input_event *ev, unsigned dont_wait) } } } + + usleep(1000); } while(dont_wait == 0); return -1; diff --git a/minuitwrp/minui.h b/minuitwrp/minui.h index 03e15bb81..bbdfdfb50 100644 --- a/minuitwrp/minui.h +++ b/minuitwrp/minui.h @@ -58,6 +58,7 @@ struct input_event; int ev_init(void); void ev_exit(void); int ev_get(struct input_event *ev, unsigned dont_wait); +int ev_has_mouse(void); // Resources @@ -70,4 +71,6 @@ int ev_wait(int timeout); void ev_dispatch(void); int ev_get_input(int fd, short revents, struct input_event *ev); +int vibrate(int timeout_ms); + #endif |