fix conflicts

This commit is contained in:
Gabor Kiss-Vamosi
2019-04-23 15:59:10 +02:00
53 changed files with 889 additions and 450 deletions

View File

@@ -169,6 +169,8 @@
#ifndef LV_USE_ANIMATION
#define LV_USE_ANIMATION 1
#endif
#if LV_USE_ANIMATION
#endif
/* 1: Enable shadow drawing*/
#ifndef LV_USE_SHADOW
@@ -225,6 +227,14 @@
#define LV_ATTRIBUTE_TASK_HANDLER
#endif
/* With size optimization (-Os) the compiler might not align data to
* 4 or 8 byte boundary. This alignment will be explicitly applied where needed.
* E.g. __attribute__((aligned(4))) */
#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif
/* 1: Variable length array is supported*/
#ifndef LV_COMPILER_VLA_SUPPORTED
#define LV_COMPILER_VLA_SUPPORTED 1
@@ -393,6 +403,15 @@
* Text settings
*=================*/
/* Select a character encoding for strings.
* Your IDE or editor should have the same character encoding
* - LV_TXT_ENC_UTF8
* - LV_TXT_ENC_ISO8859_1
* */
#ifndef LV_TXT_ENC
#define LV_TXT_ENC LV_TXT_ENC_UTF8
#endif
/*Can break (wrap) texts on these chars*/
#ifndef LV_TXT_BREAK_CHARS
#define LV_TXT_BREAK_CHARS " ,.;:-_"
@@ -545,6 +564,9 @@
#ifndef LV_LABEL_WAIT_CHAR_COUNT
# define LV_LABEL_WAIT_CHAR_COUNT 3 /* Waiting period at beginning/end of animation cycle */
#endif
#ifndef LV_LABEL_TEXT_SEL
# define LV_LABEL_TEXT_SEL 1 /*Enable selecting text of the label */
#endif
#endif
/*LED (dependencies: -)*/

View File

@@ -291,11 +291,11 @@ lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c)
/**
* Set a function for a group which will modify the object's style if it is in focus
* @param group pointer to a group
* @param style_mod_func the style modifier function pointer
* @param style_mod_cb the style modifier function pointer
*/
void lv_group_set_style_mod_cb(lv_group_t * group, lv_group_style_mod_func_t style_mod_func)
void lv_group_set_style_mod_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_cb)
{
group->style_mod = style_mod_func;
group->style_mod_cb = style_mod_cb;
if(group->obj_focus != NULL) lv_obj_invalidate(*group->obj_focus);
}
@@ -304,9 +304,9 @@ void lv_group_set_style_mod_cb(lv_group_t * group, lv_group_style_mod_func_t sty
* @param group pointer to a group
* @param style_mod_func the style modifier function pointer
*/
void lv_group_set_style_mod_edit_cb(lv_group_t * group, lv_group_style_mod_func_t style_mod_func)
void lv_group_set_style_mod_edit_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_edit_cb)
{
group->style_mod_edit = style_mod_func;
group->style_mod_edit_cb = style_mod_edit_cb;
if(group->obj_focus != NULL) lv_obj_invalidate(*group->obj_focus);
}
@@ -381,9 +381,9 @@ lv_style_t * lv_group_mod_style(lv_group_t * group, const lv_style_t * style)
lv_style_copy(&group->style_tmp, style);
if(group->editing) {
if(group->style_mod_edit) group->style_mod_edit(group, &group->style_tmp);
if(group->style_mod_edit_cb) group->style_mod_edit_cb(group, &group->style_tmp);
} else {
if(group->style_mod) group->style_mod(group, &group->style_tmp);
if(group->style_mod_cb) group->style_mod_cb(group, &group->style_tmp);
}
return &group->style_tmp;
}
@@ -418,10 +418,10 @@ lv_group_user_data_t * lv_group_get_user_data(lv_group_t * group)
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_func_t lv_group_get_style_mod_cb(const lv_group_t * group)
lv_group_style_mod_cb_t lv_group_get_style_mod_cb(const lv_group_t * group)
{
if(!group) return false;
return group->style_mod;
return group->style_mod_cb;
}
/**
@@ -429,10 +429,10 @@ lv_group_style_mod_func_t lv_group_get_style_mod_cb(const lv_group_t * group)
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_func_t lv_group_get_style_mod_edit_cb(const lv_group_t * group)
lv_group_style_mod_cb_t lv_group_get_style_mod_edit_cb(const lv_group_t * group)
{
if(!group) return false;
return group->style_mod_edit;
return group->style_mod_edit_cb;
}
/**
@@ -582,11 +582,11 @@ static void style_mod_edit_def(lv_group_t * group, lv_style_t * style)
static void refresh_theme(lv_group_t * g, lv_theme_t * th)
{
g->style_mod = style_mod_def;
g->style_mod_edit = style_mod_edit_def;
g->style_mod_cb = style_mod_def;
g->style_mod_edit_cb = style_mod_edit_def;
if(th) {
if(th->group.style_mod) g->style_mod = th->group.style_mod;
if(th->group.style_mod_edit) g->style_mod_edit = th->group.style_mod_edit;
if(th->group.style_mod_cb) g->style_mod_cb = th->group.style_mod_cb;
if(th->group.style_mod_edit_cb) g->style_mod_edit_cb = th->group.style_mod_edit_cb;
}
}

View File

@@ -45,17 +45,16 @@ extern "C" {
**********************/
struct _lv_group_t;
typedef void (*lv_group_style_mod_func_t)(struct _lv_group_t *, lv_style_t *);
typedef void (*lv_group_style_mod_cb_t)(struct _lv_group_t *, lv_style_t *);
typedef void (*lv_group_focus_cb_t)(struct _lv_group_t *);
typedef struct _lv_group_t
{
lv_ll_t obj_ll; /*Linked list to store the objects in the group */
lv_obj_t ** obj_focus; /*The object in focus*/
lv_group_style_mod_func_t
style_mod; /*A function which modifies the style of the focused object*/
lv_group_style_mod_func_t
style_mod_edit; /*A function which modifies the style of the focused object*/
lv_group_style_mod_cb_t style_mod_cb; /*A function to modifies the style of the focused object*/
lv_group_style_mod_cb_t style_mod_edit_cb; /*A function which modifies the style of the edited object*/
lv_group_focus_cb_t focus_cb; /*A function to call when a new object is focused (optional)*/
lv_style_t style_tmp; /*Stores the modified style of the focused object */
#if LV_USE_USER_DATA_SINGLE
@@ -152,16 +151,16 @@ lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c);
/**
* Set a function for a group which will modify the object's style if it is in focus
* @param group pointer to a group
* @param style_mod_func the style modifier function pointer
* @param style_mod_cb the style modifier function pointer
*/
void lv_group_set_style_mod_cb(lv_group_t * group, lv_group_style_mod_func_t style_mod_func);
void lv_group_set_style_mod_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_cb);
/**
* Set a function for a group which will modify the object's style if it is in focus in edit mode
* @param group pointer to a group
* @param style_mod_func the style modifier function pointer
* @param style_mod_edit_cb the style modifier function pointer
*/
void lv_group_set_style_mod_edit_cb(lv_group_t * group, lv_group_style_mod_func_t style_mod_func);
void lv_group_set_style_mod_edit_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_edit_cb);
/**
* Set a function for a group which will be called when a new object is focused
@@ -229,14 +228,14 @@ lv_group_user_data_t * lv_group_get_user_data(lv_group_t * group);
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_func_t lv_group_get_style_mod_cb(const lv_group_t * group);
lv_group_style_mod_cb_t lv_group_get_style_mod_cb(const lv_group_t * group);
/**
* Get a the style modifier function of a group in edit mode
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_func_t lv_group_get_style_mod_edit_cb(const lv_group_t * group);
lv_group_style_mod_cb_t lv_group_get_style_mod_edit_cb(const lv_group_t * group);
/**
* Get the focus callback function of a group

View File

@@ -219,16 +219,6 @@ void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points)
}
}
/**
* Set feedback callback for indev.
* @param indev pointer to an input device
* @param feedback feedback callback
*/
void lv_indev_set_feedback(lv_indev_t * indev, lv_indev_feedback_t feedback)
{
indev->feedback = feedback;
}
/**
* Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
* @param indev pointer to an input device
@@ -295,16 +285,6 @@ void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point)
}
}
/**
* Get feedback callback for indev.
* @param indev pointer to an input device
* @return feedback callback
*/
lv_indev_feedback_t lv_indev_get_feedback(const lv_indev_t * indev)
{
return indev->feedback;
}
/**
* Do nothing until the next release
* @param indev pointer to an input device

View File

@@ -97,13 +97,6 @@ void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group);
*/
void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points);
/**
* Set feedback callback for indev.
* @param indev pointer to an input device
* @param feedback feedback callback
*/
void lv_indev_set_feedback(lv_indev_t * indev, lv_indev_feedback_t feedback);
/**
* Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
* @param indev pointer to an input device
@@ -134,13 +127,6 @@ bool lv_indev_is_dragging(const lv_indev_t * indev);
*/
void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point);
/**
* Get feedback callback for indev.
* @param indev pointer to an input device
* @return feedback callback
*/
lv_indev_feedback_t lv_indev_get_feedback(const lv_indev_t * indev);
/**
* Do nothing until the next release
* @param indev pointer to an input device

View File

@@ -1259,11 +1259,11 @@ void lv_obj_clear_protect(lv_obj_t * obj, uint8_t prot)
* Set a an event handler function for an object.
* Used by the user to react on event which happens with the object.
* @param obj pointer to an object
* @param cb the new event function
* @param event_cb the new event function
*/
void lv_obj_set_event_cb(lv_obj_t * obj, lv_event_cb_t cb)
void lv_obj_set_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb)
{
obj->event_cb = cb;
obj->event_cb = event_cb;
}
/**
@@ -1322,9 +1322,9 @@ const void * lv_event_get_data(void)
* @param obj pointer to an object
* @param cb the new signal function
*/
void lv_obj_set_signal_cb(lv_obj_t * obj, lv_signal_cb_t cb)
void lv_obj_set_signal_cb(lv_obj_t * obj, lv_signal_cb_t signal_cb)
{
obj->signal_cb = cb;
obj->signal_cb = signal_cb;
}
/**
@@ -1340,11 +1340,11 @@ void lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param)
/**
* Set a new design function for an object
* @param obj pointer to an object
* @param cb the new design function
* @param design_cb the new design function
*/
void lv_obj_set_design_cb(lv_obj_t * obj, lv_design_cb_t cb)
void lv_obj_set_design_cb(lv_obj_t * obj, lv_design_cb_t design_cb)
{
obj->design_cb = cb;
obj->design_cb = design_cb;
}
/*----------------
@@ -1383,10 +1383,10 @@ void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj)
* @param type type of animation from 'lv_anim_builtin_t'. 'OR' it with ANIM_IN or ANIM_OUT
* @param time time of animation in milliseconds
* @param delay delay before the animation in milliseconds
* @param cb a function to call when the animation is ready
* @param ready_cb a function to call when the animation is ready
*/
void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t delay,
void (*cb)(lv_obj_t *))
lv_anim_ready_cb_t ready_cb)
{
lv_obj_t * par = lv_obj_get_parent(obj);
@@ -1398,8 +1398,8 @@ void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint1
a.var = obj;
a.time = time;
a.act_time = (int32_t)-delay;
a.end_cb = (void (*)(void *))cb;
a.path = lv_anim_path_linear;
a.ready_cb = ready_cb;
a.path_cb = lv_anim_path_linear;
a.playback_pause = 0;
a.repeat_pause = 0;
a.playback = 0;
@@ -1408,37 +1408,37 @@ void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint1
/*Init to ANIM_IN*/
switch(type) {
case LV_ANIM_FLOAT_LEFT:
a.fp = (void (*)(void *, int32_t))lv_obj_set_x;
a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_x;
a.start = -lv_obj_get_width(obj);
a.end = lv_obj_get_x(obj);
break;
case LV_ANIM_FLOAT_RIGHT:
a.fp = (void (*)(void *, int32_t))lv_obj_set_x;
a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_x;
a.start = lv_obj_get_width(par);
a.end = lv_obj_get_x(obj);
break;
case LV_ANIM_FLOAT_TOP:
a.fp = (void (*)(void *, int32_t))lv_obj_set_y;
a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_y;
a.start = -lv_obj_get_height(obj);
a.end = lv_obj_get_y(obj);
break;
case LV_ANIM_FLOAT_BOTTOM:
a.fp = (void (*)(void *, int32_t))lv_obj_set_y;
a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_y;
a.start = lv_obj_get_height(par);
a.end = lv_obj_get_y(obj);
break;
case LV_ANIM_GROW_H:
a.fp = (void (*)(void *, int32_t))lv_obj_set_width;
a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_width;
a.start = 0;
a.end = lv_obj_get_width(obj);
break;
case LV_ANIM_GROW_V:
a.fp = (void (*)(void *, int32_t))lv_obj_set_height;
a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_height;
a.start = 0;
a.end = lv_obj_get_height(obj);
break;
case LV_ANIM_NONE:
a.fp = NULL;
a.exec_cb = NULL;
a.start = 0;
a.end = 0;
break;
@@ -2091,7 +2091,9 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
lv_indev_t * indev_act = lv_indev_get_act();
if(sign > _LV_SIGNAL_FEEDBACK_SECTION_START && sign < _LV_SIGNAL_FEEDBACK_SECTION_END) {
if(indev_act != NULL && indev_act->feedback != NULL) indev_act->feedback(indev_act, sign);
if(indev_act != NULL) {
if(indev_act->driver.feedback_cb) indev_act->driver.feedback_cb(&indev_act->driver, sign);
}
}
if(sign == LV_SIGNAL_CHILD_CHG) {

View File

@@ -552,9 +552,9 @@ void lv_obj_clear_protect(lv_obj_t * obj, uint8_t prot);
* Set a an event handler function for an object.
* Used by the user to react on event which happens with the object.
* @param obj pointer to an object
* @param cb the new event function
* @param event_cb the new event function
*/
void lv_obj_set_event_cb(lv_obj_t * obj, lv_event_cb_t cb);
void lv_obj_set_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb);
/**
* Send an event to the object
@@ -575,9 +575,9 @@ const void * lv_event_get_data(void);
* Set the a signal function of an object. Used internally by the library.
* Always call the previous signal function in the new.
* @param obj pointer to an object
* @param cb the new signal function
* @param signal_cb the new signal function
*/
void lv_obj_set_signal_cb(lv_obj_t * obj, lv_signal_cb_t cb);
void lv_obj_set_signal_cb(lv_obj_t * obj, lv_signal_cb_t signal_cb);
/**
* Send an event to the object
@@ -589,9 +589,9 @@ void lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param);
/**
* Set a new design function for an object
* @param obj pointer to an object
* @param cb the new design function
* @param design_cb the new design function
*/
void lv_obj_set_design_cb(lv_obj_t * obj, lv_design_cb_t cb);
void lv_obj_set_design_cb(lv_obj_t * obj, lv_design_cb_t design_cb);
/*----------------
* Other set
@@ -612,16 +612,17 @@ void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size);
void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj);
#if LV_USE_ANIMATION
/**
* Animate an object
* @param obj pointer to an object to animate
* @param type type of animation from 'lv_anim_builtin_t'. 'OR' it with ANIM_IN or ANIM_OUT
* @param time time of animation in milliseconds
* @param delay delay before the animation in milliseconds
* @param cb a function to call when the animation is ready
* @param ready_cb a function to call when the animation is ready
*/
void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t delay,
void (*cb)(lv_obj_t *));
lv_anim_ready_cb_t ready_cb);
#endif
/*=======================

View File

@@ -33,7 +33,7 @@ typedef struct
will be modified too*/
lv_style_t style_end;
lv_style_t * style_anim;
void (*end_cb)(void *);
lv_anim_ready_cb_t ready_cb;
} lv_style_anim_dsc_t;
#endif
@@ -42,7 +42,7 @@ typedef struct
**********************/
#if LV_USE_ANIMATION
static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val);
static void style_animation_common_end_cb(void * ptr);
static void style_animation_common_end_cb(lv_anim_t * a);
#endif
/**********************
@@ -303,15 +303,15 @@ void * lv_style_anim_create(lv_style_anim_t * anim)
memcpy(&dsc->style_start, anim->style_start, sizeof(lv_style_t));
memcpy(&dsc->style_end, anim->style_end, sizeof(lv_style_t));
memcpy(dsc->style_anim, anim->style_start, sizeof(lv_style_t));
dsc->end_cb = anim->end_cb;
dsc->ready_cb = anim->ready_cb;
lv_anim_t a;
a.var = (void *)dsc;
a.start = 0;
a.end = STYLE_MIX_MAX;
a.fp = (lv_anim_fp_t)style_animator;
a.path = lv_anim_path_linear;
a.end_cb = style_animation_common_end_cb;
a.exec_cb = (lv_anim_exec_cb_t)style_animator;
a.path_cb = lv_anim_path_linear;
a.ready_cb = style_animation_common_end_cb;
a.act_time = anim->act_time;
a.time = anim->time;
a.playback = anim->playback;
@@ -348,13 +348,15 @@ static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val)
/**
* Called when a style animation is ready
* It called the user defined call back and free the allocated memories
* @param ptr the 'animated variable' set by lv_style_anim_create()
* @param a pointer to the animation
*/
static void style_animation_common_end_cb(void * ptr)
static void style_animation_common_end_cb(lv_anim_t * a)
{
lv_style_anim_dsc_t * dsc = ptr; /*To avoid casting*/
if(dsc->end_cb) dsc->end_cb(dsc);
(void) a; /*Unused*/
lv_style_anim_dsc_t * dsc = a->var; /*To avoid casting*/
if(dsc->ready_cb) dsc->ready_cb(a);
lv_mem_free(dsc);
}

