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

Merge branch 'dev-6.0' of github.com:littlevgl/lvgl into dev-6.0

This commit is contained in:
Themba Dube 2019-06-27 18:11:19 -04:00
commit 2ecd0c4166
72 changed files with 552 additions and 478 deletions

View File

@ -193,12 +193,6 @@ typedef void * lv_img_decoder_user_data_t;
* font's bitmaps */ * font's bitmaps */
#define LV_ATTRIBUTE_LARGE_CONST #define LV_ATTRIBUTE_LARGE_CONST
/* 1: Variable length array is supported*/
#define LV_COMPILER_VLA_SUPPORTED 1
/* 1: Initialization with non constant values are supported */
#define LV_COMPILER_NON_CONST_INIT_SUPPORTED 1
/*=================== /*===================
* HAL settings * HAL settings
*==================*/ *==================*/

View File

@ -1,54 +1,56 @@
''' '''
Generates a chechker file for lv_conf.h from lv_conf_templ.h define all the not defined values Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not defined values
''' '''
import re import re
fin = open("../lv_conf_template.h", "r"); fin = open("../lv_conf_template.h", "r")
fout = open("../src/lv_conf_checker.h", "w"); fout = open("../src/lv_conf_checker.h", "w")
fout.write( fout.write(
'/**\n\ '''/**
* GENERATED FILE, DO NOT EDIT IT!\n\ * GENERATED FILE, DO NOT EDIT IT!
* @file lv_conf_checker.h\n\ * @file lv_conf_checker.h
* Make sure all the defines of lv_conf.h have a default value\n\ * Make sure all the defines of lv_conf.h have a default value
**/\n\ **/
\n\
#ifndef LV_CONF_CHECKER_H\n\
#define LV_CONF_CHECKER_H\n\
'
)
inlines = fin.read().splitlines(); #ifndef LV_CONF_CHECKER_H
#define LV_CONF_CHECKER_H
'''
)
started = 0 started = 0
for i in inlines: for i in fin.read().splitlines():
if(not started): if not started:
if('#define LV_CONF_H' in i): if '#define LV_CONF_H' in i:
started = 1 started = 1
continue continue
else: else:
continue continue
if('/*--END OF LV_CONF_H--*/' in i): break if '/*--END OF LV_CONF_H--*/' in i: break
if(re.search('^ *# *define .*$', i)): r = re.search(r'^ *# *define ([^\s]+).*$', i)
new = re.sub('^ *# *define', '#define ', i) if r:
new = re.sub(' +', ' ', new) #Remove extra white spaces fout.write(
splitted = new.split(' ') f'#ifndef {r[1]}\n'
fout.write('#ifndef ' + splitted[1] + '\n') f'{i}\n'
fout.write(i + '\n') '#endif\n'
fout.write('#endif\n') )
elif(re.search('^ *typedef .*;.*$', i)): elif re.search('^ *typedef .*;.*$', i):
continue; #igonre typedefs to avoide redeclaration continue #ignore typedefs to avoide redeclaration
else: else:
fout.write(i + '\n') fout.write(f'{i}\n')
fout.write( fout.write(
'\n\ '''
#endif /*LV_CONF_CHECKER_H*/\n\ #endif /*LV_CONF_CHECKER_H*/
') '''
)
fin.close()
fout.close()

View File

@ -261,16 +261,6 @@
#define LV_ATTRIBUTE_LARGE_CONST #define LV_ATTRIBUTE_LARGE_CONST
#endif #endif
/* 1: Variable length array is supported*/
#ifndef LV_COMPILER_VLA_SUPPORTED
#define LV_COMPILER_VLA_SUPPORTED 1
#endif
/* 1: Initialization with non constant values are supported */
#ifndef LV_COMPILER_NON_CONST_INIT_SUPPORTED
#define LV_COMPILER_NON_CONST_INIT_SUPPORTED 1
#endif
/*=================== /*===================
* HAL settings * HAL settings
*==================*/ *==================*/
@ -357,6 +347,9 @@
* More info about fonts: https://docs.littlevgl.com/#Fonts * More info about fonts: https://docs.littlevgl.com/#Fonts
* To create a new font go to: https://littlevgl.com/ttf-font-to-c-array * To create a new font go to: https://littlevgl.com/ttf-font-to-c-array
*/ */
/* Robot fonts with bpp = 4
* https://fonts.google.com/specimen/Roboto */
#ifndef LV_FONT_ROBOTO_12 #ifndef LV_FONT_ROBOTO_12
#define LV_FONT_ROBOTO_12 0 #define LV_FONT_ROBOTO_12 0
#endif #endif
@ -370,6 +363,12 @@
#define LV_FONT_ROBOTO_28 0 #define LV_FONT_ROBOTO_28 0
#endif #endif
/*Pixel perfect monospace font
* http://pelulamu.net/unscii/ */
#ifndef LV_FONT_UNSCII_8
#define LV_FONT_UNSCII_8 0
#endif
/* Optionally declare your custom fonts here. /* Optionally declare your custom fonts here.
* You can use these fonts as default font too * You can use these fonts as default font too
* and they will be available globally. E.g. * and they will be available globally. E.g.

View File

@ -1118,6 +1118,7 @@ static void indev_drag(lv_indev_proc_t * state)
/*If the object didn't moved then clear the invalidated areas*/ /*If the object didn't moved then clear the invalidated areas*/
if(drag_obj->coords.x1 == prev_x && drag_obj->coords.y1 == prev_y) { if(drag_obj->coords.x1 == prev_x && drag_obj->coords.y1 == prev_y) {
state->types.pointer.drag_in_prog = 0;
/*In a special case if the object is moved on a page and /*In a special case if the object is moved on a page and
* the scrollable has fit == true and the object is dragged of the page then * the scrollable has fit == true and the object is dragged of the page then
* while its coordinate is not changing only the parent's size is reduced */ * while its coordinate is not changing only the parent's size is reduced */

View File

@ -174,7 +174,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
/*Set the default styles*/ /*Set the default styles*/
lv_theme_t * th = lv_theme_get_current(); lv_theme_t * th = lv_theme_get_current();
if(th) { if(th) {
new_obj->style_p = th->style.bg; new_obj->style_p = th->style.scr;
} else { } else {
new_obj->style_p = &lv_style_scr; new_obj->style_p = &lv_style_scr;
} }
@ -1606,23 +1606,18 @@ void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p)
* (Without the size of the border or other extra graphical elements) * (Without the size of the border or other extra graphical elements)
* @param coords_p store the result area here * @param coords_p store the result area here
*/ */
void lv_obj_get_inner_coords(const lv_obj_t *obj, lv_area_t * coords_p) void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p)
{ {
const lv_style_t *style = lv_obj_get_style(obj); const lv_style_t * style = lv_obj_get_style(obj);
if(style->body.border.part & LV_BORDER_LEFT) if(style->body.border.part & LV_BORDER_LEFT) coords_p->x1 += style->body.border.width;
coords_p->x1 += style->body.border.width;
if(style->body.border.part & LV_BORDER_RIGHT) if(style->body.border.part & LV_BORDER_RIGHT) coords_p->x2 -= style->body.border.width;
coords_p->x2 -= style->body.border.width;
if(style->body.border.part & LV_BORDER_TOP) if(style->body.border.part & LV_BORDER_TOP) coords_p->y1 += style->body.border.width;
coords_p->y1 += style->body.border.width;
if(style->body.border.part & LV_BORDER_BOTTOM) if(style->body.border.part & LV_BORDER_BOTTOM) coords_p->y2 -= style->body.border.width;
coords_p->y2 -= style->body.border.width;
} }
/** /**
* Get the x coordinate of object * Get the x coordinate of object
* @param obj pointer to an object * @param obj pointer to an object

View File

@ -257,7 +257,6 @@ typedef struct
... [x]: "lv_obj" */ ... [x]: "lv_obj" */
} lv_obj_type_t; } lv_obj_type_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
@ -683,7 +682,7 @@ void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p);
* (Without the size of the border or other extra graphical elements) * (Without the size of the border or other extra graphical elements)
* @param coords_p store the result area here * @param coords_p store the result area here
*/ */
void lv_obj_get_inner_coords(const lv_obj_t *obj, lv_area_t * coords_p); void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p);
/** /**
* Get the x coordinate of object * Get the x coordinate of object

View File

@ -14,7 +14,7 @@
#include "../lv_misc/lv_task.h" #include "../lv_misc/lv_task.h"
#include "../lv_misc/lv_mem.h" #include "../lv_misc/lv_mem.h"
#include "../lv_misc/lv_gc.h" #include "../lv_misc/lv_gc.h"
#include "../lv_draw/lv_draw_basic.h" #include "../lv_draw/lv_draw.h"
#if defined(LV_GC_INCLUDE) #if defined(LV_GC_INCLUDE)
#include LV_GC_INCLUDE #include LV_GC_INCLUDE
@ -217,6 +217,8 @@ void lv_disp_refr_task(lv_task_t * task)
} }
} }
lv_draw_free_buf();
LV_LOG_TRACE("lv_refr_task: ready"); LV_LOG_TRACE("lv_refr_task: ready");
} }
@ -562,7 +564,8 @@ static void lv_refr_vdb_flush(void)
/*In double buffered mode wait until the other buffer is flushed before flushing the current /*In double buffered mode wait until the other buffer is flushed before flushing the current
* one*/ * one*/
if(lv_disp_is_double_buf(disp_refr)) { if(lv_disp_is_double_buf(disp_refr)) {
while(vdb->flushing); while(vdb->flushing)
;
} }
vdb->flushing = 1; vdb->flushing = 1;
@ -572,7 +575,9 @@ static void lv_refr_vdb_flush(void)
if(disp->driver.flush_cb) disp->driver.flush_cb(&disp->driver, &vdb->area, vdb->buf_act); if(disp->driver.flush_cb) disp->driver.flush_cb(&disp->driver, &vdb->area, vdb->buf_act);
if(vdb->buf1 && vdb->buf2) { if(vdb->buf1 && vdb->buf2) {
if(vdb->buf_act == vdb->buf1) vdb->buf_act = vdb->buf2; if(vdb->buf_act == vdb->buf1)
else vdb->buf_act = vdb->buf1; vdb->buf_act = vdb->buf2;
else
vdb->buf_act = vdb->buf1;
} }
} }

View File

