From 6fb4235c667750295716cb40cc061a29b03e11a8 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 20 Oct 2020 13:32:57 +0200 Subject: [PATCH] prepare to release v7.7.0 --- library.json | 2 +- library.properties | 2 +- lvgl.h | 2 +- src/lv_conf_internal.h | 32 ++++- src/lv_core/lv_obj.c | 6 +- src/lv_draw/lv_draw_blend.c | 2 +- src/lv_draw/lv_draw_img.c | 2 +- src/lv_draw/lv_draw_rect.c | 8 +- src/lv_font/lv_font_montserrat_10.c | 17 +-- src/lv_font/lv_font_montserrat_8.c | 17 +-- src/lv_gpu/lv_gpu_nxp_vglite.c | 12 +- src/lv_themes/lv_theme_material.c | 23 ++-- src/lv_themes/lv_theme_mono.c | 23 ++-- src/lv_themes/lv_theme_template.c | 21 ++-- src/lv_widgets/lv_calendar.c | 6 +- src/lv_widgets/lv_chart.c | 173 ++++++++++++++-------------- src/lv_widgets/lv_chart.h | 2 +- src/lv_widgets/lv_cont.c | 5 +- src/lv_widgets/lv_table.c | 28 ++--- src/lv_widgets/lv_table.h | 9 +- 20 files changed, 206 insertions(+), 186 deletions(-) diff --git a/library.json b/library.json index d74ee907e..7bb94041d 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "lvgl", - "version": "7.6.1", + "version": "7.7.0", "keywords": "graphics, gui, embedded, tft, lvgl", "description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.", "repository": { diff --git a/library.properties b/library.properties index 0f9594804..f62ca30ab 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=lvgl -version=7.6.1 +version=7.7.0 author=kisvegabor maintainer=kisvegabor,embeddedt,pete-pjb sentence=Full-featured Graphics Library for Embedded Systems diff --git a/lvgl.h b/lvgl.h index d40b3fae4..58f3d5ce3 100644 --- a/lvgl.h +++ b/lvgl.h @@ -17,7 +17,7 @@ extern "C" { #define LVGL_VERSION_MAJOR 7 #define LVGL_VERSION_MINOR 7 #define LVGL_VERSION_PATCH 0 -#define LVGL_VERSION_INFO "dev" +#define LVGL_VERSION_INFO "" /********************* * INCLUDES diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index 3146c44b1..72993190c 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -478,7 +478,11 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ /*1: Use PXP for CPU off-load on NXP RTxxx platforms */ #ifndef LV_USE_GPU_NXP_PXP -#define LV_USE_GPU_NXP_PXP 0 +# ifdef CONFIG_LV_USE_GPU_NXP_PXP +# define LV_USE_GPU_NXP_PXP CONFIG_LV_USE_GPU_NXP_PXP +# else +# define LV_USE_GPU_NXP_PXP 0 +# endif #endif /*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) @@ -487,12 +491,20 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init() * */ #ifndef LV_USE_GPU_NXP_PXP_AUTO_INIT -#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 +# ifdef CONFIG_LV_USE_GPU_NXP_PXP_AUTO_INIT +# define LV_USE_GPU_NXP_PXP_AUTO_INIT CONFIG_LV_USE_GPU_NXP_PXP_AUTO_INIT +# else +# define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 +# endif #endif /*1: Use VG-Lite for CPU offload on NXP RTxxx platforms */ #ifndef LV_USE_GPU_NXP_VG_LITE -#define LV_USE_GPU_NXP_VG_LITE 0 +# ifdef CONFIG_LV_USE_GPU_NXP_VG_LITE +# define LV_USE_GPU_NXP_VG_LITE CONFIG_LV_USE_GPU_NXP_VG_LITE +# else +# define LV_USE_GPU_NXP_VG_LITE 0 +# endif #endif /* 1: Enable file system (might be required for images */ @@ -621,7 +633,11 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ /* Required alignment size for buffers */ #ifndef LV_ATTRIBUTE_MEM_ALIGN_SIZE -#define LV_ATTRIBUTE_MEM_ALIGN_SIZE +# ifdef CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE +# define LV_ATTRIBUTE_MEM_ALIGN_SIZE CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE +# else +# define LV_ATTRIBUTE_MEM_ALIGN_SIZE +# endif #endif /* With size optimization (-Os) the compiler might not align data to @@ -1874,7 +1890,15 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ # define LV_TABLE_COL_MAX 12 # endif #endif +#ifndef LV_TABLE_CELL_STYLE_CNT +# ifdef CONFIG_LV_TABLE_CELL_STYLE_CNT +# define LV_TABLE_CELL_STYLE_CNT CONFIG_LV_TABLE_CELL_STYLE_CNT +# else +# define LV_TABLE_CELL_STYLE_CNT 4 +# endif #endif +#endif + /*Tab (dependencies: lv_page, lv_btnm)*/ #ifndef LV_USE_TABVIEW diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index 888fe2927..88e44b023 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -3526,8 +3526,8 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint8_t part, lv_draw_label_dsc_ draw_dsc->font = lv_obj_get_style_text_font(obj, part); if(draw_dsc->sel_start != LV_DRAW_LABEL_NO_TXT_SEL && draw_dsc->sel_end != LV_DRAW_LABEL_NO_TXT_SEL) { - draw_dsc->sel_color = lv_obj_get_style_text_sel_color(obj, part); - draw_dsc->sel_bg_color = lv_obj_get_style_text_sel_bg_color(obj, part); + draw_dsc->sel_color = lv_obj_get_style_text_sel_color(obj, part); + draw_dsc->sel_bg_color = lv_obj_get_style_text_sel_bg_color(obj, part); } #if LV_USE_BIDI @@ -4091,7 +4091,7 @@ static void report_style_mod_core(void * style, lv_obj_t * obj) for(ci = 0; ci < list->style_cnt; ci++) { /* changed class to _class to allow compilation as c++ */ lv_style_t * _class = lv_style_list_get_style(list, ci); - if(_class == style || style == NULL) { + if(_class == style || style == NULL) { lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL); break; } diff --git a/src/lv_draw/lv_draw_blend.c b/src/lv_draw/lv_draw_blend.c index 4262fde30..326a2d078 100644 --- a/src/lv_draw/lv_draw_blend.c +++ b/src/lv_draw/lv_draw_blend.c @@ -757,7 +757,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col if(opa > LV_OPA_MAX) { #if LV_USE_GPU_NXP_PXP - if (lv_area_get_size(draw_area) >= GPU_NXP_PXP_BLIT_SIZE_LIMIT) { + if(lv_area_get_size(draw_area) >= GPU_NXP_PXP_BLIT_SIZE_LIMIT) { lv_gpu_nxp_pxp_blit(disp_buf_first, disp_w, map_buf_first, map_w, draw_area_w, draw_area_h, opa); return; } diff --git a/src/lv_draw/lv_draw_img.c b/src/lv_draw/lv_draw_img.c index 4165e094f..1e6de095f 100644 --- a/src/lv_draw/lv_draw_img.c +++ b/src/lv_draw/lv_draw_img.c @@ -14,7 +14,7 @@ #include "../lv_misc/lv_mem.h" #include "../lv_misc/lv_math.h" #if LV_USE_GPU_STM32_DMA2D -#include "../lv_gpu/lv_gpu_stm32_dma2d.h" + #include "../lv_gpu/lv_gpu_stm32_dma2d.h" #elif LV_USE_GPU_NXP_PXP #include "../lv_gpu/lv_gpu_nxp_pxp.h" #endif diff --git a/src/lv_draw/lv_draw_rect.c b/src/lv_draw/lv_draw_rect.c index 77d685806..4d41d4405 100644 --- a/src/lv_draw/lv_draw_rect.c +++ b/src/lv_draw/lv_draw_rect.c @@ -51,7 +51,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t static void draw_value_str(const lv_area_t * coords, const lv_area_t * clip, const lv_draw_rect_dsc_t * dsc); #endif static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * area_outer, const lv_area_t * clip, - lv_coord_t radius, bool radius_is_in, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode); + lv_coord_t radius, bool radius_is_in, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode); LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(const lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i); /********************** @@ -410,7 +410,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv area_inner.y2 -= ((dsc->border_side & LV_BORDER_SIDE_BOTTOM) ? dsc->border_width : - (dsc->border_width + rout)); if(dsc->border_side == LV_BORDER_SIDE_FULL) { - draw_full_border(&area_inner, coords, clip, dsc->radius, false, dsc->border_color, dsc->border_opa, dsc->border_blend_mode); + draw_full_border(&area_inner, coords, clip, dsc->radius, false, dsc->border_color, dsc->border_opa, + dsc->border_blend_mode); } else { lv_opa_t opa = dsc->border_opa; @@ -1347,7 +1348,8 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are /*Get the outer area*/ rout = rin + border_width; - } else { + } + else { rout = radius; int32_t short_side = LV_MATH_MIN(coords_out_w, coords_out_h); if(rout > short_side >> 1) rout = short_side >> 1; diff --git a/src/lv_font/lv_font_montserrat_10.c b/src/lv_font/lv_font_montserrat_10.c index 517908433..3f42da8b1 100644 --- a/src/lv_font/lv_font_montserrat_10.c +++ b/src/lv_font/lv_font_montserrat_10.c @@ -7,7 +7,7 @@ ******************************************************************************/ #ifndef LV_FONT_MONTSERRAT_10 -#define LV_FONT_MONTSERRAT_10 1 + #define LV_FONT_MONTSERRAT_10 1 #endif #if LV_FONT_MONTSERRAT_10 @@ -1126,8 +1126,7 @@ static const uint16_t unicode_list_1[] = { }; /*Collect the unicode lists and glyph_id offsets*/ -static const lv_font_fmt_txt_cmap_t cmaps[] = -{ +static const lv_font_fmt_txt_cmap_t cmaps[] = { { .range_start = 32, .range_length = 95, .glyph_id_start = 1, .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY @@ -1144,8 +1143,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = /*Map glyph_ids to kern left classes*/ -static const uint8_t kern_left_class_mapping[] = -{ +static const uint8_t kern_left_class_mapping[] = { 0, 0, 1, 2, 0, 3, 4, 5, 2, 6, 7, 8, 9, 10, 9, 10, 11, 12, 0, 13, 14, 15, 16, 17, @@ -1169,8 +1167,7 @@ static const uint8_t kern_left_class_mapping[] = }; /*Map glyph_ids to kern right classes*/ -static const uint8_t kern_right_class_mapping[] = -{ +static const uint8_t kern_right_class_mapping[] = { 0, 0, 1, 2, 0, 3, 4, 5, 2, 6, 7, 8, 9, 10, 9, 10, 11, 12, 13, 14, 15, 16, 17, 12, @@ -1194,8 +1191,7 @@ static const uint8_t kern_right_class_mapping[] = }; /*Kern values between classes*/ -static const int8_t kern_class_values[] = -{ +static const int8_t kern_class_values[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, @@ -1574,8 +1570,7 @@ static const int8_t kern_class_values[] = /*Collect the kern class' data in one place*/ -static const lv_font_fmt_txt_kern_classes_t kern_classes = -{ +static const lv_font_fmt_txt_kern_classes_t kern_classes = { .class_pair_values = kern_class_values, .left_class_mapping = kern_left_class_mapping, .right_class_mapping = kern_right_class_mapping, diff --git a/src/lv_font/lv_font_montserrat_8.c b/src/lv_font/lv_font_montserrat_8.c index 635ae50a3..ae766a7d2 100644 --- a/src/lv_font/lv_font_montserrat_8.c +++ b/src/lv_font/lv_font_montserrat_8.c @@ -7,7 +7,7 @@ ******************************************************************************/ #ifndef LV_FONT_MONTSERRAT_8 -#define LV_FONT_MONTSERRAT_8 1 + #define LV_FONT_MONTSERRAT_8 1 #endif #if LV_FONT_MONTSERRAT_8 @@ -918,8 +918,7 @@ static const uint16_t unicode_list_1[] = { }; /*Collect the unicode lists and glyph_id offsets*/ -static const lv_font_fmt_txt_cmap_t cmaps[] = -{ +static const lv_font_fmt_txt_cmap_t cmaps[] = { { .range_start = 32, .range_length = 95, .glyph_id_start = 1, .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY @@ -936,8 +935,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = /*Map glyph_ids to kern left classes*/ -static const uint8_t kern_left_class_mapping[] = -{ +static const uint8_t kern_left_class_mapping[] = { 0, 0, 1, 2, 0, 3, 4, 5, 2, 6, 7, 8, 9, 10, 9, 10, 11, 12, 0, 13, 14, 15, 16, 17, @@ -961,8 +959,7 @@ static const uint8_t kern_left_class_mapping[] = }; /*Map glyph_ids to kern right classes*/ -static const uint8_t kern_right_class_mapping[] = -{ +static const uint8_t kern_right_class_mapping[] = { 0, 0, 1, 2, 0, 3, 4, 5, 2, 6, 7, 8, 9, 10, 9, 10, 11, 12, 13, 14, 15, 16, 17, 12, @@ -986,8 +983,7 @@ static const uint8_t kern_right_class_mapping[] = }; /*Kern values between classes*/ -static const int8_t kern_class_values[] = -{ +static const int8_t kern_class_values[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, @@ -1366,8 +1362,7 @@ static const int8_t kern_class_values[] = /*Collect the kern class' data in one place*/ -static const lv_font_fmt_txt_kern_classes_t kern_classes = -{ +static const lv_font_fmt_txt_kern_classes_t kern_classes = { .class_pair_values = kern_class_values, .left_class_mapping = kern_left_class_mapping, .right_class_mapping = kern_right_class_mapping, diff --git a/src/lv_gpu/lv_gpu_nxp_vglite.c b/src/lv_gpu/lv_gpu_nxp_vglite.c index c3ced9264..ba4d708ab 100644 --- a/src/lv_gpu/lv_gpu_nxp_vglite.c +++ b/src/lv_gpu/lv_gpu_nxp_vglite.c @@ -131,7 +131,7 @@ lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv err |= vg_lite_init_path(&path, VG_LITE_S16, VG_LITE_LOW, sizeof(path_data), path_data, - fill_area->x1, fill_area->y1, fill_area->x2 + 1, fill_area->y2 + 1); + fill_area->x1, fill_area->y1, fill_area->x2 + 1, fill_area->y2 + 1); if(err != VG_LITE_SUCCESS) { #if LV_GPU_NXP_VG_LITE_LOG_ERRORS LV_LOG_ERROR("vg_lite_init_path() failed."); @@ -194,9 +194,9 @@ lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit) return LV_RES_OK; /* Nothing to BLIT */ } - if (!blit) { - /* Wrong parameter */ - return LV_RES_INV; + if(!blit) { + /* Wrong parameter */ + return LV_RES_INV; } /* Wrap src/dst buffer into VG-Lite buffer */ @@ -230,8 +230,8 @@ lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit) uint32_t color; vg_lite_blend_t blend; if(blit->opa >= LV_OPA_MAX) { - color = 0x0; - blend = VG_LITE_BLEND_NONE; + color = 0x0; + blend = VG_LITE_BLEND_NONE; } else { color = ((blit->opa) << 24) | ((blit->opa) << 16) | ((blit->opa) << 8) | (blit->opa); diff --git a/src/lv_themes/lv_theme_material.c b/src/lv_themes/lv_theme_material.c index 372f8a0e8..2dfe8e4a4 100644 --- a/src/lv_themes/lv_theme_material.c +++ b/src/lv_themes/lv_theme_material.c @@ -1264,21 +1264,20 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name) break; #endif #if LV_USE_TABLE - case LV_THEME_TABLE: - { - list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG); - _lv_style_list_add_style(list, &styles->bg); + case LV_THEME_TABLE: { + list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG); + _lv_style_list_add_style(list, &styles->bg); - int idx = 1; /* start value should be 1, not zero, since cell styles + int idx = 1; /* start value should be 1, not zero, since cell styles start at 1 due to presence of LV_TABLE_PART_BG=0 - in the enum (lv_table.h) */ - /* declaring idx outside loop to work with older compilers */ - for (;idx <= LV_TABLE_CELL_STYLE_CNT; idx ++ ) { - list = lv_obj_get_style_list(obj, idx); - _lv_style_list_add_style(list, &styles->table_cell); + in the enum (lv_table.h) */ + /* declaring idx outside loop to work with older compilers */ + for(; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++) { + list = lv_obj_get_style_list(obj, idx); + _lv_style_list_add_style(list, &styles->table_cell); + } + break; } - break; - } #endif #if LV_USE_WIN diff --git a/src/lv_themes/lv_theme_mono.c b/src/lv_themes/lv_theme_mono.c index 6c8a8bfaf..bfd12652b 100644 --- a/src/lv_themes/lv_theme_mono.c +++ b/src/lv_themes/lv_theme_mono.c @@ -888,22 +888,21 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name) break; #endif #if LV_USE_TABLE - case LV_THEME_TABLE: - { - list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG); - _lv_style_list_add_style(list, &styles->bg); + case LV_THEME_TABLE: { + list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG); + _lv_style_list_add_style(list, &styles->bg); - int idx = 1; /* start value should be 1, not zero, since cell styles + int idx = 1; /* start value should be 1, not zero, since cell styles start at 1 due to presence of LV_TABLE_PART_BG=0 in the enum (lv_table.h) */ - /* declaring idx outside loop to work with older compilers */ - for (; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++ ) { - list = lv_obj_get_style_list(obj, idx); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->no_radius); + /* declaring idx outside loop to work with older compilers */ + for(; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++) { + list = lv_obj_get_style_list(obj, idx); + _lv_style_list_add_style(list, &styles->bg); + _lv_style_list_add_style(list, &styles->no_radius); + } + break; } - break; - } #endif #if LV_USE_WIN diff --git a/src/lv_themes/lv_theme_template.c b/src/lv_themes/lv_theme_template.c index 1ee89979c..f9154d844 100644 --- a/src/lv_themes/lv_theme_template.c +++ b/src/lv_themes/lv_theme_template.c @@ -727,21 +727,20 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name) break; #endif #if LV_USE_TABLE - case LV_THEME_TABLE: - { - list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG); - _lv_style_list_add_style(list, &styles->bg); + case LV_THEME_TABLE: { + list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG); + _lv_style_list_add_style(list, &styles->bg); - int idx = 1; /* start value should be 1, not zero, since cell styles + int idx = 1; /* start value should be 1, not zero, since cell styles start at 1 due to presence of LV_TABLE_PART_BG=0 in the enum (lv_table.h) */ - /* declaring idx outside loop to work with older compilers */ - for (; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++ ) { - list = lv_obj_get_style_list(obj, idx); - _lv_style_list_add_style(list, &styles->bg); + /* declaring idx outside loop to work with older compilers */ + for(; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++) { + list = lv_obj_get_style_list(obj, idx); + _lv_style_list_add_style(list, &styles->bg); + } + break; } - break; - } #endif #if LV_USE_WIN diff --git a/src/lv_widgets/lv_calendar.c b/src/lv_widgets/lv_calendar.c index 505cdc6ce..9aa6f3381 100644 --- a/src/lv_widgets/lv_calendar.c +++ b/src/lv_widgets/lv_calendar.c @@ -651,9 +651,9 @@ static lv_coord_t get_header_height(lv_obj_t * calendar) { const lv_font_t * font = lv_obj_get_style_text_font(calendar, LV_CALENDAR_PART_HEADER); lv_style_int_t top = lv_obj_get_style_margin_top(calendar, LV_CALENDAR_PART_HEADER) + - lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_HEADER); + lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_HEADER); lv_style_int_t bottom = lv_obj_get_style_margin_bottom(calendar, LV_CALENDAR_PART_HEADER) + - lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_HEADER); + lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_HEADER); return lv_font_get_line_height(font) + top + bottom; } @@ -690,7 +690,7 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask) header_area.x2 = calendar->coords.x2; header_area.y1 = calendar->coords.y1 + lv_obj_get_style_margin_top(calendar, LV_CALENDAR_PART_HEADER); header_area.y2 = header_area.y1 + lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_HEADER) + - lv_font_get_line_height(font) + lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_HEADER); + lv_font_get_line_height(font) + lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_HEADER); lv_draw_rect_dsc_t header_rect_dsc; lv_draw_rect_dsc_init(&header_rect_dsc); diff --git a/src/lv_widgets/lv_chart.c b/src/lv_widgets/lv_chart.c index 055bccc14..481f15b93 100644 --- a/src/lv_widgets/lv_chart.c +++ b/src/lv_widgets/lv_chart.c @@ -658,12 +658,12 @@ void lv_chart_set_series_axis(lv_obj_t * chart, lv_chart_series_t * ser, lv_char */ void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_point_t * point) { - LV_ASSERT_NULL(cursor); - LV_UNUSED(chart); + LV_ASSERT_NULL(cursor); + LV_UNUSED(chart); - cursor->point.x = point->x; - cursor->point.y = point->y; - lv_chart_refresh(chart); + cursor->point.x = point->x; + cursor->point.y = point->y; + lv_chart_refresh(chart); } /*===================== @@ -787,42 +787,43 @@ uint16_t lv_chart_get_nearest_index_from_coord(lv_obj_t * chart, lv_coord_t x) */ lv_coord_t lv_chart_get_x_from_index(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id) { - LV_ASSERT_NULL(chart); - LV_ASSERT_NULL(ser); + LV_ASSERT_NULL(chart); + LV_ASSERT_NULL(ser); - lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); - if(id >= ext->point_cnt) { - LV_LOG_WARN("Invalid index: %d", id); - return 0; - } + lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); + if(id >= ext->point_cnt) { + LV_LOG_WARN("Invalid index: %d", id); + return 0; + } - lv_area_t series_area; - lv_chart_get_series_area(chart, &series_area); + lv_area_t series_area; + lv_chart_get_series_area(chart, &series_area); - lv_coord_t w = lv_area_get_width(&series_area); + lv_coord_t w = lv_area_get_width(&series_area); - lv_coord_t x = 0; + lv_coord_t x = 0; - if(ext->type & LV_CHART_TYPE_LINE) { - x = (w * id) / (ext->point_cnt - 1); - } else if(ext->type & LV_CHART_TYPE_COLUMN) { - lv_coord_t col_w = w / ((_lv_ll_get_len(&ext->series_ll) + 1) * ext->point_cnt); /* Suppose + 1 series as separator*/ - lv_chart_series_t * itr_ser = NULL; - lv_style_int_t col_space = lv_obj_get_style_pad_inner(chart, LV_CHART_PART_SERIES); + if(ext->type & LV_CHART_TYPE_LINE) { + x = (w * id) / (ext->point_cnt - 1); + } + else if(ext->type & LV_CHART_TYPE_COLUMN) { + lv_coord_t col_w = w / ((_lv_ll_get_len(&ext->series_ll) + 1) * ext->point_cnt); /* Suppose + 1 series as separator*/ + lv_chart_series_t * itr_ser = NULL; + lv_style_int_t col_space = lv_obj_get_style_pad_inner(chart, LV_CHART_PART_SERIES); - x = (int32_t)((int32_t)w * id) / ext->point_cnt; - x += col_w / 2; /*Start offset*/ + x = (int32_t)((int32_t)w * id) / ext->point_cnt; + x += col_w / 2; /*Start offset*/ - _LV_LL_READ_BACK(ext->series_ll, itr_ser) { - if(itr_ser == ser) break; - x += col_w; - } + _LV_LL_READ_BACK(ext->series_ll, itr_ser) { + if(itr_ser == ser) break; + x += col_w; + } - x += (col_w - col_space) / 2; - } + x += (col_w - col_space) / 2; + } - return x; + return x; } /** @@ -835,25 +836,25 @@ lv_coord_t lv_chart_get_x_from_index(lv_obj_t * chart, lv_chart_series_t * ser, */ lv_coord_t lv_chart_get_y_from_index(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id) { - LV_ASSERT_NULL(chart); - LV_ASSERT_NULL(ser); + LV_ASSERT_NULL(chart); + LV_ASSERT_NULL(ser); - lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); - if(id >= ext->point_cnt) { - LV_LOG_WARN("Invalid index: %d", id); - return 0; - } + lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); + if(id >= ext->point_cnt) { + LV_LOG_WARN("Invalid index: %d", id); + return 0; + } - lv_area_t series_area; - lv_chart_get_series_area(chart, &series_area); + lv_area_t series_area; + lv_chart_get_series_area(chart, &series_area); - lv_coord_t h = lv_area_get_height(&series_area); + lv_coord_t h = lv_area_get_height(&series_area); - int32_t y = (int32_t)((int32_t)ser->points[id] - ext->ymin[ser->y_axis]) * h; - y = y / (ext->ymax[ser->y_axis] - ext->ymin[ser->y_axis]); - y = h - y; + int32_t y = (int32_t)((int32_t)ser->points[id] - ext->ymin[ser->y_axis]) * h; + y = y / (ext->ymax[ser->y_axis] - ext->ymin[ser->y_axis]); + y = h - y; - return (lv_coord_t)y; + return (lv_coord_t)y; } /** @@ -1327,55 +1328,55 @@ static void draw_cursors(lv_obj_t * chart, const lv_area_t * series_area, const /*Go through all cursor lines*/ _LV_LL_READ_BACK(ext->cursors_ll, cursor) { - line_dsc.color = cursor->color; - point_dsc.bg_color = cursor->color; + line_dsc.color = cursor->color; + point_dsc.bg_color = cursor->color; - if(cursor->axes & LV_CHART_CURSOR_RIGHT) { - p1.x = series_area->x1 + cursor->point.x; - p1.y = series_area->y1 + cursor->point.y; - p2.x = series_area->x2; - p2.y = p1.y; - lv_draw_line(&p1, &p2, &series_mask, &line_dsc); - } + if(cursor->axes & LV_CHART_CURSOR_RIGHT) { + p1.x = series_area->x1 + cursor->point.x; + p1.y = series_area->y1 + cursor->point.y; + p2.x = series_area->x2; + p2.y = p1.y; + lv_draw_line(&p1, &p2, &series_mask, &line_dsc); + } - if(cursor->axes & LV_CHART_CURSOR_UP) { + if(cursor->axes & LV_CHART_CURSOR_UP) { - p1.x = series_area->x1 + cursor->point.x; - p1.y = series_area->y1; - p2.x = p1.x; - p2.y = series_area->y1 + cursor->point.y; - lv_draw_line(&p1, &p2, &series_mask, &line_dsc); - } + p1.x = series_area->x1 + cursor->point.x; + p1.y = series_area->y1; + p2.x = p1.x; + p2.y = series_area->y1 + cursor->point.y; + lv_draw_line(&p1, &p2, &series_mask, &line_dsc); + } - if(cursor->axes & LV_CHART_CURSOR_LEFT) { - p1.x = series_area->x1; - p1.y = series_area->y1 + cursor->point.y; - p2.x = p1.x + cursor->point.x; - p2.y = p1.y; - lv_draw_line(&p1, &p2, &series_mask, &line_dsc); - } + if(cursor->axes & LV_CHART_CURSOR_LEFT) { + p1.x = series_area->x1; + p1.y = series_area->y1 + cursor->point.y; + p2.x = p1.x + cursor->point.x; + p2.y = p1.y; + lv_draw_line(&p1, &p2, &series_mask, &line_dsc); + } - if(cursor->axes & LV_CHART_CURSOR_DOWN) { + if(cursor->axes & LV_CHART_CURSOR_DOWN) { - p1.x = series_area->x1 + cursor->point.x; - p1.y = series_area->y1 + cursor->point.y; - p2.x = p1.x; - p2.y = series_area->y2; - lv_draw_line(&p1, &p2, &series_mask, &line_dsc); - } + p1.x = series_area->x1 + cursor->point.x; + p1.y = series_area->y1 + cursor->point.y; + p2.x = p1.x; + p2.y = series_area->y2; + lv_draw_line(&p1, &p2, &series_mask, &line_dsc); + } - if(point_radius) { - lv_area_t point_area; + if(point_radius) { + lv_area_t point_area; - point_area.x1 = series_area->x1 + cursor->point.x - point_radius; - point_area.x2 = series_area->x1 + cursor->point.x + point_radius; + point_area.x1 = series_area->x1 + cursor->point.x - point_radius; + point_area.x2 = series_area->x1 + cursor->point.x + point_radius; - point_area.y1 = series_area->y1 + cursor->point.y - point_radius; - point_area.y2 = series_area->y1 + cursor->point.y + point_radius; + point_area.y1 = series_area->y1 + cursor->point.y - point_radius; + point_area.y2 = series_area->y1 + cursor->point.y + point_radius; - /*Don't limit to `series_mask` to get full circles on the ends*/ - lv_draw_rect(&point_area, clip_area, &point_dsc); - } + /*Don't limit to `series_mask` to get full circles on the ends*/ + lv_draw_rect(&point_area, clip_area, &point_dsc); + } } @@ -1620,7 +1621,9 @@ static void draw_y_ticks(lv_obj_t * chart, const lv_area_t * series_area, const /* set the area at some distance of the major tick len left of the tick */ /* changed to explicit member initialization to allow compilation as c++ */ - lv_area_t a; a.y1 = p2.y - size.y / 2; a.y2 = p2.y + size.y / 2; + lv_area_t a; + a.y1 = p2.y - size.y / 2; + a.y2 = p2.y + size.y / 2; if(which_axis == LV_CHART_AXIS_PRIMARY_Y) { a.x1 = p2.x - size.x - label_dist; diff --git a/src/lv_widgets/lv_chart.h b/src/lv_widgets/lv_chart.h index 16ee6bcf0..797edc378 100644 --- a/src/lv_widgets/lv_chart.h +++ b/src/lv_widgets/lv_chart.h @@ -63,7 +63,7 @@ typedef uint8_t lv_chart_axis_t; enum { LV_CHART_CURSOR_NONE = 0x00, - LV_CHART_CURSOR_RIGHT = 0x01, + LV_CHART_CURSOR_RIGHT = 0x01, LV_CHART_CURSOR_UP = 0x02, LV_CHART_CURSOR_LEFT = 0x04, LV_CHART_CURSOR_DOWN = 0x08 diff --git a/src/lv_widgets/lv_cont.c b/src/lv_widgets/lv_cont.c index c004d7215..08a0e4e6f 100644 --- a/src/lv_widgets/lv_cont.c +++ b/src/lv_widgets/lv_cont.c @@ -571,7 +571,8 @@ static void lv_cont_layout_pretty(lv_obj_t * cont) if(lv_obj_get_base_dir(cont) == LV_BIDI_DIR_RTL) { align = LV_ALIGN_IN_TOP_RIGHT; inv = -1; - } else { + } + else { align = LV_ALIGN_IN_TOP_LEFT; inv = 1; } @@ -582,7 +583,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont) switch(type) { case LV_LAYOUT_PRETTY_TOP: lv_obj_align(child_tmp, cont, align, - inv * (act_x + mleft), + inv * (act_x + mleft), act_y + lv_obj_get_style_margin_top(child_tmp, LV_OBJ_PART_MAIN)); break; case LV_LAYOUT_PRETTY_MID: diff --git a/src/lv_widgets/lv_table.c b/src/lv_widgets/lv_table.c index ee23f7d52..31f71aa35 100644 --- a/src/lv_widgets/lv_table.c +++ b/src/lv_widgets/lv_table.c @@ -180,10 +180,10 @@ void lv_table_set_cell_value(lv_obj_t * table, uint16_t row, uint16_t col, const _lv_txt_ap_proc(txt, &ext->cell_data[cell][1]); #else ext->cell_data[cell] = lv_mem_realloc(ext->cell_data[cell], strlen(txt) + 2); /*+1: trailing '\0; +1: format byte*/ - LV_ASSERT_MEM(ext->cell_data[cell]); - if(ext->cell_data[cell] == NULL) return; + LV_ASSERT_MEM(ext->cell_data[cell]); + if(ext->cell_data[cell] == NULL) return; - strcpy(ext->cell_data[cell] + 1, txt); /*+1 to skip the format byte*/ + strcpy(ext->cell_data[cell] + 1, txt); /*+1 to skip the format byte*/ #endif ext->cell_data[cell][0] = format.format_byte; @@ -238,12 +238,12 @@ void lv_table_set_cell_value_fmt(lv_obj_t * table, uint16_t row, uint16_t col, c } va_list ap, ap2; - va_start(ap, fmt); - va_copy(ap2, ap); + va_start(ap, fmt); + va_copy(ap2, ap); - /*Allocate space for the new text by using trick from C99 standard section 7.19.6.12 */ - uint32_t len = lv_vsnprintf(NULL, 0, fmt, ap); - va_end(ap); + /*Allocate space for the new text by using trick from C99 standard section 7.19.6.12 */ + uint32_t len = lv_vsnprintf(NULL, 0, fmt, ap); + va_end(ap); #if LV_USE_ARABIC_PERSIAN_CHARS /*Put together the text according to the format string*/ @@ -878,7 +878,8 @@ static lv_design_res_t lv_table_design(lv_obj_t * table, const lv_area_t * clip_ if(rtl) { cell_area.x2 = cell_area.x1 - 1; cell_area.x1 = cell_area.x2 - ext->col_w[col] + 1; - } else { + } + else { cell_area.x1 = cell_area.x2 + 1; cell_area.x2 = cell_area.x1 + ext->col_w[col] - 1; } @@ -1066,10 +1067,11 @@ static lv_style_list_t * lv_table_get_style(lv_obj_t * table, uint8_t part) /* Because of the presence of LV_TABLE_PART_BG, LV_TABLE_PART_CELL has an integer value of . This comes in useful to extend above code with more cell types as follows */ - if ( part == LV_TABLE_PART_BG ) { - return &table->style_list; - } else if (part >= 1 && part <= LV_TABLE_CELL_STYLE_CNT ) { - return &ext->cell_style[part-1]; + if(part == LV_TABLE_PART_BG) { + return &table->style_list; + } + else if(part >= 1 && part <= LV_TABLE_CELL_STYLE_CNT) { + return &ext->cell_style[part - 1]; } return NULL; diff --git a/src/lv_widgets/lv_table.h b/src/lv_widgets/lv_table.h index 82bdf4b06..ea00c45ed 100644 --- a/src/lv_widgets/lv_table.h +++ b/src/lv_widgets/lv_table.h @@ -32,12 +32,12 @@ extern "C" { #define LV_TABLE_COL_MAX 12 #endif -/* - Maximum allowable value of LV_TABLE_CELL_STYLE_CNT is 16 +/* + Maximum allowable value of LV_TABLE_CELL_STYLE_CNT is 16 because of restriction of lv_table_cell_format_t.type to no more than 4 bits so that lv_table_cell_format_t.s will not exceed 8 bits */ -#ifndef LV_TABLE_CELL_STYLE_CNT +#ifndef LV_TABLE_CELL_STYLE_CNT # define LV_TABLE_CELL_STYLE_CNT 4 #endif #if (LV_TABLE_CELL_STYLE_CNT > 16) @@ -71,7 +71,8 @@ typedef struct { lv_coord_t * row_h; lv_style_list_t cell_style[LV_TABLE_CELL_STYLE_CNT]; lv_coord_t col_w[LV_TABLE_COL_MAX]; - uint16_t cell_types : LV_TABLE_CELL_STYLE_CNT; /*Keep track which cell types exists to avoid dealing with unused ones*/ +uint16_t cell_types : + LV_TABLE_CELL_STYLE_CNT; /*Keep track which cell types exists to avoid dealing with unused ones*/ } lv_table_ext_t; /*Parts of the table*/