run clang-formatter

This commit is contained in:
Gabor Kiss-Vamosi
2019-06-27 07:16:15 +02:00
parent e1989c5706
commit 8f962a0464
62 changed files with 372 additions and 357 deletions

View File

@@ -133,11 +133,11 @@ static inline void lv_scr_load(lv_obj_t * scr)
#ifndef LV_HOR_RES #ifndef LV_HOR_RES
#define LV_HOR_RES lv_disp_get_hor_res(lv_disp_get_default()) #define LV_HOR_RES lv_disp_get_hor_res(lv_disp_get_default())
#endif #endif
#ifndef LV_VER_RES #ifndef LV_VER_RES
#define LV_VER_RES lv_disp_get_ver_res(lv_disp_get_default()) #define LV_VER_RES lv_disp_get_ver_res(lv_disp_get_default())
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

View File

@@ -565,7 +565,7 @@ static void style_mod_def(lv_group_t * group, lv_style_t * style)
/*Add some recolor to the images*/ /*Add some recolor to the images*/
if(style->image.intense < LV_OPA_MIN) { 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; style->image.intense = LV_OPA_40;
} }
#else #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*/ /*Add some recolor to the images*/
if(style->image.intense < LV_OPA_MIN) { 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; style->image.intense = LV_OPA_40;
} }

View File

@@ -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; event_temp_data_head = &event_temp_data;
const void * event_act_data_save = event_act_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*/ /*Call the input device's feedback callback if set*/
lv_indev_t * indev_act = lv_indev_get_act(); 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) * (Without the size of the border or other extra graphical elements)
* @param coords_p store the result area here * @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); const lv_style_t * style = lv_obj_get_style(obj);
if(style->body.border.part & LV_BORDER_LEFT) if(style->body.border.part & LV_BORDER_LEFT) coords_p->x1 += style->body.border.width;
coords_p->x1 += style->body.border.width;
if(style->body.border.part & LV_BORDER_RIGHT) if(style->body.border.part & LV_BORDER_RIGHT) coords_p->x2 -= style->body.border.width;
coords_p->x2 -= style->body.border.width;
if(style->body.border.part & LV_BORDER_TOP) if(style->body.border.part & LV_BORDER_TOP) coords_p->y1 += style->body.border.width;
coords_p->y1 += style->body.border.width;
if(style->body.border.part & LV_BORDER_BOTTOM) if(style->body.border.part & LV_BORDER_BOTTOM) coords_p->y2 -= style->body.border.width;
coords_p->y2 -= style->body.border.width;
} }
/** /**
* Get the x coordinate of object * Get the x coordinate of object
* @param obj pointer to an object * @param obj pointer to an object

View File

@@ -242,7 +242,6 @@ typedef struct
... [x]: "lv_obj" */ ... [x]: "lv_obj" */
} lv_obj_type_t; } lv_obj_type_t;
/********************** /**********************
* GLOBAL PROTOTYPES * 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) * (Without the size of the border or other extra graphical elements)
* @param coords_p store the result area here * @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 * Get the x coordinate of object

View File

@@ -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 /*In double buffered mode wait until the other buffer is flushed before flushing the current
* one*/ * one*/
if(lv_disp_is_double_buf(disp_refr)) { if(lv_disp_is_double_buf(disp_refr)) {
while(vdb->flushing); while(vdb->flushing)
;
} }
vdb->flushing = 1; 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(disp->driver.flush_cb) disp->driver.flush_cb(&disp->driver, &vdb->area, vdb->buf_act);
if(vdb->buf1 && vdb->buf2) { if(vdb->buf1 && vdb->buf2) {
if(vdb->buf_act == vdb->buf1) vdb->buf_act = vdb->buf2; if(vdb->buf_act == vdb->buf1)
else vdb->buf_act = vdb->buf1; vdb->buf_act = vdb->buf2;
else
vdb->buf_act = vdb->buf1;
} }
} }

View File

@@ -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; x -= vdb->area.x1;
y -= vdb->area.y1; y -= vdb->area.y1;
if(disp->driver.set_px_cb) { if(disp->driver.set_px_cb) {
disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, x, y, color, opa); disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, x, y, color, opa);
} else { } else {
bool scr_transp = false; bool scr_transp = false;
#if LV_COLOR_SCREEN_TRANSP #if LV_COLOR_SCREEN_TRANSP
scr_transp = disp->driver.screen_transp; scr_transp = disp->driver.screen_transp;
#endif #endif
lv_color_t * vdb_px_p = vdb->buf_act; lv_color_t * vdb_px_p = vdb->buf_act;
vdb_px_p += y * vdb_width + x; 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 row;
lv_coord_t map_useful_w = lv_area_get_width(&masked_a); lv_coord_t map_useful_w = lv_area_get_width(&masked_a);
bool scr_transp = false; bool scr_transp = false;
#if LV_COLOR_SCREEN_TRANSP #if LV_COLOR_SCREEN_TRANSP
scr_transp = disp->driver.screen_transp; scr_transp = disp->driver.screen_transp;
#endif #endif
/*The simplest case just copy the pixels into the VDB*/ /*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) { 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*/ /*Normal native VDB write*/
else { else {
if(opa_result == LV_OPA_COVER) if(opa_result == LV_OPA_COVER)
vdb_buf_tmp[col] = px_color; vdb_buf_tmp[col] = px_color;
else { 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); vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result);
} else { } else {
#if LV_COLOR_DEPTH == 32 #if LV_COLOR_DEPTH == 32
vdb_buf_tmp[col] = vdb_buf_tmp[col] = color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].ch.alpha,
color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].ch.alpha, px_color, opa_result); px_color, opa_result);
#endif #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*/ /*Calculate with alpha too*/
else { else {
bool scr_transp = false; bool scr_transp = false;
#if LV_COLOR_SCREEN_TRANSP #if LV_COLOR_SCREEN_TRANSP
scr_transp = disp->driver.screen_transp; scr_transp = disp->driver.screen_transp;
#endif #endif
lv_color_t bg_tmp = LV_COLOR_BLACK; lv_color_t bg_tmp = LV_COLOR_BLACK;
lv_color_t opa_tmp = lv_color_mix(color, bg_tmp, opa); 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. * Mix two colors. Both color can have alpha value. It requires ARGB888 colors.
* @param bg_color background color * @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 #if LV_COLOR_SCREEN_TRANSP
/* Pick the foreground if it's fully opaque or the Background is fully transparent*/ /* 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; fg_color.ch.alpha = fg_opa;
return fg_color; 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 || 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) { bg_color.full != bg_color_save.full) {
fg_opa_save = fg_opa; fg_opa_save = fg_opa;
bg_opa_save = bg_opa; bg_opa_save = bg_opa;
fg_color_save.full = fg_color.full; fg_color_save.full = fg_color.full;
bg_color_save.full = bg_color.full; bg_color_save.full = bg_color.full;
/*Info: /*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*/ #endif /*LV_COLOR_SCREEN_TRANSP*/
} }

View File

