1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

remove LV_USE_ANIMATION/FS/GROUP

This commit is contained in:
Gabor Kiss-Vamosi 2021-01-26 15:09:36 +01:00
parent 07268829c4
commit 1f4c5adc30
32 changed files with 129 additions and 765 deletions

View File

@ -181,12 +181,6 @@ typedef void * lv_anim_user_data_t;
/* 1: Use image zoom and rotation*/
#define LV_USE_IMG_TRANSFORM 1
/* 1: Enable object groups (for keyboard/encoder navigation) */
#define LV_USE_GROUP 1
#if LV_USE_GROUP
typedef void * lv_group_user_data_t;
#endif /*LV_USE_GROUP*/
/* 1: Enable GPU interface*/
#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */
#define LV_USE_GPU_STM32_DMA2D 0

View File

@ -371,20 +371,6 @@
* Feature usage
*==================*/
/*1: Enable the Animations */
#ifndef LV_USE_ANIMATION
# ifdef CONFIG_LV_USE_ANIMATION
# define LV_USE_ANIMATION CONFIG_LV_USE_ANIMATION
# else
# define LV_USE_ANIMATION 1
# endif
#endif
#if LV_USE_ANIMATION
/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/
#endif
/* 1: Enable shadow drawing on rectangles*/
#ifndef LV_USE_SHADOW
# ifdef CONFIG_LV_USE_SHADOW
@ -461,16 +447,6 @@
# endif
#endif
/* 1: Enable object groups (for keyboard/encoder navigation) */
#ifndef LV_USE_GROUP
# ifdef CONFIG_LV_USE_GROUP
# define LV_USE_GROUP CONFIG_LV_USE_GROUP
# else
# define LV_USE_GROUP 1
# endif
#endif
#if LV_USE_GROUP
#endif /*LV_USE_GROUP*/
/* 1: Enable GPU interface*/
#ifndef LV_USE_GPU
@ -528,17 +504,6 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
# endif
#endif
/* 1: Enable file system (might be required for images */
#ifndef LV_USE_FILESYSTEM
# ifdef CONFIG_LV_USE_FILESYSTEM
# define LV_USE_FILESYSTEM CONFIG_LV_USE_FILESYSTEM
# else
# define LV_USE_FILESYSTEM 1
# endif
#endif
#if LV_USE_FILESYSTEM
/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/
#endif
/*1: Add a `user_data` to drivers and objects*/
#ifndef LV_USE_USER_DATA
@ -578,23 +543,6 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
* Image decoder and cache
*========================*/
/* 1: Enable indexed (palette) images */
#ifndef LV_IMG_CF_INDEXED
# ifdef CONFIG_LV_IMG_CF_INDEXED
# define LV_IMG_CF_INDEXED CONFIG_LV_IMG_CF_INDEXED
# else
# define LV_IMG_CF_INDEXED 1
# endif
#endif
/* 1: Enable alpha indexed images */
#ifndef LV_IMG_CF_ALPHA
# ifdef CONFIG_LV_IMG_CF_ALPHA
# define LV_IMG_CF_ALPHA CONFIG_LV_IMG_CF_ALPHA
# else
# define LV_IMG_CF_ALPHA 1
# endif
#endif
/* Default image cache size. Image caching keeps the images opened.
* If only the built-in image formats are used there is no real advantage of caching.

View File

@ -22,11 +22,9 @@
* STATIC PROTOTYPES
**********************/
#if LV_USE_ANIMATION
static void scr_load_anim_start(lv_anim_t * a);
static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v);
static void scr_anim_ready(lv_anim_t * a);
#endif
static void scr_load_anim_start(lv_anim_t * a);
static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v);
static void scr_anim_ready(lv_anim_t * a);
/**********************
* STATIC VARIABLES
@ -181,8 +179,6 @@ void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa)
_lv_inv_area(disp, &a);
}
#if LV_USE_ANIMATION
/**
* Switch screen with animation
* @param scr pointer to the new screen to load
@ -300,8 +296,6 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
lv_anim_start(&a_old);
}
#endif
/**
* Get elapsed time since last user activity on a display (e.g. click)
* @param disp pointer to an display (NULL to get the overall smallest inactivity)
@ -375,7 +369,6 @@ lv_timer_t * _lv_disp_get_refr_task(lv_disp_t * disp)
* STATIC FUNCTIONS
**********************/
#if LV_USE_ANIMATION
static void scr_load_anim_start(lv_anim_t * a)
{
lv_disp_t * d = lv_obj_get_disp(a->var);
@ -398,4 +391,3 @@ static void scr_anim_ready(lv_anim_t * a)
d->scr_to_load = NULL;
// lv_style_remove_prop(lv_obj_get_local_style(a->var, LV_PART_MAIN, LV_STATE_DEFAULT), LV_STYLE_OPA);
}
#endif

View File

