Compare commits
54 Commits
master
...
release/v7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7a17a525e | ||
|
|
9122f844f6 | ||
|
|
5c0bb3f85a | ||
|
|
c539546f74 | ||
|
|
9d99f08e80 | ||
|
|
3a39ed05a7 | ||
|
|
ec4435426e | ||
|
|
a33fe6a2d6 | ||
|
|
32ee6c5781 | ||
|
|
a3234c8aa1 | ||
|
|
ac1fa649ca | ||
|
|
8747a35123 | ||
|
|
3fce530c01 | ||
|
|
719fa3ce0f | ||
|
|
797212a3f3 | ||
|
|
042e34cb88 | ||
|
|
60ddd13465 | ||
|
|
e04a8d2961 | ||
|
|
3bafa5a8a3 | ||
|
|
f710be661b | ||
|
|
b16e7f1076 | ||
|
|
708272c37c | ||
|
|
f926ec56e9 | ||
|
|
d11d95bf8e | ||
|
|
e06fe1b82e | ||
|
|
d39a34351c | ||
|
|
e08ecffca9 | ||
|
|
3e7bc7294a | ||
|
|
77d6dbb691 | ||
|
|
506a21c6d9 | ||
|
|
28c43adc60 | ||
|
|
0ce7795b7a | ||
|
|
3025101786 | ||
|
|
94ad20bc94 | ||
|
|
9f1982bf5c | ||
|
|
02b80de5f3 | ||
|
|
ea04782acb | ||
|
|
15976bdb9e | ||
|
|
acf42d3999 | ||
|
|
82b9779067 | ||
|
|
c08b0cdc79 | ||
|
|
08b3fe1f11 | ||
|
|
1748798aca | ||
|
|
e1ac174e16 | ||
|
|
3856548377 | ||
|
|
51edc63ac1 | ||
|
|
d9f5298225 | ||
|
|
3fa221e659 | ||
|
|
0b39da7d24 | ||
|
|
87a49f25c1 | ||
|
|
9688935c8f | ||
|
|
f32526562a | ||
|
|
4250e64613 | ||
|
|
cfc4ec4b1b |
@@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## v7.11.1
|
||||
|
||||
### New features
|
||||
|
||||
### Bugfixes
|
||||
- fix(kconfig) remove dependency for LV_COLOR_CHROMA_KEY_HEX
|
||||
|
||||
## v7.11.0 (Planned for 19.02.2021)
|
||||
|
||||
### New features
|
||||
|
||||
@@ -2,9 +2,16 @@ if(ESP_PLATFORM)
|
||||
|
||||
file(GLOB_RECURSE SOURCES src/*.c)
|
||||
|
||||
idf_component_register(SRCS ${SOURCES}
|
||||
INCLUDE_DIRS . src
|
||||
REQUIRES main)
|
||||
idf_build_get_property(LV_MICROPYTHON LV_MICROPYTHON)
|
||||
|
||||
if (LV_MICROPYTHON)
|
||||
idf_component_register(SRCS ${SOURCES}
|
||||
INCLUDE_DIRS . src ../
|
||||
REQUIRES main)
|
||||
else()
|
||||
idf_component_register(SRCS ${SOURCES}
|
||||
INCLUDE_DIRS . src ../)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_CONF_INCLUDE_SIMPLE")
|
||||
|
||||
@@ -65,3 +72,35 @@ file(GLOB_RECURSE SOURCES src/*.c)
|
||||
add_library(lvgl STATIC ${SOURCES})
|
||||
|
||||
endif()
|
||||
|
||||
option(install "Enable install to system" OFF)
|
||||
if(install)
|
||||
include_directories(${CMAKE_SOURCE_DIR})
|
||||
|
||||
file(GLOB LVGL_PUBLIC_HEADERS
|
||||
"${CMAKE_SOURCE_DIR}/lv_conf.h"
|
||||
"${CMAKE_SOURCE_DIR}/lvgl.h")
|
||||
|
||||
|
||||
if("${LIB_INSTALL_DIR}" STREQUAL "")
|
||||
set(LIB_INSTALL_DIR "lib")
|
||||
endif()
|
||||
|
||||
if("${INC_INSTALL_DIR}" STREQUAL "")
|
||||
set(INC_INSTALL_DIR "include/lvgl")
|
||||
endif()
|
||||
|
||||
install(DIRECTORY "${CMAKE_SOURCE_DIR}/src"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/"
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h")
|
||||
|
||||
set_target_properties(lvgl PROPERTIES
|
||||
OUTPUT_NAME lvgl
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
|
||||
|
||||
install(TARGETS lvgl
|
||||
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
|
||||
endif(install)
|
||||
|
||||
1
Kconfig
1
Kconfig
@@ -62,7 +62,6 @@ menu "LVGL configuration"
|
||||
|
||||
config LV_COLOR_TRANSP_HEX
|
||||
hex "Images pixels with this color will not be drawn (with chroma keying)."
|
||||
depends on LV_COLOR_SCREEN_TRANSP
|
||||
range 0x000000 0xFFFFFF
|
||||
default 0x00FF00
|
||||
help
|
||||
|
||||
@@ -9,7 +9,7 @@ LVGL provides everything you need to create embedded GUI with easy-to-use graphi
|
||||
</p>
|
||||
|
||||
<h4 align="center">
|
||||
<a href="https://lvgl.io">Website </a> ·
|
||||
<a href="https://lvgl.io">Website </a> ·Update README.md
|
||||
<a href="https://lvgl.io/demos">Online demo</a> ·
|
||||
<a href="https://lvgl.github.io/lv_examples/">Nightly demos</a> ·
|
||||
<a href="https://docs.lvgl.io/">Docs</a> ·
|
||||
@@ -139,6 +139,7 @@ void btn_event_cb(lv_obj_t * btn, lv_event_t event)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||

|
||||
|
||||
### LVGL from Micropython
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lvgl",
|
||||
"version": "7.11.0",
|
||||
"version": "7.11.1",
|
||||
"keywords": "graphics, gui, embedded, tft, lvgl",
|
||||
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
|
||||
"repository": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name=lvgl
|
||||
version=7.11.0
|
||||
version=7.11.1
|
||||
author=kisvegabor
|
||||
maintainer=kisvegabor,embeddedt,pete-pjb
|
||||
sentence=Full-featured Graphics Library for Embedded Systems
|
||||
|
||||
@@ -28,10 +28,11 @@ fout.write(
|
||||
#include <stdint.h>
|
||||
|
||||
/* Handle special Kconfig options */
|
||||
#include "lv_conf_kconfig.h"
|
||||
|
||||
#ifdef CONFIG_LV_CONF_SKIP
|
||||
#define LV_CONF_SKIP
|
||||
#ifndef LV_KCONFIG_IGNORE
|
||||
# include "lv_conf_kconfig.h"
|
||||
# ifdef CONFIG_LV_CONF_SKIP
|
||||
# define LV_CONF_SKIP
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* If "lv_conf.h" is available from here try to use it later.*/
|
||||
|
||||
@@ -11,10 +11,11 @@
|
||||
#include <stdint.h>
|
||||
|
||||
/* Handle special Kconfig options */
|
||||
#include "lv_conf_kconfig.h"
|
||||
|
||||
#ifdef CONFIG_LV_CONF_SKIP
|
||||
#define LV_CONF_SKIP
|
||||
#ifndef LV_KCONFIG_IGNORE
|
||||
# include "lv_conf_kconfig.h"
|
||||
# ifdef CONFIG_LV_CONF_SKIP
|
||||
# define LV_CONF_SKIP
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* If "lv_conf.h" is available from here try to use it later.*/
|
||||
|
||||
@@ -215,13 +215,15 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
|
||||
lv_disp_t * d = lv_obj_get_disp(new_scr);
|
||||
lv_obj_t * act_scr = lv_scr_act();
|
||||
|
||||
if(d->del_prev && act_scr != d->scr_to_load && d->scr_to_load) {
|
||||
lv_obj_del(act_scr);
|
||||
if(d->scr_to_load && act_scr != d->scr_to_load) {
|
||||
lv_disp_load_scr(d->scr_to_load);
|
||||
lv_anim_del(d->scr_to_load, NULL);
|
||||
lv_obj_set_pos(d->scr_to_load, 0, 0);
|
||||
lv_style_remove_prop(lv_obj_get_local_style(d->scr_to_load, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||
|
||||
if(d->del_prev) {
|
||||
lv_obj_del(act_scr);
|
||||
}
|
||||
act_scr = d->scr_to_load;
|
||||
}
|
||||
|
||||
|
||||
@@ -414,6 +414,10 @@ lv_task_t * lv_indev_get_read_task(lv_disp_t * indev)
|
||||
static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
{
|
||||
lv_disp_t * disp = i->driver.disp;
|
||||
/*Save the raw points so they can be used again in _lv_indev_read*/
|
||||
i->proc.types.pointer.last_raw_point.x = data->point.x;
|
||||
i->proc.types.pointer.last_raw_point.y = data->point.y;
|
||||
/*Rotate the points if necessary*/
|
||||
if(disp->driver.rotated == LV_DISP_ROT_180 || disp->driver.rotated == LV_DISP_ROT_270) {
|
||||
data->point.x = disp->driver.hor_res - data->point.x - 1;
|
||||
data->point.y = disp->driver.ver_res - data->point.y - 1;
|
||||
|
||||
@@ -585,34 +585,35 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
|
||||
/*Invalidate the object only if it belongs to the current or previous'*/
|
||||
lv_obj_t * obj_scr = lv_obj_get_screen(obj);
|
||||
lv_disp_t * disp = lv_obj_get_disp(obj_scr);
|
||||
if(obj_scr == lv_disp_get_scr_act(disp) ||
|
||||
obj_scr == lv_disp_get_scr_prev(disp) ||
|
||||
obj_scr == lv_disp_get_layer_top(disp) ||
|
||||
obj_scr == lv_disp_get_layer_sys(disp)) {
|
||||
if(obj_scr != lv_disp_get_scr_act(disp) &&
|
||||
obj_scr != lv_disp_get_scr_prev(disp) &&
|
||||
obj_scr != lv_disp_get_layer_top(disp) &&
|
||||
obj_scr != lv_disp_get_layer_sys(disp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*Truncate the area to the object*/
|
||||
lv_area_t obj_coords;
|
||||
lv_coord_t ext_size = obj->ext_draw_pad;
|
||||
lv_area_copy(&obj_coords, &obj->coords);
|
||||
obj_coords.x1 -= ext_size;
|
||||
obj_coords.y1 -= ext_size;
|
||||
obj_coords.x2 += ext_size;
|
||||
obj_coords.y2 += ext_size;
|
||||
/*Truncate the area to the object*/
|
||||
lv_area_t obj_coords;
|
||||
lv_coord_t ext_size = obj->ext_draw_pad;
|
||||
lv_area_copy(&obj_coords, &obj->coords);
|
||||
obj_coords.x1 -= ext_size;
|
||||
obj_coords.y1 -= ext_size;
|
||||
obj_coords.x2 += ext_size;
|
||||
obj_coords.y2 += ext_size;
|
||||
|
||||
bool is_common;
|
||||
bool is_common;
|
||||
|
||||
is_common = _lv_area_intersect(area, area, &obj_coords);
|
||||
if(is_common == false) return false; /*The area is not on the object*/
|
||||
is_common = _lv_area_intersect(area, area, &obj_coords);
|
||||
if(is_common == false) return false; /*The area is not on the object*/
|
||||
|
||||
/*Truncate recursively to the parents*/
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
while(par != NULL) {
|
||||
is_common = _lv_area_intersect(area, area, &par->coords);
|
||||
if(is_common == false) return false; /*If no common parts with parent break;*/
|
||||
if(lv_obj_get_hidden(par)) return false; /*If the parent is hidden then the child is hidden and won't be drawn*/
|
||||
/*Truncate recursively to the parents*/
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
while(par != NULL) {
|
||||
is_common = _lv_area_intersect(area, area, &par->coords);
|
||||
if(is_common == false) return false; /*If no common parts with parent break;*/
|
||||
if(lv_obj_get_hidden(par)) return false; /*If the parent is hidden then the child is hidden and won't be drawn*/
|
||||
|
||||
par = lv_obj_get_parent(par);
|
||||
}
|
||||
par = lv_obj_get_parent(par);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -3601,7 +3602,7 @@ lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part)
|
||||
lv_opa_t value_opa = lv_obj_get_style_value_opa(obj, part);
|
||||
if(value_opa > LV_OPA_MIN) {
|
||||
lv_style_int_t letter_space = lv_obj_get_style_value_letter_space(obj, part);
|
||||
lv_style_int_t line_space = lv_obj_get_style_value_letter_space(obj, part);
|
||||
lv_style_int_t line_space = lv_obj_get_style_value_line_space(obj, part);
|
||||
const lv_font_t * font = lv_obj_get_style_value_font(obj, part);
|
||||
|
||||
lv_point_t txt_size;
|
||||
|
||||
@@ -32,19 +32,6 @@ extern "C" {
|
||||
* - For example:
|
||||
* `lv_obj_set_style_local_border_width(btn1, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 2);`
|
||||
*
|
||||
* Get a local style property's value of an object in a given state
|
||||
* ----------------------------------------------------------------
|
||||
* - Return the best matching property in the given state.
|
||||
* - E.g. if `state` parameter is LV_STATE_PRESSED | LV_STATE_CHECKED` but the property defined only in
|
||||
* `LV_STATE_PRESSED` and `LV_STATE_DEFAULT` the best matching state is `LV_STATE_PRESSED`
|
||||
* (because it has higher precedence) and it will be returned.
|
||||
* - If the property is not found even in `LV_STATE_DEFAULT` `-1` is returned.
|
||||
* - For example:
|
||||
* `//Type of result should be lv_style_int_t/lv_opa_t/lv_color_t/const void * according to the type of the property`
|
||||
* `lv_style_int_t result;`
|
||||
* `lv_obj_get_style_local_border_width(btn1, LV_BTN_PART_MAIN, LV_STATE_PRESSED, &result);`
|
||||
* `if(weight > 0) ...the property is found and loaded into result...`
|
||||
*
|
||||
* Get the value from a style in a given state
|
||||
* -------------------------------------------
|
||||
* - The same rules applies to the return value then for "lv_obj_get_style_local_...()" above
|
||||
|
||||
@@ -861,7 +861,7 @@ static void lv_refr_vdb_rotate(lv_area_t * area, lv_color_t * color_p)
|
||||
area->y1 = area->x1;
|
||||
area->y2 = area->y1 + area_w - 1;
|
||||
}
|
||||
vdb->flushing = 0;
|
||||
|
||||
/*Rotate the screen in chunks, flushing after each one*/
|
||||
lv_coord_t row = 0;
|
||||
while(row < area_h) {
|
||||
@@ -895,6 +895,16 @@ static void lv_refr_vdb_rotate(lv_area_t * area, lv_color_t * color_p)
|
||||
area->x1 = area->x2 - height + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* The original part (chunk of the current area) were split into more parts here.
|
||||
* Set the original last_part flag on the last part of rotation. */
|
||||
if(row + height >= area_h && vdb->last_area && vdb->last_part) {
|
||||
vdb->flushing_last = 1;
|
||||
}
|
||||
else {
|
||||
vdb->flushing_last = 0;
|
||||
}
|
||||
|
||||
/*Flush the completed area to the display*/
|
||||
drv->flush_cb(drv, area, rot_buf == NULL ? color_p : rot_buf);
|
||||
/*FIXME: Rotation forces legacy behavior where rendering and flushing are done serially*/
|
||||
|
||||
@@ -328,13 +328,6 @@ void lv_style_reset(lv_style_t * style);
|
||||
*/
|
||||
uint16_t _lv_style_get_mem_size(const lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Copy a style to an other
|
||||
* @param dest pointer to the destination style
|
||||
* @param src pointer to the source style
|
||||
*/
|
||||
void lv_style_copy(lv_style_t * dest, const lv_style_t * src);
|
||||
|
||||
/**
|
||||
* Remove a property from a style
|
||||
* @param style pointer to a style
|
||||
|
||||
@@ -655,6 +655,14 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
int32_t col_bit;
|
||||
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
|
||||
|
||||
lv_area_t map_area;
|
||||
map_area.x1 = col_start / 3 + pos_x;
|
||||
map_area.x2 = col_end / 3 + pos_x - 1;
|
||||
map_area.y1 = row_start + pos_y;
|
||||
map_area.y2 = map_area.y1;
|
||||
|
||||
if(map_area.x2 <= map_area.x1) return;
|
||||
|
||||
int32_t mask_buf_size = box_w * box_h > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : g->box_w * g->box_h;
|
||||
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
|
||||
int32_t mask_p = 0;
|
||||
@@ -673,12 +681,6 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
/*If the letter is partially out of mask the move there on VDB*/
|
||||
vdb_buf_tmp += (row_start * vdb_width) + col_start / 3;
|
||||
|
||||
lv_area_t map_area;
|
||||
map_area.x1 = col_start / 3 + pos_x;
|
||||
map_area.x2 = col_end / 3 + pos_x - 1;
|
||||
map_area.y1 = row_start + pos_y;
|
||||
map_area.y2 = map_area.y1;
|
||||
|
||||
uint8_t other_mask_cnt = lv_draw_mask_get_cnt();
|
||||
|
||||
uint8_t font_rgb[3];
|
||||
|
||||
@@ -468,12 +468,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
fill_area.y1 = disp_area->y1 + draw_area.y1;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
|
||||
uint32_t buf_ofs = 0;
|
||||
if(dsc->border_side == LV_BORDER_SIDE_LEFT) fill_area.x2 = coords->x1 + corner_size;
|
||||
else if(dsc->border_side == LV_BORDER_SIDE_RIGHT) {
|
||||
fill_area.x1 = coords->x2 - corner_size;
|
||||
buf_ofs = fill_area.x1 - coords->x1;
|
||||
}
|
||||
|
||||
volatile bool top_only = false;
|
||||
volatile bool bottom_only = false;
|
||||
@@ -492,7 +487,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
(bottom_only && fill_area.y1 >= coords->y2 - corner_size)) {
|
||||
_lv_memset_ff(mask_buf, draw_area_w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
_lv_blend_fill(clip, &fill_area, color, mask_buf + buf_ofs, mask_res, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area, color, mask_buf, mask_res, opa, blend_mode);
|
||||
}
|
||||
fill_area.y1++;
|
||||
fill_area.y2++;
|
||||
|
||||
@@ -132,8 +132,8 @@ bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
|
||||
/* For touchpad sometimes users don't the last pressed coordinate on release.
|
||||
* So be sure a coordinates are initialized to the last point */
|
||||
if(indev->driver.type == LV_INDEV_TYPE_POINTER) {
|
||||
data->point.x = indev->proc.types.pointer.act_point.x;
|
||||
data->point.y = indev->proc.types.pointer.act_point.y;
|
||||
data->point.x = indev->proc.types.pointer.last_raw_point.x;
|
||||
data->point.y = indev->proc.types.pointer.last_raw_point.y;
|
||||
}
|
||||
/*Similarly set at least the last key in case of the user doesn't set it on release*/
|
||||
else if(indev->driver.type == LV_INDEV_TYPE_KEYPAD) {
|
||||
|
||||
@@ -131,6 +131,7 @@ typedef struct _lv_indev_proc_t {
|
||||
/*Pointer and button data*/
|
||||
lv_point_t act_point; /**< Current point of input device. */
|
||||
lv_point_t last_point; /**< Last point of input device. */
|
||||
lv_point_t last_raw_point; /**< Last point read from read_cb. */
|
||||
lv_point_t vect; /**< Difference between `act_point` and `last_point`. */
|
||||
lv_point_t drag_sum; /*Count the dragged pixels to check LV_INDEV_DEF_DRAG_LIMIT*/
|
||||
lv_point_t drag_throw_vect;
|
||||
|
||||
@@ -105,7 +105,7 @@ void lv_anim_start(lv_anim_t * a)
|
||||
a->time_orig = a->time;
|
||||
a->run_round = anim_run_round;
|
||||
_lv_memcpy(new_anim, a, sizeof(lv_anim_t));
|
||||
|
||||
if(a->var == a) new_anim->var = new_anim;
|
||||
/*Set the start value*/
|
||||
if(new_anim->early_apply) {
|
||||
if(new_anim->exec_cb && new_anim->var) new_anim->exec_cb(new_anim->var, new_anim->start);
|
||||
@@ -437,8 +437,9 @@ static void anim_task(lv_task_t * param)
|
||||
|
||||
/*The animation will run now for the first time. Call `start_cb`*/
|
||||
int32_t new_act_time = a->act_time + elaps;
|
||||
if(a->act_time <= 0 && new_act_time >= 0) {
|
||||
if(!a->start_cb_called && a->act_time <= 0 && new_act_time >= 0) {
|
||||
if(a->start_cb) a->start_cb(a);
|
||||
a->start_cb_called = 1;
|
||||
}
|
||||
a->act_time += elaps;
|
||||
if(a->act_time >= 0) {
|
||||
|
||||
@@ -95,6 +95,7 @@ typedef struct _lv_anim_t {
|
||||
/*Animation system use these - user shouldn't set*/
|
||||
uint8_t playback_now : 1; /**< Play back is in progress*/
|
||||
uint8_t run_round : 1; /**< Indicates the animation has run in this round*/
|
||||
uint8_t start_cb_called : 1; /**< Indicates that `start_cb` was already called`*/
|
||||
uint32_t time_orig;
|
||||
} lv_anim_t;
|
||||
|
||||
|
||||
@@ -352,7 +352,6 @@ static void clear_styles(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_TILEVIEW:
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -85,6 +85,10 @@ typedef struct {
|
||||
lv_style_t arc_knob;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LINE
|
||||
lv_style_t line;
|
||||
#endif
|
||||
|
||||
#if LV_USE_BAR
|
||||
lv_style_t bar_bg;
|
||||
lv_style_t bar_indic;
|
||||
@@ -206,9 +210,10 @@ static void basic_init(void)
|
||||
lv_style_set_bg_opa(&styles->bg, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&styles->bg, LV_STATE_DEFAULT, COLOR_BG);
|
||||
lv_style_set_border_color(&styles->bg, LV_STATE_DEFAULT, COLOR_BG_BORDER);
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0)lv_style_set_border_color(&styles->bg, LV_STATE_FOCUSED,
|
||||
theme.color_primary);
|
||||
lv_style_set_border_color(&styles->bg, LV_STATE_EDITED, theme.color_secondary);
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_border_color(&styles->bg, LV_STATE_FOCUSED, theme.color_primary);
|
||||
lv_style_set_border_color(&styles->bg, LV_STATE_EDITED, theme.color_secondary);
|
||||
}
|
||||
lv_style_set_border_width(&styles->bg, LV_STATE_DEFAULT, BORDER_WIDTH);
|
||||
lv_style_set_border_post(&styles->bg, LV_STATE_DEFAULT, true);
|
||||
lv_style_set_text_color(&styles->bg, LV_STATE_DEFAULT, COLOR_BG_TEXT);
|
||||
@@ -240,8 +245,11 @@ static void basic_init(void)
|
||||
lv_style_set_bg_color(&styles->bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_PR_CHK);
|
||||
lv_style_set_bg_color(&styles->bg_click, LV_STATE_DISABLED, COLOR_BG_DIS);
|
||||
lv_style_set_border_width(&styles->bg_click, LV_STATE_CHECKED, 0);
|
||||
lv_style_set_border_color(&styles->bg_click, LV_STATE_FOCUSED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary,
|
||||
LV_OPA_20));
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_border_color(&styles->bg_click, LV_STATE_FOCUSED | LV_STATE_PRESSED,
|
||||
lv_color_darken(theme.color_primary, LV_OPA_20));
|
||||
}
|
||||
|
||||
lv_style_set_border_color(&styles->bg_click, LV_STATE_PRESSED, COLOR_BG_BORDER_PR);
|
||||
lv_style_set_border_color(&styles->bg_click, LV_STATE_CHECKED, COLOR_BG_BORDER_CHK);
|
||||
lv_style_set_border_color(&styles->bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_BORDER_CHK_PR);
|
||||
@@ -296,9 +304,11 @@ static void basic_init(void)
|
||||
lv_style_set_pad_inner(&styles->btn, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_outline_width(&styles->btn, LV_STATE_DEFAULT, OUTLINE_WIDTH);
|
||||
lv_style_set_outline_opa(&styles->btn, LV_STATE_DEFAULT, LV_OPA_0);
|
||||
lv_style_set_outline_opa(&styles->btn, LV_STATE_FOCUSED, LV_OPA_50);
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_outline_opa(&styles->btn, LV_STATE_FOCUSED, LV_OPA_50);
|
||||
lv_style_set_outline_color(&styles->btn, LV_STATE_EDITED, theme.color_secondary);
|
||||
}
|
||||
lv_style_set_outline_color(&styles->btn, LV_STATE_DEFAULT, theme.color_primary);
|
||||
lv_style_set_outline_color(&styles->btn, LV_STATE_EDITED, theme.color_secondary);
|
||||
lv_style_set_transition_time(&styles->btn, LV_STATE_DEFAULT, TRANSITION_TIME);
|
||||
lv_style_set_transition_prop_4(&styles->btn, LV_STATE_DEFAULT, LV_STYLE_BORDER_OPA);
|
||||
lv_style_set_transition_prop_5(&styles->btn, LV_STATE_DEFAULT, LV_STYLE_BG_COLOR);
|
||||
@@ -352,7 +362,9 @@ static void bar_init(void)
|
||||
lv_style_set_outline_color(&styles->bar_bg, LV_STATE_DEFAULT, theme.color_primary);
|
||||
lv_style_set_outline_color(&styles->bar_bg, LV_STATE_EDITED, theme.color_secondary);
|
||||
lv_style_set_outline_opa(&styles->bar_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
||||
lv_style_set_outline_opa(&styles->bar_bg, LV_STATE_FOCUSED, LV_OPA_50);
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_outline_opa(&styles->bar_bg, LV_STATE_FOCUSED, LV_OPA_50);
|
||||
}
|
||||
lv_style_set_outline_width(&styles->bar_bg, LV_STATE_DEFAULT, OUTLINE_WIDTH);
|
||||
lv_style_set_transition_time(&styles->bar_bg, LV_STATE_DEFAULT, TRANSITION_TIME);
|
||||
lv_style_set_transition_prop_6(&styles->bar_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
|
||||
@@ -376,6 +388,8 @@ static void img_init(void)
|
||||
static void line_init(void)
|
||||
{
|
||||
#if LV_USE_LINE != 0
|
||||
lv_style_reset(&styles->line);
|
||||
lv_style_set_line_width(&styles->line, LV_STATE_DEFAULT, 1);
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -564,9 +578,11 @@ static void calendar_init(void)
|
||||
lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_DISABLED, LV_COLOR_GRAY);
|
||||
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_CHECKED, IS_LIGHT ? LV_OPA_20 : LV_OPA_40);
|
||||
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_PRESSED, LV_OPA_20);
|
||||
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_OPA_COVER);
|
||||
lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_COLOR_WHITE);
|
||||
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, theme.color_primary);
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_OPA_COVER);
|
||||
lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_COLOR_WHITE);
|
||||
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, theme.color_primary);
|
||||
}
|
||||
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_DEFAULT,
|
||||
IS_LIGHT ? lv_color_hex(0x666666) : LV_COLOR_WHITE);
|
||||
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_CHECKED, theme.color_primary);
|
||||
@@ -596,8 +612,10 @@ static void cpicker_init(void)
|
||||
lv_style_set_bg_opa(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_style_set_border_width(&styles->cpicker_indic, LV_STATE_DEFAULT, 2);
|
||||
lv_style_set_border_color(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_COLOR_GRAY);
|
||||
lv_style_set_border_color(&styles->cpicker_indic, LV_STATE_FOCUSED, theme.color_primary);
|
||||
lv_style_set_border_color(&styles->cpicker_indic, LV_STATE_EDITED, theme.color_secondary);
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_border_color(&styles->cpicker_indic, LV_STATE_FOCUSED, theme.color_primary);
|
||||
lv_style_set_border_color(&styles->cpicker_indic, LV_STATE_EDITED, theme.color_secondary);
|
||||
}
|
||||
lv_style_set_pad_left(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
|
||||
lv_style_set_pad_right(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
|
||||
lv_style_set_pad_top(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
|
||||
@@ -613,14 +631,18 @@ static void checkbox_init(void)
|
||||
lv_style_set_pad_inner(&styles->cb_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_outline_color(&styles->cb_bg, LV_STATE_DEFAULT, theme.color_primary);
|
||||
lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
||||
lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_FOCUSED, LV_OPA_50);
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_FOCUSED, LV_OPA_50);
|
||||
}
|
||||
lv_style_set_outline_width(&styles->cb_bg, LV_STATE_DEFAULT, OUTLINE_WIDTH);
|
||||
lv_style_set_outline_pad(&styles->cb_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_transition_time(&styles->cb_bg, LV_STATE_DEFAULT, TRANSITION_TIME);
|
||||
lv_style_set_transition_prop_6(&styles->cb_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
|
||||
|
||||
lv_style_reset(&styles->cb_bullet);
|
||||
lv_style_set_outline_opa(&styles->cb_bullet, LV_STATE_FOCUSED, LV_OPA_TRANSP);
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_outline_opa(&styles->cb_bullet, LV_STATE_FOCUSED, LV_OPA_TRANSP);
|
||||
}
|
||||
lv_style_set_radius(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(4));
|
||||
lv_style_set_pattern_image(&styles->cb_bullet, LV_STATE_CHECKED, LV_SYMBOL_OK);
|
||||
lv_style_set_pattern_recolor(&styles->cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE);
|
||||
@@ -647,7 +669,9 @@ static void keyboard_init(void)
|
||||
lv_style_set_border_width(&styles->kb_bg, LV_STATE_DEFAULT, LV_DPX(4));
|
||||
lv_style_set_border_side(&styles->kb_bg, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP);
|
||||
lv_style_set_border_color(&styles->kb_bg, LV_STATE_DEFAULT, IS_LIGHT ? COLOR_BG_TEXT : LV_COLOR_BLACK);
|
||||
lv_style_set_border_color(&styles->kb_bg, LV_STATE_EDITED, theme.color_secondary);
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_border_color(&styles->kb_bg, LV_STATE_EDITED, theme.color_secondary);
|
||||
}
|
||||
lv_style_set_pad_left(&styles->kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_pad_right(&styles->kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_pad_top(&styles->kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
@@ -743,13 +767,15 @@ static void list_init(void)
|
||||
|
||||
lv_style_set_border_side(&styles->list_btn, LV_STATE_DEFAULT, LV_BORDER_SIDE_BOTTOM);
|
||||
lv_style_set_border_color(&styles->list_btn, LV_STATE_DEFAULT, COLOR_BG_BORDER);
|
||||
lv_style_set_border_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_primary);
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_border_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_primary);
|
||||
}
|
||||
lv_style_set_border_width(&styles->list_btn, LV_STATE_DEFAULT, 1);
|
||||
|
||||
lv_style_set_outline_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_secondary);
|
||||
lv_style_set_outline_width(&styles->list_btn, LV_STATE_FOCUSED, OUTLINE_WIDTH);
|
||||
lv_style_set_outline_pad(&styles->list_btn, LV_STATE_FOCUSED, -BORDER_WIDTH);
|
||||
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_outline_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_secondary);
|
||||
lv_style_set_outline_width(&styles->list_btn, LV_STATE_FOCUSED, OUTLINE_WIDTH);
|
||||
lv_style_set_outline_pad(&styles->list_btn, LV_STATE_FOCUSED, -BORDER_WIDTH);
|
||||
}
|
||||
lv_style_set_pad_left(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_right(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_top(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||
@@ -760,8 +786,9 @@ static void list_init(void)
|
||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_PRESSED, -BORDER_WIDTH);
|
||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_CHECKED, -BORDER_WIDTH);
|
||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_DISABLED, -BORDER_WIDTH);
|
||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_FOCUSED, - BORDER_WIDTH);
|
||||
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_FOCUSED, - BORDER_WIDTH);
|
||||
}
|
||||
lv_style_set_transition_time(&styles->list_btn, LV_STATE_DEFAULT, TRANSITION_TIME);
|
||||
lv_style_set_transition_prop_6(&styles->list_btn, LV_STATE_DEFAULT, LV_STYLE_BG_COLOR);
|
||||
lv_style_set_transition_prop_5(&styles->list_btn, LV_STATE_DEFAULT, LV_STYLE_TRANSFORM_WIDTH);
|
||||
@@ -849,13 +876,16 @@ static void tabview_win_shared_init(void)
|
||||
lv_style_set_text_color(&styles->tabview_btns, LV_STATE_CHECKED, COLOR_SCR_TEXT);
|
||||
lv_style_set_pad_top(&styles->tabview_btns, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_bottom(&styles->tabview_btns, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_text_color(&styles->tabview_btns, LV_STATE_FOCUSED, theme.color_primary);
|
||||
lv_style_set_text_color(&styles->tabview_btns, LV_STATE_EDITED, theme.color_secondary);
|
||||
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_text_color(&styles->tabview_btns, LV_STATE_FOCUSED, theme.color_primary);
|
||||
lv_style_set_text_color(&styles->tabview_btns, LV_STATE_EDITED, theme.color_secondary);
|
||||
}
|
||||
lv_style_reset(&styles->tabview_indic);
|
||||
lv_style_set_bg_opa(&styles->tabview_indic, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&styles->tabview_indic, LV_STATE_DEFAULT, theme.color_primary);
|
||||
lv_style_set_bg_color(&styles->tabview_indic, LV_STATE_EDITED, theme.color_secondary);
|
||||
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
|
||||
lv_style_set_bg_color(&styles->tabview_indic, LV_STATE_EDITED, theme.color_secondary);
|
||||
}
|
||||
lv_style_set_size(&styles->tabview_indic, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_radius(&styles->tabview_indic, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
|
||||
@@ -1052,6 +1082,8 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
#if LV_USE_LINE
|
||||
case LV_THEME_LINE:
|
||||
list = lv_obj_get_style_list(obj, LV_LINE_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->line);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -687,13 +687,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
#if LV_USE_SPINNER
|
||||
case LV_THEME_SPINNER:
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tick_line);
|
||||
_lv_style_list_add_style(list, &styles->arc_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->fg_color);
|
||||
_lv_style_list_add_style(list, &styles->tick_line);
|
||||
_lv_style_list_add_style(list, &styles->arc_indic);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -793,8 +790,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->sb);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -636,8 +636,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ lv_obj_t * lv_btnmatrix_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->map_p = NULL;
|
||||
ext->recolor = 0;
|
||||
ext->one_check = 0;
|
||||
ext->align = LV_LABEL_ALIGN_LEFT;
|
||||
lv_style_list_init(&ext->style_btn);
|
||||
ext->style_btn.ignore_trans = 1;
|
||||
|
||||
@@ -892,6 +893,7 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
|
||||
else if(indev_type == LV_INDEV_TYPE_KEYPAD || (indev_type == LV_INDEV_TYPE_ENCODER &&
|
||||
lv_group_get_editing(lv_obj_get_group(btnm)))) {
|
||||
ext->btn_id_pr = ext->btn_id_focused;
|
||||
ext->btn_id_act = ext->btn_id_focused;
|
||||
invalidate_button_area(btnm, ext->btn_id_focused);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_draw/lv_img_cache.h"
|
||||
#include "../lv_core/lv_refr.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
|
||||
@@ -1107,7 +1108,7 @@ static lv_res_t lv_canvas_signal(lv_obj_t * canvas, lv_signal_t sign, void * par
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
lv_img_cache_invalidate_src(lv_canvas_get_img(canvas));
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -80,6 +80,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
/*Initialize the allocated 'ext' */
|
||||
ext->lmeter.lvl_ofs = -1;
|
||||
ext->needle_count = 0;
|
||||
ext->values = NULL;
|
||||
ext->needle_colors = NULL;
|
||||
|
||||
@@ -112,7 +112,14 @@ static inline void lv_gauge_set_range(lv_obj_t * gauge, int32_t min, int32_t max
|
||||
*/
|
||||
static inline void lv_gauge_set_critical_value(lv_obj_t * gauge, int32_t value)
|
||||
{
|
||||
lv_linemeter_set_value(gauge, value - 1);
|
||||
lv_linemeter_ext_t * ext = (lv_linemeter_ext_t *)lv_obj_get_ext_attr(gauge);
|
||||
if(value > lv_linemeter_get_max_value(gauge)) {
|
||||
ext->lvl_ofs = 1;
|
||||
}
|
||||
else {
|
||||
ext->lvl_ofs = -1;
|
||||
}
|
||||
lv_linemeter_set_value(gauge, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -261,8 +261,6 @@ void lv_img_set_offset_x(lv_obj_t * img, lv_coord_t x)
|
||||
|
||||
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
|
||||
|
||||
x = x % ext->w;
|
||||
|
||||
ext->offset.x = x;
|
||||
lv_obj_invalidate(img);
|
||||
}
|
||||
@@ -279,8 +277,6 @@ void lv_img_set_offset_y(lv_obj_t * img, lv_coord_t y)
|
||||
|
||||
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
|
||||
|
||||
y = y % ext->h;
|
||||
|
||||
ext->offset.y = y;
|
||||
lv_obj_invalidate(img);
|
||||
}
|
||||
@@ -683,8 +679,10 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area
|
||||
lv_area_t zoomed_coords;
|
||||
lv_obj_get_coords(img, &zoomed_coords);
|
||||
|
||||
zoomed_coords.x1 += (int32_t)((int32_t)ext->offset.x * zoom_final) >> 8;
|
||||
zoomed_coords.y1 += (int32_t)((int32_t)ext->offset.y * zoom_final) >> 8;
|
||||
int32_t offset_x = (int32_t)ext->offset.x % ext->w;
|
||||
int32_t offset_y = (int32_t)ext->offset.y % ext->h;
|
||||
zoomed_coords.x1 += (int32_t)(offset_x * zoom_final) >> 8;
|
||||
zoomed_coords.y1 += (int32_t)(offset_y * zoom_final) >> 8;
|
||||
zoomed_coords.x2 = zoomed_coords.x1 + ((int32_t)((int32_t)(obj_w - 1) * zoom_final) >> 8);
|
||||
zoomed_coords.y2 = zoomed_coords.y1 + ((int32_t)((int32_t)(obj_h - 1) * zoom_final) >> 8);
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ lv_obj_t * lv_linemeter_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->scale_angle = 240;
|
||||
ext->angle_ofs = 0;
|
||||
ext->mirrored = 0;
|
||||
ext->lvl_ofs = 0;
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_cb(linemeter, lv_linemeter_signal);
|
||||
@@ -446,7 +447,8 @@ void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uin
|
||||
p1.y = y_out_extra;
|
||||
|
||||
/* Set the color of the lines */
|
||||
if((!ext->mirrored && i > level) || (ext->mirrored && i < level)) {
|
||||
if(ext->cur_value == ext->min_value || (!ext->mirrored && i > level + ext->lvl_ofs) || (ext->mirrored &&
|
||||
i <= level + ext->lvl_ofs)) {
|
||||
line_dsc.color = end_color;
|
||||
line_dsc.width = end_line_width;
|
||||
}
|
||||
@@ -465,12 +467,12 @@ void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uin
|
||||
lv_draw_mask_remove_id(mask_out_id);
|
||||
#endif
|
||||
|
||||
if(part == LV_LINEMETER_PART_MAIN && level + 1 < ext->line_cnt - 1) {
|
||||
if(part == LV_LINEMETER_PART_MAIN && level < ext->line_cnt - 1) {
|
||||
lv_style_int_t border_width = lv_obj_get_style_scale_border_width(lmeter, part);
|
||||
lv_style_int_t end_border_width = lv_obj_get_style_scale_end_border_width(lmeter, part);
|
||||
|
||||
if(border_width || end_border_width) {
|
||||
int16_t end_angle = ((level + 1) * ext->scale_angle) / (ext->line_cnt - 1) + angle_ofs;
|
||||
int16_t end_angle = (level * ext->scale_angle) / (ext->line_cnt - 1) + angle_ofs;
|
||||
lv_draw_line_dsc_t arc_dsc;
|
||||
lv_draw_line_dsc_init(&arc_dsc);
|
||||
lv_obj_init_draw_line_dsc(lmeter, part, &arc_dsc);
|
||||
|
||||
@@ -33,6 +33,7 @@ typedef struct {
|
||||
uint16_t scale_angle; /*Angle of the scale in deg. (0..360)*/
|
||||
uint16_t angle_ofs;
|
||||
uint16_t line_cnt; /*Count of lines */
|
||||
int16_t lvl_ofs;
|
||||
int32_t cur_value;
|
||||
int32_t min_value;
|
||||
int32_t max_value;
|
||||
|
||||
@@ -829,7 +829,10 @@ static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * para
|
||||
lv_obj_t * list = lv_obj_get_parent(lv_obj_get_parent(btn));
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
lv_obj_t * sel = lv_list_get_btn_selected(list);
|
||||
if(sel == btn) lv_list_focus_btn(list, lv_list_get_next_btn(list, btn));
|
||||
if(sel == btn) {
|
||||
ext->act_sel_btn = NULL;
|
||||
lv_list_focus_btn(list, lv_list_get_next_btn(list, btn));
|
||||
}
|
||||
if(ext->last_sel_btn == btn) ext->last_sel_btn = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -58,7 +58,9 @@ typedef struct {
|
||||
enum {
|
||||
LV_LIST_PART_BG = LV_PAGE_PART_BG, /**< List background style */
|
||||
LV_LIST_PART_SCROLLBAR = LV_PAGE_PART_SCROLLBAR, /**< List scrollbar style. */
|
||||
#if LV_USE_ANIMATION
|
||||
LV_LIST_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, /**< List edge flash style. */
|
||||
#endif
|
||||
_LV_LIST_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST,
|
||||
LV_LIST_PART_SCROLLABLE = LV_PAGE_PART_SCROLLABLE, /**< List scrollable area style. */
|
||||
_LV_LIST_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST,
|
||||
|
||||
@@ -86,7 +86,9 @@ typedef struct {
|
||||
enum {
|
||||
LV_PAGE_PART_BG = LV_CONT_PART_MAIN,
|
||||
LV_PAGE_PART_SCROLLBAR = _LV_OBJ_PART_VIRTUAL_LAST,
|
||||
#if LV_USE_ANIMATION
|
||||
LV_PAGE_PART_EDGE_FLASH,
|
||||
#endif
|
||||
_LV_PAGE_PART_VIRTUAL_LAST,
|
||||
|
||||
LV_PAGE_PART_SCROLLABLE = _LV_OBJ_PART_REAL_LAST,
|
||||
|
||||
@@ -481,7 +481,7 @@ static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * cli
|
||||
label); /*Proportional position from the middle line (upscaled)*/
|
||||
|
||||
/*Apply a correction with different line heights*/
|
||||
const lv_font_t * normal_label_font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
|
||||
const lv_font_t * normal_label_font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_SELECTED);
|
||||
lv_coord_t corr = (label_dsc.font->line_height - normal_label_font->line_height) / 2;
|
||||
|
||||
/*Apply the proportional position to the selected text*/
|
||||
|
||||
@@ -310,6 +310,15 @@ void lv_table_set_row_cnt(lv_obj_t * table, uint16_t row_cnt)
|
||||
}
|
||||
|
||||
if(ext->row_cnt > 0 && ext->col_cnt > 0) {
|
||||
/*Free the unused cells*/
|
||||
if(old_row_cnt > row_cnt) {
|
||||
uint16_t old_cell_cnt = old_row_cnt * ext->col_cnt;
|
||||
uint32_t new_cell_cnt = ext->col_cnt * ext->row_cnt;
|
||||
uint32_t i;
|
||||
for(i = new_cell_cnt; i < old_cell_cnt; i++) {
|
||||
lv_mem_free(ext->cell_data[i]);
|
||||
}
|
||||
}
|
||||
ext->cell_data = lv_mem_realloc(ext->cell_data, ext->row_cnt * ext->col_cnt * sizeof(char *));
|
||||
LV_ASSERT_MEM(ext->cell_data);
|
||||
if(ext->cell_data == NULL) return;
|
||||
@@ -320,6 +329,7 @@ void lv_table_set_row_cnt(lv_obj_t * table, uint16_t row_cnt)
|
||||
uint32_t new_cell_cnt = ext->col_cnt * ext->row_cnt;
|
||||
_lv_memset_00(&ext->cell_data[old_cell_cnt], (new_cell_cnt - old_cell_cnt) * sizeof(ext->cell_data[0]));
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
lv_mem_free(ext->cell_data);
|
||||
@@ -348,6 +358,16 @@ void lv_table_set_col_cnt(lv_obj_t * table, uint16_t col_cnt)
|
||||
ext->col_cnt = col_cnt;
|
||||
|
||||
if(ext->row_cnt > 0 && ext->col_cnt > 0) {
|
||||
/*Free the unused cells*/
|
||||
if(old_col_cnt > col_cnt) {
|
||||
uint16_t old_cell_cnt = old_col_cnt * ext->row_cnt;
|
||||
uint32_t new_cell_cnt = ext->col_cnt * ext->row_cnt;
|
||||
uint32_t i;
|
||||
for(i = new_cell_cnt; i < old_cell_cnt; i++) {
|
||||
lv_mem_free(ext->cell_data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
ext->cell_data = lv_mem_realloc(ext->cell_data, ext->row_cnt * ext->col_cnt * sizeof(char *));
|
||||
LV_ASSERT_MEM(ext->cell_data);
|
||||
if(ext->cell_data == NULL) return;
|
||||
@@ -358,7 +378,6 @@ void lv_table_set_col_cnt(lv_obj_t * table, uint16_t col_cnt)
|
||||
uint32_t new_cell_cnt = ext->col_cnt * ext->row_cnt;
|
||||
_lv_memset_00(&ext->cell_data[old_cell_cnt], (new_cell_cnt - old_cell_cnt) * sizeof(ext->cell_data[0]));
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
lv_mem_free(ext->cell_data);
|
||||
|
||||
@@ -628,7 +628,16 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
uint8_t i;
|
||||
for(i = 0; ext->tab_name_ptr[i][0] != '\0' && ext->tab_name_ptr[i][0] != '\n'; i++) lv_mem_free(ext->tab_name_ptr[i]);
|
||||
if(ext->btns_pos == LV_TABVIEW_TAB_POS_LEFT || ext->btns_pos == LV_TABVIEW_TAB_POS_RIGHT) {
|
||||
for(i = 0; i < ext->tab_cnt; i++) {
|
||||
lv_mem_free(ext->tab_name_ptr[i * 2]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(i = 0; i < ext->tab_cnt; i++) {
|
||||
lv_mem_free(ext->tab_name_ptr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
lv_mem_free(ext->tab_name_ptr);
|
||||
ext->tab_name_ptr = NULL;
|
||||
|
||||
@@ -1430,6 +1430,7 @@ static lv_res_t lv_textarea_signal(lv_obj_t * ta, lv_signal_t sign, void * param
|
||||
if(ext->label) {
|
||||
if(ext->one_line) {
|
||||
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG);
|
||||
lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_BG);
|
||||
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_BG);
|
||||
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
|
||||
|
||||
@@ -1437,6 +1438,7 @@ static lv_res_t lv_textarea_signal(lv_obj_t * ta, lv_signal_t sign, void * param
|
||||
lv_coord_t font_h = lv_font_get_line_height(font);
|
||||
lv_obj_set_height(ext->label, font_h);
|
||||
lv_obj_set_height(ta, font_h + top + bottom);
|
||||
lv_obj_set_pos(lv_page_get_scrollable(ta), left, top);
|
||||
}
|
||||
else {
|
||||
/*In not one line mode refresh the Label width because 'hpad' can modify it*/
|
||||
|
||||
@@ -79,7 +79,9 @@ typedef struct {
|
||||
enum {
|
||||
LV_TEXTAREA_PART_BG = LV_PAGE_PART_BG, /**< Text area background style */
|
||||
LV_TEXTAREA_PART_SCROLLBAR = LV_PAGE_PART_SCROLLBAR, /**< Scrollbar style */
|
||||
#if LV_USE_ANIMATION
|
||||
LV_TEXTAREA_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, /**< Edge flash style */
|
||||
#endif
|
||||
LV_TEXTAREA_PART_CURSOR = _LV_PAGE_PART_VIRTUAL_LAST, /**< Cursor style */
|
||||
LV_TEXTAREA_PART_PLACEHOLDER, /**< Placeholder style */
|
||||
_LV_TEXTAREA_PART_VIRTUAL_LAST,
|
||||
|
||||
@@ -47,7 +47,9 @@ typedef struct {
|
||||
enum {
|
||||
LV_TILEVIEW_PART_BG = LV_PAGE_PART_BG,
|
||||
LV_TILEVIEW_PART_SCROLLBAR = LV_PAGE_PART_SCROLLBAR,
|
||||
#if LV_USE_ANIMATION
|
||||
LV_TILEVIEW_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH,
|
||||
#endif
|
||||
_LV_TILEVIEW_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST,
|
||||
_LV_TILEVIEW_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user