refactoring: class->style, style_dsc->style_list

This commit is contained in:
Gabor Kiss-Vamosi
2020-01-16 14:26:36 +01:00
parent 8d6a5ac776
commit 805af47113
47 changed files with 355 additions and 379 deletions

View File

@@ -51,7 +51,7 @@ typedef struct _lv_event_temp_data
typedef struct { typedef struct {
lv_draw_rect_dsc_t draw_dsc; lv_draw_rect_dsc_t draw_dsc;
lv_style_dsc_t * style_dsc; lv_style_list_t * style_dsc;
uint8_t state; uint8_t state;
}lv_draw_rect_cache_t; }lv_draw_rect_cache_t;
@@ -282,7 +282,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
new_obj->ext_attr = NULL; new_obj->ext_attr = NULL;
lv_style_dsc_init(&new_obj->style_dsc); lv_style_list_init(&new_obj->style_dsc);
if(parent != NULL) { if(parent != NULL) {
lv_obj_add_style_class(new_obj, LV_OBJ_PART_MAIN, _t(PANEL)); lv_obj_add_style_class(new_obj, LV_OBJ_PART_MAIN, _t(PANEL));
@@ -1183,29 +1183,29 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right
void lv_obj_set_style_color(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_color_t color) void lv_obj_set_style_color(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_color_t color)
{ {
lv_style_dsc_t * style_dsc = lv_obj_get_style(obj, part); lv_style_list_t * style_dsc = lv_obj_get_style(obj, part);
lv_style_set_color(&style_dsc->local, prop, color); lv_style_list_set_local_color(style_dsc, prop, color);
lv_obj_refresh_style(obj); lv_obj_refresh_style(obj);
} }
void lv_obj_set_style_int(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_int_t value) void lv_obj_set_style_int(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_int_t value)
{ {
lv_style_dsc_t * style_dsc = lv_obj_get_style(obj, part); lv_style_list_t * style_dsc = lv_obj_get_style(obj, part);
lv_style_set_int(&style_dsc->local, prop, value); lv_style_list_set_local_int(style_dsc, prop, value);
lv_obj_refresh_style(obj); lv_obj_refresh_style(obj);
} }
void lv_obj_set_style_opa(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_opa_t opa) void lv_obj_set_style_opa(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_opa_t opa)
{ {
lv_style_dsc_t * style_dsc = lv_obj_get_style(obj, part); lv_style_list_t * style_dsc = lv_obj_get_style(obj, part);
lv_style_set_opa(&style_dsc->local, prop, opa); lv_style_list_set_local_opa(style_dsc, prop, opa);
lv_obj_refresh_style(obj); lv_obj_refresh_style(obj);
} }
void lv_obj_set_style_ptr(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, void * p) void lv_obj_set_style_ptr(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, void * p)
{ {
lv_style_dsc_t * style_dsc = lv_obj_get_style(obj, part); lv_style_list_t * style_dsc = lv_obj_get_style(obj, part);
lv_style_set_ptr(&style_dsc->local, prop, p); lv_style_list_set_local_ptr(style_dsc, prop, p);
lv_obj_refresh_style(obj); lv_obj_refresh_style(obj);
} }
@@ -1213,26 +1213,26 @@ void lv_obj_add_style_class(lv_obj_t * obj, uint8_t part, lv_style_t * style)
{ {
if(style == NULL) return; if(style == NULL) return;
lv_style_dsc_t * style_dsc = lv_obj_get_style(obj, part); lv_style_list_t * style_dsc = lv_obj_get_style(obj, part);
if(style_dsc == NULL) { if(style_dsc == NULL) {
LV_LOG_WARN("lv_obj_add_style_class: can't find style with `type`"); LV_LOG_WARN("lv_obj_add_style_class: can't find style with `type`");
return; return;
} }
lv_style_dsc_add_class(style_dsc, style); lv_style_list_add_style(style_dsc, style);
lv_obj_refresh_style(obj); lv_obj_refresh_style(obj);
} }
void lv_obj_reset_style(lv_obj_t * obj, uint8_t part) void lv_obj_reset_style(lv_obj_t * obj, uint8_t part)
{ {
lv_style_dsc_t * style_dsc = lv_obj_get_style(obj, part); lv_style_list_t * style_dsc = lv_obj_get_style(obj, part);
if(style_dsc == NULL) { if(style_dsc == NULL) {
LV_LOG_WARN("lv_obj_clean_styles: can't find style with `part`"); LV_LOG_WARN("lv_obj_clean_styles: can't find style with `part`");
return; return;
} }
lv_style_dsc_reset(style_dsc); lv_style_list_reset(style_dsc);
lv_obj_refresh_style(obj); lv_obj_refresh_style(obj);
} }
@@ -2058,7 +2058,7 @@ lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj)
* Appearance get * Appearance get
*---------------*/ *---------------*/
lv_style_dsc_t * lv_obj_get_style(const lv_obj_t * obj, uint8_t part) lv_style_list_t * lv_obj_get_style(const lv_obj_t * obj, uint8_t part)
{ {
if(part == LV_OBJ_PART_MAIN) return &obj->style_dsc; if(part == LV_OBJ_PART_MAIN) return &obj->style_dsc;
@@ -2858,19 +2858,12 @@ static void report_style_mod_core(void * style, lv_obj_t * obj)
{ {
uint8_t part_sub; uint8_t part_sub;
for(part_sub = 0; part_sub != _LV_OBJ_PART_ALL; part_sub++) { for(part_sub = 0; part_sub != _LV_OBJ_PART_ALL; part_sub++) {
lv_style_dsc_t * dsc = lv_obj_get_style(obj, part_sub); lv_style_list_t * dsc = lv_obj_get_style(obj, part_sub);
if(dsc == NULL) break; if(dsc == NULL) break;
if(&dsc->local == style) { uint8_t ci;
lv_obj_refresh_style(obj); for(ci = 0; ci < dsc->style_cnt; ci++) {
/* Two local style can't have the same pointer lv_style_t * class = lv_style_list_get_style(dsc, ci);
* so there won't be an other match*/
return;
}
uint8_t ci;
for(ci = 0; ci < dsc->class_cnt; ci++) {
lv_style_t * class = lv_style_dsc_get_class(dsc, ci);
if(class == style) { if(class == style) {
lv_obj_refresh_style(obj); lv_obj_refresh_style(obj);
/*It's enough to handle once (if duplicated)*/ /*It's enough to handle once (if duplicated)*/
@@ -3028,12 +3021,12 @@ static lv_style_int_t lv_obj_get_style_int_core(const lv_obj_t * obj, uint8_t pa
lv_res_t res = LV_RES_INV; lv_res_t res = LV_RES_INV;
const lv_obj_t * parent = obj; const lv_obj_t * parent = obj;
while(parent) { while(parent) {
lv_style_dsc_t * dsc = lv_obj_get_style(parent, part); lv_style_list_t * dsc = lv_obj_get_style(parent, part);
uint8_t state = lv_obj_get_state(parent, part); uint8_t state = lv_obj_get_state(parent, part);
prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS); prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
res = lv_style_dsc_get_int(dsc, prop, &value); res = lv_style_list_get_int(dsc, prop, &value);
if(res == LV_RES_OK) return value; if(res == LV_RES_OK) return value;
if(attr.bits.inherit == 0) break; if(attr.bits.inherit == 0) break;
@@ -3075,12 +3068,12 @@ static lv_color_t lv_obj_get_style_color_core(const lv_obj_t * obj, uint8_t part
lv_res_t res = LV_RES_INV; lv_res_t res = LV_RES_INV;
const lv_obj_t * parent = obj; const lv_obj_t * parent = obj;
while(parent) { while(parent) {
lv_style_dsc_t * dsc = lv_obj_get_style(parent, part); lv_style_list_t * dsc = lv_obj_get_style(parent, part);
uint8_t state = lv_obj_get_state(parent, part); uint8_t state = lv_obj_get_state(parent, part);
prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS); prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
res = lv_style_dsc_get_color(dsc, prop, &value); res = lv_style_list_get_color(dsc, prop, &value);
if(res == LV_RES_OK) return value; if(res == LV_RES_OK) return value;
if(attr.bits.inherit == 0) break; if(attr.bits.inherit == 0) break;
@@ -3118,12 +3111,12 @@ static lv_opa_t lv_obj_get_style_opa_core(const lv_obj_t * obj, uint8_t part, lv
lv_res_t res = LV_RES_INV; lv_res_t res = LV_RES_INV;
const lv_obj_t * parent = obj; const lv_obj_t * parent = obj;
while(parent) { while(parent) {
lv_style_dsc_t * dsc = lv_obj_get_style(parent, part); lv_style_list_t * dsc = lv_obj_get_style(parent, part);
uint8_t state = lv_obj_get_state(parent, part); uint8_t state = lv_obj_get_state(parent, part);
prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS); prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
res = lv_style_dsc_get_opa(dsc, prop, &value); res = lv_style_list_get_opa(dsc, prop, &value);
if(res == LV_RES_OK) return value; if(res == LV_RES_OK) return value;
if(attr.bits.inherit == 0) break; if(attr.bits.inherit == 0) break;
@@ -3163,12 +3156,12 @@ static const void * lv_obj_get_style_ptr_core(const lv_obj_t * obj, uint8_t part
lv_res_t res = LV_RES_INV; lv_res_t res = LV_RES_INV;
const lv_obj_t * parent = obj; const lv_obj_t * parent = obj;
while(parent) { while(parent) {
lv_style_dsc_t * dsc = lv_obj_get_style(parent, part); lv_style_list_t * dsc = lv_obj_get_style(parent, part);
uint8_t state = lv_obj_get_state(parent, part); uint8_t state = lv_obj_get_state(parent, part);
prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS); prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
res = lv_style_dsc_get_ptr(dsc, prop, &value); res = lv_style_list_get_ptr(dsc, prop, &value);
if(res == LV_RES_OK) return value; if(res == LV_RES_OK) return value;
if(attr.bits.inherit == 0) break; if(attr.bits.inherit == 0) break;

View File

@@ -223,7 +223,7 @@ typedef struct _lv_obj_t
lv_design_cb_t design_cb; /**< Object type specific design function*/ lv_design_cb_t design_cb; /**< Object type specific design function*/
void * ext_attr; /**< Object type specific extended data*/ void * ext_attr; /**< Object type specific extended data*/
lv_style_dsc_t style_dsc; lv_style_list_t style_dsc;
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY #if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY
@@ -294,7 +294,7 @@ typedef struct
typedef struct typedef struct
{ {
uint8_t part; uint8_t part;
lv_style_dsc_t * result; lv_style_list_t * result;
} lv_get_style_info_t; } lv_get_style_info_t;
typedef struct typedef struct
@@ -865,7 +865,7 @@ lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj);
* Appearance get * Appearance get
*---------------*/ *---------------*/
lv_style_dsc_t * lv_obj_get_style(const lv_obj_t * obj, uint8_t type); lv_style_list_t * lv_obj_get_style(const lv_obj_t * obj, uint8_t type);
lv_style_int_t lv_obj_get_style_int(lv_obj_t * obj, uint8_t type, lv_style_property_t prop); lv_style_int_t lv_obj_get_style_int(lv_obj_t * obj, uint8_t type, lv_style_property_t prop);

View File

@@ -36,6 +36,7 @@
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop); static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop);
static lv_style_t * get_local_style(lv_style_list_t * list);
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
static void style_animator(lv_style_anim_dsc_t * dsc, lv_anim_value_t val); static void style_animator(lv_style_anim_dsc_t * dsc, lv_anim_value_t val);
static void style_animation_common_end_cb(lv_anim_t * a); static void style_animation_common_end_cb(lv_anim_t * a);
@@ -60,16 +61,7 @@ static void style_animation_common_end_cb(lv_anim_t * a);
void lv_style_built_in_init(void) void lv_style_built_in_init(void)
{ {
// lv_style_init(&lv_style_transp_tight);
// lv_style_set_opa(&lv_style_transp_tight, LV_STYLE_BG_OPA, LV_OPA_TRANSP);
// lv_style_set_opa(&lv_style_transp_tight, LV_STYLE_BORDER_OPA, LV_OPA_TRANSP);
// lv_style_set_opa(&lv_style_transp_tight, LV_STYLE_SHADOW_OPA, LV_OPA_TRANSP);
// lv_style_set_opa(&lv_style_transp_tight, LV_STYLE_PATTERN_OPA, LV_OPA_TRANSP);
// lv_style_set_int(&lv_style_transp_tight, LV_STYLE_PAD_LEFT, 0);
// lv_style_set_int(&lv_style_transp_tight, LV_STYLE_PAD_RIGHT, 0);
// lv_style_set_int(&lv_style_transp_tight, LV_STYLE_PAD_TOP, 0);
// lv_style_set_int(&lv_style_transp_tight, LV_STYLE_PAD_BOTTOM, 0);
// lv_style_set_int(&lv_style_transp_tight, LV_STYLE_PAD_INNER, 0);
} }
void lv_style_init(lv_style_t * style) void lv_style_init(lv_style_t * style)
@@ -86,74 +78,92 @@ void lv_style_copy(lv_style_t * style_dest, const lv_style_t * style_src)
style_dest->size = style_src->size; style_dest->size = style_src->size;
} }
void lv_style_dsc_init(lv_style_dsc_t * style_dsc) void lv_style_list_init(lv_style_list_t * list)
{ {
lv_style_init(&style_dsc->local); list->style_list = NULL;
style_dsc->classes = NULL; list->style_cnt = 0;
style_dsc->class_cnt = 0; list->has_local = 0;
} }
void lv_style_dsc_add_class(lv_style_dsc_t * dsc, lv_style_t * class) void lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style)
{ {
/* Do not allocate memory for the first class. /*Remove the style first if already exists*/
* It can be simply stored as a pointer.*/ lv_style_list_remove_style(list, style);
if(dsc->class_cnt == 0) {
dsc->classes = (lv_style_t**)class;
dsc->class_cnt = 1;
} else {
lv_style_t ** new_classes; lv_style_t ** new_classes;
if(dsc->class_cnt == 1) new_classes = lv_mem_alloc(sizeof(lv_style_t *) * (dsc->class_cnt + 1)); if(list->style_cnt == 0) new_classes = lv_mem_alloc(sizeof(lv_style_t *));
else new_classes = lv_mem_realloc(dsc->classes, sizeof(lv_style_t *) * (dsc->class_cnt + 1)); else new_classes = lv_mem_realloc(list->style_list, sizeof(lv_style_t *) * (list->style_cnt + 1));
LV_ASSERT_MEM(new_classes); LV_ASSERT_MEM(new_classes);
if(new_classes == NULL) { if(new_classes == NULL) {
LV_LOG_WARN("lv_style_dsc_add_class: couldn't add the class"); LV_LOG_WARN("lv_style_list_add_style: couldn't add the class");
return; return;
}
if(dsc->class_cnt == 1) new_classes[0] = (lv_style_t*)dsc->classes;
new_classes[dsc->class_cnt] = class;
dsc->class_cnt++;
dsc->classes = new_classes;
} }
}
void lv_style_dsc_remove_class(lv_style_dsc_t * dsc, lv_style_t * class) /*Make space for the new style at the beginning. Leave local style if exists*/
{ uint8_t i;
if(dsc->class_cnt == 0) return; uint8_t first_style = list->has_local ? 1 : 0;
if(dsc->class_cnt == 1) { for(i = list->style_cnt; i > first_style; i--) {
if((lv_style_t*)dsc->classes == class) { new_classes[i] = new_classes[i - 1];
dsc->classes = NULL;
dsc->class_cnt = 0;
}
} else {
lv_style_t ** new_classes = lv_mem_realloc(dsc->classes, sizeof(lv_style_t *) * (dsc->class_cnt - 1));
LV_ASSERT_MEM(new_classes);
if(new_classes == NULL) {
LV_LOG_WARN("lv_style_dsc_remove_class: couldn't remove the class");
return;
}
uint8_t i,j;
for(i = 0, j = 0; i < dsc->class_cnt; i++) {
if(dsc->classes[i] == class) continue;
new_classes[j] = dsc->classes[i];
j++;
}
dsc->class_cnt--;
dsc->classes = new_classes;
} }
new_classes[first_style] = style;
list->style_cnt++;
list->style_list = new_classes;
} }
void lv_style_dsc_reset(lv_style_dsc_t * style_dsc) void lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style)
{ {
if(style_dsc->class_cnt > 1) lv_mem_free(style_dsc->classes); if(list->style_cnt == 0) return;
style_dsc->classes = NULL;
style_dsc->class_cnt = 0; /*Check if the style really exists here*/
lv_style_reset(&style_dsc->local); uint8_t i;
bool found = false;
for(i = 0; i < list->style_cnt; i++) {
if(list->style_list[i] == style) {
found = true;
break;
}
}
if(found == false) return;
if(list->style_cnt == 1) {
lv_mem_free(list->style_list);
list->style_list = NULL;
list->style_cnt = 0;
list->has_local = 0;
return;
}
lv_style_t ** new_classes = lv_mem_realloc(list->style_list, sizeof(lv_style_t *) * (list->style_cnt - 1));
LV_ASSERT_MEM(new_classes);
if(new_classes == NULL) {
LV_LOG_WARN("lv_style_list_remove_style: couldn't reallocate class list");
return;
}
uint8_t j;
for(i = 0, j = 0; i < list->style_cnt; i++) {
if(list->style_list[i] == style) continue;
new_classes[j] = list->style_list[i];
j++;
}
list->style_cnt--;
list->style_list = new_classes;
}
void lv_style_list_reset(lv_style_list_t * list)
{
if(list->has_local) {
lv_style_t * local = lv_style_list_get_style(list, 0);
lv_style_reset(local);
lv_mem_free(local);
}
if(list->style_cnt > 0) lv_mem_free(list->style_list);
list->style_list = NULL;
list->style_cnt = 0;
list->has_local = 0;
} }
@@ -245,7 +255,7 @@ void lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa
memcpy(style->map + style->size - sizeof(lv_opa_t), &opa, sizeof(lv_opa_t)); memcpy(style->map + style->size - sizeof(lv_opa_t), &opa, sizeof(lv_opa_t));
} }
void lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, void * p) void lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void * p)
{ {
int32_t id = get_property_index(style, prop); int32_t id = get_property_index(style, prop);
/*The property already exists but not sure it's state is the same*/ /*The property already exists but not sure it's state is the same*/
@@ -360,12 +370,37 @@ int16_t lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, voi
return attr_act.bits.state & attr_goal.bits.state; return attr_act.bits.state & attr_goal.bits.state;
} }
} }
uint32_t prop_fooled[256];
lv_res_t lv_style_dsc_get_int(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_style_int_t * value)
void lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t value)
{ {
if(dsc == NULL) return LV_RES_INV; lv_style_t * local = get_local_style(list);
if(dsc->local.map == NULL && dsc->classes == NULL) return LV_RES_INV; lv_style_set_int(local, prop, value);
}
void lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t value)
{
lv_style_t * local = get_local_style(list);
lv_style_set_opa(local, prop, value);
}
void lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t value)
{
lv_style_t * local = get_local_style(list);
lv_style_set_color(local, prop, value);
}
void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, const void * value)
{
lv_style_t * local = get_local_style(list);
lv_style_set_ptr(local, prop, value);
}
lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t * value)
{
if(list == NULL) return LV_RES_INV;
if(list->style_list == NULL) return LV_RES_INV;
lv_style_attr_t attr; lv_style_attr_t attr;
attr.full = prop >> 8; attr.full = prop >> 8;
@@ -375,22 +410,10 @@ lv_res_t lv_style_dsc_get_int(lv_style_dsc_t * dsc, lv_style_property_t prop, lv
int16_t weight = -1; int16_t weight = -1;
lv_style_int_t value_act; lv_style_int_t value_act;
weight_act = lv_style_get_int(&dsc->local, prop, &value_act);
/*On perfect match return the value immediately*/
if(weight_act == weight_goal) {
*value = value_act;
return LV_RES_OK;
}
/*If the found ID is better the current candidate then use it*/
else if(weight_act > weight) {
weight = weight_act;
*value = value_act;
}
int16_t ci; int16_t ci;
for(ci = dsc->class_cnt - 1; ci >= 0; ci--) { for(ci = 0; ci < list->style_cnt; ci++) {
lv_style_t * class = lv_style_dsc_get_class(dsc, ci); lv_style_t * class = lv_style_list_get_style(list, ci);
weight_act = lv_style_get_int(class, prop, &value_act); weight_act = lv_style_get_int(class, prop, &value_act);
/*On perfect match return the value immediately*/ /*On perfect match return the value immediately*/
if(weight_act == weight_goal) { if(weight_act == weight_goal) {
@@ -404,19 +427,16 @@ lv_res_t lv_style_dsc_get_int(lv_style_dsc_t * dsc, lv_style_property_t prop, lv
} }
} }
if(weight >= 0) { if(weight >= 0) return LV_RES_OK;
prop_fooled[prop&0xFF]++;
return LV_RES_OK;
}
else return LV_RES_INV; else return LV_RES_INV;
} }
lv_res_t lv_style_dsc_get_color(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_color_t * value) lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t * value)
{ {
if(dsc == NULL) return LV_RES_INV; if(list == NULL) return LV_RES_INV;
if(dsc->local.map == NULL && dsc->classes == NULL) return LV_RES_INV; if(list->style_list == NULL) return LV_RES_INV;
lv_style_attr_t attr; lv_style_attr_t attr;
attr.full = prop >> 8; attr.full = prop >> 8;
@@ -426,22 +446,10 @@ lv_res_t lv_style_dsc_get_color(lv_style_dsc_t * dsc, lv_style_property_t prop,
int16_t weight = -1; int16_t weight = -1;
lv_color_t value_act; lv_color_t value_act;
weight_act = lv_style_get_color(&dsc->local, prop, &value_act);
/*On perfect match return the value immediately*/
if(weight_act == weight_goal) {
*value = value_act;
return LV_RES_OK;
}
/*If the found ID is better the current candidate then use it*/
else if(weight_act > weight) {
weight = weight_act;
*value = value_act;
}
int16_t ci; int16_t ci;
for(ci = dsc->class_cnt - 1; ci >= 0; ci--) { for(ci = 0; ci < list->style_cnt; ci++) {
lv_style_t * class = lv_style_dsc_get_class(dsc, ci); lv_style_t * class = lv_style_list_get_style(list, ci);
weight_act = lv_style_get_color(class, prop, &value_act); weight_act = lv_style_get_color(class, prop, &value_act);
/*On perfect match return the value immediately*/ /*On perfect match return the value immediately*/
if(weight_act == weight_goal) { if(weight_act == weight_goal) {
@@ -455,19 +463,16 @@ lv_res_t lv_style_dsc_get_color(lv_style_dsc_t * dsc, lv_style_property_t prop,
} }
} }
if(weight >= 0) { if(weight >= 0) return LV_RES_OK;
prop_fooled[prop&0xFF]++;
return LV_RES_OK;
}
else return LV_RES_INV; else return LV_RES_INV;
} }
lv_res_t lv_style_dsc_get_opa(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_opa_t * value) lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t * value)
{ {
if(dsc == NULL) return LV_RES_INV; if(list == NULL) return LV_RES_INV;
if(dsc->local.map == NULL && dsc->classes == NULL) return LV_RES_INV; if(list->style_list == NULL) return LV_RES_INV;
lv_style_attr_t attr; lv_style_attr_t attr;
attr.full = prop >> 8; attr.full = prop >> 8;
@@ -476,23 +481,11 @@ lv_res_t lv_style_dsc_get_opa(lv_style_dsc_t * dsc, lv_style_property_t prop, lv
int16_t weight_act; int16_t weight_act;
int16_t weight = -1; int16_t weight = -1;
lv_opa_t value_act; lv_opa_t value_act = LV_OPA_TRANSP;
weight_act = lv_style_get_opa(&dsc->local, prop, &value_act);
/*On perfect match return the value immediately*/
if(weight_act == weight_goal) {
*value = value_act;
return LV_RES_OK;
}
/*If the found ID is better the current candidate then use it*/
else if(weight_act > weight) {
weight = weight_act;
*value = value_act;
}
int16_t ci; int16_t ci;
for(ci = dsc->class_cnt - 1; ci >= 0; ci--) { for(ci = 0; ci < list->style_cnt; ci++) {
lv_style_t * class = lv_style_dsc_get_class(dsc, ci); lv_style_t * class = lv_style_list_get_style(list, ci);
weight_act = lv_style_get_opa(class, prop, &value_act); weight_act = lv_style_get_opa(class, prop, &value_act);
/*On perfect match return the value immediately*/ /*On perfect match return the value immediately*/
if(weight_act == weight_goal) { if(weight_act == weight_goal) {
@@ -506,18 +499,15 @@ lv_res_t lv_style_dsc_get_opa(lv_style_dsc_t * dsc, lv_style_property_t prop, lv
} }
} }
if(weight >= 0) { if(weight >= 0) return LV_RES_OK;
prop_fooled[prop&0xFF]++;
return LV_RES_OK;
}
else return LV_RES_INV; else return LV_RES_INV;
} }
lv_res_t lv_style_dsc_get_ptr(lv_style_dsc_t * dsc, lv_style_property_t prop, void ** value) lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, void ** value)
{ {
if(dsc == NULL) return LV_RES_INV; if(list == NULL) return LV_RES_INV;
if(dsc->local.map == NULL && dsc->classes == NULL) return LV_RES_INV; if(list->style_list == NULL) return LV_RES_INV;
lv_style_attr_t attr; lv_style_attr_t attr;
attr.full = prop >> 8; attr.full = prop >> 8;
@@ -527,22 +517,10 @@ lv_res_t lv_style_dsc_get_ptr(lv_style_dsc_t * dsc, lv_style_property_t prop, vo
int16_t weight = -1; int16_t weight = -1;
void * value_act = NULL; void * value_act = NULL;
weight_act = lv_style_get_ptr(&dsc->local, prop, &value_act);
/*On perfect match return the value immediately*/
if(weight_act == weight_goal) {
*value = value_act;
return LV_RES_OK;
}
/*If the found ID is better the current candidate then use it*/
else if(weight_act > weight) {
weight = weight_act;
*value = value_act;
}
int16_t ci; int16_t ci;
for(ci = dsc->class_cnt - 1; ci >= 0; ci--) { for(ci = 0; ci < list->style_cnt; ci++) {
lv_style_t * class = lv_style_dsc_get_class(dsc, ci); lv_style_t * class = lv_style_list_get_style(list, ci);
weight_act = lv_style_get_ptr(class, prop, &value_act); weight_act = lv_style_get_ptr(class, prop, &value_act);
/*On perfect match return the value immediately*/ /*On perfect match return the value immediately*/
if(weight_act == weight_goal) { if(weight_act == weight_goal) {
@@ -556,10 +534,7 @@ lv_res_t lv_style_dsc_get_ptr(lv_style_dsc_t * dsc, lv_style_property_t prop, vo
} }
} }
if(weight >= 0) { if(weight >= 0) return LV_RES_OK;
prop_fooled[prop&0xFF]++;
return LV_RES_OK;
}
else return LV_RES_INV; else return LV_RES_INV;
} }
@@ -600,8 +575,6 @@ void lv_style_anim_set_styles(lv_anim_t * a, lv_style_t * to_anim, const lv_styl
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
static uint32_t cnt = 0;
static uint32_t stat[256];
static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop) static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop)
{ {
uint8_t id_to_find = prop & 0xFF; uint8_t id_to_find = prop & 0xFF;
@@ -611,27 +584,6 @@ static inline int32_t get_property_index(const lv_style_t * style, lv_style_prop
int16_t weight = -1; int16_t weight = -1;
int16_t id_guess = -1; int16_t id_guess = -1;
stat[id_to_find]++;
cnt++;
if(cnt > 100000) {
cnt = 0;
uint32_t i;
printf("\nQuerry:\n");
for(i = 0; i < 256; i++) {
if(stat[i]) printf("%02x: %d\n", i, stat[i]);
}
memset(stat, 0x00, sizeof(stat));
// printf("\nFooled:\n");
// for(i = 0; i < 256; i++) {
// if(prop_fooled[i]) printf("%02x: %d\n", i, prop_fooled[i]);
// }
memset(prop_fooled, 0x00, sizeof(stat));
// printf("\n");
}
static const uint8_t size[16] = { static const uint8_t size[16] = {
sizeof(lv_style_int_t) + sizeof(lv_style_property_t), sizeof(lv_style_int_t) + sizeof(lv_style_property_t),
sizeof(lv_style_int_t) + sizeof(lv_style_property_t), sizeof(lv_style_int_t) + sizeof(lv_style_property_t),
@@ -687,6 +639,28 @@ static inline int32_t get_property_index(const lv_style_t * style, lv_style_prop
return id_guess; return id_guess;
} }
static lv_style_t * get_local_style(lv_style_list_t * list)
{
if(list->has_local) return lv_style_list_get_style(list, 0);
lv_style_t * local_style = lv_mem_alloc(sizeof(lv_style_t));
LV_ASSERT_MEM(local_style);
if(local_style == NULL) {
LV_LOG_WARN("get_local_style: couldn't create local style");
return NULL;
}
lv_style_init(local_style);
lv_style_list_add_style(list, local_style);
list->has_local = 1;
return local_style;
}
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
/** /**

View File

@@ -172,12 +172,10 @@ typedef int16_t lv_style_int_t;
typedef struct { typedef struct {
lv_style_t local; lv_style_t ** style_list;
lv_style_t ** classes; uint8_t style_cnt;
uint8_t class_cnt; uint8_t has_local :1;
}lv_style_dsc_t; }lv_style_list_t;
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
/** Data structure for style animations. */ /** Data structure for style animations. */
@@ -203,20 +201,21 @@ void lv_style_built_in_init(void);
void lv_style_init(lv_style_t * style); void lv_style_init(lv_style_t * style);
void lv_style_dsc_init(lv_style_dsc_t * style_dsc); void lv_style_list_init(lv_style_list_t * style_dsc);
void lv_style_dsc_add_class(lv_style_dsc_t * style_dsc, lv_style_t * style); void lv_style_list_add_style(lv_style_list_t * style_dsc, lv_style_t * style);
void lv_style_dsc_remove_class(lv_style_dsc_t * style_dsc, lv_style_t * class); void lv_style_list_remove_style(lv_style_list_t * style_dsc, lv_style_t * class);
void lv_style_dsc_reset(lv_style_dsc_t * style_dsc); void lv_style_list_reset(lv_style_list_t * style_dsc);
static inline lv_style_t * lv_style_dsc_get_class(lv_style_dsc_t * style_dsc, uint8_t id) static inline lv_style_t * lv_style_list_get_style(lv_style_list_t * style_dsc, uint8_t id)
{ {
if(style_dsc->class_cnt == 0) return NULL; if(style_dsc->style_cnt == 0) return NULL;
if(style_dsc->class_cnt == 1) return (lv_style_t*) style_dsc->classes; if(id >= style_dsc->style_cnt) return NULL;
return style_dsc->style_list[id];
return style_dsc->classes[id];
} }
void lv_style_reset(lv_style_t * style); void lv_style_reset(lv_style_t * style);
@@ -240,20 +239,24 @@ void lv_style_mix(const lv_style_t * start, const lv_style_t * end, lv_style_t *
void lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_int_t value); void lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_int_t value);
void lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_t color); void lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_t color);
void lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa); void lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa);
void lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, void * p); void lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void * p);
int16_t lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv_style_int_t * res); int16_t lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv_style_int_t * res);
int16_t lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv_opa_t * res); int16_t lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv_opa_t * res);
int16_t lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, lv_color_t * res); int16_t lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, lv_color_t * res);
int16_t lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void ** res); int16_t lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void ** res);
lv_res_t lv_style_dsc_get_int(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_style_int_t * value); void lv_style_list_set_local_int(lv_style_list_t * dsc, lv_style_property_t prop, lv_style_int_t value);
lv_res_t lv_style_dsc_get_color(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_color_t * value); void lv_style_list_set_local_opa(lv_style_list_t * dsc, lv_style_property_t prop, lv_opa_t value);
lv_res_t lv_style_dsc_get_opa(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_opa_t * value); void lv_style_list_set_local_color(lv_style_list_t * dsc, lv_style_property_t prop, lv_color_t value);
lv_res_t lv_style_dsc_get_ptr(lv_style_dsc_t * dsc, lv_style_property_t prop, void ** value); void lv_style_list_set_local_ptr(lv_style_list_t * dsc, lv_style_property_t prop, const void * value);
lv_res_t lv_style_cache_update(lv_style_dsc_t * dsc); lv_res_t lv_style_list_get_int(lv_style_list_t * dsc, lv_style_property_t prop, lv_style_int_t * value);
lv_res_t lv_style_list_get_color(lv_style_list_t * dsc, lv_style_property_t prop, lv_color_t * value);
lv_res_t lv_style_list_get_opa(lv_style_list_t * dsc, lv_style_property_t prop, lv_opa_t * value);
lv_res_t lv_style_list_get_ptr(lv_style_list_t * dsc, lv_style_property_t prop, void ** value);
lv_res_t lv_style_cache_update(lv_style_list_t * dsc);
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
@@ -351,7 +354,6 @@ static inline void lv_style_anim_create(lv_anim_t * a)
/************************* /*************************
* GLOBAL VARIABLES * GLOBAL VARIABLES
*************************/ *************************/
//extern lv_style_t lv_style_transp_tight;
/********************** /**********************
* MACROS * MACROS

View File

@@ -244,6 +244,21 @@ void lv_mem_free(const void * data)
void * lv_mem_realloc(void * data_p, size_t new_size) void * lv_mem_realloc(void * data_p, size_t new_size)
{ {
#ifdef LV_ARCH_64
/*Round the size up to 8*/
if(new_size & 0x7) {
new_size = new_size & (~0x7);
new_size += 8;
}
#else
/*Round the size up to 4*/
if(new_size & 0x3) {
new_size = new_size & (~0x3);
new_size += 4;
}
#endif
/*data_p could be previously freed pointer (in this case it is invalid)*/ /*data_p could be previously freed pointer (in this case it is invalid)*/
if(data_p != NULL) { if(data_p != NULL) {
lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *)data_p - sizeof(lv_mem_header_t)); lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *)data_p - sizeof(lv_mem_header_t));
@@ -336,7 +351,7 @@ void lv_mem_defrag(void)
#endif #endif
} }
void lv_mem_test(void) lv_res_t lv_mem_test(void)
{ {
lv_mem_ent_t * e; lv_mem_ent_t * e;
e = ent_get_next(NULL); e = ent_get_next(NULL);
@@ -344,10 +359,12 @@ void lv_mem_test(void)
if(e->header.s.d_size > 200000) { if(e->header.s.d_size > 200000) {
printf("mem err\n"); printf("mem err\n");
while(1); while(1);
return LV_RES_INV;
} }
e = ent_get_next(e); e = ent_get_next(e);
} }
return LV_RES_OK;
} }
/** /**

View File

@@ -97,7 +97,7 @@ void * lv_mem_realloc(void * data_p, size_t new_size);
*/ */
void lv_mem_defrag(void); void lv_mem_defrag(void);
void lv_mem_test(void); lv_res_t lv_mem_test(void);
/** /**
* Give information about the work memory of dynamic allocation * Give information about the work memory of dynamic allocation

View File

@@ -28,7 +28,7 @@
**********************/ **********************/
static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param); static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part); static lv_style_list_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -83,8 +83,8 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy)
/*Init the new arc arc*/ /*Init the new arc arc*/
if(copy == NULL) { if(copy == NULL) {
lv_style_dsc_init(&ext->style_arc); lv_style_list_init(&ext->style_arc);
lv_style_dsc_reset(&new_arc->style_dsc); lv_style_list_reset(&new_arc->style_dsc);
_ot(new_arc, LV_ARC_PART_BG, ARC_BG); _ot(new_arc, LV_ARC_PART_BG, ARC_BG);
_ot(new_arc, LV_ARC_PART_ARC, ARC); _ot(new_arc, LV_ARC_PART_ARC, ARC);
@@ -276,13 +276,13 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
* @param part the part of the object. (LV_ARC_PART_...) * @param part the part of the object. (LV_ARC_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part) static lv_style_list_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part)
{ {
LV_ASSERT_OBJ(arc, LV_OBJX_NAME); LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc); lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_ARC_PART_BG: case LV_ARC_PART_BG:

View File

@@ -32,7 +32,7 @@ typedef struct
/*New data for this type */ /*New data for this type */
lv_coord_t angle_start; lv_coord_t angle_start;
lv_coord_t angle_end; lv_coord_t angle_end;
lv_style_dsc_t style_arc; lv_style_list_t style_arc;
} lv_arc_ext_t; } lv_arc_ext_t;
/*Parts of the arc*/ /*Parts of the arc*/