@ -99,7 +99,6 @@ void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src);
*/
void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa);
#if LV_USE_ANIMATION
/**
* Switch screen with animation
@ -111,7 +110,6 @@ void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa);
*/
void lv_scr_load_anim(lv_obj_t * scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del);
#endif
/**
* Get elapsed time since last user activity on a display (e.g. click)
* @param disp pointer to an display (NULL to get the overall smallest inactivity)

View File

@ -7,7 +7,6 @@
* INCLUDES
*********************/
#include "lv_group.h"
#if LV_USE_GROUP != 0
#include <stddef.h>
#include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h"
@ -68,7 +67,7 @@ lv_group_t * lv_group_create(void)
group->wrap = 1;
#if LV_USE_USER_DATA
lv_memset_00(&group->user_data, sizeof(lv_group_user_data_t));
lv_memset_00(&group->user_data, sizeof(lv_user_data_t));
#endif
return group;
@ -82,7 +81,7 @@ void lv_group_del(lv_group_t * group)
{
/*Defocus the currently focused object*/
if(group->obj_focus != NULL) {
(*group->obj_focus)->signal_cb(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
lv_signal_send(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
lv_obj_invalidate(*group->obj_focus);
}
@ -114,10 +113,10 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
}
}
/*If the object is already in a group and focused then defocus it*/
/*If the object is already in a group and focused then refocus it*/
lv_group_t * group_cur = lv_obj_get_group(obj);
if(group_cur) {
if(lv_obj_is_focused(obj)) {
if(obj->spec_attr->group_p && *(obj->spec_attr->group_p->obj_focus) == obj) {
lv_group_refocus(group_cur);
LV_LOG_INFO("lv_group_add_obj: assign object to an other group");
@ -154,7 +153,7 @@ void lv_group_remove_obj(lv_obj_t * obj)
/*If this is the only object in the group then focus to nothing.*/
if(_lv_ll_get_head(&g->obj_ll) == g->obj_focus && _lv_ll_get_tail(&g->obj_ll) == g->obj_focus) {
(*g->obj_focus)->signal_cb(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
lv_signal_send(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
}
/*If there more objects in the group then focus to the next/prev object*/
else {
@ -189,7 +188,7 @@ void lv_group_remove_all_objs(lv_group_t * group)
{
/*Defocus the currently focused object*/
if(group->obj_focus != NULL) {
(*group->obj_focus)->signal_cb(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
lv_signal_send(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
lv_obj_invalidate(*group->obj_focus);
group->obj_focus = NULL;
}
@ -224,7 +223,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
_LV_LL_READ(&g->obj_ll, i) {
if(*i == obj) {
if(g->obj_focus != NULL) {
(*g->obj_focus)->signal_cb(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
lv_signal_send(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
lv_res_t res = lv_event_send(*g->obj_focus, LV_EVENT_DEFOCUSED, NULL);
if(res != LV_RES_OK) return;
lv_obj_invalidate(*g->obj_focus);
@ -233,7 +232,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
g->obj_focus = i;
if(g->obj_focus != NULL) {
(*g->obj_focus)->signal_cb(*g->obj_focus, LV_SIGNAL_FOCUS, NULL);
lv_signal_send(*g->obj_focus, LV_SIGNAL_FOCUS, NULL);
if(g->focus_cb) g->focus_cb(g);
lv_res_t res = lv_event_send(*g->obj_focus, LV_EVENT_FOCUSED, NULL);
if(res != LV_RES_OK) return;
@ -288,7 +287,7 @@ lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c)
lv_res_t res;
res = act->signal_cb(act, LV_SIGNAL_CONTROL, &c);
res = lv_signal_send(act, LV_SIGNAL_CONTROL, &c);
if(res != LV_RES_OK) return res;
res = lv_event_send(act, LV_EVENT_KEY, &c);
@ -323,7 +322,7 @@ void lv_group_set_editing(lv_group_t * group, bool edit)
lv_obj_t * focused = lv_group_get_focused(group);
if(focused) {
focused->signal_cb(focused, LV_SIGNAL_FOCUS, NULL); /*Focus again to properly leave/open edit/navigate mode*/
lv_signal_send(focused, LV_SIGNAL_FOCUS, NULL); /*Focus again to properly leave/open edit/navigate mode*/
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL);
if(res != LV_RES_OK) return;
@ -375,7 +374,7 @@ lv_obj_t * lv_group_get_focused(const lv_group_t * group)
* @param group pointer to an group
* @return pointer to the user data
*/
lv_group_user_data_t * lv_group_get_user_data(lv_group_t * group)
lv_user_data_t * lv_group_get_user_data(lv_group_t * group)
{
return &group->user_data;
}
@ -491,7 +490,7 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
if(obj_next == group->obj_focus) return; /*There's only one visible object and it's already focused*/
if(group->obj_focus) {
(*group->obj_focus)->signal_cb(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
lv_signal_send(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_DEFOCUSED, NULL);
if(res != LV_RES_OK) return;
lv_obj_invalidate(*group->obj_focus);
@ -499,7 +498,7 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
group->obj_focus = obj_next;
(*group->obj_focus)->signal_cb(*group->obj_focus, LV_SIGNAL_FOCUS, NULL);
lv_signal_send(*group->obj_focus, LV_SIGNAL_FOCUS, NULL);
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL);
if(res != LV_RES_OK) return;
@ -508,5 +507,3 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
if(group->focus_cb) group->focus_cb(group);
}
#endif /*LV_USE_GROUP != 0*/

View File

@ -14,13 +14,17 @@ extern "C" {
* INCLUDES
*********************/
#include "lv_obj.h"
#include "../lv_conf_internal.h"
#include <stdint.h>
#include <stdbool.h>
#include "../lv_misc/lv_ll.h"
#include "../lv_misc/lv_types.h"
/*********************
* DEFINES
*********************/
/*Predefined keys to control the focused object via lv_group_send(group, c)*/
/*For compatibility in signal function define the keys regardless to `LV_USE_GROUP`*/
enum {
LV_KEY_UP = 17, /*0x11*/
@ -38,13 +42,12 @@ enum {
};
typedef uint8_t lv_key_t;
#if LV_USE_GROUP != 0
/**********************
* TYPEDEFS
**********************/
struct _lv_group_t;
struct _lv_obj_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 *);
/**
@ -53,11 +56,11 @@ 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*/
struct _lv_obj_t ** obj_focus; /**< The object in focus*/
lv_group_focus_cb_t focus_cb; /**< A function to call when a new object is focused (optional)*/
#if LV_USE_USER_DATA
lv_group_user_data_t user_data;
lv_user_data_t user_data;
#endif
uint8_t frozen : 1; /**< 1: can't focus to new object*/
@ -100,13 +103,13 @@ void lv_group_del(lv_group_t * group);
* @param group pointer to a group
* @param obj pointer to an object to add
*/
void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj);
void lv_group_add_obj(lv_group_t * group, struct _lv_obj_t * obj);
/**
* Remove an object from its group
* @param obj pointer to an object to remove
*/
void lv_group_remove_obj(lv_obj_t * obj);
void lv_group_remove_obj(struct _lv_obj_t * obj);
/**
* Remove all objects from a group
@ -118,7 +121,7 @@ void lv_group_remove_all_objs(lv_group_t * group);
* Focus on an object (defocus the current)
* @param obj pointer to an object to focus on
*/
void lv_group_focus_obj(lv_obj_t * obj);
void lv_group_focus_obj(struct _lv_obj_t * obj);
/**
* Focus the next object in a group (defocus the current)
@ -188,7 +191,7 @@ void lv_group_set_wrap(lv_group_t * group, bool en);
* @param group pointer to a group
* @return pointer to the focused object
*/
lv_obj_t * lv_group_get_focused(const lv_group_t * group);
struct _lv_obj_t * lv_group_get_focused(const lv_group_t * group);
#if LV_USE_USER_DATA
/**
@ -196,7 +199,7 @@ lv_obj_t * lv_group_get_focused(const lv_group_t * group);
* @param group pointer to an group
* @return pointer to the user data
*/
lv_group_user_data_t * lv_group_get_user_data(lv_group_t * group);
lv_user_data_t * lv_group_get_user_data(lv_group_t * group);
#endif
@ -232,8 +235,6 @@ bool lv_group_get_wrap(lv_group_t * group);
* MACROS
**********************/
#endif /*LV_USE_GROUP != 0*/
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@ -180,14 +180,12 @@ void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj)
lv_obj_clear_flag(indev->cursor, LV_OBJ_FLAG_LAYOUTABLE);
}
#if LV_USE_GROUP
void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group)
{
if(indev->driver.type == LV_INDEV_TYPE_KEYPAD || indev->driver.type == LV_INDEV_TYPE_ENCODER) {
indev->group = group;
}
}
#endif
void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t points[])
{
@ -343,7 +341,6 @@ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
*/
static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
{
#if LV_USE_GROUP
if(data->state == LV_INDEV_STATE_PR && i->proc.wait_until_release) return;
if(i->proc.wait_until_release) {
@ -381,7 +378,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
/*Send the ENTER as a normal KEY*/
lv_group_send_data(g, LV_KEY_ENTER);
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSED, NULL);
indev_obj_act->class_p->signal_cb(indev_obj_act, LV_SIGNAL_PRESSED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL);
if(indev_reset_check(&i->proc)) return;
@ -414,7 +411,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
else if(data->state == LV_INDEV_STATE_PR && prev_state == LV_INDEV_STATE_PR) {
if(data->key == LV_KEY_ENTER) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSING, NULL);
indev_obj_act->class_p->signal_cb(indev_obj_act, LV_SIGNAL_PRESSING, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_PRESSING, NULL);
if(indev_reset_check(&i->proc)) return;
@ -425,7 +422,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
i->proc.long_pr_sent = 1;
if(data->key == LV_KEY_ENTER) {
i->proc.longpr_rep_timestamp = lv_tick_get();
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL);
indev_obj_act->class_p->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL);
if(indev_reset_check(&i->proc)) return;
@ -439,7 +436,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
/*Send LONG_PRESS_REP on ENTER*/
if(data->key == LV_KEY_ENTER) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS_REP, NULL);
indev_obj_act->class_p->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS_REP, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
if(indev_reset_check(&i->proc)) return;
@ -469,7 +466,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
data->key = prev_key;
if(data->key == LV_KEY_ENTER) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
indev_obj_act->class_p->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
if(indev_reset_check(&i->proc)) return;
if(i->proc.long_pr_sent == 0) {
@ -487,10 +484,6 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
i->proc.long_pr_sent = 0;
}
indev_obj_act = NULL;
#else
(void)data; /*Unused*/
(void)i; /*Unused*/
#endif
}
/**
@ -500,8 +493,6 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
*/
static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
{
#if LV_USE_GROUP
if(data->state == LV_INDEV_STATE_PR && i->proc.wait_until_release) return;
if(i->proc.wait_until_release) {
@ -538,11 +529,10 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
i->proc.pr_timestamp = lv_tick_get();
if(data->key == LV_KEY_ENTER) {
bool editable = false;
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
bool editable = indev_obj_act->class_p->editable;
if(lv_group_get_editing(g) == true || editable == false) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSED, NULL);
indev_obj_act->class_p->signal_cb(indev_obj_act, LV_SIGNAL_PRESSED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL);
@ -578,8 +568,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
i->proc.longpr_rep_timestamp = lv_tick_get();
if(data->key == LV_KEY_ENTER) {
bool editable = false;
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
bool editable = indev_obj_act->class_p->editable;
/*On enter long press toggle edit mode.*/
if(editable) {
@ -590,7 +579,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
}
/*If not editable then just send a long press signal*/
else {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL);
indev_obj_act->class_p->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL);
if(indev_reset_check(&i->proc)) return;
@ -605,7 +594,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
i->proc.longpr_rep_timestamp = lv_tick_get();
if(data->key == LV_KEY_ENTER) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS_REP, NULL);
indev_obj_act->class_p->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS_REP, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
if(indev_reset_check(&i->proc)) return;
@ -630,12 +619,11 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
else if(data->state == LV_INDEV_STATE_REL && last_state == LV_INDEV_STATE_PR) {
if(data->key == LV_KEY_ENTER) {
bool editable = false;
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
bool editable = indev_obj_act->class_p->editable;
/*The button was released on a non-editable object. Just send enter*/
if(editable == false) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
indev_obj_act->class_p->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
if(indev_reset_check(&i->proc)) return;
if(i->proc.long_pr_sent == 0) lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
@ -651,7 +639,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
else if(g->editing) {
/*Ignore long pressed enter release because it comes from mode switch*/
if(!i->proc.long_pr_sent || _lv_ll_get_len(&g->obj_ll) <= 1) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
indev_obj_act->class_p->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
@ -701,11 +689,6 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
}
}
}
#else
(void)data; /*Unused*/
(void)i; /*Unused*/
#endif
}
/**

View File

@ -76,14 +76,12 @@ void lv_indev_reset_long_press(lv_indev_t * indev);
*/
void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj);
#if LV_USE_GROUP
/**
* Set a destination group for a keypad input device (for LV_INDEV_TYPE_KEYPAD)
* @param indev pointer to an input device
* @param group point to a group
*/
void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group);
#endif
/**
* Set the an array of points for LV_INDEV_TYPE_BUTTON.

View File

@ -84,7 +84,7 @@ static void lv_obj_destructor(lv_obj_t * obj);
**********************/
static bool lv_initialized = false;
static lv_event_temp_data_t * event_temp_data_head;
static const void * event_act_data;
static void * event_act_data;
const lv_obj_class_t lv_obj = {
.constructor = lv_obj_constructor,
.destructor = lv_obj_destructor,
@ -117,17 +117,11 @@ void lv_init(void)
_lv_timer_core_init();
#if LV_USE_FILESYSTEM
_lv_fs_init();
#endif
#if LV_USE_ANIMATION
_lv_anim_core_init();
#endif
#if LV_USE_GROUP
_lv_group_init();
#endif
#if LV_USE_GPU_STM32_DMA2D
/*Initialize DMA2D GPU*/
@ -190,14 +184,14 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
* Event/Signal sending
*---------------------*/
lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data)
lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * data)
{
if(obj == NULL) return LV_RES_OK;
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
/*Nothing to do if no event function and not bubbled*/
lv_event_cb_t event_cb = lv_obj_get_event_cb(obj);
lv_event_cb_t event_cb = lv_obj_get_event_cb(obj, 0);
if(event_cb == NULL && lv_obj_has_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE) == false) {
return LV_RES_OK;
}
@ -215,7 +209,7 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data)
}
event_temp_data_head = &event_temp_data;
const void * event_act_data_save = event_act_data;
void * event_act_data_save = event_act_data;
event_act_data = data;
/*Call the input device's feedback callback if set*/
@ -224,8 +218,27 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data)
if(indev_act->driver.feedback_cb) indev_act->driver.feedback_cb(&indev_act->driver, event);
}
/*Call the event callback*/
if(event_cb) event_cb(obj, event);
uint32_t i = 0;
lv_res_t res = LV_RES_OK;
while(event_cb) {
event_cb(obj, event);
/*Stop if the object is deleted*/
if(event_temp_data.deleted) {
res = LV_RES_INV;
break;
}
if(obj) {
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE) && obj->parent) {
lv_res_t res = lv_event_send(obj->parent, event, data);
if(res != LV_RES_OK) return LV_RES_INV;
}
}
i++;
event_cb = lv_obj_get_event_cb(obj, i);
}
/*Restore the event data*/
event_act_data = event_act_data_save;
@ -233,17 +246,7 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data)
/*Remove this element from the list*/
event_temp_data_head = event_temp_data_head->prev;
if(event_temp_data.deleted) return LV_RES_INV;
if(obj) {
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE) && obj->parent) {
lv_res_t res = lv_event_send(obj->parent, event, data);
if(res != LV_RES_OK) return LV_RES_INV;
}
}
return LV_RES_OK;
return res;
}
@ -313,10 +316,6 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0
obj->state = new_state;
lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
#else
lv_state_t prev_state = obj->state;
obj->state = new_state;
@ -368,8 +367,6 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_LAYOUT) lv_obj_refresh_style(obj, LV_STYLE_PROP_ALL);
else if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) lv_obj_refresh_ext_draw_size(obj);
else if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_REDRAW) lv_obj_invalidate(obj);
#endif
}
void lv_obj_add_state(lv_obj_t * obj, lv_state_t state)
@ -397,7 +394,12 @@ void lv_obj_set_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb)
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
lv_obj_allocate_spec_attr(obj);
obj->spec_attr->event_cb = event_cb;
obj->spec_attr->event_cb_cnt++;
obj->spec_attr->event_cb = lv_mem_realloc(obj->spec_attr->event_cb, obj->spec_attr->event_cb_cnt * sizeof(lv_event_cb_t));
LV_ASSERT_MEM(obj->spec_attr->event_cb);
obj->spec_attr->event_cb[obj->spec_attr->event_cb_cnt - 1] = event_cb;
}
void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir)
@ -461,25 +463,22 @@ lv_state_t lv_obj_get_state(const lv_obj_t * obj)
return ((lv_obj_t *)obj)->state;
}
lv_event_cb_t lv_obj_get_event_cb(const lv_obj_t * obj)
lv_event_cb_t lv_obj_get_event_cb(const lv_obj_t * obj, uint32_t id)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
if(obj->spec_attr) return obj->spec_attr->event_cb;
else return NULL;
if(!obj->spec_attr) return NULL;
if(id >= obj->spec_attr->event_cb_cnt) return NULL;
return obj->spec_attr->event_cb[id];
}
void * lv_obj_get_group(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
#if LV_USE_GROUP
if(obj->spec_attr) return obj->spec_attr->group_p;
else return NULL;
#else
LV_UNUSED(obj);
return NULL;
#endif
}
/*-------------------
@ -634,13 +633,11 @@ static void lv_obj_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t
lv_memcpy_small(obj->spec_attr, copy->spec_attr, sizeof(lv_obj_spec_attr_t));
obj->spec_attr->children = NULL; /*Make the child list empty*/
}
#if LV_USE_GROUP
/*Add to the same group*/
if(copy->spec_attr && copy->spec_attr->group_p) {
obj->spec_attr->group_p = NULL; /*It was simply copied */
lv_group_add_obj(copy->spec_attr->group_p, obj);
}
#endif
/*Set the same coordinates for non screen objects*/
if(lv_obj_get_parent(copy) != NULL && parent != NULL) {
@ -954,7 +951,6 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
lv_obj_clear_state(obj, LV_STATE_PRESSED);
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_CHECKABLE)) {
uint32_t state = 0;
char c = *((char *)param);
@ -969,7 +965,6 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, &state);
if(res != LV_RES_OK) return res;
}
#endif
}
else if(sign == LV_SIGNAL_FOCUS) {
lv_obj_t * parent = lv_obj_get_parent(obj);
@ -981,12 +976,11 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
}
bool editing = false;
#if LV_USE_GROUP
editing = lv_group_get_editing(lv_obj_get_group(obj));
#endif
lv_state_t state = LV_STATE_FOCUSED;
if(editing) {
lv_state_t state = LV_STATE_FOCUSED;
state |= LV_STATE_EDITED;
if(lv_obj_get_group(obj)) state |= LV_STATE_FOCUS_GROUP;
/*if using focus mode, change target to parent*/
obj = lv_obj_get_focused_obj(obj);
@ -997,7 +991,7 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
/*if using focus mode, change target to parent*/
obj = lv_obj_get_focused_obj(obj);
lv_obj_add_state(obj, LV_STATE_FOCUSED);
lv_obj_add_state(obj, state);
lv_obj_clear_state(obj, LV_STATE_EDITED);
}
}

