Compare commits
103 Commits
v5.3
...
release/v5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88ad8c341b | ||
|
|
a66658ca3c | ||
|
|
0c64ae2ef7 | ||
|
|
e2147d4be5 | ||
|
|
22e8ec2b01 | ||
|
|
648e2c4f17 | ||
|
|
4139cd619b | ||
|
|
037e828c8a | ||
|
|
d658eef2a0 | ||
|
|
292ca72c03 | ||
|
|
8273499a8c | ||
|
|
c8d1413ece | ||
|
|
dab545e770 | ||
|
|
8745d16ba9 | ||
|
|
ef0f8b29cf | ||
|
|
580d1e111d | ||
|
|
b6df62a62a | ||
|
|
5f76d98311 | ||
|
|
bb20b8ca1a | ||
|
|
87d27a5665 | ||
|
|
6468d925ed | ||
|
|
c1e98d3f37 | ||
|
|
22f84314a4 | ||
|
|
03b3070871 | ||
|
|
73ab6b3e2f | ||
|
|
2f86a67e71 | ||
|
|
1b12ee50bb | ||
|
|
ee4e61ed68 | ||
|
|
98d43daa5d | ||
|
|
095a159005 | ||
|
|
ec6598ccfb | ||
|
|
c74e48249d | ||
|
|
2eaa579121 | ||
|
|
66e70afbb4 | ||
|
|
9d0f68880a | ||
|
|
78574541e3 | ||
|
|
b8c6783207 | ||
|
|
961d8e0350 | ||
|
|
6f53e4616a | ||
|
|
f509d8fa4f | ||
|
|
00ef778c7c | ||
|
|
fbe838730f | ||
|
|
b2e07d858b | ||
|
|
dfbcec2f0d | ||
|
|
65685a0da6 | ||
|
|
0bab902753 | ||
|
|
a374baa376 | ||
|
|
02c95e8fed | ||
|
|
56f54d864a | ||
|
|
465f8fa96a | ||
|
|
a7260bbfa9 | ||
|
|
374dfcd60a | ||
|
|
457f667cab | ||
|
|
4b6e78cf78 | ||
|
|
07e9fc4ccf | ||
|
|
a39d617ac9 | ||
|
|
be8db0719f | ||
|
|
f4498fd0a4 | ||
|
|
245d81ee92 | ||
|
|
d05ec536fd | ||
|
|
153f16fc05 | ||
|
|
2e0b8e10ae | ||
|
|
62195b7cc7 | ||
|
|
9572c7d4ed | ||
|
|
20282ce89f | ||
|
|
19ea8ac55f | ||
|
|
e3bbe0a4fd | ||
|
|
96adbe3827 | ||
|
|
92babea8c8 | ||
|
|
3425f29130 | ||
|
|
f5b8dd17b8 | ||
|
|
fabd551e2a | ||
|
|
2b67dcd2cf | ||
|
|
5addccc270 | ||
|
|
9ac933fb9e | ||
|
|
44c2397804 | ||
|
|
caa2064c90 | ||
|
|
6f47dd6522 | ||
|
|
c71047f359 | ||
|
|
6871e0252a | ||
|
|
56cfcc693a | ||
|
|
a87f4388e5 | ||
|
|
f686243f64 | ||
|
|
d64902b2a5 | ||
|
|
0733885a73 | ||
|
|
c42f378184 | ||
|
|
ad74d32f51 | ||
|
|
321a08b42e | ||
|
|
b7d5537961 | ||
|
|
32017ff659 | ||
|
|
e2c0e58af9 | ||
|
|
1c67d07dc3 | ||
|
|
e72589c6d4 | ||
|
|
b0b1174564 | ||
|
|
fb1a7fc0fc | ||
|
|
b5bcede82f | ||
|
|
23dfc37171 | ||
|
|
148539d242 | ||
|
|
b66e8410f6 | ||
|
|
9a272039d3 | ||
|
|
dc69cf82eb | ||
|
|
17c19fc35a | ||
|
|
4cd13016d3 |
14
.github/ISSUE_TEMPLATE/all-other-issues.md
vendored
Normal file
14
.github/ISSUE_TEMPLATE/all-other-issues.md
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
name: All other issues
|
||||
about: Questions and enhancement requests should go to the forum.
|
||||
title: ''
|
||||
labels: not-template
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# All enhancement requests or questions should be directed to the Forum.
|
||||
|
||||
|
||||
We use GitHub issues for development related discussions.
|
||||
Please use the [forum](https://forum.littlevgl.com/) to ask questions.
|
||||
27
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
27
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
|
||||
Please provide a small, independent code sample that can be used to reproduce the issue. Ideally this should work in the PC simulator unless the problem is specific to one platform.
|
||||
|
||||
**Expected behavior**
|
||||
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Additional context**
|
||||
|
||||
Add any other context about the problem here.
|
||||
2
.github/stale.yml
vendored
2
.github/stale.yml
vendored
@@ -7,7 +7,7 @@ exemptLabels:
|
||||
- architecture
|
||||
- pinned
|
||||
# Label to use when marking an issue as stale
|
||||
# staleLabel:
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue or pull request has been automatically marked as stale because it has not had
|
||||
|
||||
57
README.md
57
README.md
@@ -1,28 +1,22 @@
|
||||
<h1 align="center"> LittlevGL - Open-source Embedded GUI Library</h1>
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/licence-MIT-blue.svg">
|
||||
<img src="https://img.shields.io/badge/version-v5.2-blue.svg">
|
||||
<a href="https://github.com/littlevgl/lvgl/blob/master/LICENCE.txt"><img src="https://img.shields.io/badge/licence-MIT-blue.svg"></a>
|
||||
<a href="https://github.com/littlevgl/lvgl/releases/tag/v5.3"><img src="https://img.shields.io/badge/version-5.3-blue.svg"></a>
|
||||
<br>
|
||||
<img src="https://littlevgl.com/github/cover3.gif">
|
||||
<img src="https://user-images.githubusercontent.com/42941056/109342022-428df280-7839-11eb-89f7-a476495f8e9c.gif">
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
LittlevGL provides everything you need to create a Graphical User Interface (GUI) on embedded systems with easy-to-use graphical elements, beautiful visual effects and low memory footprint.
|
||||
</p>
|
||||
|
||||
<h4 align="center">
|
||||
<a href="https://littlevgl.com">Website </a> ·
|
||||
<a href="https://littlevgl.com/live-demo">Live demo</a> ·
|
||||
<a href="https://docs.littlevgl.com/#PC-simulator">Simulator</a> ·
|
||||
<a href="https://docs.littlevgl.com/">Docs</a> ·
|
||||
<a href="https://blog.littlevgl.com/">Blog</a>
|
||||
</h4>
|
||||
<h4><a href="https://github.com/lvgl/docs_old/raw/release/v6/en/docs_v5_3.zip">Documentation</a></h4>
|
||||
|
||||
<!--
|
||||
<p align="center">
|
||||
:star: Star the project if you like it! And share with your friends <a href="https://twitter.com/intent/tweet?text=LittlevGL%20is%20a%20free%20and%20open%20source%20embedded%20GUI%20library%20with%20easy-to-use%20graphical%20elements,%20beautiful%20visual%20effects%20and%20low%20memory%20footprint.&url=https://littlevgl.com/&hashtags=littlevgl,embedded,gui,free,opensource"><img src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social"></a>
|
||||
</p>
|
||||
-->
|
||||
-->
|
||||
|
||||
### Features
|
||||
* **Powerful building blocks** buttons, charts, lists, sliders, images, etc.
|
||||
@@ -35,6 +29,7 @@ LittlevGL provides everything you need to create a Graphical User Interface (GUI
|
||||
* **OS, External memory and GPU** supported but not required
|
||||
* **Single frame buffer** operation even with advances graphical effects
|
||||
* **Written in C** for maximal compatibility
|
||||
* **Micropython Binding** exposes [LittlevGL API in Micropython](https://blog.littlevgl.com/2019-02-20/micropython-bindings)
|
||||
* **Simulator** to develop on PC without embedded hardware
|
||||
* **Tutorials, examples, themes** for rapid development
|
||||
* **Documentation** and API references online
|
||||
@@ -62,15 +57,15 @@ The easiest way to get started with LittlevGL is to run it in a simulator on you
|
||||
|
||||
Choose a project with your favourite IDE:
|
||||
|
||||
| Eclipse | CodeBlock | Visual Studio | PlatfomIO | Qt Creator |
|
||||
|-------------|----------- |---------------|-----------|------------|
|
||||
| Eclipse | CodeBlocks | Visual Studio | PlatformIO | Qt Creator |
|
||||
|-------------|-------------|---------------|-----------|------------|
|
||||
| [](https://github.com/littlevgl/pc_simulator_sdl_eclipse) | [](https://github.com/littlevgl/pc_simulator_win_codeblocks) | [](https://github.com/littlevgl/visual_studio_2017_sdl_x64) | [](https://github.com/littlevgl/pc_simulator_sdl_platformio) | [](https://blog.littlevgl.com/2019-01-03/qt-creator) |
|
||||
| Cross-platform<br>with SDL | Native Windows | Cross-platform<br>with SDL | Cross-platform<br>with SDL | Cross-platform<br>with SDL |
|
||||
|
||||
### Porting to an embedded hardware
|
||||
In the most simple case you need to do these steps:
|
||||
1. Copy `lv_conf_templ.h` as `lv_conf.h` next to `lvgl` and set at least `LV_HOR_RES`, `LV_VER_RES` and `LV_COLOR_DEPTH`.
|
||||
2. Call `lv_tick_inc(x)` every `x` milliseconds in a Timer or Task (`x` should be between 1 and 10)
|
||||
2. 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 LittlevGL. **It's very important that you don't call `lv_task_handler` in the same loop.**
|
||||
3. Call `lv_init()`
|
||||
4. Register a function which can **copy a pixel array** to an area of the screen:
|
||||
```c
|
||||
@@ -105,20 +100,20 @@ bool touchpad_read(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 cooridnate*/
|
||||
/*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 cooridantes)*/
|
||||
/*Set the coordinates (if released use the last pressed coordinates)*/
|
||||
data->point.x = last_x;
|
||||
data->point.y = last_y;
|
||||
|
||||
return false; /*Return `false` because we are not buffering and no more data to read*/
|
||||
}
|
||||
```
|
||||
6. Call `lv_task_handler()` periodically every few milliseconds.
|
||||
6. 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. **It's very important that you don't call `lv_tick_inc` in the same loop.**
|
||||
|
||||
For a detailed description check the [Online documatation](https://docs.littlevgl.com/#Porting) or the [Porting tutorial](https://github.com/littlevgl/lv_examples/blob/master/lv_tutorial/0_porting/lv_tutorial_porting.c)
|
||||
For a detailed description check the [Documentation](https://docs.littlevgl.com/#Porting) or the [Porting tutorial](https://github.com/littlevgl/lv_examples/blob/master/lv_tutorial/0_porting/lv_tutorial_porting.c)
|
||||
|
||||
|
||||
### Code examples
|
||||
@@ -154,15 +149,15 @@ style_btn_rel.body.radius = LV_RADIUS_CIRCLE;
|
||||
style_btn_rel.text.color = LV_COLOR_HEX3(0xDEF);
|
||||
|
||||
static lv_style_t style_btn_pr; /*A variable to store the pressed style*/
|
||||
lv_style_copy(&style_btn_pr, &style_btn_rel); /*Initialize from a built-in style*/
|
||||
lv_style_copy(&style_btn_pr, &style_btn_rel); /*Initialize from the released style*/
|
||||
style_btn_pr.body.border.color = LV_COLOR_HEX3(0x46B);
|
||||
style_btn_pr.body.main_color = LV_COLOR_HEX3(0x8BD);
|
||||
style_btn_pr.body.grad_color = LV_COLOR_HEX3(0x24A);
|
||||
style_btn_pr.body.shadow.width = 2;
|
||||
style_btn_pr.text.color = LV_COLOR_HEX3(0xBCD);
|
||||
|
||||
lv_btn_set_style(btn, LV_BTN_STYLE_REL, &style_btn_rel); /*Set the buton's released style*/
|
||||
lv_btn_set_style(btn, LV_BTN_STYLE_PR, &style_btn_pr); /*Set the buton's pressed style*/
|
||||
lv_btn_set_style(btn, LV_BTN_STYLE_REL, &style_btn_rel); /*Set the button's released style*/
|
||||
lv_btn_set_style(btn, LV_BTN_STYLE_PR, &style_btn_pr); /*Set the button's pressed style*/
|
||||
```
|
||||
|
||||

|
||||
@@ -177,12 +172,26 @@ lv_btn_set_ink_out_time(btn, 300);
|
||||
|
||||

|
||||
|
||||
#### Use LittlevGL from Micropython
|
||||
```python
|
||||
# Create a Button and a Label
|
||||
scr = lv.obj()
|
||||
btn = lv.btn(scr)
|
||||
btn.align(lv.scr_act(), lv.ALIGN.CENTER, 0, 0)
|
||||
label = lv.label(btn)
|
||||
label.set_text("Button")
|
||||
|
||||
# Load the screen
|
||||
lv.scr_load(scr)
|
||||
```
|
||||
|
||||
Check out the [Documentation](https://docs.littlevgl.com/) for more!
|
||||
|
||||
### Contributing
|
||||
To ask questions and discuss topics we use [GitHub's Issue tracker](https://github.com/littlevgl/lvgl/issues).
|
||||
You contribute in several ways:
|
||||
- **Answer other's question** click the Watch button on the top to get notified about the issues
|
||||
To ask questions please use the [Forum](https://forum.littlevgl.com).
|
||||
FOr development related things (bug reports, feature suggestions) use [GitHub's Issue tracker](https://github.com/littlevgl/lvgl/issues).
|
||||
You can contribute in several ways:
|
||||
- **Answer other's question** in the Forum
|
||||
- **Report and/or fix bugs** using the issue tracker and in Pull-request
|
||||
- **Suggest and/or implement new features** using the issue tracker and in Pull-request
|
||||
- **Improve and/or translate the documentation** learn more [here](https://github.com/littlevgl/docs)
|
||||
|
||||
@@ -14,14 +14,24 @@ But first, start with the most Frequently Asked Questions.
|
||||
|
||||
## FAQ about contributing
|
||||
|
||||
### Where can I write my question and remarks?
|
||||
### What license does my code need to be under?
|
||||
|
||||
We use [GitHub's issue tracker](https://github.com/littlevgl/lvgl/issues) to ask questions., report bugs and suggest features. But there are some simple rules:
|
||||
Any code added to LittlevGL must be licensed under [MIT](https://choosealicense.com/licenses/mit/) or another license that is fully compatible. Contributions under other licenses are highly likely to be rejected.
|
||||
|
||||
If you borrow code from another project, please make sure to add their copyright notice to your contribution.
|
||||
|
||||
### Where do I ask questions, give feedback, or report bugs?
|
||||
|
||||
We use the [forum](http://forum.littlevgl.com/) for questions, feature suggestions, and discussions.
|
||||
|
||||
We use [GitHub's issue tracker](https://github.com/littlevgl/lvgl/issues) to report bugs.
|
||||
|
||||
For both of these there are some rules:
|
||||
- Be kind and friendly.
|
||||
- Speak about one thing in one issue.
|
||||
- Give feedback and close the issue if your question is answered.
|
||||
- Tell what you experience or expect. _"The button is not working"_ is not enough info to get help.
|
||||
- If possible send an absolute minimal code example in order to reproduce the issue
|
||||
- Explain exactly what you experience or expect. _"The button is not working"_ is not enough info to get help.
|
||||
- For most issues you should send an absolute minimal code example in order to reproduce the issue. Ideally this should be easily usable in the PC simulator.
|
||||
- Use [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) to format your post.
|
||||
- If you don't get any answer in a week write a comment like "Can somebody help?". Maybe your issue wasn't noticed.
|
||||
|
||||
@@ -30,7 +40,7 @@ Merging new code happens via Pull Requests. If you are still not familiar with t
|
||||
1. **Fork** the [lvgl repository](https://github.com/littlevgl/lvgl). To do this click the "Fork" button in the top right corner. It will "copy" the `lvgl` repository to your GitHub account (`https://github.com/your_name?tab=repositories`)
|
||||
2. **Clone** the forked repository and add your updates
|
||||
3. **Create a PR** on the GitHub on the page of you `lvgl` repository(`https://github.com/your_name/lvgl`) by hitting the "New pull request" button
|
||||
4. **Set the base branch**. It means where you want to merge your update. Fixes go to `master`, new features to the actual `dev-x.y` branch.
|
||||
4. **Set the base branch**. It means where you want to merge your update. Bugfixes for the last release go to `master`, new features to the actual `dev-x.y` branch.
|
||||
5. **Describe** what is in the update. An example code is welcome if applicable.
|
||||
|
||||
Some advice:
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
#endif
|
||||
#endif /*LV_MEM_CUSTOM*/
|
||||
|
||||
/* Garbage Collector settings. */
|
||||
/* Garbage Collector settings
|
||||
* Used if lvgl is binded to higher language and the memory is managed by that language */
|
||||
#ifndef LV_ENABLE_GC
|
||||
#define LV_ENABLE_GC 0
|
||||
#endif
|
||||
@@ -89,7 +90,7 @@
|
||||
*----------------*/
|
||||
|
||||
/* VDB (Virtual Display Buffer) is an internal graphics buffer.
|
||||
* To images will be drawn into this buffer first and then
|
||||
* The GUI will be drawn into this buffer first and then
|
||||
* the buffer will be passed to your `disp_drv.disp_flush` function to
|
||||
* copy it to your frame buffer.
|
||||
* VDB is required for: buffered drawing, opacity, anti-aliasing and shadows
|
||||
@@ -115,7 +116,7 @@
|
||||
#define LV_VDB_ADR 0
|
||||
#endif
|
||||
|
||||
/* Use two Virtual Display buffers (VDB) parallelize rendering and flushing (optional)
|
||||
/* Use two Virtual Display buffers (VDB) to parallelize rendering and flushing
|
||||
* The flushing should use DMA to write the frame buffer in the background */
|
||||
#ifndef LV_VDB_DOUBLE
|
||||
#define LV_VDB_DOUBLE 0
|
||||
@@ -165,7 +166,7 @@
|
||||
|
||||
/*Color settings*/
|
||||
#ifndef LV_COLOR_DEPTH
|
||||
#define LV_COLOR_DEPTH 32 /*Color depth: 1/8/16/32*/
|
||||
#define LV_COLOR_DEPTH 16 /*Color depth: 1/8/16/32*/
|
||||
#endif
|
||||
#ifndef LV_COLOR_16_SWAP
|
||||
#define LV_COLOR_16_SWAP 0 /*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/
|
||||
@@ -224,6 +225,9 @@
|
||||
#ifndef LV_ATTRIBUTE_TASK_HANDLER
|
||||
#define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */
|
||||
#endif
|
||||
#ifndef LV_ATTRIBUTE_MEM_ALIGN
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN /* With size optimization (-Os) the compiler might not align data to 4 or 8 byte boundary. This alignment will be explicitly applied where needed.*/
|
||||
#endif
|
||||
#ifndef LV_COMPILER_VLA_SUPPORTED
|
||||
#define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/
|
||||
#endif
|
||||
@@ -237,7 +241,7 @@
|
||||
#endif
|
||||
#if LV_TICK_CUSTOM == 1
|
||||
#ifndef LV_TICK_CUSTOM_INCLUDE
|
||||
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the sys time function*/
|
||||
#define LV_TICK_CUSTOM_INCLUDE "sonething.h" /*Header for the sys time function*/
|
||||
#endif
|
||||
#ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
|
||||
@@ -262,7 +266,7 @@
|
||||
/* 1: Print the log with 'printf'; 0: user need to register a callback*/
|
||||
|
||||
#ifndef LV_LOG_PRINTF
|
||||
# define LV_LOG_PRINTF 1
|
||||
# define LV_LOG_PRINTF 0
|
||||
#endif
|
||||
#endif /*USE_LV_LOG*/
|
||||
|
||||
@@ -386,7 +390,7 @@
|
||||
#define LV_OBJ_FREE_PTR 1 /*Enable the free pointer attribute*/
|
||||
#endif
|
||||
#ifndef LV_OBJ_REALIGN
|
||||
#define LV_OBJ_REALIGN 0 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
|
||||
#define LV_OBJ_REALIGN 1 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
|
||||
#endif
|
||||
|
||||
/*==================
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
#define LV_INDEV_READ_PERIOD 50 /*Input device read period in milliseconds*/
|
||||
#define LV_INDEV_POINT_MARKER 0 /*Mark the pressed points (required: USE_LV_REAL_DRAW = 1)*/
|
||||
#define LV_INDEV_DRAG_LIMIT 10 /*Drag threshold in pixels */
|
||||
#define LV_INDEV_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */
|
||||
#define LV_INDEV_DRAG_THROW 20 /*Drag throw slow-down in [%] (must be > 0). Greater value means faster slow-down */
|
||||
#define LV_INDEV_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/
|
||||
#define LV_INDEV_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */
|
||||
|
||||
@@ -136,13 +136,14 @@
|
||||
/*Compiler settings*/
|
||||
#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_tick_inc` function */
|
||||
#define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN /* With size optimization (-Os) the compiler might not align data to 4 or 8 byte boundary. This alignment will be explicitly applied where needed.*/
|
||||
#define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/
|
||||
#define LV_COMPILER_NON_CONST_INIT_SUPPORTED 1 /* 1: Initialization with non constant values are supported */
|
||||
|
||||
/*HAL settings*/
|
||||
#define LV_TICK_CUSTOM 0 /*1: use a custom tick source (removing the need to manually update the tick with `lv_tick_inc`) */
|
||||
#if LV_TICK_CUSTOM == 1
|
||||
#define LV_TICK_CUSTOM_INCLUDE "sonething.h" /*Header for the sys time function*/
|
||||
#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
|
||||
#endif /*LV_TICK_CUSTOM*/
|
||||
|
||||
@@ -381,6 +382,13 @@
|
||||
/*************************
|
||||
* Non-user section
|
||||
*************************/
|
||||
|
||||
#if LV_INDEV_DRAG_THROW <= 0
|
||||
#warning "LV_INDEV_DRAG_THROW must be greater than 0"
|
||||
#undef LV_INDEV_DRAG_THROW
|
||||
#define LV_INDEV_DRAG_THROW 1
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
static void style_mod_def(lv_style_t * style);
|
||||
static void style_mod_edit_def(lv_style_t * style);
|
||||
static void lv_group_refocus(lv_group_t *g);
|
||||
static void obj_to_foreground(lv_obj_t * obj);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -55,6 +56,7 @@ lv_group_t * lv_group_create(void)
|
||||
group->focus_cb = NULL;
|
||||
group->click_focus = 1;
|
||||
group->editing = 0;
|
||||
group->wrap = 1;
|
||||
|
||||
return group;
|
||||
}
|
||||
@@ -181,6 +183,9 @@ void lv_group_focus_obj(lv_obj_t * obj)
|
||||
(*g->obj_focus)->signal_func(*g->obj_focus, LV_SIGNAL_FOCUS, NULL);
|
||||
if(g->focus_cb) g->focus_cb(g);
|
||||
lv_obj_invalidate(*g->obj_focus);
|
||||
|
||||
/*If the object or its parent has `top == true` bring it to the foregorund*/
|
||||
obj_to_foreground(*g->obj_focus);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -215,6 +220,9 @@ void lv_group_focus_next(lv_group_t * group)
|
||||
lv_obj_invalidate(*group->obj_focus);
|
||||
|
||||
if(group->focus_cb) group->focus_cb(group);
|
||||
|
||||
/*If the object or its parent has `top == true` bring it to the foregorund*/
|
||||
obj_to_foreground(*group->obj_focus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,6 +254,9 @@ void lv_group_focus_prev(lv_group_t * group)
|
||||
lv_obj_invalidate(*group->obj_focus);
|
||||
|
||||
if(group->focus_cb) group->focus_cb(group);
|
||||
|
||||
/*If the object or its parent has `top == true` bring it to the foregorund*/
|
||||
obj_to_foreground(*group->obj_focus);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -356,7 +367,7 @@ static void lv_group_refocus(lv_group_t *g) {
|
||||
/**
|
||||
* Set whether focus next/prev will allow wrapping from first->last or last->first.
|
||||
* @param group pointer to group
|
||||
* @param en: true: enable `click_focus`
|
||||
* @param en: true: enable `wrap`
|
||||
*/
|
||||
void lv_group_set_wrap(lv_group_t * group, bool en)
|
||||
{
|
||||
@@ -522,4 +533,23 @@ static void style_mod_edit_def(lv_style_t * style)
|
||||
|
||||
}
|
||||
|
||||
static void obj_to_foreground(lv_obj_t * obj)
|
||||
{
|
||||
/*Search for 'top' attribute*/
|
||||
lv_obj_t * i = obj;
|
||||
lv_obj_t * last_top = NULL;
|
||||
while(i != NULL) {
|
||||
if(i->top != 0) last_top = i;
|
||||
i = lv_obj_get_parent(i);
|
||||
}
|
||||
|
||||
if(last_top != NULL) {
|
||||
/*Move the last_top object to the foreground*/
|
||||
lv_obj_t * par = lv_obj_get_parent(last_top);
|
||||
/*After list change it will be the new head*/
|
||||
lv_ll_chg_list(&par->child_ll, &par->child_ll, last_top);
|
||||
lv_obj_invalidate(last_top);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*USE_LV_GROUP != 0*/
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#if LV_INDEV_DRAG_THROW <= 0
|
||||
#warning "LV_INDEV_DRAG_THROW must be greater than 0"
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void refresh_childen_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff);
|
||||
static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff);
|
||||
static void report_style_mod_core(void * style_p, lv_obj_t * obj);
|
||||
static void refresh_childen_style(lv_obj_t * obj);
|
||||
static void refresh_children_style(lv_obj_t * obj);
|
||||
static void delete_children(lv_obj_t * obj);
|
||||
static bool lv_obj_design(lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode);
|
||||
static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
@@ -49,6 +49,8 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
static bool _lv_initialized = false;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@@ -62,6 +64,10 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
*/
|
||||
void lv_init(void)
|
||||
{
|
||||
/* Do nothing if already initialized */
|
||||
if (_lv_initialized)
|
||||
return;
|
||||
|
||||
LV_GC_ROOT(_lv_def_scr) = NULL;
|
||||
LV_GC_ROOT(_lv_act_scr) = NULL;
|
||||
LV_GC_ROOT(_lv_top_layer) = NULL;
|
||||
@@ -111,7 +117,7 @@ void lv_init(void)
|
||||
lv_indev_init();
|
||||
#endif
|
||||
|
||||
|
||||
_lv_initialized = true;
|
||||
LV_LOG_INFO("lv_init ready");
|
||||
}
|
||||
|
||||
@@ -303,7 +309,12 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
}
|
||||
#endif
|
||||
|
||||
lv_obj_set_pos(new_obj, lv_obj_get_x(copy), lv_obj_get_y(copy));
|
||||
/*Set the same coordinates for non screen objects*/
|
||||
if(lv_obj_get_parent(copy) != NULL && parent != NULL) {
|
||||
lv_obj_set_pos(new_obj, lv_obj_get_x(copy), lv_obj_get_y(copy));
|
||||
} else {
|
||||
lv_obj_set_pos(new_obj, 0, 0);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("Object create ready");
|
||||
}
|
||||
@@ -545,7 +556,7 @@ void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
obj->coords.x2 += diff.x;
|
||||
obj->coords.y2 += diff.y;
|
||||
|
||||
refresh_childen_position(obj, diff.x, diff.y);
|
||||
refresh_children_position(obj, diff.x, diff.y);
|
||||
|
||||
/*Inform the object about its new coordinates*/
|
||||
obj->signal_func(obj, LV_SIGNAL_CORD_CHG, &ori);
|
||||
@@ -981,7 +992,7 @@ void lv_obj_set_style(lv_obj_t * obj, lv_style_t * style)
|
||||
obj->style_p = style;
|
||||
|
||||
/*Send a signal about style change to every children with NULL style*/
|
||||
refresh_childen_style(obj);
|
||||
refresh_children_style(obj);
|
||||
|
||||
/*Notify the object about the style change too*/
|
||||
lv_obj_refresh_style(obj);
|
||||
@@ -1866,7 +1877,7 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
* @param x_diff x coordinate shift
|
||||
* @param y_diff y coordinate shift
|
||||
*/
|
||||
static void refresh_childen_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff)
|
||||
static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff)
|
||||
{
|
||||
lv_obj_t * i;
|
||||
LL_READ(obj->child_ll, i) {
|
||||
@@ -1875,7 +1886,7 @@ static void refresh_childen_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord
|
||||
i->coords.x2 += x_diff;
|
||||
i->coords.y2 += y_diff;
|
||||
|
||||
refresh_childen_position(i, x_diff, y_diff);
|
||||
refresh_children_position(i, x_diff, y_diff);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1889,7 +1900,7 @@ static void report_style_mod_core(void * style_p, lv_obj_t * obj)
|
||||
lv_obj_t * i;
|
||||
LL_READ(obj->child_ll, i) {
|
||||
if(i->style_p == style_p || style_p == NULL) {
|
||||
refresh_childen_style(i);
|
||||
refresh_children_style(i);
|
||||
lv_obj_refresh_style(i);
|
||||
}
|
||||
|
||||
@@ -1902,16 +1913,16 @@ static void report_style_mod_core(void * style_p, lv_obj_t * obj)
|
||||
* because the NULL styles are inherited from the parent
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
static void refresh_childen_style(lv_obj_t * obj)
|
||||
static void refresh_children_style(lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
||||
while(child != NULL) {
|
||||
if(child->style_p == NULL) {
|
||||
refresh_childen_style(child); /*Check children too*/
|
||||
refresh_children_style(child); /*Check children too*/
|
||||
lv_obj_refresh_style(child); /*Notify the child about the style change*/
|
||||
} else if(child->style_p->glass) {
|
||||
/*Children with 'glass' parent might be effected if their style == NULL*/
|
||||
refresh_childen_style(child);
|
||||
refresh_children_style(child);
|
||||
}
|
||||
child = lv_obj_get_child(obj, child);
|
||||
}
|
||||
|
||||
@@ -359,14 +359,18 @@ static void lv_refr_area_with_vdb(const lv_area_t * area_p)
|
||||
tmp.x1 = 0;
|
||||
tmp.x2 = 0;
|
||||
tmp.y1 = 0;
|
||||
tmp.y2 = max_row;
|
||||
|
||||
lv_coord_t y_tmp = max_row;
|
||||
lv_coord_t y_tmp = max_row - 1;
|
||||
do {
|
||||
tmp.y2 = y_tmp;
|
||||
round_cb(&tmp);
|
||||
y_tmp --; /*Decrement the number of line until it is rounded to a smaller (or equal) value then the original. */
|
||||
} while(lv_area_get_height(&tmp) > max_row && y_tmp != 0);
|
||||
|
||||
/*If this height fits into `max_row` then fine*/
|
||||
if(lv_area_get_height(&tmp) <= max_row) break;
|
||||
|
||||
/*Decrement the height of the area until it fits into `max_row` after rounding*/
|
||||
y_tmp --;
|
||||
} while(y_tmp != 0);
|
||||
|
||||
if(y_tmp == 0) {
|
||||
LV_LOG_WARN("Can't set VDB height using the round function. (Wrong round_cb or to small VDB)");
|
||||
|
||||
@@ -184,7 +184,7 @@ extern lv_style_t lv_style_pretty_color;
|
||||
extern lv_style_t lv_style_btn_rel;
|
||||
extern lv_style_t lv_style_btn_pr;
|
||||
extern lv_style_t lv_style_btn_tgl_rel;
|
||||
extern lv_style_t lv_style_btn_tgl_pr;;
|
||||
extern lv_style_t lv_style_btn_tgl_pr;
|
||||
extern lv_style_t lv_style_btn_ina;
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
#define LV_ATTRIBUTE_FLUSH_READY
|
||||
#endif
|
||||
|
||||
#ifndef LV_ATTRIBUTE_MEM_ALIGN
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
@@ -36,7 +40,7 @@
|
||||
#if LV_VDB_DOUBLE == 0
|
||||
# if LV_VDB_ADR == 0
|
||||
/*If the buffer address is not specified simply allocate it*/
|
||||
static uint8_t vdb_buf[LV_VDB_SIZE_IN_BYTES];
|
||||
static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf[LV_VDB_SIZE_IN_BYTES];
|
||||
static lv_vdb_t vdb = {.buf = (lv_color_t *)vdb_buf};
|
||||
# else /*LV_VDB_ADR != 0*/
|
||||
/*If the buffer address is specified use that address*/
|
||||
@@ -49,8 +53,8 @@ static lv_vdb_t vdb = {.buf = (lv_color_t *)LV_VDB_ADR};
|
||||
static uint8_t vdb_active = 0;
|
||||
# if LV_VDB_ADR == 0
|
||||
/*If the buffer address is not specified simply allocate it*/
|
||||
static uint8_t vdb_buf1[LV_VDB_SIZE_IN_BYTES];
|
||||
static uint8_t vdb_buf2[LV_VDB_SIZE_IN_BYTES];
|
||||
static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf1[LV_VDB_SIZE_IN_BYTES];
|
||||
static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf2[LV_VDB_SIZE_IN_BYTES];
|
||||
static lv_vdb_t vdb[2] = {{.buf = (lv_color_t *) vdb_buf1}, {.buf = (lv_color_t *) vdb_buf2}};
|
||||
# else /*LV_VDB_ADR != 0*/
|
||||
/*If the buffer address is specified use that address*/
|
||||
|
||||
@@ -78,6 +78,14 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
|
||||
pos.x = coords->x1;
|
||||
pos.y = coords->y1;
|
||||
|
||||
lv_coord_t x_ofs = 0;
|
||||
lv_coord_t y_ofs = 0;
|
||||
if(offset != NULL) {
|
||||
x_ofs = offset->x;
|
||||
y_ofs = offset->y;
|
||||
pos.y += y_ofs;
|
||||
}
|
||||
|
||||
uint32_t line_start = 0;
|
||||
uint32_t line_end = lv_txt_get_next_line(txt, font, style->text.letter_space, w, flag);
|
||||
|
||||
@@ -115,14 +123,6 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
|
||||
lv_color_t recolor;
|
||||
lv_coord_t letter_w;
|
||||
|
||||
lv_coord_t x_ofs = 0;
|
||||
lv_coord_t y_ofs = 0;
|
||||
if(offset != NULL) {
|
||||
x_ofs = offset->x;
|
||||
y_ofs = offset->y;
|
||||
pos.y += y_ofs;
|
||||
}
|
||||
|
||||
/*Real draw need a background color for higher bpp letter*/
|
||||
#if LV_VDB_SIZE == 0
|
||||
lv_rletter_set_background(style->body.main_color);
|
||||
|
||||
@@ -30,6 +30,10 @@
|
||||
*********************/
|
||||
#define VFILL_HW_ACC_SIZE_LIMIT 50 /*Always fill < 50 px with 'sw_color_fill' because of the hw. init overhead*/
|
||||
|
||||
#ifndef LV_ATTRIBUTE_MEM_ALIGN
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
@@ -147,7 +151,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
|
||||
|
||||
|
||||
#if USE_LV_GPU
|
||||
static lv_color_t color_array_tmp[LV_HOR_RES]; /*Used by 'lv_disp_mem_blend'*/
|
||||
static LV_ATTRIBUTE_MEM_ALIGN lv_color_t color_array_tmp[LV_HOR_RES]; /*Used by 'lv_disp_mem_blend'*/
|
||||
static lv_coord_t last_width = -1;
|
||||
|
||||
lv_coord_t w = lv_area_get_width(&vdb_rel_a);
|
||||
@@ -529,21 +533,6 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
|
||||
vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result);
|
||||
#else
|
||||
vdb_buf_tmp[col] = color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].alpha, px_color, opa_result);
|
||||
// if(vdb_buf_tmp[col].alpha == LV_OPA_TRANSP) {
|
||||
// /* When it is the first visible pixel on the transparent screen
|
||||
// * simlply use this color and set the pixel opa as backrounds alpha*/
|
||||
// vdb_buf_tmp[col] = px_color;
|
||||
// vdb_buf_tmp[col].alpha = opa_result;
|
||||
// } else {
|
||||
// /* If already this pixel is already written then for performance reasons
|
||||
// * don't care with alpha channel
|
||||
// */
|
||||
// lv_opa_t bg_opa = vdb_buf_tmp[col].alpha;
|
||||
// vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result);
|
||||
//
|
||||
// uint16_t opa_tmp = (uint16_t)opa_result + ((bg_opa * (255 - opa_result)) >> 8);
|
||||
// vdb_buf_tmp[col].alpha = opa_tmp > 0xFF ? 0xFF : opa_tmp ;
|
||||
// }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ void lv_font_builtin_init(void)
|
||||
#if USE_LV_FONT_DEJAVU_30 != 0
|
||||
lv_font_add(&lv_font_symbol_30, &lv_font_dejavu_30);
|
||||
#else
|
||||
lv_font_add(&lv_font_symbol_30_basic, NULL);
|
||||
lv_font_add(&lv_font_symbol_30, NULL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -48,74 +48,74 @@ void lv_font_builtin_init(void);
|
||||
|
||||
/*10 px */
|
||||
#if USE_LV_FONT_DEJAVU_10
|
||||
LV_FONT_DECLARE(lv_font_dejavu_10);
|
||||
LV_FONT_DECLARE(lv_font_dejavu_10)
|
||||
#endif
|
||||
|
||||
#if USE_LV_FONT_DEJAVU_10_LATIN_SUP
|
||||
LV_FONT_DECLARE(lv_font_dejavu_10_latin_sup);
|
||||
LV_FONT_DECLARE(lv_font_dejavu_10_latin_sup)
|
||||
#endif
|
||||
|
||||
#if USE_LV_FONT_DEJAVU_10_CYRILLIC
|
||||
LV_FONT_DECLARE(lv_font_dejavu_10_cyrillic);
|
||||
LV_FONT_DECLARE(lv_font_dejavu_10_cyrillic)
|
||||
#endif
|
||||
|
||||
#if USE_LV_FONT_SYMBOL_10
|
||||
LV_FONT_DECLARE(lv_font_symbol_10);
|
||||
LV_FONT_DECLARE(lv_font_symbol_10)
|
||||
#endif
|
||||
|
||||
/*20 px */
|
||||
#if USE_LV_FONT_DEJAVU_20
|
||||
LV_FONT_DECLARE(lv_font_dejavu_20);
|
||||
LV_FONT_DECLARE(lv_font_dejavu_20)
|
||||
#endif
|
||||
|
||||
#if USE_LV_FONT_DEJAVU_20_LATIN_SUP
|
||||
LV_FONT_DECLARE(lv_font_dejavu_20_latin_sup);
|
||||
LV_FONT_DECLARE(lv_font_dejavu_20_latin_sup)
|
||||
#endif
|
||||
|
||||
#if USE_LV_FONT_DEJAVU_20_CYRILLIC
|
||||
LV_FONT_DECLARE(lv_font_dejavu_20_cyrillic);
|
||||
LV_FONT_DECLARE(lv_font_dejavu_20_cyrillic)
|
||||
#endif
|
||||
|
||||
#if USE_LV_FONT_SYMBOL_20
|
||||
LV_FONT_DECLARE(lv_font_symbol_20);
|
||||
LV_FONT_DECLARE(lv_font_symbol_20)
|
||||
#endif
|
||||
|
||||
/*30 px */
|
||||
#if USE_LV_FONT_DEJAVU_30
|
||||
LV_FONT_DECLARE(lv_font_dejavu_30);
|
||||
LV_FONT_DECLARE(lv_font_dejavu_30)
|
||||
#endif
|
||||
|
||||
#if USE_LV_FONT_DEJAVU_30_LATIN_SUP
|
||||
LV_FONT_DECLARE(lv_font_dejavu_30_latin_sup);
|
||||
LV_FONT_DECLARE(lv_font_dejavu_30_latin_sup)
|
||||
#endif
|
||||
|
||||
#if USE_LV_FONT_DEJAVU_30_CYRILLIC
|
||||
LV_FONT_DECLARE(lv_font_dejavu_30_cyrillic);
|
||||
LV_FONT_DECLARE(lv_font_dejavu_30_cyrillic)
|
||||
#endif
|
||||
|
||||
#if USE_LV_FONT_SYMBOL_30
|
||||
LV_FONT_DECLARE(lv_font_symbol_30);
|
||||
LV_FONT_DECLARE(lv_font_symbol_30)
|
||||
#endif
|
||||
|
||||
/*40 px */
|
||||
#if USE_LV_FONT_DEJAVU_40
|
||||
LV_FONT_DECLARE(lv_font_dejavu_40);
|
||||
LV_FONT_DECLARE(lv_font_dejavu_40)
|
||||
#endif
|
||||
|
||||
#if USE_LV_FONT_DEJAVU_40_LATIN_SUP
|
||||
LV_FONT_DECLARE(lv_font_dejavu_40_latin_sup);
|
||||
LV_FONT_DECLARE(lv_font_dejavu_40_latin_sup)
|
||||
#endif
|
||||
|
||||
#if USE_LV_FONT_DEJAVU_40_CYRILLIC
|
||||
LV_FONT_DECLARE(lv_font_dejavu_40_cyrillic);
|
||||
LV_FONT_DECLARE(lv_font_dejavu_40_cyrillic)
|
||||
#endif
|
||||
|
||||
#if USE_LV_FONT_SYMBOL_40
|
||||
LV_FONT_DECLARE(lv_font_symbol_40);
|
||||
LV_FONT_DECLARE(lv_font_symbol_40)
|
||||
#endif
|
||||
|
||||
#if USE_LV_FONT_MONOSPACE_8
|
||||
LV_FONT_DECLARE(lv_font_monospace_8);
|
||||
LV_FONT_DECLARE(lv_font_monospace_8)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -393,14 +393,14 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
|
||||
#endif
|
||||
|
||||
|
||||
#define LV_COLOR_HEX(c) LV_COLOR_MAKE(((uint32_t)((uint32_t)c >> 16) & 0xFF), \
|
||||
((uint32_t)((uint32_t)c >> 8) & 0xFF), \
|
||||
((uint32_t) c & 0xFF))
|
||||
#define LV_COLOR_HEX(c) LV_COLOR_MAKE((uint8_t) ((uint32_t)((uint32_t)c >> 16) & 0xFF), \
|
||||
(uint8_t) ((uint32_t)((uint32_t)c >> 8) & 0xFF), \
|
||||
(uint8_t) ((uint32_t) c & 0xFF))
|
||||
|
||||
/*Usage LV_COLOR_HEX3(0x16C) which means LV_COLOR_HEX(0x1166CC)*/
|
||||
#define LV_COLOR_HEX3(c) LV_COLOR_MAKE((((c >> 4) & 0xF0) | ((c >> 8) & 0xF)), \
|
||||
((uint32_t)(c & 0xF0) | ((c & 0xF0) >> 4)), \
|
||||
((uint32_t)(c & 0xF) | ((c & 0xF) << 4)))
|
||||
#define LV_COLOR_HEX3(c) LV_COLOR_MAKE((uint8_t) (((c >> 4) & 0xF0) | ((c >> 8) & 0xF)), \
|
||||
(uint8_t) ((uint32_t)(c & 0xF0) | ((c & 0xF0) >> 4)), \
|
||||
(uint8_t) ((uint32_t)(c & 0xF) | ((c & 0xF) << 4)))
|
||||
|
||||
static inline lv_color_t lv_color_hex(uint32_t c){
|
||||
return LV_COLOR_HEX(c);
|
||||
|
||||
@@ -21,6 +21,14 @@
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/* "free" is used as a function pointer (in lv_fs_drv_t).
|
||||
* We must make sure "free" was not defined to a platform specific
|
||||
* free function, otherwise compilation would fail.
|
||||
*/
|
||||
#ifdef free
|
||||
#undef free
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*********************/
|
||||
#include "lv_math.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
||||
@@ -19,9 +19,9 @@ extern "C" {
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_MATH_MIN(a,b) (a<b?a:b)
|
||||
#define LV_MATH_MAX(a,b) (a>b?a:b)
|
||||
#define LV_MATH_ABS(x) ((x)>0?(x):(-(x)))
|
||||
#define LV_MATH_MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#define LV_MATH_MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
#define LV_MATH_ABS(x) ((x) > 0 ? (x) : (-(x)))
|
||||
|
||||
#define LV_TRIGO_SIN_MAX 32767
|
||||
#define LV_TRIGO_SHIFT 15 /* >> LV_TRIGO_SHIFT to normalize*/
|
||||
|
||||
@@ -73,7 +73,7 @@ extern "C" {
|
||||
#define SYMBOL_BATTERY_EMPTY _SYMBOL_VALUE1(F0)
|
||||
#define SYMBOL_BLUETOOTH _SYMBOL_VALUE1(F1)
|
||||
#define LV_SYMBOL_GLYPH_LAST 0xF1
|
||||
#define SYMBOL_DUMMY _SYMBOL_VALUE1(xFF) /*Invalid symbol. If written before a string then `lv_img` will show it as a label*/
|
||||
#define SYMBOL_DUMMY _SYMBOL_VALUE1(FF) /*Invalid symbol. If written before a string then `lv_img` will show it as a label*/
|
||||
|
||||
#else
|
||||
#define LV_SYMBOL_GLYPH_FIRST 0xF800
|
||||
|
||||
@@ -324,7 +324,7 @@ lv_coord_t lv_txt_get_width(const char * txt, uint16_t length,
|
||||
|
||||
lv_coord_t char_width = lv_font_get_width(font, letter);
|
||||
if(char_width > 0){
|
||||
width += lv_font_get_width(font, letter);
|
||||
width += char_width;
|
||||
width += letter_space;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->action = NULL;
|
||||
ext->map_p = NULL;
|
||||
ext->toggle = 0;
|
||||
ext->recolor = 0;
|
||||
ext->styles_btn[LV_BTN_STATE_REL] = &lv_style_btn_rel;
|
||||
ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_pr;
|
||||
ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel;
|
||||
|
||||
@@ -340,9 +340,29 @@ void lv_canvas_mult_buf(lv_obj_t * canvas, void * to_copy, lv_coord_t w, lv_coor
|
||||
lv_coord_t j;
|
||||
for(i = 0; i < h; i++) {
|
||||
for(j = 0; j < w; j++) {
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
canvas_buf_color[j].red = (uint16_t) ((uint16_t) canvas_buf_color[j].red * copy_buf_color[j].red) >> 8;
|
||||
canvas_buf_color[j].green = (uint16_t) ((uint16_t) canvas_buf_color[j].green * copy_buf_color[j].green) >> 8;
|
||||
canvas_buf_color[j].blue = (uint16_t) ((uint16_t) canvas_buf_color[j].blue * copy_buf_color[j].blue) >> 8;
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
|
||||
canvas_buf_color[j].red = (uint16_t) ((uint16_t) canvas_buf_color[j].red * copy_buf_color[j].red) >> 5;
|
||||
canvas_buf_color[j].blue = (uint16_t) ((uint16_t) canvas_buf_color[j].blue * copy_buf_color[j].blue) >> 5;
|
||||
# if LV_COLOR_16_SWAP == 0
|
||||
canvas_buf_color[j].green = (uint16_t) ((uint16_t) canvas_buf_color[j].green * copy_buf_color[j].green) >> 6;
|
||||
# else
|
||||
uint8_t green_canvas = (canvas_buf_color[j].green_h << 3) + (canvas_buf_color[j].green_l);
|
||||
uint8_t green_buf = (copy_buf_color[j].green_h << 3) + (copy_buf_color[j].green_l);
|
||||
uint8_t green_res = (uint16_t)((uint16_t)green_canvas * green_buf) >> 6;
|
||||
canvas_buf_color[j].green_h = (green_res >> 3) & 0x07;
|
||||
canvas_buf_color[j].green_l = green_res & 0x07;
|
||||
# endif /*LV_COLOR_16_SWAP*/
|
||||
|
||||
#elif LV_COLOR_DEPTH == 8
|
||||
canvas_buf_color[j].red = (uint16_t) ((uint16_t) canvas_buf_color[j].red * copy_buf_color[j].red) >> 3;
|
||||
canvas_buf_color[j].green = (uint16_t) ((uint16_t) canvas_buf_color[j].green * copy_buf_color[j].green) >> 3;
|
||||
canvas_buf_color[j].blue = (uint16_t) ((uint16_t) canvas_buf_color[j].blue * copy_buf_color[j].blue) >> 2;
|
||||
#endif
|
||||
}
|
||||
copy_buf_color += w;
|
||||
canvas_buf_color += ext->dsc.header.w;
|
||||
|
||||
@@ -175,9 +175,10 @@ void lv_chart_clear_serie(lv_obj_t * chart, lv_chart_series_t * serie)
|
||||
if(chart == NULL || serie == NULL)
|
||||
return;
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(ext == NULL)
|
||||
return;
|
||||
for(uint32_t i = 0; i < ext->point_cnt; i++)
|
||||
if(ext == NULL) return;
|
||||
|
||||
uint32_t i;
|
||||
for(i = 0; i < ext->point_cnt; i++)
|
||||
{
|
||||
serie->points[i] = LV_CHART_POINT_DEF;
|
||||
}
|
||||
@@ -764,12 +765,18 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const lv_area_t * mask)
|
||||
*/
|
||||
static void lv_chart_draw_vertical_lines(lv_obj_t * chart, const lv_area_t * mask)
|
||||
{
|
||||
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
lv_coord_t w = lv_obj_get_width(chart);
|
||||
/*Vertical lines works only if the width == point count. Else use the normal line type*/
|
||||
if(ext->point_cnt != w) {
|
||||
lv_chart_draw_lines(chart, mask);
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t i;
|
||||
lv_point_t p1;
|
||||
lv_point_t p2;
|
||||
lv_coord_t w = lv_obj_get_width(chart);
|
||||
lv_coord_t h = lv_obj_get_height(chart);
|
||||
lv_coord_t x_ofs = chart->coords.x1;
|
||||
lv_coord_t y_ofs = chart->coords.y1;
|
||||
@@ -789,47 +796,28 @@ static void lv_chart_draw_vertical_lines(lv_obj_t * chart, const lv_area_t * mas
|
||||
p2.x = 0 + x_ofs;
|
||||
y_tmp = (int32_t)((int32_t) ser->points[0] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
p1.y = LV_COORD_MIN;
|
||||
p2.y = h - y_tmp + y_ofs;
|
||||
p1.y = p2.y;
|
||||
|
||||
if(ext->point_cnt == w)
|
||||
for(i = 0; i < ext->point_cnt; i++)
|
||||
{
|
||||
for(i = 0; i < ext->point_cnt; i++)
|
||||
|
||||
y_tmp = (int32_t)((int32_t) ser->points[i] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
p2.y = h - y_tmp + y_ofs;
|
||||
|
||||
if(p1.y == p2.y)
|
||||
{
|
||||
p2.x++;
|
||||
}
|
||||
|
||||
y_tmp = (int32_t)((int32_t) ser->points[i] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
p2.y = h - y_tmp + y_ofs;
|
||||
|
||||
if(p1.y == p2.y)
|
||||
{
|
||||
p2.x++;
|
||||
}
|
||||
|
||||
if(ser->points[i] != LV_CHART_POINT_DEF) {
|
||||
lv_draw_line(&p1, &p2, mask, &style, opa_scale);
|
||||
|
||||
p2.x = ((w * i) / (ext->point_cnt - 1)) + x_ofs;
|
||||
p1.x = p2.x;
|
||||
p1.y = p2.y;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i = 1; i < ext->point_cnt; i ++) {
|
||||
p1.x = p2.x;
|
||||
p1.y = p2.y;
|
||||
|
||||
p2.x = ((w * i) / (ext->point_cnt - 1)) + x_ofs;
|
||||
|
||||
y_tmp = (int32_t)((int32_t) ser->points[i] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
p2.y = h - y_tmp + y_ofs;
|
||||
|
||||
if(ser->points[i - 1] >= 0 && ser->points[i] >= 0)
|
||||
{
|
||||
lv_draw_line(&p1, &p2, mask, &style, opa_scale);
|
||||
}
|
||||
}
|
||||
p2.x = ((w * i) / (ext->point_cnt - 1)) + x_ofs;
|
||||
p1.x = p2.x;
|
||||
p1.y = p2.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,10 +62,10 @@ typedef struct
|
||||
/*Chart types*/
|
||||
enum
|
||||
{
|
||||
LV_CHART_TYPE_LINE = 0x01,
|
||||
LV_CHART_TYPE_COLUMN = 0x02,
|
||||
LV_CHART_TYPE_POINT = 0x04,
|
||||
LV_CHART_TYPE_VERTICAL_LINE = 0x08,
|
||||
LV_CHART_TYPE_LINE = 0x01, /*Connect the points with lines*/
|
||||
LV_CHART_TYPE_COLUMN = 0x02, /*Draw columns*/
|
||||
LV_CHART_TYPE_POINT = 0x04, /*Draw circles on the points*/
|
||||
LV_CHART_TYPE_VERTICAL_LINE = 0x08, /*Draw vertical lines on points (useful when chart width == point count)*/
|
||||
};
|
||||
typedef uint8_t lv_chart_type_t;
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ lv_coord_t lv_cont_get_fit_height(lv_obj_t * cont)
|
||||
{
|
||||
lv_style_t * style = lv_cont_get_style(cont);
|
||||
|
||||
return lv_obj_get_width(cont) - 2 * style->body.padding.hor;
|
||||
return lv_obj_get_height(cont) - 2 * style->body.padding.ver;
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -199,7 +199,7 @@ void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt)
|
||||
if(ext->sel_opt_id == sel_opt) return;
|
||||
|
||||
ext->sel_opt_id = sel_opt < ext->option_cnt ? sel_opt : ext->option_cnt - 1;
|
||||
|
||||
ext->sel_opt_id_ori = ext->sel_opt_id;
|
||||
/*Move the list to show the current option*/
|
||||
if(ext->opened == 0) {
|
||||
lv_ddlist_pos_current_option(ddlist);
|
||||
@@ -624,6 +624,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
} else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
ext->label = NULL;
|
||||
} else if(sign == LV_SIGNAL_FOCUS) {
|
||||
#if USE_LV_GROUP
|
||||
lv_group_t * g = lv_obj_get_group(ddlist);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
lv_hal_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
@@ -651,6 +652,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
lv_ddlist_refr_size(ddlist, true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else if(sign == LV_SIGNAL_DEFOCUS) {
|
||||
if(ext->opened) {
|
||||
ext->opened = false;
|
||||
@@ -686,9 +688,11 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
ext->opened = 0;
|
||||
if(ext->action) ext->action(ddlist);
|
||||
|
||||
#if USE_LV_GROUP
|
||||
lv_group_t * g = lv_obj_get_group(ddlist);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
if(editing) lv_group_set_editing(g, false); /*In edit mode go to navigate mode if an option is selected*/
|
||||
#endif
|
||||
} else {
|
||||
ext->opened = 1;
|
||||
}
|
||||
@@ -697,6 +701,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
} else if(c == LV_GROUP_KEY_ESC) {
|
||||
if(ext->opened) {
|
||||
ext->opened = 0;
|
||||
ext->sel_opt_id = ext->sel_opt_id_ori;
|
||||
lv_ddlist_refr_size(ddlist, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,11 +81,10 @@ lv_obj_t * lv_imgbtn_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
/*Copy an existing image button*/
|
||||
else {
|
||||
#if LV_IMGBTN_TILED == 0
|
||||
memset(ext->img_src, 0, sizeof(ext->img_src));
|
||||
#else
|
||||
lv_imgbtn_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
|
||||
#if LV_IMGBTN_TILED == 0
|
||||
memcpy(ext->img_src, copy_ext->img_src, sizeof(ext->img_src));
|
||||
#else
|
||||
memcpy(ext->img_src_left, copy_ext->img_src_left, sizeof(ext->img_src_left));
|
||||
memcpy(ext->img_src_mid, copy_ext->img_src_mid, sizeof(ext->img_src_mid));
|
||||
memcpy(ext->img_src_right, copy_ext->img_src_right, sizeof(ext->img_src_right));
|
||||
@@ -386,7 +385,7 @@ static void refr_img(lv_obj_t * imgbtn)
|
||||
ext->act_cf = LV_IMG_CF_UNKOWN;
|
||||
}
|
||||
|
||||
|
||||
lv_obj_invalidate(imgbtn);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -39,6 +39,9 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param);
|
||||
static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param);
|
||||
static void refr_btn_width(lv_obj_t * list);
|
||||
static void lv_list_btn_single_selected(lv_obj_t *btn);
|
||||
static bool lv_list_is_list_btn(lv_obj_t * list_btn);
|
||||
static bool lv_list_is_list_img(lv_obj_t * list_btn);
|
||||
static bool lv_list_is_list_label(lv_obj_t * list_btn);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -300,6 +303,9 @@ void lv_list_set_btn_selected(lv_obj_t * list, lv_obj_t * btn)
|
||||
}
|
||||
|
||||
ext->selected_btn = btn;
|
||||
if( btn != NULL ) {
|
||||
ext->last_sel = btn;
|
||||
}
|
||||
|
||||
if(ext->selected_btn) {
|
||||
lv_btn_state_t s = lv_btn_get_state(ext->selected_btn);
|
||||
@@ -427,7 +433,7 @@ lv_obj_t * lv_list_get_btn_label(const lv_obj_t * btn)
|
||||
lv_obj_t * label = lv_obj_get_child(btn, NULL);
|
||||
if(label == NULL) return NULL;
|
||||
|
||||
while(label->signal_func != label_signal) {
|
||||
while(lv_list_is_list_label(label) == false) {
|
||||
label = lv_obj_get_child(btn, label);
|
||||
if(label == NULL) break;
|
||||
}
|
||||
@@ -446,7 +452,7 @@ lv_obj_t * lv_list_get_btn_img(const lv_obj_t * btn)
|
||||
lv_obj_t * img = lv_obj_get_child(btn, NULL);
|
||||
if(img == NULL) return NULL;
|
||||
|
||||
while(img->signal_func != img_signal) {
|
||||
while(lv_list_is_list_img(img) == false) {
|
||||
img = lv_obj_get_child(btn, img);
|
||||
if(img == NULL) break;
|
||||
}
|
||||
@@ -474,7 +480,7 @@ lv_obj_t * lv_list_get_prev_btn(const lv_obj_t * list, lv_obj_t * prev_btn)
|
||||
btn = lv_obj_get_child(scrl, prev_btn);
|
||||
if(btn == NULL) return NULL;
|
||||
|
||||
while(btn->signal_func != lv_list_btn_signal) {
|
||||
while(lv_list_is_list_btn(btn) == false) {
|
||||
btn = lv_obj_get_child(scrl, btn);
|
||||
if(btn == NULL) break;
|
||||
}
|
||||
@@ -501,7 +507,7 @@ lv_obj_t * lv_list_get_next_btn(const lv_obj_t * list, lv_obj_t * prev_btn)
|
||||
btn = lv_obj_get_child_back(scrl, prev_btn);
|
||||
if(btn == NULL) return NULL;
|
||||
|
||||
while(btn->signal_func != lv_list_btn_signal) {
|
||||
while(lv_list_is_list_btn(btn) == false) {
|
||||
btn = lv_obj_get_child_back(scrl, btn);
|
||||
if(btn == NULL) break;
|
||||
}
|
||||
@@ -585,10 +591,10 @@ lv_style_t * lv_list_get_style(const lv_obj_t * list, lv_list_style_t type)
|
||||
style = lv_page_get_style(list, LV_PAGE_STYLE_BG);
|
||||
break;
|
||||
case LV_LIST_STYLE_SCRL:
|
||||
style = lv_page_get_style(list, LV_PAGE_STYLE_SB);
|
||||
style = lv_page_get_style(list, LV_PAGE_STYLE_SCRL);
|
||||
break;
|
||||
case LV_LIST_STYLE_SB:
|
||||
style = lv_page_get_style(list, LV_PAGE_STYLE_SCRL);
|
||||
style = lv_page_get_style(list, LV_PAGE_STYLE_SB);
|
||||
break;
|
||||
case LV_LIST_STYLE_EDGE_FLASH:
|
||||
style = lv_page_get_style(list, LV_PAGE_STYLE_EDGE_FLASH);
|
||||
@@ -760,7 +766,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
lv_group_t * g = lv_obj_get_group(list);
|
||||
if(lv_group_get_editing(g)) {
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
if(NULL != ext->last_sel) {
|
||||
if(ext->last_sel) {
|
||||
/* Select the last used button */
|
||||
lv_list_set_btn_selected(list, ext->last_sel);
|
||||
}
|
||||
@@ -779,7 +785,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
lv_list_set_btn_selected(list, last_clicked_btn);
|
||||
} else {
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
if(NULL != ext->last_sel) {
|
||||
if(ext->last_sel) {
|
||||
/* Select the last used button */
|
||||
lv_list_set_btn_selected(list, ext->last_sel);
|
||||
}
|
||||
@@ -968,4 +974,58 @@ static void lv_list_btn_single_selected(lv_obj_t *btn)
|
||||
} while (e != NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this is really a list button or another object.
|
||||
* @param list_btn List button
|
||||
*/
|
||||
static bool lv_list_is_list_btn(lv_obj_t * list_btn)
|
||||
{
|
||||
lv_obj_type_t type;
|
||||
|
||||
lv_obj_get_type(list_btn, &type);
|
||||
uint8_t cnt;
|
||||
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
|
||||
if(type.type[cnt] == NULL) break;
|
||||
if(!strcmp(type.type[cnt], "lv_btn"))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this is really a list label or another object.
|
||||
* @param list_label List label
|
||||
*/
|
||||
static bool lv_list_is_list_label(lv_obj_t * list_label)
|
||||
{
|
||||
lv_obj_type_t type;
|
||||
|
||||
lv_obj_get_type(list_label, &type);
|
||||
uint8_t cnt;
|
||||
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
|
||||
if(type.type[cnt] == NULL) break;
|
||||
if(!strcmp(type.type[cnt], "lv_label"))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this is really a list image or another object.
|
||||
* @param list_image List image
|
||||
*/
|
||||
static bool lv_list_is_list_img(lv_obj_t * list_img)
|
||||
{
|
||||
lv_obj_type_t type;
|
||||
|
||||
lv_obj_get_type(list_img, &type);
|
||||
uint8_t cnt;
|
||||
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
|
||||
if(type.type[cnt] == NULL) break;
|
||||
if(!strcmp(type.type[cnt], "lv_img"))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -59,8 +59,8 @@ typedef struct
|
||||
uint32_t size; /*the number of items(buttons) in the list*/
|
||||
bool single_mode; /* whether single selected mode is enabled */
|
||||
#if USE_LV_GROUP
|
||||
lv_obj_t * last_sel; /* Last btn selected */
|
||||
lv_obj_t * selected_btn;
|
||||
lv_obj_t * last_sel; /* The last selected button. It will be reverted when the list is focused again */
|
||||
lv_obj_t * selected_btn; /* The button is currently being selected*/
|
||||
#endif
|
||||
} lv_list_ext_t;
|
||||
|
||||
|
||||
@@ -567,7 +567,7 @@ void lv_page_scroll_ver(lv_obj_t * page, lv_coord_t dist)
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
#else
|
||||
lv_obj_set_y(scrl, lv_obj_get_x(scrl) + dist);
|
||||
lv_obj_set_y(scrl, lv_obj_get_y(scrl) + dist);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -361,6 +361,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
refr_position(roller, false);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_FOCUS) {
|
||||
#if USE_LV_GROUP
|
||||
lv_group_t * g = lv_obj_get_group(roller);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
lv_hal_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
@@ -382,12 +383,15 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id; /*Save the current value. Used to revert this state if ENER wont't be pressed*/
|
||||
|
||||
}
|
||||
#endif
|
||||
} else if(sign == LV_SIGNAL_DEFOCUS) {
|
||||
#if USE_LV_GROUP
|
||||
/*Revert the original state*/
|
||||
if(ext->ddlist.sel_opt_id != ext->ddlist.sel_opt_id_ori) {
|
||||
ext->ddlist.sel_opt_id = ext->ddlist.sel_opt_id_ori;
|
||||
refr_position(roller, true);
|
||||
}
|
||||
#endif
|
||||
} else if(sign == LV_SIGNAL_CONTROLL) {
|
||||
char c = *((char *)param);
|
||||
if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) {
|
||||
@@ -402,9 +406,11 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id; /*Set the entered value as default*/
|
||||
if(ext->ddlist.action) ext->ddlist.action(roller);
|
||||
|
||||
#if USE_LV_GROUP
|
||||
lv_group_t * g = lv_obj_get_group(roller);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
if(editing) lv_group_set_editing(g, false); /*In edit mode go to navigate mode if an option is selected*/
|
||||
#endif
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#if USE_LV_SPINBOX != 0
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -64,19 +65,18 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*Initialize the allocated 'ext'*/
|
||||
ext->ta.one_line = 1;
|
||||
ext->ta.pwd_mode = 0;
|
||||
ext->ta.accapted_chars = "1234567890+-.";
|
||||
ext->ta.accapted_chars = "1234567890+-. ";
|
||||
|
||||
ext->value = 0;
|
||||
ext->dec_point_pos = 2;
|
||||
ext->dec_point_pos = 0;
|
||||
ext->digit_count = 5;
|
||||
ext->step = 100;
|
||||
ext->digit_padding_left = 0;
|
||||
ext->step = 1;
|
||||
ext->range_max = 99999;
|
||||
ext->range_min = -99999;
|
||||
ext->value_changed_cb = NULL;
|
||||
|
||||
lv_ta_set_cursor_type(new_spinbox, LV_CURSOR_BLOCK | LV_CURSOR_HIDDEN); /*hidden by default*/
|
||||
lv_ta_set_cursor_pos(new_spinbox, 4);
|
||||
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_func(new_spinbox, lv_spinbox_signal);
|
||||
@@ -189,13 +189,11 @@ void lv_spinbox_set_range(lv_obj_t * spinbox, int32_t range_min, int32_t range_m
|
||||
ext->range_max = range_max;
|
||||
ext->range_min = range_min;
|
||||
|
||||
if(ext->value > ext->range_max)
|
||||
{
|
||||
if(ext->value > ext->range_max) {
|
||||
ext->value = ext->range_max;
|
||||
lv_obj_invalidate(spinbox);
|
||||
}
|
||||
if(ext->value < ext->range_min)
|
||||
{
|
||||
if(ext->value < ext->range_min) {
|
||||
ext->value = ext->range_min;
|
||||
lv_obj_invalidate(spinbox);
|
||||
}
|
||||
@@ -252,11 +250,9 @@ void lv_spinbox_step_next(lv_obj_t * spinbox)
|
||||
{
|
||||
lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox);
|
||||
|
||||
|
||||
if((ext->step / 10) < ext->range_max && (ext->step / 10) > ext->range_min && (ext->step / 10) > 0)
|
||||
{
|
||||
ext->step /= 10;
|
||||
}
|
||||
int32_t new_step = ext->step / 10;
|
||||
if((new_step) > 0) ext->step = new_step;
|
||||
else ext->step = 1;
|
||||
|
||||
lv_spinbox_updatevalue(spinbox);
|
||||
}
|
||||
@@ -268,12 +264,10 @@ void lv_spinbox_step_next(lv_obj_t * spinbox)
|
||||
void lv_spinbox_step_previous(lv_obj_t * spinbox)
|
||||
{
|
||||
lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox);
|
||||
|
||||
|
||||
if((ext->step * 10) <= ext->range_max && (ext->step * 10) > ext->range_min && (ext->step * 10) > 0)
|
||||
{
|
||||
ext->step *= 10;
|
||||
}
|
||||
int32_t step_limit;
|
||||
step_limit = LV_MATH_MAX(ext->range_max, (ext->range_min < 0 ? (-ext->range_min) : ext->range_min));
|
||||
int32_t new_step = ext->step * 10;
|
||||
if(new_step <= step_limit) ext->step = new_step;
|
||||
|
||||
lv_spinbox_updatevalue(spinbox);
|
||||
}
|
||||
@@ -286,20 +280,16 @@ void lv_spinbox_increment(lv_obj_t * spinbox)
|
||||
{
|
||||
lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox);
|
||||
|
||||
if(ext->value + ext->step <= ext->range_max)
|
||||
{
|
||||
if(ext->value + ext->step <= ext->range_max) {
|
||||
/*Special mode when zero crossing*/
|
||||
if((ext->value + ext->step) > 0 && ext->value < 0)
|
||||
{
|
||||
ext->value = -ext->value;
|
||||
}/*end special mode*/
|
||||
if((ext->value + ext->step) > 0 && ext->value < 0) ext->value = -ext->value;
|
||||
ext->value += ext->step;
|
||||
|
||||
if(ext->value_changed_cb != NULL)
|
||||
{
|
||||
ext->value_changed_cb(spinbox, ext->value);
|
||||
}
|
||||
} else {
|
||||
ext->value = ext->range_max;
|
||||
}
|
||||
|
||||
if(ext->value_changed_cb != NULL) ext->value_changed_cb(spinbox, ext->value);
|
||||
lv_spinbox_updatevalue(spinbox);
|
||||
}
|
||||
|
||||
@@ -311,20 +301,15 @@ void lv_spinbox_decrement(lv_obj_t * spinbox)
|
||||
{
|
||||
lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox);
|
||||
|
||||
if(ext->value - ext->step >= ext->range_min)
|
||||
{
|
||||
if(ext->value - ext->step >= ext->range_min) {
|
||||
/*Special mode when zero crossing*/
|
||||
if((ext->value - ext->step) < 0 && ext->value > 0)
|
||||
{
|
||||
ext->value = -ext->value;
|
||||
}/*end special mode*/
|
||||
if((ext->value - ext->step) < 0 && ext->value > 0) ext->value = -ext->value;
|
||||
ext->value -= ext->step;
|
||||
|
||||
if(ext->value_changed_cb != NULL)
|
||||
{
|
||||
ext->value_changed_cb(spinbox, ext->value);
|
||||
}
|
||||
} else {
|
||||
ext->value = ext->range_min;
|
||||
}
|
||||
|
||||
if(ext->value_changed_cb != NULL) ext->value_changed_cb(spinbox, ext->value);
|
||||
lv_spinbox_updatevalue(spinbox);
|
||||
}
|
||||
|
||||
@@ -366,131 +351,121 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_spinbox";
|
||||
}else if(sign == LV_SIGNAL_CONTROLL)
|
||||
{
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROLL) {
|
||||
lv_hal_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
|
||||
uint32_t c = *((uint32_t *)param); /*uint32_t because can be UTF-8*/
|
||||
if(c == LV_GROUP_KEY_RIGHT)
|
||||
{
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER)
|
||||
{
|
||||
lv_spinbox_increment(spinbox);
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_spinbox_step_next(spinbox);
|
||||
}
|
||||
if(c == LV_GROUP_KEY_RIGHT) {
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER) lv_spinbox_increment(spinbox);
|
||||
else lv_spinbox_step_next(spinbox);
|
||||
}
|
||||
else if(c == LV_GROUP_KEY_LEFT)
|
||||
{
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER)
|
||||
{
|
||||
lv_spinbox_decrement(spinbox);
|
||||
}
|
||||
else
|
||||
{
|
||||
else if(c == LV_GROUP_KEY_LEFT) {
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER) lv_spinbox_decrement(spinbox);
|
||||
else lv_spinbox_step_previous(spinbox);
|
||||
}
|
||||
else if(c == LV_GROUP_KEY_UP) {
|
||||
lv_spinbox_increment(spinbox);
|
||||
}
|
||||
else if(c == LV_GROUP_KEY_DOWN) {
|
||||
lv_spinbox_decrement(spinbox);
|
||||
}
|
||||
else if(c == LV_GROUP_KEY_ENTER) {
|
||||
|
||||
if(ext->step > 1) {
|
||||
lv_spinbox_step_next(spinbox);
|
||||
} else {
|
||||
/*Restart from the MSB*/
|
||||
ext->step = 1;
|
||||
uint32_t i;
|
||||
for(i = 0; i < ext->digit_count; i++) {
|
||||
int32_t new_step = ext->step * 10;
|
||||
if(new_step >= ext->range_max) break;
|
||||
ext->step = new_step;
|
||||
}
|
||||
lv_spinbox_step_previous(spinbox);
|
||||
}
|
||||
}
|
||||
else if(c == LV_GROUP_KEY_UP)
|
||||
{
|
||||
lv_spinbox_increment(spinbox);
|
||||
}
|
||||
else if(c == LV_GROUP_KEY_DOWN)
|
||||
{
|
||||
lv_spinbox_decrement(spinbox);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(c == LV_GROUP_KEY_ENTER)
|
||||
{
|
||||
int p = lv_ta_get_cursor_pos(spinbox);
|
||||
if(p == (1 + ext->digit_padding_left + ext->digit_count))
|
||||
{
|
||||
for(int i = 0; i < ext->digit_count; i++)
|
||||
lv_spinbox_step_previous(spinbox);
|
||||
} else
|
||||
{
|
||||
lv_spinbox_step_next(spinbox);
|
||||
}
|
||||
|
||||
|
||||
lv_spinbox_updatevalue(spinbox);
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_ta_add_char(spinbox, c);
|
||||
}
|
||||
else {
|
||||
lv_ta_add_char(spinbox, c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void lv_spinbox_updatevalue(lv_obj_t * spinbox)
|
||||
{
|
||||
lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox);
|
||||
int32_t v = ext->value;
|
||||
int32_t intDigits, decDigits;
|
||||
uint8_t dc = ext->digit_count;
|
||||
|
||||
intDigits = (ext->dec_point_pos==0) ? ext->digit_count : ext->dec_point_pos;
|
||||
decDigits = ext->digit_count - intDigits;
|
||||
char buf[LV_SPINBOX_MAX_DIGIT_COUNT + 8];
|
||||
memset(buf, 0, sizeof(buf));
|
||||
char * buf_p = buf;
|
||||
|
||||
ext->digits[0] = v>=0 ? '+' : '-';
|
||||
/*Add the sign*/
|
||||
(*buf_p) = ext->value >= 0 ? '+' : '-';
|
||||
buf_p++;
|
||||
|
||||
int pl; /*padding left*/
|
||||
for(pl = 0; pl < ext->digit_padding_left; pl++)
|
||||
{
|
||||
ext->digits[1 + pl] = ' ';
|
||||
int i;
|
||||
/*padding left*/
|
||||
for(i = 0; i < ext->digit_padding_left; i++) {
|
||||
(*buf_p) = ' ';
|
||||
buf_p++;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
uint8_t digits[16];
|
||||
char digits[64];
|
||||
/*Convert the numbers to string (the sign is already handled so always covert positive number)*/
|
||||
lv_math_num_to_str(ext->value < 0 ? -ext->value : ext->value, digits);
|
||||
|
||||
if(v < 0)
|
||||
v = -v;
|
||||
for(i = 0; i < dc; i++)
|
||||
{
|
||||
digits[i] = v%10;
|
||||
v = v/10;
|
||||
/*Add leading zeros*/
|
||||
int lz_cnt = ext->digit_count - (int)strlen(digits);
|
||||
if(lz_cnt > 0) {
|
||||
for(i = strlen(digits); i >= 0; i--) {
|
||||
digits[i + lz_cnt] = digits[i];
|
||||
}
|
||||
for(i = 0; i < lz_cnt; i++) {
|
||||
digits[i] = '0';
|
||||
}
|
||||
}
|
||||
|
||||
int k;
|
||||
for(k = 0; k < intDigits; k++)
|
||||
{
|
||||
ext->digits[1 + pl + k] = '0' + digits[--i];
|
||||
int32_t intDigits;
|
||||
intDigits = (ext->dec_point_pos == 0) ? ext->digit_count : ext->dec_point_pos;
|
||||
|
||||
/*Add the decimal part*/
|
||||
for(i = 0; i < intDigits && digits[i] != '\0'; i++) {
|
||||
(*buf_p) = digits[i];
|
||||
buf_p++;
|
||||
}
|
||||
|
||||
ext->digits[1 + pl + intDigits] = '.';
|
||||
if(ext->dec_point_pos != 0) {
|
||||
/*Insert the decimal point*/
|
||||
(*buf_p) = '.';
|
||||
buf_p++;
|
||||
|
||||
int d;
|
||||
|
||||
for(d = 0; d < decDigits; d++)
|
||||
{
|
||||
ext->digits[1 + pl + intDigits + 1 + d] = '0' + digits[--i];
|
||||
for(/*Leave i*/ ;i < ext->digit_count && digits[i] != '\0'; i++) {
|
||||
(*buf_p) = digits[i];
|
||||
buf_p++;
|
||||
}
|
||||
}
|
||||
|
||||
ext->digits[1 + pl + intDigits + 1 + decDigits] = '\0';
|
||||
/*Refresh the text*/
|
||||
lv_ta_set_text(spinbox, (char*)buf);
|
||||
|
||||
lv_label_set_text(ext->ta.label, (char*)ext->digits);
|
||||
|
||||
/*Set the cursor position*/
|
||||
int32_t step = ext->step;
|
||||
uint8_t cPos = ext->digit_count + pl;
|
||||
uint8_t cur_pos = ext->digit_count;
|
||||
while(step >= 10)
|
||||
{
|
||||
step /= 10;
|
||||
cPos--;
|
||||
cur_pos--;
|
||||
}
|
||||
|
||||
if(cPos > pl + intDigits )
|
||||
{
|
||||
cPos ++;
|
||||
}
|
||||
if(cur_pos > intDigits ) cur_pos ++; /*Skip teh decimal point*/
|
||||
|
||||
lv_ta_set_cursor_pos(spinbox, cPos);
|
||||
cur_pos += ext->digit_padding_left;
|
||||
|
||||
lv_ta_set_cursor_pos(spinbox, cur_pos);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -50,11 +50,9 @@ typedef struct {
|
||||
int32_t range_max;
|
||||
int32_t range_min;
|
||||
int32_t step;
|
||||
uint8_t digit_count:4;
|
||||
uint8_t dec_point_pos:4; /*if 0, there is no separator and the number is an integer*/
|
||||
uint8_t digit_padding_left:4;
|
||||
uint8_t digit_padding_right:4;
|
||||
uint8_t digits[1+1+LV_SPINBOX_MAX_DIGIT_COUNT]; /*1 sign, 1 point, 16 num digits*/
|
||||
uint16_t digit_count:4;
|
||||
uint16_t dec_point_pos:4; /*if 0, there is no separator and the number is an integer*/
|
||||
uint16_t digit_padding_left:4;
|
||||
lv_spinbox_value_changed_cb_t value_changed_cb;
|
||||
} lv_spinbox_ext_t;
|
||||
|
||||
|
||||
@@ -1104,6 +1104,8 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
|
||||
static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
|
||||
{
|
||||
lv_res_t res;
|
||||
lv_obj_t * ta = lv_obj_get_parent(scrl);
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
|
||||
/* Include the ancient signal function */
|
||||
res = scrl_signal(scrl, sign, param);
|
||||
@@ -1111,12 +1113,27 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
||||
|
||||
if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
|
||||
/*Set ext. size because the cursor might be out of this object*/
|
||||
lv_obj_t * ta = lv_obj_get_parent(scrl);
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
lv_style_t * style_label = lv_obj_get_style(ext->label);
|
||||
lv_coord_t font_h = lv_font_get_height(style_label->text.font);
|
||||
scrl->ext_size = LV_MATH_MAX(scrl->ext_size, style_label->text.line_space + font_h);
|
||||
}
|
||||
#if 0
|
||||
else if(sign == LV_SIGNAL_CORD_CHG) {
|
||||
/*Set the label width according to the text area width*/
|
||||
if(ext->label) {
|
||||
if(lv_obj_get_width(ta) != lv_area_get_width(param) ||
|
||||
lv_obj_get_height(ta) != lv_area_get_height(param)) {
|
||||
lv_obj_t * scrl = lv_page_get_scrl(ta);
|
||||
lv_style_t * style_scrl = lv_obj_get_style(scrl);
|
||||
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor);
|
||||
lv_obj_set_pos(ext->label, style_scrl->body.padding.hor, style_scrl->body.padding.ver);
|
||||
lv_label_set_text(ext->label, NULL); /*Refresh the label*/
|
||||
|
||||
refr_cursor_area(ta);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -621,12 +621,14 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
lv_hal_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
/*With ENCODER select the first button only in edit mode*/
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER) {
|
||||
#if USE_LV_GROUP
|
||||
lv_group_t * g = lv_obj_get_group(tabview);
|
||||
if(lv_group_get_editing(g)) {
|
||||
lv_btnm_ext_t * btnm_ext = lv_obj_get_ext_attr(ext->btns);
|
||||
btnm_ext->btn_id_pr = 0;
|
||||
lv_obj_invalidate(ext->btns);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
lv_btnm_ext_t * btnm_ext = lv_obj_get_ext_attr(ext->btns);
|
||||
btnm_ext->btn_id_pr = 0;
|
||||
|
||||
@@ -220,7 +220,7 @@ void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, b
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
lv_obj_set_size(tileview, x_coord, y_coord);
|
||||
lv_obj_set_pos(scrl, x_coord, y_coord);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,6 +334,8 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
lv_obj_t * tileview = lv_obj_get_parent(scrl);
|
||||
lv_style_t * style_bg = lv_tileview_get_style(tileview, LV_TILEVIEW_STYLE_BG);
|
||||
|
||||
|
||||
/*Apply constraint on moving of the tileview*/
|
||||
if(sign == LV_SIGNAL_CORD_CHG) {
|
||||
@@ -377,7 +379,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
||||
lv_page_start_edge_flash(tileview);
|
||||
}
|
||||
|
||||
lv_obj_set_y(scrl, -ext->act_id.y * h);
|
||||
lv_obj_set_y(scrl, -ext->act_id.y * h + style_bg->body.padding.ver);
|
||||
}
|
||||
}
|
||||
if(ext->drag_bottom_en == 0 && indev->proc.vect.y < 0 && ext->drag_hor == 0) {
|
||||
@@ -390,7 +392,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
||||
}
|
||||
}
|
||||
|
||||
lv_obj_set_y(scrl, -ext->act_id.y * h);
|
||||
lv_obj_set_y(scrl, -ext->act_id.y * h + style_bg->body.padding.ver);
|
||||
}
|
||||
if(ext->drag_left_en == 0) {
|
||||
if(x > -(ext->act_id.x * w) && indev->proc.vect.x > 0 && ext->drag_ver == 0) {
|
||||
@@ -401,7 +403,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
||||
lv_page_start_edge_flash(tileview);
|
||||
}
|
||||
|
||||
lv_obj_set_x(scrl, -ext->act_id.x * w);
|
||||
lv_obj_set_x(scrl, -ext->act_id.x * w + style_bg->body.padding.hor);
|
||||
}
|
||||
}
|
||||
if(ext->drag_right_en == 0 && indev->proc.vect.x < 0 && ext->drag_ver == 0) {
|
||||
@@ -414,12 +416,12 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
||||
}
|
||||
}
|
||||
|
||||
lv_obj_set_x(scrl, -ext->act_id.x * w);
|
||||
lv_obj_set_x(scrl, -ext->act_id.x * w + style_bg->body.padding.hor);
|
||||
}
|
||||
|
||||
/*Apply the drag constraints*/
|
||||
if(ext->drag_ver == 0) lv_obj_set_y(scrl, - ext->act_id.y * lv_obj_get_height(tileview));
|
||||
if(ext->drag_hor == 0) lv_obj_set_x(scrl, - ext->act_id.x * lv_obj_get_width(tileview));
|
||||
if(ext->drag_ver == 0) lv_obj_set_y(scrl, - ext->act_id.y * lv_obj_get_height(tileview) + style_bg->body.padding.ver);
|
||||
if(ext->drag_hor == 0) lv_obj_set_x(scrl, - ext->act_id.x * lv_obj_get_width(tileview) + style_bg->body.padding.hor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@ static void basic_init(void)
|
||||
panel.body.border.width = 2;
|
||||
panel.body.border.opa = LV_OPA_60;
|
||||
panel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
panel.image.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
panel.line.color = lv_color_hsv_to_rgb(_hue, 20, 70);
|
||||
|
||||
/*Scrollbar*/
|
||||
@@ -156,6 +157,7 @@ static void btn_init(void)
|
||||
btn_rel.body.padding.inner = LV_DPI / 10;
|
||||
btn_rel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
btn_rel.text.font = _font;
|
||||
btn_rel.image.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
|
||||
lv_style_copy(&btn_pr, &btn_rel);
|
||||
btn_pr.body.opa = LV_OPA_COVER;
|
||||
@@ -165,6 +167,7 @@ static void btn_init(void)
|
||||
btn_pr.body.border.opa = LV_OPA_60;
|
||||
btn_pr.text.font = _font;
|
||||
btn_pr.text.color = lv_color_hsv_to_rgb(_hue, 10, 100);
|
||||
btn_pr.image.color = lv_color_hsv_to_rgb(_hue, 10, 100);
|
||||
|
||||
lv_style_copy(&btn_trel, &btn_pr);
|
||||
btn_trel.body.opa = LV_OPA_COVER;
|
||||
@@ -175,6 +178,7 @@ static void btn_init(void)
|
||||
btn_trel.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 90);
|
||||
btn_trel.text.font = _font;
|
||||
btn_trel.text.color = lv_color_hsv_to_rgb(_hue, 0, 100);
|
||||
btn_trel.image.color = lv_color_hsv_to_rgb(_hue, 0, 100);
|
||||
|
||||
lv_style_copy(&btn_tpr, &btn_trel);
|
||||
btn_tpr.body.opa = LV_OPA_COVER;
|
||||
@@ -185,6 +189,7 @@ static void btn_init(void)
|
||||
btn_tpr.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
btn_tpr.text.font = _font;
|
||||
btn_tpr.text.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||
btn_tpr.image.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||
|
||||
lv_style_copy(&btn_ina, &btn_rel);
|
||||
btn_ina.body.border.opa = LV_OPA_60;
|
||||
@@ -615,6 +620,7 @@ static void list_init(void)
|
||||
list_rel.body.border.opa = LV_OPA_COVER;
|
||||
list_rel.text.color = lv_color_hsv_to_rgb(_hue, 10, 94);
|
||||
list_rel.text.font = _font;
|
||||
list_rel.image.color = lv_color_hsv_to_rgb(_hue, 10, 94);
|
||||
|
||||
lv_style_copy(&list_pr, &list_rel);
|
||||
list_pr.body.empty = 0;
|
||||
@@ -622,6 +628,7 @@ static void list_init(void)
|
||||
list_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 34, 41);
|
||||
list_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 34, 41);
|
||||
list_pr.text.color = lv_color_hsv_to_rgb(_hue, 7, 96);
|
||||
list_pr.image.color = lv_color_hsv_to_rgb(_hue, 7, 96);
|
||||
|
||||
lv_style_copy(&list_trel, &list_rel);
|
||||
lv_style_copy(&list_tpr, &list_pr);
|
||||
@@ -787,6 +794,7 @@ static void win_init(void)
|
||||
header.body.border.color = lv_color_hsv_to_rgb(_hue, 20, 80);
|
||||
header.body.border.part = LV_BORDER_BOTTOM;
|
||||
header.text.color = lv_color_hsv_to_rgb(_hue, 5, 100);
|
||||
header.image.color = lv_color_hsv_to_rgb(_hue, 5, 100);
|
||||
|
||||
theme.win.bg = &bg;
|
||||
theme.win.sb = &sb;
|
||||
|
||||
@@ -72,6 +72,7 @@ static void basic_init(void)
|
||||
panel.body.padding.ver = LV_DPI / 8;
|
||||
panel.body.padding.inner = LV_DPI / 12;
|
||||
panel.text.color = LV_COLOR_HEX3(0x333);
|
||||
panel.image.color = LV_COLOR_HEX3(0x333);
|
||||
|
||||
lv_style_copy(&sb, &def);
|
||||
sb.body.main_color = LV_COLOR_BLACK;
|
||||
@@ -109,6 +110,7 @@ static void btn_init(void)
|
||||
rel.body.shadow.type = LV_SHADOW_BOTTOM;
|
||||
rel.body.shadow.width = 6;
|
||||
rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95);
|
||||
rel.image.color = lv_color_hsv_to_rgb(_hue, 5, 95);
|
||||
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
@@ -131,6 +133,7 @@ static void btn_init(void)
|
||||
ina.body.grad_color = ina.body.main_color;
|
||||
ina.body.shadow.width = 0;
|
||||
ina.text.color = lv_color_hsv_to_rgb(_hue, 95, 5);
|
||||
ina.image.color = lv_color_hsv_to_rgb(_hue, 95, 5);
|
||||
|
||||
theme.btn.rel = &rel;
|
||||
theme.btn.pr = ≺
|
||||
@@ -760,6 +763,7 @@ static void win_init(void)
|
||||
header.body.padding.hor = 0;
|
||||
header.body.padding.ver = 0;
|
||||
header.text.color = LV_COLOR_HEX3(0x333);
|
||||
header.image.color = LV_COLOR_HEX3(0x333);
|
||||
|
||||
lv_style_copy(&pr, &def);
|
||||
pr.body.main_color = LV_COLOR_HEX3(0xbbb);
|
||||
@@ -768,6 +772,7 @@ static void win_init(void)
|
||||
pr.body.empty = 0;
|
||||
pr.body.radius = 0;
|
||||
pr.text.color = LV_COLOR_HEX3(0x111);
|
||||
pr.image.color = LV_COLOR_HEX3(0x111);
|
||||
|
||||
|
||||
theme.win.bg = theme.panel;
|
||||
|
||||
@@ -59,6 +59,7 @@ static void basic_init(void)
|
||||
bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 11, 30);
|
||||
bg.text.color = lv_color_hsv_to_rgb(_hue, 5, 95);
|
||||
bg.text.font = _font;
|
||||
bg.image.color = lv_color_hsv_to_rgb(_hue, 5, 95);
|
||||
|
||||
lv_style_copy(&sb, &def);
|
||||
sb.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 60);
|
||||
@@ -109,6 +110,7 @@ static void btn_init(void)
|
||||
btn_rel.body.shadow.color = LV_COLOR_HEX3(0x111);
|
||||
btn_rel.body.shadow.width = LV_DPI / 30;
|
||||
btn_rel.text.color = LV_COLOR_HEX3(0xeee);
|
||||
btn_rel.image.color = LV_COLOR_HEX3(0xeee);
|
||||
|
||||
lv_style_copy(&btn_pr, &btn_rel);
|
||||
btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 30);
|
||||
@@ -119,18 +121,21 @@ static void btn_init(void)
|
||||
btn_tgl_rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 40);
|
||||
btn_tgl_rel.body.shadow.width = LV_DPI / 40;
|
||||
btn_tgl_rel.text.color = LV_COLOR_HEX3(0xddd);
|
||||
btn_tgl_rel.image.color = LV_COLOR_HEX3(0xddd);
|
||||
|
||||
lv_style_copy(&btn_tgl_pr, &btn_rel);
|
||||
btn_tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 10);
|
||||
btn_tgl_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 30);
|
||||
btn_tgl_pr.body.shadow.width = LV_DPI / 30;
|
||||
btn_tgl_pr.text.color = LV_COLOR_HEX3(0xddd);
|
||||
btn_tgl_pr.image.color = LV_COLOR_HEX3(0xddd);
|
||||
|
||||
lv_style_copy(&btn_ina, &btn_rel);
|
||||
btn_ina.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
btn_ina.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
btn_ina.text.color = LV_COLOR_HEX3(0xaaa);
|
||||
btn_ina.body.shadow.width = 0;
|
||||
btn_ina.text.color = LV_COLOR_HEX3(0xaaa);
|
||||
btn_ina.image.color = LV_COLOR_HEX3(0xaaa);
|
||||
|
||||
theme.btn.rel = &btn_rel;
|
||||
theme.btn.pr = &btn_pr;
|
||||
@@ -678,6 +683,7 @@ static void win_init(void)
|
||||
win_btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 10);
|
||||
win_btn_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 10);
|
||||
win_btn_pr.text.color = LV_COLOR_HEX3(0xaaa);
|
||||
win_btn_pr.image.color = LV_COLOR_HEX3(0xaaa);
|
||||
|
||||
theme.win.bg = &win_bg;
|
||||
theme.win.sb = &sb;
|
||||
|
||||
@@ -52,6 +52,7 @@ static void basic_init(void)
|
||||
def.body.border.opa = LV_OPA_COVER;
|
||||
def.text.font = _font;
|
||||
def.text.color = LV_COLOR_HEX3(0x444);
|
||||
def.image.color = LV_COLOR_HEX3(0x444);
|
||||
|
||||
lv_style_copy(&bg, &def);
|
||||
bg.body.main_color = LV_COLOR_WHITE;
|
||||
@@ -106,19 +107,23 @@ static void btn_init(void)
|
||||
rel.body.padding.hor = LV_DPI / 4;
|
||||
rel.body.padding.ver = LV_DPI / 8;
|
||||
rel.text.color = lv_color_hsv_to_rgb(_hue, 40, 90);
|
||||
rel.image.color = lv_color_hsv_to_rgb(_hue, 40, 90);
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
pr.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
||||
pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
||||
pr.body.shadow.width = 0;
|
||||
pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
||||
pr.image.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
||||
|
||||
lv_style_copy(&tgl_pr, &pr);
|
||||
tgl_pr.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 50);
|
||||
tgl_pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 50);
|
||||
tgl_pr.image.color = lv_color_hsv_to_rgb(_hue, 40, 50);
|
||||
|
||||
lv_style_copy(&ina, &tgl_pr);
|
||||
ina.body.border.color = LV_COLOR_HEX3(0xbbb);
|
||||
ina.text.color = LV_COLOR_HEX3(0xbbb);
|
||||
ina.image.color = LV_COLOR_HEX3(0xbbb);
|
||||
|
||||
theme.btn.rel = &rel;
|
||||
theme.btn.pr = ≺
|
||||
@@ -584,18 +589,22 @@ static void list_init(void)
|
||||
rel.body.padding.hor = LV_DPI / 8;
|
||||
rel.body.padding.ver = LV_DPI / 8;
|
||||
rel.text.color = LV_COLOR_HEX3(0x666);
|
||||
rel.image.color = LV_COLOR_HEX3(0x666);
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
pr.text.color = theme.btn.pr->text.color;
|
||||
pr.image.color = theme.btn.pr->image.color;
|
||||
|
||||
lv_style_copy(&tgl_rel, &rel);
|
||||
tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 50, 90);
|
||||
|
||||
lv_style_copy(&tgl_pr, &rel);
|
||||
tgl_pr.text.color = theme.btn.tgl_pr->text.color;
|
||||
tgl_pr.image.color = theme.btn.tgl_pr->image.color;
|
||||
|
||||
lv_style_copy(&ina, &rel);
|
||||
ina.text.color = theme.btn.ina->text.color;
|
||||
ina.image.color = theme.btn.ina->image.color;
|
||||
|
||||
theme.list.sb = &sb;
|
||||
theme.list.bg = &bg;
|
||||
@@ -727,14 +736,17 @@ static void win_init(void)
|
||||
header.body.border.part = LV_BORDER_BOTTOM;
|
||||
header.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||
header.text.color = LV_COLOR_HEX3(0x666);
|
||||
header.image.color = LV_COLOR_HEX3(0x666);
|
||||
|
||||
lv_style_copy(&rel, &def);
|
||||
rel.body.empty = 1;
|
||||
rel.body.border.width = 0;
|
||||
rel.text.color = LV_COLOR_HEX3(0x666);
|
||||
rel.image.color = LV_COLOR_HEX3(0x666);
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
pr.text.color = LV_COLOR_HEX3(0x333);
|
||||
pr.image.color = LV_COLOR_HEX3(0x333);
|
||||
|
||||
theme.win.bg = theme.panel;
|
||||
theme.win.sb = &sb;
|
||||
|
||||
Reference in New Issue
Block a user