merge beta

This commit is contained in:
Gabor Kiss-Vamosi
2018-04-17 14:39:27 +02:00
29 changed files with 192 additions and 80 deletions

View File

@@ -81,9 +81,10 @@
#define USE_LV_REAL_DRAW 1 /*1: Enable function which draw directly to the frame buffer instead of VDB (required if LV_VDB_SIZE = 0)*/ #define USE_LV_REAL_DRAW 1 /*1: Enable function which draw directly to the frame buffer instead of VDB (required if LV_VDB_SIZE = 0)*/
#define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images*/ #define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images*/
/*Compiler attributes*/ /*Compiler settings*/
#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to tick increment function */ #define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_tick_inc` function */
#define LV_ATTRIBUTE_TASK_HANDLER #define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */
#define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/
/*================ /*================
* THEME USAGE * THEME USAGE
@@ -242,6 +243,13 @@
/*Switch (dependencies: lv_slider)*/ /*Switch (dependencies: lv_slider)*/
#define USE_LV_SW 1 #define USE_LV_SW 1
/*************************
* Non-user section
*************************/
#ifdef _MSC_VER /* Disable warnings for Visual Studio*/
# define _CRT_SECURE_NO_WARNINGS
#endif
#endif /*LV_CONF_H*/ #endif /*LV_CONF_H*/

View File