View File

@@ -115,11 +115,19 @@ typedef struct
const lv_style_t * style_start; /*Pointer to the starting style*/
const lv_style_t * style_end; /*Pointer to the destination style*/
lv_style_t * style_anim; /*Pointer to a style to animate*/
lv_anim_cb_t end_cb; /*Call it when the animation is ready (NULL if unused)*/
lv_anim_ready_cb_t ready_cb; /*Call it when the animation is ready (NULL if unused)*/
int16_t time; /*Animation time in ms*/
int16_t act_time; /*Current time in animation. Set to negative to make delay.*/
uint16_t playback_pause; /*Wait before play back*/
uint16_t repeat_pause; /*Wait before repeat*/
#if LV_USE_USER_DATA_SINGLE
lv_anim_user_data_t user_data; /*Custom user data*/
#endif
#if LV_USE_USER_DATA_MULTI
lv_anim_user_data_t ready_user_data;
#endif
uint8_t playback : 1; /*When the animation is ready play it back*/
uint8_t repeat : 1; /*Repeat the animation infinitely*/
} lv_style_anim_t;
@@ -135,7 +143,8 @@ a.playback = 0;
a.playback_pause = 0;
a.repeat = 0;
a.repeat_pause = 0;
a.end_cb = NULL;
a.ready_cb = NULL;
a.user_data = NULL;
lv_style_anim_create(&a);
*/
#endif

View File

