improve style mutable

This commit is contained in:
lixianjing 2019-09-18 18:02:37 +08:00
parent 34283edc20
commit dfb0533892
23 changed files with 1655 additions and 1478 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
TK_CONST_DATA_ALIGN(const unsigned char data_a_b_c_any[]) = {
0x08,0x00,0x00,0x01,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x2d,0x62,0x2d,0x63,0x2e,0x61,0x6e,
0x08,0x00,0x00,0x01,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x2d,0x62,0x2d,0x63,0x2e,0x61,0x6e,
0x79,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x61,0x62,0x63,0x0a,0x00,0x00,0x00,0x00,};/*52*/
0x00,0x00,0x00,0x00,0x61,0x62,0x63,0x0d,0x0a,0x00,0x00,0x00,0x00,};/*53*/

View File

@ -1,4 +1,4 @@
TK_CONST_DATA_ALIGN(const unsigned char data_com_zlg_app_json[]) = {
0x08,0x00,0x03,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x6f,0x6d,0x2e,0x7a,0x6c,0x67,0x2e,
0x08,0x00,0x03,0x01,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x6f,0x6d,0x2e,0x7a,0x6c,0x67,0x2e,
0x61,0x70,0x70,0x2e,0x6a,0x73,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x7b,0x7d,0x0a,0x00,0x00,0x00,0x00,};/*51*/
0x00,0x00,0x00,0x00,0x7b,0x7d,0x0d,0x0a,0x00,0x00,0x00,0x00,};/*52*/

View File

@ -1,4 +1,4 @@
TK_CONST_DATA_ALIGN(const unsigned char data_test_dat[]) = {
0x08,0x00,0x04,0x01,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x2e,0x64,0x61,0x74,
0x08,0x00,0x04,0x01,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x2e,0x64,0x61,0x74,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x61,0x62,0x63,0x64,0x0a,0x00,0x00,0x00,0x00,};/*53*/
0x00,0x00,0x00,0x00,0x61,0x62,0x63,0x64,0x0d,0x0a,0x00,0x00,0x00,0x00,};/*54*/

View File

@ -1,5 +1,5 @@
TK_CONST_DATA_ALIGN(const unsigned char data_test_json[]) = {
0x08,0x00,0x03,0x01,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x2e,0x6a,0x73,0x6f,
0x08,0x00,0x03,0x01,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x2e,0x6a,0x73,0x6f,
0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x7b,0x0a,0x20,0x20,0x22,0x6e,0x61,0x6d,0x65,0x22,0x3a,0x22,0x66,0x6f,0x72,0x20,
0x74,0x65,0x73,0x74,0x22,0x0a,0x7d,0x0a,0x00,0x00,0x00,0x00,};/*72*/
0x00,0x00,0x00,0x00,0x7b,0x0d,0x0a,0x20,0x20,0x22,0x6e,0x61,0x6d,0x65,0x22,0x3a,0x22,0x66,0x6f,0x72,
0x20,0x74,0x65,0x73,0x74,0x22,0x0d,0x0a,0x7d,0x0d,0x0a,0x00,0x00,0x00,0x00,};/*75*/

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
TK_CONST_DATA_ALIGN(const unsigned char script_dummy[]) = {
0x07,0x00,0x01,0x01,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x75,0x6d,0x6d,0x79,0x00,0x72,0x65,
0x07,0x00,0x01,0x01,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x75,0x6d,0x6d,0x79,0x00,0x72,0x65,
0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x63,0x6f,0x6e,0x73,0x6f,0x6c,0x65,0x2e,0x6c,0x6f,0x67,0x28,0x22,0x68,0x65,0x6c,
0x6c,0x6f,0x20,0x61,0x77,0x74,0x6b,0x22,0x29,0x3b,0x0a,0x00,0x00,0x00,0x00,};/*75*/
0x6c,0x6f,0x20,0x61,0x77,0x74,0x6b,0x22,0x29,0x3b,0x0d,0x0a,0x00,0x00,0x00,0x00,};/*76*/

View File

