lv_style: mass attribute renames

This commit is contained in:
Gabor Kiss-Vamosi
2017-10-18 16:07:19 +02:00
parent d9205adc60
commit 0856790760
25 changed files with 509 additions and 471 deletions

View File

@@ -111,7 +111,7 @@ bool lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param)
if(valid != false) {
if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
lv_style_t * style_indic = lv_bar_get_style_indic(bar);
if(style_indic->swidth > bar->ext_size) bar->ext_size = style_indic->swidth;
if(style_indic->shadow.width > bar->ext_size) bar->ext_size = style_indic->shadow.width;
}
}
@@ -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_style_indic(bar);
area_t indic_area;
area_cpy(&indic_area, &bar->cords);
indic_area.x1 += style_indic->hpad;
indic_area.x2 -= style_indic->hpad;
indic_area.y1 += style_indic->vpad;
indic_area.y2 -= style_indic->vpad;
indic_area.x1 += style_indic->body.pad_hor;
indic_area.x2 -= style_indic->body.pad_hor;
indic_area.y1 += style_indic->body.pad_ver;
indic_area.y2 -= style_indic->body.pad_ver;
cord_t w = area_get_width(&indic_area);
cord_t h = area_get_height(&indic_area);

View File

@@ -264,9 +264,9 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
/*Set size and positions of the buttons*/
lv_style_t * btnms = lv_obj_get_style(btnm);
cord_t max_w = lv_obj_get_width(btnm) - 2 * btnms->hpad;
cord_t max_h = lv_obj_get_height(btnm) - 2 * btnms->vpad;
cord_t act_y = btnms->vpad;
cord_t max_w = lv_obj_get_width(btnm) - 2 * btnms->body.pad_hor;
cord_t max_h = lv_obj_get_height(btnm) - 2 * btnms->body.pad_ver;
cord_t act_y = btnms->body.pad_ver;
/*Count the lines to calculate button height*/
uint8_t line_cnt = 1;
@@ -275,7 +275,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
if(strcmp(map[li], "\n") == 0) line_cnt ++;
}
cord_t btn_h = max_h - ((line_cnt - 1) * btnms->opad);
cord_t btn_h = max_h - ((line_cnt - 1) * btnms->body.pad_obj);
btn_h = btn_h / line_cnt;
/* Count the units and the buttons in a line
@@ -301,11 +301,11 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
/*Only deal with the non empty lines*/
if(btn_cnt != 0) {
/*Calculate the width of all units*/
cord_t all_unit_w = max_w - ((btn_cnt-1) * btnms->opad);
cord_t all_unit_w = max_w - ((btn_cnt-1) * btnms->body.pad_obj);
/*Set the button size and positions and set the texts*/
uint16_t i;
cord_t act_x = btnms->hpad;
cord_t act_x = btnms->body.pad_hor;
cord_t act_unit_w;
unit_act_cnt = 0;
for(i = 0; i < btn_cnt; i++) {
@@ -315,7 +315,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
act_unit_w = (all_unit_w * lv_btnm_get_width_unit(map_p_tmp[i])) / unit_cnt;
/*Always recalculate act_x because of rounding errors */
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * btnms->opad + btnms->hpad;
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * btnms->body.pad_obj + btnms->body.pad_hor;
area_set(&ext->btn_areas[btn_i], act_x,
act_y,
@@ -328,7 +328,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
btn_i ++;
}
}
act_y += btn_h + btnms->opad;
act_y += btn_h + btnms->body.pad_obj;
if(strlen(map_p_tmp[btn_cnt]) == 0) break; /*Break on end of map*/
map_p_tmp = &map_p_tmp[btn_cnt + 1]; /*Set the map to the next line*/
i_tot ++; /*Skip the '\n'*/
@@ -515,10 +515,10 @@ static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_
lv_draw_rect(&area_tmp, mask, btn_style);
/*Calculate the size of the text*/
const font_t * font = btn_style->font;
const font_t * font = btn_style->txt.font;
point_t txt_size;
txt_get_size(&txt_size, ext->map_p[txt_i], font,
btn_style->letter_space, btn_style->line_space,
btn_style->txt.space_letter, btn_style->txt.space_line,
area_get_width(&area_btnm), TXT_FLAG_NONE);
area_tmp.x1 += (btn_w - txt_size.x) / 2;

View File

@@ -120,7 +120,7 @@ bool lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
* make the object specific signal handling */
if(valid != false) {
if(sign == LV_SIGNAL_STYLE_CHG) {
lv_obj_set_size(ext->bullet, font_get_height(style->font), font_get_height(style->font));
lv_obj_set_size(ext->bullet, font_get_height(style->txt.font), font_get_height(style->txt.font));
} else if(sign == LV_SIGNAL_PRESSED ||
sign == LV_SIGNAL_RELEASED ||
sign == LV_SIGNAL_PRESS_LOST) {
@@ -239,7 +239,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_style_t * style_page = lv_obj_get_style(bg);
lv_group_t * g = lv_obj_get_group(bg);
if(style_page->empty != 0 || style_page->opa == OPA_TRANSP) { /*Background is visible?*/
if(style_page->body.empty != 0 || style_page->body.opa == OPA_TRANSP) { /*Background is visible?*/
if(lv_group_get_focused(g) == bg) {
lv_style_t * style_mod;
style_mod = lv_group_mod_style(g, style_ori);

View File

@@ -413,7 +413,7 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
if(ext->hdiv_num != 0) {
/*Draw slide lines if no border*/
if(style->bwidth != 0) {
if(style->border.width != 0) {
div_i_start = 1;
div_i_end = ext->hdiv_num;
} else {
@@ -426,8 +426,8 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
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 += 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_end) p1.y -= (style->line_width >> 1) + 1; /*The last 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*/
p2.y = p1.y;
lv_draw_line(&p1, &p2, mask, style);
@@ -436,7 +436,7 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
if(ext->vdiv_num != 0) {
/*Draw slide lines if no border*/
if(style->bwidth != 0) {
if(style->border.width != 0) {
div_i_start = 1;
div_i_end = ext->vdiv_num;
} else {
@@ -449,8 +449,8 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
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 += 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_end) p1.x -= (style->line_width >> 1) + 1; /*The last 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*/
p2.x = p1.x;
lv_draw_line(&p1, &p2, mask, style);
}
@@ -477,12 +477,12 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
lv_chart_dl_t * dl;
lv_style_t lines;
lv_style_get(LV_STYLE_PLAIN, &lines);
lines.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
lines.line_width = ext->dl_width;
lines.body.opa = (uint16_t)((uint16_t)style->body.opa * ext->dl_opa) >> 8;
lines.line.width = ext->dl_width;
/*Go through all data lines*/
LL_READ_BACK(ext->dl_ll, dl) {
lines.ccolor = dl->color;
lines.line.color = dl->color;
p1.x = 0 + x_ofs;
p2.x = 0 + x_ofs;
@@ -527,27 +527,27 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
lv_style_t style_point;
lv_style_get(LV_STYLE_PLAIN, &style_point);
style_point.bwidth = 0;
style_point.empty = 0;
style_point.radius = LV_RADIUS_CIRCLE;
style_point.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
style_point.radius = ext->dl_width;
style_point.border.width = 0;
style_point.body.empty = 0;
style_point.body.radius = LV_RADIUS_CIRCLE;
style_point.body.opa = (uint16_t)((uint16_t)style->body.opa * ext->dl_opa) >> 8;
style_point.body.radius = ext->dl_width;
/*Go through all data lines*/
LL_READ_BACK(ext->dl_ll, dl) {
style_point.mcolor = dl->color;
style_point.gcolor = color_mix(COLOR_BLACK, dl->color, ext->dl_dark);
style_point.body.color_main = dl->color;
style_point.body.color_grad = color_mix(COLOR_BLACK, dl->color, ext->dl_dark);
for(i = 0; i < ext->pnum; i ++) {
cir_a.x1 = ((w * i) / (ext->pnum - 1)) + x_ofs;
cir_a.x2 = cir_a.x1 + style_point.radius;
cir_a.x1 -= style_point.radius;
cir_a.x2 = cir_a.x1 + style_point.body.radius;
cir_a.x1 -= style_point.body.radius;
y_tmp = (int32_t)((int32_t) dl->points[i] - ext->ymin) * h;
y_tmp = y_tmp / (ext->ymax - ext->ymin);
cir_a.y1 = h - y_tmp + y_ofs;
cir_a.y2 = cir_a.y1 + style_point.radius;
cir_a.y1 -= style_point.radius;
cir_a.y2 = cir_a.y1 + style_point.body.radius;
cir_a.y1 -= style_point.body.radius;
lv_draw_rect(&cir_a, mask, &style_point);
}
@@ -578,10 +578,10 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
cord_t x_ofs = col_w / 2; /*Shift with a half col.*/
lv_style_get(LV_STYLE_PLAIN, &rects);
rects.bwidth = 0;
rects.empty = 0;
rects.radius = 0;
rects.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
rects.border.width = 0;
rects.body.empty = 0;
rects.body.radius = 0;
rects.body.opa = (uint16_t)((uint16_t)style->body.opa * ext->dl_opa) >> 8;
col_a.y2 = chart->cords.y2;
@@ -594,8 +594,8 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
/*Draw the current point of all data line*/
LL_READ_BACK(ext->dl_ll, dl) {
rects.mcolor = dl->color;
rects.gcolor = color_mix(COLOR_BLACK, dl->color, ext->dl_dark);
rects.body.color_main = dl->color;
rects.body.color_grad = color_mix(COLOR_BLACK, dl->color, ext->dl_dark);
col_a.x1 = x_act;
col_a.x2 = col_a.x1 + col_w;
x_act += col_w;

View File

@@ -277,23 +277,23 @@ static void lv_cont_layout_col(lv_obj_t * cont)
/*Adjust margin and get the alignment type*/
lv_align_t align;
lv_style_t * style = lv_obj_get_style(cont);
cord_t hpad_corr;
cord_t pad_hor_corr;
switch(type) {
case LV_CONT_LAYOUT_COL_L:
hpad_corr = style->hpad;
pad_hor_corr = style->body.pad_hor;
align = LV_ALIGN_IN_TOP_LEFT;
break;
case LV_CONT_LAYOUT_COL_M:
hpad_corr = 0;
pad_hor_corr = 0;
align = LV_ALIGN_IN_TOP_MID;
break;
case LV_CONT_LAYOUT_COL_R:
hpad_corr = -style->hpad;
pad_hor_corr = -style->body.pad_hor;
align = LV_ALIGN_IN_TOP_RIGHT;
break;
default:
hpad_corr = 0;
pad_hor_corr = 0;
align = LV_ALIGN_IN_TOP_LEFT;
break;
}
@@ -302,13 +302,13 @@ static void lv_cont_layout_col(lv_obj_t * cont)
* an unnecessary child change signals could be sent*/
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
/* Align the children */
cord_t last_cord = style->vpad;
cord_t last_cord = style->body.pad_ver;
LL_READ_BACK(cont->child_ll, child) {
if(lv_obj_get_hidden(child) != false ||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
lv_obj_align(child, cont, align, hpad_corr , last_cord);
last_cord += lv_obj_get_height(child) + style->opad;
lv_obj_align(child, cont, align, pad_hor_corr , last_cord);
last_cord += lv_obj_get_height(child) + style->body.pad_obj;
}
lv_obj_clr_protect(cont, LV_PROTECT_CHILD_CHG);
@@ -326,23 +326,23 @@ static void lv_cont_layout_row(lv_obj_t * cont)
/*Adjust margin and get the alignment type*/
lv_align_t align;
lv_style_t * style = lv_obj_get_style(cont);
cord_t vpad_corr = style->vpad;
cord_t pad_ver_corr = style->body.pad_ver;
switch(type) {
case LV_CONT_LAYOUT_ROW_T:
vpad_corr = style->vpad;
pad_ver_corr = style->body.pad_ver;
align = LV_ALIGN_IN_TOP_LEFT;
break;
case LV_CONT_LAYOUT_ROW_M:
vpad_corr = 0;
pad_ver_corr = 0;
align = LV_ALIGN_IN_LEFT_MID;
break;
case LV_CONT_LAYOUT_ROW_B:
vpad_corr = -style->vpad;
pad_ver_corr = -style->body.pad_ver;
align = LV_ALIGN_IN_BOTTOM_LEFT;
break;
default:
vpad_corr = 0;
pad_ver_corr = 0;
align = LV_ALIGN_IN_TOP_LEFT;
break;
}
@@ -352,13 +352,13 @@ static void lv_cont_layout_row(lv_obj_t * cont)
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
/* Align the children */
cord_t last_cord = style->hpad;
cord_t last_cord = style->body.pad_hor;
LL_READ_BACK(cont->child_ll, child) {
if(lv_obj_get_hidden(child) != false ||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
lv_obj_align(child, cont, align, last_cord, vpad_corr);
last_cord += lv_obj_get_width(child) + style->opad;
lv_obj_align(child, cont, align, last_cord, pad_ver_corr);
last_cord += lv_obj_get_width(child) + style->body.pad_obj;
}
lv_obj_clr_protect(cont, LV_PROTECT_CHILD_CHG);
@@ -378,13 +378,13 @@ static void lv_cont_layout_center(lv_obj_t * cont)
LL_READ(cont->child_ll, child) {
if(lv_obj_get_hidden(child) != false ||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
h_tot += lv_obj_get_height(child) + style->opad;
h_tot += lv_obj_get_height(child) + style->body.pad_obj;
obj_num ++;
}
if(obj_num == 0) return;
h_tot -= style->opad;
h_tot -= style->body.pad_obj;
/* Disable child change action because the children will be moved a lot
* an unnecessary child change signals could be sent*/
@@ -397,7 +397,7 @@ static void lv_cont_layout_center(lv_obj_t * cont)
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
lv_obj_align(child, cont, LV_ALIGN_CENTER, 0, last_cord + lv_obj_get_height(child) / 2);
last_cord += lv_obj_get_height(child) + style->opad;
last_cord += lv_obj_get_height(child) + style->body.pad_obj;
}
lv_obj_clr_protect(cont, LV_PROTECT_CHILD_CHG);
@@ -415,7 +415,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
lv_obj_t * child_tmp; /* Temporary child */
lv_style_t * style = lv_obj_get_style(cont);
cord_t w_obj = lv_obj_get_width(cont);
cord_t act_y = style->vpad;
cord_t act_y = style->body.pad_ver;
/* Disable child change action because the children will be moved a lot
* an unnecessary child change signals could be sent*/
@@ -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*/
while(child_rs != NULL) {
cord_t h_row = 0;
cord_t w_row = style->hpad * 2; /*The width is at least the left+right hpad*/
cord_t w_row = style->body.pad_hor * 2; /*The width is at least the left+right hpad*/
uint32_t obj_num = 0;
/*Find the row closer object and collect some data*/
@@ -442,7 +442,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
}
break;
}
w_row += lv_obj_get_width(child_rc) + style->opad; /*Add the object width + opad*/
w_row += lv_obj_get_width(child_rc) + style->body.pad_obj; /*Add the object width + opad*/
h_row = MATH_MAX(h_row, lv_obj_get_height(child_rc)); /*Search the highest object*/
obj_num ++;
if(lv_obj_is_protected(child_rc, LV_PROTECT_FOLLOW)) break; /*If can not be followed by an other object then break here*/
@@ -474,9 +474,9 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
}
/* Align the children (from child_rs to child_rc)*/
else {
w_row -= style->opad * obj_num;
w_row -= style->body.pad_obj * obj_num;
cord_t new_opad = (w_obj - w_row) / (obj_num - 1);
cord_t act_x = style->hpad; /*x init*/
cord_t act_x = style->body.pad_hor; /*x init*/
child_tmp = child_rs;
while(child_tmp != NULL) {
if(lv_obj_get_hidden(child_tmp) == false &&
@@ -491,7 +491,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
}
if(child_rc == NULL) break;
act_y += style->opad + h_row; /*y increment*/
act_y += style->body.pad_obj + h_row; /*y increment*/
child_rs = ll_get_prev(&cont->child_ll, child_rc); /*Go to the next object*/
child_rc = child_rs;
}
@@ -509,22 +509,22 @@ static void lv_cont_layout_grid(lv_obj_t * 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 h_obj = lv_obj_get_height(lv_obj_get_child(cont, NULL));
uint16_t obj_row = (w_tot - (2 * style->hpad)) / (w_obj + style->opad); /*Obj. num. in a row*/
uint16_t obj_row = (w_tot - (2 * style->body.pad_hor)) / (w_obj + style->body.pad_obj); /*Obj. num. in a row*/
cord_t x_ofs;
if(obj_row > 1) {
x_ofs = w_obj + (w_tot - (2 * style->hpad) - (obj_row * w_obj)) / (obj_row - 1);
x_ofs = w_obj + (w_tot - (2 * style->body.pad_hor) - (obj_row * w_obj)) / (obj_row - 1);
} else {
x_ofs = w_tot / 2 - w_obj / 2;
}
cord_t y_ofs = h_obj + style->opad;
cord_t y_ofs = h_obj + style->body.pad_obj;
/* Disable child change action because the children will be moved a lot
* an unnecessary child change signals could be sent*/
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
/* Align the children */
cord_t act_x = style->hpad;
cord_t act_y = style->vpad;
cord_t act_x = style->body.pad_hor;
cord_t act_y = style->body.pad_ver;
uint16_t obj_cnt = 0;
LL_READ_BACK(cont->child_ll, child) {
if(lv_obj_get_hidden(child) != false ||
@@ -540,7 +540,7 @@ static void lv_cont_layout_grid(lv_obj_t * cont)
if(obj_cnt >= obj_row) {
obj_cnt = 0;
act_x = style->hpad;
act_x = style->body.pad_hor;
act_y += y_ofs;
}
}
@@ -565,8 +565,8 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
area_t ori;
lv_style_t * style = lv_obj_get_style(cont);
lv_obj_t * i;
cord_t hpad = style->hpad;
cord_t vpad = style->vpad;
cord_t hpad = style->body.pad_hor;
cord_t vpad = style->body.pad_ver;
/*Search the side coordinates of the children*/
lv_obj_get_cords(cont, &ori);

View File

@@ -417,15 +417,15 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const area_t * mask, lv_design_m
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
if(ext->opened != 0) {
lv_style_t * style = lv_obj_get_style(ddlist);
const font_t * font = style->font;
const font_t * font = style->txt.font;
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
area_t rect_area;
rect_area.y1 = ext->opt_label->cords.y1;
rect_area.y1 += ext->sel_opt * (font_h + style->line_space);
rect_area.y1 -= style->line_space / 2;
rect_area.y1 += ext->sel_opt * (font_h + style->txt.space_line);
rect_area.y1 -= style->txt.space_line / 2;
rect_area.y2 = rect_area.y1 + font_h + style->line_space;
rect_area.x1 = ext->opt_label->cords.x1 - style->hpad;
rect_area.y2 = rect_area.y1 + font_h + style->txt.space_line;
rect_area.x1 = ext->opt_label->cords.x1 - style->body.pad_hor;
rect_area.x2 = rect_area.x1 + lv_obj_get_width(lv_page_get_scrl(ddlist));
lv_draw_rect(&rect_area, mask, ext->style_sel);
@@ -494,13 +494,13 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, uint16_t anim_time)
lv_style_t * style = lv_obj_get_style(ddlist);
cord_t new_height;
if(ext->opened) { /*Open the list*/
if(ext->fix_height == 0) new_height = lv_obj_get_height(lv_page_get_scrl(ddlist)) + 2 * style->vpad;
if(ext->fix_height == 0) new_height = lv_obj_get_height(lv_page_get_scrl(ddlist)) + 2 * style->body.pad_ver;
else new_height = ext->fix_height;
} else { /*Close the list*/
const font_t * font = style->font;
const font_t * font = style->txt.font;
lv_style_t * label_style = lv_obj_get_style(ext->opt_label);
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
new_height = font_h + 2 * label_style->line_space;
new_height = font_h + 2 * label_style->txt.space_line;
}
if(anim_time == 0) {
lv_obj_set_height(ddlist, new_height);
@@ -532,13 +532,13 @@ static void lv_ddlist_pos_act_option(lv_obj_t * ddlist)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
lv_style_t * style = lv_obj_get_style(ddlist);
const font_t * font = style->font;
const font_t * font = style->txt.font;
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
lv_style_t * label_style = lv_obj_get_style(ext->opt_label);
lv_obj_t * scrl = lv_page_get_scrl(ddlist);
cord_t h = lv_obj_get_height(ddlist);
cord_t line_y1 = ext->sel_opt * (font_h + label_style->line_space) + ext->opt_label->cords.y1 - scrl->cords.y1;
cord_t line_y1 = ext->sel_opt * (font_h + label_style->txt.space_line) + ext->opt_label->cords.y1 - scrl->cords.y1;
lv_obj_set_y(scrl, - line_y1 + (h - font_h) / 2);

View File

@@ -134,7 +134,7 @@ bool lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param)
}
else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
lv_style_t * style_crit = lv_gauge_get_style_critical(gauge);
if(style_crit->swidth > gauge->ext_size) gauge->ext_size = style_crit->swidth;
if(style_crit->shadow.width > gauge->ext_size) gauge->ext_size = style_crit->shadow.width;
}
}
@@ -334,13 +334,13 @@ static bool lv_gauge_design(lv_obj_t * gauge, const area_t * mask, lv_design_mod
/*Mix the normal and the critical style*/
memcpy(&style_bg, style_base, sizeof(lv_style_t));
style_bg.ccolor = color_mix(style_critical->ccolor, style_base->ccolor, ratio);
style_bg.mcolor= color_mix(style_critical->mcolor, style_base->mcolor, ratio);
style_bg.gcolor = color_mix(style_critical->gcolor, style_base->gcolor, ratio);
style_bg.bcolor = color_mix(style_critical->bcolor, style_base->bcolor, ratio);
style_bg.scolor = color_mix(style_critical->scolor, style_base->scolor, ratio);
style_bg.swidth = (cord_t)(((cord_t)style_critical->swidth * ratio) + ((cord_t)style_base->swidth * (OPA_COVER - ratio))) >> 8;
style_bg.opa = (cord_t)(((uint16_t)style_critical->opa * ratio) + ((uint16_t)style_base->opa * (OPA_COVER - ratio))) >> 8;
style_bg.txt.color = color_mix(style_critical->txt.color, style_base->txt.color, ratio);
style_bg.body.color_main= color_mix(style_critical->body.color_main, style_base->body.color_main, ratio);
style_bg.body.color_grad = color_mix(style_critical->body.color_grad, style_base->body.color_grad, ratio);
style_bg.border.color = color_mix(style_critical->border.color, style_base->border.color, ratio);
style_bg.shadow.color = color_mix(style_critical->shadow.color, style_base->shadow.color, ratio);
style_bg.shadow.width = (cord_t)(((cord_t)style_critical->shadow.width * ratio) + ((cord_t)style_base->shadow.width * (OPA_COVER - ratio))) >> 8;
style_bg.body.opa = (cord_t)(((uint16_t)style_critical->body.opa * ratio) + ((uint16_t)style_base->body.opa * (OPA_COVER - ratio))) >> 8;
lv_draw_rect(&gauge->cords, mask, &style_bg);
@@ -365,7 +365,7 @@ static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask, lv_style_
{
char scale_txt[16];
cord_t r = lv_obj_get_width(gauge) / 2 - style->hpad;
cord_t r = lv_obj_get_width(gauge) / 2 - style->body.pad_hor;
cord_t x_ofs = lv_obj_get_width(gauge) / 2 + gauge->cords.x1;
cord_t y_ofs = lv_obj_get_height(gauge) / 2 + gauge->cords.y1;
int16_t scale_angle = lv_lmeter_get_scale_angle(gauge);
@@ -391,8 +391,8 @@ static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask, lv_style_
area_t label_cord;
point_t label_size;
txt_get_size(&label_size, scale_txt, style->font,
style->letter_space, style->line_space,
txt_get_size(&label_size, scale_txt, style->txt.font,
style->txt.space_letter, style->txt.space_line,
CORD_MAX, TXT_FLAG_NONE);
/*Draw the label*/
@@ -414,7 +414,7 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style
lv_style_t style_needle;
lv_gauge_ext_t * ext = lv_obj_get_ext(gauge);
cord_t r = lv_obj_get_width(gauge) / 2 - style->opad;
cord_t r = lv_obj_get_width(gauge) / 2 - style->body.pad_obj;
cord_t x_ofs = lv_obj_get_width(gauge) / 2 + gauge->cords.x1;
cord_t y_ofs = lv_obj_get_height(gauge) / 2 + gauge->cords.y1;
uint16_t angle = lv_lmeter_get_scale_angle(gauge);
@@ -436,8 +436,8 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style
p_end.x = (trigo_sin(needle_angle + 90) * r) / TRIGO_SIN_MAX + x_ofs;
/*Draw the needle with the corresponding color*/
if(ext->needle_colors == NULL) style_needle.ccolor = LV_GAUGE_DEF_NEEDLE_COLOR;
else style_needle.ccolor = ext->needle_colors[i];
if(ext->needle_colors == NULL) style_needle.line.color = LV_GAUGE_DEF_NEEDLE_COLOR;
else style_needle.line.color = ext->needle_colors[i];
lv_draw_line(&p_mid, &p_end, mask, &style_needle);
}
@@ -445,15 +445,15 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style
/*Draw the needle middle area*/
lv_style_t style_neddle_mid;
lv_style_get(LV_STYLE_PLAIN, &style_neddle_mid);
style_neddle_mid.mcolor = style->bcolor;
style_neddle_mid.gcolor = style->bcolor;
style_neddle_mid.radius = LV_RADIUS_CIRCLE;
style_neddle_mid.body.color_main = style->border.color;
style_neddle_mid.body.color_grad = style->border.color;
style_neddle_mid.body.radius = LV_RADIUS_CIRCLE;
area_t nm_cord;
nm_cord.x1 = x_ofs - style->opad;
nm_cord.y1 = y_ofs - style->opad;
nm_cord.x2 = x_ofs + style->opad;
nm_cord.y2 = y_ofs + style->opad;
nm_cord.x1 = x_ofs - style->body.pad_obj;
nm_cord.y1 = y_ofs - style->body.pad_obj;
nm_cord.x2 = x_ofs + style->body.pad_obj;
nm_cord.y2 = y_ofs + style->body.pad_obj;
lv_draw_rect(&nm_cord, mask, &style_neddle_mid);
}

View File

@@ -195,7 +195,7 @@ void lv_img_set_file(lv_obj_t * img, const char * fn)
#if LV_IMG_ENABLE_SYMBOLS
lv_style_t * style = lv_obj_get_style(img);
point_t size;
txt_get_size(&size, fn, style->font, style->letter_space, style->line_space, CORD_MAX, TXT_FLAG_NONE);
txt_get_size(&size, fn, style->txt.font, style->txt.space_letter, style->txt.space_line, CORD_MAX, TXT_FLAG_NONE);
ext->w = size.x;
ext->h = size.y;
ext->transp = 1; /*Symbols always have transparent parts*/

View File

@@ -386,7 +386,7 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos)
uint32_t new_line_start = 0;
cord_t max_w = lv_obj_get_width(label);
lv_style_t * style = lv_obj_get_style(label);
const font_t * font = style->font;
const font_t * font = style->txt.font;
uint8_t letter_height = font_get_height(font) >> FONT_ANTIALIAS;
cord_t y = 0;
txt_flag_t flag = TXT_FLAG_NONE;
@@ -404,16 +404,16 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos)
/*Search the line of the index letter */;
while (txt[new_line_start] != '\0') {
new_line_start += txt_get_next_line(&txt[line_start], font, style->letter_space, max_w, flag);
new_line_start += txt_get_next_line(&txt[line_start], font, style->txt.space_letter, max_w, flag);
if(index < new_line_start || txt[new_line_start] == '\0') break; /*The line of 'index' letter begins at 'line_start'*/
y += letter_height + style->line_space;
y += letter_height + style->txt.space_line;
line_start = new_line_start;
}
/*If the last character is line break then go to the next line*/
if((txt[index - 1] == '\n' || txt[index - 1] == '\r') && txt[index] == '\0') {
y += letter_height + style->line_space;
y += letter_height + style->txt.space_line;
line_start = index;
}
@@ -432,13 +432,13 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos)
continue; /*Skip the letter is it is part of a command*/
}
}
x += (font_get_width(font, letter) >> FONT_ANTIALIAS) + style->letter_space;
x += (font_get_width(font, letter) >> FONT_ANTIALIAS) + style->txt.space_letter;
}
if(style->txt_align == LV_TXT_ALIGN_MID) {
if(style->txt.align == LV_TXT_ALIGN_MID) {
cord_t line_w;
line_w = txt_get_width(&txt[line_start], new_line_start - line_start,
font, style->letter_space, flag);
font, style->txt.space_letter, flag);
x += lv_obj_get_width(label) / 2 - line_w / 2;
}
@@ -461,7 +461,7 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos)
uint32_t new_line_start = 0;
cord_t max_w = lv_obj_get_width(label);
lv_style_t * style = lv_obj_get_style(label);
const font_t * font = style->font;
const font_t * font = style->txt.font;
uint8_t letter_height = font_get_height(font) >> FONT_ANTIALIAS;
cord_t y = 0;
txt_flag_t flag = TXT_FLAG_NONE;
@@ -477,18 +477,18 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos)
/*Search the line of the index letter */;
while (txt[line_start] != '\0') {
new_line_start += txt_get_next_line(&txt[line_start], font, style->letter_space, max_w, flag);
if(pos->y <= y + letter_height + style->line_space) break; /*The line is found ('line_start')*/
y += letter_height + style->line_space;
new_line_start += txt_get_next_line(&txt[line_start], font, style->txt.space_letter, max_w, flag);
if(pos->y <= y + letter_height + style->txt.space_line) break; /*The line is found ('line_start')*/
y += letter_height + style->txt.space_line;
line_start = new_line_start;
}
/*Calculate the x coordinate*/
cord_t x = 0;
if(style->txt_align == LV_TXT_ALIGN_MID) {
if(style->txt.align == LV_TXT_ALIGN_MID) {
cord_t line_w;
line_w = txt_get_width(&txt[line_start], new_line_start - line_start,
font, style->letter_space, flag);
font, style->txt.space_letter, flag);
x += lv_obj_get_width(label) / 2 - line_w / 2;
}
@@ -504,7 +504,7 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos)
}
}
x += (font_get_width(font, letter) >> FONT_ANTIALIAS) + style->letter_space;
x += (font_get_width(font, letter) >> FONT_ANTIALIAS) + style->txt.space_letter;
if(pos->x < x) break; /*Get the position*/
}
@@ -573,7 +573,7 @@ static void lv_label_refr_text(lv_obj_t * label)
cord_t max_w = lv_obj_get_width(label);
lv_style_t * style = lv_obj_get_style(label);
const font_t * font = style->font;
const font_t * font = style->txt.font;
ext->dot_end = LV_LABEL_DOT_END_INV; /*Initialize the dot end index*/
@@ -589,7 +589,7 @@ static void lv_label_refr_text(lv_obj_t * label)
if(ext->recolor != 0) flag |= TXT_FLAG_RECOLOR;
if(ext->expand != 0) flag |= TXT_FLAG_EXPAND;
if(ext->no_break != 0) flag |= TXT_FLAG_NO_BREAK;
txt_get_size(&size, ext->txt, font, style->letter_space, style->line_space, max_w, flag);
txt_get_size(&size, ext->txt, font, style->txt.space_letter, style->txt.space_line, max_w, flag);
/*Refresh the full size in expand mode*/
if(ext->long_mode == LV_LABEL_LONG_EXPAND || ext->long_mode == LV_LABEL_LONG_SCROLL) {

View File

@@ -201,13 +201,13 @@ static bool lv_led_design(lv_obj_t * led, const area_t * mask, lv_design_mode_t
memcpy(&leds_tmp, style, sizeof(leds_tmp));
/*Mix. the color with black proportionally with brightness*/
leds_tmp.mcolor = color_mix(leds_tmp.mcolor, COLOR_BLACK, ext->bright);
leds_tmp.gcolor = color_mix(leds_tmp.gcolor, COLOR_BLACK, ext->bright);
leds_tmp.bcolor = color_mix(leds_tmp.bcolor, COLOR_BLACK, ext->bright);
leds_tmp.body.color_main = color_mix(leds_tmp.body.color_main, COLOR_BLACK, ext->bright);
leds_tmp.body.color_grad = color_mix(leds_tmp.body.color_grad, COLOR_BLACK, ext->bright);
leds_tmp.border.color = color_mix(leds_tmp.border.color, COLOR_BLACK, ext->bright);
/*Set the current swidth according to brightness proportionally between LV_LED_BRIGHT_OFF and LV_LED_BRIGHT_ON*/
uint16_t bright_tmp = ext->bright;
leds_tmp.swidth = ((bright_tmp - LV_LED_BRIGHT_OFF) * style->swidth) / (LV_LED_BRIGHT_ON - LV_LED_BRIGHT_OFF);
leds_tmp.shadow.width = ((bright_tmp - LV_LED_BRIGHT_OFF) * style->shadow.width) / (LV_LED_BRIGHT_ON - LV_LED_BRIGHT_OFF);
led->style_p = &leds_tmp;
ancestor_design_f(led, mask, mode);

View File

@@ -141,7 +141,7 @@ void lv_line_set_points(lv_obj_t * line, const point_t * point_a, uint16_t point
}
lv_style_t * lines = lv_obj_get_style(line);
lv_obj_set_size(line, xmax + lines->line_width, ymax + lines->line_width);
lv_obj_set_size(line, xmax + lines->line.width, ymax + lines->line.width);
}
}

View File

@@ -225,12 +225,12 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l
/*Make the size adjustment*/
cord_t w = lv_obj_get_width(list);
lv_style_t * style_scrl = lv_obj_get_style(lv_page_get_scrl(list));
cord_t hpad_tot = style->hpad + style_scrl->hpad;
w -= hpad_tot * 2;
cord_t pad_hor_tot = style->body.pad_hor + style_scrl->body.pad_hor;
w -= pad_hor_tot * 2;
/*Make place for the scrollbar if hpad_tot is too small*/
/*Make place for the scrollbar if pad_hor_tot is too small*/
if(ext->sb_out != 0) {
if(hpad_tot < ext->page.sb_width) w -= ext->page.sb_width - hpad_tot;
if(pad_hor_tot < ext->page.sb_width) w -= ext->page.sb_width - pad_hor_tot;
}
lv_obj_set_width(liste, w);
#if USE_LV_IMG != 0 && USE_FSINT != 0

View File

@@ -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));
cord_t r_out = lv_obj_get_width(lmeter) / 2;
cord_t r_in =r_out - style->hpad;
cord_t r_in =r_out - style->body.pad_hor;
cord_t x_ofs = lv_obj_get_width(lmeter) / 2 + lmeter->cords.x1;
cord_t y_ofs = lv_obj_get_height(lmeter) / 2 + lmeter->cords.y1;
int16_t angle_ofs = 90 + (360 - ext->scale_angle) / 2;
@@ -195,7 +195,7 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const area_t * mask, lv_design_m
int16_t level = (int32_t)((int32_t)(lv_bar_get_value(lmeter) - min) * ext->scale_num) / (max - min);
uint8_t i;
style_tmp.ccolor = style->mcolor;
style_tmp.line.color = style->body.color_main;
for(i = 0; i < ext->scale_num; i++) {
/*Calculate the position a scale label*/
@@ -215,9 +215,9 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const area_t * mask, lv_design_m
p1.x = x_out+ x_ofs;
p1.y = y_out + y_ofs;
if(i > level) style_tmp.ccolor = style->ccolor;
if(i > level) style_tmp.line.color = style->line.color;
else {
style_tmp.ccolor=color_mix(style->gcolor, style->mcolor, (255 * i) / ext->scale_num);
style_tmp.line.color = color_mix(style->body.color_grad, style->body.color_main, (255 * i) / ext->scale_num);
}
lv_draw_line(&p1, &p2, mask, &style_tmp);

View File

@@ -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, NULL));
lv_obj_set_design_f(ext->scrl, lv_scrl_design);
lv_page_set_sb_width(new_page, style->hpad);
lv_page_set_sb_width(new_page, style->body.pad_hor);
lv_page_set_sb_mode(new_page, ext->sb_mode);
lv_page_set_style_sb(new_page, ext->style_sb);
@@ -156,7 +156,7 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
} else if(sign == LV_SIGNAL_STYLE_CHG) {
lv_style_t * style = lv_obj_get_style(page);
if(lv_cont_get_hfit(ext->scrl) == false) {
lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->hpad);
lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.pad_hor);
} else {
ext->scrl->signal_f(ext->scrl, LV_SIGNAL_CORD_CHG, &ext->scrl->cords);
}
@@ -178,7 +178,7 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
lv_obj_get_height(page) != area_get_height(param))) {
if(lv_cont_get_hfit(ext->scrl) == false) {
lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->hpad);
lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.pad_hor);
}
ext->scrl->signal_f(ext->scrl, LV_SIGNAL_CORD_CHG, &ext->scrl->cords);
@@ -229,7 +229,7 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
/*Be sure the width of the scrollable is correct*/
if(lv_cont_get_hfit(scrl) == false) {
lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * page_style->hpad);
lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * page_style->body.pad_hor);
}
cord_t new_x;
@@ -238,8 +238,8 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
bool refr_y = false;
area_t page_cords;
area_t scrl_cords;
cord_t hpad = page_style->hpad;
cord_t vpad = page_style->vpad;
cord_t hpad = page_style->body.pad_hor;
cord_t vpad = page_style->body.pad_ver;
new_x = lv_obj_get_x(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)
lv_page_sb_refresh(page);
} else if(sign == LV_SIGNAL_DRAG_BEGIN) {
if(page_ext->sb_mode == LV_PAGE_SB_MODE_DRAG ) {
cord_t sbh_pad = MATH_MAX(page_ext->sb_width, page_style->hpad);
cord_t sbv_pad = MATH_MAX(page_ext->sb_width, page_style->vpad);
cord_t sbh_pad = MATH_MAX(page_ext->sb_width, page_style->body.pad_hor);
cord_t sbv_pad = MATH_MAX(page_ext->sb_width, page_style->body.pad_ver);
if(area_get_height(&page_ext->sbv) < lv_obj_get_height(scrl) - 2 * sbv_pad) {
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)
if((obj_h <= page_h && top_err > 0) ||
(obj_h > page_h && top_err < bot_err)) {
/*Calculate a new position and to let scrable_rects.vpad space above*/
scrlable_y = -(obj_y - style_scrl->vpad - style->vpad);
scrlable_y += style_scrl->vpad;
scrlable_y = -(obj_y - style_scrl->body.pad_ver - style->body.pad_ver);
scrlable_y += style_scrl->body.pad_ver;
}
/*Out of the page on the bottom*/
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)
/*Calculate a new position and to let scrable_rects.vpad space below*/
scrlable_y = -obj_y;
scrlable_y += page_h - obj_h;
scrlable_y -= style_scrl->vpad;
scrlable_y -= style_scrl->body.pad_ver;
} else {
/*Alraedy in focus*/
return;
@@ -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_style_t * style_page = lv_obj_get_style(page);
lv_group_t * g = lv_obj_get_group(page);
if(style_page->empty != 0 || style_page->opa == OPA_TRANSP) { /*Background is visible?*/
if(style_page->body.empty != 0 || style_page->body.opa == OPA_TRANSP) { /*Background is visible?*/
if(lv_group_get_focused(g) == page) {
lv_style_t * style_mod;
style_mod = lv_group_mod_style(g, style_ori);
@@ -633,12 +633,12 @@ static void lv_page_sb_refresh(lv_obj_t * page)
cord_t size_tmp;
cord_t scrl_w = lv_obj_get_width(scrl);
cord_t scrl_h = lv_obj_get_height(scrl);
cord_t hpad = style->hpad;
cord_t vpad = style->vpad;
cord_t hpad = style->body.pad_hor;
cord_t vpad = style->body.pad_ver;
cord_t obj_w = lv_obj_get_width(page);
cord_t obj_h = lv_obj_get_height(page);
cord_t sbh_pad = MATH_MAX(ext->sb_width, style->hpad);
cord_t sbv_pad = MATH_MAX(ext->sb_width, style->vpad);
cord_t sbh_pad = MATH_MAX(ext->sb_width, style->body.pad_hor);
cord_t sbv_pad = MATH_MAX(ext->sb_width, style->body.pad_ver);
if(ext->sb_mode == LV_PAGE_SB_MODE_OFF) return;

View File

@@ -77,8 +77,8 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, lv_obj_t * copy)
lv_ddlist_open(new_roller, true, 0);
lv_style_t * style_label = lv_obj_get_style(ext->ddlist.opt_label);
lv_ddlist_set_fix_height(new_roller, (font_get_height(style_label->font) >> FONT_ANTIALIAS) * 3
+ style_label->line_space * 4);
lv_ddlist_set_fix_height(new_roller, (font_get_height(style_label->txt.font) >> FONT_ANTIALIAS) * 3
+ style_label->txt.space_line * 4);
lv_obj_refr_style(new_roller); /*To set scrollable size automatically*/
}
/*Copy an existing roller*/
@@ -187,13 +187,13 @@ static bool lv_roller_design(lv_obj_t * roller, const area_t * mask, lv_design_m
lv_style_t * style = lv_obj_get_style(roller);
lv_draw_rect(&roller->cords, mask, style);
const font_t * font = style->font;
const font_t * font = style->txt.font;
lv_roller_ext_t * ext = lv_obj_get_ext(roller);
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
area_t rect_area;
rect_area.y1 = roller->cords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->line_space - 2;
rect_area.y2 = rect_area.y1 + font_h + style->line_space;
rect_area.x1 = ext->ddlist.opt_label->cords.x1 - style->hpad;
rect_area.y1 = roller->cords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->txt.space_line - 2;
rect_area.y2 = rect_area.y1 + font_h + style->txt.space_line;
rect_area.x1 = ext->ddlist.opt_label->cords.x1 - style->body.pad_hor;
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);
@@ -228,12 +228,12 @@ static bool roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void *
lv_obj_t * roller = lv_obj_get_parent(roller_scrl);
lv_roller_ext_t * ext = lv_obj_get_ext(roller);
lv_style_t * style_label = lv_obj_get_style(ext->ddlist.opt_label);
const font_t * font = style_label->font;
const font_t * font = style_label->txt.font;
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
if(sign == LV_SIGNAL_DRAG_END) {
/*If dragged then align the list to there be an element in the middle*/
cord_t label_y1 = ext->ddlist.opt_label->cords.y1 - roller->cords.y1;
cord_t label_unit = (font_get_height(style_label->font) >> FONT_ANTIALIAS) + style_label->line_space / 2;
cord_t label_unit = (font_get_height(style_label->txt.font) >> FONT_ANTIALIAS) + style_label->txt.space_line / 2;
cord_t mid = (roller->cords.y2 - roller->cords.y1) / 2;
id = (mid - label_y1) / label_unit;
if(id < 0) id = 0;
@@ -246,7 +246,7 @@ static bool roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void *
point_t p;
lv_indev_get_point(indev, &p);
p.y = p.y - ext->ddlist.opt_label->cords.y1;
id = p.y / (font_h + style_label->line_space);
id = p.y / (font_h + style_label->txt.space_line);
if(id < 0) id = 0;
if(id >= ext->ddlist.num_opt) id = ext->ddlist.num_opt - 1;
ext->ddlist.sel_opt = id;
@@ -256,7 +256,7 @@ static bool roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void *
/*Position the scrollable according to the new selected option*/
if(id != -1) {
cord_t h = lv_obj_get_height(roller);
cord_t line_y1 = id * (font_h + style_label->line_space) + ext->ddlist.opt_label->cords.y1 - roller_scrl->cords.y1;
cord_t line_y1 = id * (font_h + style_label->txt.space_line) + ext->ddlist.opt_label->cords.y1 - roller_scrl->cords.y1;
cord_t new_y = - line_y1 + (h - font_h) / 2;
if(ext->ddlist.anim_time == 0) {

View File

@@ -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;
} else {
lv_style_t * style = lv_obj_get_style(slider);
cord_t pad = MATH_MIN(style->hpad, style->vpad);
cord_t pad = MATH_MIN(style->body.pad_hor, style->body.pad_ver);
if(pad < 0) {
pad = -pad;
if(slider->ext_size < pad) slider->ext_size = pad;
@@ -290,19 +290,19 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
area_t area_bar;
area_cpy(&area_bar, &slider->cords);
/*Be sure at least vpad/hpad width bar will remain*/
cord_t vpad_bar = style_slider->vpad;
cord_t hpad_bar = style_slider->hpad;
if(vpad_bar * 2 + LV_SLIDER_SIZE_MIN > area_get_height(&area_bar)) {
vpad_bar = (area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
cord_t pad_ver_bar = style_slider->body.pad_ver;
cord_t pad_hor_bar = style_slider->body.pad_hor;
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;
}
if(hpad_bar * 2 + LV_SLIDER_SIZE_MIN > area_get_width(&area_bar)) {
hpad_bar = (area_get_width(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
if(pad_hor_bar * 2 + LV_SLIDER_SIZE_MIN > area_get_width(&area_bar)) {
pad_hor_bar = (area_get_width(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
}
area_bar.x1 += hpad_bar;
area_bar.x2 -= hpad_bar;
area_bar.y1 += vpad_bar;
area_bar.y2 -= vpad_bar;
area_bar.x1 += pad_hor_bar;
area_bar.x2 -= pad_hor_bar;
area_bar.y1 += pad_ver_bar;
area_bar.y2 -= pad_ver_bar;
lv_draw_rect(&area_bar, mask, style_slider);
/*Draw the indicator*/
@@ -310,19 +310,19 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
area_cpy(&area_indic, &area_bar);
/*Be sure at least vpad/hpad width indicator will remain*/
cord_t vpad_indic = style_indic->vpad;
cord_t hpad_indic = style_indic->hpad;
if(vpad_indic * 2 + LV_SLIDER_SIZE_MIN > area_get_height(&area_bar)) {
vpad_indic = (area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
cord_t pad_ver_indic = style_indic->body.pad_ver;
cord_t pad_hor_indic = style_indic->body.pad_hor;
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;
}
if(hpad_indic * 2 + LV_SLIDER_SIZE_MIN > area_get_width(&area_bar)) {
hpad_indic = (area_get_width(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
if(pad_hor_indic * 2 + LV_SLIDER_SIZE_MIN > area_get_width(&area_bar)) {
pad_hor_indic = (area_get_width(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
}
area_indic.x1 += hpad_indic;
area_indic.x2 -= hpad_indic;
area_indic.y1 += vpad_indic;
area_indic.y2 -= vpad_indic;
area_indic.x1 += pad_hor_indic;
area_indic.x2 -= pad_hor_indic;
area_indic.y1 += pad_ver_indic;
area_indic.y2 -= pad_ver_indic;
cord_t slider_w = area_get_width(&slider->cords);
cord_t slider_h = area_get_height(&slider->cords);

View File

@@ -176,11 +176,11 @@ bool lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
lv_style_t * style_scrl = lv_obj_get_style(scrl);
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);
cord_t font_h = font_get_height(style_label->font) >> FONT_ANTIALIAS;
lv_obj_set_height(ta, font_h + (style_ta->vpad + style_scrl->vpad) * 2);
cord_t font_h = font_get_height(style_label->txt.font) >> FONT_ANTIALIAS;
lv_obj_set_height(ta, font_h + (style_ta->body.pad_ver + style_scrl->body.pad_ver) * 2);
} 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->hpad);
lv_obj_set_pos(ext->label, style_scrl->hpad, style_scrl->vpad); /*Be sure the Label is in the correct position*/
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.pad_hor);
lv_obj_set_pos(ext->label, style_scrl->body.pad_hor, style_scrl->body.pad_ver); /*Be sure the Label is in the correct position*/
}
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)
lv_obj_get_height(ta) != area_get_height(param)) {
lv_obj_t * scrl = lv_page_get_scrl(ta);
lv_style_t * style_scrl = lv_obj_get_style(scrl);
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->hpad);
lv_obj_set_pos(ext->label, style_scrl->hpad, style_scrl->vpad);
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.pad_hor);
lv_obj_set_pos(ext->label, style_scrl->body.pad_hor, style_scrl->body.pad_ver);
lv_label_set_text(ext->label, NULL); /*Refresh the label*/
}
}
@@ -238,7 +238,7 @@ bool lv_ta_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
lv_ta_ext_t * ext = lv_obj_get_ext(ta);
lv_style_t * style_label = lv_obj_get_style(ext->label);
scrl->ext_size = MATH_MAX(scrl->ext_size, style_label->line_space + font_get_height(style_label->font));
scrl->ext_size = MATH_MAX(scrl->ext_size, style_label->txt.space_line + font_get_height(style_label->txt.font));
}
}
return valid;
@@ -367,7 +367,7 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt)
/*Don't let 'width == 0' because cursor will not be visible*/
if(lv_obj_get_width(ext->label) == 0) {
lv_style_t * style = lv_obj_get_style(ext->label);
lv_obj_set_width(ext->label, font_get_width(style->font, ' '));
lv_obj_set_width(ext->label, font_get_width(style->txt.font, ' '));
}
/*It is a valid x step so save it*/
@@ -419,7 +419,7 @@ void lv_ta_del(lv_obj_t * ta)
/*Don't let 'width == 0' because cursor will not be visible*/
if(lv_obj_get_width(ext->label) == 0) {
lv_style_t * style = lv_obj_get_style(ext->label);
lv_obj_set_width(ext->label, style->line_width);
lv_obj_set_width(ext->label, style->line.width);
}
if(ext->pwd_mode != 0) {
@@ -465,7 +465,7 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
lv_obj_t * label_par = lv_obj_get_parent(ext->label);
point_t cur_pos;
lv_style_t * style = lv_obj_get_style(ta);
const font_t * font_p = style->font;
const font_t * font_p = style->txt.font;
area_t label_cords;
area_t ta_cords;
lv_label_get_letter_pos(ext->label, pos, &cur_pos);
@@ -479,9 +479,9 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
/*Check the bottom*/
cord_t font_h = font_get_height(font_p) >> FONT_ANTIALIAS;
if(label_cords.y1 + cur_pos.y + font_h + style_scrl->vpad > ta_cords.y2) {
if(label_cords.y1 + cur_pos.y + font_h + style_scrl->body.pad_ver > ta_cords.y2) {
lv_obj_set_y(label_par, -(cur_pos.y - lv_obj_get_height(ta) +
font_h + 2 * style_scrl->vpad));
font_h + 2 * style_scrl->body.pad_ver));
}
/*Check the left (use the font_h as general unit)*/
if(lv_obj_get_x(label_par) + cur_pos.x < font_h) {
@@ -489,9 +489,9 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
}
/*Check the right (use the font_h as general unit)*/
if(label_cords.x1 + cur_pos.x + font_h + style_scrl->hpad > ta_cords.x2) {
if(label_cords.x1 + cur_pos.x + font_h + style_scrl->body.pad_hor > ta_cords.x2) {
lv_obj_set_x(label_par, -(cur_pos.x - lv_obj_get_width(ta) +
font_h + 2 * style_scrl->hpad));
font_h + 2 * style_scrl->body.pad_hor));
}
/*Reset cursor blink animation*/
@@ -558,9 +558,9 @@ void lv_ta_cursor_down(lv_obj_t * ta)
/*Increment the y with one line and keep the valid x*/
lv_style_t * label_style = lv_obj_get_style(ext->label);
const font_t * font_p = label_style->font;
const font_t * font_p = label_style->txt.font;
cord_t font_h = font_get_height(font_p) >> FONT_ANTIALIAS;
pos.y += font_h + label_style->line_space + 1;
pos.y += font_h + label_style->txt.space_line + 1;
pos.x = ext->cursor_valid_x;
/*Do not go below he last line*/
@@ -585,9 +585,9 @@ void lv_ta_cursor_up(lv_obj_t * ta)
/*Decrement the y with one line and keep the valid x*/
lv_style_t * label_style = lv_obj_get_style(ext->label);
const font_t * font = label_style->font;
const font_t * font = label_style->txt.font;
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
pos.y -= font_h + label_style->line_space - 1;
pos.y -= font_h + label_style->txt.space_line - 1;
pos.x = ext->cursor_valid_x;
/*Get the letter index on the new cursor position and set it*/
@@ -679,14 +679,14 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en)
lv_style_t * style_ta = lv_obj_get_style(ta);
lv_style_t * style_scrl = lv_obj_get_style(lv_page_get_scrl(ta));
lv_style_t * style_label = lv_obj_get_style(ext->label);
cord_t font_h = font_get_height(style_label->font) >> FONT_ANTIALIAS;
cord_t font_h = font_get_height(style_label->txt.font) >> FONT_ANTIALIAS;
ext->one_line = 1;
lv_cont_set_fit(lv_page_get_scrl(ta), true, true);
lv_obj_set_height(ta, font_h + (style_ta->vpad + style_scrl->vpad) * 2);
lv_obj_set_height(ta, font_h + (style_ta->body.pad_ver + style_scrl->body.pad_ver) * 2);
lv_label_set_long_mode(ext->label, LV_LABEL_LONG_EXPAND);
lv_label_set_no_break(ext->label, true);
lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->hpad, style_ta->vpad);
lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->body.pad_hor, style_ta->body.pad_ver);
} else {
lv_ta_ext_t * ext = lv_obj_get_ext(ta);
lv_style_t * style_ta = lv_obj_get_style(ta);
@@ -696,7 +696,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_no_break(ext->label, false);
lv_obj_set_height(ta, LV_TA_DEF_HEIGHT);
lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->hpad, style_ta->vpad);
lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->body.pad_hor, style_ta->body.pad_ver);
}
}
@@ -859,20 +859,20 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
else {
/*If cursor style is not specified then use the modified label style */
lv_style_cpy(&cur_style, label_style);
color_t ccolor_tmp = cur_style.ccolor; /*Make letter color to cursor color*/
cur_style.ccolor = cur_style.mcolor; /*In block mode the letter color will be current background color*/
cur_style.mcolor = ccolor_tmp;
cur_style.gcolor = ccolor_tmp;
cur_style.bcolor = ccolor_tmp;
cur_style.bopa = OPA_COVER;
cur_style.bwidth = 1 * LV_DOWNSCALE;
cur_style.line_width = 1 * LV_DOWNSCALE;
cur_style.swidth = 0;
cur_style.radius = 0;
cur_style.empty = 0;
cur_style.opa = OPA_COVER;
cur_style.hpad = 0;
cur_style.vpad = 0;
color_t ccolor_tmp = cur_style.txt.color; /*Make letter color to cursor color*/
cur_style.txt.color = cur_style.body.color_main; /*In block mode the letter color will be current background color*/
cur_style.body.color_main = ccolor_tmp;
cur_style.body.color_grad = ccolor_tmp;
cur_style.border.color = ccolor_tmp;
cur_style.border.opa = OPA_COVER;
cur_style.border.width = 1 * LV_DOWNSCALE;
cur_style.line.width = 1 * LV_DOWNSCALE;
cur_style.shadow.width = 0;
cur_style.body.radius = 0;
cur_style.body.empty = 0;
cur_style.body.opa = OPA_COVER;
cur_style.body.pad_hor = 0;
cur_style.body.pad_ver = 0;
}
uint16_t cur_pos = lv_ta_get_cursor_pos(ta);
@@ -885,13 +885,13 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
#endif
uint32_t letter = txt_utf8_next(&txt[byte_pos], NULL);
cord_t letter_h = font_get_height(label_style->font) >> FONT_ANTIALIAS;
cord_t letter_h = font_get_height(label_style->txt.font) >> FONT_ANTIALIAS;
/*Set letter_w (set not 0 on non printable but valid chars)*/
cord_t letter_w;
if(letter == '\0' || letter == '\n' || letter == '\r') {
letter_w = font_get_width(label_style->font, ' ');
letter_w = font_get_width(label_style->txt.font, ' ');
} else {
letter_w = font_get_width(label_style->font, letter);
letter_w = font_get_width(label_style->txt.font, letter);
}
point_t letter_pos;
@@ -900,7 +900,7 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
/*If the cursor is out of the text (most right) draw it to the next line*/
if(letter_pos.x + ta_ext->label->cords.x1 + letter_w > ta_ext->label->cords.x2 && ta_ext->one_line == 0) {
letter_pos.x = 0;
letter_pos.y += letter_h + label_style->line_space;
letter_pos.y += letter_h + label_style->txt.space_line;
if(letter != '\0'){
byte_pos += txt_utf8_size(txt[byte_pos]);
@@ -908,25 +908,25 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
}
if(letter == '\0' || letter == '\n' || letter == '\r') {
letter_w = font_get_width(label_style->font, ' ');
letter_w = font_get_width(label_style->txt.font, ' ');
} else {
letter_w = font_get_width(label_style->font, letter);
letter_w = font_get_width(label_style->txt.font, letter);
}
}
/*Draw he cursor according to the type*/
area_t cur_area;
if(ta_ext->cursor_type == LV_TA_CURSOR_LINE) {
cur_area.x1 = letter_pos.x + ta_ext->label->cords.x1 + cur_style.hpad - (cur_style.line_width >> 1) - (cur_style.line_width & 0x1);
cur_area.y1 = letter_pos.y + ta_ext->label->cords.y1 + cur_style.vpad;
cur_area.x2 = letter_pos.x + ta_ext->label->cords.x1 + cur_style.hpad + (cur_style.line_width >> 1);
cur_area.y2 = letter_pos.y + ta_ext->label->cords.y1 + cur_style.vpad + letter_h;
cur_area.x1 = letter_pos.x + ta_ext->label->cords.x1 + cur_style.body.pad_hor - (cur_style.line.width >> 1) - (cur_style.line.width & 0x1);
cur_area.y1 = letter_pos.y + ta_ext->label->cords.y1 + cur_style.body.pad_ver;
cur_area.x2 = letter_pos.x + ta_ext->label->cords.x1 + cur_style.body.pad_hor + (cur_style.line.width >> 1);
cur_area.y2 = letter_pos.y + ta_ext->label->cords.y1 + cur_style.body.pad_ver + letter_h;
lv_draw_rect(&cur_area, mask, &cur_style);
} else if(ta_ext->cursor_type == LV_TA_CURSOR_BLOCK) {
cur_area.x1 = letter_pos.x + ta_ext->label->cords.x1 - cur_style.hpad;
cur_area.y1 = letter_pos.y + ta_ext->label->cords.y1 - cur_style.vpad;
cur_area.x2 = letter_pos.x + ta_ext->label->cords.x1 + cur_style.hpad + letter_w;
cur_area.y2 = letter_pos.y + ta_ext->label->cords.y1 + cur_style.vpad + letter_h;
cur_area.x1 = letter_pos.x + ta_ext->label->cords.x1 - cur_style.body.pad_hor;
cur_area.y1 = letter_pos.y + ta_ext->label->cords.y1 - cur_style.body.pad_ver;
cur_area.x2 = letter_pos.x + ta_ext->label->cords.x1 + cur_style.body.pad_hor + letter_w;
cur_area.y2 = letter_pos.y + ta_ext->label->cords.y1 + cur_style.body.pad_ver + letter_h;
lv_draw_rect(&cur_area, mask, &cur_style);
@@ -939,24 +939,24 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
char letter_buf[8] = {0};
memcpy(letter_buf, &txt[byte_pos], txt_utf8_size(txt[byte_pos]));
#endif
cur_area.x1 += cur_style.hpad;
cur_area.y1 += cur_style.vpad;
cur_area.x1 += cur_style.body.pad_hor;
cur_area.y1 += cur_style.body.pad_ver;
lv_draw_label(&cur_area, mask, &cur_style, letter_buf, TXT_FLAG_NONE, 0);
} else if(ta_ext->cursor_type == LV_TA_CURSOR_OUTLINE) {
cur_area.x1 = letter_pos.x + ta_ext->label->cords.x1 - cur_style.hpad;
cur_area.y1 = letter_pos.y + ta_ext->label->cords.y1 - cur_style.vpad;
cur_area.x2 = letter_pos.x + ta_ext->label->cords.x1 + cur_style.hpad + letter_w;
cur_area.y2 = letter_pos.y + ta_ext->label->cords.y1 - cur_style.vpad+ letter_h;
cur_area.x1 = letter_pos.x + ta_ext->label->cords.x1 - cur_style.body.pad_hor;
cur_area.y1 = letter_pos.y + ta_ext->label->cords.y1 - cur_style.body.pad_ver;
cur_area.x2 = letter_pos.x + ta_ext->label->cords.x1 + cur_style.body.pad_hor + letter_w;
cur_area.y2 = letter_pos.y + ta_ext->label->cords.y1 - cur_style.body.pad_ver+ letter_h;
cur_style.empty = 1;
if(cur_style.bwidth == 0) cur_style.bwidth = 1 * LV_DOWNSCALE; /*Be sure the border will be drawn*/
cur_style.body.empty = 1;
if(cur_style.border.width == 0) cur_style.border.width = 1 * LV_DOWNSCALE; /*Be sure the border will be drawn*/
lv_draw_rect(&cur_area, mask, &cur_style);
} else if(ta_ext->cursor_type == LV_TA_CURSOR_UNDERLINE) {
cur_area.x1 = letter_pos.x + ta_ext->label->cords.x1 + cur_style.hpad;
cur_area.y1 = letter_pos.y + ta_ext->label->cords.y1 + cur_style.vpad + letter_h - (cur_style.line_width >> 1);
cur_area.x2 = letter_pos.x + ta_ext->label->cords.x1 + cur_style.hpad + letter_w;
cur_area.y2 = letter_pos.y + ta_ext->label->cords.y1 + cur_style.vpad + letter_h + (cur_style.line_width >> 1) + (cur_style.line_width & 0x1);
cur_area.x1 = letter_pos.x + ta_ext->label->cords.x1 + cur_style.body.pad_hor;
cur_area.y1 = letter_pos.y + ta_ext->label->cords.y1 + cur_style.body.pad_ver + letter_h - (cur_style.line.width >> 1);
cur_area.x2 = letter_pos.x + ta_ext->label->cords.x1 + cur_style.body.pad_hor + letter_w;
cur_area.y2 = letter_pos.y + ta_ext->label->cords.y1 + cur_style.body.pad_ver + letter_h + (cur_style.line.width >> 1) + (cur_style.line.width & 0x1);
lv_draw_rect(&cur_area, mask, &cur_style);
}

