mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
Fixed compilation issues when animations are disabled
This commit is contained in:
parent
d80cc562d4
commit
625aaa25ff
@ -19,12 +19,20 @@ extern "C" {
|
||||
#include "../../../lv_conf.h"
|
||||
#endif
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
/*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
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
@ -80,13 +88,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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -212,8 +212,8 @@ 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;
|
||||
#endif
|
||||
|
||||
|
@ -363,10 +363,14 @@ 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) {
|
||||
lv_obj_set_x(ext->content, cont_x);
|
||||
} else {
|
||||
#if LV_USE_ANIMATION
|
||||
if(anim == LV_ANIM_OFF || ext->anim_time == 0)
|
||||
#endif
|
||||
{
|
||||
lv_obj_set_x(ext->content, cont_x);
|
||||
}
|
||||
#if LV_USE_ANIMATION
|
||||
else {
|
||||
lv_anim_t a;
|
||||
a.var = ext->content;
|
||||
a.start = lv_obj_get_x(ext->content);
|
||||
@ -381,8 +385,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 +406,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 +446,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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user