@@ -47,6 +47,7 @@ lv_group_t * lv_group_create(void)
group->style_mod = style_mod_def; group->style_mod = style_mod_def;
group->obj_focus = NULL; group->obj_focus = NULL;
group->frozen = 0; group->frozen = 0;
group->focus_cb = NULL;
return group; return group;
} }
@@ -88,6 +89,10 @@ void lv_group_remove_obj(lv_obj_t * obj)
lv_group_t * g = obj->group_p; lv_group_t * g = obj->group_p;
if(g == NULL) return; if(g == NULL) return;
if(*g->obj_focus == obj) {
lv_group_focus_next(g);
}
/*Search the object and remove it from its group */ /*Search the object and remove it from its group */
lv_obj_t ** i; lv_obj_t ** i;
LL_READ(g->obj_ll, i) { LL_READ(g->obj_ll, i) {
@@ -97,11 +102,6 @@ void lv_group_remove_obj(lv_obj_t * obj)
obj->group_p = NULL; obj->group_p = NULL;
} }
} }
if(*g->obj_focus == obj) {
g->obj_focus = NULL;
lv_group_focus_next(g);
}
} }
/** /**

View File

@@ -61,6 +61,12 @@ typedef struct _lv_group_t
*/ */
lv_group_t * lv_group_create(void); lv_group_t * lv_group_create(void);
/**
* Delete a group object
* @param group pointer to a group
*/
void lv_group_del(lv_group_t * group);
/** /**
* Add an object to a group * Add an object to a group
* @param group pointer to a group * @param group pointer to a group

View File

@@ -655,10 +655,14 @@ static void indev_drag(lv_indev_proc_t * state)
lv_coord_t act_y = lv_obj_get_y(drag_obj); lv_coord_t act_y = lv_obj_get_y(drag_obj);
uint16_t inv_buf_size = lv_refr_get_buf_size(); /*Get the number of currently invalidated areas*/ uint16_t inv_buf_size = lv_refr_get_buf_size(); /*Get the number of currently invalidated areas*/
lv_coord_t prev_x = drag_obj->coords.x1;
lv_coord_t prev_y = drag_obj->coords.y1;
lv_obj_set_pos(drag_obj, act_x + state->vect.x, act_y + state->vect.y); lv_obj_set_pos(drag_obj, act_x + state->vect.x, act_y + state->vect.y);
/*Set the drag in progress flag if the object is really moved*/ /*Set the drag in progress flag if the object is really moved*/
if(lv_obj_get_x(drag_obj) != act_x || lv_obj_get_y(drag_obj) != act_y) {
if(drag_obj->coords.x1 != prev_x || drag_obj->coords.y1 != prev_y) {
if(state->drag_range_out != 0) { /*Send the drag begin signal on first move*/ if(state->drag_range_out != 0) { /*Send the drag begin signal on first move*/
drag_obj->signal_func(drag_obj, LV_SIGNAL_DRAG_BEGIN, indev_act); drag_obj->signal_func(drag_obj, LV_SIGNAL_DRAG_BEGIN, indev_act);
if(state->reset_query != 0) return; if(state->reset_query != 0) return;

View File

@@ -284,20 +284,17 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
lv_anim_del(obj, NULL); lv_anim_del(obj, NULL);
#endif #endif
/*Delete from the group*/
#if USE_LV_GROUP
if(obj->group_p != NULL) lv_group_remove_obj(obj);
#endif
/* Reset all input devices if /* Reset all input devices if
* the currently pressed object is deleted*/ * the currently pressed object is deleted*/
lv_indev_t * indev = lv_indev_next(NULL); lv_indev_t * indev = lv_indev_next(NULL);
lv_obj_t * dpar;
while(indev) { while(indev) {
dpar = obj; if(indev->proc.act_obj == obj || indev->proc.last_obj == obj) {
while(dpar != NULL) { lv_indev_reset(indev);
if(indev->proc.act_obj == dpar ||
indev->proc.last_obj == dpar) {
lv_indev_reset(indev);
break;
} else {
dpar = lv_obj_get_parent(dpar);
}
} }
indev = lv_indev_next(indev); indev = lv_indev_next(indev);
} }
@@ -1586,6 +1583,16 @@ static void delete_children(lv_obj_t * obj)
if(obj->group_p != NULL) lv_group_remove_obj(obj); if(obj->group_p != NULL) lv_group_remove_obj(obj);
#endif #endif
/* Reset the input devices if
* the currently pressed object is deleted*/
lv_indev_t * indev = lv_indev_next(NULL);
while(indev) {
if(indev->proc.act_obj == obj || indev->proc.last_obj == obj) {
lv_indev_reset(indev);
}
indev = lv_indev_next(indev);
}
/*Remove the object from parent's children list*/ /*Remove the object from parent's children list*/
lv_obj_t * par = lv_obj_get_parent(obj); lv_obj_t * par = lv_obj_get_parent(obj);
lv_ll_rem(&(par->child_ll), obj); lv_ll_rem(&(par->child_ll), obj);

View File

@@ -429,7 +429,7 @@ void lv_obj_set_design_func(lv_obj_t * obj, lv_design_func_t fp);
* Allocate a new ext. data for an object * Allocate a new ext. data for an object
* @param obj pointer to an object * @param obj pointer to an object
* @param ext_size the size of the new ext. data * @param ext_size the size of the new ext. data
* @return Normal pointer to the allocated ext * @return pointer to the allocated ext
*/ */
void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size); void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size);

View File

@@ -272,8 +272,11 @@ static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val)
STYLE_ATTR_ANIM(body.padding.inner, val); STYLE_ATTR_ANIM(body.padding.inner, val);
STYLE_ATTR_ANIM(text.line_space, val); STYLE_ATTR_ANIM(text.line_space, val);
STYLE_ATTR_ANIM(text.letter_space, val); STYLE_ATTR_ANIM(text.letter_space, val);
STYLE_ATTR_ANIM(text.opa, val);
STYLE_ATTR_ANIM(line.width, val); STYLE_ATTR_ANIM(line.width, val);
STYLE_ATTR_ANIM(line.opa, val);
STYLE_ATTR_ANIM(image.intense, val); STYLE_ATTR_ANIM(image.intense, val);
STYLE_ATTR_ANIM(image.opa, val);
lv_opa_t opa = val == LV_STYLE_ANIM_RES ? LV_OPA_COVER : val; lv_opa_t opa = val == LV_STYLE_ANIM_RES ? LV_OPA_COVER : val;

View File

@@ -448,7 +448,15 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
lv_coord_t row; lv_coord_t row;
uint32_t act_pos; uint32_t act_pos;
#if LV_COMPILER_VLA_SUPPORTED
lv_color_t buf[lv_area_get_width(&mask_com)]; lv_color_t buf[lv_area_get_width(&mask_com)];
#else
# if LV_HOR_RES > LV_VER_RES
lv_color_t buf[LV_HOR_RES];
# else
lv_color_t buf[LV_VER_RES];
# endif
#endif
for(row = mask_com.y1; row <= mask_com.y2; row ++) { for(row = mask_com.y1; row <= mask_com.y2; row ++) {
res = lv_fs_read(&file, buf, useful_data, &br); res = lv_fs_read(&file, buf, useful_data, &br);
@@ -1713,8 +1721,15 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
if(radius != 0) radius -= LV_ANTIALIAS; if(radius != 0) radius -= LV_ANTIALIAS;
swidth += LV_ANTIALIAS; swidth += LV_ANTIALIAS;
#if LV_COMPILER_VLA_SUPPORTED
lv_coord_t curve_x[radius + swidth + 1]; /*Stores the 'x' coordinates of a quarter circle.*/ lv_coord_t curve_x[radius + swidth + 1]; /*Stores the 'x' coordinates of a quarter circle.*/
#else
# if LV_HOR_RES > LV_VER_RES
lv_coord_t curve_x[LV_HOR_RES];
# else
lv_coord_t curve_x[LV_VER_RES];
# endif
#endif
memset(curve_x, 0, sizeof(curve_x)); memset(curve_x, 0, sizeof(curve_x));
lv_point_t circ; lv_point_t circ;
lv_coord_t circ_tmp; lv_coord_t circ_tmp;
@@ -1727,15 +1742,30 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
int16_t line; int16_t line;
int16_t filter_width = 2 * swidth + 1; int16_t filter_width = 2 * swidth + 1;
#if LV_COMPILER_VLA_SUPPORTED
uint32_t line_1d_blur[filter_width]; uint32_t line_1d_blur[filter_width];
#else
# if LV_HOR_RES > LV_VER_RES
uint32_t line_1d_blur[LV_HOR_RES];
# else
uint32_t line_1d_blur[LV_VER_RES];
# endif
#endif
/*1D Blur horizontally*/ /*1D Blur horizontally*/
for(line = 0; line < filter_width; line++) { for(line = 0; line < filter_width; line++) {
line_1d_blur[line] = (uint32_t)((uint32_t)(filter_width - line) * (style->body.opa * 2) << SHADOW_OPA_EXTRA_PRECISION) / (filter_width * filter_width); line_1d_blur[line] = (uint32_t)((uint32_t)(filter_width - line) * (style->body.opa * 2) << SHADOW_OPA_EXTRA_PRECISION) / (filter_width * filter_width);
} }
uint16_t col; uint16_t col;
#if LV_COMPILER_VLA_SUPPORTED
lv_opa_t line_2d_blur[radius + swidth]; lv_opa_t line_2d_blur[radius + swidth];
#else
# if LV_HOR_RES > LV_VER_RES
lv_opa_t line_2d_blur[LV_HOR_RES];
# else
lv_opa_t line_2d_blur[LV_VER_RES];
# endif
#endif
lv_point_t point_rt; lv_point_t point_rt;
lv_point_t point_rb; lv_point_t point_rb;
@@ -1845,8 +1875,15 @@ static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * ma
radius = lv_draw_cont_radius_corr(radius, width, height); radius = lv_draw_cont_radius_corr(radius, width, height);
radius += LV_ANTIALIAS * SHADOW_BOTTOM_AA_EXTRA_RADIUS; radius += LV_ANTIALIAS * SHADOW_BOTTOM_AA_EXTRA_RADIUS;
swidth += LV_ANTIALIAS; swidth += LV_ANTIALIAS;
#if LV_COMPILER_VLA_SUPPORTED
lv_coord_t curve_x[radius + 1]; /*Stores the 'x' coordinates of a quarter circle.*/ lv_coord_t curve_x[radius + 1]; /*Stores the 'x' coordinates of a quarter circle.*/
#else
# if LV_HOR_RES > LV_VER_RES
lv_coord_t curve_x[LV_HOR_RES];
# else
lv_coord_t curve_x[LV_VER_RES];
# endif
#endif
lv_point_t circ; lv_point_t circ;
lv_coord_t circ_tmp; lv_coord_t circ_tmp;
lv_circ_init(&circ, &circ_tmp, radius); lv_circ_init(&circ, &circ_tmp, radius);
@@ -1857,7 +1894,15 @@ static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * ma
} }
int16_t col; int16_t col;
#if LV_COMPILER_VLA_SUPPORTED
lv_opa_t line_1d_blur[swidth]; lv_opa_t line_1d_blur[swidth];
#else
# if LV_HOR_RES > LV_VER_RES
lv_opa_t line_1d_blur[LV_HOR_RES];
# else
lv_opa_t line_1d_blur[LV_VER_RES];
# endif
#endif
for(col = 0; col < swidth; col++) { for(col = 0; col < swidth; col++) {
line_1d_blur[col] = (uint32_t)((uint32_t)(swidth - col) * style->body.opa / 2) / (swidth); line_1d_blur[col] = (uint32_t)((uint32_t)(swidth - col) * style->body.opa / 2) / (swidth);

View File

@@ -28,7 +28,7 @@
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_color_t letter_bg_color = LV_COLOR_WHITE; static lv_color_t letter_bg_color;
/********************** /**********************
* MACROS * MACROS

View File

@@ -167,7 +167,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
} }
/*Fill with opacity*/ /*Fill with opacity*/
else { else {
/*Use hw blend if present*/ /*Use hw blend if present*/
if(lv_disp_is_mem_blend_supported()) { if(lv_disp_is_mem_blend_supported()) {
if(color_array_tmp[0].full != color.full || last_width != w) { if(color_array_tmp[0].full != color.full || last_width != w) {
uint16_t i; uint16_t i;
@@ -317,7 +317,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
*/ */
void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte, const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa) lv_color_t recolor, lv_opa_t recolor_opa)
{ {
lv_area_t masked_a; lv_area_t masked_a;
bool union_ok; bool union_ok;
@@ -384,31 +384,43 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
for(row = masked_a.y1; row <= masked_a.y2; row++) { for(row = masked_a.y1; row <= masked_a.y2; row++) {
for(col = 0; col < map_useful_w; col++) { for(col = 0; col < map_useful_w; col++) {
lv_opa_t opa_result = opa; lv_opa_t opa_result = opa;
lv_color_t * px_color = (lv_color_t *) &map_p[(uint32_t)col * px_size_byte]; uint8_t * px_color_p = (uint8_t *) &map_p[(uint32_t)col * px_size_byte];
lv_color_t px_color;
/*Handle chroma key*/
if(chroma_key && px_color->full == chroma_key_color.full) continue;
/*Calculate with the pixel level alpha*/ /*Calculate with the pixel level alpha*/
if(alpha_byte) { if(alpha_byte) {
lv_opa_t px_opa = (*(((uint8_t *) px_color) + LV_IMG_PX_SIZE_ALPHA_BYTE - 1)); #if LV_COLOR_DEPTH == 8
px_color.full = px_color_p[0];
#elif LV_COLOR_DEPTH == 16
/*Because of Alpha byte 16 bit color can start on odd address which can cause crash*/
px_color.full = px_color_p[0] + (px_color_p[1] << 8);
#elif LV_COLOR_DEPTH == 24
px_color = *((lv_color_t*)px_color_p);
#endif
lv_opa_t px_opa = *(px_color_p + LV_IMG_PX_SIZE_ALPHA_BYTE - 1);
if(px_opa == LV_OPA_TRANSP) continue; if(px_opa == LV_OPA_TRANSP) continue;
else if(px_opa != LV_OPA_COVER) opa_result = (uint32_t)((uint32_t)px_opa * opa_result) >> 8; else if(px_opa != LV_OPA_COVER) opa_result = (uint32_t)((uint32_t)px_opa * opa_result) >> 8;
} }
else {
px_color = *((lv_color_t*)px_color_p);
}
/*Handle chroma key*/
if(chroma_key && px_color.full == chroma_key_color.full) continue;
/*Re-color the pixel if required*/ /*Re-color the pixel if required*/
if(recolor_opa != LV_OPA_TRANSP) { if(recolor_opa != LV_OPA_TRANSP) {
if(last_img_px.full != px_color->full) { /*Minor acceleration: calculate only for new colors (save the last)*/ if(last_img_px.full != px_color.full) { /*Minor acceleration: calculate only for new colors (save the last)*/
last_img_px = *px_color; last_img_px = px_color;
recolored_px = lv_color_mix(recolor, last_img_px, recolor_opa); recolored_px = lv_color_mix(recolor, last_img_px, recolor_opa);
} }
if(opa_result == LV_OPA_COVER) vdb_buf_tmp[col].full = recolored_px.full; if(opa_result == LV_OPA_COVER) vdb_buf_tmp[col].full = recolored_px.full;
else vdb_buf_tmp[col] = lv_color_mix(recolored_px, vdb_buf_tmp[col], opa_result); else vdb_buf_tmp[col] = lv_color_mix(recolored_px, vdb_buf_tmp[col], opa_result);
} else { } else {
if(opa_result == LV_OPA_COVER) vdb_buf_tmp[col].full = px_color->full; if(opa_result == LV_OPA_COVER) vdb_buf_tmp[col] = px_color;
else vdb_buf_tmp[col] = lv_color_mix(*px_color, vdb_buf_tmp[col], opa_result); else vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result);
} }
@@ -441,8 +453,8 @@ static void sw_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t len
} else { } else {
uint32_t col; uint32_t col;
for(col = 0; col < length; col++) { for(col = 0; col < length; col++) {
dest[col] = lv_color_mix(src[col], dest[col], opa); dest[col] = lv_color_mix(src[col], dest[col], opa);
} }
} }
} }

View File

@@ -115,7 +115,9 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp)
uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end) uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end)
{ {
int32_t d = LV_MATH_ABS((int32_t) start - end); int32_t d = LV_MATH_ABS((int32_t) start - end);
uint16_t time = (int32_t)((int32_t)(d * 1000) / speed); uint32_t time = (int32_t)((int32_t)(d * 1000) / speed);
if(time > UINT16_MAX) time = UINT16_MAX;
if(time == 0) { if(time == 0) {
time++; time++;

View File

@@ -43,7 +43,7 @@ typedef struct _lv_anim_t
lv_anim_path_t path; /*An array with the steps of animations*/ lv_anim_path_t path; /*An array with the steps of animations*/
int32_t start; /*Start value*/ int32_t start; /*Start value*/
int32_t end; /*End value*/ int32_t end; /*End value*/
int16_t time; /*Animation time in ms*/ uint16_t time; /*Animation time in ms*/
int16_t act_time; /*Current time in animation. Set to negative to make delay.*/ int16_t act_time; /*Current time in animation. Set to negative to make delay.*/
uint16_t playback_pause; /*Wait before play back*/ uint16_t playback_pause; /*Wait before play back*/
uint16_t repeat_pause; /*Wait before repeat*/ uint16_t repeat_pause; /*Wait before repeat*/

View File

@@ -292,7 +292,7 @@ const uint8_t * lv_font_get_bitmap_sparse(const lv_font_t * font, uint32_t unico
* @param unicode_letter an unicode letter which width should be get * @param unicode_letter an unicode letter which width should be get
* @return width of the gylph or -1 if not found * @return width of the gylph or -1 if not found
*/ */
const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unicode_letter) int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unicode_letter)
{ {
/*Check the range*/ /*Check the range*/
if(unicode_letter < font->unicode_first || unicode_letter > font->unicode_last) { if(unicode_letter < font->unicode_first || unicode_letter > font->unicode_last) {
@@ -309,7 +309,7 @@ const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unic
* @param unicode_letter an unicode letter which width should be get * @param unicode_letter an unicode letter which width should be get
* @return width of the glyph or -1 if not found * @return width of the glyph or -1 if not found
*/ */
const int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter) int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter)
{ {
/*Check the range*/ /*Check the range*/
if(unicode_letter < font->unicode_first || unicode_letter > font->unicode_last) return -1; if(unicode_letter < font->unicode_first || unicode_letter > font->unicode_last) return -1;

View File

@@ -50,7 +50,7 @@ typedef struct _lv_font_struct
const lv_font_glyph_dsc_t * glyph_dsc; const lv_font_glyph_dsc_t * glyph_dsc;
const uint32_t * unicode_list; const uint32_t * unicode_list;
const uint8_t * (*get_bitmap)(const struct _lv_font_struct * ,uint32_t); /*Get a glyph's bitmap from a font*/ const uint8_t * (*get_bitmap)(const struct _lv_font_struct * ,uint32_t); /*Get a glyph's bitmap from a font*/
const int16_t (*get_width)(const struct _lv_font_struct * ,uint32_t); /*Get a glyph's with with a given font*/ int16_t (*get_width)(const struct _lv_font_struct * ,uint32_t); /*Get a glyph's with with a given font*/
struct _lv_font_struct * next_page; /*Pointer to a font extension*/ struct _lv_font_struct * next_page; /*Pointer to a font extension*/
uint32_t bpp :4; /*Bit per pixel: 1, 2 or 4*/ uint32_t bpp :4; /*Bit per pixel: 1, 2 or 4*/
}lv_font_t; }lv_font_t;
@@ -126,7 +126,7 @@ const uint8_t * lv_font_get_bitmap_sparse(const lv_font_t * font, uint32_t unico
* @param unicode_letter an unicode letter which width should be get * @param unicode_letter an unicode letter which width should be get
* @return width of the gylph or -1 if not found * @return width of the gylph or -1 if not found
*/ */
const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unicode_letter); int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unicode_letter);
/** /**
* Generic glyph width get function used in 'font->get_bitmap' when the font NOT contains all characters in the range (sparse) * Generic glyph width get function used in 'font->get_bitmap' when the font NOT contains all characters in the range (sparse)
@@ -134,7 +134,7 @@ const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unic
* @param unicode_letter an unicode letter which width should be get * @param unicode_letter an unicode letter which width should be get
* @return width of the glyph or -1 if not found * @return width of the glyph or -1 if not found
*/ */
const int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter); int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter);
/********************** /**********************
* MACROS * MACROS

View File

@@ -163,7 +163,7 @@ lv_fs_res_t lv_fs_remove (const char * path)
lv_fs_res_t lv_fs_read (lv_fs_file_t * file_p, void * buf, uint32_t btr, uint32_t * br) lv_fs_res_t lv_fs_read (lv_fs_file_t * file_p, void * buf, uint32_t btr, uint32_t * br)
{ {
if(br != NULL) *br = 0; if(br != NULL) *br = 0;
if(file_p->drv == NULL || file_p->drv == NULL) return LV_FS_RES_INV_PARAM; if(file_p->drv == NULL) return LV_FS_RES_INV_PARAM;
if(file_p->drv->read == NULL) return LV_FS_RES_NOT_IMP; if(file_p->drv->read == NULL) return LV_FS_RES_NOT_IMP;
uint32_t br_tmp = 0; uint32_t br_tmp = 0;
@@ -185,7 +185,7 @@ lv_fs_res_t lv_fs_write (lv_fs_file_t * file_p, const void * buf, uint32_t btw,
{ {
if(bw != NULL) *bw = 0; if(bw != NULL) *bw = 0;
if(file_p->drv == NULL || file_p->drv == NULL) { if(file_p->drv == NULL) {
return LV_FS_RES_INV_PARAM; return LV_FS_RES_INV_PARAM;
} }
@@ -208,7 +208,7 @@ lv_fs_res_t lv_fs_write (lv_fs_file_t * file_p, const void * buf, uint32_t btw,
*/ */
lv_fs_res_t lv_fs_seek (lv_fs_file_t * file_p, uint32_t pos) lv_fs_res_t lv_fs_seek (lv_fs_file_t * file_p, uint32_t pos)
{ {
if(file_p->drv == NULL || file_p->drv == NULL) { if(file_p->drv == NULL) {
return LV_FS_RES_INV_PARAM; return LV_FS_RES_INV_PARAM;
} }
@@ -229,7 +229,7 @@ lv_fs_res_t lv_fs_seek (lv_fs_file_t * file_p, uint32_t pos)
*/ */
lv_fs_res_t lv_fs_tell (lv_fs_file_t * file_p, uint32_t * pos) lv_fs_res_t lv_fs_tell (lv_fs_file_t * file_p, uint32_t * pos)
{ {
if(file_p->drv == NULL || file_p->drv == NULL) { if(file_p->drv == NULL) {
pos = 0; pos = 0;
return LV_FS_RES_INV_PARAM; return LV_FS_RES_INV_PARAM;
} }
@@ -252,7 +252,7 @@ lv_fs_res_t lv_fs_tell (lv_fs_file_t * file_p, uint32_t * pos)
*/ */
lv_fs_res_t lv_fs_size (lv_fs_file_t * file_p, uint32_t * size) lv_fs_res_t lv_fs_size (lv_fs_file_t * file_p, uint32_t * size)
{ {
if(file_p->drv == NULL || file_p->drv == NULL) { if(file_p->drv == NULL) {
return LV_FS_RES_INV_PARAM; return LV_FS_RES_INV_PARAM;
} }

View File

@@ -286,10 +286,10 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode
if(w >= h) { if(w >= h) {
indic_area.x2 = (int32_t) ((int32_t)w * (ext->cur_value - ext->min_value)) / (ext->max_value - ext->min_value); indic_area.x2 = (int32_t) ((int32_t)w * (ext->cur_value - ext->min_value)) / (ext->max_value - ext->min_value);
indic_area.x2 += indic_area.x1; indic_area.x2 = indic_area.x1 + indic_area.x2 - 1;
} else { } else {
indic_area.y1 = (int32_t) ((int32_t)h * (ext->cur_value - ext->min_value)) / (ext->max_value - ext->min_value); indic_area.y1 = (int32_t) ((int32_t)h * (ext->cur_value - ext->min_value)) / (ext->max_value - ext->min_value);
indic_area.y1 = indic_area.y2 - indic_area.y1; indic_area.y1 = indic_area.y2 - indic_area.y1 + 1;
} }
/*Draw the indicator*/ /*Draw the indicator*/

View File

@@ -602,7 +602,8 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
break; break;
} }
} }
ext->btn_id_pr = area_below;
if(area_below < ext->btn_cnt) ext->btn_id_pr = area_below;
} }
lv_obj_invalidate(btnm); lv_obj_invalidate(btnm);
} else if(c == LV_GROUP_KEY_UP) { } else if(c == LV_GROUP_KEY_UP) {
@@ -611,10 +612,10 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
if(ext->btn_id_pr == LV_BTNM_PR_NONE) { if(ext->btn_id_pr == LV_BTNM_PR_NONE) {
ext->btn_id_pr = 0; ext->btn_id_pr = 0;
} else { } else {
uint16_t area_above; int16_t area_above;
lv_coord_t pr_center = ext->button_areas[ext->btn_id_pr].x1 + (lv_area_get_width(&ext->button_areas[ext->btn_id_pr]) >> 1); lv_coord_t pr_center = ext->button_areas[ext->btn_id_pr].x1 + (lv_area_get_width(&ext->button_areas[ext->btn_id_pr]) >> 1);
for(area_above = ext->btn_id_pr; area_above > 0; area_above --) { for(area_above = ext->btn_id_pr; area_above >= 0; area_above --) {
if(ext->button_areas[area_above].y1 < ext->button_areas[ext->btn_id_pr].y1 && if(ext->button_areas[area_above].y1 < ext->button_areas[ext->btn_id_pr].y1 &&
pr_center >= ext->button_areas[area_above].x1 - style->body.padding.hor && pr_center >= ext->button_areas[area_above].x1 - style->body.padding.hor &&
pr_center <= ext->button_areas[area_above].x2) pr_center <= ext->button_areas[area_above].x2)
@@ -622,7 +623,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
break; break;
} }
} }
ext->btn_id_pr = area_above; if(area_above >= 0) ext->btn_id_pr = area_above;
} }
lv_obj_invalidate(btnm); lv_obj_invalidate(btnm);

View File

@@ -135,7 +135,9 @@ void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en)
ext->ver_fit = ver_en == false ? 0 : 1; ext->ver_fit = ver_en == false ? 0 : 1;
/*Send a signal to set a new size*/ /*Send a signal to set a new size*/
cont->signal_func(cont, LV_SIGNAL_CORD_CHG, cont); lv_area_t area;
lv_obj_get_coords(cont, &area);
cont->signal_func(cont, LV_SIGNAL_CORD_CHG, &area);
} }
/*===================== /*=====================

View File

@@ -36,8 +36,8 @@ typedef struct
/*New data for this type */ /*New data for this type */
const void * src; /*Image source: Pointer to an array or a file or a symbol*/ const void * src; /*Image source: Pointer to an array or a file or a symbol*/
lv_coord_t w; /*Width of the image (doubled when upscaled) (Handled by the library)*/ lv_coord_t w; /*Width of the image (Handled by the library)*/
lv_coord_t h; /*Height of the image (doubled when upscaled) (Handled by the library)*/ lv_coord_t h; /*Height of the image (Handled by the library)*/
uint8_t src_type :2; /*See: lv_img_src_t*/ uint8_t src_type :2; /*See: lv_img_src_t*/
uint8_t auto_size :1; /*1: automatically set the object size to the image size*/ uint8_t auto_size :1; /*1: automatically set the object size to the image size*/
uint8_t chroma_keyed :1; /*1: Chroma keyed image, LV_COLOR_TRANSP (lv_conf.h) pixels will be transparent (Handled by the library)*/ uint8_t chroma_keyed :1; /*1: Chroma keyed image, LV_COLOR_TRANSP (lv_conf.h) pixels will be transparent (Handled by the library)*/
@@ -70,8 +70,8 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img);
/** /**
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0. * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0.
* Use 'lv_img_set_src()' instead. * Use 'lv_img_set_src()' instead.
* @param img * @param img -
* @param fn * @param fn -
*/ */
static inline void lv_img_set_file(lv_obj_t * img, const char * fn) static inline void lv_img_set_file(lv_obj_t * img, const char * fn)
{ {
@@ -98,8 +98,8 @@ static inline void lv_img_set_style(lv_obj_t *img, lv_style_t *style)
/** /**
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0 * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
* @param img * @param img -
* @param upscale * @param upscale -
*/ */
static inline void lv_img_set_upscale(lv_obj_t * img, bool upcale) static inline void lv_img_set_upscale(lv_obj_t * img, bool upcale)
{ {
@@ -147,7 +147,7 @@ static inline lv_style_t* lv_img_get_style(lv_obj_t *img)
/** /**
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0 * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
* @param img * @param img -
* @return false * @return false
*/ */
static inline bool lv_img_get_upscale(lv_obj_t * img) static inline bool lv_img_get_upscale(lv_obj_t * img)

View File

@@ -387,14 +387,18 @@ static lv_res_t lv_app_kb_action(lv_obj_t * kb, const char * txt)
return LV_RES_OK; return LV_RES_OK;
} }
else if(strcmp(txt, SYMBOL_CLOSE) == 0) { else if(strcmp(txt, SYMBOL_CLOSE) == 0) {
lv_kb_set_ta(kb, NULL); /*De-assign the text area*/
if(ext->hide_action) ext->hide_action(kb); if(ext->hide_action) ext->hide_action(kb);
else lv_obj_del(kb); else {
lv_kb_set_ta(kb, NULL); /*De-assign the text area to hide it cursor if needed*/
lv_obj_del(kb);
}
return LV_RES_INV; return LV_RES_INV;
} else if(strcmp(txt, SYMBOL_OK) == 0) { } else if(strcmp(txt, SYMBOL_OK) == 0) {
lv_kb_set_ta(kb, NULL); /*De-assign the text area*/
if(ext->ok_action) ext->ok_action(kb); if(ext->ok_action) ext->ok_action(kb);
else lv_obj_del(kb); else {
lv_kb_set_ta(kb, NULL); /*De-assign the text area to hide it cursor if needed*/
lv_obj_del(kb);
}
return LV_RES_INV; return LV_RES_INV;
} }

View File

@@ -255,6 +255,11 @@ static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param)
} }
buf->type[i] = "lv_line"; buf->type[i] = "lv_line";
} }
else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
lv_style_t * style = lv_line_get_style(line);
if(line->ext_size < style->line.width) line->ext_size = style->line.width;
}
return res; return res;
} }

