Compare commits
69 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d0480c03d | ||
|
|
b0c9c8778d | ||
|
|
91c98f147f | ||
|
|
0bdeb00838 | ||
|
|
eee2184d10 | ||
|
|
eacc9d8ce7 | ||
|
|
d6e7187d01 | ||
|
|
f61f045135 | ||
|
|
4668bc0ee3 | ||
|
|
00f8af0fb5 | ||
|
|
33de1ffdc7 | ||
|
|
585bc329e6 | ||
|
|
c20e62d472 | ||
|
|
9260f9e0aa | ||
|
|
8532bf80df | ||
|
|
a2bb4099e6 | ||
|
|
182cbb1aa4 | ||
|
|
ccff331e3d | ||
|
|
1ca1934dbe | ||
|
|
84776ca5f7 | ||
|
|
4effebb3ea | ||
|
|
9eff0d1cd8 | ||
|
|
07ddc9bf8a | ||
|
|
9048bcc6a0 | ||
|
|
1b9ccf9cc6 | ||
|
|
36e825f093 | ||
|
|
13a53d077d | ||
|
|
479851e968 | ||
|
|
df08d0bd54 | ||
|
|
e1af20997d | ||
|
|
643bc92958 | ||
|
|
1c88c1e8d4 | ||
|
|
c3f051ac52 | ||
|
|
673c493694 | ||
|
|
4f3dac6477 | ||
|
|
d667e9d221 | ||
|
|
21e4427e57 | ||
|
|
7d29b40425 | ||
|
|
93055bc57c | ||
|
|
d5a3b81737 | ||
|
|
950ac3b993 | ||
|
|
beb496e3ed | ||
|
|
822435748a | ||
|
|
140904e201 | ||
|
|
25b4d9c34d | ||
|
|
a49e7e8295 | ||
|
|
542fa7e76d | ||
|
|
28f4092247 | ||
|
|
6adcdda06a | ||
|
|
d953d2b9fe | ||
|
|
7040084fbd | ||
|
|
6921d872a3 | ||
|
|
1544bd7b07 | ||
|
|
d28ac991ec | ||
|
|
9c90130fb3 | ||
|
|
765a97383a | ||
|
|
5cb287c3c7 | ||
|
|
32eebbbc0c | ||
|
|
a535b43290 | ||
|
|
63b1f6805a | ||
|
|
884e00ee8f | ||
|
|
f3d8d98807 | ||
|
|
4d8ae98621 | ||
|
|
e8a0413ad5 | ||
|
|
ff7e8ea315 | ||
|
|
3561d9e063 | ||
|
|
a0583f6feb | ||
|
|
0673dd0b12 | ||
|
|
09fb1e60e3 |
4
.github/workflows/ccpp.yml
vendored
4
.github/workflows/ccpp.yml
vendored
@@ -2,9 +2,9 @@ name: C/C++ CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches: [ master, dev ]
|
||||
pull_request:
|
||||
branches: [master ]
|
||||
branches: [master, dev ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
32
CHANGELOG.md
32
CHANGELOG.md
@@ -1,10 +1,34 @@
|
||||
# Changelog
|
||||
|
||||
## v7.0.1 (under development)
|
||||
*Available in the `master` branch*
|
||||
|
||||
## v7.0.2 (16.06.2020)
|
||||
|
||||
- `lv_textarea` fix wrong cursor position when clicked after the last character
|
||||
- Change all text related indices from 16-bit to 32-bit integers throughout whole library. #1545
|
||||
- Fix gestures
|
||||
- Do not call `set_px_cb` for transparent pixel
|
||||
- Fix list button focus in material theme
|
||||
- Fix crash when the a text area is cleared with the backspace of a keyboard
|
||||
- Add version number to `lv_conf_template.h`
|
||||
- Add log in true double buffering mode with `set_px_cb`
|
||||
- `lv_dropdown`: fix missing `LV_EVENT_VALUE_CHANGED` event when used with encoder
|
||||
- `lv_tileview`: fix if not the {0;0} tile is created first
|
||||
- `lv_debug`: restructure to allow asserting in from `lv_misc` too
|
||||
- add assert if `_lv_mem_buf_get()` fails
|
||||
- `lv_textarea`: fix character delete in password mode
|
||||
- Update `LV_OPA_MIN` and `LV_OPA_MAX` to widen the opacity processed range
|
||||
- `lv_btnm` fix sending events for hidden buttons
|
||||
- `lv_gaguge` make `lv_gauge_set_angle_offset` offset the labels and needles too
|
||||
- Fix typo in the API `scrllable` -> `scrollable`
|
||||
- `tabview` by default allow auto expanding the page only to right and bottom (#1573)
|
||||
- fix crash when drawing gradient to the same color
|
||||
- chart: fix memory leak
|
||||
|
||||
## v7.0.1 (01.06.2020)
|
||||
|
||||
### Bugfixes
|
||||
- Make the Microptyhon working by adding the required variables as GC_ROOT
|
||||
- Prefix some internal API functions with `_` to reduce the API of LVGL
|
||||
- Fix built-in SimSun CJK font
|
||||
- Fix UTF-8 encoding when `LV_USE_ARABIC_PERSIAN_CHARS` is enabled
|
||||
- Fix DMA2D usage when 32 bit images directly blended
|
||||
@@ -14,8 +38,8 @@
|
||||
- Improve DMA2D blending
|
||||
- Remove memcpy from `lv_ll` (caused issues with some optimization settings)
|
||||
- `lv_chart` fix X tick drawing
|
||||
- fix vertical dashed line drawing
|
||||
- some additonal minor fixes and formattings
|
||||
- Fix vertical dashed line drawing
|
||||
- Some additonal minor fixes and formattings
|
||||
|
||||
## v7.0.0 (18.05.2020)
|
||||
|
||||
|
||||
78
README.md
78
README.md
@@ -1,4 +1,4 @@
|
||||
<h1 align="center"> LVGL - Little and Versatile Graphics Library</h1>
|
||||
<h1 align="center"> LVGL - Light and Versatile Graphics Library</h1>
|
||||
<p align="center">
|
||||
<a href="https://github.com/lvgl/lvgl/blob/master/LICENCE.txt"><img src="https://img.shields.io/badge/licence-MIT-blue.svg"></a>
|
||||
<a href="https://github.com/lvgl/lvgl/releases/tag/v7.0.0"><img src="https://img.shields.io/badge/version-7.0.0-blue.svg"></a>
|
||||
@@ -28,6 +28,7 @@ LVGL provides everything you need to create embedded GUI with easy-to-use graphi
|
||||
- [Add LVGL to your project](#add-lvgl-to-your-project)
|
||||
- [Learn the basics](#learn-the-basics)
|
||||
- [Examples](#examples)
|
||||
- [Release policy](#release-policy)
|
||||
- [Contributing](#contributing)
|
||||
|
||||
|
||||
@@ -49,7 +50,7 @@ LVGL provides everything you need to create embedded GUI with easy-to-use graphi
|
||||
* **Documentation** and API references
|
||||
|
||||
## Supported devices
|
||||
Basically, every modern controller (which is able to drive a display( is suitable to run LVGL. The minimal requirements are:
|
||||
Basically, every modern controller (which is able to drive a display) is suitable to run LVGL. The minimal requirements are:
|
||||
- 16, 32 or 64 bit microcontroller or processor
|
||||
- > 16 MHz clock speed is recommended
|
||||
- Flash/ROM: > 64 kB for the very essential components (> 180 kB is recommended)
|
||||
@@ -89,11 +90,11 @@ Choose a project with your favourite IDE:
|
||||
The steps below show how to setup LVGL on an embedded system with a display and a touchpad.
|
||||
You can use the [Simulators](https://docs.lvgl.io/v7/en/html/get-started/pc-simulator) to get ready to use projects which can be run on your PC.
|
||||
|
||||
1. [Download](https://lvgl.com/developers) or [Clone](https://github.com/lvgl/lvgl) the library
|
||||
1. [Download](https://github.com/lvgl/lvgl/archive/master.zip) or [Clone](https://github.com/lvgl/lvgl) the library
|
||||
2. Copy the `lvgl` folder into your project
|
||||
3. Copy `lvgl/lv_conf_template.h` as `lv_conf.h` next to the `lvgl` folder and set at least `LV_HOR_RES_MAX`, `LV_VER_RES_MAX` and `LV_COLOR_DEPTH`. Don't forget to **change the `#if 0` statement near the top of the file to `#if 1`**, otherwise you will get compilation errors.
|
||||
3. Copy `lvgl/lv_conf_template.h` as `lv_conf.h` next to the `lvgl` folder, change the `#if 0` statement near the top of the file to `#if 1` and set at least `LV_HOR_RES_MAX`, `LV_VER_RES_MAX` and `LV_COLOR_DEPTH`.
|
||||
4. Include `lvgl/lvgl.h` where you need to use LVGL related functions.
|
||||
5. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10). It is required for the internal timing of LVGL.
|
||||
5. Call `lv_tick_inc(x)` every `x` milliseconds (should be 1..10) in a Timer or Task. It is required for the internal timing of LVGL.
|
||||
6. Call `lv_init()`
|
||||
7. Create a display buffer for LVGL
|
||||
```c
|
||||
@@ -101,7 +102,7 @@ static lv_disp_buf_t disp_buf;
|
||||
static lv_color_t buf[LV_HOR_RES_MAX * 10]; /*Declare a buffer for 10 lines*/
|
||||
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
|
||||
```
|
||||
8. Implement and register a function which can **copy a pixel array** to an area of your display:
|
||||
8. Implement and register a function which can copy a pixel array to an area of your display:
|
||||
```c
|
||||
lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
|
||||
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
|
||||
@@ -114,7 +115,7 @@ void my_disp_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_
|
||||
int32_t x, y;
|
||||
for(y = area->y1; y <= area->y2; y++) {
|
||||
for(x = area->x1; x <= area->x2; x++) {
|
||||
set_pixel(x, y, *color_p); /* Put a pixel to the display.*/
|
||||
my_set_pixel(x, y, *color_p); /* Put a pixel to the display.*/
|
||||
color_p++;
|
||||
}
|
||||
}
|
||||
@@ -123,7 +124,7 @@ void my_disp_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_
|
||||
}
|
||||
|
||||
```
|
||||
9. Implement and register a function which can **read an input device**. E.g. for a touch pad:
|
||||
9. Implement and register a function which can read an input device. E.g. for a touch pad:
|
||||
```c
|
||||
lv_indev_drv_init(&indev_drv); /*Descriptor of a input device driver*/
|
||||
indev_drv.type = LV_INDEV_TYPE_POINTER; /*Touch pad is a pointer-like device*/
|
||||
@@ -132,16 +133,8 @@ lv_indev_drv_register(&indev_drv); /*Finally register the driver*/
|
||||
|
||||
bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
|
||||
{
|
||||
static lv_coord_t last_x = 0;
|
||||
static lv_coord_t last_y = 0;
|
||||
|
||||
/*Save the state and save the pressed coordinate*/
|
||||
data->state = touchpad_is_pressed() ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
|
||||
if(data->state == LV_INDEV_STATE_PR) touchpad_get_xy(&last_x, &last_y);
|
||||
|
||||
/*Set the coordinates (if released use the last pressed coordinates)*/
|
||||
data->point.x = last_x;
|
||||
data->point.y = last_y;
|
||||
data->state = my_touchpad_is_pressed() ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
|
||||
if(data->state == LV_INDEV_STATE_PR) touchpad_get_xy(&data->point.x, &data->point.y);
|
||||
|
||||
return false; /*Return `false` because we are not buffering and no more data to read*/
|
||||
}
|
||||
@@ -149,20 +142,22 @@ bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
|
||||
10. Call `lv_task_handler()` periodically every few milliseconds in the main `while(1)` loop, in Timer interrupt or in an Operation system task.
|
||||
It will redraw the screen if required, handle input devices etc.
|
||||
|
||||
For more detailed desription visit the [Porting](https://docs.lvgl.io/v7/en/html/porting/index.html) section of the documentation.
|
||||
|
||||
## Learn the basics
|
||||
|
||||
In this section you can ready the very basics. For a more detailed guide check the [Quick overview](https://docs.lvgl.io/v7/en/html/get-started/quick-overview.html#learn-the-basics) in the documentation.
|
||||
In this section you can read the very basics of LVGL.
|
||||
For a more detailed guide check the [Quick overview](https://docs.lvgl.io/v7/en/html/get-started/quick-overview.html#learn-the-basics) in the documentation.
|
||||
|
||||
### Widgets (Objects)
|
||||
|
||||
The graphical elements like Buttons, Labels, Sliders, Charts etc are called objects in LittelvGL. Go to [Object types](https://docs.lvgl.io/v7/en/html/widgets/index) to see the full list of available types.
|
||||
The graphical elements like Buttons, Labels, Sliders, Charts etc are called objects or widgets in LVGL. Go to [Widgets](https://docs.lvgl.io/v7/en/html/widgets/index) to see the full list of available types.
|
||||
|
||||
Every object has a parent object. The child object moves with the parent and if you delete the parent the children will be deleted too. Children can be visible only on their parent.
|
||||
|
||||
The *screen* are the "root" parents. To get the current screen call `lv_scr_act()`.
|
||||
|
||||
You can create a new object with `lv_<type>_create(parent, obj_to_copy)`. It will return an `lv_obj_t *` variable which should be used as a reference to the object to set its parameters.
|
||||
You can create a new object with `lv_<type>_create(parent, obj_to_copy)`. It will return an `lv_obj_t *` variable which should be used as a reference to the object to set its parameters later.
|
||||
The first parameter is the desired *parent*, the second parameters can be an object to copy (`NULL` if unused).
|
||||
For example:
|
||||
```c
|
||||
@@ -176,15 +171,22 @@ lv_obj_set_y(btn1, 10);
|
||||
lv_obj_set_size(btn1, 200, 50);
|
||||
```
|
||||
|
||||
The objects has type specific parameters too which can be set by `lv_<type>_set_<paramters_name>(obj, <value>)` functions. For example:
|
||||
The objects have type specific parameters too which can be set by `lv_<type>_set_<paramters_name>(obj, <value>)` functions. For example:
|
||||
```c
|
||||
lv_slider_set_value(slider1, 70, LV_ANIM_ON);
|
||||
```
|
||||
|
||||
To see the full API visit the documentation of the object types or the related header file (e.g. `lvgl/src/lv_objx/lv_slider.h`).
|
||||
|
||||
|
||||
To create a new screen pass `NULL` as the fisrt paramater of a *create* function:
|
||||
```c
|
||||
lv_obj_t * scr2 = lv_obj_create(NULL, NULL); /*Create a screen*/
|
||||
lv_scr_load(scr2); /*Load the new screen*/
|
||||
```
|
||||
|
||||
### Styles
|
||||
Widgets are created with a default appearance but it can be changed by adding new styles to the object. A new style can be created like this:
|
||||
Widgets are created with a default appearance but it can be changed by adding new styles to them. A new style can be created like this:
|
||||
```c
|
||||
static lv_style_t style1; /*Should be static, global or dynamically allocated*/
|
||||
lv_style_init(&style1);
|
||||
@@ -192,15 +194,15 @@ lv_style_set_bg_color(&style1, LV_STATE_DEFAULT, LV_COLOR_RED); /*Default backg
|
||||
lv_style_set_bg_color(&style1, LV_STATE_PRESSED, LV_COLOR_BLUE); /*Pressed background color*/
|
||||
```
|
||||
|
||||
The wigedt have *parts* which can be referenced via `LV_<TYPE>_PART_<PART_NAME>`. E.g. `LV_BRN_PART_MAIN` or `LV_SLIDER_PART_KNOB`. See the documentation of the widgets to see the exisitng parts.
|
||||
The wigedt have *parts* which can be referenced via `LV_<TYPE>_PART_<PART_NAME>`. E.g. `LV_BTN_PART_MAIN` or `LV_SLIDER_PART_KNOB`. See the documentation of the widgets to see the exisitng parts.
|
||||
|
||||
To add the style to a button:
|
||||
```
|
||||
```c
|
||||
lv_obj_add_style(btn1, LV_BTN_PART_MAIN, &style1);
|
||||
```
|
||||
|
||||
To remove all styles from an object use:
|
||||
```c
|
||||
To remove all styles from a part of an object:
|
||||
```cc
|
||||
lv_obj_reset_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
```
|
||||
|
||||
@@ -210,7 +212,7 @@ Learn more in [Style overview](https://docs.lvgl.io/v7/en/html/overview/style) s
|
||||
Events are used to inform the user if something has happened with an object. You can assign a callback to an object which will be called if the object is clicked, released, dragged, being deleted etc. It should look like this:
|
||||
|
||||
```c
|
||||
lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to the button*/
|
||||
lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to the button*/
|
||||
|
||||
...
|
||||
|
||||
@@ -262,6 +264,26 @@ label.set_text("Button")
|
||||
lv.scr_load(scr)
|
||||
```
|
||||
|
||||
## Release policy
|
||||
LVGL follows the rules of [Semantic versioning](https://semver.org/):
|
||||
- Major versions for incompatible API changes. E.g. v5.0.0, v6.0.0
|
||||
- Minor version for new but backward-compatible functionalities. E.g. v6.1.0, v6.2.0
|
||||
- Patch version for backward-compatible bug fixes. E.g. v6.1.1, v6.1.2
|
||||
|
||||
Branches:
|
||||
- `master` most recent version, patches are merged directly here.
|
||||
- `dev` merge new features here until they are merged into `master`.
|
||||
- `release/vX` there is a branch for every major version to allow adding specific, not forward compatible fixes.
|
||||
|
||||
LVGL has a monthly periodic release cycle.
|
||||
- **1st Tuesday of the month**
|
||||
- Make a major, minor, or patch release from `master` depending on the new features.
|
||||
- After that merge only patches into `master` and add new features into the `dev`.
|
||||
- **3rd Tuesday of the month**
|
||||
- Make a patch release from `master`.
|
||||
- After that merge the new features from the `dev` to `master` branch.
|
||||
- In the rest of the month merge only patches into `master` and new features into `dev` branch.
|
||||
|
||||
## Contributing
|
||||
To ask questions please use the [Forum](https://forum.lvgl.io).
|
||||
For development-related things (bug reports, feature suggestions) use [GitHub's Issue tracker](https://github.com/lvgl/lvgl/issues).
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
# Contributing to LVGL
|
||||
|
||||
**Do you have some free time to spend with programming?
|
||||
Are you working on an embedded GUI project with LVGL?
|
||||
See how can you help to improve the graphics library and help others!**
|
||||
|
||||
Thank you for considering contributing to LVGL. If you have some spare time to spend with programming you will certainly find a way to helpimproving LVGL. Do not afraid to take the first step! Everybody is welcome independently from gender, age, color, location, or skill level. So don't be shy, pick a point from the list below that you are interested in, and let's go! :rocket:
|
||||
|
||||
- [Overview](#overview)
|
||||
- [How to send a pull request?](#how-to-send-a-pull-request)
|
||||
@@ -20,7 +17,7 @@ See how can you help to improve the graphics library and help others!**
|
||||
There are many ways to join the community. If you have some time to work with us you will surely find something that fits you! You can:
|
||||
- **Help others** in the [Forum](https://forum.lvgl.io).
|
||||
- **Inspire people** by speaking about your project in [My project](https://forum.lvgl.io/c/my-projects) category in the Forum.
|
||||
- **Improve and/or translate the documentation.** Go to the [Documentation](https://github.com/lvgl/docs) repository to learn more
|
||||
- **Improve and/or translate the documentation.** Go to the [Documentation](https://github.com/lvgl/docs) repository to learn more.
|
||||
- **Write a blog post** about your experiences. See how to do it in the [Blog](https://github.com/lvgl/blog) repository
|
||||
- **Report and/or fix bugs** in [GitHub's issue tracker](https://github.com/lvgl/lvgl/issues)
|
||||
- **Help the development**. Check the [Open issues](https://github.com/lvgl/lvgl/issues) especially the ones with [Help wanted](https://github.com/lvgl/lvgl/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label and tell your ideas about a topic or implement a feature.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lvgl",
|
||||
"version": "v7.0.1",
|
||||
"version": "v7.0.2",
|
||||
"keywords": "graphics, gui, embedded, littlevgl",
|
||||
"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,6 +1,6 @@
|
||||
/**
|
||||
* @file lv_conf.h
|
||||
*
|
||||
* Configuration file for LVGL v7.0.2
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -330,7 +330,7 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
|
||||
|
||||
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
|
||||
* The symbols are available via `LV_SYMBOL_...` defines
|
||||
* More info about fonts: https://docs.lvgl.com/#Fonts
|
||||
* More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html
|
||||
* To create a new font go to: https://lvgl.com/ttf-font-to-c-array
|
||||
*/
|
||||
|
||||
@@ -498,7 +498,7 @@ typedef void * lv_obj_user_data_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
|
||||
/*1: enable `lv_obj_realign()` based on `lv_obj_align()` parameters*/
|
||||
#define LV_USE_OBJ_REALIGN 1
|
||||
|
||||
/* Enable to make the object clickable on a larger area.
|
||||
|
||||
4
lvgl.h
4
lvgl.h
@@ -78,8 +78,8 @@ extern "C" {
|
||||
/*Current version of LVGL*/
|
||||
#define LVGL_VERSION_MAJOR 7
|
||||
#define LVGL_VERSION_MINOR 0
|
||||
#define LVGL_VERSION_PATCH 1
|
||||
#define LVGL_VERSION_INFO "dev"
|
||||
#define LVGL_VERSION_PATCH 2
|
||||
#define LVGL_VERSION_INFO ""
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
|
||||
@@ -30,10 +30,17 @@ def lvgl_clone():
|
||||
os.chdir("./lvgl")
|
||||
cmd("git co master")
|
||||
|
||||
def lvgl_format():
|
||||
title("lvgl: Run code formatter")
|
||||
os.chdir("./scripts")
|
||||
cmd("./code-formatter.sh")
|
||||
cmd("git ci -am 'Run code formatter'")
|
||||
os.chdir("..")
|
||||
|
||||
def lvgl_update_version():
|
||||
title("lvgl: Update version number")
|
||||
|
||||
f = open("./src/lv_version.h", "r")
|
||||
f = open("./lvgl.h", "r")
|
||||
|
||||
outbuf = ""
|
||||
major_ver = -1
|
||||
@@ -65,7 +72,7 @@ def lvgl_update_version():
|
||||
|
||||
f.close()
|
||||
|
||||
f = open("./src/lv_version.h", "w")
|
||||
f = open("./lvgl.h", "w")
|
||||
|
||||
f.write(outbuf)
|
||||
f.close()
|
||||
@@ -97,6 +104,11 @@ def lvgl_update_library_json(v):
|
||||
f.write(outbuf)
|
||||
f.close()
|
||||
|
||||
def lvgl_update_lv_conf_templ(ver_str):
|
||||
title("lvgl: Update version number in lv_conf_template.h")
|
||||
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str +"/' lv_conf_template.h ")
|
||||
|
||||
|
||||
def lvgl_commit_push(v):
|
||||
title("lvgl: commit and push release")
|
||||
|
||||
@@ -104,16 +116,68 @@ def lvgl_commit_push(v):
|
||||
cmd('git tag -a ' + v + ' -m "Release ' + v +'"')
|
||||
cmd('git push origin master')
|
||||
cmd('git push origin ' + v)
|
||||
|
||||
|
||||
def lvgl_merge_to_release_branch(v):
|
||||
title("lvgl: merge to release branch")
|
||||
cmd('git co release/v7')
|
||||
cmd('git merge master')
|
||||
cmd('git push origin release/v7')
|
||||
|
||||
|
||||
def lvgl_update_api_docs():
|
||||
title("lvgl: Update API with Doxygen")
|
||||
|
||||
cmd("cd scripts; doxygen");
|
||||
os.chdir("../")
|
||||
|
||||
|
||||
def examples_clone():
|
||||
title("examples: Clone")
|
||||
cmd("git clone https://github.com/lvgl/lv_examples.git")
|
||||
os.chdir("./lv_examples")
|
||||
cmd("git co master")
|
||||
|
||||
def examples_commit_push(v):
|
||||
title("examples: commit and push release")
|
||||
|
||||
cmd('git ci -am "Release ' + v + '"')
|
||||
cmd('git tag -a ' + v + ' -m "Release ' + v +'"')
|
||||
cmd('git push origin master')
|
||||
cmd('git push origin ' + v)
|
||||
|
||||
|
||||
def examples_merge_to_release_branch(v):
|
||||
title("examples: merge to release branch")
|
||||
cmd('git co release/v7')
|
||||
cmd('git merge master')
|
||||
cmd('git push origin release/v7')
|
||||
os.chdir("../")
|
||||
|
||||
|
||||
def drivers_clone():
|
||||
title("drivers: Clone")
|
||||
cmd("git clone https://github.com/lvgl/lv_drivers.git")
|
||||
os.chdir("./lv_drivers")
|
||||
cmd("git co master")
|
||||
|
||||
def drivers_commit_push(v):
|
||||
title("drivers: commit and push release")
|
||||
|
||||
cmd('git ci -am "Release ' + v + '"')
|
||||
cmd('git tag -a ' + v + ' -m "Release ' + v +'"')
|
||||
cmd('git push origin master')
|
||||
cmd('git push origin ' + v)
|
||||
|
||||
def drivers_merge_to_release_branch(v):
|
||||
title("drivers: merge to release branch")
|
||||
cmd('git co release/v7')
|
||||
cmd('git merge master')
|
||||
cmd('git push origin release/v7')
|
||||
os.chdir("../")
|
||||
|
||||
def docs_clone():
|
||||
title("docs: Clone")
|
||||
os.chdir("../")
|
||||
cmd("git clone --recursive https://github.com/lvgl/docs.git")
|
||||
os.chdir("./docs/v7")
|
||||
cmd("git co master")
|
||||
@@ -122,8 +186,7 @@ def docs_get_api():
|
||||
title("docs: Get API files")
|
||||
|
||||
cmd("rm -rf xml");
|
||||
cmd("cp -r ../lvgl/docs/api_doc/xml .");
|
||||
|
||||
cmd("cp -r ../../lvgl/docs/api_doc/xml .");
|
||||
|
||||
def docs_update_version(v):
|
||||
title("docs: Update version number")
|
||||
@@ -170,14 +233,25 @@ def docs_commit_push(v):
|
||||
|
||||
def clean_up():
|
||||
title("Clean up repos")
|
||||
os.chdir("..")
|
||||
cmd("rm -rf lvgl docs")
|
||||
os.chdir("../..")
|
||||
cmd("rm -rf lvgl docs lv_examples lv_drivers")
|
||||
|
||||
lvgl_clone()
|
||||
lvgl_format()
|
||||
lvgl_update_api_docs()
|
||||
ver_str = lvgl_update_version()
|
||||
lvgl_update_library_json(ver_str)
|
||||
lvgl_update_library_json(ver_str)
|
||||
lvgl_update_lv_conf_templ(ver_str)
|
||||
lvgl_commit_push(ver_str)
|
||||
lvgl_merge_to_release_branch(ver_str)
|
||||
|
||||
examples_clone()
|
||||
examples_commit_push(ver_str)
|
||||
examples_merge_to_release_branch(ver_str)
|
||||
|
||||
drivers_clone()
|
||||
drivers_commit_push(ver_str)
|
||||
drivers_merge_to_release_branch(ver_str)
|
||||
|
||||
docs_clone()
|
||||
docs_get_api()
|
||||
@@ -172,7 +172,7 @@ static inline lv_scrollbar_mode_t lv_page_get_scrlbar_mode(lv_obj_t * page)
|
||||
|
||||
static inline lv_obj_t * lv_page_get_scrl(lv_obj_t * page)
|
||||
{
|
||||
return lv_page_get_scrllable(page);
|
||||
return lv_page_get_scrollable(page);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -678,14 +678,14 @@
|
||||
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
|
||||
#endif
|
||||
|
||||
/* The control character to use for signalling text recoloring. */
|
||||
/* The control character to use for signaling text recoloring. */
|
||||
#ifndef LV_TXT_COLOR_CMD
|
||||
#define LV_TXT_COLOR_CMD "#"
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
#define LV_USE_BIDI 0
|
||||
@@ -748,7 +748,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
|
||||
/*1: enable `lv_obj_realign()` based on `lv_obj_align()` parameters*/
|
||||
#ifndef LV_USE_OBJ_REALIGN
|
||||
#define LV_USE_OBJ_REALIGN 1
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,6 @@ CSRCS += lv_disp.c
|
||||
CSRCS += lv_obj.c
|
||||
CSRCS += lv_refr.c
|
||||
CSRCS += lv_style.c
|
||||
CSRCS += lv_debug.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_group.h"
|
||||
#if LV_USE_GROUP != 0
|
||||
#include <stddef.h>
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_misc/lv_gc.h"
|
||||
|
||||
@@ -242,7 +242,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
|
||||
if(res != LV_RES_OK) return;
|
||||
lv_obj_invalidate(*g->obj_focus);
|
||||
|
||||
/*If the object or its parent has `top == true` bring it to the foregorund*/
|
||||
/*If the object or its parent has `top == true` bring it to the foreground*/
|
||||
obj_to_foreground(*g->obj_focus);
|
||||
}
|
||||
break;
|
||||
@@ -508,7 +508,7 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
|
||||
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
|
||||
/*If the object or its parent has `top == true` bring it to the foregorund*/
|
||||
/*If the object or its parent has `top == true` bring it to the foreground*/
|
||||
obj_to_foreground(*group->obj_focus);
|
||||
|
||||
lv_obj_invalidate(*group->obj_focus);
|
||||
|
||||
@@ -155,7 +155,7 @@ lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c);
|
||||
void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb);
|
||||
|
||||
/**
|
||||
* Set whether the next or previous item in a group is focused if the currently focussed obj is
|
||||
* Set whether the next or previous item in a group is focused if the currently focused obj is
|
||||
* deleted.
|
||||
* @param group pointer to a group
|
||||
* @param new refocus policy enum
|
||||
|
||||
@@ -791,7 +791,7 @@ static void indev_proc_press(lv_indev_proc_t * proc)
|
||||
&proc->types.pointer.act_point);
|
||||
new_obj_searched = true;
|
||||
}
|
||||
/*If a dragable or a protected object was the last then keep it*/
|
||||
/*If a draggable or a protected object was the last then keep it*/
|
||||
else {
|
||||
}
|
||||
|
||||
@@ -1049,7 +1049,7 @@ static void indev_proc_reset_query_handler(lv_indev_t * indev)
|
||||
/**
|
||||
* Search the most top, clickable object by a point
|
||||
* @param obj pointer to a start object, typically the screen
|
||||
* @param point pointer to a point for searhing the most top child
|
||||
* @param point pointer to a point for searching the most top child
|
||||
* @return pointer to the found object or NULL if there was no suitable object
|
||||
*/
|
||||
lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
|
||||
@@ -1086,7 +1086,7 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle focus/defocus on click for POINTER inpt devices
|
||||
* Handle focus/defocus on click for POINTER input devices
|
||||
* @param proc pointer to the state of the indev
|
||||
*/
|
||||
static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
@@ -1399,7 +1399,7 @@ static void indev_drag_throw(lv_indev_proc_t * proc)
|
||||
|
||||
/**
|
||||
* Get the really dragged object by taking `drag_parent` into account.
|
||||
* @param obj the start obejct
|
||||
* @param obj the start object
|
||||
* @return the object to really drag
|
||||
*/
|
||||
static lv_obj_t * get_dragged_obj(lv_obj_t * obj)
|
||||
@@ -1426,13 +1426,14 @@ static void indev_gesture(lv_indev_proc_t * proc)
|
||||
|
||||
lv_obj_t * gesture_obj = proc->types.pointer.act_obj;
|
||||
|
||||
/*If gesture parent is active check recursively the drag_parent attribute*/
|
||||
/*If gesture parent is active check recursively the gesture attribute*/
|
||||
while(gesture_obj && lv_obj_get_gesture_parent(gesture_obj)) {
|
||||
gesture_obj = lv_obj_get_parent(gesture_obj);
|
||||
}
|
||||
|
||||
if(gesture_obj == NULL) return;
|
||||
|
||||
|
||||
if((LV_MATH_ABS(proc->types.pointer.vect.x) < indev_act->driver.gesture_min_velocity) &&
|
||||
(LV_MATH_ABS(proc->types.pointer.vect.y) < indev_act->driver.gesture_min_velocity)) {
|
||||
proc->types.pointer.gesture_sum.x = 0;
|
||||
|
||||
@@ -160,7 +160,7 @@ lv_obj_t * lv_indev_get_obj_act(void);
|
||||
/**
|
||||
* Search the most top, clickable object by a point
|
||||
* @param obj pointer to a start object, typically the screen
|
||||
* @param point pointer to a point for searhing the most top child
|
||||
* @param point pointer to a point for searching the most top child
|
||||
* @return pointer to the found object or NULL if there was no suitable object
|
||||
*/
|
||||
lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "lv_refr.h"
|
||||
#include "lv_group.h"
|
||||
#include "lv_disp.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_misc/lv_anim.h"
|
||||
@@ -92,6 +92,7 @@ static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v);
|
||||
static void fade_in_anim_ready(lv_anim_t * a);
|
||||
#endif
|
||||
static void lv_event_mark_deleted(lv_obj_t * obj);
|
||||
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find);
|
||||
static void lv_obj_del_async_cb(void * obj);
|
||||
static void obj_del_core(lv_obj_t * obj);
|
||||
|
||||
@@ -140,6 +141,9 @@ void lv_init(void)
|
||||
#endif
|
||||
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_obj_style_trans_ll), sizeof(lv_style_trans_t));
|
||||
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t));
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_indev_ll), sizeof(lv_indev_t));
|
||||
|
||||
lv_theme_t * th = LV_THEME_DEFAULT_INIT(LV_THEME_DEFAULT_COLOR_PRIMARY, LV_THEME_DEFAULT_COLOR_SECONDARY,
|
||||
LV_THEME_DEFAULT_FLAG,
|
||||
@@ -149,9 +153,6 @@ void lv_init(void)
|
||||
/*Initialize the screen refresh system*/
|
||||
_lv_refr_init();
|
||||
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t));
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_indev_ll), sizeof(lv_indev_t));
|
||||
|
||||
/*Init the input device handling*/
|
||||
_lv_indev_init();
|
||||
|
||||
@@ -171,16 +172,16 @@ void lv_init(void)
|
||||
void lv_deinit(void)
|
||||
{
|
||||
_lv_gc_clear_roots();
|
||||
#if LV_USE_LOG
|
||||
lv_log_register_print_cb(NULL);
|
||||
#endif
|
||||
|
||||
lv_disp_set_default(NULL);
|
||||
_lv_mem_deinit();
|
||||
lv_initialized = false;
|
||||
|
||||
LV_LOG_INFO("lv_deinit done");
|
||||
|
||||
#if LV_USE_LOG
|
||||
lv_log_register_print_cb(NULL);
|
||||
#endif
|
||||
LV_LOG_INFO("lv_deinit done");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -310,7 +311,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
new_obj->top = 0;
|
||||
new_obj->protect = LV_PROTECT_NONE;
|
||||
new_obj->parent_event = 0;
|
||||
new_obj->gesture_parent = 1;
|
||||
new_obj->gesture_parent = parent ? 1 : 0;
|
||||
new_obj->state = LV_STATE_DEFAULT;
|
||||
|
||||
new_obj->ext_attr = NULL;
|
||||
@@ -837,7 +838,7 @@ void lv_obj_set_height_fit(lv_obj_t * obj, lv_coord_t h)
|
||||
|
||||
/**
|
||||
* Set the width of an object by taking the left and right margin into account.
|
||||
* The object width will be `obj_w = w - margon_left - margin_right`
|
||||
* The object width will be `obj_w = w - margin_left - margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @param w new height including margins
|
||||
*/
|
||||
@@ -851,7 +852,7 @@ void lv_obj_set_width_margin(lv_obj_t * obj, lv_coord_t w)
|
||||
|
||||
/**
|
||||
* Set the height of an object by taking the top and bottom margin into account.
|
||||
* The object height will be `obj_h = h - margon_top - margin_bottom`
|
||||
* The object height will be `obj_h = h - margin_top - margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @param h new height including margins
|
||||
*/
|
||||
@@ -1072,7 +1073,7 @@ void lv_obj_realign(lv_obj_t * obj)
|
||||
lv_obj_align(obj, obj->realign.base, obj->realign.align, obj->realign.xofs, obj->realign.yofs);
|
||||
#else
|
||||
(void)obj;
|
||||
LV_LOG_WARN("lv_obj_realaign: no effect because LV_USE_OBJ_REALIGN = 0");
|
||||
LV_LOG_WARN("lv_obj_realign: no effect because LV_USE_OBJ_REALIGN = 0");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1313,7 +1314,7 @@ void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t part, lv_style_property
|
||||
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @note shouldn't be used directly. Use the specific property remove functions instead.
|
||||
* For example: `lv_obj_style_remove_border_opa()`
|
||||
* @return true: the property was found and removed; false: teh property was not found
|
||||
* @return true: the property was found and removed; false: the property was not found
|
||||
*/
|
||||
bool lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_property_t prop)
|
||||
{
|
||||
@@ -1482,7 +1483,7 @@ void lv_obj_set_top(lv_obj_t * obj, bool en)
|
||||
/**
|
||||
* Enable the dragging of an object
|
||||
* @param obj pointer to an object
|
||||
* @param en true: make the object dragable
|
||||
* @param en true: make the object draggable
|
||||
*/
|
||||
void lv_obj_set_drag(lv_obj_t * obj, bool en)
|
||||
{
|
||||
@@ -2192,7 +2193,7 @@ lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj)
|
||||
|
||||
/**
|
||||
* Get the height of an object by taking the top and bottom margin into account.
|
||||
* The returned height will be `obj_h + margon_top + margin_bottom`
|
||||
* The returned height will be `obj_h + margin_top + margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including thee margins
|
||||
*/
|
||||
@@ -2206,7 +2207,7 @@ lv_coord_t lv_obj_get_height_margin(lv_obj_t * obj)
|
||||
|
||||
/**
|
||||
* Get the width of an object by taking the left and right margin into account.
|
||||
* The returned width will be `obj_w + margon_left + margin_right`
|
||||
* The returned width will be `obj_w + margin_left + margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including thee margins
|
||||
*/
|
||||
@@ -2678,7 +2679,7 @@ bool lv_obj_get_click(const lv_obj_t * obj)
|
||||
/**
|
||||
* Get the top enable attribute of an object
|
||||
* @param obj pointer to an object
|
||||
* @return true: the auto top feture is enabled
|
||||
* @return true: the auto top feature is enabled
|
||||
*/
|
||||
bool lv_obj_get_top(const lv_obj_t * obj)
|
||||
{
|
||||
@@ -2690,7 +2691,7 @@ bool lv_obj_get_top(const lv_obj_t * obj)
|
||||
/**
|
||||
* Get the drag enable attribute of an object
|
||||
* @param obj pointer to an object
|
||||
* @return true: the object is dragable
|
||||
* @return true: the object is draggable
|
||||
*/
|
||||
bool lv_obj_get_drag(const lv_obj_t * obj)
|
||||
{
|
||||
@@ -2809,7 +2810,7 @@ lv_state_t lv_obj_get_state(const lv_obj_t * obj, uint8_t part)
|
||||
|
||||
/*If a real part is asked, then use the object's signal to get its state.
|
||||
* A real object can be in different state then the main part
|
||||
* and only the object itseld knows who to get it's state. */
|
||||
* and only the object itself knows who to get it's state. */
|
||||
lv_get_state_info_t info;
|
||||
info.part = part;
|
||||
info.result = LV_STATE_DEFAULT;
|
||||
@@ -3283,7 +3284,7 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint8_t part, lv_draw_line_dsc_t
|
||||
|
||||
/**
|
||||
* Get the required extra size (around the object's part) to draw shadow, outline, value etc.
|
||||
* @param obj poinr to an object
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object
|
||||
*/
|
||||
lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part)
|
||||
@@ -3405,6 +3406,52 @@ void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if any object has a given type
|
||||
* @param obj pointer to an object
|
||||
* @param obj_type type of the object. (e.g. "lv_btn")
|
||||
* @return true: valid
|
||||
*/
|
||||
bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type)
|
||||
{
|
||||
if(obj_type[0] == '\0') return true;
|
||||
|
||||
lv_obj_type_t types;
|
||||
lv_obj_get_type((lv_obj_t *)obj, &types);
|
||||
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM; i++) {
|
||||
if(types.type[i] == NULL) break;
|
||||
if(strcmp(types.type[i], obj_type) == 0) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if any object is still "alive", and part of the hierarchy
|
||||
* @param obj pointer to an object
|
||||
* @param obj_type type of the object. (e.g. "lv_btn")
|
||||
* @return true: valid
|
||||
*/
|
||||
bool lv_debug_check_obj_valid(const lv_obj_t * obj)
|
||||
{
|
||||
lv_disp_t * disp = lv_disp_get_next(NULL);
|
||||
while(disp) {
|
||||
lv_obj_t * scr;
|
||||
_LV_LL_READ(disp->scr_ll, scr) {
|
||||
|
||||
if(scr == obj) return true;
|
||||
bool found = obj_valid_child(scr, obj);
|
||||
if(found) return true;
|
||||
}
|
||||
|
||||
disp = lv_disp_get_next(disp);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -3749,7 +3796,7 @@ static void base_dir_refr_children(lv_obj_t * obj)
|
||||
* @param part the part of the object to apply the transaction
|
||||
* @param prev_state the previous state of the objects
|
||||
* @param new_state the new state of the object
|
||||
* @return pointer to the allocated `the transaction` variable or `NULL` if no transtion created
|
||||
* @return pointer to the allocated `the transaction` variable or `NULL` if no transition created
|
||||
*/
|
||||
static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop, uint8_t part, lv_state_t prev_state,
|
||||
lv_state_t new_state)
|
||||
@@ -3854,12 +3901,12 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the transition from objectt's part's property.
|
||||
* Remove the transition from object's part's property.
|
||||
* - Remove the transition from `_lv_obj_style_trans_ll` and free it
|
||||
* - Delete pending transitions
|
||||
* @param obj pointer to an object which transition(s) should be removed
|
||||
* @param part a part of object or 0xFF to remove from all parts
|
||||
* @param prop a property or 0xFF to remove all porpeties
|
||||
* @param prop a property or 0xFF to remove all properties
|
||||
* @param tr_limit delete transitions only "older" then this. `NULL` is not used
|
||||
*/
|
||||
static void trans_del(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_trans_t * tr_limit)
|
||||
@@ -4001,4 +4048,19 @@ static void lv_event_mark_deleted(lv_obj_t * obj)
|
||||
}
|
||||
}
|
||||
|
||||
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find)
|
||||
{
|
||||
/*Check all children of `parent`*/
|
||||
lv_obj_t * child;
|
||||
_LV_LL_READ(parent->child_ll, child) {
|
||||
if(child == obj_to_find) return true;
|
||||
|
||||
/*Check the children*/
|
||||
bool found = obj_valid_child(child, obj_to_find);
|
||||
if(found) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ extern "C" {
|
||||
#include "../lv_misc/lv_types.h"
|
||||
#include "../lv_misc/lv_area.h"
|
||||
#include "../lv_misc/lv_color.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_hal/lv_hal.h"
|
||||
#include "../lv_draw/lv_draw_rect.h"
|
||||
#include "../lv_draw/lv_draw_label.h"
|
||||
@@ -90,7 +91,7 @@ enum {
|
||||
LV_EVENT_DRAG_BEGIN,
|
||||
LV_EVENT_DRAG_END,
|
||||
LV_EVENT_DRAG_THROW_BEGIN,
|
||||
LV_EVENT_GESTURE, /**< The object has been getture*/
|
||||
LV_EVENT_GESTURE, /**< The object has been gesture*/
|
||||
LV_EVENT_KEY,
|
||||
LV_EVENT_FOCUSED,
|
||||
LV_EVENT_DEFOCUSED,
|
||||
@@ -209,7 +210,7 @@ typedef struct _lv_obj_t {
|
||||
lv_area_t ext_click_pad; /**< Extra click padding area. */
|
||||
#endif
|
||||
|
||||
lv_coord_t ext_draw_pad; /**< EXTtend the size in every direction for drawing. */
|
||||
lv_coord_t ext_draw_pad; /**< EXTend the size in every direction for drawing. */
|
||||
|
||||
/*Attributes and states*/
|
||||
uint8_t click : 1; /**< 1: Can be pressed by an input device*/
|
||||
@@ -439,7 +440,7 @@ void lv_obj_set_height_fit(lv_obj_t * obj, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Set the width of an object by taking the left and right margin into account.
|
||||
* The object width will be `obj_w = w - margon_left - margin_right`
|
||||
* The object width will be `obj_w = w - margin_left - margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @param w new height including margins
|
||||
*/
|
||||
@@ -447,7 +448,7 @@ void lv_obj_set_width_margin(lv_obj_t * obj, lv_coord_t w);
|
||||
|
||||
/**
|
||||
* Set the height of an object by taking the top and bottom margin into account.
|
||||
* The object height will be `obj_h = h - margon_top - margin_bottom`
|
||||
* The object height will be `obj_h = h - margin_top - margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @param h new height including margins
|
||||
*/
|
||||
@@ -618,7 +619,7 @@ void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t type, lv_style_property
|
||||
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
|
||||
* @note shouldn't be used directly. Use the specific property remove functions instead.
|
||||
* For example: `lv_obj_style_remove_border_opa()`
|
||||
* @return true: the property was found and removed; false: teh property was not found
|
||||
* @return true: the property was found and removed; false: the property was not found
|
||||
*/
|
||||
bool lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
@@ -658,7 +659,7 @@ void lv_obj_set_top(lv_obj_t * obj, bool en);
|
||||
/**
|
||||
* Enable the dragging of an object
|
||||
* @param obj pointer to an object
|
||||
* @param en true: make the object dragable
|
||||
* @param en true: make the object draggable
|
||||
*/
|
||||
void lv_obj_set_drag(lv_obj_t * obj, bool en);
|
||||
|
||||
@@ -847,7 +848,6 @@ lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the display of an object
|
||||
* @param scr pointer to an object
|
||||
* @return pointer the object's display
|
||||
*/
|
||||
lv_disp_t * lv_obj_get_disp(const lv_obj_t * obj);
|
||||
@@ -956,7 +956,7 @@ lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the height of an object by taking the top and bottom margin into account.
|
||||
* The returned height will be `obj_h + margon_top + margin_bottom`
|
||||
* The returned height will be `obj_h + margin_top + margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including thee margins
|
||||
*/
|
||||
@@ -964,7 +964,7 @@ lv_coord_t lv_obj_get_height_margin(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the width of an object by taking the left and right margin into account.
|
||||
* The returned width will be `obj_w + margon_left + margin_right`
|
||||
* The returned width will be `obj_w + margin_left + margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including thee margins
|
||||
*/
|
||||
@@ -1043,7 +1043,7 @@ lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj);
|
||||
*---------------*/
|
||||
|
||||
/**
|
||||
* Get the style list of an obejct's part.
|
||||
* Get the style list of an object's part.
|
||||
* @param obj pointer to an object.
|
||||
* @param part part the part of the object which style list should be get.
|
||||
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||
@@ -1162,7 +1162,7 @@ bool lv_obj_get_top(const lv_obj_t * obj);
|
||||
/**
|
||||
* Get the drag enable attribute of an object
|
||||
* @param obj pointer to an object
|
||||
* @return true: the object is dragable
|
||||
* @return true: the object is draggable
|
||||
*/
|
||||
bool lv_obj_get_drag(const lv_obj_t * obj);
|
||||
|
||||
@@ -1348,7 +1348,7 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint8_t part, lv_draw_line_dsc_t
|
||||
|
||||
/**
|
||||
* Get the required extra size (around the object's part) to draw shadow, outline, value etc.
|
||||
* @param obj poinr to an object
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object
|
||||
*/
|
||||
lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part);
|
||||
@@ -1369,6 +1369,23 @@ void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay);
|
||||
*/
|
||||
void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
|
||||
|
||||
/**
|
||||
* Check if any object has a given type
|
||||
* @param obj pointer to an object
|
||||
* @param obj_type type of the object. (e.g. "lv_btn")
|
||||
* @return true: valid
|
||||
*/
|
||||
bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type);
|
||||
|
||||
/**
|
||||
* Check if any object is still "alive", and part of the hierarchy
|
||||
* @param obj pointer to an object
|
||||
* @param obj_type type of the object. (e.g. "lv_btn")
|
||||
* @return true: valid
|
||||
*/
|
||||
bool lv_debug_check_obj_valid(const lv_obj_t * obj);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@@ -1378,7 +1395,7 @@ void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
|
||||
* Will be expanded to: `static void <name> (lv_obj_t * obj, lv_event_t e)`
|
||||
*
|
||||
* Examples:
|
||||
* LV_EVENT_CB_DECLARE(my_event1); //Protoype declaration
|
||||
* LV_EVENT_CB_DECLARE(my_event1); //Prototype declaration
|
||||
*
|
||||
* LV_EVENT_CB_DECLARE(my_event1)
|
||||
* {
|
||||
@@ -1389,6 +1406,32 @@ void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
|
||||
*/
|
||||
#define LV_EVENT_CB_DECLARE(name) static void name(lv_obj_t * obj, lv_event_t e)
|
||||
|
||||
|
||||
#if LV_USE_DEBUG
|
||||
|
||||
# ifndef LV_DEBUG_IS_OBJ
|
||||
# define LV_DEBUG_IS_OBJ(obj_p, obj_type) (lv_debug_check_null(obj_p) && \
|
||||
lv_debug_check_obj_valid(obj_p) && \
|
||||
lv_debug_check_obj_type(obj_p, obj_type))
|
||||
# endif
|
||||
|
||||
|
||||
# if LV_USE_ASSERT_OBJ
|
||||
# ifndef LV_ASSERT_OBJ
|
||||
# define LV_ASSERT_OBJ(obj_p, obj_type) LV_DEBUG_ASSERT(LV_DEBUG_IS_OBJ(obj_p, obj_type), "Invalid object", obj_p);
|
||||
# endif
|
||||
# else /* LV_USE_ASSERT_OBJ == 0 */
|
||||
# if LV_USE_ASSERT_NULL /*Use at least LV_ASSERT_NULL if enabled*/
|
||||
# define LV_ASSERT_OBJ(obj_p, obj_type) LV_ASSERT_NULL(obj_p)
|
||||
# else
|
||||
# define LV_ASSERT_OBJ(obj_p, obj_type) true
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define LV_ASSERT_OBJ(obj, obj_type) true
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
@@ -159,7 +159,7 @@ lv_disp_t * _lv_refr_get_disp_refreshing(void)
|
||||
|
||||
/**
|
||||
* Set the display which is being refreshed.
|
||||
* It shouldn1t be used directly by the user.
|
||||
* It shouldn't be used directly by the user.
|
||||
* It can be used to trick the drawing functions about there is an active display.
|
||||
* @param the display being refreshed
|
||||
*/
|
||||
@@ -202,55 +202,59 @@ void _lv_disp_refr_task(lv_task_t * task)
|
||||
if(disp_refr->inv_p != 0) {
|
||||
/* In true double buffered mode copy the refreshed areas to the new VDB to keep it up to date.
|
||||
* With set_px_cb we don't know anything about the buffer (even it's size) so skip copying.*/
|
||||
if(lv_disp_is_true_double_buf(disp_refr) && disp_refr->driver.set_px_cb == NULL) {
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr);
|
||||
if(lv_disp_is_true_double_buf(disp_refr)) {
|
||||
if(disp_refr->driver.set_px_cb) {
|
||||
LV_LOG_WARN("Can't handle 2 screen sized buffers with set_px_cb. Display is not refreshed.");
|
||||
} else {
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr);
|
||||
|
||||
/*Flush the content of the VDB*/
|
||||
lv_refr_vdb_flush();
|
||||
/*Flush the content of the VDB*/
|
||||
lv_refr_vdb_flush();
|
||||
|
||||
/* With true double buffering the flushing should be only the address change of the
|
||||
* current frame buffer. Wait until the address change is ready and copy the changed
|
||||
* content to the other frame buffer (new active VDB) to keep the buffers synchronized*/
|
||||
while(vdb->flushing);
|
||||
/* With true double buffering the flushing should be only the address change of the
|
||||
* current frame buffer. Wait until the address change is ready and copy the changed
|
||||
* content to the other frame buffer (new active VDB) to keep the buffers synchronized*/
|
||||
while(vdb->flushing);
|
||||
|
||||
lv_color_t * copy_buf = NULL;
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
LV_UNUSED(copy_buf);
|
||||
#else
|
||||
copy_buf = _lv_mem_buf_get(disp_refr->driver.hor_res * sizeof(lv_color_t));
|
||||
#endif
|
||||
lv_color_t * copy_buf = NULL;
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
LV_UNUSED(copy_buf);
|
||||
#else
|
||||
copy_buf = _lv_mem_buf_get(disp_refr->driver.hor_res * sizeof(lv_color_t));
|
||||
#endif
|
||||
|
||||
uint8_t * buf_act = (uint8_t *)vdb->buf_act;
|
||||
uint8_t * buf_ina = (uint8_t *)vdb->buf_act == vdb->buf1 ? vdb->buf2 : vdb->buf1;
|
||||
uint8_t * buf_act = (uint8_t *)vdb->buf_act;
|
||||
uint8_t * buf_ina = (uint8_t *)vdb->buf_act == vdb->buf1 ? vdb->buf2 : vdb->buf1;
|
||||
|
||||
lv_coord_t hres = lv_disp_get_hor_res(disp_refr);
|
||||
uint16_t a;
|
||||
for(a = 0; a < disp_refr->inv_p; a++) {
|
||||
if(disp_refr->inv_area_joined[a] == 0) {
|
||||
uint32_t start_offs =
|
||||
(hres * disp_refr->inv_areas[a].y1 + disp_refr->inv_areas[a].x1) * sizeof(lv_color_t);
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
lv_gpu_stm32_dma2d_copy((lv_color_t *)(buf_act + start_offs), disp_refr->driver.hor_res,
|
||||
(lv_color_t *)(buf_ina + start_offs), disp_refr->driver.hor_res,
|
||||
lv_area_get_width(&disp_refr->inv_areas[a]),
|
||||
lv_area_get_height(&disp_refr->inv_areas[a]));
|
||||
#else
|
||||
lv_coord_t hres = lv_disp_get_hor_res(disp_refr);
|
||||
uint16_t a;
|
||||
for(a = 0; a < disp_refr->inv_p; a++) {
|
||||
if(disp_refr->inv_area_joined[a] == 0) {
|
||||
uint32_t start_offs =
|
||||
(hres * disp_refr->inv_areas[a].y1 + disp_refr->inv_areas[a].x1) * sizeof(lv_color_t);
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
lv_gpu_stm32_dma2d_copy((lv_color_t *)(buf_act + start_offs), disp_refr->driver.hor_res,
|
||||
(lv_color_t *)(buf_ina + start_offs), disp_refr->driver.hor_res,
|
||||
lv_area_get_width(&disp_refr->inv_areas[a]),
|
||||
lv_area_get_height(&disp_refr->inv_areas[a]));
|
||||
#else
|
||||
|
||||
lv_coord_t y;
|
||||
uint32_t line_length = lv_area_get_width(&disp_refr->inv_areas[a]) * sizeof(lv_color_t);
|
||||
lv_coord_t y;
|
||||
uint32_t line_length = lv_area_get_width(&disp_refr->inv_areas[a]) * sizeof(lv_color_t);
|
||||
|
||||
for(y = disp_refr->inv_areas[a].y1; y <= disp_refr->inv_areas[a].y2; y++) {
|
||||
/* The frame buffer is probably in an external RAM where sequential access is much faster.
|
||||
* So first copy a line into a buffer and write it back the ext. RAM */
|
||||
_lv_memcpy(copy_buf, buf_ina + start_offs, line_length);
|
||||
_lv_memcpy(buf_act + start_offs, copy_buf, line_length);
|
||||
start_offs += hres * sizeof(lv_color_t);
|
||||
for(y = disp_refr->inv_areas[a].y1; y <= disp_refr->inv_areas[a].y2; y++) {
|
||||
/* The frame buffer is probably in an external RAM where sequential access is much faster.
|
||||
* So first copy a line into a buffer and write it back the ext. RAM */
|
||||
_lv_memcpy(copy_buf, buf_ina + start_offs, line_length);
|
||||
_lv_memcpy(buf_act + start_offs, copy_buf, line_length);
|
||||
start_offs += hres * sizeof(lv_color_t);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if(copy_buf) _lv_mem_buf_release(copy_buf);
|
||||
if(copy_buf) _lv_mem_buf_release(copy_buf);
|
||||
}
|
||||
} /*End of true double buffer handling*/
|
||||
|
||||
/*Clean up*/
|
||||
|
||||
@@ -72,7 +72,7 @@ lv_disp_t * _lv_refr_get_disp_refreshing(void);
|
||||
|
||||
/**
|
||||
* Set the display which is being refreshed.
|
||||
* It shouldn1t be used directly by the user.
|
||||
* It shouldn't be used directly by the user.
|
||||
* It can be used to trick the drawing functions about there is an active display.
|
||||
* @param the display being refreshed
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_obj.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_mem.h"
|
||||
#include "../lv_misc/lv_anim.h"
|
||||
|
||||
@@ -1003,6 +1002,45 @@ lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop
|
||||
else return LV_RES_INV;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a style is valid (initialized correctly)
|
||||
* @param style pointer to a style
|
||||
* @return true: valid
|
||||
*/
|
||||
bool lv_debug_check_style(const lv_style_t * style)
|
||||
{
|
||||
if(style == NULL) return true; /*NULL style is still valid*/
|
||||
|
||||
#if LV_USE_ASSERT_STYLE
|
||||
if(style->sentinel != LV_DEBUG_STYLE_SENTINEL_VALUE) {
|
||||
LV_LOG_WARN("Invalid style (local variable or not initialized?)");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a style list is valid (initialized correctly)
|
||||
* @param style pointer to a style
|
||||
* @return true: valid
|
||||
*/
|
||||
bool lv_debug_check_style_list(const lv_style_list_t * list)
|
||||
{
|
||||
if(list == NULL) return true; /*NULL list is still valid*/
|
||||
|
||||
#if LV_USE_ASSERT_STYLE
|
||||
if(list->sentinel != LV_DEBUG_STYLE_LIST_SENTINEL_VALUE) {
|
||||
LV_LOG_WARN("Invalid style (local variable or not initialized?)");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -1081,7 +1119,7 @@ static lv_style_t * get_alloc_local_style(lv_style_list_t * list)
|
||||
}
|
||||
lv_style_init(local_style);
|
||||
|
||||
/*Add the local style to the furst place*/
|
||||
/*Add the local style to the first place*/
|
||||
_lv_style_list_add_style(list, local_style);
|
||||
list->has_local = 1;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ extern "C" {
|
||||
#include "../lv_misc/lv_area.h"
|
||||
#include "../lv_misc/lv_anim.h"
|
||||
#include "../lv_misc/lv_types.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw_blend.h"
|
||||
|
||||
/*********************
|
||||
@@ -541,6 +542,19 @@ lv_res_t _lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop
|
||||
*/
|
||||
lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, const void ** res);
|
||||
|
||||
/**
|
||||
* Check whether a style is valid (initialized correctly)
|
||||
* @param style pointer to a style
|
||||
* @return true: valid
|
||||
*/
|
||||
bool lv_debug_check_style(const lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Check whether a style list is valid (initialized correctly)
|
||||
* @param style pointer to a style
|
||||
* @return true: valid
|
||||
*/
|
||||
bool lv_debug_check_style_list(const lv_style_list_t * list);
|
||||
|
||||
/*************************
|
||||
* GLOBAL VARIABLES
|
||||
@@ -562,6 +576,34 @@ lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop
|
||||
#define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_init(&name); lv_style_copy(&name, copy);
|
||||
|
||||
|
||||
|
||||
#if LV_USE_DEBUG
|
||||
|
||||
# ifndef LV_DEBUG_IS_STYLE
|
||||
# define LV_DEBUG_IS_STYLE(style_p) (lv_debug_check_style(style_p))
|
||||
# endif
|
||||
|
||||
# ifndef LV_DEBUG_IS_STYLE_LIST
|
||||
# define LV_DEBUG_IS_STYLE_LIST(list_p) (lv_debug_check_style_list(list_p))
|
||||
# endif
|
||||
|
||||
# if LV_USE_ASSERT_STYLE
|
||||
# ifndef LV_ASSERT_STYLE
|
||||
# define LV_ASSERT_STYLE(style_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE(style_p), "Invalid style", style_p);
|
||||
# endif
|
||||
# ifndef LV_ASSERT_STYLE_LIST
|
||||
# define LV_ASSERT_STYLE_LIST(list_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE_LIST(list_p), "Invalid style list", list_p);
|
||||
# endif
|
||||
# else
|
||||
# define LV_ASSERT_STYLE(style_p) true
|
||||
# define LV_ASSERT_STYLE_LIST(list_p) true
|
||||
# endif
|
||||
|
||||
#else
|
||||
# define LV_ASSERT_STYLE(p) true
|
||||
# define LV_ASSERT_STYLE_LIST(p) true
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
@@ -267,8 +267,10 @@ static void fill_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, con
|
||||
|
||||
for(y = draw_area->y1; y <= draw_area->y2; y++) {
|
||||
for(x = draw_area->x1; x <= draw_area->x2; x++) {
|
||||
disp->driver.set_px_cb(&disp->driver, (void *)disp_buf, disp_w, x, y, color,
|
||||
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
|
||||
if(mask_tmp[x]) {
|
||||
disp->driver.set_px_cb(&disp->driver, (void *)disp_buf, disp_w, x, y, color,
|
||||
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
|
||||
}
|
||||
}
|
||||
mask_tmp += draw_area_w;
|
||||
}
|
||||
@@ -643,8 +645,10 @@ static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
|
||||
|
||||
for(y = draw_area->y1; y <= draw_area->y2; y++) {
|
||||
for(x = draw_area->x1; x <= draw_area->x2; x++) {
|
||||
disp->driver.set_px_cb(&disp->driver, (void *)disp_buf, disp_w, x, y, map_buf_tmp[x],
|
||||
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
|
||||
if(mask_tmp[x]) {
|
||||
disp->driver.set_px_cb(&disp->driver, (void *)disp_buf, disp_w, x, y, map_buf_tmp[x],
|
||||
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
|
||||
}
|
||||
}
|
||||
mask_tmp += draw_area_w;
|
||||
map_buf_tmp += map_w;
|
||||
|
||||
@@ -548,7 +548,9 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
mask_buf[px_i] = 0xFF;
|
||||
}
|
||||
|
||||
#if LV_COLOR_DEPTH == 8
|
||||
#if LV_COLOR_DEPTH == 1
|
||||
c.full = map_px[0];
|
||||
#elif LV_COLOR_DEPTH == 8
|
||||
c.full = map_px[0];
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
c.full = map_px[0] + (map_px[1] << 8);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "../lv_hal/lv_hal_disp.h"
|
||||
#include "../lv_core/lv_refr.h"
|
||||
#include "../lv_misc/lv_bidi.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -206,10 +206,10 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
|
||||
lv_opa_t opa = dsc->opa;
|
||||
|
||||
uint16_t sel_start = dsc->sel_start;
|
||||
uint16_t sel_end = dsc->sel_end;
|
||||
uint32_t sel_start = dsc->sel_start;
|
||||
uint32_t sel_end = dsc->sel_end;
|
||||
if(sel_start > sel_end) {
|
||||
uint16_t tmp = sel_start;
|
||||
uint32_t tmp = sel_start;
|
||||
sel_start = sel_end;
|
||||
sel_end = tmp;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
|
||||
cmd_state_t cmd_state = CMD_STATE_WAIT;
|
||||
uint32_t i;
|
||||
uint16_t par_start = 0;
|
||||
uint32_t par_start = 0;
|
||||
lv_color_t recolor;
|
||||
int32_t letter_w;
|
||||
|
||||
@@ -250,11 +250,11 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
#endif
|
||||
|
||||
while(i < line_end - line_start) {
|
||||
uint16_t logical_char_pos = 0;
|
||||
uint32_t logical_char_pos = 0;
|
||||
if(sel_start != 0xFFFF && sel_end != 0xFFFF) {
|
||||
#if LV_USE_BIDI
|
||||
logical_char_pos = _lv_txt_encoded_get_char_id(txt, line_start);
|
||||
uint16_t t = _lv_txt_encoded_get_char_id(bidi_txt, i);
|
||||
uint32_t t = _lv_txt_encoded_get_char_id(bidi_txt, i);
|
||||
logical_char_pos += _lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, dsc->bidi_dir, t, NULL);
|
||||
#else
|
||||
logical_char_pos = _lv_txt_encoded_get_char_id(txt, line_start + i);
|
||||
|
||||
@@ -33,8 +33,8 @@ typedef struct {
|
||||
lv_opa_t opa;
|
||||
lv_style_int_t line_space;
|
||||
lv_style_int_t letter_space;
|
||||
uint16_t sel_start;
|
||||
uint16_t sel_end;
|
||||
uint32_t sel_start;
|
||||
uint32_t sel_end;
|
||||
lv_coord_t ofs_x;
|
||||
lv_coord_t ofs_y;
|
||||
lv_bidi_dir_t bidi_dir;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "lv_draw_mask.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_misc/lv_log.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_misc/lv_gc.h"
|
||||
|
||||
#if defined(LV_GC_INCLUDE)
|
||||
@@ -95,12 +95,12 @@ int16_t lv_draw_mask_add(void * param, void * custom_id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the added buffers on a line. Used internally by the library's drawing routins.
|
||||
* Apply the added buffers on a line. Used internally by the library's drawing routines.
|
||||
* @param mask_buf store the result mask here. Has to be `len` byte long. Should be initialized with `0xFF`.
|
||||
* @param abs_x absolute X coordinate where the line to calculate start
|
||||
* @param abs_y absolute Y coordinate where the line to calculate start
|
||||
* @param len length of the line to calculate (in pixel count)
|
||||
* @return Oneof these values:
|
||||
* @return One of these values:
|
||||
* - `LV_DRAW_MASK_RES_FULL_TRANSP`: the whole line is transparent. `mask_buf` is not set to zero
|
||||
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
|
||||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
@@ -272,8 +272,8 @@ void lv_draw_mask_line_points_init(lv_draw_mask_line_param_t * param, lv_coord_t
|
||||
/**
|
||||
*Initialize a line mask from a point and an angle.
|
||||
* @param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||
* @param px X coordiante of a point of the line
|
||||
* @param py X coordiante of a point of the line
|
||||
* @param px X coordinate of a point of the line
|
||||
* @param py X coordinate of a point of the line
|
||||
* @param angle right 0 deg, bottom: 90
|
||||
* @param side and element of `lv_draw_mask_line_side_t` to describe which side to keep.
|
||||
* With `LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept
|
||||
@@ -370,7 +370,7 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
|
||||
* @param param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||
* @param rect coordinates of the rectangle to affect (absolute coordinates)
|
||||
* @param radius radius of the rectangle
|
||||
* @param inv: true: keep the pixels inside teh rectangle; keep teh pixels outside of the rectangle
|
||||
* @param inv: true: keep the pixels inside the rectangle; keep the pixels outside of the rectangle
|
||||
*/
|
||||
void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area_t * rect, lv_coord_t radius, bool inv)
|
||||
{
|
||||
|
||||
@@ -190,7 +190,7 @@ int16_t lv_draw_mask_add(void * param, void * custom_id);
|
||||
* @param abs_x absolute X coordinate where the line to calculate start
|
||||
* @param abs_y absolute Y coordinate where the line to calculate start
|
||||
* @param len length of the line to calculate (in pixel count)
|
||||
* @return Oneof these values:
|
||||
* @return One of these values:
|
||||
* - `LV_DRAW_MASK_RES_FULL_TRANSP`: the whole line is transparent. `mask_buf` is not set to zero
|
||||
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
|
||||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
@@ -245,8 +245,8 @@ void lv_draw_mask_line_points_init(lv_draw_mask_line_param_t * param, lv_coord_t
|
||||
/**
|
||||
*Initialize a line mask from a point and an angle.
|
||||
* @param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||
* @param px X coordiante of a point of the line
|
||||
* @param py X coordiante of a point of the line
|
||||
* @param px X coordinate of a point of the line
|
||||
* @param py X coordinate of a point of the line
|
||||
* @param angle right 0 deg, bottom: 90
|
||||
* @param side and element of `lv_draw_mask_line_side_t` to describe which side to keep.
|
||||
* With `LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept
|
||||
@@ -271,7 +271,7 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
|
||||
* @param param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||
* @param rect coordinates of the rectangle to affect (absolute coordinates)
|
||||
* @param radius radius of the rectangle
|
||||
* @param inv: true: keep the pixels inside teh rectangle; keep teh pixels outside of the rectangle
|
||||
* @param inv: true: keep the pixels inside the rectangle; keep the pixels outside of the rectangle
|
||||
*/
|
||||
void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area_t * rect, lv_coord_t radius, bool inv);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "lv_draw_mask.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_core/lv_refr.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -185,10 +185,13 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
/*Create a mask if there is a radius*/
|
||||
lv_opa_t * mask_buf = _lv_mem_buf_get(draw_area_w);
|
||||
|
||||
lv_grad_dir_t grad_dir = dsc->bg_grad_dir;
|
||||
if(dsc->bg_color.full == dsc->bg_grad_color.full) grad_dir = LV_GRAD_DIR_NONE;
|
||||
|
||||
uint16_t other_mask_cnt = lv_draw_mask_get_cnt();
|
||||
bool simple_mode = true;
|
||||
if(other_mask_cnt) simple_mode = false;
|
||||
else if(dsc->bg_grad_dir == LV_GRAD_DIR_HOR) simple_mode = false;
|
||||
else if(grad_dir == LV_GRAD_DIR_HOR) simple_mode = false;
|
||||
|
||||
int16_t mask_rout_id = LV_MASK_ID_INV;
|
||||
|
||||
@@ -201,7 +204,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
if(rout > short_side >> 1) rout = short_side >> 1;
|
||||
|
||||
/*Most simple case: just a plain rectangle*/
|
||||
if(simple_mode && rout == 0 && (dsc->bg_grad_dir == LV_GRAD_DIR_NONE)) {
|
||||
if(simple_mode && rout == 0 && (grad_dir == LV_GRAD_DIR_NONE)) {
|
||||
_lv_blend_fill(clip, &coords_bg,
|
||||
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
|
||||
dsc->bg_blend_mode);
|
||||
@@ -222,7 +225,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
|
||||
lv_color_t * grad_map = NULL;
|
||||
/*In case of horizontal gradient pre-compute a line with a gradient*/
|
||||
if(dsc->bg_grad_dir == LV_GRAD_DIR_HOR && dsc->bg_color.full != dsc->bg_grad_color.full) {
|
||||
if(grad_dir == LV_GRAD_DIR_HOR) {
|
||||
grad_map = _lv_mem_buf_get(coords_w * sizeof(lv_color_t));
|
||||
|
||||
int32_t i;
|
||||
@@ -267,12 +270,12 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
}
|
||||
|
||||
/*Get the current line color*/
|
||||
if(dsc->bg_grad_dir == LV_GRAD_DIR_VER && dsc->bg_color.full != dsc->bg_grad_color.full) {
|
||||
if(grad_dir == LV_GRAD_DIR_VER) {
|
||||
grad_color = grad_get(dsc, lv_area_get_height(&coords_bg), y - coords_bg.y1);
|
||||
}
|
||||
|
||||
/* If there is not other mask and drawing the corner area split the drawing to corner and middle areas
|
||||
* because it the middle mask shuldn't be taken into account (therefore its faster)*/
|
||||
* because it the middle mask shouldn't be taken into account (therefore its faster)*/
|
||||
if(simple_mode && split &&
|
||||
(y < coords_bg.y1 + rout + 1 ||
|
||||
y > coords_bg.y2 - rout - 1)) {
|
||||
@@ -288,7 +291,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
grad_color, mask_buf, mask_res, opa2, dsc->bg_blend_mode);
|
||||
|
||||
/*Center part*/
|
||||
if(dsc->bg_grad_dir == LV_GRAD_DIR_VER) {
|
||||
if(grad_dir == LV_GRAD_DIR_VER) {
|
||||
fill_area2.x1 = coords_bg.x1 + rout;
|
||||
fill_area2.x2 = coords_bg.x2 - rout;
|
||||
_lv_blend_fill(clip, &fill_area2,
|
||||
@@ -307,10 +310,10 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
|
||||
}
|
||||
else {
|
||||
if(dsc->bg_grad_dir == LV_GRAD_DIR_HOR) {
|
||||
if(grad_dir == LV_GRAD_DIR_HOR) {
|
||||
_lv_blend_map(clip, &fill_area, grad_map, mask_buf, mask_res, opa2, dsc->bg_blend_mode);
|
||||
}
|
||||
else if(dsc->bg_grad_dir == LV_GRAD_DIR_VER) {
|
||||
else if(grad_dir == LV_GRAD_DIR_VER) {
|
||||
_lv_blend_fill(clip, &fill_area,
|
||||
grad_color, mask_buf, mask_res, opa2, dsc->bg_blend_mode);
|
||||
}
|
||||
@@ -323,7 +326,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
fill_area.y2++;
|
||||
}
|
||||
|
||||
if(dsc->bg_grad_dir == LV_GRAD_DIR_NONE && other_mask_cnt == 0 && split) {
|
||||
if(grad_dir == LV_GRAD_DIR_NONE && other_mask_cnt == 0 && split) {
|
||||
/*Central part*/
|
||||
fill_area.x1 = coords_bg.x1 + rout;
|
||||
fill_area.x2 = coords_bg.x2 - rout;
|
||||
|
||||
@@ -60,7 +60,7 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
uint32_t px = dsc->header.w * y * px_size + x * px_size;
|
||||
_lv_memcpy_small(&p_color, &buf_u8[px], sizeof(lv_color_t));
|
||||
#if LV_COLOR_SIZE == 32
|
||||
p_color.ch.alpha = 0xFF; /*Only the color should be get so use a deafult alpha value*/
|
||||
p_color.ch.alpha = 0xFF; /*Only the color should be get so use a default alpha value*/
|
||||
#endif
|
||||
}
|
||||
else if(dsc->header.cf == LV_IMG_CF_INDEXED_1BIT) {
|
||||
@@ -414,7 +414,7 @@ uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
|
||||
#if LV_USE_IMG_TRANSFORM
|
||||
/**
|
||||
* Initialize a descriptor to tranform an image
|
||||
* Initialize a descriptor to transform an image
|
||||
* @param dsc pointer to an `lv_img_transform_dsc_t` variable whose `cfg` field is initialized
|
||||
*/
|
||||
void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
|
||||
@@ -545,7 +545,7 @@ bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc)
|
||||
/*Get the fractional part of the source pixel*/
|
||||
int xs_fract = dsc->tmp.xs & 0xff;
|
||||
int ys_fract = dsc->tmp.ys & 0xff;
|
||||
int32_t xn; /*x neightboor*/
|
||||
int32_t xn; /*x neighbor*/
|
||||
lv_opa_t xr; /*x mix ratio*/
|
||||
|
||||
if(xs_fract < 0x70) {
|
||||
@@ -563,7 +563,7 @@ bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc)
|
||||
xr = 0xFF;
|
||||
}
|
||||
|
||||
int32_t yn; /*x neightboor*/
|
||||
int32_t yn; /*x neighbor*/
|
||||
lv_opa_t yr; /*x mix ratio*/
|
||||
|
||||
if(ys_fract < 0x70) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "lv_img_cache.h"
|
||||
#include "lv_img_decoder.h"
|
||||
#include "lv_draw_img.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_img_decoder.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw_img.h"
|
||||
#include "../lv_misc/lv_ll.h"
|
||||
#include "../lv_misc/lv_color.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*********************/
|
||||
#include "lv_font.h"
|
||||
#include "lv_font_fmt_txt.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_misc/lv_types.h"
|
||||
#include "../lv_misc/lv_log.h"
|
||||
@@ -384,7 +384,7 @@ static inline void decompress_line(uint8_t * out, lv_coord_t w)
|
||||
/**
|
||||
* Read bits from an input buffer. The read can cross byte boundary.
|
||||
* @param in the input buffer to read from.
|
||||
* @param bit_pos index of teh first bit to read.
|
||||
* @param bit_pos index of the first bit to read.
|
||||
* @param len number of bits to read (must be <= 8).
|
||||
* @return the read bits
|
||||
*/
|
||||
|
||||
@@ -135,7 +135,7 @@ typedef struct {
|
||||
2 Get the class of the left and right glyphs as `left_class` and `right_class`
|
||||
left_class = left_class_mapping[glyph_id_left];
|
||||
right_class = right_class_mapping[glyph_id_right];
|
||||
3. value = class_pair_values[(left_class-1)*right_class_cnt + (righ_class-1)]
|
||||
3. value = class_pair_values[(left_class-1)*right_class_cnt + (right_class-1)]
|
||||
*/
|
||||
|
||||
const int8_t * class_pair_values; /*left_class_num * right_class_num value*/
|
||||
@@ -155,7 +155,7 @@ typedef enum {
|
||||
|
||||
/*Describe store additional data for fonts */
|
||||
typedef struct {
|
||||
/*The bitmaps os all glyphs*/
|
||||
/*The bitmaps of all glyphs*/
|
||||
const uint8_t * glyph_bitmap;
|
||||
|
||||
/*Describe the glyphs*/
|
||||
|
||||
@@ -9,7 +9,7 @@ extern "C" {
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
/*-------------------------------
|
||||
* Symbols from FontAwsome font
|
||||
* Symbols from FontAwesome font
|
||||
*-----------------------------*/
|
||||
|
||||
/* In the font converter use this list as range:
|
||||
|
||||
@@ -141,7 +141,7 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
|
||||
* @param buf a buffer where map should be copied
|
||||
* @param buf_w width of the buffer in pixels
|
||||
* @param map an "image" to copy
|
||||
* @param map_w width of teh map in pixels
|
||||
* @param map_w width of the map in pixels
|
||||
* @param copy_w width of the area to copy in pixels (<= buf_w)
|
||||
* @param copy_h height of the area to copy in pixels
|
||||
* @note `map_w - fill_w` is offset to the next line after copy
|
||||
@@ -176,7 +176,7 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
|
||||
* @param buf_w width of the buffer in pixels
|
||||
* @param map an "image" to copy
|
||||
* @param opa opacity of `map`
|
||||
* @param map_w width of teh map in pixels
|
||||
* @param map_w width of the map in pixels
|
||||
* @param copy_w width of the area to copy in pixels (<= buf_w)
|
||||
* @param copy_h height of the area to copy in pixels
|
||||
* @note `map_w - fill_w` is offset to the next line after copy
|
||||
|
||||
@@ -60,7 +60,7 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
|
||||
* @param buf a buffer where map should be copied
|
||||
* @param buf_w width of the buffer in pixels
|
||||
* @param map an "image" to copy
|
||||
* @param map_w width of teh map in pixels
|
||||
* @param map_w width of the map in pixels
|
||||
* @param copy_w width of the area to copy in pixels (<= buf_w)
|
||||
* @param copy_h height of the area to copy in pixels
|
||||
* @note `map_w - fill_w` is offset to the next line after copy
|
||||
@@ -73,7 +73,7 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
|
||||
* @param buf_w width of the buffer in pixels
|
||||
* @param map an "image" to copy
|
||||
* @param opa opacity of `map`
|
||||
* @param map_w width of teh map in pixels
|
||||
* @param map_w width of the map in pixels
|
||||
* @param copy_w width of the area to copy in pixels (<= buf_w)
|
||||
* @param copy_h height of the area to copy in pixels
|
||||
* @note `map_w - fill_w` is offset to the next line after copy
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "lv_hal.h"
|
||||
#include "../lv_misc/lv_mem.h"
|
||||
#include "../lv_misc/lv_gc.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_core/lv_obj.h"
|
||||
#include "../lv_core/lv_refr.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
@@ -158,6 +158,11 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
|
||||
|
||||
lv_task_ready(disp->refr_task); /*Be sure the screen will be refreshed immediately on start up*/
|
||||
|
||||
/*Can't handle this case later so add an error*/
|
||||
if(lv_disp_is_true_double_buf(disp) && disp->driver.set_px_cb) {
|
||||
LV_LOG_ERROR("Can't handle 2 screen sized buffers with set_px_cb. Display will not be refreshed.");
|
||||
}
|
||||
|
||||
return disp;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_hal/lv_hal_indev.h"
|
||||
#include "../lv_core/lv_indev.h"
|
||||
#include "../lv_misc/lv_mem.h"
|
||||
@@ -73,7 +73,7 @@ lv_indev_t * lv_indev_drv_register(lv_indev_drv_t * driver)
|
||||
if(driver->disp == NULL) driver->disp = lv_disp_get_default();
|
||||
|
||||
if(driver->disp == NULL) {
|
||||
LV_LOG_WARN("lv_indev_drv_register: no display registered hence can't attache the indev to "
|
||||
LV_LOG_WARN("lv_indev_drv_register: no display registered hence can't attach the indev to "
|
||||
"a display");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ typedef struct _lv_indev_proc_t {
|
||||
lv_point_t drag_sum; /*Count the dragged pixels to check LV_INDEV_DEF_DRAG_LIMIT*/
|
||||
lv_point_t drag_throw_vect;
|
||||
struct _lv_obj_t * act_obj; /*The object being pressed*/
|
||||
struct _lv_obj_t * last_obj; /*The last obejct which was pressed (used by dragthrow and
|
||||
struct _lv_obj_t * last_obj; /*The last object which was pressed (used by drag_throw and
|
||||
other post-release event)*/
|
||||
struct _lv_obj_t * last_pressed; /*The lastly pressed object*/
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#if LV_USE_ANIMATION
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_hal/lv_hal_tick.h"
|
||||
#include "lv_task.h"
|
||||
#include "lv_math.h"
|
||||
@@ -64,7 +64,7 @@ void _lv_anim_core_init(void)
|
||||
last_task_run = lv_tick_get();
|
||||
_lv_anim_task = lv_task_create(anim_task, LV_DISP_DEF_REFR_PERIOD, LV_ANIM_TASK_PRIO, NULL);
|
||||
anim_mark_list_change(); /*Turn off the animation task*/
|
||||
anim_list_changed = false; /*The list has not actaully changed*/
|
||||
anim_list_changed = false; /*The list has not actually changed*/
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,6 @@ void _lv_anim_core_init(void)
|
||||
* lv_anim_t a;
|
||||
* lv_anim_init(&a);
|
||||
* lv_anim_set_...(&a);
|
||||
* lv_anim_craete(&a);
|
||||
* @param a pointer to an `lv_anim_t` variable to initialize
|
||||
*/
|
||||
void lv_anim_init(lv_anim_t * a)
|
||||
@@ -501,7 +500,7 @@ static void anim_task(lv_task_t * param)
|
||||
* Called when an animation is ready to do the necessary thinks
|
||||
* e.g. repeat, play back, delete etc.
|
||||
* @param a pointer to an animation descriptor
|
||||
* @return true: animation delete occurred nnd the `LV_GC_ROOT(_lv_anim_ll)` has changed
|
||||
* @return true: animation delete occurred and the `LV_GC_ROOT(_lv_anim_ll)` has changed
|
||||
* */
|
||||
static bool anim_ready_handler(lv_anim_t * a)
|
||||
{
|
||||
@@ -529,11 +528,11 @@ static bool anim_ready_handler(lv_anim_t * a)
|
||||
}
|
||||
/*If the animation is not deleted then restart it*/
|
||||
else {
|
||||
a->act_time = -a->repeat_delay; /*Restart the animation*/
|
||||
a->act_time = -(int32_t)(a->repeat_delay); /*Restart the animation*/
|
||||
/*Swap the start and end values in play back mode*/
|
||||
if(a->playback_time != 0) {
|
||||
/*If now turning back use the 'playback_pause*/
|
||||
if(a->playback_now == 0) a->act_time = -a->playback_delay;
|
||||
if(a->playback_now == 0) a->act_time = -(int32_t)(a->playback_delay);
|
||||
|
||||
/*Toggle the play back state*/
|
||||
a->playback_now = a->playback_now == 0 ? 1 : 0;
|
||||
|
||||
@@ -116,7 +116,6 @@ void _lv_anim_core_init(void);
|
||||
* lv_anim_t a;
|
||||
* lv_anim_init(&a);
|
||||
* lv_anim_set_...(&a);
|
||||
* lv_anim_create(&a);
|
||||
* @param a pointer to an `lv_anim_t` variable to initialize
|
||||
*/
|
||||
void lv_anim_init(lv_anim_t * a);
|
||||
@@ -160,7 +159,7 @@ static inline void lv_anim_set_time(lv_anim_t * a, uint32_t duration)
|
||||
*/
|
||||
static inline void lv_anim_set_delay(lv_anim_t * a, uint32_t delay)
|
||||
{
|
||||
a->act_time = (int32_t)(-delay);
|
||||
a->act_time = -(int32_t)(delay);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@ struct _lv_obj_t;
|
||||
/**
|
||||
* Call an asynchronous function the next time lv_task_handler() is run. This function is likely to return
|
||||
* **before** the call actually happens!
|
||||
* @param task_xcb a callback which is the task itself.
|
||||
* @param async_xcb a callback which is the task itself.
|
||||
* (the 'x' in the argument name indicates that its not a fully generic function because it not follows
|
||||
* the `func_name(object, callback, ...)` convention)
|
||||
* @param user_data custom parameter
|
||||
|
||||
@@ -130,8 +130,8 @@ lv_bidi_dir_t _lv_bidi_detect_base_dir(const char * txt)
|
||||
* Can be `NULL` is unused
|
||||
* @param len length of the line in character count
|
||||
* @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL`
|
||||
* @param vicual_pos the visual character position which logical position should be get
|
||||
* @param is_rtl tell the the char at `viasual_pos` is RTL or LTR context
|
||||
* @param visual_pos the visual character position which logical position should be get
|
||||
* @param is_rtl tell the the char at `visual_pos` is RTL or LTR context
|
||||
* @return the logical character position
|
||||
*/
|
||||
uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_bidi_dir_t base_dir,
|
||||
@@ -207,7 +207,7 @@ uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t
|
||||
* Bidi process a paragraph of text
|
||||
* @param str_in the string to process
|
||||
* @param str_out store the result here
|
||||
* @param len length of teh text
|
||||
* @param len length of the text
|
||||
* @param base_dir base dir of the text
|
||||
* @param pos_conv_out an `uint16_t` array to store the related logical position of the character.
|
||||
* Can be `NULL` is unused
|
||||
|
||||
@@ -71,8 +71,8 @@ lv_bidi_dir_t _lv_bidi_detect_base_dir(const char * txt);
|
||||
* Can be `NULL` is unused
|
||||
* @param len length of the line in character count
|
||||
* @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL`
|
||||
* @param vicual_pos the visual character position which logical position should be get
|
||||
* @param is_rtl tell the the char at `viasual_pos` is RTL or LTR context
|
||||
* @param visual_pos the visual character position which logical position should be get
|
||||
* @param is_rtl tell the the char at `visual_pos` is RTL or LTR context
|
||||
* @return the logical character position
|
||||
*/
|
||||
uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_bidi_dir_t base_dir,
|
||||
@@ -97,7 +97,7 @@ uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t
|
||||
* Bidi process a paragraph of text
|
||||
* @param str_in the string to process
|
||||
* @param str_out store the result here
|
||||
* @param len length of teh text
|
||||
* @param len length of the text
|
||||
* @param base_dir base dir of the text
|
||||
* @param pos_conv_out an `uint16_t` array to store the related logical position of the character.
|
||||
* Can be `NULL` is unused
|
||||
|
||||
@@ -72,8 +72,8 @@ enum {
|
||||
LV_OPA_COVER = 255,
|
||||
};
|
||||
|
||||
#define LV_OPA_MIN 5 /*Opacities below this will be transparent*/
|
||||
#define LV_OPA_MAX 250 /*Opacities above this will fully cover*/
|
||||
#define LV_OPA_MIN 2 /*Opacities below this will be transparent*/
|
||||
#define LV_OPA_MAX 253 /*Opacities above this will fully cover*/
|
||||
|
||||
#if LV_COLOR_DEPTH == 1
|
||||
#define LV_COLOR_SIZE 8
|
||||
|
||||
@@ -6,11 +6,13 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_obj.h"
|
||||
#include "lv_debug.h"
|
||||
|
||||
#if LV_USE_DEBUG
|
||||
|
||||
#include "lv_mem.h"
|
||||
#include <string.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
@@ -28,7 +30,6 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -54,68 +55,6 @@ bool lv_debug_check_mem_integrity(void)
|
||||
return lv_mem_test() == LV_RES_OK ? true : false;
|
||||
}
|
||||
|
||||
bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type)
|
||||
{
|
||||
if(obj_type[0] == '\0') return true;
|
||||
|
||||
lv_obj_type_t types;
|
||||
lv_obj_get_type((lv_obj_t *)obj, &types);
|
||||
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM; i++) {
|
||||
if(types.type[i] == NULL) break;
|
||||
if(strcmp(types.type[i], obj_type) == 0) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool lv_debug_check_obj_valid(const lv_obj_t * obj)
|
||||
{
|
||||
lv_disp_t * disp = lv_disp_get_next(NULL);
|
||||
while(disp) {
|
||||
lv_obj_t * scr;
|
||||
_LV_LL_READ(disp->scr_ll, scr) {
|
||||
|
||||
if(scr == obj) return true;
|
||||
bool found = obj_valid_child(scr, obj);
|
||||
if(found) return true;
|
||||
}
|
||||
|
||||
disp = lv_disp_get_next(disp);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool lv_debug_check_style(const lv_style_t * style)
|
||||
{
|
||||
if(style == NULL) return true; /*NULL style is still valid*/
|
||||
|
||||
#if LV_USE_ASSERT_STYLE
|
||||
if(style->sentinel != LV_DEBUG_STYLE_SENTINEL_VALUE) {
|
||||
LV_LOG_WARN("Invalid style (local variable or not initialized?)");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool lv_debug_check_style_list(const lv_style_list_t * list)
|
||||
{
|
||||
if(list == NULL) return true; /*NULL list is still valid*/
|
||||
|
||||
#if LV_USE_ASSERT_STYLE
|
||||
if(list->sentinel != LV_DEBUG_STYLE_LIST_SENTINEL_VALUE) {
|
||||
LV_LOG_WARN("Invalid style (local variable or not initialized?)");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool lv_debug_check_str(const void * str)
|
||||
{
|
||||
const uint8_t * s = (const uint8_t *)str;
|
||||
@@ -196,20 +135,6 @@ void lv_debug_log_error(const char * msg, uint64_t value)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find)
|
||||
{
|
||||
/*Check all children of `parent`*/
|
||||
lv_obj_t * child;
|
||||
_LV_LL_READ(parent->child_ll, child) {
|
||||
if(child == obj_to_find) return true;
|
||||
|
||||
/*Check the children*/
|
||||
bool found = obj_valid_child(child, obj_to_find);
|
||||
if(found) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif /*LV_USE_DEBUG*/
|
||||
|
||||
@@ -13,9 +13,10 @@ extern "C" {
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_obj.h"
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_DEBUG
|
||||
#include <stdbool.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -32,14 +33,6 @@ bool lv_debug_check_null(const void * p);
|
||||
|
||||
bool lv_debug_check_mem_integrity(void);
|
||||
|
||||
bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type);
|
||||
|
||||
bool lv_debug_check_obj_valid(const lv_obj_t * obj);
|
||||
|
||||
bool lv_debug_check_style(const lv_style_t * style);
|
||||
|
||||
bool lv_debug_check_style_list(const lv_style_list_t * list);
|
||||
|
||||
bool lv_debug_check_str(const void * str);
|
||||
|
||||
void lv_debug_log_error(const char * msg, uint64_t value);
|
||||
@@ -77,20 +70,6 @@ void lv_debug_log_error(const char * msg, uint64_t value);
|
||||
lv_debug_check_str(str))
|
||||
#endif
|
||||
|
||||
#ifndef LV_DEBUG_IS_OBJ
|
||||
#define LV_DEBUG_IS_OBJ(obj_p, obj_type) (lv_debug_check_null(obj_p) && \
|
||||
lv_debug_check_obj_valid(obj_p) && \
|
||||
lv_debug_check_obj_type(obj_p, obj_type))
|
||||
#endif
|
||||
|
||||
#ifndef LV_DEBUG_IS_STYLE
|
||||
#define LV_DEBUG_IS_STYLE(style_p) (lv_debug_check_style(style_p))
|
||||
#endif
|
||||
|
||||
#ifndef LV_DEBUG_IS_STYLE_LIST
|
||||
#define LV_DEBUG_IS_STYLE_LIST(list_p) (lv_debug_check_style_list(list_p))
|
||||
#endif
|
||||
|
||||
/*-----------------
|
||||
* ASSERTS
|
||||
*-----------------*/
|
||||
@@ -133,30 +112,6 @@ void lv_debug_log_error(const char * msg, uint64_t value);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if LV_USE_ASSERT_OBJ
|
||||
# ifndef LV_ASSERT_OBJ
|
||||
# define LV_ASSERT_OBJ(obj_p, obj_type) LV_DEBUG_ASSERT(LV_DEBUG_IS_OBJ(obj_p, obj_type), "Invalid object", obj_p);
|
||||
# endif
|
||||
#else /* LV_USE_ASSERT_OBJ == 0 */
|
||||
# if LV_USE_ASSERT_NULL /*Use at least LV_ASSERT_NULL if enabled*/
|
||||
# define LV_ASSERT_OBJ(obj_p, obj_type) LV_ASSERT_NULL(obj_p)
|
||||
# else
|
||||
# define LV_ASSERT_OBJ(obj_p, obj_type) true
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if LV_USE_ASSERT_STYLE
|
||||
# ifndef LV_ASSERT_STYLE
|
||||
# define LV_ASSERT_STYLE(style_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE(style_p), "Invalid style", style_p);
|
||||
# endif
|
||||
# ifndef LV_ASSERT_STYLE_LIST
|
||||
# define LV_ASSERT_STYLE_LIST(list_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE_LIST(list_p), "Invalid style list", list_p);
|
||||
# endif
|
||||
#else
|
||||
# define LV_ASSERT_STYLE(style_p) true
|
||||
# define LV_ASSERT_STYLE_LIST(list_p) true
|
||||
#endif
|
||||
|
||||
#else /* LV_USE_DEBUG == 0 */
|
||||
|
||||
@@ -167,8 +122,6 @@ void lv_debug_log_error(const char * msg, uint64_t value);
|
||||
#define LV_ASSERT_MEM_INTEGRITY() true
|
||||
#define LV_ASSERT_STR(p) true
|
||||
#define LV_ASSERT_OBJ(obj, obj_type) true
|
||||
#define LV_ASSERT_STYLE(p) true
|
||||
#define LV_ASSERT_STYLE_LIST(p) true
|
||||
|
||||
#endif /* LV_USE_DEBUG */
|
||||
/*clang-format on*/
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_fs.h"
|
||||
#if LV_USE_FILESYSTEM
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "lv_ll.h"
|
||||
#include <string.h>
|
||||
#include "lv_gc.h"
|
||||
@@ -60,7 +60,7 @@ void _lv_fs_init(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a drive is rady or not. If the `ready` function was not initialized `true` will be
|
||||
* Test if a drive is ready or not. If the `ready` function was not initialized `true` will be
|
||||
* returned.
|
||||
* @param letter letter of the drive
|
||||
* @return true: drive is ready; false: drive is not ready
|
||||
|
||||
@@ -129,7 +129,7 @@ void lv_fs_drv_register(lv_fs_drv_t * drv_p);
|
||||
lv_fs_drv_t * lv_fs_get_drv(char letter);
|
||||
|
||||
/**
|
||||
* Test if a drive is rady or not. If the `ready` function was not initialized `true` will be
|
||||
* Test if a drive is ready or not. If the `ready` function was not initialized `true` will be
|
||||
* returned.
|
||||
* @param letter letter of the drive
|
||||
* @return true: drive is ready; false: drive is not ready
|
||||
|
||||
@@ -51,18 +51,12 @@ void _lv_ll_init(lv_ll_t * ll_p, uint32_t node_size)
|
||||
{
|
||||
ll_p->head = NULL;
|
||||
ll_p->tail = NULL;
|
||||
#ifdef LV_MEM_ENV64
|
||||
#ifdef LV_ARCH_64
|
||||
/*Round the size up to 8*/
|
||||
if(node_size & 0x7) {
|
||||
node_size = node_size & (~0x7);
|
||||
node_size += 8;
|
||||
}
|
||||
node_size = (node_size + 7) & (~0x7);
|
||||
#else
|
||||
/*Round the size up to 4*/
|
||||
if(node_size & 0x3) {
|
||||
node_size = node_size & (~0x3);
|
||||
node_size += 4;
|
||||
}
|
||||
node_size = (node_size + 3) & (~0x3);
|
||||
#endif
|
||||
|
||||
ll_p->n_size = node_size;
|
||||
@@ -140,7 +134,7 @@ void * _lv_ll_ins_tail(lv_ll_t * ll_p)
|
||||
|
||||
if(n_new != NULL) {
|
||||
node_set_next(ll_p, n_new, NULL); /*No next after the new tail*/
|
||||
node_set_prev(ll_p, n_new, ll_p->tail); /*The prev. before new is tho old tail*/
|
||||
node_set_prev(ll_p, n_new, ll_p->tail); /*The prev. before new is the old tail*/
|
||||
if(ll_p->tail != NULL) { /*If there is old tail then the new comes after it*/
|
||||
node_set_next(ll_p, ll_p->tail, n_new);
|
||||
}
|
||||
@@ -339,7 +333,7 @@ uint32_t _lv_ll_get_len(const lv_ll_t * ll_p)
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a nodw before an other node in the same linked list
|
||||
* Move a node before an other node in the same linked list
|
||||
* @param ll_p pointer to a linked list
|
||||
* @param n_act pointer to node to move
|
||||
* @param n_after pointer to a node which should be after `n_act`
|
||||
@@ -401,14 +395,13 @@ static void node_set_prev(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * pre
|
||||
if(act == NULL) return; /*Can't set the prev node of `NULL`*/
|
||||
|
||||
uint8_t * act8 = (uint8_t *) act;
|
||||
uint8_t * prev8 = (uint8_t *) &prev;
|
||||
|
||||
act8 += LL_PREV_P_OFFSET(ll_p);
|
||||
|
||||
uint32_t i;
|
||||
for(i = 0; i < sizeof(lv_ll_node_t *); i++) {
|
||||
act8[i] = prev8[i];
|
||||
}
|
||||
lv_ll_node_t ** act_node_p = (lv_ll_node_t **) act8;
|
||||
lv_ll_node_t ** prev_node_p = (lv_ll_node_t **) &prev;
|
||||
|
||||
*act_node_p = *prev_node_p;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -421,12 +414,10 @@ static void node_set_next(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * nex
|
||||
{
|
||||
if(act == NULL) return; /*Can't set the next node of `NULL`*/
|
||||
uint8_t * act8 = (uint8_t *) act;
|
||||
uint8_t * prev8 = (uint8_t *) &next;
|
||||
|
||||
act8 += LL_NEXT_P_OFFSET(ll_p);
|
||||
lv_ll_node_t ** act_node_p = (lv_ll_node_t **) act8;
|
||||
lv_ll_node_t ** next_node_p = (lv_ll_node_t **) &next;
|
||||
|
||||
uint32_t i;
|
||||
for(i = 0; i < sizeof(lv_ll_node_t *); i++) {
|
||||
act8[i] = prev8[i];
|
||||
}
|
||||
*act_node_p = *next_node_p;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ void lv_ll_swap(lv_ll_t * ll_p, void * n1_p, void * n2_p);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Move a nodw before an other node in the same linked list
|
||||
* Move a node before an other node in the same linked list
|
||||
* @param ll_p pointer to a linked list
|
||||
* @param n_act pointer to node to move
|
||||
* @param n_after pointer to a node which should be after `n_act`
|
||||
|
||||
@@ -45,7 +45,7 @@ static lv_log_print_g_cb_t custom_print_cb;
|
||||
/**
|
||||
* Register custom print/write function to call when a log is added.
|
||||
* It can format its "File path", "Line number" and "Description" as required
|
||||
* and send the formatted log message to a consol or serial port.
|
||||
* and send the formatted log message to a console or serial port.
|
||||
* @param print_cb a function pointer to print a log
|
||||
*/
|
||||
void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb)
|
||||
|
||||
@@ -56,7 +56,7 @@ typedef void (*lv_log_print_g_cb_t)(lv_log_level_t level, const char *, uint32_t
|
||||
/**
|
||||
* Register custom print/write function to call when a log is added.
|
||||
* It can format its "File path", "Line number" and "Description" as required
|
||||
* and send the formatted log message to a consol or serial port.
|
||||
* and send the formatted log message to a console or serial port.
|
||||
* @param print_cb a function pointer to print a log
|
||||
*/
|
||||
void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb);
|
||||
|
||||
@@ -103,7 +103,7 @@ int32_t _lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3)
|
||||
|
||||
/**
|
||||
* Get the square root of a number
|
||||
* @param x integer which square root should be calculatoed
|
||||
* @param x integer which square root should be calculated
|
||||
* @param q store the result here. q->i: integer part, q->f: fractional part in 1/256 unit
|
||||
* @param mask: optional to skip some iterations if the magnitude of the root is known.
|
||||
* Set to 0x8000 by default.
|
||||
|
||||
@@ -92,7 +92,7 @@ uint16_t _lv_atan2(int x, int y);
|
||||
|
||||
/**
|
||||
* Get the square root of a number
|
||||
* @param x integer which square root should be calculatoed
|
||||
* @param x integer which square root should be calculated
|
||||
* @param q store the result here. q->i: integer part, q->f: fractional part in 1/256 unit
|
||||
* @param mask: optional to skip some iterations if the magnitude of the root is known.
|
||||
* Set to 0x8000 by default.
|
||||
|
||||
@@ -108,7 +108,7 @@ static lv_mem_buf_t mem_buf_small[] = {{.p = mem_buf1_32, .size = MEM_BUF_SMALL_
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initiaiize the dyn_mem module (work memory and other variables)
|
||||
* Initialize the dyn_mem module (work memory and other variables)
|
||||
*/
|
||||
void _lv_mem_init(void)
|
||||
{
|
||||
@@ -157,16 +157,10 @@ void * lv_mem_alloc(size_t size)
|
||||
|
||||
#ifdef LV_ARCH_64
|
||||
/*Round the size up to 8*/
|
||||
if(size & 0x7) {
|
||||
size = size & (~0x7);
|
||||
size += 8;
|
||||
}
|
||||
size = (size + 7) & (~0x7);
|
||||
#else
|
||||
/*Round the size up to 4*/
|
||||
if(size & 0x3) {
|
||||
size = size & (~0x3);
|
||||
size += 4;
|
||||
}
|
||||
size = (size + 3) & (~0x3);
|
||||
#endif
|
||||
void * alloc = NULL;
|
||||
|
||||
@@ -281,16 +275,10 @@ void * lv_mem_realloc(void * data_p, size_t new_size)
|
||||
|
||||
#ifdef LV_ARCH_64
|
||||
/*Round the size up to 8*/
|
||||
if(new_size & 0x7) {
|
||||
new_size = new_size & (~0x7);
|
||||
new_size += 8;
|
||||
}
|
||||
new_size = (new_size + 7) & (~0x7);
|
||||
#else
|
||||
/*Round the size up to 4*/
|
||||
if(new_size & 0x3) {
|
||||
new_size = new_size & (~0x3);
|
||||
new_size += 4;
|
||||
}
|
||||
new_size = (new_size + 3) & (~0x3);
|
||||
#endif
|
||||
|
||||
/*data_p could be previously freed pointer (in this case it is invalid)*/
|
||||
@@ -525,14 +513,13 @@ void * _lv_mem_buf_get(uint32_t size)
|
||||
/*if this fails you probably need to increase your LV_MEM_SIZE/heap size*/
|
||||
LV_GC_ROOT(_lv_mem_buf[i]).p = lv_mem_realloc(LV_GC_ROOT(_lv_mem_buf[i]).p, size);
|
||||
if(LV_GC_ROOT(_lv_mem_buf[i]).p == NULL) {
|
||||
LV_LOG_ERROR("lv_mem_buf_get: Out of memory, can't allocate a new buffer (increase your LV_MEM_SIZE/heap size)")
|
||||
LV_DEBUG_ASSERT(false, "Out of memory, can't allocate a new buffer (increase your LV_MEM_SIZE/heap size", 0x00);
|
||||
}
|
||||
return LV_GC_ROOT(_lv_mem_buf[i]).p;
|
||||
}
|
||||
}
|
||||
|
||||
LV_LOG_ERROR("lv_mem_buf_get: no free buffer. Increase LV_DRAW_BUF_MAX_NUM.");
|
||||
|
||||
LV_DEBUG_ASSERT(false, "No free buffer. Increase LV_DRAW_BUF_MAX_NUM.", 0x00);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -858,18 +845,13 @@ static void * ent_alloc(lv_mem_ent_t * e, size_t size)
|
||||
*/
|
||||
static void ent_trunc(lv_mem_ent_t * e, size_t size)
|
||||
{
|
||||
|
||||
#ifdef LV_ARCH_64
|
||||
/*Round the size up to 8*/
|
||||
if(size & 0x7) {
|
||||
size = size & (~0x7);
|
||||
size += 8;
|
||||
}
|
||||
size = (size + 7) & (~0x7);
|
||||
#else
|
||||
/*Round the size up to 4*/
|
||||
if(size & 0x3) {
|
||||
size = size & (~0x3);
|
||||
size += 4;
|
||||
}
|
||||
size = (size + 3) & (~0x3);
|
||||
#endif
|
||||
|
||||
/*Don't let empty space only for a header without data*/
|
||||
|
||||
@@ -59,7 +59,7 @@ extern lv_mem_buf_arr_t _lv_mem_buf;
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initiaize the dyn_mem module (work memory and other variables)
|
||||
* Initialize the dyn_mem module (work memory and other variables)
|
||||
*/
|
||||
void _lv_mem_init(void);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ CSRCS += lv_utils.c
|
||||
CSRCS += lv_async.c
|
||||
CSRCS += lv_printf.c
|
||||
CSRCS += lv_bidi.c
|
||||
CSRCS += lv_debug.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*********************/
|
||||
#include <stddef.h>
|
||||
#include "lv_task.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_hal/lv_hal_tick.h"
|
||||
#include "lv_gc.h"
|
||||
|
||||
@@ -193,9 +193,9 @@ LV_ATTRIBUTE_TASK_HANDLER uint32_t lv_task_handler(void)
|
||||
return time_till_next;
|
||||
}
|
||||
/**
|
||||
* Create an "empty" task. It needs to initialzed with at least
|
||||
* Create an "empty" task. It needs to initialized with at least
|
||||
* `lv_task_set_cb` and `lv_task_set_period`
|
||||
* @return pointer to the craeted task
|
||||
* @return pointer to the created task
|
||||
*/
|
||||
lv_task_t * lv_task_create_basic(void)
|
||||
{
|
||||
@@ -256,13 +256,13 @@ lv_task_t * lv_task_create_basic(void)
|
||||
* @param user_data custom parameter
|
||||
* @return pointer to the new task
|
||||
*/
|
||||
lv_task_t * lv_task_create(lv_task_cb_t task_cb, uint32_t period, lv_task_prio_t prio, void * user_data)
|
||||
lv_task_t * lv_task_create(lv_task_cb_t task_xcb, uint32_t period, lv_task_prio_t prio, void * user_data)
|
||||
{
|
||||
lv_task_t * new_task = lv_task_create_basic();
|
||||
LV_ASSERT_MEM(new_task);
|
||||
if(new_task == NULL) return NULL;
|
||||
|
||||
lv_task_set_cb(new_task, task_cb);
|
||||
lv_task_set_cb(new_task, task_xcb);
|
||||
lv_task_set_period(new_task, period);
|
||||
lv_task_set_prio(new_task, prio);
|
||||
new_task->user_data = user_data;
|
||||
@@ -273,7 +273,7 @@ lv_task_t * lv_task_create(lv_task_cb_t task_cb, uint32_t period, lv_task_prio_t
|
||||
/**
|
||||
* Set the callback the task (the function to call periodically)
|
||||
* @param task pointer to a task
|
||||
* @param task_cb teh function to call periodically
|
||||
* @param task_cb the function to call periodically
|
||||
*/
|
||||
void lv_task_set_cb(lv_task_t * task, lv_task_cb_t task_cb)
|
||||
{
|
||||
|
||||
@@ -88,9 +88,9 @@ LV_ATTRIBUTE_TASK_HANDLER uint32_t lv_task_handler(void);
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
* Create an "empty" task. It needs to initialzed with at least
|
||||
* Create an "empty" task. It needs to initialized with at least
|
||||
* `lv_task_set_cb` and `lv_task_set_period`
|
||||
* @return pointer to the craeted task
|
||||
* @return pointer to the created task
|
||||
*/
|
||||
lv_task_t * lv_task_create_basic(void);
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ void _lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t
|
||||
*
|
||||
* If the first character is a break character, returns the next index.
|
||||
*
|
||||
* Example calls from lv_txt_get_next_line() assuming sufficent max_width and
|
||||
* Example calls from lv_txt_get_next_line() assuming sufficient max_width and
|
||||
* txt = "Test text\n"
|
||||
* 0123456789
|
||||
*
|
||||
@@ -169,7 +169,7 @@ void _lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t
|
||||
* @param force Force return the fraction of the word that can fit in the provided space.
|
||||
* @return the index of the first char of the next word (in byte index not letter index. With UTF-8 they are different)
|
||||
*/
|
||||
static uint16_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
|
||||
static uint32_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
|
||||
lv_coord_t letter_space, lv_coord_t max_width,
|
||||
lv_txt_flag_t flag, uint32_t * word_w_ptr, lv_txt_cmd_state_t * cmd_state, bool force)
|
||||
{
|
||||
@@ -290,7 +290,7 @@ static uint16_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
|
||||
* @param flags settings for the text from 'txt_flag_type' enum
|
||||
* @return the index of the first char of the new line (in byte index not letter index. With UTF-8 they are different)
|
||||
*/
|
||||
uint16_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font,
|
||||
uint32_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font,
|
||||
lv_coord_t letter_space, lv_coord_t max_width, lv_txt_flag_t flag)
|
||||
{
|
||||
if(txt == NULL) return 0;
|
||||
@@ -350,7 +350,7 @@ uint16_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font,
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
* @return length of a char_num long text
|
||||
*/
|
||||
lv_coord_t _lv_txt_get_width(const char * txt, uint16_t length, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_coord_t _lv_txt_get_width(const char * txt, uint32_t length, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_txt_flag_t flag)
|
||||
{
|
||||
if(txt == NULL) return 0;
|
||||
|
||||
@@ -84,7 +84,7 @@ void _lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t
|
||||
* @return the index of the first char of the new line (in byte index not letter index. With UTF-8
|
||||
* they are different)
|
||||
*/
|
||||
uint16_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t max_width,
|
||||
uint32_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t max_width,
|
||||
lv_txt_flag_t flag);
|
||||
|
||||
/**
|
||||
@@ -97,11 +97,11 @@ uint16_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coor
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
* @return length of a char_num long text
|
||||
*/
|
||||
lv_coord_t _lv_txt_get_width(const char * txt, uint16_t length, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_coord_t _lv_txt_get_width(const char * txt, uint32_t length, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_txt_flag_t flag);
|
||||
|
||||
/**
|
||||
* Check next character in a string and decide if te character is part of the command or not
|
||||
* 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
|
||||
* @param c the current character
|
||||
|
||||
@@ -734,6 +734,10 @@ static void list_init(void)
|
||||
lv_style_set_border_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_primary);
|
||||
lv_style_set_border_width(&styles->list_btn, LV_STATE_DEFAULT, 1);
|
||||
|
||||
lv_style_set_outline_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_secondary);
|
||||
lv_style_set_outline_width(&styles->list_btn, LV_STATE_FOCUSED, BORDER_WIDTH);
|
||||
lv_style_set_outline_pad(&styles->list_btn, LV_STATE_FOCUSED, -BORDER_WIDTH);
|
||||
|
||||
lv_style_set_pad_left(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_right(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_top(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||
@@ -741,9 +745,10 @@ static void list_init(void)
|
||||
lv_style_set_pad_inner(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||
|
||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_DEFAULT, - PAD_DEF);
|
||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_PRESSED, 0);
|
||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_CHECKED, 0);
|
||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_DISABLED, 0);
|
||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_PRESSED, -BORDER_WIDTH);
|
||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_CHECKED, -BORDER_WIDTH);
|
||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_DISABLED, -BORDER_WIDTH);
|
||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_FOCUSED, - BORDER_WIDTH);
|
||||
|
||||
lv_style_set_transition_time(&styles->list_btn, LV_STATE_DEFAULT, TRANSITION_TIME);
|
||||
lv_style_set_transition_prop_6(&styles->list_btn, LV_STATE_DEFAULT, LV_STYLE_BG_COLOR);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_arc.h"
|
||||
#if LV_USE_ARC != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_draw/lv_draw_arc.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "lv_bar.h"
|
||||
#if LV_USE_BAR != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_misc/lv_anim.h"
|
||||
@@ -148,7 +148,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
* Set a new value on the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param value new value
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediatelly
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim)
|
||||
{
|
||||
@@ -175,7 +175,7 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim)
|
||||
* Set a new start value on the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param value new start value
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediatelly
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
void lv_bar_set_start_value(lv_obj_t * bar, int16_t start_value, lv_anim_enable_t anim)
|
||||
{
|
||||
|
||||
@@ -114,7 +114,7 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim);
|
||||
* Set a new start value on the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param value new start value
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediatelly
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
void lv_bar_set_start_value(lv_obj_t * bar, int16_t start_value, lv_anim_enable_t anim);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include "../lv_core/lv_group.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_misc/lv_area.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_btnmatrix.h"
|
||||
#if LV_USE_BTNMATRIX != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_core/lv_group.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_core/lv_refr.h"
|
||||
@@ -568,7 +568,7 @@ bool lv_btnmatrix_get_one_check(const lv_obj_t * btnm)
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Handle the drawing related tasks of the button matrixs
|
||||
* Handle the drawing related tasks of the button matrix
|
||||
* @param btnm pointer to a button matrix object
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
@@ -821,11 +821,11 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
|
||||
}
|
||||
#endif
|
||||
|
||||
if(ext->btn_id_act != LV_BTNMATRIX_BTN_NONE) {
|
||||
if(button_is_click_trig(ext->ctrl_bits[ext->btn_id_act]) == false &&
|
||||
button_is_inactive(ext->ctrl_bits[ext->btn_id_act]) == false &&
|
||||
button_is_hidden(ext->ctrl_bits[ext->btn_id_act]) == false) {
|
||||
uint32_t b = ext->btn_id_act;
|
||||
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {
|
||||
if(button_is_click_trig(ext->ctrl_bits[ext->btn_id_pr]) == false &&
|
||||
button_is_inactive(ext->ctrl_bits[ext->btn_id_pr]) == false &&
|
||||
button_is_hidden(ext->ctrl_bits[ext->btn_id_pr]) == false) {
|
||||
uint32_t b = ext->btn_id_pr;
|
||||
res = lv_event_send(btnm, LV_EVENT_VALUE_CHANGED, &b);
|
||||
}
|
||||
}
|
||||
@@ -844,21 +844,22 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
|
||||
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {
|
||||
invalidate_button_area(btnm, ext->btn_id_pr);
|
||||
}
|
||||
|
||||
ext->btn_id_pr = btn_pr;
|
||||
ext->btn_id_act = btn_pr;
|
||||
|
||||
lv_indev_reset_long_press(param); /*Start the log press time again on the new button*/
|
||||
if(btn_pr != LV_BTNMATRIX_BTN_NONE &&
|
||||
button_is_inactive(ext->ctrl_bits[btn_pr]) == false &&
|
||||
button_is_hidden(ext->ctrl_bits[btn_pr]) == false) {
|
||||
/* Send VALUE_CHANGED for the newly pressed button */
|
||||
uint32_t b = ext->btn_id_act;
|
||||
uint32_t b = btn_pr;
|
||||
res = lv_event_send(btnm, LV_EVENT_VALUE_CHANGED, &b);
|
||||
if(res == LV_RES_OK) {
|
||||
invalidate_button_area(btnm, btn_pr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext->btn_id_pr = btn_pr;
|
||||
ext->btn_id_act = btn_pr;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_RELEASED) {
|
||||
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {
|
||||
@@ -924,6 +925,7 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
|
||||
/*In navigation mode don't select any button but in edit mode select the fist*/
|
||||
if(lv_group_get_editing(lv_obj_get_group(btnm))) {
|
||||
ext->btn_id_focused = 0;
|
||||
ext->btn_id_act = ext->btn_id_focused;
|
||||
}
|
||||
else {
|
||||
ext->btn_id_focused = LV_BTNMATRIX_BTN_NONE;
|
||||
@@ -931,9 +933,9 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
|
||||
}
|
||||
else if(indev_type == LV_INDEV_TYPE_KEYPAD) {
|
||||
ext->btn_id_focused = 0;
|
||||
ext->btn_id_act = ext->btn_id_focused;
|
||||
}
|
||||
|
||||
ext->btn_id_act = ext->btn_id_focused;
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_LEAVE) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_calendar.h"
|
||||
#if LV_USE_CALENDAR != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_hal/lv_hal_indev.h"
|
||||
#include "../lv_misc/lv_utils.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*********************/
|
||||
#include <stdlib.h>
|
||||
#include "lv_canvas.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_core/lv_refr.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_chart.h"
|
||||
#if LV_USE_CHART != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_core/lv_refr.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
@@ -203,9 +203,9 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color)
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the point of a serie
|
||||
* Clear the point of a series
|
||||
* @param chart pointer to a chart object
|
||||
* @param serie pointer to the chart's serie to clear
|
||||
* @param serie pointer to the chart's series to clear
|
||||
*/
|
||||
void lv_chart_clear_serie(lv_obj_t * chart, lv_chart_series_t * serie)
|
||||
{
|
||||
@@ -650,9 +650,10 @@ static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
lv_coord_t ** datal;
|
||||
_LV_LL_READ(ext->series_ll, datal) {
|
||||
lv_mem_free(*datal);
|
||||
lv_chart_series_t * ser;
|
||||
_LV_LL_READ(ext->series_ll, ser) {
|
||||
lv_mem_free(ser->points);
|
||||
lv_mem_free(ser);
|
||||
}
|
||||
_lv_ll_clear(&ext->series_ll);
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
/*No inherited ext*/ /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_ll_t series_ll; /*Linked list for the data line pointers (stores lv_chart_dl_t)*/
|
||||
lv_ll_t series_ll; /*Linked list for the data line pointers (stores lv_chart_series_t)*/
|
||||
lv_coord_t ymin; /*y min value (used to scale the data)*/
|
||||
lv_coord_t ymax; /*y max value (used to scale the data)*/
|
||||
uint8_t hdiv_cnt; /*Number of horizontal division lines*/
|
||||
@@ -126,9 +126,9 @@ 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);
|
||||
|
||||
/**
|
||||
* Clear the point of a serie
|
||||
* Clear the point of a series
|
||||
* @param chart pointer to a chart object
|
||||
* @param serie pointer to the chart's serie to clear
|
||||
* @param serie pointer to the chart's series to clear
|
||||
*/
|
||||
void lv_chart_clear_serie(lv_obj_t * chart, lv_chart_series_t * serie);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_checkbox.h"
|
||||
#if LV_USE_CHECKBOX != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_core/lv_group.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_draw/lv_draw_mask.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "lv_cpicker.h"
|
||||
#if LV_USE_CPICKER != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw_arc.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_core/lv_indev.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_dropdown.h"
|
||||
#if LV_USE_DROPDOWN != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_core/lv_group.h"
|
||||
#include "../lv_core/lv_indev.h"
|
||||
@@ -208,7 +208,7 @@ void lv_dropdown_set_options(lv_obj_t * ddlist, const char * options)
|
||||
|
||||
/*Count the '\n'-s to determine the number of options*/
|
||||
ext->option_cnt = 0;
|
||||
uint16_t i;
|
||||
uint32_t i;
|
||||
for(i = 0; options[i] != '\0'; i++) {
|
||||
if(options[i] == '\n') ext->option_cnt++;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ void lv_dropdown_set_options(lv_obj_t * ddlist, const char * options)
|
||||
/**
|
||||
* Set the options in a drop down list from a string
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param options a staic string with '\n' separated options. E.g. "One\nTwo\nThree"
|
||||
* @param options a static string with '\n' separated options. E.g. "One\nTwo\nThree"
|
||||
*/
|
||||
void lv_dropdown_set_options_static(lv_obj_t * ddlist, const char * options)
|
||||
{
|
||||
@@ -248,7 +248,7 @@ void lv_dropdown_set_options_static(lv_obj_t * ddlist, const char * options)
|
||||
|
||||
/*Count the '\n'-s to determine the number of options*/
|
||||
ext->option_cnt = 0;
|
||||
uint16_t i;
|
||||
uint32_t i;
|
||||
for(i = 0; options[i] != '\0'; i++) {
|
||||
if(options[i] == '\n') ext->option_cnt++;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ void lv_dropdown_set_options_static(lv_obj_t * ddlist, const char * options)
|
||||
* @param option a string without '\n'. E.g. "Four"
|
||||
* @param pos the insert position, indexed from 0, LV_DROPDOWN_POS_LAST = end of string
|
||||
*/
|
||||
void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint16_t pos)
|
||||
void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint32_t pos)
|
||||
{
|
||||
LV_ASSERT_OBJ(ddlist, LV_OBJX_NAME);
|
||||
LV_ASSERT_STR(option);
|
||||
@@ -302,9 +302,9 @@ void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint16_t pos
|
||||
ext->options[old_len] = 0;
|
||||
|
||||
/*Find the insert character position*/
|
||||
uint16_t insert_pos = old_len;
|
||||
uint32_t insert_pos = old_len;
|
||||
if(pos != LV_DROPDOWN_POS_LAST) {
|
||||
int opcnt = 0;
|
||||
uint32_t opcnt = 0;
|
||||
for(insert_pos = 0; ext->options[insert_pos] != 0; insert_pos++) {
|
||||
if(opcnt == pos)
|
||||
break;
|
||||
@@ -489,21 +489,21 @@ uint16_t lv_dropdown_get_option_cnt(const lv_obj_t * ddlist)
|
||||
* @param buf pointer to an array to store the string
|
||||
* @param buf_size size of `buf` in bytes. 0: to ignore it.
|
||||
*/
|
||||
void lv_dropdown_get_selected_str(const lv_obj_t * ddlist, char * buf, uint16_t buf_size)
|
||||
void lv_dropdown_get_selected_str(const lv_obj_t * ddlist, char * buf, uint32_t buf_size)
|
||||
{
|
||||
LV_ASSERT_OBJ(ddlist, LV_OBJX_NAME);
|
||||
|
||||
lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
|
||||
uint16_t i;
|
||||
uint16_t line = 0;
|
||||
uint32_t i;
|
||||
uint32_t line = 0;
|
||||
size_t txt_len = strlen(ext->options);
|
||||
|
||||
for(i = 0; i < txt_len && line != ext->sel_opt_id_orig; i++) {
|
||||
if(ext->options[i] == '\n') line++;
|
||||
}
|
||||
|
||||
uint16_t c;
|
||||
uint32_t c;
|
||||
for(c = 0; i < txt_len && ext->options[i] != '\n'; c++, i++) {
|
||||
if(buf_size && c >= buf_size - 1) {
|
||||
LV_LOG_WARN("lv_dropdown_get_selected_str: the buffer was too small")
|
||||
@@ -586,10 +586,10 @@ void lv_dropdown_open(lv_obj_t * ddlist)
|
||||
|
||||
ext->page = lv_page_create(lv_obj_get_screen(ddlist), NULL);
|
||||
lv_obj_add_protect(ext->page, LV_PROTECT_POS | LV_PROTECT_CLICK_FOCUS);
|
||||
lv_obj_add_protect(lv_page_get_scrllable(ext->page), LV_PROTECT_CLICK_FOCUS);
|
||||
lv_obj_add_protect(lv_page_get_scrollable(ext->page), LV_PROTECT_CLICK_FOCUS);
|
||||
|
||||
if(ancestor_page_signal == NULL) ancestor_page_signal = lv_obj_get_signal_cb(ext->page);
|
||||
if(ancestor_page_scrl_signal == NULL) ancestor_page_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrllable(
|
||||
if(ancestor_page_scrl_signal == NULL) ancestor_page_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrollable(
|
||||
ext->page));
|
||||
if(ancestor_page_design == NULL) ancestor_page_design = lv_obj_get_design_cb(ext->page);
|
||||
|
||||
@@ -604,7 +604,7 @@ void lv_dropdown_open(lv_obj_t * ddlist)
|
||||
|
||||
lv_obj_set_design_cb(ext->page, lv_dropdown_page_design);
|
||||
lv_obj_set_signal_cb(ext->page, lv_dropdown_page_signal);
|
||||
lv_obj_set_signal_cb(lv_page_get_scrllable(ext->page), lv_dropdown_page_scrl_signal);
|
||||
lv_obj_set_signal_cb(lv_page_get_scrollable(ext->page), lv_dropdown_page_scrl_signal);
|
||||
|
||||
lv_style_list_copy(lv_obj_get_style_list(ext->page, LV_PAGE_PART_BG), &ext->style_page);
|
||||
lv_style_list_copy(lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCROLLBAR), &ext->style_scrlbar);
|
||||
@@ -935,6 +935,9 @@ static lv_res_t lv_dropdown_signal(lv_obj_t * ddlist, lv_signal_t sign, void * p
|
||||
lv_dropdown_close(ddlist);
|
||||
if(ext->sel_opt_id_orig != ext->sel_opt_id) {
|
||||
ext->sel_opt_id_orig = ext->sel_opt_id;
|
||||
uint32_t id = ext->sel_opt_id; /*Just to use uint32_t in event data*/
|
||||
res = lv_event_send(ddlist, LV_EVENT_VALUE_CHANGED, &id);
|
||||
if(res != LV_RES_OK) return res;
|
||||
lv_obj_invalidate(ddlist);
|
||||
}
|
||||
#if LV_USE_GROUP
|
||||
@@ -1020,10 +1023,10 @@ static lv_res_t lv_dropdown_page_signal(lv_obj_t * page, lv_signal_t sign, void
|
||||
if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
|
||||
/* Make possible to draw on the full width of the background to redraw the selected rectangle
|
||||
* when the ddlist is scrolled in fix height mode.
|
||||
* (The scrollabel is scrolled the "select rectangle" is drawn on the bg too)*/
|
||||
* (The scrollable is scrolled then "select rectangle" is drawn on the bg too)*/
|
||||
lv_style_int_t left = lv_obj_get_style_pad_left(ddlist, LV_DROPDOWN_PART_LIST);
|
||||
lv_style_int_t right = lv_obj_get_style_pad_right(ddlist, LV_DROPDOWN_PART_LIST);
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(page);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(page);
|
||||
scrl->ext_draw_pad = LV_MATH_MAX3(scrl->ext_draw_pad, left, right);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_RELEASED) {
|
||||
@@ -1078,7 +1081,7 @@ static lv_res_t lv_dropdown_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign,
|
||||
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
|
||||
/* Make possible to draw on the full width of the background to redraw the selected rectangle
|
||||
* when the ddlist is scrolled in fix height mode.
|
||||
* (The scrollabel is scrolled the "select rectangle" is drawn on the bg too)*/
|
||||
* (The scrollable is scrolled then "select rectangle" is drawn on the bg too)*/
|
||||
lv_style_int_t left = lv_obj_get_style_pad_left(ddlist, LV_DROPDOWN_PART_LIST);
|
||||
lv_style_int_t right = lv_obj_get_style_pad_right(ddlist, LV_DROPDOWN_PART_LIST);
|
||||
scrl->ext_draw_pad = LV_MATH_MAX3(scrl->ext_draw_pad, left, right);
|
||||
@@ -1266,7 +1269,7 @@ static uint16_t get_id_on_point(lv_obj_t * ddlist, lv_coord_t x, lv_coord_t y)
|
||||
if(label == NULL) return 0;
|
||||
x -= label->coords.x1;
|
||||
y -= label->coords.y1;
|
||||
uint16_t letter_i;
|
||||
uint32_t letter_i;
|
||||
|
||||
lv_point_t p = {x, y};
|
||||
letter_i = lv_label_get_letter_on(label, &p);
|
||||
@@ -1297,7 +1300,7 @@ static void position_to_selected(lv_obj_t * ddlist)
|
||||
|
||||
const lv_font_t * font = lv_obj_get_style_text_font(ddlist, LV_DROPDOWN_PART_LIST);
|
||||
lv_coord_t font_h = lv_font_get_line_height(font);
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(ext->page);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(ext->page);
|
||||
lv_obj_t * label = get_label(ddlist);
|
||||
if(label == NULL) return;
|
||||
|
||||
@@ -1317,7 +1320,7 @@ static lv_obj_t * get_label(const lv_obj_t * ddlist)
|
||||
lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
if(ext->page == NULL) return NULL;
|
||||
|
||||
return lv_obj_get_child(lv_page_get_scrllable(ext->page), NULL);
|
||||
return lv_obj_get_child(lv_page_get_scrollable(ext->page), NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -125,7 +125,7 @@ void lv_dropdown_set_options_static(lv_obj_t * ddlist, const char * options);
|
||||
* @param option a string without '\n'. E.g. "Four"
|
||||
* @param pos the insert position, indexed from 0, LV_DROPDOWN_POS_LAST = end of string
|
||||
*/
|
||||
void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint16_t pos);
|
||||
void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint32_t pos);
|
||||
|
||||
/**
|
||||
* Set the selected option
|
||||
@@ -201,7 +201,7 @@ uint16_t lv_dropdown_get_option_cnt(const lv_obj_t * ddlist);
|
||||
* @param buf pointer to an array to store the string
|
||||
* @param buf_size size of `buf` in bytes. 0: to ignore it.
|
||||
*/
|
||||
void lv_dropdown_get_selected_str(const lv_obj_t * ddlist, char * buf, uint16_t buf_size);
|
||||
void lv_dropdown_get_selected_str(const lv_obj_t * ddlist, char * buf, uint32_t buf_size);
|
||||
|
||||
/**
|
||||
* Get the fix height value.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_gauge.h"
|
||||
#if LV_USE_GAUGE != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_misc/lv_txt.h"
|
||||
@@ -519,7 +519,7 @@ static void lv_gauge_draw_labels(lv_obj_t * gauge, const lv_area_t * mask)
|
||||
lv_coord_t y_ofs = gauge->coords.y1 + r + top + scale_width + txt_pad;
|
||||
int16_t scale_angle = lv_linemeter_get_scale_angle(gauge);
|
||||
uint16_t label_num = ext->label_count;
|
||||
int16_t angle_ofs = 90 + (360 - scale_angle) / 2;
|
||||
int16_t angle_ofs = 90 + (360 - scale_angle) / 2 + lv_gauge_get_angle_offset(gauge);
|
||||
int32_t min = lv_gauge_get_min_value(gauge);
|
||||
int32_t max = lv_gauge_get_max_value(gauge);
|
||||
|
||||
@@ -578,7 +578,7 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * clip_area)
|
||||
lv_coord_t x_ofs = gauge->coords.x1 + r + left + pad;
|
||||
lv_coord_t y_ofs = gauge->coords.y1 + r + top + pad;
|
||||
uint16_t angle = lv_linemeter_get_scale_angle(gauge);
|
||||
int16_t angle_ofs = 90 + (360 - angle) / 2;
|
||||
int16_t angle_ofs = 90 + (360 - angle) / 2 + lv_gauge_get_angle_offset(gauge);
|
||||
int16_t min = lv_gauge_get_min_value(gauge);
|
||||
int16_t max = lv_gauge_get_max_value(gauge);
|
||||
lv_point_t p_mid;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#error "lv_img: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
|
||||
#endif
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_draw/lv_img_decoder.h"
|
||||
#include "../lv_misc/lv_fs.h"
|
||||
|
||||
@@ -39,7 +39,7 @@ typedef struct {
|
||||
lv_coord_t h; /*Height of the image (Handled by the library)*/
|
||||
uint16_t angle; /*rotation angle of the image*/
|
||||
lv_point_t pivot; /*rotation center of the image*/
|
||||
uint16_t zoom; /*256 means no zoom, 512 double size, 128 hasl size*/
|
||||
uint16_t zoom; /*256 means no zoom, 512 double size, 128 half size*/
|
||||
uint8_t src_type : 2; /*See: lv_img_src_t*/
|
||||
uint8_t auto_size : 1; /*1: automatically set the object size to the image size*/
|
||||
uint8_t cf : 5; /*Color format from `lv_img_color_format_t`*/
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "lv_imgbtn.h"
|
||||
#include "lv_label.h"
|
||||
@@ -350,7 +350,7 @@ static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * cli
|
||||
clip_center_area.y2 = coords.y2;
|
||||
|
||||
bool comm_res;
|
||||
comm_res = lv_area_intersect(&clip_center_area, &clip_center_area, clip_area);
|
||||
comm_res = _lv_area_intersect(&clip_center_area, &clip_center_area, clip_area);
|
||||
if(comm_res) {
|
||||
lv_coord_t obj_w = lv_obj_get_width(imgbtn);
|
||||
lv_coord_t i;
|
||||
@@ -430,7 +430,7 @@ static void refr_img(lv_obj_t * imgbtn)
|
||||
|
||||
if(info_res == LV_RES_OK) {
|
||||
ext->act_cf = header.cf;
|
||||
if(ext->tiled) lv_obj_set_height(imgbtn, header.h); /*Keep the suer defined width*/
|
||||
if(ext->tiled) lv_obj_set_height(imgbtn, header.h); /*Keep the sure defined width*/
|
||||
else lv_obj_set_size(imgbtn, header.w, header.h);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -180,7 +180,7 @@ static inline lv_btn_state_t lv_imgbtn_get_state(const lv_obj_t * imgbtn)
|
||||
/**
|
||||
* Get the toggle enable attribute of the image button
|
||||
* @param imgbtn pointer to a image button object
|
||||
* @return ture: toggle enabled, false: disabled
|
||||
* @return true: toggle enabled, false: disabled
|
||||
*/
|
||||
static inline bool lv_imgbtn_get_checkable(const lv_obj_t * imgbtn)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "lv_keyboard.h"
|
||||
#if LV_USE_KEYBOARD != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "lv_textarea.h"
|
||||
|
||||
|
||||
@@ -8,9 +8,8 @@
|
||||
*********************/
|
||||
#include "lv_label.h"
|
||||
#if LV_USE_LABEL != 0
|
||||
|
||||
#include "../lv_core/lv_obj.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_core/lv_group.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_misc/lv_color.h"
|
||||
@@ -51,7 +50,7 @@ static void lv_label_revert_dots(lv_obj_t * label);
|
||||
static void lv_label_set_offset_y(lv_obj_t * label, lv_coord_t y);
|
||||
#endif
|
||||
|
||||
static bool lv_label_set_dot_tmp(lv_obj_t * label, char * data, uint16_t len);
|
||||
static bool lv_label_set_dot_tmp(lv_obj_t * label, char * data, uint32_t len);
|
||||
static char * lv_label_get_dot_tmp(lv_obj_t * label);
|
||||
static void lv_label_dot_tmp_free(lv_obj_t * label);
|
||||
static void get_txt_coords(const lv_obj_t * label, lv_area_t * area);
|
||||
@@ -152,7 +151,7 @@ lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
if(copy_ext->dot_tmp_alloc && copy_ext->dot.tmp_ptr) {
|
||||
uint16_t len = (uint16_t)strlen(copy_ext->dot.tmp_ptr);
|
||||
uint32_t len = (uint32_t)strlen(copy_ext->dot.tmp_ptr);
|
||||
lv_label_set_dot_tmp(new_label, ext->dot.tmp_ptr, len);
|
||||
}
|
||||
else {
|
||||
@@ -414,7 +413,7 @@ 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 colo codes in text needs to
|
||||
lv_label_refr_text(label); /*Refresh the text because the potential color codes in text needs to
|
||||
be hided or revealed*/
|
||||
}
|
||||
|
||||
@@ -442,7 +441,7 @@ void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed)
|
||||
#endif
|
||||
}
|
||||
|
||||
void lv_label_set_text_sel_start(lv_obj_t * label, uint16_t index)
|
||||
void lv_label_set_text_sel_start(lv_obj_t * label, uint32_t index)
|
||||
{
|
||||
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
|
||||
|
||||
@@ -456,7 +455,7 @@ void lv_label_set_text_sel_start(lv_obj_t * label, uint16_t index)
|
||||
#endif
|
||||
}
|
||||
|
||||
void lv_label_set_text_sel_end(lv_obj_t * label, uint16_t index)
|
||||
void lv_label_set_text_sel_end(lv_obj_t * label, uint32_t index)
|
||||
{
|
||||
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
|
||||
|
||||
@@ -567,15 +566,22 @@ uint16_t lv_label_get_anim_speed(const lv_obj_t * label)
|
||||
* index (different in UTF-8)
|
||||
* @param pos store the result here (E.g. index = 0 gives 0;0 coordinates)
|
||||
*/
|
||||
void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t char_id, lv_point_t * pos)
|
||||
void lv_label_get_letter_pos(const lv_obj_t * label, uint32_t char_id, lv_point_t * pos)
|
||||
{
|
||||
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
|
||||
LV_ASSERT_NULL(pos);
|
||||
|
||||
const char * txt = lv_label_get_text(label);
|
||||
|
||||
if(txt[0] == '\0') {
|
||||
pos->x = 0;
|
||||
pos->y = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
lv_area_t txt_coords;
|
||||
get_txt_coords(label, &txt_coords);
|
||||
|
||||
const char * txt = lv_label_get_text(label);
|
||||
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
|
||||
uint32_t line_start = 0;
|
||||
uint32_t new_line_start = 0;
|
||||
@@ -595,7 +601,7 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t char_id, lv_point_
|
||||
if(align == LV_LABEL_ALIGN_CENTER) flag |= LV_TXT_FLAG_CENTER;
|
||||
if(align == LV_LABEL_ALIGN_RIGHT) flag |= LV_TXT_FLAG_RIGHT;
|
||||
|
||||
uint16_t byte_id = _lv_txt_encoded_get_byte_id(txt, char_id);
|
||||
uint32_t byte_id = _lv_txt_encoded_get_byte_id(txt, char_id);
|
||||
|
||||
/*Search the line of the index letter */;
|
||||
while(txt[new_line_start] != '\0') {
|
||||
@@ -616,7 +622,7 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t char_id, lv_point_
|
||||
}
|
||||
|
||||
const char * bidi_txt;
|
||||
uint16_t visual_byte_pos;
|
||||
uint32_t visual_byte_pos;
|
||||
#if LV_USE_BIDI
|
||||
char * mutable_bidi_txt = NULL;
|
||||
/*Handle Bidi*/
|
||||
@@ -625,10 +631,10 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t char_id, lv_point_
|
||||
bidi_txt = &txt[line_start];
|
||||
}
|
||||
else {
|
||||
uint16_t line_char_id = _lv_txt_encoded_get_char_id(&txt[line_start], byte_id - line_start);
|
||||
uint32_t line_char_id = _lv_txt_encoded_get_char_id(&txt[line_start], byte_id - line_start);
|
||||
|
||||
bool is_rtl;
|
||||
uint16_t visual_char_pos = _lv_bidi_get_visual_pos(&txt[line_start], &mutable_bidi_txt, new_line_start - line_start,
|
||||
uint32_t visual_char_pos = _lv_bidi_get_visual_pos(&txt[line_start], &mutable_bidi_txt, new_line_start - line_start,
|
||||
lv_obj_get_base_dir(label), line_char_id, &is_rtl);
|
||||
bidi_txt = mutable_bidi_txt;
|
||||
if(is_rtl) visual_char_pos++;
|
||||
@@ -672,7 +678,7 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t char_id, lv_point_
|
||||
* @return the index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter)
|
||||
* Expressed in character index and not byte index (different in UTF-8)
|
||||
*/
|
||||
uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
|
||||
uint32_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
|
||||
{
|
||||
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
|
||||
LV_ASSERT_NULL(pos);
|
||||
@@ -690,7 +696,7 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
|
||||
lv_coord_t letter_height = lv_font_get_line_height(font);
|
||||
lv_coord_t y = 0;
|
||||
lv_txt_flag_t flag = LV_TXT_FLAG_NONE;
|
||||
uint16_t logical_pos;
|
||||
uint32_t logical_pos;
|
||||
char * bidi_txt;
|
||||
|
||||
if(ext->recolor != 0) flag |= LV_TXT_FLAG_RECOLOR;
|
||||
@@ -721,7 +727,7 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
|
||||
|
||||
#if LV_USE_BIDI
|
||||
bidi_txt = _lv_mem_buf_get(new_line_start - line_start + 1);
|
||||
uint16_t txt_len = new_line_start - line_start;
|
||||
uint32_t txt_len = new_line_start - line_start;
|
||||
if(new_line_start > 0 && txt[new_line_start - 1] == '\0' && txt_len > 0) txt_len--;
|
||||
_lv_bidi_process_paragraph(txt + line_start, bidi_txt, txt_len, lv_obj_get_base_dir(label), NULL, 0);
|
||||
#else
|
||||
@@ -761,13 +767,14 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
|
||||
}
|
||||
}
|
||||
|
||||
x += lv_font_get_glyph_width(font, letter, letter_next);
|
||||
lv_coord_t gw = lv_font_get_glyph_width(font, letter, letter_next);
|
||||
|
||||
/*Finish if the x position or the last char of the line is reached*/
|
||||
if(pos->x < x || i + line_start == new_line_start || txt[i + line_start] == '\0') {
|
||||
/*Finish if the x position or the last char of the next line is reached*/
|
||||
if(pos->x < x + (gw >> 1) || i + line_start == new_line_start || txt[i_act + line_start] == '\0') {
|
||||
i = i_act;
|
||||
break;
|
||||
}
|
||||
x += gw;
|
||||
x += letter_space;
|
||||
i_act = i;
|
||||
}
|
||||
@@ -775,11 +782,16 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
|
||||
|
||||
#if LV_USE_BIDI
|
||||
/*Handle Bidi*/
|
||||
bool is_rtl;
|
||||
logical_pos = _lv_bidi_get_logical_pos(&txt[line_start], NULL, txt_len, lv_obj_get_base_dir(label),
|
||||
_lv_txt_encoded_get_char_id(bidi_txt, i), &is_rtl);
|
||||
if(is_rtl) logical_pos++;
|
||||
_lv_mem_buf_release(bidi_txt);
|
||||
uint32_t cid = _lv_txt_encoded_get_char_id(bidi_txt, i);
|
||||
if(txt[line_start + cid] == '\0') {
|
||||
logical_pos = i;
|
||||
} else {
|
||||
bool is_rtl;
|
||||
logical_pos = _lv_bidi_get_logical_pos(&txt[line_start], NULL,
|
||||
txt_len, lv_obj_get_base_dir(label), cid, &is_rtl);
|
||||
if(is_rtl) logical_pos++;
|
||||
_lv_mem_buf_release(bidi_txt);
|
||||
}
|
||||
#else
|
||||
logical_pos = _lv_txt_encoded_get_char_id(bidi_txt, i);
|
||||
#endif
|
||||
@@ -792,7 +804,7 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
|
||||
* @param label pointer to a label object.
|
||||
* @return selection start index. `LV_LABEL_TXT_SEL_OFF` if nothing is selected.
|
||||
*/
|
||||
uint16_t lv_label_get_text_sel_start(const lv_obj_t * label)
|
||||
uint32_t lv_label_get_text_sel_start(const lv_obj_t * label)
|
||||
{
|
||||
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
|
||||
|
||||
@@ -811,7 +823,7 @@ uint16_t lv_label_get_text_sel_start(const lv_obj_t * label)
|
||||
* @param label pointer to a label object.
|
||||
* @return selection end index. `LV_LABEL_TXT_SEL_OFF` if nothing is selected.
|
||||
*/
|
||||
uint16_t lv_label_get_text_sel_end(const lv_obj_t * label)
|
||||
uint32_t lv_label_get_text_sel_end(const lv_obj_t * label)
|
||||
{
|
||||
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
|
||||
|
||||
@@ -827,7 +839,7 @@ uint16_t lv_label_get_text_sel_end(const lv_obj_t * label)
|
||||
/**
|
||||
* Check if a character is drawn under a point.
|
||||
* @param label Label object
|
||||
* @param pos Point to check for characte under
|
||||
* @param pos Point to check for character under
|
||||
* @return whether a character is drawn under the point
|
||||
*/
|
||||
bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos)
|
||||
@@ -1068,8 +1080,8 @@ 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 addition they will result mis-alignment is this case)*/
|
||||
/* In SCROLL and SCROLL_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)) {
|
||||
lv_point_t size;
|
||||
@@ -1449,7 +1461,7 @@ static void lv_label_set_offset_y(lv_obj_t * label, lv_coord_t y)
|
||||
* @param len Number of characters to store.
|
||||
* @return true on success.
|
||||
*/
|
||||
static bool lv_label_set_dot_tmp(lv_obj_t * label, char * data, uint16_t len)
|
||||
static bool lv_label_set_dot_tmp(lv_obj_t * label, char * data, uint32_t len)
|
||||
{
|
||||
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
|
||||
lv_label_dot_tmp_free(label); /* Deallocate any existing space */
|
||||
|
||||
@@ -72,7 +72,7 @@ typedef struct {
|
||||
char tmp[LV_LABEL_DOT_NUM + 1]; /* Directly store the characters if <=4 characters */
|
||||
} dot;
|
||||
|
||||
uint16_t dot_end; /*The text end position in dot mode (Handled by the library)*/
|
||||
uint32_t dot_end; /*The text end position in dot mode (Handled by the library)*/
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
uint16_t anim_speed; /*Speed of scroll and roll animation in px/sec unit*/
|
||||
@@ -85,8 +85,8 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
#if LV_LABEL_TEXT_SEL
|
||||
uint16_t sel_start;
|
||||
uint16_t sel_end;
|
||||
uint32_t sel_start;
|
||||
uint32_t sel_end;
|
||||
#endif
|
||||
|
||||
lv_label_long_mode_t long_mode : 3; /*Determinate what to do with the long texts*/
|
||||
@@ -178,14 +178,14 @@ void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed);
|
||||
* @param label pointer to a label object.
|
||||
* @param index index to set. `LV_LABEL_TXT_SEL_OFF` to select nothing.
|
||||
*/
|
||||
void lv_label_set_text_sel_start(lv_obj_t * label, uint16_t index);
|
||||
void lv_label_set_text_sel_start(lv_obj_t * label, uint32_t index);
|
||||
|
||||
/**
|
||||
* @brief Set the selection end index.
|
||||
* @param label pointer to a label object.
|
||||
* @param index index to set. `LV_LABEL_TXT_SEL_OFF` to select nothing.
|
||||
*/
|
||||
void lv_label_set_text_sel_end(lv_obj_t * label, uint16_t index);
|
||||
void lv_label_set_text_sel_end(lv_obj_t * label, uint32_t index);
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
@@ -233,7 +233,7 @@ uint16_t lv_label_get_anim_speed(const lv_obj_t * label);
|
||||
* index (different in UTF-8)
|
||||
* @param pos store the result here (E.g. index = 0 gives 0;0 coordinates)
|
||||
*/
|
||||
void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t index, lv_point_t * pos);
|
||||
void lv_label_get_letter_pos(const lv_obj_t * label, uint32_t index, lv_point_t * pos);
|
||||
|
||||
/**
|
||||
* Get the index of letter on a relative point of a label
|
||||
@@ -242,12 +242,12 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t index, lv_point_t
|
||||
* @return the index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter)
|
||||
* Expressed in character index and not byte index (different in UTF-8)
|
||||
*/
|
||||
uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos);
|
||||
uint32_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos);
|
||||
|
||||
/**
|
||||
* Check if a character is drawn under a point.
|
||||
* @param label Label object
|
||||
* @param pos Point to check for characte under
|
||||
* @param pos Point to check for character under
|
||||
* @return whether a character is drawn under the point
|
||||
*/
|
||||
bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos);
|
||||
@@ -257,14 +257,14 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos);
|
||||
* @param label pointer to a label object.
|
||||
* @return selection start index. `LV_LABEL_TXT_SEL_OFF` if nothing is selected.
|
||||
*/
|
||||
uint16_t lv_label_get_text_sel_start(const lv_obj_t * label);
|
||||
uint32_t lv_label_get_text_sel_start(const lv_obj_t * label);
|
||||
|
||||
/**
|
||||
* @brief Get the selection end index.
|
||||
* @param label pointer to a label object.
|
||||
* @return selection end index. `LV_LABEL_TXT_SEL_OFF` if nothing is selected.
|
||||
*/
|
||||
uint16_t lv_label_get_text_sel_end(const lv_obj_t * label);
|
||||
uint32_t lv_label_get_text_sel_end(const lv_obj_t * label);
|
||||
|
||||
|
||||
lv_style_list_t * lv_label_get_style(lv_obj_t * label, uint8_t type);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_led.h"
|
||||
#if LV_USE_LED != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_line.h"
|
||||
|
||||
#if LV_USE_LINE != 0
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_linemeter.h"
|
||||
#if LV_USE_LINEMETER != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_core/lv_group.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_list.h"
|
||||
#if LV_USE_LIST != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_core/lv_group.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_misc/lv_anim.h"
|
||||
@@ -94,7 +94,7 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*Init the new list object*/
|
||||
if(copy == NULL) {
|
||||
lv_page_set_anim_time(list, LV_LIST_DEF_ANIM_TIME);
|
||||
lv_page_set_scrllable_fit2(list, LV_FIT_PARENT, LV_FIT_TIGHT);
|
||||
lv_page_set_scrollable_fit2(list, LV_FIT_PARENT, LV_FIT_TIGHT);
|
||||
lv_obj_set_size(list, 2 * LV_DPI, 3 * LV_DPI);
|
||||
lv_page_set_scrl_layout(list, LV_LIST_LAYOUT_DEF);
|
||||
lv_list_set_scrollbar_mode(list, LV_SCROLLBAR_MODE_DRAG);
|
||||
@@ -131,7 +131,7 @@ void lv_list_clean(lv_obj_t * list)
|
||||
{
|
||||
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(list);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(list);
|
||||
lv_obj_clean(scrl);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * t
|
||||
lv_coord_t pos_x_ori = lv_obj_get_x(list);
|
||||
lv_coord_t pos_y_ori = lv_obj_get_y(list);
|
||||
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(list);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(list);
|
||||
lv_obj_add_protect(scrl, LV_PROTECT_CHILD_CHG);
|
||||
|
||||
/*Create a list element with the image an the text*/
|
||||
@@ -328,10 +328,10 @@ void lv_list_set_layout(lv_obj_t * list, lv_layout_t layout)
|
||||
}
|
||||
|
||||
if(layout == LV_LAYOUT_COLUMN_MID || layout == LV_LAYOUT_COLUMN_LEFT || layout == LV_LAYOUT_COLUMN_RIGHT) {
|
||||
lv_page_set_scrllable_fit2(list, LV_FIT_PARENT, LV_FIT_TIGHT);
|
||||
lv_page_set_scrollable_fit2(list, LV_FIT_PARENT, LV_FIT_TIGHT);
|
||||
}
|
||||
else if(layout == LV_LAYOUT_ROW_MID || layout == LV_LAYOUT_ROW_TOP || layout == LV_LAYOUT_ROW_BOTTOM) {
|
||||
lv_page_set_scrllable_fit2(list, LV_FIT_TIGHT, LV_FIT_TIGHT);
|
||||
lv_page_set_scrollable_fit2(list, LV_FIT_TIGHT, LV_FIT_TIGHT);
|
||||
lv_cont_set_fit2(list, LV_FIT_NONE, LV_FIT_TIGHT);
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ lv_obj_t * lv_list_get_prev_btn(const lv_obj_t * list, lv_obj_t * prev_btn)
|
||||
* When getting the next button try to be sure that it is at least a button */
|
||||
|
||||
lv_obj_t * btn;
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(list);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(list);
|
||||
|
||||
btn = lv_obj_get_child(scrl, prev_btn);
|
||||
if(btn == NULL) return NULL;
|
||||
@@ -441,7 +441,7 @@ lv_obj_t * lv_list_get_next_btn(const lv_obj_t * list, lv_obj_t * prev_btn)
|
||||
* When getting the next button try to be sure that it is at least a button */
|
||||
|
||||
lv_obj_t * btn;
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(list);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(list);
|
||||
|
||||
btn = lv_obj_get_child_back(scrl, prev_btn);
|
||||
if(btn == NULL) return NULL;
|
||||
@@ -540,7 +540,7 @@ void lv_list_up(const lv_obj_t * list)
|
||||
|
||||
/*Search the first list element which 'y' coordinate is below the parent
|
||||
* and position the list to show this element on the bottom*/
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(list);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(list);
|
||||
lv_obj_t * e;
|
||||
lv_obj_t * e_prev = NULL;
|
||||
|
||||
@@ -581,7 +581,7 @@ void lv_list_down(const lv_obj_t * list)
|
||||
|
||||
/*Search the first list element which 'y' coordinate is above the parent
|
||||
* and position the list to show this element on the top*/
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(list);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(list);
|
||||
lv_obj_t * e;
|
||||
e = lv_list_get_prev_btn(list, NULL);
|
||||
while(e != NULL) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_msgbox.h"
|
||||
#if LV_USE_MSGBOX != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_core/lv_group.h"
|
||||
#include "../lv_core/lv_disp.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
@@ -281,7 +281,7 @@ void lv_msgbox_stop_auto_close(lv_obj_t * mbox)
|
||||
|
||||
/**
|
||||
* Set whether recoloring is enabled
|
||||
* @param btnm pointer to button matrix object
|
||||
* @param mbox pointer to message box object
|
||||
* @param en whether recoloring is enabled
|
||||
*/
|
||||
void lv_msgbox_set_recolor(lv_obj_t * mbox, bool en)
|
||||
@@ -314,7 +314,7 @@ const char * lv_msgbox_get_text(const lv_obj_t * mbox)
|
||||
/**
|
||||
* Get the index of the lastly "activated" button by the user (pressed, released etc)
|
||||
* Useful in the the `event_cb`.
|
||||
* @param btnm pointer to button matrix object
|
||||
* @param mbox pointer to message box object
|
||||
* @return index of the last released button (LV_BTNMATRIX_BTN_NONE: if unset)
|
||||
*/
|
||||
uint16_t lv_msgbox_get_active_btn(lv_obj_t * mbox)
|
||||
@@ -335,7 +335,7 @@ uint16_t lv_msgbox_get_active_btn(lv_obj_t * mbox)
|
||||
/**
|
||||
* Get the text of the lastly "activated" button by the user (pressed, released etc)
|
||||
* Useful in the the `event_cb`.
|
||||
* @param btnm pointer to button matrix object
|
||||
* @param mbox pointer to message box object
|
||||
* @return text of the last released button (NULL: if unset)
|
||||
*/
|
||||
const char * lv_msgbox_get_active_btn_text(lv_obj_t * mbox)
|
||||
|
||||
@@ -121,7 +121,7 @@ void lv_msgbox_stop_auto_close(lv_obj_t * mbox);
|
||||
|
||||
/**
|
||||
* Set whether recoloring is enabled. Must be called after `lv_msgbox_add_btns`.
|
||||
* @param btnm pointer to button matrix object
|
||||
* @param mbox pointer to message box object
|
||||
* @param en whether recoloring is enabled
|
||||
*/
|
||||
void lv_msgbox_set_recolor(lv_obj_t * mbox, bool en);
|
||||
@@ -140,7 +140,7 @@ const char * lv_msgbox_get_text(const lv_obj_t * mbox);
|
||||
/**
|
||||
* Get the index of the lastly "activated" button by the user (pressed, released etc)
|
||||
* Useful in the the `event_cb`.
|
||||
* @param btnm pointer to button matrix object
|
||||
* @param mbox pointer to message box object
|
||||
* @return index of the last released button (LV_BTNMATRIX_BTN_NONE: if unset)
|
||||
*/
|
||||
uint16_t lv_msgbox_get_active_btn(lv_obj_t * mbox);
|
||||
@@ -148,7 +148,7 @@ uint16_t lv_msgbox_get_active_btn(lv_obj_t * mbox);
|
||||
/**
|
||||
* Get the text of the lastly "activated" button by the user (pressed, released etc)
|
||||
* Useful in the the `event_cb`.
|
||||
* @param btnm pointer to button matrix object
|
||||
* @param mbox pointer to message box object
|
||||
* @return text of the last released button (NULL: if unset)
|
||||
*/
|
||||
const char * lv_msgbox_get_active_btn_text(lv_obj_t * mbox);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_objmask.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
//#include "lv_templ.h" /*TODO uncomment this*/
|
||||
|
||||
#if defined(LV_USE_TEMPL) && LV_USE_TEMPL != 0
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "../lv_widgets/lv_page.h"
|
||||
#if LV_USE_PAGE != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_core/lv_group.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
@@ -170,7 +170,7 @@ void lv_page_clean(lv_obj_t * page)
|
||||
{
|
||||
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(page);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(page);
|
||||
lv_obj_clean(scrl);
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ void lv_page_set_edge_flash(lv_obj_t * page, bool en)
|
||||
* @param page pointer to a page object
|
||||
* @return pointer to a container which is the scrollable part of the page
|
||||
*/
|
||||
lv_obj_t * lv_page_get_scrllable(const lv_obj_t * page)
|
||||
lv_obj_t * lv_page_get_scrollable(const lv_obj_t * page)
|
||||
{
|
||||
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
|
||||
|
||||
@@ -380,7 +380,7 @@ lv_coord_t lv_page_get_height_fit(lv_obj_t * page)
|
||||
|
||||
/**
|
||||
* Divide the width of the object and get the width of a given number of columns.
|
||||
* Take into account the paddings of the background and scrollbale too.
|
||||
* Take into account the paddings of the background and scrollable too.
|
||||
* @param page pointer to an object
|
||||
* @param div indicates how many columns are assumed.
|
||||
* If 1 the width will be set the the parent's width
|
||||
@@ -403,7 +403,7 @@ lv_coord_t lv_page_get_width_grid(lv_obj_t * page, uint8_t div, uint8_t span)
|
||||
|
||||
/**
|
||||
* Divide the height of the object and get the width of a given number of columns.
|
||||
* Take into account the paddings of the background and scrollbale too.
|
||||
* Take into account the paddings of the background and scrollable too.
|
||||
* @param obj pointer to an object
|
||||
* @param div indicates how many rows are assumed.
|
||||
* If 1 the height will be set the the parent's height
|
||||
@@ -435,7 +435,7 @@ lv_coord_t lv_page_get_height_grid(lv_obj_t * page, uint8_t div, uint8_t span)
|
||||
*/
|
||||
bool lv_page_on_edge(lv_obj_t * page, lv_page_edge_t edge)
|
||||
{
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(page);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(page);
|
||||
lv_area_t page_coords;
|
||||
lv_area_t scrl_coords;
|
||||
|
||||
@@ -478,7 +478,7 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, lv_anim_enable_t anim_
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
/* Be sure there is no position changing animation in progress
|
||||
* because it can overide the current changes*/
|
||||
* because it can override the current changes*/
|
||||
lv_anim_del(page, (lv_anim_exec_xcb_t)lv_obj_set_x);
|
||||
lv_anim_del(page, (lv_anim_exec_xcb_t)lv_obj_set_y);
|
||||
lv_anim_del(ext->scrl, (lv_anim_exec_xcb_t)lv_obj_set_x);
|
||||
@@ -537,7 +537,7 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, lv_anim_enable_t anim_
|
||||
}
|
||||
/*Out of the page on the rigth*/
|
||||
else if((obj_w <= page_w && right_err > 0) || (obj_w > page_w && left_err >= right_err)) {
|
||||
/*Calculate a new position and let some space on teh side*/
|
||||
/*Calculate a new position and let some space on the side*/
|
||||
scrlable_x = -(obj_x + scrl_right + bg_right);
|
||||
scrlable_x -= scrl_right;
|
||||
scrlable_x += page_w - obj_w;
|
||||
@@ -571,7 +571,7 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, lv_anim_enable_t anim_
|
||||
*/
|
||||
void lv_page_scroll_hor(lv_obj_t * page, lv_coord_t dist)
|
||||
{
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(page);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(page);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
lv_anim_t a;
|
||||
@@ -593,7 +593,7 @@ void lv_page_scroll_hor(lv_obj_t * page, lv_coord_t dist)
|
||||
*/
|
||||
void lv_page_scroll_ver(lv_obj_t * page, lv_coord_t dist)
|
||||
{
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(page);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(page);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
lv_anim_t a;
|
||||
@@ -759,7 +759,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_STATE_DSC) {
|
||||
lv_get_state_info_t * info = param;
|
||||
if(info->part == LV_PAGE_PART_SCROLLABLE) info->result = lv_obj_get_state(lv_page_get_scrllable(page),
|
||||
if(info->part == LV_PAGE_PART_SCROLLABLE) info->result = lv_obj_get_state(lv_page_get_scrollable(page),
|
||||
LV_CONT_PART_MAIN);
|
||||
else info->result = lv_obj_get_state(page, info->part);
|
||||
return LV_RES_OK;
|
||||
@@ -806,7 +806,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
lv_obj_t * tmp = child;
|
||||
child = lv_obj_get_child(page, child); /*Get the next child before move this*/
|
||||
|
||||
/* Reposition the child to take padding into account (Only if it's on (0;0) or (widht;height) coordinates now)
|
||||
/* Reposition the child to take padding into account
|
||||
* It's required to keep new the object on the same coordinate if FIT is enabled.*/
|
||||
if((tmp->coords.x1 == page->coords.x1) &&
|
||||
(fit_left == LV_FIT_TIGHT || fit_left == LV_FIT_MAX) &&
|
||||
@@ -970,7 +970,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
|
||||
lv_page_ext_t * scroller_page_ext = lv_obj_get_ext_attr(scroller_page);
|
||||
page_ext->scroll_prop_obj = NULL;
|
||||
lv_obj_set_drag_parent(scroller_page, false);
|
||||
lv_obj_set_drag_parent(lv_page_get_scrllable(scroller_page), false);
|
||||
lv_obj_set_drag_parent(lv_page_get_scrollable(scroller_page), false);
|
||||
|
||||
/*Hide scrollbars if required*/
|
||||
if(scroller_page_ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) {
|
||||
@@ -1001,7 +1001,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
|
||||
scroller_page = scroller_ext->scroll_prop_obj;
|
||||
scroller_ext->scroll_prop_obj = NULL;
|
||||
lv_obj_set_drag_parent(scroller_page, false);
|
||||
lv_obj_set_drag_parent(lv_page_get_scrllable(scroller_page), false);
|
||||
lv_obj_set_drag_parent(lv_page_get_scrollable(scroller_page), false);
|
||||
|
||||
/*Hide scrollbars if required*/
|
||||
if(scroller_page_ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) {
|
||||
@@ -1123,7 +1123,7 @@ static void scrl_reposition(lv_obj_t * page)
|
||||
{
|
||||
/*Limit the position of the scrollable object to be always visible
|
||||
* (Do not let its edge inner then its parent respective edge)*/
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(page);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(page);
|
||||
lv_coord_t new_x = lv_obj_get_x(scrl);
|
||||
lv_coord_t new_y = lv_obj_get_y(scrl);
|
||||
bool refr_x = false;
|
||||
|
||||
@@ -117,7 +117,7 @@ void lv_page_clean(lv_obj_t * page);
|
||||
* @param page pointer to a page object
|
||||
* @return pointer to a container which is the scrollable part of the page
|
||||
*/
|
||||
lv_obj_t * lv_page_get_scrllable(const lv_obj_t * page);
|
||||
lv_obj_t * lv_page_get_scrollable(const lv_obj_t * page);
|
||||
|
||||
/**
|
||||
* Get the animation time
|
||||
@@ -170,10 +170,10 @@ void lv_page_set_edge_flash(lv_obj_t * page, bool en);
|
||||
* @param top bottom fit policy from `lv_fit_t`
|
||||
* @param bottom bottom fit policy from `lv_fit_t`
|
||||
*/
|
||||
static inline void lv_page_set_scrllable_fit4(lv_obj_t * page, lv_fit_t left, lv_fit_t right, lv_fit_t top,
|
||||
static inline void lv_page_set_scrollable_fit4(lv_obj_t * page, lv_fit_t left, lv_fit_t right, lv_fit_t top,
|
||||
lv_fit_t bottom)
|
||||
{
|
||||
lv_cont_set_fit4(lv_page_get_scrllable(page), left, right, top, bottom);
|
||||
lv_cont_set_fit4(lv_page_get_scrollable(page), left, right, top, bottom);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,20 +183,20 @@ static inline void lv_page_set_scrllable_fit4(lv_obj_t * page, lv_fit_t left, lv
|
||||
* @param hot horizontal fit policy from `lv_fit_t`
|
||||
* @param ver vertical fit policy from `lv_fit_t`
|
||||
*/
|
||||
static inline void lv_page_set_scrllable_fit2(lv_obj_t * page, lv_fit_t hor, lv_fit_t ver)
|
||||
static inline void lv_page_set_scrollable_fit2(lv_obj_t * page, lv_fit_t hor, lv_fit_t ver)
|
||||
{
|
||||
lv_cont_set_fit2(lv_page_get_scrllable(page), hor, ver);
|
||||
lv_cont_set_fit2(lv_page_get_scrollable(page), hor, ver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the fit policyin all 4 direction at once.
|
||||
* Set the fit policy in all 4 direction at once.
|
||||
* It tell how to change the page size automatically.
|
||||
* @param page pointer to a button object
|
||||
* @param fit fit policy from `lv_fit_t`
|
||||
*/
|
||||
static inline void lv_page_set_scrllable_fit(lv_obj_t * page, lv_fit_t fit)
|
||||
static inline void lv_page_set_scrollable_fit(lv_obj_t * page, lv_fit_t fit)
|
||||
{
|
||||
lv_cont_set_fit(lv_page_get_scrllable(page), fit);
|
||||
lv_cont_set_fit(lv_page_get_scrollable(page), fit);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,7 +206,7 @@ static inline void lv_page_set_scrllable_fit(lv_obj_t * page, lv_fit_t fit)
|
||||
*/
|
||||
static inline void lv_page_set_scrl_width(lv_obj_t * page, lv_coord_t w)
|
||||
{
|
||||
lv_obj_set_width(lv_page_get_scrllable(page), w);
|
||||
lv_obj_set_width(lv_page_get_scrollable(page), w);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,7 +216,7 @@ static inline void lv_page_set_scrl_width(lv_obj_t * page, lv_coord_t w)
|
||||
*/
|
||||
static inline void lv_page_set_scrl_height(lv_obj_t * page, lv_coord_t h)
|
||||
{
|
||||
lv_obj_set_height(lv_page_get_scrllable(page), h);
|
||||
lv_obj_set_height(lv_page_get_scrollable(page), h);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,7 +226,7 @@ static inline void lv_page_set_scrl_height(lv_obj_t * page, lv_coord_t h)
|
||||
*/
|
||||
static inline void lv_page_set_scrl_layout(lv_obj_t * page, lv_layout_t layout)
|
||||
{
|
||||
lv_cont_set_layout(lv_page_get_scrllable(page), layout);
|
||||
lv_cont_set_layout(lv_page_get_scrollable(page), layout);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
@@ -270,7 +270,7 @@ lv_coord_t lv_page_get_height_fit(lv_obj_t * page);
|
||||
|
||||
/**
|
||||
* Divide the width of the object and get the width of a given number of columns.
|
||||
* Take into account the paddings of the background and scrollbale too.
|
||||
* Take into account the paddings of the background and scrollable too.
|
||||
* @param page pointer to an object
|
||||
* @param div indicates how many columns are assumed.
|
||||
* If 1 the width will be set the the parent's width
|
||||
@@ -283,7 +283,7 @@ lv_coord_t lv_page_get_width_grid(lv_obj_t * page, uint8_t div, uint8_t span);
|
||||
|
||||
/**
|
||||
* Divide the height of the object and get the width of a given number of columns.
|
||||
* Take into account the paddings of the background and scrollbale too.
|
||||
* Take into account the paddings of the background and scrollable too.
|
||||
* @param page pointer to an object
|
||||
* @param div indicates how many rows are assumed.
|
||||
* If 1 the height will be set the the parent's height
|
||||
@@ -301,7 +301,7 @@ lv_coord_t lv_page_get_height_grid(lv_obj_t * page, uint8_t div, uint8_t span);
|
||||
*/
|
||||
static inline lv_coord_t lv_page_get_scrl_width(const lv_obj_t * page)
|
||||
{
|
||||
return lv_obj_get_width(lv_page_get_scrllable(page));
|
||||
return lv_obj_get_width(lv_page_get_scrollable(page));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -311,7 +311,7 @@ static inline lv_coord_t lv_page_get_scrl_width(const lv_obj_t * page)
|
||||
*/
|
||||
static inline lv_coord_t lv_page_get_scrl_height(const lv_obj_t * page)
|
||||
{
|
||||
return lv_obj_get_height(lv_page_get_scrllable(page));
|
||||
return lv_obj_get_height(lv_page_get_scrollable(page));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,7 +321,7 @@ static inline lv_coord_t lv_page_get_scrl_height(const lv_obj_t * page)
|
||||
*/
|
||||
static inline lv_layout_t lv_page_get_scrl_layout(const lv_obj_t * page)
|
||||
{
|
||||
return lv_cont_get_layout(lv_page_get_scrllable(page));
|
||||
return lv_cont_get_layout(lv_page_get_scrollable(page));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -331,7 +331,7 @@ static inline lv_layout_t lv_page_get_scrl_layout(const lv_obj_t * page)
|
||||
*/
|
||||
static inline lv_fit_t lv_page_get_scrl_fit_left(const lv_obj_t * page)
|
||||
{
|
||||
return lv_cont_get_fit_left(lv_page_get_scrllable(page));
|
||||
return lv_cont_get_fit_left(lv_page_get_scrollable(page));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,7 +341,7 @@ static inline lv_fit_t lv_page_get_scrl_fit_left(const lv_obj_t * page)
|
||||
*/
|
||||
static inline lv_fit_t lv_page_get_scrl_fit_right(const lv_obj_t * page)
|
||||
{
|
||||
return lv_cont_get_fit_right(lv_page_get_scrllable(page));
|
||||
return lv_cont_get_fit_right(lv_page_get_scrollable(page));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -351,7 +351,7 @@ static inline lv_fit_t lv_page_get_scrl_fit_right(const lv_obj_t * page)
|
||||
*/
|
||||
static inline lv_fit_t lv_page_get_scrl_fit_top(const lv_obj_t * page)
|
||||
{
|
||||
return lv_cont_get_fit_top(lv_page_get_scrllable(page));
|
||||
return lv_cont_get_fit_top(lv_page_get_scrollable(page));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -361,7 +361,7 @@ static inline lv_fit_t lv_page_get_scrl_fit_top(const lv_obj_t * page)
|
||||
*/
|
||||
static inline lv_fit_t lv_page_get_scrl_fit_bottom(const lv_obj_t * page)
|
||||
{
|
||||
return lv_cont_get_fit_bottom(lv_page_get_scrllable(page));
|
||||
return lv_cont_get_fit_bottom(lv_page_get_scrollable(page));
|
||||
}
|
||||
|
||||
/*=====================
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "lv_roller.h"
|
||||
#if LV_USE_ROLLER != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_core/lv_group.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
@@ -76,7 +76,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
LV_ASSERT_MEM(roller);
|
||||
if(roller == NULL) return NULL;
|
||||
|
||||
if(ancestor_scrl_signal == NULL) ancestor_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrllable(roller));
|
||||
if(ancestor_scrl_signal == NULL) ancestor_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrollable(roller));
|
||||
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(roller);
|
||||
|
||||
/*Allocate the roller type specific extended data*/
|
||||
@@ -104,9 +104,9 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_t * label = lv_label_create(roller, NULL);
|
||||
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
|
||||
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(roller);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(roller);
|
||||
lv_obj_set_drag(scrl, true);
|
||||
lv_page_set_scrllable_fit2(roller, LV_FIT_PARENT, LV_FIT_NONE); /*Height is specified directly*/
|
||||
lv_page_set_scrollable_fit2(roller, LV_FIT_PARENT, LV_FIT_NONE); /*Height is specified directly*/
|
||||
lv_roller_set_anim_time(roller, LV_ROLLER_DEF_ANIM_TIME);
|
||||
lv_roller_set_options(roller, "Option 1\nOption 2\nOption 3\nOption 4\nOption 5", LV_ROLLER_MODE_NORMAL);
|
||||
|
||||
@@ -123,7 +123,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_roller_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
lv_roller_set_options(roller, lv_roller_get_options(copy), copy_ext->mode);
|
||||
ext->auto_fit = copy_ext->auto_fit;
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(roller);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(roller);
|
||||
lv_obj_set_signal_cb(scrl, lv_roller_scrl_signal);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ void lv_roller_set_options(lv_obj_t * roller, const char * options, lv_roller_mo
|
||||
|
||||
/*Count the '\n'-s to determine the number of options*/
|
||||
ext->option_cnt = 0;
|
||||
uint16_t cnt;
|
||||
uint32_t cnt;
|
||||
for(cnt = 0; options[cnt] != '\0'; cnt++) {
|
||||
if(options[cnt] == '\n') ext->option_cnt++;
|
||||
}
|
||||
@@ -310,13 +310,13 @@ uint16_t lv_roller_get_selected(const lv_obj_t * roller)
|
||||
* @param buf pointer to an array to store the string
|
||||
* @param buf_size size of `buf` in bytes. 0: to ignore it.
|
||||
*/
|
||||
void lv_roller_get_selected_str(const lv_obj_t * roller, char * buf, uint16_t buf_size)
|
||||
void lv_roller_get_selected_str(const lv_obj_t * roller, char * buf, uint32_t buf_size)
|
||||
{
|
||||
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
|
||||
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
lv_obj_t * label = get_label(roller);
|
||||
uint16_t i;
|
||||
uint32_t i;
|
||||
uint16_t line = 0;
|
||||
const char * opt_txt = lv_label_get_text(label);
|
||||
size_t txt_len = strlen(opt_txt);
|
||||
@@ -325,7 +325,7 @@ void lv_roller_get_selected_str(const lv_obj_t * roller, char * buf, uint16_t bu
|
||||
if(opt_txt[i] == '\n') line++;
|
||||
}
|
||||
|
||||
uint16_t c;
|
||||
uint32_t c;
|
||||
for(c = 0; i < txt_len && opt_txt[i] != '\n'; c++, i++) {
|
||||
if(buf_size && c >= buf_size - 1) {
|
||||
LV_LOG_WARN("lv_dropdown_get_selected_str: the buffer was too small")
|
||||
@@ -403,7 +403,7 @@ const char * lv_roller_get_options(const lv_obj_t * roller)
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* LV_DESIGN_DRAW_POST: drawing after all children are drawn
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
@@ -499,6 +499,9 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
|
||||
if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
lv_obj_t * label = get_label(roller);
|
||||
/*Be sure the label's style is updated before processing the roller*/
|
||||
if(label) lv_signal_send(label, LV_SIGNAL_STYLE_CHG, NULL);
|
||||
refr_height(roller);
|
||||
refr_width(roller);
|
||||
refr_position(roller, false);
|
||||
@@ -508,7 +511,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
if(lv_obj_get_width(roller) != lv_area_get_width(param) ||
|
||||
lv_obj_get_height(roller) != lv_area_get_height(param)) {
|
||||
#if LV_USE_ANIMATION
|
||||
lv_anim_del(lv_page_get_scrllable(roller), (lv_anim_exec_xcb_t)lv_obj_set_y);
|
||||
lv_anim_del(lv_page_get_scrollable(roller), (lv_anim_exec_xcb_t)lv_obj_set_y);
|
||||
#endif
|
||||
refr_position(roller, false);
|
||||
refr_width(roller);
|
||||
@@ -539,7 +542,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
}
|
||||
else {
|
||||
ext->sel_opt_id_ori = ext->sel_opt_id; /*Save the current value. Used to revert this state if
|
||||
ENTER wont't be pressed*/
|
||||
ENTER won't be pressed*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -556,14 +559,14 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
char c = *((char *)param);
|
||||
if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN) {
|
||||
if(ext->sel_opt_id + 1 < ext->option_cnt) {
|
||||
uint16_t ori_id = ext->sel_opt_id_ori; /*lv_roller_set_selceted will overwrite this*/
|
||||
uint16_t ori_id = ext->sel_opt_id_ori; /*lv_roller_set_selected will overwrite this*/
|
||||
lv_roller_set_selected(roller, ext->sel_opt_id + 1, true);
|
||||
ext->sel_opt_id_ori = ori_id;
|
||||
}
|
||||
}
|
||||
else if(c == LV_KEY_LEFT || c == LV_KEY_UP) {
|
||||
if(ext->sel_opt_id > 0) {
|
||||
uint16_t ori_id = ext->sel_opt_id_ori; /*lv_roller_set_selceted will overwrite this*/
|
||||
uint16_t ori_id = ext->sel_opt_id_ori; /*lv_roller_set_selected will overwrite this*/
|
||||
|
||||
lv_roller_set_selected(roller, ext->sel_opt_id - 1, true);
|
||||
ext->sel_opt_id_ori = ori_id;
|
||||
@@ -605,7 +608,7 @@ static lv_style_list_t * lv_roller_get_style(lv_obj_t * roller, uint8_t part)
|
||||
|
||||
/**
|
||||
* Signal function of the scrollable part of the roller.
|
||||
* @param roller_scrl ointer to the scrollable part of roller (page)
|
||||
* @param roller_scrl pointer to the scrollable part of roller (page)
|
||||
* @param sign a signal type from lv_signal_t enum
|
||||
* @param param pointer to a signal specific variable
|
||||
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
|
||||
@@ -645,7 +648,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
|
||||
|
||||
ext->sel_opt_id = id;
|
||||
ext->sel_opt_id_ori = id;
|
||||
res = lv_event_send(roller, LV_EVENT_VALUE_CHANGED, &id);
|
||||
res = lv_event_send(roller, LV_EVENT_VALUE_CHANGED, &id);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
/*If picked an option by clicking then set it*/
|
||||
@@ -659,7 +662,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PARENT_SIZE_CHG) {
|
||||
#if LV_USE_ANIMATION
|
||||
lv_anim_del(lv_page_get_scrllable(roller), (lv_anim_exec_xcb_t)lv_obj_set_y);
|
||||
lv_anim_del(lv_page_get_scrollable(roller), (lv_anim_exec_xcb_t)lv_obj_set_y);
|
||||
#endif
|
||||
refr_position(roller, false);
|
||||
refr_width(roller);
|
||||
@@ -740,7 +743,7 @@ static void refr_position(lv_obj_t * roller, lv_anim_enable_t anim_en)
|
||||
anim_en = LV_ANIM_OFF;
|
||||
#endif
|
||||
|
||||
lv_obj_t * roller_scrl = lv_page_get_scrllable(roller);
|
||||
lv_obj_t * roller_scrl = lv_page_get_scrollable(roller);
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
|
||||
lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG);
|
||||
@@ -748,7 +751,7 @@ static void refr_position(lv_obj_t * roller, lv_anim_enable_t anim_en)
|
||||
lv_coord_t h = lv_obj_get_height(roller);
|
||||
uint16_t anim_time = lv_roller_get_anim_time(roller);
|
||||
|
||||
/* Normally the animtaion's `end_cb` sets correct position of the roller is infinite.
|
||||
/* Normally the animation's `end_cb` sets correct position of the roller is infinite.
|
||||
* But without animations do it manually*/
|
||||
if(anim_en == LV_ANIM_OFF || anim_time == 0) {
|
||||
inf_normalize(roller_scrl);
|
||||
@@ -815,7 +818,7 @@ static lv_res_t release_handler(lv_obj_t * roller)
|
||||
lv_indev_get_point(indev, &p);
|
||||
p.y -= label->coords.y1;
|
||||
p.x -= label->coords.x1;
|
||||
uint16_t letter_i;
|
||||
uint32_t letter_i;
|
||||
letter_i = lv_label_get_letter_on(label, &p);
|
||||
|
||||
const char * txt = lv_label_get_text(label);
|
||||
@@ -867,7 +870,7 @@ static void refr_width(lv_obj_t * roller)
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the height of the roller and the scrolable
|
||||
* Refresh the height of the roller and the scrollable
|
||||
* @param roller pointer to roller
|
||||
*/
|
||||
static void refr_height(lv_obj_t * roller)
|
||||
@@ -875,16 +878,16 @@ static void refr_height(lv_obj_t * roller)
|
||||
lv_obj_t * label = get_label(roller);
|
||||
if(label == NULL) return;
|
||||
|
||||
lv_obj_set_height(lv_page_get_scrllable(roller), lv_obj_get_height(label) + lv_obj_get_height(roller));
|
||||
lv_obj_set_height(lv_page_get_scrollable(roller), lv_obj_get_height(label) + lv_obj_get_height(roller));
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
lv_anim_del(lv_page_get_scrllable(roller), (lv_anim_exec_xcb_t)lv_obj_set_y);
|
||||
lv_anim_del(lv_page_get_scrollable(roller), (lv_anim_exec_xcb_t)lv_obj_set_y);
|
||||
#endif
|
||||
refr_position(roller, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the middle page for the roller if inifinte is enabled
|
||||
* Set the middle page for the roller if infinite is enabled
|
||||
* @param scrl pointer to the roller's scrollable (lv_obj_t *)
|
||||
*/
|
||||
static void inf_normalize(void * scrl)
|
||||
@@ -916,7 +919,7 @@ static void inf_normalize(void * scrl)
|
||||
|
||||
static lv_obj_t * get_label(const lv_obj_t * roller)
|
||||
{
|
||||
lv_obj_t * scrl = lv_page_get_scrllable(roller);
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(roller);
|
||||
if(scrl == NULL) return NULL; /*The roller is being deleted, the scrollable already not exists*/
|
||||
return lv_obj_get_child(scrl, NULL);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ uint16_t lv_roller_get_option_cnt(const lv_obj_t * roller);
|
||||
* @param buf pointer to an array to store the string
|
||||
* @param buf_size size of `buf` in bytes. 0: to ignore it.
|
||||
*/
|
||||
void lv_roller_get_selected_str(const lv_obj_t * roller, char * buf, uint16_t buf_size);
|
||||
void lv_roller_get_selected_str(const lv_obj_t * roller, char * buf, uint32_t buf_size);
|
||||
|
||||
/**
|
||||
* Get the align attribute. Default alignment after _create is LV_LABEL_ALIGN_CENTER
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "lv_slider.h"
|
||||
#if LV_USE_SLIDER != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_core/lv_group.h"
|
||||
#include "../lv_core/lv_indev.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_spinbox.h"
|
||||
|
||||
#if LV_USE_SPINBOX != 0
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_misc/lv_utils.h"
|
||||
@@ -89,7 +89,7 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
if(copy == NULL) {
|
||||
/* No scrolling will happen here so make the scrollable non-clickable
|
||||
* It allows to handle input events in the bg object only.*/
|
||||
lv_obj_set_click(lv_page_get_scrllable(spinbox), false);
|
||||
lv_obj_set_click(lv_page_get_scrollable(spinbox), false);
|
||||
lv_textarea_set_one_line(spinbox, true);
|
||||
lv_textarea_set_cursor_click_pos(spinbox, true);
|
||||
lv_obj_set_width(spinbox, LV_DPI);
|
||||
@@ -440,7 +440,7 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
|
||||
if(txt[ext->ta.cursor.pos] == '.') {
|
||||
lv_textarea_cursor_left(spinbox);
|
||||
}
|
||||
else if(ext->ta.cursor.pos == txt_len) {
|
||||
else if(ext->ta.cursor.pos == (uint32_t)txt_len) {
|
||||
lv_textarea_set_cursor_pos(spinbox, txt_len - 1);
|
||||
}
|
||||
else if(ext->ta.cursor.pos == 0 && ext->range_min < 0) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_spinner.h"
|
||||
#if LV_USE_SPINNER != 0
|
||||
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_debug.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_draw/lv_draw_rect.h"
|
||||
#include "../lv_draw/lv_draw_arc.h"
|
||||
@@ -56,22 +56,22 @@ static lv_design_cb_t ancestor_design;
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create a pre loader object
|
||||
* @param par pointer to an object, it will be the parent of the new pre loader
|
||||
* @param copy pointer to a pre loader object, if not NULL then the new object will be copied from
|
||||
* Create a spinner object
|
||||
* @param par pointer to an object, it will be the parent of the new spinner
|
||||
* @param copy pointer to a spinner object, if not NULL then the new object will be copied from
|
||||
* it
|
||||
* @return pointer to the created pre loader
|
||||
* @return pointer to the created spinner
|
||||
*/
|
||||
lv_obj_t * lv_spinner_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("spinner create started");
|
||||
|
||||
/*Create the ancestor of pre loader*/
|
||||
/*Create the ancestor of spinner*/
|
||||
lv_obj_t * spinner = lv_arc_create(par, copy);
|
||||
LV_ASSERT_MEM(spinner);
|
||||
if(spinner == NULL) return NULL;
|
||||
|
||||
/*Allocate the pre loader type specific extended data*/
|
||||
/*Allocate the spinner type specific extended data*/
|
||||
lv_spinner_ext_t * ext = lv_obj_allocate_ext_attr(spinner, sizeof(lv_spinner_ext_t));
|
||||
LV_ASSERT_MEM(ext);
|
||||
if(ext == NULL) {
|
||||
@@ -153,8 +153,8 @@ void lv_spinner_set_spin_time(lv_obj_t * spinner, uint16_t time)
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Set the animation type of a spinnereer.
|
||||
* @param spinner pointer to pre loader object
|
||||
* Set the animation type of a spinner.
|
||||
* @param spinner pointer to spinner object
|
||||
* @param type animation type of the spinner
|
||||
* */
|
||||
void lv_spinner_set_type(lv_obj_t * spinner, lv_spinner_type_t type)
|
||||
@@ -230,8 +230,8 @@ void lv_spinner_set_dir(lv_obj_t * spinner, lv_spinner_dir_t dir)
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Get the arc length [degree] of the a pre loader
|
||||
* @param spinner pointer to a pre loader object
|
||||
* Get the arc length [degree] of the a spinner
|
||||
* @param spinner pointer to a spinner object
|
||||
*/
|
||||
lv_anim_value_t lv_spinner_get_arc_length(const lv_obj_t * spinner)
|
||||
{
|
||||
@@ -243,7 +243,7 @@ lv_anim_value_t lv_spinner_get_arc_length(const lv_obj_t * spinner)
|
||||
|
||||
/**
|
||||
* Get the spin time of the arc
|
||||
* @param spinner pointer to a pre loader object [milliseconds]
|
||||
* @param spinner pointer to a spinner object [milliseconds]
|
||||
*/
|
||||
uint16_t lv_spinner_get_spin_time(const lv_obj_t * spinner)
|
||||
{
|
||||
@@ -254,8 +254,8 @@ uint16_t lv_spinner_get_spin_time(const lv_obj_t * spinner)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the animation type of a spinnereer.
|
||||
* @param spinner pointer to pre loader object
|
||||
* Get the animation type of a spinner.
|
||||
* @param spinner pointer to spinner object
|
||||
* @return animation type
|
||||
* */
|
||||
lv_spinner_type_t lv_spinner_get_type(lv_obj_t * spinner)
|
||||
@@ -301,8 +301,8 @@ void lv_spinner_anim_cb(void * ptr, lv_anim_value_t val)
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Signal function of the pre loader
|
||||
* @param spinner pointer to a pre loader object
|
||||
* Signal function of the spinner
|
||||
* @param spinner pointer to a spinner object
|
||||
* @param sign a signal type from lv_signal_t enum
|
||||
* @param param pointer to a signal specific variable
|
||||
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user