@@ -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) 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) || 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_2BIT && id > 3) || (dsc->header.cf == LV_IMG_CF_ALPHA_4BIT && id > 15) || (dsc->header.cf == LV_IMG_CF_ALPHA_8BIT)) {
(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'"); LV_LOG_WARN("lv_img_buf_set_px_alpha: invalid 'id'");
return; return;
} }
lv_color32_t c32; lv_color32_t c32;
c32.full = lv_color_to32(c); c32.full = lv_color_to32(c);
uint8_t * buf = (uint8_t *)dsc->data; uint8_t * buf = (uint8_t *)dsc->data;
memcpy(&buf[id * sizeof(c32)], &c32, sizeof(c32)); 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 = lv_opa_t opa =
opa_scale == LV_OPA_COVER ? style->image.opa : (uint16_t)((uint16_t)style->image.opa * opa_scale) >> 8; 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); lv_img_cache_entry_t * cdsc = lv_img_cache_open(src, style);
if(cdsc == NULL) return LV_RES_INV; if(cdsc == NULL) return LV_RES_INV;
bool chroma_keyed = lv_img_color_format_is_chroma_keyed(cdsc->dec_dsc.header.cf); 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); bool alpha_byte = lv_img_color_format_has_alpha(cdsc->dec_dsc.header.cf);
if(cdsc->dec_dsc.error_msg != NULL) { if(cdsc->dec_dsc.error_msg != NULL) {
LV_LOG_WARN("Image draw error"); LV_LOG_WARN("Image draw error");
lv_draw_rect(coords, mask, &lv_style_plain, LV_OPA_COVER); 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. /* The decoder open could open the image and gave the entire uncompressed image.
* Just draw it!*/ * Just draw it!*/
else if(cdsc->dec_dsc.img_data) { 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*/ /* The whole uncompressed image is not available. Try to read it line-by-line*/
else { else {

View File

@@ -13,7 +13,7 @@
* DEFINES * DEFINES
*********************/ *********************/
#define LABEL_RECOLOR_PAR_LENGTH 6 #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 * 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) * @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, 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; const lv_font_t * font = style->text.font;
lv_coord_t w; 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; pos.y += y_ofs;
} }
uint32_t line_start = 0; uint32_t line_start = 0;
int32_t last_line_start = -1; int32_t last_line_start = -1;
/*Check the hint to use the cached info*/ /*Check the hint to use the cached info*/
if(hint && y_ofs == 0) { 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) { if(LV_MATH_ABS(hint->coord_y - coords->y1) > LV_LABEL_HINT_UPDATE_TH - 2 * line_height) {
hint->line_start = -1; 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; pos.y += line_height;
/*Save at the threshold coordinate*/ /*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->line_start = line_start;
hint->y = pos.y - coords->y1; hint->y = pos.y - coords->y1;
hint->coord_y = coords->y1; hint->coord_y = coords->y1;
} }
if(txt[line_start] == '\0') return; if(txt[line_start] == '\0') return;

View File

@@ -28,8 +28,9 @@ extern "C" {
* all the previous characters needs to be checked to calculate the positions. * 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. * This structure stores an earlier (e.g. at -1000 px) coordinate and the index of that line.
* Therefore the calculations can start from here.*/ * Therefore the calculations can start from here.*/
typedef struct { typedef struct
/*Index of the line at `y` coordinate*/ {
/*Index of the line at `y` coordinate*/
int32_t line_start; int32_t line_start;
/*Give the `y` coordinate of the first letter at `line start` index. Relative to the label's coordinates*/ /*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. /*The 'y1' coordinate of the label when the hint was saved.
* Used to invalidate the hint if the label has moved too much. */ * Used to invalidate the hint if the label has moved too much. */
int32_t coord_y; int32_t coord_y;
}lv_draw_label_hint_t; } lv_draw_label_hint_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
@@ -57,7 +58,8 @@ typedef struct {
* @param sel_end end index of selected area (`LV_LABEL_TXT_SEL_OFF` if none) * @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, 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 * MACROS

View File

@@ -17,10 +17,10 @@
* DEFINES * DEFINES
*********************/ *********************/
/*Decrement life with this value in every open*/ /*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)*/ /*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 /*Don't let life to be greater than this limit because it would require a lot of time to
* "die" from very high values */ * "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. * Image difficult to open should live longer to keep avoid frequent their recaching.
* Therefore increase `life` with `time_to_open`*/ * Therefore increase `life` with `time_to_open`*/
cached_src = &cache[i]; 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; 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"); LV_LOG_TRACE("image draw: image found in the cache");
break; 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*/ /*Open the image and measure the time to open*/
uint32_t t_start; uint32_t t_start;
t_start = lv_tick_get(); t_start = lv_tick_get();
cached_src->dec_dsc.time_to_open = 0; cached_src->dec_dsc.time_to_open = 0;
lv_res_t open_res = lv_img_decoder_open(&cached_src->dec_dsc, src, style); lv_res_t open_res = lv_img_decoder_open(&cached_src->dec_dsc, src, style);
if(open_res ==LV_RES_INV) { if(open_res == LV_RES_INV) {
LV_LOG_WARN("Image draw cannot open the image resource"); LV_LOG_WARN("Image draw cannot open the image resource");
lv_img_decoder_close(&cached_src->dec_dsc); lv_img_decoder_close(&cached_src->dec_dsc);
memset(&cached_src->dec_dsc, 0, sizeof(lv_img_decoder_dsc_t)); memset(&cached_src->dec_dsc, 0, sizeof(lv_img_decoder_dsc_t));
memset(&cached_src, 0, sizeof(lv_img_cache_entry_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; return NULL;
} }

View File

@@ -30,7 +30,7 @@ typedef struct
* Decrement all lifes by one every in every `lv_img_cache_open`. * Decrement all lifes by one every in every `lv_img_cache_open`.
* If life == 0 the entry can be reused,*/ * If life == 0 the entry can be reused,*/
int32_t life; int32_t life;
}lv_img_cache_entry_t; } lv_img_cache_entry_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES

View File

@@ -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; if(res != LV_RES_OK) continue;
dsc->error_msg = NULL; dsc->error_msg = NULL;
dsc->img_data = NULL; dsc->img_data = NULL;
dsc->decoder = d; dsc->decoder = d;
res = d->open_cb(d, dsc); res = d->open_cb(d, dsc);

View File

@@ -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); lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header);
/** /**
* Open an image. * 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` * Try the created image decoder one by one. Once one is able to open the image that decoder is save in `dsc`

View File

@@ -71,7 +71,6 @@ void lv_disp_drv_init(lv_disp_drv_t * driver)
driver->screen_transp = 1; driver->screen_transp = 1;
#endif #endif
#if LV_USE_GPU #if LV_USE_GPU
driver->gpu_blend_cb = NULL; driver->gpu_blend_cb = NULL;
driver->gpu_fill_cb = NULL; driver->gpu_fill_cb = NULL;

View File

@@ -72,9 +72,9 @@ void lv_anim_core_init(void)
void lv_anim_init(lv_anim_t * a) void lv_anim_init(lv_anim_t * a)
{ {
memset(a, 0, sizeof(lv_anim_t)); memset(a, 0, sizeof(lv_anim_t));
a->time = 500; a->time = 500;
a->start = 0; a->start = 0;
a->end = 100; a->end = 100;
a->path_cb = lv_anim_path_linear; a->path_cb = lv_anim_path_linear;
} }
/** /**

View File

@@ -33,8 +33,8 @@ extern "C" {
/*Can be used to indicate if animations are enabled or disabled in a case*/ /*Can be used to indicate if animations are enabled or disabled in a case*/
enum { enum {
LV_ANIM_OFF, LV_ANIM_OFF,
LV_ANIM_ON, LV_ANIM_ON,
}; };
typedef uint8_t lv_anim_enable_t; 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 typedef struct _lv_anim_t
{ {
void * var; /*Variable to animate*/ 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_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*/ lv_anim_ready_cb_t ready_cb; /*Call it when the animation is ready*/
int32_t start; /*Start value*/ 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*/ uint32_t has_run : 1; /*Indicates the animation has run in this round*/
} lv_anim_t; } lv_anim_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/

View File

@@ -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 * old_real = lv_fs_get_real_path(oldname);
const char * new_real = lv_fs_get_real_path(newname); 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; 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); 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; return res;
} }

View File

@@ -93,7 +93,7 @@ typedef struct
typedef struct typedef struct
{ {
void * dir_d; void * dir_d;
lv_fs_drv_t * drv; lv_fs_drv_t * drv;
} lv_fs_dir_t; } lv_fs_dir_t;
/********************** /**********************

View File

@@ -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 #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 #else
# define LV_LOG_TRACE(dsc) {;} #define LV_LOG_TRACE(dsc) \
{ \
; \
}
#endif #endif
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_INFO #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 #else
# define LV_LOG_INFO(dsc) {;} #define LV_LOG_INFO(dsc) \
{ \
; \
}
#endif #endif
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_WARN #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 #else
# define LV_LOG_WARN(dsc) {;} #define LV_LOG_WARN(dsc) \
{ \
; \
}
#endif #endif
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_ERROR #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 #else
# define LV_LOG_ERROR(dsc) {;} #define LV_LOG_ERROR(dsc) \
{ \
; \
}
#endif #endif
#else /*LV_USE_LOG*/ #else /*LV_USE_LOG*/
/*Do nothing if `LV_USE_LOG 0`*/ /*Do nothing if `LV_USE_LOG 0`*/

View File

@@ -96,7 +96,6 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void);
*/ */
lv_task_t * lv_task_create_basic(void); lv_task_t * lv_task_create_basic(void);
/** /**
* Create a new lv_task * Create a new lv_task
* @param task_xcb a callback which is the task itself. It will be called periodically. * @param task_xcb a callback which is the task itself. It will be called periodically.

View File

@@ -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; size_res->y -= line_space;
} }
/** /**
* Get the next line of text. Check line length and break chars too. * Get the next line of text. Check line length and break chars too.
* @param txt a '\0' terminated string * @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 * @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) * @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, 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_coord_t letter_space, lv_coord_t max_width, lv_txt_flag_t flag) lv_txt_flag_t flag)
{ {
if(txt == NULL) return 0; if(txt == NULL) return 0;
if(font == NULL) return 0; if(font == NULL) return 0;
if(flag & LV_TXT_FLAG_EXPAND) max_width = LV_COORD_MAX; if(flag & LV_TXT_FLAG_EXPAND) max_width = LV_COORD_MAX;
uint32_t i = 0; uint32_t i = 0;
uint32_t i_next = 0; uint32_t i_next = 0;
lv_coord_t cur_w = 0; lv_coord_t cur_w = 0;
uint32_t last_break = NO_BREAK_FOUND; uint32_t last_break = NO_BREAK_FOUND;
lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT; lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT;
uint32_t letter_w; uint32_t letter_w;
uint32_t letter = 0; uint32_t letter = 0;
uint32_t letter_next = 0; uint32_t letter_next = 0;
letter_next = lv_txt_encoded_next(txt, &i_next); letter_next = lv_txt_encoded_next(txt, &i_next);
while(txt[i] != '\0') { while(txt[i] != '\0') {
letter = letter_next; letter = letter_next;
i = i_next; i = i_next;
letter_next = lv_txt_encoded_next(txt, &i_next); letter_next = lv_txt_encoded_next(txt, &i_next);
/*Handle the recolor command*/ /*Handle the recolor command*/
if((flag & LV_TXT_FLAG_RECOLOR) != 0) { if((flag & LV_TXT_FLAG_RECOLOR) != 0) {
if(lv_txt_is_cmd(&cmd_state, letter) != false) { 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*/ /*Check for new line chars*/
if(letter == '\n' || letter == '\r') { if(letter == '\n' || letter == '\r') {
/*Return with the first letter of the next line*/ /*Return with the first letter of the next line*/
if(letter == '\r' && letter_next == '\n') return i_next; if(letter == '\r' && letter_next == '\n')
else return i; return i_next;
else
return i;
} else { /*Check the actual length*/ } else { /*Check the actual length*/
letter_w = lv_font_get_glyph_width(font, letter, letter_next); letter_w = lv_font_get_glyph_width(font, letter, letter_next);
cur_w += letter_w; cur_w += letter_w;
@@ -711,7 +712,7 @@ static uint32_t lv_txt_iso8859_1_get_length(const char * txt)
* @param letter a letter * @param letter a letter
* @return false: 'letter' is not break char * @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; uint8_t i;
bool ret = false; bool ret = false;

View File

@@ -222,10 +222,10 @@ void lv_bar_set_anim_time(lv_obj_t * bar, uint16_t anim_time)
{ {
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
ext->anim_time = anim_time; ext->anim_time = anim_time;
#else #else
(void)bar; /*Unused*/ (void)bar; /*Unused*/
(void)anim_time; /*Unused*/ (void)anim_time; /*Unused*/
#endif #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); lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
return ext->anim_time; return ext->anim_time;
#else #else
(void) bar; /*Unused*/ (void)bar; /*Unused*/
return 0; return 0;
#endif #endif
} }

View File

@@ -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; const lv_style_t * style = NULL;
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn); 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 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 * If the button is focused then this style is updated by the group's
* `style_mod_cb` function */ * `style_mod_cb` function */
if((type == LV_BTN_STYLE_REL && state == LV_BTN_STATE_REL) || 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_PR && state == LV_BTN_STATE_PR) ||
(type == LV_BTN_STYLE_TGL_REL && state == LV_BTN_STATE_TGL_REL) || (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_TGL_PR && state == LV_BTN_STATE_TGL_PR) ||
(type == LV_BTN_STYLE_INA && state == LV_BTN_STATE_INA)) { (type == LV_BTN_STYLE_INA && state == LV_BTN_STATE_INA)) {
style = lv_obj_get_style(btn); style = lv_obj_get_style(btn);
} else { } 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); lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
uint32_t state = 1; 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; 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); lv_btn_set_state(btn, LV_BTN_STATE_REL);
uint32_t state = 0; 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; if(res != LV_RES_OK) return res;
} }
} }