View File

@ -91,6 +91,9 @@ typedef enum {
LV_EVENT_DRAW_PART_BEGIN,
LV_EVENT_DRAW_PART_END,
LV_EVENT_READY, /**< A process has finished */
LV_EVENT_CANCEL, /**< A process has been cancelled */
_LV_EVENT_LAST /** Number of default events*/
}lv_event_t;
@ -153,7 +156,7 @@ enum {
LV_STATE_DEFAULT = 0x00,
LV_STATE_CHECKED = 0x01,
LV_STATE_FOCUSED = 0x02,
LV_STATE_KEY_FOCUSED = 0x04,
LV_STATE_FOCUS_GROUP = 0x04,
LV_STATE_EDITED = 0x08,
LV_STATE_HOVERED = 0x10,
LV_STATE_PRESSED = 0x20,
@ -233,6 +236,7 @@ typedef uint32_t lv_obj_flag_t;
#include "lv_obj_style.h"
#include "lv_obj_draw.h"
#include "lv_grid.h"
#include "lv_group.h"
#include "lv_flex.h"
/**
@ -261,13 +265,11 @@ extern const lv_obj_class_t lv_obj;
typedef struct {
struct _lv_obj_t ** children; /**< Store the pointer of the children in an array.*/
uint32_t child_cnt; /**< Number of children */
#if LV_USE_GROUP != 0
void * group_p;
#endif
lv_group_t * group_p;
const lv_layout_dsc_t * layout_dsc; /**< Pointer to the layout descriptor*/
lv_event_cb_t event_cb; /**< Event callback function */
lv_event_cb_t * event_cb; /**< Event callback function */
lv_point_t scroll; /**< The current X/Y scroll offset*/
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY
@ -282,6 +284,7 @@ typedef struct {
lv_snap_align_t snap_align_y : 2; /**< Where to align the snapable children horizontally*/
lv_dir_t scroll_dir :4; /**< The allowed scroll direction(s)*/
lv_bidi_dir_t base_dir : 2; /**< Base direction of texts related to this object */
uint8_t event_cb_cnt; /**< Number of event callabcks stored in `event_cb` array */
}lv_obj_spec_attr_t;
typedef struct _lv_obj_t{
@ -345,7 +348,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy);
* @param data arbitrary data depending on the object type and the event. (Usually `NULL`)
* @return LV_RES_OK: `obj` was not deleted in the event; LV_RES_INV: `obj` was deleted in the event
*/
lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data);
lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * data);
/**
* Get the `data` parameter of the current event
@ -449,10 +452,11 @@ lv_state_t lv_obj_get_state(const lv_obj_t * obj);
/**
* Get the event function of an object
* @param obj pointer to an object
* @param obj: pointer to an object
* @param id: the index of the event callback. 0: the firstly added
* @return the event function
*/
lv_event_cb_t lv_obj_get_event_cb(const lv_obj_t * obj);
lv_event_cb_t lv_obj_get_event_cb(const lv_obj_t * obj, uint32_t id);
/**
* Get the group of the object

View File

@ -28,10 +28,8 @@ void lv_obj_move_children_by(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_dif
/**********************
* STATIC PROTOTYPES
**********************/
#if LV_USE_ANIMATION
static void scroll_anim_x_cb(lv_obj_t * obj, lv_anim_value_t v);
static void scroll_anim_y_cb(lv_obj_t * obj, lv_anim_value_t v);
#endif
/**********************
* STATIC VARIABLES
@ -219,17 +217,12 @@ lv_coord_t lv_obj_get_scroll_right(lv_obj_t * obj)
void lv_obj_get_scroll_end(struct _lv_obj_t * obj, lv_point_t * end)
{
#if LV_USE_ANIMATION
lv_anim_t * a;
a = lv_anim_get(obj, (lv_anim_exec_xcb_t)scroll_anim_x_cb);
end->x = a ? -a->end : lv_obj_get_scroll_x(obj);
a = lv_anim_get(obj, (lv_anim_exec_xcb_t)scroll_anim_y_cb);
end->y = a ? -a->end : lv_obj_get_scroll_y(obj);
#else
end->x = lv_obj_get_scroll_x(obj);
end->y = lv_obj_get_scroll_y(obj);
#endif
}
/*=====================
@ -254,11 +247,7 @@ void _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en)
{
if(x == 0 && y == 0) return;
#if LV_USE_ANIMATION == 0
anim_en = LV_ANIM_OFF;
#endif
if(anim_en == LV_ANIM_ON) {
#if LV_USE_ANIMATION
lv_disp_t * d = lv_obj_get_disp(obj);
lv_anim_t a;
lv_anim_init(&a);
@ -291,13 +280,10 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable
lv_anim_set_path(&a, &path);
lv_anim_start(&a);
}
#endif
} else {
/*Remove pending animations*/
#if LV_USE_ANIMATION
lv_anim_del(obj, (lv_anim_exec_xcb_t) scroll_anim_y_cb);
lv_anim_del(obj, (lv_anim_exec_xcb_t) scroll_anim_x_cb);
#endif
_lv_obj_scroll_by_raw(obj, x, y);
}
}
@ -310,17 +296,13 @@ void lv_obj_scroll_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable
void lv_obj_scroll_to_x(lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en)
{
#if LV_USE_ANIMATION
lv_anim_del(obj, (lv_anim_exec_xcb_t) scroll_anim_x_cb);
#endif
lv_obj_scroll_by(obj, -x + lv_obj_get_scroll_x(obj), 0, anim_en);
}
void lv_obj_scroll_to_y(lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en)
{
#if LV_USE_ANIMATION
lv_anim_del(obj, (lv_anim_exec_xcb_t) scroll_anim_y_cb);
#endif
lv_obj_scroll_by(obj, 0, -y + lv_obj_get_scroll_y(obj), anim_en);
}
@ -358,7 +340,6 @@ void lv_obj_scroll_to_view(lv_obj_t * obj, lv_anim_enable_t anim_en)
* STATIC FUNCTIONS
**********************/
#if LV_USE_ANIMATION
static void scroll_anim_x_cb(lv_obj_t * obj, lv_anim_value_t v)
{
_lv_obj_scroll_by_raw(obj, v + lv_obj_get_scroll_x(obj), 0);
@ -368,4 +349,3 @@ static void scroll_anim_y_cb(lv_obj_t * obj, lv_anim_value_t v)
{
_lv_obj_scroll_by_raw(obj, 0, v + lv_obj_get_scroll_y(obj));
}
#endif

View File

@ -89,9 +89,7 @@ void _lv_obj_style_init(void)
*/
void lv_obj_add_style(struct _lv_obj_t * obj, uint32_t part, uint32_t state, lv_style_t * style)
{
#if LV_USE_ANIMATION
trans_del(obj, part, 0xFF, NULL);
#endif
uint32_t i;
/*Go after the transition and local styles*/
@ -435,7 +433,6 @@ _lv_style_state_cmp_t lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t stat
}
#if LV_USE_ANIMATION
/**
* Fade in (from transparent to fully cover) an object and all its children using an `opa_scale` animation.
* @param obj the object to fade in
@ -472,7 +469,7 @@ void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay)
lv_anim_set_delay(&a, delay);
lv_anim_start(&a);
}
#endif
/**********************
* STATIC FUNCTIONS
**********************/

View File

@ -329,16 +329,12 @@ static void obj_del_core(lv_obj_t * obj)
if(res == LV_RES_INV) return;
/*Delete from the group*/
#if LV_USE_GROUP
lv_group_t * group = lv_obj_get_group(obj);
if(group) lv_group_remove_obj(obj);
#endif
/*Remove the animations from this object*/
#if LV_USE_ANIMATION
lv_anim_del(obj, NULL);
// _lv_obj_remove_style_trans(obj);
#endif
/*Delete the user data*/
#if LV_USE_USER_DATA
@ -365,11 +361,9 @@ static void obj_del_core(lv_obj_t * obj)
indev->proc.types.pointer.last_pressed = NULL;
}
#if LV_USE_GROUP
if(indev->group == group && obj == lv_indev_get_obj_act()) {
lv_indev_reset(indev, obj);
}
#endif
indev = lv_indev_get_next(indev);
}

View File

