From 8f962a04649b6ee8d58e8b741e2c6c87e6e9dc5e Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 27 Jun 2019 07:16:15 +0200 Subject: [PATCH] run clang-formatter --- src/lv_core/lv_disp.h | 4 +- src/lv_core/lv_group.c | 4 +- src/lv_core/lv_obj.c | 19 ++++------ src/lv_core/lv_obj.h | 3 +- src/lv_core/lv_refr.c | 9 +++-- src/lv_draw/lv_draw_basic.c | 24 +++++------- src/lv_draw/lv_draw_img.c | 16 ++++---- src/lv_draw/lv_draw_label.c | 15 ++++---- src/lv_draw/lv_draw_label.h | 10 +++-- src/lv_draw/lv_img_cache.c | 14 +++---- src/lv_draw/lv_img_cache.h | 2 +- src/lv_draw/lv_img_decoder.c | 4 +- src/lv_draw/lv_img_decoder.h | 1 - src/lv_hal/lv_hal_disp.c | 1 - src/lv_misc/lv_anim.c | 6 +-- src/lv_misc/lv_anim.h | 7 ++-- src/lv_misc/lv_fs.c | 4 +- src/lv_misc/lv_fs.h | 2 +- src/lv_misc/lv_log.h | 29 +++++++++----- src/lv_misc/lv_task.h | 1 - src/lv_misc/lv_txt.c | 29 +++++++------- src/lv_objx/lv_bar.c | 8 ++-- src/lv_objx/lv_btn.c | 14 +++---- src/lv_objx/lv_btn.h | 63 +++++++++++++++++++++++-------- src/lv_objx/lv_btnm.c | 1 - src/lv_objx/lv_btnm.h | 12 +++--- src/lv_objx/lv_canvas.c | 4 +- src/lv_objx/lv_canvas.h | 13 +++---- src/lv_objx/lv_chart.c | 60 +++++++++++++++-------------- src/lv_objx/lv_chart.h | 20 +++++----- src/lv_objx/lv_cont.h | 6 ++- src/lv_objx/lv_ddlist.c | 2 +- src/lv_objx/lv_gauge.h | 4 +- src/lv_objx/lv_img.h | 2 +- src/lv_objx/lv_imgbtn.h | 8 ++-- src/lv_objx/lv_label.c | 24 ++++++------ src/lv_objx/lv_label.h | 16 ++++---- src/lv_objx/lv_led.h | 6 +-- src/lv_objx/lv_line.h | 4 +- src/lv_objx/lv_list.c | 4 +- src/lv_objx/lv_list.h | 6 +-- src/lv_objx/lv_lmeter.h | 4 +- src/lv_objx/lv_page.c | 27 +++++-------- src/lv_objx/lv_page.h | 7 +--- src/lv_objx/lv_roller.c | 10 ++--- src/lv_objx/lv_roller.h | 3 -- src/lv_objx/lv_sw.c | 11 +++--- src/lv_objx/lv_ta.c | 17 ++++----- src/lv_objx/lv_ta.h | 2 +- src/lv_objx/lv_tabview.c | 7 ++-- src/lv_objx/lv_tileview.c | 12 +++--- src/lv_objx/lv_tileview.h | 1 - src/lv_objx/lv_win.c | 1 - src/lv_objx/lv_win.h | 1 - src/lv_themes/lv_theme_alien.c | 18 ++++----- src/lv_themes/lv_theme_default.c | 19 +++++----- src/lv_themes/lv_theme_material.c | 18 ++++----- src/lv_themes/lv_theme_mono.c | 19 +++++----- src/lv_themes/lv_theme_nemo.c | 17 ++++----- src/lv_themes/lv_theme_night.c | 22 +++++------ src/lv_themes/lv_theme_templ.c | 14 +++---- src/lv_themes/lv_theme_zen.c | 18 ++++----- 62 files changed, 372 insertions(+), 357 deletions(-) diff --git a/src/lv_core/lv_disp.h b/src/lv_core/lv_disp.h index 14e18759f..dab25c2b1 100644 --- a/src/lv_core/lv_disp.h +++ b/src/lv_core/lv_disp.h @@ -133,11 +133,11 @@ static inline void lv_scr_load(lv_obj_t * scr) #ifndef LV_HOR_RES #define LV_HOR_RES lv_disp_get_hor_res(lv_disp_get_default()) -#endif +#endif #ifndef LV_VER_RES #define LV_VER_RES lv_disp_get_ver_res(lv_disp_get_default()) -#endif +#endif #ifdef __cplusplus } /* extern "C" */ diff --git a/src/lv_core/lv_group.c b/src/lv_core/lv_group.c index 4de24d1d7..0ffb4f8e5 100644 --- a/src/lv_core/lv_group.c +++ b/src/lv_core/lv_group.c @@ -565,7 +565,7 @@ static void style_mod_def(lv_group_t * group, lv_style_t * style) /*Add some recolor to the images*/ if(style->image.intense < LV_OPA_MIN) { - style->image.color = LV_COLOR_ORANGE; + style->image.color = LV_COLOR_ORANGE; style->image.intense = LV_OPA_40; } #else @@ -601,7 +601,7 @@ static void style_mod_edit_def(lv_group_t * group, lv_style_t * style) /*Add some recolor to the images*/ if(style->image.intense < LV_OPA_MIN) { - style->image.color = LV_COLOR_GREEN; + style->image.color = LV_COLOR_GREEN; style->image.intense = LV_OPA_40; } diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index eaa8240c8..aef953042 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -1348,7 +1348,7 @@ lv_res_t lv_event_send_func(lv_event_cb_t event_xcb, lv_obj_t * obj, lv_event_t event_temp_data_head = &event_temp_data; const void * event_act_data_save = event_act_data; - event_act_data = data; + event_act_data = data; /*Call the input device's feedback callback if set*/ lv_indev_t * indev_act = lv_indev_get_act(); @@ -1606,23 +1606,18 @@ void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p) * (Without the size of the border or other extra graphical elements) * @param coords_p store the result area here */ -void lv_obj_get_inner_coords(const lv_obj_t *obj, lv_area_t * coords_p) +void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p) { - const lv_style_t *style = lv_obj_get_style(obj); - if(style->body.border.part & LV_BORDER_LEFT) - coords_p->x1 += style->body.border.width; + const lv_style_t * style = lv_obj_get_style(obj); + if(style->body.border.part & LV_BORDER_LEFT) coords_p->x1 += style->body.border.width; - if(style->body.border.part & LV_BORDER_RIGHT) - coords_p->x2 -= style->body.border.width; + if(style->body.border.part & LV_BORDER_RIGHT) coords_p->x2 -= style->body.border.width; - if(style->body.border.part & LV_BORDER_TOP) - coords_p->y1 += style->body.border.width; + if(style->body.border.part & LV_BORDER_TOP) coords_p->y1 += style->body.border.width; - if(style->body.border.part & LV_BORDER_BOTTOM) - coords_p->y2 -= style->body.border.width; + if(style->body.border.part & LV_BORDER_BOTTOM) coords_p->y2 -= style->body.border.width; } - /** * Get the x coordinate of object * @param obj pointer to an object diff --git a/src/lv_core/lv_obj.h b/src/lv_core/lv_obj.h index d6bc3fc19..dc8176ca8 100644 --- a/src/lv_core/lv_obj.h +++ b/src/lv_core/lv_obj.h @@ -242,7 +242,6 @@ typedef struct ... [x]: "lv_obj" */ } lv_obj_type_t; - /********************** * GLOBAL PROTOTYPES **********************/ @@ -668,7 +667,7 @@ void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p); * (Without the size of the border or other extra graphical elements) * @param coords_p store the result area here */ -void lv_obj_get_inner_coords(const lv_obj_t *obj, lv_area_t * coords_p); +void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p); /** * Get the x coordinate of object diff --git a/src/lv_core/lv_refr.c b/src/lv_core/lv_refr.c index 40ef7c2c1..439dca3da 100644 --- a/src/lv_core/lv_refr.c +++ b/src/lv_core/lv_refr.c @@ -562,7 +562,8 @@ static void lv_refr_vdb_flush(void) /*In double buffered mode wait until the other buffer is flushed before flushing the current * one*/ if(lv_disp_is_double_buf(disp_refr)) { - while(vdb->flushing); + while(vdb->flushing) + ; } vdb->flushing = 1; @@ -572,7 +573,9 @@ static void lv_refr_vdb_flush(void) if(disp->driver.flush_cb) disp->driver.flush_cb(&disp->driver, &vdb->area, vdb->buf_act); if(vdb->buf1 && vdb->buf2) { - if(vdb->buf_act == vdb->buf1) vdb->buf_act = vdb->buf2; - else vdb->buf_act = vdb->buf1; + if(vdb->buf_act == vdb->buf1) + vdb->buf_act = vdb->buf2; + else + vdb->buf_act = vdb->buf1; } } diff --git a/src/lv_draw/lv_draw_basic.c b/src/lv_draw/lv_draw_basic.c index 059071374..e7be49a9d 100644 --- a/src/lv_draw/lv_draw_basic.c +++ b/src/lv_draw/lv_draw_basic.c @@ -86,14 +86,13 @@ void lv_draw_px(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t x -= vdb->area.x1; y -= vdb->area.y1; - if(disp->driver.set_px_cb) { disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, x, y, color, opa); } else { bool scr_transp = false; - #if LV_COLOR_SCREEN_TRANSP +#if LV_COLOR_SCREEN_TRANSP scr_transp = disp->driver.screen_transp; - #endif +#endif lv_color_t * vdb_px_p = vdb->buf_act; vdb_px_p += y * vdb_width + x; @@ -429,13 +428,11 @@ void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint lv_coord_t row; lv_coord_t map_useful_w = lv_area_get_width(&masked_a); - bool scr_transp = false; #if LV_COLOR_SCREEN_TRANSP scr_transp = disp->driver.screen_transp; #endif - /*The simplest case just copy the pixels into the VDB*/ if(chroma_key == false && alpha_byte == false && opa == LV_OPA_COVER && recolor_opa == LV_OPA_TRANSP) { @@ -532,7 +529,6 @@ void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint /*Normal native VDB write*/ else { - if(opa_result == LV_OPA_COVER) vdb_buf_tmp[col] = px_color; else { @@ -540,8 +536,8 @@ void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result); } else { #if LV_COLOR_DEPTH == 32 - vdb_buf_tmp[col] = - color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].ch.alpha, px_color, opa_result); + vdb_buf_tmp[col] = color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].ch.alpha, + px_color, opa_result); #endif } } @@ -624,9 +620,9 @@ static void sw_color_fill(lv_color_t * mem, lv_coord_t mem_width, const lv_area_ /*Calculate with alpha too*/ else { bool scr_transp = false; - #if LV_COLOR_SCREEN_TRANSP +#if LV_COLOR_SCREEN_TRANSP scr_transp = disp->driver.screen_transp; - #endif +#endif lv_color_t bg_tmp = LV_COLOR_BLACK; lv_color_t opa_tmp = lv_color_mix(color, bg_tmp, opa); @@ -653,7 +649,6 @@ static void sw_color_fill(lv_color_t * mem, lv_coord_t mem_width, const lv_area_ } } - /** * Mix two colors. Both color can have alpha value. It requires ARGB888 colors. * @param bg_color background color @@ -667,7 +662,7 @@ static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa, #if LV_COLOR_SCREEN_TRANSP /* Pick the foreground if it's fully opaque or the Background is fully transparent*/ - if(fg_opa > LV_OPA_MAX|| bg_opa <= LV_OPA_MIN) { + if(fg_opa > LV_OPA_MAX || bg_opa <= LV_OPA_MIN) { fg_color.ch.alpha = fg_opa; return fg_color; } @@ -690,8 +685,8 @@ static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa, if(fg_opa != fg_opa_save || bg_opa != bg_opa_save || fg_color.full != fg_color_save.full || bg_color.full != bg_color_save.full) { - fg_opa_save = fg_opa; - bg_opa_save = bg_opa; + fg_opa_save = fg_opa; + bg_opa_save = bg_opa; fg_color_save.full = fg_color.full; bg_color_save.full = bg_color.full; /*Info: @@ -717,4 +712,3 @@ static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa, #endif /*LV_COLOR_SCREEN_TRANSP*/ } - diff --git a/src/lv_draw/lv_draw_img.c b/src/lv_draw/lv_draw_img.c index 6185863e1..e5afe28a3 100644 --- a/src/lv_draw/lv_draw_img.c +++ b/src/lv_draw/lv_draw_img.c @@ -309,16 +309,14 @@ void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_ */ void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c) { - if((dsc->header.cf == LV_IMG_CF_ALPHA_1BIT && id > 1) || - (dsc->header.cf == LV_IMG_CF_ALPHA_2BIT && id > 3) || - (dsc->header.cf == LV_IMG_CF_ALPHA_4BIT && id > 15) || - (dsc->header.cf == LV_IMG_CF_ALPHA_8BIT)) { + if((dsc->header.cf == LV_IMG_CF_ALPHA_1BIT && id > 1) || (dsc->header.cf == LV_IMG_CF_ALPHA_2BIT && id > 3) || + (dsc->header.cf == LV_IMG_CF_ALPHA_4BIT && id > 15) || (dsc->header.cf == LV_IMG_CF_ALPHA_8BIT)) { LV_LOG_WARN("lv_img_buf_set_px_alpha: invalid 'id'"); return; } lv_color32_t c32; - c32.full = lv_color_to32(c); + c32.full = lv_color_to32(c); uint8_t * buf = (uint8_t *)dsc->data; memcpy(&buf[id * sizeof(c32)], &c32, sizeof(c32)); } @@ -446,24 +444,24 @@ static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mas lv_opa_t opa = opa_scale == LV_OPA_COVER ? style->image.opa : (uint16_t)((uint16_t)style->image.opa * opa_scale) >> 8; - lv_img_cache_entry_t * cdsc = lv_img_cache_open(src, style); if(cdsc == NULL) return LV_RES_INV; - bool chroma_keyed = lv_img_color_format_is_chroma_keyed(cdsc->dec_dsc.header.cf); bool alpha_byte = lv_img_color_format_has_alpha(cdsc->dec_dsc.header.cf); if(cdsc->dec_dsc.error_msg != NULL) { LV_LOG_WARN("Image draw error"); lv_draw_rect(coords, mask, &lv_style_plain, LV_OPA_COVER); - lv_draw_label(coords, mask, &lv_style_plain, LV_OPA_COVER, cdsc->dec_dsc.error_msg, LV_TXT_FLAG_NONE, NULL, -1, -1, NULL); + lv_draw_label(coords, mask, &lv_style_plain, LV_OPA_COVER, cdsc->dec_dsc.error_msg, LV_TXT_FLAG_NONE, NULL, -1, + -1, NULL); } /* The decoder open could open the image and gave the entire uncompressed image. * Just draw it!*/ else if(cdsc->dec_dsc.img_data) { - lv_draw_map(coords, mask, cdsc->dec_dsc.img_data, opa, chroma_keyed, alpha_byte, style->image.color, style->image.intense); + lv_draw_map(coords, mask, cdsc->dec_dsc.img_data, opa, chroma_keyed, alpha_byte, style->image.color, + style->image.intense); } /* The whole uncompressed image is not available. Try to read it line-by-line*/ else { diff --git a/src/lv_draw/lv_draw_label.c b/src/lv_draw/lv_draw_label.c index 6244668ef..c87cd0da7 100644 --- a/src/lv_draw/lv_draw_label.c +++ b/src/lv_draw/lv_draw_label.c @@ -13,7 +13,7 @@ * DEFINES *********************/ #define LABEL_RECOLOR_PAR_LENGTH 6 -#define LV_LABEL_HINT_UPDATE_TH 1024 /*Update the "hint" if the label's y coordinates have changed more then this*/ +#define LV_LABEL_HINT_UPDATE_TH 1024 /*Update the "hint" if the label's y coordinates have changed more then this*/ /********************** * TYPEDEFS @@ -55,7 +55,8 @@ static uint8_t hex_char_to_num(char hex); * @param sel_end end index of selected area (`LV_LABEL_TXT_SEL_OFF` if none) */ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale, - const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end, lv_draw_label_hint_t * hint) + const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end, + lv_draw_label_hint_t * hint) { const lv_font_t * font = style->text.font; lv_coord_t w; @@ -86,12 +87,12 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st pos.y += y_ofs; } - uint32_t line_start = 0; + uint32_t line_start = 0; int32_t last_line_start = -1; /*Check the hint to use the cached info*/ if(hint && y_ofs == 0) { - /*If the label changed too much recalculate the hint.*/ + /*If the label changed too much recalculate the hint.*/ if(LV_MATH_ABS(hint->coord_y - coords->y1) > LV_LABEL_HINT_UPDATE_TH - 2 * line_height) { hint->line_start = -1; } @@ -114,10 +115,10 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st pos.y += line_height; /*Save at the threshold coordinate*/ - if(hint && pos.y >= -LV_LABEL_HINT_UPDATE_TH && hint->line_start < 0) { + if(hint && pos.y >= -LV_LABEL_HINT_UPDATE_TH && hint->line_start < 0) { hint->line_start = line_start; - hint->y = pos.y - coords->y1; - hint->coord_y = coords->y1; + hint->y = pos.y - coords->y1; + hint->coord_y = coords->y1; } if(txt[line_start] == '\0') return; diff --git a/src/lv_draw/lv_draw_label.h b/src/lv_draw/lv_draw_label.h index ebc66d430..91f9f5fd8 100644 --- a/src/lv_draw/lv_draw_label.h +++ b/src/lv_draw/lv_draw_label.h @@ -28,8 +28,9 @@ extern "C" { * all the previous characters needs to be checked to calculate the positions. * This structure stores an earlier (e.g. at -1000 px) coordinate and the index of that line. * Therefore the calculations can start from here.*/ -typedef struct { - /*Index of the line at `y` coordinate*/ +typedef struct +{ + /*Index of the line at `y` coordinate*/ int32_t line_start; /*Give the `y` coordinate of the first letter at `line start` index. Relative to the label's coordinates*/ @@ -38,7 +39,7 @@ typedef struct { /*The 'y1' coordinate of the label when the hint was saved. * Used to invalidate the hint if the label has moved too much. */ int32_t coord_y; -}lv_draw_label_hint_t; +} lv_draw_label_hint_t; /********************** * GLOBAL PROTOTYPES @@ -57,7 +58,8 @@ typedef struct { * @param sel_end end index of selected area (`LV_LABEL_TXT_SEL_OFF` if none) */ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale, - const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end, lv_draw_label_hint_t * hint); + const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end, + lv_draw_label_hint_t * hint); /********************** * MACROS diff --git a/src/lv_draw/lv_img_cache.c b/src/lv_draw/lv_img_cache.c index e464d0245..1b7807955 100644 --- a/src/lv_draw/lv_img_cache.c +++ b/src/lv_draw/lv_img_cache.c @@ -17,10 +17,10 @@ * DEFINES *********************/ /*Decrement life with this value in every open*/ -#define LV_IMG_CACHE_AGING 1 +#define LV_IMG_CACHE_AGING 1 /*Boost life by this factor (multiply time_to_open with this value)*/ -#define LV_IMG_CACHE_LIFE_GAIN 1 +#define LV_IMG_CACHE_LIFE_GAIN 1 /*Don't let life to be greater than this limit because it would require a lot of time to * "die" from very high values */ @@ -84,7 +84,7 @@ lv_img_cache_entry_t * lv_img_cache_open(const void * src, const lv_style_t * st * Image difficult to open should live longer to keep avoid frequent their recaching. * Therefore increase `life` with `time_to_open`*/ cached_src = &cache[i]; - cached_src->life += cached_src->dec_dsc.time_to_open * LV_IMG_CACHE_LIFE_GAIN ; + cached_src->life += cached_src->dec_dsc.time_to_open * LV_IMG_CACHE_LIFE_GAIN; if(cached_src->life > LV_IMG_CACHE_LIFE_LIMIT) cached_src->life = LV_IMG_CACHE_LIFE_LIMIT; LV_LOG_TRACE("image draw: image found in the cache"); break; @@ -111,15 +111,15 @@ lv_img_cache_entry_t * lv_img_cache_open(const void * src, const lv_style_t * st /*Open the image and measure the time to open*/ uint32_t t_start; - t_start = lv_tick_get(); + t_start = lv_tick_get(); cached_src->dec_dsc.time_to_open = 0; - lv_res_t open_res = lv_img_decoder_open(&cached_src->dec_dsc, src, style); - if(open_res ==LV_RES_INV) { + lv_res_t open_res = lv_img_decoder_open(&cached_src->dec_dsc, src, style); + if(open_res == LV_RES_INV) { LV_LOG_WARN("Image draw cannot open the image resource"); lv_img_decoder_close(&cached_src->dec_dsc); memset(&cached_src->dec_dsc, 0, sizeof(lv_img_decoder_dsc_t)); memset(&cached_src, 0, sizeof(lv_img_cache_entry_t)); - cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its use */ + cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its use */ return NULL; } diff --git a/src/lv_draw/lv_img_cache.h b/src/lv_draw/lv_img_cache.h index 112724764..6d9563d60 100644 --- a/src/lv_draw/lv_img_cache.h +++ b/src/lv_draw/lv_img_cache.h @@ -30,7 +30,7 @@ typedef struct * Decrement all lifes by one every in every `lv_img_cache_open`. * If life == 0 the entry can be reused,*/ int32_t life; -}lv_img_cache_entry_t; +} lv_img_cache_entry_t; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_draw/lv_img_decoder.c b/src/lv_draw/lv_img_decoder.c index 3215b61b5..0ef0c9867 100644 --- a/src/lv_draw/lv_img_decoder.c +++ b/src/lv_draw/lv_img_decoder.c @@ -138,8 +138,8 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, const if(res != LV_RES_OK) continue; dsc->error_msg = NULL; - dsc->img_data = NULL; - dsc->decoder = d; + dsc->img_data = NULL; + dsc->decoder = d; res = d->open_cb(d, dsc); diff --git a/src/lv_draw/lv_img_decoder.h b/src/lv_draw/lv_img_decoder.h index 9e4045fd9..7872bb20a 100644 --- a/src/lv_draw/lv_img_decoder.h +++ b/src/lv_draw/lv_img_decoder.h @@ -213,7 +213,6 @@ void lv_img_decoder_init(void); */ lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header); - /** * Open an image. * Try the created image decoder one by one. Once one is able to open the image that decoder is save in `dsc` diff --git a/src/lv_hal/lv_hal_disp.c b/src/lv_hal/lv_hal_disp.c index c0ce65d10..c8331e273 100644 --- a/src/lv_hal/lv_hal_disp.c +++ b/src/lv_hal/lv_hal_disp.c @@ -71,7 +71,6 @@ void lv_disp_drv_init(lv_disp_drv_t * driver) driver->screen_transp = 1; #endif - #if LV_USE_GPU driver->gpu_blend_cb = NULL; driver->gpu_fill_cb = NULL; diff --git a/src/lv_misc/lv_anim.c b/src/lv_misc/lv_anim.c index 1cf64b7c7..5a50165b8 100644 --- a/src/lv_misc/lv_anim.c +++ b/src/lv_misc/lv_anim.c @@ -72,9 +72,9 @@ void lv_anim_core_init(void) void lv_anim_init(lv_anim_t * a) { memset(a, 0, sizeof(lv_anim_t)); - a->time = 500; - a->start = 0; - a->end = 100; + a->time = 500; + a->start = 0; + a->end = 100; a->path_cb = lv_anim_path_linear; } /** diff --git a/src/lv_misc/lv_anim.h b/src/lv_misc/lv_anim.h index a816bc0fc..c3c73d25f 100644 --- a/src/lv_misc/lv_anim.h +++ b/src/lv_misc/lv_anim.h @@ -33,8 +33,8 @@ extern "C" { /*Can be used to indicate if animations are enabled or disabled in a case*/ enum { - LV_ANIM_OFF, - LV_ANIM_ON, + LV_ANIM_OFF, + LV_ANIM_ON, }; typedef uint8_t lv_anim_enable_t; @@ -68,7 +68,7 @@ typedef void (*lv_anim_ready_cb_t)(struct _lv_anim_t *); typedef struct _lv_anim_t { void * var; /*Variable to animate*/ - lv_anim_exec_xcb_t exec_cb; /*Function to execute to animate*/ + lv_anim_exec_xcb_t exec_cb; /*Function to execute to animate*/ lv_anim_path_cb_t path_cb; /*An array with the steps of animations*/ lv_anim_ready_cb_t ready_cb; /*Call it when the animation is ready*/ int32_t start; /*Start value*/ @@ -88,7 +88,6 @@ typedef struct _lv_anim_t uint32_t has_run : 1; /*Indicates the animation has run in this round*/ } lv_anim_t; - /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/lv_misc/lv_fs.c b/src/lv_misc/lv_fs.c index 084a03a58..6d0a01188 100644 --- a/src/lv_misc/lv_fs.c +++ b/src/lv_misc/lv_fs.c @@ -343,7 +343,7 @@ lv_fs_res_t lv_fs_rename(const char * oldname, const char * newname) const char * old_real = lv_fs_get_real_path(oldname); const char * new_real = lv_fs_get_real_path(newname); - lv_fs_res_t res = drv->rename_cb(drv, old_real, new_real); + lv_fs_res_t res = drv->rename_cb(drv, old_real, new_real); return res; } @@ -380,7 +380,7 @@ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path) const char * real_path = lv_fs_get_real_path(path); - lv_fs_res_t res = rddir_p->drv->dir_open_cb(rddir_p->drv, rddir_p->dir_d, real_path); + lv_fs_res_t res = rddir_p->drv->dir_open_cb(rddir_p->drv, rddir_p->dir_d, real_path); return res; } diff --git a/src/lv_misc/lv_fs.h b/src/lv_misc/lv_fs.h index b65c7d14e..a4f3eb2e2 100644 --- a/src/lv_misc/lv_fs.h +++ b/src/lv_misc/lv_fs.h @@ -93,7 +93,7 @@ typedef struct typedef struct { void * dir_d; - lv_fs_drv_t * drv; + lv_fs_drv_t * drv; } lv_fs_dir_t; /********************** diff --git a/src/lv_misc/lv_log.h b/src/lv_misc/lv_log.h index 6cc35df8b..c299e9b3e 100644 --- a/src/lv_misc/lv_log.h +++ b/src/lv_misc/lv_log.h @@ -70,30 +70,41 @@ void lv_log_add(lv_log_level_t level, const char * file, int line, const char * **********************/ #if LV_LOG_LEVEL <= LV_LOG_LEVEL_TRACE -# define LV_LOG_TRACE(dsc) lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, dsc); +#define LV_LOG_TRACE(dsc) lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, dsc); #else -# define LV_LOG_TRACE(dsc) {;} +#define LV_LOG_TRACE(dsc) \ + { \ + ; \ + } #endif #if LV_LOG_LEVEL <= LV_LOG_LEVEL_INFO -# define LV_LOG_INFO(dsc) lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, dsc); +#define LV_LOG_INFO(dsc) lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, dsc); #else -# define LV_LOG_INFO(dsc) {;} +#define LV_LOG_INFO(dsc) \ + { \ + ; \ + } #endif #if LV_LOG_LEVEL <= LV_LOG_LEVEL_WARN -# define LV_LOG_WARN(dsc) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, dsc); +#define LV_LOG_WARN(dsc) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, dsc); #else -# define LV_LOG_WARN(dsc) {;} +#define LV_LOG_WARN(dsc) \ + { \ + ; \ + } #endif #if LV_LOG_LEVEL <= LV_LOG_LEVEL_ERROR -# define LV_LOG_ERROR(dsc) lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, dsc); +#define LV_LOG_ERROR(dsc) lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, dsc); #else -# define LV_LOG_ERROR(dsc) {;} +#define LV_LOG_ERROR(dsc) \ + { \ + ; \ + } #endif - #else /*LV_USE_LOG*/ /*Do nothing if `LV_USE_LOG 0`*/ diff --git a/src/lv_misc/lv_task.h b/src/lv_misc/lv_task.h index f5d5ce9a2..c9ead91f5 100644 --- a/src/lv_misc/lv_task.h +++ b/src/lv_misc/lv_task.h @@ -96,7 +96,6 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void); */ lv_task_t * lv_task_create_basic(void); - /** * Create a new lv_task * @param task_xcb a callback which is the task itself. It will be called periodically. diff --git a/src/lv_misc/lv_txt.c b/src/lv_misc/lv_txt.c index 0fdbf22bc..8b35c7149 100644 --- a/src/lv_misc/lv_txt.c +++ b/src/lv_misc/lv_txt.c @@ -130,7 +130,6 @@ void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t * size_res->y -= line_space; } - /** * Get the next line of text. Check line length and break chars too. * @param txt a '\0' terminated string @@ -140,42 +139,44 @@ void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t * * @param flags settings for the text from 'txt_flag_type' enum * @return the index of the first char of the new line (in byte index not letter index. With UTF-8 they are different) */ -uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font, - lv_coord_t letter_space, lv_coord_t max_width, lv_txt_flag_t flag) +uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t max_width, + lv_txt_flag_t flag) { if(txt == NULL) return 0; if(font == NULL) return 0; if(flag & LV_TXT_FLAG_EXPAND) max_width = LV_COORD_MAX; - uint32_t i = 0; - uint32_t i_next = 0; - lv_coord_t cur_w = 0; - uint32_t last_break = NO_BREAK_FOUND; + uint32_t i = 0; + uint32_t i_next = 0; + lv_coord_t cur_w = 0; + uint32_t last_break = NO_BREAK_FOUND; lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT; uint32_t letter_w; - uint32_t letter = 0; + uint32_t letter = 0; uint32_t letter_next = 0; letter_next = lv_txt_encoded_next(txt, &i_next); while(txt[i] != '\0') { - letter = letter_next; - i = i_next; + letter = letter_next; + i = i_next; letter_next = lv_txt_encoded_next(txt, &i_next); /*Handle the recolor command*/ if((flag & LV_TXT_FLAG_RECOLOR) != 0) { if(lv_txt_is_cmd(&cmd_state, letter) != false) { - continue; /*Skip the letter is it is part of a command*/ + continue; /*Skip the letter is it is part of a command*/ } } /*Check for new line chars*/ if(letter == '\n' || letter == '\r') { /*Return with the first letter of the next line*/ - if(letter == '\r' && letter_next == '\n') return i_next; - else return i; + if(letter == '\r' && letter_next == '\n') + return i_next; + else + return i; } else { /*Check the actual length*/ letter_w = lv_font_get_glyph_width(font, letter, letter_next); cur_w += letter_w; @@ -711,7 +712,7 @@ static uint32_t lv_txt_iso8859_1_get_length(const char * txt) * @param letter a letter * @return false: 'letter' is not break char */ -static inline bool is_break_char(uint32_t letter) +static inline bool is_break_char(uint32_t letter) { uint8_t i; bool ret = false; diff --git a/src/lv_objx/lv_bar.c b/src/lv_objx/lv_bar.c index 2485cc0f7..6b6ebb349 100644 --- a/src/lv_objx/lv_bar.c +++ b/src/lv_objx/lv_bar.c @@ -222,10 +222,10 @@ void lv_bar_set_anim_time(lv_obj_t * bar, uint16_t anim_time) { #if LV_USE_ANIMATION lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); - ext->anim_time = anim_time; + ext->anim_time = anim_time; #else - (void)bar; /*Unused*/ - (void)anim_time; /*Unused*/ + (void)bar; /*Unused*/ + (void)anim_time; /*Unused*/ #endif } @@ -312,7 +312,7 @@ uint16_t lv_bar_get_anim_time(lv_obj_t * bar) lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); return ext->anim_time; #else - (void) bar; /*Unused*/ + (void)bar; /*Unused*/ return 0; #endif } diff --git a/src/lv_objx/lv_btn.c b/src/lv_objx/lv_btn.c index 4eb9a4887..aa9255123 100644 --- a/src/lv_objx/lv_btn.c +++ b/src/lv_objx/lv_btn.c @@ -354,16 +354,16 @@ const lv_style_t * lv_btn_get_style(const lv_obj_t * btn, lv_btn_style_t type) { const lv_style_t * style = NULL; lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn); - lv_btn_state_t state = lv_btn_get_state(btn); + lv_btn_state_t state = lv_btn_get_state(btn); /* If the style of the current state is asked then return object style. * If the button is focused then this style is updated by the group's * `style_mod_cb` function */ if((type == LV_BTN_STYLE_REL && state == LV_BTN_STATE_REL) || - (type == LV_BTN_STYLE_PR && state == LV_BTN_STATE_PR) || - (type == LV_BTN_STYLE_TGL_REL && state == LV_BTN_STATE_TGL_REL) || - (type == LV_BTN_STYLE_TGL_PR && state == LV_BTN_STATE_TGL_PR) || - (type == LV_BTN_STYLE_INA && state == LV_BTN_STATE_INA)) { + (type == LV_BTN_STYLE_PR && state == LV_BTN_STATE_PR) || + (type == LV_BTN_STYLE_TGL_REL && state == LV_BTN_STATE_TGL_REL) || + (type == LV_BTN_STYLE_TGL_PR && state == LV_BTN_STATE_TGL_PR) || + (type == LV_BTN_STYLE_INA && state == LV_BTN_STATE_INA)) { style = lv_obj_get_style(btn); } else { @@ -614,7 +614,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL); uint32_t state = 1; - res = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &state); + res = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &state); if(res != LV_RES_OK) return res; } @@ -623,7 +623,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param) lv_btn_set_state(btn, LV_BTN_STATE_REL); uint32_t state = 0; - res = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &state); + res = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &state); if(res != LV_RES_OK) return res; } } diff --git a/src/lv_objx/lv_btn.h b/src/lv_objx/lv_btn.h index 3bbbe0020..592ac83b7 100644 --- a/src/lv_objx/lv_btn.h +++ b/src/lv_objx/lv_btn.h @@ -40,36 +40,69 @@ extern "C" { /** Possible states of a button. * It can be used not only by buttons but other button-like objects too*/ enum { - LV_BTN_STATE_REL, /**Released*/ - LV_BTN_STATE_PR, /**Pressed*/ - LV_BTN_STATE_TGL_REL, /**Toggled released*/ - LV_BTN_STATE_TGL_PR, /**Toggled pressed*/ - LV_BTN_STATE_INA, /**Inactive*/ - LV_BTN_STATE_NUM, + /**Released*/ + LV_BTN_STATE_REL, + + /**Pressed*/ + LV_BTN_STATE_PR, + + /**Toggled released*/ + LV_BTN_STATE_TGL_REL, + + /**Toggled pressed*/ + LV_BTN_STATE_TGL_PR, + + /**Inactive*/ + LV_BTN_STATE_INA, + + /**Number of states*/ + _LV_BTN_STATE_NUM, }; typedef uint8_t lv_btn_state_t; -/*Data of button*/ +/** Extended data of button*/ typedef struct { - lv_cont_ext_t cont; /*Ext. of ancestor*/ + /** Ext. of ancestor*/ + lv_cont_ext_t cont; + /*New data for this type */ - const lv_style_t * styles[LV_BTN_STATE_NUM]; /*Styles in each state*/ + + /**Styles in each state*/ + const lv_style_t * styles[_LV_BTN_STATE_NUM]; #if LV_BTN_INK_EFFECT - uint16_t ink_in_time; /*[ms] Time of ink fill effect (0: disable ink effect)*/ - uint16_t ink_wait_time; /*[ms] Wait before the ink disappears */ - uint16_t ink_out_time; /*[ms] Time of ink disappearing*/ + /** [ms] Time of ink fill effect (0: disable ink effect)*/ + uint16_t ink_in_time; + + /** [ms] Wait before the ink disappears */ + uint16_t ink_wait_time; + + /** [ms] Time of ink disappearing*/ + uint16_t ink_out_time; #endif - lv_btn_state_t state : 3; /*Current state of the button from 'lv_btn_state_t' enum*/ - uint8_t toggle : 1; /*1: Toggle enabled*/ + + /** Current state of the button from 'lv_btn_state_t' enum*/ + lv_btn_state_t state : 3; + + /** 1: Toggle enabled*/ + uint8_t toggle : 1; } lv_btn_ext_t; -/*Styles*/ +/**Styles*/ enum { + /** Release style */ LV_BTN_STYLE_REL, + + /**Pressed style*/ LV_BTN_STYLE_PR, + + /** Toggle released style*/ LV_BTN_STYLE_TGL_REL, + + /** Toggle pressed style */ LV_BTN_STYLE_TGL_PR, + + /** Inactive style*/ LV_BTN_STYLE_INA, }; typedef uint8_t lv_btn_style_t; diff --git a/src/lv_objx/lv_btnm.c b/src/lv_objx/lv_btnm.c index adfb041b3..912986245 100644 --- a/src/lv_objx/lv_btnm.c +++ b/src/lv_objx/lv_btnm.c @@ -381,7 +381,6 @@ void lv_btnm_set_btn_ctrl_all(lv_obj_t * btnm, lv_btnm_ctrl_t ctrl) } } - /** * Clear the attributes of all buttons of a button matrix * @param btnm pointer to a button matrix object diff --git a/src/lv_objx/lv_btnm.h b/src/lv_objx/lv_btnm.h index bcbc494ea..2b86f9867 100644 --- a/src/lv_objx/lv_btnm.h +++ b/src/lv_objx/lv_btnm.h @@ -51,12 +51,12 @@ typedef struct { /*No inherited ext.*/ /*Ext. of ancestor*/ /*New data for this type */ - const char ** map_p; /*Pointer to the current map*/ - lv_area_t * button_areas; /*Array of areas of buttons*/ - lv_btnm_ctrl_t * ctrl_bits; /*Array of control bytes*/ - const lv_style_t * styles_btn[LV_BTN_STATE_NUM]; /*Styles of buttons in each state*/ - 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*/ + const char ** map_p; /*Pointer to the current map*/ + lv_area_t * button_areas; /*Array of areas of buttons*/ + lv_btnm_ctrl_t * ctrl_bits; /*Array of control bytes*/ + const lv_style_t * styles_btn[_LV_BTN_STATE_NUM]; /*Styles of buttons in each state*/ + 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_act; /*Index of the active button (being pressed/released etc) or LV_BTNM_BTN_NONE */ uint8_t recolor : 1; /*Enable button recoloring*/ uint8_t one_toggle : 1; /*Single button toggled at once*/ diff --git a/src/lv_objx/lv_canvas.c b/src/lv_objx/lv_canvas.c index 3f39481a4..74de95f7e 100644 --- a/src/lv_objx/lv_canvas.c +++ b/src/lv_objx/lv_canvas.c @@ -544,7 +544,8 @@ void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord default: flag = LV_TXT_FLAG_NONE; break; } - lv_draw_label(&coords, &mask, style, LV_OPA_COVER, txt, flag, NULL, LV_LABEL_TEXT_SEL_OFF, LV_LABEL_TEXT_SEL_OFF, NULL); + lv_draw_label(&coords, &mask, style, LV_OPA_COVER, txt, flag, NULL, LV_LABEL_TEXT_SEL_OFF, LV_LABEL_TEXT_SEL_OFF, + NULL); lv_refr_set_disp_refreshing(refr_ori); } @@ -601,7 +602,6 @@ void lv_canvas_draw_img(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, const voi lv_refr_set_disp_refreshing(refr_ori); } - /** * Draw a line on the canvas * @param canvas pointer to a canvas object diff --git a/src/lv_objx/lv_canvas.h b/src/lv_objx/lv_canvas.h index a14a3870d..1d59d44d6 100644 --- a/src/lv_objx/lv_canvas.h +++ b/src/lv_objx/lv_canvas.h @@ -146,8 +146,8 @@ const lv_style_t * lv_canvas_get_style(const lv_obj_t * canvas, lv_canvas_style_ * @param w width of the buffer to copy * @param h height of the buffer to copy */ -void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t x, - lv_coord_t y, lv_coord_t w, lv_coord_t h); +void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t x, lv_coord_t y, lv_coord_t w, + lv_coord_t h); /** * Rotate and image and store the result on a canvas. @@ -197,7 +197,6 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_t max_w, const lv_style_t * style, const char * txt, lv_label_align_t align); - /** * Draw an image on the canvas * @param canvas pointer to a canvas object @@ -245,10 +244,10 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_ #define LV_CANVAS_BUF_SIZE_TRUE_COLOR_ALPHA(w, h) (LV_IMG_PX_SIZE_ALPHA_BYTE * w * h) /*+ 1: to be sure no fractional row*/ -#define LV_CANVAS_BUF_SIZE_ALPHA_1BIT(w, h) ((((w / 8) + 1) * h)) -#define LV_CANVAS_BUF_SIZE_ALPHA_2BIT(w, h) ((((w / 4) + 1) * h)) -#define LV_CANVAS_BUF_SIZE_ALPHA_4BIT(w, h) ((((w / 2) + 1) * h)) -#define LV_CANVAS_BUF_SIZE_ALPHA_8BIT(w, h) ((w * h)) +#define LV_CANVAS_BUF_SIZE_ALPHA_1BIT(w, h) ((((w / 8) + 1) * h)) +#define LV_CANVAS_BUF_SIZE_ALPHA_2BIT(w, h) ((((w / 4) + 1) * h)) +#define LV_CANVAS_BUF_SIZE_ALPHA_4BIT(w, h) ((((w / 2) + 1) * h)) +#define LV_CANVAS_BUF_SIZE_ALPHA_8BIT(w, h) ((w * h)) /*4 * X: for palette*/ #define LV_CANVAS_BUF_SIZE_INDEXED_1BIT(w, h) (LV_CANVAS_BUF_SIZE_ALPHA_1BIT(w, h) + 4 * 2) diff --git a/src/lv_objx/lv_chart.c b/src/lv_objx/lv_chart.c index c36539042..7f92b1560 100644 --- a/src/lv_objx/lv_chart.c +++ b/src/lv_objx/lv_chart.c @@ -84,18 +84,18 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy) lv_ll_init(&ext->series_ll, sizeof(lv_chart_series_t)); - ext->series.num = 0; - ext->ymin = LV_CHART_YMIN_DEF; - ext->ymax = LV_CHART_YMAX_DEF; - ext->hdiv_cnt = LV_CHART_HDIV_DEF; - ext->vdiv_cnt = LV_CHART_VDIV_DEF; - ext->point_cnt = LV_CHART_PNUM_DEF; - ext->type = LV_CHART_TYPE_LINE; - ext->update_mode = LV_CHART_UPDATE_MODE_SHIFT; - ext->series.opa = LV_OPA_COVER; - ext->series.dark = LV_OPA_50; - ext->series.width = 2; - ext->margin = 0; + ext->series.num = 0; + ext->ymin = LV_CHART_YMIN_DEF; + ext->ymax = LV_CHART_YMAX_DEF; + ext->hdiv_cnt = LV_CHART_HDIV_DEF; + ext->vdiv_cnt = LV_CHART_VDIV_DEF; + ext->point_cnt = LV_CHART_PNUM_DEF; + ext->type = LV_CHART_TYPE_LINE; + ext->update_mode = LV_CHART_UPDATE_MODE_SHIFT; + ext->series.opa = LV_OPA_COVER; + ext->series.dark = LV_OPA_50; + ext->series.width = 2; + ext->margin = 0; ext->x_axis.major_tick_len = LV_CHART_TICK_LENGTH_AUTO; ext->x_axis.minor_tick_len = LV_CHART_TICK_LENGTH_AUTO; ext->y_axis.major_tick_len = LV_CHART_TICK_LENGTH_AUTO; @@ -124,14 +124,14 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy) } else { lv_chart_ext_t * ext_copy = lv_obj_get_ext_attr(copy); - ext->type = ext_copy->type; - ext->ymin = ext_copy->ymin; - ext->ymax = ext_copy->ymax; - ext->hdiv_cnt = ext_copy->hdiv_cnt; - ext->vdiv_cnt = ext_copy->vdiv_cnt; - ext->point_cnt = ext_copy->point_cnt; - ext->series.opa = ext_copy->series.opa; - ext->margin = ext_copy->margin; + ext->type = ext_copy->type; + ext->ymin = ext_copy->ymin; + ext->ymax = ext_copy->ymax; + ext->hdiv_cnt = ext_copy->hdiv_cnt; + ext->vdiv_cnt = ext_copy->vdiv_cnt; + ext->point_cnt = ext_copy->point_cnt; + ext->series.opa = ext_copy->series.opa; + ext->margin = ext_copy->margin; memcpy(&ext->x_axis, &ext_copy->x_axis, sizeof(lv_chart_axis_cfg_t)); memcpy(&ext->y_axis, &ext_copy->y_axis, sizeof(lv_chart_axis_cfg_t)); @@ -460,9 +460,9 @@ void lv_chart_set_x_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_ */ void lv_chart_set_y_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_t minor_tick_len) { - lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); - ext->y_axis.major_tick_len = major_tick_len; - ext->y_axis.minor_tick_len = minor_tick_len; + lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); + ext->y_axis.major_tick_len = major_tick_len; + ext->y_axis.minor_tick_len = minor_tick_len; } /** @@ -473,7 +473,8 @@ void lv_chart_set_y_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_ * else number of ticks between two value labels * @param options extra options */ -void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, lv_chart_axis_options_t options) +void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, + lv_chart_axis_options_t options) { lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); ext->x_axis.num_tick_marks = num_tick_marks; @@ -489,7 +490,8 @@ void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, ui * else number of ticks between two value labels * @param options extra options */ -void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, lv_chart_axis_options_t options) +void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, + lv_chart_axis_options_t options) { lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); ext->y_axis.num_tick_marks = num_tick_marks; @@ -498,10 +500,10 @@ void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, ui } /** -* Set the margin around the chart, used for axes value and ticks -* @param chart pointer to an chart object -* @param margin value of the margin [px] -*/ + * Set the margin around the chart, used for axes value and ticks + * @param chart pointer to an chart object + * @param margin value of the margin [px] + */ void lv_chart_set_margin(lv_obj_t * chart, uint16_t margin) { lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); diff --git a/src/lv_objx/lv_chart.h b/src/lv_objx/lv_chart.h index ab68b4313..89b2ccc97 100644 --- a/src/lv_objx/lv_chart.h +++ b/src/lv_objx/lv_chart.h @@ -40,7 +40,7 @@ extern "C" { /*Chart types*/ enum { - LV_CHART_TYPE_NONE = 0x00, /*Don't draw the series*/ + LV_CHART_TYPE_NONE = 0x00, /*Don't draw the series*/ LV_CHART_TYPE_LINE = 0x01, /*Connect the points with lines*/ LV_CHART_TYPE_COLUMN = 0x02, /*Draw columns*/ LV_CHART_TYPE_POINT = 0x04, /*Draw circles on the points*/ @@ -51,8 +51,8 @@ typedef uint8_t lv_chart_type_t; /*Chart update mode for `lv_chart_set_next`*/ enum { - LV_CHART_UPDATE_MODE_SHIFT, /*Shift old data to the left and add the new one o the right*/ - LV_CHART_UPDATE_MODE_CIRCULAR, /*Add the new data in a circular way*/ + LV_CHART_UPDATE_MODE_SHIFT, /*Shift old data to the left and add the new one o the right*/ + LV_CHART_UPDATE_MODE_CIRCULAR, /*Add the new data in a circular way*/ }; typedef uint8_t lv_chart_update_mode_t; @@ -65,8 +65,8 @@ typedef struct /*Data of axis */ enum { - LV_CHART_AXIS_SKIP_LAST_TICK = 0x00, /* don't draw the last tick */ - LV_CHART_AXIS_DRAW_LAST_TICK = 0x01 /* draw the last tick */ + LV_CHART_AXIS_SKIP_LAST_TICK = 0x00, /* don't draw the last tick */ + LV_CHART_AXIS_DRAW_LAST_TICK = 0x01 /* draw the last tick */ }; typedef uint8_t lv_chart_axis_options_t; @@ -235,7 +235,7 @@ void lv_chart_set_update_mode(lv_obj_t * chart, lv_chart_update_mode_t update_mo */ static inline void lv_chart_set_style(lv_obj_t * chart, lv_chart_style_t type, const lv_style_t * style) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ lv_obj_set_style(chart, style); } @@ -267,7 +267,8 @@ void lv_chart_set_y_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_ * else number of ticks between two value labels * @param options extra options */ -void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, lv_chart_axis_options_t options); +void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, + lv_chart_axis_options_t options); /** * Set the y-axis tick count and labels of a chart @@ -277,7 +278,8 @@ void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, ui * else number of ticks between two value labels * @param options extra options */ -void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, lv_chart_axis_options_t options); +void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, + lv_chart_axis_options_t options); /** * Set the margin around the chart, used for axes value and ticks @@ -333,7 +335,7 @@ lv_opa_t lv_chart_get_series_darking(const lv_obj_t * chart); */ static inline const lv_style_t * lv_chart_get_style(const lv_obj_t * chart, lv_chart_style_t type) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ return lv_obj_get_style(chart); } diff --git a/src/lv_objx/lv_cont.h b/src/lv_objx/lv_cont.h index 22a3a1ff7..de053a2c3 100644 --- a/src/lv_objx/lv_cont.h +++ b/src/lv_objx/lv_cont.h @@ -43,6 +43,7 @@ enum { LV_LAYOUT_ROW_B, /*Row bottom align*/ LV_LAYOUT_PRETTY, /*Put as many object as possible in row and begin a new row*/ LV_LAYOUT_GRID, /*Align same-sized object into a grid*/ + _LV_LAYOUT_NUM }; typedef uint8_t lv_layout_t; @@ -52,6 +53,7 @@ enum { LV_FIT_FLOOD, /*Align the size to the parent's edge*/ LV_FIT_FILL, /*Align the size to the parent's edge first but if there is an object out of it then involve it*/ + _LV_FIT_NUM }; typedef uint8_t lv_fit_t; @@ -137,7 +139,7 @@ static inline void lv_cont_set_fit(lv_obj_t * cont, lv_fit_t fit) */ static inline void lv_cont_set_style(lv_obj_t * cont, lv_cont_style_t type, const lv_style_t * style) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ lv_obj_set_style(cont, style); } @@ -188,7 +190,7 @@ lv_fit_t lv_cont_get_fit_bottom(const lv_obj_t * cont); */ static inline const lv_style_t * lv_cont_get_style(const lv_obj_t * cont, lv_cont_style_t type) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ return lv_obj_get_style(cont); } diff --git a/src/lv_objx/lv_ddlist.c b/src/lv_objx/lv_ddlist.c index e77490256..eee1ecf96 100644 --- a/src/lv_objx/lv_ddlist.c +++ b/src/lv_objx/lv_ddlist.c @@ -784,7 +784,7 @@ static lv_res_t release_handler(lv_obj_t * ddlist) ext->sel_opt_id_ori = ext->sel_opt_id; } - uint32_t id = ext->sel_opt_id; /*Just to use uint32_t in event data*/ + uint32_t id = ext->sel_opt_id; /*Just to use uint32_t in event data*/ lv_res_t res = lv_event_send(ddlist, LV_EVENT_VALUE_CHANGED, &id); if(res != LV_RES_OK) return res; diff --git a/src/lv_objx/lv_gauge.h b/src/lv_objx/lv_gauge.h index 3d953cfab..fb7cf366a 100644 --- a/src/lv_objx/lv_gauge.h +++ b/src/lv_objx/lv_gauge.h @@ -128,7 +128,7 @@ void lv_gauge_set_scale(lv_obj_t * gauge, uint16_t angle, uint8_t line_cnt, uint * */ static inline void lv_gauge_set_style(lv_obj_t * gauge, lv_gauge_style_t type, lv_style_t * style) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ lv_obj_set_style(gauge, style); } @@ -216,7 +216,7 @@ static inline uint16_t lv_gauge_get_scale_angle(const lv_obj_t * gauge) */ static inline const lv_style_t * lv_gauge_get_style(const lv_obj_t * gauge, lv_gauge_style_t type) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ return lv_obj_get_style(gauge); } diff --git a/src/lv_objx/lv_img.h b/src/lv_objx/lv_img.h index 343ecb196..d1e14d209 100644 --- a/src/lv_objx/lv_img.h +++ b/src/lv_objx/lv_img.h @@ -159,7 +159,7 @@ lv_coord_t lv_img_get_offset_y(lv_obj_t * img); */ static inline const lv_style_t * lv_img_get_style(const lv_obj_t * img, lv_img_style_t type) { - (void)type; /*Unused*/ + (void)type; /*Unused*/ return lv_obj_get_style(img); } diff --git a/src/lv_objx/lv_imgbtn.h b/src/lv_objx/lv_imgbtn.h index 850866335..09aab0e4f 100644 --- a/src/lv_objx/lv_imgbtn.h +++ b/src/lv_objx/lv_imgbtn.h @@ -43,11 +43,11 @@ typedef struct lv_btn_ext_t btn; /*Ext. of ancestor*/ /*New data for this type */ #if LV_IMGBTN_TILED == 0 - const void * img_src[LV_BTN_STATE_NUM]; /*Store images to each state*/ + const void * img_src[_LV_BTN_STATE_NUM]; /*Store images to each state*/ #else - const void * img_src_left[LV_BTN_STATE_NUM]; /*Store left side images to each state*/ - const void * img_src_mid[LV_BTN_STATE_NUM]; /*Store center images to each state*/ - const void * img_src_right[LV_BTN_STATE_NUM]; /*Store right side images to each state*/ + const void * img_src_left[_LV_BTN_STATE_NUM]; /*Store left side images to each state*/ + const void * img_src_mid[_LV_BTN_STATE_NUM]; /*Store center images to each state*/ + const void * img_src_right[_LV_BTN_STATE_NUM]; /*Store right side images to each state*/ #endif lv_img_cf_t act_cf; /*Color format of the currently active image*/ } lv_imgbtn_ext_t; diff --git a/src/lv_objx/lv_label.c b/src/lv_objx/lv_label.c index 8a7f9b290..da02bb5a0 100644 --- a/src/lv_objx/lv_label.c +++ b/src/lv_objx/lv_label.c @@ -23,7 +23,8 @@ #endif #define LV_LABEL_DOT_END_INV 0xFFFF -#define LV_LABEL_HINT_HEIGHT_LIMIT 1024 /*Enable "hint" to buffer info about labels larger than this. (Speed up their drawing)*/ +#define LV_LABEL_HINT_HEIGHT_LIMIT \ + 1024 /*Enable "hint" to buffer info about labels larger than this. (Speed up their drawing)*/ /********************** * TYPEDEFS @@ -97,8 +98,8 @@ lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy) ext->offset.y = 0; ext->hint.line_start = -1; - ext->hint.coord_y = 0; - ext->hint.y = 0; + ext->hint.coord_y = 0; + ext->hint.y = 0; #if LV_LABEL_TEXT_SEL ext->txt_sel_start = LV_LABEL_TEXT_SEL_OFF; @@ -358,8 +359,8 @@ void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed) lv_label_refr_text(label); } #else - (void) label; /*Unused*/ - (void) anim_speed; /*Unused*/ + (void)label; /*Unused*/ + (void)anim_speed; /*Unused*/ #endif } @@ -452,7 +453,7 @@ uint16_t lv_label_get_anim_speed(const lv_obj_t * label) lv_label_ext_t * ext = lv_obj_get_ext_attr(label); return ext->anim_speed; #else - (void) label; /*Unused*/ + (void)label; /*Unused*/ return 0; #endif } @@ -690,9 +691,9 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos) lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT; - uint32_t i = line_start; - uint32_t i_current = i; - uint32_t letter = '\0'; + uint32_t i = line_start; + uint32_t i_current = i; + uint32_t letter = '\0'; uint32_t letter_next = '\0'; if(new_line_start > 0) { @@ -854,7 +855,8 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_ } lv_draw_label_hint_t * hint = &ext->hint; - if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC || lv_obj_get_height(label) < LV_LABEL_HINT_HEIGHT_LIMIT) hint = NULL; + if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC || lv_obj_get_height(label) < LV_LABEL_HINT_HEIGHT_LIMIT) + hint = NULL; lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ext->offset, lv_label_get_text_sel_start(label), lv_label_get_text_sel_end(label), hint); @@ -952,7 +954,7 @@ static void lv_label_refr_text(lv_obj_t * label) if(ext->text == NULL) return; - ext->hint.line_start = -1; /*The hint is invalid if the text changes*/ + ext->hint.line_start = -1; /*The hint is invalid if the text changes*/ lv_coord_t max_w = lv_obj_get_width(label); const lv_style_t * style = lv_obj_get_style(label); diff --git a/src/lv_objx/lv_label.h b/src/lv_objx/lv_label.h index 8189734ee..9cef48eeb 100644 --- a/src/lv_objx/lv_label.h +++ b/src/lv_objx/lv_label.h @@ -40,13 +40,13 @@ extern "C" { /*Long mode behaviors. Used in 'lv_label_ext_t' */ enum { - LV_LABEL_LONG_EXPAND, /*Expand the object size to the text size*/ - LV_LABEL_LONG_BREAK, /*Keep the object width, break the too long lines and expand the object - height*/ - LV_LABEL_LONG_DOT, /*Keep the size and write dots at the end if the text is too long*/ + LV_LABEL_LONG_EXPAND, /*Expand the object size to the text size*/ + LV_LABEL_LONG_BREAK, /*Keep the object width, break the too long lines and expand the object + height*/ + LV_LABEL_LONG_DOT, /*Keep the size and write dots at the end if the text is too long*/ LV_LABEL_LONG_SROLL, /*Keep the size and roll the text back and forth*/ LV_LABEL_LONG_SROLL_CIRC, /*Keep the size and roll the text circularly*/ - LV_LABEL_LONG_CROP, /*Keep the size and crop the text out of it*/ + LV_LABEL_LONG_CROP, /*Keep the size and crop the text out of it*/ }; typedef uint8_t lv_label_long_mode_t; @@ -73,7 +73,7 @@ typedef struct uint16_t dot_end; /*The text end position in dot mode (Handled by the library)*/ lv_point_t offset; /*Text draw position offset*/ - lv_draw_label_hint_t hint; /*Used to buffer info about large text*/ + lv_draw_label_hint_t hint; /*Used to buffer info about large text*/ #if LV_USE_ANIMATION uint16_t anim_speed; /*Speed of scroll and roll animation in px/sec unit*/ #endif @@ -184,7 +184,7 @@ void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed); */ static inline void lv_label_set_style(lv_obj_t * label, lv_label_style_t type, const lv_style_t * style) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ lv_obj_set_style(label, style); } @@ -282,7 +282,7 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos); */ static inline const lv_style_t * lv_label_get_style(const lv_obj_t * label, lv_label_style_t type) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ return lv_obj_get_style(label); } diff --git a/src/lv_objx/lv_led.h b/src/lv_objx/lv_led.h index 530be5c57..a0c9125e8 100644 --- a/src/lv_objx/lv_led.h +++ b/src/lv_objx/lv_led.h @@ -88,9 +88,9 @@ void lv_led_toggle(lv_obj_t * led); * @param type which style should be set (can be only `LV_LED_STYLE_MAIN`) * @param style pointer to a style */ -static inline void lv_led_set_style(lv_obj_t * led, lv_led_style_t type, const lv_style_t * style) +static inline void lv_led_set_style(lv_obj_t * led, lv_led_style_t type, const lv_style_t * style) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ lv_obj_set_style(led, style); } @@ -109,7 +109,7 @@ uint8_t lv_led_get_bright(const lv_obj_t * led); */ static inline const lv_style_t * lv_led_get_style(const lv_obj_t * led, lv_led_style_t type) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ return lv_obj_get_style(led); } diff --git a/src/lv_objx/lv_line.h b/src/lv_objx/lv_line.h index ad677c9fb..cfea7368e 100644 --- a/src/lv_objx/lv_line.h +++ b/src/lv_objx/lv_line.h @@ -100,7 +100,7 @@ void lv_line_set_y_invert(lv_obj_t * line, bool en); */ static inline void lv_line_set_style(lv_obj_t * line, lv_line_style_t type, const lv_style_t * style) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ lv_obj_set_style(line, style); } @@ -130,7 +130,7 @@ bool lv_line_get_y_invert(const lv_obj_t * line); */ static inline const lv_style_t * lv_line_get_style(const lv_obj_t * line, lv_line_style_t type) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ return lv_obj_get_style(line); } diff --git a/src/lv_objx/lv_list.c b/src/lv_objx/lv_list.c index db95034b4..aee3b2344 100644 --- a/src/lv_objx/lv_list.c +++ b/src/lv_objx/lv_list.c @@ -88,8 +88,8 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy) ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel; ext->styles_btn[LV_BTN_STATE_TGL_PR] = &lv_style_btn_tgl_pr; ext->styles_btn[LV_BTN_STATE_INA] = &lv_style_btn_ina; - ext->single_mode = false; - ext->size = 0; + ext->single_mode = false; + ext->size = 0; #if LV_USE_GROUP ext->last_sel = NULL; diff --git a/src/lv_objx/lv_list.h b/src/lv_objx/lv_list.h index 0aed99f32..6bb36a58a 100644 --- a/src/lv_objx/lv_list.h +++ b/src/lv_objx/lv_list.h @@ -52,9 +52,9 @@ typedef struct { lv_page_ext_t page; /*Ext. of ancestor*/ /*New data for this type */ - const lv_style_t * styles_btn[LV_BTN_STATE_NUM]; /*Styles of the list element buttons*/ - const lv_style_t * style_img; /*Style of the list element images on buttons*/ - uint16_t size; /*the number of items(buttons) in the list*/ + const lv_style_t * styles_btn[_LV_BTN_STATE_NUM]; /*Styles of the list element buttons*/ + const lv_style_t * style_img; /*Style of the list element images on buttons*/ + uint16_t size; /*the number of items(buttons) in the list*/ uint8_t single_mode : 1; /* whether single selected mode is enabled */ diff --git a/src/lv_objx/lv_lmeter.h b/src/lv_objx/lv_lmeter.h index e83ccbfb8..e1a70a64f 100644 --- a/src/lv_objx/lv_lmeter.h +++ b/src/lv_objx/lv_lmeter.h @@ -96,7 +96,7 @@ void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt); */ static inline void lv_lmeter_set_style(lv_obj_t * lmeter, lv_lmeter_style_t type, lv_style_t * style) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ lv_obj_set_style(lmeter, style); } @@ -147,7 +147,7 @@ uint16_t lv_lmeter_get_scale_angle(const lv_obj_t * lmeter); */ static inline const lv_style_t * lv_lmeter_get_style(const lv_obj_t * lmeter, lv_lmeter_style_t type) { - (void) type; /*Unused*/ + (void)type; /*Unused*/ return lv_obj_get_style(lmeter); } diff --git a/src/lv_objx/lv_page.c b/src/lv_objx/lv_page.c index dbd711ff9..549c891e1 100644 --- a/src/lv_objx/lv_page.c +++ b/src/lv_objx/lv_page.c @@ -101,7 +101,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy) ext->edge_flash.right_ip = 0; ext->edge_flash.state = 0; ext->edge_flash.style = &lv_style_plain_color; - ext->anim_time = LV_PAGE_DEF_ANIM_TIME; + ext->anim_time = LV_PAGE_DEF_ANIM_TIME; #endif ext->scroll_prop = 0; ext->scroll_prop_ip = 0; @@ -218,12 +218,11 @@ void lv_page_set_anim_time(lv_obj_t * page, uint16_t anim_time) { #if LV_USE_ANIMATION lv_page_ext_t * ext = lv_obj_get_ext_attr(page); - ext->anim_time = anim_time; + ext->anim_time = anim_time; #else - (void)page; /*Unused*/ - (void)anim_time; /*Unused*/ + (void)page; /*Unused*/ + (void)anim_time; /*Unused*/ #endif - } /** @@ -308,7 +307,7 @@ uint16_t lv_page_get_anim_time(const lv_obj_t * page) lv_page_ext_t * ext = lv_obj_get_ext_attr(page); return ext->anim_time; #else - (void) page; /*Unused*/ + (void)page; /*Unused*/ return 0; #endif } @@ -423,14 +422,10 @@ bool lv_page_on_edge(lv_obj_t * page, lv_page_edge_t edge) lv_obj_get_coords(scrl, &scrl_coords); lv_obj_get_coords(page, &page_coords); - if((edge & LV_PAGE_EDGE_TOP) && scrl_coords.y1 == page_coords.y1 + page_style->body.padding.top) - return true; - if((edge & LV_PAGE_EDGE_BOTTOM) && scrl_coords.y2 == page_coords.y2 - page_style->body.padding.bottom) - return true; - if((edge & LV_PAGE_EDGE_LEFT) && scrl_coords.x1 == page_coords.x1 + page_style->body.padding.left) - return true; - if((edge & LV_PAGE_EDGE_RIGHT) && scrl_coords.x2 == page_coords.x2 - page_style->body.padding.right) - return true; + if((edge & LV_PAGE_EDGE_TOP) && scrl_coords.y1 == page_coords.y1 + page_style->body.padding.top) return true; + if((edge & LV_PAGE_EDGE_BOTTOM) && scrl_coords.y2 == page_coords.y2 - page_style->body.padding.bottom) return true; + if((edge & LV_PAGE_EDGE_LEFT) && scrl_coords.x1 == page_coords.x1 + page_style->body.padding.left) return true; + if((edge & LV_PAGE_EDGE_RIGHT) && scrl_coords.x2 == page_coords.x2 - page_style->body.padding.right) return true; return false; } @@ -446,7 +441,6 @@ void lv_page_glue_obj(lv_obj_t * obj, bool glue) lv_obj_set_drag(obj, glue); } - /** * Focus on an object. It ensures that the object will be visible on the page. * @param page pointer to a page object @@ -625,7 +619,7 @@ void lv_page_start_edge_flash(lv_obj_t * page) lv_anim_create(&a); } #else - (void) page; /*Unused*/ + (void)page; /*Unused*/ #endif } @@ -940,7 +934,6 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi if(lv_obj_get_parent(page_parent) != NULL) { /*Do not propagate the scroll to a screen*/ page_ext->scroll_prop_ip = 1; - } } } diff --git a/src/lv_objx/lv_page.h b/src/lv_objx/lv_page.h index 59b62d5ec..37d5ef1f0 100644 --- a/src/lv_objx/lv_page.h +++ b/src/lv_objx/lv_page.h @@ -50,12 +50,7 @@ enum { typedef uint8_t lv_sb_mode_t; /*Edges: describes the four edges of the page*/ -enum { - LV_PAGE_EDGE_LEFT = 0x1, - LV_PAGE_EDGE_TOP = 0x2, - LV_PAGE_EDGE_RIGHT = 0x4, - LV_PAGE_EDGE_BOTTOM = 0x8 -}; +enum { LV_PAGE_EDGE_LEFT = 0x1, LV_PAGE_EDGE_TOP = 0x2, LV_PAGE_EDGE_RIGHT = 0x4, LV_PAGE_EDGE_BOTTOM = 0x8 }; typedef uint8_t lv_page_edge_t; /*Data of page*/ diff --git a/src/lv_objx/lv_roller.c b/src/lv_objx/lv_roller.c index 6a11cfc0f..05c3b0919 100644 --- a/src/lv_objx/lv_roller.c +++ b/src/lv_objx/lv_roller.c @@ -107,7 +107,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy) /*Copy an existing roller*/ else { lv_roller_ext_t * copy_ext = lv_obj_get_ext_attr(copy); - ext->mode = copy_ext->mode; + ext->mode = copy_ext->mode; lv_obj_t * scrl = lv_page_get_scrl(new_roller); lv_ddlist_open(new_roller, false); @@ -321,9 +321,9 @@ static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_desig rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.line_space / 2; if((font_h & 0x1) && (style->text.line_space & 0x1)) rect_area.y1--; /*Compensate the two rounding error*/ rect_area.y2 = rect_area.y1 + font_h + style->text.line_space - 1; - lv_area_t roller_coords; - lv_obj_get_coords(roller, &roller_coords); - lv_obj_get_inner_coords(roller, &roller_coords); + lv_area_t roller_coords; + lv_obj_get_coords(roller, &roller_coords); + lv_obj_get_inner_coords(roller, &roller_coords); rect_area.x1 = roller_coords.x1; rect_area.x2 = roller_coords.x2; @@ -607,7 +607,7 @@ static void refr_position(lv_obj_t * roller, lv_anim_enable_t anim_en) const lv_font_t * font = style_label->text.font; lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t h = lv_obj_get_height(roller); - uint16_t anim_time = lv_roller_get_anim_time(roller); + uint16_t anim_time = lv_roller_get_anim_time(roller); /* Normally the animtaion's `end_cb` sets correct position of the roller is infinite. * But without animations do it manually*/ diff --git a/src/lv_objx/lv_roller.h b/src/lv_objx/lv_roller.h index 677a7dd15..154dbe95d 100644 --- a/src/lv_objx/lv_roller.h +++ b/src/lv_objx/lv_roller.h @@ -38,7 +38,6 @@ extern "C" { * TYPEDEFS **********************/ - enum { LV_ROLLER_MODE_NORMAL, LV_ROLLER_MODE_INIFINITE, @@ -46,8 +45,6 @@ enum { typedef uint8_t lv_roller_mode_t; - - /*Data of roller*/ typedef struct { diff --git a/src/lv_objx/lv_sw.c b/src/lv_objx/lv_sw.c index a398cf2c2..80854b0a0 100644 --- a/src/lv_objx/lv_sw.c +++ b/src/lv_objx/lv_sw.c @@ -241,7 +241,7 @@ uint16_t lv_sw_get_anim_time(const lv_obj_t * sw) lv_sw_ext_t * ext = lv_obj_get_ext_attr(sw); return ext->anim_time; #else - (void) sw; /*Unused*/ + (void)sw; /*Unused*/ return 0; #endif } @@ -335,8 +335,7 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param) if(lv_sw_get_state(sw)) { lv_sw_off(sw, LV_ANIM_ON); state = 0; - } - else { + } else { lv_sw_on(sw, LV_ANIM_ON); state = 1; } @@ -351,7 +350,7 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param) if(v > LV_SW_MAX_VALUE / 2) { lv_sw_on(sw, LV_ANIM_ON); state = 1; - } else{ + } else { lv_sw_off(sw, LV_ANIM_ON); state = 0; } @@ -364,12 +363,12 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param) if(c == LV_KEY_RIGHT || c == LV_KEY_UP) { lv_slider_set_value(sw, LV_SW_MAX_VALUE, true); state = 1; - res = lv_event_send(sw, LV_EVENT_VALUE_CHANGED, &state); + res = lv_event_send(sw, LV_EVENT_VALUE_CHANGED, &state); if(res != LV_RES_OK) return res; } else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) { lv_slider_set_value(sw, 0, true); state = 0; - res = lv_event_send(sw, LV_EVENT_VALUE_CHANGED, &state); + res = lv_event_send(sw, LV_EVENT_VALUE_CHANGED, &state); if(res != LV_RES_OK) return res; } } else if(sign == LV_SIGNAL_GET_EDITABLE) { diff --git a/src/lv_objx/lv_ta.c b/src/lv_objx/lv_ta.c index 408260679..d2f079392 100644 --- a/src/lv_objx/lv_ta.c +++ b/src/lv_objx/lv_ta.c @@ -112,10 +112,10 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy) ext->cursor.valid_x = 0; ext->one_line = 0; #if LV_LABEL_TEXT_SEL - ext->text_sel_en = 0; + ext->text_sel_en = 0; #endif - ext->label = NULL; - ext->placeholder = NULL; + ext->label = NULL; + ext->placeholder = NULL; #if LV_USE_ANIMATION == 0 ext->pwd_show_time = 0; @@ -627,7 +627,7 @@ void lv_ta_set_cursor_type(lv_obj_t * ta, lv_cursor_type_t cur_type) */ void lv_ta_set_cursor_click_pos(lv_obj_t * ta, bool en) { - lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); + lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); ext->cursor.click_pos = en ? 1 : 0; } @@ -1455,7 +1455,8 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void } else if(sign == LV_SIGNAL_CORD_CHG) { /*Set the label width according to the text area width*/ if(ext->label) { - if(lv_obj_get_width(scrl) != lv_area_get_width(param) || lv_obj_get_height(scrl) != lv_area_get_height(param)) { + if(lv_obj_get_width(scrl) != lv_area_get_width(param) || + lv_obj_get_height(scrl) != lv_area_get_height(param)) { const lv_style_t * style_scrl = lv_obj_get_style(scrl); lv_obj_set_width(ext->label, lv_page_get_fit_width(ta)); @@ -1610,8 +1611,7 @@ static void get_cursor_style(lv_obj_t * ta, lv_style_t * style_res) static void refr_cursor_area(lv_obj_t * ta) { - lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); - + lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); const lv_style_t * label_style = lv_obj_get_style(ext->label); @@ -1739,14 +1739,13 @@ static void update_cursor_position_on_click(lv_obj_t * ta, lv_signal_t sign, lv_ lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); if(ext->cursor.click_pos == 0) return; - if(ext->cursor.type == LV_CURSOR_NONE) return; + if(ext->cursor.type == LV_CURSOR_NONE) return; if(lv_indev_get_type(click_source) == LV_INDEV_TYPE_KEYPAD || lv_indev_get_type(click_source) == LV_INDEV_TYPE_ENCODER) { return; } - lv_area_t label_coords; lv_obj_get_coords(ext->label, &label_coords); diff --git a/src/lv_objx/lv_ta.h b/src/lv_objx/lv_ta.h index c33ac8cf4..48dba2bb8 100644 --- a/src/lv_objx/lv_ta.h +++ b/src/lv_objx/lv_ta.h @@ -76,7 +76,7 @@ typedef struct uint16_t txt_byte_pos; /* Byte index of the letter after (on) the cursor*/ lv_cursor_type_t type : 4; /* Shape of the cursor*/ uint8_t state : 1; /*Cursor is visible now or not (Handled by the library)*/ - uint8_t click_pos :1; /*1: Enable positioning the cursor by clicking the text area*/ + uint8_t click_pos : 1; /*1: Enable positioning the cursor by clicking the text area*/ } cursor; #if LV_LABEL_TEXT_SEL uint16_t tmp_sel_start; /*Temporary value*/ diff --git a/src/lv_objx/lv_tabview.c b/src/lv_objx/lv_tabview.c index 104f28595..bdc59724d 100644 --- a/src/lv_objx/lv_tabview.c +++ b/src/lv_objx/lv_tabview.c @@ -361,7 +361,7 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an if(anim == LV_ANIM_OFF || lv_tabview_get_anim_time(tabview) == 0) { lv_obj_set_x(ext->content, cont_x); - } + } #if LV_USE_ANIMATION else { lv_anim_t a; @@ -400,7 +400,7 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an } #if LV_USE_ANIMATION - if(anim == LV_ANIM_OFF || ext->anim_time == 0) + if(anim == LV_ANIM_OFF || ext->anim_time == 0) #endif { switch(ext->btns_pos) { @@ -409,7 +409,7 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an case LV_TABVIEW_BTNS_POS_LEFT: case LV_TABVIEW_BTNS_POS_RIGHT: lv_obj_set_y(ext->indic, indic_pos); break; } - } + } #if LV_USE_ANIMATION else { lv_anim_t a; @@ -956,7 +956,6 @@ static void tab_btnm_event_cb(lv_obj_t * tab_btnm, lv_event_t event) if(id_prev != id_new) res = lv_event_send(tabview, LV_EVENT_VALUE_CHANGED, &id_new); if(res != LV_RES_OK) return; - } /** diff --git a/src/lv_objx/lv_tileview.c b/src/lv_objx/lv_tileview.c index 5b01d215e..ae86ea7dd 100644 --- a/src/lv_objx/lv_tileview.c +++ b/src/lv_objx/lv_tileview.c @@ -80,9 +80,9 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy) #if LV_USE_ANIMATION ext->anim_time = LV_TILEVIEW_DEF_ANIM_TIME; #endif - ext->act_id.x = 0; - ext->act_id.y = 0; - ext->valid_pos = NULL; + ext->act_id.x = 0; + ext->act_id.y = 0; + ext->valid_pos = NULL; ext->valid_pos_cnt = 0; /*The signal and design functions are not copied so set them here*/ @@ -116,8 +116,8 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy) lv_tileview_ext_t * copy_ext = lv_obj_get_ext_attr(copy); ext->act_id.x = copy_ext->act_id.x; ext->act_id.y = copy_ext->act_id.y; - ext->valid_pos = copy_ext->valid_pos; - ext->valid_pos_cnt = copy_ext->valid_pos_cnt; + ext->valid_pos = copy_ext->valid_pos; + ext->valid_pos_cnt = copy_ext->valid_pos_cnt; #if LV_USE_ANIMATION ext->anim_time = copy_ext->anim_time; #endif @@ -169,7 +169,7 @@ void lv_tileview_set_valid_positions(lv_obj_t * tileview, const lv_point_t * val { lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview); ext->valid_pos = valid_pos; - ext->valid_pos_cnt = valid_pos_cnt; + ext->valid_pos_cnt = valid_pos_cnt; /*If valid pos. is selected do nothing*/ uint16_t i; diff --git a/src/lv_objx/lv_tileview.h b/src/lv_objx/lv_tileview.h index 26f0933ed..9852f6ff5 100644 --- a/src/lv_objx/lv_tileview.h +++ b/src/lv_objx/lv_tileview.h @@ -83,7 +83,6 @@ void lv_tileview_add_element(lv_obj_t * tileview, lv_obj_t * element); * Setter functions *====================*/ - /** * Set the valid position's indices. The scrolling will be possible only to these positions. * @param tileview pointer to a Tileview object diff --git a/src/lv_objx/lv_win.c b/src/lv_objx/lv_win.c index c062a9728..946c8a8f8 100644 --- a/src/lv_objx/lv_win.c +++ b/src/lv_objx/lv_win.c @@ -94,7 +94,6 @@ lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy) ext->title = lv_label_create(ext->header, NULL); lv_label_set_text(ext->title, "My title"); - /*Set the default styles*/ lv_theme_t * th = lv_theme_get_current(); if(th) { diff --git a/src/lv_objx/lv_win.h b/src/lv_objx/lv_win.h index 8f4599afc..4535af7df 100644 --- a/src/lv_objx/lv_win.h +++ b/src/lv_objx/lv_win.h @@ -228,7 +228,6 @@ uint16_t lv_win_get_anim_time(const lv_obj_t * win); */ lv_coord_t lv_win_get_width(lv_obj_t * win); - /** * Get a style of a window * @param win pointer to a button object diff --git a/src/lv_themes/lv_theme_alien.c b/src/lv_themes/lv_theme_alien.c index 54cdde769..987a36310 100644 --- a/src/lv_themes/lv_theme_alien.c +++ b/src/lv_themes/lv_theme_alien.c @@ -108,9 +108,9 @@ static void basic_init(void) lv_style_copy(&scr, &bg); scr.body.padding.bottom = 0; - scr.body.padding.top = 0; - scr.body.padding.left = 0; - scr.body.padding.right = 0; + scr.body.padding.top = 0; + scr.body.padding.left = 0; + scr.body.padding.right = 0; /*Panel*/ lv_style_copy(&panel, &def); @@ -140,7 +140,7 @@ static void basic_init(void) sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/ theme.style.bg = &bg; - theme.style.scr = &scr; + theme.style.scr = &scr; theme.style.panel = &panel; } @@ -828,12 +828,12 @@ static void win_init(void) header.text.color = lv_color_hsv_to_rgb(_hue, 5, 100); header.image.color = lv_color_hsv_to_rgb(_hue, 5, 100); - theme.style.win.bg = &bg; - theme.style.win.sb = &sb; - theme.style.win.header = &header; + theme.style.win.bg = &bg; + theme.style.win.sb = &sb; + theme.style.win.header = &header; theme.style.win.content = &lv_style_transp; - theme.style.win.btn.rel = &btn_rel; - theme.style.win.btn.pr = &btn_pr; + theme.style.win.btn.rel = &btn_rel; + theme.style.win.btn.pr = &btn_pr; #endif } diff --git a/src/lv_themes/lv_theme_default.c b/src/lv_themes/lv_theme_default.c index fba356ac4..d13dfbc95 100644 --- a/src/lv_themes/lv_theme_default.c +++ b/src/lv_themes/lv_theme_default.c @@ -55,12 +55,11 @@ static void basic_init(void) { lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/ - lv_style_copy(&scr, &def); scr.body.padding.bottom = 0; - scr.body.padding.top = 0; - scr.body.padding.left = 0; - scr.body.padding.right = 0; + scr.body.padding.top = 0; + scr.body.padding.left = 0; + scr.body.padding.right = 0; lv_style_copy(&sb, &lv_style_pretty_color); sb.body.grad_color = sb.body.main_color; @@ -72,7 +71,7 @@ static void basic_init(void) plain_bordered.body.border.color = lv_color_hex3(0xbbb); theme.style.bg = &lv_style_plain; - theme.style.scr = &scr; + theme.style.scr = &scr; theme.style.panel = &lv_style_pretty; } @@ -346,12 +345,12 @@ static void win_init(void) { #if LV_USE_WIN != 0 - theme.style.win.bg = &plain_bordered; - theme.style.win.sb = &sb; - theme.style.win.header = &lv_style_plain_color; + theme.style.win.bg = &plain_bordered; + theme.style.win.sb = &sb; + theme.style.win.header = &lv_style_plain_color; theme.style.win.content = &lv_style_transp; - theme.style.win.btn.rel = &lv_style_btn_rel; - theme.style.win.btn.pr = &lv_style_btn_pr; + theme.style.win.btn.rel = &lv_style_btn_rel; + theme.style.win.btn.pr = &lv_style_btn_pr; #endif } diff --git a/src/lv_themes/lv_theme_material.c b/src/lv_themes/lv_theme_material.c index 147a077bd..a8a408722 100644 --- a/src/lv_themes/lv_theme_material.c +++ b/src/lv_themes/lv_theme_material.c @@ -60,9 +60,9 @@ static void basic_init(void) lv_style_copy(&scr, &bg); scr.body.padding.bottom = 0; - scr.body.padding.top = 0; - scr.body.padding.left = 0; - scr.body.padding.right = 0; + scr.body.padding.top = 0; + scr.body.padding.left = 0; + scr.body.padding.right = 0; lv_style_copy(&panel, &def); panel.body.radius = DEF_RADIUS; @@ -90,7 +90,7 @@ static void basic_init(void) sb.body.padding.bottom = LV_DPI / 25; theme.style.bg = &bg; - theme.style.scr = &scr; + theme.style.scr = &scr; theme.style.panel = &panel; } @@ -792,12 +792,12 @@ static void win_init(void) pr.text.color = lv_color_hex3(0x111); pr.image.color = lv_color_hex3(0x111); - theme.style.win.bg = theme.style.panel; - theme.style.win.sb = &sb; - theme.style.win.header = &header; + theme.style.win.bg = theme.style.panel; + theme.style.win.sb = &sb; + theme.style.win.header = &header; theme.style.win.content = &lv_style_transp; - theme.style.win.btn.rel = &lv_style_transp; - theme.style.win.btn.pr = ≺ + theme.style.win.btn.rel = &lv_style_transp; + theme.style.win.btn.pr = ≺ #endif } diff --git a/src/lv_themes/lv_theme_mono.c b/src/lv_themes/lv_theme_mono.c index a99c2a36b..9c2e7743f 100644 --- a/src/lv_themes/lv_theme_mono.c +++ b/src/lv_themes/lv_theme_mono.c @@ -76,12 +76,11 @@ static void basic_init(void) def.image.intense = LV_OPA_TRANSP; def.image.opa = LV_OPA_COVER; - lv_style_copy(&scr, &light_plain); scr.body.padding.bottom = 0; - scr.body.padding.top = 0; - scr.body.padding.left = 0; - scr.body.padding.right = 0; + scr.body.padding.top = 0; + scr.body.padding.left = 0; + scr.body.padding.right = 0; lv_style_copy(&light_plain, &def); @@ -100,7 +99,7 @@ static void basic_init(void) dark_frame.body.radius = LV_DPI / 20; theme.style.bg = &def; - theme.style.scr = &scr; + theme.style.scr = &scr; theme.style.panel = &light_frame; } @@ -401,12 +400,12 @@ static void win_init(void) win_header.body.padding.top = LV_DPI / 30; win_header.body.padding.bottom = LV_DPI / 30; - theme.style.win.bg = &light_frame; - theme.style.win.sb = &dark_frame; - theme.style.win.header = &win_header; + theme.style.win.bg = &light_frame; + theme.style.win.sb = &dark_frame; + theme.style.win.header = &win_header; theme.style.win.content = &lv_style_transp; - theme.style.win.btn.rel = &light_frame; - theme.style.win.btn.pr = &dark_frame; + theme.style.win.btn.rel = &light_frame; + theme.style.win.btn.pr = &dark_frame; #endif } diff --git a/src/lv_themes/lv_theme_nemo.c b/src/lv_themes/lv_theme_nemo.c index 310440079..cd4bd002a 100644 --- a/src/lv_themes/lv_theme_nemo.c +++ b/src/lv_themes/lv_theme_nemo.c @@ -108,12 +108,11 @@ static void basic_init(void) bg.body.border.color = lv_color_hex3(0x666); bg.body.shadow.color = LV_COLOR_SILVER; - lv_style_copy(&scr, &bg); scr.body.padding.bottom = 0; - scr.body.padding.top = 0; - scr.body.padding.left = 0; - scr.body.padding.right = 0; + scr.body.padding.top = 0; + scr.body.padding.left = 0; + scr.body.padding.right = 0; /*Panel*/ lv_style_copy(&panel, &def); @@ -798,12 +797,12 @@ static void win_init(void) win_header.body.border.color = lv_color_hsv_to_rgb(_hue, 20, 80); win_header.text.color = lv_color_hsv_to_rgb(_hue, 5, 100); - theme.style.win.bg = &bg; - theme.style.win.sb = &sb; - theme.style.win.header = &win_header; + theme.style.win.bg = &bg; + theme.style.win.sb = &sb; + theme.style.win.header = &win_header; theme.style.win.content = &lv_style_transp; - theme.style.win.btn.rel = &btn_rel; - theme.style.win.btn.pr = &btn_pr; + theme.style.win.btn.rel = &btn_rel; + theme.style.win.btn.pr = &btn_pr; #endif } diff --git a/src/lv_themes/lv_theme_night.c b/src/lv_themes/lv_theme_night.c index 93eab0fc7..46bacdf9e 100644 --- a/src/lv_themes/lv_theme_night.c +++ b/src/lv_themes/lv_theme_night.c @@ -63,9 +63,9 @@ static void basic_init(void) lv_style_copy(&scr, &bg); scr.body.padding.bottom = 0; - scr.body.padding.top = 0; - scr.body.padding.left = 0; - scr.body.padding.right = 0; + scr.body.padding.top = 0; + scr.body.padding.left = 0; + scr.body.padding.right = 0; lv_style_copy(&sb, &def); sb.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 60); @@ -93,9 +93,9 @@ static void basic_init(void) panel.line.color = lv_color_hsv_to_rgb(_hue, 20, 40); panel.line.width = 1; - theme.style.scr = &scr; - theme.style.bg = &bg; - theme.style.panel = &def; + theme.style.scr = &scr; + theme.style.bg = &bg; + theme.style.panel = &def; } static void cont_init(void) @@ -719,12 +719,12 @@ static void win_init(void) win_btn_pr.text.color = lv_color_hex3(0xaaa); win_btn_pr.image.color = lv_color_hex3(0xaaa); - theme.style.win.bg = &win_bg; - theme.style.win.sb = &sb; - theme.style.win.header = &win_header; + theme.style.win.bg = &win_bg; + theme.style.win.sb = &sb; + theme.style.win.header = &win_header; theme.style.win.content = &lv_style_transp; - theme.style.win.btn.rel = &lv_style_transp; - theme.style.win.btn.pr = &win_btn_pr; + theme.style.win.btn.rel = &lv_style_transp; + theme.style.win.btn.pr = &win_btn_pr; #endif } diff --git a/src/lv_themes/lv_theme_templ.c b/src/lv_themes/lv_theme_templ.c index a76e09474..fecbdb844 100644 --- a/src/lv_themes/lv_theme_templ.c +++ b/src/lv_themes/lv_theme_templ.c @@ -46,7 +46,7 @@ static void basic_init(void) lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/ def.text.font = _font; - theme.style.scr = &def; + theme.style.scr = &def; theme.style.bg = &def; theme.style.panel = &def; } @@ -333,12 +333,12 @@ static void win_init(void) { #if LV_USE_WIN != 0 - theme.style.win.bg = &def; - theme.style.win.sb = &def; - theme.style.win.header = &def; - theme.style.win.content = &def; - theme.style.win.btn.rel = &def; - theme.style.win.btn.pr = &def; + theme.style.win.bg = &def; + theme.style.win.sb = &def; + theme.style.win.header = &def; + theme.style.win.content = &def; + theme.style.win.btn.rel = &def; + theme.style.win.btn.pr = &def; #endif } diff --git a/src/lv_themes/lv_theme_zen.c b/src/lv_themes/lv_theme_zen.c index b12bc8926..2135c0e9b 100644 --- a/src/lv_themes/lv_theme_zen.c +++ b/src/lv_themes/lv_theme_zen.c @@ -63,9 +63,9 @@ static void basic_init(void) lv_style_copy(&scr, &bg); scr.body.padding.bottom = 0; - scr.body.padding.top = 0; - scr.body.padding.left = 0; - scr.body.padding.right = 0; + scr.body.padding.top = 0; + scr.body.padding.left = 0; + scr.body.padding.right = 0; lv_style_copy(&panel, &bg); panel.body.radius = LV_DPI / 10; @@ -87,7 +87,7 @@ static void basic_init(void) sb.body.radius = LV_RADIUS_CIRCLE; sb.body.padding.inner = LV_DPI / 10; - theme.style.scr = &scr; + theme.style.scr = &scr; theme.style.bg = &bg; theme.style.panel = &panel; } @@ -768,12 +768,12 @@ static void win_init(void) pr.text.color = lv_color_hex3(0x333); pr.image.color = lv_color_hex3(0x333); - theme.style.win.bg = theme.style.panel; - theme.style.win.sb = &sb; - theme.style.win.header = &header; + theme.style.win.bg = theme.style.panel; + theme.style.win.sb = &sb; + theme.style.win.header = &header; theme.style.win.content = &lv_style_transp; - theme.style.win.btn.rel = &rel; - theme.style.win.btn.pr = ≺ + theme.style.win.btn.rel = &rel; + theme.style.win.btn.pr = ≺ #endif }