@ -11,6 +11,9 @@
#include <stdbool.h> #include <stdbool.h>
#include "lv_draw.h" #include "lv_draw.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_log.h"
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_mem.h"
/********************* /*********************
* DEFINES * DEFINES
@ -27,6 +30,8 @@
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static void * draw_buf = NULL;
static uint32_t draw_buf_size = 0;
/********************** /**********************
* MACROS * MACROS
@ -36,9 +41,41 @@
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
/********************** /**
* STATIC FUNCTIONS * Give a buffer with the given to use during drawing.
**********************/ * Be careful to not use the buffer while other processes are using it.
* @param size the required size
*/
void * lv_draw_get_buf(uint32_t size)
{
if(size <= draw_buf_size) return draw_buf;
LV_LOG_TRACE("lv_draw_get_buf: allocate");
draw_buf_size = size;
if(draw_buf == NULL) {
draw_buf = lv_mem_alloc(size);
lv_mem_assert(draw_buf);
return draw_buf;
}
draw_buf = lv_mem_realloc(draw_buf, size);
lv_mem_assert(draw_buf);
return draw_buf;
}
/**
* Free the draw buffer
*/
void lv_draw_free_buf(void)
{
if(draw_buf) {
lv_mem_free(draw_buf);
draw_buf = NULL;
draw_buf_size = 0;
}
}
#if LV_ANTIALIAS #if LV_ANTIALIAS
@ -143,3 +180,7 @@ void lv_draw_aa_hor_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_
} }
#endif #endif
/**********************
* STATIC FUNCTIONS
**********************/

View File

@ -35,6 +35,18 @@ extern "C" {
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
/**
* Give a buffer with the given to use during drawing.
* Be careful to not use the buffer while other processes are using it.
* @param size the required size
*/
void * lv_draw_get_buf(uint32_t size);
/**
* Free the draw buffer
*/
void lv_draw_free_buf(void);
#if LV_ANTIALIAS #if LV_ANTIALIAS
/** /**

View File

@ -86,14 +86,13 @@ void lv_draw_px(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t
x -= vdb->area.x1; x -= vdb->area.x1;
y -= vdb->area.y1; y -= vdb->area.y1;
if(disp->driver.set_px_cb) { if(disp->driver.set_px_cb) {
disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, x, y, color, opa); disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, x, y, color, opa);
} else { } else {
bool scr_transp = false; bool scr_transp = false;
#if LV_COLOR_SCREEN_TRANSP #if LV_COLOR_SCREEN_TRANSP
scr_transp = disp->driver.screen_transp; scr_transp = disp->driver.screen_transp;
#endif #endif
lv_color_t * vdb_px_p = vdb->buf_act; lv_color_t * vdb_px_p = vdb->buf_act;
vdb_px_p += y * vdb_width + x; vdb_px_p += y * vdb_width + x;
@ -429,13 +428,11 @@ void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint
lv_coord_t row; lv_coord_t row;
lv_coord_t map_useful_w = lv_area_get_width(&masked_a); lv_coord_t map_useful_w = lv_area_get_width(&masked_a);
bool scr_transp = false; bool scr_transp = false;
#if LV_COLOR_SCREEN_TRANSP #if LV_COLOR_SCREEN_TRANSP
scr_transp = disp->driver.screen_transp; scr_transp = disp->driver.screen_transp;
#endif #endif
/*The simplest case just copy the pixels into the VDB*/ /*The simplest case just copy the pixels into the VDB*/
if(chroma_key == false && alpha_byte == false && opa == LV_OPA_COVER && recolor_opa == LV_OPA_TRANSP) { if(chroma_key == false && alpha_byte == false && opa == LV_OPA_COVER && recolor_opa == LV_OPA_TRANSP) {
@ -532,7 +529,6 @@ void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint
/*Normal native VDB write*/ /*Normal native VDB write*/
else { else {
if(opa_result == LV_OPA_COVER) if(opa_result == LV_OPA_COVER)
vdb_buf_tmp[col] = px_color; vdb_buf_tmp[col] = px_color;
else { else {
@ -540,8 +536,8 @@ void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint
vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result); vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result);
} else { } else {
#if LV_COLOR_DEPTH == 32 #if LV_COLOR_DEPTH == 32
vdb_buf_tmp[col] = vdb_buf_tmp[col] = color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].ch.alpha,
color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].ch.alpha, px_color, opa_result); px_color, opa_result);
#endif #endif
} }
} }
@ -624,9 +620,9 @@ static void sw_color_fill(lv_color_t * mem, lv_coord_t mem_width, const lv_area_
/*Calculate with alpha too*/ /*Calculate with alpha too*/
else { else {
bool scr_transp = false; bool scr_transp = false;
#if LV_COLOR_SCREEN_TRANSP #if LV_COLOR_SCREEN_TRANSP
scr_transp = disp->driver.screen_transp; scr_transp = disp->driver.screen_transp;
#endif #endif
lv_color_t bg_tmp = LV_COLOR_BLACK; lv_color_t bg_tmp = LV_COLOR_BLACK;
lv_color_t opa_tmp = lv_color_mix(color, bg_tmp, opa); lv_color_t opa_tmp = lv_color_mix(color, bg_tmp, opa);
@ -653,7 +649,6 @@ static void sw_color_fill(lv_color_t * mem, lv_coord_t mem_width, const lv_area_
} }
} }
/** /**
* Mix two colors. Both color can have alpha value. It requires ARGB888 colors. * Mix two colors. Both color can have alpha value. It requires ARGB888 colors.
* @param bg_color background color * @param bg_color background color
@ -667,7 +662,7 @@ static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa,
#if LV_COLOR_SCREEN_TRANSP #if LV_COLOR_SCREEN_TRANSP
/* Pick the foreground if it's fully opaque or the Background is fully transparent*/ /* Pick the foreground if it's fully opaque or the Background is fully transparent*/
if(fg_opa > LV_OPA_MAX|| bg_opa <= LV_OPA_MIN) { if(fg_opa > LV_OPA_MAX || bg_opa <= LV_OPA_MIN) {
fg_color.ch.alpha = fg_opa; fg_color.ch.alpha = fg_opa;
return fg_color; return fg_color;
} }
@ -717,4 +712,3 @@ static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa,
#endif /*LV_COLOR_SCREEN_TRANSP*/ #endif /*LV_COLOR_SCREEN_TRANSP*/
} }

View File