View File

@@ -90,8 +90,8 @@ static inline void lv_line_set_style(lv_obj_t *line, lv_style_t *style)
/** /**
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0 * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
* @param line * @param line -
* @param upscale * @param upscale -
*/ */
static inline void lv_line_set_upscale(lv_obj_t * line, bool upcale) static inline void lv_line_set_upscale(lv_obj_t * line, bool upcale)
{ {
@@ -127,7 +127,7 @@ static inline lv_style_t* lv_line_get_style(lv_obj_t *line)
/** /**
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0 * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
* @param line * @param line -
* @return false * @return false
*/ */
static inline bool lv_line_get_upscale(lv_obj_t * line) static inline bool lv_line_get_upscale(lv_obj_t * line)

View File

@@ -80,7 +80,7 @@ void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt);
* Set the styles of a line meter * Set the styles of a line meter
* @param lmeter pointer to a line meter object * @param lmeter pointer to a line meter object
* @param bg set the style of the line meter * @param bg set the style of the line meter
* */ */
static inline void lv_lmeter_set_style(lv_obj_t *lmeter, lv_style_t *bg) static inline void lv_lmeter_set_style(lv_obj_t *lmeter, lv_style_t *bg)
{ {
lv_obj_set_style(lmeter, bg); lv_obj_set_style(lmeter, bg);

View File

@@ -348,6 +348,16 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
{ {
lv_res_t res; lv_res_t res;
/*Translate LV_GROUP_KEY_UP/DOWN to LV_GROUP_KEY_LEFT/RIGHT */
char c_trans = 0;
if(sign == LV_SIGNAL_CONTROLL) {
c_trans = *((char*)param);
if(c_trans == LV_GROUP_KEY_DOWN) c_trans = LV_GROUP_KEY_LEFT;
if(c_trans == LV_GROUP_KEY_UP) c_trans = LV_GROUP_KEY_RIGHT;
param = &c_trans;
}
/* Include the ancient signal function */ /* Include the ancient signal function */
res = ancestor_signal(mbox, sign, param); res = ancestor_signal(mbox, sign, param);
if(res != LV_RES_OK) return res; if(res != LV_RES_OK) return res;
@@ -356,7 +366,6 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
if(sign == LV_SIGNAL_CORD_CHG) { if(sign == LV_SIGNAL_CORD_CHG) {
if(lv_obj_get_width(mbox) != lv_area_get_width(param)) { if(lv_obj_get_width(mbox) != lv_area_get_width(param)) {
mbox_realign(mbox); mbox_realign(mbox);
} }
} }
else if(sign == LV_SIGNAL_STYLE_CHG) { else if(sign == LV_SIGNAL_STYLE_CHG) {

View File

@@ -166,7 +166,7 @@ static inline void lv_page_set_scrl_layout(lv_obj_t * page, lv_layout_t layout)
* @param page pointer to a page object * @param page pointer to a page object
* @param type which style should be set * @param type which style should be set
* @param style pointer to a style * @param style pointer to a style
* */ */
void lv_page_set_style(lv_obj_t *page, lv_page_style_t type, lv_style_t *style); void lv_page_set_style(lv_obj_t *page, lv_page_style_t type, lv_style_t *style);
/*===================== /*=====================
@@ -235,7 +235,7 @@ static inline bool lv_page_get_scrl_fit_ver(lv_obj_t * page)
* @param page pointer to page object * @param page pointer to page object
* @param type which style should be get * @param type which style should be get
* @return style pointer to a style * @return style pointer to a style
* */ */
lv_style_t * lv_page_get_style(lv_obj_t *page, lv_page_style_t type); lv_style_t * lv_page_get_style(lv_obj_t *page, lv_page_style_t type);
/*===================== /*=====================

View File

@@ -309,11 +309,11 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
if(slider_w >= slider_h) { if(slider_w >= slider_h) {
area_indic.x2 = (int32_t) ((int32_t)lv_area_get_width(&area_indic) * (cur_value - min_value)) / (max_value - min_value); area_indic.x2 = (int32_t) ((int32_t)lv_area_get_width(&area_indic) * (cur_value - min_value)) / (max_value - min_value);
area_indic.x2 += area_indic.x1; area_indic.x2 = area_indic.x1 + area_indic.x2 - 1;
} else { } else {
area_indic.y1 = (int32_t) ((int32_t)lv_area_get_height(&area_indic) * (cur_value - min_value)) / (max_value - min_value); area_indic.y1 = (int32_t) ((int32_t)lv_area_get_height(&area_indic) * (cur_value - min_value)) / (max_value - min_value);
area_indic.y1 = area_indic.y2 - area_indic.y1; area_indic.y1 = area_indic.y2 - area_indic.y1 + 1;
} }
if(cur_value != min_value) lv_draw_rect(&area_indic, mask, style_indic); if(cur_value != min_value) lv_draw_rect(&area_indic, mask, style_indic);

View File

@@ -1044,7 +1044,10 @@ static void pwd_char_hider(lv_obj_t * ta)
int16_t len = lv_txt_get_length(txt); int16_t len = lv_txt_get_length(txt);
bool refr = false; bool refr = false;
uint16_t i; uint16_t i;
for(i = 0; i < len; i++) txt[i] = '*'; for(i = 0; i < len; i++) {
txt[i] = '*';
refr = true;
}
txt[i] = '\0'; txt[i] = '\0';

View File

@@ -456,7 +456,7 @@ lv_theme_t * lv_theme_mono_init(uint16_t hue, lv_font_t *font)
* Get a pointer to the theme * Get a pointer to the theme
* @return pointer to the theme * @return pointer to the theme
*/ */
lv_theme_t * lv_theme_get_templ(void) lv_theme_t * lv_theme_get_mono(void)
{ {
return &theme; return &theme;
} }

1
lvgl.h
View File

@@ -57,6 +57,7 @@ extern "C" {
#define LVGL_VERSION_MAJOR 5 #define LVGL_VERSION_MAJOR 5
#define LVGL_VERSION_MINOR 2 #define LVGL_VERSION_MINOR 2
#define LVGL_VERSION_PATCH 0 #define LVGL_VERSION_PATCH 0
#define LVGL_VERSION_INFO "beta" #define LVGL_VERSION_INFO "beta"
/********************** /**********************