@@ -158,7 +158,7 @@ void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_
else if(opa == LV_OPA_COVER) {
/*Use hw fill if present*/
if(disp->driver.mem_fill_cb) {
disp->driver.mem_fill_cb(vdb->buf_act, &vdb->area, &vdb_rel_a, color);
disp->driver.mem_fill_cb(&disp->driver, vdb->buf_act, &vdb->area, &vdb_rel_a, color);
}
/*Use hw blend if present and the area is not too small*/
else if(lv_area_get_height(&vdb_rel_a) > VFILL_HW_ACC_SIZE_LIMIT &&
@@ -175,7 +175,7 @@ void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_
/*Blend the filled line to every line VDB line-by-line*/
lv_coord_t row;
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
disp->driver.mem_blend_cb(&vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
disp->driver.mem_blend_cb(&disp->driver, &vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
vdb_buf_tmp += vdb_width;
}
@@ -200,7 +200,7 @@ void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_
}
lv_coord_t row;
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
disp->driver.mem_blend_cb(&vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
disp->driver.mem_blend_cb(&disp->driver, &vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
vdb_buf_tmp += vdb_width;
}
@@ -441,7 +441,7 @@ void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint
if(disp->driver.mem_blend_cb == false) {
sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
} else {
disp->driver.mem_blend_cb(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
disp->driver.mem_blend_cb(&disp->driver, vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
}
#else
sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);

View File

@@ -236,7 +236,9 @@ static void line_draw_skew(line_draw_t * main_line, bool dir_ori, const lv_area_
lv_opa_t opa = opa_scale == LV_OPA_COVER
? style->line.opa
: (uint16_t)((uint16_t)style->line.opa * opa_scale) >> 8;
#if LV_ANTIALIAS
bool aa = lv_disp_get_antialiasing(lv_refr_get_disp_refreshing());
#endif
lv_point_t vect_main, vect_norm;
vect_main.x = main_line->p2.x - main_line->p1.x;
vect_main.y = main_line->p2.y - main_line->p1.y;

View File

@@ -92,10 +92,10 @@ typedef struct _disp_drv_t
#if LV_USE_GPU
/*OPTIONAL: Blend two memories using opacity (GPU only)*/
void (*mem_blend_cb)(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
void (*mem_blend_cb)(struct _disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
/*OPTIONAL: Fill a memory with a color (GPU only)*/
void (*mem_fill_cb)(lv_color_t * dest_buf, const lv_area_t * dest_area,
void (*mem_fill_cb)(struct _disp_drv_t * disp_drv, lv_color_t * dest_buf, const lv_area_t * dest_area,
const lv_area_t * fill_area, lv_color_t color);
#endif
@@ -105,6 +105,8 @@ typedef struct _disp_drv_t
#if LV_USE_USER_DATA_MULTI
lv_disp_drv_user_data_t flush_user_data;
lv_disp_drv_user_data_t mem_blend_user_data;
lv_disp_drv_user_data_t mem_fill_user_data;
lv_disp_drv_user_data_t rounder_user_data;
lv_disp_drv_user_data_t set_px_user_data;
lv_disp_drv_user_data_t monitor_user_data;

View File

@@ -54,6 +54,7 @@ typedef uint8_t lv_indev_type_t;
enum { LV_INDEV_STATE_REL = 0, LV_INDEV_STATE_PR };
typedef uint8_t lv_indev_state_t;
/*Data type when an input device is read */
typedef struct
{
@@ -73,18 +74,23 @@ typedef struct _lv_indev_drv_t
/*Input device type*/
lv_indev_type_t type;
/*Function pointer to read_cb data. Return 'true' if there is still data to be read_cb
* (buffered)*/
/*Function pointer to read input device data.
* Return 'true' if there is still data to be read (buffered)*/
bool (*read_cb)(struct _lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
#if LV_USE_USER_DATA_MULTI
lv_indev_drv_user_data_t read_user_data;
#endif
/*Called when an action happened on the input device.*/
void (*feedback_cb)(struct _lv_indev_drv_t *, uint8_t);
#if LV_USE_USER_DATA_SINGLE
lv_indev_drv_user_data_t user_data;
#endif
#if LV_USE_USER_DATA_MULTI
lv_indev_drv_user_data_t read_user_data;
lv_indev_drv_user_data_t feedback_user_data;
#endif
/*Pointer to the assigned display*/
struct _disp_t * disp;
@@ -143,8 +149,6 @@ typedef struct _lv_indev_proc_t
uint8_t wait_until_release : 1;
} lv_indev_proc_t;
typedef void (*lv_indev_feedback_t)(struct _lv_indev_t *, uint8_t);
struct _lv_obj_t;
struct _lv_group_t;
@@ -154,7 +158,6 @@ typedef struct _lv_indev_t
{
lv_indev_drv_t driver;
lv_indev_proc_t proc;
lv_indev_feedback_t feedback;
struct _lv_obj_t * cursor; /*Cursor for LV_INPUT_TYPE_POINTER*/
struct _lv_group_t * group; /*Keypad destination group*/
const lv_point_t * btn_points; /*Array points assigned to the button ()screen will be pressed

View File

@@ -68,8 +68,8 @@ void lv_anim_create(lv_anim_t * anim_p)
{
LV_LOG_TRACE("animation create started")
/* Do not let two animations for the same 'var' with the same 'fp'*/
if(anim_p->fp != NULL)
lv_anim_del(anim_p->var, anim_p->fp); /*fp == NULL would delete all animations of var*/
if(anim_p->exec_cb != NULL)
lv_anim_del(anim_p->var, anim_p->exec_cb); /*fp == NULL would delete all animations of var*/
/*Add the new animation to the animation linked list*/
lv_anim_t * new_anim = lv_ll_ins_head(&LV_GC_ROOT(_lv_anim_ll));
@@ -81,7 +81,7 @@ void lv_anim_create(lv_anim_t * anim_p)
memcpy(new_anim, anim_p, sizeof(lv_anim_t));
/*Set the start value*/
if(new_anim->fp != NULL) new_anim->fp(new_anim->var, new_anim->start);
if(new_anim->exec_cb != NULL) new_anim->exec_cb(new_anim->var, new_anim->start);
/* Creating an animation changed the linked list.
* It's important if it happens in a ready callback. (see `anim_task`)*/
@@ -97,7 +97,7 @@ void lv_anim_create(lv_anim_t * anim_p)
* or NULL to delete all animations of 'var'
* @return true: at least 1 animation is deleted, false: no animation is deleted
*/
bool lv_anim_del(void * var, lv_anim_fp_t fp)
bool lv_anim_del(void * var, lv_anim_exec_cb_t fp)
{
lv_anim_t * a;
lv_anim_t * a_next;
@@ -107,7 +107,7 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp)
/*'a' might be deleted, so get the next object while 'a' is valid*/
a_next = lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a);
if(a->var == var && (a->fp == fp || fp == NULL)) {
if(a->var == var && (a->exec_cb == fp || fp == NULL)) {
lv_ll_rem(&LV_GC_ROOT(_lv_anim_ll), a);
lv_mem_free(a);
anim_list_changed = true; /*Read by `anim_task`. It need to know if a delete occurred in
@@ -386,9 +386,9 @@ static void anim_task(void * param)
if(a->act_time > a->time) a->act_time = a->time;
int32_t new_value;
new_value = a->path(a);
new_value = a->path_cb(a);
if(a->fp != NULL) a->fp(a->var, new_value); /*Apply the calculated value*/
if(a->exec_cb != NULL) a->exec_cb(a->var, new_value); /*Apply the calculated value*/
/*If the time is elapsed the animation is ready*/
if(a->act_time >= a->time) {
@@ -422,16 +422,17 @@ static bool anim_ready_handler(lv_anim_t * a)
* - no repeat, play back is enabled and play back is ready */
if((a->repeat == 0 && a->playback == 0) ||
(a->repeat == 0 && a->playback == 1 && a->playback_now == 1)) {
void (*cb)(void *) = a->end_cb;
void * p = a->var;
/*Create copy from the animation and delete the animation from the list.
* This way the `ready_cb` will see the animations like it's animation is ready deleted*/
lv_anim_t a_tmp;
memcpy(&a_tmp, a, sizeof(lv_anim_t));
lv_ll_rem(&LV_GC_ROOT(_lv_anim_ll), a);
lv_mem_free(a);
anim_list_changed = true;
/* Call the callback function at the end*/
/* Check if an animation is deleted in the cb function
* if yes then the caller function has to know this*/
if(cb != NULL) cb(p);
if(a_tmp.ready_cb != NULL) a_tmp.ready_cb(&a_tmp);
}
/*If the animation is not deleted then restart it*/
else {

View File

@@ -34,23 +34,37 @@ extern "C" {
struct _lv_anim_t;
typedef int32_t (*lv_anim_path_t)(const struct _lv_anim_t *);
/*Generic prototype of "animator" functions*/
typedef void (*lv_anim_exec_cb_t)(void *, int32_t);
typedef void (*lv_anim_fp_t)(void *, int32_t);
typedef void (*lv_anim_cb_t)(void *);
/*Get the current value in an animation*/
typedef int32_t (*lv_anim_path_cb_t)(const struct _lv_anim_t *);
/*Callback for animation ready*/
typedef void (*lv_anim_ready_cb_t)(struct _lv_anim_t *);
typedef struct _lv_anim_t
{
void * var; /*Variable to animate*/
lv_anim_fp_t fp; /*Animator function*/
lv_anim_cb_t end_cb; /*Call it when the animation is ready*/
lv_anim_path_t path; /*An array with the steps of animations*/
lv_anim_exec_cb_t exec_cb; /*Function to execute to animate*/
lv_anim_path_cb_t path_cb; /*An array with the steps of animations*/
lv_anim_ready_cb_t ready_cb; /*Call it when the animation is ready*/
int32_t start; /*Start value*/
int32_t end; /*End value*/
uint16_t time; /*Animation time in ms*/
int16_t act_time; /*Current time in animation. Set to negative to make delay.*/
uint16_t playback_pause; /*Wait before play back*/
uint16_t repeat_pause; /*Wait before repeat*/
#if LV_USE_USER_DATA_SINGLE
lv_anim_user_data_t user_data; /*Custom user data*/
#endif
#if LV_USE_USER_DATA_MULTI
lv_anim_user_data_t exec_user_data;
lv_anim_user_data_t path_user_data;
lv_anim_user_data_t ready_user_data;
#endif
uint8_t playback : 1; /*When the animation is ready play it back*/
uint8_t repeat : 1; /*Repeat the animation infinitely*/
/*Animation system use these - user shouldn't set*/
@@ -63,15 +77,16 @@ lv_anim_t a;
a.var = obj;
a.start = lv_obj_get_height(obj);
a.end = new_height;
a.fp = (lv_anim_fp_t)lv_obj_set_height;
a.path = lv_anim_path_linear;
a.end_cb = NULL;
a.exec_cb = (lv_anim_fp_t)lv_obj_set_height;
a.path_cb = lv_anim_path_linear;
a.ready_cb = NULL;
a.act_time = 0;
a.time = 200;
a.playback = 0;
a.playback_pause = 0;
a.repeat = 0;
a.repeat_pause = 0;
a.user_data = NULL;
lv_anim_create(&a);
*/
/**********************
@@ -96,7 +111,7 @@ void lv_anim_create(lv_anim_t * anim_p);
* or NULL to ignore it and delete all animation with 'var
* @return true: at least 1 animation is deleted, false: no animation is deleted
*/
bool lv_anim_del(void * var, lv_anim_fp_t fp);
bool lv_anim_del(void * var, lv_anim_exec_cb_t fp);
/**
* Get the number of currently running animations
@@ -162,6 +177,7 @@ int32_t lv_anim_path_bounce(const lv_anim_t * a);
* @return the current value to set
*/
int32_t lv_anim_path_step(const lv_anim_t * a);
/**********************
* MACROS
**********************/

View File

@@ -6,7 +6,12 @@
/*********************
* INCLUDES
*********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#else
#include "../../../lv_conf.h"
#endif
#include "lv_area.h"
#include "lv_math.h"
@@ -154,29 +159,6 @@ bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p)
return is_on;
}
#if LV_USE_EXTENDED_CLICK_AREA_TINY
/**
* Check if a point is on an area
* @param a_p pointer to an area
* @param p_p pointer to a point
* @param ext_hor extended horizontal padding
* @param ext_ver extended horizontal padding
* @return false:the point is out of the area
*/
bool lv_area_ext_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, uint8_t ext_hor, uint8_t ext_ver)
{
bool is_on = false;
if(( (p_p->x + ext_hor) >= a_p->x1 && p_p->x <= (a_p->x2 + ext_hor) ) &&
( (p_p->y + ext_ver) >= a_p->y1 && p_p->y <= (a_p->y2 + ext_ver)) ) {
is_on = true;
}
return is_on;
}
#endif
/**
* Check if two area has common parts
* @param a1_p pointer to an area.

View File

@@ -145,18 +145,6 @@ void lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t *
*/
bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p);
#if LV_USE_EXTENDED_CLICK_AREA_TINY
/**
* Check if a point is on an area
* @param a_p pointer to an area
* @param p_p pointer to a point
* @param ext_hor extended horizontal padding
* @param ext_ver extended horizontal padding
* @return false:the point is out of the area
*/
bool lv_area_ext_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, uint8_t ext_hor, uint8_t ext_ver);
#endif
/**
* Check if two area has common parts
* @param a1_p pointer to an area.

View File

@@ -19,7 +19,7 @@
* DEFINES
*********************/
/*Add memory junk on alloc (0xaa) and free(0xbb) (just for testing purposes)*/
#define LV_MEM_ADD_JUNK 0
#define LV_MEM_ADD_JUNK 1
#ifdef LV_MEM_ENV64
#define MEM_UNIT uint64_t

View File

@@ -165,10 +165,10 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
* @param task a function which is the task itself
* @param period call period in ms unit
* @param prio priority of the task (LV_TASK_PRIO_OFF means the task is stopped)
* @param param free parameter
* @param user_data free parameter
* @return pointer to the new task
*/
lv_task_t * lv_task_create(void (*task)(void *), uint32_t period, lv_task_prio_t prio, void * param)
lv_task_t * lv_task_create(void (*task)(void *), uint32_t period, lv_task_prio_t prio, void * user_data)
{
lv_task_t * new_lv_task = NULL;
lv_task_t * tmp;
@@ -200,7 +200,7 @@ lv_task_t * lv_task_create(void (*task)(void *), uint32_t period, lv_task_prio_t
new_lv_task->period = period;
new_lv_task->task = task;
new_lv_task->prio = prio;
new_lv_task->param = param;
new_lv_task->param = user_data;
new_lv_task->once = 0;
new_lv_task->last_run = lv_tick_get();

View File

@@ -80,11 +80,11 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void);
* @param task a function which is the task itself
* @param period call period in ms unit
* @param prio priority of the task (LV_TASK_PRIO_OFF means the task is stopped)
* @param param free parameter
* @param user_data free parameter
* @return pointer to the new task
*/
lv_task_t * lv_task_create(void (*task)(void *), uint32_t period, lv_task_prio_t prio,
void * param);
void * user_data);
/**
* Delete a lv_task

View File

@@ -38,6 +38,7 @@
**********************/
static bool is_break_char(uint32_t letter);
#if LV_TXT_ENC == LV_TXT_ENC_UTF8
static uint8_t lv_txt_utf8_size(const char * str);
static uint32_t lv_txt_unicode_to_utf8(uint32_t letter_uni);
static uint32_t lv_txt_utf8_conv_wc(uint32_t c);
@@ -46,7 +47,16 @@ static uint32_t lv_txt_utf8_prev(const char * txt, uint32_t * i_start);
static uint32_t lv_txt_utf8_get_byte_id(const char * txt, uint32_t utf8_id);
static uint32_t lv_txt_utf8_get_char_id(const char * txt, uint32_t byte_id);
static uint32_t lv_txt_utf8_get_length(const char * txt);
#elif LV_TXT_ENC == LV_TXT_ENC_ISO8859_1
static uint8_t lv_txt_iso8859_1_size(const char * str);
static uint32_t lv_txt_unicode_to_iso8859_1(uint32_t letter_uni);
static uint32_t lv_txt_iso8859_1_conv_wc(uint32_t c);
static uint32_t lv_txt_iso8859_1_next(const char * txt, uint32_t * i);
static uint32_t lv_txt_iso8859_1_prev(const char * txt, uint32_t * i_start);
static uint32_t lv_txt_iso8859_1_get_byte_id(const char * txt, uint32_t utf8_id);
static uint32_t lv_txt_iso8859_1_get_char_id(const char * txt, uint32_t byte_id);
static uint32_t lv_txt_iso8859_1_get_length(const char * txt);
#endif
/**********************
* STATIC VARIABLES
**********************/
@@ -54,6 +64,7 @@ static uint32_t lv_txt_utf8_get_length(const char * txt);
/**********************
* GLOBAL VARIABLES
**********************/
#if LV_TXT_ENC == LV_TXT_ENC_UTF8
uint8_t (*lv_txt_encoded_size)(const char *) = lv_txt_utf8_size;
uint32_t (*lv_txt_unicode_to_encoded)(uint32_t) = lv_txt_unicode_to_utf8;
uint32_t (*lv_txt_encoded_conv_wc)(uint32_t) = lv_txt_utf8_conv_wc;
@@ -62,6 +73,17 @@ uint32_t (*lv_txt_encoded_prev)(const char *, uint32_t *) = lv_txt_utf8_pre
uint32_t (*lv_txt_encoded_get_byte_id)(const char *, uint32_t) = lv_txt_utf8_get_byte_id;
uint32_t (*lv_encoded_get_char_id)(const char *, uint32_t) = lv_txt_utf8_get_char_id;
uint32_t (*lv_txt_get_encoded_length)(const char *) = lv_txt_utf8_get_length;
#elif LV_TXT_ENC == LV_TXT_ENC_ISO8859_1
uint8_t (*lv_txt_encoded_size)(const char *) = lv_txt_iso8859_1_size;
uint32_t (*lv_txt_unicode_to_encoded)(uint32_t) = lv_txt_unicode_to_iso8859_1;
uint32_t (*lv_txt_encoded_conv_wc)(uint32_t) = lv_txt_iso8859_1_conv_wc;
uint32_t (*lv_txt_encoded_next)(const char *, uint32_t *) = lv_txt_iso8859_1_next;
uint32_t (*lv_txt_encoded_prev)(const char *, uint32_t *) = lv_txt_iso8859_1_prev;
uint32_t (*lv_txt_encoded_get_byte_id)(const char *, uint32_t) = lv_txt_iso8859_1_get_byte_id;
uint32_t (*lv_encoded_get_char_id)(const char *, uint32_t) = lv_txt_iso8859_1_get_char_id;
uint32_t (*lv_txt_get_encoded_length)(const char *) = lv_txt_iso8859_1_get_length;
#endif
/**********************
* MACROS
@@ -313,7 +335,7 @@ lv_coord_t lv_txt_get_width(const char * txt, uint16_t length, const lv_font_t *
lv_coord_t char_width = lv_font_get_width(font, letter);
if(char_width > 0) {
width += lv_font_get_width(font, letter);
width += char_width;
width += letter_space;
}
}
@@ -413,6 +435,7 @@ void lv_txt_cut(char * txt, uint32_t pos, uint32_t len)
}
}
#if LV_TXT_ENC == LV_TXT_ENC_UTF8
/*******************************
* UTF-8 ENCODER/DECOER
******************************/
@@ -654,6 +677,121 @@ static uint32_t lv_txt_utf8_get_length(const char * txt)
return len;
}
#elif LV_TXT_ENC == LV_TXT_ENC_ISO8859_1
/*******************************
* IOS8859-1 ENCODER/DECOER
******************************/
/**
* Give the size of an ISO8859-1 coded character
* @param str pointer to a character in a string
* @return length of the UTF-8 character (1,2,3 or 4). O on invalid code
*/
static uint8_t lv_txt_iso8859_1_size(const char * str)
{
(void) str; /*Unused*/
return 1;
}
/**
* Convert an Unicode letter to ISO8859-1.
* @param letter_uni an Unicode letter
* @return ISO8859-1 coded character in Little Endian to be compatible with C chars (e.g. 'Á', 'Ű')
*/
static uint32_t lv_txt_unicode_to_iso8859_1(uint32_t letter_uni)
{
if(letter_uni < 128) return letter_uni;
else return ' ';
}
/**
* Convert wide characters to ASCII, however wide characters in ASCII range (e.g. 'A') are ASCII compatible by default.
* So this function does nothing just returns with `c`.
* @param c a character, e.g. 'A'
* @return same as `c`
*/
static uint32_t lv_txt_iso8859_1_conv_wc(uint32_t c)
{
return c;
}
/**
* Decode an ISO8859-1 character from a string.
* @param txt pointer to '\0' terminated string
* @param i start byte index in 'txt' where to start.
* After call it will point to the next UTF-8 char in 'txt'.
* NULL to use txt[0] as index
* @return the decoded Unicode character or 0 on invalid UTF-8 code
*/
static uint32_t lv_txt_iso8859_1_next(const char * txt, uint32_t * i)
{
if(i == NULL) return txt[1]; /*Get the next char */
uint8_t letter = txt[*i] ;
(*i)++;
return letter;
}
/**
* Get previous ISO8859-1 character form a string.
* @param txt pointer to '\0' terminated string
* @param i start byte index in 'txt' where to start. After the call it will point to the previous UTF-8 char in 'txt'.
* @return the decoded Unicode character or 0 on invalid UTF-8 code
*/
static uint32_t lv_txt_iso8859_1_prev(const char * txt, uint32_t * i)
{
if(i == NULL) return *(txt - 1); /*Get the prev. char */
(*i)--;
uint8_t letter = txt[*i] ;
return letter;
}
/**
* Convert a character index (in an ISO8859-1 text) to byte index.
* E.g. in "AÁRT" index of 'R' is 2th char but start at byte 3 because 'Á' is 2 bytes long
* @param txt a '\0' terminated UTF-8 string
* @param utf8_id character index
* @return byte index of the 'utf8_id'th letter
*/
static uint32_t lv_txt_iso8859_1_get_byte_id(const char * txt, uint32_t utf8_id)
{
(void) txt; /*Unused*/
return utf8_id; /*In Non encoded no difference*/
}
/**
* Convert a byte index (in an ISO8859-1 text) to character index.
* E.g. in "AÁRT" index of 'R' is 2th char but start at byte 3 because 'Á' is 2 bytes long
* @param txt a '\0' terminated UTF-8 string
* @param byte_id byte index
* @return character index of the letter at 'byte_id'th position
*/
static uint32_t lv_txt_iso8859_1_get_char_id(const char * txt, uint32_t byte_id)
{
(void) txt; /*Unused*/
return byte_id; /*In Non encoded no difference*/
}
/**
* Get the number of characters (and NOT bytes) in a string. Decode it with UTF-8 if enabled.
* E.g.: "ÁBC" is 3 characters (but 4 bytes)
* @param txt a '\0' terminated char string
* @return number of characters
*/
static uint32_t lv_txt_iso8859_1_get_length(const char * txt)
{
return strlen(txt);
}
#else
#error "Invalid character encoding. See `LV_TXT_ENC` in `lv_conf.h`"
#endif
/**********************
* STATIC FUNCTIONS
**********************/

View File

@@ -29,6 +29,9 @@ extern "C" {
*********************/
#define LV_TXT_COLOR_CMD "#"
#define LV_TXT_ENC_UTF8 1
#define LV_TXT_ENC_ISO8859_1 2
/**********************
* TYPEDEFS
**********************/

View File

@@ -31,7 +31,7 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode
static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param);
static void lv_bar_animate(void * bar, int32_t value);
static void lv_bar_anim_ready(void * bar);
static void lv_bar_anim_ready(lv_anim_t * a);
/**********************
* STATIC VARIABLES
@@ -158,9 +158,9 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value, bool anim)
a.var = bar;
a.start = LV_BAR_ANIM_STATE_START;
a.end = LV_BAR_ANIM_STATE_END;
a.fp = (lv_anim_fp_t)lv_bar_animate;
a.path = lv_anim_path_linear;
a.end_cb = lv_bar_anim_ready;
a.exec_cb = (lv_anim_exec_cb_t)lv_bar_animate;
a.path_cb = lv_anim_path_linear;
a.ready_cb = lv_bar_anim_ready;
a.act_time = 0;
a.time = ext->anim_time;
a.playback = 0;
@@ -482,11 +482,11 @@ static void lv_bar_animate(void * bar, int32_t value)
lv_obj_invalidate(bar);
}
static void lv_bar_anim_ready(void * bar)
static void lv_bar_anim_ready(lv_anim_t * a)
{
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
lv_bar_ext_t * ext = lv_obj_get_ext_attr(a->var);
ext->anim_state = LV_BAR_ANIM_STATE_INV;
lv_bar_set_value(bar, ext->anim_end, false);
lv_bar_set_value(a->var, ext->anim_end, false);
}
#endif

View File

@@ -36,7 +36,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param);
#if LV_USE_ANIMATION && LV_BTN_INK_EFFECT
static void lv_btn_ink_effect_anim(lv_obj_t * btn, int32_t val);
static void lv_btn_ink_effect_anim_ready(void * p);
static void lv_btn_ink_effect_anim_ready(lv_anim_t * a);
#endif
/**********************
@@ -502,7 +502,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
#if LV_USE_ANIMATION && LV_BTN_INK_EFFECT
/*Forget the old inked button*/
if(ink_obj != NULL && ink_obj != btn) {
lv_anim_del(ink_obj, (lv_anim_fp_t)lv_btn_ink_effect_anim);
lv_anim_del(ink_obj, (lv_anim_exec_cb_t)lv_btn_ink_effect_anim);
lv_obj_invalidate(ink_obj);
ink_obj = NULL;
}
@@ -517,9 +517,9 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
a.var = btn;
a.start = 0;
a.end = LV_BTN_INK_VALUE_MAX;
a.fp = (lv_anim_fp_t)lv_btn_ink_effect_anim;
a.path = lv_anim_path_linear;
a.end_cb = lv_btn_ink_effect_anim_ready;
a.exec_cb = (lv_anim_exec_cb_t)lv_btn_ink_effect_anim;
a.path_cb = lv_anim_path_linear;
a.ready_cb = lv_btn_ink_effect_anim_ready;
a.act_time = 0;
a.time = ext->ink_in_time;
a.playback = 0;
@@ -586,9 +586,9 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
a.var = ink_obj;
a.start = LV_BTN_INK_VALUE_MAX;
a.end = 0;
a.fp = (lv_anim_fp_t)lv_btn_ink_effect_anim;
a.path = lv_anim_path_linear;
a.end_cb = lv_btn_ink_effect_anim_ready;
a.exec_cb = (lv_anim_exec_cb_t)lv_btn_ink_effect_anim;
a.path_cb = lv_anim_path_linear;
a.ready_cb = lv_btn_ink_effect_anim_ready;
a.act_time = 0;
a.time = ext->ink_out_time;
a.playback = 0;
@@ -624,7 +624,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
} else if(sign == LV_SIGNAL_CLEANUP) {
#if LV_USE_ANIMATION && LV_BTN_INK_EFFECT
if(btn == ink_obj) {
lv_anim_del(ink_obj, (lv_anim_fp_t)lv_btn_ink_effect_anim);
lv_anim_del(ink_obj, (lv_anim_exec_cb_t)lv_btn_ink_effect_anim);
ink_obj = NULL;
}
#endif
@@ -657,11 +657,11 @@ static void lv_btn_ink_effect_anim(lv_obj_t * btn, int32_t val)
/**
* Called to clean up when the ink animation is ready
* @param p unused
* @param a unused
*/
static void lv_btn_ink_effect_anim_ready(void * p)
static void lv_btn_ink_effect_anim_ready(lv_anim_t * a)
{
(void)p; /*Unused*/
(void) a; /*Unused*/
lv_btn_ext_t * ext = lv_obj_get_ext_attr(ink_obj);
lv_btn_state_t state = lv_btn_get_state(ink_obj);
@@ -675,9 +675,9 @@ static void lv_btn_ink_effect_anim_ready(void * p)
a.var = ink_obj;
a.start = LV_BTN_INK_VALUE_MAX;
a.end = 0;
a.fp = (lv_anim_fp_t)lv_btn_ink_effect_anim;
a.path = lv_anim_path_linear;
a.end_cb = lv_btn_ink_effect_anim_ready;
a.exec_cb = (lv_anim_exec_cb_t)lv_btn_ink_effect_anim;
a.path_cb = lv_anim_path_linear;
a.ready_cb = lv_btn_ink_effect_anim_ready;
a.act_time = -ext->ink_wait_time;
a.time = ext->ink_out_time;
a.playback = 0;

View File

@@ -44,7 +44,8 @@ static lv_res_t release_handler(lv_obj_t * ddlist);
static void lv_ddlist_refr_size(lv_obj_t * ddlist, bool anim_en);
static void lv_ddlist_pos_current_option(lv_obj_t * ddlist);
static void lv_ddlist_refr_width(lv_obj_t* ddlist);
static void lv_ddlist_anim_cb(lv_obj_t * ddlist);
static void lv_ddlist_anim_ready_cb(lv_anim_t * a);
static void lv_ddlist_anim_finish(lv_obj_t* ddlist);
static void lv_ddlist_adjust_height(lv_obj_t * ddlist, int32_t height);
/**********************
@@ -182,13 +183,13 @@ void lv_ddlist_set_options(lv_obj_t * ddlist, const char * options)
switch(lv_label_get_align(ext->label)) {
case LV_LABEL_ALIGN_LEFT:
lv_obj_align(ext->label, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_obj_align(ext->label, NULL, LV_ALIGN_IN_LEFT_MID, 0, 0);
break;
case LV_LABEL_ALIGN_CENTER:
lv_obj_align(ext->label, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
lv_obj_align(ext->label, NULL, LV_ALIGN_CENTER, 0, 0);
break;
case LV_LABEL_ALIGN_RIGHT:
lv_obj_align(ext->label, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
lv_obj_align(ext->label, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0);
break;
}
@@ -236,9 +237,9 @@ void lv_ddlist_set_fix_height(lv_obj_t * ddlist, lv_coord_t h)
* @param ddlist pointer to a drop down list
* @param fit fit mode from `lv_fit_t` (Typically `LV_FIT_NONE` or `LV_FIT_TIGHT`)
*/
void lv_ddlist_set_fit(lv_obj_t * ddlist, lv_fit_t fit)
void lv_ddlist_set_hor_fit(lv_obj_t * ddlist, lv_fit_t fit)
{
lv_cont_set_fit2(ddlist, fit, LV_FIT_NONE);
lv_cont_set_fit2(ddlist, fit, lv_cont_get_fit_bottom(ddlist));
lv_ddlist_refr_size(ddlist, false);
}
@@ -315,13 +316,13 @@ void lv_ddlist_set_align(lv_obj_t * ddlist, lv_label_align_t align)
lv_label_set_align(ext->label, align);
switch(align) {
case LV_LABEL_ALIGN_LEFT:
lv_obj_align(ext->label, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_obj_align(ext->label, NULL, LV_ALIGN_IN_LEFT_MID, 0, 0);
break;
case LV_LABEL_ALIGN_CENTER:
lv_obj_align(ext->label, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
lv_obj_align(ext->label, NULL, LV_ALIGN_CENTER, 0, 0);
break;
case LV_LABEL_ALIGN_RIGHT:
lv_obj_align(ext->label, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
lv_obj_align(ext->label, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0);
break;
}
@@ -851,14 +852,19 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, bool anim_en)
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
const lv_style_t * style = lv_obj_get_style(ddlist);
lv_coord_t new_height;
if(ext->opened) { /*Open the list*/
if(ext->fix_height == 0)
/*Open the list*/
if(ext->opened) {
if(ext->fix_height == 0) {
new_height = lv_obj_get_height(lv_page_get_scrl(ddlist)) + style->body.padding.top +
style->body.padding.bottom;
else
} else {
new_height = ext->fix_height;
}
} else { /*Close the list*/
}
/*Close the list*/
else {
const lv_font_t * font = style->text.font;
const lv_style_t * label_style = lv_obj_get_style(ext->label);
lv_coord_t font_h = lv_font_get_line_height(font);
@@ -872,17 +878,21 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, bool anim_en)
lv_ddlist_pos_current_option(ddlist);
if(ext->opened) lv_page_set_sb_mode(ddlist, LV_SB_MODE_UNHIDE);
#if LV_USE_ANIMATION
lv_anim_del(ddlist, (lv_anim_fp_t)lv_ddlist_adjust_height); /*If an animation is in progress then
lv_anim_del(ddlist, (lv_anim_exec_cb_t)lv_ddlist_adjust_height); /*If an animation is in progress then
it will overwrite this changes*/
lv_ddlist_anim_cb(ddlist); /*Force animation complete to fix highlight selection*/
/*Force animation complete to fix highlight selection*/
lv_ddlist_anim_finish(ddlist);
} else {
lv_anim_t a;
a.var = ddlist;
a.start = lv_obj_get_height(ddlist);
a.end = new_height;
a.fp = (lv_anim_fp_t)lv_ddlist_adjust_height;
a.path = lv_anim_path_linear;
a.end_cb = (lv_anim_cb_t)lv_ddlist_anim_cb;
a.exec_cb = (lv_anim_exec_cb_t)lv_ddlist_adjust_height;
a.path_cb = lv_anim_path_linear;
a.ready_cb = lv_ddlist_anim_ready_cb;
a.act_time = 0;
a.time = ext->anim_time;
a.playback = 0;
@@ -899,16 +909,24 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, bool anim_en)
/**
* Position the list and remove the selection highlight if it's closed.
* Called at end of list animation.
* @param ddlist pointer to a drop down list
* @param a pointer to the animation
*/
static void lv_ddlist_anim_cb(lv_obj_t * ddlist)
static void lv_ddlist_anim_ready_cb(lv_anim_t * a)
{
lv_obj_t * ddlist = a->var;
lv_ddlist_anim_finish(ddlist);
}
/**
* Clean up after the open animation
* @param ddlist
*/
static void lv_ddlist_anim_finish(lv_obj_t* ddlist)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
lv_ddlist_pos_current_option(ddlist);
ext->force_sel = 0; /*Turn off drawing of selection*/
if(ext->opened) lv_page_set_sb_mode(ddlist, LV_SB_MODE_UNHIDE);
}
@@ -952,10 +970,10 @@ static void lv_ddlist_pos_current_option(lv_obj_t * ddlist)
static void lv_ddlist_refr_width(lv_obj_t* ddlist)
{
/*Set the TIGHT fit horizontally the set the width to the content*/
lv_page_set_scrl_fit2(ddlist, LV_FIT_TIGHT, LV_FIT_TIGHT);
lv_page_set_scrl_fit2(ddlist, LV_FIT_TIGHT, lv_page_get_scrl_fit_bottom(ddlist));
/*Revert FILL fit to fill the parent with the options area. It allows to RIGHT/CENTER align the text*/
lv_page_set_scrl_fit2(ddlist, LV_FIT_FILL, LV_FIT_TIGHT);
lv_page_set_scrl_fit2(ddlist, LV_FIT_FILL, lv_page_get_scrl_fit_bottom(ddlist));
}
#endif

View File

@@ -109,7 +109,7 @@ void lv_ddlist_set_fix_height(lv_obj_t * ddlist, lv_coord_t h);
* @param ddlist pointer to a drop down list
* @param fit fit mode from `lv_fit_t` (Typically `LV_FIT_NONE` or `LV_FIT_TIGHT`)
*/
void lv_ddlist_set_fit(lv_obj_t * ddlist, lv_fit_t fit);
void lv_ddlist_set_hor_fit(lv_obj_t * ddlist, lv_fit_t fit);
/**
* Set arrow draw in a drop down list

View File

@@ -16,6 +16,7 @@
/*********************
* DEFINES
*********************/
#define LV_KB_CTRL_BTN_FLAGS (LV_BTNM_CTRL_NO_REPEAT | LV_BTNM_CTRL_CLICK_TRIG)
/**********************
* TYPEDEFS
@@ -37,10 +38,10 @@ static const char * kb_map_lc[] = {"1#", "q", "w", "e", "r", "t", "y", "u", "i",
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""};
static const lv_btnm_ctrl_t kb_ctrl_lc_map[] = {
5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7, (6 | LV_BTNM_CTRL_NO_REPEAT),
3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 6, 2,
2};
LV_KB_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
LV_KB_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 6, 2, 2};
static const char * kb_map_uc[] = {"1#", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "Bksp", "\n",
"abc", "A", "S", "D", "F", "G", "H", "J", "K", "L", "Enter", "\n",
@@ -48,10 +49,10 @@ static const char * kb_map_uc[] = {"1#", "Q", "W", "E", "R", "T", "Y", "U", "I",
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""};
static const lv_btnm_ctrl_t kb_ctrl_uc_map[] = {
5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7, (6 | LV_BTNM_CTRL_NO_REPEAT),
3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 6, 2,
2};
LV_KB_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
LV_KB_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 6, 2, 2};
static const char * kb_map_spec[] = {"0", "1", "2", "3", "4" ,"5", "6", "7", "8", "9", "Bksp", "\n",
"abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
@@ -59,17 +60,21 @@ static const char * kb_map_spec[] = {"0", "1", "2", "3", "4" ,"5", "6", "7", "8"
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""};
static const lv_btnm_ctrl_t kb_ctrl_spec_map[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, (2 | LV_BTNM_CTRL_NO_REPEAT),
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
2, 6, 2, 2};
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
LV_KB_CTRL_BTN_FLAGS | 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KB_CTRL_BTN_FLAGS | 2, LV_KB_CTRL_BTN_FLAGS | 2, 6, 2, 2};
static const char * kb_map_num[] = {"1", "2", "3", LV_SYMBOL_CLOSE, "\n",
"4", "5", "6", LV_SYMBOL_OK, "\n",
"7", "8", "9", "Bksp", "\n",
"+/-", "0", ".", LV_SYMBOL_LEFT, LV_SYMBOL_RIGHT, ""};
static const lv_btnm_ctrl_t kb_ctrl_num_map[] = {1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1};
static const lv_btnm_ctrl_t kb_ctrl_num_map[] = {
1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
LV_KB_CTRL_BTN_FLAGS | 1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 1, LV_KB_CTRL_BTN_FLAGS | 1};
/* clang-format on */
/**********************
@@ -317,7 +322,7 @@ const lv_style_t * lv_kb_get_style(const lv_obj_t * kb, lv_kb_style_t type)
*/
void lv_kb_def_event_cb(lv_obj_t * kb, lv_event_t event)
{
if(event != LV_EVENT_PRESSED && event != LV_EVENT_LONG_PRESSED_REPEAT) return;
if(event != LV_EVENT_SELECTED && event != LV_EVENT_LONG_PRESSED_REPEAT) return;
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
uint16_t btn_id = lv_btnm_get_active_btn(kb);

View File

@@ -97,7 +97,7 @@ lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
ext->txt_sel_start = LV_LABEL_TEXT_SEL_OFF;
ext->txt_sel_end = LV_LABEL_TEXT_SEL_OFF;
#endif
ext->dot_tmp_ptr = NULL;
ext->dot.tmp_ptr = NULL;
ext->dot_tmp_alloc = 0;
lv_obj_set_design_cb(new_label, lv_label_design);
@@ -130,12 +130,12 @@ lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
memcpy(ext->text, copy_ext->text, lv_mem_get_size(copy_ext->text));
}
if(copy_ext->dot_tmp_alloc && copy_ext->dot_tmp_ptr ){
int len = strlen(copy_ext->dot_tmp_ptr);
lv_label_set_dot_tmp(new_label, ext->dot_tmp_ptr, len);
if(copy_ext->dot_tmp_alloc && copy_ext->dot.tmp_ptr ){
int len = strlen(copy_ext->dot.tmp_ptr);
lv_label_set_dot_tmp(new_label, ext->dot.tmp_ptr, len);
}
else{
memcpy(ext->dot_tmp, copy_ext->dot_tmp, sizeof(ext->dot_tmp));
memcpy(ext->dot.tmp, copy_ext->dot.tmp, sizeof(ext->dot.tmp));
}
ext->dot_tmp_alloc = copy_ext->dot_tmp_alloc;
ext->dot_end = copy_ext->dot_end;
@@ -264,10 +264,10 @@ void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode)
#if LV_USE_ANIMATION
/*Delete the old animation (if exists)*/
lv_anim_del(label, (lv_anim_fp_t)lv_obj_set_x);
lv_anim_del(label, (lv_anim_fp_t)lv_obj_set_y);
lv_anim_del(label, (lv_anim_fp_t)lv_label_set_offset_x);
lv_anim_del(label, (lv_anim_fp_t)lv_label_set_offset_y);
lv_anim_del(label, (lv_anim_exec_cb_t)lv_obj_set_x);
lv_anim_del(label, (lv_anim_exec_cb_t)lv_obj_set_y);
lv_anim_del(label, (lv_anim_exec_cb_t)lv_label_set_offset_x);
lv_anim_del(label, (lv_anim_exec_cb_t)lv_label_set_offset_y);
#endif
ext->offset.x = 0;
ext->offset.y = 0;
@@ -948,8 +948,8 @@ static void lv_label_refr_text(lv_obj_t * label)
anim.repeat = 1;
anim.playback = 1;
anim.start = 0;
anim.end_cb = NULL;
anim.path = lv_anim_path_linear;
anim.ready_cb = NULL;
anim.path_cb = lv_anim_path_linear;
anim.playback_pause =
(((lv_font_get_width(style->text.font, ' ') + style->text.letter_space) * 1000) /
ext->anim_speed) * LV_LABEL_WAIT_CHAR_COUNT;
@@ -959,24 +959,25 @@ static void lv_label_refr_text(lv_obj_t * label)
bool hor_anim = false;
if(size.x > lv_obj_get_width(label)) {
anim.end = lv_obj_get_width(label) - size.x;
anim.fp = (lv_anim_fp_t)lv_label_set_offset_x;
anim.exec_cb = (lv_anim_exec_cb_t)lv_label_set_offset_x;
anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
lv_anim_create(&anim);
hor_anim = true;
} else {
/*Delete the offset animation if not required*/
lv_anim_del(label, (lv_anim_fp_t)lv_label_set_offset_x);
lv_anim_del(label, (lv_anim_exec_cb_t)lv_label_set_offset_x);
ext->offset.x = 0;
}
if(size.y > lv_obj_get_height(label) && hor_anim == false) {
anim.end = lv_obj_get_height(label) - size.y - (lv_font_get_line_height(font));
anim.fp = (lv_anim_fp_t)lv_label_set_offset_y;
anim.exec_cb = (lv_anim_exec_cb_t)lv_label_set_offset_y;
anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
lv_anim_create(&anim);
} else {
/*Delete the offset animation if not required*/
lv_anim_del(label, (lv_anim_fp_t)lv_label_set_offset_y);
lv_anim_del(label, (lv_anim_exec_cb_t)lv_label_set_offset_y);
ext->offset.y = 0;
}
#endif
@@ -992,32 +993,32 @@ static void lv_label_refr_text(lv_obj_t * label)
anim.act_time =
-(((lv_font_get_width(style->text.font, ' ') + style->text.letter_space) * 1000) /
ext->anim_speed) * LV_LABEL_WAIT_CHAR_COUNT;
anim.end_cb = NULL;
anim.path = lv_anim_path_linear;
anim.ready_cb = NULL;
anim.path_cb = lv_anim_path_linear;
anim.playback_pause = 0;
anim.repeat_pause = 0;
bool hor_anim = false;
if(size.x > lv_obj_get_width(label)) {
anim.end = -size.x - lv_font_get_width(font, ' ') * LV_LABEL_WAIT_CHAR_COUNT;
anim.fp = (lv_anim_fp_t)lv_label_set_offset_x;
anim.exec_cb = (lv_anim_exec_cb_t)lv_label_set_offset_x;
anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
lv_anim_create(&anim);
hor_anim = true;
} else {
/*Delete the offset animation if not required*/
lv_anim_del(label, (lv_anim_fp_t)lv_label_set_offset_x);
lv_anim_del(label, (lv_anim_exec_cb_t)lv_label_set_offset_x);
ext->offset.x = 0;
}
if(size.y > lv_obj_get_height(label) && hor_anim == false) {
anim.end = -size.y - (lv_font_get_line_height(font));
anim.fp = (lv_anim_fp_t)lv_label_set_offset_y;
anim.exec_cb = (lv_anim_exec_cb_t)lv_label_set_offset_y;
anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
lv_anim_create(&anim);
} else {
/*Delete the offset animation if not required*/
lv_anim_del(label, (lv_anim_fp_t)lv_label_set_offset_y);
lv_anim_del(label, (lv_anim_exec_cb_t)lv_label_set_offset_y);
ext->offset.y = 0;
}
#endif
@@ -1119,19 +1120,19 @@ static bool lv_label_set_dot_tmp(lv_obj_t *label, char *data, uint16_t len){
if( len > sizeof(char *) ){
/* Memory needs to be allocated. Allocates an additional byte
* for a NULL-terminator so it can be copied. */
ext->dot_tmp_ptr = lv_mem_alloc(len + 1);
if( ext->dot_tmp_ptr == NULL ){
ext->dot.tmp_ptr = lv_mem_alloc(len + 1);
if( ext->dot.tmp_ptr == NULL ){
LV_LOG_ERROR("Failed to allocate memory for dot_tmp_ptr");
return false;
}
memcpy(ext->dot_tmp_ptr, data, len);
ext->dot_tmp_ptr[len]='\0';
memcpy(ext->dot.tmp_ptr, data, len);
ext->dot.tmp_ptr[len]='\0';
ext->dot_tmp_alloc = true;
}
else {
/* Characters can be directly stored in object */
ext->dot_tmp_alloc = false;
memcpy(ext->dot_tmp, data, len);
memcpy(ext->dot.tmp, data, len);
}
return true;
}
@@ -1144,10 +1145,10 @@ static bool lv_label_set_dot_tmp(lv_obj_t *label, char *data, uint16_t len){
static char * lv_label_get_dot_tmp(lv_obj_t *label){
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if( ext->dot_tmp_alloc ){
return ext->dot_tmp_ptr;
return ext->dot.tmp_ptr;
}
else{
return ext->dot_tmp;
return ext->dot.tmp;
}
}
@@ -1158,11 +1159,11 @@ static char * lv_label_get_dot_tmp(lv_obj_t *label){
*/
static void lv_label_dot_tmp_free(lv_obj_t *label){
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if( ext->dot_tmp_alloc && ext->dot_tmp_ptr ){
lv_mem_free(ext->dot_tmp_ptr);
if( ext->dot_tmp_alloc && ext->dot.tmp_ptr ){
lv_mem_free(ext->dot.tmp_ptr);
}
ext->dot_tmp_alloc = false;
ext->dot_tmp_ptr = NULL;
ext->dot.tmp_ptr = NULL;
}
#endif

View File

@@ -64,9 +64,9 @@ typedef struct
/*New data for this type */
char * text; /*Text of the label*/
union{
char * dot_tmp_ptr; /* Pointer to the allocated memory containing the character which are replaced by dots (Handled by the library)*/
char dot_tmp[ sizeof(char *) ]; /* Directly store the characters if <=4 characters */
};
char * tmp_ptr; /* Pointer to the allocated memory containing the character which are replaced by dots (Handled by the library)*/
char tmp[ sizeof(char *) ]; /* Directly store the characters if <=4 characters */
} dot;
uint16_t dot_end; /*The text end position in dot mode (Handled by the library)*/
uint16_t anim_speed; /*Speed of scroll and roll animation in px/sec unit*/
lv_point_t offset; /*Text draw position offset*/

View File

@@ -627,9 +627,9 @@ void lv_list_up(const lv_obj_t * list)
a.var = scrl;
a.start = lv_obj_get_y(scrl);
a.end = new_y;
a.fp = (lv_anim_fp_t)lv_obj_set_y;
a.path = lv_anim_path_linear;
a.end_cb = NULL;
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
a.path_cb = lv_anim_path_linear;
a.ready_cb = NULL;
a.act_time = 0;
a.time = LV_LIST_DEF_ANIM_TIME;
a.playback = 0;
@@ -670,9 +670,9 @@ void lv_list_down(const lv_obj_t * list)
a.var = scrl;
a.start = lv_obj_get_y(scrl);
a.end = new_y;
a.fp = (lv_anim_fp_t)lv_obj_set_y;
a.path = lv_anim_path_linear;
a.end_cb = NULL;
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
a.path_cb = lv_anim_path_linear;
a.ready_cb = NULL;
a.act_time = 0;
a.time = LV_LIST_DEF_ANIM_TIME;
a.playback = 0;

View File

@@ -36,7 +36,7 @@
**********************/
static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param);
static void mbox_realign(lv_obj_t * mbox);
static void lv_mbox_close_end_cb(lv_obj_t * mbox);
static void lv_mbox_close_ready_cb(lv_anim_t * a);
static void lv_mbox_default_event_cb(lv_obj_t * mbox, lv_event_t event);
/**********************
@@ -204,12 +204,12 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay)
/*Add shrinking animations*/
lv_obj_animate(mbox, LV_ANIM_GROW_H | LV_ANIM_OUT, ext->anim_time, delay, NULL);
lv_obj_animate(mbox, LV_ANIM_GROW_V | LV_ANIM_OUT, ext->anim_time, delay,
lv_mbox_close_end_cb);
lv_mbox_close_ready_cb);
/*Disable fit to let shrinking work*/
lv_cont_set_fit(mbox, LV_FIT_NONE);
} else {
lv_obj_animate(mbox, LV_ANIM_NONE, ext->anim_time, delay, lv_mbox_close_end_cb);
lv_obj_animate(mbox, LV_ANIM_NONE, ext->anim_time, delay, lv_mbox_close_ready_cb);
}
#else
(void)delay; /*Unused*/
@@ -491,9 +491,9 @@ static void mbox_realign(lv_obj_t * mbox)
}
}
static void lv_mbox_close_end_cb(lv_obj_t * mbox)
static void lv_mbox_close_ready_cb(lv_anim_t * a)
{
lv_obj_del(mbox);
lv_obj_del(a->var);
}
static void lv_mbox_default_event_cb(lv_obj_t * mbox, lv_event_t event)

View File

@@ -41,7 +41,7 @@ static bool lv_scrl_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mo
static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param);
static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
static void edge_flash_anim(void * page, int32_t v);
static void edge_flash_anim_end(void * page);
static void edge_flash_anim_end(lv_anim_t * a);
static void scrl_def_event_cb(lv_obj_t * scrl, lv_event_t event);
/**********************
@@ -433,12 +433,12 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, uint16_t anim_time)
#else
/* Be sure there is no position changing animation in progress
* because it can overide the current changes*/
lv_anim_del(page, (lv_anim_fp_t)lv_obj_set_x);
lv_anim_del(page, (lv_anim_fp_t)lv_obj_set_y);
lv_anim_del(page, (lv_anim_fp_t)lv_obj_set_pos);
lv_anim_del(ext->scrl, (lv_anim_fp_t)lv_obj_set_x);
lv_anim_del(ext->scrl, (lv_anim_fp_t)lv_obj_set_y);
lv_anim_del(ext->scrl, (lv_anim_fp_t)lv_obj_set_pos);
lv_anim_del(page, (lv_anim_exec_cb_t)lv_obj_set_x);
lv_anim_del(page, (lv_anim_exec_cb_t)lv_obj_set_y);
lv_anim_del(page, (lv_anim_exec_cb_t)lv_obj_set_pos);
lv_anim_del(ext->scrl, (lv_anim_exec_cb_t)lv_obj_set_x);
lv_anim_del(ext->scrl, (lv_anim_exec_cb_t)lv_obj_set_y);
lv_anim_del(ext->scrl, (lv_anim_exec_cb_t)lv_obj_set_pos);
#endif
const lv_style_t * style = lv_page_get_style(page, LV_PAGE_STYLE_BG);
@@ -500,17 +500,17 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, uint16_t anim_time)
a.start = lv_obj_get_y(ext->scrl);
a.end = scrlable_y;
a.time = anim_time;
a.end_cb = NULL;
a.ready_cb = NULL;
a.playback = 0;
a.repeat = 0;
a.var = ext->scrl;
a.path = lv_anim_path_linear;
a.fp = (lv_anim_fp_t)lv_obj_set_y;
a.path_cb = lv_anim_path_linear;
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
lv_anim_create(&a);
a.start = lv_obj_get_x(ext->scrl);
a.end = scrlable_x;
a.fp = (lv_anim_fp_t)lv_obj_set_x;
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_x;
lv_anim_create(&a);
#endif
}
@@ -530,9 +530,9 @@ void lv_page_scroll_hor(lv_obj_t * page, lv_coord_t dist)
a.var = scrl;
a.start = lv_obj_get_x(scrl);
a.end = a.start + dist;
a.fp = (lv_anim_fp_t)lv_obj_set_x;
a.path = lv_anim_path_linear;
a.end_cb = NULL;
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_x;
a.path_cb = lv_anim_path_linear;
a.ready_cb = NULL;
a.act_time = 0;
a.time = LV_PAGE_SCROLL_ANIM_TIME;
a.playback = 0;
@@ -559,9 +559,9 @@ void lv_page_scroll_ver(lv_obj_t * page, lv_coord_t dist)
a.var = scrl;
a.start = lv_obj_get_y(scrl);
a.end = a.start + dist;
a.fp = (lv_anim_fp_t)lv_obj_set_y;
a.path = lv_anim_path_linear;
a.end_cb = NULL;
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
a.path_cb = lv_anim_path_linear;
a.ready_cb = NULL;
a.act_time = 0;
a.time = LV_PAGE_SCROLL_ANIM_TIME;
a.playback = 0;
@@ -588,9 +588,9 @@ void lv_page_start_edge_flash(lv_obj_t * page)
a.var = page;
a.start = 0;
a.end = LV_PAGE_END_FLASH_SIZE;
a.fp = (lv_anim_fp_t)edge_flash_anim;
a.path = lv_anim_path_linear;
a.end_cb = edge_flash_anim_end;
a.exec_cb = (lv_anim_exec_cb_t)edge_flash_anim;
a.path_cb = lv_anim_path_linear;
a.ready_cb = edge_flash_anim_end;
a.act_time = 0;
a.time = LV_PAGE_END_ANIM_TIME;
a.playback = 1;
@@ -768,11 +768,11 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
if(res != LV_RES_OK) return res;
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
lv_fit_t fit_left = lv_page_get_scrl_fit_left(page);
lv_fit_t fit_top = lv_page_get_scrl_fit_top(page);
const lv_style_t * style = lv_page_get_style(page, LV_PAGE_STYLE_SCRL);
lv_obj_t * child;
if(sign == LV_SIGNAL_CHILD_CHG) { /*Automatically move children to the scrollable object*/
const lv_style_t * style = lv_page_get_style(page, LV_PAGE_STYLE_SCRL);
lv_fit_t fit_left = lv_page_get_scrl_fit_left(page);
lv_fit_t fit_top = lv_page_get_scrl_fit_top(page);
child = lv_obj_get_child(page, NULL);
while(child != NULL) {
if(lv_obj_is_protected(child, LV_PROTECT_PARENT) == false) {
@@ -1201,14 +1201,14 @@ static void edge_flash_anim(void * page, int32_t v)
lv_obj_invalidate(page);
}
static void edge_flash_anim_end(void * page)
static void edge_flash_anim_end(lv_anim_t * a)
{
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
lv_page_ext_t * ext = lv_obj_get_ext_attr(a->var);
ext->edge_flash.top_ip = 0;
ext->edge_flash.bottom_ip = 0;
ext->edge_flash.left_ip = 0;
ext->edge_flash.right_ip = 0;
lv_obj_invalidate(page);
lv_obj_invalidate(a->var);
}
#endif

View File

@@ -189,9 +189,9 @@ void lv_preload_set_anim_type(lv_obj_t * preload, lv_preload_type_t type)
a.start = 0;
a.end = 360;
}
a.fp = (lv_anim_fp_t)lv_preload_spinner_anim;
a.path = lv_anim_path_ease_in_out;
a.end_cb = NULL;
a.exec_cb = (lv_anim_exec_cb_t)lv_preload_spinner_anim;
a.path_cb = lv_anim_path_ease_in_out;
a.ready_cb = NULL;
a.act_time = 0;
a.time = ext->time;
a.playback = 0;
@@ -211,9 +211,9 @@ void lv_preload_set_anim_type(lv_obj_t * preload, lv_preload_type_t type)
b.start = ext->arc_length;
b.end = 360 - ext->arc_length;
}
b.fp = (lv_anim_fp_t)lv_preload_set_arc_length;
b.path = lv_anim_path_ease_in_out;
b.end_cb = NULL;
b.exec_cb = (lv_anim_exec_cb_t)lv_preload_set_arc_length;
b.path_cb = lv_anim_path_ease_in_out;
b.ready_cb = NULL;
b.act_time = 0;
b.time = ext->time;
b.playback = 1;
@@ -237,9 +237,9 @@ void lv_preload_set_anim_type(lv_obj_t * preload, lv_preload_type_t type)
a.start = 0;
a.end = 360;
}
a.fp = (lv_anim_fp_t)lv_preload_spinner_anim;
a.path = lv_anim_path_ease_in_out;
a.end_cb = NULL;
a.exec_cb = (lv_anim_exec_cb_t)lv_preload_spinner_anim;
a.path_cb = lv_anim_path_ease_in_out;
a.ready_cb = NULL;
a.act_time = 0;
a.time = ext->time;
a.playback = 0;

View File

@@ -36,7 +36,9 @@ static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_desig
static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * param);
static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param);
static void refr_position(lv_obj_t * roller, bool anim_en);
static void refr_height(lv_obj_t * roller);
static void inf_normalize(void * roller_scrl);
static void scroll_anim_ready_cb(lv_anim_t * a);
static void draw_bg(lv_obj_t * roller, const lv_area_t * mask);
/**********************
@@ -86,8 +88,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy)
if(copy == NULL) {
lv_obj_t * scrl = lv_page_get_scrl(new_roller);
lv_obj_set_drag(scrl, true); /*In ddlist it might be disabled*/
lv_page_set_scrl_fit2(new_roller, LV_FIT_TIGHT,
LV_FIT_NONE); /*Height is specified directly*/
lv_page_set_scrl_fit2(new_roller, LV_FIT_TIGHT, LV_FIT_NONE); /*Height is specified directly*/
lv_ddlist_open(new_roller, false);
lv_ddlist_set_anim_time(new_roller, LV_ROLLER_DEF_ANIM_TIME);
lv_ddlist_set_stay_open(new_roller, true);
@@ -140,6 +141,11 @@ void lv_roller_set_options(lv_obj_t * roller, const char * options, bool inf)
if(inf == false) {
ext->inf = 0;
lv_ddlist_set_options(roller, options);
/* Make sure the roller's height and the scrollable's height is refreshed.
* They are refreshed in `LV_SIGNAL_COORD_CHG` but if the new options has the same width
* that signal won't be called. (It called because LV_FIT_TIGHT hor fit)*/
refr_height(roller);
} else {
ext->inf = 1;
@@ -154,9 +160,13 @@ void lv_roller_set_options(lv_obj_t * roller, const char * options, bool inf)
lv_ddlist_set_options(roller, opt_extra);
lv_mem_free(opt_extra);
/* Make sure the roller's height and the scrollable's height is refreshed.
* They are refreshed in `LV_SIGNAL_COORD_CHG` but if the new options has the same width
* that signal won't be called. (It called because LV_FIT_TIGHT hor fit)*/
refr_height(roller);
uint16_t real_id_cnt = ext->ddlist.option_cnt / LV_ROLLER_INF_PAGES;
ext->ddlist.sel_opt_id =
((LV_ROLLER_INF_PAGES / 2) + 1) * real_id_cnt; /*Select the middle page*/
lv_roller_set_selected(roller, ((LV_ROLLER_INF_PAGES / 2) + 1) * real_id_cnt, false); /*Select the middle page*/
}
}
@@ -386,21 +396,9 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
}
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
lv_align_t obj_align = LV_ALIGN_IN_LEFT_MID;
if(ext->ddlist.label) {
lv_label_align_t label_align = lv_label_get_align(ext->ddlist.label);
if(LV_LABEL_ALIGN_CENTER == label_align)
obj_align = LV_ALIGN_CENTER;
else if(LV_LABEL_ALIGN_RIGHT == label_align)
obj_align = LV_ALIGN_IN_RIGHT_MID;
}
if(sign == LV_SIGNAL_STYLE_CHG) {
lv_obj_set_height(lv_page_get_scrl(roller),
lv_obj_get_height(ext->ddlist.label) + lv_obj_get_height(roller));
lv_obj_align(ext->ddlist.label, NULL, obj_align, 0, 0);
lv_anim_del(lv_page_get_scrl(roller), (lv_anim_fp_t)lv_obj_set_y);
lv_ddlist_set_selected(roller, ext->ddlist.sel_opt_id);
refr_height(roller);
refr_position(roller, false);
} else if(sign == LV_SIGNAL_CORD_CHG) {
@@ -408,12 +406,8 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
if(lv_obj_get_width(roller) != lv_area_get_width(param) ||
lv_obj_get_height(roller) != lv_area_get_height(param)) {
lv_ddlist_set_fix_height(roller, lv_obj_get_height(roller));
lv_obj_set_height(lv_page_get_scrl(roller),
lv_obj_get_height(ext->ddlist.label) + lv_obj_get_height(roller));
lv_obj_align(ext->ddlist.label, NULL, obj_align, 0, 0);
lv_anim_del(lv_page_get_scrl(roller), (lv_anim_fp_t)lv_obj_set_y);
refr_height(roller);
lv_anim_del(lv_page_get_scrl(roller), (lv_anim_exec_cb_t)lv_obj_set_y);
lv_ddlist_set_selected(roller, ext->ddlist.sel_opt_id);
refr_position(roller, false);
}
@@ -632,9 +626,9 @@ static void refr_position(lv_obj_t * roller, bool anim_en)
a.var = roller_scrl;
a.start = lv_obj_get_y(roller_scrl);
a.end = new_y;
a.fp = (lv_anim_fp_t)lv_obj_set_y;
a.path = lv_anim_path_linear;
a.end_cb = inf_normalize;
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
a.path_cb = lv_anim_path_linear;
a.ready_cb = scroll_anim_ready_cb;
a.act_time = 0;
a.time = ext->ddlist.anim_time;
a.playback = 0;
@@ -646,6 +640,29 @@ static void refr_position(lv_obj_t * roller, bool anim_en)
}
}
/**
* Refresh the height of the roller and the scrolable
* @param roller pointer to roller
*/
static void refr_height(lv_obj_t * roller)
{
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
lv_align_t obj_align = LV_ALIGN_IN_LEFT_MID;
if(ext->ddlist.label) {
lv_label_align_t label_align = lv_label_get_align(ext->ddlist.label);
if(LV_LABEL_ALIGN_CENTER == label_align)
obj_align = LV_ALIGN_CENTER;
else if(LV_LABEL_ALIGN_RIGHT == label_align)
obj_align = LV_ALIGN_IN_RIGHT_MID;
}
lv_obj_set_height(lv_page_get_scrl(roller),
lv_obj_get_height(ext->ddlist.label) + lv_obj_get_height(roller));
lv_obj_align(ext->ddlist.label, NULL, obj_align, 0, 0);
lv_anim_del(lv_page_get_scrl(roller), (lv_anim_exec_cb_t)lv_obj_set_y);
lv_ddlist_set_selected(roller, ext->ddlist.sel_opt_id);
}
/**
* Set the middle page for the roller if inifinte is enabled
* @param scrl pointer to the roller's scrollable (lv_obj_t *)
@@ -677,4 +694,9 @@ static void inf_normalize(void * scrl)
}
}
static void scroll_anim_ready_cb(lv_anim_t * a)
{
inf_normalize(a->var);
}
#endif

View File

@@ -104,7 +104,7 @@ void lv_roller_set_visible_row_count(lv_obj_t * roller, uint8_t row_cnt);
*/
static inline void lv_roller_set_hor_fit(lv_obj_t * roller, lv_fit_t fit)
{
lv_ddlist_set_fit(roller, fit);
lv_ddlist_set_hor_fit(roller, fit);
}
/**

View File

@@ -38,9 +38,6 @@ extern "C" {
* TYPEDEFS
**********************/
/*callback on value change*/
typedef void (*lv_spinbox_value_changed_cb_t)(lv_obj_t * spinbox, int32_t new_value);
/*Data of spinbox*/
typedef struct
{

View File

@@ -163,17 +163,17 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy)
/*Create a cursor blinker animation*/
lv_anim_t a;
a.var = new_ta;
a.fp = (lv_anim_fp_t)cursor_blink_anim;
a.exec_cb = (lv_anim_exec_cb_t)cursor_blink_anim;
a.time = LV_TA_CURSOR_BLINK_TIME;
a.act_time = 0;
a.end_cb = NULL;
a.ready_cb = NULL;
a.start = 1;
a.end = 0;
a.repeat = 1;
a.repeat_pause = 0;
a.playback = 1;
a.playback_pause = 0;
a.path = lv_anim_path_step;
a.path_cb = lv_anim_path_step;
lv_anim_create(&a);
#endif
@@ -248,17 +248,17 @@ void lv_ta_add_char(lv_obj_t * ta, uint32_t c)
/*Auto hide characters*/
lv_anim_t a;
a.var = ta;
a.fp = (lv_anim_fp_t)pwd_char_hider_anim;
a.exec_cb = (lv_anim_exec_cb_t)pwd_char_hider_anim;
a.time = LV_TA_PWD_SHOW_TIME;
a.act_time = 0;
a.end_cb = (lv_anim_cb_t)pwd_char_hider;
a.ready_cb = (lv_anim_ready_cb_t)pwd_char_hider;
a.start = 0;
a.end = 1;
a.repeat = 0;
a.repeat_pause = 0;
a.playback = 0;
a.playback_pause = 0;
a.path = lv_anim_path_step;
a.path_cb = lv_anim_path_step;
lv_anim_create(&a);
#else
pwd_char_hider(ta);
@@ -328,17 +328,17 @@ void lv_ta_add_text(lv_obj_t * ta, const char * txt)
/*Auto hide characters*/
lv_anim_t a;
a.var = ta;
a.fp = (lv_anim_fp_t)pwd_char_hider_anim;
a.exec_cb = (lv_anim_exec_cb_t)pwd_char_hider_anim;
a.time = LV_TA_PWD_SHOW_TIME;
a.act_time = 0;
a.end_cb = (lv_anim_cb_t)pwd_char_hider;
a.ready_cb = (lv_anim_ready_cb_t)pwd_char_hider;
a.start = 0;
a.end = 1;
a.repeat = 0;
a.repeat_pause = 0;
a.playback = 0;
a.playback_pause = 0;
a.path = lv_anim_path_step;
a.path_cb = lv_anim_path_step;
lv_anim_create(&a);
#else
pwd_char_hider(ta);
@@ -468,17 +468,17 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt)
/*Auto hide characters*/
lv_anim_t a;
a.var = ta;
a.fp = (lv_anim_fp_t)pwd_char_hider_anim;
a.exec_cb = (lv_anim_exec_cb_t)pwd_char_hider_anim;
a.time = LV_TA_PWD_SHOW_TIME;
a.act_time = 0;
a.end_cb = (lv_anim_cb_t)pwd_char_hider;
a.ready_cb = (lv_anim_ready_cb_t)pwd_char_hider;
a.start = 0;
a.end = 1;
a.repeat = 0;
a.repeat_pause = 0;
a.playback = 0;
a.playback_pause = 0;
a.path = lv_anim_path_step;
a.path_cb = lv_anim_path_step;
lv_anim_create(&a);
#else
pwd_char_hider(ta);
@@ -574,17 +574,17 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
/*Reset cursor blink animation*/
lv_anim_t a;
a.var = ta;
a.fp = (lv_anim_fp_t)cursor_blink_anim;
a.exec_cb = (lv_anim_exec_cb_t)cursor_blink_anim;
a.time = LV_TA_CURSOR_BLINK_TIME;
a.act_time = 0;
a.end_cb = NULL;
a.ready_cb = NULL;
a.start = 1;
a.end = 0;
a.repeat = 1;
a.repeat_pause = 0;
a.playback = 1;
a.playback_pause = 0;
a.path = lv_anim_path_step;
a.path_cb = lv_anim_path_step;
lv_anim_create(&a);
#endif

View File

@@ -113,17 +113,18 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy)
lv_obj_set_size(new_tabview, lv_obj_get_width_fit(lv_obj_get_parent(new_tabview)),
lv_obj_get_height_fit(lv_obj_get_parent(new_tabview)));
ext->content = lv_cont_create(new_tabview, NULL);
ext->btns = lv_btnm_create(new_tabview, NULL);
ext->indic = lv_obj_create(ext->btns, NULL);
lv_obj_set_height(ext->btns, 3 * LV_DPI / 4);
lv_btnm_set_map(ext->btns, tab_def);
lv_obj_set_event_cb(ext->btns, tab_btnm_event_cb);
ext->indic = lv_obj_create(ext->btns, NULL);
lv_obj_set_width(ext->indic, LV_DPI);
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_obj_set_click(ext->indic, false);
ext->content = lv_cont_create(new_tabview, NULL);
lv_cont_set_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_NONE);
lv_cont_set_layout(ext->content, LV_LAYOUT_ROW_T);
lv_cont_set_style(ext->content, &lv_style_transp_tight);
@@ -232,12 +233,43 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
strcpy(name_dm, name);
ext->tab_cnt++;
ext->tab_name_ptr = lv_mem_realloc(ext->tab_name_ptr, sizeof(char *) * (ext->tab_cnt + 1));
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
case LV_TABVIEW_BTNS_POS_BOTTOM:
ext->tab_name_ptr = lv_mem_realloc(ext->tab_name_ptr, sizeof(char *) * (ext->tab_cnt + 1));
break;
case LV_TABVIEW_BTNS_POS_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT:
ext->tab_name_ptr = lv_mem_realloc(ext->tab_name_ptr, sizeof(char *) * (ext->tab_cnt * 2));
break;
}
lv_mem_assert(ext->tab_name_ptr);
if(ext->tab_name_ptr == NULL) return NULL;
ext->tab_name_ptr[ext->tab_cnt - 1] = name_dm;
ext->tab_name_ptr[ext->tab_cnt] = "";
/* FIXME: It is not possible yet to switch tab button position from/to top/bottom from/to left/right at runtime.
* Method: clean extra \n when switch from LV_TABVIEW_BTNS_POS_LEFT or LV_TABVIEW_BTNS_POS_RIGHT
* to LV_TABVIEW_BTNS_POS_TOP or LV_TABVIEW_BTNS_POS_BOTTOM.
*/
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
case LV_TABVIEW_BTNS_POS_BOTTOM:
ext->tab_name_ptr[ext->tab_cnt - 1] = name_dm;
ext->tab_name_ptr[ext->tab_cnt] = "";
break;
case LV_TABVIEW_BTNS_POS_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT:
if(ext->tab_cnt == 1) {
ext->tab_name_ptr[0] = name_dm;
ext->tab_name_ptr[1] = "";
} else {
ext->tab_name_ptr[ext->tab_cnt * 2 - 3] = "\n";
ext->tab_name_ptr[ext->tab_cnt * 2 - 2] = name_dm;
ext->tab_name_ptr[ext->tab_cnt * 2 - 1] = "";
}
break;
}
/* The button matrix's map still points to the old `tab_name_ptr` which might be freed by
* `lv_mem_realloc`. So make its current map invalid*/
@@ -249,21 +281,41 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
/*Modify the indicator size*/
const lv_style_t * style_tabs = lv_obj_get_style(ext->btns);
lv_coord_t indic_width =
(lv_obj_get_width(tabview) - style_tabs->body.padding.inner * (ext->tab_cnt - 1) -
style_tabs->body.padding.left - style_tabs->body.padding.right) /
ext->tab_cnt;
lv_obj_set_width(ext->indic, indic_width);
lv_obj_set_x(ext->indic, indic_width * ext->tab_cur +
style_tabs->body.padding.inner * ext->tab_cur +
style_tabs->body.padding.left);
lv_coord_t indic_size;
lv_coord_t max_h, btn_h, act_y;
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
case LV_TABVIEW_BTNS_POS_BOTTOM:
indic_size =
(lv_obj_get_width(tabview) - style_tabs->body.padding.inner * (ext->tab_cnt - 1) -
style_tabs->body.padding.left - style_tabs->body.padding.right) /
ext->tab_cnt;
lv_obj_set_width(ext->indic, indic_size);
lv_obj_set_x(ext->indic, indic_size * ext->tab_cur +
style_tabs->body.padding.inner * ext->tab_cur +
style_tabs->body.padding.left);
break;
case LV_TABVIEW_BTNS_POS_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT:
max_h = lv_obj_get_height(ext->btns) - style_tabs->body.padding.top - style_tabs->body.padding.bottom;
btn_h = max_h - ((ext->tab_cnt - 1) * style_tabs->body.padding.inner);
btn_h = btn_h / ext->tab_cnt;
btn_h--; /*-1 because e.g. height = 100 means 101 pixels (0..100)*/
act_y = style_tabs->body.padding.top + ext->tab_cur * (btn_h + style_tabs->body.padding.inner);
lv_obj_set_height(ext->indic, btn_h);
lv_obj_set_y(ext->indic, act_y);
break;
}
/*Set the first btn as active*/
if(ext->tab_cnt == 1) {
ext->tab_cur = 0;
tabview_realign(tabview); /*To set the proper btns height*/
}
tabview_realign(tabview); /*Set the size of the pages, tab buttons and indicator*/
lv_tabview_set_tab_act(tabview, ext->tab_cur, false);
return h;
@@ -298,8 +350,27 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
ext->tab_cur = id;
lv_coord_t cont_x = -(lv_obj_get_width(tabview) * id + style->body.padding.inner * id +
style->body.padding.left);
lv_coord_t cont_x;
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
case LV_TABVIEW_BTNS_POS_BOTTOM:
cont_x = -(lv_obj_get_width(tabview) * id + style->body.padding.inner * id +
style->body.padding.left);
break;
case LV_TABVIEW_BTNS_POS_LEFT:
cont_x = -((lv_obj_get_width(tabview) - lv_obj_get_width(ext->btns)) * id +
style->body.padding.inner * id +
style->body.padding.left) +
lv_obj_get_width(ext->btns);
break;
case LV_TABVIEW_BTNS_POS_RIGHT:
cont_x = -((lv_obj_get_width(tabview) - lv_obj_get_width(ext->btns)) * id +
style->body.padding.inner * id +
style->body.padding.left);
break;
}
if(ext->anim_time == 0 || anim_en == false) {
lv_obj_set_x(ext->content, cont_x);
} else {
@@ -308,9 +379,9 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
a.var = ext->content;
a.start = lv_obj_get_x(ext->content);
a.end = cont_x;
a.fp = (lv_anim_fp_t)lv_obj_set_x;
a.path = lv_anim_path_linear;
a.end_cb = NULL;
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_x;
a.path_cb = lv_anim_path_linear;
a.ready_cb = NULL;
a.act_time = 0;
a.time = ext->anim_time;
a.playback = 0;
@@ -322,22 +393,56 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
}
/*Move the indicator*/
lv_coord_t indic_width = lv_obj_get_width(ext->indic);
const lv_style_t * tabs_style = lv_obj_get_style(ext->btns);
lv_coord_t indic_x =
indic_width * id + tabs_style->body.padding.inner * id + tabs_style->body.padding.left;
lv_coord_t indic_size;
lv_coord_t indic_pos;
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
case LV_TABVIEW_BTNS_POS_BOTTOM:
indic_size = lv_obj_get_width(ext->indic);
indic_pos = indic_size * id + tabs_style->body.padding.inner * id + tabs_style->body.padding.left;
break;
case LV_TABVIEW_BTNS_POS_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT:
indic_size = lv_obj_get_height(ext->indic);
indic_pos = tabs_style->body.padding.top + id * (indic_size + tabs_style->body.padding.inner);
break;
}
if(ext->anim_time == 0 || anim_en == false) {
lv_obj_set_x(ext->indic, indic_x);
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
case LV_TABVIEW_BTNS_POS_BOTTOM:
lv_obj_set_x(ext->indic, indic_pos);
break;
case LV_TABVIEW_BTNS_POS_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT:
lv_obj_set_y(ext->indic, indic_pos);
break;
}
} else {
#if LV_USE_ANIMATION
lv_anim_t a;
a.var = ext->indic;
a.start = lv_obj_get_x(ext->indic);
a.end = indic_x;
a.fp = (lv_anim_fp_t)lv_obj_set_x;
a.path = lv_anim_path_linear;
a.end_cb = NULL;
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
case LV_TABVIEW_BTNS_POS_BOTTOM:
a.start = lv_obj_get_x(ext->indic);
a.end = indic_pos;
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_x;
break;
case LV_TABVIEW_BTNS_POS_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT:
a.start = lv_obj_get_y(ext->indic);
a.end = indic_pos;
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
break;
}
a.path_cb = lv_anim_path_linear;
a.ready_cb = NULL;
a.act_time = 0;
a.time = ext->anim_time;
a.playback = 0;
@@ -407,7 +512,18 @@ void lv_tabview_set_style(lv_obj_t * tabview, lv_tabview_style_t type, const lv_
break;
case LV_TABVIEW_STYLE_INDIC:
lv_obj_set_style(ext->indic, style);
lv_obj_set_height(ext->indic, style->body.padding.inner);
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
case LV_TABVIEW_BTNS_POS_BOTTOM:
lv_obj_set_height(ext->indic, style->body.padding.inner);
break;
case LV_TABVIEW_BTNS_POS_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT:
lv_obj_set_width(ext->indic, style->body.padding.inner);
break;
}
tabview_realign(tabview);
break;
}
@@ -765,16 +881,33 @@ static void tabpage_pressing_handler(lv_obj_t * tabview, lv_obj_t * tabpage)
ext->point_last.y = point_act.y;
/*Move the indicator*/
lv_coord_t indic_width = lv_obj_get_width(ext->indic);
const lv_style_t * tabs_style = lv_obj_get_style(ext->btns);
const lv_style_t * indic_style = lv_obj_get_style(ext->indic);
lv_coord_t p = ((tabpage->coords.x1 - tabview->coords.x1) *
(indic_width + tabs_style->body.padding.inner)) /
lv_obj_get_width(tabview);
lv_coord_t indic_size;
lv_coord_t p;
lv_coord_t indic_y;
const lv_style_t * indic_style;
lv_obj_set_x(ext->indic, indic_width * ext->tab_cur +
tabs_style->body.padding.inner * ext->tab_cur +
indic_style->body.padding.left - p);
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
case LV_TABVIEW_BTNS_POS_BOTTOM:
indic_size = lv_obj_get_width(ext->indic);
indic_style = lv_obj_get_style(ext->indic);
p = ((tabpage->coords.x1 - tabview->coords.x1) *
(indic_size + tabs_style->body.padding.inner)) /
lv_obj_get_width(tabview);
lv_obj_set_x(ext->indic, indic_size * ext->tab_cur +
tabs_style->body.padding.inner * ext->tab_cur +
indic_style->body.padding.left - p);
break;
case LV_TABVIEW_BTNS_POS_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT:
indic_size = lv_obj_get_height(ext->indic);
indic_y = tabs_style->body.padding.top +
ext->tab_cur * (indic_size + tabs_style->body.padding.inner);
lv_obj_set_y(ext->indic, indic_y);
break;
}
}
}
@@ -859,30 +992,114 @@ static void tabview_realign(lv_obj_t * tabview)
const lv_style_t * style_btn_bg = lv_tabview_get_style(tabview, LV_TABVIEW_STYLE_BTN_BG);
const lv_style_t * style_btn_rel = lv_tabview_get_style(tabview, LV_TABVIEW_STYLE_BTN_REL);
/*Set the indicator widths*/
lv_coord_t indic_width =
(lv_obj_get_width(tabview) - style_btn_bg->body.padding.inner * (ext->tab_cnt - 1) -
style_btn_bg->body.padding.left - style_btn_bg->body.padding.right) /
ext->tab_cnt;
lv_obj_set_width(ext->indic, indic_width);
/*Set the indicator width/height*/
lv_coord_t indic_size;
lv_coord_t max_h;
/*Set the tabs height*/
lv_coord_t btns_height = lv_font_get_line_height(style_btn_rel->text.font) +
style_btn_rel->body.padding.top +
style_btn_rel->body.padding.bottom +
style_btn_bg->body.padding.top + style_btn_bg->body.padding.bottom;
lv_obj_set_height(ext->btns, btns_height);
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
case LV_TABVIEW_BTNS_POS_BOTTOM:
indic_size =
(lv_obj_get_width(tabview) - style_btn_bg->body.padding.inner * (ext->tab_cnt - 1) -
style_btn_bg->body.padding.left - style_btn_bg->body.padding.right) /
ext->tab_cnt;
lv_obj_set_width(ext->indic, indic_size);
break;
case LV_TABVIEW_BTNS_POS_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT:
lv_obj_set_height(ext->btns, lv_obj_get_height(tabview));
lv_obj_set_height(ext->content, lv_obj_get_height(tabview) - lv_obj_get_height(ext->btns));
max_h = lv_obj_get_height(ext->btns) - style_btn_bg->body.padding.top - style_btn_bg->body.padding.bottom;
indic_size = max_h - ((ext->tab_cnt - 1) * style_btn_bg->body.padding.inner);
indic_size = indic_size / ext->tab_cnt;
indic_size--; /*-1 because e.g. height = 100 means 101 pixels (0..100)*/
lv_obj_set_height(ext->indic, indic_size);
break;
}
/*Set the tabs height/width*/
lv_coord_t btns_size;
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
case LV_TABVIEW_BTNS_POS_BOTTOM:
btns_size = lv_font_get_height(style_btn_rel->text.font) +
style_btn_rel->body.padding.top +
style_btn_rel->body.padding.bottom +
style_btn_bg->body.padding.top + style_btn_bg->body.padding.bottom;
lv_obj_set_height(ext->btns, btns_size);
break;
case LV_TABVIEW_BTNS_POS_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT:
btns_size = lv_font_get_width(style_btn_rel->text.font, 0x0041) + // 'A'
style_btn_rel->body.padding.left +
style_btn_rel->body.padding.right +
style_btn_bg->body.padding.left + style_btn_bg->body.padding.right;
lv_obj_set_width(ext->btns, btns_size);
break;
}
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
case LV_TABVIEW_BTNS_POS_BOTTOM:
lv_obj_set_height(ext->content, lv_obj_get_height(tabview) - lv_obj_get_height(ext->btns));
break;
case LV_TABVIEW_BTNS_POS_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT:
lv_obj_set_height(ext->content, lv_obj_get_height(tabview));
break;
}
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
lv_obj_align(ext->btns, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_obj_align(ext->content, ext->btns, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_cont_set_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_NONE);
lv_cont_set_layout(ext->content, LV_LAYOUT_ROW_T);
lv_obj_set_height(ext->content,
lv_obj_get_height(tabview) - lv_obj_get_height(ext->btns));
// lv_obj_set_height(ext->btns, 3 * LV_DPI / 4);
// lv_obj_set_width(ext->indic, LV_DPI);
break;
case LV_TABVIEW_BTNS_POS_BOTTOM:
lv_obj_align(ext->content, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_obj_align(ext->btns, ext->content, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_cont_set_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_NONE);
lv_cont_set_layout(ext->content, LV_LAYOUT_ROW_T);
lv_obj_set_height(ext->content,
lv_obj_get_height(tabview) - lv_obj_get_height(ext->btns));
break;
case LV_TABVIEW_BTNS_POS_LEFT:
lv_obj_align(ext->btns, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_obj_align(ext->content, tabview, LV_ALIGN_IN_TOP_LEFT, lv_obj_get_width(ext->btns), 0);
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
lv_cont_set_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_NONE);
lv_cont_set_layout(ext->content, LV_LAYOUT_ROW_T);
lv_obj_set_width(ext->content,
lv_obj_get_width(tabview) - lv_obj_get_width(ext->btns));
lv_obj_set_height(ext->btns, lv_obj_get_height(tabview));
lv_obj_set_width(ext->indic, style_btn_bg->body.padding.inner);
break;
case LV_TABVIEW_BTNS_POS_RIGHT:
lv_obj_align(ext->btns, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
lv_obj_align(ext->content, tabview, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_cont_set_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_NONE);
lv_cont_set_layout(ext->content, LV_LAYOUT_ROW_T);
lv_obj_set_width(ext->content,
lv_obj_get_width(tabview) - lv_obj_get_width(ext->btns));
lv_obj_set_height(ext->btns, lv_obj_get_height(tabview));
lv_obj_set_width(ext->indic, style_btn_bg->body.padding.inner);
break;
}
}
@@ -891,13 +1108,43 @@ static void tabview_realign(lv_obj_t * tabview)
while(pages != NULL) {
if(lv_obj_get_signal_cb(pages) ==
tabpage_signal) { /*Be sure adjust only the pages (user can other things)*/
lv_obj_set_size(pages, lv_obj_get_width(tabview), lv_obj_get_height(ext->content));
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
case LV_TABVIEW_BTNS_POS_BOTTOM:
lv_obj_set_size(
pages,
lv_obj_get_width(tabview),
lv_obj_get_height(ext->content)
);
break;
case LV_TABVIEW_BTNS_POS_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT:
lv_obj_set_size(
pages,
lv_obj_get_width(tabview) - lv_obj_get_width(ext->btns),
lv_obj_get_height(ext->content)
);
break;
}
}
pages = lv_obj_get_child(ext->content, pages);
}
if(!ext->btns_hide) {
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
switch(ext->btns_pos) {
case LV_TABVIEW_BTNS_POS_TOP:
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
break;
case LV_TABVIEW_BTNS_POS_BOTTOM:
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_LEFT, 0, 0);
break;
case LV_TABVIEW_BTNS_POS_LEFT:
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
break;
case LV_TABVIEW_BTNS_POS_RIGHT:
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_LEFT, 0, 0);
break;
}
}
lv_tabview_set_tab_act(tabview, ext->tab_cur, false);