@ -309,10 +309,8 @@ void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
*/ */
void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c) void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
{ {
if((dsc->header.cf == LV_IMG_CF_ALPHA_1BIT && id > 1) || if((dsc->header.cf == LV_IMG_CF_ALPHA_1BIT && id > 1) || (dsc->header.cf == LV_IMG_CF_ALPHA_2BIT && id > 3) ||
(dsc->header.cf == LV_IMG_CF_ALPHA_2BIT && id > 3) || (dsc->header.cf == LV_IMG_CF_ALPHA_4BIT && id > 15) || (dsc->header.cf == LV_IMG_CF_ALPHA_8BIT)) {
(dsc->header.cf == LV_IMG_CF_ALPHA_4BIT && id > 15) ||
(dsc->header.cf == LV_IMG_CF_ALPHA_8BIT)) {
LV_LOG_WARN("lv_img_buf_set_px_alpha: invalid 'id'"); LV_LOG_WARN("lv_img_buf_set_px_alpha: invalid 'id'");
return; return;
} }
@ -446,34 +444,31 @@ static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mas
lv_opa_t opa = lv_opa_t opa =
opa_scale == LV_OPA_COVER ? style->image.opa : (uint16_t)((uint16_t)style->image.opa * opa_scale) >> 8; opa_scale == LV_OPA_COVER ? style->image.opa : (uint16_t)((uint16_t)style->image.opa * opa_scale) >> 8;
lv_img_cache_entry_t * cdsc = lv_img_cache_open(src, style); lv_img_cache_entry_t * cdsc = lv_img_cache_open(src, style);
if(cdsc == NULL) return LV_RES_INV; if(cdsc == NULL) return LV_RES_INV;
bool chroma_keyed = lv_img_color_format_is_chroma_keyed(cdsc->dec_dsc.header.cf); bool chroma_keyed = lv_img_color_format_is_chroma_keyed(cdsc->dec_dsc.header.cf);
bool alpha_byte = lv_img_color_format_has_alpha(cdsc->dec_dsc.header.cf); bool alpha_byte = lv_img_color_format_has_alpha(cdsc->dec_dsc.header.cf);
if(cdsc->dec_dsc.error_msg != NULL) { if(cdsc->dec_dsc.error_msg != NULL) {
LV_LOG_WARN("Image draw error"); LV_LOG_WARN("Image draw error");
lv_draw_rect(coords, mask, &lv_style_plain, LV_OPA_COVER); lv_draw_rect(coords, mask, &lv_style_plain, LV_OPA_COVER);
lv_draw_label(coords, mask, &lv_style_plain, LV_OPA_COVER, cdsc->dec_dsc.error_msg, LV_TXT_FLAG_NONE, NULL, -1, -1, NULL); lv_draw_label(coords, mask, &lv_style_plain, LV_OPA_COVER, cdsc->dec_dsc.error_msg, LV_TXT_FLAG_NONE, NULL, -1,
-1, NULL);
} }
/* The decoder open could open the image and gave the entire uncompressed image. /* The decoder open could open the image and gave the entire uncompressed image.
* Just draw it!*/ * Just draw it!*/
else if(cdsc->dec_dsc.img_data) { else if(cdsc->dec_dsc.img_data) {
lv_draw_map(coords, mask, cdsc->dec_dsc.img_data, opa, chroma_keyed, alpha_byte, style->image.color, style->image.intense); lv_draw_map(coords, mask, cdsc->dec_dsc.img_data, opa, chroma_keyed, alpha_byte, style->image.color,
style->image.intense);
} }
/* The whole uncompressed image is not available. Try to read it line-by-line*/ /* The whole uncompressed image is not available. Try to read it line-by-line*/
else { else {
lv_coord_t width = lv_area_get_width(&mask_com); lv_coord_t width = lv_area_get_width(&mask_com);
#if LV_COMPILER_VLA_SUPPORTED uint8_t * buf = lv_draw_get_buf(lv_area_get_width(&mask_com) * ((LV_COLOR_DEPTH >> 3) + 1)); /*+1 because of the possible alpha byte*/
uint8_t buf[(lv_area_get_width(&mask_com) * ((LV_COLOR_DEPTH >> 3) + 1))];
#else
uint8_t buf[LV_HOR_RES_MAX * ((LV_COLOR_DEPTH >> 3) + 1)]; /*+1 because of the possible alpha byte*/
#endif
lv_area_t line; lv_area_t line;
lv_area_copy(&line, &mask_com); lv_area_copy(&line, &mask_com);
lv_area_set_height(&line, 1); lv_area_set_height(&line, 1);

View File

@ -55,7 +55,8 @@ static uint8_t hex_char_to_num(char hex);
* @param sel_end end index of selected area (`LV_LABEL_TXT_SEL_OFF` if none) * @param sel_end end index of selected area (`LV_LABEL_TXT_SEL_OFF` if none)
*/ */
void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale, void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale,
const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end, lv_draw_label_hint_t * hint) const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end,
lv_draw_label_hint_t * hint)
{ {
const lv_font_t * font = style->text.font; const lv_font_t * font = style->text.font;
lv_coord_t w; lv_coord_t w;

View File

@ -57,7 +57,8 @@ typedef struct {
* @param sel_end end index of selected area (`LV_LABEL_TXT_SEL_OFF` if none) * @param sel_end end index of selected area (`LV_LABEL_TXT_SEL_OFF` if none)
*/ */
void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale, void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale,
const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end, lv_draw_label_hint_t * hint); const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end,
lv_draw_label_hint_t * hint);
/********************** /**********************
* MACROS * MACROS

View File

@ -15,9 +15,6 @@
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#if LV_COMPILER_VLA_SUPPORTED == 0
#define LINE_MAX_WIDTH 64
#endif
/********************** /**********************
* TYPEDEFS * TYPEDEFS
@ -265,11 +262,8 @@ static void line_draw_skew(line_draw_t * main_line, bool dir_ori, const lv_area_
/* The pattern stores the points of the line ending. It has the good direction and length. /* The pattern stores the points of the line ending. It has the good direction and length.
* The worth case is the 45° line where pattern can have 1.41 x `width` points*/ * The worth case is the 45° line where pattern can have 1.41 x `width` points*/
#if LV_COMPILER_VLA_SUPPORTED
lv_point_t pattern[width * 2]; lv_point_t * pattern = lv_draw_get_buf(width * 2 * sizeof(lv_point_t));
#else
lv_point_t pattern[LINE_MAX_WIDTH];
#endif
lv_coord_t i = 0; lv_coord_t i = 0;
/*Create a perpendicular pattern (a small line)*/ /*Create a perpendicular pattern (a small line)*/

View File

@ -1168,16 +1168,23 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
radius += aa; radius += aa;
#if LV_COMPILER_VLA_SUPPORTED /*Allocate a draw buffer the buffer required to draw the shadow*/
lv_coord_t curve_x[radius + swidth + 1]; /*Stores the 'x' coordinates of a quarter circle.*/ int16_t filter_width = 2 * swidth + 1;
#else uint32_t curve_x_size = ((radius + swidth + 1) + 3) & ~0x3; /*Round to 4*/
#if LV_HOR_RES_MAX > LV_VER_RES_MAX curve_x_size *= sizeof(lv_coord_t);
lv_coord_t curve_x[LV_HOR_RES_MAX]; uint32_t line_1d_blur_size = (filter_width + 3) & ~0x3; /*Round to 4*/
#else line_1d_blur_size *= sizeof(uint32_t);
lv_coord_t curve_x[LV_VER_RES_MAX]; uint32_t line_2d_blur_size = ((radius + swidth + 1) + 3) & ~0x3; /*Round to 4*/
#endif line_2d_blur_size *= sizeof(lv_opa_t);
#endif
memset(curve_x, 0, sizeof(curve_x)); uint8_t * draw_buf = lv_draw_get_buf(curve_x_size + line_1d_blur_size + line_2d_blur_size);
/*Divide the draw buffer*/
lv_coord_t * curve_x = (lv_coord_t *)&draw_buf[0]; /*Stores the 'x' coordinates of a quarter circle.*/
uint32_t * line_1d_blur = (uint32_t *)&draw_buf[curve_x_size];
lv_opa_t * line_2d_blur = (lv_opa_t *)&draw_buf[curve_x_size + line_1d_blur_size];
memset(curve_x, 0, curve_x_size);
lv_point_t circ; lv_point_t circ;
lv_coord_t circ_tmp; lv_coord_t circ_tmp;
lv_circ_init(&circ, &circ_tmp, radius); lv_circ_init(&circ, &circ_tmp, radius);
@ -1187,17 +1194,6 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
lv_circ_next(&circ, &circ_tmp); lv_circ_next(&circ, &circ_tmp);
} }
int16_t line; int16_t line;
int16_t filter_width = 2 * swidth + 1;
#if LV_COMPILER_VLA_SUPPORTED
uint32_t line_1d_blur[filter_width];
#else
#if LV_HOR_RES_MAX > LV_VER_RES_MAX
uint32_t line_1d_blur[LV_HOR_RES_MAX];
#else
uint32_t line_1d_blur[LV_VER_RES_MAX];
#endif
#endif
/*1D Blur horizontally*/ /*1D Blur horizontally*/
lv_opa_t opa = opa_scale == LV_OPA_COVER ? style->body.opa : (uint16_t)((uint16_t)style->body.opa * opa_scale) >> 8; lv_opa_t opa = opa_scale == LV_OPA_COVER ? style->body.opa : (uint16_t)((uint16_t)style->body.opa * opa_scale) >> 8;
for(line = 0; line < filter_width; line++) { for(line = 0; line < filter_width; line++) {
@ -1206,15 +1202,6 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
} }
uint16_t col; uint16_t col;
#if LV_COMPILER_VLA_SUPPORTED
lv_opa_t line_2d_blur[radius + swidth + 1];
#else
#if LV_HOR_RES_MAX > LV_VER_RES_MAX
lv_opa_t line_2d_blur[LV_HOR_RES_MAX];
#else
lv_opa_t line_2d_blur[LV_VER_RES_MAX];
#endif
#endif
lv_point_t point_rt; lv_point_t point_rt;
lv_point_t point_rb; lv_point_t point_rb;
@ -1332,15 +1319,18 @@ static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * ma
radius = lv_draw_cont_radius_corr(radius, width, height); radius = lv_draw_cont_radius_corr(radius, width, height);
radius += aa * SHADOW_BOTTOM_AA_EXTRA_RADIUS; radius += aa * SHADOW_BOTTOM_AA_EXTRA_RADIUS;
swidth += aa; swidth += aa;
#if LV_COMPILER_VLA_SUPPORTED
lv_coord_t curve_x[radius + 1]; /*Stores the 'x' coordinates of a quarter circle.*/ uint32_t curve_x_size = ((radius + 1) + 3) & ~0x3; /*Round to 4*/
#else curve_x_size *= sizeof(lv_coord_t);
#if LV_HOR_RES_MAX > LV_VER_RES_MAX lv_opa_t line_1d_blur_size = (swidth + 3) & ~0x3; /*Round to 4*/
lv_coord_t curve_x[LV_HOR_RES_MAX]; line_1d_blur_size *= sizeof(lv_opa_t);
#else
lv_coord_t curve_x[LV_VER_RES_MAX]; uint8_t * draw_buf = lv_draw_get_buf(curve_x_size + line_1d_blur_size);
#endif
#endif /*Divide the draw buffer*/
lv_coord_t * curve_x = (lv_coord_t *)&draw_buf[0]; /*Stores the 'x' coordinates of a quarter circle.*/
lv_opa_t * line_1d_blur = (lv_opa_t *)&draw_buf[curve_x_size];
lv_point_t circ; lv_point_t circ;
lv_coord_t circ_tmp; lv_coord_t circ_tmp;
lv_circ_init(&circ, &circ_tmp, radius); lv_circ_init(&circ, &circ_tmp, radius);
@ -1351,15 +1341,6 @@ static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * ma
} }
int16_t col; int16_t col;
#if LV_COMPILER_VLA_SUPPORTED
lv_opa_t line_1d_blur[swidth];
#else
#if LV_HOR_RES_MAX > LV_VER_RES_MAX
lv_opa_t line_1d_blur[LV_HOR_RES_MAX];
#else
lv_opa_t line_1d_blur[LV_VER_RES_MAX];
#endif
#endif
lv_opa_t opa = opa_scale == LV_OPA_COVER ? style->body.opa : (uint16_t)((uint16_t)style->body.opa * opa_scale) >> 8; lv_opa_t opa = opa_scale == LV_OPA_COVER ? style->body.opa : (uint16_t)((uint16_t)style->body.opa * opa_scale) >> 8;
for(col = 0; col < swidth; col++) { for(col = 0; col < swidth; col++) {

View File

@ -84,7 +84,7 @@ lv_img_cache_entry_t * lv_img_cache_open(const void * src, const lv_style_t * st
* Image difficult to open should live longer to keep avoid frequent their recaching. * Image difficult to open should live longer to keep avoid frequent their recaching.
* Therefore increase `life` with `time_to_open`*/ * Therefore increase `life` with `time_to_open`*/
cached_src = &cache[i]; cached_src = &cache[i];
cached_src->life += cached_src->dec_dsc.time_to_open * LV_IMG_CACHE_LIFE_GAIN ; cached_src->life += cached_src->dec_dsc.time_to_open * LV_IMG_CACHE_LIFE_GAIN;
if(cached_src->life > LV_IMG_CACHE_LIFE_LIMIT) cached_src->life = LV_IMG_CACHE_LIFE_LIMIT; if(cached_src->life > LV_IMG_CACHE_LIFE_LIMIT) cached_src->life = LV_IMG_CACHE_LIFE_LIMIT;
LV_LOG_TRACE("image draw: image found in the cache"); LV_LOG_TRACE("image draw: image found in the cache");
break; break;
@ -114,7 +114,7 @@ lv_img_cache_entry_t * lv_img_cache_open(const void * src, const lv_style_t * st
t_start = lv_tick_get(); t_start = lv_tick_get();
cached_src->dec_dsc.time_to_open = 0; cached_src->dec_dsc.time_to_open = 0;
lv_res_t open_res = lv_img_decoder_open(&cached_src->dec_dsc, src, style); lv_res_t open_res = lv_img_decoder_open(&cached_src->dec_dsc, src, style);
if(open_res ==LV_RES_INV) { if(open_res == LV_RES_INV) {
LV_LOG_WARN("Image draw cannot open the image resource"); LV_LOG_WARN("Image draw cannot open the image resource");
lv_img_decoder_close(&cached_src->dec_dsc); lv_img_decoder_close(&cached_src->dec_dsc);
memset(&cached_src->dec_dsc, 0, sizeof(lv_img_decoder_dsc_t)); memset(&cached_src->dec_dsc, 0, sizeof(lv_img_decoder_dsc_t));

View File

@ -36,7 +36,7 @@ typedef struct
* Decrement all lifes by one every in every ::lv_img_cache_open. * Decrement all lifes by one every in every ::lv_img_cache_open.
* If life == 0 the entry can be reused */ * If life == 0 the entry can be reused */
int32_t life; int32_t life;
}lv_img_cache_entry_t; } lv_img_cache_entry_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES

View File

@ -126,7 +126,7 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, const
dsc->src_type = lv_img_src_get_type(src); dsc->src_type = lv_img_src_get_type(src);
dsc->user_data = NULL; dsc->user_data = NULL;
lv_res_t res; lv_res_t res = LV_RES_INV;
lv_img_decoder_t * d; lv_img_decoder_t * d;
LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d) LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d)
@ -568,12 +568,9 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
#if LV_USE_FILESYSTEM #if LV_USE_FILESYSTEM
lv_img_decoder_built_in_data_t * user_data = dsc->user_data; lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
#if LV_COMPILER_VLA_SUPPORTED
uint8_t fs_buf[w];
#else
uint8_t fs_buf[LV_HOR_RES_MAX]; uint8_t fs_buf[LV_HOR_RES_MAX];
#endif #endif
#endif
const uint8_t * data_tmp = NULL; const uint8_t * data_tmp = NULL;
if(dsc->src_type == LV_IMG_SRC_VARIABLE) { if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
const lv_img_dsc_t * img_dsc = dsc->src; const lv_img_dsc_t * img_dsc = dsc->src;
@ -658,11 +655,7 @@ 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; lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
#if LV_USE_FILESYSTEM #if LV_USE_FILESYSTEM
#if LV_COMPILER_VLA_SUPPORTED
uint8_t fs_buf[w];
#else
uint8_t fs_buf[LV_HOR_RES_MAX]; uint8_t fs_buf[LV_HOR_RES_MAX];
#endif
#endif #endif
const uint8_t * data_tmp = NULL; const uint8_t * data_tmp = NULL;
if(dsc->src_type == LV_IMG_SRC_VARIABLE) { if(dsc->src_type == LV_IMG_SRC_VARIABLE) {

View File

@ -190,10 +190,8 @@ typedef struct _lv_img_decoder_dsc
* Can be set in `open` function or set NULL. */ * Can be set in `open` function or set NULL. */
const char * error_msg; const char * error_msg;
#if LV_USE_USER_DATA
/**Store any custom data here is required*/ /**Store any custom data here is required*/
void * user_data; void * user_data;
#endif
} lv_img_decoder_dsc_t; } lv_img_decoder_dsc_t;
/********************** /**********************
@ -217,7 +215,6 @@ void lv_img_decoder_init(void);
*/ */
lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header); lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header);
/** /**
* Open an image. * Open an image.
* Try the created image decoder one by one. Once one is able to open the image that decoder is save in `dsc` * Try the created image decoder one by one. Once one is able to open the image that decoder is save in `dsc`
@ -290,36 +287,6 @@ void lv_img_decoder_set_read_line_cb(lv_img_decoder_t * decoder, lv_img_decoder_
*/ */
void lv_img_decoder_set_close_cb(lv_img_decoder_t * decoder, lv_img_decoder_close_f_t close_cb); void lv_img_decoder_set_close_cb(lv_img_decoder_t * decoder, lv_img_decoder_close_f_t close_cb);
/**
* Set a custom user data in an image decoder.
* @param decoder pointer to an image decoder
* @param user_data the user data to set
*/
static inline void lv_img_decoder_set_user_data(lv_img_decoder_t * decoder, lv_img_decoder_t user_data)
{
memcpy(&decoder->user_data, &user_data, sizeof(user_data));
}
/**
* Get the user data
* @param decoder pointer to an image decoder
* @return the user data
*/
static inline lv_img_decoder_user_data_t lv_img_decoder_get_user_data(lv_img_decoder_t * decoder)
{
return decoder->user_data;
}
/**
* Get a pointer to the user data
* @param decoder pointer to an image decoder
* @return pointer to the user data
*/
static inline lv_img_decoder_user_data_t * lv_img_decoder_get_user_data_ptr(lv_img_decoder_t * decoder)
{
return &decoder->user_data;
}
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/

View File

@ -71,7 +71,6 @@ void lv_disp_drv_init(lv_disp_drv_t * driver)
driver->screen_transp = 1; driver->screen_transp = 1;
#endif #endif
#if LV_USE_GPU #if LV_USE_GPU
driver->gpu_blend_cb = NULL; driver->gpu_blend_cb = NULL;
driver->gpu_fill_cb = NULL; driver->gpu_fill_cb = NULL;

View File

@ -70,30 +70,41 @@ void lv_log_add(lv_log_level_t level, const char * file, int line, const char *
**********************/ **********************/
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_TRACE #if LV_LOG_LEVEL <= LV_LOG_LEVEL_TRACE
# define LV_LOG_TRACE(dsc) lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, dsc); #define LV_LOG_TRACE(dsc) lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, dsc);
#else #else
# define LV_LOG_TRACE(dsc) {;} #define LV_LOG_TRACE(dsc) \
{ \
; \
}
#endif #endif
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_INFO #if LV_LOG_LEVEL <= LV_LOG_LEVEL_INFO
# define LV_LOG_INFO(dsc) lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, dsc); #define LV_LOG_INFO(dsc) lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, dsc);
#else #else
# define LV_LOG_INFO(dsc) {;} #define LV_LOG_INFO(dsc) \
{ \
; \
}
#endif #endif
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_WARN #if LV_LOG_LEVEL <= LV_LOG_LEVEL_WARN
# define LV_LOG_WARN(dsc) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, dsc); #define LV_LOG_WARN(dsc) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, dsc);
#else #else
# define LV_LOG_WARN(dsc) {;} #define LV_LOG_WARN(dsc) \
{ \
; \
}
#endif #endif
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_ERROR #if LV_LOG_LEVEL <= LV_LOG_LEVEL_ERROR
# define LV_LOG_ERROR(dsc) lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, dsc); #define LV_LOG_ERROR(dsc) lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, dsc);
#else #else
# define LV_LOG_ERROR(dsc) {;} #define LV_LOG_ERROR(dsc) \
{ \
; \
}
#endif #endif
#else /*LV_USE_LOG*/ #else /*LV_USE_LOG*/
/*Do nothing if `LV_USE_LOG 0`*/ /*Do nothing if `LV_USE_LOG 0`*/

View File

@ -96,7 +96,6 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void);
*/ */
lv_task_t * lv_task_create_basic(void); lv_task_t * lv_task_create_basic(void);
/** /**
* Create a new lv_task * Create a new lv_task
* @param task_xcb a callback which is the task itself. It will be called periodically. * @param task_xcb a callback which is the task itself. It will be called periodically.

View File

@ -130,7 +130,6 @@ void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t *
size_res->y -= line_space; size_res->y -= line_space;
} }
/** /**
* Get the next line of text. Check line length and break chars too. * Get the next line of text. Check line length and break chars too.
* @param txt a '\0' terminated string * @param txt a '\0' terminated string
@ -140,8 +139,8 @@ void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t *
* @param flags settings for the text from 'txt_flag_type' enum * @param flags settings for the text from 'txt_flag_type' enum
* @return the index of the first char of the new line (in byte index not letter index. With UTF-8 they are different) * @return the index of the first char of the new line (in byte index not letter index. With UTF-8 they are different)
*/ */
uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font, uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t max_width,
lv_coord_t letter_space, lv_coord_t max_width, lv_txt_flag_t flag) lv_txt_flag_t flag)
{ {
if(txt == NULL) return 0; if(txt == NULL) return 0;
if(font == NULL) return 0; if(font == NULL) return 0;
@ -174,8 +173,10 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font,
/*Check for new line chars*/ /*Check for new line chars*/
if(letter == '\n' || letter == '\r') { if(letter == '\n' || letter == '\r') {
/*Return with the first letter of the next line*/ /*Return with the first letter of the next line*/
if(letter == '\r' && letter_next == '\n') return i_next; if(letter == '\r' && letter_next == '\n')
else return i; return i_next;
else
return i;
} else { /*Check the actual length*/ } else { /*Check the actual length*/
letter_w = lv_font_get_glyph_width(font, letter, letter_next); letter_w = lv_font_get_glyph_width(font, letter, letter_next);
cur_w += letter_w; cur_w += letter_w;

View File

@ -312,7 +312,7 @@ uint16_t lv_bar_get_anim_time(lv_obj_t * bar)
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
return ext->anim_time; return ext->anim_time;
#else #else
(void) bar; /*Unused*/ (void)bar; /*Unused*/
return 0; return 0;
#endif #endif
} }

View File

@ -40,36 +40,69 @@ extern "C" {
/** Possible states of a button. /** Possible states of a button.
* It can be used not only by buttons but other button-like objects too*/ * It can be used not only by buttons but other button-like objects too*/
enum { enum {
LV_BTN_STATE_REL, /**Released*/ /**Released*/
LV_BTN_STATE_PR, /**Pressed*/ LV_BTN_STATE_REL,
LV_BTN_STATE_TGL_REL, /**Toggled released*/
LV_BTN_STATE_TGL_PR, /**Toggled pressed*/ /**Pressed*/
LV_BTN_STATE_INA, /**Inactive*/ LV_BTN_STATE_PR,
LV_BTN_STATE_NUM,
/**Toggled released*/
LV_BTN_STATE_TGL_REL,
/**Toggled pressed*/
LV_BTN_STATE_TGL_PR,
/**Inactive*/
LV_BTN_STATE_INA,
/**Number of states*/
_LV_BTN_STATE_NUM,
}; };
typedef uint8_t lv_btn_state_t; typedef uint8_t lv_btn_state_t;
/*Data of button*/ /** Extended data of button*/
typedef struct typedef struct
{ {
lv_cont_ext_t cont; /*Ext. of ancestor*/ /** Ext. of ancestor*/
lv_cont_ext_t cont;
/*New data for this type */ /*New data for this type */
const lv_style_t * styles[LV_BTN_STATE_NUM]; /*Styles in each state*/
/**Styles in each state*/
const lv_style_t * styles[_LV_BTN_STATE_NUM];
#if LV_BTN_INK_EFFECT #if LV_BTN_INK_EFFECT
uint16_t ink_in_time; /*[ms] Time of ink fill effect (0: disable ink effect)*/ /** [ms] Time of ink fill effect (0: disable ink effect)*/
uint16_t ink_wait_time; /*[ms] Wait before the ink disappears */ uint16_t ink_in_time;
uint16_t ink_out_time; /*[ms] Time of ink disappearing*/
/** [ms] Wait before the ink disappears */
uint16_t ink_wait_time;
/** [ms] Time of ink disappearing*/
uint16_t ink_out_time;
#endif #endif
lv_btn_state_t state : 3; /*Current state of the button from 'lv_btn_state_t' enum*/
uint8_t toggle : 1; /*1: Toggle enabled*/ /** Current state of the button from 'lv_btn_state_t' enum*/
lv_btn_state_t state : 3;
/** 1: Toggle enabled*/
uint8_t toggle : 1;
} lv_btn_ext_t; } lv_btn_ext_t;
/*Styles*/ /**Styles*/
enum { enum {
/** Release style */
LV_BTN_STYLE_REL, LV_BTN_STYLE_REL,
/**Pressed style*/
LV_BTN_STYLE_PR, LV_BTN_STYLE_PR,
/** Toggle released style*/
LV_BTN_STYLE_TGL_REL, LV_BTN_STYLE_TGL_REL,
/** Toggle pressed style */
LV_BTN_STYLE_TGL_PR, LV_BTN_STYLE_TGL_PR,
/** Inactive style*/
LV_BTN_STYLE_INA, LV_BTN_STYLE_INA,
}; };
typedef uint8_t lv_btn_style_t; typedef uint8_t lv_btn_style_t;

View File

@ -381,7 +381,6 @@ void lv_btnm_set_btn_ctrl_all(lv_obj_t * btnm, lv_btnm_ctrl_t ctrl)
} }
} }
/** /**
* Clear the attributes of all buttons of a button matrix * Clear the attributes of all buttons of a button matrix
* @param btnm pointer to a button matrix object * @param btnm pointer to a button matrix object

View File

@ -54,7 +54,7 @@ typedef struct
const char ** map_p; /*Pointer to the current map*/ const char ** map_p; /*Pointer to the current map*/
lv_area_t * button_areas; /*Array of areas of buttons*/ lv_area_t * button_areas; /*Array of areas of buttons*/
lv_btnm_ctrl_t * ctrl_bits; /*Array of control bytes*/ lv_btnm_ctrl_t * ctrl_bits; /*Array of control bytes*/
const lv_style_t * styles_btn[LV_BTN_STATE_NUM]; /*Styles of buttons in each state*/ const lv_style_t * styles_btn[_LV_BTN_STATE_NUM]; /*Styles of buttons in each state*/
uint16_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/ uint16_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/
uint16_t btn_id_pr; /*Index of the currently pressed button or LV_BTNM_BTN_NONE*/ uint16_t btn_id_pr; /*Index of the currently pressed button or LV_BTNM_BTN_NONE*/
uint16_t btn_id_act; /*Index of the active button (being pressed/released etc) or LV_BTNM_BTN_NONE */ uint16_t btn_id_act; /*Index of the active button (being pressed/released etc) or LV_BTNM_BTN_NONE */