View File

@@ -40,36 +40,69 @@ extern "C" {
/** Possible states of a button. /** Possible states of a button.
* It can be used not only by buttons but other button-like objects too*/ * It can be used not only by buttons but other button-like objects too*/
enum { enum {
LV_BTN_STATE_REL, /**Released*/ /**Released*/
LV_BTN_STATE_PR, /**Pressed*/ LV_BTN_STATE_REL,
LV_BTN_STATE_TGL_REL, /**Toggled released*/
LV_BTN_STATE_TGL_PR, /**Toggled pressed*/ /**Pressed*/
LV_BTN_STATE_INA, /**Inactive*/ LV_BTN_STATE_PR,
LV_BTN_STATE_NUM,
/**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; typedef uint8_t lv_btn_state_t;
/*Data of button*/ /** Extended data of button*/
typedef struct typedef struct
{ {
lv_cont_ext_t cont; /*Ext. of ancestor*/ /** Ext. of ancestor*/
lv_cont_ext_t cont;
/*New data for this type */ /*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 #if LV_BTN_INK_EFFECT
uint16_t ink_in_time; /*[ms] Time of ink fill effect (0: disable ink effect)*/ /** [ms] Time of ink fill effect (0: disable ink effect)*/
uint16_t ink_wait_time; /*[ms] Wait before the ink disappears */ uint16_t ink_in_time;
uint16_t ink_out_time; /*[ms] Time of ink disappearing*/
/** [ms] Wait before the ink disappears */
uint16_t ink_wait_time;
/** [ms] Time of ink disappearing*/
uint16_t ink_out_time;
#endif #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; } lv_btn_ext_t;
/*Styles*/ /**Styles*/
enum { enum {
/** Release style */
LV_BTN_STYLE_REL, LV_BTN_STYLE_REL,
/**Pressed style*/
LV_BTN_STYLE_PR, LV_BTN_STYLE_PR,
/** Toggle released style*/
LV_BTN_STYLE_TGL_REL, LV_BTN_STYLE_TGL_REL,
/** Toggle pressed style */
LV_BTN_STYLE_TGL_PR, LV_BTN_STYLE_TGL_PR,
/** Inactive style*/
LV_BTN_STYLE_INA, LV_BTN_STYLE_INA,
}; };
typedef uint8_t lv_btn_style_t; typedef uint8_t lv_btn_style_t;

View File

@@ -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 * Clear the attributes of all buttons of a button matrix
* @param btnm pointer to a button matrix object * @param btnm pointer to a button matrix object

View File

@@ -51,12 +51,12 @@ typedef struct
{ {
/*No inherited ext.*/ /*Ext. of ancestor*/ /*No inherited ext.*/ /*Ext. of ancestor*/
/*New data for this type */ /*New data for this type */
const char ** map_p; /*Pointer to the current map*/ const char ** map_p; /*Pointer to the current map*/
lv_area_t * button_areas; /*Array of areas of buttons*/ lv_area_t * button_areas; /*Array of areas of buttons*/
lv_btnm_ctrl_t * ctrl_bits; /*Array of control bytes*/ 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*/ 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_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_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 */ 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 recolor : 1; /*Enable button recoloring*/
uint8_t one_toggle : 1; /*Single button toggled at once*/ uint8_t one_toggle : 1; /*Single button toggled at once*/

View File

@@ -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; 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); 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); lv_refr_set_disp_refreshing(refr_ori);
} }
/** /**
* Draw a line on the canvas * Draw a line on the canvas
* @param canvas pointer to a canvas object * @param canvas pointer to a canvas object

View File

@@ -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 w width of the buffer to copy
* @param h height 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, 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 y, lv_coord_t w, lv_coord_t h); lv_coord_t h);
/** /**
* Rotate and image and store the result on a canvas. * 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, 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); const char * txt, lv_label_align_t align);
/** /**
* Draw an image on the canvas * Draw an image on the canvas
* @param canvas pointer to a canvas object * @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) #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*/ /*+ 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_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_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_4BIT(w, h) ((((w / 2) + 1) * h))
#define LV_CANVAS_BUF_SIZE_ALPHA_8BIT(w, h) ((w * h)) #define LV_CANVAS_BUF_SIZE_ALPHA_8BIT(w, h) ((w * h))
/*4 * X: for palette*/ /*4 * X: for palette*/
#define LV_CANVAS_BUF_SIZE_INDEXED_1BIT(w, h) (LV_CANVAS_BUF_SIZE_ALPHA_1BIT(w, h) + 4 * 2) #define LV_CANVAS_BUF_SIZE_INDEXED_1BIT(w, h) (LV_CANVAS_BUF_SIZE_ALPHA_1BIT(w, h) + 4 * 2)

View File

@@ -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)); lv_ll_init(&ext->series_ll, sizeof(lv_chart_series_t));
ext->series.num = 0; ext->series.num = 0;
ext->ymin = LV_CHART_YMIN_DEF; ext->ymin = LV_CHART_YMIN_DEF;
ext->ymax = LV_CHART_YMAX_DEF; ext->ymax = LV_CHART_YMAX_DEF;
ext->hdiv_cnt = LV_CHART_HDIV_DEF; ext->hdiv_cnt = LV_CHART_HDIV_DEF;
ext->vdiv_cnt = LV_CHART_VDIV_DEF; ext->vdiv_cnt = LV_CHART_VDIV_DEF;
ext->point_cnt = LV_CHART_PNUM_DEF; ext->point_cnt = LV_CHART_PNUM_DEF;
ext->type = LV_CHART_TYPE_LINE; ext->type = LV_CHART_TYPE_LINE;
ext->update_mode = LV_CHART_UPDATE_MODE_SHIFT; ext->update_mode = LV_CHART_UPDATE_MODE_SHIFT;
ext->series.opa = LV_OPA_COVER; ext->series.opa = LV_OPA_COVER;
ext->series.dark = LV_OPA_50; ext->series.dark = LV_OPA_50;
ext->series.width = 2; ext->series.width = 2;
ext->margin = 0; ext->margin = 0;
ext->x_axis.major_tick_len = LV_CHART_TICK_LENGTH_AUTO; ext->x_axis.major_tick_len = LV_CHART_TICK_LENGTH_AUTO;
ext->x_axis.minor_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; 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 { } else {
lv_chart_ext_t * ext_copy = lv_obj_get_ext_attr(copy); lv_chart_ext_t * ext_copy = lv_obj_get_ext_attr(copy);
ext->type = ext_copy->type; ext->type = ext_copy->type;
ext->ymin = ext_copy->ymin; ext->ymin = ext_copy->ymin;
ext->ymax = ext_copy->ymax; ext->ymax = ext_copy->ymax;
ext->hdiv_cnt = ext_copy->hdiv_cnt; ext->hdiv_cnt = ext_copy->hdiv_cnt;
ext->vdiv_cnt = ext_copy->vdiv_cnt; ext->vdiv_cnt = ext_copy->vdiv_cnt;
ext->point_cnt = ext_copy->point_cnt; ext->point_cnt = ext_copy->point_cnt;
ext->series.opa = ext_copy->series.opa; ext->series.opa = ext_copy->series.opa;
ext->margin = ext_copy->margin; ext->margin = ext_copy->margin;
memcpy(&ext->x_axis, &ext_copy->x_axis, sizeof(lv_chart_axis_cfg_t)); 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)); 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) 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); lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->y_axis.major_tick_len = major_tick_len; ext->y_axis.major_tick_len = major_tick_len;
ext->y_axis.minor_tick_len = minor_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 * else number of ticks between two value labels
* @param options extra options * @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); lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->x_axis.num_tick_marks = num_tick_marks; 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 * else number of ticks between two value labels
* @param options extra options * @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); lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->y_axis.num_tick_marks = num_tick_marks; 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 * Set the margin around the chart, used for axes value and ticks
* @param chart pointer to an chart object * @param chart pointer to an chart object
* @param margin value of the margin [px] * @param margin value of the margin [px]
*/ */
void lv_chart_set_margin(lv_obj_t * chart, uint16_t margin) void lv_chart_set_margin(lv_obj_t * chart, uint16_t margin)
{ {
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);

View File

@@ -40,7 +40,7 @@ extern "C" {
/*Chart types*/ /*Chart types*/
enum { 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_LINE = 0x01, /*Connect the points with lines*/
LV_CHART_TYPE_COLUMN = 0x02, /*Draw columns*/ LV_CHART_TYPE_COLUMN = 0x02, /*Draw columns*/
LV_CHART_TYPE_POINT = 0x04, /*Draw circles on the points*/ 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`*/ /*Chart update mode for `lv_chart_set_next`*/
enum { enum {
LV_CHART_UPDATE_MODE_SHIFT, /*Shift old data to the left and add the new one o the right*/ 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_CIRCULAR, /*Add the new data in a circular way*/
}; };
typedef uint8_t lv_chart_update_mode_t; typedef uint8_t lv_chart_update_mode_t;
@@ -65,8 +65,8 @@ typedef struct
/*Data of axis */ /*Data of axis */
enum { enum {
LV_CHART_AXIS_SKIP_LAST_TICK = 0x00, /* don't 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 */ LV_CHART_AXIS_DRAW_LAST_TICK = 0x01 /* draw the last tick */
}; };
typedef uint8_t lv_chart_axis_options_t; 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) 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); 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 * else number of ticks between two value labels
* @param options extra options * @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 * 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 * else number of ticks between two value labels
* @param options extra options * @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 * 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) 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); return lv_obj_get_style(chart);
} }

View File

@@ -43,6 +43,7 @@ enum {
LV_LAYOUT_ROW_B, /*Row bottom align*/ 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_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_GRID, /*Align same-sized object into a grid*/
_LV_LAYOUT_NUM
}; };
typedef uint8_t lv_layout_t; typedef uint8_t lv_layout_t;
@@ -52,6 +53,7 @@ enum {
LV_FIT_FLOOD, /*Align the size to the parent's edge*/ 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 LV_FIT_FILL, /*Align the size to the parent's edge first but if there is an object out of it
then involve it*/ then involve it*/
_LV_FIT_NUM
}; };
typedef uint8_t lv_fit_t; 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) 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); 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) 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); return lv_obj_get_style(cont);
} }

View File

@@ -784,7 +784,7 @@ static lv_res_t release_handler(lv_obj_t * ddlist)
ext->sel_opt_id_ori = ext->sel_opt_id; 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); lv_res_t res = lv_event_send(ddlist, LV_EVENT_VALUE_CHANGED, &id);
if(res != LV_RES_OK) return res; if(res != LV_RES_OK) return res;

View File

@@ -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) 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); 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) 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); return lv_obj_get_style(gauge);
} }

View File

@@ -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) 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); return lv_obj_get_style(img);
} }

View File

@@ -43,11 +43,11 @@ typedef struct
lv_btn_ext_t btn; /*Ext. of ancestor*/ lv_btn_ext_t btn; /*Ext. of ancestor*/
/*New data for this type */ /*New data for this type */
#if LV_IMGBTN_TILED == 0 #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 #else
const void * img_src_left[LV_BTN_STATE_NUM]; /*Store left 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_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_right[_LV_BTN_STATE_NUM]; /*Store right side images to each state*/
#endif #endif
lv_img_cf_t act_cf; /*Color format of the currently active image*/ lv_img_cf_t act_cf; /*Color format of the currently active image*/
} lv_imgbtn_ext_t; } lv_imgbtn_ext_t;

View File

@@ -23,7 +23,8 @@
#endif #endif
#define LV_LABEL_DOT_END_INV 0xFFFF #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 * 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->offset.y = 0;
ext->hint.line_start = -1; ext->hint.line_start = -1;
ext->hint.coord_y = 0; ext->hint.coord_y = 0;
ext->hint.y = 0; ext->hint.y = 0;
#if LV_LABEL_TEXT_SEL #if LV_LABEL_TEXT_SEL
ext->txt_sel_start = LV_LABEL_TEXT_SEL_OFF; 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); lv_label_refr_text(label);
} }
#else #else
(void) label; /*Unused*/ (void)label; /*Unused*/
(void) anim_speed; /*Unused*/ (void)anim_speed; /*Unused*/
#endif #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); lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->anim_speed; return ext->anim_speed;
#else #else
(void) label; /*Unused*/ (void)label; /*Unused*/
return 0; return 0;
#endif #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; lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT;
uint32_t i = line_start; uint32_t i = line_start;
uint32_t i_current = i; uint32_t i_current = i;
uint32_t letter = '\0'; uint32_t letter = '\0';
uint32_t letter_next = '\0'; uint32_t letter_next = '\0';
if(new_line_start > 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; 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_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); 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; 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); lv_coord_t max_w = lv_obj_get_width(label);
const lv_style_t * style = lv_obj_get_style(label); const lv_style_t * style = lv_obj_get_style(label);

View File

@@ -40,13 +40,13 @@ extern "C" {
/*Long mode behaviors. Used in 'lv_label_ext_t' */ /*Long mode behaviors. Used in 'lv_label_ext_t' */
enum { enum {
LV_LABEL_LONG_EXPAND, /*Expand the object size to the text size*/ 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 LV_LABEL_LONG_BREAK, /*Keep the object width, break the too long lines and expand the object
height*/ height*/
LV_LABEL_LONG_DOT, /*Keep the size and write dots at the end if the text is too long*/ 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, /*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_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; 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)*/ uint16_t dot_end; /*The text end position in dot mode (Handled by the library)*/
lv_point_t offset; /*Text draw position offset*/ 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 #if LV_USE_ANIMATION
uint16_t anim_speed; /*Speed of scroll and roll animation in px/sec unit*/ uint16_t anim_speed; /*Speed of scroll and roll animation in px/sec unit*/
#endif #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) 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); 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) 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); return lv_obj_get_style(label);
} }

View File

@@ -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 type which style should be set (can be only `LV_LED_STYLE_MAIN`)
* @param style pointer to a style * @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); 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) 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); return lv_obj_get_style(led);
} }

View File

@@ -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) 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); 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) 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); return lv_obj_get_style(line);
} }

View File

@@ -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_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_TGL_PR] = &lv_style_btn_tgl_pr;
ext->styles_btn[LV_BTN_STATE_INA] = &lv_style_btn_ina; ext->styles_btn[LV_BTN_STATE_INA] = &lv_style_btn_ina;
ext->single_mode = false; ext->single_mode = false;
ext->size = 0; ext->size = 0;
#if LV_USE_GROUP #if LV_USE_GROUP
ext->last_sel = NULL; ext->last_sel = NULL;

View File

@@ -52,9 +52,9 @@ typedef struct
{ {
lv_page_ext_t page; /*Ext. of ancestor*/ lv_page_ext_t page; /*Ext. of ancestor*/
/*New data for this type */ /*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 * 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*/ 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*/ uint16_t size; /*the number of items(buttons) in the list*/
uint8_t single_mode : 1; /* whether single selected mode is enabled */ uint8_t single_mode : 1; /* whether single selected mode is enabled */

View File

@@ -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) 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); 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) 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); return lv_obj_get_style(lmeter);
} }

View File

@@ -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.right_ip = 0;
ext->edge_flash.state = 0; ext->edge_flash.state = 0;
ext->edge_flash.style = &lv_style_plain_color; 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 #endif
ext->scroll_prop = 0; ext->scroll_prop = 0;
ext->scroll_prop_ip = 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 #if LV_USE_ANIMATION
lv_page_ext_t * ext = lv_obj_get_ext_attr(page); lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
ext->anim_time = anim_time; ext->anim_time = anim_time;
#else #else
(void)page; /*Unused*/ (void)page; /*Unused*/
(void)anim_time; /*Unused*/ (void)anim_time; /*Unused*/
#endif #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); lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
return ext->anim_time; return ext->anim_time;
#else #else
(void) page; /*Unused*/ (void)page; /*Unused*/
return 0; return 0;
#endif #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(scrl, &scrl_coords);
lv_obj_get_coords(page, &page_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) if((edge & LV_PAGE_EDGE_TOP) && scrl_coords.y1 == page_coords.y1 + page_style->body.padding.top) return true;
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_BOTTOM) && scrl_coords.y2 == page_coords.y2 - page_style->body.padding.bottom) if((edge & LV_PAGE_EDGE_LEFT) && scrl_coords.x1 == page_coords.x1 + page_style->body.padding.left) return true;
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_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; return false;
} }
@@ -446,7 +441,6 @@ void lv_page_glue_obj(lv_obj_t * obj, bool glue)
lv_obj_set_drag(obj, glue); lv_obj_set_drag(obj, glue);
} }
/** /**
* Focus on an object. It ensures that the object will be visible on the page. * Focus on an object. It ensures that the object will be visible on the page.
* @param page pointer to a page object * @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); lv_anim_create(&a);
} }
#else #else
(void) page; /*Unused*/ (void)page; /*Unused*/
#endif #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*/ if(lv_obj_get_parent(page_parent) != NULL) { /*Do not propagate the scroll to a screen*/
page_ext->scroll_prop_ip = 1; page_ext->scroll_prop_ip = 1;
} }
} }
} }

View File

@@ -50,12 +50,7 @@ enum {
typedef uint8_t lv_sb_mode_t; typedef uint8_t lv_sb_mode_t;
/*Edges: describes the four edges of the page*/ /*Edges: describes the four edges of the page*/
enum { enum { LV_PAGE_EDGE_LEFT = 0x1, LV_PAGE_EDGE_TOP = 0x2, LV_PAGE_EDGE_RIGHT = 0x4, LV_PAGE_EDGE_BOTTOM = 0x8 };
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; typedef uint8_t lv_page_edge_t;
/*Data of page*/ /*Data of page*/

View File

@@ -107,7 +107,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy)
/*Copy an existing roller*/ /*Copy an existing roller*/
else { else {
lv_roller_ext_t * copy_ext = lv_obj_get_ext_attr(copy); 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_obj_t * scrl = lv_page_get_scrl(new_roller);
lv_ddlist_open(new_roller, false); 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; 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*/ 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; rect_area.y2 = rect_area.y1 + font_h + style->text.line_space - 1;
lv_area_t roller_coords; lv_area_t roller_coords;
lv_obj_get_coords(roller, &roller_coords); lv_obj_get_coords(roller, &roller_coords);
lv_obj_get_inner_coords(roller, &roller_coords); lv_obj_get_inner_coords(roller, &roller_coords);
rect_area.x1 = roller_coords.x1; rect_area.x1 = roller_coords.x1;
rect_area.x2 = roller_coords.x2; 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; const lv_font_t * font = style_label->text.font;
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
lv_coord_t h = lv_obj_get_height(roller); 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. /* Normally the animtaion's `end_cb` sets correct position of the roller is infinite.
* But without animations do it manually*/ * But without animations do it manually*/

View File

@@ -38,7 +38,6 @@ extern "C" {
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
enum { enum {
LV_ROLLER_MODE_NORMAL, LV_ROLLER_MODE_NORMAL,
LV_ROLLER_MODE_INIFINITE, LV_ROLLER_MODE_INIFINITE,
@@ -46,8 +45,6 @@ enum {
typedef uint8_t lv_roller_mode_t; typedef uint8_t lv_roller_mode_t;
/*Data of roller*/ /*Data of roller*/
typedef struct typedef struct
{ {

View File

@@ -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); lv_sw_ext_t * ext = lv_obj_get_ext_attr(sw);
return ext->anim_time; return ext->anim_time;
#else #else
(void) sw; /*Unused*/ (void)sw; /*Unused*/
return 0; return 0;
#endif #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)) { if(lv_sw_get_state(sw)) {
lv_sw_off(sw, LV_ANIM_ON); lv_sw_off(sw, LV_ANIM_ON);
state = 0; state = 0;
} } else {
else {
lv_sw_on(sw, LV_ANIM_ON); lv_sw_on(sw, LV_ANIM_ON);
state = 1; 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) { if(v > LV_SW_MAX_VALUE / 2) {
lv_sw_on(sw, LV_ANIM_ON); lv_sw_on(sw, LV_ANIM_ON);
state = 1; state = 1;
} else{ } else {
lv_sw_off(sw, LV_ANIM_ON); lv_sw_off(sw, LV_ANIM_ON);
state = 0; 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) { if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
lv_slider_set_value(sw, LV_SW_MAX_VALUE, true); lv_slider_set_value(sw, LV_SW_MAX_VALUE, true);
state = 1; 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; if(res != LV_RES_OK) return res;
} else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) { } else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) {
lv_slider_set_value(sw, 0, true); lv_slider_set_value(sw, 0, true);
state = 0; 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; if(res != LV_RES_OK) return res;
} }
} else if(sign == LV_SIGNAL_GET_EDITABLE) { } else if(sign == LV_SIGNAL_GET_EDITABLE) {

View File

@@ -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->cursor.valid_x = 0;
ext->one_line = 0; ext->one_line = 0;
#if LV_LABEL_TEXT_SEL #if LV_LABEL_TEXT_SEL
ext->text_sel_en = 0; ext->text_sel_en = 0;
#endif #endif
ext->label = NULL; ext->label = NULL;
ext->placeholder = NULL; ext->placeholder = NULL;
#if LV_USE_ANIMATION == 0 #if LV_USE_ANIMATION == 0
ext->pwd_show_time = 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) 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; 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) { } else if(sign == LV_SIGNAL_CORD_CHG) {
/*Set the label width according to the text area width*/ /*Set the label width according to the text area width*/
if(ext->label) { 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); const lv_style_t * style_scrl = lv_obj_get_style(scrl);
lv_obj_set_width(ext->label, lv_page_get_fit_width(ta)); 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) 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); 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); lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
if(ext->cursor.click_pos == 0) return; 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 || if(lv_indev_get_type(click_source) == LV_INDEV_TYPE_KEYPAD ||
lv_indev_get_type(click_source) == LV_INDEV_TYPE_ENCODER) { lv_indev_get_type(click_source) == LV_INDEV_TYPE_ENCODER) {
return; return;
} }
lv_area_t label_coords; lv_area_t label_coords;
lv_obj_get_coords(ext->label, &label_coords); lv_obj_get_coords(ext->label, &label_coords);

View File

@@ -76,7 +76,7 @@ typedef struct
uint16_t txt_byte_pos; /* Byte index of the letter after (on) the cursor*/ uint16_t txt_byte_pos; /* Byte index of the letter after (on) the cursor*/
lv_cursor_type_t type : 4; /* Shape of 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 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; } cursor;
#if LV_LABEL_TEXT_SEL #if LV_LABEL_TEXT_SEL
uint16_t tmp_sel_start; /*Temporary value*/ uint16_t tmp_sel_start; /*Temporary value*/

View File

@@ -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) { if(anim == LV_ANIM_OFF || lv_tabview_get_anim_time(tabview) == 0) {
lv_obj_set_x(ext->content, cont_x); lv_obj_set_x(ext->content, cont_x);
} }
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
else { else {
lv_anim_t a; 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 LV_USE_ANIMATION
if(anim == LV_ANIM_OFF || ext->anim_time == 0) if(anim == LV_ANIM_OFF || ext->anim_time == 0)
#endif #endif
{ {
switch(ext->btns_pos) { 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_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT: lv_obj_set_y(ext->indic, indic_pos); break; case LV_TABVIEW_BTNS_POS_RIGHT: lv_obj_set_y(ext->indic, indic_pos); break;
} }
} }
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
else { else {
lv_anim_t a; 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(id_prev != id_new) res = lv_event_send(tabview, LV_EVENT_VALUE_CHANGED, &id_new);
if(res != LV_RES_OK) return; if(res != LV_RES_OK) return;
} }
/** /**

View File

@@ -80,9 +80,9 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy)
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
ext->anim_time = LV_TILEVIEW_DEF_ANIM_TIME; ext->anim_time = LV_TILEVIEW_DEF_ANIM_TIME;
#endif #endif
ext->act_id.x = 0; ext->act_id.x = 0;
ext->act_id.y = 0; ext->act_id.y = 0;
ext->valid_pos = NULL; ext->valid_pos = NULL;
ext->valid_pos_cnt = 0; ext->valid_pos_cnt = 0;
/*The signal and design functions are not copied so set them here*/ /*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); lv_tileview_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->act_id.x = copy_ext->act_id.x; ext->act_id.x = copy_ext->act_id.x;
ext->act_id.y = copy_ext->act_id.y; ext->act_id.y = copy_ext->act_id.y;
ext->valid_pos = copy_ext->valid_pos; ext->valid_pos = copy_ext->valid_pos;
ext->valid_pos_cnt = copy_ext->valid_pos_cnt; ext->valid_pos_cnt = copy_ext->valid_pos_cnt;
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
ext->anim_time = copy_ext->anim_time; ext->anim_time = copy_ext->anim_time;
#endif #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); lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview);
ext->valid_pos = valid_pos; 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*/ /*If valid pos. is selected do nothing*/
uint16_t i; uint16_t i;

View File

@@ -83,7 +83,6 @@ void lv_tileview_add_element(lv_obj_t * tileview, lv_obj_t * element);
* Setter functions * Setter functions
*====================*/ *====================*/
/** /**
* Set the valid position's indices. The scrolling will be possible only to these positions. * Set the valid position's indices. The scrolling will be possible only to these positions.
* @param tileview pointer to a Tileview object * @param tileview pointer to a Tileview object

View File

@@ -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); ext->title = lv_label_create(ext->header, NULL);
lv_label_set_text(ext->title, "My title"); lv_label_set_text(ext->title, "My title");
/*Set the default styles*/ /*Set the default styles*/
lv_theme_t * th = lv_theme_get_current(); lv_theme_t * th = lv_theme_get_current();
if(th) { if(th) {

View File

@@ -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); lv_coord_t lv_win_get_width(lv_obj_t * win);
/** /**
* Get a style of a window * Get a style of a window
* @param win pointer to a button object * @param win pointer to a button object

View File

@@ -108,9 +108,9 @@ static void basic_init(void)
lv_style_copy(&scr, &bg); lv_style_copy(&scr, &bg);
scr.body.padding.bottom = 0; scr.body.padding.bottom = 0;
scr.body.padding.top = 0; scr.body.padding.top = 0;
scr.body.padding.left = 0; scr.body.padding.left = 0;
scr.body.padding.right = 0; scr.body.padding.right = 0;
/*Panel*/ /*Panel*/
lv_style_copy(&panel, &def); lv_style_copy(&panel, &def);
@@ -140,7 +140,7 @@ static void basic_init(void)
sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/ sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/
theme.style.bg = &bg; theme.style.bg = &bg;
theme.style.scr = &scr; theme.style.scr = &scr;
theme.style.panel = &panel; 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.text.color = lv_color_hsv_to_rgb(_hue, 5, 100);
header.image.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.bg = &bg;
theme.style.win.sb = &sb; theme.style.win.sb = &sb;
theme.style.win.header = &header; theme.style.win.header = &header;
theme.style.win.content = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.btn.rel = &btn_rel; theme.style.win.btn.rel = &btn_rel;
theme.style.win.btn.pr = &btn_pr; theme.style.win.btn.pr = &btn_pr;
#endif #endif
} }

View File

@@ -55,12 +55,11 @@ static void basic_init(void)
{ {
lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/ lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/
lv_style_copy(&scr, &def); lv_style_copy(&scr, &def);
scr.body.padding.bottom = 0; scr.body.padding.bottom = 0;
scr.body.padding.top = 0; scr.body.padding.top = 0;
scr.body.padding.left = 0; scr.body.padding.left = 0;
scr.body.padding.right = 0; scr.body.padding.right = 0;
lv_style_copy(&sb, &lv_style_pretty_color); lv_style_copy(&sb, &lv_style_pretty_color);
sb.body.grad_color = sb.body.main_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); plain_bordered.body.border.color = lv_color_hex3(0xbbb);
theme.style.bg = &lv_style_plain; theme.style.bg = &lv_style_plain;
theme.style.scr = &scr; theme.style.scr = &scr;
theme.style.panel = &lv_style_pretty; theme.style.panel = &lv_style_pretty;
} }
@@ -346,12 +345,12 @@ static void win_init(void)
{ {
#if LV_USE_WIN != 0 #if LV_USE_WIN != 0
theme.style.win.bg = &plain_bordered; theme.style.win.bg = &plain_bordered;
theme.style.win.sb = &sb; theme.style.win.sb = &sb;
theme.style.win.header = &lv_style_plain_color; theme.style.win.header = &lv_style_plain_color;
theme.style.win.content = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.btn.rel = &lv_style_btn_rel; theme.style.win.btn.rel = &lv_style_btn_rel;
theme.style.win.btn.pr = &lv_style_btn_pr; theme.style.win.btn.pr = &lv_style_btn_pr;
#endif #endif
} }

View File

@@ -60,9 +60,9 @@ static void basic_init(void)
lv_style_copy(&scr, &bg); lv_style_copy(&scr, &bg);
scr.body.padding.bottom = 0; scr.body.padding.bottom = 0;
scr.body.padding.top = 0; scr.body.padding.top = 0;
scr.body.padding.left = 0; scr.body.padding.left = 0;
scr.body.padding.right = 0; scr.body.padding.right = 0;
lv_style_copy(&panel, &def); lv_style_copy(&panel, &def);
panel.body.radius = DEF_RADIUS; panel.body.radius = DEF_RADIUS;
@@ -90,7 +90,7 @@ static void basic_init(void)
sb.body.padding.bottom = LV_DPI / 25; sb.body.padding.bottom = LV_DPI / 25;
theme.style.bg = &bg; theme.style.bg = &bg;
theme.style.scr = &scr; theme.style.scr = &scr;
theme.style.panel = &panel; theme.style.panel = &panel;
} }
@@ -792,12 +792,12 @@ static void win_init(void)
pr.text.color = lv_color_hex3(0x111); pr.text.color = lv_color_hex3(0x111);
pr.image.color = lv_color_hex3(0x111); pr.image.color = lv_color_hex3(0x111);
theme.style.win.bg = theme.style.panel; theme.style.win.bg = theme.style.panel;
theme.style.win.sb = &sb; theme.style.win.sb = &sb;
theme.style.win.header = &header; theme.style.win.header = &header;
theme.style.win.content = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.btn.rel = &lv_style_transp; theme.style.win.btn.rel = &lv_style_transp;
theme.style.win.btn.pr = &pr; theme.style.win.btn.pr = &pr;
#endif #endif
} }

View File

@@ -76,12 +76,11 @@ static void basic_init(void)
def.image.intense = LV_OPA_TRANSP; def.image.intense = LV_OPA_TRANSP;
def.image.opa = LV_OPA_COVER; def.image.opa = LV_OPA_COVER;
lv_style_copy(&scr, &light_plain); lv_style_copy(&scr, &light_plain);
scr.body.padding.bottom = 0; scr.body.padding.bottom = 0;
scr.body.padding.top = 0; scr.body.padding.top = 0;
scr.body.padding.left = 0; scr.body.padding.left = 0;
scr.body.padding.right = 0; scr.body.padding.right = 0;
lv_style_copy(&light_plain, &def); lv_style_copy(&light_plain, &def);
@@ -100,7 +99,7 @@ static void basic_init(void)
dark_frame.body.radius = LV_DPI / 20; dark_frame.body.radius = LV_DPI / 20;
theme.style.bg = &def; theme.style.bg = &def;
theme.style.scr = &scr; theme.style.scr = &scr;
theme.style.panel = &light_frame; 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.top = LV_DPI / 30;
win_header.body.padding.bottom = LV_DPI / 30; win_header.body.padding.bottom = LV_DPI / 30;
theme.style.win.bg = &light_frame; theme.style.win.bg = &light_frame;
theme.style.win.sb = &dark_frame; theme.style.win.sb = &dark_frame;
theme.style.win.header = &win_header; theme.style.win.header = &win_header;
theme.style.win.content = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.btn.rel = &light_frame; theme.style.win.btn.rel = &light_frame;
theme.style.win.btn.pr = &dark_frame; theme.style.win.btn.pr = &dark_frame;
#endif #endif
} }

View File

@@ -108,12 +108,11 @@ static void basic_init(void)
bg.body.border.color = lv_color_hex3(0x666); bg.body.border.color = lv_color_hex3(0x666);
bg.body.shadow.color = LV_COLOR_SILVER; bg.body.shadow.color = LV_COLOR_SILVER;
lv_style_copy(&scr, &bg); lv_style_copy(&scr, &bg);
scr.body.padding.bottom = 0; scr.body.padding.bottom = 0;
scr.body.padding.top = 0; scr.body.padding.top = 0;
scr.body.padding.left = 0; scr.body.padding.left = 0;
scr.body.padding.right = 0; scr.body.padding.right = 0;
/*Panel*/ /*Panel*/
lv_style_copy(&panel, &def); 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.body.border.color = lv_color_hsv_to_rgb(_hue, 20, 80);
win_header.text.color = lv_color_hsv_to_rgb(_hue, 5, 100); win_header.text.color = lv_color_hsv_to_rgb(_hue, 5, 100);
theme.style.win.bg = &bg; theme.style.win.bg = &bg;
theme.style.win.sb = &sb; theme.style.win.sb = &sb;
theme.style.win.header = &win_header; theme.style.win.header = &win_header;
theme.style.win.content = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.btn.rel = &btn_rel; theme.style.win.btn.rel = &btn_rel;
theme.style.win.btn.pr = &btn_pr; theme.style.win.btn.pr = &btn_pr;
#endif #endif
} }

View File

@@ -63,9 +63,9 @@ static void basic_init(void)
lv_style_copy(&scr, &bg); lv_style_copy(&scr, &bg);
scr.body.padding.bottom = 0; scr.body.padding.bottom = 0;
scr.body.padding.top = 0; scr.body.padding.top = 0;
scr.body.padding.left = 0; scr.body.padding.left = 0;
scr.body.padding.right = 0; scr.body.padding.right = 0;
lv_style_copy(&sb, &def); lv_style_copy(&sb, &def);
sb.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 60); 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.color = lv_color_hsv_to_rgb(_hue, 20, 40);
panel.line.width = 1; panel.line.width = 1;
theme.style.scr = &scr; theme.style.scr = &scr;
theme.style.bg = &bg; theme.style.bg = &bg;
theme.style.panel = &def; theme.style.panel = &def;
} }
static void cont_init(void) 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.text.color = lv_color_hex3(0xaaa);
win_btn_pr.image.color = lv_color_hex3(0xaaa); win_btn_pr.image.color = lv_color_hex3(0xaaa);
theme.style.win.bg = &win_bg; theme.style.win.bg = &win_bg;
theme.style.win.sb = &sb; theme.style.win.sb = &sb;
theme.style.win.header = &win_header; theme.style.win.header = &win_header;
theme.style.win.content = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.btn.rel = &lv_style_transp; theme.style.win.btn.rel = &lv_style_transp;
theme.style.win.btn.pr = &win_btn_pr; theme.style.win.btn.pr = &win_btn_pr;
#endif #endif
} }

View File

@@ -46,7 +46,7 @@ static void basic_init(void)
lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/ lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/
def.text.font = _font; def.text.font = _font;
theme.style.scr = &def; theme.style.scr = &def;
theme.style.bg = &def; theme.style.bg = &def;
theme.style.panel = &def; theme.style.panel = &def;
} }
@@ -333,12 +333,12 @@ static void win_init(void)
{ {
#if LV_USE_WIN != 0 #if LV_USE_WIN != 0
theme.style.win.bg = &def; theme.style.win.bg = &def;
theme.style.win.sb = &def; theme.style.win.sb = &def;
theme.style.win.header = &def; theme.style.win.header = &def;
theme.style.win.content = &def; theme.style.win.content = &def;
theme.style.win.btn.rel = &def; theme.style.win.btn.rel = &def;
theme.style.win.btn.pr = &def; theme.style.win.btn.pr = &def;
#endif #endif
} }

View File

@@ -63,9 +63,9 @@ static void basic_init(void)
lv_style_copy(&scr, &bg); lv_style_copy(&scr, &bg);
scr.body.padding.bottom = 0; scr.body.padding.bottom = 0;
scr.body.padding.top = 0; scr.body.padding.top = 0;
scr.body.padding.left = 0; scr.body.padding.left = 0;
scr.body.padding.right = 0; scr.body.padding.right = 0;
lv_style_copy(&panel, &bg); lv_style_copy(&panel, &bg);
panel.body.radius = LV_DPI / 10; panel.body.radius = LV_DPI / 10;
@@ -87,7 +87,7 @@ static void basic_init(void)
sb.body.radius = LV_RADIUS_CIRCLE; sb.body.radius = LV_RADIUS_CIRCLE;
sb.body.padding.inner = LV_DPI / 10; sb.body.padding.inner = LV_DPI / 10;
theme.style.scr = &scr; theme.style.scr = &scr;
theme.style.bg = &bg; theme.style.bg = &bg;
theme.style.panel = &panel; theme.style.panel = &panel;
} }
@@ -768,12 +768,12 @@ static void win_init(void)
pr.text.color = lv_color_hex3(0x333); pr.text.color = lv_color_hex3(0x333);
pr.image.color = lv_color_hex3(0x333); pr.image.color = lv_color_hex3(0x333);
theme.style.win.bg = theme.style.panel; theme.style.win.bg = theme.style.panel;
theme.style.win.sb = &sb; theme.style.win.sb = &sb;
theme.style.win.header = &header; theme.style.win.header = &header;
theme.style.win.content = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.btn.rel = &rel; theme.style.win.btn.rel = &rel;
theme.style.win.btn.pr = &pr; theme.style.win.btn.pr = &pr;
#endif #endif
} }