View File

@@ -45,6 +45,8 @@ extern "C" {
enum {
LV_TABVIEW_BTNS_POS_TOP,
LV_TABVIEW_BTNS_POS_BOTTOM,
LV_TABVIEW_BTNS_POS_LEFT,
LV_TABVIEW_BTNS_POS_RIGHT
};
typedef uint8_t lv_tabview_btns_pos_t;
@@ -66,7 +68,7 @@ typedef struct
uint8_t drag_hor : 1;
uint8_t scroll_ver : 1;
uint8_t btns_hide : 1;
lv_tabview_btns_pos_t btns_pos : 1;
lv_tabview_btns_pos_t btns_pos : 2;
} lv_tabview_ext_t;
enum {

View File

@@ -211,9 +211,9 @@ void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, b
lv_anim_t a;
a.var = scrl;
a.fp = (lv_anim_fp_t)lv_obj_set_x;
a.path = lv_anim_path_linear;
a.end_cb = NULL;
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_x;
a.path_cb = lv_anim_path_linear;
a.ready_cb = NULL;
a.act_time = 0;
a.time = ext->anim_time;
a.playback = 0;
@@ -230,7 +230,7 @@ void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, b
if(y_coord != y_act) {
a.start = y_act;
a.end = y_coord;
a.fp = (lv_anim_fp_t)lv_obj_set_y;
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
lv_anim_create(&a);
}
#endif

View File

@@ -31,10 +31,6 @@ extern "C" {
* TYPEDEFS
**********************/
/* parametes: pointer to a tileview object, x, y (tile coordinates to load)
* return: LV_RES_INV: to prevent the loading of the tab; LV_RES_OK: if everything is fine*/
typedef lv_res_t (*lv_tileview_action_t)(lv_obj_t *, lv_coord_t, lv_coord_t);
/*Data of tileview*/
typedef struct
{

View File

@@ -64,7 +64,6 @@ lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy)
ext->page = NULL;
ext->header = NULL;
ext->title = NULL;
ext->style_header = &lv_style_plain_color;
ext->style_btn_rel = &lv_style_btn_rel;
ext->style_btn_pr = &lv_style_btn_pr;
ext->btn_size = (LV_DPI) / 2;
@@ -538,7 +537,8 @@ static void lv_win_realign(lv_obj_t * win)
btn = lv_obj_get_child_back(ext->header, btn);
}
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.left, 0);
const lv_style_t * style_header = lv_win_get_style(win, LV_WIN_STYLE_HEADER);
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, style_header->body.padding.left, 0);
lv_obj_set_pos(ext->header, 0, 0);