View File

@ -544,7 +544,8 @@ void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord
default: flag = LV_TXT_FLAG_NONE; break; default: flag = LV_TXT_FLAG_NONE; break;
} }
lv_draw_label(&coords, &mask, style, LV_OPA_COVER, txt, flag, NULL, LV_LABEL_TEXT_SEL_OFF, LV_LABEL_TEXT_SEL_OFF, NULL); lv_draw_label(&coords, &mask, style, LV_OPA_COVER, txt, flag, NULL, LV_LABEL_TEXT_SEL_OFF, LV_LABEL_TEXT_SEL_OFF,
NULL);
lv_refr_set_disp_refreshing(refr_ori); lv_refr_set_disp_refreshing(refr_ori);
} }
@ -601,7 +602,6 @@ void lv_canvas_draw_img(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, const voi
lv_refr_set_disp_refreshing(refr_ori); lv_refr_set_disp_refreshing(refr_ori);
} }
/** /**
* Draw a line on the canvas * Draw a line on the canvas
* @param canvas pointer to a canvas object * @param canvas pointer to a canvas object

View File

@ -146,8 +146,8 @@ const lv_style_t * lv_canvas_get_style(const lv_obj_t * canvas, lv_canvas_style_
* @param w width of the buffer to copy * @param w width of the buffer to copy
* @param h height of the buffer to copy * @param h height of the buffer to copy
*/ */
void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t x, void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t x, lv_coord_t y, lv_coord_t w,
lv_coord_t y, lv_coord_t w, lv_coord_t h); lv_coord_t h);
/** /**
* Rotate and image and store the result on a canvas. * Rotate and image and store the result on a canvas.
@ -197,7 +197,6 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord
void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_t max_w, const lv_style_t * style, void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_t max_w, const lv_style_t * style,
const char * txt, lv_label_align_t align); const char * txt, lv_label_align_t align);
/** /**
* Draw an image on the canvas * Draw an image on the canvas
* @param canvas pointer to a canvas object * @param canvas pointer to a canvas object

View File

@ -473,7 +473,8 @@ void lv_chart_set_y_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_
* else number of ticks between two value labels * else number of ticks between two value labels
* @param options extra options * @param options extra options
*/ */
void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, lv_chart_axis_options_t options) void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options)
{ {
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->x_axis.num_tick_marks = num_tick_marks; ext->x_axis.num_tick_marks = num_tick_marks;
@ -489,7 +490,8 @@ void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, ui
* else number of ticks between two value labels * else number of ticks between two value labels
* @param options extra options * @param options extra options
*/ */
void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, lv_chart_axis_options_t options) void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options)
{ {
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->y_axis.num_tick_marks = num_tick_marks; ext->y_axis.num_tick_marks = num_tick_marks;
@ -498,10 +500,10 @@ void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, ui
} }
/** /**
* Set the margin around the chart, used for axes value and ticks * Set the margin around the chart, used for axes value and ticks
* @param chart pointer to an chart object * @param chart pointer to an chart object
* @param margin value of the margin [px] * @param margin value of the margin [px]
*/ */
void lv_chart_set_margin(lv_obj_t * chart, uint16_t margin) void lv_chart_set_margin(lv_obj_t * chart, uint16_t margin)
{ {
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);

View File

@ -235,7 +235,7 @@ void lv_chart_set_update_mode(lv_obj_t * chart, lv_chart_update_mode_t update_mo
*/ */
static inline void lv_chart_set_style(lv_obj_t * chart, lv_chart_style_t type, const lv_style_t * style) static inline void lv_chart_set_style(lv_obj_t * chart, lv_chart_style_t type, const lv_style_t * style)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
lv_obj_set_style(chart, style); lv_obj_set_style(chart, style);
} }
@ -267,7 +267,8 @@ void lv_chart_set_y_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_
* else number of ticks between two value labels * else number of ticks between two value labels
* @param options extra options * @param options extra options
*/ */
void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, lv_chart_axis_options_t options); void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options);
/** /**
* Set the y-axis tick count and labels of a chart * Set the y-axis tick count and labels of a chart
@ -277,7 +278,8 @@ void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, ui
* else number of ticks between two value labels * else number of ticks between two value labels
* @param options extra options * @param options extra options
*/ */
void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, lv_chart_axis_options_t options); void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options);
/** /**
* Set the margin around the chart, used for axes value and ticks * Set the margin around the chart, used for axes value and ticks
@ -333,7 +335,7 @@ lv_opa_t lv_chart_get_series_darking(const lv_obj_t * chart);
*/ */
static inline const lv_style_t * lv_chart_get_style(const lv_obj_t * chart, lv_chart_style_t type) static inline const lv_style_t * lv_chart_get_style(const lv_obj_t * chart, lv_chart_style_t type)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
return lv_obj_get_style(chart); return lv_obj_get_style(chart);
} }

