diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 1b34d7088..0c08541e1 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -custom: ["https://www.paypal.com/paypalme/my/profile"] +custom: ["https://paypal.me/littlevgl?locale.x=en_US"] diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ae4be1f3..2a92f840d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,12 @@ *Available in the `dev` branch* ## v7.3.1 (planned on 18.08.2020) -*Available in the `master` branch* + +### Bugfixes +- Fix drawing value string twice +- Rename `lv_chart_clear_serie` to `lv_chart_clear_series` and `lv_obj_align_origo` to `lv_obj_align_mid` +- Add linemeter's mirror feature again +- Fix text decor (udnerline strikethrough) with older versions of font converter ## v7.3.0 (04.08.2020) diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index a30893f76..5affba5f7 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -31,4 +31,5 @@ Planned to September/October 2020 - Optmize font decompression - Switch to RGBA colors in styles - Need coverage report for tests -- Need static analize (via coverity.io or somehing else). +- Need static analize (via coverity.io or somehing else) +- Support dot_begin and dot_middle long modes for labels diff --git a/src/lv_api_map.h b/src/lv_api_map.h index 926e9ec47..d8e904e8a 100644 --- a/src/lv_api_map.h +++ b/src/lv_api_map.h @@ -200,8 +200,30 @@ static inline void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coor { lv_chart_set_y_range(chart, LV_CHART_AXIS_PRIMARY_Y, ymin, ymax); } + + +static inline void lv_chart_clear_serie(lv_obj_t * chart, lv_chart_series_t * series) +{ + lv_chart_clear_series(chart, series); +} + #endif +static inline void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs) +{ + lv_obj_align_mid(obj, base, align, x_ofs, y_ofs); +} + +static inline void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs) +{ + lv_obj_align_mid_y(obj, base, align, x_ofs); +} + +static inline void lv_obj_align_origo_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs) +{ + lv_obj_align_mid_y(obj, base, align, y_ofs); +} + #endif /*LV_USE_API_EXTENSION_V6*/ /********************** * MACROS diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index a3051e529..e8b50b0e1 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -87,7 +87,7 @@ static void refresh_children_style(lv_obj_t * obj); static void base_dir_refr_children(lv_obj_t * obj); static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, lv_coord_t x_ofs, lv_coord_t y_ofs); -static void obj_align_origo_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, +static void obj_align_mid_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, lv_coord_t x_ofs, lv_coord_t y_ofs); #if LV_USE_ANIMATION static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop, uint8_t part, lv_state_t prev_state, @@ -911,7 +911,7 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co obj->realign.xofs = x_ofs; obj->realign.yofs = y_ofs; obj->realign.base = base; - obj->realign.origo_align = 0; + obj->realign.mid_align = 0; #endif } @@ -959,7 +959,7 @@ void lv_obj_align_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_ * @param x_ofs x coordinate offset after alignment * @param y_ofs y coordinate offset after alignment */ -void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs) +void lv_obj_align_mid(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); @@ -970,7 +970,7 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, LV_ASSERT_OBJ(base, LV_OBJX_NAME); - obj_align_origo_core(obj, base, align, true, true, x_ofs, y_ofs); + obj_align_mid_core(obj, base, align, true, true, x_ofs, y_ofs); #if LV_USE_OBJ_REALIGN /*Save the last align parameters to use them in `lv_obj_realign`*/ @@ -978,7 +978,7 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, obj->realign.xofs = x_ofs; obj->realign.yofs = y_ofs; obj->realign.base = base; - obj->realign.origo_align = 1; + obj->realign.mid_align = 1; #endif } @@ -989,7 +989,7 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, * @param align type of alignment (see 'lv_align_t' enum) * @param x_ofs x coordinate offset after alignment */ -void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs) +void lv_obj_align_mid_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); @@ -1000,7 +1000,7 @@ void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t alig LV_ASSERT_OBJ(base, LV_OBJX_NAME); - obj_align_origo_core(obj, base, align, true, false, x_ofs, 0); + obj_align_mid_core(obj, base, align, true, false, x_ofs, 0); } @@ -1011,7 +1011,7 @@ void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t alig * @param align type of alignment (see 'lv_align_t' enum) * @param y_ofs y coordinate offset after alignment */ -void lv_obj_align_origo_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs) +void lv_obj_align_mid_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); @@ -1022,7 +1022,7 @@ void lv_obj_align_origo_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t alig LV_ASSERT_OBJ(base, LV_OBJX_NAME); - obj_align_origo_core(obj, base, align, true, false, 0, y_ofs); + obj_align_mid_core(obj, base, align, true, false, 0, y_ofs); } /** @@ -1034,8 +1034,8 @@ void lv_obj_realign(lv_obj_t * obj) LV_ASSERT_OBJ(obj, LV_OBJX_NAME); #if LV_USE_OBJ_REALIGN - if(obj->realign.origo_align) - lv_obj_align_origo(obj, obj->realign.base, obj->realign.align, obj->realign.xofs, obj->realign.yofs); + if(obj->realign.mid_align) + lv_obj_align_mid(obj, obj->realign.base, obj->realign.align, obj->realign.xofs, obj->realign.yofs); else lv_obj_align(obj, obj->realign.base, obj->realign.align, obj->realign.xofs, obj->realign.yofs); #else @@ -3676,6 +3676,7 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area draw_dsc.bg_opa = LV_OPA_TRANSP; draw_dsc.pattern_opa = LV_OPA_TRANSP; draw_dsc.shadow_opa = LV_OPA_TRANSP; + draw_dsc.value_opa = LV_OPA_TRANSP; lv_obj_init_draw_rect_dsc(obj, LV_OBJ_PART_MAIN, &draw_dsc); lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_OBJ_PART_MAIN); @@ -3892,7 +3893,7 @@ static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t ali else if(y_set) lv_obj_set_y(obj, new_pos.y); } -static void obj_align_origo_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, +static void obj_align_mid_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, lv_coord_t x_ofs, lv_coord_t y_ofs) { lv_coord_t new_x = lv_obj_get_x(obj); diff --git a/src/lv_core/lv_obj.h b/src/lv_core/lv_obj.h index 9815d3b9b..5d10eb3bc 100644 --- a/src/lv_core/lv_obj.h +++ b/src/lv_core/lv_obj.h @@ -162,7 +162,7 @@ typedef struct { lv_coord_t yofs; lv_align_t align; uint8_t auto_realign : 1; - uint8_t origo_align : 1; /**< 1: the origo (center of the object) was aligned with + uint8_t mid_align : 1; /**< 1: the origo (center of the object) was aligned with `lv_obj_align_origo`*/ } lv_realign_t; #endif @@ -494,7 +494,7 @@ void lv_obj_align_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_ * @param x_ofs x coordinate offset after alignment * @param y_ofs y coordinate offset after alignment */ -void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs); +void lv_obj_align_mid(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs); /** @@ -504,7 +504,7 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, * @param align type of alignment (see 'lv_align_t' enum) * @param x_ofs x coordinate offset after alignment */ -void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs); +void lv_obj_align_mid_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs); /** * Align an object's middle point to an other object vertically. @@ -513,7 +513,7 @@ void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t alig * @param align type of alignment (see 'lv_align_t' enum) * @param y_ofs y coordinate offset after alignment */ -void lv_obj_align_origo_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs); +void lv_obj_align_mid_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs); /** * Realign the object based on the last `lv_obj_align` parameters. diff --git a/src/lv_draw/lv_draw_label.c b/src/lv_draw/lv_draw_label.c index 30c19404e..113393e34 100644 --- a/src/lv_draw/lv_draw_label.c +++ b/src/lv_draw/lv_draw_label.c @@ -216,11 +216,11 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area sel_end = tmp; } lv_draw_line_dsc_t line_dsc; - //dsc->decor = LV_TEXT_DECOR_UNDERLINE; + if((dsc->decor & LV_TEXT_DECOR_UNDERLINE) || (dsc->decor & LV_TEXT_DECOR_STRIKETHROUGH)) { lv_draw_line_dsc_init(&line_dsc); line_dsc.color = dsc->color; - line_dsc.width = font->underline_thickness; + line_dsc.width = font->underline_thickness ? font->underline_thickness : LV_MATH_MAX(font->line_height / 10, 1); line_dsc.opa = dsc->opa; line_dsc.blend_mode = dsc->blend_mode; } diff --git a/src/lv_themes/lv_theme_empty.c b/src/lv_themes/lv_theme_empty.c index 821bbd510..6900ef23c 100644 --- a/src/lv_themes/lv_theme_empty.c +++ b/src/lv_themes/lv_theme_empty.c @@ -95,7 +95,7 @@ lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_seco } -void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name) +static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name) { LV_UNUSED(th); if(name == LV_THEME_SCR) { diff --git a/src/lv_widgets/lv_chart.c b/src/lv_widgets/lv_chart.c index d7308cf88..c77ecd858 100644 --- a/src/lv_widgets/lv_chart.c +++ b/src/lv_widgets/lv_chart.c @@ -207,23 +207,23 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color) /** * Clear the point of a series * @param chart pointer to a chart object - * @param serie pointer to the chart's series to clear + * @param series pointer to the chart's series to clear */ -void lv_chart_clear_serie(lv_obj_t * chart, lv_chart_series_t * serie) +void lv_chart_clear_series(lv_obj_t * chart, lv_chart_series_t * series) { LV_ASSERT_OBJ(chart, LV_OBJX_NAME); - LV_ASSERT_NULL(serie); + LV_ASSERT_NULL(series); - if(chart == NULL || serie == NULL) return; + if(chart == NULL || series == NULL) return; lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); if(ext == NULL) return; uint32_t i; for(i = 0; i < ext->point_cnt; i++) { - serie->points[i] = LV_CHART_POINT_DEF; + series->points[i] = LV_CHART_POINT_DEF; } - serie->start_point = 0; + series->start_point = 0; } /*===================== diff --git a/src/lv_widgets/lv_chart.h b/src/lv_widgets/lv_chart.h index e35c696c7..6f3deed8d 100644 --- a/src/lv_widgets/lv_chart.h +++ b/src/lv_widgets/lv_chart.h @@ -139,9 +139,9 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color); /** * Clear the point of a series * @param chart pointer to a chart object - * @param serie pointer to the chart's series to clear + * @param series pointer to the chart's series to clear */ -void lv_chart_clear_serie(lv_obj_t * chart, lv_chart_series_t * serie); +void lv_chart_clear_series(lv_obj_t * chart, lv_chart_series_t * series); /*===================== * Setter functions diff --git a/src/lv_widgets/lv_linemeter.c b/src/lv_widgets/lv_linemeter.c index c8e7ae724..d8043f876 100644 --- a/src/lv_widgets/lv_linemeter.c +++ b/src/lv_widgets/lv_linemeter.c @@ -392,15 +392,15 @@ void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uin lv_coord_t x_ofs = lmeter->coords.x1 + r_out + left; lv_coord_t y_ofs = lmeter->coords.y1 + r_out + top; int16_t angle_ofs = ext->angle_ofs + 90 + (360 - ext->scale_angle) / 2; - int16_t level = - (int32_t)((int32_t)(ext->cur_value - ext->min_value) * (ext->line_cnt - 1)) / (ext->max_value - ext->min_value); + int16_t level = ext->mirrored ? + (int32_t)((int32_t)(ext->max_value - ext->cur_value) * (ext->line_cnt - 1)) / (ext->max_value - ext->min_value) : + (int32_t)((int32_t)(ext->cur_value - ext->min_value) * (ext->line_cnt - 1)) / (ext->max_value - ext->min_value); uint8_t i; lv_color_t main_color = lv_obj_get_style_line_color(lmeter, part); lv_color_t grad_color = lv_obj_get_style_scale_grad_color(lmeter, part); lv_color_t end_color = lv_obj_get_style_scale_end_color(lmeter, part); - lv_draw_line_dsc_t line_dsc; lv_draw_line_dsc_init(&line_dsc); lv_obj_init_draw_line_dsc(lmeter, part, &line_dsc); @@ -520,11 +520,11 @@ void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uin p1.y = y_out_extra; /* Set the color of the lines */ - if(i > level) { + uint16_t index = ext->mirrored ? ext->line_cnt - i : i; + if((!ext->mirrored && i >= level) || (ext->mirrored && i <= level)) { line_dsc.color = end_color; line_dsc.width = end_line_width; - } - else { + } else { line_dsc.color = lv_color_mix(grad_color, main_color, (255 * i) / ext->line_cnt); }