Compare commits
56 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e66f19e5ce | ||
|
|
8ed224fd63 | ||
|
|
998ad66c84 | ||
|
|
83c55c2a64 | ||
|
|
6ed420e043 | ||
|
|
de44f74522 | ||
|
|
ed5f91ab72 | ||
|
|
e5f58151ac | ||
|
|
26ab373b43 | ||
|
|
3dbee9b584 | ||
|
|
56a48e0173 | ||
|
|
aba10b0170 | ||
|
|
f0c52b3511 | ||
|
|
6dd1884228 | ||
|
|
20d56ee6e9 | ||
|
|
196bcb9b0e | ||
|
|
cee779a56d | ||
|
|
07b6d93de4 | ||
|
|
091174069d | ||
|
|
43ed3eb1f4 | ||
|
|
c4d978fa6f | ||
|
|
0ca874bc49 | ||
|
|
3d22dc5722 | ||
|
|
62d21734d9 | ||
|
|
cd69be12d1 | ||
|
|
1b83855c72 | ||
|
|
243145d8c9 | ||
|
|
cb021a425a | ||
|
|
b0fecc6bb2 | ||
|
|
4e177e01ea | ||
|
|
2bf91dbbb5 | ||
|
|
aac672e88b | ||
|
|
93d7bd4cf5 | ||
|
|
57c2201386 | ||
|
|
9e72cb0000 | ||
|
|
0ea6bcd40c | ||
|
|
9b579f3fad | ||
|
|
417e32b4df | ||
|
|
0a7f6a6331 | ||
|
|
b04dea5971 | ||
|
|
e90ce9d4b7 | ||
|
|
5fc66822b9 | ||
|
|
e2d7fa4477 | ||
|
|
b565a69c76 | ||
|
|
861f07bb77 | ||
|
|
6d4de78756 | ||
|
|
a905be4f90 | ||
|
|
99bb4cb8f1 | ||
|
|
03d2d10f17 | ||
|
|
b80f1dbf14 | ||
|
|
b9aff01102 | ||
|
|
ba5ee315e9 | ||
|
|
568c2ee688 | ||
|
|
2aad9aaebd | ||
|
|
4f6fb723ef | ||
|
|
2c0ca03319 |
8
.github/pull_request_template.md
vendored
Normal file
8
.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
### Description of the feature or fix
|
||||
|
||||
A clear and concise description of what the bug or new feature is.
|
||||
|
||||
### Checkpoints
|
||||
- [ ] Follow the [styling guide](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md)
|
||||
- [ ] Update CHANGELOG.md
|
||||
- [ ] Update the documentation
|
||||
28
CHANGELOG.md
28
CHANGELOG.md
@@ -1,6 +1,32 @@
|
||||
# Changelog
|
||||
|
||||
## v7.8.0 (Planned to 01.12.2020)
|
||||
## v7.9.0 (Plann1d at 05.01.2020
|
||||
|
||||
### New features
|
||||
- feat(chart) add lv_chart_remove_series and lv_chart_hide_series
|
||||
- feat(img_cahce) allow disabling image cacheing
|
||||
- calendar: make get_day_of_week() public
|
||||
- Added support for Zephyr integration
|
||||
|
||||
### Bugfixes
|
||||
- fix(draw_rect) free buffer used for arabic processing
|
||||
- fix(win) arabic process the title of the window
|
||||
- fix(dropdown) arabic process the option in lv_dropdown_add_option
|
||||
- fix(textarea) buffer overflow in password mode with UTF-8 characters
|
||||
- fix(textarea) cursor position after hiding character in password mode
|
||||
- fix(linemeter) draw critical lines with correct color
|
||||
- fix(kconfig) handle disable sprintf float correctly.
|
||||
- fix(layout) stop layout after recursion threshold is reached
|
||||
- fix(gauge) fix redraw with image needle
|
||||
|
||||
|
||||
## v7.8.1
|
||||
|
||||
### Bugfixes
|
||||
- fix(lv_scr_load_anim) fix when multiple screen are loaded at tsame time with delay
|
||||
- fix(page) fix LV_SCOLLBAR_MODE_DRAG
|
||||
|
||||
## v7.8.0 (01.12.2020)
|
||||
|
||||
### New features
|
||||
- make DMA2D non blocking
|
||||
|
||||
@@ -3,15 +3,62 @@ if(ESP_PLATFORM)
|
||||
file(GLOB_RECURSE SOURCES src/*.c)
|
||||
|
||||
idf_component_register(SRCS ${SOURCES}
|
||||
INCLUDE_DIRS . src)
|
||||
INCLUDE_DIRS . src
|
||||
REQUIRES main)
|
||||
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_CONF_INCLUDE_SIMPLE")
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_CONF_SKIP")
|
||||
|
||||
if (CONFIG_LV_MEM_CUSTOM)
|
||||
if (CONFIG_LV_MEM_CUSTOM_ALLOC)
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_MEM_CUSTOM_ALLOC=${CONFIG_LV_MEM_CUSTOM_ALLOC}")
|
||||
endif()
|
||||
|
||||
if (CONFIG_LV_MEM_CUSTOM_FREE)
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_MEM_CUSTOM_FREE=${CONFIG_LV_MEM_CUSTOM_FREE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CONFIG_LV_TICK_CUSTOM)
|
||||
if (CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR)
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_TICK_CUSTOM_SYS_TIME_EXPR=${CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CONFIG_LV_USER_DATA_FREE)
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_USER_DATA_FREE=${CONFIG_LV_USER_DATA_FREE}")
|
||||
endif()
|
||||
|
||||
if (CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM)
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_ATTRIBUTE_FAST_MEM=IRAM_ATTR")
|
||||
endif()
|
||||
|
||||
elseif(ZEPHYR_BASE)
|
||||
|
||||
if(CONFIG_LVGL)
|
||||
|
||||
zephyr_include_directories(${ZEPHYR_BASE}/lib/gui/lvgl)
|
||||
|
||||
target_include_directories(lvgl INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
zephyr_compile_definitions(LV_CONF_KCONFIG_EXTERNAL_INCLUDE=<autoconf.h>)
|
||||
|
||||
zephyr_compile_definitions_ifdef(CONFIG_LV_MEM_CUSTOM
|
||||
LV_MEM_CUSTOM_ALLOC=${CONFIG_LV_MEM_CUSTOM_ALLOC}
|
||||
)
|
||||
zephyr_compile_definitions_ifdef(CONFIG_LV_MEM_CUSTOM
|
||||
LV_MEM_CUSTOM_FREE=${CONFIG_LV_MEM_CUSTOM_FREE}
|
||||
)
|
||||
zephyr_compile_definitions_ifdef(CONFIG_LV_TICK_CUSTOM
|
||||
LV_TICK_CUSTOM_SYS_TIME_EXPR=${CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR}
|
||||
)
|
||||
|
||||
zephyr_library()
|
||||
|
||||
file(GLOB_RECURSE SOURCES src/*.c)
|
||||
zephyr_library_sources(${SOURCES})
|
||||
|
||||
endif() # CONFIG_LVGL
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown platform.")
|
||||
endif()
|
||||
|
||||
64
Kconfig
64
Kconfig
@@ -1,4 +1,4 @@
|
||||
# Kconfig file for LVGL v7.7.1
|
||||
# Kconfig file for LVGL v7.8.1
|
||||
|
||||
menu "LVGL configuration"
|
||||
|
||||
@@ -105,11 +105,38 @@ menu "LVGL configuration"
|
||||
displays.
|
||||
|
||||
menu "Memory manager settings"
|
||||
config LV_MEM_CUSTOM
|
||||
bool
|
||||
prompt "If true use custom malloc/free, otherwise use the built-in `lv_mem_alloc` and `lv_mem_free`"
|
||||
|
||||
config LV_MEM_CUSTOM_INCLUDE
|
||||
string
|
||||
prompt "Header to include for the custom memory function"
|
||||
default "stdlib.h"
|
||||
depends on LV_MEM_CUSTOM
|
||||
|
||||
config LV_MEM_CUSTOM_ALLOC
|
||||
string
|
||||
prompt "Wrapper to malloc"
|
||||
default "malloc"
|
||||
depends on LV_MEM_CUSTOM
|
||||
|
||||
config LV_MEM_CUSTOM_FREE
|
||||
string
|
||||
prompt "Wrapper to free"
|
||||
default "free"
|
||||
depends on LV_MEM_CUSTOM
|
||||
|
||||
config LV_MEM_SIZE_BYTES
|
||||
int
|
||||
prompt "Size of the memory used by `lv_mem_alloc` in kilobytes (>= 2kB)"
|
||||
range 2 128
|
||||
default 32
|
||||
default 32
|
||||
depends on !LV_MEM_CUSTOM
|
||||
|
||||
config LV_MEMCPY_MEMSET_STD
|
||||
bool
|
||||
prompt "Use the standard memcpy and memset instead of LVGL's own functions"
|
||||
endmenu
|
||||
|
||||
menu "Indev device settings"
|
||||
@@ -204,6 +231,17 @@ menu "LVGL configuration"
|
||||
default y if !LV_CONF_MINIMAL
|
||||
config LV_USE_USER_DATA
|
||||
bool "Add a 'user_data' to drivers and objects."
|
||||
config LV_USE_USER_DATA_FREE
|
||||
bool "Free the user data field upon object deletion"
|
||||
depends on LV_USE_USER_DATA
|
||||
config LV_USER_DATA_FREE_INCLUDE
|
||||
string "Header for user data free function"
|
||||
default "something.h"
|
||||
depends on LV_USE_USER_DATA_FREE
|
||||
config LV_USER_DATA_FREE
|
||||
string "Invoking for user data free function. It has the lv_obj_t pointer as single parameter."
|
||||
default "(user_data_free)"
|
||||
depends on LV_USE_USER_DATA_FREE
|
||||
config LV_USE_PERF_MONITOR
|
||||
bool "Show CPU usage and FPS count in the right bottom corner."
|
||||
config LV_USE_API_EXTENSION_V6
|
||||
@@ -235,11 +273,29 @@ menu "LVGL configuration"
|
||||
LV_IMG_CACHE_DEF_SIZE must be >= 1
|
||||
endmenu
|
||||
|
||||
menu "Compiler settings"
|
||||
menu "Compiler Settings"
|
||||
config LV_BIG_ENDIAN_SYSTEM
|
||||
bool "For big endian systems set to 1"
|
||||
endmenu
|
||||
|
||||
menu "HAL Settings"
|
||||
config LV_TICK_CUSTOM
|
||||
bool
|
||||
prompt "Use a custom tick source"
|
||||
|
||||
config LV_TICK_CUSTOM_INCLUDE
|
||||
string
|
||||
prompt "Header for the system time function"
|
||||
default "Arduino.h"
|
||||
depends on LV_TICK_CUSTOM
|
||||
|
||||
config LV_TICK_CUSTOM_SYS_TIME_EXPR
|
||||
string
|
||||
prompt "Expression evaluating to current system time in ms"
|
||||
default "millis()"
|
||||
depends on LV_TICK_CUSTOM
|
||||
endmenu
|
||||
|
||||
menu "Log Settings"
|
||||
config LV_USE_LOG
|
||||
bool "Enable the log module"
|
||||
@@ -856,7 +912,7 @@ menu "LVGL configuration"
|
||||
bool "Support bidirectional texts"
|
||||
help
|
||||
Allows mixing Left-to-Right and Right-to-Left texts.
|
||||
The direction will be processed according to the Unicode Bidirectioanl Algorithm:
|
||||
The direction will be processed according to the Unicode Bidirectional Algorithm:
|
||||
https://www.w3.org/International/articles/inline-bidi-markup/uba-basics
|
||||
|
||||
choice
|
||||
|
||||
@@ -27,14 +27,12 @@ Planned to November/December 2020
|
||||
- Simplified File system interface ([feat/new_fs_api](https://github.com/lvgl/lvgl/tree/feat/new-fs-api) branch) to make porting easier
|
||||
- Work in progress
|
||||
- Remove the align parameter from `lv_canvas_draw_text`
|
||||
- Remove the copy paramter from create functions
|
||||
- Style selectors and style-based states See [#1832](https://github.com/lvgl/lvgl/issues/1832)
|
||||
- Add Object Orianted system [#1919](https://github.com/lvgl/lvgl/issues/1919)
|
||||
|
||||
## v8.1
|
||||
- Add radio button widget
|
||||
- Make the copy paramter obsolate in create functions
|
||||
- Optimize and simplifie styles [#1832](https://github.com/lvgl/lvgl/issues/1832)
|
||||
- Use a more generic inheritenace [#1919](https://github.com/lvgl/lvgl/issues/1919)
|
||||
|
||||
## v8.x
|
||||
- Add radio button widget
|
||||
- Unit testing (gtest?). See [#1658](https://github.com/lvgl/lvgl/issues/1658)
|
||||
- Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660)
|
||||
|
||||
@@ -47,10 +45,8 @@ Planned to November/December 2020
|
||||
- Handle stride. See [#1858](https://github.com/lvgl/lvgl/issues/1858)
|
||||
- Make gradients more versatile
|
||||
- Make image transformations more versatile
|
||||
- Allow snapshoting object to tranfrom them as images
|
||||
- Allow snapshoting object to tranfrom them to images
|
||||
|
||||
## v10
|
||||
- Remove property level states
|
||||
|
||||
|
||||
## Ideas
|
||||
|
||||
@@ -325,9 +325,9 @@ static lv_fs_res_t fs_free (lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * fr
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a 'fs_read_dir_t' variable for directory reading
|
||||
* Initialize a 'lv_fs_dir_t' variable for directory reading
|
||||
* @param drv pointer to a driver where this function belongs
|
||||
* @param rddir_p pointer to a 'fs_read_dir_t' variable
|
||||
* @param rddir_p pointer to a 'lv_fs_dir_t' variable
|
||||
* @param path path to a directory
|
||||
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
|
||||
*/
|
||||
@@ -344,7 +344,7 @@ static lv_fs_res_t fs_dir_open (lv_fs_drv_t * drv, void * rddir_p, const char *p
|
||||
* Read the next filename form a directory.
|
||||
* The name of the directories will begin with '/'
|
||||
* @param drv pointer to a driver where this function belongs
|
||||
* @param rddir_p pointer to an initialized 'fs_read_dir_t' variable
|
||||
* @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable
|
||||
* @param fn pointer to a buffer to store the filename
|
||||
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
|
||||
*/
|
||||
@@ -360,7 +360,7 @@ static lv_fs_res_t fs_dir_read (lv_fs_drv_t * drv, void * rddir_p, char *fn)
|
||||
/**
|
||||
* Close the directory reading
|
||||
* @param drv pointer to a driver where this function belongs
|
||||
* @param rddir_p pointer to an initialized 'fs_read_dir_t' variable
|
||||
* @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable
|
||||
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
|
||||
*/
|
||||
static lv_fs_res_t fs_dir_close (lv_fs_drv_t * drv, void * rddir_p)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lvgl",
|
||||
"version": "7.8.0",
|
||||
"version": "7.9.0",
|
||||
"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.8.0
|
||||
version=7.9.0
|
||||
author=kisvegabor
|
||||
maintainer=kisvegabor,embeddedt,pete-pjb
|
||||
sentence=Full-featured Graphics Library for Embedded Systems
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file lv_conf.h
|
||||
* Configuration file for v7.8.0-dev
|
||||
* Configuration file for v7.9.0
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -82,7 +82,7 @@ typedef int16_t lv_coord_t;
|
||||
/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
|
||||
# define LV_MEM_SIZE (32U * 1024U)
|
||||
|
||||
/* Complier prefix for a big array declaration */
|
||||
/* Compiler prefix for a big array declaration */
|
||||
# define LV_MEM_ATTR
|
||||
|
||||
/* Set an address for the memory pool instead of allocating it as an array.
|
||||
@@ -127,7 +127,7 @@ typedef int16_t lv_coord_t;
|
||||
#define LV_INDEV_DEF_DRAG_THROW 10
|
||||
|
||||
/* Long press time in milliseconds.
|
||||
* Time to send `LV_EVENT_LONG_PRESSSED`) */
|
||||
* Time to send `LV_EVENT_LONG_PRESSED`) */
|
||||
#define LV_INDEV_DEF_LONG_PRESS_TIME 400
|
||||
|
||||
/* Repeated trigger period in long press [ms]
|
||||
@@ -240,7 +240,7 @@ typedef void * lv_fs_drv_user_data_t;
|
||||
* (I.e. no new image decoder is added)
|
||||
* With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
|
||||
* However the opened images might consume additional RAM.
|
||||
* LV_IMG_CACHE_DEF_SIZE must be >= 1 */
|
||||
* Set it to 0 to disable caching */
|
||||
#define LV_IMG_CACHE_DEF_SIZE 1
|
||||
|
||||
/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/
|
||||
@@ -514,7 +514,7 @@ typedef void * lv_font_user_data_t;
|
||||
|
||||
/* Support bidirectional texts.
|
||||
* Allows mixing Left-to-Right and Right-to-Left texts.
|
||||
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
|
||||
* The direction will be processed according to the Unicode Bidirectional Algorithm:
|
||||
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
|
||||
#define LV_USE_BIDI 0
|
||||
#if LV_USE_BIDI
|
||||
|
||||
2
lvgl.h
2
lvgl.h
@@ -15,7 +15,7 @@ extern "C" {
|
||||
* CURRENT VERSION OF LVGL
|
||||
***************************/
|
||||
#define LVGL_VERSION_MAJOR 7
|
||||
#define LVGL_VERSION_MINOR 8
|
||||
#define LVGL_VERSION_MINOR 9
|
||||
#define LVGL_VERSION_PATCH 0
|
||||
#define LVGL_VERSION_INFO ""
|
||||
|
||||
|
||||
@@ -93,14 +93,13 @@ for i in fin.read().splitlines():
|
||||
|
||||
if r:
|
||||
line = re.sub('\(.*?\)', '', r[1], 1) #remove parentheses from macros
|
||||
|
||||
dr = re.sub('.*# *define', '', i, 1)
|
||||
d = "# define " + dr
|
||||
|
||||
|
||||
fout.write(
|
||||
f'#ifndef {line}\n'
|
||||
f'# ifdef CONFIG_{line}\n'
|
||||
f'# define {line} CONFIG_{line}\n'
|
||||
f'# ifdef CONFIG_{line.upper()}\n'
|
||||
f'# define {line} CONFIG_{line.upper()}\n'
|
||||
f'# else\n'
|
||||
f'{d}\n'
|
||||
f'# endif\n'
|
||||
|
||||
@@ -85,10 +85,10 @@ def update_version(ver):
|
||||
|
||||
templ = fnmatch.filter(os.listdir('.'), '*_templ*.h')
|
||||
|
||||
if len(templ) > 0 and templ[0]:
|
||||
if len(templ) > 0 and templ[0]:
|
||||
print("Updating version in " + templ[0])
|
||||
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ "v" + ver_num + "/' " + templ[0])
|
||||
|
||||
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/"+ "v" + ver_num + "/' " + templ[0])
|
||||
|
||||
if os.path.exists("library.json"):
|
||||
print("Updating version in library.json")
|
||||
cmd("sed -i -r 's/[0-9]+\.[0-9]+\.[0-9]+/"+ ver_num +"/' library.json")
|
||||
@@ -100,6 +100,9 @@ def update_version(ver):
|
||||
if path.exists("conf.py"):
|
||||
cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" conf.py")
|
||||
|
||||
if path.exists("Kconfig"):
|
||||
cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" Kconfig")
|
||||
|
||||
if path.exists("lvgl.h"):
|
||||
define_set("./lvgl.h", "LVGL_VERSION_MAJOR", str(ver[0]))
|
||||
define_set("./lvgl.h", "LVGL_VERSION_MINOR", str(ver[1]))
|
||||
|
||||
@@ -55,7 +55,7 @@ if __name__ == '__main__':
|
||||
print("Invalid argument. Usage ./release.py bugfix | minor | major")
|
||||
exit(1)
|
||||
|
||||
os.chdir(workdir)
|
||||
#os.chdir(workdir)
|
||||
clone_repos()
|
||||
release.make()
|
||||
for p in proj_list:
|
||||
|
||||
@@ -188,7 +188,7 @@ static inline lv_obj_t * lv_page_get_scrl(lv_obj_t * page)
|
||||
#if LV_USE_API_EXTENSION_V7
|
||||
|
||||
#if LV_USE_ROLLER
|
||||
#define LV_ROLLER_MODE_INFINITE LV_ROLLER_MODE_INIFINITE
|
||||
#define LV_ROLLER_MODE_INIFINITE LV_ROLLER_MODE_INFINITE
|
||||
#endif
|
||||
|
||||
#if LV_USE_WIN
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Complier prefix for a big array declaration */
|
||||
/* Compiler prefix for a big array declaration */
|
||||
#ifndef LV_MEM_ATTR
|
||||
# ifdef CONFIG_LV_MEM_ATTR
|
||||
# define LV_MEM_ATTR CONFIG_LV_MEM_ATTR
|
||||
@@ -330,7 +330,7 @@
|
||||
#endif
|
||||
|
||||
/* Long press time in milliseconds.
|
||||
* Time to send `LV_EVENT_LONG_PRESSSED`) */
|
||||
* Time to send `LV_EVENT_LONG_PRESSED`) */
|
||||
#ifndef LV_INDEV_DEF_LONG_PRESS_TIME
|
||||
# ifdef CONFIG_LV_INDEV_DEF_LONG_PRESS_TIME
|
||||
# define LV_INDEV_DEF_LONG_PRESS_TIME CONFIG_LV_INDEV_DEF_LONG_PRESS_TIME
|
||||
@@ -602,7 +602,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
* (I.e. no new image decoder is added)
|
||||
* With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
|
||||
* However the opened images might consume additional RAM.
|
||||
* LV_IMG_CACHE_DEF_SIZE must be >= 1 */
|
||||
* Set it to 0 to disable caching */
|
||||
#ifndef LV_IMG_CACHE_DEF_SIZE
|
||||
# ifdef CONFIG_LV_IMG_CACHE_DEF_SIZE
|
||||
# define LV_IMG_CACHE_DEF_SIZE CONFIG_LV_IMG_CACHE_DEF_SIZE
|
||||
@@ -1322,7 +1322,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
|
||||
/* Support bidirectional texts.
|
||||
* Allows mixing Left-to-Right and Right-to-Left texts.
|
||||
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
|
||||
* The direction will be processed according to the Unicode Bidirectional Algorithm:
|
||||
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
|
||||
#ifndef LV_USE_BIDI
|
||||
# ifdef CONFIG_LV_USE_BIDI
|
||||
@@ -1373,15 +1373,15 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
# endif
|
||||
#endif
|
||||
#ifndef lv_snprintf
|
||||
# ifdef CONFIG_lv_snprintf
|
||||
# define lv_snprintf CONFIG_lv_snprintf
|
||||
# ifdef CONFIG_LV_SNPRINTF
|
||||
# define lv_snprintf CONFIG_LV_SNPRINTF
|
||||
# else
|
||||
# define lv_snprintf snprintf
|
||||
# endif
|
||||
#endif
|
||||
#ifndef lv_vsnprintf
|
||||
# ifdef CONFIG_lv_vsnprintf
|
||||
# define lv_vsnprintf CONFIG_lv_vsnprintf
|
||||
# ifdef CONFIG_LV_VSNPRINTF
|
||||
# define lv_vsnprintf CONFIG_LV_VSNPRINTF
|
||||
# else
|
||||
# define lv_vsnprintf vsnprintf
|
||||
# endif
|
||||
|
||||
@@ -400,6 +400,20 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*------------------
|
||||
* SPRINTF DISABLE FLOAT
|
||||
*-----------------*/
|
||||
|
||||
#if defined(CONFIG_LV_CONF_SKIP) || defined(LV_CONF_SKIP)
|
||||
# ifndef LV_SPRINTF_DISABLE_FLOAT
|
||||
# ifndef CONFIG_LV_SPRINTF_DISABLE_FLOAT
|
||||
# define LV_SPRINTF_DISABLE_FLOAT 0
|
||||
# else
|
||||
# define LV_SPRINTF_DISABLE_FLOAT 1
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifdef __ZEPHYR__
|
||||
|
||||
#include <autoconf.h>
|
||||
|
||||
#define LV_MEM_CUSTOM 1
|
||||
|
||||
#define LV_MEMCPY_MEMSET_STD 1
|
||||
|
||||
#ifdef CONFIG_LVGL_MEM_POOL_HEAP_KERNEL
|
||||
|
||||
#define LV_MEM_CUSTOM_INCLUDE "kernel.h"
|
||||
#define LV_MEM_CUSTOM_ALLOC k_malloc
|
||||
#define LV_MEM_CUTOM_FREE k_free
|
||||
|
||||
#elif defined(CONFIG_LVGL_MEM_POOL_HEAP_LIB_C)
|
||||
|
||||
#define LV_MEM_CUSTOM_INCLUDE "stdlib.h"
|
||||
#define LV_MEM_CUSTOM_ALLOC malloc
|
||||
#define LV_MEM_CUTOM_FREE free
|
||||
|
||||
#else
|
||||
|
||||
#define LV_MEM_CUSTOM_INCLUDE "lvgl_mem.h"
|
||||
#define LV_MEM_CUSTOM_ALLOC lvgl_malloc
|
||||
#define LV_MEM_CUTOM_FREE lvgl_free
|
||||
|
||||
#endif
|
||||
|
||||
#define LV_ENABLE_GC 0
|
||||
|
||||
#define LV_TICK_CUSTOM 1
|
||||
#define LV_TICK_CUSTOM_INCLUDE "kernel.h"
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (k_uptime_get_32())
|
||||
|
||||
#define LV_SPRINTF_CUSTOM 1
|
||||
|
||||
#if LV_SPRINTF_CUSTOM
|
||||
#define LV_SPRINTF_INCLUDE "stdio.h"
|
||||
#define lv_snprintf snprintf
|
||||
#define lv_vsnprintf vsnprintf
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -214,6 +214,20 @@ void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa)
|
||||
void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del)
|
||||
{
|
||||
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);
|
||||
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);
|
||||
|
||||
act_scr = d->scr_to_load;
|
||||
}
|
||||
|
||||
d->scr_to_load = new_scr;
|
||||
|
||||
if(d->prev_scr && d->del_prev) {
|
||||
lv_obj_del(d->prev_scr);
|
||||
@@ -396,13 +410,13 @@ static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v)
|
||||
lv_obj_set_style_local_opa_scale(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v);
|
||||
}
|
||||
|
||||
|
||||
static void scr_anim_ready(lv_anim_t * a)
|
||||
{
|
||||
lv_disp_t * d = lv_obj_get_disp(a->var);
|
||||
|
||||
if(d->prev_scr && d->del_prev) lv_obj_del(d->prev_scr);
|
||||
d->prev_scr = NULL;
|
||||
d->scr_to_load = NULL;
|
||||
lv_style_remove_prop(lv_obj_get_local_style(a->var, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -225,4 +225,4 @@ static inline lv_coord_t lv_dpx(lv_coord_t n)
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_TEMPL_H*/
|
||||
#endif /*LV_DISP_H*/
|
||||
|
||||
@@ -541,7 +541,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
lv_group_focus_prev(g);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
/*Just send other keys again to the object (e.g. 'A' or `LV_GORUP_KEY_RIGHT)*/
|
||||
/*Just send other keys again to the object (e.g. 'A' or `LV_GROUP_KEY_RIGHT)*/
|
||||
else {
|
||||
lv_group_send_data(g, data->key);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
@@ -834,7 +834,7 @@ static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the pressed state of LV_INDEV_TYPE_POINER input devices
|
||||
* Process the pressed state of LV_INDEV_TYPE_POINTER input devices
|
||||
* @param indev pointer to an input device 'proc'
|
||||
* @return LV_RES_OK: no indev reset required; LV_RES_INV: indev reset is required
|
||||
*/
|
||||
@@ -1004,7 +1004,7 @@ static void indev_proc_press(lv_indev_proc_t * proc)
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the released state of LV_INDEV_TYPE_POINER input devices
|
||||
* Process the released state of LV_INDEV_TYPE_POINTER input devices
|
||||
* @param proc pointer to an input device 'proc'
|
||||
*/
|
||||
static void indev_proc_release(lv_indev_proc_t * proc)
|
||||
|
||||
@@ -105,7 +105,7 @@ typedef struct {
|
||||
lv_color_t scale_grad_color;
|
||||
lv_color_t scale_end_color;
|
||||
lv_opa_t opa_scale;
|
||||
uint32_t clip_corder : 1;
|
||||
uint32_t clip_corner : 1;
|
||||
uint32_t border_post : 1;
|
||||
} style_snapshot_t;
|
||||
|
||||
@@ -221,8 +221,9 @@ void lv_init(void)
|
||||
_lv_indev_init();
|
||||
|
||||
_lv_img_decoder_init();
|
||||
#if LV_IMG_CACHE_DEF_SIZE
|
||||
lv_img_cache_set_size(LV_IMG_CACHE_DEF_SIZE);
|
||||
|
||||
#endif
|
||||
/*Test if the IDE has UTF-8 encoding*/
|
||||
char * txt = "Á";
|
||||
|
||||
@@ -590,7 +591,7 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
|
||||
{
|
||||
if(lv_obj_get_hidden(obj)) return false;
|
||||
|
||||
/*Invalidate the object only if it belongs to the curent or previous'*/
|
||||
/*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) ||
|
||||
@@ -1476,7 +1477,7 @@ void lv_obj_report_style_mod(lv_style_t * style)
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable the use of style cahche for an object
|
||||
* Enable/disable the use of style cache for an object
|
||||
* @param obj pointer to an object
|
||||
* @param dis true: disable; false: enable (re-enable)
|
||||
*/
|
||||
@@ -1656,7 +1657,8 @@ void lv_obj_set_parent_event(lv_obj_t * obj, bool en)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the base direction of the object
|
||||
* Set the base direction of the object.
|
||||
* @note This only works if LV_USE_BIDI is enabled.
|
||||
* @param obj pointer to an object
|
||||
* @param dir the new base direction. `LV_BIDI_DIR_LTR/RTL/AUTO/INHERIT`
|
||||
*/
|
||||
@@ -4309,7 +4311,7 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
lv_style_list_t * style_list = lv_obj_get_style_list(obj, part);
|
||||
lv_style_t * style_trans = _lv_style_list_get_transition_style(style_list);
|
||||
|
||||
bool cahche_ori = style_list->ignore_cache;
|
||||
bool cache_ori = style_list->ignore_cache;
|
||||
|
||||
/*Get the previous and current values*/
|
||||
if((prop & 0xF) < LV_STYLE_ID_COLOR) { /*Int*/
|
||||
@@ -4320,7 +4322,7 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
obj->state = new_state;
|
||||
lv_style_int_t int2 = _lv_obj_get_style_int(obj, part, prop);
|
||||
style_list->skip_trans = 0;
|
||||
style_list->ignore_cache = cahche_ori;
|
||||
style_list->ignore_cache = cache_ori;
|
||||
|
||||
if(int1 == int2) return NULL;
|
||||
obj->state = prev_state;
|
||||
@@ -4351,7 +4353,7 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
obj->state = new_state;
|
||||
lv_color_t c2 = _lv_obj_get_style_color(obj, part, prop);
|
||||
style_list->skip_trans = 0;
|
||||
style_list->ignore_cache = cahche_ori;
|
||||
style_list->ignore_cache = cache_ori;
|
||||
|
||||
if(c1.full == c2.full) return NULL;
|
||||
obj->state = prev_state;
|
||||
@@ -4373,7 +4375,7 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
obj->state = new_state;
|
||||
lv_opa_t o2 = _lv_obj_get_style_opa(obj, part, prop);
|
||||
style_list->skip_trans = 0;
|
||||
style_list->ignore_cache = cahche_ori;
|
||||
style_list->ignore_cache = cache_ori;
|
||||
|
||||
if(o1 == o2) return NULL;
|
||||
|
||||
@@ -4396,7 +4398,7 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
obj->state = new_state;
|
||||
const void * p2 = _lv_obj_get_style_ptr(obj, part, prop);
|
||||
style_list->skip_trans = 0;
|
||||
style_list->ignore_cache = cahche_ori;
|
||||
style_list->ignore_cache = cache_ori;
|
||||
|
||||
if(memcmp(&p1, &p2, sizeof(const void *)) == 0) return NULL;
|
||||
obj->state = prev_state;
|
||||
@@ -4819,7 +4821,7 @@ static void style_snapshot(lv_obj_t * obj, uint8_t part, style_snapshot_t * shot
|
||||
shot->scale_grad_color = lv_obj_get_style_scale_grad_color(obj, part);
|
||||
shot->scale_end_color = lv_obj_get_style_scale_end_color(obj, part);
|
||||
shot->opa_scale = lv_obj_get_style_opa_scale(obj, part);
|
||||
shot->clip_corder = lv_obj_get_style_clip_corner(obj, part);
|
||||
shot->clip_corner = lv_obj_get_style_clip_corner(obj, part);
|
||||
shot->border_post = lv_obj_get_style_border_post(obj, part);
|
||||
|
||||
_lv_obj_disable_style_caching(obj, false);
|
||||
|
||||
@@ -775,6 +775,7 @@ void lv_obj_set_parent_event(lv_obj_t * obj, bool en);
|
||||
|
||||
/**
|
||||
* Set the base direction of the object
|
||||
* @note This only works if LV_USE_BIDI is enabled.
|
||||
* @param obj pointer to an object
|
||||
* @param dir the new base direction. `LV_BIDI_DIR_LTR/RTL/AUTO/INHERIT`
|
||||
*/
|
||||
|
||||
@@ -44,7 +44,7 @@ static inline size_t get_prop_size(uint8_t prop_id);
|
||||
static inline size_t get_next_prop_index(uint8_t prop_id, size_t id);
|
||||
|
||||
/**********************
|
||||
* GLOABAL VARIABLES
|
||||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
@@ -340,7 +340,7 @@ uint16_t _lv_style_get_mem_size(const lv_style_t * style)
|
||||
|
||||
size_t i = 0;
|
||||
uint8_t prop_id;
|
||||
while((prop_id = get_style_prop_id(style, i)) != _LV_STYLE_CLOSEING_PROP) {
|
||||
while((prop_id = get_style_prop_id(style, i)) != _LV_STYLE_CLOSING_PROP) {
|
||||
i = get_next_prop_index(prop_id, i);
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_in
|
||||
|
||||
/*Add new property if not exists yet*/
|
||||
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(lv_style_int_t));
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSING_PROP;
|
||||
uint8_t end_mark_size = sizeof(end_mark);
|
||||
|
||||
uint16_t size = _lv_style_get_mem_size(style);
|
||||
@@ -424,7 +424,7 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
|
||||
|
||||
/*Add new property if not exists yet*/
|
||||
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(lv_color_t));
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSING_PROP;
|
||||
uint8_t end_mark_size = sizeof(end_mark);
|
||||
|
||||
uint16_t size = _lv_style_get_mem_size(style);
|
||||
@@ -471,7 +471,7 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
|
||||
|
||||
/*Add new property if not exists yet*/
|
||||
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(lv_opa_t));
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSING_PROP;
|
||||
uint8_t end_mark_size = sizeof(end_mark);
|
||||
|
||||
uint16_t size = _lv_style_get_mem_size(style);
|
||||
@@ -518,7 +518,7 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
|
||||
|
||||
/*Add new property if not exists yet*/
|
||||
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(const void *));
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSING_PROP;
|
||||
uint8_t end_mark_size = sizeof(end_mark);
|
||||
|
||||
uint16_t size = _lv_style_get_mem_size(style);
|
||||
@@ -1069,7 +1069,7 @@ LV_ATTRIBUTE_FAST_MEM static inline int32_t get_property_index(const lv_style_t
|
||||
size_t i = 0;
|
||||
|
||||
uint8_t prop_id;
|
||||
while((prop_id = get_style_prop_id(style, i)) != _LV_STYLE_CLOSEING_PROP) {
|
||||
while((prop_id = get_style_prop_id(style, i)) != _LV_STYLE_CLOSING_PROP) {
|
||||
if(prop_id == id_to_find) {
|
||||
lv_style_attr_t attr_i;
|
||||
attr_i = get_style_prop_attr(style, i);
|
||||
|
||||
@@ -39,7 +39,7 @@ LV_EXPORT_CONST_INT(LV_RADIUS_CIRCLE);
|
||||
#define LV_STYLE_ATTR_NONE 0
|
||||
#define LV_STYLE_ATTR_INHERIT (1 << 7)
|
||||
|
||||
#define _LV_STYLE_CLOSEING_PROP 0xFF
|
||||
#define _LV_STYLE_CLOSING_PROP 0xFF
|
||||
|
||||
#define LV_STYLE_TRANS_NUM_MAX 6
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ static void draw_quarter_0(quarter_draw_dsc_t * q);
|
||||
static void draw_quarter_1(quarter_draw_dsc_t * q);
|
||||
static void draw_quarter_2(quarter_draw_dsc_t * q);
|
||||
static void draw_quarter_3(quarter_draw_dsc_t * q);
|
||||
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t tickness, lv_area_t * res_area);
|
||||
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness, lv_area_t * res_area);
|
||||
|
||||
|
||||
/**********************
|
||||
@@ -386,13 +386,13 @@ static void draw_quarter_3(quarter_draw_dsc_t * q)
|
||||
}
|
||||
|
||||
|
||||
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t tickness, lv_area_t * res_area)
|
||||
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness, lv_area_t * res_area)
|
||||
{
|
||||
const uint8_t ps = 8;
|
||||
const uint8_t pa = 127;
|
||||
|
||||
int32_t thick_half = tickness / 2;
|
||||
uint8_t thick_corr = (tickness & 0x01) ? 0 : 1;
|
||||
int32_t thick_half = thickness / 2;
|
||||
uint8_t thick_corr = (thickness & 0x01) ? 0 : 1;
|
||||
|
||||
int32_t cir_x;
|
||||
int32_t cir_y;
|
||||
|
||||
@@ -40,6 +40,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
bool chroma_key, bool alpha_byte);
|
||||
|
||||
static void show_error(const lv_area_t * coords, const lv_area_t * clip_area, const char * msg);
|
||||
static void draw_cleanup(lv_img_cache_entry_t * cache);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -267,9 +268,10 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
lv_area_t mask_com; /*Common area of mask and coords*/
|
||||
bool union_ok;
|
||||
union_ok = _lv_area_intersect(&mask_com, clip_area, &map_area_rot);
|
||||
/*Out of mask. There is nothing to draw so the image is drawn successfully.*/
|
||||
if(union_ok == false) {
|
||||
return LV_RES_OK; /*Out of mask. There is nothing to draw so the image is drawn
|
||||
successfully.*/
|
||||
draw_cleanup(cdsc);
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
lv_draw_map(coords, &mask_com, cdsc->dec_dsc.img_data, draw_dsc, chroma_keyed, alpha_byte);
|
||||
@@ -279,9 +281,10 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
lv_area_t mask_com; /*Common area of mask and coords*/
|
||||
bool union_ok;
|
||||
union_ok = _lv_area_intersect(&mask_com, clip_area, coords);
|
||||
/*Out of mask. There is nothing to draw so the image is drawn successfully.*/
|
||||
if(union_ok == false) {
|
||||
return LV_RES_OK; /*Out of mask. There is nothing to draw so the image is drawn
|
||||
successfully.*/
|
||||
draw_cleanup(cdsc);
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
int32_t width = lv_area_get_width(&mask_com);
|
||||
@@ -306,6 +309,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
lv_img_decoder_close(&cdsc->dec_dsc);
|
||||
LV_LOG_WARN("Image draw can't read the line");
|
||||
_lv_mem_buf_release(buf);
|
||||
draw_cleanup(cdsc);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
@@ -318,6 +322,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
_lv_mem_buf_release(buf);
|
||||
}
|
||||
|
||||
draw_cleanup(cdsc);
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
@@ -649,3 +654,13 @@ static void show_error(const lv_area_t * coords, const lv_area_t * clip_area, co
|
||||
lv_draw_label(coords, clip_area, &label_dsc, msg, NULL);
|
||||
}
|
||||
|
||||
static void draw_cleanup(lv_img_cache_entry_t * cache)
|
||||
{
|
||||
/*Automatically close images with no caching*/
|
||||
#if LV_IMG_CACHE_DEF_SIZE == 0
|
||||
lv_img_decoder_close(&cache->dec_dsc);
|
||||
#else
|
||||
LV_UNUSED(cache);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -93,4 +93,4 @@ bool lv_img_cf_has_alpha(lv_img_cf_t cf);
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_TEMPL_H*/
|
||||
#endif /*LV_DRAW_IMG_H*/
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define SHADOW_UPSACALE_SHIFT 6
|
||||
#define SHADOW_UPSCALE_SHIFT 6
|
||||
#define SHADOW_ENHANCE 1
|
||||
#define SPLIT_LIMIT 50
|
||||
|
||||
@@ -1029,10 +1029,10 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
|
||||
}
|
||||
else {
|
||||
int32_t i;
|
||||
sh_ups_tmp_buf[0] = (mask_line[0] << SHADOW_UPSACALE_SHIFT) / sw;
|
||||
sh_ups_tmp_buf[0] = (mask_line[0] << SHADOW_UPSCALE_SHIFT) / sw;
|
||||
for(i = 1; i < size; i++) {
|
||||
if(mask_line[i] == mask_line[i - 1]) sh_ups_tmp_buf[i] = sh_ups_tmp_buf[i - 1];
|
||||
else sh_ups_tmp_buf[i] = (mask_line[i] << SHADOW_UPSACALE_SHIFT) / sw;
|
||||
else sh_ups_tmp_buf[i] = (mask_line[i] << SHADOW_UPSCALE_SHIFT) / sw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1044,7 +1044,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
|
||||
int32_t i;
|
||||
lv_opa_t * res_buf = (lv_opa_t *)sh_buf;
|
||||
for(i = 0; i < size * size; i++) {
|
||||
res_buf[i] = (sh_buf[i] >> SHADOW_UPSACALE_SHIFT);
|
||||
res_buf[i] = (sh_buf[i] >> SHADOW_UPSCALE_SHIFT);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1062,10 +1062,10 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
|
||||
sw += sw_ori & 1;
|
||||
if(sw > 1) {
|
||||
uint32_t i;
|
||||
sh_buf[0] = (sh_buf[0] << SHADOW_UPSACALE_SHIFT) / sw;
|
||||
sh_buf[0] = (sh_buf[0] << SHADOW_UPSCALE_SHIFT) / sw;
|
||||
for(i = 1; i < (uint32_t) size * size; i++) {
|
||||
if(sh_buf[i] == sh_buf[i - 1]) sh_buf[i] = sh_buf[i - 1];
|
||||
else sh_buf[i] = (sh_buf[i] << SHADOW_UPSACALE_SHIFT) / sw;
|
||||
else sh_buf[i] = (sh_buf[i] << SHADOW_UPSCALE_SHIFT) / sw;
|
||||
}
|
||||
|
||||
shadow_blur_corner(size, sw, sh_buf);
|
||||
@@ -1125,7 +1125,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t
|
||||
sh_ups_tmp_buf = &sh_ups_buf[x];
|
||||
int32_t v = sh_ups_tmp_buf[0] * sw;
|
||||
for(y = 0; y < size ; y++, sh_ups_tmp_buf += size) {
|
||||
sh_ups_blur_buf[y] = v < 0 ? 0 : (v >> SHADOW_UPSACALE_SHIFT);
|
||||
sh_ups_blur_buf[y] = v < 0 ? 0 : (v >> SHADOW_UPSCALE_SHIFT);
|
||||
|
||||
/*Forget the top pixel*/
|
||||
uint32_t top_val;
|
||||
@@ -1331,6 +1331,10 @@ static void draw_value_str(const lv_area_t * coords, const lv_area_t * clip, con
|
||||
label_dsc.opa = dsc->value_opa;
|
||||
|
||||
lv_draw_label(&value_area, clip, &label_dsc, str, NULL);
|
||||
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS
|
||||
_lv_mem_buf_release(str);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -423,14 +423,14 @@ void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
|
||||
dsc->tmp.pivot_y_256 = dsc->cfg.pivot_y * 256;
|
||||
|
||||
int32_t angle_low = dsc->cfg.angle / 10;
|
||||
int32_t angle_hight = angle_low + 1;
|
||||
int32_t angle_high = angle_low + 1;
|
||||
int32_t angle_rem = dsc->cfg.angle - (angle_low * 10);
|
||||
|
||||
int32_t s1 = _lv_trigo_sin(-angle_low);
|
||||
int32_t s2 = _lv_trigo_sin(-angle_hight);
|
||||
int32_t s2 = _lv_trigo_sin(-angle_high);
|
||||
|
||||
int32_t c1 = _lv_trigo_sin(-angle_low + 90);
|
||||
int32_t c2 = _lv_trigo_sin(-angle_hight + 90);
|
||||
int32_t c2 = _lv_trigo_sin(-angle_high + 90);
|
||||
|
||||
dsc->tmp.sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10;
|
||||
dsc->tmp.cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10;
|
||||
@@ -500,14 +500,14 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
|
||||
}
|
||||
|
||||
int32_t angle_low = angle / 10;
|
||||
int32_t angle_hight = angle_low + 1;
|
||||
int32_t angle_high = angle_low + 1;
|
||||
int32_t angle_rem = angle - (angle_low * 10);
|
||||
|
||||
int32_t s1 = _lv_trigo_sin(angle_low);
|
||||
int32_t s2 = _lv_trigo_sin(angle_hight);
|
||||
int32_t s2 = _lv_trigo_sin(angle_high);
|
||||
|
||||
int32_t c1 = _lv_trigo_sin(angle_low + 90);
|
||||
int32_t c2 = _lv_trigo_sin(angle_hight + 90);
|
||||
int32_t c2 = _lv_trigo_sin(angle_high + 90);
|
||||
|
||||
int32_t sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10;
|
||||
int32_t cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
/*Decrement life with this value in every open*/
|
||||
/*Decrement life with this value on every open*/
|
||||
#define LV_IMG_CACHE_AGING 1
|
||||
|
||||
/*Boost life by this factor (multiply time_to_open with this value)*/
|
||||
@@ -29,10 +29,6 @@
|
||||
* "die" from very high values */
|
||||
#define LV_IMG_CACHE_LIFE_LIMIT 1000
|
||||
|
||||
#if LV_IMG_CACHE_DEF_SIZE < 1
|
||||
#error "LV_IMG_CACHE_DEF_SIZE must be >= 1. See lv_conf.h"
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
@@ -40,11 +36,16 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
#if LV_IMG_CACHE_DEF_SIZE == 0
|
||||
static lv_img_cache_entry_t cache_temp;
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static uint16_t entry_cnt;
|
||||
#if LV_IMG_CACHE_DEF_SIZE
|
||||
static uint16_t entry_cnt;
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -64,6 +65,10 @@ static uint16_t entry_cnt;
|
||||
*/
|
||||
lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color)
|
||||
{
|
||||
/*Is the image cached?*/
|
||||
lv_img_cache_entry_t * cached_src = NULL;
|
||||
|
||||
#if LV_IMG_CACHE_DEF_SIZE
|
||||
if(entry_cnt == 0) {
|
||||
LV_LOG_WARN("lv_img_cache_open: the cache size is 0");
|
||||
return NULL;
|
||||
@@ -79,8 +84,6 @@ lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color)
|
||||
}
|
||||
}
|
||||
|
||||
/*Is the image cached?*/
|
||||
lv_img_cache_entry_t * cached_src = NULL;
|
||||
for(i = 0; i < entry_cnt; i++) {
|
||||
bool match = false;
|
||||
lv_img_src_t src_type = lv_img_src_get_type(cache[i].dec_dsc.src);
|
||||
@@ -104,48 +107,51 @@ lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color)
|
||||
}
|
||||
|
||||
/*The image is not cached then cache it now*/
|
||||
if(cached_src == NULL) {
|
||||
/*Find an entry to reuse. Select the entry with the least life*/
|
||||
cached_src = &cache[0];
|
||||
for(i = 1; i < entry_cnt; i++) {
|
||||
if(cache[i].life < cached_src->life) {
|
||||
cached_src = &cache[i];
|
||||
}
|
||||
}
|
||||
if(cached_src) return cached_src;
|
||||
|
||||
/*Close the decoder to reuse if it was opened (has a valid source)*/
|
||||
if(cached_src->dec_dsc.src) {
|
||||
lv_img_decoder_close(&cached_src->dec_dsc);
|
||||
LV_LOG_INFO("image draw: cache miss, close and reuse an entry");
|
||||
/*Find an entry to reuse. Select the entry with the least life*/
|
||||
cached_src = &cache[0];
|
||||
for(i = 1; i < entry_cnt; i++) {
|
||||
if(cache[i].life < cached_src->life) {
|
||||
cached_src = &cache[i];
|
||||
}
|
||||
else {
|
||||
LV_LOG_INFO("image draw: cache miss, cached to an empty entry");
|
||||
}
|
||||
|
||||
/*Open the image and measure the time to open*/
|
||||
uint32_t t_start;
|
||||
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, color);
|
||||
if(open_res == LV_RES_INV) {
|
||||
LV_LOG_WARN("Image draw cannot open the image resource");
|
||||
lv_img_decoder_close(&cached_src->dec_dsc);
|
||||
_lv_memset_00(&cached_src->dec_dsc, sizeof(lv_img_decoder_dsc_t));
|
||||
_lv_memset_00(cached_src, sizeof(lv_img_cache_entry_t));
|
||||
cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its use */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cached_src->life = 0;
|
||||
|
||||
/*If `time_to_open` was not set in the open function set it here*/
|
||||
if(cached_src->dec_dsc.time_to_open == 0) {
|
||||
cached_src->dec_dsc.time_to_open = lv_tick_elaps(t_start);
|
||||
}
|
||||
|
||||
if(cached_src->dec_dsc.time_to_open == 0) cached_src->dec_dsc.time_to_open = 1;
|
||||
}
|
||||
|
||||
/*Close the decoder to reuse if it was opened (has a valid source)*/
|
||||
if(cached_src->dec_dsc.src) {
|
||||
lv_img_decoder_close(&cached_src->dec_dsc);
|
||||
LV_LOG_INFO("image draw: cache miss, close and reuse an entry");
|
||||
}
|
||||
else {
|
||||
LV_LOG_INFO("image draw: cache miss, cached to an empty entry");
|
||||
}
|
||||
|
||||
#else
|
||||
cached_src = &cache_temp;
|
||||
#endif
|
||||
/*Open the image and measure the time to open*/
|
||||
uint32_t t_start;
|
||||
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, color);
|
||||
if(open_res == LV_RES_INV) {
|
||||
LV_LOG_WARN("Image draw cannot open the image resource");
|
||||
lv_img_decoder_close(&cached_src->dec_dsc);
|
||||
_lv_memset_00(&cached_src->dec_dsc, sizeof(lv_img_decoder_dsc_t));
|
||||
_lv_memset_00(cached_src, sizeof(lv_img_cache_entry_t));
|
||||
cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its use */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cached_src->life = 0;
|
||||
|
||||
/*If `time_to_open` was not set in the open function set it here*/
|
||||
if(cached_src->dec_dsc.time_to_open == 0) {
|
||||
cached_src->dec_dsc.time_to_open = lv_tick_elaps(t_start);
|
||||
}
|
||||
|
||||
if(cached_src->dec_dsc.time_to_open == 0) cached_src->dec_dsc.time_to_open = 1;
|
||||
|
||||
return cached_src;
|
||||
}
|
||||
|
||||
@@ -157,6 +163,10 @@ lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color)
|
||||
*/
|
||||
void lv_img_cache_set_size(uint16_t new_entry_cnt)
|
||||
{
|
||||
#if LV_IMG_CACHE_DEF_SIZE == 0
|
||||
LV_UNUSED(new_entry_cnt);
|
||||
LV_LOG_WARN("Can't change cache size because it's disabled by LV_IMG_CACHE_DEF_SIZE = 0");
|
||||
#else
|
||||
if(LV_GC_ROOT(_lv_img_cache_array) != NULL) {
|
||||
/*Clean the cache before free it*/
|
||||
lv_img_cache_invalidate_src(NULL);
|
||||
@@ -178,6 +188,7 @@ void lv_img_cache_set_size(uint16_t new_entry_cnt)
|
||||
_lv_memset_00(&LV_GC_ROOT(_lv_img_cache_array)[i].dec_dsc, sizeof(lv_img_decoder_dsc_t));
|
||||
_lv_memset_00(&LV_GC_ROOT(_lv_img_cache_array)[i], sizeof(lv_img_cache_entry_t));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,7 +198,7 @@ void lv_img_cache_set_size(uint16_t new_entry_cnt)
|
||||
*/
|
||||
void lv_img_cache_invalidate_src(const void * src)
|
||||
{
|
||||
|
||||
#if LV_IMG_CACHE_DEF_SIZE
|
||||
lv_img_cache_entry_t * cache = LV_GC_ROOT(_lv_img_cache_array);
|
||||
|
||||
uint16_t i;
|
||||
@@ -201,6 +212,7 @@ void lv_img_cache_invalidate_src(const void * src)
|
||||
_lv_memset_00(&cache[i], sizeof(lv_img_cache_entry_t));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_IMG_DEOCER_H
|
||||
#define LV_IMG_DEOCER_H
|
||||
#ifndef LV_IMG_DECODER_H
|
||||
#define LV_IMG_DECODER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -267,4 +267,4 @@ void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_ds
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_TEMPL_H*/
|
||||
#endif /*LV_IMG_DECODER_H*/
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#define PXP_OUT_PIXEL_FORMAT kPXP_OutputPixelFormatRGB565
|
||||
#define PXP_AS_PIXEL_FORMAT kPXP_AsPixelFormatRGB565
|
||||
#define PXP_PS_PIXEL_FORMAT kPXP_PsPixelFormatRGB565
|
||||
#elif
|
||||
#else
|
||||
#error Only 16bit color depth is supported. Set LV_COLOR_DEPTH to 16.
|
||||
#endif
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
/** Enable logging of VG-Lite erors (\see LV_LOG_ERROR) */
|
||||
/** Enable logging of VG-Lite errors (\see LV_LOG_ERROR) */
|
||||
#define LV_GPU_NXP_VG_LITE_LOG_ERRORS 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -153,8 +153,11 @@ typedef struct _disp_t {
|
||||
|
||||
/** Screens of the display*/
|
||||
lv_ll_t scr_ll;
|
||||
struct _lv_obj_t * act_scr; /**< Currently active screen on this display */
|
||||
struct _lv_obj_t * prev_scr; /**< Previous screen. Used during screen animations */
|
||||
struct _lv_obj_t * act_scr; /**< Currently active screen on this display */
|
||||
struct _lv_obj_t * prev_scr; /**< Previous screen. Used during screen animations */
|
||||
#if LV_USE_ANIMATION
|
||||
struct _lv_obj_t * scr_to_load; /**< The screen prepared to load in lv_scr_load_anim*/
|
||||
#endif
|
||||
struct _lv_obj_t * top_layer; /**< @see lv_disp_get_layer_top */
|
||||
struct _lv_obj_t * sys_layer; /**< @see lv_disp_get_layer_sys */
|
||||
|
||||
|
||||
@@ -150,9 +150,9 @@ bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
|
||||
}
|
||||
|
||||
if(indev->driver.read_cb) {
|
||||
LV_LOG_TRACE("idnev read started");
|
||||
LV_LOG_TRACE("indev read started");
|
||||
cont = indev->driver.read_cb(&indev->driver, data);
|
||||
LV_LOG_TRACE("idnev read finished");
|
||||
LV_LOG_TRACE("indev read finished");
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("indev function registered");
|
||||
|
||||
@@ -59,4 +59,4 @@ lv_res_t lv_async_call(lv_async_cb_t async_xcb, void * user_data);
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_TEMPL_H*/
|
||||
#endif /*LV_ASYNC_H*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file lv_bifi.h
|
||||
* @file lv_bidi.h
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -348,8 +348,8 @@ lv_fs_res_t lv_fs_rename(const char * oldname, const char * newname)
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a 'fs_read_dir_t' variable for directory reading
|
||||
* @param rddir_p pointer to a 'fs_read_dir_t' variable
|
||||
* Initialize a 'lv_fs_dir_t' variable for directory reading
|
||||
* @param rddir_p pointer to a 'lv_fs_dir_t' variable
|
||||
* @param path path to a directory
|
||||
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
|
||||
*/
|
||||
@@ -387,7 +387,7 @@ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path)
|
||||
/**
|
||||
* Read the next filename form a directory.
|
||||
* The name of the directories will begin with '/'
|
||||
* @param rddir_p pointer to an initialized 'fs_read_dir_t' variable
|
||||
* @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable
|
||||
* @param fn pointer to a buffer to store the filename
|
||||
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
|
||||
*/
|
||||
@@ -409,7 +409,7 @@ lv_fs_res_t lv_fs_dir_read(lv_fs_dir_t * rddir_p, char * fn)
|
||||
|
||||
/**
|
||||
* Close the directory reading
|
||||
* @param rddir_p pointer to an initialized 'fs_read_dir_t' variable
|
||||
* @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable
|
||||
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
|
||||
*/
|
||||
lv_fs_res_t lv_fs_dir_close(lv_fs_dir_t * rddir_p)
|
||||
|
||||
@@ -221,7 +221,7 @@ lv_fs_res_t lv_fs_rename(const char * oldname, const char * newname);
|
||||
|
||||
/**
|
||||
* Initialize a 'fs_dir_t' variable for directory reading
|
||||
* @param rddir_p pointer to a 'fs_read_dir_t' variable
|
||||
* @param rddir_p pointer to a 'lv_fs_dir_t' variable
|
||||
* @param path path to a directory
|
||||
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
|
||||
*/
|
||||
@@ -230,7 +230,7 @@ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path);
|
||||
/**
|
||||
* Read the next filename form a directory.
|
||||
* The name of the directories will begin with '/'
|
||||
* @param rddir_p pointer to an initialized 'fs_rdir_t' variable
|
||||
* @param rddir_p pointer to an initialized 'fs_dir_t' variable
|
||||
* @param fn pointer to a buffer to store the filename
|
||||
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
|
||||
*/
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*********************/
|
||||
#include <stdarg.h>
|
||||
#include "lv_txt.h"
|
||||
#include "lv_txt_ap.h"
|
||||
#include "lv_math.h"
|
||||
#include "lv_log.h"
|
||||
#include "lv_debug.h"
|
||||
@@ -391,7 +392,7 @@ lv_coord_t _lv_txt_get_width(const char * txt, uint32_t length, const lv_font_t
|
||||
/**
|
||||
* Check next character in a string and decide if the character is part of the command or not
|
||||
* @param state pointer to a txt_cmd_state_t variable which stores the current state of command
|
||||
* processing (Initied. to TXT_CMD_STATE_WAIT )
|
||||
* processing (Inited to TXT_CMD_STATE_WAIT )
|
||||
* @param c the current character
|
||||
* @return true: the character is part of a command and should not be written,
|
||||
* false: the character should be written
|
||||
@@ -525,7 +526,7 @@ char * _lv_txt_set_text_vfmt(const char * fmt, va_list ap)
|
||||
|
||||
#if LV_TXT_ENC == LV_TXT_ENC_UTF8
|
||||
/*******************************
|
||||
* UTF-8 ENCODER/DECOER
|
||||
* UTF-8 ENCODER/DECODER
|
||||
******************************/
|
||||
|
||||
/**
|
||||
@@ -793,7 +794,7 @@ static uint8_t lv_txt_iso8859_1_size(const char * str)
|
||||
*/
|
||||
static uint32_t lv_txt_unicode_to_iso8859_1(uint32_t letter_uni)
|
||||
{
|
||||
if(letter_uni < 128)
|
||||
if(letter_uni < 256)
|
||||
return letter_uni;
|
||||
else
|
||||
return ' ';
|
||||
|
||||
@@ -16,6 +16,7 @@ extern "C" {
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
#include "lv_area.h"
|
||||
#include "lv_area.h"
|
||||
#include "../lv_font/lv_font.h"
|
||||
@@ -136,7 +137,7 @@ void _lv_txt_cut(char * txt, uint32_t pos, uint32_t len);
|
||||
char * _lv_txt_set_text_vfmt(const char * fmt, va_list ap);
|
||||
|
||||
/***************************************************************
|
||||
* GLOBAL FUNCTION POINTERS FOR CAHRACTER ENCODING INTERFACE
|
||||
* GLOBAL FUNCTION POINTERS FOR CHARACTER ENCODING INTERFACE
|
||||
***************************************************************/
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,7 +69,7 @@ const ap_chars_map_t ap_chars_map[] = {
|
||||
{36, 0xFEE6, 1, 2, -1, {1, 1}}, // ن
|
||||
{38, 0xFEEE, -1, 0, -1, {1, 0}}, // و
|
||||
{37, 0xFEEA, 1, 2, -1, {1, 1}}, // ه
|
||||
{39, 0xFBFD, 1, 2, -1, {1, 1}}, // ي
|
||||
{39, 0xFEF0, 0, 0, -1, {1, 0}}, // ى
|
||||
{40, 0xFEF2, 1, 2, -1, {1, 1}}, // ي
|
||||
{170, 0xFBFD, 1, 2, -1, {1, 1}}, // ی
|
||||
{7, 0xFE94, 1, 2, -1, {1, 0}}, // ة
|
||||
|
||||
@@ -337,7 +337,7 @@ static void clear_styles(lv_obj_t * obj, lv_theme_style_t name)
|
||||
#if LV_USE_TABVIEW
|
||||
case LV_THEME_TABVIEW:
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCROLLABLE);
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
|
||||
@@ -316,10 +316,10 @@ static void basic_init(void)
|
||||
style_init_reset(&styles->pad_inner);
|
||||
|
||||
lv_style_set_pad_inner(&styles->pad_inner, LV_STATE_DEFAULT,
|
||||
lv_disp_get_size_category(NULL) <= LV_DISP_MEDIUM_LIMIT ? LV_DPX(20) : LV_DPX(40));
|
||||
lv_disp_get_size_category(NULL) <= LV_DISP_SIZE_MEDIUM ? LV_DPX(20) : LV_DPX(40));
|
||||
|
||||
style_init_reset(&styles->pad_small);
|
||||
lv_style_int_t pad_small_value = lv_disp_get_size_category(NULL) <= LV_DISP_MEDIUM_LIMIT ? LV_DPX(10) : LV_DPX(20);
|
||||
lv_style_int_t pad_small_value = lv_disp_get_size_category(NULL) <= LV_DISP_SIZE_MEDIUM ? LV_DPX(10) : LV_DPX(20);
|
||||
lv_style_set_pad_left(&styles->pad_small, LV_STATE_DEFAULT, pad_small_value);
|
||||
lv_style_set_pad_right(&styles->pad_small, LV_STATE_DEFAULT, pad_small_value);
|
||||
lv_style_set_pad_top(&styles->pad_small, LV_STATE_DEFAULT, pad_small_value);
|
||||
|
||||
@@ -618,7 +618,7 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCROLLABLE);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ static lv_coord_t get_day_names_height(lv_obj_t * calendar);
|
||||
static void draw_header(lv_obj_t * calendar, const lv_area_t * mask);
|
||||
static void draw_day_names(lv_obj_t * calendar, const lv_area_t * mask);
|
||||
static void draw_dates(lv_obj_t * calendar, const lv_area_t * clip_area);
|
||||
static uint8_t get_day_of_week(uint32_t year, uint32_t month, uint32_t day);
|
||||
static bool is_highlighted(lv_obj_t * calendar, day_draw_state_t draw_state, int32_t year, int32_t month, int32_t day);
|
||||
static bool is_pressed(lv_obj_t * calendar, day_draw_state_t draw_state, int32_t year, int32_t month, int32_t day);
|
||||
static const char * get_day_name(lv_obj_t * calendar, uint8_t day);
|
||||
@@ -365,6 +364,27 @@ const char ** lv_calendar_get_month_names(const lv_obj_t * calendar)
|
||||
return ext->month_names;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the day of the week
|
||||
* @param year a year
|
||||
* @param month a month (1..12)
|
||||
* @param day a day (1..31)
|
||||
* @return [0..6] which means [Sun..Sat] or [Mon..Sun] depending on LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||
*/
|
||||
uint8_t lv_calendar_get_day_of_week(uint32_t year, uint32_t month, uint32_t day)
|
||||
{
|
||||
uint32_t a = month < 3 ? 1 : 0;
|
||||
uint32_t b = year - a;
|
||||
|
||||
#if LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||
uint32_t day_of_week = (day + (31 * (month - 2 + 12 * a) / 12) + b + (b / 4) - (b / 100) + (b / 400) - 1) % 7;
|
||||
#else
|
||||
uint32_t day_of_week = (day + (31 * (month - 2 + 12 * a) / 12) + b + (b / 4) - (b / 100) + (b / 400)) % 7;
|
||||
#endif
|
||||
|
||||
return day_of_week;
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
@@ -617,22 +637,22 @@ static bool calculate_touched_day(lv_obj_t * calendar, const lv_point_t * touche
|
||||
uint8_t i_pos = 0;
|
||||
i_pos = (y_pos * 7) + x_pos;
|
||||
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
|
||||
if(i_pos < get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1)) {
|
||||
if(i_pos < lv_calendar_get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1)) {
|
||||
ext->pressed_date.year = ext->showed_date.year - (ext->showed_date.month == 1 ? 1 : 0);
|
||||
ext->pressed_date.month = ext->showed_date.month == 1 ? 12 : (ext->showed_date.month - 1);
|
||||
ext->pressed_date.day = get_month_length(ext->pressed_date.year, ext->pressed_date.month) -
|
||||
get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1) + 1 + i_pos;
|
||||
lv_calendar_get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1) + 1 + i_pos;
|
||||
}
|
||||
else if(i_pos < (get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1) +
|
||||
else if(i_pos < (lv_calendar_get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1) +
|
||||
get_month_length(ext->showed_date.year, ext->showed_date.month))) {
|
||||
ext->pressed_date.year = ext->showed_date.year;
|
||||
ext->pressed_date.month = ext->showed_date.month;
|
||||
ext->pressed_date.day = i_pos + 1 - get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1);
|
||||
ext->pressed_date.day = i_pos + 1 - lv_calendar_get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1);
|
||||
}
|
||||
else if(i_pos < 42) {
|
||||
ext->pressed_date.year = ext->showed_date.year + (ext->showed_date.month == 12 ? 1 : 0);
|
||||
ext->pressed_date.month = ext->showed_date.month == 12 ? 1 : (ext->showed_date.month + 1);
|
||||
ext->pressed_date.day = i_pos + 1 - get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1) -
|
||||
ext->pressed_date.day = i_pos + 1 - lv_calendar_get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1) -
|
||||
get_month_length(ext->showed_date.year, ext->showed_date.month);
|
||||
}
|
||||
return true;
|
||||
@@ -826,7 +846,7 @@ static void draw_dates(lv_obj_t * calendar, const lv_area_t * clip_area)
|
||||
lv_coord_t box_h = (days_h - 5 * date_inner) / 6;
|
||||
lv_coord_t box_size = LV_MATH_MIN(box_w, box_h);
|
||||
|
||||
uint8_t month_start_day = get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1);
|
||||
uint8_t month_start_day = lv_calendar_get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1);
|
||||
|
||||
day_draw_state_t draw_state;
|
||||
|
||||
@@ -1067,25 +1087,4 @@ static uint8_t is_leap_year(uint32_t year)
|
||||
return (year % 4) || ((year % 100 == 0) && (year % 400)) ? 0 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the day of the week
|
||||
* @param year a year
|
||||
* @param month a month
|
||||
* @param day a day
|
||||
* @return [0..6] which means [Sun..Sat] or [Mon..Sun] depending on LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||
*/
|
||||
static uint8_t get_day_of_week(uint32_t year, uint32_t month, uint32_t day)
|
||||
{
|
||||
uint32_t a = month < 3 ? 1 : 0;
|
||||
uint32_t b = year - a;
|
||||
|
||||
#if LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||
uint32_t day_of_week = (day + (31 * (month - 2 + 12 * a) / 12) + b + (b / 4) - (b / 100) + (b / 400) - 1) % 7;
|
||||
#else
|
||||
uint32_t day_of_week = (day + (31 * (month - 2 + 12 * a) / 12) + b + (b / 4) - (b / 100) + (b / 400)) % 7;
|
||||
#endif
|
||||
|
||||
return day_of_week;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -182,6 +182,15 @@ const char ** lv_calendar_get_day_names(const lv_obj_t * calendar);
|
||||
*/
|
||||
const char ** lv_calendar_get_month_names(const lv_obj_t * calendar);
|
||||
|
||||
/**
|
||||
* Get the day of the week
|
||||
* @param year a year
|
||||
* @param month a month (1..12)
|
||||
* @param day a day (1..31)
|
||||
* @return [0..6] which means [Sun..Sat] or [Mon..Sun] depending on LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||
*/
|
||||
uint8_t lv_calendar_get_day_of_week(uint32_t year, uint32_t month, uint32_t day);
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
@@ -195,6 +195,7 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color)
|
||||
|
||||
ser->start_point = 0;
|
||||
ser->ext_buf_assigned = false;
|
||||
ser->hidden = 0;
|
||||
ser->y_axis = LV_CHART_AXIS_PRIMARY_Y;
|
||||
|
||||
uint16_t i;
|
||||
@@ -207,6 +208,33 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color)
|
||||
return ser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deallocate and remove a data series from a chart
|
||||
* @param chart pointer to a chart object
|
||||
* @param series pointer to a data series on 'chart'
|
||||
*/
|
||||
void lv_chart_remove_series(lv_obj_t * chart, lv_chart_series_t * series)
|
||||
{
|
||||
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
|
||||
LV_ASSERT_NULL(series);
|
||||
|
||||
if(chart == NULL || series == NULL) return;
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(!series->ext_buf_assigned && series->points) lv_mem_free(series->points);
|
||||
|
||||
_lv_ll_remove(&ext->series_ll, series);
|
||||
lv_mem_free(series);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a cursor with a given color
|
||||
* @param chart pointer to chart object
|
||||
* @param color color of the cursor
|
||||
* @param dir direction of the cursor. `LV_CHART_CURSOR_RIGHT/LEFT/TOP/DOWN`. OR-ed values are possible
|
||||
* @return pointer to the created cursor
|
||||
*/
|
||||
lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * chart, lv_color_t color, lv_cursor_direction_t axes)
|
||||
{
|
||||
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
|
||||
@@ -246,6 +274,22 @@ void lv_chart_clear_series(lv_obj_t * chart, lv_chart_series_t * series)
|
||||
series->start_point = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide/Unhide a single series of a chart.
|
||||
* @param chart pointer to a chart object.
|
||||
* @param series pointer to a series object
|
||||
* @param hide true: hide the series
|
||||
*/
|
||||
void lv_chart_hide_series(lv_obj_t * chart, lv_chart_series_t * series, bool hide)
|
||||
{
|
||||
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
|
||||
LV_ASSERT_NULL(series);
|
||||
|
||||
series->hidden = hide ? 1 : 0;
|
||||
lv_chart_refresh(chart);
|
||||
}
|
||||
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
@@ -289,7 +333,7 @@ void lv_chart_set_y_range(lv_obj_t * chart, lv_chart_axis_t axis, lv_coord_t ymi
|
||||
if(ext->ymin[axis] == ymin && ext->ymax[axis] == ymax) return;
|
||||
|
||||
ext->ymin[axis] = ymin;
|
||||
ext->ymax[axis] = ymax;
|
||||
ext->ymax[axis] = (ymax == ymin ? ymax + 1 : ymax);
|
||||
|
||||
lv_chart_refresh(chart);
|
||||
}
|
||||
@@ -666,6 +710,7 @@ void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_
|
||||
lv_chart_refresh(chart);
|
||||
}
|
||||
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@@ -1135,6 +1180,7 @@ static void draw_series_line(lv_obj_t * chart, const lv_area_t * series_area, co
|
||||
|
||||
/*Go through all data lines*/
|
||||
_LV_LL_READ_BACK(ext->series_ll, ser) {
|
||||
if(ser->hidden) continue;
|
||||
line_dsc.color = ser->color;
|
||||
point_dsc.bg_color = ser->color;
|
||||
area_dsc.bg_color = ser->color;
|
||||
@@ -1148,7 +1194,7 @@ static void draw_series_line(lv_obj_t * chart, const lv_area_t * series_area, co
|
||||
lv_coord_t p_act = start_point;
|
||||
lv_coord_t p_prev = start_point;
|
||||
int32_t y_tmp = (int32_t)((int32_t)ser->points[p_prev] - ext->ymin[ser->y_axis]) * h;
|
||||
y_tmp = y_tmp / (ext->ymax[ser->y_axis] - ext->ymin[ser->y_axis]);
|
||||
y_tmp = y_tmp / (ext->ymax[ser->y_axis] - ext->ymin[ser->y_axis]);
|
||||
p2.y = h - y_tmp + y_ofs;
|
||||
|
||||
for(i = 0; i < ext->point_cnt; i++) {
|
||||
@@ -1271,6 +1317,7 @@ static void draw_series_column(lv_obj_t * chart, const lv_area_t * series_area,
|
||||
|
||||
/*Draw the current point of all data line*/
|
||||
_LV_LL_READ_BACK(ext->series_ll, ser) {
|
||||
if(ser->hidden) continue;
|
||||
lv_coord_t start_point = ext->update_mode == LV_CHART_UPDATE_MODE_SHIFT ? ser->start_point : 0;
|
||||
|
||||
col_a.x1 = x_act;
|
||||
|
||||
@@ -74,6 +74,7 @@ typedef struct {
|
||||
lv_color_t color;
|
||||
uint16_t start_point;
|
||||
uint8_t ext_buf_assigned : 1;
|
||||
uint8_t hidden : 1;
|
||||
lv_chart_axis_t y_axis : 1;
|
||||
} lv_chart_series_t;
|
||||
|
||||
@@ -153,11 +154,18 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy);
|
||||
*/
|
||||
lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color);
|
||||
|
||||
/**
|
||||
* Deallocate and remove a data series from a chart
|
||||
* @param chart pointer to a chart object
|
||||
* @param series pointer to a data series on 'chart'
|
||||
*/
|
||||
void lv_chart_remove_series(lv_obj_t * chart, lv_chart_series_t * series);
|
||||
|
||||
/**
|
||||
* Add a cursor with a given color
|
||||
* @param chart pointer to chart object
|
||||
* @param color color of the cursor
|
||||
* @param dir direction of the cursor. `LV_CHART_CURSOR_RIGHT/LEFT/TOP/DOWN`. OR-ed vaéues are possible
|
||||
* @param dir direction of the cursor. `LV_CHART_CURSOR_RIGHT/LEFT/TOP/DOWN`. OR-ed values are possible
|
||||
* @return pointer to the created cursor
|
||||
*/
|
||||
lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * chart, lv_color_t color, lv_cursor_direction_t dir);
|
||||
@@ -169,6 +177,15 @@ lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * chart, lv_color_t color, lv_c
|
||||
*/
|
||||
void lv_chart_clear_series(lv_obj_t * chart, lv_chart_series_t * series);
|
||||
|
||||
/**
|
||||
* Hide/Unhide a single series of a chart.
|
||||
* @param chart pointer to a chart object.
|
||||
* @param series pointer to a series object
|
||||
* @param hide true: hide the series
|
||||
*/
|
||||
void lv_chart_hide_series(lv_obj_t * chart, lv_chart_series_t * series, bool hide);
|
||||
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_cont"
|
||||
|
||||
#ifndef LV_LAYOUT_MAX_RECURSION
|
||||
#define LV_LAYOUT_MAX_RECURSION 10
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
@@ -664,142 +668,152 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
|
||||
return;
|
||||
}
|
||||
|
||||
lv_area_t tight_area;
|
||||
lv_area_t ori;
|
||||
lv_obj_t * child_i;
|
||||
static int recursion_level = 0;
|
||||
recursion_level++;
|
||||
/*Ensure it won't keep recursing forever*/
|
||||
if(recursion_level <= LV_LAYOUT_MAX_RECURSION) {
|
||||
lv_area_t tight_area;
|
||||
lv_area_t ori;
|
||||
lv_obj_t * child_i;
|
||||
|
||||
lv_obj_t * par = lv_obj_get_parent(cont);
|
||||
lv_area_t parent_area;
|
||||
lv_area_copy(&parent_area, &par->coords);
|
||||
parent_area.x1 += lv_obj_get_style_pad_left(par, LV_OBJ_PART_MAIN);
|
||||
parent_area.x2 -= lv_obj_get_style_pad_right(par, LV_OBJ_PART_MAIN);
|
||||
parent_area.y1 += lv_obj_get_style_pad_top(par, LV_OBJ_PART_MAIN);
|
||||
parent_area.y2 -= lv_obj_get_style_pad_bottom(par, LV_OBJ_PART_MAIN);
|
||||
lv_obj_t * par = lv_obj_get_parent(cont);
|
||||
lv_area_t parent_area;
|
||||
lv_area_copy(&parent_area, &par->coords);
|
||||
parent_area.x1 += lv_obj_get_style_pad_left(par, LV_OBJ_PART_MAIN);
|
||||
parent_area.x2 -= lv_obj_get_style_pad_right(par, LV_OBJ_PART_MAIN);
|
||||
parent_area.y1 += lv_obj_get_style_pad_top(par, LV_OBJ_PART_MAIN);
|
||||
parent_area.y2 -= lv_obj_get_style_pad_bottom(par, LV_OBJ_PART_MAIN);
|
||||
|
||||
/*Search the side coordinates of the children*/
|
||||
lv_obj_get_coords(cont, &ori);
|
||||
lv_obj_get_coords(cont, &tight_area);
|
||||
/*Search the side coordinates of the children*/
|
||||
lv_obj_get_coords(cont, &ori);
|
||||
lv_obj_get_coords(cont, &tight_area);
|
||||
|
||||
bool has_children = _lv_ll_is_empty(&cont->child_ll) ? false : true;
|
||||
bool has_children = _lv_ll_is_empty(&cont->child_ll) ? false : true;
|
||||
|
||||
if(has_children) {
|
||||
tight_area.x1 = LV_COORD_MAX;
|
||||
tight_area.y1 = LV_COORD_MAX;
|
||||
tight_area.x2 = LV_COORD_MIN;
|
||||
tight_area.y2 = LV_COORD_MIN;
|
||||
if(has_children) {
|
||||
tight_area.x1 = LV_COORD_MAX;
|
||||
tight_area.y1 = LV_COORD_MAX;
|
||||
tight_area.x2 = LV_COORD_MIN;
|
||||
tight_area.y2 = LV_COORD_MIN;
|
||||
|
||||
_LV_LL_READ(cont->child_ll, child_i) {
|
||||
if(lv_obj_get_hidden(child_i) != false) continue;
|
||||
_LV_LL_READ(cont->child_ll, child_i) {
|
||||
if(lv_obj_get_hidden(child_i) != false) continue;
|
||||
|
||||
if(ext->fit_left != LV_FIT_PARENT) {
|
||||
lv_style_int_t mleft = lv_obj_get_style_margin_left(child_i, LV_OBJ_PART_MAIN);
|
||||
tight_area.x1 = LV_MATH_MIN(tight_area.x1, child_i->coords.x1 - mleft);
|
||||
if(ext->fit_left != LV_FIT_PARENT) {
|
||||
lv_style_int_t mleft = lv_obj_get_style_margin_left(child_i, LV_OBJ_PART_MAIN);
|
||||
tight_area.x1 = LV_MATH_MIN(tight_area.x1, child_i->coords.x1 - mleft);
|
||||
}
|
||||
|
||||
if(ext->fit_right != LV_FIT_PARENT) {
|
||||
lv_style_int_t mright = lv_obj_get_style_margin_right(child_i, LV_OBJ_PART_MAIN);
|
||||
tight_area.x2 = LV_MATH_MAX(tight_area.x2, child_i->coords.x2 + mright);
|
||||
}
|
||||
|
||||
if(ext->fit_top != LV_FIT_PARENT) {
|
||||
lv_style_int_t mtop = lv_obj_get_style_margin_top(child_i, LV_OBJ_PART_MAIN);
|
||||
tight_area.y1 = LV_MATH_MIN(tight_area.y1, child_i->coords.y1 - mtop);
|
||||
}
|
||||
|
||||
if(ext->fit_bottom != LV_FIT_PARENT) {
|
||||
lv_style_int_t mbottom = lv_obj_get_style_margin_bottom(child_i, LV_OBJ_PART_MAIN);
|
||||
tight_area.y2 = LV_MATH_MAX(tight_area.y2, child_i->coords.y2 + mbottom);
|
||||
}
|
||||
}
|
||||
|
||||
if(ext->fit_right != LV_FIT_PARENT) {
|
||||
lv_style_int_t mright = lv_obj_get_style_margin_right(child_i, LV_OBJ_PART_MAIN);
|
||||
tight_area.x2 = LV_MATH_MAX(tight_area.x2, child_i->coords.x2 + mright);
|
||||
}
|
||||
|
||||
if(ext->fit_top != LV_FIT_PARENT) {
|
||||
lv_style_int_t mtop = lv_obj_get_style_margin_top(child_i, LV_OBJ_PART_MAIN);
|
||||
tight_area.y1 = LV_MATH_MIN(tight_area.y1, child_i->coords.y1 - mtop);
|
||||
}
|
||||
|
||||
if(ext->fit_bottom != LV_FIT_PARENT) {
|
||||
lv_style_int_t mbottom = lv_obj_get_style_margin_bottom(child_i, LV_OBJ_PART_MAIN);
|
||||
tight_area.y2 = LV_MATH_MAX(tight_area.y2, child_i->coords.y2 + mbottom);
|
||||
}
|
||||
tight_area.x1 -= lv_obj_get_style_pad_left(cont, LV_CONT_PART_MAIN);
|
||||
tight_area.x2 += lv_obj_get_style_pad_right(cont, LV_CONT_PART_MAIN);
|
||||
tight_area.y1 -= lv_obj_get_style_pad_top(cont, LV_CONT_PART_MAIN);
|
||||
tight_area.y2 += lv_obj_get_style_pad_bottom(cont, LV_CONT_PART_MAIN);
|
||||
}
|
||||
|
||||
tight_area.x1 -= lv_obj_get_style_pad_left(cont, LV_CONT_PART_MAIN);
|
||||
tight_area.x2 += lv_obj_get_style_pad_right(cont, LV_CONT_PART_MAIN);
|
||||
tight_area.y1 -= lv_obj_get_style_pad_top(cont, LV_CONT_PART_MAIN);
|
||||
tight_area.y2 += lv_obj_get_style_pad_bottom(cont, LV_CONT_PART_MAIN);
|
||||
}
|
||||
lv_area_t new_area;
|
||||
lv_area_copy(&new_area, &ori);
|
||||
|
||||
lv_area_t new_area;
|
||||
lv_area_copy(&new_area, &ori);
|
||||
|
||||
switch(ext->fit_left) {
|
||||
case LV_FIT_TIGHT:
|
||||
new_area.x1 = tight_area.x1;
|
||||
break;
|
||||
case LV_FIT_PARENT:
|
||||
new_area.x1 = parent_area.x1;
|
||||
break;
|
||||
case LV_FIT_MAX:
|
||||
new_area.x1 = has_children ? LV_MATH_MIN(tight_area.x1, parent_area.x1) : parent_area.x1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch(ext->fit_right) {
|
||||
case LV_FIT_TIGHT:
|
||||
new_area.x2 = tight_area.x2;
|
||||
break;
|
||||
case LV_FIT_PARENT:
|
||||
new_area.x2 = parent_area.x2;
|
||||
break;
|
||||
case LV_FIT_MAX:
|
||||
new_area.x2 = has_children ? LV_MATH_MAX(tight_area.x2, parent_area.x2) : parent_area.x2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch(ext->fit_top) {
|
||||
case LV_FIT_TIGHT:
|
||||
new_area.y1 = tight_area.y1;
|
||||
break;
|
||||
case LV_FIT_PARENT:
|
||||
new_area.y1 = parent_area.y1;
|
||||
break;
|
||||
case LV_FIT_MAX:
|
||||
new_area.y1 = has_children ? LV_MATH_MIN(tight_area.y1, parent_area.y1) : parent_area.y1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch(ext->fit_bottom) {
|
||||
case LV_FIT_TIGHT:
|
||||
new_area.y2 = tight_area.y2;
|
||||
break;
|
||||
case LV_FIT_PARENT:
|
||||
new_area.y2 = parent_area.y2;
|
||||
break;
|
||||
case LV_FIT_MAX:
|
||||
new_area.y2 = has_children ? LV_MATH_MAX(tight_area.y2, parent_area.y2) : parent_area.y2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/*Do nothing if the coordinates are not changed*/
|
||||
if(cont->coords.x1 != new_area.x1 || cont->coords.y1 != new_area.y1 || cont->coords.x2 != new_area.x2 ||
|
||||
cont->coords.y2 != new_area.y2) {
|
||||
|
||||
lv_obj_invalidate(cont);
|
||||
lv_area_copy(&cont->coords, &new_area);
|
||||
lv_obj_invalidate(cont);
|
||||
|
||||
/*Notify the object about its new coordinates*/
|
||||
cont->signal_cb(cont, LV_SIGNAL_COORD_CHG, &ori);
|
||||
|
||||
/*Inform the parent about the new coordinates*/
|
||||
par->signal_cb(par, LV_SIGNAL_CHILD_CHG, cont);
|
||||
|
||||
if(lv_obj_get_auto_realign(cont)) {
|
||||
lv_obj_realign(cont);
|
||||
switch(ext->fit_left) {
|
||||
case LV_FIT_TIGHT:
|
||||
new_area.x1 = tight_area.x1;
|
||||
break;
|
||||
case LV_FIT_PARENT:
|
||||
new_area.x1 = parent_area.x1;
|
||||
break;
|
||||
case LV_FIT_MAX:
|
||||
new_area.x1 = has_children ? LV_MATH_MIN(tight_area.x1, parent_area.x1) : parent_area.x1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/*Tell the children the parent's size has changed*/
|
||||
_LV_LL_READ(cont->child_ll, child_i) {
|
||||
child_i->signal_cb(child_i, LV_SIGNAL_PARENT_SIZE_CHG, &ori);
|
||||
switch(ext->fit_right) {
|
||||
case LV_FIT_TIGHT:
|
||||
new_area.x2 = tight_area.x2;
|
||||
break;
|
||||
case LV_FIT_PARENT:
|
||||
new_area.x2 = parent_area.x2;
|
||||
break;
|
||||
case LV_FIT_MAX:
|
||||
new_area.x2 = has_children ? LV_MATH_MAX(tight_area.x2, parent_area.x2) : parent_area.x2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch(ext->fit_top) {
|
||||
case LV_FIT_TIGHT:
|
||||
new_area.y1 = tight_area.y1;
|
||||
break;
|
||||
case LV_FIT_PARENT:
|
||||
new_area.y1 = parent_area.y1;
|
||||
break;
|
||||
case LV_FIT_MAX:
|
||||
new_area.y1 = has_children ? LV_MATH_MIN(tight_area.y1, parent_area.y1) : parent_area.y1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch(ext->fit_bottom) {
|
||||
case LV_FIT_TIGHT:
|
||||
new_area.y2 = tight_area.y2;
|
||||
break;
|
||||
case LV_FIT_PARENT:
|
||||
new_area.y2 = parent_area.y2;
|
||||
break;
|
||||
case LV_FIT_MAX:
|
||||
new_area.y2 = has_children ? LV_MATH_MAX(tight_area.y2, parent_area.y2) : parent_area.y2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/*Do nothing if the coordinates are not changed*/
|
||||
if(cont->coords.x1 != new_area.x1 || cont->coords.y1 != new_area.y1 || cont->coords.x2 != new_area.x2 ||
|
||||
cont->coords.y2 != new_area.y2) {
|
||||
|
||||
lv_obj_invalidate(cont);
|
||||
lv_area_copy(&cont->coords, &new_area);
|
||||
lv_obj_invalidate(cont);
|
||||
|
||||
/*Notify the object about its new coordinates*/
|
||||
cont->signal_cb(cont, LV_SIGNAL_COORD_CHG, &ori);
|
||||
|
||||
/*Inform the parent about the new coordinates*/
|
||||
par->signal_cb(par, LV_SIGNAL_CHILD_CHG, cont);
|
||||
|
||||
if(lv_obj_get_auto_realign(cont)) {
|
||||
lv_obj_realign(cont);
|
||||
}
|
||||
|
||||
/*Tell the children the parent's size has changed*/
|
||||
_LV_LL_READ(cont->child_ll, child_i) {
|
||||
child_i->signal_cb(child_i, LV_SIGNAL_PARENT_SIZE_CHG, &ori);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
LV_LOG_ERROR("LV_LAYOUT_MAX_RECURSION reached! You may have encountered issue #1539.");
|
||||
}
|
||||
|
||||
recursion_level--;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,7 +33,7 @@ enum {
|
||||
LV_LAYOUT_CENTER, /**< Center objects */
|
||||
|
||||
/**
|
||||
* COULMN:
|
||||
* COLUMN:
|
||||
* - Place the object below each other
|
||||
* - Keep `pad_top` space on the top
|
||||
* - Keep `pad_inner` space between the objects
|
||||
|
||||
@@ -45,7 +45,7 @@ typedef struct {
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static lv_design_res_t lv_dropdown_design(lv_obj_t * ddlist, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_dropdown_page_design(lv_obj_t * ddlist, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_dropdown_page_design(lv_obj_t * page, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_dropdown_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param);
|
||||
static lv_res_t lv_dropdown_page_signal(lv_obj_t * page, lv_signal_t sign, void * param);
|
||||
static lv_res_t lv_dropdown_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
|
||||
@@ -303,7 +303,12 @@ void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint32_t pos
|
||||
|
||||
/*Allocate space for the new option*/
|
||||
size_t old_len = (ext->options == NULL) ? 0 : strlen(ext->options);
|
||||
size_t ins_len = strlen(option);
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 0
|
||||
size_t ins_len = strlen(option) + 1;
|
||||
#else
|
||||
size_t ins_len = _lv_txt_ap_calc_bytes_cnt(option) + 1;
|
||||
#endif
|
||||
|
||||
size_t new_len = ins_len + old_len + 2; /* +2 for terminating NULL and possible \n */
|
||||
ext->options = lv_mem_realloc(ext->options, new_len + 1);
|
||||
LV_ASSERT_MEM(ext->options);
|
||||
@@ -331,9 +336,13 @@ void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint32_t pos
|
||||
char * ins_buf = _lv_mem_buf_get(ins_len + 2); /* + 2 for terminating NULL and possible \n */
|
||||
LV_ASSERT_MEM(ins_buf);
|
||||
if(ins_buf == NULL) return;
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 0
|
||||
strcpy(ins_buf, option);
|
||||
if(pos < ext->option_cnt)
|
||||
strcat(ins_buf, "\n");
|
||||
#else
|
||||
_lv_txt_ap_proc(option, ins_buf);
|
||||
#endif
|
||||
if(pos < ext->option_cnt) strcat(ins_buf, "\n");
|
||||
|
||||
_lv_txt_ins(ext->options, _lv_txt_encoded_get_char_id(ext->options, insert_pos), ins_buf);
|
||||
_lv_mem_buf_release(ins_buf);
|
||||
|
||||
@@ -356,10 +365,8 @@ void lv_dropdown_set_selected(lv_obj_t * ddlist, uint16_t sel_opt)
|
||||
|
||||
ext->sel_opt_id = sel_opt < ext->option_cnt ? sel_opt : ext->option_cnt - 1;
|
||||
ext->sel_opt_id_orig = ext->sel_opt_id;
|
||||
/*Move the list to show the current option*/
|
||||
if(ext->page != NULL) {
|
||||
lv_obj_invalidate(ddlist);
|
||||
}
|
||||
|
||||
lv_obj_invalidate(ddlist);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -197,15 +197,9 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int32_t value)
|
||||
int32_t old_value = ext->values[needle_id];
|
||||
ext->values[needle_id] = value;
|
||||
|
||||
// lv_obj_invalidate(gauge);
|
||||
|
||||
lv_style_int_t pad = lv_obj_get_style_pad_inner(gauge, LV_GAUGE_PART_NEEDLE);
|
||||
lv_style_int_t left = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_MAIN);
|
||||
lv_style_int_t right = lv_obj_get_style_pad_right(gauge, LV_GAUGE_PART_MAIN);
|
||||
lv_style_int_t top = lv_obj_get_style_pad_top(gauge, LV_GAUGE_PART_MAIN);
|
||||
lv_coord_t r = (lv_obj_get_width(gauge) - left - right) / 2 - pad;
|
||||
lv_coord_t x_ofs = gauge->coords.x1 + r + left + pad;
|
||||
lv_coord_t y_ofs = gauge->coords.y1 + r + top + pad;
|
||||
lv_coord_t r = lv_obj_get_width(gauge) / 2;
|
||||
lv_coord_t x_ofs = gauge->coords.x1 + r;
|
||||
lv_coord_t y_ofs = gauge->coords.y1 + r;
|
||||
uint16_t angle = lv_linemeter_get_scale_angle(gauge);
|
||||
int16_t angle_ofs = 90 + (360 - angle) / 2 + lv_gauge_get_angle_offset(gauge);
|
||||
lv_point_t p_mid;
|
||||
|
||||
@@ -681,16 +681,16 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area
|
||||
if(zoomed_src_w <= 0) return LV_DESIGN_RES_OK;
|
||||
lv_coord_t zoomed_src_h = (int32_t)((int32_t)ext->h * zoom_final) >> 8;
|
||||
if(zoomed_src_h <= 0) return LV_DESIGN_RES_OK;
|
||||
lv_area_t zommed_coords;
|
||||
lv_obj_get_coords(img, &zommed_coords);
|
||||
lv_area_t zoomed_coords;
|
||||
lv_obj_get_coords(img, &zoomed_coords);
|
||||
|
||||
zommed_coords.x1 += (int32_t)((int32_t)ext->offset.x * zoom_final) >> 8;
|
||||
zommed_coords.y1 += (int32_t)((int32_t)ext->offset.y * zoom_final) >> 8;
|
||||
zommed_coords.x2 = zommed_coords.x1 + ((int32_t)((int32_t)(obj_w - 1) * zoom_final) >> 8);
|
||||
zommed_coords.y2 = zommed_coords.y1 + ((int32_t)((int32_t)(obj_h - 1) * zoom_final) >> 8);
|
||||
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;
|
||||
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);
|
||||
|
||||
if(zommed_coords.x1 > img->coords.x1) zommed_coords.x1 -= ext->w;
|
||||
if(zommed_coords.y1 > img->coords.y1) zommed_coords.y1 -= ext->h;
|
||||
if(zoomed_coords.x1 > img->coords.x1) zoomed_coords.x1 -= ext->w;
|
||||
if(zoomed_coords.y1 > img->coords.y1) zoomed_coords.y1 -= ext->h;
|
||||
|
||||
lv_area_t clip_real;
|
||||
_lv_img_buf_get_transformed_area(&clip_real, lv_obj_get_width(img), lv_obj_get_height(img), angle_final, zoom_final,
|
||||
@@ -703,13 +703,13 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area
|
||||
if(_lv_area_intersect(&clip_real, &clip_real, clip_area) == false) return LV_DESIGN_RES_OK;
|
||||
|
||||
lv_area_t coords_tmp;
|
||||
coords_tmp.y1 = zommed_coords.y1;
|
||||
coords_tmp.y2 = zommed_coords.y1 + ext->h - 1;
|
||||
coords_tmp.y1 = zoomed_coords.y1;
|
||||
coords_tmp.y2 = zoomed_coords.y1 + ext->h - 1;
|
||||
|
||||
for(; coords_tmp.y1 < zommed_coords.y2; coords_tmp.y1 += zoomed_src_h, coords_tmp.y2 += zoomed_src_h) {
|
||||
coords_tmp.x1 = zommed_coords.x1;
|
||||
coords_tmp.x2 = zommed_coords.x1 + ext->w - 1;
|
||||
for(; coords_tmp.x1 < zommed_coords.x2; coords_tmp.x1 += zoomed_src_w, coords_tmp.x2 += zoomed_src_w) {
|
||||
for(; coords_tmp.y1 < zoomed_coords.y2; coords_tmp.y1 += zoomed_src_h, coords_tmp.y2 += zoomed_src_h) {
|
||||
coords_tmp.x1 = zoomed_coords.x1;
|
||||
coords_tmp.x2 = zoomed_coords.x1 + ext->w - 1;
|
||||
for(; coords_tmp.x1 < zoomed_coords.x2; coords_tmp.x1 += zoomed_src_w, coords_tmp.x2 += zoomed_src_w) {
|
||||
lv_draw_img(&coords_tmp, &clip_real, ext->src, &img_dsc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -532,7 +532,7 @@ static void refr_img(lv_obj_t * imgbtn)
|
||||
}
|
||||
|
||||
/**
|
||||
* If `src` is not defined for the current state try to get a state which is related to the curent but has `src`.
|
||||
* If `src` is not defined for the current state try to get a state which is related to the current but has `src`.
|
||||
* E.g. if the PRESSED src is not set but the RELEASED does, use the RELEASED.
|
||||
* @param imgbtn pointer to an image button
|
||||
* @param state the state to convert
|
||||
|
||||
@@ -370,11 +370,11 @@ void lv_label_set_recolor(lv_obj_t * label, bool en)
|
||||
ext->recolor = en == false ? 0 : 1;
|
||||
|
||||
lv_label_refr_text(label); /*Refresh the text because the potential color codes in text needs to
|
||||
be hided or revealed*/
|
||||
be hidden or revealed*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the label's animation speed in LV_LABEL_LONG_SROLL/SCROLL_CIRC modes
|
||||
* Set the label's animation speed in LV_LABEL_LONG_SROLL/SROLL_CIRC modes
|
||||
* @param label pointer to a label object
|
||||
* @param anim_speed speed of animation in px/sec unit
|
||||
*/
|
||||
@@ -1286,7 +1286,7 @@ static lv_design_res_t lv_label_design(lv_obj_t * label, const lv_area_t * clip_
|
||||
label_draw_dsc.flag = flag;
|
||||
lv_obj_init_draw_label_dsc(label, LV_LABEL_PART_MAIN, &label_draw_dsc);
|
||||
|
||||
/* In SCROLL and SCROLL_CIRC mode the CENTER and RIGHT are pointless so remove them.
|
||||
/* In SROLL and SROLL_CIRC mode the CENTER and RIGHT are pointless so remove them.
|
||||
* (In addition they will result misalignment is this case)*/
|
||||
if((ext->long_mode == LV_LABEL_LONG_SROLL || ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) &&
|
||||
(ext->align == LV_LABEL_ALIGN_CENTER || ext->align == LV_LABEL_ALIGN_RIGHT)) {
|
||||
|
||||
@@ -167,7 +167,7 @@ void lv_label_set_align(lv_obj_t * label, lv_label_align_t align);
|
||||
void lv_label_set_recolor(lv_obj_t * label, bool en);
|
||||
|
||||
/**
|
||||
* Set the label's animation speed in LV_LABEL_LONG_SROLL/SCROLL_CIRC modes
|
||||
* Set the label's animation speed in LV_LABEL_LONG_SROLL/SROLL_CIRC modes
|
||||
* @param label pointer to a label object
|
||||
* @param anim_speed speed of animation in px/sec unit
|
||||
*/
|
||||
|
||||
@@ -447,7 +447,7 @@ 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->mirrored && i >= level) || (ext->mirrored && i <= level)) {
|
||||
line_dsc.color = end_color;
|
||||
line_dsc.width = end_line_width;
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ void lv_list_down(const lv_obj_t * list);
|
||||
/**
|
||||
* Focus on a list button. It ensures that the button will be visible on the list.
|
||||
* @param btn pointer to a list button to focus
|
||||
* @param anim LV_ANOM_ON: scroll with animation, LV_ANIM_OFF: without animation
|
||||
* @param anim LV_ANIM_ON: scroll with animation, LV_ANIM_OFF: without animation
|
||||
*/
|
||||
void lv_list_focus(const lv_obj_t * btn, lv_anim_enable_t anim);
|
||||
|
||||
|
||||
@@ -1250,8 +1250,22 @@ static void scrlbar_refresh(lv_obj_t * page)
|
||||
(scrl_w + bg_left + bg_right - obj_w),
|
||||
obj_h - sb_width - sb_bottom);
|
||||
|
||||
if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO ||
|
||||
ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) ext->scrlbar.hor_draw = 1;
|
||||
if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO) ext->scrlbar.hor_draw = 1;
|
||||
else if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) {
|
||||
lv_indev_t * indev = lv_indev_get_next(NULL);
|
||||
while(indev) {
|
||||
if(indev->driver.type == LV_INDEV_TYPE_POINTER && (indev->proc.types.pointer.drag_dir & LV_DRAG_DIR_HOR)) {
|
||||
lv_obj_t * drag_obj = indev->proc.types.pointer.act_obj;
|
||||
while(drag_obj && drag_obj->drag_parent) drag_obj = lv_obj_get_parent(drag_obj);
|
||||
|
||||
if(drag_obj && drag_obj == scrl) {
|
||||
ext->scrlbar.hor_draw = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
indev = lv_indev_get_next(indev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Full sized vertical scroll bar*/
|
||||
@@ -1275,8 +1289,22 @@ static void scrlbar_refresh(lv_obj_t * page)
|
||||
(obj_h - size_tmp - 2 * sb_ver_pad)) /
|
||||
(scrl_h + bg_top + bg_bottom - obj_h));
|
||||
|
||||
if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO ||
|
||||
ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) ext->scrlbar.ver_draw = 1;
|
||||
if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO) ext->scrlbar.ver_draw = 1;
|
||||
else if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) {
|
||||
lv_indev_t * indev = lv_indev_get_next(NULL);
|
||||
while(indev) {
|
||||
if(indev->driver.type == LV_INDEV_TYPE_POINTER && (indev->proc.types.pointer.drag_dir & LV_DRAG_DIR_VER)) {
|
||||
lv_obj_t * drag_obj = indev->proc.types.pointer.act_obj;
|
||||
while(drag_obj && drag_obj->drag_parent) drag_obj = lv_obj_get_parent(drag_obj);
|
||||
|
||||
if(drag_obj && drag_obj == scrl) {
|
||||
ext->scrlbar.ver_draw = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
indev = lv_indev_get_next(indev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Invalidate the new scrollbar areas*/
|
||||
|
||||
@@ -99,7 +99,7 @@ void lv_roller_set_align(lv_obj_t * roller, lv_label_align_t align);
|
||||
* Set the selected option
|
||||
* @param roller pointer to a roller object
|
||||
* @param sel_opt id of the selected option (0 ... number of option - 1);
|
||||
* @param anim LV_ANOM_ON: set with animation; LV_ANIM_OFF set immediately
|
||||
* @param anim LV_ANIM_ON: set with animation; LV_ANIM_OFF set immediately
|
||||
*/
|
||||
void lv_roller_set_selected(lv_obj_t * roller, uint16_t sel_opt, lv_anim_enable_t anim);
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
static lv_res_t lv_switch_signal(lv_obj_t * sw, lv_signal_t sign, void * param);
|
||||
static lv_design_res_t lv_switch_design(lv_obj_t * sw, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_style_list_t * lv_switch_get_style(lv_obj_t * sw, uint8_t part);
|
||||
static lv_style_list_t * lv_switch_get_style(lv_obj_t * sw, uint8_t part);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -117,7 +116,7 @@ lv_obj_t * lv_switch_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/**
|
||||
* Turn ON the switch
|
||||
* @param sw pointer to a switch object
|
||||
* @param anim LV_ANOM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
void lv_switch_on(lv_obj_t * sw, lv_anim_enable_t anim)
|
||||
{
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
#include "lv_table.h"
|
||||
#if LV_USE_TABLE != 0
|
||||
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_core/lv_indev.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_misc/lv_txt.h"
|
||||
#include "../lv_misc/lv_txt_ap.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_draw/lv_draw_label.h"
|
||||
#include "../lv_misc/lv_printf.h"
|
||||
#include "../lv_draw/lv_draw_label.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
|
||||
/*********************
|
||||
|
||||
@@ -165,8 +165,8 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->tab_name_ptr[0] = "";
|
||||
lv_btnmatrix_set_map(ext->btns, ext->tab_name_ptr);
|
||||
|
||||
lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_BG_SCRLLABLE), lv_obj_get_style_list(copy,
|
||||
LV_TABVIEW_PART_BG_SCRLLABLE));
|
||||
lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_BG_SCROLLABLE), lv_obj_get_style_list(copy,
|
||||
LV_TABVIEW_PART_BG_SCROLLABLE));
|
||||
lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_TAB_BG), lv_obj_get_style_list(copy,
|
||||
LV_TABVIEW_PART_TAB_BG));
|
||||
lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_TAB_BTN), lv_obj_get_style_list(copy,
|
||||
@@ -615,8 +615,8 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
if(info->part == LV_TABVIEW_PART_TAB_BG) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BG);
|
||||
else if(info->part == LV_TABVIEW_PART_TAB_BTN) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BTN);
|
||||
else if(info->part == LV_TABVIEW_PART_INDIC) info->result = lv_obj_get_state(ext->indic, LV_OBJ_PART_MAIN);
|
||||
else if(info->part == LV_TABVIEW_PART_BG_SCRLLABLE) info->result = lv_obj_get_state(ext->content,
|
||||
LV_PAGE_PART_SCROLLABLE);
|
||||
else if(info->part == LV_TABVIEW_PART_BG_SCROLLABLE) info->result = lv_obj_get_state(ext->content,
|
||||
LV_PAGE_PART_SCROLLABLE);
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
@@ -791,7 +791,7 @@ static lv_style_list_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part)
|
||||
case LV_TABVIEW_PART_BG:
|
||||
style_dsc_p = &tabview->style_list;
|
||||
break;
|
||||
case LV_TABVIEW_PART_BG_SCRLLABLE:
|
||||
case LV_TABVIEW_PART_BG_SCROLLABLE:
|
||||
style_dsc_p = lv_obj_get_style_list(ext->content, LV_PAGE_PART_SCROLLABLE);
|
||||
break;
|
||||
case LV_TABVIEW_PART_TAB_BG:
|
||||
@@ -985,8 +985,8 @@ static void refr_content_size(lv_obj_t * tabview)
|
||||
lv_obj_set_size(ext->content, cont_w, cont_h);
|
||||
|
||||
/*Refresh the size of the tab pages too. `ext->content` has a layout to align the pages*/
|
||||
lv_style_int_t bg_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||
lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||
lv_style_int_t bg_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_BG_SCROLLABLE);
|
||||
lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_BG_SCROLLABLE);
|
||||
cont_h -= bg_top + bg_bottom;
|
||||
lv_obj_t * content_scrl = lv_page_get_scrollable(ext->content);
|
||||
lv_obj_t * pages = lv_obj_get_child(content_scrl, NULL);
|
||||
|
||||
@@ -69,7 +69,7 @@ enum {
|
||||
LV_TABVIEW_PART_BG = LV_OBJ_PART_MAIN,
|
||||
_LV_TABVIEW_PART_VIRTUAL_LAST = _LV_OBJ_PART_VIRTUAL_LAST,
|
||||
|
||||
LV_TABVIEW_PART_BG_SCRLLABLE = _LV_OBJ_PART_REAL_LAST,
|
||||
LV_TABVIEW_PART_BG_SCROLLABLE = _LV_OBJ_PART_REAL_LAST,
|
||||
LV_TABVIEW_PART_TAB_BG,
|
||||
LV_TABVIEW_PART_TAB_BTN,
|
||||
LV_TABVIEW_PART_INDIC,
|
||||
|
||||
@@ -110,7 +110,7 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->pwd_mode = 0;
|
||||
ext->pwd_tmp = NULL;
|
||||
ext->pwd_show_time = LV_TEXTAREA_DEF_PWD_SHOW_TIME;
|
||||
ext->accapted_chars = NULL;
|
||||
ext->accepted_chars = NULL;
|
||||
ext->max_length = 0;
|
||||
ext->cursor.state = 1;
|
||||
ext->cursor.hidden = 0;
|
||||
@@ -161,7 +161,7 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_textarea_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
ext->label = lv_label_create(ta, copy_ext->label);
|
||||
ext->pwd_mode = copy_ext->pwd_mode;
|
||||
ext->accapted_chars = copy_ext->accapted_chars;
|
||||
ext->accepted_chars = copy_ext->accepted_chars;
|
||||
ext->max_length = copy_ext->max_length;
|
||||
ext->cursor.pos = copy_ext->cursor.pos;
|
||||
ext->cursor.valid_x = copy_ext->cursor.valid_x;
|
||||
@@ -276,8 +276,7 @@ void lv_textarea_add_char(lv_obj_t * ta, uint32_t c)
|
||||
lv_textarea_clear_selection(ta); /*Clear selection*/
|
||||
|
||||
if(ext->pwd_mode != 0) {
|
||||
|
||||
ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + 2); /*+2: the new char + \0 */
|
||||
ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + strlen(letter_buf) + 1); /*+2: the new char + \0 */
|
||||
LV_ASSERT_MEM(ext->pwd_tmp);
|
||||
if(ext->pwd_tmp == NULL) return;
|
||||
|
||||
@@ -828,7 +827,7 @@ void lv_textarea_set_accepted_chars(lv_obj_t * ta, const char * list)
|
||||
|
||||
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
|
||||
ext->accapted_chars = list;
|
||||
ext->accepted_chars = list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1070,7 +1069,7 @@ const char * lv_textarea_get_accepted_chars(lv_obj_t * ta)
|
||||
|
||||
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
|
||||
return ext->accapted_chars;
|
||||
return ext->accepted_chars;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1671,6 +1670,7 @@ static void pwd_char_hider(lv_obj_t * ta)
|
||||
|
||||
lv_label_set_text(ext->label, txt_tmp);
|
||||
_lv_mem_buf_release(txt_tmp);
|
||||
refr_cursor_area(ta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1685,7 +1685,7 @@ static bool char_is_accepted(lv_obj_t * ta, uint32_t c)
|
||||
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
|
||||
/*If no restriction accept it*/
|
||||
if(ext->accapted_chars == NULL && ext->max_length == 0) return true;
|
||||
if(ext->accepted_chars == NULL && ext->max_length == 0) return true;
|
||||
|
||||
/*Too many characters?*/
|
||||
if(ext->max_length > 0 && _lv_txt_get_encoded_length(lv_textarea_get_text(ta)) >= ext->max_length) {
|
||||
@@ -1693,11 +1693,11 @@ static bool char_is_accepted(lv_obj_t * ta, uint32_t c)
|
||||
}
|
||||
|
||||
/*Accepted character?*/
|
||||
if(ext->accapted_chars) {
|
||||
if(ext->accepted_chars) {
|
||||
uint32_t i = 0;
|
||||
|
||||
while(ext->accapted_chars[i] != '\0') {
|
||||
uint32_t a = _lv_txt_encoded_next(ext->accapted_chars, &i);
|
||||
while(ext->accepted_chars[i] != '\0') {
|
||||
uint32_t a = _lv_txt_encoded_next(ext->accepted_chars, &i);
|
||||
if(a == c) return true; /*Accepted*/
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ typedef struct {
|
||||
char * placeholder_txt; /*Place holder label. only visible if text is an empty string*/
|
||||
lv_style_list_t style_placeholder;
|
||||
char * pwd_tmp; /*Used to store the original text in password mode*/
|
||||
const char * accapted_chars; /*Only these characters will be accepted. NULL: accept all*/
|
||||
const char * accepted_chars; /*Only these characters will be accepted. NULL: accept all*/
|
||||
uint32_t max_length; /*The max. number of characters. 0: no limit*/
|
||||
uint16_t pwd_show_time; /*Time to show characters in password mode before change them to '*' */
|
||||
struct {
|
||||
|
||||
@@ -47,7 +47,7 @@ static lv_design_res_t lv_win_header_design(lv_obj_t * header, const lv_area_t *
|
||||
static lv_style_list_t * lv_win_get_style(lv_obj_t * win, uint8_t part);
|
||||
static void lv_win_realign(lv_obj_t * win);
|
||||
static lv_obj_t * lv_win_btn_create(lv_obj_t * par, const void * img_src);
|
||||
static void lv_win_btn_set_alignment(lv_obj_t * par, const lv_win_btn_align_t alignment);
|
||||
static void lv_win_btn_set_alignment(lv_obj_t * win_btn, const lv_win_btn_align_t alignment);
|
||||
static lv_win_btn_align_t lv_win_btn_get_alignment(const lv_obj_t * par);
|
||||
|
||||
/**********************
|
||||
@@ -92,6 +92,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->page = NULL;
|
||||
ext->header = NULL;
|
||||
ext->title_txt = lv_mem_alloc(strlen(DEF_TITLE) + 1);
|
||||
ext->title_txt_align = LV_TXT_FLAG_NONE;
|
||||
strcpy(ext->title_txt, DEF_TITLE);
|
||||
|
||||
/*Init the new window object*/
|
||||
@@ -232,7 +233,7 @@ lv_obj_t * lv_win_add_btn_left(lv_obj_t * win, const void * img_src)
|
||||
/**
|
||||
* Can be assigned to a window control button to close the window
|
||||
* @param btn pointer to the control button on the widows header
|
||||
* @param evet the event type
|
||||
* @param event the event type
|
||||
*/
|
||||
void lv_win_close_event_cb(lv_obj_t * btn, lv_event_t event)
|
||||
{
|
||||
@@ -257,11 +258,20 @@ void lv_win_set_title(lv_obj_t * win, const char * title)
|
||||
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
|
||||
ext->title_txt = lv_mem_realloc(ext->title_txt, strlen(title) + 1);
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 0
|
||||
size_t len = strlen(title) + 1;
|
||||
#else
|
||||
size_t len = _lv_txt_ap_calc_bytes_cnt(title) + 1;
|
||||
#endif
|
||||
|
||||
ext->title_txt = lv_mem_realloc(ext->title_txt, len + 1);
|
||||
LV_ASSERT_MEM(ext->title_txt);
|
||||
if(ext->title_txt == NULL) return;
|
||||
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 0
|
||||
strcpy(ext->title_txt, title);
|
||||
#else
|
||||
_lv_txt_ap_proc(title, ext->title_txt);
|
||||
#endif
|
||||
lv_obj_invalidate(ext->header);
|
||||
}
|
||||
|
||||
@@ -363,6 +373,14 @@ void lv_win_set_drag(lv_obj_t * win, bool en)
|
||||
lv_obj_set_drag(win, en);
|
||||
}
|
||||
|
||||
void lv_win_title_set_alignment(lv_obj_t * win, uint8_t alignment)
|
||||
{
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
|
||||
ext->title_txt_align = alignment;
|
||||
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@@ -491,6 +509,14 @@ lv_coord_t lv_win_get_width(lv_obj_t * win)
|
||||
return lv_obj_get_width_fit(scrl) - left - right;
|
||||
}
|
||||
|
||||
uint8_t lv_win_title_get_alignment(lv_obj_t * win)
|
||||
{
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
|
||||
return ext->title_txt_align;
|
||||
}
|
||||
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
@@ -538,11 +564,13 @@ static lv_design_res_t lv_win_header_design(lv_obj_t * header, const lv_area_t *
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
|
||||
lv_style_int_t header_left = lv_obj_get_style_pad_left(win, LV_WIN_PART_HEADER);
|
||||
lv_style_int_t header_right = lv_obj_get_style_pad_right(win, LV_WIN_PART_HEADER);
|
||||
lv_style_int_t header_inner = lv_obj_get_style_pad_inner(win, LV_WIN_PART_HEADER);
|
||||
|
||||
lv_draw_label_dsc_t label_dsc;
|
||||
lv_draw_label_dsc_init(&label_dsc);
|
||||
lv_obj_init_draw_label_dsc(header, LV_OBJ_PART_MAIN, &label_dsc);
|
||||
label_dsc.flag = ext->title_txt_align;
|
||||
|
||||
lv_area_t txt_area;
|
||||
lv_point_t txt_size;
|
||||
@@ -557,21 +585,41 @@ static lv_design_res_t lv_win_header_design(lv_obj_t * header, const lv_area_t *
|
||||
|
||||
/*Get x position of the title (should be on the right of the buttons on the left)*/
|
||||
|
||||
lv_coord_t left_btn_offset = 0;
|
||||
lv_coord_t btn_offset = 0;
|
||||
btn = lv_obj_get_child_back(ext->header, NULL);
|
||||
while(btn != NULL) {
|
||||
if(LV_WIN_BTN_ALIGN_LEFT == lv_win_btn_get_alignment(btn)) {
|
||||
left_btn_offset += btn_w + header_inner;
|
||||
btn_offset += btn_w + header_inner;
|
||||
}
|
||||
|
||||
btn = lv_obj_get_child_back(header, btn);
|
||||
}
|
||||
|
||||
txt_area.x1 = header->coords.x1 + header_left + left_btn_offset;
|
||||
txt_area.y1 = header->coords.y1 + (lv_obj_get_height(header) - txt_size.y) / 2;
|
||||
txt_area.x2 = txt_area.x1 + txt_size.x + left_btn_offset;
|
||||
txt_area.y2 = txt_area.y1 + txt_size.y;
|
||||
|
||||
switch(label_dsc.flag) {
|
||||
case LV_TXT_FLAG_CENTER:
|
||||
txt_area.x1 = header->coords.x1 + header_left + btn_offset;
|
||||
txt_area.x2 = header->coords.x2 - header_right - btn_offset;
|
||||
txt_area.y1 = header->coords.y1 + (lv_obj_get_height(header) - txt_size.y) / 2;
|
||||
txt_area.y2 = txt_area.y1 + txt_size.y;
|
||||
break;
|
||||
case LV_TXT_FLAG_RIGHT:
|
||||
txt_area.x1 = header->coords.x1;
|
||||
txt_area.x2 = header->coords.x2 - header_right - btn_offset;
|
||||
txt_area.y1 = header->coords.y1 + (lv_obj_get_height(header) - txt_size.y) / 2;
|
||||
txt_area.y2 = txt_area.y1 + txt_size.y;
|
||||
break;
|
||||
case LV_TXT_FLAG_FIT || LV_TXT_FLAG_EXPAND:
|
||||
txt_area.x1 = header->coords.x1;
|
||||
txt_area.x2 = header->coords.x2;
|
||||
txt_area.y1 = header->coords.y1 + (lv_obj_get_height(header) - txt_size.y) / 2;
|
||||
txt_area.y2 = txt_area.y1 + txt_size.y;
|
||||
break;
|
||||
default:
|
||||
txt_area.x1 = header->coords.x1 + header_left + btn_offset;
|
||||
txt_area.x2 = txt_area.x1 + txt_size.x + btn_offset;
|
||||
txt_area.y1 = header->coords.y1 + (lv_obj_get_height(header) - txt_size.y) / 2;
|
||||
txt_area.y2 = txt_area.y1 + txt_size.y;
|
||||
break;
|
||||
}
|
||||
lv_draw_label(&txt_area, clip_area, &label_dsc, ext->title_txt, NULL);
|
||||
}
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
|
||||
@@ -57,6 +57,7 @@ typedef struct {
|
||||
lv_obj_t * header; /*Pointer to the header container of the window*/
|
||||
char * title_txt; /*Pointer to the title label of the window*/
|
||||
lv_coord_t btn_w; /*Width of the control buttons*/
|
||||
uint8_t title_txt_align; /*Control the alignment of the header text*/
|
||||
} lv_win_ext_t;
|
||||
|
||||
/** Window parts. */
|
||||
@@ -114,7 +115,7 @@ lv_obj_t * lv_win_add_btn_left(lv_obj_t * win, const void * img_src);
|
||||
/**
|
||||
* Can be assigned to a window control button to close the window
|
||||
* @param btn pointer to the control button on the widows header
|
||||
* @param evet the event type
|
||||
* @param event the event type
|
||||
*/
|
||||
void lv_win_close_event_cb(lv_obj_t * btn, lv_event_t event);
|
||||
|
||||
@@ -175,6 +176,13 @@ void lv_win_set_anim_time(lv_obj_t * win, uint16_t anim_time);
|
||||
*/
|
||||
void lv_win_set_drag(lv_obj_t * win, bool en);
|
||||
|
||||
/**
|
||||
* Set alignment of title text in window header.
|
||||
* @param win pointer to a window object
|
||||
* @param alignment set the type of alignment with LV_TXT_FLAGS
|
||||
*/
|
||||
void lv_win_title_set_alignment(lv_obj_t * win, uint8_t alignment);
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@@ -254,6 +262,12 @@ static inline bool lv_win_get_drag(const lv_obj_t * win)
|
||||
return lv_obj_get_drag(win);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current alignment of title text in window header.
|
||||
* @param win pointer to a window object
|
||||
*/
|
||||
uint8_t lv_win_title_get_alignment(lv_obj_t * win);
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "../lvgl.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
#include "lv_test_core/lv_test_core.h"
|
||||
#include "lv_test_widgets/lv_test_label.h"
|
||||
|
||||
#if LV_BUILD_TEST
|
||||
#include <sys/time.h>
|
||||
|
||||
static void hal_init(void);
|
||||
static void dummy_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
|
||||
|
||||
2
zephyr/module.yml
Normal file
2
zephyr/module.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
build:
|
||||
cmake: .
|
||||
Reference in New Issue
Block a user