View File

@ -87,7 +87,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy)
/*Init the new container*/ /*Init the new container*/
if(copy == NULL) { if(copy == NULL) {
/*Set the default styles*/ /*Set the default styles if it's not screen*/
if(par != NULL) {
lv_theme_t * th = lv_theme_get_current(); lv_theme_t * th = lv_theme_get_current();
if(th) { if(th) {
lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, th->style.cont); lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, th->style.cont);
@ -95,6 +96,7 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy)
lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, &lv_style_pretty); lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, &lv_style_pretty);
} }
} }
}
/*Copy an existing object*/ /*Copy an existing object*/
else { else {
lv_cont_ext_t * copy_ext = lv_obj_get_ext_attr(copy); lv_cont_ext_t * copy_ext = lv_obj_get_ext_attr(copy);

View File

@ -43,6 +43,7 @@ enum {
LV_LAYOUT_ROW_B, /**< Row bottom align*/ LV_LAYOUT_ROW_B, /**< Row bottom align*/
LV_LAYOUT_PRETTY, /**< Put as many object as possible in row and begin a new row*/ LV_LAYOUT_PRETTY, /**< Put as many object as possible in row and begin a new row*/
LV_LAYOUT_GRID, /**< Align same-sized object into a grid*/ LV_LAYOUT_GRID, /**< Align same-sized object into a grid*/
_LV_LAYOUT_NUM
}; };
typedef uint8_t lv_layout_t; typedef uint8_t lv_layout_t;
@ -55,6 +56,7 @@ enum {
LV_FIT_FLOOD, /**< Align the size to the parent's edge*/ LV_FIT_FLOOD, /**< Align the size to the parent's edge*/
LV_FIT_FILL, /**< Align the size to the parent's edge first but if there is an object out of it LV_FIT_FILL, /**< Align the size to the parent's edge first but if there is an object out of it
then get larger */ then get larger */
_LV_FIT_NUM
}; };
typedef uint8_t lv_fit_t; typedef uint8_t lv_fit_t;
@ -140,7 +142,7 @@ static inline void lv_cont_set_fit(lv_obj_t * cont, lv_fit_t fit)
*/ */
static inline void lv_cont_set_style(lv_obj_t * cont, lv_cont_style_t type, const lv_style_t * style) static inline void lv_cont_set_style(lv_obj_t * cont, lv_cont_style_t type, const lv_style_t * style)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
lv_obj_set_style(cont, style); lv_obj_set_style(cont, style);
} }
@ -191,7 +193,7 @@ lv_fit_t lv_cont_get_fit_bottom(const lv_obj_t * cont);
*/ */
static inline const lv_style_t * lv_cont_get_style(const lv_obj_t * cont, lv_cont_style_t type) static inline const lv_style_t * lv_cont_get_style(const lv_obj_t * cont, lv_cont_style_t type)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
return lv_obj_get_style(cont); return lv_obj_get_style(cont);
} }

View File

@ -749,8 +749,9 @@ static lv_res_t release_handler(lv_obj_t * ddlist)
lv_ddlist_refr_size(ddlist, true); lv_ddlist_refr_size(ddlist, true);
} else { } else {
/*Leave edit mode once a new item is selected*/
lv_indev_t * indev = lv_indev_get_act(); 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) { if(lv_indev_get_type(indev) == LV_INDEV_TYPE_ENCODER) {
ext->sel_opt_id_ori = ext->sel_opt_id; ext->sel_opt_id_ori = ext->sel_opt_id;
lv_group_t * g = lv_obj_get_group(ddlist); lv_group_t * g = lv_obj_get_group(ddlist);
@ -758,6 +759,7 @@ static lv_res_t release_handler(lv_obj_t * ddlist)
lv_group_set_editing(g, false); lv_group_set_editing(g, false);
} }
} }
#endif
/*Search the clicked option (For KEYPAD and ENCODER the new value should be already set)*/ /*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) { if(lv_indev_get_type(indev) == LV_INDEV_TYPE_POINTER || lv_indev_get_type(indev) == LV_INDEV_TYPE_BUTTON) {

View File

@ -128,7 +128,7 @@ void lv_gauge_set_scale(lv_obj_t * gauge, uint16_t angle, uint8_t line_cnt, uint
* */ * */
static inline void lv_gauge_set_style(lv_obj_t * gauge, lv_gauge_style_t type, lv_style_t * style) static inline void lv_gauge_set_style(lv_obj_t * gauge, lv_gauge_style_t type, lv_style_t * style)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
lv_obj_set_style(gauge, style); lv_obj_set_style(gauge, style);
} }
@ -216,7 +216,7 @@ static inline uint16_t lv_gauge_get_scale_angle(const lv_obj_t * gauge)
*/ */
static inline const lv_style_t * lv_gauge_get_style(const lv_obj_t * gauge, lv_gauge_style_t type) static inline const lv_style_t * lv_gauge_get_style(const lv_obj_t * gauge, lv_gauge_style_t type)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
return lv_obj_get_style(gauge); return lv_obj_get_style(gauge);
} }

