mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
Merge branch 'dev-6.0' of github.com:littlevgl/lvgl into dev-6.0
This commit is contained in:
commit
2ecd0c4166
@ -193,12 +193,6 @@ typedef void * lv_img_decoder_user_data_t;
|
||||
* font's bitmaps */
|
||||
#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
|
||||
*==================*/
|
||||
|
@ -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
|
||||
|
||||
fin = open("../lv_conf_template.h", "r");
|
||||
fout = open("../src/lv_conf_checker.h", "w");
|
||||
fin = open("../lv_conf_template.h", "r")
|
||||
fout = open("../src/lv_conf_checker.h", "w")
|
||||
|
||||
|
||||
fout.write(
|
||||
'/**\n\
|
||||
* GENERATED FILE, DO NOT EDIT IT!\n\
|
||||
* @file lv_conf_checker.h\n\
|
||||
* Make sure all the defines of lv_conf.h have a default value\n\
|
||||
**/\n\
|
||||
\n\
|
||||
#ifndef LV_CONF_CHECKER_H\n\
|
||||
#define LV_CONF_CHECKER_H\n\
|
||||
'
|
||||
)
|
||||
'''/**
|
||||
* GENERATED FILE, DO NOT EDIT IT!
|
||||
* @file lv_conf_checker.h
|
||||
* Make sure all the defines of lv_conf.h have a default value
|
||||
**/
|
||||
|
||||
inlines = fin.read().splitlines();
|
||||
#ifndef LV_CONF_CHECKER_H
|
||||
#define LV_CONF_CHECKER_H
|
||||
'''
|
||||
)
|
||||
|
||||
started = 0
|
||||
|
||||
for i in inlines:
|
||||
if(not started):
|
||||
if('#define LV_CONF_H' in i):
|
||||
for i in fin.read().splitlines():
|
||||
if not started:
|
||||
if '#define LV_CONF_H' in i:
|
||||
started = 1
|
||||
continue
|
||||
else:
|
||||
continue
|
||||
|
||||
if('/*--END OF LV_CONF_H--*/' in i): break
|
||||
if '/*--END OF LV_CONF_H--*/' in i: break
|
||||
|
||||
if(re.search('^ *# *define .*$', i)):
|
||||
new = re.sub('^ *# *define', '#define ', i)
|
||||
new = re.sub(' +', ' ', new) #Remove extra white spaces
|
||||
splitted = new.split(' ')
|
||||
fout.write('#ifndef ' + splitted[1] + '\n')
|
||||
fout.write(i + '\n')
|
||||
fout.write('#endif\n')
|
||||
elif(re.search('^ *typedef .*;.*$', i)):
|
||||
continue; #igonre typedefs to avoide redeclaration
|
||||
r = re.search(r'^ *# *define ([^\s]+).*$', i)
|
||||
if r:
|
||||
fout.write(
|
||||
f'#ifndef {r[1]}\n'
|
||||
f'{i}\n'
|
||||
'#endif\n'
|
||||
)
|
||||
elif re.search('^ *typedef .*;.*$', i):
|
||||
continue #ignore typedefs to avoide redeclaration
|
||||
else:
|
||||
fout.write(i + '\n')
|
||||
fout.write(f'{i}\n')
|
||||
|
||||
|
||||
fout.write(
|
||||
'\n\
|
||||
#endif /*LV_CONF_CHECKER_H*/\n\
|
||||
')
|
||||
'''
|
||||
#endif /*LV_CONF_CHECKER_H*/
|
||||
'''
|
||||
)
|
||||
|
||||
fin.close()
|
||||
fout.close()
|
||||
|
@ -261,16 +261,6 @@
|
||||
#define LV_ATTRIBUTE_LARGE_CONST
|
||||
#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
|
||||
*==================*/
|
||||
@ -357,6 +347,9 @@
|
||||
* More info about fonts: https://docs.littlevgl.com/#Fonts
|
||||
* 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
|
||||
#define LV_FONT_ROBOTO_12 0
|
||||
#endif
|
||||
@ -370,6 +363,12 @@
|
||||
#define LV_FONT_ROBOTO_28 0
|
||||
#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.
|
||||
* You can use these fonts as default font too
|
||||
* and they will be available globally. E.g.
|
||||
|
@ -565,7 +565,7 @@ static void style_mod_def(lv_group_t * group, lv_style_t * style)
|
||||
|
||||
/*Add some recolor to the images*/
|
||||
if(style->image.intense < LV_OPA_MIN) {
|
||||
style->image.color = LV_COLOR_ORANGE;
|
||||
style->image.color = LV_COLOR_ORANGE;
|
||||
style->image.intense = LV_OPA_40;
|
||||
}
|
||||
#else
|
||||
@ -601,7 +601,7 @@ static void style_mod_edit_def(lv_group_t * group, lv_style_t * style)
|
||||
|
||||
/*Add some recolor to the images*/
|
||||
if(style->image.intense < LV_OPA_MIN) {
|
||||
style->image.color = LV_COLOR_GREEN;
|
||||
style->image.color = LV_COLOR_GREEN;
|
||||
style->image.intense = LV_OPA_40;
|
||||
}
|
||||
|
||||
|
@ -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(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
|
||||
* 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 */
|
||||
|
@ -174,7 +174,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
/*Set the default styles*/
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
new_obj->style_p = th->style.bg;
|
||||
new_obj->style_p = th->style.scr;
|
||||
} else {
|
||||
new_obj->style_p = &lv_style_scr;
|
||||
}
|
||||
@ -1348,7 +1348,7 @@ lv_res_t lv_event_send_func(lv_event_cb_t event_xcb, lv_obj_t * obj, lv_event_t
|
||||
event_temp_data_head = &event_temp_data;
|
||||
|
||||
const void * event_act_data_save = event_act_data;
|
||||
event_act_data = data;
|
||||
event_act_data = data;
|
||||
|
||||
/*Call the input device's feedback callback if set*/
|
||||
lv_indev_t * indev_act = lv_indev_get_act();
|
||||
@ -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)
|
||||
* @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);
|
||||
if(style->body.border.part & LV_BORDER_LEFT)
|
||||
coords_p->x1 += style->body.border.width;
|
||||
const lv_style_t * style = lv_obj_get_style(obj);
|
||||
if(style->body.border.part & LV_BORDER_LEFT) coords_p->x1 += style->body.border.width;
|
||||
|
||||
if(style->body.border.part & LV_BORDER_RIGHT)
|
||||
coords_p->x2 -= style->body.border.width;
|
||||
if(style->body.border.part & LV_BORDER_RIGHT) coords_p->x2 -= style->body.border.width;
|
||||
|
||||
if(style->body.border.part & LV_BORDER_TOP)
|
||||
coords_p->y1 += style->body.border.width;
|
||||
if(style->body.border.part & LV_BORDER_TOP) coords_p->y1 += style->body.border.width;
|
||||
|
||||
if(style->body.border.part & LV_BORDER_BOTTOM)
|
||||
coords_p->y2 -= style->body.border.width;
|
||||
if(style->body.border.part & LV_BORDER_BOTTOM) coords_p->y2 -= style->body.border.width;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the x coordinate of object
|
||||
* @param obj pointer to an object
|
||||
|
@ -257,7 +257,6 @@ typedef struct
|
||||
... [x]: "lv_obj" */
|
||||
} lv_obj_type_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* 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)
|
||||
* @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
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "../lv_misc/lv_task.h"
|
||||
#include "../lv_misc/lv_mem.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)
|
||||
#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");
|
||||
}
|
||||
|
||||
@ -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
|
||||
* one*/
|
||||
if(lv_disp_is_double_buf(disp_refr)) {
|
||||
while(vdb->flushing);
|
||||
while(vdb->flushing)
|
||||
;
|
||||
}
|
||||
|
||||
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(vdb->buf1 && vdb->buf2) {
|
||||
if(vdb->buf_act == vdb->buf1) vdb->buf_act = vdb->buf2;
|
||||
else vdb->buf_act = vdb->buf1;
|
||||
if(vdb->buf_act == vdb->buf1)
|
||||
vdb->buf_act = vdb->buf2;
|
||||
else
|
||||
vdb->buf_act = vdb->buf1;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,9 @@
|
||||
#include <stdbool.h>
|
||||
#include "lv_draw.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
|
||||
@ -27,6 +30,8 @@
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static void * draw_buf = NULL;
|
||||
static uint32_t draw_buf_size = 0;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@ -36,9 +41,41 @@
|
||||
* 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
|
||||
|
||||
@ -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
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
@ -35,6 +35,18 @@ extern "C" {
|
||||
* 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
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
y -= vdb->area.y1;
|
||||
|
||||
|
||||
if(disp->driver.set_px_cb) {
|
||||
disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, x, y, color, opa);
|
||||
} else {
|
||||
bool scr_transp = false;
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
scr_transp = disp->driver.screen_transp;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
lv_color_t * vdb_px_p = vdb->buf_act;
|
||||
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 map_useful_w = lv_area_get_width(&masked_a);
|
||||
|
||||
|
||||
bool scr_transp = false;
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
scr_transp = disp->driver.screen_transp;
|
||||
#endif
|
||||
|
||||
|
||||
/*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) {
|
||||
|
||||
@ -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*/
|
||||
else {
|
||||
|
||||
|
||||
if(opa_result == LV_OPA_COVER)
|
||||
vdb_buf_tmp[col] = px_color;
|
||||
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);
|
||||
} else {
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
vdb_buf_tmp[col] =
|
||||
color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].ch.alpha, px_color, opa_result);
|
||||
vdb_buf_tmp[col] = color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].ch.alpha,
|
||||
px_color, opa_result);
|
||||
#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*/
|
||||
else {
|
||||
bool scr_transp = false;
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
scr_transp = disp->driver.screen_transp;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
lv_color_t bg_tmp = LV_COLOR_BLACK;
|
||||
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.
|
||||
* @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
|
||||
/* 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;
|
||||
return fg_color;
|
||||
}
|
||||
@ -690,8 +685,8 @@ static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa,
|
||||
|
||||
if(fg_opa != fg_opa_save || bg_opa != bg_opa_save || fg_color.full != fg_color_save.full ||
|
||||
bg_color.full != bg_color_save.full) {
|
||||
fg_opa_save = fg_opa;
|
||||
bg_opa_save = bg_opa;
|
||||
fg_opa_save = fg_opa;
|
||||
bg_opa_save = bg_opa;
|
||||
fg_color_save.full = fg_color.full;
|
||||
bg_color_save.full = bg_color.full;
|
||||
/*Info:
|
||||
@ -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*/
|
||||
}
|
||||
|
||||
|
@ -309,16 +309,14 @@ 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)
|
||||
{
|
||||
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_4BIT && id > 15) ||
|
||||
(dsc->header.cf == LV_IMG_CF_ALPHA_8BIT)) {
|
||||
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_4BIT && id > 15) || (dsc->header.cf == LV_IMG_CF_ALPHA_8BIT)) {
|
||||
LV_LOG_WARN("lv_img_buf_set_px_alpha: invalid 'id'");
|
||||
return;
|
||||
}
|
||||
|
||||
lv_color32_t c32;
|
||||
c32.full = lv_color_to32(c);
|
||||
c32.full = lv_color_to32(c);
|
||||
uint8_t * buf = (uint8_t *)dsc->data;
|
||||
memcpy(&buf[id * sizeof(c32)], &c32, sizeof(c32));
|
||||
}
|
||||
@ -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 =
|
||||
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);
|
||||
|
||||
if(cdsc == NULL) return LV_RES_INV;
|
||||
|
||||
|
||||
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);
|
||||
|
||||
if(cdsc->dec_dsc.error_msg != NULL) {
|
||||
LV_LOG_WARN("Image draw error");
|
||||
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.
|
||||
* Just draw it!*/
|
||||
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*/
|
||||
else {
|
||||
lv_coord_t width = lv_area_get_width(&mask_com);
|
||||
|
||||
#if LV_COMPILER_VLA_SUPPORTED
|
||||
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
|
||||
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*/
|
||||
|
||||
lv_area_t line;
|
||||
lv_area_copy(&line, &mask_com);
|
||||
lv_area_set_height(&line, 1);
|
||||
|
@ -13,7 +13,7 @@
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LABEL_RECOLOR_PAR_LENGTH 6
|
||||
#define LV_LABEL_HINT_UPDATE_TH 1024 /*Update the "hint" if the label's y coordinates have changed more then this*/
|
||||
#define LV_LABEL_HINT_UPDATE_TH 1024 /*Update the "hint" if the label's y coordinates have changed more then this*/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -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)
|
||||
*/
|
||||
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;
|
||||
lv_coord_t w;
|
||||
@ -86,12 +87,12 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
|
||||
pos.y += y_ofs;
|
||||
}
|
||||
|
||||
uint32_t line_start = 0;
|
||||
uint32_t line_start = 0;
|
||||
int32_t last_line_start = -1;
|
||||
|
||||
/*Check the hint to use the cached info*/
|
||||
if(hint && y_ofs == 0) {
|
||||
/*If the label changed too much recalculate the hint.*/
|
||||
/*If the label changed too much recalculate the hint.*/
|
||||
if(LV_MATH_ABS(hint->coord_y - coords->y1) > LV_LABEL_HINT_UPDATE_TH - 2 * line_height) {
|
||||
hint->line_start = -1;
|
||||
}
|
||||
@ -114,10 +115,10 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
|
||||
pos.y += line_height;
|
||||
|
||||
/*Save at the threshold coordinate*/
|
||||
if(hint && pos.y >= -LV_LABEL_HINT_UPDATE_TH && hint->line_start < 0) {
|
||||
if(hint && pos.y >= -LV_LABEL_HINT_UPDATE_TH && hint->line_start < 0) {
|
||||
hint->line_start = line_start;
|
||||
hint->y = pos.y - coords->y1;
|
||||
hint->coord_y = coords->y1;
|
||||
hint->y = pos.y - coords->y1;
|
||||
hint->coord_y = coords->y1;
|
||||
}
|
||||
|
||||
if(txt[line_start] == '\0') return;
|
||||
|
@ -29,7 +29,7 @@ extern "C" {
|
||||
* This structure stores an earlier (e.g. at -1000 px) coordinate and the index of that line.
|
||||
* Therefore the calculations can start from here.*/
|
||||
typedef struct {
|
||||
/** Index of the line at `y` coordinate*/
|
||||
/** Index of the line at `y` coordinate*/
|
||||
int32_t line_start;
|
||||
|
||||
/** Give the `y` coordinate of the first letter at `line start` index. Relative to the label's coordinates*/
|
||||
@ -57,7 +57,8 @@ typedef struct {
|
||||
* @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,
|
||||
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
|
||||
|
@ -15,9 +15,6 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#if LV_COMPILER_VLA_SUPPORTED == 0
|
||||
#define LINE_MAX_WIDTH 64
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* 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 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];
|
||||
#else
|
||||
lv_point_t pattern[LINE_MAX_WIDTH];
|
||||
#endif
|
||||
|
||||
lv_point_t * pattern = lv_draw_get_buf(width * 2 * sizeof(lv_point_t));
|
||||
lv_coord_t i = 0;
|
||||
|
||||
/*Create a perpendicular pattern (a small line)*/
|
||||
|
@ -1168,16 +1168,23 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
|
||||
|
||||
radius += aa;
|
||||
|
||||
#if LV_COMPILER_VLA_SUPPORTED
|
||||
lv_coord_t curve_x[radius + swidth + 1]; /*Stores the 'x' coordinates of a quarter circle.*/
|
||||
#else
|
||||
#if LV_HOR_RES_MAX > LV_VER_RES_MAX
|
||||
lv_coord_t curve_x[LV_HOR_RES_MAX];
|
||||
#else
|
||||
lv_coord_t curve_x[LV_VER_RES_MAX];
|
||||
#endif
|
||||
#endif
|
||||
memset(curve_x, 0, sizeof(curve_x));
|
||||
/*Allocate a draw buffer the buffer required to draw the shadow*/
|
||||
int16_t filter_width = 2 * swidth + 1;
|
||||
uint32_t curve_x_size = ((radius + swidth + 1) + 3) & ~0x3; /*Round to 4*/
|
||||
curve_x_size *= sizeof(lv_coord_t);
|
||||
uint32_t line_1d_blur_size = (filter_width + 3) & ~0x3; /*Round to 4*/
|
||||
line_1d_blur_size *= sizeof(uint32_t);
|
||||
uint32_t line_2d_blur_size = ((radius + swidth + 1) + 3) & ~0x3; /*Round to 4*/
|
||||
line_2d_blur_size *= sizeof(lv_opa_t);
|
||||
|
||||
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_coord_t circ_tmp;
|
||||
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);
|
||||
}
|
||||
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*/
|
||||
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++) {
|
||||
@ -1206,15 +1202,6 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
|
||||
}
|
||||
|
||||
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_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 += aa * SHADOW_BOTTOM_AA_EXTRA_RADIUS;
|
||||
swidth += aa;
|
||||
#if LV_COMPILER_VLA_SUPPORTED
|
||||
lv_coord_t curve_x[radius + 1]; /*Stores the 'x' coordinates of a quarter circle.*/
|
||||
#else
|
||||
#if LV_HOR_RES_MAX > LV_VER_RES_MAX
|
||||
lv_coord_t curve_x[LV_HOR_RES_MAX];
|
||||
#else
|
||||
lv_coord_t curve_x[LV_VER_RES_MAX];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint32_t curve_x_size = ((radius + 1) + 3) & ~0x3; /*Round to 4*/
|
||||
curve_x_size *= sizeof(lv_coord_t);
|
||||
lv_opa_t line_1d_blur_size = (swidth + 3) & ~0x3; /*Round to 4*/
|
||||
line_1d_blur_size *= sizeof(lv_opa_t);
|
||||
|
||||
uint8_t * draw_buf = lv_draw_get_buf(curve_x_size + line_1d_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.*/
|
||||
lv_opa_t * line_1d_blur = (lv_opa_t *)&draw_buf[curve_x_size];
|
||||
|
||||
lv_point_t circ;
|
||||
lv_coord_t circ_tmp;
|
||||
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;
|
||||
#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;
|
||||
for(col = 0; col < swidth; col++) {
|
||||
|
@ -17,10 +17,10 @@
|
||||
* DEFINES
|
||||
*********************/
|
||||
/*Decrement life with this value in every open*/
|
||||
#define LV_IMG_CACHE_AGING 1
|
||||
#define LV_IMG_CACHE_AGING 1
|
||||
|
||||
/*Boost life by this factor (multiply time_to_open with this value)*/
|
||||
#define LV_IMG_CACHE_LIFE_GAIN 1
|
||||
#define LV_IMG_CACHE_LIFE_GAIN 1
|
||||
|
||||
/*Don't let life to be greater than this limit because it would require a lot of time to
|
||||
* "die" from very high values */
|
||||
@ -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.
|
||||
* Therefore increase `life` with `time_to_open`*/
|
||||
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;
|
||||
LV_LOG_TRACE("image draw: image found in the cache");
|
||||
break;
|
||||
@ -111,15 +111,15 @@ lv_img_cache_entry_t * lv_img_cache_open(const void * src, const lv_style_t * st
|
||||
|
||||
/*Open the image and measure the time to open*/
|
||||
uint32_t t_start;
|
||||
t_start = lv_tick_get();
|
||||
t_start = lv_tick_get();
|
||||
cached_src->dec_dsc.time_to_open = 0;
|
||||
lv_res_t open_res = lv_img_decoder_open(&cached_src->dec_dsc, src, style);
|
||||
if(open_res ==LV_RES_INV) {
|
||||
lv_res_t open_res = lv_img_decoder_open(&cached_src->dec_dsc, src, style);
|
||||
if(open_res == LV_RES_INV) {
|
||||
LV_LOG_WARN("Image draw cannot open the image resource");
|
||||
lv_img_decoder_close(&cached_src->dec_dsc);
|
||||
memset(&cached_src->dec_dsc, 0, sizeof(lv_img_decoder_dsc_t));
|
||||
memset(&cached_src, 0, sizeof(lv_img_cache_entry_t));
|
||||
cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its use */
|
||||
cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its use */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ typedef struct
|
||||
* Decrement all lifes by one every in every ::lv_img_cache_open.
|
||||
* If life == 0 the entry can be reused */
|
||||
int32_t life;
|
||||
}lv_img_cache_entry_t;
|
||||
} lv_img_cache_entry_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
@ -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->user_data = NULL;
|
||||
|
||||
lv_res_t res;
|
||||
lv_res_t res = LV_RES_INV;
|
||||
|
||||
lv_img_decoder_t * d;
|
||||
LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d)
|
||||
@ -138,8 +138,8 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, const
|
||||
if(res != LV_RES_OK) continue;
|
||||
|
||||
dsc->error_msg = NULL;
|
||||
dsc->img_data = NULL;
|
||||
dsc->decoder = d;
|
||||
dsc->img_data = NULL;
|
||||
dsc->decoder = d;
|
||||
|
||||
res = d->open_cb(d, dsc);
|
||||
|
||||
@ -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
|
||||
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];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const uint8_t * data_tmp = NULL;
|
||||
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
||||
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;
|
||||
|
||||
#if LV_USE_FILESYSTEM
|
||||
#if LV_COMPILER_VLA_SUPPORTED
|
||||
uint8_t fs_buf[w];
|
||||
#else
|
||||
uint8_t fs_buf[LV_HOR_RES_MAX];
|
||||
#endif
|
||||
#endif
|
||||
const uint8_t * data_tmp = NULL;
|
||||
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
||||
|
@ -190,10 +190,8 @@ typedef struct _lv_img_decoder_dsc
|
||||
* Can be set in `open` function or set NULL. */
|
||||
const char * error_msg;
|
||||
|
||||
#if LV_USE_USER_DATA
|
||||
/**Store any custom data here is required*/
|
||||
void * user_data;
|
||||
#endif
|
||||
} 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);
|
||||
|
||||
|
||||
/**
|
||||
* 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`
|
||||
@ -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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
**********************/
|
||||
|
@ -71,7 +71,6 @@ void lv_disp_drv_init(lv_disp_drv_t * driver)
|
||||
driver->screen_transp = 1;
|
||||
#endif
|
||||
|
||||
|
||||
#if LV_USE_GPU
|
||||
driver->gpu_blend_cb = NULL;
|
||||
driver->gpu_fill_cb = NULL;
|
||||
|
@ -72,9 +72,9 @@ void lv_anim_core_init(void)
|
||||
void lv_anim_init(lv_anim_t * a)
|
||||
{
|
||||
memset(a, 0, sizeof(lv_anim_t));
|
||||
a->time = 500;
|
||||
a->start = 0;
|
||||
a->end = 100;
|
||||
a->time = 500;
|
||||
a->start = 0;
|
||||
a->end = 100;
|
||||
a->path_cb = lv_anim_path_linear;
|
||||
}
|
||||
/**
|
||||
|
@ -33,8 +33,8 @@ extern "C" {
|
||||
|
||||
/** Can be used to indicate if animations are enabled or disabled in a case*/
|
||||
enum {
|
||||
LV_ANIM_OFF,
|
||||
LV_ANIM_ON,
|
||||
LV_ANIM_OFF,
|
||||
LV_ANIM_ON,
|
||||
};
|
||||
|
||||
typedef uint8_t lv_anim_enable_t;
|
||||
|
@ -343,7 +343,7 @@ lv_fs_res_t lv_fs_rename(const char * oldname, const char * newname)
|
||||
const char * old_real = lv_fs_get_real_path(oldname);
|
||||
const char * new_real = lv_fs_get_real_path(newname);
|
||||
|
||||
lv_fs_res_t res = drv->rename_cb(drv, old_real, new_real);
|
||||
lv_fs_res_t res = drv->rename_cb(drv, old_real, new_real);
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -380,7 +380,7 @@ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path)
|
||||
|
||||
const char * real_path = lv_fs_get_real_path(path);
|
||||
|
||||
lv_fs_res_t res = rddir_p->drv->dir_open_cb(rddir_p->drv, rddir_p->dir_d, real_path);
|
||||
lv_fs_res_t res = rddir_p->drv->dir_open_cb(rddir_p->drv, rddir_p->dir_d, real_path);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
void * dir_d;
|
||||
lv_fs_drv_t * drv;
|
||||
lv_fs_drv_t * drv;
|
||||
} lv_fs_dir_t;
|
||||
|
||||
/**********************
|
||||
|
@ -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
|
||||
# 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
|
||||
# define LV_LOG_TRACE(dsc) {;}
|
||||
#define LV_LOG_TRACE(dsc) \
|
||||
{ \
|
||||
; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#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
|
||||
# define LV_LOG_INFO(dsc) {;}
|
||||
#define LV_LOG_INFO(dsc) \
|
||||
{ \
|
||||
; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#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
|
||||
# define LV_LOG_WARN(dsc) {;}
|
||||
#define LV_LOG_WARN(dsc) \
|
||||
{ \
|
||||
; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#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
|
||||
# define LV_LOG_ERROR(dsc) {;}
|
||||
#define LV_LOG_ERROR(dsc) \
|
||||
{ \
|
||||
; \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#else /*LV_USE_LOG*/
|
||||
|
||||
/*Do nothing if `LV_USE_LOG 0`*/
|
||||
|
@ -96,7 +96,6 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void);
|
||||
*/
|
||||
lv_task_t * lv_task_create_basic(void);
|
||||
|
||||
|
||||
/**
|
||||
* Create a new lv_task
|
||||
* @param task_xcb a callback which is the task itself. It will be called periodically.
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the next line of text. Check line length and break chars too.
|
||||
* @param txt a '\0' terminated string
|
||||
@ -140,42 +139,44 @@ 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
|
||||
* @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,
|
||||
lv_coord_t letter_space, lv_coord_t max_width, lv_txt_flag_t flag)
|
||||
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_txt_flag_t flag)
|
||||
{
|
||||
if(txt == NULL) return 0;
|
||||
if(font == NULL) return 0;
|
||||
|
||||
if(flag & LV_TXT_FLAG_EXPAND) max_width = LV_COORD_MAX;
|
||||
|
||||
uint32_t i = 0;
|
||||
uint32_t i_next = 0;
|
||||
lv_coord_t cur_w = 0;
|
||||
uint32_t last_break = NO_BREAK_FOUND;
|
||||
uint32_t i = 0;
|
||||
uint32_t i_next = 0;
|
||||
lv_coord_t cur_w = 0;
|
||||
uint32_t last_break = NO_BREAK_FOUND;
|
||||
lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT;
|
||||
uint32_t letter_w;
|
||||
uint32_t letter = 0;
|
||||
uint32_t letter = 0;
|
||||
uint32_t letter_next = 0;
|
||||
|
||||
letter_next = lv_txt_encoded_next(txt, &i_next);
|
||||
|
||||
while(txt[i] != '\0') {
|
||||
letter = letter_next;
|
||||
i = i_next;
|
||||
letter = letter_next;
|
||||
i = i_next;
|
||||
letter_next = lv_txt_encoded_next(txt, &i_next);
|
||||
|
||||
/*Handle the recolor command*/
|
||||
if((flag & LV_TXT_FLAG_RECOLOR) != 0) {
|
||||
if(lv_txt_is_cmd(&cmd_state, letter) != false) {
|
||||
continue; /*Skip the letter is it is part of a command*/
|
||||
continue; /*Skip the letter is it is part of a command*/
|
||||
}
|
||||
}
|
||||
|
||||
/*Check for new line chars*/
|
||||
if(letter == '\n' || letter == '\r') {
|
||||
/*Return with the first letter of the next line*/
|
||||
if(letter == '\r' && letter_next == '\n') return i_next;
|
||||
else return i;
|
||||
if(letter == '\r' && letter_next == '\n')
|
||||
return i_next;
|
||||
else
|
||||
return i;
|
||||
} else { /*Check the actual length*/
|
||||
letter_w = lv_font_get_glyph_width(font, letter, letter_next);
|
||||
cur_w += letter_w;
|
||||
@ -711,7 +712,7 @@ static uint32_t lv_txt_iso8859_1_get_length(const char * txt)
|
||||
* @param letter a letter
|
||||
* @return false: 'letter' is not break char
|
||||
*/
|
||||
static inline bool is_break_char(uint32_t letter)
|
||||
static inline bool is_break_char(uint32_t letter)
|
||||
{
|
||||
uint8_t i;
|
||||
bool ret = false;
|
||||
|
@ -222,10 +222,10 @@ void lv_bar_set_anim_time(lv_obj_t * bar, uint16_t anim_time)
|
||||
{
|
||||
#if LV_USE_ANIMATION
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
|
||||
ext->anim_time = anim_time;
|
||||
ext->anim_time = anim_time;
|
||||
#else
|
||||
(void)bar; /*Unused*/
|
||||
(void)anim_time; /*Unused*/
|
||||
(void)bar; /*Unused*/
|
||||
(void)anim_time; /*Unused*/
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -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);
|
||||
return ext->anim_time;
|
||||
#else
|
||||
(void) bar; /*Unused*/
|
||||
(void)bar; /*Unused*/
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
@ -354,16 +354,16 @@ const lv_style_t * lv_btn_get_style(const lv_obj_t * btn, lv_btn_style_t type)
|
||||
{
|
||||
const lv_style_t * style = NULL;
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||
lv_btn_state_t state = lv_btn_get_state(btn);
|
||||
lv_btn_state_t state = lv_btn_get_state(btn);
|
||||
|
||||
/* If the style of the current state is asked then return object style.
|
||||
* If the button is focused then this style is updated by the group's
|
||||
* `style_mod_cb` function */
|
||||
if((type == LV_BTN_STYLE_REL && state == LV_BTN_STATE_REL) ||
|
||||
(type == LV_BTN_STYLE_PR && state == LV_BTN_STATE_PR) ||
|
||||
(type == LV_BTN_STYLE_TGL_REL && state == LV_BTN_STATE_TGL_REL) ||
|
||||
(type == LV_BTN_STYLE_TGL_PR && state == LV_BTN_STATE_TGL_PR) ||
|
||||
(type == LV_BTN_STYLE_INA && state == LV_BTN_STATE_INA)) {
|
||||
(type == LV_BTN_STYLE_PR && state == LV_BTN_STATE_PR) ||
|
||||
(type == LV_BTN_STYLE_TGL_REL && state == LV_BTN_STATE_TGL_REL) ||
|
||||
(type == LV_BTN_STYLE_TGL_PR && state == LV_BTN_STATE_TGL_PR) ||
|
||||
(type == LV_BTN_STYLE_INA && state == LV_BTN_STATE_INA)) {
|
||||
|
||||
style = lv_obj_get_style(btn);
|
||||
} else {
|
||||
@ -614,7 +614,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
|
||||
|
||||
uint32_t state = 1;
|
||||
res = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &state);
|
||||
res = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &state);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
|
||||
@ -623,7 +623,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
|
||||
uint32_t state = 0;
|
||||
res = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &state);
|
||||
res = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &state);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
}
|
||||
|
@ -40,36 +40,69 @@ extern "C" {
|
||||
/** Possible states of a button.
|
||||
* It can be used not only by buttons but other button-like objects too*/
|
||||
enum {
|
||||
LV_BTN_STATE_REL, /**Released*/
|
||||
LV_BTN_STATE_PR, /**Pressed*/
|
||||
LV_BTN_STATE_TGL_REL, /**Toggled released*/
|
||||
LV_BTN_STATE_TGL_PR, /**Toggled pressed*/
|
||||
LV_BTN_STATE_INA, /**Inactive*/
|
||||
LV_BTN_STATE_NUM,
|
||||
/**Released*/
|
||||
LV_BTN_STATE_REL,
|
||||
|
||||
/**Pressed*/
|
||||
LV_BTN_STATE_PR,
|
||||
|
||||
/**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;
|
||||
|
||||
/*Data of button*/
|
||||
/** Extended data of button*/
|
||||
typedef struct
|
||||
{
|
||||
lv_cont_ext_t cont; /*Ext. of ancestor*/
|
||||
/** Ext. of ancestor*/
|
||||
lv_cont_ext_t cont;
|
||||
|
||||
/*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
|
||||
uint16_t ink_in_time; /*[ms] Time of ink fill effect (0: disable ink effect)*/
|
||||
uint16_t ink_wait_time; /*[ms] Wait before the ink disappears */
|
||||
uint16_t ink_out_time; /*[ms] Time of ink disappearing*/
|
||||
/** [ms] Time of ink fill effect (0: disable ink effect)*/
|
||||
uint16_t ink_in_time;
|
||||
|
||||
/** [ms] Wait before the ink disappears */
|
||||
uint16_t ink_wait_time;
|
||||
|
||||
/** [ms] Time of ink disappearing*/
|
||||
uint16_t ink_out_time;
|
||||
#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;
|
||||
|
||||
/*Styles*/
|
||||
/**Styles*/
|
||||
enum {
|
||||
/** Release style */
|
||||
LV_BTN_STYLE_REL,
|
||||
|
||||
/**Pressed style*/
|
||||
LV_BTN_STYLE_PR,
|
||||
|
||||
/** Toggle released style*/
|
||||
LV_BTN_STYLE_TGL_REL,
|
||||
|
||||
/** Toggle pressed style */
|
||||
LV_BTN_STYLE_TGL_PR,
|
||||
|
||||
/** Inactive style*/
|
||||
LV_BTN_STYLE_INA,
|
||||
};
|
||||
typedef uint8_t lv_btn_style_t;
|
||||
|
@ -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
|
||||
* @param btnm pointer to a button matrix object
|
||||
|
@ -51,12 +51,12 @@ typedef struct
|
||||
{
|
||||
/*No inherited ext.*/ /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
const char ** map_p; /*Pointer to the current map*/
|
||||
lv_area_t * button_areas; /*Array of areas of buttons*/
|
||||
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*/
|
||||
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*/
|
||||
const char ** map_p; /*Pointer to the current map*/
|
||||
lv_area_t * button_areas; /*Array of areas of buttons*/
|
||||
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*/
|
||||
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_act; /*Index of the active button (being pressed/released etc) or LV_BTNM_BTN_NONE */
|
||||
uint8_t recolor : 1; /*Enable button recoloring*/
|
||||
uint8_t one_toggle : 1; /*Single button toggled at once*/
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw a line on the canvas
|
||||
* @param canvas pointer to a canvas object
|
||||
|
@ -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 h height of the buffer to copy
|
||||
*/
|
||||
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 h);
|
||||
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 h);
|
||||
|
||||
/**
|
||||
* 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,
|
||||
const char * txt, lv_label_align_t align);
|
||||
|
||||
|
||||
/**
|
||||
* Draw an image on the canvas
|
||||
* @param canvas pointer to a canvas object
|
||||
@ -245,10 +244,10 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_
|
||||
#define LV_CANVAS_BUF_SIZE_TRUE_COLOR_ALPHA(w, h) (LV_IMG_PX_SIZE_ALPHA_BYTE * w * h)
|
||||
|
||||
/*+ 1: to be sure no fractional row*/
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_1BIT(w, h) ((((w / 8) + 1) * h))
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_2BIT(w, h) ((((w / 4) + 1) * h))
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_4BIT(w, h) ((((w / 2) + 1) * h))
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_8BIT(w, h) ((w * h))
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_1BIT(w, h) ((((w / 8) + 1) * h))
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_2BIT(w, h) ((((w / 4) + 1) * h))
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_4BIT(w, h) ((((w / 2) + 1) * h))
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_8BIT(w, h) ((w * h))
|
||||
|
||||
/*4 * X: for palette*/
|
||||
#define LV_CANVAS_BUF_SIZE_INDEXED_1BIT(w, h) (LV_CANVAS_BUF_SIZE_ALPHA_1BIT(w, h) + 4 * 2)
|
||||
|
@ -84,18 +84,18 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
lv_ll_init(&ext->series_ll, sizeof(lv_chart_series_t));
|
||||
|
||||
ext->series.num = 0;
|
||||
ext->ymin = LV_CHART_YMIN_DEF;
|
||||
ext->ymax = LV_CHART_YMAX_DEF;
|
||||
ext->hdiv_cnt = LV_CHART_HDIV_DEF;
|
||||
ext->vdiv_cnt = LV_CHART_VDIV_DEF;
|
||||
ext->point_cnt = LV_CHART_PNUM_DEF;
|
||||
ext->type = LV_CHART_TYPE_LINE;
|
||||
ext->update_mode = LV_CHART_UPDATE_MODE_SHIFT;
|
||||
ext->series.opa = LV_OPA_COVER;
|
||||
ext->series.dark = LV_OPA_50;
|
||||
ext->series.width = 2;
|
||||
ext->margin = 0;
|
||||
ext->series.num = 0;
|
||||
ext->ymin = LV_CHART_YMIN_DEF;
|
||||
ext->ymax = LV_CHART_YMAX_DEF;
|
||||
ext->hdiv_cnt = LV_CHART_HDIV_DEF;
|
||||
ext->vdiv_cnt = LV_CHART_VDIV_DEF;
|
||||
ext->point_cnt = LV_CHART_PNUM_DEF;
|
||||
ext->type = LV_CHART_TYPE_LINE;
|
||||
ext->update_mode = LV_CHART_UPDATE_MODE_SHIFT;
|
||||
ext->series.opa = LV_OPA_COVER;
|
||||
ext->series.dark = LV_OPA_50;
|
||||
ext->series.width = 2;
|
||||
ext->margin = 0;
|
||||
ext->x_axis.major_tick_len = LV_CHART_TICK_LENGTH_AUTO;
|
||||
ext->x_axis.minor_tick_len = LV_CHART_TICK_LENGTH_AUTO;
|
||||
ext->y_axis.major_tick_len = LV_CHART_TICK_LENGTH_AUTO;
|
||||
@ -124,14 +124,14 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
} else {
|
||||
lv_chart_ext_t * ext_copy = lv_obj_get_ext_attr(copy);
|
||||
|
||||
ext->type = ext_copy->type;
|
||||
ext->ymin = ext_copy->ymin;
|
||||
ext->ymax = ext_copy->ymax;
|
||||
ext->hdiv_cnt = ext_copy->hdiv_cnt;
|
||||
ext->vdiv_cnt = ext_copy->vdiv_cnt;
|
||||
ext->point_cnt = ext_copy->point_cnt;
|
||||
ext->series.opa = ext_copy->series.opa;
|
||||
ext->margin = ext_copy->margin;
|
||||
ext->type = ext_copy->type;
|
||||
ext->ymin = ext_copy->ymin;
|
||||
ext->ymax = ext_copy->ymax;
|
||||
ext->hdiv_cnt = ext_copy->hdiv_cnt;
|
||||
ext->vdiv_cnt = ext_copy->vdiv_cnt;
|
||||
ext->point_cnt = ext_copy->point_cnt;
|
||||
ext->series.opa = ext_copy->series.opa;
|
||||
ext->margin = ext_copy->margin;
|
||||
memcpy(&ext->x_axis, &ext_copy->x_axis, sizeof(lv_chart_axis_cfg_t));
|
||||
memcpy(&ext->y_axis, &ext_copy->y_axis, sizeof(lv_chart_axis_cfg_t));
|
||||
|
||||
@ -460,9 +460,9 @@ void lv_chart_set_x_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_
|
||||
*/
|
||||
void lv_chart_set_y_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_t minor_tick_len)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
ext->y_axis.major_tick_len = major_tick_len;
|
||||
ext->y_axis.minor_tick_len = minor_tick_len;
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
ext->y_axis.major_tick_len = major_tick_len;
|
||||
ext->y_axis.minor_tick_len = minor_tick_len;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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
|
||||
* @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);
|
||||
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
|
||||
* @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);
|
||||
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
|
||||
* @param chart pointer to an chart object
|
||||
* @param margin value of the margin [px]
|
||||
*/
|
||||
* Set the margin around the chart, used for axes value and ticks
|
||||
* @param chart pointer to an chart object
|
||||
* @param margin value of the margin [px]
|
||||
*/
|
||||
void lv_chart_set_margin(lv_obj_t * chart, uint16_t margin)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
|
@ -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)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
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
|
||||
* @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
|
||||
@ -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
|
||||
* @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
|
||||
@ -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)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
return lv_obj_get_style(chart);
|
||||
}
|
||||
|
||||
|
@ -87,12 +87,14 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
/*Init the new container*/
|
||||
if(copy == NULL) {
|
||||
/*Set the default styles*/
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, th->style.cont);
|
||||
} else {
|
||||
lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, &lv_style_pretty);
|
||||
/*Set the default styles if it's not screen*/
|
||||
if(par != NULL) {
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, th->style.cont);
|
||||
} else {
|
||||
lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, &lv_style_pretty);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
|
@ -43,6 +43,7 @@ enum {
|
||||
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_GRID, /**< Align same-sized object into a grid*/
|
||||
_LV_LAYOUT_NUM
|
||||
};
|
||||
typedef uint8_t lv_layout_t;
|
||||
|
||||
@ -55,6 +56,7 @@ enum {
|
||||
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
|
||||
then get larger */
|
||||
_LV_FIT_NUM
|
||||
};
|
||||
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)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
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)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
return lv_obj_get_style(cont);
|
||||
}
|
||||
|
||||
|
@ -749,8 +749,9 @@ static lv_res_t release_handler(lv_obj_t * ddlist)
|
||||
lv_ddlist_refr_size(ddlist, true);
|
||||
} else {
|
||||
|
||||
/*Leave edit mode once a new item is selected*/
|
||||
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) {
|
||||
ext->sel_opt_id_ori = ext->sel_opt_id;
|
||||
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);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*Search the clicked option (For KEYPAD and ENCODER the new value should be already set)*/
|
||||
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_POINTER || lv_indev_get_type(indev) == LV_INDEV_TYPE_BUTTON) {
|
||||
@ -784,7 +786,7 @@ static lv_res_t release_handler(lv_obj_t * ddlist)
|
||||
ext->sel_opt_id_ori = ext->sel_opt_id;
|
||||
}
|
||||
|
||||
uint32_t id = ext->sel_opt_id; /*Just to use uint32_t in event data*/
|
||||
uint32_t id = ext->sel_opt_id; /*Just to use uint32_t in event data*/
|
||||
lv_res_t res = lv_event_send(ddlist, LV_EVENT_VALUE_CHANGED, &id);
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
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)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
return lv_obj_get_style(gauge);
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ lv_coord_t lv_img_get_offset_y(lv_obj_t * img);
|
||||
*/
|
||||
static inline const lv_style_t * lv_img_get_style(const lv_obj_t * img, lv_img_style_t type)
|
||||
{
|
||||
(void)type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
return lv_obj_get_style(img);
|
||||
}
|
||||
|
||||
|
@ -43,11 +43,11 @@ typedef struct
|
||||
lv_btn_ext_t btn; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
#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
|
||||
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_right[LV_BTN_STATE_NUM]; /*Store right 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_right[_LV_BTN_STATE_NUM]; /*Store right side images to each state*/
|
||||
#endif
|
||||
lv_img_cf_t act_cf; /*Color format of the currently active image*/
|
||||
} lv_imgbtn_ext_t;
|
||||
|
@ -23,7 +23,8 @@
|
||||
#endif
|
||||
|
||||
#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
|
||||
@ -97,8 +98,8 @@ lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->offset.y = 0;
|
||||
|
||||
ext->hint.line_start = -1;
|
||||
ext->hint.coord_y = 0;
|
||||
ext->hint.y = 0;
|
||||
ext->hint.coord_y = 0;
|
||||
ext->hint.y = 0;
|
||||
|
||||
#if LV_LABEL_TEXT_SEL
|
||||
ext->txt_sel_start = LV_LABEL_TEXT_SEL_OFF;
|
||||
@ -358,8 +359,8 @@ void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed)
|
||||
lv_label_refr_text(label);
|
||||
}
|
||||
#else
|
||||
(void) label; /*Unused*/
|
||||
(void) anim_speed; /*Unused*/
|
||||
(void)label; /*Unused*/
|
||||
(void)anim_speed; /*Unused*/
|
||||
#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);
|
||||
return ext->anim_speed;
|
||||
#else
|
||||
(void) label; /*Unused*/
|
||||
(void)label; /*Unused*/
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
@ -690,9 +691,9 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos)
|
||||
|
||||
lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT;
|
||||
|
||||
uint32_t i = line_start;
|
||||
uint32_t i_current = i;
|
||||
uint32_t letter = '\0';
|
||||
uint32_t i = line_start;
|
||||
uint32_t i_current = i;
|
||||
uint32_t letter = '\0';
|
||||
uint32_t letter_next = '\0';
|
||||
|
||||
if(new_line_start > 0) {
|
||||
@ -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;
|
||||
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_label_get_text_sel_start(label), lv_label_get_text_sel_end(label), hint);
|
||||
@ -952,7 +954,7 @@ static void lv_label_refr_text(lv_obj_t * label)
|
||||
|
||||
if(ext->text == NULL) return;
|
||||
|
||||
ext->hint.line_start = -1; /*The hint is invalid if the text changes*/
|
||||
ext->hint.line_start = -1; /*The hint is invalid if the text changes*/
|
||||
|
||||
lv_coord_t max_w = lv_obj_get_width(label);
|
||||
const lv_style_t * style = lv_obj_get_style(label);
|
||||
|
@ -73,7 +73,7 @@ typedef struct
|
||||
uint16_t dot_end; /*The text end position in dot mode (Handled by the library)*/
|
||||
lv_point_t offset; /*Text draw position offset*/
|
||||
|
||||
lv_draw_label_hint_t hint; /*Used to buffer info about large text*/
|
||||
lv_draw_label_hint_t hint; /*Used to buffer info about large text*/
|
||||
#if LV_USE_ANIMATION
|
||||
uint16_t anim_speed; /*Speed of scroll and roll animation in px/sec unit*/
|
||||
#endif
|
||||
@ -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)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
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)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
return lv_obj_get_style(label);
|
||||
}
|
||||
|
||||
|
@ -88,9 +88,9 @@ void lv_led_toggle(lv_obj_t * led);
|
||||
* @param type which style should be set (can be only `LV_LED_STYLE_MAIN`)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@ -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)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
return lv_obj_get_style(led);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
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)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
return lv_obj_get_style(line);
|
||||
}
|
||||
|
||||
|
@ -88,8 +88,8 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel;
|
||||
ext->styles_btn[LV_BTN_STATE_TGL_PR] = &lv_style_btn_tgl_pr;
|
||||
ext->styles_btn[LV_BTN_STATE_INA] = &lv_style_btn_ina;
|
||||
ext->single_mode = false;
|
||||
ext->size = 0;
|
||||
ext->single_mode = false;
|
||||
ext->size = 0;
|
||||
|
||||
#if LV_USE_GROUP
|
||||
ext->last_sel = NULL;
|
||||
@ -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 ||
|
||||
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*/
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
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) {
|
||||
res = lv_event_send(btn, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
|
||||
} else if(sign == LV_SIGNAL_RELEASED) {
|
||||
#if LV_USE_GROUP
|
||||
ext->last_sel = btn;
|
||||
#endif
|
||||
if(indev->proc.long_pr_sent == 0) {
|
||||
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) {
|
||||
|
||||
#if LV_USE_GROUP
|
||||
|
@ -52,9 +52,9 @@ typedef struct
|
||||
{
|
||||
lv_page_ext_t page; /*Ext. of ancestor*/
|
||||
/*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 * style_img; /*Style of the list element images on buttons*/
|
||||
uint16_t size; /*the number of items(buttons) in the list*/
|
||||
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*/
|
||||
uint16_t size; /*the number of items(buttons) in the list*/
|
||||
|
||||
uint8_t single_mode : 1; /* whether single selected mode is enabled */
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
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)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
(void)type; /*Unused*/
|
||||
return lv_obj_get_style(lmeter);
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->edge_flash.right_ip = 0;
|
||||
ext->edge_flash.state = 0;
|
||||
ext->edge_flash.style = &lv_style_plain_color;
|
||||
ext->anim_time = LV_PAGE_DEF_ANIM_TIME;
|
||||
ext->anim_time = LV_PAGE_DEF_ANIM_TIME;
|
||||
#endif
|
||||
ext->scroll_prop = 0;
|
||||
ext->scroll_prop_ip = 0;
|
||||
@ -218,12 +218,11 @@ void lv_page_set_anim_time(lv_obj_t * page, uint16_t anim_time)
|
||||
{
|
||||
#if LV_USE_ANIMATION
|
||||
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
|
||||
ext->anim_time = anim_time;
|
||||
ext->anim_time = anim_time;
|
||||
#else
|
||||
(void)page; /*Unused*/
|
||||
(void)anim_time; /*Unused*/
|
||||
(void)page; /*Unused*/
|
||||
(void)anim_time; /*Unused*/
|
||||
#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);
|
||||
return ext->anim_time;
|
||||
#else
|
||||
(void) page; /*Unused*/
|
||||
(void)page; /*Unused*/
|
||||
return 0;
|
||||
#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(page, &page_coords);
|
||||
|
||||
if((edge & LV_PAGE_EDGE_TOP) && scrl_coords.y1 == page_coords.y1 + page_style->body.padding.top)
|
||||
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_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;
|
||||
if((edge & LV_PAGE_EDGE_TOP) && scrl_coords.y1 == page_coords.y1 + page_style->body.padding.top) 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_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;
|
||||
}
|
||||
@ -446,7 +441,6 @@ void lv_page_glue_obj(lv_obj_t * obj, bool glue)
|
||||
lv_obj_set_drag(obj, glue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Focus on an object. It ensures that the object will be visible on the page.
|
||||
* @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);
|
||||
}
|
||||
#else
|
||||
(void) page; /*Unused*/
|
||||
(void)page; /*Unused*/
|
||||
#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*/
|
||||
page_ext->scroll_prop_ip = 1;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,12 +50,7 @@ enum {
|
||||
typedef uint8_t lv_sb_mode_t;
|
||||
|
||||
/** Edges: describes the four edges of the page*/
|
||||
enum {
|
||||
LV_PAGE_EDGE_LEFT = 0x1,
|
||||
LV_PAGE_EDGE_TOP = 0x2,
|
||||
LV_PAGE_EDGE_RIGHT = 0x4,
|
||||
LV_PAGE_EDGE_BOTTOM = 0x8
|
||||
};
|
||||
enum { 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;
|
||||
|
||||
/*Data of page*/
|
||||
|
@ -107,7 +107,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*Copy an existing roller*/
|
||||
else {
|
||||
lv_roller_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
ext->mode = copy_ext->mode;
|
||||
ext->mode = copy_ext->mode;
|
||||
|
||||
lv_obj_t * scrl = lv_page_get_scrl(new_roller);
|
||||
lv_ddlist_open(new_roller, false);
|
||||
@ -321,9 +321,9 @@ static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_desig
|
||||
rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.line_space / 2;
|
||||
if((font_h & 0x1) && (style->text.line_space & 0x1)) rect_area.y1--; /*Compensate the two rounding error*/
|
||||
rect_area.y2 = rect_area.y1 + font_h + style->text.line_space - 1;
|
||||
lv_area_t roller_coords;
|
||||
lv_obj_get_coords(roller, &roller_coords);
|
||||
lv_obj_get_inner_coords(roller, &roller_coords);
|
||||
lv_area_t roller_coords;
|
||||
lv_obj_get_coords(roller, &roller_coords);
|
||||
lv_obj_get_inner_coords(roller, &roller_coords);
|
||||
|
||||
rect_area.x1 = roller_coords.x1;
|
||||
rect_area.x2 = roller_coords.x2;
|
||||
@ -607,7 +607,7 @@ static void refr_position(lv_obj_t * roller, lv_anim_enable_t anim_en)
|
||||
const lv_font_t * font = style_label->text.font;
|
||||
lv_coord_t font_h = lv_font_get_line_height(font);
|
||||
lv_coord_t h = lv_obj_get_height(roller);
|
||||
uint16_t anim_time = lv_roller_get_anim_time(roller);
|
||||
uint16_t anim_time = lv_roller_get_anim_time(roller);
|
||||
|
||||
/* Normally the animtaion's `end_cb` sets correct position of the roller is infinite.
|
||||
* But without animations do it manually*/
|
||||
|
@ -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";
|
||||
} 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();
|
||||
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_ENCODER) {
|
||||
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) {
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
|
||||
|
@ -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);
|
||||
return ext->anim_time;
|
||||
#else
|
||||
(void) sw; /*Unused*/
|
||||
(void)sw; /*Unused*/
|
||||
return 0;
|
||||
#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)) {
|
||||
lv_sw_off(sw, LV_ANIM_ON);
|
||||
state = 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
lv_sw_on(sw, LV_ANIM_ON);
|
||||
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) {
|
||||
lv_sw_on(sw, LV_ANIM_ON);
|
||||
state = 1;
|
||||
} else{
|
||||
} else {
|
||||
lv_sw_off(sw, LV_ANIM_ON);
|
||||
state = 0;
|
||||
}
|
||||
@ -364,12 +363,12 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
|
||||
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
|
||||
lv_slider_set_value(sw, LV_SW_MAX_VALUE, true);
|
||||
state = 1;
|
||||
res = lv_event_send(sw, LV_EVENT_VALUE_CHANGED, &state);
|
||||
res = lv_event_send(sw, LV_EVENT_VALUE_CHANGED, &state);
|
||||
if(res != LV_RES_OK) return res;
|
||||
} else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) {
|
||||
lv_slider_set_value(sw, 0, true);
|
||||
state = 0;
|
||||
res = lv_event_send(sw, LV_EVENT_VALUE_CHANGED, &state);
|
||||
res = lv_event_send(sw, LV_EVENT_VALUE_CHANGED, &state);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
|
@ -112,10 +112,10 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->cursor.valid_x = 0;
|
||||
ext->one_line = 0;
|
||||
#if LV_LABEL_TEXT_SEL
|
||||
ext->text_sel_en = 0;
|
||||
ext->text_sel_en = 0;
|
||||
#endif
|
||||
ext->label = NULL;
|
||||
ext->placeholder = NULL;
|
||||
ext->label = NULL;
|
||||
ext->placeholder = NULL;
|
||||
|
||||
#if LV_USE_ANIMATION == 0
|
||||
ext->pwd_show_time = 0;
|
||||
@ -627,7 +627,7 @@ void lv_ta_set_cursor_type(lv_obj_t * ta, lv_cursor_type_t cur_type)
|
||||
*/
|
||||
void lv_ta_set_cursor_click_pos(lv_obj_t * ta, bool en)
|
||||
{
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
ext->cursor.click_pos = en ? 1 : 0;
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
/*Set the label width according to the text area width*/
|
||||
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);
|
||||
lv_obj_set_width(ext->label, lv_page_get_fit_width(ta));
|
||||
@ -1610,8 +1611,7 @@ static void get_cursor_style(lv_obj_t * ta, lv_style_t * style_res)
|
||||
|
||||
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);
|
||||
|
||||
@ -1739,14 +1739,13 @@ static void update_cursor_position_on_click(lv_obj_t * ta, lv_signal_t sign, lv_
|
||||
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
if(ext->cursor.click_pos == 0) return;
|
||||
if(ext->cursor.type == LV_CURSOR_NONE) return;
|
||||
if(ext->cursor.type == LV_CURSOR_NONE) return;
|
||||
|
||||
if(lv_indev_get_type(click_source) == LV_INDEV_TYPE_KEYPAD ||
|
||||
lv_indev_get_type(click_source) == LV_INDEV_TYPE_ENCODER) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
lv_area_t label_coords;
|
||||
lv_obj_get_coords(ext->label, &label_coords);
|
||||
|
||||
|
@ -77,7 +77,7 @@ typedef struct
|
||||
uint16_t txt_byte_pos; /* Byte index of the letter after (on) 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 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;
|
||||
#if LV_LABEL_TEXT_SEL
|
||||
uint16_t tmp_sel_start; /*Temporary value*/
|
||||
|
@ -691,6 +691,7 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
tabview_realign(tabview);
|
||||
}
|
||||
} 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.
|
||||
* So simulate a CLICK on the tab buttons*/
|
||||
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)))) {
|
||||
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) {
|
||||
/* 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*/
|
||||
@ -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(res != LV_RES_OK) return;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,9 +80,9 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
#if LV_USE_ANIMATION
|
||||
ext->anim_time = LV_TILEVIEW_DEF_ANIM_TIME;
|
||||
#endif
|
||||
ext->act_id.x = 0;
|
||||
ext->act_id.y = 0;
|
||||
ext->valid_pos = NULL;
|
||||
ext->act_id.x = 0;
|
||||
ext->act_id.y = 0;
|
||||
ext->valid_pos = NULL;
|
||||
ext->valid_pos_cnt = 0;
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
@ -116,8 +116,8 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_tileview_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
ext->act_id.x = copy_ext->act_id.x;
|
||||
ext->act_id.y = copy_ext->act_id.y;
|
||||
ext->valid_pos = copy_ext->valid_pos;
|
||||
ext->valid_pos_cnt = copy_ext->valid_pos_cnt;
|
||||
ext->valid_pos = copy_ext->valid_pos;
|
||||
ext->valid_pos_cnt = copy_ext->valid_pos_cnt;
|
||||
#if LV_USE_ANIMATION
|
||||
ext->anim_time = copy_ext->anim_time;
|
||||
#endif
|
||||
@ -169,7 +169,7 @@ void lv_tileview_set_valid_positions(lv_obj_t * tileview, const lv_point_t * val
|
||||
{
|
||||
lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview);
|
||||
ext->valid_pos = valid_pos;
|
||||
ext->valid_pos_cnt = valid_pos_cnt;
|
||||
ext->valid_pos_cnt = valid_pos_cnt;
|
||||
|
||||
/*If valid pos. is selected do nothing*/
|
||||
uint16_t i;
|
||||
|
@ -83,7 +83,6 @@ void lv_tileview_add_element(lv_obj_t * tileview, lv_obj_t * element);
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
|
||||
/**
|
||||
* Set the valid position's indices. The scrolling will be possible only to these positions.
|
||||
* @param tileview pointer to a Tileview object
|
||||
|
@ -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);
|
||||
lv_label_set_text(ext->title, "My title");
|
||||
|
||||
|
||||
/*Set the default styles*/
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
|
@ -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);
|
||||
|
||||
|
||||
/**
|
||||
* Get a style of a window
|
||||
* @param win pointer to a button object
|
||||
|
@ -40,6 +40,7 @@ typedef struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
lv_style_t * scr;
|
||||
lv_style_t * bg;
|
||||
lv_style_t * panel;
|
||||
|
||||
|
@ -32,6 +32,7 @@ static lv_font_t * _font;
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
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 sb;
|
||||
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.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*/
|
||||
lv_style_copy(&panel, &def);
|
||||
panel.body.radius = LV_DPI / 10;
|
||||
@ -133,6 +140,7 @@ static void basic_init(void)
|
||||
sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/
|
||||
|
||||
theme.style.bg = &bg;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &panel;
|
||||
}
|
||||
|
||||
@ -820,12 +828,12 @@ static void win_init(void)
|
||||
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;
|
||||
theme.style.win.header = &header;
|
||||
theme.style.win.bg = &bg;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &header;
|
||||
theme.style.win.content = &lv_style_transp;
|
||||
theme.style.win.btn.rel = &btn_rel;
|
||||
theme.style.win.btn.pr = &btn_pr;
|
||||
theme.style.win.btn.rel = &btn_rel;
|
||||
theme.style.win.btn.pr = &btn_pr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
**********************/
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
static lv_style_t scr;
|
||||
|
||||
/*Static style definitions*/
|
||||
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(&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);
|
||||
sb.body.grad_color = sb.body.main_color;
|
||||
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);
|
||||
|
||||
theme.style.bg = &lv_style_plain;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &lv_style_pretty;
|
||||
}
|
||||
|
||||
@ -337,12 +345,12 @@ static void win_init(void)
|
||||
{
|
||||
#if LV_USE_WIN != 0
|
||||
|
||||
theme.style.win.bg = &plain_bordered;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &lv_style_plain_color;
|
||||
theme.style.win.bg = &plain_bordered;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &lv_style_plain_color;
|
||||
theme.style.win.content = &lv_style_transp;
|
||||
theme.style.win.btn.rel = &lv_style_btn_rel;
|
||||
theme.style.win.btn.pr = &lv_style_btn_pr;
|
||||
theme.style.win.btn.rel = &lv_style_btn_rel;
|
||||
theme.style.win.btn.pr = &lv_style_btn_pr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ static lv_font_t * _font;
|
||||
|
||||
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*/
|
||||
def.text.font = _font;
|
||||
@ -58,6 +58,12 @@ static void basic_init(void)
|
||||
bg.body.grad_color = bg.body.main_color;
|
||||
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);
|
||||
panel.body.radius = DEF_RADIUS;
|
||||
panel.body.main_color = LV_COLOR_WHITE;
|
||||
@ -84,6 +90,7 @@ static void basic_init(void)
|
||||
sb.body.padding.bottom = LV_DPI / 25;
|
||||
|
||||
theme.style.bg = &bg;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &panel;
|
||||
}
|
||||
|
||||
@ -785,12 +792,12 @@ static void win_init(void)
|
||||
pr.text.color = lv_color_hex3(0x111);
|
||||
pr.image.color = lv_color_hex3(0x111);
|
||||
|
||||
theme.style.win.bg = theme.style.panel;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &header;
|
||||
theme.style.win.bg = theme.style.panel;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &header;
|
||||
theme.style.win.content = &lv_style_transp;
|
||||
theme.style.win.btn.rel = &lv_style_transp;
|
||||
theme.style.win.btn.pr = ≺
|
||||
theme.style.win.btn.rel = &lv_style_transp;
|
||||
theme.style.win.btn.pr = ≺
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
**********************/
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
static lv_style_t scr;
|
||||
|
||||
/*Static style definitions*/
|
||||
static lv_style_t light_plain;
|
||||
@ -75,6 +76,12 @@ static void basic_init(void)
|
||||
def.image.intense = LV_OPA_TRANSP;
|
||||
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_frame, &light_plain);
|
||||
@ -92,6 +99,7 @@ static void basic_init(void)
|
||||
dark_frame.body.radius = LV_DPI / 20;
|
||||
|
||||
theme.style.bg = &def;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &light_frame;
|
||||
}
|
||||
|
||||
@ -392,12 +400,12 @@ static void win_init(void)
|
||||
win_header.body.padding.top = LV_DPI / 30;
|
||||
win_header.body.padding.bottom = LV_DPI / 30;
|
||||
|
||||
theme.style.win.bg = &light_frame;
|
||||
theme.style.win.sb = &dark_frame;
|
||||
theme.style.win.header = &win_header;
|
||||
theme.style.win.bg = &light_frame;
|
||||
theme.style.win.sb = &dark_frame;
|
||||
theme.style.win.header = &win_header;
|
||||
theme.style.win.content = &lv_style_transp;
|
||||
theme.style.win.btn.rel = &light_frame;
|
||||
theme.style.win.btn.pr = &dark_frame;
|
||||
theme.style.win.btn.rel = &light_frame;
|
||||
theme.style.win.btn.pr = &dark_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ static lv_font_t * _font;
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
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 sb;
|
||||
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.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*/
|
||||
lv_style_copy(&panel, &def);
|
||||
panel.body.radius = LV_DPI / 10;
|
||||
@ -134,6 +141,7 @@ static void basic_init(void)
|
||||
sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/
|
||||
|
||||
theme.style.bg = &bg;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &panel;
|
||||
}
|
||||
|
||||
@ -789,12 +797,12 @@ static void win_init(void)
|
||||
win_header.body.border.color = lv_color_hsv_to_rgb(_hue, 20, 80);
|
||||
win_header.text.color = lv_color_hsv_to_rgb(_hue, 5, 100);
|
||||
|
||||
theme.style.win.bg = &bg;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &win_header;
|
||||
theme.style.win.bg = &bg;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &win_header;
|
||||
theme.style.win.content = &lv_style_transp;
|
||||
theme.style.win.btn.rel = &btn_rel;
|
||||
theme.style.win.btn.pr = &btn_pr;
|
||||
theme.style.win.btn.rel = &btn_rel;
|
||||
theme.style.win.btn.pr = &btn_pr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
|
||||
/*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 btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina;
|
||||
static lv_style_t bar_bg, bar_indic;
|
||||
@ -61,6 +61,12 @@ static void basic_init(void)
|
||||
bg.text.font = _font;
|
||||
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);
|
||||
sb.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 60);
|
||||
sb.body.grad_color = lv_color_hsv_to_rgb(_hue, 30, 60);
|
||||
@ -86,8 +92,10 @@ static void basic_init(void)
|
||||
panel.body.padding.bottom = LV_DPI / 10;
|
||||
panel.line.color = lv_color_hsv_to_rgb(_hue, 20, 40);
|
||||
panel.line.width = 1;
|
||||
theme.style.bg = &bg;
|
||||
theme.style.panel = &def;
|
||||
|
||||
theme.style.scr = &scr;
|
||||
theme.style.bg = &bg;
|
||||
theme.style.panel = &def;
|
||||
}
|
||||
|
||||
static void cont_init(void)
|
||||
@ -711,12 +719,12 @@ static void win_init(void)
|
||||
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;
|
||||
theme.style.win.header = &win_header;
|
||||
theme.style.win.bg = &win_bg;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &win_header;
|
||||
theme.style.win.content = &lv_style_transp;
|
||||
theme.style.win.btn.rel = &lv_style_transp;
|
||||
theme.style.win.btn.pr = &win_btn_pr;
|
||||
theme.style.win.btn.rel = &lv_style_transp;
|
||||
theme.style.win.btn.pr = &win_btn_pr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,7 @@ static void basic_init(void)
|
||||
lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/
|
||||
def.text.font = _font;
|
||||
|
||||
theme.style.scr = &def;
|
||||
theme.style.bg = &def;
|
||||
theme.style.panel = &def;
|
||||
}
|
||||
@ -332,12 +333,12 @@ static void win_init(void)
|
||||
{
|
||||
#if LV_USE_WIN != 0
|
||||
|
||||
theme.style.win.bg = &def;
|
||||
theme.style.win.sb = &def;
|
||||
theme.style.win.header = &def;
|
||||
theme.style.win.content = &def;
|
||||
theme.style.win.btn.rel = &def;
|
||||
theme.style.win.btn.pr = &def;
|
||||
theme.style.win.bg = &def;
|
||||
theme.style.win.sb = &def;
|
||||
theme.style.win.header = &def;
|
||||
theme.style.win.content = &def;
|
||||
theme.style.win.btn.rel = &def;
|
||||
theme.style.win.btn.pr = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@ static lv_font_t * _font;
|
||||
static void basic_init(void)
|
||||
{
|
||||
static lv_style_t bg;
|
||||
static lv_style_t scr;
|
||||
static lv_style_t panel;
|
||||
|
||||
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.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);
|
||||
panel.body.radius = LV_DPI / 10;
|
||||
panel.body.border.width = 2;
|
||||
@ -80,6 +87,7 @@ static void basic_init(void)
|
||||
sb.body.radius = LV_RADIUS_CIRCLE;
|
||||
sb.body.padding.inner = LV_DPI / 10;
|
||||
|
||||
theme.style.scr = &scr;
|
||||
theme.style.bg = &bg;
|
||||
theme.style.panel = &panel;
|
||||
}
|
||||
@ -760,12 +768,12 @@ static void win_init(void)
|
||||
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;
|
||||
theme.style.win.header = &header;
|
||||
theme.style.win.bg = theme.style.panel;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &header;
|
||||
theme.style.win.content = &lv_style_transp;
|
||||
theme.style.win.btn.rel = &rel;
|
||||
theme.style.win.btn.pr = ≺
|
||||
theme.style.win.btn.rel = &rel;
|
||||
theme.style.win.btn.pr = ≺
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user