@ -80,9 +80,7 @@ void _lv_refr_init(void)
*/
void lv_refr_now(lv_disp_t * disp)
{
#if LV_USE_ANIMATION
lv_anim_refr_now();
#endif
if(disp) {
_lv_disp_refr_task(disp->read_task);

View File

@ -23,9 +23,7 @@
* TYPEDEFS
**********************/
typedef struct {
#if LV_USE_FILESYSTEM
lv_fs_file_t * f;
#endif
lv_color_t * palette;
lv_opa_t * opa;
} lv_img_decoder_built_in_data_t;
@ -271,7 +269,6 @@ lv_res_t lv_img_decoder_built_in_info(lv_img_decoder_t * decoder, const void * s
header->h = ((lv_img_dsc_t *)src)->header.h;
header->cf = ((lv_img_dsc_t *)src)->header.cf;
}
#if LV_USE_FILESYSTEM
else if(src_type == LV_IMG_SRC_FILE) {
lv_fs_file_t * f;
uint32_t rn;
@ -288,7 +285,6 @@ lv_res_t lv_img_decoder_built_in_info(lv_img_decoder_t * decoder, const void * s
if(header->cf < CF_BUILT_IN_FIRST || header->cf > CF_BUILT_IN_LAST) return LV_RES_INV;
}
#endif
else if(src_type == LV_IMG_SRC_SYMBOL) {
/*The size depend on the font but it is unknown here. It should be handled outside of the
* function*/
@ -315,8 +311,6 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
{
/*Open the file if it's a file*/
if(dsc->src_type == LV_IMG_SRC_FILE) {
#if LV_USE_FILESYSTEM
/*Support only "*.bin" files*/
if(strcmp(lv_fs_get_ext(dsc->src), "bin")) return LV_RES_INV;
@ -339,10 +333,6 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
user_data->f = f;
#else
LV_LOG_WARN("Image built-in decoder cannot read file because LV_USE_FILESYSTEM = 0");
return LV_RES_INV;
#endif
}
else if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
/*The variables should have valid data*/
@ -370,7 +360,6 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
else if(cf == LV_IMG_CF_INDEXED_1BIT || cf == LV_IMG_CF_INDEXED_2BIT || cf == LV_IMG_CF_INDEXED_4BIT ||
cf == LV_IMG_CF_INDEXED_8BIT) {
#if LV_IMG_CF_INDEXED
uint8_t px_size = lv_img_cf_get_px_size(cf);
uint32_t palette_size = 1 << px_size;
@ -399,7 +388,6 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
if(dsc->src_type == LV_IMG_SRC_FILE) {
/*Read the palette from file*/
#if LV_USE_FILESYSTEM
lv_fs_seek(user_data->f, 4, LV_FS_SEEK_SET); /*Skip the header*/
lv_color32_t cur_color;
uint32_t i;
@ -408,10 +396,6 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
user_data->palette[i] = lv_color_make(cur_color.ch.red, cur_color.ch.green, cur_color.ch.blue);
user_data->opa[i] = cur_color.ch.alpha;
}
#else
LV_LOG_WARN("Image built-in decoder can read the palette because LV_USE_FILESYSTEM = 0");
return LV_RES_INV;
#endif
}
else {
/*The palette begins in the beginning of the image data. Just point to it.*/
@ -426,21 +410,12 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
dsc->img_data = NULL;
return LV_RES_OK;
#else
LV_LOG_WARN("Indexed (palette) images are not enabled in lv_conf.h. See LV_IMG_CF_INDEXED");
return LV_RES_INV;
#endif
}
/*Alpha indexed images. */
else if(cf == LV_IMG_CF_ALPHA_1BIT || cf == LV_IMG_CF_ALPHA_2BIT || cf == LV_IMG_CF_ALPHA_4BIT ||
cf == LV_IMG_CF_ALPHA_8BIT) {
#if LV_IMG_CF_ALPHA
dsc->img_data = NULL;
return LV_RES_OK; /*Nothing to process*/
#else
LV_LOG_WARN("Alpha indexed images are not enabled in lv_conf.h. See LV_IMG_CF_ALPHA");
return LV_RES_INV;
#endif
}
/*Unknown format. Can't decode it.*/
else {
@ -506,11 +481,9 @@ void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_ds
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
if(user_data) {
#if LV_USE_FILESYSTEM
if(user_data->f) {
lv_fs_close(user_data->f);
}
#endif
if(user_data->palette) lv_mem_free(user_data->palette);
if(user_data->opa) lv_mem_free(user_data->opa);
@ -527,7 +500,6 @@ void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_ds
static lv_res_t lv_img_decoder_built_in_line_true_color(lv_img_decoder_dsc_t * dsc, lv_coord_t x, lv_coord_t y,
lv_coord_t len, uint8_t * buf)
{
#if LV_USE_FILESYSTEM
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
lv_fs_res_t res;
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf);
@ -548,22 +520,12 @@ static lv_res_t lv_img_decoder_built_in_line_true_color(lv_img_decoder_dsc_t * d
}
return LV_RES_OK;
#else
LV_UNUSED(dsc);
LV_UNUSED(x);
LV_UNUSED(y);
LV_UNUSED(len);
LV_UNUSED(buf);
LV_LOG_WARN("Image built-in decoder cannot read file because LV_USE_FILESYSTEM = 0");
return LV_RES_INV;
#endif
}
static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, lv_coord_t x, lv_coord_t y,
lv_coord_t len, uint8_t * buf)
{
#if LV_IMG_CF_ALPHA
const lv_opa_t alpha1_opa_table[2] = {0, 255}; /*Opacity mapping with bpp = 1 (Just for compatibility)*/
const lv_opa_t alpha2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/
const lv_opa_t alpha4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
@ -623,10 +585,8 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
break;
}
#if LV_USE_FILESYSTEM
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
uint8_t * fs_buf = lv_mem_buf_get(w);
#endif
const uint8_t * data_tmp = NULL;
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
@ -635,15 +595,9 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
data_tmp = img_dsc->data + ofs;
}
else {
#if LV_USE_FILESYSTEM
lv_fs_seek(user_data->f, ofs + 4, LV_FS_SEEK_SET); /*+4 to skip the header*/
lv_fs_read(user_data->f, fs_buf, w, NULL);
data_tmp = fs_buf;
#else
LV_LOG_WARN("Image built-in alpha line reader can't read file because LV_USE_FILESYSTEM = 0");
data_tmp = NULL; /*To avoid warnings*/
return LV_RES_INV;
#endif
}
for(i = 0; i < len; i++) {
@ -658,22 +612,13 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
data_tmp++;
}
}
#if LV_USE_FILESYSTEM
lv_mem_buf_release(fs_buf);
#endif
return LV_RES_OK;
#else
LV_LOG_WARN("Image built-in alpha line reader failed because LV_IMG_CF_ALPHA is 0 in lv_conf.h");
return LV_RES_INV;
#endif
}
static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc, lv_coord_t x, lv_coord_t y,
lv_coord_t len, uint8_t * buf)
{
#if LV_IMG_CF_INDEXED
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf);
uint16_t mask = (1 << px_size) - 1; /*E.g. px_size = 2; mask = 0x03*/
@ -712,24 +657,16 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
#if LV_USE_FILESYSTEM
uint8_t * fs_buf = lv_mem_buf_get(w);
#endif
const uint8_t * data_tmp = NULL;
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
const lv_img_dsc_t * img_dsc = dsc->src;
data_tmp = img_dsc->data + ofs;
}
else {
#if LV_USE_FILESYSTEM
lv_fs_seek(user_data->f, ofs + 4, LV_FS_SEEK_SET); /*+4 to skip the header*/
lv_fs_read(user_data->f, fs_buf, w, NULL);
data_tmp = fs_buf;
#else
LV_LOG_WARN("Image built-in indexed line reader can't read file because LV_USE_FILESYSTEM = 0");
data_tmp = NULL; /*To avoid warnings*/
return LV_RES_INV;
#endif
}
lv_coord_t i;
@ -756,12 +693,6 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
data_tmp++;
}
}
#if LV_USE_FILESYSTEM
lv_mem_buf_release(fs_buf);
#endif
return LV_RES_OK;
#else
LV_LOG_WARN("Image built-in indexed line reader failed because LV_IMG_CF_INDEXED is 0 in lv_conf.h");
return LV_RES_INV;
#endif
}

View File

@ -90,7 +90,7 @@ typedef struct _lv_img_decoder {
lv_img_decoder_close_f_t close_cb;
#if LV_USE_USER_DATA
lv_img_decoder_user_data_t user_data;
lv_user_data_t user_data;
#endif
} lv_img_decoder_t;

View File

@ -14,8 +14,6 @@
#include "../lv_misc/lv_fs.h"
#include "lv_font_loader.h"
#if LV_USE_FILESYSTEM
/**********************
* TYPEDEFS
**********************/
@ -684,5 +682,3 @@ int32_t load_kern(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, uint8_t f
return kern_length;
}
#endif /*LV_USE_FILESYSTEM*/

View File