View File

@ -43,11 +43,11 @@ typedef struct
lv_btn_ext_t btn; /*Ext. of ancestor*/ lv_btn_ext_t btn; /*Ext. of ancestor*/
/*New data for this type */ /*New data for this type */
#if LV_IMGBTN_TILED == 0 #if LV_IMGBTN_TILED == 0
const void * img_src[LV_BTN_STATE_NUM]; /*Store images to each state*/ const void * img_src[_LV_BTN_STATE_NUM]; /*Store images to each state*/
#else #else
const void * img_src_left[LV_BTN_STATE_NUM]; /*Store left side images to each state*/ const void * img_src_left[_LV_BTN_STATE_NUM]; /*Store left side images to each state*/
const void * img_src_mid[LV_BTN_STATE_NUM]; /*Store center images to each state*/ const void * img_src_mid[_LV_BTN_STATE_NUM]; /*Store center images to each state*/
const void * img_src_right[LV_BTN_STATE_NUM]; /*Store right side images to each state*/ const void * img_src_right[_LV_BTN_STATE_NUM]; /*Store right side images to each state*/
#endif #endif
lv_img_cf_t act_cf; /*Color format of the currently active image*/ lv_img_cf_t act_cf; /*Color format of the currently active image*/
} lv_imgbtn_ext_t; } lv_imgbtn_ext_t;

View File

@ -23,7 +23,8 @@
#endif #endif
#define LV_LABEL_DOT_END_INV 0xFFFF #define LV_LABEL_DOT_END_INV 0xFFFF
#define LV_LABEL_HINT_HEIGHT_LIMIT 1024 /*Enable "hint" to buffer info about labels larger than this. (Speed up their drawing)*/ #define LV_LABEL_HINT_HEIGHT_LIMIT \
1024 /*Enable "hint" to buffer info about labels larger than this. (Speed up their drawing)*/
/********************** /**********************
* TYPEDEFS * TYPEDEFS
@ -358,8 +359,8 @@ void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed)
lv_label_refr_text(label); lv_label_refr_text(label);
} }
#else #else
(void) label; /*Unused*/ (void)label; /*Unused*/
(void) anim_speed; /*Unused*/ (void)anim_speed; /*Unused*/
#endif #endif
} }
@ -452,7 +453,7 @@ uint16_t lv_label_get_anim_speed(const lv_obj_t * label)
lv_label_ext_t * ext = lv_obj_get_ext_attr(label); lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->anim_speed; return ext->anim_speed;
#else #else
(void) label; /*Unused*/ (void)label; /*Unused*/
return 0; return 0;
#endif #endif
} }
@ -854,7 +855,8 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_
} }
lv_draw_label_hint_t * hint = &ext->hint; lv_draw_label_hint_t * hint = &ext->hint;
if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC || lv_obj_get_height(label) < LV_LABEL_HINT_HEIGHT_LIMIT) hint = NULL; if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC || lv_obj_get_height(label) < LV_LABEL_HINT_HEIGHT_LIMIT)
hint = NULL;
lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ext->offset, lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ext->offset,
lv_label_get_text_sel_start(label), lv_label_get_text_sel_end(label), hint); lv_label_get_text_sel_start(label), lv_label_get_text_sel_end(label), hint);

View File

@ -184,7 +184,7 @@ void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed);
*/ */
static inline void lv_label_set_style(lv_obj_t * label, lv_label_style_t type, const lv_style_t * style) static inline void lv_label_set_style(lv_obj_t * label, lv_label_style_t type, const lv_style_t * style)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
lv_obj_set_style(label, style); lv_obj_set_style(label, style);
} }
@ -282,7 +282,7 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos);
*/ */
static inline const lv_style_t * lv_label_get_style(const lv_obj_t * label, lv_label_style_t type) static inline const lv_style_t * lv_label_get_style(const lv_obj_t * label, lv_label_style_t type)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
return lv_obj_get_style(label); return lv_obj_get_style(label);
} }

View File

@ -90,7 +90,7 @@ void lv_led_toggle(lv_obj_t * led);
*/ */
static inline void lv_led_set_style(lv_obj_t * led, lv_led_style_t type, const lv_style_t * style) static inline void lv_led_set_style(lv_obj_t * led, lv_led_style_t type, const lv_style_t * style)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
lv_obj_set_style(led, style); lv_obj_set_style(led, style);
} }
@ -109,7 +109,7 @@ uint8_t lv_led_get_bright(const lv_obj_t * led);
*/ */
static inline const lv_style_t * lv_led_get_style(const lv_obj_t * led, lv_led_style_t type) static inline const lv_style_t * lv_led_get_style(const lv_obj_t * led, lv_led_style_t type)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
return lv_obj_get_style(led); return lv_obj_get_style(led);
} }

View File

@ -100,7 +100,7 @@ void lv_line_set_y_invert(lv_obj_t * line, bool en);
*/ */
static inline void lv_line_set_style(lv_obj_t * line, lv_line_style_t type, const lv_style_t * style) static inline void lv_line_set_style(lv_obj_t * line, lv_line_style_t type, const lv_style_t * style)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
lv_obj_set_style(line, style); lv_obj_set_style(line, style);
} }
@ -130,7 +130,7 @@ bool lv_line_get_y_invert(const lv_obj_t * line);
*/ */
static inline const lv_style_t * lv_line_get_style(const lv_obj_t * line, lv_line_style_t type) static inline const lv_style_t * lv_line_get_style(const lv_obj_t * line, lv_line_style_t type)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
return lv_obj_get_style(line); return lv_obj_get_style(line);
} }

View File

@ -684,6 +684,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_PRESSING || if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_PRESSING ||
sign == LV_SIGNAL_LONG_PRESS || sign == LV_SIGNAL_LONG_PRESS_REP) { sign == LV_SIGNAL_LONG_PRESS || sign == LV_SIGNAL_LONG_PRESS_REP) {
#if LV_USE_GROUP
/*If pressed/released etc by a KEYPAD or ENCODER delegate signal to the button*/ /*If pressed/released etc by a KEYPAD or ENCODER delegate signal to the button*/
lv_indev_t * indev = lv_indev_get_act(); lv_indev_t * indev = lv_indev_get_act();
lv_indev_type_t indev_type = lv_indev_get_type(indev); lv_indev_type_t indev_type = lv_indev_get_type(indev);
@ -710,7 +711,9 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
} else if(sign == LV_SIGNAL_LONG_PRESS_REP) { } else if(sign == LV_SIGNAL_LONG_PRESS_REP) {
res = lv_event_send(btn, LV_EVENT_LONG_PRESSED_REPEAT, NULL); res = lv_event_send(btn, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
} else if(sign == LV_SIGNAL_RELEASED) { } else if(sign == LV_SIGNAL_RELEASED) {
#if LV_USE_GROUP
ext->last_sel = btn; ext->last_sel = btn;
#endif
if(indev->proc.long_pr_sent == 0) { if(indev->proc.long_pr_sent == 0) {
res = lv_event_send(btn, LV_EVENT_SHORT_CLICKED, NULL); res = lv_event_send(btn, LV_EVENT_SHORT_CLICKED, NULL);
} }
@ -723,6 +726,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
} }
} }
} }
#endif
} else if(sign == LV_SIGNAL_FOCUS) { } else if(sign == LV_SIGNAL_FOCUS) {
#if LV_USE_GROUP #if LV_USE_GROUP

View File

@ -52,7 +52,7 @@ typedef struct
{ {
lv_page_ext_t page; /*Ext. of ancestor*/ lv_page_ext_t page; /*Ext. of ancestor*/
/*New data for this type */ /*New data for this type */
const lv_style_t * styles_btn[LV_BTN_STATE_NUM]; /*Styles of the list element buttons*/ const lv_style_t * styles_btn[_LV_BTN_STATE_NUM]; /*Styles of the list element buttons*/
const lv_style_t * style_img; /*Style of the list element images on buttons*/ const lv_style_t * style_img; /*Style of the list element images on buttons*/
uint16_t size; /*the number of items(buttons) in the list*/ uint16_t size; /*the number of items(buttons) in the list*/

View File

@ -96,7 +96,7 @@ void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt);
*/ */
static inline void lv_lmeter_set_style(lv_obj_t * lmeter, lv_lmeter_style_t type, lv_style_t * style) static inline void lv_lmeter_set_style(lv_obj_t * lmeter, lv_lmeter_style_t type, lv_style_t * style)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
lv_obj_set_style(lmeter, style); lv_obj_set_style(lmeter, style);
} }
@ -147,7 +147,7 @@ uint16_t lv_lmeter_get_scale_angle(const lv_obj_t * lmeter);
*/ */
static inline const lv_style_t * lv_lmeter_get_style(const lv_obj_t * lmeter, lv_lmeter_style_t type) static inline const lv_style_t * lv_lmeter_get_style(const lv_obj_t * lmeter, lv_lmeter_style_t type)
{ {
(void) type; /*Unused*/ (void)type; /*Unused*/
return lv_obj_get_style(lmeter); return lv_obj_get_style(lmeter);
} }

View File