@ -1,14 +1,14 @@
TK_CONST_DATA_ALIGN(const unsigned char strings_en_US[]) = {
0x06,0x00,0x00,0x01,0xc4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x65,0x6e,0x5f,0x55,0x53,0x00,0x64,0x61,
0x06,0x00,0x00,0x01,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x65,0x6e,0x5f,0x55,0x53,0x00,0x64,0x61,
0x74,0x61,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x3c,0x00,0x00,0x00,0x43,0x00,0x00,0x00,0x4a,0x00,0x00,0x00,
0x52,0x00,0x00,0x00,0x5a,0x00,0x00,0x00,0x62,0x00,0x00,0x00,0x6a,0x00,0x00,0x00,0x7a,0x00,0x00,0x00,
0xa6,0x00,0x00,0x00,0xa9,0x00,0x00,0x00,0xac,0x00,0x00,0x00,0xb8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xab,0x00,0x00,0x00,0xae,0x00,0x00,0x00,0xb1,0x00,0x00,0x00,0xbd,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x63,0x61,0x6e,0x63,0x65,0x6c,0x00,0x43,0x61,0x6e,0x63,0x65,0x6c,0x00,0x63,0x68,
0x69,0x6e,0x65,0x73,0x65,0x00,0x43,0x68,0x69,0x6e,0x65,0x73,0x65,0x00,0x65,0x6e,0x67,0x6c,0x69,0x73,
0x68,0x00,0x45,0x6e,0x67,0x6c,0x69,0x73,0x68,0x00,0x6d,0x75,0x6c,0x74,0x69,0x20,0x6c,0x69,0x6e,0x65,
0x20,0x74,0x65,0x78,0x74,0x00,0x69,0x74,0x0a,0x69,0x73,0x0a,0x61,0x0a,0x6d,0x75,0x6c,0x74,0x69,0x2d,
0x6c,0x69,0x6e,0x65,0x0a,0x54,0x72,0x61,0x6e,0x73,0x6c,0x61,0x74,0x65,0x20,0x74,0x65,0x78,0x74,0x20,
0x0a,0x28,0x63,0x65,0x6e,0x74,0x65,0x72,0x29,0x00,0x6f,0x6b,0x00,0x4f,0x4b,0x00,0x76,0x61,0x6c,0x75,
0x65,0x20,0x69,0x73,0x20,0x25,0x64,0x00,0x76,0x61,0x6c,0x75,0x65,0x20,0x69,0x73,0x20,0x25,0x64,0x00,
0x00,0x00,0x00,0x00,};/*244*/
0x20,0x74,0x65,0x78,0x74,0x00,0x69,0x74,0x0d,0x0a,0x69,0x73,0x0d,0x0a,0x61,0x0d,0x0a,0x6d,0x75,0x6c,
0x74,0x69,0x2d,0x6c,0x69,0x6e,0x65,0x0d,0x0a,0x54,0x72,0x61,0x6e,0x73,0x6c,0x61,0x74,0x65,0x20,0x74,
0x65,0x78,0x74,0x20,0x0d,0x0a,0x28,0x63,0x65,0x6e,0x74,0x65,0x72,0x29,0x00,0x6f,0x6b,0x00,0x4f,0x4b,
0x00,0x76,0x61,0x6c,0x75,0x65,0x20,0x69,0x73,0x20,0x25,0x64,0x00,0x76,0x61,0x6c,0x75,0x65,0x20,0x69,
0x73,0x20,0x25,0x64,0x00,0x00,0x00,0x00,0x00,};/*249*/

View File