View File

@@ -61,7 +61,6 @@ typedef struct
lv_obj_t * page; /*Pointer to a page which holds the content*/
lv_obj_t * header; /*Pointer to the header container of the window*/
lv_obj_t * title; /*Pointer to the title label of the window*/
const lv_style_t * style_header; /*Style of the header container*/
const lv_style_t * style_btn_rel; /*Control button releases style*/
const lv_style_t * style_btn_pr; /*Control button pressed style*/
lv_coord_t btn_size; /*Size of the control buttons (square)*/

View File

@@ -328,8 +328,8 @@ typedef struct
#if LV_USE_GROUP
struct
{
lv_group_style_mod_func_t style_mod;
lv_group_style_mod_func_t style_mod_edit;
lv_group_style_mod_cb_t style_mod_cb;
lv_group_style_mod_cb_t style_mod_edit_cb;
} group;
#endif
} lv_theme_t;

View File

@@ -929,8 +929,8 @@ lv_theme_t * lv_theme_alien_init(uint16_t hue, lv_font_t * font)
win_init();
#if LV_USE_GROUP
theme.group.style_mod = style_mod;
theme.group.style_mod_edit = style_mod_edit;
theme.group.style_mod_cb = style_mod;
theme.group.style_mod_edit_cb = style_mod_edit;
#endif
return &theme;

