BigW Consortium Gitlab

Commit f0080b94 by Gabor Kiss-Vamosi

fixes and updates according to test results

parent 816327f4
...@@ -62,18 +62,18 @@ static void point_swap(point_t * p1, point_t * p2); ...@@ -62,18 +62,18 @@ static void point_swap(point_t * p1, point_t * p2);
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
#if LV_VDB_SIZE != 0 #if LV_VDB_SIZE != 0
static void (*px_fp)(cord_t x, cord_t y, const area_t * mask_p, color_t color, opa_t opacity) = lv_vpx; static void (*px_fp)(cord_t x, cord_t y, const area_t * mask_p, color_t color, opa_t opa) = lv_vpx;
static void (*fill_fp)(const area_t * cords_p, const area_t * mask_p, color_t color, opa_t opacity) = lv_vfill; static void (*fill_fp)(const area_t * cords_p, const area_t * mask_p, color_t color, opa_t opa) = lv_vfill;
static void (*letter_fp)(const point_t * pos_p, const area_t * mask_p, const font_t * font_p, uint32_t letter, color_t color, opa_t opacity) = lv_vletter; static void (*letter_fp)(const point_t * pos_p, const area_t * mask_p, const font_t * font_p, uint32_t letter, color_t color, opa_t opa) = lv_vletter;
#if USE_FSINT != 0 #if USE_FSINT != 0
static void (*map_fp)(const area_t * cords_p, const area_t * mask_p, const color_t * map_p, opa_t opacity, bool transp, bool upscale, color_t recolor, opa_t recolor_opa) = lv_vmap; static void (*map_fp)(const area_t * cords_p, const area_t * mask_p, const color_t * map_p, opa_t opa, bool transp, bool upscale, color_t recolor, opa_t recolor_opa) = lv_vmap;
#endif #endif
#else #else
static void (*px_fp)(cord_t x, cord_t y, const area_t * mask_p, color_t color, opa_t opacity) = lv_rpx; static void (*px_fp)(cord_t x, cord_t y, const area_t * mask_p, color_t color, opa_t opa) = lv_rpx;
static void (*fill_fp)(const area_t * cords_p, const area_t * mask_p, color_t color, opa_t opacity) = lv_rfill; static void (*fill_fp)(const area_t * cords_p, const area_t * mask_p, color_t color, opa_t opa) = lv_rfill;
static void (*letter_fp)(const point_t * pos_p, const area_t * mask_p, const font_t * font_p, uint32_t letter, color_t color, opa_t opacity) = lv_rletter; static void (*letter_fp)(const point_t * pos_p, const area_t * mask_p, const font_t * font_p, uint32_t letter, color_t color, opa_t opa) = lv_rletter;
#if USE_LV_IMG != 0 && USE_FSINT != 0 #if USE_LV_IMG != 0 && USE_FSINT != 0
static void (*map_fp)(const area_t * cords_p, const area_t * mask_p, const color_t * map_p, opa_t opacity, bool transp, bool upscale, color_t recolor, opa_t recolor_opa) = lv_rmap; static void (*map_fp)(const area_t * cords_p, const area_t * mask_p, const color_t * map_p, opa_t opa, bool transp, bool upscale, color_t recolor, opa_t recolor_opa) = lv_rmap;
#endif #endif
#endif #endif
...@@ -322,7 +322,7 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_style_ ...@@ -322,7 +322,7 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_style_
color_t color = style->text.color; color_t color = style->text.color;
if(cmd_state == CMD_STATE_IN) color = recolor; if(cmd_state == CMD_STATE_IN) color = recolor;
letter_fp(&pos, mask_p, font, letter, color, style->opacity); letter_fp(&pos, mask_p, font, letter, color, style->opa);
pos.x += (font_get_width(font, letter) >> FONT_ANTIALIAS) + style->text.space_letter; pos.x += (font_get_width(font, letter) >> FONT_ANTIALIAS) + style->text.space_letter;
...@@ -395,7 +395,7 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p, ...@@ -395,7 +395,7 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
const_data = true; const_data = true;
uint8_t * f_data = ((ufs_file_t*)file.file_d)->ent->data_d; uint8_t * f_data = ((ufs_file_t*)file.file_d)->ent->data_d;
f_data += sizeof(lv_img_raw_header_t); f_data += sizeof(lv_img_raw_header_t);
map_fp(cords_p, &mask_com, (void*)f_data , style->opacity, header.transp, upscale, style->image.color, style->image.intense); map_fp(cords_p, &mask_com, (void*)f_data , style->opa, header.transp, upscale, style->image.color, style->image.intense);
} }
#endif #endif
...@@ -429,7 +429,7 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p, ...@@ -429,7 +429,7 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
for(row = mask_com.y1; row <= mask_com.y2; row += us_val) { for(row = mask_com.y1; row <= mask_com.y2; row += us_val) {
res = fs_read(&file, buf, useful_data, &br); res = fs_read(&file, buf, useful_data, &br);
map_fp(&line, &mask_com, buf, style->opacity, header.transp, upscale, map_fp(&line, &mask_com, buf, style->opa, header.transp, upscale,
style->image.color, style->image.intense); style->image.color, style->image.intense);
fs_tell(&file, &act_pos); fs_tell(&file, &act_pos);
...@@ -515,7 +515,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, ...@@ -515,7 +515,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
draw_area.x2 = MATH_MAX(act_area.x1, act_area.x2); draw_area.x2 = MATH_MAX(act_area.x1, act_area.x2);
draw_area.y1 = MATH_MIN(act_area.y1, act_area.y2); draw_area.y1 = MATH_MIN(act_area.y1, act_area.y2);
draw_area.y2 = MATH_MAX(act_area.y1, act_area.y2); draw_area.y2 = MATH_MAX(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask_p, style->line.color, style->opacity); fill_fp(&draw_area, mask_p, style->line.color, style->opa);
} }
if (hor == false && last_x != act_point.x) { if (hor == false && last_x != act_point.x) {
area_t act_area; area_t act_area;
...@@ -531,7 +531,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, ...@@ -531,7 +531,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
draw_area.x2 = MATH_MAX(act_area.x1, act_area.x2); draw_area.x2 = MATH_MAX(act_area.x1, act_area.x2);
draw_area.y1 = MATH_MIN(act_area.y1, act_area.y2); draw_area.y1 = MATH_MIN(act_area.y1, act_area.y2);
draw_area.y2 = MATH_MAX(act_area.y1, act_area.y2); draw_area.y2 = MATH_MAX(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask_p, style->line.color, style->opacity); fill_fp(&draw_area, mask_p, style->line.color, style->opa);
} }
/*Calc. the next point of the line*/ /*Calc. the next point of the line*/
...@@ -559,7 +559,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, ...@@ -559,7 +559,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
draw_area.x2 = MATH_MAX(act_area.x1, act_area.x2); draw_area.x2 = MATH_MAX(act_area.x1, act_area.x2);
draw_area.y1 = MATH_MIN(act_area.y1, act_area.y2); draw_area.y1 = MATH_MIN(act_area.y1, act_area.y2);
draw_area.y2 = MATH_MAX(act_area.y1, act_area.y2); draw_area.y2 = MATH_MAX(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask_p, style->line.color, style->opacity); fill_fp(&draw_area, mask_p, style->line.color, style->opa);
} }
if (hor == false) { if (hor == false) {
area_t act_area; area_t act_area;
...@@ -573,7 +573,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, ...@@ -573,7 +573,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
draw_area.x2 = MATH_MAX(act_area.x1, act_area.x2); draw_area.x2 = MATH_MAX(act_area.x1, act_area.x2);
draw_area.y1 = MATH_MIN(act_area.y1, act_area.y2); draw_area.y1 = MATH_MIN(act_area.y1, act_area.y2);
draw_area.y2 = MATH_MAX(act_area.y1, act_area.y2); draw_area.y2 = MATH_MAX(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask_p, style->line.color, style->opacity); fill_fp(&draw_area, mask_p, style->line.color, style->opa);
} }
} }
...@@ -595,7 +595,7 @@ static void lv_draw_rect_main_mid(const area_t * cords_p, const area_t * mask_p, ...@@ -595,7 +595,7 @@ static void lv_draw_rect_main_mid(const area_t * cords_p, const area_t * mask_p,
color_t mcolor = style->body.color_main; color_t mcolor = style->body.color_main;
color_t gcolor = style->body.color_gradient; color_t gcolor = style->body.color_gradient;
uint8_t mix; uint8_t mix;
opa_t opa = style->opacity; opa_t opa = style->opa;
cord_t height = area_get_height(cords_p); cord_t height = area_get_height(cords_p);
cord_t width = area_get_width(cords_p); cord_t width = area_get_width(cords_p);
...@@ -645,7 +645,7 @@ static void lv_draw_rect_main_corner(const area_t * cords_p, const area_t * mask ...@@ -645,7 +645,7 @@ static void lv_draw_rect_main_corner(const area_t * cords_p, const area_t * mask
color_t mcolor = style_p->body.color_main; color_t mcolor = style_p->body.color_main;
color_t gcolor = style_p->body.color_gradient; color_t gcolor = style_p->body.color_gradient;
color_t act_color; color_t act_color;
opa_t opa = style_p->opacity; opa_t opa = style_p->opa;
uint8_t mix; uint8_t mix;
cord_t height = area_get_height(cords_p); cord_t height = area_get_height(cords_p);
cord_t width = area_get_width(cords_p); cord_t width = area_get_width(cords_p);
...@@ -816,7 +816,7 @@ static void lv_draw_rect_border_straight(const area_t * cords_p, const area_t * ...@@ -816,7 +816,7 @@ static void lv_draw_rect_border_straight(const area_t * cords_p, const area_t *
cord_t width = area_get_width(cords_p); cord_t width = area_get_width(cords_p);
cord_t height = area_get_height(cords_p); cord_t height = area_get_height(cords_p);
uint16_t bwidth = style_p->body.border.width; uint16_t bwidth = style_p->body.border.width;
opa_t bopa = (uint16_t)((uint16_t) style_p->opacity * style_p->body.border.opa) >> 8; opa_t bopa = (uint16_t)((uint16_t) style_p->opa * style_p->body.border.opa) >> 8;
area_t work_area; area_t work_area;
cord_t length_corr = 0; cord_t length_corr = 0;
cord_t corner_size = 0; cord_t corner_size = 0;
...@@ -930,7 +930,7 @@ static void lv_draw_rect_border_corner(const area_t * cords_p, const area_t * ma ...@@ -930,7 +930,7 @@ static void lv_draw_rect_border_corner(const area_t * cords_p, const area_t * ma
uint16_t radius = style->body.radius; uint16_t radius = style->body.radius;
uint16_t bwidth = style->body.border.width; uint16_t bwidth = style->body.border.width;
color_t bcolor = style->body.border.color; color_t bcolor = style->body.border.color;
opa_t bopa = (uint16_t)((uint16_t) style->opacity * style->body.border.opa ) >> 8; opa_t bopa = (uint16_t)((uint16_t) style->opa * style->body.border.opa ) >> 8;
/*0 px border width drawn as 1 px, so decrement the bwidth*/ /*0 px border width drawn as 1 px, so decrement the bwidth*/
bwidth--; bwidth--;
...@@ -1112,7 +1112,7 @@ static void lv_draw_cont_shadow_full(const area_t * cords_p, const area_t * mask ...@@ -1112,7 +1112,7 @@ static void lv_draw_cont_shadow_full(const area_t * cords_p, const area_t * mask
int16_t filter_size = 2 * style->body.shadow.width + 1; int16_t filter_size = 2 * style->body.shadow.width + 1;
for(row = 0; row < filter_size; row++) { for(row = 0; row < filter_size; row++) {
opa_h_result[row] = (uint32_t)((uint32_t)(filter_size - row) * style->opacity * 2) / (filter_size); opa_h_result[row] = (uint32_t)((uint32_t)(filter_size - row) * style->opa * 2) / (filter_size);
} }
uint16_t p; uint16_t p;
...@@ -1157,7 +1157,7 @@ static void lv_draw_cont_shadow_full(const area_t * cords_p, const area_t * mask ...@@ -1157,7 +1157,7 @@ static void lv_draw_cont_shadow_full(const area_t * cords_p, const area_t * mask
{ {
int16_t p_tmp = p - (cruve_x[row_v] - cruve_x[row]); int16_t p_tmp = p - (cruve_x[row_v] - cruve_x[row]);
if(p_tmp < -style->body.shadow.width) { /*Cols before the filtered shadow (still not blurred)*/ if(p_tmp < -style->body.shadow.width) { /*Cols before the filtered shadow (still not blurred)*/
opa_tmp += style->opacity * 2; opa_tmp += style->opa * 2;
} }
/*Cols after the filtered shadow (already no effect) */ /*Cols after the filtered shadow (already no effect) */
else if (p_tmp > style->body.shadow.width) { else if (p_tmp > style->body.shadow.width) {
...@@ -1252,7 +1252,7 @@ static void lv_draw_cont_shadow_bottom(const area_t * cords_p, const area_t * ma ...@@ -1252,7 +1252,7 @@ static void lv_draw_cont_shadow_bottom(const area_t * cords_p, const area_t * ma
int16_t filter_size = 2 * style->body.shadow.width + 1; int16_t filter_size = 2 * style->body.shadow.width + 1;
for(row = 0; row < filter_size; row++) { for(row = 0; row < filter_size; row++) {
opa_h_result[row] = (uint32_t)((uint32_t)(filter_size - row) * style->opacity) / (filter_size); opa_h_result[row] = (uint32_t)((uint32_t)(filter_size - row) * style->opa) / (filter_size);
} }
point_t point_l; point_t point_l;
......
...@@ -352,7 +352,7 @@ static lv_obj_t * lv_refr_get_top_obj(const area_t * area_p, lv_obj_t * obj) ...@@ -352,7 +352,7 @@ static lv_obj_t * lv_refr_get_top_obj(const area_t * area_p, lv_obj_t * obj)
/*If no better children check this object*/ /*If no better children check this object*/
if(found_p == NULL) { if(found_p == NULL) {
lv_style_t * style = lv_obj_get_style(obj); lv_style_t * style = lv_obj_get_style(obj);
if(style->opacity == OPA_COVER && if(style->opa == OPA_COVER &&
obj->design_func(obj, area_p, LV_DESIGN_COVER_CHK) != false) { obj->design_func(obj, area_p, LV_DESIGN_COVER_CHK) != false) {
found_p = obj; found_p = obj;
} }
...@@ -439,7 +439,7 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p) ...@@ -439,7 +439,7 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p)
/* Redraw the object */ /* Redraw the object */
lv_style_t * style = lv_obj_get_style(obj); lv_style_t * style = lv_obj_get_style(obj);
if(style->opacity != OPA_TRANSP) { if(style->opa != OPA_TRANSP) {
obj->design_func(obj, &obj_ext_mask, LV_DESIGN_DRAW_MAIN); obj->design_func(obj, &obj_ext_mask, LV_DESIGN_DRAW_MAIN);
//tick_wait_ms(100); /*DEBUG: Wait after every object draw to see the order of drawing*/ //tick_wait_ms(100); /*DEBUG: Wait after every object draw to see the order of drawing*/
} }
...@@ -472,7 +472,7 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p) ...@@ -472,7 +472,7 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p)
} }
/* If all the children are redrawn make 'post draw' design */ /* If all the children are redrawn make 'post draw' design */
if(style->opacity != OPA_TRANSP) { if(style->opa != OPA_TRANSP) {
obj->design_func(obj, &obj_ext_mask, LV_DESIGN_DRAW_POST); obj->design_func(obj, &obj_ext_mask, LV_DESIGN_DRAW_POST);
} }
} }
......
...@@ -68,12 +68,12 @@ void lv_style_init (void) ...@@ -68,12 +68,12 @@ void lv_style_init (void)
* HUE = 210*/ * HUE = 210*/
/*Screen style*/ /*Screen style*/
lv_style_scr.opacity = OPA_COVER; lv_style_scr.opa = OPA_COVER;
lv_style_scr.body.color_main = COLOR_WHITE; lv_style_scr.body.color_main = COLOR_WHITE;
lv_style_scr.body.color_gradient = COLOR_WHITE; lv_style_scr.body.color_gradient = COLOR_WHITE;
lv_style_scr.body.radius = 0; lv_style_scr.body.radius = 0;
lv_style_scr.body.padding.vertical = LV_DPI / 12; lv_style_scr.body.padding.ver = LV_DPI / 12;
lv_style_scr.body.padding.horizontal = LV_DPI / 12; lv_style_scr.body.padding.hor = LV_DPI / 12;
lv_style_scr.body.padding.inner = LV_DPI / 12; lv_style_scr.body.padding.inner = LV_DPI / 12;
lv_style_scr.body.empty = 0; lv_style_scr.body.empty = 0;
lv_style_scr.glass = 0; lv_style_scr.glass = 0;
...@@ -138,16 +138,16 @@ void lv_style_init (void) ...@@ -138,16 +138,16 @@ void lv_style_init (void)
/*Transparent tight style*/ /*Transparent tight style*/
memcpy(&lv_style_transparent_tight, &lv_style_transparent, sizeof(lv_style_t)); memcpy(&lv_style_transparent_tight, &lv_style_transparent, sizeof(lv_style_t));
lv_style_transparent_tight.body.padding.horizontal = 0; lv_style_transparent_tight.body.padding.hor = 0;
lv_style_transparent_tight.body.padding.vertical = 0; lv_style_transparent_tight.body.padding.ver = 0;
/*Button released style*/ /*Button released style*/
memcpy(&lv_style_button_off_released, &lv_style_plain, sizeof(lv_style_t)); memcpy(&lv_style_button_off_released, &lv_style_plain, sizeof(lv_style_t));
lv_style_button_off_released.body.color_main = COLOR_MAKE(0x76, 0xa2, 0xd0); lv_style_button_off_released.body.color_main = COLOR_MAKE(0x76, 0xa2, 0xd0);
lv_style_button_off_released.body.color_gradient = COLOR_MAKE(0x19, 0x3a, 0x5d); lv_style_button_off_released.body.color_gradient = COLOR_MAKE(0x19, 0x3a, 0x5d);
lv_style_button_off_released.body.radius = LV_DPI / 15; lv_style_button_off_released.body.radius = LV_DPI / 15;
lv_style_button_off_released.body.padding.horizontal = LV_DPI / 4; lv_style_button_off_released.body.padding.hor = LV_DPI / 4;
lv_style_button_off_released.body.padding.vertical = LV_DPI / 6; lv_style_button_off_released.body.padding.ver = LV_DPI / 6;
lv_style_button_off_released.body.padding.inner = LV_DPI / 10; lv_style_button_off_released.body.padding.inner = LV_DPI / 10;
lv_style_button_off_released.body.border.color = COLOR_MAKE(0x0b, 0x19, 0x28); lv_style_button_off_released.body.border.color = COLOR_MAKE(0x0b, 0x19, 0x28);
lv_style_button_off_released.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1; lv_style_button_off_released.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
...@@ -300,12 +300,12 @@ static void lv_style_aimator(lv_style_anim_dsc_t * dsc, int32_t val) ...@@ -300,12 +300,12 @@ static void lv_style_aimator(lv_style_anim_dsc_t * dsc, int32_t val)
const lv_style_t * end = dsc->style_end; const lv_style_t * end = dsc->style_end;
lv_style_t * act = dsc->style_anim; lv_style_t * act = dsc->style_anim;
STYLE_ATTR_ANIM(opacity, val); STYLE_ATTR_ANIM(opa, val);
STYLE_ATTR_ANIM(body.radius, val); STYLE_ATTR_ANIM(body.radius, val);
STYLE_ATTR_ANIM(body.border.width, val); STYLE_ATTR_ANIM(body.border.width, val);
STYLE_ATTR_ANIM(body.shadow.width, val); STYLE_ATTR_ANIM(body.shadow.width, val);
STYLE_ATTR_ANIM(body.padding.horizontal, val); STYLE_ATTR_ANIM(body.padding.hor, val);
STYLE_ATTR_ANIM(body.padding.vertical, val); STYLE_ATTR_ANIM(body.padding.ver, val);
STYLE_ATTR_ANIM(body.padding.inner, val); STYLE_ATTR_ANIM(body.padding.inner, val);
STYLE_ATTR_ANIM(text.space_line, val); STYLE_ATTR_ANIM(text.space_line, val);
STYLE_ATTR_ANIM(text.space_letter, val); STYLE_ATTR_ANIM(text.space_letter, val);
......
...@@ -42,18 +42,18 @@ typedef enum ...@@ -42,18 +42,18 @@ typedef enum
typedef struct typedef struct
{ {
opa_t opacity; opa_t opa;
uint8_t glass :1; /*1: Do not inherit this style*/ uint8_t glass :1; /*1: Do not inherit this style*/
struct { struct {
color_t color_main; color_t color_main;
color_t color_gradient; color_t color_gradient;
cord_t radius; /*Corner radius of background*/ cord_t radius;
struct { struct {
color_t color; color_t color;
cord_t width; cord_t width;
opa_t opa; /*Opacity of background border*/ opa_t opa;
}border; }border;
struct { struct {
...@@ -63,8 +63,8 @@ typedef struct ...@@ -63,8 +63,8 @@ typedef struct
}shadow; }shadow;
struct { struct {
cord_t vertical; cord_t ver;
cord_t horizontal; cord_t hor;
cord_t inner; cord_t inner;
}padding; }padding;
......
...@@ -285,10 +285,10 @@ static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t ...@@ -285,10 +285,10 @@ static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t
lv_style_t * style_indic = lv_bar_get_indicator_style(bar); lv_style_t * style_indic = lv_bar_get_indicator_style(bar);
area_t indic_area; area_t indic_area;
area_cpy(&indic_area, &bar->coords); area_cpy(&indic_area, &bar->coords);
indic_area.x1 += style_indic->body.padding.horizontal; indic_area.x1 += style_indic->body.padding.hor;
indic_area.x2 -= style_indic->body.padding.horizontal; indic_area.x2 -= style_indic->body.padding.hor;
indic_area.y1 += style_indic->body.padding.vertical; indic_area.y1 += style_indic->body.padding.ver;
indic_area.y2 -= style_indic->body.padding.vertical; indic_area.y2 -= style_indic->body.padding.ver;
cord_t w = area_get_width(&indic_area); cord_t w = area_get_width(&indic_area);
cord_t h = area_get_height(&indic_area); cord_t h = area_get_height(&indic_area);
......
...@@ -267,9 +267,9 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map) ...@@ -267,9 +267,9 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
/*Set size and positions of the buttons*/ /*Set size and positions of the buttons*/
lv_style_t * btnms = lv_obj_get_style(btnm); lv_style_t * btnms = lv_obj_get_style(btnm);
cord_t max_w = lv_obj_get_width(btnm) - 2 * btnms->body.padding.horizontal; cord_t max_w = lv_obj_get_width(btnm) - 2 * btnms->body.padding.hor;
cord_t max_h = lv_obj_get_height(btnm) - 2 * btnms->body.padding.vertical; cord_t max_h = lv_obj_get_height(btnm) - 2 * btnms->body.padding.ver;
cord_t act_y = btnms->body.padding.vertical; cord_t act_y = btnms->body.padding.ver;
/*Count the lines to calculate button height*/ /*Count the lines to calculate button height*/
uint8_t line_cnt = 1; uint8_t line_cnt = 1;
...@@ -308,7 +308,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map) ...@@ -308,7 +308,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
/*Set the button size and positions and set the texts*/ /*Set the button size and positions and set the texts*/
uint16_t i; uint16_t i;
cord_t act_x = btnms->body.padding.horizontal; cord_t act_x = btnms->body.padding.hor;
cord_t act_unit_w; cord_t act_unit_w;
unit_act_cnt = 0; unit_act_cnt = 0;
for(i = 0; i < btn_cnt; i++) { for(i = 0; i < btn_cnt; i++) {
...@@ -318,7 +318,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map) ...@@ -318,7 +318,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
act_unit_w = (all_unit_w * get_button_width(map_p_tmp[i])) / unit_cnt; act_unit_w = (all_unit_w * get_button_width(map_p_tmp[i])) / unit_cnt;
/*Always recalculate act_x because of rounding errors */ /*Always recalculate act_x because of rounding errors */
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * btnms->body.padding.inner + btnms->body.padding.horizontal; act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * btnms->body.padding.inner + btnms->body.padding.hor;
area_set(&ext->button_areas[btn_i], act_x, area_set(&ext->button_areas[btn_i], act_x,
act_y, act_y,
......
...@@ -69,7 +69,6 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -69,7 +69,6 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
/*Init the new checkbox object*/ /*Init the new checkbox object*/
if(copy == NULL) { if(copy == NULL) {
ext->bullet = lv_btn_create(new_cb, NULL); ext->bullet = lv_btn_create(new_cb, NULL);
if(ancestor_bullet_design_f == NULL) ancestor_bullet_design_f = lv_obj_get_design_func(ext->bullet);
lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_RELEASED, lv_style_get(LV_STYLE_TRANSPARENT)); lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_RELEASED, lv_style_get(LV_STYLE_TRANSPARENT));
lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_PRESSED, lv_style_get(LV_STYLE_TRANSPARENT)); lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_PRESSED, lv_style_get(LV_STYLE_TRANSPARENT));
lv_btn_set_style(new_cb, LV_BTN_STATE_ON_RELEASED, lv_style_get(LV_STYLE_TRANSPARENT)); lv_btn_set_style(new_cb, LV_BTN_STATE_ON_RELEASED, lv_style_get(LV_STYLE_TRANSPARENT));
...@@ -80,11 +79,12 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -80,11 +79,12 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
lv_cont_set_fit(new_cb, true, true); lv_cont_set_fit(new_cb, true, true);
lv_btn_set_toggle(new_cb, true); lv_btn_set_toggle(new_cb, true);
if(ancestor_bullet_design_f == NULL) ancestor_bullet_design_f = lv_obj_get_design_func(ext->bullet);
lv_obj_set_click(ext->bullet, false); lv_obj_set_click(ext->bullet, false);
lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_RELEASED, lv_style_get(LV_STYLE_PRETTY)); lv_btn_set_style(ext->bullet, LV_BTN_STATE_OFF_RELEASED, lv_style_get(LV_STYLE_PRETTY));
lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_PRESSED, lv_style_get(LV_STYLE_PRETTY_COLOR)); lv_btn_set_style(ext->bullet, LV_BTN_STATE_OFF_PRESSED, lv_style_get(LV_STYLE_PRETTY_COLOR));
lv_btn_set_style(new_cb, LV_BTN_STATE_ON_RELEASED, lv_style_get(LV_STYLE_BUTTON_ON_RELEASED)); lv_btn_set_style(ext->bullet, LV_BTN_STATE_ON_RELEASED, lv_style_get(LV_STYLE_BUTTON_ON_RELEASED));
lv_btn_set_style(new_cb, LV_BTN_STATE_ON_PRESSED, lv_style_get(LV_STYLE_BUTTON_ON_PRESSED)); lv_btn_set_style(ext->bullet, LV_BTN_STATE_ON_PRESSED, lv_style_get(LV_STYLE_BUTTON_ON_PRESSED));
ext->label = lv_label_create(new_cb, NULL); ext->label = lv_label_create(new_cb, NULL);
lv_obj_set_style(ext->label, NULL); /*Inherit the style of the parent*/ lv_obj_set_style(ext->label, NULL); /*Inherit the style of the parent*/
...@@ -125,6 +125,7 @@ bool lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param) ...@@ -125,6 +125,7 @@ bool lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
if(valid != false) { if(valid != false) {
if(sign == LV_SIGNAL_STYLE_CHG) { if(sign == LV_SIGNAL_STYLE_CHG) {
lv_obj_set_size(ext->bullet, font_get_height(style->text.font), font_get_height(style->text.font)); lv_obj_set_size(ext->bullet, font_get_height(style->text.font), font_get_height(style->text.font));
lv_btn_set_state(lv_cb_get_bullet(cb), lv_btn_get_state(cb));
} else if(sign == LV_SIGNAL_PRESSED || } else if(sign == LV_SIGNAL_PRESSED ||
sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_RELEASED ||
sign == LV_SIGNAL_PRESS_LOST) { sign == LV_SIGNAL_PRESS_LOST) {
...@@ -243,7 +244,7 @@ static bool lv_bullet_design(lv_obj_t * bullet, const area_t * mask, lv_design_m ...@@ -243,7 +244,7 @@ static bool lv_bullet_design(lv_obj_t * bullet, const area_t * mask, lv_design_m
lv_obj_t * bg = lv_obj_get_parent(bullet); lv_obj_t * bg = lv_obj_get_parent(bullet);
lv_style_t * style_page = lv_obj_get_style(bg); lv_style_t * style_page = lv_obj_get_style(bg);
lv_group_t * g = lv_obj_get_group(bg); lv_group_t * g = lv_obj_get_group(bg);
if(style_page->body.empty != 0 || style_page->opacity == OPA_TRANSP) { /*Background is visible?*/ if(style_page->body.empty != 0 || style_page->opa == OPA_TRANSP) { /*Background is visible?*/
if(lv_group_get_focused(g) == bg) { if(lv_group_get_focused(g) == bg) {
lv_style_t * style_mod; lv_style_t * style_mod;
style_mod = lv_group_mod_style(g, style_ori); style_mod = lv_group_mod_style(g, style_ori);
......
...@@ -71,10 +71,10 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -71,10 +71,10 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
ext->dl_num = 0; ext->dl_num = 0;
ext->ymin = LV_CHART_YMIN_DEF; ext->ymin = LV_CHART_YMIN_DEF;
ext->ymax = LV_CHART_YMAX_DEF; ext->ymax = LV_CHART_YMAX_DEF;
ext->hdiv_num = LV_CHART_HDIV_DEF; ext->hdiv_cnt = LV_CHART_HDIV_DEF;
ext->vdiv_num = LV_CHART_VDIV_DEF; ext->vdiv_cnt = LV_CHART_VDIV_DEF;
ext->pnum = LV_CHART_PNUM_DEF; ext->pnum = LV_CHART_PNUM_DEF;
ext->type = LV_CHART_LINE; ext->type = LV_CHART_TYPE_LINE;
ext->dl_opa = OPA_COVER; ext->dl_opa = OPA_COVER;
ext->dl_dark = OPA_50; ext->dl_dark = OPA_50;
ext->dl_width = 2 << LV_ANTIALIAS; ext->dl_width = 2 << LV_ANTIALIAS;
...@@ -87,13 +87,14 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -87,13 +87,14 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
/*Init the new chart background object*/ /*Init the new chart background object*/
if(copy == NULL) { if(copy == NULL) {
lv_obj_set_style(new_chart, lv_style_get(LV_STYLE_PRETTY)); lv_obj_set_style(new_chart, lv_style_get(LV_STYLE_PRETTY));
lv_obj_set_size(new_chart, LV_HOR_RES / 2, LV_VER_RES / 2);
} else { } else {
lv_chart_ext_t * ext_copy = lv_obj_get_ext_attr(copy); lv_chart_ext_t * ext_copy = lv_obj_get_ext_attr(copy);
ext->type = ext_copy->type; ext->type = ext_copy->type;
ext->ymin = ext_copy->ymin; ext->ymin = ext_copy->ymin;
ext->ymax = ext_copy->ymax; ext->ymax = ext_copy->ymax;
ext->hdiv_num = ext_copy->hdiv_num; ext->hdiv_cnt = ext_copy->hdiv_cnt;
ext->vdiv_num = ext_copy->vdiv_num; ext->vdiv_cnt = ext_copy->vdiv_cnt;
ext->pnum = ext_copy->pnum; ext->pnum = ext_copy->pnum;
ext->dl_opa = ext_copy->dl_opa; ext->dl_opa = ext_copy->dl_opa;
...@@ -167,7 +168,7 @@ lv_chart_dl_t * lv_chart_add_data_line(lv_obj_t * chart, color_t color) ...@@ -167,7 +168,7 @@ lv_chart_dl_t * lv_chart_add_data_line(lv_obj_t * chart, color_t color)
* Refresh a chart if its data line has changed * Refresh a chart if its data line has changed
* @param chart pointer to chart object * @param chart pointer to chart object
*/ */
void lv_chart_refr(lv_obj_t * chart) void lv_chart_refresh(lv_obj_t * chart)
{ {
lv_obj_invalidate(chart); lv_obj_invalidate(chart);
} }
...@@ -181,12 +182,12 @@ void lv_chart_refr(lv_obj_t * chart) ...@@ -181,12 +182,12 @@ void lv_chart_refr(lv_obj_t * chart)
* @param hdiv number of horizontal division lines * @param hdiv number of horizontal division lines
* @param vdiv number of vertical division lines * @param vdiv number of vertical division lines
*/ */
void lv_chart_set_hvdiv(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv) void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv)
{ {
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->hdiv_num = hdiv; ext->hdiv_cnt = hdiv;
ext->vdiv_num = vdiv; ext->vdiv_cnt = vdiv;
lv_obj_invalidate(chart); lv_obj_invalidate(chart);
} }
...@@ -206,7 +207,7 @@ void lv_chart_set_range(lv_obj_t * chart, cord_t ymin, cord_t ymax) ...@@ -206,7 +207,7 @@ void lv_chart_set_range(lv_obj_t * chart, cord_t ymin, cord_t ymax)
ext->ymin = ymin; ext->ymin = ymin;
ext->ymax = ymax; ext->ymax = ymax;
lv_chart_refr(chart); lv_chart_refresh(chart);
} }
/** /**
...@@ -219,7 +220,7 @@ void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type) ...@@ -219,7 +220,7 @@ void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type)
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->type = type; ext->type = type;
lv_chart_refr(chart); lv_chart_refresh(chart);
} }
/** /**
...@@ -231,15 +232,25 @@ void lv_chart_set_pnum(lv_obj_t * chart, uint16_t pnum) ...@@ -231,15 +232,25 @@ void lv_chart_set_pnum(lv_obj_t * chart, uint16_t pnum)
{ {
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_chart_dl_t * dl; lv_chart_dl_t * dl;
uint16_t pnum_old = ext->pnum;
uint16_t i;
cord_t def = (ext->ymin + ext->ymax) >> 1; /*half range as default value*/
if(pnum < 1) pnum = 1; if(pnum < 1) pnum = 1;
LL_READ_BACK(ext->dl_ll, dl) { LL_READ_BACK(ext->dl_ll, dl) {
dl->points = dm_realloc(dl->points, sizeof(cord_t) * pnum); dl->points = dm_realloc(dl->points, sizeof(cord_t) * pnum);
/*Initialize the new points*/
if(pnum > pnum_old) {
for(i = pnum_old - 1; i < pnum; i++) {
dl->points[i] = def;
}
}
} }
ext->pnum = pnum; ext->pnum = pnum;
lv_chart_refr(chart); lv_chart_refresh(chart);
} }
/** /**
...@@ -291,7 +302,7 @@ void lv_chart_set_next(lv_obj_t * chart, lv_chart_dl_t * dl, cord_t y) ...@@ -291,7 +302,7 @@ void lv_chart_set_next(lv_obj_t * chart, lv_chart_dl_t * dl, cord_t y)
} }
dl->points[ext->pnum - 1] = y; dl->points[ext->pnum - 1] = y;
lv_chart_refr(chart); lv_chart_refresh(chart);
} }
...@@ -384,9 +395,9 @@ static bool lv_chart_design(lv_obj_t * chart, const area_t * mask, lv_design_mod ...@@ -384,9 +395,9 @@ static bool lv_chart_design(lv_obj_t * chart, const area_t * mask, lv_design_mod
lv_chart_draw_div(chart, mask); lv_chart_draw_div(chart, mask);
if(ext->type & LV_CHART_LINE) lv_chart_draw_lines(chart, mask); if(ext->type & LV_CHART_TYPE_LINE) lv_chart_draw_lines(chart, mask);
if(ext->type & LV_CHART_COL) lv_chart_draw_cols(chart, mask); if(ext->type & LV_CHART_TYPE_COLUMN) lv_chart_draw_cols(chart, mask);
if(ext->type & LV_CHART_POINT) lv_chart_draw_points(chart, mask); if(ext->type & LV_CHART_TYPE_POINT) lv_chart_draw_points(chart, mask);
} }
return true; return true;
} }
...@@ -411,20 +422,20 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask) ...@@ -411,20 +422,20 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
cord_t x_ofs = chart->coords.x1; cord_t x_ofs = chart->coords.x1;
cord_t y_ofs = chart->coords.y1; cord_t y_ofs = chart->coords.y1;
if(ext->hdiv_num != 0) { if(ext->hdiv_cnt != 0) {
/*Draw slide lines if no border*/ /*Draw slide lines if no border*/
if(style->body.border.width != 0) { if(style->body.border.width != 0) {
div_i_start = 1; div_i_start = 1;
div_i_end = ext->hdiv_num; div_i_end = ext->hdiv_cnt;
} else { } else {
div_i_start = 0; div_i_start = 0;
div_i_end = ext->hdiv_num + 1; div_i_end = ext->hdiv_cnt + 1;
} }
p1.x = 0 + x_ofs; p1.x = 0 + x_ofs;
p2.x = w + x_ofs; p2.x = w + x_ofs;
for(div_i = div_i_start; div_i <= div_i_end; div_i++) { for(div_i = div_i_start; div_i <= div_i_end; div_i++) {
p1.y = (int32_t)((int32_t)h * div_i) / (ext->hdiv_num + 1); p1.y = (int32_t)((int32_t)h * div_i) / (ext->hdiv_cnt + 1);
p1.y += y_ofs; p1.y += y_ofs;
if(div_i == div_i_start) p1.y += (style->line.width >> 1) + 1; /*The first line might not be visible*/ if(div_i == div_i_start) p1.y += (style->line.width >> 1) + 1; /*The first line might not be visible*/
if(div_i == div_i_end) p1.y -= (style->line.width >> 1) + 1; /*The last line might not be visible*/ if(div_i == div_i_end) p1.y -= (style->line.width >> 1) + 1; /*The last line might not be visible*/
...@@ -434,20 +445,20 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask) ...@@ -434,20 +445,20 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
} }
} }
if(ext->vdiv_num != 0) { if(ext->vdiv_cnt != 0) {
/*Draw slide lines if no border*/ /*Draw slide lines if no border*/
if(style->body.border.width != 0) { if(style->body.border.width != 0) {
div_i_start = 1; div_i_start = 1;
div_i_end = ext->vdiv_num; div_i_end = ext->vdiv_cnt;
} else { } else {
div_i_start = 0; div_i_start = 0;
div_i_end = ext->vdiv_num + 1; div_i_end = ext->vdiv_cnt + 1;
} }
p1.y = 0 + y_ofs; p1.y = 0 + y_ofs;
p2.y = h + y_ofs; p2.y = h + y_ofs;
for(div_i = div_i_start; div_i <= div_i_end; div_i ++) { for(div_i = div_i_start; div_i <= div_i_end; div_i ++) {
p1.x = (int32_t)((int32_t)w * div_i) / (ext->vdiv_num + 1); p1.x = (int32_t)((int32_t)w * div_i) / (ext->vdiv_cnt + 1);
p1.x += x_ofs; p1.x += x_ofs;
if(div_i == div_i_start) p1.x += (style->line.width >> 1) + 1; /*The first line might not be visible*/ if(div_i == div_i_start) p1.x += (style->line.width >> 1) + 1; /*The first line might not be visible*/
if(div_i == div_i_end) p1.x -= (style->line.width >> 1) + 1; /*The last line might not be visible*/ if(div_i == div_i_end) p1.x -= (style->line.width >> 1) + 1; /*The last line might not be visible*/
...@@ -477,7 +488,7 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask) ...@@ -477,7 +488,7 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
lv_chart_dl_t * dl; lv_chart_dl_t * dl;
lv_style_t lines; lv_style_t lines;
lv_style_copy(&lines, lv_style_get(LV_STYLE_PLAIN)); lv_style_copy(&lines, lv_style_get(LV_STYLE_PLAIN));
lines.opacity = (uint16_t)((uint16_t)style->opacity * ext->dl_opa) >> 8; lines.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
lines.line.width = ext->dl_width; lines.line.width = ext->dl_width;
/*Go through all data lines*/ /*Go through all data lines*/
...@@ -530,7 +541,7 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask) ...@@ -530,7 +541,7 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
style_point.body.border.width = 0; style_point.body.border.width = 0;
style_point.body.empty = 0; style_point.body.empty = 0;
style_point.body.radius = LV_RADIUS_CIRCLE; style_point.body.radius = LV_RADIUS_CIRCLE;
style_point.opacity = (uint16_t)((uint16_t)style->opacity * ext->dl_opa) >> 8; style_point.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
style_point.body.radius = ext->dl_width; style_point.body.radius = ext->dl_width;
/*Go through all data lines*/ /*Go through all data lines*/
...@@ -581,7 +592,7 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask) ...@@ -581,7 +592,7 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
rects.body.border.width = 0; rects.body.border.width = 0;
rects.body.empty = 0; rects.body.empty = 0;
rects.body.radius = 0; rects.body.radius = 0;
rects.opacity = (uint16_t)((uint16_t)style->opacity * ext->dl_opa) >> 8; rects.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
col_a.y2 = chart->coords.y2; col_a.y2 = chart->coords.y2;
......
...@@ -40,8 +40,8 @@ typedef struct ...@@ -40,8 +40,8 @@ typedef struct
ll_dsc_t dl_ll; /*Linked list for the data line pointers (stores lv_chart_dl_t)*/ ll_dsc_t dl_ll; /*Linked list for the data line pointers (stores lv_chart_dl_t)*/
cord_t ymin; /*y min value (used to scale the data)*/ cord_t ymin; /*y min value (used to scale the data)*/
cord_t ymax; /*y max value (used to scale the data)*/ cord_t ymax; /*y max value (used to scale the data)*/
uint8_t hdiv_num; /*Number of horizontal division lines*/ uint8_t hdiv_cnt; /*Number of horizontal division lines*/
uint8_t vdiv_num; /*Number of vertical division lines*/ uint8_t vdiv_cnt; /*Number of vertical division lines*/
uint16_t pnum; /*Point number in a data line*/ uint16_t pnum; /*Point number in a data line*/
cord_t dl_width; /*Line width or point radius*/ cord_t dl_width; /*Line width or point radius*/
uint8_t dl_num; /*Number of data lines in dl_ll*/ uint8_t dl_num; /*Number of data lines in dl_ll*/
...@@ -53,10 +53,9 @@ typedef struct ...@@ -53,10 +53,9 @@ typedef struct
/*Chart types*/ /*Chart types*/
typedef enum typedef enum
{ {
LV_CHART_NONE = 0, LV_CHART_TYPE_LINE = 0x01,
LV_CHART_LINE = 0x01, LV_CHART_TYPE_COLUMN = 0x02,
LV_CHART_COL = 0x02, LV_CHART_TYPE_POINT = 0x04,
LV_CHART_POINT = 0x04,
}lv_chart_type_t; }lv_chart_type_t;
...@@ -92,7 +91,7 @@ lv_chart_dl_t * lv_chart_add_data_line(lv_obj_t * chart, color_t color); ...@@ -92,7 +91,7 @@ lv_chart_dl_t * lv_chart_add_data_line(lv_obj_t * chart, color_t color);
* Refresh a chart if its data line has changed * Refresh a chart if its data line has changed
* @param chart pointer to chart object * @param chart pointer to chart object
*/ */
void lv_chart_refr(lv_obj_t * chart); void lv_chart_refresh(lv_obj_t * chart);
/** /**
* Set the number of horizontal and vertical division lines * Set the number of horizontal and vertical division lines
...@@ -100,7 +99,7 @@ void lv_chart_refr(lv_obj_t * chart); ...@@ -100,7 +99,7 @@ void lv_chart_refr(lv_obj_t * chart);
* @param hdiv number of horizontal division lines * @param hdiv number of horizontal division lines
* @param vdiv number of vertical division lines * @param vdiv number of vertical division lines
*/ */
void lv_chart_set_hvdiv(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv); void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv);
/** /**
* Set the minimal and maximal x and y values * Set the minimal and maximal x and y values
......
...@@ -75,8 +75,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -75,8 +75,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_allocate_ext_attr(new_rect, sizeof(lv_cont_ext_t)); lv_obj_allocate_ext_attr(new_rect, sizeof(lv_cont_ext_t));
lv_cont_ext_t * ext = lv_obj_get_ext_attr(new_rect); lv_cont_ext_t * ext = lv_obj_get_ext_attr(new_rect);
dm_assert(ext); dm_assert(ext);
ext->hfit_en = 0; ext->hor_fit = 0;
ext->vfit_en = 0; ext->ver_fit = 0;
ext->layout = LV_CONT_LAYOUT_OFF; ext->layout = LV_CONT_LAYOUT_OFF;
lv_obj_set_signal_func(new_rect, lv_cont_signal); lv_obj_set_signal_func(new_rect, lv_cont_signal);
...@@ -88,8 +88,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -88,8 +88,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
/*Copy an existing object*/ /*Copy an existing object*/
else { else {
lv_cont_ext_t * copy_ext = lv_obj_get_ext_attr(copy); lv_cont_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->hfit_en = copy_ext->hfit_en; ext->hor_fit = copy_ext->hor_fit;
ext->vfit_en = copy_ext->vfit_en; ext->ver_fit = copy_ext->ver_fit;
ext->layout = copy_ext->layout; ext->layout = copy_ext->layout;
/*Refresh the style with new signal function*/ /*Refresh the style with new signal function*/
...@@ -164,8 +164,8 @@ void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en) ...@@ -164,8 +164,8 @@ void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en)
{ {
lv_obj_invalidate(cont); lv_obj_invalidate(cont);
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont); lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
ext->hfit_en = hor_en == false ? 0 : 1; ext->hor_fit = hor_en == false ? 0 : 1;
ext->vfit_en = ver_en == false ? 0 : 1; ext->ver_fit = ver_en == false ? 0 : 1;
/*Send a signal to set a new size*/ /*Send a signal to set a new size*/
cont->signal_func(cont, LV_SIGNAL_CORD_CHG, cont); cont->signal_func(cont, LV_SIGNAL_CORD_CHG, cont);
...@@ -191,10 +191,10 @@ lv_cont_layout_t lv_cont_get_layout(lv_obj_t * cont) ...@@ -191,10 +191,10 @@ lv_cont_layout_t lv_cont_get_layout(lv_obj_t * cont)
* @param cont pointer to a container object * @param cont pointer to a container object
* @return true: horizontal padding is enabled * @return true: horizontal padding is enabled
*/ */
bool lv_cont_get_hfit(lv_obj_t * cont) bool lv_cont_get_hor_fit(lv_obj_t * cont)
{ {
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont); lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
return ext->hfit_en == 0 ? false : true; return ext->hor_fit == 0 ? false : true;
} }
/** /**
...@@ -202,10 +202,10 @@ bool lv_cont_get_hfit(lv_obj_t * cont) ...@@ -202,10 +202,10 @@ bool lv_cont_get_hfit(lv_obj_t * cont)
* @param cont pointer to a container object * @param cont pointer to a container object
* @return true: vertical padding is enabled * @return true: vertical padding is enabled
*/ */
bool lv_cont_get_vfit(lv_obj_t * cont) bool lv_cont_get_ver_fit(lv_obj_t * cont)
{ {
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont); lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
return ext->vfit_en == 0 ? false : true; return ext->ver_fit == 0 ? false : true;
} }
...@@ -281,7 +281,7 @@ static void lv_cont_layout_col(lv_obj_t * cont) ...@@ -281,7 +281,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
switch(type) { switch(type) {
case LV_CONT_LAYOUT_COL_L: case LV_CONT_LAYOUT_COL_L:
hpad_corr = style->body.padding.horizontal; hpad_corr = style->body.padding.hor;
align = LV_ALIGN_IN_TOP_LEFT; align = LV_ALIGN_IN_TOP_LEFT;
break; break;
case LV_CONT_LAYOUT_COL_M: case LV_CONT_LAYOUT_COL_M:
...@@ -289,7 +289,7 @@ static void lv_cont_layout_col(lv_obj_t * cont) ...@@ -289,7 +289,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
align = LV_ALIGN_IN_TOP_MID; align = LV_ALIGN_IN_TOP_MID;
break; break;
case LV_CONT_LAYOUT_COL_R: case LV_CONT_LAYOUT_COL_R:
hpad_corr = -style->body.padding.horizontal; hpad_corr = -style->body.padding.hor;
align = LV_ALIGN_IN_TOP_RIGHT; align = LV_ALIGN_IN_TOP_RIGHT;
break; break;
default: default:
...@@ -302,7 +302,7 @@ static void lv_cont_layout_col(lv_obj_t * cont) ...@@ -302,7 +302,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
* an unnecessary child change signals could be sent*/ * an unnecessary child change signals could be sent*/
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG); lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
/* Align the children */ /* Align the children */
cord_t last_cord = style->body.padding.vertical; cord_t last_cord = style->body.padding.ver;
LL_READ_BACK(cont->child_ll, child) { LL_READ_BACK(cont->child_ll, child) {
if(lv_obj_get_hidden(child) != false || if(lv_obj_get_hidden(child) != false ||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue; lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
...@@ -326,11 +326,11 @@ static void lv_cont_layout_row(lv_obj_t * cont) ...@@ -326,11 +326,11 @@ static void lv_cont_layout_row(lv_obj_t * cont)
/*Adjust margin and get the alignment type*/ /*Adjust margin and get the alignment type*/
lv_align_t align; lv_align_t align;
lv_style_t * style = lv_obj_get_style(cont); lv_style_t * style = lv_obj_get_style(cont);
cord_t vpad_corr = style->body.padding.vertical; cord_t vpad_corr = style->body.padding.ver;
switch(type) { switch(type) {
case LV_CONT_LAYOUT_ROW_T: case LV_CONT_LAYOUT_ROW_T:
vpad_corr = style->body.padding.vertical; vpad_corr = style->body.padding.ver;
align = LV_ALIGN_IN_TOP_LEFT; align = LV_ALIGN_IN_TOP_LEFT;
break; break;
case LV_CONT_LAYOUT_ROW_M: case LV_CONT_LAYOUT_ROW_M:
...@@ -338,7 +338,7 @@ static void lv_cont_layout_row(lv_obj_t * cont) ...@@ -338,7 +338,7 @@ static void lv_cont_layout_row(lv_obj_t * cont)
align = LV_ALIGN_IN_LEFT_MID; align = LV_ALIGN_IN_LEFT_MID;
break; break;
case LV_CONT_LAYOUT_ROW_B: case LV_CONT_LAYOUT_ROW_B:
vpad_corr = -style->body.padding.vertical; vpad_corr = -style->body.padding.ver;
align = LV_ALIGN_IN_BOTTOM_LEFT; align = LV_ALIGN_IN_BOTTOM_LEFT;
break; break;
default: default:
...@@ -352,7 +352,7 @@ static void lv_cont_layout_row(lv_obj_t * cont) ...@@ -352,7 +352,7 @@ static void lv_cont_layout_row(lv_obj_t * cont)
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG); lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
/* Align the children */ /* Align the children */
cord_t last_cord = style->body.padding.horizontal; cord_t last_cord = style->body.padding.hor;
LL_READ_BACK(cont->child_ll, child) { LL_READ_BACK(cont->child_ll, child) {
if(lv_obj_get_hidden(child) != false || if(lv_obj_get_hidden(child) != false ||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue; lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
...@@ -415,7 +415,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont) ...@@ -415,7 +415,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
lv_obj_t * child_tmp; /* Temporary child */ lv_obj_t * child_tmp; /* Temporary child */
lv_style_t * style = lv_obj_get_style(cont); lv_style_t * style = lv_obj_get_style(cont);
cord_t w_obj = lv_obj_get_width(cont); cord_t w_obj = lv_obj_get_width(cont);
cord_t act_y = style->body.padding.vertical; cord_t act_y = style->body.padding.ver;
/* Disable child change action because the children will be moved a lot /* Disable child change action because the children will be moved a lot
* an unnecessary child change signals could be sent*/ * an unnecessary child change signals could be sent*/
...@@ -427,7 +427,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont) ...@@ -427,7 +427,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
child_rc = child_rs; /*Initially the the row starter and closer is the same*/ child_rc = child_rs; /*Initially the the row starter and closer is the same*/
while(child_rs != NULL) { while(child_rs != NULL) {
cord_t h_row = 0; cord_t h_row = 0;
cord_t w_row = style->body.padding.horizontal * 2; /*The width is at least the left+right hpad*/ cord_t w_row = style->body.padding.hor * 2; /*The width is at least the left+right hpad*/
uint32_t obj_num = 0; uint32_t obj_num = 0;
/*Find the row closer object and collect some data*/ /*Find the row closer object and collect some data*/
...@@ -476,7 +476,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont) ...@@ -476,7 +476,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
else { else {
w_row -= style->body.padding.inner * obj_num; w_row -= style->body.padding.inner * obj_num;
cord_t new_opad = (w_obj - w_row) / (obj_num - 1); cord_t new_opad = (w_obj - w_row) / (obj_num - 1);
cord_t act_x = style->body.padding.horizontal; /*x init*/ cord_t act_x = style->body.padding.hor; /*x init*/
child_tmp = child_rs; child_tmp = child_rs;
while(child_tmp != NULL) { while(child_tmp != NULL) {
if(lv_obj_get_hidden(child_tmp) == false && if(lv_obj_get_hidden(child_tmp) == false &&
...@@ -509,10 +509,10 @@ static void lv_cont_layout_grid(lv_obj_t * cont) ...@@ -509,10 +509,10 @@ static void lv_cont_layout_grid(lv_obj_t * cont)
cord_t w_tot = lv_obj_get_width(cont); cord_t w_tot = lv_obj_get_width(cont);
cord_t w_obj = lv_obj_get_width(lv_obj_get_child(cont, NULL)); cord_t w_obj = lv_obj_get_width(lv_obj_get_child(cont, NULL));
cord_t h_obj = lv_obj_get_height(lv_obj_get_child(cont, NULL)); cord_t h_obj = lv_obj_get_height(lv_obj_get_child(cont, NULL));
uint16_t obj_row = (w_tot - (2 * style->body.padding.horizontal)) / (w_obj + style->body.padding.inner); /*Obj. num. in a row*/ uint16_t obj_row = (w_tot - (2 * style->body.padding.hor)) / (w_obj + style->body.padding.inner); /*Obj. num. in a row*/
cord_t x_ofs; cord_t x_ofs;
if(obj_row > 1) { if(obj_row > 1) {
x_ofs = w_obj + (w_tot - (2 * style->body.padding.horizontal) - (obj_row * w_obj)) / (obj_row - 1); x_ofs = w_obj + (w_tot - (2 * style->body.padding.hor) - (obj_row * w_obj)) / (obj_row - 1);
} else { } else {
x_ofs = w_tot / 2 - w_obj / 2; x_ofs = w_tot / 2 - w_obj / 2;
} }
...@@ -523,8 +523,8 @@ static void lv_cont_layout_grid(lv_obj_t * cont) ...@@ -523,8 +523,8 @@ static void lv_cont_layout_grid(lv_obj_t * cont)
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG); lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
/* Align the children */ /* Align the children */
cord_t act_x = style->body.padding.horizontal; cord_t act_x = style->body.padding.hor;
cord_t act_y = style->body.padding.vertical; cord_t act_y = style->body.padding.ver;
uint16_t obj_cnt = 0; uint16_t obj_cnt = 0;
LL_READ_BACK(cont->child_ll, child) { LL_READ_BACK(cont->child_ll, child) {
if(lv_obj_get_hidden(child) != false || if(lv_obj_get_hidden(child) != false ||
...@@ -540,7 +540,7 @@ static void lv_cont_layout_grid(lv_obj_t * cont) ...@@ -540,7 +540,7 @@ static void lv_cont_layout_grid(lv_obj_t * cont)
if(obj_cnt >= obj_row) { if(obj_cnt >= obj_row) {
obj_cnt = 0; obj_cnt = 0;
act_x = style->body.padding.horizontal; act_x = style->body.padding.hor;
act_y += y_ofs; act_y += y_ofs;
} }
} }
...@@ -556,8 +556,8 @@ static void lv_cont_refr_autofit(lv_obj_t * cont) ...@@ -556,8 +556,8 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
{ {
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont); lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
if(ext->hfit_en == 0 && if(ext->hor_fit == 0 &&
ext->vfit_en == 0) { ext->ver_fit == 0) {
return; return;
} }
...@@ -565,8 +565,8 @@ static void lv_cont_refr_autofit(lv_obj_t * cont) ...@@ -565,8 +565,8 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
area_t ori; area_t ori;
lv_style_t * style = lv_obj_get_style(cont); lv_style_t * style = lv_obj_get_style(cont);
lv_obj_t * i; lv_obj_t * i;
cord_t hpad = style->body.padding.horizontal; cord_t hpad = style->body.padding.hor;
cord_t vpad = style->body.padding.vertical; cord_t vpad = style->body.padding.ver;
/*Search the side coordinates of the children*/ /*Search the side coordinates of the children*/
lv_obj_get_coords(cont, &ori); lv_obj_get_coords(cont, &ori);
...@@ -587,14 +587,14 @@ static void lv_cont_refr_autofit(lv_obj_t * cont) ...@@ -587,14 +587,14 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
/*If the value is not the init value then the page has >=1 child.*/ /*If the value is not the init value then the page has >=1 child.*/
if(new_cords.x1 != CORD_MAX) { if(new_cords.x1 != CORD_MAX) {
if(ext->hfit_en != 0) { if(ext->hor_fit != 0) {
new_cords.x1 -= hpad; new_cords.x1 -= hpad;
new_cords.x2 += hpad; new_cords.x2 += hpad;
} else { } else {
new_cords.x1 = cont->coords.x1; new_cords.x1 = cont->coords.x1;
new_cords.x2 = cont->coords.x2; new_cords.x2 = cont->coords.x2;
} }
if(ext->vfit_en != 0) { if(ext->ver_fit != 0) {
new_cords.y1 -= vpad; new_cords.y1 -= vpad;
new_cords.y2 += vpad; new_cords.y2 += vpad;
} else { } else {
......
...@@ -45,15 +45,16 @@ typedef struct ...@@ -45,15 +45,16 @@ typedef struct
{ {
/*Inherited from 'base_obj' so no inherited ext. */ /*Ext. of ancestor*/ /*Inherited from 'base_obj' so no inherited ext. */ /*Ext. of ancestor*/
/*New data for this type */ /*New data for this type */
uint8_t layout :5; /*A layout from 'lv_cont_layout_t' enum*/ uint8_t layout :4; /*A layout from 'lv_cont_layout_t' enum*/
uint8_t hfit_en :1; /*Enable horizontal padding to involve all children*/ uint8_t hor_fit :1; /*1: Enable horizontal fit to involve all children*/
uint8_t vfit_en :1; /*Enable horizontal padding to involve all children*/ uint8_t ver_fit :1; /*1: Enable horizontal fir to involve all children*/
}lv_cont_ext_t; }lv_cont_ext_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
/** /**
* Create a container objects * Create a container objects
* @param par pointer to an object, it will be the parent of the new container * @param par pointer to an object, it will be the parent of the new container
...@@ -98,14 +99,14 @@ lv_cont_layout_t lv_cont_get_layout(lv_obj_t * cont); ...@@ -98,14 +99,14 @@ lv_cont_layout_t lv_cont_get_layout(lv_obj_t * cont);
* @param cont pointer to a container object * @param cont pointer to a container object
* @return true: horizontal padding is enabled * @return true: horizontal padding is enabled
*/ */
bool lv_cont_get_hfit(lv_obj_t * cont); bool lv_cont_get_hor_fit(lv_obj_t * cont);
/** /**
* Get vertical fit enable attribute of a container * Get vertical fit enable attribute of a container
* @param cont pointer to a container object * @param cont pointer to a container object
* @return true: vertical padding is enabled * @return true: vertical padding is enabled
*/ */
bool lv_cont_get_vfit(lv_obj_t * cont); bool lv_cont_get_ver_fit(lv_obj_t * cont);
/********************** /**********************
* MACROS * MACROS
......
...@@ -41,11 +41,11 @@ typedef struct ...@@ -41,11 +41,11 @@ typedef struct
{ {
lv_page_ext_t page; /*Ext. of ancestor*/ lv_page_ext_t page; /*Ext. of ancestor*/
/*New data for this type */ /*New data for this type */
lv_obj_t * opt_label; /*Label for the options*/ lv_obj_t * options_label; /*Label for the options*/
lv_style_t * style_sel; /*Style of the selected option*/ lv_style_t * selected_style; /*Style of the selected option*/
lv_action_t cb; /*Pointer to function to call when an option is selected*/ lv_action_t callback; /*Pointer to function to call when an option is selected*/
uint16_t num_opt; /*Number of options*/ uint16_t option_cnt; /*Number of options*/
uint16_t sel_opt; /*Index of the current option*/ uint16_t selected_option_id; /*Index of the current option*/
uint16_t anim_time; /*Open/Close animation time [ms]*/ uint16_t anim_time; /*Open/Close animation time [ms]*/
uint8_t opened :1; /*1: The list is opened*/ uint8_t opened :1; /*1: The list is opened*/
cord_t fix_height; /*Height if the ddlist is opened. (0: auto-size)*/ cord_t fix_height; /*Height if the ddlist is opened. (0: auto-size)*/
...@@ -74,15 +74,21 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy); ...@@ -74,15 +74,21 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy);
bool lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param); bool lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param);
/** /**
* Set the options in a drop down list * Set the options in a drop down list from an array
* @param ddlist pointer to drop down list object * @param ddlist pointer to drop down list object
* @param options an array of strings wit the text of the options. * @param options an array of strings with the text of the options.
* The lest element has to be "" (empty string) * The lest element has to be "" (empty string)
* E.g. const char * opts[] = {"apple", "banana", "orange", ""}; * E.g. const char * opts[] = {"apple", "banana", "orange", ""};
*/ */
void lv_ddlist_set_options(lv_obj_t * ddlist, const char ** options); void lv_ddlist_set_options(lv_obj_t * ddlist, const char ** options);
/**
* Set the options in a drop down list from a string
* @param ddlist pointer to drop down list object
* @param options a string with '\n' separated options. E.g. "One\nTwo\nThree"
*/
void lv_ddlist_set_options_str(lv_obj_t * ddlist, const char * options); void lv_ddlist_set_options_str(lv_obj_t * ddlist, const char * options);
/** /**
* Set the selected option * Set the selected option
* @param ddlist pointer to drop down list object * @param ddlist pointer to drop down list object
...@@ -90,7 +96,6 @@ void lv_ddlist_set_options_str(lv_obj_t * ddlist, const char * options); ...@@ -90,7 +96,6 @@ void lv_ddlist_set_options_str(lv_obj_t * ddlist, const char * options);
*/ */
void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt); void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt);
/** /**
* Set a function to call when a new option is chosen * Set a function to call when a new option is chosen
* @param ddlist pointer to a drop down list * @param ddlist pointer to a drop down list
...@@ -107,19 +112,32 @@ void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_t cb); ...@@ -107,19 +112,32 @@ void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_t cb);
void lv_ddlist_set_fix_height(lv_obj_t * ddlist, cord_t h); void lv_ddlist_set_fix_height(lv_obj_t * ddlist, cord_t h);
/** /**
* Set the open/close animation time.
* @param ddlist pointer to a drop down list
* @param anim_time: open/close animation time [ms]
*/
void lv_ddlist_set_anim_time(lv_obj_t * ddlist, uint16_t anim_time);
/**
* Set the style of the rectangle on the selected option * Set the style of the rectangle on the selected option
* @param ddlist pointer to a drop down list object * @param ddlist pointer to a drop down list object
* @param style pointer the new style of the select rectangle * @param style pointer the new style of the select rectangle
*/ */
void lv_ddlist_set_style_select(lv_obj_t * ddlist, lv_style_t * style); void lv_ddlist_set_selected_style(lv_obj_t * ddlist, lv_style_t * style);
/** /**
* Open or Collapse the drop down list * Open the drop down list with or without animation
* @param ddlist pointer to drop down list object * @param ddlist pointer to drop down list object
* @param state true: open; false: collapse * @param anim true: use animation; false: not use animations
* @param anim true: use animations; false: not use animations
*/ */
void lv_ddlist_open(lv_obj_t * ddlist, bool state, bool anim); void lv_ddlist_open(lv_obj_t * ddlist, bool anim);
/**
* Close (Collapse) the drop down list
* @param ddlist pointer to drop down list object
* @param anim true: use animation; false: not use animations
*/
void lv_ddlist_close(lv_obj_t * ddlist, bool anim);
/** /**
* Get the options of a drop down list * Get the options of a drop down list
...@@ -142,7 +160,6 @@ uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist); ...@@ -142,7 +160,6 @@ uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist);
*/ */
void lv_ddlist_get_selected_str(lv_obj_t * ddlist, char * buf); void lv_ddlist_get_selected_str(lv_obj_t * ddlist, char * buf);
/** /**
* Get the fix height value. * Get the fix height value.
* @param ddlist pointer to a drop down list object * @param ddlist pointer to a drop down list object
...@@ -157,6 +174,13 @@ cord_t lv_ddlist_get_fix_height(lv_obj_t * ddlist); ...@@ -157,6 +174,13 @@ cord_t lv_ddlist_get_fix_height(lv_obj_t * ddlist);
*/ */
lv_style_t * lv_ddlist_get_style_select(lv_obj_t * ddlist); lv_style_t * lv_ddlist_get_style_select(lv_obj_t * ddlist);
/**
* Get the open/close animation time.
* @param ddlist pointer to a drop down list
* @return open/close animation time [ms]
*/
uint16_t lv_ddlist_get_anim_time(lv_obj_t * ddlist);
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/
......
...@@ -46,10 +46,9 @@ typedef struct ...@@ -46,10 +46,9 @@ typedef struct
lv_lmeter_ext_t lmeter; /*Ext. of ancestor*/ lv_lmeter_ext_t lmeter; /*Ext. of ancestor*/
/*New data for this type */ /*New data for this type */
int16_t * values; /*Array of the set values (for needles) */ int16_t * values; /*Array of the set values (for needles) */
lv_style_t * style_critical; /*Fade to this style nearer to the critical value*/
color_t * needle_colors; /*Color of the needles (color_t my_colors[needle_num])*/ color_t * needle_colors; /*Color of the needles (color_t my_colors[needle_num])*/
uint8_t needle_num; /*Number of needles*/ uint8_t needle_count; /*Number of needles*/
uint8_t low_critical:1; /*0: the higher value is more critical, 1: the lower value is more critical*/ uint8_t label_count; /*Number of labels on the scale*/
}lv_gauge_ext_t; }lv_gauge_ext_t;
/********************** /**********************
...@@ -108,8 +107,9 @@ void lv_gauge_set_style_critical(lv_obj_t * gauge, lv_style_t * style); ...@@ -108,8 +107,9 @@ void lv_gauge_set_style_critical(lv_obj_t * gauge, lv_style_t * style);
* @param gauge pointer to gauge * @param gauge pointer to gauge
* @return number of needles * @return number of needles
*/ */
uint8_t lv_gauge_get_needle_num(lv_obj_t * gauge); uint8_t lv_gauge_get_needle_count(lv_obj_t * gauge);
uint8_t lv_gauge_get_label_count(lv_obj_t * gauge);
/** /**
* Get the value of a needle * Get the value of a needle
* @param gauge pointer to gauge object * @param gauge pointer to gauge object
......
...@@ -223,7 +223,7 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l ...@@ -223,7 +223,7 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l
/*Make the size adjustment*/ /*Make the size adjustment*/
cord_t w = lv_obj_get_width(list); cord_t w = lv_obj_get_width(list);
lv_style_t * style_scrl = lv_obj_get_style(lv_page_get_scrl(list)); lv_style_t * style_scrl = lv_obj_get_style(lv_page_get_scrl(list));
cord_t pad_hor_tot = style->body.padding.horizontal + style_scrl->body.padding.horizontal; cord_t pad_hor_tot = style->body.padding.hor + style_scrl->body.padding.hor;
w -= pad_hor_tot * 2; w -= pad_hor_tot * 2;
/*Make place for the scrollbar if pad_hor_tot is too small*/ /*Make place for the scrollbar if pad_hor_tot is too small*/
......
...@@ -186,7 +186,7 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const area_t * mask, lv_design_m ...@@ -186,7 +186,7 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const area_t * mask, lv_design_m
memcpy(&style_tmp, style, sizeof(lv_style_t)); memcpy(&style_tmp, style, sizeof(lv_style_t));
cord_t r_out = lv_obj_get_width(lmeter) / 2; cord_t r_out = lv_obj_get_width(lmeter) / 2;
cord_t r_in =r_out - style->body.padding.horizontal; cord_t r_in = r_out - style->body.padding.hor;
cord_t x_ofs = lv_obj_get_width(lmeter) / 2 + lmeter->coords.x1; cord_t x_ofs = lv_obj_get_width(lmeter) / 2 + lmeter->coords.x1;
cord_t y_ofs = lv_obj_get_height(lmeter) / 2 + lmeter->coords.y1; cord_t y_ofs = lv_obj_get_height(lmeter) / 2 + lmeter->coords.y1;
int16_t angle_ofs = 90 + (360 - ext->scale_angle) / 2; int16_t angle_ofs = 90 + (360 - ext->scale_angle) / 2;
......
...@@ -89,7 +89,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -89,7 +89,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_set_style(ext->scrl, lv_style_get(LV_STYLE_PRETTY)); lv_obj_set_style(ext->scrl, lv_style_get(LV_STYLE_PRETTY));
lv_obj_set_design_func(ext->scrl, lv_scrl_design); lv_obj_set_design_func(ext->scrl, lv_scrl_design);
lv_page_set_sb_width(new_page, style->body.padding.horizontal); lv_page_set_sb_width(new_page, style->body.padding.hor);
lv_page_set_sb_mode(new_page, ext->sb_mode); lv_page_set_sb_mode(new_page, ext->sb_mode);
lv_page_set_style_sb(new_page, ext->style_sb); lv_page_set_style_sb(new_page, ext->style_sb);
...@@ -155,8 +155,8 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) ...@@ -155,8 +155,8 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
} }
} else if(sign == LV_SIGNAL_STYLE_CHG) { } else if(sign == LV_SIGNAL_STYLE_CHG) {
lv_style_t * style = lv_obj_get_style(page); lv_style_t * style = lv_obj_get_style(page);
if(lv_cont_get_hfit(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.horizontal); lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.padding.hor);
} else { } else {
ext->scrl->signal_func(ext->scrl, LV_SIGNAL_CORD_CHG, &ext->scrl->coords); ext->scrl->signal_func(ext->scrl, LV_SIGNAL_CORD_CHG, &ext->scrl->coords);
} }
...@@ -177,8 +177,8 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) ...@@ -177,8 +177,8 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
(lv_obj_get_width(page) != area_get_width(param) || (lv_obj_get_width(page) != area_get_width(param) ||
lv_obj_get_height(page) != area_get_height(param))) { lv_obj_get_height(page) != area_get_height(param))) {
if(lv_cont_get_hfit(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.horizontal); lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.padding.hor);
} }
ext->scrl->signal_func(ext->scrl, LV_SIGNAL_CORD_CHG, &ext->scrl->coords); ext->scrl->signal_func(ext->scrl, LV_SIGNAL_CORD_CHG, &ext->scrl->coords);
...@@ -228,8 +228,8 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param) ...@@ -228,8 +228,8 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
if(sign == LV_SIGNAL_CORD_CHG) { if(sign == LV_SIGNAL_CORD_CHG) {
/*Be sure the width of the scrollable is correct*/ /*Be sure the width of the scrollable is correct*/
if(lv_cont_get_hfit(scrl) == false) { if(lv_cont_get_hor_fit(scrl) == false) {
lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * page_style->body.padding.horizontal); lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * page_style->body.padding.hor);
} }
cord_t new_x; cord_t new_x;
...@@ -238,8 +238,8 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param) ...@@ -238,8 +238,8 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
bool refr_y = false; bool refr_y = false;
area_t page_cords; area_t page_cords;
area_t scrl_cords; area_t scrl_cords;
cord_t hpad = page_style->body.padding.horizontal; cord_t hpad = page_style->body.padding.hor;
cord_t vpad = page_style->body.padding.vertical; cord_t vpad = page_style->body.padding.ver;
new_x = lv_obj_get_x(scrl); new_x = lv_obj_get_x(scrl);
new_y = lv_obj_get_y(scrl); new_y = lv_obj_get_y(scrl);
...@@ -288,8 +288,8 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param) ...@@ -288,8 +288,8 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
lv_page_sb_refresh(page); lv_page_sb_refresh(page);
} else if(sign == LV_SIGNAL_DRAG_BEGIN) { } else if(sign == LV_SIGNAL_DRAG_BEGIN) {
if(page_ext->sb_mode == LV_PAGE_SB_MODE_DRAG ) { if(page_ext->sb_mode == LV_PAGE_SB_MODE_DRAG ) {
cord_t sbh_pad = MATH_MAX(page_ext->sb_width, page_style->body.padding.horizontal); cord_t sbh_pad = MATH_MAX(page_ext->sb_width, page_style->body.padding.hor);
cord_t sbv_pad = MATH_MAX(page_ext->sb_width, page_style->body.padding.vertical); cord_t sbv_pad = MATH_MAX(page_ext->sb_width, page_style->body.padding.ver);
if(area_get_height(&page_ext->sbv) < lv_obj_get_height(scrl) - 2 * sbv_pad) { if(area_get_height(&page_ext->sbv) < lv_obj_get_height(scrl) - 2 * sbv_pad) {
page_ext->sbv_draw = 1; page_ext->sbv_draw = 1;
} }
...@@ -438,8 +438,8 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time) ...@@ -438,8 +438,8 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
if((obj_h <= page_h && top_err > 0) || if((obj_h <= page_h && top_err > 0) ||
(obj_h > page_h && top_err < bot_err)) { (obj_h > page_h && top_err < bot_err)) {
/*Calculate a new position and to let scrable_rects.vpad space above*/ /*Calculate a new position and to let scrable_rects.vpad space above*/
scrlable_y = -(obj_y - style_scrl->body.padding.vertical - style->body.padding.vertical); scrlable_y = -(obj_y - style_scrl->body.padding.ver - style->body.padding.ver);
scrlable_y += style_scrl->body.padding.vertical; scrlable_y += style_scrl->body.padding.ver;
} }
/*Out of the page on the bottom*/ /*Out of the page on the bottom*/
else if((obj_h <= page_h && bot_err > 0) || else if((obj_h <= page_h && bot_err > 0) ||
...@@ -447,7 +447,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time) ...@@ -447,7 +447,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
/*Calculate a new position and to let scrable_rects.vpad space below*/ /*Calculate a new position and to let scrable_rects.vpad space below*/
scrlable_y = -obj_y; scrlable_y = -obj_y;
scrlable_y += page_h - obj_h; scrlable_y += page_h - obj_h;
scrlable_y -= style_scrl->body.padding.vertical; scrlable_y -= style_scrl->body.padding.ver;
} else { } else {
/*Alraedy in focus*/ /*Alraedy in focus*/
return; return;
...@@ -594,7 +594,7 @@ static bool lv_scrl_design(lv_obj_t * scrl, const area_t * mask, lv_design_mode_ ...@@ -594,7 +594,7 @@ static bool lv_scrl_design(lv_obj_t * scrl, const area_t * mask, lv_design_mode_
lv_obj_t * page = lv_obj_get_parent(scrl); lv_obj_t * page = lv_obj_get_parent(scrl);
lv_style_t * style_page = lv_obj_get_style(page); lv_style_t * style_page = lv_obj_get_style(page);
lv_group_t * g = lv_obj_get_group(page); lv_group_t * g = lv_obj_get_group(page);
if(style_page->body.empty != 0 || style_page->opacity == OPA_TRANSP) { /*Background is visible?*/ if(style_page->body.empty != 0 || style_page->opa == OPA_TRANSP) { /*Background is visible?*/
if(lv_group_get_focused(g) == page) { if(lv_group_get_focused(g) == page) {
lv_style_t * style_mod; lv_style_t * style_mod;
style_mod = lv_group_mod_style(g, style_ori); style_mod = lv_group_mod_style(g, style_ori);
...@@ -633,12 +633,12 @@ static void lv_page_sb_refresh(lv_obj_t * page) ...@@ -633,12 +633,12 @@ static void lv_page_sb_refresh(lv_obj_t * page)
cord_t size_tmp; cord_t size_tmp;
cord_t scrl_w = lv_obj_get_width(scrl); cord_t scrl_w = lv_obj_get_width(scrl);
cord_t scrl_h = lv_obj_get_height(scrl); cord_t scrl_h = lv_obj_get_height(scrl);
cord_t hpad = style->body.padding.horizontal; cord_t hpad = style->body.padding.hor;
cord_t vpad = style->body.padding.vertical; cord_t vpad = style->body.padding.ver;
cord_t obj_w = lv_obj_get_width(page); cord_t obj_w = lv_obj_get_width(page);
cord_t obj_h = lv_obj_get_height(page); cord_t obj_h = lv_obj_get_height(page);
cord_t sbh_pad = MATH_MAX(ext->sb_width, style->body.padding.horizontal); cord_t sbh_pad = MATH_MAX(ext->sb_width, style->body.padding.hor);
cord_t sbv_pad = MATH_MAX(ext->sb_width, style->body.padding.vertical); cord_t sbv_pad = MATH_MAX(ext->sb_width, style->body.padding.ver);
if(ext->sb_mode == LV_PAGE_SB_MODE_OFF) return; if(ext->sb_mode == LV_PAGE_SB_MODE_OFF) return;
......
...@@ -74,9 +74,9 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -74,9 +74,9 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, lv_obj_t * copy)
lv_page_set_rel_action(new_roller, NULL); /*Handle roller specific actions*/ lv_page_set_rel_action(new_roller, NULL); /*Handle roller specific actions*/
lv_cont_set_fit(lv_page_get_scrl(new_roller), true, false); /*Height is specified directly*/ lv_cont_set_fit(lv_page_get_scrl(new_roller), true, false); /*Height is specified directly*/
lv_obj_set_signal_func(scrl, roller_scrl_signal); lv_obj_set_signal_func(scrl, roller_scrl_signal);
lv_ddlist_open(new_roller, true, 0); lv_ddlist_open(new_roller, false);
lv_style_t * style_label = lv_obj_get_style(ext->ddlist.opt_label); lv_style_t * style_label = lv_obj_get_style(ext->ddlist.options_label);
lv_ddlist_set_fix_height(new_roller, (font_get_height(style_label->text.font) >> FONT_ANTIALIAS) * 3 lv_ddlist_set_fix_height(new_roller, (font_get_height(style_label->text.font) >> FONT_ANTIALIAS) * 3
+ style_label->text.space_line * 4); + style_label->text.space_line * 4);
lv_obj_refresh_style(new_roller); /*To set scrollable size automatically*/ lv_obj_refresh_style(new_roller); /*To set scrollable size automatically*/
...@@ -112,15 +112,15 @@ bool lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param) ...@@ -112,15 +112,15 @@ bool lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param)
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller); lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
if(sign == LV_SIGNAL_STYLE_CHG) { if(sign == LV_SIGNAL_STYLE_CHG) {
lv_obj_set_height(lv_page_get_scrl(roller), lv_obj_set_height(lv_page_get_scrl(roller),
lv_obj_get_height(ext->ddlist.opt_label) + lv_obj_get_height(roller)); lv_obj_get_height(ext->ddlist.options_label) + lv_obj_get_height(roller));
lv_obj_align(ext->ddlist.opt_label, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_align(ext->ddlist.options_label, NULL, LV_ALIGN_CENTER, 0, 0);
lv_ddlist_set_selected(roller, ext->ddlist.sel_opt); lv_ddlist_set_selected(roller, ext->ddlist.selected_option_id);
} else if(sign == LV_SIGNAL_CORD_CHG) { } else if(sign == LV_SIGNAL_CORD_CHG) {
lv_ddlist_set_fix_height(roller, lv_obj_get_height(roller)); lv_ddlist_set_fix_height(roller, lv_obj_get_height(roller));
lv_obj_set_height(lv_page_get_scrl(roller), lv_obj_set_height(lv_page_get_scrl(roller),
lv_obj_get_height(ext->ddlist.opt_label) + lv_obj_get_height(roller)); lv_obj_get_height(ext->ddlist.options_label) + lv_obj_get_height(roller));
lv_obj_align(ext->ddlist.opt_label, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_align(ext->ddlist.options_label, NULL, LV_ALIGN_CENTER, 0, 0);
lv_ddlist_set_selected(roller, ext->ddlist.sel_opt); lv_ddlist_set_selected(roller, ext->ddlist.selected_option_id);
} }
} }
...@@ -193,10 +193,10 @@ static bool lv_roller_design(lv_obj_t * roller, const area_t * mask, lv_design_m ...@@ -193,10 +193,10 @@ static bool lv_roller_design(lv_obj_t * roller, const area_t * mask, lv_design_m
area_t rect_area; area_t rect_area;
rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.space_line - 2; rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.space_line - 2;
rect_area.y2 = rect_area.y1 + font_h + style->text.space_line; rect_area.y2 = rect_area.y1 + font_h + style->text.space_line;
rect_area.x1 = ext->ddlist.opt_label->coords.x1 - style->body.padding.horizontal; rect_area.x1 = ext->ddlist.options_label->coords.x1 - style->body.padding.hor;
rect_area.x2 = rect_area.x1 + lv_obj_get_width(lv_page_get_scrl(roller)); rect_area.x2 = rect_area.x1 + lv_obj_get_width(lv_page_get_scrl(roller));
lv_draw_rect(&rect_area, mask, ext->ddlist.style_sel); lv_draw_rect(&rect_area, mask, ext->ddlist.selected_style);
} }
/*Post draw when the children are drawn*/ /*Post draw when the children are drawn*/
else if(mode == LV_DESIGN_DRAW_POST) { else if(mode == LV_DESIGN_DRAW_POST) {
...@@ -227,36 +227,36 @@ static bool roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * ...@@ -227,36 +227,36 @@ static bool roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void *
int32_t id = -1; int32_t id = -1;
lv_obj_t * roller = lv_obj_get_parent(roller_scrl); lv_obj_t * roller = lv_obj_get_parent(roller_scrl);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller); lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
lv_style_t * style_label = lv_obj_get_style(ext->ddlist.opt_label); lv_style_t * style_label = lv_obj_get_style(ext->ddlist.options_label);
const font_t * font = style_label->text.font; const font_t * font = style_label->text.font;
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS; cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
if(sign == LV_SIGNAL_DRAG_END) { if(sign == LV_SIGNAL_DRAG_END) {
/*If dragged then align the list to there be an element in the middle*/ /*If dragged then align the list to there be an element in the middle*/
cord_t label_y1 = ext->ddlist.opt_label->coords.y1 - roller->coords.y1; cord_t label_y1 = ext->ddlist.options_label->coords.y1 - roller->coords.y1;
cord_t label_unit = (font_get_height(style_label->text.font) >> FONT_ANTIALIAS) + style_label->text.space_line / 2; cord_t label_unit = (font_get_height(style_label->text.font) >> FONT_ANTIALIAS) + style_label->text.space_line / 2;
cord_t mid = (roller->coords.y2 - roller->coords.y1) / 2; cord_t mid = (roller->coords.y2 - roller->coords.y1) / 2;
id = (mid - label_y1) / label_unit; id = (mid - label_y1) / label_unit;
if(id < 0) id = 0; if(id < 0) id = 0;
if(id >= ext->ddlist.num_opt) id = ext->ddlist.num_opt - 1; if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
ext->ddlist.sel_opt = id; ext->ddlist.selected_option_id = id;
} }
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)) {
point_t p; point_t p;
lv_indev_get_point(indev, &p); lv_indev_get_point(indev, &p);
p.y = p.y - ext->ddlist.opt_label->coords.y1; p.y = p.y - ext->ddlist.options_label->coords.y1;
id = p.y / (font_h + style_label->text.space_line); id = p.y / (font_h + style_label->text.space_line);
if(id < 0) id = 0; if(id < 0) id = 0;
if(id >= ext->ddlist.num_opt) id = ext->ddlist.num_opt - 1; if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
ext->ddlist.sel_opt = id; ext->ddlist.selected_option_id = id;
} }
} }
/*Position the scrollable according to the new selected option*/ /*Position the scrollable according to the new selected option*/
if(id != -1) { if(id != -1) {
cord_t h = lv_obj_get_height(roller); cord_t h = lv_obj_get_height(roller);
cord_t line_y1 = id * (font_h + style_label->text.space_line) + ext->ddlist.opt_label->coords.y1 - roller_scrl->coords.y1; cord_t line_y1 = id * (font_h + style_label->text.space_line) + ext->ddlist.options_label->coords.y1 - roller_scrl->coords.y1;
cord_t new_y = - line_y1 + (h - font_h) / 2; cord_t new_y = - line_y1 + (h - font_h) / 2;
if(ext->ddlist.anim_time == 0) { if(ext->ddlist.anim_time == 0) {
......
...@@ -155,7 +155,7 @@ bool lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param) ...@@ -155,7 +155,7 @@ bool lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param)
if(slider->ext_size < x) slider->ext_size = x; if(slider->ext_size < x) slider->ext_size = x;
} else { } else {
lv_style_t * style = lv_obj_get_style(slider); lv_style_t * style = lv_obj_get_style(slider);
cord_t pad = MATH_MIN(style->body.padding.horizontal, style->body.padding.vertical); cord_t pad = MATH_MIN(style->body.padding.hor, style->body.padding.ver);
if(pad < 0) { if(pad < 0) {
pad = -pad; pad = -pad;
if(slider->ext_size < pad) slider->ext_size = pad; if(slider->ext_size < pad) slider->ext_size = pad;
...@@ -290,8 +290,8 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m ...@@ -290,8 +290,8 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
area_t area_bar; area_t area_bar;
area_cpy(&area_bar, &slider->coords); area_cpy(&area_bar, &slider->coords);
/*Be sure at least vpad/hpad width bar will remain*/ /*Be sure at least vpad/hpad width bar will remain*/
cord_t pad_ver_bar = style_slider->body.padding.vertical; cord_t pad_ver_bar = style_slider->body.padding.ver;
cord_t pad_hor_bar = style_slider->body.padding.horizontal; cord_t pad_hor_bar = style_slider->body.padding.hor;
if(pad_ver_bar * 2 + LV_SLIDER_SIZE_MIN > area_get_height(&area_bar)) { if(pad_ver_bar * 2 + LV_SLIDER_SIZE_MIN > area_get_height(&area_bar)) {
pad_ver_bar = (area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1; pad_ver_bar = (area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
} }
...@@ -310,8 +310,8 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m ...@@ -310,8 +310,8 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
area_cpy(&area_indic, &area_bar); area_cpy(&area_indic, &area_bar);
/*Be sure at least vpad/hpad width indicator will remain*/ /*Be sure at least vpad/hpad width indicator will remain*/
cord_t pad_ver_indic = style_indic->body.padding.vertical; cord_t pad_ver_indic = style_indic->body.padding.ver;
cord_t pad_hor_indic = style_indic->body.padding.horizontal; cord_t pad_hor_indic = style_indic->body.padding.hor;
if(pad_ver_indic * 2 + LV_SLIDER_SIZE_MIN > area_get_height(&area_bar)) { if(pad_ver_indic * 2 + LV_SLIDER_SIZE_MIN > area_get_height(&area_bar)) {
pad_ver_indic = (area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1; pad_ver_indic = (area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
} }
......
...@@ -177,10 +177,10 @@ bool lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param) ...@@ -177,10 +177,10 @@ bool lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
if(ext->one_line) { /*In one line mode refresh the Text Area height because 'vpad' can modify it*/ if(ext->one_line) { /*In one line mode refresh the Text Area height because 'vpad' can modify it*/
lv_style_t * style_label = lv_obj_get_style(ext->label); lv_style_t * style_label = lv_obj_get_style(ext->label);
cord_t font_h = font_get_height(style_label->text.font) >> FONT_ANTIALIAS; cord_t font_h = font_get_height(style_label->text.font) >> FONT_ANTIALIAS;
lv_obj_set_height(ta, font_h + (style_ta->body.padding.vertical + style_scrl->body.padding.vertical) * 2); lv_obj_set_height(ta, font_h + (style_ta->body.padding.ver + style_scrl->body.padding.ver) * 2);
} else { /*In not one line mode refresh the Label width because 'hpad' can modify it*/ } else { /*In not one line mode refresh the Label width because 'hpad' can modify it*/
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.horizontal); lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor);
lv_obj_set_pos(ext->label, style_scrl->body.padding.horizontal, style_scrl->body.padding.vertical); /*Be sure the Label is in the correct position*/ lv_obj_set_pos(ext->label, style_scrl->body.padding.hor, style_scrl->body.padding.ver); /*Be sure the Label is in the correct position*/
} }
lv_label_set_text(ext->label, NULL); lv_label_set_text(ext->label, NULL);
...@@ -193,8 +193,8 @@ bool lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param) ...@@ -193,8 +193,8 @@ bool lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
lv_obj_get_height(ta) != area_get_height(param)) { lv_obj_get_height(ta) != area_get_height(param)) {
lv_obj_t * scrl = lv_page_get_scrl(ta); lv_obj_t * scrl = lv_page_get_scrl(ta);
lv_style_t * style_scrl = lv_obj_get_style(scrl); lv_style_t * style_scrl = lv_obj_get_style(scrl);
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.horizontal); lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor);
lv_obj_set_pos(ext->label, style_scrl->body.padding.horizontal, style_scrl->body.padding.vertical); lv_obj_set_pos(ext->label, style_scrl->body.padding.hor, style_scrl->body.padding.ver);
lv_label_set_text(ext->label, NULL); /*Refresh the label*/ lv_label_set_text(ext->label, NULL); /*Refresh the label*/
} }
} }
...@@ -478,9 +478,9 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) ...@@ -478,9 +478,9 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
/*Check the bottom*/ /*Check the bottom*/
cord_t font_h = font_get_height(font_p) >> FONT_ANTIALIAS; cord_t font_h = font_get_height(font_p) >> FONT_ANTIALIAS;
if(label_cords.y1 + cur_pos.y + font_h + style_scrl->body.padding.vertical > ta_cords.y2) { if(label_cords.y1 + cur_pos.y + font_h + style_scrl->body.padding.ver > ta_cords.y2) {
lv_obj_set_y(label_par, -(cur_pos.y - lv_obj_get_height(ta) + lv_obj_set_y(label_par, -(cur_pos.y - lv_obj_get_height(ta) +
font_h + 2 * style_scrl->body.padding.vertical)); font_h + 2 * style_scrl->body.padding.ver));
} }
/*Check the left (use the font_h as general unit)*/ /*Check the left (use the font_h as general unit)*/
if(lv_obj_get_x(label_par) + cur_pos.x < font_h) { if(lv_obj_get_x(label_par) + cur_pos.x < font_h) {
...@@ -488,9 +488,9 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) ...@@ -488,9 +488,9 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
} }
/*Check the right (use the font_h as general unit)*/ /*Check the right (use the font_h as general unit)*/
if(label_cords.x1 + cur_pos.x + font_h + style_scrl->body.padding.horizontal > ta_cords.x2) { if(label_cords.x1 + cur_pos.x + font_h + style_scrl->body.padding.hor > ta_cords.x2) {
lv_obj_set_x(label_par, -(cur_pos.x - lv_obj_get_width(ta) + lv_obj_set_x(label_par, -(cur_pos.x - lv_obj_get_width(ta) +
font_h + 2 * style_scrl->body.padding.horizontal)); font_h + 2 * style_scrl->body.padding.hor));
} }
/*Reset cursor blink animation*/ /*Reset cursor blink animation*/
...@@ -682,10 +682,10 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en) ...@@ -682,10 +682,10 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en)
ext->one_line = 1; ext->one_line = 1;
lv_cont_set_fit(lv_page_get_scrl(ta), true, true); lv_cont_set_fit(lv_page_get_scrl(ta), true, true);
lv_obj_set_height(ta, font_h + (style_ta->body.padding.vertical + style_scrl->body.padding.vertical) * 2); lv_obj_set_height(ta, font_h + (style_ta->body.padding.ver + style_scrl->body.padding.ver) * 2);
lv_label_set_long_mode(ext->label, LV_LABEL_LONG_EXPAND); lv_label_set_long_mode(ext->label, LV_LABEL_LONG_EXPAND);
lv_label_set_no_break(ext->label, true); lv_label_set_no_break(ext->label, true);
lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->body.padding.horizontal, style_ta->body.padding.vertical); lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->body.padding.hor, style_ta->body.padding.ver);
} else { } else {
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
lv_style_t * style_ta = lv_obj_get_style(ta); lv_style_t * style_ta = lv_obj_get_style(ta);
...@@ -695,7 +695,7 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en) ...@@ -695,7 +695,7 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en)
lv_label_set_long_mode(ext->label, LV_LABEL_LONG_BREAK); lv_label_set_long_mode(ext->label, LV_LABEL_LONG_BREAK);
lv_label_set_no_break(ext->label, false); lv_label_set_no_break(ext->label, false);
lv_obj_set_height(ta, LV_TA_DEF_HEIGHT); lv_obj_set_height(ta, LV_TA_DEF_HEIGHT);
lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->body.padding.horizontal, style_ta->body.padding.vertical); lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->body.padding.hor, style_ta->body.padding.ver);
} }
} }
...@@ -868,10 +868,10 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design ...@@ -868,10 +868,10 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
cur_style.body.shadow.width = 0; cur_style.body.shadow.width = 0;
cur_style.body.radius = 0; cur_style.body.radius = 0;
cur_style.body.empty = 0; cur_style.body.empty = 0;
cur_style.body.padding.horizontal = 0; cur_style.body.padding.hor = 0;
cur_style.body.padding.vertical = 0; cur_style.body.padding.ver = 0;
cur_style.line.width = 1 << LV_ANTIALIAS; cur_style.line.width = 1 << LV_ANTIALIAS;
cur_style.opacity = OPA_COVER; cur_style.opa = OPA_COVER;
} }
uint16_t cur_pos = lv_ta_get_cursor_pos(ta); uint16_t cur_pos = lv_ta_get_cursor_pos(ta);
...@@ -916,16 +916,16 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design ...@@ -916,16 +916,16 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
/*Draw he cursor according to the type*/ /*Draw he cursor according to the type*/
area_t cur_area; area_t cur_area;
if(ta_ext->cursor_type == LV_TA_CURSOR_LINE) { if(ta_ext->cursor_type == LV_TA_CURSOR_LINE) {
cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.horizontal - (cur_style.line.width >> 1) - (cur_style.line.width & 0x1); cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor - (cur_style.line.width >> 1) - (cur_style.line.width & 0x1);
cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.vertical; cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.ver;
cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.horizontal + (cur_style.line.width >> 1); cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor + (cur_style.line.width >> 1);
cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.vertical + letter_h; cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.ver + letter_h;
lv_draw_rect(&cur_area, mask, &cur_style); lv_draw_rect(&cur_area, mask, &cur_style);
} else if(ta_ext->cursor_type == LV_TA_CURSOR_BLOCK) { } else if(ta_ext->cursor_type == LV_TA_CURSOR_BLOCK) {
cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 - cur_style.body.padding.horizontal; cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 - cur_style.body.padding.hor;
cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.vertical; cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.ver;
cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.horizontal + letter_w; cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor + letter_w;
cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.vertical + letter_h; cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.ver + letter_h;
lv_draw_rect(&cur_area, mask, &cur_style); lv_draw_rect(&cur_area, mask, &cur_style);
...@@ -938,24 +938,24 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design ...@@ -938,24 +938,24 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
char letter_buf[8] = {0}; char letter_buf[8] = {0};
memcpy(letter_buf, &txt[byte_pos], txt_utf8_size(txt[byte_pos])); memcpy(letter_buf, &txt[byte_pos], txt_utf8_size(txt[byte_pos]));
#endif #endif
cur_area.x1 += cur_style.body.padding.horizontal; cur_area.x1 += cur_style.body.padding.hor;
cur_area.y1 += cur_style.body.padding.vertical; cur_area.y1 += cur_style.body.padding.ver;
lv_draw_label(&cur_area, mask, &cur_style, letter_buf, TXT_FLAG_NONE, 0); lv_draw_label(&cur_area, mask, &cur_style, letter_buf, TXT_FLAG_NONE, 0);
} else if(ta_ext->cursor_type == LV_TA_CURSOR_OUTLINE) { } else if(ta_ext->cursor_type == LV_TA_CURSOR_OUTLINE) {
cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 - cur_style.body.padding.horizontal; cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 - cur_style.body.padding.hor;
cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.vertical; cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.ver;
cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.horizontal + letter_w; cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor + letter_w;
cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.vertical+ letter_h; cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.ver+ letter_h;
cur_style.body.empty = 1; cur_style.body.empty = 1;
if(cur_style.body.border.width == 0) cur_style.body.border.width = 1 << LV_ANTIALIAS; /*Be sure the border will be drawn*/ if(cur_style.body.border.width == 0) cur_style.body.border.width = 1 << LV_ANTIALIAS; /*Be sure the border will be drawn*/
lv_draw_rect(&cur_area, mask, &cur_style); lv_draw_rect(&cur_area, mask, &cur_style);
} else if(ta_ext->cursor_type == LV_TA_CURSOR_UNDERLINE) { } else if(ta_ext->cursor_type == LV_TA_CURSOR_UNDERLINE) {
cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.horizontal; cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor;
cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.vertical + letter_h - (cur_style.line.width >> 1); cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.ver + letter_h - (cur_style.line.width >> 1);
cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.horizontal + letter_w; cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor + letter_w;
cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.vertical + letter_h + (cur_style.line.width >> 1) + (cur_style.line.width & 0x1); cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.ver + letter_h + (cur_style.line.width >> 1) + (cur_style.line.width & 0x1);
lv_draw_rect(&cur_area, mask, &cur_style); lv_draw_rect(&cur_area, mask, &cur_style);
} }
......
...@@ -201,9 +201,9 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name) ...@@ -201,9 +201,9 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
/*Modify the indicator size*/ /*Modify the indicator size*/
lv_style_t * style_tabs = lv_obj_get_style(ext->tabs); lv_style_t * style_tabs = lv_obj_get_style(ext->tabs);
cord_t indic_width = (lv_obj_get_width(tabview) - style_tabs->body.padding.inner * (ext->tab_cnt - 1) - 2 * style_tabs->body.padding.horizontal) / ext->tab_cnt; cord_t indic_width = (lv_obj_get_width(tabview) - style_tabs->body.padding.inner * (ext->tab_cnt - 1) - 2 * style_tabs->body.padding.hor) / ext->tab_cnt;
lv_obj_set_width(ext->indic, indic_width); lv_obj_set_width(ext->indic, indic_width);
lv_obj_set_x(ext->indic, indic_width * ext->tab_act + style_tabs->body.padding.inner * ext->tab_act + style_tabs->body.padding.horizontal); lv_obj_set_x(ext->indic, indic_width * ext->tab_act + style_tabs->body.padding.inner * ext->tab_act + style_tabs->body.padding.hor);
/*Set the first tab as active*/ /*Set the first tab as active*/
if(ext->tab_cnt == 1) { if(ext->tab_cnt == 1) {
...@@ -235,7 +235,7 @@ void lv_tabview_set_act(lv_obj_t * tabview, uint16_t id, bool anim_en) ...@@ -235,7 +235,7 @@ void lv_tabview_set_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
anim_en = false; anim_en = false;
#endif #endif
cord_t cont_x = -(lv_obj_get_width(tabview) * id + style->body.padding.inner * id + style->body.padding.horizontal); cord_t cont_x = -(lv_obj_get_width(tabview) * id + style->body.padding.inner * id + style->body.padding.hor);
if(anim_en == false) { if(anim_en == false) {
lv_obj_set_x(ext->content, cont_x); lv_obj_set_x(ext->content, cont_x);
} else { } else {
...@@ -258,7 +258,7 @@ void lv_tabview_set_act(lv_obj_t * tabview, uint16_t id, bool anim_en) ...@@ -258,7 +258,7 @@ void lv_tabview_set_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
/*Move the indicator*/ /*Move the indicator*/
cord_t indic_width = lv_obj_get_width(ext->indic); cord_t indic_width = lv_obj_get_width(ext->indic);
lv_style_t * tabs_style = lv_obj_get_style(ext->tabs); lv_style_t * tabs_style = lv_obj_get_style(ext->tabs);
cord_t indic_x = indic_width * id + tabs_style->body.padding.inner * id + tabs_style->body.padding.horizontal; cord_t indic_x = indic_width * id + tabs_style->body.padding.inner * id + tabs_style->body.padding.hor;
if(anim_en == false) { if(anim_en == false) {
lv_obj_set_x(ext->indic, indic_x); lv_obj_set_x(ext->indic, indic_x);
...@@ -376,7 +376,7 @@ void lv_tabview_realign(lv_obj_t * tabview) ...@@ -376,7 +376,7 @@ void lv_tabview_realign(lv_obj_t * tabview)
if(ext->tab_cnt != 0) { if(ext->tab_cnt != 0) {
lv_style_t * style_tabs = lv_obj_get_style(ext->tabs); lv_style_t * style_tabs = lv_obj_get_style(ext->tabs);
cord_t indic_width = (lv_obj_get_width(tabview) - style_tabs->body.padding.inner * (ext->tab_cnt - 1) - cord_t indic_width = (lv_obj_get_width(tabview) - style_tabs->body.padding.inner * (ext->tab_cnt - 1) -
2 * style_tabs->body.padding.horizontal) / ext->tab_cnt; 2 * style_tabs->body.padding.hor) / ext->tab_cnt;
lv_obj_set_width(ext->indic, indic_width); lv_obj_set_width(ext->indic, indic_width);
} }
...@@ -534,7 +534,7 @@ static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage) ...@@ -534,7 +534,7 @@ static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage)
lv_style_t * indic_style = lv_obj_get_style(ext->indic); lv_style_t * indic_style = lv_obj_get_style(ext->indic);
cord_t p = ((tabpage->coords.x1 - tabview->coords.x1) * (indic_width + tabs_style->body.padding.inner)) / lv_obj_get_width(tabview); cord_t p = ((tabpage->coords.x1 - tabview->coords.x1) * (indic_width + tabs_style->body.padding.inner)) / lv_obj_get_width(tabview);
lv_obj_set_x(ext->indic, indic_width * ext->tab_act + tabs_style->body.padding.inner * ext->tab_act + indic_style->body.padding.horizontal - p); lv_obj_set_x(ext->indic, indic_width * ext->tab_act + tabs_style->body.padding.inner * ext->tab_act + indic_style->body.padding.hor - p);
} }
} }
......
...@@ -343,7 +343,7 @@ cord_t lv_win_get_width(lv_obj_t * win) ...@@ -343,7 +343,7 @@ cord_t lv_win_get_width(lv_obj_t * win)
lv_obj_t * scrl = lv_page_get_scrl(ext->page); lv_obj_t * scrl = lv_page_get_scrl(ext->page);
lv_style_t * style_scrl = lv_obj_get_style(scrl); lv_style_t * style_scrl = lv_obj_get_style(scrl);
return lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.horizontal; return lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor;
} }
/** /**
...@@ -414,16 +414,16 @@ static void lv_win_realign(lv_obj_t * win) ...@@ -414,16 +414,16 @@ static void lv_win_realign(lv_obj_t * win)
} }
lv_style_t * btnh_style = lv_obj_get_style(ext->btnh); lv_style_t * btnh_style = lv_obj_get_style(ext->btnh);
lv_obj_set_height(ext->btnh, ext->cbtn_size + 2 * btnh_style->body.padding.vertical * 2); lv_obj_set_height(ext->btnh, ext->cbtn_size + 2 * btnh_style->body.padding.ver * 2);
lv_obj_set_width(ext->header, lv_obj_get_width(win)); lv_obj_set_width(ext->header, lv_obj_get_width(win));
/*Align the higher object first to make the correct header size first*/ /*Align the higher object first to make the correct header size first*/
if(lv_obj_get_height(ext->title) > lv_obj_get_height(ext->btnh)) { if(lv_obj_get_height(ext->title) > lv_obj_get_height(ext->btnh)) {
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.horizontal, 0); lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.hor, 0);
lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.padding.horizontal, 0); lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.padding.hor, 0);
} else { } else {
lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.padding.horizontal, 0); lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.padding.hor, 0);
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.horizontal, 0); lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.hor, 0);
} }
lv_obj_set_pos_scale(ext->header, 0, 0); lv_obj_set_pos_scale(ext->header, 0, 0);
...@@ -435,7 +435,7 @@ static void lv_win_realign(lv_obj_t * win) ...@@ -435,7 +435,7 @@ static void lv_win_realign(lv_obj_t * win)
lv_style_t * style_page = lv_obj_get_style(page); lv_style_t * style_page = lv_obj_get_style(page);
lv_obj_t * scrl = lv_page_get_scrl(page); lv_obj_t * scrl = lv_page_get_scrl(page);
lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * style_page->body.padding.horizontal); lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * style_page->body.padding.hor);
} }
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment