From bd4db19aee5a1f5f50066838ab1aa2b9c4a0de69 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 4 Aug 2020 18:52:37 +0200 Subject: [PATCH] rename lv_chart_clear_serie to lv_chart_clear_series and lv_obj_align_origo to lv_obj_align_mid --- CHANGELOG.md | 3 ++- src/lv_api_map.h | 22 ++++++++++++++++++++++ src/lv_core/lv_obj.c | 24 ++++++++++++------------ src/lv_core/lv_obj.h | 8 ++++---- src/lv_widgets/lv_chart.c | 12 ++++++------ src/lv_widgets/lv_chart.h | 4 ++-- 6 files changed, 48 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3a111429..b0748227c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,9 @@ ## v7.3.1 (planned on 18.08.2020) -### Bugfix +### 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` ## v7.3.0 (04.08.2020) 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 7ba1c6173..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 @@ -3893,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_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