1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

animation warning fixes

This commit is contained in:
Gabor Kiss-Vamosi 2019-06-20 06:26:24 +02:00
commit 7a0ccd74a8
7 changed files with 30 additions and 36 deletions

View File

@ -19,8 +19,6 @@ extern "C" {
#include "../../../lv_conf.h"
#endif
#if LV_USE_ANIMATION
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
@ -33,6 +31,16 @@ extern "C" {
* TYPEDEFS
**********************/
/*Can be used to indicate if animations are enabled or disabled in a case*/
enum {
LV_ANIM_OFF,
LV_ANIM_ON,
};
typedef uint8_t lv_anim_enable_t;
#if LV_USE_ANIMATION
struct _lv_anim_t;
/* Generic prototype of "animator" functions.
@ -77,13 +85,6 @@ typedef struct _lv_anim_t
uint32_t has_run : 1; /*Indicates the animation has run in this round*/
} lv_anim_t;
/*Can be used to indicate if animations are enabled or disabled in a case*/
enum {
LV_ANIM_OFF,
LV_ANIM_ON,
};
typedef uint8_t lv_anim_enable_t;
/**********************
* GLOBAL PROTOTYPES

View File

@ -220,11 +220,10 @@ void lv_bar_set_sym(lv_obj_t * bar, bool en)
*/
void lv_bar_set_anim_time(lv_obj_t * bar, uint16_t anim_time)
{
#if LV_USE_ANIMATION == 0
anim_time = 0;
#endif
#if LV_USE_ANIMATION
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
ext->anim_time = anim_time;
#endif
}
/**

View File

@ -435,7 +435,7 @@ lv_label_align_t lv_ddlist_get_align(const lv_obj_t * ddlist)
void lv_ddlist_open(lv_obj_t * ddlist, lv_anim_enable_t anim)
{
#if LV_USE_ANIMATION == 0
anim_en = false;
anim = false;
#endif
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
ext->opened = 1;
@ -451,7 +451,7 @@ void lv_ddlist_open(lv_obj_t * ddlist, lv_anim_enable_t anim)
void lv_ddlist_close(lv_obj_t * ddlist, lv_anim_enable_t anim)
{
#if LV_USE_ANIMATION == 0
anim_en = false;
anim = false;
#endif
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
ext->opened = 0;
@ -811,7 +811,7 @@ static lv_res_t release_handler(lv_obj_t * ddlist)
static void lv_ddlist_refr_size(lv_obj_t * ddlist, lv_anim_enable_t anim)
{
#if LV_USE_ANIMATION == 0
anim_en = false;
anim = false;
#endif
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
const lv_style_t * style = lv_obj_get_style(ddlist);

View File

@ -143,13 +143,6 @@ static inline void lv_ddlist_set_anim_time(lv_obj_t * ddlist, uint16_t anim_time
lv_page_set_anim_time(ddlist, anim_time);
}
/**
* Set the open/close animation time.
* @param ddlist pointer to a drop down list
* @param anim_time: open/close animation time [ms]
*/
void lv_ddlist_set_anim_time(lv_obj_t * ddlist, uint16_t anim_time);
/**
* Set a style of a drop down list
* @param ddlist pointer to a drop down list object
@ -230,13 +223,6 @@ static inline uint16_t lv_ddlist_get_anim_time(const lv_obj_t * ddlist)
return lv_page_get_anim_time(ddlist);
}
/**
* Get the open/close animation time.
* @param ddlist pointer to a drop down list
* @return open/close animation time [ms]
*/
uint16_t lv_ddlist_get_anim_time(const lv_obj_t * ddlist);
/**
* Get a style of a drop down list
* @param ddlist pointer to a drop down list object

View File

@ -657,7 +657,7 @@ void lv_list_focus(const lv_obj_t * btn, lv_anim_enable_t anim)
{
#if LV_USE_ANIMATION == 0
anim_en = false;
anim = false;
#endif
lv_obj_t * list = lv_obj_get_parent(lv_obj_get_parent(btn));

View File

@ -218,9 +218,12 @@ void lv_page_set_sb_mode(lv_obj_t * page, lv_sb_mode_t sb_mode)
*/
void lv_page_set_anim_time(lv_obj_t * page, uint16_t anim_time)
{
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
#if LV_USE_ANIMATION
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
ext->anim_time = anim_time;
#else
(void)page; /*Unused*/
(void)anim_time; /*Unused*/
#endif
}

View File

@ -365,8 +365,9 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an
if(anim == LV_ANIM_OFF || lv_tabview_get_anim_time(tabview) == 0) {
lv_obj_set_x(ext->content, cont_x);
} else {
}
#if LV_USE_ANIMATION
else {
lv_anim_t a;
a.var = ext->content;
a.start = lv_obj_get_x(ext->content);
@ -381,8 +382,8 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an
a.repeat = 0;
a.repeat_pause = 0;
lv_anim_create(&a);
#endif
}
#endif
/*Move the indicator*/
const lv_style_t * tabs_style = lv_obj_get_style(ext->btns);
@ -402,15 +403,19 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an
break;
}
if(anim == LV_ANIM_OFF || ext->anim_time == 0) {
#if LV_USE_ANIMATION
if(anim == LV_ANIM_OFF || ext->anim_time == 0)
#endif
{
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
else {
lv_anim_t a;
a.var = ext->indic;
@ -438,8 +443,8 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an
a.repeat = 0;
a.repeat_pause = 0;
lv_anim_create(&a);
#endif
}
#endif
lv_btnm_set_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNM_CTRL_TGL_STATE);
}