@ -26,13 +26,9 @@ extern "C" {
* GLOBAL PROTOTYPES
**********************/
#if LV_USE_FILESYSTEM
lv_font_t * lv_font_load(const char * fontName);
void lv_font_free(lv_font_t * font);
#endif
/**********************
* MACROS
**********************/

View File

@ -155,9 +155,7 @@ typedef struct _disp_t {
struct _lv_obj_t ** screens; /**< Array of screen objects. `NULL` terminated*/
struct _lv_obj_t * act_scr; /**< Currently active screen on this display */
struct _lv_obj_t * prev_scr; /**< Previous screen. Used during screen animations */
#if LV_USE_ANIMATION
struct _lv_obj_t * scr_to_load; /**< The screen prepared to load in lv_scr_load_anim*/
#endif
struct _lv_obj_t * top_layer; /**< @see lv_disp_get_layer_top */
struct _lv_obj_t * sys_layer; /**< @see lv_disp_get_layer_sys */
uint32_t screen_cnt;

View File

@ -8,7 +8,6 @@
*********************/
#include "lv_anim.h"
#if LV_USE_ANIMATION
#include <stddef.h>
#include <string.h>
#include "../lv_misc/lv_debug.h"
@ -575,4 +574,3 @@ static void anim_mark_list_change(void)
else
lv_timer_pause(_lv_anim_tmr, false);
}
#endif

View File

@ -38,8 +38,6 @@ typedef uint8_t lv_anim_enable_t;
/** Type of the animated value*/
typedef lv_coord_t lv_anim_value_t;
#if LV_USE_ANIMATION
#define LV_ANIM_REPEAT_INFINITE 0xFFFF
struct _lv_anim_t;
@ -80,7 +78,7 @@ typedef struct _lv_anim_t {
int32_t start; /**< Start value*/
int32_t current; /**< Current value */
int32_t end; /**< End value*/
int32_t time; /**< Animation time in ms*/
int32_t time; /**< Animation time in ms*/
int32_t act_time; /**< Current time in animation. Set to negative to make delay.*/
uint32_t playback_delay; /**< Wait before play back*/
uint32_t playback_time; /**< Duration of playback animation*/
@ -88,7 +86,7 @@ typedef struct _lv_anim_t {
uint16_t repeat_cnt; /**< Repeat count for the animation*/
uint8_t early_apply : 1; /**< 1: Apply start value immediately even is there is `delay` */
#if LV_USE_USER_DATA
lv_anim_user_data_t user_data; /**< Custom user data*/
lv_user_data_t user_data; /**< Custom user data*/
#endif
/*Animation system use these - user shouldn't set*/
@ -418,4 +416,3 @@ extern const lv_anim_path_t lv_anim_path_def;
} /* extern "C" */
#endif
#endif /*LV_ANIM_H*/

View File

@ -7,7 +7,6 @@
* INCLUDES
*********************/
#include "lv_fs.h"
#if LV_USE_FILESYSTEM
#include "../lv_misc/lv_debug.h"
#include "lv_ll.h"
@ -47,20 +46,11 @@ static const char * lv_fs_get_real_path(const char * path);
* GLOBAL FUNCTIONS
**********************/
/**
* Initialize the File system interface
*/
void _lv_fs_init(void)
{
_lv_ll_init(&LV_GC_ROOT(_lv_drv_ll), sizeof(lv_fs_drv_t));
}
/**
* Test if a drive is ready or not. If the `ready` function was not initialized `true` will be
* returned.
* @param letter letter of the drive
* @return true: drive is ready; false: drive is not ready
*/
bool lv_fs_is_ready(char letter)
{
lv_fs_drv_t * drv = lv_fs_get_drv(letter);
@ -72,13 +62,6 @@ bool lv_fs_is_ready(char letter)
return drv->ready_cb(drv);
}
/**
* Open a file
* @param file_p pointer to a lv_fs_file_t variable
* @param path path to the file beginning with the driver letter (e.g. S:/folder/file.txt)
* @param mode read: FS_MODE_RD, write: FS_MODE_WR, both: FS_MODE_RD | FS_MODE_WR
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
void * lv_fs_open(const char * path, lv_fs_mode_t mode)
{
if(path == NULL) {
@ -126,11 +109,6 @@ void * lv_fs_open(const char * path, lv_fs_mode_t mode)
return file_p;
}
/**
* Close an already opened file
* @param file_p pointer to a lv_fs_file_t variable
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_close(lv_fs_file_t * file_p)
{
if(file_p->drv == NULL) {
@ -148,39 +126,6 @@ lv_fs_res_t lv_fs_close(lv_fs_file_t * file_p)
return res;
}
/**
* Delete a file
* @param path path of the file to delete
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_remove(const char * path)
{
if(path == NULL) return LV_FS_RES_INV_PARAM;
char letter = path[0];
lv_fs_drv_t * drv = lv_fs_get_drv(letter);
if(drv == NULL) return LV_FS_RES_NOT_EX;
if(drv->ready_cb != NULL) {
if(drv->ready_cb(drv) == false) return LV_FS_RES_HW_ERR;
}
if(drv->remove_cb == NULL) return LV_FS_RES_NOT_IMP;
const char * real_path = lv_fs_get_real_path(path);
lv_fs_res_t res = drv->remove_cb(drv, real_path);
return res;
}
/**
* Read from a file
* @param file_p pointer to a lv_fs_file_t variable
* @param buf pointer to a buffer where the read bytes are stored
* @param btr Bytes To Read
* @param br the number of real read bytes (Bytes Read). NULL if unused.
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_read(lv_fs_file_t * file_p, void * buf, uint32_t btr, uint32_t * br)
{
if(br != NULL) *br = 0;
@ -194,14 +139,6 @@ lv_fs_res_t lv_fs_read(lv_fs_file_t * file_p, void * buf, uint32_t btr, uint32_t
return res;
}
/**
* Write into a file
* @param file_p pointer to a lv_fs_file_t variable
* @param buf pointer to a buffer with the bytes to write
* @param btr Bytes To Write
* @param br the number of real written bytes (Bytes Written). NULL if unused.
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_write(lv_fs_file_t * file_p, const void * buf, uint32_t btw, uint32_t * bw)
{
if(bw != NULL) *bw = 0;
@ -221,12 +158,6 @@ lv_fs_res_t lv_fs_write(lv_fs_file_t * file_p, const void * buf, uint32_t btw, u
return res;
}
/**
* Set the position of the 'cursor' (read write pointer) in a file
* @param file_p pointer to a lv_fs_file_t variable
* @param pos the new position expressed in bytes index (0: start of file)
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_seek(lv_fs_file_t * file_p, uint32_t pos, lv_fs_whence_t whence)
{
if(file_p->drv == NULL) {
@ -242,12 +173,6 @@ lv_fs_res_t lv_fs_seek(lv_fs_file_t * file_p, uint32_t pos, lv_fs_whence_t whenc
return res;
}
/**
* Give the position of the read write pointer
* @param file_p pointer to a lv_fs_file_t variable
* @param pos_p pointer to store the position of the read write pointer
* @return LV_FS_RES_OK or any error from 'fs_res_t'
*/
lv_fs_res_t lv_fs_tell(lv_fs_file_t * file_p, uint32_t * pos)
{
if(file_p->drv == NULL) {
@ -265,87 +190,6 @@ lv_fs_res_t lv_fs_tell(lv_fs_file_t * file_p, uint32_t * pos)
return res;
}
/**
* Truncate the file size to the current position of the read write pointer
* @param file_p pointer to an 'ufs_file_t' variable. (opened with lv_fs_open )
* @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_trunc(lv_fs_file_t * file_p)
{
if(file_p->drv == NULL) {
return LV_FS_RES_INV_PARAM;
}
if(file_p->drv->trunc_cb == NULL) {
return LV_FS_RES_NOT_IMP;
}
lv_fs_res_t res = file_p->drv->trunc_cb(file_p->drv, file_p->file_d);
return res;
}
/**
* Give the size of a file bytes
* @param file_p pointer to a lv_fs_file_t variable
* @param size pointer to a variable to store the size
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_size(lv_fs_file_t * file_p, uint32_t * size)
{
if(file_p->drv == NULL) {
return LV_FS_RES_INV_PARAM;
}
if(file_p->drv->size_cb == NULL) return LV_FS_RES_NOT_IMP;
if(size == NULL) return LV_FS_RES_INV_PARAM;
lv_fs_res_t res = file_p->drv->size_cb(file_p->drv, file_p->file_d, size);
return res;
}
/**
* Rename a file
* @param oldname path to the file
* @param newname path with the new name
* @return LV_FS_RES_OK or any error from 'fs_res_t'
*/
lv_fs_res_t lv_fs_rename(const char * oldname, const char * newname)
{
if(!oldname || !newname) return LV_FS_RES_INV_PARAM;
char letter = oldname[0];
lv_fs_drv_t * drv = lv_fs_get_drv(letter);
if(!drv) {
return LV_FS_RES_NOT_EX;
}
if(drv->ready_cb != NULL) {
if(drv->ready_cb(drv) == false) {
return LV_FS_RES_HW_ERR;
}
}
if(drv->rename_cb == NULL) return LV_FS_RES_NOT_IMP;
const char * old_real = lv_fs_get_real_path(oldname);
const char * new_real = lv_fs_get_real_path(newname);
lv_fs_res_t res = drv->rename_cb(drv, old_real, new_real);
return res;
}
/**
* Initialize a 'lv_fs_dir_t' variable for directory reading
* @param rddir_p pointer to a 'lv_fs_dir_t' variable
* @param path path to a directory
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path)
{
rddir_p->drv = NULL;
@ -398,13 +242,6 @@ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path)
return res;
}
/**
* Read the next filename form a directory.
* The name of the directories will begin with '/'
* @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable
* @param fn pointer to a buffer to store the filename
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_dir_read(lv_fs_dir_t * rddir_p, char * fn)
{
if(rddir_p->drv == NULL || rddir_p->dir_d == NULL) {
@ -422,11 +259,6 @@ lv_fs_res_t lv_fs_dir_read(lv_fs_dir_t * rddir_p, char * fn)
return res;
}
/**
* Close the directory reading
* @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_dir_close(lv_fs_dir_t * rddir_p)
{
if(rddir_p->drv == NULL || rddir_p->dir_d == NULL) {
@ -446,57 +278,11 @@ lv_fs_res_t lv_fs_dir_close(lv_fs_dir_t * rddir_p)
return res;
}
/**
* Get the free and total size of a driver in kB
* @param letter the driver letter
* @param total_p pointer to store the total size [kB]
* @param free_p pointer to store the free size_cb [kB]
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_free_space(char letter, uint32_t * total_p, uint32_t * free_p)
{
lv_fs_drv_t * drv = lv_fs_get_drv(letter);
if(drv == NULL) {
return LV_FS_RES_INV_PARAM;
}
if(drv->ready_cb != NULL) {
if(drv->ready_cb(drv) == false) {
return LV_FS_RES_HW_ERR;
}
}
if(drv->free_space_cb == NULL) {
return LV_FS_RES_NOT_IMP;
}
uint32_t total_tmp = 0;
uint32_t free_tmp = 0;
lv_fs_res_t res = drv->free_space_cb(drv, &total_tmp, &free_tmp);
if(total_p != NULL) *total_p = total_tmp;
if(free_p != NULL) *free_p = free_tmp;
return res;
}
/**
* Initialize a file system driver with default values.
* It is used to surly have known values in the fields ant not memory junk.
* After it you can set the fields.
* @param drv pointer to driver variable to initialize
*/
void lv_fs_drv_init(lv_fs_drv_t * drv)
{
lv_memset_00(drv, sizeof(lv_fs_drv_t));
}
/**
* Add a new drive
* @param drv_p pointer to an lv_fs_drv_t structure which is inited with the
* corresponding function pointers. The data will be copied so the variable can be local.
*/
void lv_fs_drv_register(lv_fs_drv_t * drv_p)
{
/*Save the new driver*/
@ -508,11 +294,6 @@ void lv_fs_drv_register(lv_fs_drv_t * drv_p)
lv_memcpy(new_drv, drv_p, sizeof(lv_fs_drv_t));
}
/**
* Give a pointer to a driver from its letter
* @param letter the driver letter
* @return pointer to a driver or NULL if not found
*/
lv_fs_drv_t * lv_fs_get_drv(char letter)
{
lv_fs_drv_t * drv;
@ -525,11 +306,7 @@ lv_fs_drv_t * lv_fs_get_drv(char letter)
return NULL;
}
/**
* Fill a buffer with the letters of existing drivers
* @param buf buffer to store the letters ('\0' added after the last letter)
* @return the buffer
*/
char * lv_fs_get_letters(char * buf)
{
lv_fs_drv_t * drv;
@ -545,11 +322,6 @@ char * lv_fs_get_letters(char * buf)
return buf;
}
/**
* Return with the extension of the filename
* @param fn string with a filename
* @return pointer to the beginning extension or empty string if no extension
*/
const char * lv_fs_get_ext(const char * fn)
{
size_t i;
@ -565,11 +337,6 @@ const char * lv_fs_get_ext(const char * fn)
return ""; /*Empty string if no '.' in the file name. */
}
/**
* Step up one level
* @param path pointer to a file name
* @return the truncated file name
*/
char * lv_fs_up(char * path)
{
size_t len = strlen(path);
@ -596,11 +363,6 @@ char * lv_fs_up(char * path)
return path;
}
/**
* Get the last element of a path (e.g. U:/folder/file -> file)
* @param path a character sting with the path to search in
* @return pointer to the beginning of the last element in the path
*/
const char * lv_fs_get_last(const char * path)
{
size_t len = strlen(path);
@ -653,5 +415,3 @@ static const char * lv_fs_get_real_path(const char * path)
return path;
}
#endif /*LV_USE_FILESYSTEM*/

View File

@ -15,8 +15,6 @@ extern "C" {
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_FILESYSTEM
#include <stdint.h>
#include <stdbool.h>
@ -77,22 +75,17 @@ typedef struct _lv_fs_drv_t {
void * (*open_cb)(struct _lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode);
lv_fs_res_t (*close_cb)(struct _lv_fs_drv_t * drv, void * file_p);
lv_fs_res_t (*remove_cb)(struct _lv_fs_drv_t * drv, const char * fn);
lv_fs_res_t (*read_cb)(struct _lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br);
lv_fs_res_t (*write_cb)(struct _lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw);
lv_fs_res_t (*seek_cb)(struct _lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs_whence_t whence);
lv_fs_res_t (*tell_cb)(struct _lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p);
lv_fs_res_t (*trunc_cb)(struct _lv_fs_drv_t * drv, void * file_p);
lv_fs_res_t (*size_cb)(struct _lv_fs_drv_t * drv, void * file_p, uint32_t * size_p);
lv_fs_res_t (*rename_cb)(struct _lv_fs_drv_t * drv, const char * oldname, const char * newname);
lv_fs_res_t (*free_space_cb)(struct _lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * free_p);
lv_fs_res_t (*dir_open_cb)(struct _lv_fs_drv_t * drv, void * rddir_p, const char * path);
lv_fs_res_t (*dir_read_cb)(struct _lv_fs_drv_t * drv, void * rddir_p, char * fn);
lv_fs_res_t (*dir_close_cb)(struct _lv_fs_drv_t * drv, void * rddir_p);
#if LV_USE_USER_DATA
lv_fs_drv_user_data_t user_data; /**< Custom file user data */
lv_user_data_t user_data; /**< Custom file user data */
#endif
} lv_fs_drv_t;
@ -161,13 +154,6 @@ void * lv_fs_open(const char * path, lv_fs_mode_t mode);
*/
lv_fs_res_t lv_fs_close(lv_fs_file_t * file_p);
/**
* Delete a file
* @param path path of the file to delete
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_remove(const char * path);
/**
* Read from a file
* @param file_p pointer to a lv_fs_file_t variable
@ -204,30 +190,6 @@ lv_fs_res_t lv_fs_seek(lv_fs_file_t * file_p, uint32_t pos, lv_fs_whence_t whenc
*/
lv_fs_res_t lv_fs_tell(lv_fs_file_t * file_p, uint32_t * pos);
/**
* Truncate the file size to the current position of the read write pointer
* @param file_p pointer to an 'ufs_file_t' variable. (opened with lv_fs_open )
* @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_trunc(lv_fs_file_t * file_p);
/**
* Give the size of a file bytes
* @param file_p pointer to a lv_fs_file_t variable
* @param size pointer to a variable to store the size
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_size(lv_fs_file_t * file_p, uint32_t * size);
/**
* Rename a file
* @param oldname path to the file
* @param newname path with the new name
* @return LV_FS_RES_OK or any error from 'fs_res_t'
*/
lv_fs_res_t lv_fs_rename(const char * oldname, const char * newname);
/**
* Initialize a 'fs_dir_t' variable for directory reading
* @param rddir_p pointer to a 'lv_fs_dir_t' variable
@ -252,15 +214,6 @@ lv_fs_res_t lv_fs_dir_read(lv_fs_dir_t * rddir_p, char * fn);
*/
lv_fs_res_t lv_fs_dir_close(lv_fs_dir_t * rddir_p);
/**
* Get the free and total size of a driver in kB
* @param letter the driver letter
* @param total_p pointer to store the total size [kB]
* @param free_p pointer to store the free size [kB]
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_free_space(char letter, uint32_t * total_p, uint32_t * free_p);
/**
* Fill a buffer with the letters of existing drivers
* @param buf buffer to store the letters ('\0' added after the last letter)
@ -299,4 +252,3 @@ const char * lv_fs_get_last(const char * path);
} /* extern "C" */
#endif
#endif /*LV_FS_H*/

View File

@ -680,15 +680,13 @@ static lv_res_t lv_arc_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
arc->dragging = false;
#if LV_USE_GROUP
/*Leave edit mode if released. (No need to wait for LONG_PRESS) */
lv_group_t * g = lv_obj_get_group(arc);
lv_group_t * g = lv_obj_get_group(obj);
bool editing = lv_group_get_editing(g);
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
if(indev_type == LV_INDEV_TYPE_ENCODER) {
if(editing) lv_group_set_editing(g, false);
}
#endif
}
else if(sign == LV_SIGNAL_CONTROL) {

View File

@ -23,12 +23,9 @@
#define LV_BAR_SIZE_MIN 4 /*hor. pad and ver. pad cannot make the indicator smaller then this [px]*/
#if LV_USE_ANIMATION
#define LV_BAR_IS_ANIMATING(anim_struct) (((anim_struct).anim_state) != LV_BAR_ANIM_STATE_INV)
#define LV_BAR_GET_ANIM_VALUE(orig_value, anim_struct) (LV_BAR_IS_ANIMATING(anim_struct) ? ((anim_struct).anim_end) : (orig_value))
#else
#define LV_BAR_GET_ANIM_VALUE(orig_value, anim_struct) (orig_value)
#endif
#define LV_BAR_IS_ANIMATING(anim_struct) (((anim_struct).anim_state) != LV_BAR_ANIM_STATE_INV)
#define LV_BAR_GET_ANIM_VALUE(orig_value, anim_struct) (LV_BAR_IS_ANIMATING(anim_struct) ? ((anim_struct).anim_end) : (orig_value))
/**********************
* TYPEDEFS
**********************/
@ -42,13 +39,11 @@ static lv_draw_res_t lv_bar_draw(lv_obj_t * bar, const lv_area_t * clip_area, lv
static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param);
static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area);
#if LV_USE_ANIMATION
static void lv_bar_set_value_with_anim(lv_obj_t * obj, int16_t new_value, int16_t * value_ptr,
lv_bar_anim_t * anim_info, lv_anim_enable_t en);
static void lv_bar_init_anim(lv_obj_t * bar, lv_bar_anim_t * bar_anim);
static void lv_bar_anim(lv_bar_anim_t * bar, lv_anim_value_t value);
static void lv_bar_anim_ready(lv_anim_t * a);
#endif
/**********************
* STATIC VARIABLES
@ -102,13 +97,7 @@ void lv_bar_set_value(lv_obj_t * obj, int16_t value, lv_anim_enable_t anim)
value = value < bar->start_value ? bar->start_value : value; /*Can be smaller then the left value*/
if(bar->cur_value == value) return;
#if LV_USE_ANIMATION == 0
LV_UNUSED(anim);
bar->cur_value = value;
lv_obj_invalidate(bar);
#else
lv_bar_set_value_with_anim(obj, value, &bar->cur_value, &bar->cur_value_anim, anim);
#endif
}
/**
@ -129,12 +118,7 @@ void lv_bar_set_start_value(lv_obj_t * obj, int16_t start_value, lv_anim_enable_
new_value = new_value > bar->cur_value ? bar->cur_value : new_value;
if(bar->start_value == new_value) return;
#if LV_USE_ANIMATION == 0
LV_UNUSED(anim);
bar->start_value = new_value;
#else
lv_bar_set_value_with_anim(obj, new_value, &bar->start_value, &bar->start_value_anim, anim);
#endif
}
/**
@ -272,10 +256,8 @@ static void lv_bar_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t
bar->cur_value = 0;
bar->type = LV_BAR_TYPE_NORMAL;
#if LV_USE_ANIMATION
lv_bar_init_anim(obj, &bar->cur_value_anim);
lv_bar_init_anim(obj, &bar->start_value_anim);
#endif
if(copy == NULL) {
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CHECKABLE);
@ -401,7 +383,6 @@ static void draw_indic(lv_obj_t * obj, const lv_area_t * clip_area)
indic_length_calc = lv_area_get_height;
}
#if LV_USE_ANIMATION
if(LV_BAR_IS_ANIMATING(bar->start_value_anim)) {
lv_coord_t anim_start_value_start_x =
(int32_t)((int32_t)anim_length * (bar->start_value_anim.anim_start - bar->min_value)) / range;
@ -414,12 +395,10 @@ static void draw_indic(lv_obj_t * obj, const lv_area_t * clip_area)
anim_start_value_x += anim_start_value_start_x;
}
else
#endif
{
anim_start_value_x = (int32_t)((int32_t)anim_length * (bar->start_value - bar->min_value)) / range;
}
#if LV_USE_ANIMATION
if(LV_BAR_IS_ANIMATING(bar->cur_value_anim)) {
lv_coord_t anim_cur_value_start_x =
(int32_t)((int32_t)anim_length * (bar->cur_value_anim.anim_start - bar->min_value)) / range;
@ -431,7 +410,6 @@ static void draw_indic(lv_obj_t * obj, const lv_area_t * clip_area)
LV_BAR_ANIM_STATE_END);
}
else
#endif
{
anim_cur_value_x = (int32_t)((int32_t)anim_length * (bar->cur_value - bar->min_value)) / range;
}
@ -580,7 +558,6 @@ static lv_res_t lv_bar_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
return res;
}
#if LV_USE_ANIMATION
static void lv_bar_anim(lv_bar_anim_t * var, lv_anim_value_t value)
{
var->anim_state = value;
@ -641,6 +618,5 @@ static void lv_bar_init_anim(lv_obj_t * obj, lv_bar_anim_t * bar_anim)
bar_anim->anim_end = 0;
bar_anim->anim_state = LV_BAR_ANIM_STATE_INV;
}
#endif
#endif

View File

@ -49,14 +49,12 @@ enum {
};
typedef uint8_t lv_bar_type_t;
#if LV_USE_ANIMATION
typedef struct {
lv_obj_t * bar;
lv_anim_value_t anim_start;
lv_anim_value_t anim_end;
lv_anim_value_t anim_state;
} lv_bar_anim_t;
#endif
typedef struct {
lv_obj_t obj;
@ -65,10 +63,8 @@ typedef struct {
int16_t max_value; /*Maximum value of the bar*/
int16_t start_value; /*Start value of the bar*/
lv_area_t indic_area; /*Save the indicator area. Might be used by derived types*/
#if LV_USE_ANIMATION
lv_bar_anim_t cur_value_anim;
lv_bar_anim_t start_value_anim;
#endif
uint8_t type : 2; /*Type of bar*/
}lv_bar_t;

View File

@ -10,10 +10,10 @@
#if LV_USE_BTNMATRIX != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_indev.h"
#include "../lv_core/lv_group.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_core/lv_refr.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_txt.h"
#include "../lv_misc/lv_txt_ap.h"
@ -763,13 +763,11 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * obj, lv_signal_t sign, void * par
}
}
}
#if LV_USE_GROUP
else if(indev_type == LV_INDEV_TYPE_KEYPAD || (indev_type == LV_INDEV_TYPE_ENCODER &&
lv_group_get_editing(lv_obj_get_group(obj)))) {
btnm->btn_id_pr = btnm->btn_id_focused;
invalidate_button_area(obj, btnm->btn_id_focused);
}
#endif
if(btnm->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {
if(button_is_click_trig(btnm->ctrl_bits[btnm->btn_id_pr]) == false &&
@ -860,7 +858,6 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * obj, lv_signal_t sign, void * par
lv_obj_invalidate(obj);
}
else if(sign == LV_SIGNAL_FOCUS) {
#if LV_USE_GROUP
lv_indev_t * indev = lv_indev_get_act();
lv_indev_type_t indev_type = lv_indev_get_type(indev);
@ -890,8 +887,6 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * obj, lv_signal_t sign, void * par
btnm->btn_id_focused = b;
btnm->btn_id_act = b;
}
#endif
}
else if(sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_LEAVE) {
if(btnm->btn_id_focused != LV_BTNMATRIX_BTN_NONE) invalidate_button_area(obj, btnm->btn_id_focused);
@ -901,7 +896,6 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * obj, lv_signal_t sign, void * par
btnm->btn_id_act = LV_BTNMATRIX_BTN_NONE;
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
char c = *((char *)param);
if(c == LV_KEY_RIGHT) {
if(btnm->btn_id_focused == LV_BTNMATRIX_BTN_NONE) btnm->btn_id_focused = 0;
@ -929,18 +923,10 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * obj, lv_signal_t sign, void * par
lv_obj_invalidate(obj);
}
else if(c == LV_KEY_DOWN) {
<<<<<<< HEAD
lv_coord_t col_gap = LV_MAX(lv_obj_get_style_margin_left(obj, LV_BTNMATRIX_PART_BTN), lv_obj_get_style_margin_right(obj, LV_BTNMATRIX_PART_BTN));
lv_coord_t col_gap = lv_obj_get_style_pad_column(obj, LV_PART_MAIN);
/*Find the area below the the current*/
if(btnm->btn_id_focused == LV_BTNMATRIX_BTN_NONE) {
btnm->btn_id_focused = 0;
=======
lv_style_int_t pad_inner = lv_obj_get_style_pad_inner(btnm, LV_BTNMATRIX_PART_BG);
/*Find the area below the current*/
if(ext->btn_id_focused == LV_BTNMATRIX_BTN_NONE) {
ext->btn_id_focused = 0;
>>>>>>> master
}
else {
uint16_t area_below;
@ -963,17 +949,10 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * obj, lv_signal_t sign, void * par
lv_obj_invalidate(obj);
}
else if(c == LV_KEY_UP) {
<<<<<<< HEAD
lv_coord_t col_gap = LV_MAX(lv_obj_get_style_margin_left(obj, LV_BTNMATRIX_PART_BTN), lv_obj_get_style_margin_right(obj, LV_BTNMATRIX_PART_BTN));
lv_coord_t col_gap = lv_obj_get_style_pad_column(obj, LV_PART_MAIN);
/*Find the area below the the current*/
if(btnm->btn_id_focused == LV_BTNMATRIX_BTN_NONE) {
btnm->btn_id_focused = 0;
=======
lv_style_int_t pad_inner = lv_obj_get_style_pad_inner(btnm, LV_BTNMATRIX_PART_BG);
/*Find the area below the current*/
if(ext->btn_id_focused == LV_BTNMATRIX_BTN_NONE) {
ext->btn_id_focused = 0;
>>>>>>> master
}
else {
int16_t area_above;
@ -994,7 +973,6 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * obj, lv_signal_t sign, void * par
btnm->btn_id_act = btnm->btn_id_focused;
lv_obj_invalidate(obj);
}
#endif
}
return res;
}

View File

@ -26,11 +26,6 @@
*********************/
#define LV_OBJX_NAME "lv_dropdown"
#if LV_USE_ANIMATION == 0
#undef LV_DROPDOWN_DEF_ANIM_TIME
#define LV_DROPDOWN_DEF_ANIM_TIME 0 /*No animation*/
#endif
#define LV_DROPDOWN_PR_NONE 0xFFFF
/**********************
@ -901,20 +896,18 @@ static lv_res_t lv_dropdown_signal(lv_obj_t * obj, lv_signal_t sign, void * para
lv_dropdown_t * dropdown = (lv_dropdown_t *) obj;
if(sign == LV_SIGNAL_FOCUS) {
#if LV_USE_GROUP
lv_group_t * g = lv_obj_get_group(ddlist);
lv_group_t * g = lv_obj_get_group(obj);
bool editing = lv_group_get_editing(g);
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
/*Encoders need special handling*/
if(indev_type == LV_INDEV_TYPE_ENCODER) {
/*Open the list if editing*/
if(editing) lv_dropdown_open(ddlist);
if(editing) lv_dropdown_open(obj);
/*Close the list if navigating*/
else
lv_dropdown_close(ddlist);
lv_dropdown_close(obj);
}
#endif
}
else if(sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_LEAVE) {
lv_dropdown_close(obj);
@ -931,12 +924,10 @@ static lv_res_t lv_dropdown_signal(lv_obj_t * obj, lv_signal_t sign, void * para
if(res != LV_RES_OK) return res;
lv_obj_invalidate(obj);
}
#if LV_USE_GROUP
lv_indev_type_t indev_type = lv_indev_get_type(indev);
if(indev_type == LV_INDEV_TYPE_ENCODER) {
lv_group_set_editing(lv_obj_get_group(ddlist), false);
lv_group_set_editing(lv_obj_get_group(obj), false);
}
#endif
}
else {
lv_dropdown_open(obj);
@ -957,32 +948,30 @@ static lv_res_t lv_dropdown_signal(lv_obj_t * obj, lv_signal_t sign, void * para
lv_obj_set_height(obj, top + bottom + lv_font_get_line_height(font));
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
char c = *((char *)param);
if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN) {
if(dropdown->list == NULL) {
lv_dropdown_open(ddlist);
lv_dropdown_open(obj);
}
else if(dropdown->sel_opt_id + 1 < dropdown->option_cnt) {
dropdown->sel_opt_id++;
position_to_selected(ddlist);
position_to_selected(obj);
}
}
else if(c == LV_KEY_LEFT || c == LV_KEY_UP) {
if(dropdown->list == NULL) {
lv_dropdown_open(ddlist);
lv_dropdown_open(obj);
}
else if(dropdown->sel_opt_id > 0) {
dropdown->sel_opt_id--;
position_to_selected(ddlist);
position_to_selected(obj);
}
}
else if(c == LV_KEY_ESC) {
dropdown->sel_opt_id = dropdown->sel_opt_id_orig;
lv_dropdown_close(ddlist);
lv_dropdown_close(obj);
}
#endif
}
return res;
@ -1105,16 +1094,14 @@ static lv_res_t list_release_handler(lv_obj_t * list_obj)
lv_dropdown_t * dropdown = (lv_dropdown_t *) dropdown_obj;
lv_indev_t * indev = lv_indev_get_act();
#if LV_USE_GROUP
/*Leave edit mode once a new item is selected*/
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_ENCODER) {
dropdown->sel_opt_id_orig = dropdown->sel_opt_id;
lv_group_t * g = lv_obj_get_group(ddlist);
lv_group_t * g = lv_obj_get_group(dropdown_obj);
if(lv_group_get_editing(g)) {
lv_group_set_editing(g, false);
}
}
#endif
/*Search the clicked option (For KEYPAD and ENCODER the new value should be already set)*/
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_POINTER || lv_indev_get_type(indev) == LV_INDEV_TYPE_BUTTON) {

View File

@ -40,10 +40,8 @@ static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param
static lv_draw_res_t lv_label_draw(lv_obj_t * label, const lv_area_t * clip_area, lv_draw_mode_t mode);
static void lv_label_revert_dots(lv_obj_t * label);
#if LV_USE_ANIMATION
static void lv_label_set_offset_x(lv_obj_t * label, lv_coord_t x);
static void lv_label_set_offset_y(lv_obj_t * label, lv_coord_t y);
#endif
static void lv_label_set_offset_x(lv_obj_t * label, lv_coord_t x);
static void lv_label_set_offset_y(lv_obj_t * label, lv_coord_t y);
static bool lv_label_set_dot_tmp(lv_obj_t * label, char * data, uint32_t len);
static char * lv_label_get_dot_tmp(lv_obj_t * label);
@ -225,13 +223,11 @@ void lv_label_set_long_mode(lv_obj_t * obj, lv_label_long_mode_t long_mode)
lv_label_t * label = (lv_label_t *)obj;
#if LV_USE_ANIMATION
/*Delete the old animation (if exists)*/
lv_anim_del(obj, (lv_anim_exec_xcb_t)lv_obj_set_x);
lv_anim_del(obj, (lv_anim_exec_xcb_t)lv_obj_set_y);
lv_anim_del(obj, (lv_anim_exec_xcb_t)lv_label_set_offset_x);
lv_anim_del(obj, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
#endif
label->offset.x = 0;
label->offset.y = 0;
@ -829,7 +825,6 @@ void lv_label_refr_text(lv_obj_t * obj)
}
/*In roll mode keep the size but start offset animations*/
else if(label->long_mode == LV_LABEL_LONG_SROLL) {
#if LV_USE_ANIMATION
uint16_t anim_speed = lv_obj_get_style_anim_time(obj, LV_PART_MAIN);
lv_anim_t a;
lv_anim_init(&a);
@ -909,11 +904,9 @@ void lv_label_refr_text(lv_obj_t * obj)
lv_anim_del(obj, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
label->offset.y = 0;
}
#endif
}
/*In roll inf. mode keep the size but start offset animations*/
else if(label->long_mode == LV_LABEL_LONG_SROLL_CIRC) {
#if LV_USE_ANIMATION
uint16_t anim_speed = lv_obj_get_style_anim_time(obj, LV_PART_MAIN);
lv_anim_t a;
lv_anim_init(&a);
@ -961,7 +954,6 @@ void lv_label_refr_text(lv_obj_t * obj)
lv_anim_del(obj, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
label->offset.y = 0;
}
#endif
}
else if(label->long_mode == LV_LABEL_LONG_DOT) {
if(size.y <= lv_area_get_height(&txt_coords)) { /*No dots are required, the text is short enough*/
@ -1248,7 +1240,6 @@ static void lv_label_revert_dots(lv_obj_t * obj)
label->dot_end = LV_LABEL_DOT_END_INV;
}
#if LV_USE_ANIMATION
static void lv_label_set_offset_x(lv_obj_t * obj, lv_coord_t x)
{
lv_label_t * label = (lv_label_t *)obj;
@ -1262,7 +1253,6 @@ static void lv_label_set_offset_y(lv_obj_t * obj, lv_coord_t y)
label->offset.y = y;
lv_obj_invalidate(obj);
}
#endif
/**
* Store `len` characters from `data`. Allocates space if necessary.

View File

@ -21,11 +21,6 @@
*********************/
#define LV_OBJX_NAME "lv_roller"
#if LV_USE_ANIMATION == 0
#undef LV_ROLLER_DEF_ANIM_TIME
#define LV_ROLLER_DEF_ANIM_TIME 0 /*No animation*/
#endif
/**********************
* TYPEDEFS
**********************/
@ -46,9 +41,7 @@ static lv_res_t release_handler(lv_obj_t * obj);
static void inf_normalize(lv_obj_t * obj_scrl);
static lv_obj_t * get_label(const lv_obj_t * obj);
static lv_coord_t get_selected_label_width(const lv_obj_t * obj);
#if LV_USE_ANIMATION
static void scroll_anim_ready_cb(lv_anim_t * a);
#endif
static void scroll_anim_ready_cb(lv_anim_t * a);
/**********************
* STATIC VARIABLES
@ -160,10 +153,6 @@ void lv_roller_set_selected(lv_obj_t * obj, uint16_t sel_opt, lv_anim_enable_t a
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0
anim = LV_ANIM_OFF;
#endif
/* Set the value even if it's the same as the current value because
* if moving to the next option with an animation which was just deleted in the PRESS signal
* nothing will continue the animation. */
@ -551,9 +540,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
}
else if(sign == LV_SIGNAL_PRESSED) {
roller->moved = 0;
#if LV_USE_ANIMATION
lv_anim_del(get_label(obj), (lv_anim_exec_xcb_t)lv_obj_set_y);
#endif
}
else if(sign == LV_SIGNAL_PRESSING) {
lv_indev_t * indev = lv_indev_get_act();
@ -569,7 +556,6 @@ static lv_res_t lv_roller_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
release_handler(obj);
}
else if(sign == LV_SIGNAL_FOCUS) {
#if LV_USE_GROUP
lv_group_t * g = lv_obj_get_group(obj);
bool editing = lv_group_get_editing(g);
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
@ -578,7 +564,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
if(indev_type == LV_INDEV_TYPE_ENCODER) {
/*In navigate mode revert the original value*/
if(!editing) {
if(obj->sel_opt_id != roller->sel_opt_id_ori) {
if(roller->sel_opt_id != roller->sel_opt_id_ori) {
roller->sel_opt_id = roller->sel_opt_id_ori;
refr_position(obj, true);
}
@ -592,36 +578,31 @@ static lv_res_t lv_roller_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
roller->sel_opt_id_ori = roller->sel_opt_id; /*Save the current value. Used to revert this state if
ENTER won't be pressed*/
}
#endif
}
else if(sign == LV_SIGNAL_DEFOCUS) {
#if LV_USE_GROUP
/*Revert the original state*/
if(obj->sel_opt_id != roller->sel_opt_id_ori) {
if(roller->sel_opt_id != roller->sel_opt_id_ori) {
roller->sel_opt_id = roller->sel_opt_id_ori;
refr_position(obj, true);
}
#endif
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
char c = *((char *)param);
if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN) {
if(obj->sel_opt_id + 1 < roller->option_cnt) {
if(roller->sel_opt_id + 1 < roller->option_cnt) {
uint16_t ori_id = roller->sel_opt_id_ori; /*lv_roller_set_selected will overwrite this*/
lv_roller_set_selected(obj, roller->sel_opt_id + 1, true);
roller->sel_opt_id_ori = ori_id;
}
}
else if(c == LV_KEY_LEFT || c == LV_KEY_UP) {
if(obj->sel_opt_id > 0) {
if(roller->sel_opt_id > 0) {
uint16_t ori_id = roller->sel_opt_id_ori; /*lv_roller_set_selected will overwrite this*/
lv_roller_set_selected(obj, roller->sel_opt_id - 1, true);
roller->sel_opt_id_ori = ori_id;
}
}
#endif
}
return res;
@ -664,10 +645,6 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en)
lv_obj_t * label = get_label(obj);
if(label == NULL) return;
#if LV_USE_ANIMATION == 0
anim_en = LV_ANIM_OFF;
#endif
lv_text_align_t align = lv_obj_get_style_text_align(label, LV_PART_MAIN);
switch(align) {
case LV_TEXT_ALIGN_CENTER:
@ -703,13 +680,10 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en)
lv_coord_t new_y = mid_y1 - sel_y1;
if(anim_en == LV_ANIM_OFF || anim_time == 0) {
#if LV_USE_ANIMATION
lv_anim_del(label, (lv_anim_exec_xcb_t)lv_obj_set_y);
#endif
lv_obj_set_y(label, new_y);
}
else {
#if LV_USE_ANIMATION
lv_anim_path_t path;
lv_anim_path_init(&path);
lv_anim_path_set_cb(&path, lv_anim_path_ease_out);
@ -722,7 +696,6 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en)
lv_anim_set_ready_cb(&a, scroll_anim_ready_cb);
lv_anim_set_path(&a, &path);
lv_anim_start(&a);
#endif
}
}
@ -735,7 +708,6 @@ static lv_res_t release_handler(lv_obj_t * obj)
lv_indev_t * indev = lv_indev_get_act();
lv_roller_t * roller = (lv_roller_t*)obj;
#if LV_USE_GROUP
/*Leave edit mode once a new option is selected*/
lv_indev_type_t indev_type = lv_indev_get_type(indev);
if(indev_type == LV_INDEV_TYPE_ENCODER || indev_type == LV_INDEV_TYPE_KEYPAD) {
@ -748,7 +720,6 @@ static lv_res_t release_handler(lv_obj_t * obj)
}
}
}
#endif
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_POINTER || lv_indev_get_type(indev) == LV_INDEV_TYPE_BUTTON) {
/*Search the clicked option (For KEYPAD and ENCODER the new value should be already set)*/
@ -852,12 +823,9 @@ static lv_coord_t get_selected_label_width(const lv_obj_t * obj)
return size.x;
}
#if LV_USE_ANIMATION
static void scroll_anim_ready_cb(lv_anim_t * a)
{
lv_obj_t * obj = lv_obj_get_parent(a->var); /*The label is animated*/
inf_normalize(obj);
}
#endif
#endif