@ -223,7 +223,6 @@ void lv_page_set_anim_time(lv_obj_t * page, uint16_t anim_time)
(void)page; /*Unused*/ (void)page; /*Unused*/
(void)anim_time; /*Unused*/ (void)anim_time; /*Unused*/
#endif #endif
} }
/** /**
@ -308,7 +307,7 @@ uint16_t lv_page_get_anim_time(const lv_obj_t * page)
lv_page_ext_t * ext = lv_obj_get_ext_attr(page); lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
return ext->anim_time; return ext->anim_time;
#else #else
(void) page; /*Unused*/ (void)page; /*Unused*/
return 0; return 0;
#endif #endif
} }
@ -423,14 +422,10 @@ bool lv_page_on_edge(lv_obj_t * page, lv_page_edge_t edge)
lv_obj_get_coords(scrl, &scrl_coords); lv_obj_get_coords(scrl, &scrl_coords);
lv_obj_get_coords(page, &page_coords); lv_obj_get_coords(page, &page_coords);
if((edge & LV_PAGE_EDGE_TOP) && scrl_coords.y1 == page_coords.y1 + page_style->body.padding.top) if((edge & LV_PAGE_EDGE_TOP) && scrl_coords.y1 == page_coords.y1 + page_style->body.padding.top) return true;
return true; if((edge & LV_PAGE_EDGE_BOTTOM) && scrl_coords.y2 == page_coords.y2 - page_style->body.padding.bottom) return true;
if((edge & LV_PAGE_EDGE_BOTTOM) && scrl_coords.y2 == page_coords.y2 - page_style->body.padding.bottom) if((edge & LV_PAGE_EDGE_LEFT) && scrl_coords.x1 == page_coords.x1 + page_style->body.padding.left) return true;
return true; if((edge & LV_PAGE_EDGE_RIGHT) && scrl_coords.x2 == page_coords.x2 - page_style->body.padding.right) return true;
if((edge & LV_PAGE_EDGE_LEFT) && scrl_coords.x1 == page_coords.x1 + page_style->body.padding.left)
return true;
if((edge & LV_PAGE_EDGE_RIGHT) && scrl_coords.x2 == page_coords.x2 - page_style->body.padding.right)
return true;
return false; return false;
} }
@ -446,7 +441,6 @@ void lv_page_glue_obj(lv_obj_t * obj, bool glue)
lv_obj_set_drag(obj, glue); lv_obj_set_drag(obj, glue);
} }
/** /**
* Focus on an object. It ensures that the object will be visible on the page. * Focus on an object. It ensures that the object will be visible on the page.
* @param page pointer to a page object * @param page pointer to a page object
@ -625,7 +619,7 @@ void lv_page_start_edge_flash(lv_obj_t * page)
lv_anim_create(&a); lv_anim_create(&a);
} }
#else #else
(void) page; /*Unused*/ (void)page; /*Unused*/
#endif #endif
} }
@ -940,7 +934,6 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
if(lv_obj_get_parent(page_parent) != NULL) { /*Do not propagate the scroll to a screen*/ if(lv_obj_get_parent(page_parent) != NULL) { /*Do not propagate the scroll to a screen*/
page_ext->scroll_prop_ip = 1; page_ext->scroll_prop_ip = 1;
} }
} }
} }

View File

@ -50,12 +50,7 @@ enum {
typedef uint8_t lv_sb_mode_t; typedef uint8_t lv_sb_mode_t;
/** Edges: describes the four edges of the page*/ /** Edges: describes the four edges of the page*/
enum { enum { LV_PAGE_EDGE_LEFT = 0x1, LV_PAGE_EDGE_TOP = 0x2, LV_PAGE_EDGE_RIGHT = 0x4, LV_PAGE_EDGE_BOTTOM = 0x8 };
LV_PAGE_EDGE_LEFT = 0x1,
LV_PAGE_EDGE_TOP = 0x2,
LV_PAGE_EDGE_RIGHT = 0x4,
LV_PAGE_EDGE_BOTTOM = 0x8
};
typedef uint8_t lv_page_edge_t; typedef uint8_t lv_page_edge_t;
/*Data of page*/ /*Data of page*/

View File

@ -328,7 +328,8 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
} }
buf->type[i] = "lv_spinbox"; buf->type[i] = "lv_spinbox";
} else if(sign == LV_SIGNAL_RELEASED) { } else if(sign == LV_SIGNAL_RELEASED) {
/*If released with an ENCODER then move to the nexxt digit*/ /*If released with an ENCODER then move to the next digit*/
#if LV_USE_GROUP
lv_indev_t * indev = lv_indev_get_act(); lv_indev_t * indev = lv_indev_get_act();
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_ENCODER) { if(lv_indev_get_type(indev) == LV_INDEV_TYPE_ENCODER) {
if(lv_group_get_editing(lv_obj_get_group(spinbox))) { if(lv_group_get_editing(lv_obj_get_group(spinbox))) {
@ -347,6 +348,7 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
} }
} }
} }
#endif
} else if(sign == LV_SIGNAL_CONTROL) { } else if(sign == LV_SIGNAL_CONTROL) {
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act()); lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());

View File

@ -241,7 +241,7 @@ uint16_t lv_sw_get_anim_time(const lv_obj_t * sw)
lv_sw_ext_t * ext = lv_obj_get_ext_attr(sw); lv_sw_ext_t * ext = lv_obj_get_ext_attr(sw);
return ext->anim_time; return ext->anim_time;
#else #else
(void) sw; /*Unused*/ (void)sw; /*Unused*/
return 0; return 0;
#endif #endif
} }
@ -335,8 +335,7 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
if(lv_sw_get_state(sw)) { if(lv_sw_get_state(sw)) {
lv_sw_off(sw, LV_ANIM_ON); lv_sw_off(sw, LV_ANIM_ON);
state = 0; state = 0;
} } else {
else {
lv_sw_on(sw, LV_ANIM_ON); lv_sw_on(sw, LV_ANIM_ON);
state = 1; state = 1;
} }
@ -351,7 +350,7 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
if(v > LV_SW_MAX_VALUE / 2) { if(v > LV_SW_MAX_VALUE / 2) {
lv_sw_on(sw, LV_ANIM_ON); lv_sw_on(sw, LV_ANIM_ON);
state = 1; state = 1;
} else{ } else {
lv_sw_off(sw, LV_ANIM_ON); lv_sw_off(sw, LV_ANIM_ON);
state = 0; state = 0;
} }

View File

@ -1455,7 +1455,8 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
} else if(sign == LV_SIGNAL_CORD_CHG) { } else if(sign == LV_SIGNAL_CORD_CHG) {
/*Set the label width according to the text area width*/ /*Set the label width according to the text area width*/
if(ext->label) { if(ext->label) {
if(lv_obj_get_width(scrl) != lv_area_get_width(param) || lv_obj_get_height(scrl) != lv_area_get_height(param)) { if(lv_obj_get_width(scrl) != lv_area_get_width(param) ||
lv_obj_get_height(scrl) != lv_area_get_height(param)) {
const lv_style_t * style_scrl = lv_obj_get_style(scrl); const lv_style_t * style_scrl = lv_obj_get_style(scrl);
lv_obj_set_width(ext->label, lv_page_get_fit_width(ta)); lv_obj_set_width(ext->label, lv_page_get_fit_width(ta));
@ -1612,7 +1613,6 @@ static void refr_cursor_area(lv_obj_t * ta)
{ {
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
const lv_style_t * label_style = lv_obj_get_style(ext->label); const lv_style_t * label_style = lv_obj_get_style(ext->label);
lv_style_t cur_style; lv_style_t cur_style;
@ -1746,7 +1746,6 @@ static void update_cursor_position_on_click(lv_obj_t * ta, lv_signal_t sign, lv_
return; return;
} }
lv_area_t label_coords; lv_area_t label_coords;
lv_obj_get_coords(ext->label, &label_coords); lv_obj_get_coords(ext->label, &label_coords);

View File

@ -77,7 +77,7 @@ typedef struct
uint16_t txt_byte_pos; /* Byte index of the letter after (on) the cursor*/ uint16_t txt_byte_pos; /* Byte index of the letter after (on) the cursor*/
lv_cursor_type_t type : 4; /* Shape of the cursor*/ lv_cursor_type_t type : 4; /* Shape of the cursor*/
uint8_t state : 1; /*Cursor is visible now or not (Handled by the library)*/ uint8_t state : 1; /*Cursor is visible now or not (Handled by the library)*/
uint8_t click_pos :1; /*1: Enable positioning the cursor by clicking the text area*/ uint8_t click_pos : 1; /*1: Enable positioning the cursor by clicking the text area*/
} cursor; } cursor;
#if LV_LABEL_TEXT_SEL #if LV_LABEL_TEXT_SEL
uint16_t tmp_sel_start; /*Temporary value*/ uint16_t tmp_sel_start; /*Temporary value*/

View File

@ -691,6 +691,7 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
tabview_realign(tabview); tabview_realign(tabview);
} }
} else if(sign == LV_SIGNAL_RELEASED) { } else if(sign == LV_SIGNAL_RELEASED) {
#if LV_USE_GROUP
/*If released by a KEYPAD or ENCODER then really the tab buttons should be released. /*If released by a KEYPAD or ENCODER then really the tab buttons should be released.
* So simulate a CLICK on the tab buttons*/ * So simulate a CLICK on the tab buttons*/
lv_indev_t * indev = lv_indev_get_act(); lv_indev_t * indev = lv_indev_get_act();
@ -699,6 +700,7 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
(indev_type == LV_INDEV_TYPE_ENCODER && lv_group_get_editing(lv_obj_get_group(tabview)))) { (indev_type == LV_INDEV_TYPE_ENCODER && lv_group_get_editing(lv_obj_get_group(tabview)))) {
lv_event_send(ext->btns, LV_EVENT_CLICKED, lv_event_get_data()); lv_event_send(ext->btns, LV_EVENT_CLICKED, lv_event_get_data());
} }
#endif
} else if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_CONTROL) { } else if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_CONTROL) {
/* The button matrix is not in a group (the tab view is in it) but it should handle the /* The button matrix is not in a group (the tab view is in it) but it should handle the
* group signals. So propagate the related signals to the button matrix manually*/ * group signals. So propagate the related signals to the button matrix manually*/
@ -956,7 +958,6 @@ static void tab_btnm_event_cb(lv_obj_t * tab_btnm, lv_event_t event)
if(id_prev != id_new) res = lv_event_send(tabview, LV_EVENT_VALUE_CHANGED, &id_new); if(id_prev != id_new) res = lv_event_send(tabview, LV_EVENT_VALUE_CHANGED, &id_new);
if(res != LV_RES_OK) return; if(res != LV_RES_OK) return;
} }
/** /**

View File

@ -83,7 +83,6 @@ void lv_tileview_add_element(lv_obj_t * tileview, lv_obj_t * element);
* Setter functions * Setter functions
*====================*/ *====================*/
/** /**
* Set the valid position's indices. The scrolling will be possible only to these positions. * Set the valid position's indices. The scrolling will be possible only to these positions.
* @param tileview pointer to a Tileview object * @param tileview pointer to a Tileview object

View File

@ -94,7 +94,6 @@ lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy)
ext->title = lv_label_create(ext->header, NULL); ext->title = lv_label_create(ext->header, NULL);
lv_label_set_text(ext->title, "My title"); lv_label_set_text(ext->title, "My title");
/*Set the default styles*/ /*Set the default styles*/
lv_theme_t * th = lv_theme_get_current(); lv_theme_t * th = lv_theme_get_current();
if(th) { if(th) {

View File

@ -229,7 +229,6 @@ uint16_t lv_win_get_anim_time(const lv_obj_t * win);
*/ */
lv_coord_t lv_win_get_width(lv_obj_t * win); lv_coord_t lv_win_get_width(lv_obj_t * win);
/** /**
* Get a style of a window * Get a style of a window
* @param win pointer to a button object * @param win pointer to a button object

View File

@ -40,6 +40,7 @@ typedef struct
{ {
struct struct
{ {
lv_style_t * scr;
lv_style_t * bg; lv_style_t * bg;
lv_style_t * panel; lv_style_t * panel;

View File

@ -32,6 +32,7 @@ static lv_font_t * _font;
static lv_theme_t theme; static lv_theme_t theme;
static lv_style_t def; static lv_style_t def;
static lv_style_t bg; static lv_style_t bg;
static lv_style_t scr;
static lv_style_t panel; /*General fancy background (e.g. to chart or ta)*/ static lv_style_t panel; /*General fancy background (e.g. to chart or ta)*/
static lv_style_t sb; static lv_style_t sb;
static lv_style_t btn_rel, btn_pr, btn_trel, btn_tpr, btn_ina; static lv_style_t btn_rel, btn_pr, btn_trel, btn_tpr, btn_ina;
@ -105,6 +106,12 @@ static void basic_init(void)
bg.body.border.color = lv_color_hex3(0x666); bg.body.border.color = lv_color_hex3(0x666);
bg.body.shadow.color = LV_COLOR_SILVER; bg.body.shadow.color = LV_COLOR_SILVER;
lv_style_copy(&scr, &bg);
scr.body.padding.bottom = 0;
scr.body.padding.top = 0;
scr.body.padding.left = 0;
scr.body.padding.right = 0;
/*Panel*/ /*Panel*/
lv_style_copy(&panel, &def); lv_style_copy(&panel, &def);
panel.body.radius = LV_DPI / 10; panel.body.radius = LV_DPI / 10;
@ -133,6 +140,7 @@ static void basic_init(void)
sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/ sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/
theme.style.bg = &bg; theme.style.bg = &bg;
theme.style.scr = &scr;
theme.style.panel = &panel; theme.style.panel = &panel;
} }