View File

@@ -40,7 +40,7 @@
**********************/ **********************/
static lv_design_res_t lv_bar_design(lv_obj_t * bar, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_design_res_t lv_bar_design(lv_obj_t * bar, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param); static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_bar_get_style(lv_obj_t * bar, uint8_t part); static lv_style_list_t * lv_bar_get_style(lv_obj_t * bar, uint8_t part);
static void draw_bg(lv_obj_t * bar, const lv_area_t * clip_area); static void draw_bg(lv_obj_t * bar, const lv_area_t * clip_area);
static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area); static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area);
@@ -102,7 +102,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy)
lv_bar_init_anim(new_bar, &ext->start_value_anim); lv_bar_init_anim(new_bar, &ext->start_value_anim);
#endif #endif
ext->type = LV_BAR_TYPE_NORMAL; ext->type = LV_BAR_TYPE_NORMAL;
lv_style_dsc_init(&ext->style_indic); lv_style_list_init(&ext->style_indic);
lv_obj_set_signal_cb(new_bar, lv_bar_signal); lv_obj_set_signal_cb(new_bar, lv_bar_signal);
lv_obj_set_design_cb(new_bar, lv_bar_design); lv_obj_set_design_cb(new_bar, lv_bar_design);
@@ -611,12 +611,12 @@ static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param)
return res; return res;
} }
static lv_style_dsc_t * lv_bar_get_style(lv_obj_t * bar, uint8_t part) static lv_style_list_t * lv_bar_get_style(lv_obj_t * bar, uint8_t part)
{ {
LV_ASSERT_OBJ(bar, LV_OBJX_NAME); LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_BAR_PART_BG: case LV_BAR_PART_BG:

View File

@@ -76,7 +76,7 @@ typedef struct
lv_bar_anim_t start_value_anim; lv_bar_anim_t start_value_anim;
#endif #endif
uint8_t type : 2; /*Type of bar*/ uint8_t type : 2; /*Type of bar*/
lv_style_dsc_t style_indic; /*Style of the indicator*/ lv_style_list_t style_indic; /*Style of the indicator*/
} lv_bar_ext_t; } lv_bar_ext_t;
/** Bar parts */ /** Bar parts */