@ -3,7 +3,7 @@ TK_CONST_DATA_ALIGN(const unsigned char strings_zh_CN[]) = {
0x74,0x61,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x34,0x00,0x00,0x00,0x3b,0x00,0x00,0x00,0x42,0x00,0x00,0x00,
0x4a,0x00,0x00,0x00,0x51,0x00,0x00,0x00,0x59,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x63,0x00,0x00,0x00,
0x6a,0x00,0x00,0x00,0x76,0x00,0x00,0x00,0xac,0x00,0x00,0x00,0xb8,0x00,0x00,0x00,0x63,0x61,0x6e,0x63,
0x6a,0x00,0x00,0x00,0x76,0x00,0x00,0x00,0xb1,0x00,0x00,0x00,0xbd,0x00,0x00,0x00,0x63,0x61,0x6e,0x63,
0x65,0x6c,0x00,0xe5,0x8f,0x96,0xe6,0xb6,0x88,0x00,0x63,0x68,0x69,0x6e,0x65,0x73,0x65,0x00,0xe4,0xb8,
0xad,0xe6,0x96,0x87,0x00,0x65,0x6e,0x67,0x6c,0x69,0x73,0x68,0x00,0xe8,0x8b,0xb1,0xe6,0x96,0x87,0x00,
0x6f,0x6b,0x00,0xe7,0xa1,0xae,0xe5,0xae,0x9a,0x00,0x76,0x61,0x6c,0x75,0x65,0x20,0x69,0x73,0x20,0x25,

View File

@ -1,5 +1,5 @@
TK_CONST_DATA_ALIGN(const unsigned char ui_label[]) = {
0x04,0x00,0x01,0x01,0xe4,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x64,0x61,
0x04,0x00,0x01,0x01,0xe9,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x64,0x61,
0x74,0x61,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x12,0x12,0x22,0x11,0x77,0x69,0x6e,0x64,0x6f,0x77,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -8,59 +8,60 @@ TK_CONST_DATA_ALIGN(const unsigned char ui_label[]) = {
0x63,0x3d,0x33,0x2c,0x72,0x3d,0x34,0x29,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x74,
0x79,0x6c,0x65,0x00,0x6c,0x65,0x66,0x74,0x00,0x74,0x65,0x78,0x74,0x00,0x69,0x74,0x0a,0x69,0x73,0x0a,
0x61,0x0a,0x6d,0x75,0x6c,0x74,0x69,0x2d,0x6c,0x69,0x6e,0x65,0x0a,0x73,0x61,0x6d,0x70,0x6c,0x65,0x0a,
0x28,0x6c,0x65,0x66,0x74,0x29,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,
0x79,0x6c,0x65,0x00,0x6c,0x65,0x66,0x74,0x00,0x74,0x65,0x78,0x74,0x00,0x69,0x74,0x0d,0x0a,0x69,0x73,
0x0d,0x0a,0x61,0x0d,0x0a,0x6d,0x75,0x6c,0x74,0x69,0x2d,0x6c,0x69,0x6e,0x65,0x0d,0x0a,0x73,0x61,0x6d,
0x70,0x6c,0x65,0x0d,0x0a,0x28,0x6c,0x65,0x66,0x74,0x29,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x74,0x79,
0x6c,0x65,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x00,0x74,0x72,0x5f,0x74,0x65,0x78,0x74,0x00,0x6d,0x75,
0x6c,0x74,0x69,0x20,0x6c,0x69,0x6e,0x65,0x20,0x74,0x65,0x78,0x74,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x00,0x74,0x72,0x5f,0x74,0x65,
0x78,0x74,0x00,0x6d,0x75,0x6c,0x74,0x69,0x20,0x6c,0x69,0x6e,0x65,0x20,0x74,0x65,0x78,0x74,0x00,0x00,
0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x72,0x69,0x67,0x68,0x74,
0x00,0x74,0x65,0x78,0x74,0x00,0x69,0x74,0x0a,0x69,0x73,0x0a,0x61,0x0a,0x6d,0x75,0x6c,0x74,0x69,0x2d,
0x6c,0x69,0x6e,0x65,0x0a,0x73,0x61,0x6d,0x70,0x6c,0x65,0x0a,0x28,0x72,0x69,0x67,0x68,0x74,0x29,0x00,
0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x63,0x65,0x6e,0x74,
0x65,0x72,0x5f,0x74,0x6f,0x70,0x00,0x74,0x65,0x78,0x74,0x00,0x69,0x74,0x0a,0x69,0x73,0x0a,0x61,0x0a,
0x6d,0x75,0x6c,0x74,0x69,0x2d,0x6c,0x69,0x6e,0x65,0x0a,0x73,0x61,0x6d,0x70,0x6c,0x65,0x0a,0x28,0x63,
0x65,0x6e,0x74,0x65,0x72,0x5f,0x74,0x6f,0x70,0x29,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x00,0x74,0x65,0x78,0x74,0x00,0x69,
0x74,0x0a,0x69,0x73,0x0a,0x61,0x0a,0x6d,0x75,0x6c,0x74,0x69,0x2d,0x6c,0x69,0x6e,0x65,0x0a,0x73,0x61,
0x6d,0x70,0x6c,0x65,0x0a,0x28,0x63,0x65,0x6e,0x74,0x65,0x72,0x29,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,
0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x72,0x69,0x67,0x68,0x74,0x00,0x74,0x65,0x78,0x74,
0x00,0x69,0x74,0x0a,0x69,0x73,0x0a,0x61,0x0a,0x6d,0x75,0x6c,0x74,0x69,0x2d,0x6c,0x69,0x6e,0x65,0x0a,
0x73,0x61,0x6d,0x70,0x6c,0x65,0x0a,0x28,0x72,0x69,0x67,0x68,0x74,0x29,0x00,0x00,0x00,0x6c,0x61,0x62,
0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x5f,0x62,0x6f,0x74,
0x74,0x6f,0x6d,0x00,0x74,0x65,0x78,0x74,0x00,0x69,0x74,0x0a,0x69,0x73,0x0a,0x61,0x0a,0x6d,0x75,0x6c,
0x74,0x69,0x2d,0x6c,0x69,0x6e,0x65,0x0a,0x73,0x61,0x6d,0x70,0x6c,0x65,0x0a,0x28,0x63,0x65,0x6e,0x74,
0x65,0x72,0x5f,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x29,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x5f,0x74,0x6f,
0x70,0x00,0x74,0x65,0x78,0x74,0x00,0x69,0x74,0x0a,0x69,0x73,0x0a,0x61,0x0a,0x6d,0x75,0x6c,0x74,0x69,
0x2d,0x6c,0x69,0x6e,0x65,0x0a,0x73,0x61,0x6d,0x70,0x6c,0x65,0x0a,0x28,0x63,0x65,0x6e,0x74,0x65,0x72,
0x5f,0x74,0x6f,0x70,0x29,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,
0x65,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x00,0x74,0x65,0x78,0x74,0x00,0x69,0x74,0x0a,0x69,0x73,0x0a,
0x61,0x0a,0x6d,0x75,0x6c,0x74,0x69,0x2d,0x6c,0x69,0x6e,0x65,0x0a,0x73,0x61,0x6d,0x70,0x6c,0x65,0x0a,
0x28,0x63,0x65,0x6e,0x74,0x65,0x72,0x29,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,
0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x6c,0x65,0x66,0x74,0x00,0x74,0x65,0x78,0x74,0x00,0x64,0x69,0x61,
0x6c,0x69,0x6e,0x67,0x2e,0x2e,0x2e,0x00,0x61,0x6e,0x69,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x00,0x6c,0x65,
0x6e,0x67,0x74,0x68,0x28,0x66,0x72,0x6f,0x6d,0x3d,0x37,0x2c,0x20,0x74,0x6f,0x3d,0x31,0x32,0x2c,0x20,
0x65,0x61,0x73,0x69,0x6e,0x67,0x3d,0x6c,0x69,0x6e,0x65,0x61,0x72,0x2c,0x20,0x64,0x75,0x72,0x61,0x74,
0x69,0x6f,0x6e,0x3d,0x31,0x32,0x30,0x30,0x2c,0x20,0x72,0x65,0x70,0x65,0x61,0x74,0x3d,0x31,0x30,0x30,
0x30,0x29,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x63,
0x65,0x6e,0x74,0x65,0x72,0x00,0x74,0x65,0x78,0x74,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x00,0x00,0x00,
0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x72,0x69,0x67,0x68,0x74,0x00,
0x74,0x65,0x78,0x74,0x00,0x72,0x69,0x67,0x68,0x74,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x5f,0x74,0x6f,0x70,0x00,0x74,0x65,
0x78,0x74,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x5f,0x74,0x6f,0x70,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,
0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x00,0x74,0x65,0x78,
0x74,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,
0x74,0x79,0x6c,0x65,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x5f,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x00,0x74,
0x65,0x78,0x74,0x00,0x69,0x74,0x0a,0x69,0x73,0x0a,0x61,0x0a,0x6d,0x75,0x6c,0x74,0x69,0x2d,0x6c,0x69,
0x6e,0x65,0x0a,0x73,0x61,0x6d,0x70,0x6c,0x65,0x0a,0x28,0x63,0x65,0x6e,0x74,0x65,0x72,0x5f,0x62,0x6f,
0x74,0x74,0x6f,0x6d,0x29,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,
0x65,0x00,0x6c,0x65,0x66,0x74,0x00,0x74,0x65,0x78,0x74,0x00,0x64,0x69,0x61,0x6c,0x69,0x6e,0x67,0x2e,
0x2e,0x2e,0x00,0x61,0x6e,0x69,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x00,0x6c,0x65,0x6e,0x67,0x74,0x68,0x28,
0x66,0x72,0x6f,0x6d,0x3d,0x37,0x2c,0x20,0x74,0x6f,0x3d,0x31,0x32,0x2c,0x20,0x65,0x61,0x73,0x69,0x6e,
0x67,0x3d,0x6c,0x69,0x6e,0x65,0x61,0x72,0x2c,0x20,0x64,0x75,0x72,0x61,0x74,0x69,0x6f,0x6e,0x3d,0x31,
0x32,0x30,0x30,0x2c,0x20,0x72,0x65,0x70,0x65,0x61,0x74,0x3d,0x31,0x30,0x30,0x30,0x29,0x00,0x00,0x00,
0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,
0x00,0x74,0x65,0x78,0x74,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x72,0x69,0x67,0x68,0x74,0x00,0x74,0x65,0x78,0x74,0x00,
0x72,0x69,0x67,0x68,0x74,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,
0x65,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x5f,0x74,0x6f,0x70,0x00,0x74,0x65,0x78,0x74,0x00,0x63,0x65,
0x6e,0x74,0x65,0x72,0x5f,0x74,0x6f,0x70,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,
0x74,0x79,0x6c,0x65,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x00,0x74,0x65,0x78,0x74,0x00,0x63,0x65,0x6e,
0x74,0x65,0x72,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,
0x63,0x65,0x6e,0x74,0x65,0x72,0x5f,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x00,0x74,0x65,0x78,0x74,0x00,0x63,
0x65,0x6e,0x74,0x65,0x72,0x5f,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*1300*/
0x65,0x78,0x74,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x5f,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,};/*1305*/

View File

@ -1,5 +1,5 @@
TK_CONST_DATA_ALIGN(const unsigned char ui_rich_text[]) = {
0x04,0x00,0x01,0x01,0xd3,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x72,0x69,0x63,0x68,0x5f,0x74,0x65,0x78,
0x04,0x00,0x01,0x01,0xd5,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x72,0x69,0x63,0x68,0x5f,0x74,0x65,0x78,
0x74,0x00,0x64,0x61,0x74,0x61,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x12,0x12,0x22,0x11,0x77,0x69,0x6e,0x64,0x6f,0x77,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -50,17 +50,17 @@ TK_CONST_DATA_ALIGN(const unsigned char ui_rich_text[]) = {
0x73,0x20,0x79,0x6f,0x75,0x20,0x65,0x76,0x65,0x6e,0x74,0x73,0x20,0x66,0x72,0x6f,0x6d,0x20,0x70,0x65,
0x6f,0x70,0x6c,0x65,0x20,0x79,0x6f,0x75,0x20,0x66,0x6f,0x6c,0x6c,0x6f,0x77,0x20,0x61,0x6e,0x64,0x20,
0x72,0x65,0x70,0x6f,0x73,0x69,0x74,0x6f,0x72,0x69,0x65,0x73,0x20,0x79,0x6f,0x75,0x20,0x77,0x61,0x74,
0x63,0x68,0x2e,0x20,0x0a,0x20,0x68,0x65,0x6c,0x6c,0x6f,0x20,0x77,0x6f,0x72,0x6c,0x64,0x21,0x0a,0x20,
0x3c,0x2f,0x66,0x6f,0x6e,0x74,0x3e,0x3c,0x66,0x6f,0x6e,0x74,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,
0x72,0x65,0x64,0x22,0x20,0x73,0x69,0x7a,0x65,0x3d,0x22,0x32,0x30,0x22,0x3e,0xe7,0xa1,0xae,0xe5,0xae,
0x9a,0xe5,0x8f,0x96,0xe6,0xb6,0x88,0xe4,0xb8,0xad,0xe6,0x96,0x87,0xe5,0xad,0x97,0xe7,0xac,0xa6,0xe6,
0xb5,0x8b,0xe8,0xaf,0x95,0xe3,0x80,0x82,0xe7,0xa1,0xae,0xe5,0xae,0x9a,0xe3,0x80,0x82,0xe5,0x8f,0x96,
0xe6,0xb6,0x88,0xe3,0x80,0x82,0xe4,0xb8,0xad,0xe6,0x96,0x87,0xe5,0xad,0x97,0xe7,0xac,0xa6,0xe6,0xb5,
0x8b,0xe8,0xaf,0x95,0xe3,0x80,0x82,0x3c,0x2f,0x66,0x6f,0x6e,0x74,0x3e,0x22,0x00,0x00,0x00,0x62,0x75,
0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x00,
0x00,0x00,0x28,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,
0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x63,0x2c,0x79,0x3d,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x3a,0x31,
0x30,0x2c,0x77,0x3d,0x32,0x35,0x25,0x2c,0x68,0x3d,0x34,0x30,0x29,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,
0x6c,0x6f,0x73,0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x6c,0x6f,0x73,0x65,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,};/*1283*/
0x63,0x68,0x2e,0x20,0x0d,0x0a,0x20,0x68,0x65,0x6c,0x6c,0x6f,0x20,0x77,0x6f,0x72,0x6c,0x64,0x21,0x0d,
0x0a,0x20,0x3c,0x2f,0x66,0x6f,0x6e,0x74,0x3e,0x3c,0x66,0x6f,0x6e,0x74,0x20,0x63,0x6f,0x6c,0x6f,0x72,
0x3d,0x22,0x72,0x65,0x64,0x22,0x20,0x73,0x69,0x7a,0x65,0x3d,0x22,0x32,0x30,0x22,0x3e,0xe7,0xa1,0xae,
0xe5,0xae,0x9a,0xe5,0x8f,0x96,0xe6,0xb6,0x88,0xe4,0xb8,0xad,0xe6,0x96,0x87,0xe5,0xad,0x97,0xe7,0xac,
0xa6,0xe6,0xb5,0x8b,0xe8,0xaf,0x95,0xe3,0x80,0x82,0xe7,0xa1,0xae,0xe5,0xae,0x9a,0xe3,0x80,0x82,0xe5,
0x8f,0x96,0xe6,0xb6,0x88,0xe3,0x80,0x82,0xe4,0xb8,0xad,0xe6,0x96,0x87,0xe5,0xad,0x97,0xe7,0xac,0xa6,
0xe6,0xb5,0x8b,0xe8,0xaf,0x95,0xe3,0x80,0x82,0x3c,0x2f,0x66,0x6f,0x6e,0x74,0x3e,0x22,0x00,0x00,0x00,
0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x19,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,
0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x63,0x2c,0x79,0x3d,0x62,0x6f,0x74,0x74,0x6f,0x6d,
0x3a,0x31,0x30,0x2c,0x77,0x3d,0x32,0x35,0x25,0x2c,0x68,0x3d,0x34,0x30,0x29,0x00,0x6e,0x61,0x6d,0x65,
0x00,0x63,0x6c,0x6f,0x73,0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x6c,0x6f,0x73,0x65,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,};/*1285*/

View File

@ -1,10 +1,10 @@
TK_CONST_DATA_ALIGN(const unsigned char xml_test[]) = {
0x05,0x00,0x00,0x01,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x00,0x64,0x61,0x74,
0x05,0x00,0x00,0x01,0x7b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x00,0x64,0x61,0x74,
0x61,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x3c,0x77,0x69,0x6e,0x64,0x6f,0x77,0x20,0x61,0x6e,0x69,0x6d,0x5f,0x68,0x69,0x6e,
0x74,0x3d,0x22,0x68,0x74,0x72,0x61,0x6e,0x73,0x6c,0x61,0x74,0x65,0x22,0x3e,0x0a,0x20,0x20,0x3c,0x62,
0x75,0x74,0x74,0x6f,0x6e,0x20,0x6e,0x61,0x6d,0x65,0x3d,0x22,0x63,0x6c,0x6f,0x73,0x65,0x22,0x20,0x78,
0x3d,0x22,0x63,0x65,0x6e,0x74,0x65,0x72,0x22,0x20,0x79,0x3d,0x22,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x3a,
0x31,0x30,0x22,0x20,0x77,0x3d,0x22,0x32,0x35,0x25,0x22,0x20,0x68,0x3d,0x22,0x33,0x30,0x22,0x20,0x74,
0x65,0x78,0x74,0x3d,0x22,0x43,0x6c,0x6f,0x73,0x65,0x22,0x2f,0x3e,0x0a,0x3c,0x2f,0x77,0x69,0x6e,0x64,
0x6f,0x77,0x3e,0x0a,0x00,0x00,0x00,0x00,};/*168*/
0x74,0x3d,0x22,0x68,0x74,0x72,0x61,0x6e,0x73,0x6c,0x61,0x74,0x65,0x22,0x3e,0x0d,0x0a,0x20,0x20,0x3c,
0x62,0x75,0x74,0x74,0x6f,0x6e,0x20,0x6e,0x61,0x6d,0x65,0x3d,0x22,0x63,0x6c,0x6f,0x73,0x65,0x22,0x20,
0x78,0x3d,0x22,0x63,0x65,0x6e,0x74,0x65,0x72,0x22,0x20,0x79,0x3d,0x22,0x62,0x6f,0x74,0x74,0x6f,0x6d,
0x3a,0x31,0x30,0x22,0x20,0x77,0x3d,0x22,0x32,0x35,0x25,0x22,0x20,0x68,0x3d,0x22,0x33,0x30,0x22,0x20,
0x74,0x65,0x78,0x74,0x3d,0x22,0x43,0x6c,0x6f,0x73,0x65,0x22,0x2f,0x3e,0x0d,0x0a,0x3c,0x2f,0x77,0x69,
0x6e,0x64,0x6f,0x77,0x3e,0x0d,0x0a,0x00,0x00,0x00,0x00,};/*171*/

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,6 +2,9 @@
* 2019/09/18
* 增加iostream\_mem。
* 重构theme gen。
* 完善style_mutableset value时和theme gen保持一致。
* edit 输入类型为email时允许输入空格感谢俊杰提供补丁
* 2019/09/17
* 修改LinuxCPU占用高的问题感谢俊杰提供补丁

View File

@ -74,3 +74,83 @@ bool_t style_is_mutable(style_t* s) {
return s->vt->is_mutable;
}
#include "base/enums.h"
#include "tkc/color_parser.h"
static uint32_t to_border(const char* value) {
uint32_t border = 0;
if (strstr(value, "left")) {
border |= BORDER_LEFT;
}
if (strstr(value, "right")) {
border |= BORDER_RIGHT;
}
if (strstr(value, "top")) {
border |= BORDER_TOP;
}
if (strstr(value, "bottom")) {
border |= BORDER_BOTTOM;
}
if (strstr(value, "all")) {
border |= BORDER_ALL;
}
return border;
}
static uint32_t to_icon_at(const char* value) {
uint32_t icon_at = ICON_AT_AUTO;
if (strstr(value, "left")) {
icon_at = ICON_AT_LEFT;
}
if (strstr(value, "right")) {
icon_at = ICON_AT_RIGHT;
}
if (strstr(value, "top")) {
icon_at = ICON_AT_TOP;
}
if (strstr(value, "bottom")) {
icon_at = ICON_AT_BOTTOM;
}
return icon_at;
}
ret_t style_normalize_value(const char* name, const char* value, value_t* out) {
value_t* v = out;
const key_type_value_t* dt = NULL;
return_value_if_fail(name != NULL && value != NULL && out != NULL, RET_BAD_PARAMS);
value_set_int(v, 0);
if (strstr(name, "image_draw_type") != NULL) {
dt = image_draw_type_find(value);
} else if (strcmp(name, "text_align_h") == 0) {
dt = align_h_type_find(value);
} else if (strcmp(name, "text_align_v") == 0) {
dt = align_v_type_find(value);
} else if (strcmp(name, "border") == 0) {
value_set_int(v, to_border(value));
} else if (strcmp(name, "icon_at") == 0) {
value_set_int(v, to_icon_at(value));
} else if (strstr(name, "color") != NULL) {
color_t c = color_parse(value);
value_set_int(v, c.color);
} else if (strstr(name, "image") != NULL || strstr(name, "name") != NULL ||
strstr(name, "icon") != NULL) {
value_dup_str(v, value);
} else {
if (isdigit(*value)) {
value_set_int(v, tk_atoi(value));
} else {
value_dup_str(v, value);
}
}
if (dt != NULL) {
value_set_int(v, dt->value);
}
return RET_OK;
}

View File

@ -359,6 +359,9 @@ bool_t style_is_mutable(style_t* s);
*/
ret_t style_destroy(style_t* s);
/*helper functions*/
ret_t style_normalize_value(const char* name, const char* value, value_t* out);
END_C_DECLS
#endif /*TK_STYLE_H*/

View File

@ -33,14 +33,31 @@ typedef struct _style_item_t {
struct _style_item_t* next;
} style_item_t;
static ret_t style_item_set_value(style_item_t* item, const value_t* value) {
const char* name = item->name;
value_t* v = &(item->value);
value_reset(v);
if (value->type == VALUE_TYPE_STRING) {
return style_normalize_value(name, value_str(value), v);
} else {
value_set_int(v, value_int(value));
return RET_OK;
}
}
static ret_t style_item_init(style_item_t* item, const char* name, const value_t* value) {
tk_strncpy(item->name, name, TK_NAME_LEN);
return style_item_set_value(item, value);
}
static style_item_t* style_item_add(style_item_t* first, const char* name, const value_t* value) {
style_item_t* iter = first;
style_item_t* item = TKMEM_ZALLOC(style_item_t);
return_value_if_fail(item != NULL, NULL);
tk_strncpy(item->name, name, TK_NAME_LEN);
value_reset(&(item->value));
value_deep_copy(&(item->value), value);
style_item_init(item, name, value);
if (first != NULL) {
while (iter->next) {
@ -60,8 +77,7 @@ static ret_t style_item_set(style_item_t* first, const char* name, const value_t
if (first != NULL) {
while (iter) {
if (tk_str_eq(iter->name, name)) {
value_reset(&(iter->value));
value_deep_copy(&(iter->value), value);
style_item_set_value(iter, value);
return RET_OK;
}
iter = iter->next;

View File

@ -3052,20 +3052,7 @@ ret_t widget_set_style(widget_t* widget, const char* state_and_name, const value
widget_invalidate(widget, NULL);
if (strstr(name, "_color") != NULL && value->type == VALUE_TYPE_STRING) {
value_t v;
color_t c = color_parse(value_str(value));
value_set_uint32(&v, c.color);
return style_set(widget->astyle, state, name, &v);
} else if (tk_str_eq(name, STYLE_ID_BORDER) && value->type == VALUE_TYPE_STRING) {
value_t v;
value_set_uint32(&v, border_from_str(value_str(value)));
return style_set(widget->astyle, state, name, &v);
} else {
return style_set(widget->astyle, state, name, value);
}
return style_set(widget->astyle, state, name, value);
}
ret_t widget_set_style_int(widget_t* widget, const char* state_and_name, int32_t value) {

View File

@ -100,11 +100,11 @@ TEST(StyleMutable, copy) {
style_t* m2 = style_mutable_create(NULL, NULL);
style_mutable_set_int(m1, "normal", "font_size", 123);
style_mutable_set_str(m1, "normal", "font", "foo");
style_mutable_set_str(m1, "normal", "font_name", "foo");
style_mutable_set_color(m1, "normal", "text_color", c1);
style_mutable_set_int(m1, "focused", "font_size", 321);
style_mutable_set_str(m1, "focused", "font", "foo2");
style_mutable_set_str(m1, "focused", "font_name", "foo2");
style_mutable_set_color(m1, "focused", "text_color", c2);
style_mutable_copy(m2, m1);
@ -114,9 +114,10 @@ TEST(StyleMutable, copy) {
style_mutable_foreach(m2, on_style_item, &str2);
ASSERT_EQ(str1, str2);
ASSERT_EQ(str1,
string("normal,font_size,123;normal,font,\"foo\";normal,text_color,67305985;focused,"
"font_size,321;focused,font,\"foo2\";focused,text_color,67305986;"));
ASSERT_EQ(
str1,
string("normal,font_size,123;normal,font_name,\"foo\";normal,text_color,67305985;focused,"
"font_size,321;focused,font_name,\"foo2\";focused,text_color,67305986;"));
style_destroy(m1);
style_destroy(m2);

144
tests/style_test.cc Normal file
View File

@ -0,0 +1,144 @@
#include "gtest/gtest.h"
#include "widgets/button.h"
#include "tkc/value.h"
#include "base/window.h"
#include "base/style_mutable.h"
#include <string>
using std::string;
TEST(Style, normalize_int) {
value_t v;
ASSERT_EQ(style_normalize_value("font_size", "16", &v), RET_OK);
ASSERT_EQ(v.type, VALUE_TYPE_INT32);
ASSERT_EQ(value_int(&v), 16);
}
TEST(Style, normalize_str) {
value_t v;
ASSERT_EQ(style_normalize_value("font_name", "sans", &v), RET_OK);
ASSERT_EQ(v.type, VALUE_TYPE_STRING);
ASSERT_STREQ(value_str(&v), "sans");
}
TEST(Style, normalize_border_left_right) {
value_t v;
uint32_t v32 = 0;
ASSERT_EQ(style_normalize_value("border", "left|right", &v), RET_OK);
ASSERT_EQ(v.type, VALUE_TYPE_INT32);
v32 = value_uint32(&v);
ASSERT_EQ((v32 & BORDER_LEFT) != 0, true);
ASSERT_EQ((v32 & BORDER_RIGHT) != 0, true);
ASSERT_EQ((v32 & BORDER_TOP) == 0, true);
ASSERT_EQ((v32 & BORDER_BOTTOM) == 0, true);
}
TEST(Style, normalize_border_top_bottom) {
value_t v;
uint32_t v32 = 0;
ASSERT_EQ(style_normalize_value("border", "top|bottom", &v), RET_OK);
ASSERT_EQ(v.type, VALUE_TYPE_INT32);
v32 = value_uint32(&v);
ASSERT_EQ((v32 & BORDER_LEFT) == 0, true);
ASSERT_EQ((v32 & BORDER_RIGHT) == 0, true);
ASSERT_EQ((v32 & BORDER_TOP) != 0, true);
ASSERT_EQ((v32 & BORDER_BOTTOM) != 0, true);
}
TEST(Style, normalize_border_all) {
value_t v;
uint32_t v32 = 0;
ASSERT_EQ(style_normalize_value("border", "all", &v), RET_OK);
ASSERT_EQ(v.type, VALUE_TYPE_INT32);
v32 = value_uint32(&v);
ASSERT_EQ((v32 & BORDER_LEFT) != 0, true);
ASSERT_EQ((v32 & BORDER_RIGHT) != 0, true);
ASSERT_EQ((v32 & BORDER_TOP) != 0, true);
ASSERT_EQ((v32 & BORDER_BOTTOM) != 0, true);
}
TEST(Style, normalize_icon_at_left) {
value_t v;
uint32_t v32 = 0;
ASSERT_EQ(style_normalize_value("icon_at", "left", &v), RET_OK);
ASSERT_EQ(v.type, VALUE_TYPE_INT32);
v32 = value_uint32(&v);
ASSERT_EQ((v32 & ICON_AT_LEFT) != 0, true);
}
TEST(Style, normalize_icon_at_right) {
value_t v;
uint32_t v32 = 0;
ASSERT_EQ(style_normalize_value("icon_at", "right", &v), RET_OK);
ASSERT_EQ(v.type, VALUE_TYPE_INT32);
v32 = value_uint32(&v);
ASSERT_EQ((v32 & ICON_AT_RIGHT) != 0, true);
}
TEST(Style, normalize_icon_at_top) {
value_t v;
uint32_t v32 = 0;
ASSERT_EQ(style_normalize_value("icon_at", "top", &v), RET_OK);
ASSERT_EQ(v.type, VALUE_TYPE_INT32);
v32 = value_uint32(&v);
ASSERT_EQ((v32 & ICON_AT_TOP) != 0, true);
}
TEST(Style, normalize_icon_at_bottom) {
value_t v;
uint32_t v32 = 0;
ASSERT_EQ(style_normalize_value("icon_at", "bottom", &v), RET_OK);
ASSERT_EQ(v.type, VALUE_TYPE_INT32);
v32 = value_uint32(&v);
ASSERT_EQ((v32 & ICON_AT_BOTTOM) != 0, true);
}
TEST(Style, normalize_draw_type) {
value_t v;
ASSERT_EQ(style_normalize_value("fg_image_draw_type", "center", &v), RET_OK);
ASSERT_EQ(IMAGE_DRAW_CENTER, value_int(&v));
ASSERT_EQ(style_normalize_value("fg_image_draw_type", "scale_w", &v), RET_OK);
ASSERT_EQ(IMAGE_DRAW_SCALE_W, value_int(&v));
}
TEST(Style, normalize_text_align_h) {
value_t v;
ASSERT_EQ(style_normalize_value("text_align_h", "center", &v), RET_OK);
ASSERT_EQ(ALIGN_H_CENTER, value_int(&v));
ASSERT_EQ(style_normalize_value("text_align_h", "left", &v), RET_OK);
ASSERT_EQ(ALIGN_H_LEFT, value_int(&v));
ASSERT_EQ(style_normalize_value("text_align_h", "right", &v), RET_OK);
ASSERT_EQ(ALIGN_H_RIGHT, value_int(&v));
}
TEST(Style, normalize_text_align_v) {
value_t v;
ASSERT_EQ(style_normalize_value("text_align_v", "top", &v), RET_OK);
ASSERT_EQ(ALIGN_V_TOP, value_int(&v));
ASSERT_EQ(style_normalize_value("text_align_v", "middle", &v), RET_OK);
ASSERT_EQ(ALIGN_V_MIDDLE, value_int(&v));
ASSERT_EQ(style_normalize_value("text_align_v", "bottom", &v), RET_OK);
ASSERT_EQ(ALIGN_V_BOTTOM, value_int(&v));
}
TEST(Style, normalize_color) {
value_t v;
ASSERT_EQ(style_normalize_value("bg_color", "#112233", &v), RET_OK);
ASSERT_EQ(0xff332211, value_uint32(&v));
ASSERT_EQ(style_normalize_value("bg_color", "white", &v), RET_OK);
ASSERT_EQ(0xffffffff, value_uint32(&v));
}

View File

@ -22,6 +22,7 @@
#include "theme_gen.h"
#include "base/enums.h"
#include "base/theme.h"
#include "base/style.h"
#include "base/widget.h"
#include "common/utils.h"
#include "xml_theme_gen.h"
@ -40,82 +41,23 @@ typedef struct _xml_builder_t {
string widget_type;
} xml_builder_t;
static color_t parse_color(const char* name) {
color_t c = color_parse(name);
return c;
}
static uint32_t to_border(const char* value) {
uint32_t border = 0;
if (strstr(value, "left")) {
border |= BORDER_LEFT;
}
if (strstr(value, "right")) {
border |= BORDER_RIGHT;
}
if (strstr(value, "top")) {
border |= BORDER_TOP;
}
if (strstr(value, "bottom")) {
border |= BORDER_BOTTOM;
}
if (strstr(value, "all")) {
border |= BORDER_ALL;
}
return border;
}
static uint32_t to_icon_at(const char* value) {
uint32_t icon_at = ICON_AT_AUTO;
if (strstr(value, "left")) {
icon_at = ICON_AT_LEFT;
}
if (strstr(value, "right")) {
icon_at = ICON_AT_RIGHT;
}
if (strstr(value, "top")) {
icon_at = ICON_AT_TOP;
}
if (strstr(value, "bottom")) {
icon_at = ICON_AT_BOTTOM;
}
return icon_at;
}
static void xml_gen_style(xml_builder_t* b, Style& s, const char** attrs) {
value_t v;
uint32_t i = 0;
value_set_int(&v, 0);
while (attrs[i]) {
const char* name = attrs[i];
const char* value = attrs[i + 1];
ENSURE(style_normalize_value(name, value, &v) == RET_OK);
if (strcmp(name, "name") == 0) {
} else if (strcmp(name, "bg_image_draw_type") == 0 || strcmp(name, "fg_image_draw_type") == 0) {
const key_type_value_t* dt = image_draw_type_find(value);
s.AddInt(name, dt->value);
} else if (strcmp(name, "text_align_h") == 0) {
const key_type_value_t* dt = align_h_type_find(value);
s.AddInt(name, dt->value);
} else if (strcmp(name, "text_align_v") == 0) {
const key_type_value_t* dt = align_v_type_find(value);
s.AddInt(name, dt->value);
} else if (strcmp(name, "border") == 0) {
uint32_t border = to_border(value);
s.AddInt(name, border);
} else if (strcmp(name, "icon_at") == 0) {
uint32_t icon_at = to_icon_at(value);
s.AddInt(name, icon_at);
} else if (strstr(name, "color") != NULL) {
s.AddInt(name, parse_color(value).color);
} else if (strstr(name, "image") != NULL || strstr(name, "name") != NULL ||
strstr(name, "icon") != NULL) {
s.AddString(name, value);
} else {
s.AddInt(name, tk_atoi(value));
if (strcmp(name, "name") != 0) {
if (v.type == VALUE_TYPE_STRING) {
s.AddString(name, value_str(&v));
} else {
s.AddInt(name, value_int(&v));
}
value_reset(&v);
}
i += 2;