Merge branch 'master' into size_reduction
This commit is contained in:
@@ -23,9 +23,9 @@
|
||||
**********************/
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
static void scr_load_anim_start(lv_anim_t * a);
|
||||
static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v);
|
||||
static void scr_anim_ready(lv_anim_t * a);
|
||||
static void scr_load_anim_start(lv_anim_t * a);
|
||||
static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v);
|
||||
static void scr_anim_ready(lv_anim_t * a);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
@@ -166,7 +166,7 @@ void lv_disp_set_bg_color(lv_disp_t * disp, lv_color_t color)
|
||||
* @param disp pointer to a display
|
||||
* @param img_src path to file or pointer to an `lv_img_dsc_t` variable
|
||||
*/
|
||||
void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src)
|
||||
void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src)
|
||||
{
|
||||
if(!disp) disp = lv_disp_get_default();
|
||||
if(!disp) {
|
||||
@@ -248,60 +248,60 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
|
||||
lv_anim_set_delay(&a_old, delay);
|
||||
|
||||
switch(anim_type) {
|
||||
case LV_SCR_LOAD_ANIM_NONE:
|
||||
/* Create a dummy animation to apply the delay*/
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, 0, 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_LEFT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_RIGHT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_TOP:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_BOTTOM:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_LEFT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0);
|
||||
case LV_SCR_LOAD_ANIM_NONE:
|
||||
/* Create a dummy animation to apply the delay*/
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, 0, 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_LEFT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_RIGHT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_TOP:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_BOTTOM:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_LEFT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0);
|
||||
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_old, 0, -lv_disp_get_hor_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_RIGHT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0);
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_old, 0, -lv_disp_get_hor_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_RIGHT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0);
|
||||
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_old, 0, lv_disp_get_hor_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_TOP:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0);
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_old, 0, lv_disp_get_hor_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_TOP:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0);
|
||||
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_old, 0, -lv_disp_get_ver_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_BOTTOM:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0);
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_old, 0, -lv_disp_get_ver_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_BOTTOM:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0);
|
||||
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_old, 0, lv_disp_get_ver_res(d));
|
||||
break;
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_old, 0, lv_disp_get_ver_res(d));
|
||||
break;
|
||||
|
||||
case LV_SCR_LOAD_ANIM_FADE_ON:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) opa_scale_anim);
|
||||
lv_anim_set_values(&a_new, LV_OPA_TRANSP, LV_OPA_COVER);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_FADE_ON:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) opa_scale_anim);
|
||||
lv_anim_set_values(&a_new, LV_OPA_TRANSP, LV_OPA_COVER);
|
||||
break;
|
||||
}
|
||||
|
||||
lv_anim_start(&a_new);
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef enum {
|
||||
LV_SCR_LOAD_ANIM_MOVE_TOP,
|
||||
LV_SCR_LOAD_ANIM_MOVE_BOTTOM,
|
||||
LV_SCR_LOAD_ANIM_FADE_ON,
|
||||
}lv_scr_load_anim_t;
|
||||
} lv_scr_load_anim_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@@ -98,7 +98,7 @@ void lv_disp_set_bg_color(lv_disp_t * disp, lv_color_t color);
|
||||
* @param disp pointer to a display
|
||||
* @param img_src path to file or pointer to an `lv_img_dsc_t` variable
|
||||
*/
|
||||
void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src);
|
||||
void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src);
|
||||
|
||||
/**
|
||||
* Opacity of the background
|
||||
|
||||
@@ -85,8 +85,10 @@ static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coor
|
||||
static void report_style_mod_core(void * style_p, lv_obj_t * obj);
|
||||
static void refresh_children_style(lv_obj_t * obj);
|
||||
static void base_dir_refr_children(lv_obj_t * obj);
|
||||
static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
static void obj_align_origo_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set,
|
||||
lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
static void obj_align_origo_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set,
|
||||
lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
#if LV_USE_ANIMATION
|
||||
static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop, uint8_t part, lv_state_t prev_state,
|
||||
lv_state_t new_state);
|
||||
@@ -1751,6 +1753,51 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data)
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send LV_EVENT_REFRESH event to an object
|
||||
* @param obj point to an obejct. (Can NOT be NULL)
|
||||
* @return LV_RES_OK: success, LV_RES_INV: to object become invalid (e.g. deleted) due to this event.
|
||||
*/
|
||||
lv_res_t lv_event_send_refresh(lv_obj_t * obj)
|
||||
{
|
||||
return lv_event_send(obj, LV_EVENT_REFRESH, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send LV_EVENT_REFRESH event to an object and all of its children.
|
||||
* @param obj pointer to an object or NULL to refresh all objects of all displays
|
||||
*/
|
||||
void lv_event_send_refresh_recursive(lv_obj_t * obj)
|
||||
{
|
||||
if(obj == NULL) {
|
||||
/*If no obj specified refresh all screen of all displays */
|
||||
lv_disp_t * d = lv_disp_get_next(NULL);
|
||||
while(d) {
|
||||
lv_obj_t * scr = _lv_ll_get_head(&d->scr_ll);
|
||||
while(scr) {
|
||||
lv_event_send_refresh_recursive(scr);
|
||||
scr = _lv_ll_get_next(&d->scr_ll, scr);
|
||||
}
|
||||
lv_event_send_refresh_recursive(d->top_layer);
|
||||
lv_event_send_refresh_recursive(d->sys_layer);
|
||||
|
||||
d = lv_disp_get_next(d);
|
||||
}
|
||||
} else {
|
||||
|
||||
lv_res_t res = lv_event_send_refresh(obj);
|
||||
if(res != LV_RES_OK) return; /*If invalid returned do not check the children*/
|
||||
|
||||
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
||||
while(child) {
|
||||
lv_event_send_refresh_recursive(child);
|
||||
|
||||
child = lv_obj_get_child(obj, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call an event function with an object, event, and data.
|
||||
* @param event_xcb an event callback function. If `NULL` `LV_RES_OK` will return without any actions.
|
||||
@@ -3818,7 +3865,8 @@ static void base_dir_refr_children(lv_obj_t * obj)
|
||||
}
|
||||
}
|
||||
|
||||
static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||
static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set,
|
||||
lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||
{
|
||||
lv_point_t new_pos;
|
||||
_lv_area_align(&base->coords, &obj->coords, align, &new_pos);
|
||||
@@ -3837,7 +3885,8 @@ static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t ali
|
||||
else if(y_set) lv_obj_set_y(obj, new_pos.y);
|
||||
}
|
||||
|
||||
static void obj_align_origo_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||
static void obj_align_origo_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set,
|
||||
lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||
{
|
||||
lv_coord_t new_x = lv_obj_get_x(obj);
|
||||
lv_coord_t new_y = lv_obj_get_y(obj);
|
||||
|
||||
@@ -823,6 +823,20 @@ void lv_obj_set_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb);
|
||||
*/
|
||||
lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data);
|
||||
|
||||
|
||||
/**
|
||||
* Send LV_EVENT_REFRESH event to an object
|
||||
* @param obj point to an obejct. (Can NOT be NULL)
|
||||
* @return LV_RES_OK: success, LV_RES_INV: to object become invalid (e.g. deleted) due to this event.
|
||||
*/
|
||||
lv_res_t lv_event_send_refresh(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Send LV_EVENT_REFRESH event to an object and all of its children
|
||||
* @param obj pointer to an object or NULL to refresh all objects of all displays
|
||||
*/
|
||||
void lv_event_send_refresh_recursive(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Call an event function with an object, event, and data.
|
||||
* @param event_xcb an event callback function. If `NULL` `LV_RES_OK` will return without any actions.
|
||||
|
||||
@@ -517,10 +517,12 @@ static void lv_refr_area_part(const lv_area_t * area_p)
|
||||
lv_area_t a;
|
||||
lv_area_set(&a, 0, 0, header.w - 1, header.h - 1);
|
||||
lv_draw_img(&a, &start_mask, disp_refr->bg_img, &dsc);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Can't draw the background image")
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_draw_rect_dsc_t dsc;
|
||||
lv_draw_rect_dsc_init(&dsc);
|
||||
dsc.bg_color = disp_refr->bg_color;
|
||||
@@ -542,8 +544,8 @@ static void lv_refr_area_part(const lv_area_t * area_p)
|
||||
|
||||
|
||||
if(top_act_scr == NULL) {
|
||||
top_act_scr = disp_refr->act_scr;
|
||||
}
|
||||
top_act_scr = disp_refr->act_scr;
|
||||
}
|
||||
/*Do the refreshing from the top object*/
|
||||
lv_refr_obj_and_children(top_act_scr, &start_mask);
|
||||
|
||||
|
||||
@@ -407,7 +407,6 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
/*Build the image and a mask line-by-line*/
|
||||
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : lv_area_get_size(&draw_area);
|
||||
lv_color_t * map2 = _lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
|
||||
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
|
||||
@@ -420,7 +419,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
|
||||
mask_buf[px_i] = px_opa;
|
||||
if(px_opa) {
|
||||
#if LV_COLOR_DEPTH == 8
|
||||
#if LV_COLOR_DEPTH == 8 || LV_COLOR_DEPTH == 1
|
||||
map2[px_i].full = map_px[0];
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
map2[px_i].full = map_px[0] + (map_px[1] << 8);
|
||||
|
||||
@@ -1559,4 +1559,3 @@ static void draw_value(const lv_area_t * coords, const lv_area_t * clip, lv_draw
|
||||
|
||||
lv_draw_label(&value_area, clip, &label_dsc, dsc->value_str, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,8 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
|
||||
}
|
||||
|
||||
bool prefilter = fdsc->bitmap_format == LV_FONT_FMT_TXT_COMPRESSED ? true : false;
|
||||
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], decompr_buf, gdsc->box_w, gdsc->box_h, (uint8_t)fdsc->bpp, prefilter);
|
||||
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], decompr_buf, gdsc->box_w, gdsc->box_h, (uint8_t)fdsc->bpp,
|
||||
prefilter);
|
||||
return decompr_buf;
|
||||
#else /* !LV_USE_FONT_COMPRESSED */
|
||||
return NULL;
|
||||
@@ -353,7 +354,7 @@ static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord
|
||||
uint8_t * line_buf2 = NULL;
|
||||
|
||||
if(prefilter) {
|
||||
line_buf2= _lv_mem_buf_get(w);
|
||||
line_buf2 = _lv_mem_buf_get(w);
|
||||
}
|
||||
|
||||
decompress_line(line_buf1, w);
|
||||
@@ -375,7 +376,8 @@ static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord
|
||||
bits_write(out, wrp, line_buf1[x], bpp);
|
||||
wrp += wr_size;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
decompress_line(line_buf1, w);
|
||||
|
||||
for(x = 0; x < w; x++) {
|
||||
|
||||
@@ -150,7 +150,7 @@ typedef struct {
|
||||
typedef enum {
|
||||
LV_FONT_FMT_TXT_PLAIN = 0,
|
||||
LV_FONT_FMT_TXT_COMPRESSED = 1,
|
||||
LV_FONT_FMT_TXT_COMPRESSED_NO_PREFILTER= 1,
|
||||
LV_FONT_FMT_TXT_COMPRESSED_NO_PREFILTER = 1,
|
||||
} lv_font_fmt_txt_bitmap_format_t;
|
||||
|
||||
|
||||
|
||||
@@ -151,7 +151,8 @@ typedef struct _disp_t {
|
||||
struct _lv_obj_t * top_layer; /**< @see lv_disp_get_layer_top */
|
||||
struct _lv_obj_t * sys_layer; /**< @see lv_disp_get_layer_sys */
|
||||
|
||||
uint8_t del_prev :1; /**< 1: Automatically delete the previous screen when the screen load animation is ready */
|
||||
uint8_t del_prev :
|
||||
1; /**< 1: Automatically delete the previous screen when the screen load animation is ready */
|
||||
|
||||
lv_color_t bg_color; /**< Default display color when screens are transparent*/
|
||||
const void * bg_img; /**< An image source to display as wallpaper*/
|
||||
|
||||
@@ -390,7 +390,7 @@ static inline uint32_t lv_color_to32(lv_color_t color)
|
||||
{
|
||||
#if LV_COLOR_DEPTH == 1
|
||||
if(color.full == 0)
|
||||
return 0;
|
||||
return 0xFF000000;
|
||||
else
|
||||
return 0xFFFFFFFF;
|
||||
#elif LV_COLOR_DEPTH == 8
|
||||
|
||||
@@ -378,6 +378,17 @@ uint8_t lv_task_get_idle(void)
|
||||
return idle_last;
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate through the tasks
|
||||
* @param task NULL to start iteration or the previous return value to get the next task
|
||||
* @return the next task or NULL if there is no more task
|
||||
*/
|
||||
lv_task_t * lv_task_get_next(lv_task_t * task)
|
||||
{
|
||||
if(task == NULL) return _lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll));
|
||||
else return _lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), task);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -165,6 +165,13 @@ void lv_task_enable(bool en);
|
||||
*/
|
||||
uint8_t lv_task_get_idle(void);
|
||||
|
||||
/**
|
||||
* Iterate through the tasks
|
||||
* @param task NULL to start iteration or the previous return value to get the next task
|
||||
* @return the next task or NULL if there is no more task
|
||||
*/
|
||||
lv_task_t * lv_task_get_next(lv_task_t * task);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -191,7 +191,7 @@ static void apply_theme(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
}
|
||||
|
||||
/*apply_xcb is deprecated, use apply_cb instead*/
|
||||
if (th->apply_xcb) {
|
||||
if(th->apply_xcb) {
|
||||
th->apply_xcb(obj, name);
|
||||
}
|
||||
else if(th->apply_cb) {
|
||||
|
||||
@@ -38,6 +38,7 @@ typedef struct {
|
||||
lv_style_t pad_normal;
|
||||
lv_style_t pad_small;
|
||||
lv_style_t pad_inner;
|
||||
lv_style_t txt_underline;
|
||||
|
||||
#if LV_USE_ARC
|
||||
lv_style_t arc_bg, arc_indic;
|
||||
@@ -122,6 +123,8 @@ static void basic_init(void)
|
||||
lv_style_set_bg_opa(&styles->bg, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&styles->bg, LV_STATE_DEFAULT, BG_COLOR);
|
||||
lv_style_set_border_width(&styles->bg, LV_STATE_DEFAULT, BORDER_WIDTH);
|
||||
lv_style_set_border_width(&styles->bg, LV_STATE_FOCUSED, BORDER_WIDTH * 2);
|
||||
lv_style_set_border_width(&styles->bg, LV_STATE_FOCUSED | LV_STATE_EDITED, BORDER_WIDTH * 3);
|
||||
lv_style_set_border_color(&styles->bg, LV_STATE_DEFAULT, FG_COLOR);
|
||||
lv_style_set_line_width(&styles->bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100, 1));
|
||||
lv_style_set_scale_end_line_width(&styles->bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100, 1));
|
||||
@@ -139,10 +142,11 @@ static void basic_init(void)
|
||||
style_init_reset(&styles->clip_corner);
|
||||
lv_style_set_clip_corner(&styles->clip_corner, LV_STATE_DEFAULT, true);
|
||||
|
||||
|
||||
style_init_reset(&styles->btn);
|
||||
lv_style_set_radius(&styles->btn, LV_STATE_DEFAULT, RADIUS);
|
||||
lv_style_set_border_width(&styles->btn, LV_STATE_DEFAULT, BORDER_WIDTH);
|
||||
lv_style_set_border_width(&styles->btn, LV_STATE_FOCUSED, BORDER_WIDTH + 1);
|
||||
lv_style_set_border_width(&styles->btn, LV_STATE_FOCUSED | LV_STATE_EDITED, BORDER_WIDTH + 2);
|
||||
lv_style_set_border_color(&styles->btn, LV_STATE_DEFAULT, FG_COLOR);
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_DEFAULT, BG_COLOR);
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_PRESSED, FG_COLOR);
|
||||
@@ -204,6 +208,9 @@ static void basic_init(void)
|
||||
|
||||
style_init_reset(&styles->pad_inner);
|
||||
lv_style_set_pad_inner(&styles->pad_inner, LV_STATE_DEFAULT, LV_DPI / 15);
|
||||
|
||||
style_init_reset(&styles->txt_underline);
|
||||
lv_style_set_text_decor(&styles->txt_underline, LV_STATE_FOCUSED, LV_TEXT_DECOR_UNDERLINE);
|
||||
}
|
||||
|
||||
static void arc_init(void)
|
||||
@@ -589,6 +596,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -600,6 +608,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -714,6 +723,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
_lv_style_list_add_style(list, &styles->fg_color);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -725,6 +735,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -741,6 +752,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||
break;
|
||||
|
||||
#endif
|
||||
@@ -775,6 +787,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||
break;
|
||||
|
||||
case LV_THEME_TABVIEW_PAGE:
|
||||
@@ -834,6 +847,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->list_btn);
|
||||
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||
|
||||
break;
|
||||
#endif
|
||||
@@ -940,12 +954,14 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
_lv_style_list_add_style(list, &styles->fg_color);
|
||||
_lv_style_list_add_style(list, &styles->pad_none);
|
||||
_lv_style_list_add_style(list, &styles->no_radius);
|
||||
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||
break;
|
||||
|
||||
case LV_THEME_SPINBOX_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ static void basic_init(void)
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_PRESSED, lv_color_hex3(0xccc));
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED, theme.color_primary);
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary,
|
||||
LV_OPA_30));
|
||||
LV_OPA_30));
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_SILVER);
|
||||
lv_style_set_text_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
|
||||
lv_style_set_image_recolor(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
|
||||
@@ -345,8 +345,8 @@ static void win_init(void)
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title)
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title)
|
||||
{
|
||||
|
||||
/* This trick is required only to avoid the garbage collection of
|
||||
|
||||
@@ -1070,11 +1070,11 @@ static uint8_t get_day_of_week(uint32_t year, uint32_t month, uint32_t day)
|
||||
uint32_t a = month < 3 ? 1 : 0;
|
||||
uint32_t b = year - a;
|
||||
|
||||
#if LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||
#if LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||
uint32_t day_of_week = (day + (31 * (month - 2 + 12 * a) / 12) + b + (b / 4) - (b / 100) + (b / 400) - 1) % 7;
|
||||
#else
|
||||
#else
|
||||
uint32_t day_of_week = (day + (31 * (month - 2 + 12 * a) / 12) + b + (b / 4) - (b / 100) + (b / 400)) % 7;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return day_of_week;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ lv_obj_t * lv_canvas_create(lv_obj_t * par, const lv_obj_t * copy);
|
||||
/**
|
||||
* Set a buffer for the canvas.
|
||||
* @param buf a buffer where the content of the canvas will be.
|
||||
* The required size is (lv_img_color_format_get_px_size(cf) * w * h) / 8)
|
||||
* The required size is (lv_img_color_format_get_px_size(cf) * w) / 8 * h)
|
||||
* It can be allocated with `lv_mem_alloc()` or
|
||||
* it can be statically allocated array (e.g. static lv_color_t buf[100*50]) or
|
||||
* it can be an address in RAM or external SRAM
|
||||
|
||||
@@ -311,44 +311,44 @@ void lv_chart_set_point_count(lv_obj_t * chart, uint16_t point_cnt)
|
||||
if(point_cnt < 1) point_cnt = 1;
|
||||
|
||||
_LV_LL_READ_BACK(ext->series_ll, ser) {
|
||||
if( !ser->ext_buf_assigned ) {
|
||||
if(ser->start_point != 0) {
|
||||
lv_coord_t * new_points = lv_mem_alloc(sizeof(lv_coord_t) * point_cnt);
|
||||
LV_ASSERT_MEM(new_points);
|
||||
if(new_points == NULL) return;
|
||||
if(!ser->ext_buf_assigned) {
|
||||
if(ser->start_point != 0) {
|
||||
lv_coord_t * new_points = lv_mem_alloc(sizeof(lv_coord_t) * point_cnt);
|
||||
LV_ASSERT_MEM(new_points);
|
||||
if(new_points == NULL) return;
|
||||
|
||||
if(point_cnt >= point_cnt_old) {
|
||||
for(i = 0; i < point_cnt_old; i++) {
|
||||
new_points[i] =
|
||||
ser->points[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
|
||||
}
|
||||
for(i = point_cnt_old; i < point_cnt; i++) {
|
||||
new_points[i] = def; /*Fill up the rest with default value*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(i = 0; i < point_cnt; i++) {
|
||||
new_points[i] =
|
||||
ser->points[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
|
||||
}
|
||||
}
|
||||
if(point_cnt >= point_cnt_old) {
|
||||
for(i = 0; i < point_cnt_old; i++) {
|
||||
new_points[i] =
|
||||
ser->points[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
|
||||
}
|
||||
for(i = point_cnt_old; i < point_cnt; i++) {
|
||||
new_points[i] = def; /*Fill up the rest with default value*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(i = 0; i < point_cnt; i++) {
|
||||
new_points[i] =
|
||||
ser->points[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
|
||||
}
|
||||
}
|
||||
|
||||
/*Switch over pointer from old to new*/
|
||||
lv_mem_free(ser->points);
|
||||
ser->points = new_points;
|
||||
}
|
||||
else {
|
||||
ser->points = lv_mem_realloc(ser->points, sizeof(lv_coord_t) * point_cnt);
|
||||
LV_ASSERT_MEM(ser->points);
|
||||
if(ser->points == NULL) return;
|
||||
/*Initialize the new points*/
|
||||
if(point_cnt > point_cnt_old) {
|
||||
for(i = point_cnt_old - 1; i < point_cnt; i++) {
|
||||
ser->points[i] = def;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Switch over pointer from old to new*/
|
||||
lv_mem_free(ser->points);
|
||||
ser->points = new_points;
|
||||
}
|
||||
else {
|
||||
ser->points = lv_mem_realloc(ser->points, sizeof(lv_coord_t) * point_cnt);
|
||||
LV_ASSERT_MEM(ser->points);
|
||||
if(ser->points == NULL) return;
|
||||
/*Initialize the new points*/
|
||||
if(point_cnt > point_cnt_old) {
|
||||
for(i = point_cnt_old - 1; i < point_cnt; i++) {
|
||||
ser->points[i] = def;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ser->start_point = 0;
|
||||
}
|
||||
|
||||
@@ -552,8 +552,8 @@ void lv_chart_set_secondary_y_tick_texts(lv_obj_t * chart, const char * list_of_
|
||||
/**
|
||||
* Set the index of the x-axis start point in the data array
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the data array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the data array
|
||||
*/
|
||||
void lv_chart_set_x_start_point(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id)
|
||||
{
|
||||
@@ -563,7 +563,7 @@ void lv_chart_set_x_start_point(lv_obj_t * chart, lv_chart_series_t * ser, uint1
|
||||
if(chart == NULL || ser == NULL) return;
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(ext == NULL) return;
|
||||
if( id >= ext->point_cnt ) return;
|
||||
if(id >= ext->point_cnt) return;
|
||||
ser->start_point = id;
|
||||
}
|
||||
|
||||
@@ -571,9 +571,9 @@ void lv_chart_set_x_start_point(lv_obj_t * chart, lv_chart_series_t * ser, uint1
|
||||
* Set an external array of data points to use for the chart
|
||||
* NOTE: It is the users responsibility to make sure the point_cnt matches the external array size.
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param array external array of points for chart
|
||||
* @param point_cnt number of external points in the array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param array external array of points for chart
|
||||
* @param point_cnt number of external points in the array
|
||||
*/
|
||||
void lv_chart_set_ext_array(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t array[], uint16_t point_cnt)
|
||||
{
|
||||
@@ -582,7 +582,7 @@ void lv_chart_set_ext_array(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_
|
||||
|
||||
if(chart == NULL || ser == NULL) return;
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if( !ser->ext_buf_assigned && ser->points ) lv_mem_free(ser->points);
|
||||
if(!ser->ext_buf_assigned && ser->points) lv_mem_free(ser->points);
|
||||
ser->ext_buf_assigned = true;
|
||||
ser->points = array;
|
||||
ext->point_cnt = point_cnt;
|
||||
@@ -591,9 +591,9 @@ void lv_chart_set_ext_array(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_
|
||||
/**
|
||||
* Set an individual point y value in the chart series directly based on index
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param value value to assign to array point
|
||||
* @param id the index of the x point in the array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param value value to assign to array point
|
||||
* @param id the index of the x point in the array
|
||||
*/
|
||||
void lv_chart_set_point_id(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t value, uint16_t id)
|
||||
{
|
||||
@@ -603,7 +603,7 @@ void lv_chart_set_point_id(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t
|
||||
if(chart == NULL || ser == NULL) return;
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(ext == NULL) return;
|
||||
if( id >= ext->point_cnt ) return;
|
||||
if(id >= ext->point_cnt) return;
|
||||
ser->points[id] = value;
|
||||
}
|
||||
|
||||
@@ -623,7 +623,7 @@ void lv_chart_set_series_axis(lv_obj_t * chart, lv_chart_series_t * ser, lv_char
|
||||
return;
|
||||
}
|
||||
|
||||
if( ser->y_axis == axis) return;
|
||||
if(ser->y_axis == axis) return;
|
||||
|
||||
ser->y_axis = axis;
|
||||
lv_chart_refresh(chart);
|
||||
@@ -661,8 +661,8 @@ uint16_t lv_chart_get_point_count(const lv_obj_t * chart)
|
||||
|
||||
/**
|
||||
* Get the current index of the x-axis start point in the data array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @return the index of the current x start point in the data array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @return the index of the current x start point in the data array
|
||||
*/
|
||||
uint16_t lv_chart_get_x_start_point(lv_chart_series_t * ser)
|
||||
{
|
||||
@@ -674,9 +674,9 @@ uint16_t lv_chart_get_x_start_point(lv_chart_series_t * ser)
|
||||
/**
|
||||
* Get an individual point y value in the chart series directly based on index
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the array
|
||||
* @return value of array point at index id
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the array
|
||||
* @return value of array point at index id
|
||||
*/
|
||||
lv_coord_t lv_chart_get_point_id(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id)
|
||||
{
|
||||
@@ -684,7 +684,7 @@ lv_coord_t lv_chart_get_point_id(lv_obj_t * chart, lv_chart_series_t * ser, uint
|
||||
LV_ASSERT_NULL(ser);
|
||||
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if( id >= ext->point_cnt ) id = 0;
|
||||
if(id >= ext->point_cnt) id = 0;
|
||||
return(ser->points[id]);
|
||||
|
||||
}
|
||||
@@ -783,15 +783,15 @@ static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
lv_chart_series_t * ser;
|
||||
while( ext->series_ll.head != NULL ) {
|
||||
ser =_lv_ll_get_head(&ext->series_ll);
|
||||
while(ext->series_ll.head != NULL) {
|
||||
ser = _lv_ll_get_head(&ext->series_ll);
|
||||
|
||||
if(!ser->ext_buf_assigned) lv_mem_free(ser->points);
|
||||
if(!ser->ext_buf_assigned) lv_mem_free(ser->points);
|
||||
|
||||
_lv_ll_remove(&ext->series_ll, ser);
|
||||
lv_mem_free(ser);
|
||||
}
|
||||
_lv_ll_clear(&ext->series_ll);
|
||||
_lv_ll_remove(&ext->series_ll, ser);
|
||||
lv_mem_free(ser);
|
||||
}
|
||||
_lv_ll_clear(&ext->series_ll);
|
||||
|
||||
lv_obj_clean_style_list(chart, LV_CHART_PART_SERIES);
|
||||
lv_obj_clean_style_list(chart, LV_CHART_PART_SERIES_BG);
|
||||
|
||||
@@ -276,8 +276,8 @@ void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, ui
|
||||
/**
|
||||
* Set the index of the x-axis start point in the data array
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the data array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the data array
|
||||
*/
|
||||
void lv_chart_set_x_start_point(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id);
|
||||
|
||||
@@ -285,17 +285,17 @@ void lv_chart_set_x_start_point(lv_obj_t * chart, lv_chart_series_t * ser, uint1
|
||||
* Set an external array of data points to use for the chart
|
||||
* NOTE: It is the users responsibility to make sure the point_cnt matches the external array size.
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param array external array of points for chart
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param array external array of points for chart
|
||||
*/
|
||||
void lv_chart_set_ext_array(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t array[], uint16_t point_cnt );
|
||||
void lv_chart_set_ext_array(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t array[], uint16_t point_cnt);
|
||||
|
||||
/**
|
||||
* Set an individual point value in the chart series directly based on index
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param value value to assign to array point
|
||||
* @param id the index of the x point in the array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param value value to assign to array point
|
||||
* @param id the index of the x point in the array
|
||||
*/
|
||||
void lv_chart_set_point_id(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t value, uint16_t id);
|
||||
|
||||
@@ -327,17 +327,17 @@ uint16_t lv_chart_get_point_count(const lv_obj_t * chart);
|
||||
|
||||
/**
|
||||
* get the current index of the x-axis start point in the data array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @return the index of the current x start point in the data array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @return the index of the current x start point in the data array
|
||||
*/
|
||||
uint16_t lv_chart_get_x_start_point(lv_chart_series_t * ser);
|
||||
|
||||
/**
|
||||
* Get an individual point value in the chart series directly based on index
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the array
|
||||
* @return value of array point at index id
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the array
|
||||
* @return value of array point at index id
|
||||
*/
|
||||
lv_coord_t lv_chart_get_point_id(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id);
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ static inline void lv_checkbox_set_disabled(lv_obj_t * cb)
|
||||
*/
|
||||
static inline void lv_checkbox_set_state(lv_obj_t * cb, lv_btn_state_t state)
|
||||
{
|
||||
lv_btn_set_state(cb, state);
|
||||
lv_btn_set_state(cb, state);
|
||||
}
|
||||
/*=====================
|
||||
* Getter functions
|
||||
@@ -153,7 +153,7 @@ static inline bool lv_checkbox_is_inactive(const lv_obj_t * cb)
|
||||
*/
|
||||
static inline lv_btn_state_t lv_checkbox_get_state(const lv_obj_t * cb)
|
||||
{
|
||||
return lv_btn_get_state(cb);
|
||||
return lv_btn_get_state(cb);
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -628,7 +628,7 @@ static void lv_cont_layout_grid(lv_obj_t * cont)
|
||||
_LV_LL_READ_BACK(cont->child_ll, child) {
|
||||
if(lv_obj_get_hidden(child) != false || lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
|
||||
lv_coord_t obj_w = lv_obj_get_width(child);
|
||||
if(act_x + inner + obj_w > w_fit) {
|
||||
if(act_x + obj_w > w_fit + left) {
|
||||
act_x = left;
|
||||
act_y += y_ofs;
|
||||
}
|
||||
|
||||
@@ -474,12 +474,15 @@ static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * cli
|
||||
|
||||
/*Get the size of the "selected text"*/
|
||||
lv_point_t res_p;
|
||||
_lv_txt_get_size(&res_p, lv_label_get_text(label), label_dsc.font, label_dsc.letter_space, label_dsc.line_space, lv_obj_get_width(roller), LV_TXT_FLAG_EXPAND);
|
||||
_lv_txt_get_size(&res_p, lv_label_get_text(label), label_dsc.font, label_dsc.letter_space, label_dsc.line_space,
|
||||
lv_obj_get_width(roller), LV_TXT_FLAG_EXPAND);
|
||||
|
||||
/*Move the selected label proportionally with the background label*/
|
||||
lv_coord_t roller_h = lv_obj_get_height(roller);
|
||||
int32_t label_y_prop = label->coords.y1 - (roller_h / 2 + roller->coords.y1); /*label offset from the middle line of the roller*/
|
||||
label_y_prop = (label_y_prop << 14) / lv_obj_get_height(label); /*Proportional position from the middle line (upscaled)*/
|
||||
int32_t label_y_prop = label->coords.y1 - (roller_h / 2 +
|
||||
roller->coords.y1); /*label offset from the middle line of the roller*/
|
||||
label_y_prop = (label_y_prop << 14) / lv_obj_get_height(
|
||||
label); /*Proportional position from the middle line (upscaled)*/
|
||||
|
||||
/*Apply a correction with different line heights*/
|
||||
const lv_font_t * normal_label_font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
|
||||
|
||||
@@ -448,6 +448,36 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an
|
||||
lv_btnmatrix_set_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNMATRIX_CTRL_CHECK_STATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of a tab.
|
||||
* @param tabview pointer to Tab view object
|
||||
* @param id index of the tab the name should be set
|
||||
* @param name new tab name
|
||||
*/
|
||||
void lv_tabview_set_tab_name(lv_obj_t *tabview, uint16_t id, char *name)
|
||||
{
|
||||
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
|
||||
|
||||
/* get tabview's ext pointer which contains the tab name pointer list */
|
||||
lv_tabview_ext_t *ext = lv_obj_get_ext_attr(tabview);
|
||||
|
||||
/* check for valid tab index */
|
||||
if (ext->tab_cnt > id)
|
||||
{
|
||||
/* reallocate memory for new tab name (use reallocate due to mostly the size didn't change much) */
|
||||
char *str = lv_mem_realloc((void *)ext->tab_name_ptr[id], strlen(name) + 1);
|
||||
LV_ASSERT_MEM(str);
|
||||
|
||||
/* store new tab name at allocated memory */
|
||||
strcpy(str, name);
|
||||
/* update pointer */
|
||||
ext->tab_name_ptr[id] = str;
|
||||
|
||||
/* force redrawing of the tab headers */
|
||||
lv_obj_invalidate(ext->btns);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the animation time of tab view when a new tab is loaded
|
||||
* @param tabview pointer to Tab view object
|
||||
|
||||
@@ -119,6 +119,14 @@ void lv_tabview_clean_tab(lv_obj_t * tab);
|
||||
*/
|
||||
void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t anim);
|
||||
|
||||
/**
|
||||
* Set the name of a tab.
|
||||
* @param tabview pointer to Tab view object
|
||||
* @param id index of the tab the name should be set
|
||||
* @param name new tab name
|
||||
*/
|
||||
void lv_tabview_set_tab_name(lv_obj_t * tabview, uint16_t id, char * name);
|
||||
|
||||
/**
|
||||
* Set the animation time of tab view when a new tab is loaded
|
||||
* @param tabview pointer to Tab view object
|
||||
|
||||
Reference in New Issue
Block a user