View File

@@ -210,9 +210,9 @@ bool lv_btn_get_toggle(const lv_obj_t * btn)
return ext->toggle != 0 ? true : false; return ext->toggle != 0 ? true : false;
} }
lv_style_dsc_t * lv_btn_get_style(lv_obj_t * cont, uint8_t type) lv_style_list_t * lv_btn_get_style(lv_obj_t * cont, uint8_t type)
{ {
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(type) { switch(type) {
case LV_BTN_PART_MAIN: case LV_BTN_PART_MAIN:
style_dsc_p = &cont->style_dsc; style_dsc_p = &cont->style_dsc;

View File

@@ -274,7 +274,7 @@ uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn);
*/ */
uint16_t lv_btn_get_ink_out_time(const lv_obj_t * btn); uint16_t lv_btn_get_ink_out_time(const lv_obj_t * btn);
lv_style_dsc_t * lv_btn_get_style(lv_obj_t * cont, uint8_t type); lv_style_list_t * lv_btn_get_style(lv_obj_t * cont, uint8_t type);
/********************** /**********************
* MACROS * MACROS

View File

@@ -30,7 +30,7 @@
**********************/ **********************/
static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param); static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param);
static lv_design_res_t lv_btnm_design(lv_obj_t * btnm, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_design_res_t lv_btnm_design(lv_obj_t * btnm, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_style_dsc_t * lv_btnm_get_style(lv_obj_t * btnm, uint8_t part); static lv_style_list_t * lv_btnm_get_style(lv_obj_t * btnm, uint8_t part);
static uint8_t get_button_width(lv_btnm_ctrl_t ctrl_bits); static uint8_t get_button_width(lv_btnm_ctrl_t ctrl_bits);
static bool button_is_hidden(lv_btnm_ctrl_t ctrl_bits); static bool button_is_hidden(lv_btnm_ctrl_t ctrl_bits);
@@ -96,7 +96,7 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, const lv_obj_t * copy)
ext->map_p = NULL; ext->map_p = NULL;
ext->recolor = 0; ext->recolor = 0;
ext->one_toggle = 0; ext->one_toggle = 0;
lv_style_dsc_init(&ext->style_btn); lv_style_list_init(&ext->style_btn);
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_cb(new_btnm); if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_cb(new_btnm);
@@ -978,13 +978,13 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
* @param part the part of the object. (LV_BTNM_PART_...) * @param part the part of the object. (LV_BTNM_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_btnm_get_style(lv_obj_t * btnm, uint8_t part) static lv_style_list_t * lv_btnm_get_style(lv_obj_t * btnm, uint8_t part)
{ {
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME); LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm); lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_BTNM_PART_BG: case LV_BTNM_PART_BG:

View File

@@ -53,7 +53,7 @@ typedef struct
const char ** map_p; /*Pointer to the current map*/ const char ** map_p; /*Pointer to the current map*/
lv_area_t * button_areas; /*Array of areas of buttons*/ lv_area_t * button_areas; /*Array of areas of buttons*/
lv_btnm_ctrl_t * ctrl_bits; /*Array of control bytes*/ lv_btnm_ctrl_t * ctrl_bits; /*Array of control bytes*/
lv_style_dsc_t style_btn; /*Styles of buttons in each state*/ lv_style_list_t style_btn; /*Styles of buttons in each state*/
uint16_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/ uint16_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/
uint16_t btn_id_pr; /*Index of the currently pressed button or LV_BTNM_BTN_NONE*/ uint16_t btn_id_pr; /*Index of the currently pressed button or LV_BTNM_BTN_NONE*/
uint16_t btn_id_focused; /*Index of the currently focused button or LV_BTNM_BTN_NONE*/ uint16_t btn_id_focused; /*Index of the currently focused button or LV_BTNM_BTN_NONE*/

View File

@@ -37,7 +37,7 @@ typedef uint8_t day_draw_state_t;
**********************/ **********************/
static lv_design_res_t lv_calendar_design(lv_obj_t * calendar, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_design_res_t lv_calendar_design(lv_obj_t * calendar, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void * param); static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_calendar_get_style(lv_obj_t * calendar, uint8_t part); static lv_style_list_t * lv_calendar_get_style(lv_obj_t * calendar, uint8_t part);
static bool calculate_touched_day(lv_obj_t * calendar, const lv_point_t * touched_point); static bool calculate_touched_day(lv_obj_t * calendar, const lv_point_t * touched_point);
static lv_coord_t get_header_height(lv_obj_t * calendar); static lv_coord_t get_header_height(lv_obj_t * calendar);
static lv_coord_t get_day_names_height(lv_obj_t * calendar); static lv_coord_t get_day_names_height(lv_obj_t * calendar);
@@ -116,9 +116,9 @@ lv_obj_t * lv_calendar_create(lv_obj_t * par, const lv_obj_t * copy)
ext->btn_pressing = 0; ext->btn_pressing = 0;
lv_style_dsc_init(&ext->style_date_nums); lv_style_list_init(&ext->style_date_nums);
lv_style_dsc_init(&ext->style_day_names); lv_style_list_init(&ext->style_day_names);
lv_style_dsc_init(&ext->style_header); lv_style_list_init(&ext->style_header);
/*The signal and design functions are not copied so set them here*/ /*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(new_calendar, lv_calendar_signal); lv_obj_set_signal_cb(new_calendar, lv_calendar_signal);
@@ -128,11 +128,11 @@ lv_obj_t * lv_calendar_create(lv_obj_t * par, const lv_obj_t * copy)
if(copy == NULL) { if(copy == NULL) {
/*Different styles will be used from the styles while rendering so disable caching*/ /*Different styles will be used from the styles while rendering so disable caching*/
lv_style_dsc_reset(&new_calendar->style_dsc); lv_style_list_reset(&new_calendar->style_dsc);
lv_style_dsc_add_class(&new_calendar->style_dsc, lv_theme_get_style(LV_THEME_CALENDAR_BG)); lv_style_list_add_style(&new_calendar->style_dsc, lv_theme_get_style(LV_THEME_CALENDAR_BG));
lv_style_dsc_add_class(&ext->style_date_nums, lv_theme_get_style(LV_THEME_CALENDAR_DATE_NUMS)); lv_style_list_add_style(&ext->style_date_nums, lv_theme_get_style(LV_THEME_CALENDAR_DATE_NUMS));
lv_style_dsc_add_class(&ext->style_day_names, lv_theme_get_style(LV_THEME_CALENDAR_DAY_NAMES)); lv_style_list_add_style(&ext->style_day_names, lv_theme_get_style(LV_THEME_CALENDAR_DAY_NAMES));
lv_style_dsc_add_class(&ext->style_header, lv_theme_get_style(LV_THEME_CALENDAR_HEADER)); lv_style_list_add_style(&ext->style_header, lv_theme_get_style(LV_THEME_CALENDAR_HEADER));
lv_obj_refresh_style(new_calendar); lv_obj_refresh_style(new_calendar);
@@ -537,12 +537,12 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void *
* @param part the part from `lv_calendar_part_t`. (LV_CALENDAR_PART_...) * @param part the part from `lv_calendar_part_t`. (LV_CALENDAR_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_calendar_get_style(lv_obj_t * calendar, uint8_t part) static lv_style_list_t * lv_calendar_get_style(lv_obj_t * calendar, uint8_t part)
{ {
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME); LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar); lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {

View File

@@ -53,9 +53,9 @@ typedef struct
const char ** month_names; /*Pointer to an array with the name of the month (NULL. use default names)*/ const char ** month_names; /*Pointer to an array with the name of the month (NULL. use default names)*/
/*Styles*/ /*Styles*/
lv_style_dsc_t style_header; lv_style_list_t style_header;
lv_style_dsc_t style_day_names; lv_style_list_t style_day_names;
lv_style_dsc_t style_date_nums; lv_style_list_t style_date_nums;
} lv_calendar_ext_t; } lv_calendar_ext_t;
/** Calendar parts*/ /** Calendar parts*/

View File

@@ -26,7 +26,7 @@
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param); static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_cb_get_style(lv_obj_t * cb, uint8_t type); static lv_style_list_t * lv_cb_get_style(lv_obj_t * cb, uint8_t type);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -202,9 +202,9 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
} }
static lv_style_dsc_t * lv_cb_get_style(lv_obj_t * cb, uint8_t type) static lv_style_list_t * lv_cb_get_style(lv_obj_t * cb, uint8_t type)
{ {
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
lv_cb_ext_t * ext = lv_obj_get_ext_attr(cb); lv_cb_ext_t * ext = lv_obj_get_ext_attr(cb);
switch(type) { switch(type) {

View File

@@ -49,7 +49,7 @@ typedef struct {
**********************/ **********************/
static lv_design_res_t lv_chart_design(lv_obj_t * chart, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_design_res_t lv_chart_design(lv_obj_t * chart, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param); static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_chart_get_style(lv_obj_t * chart, uint8_t part); static lv_style_list_t * lv_chart_get_style(lv_obj_t * chart, uint8_t part);
static void draw_series_bg(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * mask); static void draw_series_bg(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * mask);
static void draw_series_line(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * clip_area); static void draw_series_line(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * clip_area);
@@ -120,8 +120,8 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
ext->secondary_y_axis.minor_tick_len = LV_CHART_TICK_LENGTH_AUTO; ext->secondary_y_axis.minor_tick_len = LV_CHART_TICK_LENGTH_AUTO;
lv_style_dsc_init(&ext->style_series_bg); lv_style_list_init(&ext->style_series_bg);
lv_style_dsc_init(&ext->style_series); lv_style_list_init(&ext->style_series);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_chart); if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_chart);
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_chart); if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_chart);
@@ -133,7 +133,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
if(copy == NULL) { if(copy == NULL) {
lv_obj_set_size(new_chart, LV_DPI * 3, LV_DPI * 2); lv_obj_set_size(new_chart, LV_DPI * 3, LV_DPI * 2);
lv_style_dsc_reset(&new_chart->style_dsc); lv_style_list_reset(&new_chart->style_dsc);
lv_obj_add_style_theme(new_chart, LV_CHART_PART_BG, LV_THEME_CHART_BG); lv_obj_add_style_theme(new_chart, LV_CHART_PART_BG, LV_THEME_CHART_BG);
lv_obj_add_style_theme(new_chart, LV_CHART_PART_SERIES_BG, LV_THEME_CHART_SERIES_BG); lv_obj_add_style_theme(new_chart, LV_CHART_PART_SERIES_BG, LV_THEME_CHART_SERIES_BG);
lv_obj_add_style_theme(new_chart, LV_CHART_PART_SERIES, LV_THEME_CHART_SERIES); lv_obj_add_style_theme(new_chart, LV_CHART_PART_SERIES, LV_THEME_CHART_SERIES);
@@ -665,12 +665,12 @@ static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param
* @param part the part of the chart. (LV_CHART_PART_...) * @param part the part of the chart. (LV_CHART_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_chart_get_style(lv_obj_t * chart, uint8_t part) static lv_style_list_t * lv_chart_get_style(lv_obj_t * chart, uint8_t part)
{ {
LV_ASSERT_OBJ(chart, LV_OBJX_NAME); LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_CHART_PART_BG: case LV_CHART_PART_BG:

View File

@@ -87,8 +87,8 @@ typedef struct
uint8_t hdiv_cnt; /*Number of horizontal division lines*/ uint8_t hdiv_cnt; /*Number of horizontal division lines*/
uint8_t vdiv_cnt; /*Number of vertical division lines*/ uint8_t vdiv_cnt; /*Number of vertical division lines*/
uint16_t point_cnt; /*Point number in a data line*/ uint16_t point_cnt; /*Point number in a data line*/
lv_style_dsc_t style_series_bg; lv_style_list_t style_series_bg;
lv_style_dsc_t style_series; lv_style_list_t style_series;
lv_chart_type_t type; /*Line, column or point chart (from 'lv_chart_type_t')*/ lv_chart_type_t type; /*Line, column or point chart (from 'lv_chart_type_t')*/
lv_chart_axis_cfg_t y_axis; lv_chart_axis_cfg_t y_axis;
lv_chart_axis_cfg_t x_axis; lv_chart_axis_cfg_t x_axis;

View File

@@ -36,7 +36,7 @@
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static lv_res_t lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param); static lv_res_t lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_cont_get_style(lv_obj_t * cont, uint8_t type); static lv_style_list_t * lv_cont_get_style(lv_obj_t * cont, uint8_t type);
static void lv_cont_refr_layout(lv_obj_t * cont); static void lv_cont_refr_layout(lv_obj_t * cont);
static void lv_cont_layout_col(lv_obj_t * cont); static void lv_cont_layout_col(lv_obj_t * cont);
static void lv_cont_layout_row(lv_obj_t * cont); static void lv_cont_layout_row(lv_obj_t * cont);
@@ -288,9 +288,9 @@ static lv_res_t lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param)
} }
static lv_style_dsc_t * lv_cont_get_style(lv_obj_t * cont, uint8_t type) static lv_style_list_t * lv_cont_get_style(lv_obj_t * cont, uint8_t type)
{ {
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(type) { switch(type) {
case LV_CONT_PART_MAIN: case LV_CONT_PART_MAIN:
style_dsc_p = &cont->style_dsc; style_dsc_p = &cont->style_dsc;

View File

@@ -39,7 +39,7 @@
static lv_design_res_t lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_design_res_t lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param); static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param);
static lv_res_t lv_ddlist_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param); static lv_res_t lv_ddlist_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_ddlist_get_style(lv_obj_t * ddlist, uint8_t part); static lv_style_list_t * lv_ddlist_get_style(lv_obj_t * ddlist, uint8_t part);
static lv_res_t release_handler(lv_obj_t * ddlist); static lv_res_t release_handler(lv_obj_t * ddlist);
static void lv_ddlist_refr_size(lv_obj_t * ddlist, lv_anim_enable_t anim); static void lv_ddlist_refr_size(lv_obj_t * ddlist, lv_anim_enable_t anim);
static void lv_ddlist_pos_current_option(lv_obj_t * ddlist); static void lv_ddlist_pos_current_option(lv_obj_t * ddlist);
@@ -102,7 +102,7 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, const lv_obj_t * copy)
ext->sel_opt_id_ori = 0; ext->sel_opt_id_ori = 0;
ext->option_cnt = 0; ext->option_cnt = 0;
ext->stay_open = 0; ext->stay_open = 0;
lv_style_dsc_init(&ext->style_sel); lv_style_list_init(&ext->style_sel);
/*The signal and design functions are not copied so set them here*/ /*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(new_ddlist, lv_ddlist_signal); lv_obj_set_signal_cb(new_ddlist, lv_ddlist_signal);
@@ -594,7 +594,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
lv_res_t res; lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) { if(sign == LV_SIGNAL_GET_STYLE) {
uint8_t ** type_p = param; uint8_t ** type_p = param;
lv_style_dsc_t ** style_dsc_p = param; lv_style_list_t ** style_dsc_p = param;
*style_dsc_p = lv_ddlist_get_style(ddlist, **type_p); *style_dsc_p = lv_ddlist_get_style(ddlist, **type_p);
return LV_RES_OK; return LV_RES_OK;
} }
@@ -739,12 +739,12 @@ static lv_res_t lv_ddlist_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void *
* @param part the part from `lv_ddlist_part_t`. (LV_DDLIST_PART_...) * @param part the part from `lv_ddlist_part_t`. (LV_DDLIST_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_ddlist_get_style(lv_obj_t * ddlist, uint8_t part) static lv_style_list_t * lv_ddlist_get_style(lv_obj_t * ddlist, uint8_t part)
{ {
LV_ASSERT_OBJ(ddlist, LV_OBJX_NAME); LV_ASSERT_OBJ(ddlist, LV_OBJX_NAME);
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist); lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_DDLIST_PART_BG: case LV_DDLIST_PART_BG:

View File

@@ -43,7 +43,7 @@ typedef struct
lv_page_ext_t page; /*Ext. of ancestor*/ lv_page_ext_t page; /*Ext. of ancestor*/
/*New data for this type */ /*New data for this type */
lv_obj_t * label; /*Label for the options*/ lv_obj_t * label; /*Label for the options*/
lv_style_dsc_t style_sel; /*Style of the selected option*/ lv_style_list_t style_sel; /*Style of the selected option*/
const char * symbol; /*Arrow or other icon when the drop-down list is closed*/ const char * symbol; /*Arrow or other icon when the drop-down list is closed*/
uint16_t option_cnt; /*Number of options*/ uint16_t option_cnt; /*Number of options*/
uint16_t sel_opt_id; /*Index of the current option*/ uint16_t sel_opt_id; /*Index of the current option*/

View File

@@ -38,7 +38,7 @@
**********************/ **********************/
static lv_design_res_t lv_gauge_design(lv_obj_t * gauge, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_design_res_t lv_gauge_design(lv_obj_t * gauge, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param); static lv_res_t lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_gauge_get_style(lv_obj_t * gauge, uint8_t part); static lv_style_list_t * lv_gauge_get_style(lv_obj_t * gauge, uint8_t part);
static void lv_gauge_draw_labels(lv_obj_t * gauge, const lv_area_t * mask); static void lv_gauge_draw_labels(lv_obj_t * gauge, const lv_area_t * mask);
static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * clip_area); static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * clip_area);
@@ -102,8 +102,8 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy)
lv_gauge_set_critical_value(new_gauge, 80); lv_gauge_set_critical_value(new_gauge, 80);
lv_obj_set_size(new_gauge, 2 * LV_DPI, 2 * LV_DPI); lv_obj_set_size(new_gauge, 2 * LV_DPI, 2 * LV_DPI);
lv_style_dsc_reset(&new_gauge->style_dsc); lv_style_list_reset(&new_gauge->style_dsc);
lv_style_dsc_init(&ext->style_strong); lv_style_list_init(&ext->style_strong);
_ot(new_gauge, LV_GAUGE_PART_MAIN, GAUGE); _ot(new_gauge, LV_GAUGE_PART_MAIN, GAUGE);
_ot(new_gauge, LV_GAUGE_PART_STRONG, GAUGE_STRONG); _ot(new_gauge, LV_GAUGE_PART_STRONG, GAUGE_STRONG);
@@ -410,12 +410,12 @@ static lv_res_t lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param
* @param part the part from `lv_gauge_part_t`. (LV_GAUGE_PART_...) * @param part the part from `lv_gauge_part_t`. (LV_GAUGE_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_gauge_get_style(lv_obj_t * gauge, uint8_t part) static lv_style_list_t * lv_gauge_get_style(lv_obj_t * gauge, uint8_t part)
{ {
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME); LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge); lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_GAUGE_PART_MAIN: case LV_GAUGE_PART_MAIN:

View File

@@ -44,7 +44,7 @@ typedef struct
const lv_color_t * needle_colors; /*Color of the needles (lv_color_t my_colors[needle_num])*/ const lv_color_t * needle_colors; /*Color of the needles (lv_color_t my_colors[needle_num])*/
const void * needle_img; const void * needle_img;
lv_point_t needle_img_pivot; lv_point_t needle_img_pivot;
lv_style_dsc_t style_strong; lv_style_list_t style_strong;
uint8_t needle_count; /*Number of needles*/ uint8_t needle_count; /*Number of needles*/
uint8_t label_count; /*Number of labels on the scale*/ uint8_t label_count; /*Number of labels on the scale*/
} lv_gauge_ext_t; } lv_gauge_ext_t;

View File

@@ -36,7 +36,7 @@
**********************/ **********************/
static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param); static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_img_get_style(lv_obj_t * img, uint8_t type); static lv_style_list_t * lv_img_get_style(lv_obj_t * img, uint8_t type);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -629,9 +629,9 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
} }
static lv_style_dsc_t * lv_img_get_style(lv_obj_t * img, uint8_t type) static lv_style_list_t * lv_img_get_style(lv_obj_t * img, uint8_t type)
{ {
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(type) { switch(type) {
case LV_IMG_PART_MAIN: case LV_IMG_PART_MAIN:
style_dsc_p = &img->style_dsc; style_dsc_p = &img->style_dsc;

View File

@@ -29,7 +29,7 @@
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static lv_res_t lv_kb_signal(lv_obj_t * kb, lv_signal_t sign, void * param); static lv_res_t lv_kb_signal(lv_obj_t * kb, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_kb_get_style(lv_obj_t * kb, uint8_t part); static lv_style_list_t * lv_kb_get_style(lv_obj_t * kb, uint8_t part);
static void lv_kb_update_map(lv_obj_t * kb); static void lv_kb_update_map(lv_obj_t * kb);
/********************** /**********************
@@ -454,12 +454,12 @@ static lv_res_t lv_kb_signal(lv_obj_t * kb, lv_signal_t sign, void * param)
* @param part the part from `lv_kb_part_t`. (LV_KB_PART_...) * @param part the part from `lv_kb_part_t`. (LV_KB_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_kb_get_style(lv_obj_t * kb, uint8_t part) static lv_style_list_t * lv_kb_get_style(lv_obj_t * kb, uint8_t part)
{ {
LV_ASSERT_OBJ(kb, LV_OBJX_NAME); LV_ASSERT_OBJ(kb, LV_OBJX_NAME);
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb); lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_KB_PART_BG: case LV_KB_PART_BG:

View File

@@ -906,9 +906,9 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos)
return (pos->x >= (last_x - letter_space) && pos->x <= (last_x + max_diff)); return (pos->x >= (last_x - letter_space) && pos->x <= (last_x + max_diff));
} }
lv_style_dsc_t * lv_label_get_style(lv_obj_t * label, uint8_t type) lv_style_list_t * lv_label_get_style(lv_obj_t * label, uint8_t type)
{ {
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(type) { switch(type) {
case LV_LABEL_PART_MAIN: case LV_LABEL_PART_MAIN:
style_dsc_p = &label->style_dsc; style_dsc_p = &label->style_dsc;

View File

@@ -278,7 +278,7 @@ uint16_t lv_label_get_text_sel_start(const lv_obj_t * label);
uint16_t lv_label_get_text_sel_end(const lv_obj_t * label); uint16_t lv_label_get_text_sel_end(const lv_obj_t * label);
lv_style_dsc_t * lv_label_get_style(lv_obj_t * label, uint8_t type); lv_style_list_t * lv_label_get_style(lv_obj_t * label, uint8_t type);
/*===================== /*=====================
* Other functions * Other functions

View File

@@ -82,7 +82,7 @@ lv_obj_t * lv_led_create(lv_obj_t * par, const lv_obj_t * copy)
if(copy == NULL) { if(copy == NULL) {
lv_obj_set_size(new_led, LV_LED_WIDTH_DEF, LV_LED_HEIGHT_DEF); lv_obj_set_size(new_led, LV_LED_WIDTH_DEF, LV_LED_HEIGHT_DEF);
lv_style_dsc_init(&new_led->style_dsc); lv_style_list_init(&new_led->style_dsc);
lv_obj_add_style_class(new_led, LV_LED_PART_MAIN, lv_theme_get_style(LV_THEME_LED)); lv_obj_add_style_class(new_led, LV_LED_PART_MAIN, lv_theme_get_style(LV_THEME_LED));
} }
/*Copy an existing object*/ /*Copy an existing object*/

View File

@@ -36,7 +36,7 @@
**********************/ **********************/
static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param); static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param);
static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param); static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_list_get_style(lv_obj_t * list, uint8_t part); static lv_style_list_t * lv_list_get_style(lv_obj_t * list, uint8_t part);
static void lv_list_btn_single_select(lv_obj_t * btn); static void lv_list_btn_single_select(lv_obj_t * btn);
static bool lv_list_is_list_btn(lv_obj_t * list_btn); static bool lv_list_is_list_btn(lv_obj_t * list_btn);
static bool lv_list_is_list_img(lv_obj_t * list_btn); static bool lv_list_is_list_img(lv_obj_t * list_btn);
@@ -171,7 +171,7 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * t
if(ancestor_btn_signal == NULL) ancestor_btn_signal = lv_obj_get_signal_cb(liste); if(ancestor_btn_signal == NULL) ancestor_btn_signal = lv_obj_get_signal_cb(liste);
/*Set the default styles*/ /*Set the default styles*/
lv_style_dsc_reset(&liste->style_dsc); lv_style_list_reset(&liste->style_dsc);
_ot(liste, LV_BTN_PART_MAIN, LIST_BTN); _ot(liste, LV_BTN_PART_MAIN, LIST_BTN);
lv_page_glue_obj(liste, true); lv_page_glue_obj(liste, true);
@@ -910,12 +910,12 @@ static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * para
* @param part the part from `lv_page_list_t`. (LV_LIST_PART_...) * @param part the part from `lv_page_list_t`. (LV_LIST_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_list_get_style(lv_obj_t * list, uint8_t part) static lv_style_list_t * lv_list_get_style(lv_obj_t * list, uint8_t part)
{ {
LV_ASSERT_OBJ(list, LV_OBJX_NAME); LV_ASSERT_OBJ(list, LV_OBJX_NAME);
lv_list_ext_t * ext = lv_obj_get_ext_attr(list); lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_LIST_PART_BG: case LV_LIST_PART_BG:

View File

@@ -85,7 +85,7 @@ lv_obj_t * lv_lmeter_create(lv_obj_t * par, const lv_obj_t * copy)
if(copy == NULL) { if(copy == NULL) {
lv_obj_set_size(new_lmeter, LV_DPI, LV_DPI); lv_obj_set_size(new_lmeter, LV_DPI, LV_DPI);
lv_style_dsc_reset(lv_obj_get_style(new_lmeter, LV_LMETER_PART_MAIN)); lv_style_list_reset(lv_obj_get_style(new_lmeter, LV_LMETER_PART_MAIN));
_ot(new_lmeter, LV_LMETER_PART_MAIN, LMETER); _ot(new_lmeter, LV_LMETER_PART_MAIN, LMETER);
} }
/*Copy an existing line meter*/ /*Copy an existing line meter*/

View File

@@ -38,7 +38,7 @@
**********************/ **********************/
static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param); static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param);
static void mbox_realign(lv_obj_t * mbox); static void mbox_realign(lv_obj_t * mbox);
static lv_style_dsc_t * lv_mbox_get_style(lv_obj_t * mbox, uint8_t part); static lv_style_list_t * lv_mbox_get_style(lv_obj_t * mbox, uint8_t part);
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
static void lv_mbox_close_ready_cb(lv_anim_t * a); static void lv_mbox_close_ready_cb(lv_anim_t * a);
#endif #endif
@@ -107,7 +107,7 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, const lv_obj_t * copy)
lv_obj_set_event_cb(new_mbox, lv_mbox_default_event_cb); lv_obj_set_event_cb(new_mbox, lv_mbox_default_event_cb);
/*Set the default styles*/ /*Set the default styles*/
lv_style_dsc_reset(&new_mbox->style_dsc); lv_style_list_reset(&new_mbox->style_dsc);
lv_obj_add_style_theme(new_mbox, LV_MBOX_PART_BG, LV_THEME_MBOX_BG); lv_obj_add_style_theme(new_mbox, LV_MBOX_PART_BG, LV_THEME_MBOX_BG);
} }
@@ -150,11 +150,11 @@ void lv_mbox_add_btns(lv_obj_t * mbox, const char * btn_map[])
if(ext->btnm == NULL) { if(ext->btnm == NULL) {
ext->btnm = lv_btnm_create(mbox, NULL); ext->btnm = lv_btnm_create(mbox, NULL);
lv_style_dsc_reset(&ext->btnm->style_dsc); lv_style_list_reset(&ext->btnm->style_dsc);
lv_obj_add_style_theme(ext->btnm, LV_BTNM_PART_BG, LV_THEME_MBOX_BTN_BG); lv_obj_add_style_theme(ext->btnm, LV_BTNM_PART_BG, LV_THEME_MBOX_BTN_BG);
lv_style_dsc_reset(lv_obj_get_style(ext->btnm, LV_BTNM_PART_BTN)); lv_style_list_reset(lv_obj_get_style(ext->btnm, LV_BTNM_PART_BTN));
lv_obj_add_style_theme(ext->btnm, LV_BTNM_PART_BTN, LV_THEME_MBOX_BTN); lv_obj_add_style_theme(ext->btnm, LV_BTNM_PART_BTN, LV_THEME_MBOX_BTN);
} }
@@ -472,12 +472,12 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
* @param part the part from `lv_mbox_part_t`. (LV_MBOX_PART_...) * @param part the part from `lv_mbox_part_t`. (LV_MBOX_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_mbox_get_style(lv_obj_t * mbox, uint8_t part) static lv_style_list_t * lv_mbox_get_style(lv_obj_t * mbox, uint8_t part)
{ {
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME); LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox); lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_MBOX_PART_BG: case LV_MBOX_PART_BG:

View File

@@ -46,7 +46,7 @@
static void lv_page_sb_refresh(lv_obj_t * page); static void lv_page_sb_refresh(lv_obj_t * page);
static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param); static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_page_get_style(lv_obj_t * page, uint8_t part); static lv_style_list_t * lv_page_get_style(lv_obj_t * page, uint8_t part);
static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param); static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
static void scrl_def_event_cb(lv_obj_t * scrl, lv_event_t event); static void scrl_def_event_cb(lv_obj_t * scrl, lv_event_t event);
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
@@ -95,12 +95,12 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
} }
ext->scrl = NULL; ext->scrl = NULL;
lv_style_dsc_init(&ext->sb.style); lv_style_list_init(&ext->sb.style);
ext->sb.hor_draw = 0; ext->sb.hor_draw = 0;
ext->sb.ver_draw = 0; ext->sb.ver_draw = 0;
ext->sb.mode = LV_SB_MODE_AUTO; ext->sb.mode = LV_SB_MODE_AUTO;
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
lv_style_dsc_init(&ext->edge_flash.style); lv_style_list_init(&ext->edge_flash.style);
ext->edge_flash.enabled = 0; ext->edge_flash.enabled = 0;
ext->edge_flash.bottom_ip = 0; ext->edge_flash.bottom_ip = 0;
ext->edge_flash.top_ip = 0; ext->edge_flash.top_ip = 0;
@@ -1075,12 +1075,12 @@ static void scrl_def_event_cb(lv_obj_t * scrl, lv_event_t event)
* @param part the part of the page. (LV_PAGE_PART_...) * @param part the part of the page. (LV_PAGE_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_page_get_style(lv_obj_t * page, uint8_t part) static lv_style_list_t * lv_page_get_style(lv_obj_t * page, uint8_t part)
{ {
LV_ASSERT_OBJ(page, LV_OBJX_NAME); LV_ASSERT_OBJ(page, LV_OBJX_NAME);
lv_page_ext_t * ext = lv_obj_get_ext_attr(page); lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_PAGE_PART_BG: case LV_PAGE_PART_BG:

View File

@@ -57,7 +57,7 @@ typedef struct
lv_obj_t * scrl; /*The scrollable object on the background*/ lv_obj_t * scrl; /*The scrollable object on the background*/
struct struct
{ {
lv_style_dsc_t style; /*Style of scrollbars*/ lv_style_list_t style; /*Style of scrollbars*/
lv_area_t hor_area; /*Horizontal scrollbar area relative to the page. (Handled by the library) */ lv_area_t hor_area; /*Horizontal scrollbar area relative to the page. (Handled by the library) */
lv_area_t ver_area; /*Vertical scrollbar area relative to the page (Handled by the library)*/ lv_area_t ver_area; /*Vertical scrollbar area relative to the page (Handled by the library)*/
uint8_t hor_draw : 1; /*1: horizontal scrollbar is visible now (Handled by the library)*/ uint8_t hor_draw : 1; /*1: horizontal scrollbar is visible now (Handled by the library)*/
@@ -68,7 +68,7 @@ typedef struct
struct struct
{ {
lv_anim_value_t state; /*Store the current size of the edge flash effect*/ lv_anim_value_t state; /*Store the current size of the edge flash effect*/
lv_style_dsc_t style; /*Style of edge flash effect (usually homogeneous circle)*/ lv_style_list_t style; /*Style of edge flash effect (usually homogeneous circle)*/
uint8_t enabled : 1; /*1: Show a flash animation on the edge*/ uint8_t enabled : 1; /*1: Show a flash animation on the edge*/
uint8_t top_ip : 1; /*Used internally to show that top most position is reached (flash is In uint8_t top_ip : 1; /*Used internally to show that top most position is reached (flash is In
Progress)*/ Progress)*/

View File

@@ -33,7 +33,7 @@
**********************/ **********************/
static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * param); static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_roller_get_style(lv_obj_t * roller, uint8_t part); static lv_style_list_t * lv_roller_get_style(lv_obj_t * roller, uint8_t part);
static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param); static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param);
static void refr_position(lv_obj_t * roller, lv_anim_enable_t animen); static void refr_position(lv_obj_t * roller, lv_anim_enable_t animen);
static void refr_height(lv_obj_t * roller); static void refr_height(lv_obj_t * roller);
@@ -385,7 +385,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
lv_res_t res; lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) { if(sign == LV_SIGNAL_GET_STYLE) {
uint8_t ** type_p = param; uint8_t ** type_p = param;
lv_style_dsc_t ** style_dsc_p = param; lv_style_list_t ** style_dsc_p = param;
*style_dsc_p = lv_roller_get_style(roller, **type_p); *style_dsc_p = lv_roller_get_style(roller, **type_p);
return LV_RES_OK; return LV_RES_OK;
} }
@@ -475,12 +475,12 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
* @param part the part from `lv_roller_part_t`. (LV_ROLLER_PART_...) * @param part the part from `lv_roller_part_t`. (LV_ROLLER_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_roller_get_style(lv_obj_t * roller, uint8_t part) static lv_style_list_t * lv_roller_get_style(lv_obj_t * roller, uint8_t part)
{ {
LV_ASSERT_OBJ(roller, LV_OBJX_NAME); LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller); lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_ROLLER_PART_BG: case LV_ROLLER_PART_BG:

View File

@@ -32,7 +32,7 @@
**********************/ **********************/
static lv_design_res_t lv_slider_design(lv_obj_t * slider, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_design_res_t lv_slider_design(lv_obj_t * slider, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param); static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_slider_get_style(lv_obj_t * slider, uint8_t part); static lv_style_list_t * lv_slider_get_style(lv_obj_t * slider, uint8_t part);
static void lv_slider_position_knob(lv_obj_t * slider, lv_area_t * knob_area, lv_coord_t knob_size, bool hor); static void lv_slider_position_knob(lv_obj_t * slider, lv_area_t * knob_area, lv_coord_t knob_size, bool hor);
static void lv_slider_draw_knob(lv_obj_t * slider, const lv_area_t * knob_area, const lv_area_t * clip_area); static void lv_slider_draw_knob(lv_obj_t * slider, const lv_area_t * knob_area, const lv_area_t * clip_area);
@@ -77,7 +77,7 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, const lv_obj_t * copy)
} }
/*Initialize the allocated 'ext' */ /*Initialize the allocated 'ext' */
lv_style_dsc_init(&ext->style_knob); lv_style_list_init(&ext->style_knob);
ext->value_to_set = NULL; ext->value_to_set = NULL;
ext->dragging = false; ext->dragging = false;
@@ -394,12 +394,12 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
} }
static lv_style_dsc_t * lv_slider_get_style(lv_obj_t * slider, uint8_t part) static lv_style_list_t * lv_slider_get_style(lv_obj_t * slider, uint8_t part)
{ {
LV_ASSERT_OBJ(slider, LV_OBJX_NAME); LV_ASSERT_OBJ(slider, LV_OBJX_NAME);
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider); lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_SLIDER_PART_BG: case LV_SLIDER_PART_BG:

View File

@@ -44,7 +44,7 @@ typedef struct
{ {
lv_bar_ext_t bar; /*Ext. of ancestor*/ lv_bar_ext_t bar; /*Ext. of ancestor*/
/*New data for this type */ /*New data for this type */
lv_style_dsc_t style_knob; /*Style of the knob*/ lv_style_list_t style_knob; /*Style of the knob*/
lv_area_t left_knob_area; lv_area_t left_knob_area;
lv_area_t right_knob_area; lv_area_t right_knob_area;
int16_t *value_to_set; /* Which bar value to set */ int16_t *value_to_set; /* Which bar value to set */

View File

@@ -27,7 +27,7 @@
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * param); static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_spinbox_get_style(lv_obj_t * ta, uint8_t part); static lv_style_list_t * lv_spinbox_get_style(lv_obj_t * ta, uint8_t part);
static void lv_spinbox_updatevalue(lv_obj_t * spinbox); static void lv_spinbox_updatevalue(lv_obj_t * spinbox);
/********************** /**********************
@@ -408,12 +408,12 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
* @param part the part from `lv_spinbox_part_t`. (LV_SPINBOX_PART_...) * @param part the part from `lv_spinbox_part_t`. (LV_SPINBOX_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_spinbox_get_style(lv_obj_t * ta, uint8_t part) static lv_style_list_t * lv_spinbox_get_style(lv_obj_t * ta, uint8_t part)
{ {
LV_ASSERT_OBJ(ta, LV_OBJX_NAME); LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(ta); lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(ta);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_SPINBOX_PART_BG: case LV_SPINBOX_PART_BG:

View File

@@ -34,8 +34,8 @@
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param); static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_sw_get_style(lv_obj_t * sw, uint8_t part); static lv_style_list_t * lv_sw_get_style(lv_obj_t * sw, uint8_t part);
static lv_style_dsc_t * lv_sw_get_style(lv_obj_t * sw, uint8_t part); static lv_style_list_t * lv_sw_get_style(lv_obj_t * sw, uint8_t part);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -233,12 +233,12 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
return res; return res;
} }
static lv_style_dsc_t * lv_sw_get_style(lv_obj_t * sw, uint8_t part) static lv_style_list_t * lv_sw_get_style(lv_obj_t * sw, uint8_t part)
{ {
LV_ASSERT_OBJ(sw, LV_OBJX_NAME); LV_ASSERT_OBJ(sw, LV_OBJX_NAME);
lv_sw_ext_t * ext = lv_obj_get_ext_attr(sw); lv_sw_ext_t * ext = lv_obj_get_ext_attr(sw);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_SW_PART_BG: case LV_SW_PART_BG:

View File

@@ -46,7 +46,7 @@ static lv_design_res_t lv_ta_design(lv_obj_t * ta, const lv_area_t * clip_area,
static lv_design_res_t lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_design_res_t lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param); static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param);
static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param); static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_ta_get_style(lv_obj_t * ta, uint8_t part); static lv_style_list_t * lv_ta_get_style(lv_obj_t * ta, uint8_t part);
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
static void cursor_blink_anim(lv_obj_t * ta, lv_anim_value_t show); static void cursor_blink_anim(lv_obj_t * ta, lv_anim_value_t show);
static void pwd_char_hider_anim(lv_obj_t * ta, lv_anim_value_t x); static void pwd_char_hider_anim(lv_obj_t * ta, lv_anim_value_t x);
@@ -121,7 +121,7 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy)
ext->label = NULL; ext->label = NULL;
ext->placeholder = NULL; ext->placeholder = NULL;
lv_style_dsc_init(&ext->cursor.style); lv_style_list_init(&ext->cursor.style);
#if LV_USE_ANIMATION == 0 #if LV_USE_ANIMATION == 0
ext->pwd_show_time = 0; ext->pwd_show_time = 0;
@@ -1541,12 +1541,12 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
* @param part the part from `lv_ta_part_t`. (LV_TA_PART_...) * @param part the part from `lv_ta_part_t`. (LV_TA_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_ta_get_style(lv_obj_t * ta, uint8_t part) static lv_style_list_t * lv_ta_get_style(lv_obj_t * ta, uint8_t part)
{ {
LV_ASSERT_OBJ(ta, LV_OBJX_NAME); LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_TA_PART_BG: case LV_TA_PART_BG:

View File

@@ -54,7 +54,7 @@ typedef struct
uint16_t pwd_show_time; /*Time to show characters in password mode before change them to '*' */ uint16_t pwd_show_time; /*Time to show characters in password mode before change them to '*' */
struct struct
{ {
lv_style_dsc_t style; /* Style of the cursor (NULL to use label's style)*/ lv_style_list_t style; /* Style of the cursor (NULL to use label's style)*/
lv_coord_t valid_x; /* Used when stepping up/down to a shorter line. lv_coord_t valid_x; /* Used when stepping up/down to a shorter line.
* (Used by the library)*/ * (Used by the library)*/
uint16_t pos; /* The current cursor position uint16_t pos; /* The current cursor position

View File

@@ -29,7 +29,7 @@
**********************/ **********************/
static lv_design_res_t lv_table_design(lv_obj_t * table, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_design_res_t lv_table_design(lv_obj_t * table, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_table_signal(lv_obj_t * table, lv_signal_t sign, void * param); static lv_res_t lv_table_signal(lv_obj_t * table, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_table_get_style(lv_obj_t * table, uint8_t part); static lv_style_list_t * lv_table_get_style(lv_obj_t * table, uint8_t part);
static lv_coord_t get_row_height(lv_obj_t * table, uint16_t row_id); static lv_coord_t get_row_height(lv_obj_t * table, uint16_t row_id);
static void refr_size(lv_obj_t * table); static void refr_size(lv_obj_t * table);
@@ -80,7 +80,7 @@ lv_obj_t * lv_table_create(lv_obj_t * par, const lv_obj_t * copy)
uint16_t i; uint16_t i;
for(i = 0; i < LV_TABLE_CELL_STYLE_CNT; i++) { for(i = 0; i < LV_TABLE_CELL_STYLE_CNT; i++) {
lv_style_dsc_init(&ext->cell_style[i]); lv_style_list_init(&ext->cell_style[i]);
} }
for(i = 0; i < LV_TABLE_COL_MAX; i++) { for(i = 0; i < LV_TABLE_COL_MAX; i++) {
@@ -93,7 +93,7 @@ lv_obj_t * lv_table_create(lv_obj_t * par, const lv_obj_t * copy)
/*Init the new table table*/ /*Init the new table table*/
if(copy == NULL) { if(copy == NULL) {
lv_style_dsc_reset(&new_table->style_dsc); lv_style_list_reset(&new_table->style_dsc);
lv_obj_add_style_theme(new_table, LV_TABLE_PART_BG, LV_THEME_TABLE_BG); lv_obj_add_style_theme(new_table, LV_TABLE_PART_BG, LV_THEME_TABLE_BG);
lv_obj_add_style_theme(new_table, LV_TABLE_PART_CELL1, LV_THEME_TABLE_CELL1); lv_obj_add_style_theme(new_table, LV_TABLE_PART_CELL1, LV_THEME_TABLE_CELL1);
lv_obj_add_style_theme(new_table, LV_TABLE_PART_CELL2, LV_THEME_TABLE_CELL2); lv_obj_add_style_theme(new_table, LV_TABLE_PART_CELL2, LV_THEME_TABLE_CELL2);
@@ -827,12 +827,12 @@ static lv_res_t lv_table_signal(lv_obj_t * table, lv_signal_t sign, void * param
* @param part the part from. (LV_TABLE_PART_...) * @param part the part from. (LV_TABLE_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_table_get_style(lv_obj_t * table, uint8_t part) static lv_style_list_t * lv_table_get_style(lv_obj_t * table, uint8_t part)
{ {
LV_ASSERT_OBJ(table, LV_OBJX_NAME); LV_ASSERT_OBJ(table, LV_OBJX_NAME);
lv_table_ext_t * ext = lv_obj_get_ext_attr(table); lv_table_ext_t * ext = lv_obj_get_ext_attr(table);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_TABLE_PART_BG: case LV_TABLE_PART_BG:

View File

@@ -61,7 +61,7 @@ typedef struct
uint16_t col_cnt; uint16_t col_cnt;
uint16_t row_cnt; uint16_t row_cnt;
char ** cell_data; char ** cell_data;
lv_style_dsc_t cell_style[LV_TABLE_CELL_STYLE_CNT]; lv_style_list_t cell_style[LV_TABLE_CELL_STYLE_CNT];
lv_coord_t col_w[LV_TABLE_COL_MAX]; lv_coord_t col_w[LV_TABLE_COL_MAX];
} lv_table_ext_t; } lv_table_ext_t;

View File

@@ -38,7 +38,7 @@
**********************/ **********************/
static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * param); static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * param);
static lv_res_t tabview_scrl_signal(lv_obj_t * tabview_scrl, lv_signal_t sign, void * param); static lv_res_t tabview_scrl_signal(lv_obj_t * tabview_scrl, lv_signal_t sign, void * param);
static lv_style_dsc_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part); static lv_style_list_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part);
static void tab_btnm_event_cb(lv_obj_t * tab_btnm, lv_event_t event); static void tab_btnm_event_cb(lv_obj_t * tab_btnm, lv_event_t event);
static void tabview_realign(lv_obj_t * tabview); static void tabview_realign(lv_obj_t * tabview);
@@ -133,11 +133,11 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy)
lv_page_set_sb_mode(ext->content, LV_SB_MODE_OFF); lv_page_set_sb_mode(ext->content, LV_SB_MODE_OFF);
lv_obj_set_drag_dir(lv_page_get_scrl(ext->content), LV_DRAG_DIR_ONE); lv_obj_set_drag_dir(lv_page_get_scrl(ext->content), LV_DRAG_DIR_ONE);
lv_style_dsc_reset(lv_obj_get_style(ext->content, LV_PAGE_PART_BG)); lv_style_list_reset(lv_obj_get_style(ext->content, LV_PAGE_PART_BG));
lv_style_dsc_reset(lv_obj_get_style(ext->content, LV_PAGE_PART_SCRL)); lv_style_list_reset(lv_obj_get_style(ext->content, LV_PAGE_PART_SCRL));
lv_style_dsc_reset(lv_obj_get_style(new_tabview, LV_TABVIEW_PART_INDIC)); lv_style_list_reset(lv_obj_get_style(new_tabview, LV_TABVIEW_PART_INDIC));
lv_style_dsc_reset(lv_obj_get_style(new_tabview, LV_TABVIEW_PART_BTNS)); lv_style_list_reset(lv_obj_get_style(new_tabview, LV_TABVIEW_PART_BTNS));
lv_style_dsc_reset(lv_obj_get_style(new_tabview, LV_TABVIEW_PART_BTNS_BG)); lv_style_list_reset(lv_obj_get_style(new_tabview, LV_TABVIEW_PART_BTNS_BG));
lv_obj_reset_style(ext->content, LV_PAGE_PART_BG); lv_obj_reset_style(ext->content, LV_PAGE_PART_BG);
_ot(new_tabview, LV_TABVIEW_PART_BG_SCRL, TABVIEW_BG_SCRL); _ot(new_tabview, LV_TABVIEW_PART_BG_SCRL, TABVIEW_BG_SCRL);
@@ -219,8 +219,8 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
lv_obj_t * h = lv_page_create(ext->content, NULL); lv_obj_t * h = lv_page_create(ext->content, NULL);
lv_obj_set_size(h, lv_obj_get_width(tabview), lv_obj_get_height(ext->content)); lv_obj_set_size(h, lv_obj_get_width(tabview), lv_obj_get_height(ext->content));
lv_page_set_sb_mode(h, LV_SB_MODE_AUTO); lv_page_set_sb_mode(h, LV_SB_MODE_AUTO);
lv_style_dsc_reset(lv_obj_get_style(h, LV_PAGE_PART_BG)); lv_style_list_reset(lv_obj_get_style(h, LV_PAGE_PART_BG));
lv_style_dsc_reset(lv_obj_get_style(h, LV_PAGE_PART_SCRL)); lv_style_list_reset(lv_obj_get_style(h, LV_PAGE_PART_SCRL));
_ot(h, LV_PAGE_PART_BG, TABVIEW_TAB_BG); _ot(h, LV_PAGE_PART_BG, TABVIEW_TAB_BG);
_ot(h, LV_PAGE_PART_SCRL, TABVIEW_TAB_SCRL); _ot(h, LV_PAGE_PART_SCRL, TABVIEW_TAB_SCRL);
lv_page_set_scroll_propagation(h, true); lv_page_set_scroll_propagation(h, true);
@@ -735,12 +735,12 @@ static lv_res_t tabview_scrl_signal(lv_obj_t * tabview_scrl, lv_signal_t sign, v
* @param part the part from `lv_tabview_part_t`. (LV_TABVIEW_PART_...) * @param part the part from `lv_tabview_part_t`. (LV_TABVIEW_PART_...)
* @return pointer to the style descriptor of the specified part * @return pointer to the style descriptor of the specified part
*/ */
static lv_style_dsc_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part) static lv_style_list_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part)
{ {
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME); LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview); lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
lv_style_dsc_t * style_dsc_p; lv_style_list_t * style_dsc_p;
switch(part) { switch(part) {
case LV_TABVIEW_PART_BG: case LV_TABVIEW_PART_BG:

View File

@@ -11,15 +11,17 @@ OPTIMIZATION ?= -O3 -g0
CFLAGS ?= -I$(LVGL_DIR)/ $(DEFINES) $(WARNINGS) $(OPTIMIZATION) -I$(LVGL_DIR) -I. CFLAGS ?= -I$(LVGL_DIR)/ $(DEFINES) $(WARNINGS) $(OPTIMIZATION) -I$(LVGL_DIR) -I.
LDFLAGS ?= LDFLAGS ?= -lpng
BIN ?= demo BIN ?= demo
#Collect the files to compile #Collect the files to compile
MAINSRC = ./test_main.c MAINSRC = ./lv_test_main.c
include ../lvgl.mk include ../lvgl.mk
CSRCS += lv_test_assert.c
OBJEXT ?= .o OBJEXT ?= .o
AOBJS = $(ASRCS:.S=$(OBJEXT)) AOBJS = $(ASRCS:.S=$(OBJEXT))

View File

@@ -21,6 +21,10 @@ extern "C" {
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
uint32_t custom_tick_get(void);
#define LV_TICK_CUSTOM_SYS_TIME_EXPR custom_tick_get()
typedef int16_t lv_coord_t; typedef int16_t lv_coord_t;
typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/ typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/

View File

@@ -1,16 +0,0 @@
#include "../lvgl.h"
#include <stdio.h>
#if LV_BUILD_TEST
int main(void)
{
printf("Call lv_init...\n");
lv_init();
printf("Exit with success!\n");
return 0;
}
#endif