BigW Consortium Gitlab

Commit 8c9d4b58 by Gabor Kiss-Vamosi

further renames in styles

parent 08567907
......@@ -127,7 +127,7 @@ static void gui_create(void)
lv_obj_t * holder = lv_cont_create(scr, NULL); /*Create a transparent holder*/
lv_cont_set_fit(holder, true, true);
lv_cont_set_layout(holder, LV_CONT_LAYOUT_COL_L);
lv_obj_set_style(holder, lv_style_get(LV_STYLE_TRANSP, NULL));
lv_obj_set_style(holder, lv_style_get(LV_STYLE_TRANSPARENT, NULL));
lv_obj_t * cb = lv_cb_create(holder, NULL); /*First check box*/
lv_cb_set_text(cb, "Red");
......
......@@ -258,7 +258,7 @@ static void style_mod_def(lv_style_t * style)
if(style->border.width == 0 && style->body.empty == 0) style->border.width = 2 * LV_DOWNSCALE; /*Add border to not transparent styles*/
else style->border.width = style->border.width * 2; /*Make the border thicker*/
style->body.color_main = color_mix(style->body.color_main, COLOR_ORANGE, OPA_80);
style->body.color_grad = color_mix(style->body.color_grad, COLOR_ORANGE, OPA_80);
style->body.color_gradient = color_mix(style->body.color_gradient, COLOR_ORANGE, OPA_80);
}
#endif /*LV_OBJ_GROUP != 0*/
......@@ -90,10 +90,10 @@ void lv_init(void)
act_scr = def_scr;
top_layer = lv_obj_create(NULL, NULL);
lv_obj_set_style(top_layer, lv_style_get(LV_STYLE_TRANSP_TIGHT, NULL));
lv_obj_set_style(top_layer, lv_style_get(LV_STYLE_TRANSPARENT_TIGHT, NULL));
sys_layer = lv_obj_create(NULL, NULL);
lv_obj_set_style(sys_layer, lv_style_get(LV_STYLE_TRANSP_TIGHT, NULL));
lv_obj_set_style(sys_layer, lv_style_get(LV_STYLE_TRANSPARENT_TIGHT, NULL));
/*Refresh the screen*/
lv_obj_inv(act_scr);
......@@ -139,7 +139,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
new_obj->ext_size = 0;
/*Set appearance*/
new_obj->style_p = lv_style_get(LV_STYLE_SCR, NULL);
new_obj->style_p = lv_style_get(LV_STYLE_SCREEN, NULL);
/*Set virtual functions*/
lv_obj_set_signal_f(new_obj, lv_obj_signal);
......@@ -1287,7 +1287,7 @@ lv_style_t * lv_obj_get_style(lv_obj_t * obj)
while(par != NULL) {
if(par->style_p != NULL) {
if(par->style_p->body.glass == 0) {
if(par->style_p->glass == 0) {
style_act = par->style_p;
break;
}
......@@ -1561,7 +1561,7 @@ static void lv_child_refr_style(lv_obj_t * obj)
if(child->style_p == NULL) {
lv_child_refr_style(child); /*Check children too*/
lv_obj_refr_style(child); /*Notify the child about the style change*/
} else if(child->style_p->body.glass) {
} else if(child->style_p->glass) {
/*Children with 'glass' parent might be effected if their style == NULL*/
lv_child_refr_style(child);
}
......
......@@ -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(found_p == NULL) {
lv_style_t * style = lv_obj_get_style(obj);
if(style->body.opa == OPA_COVER &&
if(style->opacity == OPA_COVER &&
obj->design_f(obj, area_p, LV_DESIGN_COVER_CHK) != false) {
found_p = obj;
}
......@@ -439,7 +439,7 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p)
/* Redraw the object */
lv_style_t * style = lv_obj_get_style(obj);
if(style->body.opa != OPA_TRANSP) {
if(style->opacity != OPA_TRANSP) {
obj->design_f(obj, &obj_ext_mask, LV_DESIGN_DRAW_MAIN);
//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)
}
/* If all the children are redrawn make 'post draw' design */
if(style->body.opa != OPA_TRANSP) {
if(style->opacity != OPA_TRANSP) {
obj->design_f(obj, &obj_ext_mask, LV_DESIGN_DRAW_POST);
}
}
......
......@@ -33,25 +33,28 @@ typedef enum {
LV_TXT_ALIGN_MID,
}lv_txt_align_t;
/*Shadow types*/
typedef enum
{
LV_STYPE_BOTTOM = 0,
LV_STYPE_FULL,
}lv_stype_t;
LV_SHADOW_BOTTOM = 0,
LV_SHADOW_FULL,
}lv_shadow_type_t;
typedef struct
{
opa_t opacity;
uint8_t glass :1; /*1: Do not inherit this style*/
struct {
color_t color_main;
color_t color_grad;
opa_t opa;
cord_t pad_ver; /*Vertical padding*/
cord_t pad_hor; /*Horizontal padding*/
cord_t pad_obj; /*Object padding on the background*/
color_t color_gradient;
cord_t radius; /*Corner radius of background*/
uint8_t glass :1; /*1: Do not inherit this style*/
struct {
cord_t vertical;
cord_t horizontal;
cord_t inner;
}padding;
uint8_t empty :1; /*Transparent background (border still drawn)*/
}body;
......@@ -67,40 +70,38 @@ typedef struct
uint8_t type;
}shadow;
struct {
color_t color;
const font_t * font;
cord_t space_letter;
cord_t space_line;
uint8_t align:2;
}txt;
}text;
struct {
color_t color;
opa_t intense;
}img;
}image;
struct {
color_t color;
cord_t width;
}line;
}lv_style_t;
typedef enum {
LV_STYLE_SCR,
LV_STYLE_TRANSP,
LV_STYLE_TRANSP_TIGHT,
LV_STYLE_SCREEN,
LV_STYLE_TRANSPARENT,
LV_STYLE_TRANSPARENT_TIGHT,
LV_STYLE_PLAIN,
LV_STYLE_PLAIN_COLOR,
LV_STYLE_PRETTY,
LV_STYLE_PRETTY_COLOR,
LV_STYLE_BTN_REL,
LV_STYLE_BTN_PR,
LV_STYLE_BTN_TREL,
LV_STYLE_BTN_TPR,
LV_STYLE_BTN_INA,
LV_STYLE_BUTTON_OFF_RELEASED,
LV_STYLE_BUTTON_OFF_PRESSED,
LV_STYLE_BUTTON_ON_RELEASED,
LV_STYLE_BUTTON_ON_PRESSED,
LV_STYLE_BUTTON_INACTIVE,
}lv_style_name_t;
......@@ -162,7 +163,6 @@ void lv_style_cpy(lv_style_t * dest, const lv_style_t * src);
*/
void lv_style_anim_create(lv_style_anim_t * anim);
/**********************
* MACROS
**********************/
......
......@@ -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->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;
indic_area.x1 += style_indic->body.padding.horizontal;
indic_area.x2 -= style_indic->body.padding.horizontal;
indic_area.y1 += style_indic->body.padding.vertical;
indic_area.y2 -= style_indic->body.padding.vertical;
cord_t w = area_get_width(&indic_area);
cord_t h = area_get_height(&indic_area);
......
......@@ -65,11 +65,11 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy)
ext->rel_action = NULL;
ext->lpr_action = NULL;
ext->lpr_rep_action = NULL;
ext->styles[LV_BTN_STATE_REL] = lv_style_get(LV_STYLE_BTN_REL, NULL);
ext->styles[LV_BTN_STATE_PR] = lv_style_get(LV_STYLE_BTN_PR, NULL);
ext->styles[LV_BTN_STATE_TREL] = lv_style_get(LV_STYLE_BTN_TREL, NULL);
ext->styles[LV_BTN_STATE_TPR] = lv_style_get(LV_STYLE_BTN_TPR, NULL);
ext->styles[LV_BTN_STATE_INA] = lv_style_get(LV_STYLE_BTN_INA, NULL);
ext->styles[LV_BTN_STATE_REL] = lv_style_get(LV_STYLE_BUTTON_OFF_RELEASED, NULL);
ext->styles[LV_BTN_STATE_PR] = lv_style_get(LV_STYLE_BUTTON_OFF_PRESSED, NULL);
ext->styles[LV_BTN_STATE_TREL] = lv_style_get(LV_STYLE_BUTTON_ON_RELEASED, NULL);
ext->styles[LV_BTN_STATE_TPR] = lv_style_get(LV_STYLE_BUTTON_ON_PRESSED, NULL);
ext->styles[LV_BTN_STATE_INA] = lv_style_get(LV_STYLE_BUTTON_INACTIVE, NULL);
ext->lpr_exec = 0;
ext->tgl = 0;
......
......@@ -74,10 +74,10 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy)
ext->btn_areas = NULL;
ext->cb = NULL;
ext->map_p = NULL;
ext->style_btn_rel = lv_style_get(LV_STYLE_BTN_REL, NULL);
ext->style_btn_pr = lv_style_get(LV_STYLE_BTN_PR, NULL);
ext->style_btn_trel = lv_style_get(LV_STYLE_BTN_TREL, NULL);
ext->style_btn_tpr = lv_style_get(LV_STYLE_BTN_TPR, NULL);
ext->style_btn_rel = lv_style_get(LV_STYLE_BUTTON_OFF_RELEASED, NULL);
ext->style_btn_pr = lv_style_get(LV_STYLE_BUTTON_OFF_PRESSED, NULL);
ext->style_btn_trel = lv_style_get(LV_STYLE_BUTTON_ON_RELEASED, NULL);
ext->style_btn_tpr = lv_style_get(LV_STYLE_BUTTON_ON_PRESSED, NULL);
ext->tgl = 0;
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_btnm);
......@@ -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->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;
cord_t max_w = lv_obj_get_width(btnm) - 2 * btnms->body.padding.horizontal;
cord_t max_h = lv_obj_get_height(btnm) - 2 * btnms->body.padding.vertical;
cord_t act_y = btnms->body.padding.vertical;
/*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->body.pad_obj);
cord_t btn_h = max_h - ((line_cnt - 1) * btnms->body.padding.inner);
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->body.pad_obj);
cord_t all_unit_w = max_w - ((btn_cnt-1) * btnms->body.padding.inner);
/*Set the button size and positions and set the texts*/
uint16_t i;
cord_t act_x = btnms->body.pad_hor;
cord_t act_x = btnms->body.padding.horizontal;
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->body.pad_obj + btnms->body.pad_hor;
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * btnms->body.padding.inner + btnms->body.padding.horizontal;
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->body.pad_obj;
act_y += btn_h + btnms->body.padding.inner;
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->txt.font;
const font_t * font = btn_style->text.font;
point_t txt_size;
txt_get_size(&txt_size, ext->map_p[txt_i], font,
btn_style->txt.space_letter, btn_style->txt.space_line,
btn_style->text.space_letter, btn_style->text.space_line,
area_get_width(&area_btnm), TXT_FLAG_NONE);
area_tmp.x1 += (btn_w - txt_size.x) / 2;
......
......@@ -70,17 +70,17 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
if(copy == NULL) {
ext->bullet = lv_btn_create(new_cb, NULL);
if(ancestor_bullet_design_f == NULL) ancestor_bullet_design_f = lv_obj_get_design_f(ext->bullet);
lv_btn_set_styles(new_cb, lv_style_get(LV_STYLE_TRANSP, NULL), lv_style_get(LV_STYLE_TRANSP, NULL),
lv_style_get(LV_STYLE_TRANSP, NULL), lv_style_get(LV_STYLE_TRANSP, NULL),
lv_style_get(LV_STYLE_TRANSP, NULL));
lv_btn_set_styles(new_cb, lv_style_get(LV_STYLE_TRANSPARENT, NULL), lv_style_get(LV_STYLE_TRANSPARENT, NULL),
lv_style_get(LV_STYLE_TRANSPARENT, NULL), lv_style_get(LV_STYLE_TRANSPARENT, NULL),
lv_style_get(LV_STYLE_TRANSPARENT, NULL));
lv_cont_set_layout(new_cb, LV_CONT_LAYOUT_ROW_M);
lv_cont_set_fit(new_cb, true, true);
lv_btn_set_tgl(new_cb, true);
lv_obj_set_click(ext->bullet, false);
lv_btn_set_styles(ext->bullet, lv_style_get(LV_STYLE_PRETTY, NULL), lv_style_get(LV_STYLE_PRETTY_COLOR, NULL),
lv_style_get(LV_STYLE_BTN_TREL, NULL), lv_style_get(LV_STYLE_BTN_TPR, NULL),
lv_style_get(LV_STYLE_BTN_INA, NULL));
lv_style_get(LV_STYLE_BUTTON_ON_RELEASED, NULL), lv_style_get(LV_STYLE_BUTTON_ON_PRESSED, NULL),
lv_style_get(LV_STYLE_BUTTON_INACTIVE, NULL));
ext->label = lv_label_create(new_cb, NULL);
lv_obj_set_style(ext->label, NULL); /*Inherit the style of the parent*/
......@@ -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->txt.font), font_get_height(style->txt.font));
lv_obj_set_size(ext->bullet, font_get_height(style->text.font), font_get_height(style->text.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->body.empty != 0 || style_page->body.opa == OPA_TRANSP) { /*Background is visible?*/
if(style_page->body.empty != 0 || style_page->opacity == 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);
......
......@@ -477,7 +477,7 @@ 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.body.opa = (uint16_t)((uint16_t)style->body.opa * ext->dl_opa) >> 8;
lines.opacity = (uint16_t)((uint16_t)style->opacity * ext->dl_opa) >> 8;
lines.line.width = ext->dl_width;
/*Go through all data lines*/
......@@ -530,13 +530,13 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
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.opacity = (uint16_t)((uint16_t)style->opacity * 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.body.color_main = dl->color;
style_point.body.color_grad = color_mix(COLOR_BLACK, dl->color, ext->dl_dark);
style_point.body.color_gradient = 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;
......@@ -581,7 +581,7 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
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;
rects.opacity = (uint16_t)((uint16_t)style->opacity * ext->dl_opa) >> 8;
col_a.y2 = chart->cords.y2;
......@@ -595,7 +595,7 @@ 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.body.color_main = dl->color;
rects.body.color_grad = color_mix(COLOR_BLACK, dl->color, ext->dl_dark);
rects.body.color_gradient = 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;
......
......@@ -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 pad_hor_corr;
cord_t hpad_corr;
switch(type) {
case LV_CONT_LAYOUT_COL_L:
pad_hor_corr = style->body.pad_hor;
hpad_corr = style->body.padding.horizontal;
align = LV_ALIGN_IN_TOP_LEFT;
break;
case LV_CONT_LAYOUT_COL_M:
pad_hor_corr = 0;
hpad_corr = 0;
align = LV_ALIGN_IN_TOP_MID;
break;
case LV_CONT_LAYOUT_COL_R:
pad_hor_corr = -style->body.pad_hor;
hpad_corr = -style->body.padding.horizontal;
align = LV_ALIGN_IN_TOP_RIGHT;
break;
default:
pad_hor_corr = 0;
hpad_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->body.pad_ver;
cord_t last_cord = style->body.padding.vertical;
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, pad_hor_corr , last_cord);
last_cord += lv_obj_get_height(child) + style->body.pad_obj;
lv_obj_align(child, cont, align, hpad_corr , last_cord);
last_cord += lv_obj_get_height(child) + style->body.padding.inner;
}
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 pad_ver_corr = style->body.pad_ver;
cord_t vpad_corr = style->body.padding.vertical;
switch(type) {
case LV_CONT_LAYOUT_ROW_T:
pad_ver_corr = style->body.pad_ver;
vpad_corr = style->body.padding.vertical;
align = LV_ALIGN_IN_TOP_LEFT;
break;
case LV_CONT_LAYOUT_ROW_M:
pad_ver_corr = 0;
vpad_corr = 0;
align = LV_ALIGN_IN_LEFT_MID;
break;
case LV_CONT_LAYOUT_ROW_B:
pad_ver_corr = -style->body.pad_ver;
vpad_corr = -style->body.padding.vertical;
align = LV_ALIGN_IN_BOTTOM_LEFT;
break;
default:
pad_ver_corr = 0;
vpad_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->body.pad_hor;
cord_t last_cord = style->body.padding.horizontal;
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, pad_ver_corr);
last_cord += lv_obj_get_width(child) + style->body.pad_obj;
lv_obj_align(child, cont, align, last_cord, vpad_corr);
last_cord += lv_obj_get_width(child) + style->body.padding.inner;
}
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->body.pad_obj;
h_tot += lv_obj_get_height(child) + style->body.padding.inner;
obj_num ++;
}
if(obj_num == 0) return;
h_tot -= style->body.pad_obj;
h_tot -= style->body.padding.inner;
/* 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->body.pad_obj;
last_cord += lv_obj_get_height(child) + style->body.padding.inner;
}
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->body.pad_ver;
cord_t act_y = style->body.padding.vertical;
/* 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->body.pad_hor * 2; /*The width is at least the left+right hpad*/
cord_t w_row = style->body.padding.horizontal * 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->body.pad_obj; /*Add the object width + opad*/
w_row += lv_obj_get_width(child_rc) + style->body.padding.inner; /*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->body.pad_obj * obj_num;
w_row -= style->body.padding.inner * obj_num;
cord_t new_opad = (w_obj - w_row) / (obj_num - 1);
cord_t act_x = style->body.pad_hor; /*x init*/
cord_t act_x = style->body.padding.horizontal; /*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->body.pad_obj + h_row; /*y increment*/
act_y += style->body.padding.inner + 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->body.pad_hor)) / (w_obj + style->body.pad_obj); /*Obj. num. in a row*/
uint16_t obj_row = (w_tot - (2 * style->body.padding.horizontal)) / (w_obj + style->body.padding.inner); /*Obj. num. in a row*/
cord_t x_ofs;
if(obj_row > 1) {
x_ofs = w_obj + (w_tot - (2 * style->body.pad_hor) - (obj_row * w_obj)) / (obj_row - 1);
x_ofs = w_obj + (w_tot - (2 * style->body.padding.horizontal) - (obj_row * w_obj)) / (obj_row - 1);
} else {
x_ofs = w_tot / 2 - w_obj / 2;
}
cord_t y_ofs = h_obj + style->body.pad_obj;
cord_t y_ofs = h_obj + style->body.padding.inner;
/* 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->body.pad_hor;
cord_t act_y = style->body.pad_ver;
cord_t act_x = style->body.padding.horizontal;
cord_t act_y = style->body.padding.vertical;
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->body.pad_hor;
act_x = style->body.padding.horizontal;
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->body.pad_hor;
cord_t vpad = style->body.pad_ver;
cord_t hpad = style->body.padding.horizontal;
cord_t vpad = style->body.padding.vertical;
/*Search the side coordinates of the children*/
lv_obj_get_cords(cont, &ori);
......
......@@ -86,7 +86,7 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
if(copy == NULL) {
lv_obj_t * scrl = lv_page_get_scrl(new_ddlist);
lv_obj_set_drag(scrl, false);
lv_obj_set_style(scrl, lv_style_get(LV_STYLE_TRANSP, NULL));
lv_obj_set_style(scrl, lv_style_get(LV_STYLE_TRANSPARENT, NULL));
lv_cont_set_fit(scrl, true, true);
ext->opt_label = lv_label_create(new_ddlist, NULL);
......@@ -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->txt.font;
const font_t * font = style->text.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->txt.space_line);
rect_area.y1 -= style->txt.space_line / 2;
rect_area.y1 += ext->sel_opt * (font_h + style->text.space_line);
rect_area.y1 -= style->text.space_line / 2;
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.y2 = rect_area.y1 + font_h + style->text.space_line;
rect_area.x1 = ext->opt_label->cords.x1 - style->body.padding.horizontal;
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->body.pad_ver;
if(ext->fix_height == 0) new_height = lv_obj_get_height(lv_page_get_scrl(ddlist)) + 2 * style->body.padding.vertical;
else new_height = ext->fix_height;
} else { /*Close the list*/
const font_t * font = style->txt.font;
const font_t * font = style->text.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->txt.space_line;
new_height = font_h + 2 * label_style->text.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->txt.font;
const font_t * font = style->text.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->txt.space_line) + ext->opt_label->cords.y1 - scrl->cords.y1;
cord_t line_y1 = ext->sel_opt * (font_h + label_style->text.space_line) + ext->opt_label->cords.y1 - scrl->cords.y1;
lv_obj_set_y(scrl, - line_y1 + (h - font_h) / 2);
......
......@@ -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.txt.color = color_mix(style_critical->txt.color, style_base->txt.color, ratio);
style_bg.text.color = color_mix(style_critical->text.color, style_base->text.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.body.color_gradient = color_mix(style_critical->body.color_gradient, style_base->body.color_gradient, 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;
style_bg.opacity = (cord_t)(((uint16_t)style_critical->opacity * ratio) + ((uint16_t)style_base->opacity * (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->body.pad_hor;
cord_t r = lv_obj_get_width(gauge) / 2 - style->body.padding.horizontal;
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->txt.font,
style->txt.space_letter, style->txt.space_line,
txt_get_size(&label_size, scale_txt, style->text.font,
style->text.space_letter, style->text.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->body.pad_obj;
cord_t r = lv_obj_get_width(gauge) / 2 - style->body.padding.inner;
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);
......@@ -446,14 +446,14 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style
lv_style_t style_neddle_mid;
lv_style_get(LV_STYLE_PLAIN, &style_neddle_mid);
style_neddle_mid.body.color_main = style->border.color;
style_neddle_mid.body.color_grad = style->border.color;
style_neddle_mid.body.color_gradient = style->border.color;
style_neddle_mid.body.radius = LV_RADIUS_CIRCLE;
area_t nm_cord;
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;
nm_cord.x1 = x_ofs - style->body.padding.inner;
nm_cord.y1 = y_ofs - style->body.padding.inner;
nm_cord.x2 = x_ofs + style->body.padding.inner;
nm_cord.y2 = y_ofs + style->body.padding.inner;
lv_draw_rect(&nm_cord, mask, &style_neddle_mid);
}
......
......@@ -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->txt.font, style->txt.space_letter, style->txt.space_line, CORD_MAX, TXT_FLAG_NONE);
txt_get_size(&size, fn, style->text.font, style->text.space_letter, style->text.space_line, CORD_MAX, TXT_FLAG_NONE);
ext->w = size.x;
ext->h = size.y;
ext->transp = 1; /*Symbols always have transparent parts*/
......
......@@ -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->txt.font;
const font_t * font = style->text.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->txt.space_letter, max_w, flag);
new_line_start += txt_get_next_line(&txt[line_start], font, style->text.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->txt.space_line;
y += letter_height + style->text.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->txt.space_line;
y += letter_height + style->text.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->txt.space_letter;
x += (font_get_width(font, letter) >> FONT_ANTIALIAS) + style->text.space_letter;
}
if(style->txt.align == LV_TXT_ALIGN_MID) {
if(style->text.align == LV_TXT_ALIGN_MID) {
cord_t line_w;
line_w = txt_get_width(&txt[line_start], new_line_start - line_start,
font, style->txt.space_letter, flag);
font, style->text.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->txt.font;
const font_t * font = style->text.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->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;
new_line_start += txt_get_next_line(&txt[line_start], font, style->text.space_letter, max_w, flag);
if(pos->y <= y + letter_height + style->text.space_line) break; /*The line is found ('line_start')*/
y += letter_height + style->text.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->text.align == LV_TXT_ALIGN_MID) {
cord_t line_w;
line_w = txt_get_width(&txt[line_start], new_line_start - line_start,
font, style->txt.space_letter, flag);
font, style->text.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->txt.space_letter;
x += (font_get_width(font, letter) >> FONT_ANTIALIAS) + style->text.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->txt.font;
const font_t * font = style->text.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->txt.space_letter, style->txt.space_line, max_w, flag);
txt_get_size(&size, ext->txt, font, style->text.space_letter, style->text.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) {
......
......@@ -202,7 +202,7 @@ static bool lv_led_design(lv_obj_t * led, const area_t * mask, lv_design_mode_t
/*Mix. the color with black proportionally with brightness*/
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.body.color_gradient = color_mix(leds_tmp.body.color_gradient, 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*/
......
......@@ -68,11 +68,11 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
ext->sb_out = 0;
ext->style_img = NULL;
ext->styles_btn[LV_BTN_STATE_REL] = lv_style_get(LV_STYLE_BTN_REL, NULL);
ext->styles_btn[LV_BTN_STATE_PR] = lv_style_get(LV_STYLE_BTN_PR, NULL);
ext->styles_btn[LV_BTN_STATE_TREL] = lv_style_get(LV_STYLE_BTN_TREL, NULL);
ext->styles_btn[LV_BTN_STATE_PR] = lv_style_get(LV_STYLE_BTN_TPR, NULL);
ext->styles_btn[LV_BTN_STATE_INA] = lv_style_get(LV_STYLE_BTN_INA, NULL);
ext->styles_btn[LV_BTN_STATE_REL] = lv_style_get(LV_STYLE_BUTTON_ON_RELEASED, NULL);
ext->styles_btn[LV_BTN_STATE_PR] = lv_style_get(LV_STYLE_BUTTON_ON_PRESSED, NULL);
ext->styles_btn[LV_BTN_STATE_TREL] = lv_style_get(LV_STYLE_BUTTON_ON_RELEASED, NULL);
ext->styles_btn[LV_BTN_STATE_PR] = lv_style_get(LV_STYLE_BUTTON_ON_PRESSED, NULL);
ext->styles_btn[LV_BTN_STATE_INA] = lv_style_get(LV_STYLE_BUTTON_INACTIVE, NULL);
lv_obj_set_signal_f(new_list, lv_list_signal);
......@@ -80,7 +80,7 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
if(copy == NULL) {
lv_obj_set_size(new_list, 2 * LV_DPI, 3 * LV_DPI);
lv_cont_set_layout(ext->page.scrl, LV_LIST_LAYOUT_DEF);
lv_obj_set_style(new_list, lv_style_get(LV_STYLE_TRANSP_TIGHT, NULL));
lv_obj_set_style(new_list, lv_style_get(LV_STYLE_TRANSPARENT_TIGHT, NULL));
lv_obj_set_style(lv_page_get_scrl(new_list), lv_style_get(LV_STYLE_PRETTY, NULL));
lv_page_set_sb_mode(new_list, LV_PAGE_SB_MODE_AUTO);
} else {
......@@ -225,7 +225,7 @@ 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 pad_hor_tot = style->body.pad_hor + style_scrl->body.pad_hor;
cord_t pad_hor_tot = style->body.padding.horizontal + style_scrl->body.padding.horizontal;
w -= pad_hor_tot * 2;
/*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
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->body.pad_hor;
cord_t r_in =r_out - style->body.padding.horizontal;
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;
......@@ -217,7 +217,7 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const area_t * mask, lv_design_m
if(i > level) style_tmp.line.color = style->line.color;
else {
style_tmp.line.color = color_mix(style->body.color_grad, style->body.color_main, (255 * i) / ext->scale_num);
style_tmp.line.color = color_mix(style->body.color_gradient, style->body.color_main, (255 * i) / ext->scale_num);
}
lv_draw_line(&p1, &p2, mask, &style_tmp);
......
......@@ -65,8 +65,8 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy)
dm_assert(ext);
ext->txt = NULL;
ext->btnh = NULL;
ext->style_btn_rel = lv_style_get(LV_STYLE_BTN_REL, NULL);
ext->style_btn_pr = lv_style_get(LV_STYLE_BTN_PR, NULL);
ext->style_btn_rel = lv_style_get(LV_STYLE_BUTTON_ON_RELEASED, NULL);
ext->style_btn_pr = lv_style_get(LV_STYLE_BUTTON_ON_PRESSED, NULL);
ext->anim_close_time = LV_MBOX_CLOSE_ANIM_TIME;
/*The signal and design functions are not copied so set them here*/
......@@ -267,7 +267,7 @@ lv_obj_t * lv_mbox_add_btn(lv_obj_t * mbox, const char * btn_txt, lv_action_t re
/*Create a button if it is not existed yet*/
if(ext->btnh == NULL) {
ext->btnh = lv_cont_create(mbox, NULL);
lv_obj_set_style(ext->btnh, lv_style_get(LV_STYLE_TRANSP, NULL));
lv_obj_set_style(ext->btnh, lv_style_get(LV_STYLE_TRANSPARENT, NULL));
lv_obj_set_click(ext->btnh, false);
lv_cont_set_fit(ext->btnh, false, true);
lv_cont_set_layout(ext->btnh, LV_CONT_LAYOUT_PRETTY);
......
......@@ -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->body.pad_hor);
lv_page_set_sb_width(new_page, style->body.padding.horizontal);
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->body.pad_hor);
lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.padding.horizontal);
} 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->body.pad_hor);
lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.padding.horizontal);
}
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->body.pad_hor);
lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * page_style->body.padding.horizontal);
}
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->body.pad_hor;
cord_t vpad = page_style->body.pad_ver;
cord_t hpad = page_style->body.padding.horizontal;
cord_t vpad = page_style->body.padding.vertical;
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->body.pad_hor);
cord_t sbv_pad = MATH_MAX(page_ext->sb_width, page_style->body.pad_ver);
cord_t sbh_pad = MATH_MAX(page_ext->sb_width, page_style->body.padding.horizontal);
cord_t sbv_pad = MATH_MAX(page_ext->sb_width, page_style->body.padding.vertical);
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->body.pad_ver - style->body.pad_ver);
scrlable_y += style_scrl->body.pad_ver;
scrlable_y = -(obj_y - style_scrl->body.padding.vertical - style->body.padding.vertical);
scrlable_y += style_scrl->body.padding.vertical;
}
/*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->body.pad_ver;
scrlable_y -= style_scrl->body.padding.vertical;
} 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->body.empty != 0 || style_page->body.opa == OPA_TRANSP) { /*Background is visible?*/
if(style_page->body.empty != 0 || style_page->opacity == 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->body.pad_hor;
cord_t vpad = style->body.pad_ver;
cord_t hpad = style->body.padding.horizontal;
cord_t vpad = style->body.padding.vertical;
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->body.pad_hor);
cord_t sbv_pad = MATH_MAX(ext->sb_width, style->body.pad_ver);
cord_t sbh_pad = MATH_MAX(ext->sb_width, style->body.padding.horizontal);
cord_t sbv_pad = MATH_MAX(ext->sb_width, style->body.padding.vertical);
if(ext->sb_mode == LV_PAGE_SB_MODE_OFF) return;
......
......@@ -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->txt.font) >> FONT_ANTIALIAS) * 3
+ style_label->txt.space_line * 4);
lv_ddlist_set_fix_height(new_roller, (font_get_height(style_label->text.font) >> FONT_ANTIALIAS) * 3
+ style_label->text.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->txt.font;
const font_t * font = style->text.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->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.y1 = roller->cords.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.x1 = ext->ddlist.opt_label->cords.x1 - style->body.padding.horizontal;
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->txt.font;
const font_t * font = style_label->text.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->txt.font) >> FONT_ANTIALIAS) + style_label->txt.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->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->txt.space_line);
id = p.y / (font_h + style_label->text.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->txt.space_line) + ext->ddlist.opt_label->cords.y1 - roller_scrl->cords.y1;
cord_t line_y1 = id * (font_h + style_label->text.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) {
......
......@@ -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->body.pad_hor, style->body.pad_ver);
cord_t pad = MATH_MIN(style->body.padding.horizontal, style->body.padding.vertical);
if(pad < 0) {
pad = -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
area_t area_bar;
area_cpy(&area_bar, &slider->cords);
/*Be sure at least vpad/hpad width bar will remain*/
cord_t pad_ver_bar = style_slider->body.pad_ver;
cord_t pad_hor_bar = style_slider->body.pad_hor;
cord_t pad_ver_bar = style_slider->body.padding.vertical;
cord_t pad_hor_bar = style_slider->body.padding.horizontal;
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;
}
......@@ -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);
/*Be sure at least vpad/hpad width indicator will remain*/
cord_t pad_ver_indic = style_indic->body.pad_ver;
cord_t pad_hor_indic = style_indic->body.pad_hor;
cord_t pad_ver_indic = style_indic->body.padding.vertical;
cord_t pad_hor_indic = style_indic->body.padding.horizontal;
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;
}
......
......@@ -105,7 +105,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, lv_obj_t * copy)
lv_cont_set_fit(ext->content, true, false);
lv_cont_set_layout(ext->content, LV_CONT_LAYOUT_ROW_T);
lv_obj_set_height(ext->content, LV_VER_RES);
lv_obj_set_style(ext->content, lv_style_get(LV_STYLE_TRANSP_TIGHT, NULL));
lv_obj_set_style(ext->content, lv_style_get(LV_STYLE_TRANSPARENT_TIGHT, NULL));
lv_obj_align(ext->content, ext->tabs, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
}
/*Copy an existing tab*/
......@@ -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->body.pad_obj * (ext->tab_cnt - 1) - 2 * style_tabs->body.pad_hor) / 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.horizontal) / ext->tab_cnt;
lv_obj_set_width(ext->indic, indic_width);
lv_obj_set_x(ext->indic, indic_width * ext->tab_act + style_tabs->body.pad_obj * ext->tab_act + style_tabs->body.pad_hor);
lv_obj_set_x(ext->indic, indic_width * ext->tab_act + style_tabs->body.padding.inner * ext->tab_act + style_tabs->body.padding.horizontal);
/*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->body.pad_obj * id + style->body.pad_hor);
cord_t cont_x = -(lv_obj_get_width(tabview) * id + style->body.padding.inner * id + style->body.padding.horizontal);
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->body.pad_obj * id + tabs_style->body.pad_hor;
cord_t indic_x = indic_width * id + tabs_style->body.padding.inner * id + tabs_style->body.padding.horizontal;
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->body.pad_obj * (ext->tab_cnt - 1) -
2 * style_tabs->body.pad_hor) / 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.horizontal) / 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->body.pad_obj)) / lv_obj_get_width(tabview);
cord_t p = ((tabpage->cords.x1 - tabview->cords.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.pad_obj * ext->tab_act + indic_style->body.pad_hor - p);
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);
}
}
......
......@@ -63,8 +63,8 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
ext->header = NULL;
ext->title = NULL;
ext->style_header = lv_style_get(LV_STYLE_PLAIN_COLOR, NULL);
ext->style_cbtn_rel = lv_style_get(LV_STYLE_BTN_REL, NULL);
ext->style_cbtn_pr = lv_style_get(LV_STYLE_BTN_PR, NULL);
ext->style_cbtn_rel = lv_style_get(LV_STYLE_BUTTON_ON_RELEASED, NULL);
ext->style_cbtn_pr = lv_style_get(LV_STYLE_BUTTON_ON_PRESSED, NULL);
ext->cbtn_size = ( LV_DPI) / 2;
/*Init the new window object*/
......@@ -80,7 +80,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * scrl = lv_page_get_scrl(ext->page);
lv_cont_set_fit(scrl, false, true);
lv_obj_set_style(scrl, lv_style_get(LV_STYLE_TRANSP, NULL));
lv_obj_set_style(scrl, lv_style_get(LV_STYLE_TRANSPARENT, NULL));
/*Create a holder for the header*/
ext->header = lv_cont_create(new_win, NULL);
......@@ -97,7 +97,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
/*Create a holder for the control buttons*/
ext->btnh = lv_cont_create(ext->header, NULL);
lv_cont_set_fit(ext->btnh, true, false);
lv_obj_set_style(ext->btnh, lv_style_get(LV_STYLE_TRANSP_TIGHT, NULL));
lv_obj_set_style(ext->btnh, lv_style_get(LV_STYLE_TRANSPARENT_TIGHT, NULL));
lv_cont_set_layout(ext->btnh, LV_CONT_LAYOUT_ROW_M);
lv_obj_set_signal_f(new_win, lv_win_signal);
......@@ -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->body.pad_hor;
return lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.horizontal;
}
/**
......@@ -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->body.pad_ver * 2);
lv_obj_set_height(ext->btnh, ext->cbtn_size + 2 * btnh_style->body.padding.vertical * 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->body.pad_hor, 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.padding.horizontal, 0);
lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.padding.horizontal, 0);
} else {
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_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.padding.horizontal, 0);
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.horizontal, 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->body.pad_hor);
lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * style_page->body.padding.horizontal);
}
#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