1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

Formatting all source file (*.c) in accordance with project coding style, using the astyle tool and the rules file _astylerc-c.

This commit is contained in:
Alexander 2018-06-18 13:51:01 +03:00
parent 6038064e71
commit 8e9335d49f
74 changed files with 144657 additions and 144706 deletions

View File

@ -267,11 +267,9 @@ static void indev_proc_task(void * param)
if(i->driver.type == LV_INDEV_TYPE_POINTER) { if(i->driver.type == LV_INDEV_TYPE_POINTER) {
indev_pointer_proc(i, &data); indev_pointer_proc(i, &data);
} } else if(i->driver.type == LV_INDEV_TYPE_KEYPAD) {
else if(i->driver.type == LV_INDEV_TYPE_KEYPAD) {
indev_keypad_proc(i, &data); indev_keypad_proc(i, &data);
} } else if(i->driver.type == LV_INDEV_TYPE_BUTTON) {
else if(i->driver.type == LV_INDEV_TYPE_BUTTON) {
indev_button_proc(i, &data); indev_button_proc(i, &data);
} }
/*Handle reset query if it happened in during processing*/ /*Handle reset query if it happened in during processing*/
@ -295,8 +293,7 @@ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
/*Move the cursor if set and moved*/ /*Move the cursor if set and moved*/
if(i->cursor != NULL && if(i->cursor != NULL &&
(i->proc.last_point.x != data->point.x || (i->proc.last_point.x != data->point.x ||
i->proc.last_point.y != data->point.y)) i->proc.last_point.y != data->point.y)) {
{
lv_obj_set_pos(i->cursor, data->point.x, data->point.y); lv_obj_set_pos(i->cursor, data->point.x, data->point.y);
} }
@ -333,16 +330,14 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
/*Key press happened*/ /*Key press happened*/
if(data->state == LV_INDEV_STATE_PR && if(data->state == LV_INDEV_STATE_PR &&
i->proc.last_state == LV_INDEV_STATE_REL) i->proc.last_state == LV_INDEV_STATE_REL) {
{
i->proc.pr_timestamp = lv_tick_get(); i->proc.pr_timestamp = lv_tick_get();
} }
/*Pressing*/ /*Pressing*/
else if(data->state == LV_INDEV_STATE_PR && i->proc.last_state == LV_INDEV_STATE_PR) { else if(data->state == LV_INDEV_STATE_PR && i->proc.last_state == LV_INDEV_STATE_PR) {
if(data->key == LV_GROUP_KEY_ENTER && if(data->key == LV_GROUP_KEY_ENTER &&
i->proc.long_pr_sent == 0 && i->proc.long_pr_sent == 0 &&
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME) lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME) {
{
lv_group_send_data(i->group, LV_GROUP_KEY_ENTER_LONG); lv_group_send_data(i->group, LV_GROUP_KEY_ENTER_LONG);
i->proc.long_pr_sent = 1; i->proc.long_pr_sent = 1;
@ -350,18 +345,15 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
} }
} }
/*Release happened*/ /*Release happened*/
else if(data->state == LV_INDEV_STATE_REL && i->proc.last_state == LV_INDEV_STATE_PR) else if(data->state == LV_INDEV_STATE_REL && i->proc.last_state == LV_INDEV_STATE_PR) {
{
/*The user might clear the key it was released. Always release the pressed key*/ /*The user might clear the key it was released. Always release the pressed key*/
data->key = i->proc.last_key; data->key = i->proc.last_key;
if(data->key == LV_GROUP_KEY_NEXT) { if(data->key == LV_GROUP_KEY_NEXT) {
lv_group_focus_next(i->group); lv_group_focus_next(i->group);
} } else if(data->key == LV_GROUP_KEY_PREV) {
else if(data->key == LV_GROUP_KEY_PREV) {
lv_group_focus_prev(i->group); lv_group_focus_prev(i->group);
} } else if(data->key == LV_GROUP_KEY_ENTER && i->proc.long_pr_sent) {
else if(data->key == LV_GROUP_KEY_ENTER && i->proc.long_pr_sent) {
/*Do nothing. Don't send the ENTER if ENTER_LONG was sent*/ /*Do nothing. Don't send the ENTER if ENTER_LONG was sent*/
} else { } else {
lv_group_send_data(i->group, data->key); lv_group_send_data(i->group, data->key);
@ -643,8 +635,7 @@ static void indev_drag(lv_indev_proc_t * state)
/*If a move is greater then LV_DRAG_LIMIT then begin the drag*/ /*If a move is greater then LV_DRAG_LIMIT then begin the drag*/
if(LV_MATH_ABS(state->drag_sum.x) >= LV_INDEV_DRAG_LIMIT || if(LV_MATH_ABS(state->drag_sum.x) >= LV_INDEV_DRAG_LIMIT ||
LV_MATH_ABS(state->drag_sum.y) >= LV_INDEV_DRAG_LIMIT) LV_MATH_ABS(state->drag_sum.y) >= LV_INDEV_DRAG_LIMIT) {
{
state->drag_range_out = 1; state->drag_range_out = 1;
} }
} }
@ -713,8 +704,7 @@ static void indev_drag_throw(lv_indev_proc_t * state)
state->vect.y = state->vect.y * (100 - LV_INDEV_DRAG_THROW) / 100; state->vect.y = state->vect.y * (100 - LV_INDEV_DRAG_THROW) / 100;
if(state->vect.x != 0 || if(state->vect.x != 0 ||
state->vect.y != 0) state->vect.y != 0) {
{
/*Get the coordinates and modify them*/ /*Get the coordinates and modify them*/
lv_coord_t act_x = lv_obj_get_x(drag_obj) + state->vect.x; lv_coord_t act_x = lv_obj_get_x(drag_obj) + state->vect.x;
lv_coord_t act_y = lv_obj_get_y(drag_obj) + state->vect.y; lv_coord_t act_y = lv_obj_get_y(drag_obj) + state->vect.y;

View File

@ -166,8 +166,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
new_obj->ext_attr = NULL; new_obj->ext_attr = NULL;
} }
/*parent != NULL create normal obj. on a parent*/ /*parent != NULL create normal obj. on a parent*/
else else {
{
new_obj = lv_ll_ins_head(&(parent)->child_ll); new_obj = lv_ll_ins_head(&(parent)->child_ll);
new_obj->par = parent; /*Set the parent*/ new_obj->par = parent; /*Set the parent*/
@ -350,8 +349,7 @@ void lv_obj_invalidate(lv_obj_t * obj)
lv_obj_t * obj_scr = lv_obj_get_screen(obj); lv_obj_t * obj_scr = lv_obj_get_screen(obj);
if(obj_scr == lv_scr_act() || if(obj_scr == lv_scr_act() ||
obj_scr == lv_layer_top() || obj_scr == lv_layer_top() ||
obj_scr == lv_layer_sys()) obj_scr == lv_layer_sys()) {
{
/*Truncate recursively to the parents*/ /*Truncate recursively to the parents*/
lv_area_t area_trunc; lv_area_t area_trunc;
lv_obj_t * par = lv_obj_get_parent(obj); lv_obj_t * par = lv_obj_get_parent(obj);
@ -578,8 +576,7 @@ void lv_obj_align(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, lv_coord_t x
base = lv_obj_get_parent(obj); base = lv_obj_get_parent(obj);
} }
switch(align) switch(align) {
{
case LV_ALIGN_CENTER: case LV_ALIGN_CENTER:
new_x = lv_obj_get_width(base) / 2 - lv_obj_get_width(obj) / 2; new_x = lv_obj_get_width(base) / 2 - lv_obj_get_width(obj) / 2;
new_y = lv_obj_get_height(base) / 2 - lv_obj_get_height(obj) / 2; new_y = lv_obj_get_height(base) / 2 - lv_obj_get_height(obj) / 2;
@ -1046,8 +1043,7 @@ lv_obj_t * lv_obj_get_screen(lv_obj_t * obj)
do { do {
act_p = par; act_p = par;
par = lv_obj_get_parent(act_p); par = lv_obj_get_parent(act_p);
} } while(par != NULL);
while(par != NULL);
return act_p; return act_p;
} }
@ -1488,14 +1484,11 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
if(sign == LV_SIGNAL_CHILD_CHG) { if(sign == LV_SIGNAL_CHILD_CHG) {
/*Return 'invalid' if the child change signal is not enabled*/ /*Return 'invalid' if the child change signal is not enabled*/
if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) res = LV_RES_INV; if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) res = LV_RES_INV;
} } else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
if(style->body.shadow.width > obj->ext_size) obj->ext_size = style->body.shadow.width; if(style->body.shadow.width > obj->ext_size) obj->ext_size = style->body.shadow.width;
} } else if(sign == LV_SIGNAL_STYLE_CHG) {
else if(sign == LV_SIGNAL_STYLE_CHG) {
lv_obj_refresh_ext_size(obj); lv_obj_refresh_ext_size(obj);
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
buf->type[0] = "lv_obj"; buf->type[0] = "lv_obj";
} }

View File

@ -21,8 +21,7 @@
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
typedef struct typedef struct {
{
lv_area_t area; lv_area_t area;
uint8_t joined; uint8_t joined;
} lv_join_t; } lv_join_t;
@ -211,8 +210,7 @@ static void lv_refr_join_area(void)
/*Check if the areas are on each other*/ /*Check if the areas are on each other*/
if(lv_area_is_on(&inv_buf[join_in].area, if(lv_area_is_on(&inv_buf[join_in].area,
&inv_buf[join_from].area) == false) &inv_buf[join_from].area) == false) {
{
continue; continue;
} }
@ -360,8 +358,7 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
lv_obj_t * found_p = NULL; lv_obj_t * found_p = NULL;
/*If this object is fully cover the draw area check the children too */ /*If this object is fully cover the draw area check the children too */
if(lv_area_is_in(area_p, &obj->coords) && obj->hidden == 0) if(lv_area_is_in(area_p, &obj->coords) && obj->hidden == 0) {
{
LL_READ(obj->child_ll, i) { LL_READ(obj->child_ll, i) {
found_p = lv_refr_get_top_obj(area_p, i); found_p = lv_refr_get_top_obj(area_p, i);
@ -473,8 +470,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
lv_area_t mask_child; /*Mask from obj and its child*/ lv_area_t mask_child; /*Mask from obj and its child*/
lv_obj_t * child_p; lv_obj_t * child_p;
lv_area_t child_area; lv_area_t child_area;
LL_READ_BACK(obj->child_ll, child_p) LL_READ_BACK(obj->child_ll, child_p) {
{
lv_obj_get_coords(child_p, &child_area); lv_obj_get_coords(child_p, &child_area);
ext_size = child_p->ext_size; ext_size = child_p->ext_size;
child_area.x1 -= ext_size; child_area.x1 -= ext_size;

View File

@ -34,8 +34,7 @@
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
typedef enum typedef enum {
{
CMD_STATE_WAIT, CMD_STATE_WAIT,
CMD_STATE_PAR, CMD_STATE_PAR,
CMD_STATE_IN, CMD_STATE_IN,
@ -219,8 +218,7 @@ void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_colo
dy1 = LV_MATH_ABS(tri[1].y - tri[2].y); dy1 = LV_MATH_ABS(tri[1].y - tri[2].y);
sy1 = tri[1].y < tri[2].y ? 1 : -1; sy1 = tri[1].y < tri[2].y ? 1 : -1;
err1 = (dx1 > dy1 ? dx1 : -dy1) / 2; err1 = (dx1 > dy1 ? dx1 : -dy1) / 2;
} } else if(edge1.x == tri[2].x && edge1.y == tri[2].y) return;
else if (edge1.x == tri[2].x && edge1.y == tri[2].y) return;
err_tmp1 = err1; err_tmp1 = err1;
if(err_tmp1 > -dx1) { if(err_tmp1 > -dx1) {
err1 -= dy1; err1 -= dy1;
@ -421,10 +419,17 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
uint8_t px_size = 0; uint8_t px_size = 0;
switch(img_data.header.format) { switch(img_data.header.format) {
case LV_IMG_FORMAT_FILE_RAW_RGB332: px_size = 1; break; case LV_IMG_FORMAT_FILE_RAW_RGB332:
case LV_IMG_FORMAT_FILE_RAW_RGB565: px_size = 2; break; px_size = 1;
case LV_IMG_FORMAT_FILE_RAW_RGB888: px_size = 4; break; break;
default: return; case LV_IMG_FORMAT_FILE_RAW_RGB565:
px_size = 2;
break;
case LV_IMG_FORMAT_FILE_RAW_RGB888:
px_size = 4;
break;
default:
return;
} }
if(img_data.header.alpha_byte) { /*Correction with the alpha byte*/ if(img_data.header.alpha_byte) { /*Correction with the alpha byte*/
@ -477,8 +482,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
} }
} }
#endif #endif
} } else {
else {
const lv_img_t * img_var = src; const lv_img_t * img_var = src;
lv_area_t mask_com; /*Common area of mask and coords*/ lv_area_t mask_com; /*Common area of mask and coords*/
bool union_ok; bool union_ok;
@ -838,8 +842,7 @@ static void lv_draw_rect_main_mid(const lv_area_t * coords, const lv_area_t * ma
} }
if(row_start < 0) row_start = 0; if(row_start < 0) row_start = 0;
for(row = row_start; row <= row_end; row ++) for(row = row_start; row <= row_end; row ++) {
{
work_area.y1 = row; work_area.y1 = row;
work_area.y2 = row; work_area.y2 = row;
mix = (uint32_t)((uint32_t)(coords->y2 - work_area.y1) * 255) / height; mix = (uint32_t)((uint32_t)(coords->y2 - work_area.y1) * 255) / height;
@ -1809,8 +1812,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
if(col_rel < -swidth) { /*Outside of the blurred area. */ if(col_rel < -swidth) { /*Outside of the blurred area. */
if(line_rel == -swidth) line_ready = true; /*If no data even on the very first line then it wont't be anything else in this line*/ if(line_rel == -swidth) line_ready = true; /*If no data even on the very first line then it wont't be anything else in this line*/
break; /*Break anyway because only smaller 'col_rel' values will come */ break; /*Break anyway because only smaller 'col_rel' values will come */
} } else if(col_rel > swidth) px_opa_sum += line_1d_blur[0]; /*Inside the not blurred area*/
else if (col_rel > swidth) px_opa_sum += line_1d_blur[0]; /*Inside the not blurred area*/
else px_opa_sum += line_1d_blur[swidth - col_rel]; /*On the 1D blur (+ swidth to align to the center)*/ else px_opa_sum += line_1d_blur[swidth - col_rel]; /*On the 1D blur (+ swidth to align to the center)*/
} }
@ -2071,7 +2073,8 @@ static lv_opa_t antialias_get_opa(lv_coord_t seg, lv_coord_t px_id, lv_opa_t lin
static const lv_opa_t seg8[8] = {16, 48, 80, 112, 143, 175, 207, 239}; static const lv_opa_t seg8[8] = {16, 48, 80, 112, 143, 175, 207, 239};
static const lv_opa_t * seg_map[] = {seg1, seg2, seg3, seg4, static const lv_opa_t * seg_map[] = {seg1, seg2, seg3, seg4,
seg5, seg6, seg7, seg8}; seg5, seg6, seg7, seg8
};
if(seg == 0) return LV_OPA_TRANSP; if(seg == 0) return LV_OPA_TRANSP;
else if(seg < 8) return (uint32_t)((uint32_t)seg_map[seg - 1][px_id] * line_opa) >> 8; else if(seg < 8) return (uint32_t)((uint32_t)seg_map[seg - 1][px_id] * line_opa) >> 8;
@ -2121,13 +2124,20 @@ static uint8_t hex_char_to_num(char hex)
if(hex >= 'a') hex -= 'a' - 'A'; /*Convert to upper case*/ if(hex >= 'a') hex -= 'a' - 'A'; /*Convert to upper case*/
switch(hex) { switch(hex) {
case 'A': return 10; case 'A':
case 'B': return 11; return 10;
case 'C': return 12; case 'B':
case 'D': return 13; return 11;
case 'E': return 14; case 'C':
case 'F': return 15; return 12;
default: return 0; case 'D':
return 13;
case 'E':
return 14;
case 'F':
return 15;
default:
return 0;
} }
return 0; return 0;

View File

@ -108,7 +108,8 @@ void lv_rletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
static uint8_t bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/ static uint8_t bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
68, 85, 102, 119, 68, 85, 102, 119,
136, 153, 170, 187, 136, 153, 170, 187,
204, 221, 238, 255}; 204, 221, 238, 255
};
if(font_p == NULL) return; if(font_p == NULL) return;
@ -120,11 +121,24 @@ void lv_rletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
uint8_t mask; uint8_t mask;
switch(bpp) { switch(bpp) {
case 1: bpp_opa_table = bpp1_opa_table; mask_init = 0x80; break; case 1:
case 2: bpp_opa_table = bpp2_opa_table; mask_init = 0xC0; break; bpp_opa_table = bpp1_opa_table;
case 4: bpp_opa_table = bpp4_opa_table; mask_init = 0xF0; break; mask_init = 0x80;
case 8: bpp_opa_table = NULL; mask_init = 0xFF; break; /*No opa table, pixel value will be used directly*/ break;
default: return; /*Invalid bpp. Can't render the letter*/ case 2:
bpp_opa_table = bpp2_opa_table;
mask_init = 0xC0;
break;
case 4:
bpp_opa_table = bpp4_opa_table;
mask_init = 0xF0;
break;
case 8:
bpp_opa_table = NULL;
mask_init = 0xFF;
break; /*No opa table, pixel value will be used directly*/
default:
return; /*Invalid bpp. Can't render the letter*/
} }
const uint8_t * map_p = lv_font_get_bitmap(font_p, letter); const uint8_t * map_p = lv_font_get_bitmap(font_p, letter);
@ -166,8 +180,7 @@ void lv_rletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
if(col_bit < 8 - bpp) { if(col_bit < 8 - bpp) {
col_bit += bpp; col_bit += bpp;
mask = mask >> bpp; mask = mask >> bpp;
} } else {
else {
col_bit = 0; col_bit = 0;
col_byte_cnt ++; col_byte_cnt ++;
mask = mask_init; mask = mask_init;

View File

@ -77,8 +77,7 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
lv_color_t * vdb_px_p = vdb_p->buf + y * vdb_width + x; lv_color_t * vdb_px_p = vdb_p->buf + y * vdb_width + x;
if(opa == LV_OPA_COVER) { if(opa == LV_OPA_COVER) {
*vdb_px_p = color; *vdb_px_p = color;
} } else {
else {
*vdb_px_p = lv_color_mix(color, *vdb_px_p, opa); *vdb_px_p = lv_color_mix(color, *vdb_px_p, opa);
} }
@ -140,8 +139,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
} }
/*Use hw blend if present and the area is not too small*/ /*Use hw blend if present and the area is not too small*/
else if(lv_area_get_height(&vdb_rel_a) > VFILL_HW_ACC_SIZE_LIMIT && else if(lv_area_get_height(&vdb_rel_a) > VFILL_HW_ACC_SIZE_LIMIT &&
lv_disp_is_mem_blend_supported()) lv_disp_is_mem_blend_supported()) {
{
/*Fill a one line sized buffer with a color and blend this later*/ /*Fill a one line sized buffer with a color and blend this later*/
if(color_array_tmp[0].full != color.full || last_width != w) { if(color_array_tmp[0].full != color.full || last_width != w) {
uint16_t i; uint16_t i;
@ -214,7 +212,8 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
static uint8_t bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/ static uint8_t bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
68, 85, 102, 119, 68, 85, 102, 119,
136, 153, 170, 187, 136, 153, 170, 187,
204, 221, 238, 255}; 204, 221, 238, 255
};
if(font_p == NULL) return; if(font_p == NULL) return;
@ -226,11 +225,24 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
uint8_t mask; uint8_t mask;
switch(bpp) { switch(bpp) {
case 1: bpp_opa_table = bpp1_opa_table; mask_init = 0x80; break; case 1:
case 2: bpp_opa_table = bpp2_opa_table; mask_init = 0xC0; break; bpp_opa_table = bpp1_opa_table;
case 4: bpp_opa_table = bpp4_opa_table; mask_init = 0xF0; break; mask_init = 0x80;
case 8: bpp_opa_table = NULL; mask_init = 0xFF; break; /*No opa table, pixel value will be used directly*/ break;
default: return; /*Invalid bpp. Can't render the letter*/ case 2:
bpp_opa_table = bpp2_opa_table;
mask_init = 0xC0;
break;
case 4:
bpp_opa_table = bpp4_opa_table;
mask_init = 0xF0;
break;
case 8:
bpp_opa_table = NULL;
mask_init = 0xFF;
break; /*No opa table, pixel value will be used directly*/
default:
return; /*Invalid bpp. Can't render the letter*/
} }
const uint8_t * map_p = lv_font_get_bitmap(font_p, letter); const uint8_t * map_p = lv_font_get_bitmap(font_p, letter);
@ -290,8 +302,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
if(col_bit < 8 - bpp) { if(col_bit < 8 - bpp) {
col_bit += bpp; col_bit += bpp;
mask = mask >> bpp; mask = mask >> bpp;
} } else {
else {
col_bit = 0; col_bit = 0;
col_byte_cnt ++; col_byte_cnt ++;
mask = mask_init; mask = mask_init;
@ -400,8 +411,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_opa_t px_opa = *(px_color_p + LV_IMG_PX_SIZE_ALPHA_BYTE - 1); lv_opa_t px_opa = *(px_color_p + LV_IMG_PX_SIZE_ALPHA_BYTE - 1);
if(px_opa == LV_OPA_TRANSP) continue; if(px_opa == LV_OPA_TRANSP) continue;
else if(px_opa != LV_OPA_COVER) opa_result = (uint32_t)((uint32_t)px_opa * opa_result) >> 8; else if(px_opa != LV_OPA_COVER) opa_result = (uint32_t)((uint32_t)px_opa * opa_result) >> 8;
} } else {
else {
px_color = *((lv_color_t *)px_color_p); px_color = *((lv_color_t *)px_color_p);
} }

View File

@ -118,8 +118,7 @@ bool lv_area_union(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t *
/*If x1 or y1 greater then x2 or y2 then the areas union is empty*/ /*If x1 or y1 greater then x2 or y2 then the areas union is empty*/
bool union_ok = true; bool union_ok = true;
if((res_p->x1 > res_p->x2) || if((res_p->x1 > res_p->x2) ||
(res_p->y1 > res_p->y2)) (res_p->y1 > res_p->y2)) {
{
union_ok = false; union_ok = false;
} }
@ -150,8 +149,7 @@ bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p)
bool is_on = false; bool is_on = false;
if((p_p->x >= a_p->x1 && p_p->x <= a_p->x2) && if((p_p->x >= a_p->x1 && p_p->x <= a_p->x2) &&
((p_p->y >= a_p->y1 && p_p->y <= a_p->y2))) ((p_p->y >= a_p->y1 && p_p->y <= a_p->y2))) {
{
is_on = true; is_on = true;
} }
@ -169,8 +167,7 @@ bool lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p)
if((a1_p->x1 <= a2_p->x2) && if((a1_p->x1 <= a2_p->x2) &&
(a1_p->x2 >= a2_p->x1) && (a1_p->x2 >= a2_p->x1) &&
(a1_p->y1 <= a2_p->y2) && (a1_p->y1 <= a2_p->y2) &&
(a1_p->y2 >= a2_p->y1)) (a1_p->y2 >= a2_p->y1)) {
{
return true; return true;
} else { } else {
return false; return false;
@ -191,8 +188,7 @@ bool lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p)
if(ain_p->x1 >= aholder_p->x1 && if(ain_p->x1 >= aholder_p->x1 &&
ain_p->y1 >= aholder_p->y1 && ain_p->y1 >= aholder_p->y1 &&
ain_p->x2 <= aholder_p->x2 && ain_p->x2 <= aholder_p->x2 &&
ain_p->y2 <= aholder_p->y2) ain_p->y2 <= aholder_p->y2) {
{
is_in = true; is_in = true;
} }

View File

@ -53,8 +53,7 @@ lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v)
uint8_t region, remainder, p, q, t; uint8_t region, remainder, p, q, t;
if (s == 0) if(s == 0) {
{
r = v; r = v;
g = v; g = v;
b = v; b = v;
@ -68,25 +67,36 @@ lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v)
q = (v * (255 - ((s * remainder) >> 8))) >> 8; q = (v * (255 - ((s * remainder) >> 8))) >> 8;
t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8; t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8;
switch (region) switch(region) {
{
case 0: case 0:
r = v; g = t; b = p; r = v;
g = t;
b = p;
break; break;
case 1: case 1:
r = q; g = v; b = p; r = q;
g = v;
b = p;
break; break;
case 2: case 2:
r = p; g = v; b = t; r = p;
g = v;
b = t;
break; break;
case 3: case 3:
r = p; g = q; b = v; r = p;
g = q;
b = v;
break; break;
case 4: case 4:
r = t; g = p; b = v; r = t;
g = p;
b = v;
break; break;
default: default:
r = v; g = p; b = q; r = v;
g = p;
b = q;
break; break;
} }
@ -110,16 +120,14 @@ lv_color_hsv_t lv_color_rgb_to_hsv(uint8_t r, uint8_t g, uint8_t b)
rgbMax = r > g ? (r > b ? r : b) : (g > b ? g : b); rgbMax = r > g ? (r > b ? r : b) : (g > b ? g : b);
hsv.v = rgbMax; hsv.v = rgbMax;
if (hsv.v == 0) if(hsv.v == 0) {
{
hsv.h = 0; hsv.h = 0;
hsv.s = 0; hsv.s = 0;
return hsv; return hsv;
} }
hsv.s = 255 * (long)(rgbMax - rgbMin) / hsv.v; hsv.s = 255 * (long)(rgbMax - rgbMin) / hsv.v;
if (hsv.s == 0) if(hsv.s == 0) {
{
hsv.h = 0; hsv.h = 0;
return hsv; return hsv;
} }

View File

@ -8,8 +8,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_dejavu_10_glyph_bitmap[] = static const uint8_t lv_font_dejavu_10_glyph_bitmap[] = {
{
#if USE_LV_FONT_DEJAVU_10 == 1 #if USE_LV_FONT_DEJAVU_10 == 1
/*Unicode: U+0020 ( ) , Width: 3 */ /*Unicode: U+0020 ( ) , Width: 3 */
0x00, //... 0x00, //...
@ -4963,8 +4962,7 @@ static const uint8_t lv_font_dejavu_10_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_dejavu_10_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_dejavu_10_glyph_dsc[] = {
{
#if USE_LV_FONT_DEJAVU_10 == 1 #if USE_LV_FONT_DEJAVU_10 == 1
{.w_px = 3, .glyph_index = 0}, /*Unicode: U+0020 ( )*/ {.w_px = 3, .glyph_index = 0}, /*Unicode: U+0020 ( )*/
{.w_px = 1, .glyph_index = 10}, /*Unicode: U+0021 (!)*/ {.w_px = 1, .glyph_index = 10}, /*Unicode: U+0021 (!)*/
@ -5356,8 +5354,7 @@ static const lv_font_glyph_dsc_t lv_font_dejavu_10_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_dejavu_10 = lv_font_t lv_font_dejavu_10 = {
{
.unicode_first = 32, /*First Unicode letter in this font*/ .unicode_first = 32, /*First Unicode letter in this font*/
.unicode_last = 126, /*Last Unicode letter in this font*/ .unicode_last = 126, /*Last Unicode letter in this font*/
.h_px = 10, /*Font height in pixels*/ .h_px = 10, /*Font height in pixels*/

View File

@ -8,8 +8,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_dejavu_10_cyrillic_glyph_bitmap[] = static const uint8_t lv_font_dejavu_10_cyrillic_glyph_bitmap[] = {
{
#if USE_LV_FONT_DEJAVU_10_CYRILLIC == 1 #if USE_LV_FONT_DEJAVU_10_CYRILLIC == 1
/*Unicode: U+0410 (А) , Width: 5 */ /*Unicode: U+0410 (А) , Width: 5 */
0x00, //..... 0x00, //.....
@ -3351,8 +3350,7 @@ static const uint8_t lv_font_dejavu_10_cyrillic_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_dejavu_10_cyrillic_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_dejavu_10_cyrillic_glyph_dsc[] = {
{
#if USE_LV_FONT_DEJAVU_10_CYRILLIC == 1 #if USE_LV_FONT_DEJAVU_10_CYRILLIC == 1
{.w_px = 5, .glyph_index = 0}, /*Unicode: U+0410 (А)*/ {.w_px = 5, .glyph_index = 0}, /*Unicode: U+0410 (А)*/
{.w_px = 4, .glyph_index = 10}, /*Unicode: U+0411 (Б)*/ {.w_px = 4, .glyph_index = 10}, /*Unicode: U+0411 (Б)*/
@ -3620,8 +3618,7 @@ static const lv_font_glyph_dsc_t lv_font_dejavu_10_cyrillic_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_dejavu_10_cyrillic = lv_font_t lv_font_dejavu_10_cyrillic = {
{
.unicode_first = 1040, /*First Unicode letter in this font*/ .unicode_first = 1040, /*First Unicode letter in this font*/
.unicode_last = 1103, /*Last Unicode letter in this font*/ .unicode_last = 1103, /*Last Unicode letter in this font*/
.h_px = 10, /*Font height in pixels*/ .h_px = 10, /*Font height in pixels*/

View File

@ -8,8 +8,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_dejavu_10_latin_sup_glyph_bitmap[] = static const uint8_t lv_font_dejavu_10_latin_sup_glyph_bitmap[] = {
{
#if USE_LV_FONT_DEJAVU_10_LATIN_SUP == 1 #if USE_LV_FONT_DEJAVU_10_LATIN_SUP == 1
/*Unicode: U+00a0 ( ) , Width: 3 */ /*Unicode: U+00a0 ( ) , Width: 3 */
0x00, //... 0x00, //...
@ -5015,8 +5014,7 @@ static const uint8_t lv_font_dejavu_10_latin_sup_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_dejavu_10_latin_sup_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_dejavu_10_latin_sup_glyph_dsc[] = {
{
#if USE_LV_FONT_DEJAVU_10_LATIN_SUP == 1 #if USE_LV_FONT_DEJAVU_10_LATIN_SUP == 1
{.w_px = 3, .glyph_index = 0}, /*Unicode: U+00a0 ( )*/ {.w_px = 3, .glyph_index = 0}, /*Unicode: U+00a0 ( )*/
{.w_px = 1, .glyph_index = 10}, /*Unicode: U+00a1 (¡)*/ {.w_px = 1, .glyph_index = 10}, /*Unicode: U+00a1 (¡)*/
@ -5412,8 +5410,7 @@ static const lv_font_glyph_dsc_t lv_font_dejavu_10_latin_sup_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_dejavu_10_latin_sup = lv_font_t lv_font_dejavu_10_latin_sup = {
{
.unicode_first = 160, /*First Unicode letter in this font*/ .unicode_first = 160, /*First Unicode letter in this font*/
.unicode_last = 255, /*Last Unicode letter in this font*/ .unicode_last = 255, /*Last Unicode letter in this font*/
.h_px = 10, /*Font height in pixels*/ .h_px = 10, /*Font height in pixels*/

View File

@ -8,8 +8,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_dejavu_20_glyph_bitmap[] = static const uint8_t lv_font_dejavu_20_glyph_bitmap[] = {
{
#if USE_LV_FONT_DEJAVU_20 == 1 #if USE_LV_FONT_DEJAVU_20 == 1
/*Unicode: U+0020 ( ) , Width: 6 */ /*Unicode: U+0020 ( ) , Width: 6 */
0x00, //...... 0x00, //......
@ -8763,8 +8762,7 @@ static const uint8_t lv_font_dejavu_20_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_dejavu_20_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_dejavu_20_glyph_dsc[] = {
{
#if USE_LV_FONT_DEJAVU_20 == 1 #if USE_LV_FONT_DEJAVU_20 == 1
{.w_px = 6, .glyph_index = 0}, /*Unicode: U+0020 ( )*/ {.w_px = 6, .glyph_index = 0}, /*Unicode: U+0020 ( )*/
{.w_px = 2, .glyph_index = 20}, /*Unicode: U+0021 (!)*/ {.w_px = 2, .glyph_index = 20}, /*Unicode: U+0021 (!)*/
@ -9156,8 +9154,7 @@ static const lv_font_glyph_dsc_t lv_font_dejavu_20_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_dejavu_20 = lv_font_t lv_font_dejavu_20 = {
{
.unicode_first = 32, /*First Unicode letter in this font*/ .unicode_first = 32, /*First Unicode letter in this font*/
.unicode_last = 126, /*Last Unicode letter in this font*/ .unicode_last = 126, /*Last Unicode letter in this font*/
.h_px = 20, /*Font height in pixels*/ .h_px = 20, /*Font height in pixels*/

View File

@ -8,8 +8,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_dejavu_20_cyrillic_glyph_bitmap[] = static const uint8_t lv_font_dejavu_20_cyrillic_glyph_bitmap[] = {
{
#if USE_LV_FONT_DEJAVU_20_CYRILLIC == 1 #if USE_LV_FONT_DEJAVU_20_CYRILLIC == 1
/*Unicode: U+0410 (А) , Width: 12 */ /*Unicode: U+0410 (А) , Width: 12 */
0x00, 0x00, //............ 0x00, 0x00, //............
@ -5911,8 +5910,7 @@ static const uint8_t lv_font_dejavu_20_cyrillic_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_dejavu_20_cyrillic_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_dejavu_20_cyrillic_glyph_dsc[] = {
{
#if USE_LV_FONT_DEJAVU_20_CYRILLIC == 1 #if USE_LV_FONT_DEJAVU_20_CYRILLIC == 1
{.w_px = 12, .glyph_index = 0}, /*Unicode: U+0410 (А)*/ {.w_px = 12, .glyph_index = 0}, /*Unicode: U+0410 (А)*/
{.w_px = 9, .glyph_index = 40}, /*Unicode: U+0411 (Б)*/ {.w_px = 9, .glyph_index = 40}, /*Unicode: U+0411 (Б)*/
@ -6180,8 +6178,7 @@ static const lv_font_glyph_dsc_t lv_font_dejavu_20_cyrillic_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_dejavu_20_cyrillic = lv_font_t lv_font_dejavu_20_cyrillic = {
{
.unicode_first = 1040, /*First Unicode letter in this font*/ .unicode_first = 1040, /*First Unicode letter in this font*/
.unicode_last = 1103, /*Last Unicode letter in this font*/ .unicode_last = 1103, /*Last Unicode letter in this font*/
.h_px = 20, /*Font height in pixels*/ .h_px = 20, /*Font height in pixels*/

View File

@ -8,8 +8,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_dejavu_20_latin_sup_glyph_bitmap[] = static const uint8_t lv_font_dejavu_20_latin_sup_glyph_bitmap[] = {
{
#if USE_LV_FONT_DEJAVU_20_LATIN_SUP == 1 #if USE_LV_FONT_DEJAVU_20_LATIN_SUP == 1
/*Unicode: U+00a0 ( ) , Width: 6 */ /*Unicode: U+00a0 ( ) , Width: 6 */
0x00, //...... 0x00, //......
@ -8855,8 +8854,7 @@ static const uint8_t lv_font_dejavu_20_latin_sup_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_dejavu_20_latin_sup_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_dejavu_20_latin_sup_glyph_dsc[] = {
{
#if USE_LV_FONT_DEJAVU_20_LATIN_SUP == 1 #if USE_LV_FONT_DEJAVU_20_LATIN_SUP == 1
{.w_px = 6, .glyph_index = 0}, /*Unicode: U+00a0 ( )*/ {.w_px = 6, .glyph_index = 0}, /*Unicode: U+00a0 ( )*/
{.w_px = 2, .glyph_index = 20}, /*Unicode: U+00a1 (¡)*/ {.w_px = 2, .glyph_index = 20}, /*Unicode: U+00a1 (¡)*/
@ -9252,8 +9250,7 @@ static const lv_font_glyph_dsc_t lv_font_dejavu_20_latin_sup_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_dejavu_20_latin_sup = lv_font_t lv_font_dejavu_20_latin_sup = {
{
.unicode_first = 160, /*First Unicode letter in this font*/ .unicode_first = 160, /*First Unicode letter in this font*/
.unicode_last = 255, /*Last Unicode letter in this font*/ .unicode_last = 255, /*Last Unicode letter in this font*/
.h_px = 20, /*Font height in pixels*/ .h_px = 20, /*Font height in pixels*/

View File

@ -8,8 +8,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_dejavu_30_glyph_bitmap[] = static const uint8_t lv_font_dejavu_30_glyph_bitmap[] = {
{
#if USE_LV_FONT_DEJAVU_30 == 1 #if USE_LV_FONT_DEJAVU_30 == 1
/*Unicode: U+0020 ( ) , Width: 8 */ /*Unicode: U+0020 ( ) , Width: 8 */
0x00, //........ 0x00, //........
@ -12563,8 +12562,7 @@ static const uint8_t lv_font_dejavu_30_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_dejavu_30_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_dejavu_30_glyph_dsc[] = {
{
#if USE_LV_FONT_DEJAVU_30 == 1 #if USE_LV_FONT_DEJAVU_30 == 1
{.w_px = 8, .glyph_index = 0}, /*Unicode: U+0020 ( )*/ {.w_px = 8, .glyph_index = 0}, /*Unicode: U+0020 ( )*/
{.w_px = 3, .glyph_index = 30}, /*Unicode: U+0021 (!)*/ {.w_px = 3, .glyph_index = 30}, /*Unicode: U+0021 (!)*/
@ -12956,8 +12954,7 @@ static const lv_font_glyph_dsc_t lv_font_dejavu_30_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_dejavu_30 = lv_font_t lv_font_dejavu_30 = {
{
.unicode_first = 32, /*First Unicode letter in this font*/ .unicode_first = 32, /*First Unicode letter in this font*/
.unicode_last = 126, /*Last Unicode letter in this font*/ .unicode_last = 126, /*Last Unicode letter in this font*/
.h_px = 30, /*Font height in pixels*/ .h_px = 30, /*Font height in pixels*/

View File

@ -8,8 +8,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_dejavu_30_cyrillic_glyph_bitmap[] = static const uint8_t lv_font_dejavu_30_cyrillic_glyph_bitmap[] = {
{
#if USE_LV_FONT_DEJAVU_30_CYRILLIC == 1 #if USE_LV_FONT_DEJAVU_30_CYRILLIC == 1
/*Unicode: U+0410 (А) , Width: 17 */ /*Unicode: U+0410 (А) , Width: 17 */
0x00, 0x00, 0x00, //................. 0x00, 0x00, 0x00, //.................
@ -8471,8 +8470,7 @@ static const uint8_t lv_font_dejavu_30_cyrillic_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_dejavu_30_cyrillic_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_dejavu_30_cyrillic_glyph_dsc[] = {
{
#if USE_LV_FONT_DEJAVU_30_CYRILLIC == 1 #if USE_LV_FONT_DEJAVU_30_CYRILLIC == 1
{.w_px = 17, .glyph_index = 0}, /*Unicode: U+0410 (А)*/ {.w_px = 17, .glyph_index = 0}, /*Unicode: U+0410 (А)*/
{.w_px = 13, .glyph_index = 90}, /*Unicode: U+0411 (Б)*/ {.w_px = 13, .glyph_index = 90}, /*Unicode: U+0411 (Б)*/
@ -8740,8 +8738,7 @@ static const lv_font_glyph_dsc_t lv_font_dejavu_30_cyrillic_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_dejavu_30_cyrillic = lv_font_t lv_font_dejavu_30_cyrillic = {
{
.unicode_first = 1040, /*First Unicode letter in this font*/ .unicode_first = 1040, /*First Unicode letter in this font*/
.unicode_last = 1103, /*Last Unicode letter in this font*/ .unicode_last = 1103, /*Last Unicode letter in this font*/
.h_px = 30, /*Font height in pixels*/ .h_px = 30, /*Font height in pixels*/

View File

@ -8,8 +8,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_dejavu_30_latin_sup_glyph_bitmap[] = static const uint8_t lv_font_dejavu_30_latin_sup_glyph_bitmap[] = {
{
#if USE_LV_FONT_DEJAVU_30_LATIN_SUP == 1 #if USE_LV_FONT_DEJAVU_30_LATIN_SUP == 1
/*Unicode: U+00a0 ( ) , Width: 8 */ /*Unicode: U+00a0 ( ) , Width: 8 */
0x00, //........ 0x00, //........
@ -12695,8 +12694,7 @@ static const uint8_t lv_font_dejavu_30_latin_sup_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_dejavu_30_latin_sup_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_dejavu_30_latin_sup_glyph_dsc[] = {
{
#if USE_LV_FONT_DEJAVU_30_LATIN_SUP == 1 #if USE_LV_FONT_DEJAVU_30_LATIN_SUP == 1
{.w_px = 8, .glyph_index = 0}, /*Unicode: U+00a0 ( )*/ {.w_px = 8, .glyph_index = 0}, /*Unicode: U+00a0 ( )*/
{.w_px = 3, .glyph_index = 30}, /*Unicode: U+00a1 (¡)*/ {.w_px = 3, .glyph_index = 30}, /*Unicode: U+00a1 (¡)*/
@ -13092,8 +13090,7 @@ static const lv_font_glyph_dsc_t lv_font_dejavu_30_latin_sup_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_dejavu_30_latin_sup = lv_font_t lv_font_dejavu_30_latin_sup = {
{
.unicode_first = 160, /*First Unicode letter in this font*/ .unicode_first = 160, /*First Unicode letter in this font*/
.unicode_last = 255, /*Last Unicode letter in this font*/ .unicode_last = 255, /*Last Unicode letter in this font*/
.h_px = 30, /*Font height in pixels*/ .h_px = 30, /*Font height in pixels*/

View File

@ -8,8 +8,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_dejavu_40_glyph_bitmap[] = static const uint8_t lv_font_dejavu_40_glyph_bitmap[] = {
{
#if USE_LV_FONT_DEJAVU_40 == 1 #if USE_LV_FONT_DEJAVU_40 == 1
/*Unicode: U+0020 ( ) , Width: 11 */ /*Unicode: U+0020 ( ) , Width: 11 */
0x00, 0x00, //........... 0x00, 0x00, //...........
@ -16363,8 +16362,7 @@ static const uint8_t lv_font_dejavu_40_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_dejavu_40_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_dejavu_40_glyph_dsc[] = {
{
#if USE_LV_FONT_DEJAVU_40 == 1 #if USE_LV_FONT_DEJAVU_40 == 1
{.w_px = 11, .glyph_index = 0}, /*Unicode: U+0020 ( )*/ {.w_px = 11, .glyph_index = 0}, /*Unicode: U+0020 ( )*/
{.w_px = 3, .glyph_index = 80}, /*Unicode: U+0021 (!)*/ {.w_px = 3, .glyph_index = 80}, /*Unicode: U+0021 (!)*/
@ -16756,8 +16754,7 @@ static const lv_font_glyph_dsc_t lv_font_dejavu_40_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_dejavu_40 = lv_font_t lv_font_dejavu_40 = {
{
.unicode_first = 32, /*First Unicode letter in this font*/ .unicode_first = 32, /*First Unicode letter in this font*/
.unicode_last = 126, /*Last Unicode letter in this font*/ .unicode_last = 126, /*Last Unicode letter in this font*/
.h_px = 40, /*Font height in pixels*/ .h_px = 40, /*Font height in pixels*/

View File

@ -8,8 +8,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_dejavu_40_cyrillic_glyph_bitmap[] = static const uint8_t lv_font_dejavu_40_cyrillic_glyph_bitmap[] = {
{
#if USE_LV_FONT_DEJAVU_40_CYRILLIC == 1 #if USE_LV_FONT_DEJAVU_40_CYRILLIC == 1
/*Unicode: U+0410 (А) , Width: 23 */ /*Unicode: U+0410 (А) , Width: 23 */
0x00, 0x00, 0x00, //....................... 0x00, 0x00, 0x00, //.......................
@ -11031,8 +11030,7 @@ static const uint8_t lv_font_dejavu_40_cyrillic_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_dejavu_40_cyrillic_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_dejavu_40_cyrillic_glyph_dsc[] = {
{
#if USE_LV_FONT_DEJAVU_40_CYRILLIC == 1 #if USE_LV_FONT_DEJAVU_40_CYRILLIC == 1
{.w_px = 23, .glyph_index = 0}, /*Unicode: U+0410 (А)*/ {.w_px = 23, .glyph_index = 0}, /*Unicode: U+0410 (А)*/
{.w_px = 18, .glyph_index = 120}, /*Unicode: U+0411 (Б)*/ {.w_px = 18, .glyph_index = 120}, /*Unicode: U+0411 (Б)*/
@ -11300,8 +11298,7 @@ static const lv_font_glyph_dsc_t lv_font_dejavu_40_cyrillic_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_dejavu_40_cyrillic = lv_font_t lv_font_dejavu_40_cyrillic = {
{
.unicode_first = 1040, /*First Unicode letter in this font*/ .unicode_first = 1040, /*First Unicode letter in this font*/
.unicode_last = 1103, /*Last Unicode letter in this font*/ .unicode_last = 1103, /*Last Unicode letter in this font*/
.h_px = 40, /*Font height in pixels*/ .h_px = 40, /*Font height in pixels*/

View File

@ -8,8 +8,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_dejavu_40_latin_sup_glyph_bitmap[] = static const uint8_t lv_font_dejavu_40_latin_sup_glyph_bitmap[] = {
{
#if USE_LV_FONT_DEJAVU_40_LATIN_SUP == 1 #if USE_LV_FONT_DEJAVU_40_LATIN_SUP == 1
/*Unicode: U+00a0 ( ) , Width: 11 */ /*Unicode: U+00a0 ( ) , Width: 11 */
0x00, 0x00, //........... 0x00, 0x00, //...........
@ -16535,8 +16534,7 @@ static const uint8_t lv_font_dejavu_40_latin_sup_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_dejavu_40_latin_sup_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_dejavu_40_latin_sup_glyph_dsc[] = {
{
#if USE_LV_FONT_DEJAVU_40_LATIN_SUP == 1 #if USE_LV_FONT_DEJAVU_40_LATIN_SUP == 1
{.w_px = 11, .glyph_index = 0}, /*Unicode: U+00a0 ( )*/ {.w_px = 11, .glyph_index = 0}, /*Unicode: U+00a0 ( )*/
{.w_px = 3, .glyph_index = 80}, /*Unicode: U+00a1 (¡)*/ {.w_px = 3, .glyph_index = 80}, /*Unicode: U+00a1 (¡)*/
@ -16932,8 +16930,7 @@ static const lv_font_glyph_dsc_t lv_font_dejavu_40_latin_sup_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_dejavu_40_latin_sup = lv_font_t lv_font_dejavu_40_latin_sup = {
{
.unicode_first = 160, /*First Unicode letter in this font*/ .unicode_first = 160, /*First Unicode letter in this font*/
.unicode_last = 255, /*Last Unicode letter in this font*/ .unicode_last = 255, /*Last Unicode letter in this font*/
.h_px = 40, /*Font height in pixels*/ .h_px = 40, /*Font height in pixels*/

View File

@ -9,8 +9,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_symbol_10_glyph_bitmap[] = static const uint8_t lv_font_symbol_10_glyph_bitmap[] = {
{
#if USE_LV_FONT_SYMBOL_10 == 1 #if USE_LV_FONT_SYMBOL_10 == 1
/*Unicode: U+f001 () , Width: 8 */ /*Unicode: U+f001 () , Width: 8 */
0x00, //........ 0x00, //........
@ -2624,8 +2623,7 @@ static const uint8_t lv_font_symbol_10_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_symbol_10_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_symbol_10_glyph_dsc[] = {
{
#if USE_LV_FONT_SYMBOL_10 == 1 #if USE_LV_FONT_SYMBOL_10 == 1
{.w_px = 8, .glyph_index = 0}, /*Unicode: U+f001 ()*/ {.w_px = 8, .glyph_index = 0}, /*Unicode: U+f001 ()*/
{.w_px = 10, .glyph_index = 10}, /*Unicode: U+f008 ()*/ {.w_px = 10, .glyph_index = 10}, /*Unicode: U+f008 ()*/
@ -2837,8 +2835,7 @@ static const lv_font_glyph_dsc_t lv_font_symbol_10_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_symbol_10 = lv_font_t lv_font_symbol_10 = {
{
#if LV_TXT_UTF8 #if LV_TXT_UTF8
.unicode_first = 61440, /*First Unicode letter in this font*/ .unicode_first = 61440, /*First Unicode letter in this font*/
.unicode_last = 62190, /*Last Unicode letter in this font*/ .unicode_last = 62190, /*Last Unicode letter in this font*/

View File

@ -9,8 +9,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_symbol_20_glyph_bitmap[] = static const uint8_t lv_font_symbol_20_glyph_bitmap[] = {
{
#if USE_LV_FONT_SYMBOL_20 == 1 #if USE_LV_FONT_SYMBOL_20 == 1
/*Unicode: U+f001 () , Width: 17 */ /*Unicode: U+f001 () , Width: 17 */
0x00, 0x00, 0x00, //................. 0x00, 0x00, 0x00, //.................
@ -4624,8 +4623,7 @@ static const uint8_t lv_font_symbol_20_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_symbol_20_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_symbol_20_glyph_dsc[] = {
{
#if USE_LV_FONT_SYMBOL_20 == 1 #if USE_LV_FONT_SYMBOL_20 == 1
{.w_px = 17, .glyph_index = 0}, /*Unicode: U+f001 ()*/ {.w_px = 17, .glyph_index = 0}, /*Unicode: U+f001 ()*/
{.w_px = 21, .glyph_index = 60}, /*Unicode: U+f008 ()*/ {.w_px = 21, .glyph_index = 60}, /*Unicode: U+f008 ()*/
@ -4837,8 +4835,7 @@ static const lv_font_glyph_dsc_t lv_font_symbol_20_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_symbol_20 = lv_font_t lv_font_symbol_20 = {
{
#if LV_TXT_UTF8 #if LV_TXT_UTF8
.unicode_first = 61440, /*First Unicode letter in this font*/ .unicode_first = 61440, /*First Unicode letter in this font*/
.unicode_last = 62190, /*Last Unicode letter in this font*/ .unicode_last = 62190, /*Last Unicode letter in this font*/

View File

@ -9,8 +9,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_symbol_30_glyph_bitmap[] = static const uint8_t lv_font_symbol_30_glyph_bitmap[] = {
{
#if USE_LV_FONT_SYMBOL_30 == 1 #if USE_LV_FONT_SYMBOL_30 == 1
/*Unicode: U+f001 () , Width: 25 */ /*Unicode: U+f001 () , Width: 25 */
0x00, 0x00, 0x00, 0x00, //......................... 0x00, 0x00, 0x00, 0x00, //.........................
@ -6624,8 +6623,7 @@ static const uint8_t lv_font_symbol_30_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_symbol_30_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_symbol_30_glyph_dsc[] = {
{
#if USE_LV_FONT_SYMBOL_30 == 1 #if USE_LV_FONT_SYMBOL_30 == 1
{.w_px = 25, .glyph_index = 0}, /*Unicode: U+f001 ()*/ {.w_px = 25, .glyph_index = 0}, /*Unicode: U+f001 ()*/
{.w_px = 32, .glyph_index = 120}, /*Unicode: U+f008 ()*/ {.w_px = 32, .glyph_index = 120}, /*Unicode: U+f008 ()*/
@ -6836,8 +6834,7 @@ static const lv_font_glyph_dsc_t lv_font_symbol_30_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_symbol_30 = lv_font_t lv_font_symbol_30 = {
{
.unicode_first = 61440, /*First Unicode letter in this font*/ .unicode_first = 61440, /*First Unicode letter in this font*/
.unicode_last = 62190, /*Last Unicode letter in this font*/ .unicode_last = 62190, /*Last Unicode letter in this font*/
.h_px = 30, /*Font height in pixels*/ .h_px = 30, /*Font height in pixels*/

View File

@ -9,8 +9,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_symbol_40_glyph_bitmap[] = static const uint8_t lv_font_symbol_40_glyph_bitmap[] = {
{
#if USE_LV_FONT_SYMBOL_40 == 1 #if USE_LV_FONT_SYMBOL_40 == 1
/*Unicode: U+f001 () , Width: 34 */ /*Unicode: U+f001 () , Width: 34 */
0x00, 0x00, 0x00, 0x00, 0x00, //.................................. 0x00, 0x00, 0x00, 0x00, 0x00, //..................................
@ -8624,8 +8623,7 @@ static const uint8_t lv_font_symbol_40_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_symbol_40_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_symbol_40_glyph_dsc[] = {
{
#if USE_LV_FONT_SYMBOL_40 == 1 #if USE_LV_FONT_SYMBOL_40 == 1
{.w_px = 34, .glyph_index = 0}, /*Unicode: U+f001 ()*/ {.w_px = 34, .glyph_index = 0}, /*Unicode: U+f001 ()*/
{.w_px = 42, .glyph_index = 200}, /*Unicode: U+f008 ()*/ {.w_px = 42, .glyph_index = 200}, /*Unicode: U+f008 ()*/
@ -8837,8 +8835,7 @@ static const lv_font_glyph_dsc_t lv_font_symbol_40_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_symbol_40 = lv_font_t lv_font_symbol_40 = {
{
#if LV_TXT_UTF8 #if LV_TXT_UTF8
.unicode_first = 61440, /*First Unicode letter in this font*/ .unicode_first = 61440, /*First Unicode letter in this font*/
.unicode_last = 62190, /*Last Unicode letter in this font*/ .unicode_last = 62190, /*Last Unicode letter in this font*/

View File

@ -512,8 +512,7 @@ static const char * lv_fs_get_real_path(const char * path)
while(*path != '\0') { while(*path != '\0') {
if(*path == ':' || *path == '\\' || *path == '/') { if(*path == ':' || *path == '\\' || *path == '/') {
path ++; path ++;
} } else {
else {
break; break;
} }
} }

View File

@ -103,8 +103,7 @@ void * lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act)
if(lv_ll_get_head(ll_p) == n_act) { if(lv_ll_get_head(ll_p) == n_act) {
n_new = lv_ll_ins_head(ll_p); n_new = lv_ll_ins_head(ll_p);
} } else {
else {
n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE); n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE);
lv_mem_assert(n_new); lv_mem_assert(n_new);
@ -159,23 +158,18 @@ void lv_ll_rem(lv_ll_t * ll_p, void * node_p)
ll_p->head = lv_ll_get_next(ll_p, node_p); ll_p->head = lv_ll_get_next(ll_p, node_p);
if(ll_p->head == NULL) { if(ll_p->head == NULL) {
ll_p->tail = NULL; ll_p->tail = NULL;
} } else {
else {
node_set_prev(ll_p, ll_p->head, NULL); node_set_prev(ll_p, ll_p->head, NULL);
} }
} } else if(lv_ll_get_tail(ll_p) == node_p) {
else if(lv_ll_get_tail(ll_p) == node_p) {
/*The new tail will be the node before 'n_act'*/ /*The new tail will be the node before 'n_act'*/
ll_p->tail = lv_ll_get_prev(ll_p, node_p); ll_p->tail = lv_ll_get_prev(ll_p, node_p);
if(ll_p->tail == NULL) { if(ll_p->tail == NULL) {
ll_p->head = NULL; ll_p->head = NULL;
} } else {
else {
node_set_next(ll_p, ll_p->tail, NULL); node_set_next(ll_p, ll_p->tail, NULL);
} }
} } else {
else
{
lv_ll_node_t * n_prev = lv_ll_get_prev(ll_p, node_p); lv_ll_node_t * n_prev = lv_ll_get_prev(ll_p, node_p);
lv_ll_node_t * n_next = lv_ll_get_next(ll_p, node_p); lv_ll_node_t * n_next = lv_ll_get_next(ll_p, node_p);

View File

@ -26,18 +26,15 @@
**********************/ **********************/
/*The size of this union must be 4 bytes (uint32_t)*/ /*The size of this union must be 4 bytes (uint32_t)*/
typedef union typedef union {
{ struct {
struct
{
uint32_t used: 1; //1: if the entry is used uint32_t used: 1; //1: if the entry is used
uint32_t d_size: 31; //Size off the data (1 means 4 bytes) uint32_t d_size: 31; //Size off the data (1 means 4 bytes)
}; };
uint32_t header; //The header (used + d_size) uint32_t header; //The header (used + d_size)
} lv_mem_header_t; } lv_mem_header_t;
typedef struct typedef struct {
{
lv_mem_header_t header; lv_mem_header_t header;
uint8_t first_data; /*First data byte in the allocated data (Just for easily create a pointer)*/ uint8_t first_data; /*First data byte in the allocated data (Just for easily create a pointer)*/
} lv_mem_ent_t; } lv_mem_ent_t;
@ -322,9 +319,7 @@ static lv_mem_ent_t * ent_get_next(lv_mem_ent_t * act_e)
if(act_e == NULL) { /*NULL means: get the first entry*/ if(act_e == NULL) { /*NULL means: get the first entry*/
next_e = (lv_mem_ent_t *) work_mem; next_e = (lv_mem_ent_t *) work_mem;
} } else { /*Get the next entry */
else /*Get the next entry */
{
uint8_t * data = &act_e->first_data; uint8_t * data = &act_e->first_data;
next_e = (lv_mem_ent_t *)&data[act_e->header.d_size]; next_e = (lv_mem_ent_t *)&data[act_e->header.d_size];

View File

@ -143,8 +143,7 @@ lv_task_t* lv_task_create(void (*task) (void *), uint32_t period, lv_task_prio_t
tmp = lv_ll_get_head(&lv_task_ll); tmp = lv_ll_get_head(&lv_task_ll);
if(NULL == tmp) { /*First task*/ if(NULL == tmp) { /*First task*/
new_lv_task = lv_ll_ins_head(&lv_task_ll); new_lv_task = lv_ll_ins_head(&lv_task_ll);
} } else {
else{
do { do {
if(tmp->prio <= prio) { if(tmp->prio <= prio) {
new_lv_task = lv_ll_ins_prev(&lv_task_ll, tmp); new_lv_task = lv_ll_ins_prev(&lv_task_ll, tmp);

View File

@ -24,8 +24,7 @@
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static int16_t sin0_90_table[] = static int16_t sin0_90_table[] = {
{
0, 572, 1144, 1715, 2286, 2856, 3425, 3993, 4560, 5126, 0, 572, 1144, 1715, 2286, 2856, 3425, 3993, 4560, 5126,
5690, 6252, 6813, 7371, 7927, 8481, 9032, 9580, 10126, 10668, 5690, 6252, 6813, 7371, 7927, 8481, 9032, 9580, 10126, 10668,
11207, 11743, 12275, 12803, 13328, 13848, 14364, 14876, 15383, 15886, 11207, 11743, 12275, 12803, 13328, 13848, 14364, 14876, 15383, 15886,
@ -60,12 +59,10 @@ int16_t lv_trigo_sin(int16_t angle)
if(angle < 90) { if(angle < 90) {
ret = sin0_90_table[angle]; ret = sin0_90_table[angle];
} else if(angle >= 90 && angle < 180) } else if(angle >= 90 && angle < 180) {
{
angle = 179 - angle; angle = 179 - angle;
ret = sin0_90_table[angle]; ret = sin0_90_table[angle];
} else if(angle >= 180 && angle < 270) } else if(angle >= 180 && angle < 270) {
{
angle = angle - 180; angle = angle - 180;
ret = - sin0_90_table[angle]; ret = - sin0_90_table[angle];
} else { /*angle >=270*/ } else { /*angle >=270*/

View File

@ -328,14 +328,12 @@ uint32_t lv_txt_unicode_to_utf8(uint32_t letter_uni)
bytes[1] = ((letter_uni >> 0) & 0x3F) | 0x80; bytes[1] = ((letter_uni >> 0) & 0x3F) | 0x80;
bytes[2] = 0; bytes[2] = 0;
bytes[3] = 0; bytes[3] = 0;
} } else if(letter_uni < 0x010000) {
else if (letter_uni < 0x010000) {
bytes[0] = ((letter_uni >> 12) & 0x0F) | 0xE0; bytes[0] = ((letter_uni >> 12) & 0x0F) | 0xE0;
bytes[1] = ((letter_uni >> 6) & 0x3F) | 0x80; bytes[1] = ((letter_uni >> 6) & 0x3F) | 0x80;
bytes[2] = ((letter_uni >> 0) & 0x3F) | 0x80; bytes[2] = ((letter_uni >> 0) & 0x3F) | 0x80;
bytes[3] = 0; bytes[3] = 0;
} } else if(letter_uni < 0x110000) {
else if (letter_uni < 0x110000) {
bytes[0] = ((letter_uni >> 18) & 0x07) | 0xF0; bytes[0] = ((letter_uni >> 18) & 0x07) | 0xF0;
bytes[1] = ((letter_uni >> 12) & 0x3F) | 0x80; bytes[1] = ((letter_uni >> 12) & 0x3F) | 0x80;
bytes[2] = ((letter_uni >> 6) & 0x3F) | 0x80; bytes[2] = ((letter_uni >> 6) & 0x3F) | 0x80;

View File

@ -246,9 +246,12 @@ lv_style_t * lv_bar_get_style(lv_obj_t *bar, lv_bar_style_t type)
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
switch(type) { switch(type) {
case LV_BAR_STYLE_BG: return lv_obj_get_style(bar); case LV_BAR_STYLE_BG:
case LV_BAR_STYLE_INDIC: return ext->style_indic; return lv_obj_get_style(bar);
default: return NULL; case LV_BAR_STYLE_INDIC:
return ext->style_indic;
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -322,8 +325,7 @@ static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param)
if(sign == LV_SIGNAL_REFR_EXT_SIZE) { if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
lv_style_t * style_indic = lv_bar_get_style(bar, LV_BAR_STYLE_INDIC); lv_style_t * style_indic = lv_bar_get_style(bar, LV_BAR_STYLE_INDIC);
if(style_indic->body.shadow.width > bar->ext_size) bar->ext_size = style_indic->body.shadow.width; if(style_indic->body.shadow.width > bar->ext_size) bar->ext_size = style_indic->body.shadow.width;
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -153,11 +153,20 @@ void lv_btn_toggle(lv_obj_t * btn)
{ {
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn); lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
switch(ext->state) { switch(ext->state) {
case LV_BTN_STATE_REL: lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL); break; case LV_BTN_STATE_REL:
case LV_BTN_STATE_PR: lv_btn_set_state(btn, LV_BTN_STATE_TGL_PR); break; lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
case LV_BTN_STATE_TGL_REL: lv_btn_set_state(btn, LV_BTN_STATE_REL); break; break;
case LV_BTN_STATE_TGL_PR: lv_btn_set_state(btn, LV_BTN_STATE_PR); break; case LV_BTN_STATE_PR:
default: break; lv_btn_set_state(btn, LV_BTN_STATE_TGL_PR);
break;
case LV_BTN_STATE_TGL_REL:
lv_btn_set_state(btn, LV_BTN_STATE_REL);
break;
case LV_BTN_STATE_TGL_PR:
lv_btn_set_state(btn, LV_BTN_STATE_PR);
break;
default:
break;
} }
} }
@ -258,12 +267,18 @@ lv_style_t * lv_btn_get_style(lv_obj_t *btn, lv_btn_style_t type)
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn); lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
switch(type) { switch(type) {
case LV_BTN_STYLE_REL: return ext->styles[LV_BTN_STATE_REL]; case LV_BTN_STYLE_REL:
case LV_BTN_STYLE_PR: return ext->styles[LV_BTN_STATE_PR]; return ext->styles[LV_BTN_STATE_REL];
case LV_BTN_STYLE_TGL_REL: return ext->styles[LV_BTN_STATE_TGL_REL]; case LV_BTN_STYLE_PR:
case LV_BTN_STYLE_TGL_PR: return ext->styles[LV_BTN_STATE_TGL_PR]; return ext->styles[LV_BTN_STATE_PR];
case LV_BTN_STYLE_INA: return ext->styles[LV_BTN_STATE_INA]; case LV_BTN_STYLE_TGL_REL:
default: return NULL; return ext->styles[LV_BTN_STATE_TGL_REL];
case LV_BTN_STYLE_TGL_PR:
return ext->styles[LV_BTN_STATE_TGL_PR];
case LV_BTN_STYLE_INA:
return ext->styles[LV_BTN_STATE_INA];
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -306,20 +321,17 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
if(ext->actions[LV_BTN_ACTION_PR] && state != LV_BTN_STATE_INA) { if(ext->actions[LV_BTN_ACTION_PR] && state != LV_BTN_STATE_INA) {
res = ext->actions[LV_BTN_ACTION_PR](btn); res = ext->actions[LV_BTN_ACTION_PR](btn);
} }
} } else if(sign == LV_SIGNAL_PRESS_LOST) {
else if(sign == LV_SIGNAL_PRESS_LOST) {
/*Refresh the state*/ /*Refresh the state*/
if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL); if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL);
else if(ext->state == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL); else if(ext->state == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
} } else if(sign == LV_SIGNAL_PRESSING) {
else if(sign == LV_SIGNAL_PRESSING) {
/*When the button begins to drag revert pressed states to released*/ /*When the button begins to drag revert pressed states to released*/
if(lv_indev_is_dragging(param) != false) { if(lv_indev_is_dragging(param) != false) {
if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL); if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL);
else if(ext->state == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL); else if(ext->state == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
} }
} } else if(sign == LV_SIGNAL_RELEASED) {
else if(sign == LV_SIGNAL_RELEASED) {
/*If not dragged and it was not long press action then /*If not dragged and it was not long press action then
*change state and run the action*/ *change state and run the action*/
if(lv_indev_is_dragging(param) == false && ext->long_pr_action_executed == 0) { if(lv_indev_is_dragging(param) == false && ext->long_pr_action_executed == 0) {
@ -343,19 +355,16 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL); lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
} }
} }
} } else if(sign == LV_SIGNAL_LONG_PRESS) {
else if(sign == LV_SIGNAL_LONG_PRESS) {
if(ext->actions[LV_BTN_ACTION_LONG_PR] && state != LV_BTN_STATE_INA) { if(ext->actions[LV_BTN_ACTION_LONG_PR] && state != LV_BTN_STATE_INA) {
ext->long_pr_action_executed = 1; ext->long_pr_action_executed = 1;
res = ext->actions[LV_BTN_ACTION_LONG_PR](btn); res = ext->actions[LV_BTN_ACTION_LONG_PR](btn);
} }
} } else if(sign == LV_SIGNAL_LONG_PRESS_REP) {
else if(sign == LV_SIGNAL_LONG_PRESS_REP) {
if(ext->actions[LV_BTN_ACTION_LONG_PR_REPEAT] && state != LV_BTN_STATE_INA) { if(ext->actions[LV_BTN_ACTION_LONG_PR_REPEAT] && state != LV_BTN_STATE_INA) {
res = ext->actions[LV_BTN_ACTION_LONG_PR_REPEAT](btn); res = ext->actions[LV_BTN_ACTION_LONG_PR_REPEAT](btn);
} }
} } else if(sign == LV_SIGNAL_CONTROLL) {
else if(sign == LV_SIGNAL_CONTROLL) {
char c = *((char *)param); char c = *((char *)param);
if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_UP) { if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_UP) {
if(lv_btn_get_toggle(btn) != false) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL); if(lv_btn_get_toggle(btn) != false) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
@ -380,14 +389,12 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
} }
} }
ext->long_pr_action_executed = 0; ext->long_pr_action_executed = 0;
} } else if(c == LV_GROUP_KEY_ENTER_LONG) {
else if(c == LV_GROUP_KEY_ENTER_LONG) {
if(ext->actions[LV_BTN_ACTION_LONG_PR] && state != LV_BTN_STATE_INA) { if(ext->actions[LV_BTN_ACTION_LONG_PR] && state != LV_BTN_STATE_INA) {
res = ext->actions[LV_BTN_ACTION_LONG_PR](btn); res = ext->actions[LV_BTN_ACTION_LONG_PR](btn);
} }
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -43,7 +43,8 @@ static void create_buttons(lv_obj_t * btnm, const char ** map);
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static const char * lv_btnm_def_map[] = {"Btn1", "Btn2", "Btn3", "\n", static const char * lv_btnm_def_map[] = {"Btn1", "Btn2", "Btn3", "\n",
"\002Btn4","Btn5", ""}; "\002Btn4", "Btn5", ""
};
static lv_design_func_t ancestor_design_f; static lv_design_func_t ancestor_design_f;
static lv_signal_func_t ancestor_signal; static lv_signal_func_t ancestor_signal;
@ -343,7 +344,8 @@ uint16_t lv_btnm_get_toggled(lv_obj_t * btnm)
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm); lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(ext->toggle == 0) return 0; if(ext->toggle == 0) return 0;
else return ext->btn_id_tgl;} else return ext->btn_id_tgl;
}
/** /**
* Get a style of a button matrix * Get a style of a button matrix
@ -356,13 +358,20 @@ lv_style_t * lv_btnm_get_style(lv_obj_t *btnm, lv_btnm_style_t type)
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm); lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
switch(type) { switch(type) {
case LV_BTNM_STYLE_BG: return lv_obj_get_style(btnm); case LV_BTNM_STYLE_BG:
case LV_BTNM_STYLE_BTN_REL: return ext->styles_btn[LV_BTN_STATE_REL]; return lv_obj_get_style(btnm);
case LV_BTNM_STYLE_BTN_PR: return ext->styles_btn[LV_BTN_STATE_PR]; case LV_BTNM_STYLE_BTN_REL:
case LV_BTNM_STYLE_BTN_TGL_REL: return ext->styles_btn[LV_BTN_STATE_TGL_REL]; return ext->styles_btn[LV_BTN_STATE_REL];
case LV_BTNM_STYLE_BTN_TGL_PR: return ext->styles_btn[LV_BTN_STATE_TGL_PR]; case LV_BTNM_STYLE_BTN_PR:
case LV_BTNM_STYLE_BTN_INA: return ext->styles_btn[LV_BTN_STATE_INA]; return ext->styles_btn[LV_BTN_STATE_PR];
default: return NULL; case LV_BTNM_STYLE_BTN_TGL_REL:
return ext->styles_btn[LV_BTN_STATE_TGL_REL];
case LV_BTNM_STYLE_BTN_TGL_PR:
return ext->styles_btn[LV_BTN_STATE_TGL_PR];
case LV_BTNM_STYLE_BTN_INA:
return ext->styles_btn[LV_BTN_STATE_INA];
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -488,11 +497,9 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
lv_point_t p; lv_point_t p;
if(sign == LV_SIGNAL_CLEANUP) { if(sign == LV_SIGNAL_CLEANUP) {
lv_mem_free(ext->button_areas); lv_mem_free(ext->button_areas);
} } else if(sign == LV_SIGNAL_STYLE_CHG || sign == LV_SIGNAL_CORD_CHG) {
else if(sign == LV_SIGNAL_STYLE_CHG || sign == LV_SIGNAL_CORD_CHG) {
lv_btnm_set_map(btnm, ext->map_p); lv_btnm_set_map(btnm, ext->map_p);
} } else if(sign == LV_SIGNAL_PRESSING) {
else if(sign == LV_SIGNAL_PRESSING) {
uint16_t btn_pr; uint16_t btn_pr;
/*Search the pressed area*/ /*Search the pressed area*/
lv_indev_get_point(param, &p); lv_indev_get_point(param, &p);
@ -532,8 +539,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
} }
} }
} }
} } else if(sign == LV_SIGNAL_RELEASED) {
else if(sign == LV_SIGNAL_RELEASED) {
if(ext->btn_id_pr != LV_BTNM_PR_NONE) { if(ext->btn_id_pr != LV_BTNM_PR_NONE) {
if(ext->action) { if(ext->action) {
uint16_t txt_i = get_button_text(btnm, ext->btn_id_pr); uint16_t txt_i = get_button_text(btnm, ext->btn_id_pr);
@ -565,16 +571,13 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
ext->btn_id_pr = LV_BTNM_PR_NONE; ext->btn_id_pr = LV_BTNM_PR_NONE;
} }
} } else if(sign == LV_SIGNAL_PRESS_LOST || sign == LV_SIGNAL_DEFOCUS) {
else if(sign == LV_SIGNAL_PRESS_LOST || sign == LV_SIGNAL_DEFOCUS) {
ext->btn_id_pr = LV_BTNM_PR_NONE; ext->btn_id_pr = LV_BTNM_PR_NONE;
lv_obj_invalidate(btnm); lv_obj_invalidate(btnm);
} } else if(sign == LV_SIGNAL_FOCUS) {
else if(sign == LV_SIGNAL_FOCUS) {
ext->btn_id_pr = 0; ext->btn_id_pr = 0;
lv_obj_invalidate(btnm); lv_obj_invalidate(btnm);
} } else if(sign == LV_SIGNAL_CONTROLL) {
else if(sign == LV_SIGNAL_CONTROLL) {
char c = *((char *)param); char c = *((char *)param);
if(c == LV_GROUP_KEY_RIGHT) { if(c == LV_GROUP_KEY_RIGHT) {
if(ext->btn_id_pr == LV_BTNM_PR_NONE) ext->btn_id_pr = 0; if(ext->btn_id_pr == LV_BTNM_PR_NONE) ext->btn_id_pr = 0;
@ -597,8 +600,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
for(area_below = ext->btn_id_pr; area_below < ext->btn_cnt; area_below ++) { for(area_below = ext->btn_id_pr; area_below < ext->btn_cnt; area_below ++) {
if(ext->button_areas[area_below].y1 > ext->button_areas[ext->btn_id_pr].y1 && if(ext->button_areas[area_below].y1 > ext->button_areas[ext->btn_id_pr].y1 &&
pr_center >= ext->button_areas[area_below].x1 && pr_center >= ext->button_areas[area_below].x1 &&
pr_center <= ext->button_areas[area_below].x2 + style->body.padding.hor) pr_center <= ext->button_areas[area_below].x2 + style->body.padding.hor) {
{
break; break;
} }
} }
@ -618,8 +620,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
for(area_above = ext->btn_id_pr; area_above >= 0; area_above --) { for(area_above = ext->btn_id_pr; area_above >= 0; area_above --) {
if(ext->button_areas[area_above].y1 < ext->button_areas[ext->btn_id_pr].y1 && if(ext->button_areas[area_above].y1 < ext->button_areas[ext->btn_id_pr].y1 &&
pr_center >= ext->button_areas[area_above].x1 - style->body.padding.hor && pr_center >= ext->button_areas[area_above].x1 - style->body.padding.hor &&
pr_center <= ext->button_areas[area_above].x2) pr_center <= ext->button_areas[area_above].x2) {
{
break; break;
} }
} }
@ -634,8 +635,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
ext->action(btnm, cut_ctrl_byte(ext->map_p[txt_i])); ext->action(btnm, cut_ctrl_byte(ext->map_p[txt_i]));
} }
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -185,12 +185,18 @@ lv_style_t * lv_cb_get_style(lv_obj_t * cb, lv_cb_style_t type)
lv_cb_ext_t * ext = lv_obj_get_ext_attr(cb); lv_cb_ext_t * ext = lv_obj_get_ext_attr(cb);
switch(type) { switch(type) {
case LV_CB_STYLE_BOX_REL: return lv_btn_get_style(ext->bullet, LV_BTN_STYLE_REL); case LV_CB_STYLE_BOX_REL:
case LV_CB_STYLE_BOX_PR: return lv_btn_get_style(ext->bullet, LV_BTN_STYLE_PR); return lv_btn_get_style(ext->bullet, LV_BTN_STYLE_REL);
case LV_CB_STYLE_BOX_TGL_REL: return lv_btn_get_style(ext->bullet, LV_BTN_STYLE_TGL_REL); case LV_CB_STYLE_BOX_PR:
case LV_CB_STYLE_BOX_TGL_PR: return lv_btn_get_style(ext->bullet, LV_BTN_STYLE_TGL_PR); return lv_btn_get_style(ext->bullet, LV_BTN_STYLE_PR);
case LV_CB_STYLE_BOX_INA: return lv_btn_get_style(ext->bullet, LV_BTN_STYLE_INA); case LV_CB_STYLE_BOX_TGL_REL:
default: return NULL; return lv_btn_get_style(ext->bullet, LV_BTN_STYLE_TGL_REL);
case LV_CB_STYLE_BOX_TGL_PR:
return lv_btn_get_style(ext->bullet, LV_BTN_STYLE_TGL_PR);
case LV_CB_STYLE_BOX_INA:
return lv_btn_get_style(ext->bullet, LV_BTN_STYLE_INA);
default:
return NULL;
} }
/*To avoid awrning*/ /*To avoid awrning*/
@ -308,8 +314,7 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) {
lv_btn_set_state(ext->bullet, lv_btn_get_state(cb)); lv_btn_set_state(ext->bullet, lv_btn_get_state(cb));
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -448,8 +448,7 @@ static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param
lv_mem_free(*datal); lv_mem_free(*datal);
} }
lv_ll_clear(&ext->series_ll); lv_ll_clear(&ext->series_ll);
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -212,8 +212,7 @@ static lv_res_t lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param)
lv_cont_refr_layout(cont); lv_cont_refr_layout(cont);
lv_cont_refr_autofit(cont); lv_cont_refr_autofit(cont);
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -361,10 +361,14 @@ lv_style_t * lv_ddlist_get_style(lv_obj_t *ddlist, lv_ddlist_style_t type)
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist); lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
switch(type) { switch(type) {
case LV_DDLIST_STYLE_BG: return lv_page_get_style(ddlist, LV_PAGE_STYLE_BG); case LV_DDLIST_STYLE_BG:
case LV_DDLIST_STYLE_SB: return lv_page_get_style(ddlist, LV_PAGE_STYLE_SB); return lv_page_get_style(ddlist, LV_PAGE_STYLE_BG);
case LV_DDLIST_STYLE_SEL: return ext->sel_style; case LV_DDLIST_STYLE_SB:
default: return NULL; return lv_page_get_style(ddlist, LV_PAGE_STYLE_SB);
case LV_DDLIST_STYLE_SEL:
return ext->sel_style;
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -508,25 +512,21 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
if(sign == LV_SIGNAL_STYLE_CHG) { if(sign == LV_SIGNAL_STYLE_CHG) {
lv_ddlist_refr_size(ddlist, 0); lv_ddlist_refr_size(ddlist, 0);
} } else if(sign == LV_SIGNAL_CLEANUP) {
else if(sign == LV_SIGNAL_CLEANUP) {
ext->label = NULL; ext->label = NULL;
} } else if(sign == LV_SIGNAL_FOCUS) {
else if(sign == LV_SIGNAL_FOCUS) {
if(ext->opened == false) { if(ext->opened == false) {
ext->opened = true; ext->opened = true;
lv_ddlist_refr_size(ddlist, true); lv_ddlist_refr_size(ddlist, true);
ext->sel_opt_id_ori = ext->sel_opt_id; ext->sel_opt_id_ori = ext->sel_opt_id;
} }
} } else if(sign == LV_SIGNAL_DEFOCUS) {
else if(sign == LV_SIGNAL_DEFOCUS) {
if(ext->opened != false) { if(ext->opened != false) {
ext->opened = false; ext->opened = false;
ext->sel_opt_id = ext->sel_opt_id_ori; ext->sel_opt_id = ext->sel_opt_id_ori;
lv_ddlist_refr_size(ddlist, true); lv_ddlist_refr_size(ddlist, true);
} }
} } else if(sign == LV_SIGNAL_CONTROLL) {
else if(sign == LV_SIGNAL_CONTROLL) {
char c = *((char *)param); char c = *((char *)param);
if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) { if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) {
if(!ext->opened) { if(!ext->opened) {
@ -554,21 +554,18 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
ext->sel_opt_id_ori = ext->sel_opt_id; ext->sel_opt_id_ori = ext->sel_opt_id;
ext->opened = 0; ext->opened = 0;
if(ext->action) ext->action(ddlist); if(ext->action) ext->action(ddlist);
} } else {
else {
ext->opened = 1; ext->opened = 1;
} }
lv_ddlist_refr_size(ddlist, true); lv_ddlist_refr_size(ddlist, true);
} } else if(c == LV_GROUP_KEY_ESC) {
else if(c == LV_GROUP_KEY_ESC) {
if(ext->opened) { if(ext->opened) {
ext->opened = 0; ext->opened = 0;
lv_ddlist_refr_size(ddlist, true); lv_ddlist_refr_size(ddlist, true);
} }
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
@ -602,8 +599,7 @@ static lv_res_t lv_ddlist_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void *
* In this way by dragging the scrollable part the wider rectangle area can be redrawn too*/ * In this way by dragging the scrollable part the wider rectangle area can be redrawn too*/
lv_style_t * style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_BG); lv_style_t * style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_BG);
if(scrl->ext_size < style->body.padding.hor) scrl->ext_size = style->body.padding.hor; if(scrl->ext_size < style->body.padding.hor) scrl->ext_size = style->body.padding.hor;
} } else if(sign == LV_SIGNAL_CLEANUP) {
else if(sign == LV_SIGNAL_CLEANUP) {
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist); lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
ext->label = NULL; /*The label is already deleted*/ ext->label = NULL; /*The label is already deleted*/
} }

View File

@ -314,8 +314,7 @@ static lv_res_t lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param
if(sign == LV_SIGNAL_CLEANUP) { if(sign == LV_SIGNAL_CLEANUP) {
lv_mem_free(ext->values); lv_mem_free(ext->values);
ext->values = NULL; ext->values = NULL;
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -344,15 +344,13 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
ext->src = NULL; ext->src = NULL;
ext->src_type = LV_IMG_SRC_UNKNOWN; ext->src_type = LV_IMG_SRC_UNKNOWN;
} }
} } else if(sign == LV_SIGNAL_STYLE_CHG) {
else if(sign == LV_SIGNAL_STYLE_CHG) {
/*Refresh the file name to refresh the symbol text size*/ /*Refresh the file name to refresh the symbol text size*/
if(ext->src_type == LV_IMG_SRC_SYMBOL) { if(ext->src_type == LV_IMG_SRC_SYMBOL) {
lv_img_set_src(img, ext->src); lv_img_set_src(img, ext->src);
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -118,7 +118,8 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy)
} }
/*Copy an existing keyboard*/ /*Copy an existing keyboard*/
else { else {
lv_kb_ext_t * copy_ext = lv_obj_get_ext_attr(copy);ext->ta = NULL; lv_kb_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->ta = NULL;
ext->ta = copy_ext->ta; ext->ta = copy_ext->ta;
ext->mode = copy_ext->mode; ext->mode = copy_ext->mode;
ext->cursor_mng = copy_ext->cursor_mng; ext->cursor_mng = copy_ext->cursor_mng;
@ -322,13 +323,20 @@ lv_action_t lv_kb_get_hide_action(lv_obj_t * kb)
lv_style_t * lv_kb_get_style(lv_obj_t * kb, lv_kb_style_t type) lv_style_t * lv_kb_get_style(lv_obj_t * kb, lv_kb_style_t type)
{ {
switch(type) { switch(type) {
case LV_KB_STYLE_BG: return lv_btnm_get_style(kb, LV_BTNM_STYLE_BG); case LV_KB_STYLE_BG:
case LV_KB_STYLE_BTN_REL: return lv_btnm_get_style(kb, LV_BTNM_STYLE_BTN_REL); return lv_btnm_get_style(kb, LV_BTNM_STYLE_BG);
case LV_KB_STYLE_BTN_PR: return lv_btnm_get_style(kb, LV_BTNM_STYLE_BTN_PR); case LV_KB_STYLE_BTN_REL:
case LV_KB_STYLE_BTN_TGL_REL: return lv_btnm_get_style(kb, LV_BTNM_STYLE_BTN_TGL_REL); return lv_btnm_get_style(kb, LV_BTNM_STYLE_BTN_REL);
case LV_KB_STYLE_BTN_TGL_PR: return lv_btnm_get_style(kb, LV_BTNM_STYLE_BTN_TGL_PR); case LV_KB_STYLE_BTN_PR:
case LV_KB_STYLE_BTN_INA: return lv_btnm_get_style(kb, LV_BTNM_STYLE_BTN_INA); return lv_btnm_get_style(kb, LV_BTNM_STYLE_BTN_PR);
default: return NULL; case LV_KB_STYLE_BTN_TGL_REL:
return lv_btnm_get_style(kb, LV_BTNM_STYLE_BTN_TGL_REL);
case LV_KB_STYLE_BTN_TGL_PR:
return lv_btnm_get_style(kb, LV_BTNM_STYLE_BTN_TGL_PR);
case LV_KB_STYLE_BTN_INA:
return lv_btnm_get_style(kb, LV_BTNM_STYLE_BTN_INA);
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -356,8 +364,7 @@ static lv_res_t lv_kb_signal(lv_obj_t * kb, lv_signal_t sign, void * param)
if(sign == LV_SIGNAL_CLEANUP) { if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/ /*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
@ -383,16 +390,13 @@ static lv_res_t lv_app_kb_action(lv_obj_t * kb, const char * txt)
if(strcmp(txt, "abc") == 0) { if(strcmp(txt, "abc") == 0) {
lv_btnm_set_map(kb, kb_map_lc); lv_btnm_set_map(kb, kb_map_lc);
return LV_RES_OK; return LV_RES_OK;
} } else if(strcmp(txt, "ABC") == 0) {
else if(strcmp(txt, "ABC") == 0) {
lv_btnm_set_map(kb, kb_map_uc); lv_btnm_set_map(kb, kb_map_uc);
return LV_RES_OK; return LV_RES_OK;
} } else if(strcmp(txt, "1#") == 0) {
else if(strcmp(txt, "1#") == 0) {
lv_btnm_set_map(kb, kb_map_spec); lv_btnm_set_map(kb, kb_map_spec);
return LV_RES_OK; return LV_RES_OK;
} } else if(strcmp(txt, SYMBOL_CLOSE) == 0) {
else if(strcmp(txt, SYMBOL_CLOSE) == 0) {
if(ext->hide_action) ext->hide_action(kb); if(ext->hide_action) ext->hide_action(kb);
else { else {
lv_kb_set_ta(kb, NULL); /*De-assign the text area to hide it cursor if needed*/ lv_kb_set_ta(kb, NULL); /*De-assign the text area to hide it cursor if needed*/

View File

@ -700,29 +700,24 @@ static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param
lv_mem_free(ext->text); lv_mem_free(ext->text);
ext->text = NULL; ext->text = NULL;
} }
} } else if(sign == LV_SIGNAL_STYLE_CHG) {
else if(sign == LV_SIGNAL_STYLE_CHG) {
/*Revert dots for proper refresh*/ /*Revert dots for proper refresh*/
lv_label_revert_dots(label); lv_label_revert_dots(label);
lv_label_refr_text(label); lv_label_refr_text(label);
} } else if(sign == LV_SIGNAL_CORD_CHG) {
else if (sign == LV_SIGNAL_CORD_CHG) {
if(lv_area_get_width(&label->coords) != lv_area_get_width(param) || if(lv_area_get_width(&label->coords) != lv_area_get_width(param) ||
lv_area_get_height(&label->coords) != lv_area_get_height(param)) lv_area_get_height(&label->coords) != lv_area_get_height(param)) {
{
lv_label_revert_dots(label); lv_label_revert_dots(label);
lv_label_refr_text(label); lv_label_refr_text(label);
} }
} } else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
if(ext->body_draw) { if(ext->body_draw) {
lv_style_t * style = lv_label_get_style(label); lv_style_t * style = lv_label_get_style(label);
label->ext_size = LV_MATH_MAX(label->ext_size, style->body.padding.hor); label->ext_size = LV_MATH_MAX(label->ext_size, style->body.padding.hor);
label->ext_size = LV_MATH_MAX(label->ext_size, style->body.padding.ver); label->ext_size = LV_MATH_MAX(label->ext_size, style->body.padding.ver);
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
@ -840,8 +835,7 @@ static void lv_label_refr_text(lv_obj_t * label)
ext->offset.y = 0; ext->offset.y = 0;
} }
#endif #endif
} } else if(ext->long_mode == LV_LABEL_LONG_DOT) {
else if(ext->long_mode == LV_LABEL_LONG_DOT) {
if(size.y <= lv_obj_get_height(label)) { /*No dots are required, the text is short enough*/ if(size.y <= lv_obj_get_height(label)) { /*No dots are required, the text is short enough*/
ext->dot_end = LV_LABEL_DOT_END_INV; ext->dot_end = LV_LABEL_DOT_END_INV;
} else if(lv_txt_get_length(ext->text) <= LV_LABEL_DOT_NUM) { /*Don't turn to dots all the characters*/ } else if(lv_txt_get_length(ext->text) <= LV_LABEL_DOT_NUM) { /*Don't turn to dots all the characters*/

View File

@ -256,8 +256,7 @@ static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param)
if(buf->type[i] == NULL) break; if(buf->type[i] == NULL) break;
} }
buf->type[i] = "lv_line"; buf->type[i] = "lv_line";
} } else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
lv_style_t * style = lv_line_get_style(line); lv_style_t * style = lv_line_get_style(line);
if(line->ext_size < style->line.width) line->ext_size = style->line.width; if(line->ext_size < style->line.width) line->ext_size = style->line.width;
} }

View File

@ -266,8 +266,7 @@ void lv_list_set_style(lv_obj_t *list, lv_list_style_t type, lv_style_t *style)
/*Refresh existing buttons' style*/ /*Refresh existing buttons' style*/
if(type == LV_LIST_STYLE_BTN_PR || type == LV_LIST_STYLE_BTN_REL || if(type == LV_LIST_STYLE_BTN_PR || type == LV_LIST_STYLE_BTN_REL ||
type == LV_LIST_STYLE_BTN_TGL_REL || type == LV_LIST_STYLE_BTN_TGL_PR || type == LV_LIST_STYLE_BTN_TGL_REL || type == LV_LIST_STYLE_BTN_TGL_PR ||
type == LV_LIST_STYLE_BTN_INA) type == LV_LIST_STYLE_BTN_INA) {
{
btn = get_next_btn(list, NULL); btn = get_next_btn(list, NULL);
while(btn != NULL) { while(btn != NULL) {
lv_btn_set_style(btn, btn_style_refr, ext->styles_btn[btn_style_refr]); lv_btn_set_style(btn, btn_style_refr, ext->styles_btn[btn_style_refr]);
@ -354,15 +353,24 @@ lv_style_t * lv_list_get_style(lv_obj_t *list, lv_list_style_t type)
lv_list_ext_t * ext = lv_obj_get_ext_attr(list); lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
switch(type) { switch(type) {
case LV_LIST_STYLE_BG: return lv_page_get_style(list, LV_PAGE_STYLE_BG); case LV_LIST_STYLE_BG:
case LV_LIST_STYLE_SCRL: return lv_page_get_style(list, LV_PAGE_STYLE_SB); return lv_page_get_style(list, LV_PAGE_STYLE_BG);
case LV_LIST_STYLE_SB: return lv_page_get_style(list, LV_PAGE_STYLE_SCRL); case LV_LIST_STYLE_SCRL:
case LV_LIST_STYLE_BTN_REL: return ext->styles_btn[LV_BTN_STATE_REL]; return lv_page_get_style(list, LV_PAGE_STYLE_SB);
case LV_LIST_STYLE_BTN_PR: return ext->styles_btn[LV_BTN_STATE_PR]; case LV_LIST_STYLE_SB:
case LV_LIST_STYLE_BTN_TGL_REL: return ext->styles_btn[LV_BTN_STATE_TGL_REL]; return lv_page_get_style(list, LV_PAGE_STYLE_SCRL);
case LV_LIST_STYLE_BTN_TGL_PR: return ext->styles_btn[LV_BTN_STATE_TGL_PR]; case LV_LIST_STYLE_BTN_REL:
case LV_LIST_STYLE_BTN_INA: return ext->styles_btn[LV_BTN_STATE_INA]; return ext->styles_btn[LV_BTN_STATE_REL];
default: return NULL; case LV_LIST_STYLE_BTN_PR:
return ext->styles_btn[LV_BTN_STATE_PR];
case LV_LIST_STYLE_BTN_TGL_REL:
return ext->styles_btn[LV_BTN_STATE_TGL_REL];
case LV_LIST_STYLE_BTN_TGL_PR:
return ext->styles_btn[LV_BTN_STATE_TGL_PR];
case LV_LIST_STYLE_BTN_INA:
return ext->styles_btn[LV_BTN_STATE_INA];
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -501,12 +509,10 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
if(w != lv_area_get_width(param)) { /*Width changed*/ if(w != lv_area_get_width(param)) { /*Width changed*/
refr_btn_width(list); refr_btn_width(list);
} }
} } else if(sign == LV_SIGNAL_STYLE_CHG) {
else if(sign == LV_SIGNAL_STYLE_CHG) {
/*Because of the possible change of horizontal and vertical padding refresh buttons width */ /*Because of the possible change of horizontal and vertical padding refresh buttons width */
refr_btn_width(list); refr_btn_width(list);
} } else if(sign == LV_SIGNAL_FOCUS) {
else if(sign == LV_SIGNAL_FOCUS) {
/*Get the first button*/ /*Get the first button*/
lv_obj_t * btn = NULL; lv_obj_t * btn = NULL;
lv_obj_t * btn_prev = NULL; lv_obj_t * btn_prev = NULL;
@ -518,8 +524,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
if(btn_prev != NULL) { if(btn_prev != NULL) {
lv_btn_set_state(btn_prev, LV_BTN_STATE_TGL_REL); lv_btn_set_state(btn_prev, LV_BTN_STATE_TGL_REL);
} }
} } else if(sign == LV_SIGNAL_DEFOCUS) {
else if(sign == LV_SIGNAL_DEFOCUS) {
/*Get the 'pressed' button*/ /*Get the 'pressed' button*/
lv_obj_t * btn = NULL; lv_obj_t * btn = NULL;
btn = get_next_btn(list, btn); btn = get_next_btn(list, btn);
@ -531,8 +536,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
if(btn != NULL) { if(btn != NULL) {
lv_btn_set_state(btn, LV_BTN_STATE_REL); lv_btn_set_state(btn, LV_BTN_STATE_REL);
} }
} } else if(sign == LV_SIGNAL_CONTROLL) {
else if(sign == LV_SIGNAL_CONTROLL) {
char c = *((char *)param); char c = *((char *)param);
if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) { if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) {
/*Get the last pressed button*/ /*Get the last pressed button*/
@ -551,8 +555,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
lv_btn_set_state(btn_prev, LV_BTN_STATE_TGL_REL); lv_btn_set_state(btn_prev, LV_BTN_STATE_TGL_REL);
lv_page_focus(list, btn_prev, ext->anim_time); lv_page_focus(list, btn_prev, ext->anim_time);
} }
} } else if(c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_UP) {
else if(c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_UP) {
/*Get the last pressed button*/ /*Get the last pressed button*/
lv_obj_t * btn = NULL; lv_obj_t * btn = NULL;
lv_list_ext_t * ext = lv_obj_get_ext_attr(list); lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
@ -584,8 +587,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
rel_action = lv_btn_get_action(btn, LV_BTN_ACTION_CLICK); rel_action = lv_btn_get_action(btn, LV_BTN_ACTION_CLICK);
if(rel_action != NULL) rel_action(btn); if(rel_action != NULL) rel_action(btn);
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -331,8 +331,7 @@ static lv_res_t lv_lmeter_signal(lv_obj_t * lmeter, lv_signal_t sign, void * par
if(sign == LV_SIGNAL_CLEANUP) { if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/ /*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -319,14 +319,22 @@ lv_style_t * lv_mbox_get_style(lv_obj_t *mbox, lv_mbox_style_t type)
lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox); lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
switch(type) { switch(type) {
case LV_MBOX_STYLE_BG: return lv_obj_get_style(mbox); case LV_MBOX_STYLE_BG:
case LV_MBOX_STYLE_BTN_BG: return lv_btnm_get_style(ext->btnm, LV_BTNM_STYLE_BG); return lv_obj_get_style(mbox);
case LV_MBOX_STYLE_BTN_REL: return lv_btnm_get_style(ext->btnm, LV_BTNM_STYLE_BTN_REL); case LV_MBOX_STYLE_BTN_BG:
case LV_MBOX_STYLE_BTN_PR: return lv_btnm_get_style(ext->btnm, LV_BTNM_STYLE_BTN_PR); return lv_btnm_get_style(ext->btnm, LV_BTNM_STYLE_BG);
case LV_MBOX_STYLE_BTN_TGL_REL: return lv_btnm_get_style(ext->btnm, LV_BTNM_STYLE_BTN_TGL_REL); case LV_MBOX_STYLE_BTN_REL:
case LV_MBOX_STYLE_BTN_TGL_PR: return lv_btnm_get_style(ext->btnm, LV_BTNM_STYLE_BTN_TGL_PR); return lv_btnm_get_style(ext->btnm, LV_BTNM_STYLE_BTN_REL);
case LV_MBOX_STYLE_BTN_INA: return lv_btnm_get_style(ext->btnm, LV_BTNM_STYLE_BTN_INA); case LV_MBOX_STYLE_BTN_PR:
default: return NULL; return lv_btnm_get_style(ext->btnm, LV_BTNM_STYLE_BTN_PR);
case LV_MBOX_STYLE_BTN_TGL_REL:
return lv_btnm_get_style(ext->btnm, LV_BTNM_STYLE_BTN_TGL_REL);
case LV_MBOX_STYLE_BTN_TGL_PR:
return lv_btnm_get_style(ext->btnm, LV_BTNM_STYLE_BTN_TGL_PR);
case LV_MBOX_STYLE_BTN_INA:
return lv_btnm_get_style(ext->btnm, LV_BTNM_STYLE_BTN_INA);
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -368,17 +376,14 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
if(lv_obj_get_width(mbox) != lv_area_get_width(param)) { if(lv_obj_get_width(mbox) != lv_area_get_width(param)) {
mbox_realign(mbox); mbox_realign(mbox);
} }
} } else if(sign == LV_SIGNAL_STYLE_CHG) {
else if(sign == LV_SIGNAL_STYLE_CHG) {
mbox_realign(mbox); mbox_realign(mbox);
} } else if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_CONTROLL) {
else if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_CONTROLL) {
if(ext->btnm) { if(ext->btnm) {
ext->btnm->signal_func(ext->btnm, sign, param); ext->btnm->signal_func(ext->btnm, sign, param);
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -142,9 +142,12 @@ lv_style_t * lv_btn_get_style(lv_obj_t * templ, lv_templ_style_t type)
lv_templ_ext_t * ext = lv_obj_get_ext_attr(templ); lv_templ_ext_t * ext = lv_obj_get_ext_attr(templ);
switch(type) { switch(type) {
case LV_TEMPL_STYLE_X: return NULL; case LV_TEMPL_STYLE_X:
case LV_TEMPL_STYLE_Y: return NULL; return NULL;
default: return NULL; case LV_TEMPL_STYLE_Y:
return NULL;
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -209,8 +212,7 @@ static lv_res_t lv_templ_signal(lv_obj_t * templ, lv_signal_t sign, void * param
if(sign == LV_SIGNAL_CLEANUP) { if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/ /*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -245,10 +245,14 @@ lv_style_t * lv_page_get_style(lv_obj_t *page, lv_page_style_t type)
lv_page_ext_t * ext = lv_obj_get_ext_attr(page); lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
switch(type) { switch(type) {
case LV_PAGE_STYLE_BG: return lv_obj_get_style(page); case LV_PAGE_STYLE_BG:
case LV_PAGE_STYLE_SCRL: return lv_obj_get_style(ext->scrl); return lv_obj_get_style(page);
case LV_PAGE_STYLE_SB: return ext->sb.style; case LV_PAGE_STYLE_SCRL:
default: return NULL; return lv_obj_get_style(ext->scrl);
case LV_PAGE_STYLE_SB:
return ext->sb.style;
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -313,8 +317,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
if(anim_time == 0) { if(anim_time == 0) {
lv_obj_set_y(ext->scrl, scrlable_y); lv_obj_set_y(ext->scrl, scrlable_y);
} } else {
else {
#if USE_LV_ANIMATION #if USE_LV_ANIMATION
lv_anim_t a; lv_anim_t a;
a.act_time = 0; a.act_time = 0;
@ -471,8 +474,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
child = lv_obj_get_child(page, child); child = lv_obj_get_child(page, child);
} }
} }
} } else if(sign == LV_SIGNAL_STYLE_CHG) {
else if(sign == LV_SIGNAL_STYLE_CHG) {
/*If no hor_fit enabled set the scrollable's width to the page's width*/ /*If no hor_fit enabled set the scrollable's width to the page's width*/
if(lv_cont_get_hor_fit(ext->scrl) == false) { if(lv_cont_get_hor_fit(ext->scrl) == false) {
lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.padding.hor); lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.padding.hor);
@ -485,12 +487,10 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
/*Refresh the ext. size because the scrollbars might be positioned out of the page*/ /*Refresh the ext. size because the scrollbars might be positioned out of the page*/
lv_obj_refresh_ext_size(page); lv_obj_refresh_ext_size(page);
} } else if(sign == LV_SIGNAL_CORD_CHG) {
else if(sign == LV_SIGNAL_CORD_CHG) {
/*Refresh the scrollbar and notify the scrl if the size is changed*/ /*Refresh the scrollbar and notify the scrl if the size is changed*/
if(ext->scrl != NULL && (lv_obj_get_width(page) != lv_area_get_width(param) || if(ext->scrl != NULL && (lv_obj_get_width(page) != lv_area_get_width(param) ||
lv_obj_get_height(page) != lv_area_get_height(param))) lv_obj_get_height(page) != lv_area_get_height(param))) {
{
/*If no hor_fit enabled set the scrollable's width to the page's width*/ /*If no hor_fit enabled set the scrollable's width to the page's width*/
if(lv_cont_get_hor_fit(ext->scrl) == false) { if(lv_cont_get_hor_fit(ext->scrl) == false) {
lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.padding.hor); lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.padding.hor);
@ -501,25 +501,21 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
/*The scrollbars are important only if they are visible now*/ /*The scrollbars are important only if they are visible now*/
if(ext->sb.hor_draw || ext->sb.ver_draw) lv_page_sb_refresh(page); if(ext->sb.hor_draw || ext->sb.ver_draw) lv_page_sb_refresh(page);
} }
} } else if(sign == LV_SIGNAL_PRESSED) {
else if(sign == LV_SIGNAL_PRESSED) {
if(ext->pr_action != NULL) { if(ext->pr_action != NULL) {
ext->pr_action(page); ext->pr_action(page);
} }
} } else if(sign == LV_SIGNAL_RELEASED) {
else if(sign == LV_SIGNAL_RELEASED) {
if(lv_indev_is_dragging(lv_indev_get_act()) == false) { if(lv_indev_is_dragging(lv_indev_get_act()) == false) {
if(ext->rel_action != NULL) { if(ext->rel_action != NULL) {
ext->rel_action(page); ext->rel_action(page);
} }
} }
} } else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
/*Ensure ext. size for the scrollbars if they are out of the page*/ /*Ensure ext. size for the scrollbars if they are out of the page*/
if(page->ext_size < (-ext->sb.style->body.padding.hor)) page->ext_size = -ext->sb.style->body.padding.hor; if(page->ext_size < (-ext->sb.style->body.padding.hor)) page->ext_size = -ext->sb.style->body.padding.hor;
if(page->ext_size < (-ext->sb.style->body.padding.ver)) page->ext_size = -ext->sb.style->body.padding.ver; if(page->ext_size < (-ext->sb.style->body.padding.ver)) page->ext_size = -ext->sb.style->body.padding.ver;
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
@ -612,8 +608,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
} }
lv_page_sb_refresh(page); lv_page_sb_refresh(page);
} } else if(sign == LV_SIGNAL_DRAG_END) {
else if(sign == LV_SIGNAL_DRAG_END) {
/*Hide scrollbars if required*/ /*Hide scrollbars if required*/
if(page_ext->sb.mode == LV_SB_MODE_DRAG) { if(page_ext->sb.mode == LV_SB_MODE_DRAG) {
lv_area_t sb_area_tmp; lv_area_t sb_area_tmp;
@ -636,13 +631,11 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
page_ext->sb.ver_draw = 0; page_ext->sb.ver_draw = 0;
} }
} }
} } else if(sign == LV_SIGNAL_PRESSED) {
else if(sign == LV_SIGNAL_PRESSED) {
if(page_ext->pr_action != NULL) { if(page_ext->pr_action != NULL) {
page_ext->pr_action(page); page_ext->pr_action(page);
} }
} } else if(sign == LV_SIGNAL_RELEASED) {
else if(sign == LV_SIGNAL_RELEASED) {
if(lv_indev_is_dragging(lv_indev_get_act()) == false) { if(lv_indev_is_dragging(lv_indev_get_act()) == false) {
if(page_ext->rel_action != NULL) { if(page_ext->rel_action != NULL) {
page_ext->rel_action(page); page_ext->rel_action(page);

View File

@ -185,9 +185,12 @@ bool lv_roller_get_hor_fit(lv_obj_t *roller)
lv_style_t * lv_roller_get_style(lv_obj_t * roller, lv_roller_style_t type) lv_style_t * lv_roller_get_style(lv_obj_t * roller, lv_roller_style_t type)
{ {
switch(type) { switch(type) {
case LV_ROLLER_STYLE_BG: return lv_obj_get_style(roller); case LV_ROLLER_STYLE_BG:
case LV_ROLLER_STYLE_SEL: return lv_ddlist_get_style(roller, LV_DDLIST_STYLE_SEL); return lv_obj_get_style(roller);
default: return NULL; case LV_ROLLER_STYLE_SEL:
return lv_ddlist_get_style(roller, LV_DDLIST_STYLE_SEL);
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -299,19 +302,16 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
lv_ddlist_set_selected(roller, ext->ddlist.sel_opt_id); lv_ddlist_set_selected(roller, ext->ddlist.sel_opt_id);
refr_position(roller, false); refr_position(roller, false);
} }
} } else if(sign == LV_SIGNAL_FOCUS) {
else if(sign == LV_SIGNAL_FOCUS) {
ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id; ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id;
} } else if(sign == LV_SIGNAL_DEFOCUS) {
else if(sign == LV_SIGNAL_DEFOCUS) {
/*Revert the original state*/ /*Revert the original state*/
if(ext->ddlist.sel_opt_id != ext->ddlist.sel_opt_id_ori) { if(ext->ddlist.sel_opt_id != ext->ddlist.sel_opt_id_ori) {
ext->ddlist.sel_opt_id = ext->ddlist.sel_opt_id_ori; ext->ddlist.sel_opt_id = ext->ddlist.sel_opt_id_ori;
refr_position(roller, true); refr_position(roller, true);
} }
} } else if(sign == LV_SIGNAL_CONTROLL) {
else if(sign == LV_SIGNAL_CONTROLL) {
char c = *((char *)param); char c = *((char *)param);
if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) { if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) {
if(ext->ddlist.sel_opt_id + 1 < ext->ddlist.option_cnt) { if(ext->ddlist.sel_opt_id + 1 < ext->ddlist.option_cnt) {
@ -325,8 +325,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
if(ext->ddlist.action) ext->ddlist.action(roller); if(ext->ddlist.action) ext->ddlist.action(roller);
ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id; /*Set the entered value as default*/ ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id; /*Set the entered value as default*/
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
@ -374,8 +373,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1; if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
ext->ddlist.sel_opt_id = id; ext->ddlist.sel_opt_id = id;
if(ext->ddlist.action) ext->ddlist.action(roller); if(ext->ddlist.action) ext->ddlist.action(roller);
} } else if(sign == LV_SIGNAL_RELEASED) {
else if(sign == LV_SIGNAL_RELEASED) {
/*If picked an option by clicking then set it*/ /*If picked an option by clicking then set it*/
if(!lv_indev_is_dragging(indev)) { if(!lv_indev_is_dragging(indev)) {
lv_point_t p; lv_point_t p;

View File

@ -219,10 +219,14 @@ lv_style_t * lv_slider_get_style(lv_obj_t *slider, lv_slider_style_t type)
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider); lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
switch(type) { switch(type) {
case LV_SLIDER_STYLE_BG: return lv_bar_get_style(slider, LV_BAR_STYLE_BG); case LV_SLIDER_STYLE_BG:
case LV_SLIDER_STYLE_INDIC: return lv_bar_get_style(slider, LV_BAR_STYLE_INDIC); return lv_bar_get_style(slider, LV_BAR_STYLE_BG);
case LV_SLIDER_STYLE_KNOB: return ext->style_knob; case LV_SLIDER_STYLE_INDIC:
default: return NULL; return lv_bar_get_style(slider, LV_BAR_STYLE_INDIC);
case LV_SLIDER_STYLE_KNOB:
return ext->style_knob;
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -393,8 +397,7 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
if(sign == LV_SIGNAL_PRESSED) { if(sign == LV_SIGNAL_PRESSED) {
ext->drag_value = lv_slider_get_value(slider); ext->drag_value = lv_slider_get_value(slider);
} } else if(sign == LV_SIGNAL_PRESSING) {
else if(sign == LV_SIGNAL_PRESSING) {
lv_indev_get_point(param, &p); lv_indev_get_point(param, &p);
int16_t tmp = 0; int16_t tmp = 0;
if(w > h) { if(w > h) {
@ -417,13 +420,11 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
if(ext->action != NULL) ext->action(slider); if(ext->action != NULL) ext->action(slider);
lv_obj_invalidate(slider); lv_obj_invalidate(slider);
} }
} } else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
else if (sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
lv_slider_set_value(slider, ext->drag_value); lv_slider_set_value(slider, ext->drag_value);
ext->drag_value = LV_SLIDER_NOT_PRESSED; ext->drag_value = LV_SLIDER_NOT_PRESSED;
if(ext->action != NULL) ext->action(slider); if(ext->action != NULL) ext->action(slider);
} } else if(sign == LV_SIGNAL_CORD_CHG) {
else if(sign == LV_SIGNAL_CORD_CHG) {
/* The knob size depends on slider size. /* The knob size depends on slider size.
* During the drawing method the ext. size is used by the knob so refresh the ext. size.*/ * During the drawing method the ext. size is used by the knob so refresh the ext. size.*/
if(lv_obj_get_width(slider) != lv_area_get_width(param) || if(lv_obj_get_width(slider) != lv_area_get_width(param) ||
@ -454,8 +455,7 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
lv_slider_set_value(slider, lv_slider_get_value(slider) - 1); lv_slider_set_value(slider, lv_slider_get_value(slider) - 1);
if(ext->action != NULL) ext->action(slider); if(ext->action != NULL) ext->action(slider);
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -175,11 +175,16 @@ lv_style_t * lv_sw_get_style(lv_obj_t *sw, lv_sw_style_t type)
lv_sw_ext_t * ext = lv_obj_get_ext_attr(sw); lv_sw_ext_t * ext = lv_obj_get_ext_attr(sw);
switch(type) { switch(type) {
case LV_SW_STYLE_BG: return lv_slider_get_style(sw, LV_SLIDER_STYLE_BG); case LV_SW_STYLE_BG:
case LV_SW_STYLE_INDIC: return lv_slider_get_style(sw, LV_SLIDER_STYLE_INDIC); return lv_slider_get_style(sw, LV_SLIDER_STYLE_BG);
case LV_SW_STYLE_KNOB_OFF: return ext->style_knob_off; case LV_SW_STYLE_INDIC:
case LV_SW_STYLE_KNOB_ON: return ext->style_knob_on; return lv_slider_get_style(sw, LV_SLIDER_STYLE_INDIC);
default: return NULL; case LV_SW_STYLE_KNOB_OFF:
return ext->style_knob_off;
case LV_SW_STYLE_KNOB_ON:
return ext->style_knob_on;
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -216,17 +221,14 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
if(sign == LV_SIGNAL_CLEANUP) { if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/ /*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
} } else if(sign == LV_SIGNAL_PRESSING) {
else if(sign == LV_SIGNAL_PRESSING) {
int16_t act_val = ext->slider.drag_value; int16_t act_val = ext->slider.drag_value;
if(act_val != old_val) ext->changed = 1; if(act_val != old_val) ext->changed = 1;
} } else if(sign == LV_SIGNAL_PRESS_LOST) {
else if(sign == LV_SIGNAL_PRESS_LOST) {
ext->changed = 0; ext->changed = 0;
if(lv_sw_get_state(sw)) lv_slider_set_style(sw, LV_SLIDER_STYLE_KNOB, ext->style_knob_on); if(lv_sw_get_state(sw)) lv_slider_set_style(sw, LV_SLIDER_STYLE_KNOB, ext->style_knob_on);
else lv_slider_set_style(sw, LV_SLIDER_STYLE_KNOB, ext->style_knob_off); else lv_slider_set_style(sw, LV_SLIDER_STYLE_KNOB, ext->style_knob_off);
} } else if(sign == LV_SIGNAL_RELEASED) {
else if(sign == LV_SIGNAL_RELEASED) {
if(ext->changed == 0) { if(ext->changed == 0) {
int16_t v = lv_slider_get_value(sw); int16_t v = lv_slider_get_value(sw);
if(v == 0) lv_slider_set_value(sw, 1); if(v == 0) lv_slider_set_value(sw, 1);
@ -239,8 +241,7 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
if(slider_action != NULL) slider_action(sw); if(slider_action != NULL) slider_action(sw);
ext->changed = 0; ext->changed = 0;
} } else if(sign == LV_SIGNAL_CONTROLL) {
else if(sign == LV_SIGNAL_CONTROLL) {
char c = *((char *)param); char c = *((char *)param);
if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) {
@ -248,17 +249,14 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
else lv_sw_on(sw); else lv_sw_on(sw);
if(slider_action) slider_action(sw); if(slider_action) slider_action(sw);
} } else if(c == LV_GROUP_KEY_UP || c == LV_GROUP_KEY_RIGHT) {
else if(c == LV_GROUP_KEY_UP || c== LV_GROUP_KEY_RIGHT) {
lv_sw_on(sw); lv_sw_on(sw);
if(slider_action) slider_action(sw); if(slider_action) slider_action(sw);
} } else if(c == LV_GROUP_KEY_DOWN || c == LV_GROUP_KEY_LEFT) {
else if(c == LV_GROUP_KEY_DOWN || c== LV_GROUP_KEY_LEFT) {
lv_sw_off(sw); lv_sw_off(sw);
if(slider_action) slider_action(sw); if(slider_action) slider_action(sw);
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -611,10 +611,14 @@ lv_style_t * lv_ta_get_style(lv_obj_t *ta, lv_ta_style_t type)
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
switch(type) { switch(type) {
case LV_TA_STYLE_BG: return lv_page_get_style(ta, LV_PAGE_STYLE_BG); case LV_TA_STYLE_BG:
case LV_TA_STYLE_SB: return lv_page_get_style(ta, LV_PAGE_STYLE_SB); return lv_page_get_style(ta, LV_PAGE_STYLE_BG);
case LV_TA_STYLE_CURSOR: return ext->cursor.style; case LV_TA_STYLE_SB:
default: return NULL; return lv_page_get_style(ta, LV_PAGE_STYLE_SB);
case LV_TA_STYLE_CURSOR:
return ext->cursor.style;
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -763,8 +767,7 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * mask, lv_
if(ta_ext->cursor.type == LV_CURSOR_NONE || if(ta_ext->cursor.type == LV_CURSOR_NONE ||
(ta_ext->cursor.type & LV_CURSOR_HIDDEN) || (ta_ext->cursor.type & LV_CURSOR_HIDDEN) ||
ta_ext->cursor.state == 0 || ta_ext->cursor.state == 0 ||
label_style->body.opa == LV_OPA_TRANSP) label_style->body.opa == LV_OPA_TRANSP) {
{
return true; /*The cursor is not visible now*/ return true; /*The cursor is not visible now*/
} }
@ -772,8 +775,7 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * mask, lv_
lv_style_t cur_style; lv_style_t cur_style;
if(ta_ext->cursor.style != NULL) { if(ta_ext->cursor.style != NULL) {
lv_style_copy(&cur_style, ta_ext->cursor.style); lv_style_copy(&cur_style, ta_ext->cursor.style);
} } else {
else {
/*If cursor style is not specified then use the modified label style */ /*If cursor style is not specified then use the modified label style */
lv_style_copy(&cur_style, label_style); lv_style_copy(&cur_style, label_style);
lv_color_t clv_color_tmp = cur_style.text.color; /*Make letter color to cursor color*/ lv_color_t clv_color_tmp = cur_style.text.color; /*Make letter color to cursor color*/
@ -933,8 +935,7 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
lv_label_set_text(ext->label, NULL); /*Refresh the label*/ lv_label_set_text(ext->label, NULL); /*Refresh the label*/
} }
} }
} } else if(sign == LV_SIGNAL_CONTROLL) {
else if (sign == LV_SIGNAL_CONTROLL) {
uint32_t c = *((uint32_t *)param); /*uint32_t because can be UTF-8*/ uint32_t c = *((uint32_t *)param); /*uint32_t because can be UTF-8*/
if(c == LV_GROUP_KEY_RIGHT) lv_ta_cursor_right(ta); if(c == LV_GROUP_KEY_RIGHT) lv_ta_cursor_right(ta);
else if(c == LV_GROUP_KEY_LEFT) lv_ta_cursor_left(ta); else if(c == LV_GROUP_KEY_LEFT) lv_ta_cursor_left(ta);
@ -945,8 +946,7 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
/*Swap the bytes (UTF-8 is big endian, but the MCUs are little endian)*/ /*Swap the bytes (UTF-8 is big endian, but the MCUs are little endian)*/
if((c & 0x80) == 0) { /*ASCII*/ if((c & 0x80) == 0) { /*ASCII*/
lv_ta_add_char(ta, (char)c); lv_ta_add_char(ta, (char)c);
} } else {
else {
uint32_t swapped[2] = {0, 0}; /*the 2. element is the closing '\0'*/ uint32_t swapped[2] = {0, 0}; /*the 2. element is the closing '\0'*/
uint8_t c8[4]; uint8_t c8[4];
memcpy(c8, &c, 4); memcpy(c8, &c, 4);
@ -963,8 +963,7 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
#endif #endif
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@ -468,13 +468,20 @@ lv_style_t * lv_tabview_get_style(lv_obj_t *tabview, lv_tabview_style_t type)
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview); lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
switch(type) { switch(type) {
case LV_TABVIEW_STYLE_BG: return lv_obj_get_style(tabview); case LV_TABVIEW_STYLE_BG:
case LV_TABVIEW_STYLE_BTN_BG: return lv_btnm_get_style(ext->btns, LV_BTNM_STYLE_BG); return lv_obj_get_style(tabview);
case LV_TABVIEW_STYLE_BTN_REL: return lv_btnm_get_style(ext->btns, LV_BTNM_STYLE_BTN_REL); case LV_TABVIEW_STYLE_BTN_BG:
case LV_TABVIEW_STYLE_BTN_PR: return lv_btnm_get_style(ext->btns, LV_BTNM_STYLE_BTN_PR); return lv_btnm_get_style(ext->btns, LV_BTNM_STYLE_BG);
case LV_TABVIEW_STYLE_BTN_TGL_REL: return lv_btnm_get_style(ext->btns, LV_BTNM_STYLE_BTN_TGL_REL); case LV_TABVIEW_STYLE_BTN_REL:
case LV_TABVIEW_STYLE_BTN_TGL_PR: return lv_btnm_get_style(ext->btns, LV_BTNM_STYLE_BTN_TGL_PR); return lv_btnm_get_style(ext->btns, LV_BTNM_STYLE_BTN_REL);
default: return NULL; case LV_TABVIEW_STYLE_BTN_PR:
return lv_btnm_get_style(ext->btns, LV_BTNM_STYLE_BTN_PR);
case LV_TABVIEW_STYLE_BTN_TGL_REL:
return lv_btnm_get_style(ext->btns, LV_BTNM_STYLE_BTN_TGL_REL);
case LV_TABVIEW_STYLE_BTN_TGL_PR:
return lv_btnm_get_style(ext->btns, LV_BTNM_STYLE_BTN_TGL_PR);
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -509,21 +516,17 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
ext->tab_name_ptr = NULL; ext->tab_name_ptr = NULL;
ext->btns = NULL; /*These objects were children so they are already invalid*/ ext->btns = NULL; /*These objects were children so they are already invalid*/
ext->content = NULL; ext->content = NULL;
} } else if(sign == LV_SIGNAL_CORD_CHG) {
else if(sign == LV_SIGNAL_CORD_CHG) {
if(ext->content != NULL && if(ext->content != NULL &&
(lv_obj_get_width(tabview) != lv_area_get_width(param) || (lv_obj_get_width(tabview) != lv_area_get_width(param) ||
lv_obj_get_height(tabview) != lv_area_get_height(param))) lv_obj_get_height(tabview) != lv_area_get_height(param))) {
{
tabview_realign(tabview); tabview_realign(tabview);
} }
} } else if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_CONTROLL) {
else if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_CONTROLL) {
if(ext->btns) { if(ext->btns) {
ext->btns->signal_func(ext->btns, sign, param); ext->btns->signal_func(ext->btns, sign, param);
} }
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
@ -558,11 +561,9 @@ static lv_res_t tabpage_signal(lv_obj_t * tab_page, lv_signal_t sign, void * par
if(sign == LV_SIGNAL_PRESSED) { if(sign == LV_SIGNAL_PRESSED) {
tabpage_pressed_handler(tabview, tab_page); tabpage_pressed_handler(tabview, tab_page);
} } else if(sign == LV_SIGNAL_PRESSING) {
else if(sign == LV_SIGNAL_PRESSING) {
tabpage_pressing_handler(tabview, tab_page); tabpage_pressing_handler(tabview, tab_page);
} } else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
tabpage_press_lost_handler(tabview, tab_page); tabpage_press_lost_handler(tabview, tab_page);
} }
@ -591,11 +592,9 @@ static lv_res_t tabpage_scrl_signal(lv_obj_t * tab_scrl, lv_signal_t sign, void
if(sign == LV_SIGNAL_PRESSED) { if(sign == LV_SIGNAL_PRESSED) {
tabpage_pressed_handler(tabview, tab_page); tabpage_pressed_handler(tabview, tab_page);
} } else if(sign == LV_SIGNAL_PRESSING) {
else if(sign == LV_SIGNAL_PRESSING) {
tabpage_pressing_handler(tabview, tab_page); tabpage_pressing_handler(tabview, tab_page);
} } else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
tabpage_press_lost_handler(tabview, tab_page); tabpage_press_lost_handler(tabview, tab_page);
} }

View File

@ -374,14 +374,22 @@ lv_style_t * lv_win_get_style(lv_obj_t *win, lv_win_style_t type)
lv_win_ext_t * ext = lv_obj_get_ext_attr(win); lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
switch(type) { switch(type) {
case LV_WIN_STYLE_BG: return lv_obj_get_style(win); case LV_WIN_STYLE_BG:
case LV_WIN_STYLE_CONTENT_BG: return lv_page_get_style(ext->page, LV_PAGE_STYLE_BG); return lv_obj_get_style(win);
case LV_WIN_STYLE_CONTENT_SCRL: return lv_page_get_style(ext->page, LV_PAGE_STYLE_SCRL); case LV_WIN_STYLE_CONTENT_BG:
case LV_WIN_STYLE_SB: return lv_page_get_style(ext->page, LV_PAGE_STYLE_SB); return lv_page_get_style(ext->page, LV_PAGE_STYLE_BG);
case LV_WIN_STYLE_HEADER: return lv_obj_get_style(ext->header); case LV_WIN_STYLE_CONTENT_SCRL:
case LV_WIN_STYLE_BTN_REL: return ext->style_btn_rel; return lv_page_get_style(ext->page, LV_PAGE_STYLE_SCRL);
case LV_WIN_STYLE_BTN_PR: return ext->style_btn_pr; case LV_WIN_STYLE_SB:
default: return NULL; return lv_page_get_style(ext->page, LV_PAGE_STYLE_SB);
case LV_WIN_STYLE_HEADER:
return lv_obj_get_style(ext->header);
case LV_WIN_STYLE_BTN_REL:
return ext->style_btn_rel;
case LV_WIN_STYLE_BTN_PR:
return ext->style_btn_pr;
default:
return NULL;
} }
/*To avoid warning*/ /*To avoid warning*/
@ -439,23 +447,19 @@ static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
} }
} }
} }
} } else if(sign == LV_SIGNAL_STYLE_CHG) {
else if(sign == LV_SIGNAL_STYLE_CHG) {
lv_win_realign(win); lv_win_realign(win);
} } else if(sign == LV_SIGNAL_CORD_CHG) {
else if(sign == LV_SIGNAL_CORD_CHG) {
/*If the size is changed refresh the window*/ /*If the size is changed refresh the window*/
if(lv_area_get_width(param) != lv_obj_get_width(win) || if(lv_area_get_width(param) != lv_obj_get_width(win) ||
lv_area_get_height(param) != lv_obj_get_height(win)) { lv_area_get_height(param) != lv_obj_get_height(win)) {
lv_win_realign(win); lv_win_realign(win);
} }
} } else if(sign == LV_SIGNAL_CLEANUP) {
else if(sign == LV_SIGNAL_CLEANUP) {
ext->header = NULL; /*These objects were children so they are already invalid*/ ext->header = NULL; /*These objects were children so they are already invalid*/
ext->page = NULL; ext->page = NULL;
ext->title = NULL; ext->title = NULL;
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/