Merge branch 'dev-6.0' of https://github.com/littlevgl/lvgl into dev-6.0
This commit is contained in:
@@ -112,7 +112,7 @@ void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr)
|
||||
|
||||
if(old_disp == disp) return;
|
||||
|
||||
lv_ll_chg_list(&old_disp->scr_ll, &disp->scr_ll, scr);
|
||||
lv_ll_chg_list(&old_disp->scr_ll, &disp->scr_ll, scr, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -669,10 +669,7 @@ static void obj_to_foreground(lv_obj_t * obj)
|
||||
|
||||
if(last_top != NULL) {
|
||||
/*Move the last_top object to the foreground*/
|
||||
lv_obj_t * par = lv_obj_get_parent(last_top);
|
||||
/*After list change it will be the new head*/
|
||||
lv_ll_chg_list(&par->child_ll, &par->child_ll, last_top);
|
||||
lv_obj_invalidate(last_top);
|
||||
lv_obj_move_foreground(last_top);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -738,10 +738,7 @@ static void indev_proc_press(lv_indev_proc_t * proc)
|
||||
|
||||
if(last_top != NULL) {
|
||||
/*Move the last_top object to the foreground*/
|
||||
lv_obj_t * par = lv_obj_get_parent(last_top);
|
||||
/*After list change it will be the new head*/
|
||||
lv_ll_chg_list(&par->child_ll, &par->child_ll, last_top);
|
||||
lv_obj_invalidate(last_top);
|
||||
lv_obj_move_foreground(last_top);
|
||||
}
|
||||
|
||||
/*Send a signal about the press*/
|
||||
|
||||
@@ -215,7 +215,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
else {
|
||||
LV_LOG_TRACE("Object create started");
|
||||
|
||||
new_obj = lv_ll_ins_head(&(parent)->child_ll);
|
||||
new_obj = lv_ll_ins_head(&parent->child_ll);
|
||||
lv_mem_assert(new_obj);
|
||||
if(new_obj == NULL) return NULL;
|
||||
|
||||
@@ -429,13 +429,15 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
|
||||
lv_ll_rem(&(par->child_ll), obj);
|
||||
}
|
||||
|
||||
/* Reset all input devices if
|
||||
* the object to delete is used*/
|
||||
/* Reset all input devices if the object to delete is used*/
|
||||
lv_indev_t * indev = lv_indev_get_next(NULL);
|
||||
while(indev) {
|
||||
if(indev->proc.types.pointer.act_obj == obj || indev->proc.types.pointer.last_obj == obj) {
|
||||
lv_indev_reset(indev);
|
||||
}
|
||||
if(indev->proc.types.pointer.last_pressed == obj) {
|
||||
indev->proc.types.pointer.last_pressed = NULL;
|
||||
}
|
||||
|
||||
#if LV_USE_GROUP
|
||||
if(indev->group == group && was_focused) {
|
||||
@@ -550,7 +552,7 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
|
||||
|
||||
lv_obj_t * old_par = obj->par;
|
||||
|
||||
lv_ll_chg_list(&obj->par->child_ll, &parent->child_ll, obj);
|
||||
lv_ll_chg_list(&obj->par->child_ll, &parent->child_ll, obj, true);
|
||||
obj->par = parent;
|
||||
lv_obj_set_pos(obj, old_pos.x, old_pos.y);
|
||||
|
||||
@@ -563,6 +565,42 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move and object to the foreground
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_obj_move_foreground(lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
|
||||
lv_obj_invalidate(parent);
|
||||
|
||||
lv_ll_chg_list(&parent->child_ll, &parent->child_ll, obj, true);
|
||||
|
||||
/*Notify the new parent about the child*/
|
||||
parent->signal_cb(parent, LV_SIGNAL_CHILD_CHG, obj);
|
||||
|
||||
lv_obj_invalidate(parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move and object to the background
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_obj_move_background(lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
|
||||
lv_obj_invalidate(parent);
|
||||
|
||||
lv_ll_chg_list(&parent->child_ll, &parent->child_ll, obj, false);
|
||||
|
||||
/*Notify the new parent about the child*/
|
||||
parent->signal_cb(parent, LV_SIGNAL_CHILD_CHG, obj);
|
||||
|
||||
lv_obj_invalidate(parent);
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
* Coordinate set
|
||||
* ------------------*/
|
||||
@@ -1409,87 +1447,6 @@ void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj)
|
||||
lv_obj_invalidate(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 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,
|
||||
lv_anim_ready_cb_t ready_cb)
|
||||
{
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
|
||||
/*Get the direction*/
|
||||
bool out = (type & LV_ANIM_DIR_MASK) == LV_ANIM_IN ? false : true;
|
||||
type = type & (~LV_ANIM_DIR_MASK);
|
||||
|
||||
lv_anim_t a;
|
||||
a.var = obj;
|
||||
a.time = time;
|
||||
a.act_time = (int32_t)-delay;
|
||||
a.ready_cb = ready_cb;
|
||||
a.path_cb = lv_anim_path_linear;
|
||||
a.playback_pause = 0;
|
||||
a.repeat_pause = 0;
|
||||
a.playback = 0;
|
||||
a.repeat = 0;
|
||||
|
||||
/*Init to ANIM_IN*/
|
||||
switch(type) {
|
||||
case LV_ANIM_FLOAT_LEFT:
|
||||
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.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.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.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.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.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.exec_cb = NULL;
|
||||
a.start = 0;
|
||||
a.end = 0;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
/*Swap start and end in case of ANIM OUT*/
|
||||
if(out != false) {
|
||||
int32_t tmp = a.start;
|
||||
a.start = a.end;
|
||||
a.end = tmp;
|
||||
}
|
||||
|
||||
lv_anim_create(&a);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*=======================
|
||||
* Getter functions
|
||||
*======================*/
|
||||
@@ -2041,7 +1998,7 @@ void * lv_obj_get_group(const lv_obj_t * obj)
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell whether the ohe object is the focused object of a group or not.
|
||||
* Tell whether the object is the focused object of a group or not.
|
||||
* @param obj pointer to an object
|
||||
* @return true: the object is focused, false: the object is not focused or not in a group
|
||||
*/
|
||||
@@ -2255,6 +2212,10 @@ static void delete_children(lv_obj_t * obj)
|
||||
if(indev->proc.types.pointer.act_obj == obj || indev->proc.types.pointer.last_obj == obj) {
|
||||
lv_indev_reset(indev);
|
||||
}
|
||||
|
||||
if(indev->proc.types.pointer.last_pressed == obj) {
|
||||
indev->proc.types.pointer.last_pressed = NULL;
|
||||
}
|
||||
#if LV_USE_GROUP
|
||||
if(indev->group == group && was_focused) {
|
||||
lv_indev_reset(indev);
|
||||
|
||||
@@ -44,10 +44,6 @@ extern "C" {
|
||||
|
||||
#define LV_MAX_ANCESTOR_NUM 8
|
||||
|
||||
#define LV_ANIM_IN 0x00 /*Animation to show an object. 'OR' it with lv_anim_builtin_t*/
|
||||
#define LV_ANIM_OUT 0x80 /*Animation to hide an object. 'OR' it with lv_anim_builtin_t*/
|
||||
#define LV_ANIM_DIR_MASK 0x80 /*ANIM_IN/ANIM_OUT mask*/
|
||||
|
||||
#define LV_EXT_CLICK_AREA_OFF 0
|
||||
#define LV_EXT_CLICK_AREA_TINY 1
|
||||
#define LV_EXT_CLICK_AREA_FULL 2
|
||||
@@ -261,17 +257,6 @@ typedef struct
|
||||
... [x]: "lv_obj" */
|
||||
} lv_obj_type_t;
|
||||
|
||||
enum {
|
||||
LV_ANIM_NONE = 0,
|
||||
LV_ANIM_FLOAT_TOP, /*Float from/to the top*/
|
||||
LV_ANIM_FLOAT_LEFT, /*Float from/to the left*/
|
||||
LV_ANIM_FLOAT_BOTTOM, /*Float from/to the bottom*/
|
||||
LV_ANIM_FLOAT_RIGHT, /*Float from/to the right*/
|
||||
LV_ANIM_GROW_H, /*Grow/shrink horizontally*/
|
||||
LV_ANIM_GROW_V, /*Grow/shrink vertically*/
|
||||
};
|
||||
typedef uint8_t lv_anim_builtin_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@@ -328,6 +313,18 @@ void lv_obj_invalidate(const lv_obj_t * obj);
|
||||
*/
|
||||
void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent);
|
||||
|
||||
/**
|
||||
* Move and object to the foreground
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_obj_move_foreground(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Move and object to the background
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_obj_move_background(lv_obj_t * obj);
|
||||
|
||||
/*--------------------
|
||||
* Coordinate set
|
||||
* ------------------*/
|
||||
@@ -621,20 +618,6 @@ 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 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,
|
||||
lv_anim_ready_cb_t ready_cb);
|
||||
#endif
|
||||
|
||||
/*=======================
|
||||
* Getter functions
|
||||
*======================*/
|
||||
|
||||
@@ -290,10 +290,13 @@ void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * mask_p, const lv
|
||||
lv_coord_t col, row;
|
||||
uint8_t col_bit;
|
||||
uint8_t col_byte_cnt;
|
||||
uint8_t width_byte_scr =
|
||||
letter_w >> 3; /*Width in bytes (on the screen finally) (e.g. w = 11 -> 2 bytes wide)*/
|
||||
|
||||
/*Width in bytes (on the screen finally) (e.g. w = 11 -> 2 bytes wide)*/
|
||||
uint8_t width_byte_scr = letter_w >> 3;
|
||||
if(letter_w & 0x7) width_byte_scr++;
|
||||
uint8_t width_byte_bpp = (letter_w * bpp) >> 3; /*Letter width in byte. Real width in the font*/
|
||||
|
||||
/*Letter width in byte. Real width in the font*/
|
||||
uint8_t width_byte_bpp = (letter_w * bpp) >> 3;
|
||||
if((letter_w * bpp) & 0x7) width_byte_bpp++;
|
||||
|
||||
/* Calculate the col/row start/end on the map*/
|
||||
@@ -331,13 +334,16 @@ void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * mask_p, const lv
|
||||
disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width,
|
||||
(col + pos_x) - vdb->area.x1,
|
||||
(row + pos_y) - vdb->area.y1, color, px_opa);
|
||||
} else {
|
||||
} else if (vdb_buf_tmp->full != color.full) {
|
||||
if(px_opa > LV_OPA_MAX) *vdb_buf_tmp = color;
|
||||
else if(px_opa > LV_OPA_MIN) {
|
||||
#if LV_COLOR_SCREEN_TRANSP == 0
|
||||
*vdb_buf_tmp = lv_color_mix(color, *vdb_buf_tmp, px_opa);
|
||||
*vdb_buf_tmp = lv_color_mix(color, *vdb_buf_tmp, px_opa);
|
||||
#else
|
||||
*vdb_buf_tmp =
|
||||
color_mix_2_alpha(*vdb_buf_tmp, (*vdb_buf_tmp).alpha, color, px_opa);
|
||||
*vdb_buf_tmp =
|
||||
color_mix_2_alpha(*vdb_buf_tmp, (*vdb_buf_tmp).alpha, color, px_opa);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void anim_task(void * param);
|
||||
static void anim_task(lv_task_t * param);
|
||||
static bool anim_ready_handler(lv_anim_t * a);
|
||||
|
||||
/**********************
|
||||
@@ -141,7 +141,7 @@ uint16_t lv_anim_count_running(void)
|
||||
* @param end end value of the animation
|
||||
* @return the required time [ms] for the animation with the given parameters
|
||||
*/
|
||||
uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end)
|
||||
uint16_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end)
|
||||
{
|
||||
int32_t d = LV_MATH_ABS((int32_t)start - end);
|
||||
uint32_t time = (int32_t)((int32_t)(d * 1000) / speed);
|
||||
@@ -160,14 +160,16 @@ uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end)
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_linear(const lv_anim_t * a)
|
||||
lv_anim_value_t lv_anim_path_linear(const lv_anim_t * a)
|
||||
{
|
||||
/*Calculate the current step*/
|
||||
uint16_t step;
|
||||
if(a->time == a->act_time)
|
||||
uint32_t step;
|
||||
if(a->time == a->act_time) {
|
||||
step = LV_ANIM_RESOLUTION; /*Use the last value if the time fully elapsed*/
|
||||
else
|
||||
step = (a->act_time * LV_ANIM_RESOLUTION) / a->time;
|
||||
}
|
||||
else {
|
||||
step = ((int32_t)a->act_time * LV_ANIM_RESOLUTION) / a->time;
|
||||
}
|
||||
|
||||
/* Get the new value which will be proportional to `step`
|
||||
* and the `start` and `end` values*/
|
||||
@@ -176,7 +178,7 @@ int32_t lv_anim_path_linear(const lv_anim_t * a)
|
||||
new_value = new_value >> LV_ANIM_RES_SHIFT;
|
||||
new_value += a->start;
|
||||
|
||||
return new_value;
|
||||
return (lv_anim_value_t)new_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,7 +186,7 @@ int32_t lv_anim_path_linear(const lv_anim_t * a)
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_ease_in(const lv_anim_t * a)
|
||||
lv_anim_value_t lv_anim_path_ease_in(const lv_anim_t * a)
|
||||
{
|
||||
/*Calculate the current step*/
|
||||
uint32_t t;
|
||||
@@ -200,7 +202,7 @@ int32_t lv_anim_path_ease_in(const lv_anim_t * a)
|
||||
new_value = new_value >> 10;
|
||||
new_value += a->start;
|
||||
|
||||
return new_value;
|
||||
return (lv_anim_value_t)new_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,7 +210,7 @@ int32_t lv_anim_path_ease_in(const lv_anim_t * a)
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_ease_out(const lv_anim_t * a)
|
||||
lv_anim_value_t lv_anim_path_ease_out(const lv_anim_t * a)
|
||||
{
|
||||
/*Calculate the current step*/
|
||||
|
||||
@@ -225,7 +227,7 @@ int32_t lv_anim_path_ease_out(const lv_anim_t * a)
|
||||
new_value = new_value >> 10;
|
||||
new_value += a->start;
|
||||
|
||||
return new_value;
|
||||
return (lv_anim_value_t)new_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -233,7 +235,7 @@ int32_t lv_anim_path_ease_out(const lv_anim_t * a)
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_ease_in_out(const lv_anim_t * a)
|
||||
lv_anim_value_t lv_anim_path_ease_in_out(const lv_anim_t * a)
|
||||
{
|
||||
/*Calculate the current step*/
|
||||
|
||||
@@ -250,7 +252,7 @@ int32_t lv_anim_path_ease_in_out(const lv_anim_t * a)
|
||||
new_value = new_value >> 10;
|
||||
new_value += a->start;
|
||||
|
||||
return new_value;
|
||||
return (lv_anim_value_t)new_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,7 +260,7 @@ int32_t lv_anim_path_ease_in_out(const lv_anim_t * a)
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_overshoot(const lv_anim_t * a)
|
||||
lv_anim_value_t lv_anim_path_overshoot(const lv_anim_t * a)
|
||||
{
|
||||
/*Calculate the current step*/
|
||||
|
||||
@@ -275,7 +277,7 @@ int32_t lv_anim_path_overshoot(const lv_anim_t * a)
|
||||
new_value = new_value >> 10;
|
||||
new_value += a->start;
|
||||
|
||||
return new_value;
|
||||
return (lv_anim_value_t)new_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,7 +285,7 @@ int32_t lv_anim_path_overshoot(const lv_anim_t * a)
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_bounce(const lv_anim_t * a)
|
||||
lv_anim_value_t lv_anim_path_bounce(const lv_anim_t * a)
|
||||
{
|
||||
/*Calculate the current step*/
|
||||
uint32_t t;
|
||||
@@ -328,12 +330,11 @@ int32_t lv_anim_path_bounce(const lv_anim_t * a)
|
||||
int32_t step = lv_bezier3(t, 1024, 1024, 800, 0);
|
||||
|
||||
int32_t new_value;
|
||||
|
||||
new_value = (int32_t)step * diff;
|
||||
new_value = new_value >> 10;
|
||||
new_value = a->end - new_value;
|
||||
|
||||
return new_value;
|
||||
return (lv_anim_value_t)new_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -342,7 +343,7 @@ int32_t lv_anim_path_bounce(const lv_anim_t * a)
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_step(const lv_anim_t * a)
|
||||
lv_anim_value_t lv_anim_path_step(const lv_anim_t * a)
|
||||
{
|
||||
if(a->act_time >= a->time)
|
||||
return a->end;
|
||||
@@ -358,7 +359,7 @@ int32_t lv_anim_path_step(const lv_anim_t * a)
|
||||
* Periodically handle the animations.
|
||||
* @param param unused
|
||||
*/
|
||||
static void anim_task(void * param)
|
||||
static void anim_task(lv_task_t * param)
|
||||
{
|
||||
(void)param;
|
||||
|
||||
|
||||
@@ -32,13 +32,15 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef int16_t lv_anim_value_t; /*Type of the animated value*/
|
||||
|
||||
struct _lv_anim_t;
|
||||
|
||||
/*Generic prototype of "animator" functions*/
|
||||
typedef void (*lv_anim_exec_cb_t)(void *, int32_t);
|
||||
typedef void (*lv_anim_exec_cb_t)(void *, lv_anim_value_t);
|
||||
|
||||
/*Get the current value in an animation*/
|
||||
typedef int32_t (*lv_anim_path_cb_t)(const struct _lv_anim_t *);
|
||||
typedef lv_anim_value_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 *);
|
||||
@@ -126,49 +128,49 @@ uint16_t lv_anim_count_running(void);
|
||||
* @param end end value of the animation
|
||||
* @return the required time [ms] for the animation with the given parameters
|
||||
*/
|
||||
uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end);
|
||||
uint16_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end);
|
||||
|
||||
/**
|
||||
* Calculate the current value of an animation applying linear characteristic
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_linear(const lv_anim_t * a);
|
||||
lv_anim_value_t lv_anim_path_linear(const lv_anim_t * a);
|
||||
|
||||
/**
|
||||
* Calculate the current value of an animation slowing down the start phase
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_ease_in(const lv_anim_t * a);
|
||||
lv_anim_value_t lv_anim_path_ease_in(const lv_anim_t * a);
|
||||
|
||||
/**
|
||||
* Calculate the current value of an animation slowing down the end phase
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_ease_out(const lv_anim_t * a);
|
||||
lv_anim_value_t lv_anim_path_ease_out(const lv_anim_t * a);
|
||||
|
||||
/**
|
||||
* Calculate the current value of an animation applying an "S" characteristic (cosine)
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_ease_in_out(const lv_anim_t * a);
|
||||
lv_anim_value_t lv_anim_path_ease_in_out(const lv_anim_t * a);
|
||||
|
||||
/**
|
||||
* Calculate the current value of an animation with overshoot at the end
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_overshoot(const lv_anim_t * a);
|
||||
lv_anim_value_t lv_anim_path_overshoot(const lv_anim_t * a);
|
||||
|
||||
/**
|
||||
* Calculate the current value of an animation with 3 bounces
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_bounce(const lv_anim_t * a);
|
||||
lv_anim_value_t lv_anim_path_bounce(const lv_anim_t * a);
|
||||
|
||||
/**
|
||||
* Calculate the current value of an animation applying step characteristic.
|
||||
@@ -176,7 +178,7 @@ int32_t lv_anim_path_bounce(const lv_anim_t * a);
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_step(const lv_anim_t * a);
|
||||
lv_anim_value_t lv_anim_path_step(const lv_anim_t * a);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -214,22 +214,39 @@ void lv_ll_clear(lv_ll_t * ll_p)
|
||||
* @param ll_ori_p pointer to the original (old) linked list
|
||||
* @param ll_new_p pointer to the new linked list
|
||||
* @param node pointer to a node
|
||||
* @param head true: be the head in the new list
|
||||
* false be the head in the new list
|
||||
*/
|
||||
void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node)
|
||||
void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head)
|
||||
{
|
||||
lv_ll_rem(ll_ori_p, node);
|
||||
|
||||
/*Set node as head*/
|
||||
node_set_prev(ll_new_p, node, NULL);
|
||||
node_set_next(ll_new_p, node, ll_new_p->head);
|
||||
if(head) {
|
||||
/*Set node as head*/
|
||||
node_set_prev(ll_new_p, node, NULL);
|
||||
node_set_next(ll_new_p, node, ll_new_p->head);
|
||||
|
||||
if(ll_new_p->head != NULL) { /*If there is old head then before it goes the new*/
|
||||
node_set_prev(ll_new_p, ll_new_p->head, node);
|
||||
}
|
||||
if(ll_new_p->head != NULL) { /*If there is old head then before it goes the new*/
|
||||
node_set_prev(ll_new_p, ll_new_p->head, node);
|
||||
}
|
||||
|
||||
ll_new_p->head = node; /*Set the new head in the dsc.*/
|
||||
if(ll_new_p->tail == NULL) { /*If there is no tail (first node) set the tail too*/
|
||||
ll_new_p->tail = node;
|
||||
ll_new_p->head = node; /*Set the new head in the dsc.*/
|
||||
if(ll_new_p->tail == NULL) { /*If there is no tail (first node) set the tail too*/
|
||||
ll_new_p->tail = node;
|
||||
}
|
||||
} else {
|
||||
/*Set node as tail*/
|
||||
node_set_prev(ll_new_p, node, ll_new_p->tail);
|
||||
node_set_next(ll_new_p, node, NULL);
|
||||
|
||||
if(ll_new_p->tail != NULL) { /*If there is old tail then after it goes the new*/
|
||||
node_set_next(ll_new_p, ll_new_p->tail, node);
|
||||
}
|
||||
|
||||
ll_new_p->tail = node; /*Set the new tail in the dsc.*/
|
||||
if(ll_new_p->head == NULL) { /*If there is no head (first node) set the head too*/
|
||||
ll_new_p->head = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,8 +89,10 @@ void lv_ll_clear(lv_ll_t * ll_p);
|
||||
* @param ll_ori_p pointer to the original (old) linked list
|
||||
* @param ll_new_p pointer to the new linked list
|
||||
* @param node pointer to a node
|
||||
* @param head true: be the head in the new list
|
||||
* false be the head in the new list
|
||||
*/
|
||||
void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node);
|
||||
void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head);
|
||||
|
||||
/**
|
||||
* Return with head node of the linked list
|
||||
|
||||
@@ -202,14 +202,45 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay)
|
||||
|
||||
if(ext->anim_time != 0) {
|
||||
/*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_ready_cb);
|
||||
lv_anim_t a;
|
||||
a.var = mbox;
|
||||
a.start = lv_obj_get_height(mbox);
|
||||
a.end = 0;
|
||||
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_height;
|
||||
a.path_cb = lv_anim_path_linear;
|
||||
a.ready_cb = NULL;
|
||||
a.act_time = -delay;
|
||||
a.time = ext->anim_time;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
a.user_data = NULL;
|
||||
lv_anim_create(&a);
|
||||
|
||||
a.start = lv_obj_get_width(mbox);
|
||||
a.ready_cb = lv_mbox_close_ready_cb;
|
||||
lv_anim_create(&a);
|
||||
|
||||
/*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_ready_cb);
|
||||
/*Create an animation to delete the mbox `delay` ms later*/
|
||||
lv_anim_t a;
|
||||
a.var = mbox;
|
||||
a.start = 0;
|
||||
a.end = 1;
|
||||
a.exec_cb = (lv_anim_exec_cb_t)NULL;
|
||||
a.path_cb = lv_anim_path_linear;
|
||||
a.ready_cb = lv_mbox_close_ready_cb;
|
||||
a.act_time = -delay;
|
||||
a.time = 0;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
a.user_data = NULL;
|
||||
lv_anim_create(&a);
|
||||
}
|
||||
#else
|
||||
(void)delay; /*Unused*/
|
||||
|
||||
@@ -506,7 +506,8 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
|
||||
lv_coord_t label_y1 = ext->ddlist.label->coords.y1 - roller->coords.y1;
|
||||
lv_coord_t label_unit = font_h + style_label->text.line_space;
|
||||
lv_coord_t mid = (roller->coords.y2 - roller->coords.y1) / 2;
|
||||
id = (mid - label_y1 + style_label->text.line_space / 2) / label_unit;
|
||||
|
||||
id = (mid - label_y1 + style_label->text.line_space / 2) / label_unit;
|
||||
|
||||
if(id < 0) id = 0;
|
||||
if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
|
||||
@@ -515,19 +516,23 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
|
||||
ext->ddlist.sel_opt_id_ori = id;
|
||||
res = lv_event_send(roller, LV_EVENT_VALUE_CHANGED, &id);
|
||||
if(res != LV_RES_OK) return res;
|
||||
} else if(sign == LV_SIGNAL_RELEASED) {
|
||||
/*If picked an option by clicking then set it*/
|
||||
}
|
||||
/*If picked an option by clicking then set it*/
|
||||
else if(sign == LV_SIGNAL_RELEASED) {
|
||||
if(!lv_indev_is_dragging(indev)) {
|
||||
id = ext->ddlist.sel_opt_id;
|
||||
#if LV_USE_GROUP
|
||||
/*In edit mode go to navigate mode if an option is selected*/
|
||||
lv_group_t * g = lv_obj_get_group(roller);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
if(editing)
|
||||
lv_group_set_editing(
|
||||
g, false); /*In edit mode go to navigate mode if an option is selected*/
|
||||
lv_group_set_editing(g, false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESSED) {
|
||||
lv_anim_del(roller_scrl, (lv_anim_exec_cb_t)lv_obj_set_y);
|
||||
}
|
||||
|
||||
/*Position the scrollable according to the new selected option*/
|
||||
if(id != -1) {
|
||||
|
||||
Reference in New Issue
Block a user