mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
Merge branch 'dev-6.0' into feature/theme_focus_cb
This commit is contained in:
commit
79dc8b2ace
@ -40,7 +40,8 @@
|
||||
#endif
|
||||
#endif /*LV_MEM_CUSTOM*/
|
||||
|
||||
/* Garbage Collector settings. */
|
||||
/* Garbage Collector settings
|
||||
* Used if lvgl is binded to higher language and the memory is managed by that language */
|
||||
#ifndef LV_ENABLE_GC
|
||||
#define LV_ENABLE_GC 0
|
||||
#endif
|
||||
@ -89,7 +90,7 @@
|
||||
*----------------*/
|
||||
|
||||
/* VDB (Virtual Display Buffer) is an internal graphics buffer.
|
||||
* To images will be drawn into this buffer first and then
|
||||
* The GUI will be drawn into this buffer first and then
|
||||
* the buffer will be passed to your `disp_drv.disp_flush` function to
|
||||
* copy it to your frame buffer.
|
||||
* VDB is required for: buffered drawing, opacity, anti-aliasing and shadows
|
||||
@ -115,7 +116,7 @@
|
||||
#define LV_VDB_ADR 0
|
||||
#endif
|
||||
|
||||
/* Use two Virtual Display buffers (VDB) parallelize rendering and flushing (optional)
|
||||
/* Use two Virtual Display buffers (VDB) to parallelize rendering and flushing
|
||||
* The flushing should use DMA to write the frame buffer in the background */
|
||||
#ifndef LV_VDB_DOUBLE
|
||||
#define LV_VDB_DOUBLE 0
|
||||
@ -165,7 +166,7 @@
|
||||
|
||||
/*Color settings*/
|
||||
#ifndef LV_COLOR_DEPTH
|
||||
#define LV_COLOR_DEPTH 32 /*Color depth: 1/8/16/32*/
|
||||
#define LV_COLOR_DEPTH 16 /*Color depth: 1/8/16/32*/
|
||||
#endif
|
||||
#ifndef LV_COLOR_16_SWAP
|
||||
#define LV_COLOR_16_SWAP 0 /*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/
|
||||
@ -224,6 +225,9 @@
|
||||
#ifndef LV_ATTRIBUTE_TASK_HANDLER
|
||||
#define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */
|
||||
#endif
|
||||
#ifndef LV_ATTRIBUTE_MEM_ALIGN
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN /* With size optimization (-Os) the compiler might not align data to 4 or 8 byte boundary. This alignment will be explicitly applied where needed.*/
|
||||
#endif
|
||||
#ifndef LV_COMPILER_VLA_SUPPORTED
|
||||
#define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/
|
||||
#endif
|
||||
@ -237,7 +241,7 @@
|
||||
#endif
|
||||
#if LV_TICK_CUSTOM == 1
|
||||
#ifndef LV_TICK_CUSTOM_INCLUDE
|
||||
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the sys time function*/
|
||||
#define LV_TICK_CUSTOM_INCLUDE "sonething.h" /*Header for the sys time function*/
|
||||
#endif
|
||||
#ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
|
||||
@ -262,7 +266,7 @@
|
||||
/* 1: Print the log with 'printf'; 0: user need to register a callback*/
|
||||
|
||||
#ifndef LV_LOG_PRINTF
|
||||
# define LV_LOG_PRINTF 1
|
||||
# define LV_LOG_PRINTF 0
|
||||
#endif
|
||||
#endif /*USE_LV_LOG*/
|
||||
|
||||
@ -386,7 +390,7 @@
|
||||
#define LV_OBJ_FREE_PTR 1 /*Enable the free pointer attribute*/
|
||||
#endif
|
||||
#ifndef LV_OBJ_REALIGN
|
||||
#define LV_OBJ_REALIGN 0 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
|
||||
#define LV_OBJ_REALIGN 1 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
|
||||
#endif
|
||||
|
||||
/*==================
|
||||
|
@ -107,7 +107,7 @@
|
||||
#define LV_INDEV_READ_PERIOD 50 /*Input device read period in milliseconds*/
|
||||
#define LV_INDEV_POINT_MARKER 0 /*Mark the pressed points (required: USE_LV_REAL_DRAW = 1)*/
|
||||
#define LV_INDEV_DRAG_LIMIT 10 /*Drag threshold in pixels */
|
||||
#define LV_INDEV_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */
|
||||
#define LV_INDEV_DRAG_THROW 20 /*Drag throw slow-down in [%] (must be > 0). Greater value means faster slow-down */
|
||||
#define LV_INDEV_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/
|
||||
#define LV_INDEV_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */
|
||||
|
||||
@ -136,13 +136,14 @@
|
||||
/*Compiler settings*/
|
||||
#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_tick_inc` function */
|
||||
#define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN /* With size optimization (-Os) the compiler might not align data to 4 or 8 byte boundary. This alignment will be explicitly applied where needed.*/
|
||||
#define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/
|
||||
#define LV_COMPILER_NON_CONST_INIT_SUPPORTED 1 /* 1: Initialization with non constant values are supported */
|
||||
|
||||
/*HAL settings*/
|
||||
#define LV_TICK_CUSTOM 0 /*1: use a custom tick source (removing the need to manually update the tick with `lv_tick_inc`) */
|
||||
#if LV_TICK_CUSTOM == 1
|
||||
#define LV_TICK_CUSTOM_INCLUDE "sonething.h" /*Header for the sys time function*/
|
||||
#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
|
||||
#endif /*LV_TICK_CUSTOM*/
|
||||
|
||||
@ -381,6 +382,13 @@
|
||||
/*************************
|
||||
* Non-user section
|
||||
*************************/
|
||||
|
||||
#if LV_INDEV_DRAG_THROW <= 0
|
||||
#warning "LV_INDEV_DRAG_THROW must be greater than 0"
|
||||
#undef LV_INDEV_DRAG_THROW
|
||||
#define LV_INDEV_DRAG_THROW 1
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
@ -20,6 +20,10 @@
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#if LV_INDEV_DRAG_THROW <= 0
|
||||
#warning "LV_INDEV_DRAG_THROW must be greater than 0"
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
@ -38,9 +38,9 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void refresh_childen_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff);
|
||||
static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff);
|
||||
static void report_style_mod_core(void * style_p, lv_obj_t * obj);
|
||||
static void refresh_childen_style(lv_obj_t * obj);
|
||||
static void refresh_children_style(lv_obj_t * obj);
|
||||
static void delete_children(lv_obj_t * obj);
|
||||
static bool lv_obj_design(lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode);
|
||||
static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
@ -49,6 +49,8 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
static bool _lv_initialized = false;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@ -62,6 +64,10 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
*/
|
||||
void lv_init(void)
|
||||
{
|
||||
/* Do nothing if already initialized */
|
||||
if (_lv_initialized)
|
||||
return;
|
||||
|
||||
LV_GC_ROOT(_lv_def_scr) = NULL;
|
||||
LV_GC_ROOT(_lv_act_scr) = NULL;
|
||||
LV_GC_ROOT(_lv_top_layer) = NULL;
|
||||
@ -111,7 +117,7 @@ void lv_init(void)
|
||||
lv_indev_init();
|
||||
#endif
|
||||
|
||||
|
||||
_lv_initialized = true;
|
||||
LV_LOG_INFO("lv_init ready");
|
||||
}
|
||||
|
||||
@ -545,7 +551,7 @@ void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
obj->coords.x2 += diff.x;
|
||||
obj->coords.y2 += diff.y;
|
||||
|
||||
refresh_childen_position(obj, diff.x, diff.y);
|
||||
refresh_children_position(obj, diff.x, diff.y);
|
||||
|
||||
/*Inform the object about its new coordinates*/
|
||||
obj->signal_func(obj, LV_SIGNAL_CORD_CHG, &ori);
|
||||
@ -981,7 +987,7 @@ void lv_obj_set_style(lv_obj_t * obj, lv_style_t * style)
|
||||
obj->style_p = style;
|
||||
|
||||
/*Send a signal about style change to every children with NULL style*/
|
||||
refresh_childen_style(obj);
|
||||
refresh_children_style(obj);
|
||||
|
||||
/*Notify the object about the style change too*/
|
||||
lv_obj_refresh_style(obj);
|
||||
@ -1866,7 +1872,7 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
* @param x_diff x coordinate shift
|
||||
* @param y_diff y coordinate shift
|
||||
*/
|
||||
static void refresh_childen_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff)
|
||||
static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff)
|
||||
{
|
||||
lv_obj_t * i;
|
||||
LL_READ(obj->child_ll, i) {
|
||||
@ -1875,7 +1881,7 @@ static void refresh_childen_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord
|
||||
i->coords.x2 += x_diff;
|
||||
i->coords.y2 += y_diff;
|
||||
|
||||
refresh_childen_position(i, x_diff, y_diff);
|
||||
refresh_children_position(i, x_diff, y_diff);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1889,7 +1895,7 @@ static void report_style_mod_core(void * style_p, lv_obj_t * obj)
|
||||
lv_obj_t * i;
|
||||
LL_READ(obj->child_ll, i) {
|
||||
if(i->style_p == style_p || style_p == NULL) {
|
||||
refresh_childen_style(i);
|
||||
refresh_children_style(i);
|
||||
lv_obj_refresh_style(i);
|
||||
}
|
||||
|
||||
@ -1902,16 +1908,16 @@ static void report_style_mod_core(void * style_p, lv_obj_t * obj)
|
||||
* because the NULL styles are inherited from the parent
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
static void refresh_childen_style(lv_obj_t * obj)
|
||||
static void refresh_children_style(lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
||||
while(child != NULL) {
|
||||
if(child->style_p == NULL) {
|
||||
refresh_childen_style(child); /*Check children too*/
|
||||
refresh_children_style(child); /*Check children too*/
|
||||
lv_obj_refresh_style(child); /*Notify the child about the style change*/
|
||||
} else if(child->style_p->glass) {
|
||||
/*Children with 'glass' parent might be effected if their style == NULL*/
|
||||
refresh_childen_style(child);
|
||||
refresh_children_style(child);
|
||||
}
|
||||
child = lv_obj_get_child(obj, child);
|
||||
}
|
||||
|
@ -20,6 +20,10 @@
|
||||
#define LV_ATTRIBUTE_FLUSH_READY
|
||||
#endif
|
||||
|
||||
#ifndef LV_ATTRIBUTE_MEM_ALIGN
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
@ -36,7 +40,7 @@
|
||||
#if LV_VDB_DOUBLE == 0
|
||||
# if LV_VDB_ADR == 0
|
||||
/*If the buffer address is not specified simply allocate it*/
|
||||
static uint8_t vdb_buf[LV_VDB_SIZE_IN_BYTES];
|
||||
static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf[LV_VDB_SIZE_IN_BYTES];
|
||||
static lv_vdb_t vdb = {.buf = (lv_color_t *)vdb_buf};
|
||||
# else /*LV_VDB_ADR != 0*/
|
||||
/*If the buffer address is specified use that address*/
|
||||
@ -49,8 +53,8 @@ static lv_vdb_t vdb = {.buf = (lv_color_t *)LV_VDB_ADR};
|
||||
static uint8_t vdb_active = 0;
|
||||
# if LV_VDB_ADR == 0
|
||||
/*If the buffer address is not specified simply allocate it*/
|
||||
static uint8_t vdb_buf1[LV_VDB_SIZE_IN_BYTES];
|
||||
static uint8_t vdb_buf2[LV_VDB_SIZE_IN_BYTES];
|
||||
static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf1[LV_VDB_SIZE_IN_BYTES];
|
||||
static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf2[LV_VDB_SIZE_IN_BYTES];
|
||||
static lv_vdb_t vdb[2] = {{.buf = (lv_color_t *) vdb_buf1}, {.buf = (lv_color_t *) vdb_buf2}};
|
||||
# else /*LV_VDB_ADR != 0*/
|
||||
/*If the buffer address is specified use that address*/
|
||||
|
@ -30,6 +30,10 @@
|
||||
*********************/
|
||||
#define VFILL_HW_ACC_SIZE_LIMIT 50 /*Always fill < 50 px with 'sw_color_fill' because of the hw. init overhead*/
|
||||
|
||||
#ifndef LV_ATTRIBUTE_MEM_ALIGN
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
@ -147,7 +151,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
|
||||
|
||||
|
||||
#if USE_LV_GPU
|
||||
static lv_color_t color_array_tmp[LV_HOR_RES]; /*Used by 'lv_disp_mem_blend'*/
|
||||
static LV_ATTRIBUTE_MEM_ALIGN lv_color_t color_array_tmp[LV_HOR_RES]; /*Used by 'lv_disp_mem_blend'*/
|
||||
static lv_coord_t last_width = -1;
|
||||
|
||||
lv_coord_t w = lv_area_get_width(&vdb_rel_a);
|
||||
@ -529,21 +533,6 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
|
||||
vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result);
|
||||
#else
|
||||
vdb_buf_tmp[col] = color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].alpha, px_color, opa_result);
|
||||
// if(vdb_buf_tmp[col].alpha == LV_OPA_TRANSP) {
|
||||
// /* When it is the first visible pixel on the transparent screen
|
||||
// * simlply use this color and set the pixel opa as backrounds alpha*/
|
||||
// vdb_buf_tmp[col] = px_color;
|
||||
// vdb_buf_tmp[col].alpha = opa_result;
|
||||
// } else {
|
||||
// /* If already this pixel is already written then for performance reasons
|
||||
// * don't care with alpha channel
|
||||
// */
|
||||
// lv_opa_t bg_opa = vdb_buf_tmp[col].alpha;
|
||||
// vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result);
|
||||
//
|
||||
// uint16_t opa_tmp = (uint16_t)opa_result + ((bg_opa * (255 - opa_result)) >> 8);
|
||||
// vdb_buf_tmp[col].alpha = opa_tmp > 0xFF ? 0xFF : opa_tmp ;
|
||||
// }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -393,14 +393,14 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
|
||||
#endif
|
||||
|
||||
|
||||
#define LV_COLOR_HEX(c) LV_COLOR_MAKE(((uint32_t)((uint32_t)c >> 16) & 0xFF), \
|
||||
((uint32_t)((uint32_t)c >> 8) & 0xFF), \
|
||||
((uint32_t) c & 0xFF))
|
||||
#define LV_COLOR_HEX(c) LV_COLOR_MAKE((uint8_t) ((uint32_t)((uint32_t)c >> 16) & 0xFF), \
|
||||
(uint8_t) ((uint32_t)((uint32_t)c >> 8) & 0xFF), \
|
||||
(uint8_t) ((uint32_t) c & 0xFF))
|
||||
|
||||
/*Usage LV_COLOR_HEX3(0x16C) which means LV_COLOR_HEX(0x1166CC)*/
|
||||
#define LV_COLOR_HEX3(c) LV_COLOR_MAKE((((c >> 4) & 0xF0) | ((c >> 8) & 0xF)), \
|
||||
((uint32_t)(c & 0xF0) | ((c & 0xF0) >> 4)), \
|
||||
((uint32_t)(c & 0xF) | ((c & 0xF) << 4)))
|
||||
#define LV_COLOR_HEX3(c) LV_COLOR_MAKE((uint8_t) (((c >> 4) & 0xF0) | ((c >> 8) & 0xF)), \
|
||||
(uint8_t) ((uint32_t)(c & 0xF0) | ((c & 0xF0) >> 4)), \
|
||||
(uint8_t) ((uint32_t)(c & 0xF) | ((c & 0xF) << 4)))
|
||||
|
||||
static inline lv_color_t lv_color_hex(uint32_t c){
|
||||
return LV_COLOR_HEX(c);
|
||||
|
@ -764,12 +764,18 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const lv_area_t * mask)
|
||||
*/
|
||||
static void lv_chart_draw_vertical_lines(lv_obj_t * chart, const lv_area_t * mask)
|
||||
{
|
||||
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
lv_coord_t w = lv_obj_get_width(chart);
|
||||
/*Vertical lines works only if the width == point count. Else use the normal line type*/
|
||||
if(ext->point_cnt != w) {
|
||||
lv_chart_draw_lines(chart, mask);
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t i;
|
||||
lv_point_t p1;
|
||||
lv_point_t p2;
|
||||
lv_coord_t w = lv_obj_get_width(chart);
|
||||
lv_coord_t h = lv_obj_get_height(chart);
|
||||
lv_coord_t x_ofs = chart->coords.x1;
|
||||
lv_coord_t y_ofs = chart->coords.y1;
|
||||
@ -789,47 +795,28 @@ static void lv_chart_draw_vertical_lines(lv_obj_t * chart, const lv_area_t * mas
|
||||
p2.x = 0 + x_ofs;
|
||||
y_tmp = (int32_t)((int32_t) ser->points[0] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
p1.y = LV_COORD_MIN;
|
||||
p2.y = h - y_tmp + y_ofs;
|
||||
p1.y = p2.y;
|
||||
|
||||
if(ext->point_cnt == w)
|
||||
for(i = 0; i < ext->point_cnt; i++)
|
||||
{
|
||||
for(i = 0; i < ext->point_cnt; i++)
|
||||
|
||||
y_tmp = (int32_t)((int32_t) ser->points[i] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
p2.y = h - y_tmp + y_ofs;
|
||||
|
||||
if(p1.y == p2.y)
|
||||
{
|
||||
p2.x++;
|
||||
}
|
||||
|
||||
y_tmp = (int32_t)((int32_t) ser->points[i] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
p2.y = h - y_tmp + y_ofs;
|
||||
|
||||
if(p1.y == p2.y)
|
||||
{
|
||||
p2.x++;
|
||||
}
|
||||
|
||||
if(ser->points[i] != LV_CHART_POINT_DEF) {
|
||||
lv_draw_line(&p1, &p2, mask, &style, opa_scale);
|
||||
|
||||
p2.x = ((w * i) / (ext->point_cnt - 1)) + x_ofs;
|
||||
p1.x = p2.x;
|
||||
p1.y = p2.y;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i = 1; i < ext->point_cnt; i ++) {
|
||||
p1.x = p2.x;
|
||||
p1.y = p2.y;
|
||||
|
||||
p2.x = ((w * i) / (ext->point_cnt - 1)) + x_ofs;
|
||||
|
||||
y_tmp = (int32_t)((int32_t) ser->points[i] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
p2.y = h - y_tmp + y_ofs;
|
||||
|
||||
if(ser->points[i - 1] >= 0 && ser->points[i] >= 0)
|
||||
{
|
||||
lv_draw_line(&p1, &p2, mask, &style, opa_scale);
|
||||
}
|
||||
}
|
||||
p2.x = ((w * i) / (ext->point_cnt - 1)) + x_ofs;
|
||||
p1.x = p2.x;
|
||||
p1.y = p2.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,10 +62,10 @@ typedef struct
|
||||
/*Chart types*/
|
||||
enum
|
||||
{
|
||||
LV_CHART_TYPE_LINE = 0x01,
|
||||
LV_CHART_TYPE_COLUMN = 0x02,
|
||||
LV_CHART_TYPE_POINT = 0x04,
|
||||
LV_CHART_TYPE_VERTICAL_LINE = 0x08,
|
||||
LV_CHART_TYPE_LINE = 0x01, /*Connect the points with lines*/
|
||||
LV_CHART_TYPE_COLUMN = 0x02, /*Draw columns*/
|
||||
LV_CHART_TYPE_POINT = 0x04, /*Draw circles on the points*/
|
||||
LV_CHART_TYPE_VERTICAL_LINE = 0x08, /*Draw vertical lines on points (useful when chart width == point count)*/
|
||||
};
|
||||
typedef uint8_t lv_chart_type_t;
|
||||
|
||||
|
@ -81,11 +81,10 @@ lv_obj_t * lv_imgbtn_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
/*Copy an existing image button*/
|
||||
else {
|
||||
#if LV_IMGBTN_TILED == 0
|
||||
memset(ext->img_src, 0, sizeof(ext->img_src));
|
||||
#else
|
||||
lv_imgbtn_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
|
||||
#if LV_IMGBTN_TILED == 0
|
||||
memcpy(ext->img_src, copy_ext->img_src, sizeof(ext->img_src));
|
||||
#else
|
||||
memcpy(ext->img_src_left, copy_ext->img_src_left, sizeof(ext->img_src_left));
|
||||
memcpy(ext->img_src_mid, copy_ext->img_src_mid, sizeof(ext->img_src_mid));
|
||||
memcpy(ext->img_src_right, copy_ext->img_src_right, sizeof(ext->img_src_right));
|
||||
|
@ -300,6 +300,7 @@ void lv_list_set_btn_selected(lv_obj_t * list, lv_obj_t * btn)
|
||||
}
|
||||
|
||||
ext->selected_btn = btn;
|
||||
ext->last_sel = btn;
|
||||
|
||||
if(ext->selected_btn) {
|
||||
lv_btn_state_t s = lv_btn_get_state(ext->selected_btn);
|
||||
@ -760,7 +761,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
lv_group_t * g = lv_obj_get_group(list);
|
||||
if(lv_group_get_editing(g)) {
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
if(NULL != ext->last_sel) {
|
||||
if(ext->last_sel) {
|
||||
/* Select the last used button */
|
||||
lv_list_set_btn_selected(list, ext->last_sel);
|
||||
}
|
||||
@ -779,7 +780,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
lv_list_set_btn_selected(list, last_clicked_btn);
|
||||
} else {
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
if(NULL != ext->last_sel) {
|
||||
if(ext->last_sel) {
|
||||
/* Select the last used button */
|
||||
lv_list_set_btn_selected(list, ext->last_sel);
|
||||
}
|
||||
|
@ -59,8 +59,8 @@ typedef struct
|
||||
uint32_t size; /*the number of items(buttons) in the list*/
|
||||
bool single_mode; /* whether single selected mode is enabled */
|
||||
#if USE_LV_GROUP
|
||||
lv_obj_t * last_sel; /* Last btn selected */
|
||||
lv_obj_t * selected_btn;
|
||||
lv_obj_t * last_sel; /* The last selected button. It will be reverted when the list is focused again */
|
||||
lv_obj_t * selected_btn; /* The button is currently being selected*/
|
||||
#endif
|
||||
} lv_list_ext_t;
|
||||
|
||||
|
@ -567,7 +567,7 @@ void lv_page_scroll_ver(lv_obj_t * page, lv_coord_t dist)
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
#else
|
||||
lv_obj_set_y(scrl, lv_obj_get_x(scrl) + dist);
|
||||
lv_obj_set_y(scrl, lv_obj_get_y(scrl) + dist);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -67,16 +67,15 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->ta.accapted_chars = "1234567890+-.";
|
||||
|
||||
ext->value = 0;
|
||||
ext->dec_point_pos = 2;
|
||||
ext->dec_point_pos = 0;
|
||||
ext->digit_count = 5;
|
||||
ext->step = 100;
|
||||
ext->digit_padding_left = 0;
|
||||
ext->step = 1;
|
||||
ext->range_max = 99999;
|
||||
ext->range_min = -99999;
|
||||
ext->value_changed_cb = NULL;
|
||||
|
||||
lv_ta_set_cursor_type(new_spinbox, LV_CURSOR_BLOCK | LV_CURSOR_HIDDEN); /*hidden by default*/
|
||||
lv_ta_set_cursor_pos(new_spinbox, 4);
|
||||
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_func(new_spinbox, lv_spinbox_signal);
|
||||
@ -450,8 +449,8 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox)
|
||||
int i = 0;
|
||||
uint8_t digits[16];
|
||||
|
||||
if(v < 0)
|
||||
v = -v;
|
||||
if(v < 0) v = -v;
|
||||
|
||||
for(i = 0; i < dc; i++)
|
||||
{
|
||||
digits[i] = v%10;
|
||||
@ -464,18 +463,24 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox)
|
||||
ext->digits[1 + pl + k] = '0' + digits[--i];
|
||||
}
|
||||
|
||||
ext->digits[1 + pl + intDigits] = '.';
|
||||
if(ext->dec_point_pos != 0) {
|
||||
ext->digits[1 + pl + intDigits] = '.';
|
||||
|
||||
int d;
|
||||
int d;
|
||||
|
||||
for(d = 0; d < decDigits; d++)
|
||||
{
|
||||
ext->digits[1 + pl + intDigits + 1 + d] = '0' + digits[--i];
|
||||
}
|
||||
|
||||
ext->digits[1 + pl + intDigits + 1 + decDigits] = '\0';
|
||||
} else {
|
||||
ext->digits[1 + pl + intDigits] = '\0';
|
||||
|
||||
for(d = 0; d < decDigits; d++)
|
||||
{
|
||||
ext->digits[1 + pl + intDigits + 1 + d] = '0' + digits[--i];
|
||||
}
|
||||
|
||||
ext->digits[1 + pl + intDigits + 1 + decDigits] = '\0';
|
||||
|
||||
lv_label_set_text(ext->ta.label, (char*)ext->digits);
|
||||
lv_ta_set_text(spinbox, (char*)ext->digits);
|
||||
|
||||
int32_t step = ext->step;
|
||||
uint8_t cPos = ext->digit_count + pl;
|
||||
|
@ -114,6 +114,7 @@ static void basic_init(void)
|
||||
panel.body.border.width = 2;
|
||||
panel.body.border.opa = LV_OPA_60;
|
||||
panel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
panel.image.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
panel.line.color = lv_color_hsv_to_rgb(_hue, 20, 70);
|
||||
|
||||
/*Scrollbar*/
|
||||
@ -156,6 +157,7 @@ static void btn_init(void)
|
||||
btn_rel.body.padding.inner = LV_DPI / 10;
|
||||
btn_rel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
btn_rel.text.font = _font;
|
||||
btn_rel.image.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
|
||||
lv_style_copy(&btn_pr, &btn_rel);
|
||||
btn_pr.body.opa = LV_OPA_COVER;
|
||||
@ -165,6 +167,7 @@ static void btn_init(void)
|
||||
btn_pr.body.border.opa = LV_OPA_60;
|
||||
btn_pr.text.font = _font;
|
||||
btn_pr.text.color = lv_color_hsv_to_rgb(_hue, 10, 100);
|
||||
btn_pr.image.color = lv_color_hsv_to_rgb(_hue, 10, 100);
|
||||
|
||||
lv_style_copy(&btn_trel, &btn_pr);
|
||||
btn_trel.body.opa = LV_OPA_COVER;
|
||||
@ -175,6 +178,7 @@ static void btn_init(void)
|
||||
btn_trel.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 90);
|
||||
btn_trel.text.font = _font;
|
||||
btn_trel.text.color = lv_color_hsv_to_rgb(_hue, 0, 100);
|
||||
btn_trel.image.color = lv_color_hsv_to_rgb(_hue, 0, 100);
|
||||
|
||||
lv_style_copy(&btn_tpr, &btn_trel);
|
||||
btn_tpr.body.opa = LV_OPA_COVER;
|
||||
@ -185,6 +189,7 @@ static void btn_init(void)
|
||||
btn_tpr.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
btn_tpr.text.font = _font;
|
||||
btn_tpr.text.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||
btn_tpr.image.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||
|
||||
lv_style_copy(&btn_ina, &btn_rel);
|
||||
btn_ina.body.border.opa = LV_OPA_60;
|
||||
@ -615,6 +620,7 @@ static void list_init(void)
|
||||
list_rel.body.border.opa = LV_OPA_COVER;
|
||||
list_rel.text.color = lv_color_hsv_to_rgb(_hue, 10, 94);
|
||||
list_rel.text.font = _font;
|
||||
list_rel.image.color = lv_color_hsv_to_rgb(_hue, 10, 94);
|
||||
|
||||
lv_style_copy(&list_pr, &list_rel);
|
||||
list_pr.body.empty = 0;
|
||||
@ -622,6 +628,7 @@ static void list_init(void)
|
||||
list_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 34, 41);
|
||||
list_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 34, 41);
|
||||
list_pr.text.color = lv_color_hsv_to_rgb(_hue, 7, 96);
|
||||
list_pr.image.color = lv_color_hsv_to_rgb(_hue, 7, 96);
|
||||
|
||||
lv_style_copy(&list_trel, &list_rel);
|
||||
lv_style_copy(&list_tpr, &list_pr);
|
||||
@ -787,6 +794,7 @@ static void win_init(void)
|
||||
header.body.border.color = lv_color_hsv_to_rgb(_hue, 20, 80);
|
||||
header.body.border.part = LV_BORDER_BOTTOM;
|
||||
header.text.color = lv_color_hsv_to_rgb(_hue, 5, 100);
|
||||
header.image.color = lv_color_hsv_to_rgb(_hue, 5, 100);
|
||||
|
||||
theme.style.win.bg = &bg;
|
||||
theme.style.win.sb = &sb;
|
||||
|
@ -72,6 +72,7 @@ static void basic_init(void)
|
||||
panel.body.padding.ver = LV_DPI / 8;
|
||||
panel.body.padding.inner = LV_DPI / 12;
|
||||
panel.text.color = LV_COLOR_HEX3(0x333);
|
||||
panel.image.color = LV_COLOR_HEX3(0x333);
|
||||
|
||||
lv_style_copy(&sb, &def);
|
||||
sb.body.main_color = LV_COLOR_BLACK;
|
||||
@ -109,6 +110,7 @@ static void btn_init(void)
|
||||
rel.body.shadow.type = LV_SHADOW_BOTTOM;
|
||||
rel.body.shadow.width = 6;
|
||||
rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95);
|
||||
rel.image.color = lv_color_hsv_to_rgb(_hue, 5, 95);
|
||||
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
@ -131,6 +133,7 @@ static void btn_init(void)
|
||||
ina.body.grad_color = ina.body.main_color;
|
||||
ina.body.shadow.width = 0;
|
||||
ina.text.color = lv_color_hsv_to_rgb(_hue, 95, 5);
|
||||
ina.image.color = lv_color_hsv_to_rgb(_hue, 95, 5);
|
||||
|
||||
theme.style.btn.rel = &rel;
|
||||
theme.style.btn.pr = ≺
|
||||
@ -760,6 +763,7 @@ static void win_init(void)
|
||||
header.body.padding.hor = 0;
|
||||
header.body.padding.ver = 0;
|
||||
header.text.color = LV_COLOR_HEX3(0x333);
|
||||
header.image.color = LV_COLOR_HEX3(0x333);
|
||||
|
||||
lv_style_copy(&pr, &def);
|
||||
pr.body.main_color = LV_COLOR_HEX3(0xbbb);
|
||||
@ -768,6 +772,7 @@ static void win_init(void)
|
||||
pr.body.empty = 0;
|
||||
pr.body.radius = 0;
|
||||
pr.text.color = LV_COLOR_HEX3(0x111);
|
||||
pr.image.color = LV_COLOR_HEX3(0x111);
|
||||
|
||||
|
||||
theme.style.win.bg = theme.style.panel;
|
||||
|
@ -59,6 +59,7 @@ static void basic_init(void)
|
||||
bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 11, 30);
|
||||
bg.text.color = lv_color_hsv_to_rgb(_hue, 5, 95);
|
||||
bg.text.font = _font;
|
||||
bg.image.color = lv_color_hsv_to_rgb(_hue, 5, 95);
|
||||
|
||||
lv_style_copy(&sb, &def);
|
||||
sb.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 60);
|
||||
@ -109,6 +110,7 @@ static void btn_init(void)
|
||||
btn_rel.body.shadow.color = LV_COLOR_HEX3(0x111);
|
||||
btn_rel.body.shadow.width = LV_DPI / 30;
|
||||
btn_rel.text.color = LV_COLOR_HEX3(0xeee);
|
||||
btn_rel.image.color = LV_COLOR_HEX3(0xeee);
|
||||
|
||||
lv_style_copy(&btn_pr, &btn_rel);
|
||||
btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 30);
|
||||
@ -119,18 +121,21 @@ static void btn_init(void)
|
||||
btn_tgl_rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 40);
|
||||
btn_tgl_rel.body.shadow.width = LV_DPI / 40;
|
||||
btn_tgl_rel.text.color = LV_COLOR_HEX3(0xddd);
|
||||
btn_tgl_rel.image.color = LV_COLOR_HEX3(0xddd);
|
||||
|
||||
lv_style_copy(&btn_tgl_pr, &btn_rel);
|
||||
btn_tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 10);
|
||||
btn_tgl_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 30);
|
||||
btn_tgl_pr.body.shadow.width = LV_DPI / 30;
|
||||
btn_tgl_pr.text.color = LV_COLOR_HEX3(0xddd);
|
||||
btn_tgl_pr.image.color = LV_COLOR_HEX3(0xddd);
|
||||
|
||||
lv_style_copy(&btn_ina, &btn_rel);
|
||||
btn_ina.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
btn_ina.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
btn_ina.text.color = LV_COLOR_HEX3(0xaaa);
|
||||
btn_ina.body.shadow.width = 0;
|
||||
btn_ina.text.color = LV_COLOR_HEX3(0xaaa);
|
||||
btn_ina.image.color = LV_COLOR_HEX3(0xaaa);
|
||||
|
||||
theme.style.btn.rel = &btn_rel;
|
||||
theme.style.btn.pr = &btn_pr;
|
||||
@ -678,6 +683,7 @@ static void win_init(void)
|
||||
win_btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 10);
|
||||
win_btn_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 10);
|
||||
win_btn_pr.text.color = LV_COLOR_HEX3(0xaaa);
|
||||
win_btn_pr.image.color = LV_COLOR_HEX3(0xaaa);
|
||||
|
||||
theme.style.win.bg = &win_bg;
|
||||
theme.style.win.sb = &sb;
|
||||
|
@ -52,6 +52,7 @@ static void basic_init(void)
|
||||
def.body.border.opa = LV_OPA_COVER;
|
||||
def.text.font = _font;
|
||||
def.text.color = LV_COLOR_HEX3(0x444);
|
||||
def.image.color = LV_COLOR_HEX3(0x444);
|
||||
|
||||
lv_style_copy(&bg, &def);
|
||||
bg.body.main_color = LV_COLOR_WHITE;
|
||||
@ -106,19 +107,23 @@ static void btn_init(void)
|
||||
rel.body.padding.hor = LV_DPI / 4;
|
||||
rel.body.padding.ver = LV_DPI / 8;
|
||||
rel.text.color = lv_color_hsv_to_rgb(_hue, 40, 90);
|
||||
rel.image.color = lv_color_hsv_to_rgb(_hue, 40, 90);
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
pr.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
||||
pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
||||
pr.body.shadow.width = 0;
|
||||
pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
||||
pr.image.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
||||
|
||||
lv_style_copy(&tgl_pr, &pr);
|
||||
tgl_pr.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 50);
|
||||
tgl_pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 50);
|
||||
tgl_pr.image.color = lv_color_hsv_to_rgb(_hue, 40, 50);
|
||||
|
||||
lv_style_copy(&ina, &tgl_pr);
|
||||
ina.body.border.color = LV_COLOR_HEX3(0xbbb);
|
||||
ina.text.color = LV_COLOR_HEX3(0xbbb);
|
||||
ina.image.color = LV_COLOR_HEX3(0xbbb);
|
||||
|
||||
theme.style.btn.rel = &rel;
|
||||
theme.style.btn.pr = ≺
|
||||
@ -584,18 +589,22 @@ static void list_init(void)
|
||||
rel.body.padding.hor = LV_DPI / 8;
|
||||
rel.body.padding.ver = LV_DPI / 8;
|
||||
rel.text.color = LV_COLOR_HEX3(0x666);
|
||||
rel.image.color = LV_COLOR_HEX3(0x666);
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
pr.text.color = theme.style.btn.pr->text.color;
|
||||
pr.image.color = theme.style.btn.pr->image.color;
|
||||
|
||||
lv_style_copy(&tgl_rel, &rel);
|
||||
tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 50, 90);
|
||||
|
||||
lv_style_copy(&tgl_pr, &rel);
|
||||
tgl_pr.text.color = theme.style.btn.tgl_pr->text.color;
|
||||
tgl_pr.image.color = theme.style.btn.tgl_pr->image.color;
|
||||
|
||||
lv_style_copy(&ina, &rel);
|
||||
ina.text.color = theme.style.btn.ina->text.color;
|
||||
ina.image.color = theme.style.btn.ina->image.color;
|
||||
|
||||
theme.style.list.sb = &sb;
|
||||
theme.style.list.bg = &bg;
|
||||
@ -727,14 +736,17 @@ static void win_init(void)
|
||||
header.body.border.part = LV_BORDER_BOTTOM;
|
||||
header.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||
header.text.color = LV_COLOR_HEX3(0x666);
|
||||
header.image.color = LV_COLOR_HEX3(0x666);
|
||||
|
||||
lv_style_copy(&rel, &def);
|
||||
rel.body.empty = 1;
|
||||
rel.body.border.width = 0;
|
||||
rel.text.color = LV_COLOR_HEX3(0x666);
|
||||
rel.image.color = LV_COLOR_HEX3(0x666);
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
pr.text.color = LV_COLOR_HEX3(0x333);
|
||||
pr.image.color = LV_COLOR_HEX3(0x333);
|
||||
|
||||
theme.style.win.bg = theme.style.panel;
|
||||
theme.style.win.sb = &sb;
|
||||
|
Loading…
x
Reference in New Issue
Block a user