View File

@@ -450,8 +450,8 @@ lv_theme_t * lv_theme_default_init(uint16_t hue, lv_font_t * font)
win_init();
#if LV_USE_GROUP
theme.group.style_mod = style_mod;
theme.group.style_mod_edit = style_mod_edit;
theme.group.style_mod_cb = style_mod;
theme.group.style_mod_edit_cb = style_mod_edit;
#endif
return &theme;

View File

@@ -908,8 +908,8 @@ lv_theme_t * lv_theme_material_init(uint16_t hue, lv_font_t * font)
win_init();
#if LV_USE_GROUP
theme.group.style_mod = style_mod;
theme.group.style_mod_edit = style_mod_edit;
theme.group.style_mod_cb = style_mod;
theme.group.style_mod_edit_cb = style_mod_edit;
#endif
return &theme;

View File

@@ -497,8 +497,8 @@ lv_theme_t * lv_theme_mono_init(uint16_t hue, lv_font_t * font)
win_init();
#if LV_USE_GROUP
theme.group.style_mod = style_mod;
theme.group.style_mod_edit = style_mod_edit;
theme.group.style_mod_cb = style_mod;
theme.group.style_mod_edit_cb = style_mod_edit;
#endif
return &theme;

View File

@@ -901,8 +901,8 @@ lv_theme_t * lv_theme_nemo_init(uint16_t hue, lv_font_t * font)
win_init();
#if LV_USE_GROUP
theme.group.style_mod = style_mod;
theme.group.style_mod_edit = style_mod_edit;
theme.group.style_mod_cb = style_mod;
theme.group.style_mod_edit_cb = style_mod_edit;
#endif
return &theme;

View File

@@ -818,8 +818,8 @@ lv_theme_t * lv_theme_night_init(uint16_t hue, lv_font_t * font)
win_init();
#if LV_USE_GROUP
theme.group.style_mod = style_mod;
theme.group.style_mod_edit = style_mod_edit;
theme.group.style_mod_cb = style_mod;
theme.group.style_mod_edit_cb = style_mod_edit;
#endif
return &theme;

View File

@@ -450,8 +450,8 @@ lv_theme_t * lv_theme_templ_init(uint16_t hue, lv_font_t * font)
win_init();
#if LV_USE_GROUP
theme.group.style_mod = style_mod;
theme.group.style_mod_edit = style_mod_edit;
theme.group.style_mod_cb = style_mod;
theme.group.style_mod_edit_cb = style_mod_edit;
#endif
return &theme;

View File

@@ -874,8 +874,8 @@ lv_theme_t * lv_theme_zen_init(uint16_t hue, lv_font_t * font)
win_init();
#if LV_USE_GROUP
theme.group.style_mod = style_mod;
theme.group.style_mod_edit = style_mod_edit;
theme.group.style_mod_cb = style_mod;
theme.group.style_mod_edit_cb = style_mod_edit;
#endif
return &theme;