diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index f7066935e..826f5a6ea 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -1174,7 +1174,7 @@ void lv_obj_set_style_color(lv_obj_t * obj, uint8_t part, lv_style_property_t pr void lv_obj_set_style_value(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_set_value(&style_dsc->local, prop, value); + lv_style_set_int(&style_dsc->local, prop, value); lv_obj_refresh_style(obj, part); } @@ -2138,7 +2138,6 @@ lv_style_int_t lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_style lv_style_attr_t attr; attr.full = prop >> 8; - int16_t weight_goal = lv_obj_get_state(obj, part); int16_t weight = -1; lv_style_int_t value; @@ -2147,12 +2146,13 @@ lv_style_int_t lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_style lv_style_dsc_t * dsc = lv_obj_get_style(parent, part); if(dsc == NULL) continue; - 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); + int16_t weight_goal = state; int16_t weight_act; lv_style_int_t value_act; - weight_act = lv_style_get_value(&dsc->local, prop, &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) { @@ -2167,7 +2167,7 @@ lv_style_int_t lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_style int16_t ci; for(ci = dsc->class_cnt - 1; ci >= 0; ci--) { lv_style_t * class = lv_style_dsc_get_class(dsc, ci); - weight_act = lv_style_get_value(class, prop, &value_act); + weight_act = lv_style_get_int(class, prop, &value_act); /*On perfect match return the value immediately*/ if(weight_act == weight_goal) { return value_act; @@ -2223,9 +2223,9 @@ lv_color_t lv_obj_get_style_color(const lv_obj_t * obj, uint8_t part, lv_style_p lv_style_dsc_t * dsc = lv_obj_get_style(parent, part); if(dsc == NULL) continue; - state = lv_obj_get_state(parent, part); - int16_t weight_goal = state; + uint8_t state = lv_obj_get_state(parent, part); prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS); + int16_t weight_goal = state; int16_t weight_act; lv_color_t value_act; @@ -2325,13 +2325,12 @@ lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_prope } } - uint8_t state; + lv_style_property_t prop_ori = prop; lv_style_attr_t attr; attr.full = prop >> 8; - int16_t weight_goal = lv_obj_get_state(obj, part); int16_t weight = -1; lv_opa_t value; @@ -2340,8 +2339,9 @@ lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_prope lv_style_dsc_t * dsc = lv_obj_get_style(parent, part); if(dsc == NULL) continue; - 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); + int16_t weight_goal = state; int16_t weight_act; lv_opa_t value_act; @@ -2423,9 +2423,9 @@ void * lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_propert lv_style_dsc_t * dsc = lv_obj_get_style(parent, part); if(dsc == NULL) continue; - state = lv_obj_get_state(parent, part); - int16_t weight_goal = state; + uint8_t state = lv_obj_get_state(parent, part); prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS); + int16_t weight_goal = state; int16_t weight_act; void * value_act; diff --git a/src/lv_core/lv_style.c b/src/lv_core/lv_style.c index b69152722..dcc4cba60 100644 --- a/src/lv_core/lv_style.c +++ b/src/lv_core/lv_style.c @@ -65,11 +65,11 @@ void lv_style_built_in_init(void) 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_value(&lv_style_transp_tight, LV_STYLE_PAD_LEFT, 0); - lv_style_set_value(&lv_style_transp_tight, LV_STYLE_PAD_RIGHT, 0); - lv_style_set_value(&lv_style_transp_tight, LV_STYLE_PAD_TOP, 0); - lv_style_set_value(&lv_style_transp_tight, LV_STYLE_PAD_BOTTOM, 0); - lv_style_set_value(&lv_style_transp_tight, LV_STYLE_PAD_INNER, 0); + 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) @@ -166,7 +166,7 @@ void lv_style_reset(lv_style_t * style) style->size = 0; } -void lv_style_set_value(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) { int32_t id = get_property_index(style, prop); /*The property already exists but not sure it's state is the same*/ @@ -285,7 +285,7 @@ void lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, void * p) * Higher number is means better fit * -1 if the not found (`res` will be undefined) */ -int16_t lv_style_get_value(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) { if(style == NULL) return -1; int32_t id = get_property_index(style, prop); @@ -463,11 +463,11 @@ static void style_animator(lv_style_anim_dsc_t * dsc, lv_anim_value_t val) int16_t res2; lv_style_int_t v2; - res2 = lv_style_get_value(end, prop_act, &v2); + res2 = lv_style_get_int(end, prop_act, &v2); if(res2 >= 0) { lv_style_int_t vres = v1 + ((int32_t)((int32_t)(v2-v1) * val) >> 8); - lv_style_set_value(act, prop_act, vres); + lv_style_set_int(act, prop_act, vres); } i+= sizeof(lv_style_int_t); diff --git a/src/lv_core/lv_style.h b/src/lv_core/lv_style.h index 5236b6195..d6ef5f73d 100644 --- a/src/lv_core/lv_style.h +++ b/src/lv_core/lv_style.h @@ -298,13 +298,13 @@ void lv_style_copy(lv_style_t * dest, const lv_style_t * src); */ void lv_style_mix(const lv_style_t * start, const lv_style_t * end, lv_style_t * res, uint16_t ratio); -void lv_style_set_value(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_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); -int16_t lv_style_get_value(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_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); diff --git a/src/lv_objx/lv_calendar.c b/src/lv_objx/lv_calendar.c index 783a645fa..93dcc38f0 100644 --- a/src/lv_objx/lv_calendar.c +++ b/src/lv_objx/lv_calendar.c @@ -45,7 +45,8 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask); static void draw_day_names(lv_obj_t * calendar, const lv_area_t * mask); static void draw_days(lv_obj_t * calendar, const lv_area_t * mask); static uint8_t get_day_of_week(uint32_t year, uint32_t month, uint32_t day); -static bool is_highlighted(lv_obj_t * calendar, int32_t year, int32_t month, int32_t day); +static bool is_highlighted(lv_obj_t * calendar, day_draw_state_t draw_state, int32_t year, int32_t month, int32_t day); +static bool is_pressed(lv_obj_t * calendar, day_draw_state_t draw_state, int32_t year, int32_t month, int32_t day); static const char * get_day_name(lv_obj_t * calendar, uint8_t day); static const char * get_month_name(lv_obj_t * calendar, int32_t month); static uint8_t get_month_length(int32_t year, int32_t month); @@ -468,10 +469,10 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void * } /*If a day is pressed save it*/ else if(calculate_touched_day(calendar, &p)) { - if(ext->btn_pressing != 0) lv_obj_invalidate(calendar); ext->btn_pressing = 0; + lv_obj_invalidate(calendar); } - /*ELse set a deafault state*/ + /*ELse set a default state*/ else { if(ext->btn_pressing != 0) lv_obj_invalidate(calendar); ext->btn_pressing = 0; @@ -482,6 +483,9 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void * } else if(sign == LV_SIGNAL_PRESS_LOST) { lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar); ext->btn_pressing = 0; + ext->pressed_date.year = 0; + ext->pressed_date.month = 0; + ext->pressed_date.day = 0; lv_obj_invalidate(calendar); } else if(sign == LV_SIGNAL_RELEASED) { @@ -503,9 +507,13 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void * } else if(ext->pressed_date.year != 0) { res = lv_event_send(calendar, LV_EVENT_VALUE_CHANGED, NULL); if(res != LV_RES_OK) return res; + } ext->btn_pressing = 0; + ext->pressed_date.year = 0; + ext->pressed_date.month = 0; + ext->pressed_date.day = 0; lv_obj_invalidate(calendar); } else if(sign == LV_SIGNAL_CONTROL) { uint8_t c = *((uint8_t *)param); @@ -803,32 +811,39 @@ static void draw_days(lv_obj_t * calendar, const lv_area_t * mask) lv_draw_label_dsc_t wb_label_dsc; lv_draw_label_dsc_t tb_label_dsc; lv_draw_label_dsc_t normal_label_dsc; - lv_draw_label_dsc_t focus_label_dsc; + lv_draw_label_dsc_t chk_label_dsc; lv_draw_label_dsc_t ina_label_dsc; + lv_draw_label_dsc_t pr_label_dsc; lv_draw_label_dsc_init(&wb_label_dsc); lv_draw_label_dsc_init(&tb_label_dsc); lv_draw_label_dsc_init(&normal_label_dsc); - lv_draw_label_dsc_init(&focus_label_dsc); + lv_draw_label_dsc_init(&chk_label_dsc); lv_draw_label_dsc_init(&ina_label_dsc); + lv_draw_label_dsc_init(&pr_label_dsc); tb_label_dsc.flag = LV_TXT_FLAG_CENTER; wb_label_dsc.flag = LV_TXT_FLAG_CENTER; normal_label_dsc.flag = LV_TXT_FLAG_CENTER; - focus_label_dsc.flag = LV_TXT_FLAG_CENTER; + chk_label_dsc.flag = LV_TXT_FLAG_CENTER; ina_label_dsc.flag = LV_TXT_FLAG_CENTER; + pr_label_dsc.flag = LV_TXT_FLAG_CENTER; calendar->state = 0; lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_WEEK_BOX, &wb_label_dsc); lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_TODAY_BOX, &tb_label_dsc); lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_DATE_NUMS, &normal_label_dsc); - calendar->state = LV_OBJ_STATE_FOCUS; - lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_DATE_NUMS, &focus_label_dsc); + calendar->state = LV_OBJ_STATE_CHECKED; + lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_DATE_NUMS, &chk_label_dsc); calendar->state = LV_OBJ_STATE_DISABLED; lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_DATE_NUMS, &ina_label_dsc); + calendar->state = LV_OBJ_STATE_PRESSED; + lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_DATE_NUMS, &pr_label_dsc); + pr_label_dsc.color = LV_COLOR_RED; + calendar->state = state_ori; calendar->style_dsc.cache.enabled = 1; @@ -920,17 +935,10 @@ static void draw_days(lv_obj_t * calendar, const lv_area_t * mask) /*Get the final style : highlighted/week box/today box/normal*/ lv_draw_label_dsc_t * final_label_dsc; - if(draw_state == DAY_DRAW_PREV_MONTH && - is_highlighted(calendar, ext->showed_date.year - (ext->showed_date.month == 1 ? 1 : 0), - ext->showed_date.month == 1 ? 12 : ext->showed_date.month - 1, day_cnt)) { - final_label_dsc = &focus_label_dsc; - } else if(draw_state == DAY_DRAW_ACT_MONTH && - is_highlighted(calendar, ext->showed_date.year, ext->showed_date.month, day_cnt)) { - final_label_dsc = &focus_label_dsc; - } else if(draw_state == DAY_DRAW_NEXT_MONTH && - is_highlighted(calendar, ext->showed_date.year + (ext->showed_date.month == 12 ? 1 : 0), - ext->showed_date.month == 12 ? 1 : ext->showed_date.month + 1, day_cnt)) { - final_label_dsc = &focus_label_dsc; + if(is_pressed(calendar, draw_state, ext->showed_date.year, ext->showed_date.month, day_cnt)) { + final_label_dsc = &pr_label_dsc; + } else if(is_highlighted(calendar, draw_state, ext->showed_date.year, ext->showed_date.month, day_cnt)) { + final_label_dsc = &chk_label_dsc; } else if(month_of_today_shown && day_cnt == ext->today.day && draw_state == DAY_DRAW_ACT_MONTH) final_label_dsc = &tb_label_dsc; else if(in_week_box && draw_state == DAY_DRAW_ACT_MONTH) @@ -955,16 +963,24 @@ static void draw_days(lv_obj_t * calendar, const lv_area_t * mask) /** * Check weather a date is highlighted or not * @param calendar pointer to a calendar object + * @param draw_state which month is drawn (previous, active, next) * @param year a year * @param month a month [1..12] * @param day a day [1..31] * @return true: highlighted */ -static bool is_highlighted(lv_obj_t * calendar, int32_t year, int32_t month, int32_t day) +static bool is_highlighted(lv_obj_t * calendar, day_draw_state_t draw_state, int32_t year, int32_t month, int32_t day) { lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar); - if(ext->highlighted_dates == NULL || ext->highlighted_dates_num == 0) return false; + + if(draw_state == DAY_DRAW_PREV_MONTH) { + year -= month == 1 ? 1 : 0; + month = month == 1 ? 12 : month - 1; + } else if(draw_state == DAY_DRAW_NEXT_MONTH) { + year += month == 12 ? 1 : 0; + month = month == 12 ? 1 : month + 1; + } uint32_t i; for(i = 0; i < ext->highlighted_dates_num; i++) { @@ -977,6 +993,31 @@ static bool is_highlighted(lv_obj_t * calendar, int32_t year, int32_t month, int return false; } +/** + * Check weather a date is highlighted or not + * @param calendar pointer to a calendar object + * @param draw_state which month is drawn (previous, active, next) + * @param year a year + * @param month a month [1..12] + * @param day a day [1..31] + * @return true: highlighted + */ +static bool is_pressed(lv_obj_t * calendar, day_draw_state_t draw_state, int32_t year, int32_t month, int32_t day) +{ + lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar); + + + if(draw_state == DAY_DRAW_PREV_MONTH) { + year -= month == 1 ? 1 : 0; + month = month == 1 ? 12 : month - 1; + } else if(draw_state == DAY_DRAW_NEXT_MONTH) { + year += month == 12 ? 1 : 0; + month = month == 12 ? 1 : month + 1; + } + + if(year == ext->pressed_date.year && month == ext->pressed_date.month && day == ext->pressed_date.day) return true; + else return false; +} /** * Get the day name * @param calendar pointer to a calendar object diff --git a/src/lv_themes/lv_theme_alien.c b/src/lv_themes/lv_theme_alien.c index fc5e392fb..350609404 100644 --- a/src/lv_themes/lv_theme_alien.c +++ b/src/lv_themes/lv_theme_alien.c @@ -76,32 +76,32 @@ static void basic_init(void) lv_style_set_color(&scr, LV_STYLE_TEXT_COLOR , LV_COLOR_WHITE); lv_style_init(&transp); - lv_style_set_value(&transp, LV_STYLE_BG_OPA, LV_OPA_TRANSP); - lv_style_set_value(&transp, LV_STYLE_BORDER_WIDTH, 0); + lv_style_set_int(&transp, LV_STYLE_BG_OPA, LV_OPA_TRANSP); + lv_style_set_int(&transp, LV_STYLE_BORDER_WIDTH, 0); lv_style_init(&panel); - lv_style_set_value(&panel, LV_STYLE_PAD_LEFT, LV_DPI / 20); - lv_style_set_value(&panel, LV_STYLE_PAD_RIGHT, LV_DPI / 20); - lv_style_set_value(&panel, LV_STYLE_PAD_TOP, LV_DPI / 20); - lv_style_set_value(&panel, LV_STYLE_PAD_BOTTOM, LV_DPI / 20); - lv_style_set_value(&panel, LV_STYLE_PAD_INNER, LV_DPI / 20); - lv_style_set_value(&panel, LV_STYLE_RADIUS, LV_DPI / 16); - lv_style_set_value(&panel, LV_STYLE_BORDER_WIDTH, LV_DPI / 50 > 0 ? LV_DPI / 50 : 1); + lv_style_set_int(&panel, LV_STYLE_PAD_LEFT, LV_DPI / 20); + lv_style_set_int(&panel, LV_STYLE_PAD_RIGHT, LV_DPI / 20); + lv_style_set_int(&panel, LV_STYLE_PAD_TOP, LV_DPI / 20); + lv_style_set_int(&panel, LV_STYLE_PAD_BOTTOM, LV_DPI / 20); + lv_style_set_int(&panel, LV_STYLE_PAD_INNER, LV_DPI / 20); + lv_style_set_int(&panel, LV_STYLE_RADIUS, LV_DPI / 16); + lv_style_set_int(&panel, LV_STYLE_BORDER_WIDTH, LV_DPI / 50 > 0 ? LV_DPI / 50 : 1); lv_style_set_color(&panel, LV_STYLE_BG_COLOR, LV_COLOR_SILVER); lv_style_set_color(&panel, LV_STYLE_BG_GRAD_COLOR, LV_COLOR_BLUE); - lv_style_set_value(&panel, LV_STYLE_BG_GRAD_DIR, LV_GRAD_DIR_VER); + lv_style_set_int(&panel, LV_STYLE_BG_GRAD_DIR, LV_GRAD_DIR_VER); lv_style_set_color(&panel, LV_STYLE_BORDER_COLOR, LV_COLOR_GRAY); lv_style_set_color(&panel, LV_STYLE_TEXT_COLOR, LV_COLOR_BLACK); lv_style_init(&btn); - lv_style_set_value(&btn, LV_STYLE_PAD_LEFT, LV_DPI / 20); - lv_style_set_value(&btn, LV_STYLE_PAD_RIGHT, LV_DPI / 20); - lv_style_set_value(&btn, LV_STYLE_PAD_TOP, LV_DPI / 20); - lv_style_set_value(&btn, LV_STYLE_PAD_BOTTOM, LV_DPI / 20); - lv_style_set_value(&btn, LV_STYLE_PAD_INNER, LV_DPI / 16); - lv_style_set_value(&btn, LV_STYLE_RADIUS, 5); - lv_style_set_value(&btn, LV_STYLE_BORDER_WIDTH, 2);//LV_DPI / 50 > 0 ? LV_DPI / 50 : 1); - lv_style_set_value(&btn, LV_STYLE_BG_GRAD_DIR, LV_GRAD_DIR_VER); + lv_style_set_int(&btn, LV_STYLE_PAD_LEFT, LV_DPI / 20); + lv_style_set_int(&btn, LV_STYLE_PAD_RIGHT, LV_DPI / 20); + lv_style_set_int(&btn, LV_STYLE_PAD_TOP, LV_DPI / 20); + lv_style_set_int(&btn, LV_STYLE_PAD_BOTTOM, LV_DPI / 20); + lv_style_set_int(&btn, LV_STYLE_PAD_INNER, LV_DPI / 16); + lv_style_set_int(&btn, LV_STYLE_RADIUS, 5); + lv_style_set_int(&btn, LV_STYLE_BORDER_WIDTH, 2);//LV_DPI / 50 > 0 ? LV_DPI / 50 : 1); + lv_style_set_int(&btn, LV_STYLE_BG_GRAD_DIR, LV_GRAD_DIR_VER); lv_style_set_color(&btn, LV_STYLE_BG_COLOR, LV_COLOR_RED); lv_style_set_color(&btn, LV_STYLE_BG_GRAD_COLOR, LV_COLOR_MAROON); lv_style_set_color(&btn, LV_STYLE_BORDER_COLOR, LV_COLOR_NAVY); @@ -118,9 +118,9 @@ static void basic_init(void) // lv_style_set_opa(&btn, LV_STYLE_TEXT_OPA, LV_OPA_50); // lv_style_set_value(&btn, LV_STYLE_SHADOW_WIDTH, 5); // lv_style_set_value(&btn, LV_STYLE_SHADOW_OFFSET_Y, 10); - lv_style_set_value(&btn, LV_STYLE_BORDER_WIDTH | LV_STYLE_STATE_FOCUS, 6); + lv_style_set_int(&btn, LV_STYLE_BORDER_WIDTH | LV_STYLE_STATE_FOCUS, 6); lv_style_set_ptr(&btn, LV_STYLE_PATTERN_IMAGE | LV_STYLE_STATE_CHECKED, LV_SYMBOL_OK); - lv_style_set_value(&btn, LV_STYLE_PATTERN_REPEATE | LV_STYLE_STATE_CHECKED, 1); + lv_style_set_int(&btn, LV_STYLE_PATTERN_REPEATE | LV_STYLE_STATE_CHECKED, 1); lv_style_set_ptr(&btn, LV_STYLE_FONT | LV_STYLE_STATE_CHECKED, &lv_font_roboto_12); lv_style_init(&transp_tight); @@ -128,11 +128,11 @@ static void basic_init(void) lv_style_set_opa(&transp_tight, LV_STYLE_BORDER_OPA, LV_OPA_TRANSP); lv_style_set_opa(&transp_tight, LV_STYLE_SHADOW_OPA, LV_OPA_TRANSP); lv_style_set_opa(&transp_tight, LV_STYLE_PATTERN_OPA, LV_OPA_TRANSP); - lv_style_set_value(&transp_tight, LV_STYLE_PAD_LEFT, 0); - lv_style_set_value(&transp_tight, LV_STYLE_PAD_RIGHT, 0); - lv_style_set_value(&transp_tight, LV_STYLE_PAD_TOP, 0); - lv_style_set_value(&transp_tight, LV_STYLE_PAD_BOTTOM, 0); - lv_style_set_value(&transp_tight, LV_STYLE_PAD_INNER, 0); + lv_style_set_int(&transp_tight, LV_STYLE_PAD_LEFT, 0); + lv_style_set_int(&transp_tight, LV_STYLE_PAD_RIGHT, 0); + lv_style_set_int(&transp_tight, LV_STYLE_PAD_TOP, 0); + lv_style_set_int(&transp_tight, LV_STYLE_PAD_BOTTOM, 0); + lv_style_set_int(&transp_tight, LV_STYLE_PAD_INNER, 0); } @@ -232,10 +232,10 @@ static void bar_init(void) #if LV_USE_BAR lv_style_init(&bar_indic); lv_style_set_color(&bar_indic, LV_STYLE_BG_COLOR, LV_COLOR_BLUE); - lv_style_set_value(&bar_indic, LV_STYLE_PAD_TOP, LV_DPI/20); - lv_style_set_value(&bar_indic, LV_STYLE_PAD_BOTTOM, LV_DPI/20); - lv_style_set_value(&bar_indic, LV_STYLE_PAD_LEFT, LV_DPI/20); - lv_style_set_value(&bar_indic, LV_STYLE_PAD_RIGHT, LV_DPI/20); + lv_style_set_int(&bar_indic, LV_STYLE_PAD_TOP, LV_DPI/20); + lv_style_set_int(&bar_indic, LV_STYLE_PAD_BOTTOM, LV_DPI/20); + lv_style_set_int(&bar_indic, LV_STYLE_PAD_LEFT, LV_DPI/20); + lv_style_set_int(&bar_indic, LV_STYLE_PAD_RIGHT, LV_DPI/20); #endif } @@ -277,10 +277,10 @@ static void slider_init(void) lv_style_init(&knob); lv_style_set_color(&knob, LV_STYLE_BG_COLOR, LV_COLOR_RED); lv_style_set_color(&knob, LV_STYLE_BG_COLOR | LV_STYLE_STATE_CHECKED, LV_COLOR_LIME); - lv_style_set_value(&knob, LV_STYLE_PAD_TOP, LV_DPI/20); - lv_style_set_value(&knob, LV_STYLE_PAD_BOTTOM, LV_DPI/20); - lv_style_set_value(&knob, LV_STYLE_PAD_LEFT, LV_DPI/20); - lv_style_set_value(&knob, LV_STYLE_PAD_RIGHT, LV_DPI/20); + lv_style_set_int(&knob, LV_STYLE_PAD_TOP, LV_DPI/20); + lv_style_set_int(&knob, LV_STYLE_PAD_BOTTOM, LV_DPI/20); + lv_style_set_int(&knob, LV_STYLE_PAD_LEFT, LV_DPI/20); + lv_style_set_int(&knob, LV_STYLE_PAD_RIGHT, LV_DPI/20); #endif } @@ -299,7 +299,7 @@ static void lmeter_init(void) lv_style_set_color(&lmeter, LV_STYLE_SCALE_COLOR, LV_COLOR_AQUA); lv_style_set_color(&lmeter, LV_STYLE_SCALE_GRAD_COLOR, LV_COLOR_NAVY); lv_style_set_color(&lmeter, LV_STYLE_SCALE_END_COLOR, LV_COLOR_GRAY); - lv_style_set_value(&lmeter, LV_STYLE_LINE_WIDTH, 2); + lv_style_set_int(&lmeter, LV_STYLE_LINE_WIDTH, 2); #endif } @@ -310,15 +310,15 @@ static void gauge_init(void) lv_style_set_color(&gauge, LV_STYLE_SCALE_COLOR, LV_COLOR_AQUA); lv_style_set_color(&gauge, LV_STYLE_SCALE_GRAD_COLOR, LV_COLOR_NAVY); lv_style_set_color(&gauge, LV_STYLE_SCALE_END_COLOR, LV_COLOR_RED); - lv_style_set_value(&gauge, LV_STYLE_LINE_WIDTH, 2); + lv_style_set_int(&gauge, LV_STYLE_LINE_WIDTH, 2); lv_style_init(&gauge_strong); lv_style_set_color(&gauge_strong, LV_STYLE_SCALE_COLOR, LV_COLOR_AQUA); lv_style_set_color(&gauge_strong, LV_STYLE_SCALE_GRAD_COLOR, LV_COLOR_NAVY); lv_style_set_color(&gauge_strong, LV_STYLE_SCALE_END_COLOR, LV_COLOR_RED); - lv_style_set_value(&gauge_strong, LV_STYLE_LINE_WIDTH, 4); - lv_style_set_value(&gauge_strong, LV_STYLE_SCALE_WIDTH, LV_DPI/5); - lv_style_set_value(&gauge_strong, LV_STYLE_PAD_INNER, LV_DPI/10); + lv_style_set_int(&gauge_strong, LV_STYLE_LINE_WIDTH, 4); + lv_style_set_int(&gauge_strong, LV_STYLE_SCALE_WIDTH, LV_DPI/5); + lv_style_set_int(&gauge_strong, LV_STYLE_PAD_INNER, LV_DPI/10); #endif } @@ -447,7 +447,7 @@ static void ta_init(void) lv_style_init(&ta_cursor); lv_style_set_color(&ta_cursor, LV_STYLE_LINE_COLOR, LV_COLOR_LIME); lv_style_set_color(&ta_cursor, LV_STYLE_BG_COLOR, LV_COLOR_RED); - lv_style_set_value(&ta_cursor, LV_STYLE_LINE_WIDTH, 3); + lv_style_set_int(&ta_cursor, LV_STYLE_LINE_WIDTH, 3); // lv_style_set_color(&ta_cursor, LV_STYLE_LINE_COLOR, LV_COLOR_RED); #endif }