View File

@@ -97,7 +97,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, lv_obj_t * copy)
ext->indic = lv_obj_create(ext->tabs, NULL);
lv_style_t * style_indic = lv_obj_get_style(ext->indic);
lv_obj_set_size(ext->indic, LV_DPI, style_indic->line_width);
lv_obj_set_size(ext->indic, LV_DPI, style_indic->line.width);
lv_obj_align(ext->indic, ext->tabs, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_obj_set_click(ext->indic, false);
@@ -201,9 +201,9 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
/*Modify the indicator size*/
lv_style_t * style_tabs = lv_obj_get_style(ext->tabs);
cord_t indic_width = (lv_obj_get_width(tabview) - style_tabs->opad * (ext->tab_cnt - 1) - 2 * style_tabs->hpad) / ext->tab_cnt;
cord_t indic_width = (lv_obj_get_width(tabview) - style_tabs->body.pad_obj * (ext->tab_cnt - 1) - 2 * style_tabs->body.pad_hor) / ext->tab_cnt;
lv_obj_set_width(ext->indic, indic_width);
lv_obj_set_x(ext->indic, indic_width * ext->tab_act + style_tabs->opad * ext->tab_act + style_tabs->hpad);
lv_obj_set_x(ext->indic, indic_width * ext->tab_act + style_tabs->body.pad_obj * ext->tab_act + style_tabs->body.pad_hor);
/*Set the first tab as active*/
if(ext->tab_cnt == 1) {
@@ -235,7 +235,7 @@ void lv_tabview_set_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
anim_en = false;
#endif
cord_t cont_x = -(lv_obj_get_width(tabview) * id + style->opad * id + style->hpad);
cord_t cont_x = -(lv_obj_get_width(tabview) * id + style->body.pad_obj * id + style->body.pad_hor);
if(anim_en == false) {
lv_obj_set_x(ext->content, cont_x);
} else {
@@ -258,7 +258,7 @@ void lv_tabview_set_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
/*Move the indicator*/
cord_t indic_width = lv_obj_get_width(ext->indic);
lv_style_t * tabs_style = lv_obj_get_style(ext->tabs);
cord_t indic_x = indic_width * id + tabs_style->opad * id + tabs_style->hpad;
cord_t indic_x = indic_width * id + tabs_style->body.pad_obj * id + tabs_style->body.pad_hor;
if(anim_en == false) {
lv_obj_set_x(ext->indic, indic_x);
@@ -375,8 +375,8 @@ void lv_tabview_realign(lv_obj_t * tabview)
if(ext->tab_cnt != 0) {
lv_style_t * style_tabs = lv_obj_get_style(ext->tabs);
cord_t indic_width = (lv_obj_get_width(tabview) - style_tabs->opad * (ext->tab_cnt - 1) -
2 * style_tabs->hpad) / ext->tab_cnt;
cord_t indic_width = (lv_obj_get_width(tabview) - style_tabs->body.pad_obj * (ext->tab_cnt - 1) -
2 * style_tabs->body.pad_hor) / ext->tab_cnt;
lv_obj_set_width(ext->indic, indic_width);
}
@@ -532,9 +532,9 @@ static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage)
cord_t indic_width = lv_obj_get_width(ext->indic);
lv_style_t * tabs_style = lv_obj_get_style(ext->tabs);
lv_style_t * indic_style = lv_obj_get_style(ext->indic);
cord_t p = ((tabpage->cords.x1 - tabview->cords.x1) * (indic_width + tabs_style->opad)) / lv_obj_get_width(tabview);
cord_t p = ((tabpage->cords.x1 - tabview->cords.x1) * (indic_width + tabs_style->body.pad_obj)) / lv_obj_get_width(tabview);
lv_obj_set_x(ext->indic, indic_width * ext->tab_act + tabs_style->opad * ext->tab_act + indic_style->hpad - p);
lv_obj_set_x(ext->indic, indic_width * ext->tab_act + tabs_style->body.pad_obj * ext->tab_act + indic_style->body.pad_hor - p);
}
}

View File

@@ -341,7 +341,7 @@ cord_t lv_win_get_width(lv_obj_t * win)
lv_obj_t * scrl = lv_page_get_scrl(ext->page);
lv_style_t * style_scrl = lv_obj_get_style(scrl);
return lv_obj_get_width(scrl) - 2 * style_scrl->hpad;
return lv_obj_get_width(scrl) - 2 * style_scrl->body.pad_hor;
}
/**
@@ -412,16 +412,16 @@ static void lv_win_realign(lv_obj_t * win)
}
lv_style_t * btnh_style = lv_obj_get_style(ext->btnh);
lv_obj_set_height(ext->btnh, ext->cbtn_size + 2 * btnh_style->vpad * 2);
lv_obj_set_height(ext->btnh, ext->cbtn_size + 2 * btnh_style->body.pad_ver * 2);
lv_obj_set_width(ext->header, lv_obj_get_width(win));
/*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)) {
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->hpad, 0);
lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->hpad, 0);
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.pad_hor, 0);
lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.pad_hor, 0);
} else {
lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->hpad, 0);
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->hpad, 0);
lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.pad_hor, 0);
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.pad_hor, 0);
}
lv_obj_set_pos_us(ext->header, 0, 0);
@@ -433,7 +433,7 @@ static void lv_win_realign(lv_obj_t * win)
lv_style_t * style_page = lv_obj_get_style(page);
lv_obj_t * scrl = lv_page_get_scrl(page);
lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * style_page->hpad);
lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * style_page->body.pad_hor);
}
#endif