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

@@ -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) {