View File

@ -27,6 +27,7 @@
**********************/ **********************/
static lv_theme_t theme; static lv_theme_t theme;
static lv_style_t def; static lv_style_t def;
static lv_style_t scr;
/*Static style definitions*/ /*Static style definitions*/
static lv_style_t sb; static lv_style_t sb;
@ -54,6 +55,12 @@ static void basic_init(void)
{ {
lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/ lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/
lv_style_copy(&scr, &def);
scr.body.padding.bottom = 0;
scr.body.padding.top = 0;
scr.body.padding.left = 0;
scr.body.padding.right = 0;
lv_style_copy(&sb, &lv_style_pretty_color); lv_style_copy(&sb, &lv_style_pretty_color);
sb.body.grad_color = sb.body.main_color; sb.body.grad_color = sb.body.main_color;
sb.body.padding.right = sb.body.padding.right / 2; /*Make closer to the edges*/ sb.body.padding.right = sb.body.padding.right / 2; /*Make closer to the edges*/
@ -64,6 +71,7 @@ static void basic_init(void)
plain_bordered.body.border.color = lv_color_hex3(0xbbb); plain_bordered.body.border.color = lv_color_hex3(0xbbb);
theme.style.bg = &lv_style_plain; theme.style.bg = &lv_style_plain;
theme.style.scr = &scr;
theme.style.panel = &lv_style_pretty; theme.style.panel = &lv_style_pretty;
} }

View File

@ -47,7 +47,7 @@ static lv_font_t * _font;
static void basic_init(void) static void basic_init(void)
{ {
static lv_style_t bg, panel; static lv_style_t bg, panel, scr;
lv_style_copy(&def, &lv_style_plain); /*Initialize the default style*/ lv_style_copy(&def, &lv_style_plain); /*Initialize the default style*/
def.text.font = _font; def.text.font = _font;
@ -58,6 +58,12 @@ static void basic_init(void)
bg.body.grad_color = bg.body.main_color; bg.body.grad_color = bg.body.main_color;
bg.body.radius = 0; bg.body.radius = 0;
lv_style_copy(&scr, &bg);
scr.body.padding.bottom = 0;
scr.body.padding.top = 0;
scr.body.padding.left = 0;
scr.body.padding.right = 0;
lv_style_copy(&panel, &def); lv_style_copy(&panel, &def);
panel.body.radius = DEF_RADIUS; panel.body.radius = DEF_RADIUS;
panel.body.main_color = LV_COLOR_WHITE; panel.body.main_color = LV_COLOR_WHITE;
@ -84,6 +90,7 @@ static void basic_init(void)
sb.body.padding.bottom = LV_DPI / 25; sb.body.padding.bottom = LV_DPI / 25;
theme.style.bg = &bg; theme.style.bg = &bg;
theme.style.scr = &scr;
theme.style.panel = &panel; theme.style.panel = &panel;
} }

View File

@ -27,6 +27,7 @@
**********************/ **********************/
static lv_theme_t theme; static lv_theme_t theme;
static lv_style_t def; static lv_style_t def;
static lv_style_t scr;
/*Static style definitions*/ /*Static style definitions*/
static lv_style_t light_plain; static lv_style_t light_plain;
@ -75,6 +76,12 @@ static void basic_init(void)
def.image.intense = LV_OPA_TRANSP; def.image.intense = LV_OPA_TRANSP;
def.image.opa = LV_OPA_COVER; def.image.opa = LV_OPA_COVER;
lv_style_copy(&scr, &light_plain);
scr.body.padding.bottom = 0;
scr.body.padding.top = 0;
scr.body.padding.left = 0;
scr.body.padding.right = 0;
lv_style_copy(&light_plain, &def); lv_style_copy(&light_plain, &def);
lv_style_copy(&light_frame, &light_plain); lv_style_copy(&light_frame, &light_plain);
@ -92,6 +99,7 @@ static void basic_init(void)
dark_frame.body.radius = LV_DPI / 20; dark_frame.body.radius = LV_DPI / 20;
theme.style.bg = &def; theme.style.bg = &def;
theme.style.scr = &scr;
theme.style.panel = &light_frame; theme.style.panel = &light_frame;
} }

View File

@ -34,6 +34,7 @@ static lv_font_t * _font;
static lv_theme_t theme; static lv_theme_t theme;
static lv_style_t def; static lv_style_t def;
static lv_style_t bg; static lv_style_t bg;
static lv_style_t scr;
static lv_style_t panel; /*General fancy background (e.g. to chart or ta)*/ static lv_style_t panel; /*General fancy background (e.g. to chart or ta)*/
static lv_style_t sb; static lv_style_t sb;
static lv_style_t btn_rel, btn_pr, btn_trel, btn_tpr, btn_ina; static lv_style_t btn_rel, btn_pr, btn_trel, btn_tpr, btn_ina;
@ -107,6 +108,12 @@ static void basic_init(void)
bg.body.border.color = lv_color_hex3(0x666); bg.body.border.color = lv_color_hex3(0x666);
bg.body.shadow.color = LV_COLOR_SILVER; bg.body.shadow.color = LV_COLOR_SILVER;
lv_style_copy(&scr, &bg);
scr.body.padding.bottom = 0;
scr.body.padding.top = 0;
scr.body.padding.left = 0;
scr.body.padding.right = 0;
/*Panel*/ /*Panel*/
lv_style_copy(&panel, &def); lv_style_copy(&panel, &def);
panel.body.radius = LV_DPI / 10; panel.body.radius = LV_DPI / 10;
@ -134,6 +141,7 @@ static void basic_init(void)
sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/ sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/
theme.style.bg = &bg; theme.style.bg = &bg;
theme.style.scr = &scr;
theme.style.panel = &panel; theme.style.panel = &panel;
} }

View File

@ -29,7 +29,7 @@ static lv_theme_t theme;
static lv_style_t def; static lv_style_t def;
/*Static style definitions*/ /*Static style definitions*/
static lv_style_t bg, sb, panel; static lv_style_t scr, bg, sb, panel;
static lv_style_t prim, sec, hint; static lv_style_t prim, sec, hint;
static lv_style_t btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina; static lv_style_t btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina;
static lv_style_t bar_bg, bar_indic; static lv_style_t bar_bg, bar_indic;
@ -61,6 +61,12 @@ static void basic_init(void)
bg.text.font = _font; bg.text.font = _font;
bg.image.color = lv_color_hsv_to_rgb(_hue, 5, 95); bg.image.color = lv_color_hsv_to_rgb(_hue, 5, 95);
lv_style_copy(&scr, &bg);
scr.body.padding.bottom = 0;
scr.body.padding.top = 0;
scr.body.padding.left = 0;
scr.body.padding.right = 0;
lv_style_copy(&sb, &def); lv_style_copy(&sb, &def);
sb.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 60); sb.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 60);
sb.body.grad_color = lv_color_hsv_to_rgb(_hue, 30, 60); sb.body.grad_color = lv_color_hsv_to_rgb(_hue, 30, 60);
@ -86,6 +92,8 @@ static void basic_init(void)
panel.body.padding.bottom = LV_DPI / 10; panel.body.padding.bottom = LV_DPI / 10;
panel.line.color = lv_color_hsv_to_rgb(_hue, 20, 40); panel.line.color = lv_color_hsv_to_rgb(_hue, 20, 40);
panel.line.width = 1; panel.line.width = 1;
theme.style.scr = &scr;
theme.style.bg = &bg; theme.style.bg = &bg;
theme.style.panel = &def; theme.style.panel = &def;
} }

View File

@ -46,6 +46,7 @@ static void basic_init(void)
lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/ lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/
def.text.font = _font; def.text.font = _font;
theme.style.scr = &def;
theme.style.bg = &def; theme.style.bg = &def;
theme.style.panel = &def; theme.style.panel = &def;
} }

View File

@ -45,6 +45,7 @@ static lv_font_t * _font;
static void basic_init(void) static void basic_init(void)
{ {
static lv_style_t bg; static lv_style_t bg;
static lv_style_t scr;
static lv_style_t panel; static lv_style_t panel;
lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/ lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/
@ -60,6 +61,12 @@ static void basic_init(void)
bg.body.border.width = 0; bg.body.border.width = 0;
bg.body.shadow.width = 0; bg.body.shadow.width = 0;
lv_style_copy(&scr, &bg);
scr.body.padding.bottom = 0;
scr.body.padding.top = 0;
scr.body.padding.left = 0;
scr.body.padding.right = 0;
lv_style_copy(&panel, &bg); lv_style_copy(&panel, &bg);
panel.body.radius = LV_DPI / 10; panel.body.radius = LV_DPI / 10;
panel.body.border.width = 2; panel.body.border.width = 2;
@ -80,6 +87,7 @@ static void basic_init(void)
sb.body.radius = LV_RADIUS_CIRCLE; sb.body.radius = LV_RADIUS_CIRCLE;
sb.body.padding.inner = LV_DPI / 10; sb.body.padding.inner = LV_DPI / 10;
theme.style.scr = &scr;
theme.style.bg = &bg; theme.style.bg = &bg;
theme.style.panel = &panel; theme.style.panel = &panel;
} }