View File

@ -307,7 +307,6 @@ static lv_res_t lv_slider_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
slider->dragging = false;
slider->value_to_set = NULL;
#if LV_USE_GROUP
/*Leave edit mode if released. (No need to wait for LONG_PRESS) */
lv_group_t * g = lv_obj_get_group(slider);
bool editing = lv_group_get_editing(g);
@ -326,7 +325,6 @@ static lv_res_t lv_slider_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
}
}
}
#endif
}
else if(sign == LV_SIGNAL_FOCUS) {
@ -361,7 +359,6 @@ static lv_res_t lv_slider_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
char c = *((char *)param);
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
@ -378,7 +375,6 @@ static lv_res_t lv_slider_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
res = lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return res;
}
#endif
}
return res;

View File

@ -50,11 +50,9 @@ static void lv_textarea_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_
static void lv_textarea_destructor(lv_obj_t * obj);
static lv_draw_res_t lv_textarea_draw(lv_obj_t * obj, const lv_area_t * clip_area, lv_draw_mode_t mode);
static lv_res_t lv_textarea_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
#if LV_USE_ANIMATION
static void cursor_blink_anim_cb(lv_obj_t * obj, lv_anim_value_t show);
static void pwd_char_hider_anim(lv_obj_t * obj, lv_anim_value_t x);
static void pwd_char_hider_anim_ready(lv_anim_t * a);
#endif
static void cursor_blink_anim_cb(lv_obj_t * obj, lv_anim_value_t show);
static void pwd_char_hider_anim(lv_obj_t * obj, lv_anim_value_t x);
static void pwd_char_hider_anim_ready(lv_anim_t * a);
static void pwd_char_hider(lv_obj_t * obj);
static bool char_is_accepted(lv_obj_t * obj, uint32_t c);
static void start_cursor_blink(lv_obj_t * obj);
@ -160,7 +158,6 @@ void lv_textarea_add_char(lv_obj_t * obj, uint32_t c)
_lv_txt_ins(ta->pwd_tmp, ta->cursor.pos, (const char *)letter_buf);
#if LV_USE_ANIMATION
/*Auto hide characters*/
if(ta->pwd_show_time == 0) {
pwd_char_hider(obj);
@ -180,10 +177,6 @@ void lv_textarea_add_char(lv_obj_t * obj, uint32_t c)
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
lv_anim_start(&a);
}
#else
pwd_char_hider(obj);
#endif
}
/*Move the cursor after the new character*/
@ -236,7 +229,6 @@ void lv_textarea_add_text(lv_obj_t * obj, const char * txt)
_lv_txt_ins(ta->pwd_tmp, ta->cursor.pos, txt);
#if LV_USE_ANIMATION
/*Auto hide characters*/
if(ta->pwd_show_time == 0) {
pwd_char_hider(obj);
@ -256,9 +248,6 @@ void lv_textarea_add_text(lv_obj_t * obj, const char * txt)
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
lv_anim_start(&a);
}
#else
pwd_char_hider(obj);
#endif
}
/*Move the cursor after the new text*/
@ -377,7 +366,6 @@ void lv_textarea_set_text(lv_obj_t * obj, const char * txt)
if(ta->pwd_tmp == NULL) return;
strcpy(ta->pwd_tmp, txt);
#if LV_USE_ANIMATION
/*Auto hide characters*/
if(ta->pwd_show_time == 0) {
pwd_char_hider(obj);
@ -397,9 +385,6 @@ void lv_textarea_set_text(lv_obj_t * obj, const char * txt)
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
lv_anim_start(&a);
}
#else
pwd_char_hider(obj);
#endif
}
lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL);
@ -650,10 +635,6 @@ void lv_textarea_set_pwd_show_time(lv_obj_t * obj, uint16_t time)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0
time = 0;
#endif
lv_textarea_t * ta = (lv_textarea_t *) obj;
ta->pwd_show_time = time;
}
@ -988,11 +969,6 @@ static void lv_textarea_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_
ta->label = NULL;
ta->placeholder_txt = NULL;
#if LV_USE_ANIMATION == 0
ta->pwd_show_time = 0;
ta->cursor.blink_time = 0;
#endif
/*Init the new text area object*/
if(copy == NULL) {
ta->label = lv_label_create(obj, NULL);
@ -1130,7 +1106,6 @@ static lv_res_t lv_textarea_signal(lv_obj_t * obj, lv_signal_t sign, void * para
}
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
uint32_t c = *((uint32_t *)param); /*uint32_t because can be UTF-8*/
if(c == LV_KEY_RIGHT)
lv_textarea_cursor_right(obj);
@ -1149,11 +1124,10 @@ static lv_res_t lv_textarea_signal(lv_obj_t * obj, lv_signal_t sign, void * para
else if(c == LV_KEY_END)
lv_textarea_set_cursor_pos(obj, LV_TEXTAREA_CURSOR_LAST);
else if(c == LV_KEY_ENTER && lv_textarea_get_one_line(obj))
lv_event_send(obj, LV_EVENT_APPLY, NULL);
lv_event_send(obj, LV_EVENT_READY, NULL);
else {
lv_textarea_add_char(obj, c);
}
#endif
}
else if(sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_PRESSING || sign == LV_SIGNAL_PRESS_LOST ||
sign == LV_SIGNAL_RELEASED) {
@ -1162,8 +1136,6 @@ static lv_res_t lv_textarea_signal(lv_obj_t * obj, lv_signal_t sign, void * para
return res;
}
#if LV_USE_ANIMATION
/**
* Called to blink the cursor
* @param ta pointer to a text area
@ -1206,7 +1178,6 @@ static void pwd_char_hider_anim_ready(lv_anim_t * a)
lv_obj_t * obj = a->var;
pwd_char_hider(obj);
}
#endif
/**
* Hide all characters (convert them to '*')
@ -1280,7 +1251,6 @@ static bool char_is_accepted(lv_obj_t * obj, uint32_t c)
static void start_cursor_blink(lv_obj_t * obj)
{
#if LV_USE_ANIMATION
lv_textarea_t * ta = (lv_textarea_t *) obj;
uint32_t blink_time = lv_obj_get_style_anim_time(obj, LV_PART_MARKER);
if(blink_time == 0) {
@ -1302,7 +1272,6 @@ static void start_cursor_blink(lv_obj_t * obj)
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
lv_anim_start(&a);
}
#endif
}
static void refr_cursor_area(lv_obj_t * obj)