Compare commits
422 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acb46aaed1 | ||
|
|
7caa2bf9ad | ||
|
|
a0f338eb6f | ||
|
|
0f0d57d855 | ||
|
|
5d42f92c86 | ||
|
|
42a7fda05d | ||
|
|
5810baa021 | ||
|
|
f36f8fe253 | ||
|
|
d56708b45e | ||
|
|
d0b408d679 | ||
|
|
7e3739576f | ||
|
|
565633828c | ||
|
|
061c6325b7 | ||
|
|
66c184a84d | ||
|
|
e3a07ed58c | ||
|
|
e1963a4a3d | ||
|
|
05f6b67b5f | ||
|
|
eb76519d25 | ||
|
|
7b0a0ef4a7 | ||
|
|
48f8d83bdc | ||
|
|
a728817fb5 | ||
|
|
ad422250db | ||
|
|
243c448df9 | ||
|
|
ec7397e4a0 | ||
|
|
245de140f4 | ||
|
|
0ec409f83e | ||
|
|
cc505a3cb2 | ||
|
|
b58f9c6021 | ||
|
|
4560a72c32 | ||
|
|
85d375b128 | ||
|
|
99f49f9097 | ||
|
|
a0e6f7f022 | ||
|
|
1c3bbc9f6c | ||
|
|
0aa4591021 | ||
|
|
c85295b5ea | ||
|
|
28213adfa6 | ||
|
|
25b0b994a0 | ||
|
|
2b60f4496f | ||
|
|
1d714bfed7 | ||
|
|
b7d7bf7dd5 | ||
|
|
373af97472 | ||
|
|
3e9495a074 | ||
|
|
1072b71ea0 | ||
|
|
cb0d6f40c9 | ||
|
|
0f69469eee | ||
|
|
f2a59c23f1 | ||
|
|
cac6f92964 | ||
|
|
0d2784a13e | ||
|
|
80a4c6ff14 | ||
|
|
013ae48221 | ||
|
|
daec3626bc | ||
|
|
fd695c9ad3 | ||
|
|
88ce04cea3 | ||
|
|
06d7a6d006 | ||
|
|
529fee1e20 | ||
|
|
ca9dfb7063 | ||
|
|
83ca45e0c8 | ||
|
|
fd411e200f | ||
|
|
3592a2ac17 | ||
|
|
8cc951202c | ||
|
|
ac89d1245b | ||
|
|
2172ec93a2 | ||
|
|
c173f28a3f | ||
|
|
a5a7329d41 | ||
|
|
ed10c1da67 | ||
|
|
bb730735f2 | ||
|
|
834b498aec | ||
|
|
2fb690b3b9 | ||
|
|
28a668ce09 | ||
|
|
5a2cf28c54 | ||
|
|
ed480e821c | ||
|
|
f11f7c5223 | ||
|
|
3b4bff79c2 | ||
|
|
f30dc5d186 | ||
|
|
da5c9dd424 | ||
|
|
89adfbc816 | ||
|
|
d125472e81 | ||
|
|
28495b9eb9 | ||
|
|
4fefa2ee28 | ||
|
|
00e93a5d30 | ||
|
|
95ef03baa8 | ||
|
|
dae3ebdb66 | ||
|
|
fb3e6ec1f4 | ||
|
|
bb4e4a9e53 | ||
|
|
4df27fc5b2 | ||
|
|
f7870310dc | ||
|
|
3c3fe46447 | ||
|
|
806f3a9bbf | ||
|
|
dca7cedb28 | ||
|
|
557342cc08 | ||
|
|
eb725a3a68 | ||
|
|
53f002c3f8 | ||
|
|
b48120947f | ||
|
|
4659289924 | ||
|
|
cc0ea22903 | ||
|
|
c0ca1a025b | ||
|
|
35b3a1f2a4 | ||
|
|
6731e44503 | ||
|
|
7b68e6e426 | ||
|
|
c36a96914b | ||
|
|
ab6f93db24 | ||
|
|
57079452b0 | ||
|
|
960bca7807 | ||
|
|
67400d1d72 | ||
|
|
ecfef570ea | ||
|
|
75875e244d | ||
|
|
1db33435c1 | ||
|
|
2d984da893 | ||
|
|
5b062a0d8d | ||
|
|
c0a7cf76b9 | ||
|
|
44e57aaaf5 | ||
|
|
d06fe5100e | ||
|
|
ae94302f4d | ||
|
|
b26b4435a5 | ||
|
|
da9a5f58d0 | ||
|
|
a4774ccc72 | ||
|
|
a6289f5e85 | ||
|
|
dd56e9a013 | ||
|
|
e31993bdf2 | ||
|
|
6dac633235 | ||
|
|
1d5300e02f | ||
|
|
b646365e2c | ||
|
|
798f3177f2 | ||
|
|
0921cf6e3b | ||
|
|
ac5f1998e4 | ||
|
|
433435889a | ||
|
|
a66afca68e | ||
|
|
b1213dcc59 | ||
|
|
f8c8c4040a | ||
|
|
2f33670b4f | ||
|
|
d8e10c41cf | ||
|
|
7e38ac68e3 | ||
|
|
abff805509 | ||
|
|
18072b3dd4 | ||
|
|
4640611758 | ||
|
|
baeda1998f | ||
|
|
e1a09551ce | ||
|
|
ba7a86de74 | ||
|
|
6cb79914a8 | ||
|
|
f1f0aa621a | ||
|
|
43a77d8699 | ||
|
|
58b88bf1fb | ||
|
|
96bc397821 | ||
|
|
fd508065dd | ||
|
|
416ef9e251 | ||
|
|
09250d0a92 | ||
|
|
822e06be39 | ||
|
|
c07ef75ac5 | ||
|
|
2a6f5d46ab | ||
|
|
e3f6a3327d | ||
|
|
6227aaee96 | ||
|
|
08591a8e8c | ||
|
|
106e023c80 | ||
|
|
a5de71933b | ||
|
|
e85888908a | ||
|
|
1a3b6d4cb3 | ||
|
|
e587ceb22e | ||
|
|
b769463d39 | ||
|
|
cbc88285d3 | ||
|
|
ec64820272 | ||
|
|
15b7ea6614 | ||
|
|
843555a4b1 | ||
|
|
5f4c26cb79 | ||
|
|
019042297d | ||
|
|
46a4469a9c | ||
|
|
646cb71a9d | ||
|
|
ad262172de | ||
|
|
343b70b19c | ||
|
|
b802e7e775 | ||
|
|
2cecd01b30 | ||
|
|
2ba1fc625f | ||
|
|
aff7a22ac5 | ||
|
|
5a23fd569b | ||
|
|
234e74202c | ||
|
|
914c874ada | ||
|
|
a6793b2695 | ||
|
|
45bf6a3862 | ||
|
|
f00a6a118d | ||
|
|
c599a59f05 | ||
|
|
c97a0684cf | ||
|
|
418413e334 | ||
|
|
815e0afdaf | ||
|
|
faf56680f8 | ||
|
|
b2d78dcca7 | ||
|
|
38e68eeb7a | ||
|
|
0f69cbf087 | ||
|
|
039080fc26 | ||
|
|
7e9cf858d6 | ||
|
|
a740af4afb | ||
|
|
a117b3cead | ||
|
|
e30efb716f | ||
|
|
43f5e4d2e0 | ||
|
|
e178bcc9f3 | ||
|
|
d8585d2ea3 | ||
|
|
41c4c25315 | ||
|
|
9e56f750a7 | ||
|
|
4396196889 | ||
|
|
e6fe8436f4 | ||
|
|
f3f1c606b6 | ||
|
|
e9d3001dbf | ||
|
|
fd186eeb15 | ||
|
|
25607ceaee | ||
|
|
4b2c3e560b | ||
|
|
989016dff3 | ||
|
|
c54788fae4 | ||
|
|
c7fb2ad12c | ||
|
|
2fdeaf5599 | ||
|
|
1051e3f5a4 | ||
|
|
0b68c21840 | ||
|
|
ac26442ca6 | ||
|
|
b539e6dc46 | ||
|
|
06603a9c84 | ||
|
|
6b45f3ade5 | ||
|
|
6b246b2fed | ||
|
|
86f74e3da2 | ||
|
|
c4e7d7cb83 | ||
|
|
43b69a88a9 | ||
|
|
6d1da27b3c | ||
|
|
bae04005d3 | ||
|
|
edeca8c01b | ||
|
|
069e24bdb2 | ||
|
|
d0db0bab5c | ||
|
|
421f1b2c01 | ||
|
|
92027cc06f | ||
|
|
ddbeb212b7 | ||
|
|
d055944ebb | ||
|
|
40daa7195d | ||
|
|
3e8b39c404 | ||
|
|
e06201f042 | ||
|
|
2d7423100a | ||
|
|
6971d603d2 | ||
|
|
aad9f4f0c1 | ||
|
|
76625adec2 | ||
|
|
8b3f9f19f6 | ||
|
|
97f999ed9f | ||
|
|
e678a2c599 | ||
|
|
6056bc3b95 | ||
|
|
91f64c8662 | ||
|
|
274d0b522d | ||
|
|
ac7527fecf | ||
|
|
2ed6b4e2f5 | ||
|
|
3761db65e0 | ||
|
|
eb006b3d39 | ||
|
|
f10f94bea3 | ||
|
|
710226c6db | ||
|
|
44a96df9fb | ||
|
|
cd788da47a | ||
|
|
c4eec78a02 | ||
|
|
1e33359d0c | ||
|
|
cf8357e004 | ||
|
|
8f243c01d5 | ||
|
|
e2aa68394c | ||
|
|
2828582c7a | ||
|
|
f6a2c635fd | ||
|
|
db24bf1d18 | ||
|
|
8c151a2d43 | ||
|
|
52cca1dd9b | ||
|
|
859f72eb84 | ||
|
|
b77d484a27 | ||
|
|
1733508e9a | ||
|
|
5f6c7743ad | ||
|
|
2550368d30 | ||
|
|
63aba1b3de | ||
|
|
42f79763e1 | ||
|
|
be19e91e91 | ||
|
|
9561aa767d | ||
|
|
4c629ec23f | ||
|
|
8864cd87ee | ||
|
|
916f5b343a | ||
|
|
c0223977d1 | ||
|
|
e1c5d8950f | ||
|
|
20c46ca640 | ||
|
|
188205399b | ||
|
|
0d0427f8bc | ||
|
|
f9512f55cc | ||
|
|
201d38c574 | ||
|
|
8dbd685a90 | ||
|
|
4345e05e32 | ||
|
|
24b1a7735a | ||
|
|
b16f3ff8e7 | ||
|
|
0f4aeede79 | ||
|
|
5d4873aa95 | ||
|
|
8ac337d515 | ||
|
|
2678068a86 | ||
|
|
64be5e2096 | ||
|
|
6b3d7759cc | ||
|
|
765b6c4015 | ||
|
|
1521d64784 | ||
|
|
25fbcea31a | ||
|
|
51e064d836 | ||
|
|
6ae7f67ef5 | ||
|
|
156a3c005d | ||
|
|
295337ac7e | ||
|
|
a39f51a571 | ||
|
|
d050c99161 | ||
|
|
1523cc0634 | ||
|
|
65d029279b | ||
|
|
d2d664a69b | ||
|
|
4a953b9d9d | ||
|
|
ae748cfffa | ||
|
|
ad215c5b4b | ||
|
|
2dd84e6de1 | ||
|
|
05d249d5ee | ||
|
|
f746ac8542 | ||
|
|
7af64df008 | ||
|
|
975ab3f4cc | ||
|
|
122ef1d862 | ||
|
|
4174ad844c | ||
|
|
41e65d9df1 | ||
|
|
2d0480c03d | ||
|
|
b0c9c8778d | ||
|
|
91c98f147f | ||
|
|
0bdeb00838 | ||
|
|
eee2184d10 | ||
|
|
df9801eac3 | ||
|
|
eacc9d8ce7 | ||
|
|
d6e7187d01 | ||
|
|
f61f045135 | ||
|
|
4668bc0ee3 | ||
|
|
ae93ee067c | ||
|
|
59165f077e | ||
|
|
832dbd644b | ||
|
|
00f8af0fb5 | ||
|
|
10ee9e5e99 | ||
|
|
33de1ffdc7 | ||
|
|
fe5663908c | ||
|
|
f23873e3f5 | ||
|
|
585bc329e6 | ||
|
|
c20e62d472 | ||
|
|
9260f9e0aa | ||
|
|
8532bf80df | ||
|
|
a2bb4099e6 | ||
|
|
182cbb1aa4 | ||
|
|
ccff331e3d | ||
|
|
43cc512e5a | ||
|
|
a265165038 | ||
|
|
8117a70608 | ||
|
|
dca12fcd7a | ||
|
|
e2dabe167d | ||
|
|
14a359679a | ||
|
|
3b111c794c | ||
|
|
1ca1934dbe | ||
|
|
ce8d333407 | ||
|
|
71e23c4e13 | ||
|
|
84776ca5f7 | ||
|
|
91acf877c6 | ||
|
|
0ebcf7e266 | ||
|
|
3c70a1b5a2 | ||
|
|
4effebb3ea | ||
|
|
9eff0d1cd8 | ||
|
|
07ddc9bf8a | ||
|
|
9048bcc6a0 | ||
|
|
94b2e0f1a3 | ||
|
|
a62b03743d | ||
|
|
4754935038 | ||
|
|
ee44433f86 | ||
|
|
9c8c8aee72 | ||
|
|
2739753f20 | ||
|
|
14de809fa5 | ||
|
|
06fa5b3b8f | ||
|
|
1b9ccf9cc6 | ||
|
|
36e825f093 | ||
|
|
13a53d077d | ||
|
|
479851e968 | ||
|
|
0867f72cb9 | ||
|
|
df08d0bd54 | ||
|
|
bb5c6437ff | ||
|
|
e1af20997d | ||
|
|
cd9f34076e | ||
|
|
0d897136c9 | ||
|
|
0e1b02e328 | ||
|
|
e3b5a14275 | ||
|
|
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 | ||
|
|
2be22d3bef | ||
|
|
6a35a384b8 | ||
|
|
691ce77800 | ||
|
|
7e4e5b7271 | ||
|
|
1666c8cb4f | ||
|
|
8f19010b17 | ||
|
|
4fade082e5 | ||
|
|
b23d945ed4 | ||
|
|
10ca6d4215 | ||
|
|
2712f0aeaa | ||
|
|
aaa78ba949 |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1 +1 @@
|
|||||||
custom: ["https://littlevgl.com/donate"]
|
custom: ["https://www.paypal.com/paypalme/my/profile"]
|
||||||
|
|||||||
12
.github/auto-comment.yml
vendored
Normal file
12
.github/auto-comment.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Comment to a new issue.
|
||||||
|
pullRequestOpened: |
|
||||||
|
Thank you for raising your pull request.
|
||||||
|
|
||||||
|
To ensure that all licensing criteria is met all repositories of the LVGL project apply a process called DCO (Developer's Certificate of Origin).
|
||||||
|
|
||||||
|
The text of DCO can be read here: https://developercertificate.org/
|
||||||
|
For a more detailed description see the [Documentation](https://docs.lvgl.io/latest/en/html/contributing/index.html#developer-certification-of-origin-dco) site.
|
||||||
|
|
||||||
|
By contributing to any repositories of the LVGL project you state that your contribution corresponds with the DCO.
|
||||||
|
|
||||||
|
No further action is required if your contribution fulfills the DCO. If you are not sure about it feel free to ask us in a comment.
|
||||||
4
.github/workflows/ccpp.yml
vendored
4
.github/workflows/ccpp.yml
vendored
@@ -2,9 +2,9 @@ name: C/C++ CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [ master, dev ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [master ]
|
branches: [master, dev ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
17
.github/workflows/merge-to-dev.yml
vendored
Normal file
17
.github/workflows/merge-to-dev.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
name: Merge master branch to dev
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
jobs:
|
||||||
|
merge-branch:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
- name: Merge to dev branch
|
||||||
|
uses: devmasx/merge-branch@v1.1.0
|
||||||
|
with:
|
||||||
|
type: now
|
||||||
|
target_branch: 'dev'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
109
CHANGELOG.md
109
CHANGELOG.md
@@ -1,10 +1,113 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## v7.0.1 (under development)
|
## v7.4.0 (planned on 01.09.2020)
|
||||||
|
*Available in the `dev` branch*
|
||||||
|
|
||||||
|
## v7.3.1 (planned on 18.08.2020)
|
||||||
*Available in the `master` branch*
|
*Available in the `master` branch*
|
||||||
|
|
||||||
|
## v7.3.0 (04.08.2020)
|
||||||
|
|
||||||
|
### New features
|
||||||
|
- Add `lv_task_get_next`
|
||||||
|
- Add `lv_event_send_refresh`, `lv_event_send_refresh_recursive` to easily send `LV_EVENT_REFRESH` to object
|
||||||
|
- Add `lv_tabview_set_tab_name()` function - used to change a tab's name
|
||||||
|
- Add `LV_THEME_MATERIAL_FLAG_NO_TRANSITION` and `LV_THEME_MATERIAL_FLAG_NO_FOCUS` flags
|
||||||
|
- Reduce code size by adding: `LV_USE_FONT_COMPRESSED`, `LV_FONT_USE_SUBPX`, `LV_USE_OUTLINE`, `LV_USE_PATTERN`, `LV_USE_VALUE_STR` and applying some optimization
|
||||||
|
- Add `LV_MEMCPY_MEMSET_STD` to use standard `memcpy` and `memset`
|
||||||
|
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
- Do not print warning for missing glyph if its height OR width is zero.
|
||||||
|
- Prevent duplicated sending of `LV_EVENT_INSERT` from text area
|
||||||
|
- Tidy outer edges of cpicker widget.
|
||||||
|
- Remove duplicated lines from `lv_tabview_add_tab`
|
||||||
|
- btnmatrix: hadle combined states of buttons (e.g. chacked + disabled)
|
||||||
|
- textarea: fix typo in lv_textarea_set_sscrollbar_mode
|
||||||
|
- gauge: fix image needle drawing
|
||||||
|
- fix using freed memory in _lv_style_list_remove_style
|
||||||
|
|
||||||
|
|
||||||
|
## v7.2.0 (21.07.2020)
|
||||||
|
|
||||||
|
### New features
|
||||||
|
- Add screen transitions with `lv_scr_load_anim()`
|
||||||
|
- Add display background color, wallpaper and opacity. Shown when the screen is transparent. Can be used with `lv_disp_set_bg_opa/color/image()`.
|
||||||
|
- Add `LV_CALENDAR_WEEK_STARTS_MONDAY`
|
||||||
|
- Add `lv_chart_set_x_start_point()` function - Set the index of the x-axis start point in the data array
|
||||||
|
- Add `lv_chart_set_ext_array()` function - Set an external array of data points to use for the chart
|
||||||
|
- Add `lv_chart_set_point_id()` function - Set an individual point value in the chart series directly based on index
|
||||||
|
- Add `lv_chart_get_x_start_point()` function - Get the current index of the x-axis start point in the data array
|
||||||
|
- Add `lv_chart_get_point_id()` function - Get an individual point value in the chart series directly based on index
|
||||||
|
- Add `ext_buf_assigned` bit field to `lv_chart_series_t` structure - it's true if external buffer is assigned to series
|
||||||
|
- Add `lv_chart_set_series_axis()` to assign series to primary or secondary axis
|
||||||
|
- Add `lv_chart_set_y_range()` to allow setting range of secondary y axis (based on `lv_chart_set_range` but extended with an axis parameter)
|
||||||
|
- Allow setting different font for the selected text in `lv_roller`
|
||||||
|
- Add `theme->apply_cb` to replace `theme->apply_xcb` to make it compatible with the MicroPython binding
|
||||||
|
- Add `lv_theme_set_base()` to allow easy extension of built-in (or any) themes
|
||||||
|
- Add `lv_obj_align_x()` and `lv_obj_align_y()` functions
|
||||||
|
- Add `lv_obj_align_origo_x()` and `lv_obj_align_origo_y()` functions
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
- `tileview` fix navigation when not screen sized
|
||||||
|
- Use 14px font by default to for better compatibility with smaller displays
|
||||||
|
- `linemeter` fix conversation of current value to "level"
|
||||||
|
- Fix drawing on right border
|
||||||
|
- Set the cursor image non clickable by default
|
||||||
|
- Improve mono theme when used with keyboard or encoder
|
||||||
|
|
||||||
|
## v7.1.0 (07.07.2020)
|
||||||
|
|
||||||
|
### New features
|
||||||
|
- Add `focus_parent` attribute to `lv_obj`
|
||||||
|
- Allow using buttons in encoder input device
|
||||||
|
- Add lv_btnmatrix_set/get_align capability
|
||||||
|
- DMA2D: Remove dependency on ST CubeMX HAL
|
||||||
|
- Added `max_used` propriety to `lv_mem_monitor_t` struct
|
||||||
|
- In `lv_init` test if the the strings are UTF-8 encoded.
|
||||||
|
- Add `user_data` to themes
|
||||||
|
- Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems.
|
||||||
|
- Add inline function lv_checkbox_get_state(const lv_obj_t * cb) to extend the checkbox functionality.
|
||||||
|
- Add inline function lv_checkbox_set_state(const lv_obj_t * cb, lv_btn_state_t state ) to extend the checkbox functionality.
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
- `lv_img` fix invalidation area when angle or zoom changes
|
||||||
|
- Update the style handling to support Big endian MCUs
|
||||||
|
- Change some methods to support big endian hardware.
|
||||||
|
- remove use of c++ keyword 'new' in parameter of function lv_theme_set_base().
|
||||||
|
- Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems.
|
||||||
|
- Fix inserting chars in text area in big endian hardware.
|
||||||
|
|
||||||
|
## v7.0.2 (16.06.2020)
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
- `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
|
||||||
|
- `img`: improve hit test for transformed images
|
||||||
|
|
||||||
|
## v7.0.1 (01.06.2020)
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
- Make the Microptyhon working by adding the required variables as GC_ROOT
|
- 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 built-in SimSun CJK font
|
||||||
- Fix UTF-8 encoding when `LV_USE_ARABIC_PERSIAN_CHARS` is enabled
|
- Fix UTF-8 encoding when `LV_USE_ARABIC_PERSIAN_CHARS` is enabled
|
||||||
- Fix DMA2D usage when 32 bit images directly blended
|
- Fix DMA2D usage when 32 bit images directly blended
|
||||||
@@ -14,8 +117,8 @@
|
|||||||
- Improve DMA2D blending
|
- Improve DMA2D blending
|
||||||
- Remove memcpy from `lv_ll` (caused issues with some optimization settings)
|
- Remove memcpy from `lv_ll` (caused issues with some optimization settings)
|
||||||
- `lv_chart` fix X tick drawing
|
- `lv_chart` fix X tick drawing
|
||||||
- fix vertical dashed line drawing
|
- Fix vertical dashed line drawing
|
||||||
- some additonal minor fixes and formattings
|
- Some additonal minor fixes and formattings
|
||||||
|
|
||||||
## v7.0.0 (18.05.2020)
|
## v7.0.0 (18.05.2020)
|
||||||
|
|
||||||
|
|||||||
315
README.md
315
README.md
@@ -1,8 +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>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://lvgl.io/assets/images/img_1.png">
|
<img src="https://lvgl.io/assets/images/img_1.png">
|
||||||
@@ -14,219 +10,115 @@ LVGL provides everything you need to create embedded GUI with easy-to-use graphi
|
|||||||
|
|
||||||
<h4 align="center">
|
<h4 align="center">
|
||||||
<a href="https://lvgl.io">Website </a> ·
|
<a href="https://lvgl.io">Website </a> ·
|
||||||
<a href="https://lvgl.io/demos">Live demo</a> ·
|
<a href="https://lvgl.io/demos">Online demo</a> ·
|
||||||
<a href="https://docs.lvgl.io/">Docs</a> ·
|
<a href="https://docs.lvgl.io/">Docs</a> ·
|
||||||
<a href="https://forum.lvgl.io">Forum</a> ·
|
<a href="https://forum.lvgl.io">Forum</a>
|
||||||
<a href="https://blog.lvgl.io/">Blog</a>
|
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
- [Features](#features)
|
|
||||||
- [Supported devices](#supported-devices)
|
|
||||||
- [Quick start in a simulator](#quick-start-in-a-simulator)
|
|
||||||
- [Add LVGL to your project](#add-lvgl-to-your-project)
|
|
||||||
- [Learn the basics](#learn-the-basics)
|
|
||||||
- [Examples](#examples)
|
|
||||||
- [Contributing](#contributing)
|
|
||||||
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* **Powerful building blocks** buttons, charts, lists, sliders, images, etc.
|
* Powerful [building blocks](https://docs.lvgl.io/latest/en/html/widgets/index.html): buttons, charts, lists, sliders, images, etc.
|
||||||
* **Advanced graphics** with animations, anti-aliasing, opacity, smooth scrolling
|
* Advanced graphics: animations, anti-aliasing, opacity, smooth scrolling
|
||||||
* **Simultaneously use various input devices** touchscreen, mouse, keyboard, encoder, buttons, etc.
|
* Use [various input devices](https://docs.lvgl.io/latest/en/html/overview/indev.html): touchscreen, mouse, keyboard, encoder, buttons, etc.
|
||||||
* **Simultaneously use multiple displays** i.e. monochrome and color display
|
* Use [multiple displays](https://docs.lvgl.io/latest/en/html/overview/display.html): e.g. monochrome and color display
|
||||||
* **Multi-language support** with UTF-8 encoding, Bidirectional support, and Arabic text handling
|
* Hardware independent to use with any microcontroller or display
|
||||||
* **Fully customizable** graphical elements
|
* Scalable to operate with little memory (64 kB Flash, 10 kB RAM)
|
||||||
* **Hardware independent** to use with any microcontroller or display
|
* Multi-language support with UTF-8 handling, Bidirectional and Arabic script support
|
||||||
* **Scalable** to operate with little memory (64 kB Flash, 10 kB RAM)
|
* Fully customizable graphical elements via [CSS-like styles](https://docs.lvgl.io/latest/en/html/overview/style.html)
|
||||||
* **OS, External memory and GPU** supported but not required
|
* OS, External memory and GPU are supported but not required
|
||||||
* **Single frame buffer** operation even with advances graphical effects
|
* Smooth rendering even with a [single frame buffer](https://docs.lvgl.io/latest/en/html/porting/display.html)
|
||||||
* **Written in C** for maximal compatibility (C++ compatible)
|
* Written in C for maximal compatibility (C++ compatible)
|
||||||
* **Micropython Binding** exposes [LVGL API in Micropython](https://blog.lvgl.io/2019-02-20/micropython-bindings)
|
* Micropython Binding exposes [LVGL API in Micropython](https://blog.lvgl.io/2019-02-20/micropython-bindings)
|
||||||
* **Simulator** to develop on PC without embedded hardware
|
* [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html) to develop on PC without embedded hardware
|
||||||
* **Tutorials, examples, themes** for rapid development
|
* [Examples](lv_examples) and tutorials for rapid development
|
||||||
* **Documentation** and API references
|
* [Documentation](http://docs.lvgl.io/) and API references
|
||||||
|
|
||||||
## Supported devices
|
## Requirements
|
||||||
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
|
<table>
|
||||||
- Flash/ROM: > 64 kB for the very essential components (> 180 kB is recommended)
|
<tr>
|
||||||
- RAM:
|
<td> <strong>Name</strong> </td>
|
||||||
- Static RAM usage: ~2 kB depending on the used features and objects types
|
<td><strong>Minimal</strong></td>
|
||||||
- Stack: > 2kB (> 8 kB is recommended)
|
<td><strong>Recommended</strong></td>
|
||||||
- Dynamic data (heap): > 2 KB (> 16 kB is recommended if using several objects).
|
</tr>
|
||||||
Set by `LV_MEM_SIZE` in *lv_conf.h*.
|
<tr>
|
||||||
- Display buffer: > *"Horizontal resolution"* pixels (> 10 × *"Horizontal resolution"* is recommended)
|
<td><strong>Architecture</strong></td>
|
||||||
- C99 or newer compiler
|
<td colspan="2">16, 32 or 64 bit microcontroller or processor</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> <strong>Clock</strong></td>
|
||||||
|
<td> > 16 MHz </td>
|
||||||
|
<td> > 48 MHz</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td> <strong>Flash/ROM</strong></td>
|
||||||
|
<td> > 64 kB </td>
|
||||||
|
<td> > 180 kB</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td> <strong>Static RAM</strong></td>
|
||||||
|
<td> > 2 kB </td>
|
||||||
|
<td> > 4 kB</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td> <strong>Stack</strong></td>
|
||||||
|
<td> > 2 kB </td>
|
||||||
|
<td> > 8 kB</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td> <strong>Heap</strong></td>
|
||||||
|
<td> > 2 kB </td>
|
||||||
|
<td> > 8 kB</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td> <strong>Display buffer</strong></td>
|
||||||
|
<td> > 1 × <em>hor. res.</em> pixels </td>
|
||||||
|
<td> > 10 × <em>hor. res.</em> pixels </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td> <strong>Compiler</strong></td>
|
||||||
|
<td colspan="2"> C99 or newer </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
*Note that the memory usage might vary depending on the architecture, compiler and build options.*
|
*Note that the memory usage might vary depending on the architecture, compiler and build options.*
|
||||||
|
|
||||||
Just to mention some **platforms**:
|
Just to mention some platforms:
|
||||||
- STM32F1, STM32F3, [STM32F4](https://blog.lvgl.io/2017-07-15/stm32f429_disco_port), [STM32F7](https://github.com/lvgl/lv_port_stm32f746_disco_sw4stm32)
|
- STM32F1, STM32F3, STM32F4, STM32F7, STM32L4, STM32L5, STM32H7
|
||||||
- Microchip dsPIC33, PIC24, PIC32MX, PIC32MZ
|
- Microchip dsPIC33, PIC24, PIC32MX, PIC32MZ
|
||||||
- NXP Kinetis, LPC, iMX
|
- NXP: Kinetis, LPC, iMX, iMX RT
|
||||||
- [Linux frame buffer](https://blog.lvgl.io/2018-01-03/linux_fb) (/dev/fb)
|
- [Linux frame buffer](https://blog.lvgl.io/2018-01-03/linux_fb) (/dev/fb)
|
||||||
- [Raspberry PI](http://www.vk3erw.com/index.php/16-software/63-raspberry-pi-official-7-touchscreen-and-littlevgl)
|
- [Raspberry Pi](http://www.vk3erw.com/index.php/16-software/63-raspberry-pi-official-7-touchscreen-and-littlevgl)
|
||||||
- [Espressif ESP32](https://github.com/lvgl/lv_port_esp32)
|
- [Espressif ESP32](https://github.com/lvgl/lv_port_esp32)
|
||||||
- Nordic nrf52
|
- [Infineon Aurix](https://github.com/lvgl/lv_port_aurix)
|
||||||
- Quectell M66
|
- Nordic NRF52 Bluetooth modules
|
||||||
|
- Quectel modems
|
||||||
## Quick start in a simulator
|
|
||||||
The easiest way to get started with LVGL is to run it in a simulator on your PC without any embedded hardware.
|
|
||||||
|
|
||||||
Choose a project with your favourite IDE:
|
|
||||||
|
|
||||||
| Eclipse | CodeBlocks | Visual Studio | PlatformIO | Qt Creator |
|
|
||||||
|-------------|-------------|---------------|-----------|------------|
|
|
||||||
| [](https://github.com/lvgl/lv_sim_eclipse_sdl) | [](https://github.com/lvgl/lv_sim_codeblocks_win) | [](https://github.com/lvgl/lv_sim_visual_studio_sdl) | [](https://github.com/lvgl/lv_platformio) | [](https://blog.lvgl.io/2019-01-03/qt-creator) |
|
|
||||||
| Cross-platform<br>with SDL<br>(Recommended on<br>Linux and Mac) | Native Windows | Windows<br>with SDL | Cross-platform<br>with SDL | Cross-platform<br>with SDL |
|
|
||||||
|
|
||||||
|
|
||||||
## Add LVGL to your project
|
|
||||||
|
|
||||||
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
|
|
||||||
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.
|
|
||||||
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.
|
|
||||||
6. Call `lv_init()`
|
|
||||||
7. Create a display buffer for LVGL
|
|
||||||
```c
|
|
||||||
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:
|
|
||||||
```c
|
|
||||||
lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
|
|
||||||
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
|
|
||||||
disp_drv.flush_cb = my_disp_flush; /*Set your driver function*/
|
|
||||||
disp_drv.buffer = &disp_buf; /*Assign the buffer to the display*/
|
|
||||||
lv_disp_drv_register(&disp_drv); /*Finally register the driver*/
|
|
||||||
|
|
||||||
void my_disp_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_p)
|
|
||||||
{
|
|
||||||
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.*/
|
|
||||||
color_p++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lv_disp_flush_ready(disp); /* Indicate you are ready with the flushing*/
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
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*/
|
|
||||||
indev_drv.read_cb = my_touchpad_read; /*Set your driver function*/
|
|
||||||
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;
|
|
||||||
|
|
||||||
return false; /*Return `false` because we are not buffering and no more data to read*/
|
|
||||||
}
|
|
||||||
```
|
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
## 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.
|
|
||||||
|
|
||||||
### 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.
|
|
||||||
|
|
||||||
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.
|
|
||||||
The first parameter is the desired *parent*, the second parameters can be an object to copy (`NULL` if unused).
|
|
||||||
For example:
|
|
||||||
```c
|
|
||||||
lv_obj_t * slider1 = lv_slider_create(lv_scr_act(), NULL);
|
|
||||||
```
|
|
||||||
|
|
||||||
To set some basic attribute `lv_obj_set_<paramters_name>(obj, <value>)` function can be used. For example:
|
|
||||||
```c
|
|
||||||
lv_obj_set_x(btn1, 30);
|
|
||||||
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:
|
|
||||||
```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`).
|
|
||||||
|
|
||||||
### 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:
|
|
||||||
```c
|
|
||||||
static lv_style_t style1; /*Should be static, global or dynamically allocated*/
|
|
||||||
lv_style_init(&style1);
|
|
||||||
lv_style_set_bg_color(&style1, LV_STATE_DEFAULT, LV_COLOR_RED); /*Default background color*/
|
|
||||||
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.
|
|
||||||
|
|
||||||
To add the style to a button:
|
|
||||||
```
|
|
||||||
lv_obj_add_style(btn1, LV_BTN_PART_MAIN, &style1);
|
|
||||||
```
|
|
||||||
|
|
||||||
To remove all styles from an object use:
|
|
||||||
```c
|
|
||||||
lv_obj_reset_style_list(obj, LV_OBJ_PART_MAIN);
|
|
||||||
```
|
|
||||||
|
|
||||||
Learn more in [Style overview](https://docs.lvgl.io/v7/en/html/overview/style) section.
|
|
||||||
|
|
||||||
### Events
|
|
||||||
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*/
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
void btn_event_cb(lv_obj_t * btn, lv_event_t event)
|
|
||||||
{
|
|
||||||
if(event == LV_EVENT_CLICKED) {
|
|
||||||
printf("Clicked\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Learn more about the events in the [Event overview](https://docs.lvgl.io/v7/en/html/overview/event) section.
|
|
||||||
|
|
||||||
|
## Get started
|
||||||
|
This list shows the recommended way of learning the library:
|
||||||
|
1. Check the [Online demos](https://lvgl.io/demos) to see LVGL in action (3 minutes)
|
||||||
|
2. Read the [Introduction](https://docs.lvgl.io/latest/en/html/intro/index.html) page of the documentation (5 minutes)
|
||||||
|
3. Get familiar with the basics on the [Quick overview](https://docs.lvgl.io/latest/en/html/get-started/quick-overview.html) page (15 minutes)
|
||||||
|
4. Set up a [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html) (10 minutes)
|
||||||
|
5. Try out some [Examples](https://github.com/lvgl/lv_examples/)
|
||||||
|
6. Port LVGL to a board. See the [Porting](https://docs.lvgl.io/latest/en/html/porting/index.html) guide or check the ready to use [Projects](https://github.com/lvgl?q=lv_port_&type=&language=)
|
||||||
|
7. Read the [Overview](https://docs.lvgl.io/latest/en/html/overview/index.html) page to get a better understanding of the library (2-3 hours)
|
||||||
|
8. Check the documentation of the [Widgets](https://docs.lvgl.io/latest/en/html/widgets/index.html) to see their features and usage
|
||||||
|
9. If you have questions go to the [Forum](http://forum.lvgl.io/)
|
||||||
|
10. Read the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) guide to see how you can help to improve LVGL (15 minutes)
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
For more examples see the [lv_examples](https://github.com/lvgl/lv_examples) repository.
|
||||||
|
|
||||||
### Button with label
|
### Button with label
|
||||||
```c
|
```c
|
||||||
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button the current screen*/
|
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button the current screen*/
|
||||||
@@ -246,10 +138,10 @@ void btn_event_cb(lv_obj_t * btn, lv_event_t event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||

|

|
||||||
|
|
||||||
### Use LVGL from Micropython
|
### LVGL from Micropython
|
||||||
Learn more about [Micropython](https://docs.lvgl.io/en/html/get-started/micropython).
|
Learn more about [Micropython](https://docs.lvgl.io/latest/en/html/get-started/micropython.html).
|
||||||
```python
|
```python
|
||||||
# Create a Button and a Label
|
# Create a Button and a Label
|
||||||
scr = lv.obj()
|
scr = lv.obj()
|
||||||
@@ -263,17 +155,6 @@ lv.scr_load(scr)
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
To ask questions please use the [Forum](https://forum.lvgl.io).
|
LVGL is an open project and contribution is very welcome. There are many ways to contribute from simply speaking about your project, through writing examples, improving the documentation, fixing bugs to hosing your own project under in LVGL.
|
||||||
For development-related things (bug reports, feature suggestions) use [GitHub's Issue tracker](https://github.com/lvgl/lvgl/issues).
|
|
||||||
|
|
||||||
If you are interested in contributing to LVGL you can
|
For a detailed description of contribution opportunities visit the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) section of the documentation.
|
||||||
- **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
|
|
||||||
- **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 in the developement**. 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.
|
|
||||||
|
|
||||||
Before sending Pull requests, please read the following guides:
|
|
||||||
- [Contributing guide](https://github.com/lvgl/lvgl/blob/master/docs/CONTRIBUTING.md)
|
|
||||||
- [Coding style guide](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md)
|
|
||||||
|
|||||||
@@ -1,117 +1,5 @@
|
|||||||
# Contributing to LVGL
|
# Contributing to LVGL
|
||||||
|
|
||||||
**Do you have some free time to spend with programming?
|
Thank you for considering contributing to LVGL.
|
||||||
Are you working on an embedded GUI project with LVGL?
|
|
||||||
See how can you help to improve the graphics library and help others!**
|
|
||||||
|
|
||||||
|
For a detailed description of contribution opportunities, please visit the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) section of the documentation.
|
||||||
- [Overview](#overview)
|
|
||||||
- [How to send a pull request?](#how-to-send-a-pull-request)
|
|
||||||
- [Help others in the Forum](help-others-in-the-forum)
|
|
||||||
- [Improve or translate the documentation](#improve-or-translate-the-documentation)
|
|
||||||
- [Write a blog post](#write-a-blog-post)
|
|
||||||
- [Report or fix bugs](#report-or-fix-bugs)
|
|
||||||
- [Suggest or implement new features](#suggest-or-implement-new-features)
|
|
||||||
- [Summary](#summary)
|
|
||||||
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
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
|
|
||||||
- **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.
|
|
||||||
|
|
||||||
We have some simple rules:
|
|
||||||
- Be kind and friendly.
|
|
||||||
- Speak about one thing in one issue/topic.
|
|
||||||
- Give feedback and close the issue or mark the topic as solved if your question is answered.
|
|
||||||
- Tell what you experience or expect. _"The button is not working"_ is not enough info to get help.
|
|
||||||
- Use [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) to format your post.
|
|
||||||
- We use the [Forum](https://forum.lvgl.io/) to ask and answer questions and [GitHub's issue tracker](https://github.com/lvgl/lvgl/issues) for development-related discussion.
|
|
||||||
- If possible send an absolute minimal code example in order to reproduce the issue
|
|
||||||
|
|
||||||
|
|
||||||
## How to send a pull request?
|
|
||||||
|
|
||||||
Merging new code into LVGL, documentation, blog, and examples happens via *Pull requests*. If you are still not familiar with Pull Requests (PR for short) here is a short guide. It's about the `lvgl` repository but it works the same way for other repositories too.
|
|
||||||
1. **Fork** the [lvgl repository](https://github.com/lvgl/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 changes
|
|
||||||
3. **Create a PR** on GitHub from the page of your `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 feature branch.
|
|
||||||
5. **Describe** what is in the update. An example code is welcome if applicable.
|
|
||||||
6. **Update** your `lvgl` branch with new commits. They will appear in the PR too.
|
|
||||||
|
|
||||||
Some advice:
|
|
||||||
- For non-trivial fixes and features it's better open an issue first to discuss the details.
|
|
||||||
- Maybe your fix or update won't be perfect at first. Don't be afraid, just improve it and push the new commits. The PR will be updated accordingly.
|
|
||||||
- If your update needs some extra work it's okay to say: _"I'm busy now and I will improve it soon"_ or _"Sorry, I don't have time to improve it, I hope it helps in this form too"_.
|
|
||||||
So it's better to say don't have time to continue than saying nothing.
|
|
||||||
- Please read and follow this [guide about the coding style](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md)
|
|
||||||
|
|
||||||
## Help others in the Forum
|
|
||||||
|
|
||||||
It's a great way to contribute to the library if you already use it.
|
|
||||||
Just go to [https://forum.lvgl.io/](https://forum.lvgl.io/) a register (Google and GitHub login also works).
|
|
||||||
Log in, read the titles and if you are already familiar with a topic, don't be shy, and write your suggestion.
|
|
||||||
|
|
||||||
## Improve or translate the documentation
|
|
||||||
|
|
||||||
If you would like to contribute to LVGL the documentation is the best place to start.
|
|
||||||
|
|
||||||
### Fix typos, add missing parts
|
|
||||||
|
|
||||||
If you find a typo, an obscure sentence or something which is not explained well enough in the [English documentation](https://docs.lvgl.io/en/html/index.html)
|
|
||||||
click the *"Edit on GitHub"* button in the top right corner and fix the issue by sending a Pull Request.
|
|
||||||
|
|
||||||
### Translate the documentation
|
|
||||||
|
|
||||||
If you have time and interest you can translate the documentation to your native language or any language you speak well.
|
|
||||||
You can join others to work on an already existing language or you can start a new one.
|
|
||||||
|
|
||||||
To translate the documentation we use [Zanata](https://zanata.org) which is an online translation platform.
|
|
||||||
You will find the LVGL project here: [LVGL on Zanata](https://translate.zanata.org/iteration/view/littlevgl-docs/v6.0-doc1?dswid=3430)
|
|
||||||
|
|
||||||
To get started you need to:
|
|
||||||
- register at [Zanata](https://zanata.org) which is an online translation platform.
|
|
||||||
- comment to [this post](https://forum.lvgl.io/t/translate-the-documentation/238?u=kisvegabor)
|
|
||||||
- tell your username at *Zanata* and your selected language(s) to get permission the edit the translations
|
|
||||||
|
|
||||||
Note that a translation will be added to the documentation only if the following parts are translated:
|
|
||||||
- [Home page](https://docs.lvgl.io/en/v7/)
|
|
||||||
- [Porting section](https://docs.lvgl.io/en/v7/html/porting/index.html)
|
|
||||||
- [Quick overview](https://docs.lvgl.io/v7/en/html/get-started/quick-overview.html)
|
|
||||||
|
|
||||||
## Write a blog post
|
|
||||||
|
|
||||||
Have you ported LVGL to a new platform or created a fancy GUI? Do you know a great trick?
|
|
||||||
You can share your knowledge on LVGL's blog! It's super easy to add your own post:
|
|
||||||
- Fork and clone the [blog repository](https://github.com/lvgl/blog)
|
|
||||||
- Add your post in Markdown to the `_posts` folder.
|
|
||||||
- Store the images and other resources in a dedicated folder in `assets`
|
|
||||||
- Create a Pull Request
|
|
||||||
|
|
||||||
The blog uses [Jekyll](https://jekyllrb.com/) to convert the `.md` files to a webpage. You can easily [run Jekyll offline](https://jekyllrb.com/docs/) to check your post before creating the Pull request
|
|
||||||
|
|
||||||
## Report or fix bugs
|
|
||||||
For simple bugfixes (typos, missing error handling, fixing a warning) it's fine to send a Pull request directly. However, for more complex bugs it's better to open an issue first. In the issue, you should describe how to reproduce the bug and add the minimal code snippet.
|
|
||||||
|
|
||||||
## Suggest or implement new features
|
|
||||||
If you have a good idea don't hesitate to share with us. It's even better if you have time to deal with its implementation. Don't be afraid if you still don't know LVGL well enough. We will help you to get started.
|
|
||||||
|
|
||||||
To share your ideas use [Feature request](https://forum.lvgl.io/c/feature-request/9) category of the forum.
|
|
||||||
|
|
||||||
If you are ready to get involved into the development of this faetures feel free to pen a [new issue](https://github.com/lvgl/lvgl/issues) for it on GitHub.
|
|
||||||
|
|
||||||
During the implementation don't forget the [Code style guide](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md).
|
|
||||||
|
|
||||||
If you implemented a new feature it's important to record it in the documentation and if applicable create an example for it:
|
|
||||||
- Go to the [docs](https://github.com/lvgl/docs/tree/master/v7/en) repository and update the relevant part of the English documentation.
|
|
||||||
- Go to the [examples](https://github.com/lvgl/lv_examples) repository and add a new file about the new feature in the related directory.
|
|
||||||
|
|
||||||
## Summary
|
|
||||||
|
|
||||||
I hope you have taken a liking to contribute to LVGL. A helpful and friendly community is waiting for you! :)
|
|
||||||
|
|||||||
34
docs/ROADMAP.md
Normal file
34
docs/ROADMAP.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# Roadmap
|
||||||
|
|
||||||
|
This is a summary for thenew fatures of the major releases and a collection of ideas.
|
||||||
|
|
||||||
|
This list indicates only the current intention and can be changed.
|
||||||
|
|
||||||
|
## v8
|
||||||
|
Planned to September/October 2020
|
||||||
|
- New scrolling:
|
||||||
|
- See [feat/new-scroll](https://github.com/lvgl/lvgl/tree/feat/new-scroll) branch and [#1614](https://github.com/lvgl/lvgl/issues/1614)) issue.
|
||||||
|
- Remove `lv_page` and support scrolling on `lv_obj`
|
||||||
|
- Support "elastic" scrolling when scrolled in
|
||||||
|
- Support scroll chaining among any objects types (not only `lv_pages`s)
|
||||||
|
- Remove `lv_drag`. Similar effect can be achieved by setting the position in `LV_EVENT_PRESSING`
|
||||||
|
- Add snapping?
|
||||||
|
- Already working
|
||||||
|
- New layouts:
|
||||||
|
- See [#1615](https://github.com/lvgl/lvgl/issues/1615) issue
|
||||||
|
- [CSS Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)-like layout support
|
||||||
|
- Besides setting width/height in `px` add support to `partent percentage` and `screen percentage`.
|
||||||
|
- Work in progress
|
||||||
|
- Simplified File system interface ([feat/new_fs_api](https://github.com/lvgl/lvgl/tree/feat/new-fs-api) branch) to make porting easier
|
||||||
|
- Work in progress
|
||||||
|
- Add new label alignment modes
|
||||||
|
- See [#1656](https://github.com/lvgl/lvgl/issues/1656)
|
||||||
|
|
||||||
|
## Ideas
|
||||||
|
- Unit testing (gtest?). See [#1658](https://github.com/lvgl/lvgl/issues/1658)
|
||||||
|
- Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660)
|
||||||
|
- CPP binding. See [Forum](https://forum.lvgl.io/t/is-it-possible-to-officially-support-optional-cpp-api/2736)
|
||||||
|
- Optmize font decompression
|
||||||
|
- Switch to RGBA colors in styles
|
||||||
|
- Need coverage report for tests
|
||||||
|
- Need static analize (via coverity.io or somehing else).
|
||||||
119
examples/arduino/ESP32_TFT_eSPI/ESP32_TFT_eSPI.ino
Normal file
119
examples/arduino/ESP32_TFT_eSPI/ESP32_TFT_eSPI.ino
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
#include <lvgl.h>
|
||||||
|
#include <TFT_eSPI.h>
|
||||||
|
|
||||||
|
TFT_eSPI tft = TFT_eSPI(); /* TFT instance */
|
||||||
|
static lv_disp_buf_t disp_buf;
|
||||||
|
static lv_color_t buf[LV_HOR_RES_MAX * 10];
|
||||||
|
|
||||||
|
#if USE_LV_LOG != 0
|
||||||
|
/* Serial debugging */
|
||||||
|
void my_print(lv_log_level_t level, const char * file, uint32_t line, const char * dsc)
|
||||||
|
{
|
||||||
|
|
||||||
|
Serial.printf("%s@%d->%s\r\n", file, line, dsc);
|
||||||
|
Serial.flush();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Display flushing */
|
||||||
|
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
|
||||||
|
{
|
||||||
|
uint32_t w = (area->x2 - area->x1 + 1);
|
||||||
|
uint32_t h = (area->y2 - area->y1 + 1);
|
||||||
|
|
||||||
|
tft.startWrite();
|
||||||
|
tft.setAddrWindow(area->x1, area->y1, w, h);
|
||||||
|
tft.pushColors(&color_p->full, w * h, true);
|
||||||
|
tft.endWrite();
|
||||||
|
|
||||||
|
lv_disp_flush_ready(disp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Read the touchpad*/
|
||||||
|
bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
|
||||||
|
{
|
||||||
|
uint16_t touchX, touchY;
|
||||||
|
|
||||||
|
bool touched = tft.getTouch(&touchX, &touchY, 600);
|
||||||
|
|
||||||
|
if(!touched)
|
||||||
|
{
|
||||||
|
data->state = LV_INDEV_STATE_REL;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data->state = LV_INDEV_STATE_PR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(touchX>screenWidth || touchY > screenHeight)
|
||||||
|
{
|
||||||
|
Serial.println("Y or y outside of expected parameters..");
|
||||||
|
Serial.print("y:");
|
||||||
|
Serial.print(touchX);
|
||||||
|
Serial.print(" x:");
|
||||||
|
Serial.print(touchY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*Set the coordinates*/
|
||||||
|
data->point.x = touchX;
|
||||||
|
data->point.y = touchY;
|
||||||
|
|
||||||
|
Serial.print("Data x");
|
||||||
|
Serial.println(touchX);
|
||||||
|
|
||||||
|
Serial.print("Data y");
|
||||||
|
Serial.println(touchY);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return false; /*Return `false` because we are not buffering and no more data to read*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Serial.begin(115200); /* prepare for possible serial debug */
|
||||||
|
|
||||||
|
lv_init();
|
||||||
|
|
||||||
|
#if USE_LV_LOG != 0
|
||||||
|
lv_log_register_print_cb(my_print); /* register print function for debugging */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
tft.begin(); /* TFT init */
|
||||||
|
tft.setRotation(1); /* Landscape orientation */
|
||||||
|
|
||||||
|
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
|
||||||
|
tft.setTouch(calData);
|
||||||
|
|
||||||
|
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10);
|
||||||
|
|
||||||
|
/*Initialize the display*/
|
||||||
|
lv_disp_drv_t disp_drv;
|
||||||
|
lv_disp_drv_init(&disp_drv);
|
||||||
|
disp_drv.hor_res = 320;
|
||||||
|
disp_drv.ver_res = 240;
|
||||||
|
disp_drv.flush_cb = my_disp_flush;
|
||||||
|
disp_drv.buffer = &disp_buf;
|
||||||
|
lv_disp_drv_register(&disp_drv);
|
||||||
|
|
||||||
|
/*Initialize the (dummy) input device driver*/
|
||||||
|
lv_indev_drv_t indev_drv;
|
||||||
|
lv_indev_drv_init(&indev_drv);
|
||||||
|
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||||
|
indev_drv.read_cb = my_touchpad_read;
|
||||||
|
lv_indev_drv_register(&indev_drv);
|
||||||
|
|
||||||
|
/* Try an example from the lv_examples repository
|
||||||
|
* https://github.com/lvgl/lv_examples*/
|
||||||
|
lv_ex_btn_1();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
|
||||||
|
lv_task_handler(); /* let the GUI do its work */
|
||||||
|
delay(5);
|
||||||
|
}
|
||||||
44
examples/arduino/ESP32_TFT_eSPI/README.md
Normal file
44
examples/arduino/ESP32_TFT_eSPI/README.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# Example for lv_arduino using a slider
|
||||||
|
|
||||||
|
This example has the screen set to 320x480 (ILI9488), change this by altering the following lines in the main ino file:
|
||||||
|
|
||||||
|
```C
|
||||||
|
int screenWidth = 480;
|
||||||
|
int screenHeight = 320;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Backlight
|
||||||
|
|
||||||
|
Change pin 32 to your preferred backlight pin using a PNP transistor (2N3906) or remove the following code and connect directly to +ve:
|
||||||
|
|
||||||
|
```C
|
||||||
|
ledcSetup(10, 5000/*freq*/, 10 /*resolution*/);
|
||||||
|
ledcAttachPin(32, 10);
|
||||||
|
analogReadResolution(10);
|
||||||
|
ledcWrite(10,768);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Theme selection
|
||||||
|
|
||||||
|
Change the following to change the theme:
|
||||||
|
|
||||||
|
```C
|
||||||
|
lv_theme_t * th = lv_theme_night_init(210, NULL); //Set a HUE value and a Font for the Night Theme
|
||||||
|
lv_theme_set_current(th);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Calibration
|
||||||
|
|
||||||
|
This is using the bodmer tft_espi driver for touch. To correctly set the calibration load the calibration sketch and replace the following with your values:
|
||||||
|
|
||||||
|
```C
|
||||||
|
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
|
||||||
|
```
|
||||||
|
|
||||||
|
## Screen rotation
|
||||||
|
|
||||||
|
Check the following if you need to alter your screen rotation:
|
||||||
|
|
||||||
|
```C
|
||||||
|
tft.setRotation(3);
|
||||||
|
```
|
||||||
37
examples/arduino/README.md
Normal file
37
examples/arduino/README.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# LVGL Arduino examples
|
||||||
|
|
||||||
|
LVGL can be installed via Arduino IDE Library Manager or as an .ZIP library.
|
||||||
|
It will install [lv_exmaples](https://github.com/lvgl/lv_examples) which contains a lot of examples and demos to try LVGL.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
There are simple examples which use the [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI) library as a TFT driver to simplify testing.
|
||||||
|
To get all this to work you have to setup TFT_eSPI to work with your TFT display type via editing the `User_Setup.h` file in TFT_eSPI library folder, or by selecting your own configurtion in the `User_Setup_Select.h` file in TFT_eSPI library folder.
|
||||||
|
|
||||||
|
LVGL library has its own configuration file called `lv_conf.h`. When LVGL is installed to followings needs to be done to configure it:
|
||||||
|
1. Go to directory of the installed Arduno libraries
|
||||||
|
2. Go to `lvgl` and copy `lv_conf_template.h` as `lvgl.h` next to the `lvgl` folder.
|
||||||
|
3. Open `lv_conf.h` and change the first `#if 0` to `#if 1`
|
||||||
|
4. Set the resolution of your display in `LV_HOR_RES_MAX` and `LV_VER_RES_MAX`
|
||||||
|
5. Set the color depth of you display in `LV_COLOR_DEPTH`
|
||||||
|
6. Set `LV_TICK_CUSTOM 1`
|
||||||
|
|
||||||
|
## Debugging
|
||||||
|
|
||||||
|
In case of trouble there are debug informations inside LVGL. In the `ESP32_TFT_eSPI` example there is `my_print` method, which allow to send this debug informations to the serial interface. To enable this feature you have to edit `lv_conf.h` file and enable logging in section `log settings`:
|
||||||
|
|
||||||
|
```c
|
||||||
|
/*Log settings*/
|
||||||
|
#define USE_LV_LOG 1 /*Enable/disable the log module*/
|
||||||
|
#if LV_USE_LOG
|
||||||
|
/* How important log should be added:
|
||||||
|
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
|
||||||
|
* LV_LOG_LEVEL_INFO Log important events
|
||||||
|
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
|
||||||
|
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
|
||||||
|
* LV_LOG_LEVEL_NONE Do not log anything
|
||||||
|
*/
|
||||||
|
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
|
||||||
|
```
|
||||||
|
|
||||||
|
After enabling log module and setting LV_LOG_LEVEL accordingly the output log is sent to the `Serial` port @ 115200 Bd.
|
||||||
27
library.json
27
library.json
@@ -1,14 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "lvgl",
|
"name": "lvgl",
|
||||||
"version": "v7.0.1",
|
"version": "7.3.0",
|
||||||
"keywords": "graphics, gui, embedded, littlevgl",
|
"keywords": "graphics, gui, embedded, tft, lvgl",
|
||||||
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
|
"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":
|
"repository": {
|
||||||
{
|
"type": "git",
|
||||||
"type": "git",
|
"url": "https://github.com/lvgl/lvgl.git"
|
||||||
"url": "https://github.com/lvgl/lvgl.git"
|
},
|
||||||
},
|
"build": {
|
||||||
"build": {
|
"includeDir": "."
|
||||||
"includeDir": "."
|
},
|
||||||
}
|
"license": "MIT",
|
||||||
|
"homepage": "https://lvgl.io",
|
||||||
|
"frameworks": "*",
|
||||||
|
"platforms": "*"
|
||||||
}
|
}
|
||||||
|
|||||||
10
library.properties
Normal file
10
library.properties
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
name=lvgl
|
||||||
|
version=7.3.0
|
||||||
|
author=kisvegabor
|
||||||
|
maintainer=kisvegabor,embeddedt,pete-pjb
|
||||||
|
sentence=Full-featured Graphics Library for Embedded Systems
|
||||||
|
paragraph=Powerful and easy-to-use embedded GUI with many widgets, advanced visual effects (opacity, antialiasing, animations) and low memory requirements (16K RAM, 64K Flash).
|
||||||
|
category=Display
|
||||||
|
url=https://lvgl.io
|
||||||
|
architectures=*
|
||||||
|
includes=lvgl.h
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @file lv_conf.h
|
* @file lv_conf.h
|
||||||
*
|
* Configuration file for LVGL v7.3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -97,6 +97,10 @@ typedef int16_t lv_coord_t;
|
|||||||
# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
|
# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
|
||||||
#endif /*LV_MEM_CUSTOM*/
|
#endif /*LV_MEM_CUSTOM*/
|
||||||
|
|
||||||
|
/* Use the standard memcpy and memset instead of LVGL's own functions.
|
||||||
|
* The standard functions might or might not be faster depending on their implementation. */
|
||||||
|
#define LV_MEMCPY_MEMSET_STD 0
|
||||||
|
|
||||||
/* Garbage Collector settings
|
/* Garbage Collector settings
|
||||||
* Used if lvgl is binded to higher level language and the memory is managed by that language */
|
* Used if lvgl is binded to higher level language and the memory is managed by that language */
|
||||||
#define LV_ENABLE_GC 0
|
#define LV_ENABLE_GC 0
|
||||||
@@ -150,7 +154,7 @@ typedef void * lv_anim_user_data_t;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* 1: Enable shadow drawing*/
|
/* 1: Enable shadow drawing on rectangles*/
|
||||||
#define LV_USE_SHADOW 1
|
#define LV_USE_SHADOW 1
|
||||||
#if LV_USE_SHADOW
|
#if LV_USE_SHADOW
|
||||||
/* Allow buffering some shadow calculation
|
/* Allow buffering some shadow calculation
|
||||||
@@ -160,6 +164,15 @@ typedef void * lv_anim_user_data_t;
|
|||||||
#define LV_SHADOW_CACHE_SIZE 0
|
#define LV_SHADOW_CACHE_SIZE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*1: enable outline drawing on rectangles*/
|
||||||
|
#define LV_USE_OUTLINE 1
|
||||||
|
|
||||||
|
/*1: enable pattern drawing on rectangles*/
|
||||||
|
#define LV_USE_PATTERN 1
|
||||||
|
|
||||||
|
/*1: enable value string drawing on rectangles*/
|
||||||
|
#define LV_USE_VALUE_STR 1
|
||||||
|
|
||||||
/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
|
/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
|
||||||
#define LV_USE_BLEND_MODES 1
|
#define LV_USE_BLEND_MODES 1
|
||||||
|
|
||||||
@@ -178,6 +191,9 @@ typedef void * lv_group_user_data_t;
|
|||||||
/* 1: Enable GPU interface*/
|
/* 1: Enable GPU interface*/
|
||||||
#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */
|
#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */
|
||||||
#define LV_USE_GPU_STM32_DMA2D 0
|
#define LV_USE_GPU_STM32_DMA2D 0
|
||||||
|
/*If enabling LV_USE_GPU_STM32_DMA2D, LV_GPU_DMA2D_CMSIS_INCLUDE must be defined to include path of CMSIS header of target processor
|
||||||
|
e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||||
|
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||||
|
|
||||||
/* 1: Enable file system (might be required for images */
|
/* 1: Enable file system (might be required for images */
|
||||||
#define LV_USE_FILESYSTEM 1
|
#define LV_USE_FILESYSTEM 1
|
||||||
@@ -194,6 +210,7 @@ typedef void * lv_fs_drv_user_data_t;
|
|||||||
|
|
||||||
/*1: Use the functions and types from the older API if possible */
|
/*1: Use the functions and types from the older API if possible */
|
||||||
#define LV_USE_API_EXTENSION_V6 1
|
#define LV_USE_API_EXTENSION_V6 1
|
||||||
|
#define LV_USE_API_EXTENSION_V7 1
|
||||||
|
|
||||||
/*========================
|
/*========================
|
||||||
* Image decoder and cache
|
* Image decoder and cache
|
||||||
@@ -219,6 +236,10 @@ typedef void * lv_img_decoder_user_data_t;
|
|||||||
/*=====================
|
/*=====================
|
||||||
* Compiler settings
|
* Compiler settings
|
||||||
*====================*/
|
*====================*/
|
||||||
|
|
||||||
|
/* For big endian systems set to 1 */
|
||||||
|
#define LV_BIG_ENDIAN_SYSTEM 0
|
||||||
|
|
||||||
/* Define a custom attribute to `lv_tick_inc` function */
|
/* Define a custom attribute to `lv_tick_inc` function */
|
||||||
#define LV_ATTRIBUTE_TICK_INC
|
#define LV_ATTRIBUTE_TICK_INC
|
||||||
|
|
||||||
@@ -249,6 +270,10 @@ typedef void * lv_img_decoder_user_data_t;
|
|||||||
*/
|
*/
|
||||||
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
|
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
|
||||||
|
|
||||||
|
/* Prefix variables that are used in GPU accelerated operations, often these need to be
|
||||||
|
* placed in RAM sections that are DMA accessible */
|
||||||
|
#define LV_ATTRIBUTE_DMA
|
||||||
|
|
||||||
/*===================
|
/*===================
|
||||||
* HAL settings
|
* HAL settings
|
||||||
*==================*/
|
*==================*/
|
||||||
@@ -257,8 +282,8 @@ typedef void * lv_img_decoder_user_data_t;
|
|||||||
* It removes the need to manually update the tick with `lv_tick_inc`) */
|
* It removes the need to manually update the tick with `lv_tick_inc`) */
|
||||||
#define LV_TICK_CUSTOM 0
|
#define LV_TICK_CUSTOM 0
|
||||||
#if LV_TICK_CUSTOM == 1
|
#if LV_TICK_CUSTOM == 1
|
||||||
#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/
|
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
|
||||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
|
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
|
||||||
#endif /*LV_TICK_CUSTOM*/
|
#endif /*LV_TICK_CUSTOM*/
|
||||||
|
|
||||||
typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
|
typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
|
||||||
@@ -330,15 +355,15 @@ 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 built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
|
||||||
* The symbols are available via `LV_SYMBOL_...` defines
|
* 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
|
* To create a new font go to: https://lvgl.com/ttf-font-to-c-array
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Montserrat fonts with bpp = 4
|
/* Montserrat fonts with bpp = 4
|
||||||
* https://fonts.google.com/specimen/Montserrat */
|
* https://fonts.google.com/specimen/Montserrat */
|
||||||
#define LV_FONT_MONTSERRAT_12 0
|
#define LV_FONT_MONTSERRAT_12 0
|
||||||
#define LV_FONT_MONTSERRAT_14 0
|
#define LV_FONT_MONTSERRAT_14 1
|
||||||
#define LV_FONT_MONTSERRAT_16 1
|
#define LV_FONT_MONTSERRAT_16 0
|
||||||
#define LV_FONT_MONTSERRAT_18 0
|
#define LV_FONT_MONTSERRAT_18 0
|
||||||
#define LV_FONT_MONTSERRAT_20 0
|
#define LV_FONT_MONTSERRAT_20 0
|
||||||
#define LV_FONT_MONTSERRAT_22 0
|
#define LV_FONT_MONTSERRAT_22 0
|
||||||
@@ -379,11 +404,20 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
|
|||||||
* but with > 10,000 characters if you see issues probably you need to enable it.*/
|
* but with > 10,000 characters if you see issues probably you need to enable it.*/
|
||||||
#define LV_FONT_FMT_TXT_LARGE 0
|
#define LV_FONT_FMT_TXT_LARGE 0
|
||||||
|
|
||||||
|
/* Enables/disables support for compressed fonts. If it's disabled, compressed
|
||||||
|
* glyphs cannot be processed by the library and won't be rendered.
|
||||||
|
*/
|
||||||
|
#define LV_USE_FONT_COMPRESSED 1
|
||||||
|
|
||||||
|
/* Enable subpixel rendering */
|
||||||
|
#define LV_USE_FONT_SUBPX 1
|
||||||
|
#if LV_USE_FONT_SUBPX
|
||||||
/* Set the pixel order of the display.
|
/* Set the pixel order of the display.
|
||||||
* Important only if "subpx fonts" are used.
|
* Important only if "subpx fonts" are used.
|
||||||
* With "normal" font it doesn't matter.
|
* With "normal" font it doesn't matter.
|
||||||
*/
|
*/
|
||||||
#define LV_FONT_SUBPX_BGR 0
|
#define LV_FONT_SUBPX_BGR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
|
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
|
||||||
typedef void * lv_font_user_data_t;
|
typedef void * lv_font_user_data_t;
|
||||||
@@ -405,7 +439,10 @@ typedef void * lv_font_user_data_t;
|
|||||||
/* A fast and impressive theme.
|
/* A fast and impressive theme.
|
||||||
* Flags:
|
* Flags:
|
||||||
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme
|
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme
|
||||||
* LV_THEME_MATERIAL_FLAG_DARK: dark theme*/
|
* LV_THEME_MATERIAL_FLAG_DARK: dark theme
|
||||||
|
* LV_THEME_MATERIAL_FLAG_NO_TRANSITION: disable transitions (state change animations)
|
||||||
|
* LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state)
|
||||||
|
* */
|
||||||
#define LV_USE_THEME_MATERIAL 1
|
#define LV_USE_THEME_MATERIAL 1
|
||||||
|
|
||||||
/* Mono-color theme for monochrome displays.
|
/* Mono-color theme for monochrome displays.
|
||||||
@@ -417,13 +454,13 @@ typedef void * lv_font_user_data_t;
|
|||||||
|
|
||||||
#define LV_THEME_DEFAULT_INCLUDE <stdint.h> /*Include a header for the init. function*/
|
#define LV_THEME_DEFAULT_INCLUDE <stdint.h> /*Include a header for the init. function*/
|
||||||
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
|
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
|
||||||
#define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED
|
#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1)
|
||||||
#define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE
|
#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6)
|
||||||
#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT
|
#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT
|
||||||
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_16
|
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_14
|
||||||
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_16
|
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_14
|
||||||
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_16
|
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_14
|
||||||
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_16
|
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_14
|
||||||
|
|
||||||
/*=================
|
/*=================
|
||||||
* Text settings
|
* Text settings
|
||||||
@@ -498,7 +535,7 @@ typedef void * lv_obj_user_data_t;
|
|||||||
#endif
|
#endif
|
||||||
#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
|
#define LV_USE_OBJ_REALIGN 1
|
||||||
|
|
||||||
/* Enable to make the object clickable on a larger area.
|
/* Enable to make the object clickable on a larger area.
|
||||||
@@ -529,6 +566,9 @@ typedef void * lv_obj_user_data_t;
|
|||||||
|
|
||||||
/*Calendar (dependencies: -)*/
|
/*Calendar (dependencies: -)*/
|
||||||
#define LV_USE_CALENDAR 1
|
#define LV_USE_CALENDAR 1
|
||||||
|
#if LV_USE_CALENDAR
|
||||||
|
# define LV_CALENDAR_WEEK_STARTS_MONDAY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/*Canvas (dependencies: lv_img)*/
|
/*Canvas (dependencies: lv_img)*/
|
||||||
#define LV_USE_CANVAS 1
|
#define LV_USE_CANVAS 1
|
||||||
|
|||||||
6
lvgl.h
6
lvgl.h
@@ -2,7 +2,7 @@
|
|||||||
* @file lvgl.h
|
* @file lvgl.h
|
||||||
* Include all LittleV GL related headers
|
* Include all LittleV GL related headers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LVGL_H
|
#ifndef LVGL_H
|
||||||
#define LVGL_H
|
#define LVGL_H
|
||||||
|
|
||||||
@@ -77,9 +77,9 @@ extern "C" {
|
|||||||
*********************/
|
*********************/
|
||||||
/*Current version of LVGL*/
|
/*Current version of LVGL*/
|
||||||
#define LVGL_VERSION_MAJOR 7
|
#define LVGL_VERSION_MAJOR 7
|
||||||
#define LVGL_VERSION_MINOR 0
|
#define LVGL_VERSION_MINOR 3
|
||||||
#define LVGL_VERSION_PATCH 1
|
#define LVGL_VERSION_PATCH 1
|
||||||
#define LVGL_VERSION_INFO "dev"
|
#define LVGL_VERSION_INFO "dev"
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
#!/usr/bin/env python3.6
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not defined values
|
Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not defined values
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
import sys
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
if sys.version_info < (3,6,0):
|
||||||
|
print("Python >=3.6 is required", file=sys.stderr)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
fin = open("../lv_conf_template.h", "r")
|
fin = open("../lv_conf_template.h", "r")
|
||||||
fout = open("../src/lv_conf_internal.h", "w")
|
fout = open("../src/lv_conf_internal.h", "w")
|
||||||
|
|
||||||
|
|||||||
255
scripts/release.py
Executable file
255
scripts/release.py
Executable file
@@ -0,0 +1,255 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
lastNum = re.compile(r'(?:[^\d]*(\d+)[^\d]*)+')
|
||||||
|
|
||||||
|
|
||||||
|
def title(t):
|
||||||
|
print("\n---------------------------------")
|
||||||
|
print(t)
|
||||||
|
print("---------------------------------")
|
||||||
|
|
||||||
|
|
||||||
|
def cmd(c):
|
||||||
|
print("\n" + c)
|
||||||
|
r = os.system(c)
|
||||||
|
if r:
|
||||||
|
print("### Error: " + str(r))
|
||||||
|
|
||||||
|
def lvgl_clone():
|
||||||
|
title("lvgl: Clone")
|
||||||
|
cmd("git clone https://github.com/lvgl/lvgl.git")
|
||||||
|
os.chdir("./lvgl")
|
||||||
|
cmd("git co master")
|
||||||
|
|
||||||
|
def lvgl_format():
|
||||||
|
title("lvgl: Run code formatter")
|
||||||
|
os.chdir("./scripts")
|
||||||
|
cmd("./code-format.sh")
|
||||||
|
os.system("git ci -am 'Run code formatter'")
|
||||||
|
os.chdir("..")
|
||||||
|
|
||||||
|
def lvgl_update_version():
|
||||||
|
title("lvgl: Update version number")
|
||||||
|
|
||||||
|
f = open("./lvgl.h", "r")
|
||||||
|
|
||||||
|
outbuf = ""
|
||||||
|
major_ver = -1
|
||||||
|
minor_ver = -1
|
||||||
|
patch_ver = -1
|
||||||
|
|
||||||
|
for i in f.read().splitlines():
|
||||||
|
r = re.search(r'^#define LVGL_VERSION_MAJOR ', i)
|
||||||
|
if r:
|
||||||
|
m = lastNum.search(i)
|
||||||
|
if m: major_ver = m.group(1)
|
||||||
|
|
||||||
|
r = re.search(r'^#define LVGL_VERSION_MINOR ', i)
|
||||||
|
if r:
|
||||||
|
m = lastNum.search(i)
|
||||||
|
if m: minor_ver = m.group(1)
|
||||||
|
|
||||||
|
r = re.search(r'^#define LVGL_VERSION_PATCH ', i)
|
||||||
|
if r:
|
||||||
|
m = lastNum.search(i)
|
||||||
|
if m: patch_ver = m.group(1)
|
||||||
|
|
||||||
|
|
||||||
|
r = re.search(r'^#define LVGL_VERSION_INFO ', i)
|
||||||
|
if r:
|
||||||
|
i = "#define LVGL_VERSION_INFO \"\""
|
||||||
|
|
||||||
|
outbuf += i + '\n'
|
||||||
|
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
f = open("./lvgl.h", "w")
|
||||||
|
|
||||||
|
f.write(outbuf)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
s = "v" + str(major_ver) + "." + str(minor_ver) + "." + str(patch_ver)
|
||||||
|
print("New version:" + s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def lvgl_update_library_json(v):
|
||||||
|
title("lvgl: Update version number in library.json")
|
||||||
|
|
||||||
|
f = open("./library.json", "r")
|
||||||
|
vn = v[1:]
|
||||||
|
outbuf = ""
|
||||||
|
|
||||||
|
for i in f.read().splitlines():
|
||||||
|
r = re.search(r'"version": ', i)
|
||||||
|
if r:
|
||||||
|
i = ' "version": "' + vn + '",'
|
||||||
|
|
||||||
|
outbuf += i + '\n'
|
||||||
|
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
f = open("./library.json", "w")
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
||||||
|
os.system('git ci -am "Release ' + 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')
|
||||||
|
os.chdir("../")
|
||||||
|
|
||||||
|
|
||||||
|
def lvgl_update_api_docs():
|
||||||
|
title("lvgl: Update API with Doxygen")
|
||||||
|
|
||||||
|
cmd("cd scripts; doxygen");
|
||||||
|
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
||||||
|
os.system('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")
|
||||||
|
|
||||||
|
os.system('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")
|
||||||
|
cmd("git clone --recursive https://github.com/lvgl/docs.git")
|
||||||
|
os.chdir("./docs")
|
||||||
|
|
||||||
|
def docs_get_api():
|
||||||
|
title("docs: Get API files")
|
||||||
|
|
||||||
|
cmd("git co latest --")
|
||||||
|
cmd("rm -rf xml");
|
||||||
|
cmd("cp -r ../lvgl/docs/api_doc/xml .");
|
||||||
|
cmd("git add xml");
|
||||||
|
cmd('git commit -m "update API"')
|
||||||
|
|
||||||
|
def docs_update_version(v):
|
||||||
|
title("docs: Update version number")
|
||||||
|
|
||||||
|
f = open("./conf.py", "r")
|
||||||
|
|
||||||
|
outbuf = ""
|
||||||
|
|
||||||
|
for i in f.read().splitlines():
|
||||||
|
r = re.search(r'^version = ', i)
|
||||||
|
if r:
|
||||||
|
i = "version = '" + v + "'"
|
||||||
|
|
||||||
|
r = re.search(r'^release = ', i)
|
||||||
|
if r:
|
||||||
|
i = "version = '" + v + "'"
|
||||||
|
|
||||||
|
outbuf += i + '\n'
|
||||||
|
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
f = open("./conf.py", "w")
|
||||||
|
|
||||||
|
f.write(outbuf)
|
||||||
|
f.close()
|
||||||
|
cmd("git add conf.py")
|
||||||
|
cmd('git ci -m "update conf.py to ' + v + '"')
|
||||||
|
|
||||||
|
|
||||||
|
def docs_merge_to_release_branch(v):
|
||||||
|
title("docs: merge to release branch")
|
||||||
|
cmd('git co release/v7 --')
|
||||||
|
cmd('git clean -fd .')
|
||||||
|
cmd('rm -f LVGL.pdf') #To avoide possible merge conflict
|
||||||
|
cmd('git merge latest')
|
||||||
|
cmd('git push origin release/v7')
|
||||||
|
|
||||||
|
def docs_build():
|
||||||
|
title("docs: Build")
|
||||||
|
cmd("git checkout master")
|
||||||
|
cmd("./update.py latest release/v7")
|
||||||
|
|
||||||
|
def clean_up():
|
||||||
|
title("Clean up repos")
|
||||||
|
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_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()
|
||||||
|
docs_update_version(ver_str)
|
||||||
|
docs_merge_to_release_branch(ver_str)
|
||||||
|
docs_build()
|
||||||
|
|
||||||
|
clean_up()
|
||||||
@@ -1,189 +0,0 @@
|
|||||||
import re
|
|
||||||
import os
|
|
||||||
lastNum = re.compile(r'(?:[^\d]*(\d+)[^\d]*)+')
|
|
||||||
|
|
||||||
|
|
||||||
def title(t):
|
|
||||||
print("\n---------------------------------")
|
|
||||||
print(t)
|
|
||||||
print("---------------------------------")
|
|
||||||
|
|
||||||
|
|
||||||
def cmd(c):
|
|
||||||
print("\n" + c)
|
|
||||||
os.system(c)
|
|
||||||
|
|
||||||
|
|
||||||
def increment(s):
|
|
||||||
""" look for the last sequence of number(s) in a string and increment """
|
|
||||||
m = lastNum.search(s)
|
|
||||||
if m:
|
|
||||||
next = str(int(m.group(1))+1)
|
|
||||||
start, end = m.span(1)
|
|
||||||
s = s[:max(end-len(next), start)] + next + s[end:]
|
|
||||||
return s, str(next)
|
|
||||||
|
|
||||||
|
|
||||||
def lvgl_clone():
|
|
||||||
title("lvgl: Clone")
|
|
||||||
cmd("git clone https://github.com/lvgl/lvgl.git")
|
|
||||||
os.chdir("./lvgl")
|
|
||||||
cmd("git co master")
|
|
||||||
|
|
||||||
def lvgl_update_version():
|
|
||||||
title("lvgl: Update version number")
|
|
||||||
|
|
||||||
f = open("./src/lv_version.h", "r")
|
|
||||||
|
|
||||||
outbuf = ""
|
|
||||||
major_ver = -1
|
|
||||||
minor_ver = -1
|
|
||||||
patch_ver = -1
|
|
||||||
|
|
||||||
for i in f.read().splitlines():
|
|
||||||
r = re.search(r'^#define LVGL_VERSION_MAJOR ', i)
|
|
||||||
if r:
|
|
||||||
m = lastNum.search(i)
|
|
||||||
if m: major_ver = m.group(1)
|
|
||||||
|
|
||||||
r = re.search(r'^#define LVGL_VERSION_MINOR ', i)
|
|
||||||
if r:
|
|
||||||
m = lastNum.search(i)
|
|
||||||
if m: minor_ver = m.group(1)
|
|
||||||
|
|
||||||
r = re.search(r'^#define LVGL_VERSION_PATCH ', i)
|
|
||||||
if r:
|
|
||||||
m = lastNum.search(i)
|
|
||||||
if m: patch_ver = m.group(1)
|
|
||||||
|
|
||||||
|
|
||||||
r = re.search(r'^#define LVGL_VERSION_INFO ', i)
|
|
||||||
if r:
|
|
||||||
i = "#define LVGL_VERSION_INFO \"\""
|
|
||||||
|
|
||||||
outbuf += i + '\n'
|
|
||||||
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
f = open("./src/lv_version.h", "w")
|
|
||||||
|
|
||||||
f.write(outbuf)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
s = "v" + str(major_ver) + "." + str(minor_ver) + "." + str(patch_ver)
|
|
||||||
print("New version:" + s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def lvgl_update_library_json(v):
|
|
||||||
title("lvgl: Update version number in library.json")
|
|
||||||
|
|
||||||
f = open("./library.json", "r")
|
|
||||||
|
|
||||||
outbuf = ""
|
|
||||||
|
|
||||||
for i in f.read().splitlines():
|
|
||||||
r = re.search(r'"version": ', i)
|
|
||||||
if r:
|
|
||||||
i = ' "version": "' + v + '",'
|
|
||||||
|
|
||||||
outbuf += i + '\n'
|
|
||||||
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
f = open("./library.json", "w")
|
|
||||||
|
|
||||||
f.write(outbuf)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
def lvgl_commit_push(v):
|
|
||||||
title("lvgl: 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 lvgl_update_api_docs():
|
|
||||||
title("lvgl: Update API with Doxygen")
|
|
||||||
|
|
||||||
cmd("cd scripts; doxygen");
|
|
||||||
|
|
||||||
|
|
||||||
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")
|
|
||||||
|
|
||||||
def docs_get_api():
|
|
||||||
title("docs: Get API files")
|
|
||||||
|
|
||||||
cmd("rm -rf xml");
|
|
||||||
cmd("cp -r ../lvgl/docs/api_doc/xml .");
|
|
||||||
|
|
||||||
|
|
||||||
def docs_update_version(v):
|
|
||||||
title("docs: Update version number")
|
|
||||||
|
|
||||||
f = open("./conf.py", "r")
|
|
||||||
|
|
||||||
outbuf = ""
|
|
||||||
|
|
||||||
for i in f.read().splitlines():
|
|
||||||
r = re.search(r'^version = ', i)
|
|
||||||
if r:
|
|
||||||
i = "version = '" + v + "'"
|
|
||||||
|
|
||||||
r = re.search(r'^release = ', i)
|
|
||||||
if r:
|
|
||||||
i = "version = '" + v + "'"
|
|
||||||
|
|
||||||
outbuf += i + '\n'
|
|
||||||
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
f = open("./conf.py", "w")
|
|
||||||
|
|
||||||
f.write(outbuf)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
def docs_update_trans():
|
|
||||||
title("docs: Update translations")
|
|
||||||
cmd("cd en && ./trans_push.py && ./trans_pull.py")
|
|
||||||
|
|
||||||
def docs_build():
|
|
||||||
title("docs: Build")
|
|
||||||
cmd("./build.py clean")
|
|
||||||
|
|
||||||
|
|
||||||
def docs_commit_push(v):
|
|
||||||
title("docs: Commit release")
|
|
||||||
|
|
||||||
cmd('git add .')
|
|
||||||
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 clean_up():
|
|
||||||
title("Clean up repos")
|
|
||||||
os.chdir("..")
|
|
||||||
cmd("rm -rf lvgl docs")
|
|
||||||
|
|
||||||
lvgl_clone()
|
|
||||||
lvgl_update_api_docs()
|
|
||||||
ver_str = lvgl_update_version()
|
|
||||||
lvgl_update_library_json(ver_str)
|
|
||||||
lvgl_commit_push(ver_str)
|
|
||||||
|
|
||||||
docs_clone()
|
|
||||||
docs_get_api()
|
|
||||||
docs_update_version(ver_str)
|
|
||||||
#docs_update_trans() # Zanata is not working now
|
|
||||||
docs_build()
|
|
||||||
docs_commit_push(ver_str)
|
|
||||||
|
|
||||||
clean_up()
|
|
||||||
@@ -153,7 +153,7 @@ static inline void lv_roller_set_fix_width(lv_obj_t * roller, lv_coord_t w)
|
|||||||
#define lv_scrlbar_mode_t lv_scrollbar_mode_t
|
#define lv_scrlbar_mode_t lv_scrollbar_mode_t
|
||||||
|
|
||||||
#define LV_SCRLBAR_MODE_OFF LV_SCROLLBAR_MODE_OFF
|
#define LV_SCRLBAR_MODE_OFF LV_SCROLLBAR_MODE_OFF
|
||||||
#define LV_SCRLBAR_MODE_ON LV_SCRILLBAR_MODE_ON
|
#define LV_SCRLBAR_MODE_ON LV_SCROLLBAR_MODE_ON
|
||||||
#define LV_SCRLBAR_MODE_DRAG LV_SCROLLBAR_MODE_DRAG
|
#define LV_SCRLBAR_MODE_DRAG LV_SCROLLBAR_MODE_DRAG
|
||||||
#define LV_SCRLBAR_MODE_AUTO LV_SCROLLBAR_MODE_AUTO
|
#define LV_SCRLBAR_MODE_AUTO LV_SCROLLBAR_MODE_AUTO
|
||||||
#define LV_SCRLBAR_MODE_HIDE LV_SCROLLBAR_MODE_HIDE
|
#define LV_SCRLBAR_MODE_HIDE LV_SCROLLBAR_MODE_HIDE
|
||||||
@@ -172,12 +172,37 @@ 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)
|
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
|
||||||
|
|
||||||
|
|
||||||
|
#endif /*LV_USE_API_EXTENSION_V6*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------
|
||||||
|
* V7.0 COMPATIBILITY
|
||||||
|
*--------------------*/
|
||||||
|
#if LV_USE_API_EXTENSION_V7
|
||||||
|
#if LV_USE_WIN
|
||||||
|
|
||||||
|
static inline lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * img_src)
|
||||||
|
{
|
||||||
|
return lv_win_add_btn_right(win, img_src);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_CHART
|
||||||
|
static inline void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coord_t ymax)
|
||||||
|
{
|
||||||
|
lv_chart_set_y_range(chart, LV_CHART_AXIS_PRIMARY_Y, ymin, ymax);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /*LV_USE_API_EXTENSION_V6*/
|
#endif /*LV_USE_API_EXTENSION_V6*/
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
|
|||||||
@@ -147,6 +147,12 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif /*LV_MEM_CUSTOM*/
|
#endif /*LV_MEM_CUSTOM*/
|
||||||
|
|
||||||
|
/* Use the standard memcpy and memset instead of LVGL's own functions.
|
||||||
|
* The standard functions might or might not be faster depending on their implementation. */
|
||||||
|
#ifndef LV_MEMCPY_MEMSET_STD
|
||||||
|
#define LV_MEMCPY_MEMSET_STD 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Garbage Collector settings
|
/* Garbage Collector settings
|
||||||
* Used if lvgl is binded to higher level language and the memory is managed by that language */
|
* Used if lvgl is binded to higher level language and the memory is managed by that language */
|
||||||
#ifndef LV_ENABLE_GC
|
#ifndef LV_ENABLE_GC
|
||||||
@@ -223,7 +229,7 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* 1: Enable shadow drawing*/
|
/* 1: Enable shadow drawing on rectangles*/
|
||||||
#ifndef LV_USE_SHADOW
|
#ifndef LV_USE_SHADOW
|
||||||
#define LV_USE_SHADOW 1
|
#define LV_USE_SHADOW 1
|
||||||
#endif
|
#endif
|
||||||
@@ -237,6 +243,21 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*1: enable outline drawing on rectangles*/
|
||||||
|
#ifndef LV_USE_OUTLINE
|
||||||
|
#define LV_USE_OUTLINE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*1: enable pattern drawing on rectangles*/
|
||||||
|
#ifndef LV_USE_PATTERN
|
||||||
|
#define LV_USE_PATTERN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*1: enable value string drawing on rectangles*/
|
||||||
|
#ifndef LV_USE_VALUE_STR
|
||||||
|
#define LV_USE_VALUE_STR 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
|
/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
|
||||||
#ifndef LV_USE_BLEND_MODES
|
#ifndef LV_USE_BLEND_MODES
|
||||||
#define LV_USE_BLEND_MODES 1
|
#define LV_USE_BLEND_MODES 1
|
||||||
@@ -266,6 +287,11 @@
|
|||||||
#ifndef LV_USE_GPU_STM32_DMA2D
|
#ifndef LV_USE_GPU_STM32_DMA2D
|
||||||
#define LV_USE_GPU_STM32_DMA2D 0
|
#define LV_USE_GPU_STM32_DMA2D 0
|
||||||
#endif
|
#endif
|
||||||
|
/*If enabling LV_USE_GPU_STM32_DMA2D, LV_GPU_DMA2D_CMSIS_INCLUDE must be defined to include path of CMSIS header of target processor
|
||||||
|
e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||||
|
#ifndef LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||||
|
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||||
|
#endif
|
||||||
|
|
||||||
/* 1: Enable file system (might be required for images */
|
/* 1: Enable file system (might be required for images */
|
||||||
#ifndef LV_USE_FILESYSTEM
|
#ifndef LV_USE_FILESYSTEM
|
||||||
@@ -289,6 +315,9 @@
|
|||||||
#ifndef LV_USE_API_EXTENSION_V6
|
#ifndef LV_USE_API_EXTENSION_V6
|
||||||
#define LV_USE_API_EXTENSION_V6 1
|
#define LV_USE_API_EXTENSION_V6 1
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef LV_USE_API_EXTENSION_V7
|
||||||
|
#define LV_USE_API_EXTENSION_V7 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/*========================
|
/*========================
|
||||||
* Image decoder and cache
|
* Image decoder and cache
|
||||||
@@ -319,6 +348,12 @@
|
|||||||
/*=====================
|
/*=====================
|
||||||
* Compiler settings
|
* Compiler settings
|
||||||
*====================*/
|
*====================*/
|
||||||
|
|
||||||
|
/* For big endian systems set to 1 */
|
||||||
|
#ifndef LV_BIG_ENDIAN_SYSTEM
|
||||||
|
#define LV_BIG_ENDIAN_SYSTEM 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define a custom attribute to `lv_tick_inc` function */
|
/* Define a custom attribute to `lv_tick_inc` function */
|
||||||
#ifndef LV_ATTRIBUTE_TICK_INC
|
#ifndef LV_ATTRIBUTE_TICK_INC
|
||||||
#define LV_ATTRIBUTE_TICK_INC
|
#define LV_ATTRIBUTE_TICK_INC
|
||||||
@@ -363,6 +398,12 @@
|
|||||||
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
|
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Prefix variables that are used in GPU accelerated operations, often these need to be
|
||||||
|
* placed in RAM sections that are DMA accessible */
|
||||||
|
#ifndef LV_ATTRIBUTE_DMA
|
||||||
|
#define LV_ATTRIBUTE_DMA
|
||||||
|
#endif
|
||||||
|
|
||||||
/*===================
|
/*===================
|
||||||
* HAL settings
|
* HAL settings
|
||||||
*==================*/
|
*==================*/
|
||||||
@@ -374,10 +415,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#if LV_TICK_CUSTOM == 1
|
#if LV_TICK_CUSTOM == 1
|
||||||
#ifndef LV_TICK_CUSTOM_INCLUDE
|
#ifndef LV_TICK_CUSTOM_INCLUDE
|
||||||
#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/
|
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR
|
#ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR
|
||||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
|
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
|
||||||
#endif
|
#endif
|
||||||
#endif /*LV_TICK_CUSTOM*/
|
#endif /*LV_TICK_CUSTOM*/
|
||||||
|
|
||||||
@@ -468,7 +509,7 @@
|
|||||||
|
|
||||||
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
|
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
|
||||||
* The symbols are available via `LV_SYMBOL_...` defines
|
* 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
|
* To create a new font go to: https://lvgl.com/ttf-font-to-c-array
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -478,10 +519,10 @@
|
|||||||
#define LV_FONT_MONTSERRAT_12 0
|
#define LV_FONT_MONTSERRAT_12 0
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_FONT_MONTSERRAT_14
|
#ifndef LV_FONT_MONTSERRAT_14
|
||||||
#define LV_FONT_MONTSERRAT_14 0
|
#define LV_FONT_MONTSERRAT_14 1
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_FONT_MONTSERRAT_16
|
#ifndef LV_FONT_MONTSERRAT_16
|
||||||
#define LV_FONT_MONTSERRAT_16 1
|
#define LV_FONT_MONTSERRAT_16 0
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_FONT_MONTSERRAT_18
|
#ifndef LV_FONT_MONTSERRAT_18
|
||||||
#define LV_FONT_MONTSERRAT_18 0
|
#define LV_FONT_MONTSERRAT_18 0
|
||||||
@@ -569,6 +610,18 @@
|
|||||||
#define LV_FONT_FMT_TXT_LARGE 0
|
#define LV_FONT_FMT_TXT_LARGE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Enables/disables support for compressed fonts. If it's disabled, compressed
|
||||||
|
* glyphs cannot be processed by the library and won't be rendered.
|
||||||
|
*/
|
||||||
|
#ifndef LV_USE_FONT_COMPRESSED
|
||||||
|
#define LV_USE_FONT_COMPRESSED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Enable subpixel rendering */
|
||||||
|
#ifndef LV_USE_FONT_SUBPX
|
||||||
|
#define LV_USE_FONT_SUBPX 1
|
||||||
|
#endif
|
||||||
|
#if LV_USE_FONT_SUBPX
|
||||||
/* Set the pixel order of the display.
|
/* Set the pixel order of the display.
|
||||||
* Important only if "subpx fonts" are used.
|
* Important only if "subpx fonts" are used.
|
||||||
* With "normal" font it doesn't matter.
|
* With "normal" font it doesn't matter.
|
||||||
@@ -576,6 +629,7 @@
|
|||||||
#ifndef LV_FONT_SUBPX_BGR
|
#ifndef LV_FONT_SUBPX_BGR
|
||||||
#define LV_FONT_SUBPX_BGR 0
|
#define LV_FONT_SUBPX_BGR 0
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
|
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
|
||||||
|
|
||||||
@@ -600,7 +654,10 @@
|
|||||||
/* A fast and impressive theme.
|
/* A fast and impressive theme.
|
||||||
* Flags:
|
* Flags:
|
||||||
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme
|
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme
|
||||||
* LV_THEME_MATERIAL_FLAG_DARK: dark theme*/
|
* LV_THEME_MATERIAL_FLAG_DARK: dark theme
|
||||||
|
* LV_THEME_MATERIAL_FLAG_NO_TRANSITION: disable transitions (state change animations)
|
||||||
|
* LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state)
|
||||||
|
* */
|
||||||
#ifndef LV_USE_THEME_MATERIAL
|
#ifndef LV_USE_THEME_MATERIAL
|
||||||
#define LV_USE_THEME_MATERIAL 1
|
#define LV_USE_THEME_MATERIAL 1
|
||||||
#endif
|
#endif
|
||||||
@@ -621,25 +678,25 @@
|
|||||||
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
|
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_THEME_DEFAULT_COLOR_PRIMARY
|
#ifndef LV_THEME_DEFAULT_COLOR_PRIMARY
|
||||||
#define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED
|
#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1)
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_THEME_DEFAULT_COLOR_SECONDARY
|
#ifndef LV_THEME_DEFAULT_COLOR_SECONDARY
|
||||||
#define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE
|
#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6)
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_THEME_DEFAULT_FLAG
|
#ifndef LV_THEME_DEFAULT_FLAG
|
||||||
#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT
|
#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_THEME_DEFAULT_FONT_SMALL
|
#ifndef LV_THEME_DEFAULT_FONT_SMALL
|
||||||
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_16
|
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_14
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_THEME_DEFAULT_FONT_NORMAL
|
#ifndef LV_THEME_DEFAULT_FONT_NORMAL
|
||||||
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_16
|
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_14
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_THEME_DEFAULT_FONT_SUBTITLE
|
#ifndef LV_THEME_DEFAULT_FONT_SUBTITLE
|
||||||
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_16
|
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_14
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_THEME_DEFAULT_FONT_TITLE
|
#ifndef LV_THEME_DEFAULT_FONT_TITLE
|
||||||
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_16
|
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_14
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*=================
|
/*=================
|
||||||
@@ -748,7 +805,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#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
|
#ifndef LV_USE_OBJ_REALIGN
|
||||||
#define LV_USE_OBJ_REALIGN 1
|
#define LV_USE_OBJ_REALIGN 1
|
||||||
#endif
|
#endif
|
||||||
@@ -793,6 +850,11 @@
|
|||||||
#ifndef LV_USE_CALENDAR
|
#ifndef LV_USE_CALENDAR
|
||||||
#define LV_USE_CALENDAR 1
|
#define LV_USE_CALENDAR 1
|
||||||
#endif
|
#endif
|
||||||
|
#if LV_USE_CALENDAR
|
||||||
|
#ifndef LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||||
|
# define LV_CALENDAR_WEEK_STARTS_MONDAY 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*Canvas (dependencies: lv_img)*/
|
/*Canvas (dependencies: lv_img)*/
|
||||||
#ifndef LV_USE_CANVAS
|
#ifndef LV_USE_CANVAS
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ CSRCS += lv_disp.c
|
|||||||
CSRCS += lv_obj.c
|
CSRCS += lv_obj.c
|
||||||
CSRCS += lv_refr.c
|
CSRCS += lv_refr.c
|
||||||
CSRCS += lv_style.c
|
CSRCS += lv_style.c
|
||||||
CSRCS += lv_debug.c
|
|
||||||
|
|
||||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core
|
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core
|
||||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core
|
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
*********************/
|
*********************/
|
||||||
#include "lv_disp.h"
|
#include "lv_disp.h"
|
||||||
#include "../lv_misc/lv_math.h"
|
#include "../lv_misc/lv_math.h"
|
||||||
|
#include "../lv_core/lv_refr.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
@@ -21,6 +22,12 @@
|
|||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
#if LV_USE_ANIMATION
|
||||||
|
static void scr_load_anim_start(lv_anim_t * a);
|
||||||
|
static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v);
|
||||||
|
static void scr_anim_ready(lv_anim_t * a);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
**********************/
|
**********************/
|
||||||
@@ -43,13 +50,30 @@ lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp)
|
|||||||
{
|
{
|
||||||
if(!disp) disp = lv_disp_get_default();
|
if(!disp) disp = lv_disp_get_default();
|
||||||
if(!disp) {
|
if(!disp) {
|
||||||
LV_LOG_WARN("lv_scr_act: no display registered to get its act. screen");
|
LV_LOG_WARN("no display registered to get its active screen");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return disp->act_scr;
|
return disp->act_scr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return with a pointer to the previous screen. Only used during screen transitions.
|
||||||
|
* @param disp pointer to display which previous screen should be get. (NULL to use the default
|
||||||
|
* screen)
|
||||||
|
* @return pointer to the previous screen object or NULL if not used now
|
||||||
|
*/
|
||||||
|
lv_obj_t * lv_disp_get_scr_prev(lv_disp_t * disp)
|
||||||
|
{
|
||||||
|
if(!disp) disp = lv_disp_get_default();
|
||||||
|
if(!disp) {
|
||||||
|
LV_LOG_WARN("no display registered to get its previous screen");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return disp->prev_scr;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a screen active
|
* Make a screen active
|
||||||
* @param scr pointer to a screen
|
* @param scr pointer to a screen
|
||||||
@@ -96,6 +120,7 @@ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp)
|
|||||||
return disp->sys_layer;
|
return disp->sys_layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign a screen to a display.
|
* Assign a screen to a display.
|
||||||
* @param disp pointer to a display where to assign the screen
|
* @param disp pointer to a display where to assign the screen
|
||||||
@@ -115,6 +140,176 @@ void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr)
|
|||||||
_lv_ll_chg_list(&old_disp->scr_ll, &disp->scr_ll, scr, true);
|
_lv_ll_chg_list(&old_disp->scr_ll, &disp->scr_ll, scr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the background color of a display
|
||||||
|
* @param disp pointer to a display
|
||||||
|
* @param color color of the background
|
||||||
|
*/
|
||||||
|
void lv_disp_set_bg_color(lv_disp_t * disp, lv_color_t color)
|
||||||
|
{
|
||||||
|
if(!disp) disp = lv_disp_get_default();
|
||||||
|
if(!disp) {
|
||||||
|
LV_LOG_WARN("no display registered");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
disp->bg_color = color;
|
||||||
|
|
||||||
|
lv_area_t a;
|
||||||
|
lv_area_set(&a, 0, 0, lv_disp_get_hor_res(disp) - 1, lv_disp_get_ver_res(disp) - 1);
|
||||||
|
_lv_inv_area(disp, &a);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the background image of a display
|
||||||
|
* @param disp pointer to a display
|
||||||
|
* @param img_src path to file or pointer to an `lv_img_dsc_t` variable
|
||||||
|
*/
|
||||||
|
void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src)
|
||||||
|
{
|
||||||
|
if(!disp) disp = lv_disp_get_default();
|
||||||
|
if(!disp) {
|
||||||
|
LV_LOG_WARN("no display registered");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
disp->bg_img = img_src;
|
||||||
|
|
||||||
|
lv_area_t a;
|
||||||
|
lv_area_set(&a, 0, 0, lv_disp_get_hor_res(disp) - 1, lv_disp_get_ver_res(disp) - 1);
|
||||||
|
_lv_inv_area(disp, &a);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opacity of the background
|
||||||
|
* @param disp pointer to a display
|
||||||
|
* @param opa opacity (0..255)
|
||||||
|
*/
|
||||||
|
void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa)
|
||||||
|
{
|
||||||
|
if(!disp) disp = lv_disp_get_default();
|
||||||
|
if(!disp) {
|
||||||
|
LV_LOG_WARN("no display registered");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
disp->bg_opa = opa;
|
||||||
|
|
||||||
|
lv_area_t a;
|
||||||
|
lv_area_set(&a, 0, 0, lv_disp_get_hor_res(disp) - 1, lv_disp_get_ver_res(disp) - 1);
|
||||||
|
_lv_inv_area(disp, &a);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if LV_USE_ANIMATION
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch screen with animation
|
||||||
|
* @param scr pointer to the new screen to load
|
||||||
|
* @param anim_type type of the animation from `lv_scr_load_anim_t`. E.g. `LV_SCR_LOAD_ANIM_MOVE_LEFT`
|
||||||
|
* @param time time of the animation
|
||||||
|
* @param delay delay before the transition
|
||||||
|
* @param auto_del true: automatically delete the old screen
|
||||||
|
*/
|
||||||
|
void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del)
|
||||||
|
{
|
||||||
|
lv_disp_t * d = lv_obj_get_disp(new_scr);
|
||||||
|
|
||||||
|
if(d->prev_scr && d->del_prev) {
|
||||||
|
lv_obj_del(d->prev_scr);
|
||||||
|
d->prev_scr = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
d->del_prev = auto_del;
|
||||||
|
|
||||||
|
/*Be sure there is no other animation on the screens*/
|
||||||
|
lv_anim_del(new_scr, NULL);
|
||||||
|
lv_anim_del(lv_scr_act(), NULL);
|
||||||
|
|
||||||
|
/*Be sure both screens are in a normal position*/
|
||||||
|
lv_obj_set_pos(new_scr, 0, 0);
|
||||||
|
lv_obj_set_pos(lv_scr_act(), 0, 0);
|
||||||
|
lv_style_remove_prop(lv_obj_get_local_style(new_scr, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||||
|
lv_style_remove_prop(lv_obj_get_local_style(lv_scr_act(), LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||||
|
|
||||||
|
lv_anim_t a_new;
|
||||||
|
lv_anim_init(&a_new);
|
||||||
|
lv_anim_set_var(&a_new, new_scr);
|
||||||
|
lv_anim_set_start_cb(&a_new, scr_load_anim_start);
|
||||||
|
lv_anim_set_ready_cb(&a_new, scr_anim_ready);
|
||||||
|
lv_anim_set_time(&a_new, time);
|
||||||
|
lv_anim_set_delay(&a_new, delay);
|
||||||
|
|
||||||
|
lv_anim_t a_old;
|
||||||
|
lv_anim_init(&a_old);
|
||||||
|
lv_anim_set_var(&a_old, d->act_scr);
|
||||||
|
lv_anim_set_time(&a_old, time);
|
||||||
|
lv_anim_set_delay(&a_old, delay);
|
||||||
|
|
||||||
|
switch(anim_type) {
|
||||||
|
case LV_SCR_LOAD_ANIM_NONE:
|
||||||
|
/* Create a dummy animation to apply the delay*/
|
||||||
|
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||||
|
lv_anim_set_values(&a_new, 0, 0);
|
||||||
|
break;
|
||||||
|
case LV_SCR_LOAD_ANIM_OVER_LEFT:
|
||||||
|
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||||
|
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0);
|
||||||
|
break;
|
||||||
|
case LV_SCR_LOAD_ANIM_OVER_RIGHT:
|
||||||
|
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||||
|
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0);
|
||||||
|
break;
|
||||||
|
case LV_SCR_LOAD_ANIM_OVER_TOP:
|
||||||
|
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||||
|
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0);
|
||||||
|
break;
|
||||||
|
case LV_SCR_LOAD_ANIM_OVER_BOTTOM:
|
||||||
|
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||||
|
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0);
|
||||||
|
break;
|
||||||
|
case LV_SCR_LOAD_ANIM_MOVE_LEFT:
|
||||||
|
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||||
|
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0);
|
||||||
|
|
||||||
|
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||||
|
lv_anim_set_values(&a_old, 0, -lv_disp_get_hor_res(d));
|
||||||
|
break;
|
||||||
|
case LV_SCR_LOAD_ANIM_MOVE_RIGHT:
|
||||||
|
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||||
|
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0);
|
||||||
|
|
||||||
|
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||||
|
lv_anim_set_values(&a_old, 0, lv_disp_get_hor_res(d));
|
||||||
|
break;
|
||||||
|
case LV_SCR_LOAD_ANIM_MOVE_TOP:
|
||||||
|
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||||
|
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0);
|
||||||
|
|
||||||
|
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||||
|
lv_anim_set_values(&a_old, 0, -lv_disp_get_ver_res(d));
|
||||||
|
break;
|
||||||
|
case LV_SCR_LOAD_ANIM_MOVE_BOTTOM:
|
||||||
|
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||||
|
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0);
|
||||||
|
|
||||||
|
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||||
|
lv_anim_set_values(&a_old, 0, lv_disp_get_ver_res(d));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LV_SCR_LOAD_ANIM_FADE_ON:
|
||||||
|
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) opa_scale_anim);
|
||||||
|
lv_anim_set_values(&a_new, LV_OPA_TRANSP, LV_OPA_COVER);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
lv_anim_start(&a_new);
|
||||||
|
lv_anim_start(&a_old);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get elapsed time since last user activity on a display (e.g. click)
|
* Get elapsed time since last user activity on a display (e.g. click)
|
||||||
* @param disp pointer to an display (NULL to get the overall smallest inactivity)
|
* @param disp pointer to an display (NULL to get the overall smallest inactivity)
|
||||||
@@ -178,3 +373,28 @@ lv_task_t * _lv_disp_get_refr_task(lv_disp_t * disp)
|
|||||||
/**********************
|
/**********************
|
||||||
* STATIC FUNCTIONS
|
* STATIC FUNCTIONS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
#if LV_USE_ANIMATION
|
||||||
|
static void scr_load_anim_start(lv_anim_t * a)
|
||||||
|
{
|
||||||
|
lv_disp_t * d = lv_obj_get_disp(a->var);
|
||||||
|
d->prev_scr = lv_scr_act();
|
||||||
|
|
||||||
|
lv_disp_load_scr(a->var);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v)
|
||||||
|
{
|
||||||
|
lv_obj_set_style_local_opa_scale(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void scr_anim_ready(lv_anim_t * a)
|
||||||
|
{
|
||||||
|
lv_disp_t * d = lv_obj_get_disp(a->var);
|
||||||
|
|
||||||
|
if(d->prev_scr && d->del_prev) lv_obj_del(d->prev_scr);
|
||||||
|
d->prev_scr = NULL;
|
||||||
|
lv_style_remove_prop(lv_obj_get_local_style(a->var, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -24,6 +24,19 @@ extern "C" {
|
|||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LV_SCR_LOAD_ANIM_NONE,
|
||||||
|
LV_SCR_LOAD_ANIM_OVER_LEFT,
|
||||||
|
LV_SCR_LOAD_ANIM_OVER_RIGHT,
|
||||||
|
LV_SCR_LOAD_ANIM_OVER_TOP,
|
||||||
|
LV_SCR_LOAD_ANIM_OVER_BOTTOM,
|
||||||
|
LV_SCR_LOAD_ANIM_MOVE_LEFT,
|
||||||
|
LV_SCR_LOAD_ANIM_MOVE_RIGHT,
|
||||||
|
LV_SCR_LOAD_ANIM_MOVE_TOP,
|
||||||
|
LV_SCR_LOAD_ANIM_MOVE_BOTTOM,
|
||||||
|
LV_SCR_LOAD_ANIM_FADE_ON,
|
||||||
|
} lv_scr_load_anim_t;
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
@@ -36,6 +49,14 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp);
|
lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return with a pointer to the previous screen. Only used during screen transitions.
|
||||||
|
* @param disp pointer to display which previous screen should be get. (NULL to use the default
|
||||||
|
* screen)
|
||||||
|
* @return pointer to the previous screen object or NULL if not used now
|
||||||
|
*/
|
||||||
|
lv_obj_t * lv_disp_get_scr_prev(lv_disp_t * disp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a screen active
|
* Make a screen active
|
||||||
* @param scr pointer to a screen
|
* @param scr pointer to a screen
|
||||||
@@ -64,6 +85,41 @@ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp);
|
|||||||
*/
|
*/
|
||||||
void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr);
|
void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the background color of a display
|
||||||
|
* @param disp pointer to a display
|
||||||
|
* @param color color of the background
|
||||||
|
*/
|
||||||
|
void lv_disp_set_bg_color(lv_disp_t * disp, lv_color_t color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the background image of a display
|
||||||
|
* @param disp pointer to a display
|
||||||
|
* @param img_src path to file or pointer to an `lv_img_dsc_t` variable
|
||||||
|
*/
|
||||||
|
void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opacity of the background
|
||||||
|
* @param disp pointer to a display
|
||||||
|
* @param opa opacity (0..255)
|
||||||
|
*/
|
||||||
|
void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa);
|
||||||
|
|
||||||
|
#if LV_USE_ANIMATION
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch screen with animation
|
||||||
|
* @param scr pointer to the new screen to load
|
||||||
|
* @param anim_type type of the animation from `lv_scr_load_anim_t`. E.g. `LV_SCR_LOAD_ANIM_MOVE_LEFT`
|
||||||
|
* @param time time of the animation
|
||||||
|
* @param delay delay before the transition
|
||||||
|
* @param auto_del true: automatically delete the old screen
|
||||||
|
*/
|
||||||
|
void lv_scr_load_anim(lv_obj_t * scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del);
|
||||||
|
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* Get elapsed time since last user activity on a display (e.g. click)
|
* Get elapsed time since last user activity on a display (e.g. click)
|
||||||
* @param disp pointer to an display (NULL to get the overall smallest inactivity)
|
* @param disp pointer to an display (NULL to get the overall smallest inactivity)
|
||||||
@@ -122,6 +178,7 @@ static inline void lv_scr_load(lv_obj_t * scr)
|
|||||||
lv_disp_load_scr(scr);
|
lv_disp_load_scr(scr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
@@ -154,6 +211,11 @@ static inline void lv_scr_load(lv_obj_t * scr)
|
|||||||
*/
|
*/
|
||||||
#define LV_DPX(n) LV_MATH_MAX((( lv_disp_get_dpi(NULL) * (n) + 80) / 160), 1) /*+80 for rounding*/
|
#define LV_DPX(n) LV_MATH_MAX((( lv_disp_get_dpi(NULL) * (n) + 80) / 160), 1) /*+80 for rounding*/
|
||||||
|
|
||||||
|
static inline lv_coord_t lv_dpx(lv_coord_t n)
|
||||||
|
{
|
||||||
|
return LV_DPX(n);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "lv_group.h"
|
#include "lv_group.h"
|
||||||
#if LV_USE_GROUP != 0
|
#if LV_USE_GROUP != 0
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "../lv_core/lv_debug.h"
|
#include "../lv_misc/lv_debug.h"
|
||||||
#include "../lv_themes/lv_theme.h"
|
#include "../lv_themes/lv_theme.h"
|
||||||
#include "../lv_misc/lv_gc.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;
|
if(res != LV_RES_OK) return;
|
||||||
lv_obj_invalidate(*g->obj_focus);
|
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);
|
obj_to_foreground(*g->obj_focus);
|
||||||
}
|
}
|
||||||
break;
|
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);
|
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL);
|
||||||
if(res != LV_RES_OK) return;
|
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);
|
obj_to_foreground(*group->obj_focus);
|
||||||
|
|
||||||
lv_obj_invalidate(*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);
|
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.
|
* deleted.
|
||||||
* @param group pointer to a group
|
* @param group pointer to a group
|
||||||
* @param new refocus policy enum
|
* @param new refocus policy enum
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj)
|
|||||||
indev->cursor = cur_obj;
|
indev->cursor = cur_obj;
|
||||||
lv_obj_set_parent(indev->cursor, lv_disp_get_layer_sys(indev->driver.disp));
|
lv_obj_set_parent(indev->cursor, lv_disp_get_layer_sys(indev->driver.disp));
|
||||||
lv_obj_set_pos(indev->cursor, indev->proc.types.pointer.act_point.x, indev->proc.types.pointer.act_point.y);
|
lv_obj_set_pos(indev->cursor, indev->proc.types.pointer.act_point.x, indev->proc.types.pointer.act_point.y);
|
||||||
|
lv_obj_set_click(indev->cursor, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LV_USE_GROUP
|
#if LV_USE_GROUP
|
||||||
@@ -607,8 +608,163 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
|||||||
indev_obj_act = lv_group_get_focused(g);
|
indev_obj_act = lv_group_get_focused(g);
|
||||||
if(indev_obj_act == NULL) return;
|
if(indev_obj_act == NULL) return;
|
||||||
|
|
||||||
/*Process the steps first. They are valid only with released button*/
|
/*Process the steps they are valid only with released button*/
|
||||||
if(data->state == LV_INDEV_STATE_REL) {
|
if(data->state != LV_INDEV_STATE_REL) {
|
||||||
|
data->enc_diff = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Refresh the focused object. It might change due to lv_group_focus_prev/next*/
|
||||||
|
indev_obj_act = lv_group_get_focused(g);
|
||||||
|
if(indev_obj_act == NULL) return;
|
||||||
|
|
||||||
|
/*Button press happened*/
|
||||||
|
if(data->state == LV_INDEV_STATE_PR && last_state == LV_INDEV_STATE_REL) {
|
||||||
|
|
||||||
|
i->proc.pr_timestamp = lv_tick_get();
|
||||||
|
|
||||||
|
if(data->key == LV_KEY_ENTER) {
|
||||||
|
bool editable = false;
|
||||||
|
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
|
||||||
|
|
||||||
|
if(lv_group_get_editing(g) == true || editable == false) {
|
||||||
|
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSED, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
|
||||||
|
lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(data->key == LV_KEY_LEFT) {
|
||||||
|
/*emulate encoder left*/
|
||||||
|
data->enc_diff--;
|
||||||
|
}
|
||||||
|
else if(data->key == LV_KEY_RIGHT) {
|
||||||
|
/*emulate encoder right*/
|
||||||
|
data->enc_diff++;
|
||||||
|
}
|
||||||
|
else if(data->key == LV_KEY_ESC) {
|
||||||
|
/*Send the ESC as a normal KEY*/
|
||||||
|
lv_group_send_data(g, LV_KEY_ESC);
|
||||||
|
|
||||||
|
lv_event_send(indev_obj_act, LV_EVENT_CANCEL, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
}
|
||||||
|
/*Just send other keys to the object (e.g. 'A' or `LV_GROUP_KEY_RIGHT`)*/
|
||||||
|
else {
|
||||||
|
lv_group_send_data(g, data->key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*Pressing*/
|
||||||
|
else if(data->state == LV_INDEV_STATE_PR && last_state == LV_INDEV_STATE_PR) {
|
||||||
|
/* Long press*/
|
||||||
|
if(i->proc.long_pr_sent == 0 && lv_tick_elaps(i->proc.pr_timestamp) > i->driver.long_press_time) {
|
||||||
|
|
||||||
|
i->proc.long_pr_sent = 1;
|
||||||
|
i->proc.longpr_rep_timestamp = lv_tick_get();
|
||||||
|
|
||||||
|
if(data->key == LV_KEY_ENTER) {
|
||||||
|
bool editable = false;
|
||||||
|
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
|
||||||
|
|
||||||
|
/*On enter long press toggle edit mode.*/
|
||||||
|
if(editable) {
|
||||||
|
/*Don't leave edit mode if there is only one object (nowhere to navigate)*/
|
||||||
|
if(_lv_ll_is_empty(&g->obj_ll) == false) {
|
||||||
|
lv_group_set_editing(g, lv_group_get_editing(g) ? false : true); /*Toggle edit mode on long press*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*If not editable then just send a long press signal*/
|
||||||
|
else {
|
||||||
|
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i->proc.long_pr_sent = 1;
|
||||||
|
}
|
||||||
|
/*Long press repeated time has elapsed?*/
|
||||||
|
else if(i->proc.long_pr_sent != 0 && lv_tick_elaps(i->proc.longpr_rep_timestamp) > i->driver.long_press_rep_time) {
|
||||||
|
|
||||||
|
i->proc.longpr_rep_timestamp = lv_tick_get();
|
||||||
|
|
||||||
|
if(data->key == LV_KEY_ENTER) {
|
||||||
|
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS_REP, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
}
|
||||||
|
else if(data->key == LV_KEY_LEFT) {
|
||||||
|
/*emulate encoder left*/
|
||||||
|
data->enc_diff--;
|
||||||
|
}
|
||||||
|
else if(data->key == LV_KEY_RIGHT) {
|
||||||
|
/*emulate encoder right*/
|
||||||
|
data->enc_diff++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lv_group_send_data(g, data->key);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*Release happened*/
|
||||||
|
else if(data->state == LV_INDEV_STATE_REL && last_state == LV_INDEV_STATE_PR) {
|
||||||
|
|
||||||
|
if(data->key == LV_KEY_ENTER) {
|
||||||
|
bool editable = false;
|
||||||
|
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
|
||||||
|
|
||||||
|
/*The button was released on a non-editable object. Just send enter*/
|
||||||
|
if(editable == false) {
|
||||||
|
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
|
||||||
|
if(i->proc.long_pr_sent == 0) lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
|
||||||
|
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
|
||||||
|
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
}
|
||||||
|
/*An object is being edited and the button is released. */
|
||||||
|
else if(g->editing) {
|
||||||
|
/*Ignore long pressed enter release because it comes from mode switch*/
|
||||||
|
if(!i->proc.long_pr_sent || _lv_ll_is_empty(&g->obj_ll)) {
|
||||||
|
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
|
||||||
|
lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
|
||||||
|
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
|
||||||
|
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
|
||||||
|
if(indev_reset_check(&i->proc)) return;
|
||||||
|
|
||||||
|
lv_group_send_data(g, LV_KEY_ENTER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*If the focused object is editable and now in navigate mode then on enter switch edit
|
||||||
|
mode*/
|
||||||
|
else if(editable && !g->editing && !i->proc.long_pr_sent) {
|
||||||
|
lv_group_set_editing(g, true); /*Set edit mode*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i->proc.pr_timestamp = 0;
|
||||||
|
i->proc.long_pr_sent = 0;
|
||||||
|
}
|
||||||
|
indev_obj_act = NULL;
|
||||||
|
|
||||||
|
/*if encoder steps or simulated steps via left/right keys*/
|
||||||
|
if(data->enc_diff != 0) {
|
||||||
/*In edit mode send LEFT/RIGHT keys*/
|
/*In edit mode send LEFT/RIGHT keys*/
|
||||||
if(lv_group_get_editing(g)) {
|
if(lv_group_get_editing(g)) {
|
||||||
int32_t s;
|
int32_t s;
|
||||||
@@ -631,96 +787,6 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Refresh the focused object. It might change due to lv_group_focus_prev/next*/
|
|
||||||
indev_obj_act = lv_group_get_focused(g);
|
|
||||||
if(indev_obj_act == NULL) return;
|
|
||||||
|
|
||||||
/*Button press happened*/
|
|
||||||
if(data->state == LV_INDEV_STATE_PR && last_state == LV_INDEV_STATE_REL) {
|
|
||||||
bool editable = false;
|
|
||||||
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
|
|
||||||
|
|
||||||
i->proc.pr_timestamp = lv_tick_get();
|
|
||||||
if(lv_group_get_editing(g) == true || editable == false) {
|
|
||||||
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSED, NULL);
|
|
||||||
if(indev_reset_check(&i->proc)) return;
|
|
||||||
|
|
||||||
lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL);
|
|
||||||
if(indev_reset_check(&i->proc)) return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*Pressing*/
|
|
||||||
else if(data->state == LV_INDEV_STATE_PR && last_state == LV_INDEV_STATE_PR) {
|
|
||||||
if(i->proc.long_pr_sent == 0 && lv_tick_elaps(i->proc.pr_timestamp) > i->driver.long_press_time) {
|
|
||||||
bool editable = false;
|
|
||||||
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
|
|
||||||
|
|
||||||
/*On enter long press toggle edit mode.*/
|
|
||||||
if(editable) {
|
|
||||||
/*Don't leave edit mode if there is only one object (nowhere to navigate)*/
|
|
||||||
if(_lv_ll_is_empty(&g->obj_ll) == false) {
|
|
||||||
lv_group_set_editing(g, lv_group_get_editing(g) ? false : true); /*Toggle edit mode on long press*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*If not editable then just send a long press signal*/
|
|
||||||
else {
|
|
||||||
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL);
|
|
||||||
if(indev_reset_check(&i->proc)) return;
|
|
||||||
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL);
|
|
||||||
if(indev_reset_check(&i->proc)) return;
|
|
||||||
}
|
|
||||||
i->proc.long_pr_sent = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*Release happened*/
|
|
||||||
else if(data->state == LV_INDEV_STATE_REL && last_state == LV_INDEV_STATE_PR) {
|
|
||||||
|
|
||||||
bool editable = false;
|
|
||||||
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
|
|
||||||
|
|
||||||
/*The button was released on a non-editable object. Just send enter*/
|
|
||||||
if(editable == false) {
|
|
||||||
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
|
|
||||||
if(indev_reset_check(&i->proc)) return;
|
|
||||||
|
|
||||||
if(i->proc.long_pr_sent == 0) lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
|
|
||||||
if(indev_reset_check(&i->proc)) return;
|
|
||||||
|
|
||||||
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
|
|
||||||
if(indev_reset_check(&i->proc)) return;
|
|
||||||
|
|
||||||
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
|
|
||||||
if(indev_reset_check(&i->proc)) return;
|
|
||||||
}
|
|
||||||
/*An object is being edited and the button is released. */
|
|
||||||
else if(g->editing) {
|
|
||||||
/*Ignore long pressed enter release because it comes from mode switch*/
|
|
||||||
if(!i->proc.long_pr_sent || _lv_ll_is_empty(&g->obj_ll)) {
|
|
||||||
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
|
|
||||||
if(indev_reset_check(&i->proc)) return;
|
|
||||||
|
|
||||||
lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
|
|
||||||
if(indev_reset_check(&i->proc)) return;
|
|
||||||
|
|
||||||
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
|
|
||||||
if(indev_reset_check(&i->proc)) return;
|
|
||||||
|
|
||||||
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
|
|
||||||
if(indev_reset_check(&i->proc)) return;
|
|
||||||
|
|
||||||
lv_group_send_data(g, LV_KEY_ENTER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*If the focused object is editable and now in navigate mode then on enter switch edit
|
|
||||||
mode*/
|
|
||||||
else if(editable && !g->editing && !i->proc.long_pr_sent) {
|
|
||||||
lv_group_set_editing(g, true); /*Set edit mode*/
|
|
||||||
}
|
|
||||||
|
|
||||||
i->proc.pr_timestamp = 0;
|
|
||||||
i->proc.long_pr_sent = 0;
|
|
||||||
}
|
|
||||||
indev_obj_act = NULL;
|
|
||||||
#else
|
#else
|
||||||
(void)data; /*Unused*/
|
(void)data; /*Unused*/
|
||||||
(void)i; /*Unused*/
|
(void)i; /*Unused*/
|
||||||
@@ -791,7 +857,7 @@ static void indev_proc_press(lv_indev_proc_t * proc)
|
|||||||
&proc->types.pointer.act_point);
|
&proc->types.pointer.act_point);
|
||||||
new_obj_searched = true;
|
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 {
|
else {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1049,7 +1115,7 @@ static void indev_proc_reset_query_handler(lv_indev_t * indev)
|
|||||||
/**
|
/**
|
||||||
* Search the most top, clickable object by a point
|
* Search the most top, clickable object by a point
|
||||||
* @param obj pointer to a start object, typically the screen
|
* @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
|
* @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)
|
lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
|
||||||
@@ -1086,14 +1152,15 @@ 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
|
* @param proc pointer to the state of the indev
|
||||||
*/
|
*/
|
||||||
static void indev_click_focus(lv_indev_proc_t * proc)
|
static void indev_click_focus(lv_indev_proc_t * proc)
|
||||||
{
|
{
|
||||||
/*Handle click focus*/
|
/*Handle click focus*/
|
||||||
|
lv_obj_t * obj_to_focus = lv_obj_get_focused_obj(indev_obj_act);
|
||||||
if(lv_obj_is_protected(indev_obj_act, LV_PROTECT_CLICK_FOCUS) == false &&
|
if(lv_obj_is_protected(indev_obj_act, LV_PROTECT_CLICK_FOCUS) == false &&
|
||||||
proc->types.pointer.last_pressed != indev_obj_act) {
|
proc->types.pointer.last_pressed != obj_to_focus) {
|
||||||
#if LV_USE_GROUP
|
#if LV_USE_GROUP
|
||||||
lv_group_t * g_act = lv_obj_get_group(indev_obj_act);
|
lv_group_t * g_act = lv_obj_get_group(indev_obj_act);
|
||||||
lv_group_t * g_prev = proc->types.pointer.last_pressed ? lv_obj_get_group(proc->types.pointer.last_pressed) : NULL;
|
lv_group_t * g_prev = proc->types.pointer.last_pressed ? lv_obj_get_group(proc->types.pointer.last_pressed) : NULL;
|
||||||
@@ -1122,11 +1189,6 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
|||||||
}
|
}
|
||||||
/*The object are not in the same group (in different group or one in not a group)*/
|
/*The object are not in the same group (in different group or one in not a group)*/
|
||||||
else {
|
else {
|
||||||
/*Focus to the act. its group*/
|
|
||||||
if(g_act) {
|
|
||||||
lv_group_focus_obj(indev_obj_act);
|
|
||||||
if(indev_reset_check(proc)) return;
|
|
||||||
}
|
|
||||||
/*If the prev. obj. is not in a group then defocus it.*/
|
/*If the prev. obj. is not in a group then defocus it.*/
|
||||||
if(g_prev == NULL && proc->types.pointer.last_pressed) {
|
if(g_prev == NULL && proc->types.pointer.last_pressed) {
|
||||||
lv_signal_send(proc->types.pointer.last_pressed, LV_SIGNAL_DEFOCUS, NULL);
|
lv_signal_send(proc->types.pointer.last_pressed, LV_SIGNAL_DEFOCUS, NULL);
|
||||||
@@ -1152,7 +1214,14 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
|||||||
if(indev_reset_check(proc)) return;
|
if(indev_reset_check(proc)) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Focus to the act. in its group*/
|
||||||
|
if(g_act) {
|
||||||
|
lv_group_focus_obj(indev_obj_act);
|
||||||
|
if(indev_reset_check(proc)) return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL);
|
lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL);
|
||||||
if(indev_reset_check(proc)) return;
|
if(indev_reset_check(proc)) return;
|
||||||
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
|
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
|
||||||
@@ -1172,7 +1241,7 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
|||||||
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
|
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
|
||||||
if(indev_reset_check(proc)) return;
|
if(indev_reset_check(proc)) return;
|
||||||
#endif
|
#endif
|
||||||
proc->types.pointer.last_pressed = indev_obj_act;
|
proc->types.pointer.last_pressed = obj_to_focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1399,7 +1468,7 @@ static void indev_drag_throw(lv_indev_proc_t * proc)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the really dragged object by taking `drag_parent` into account.
|
* 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
|
* @return the object to really drag
|
||||||
*/
|
*/
|
||||||
static lv_obj_t * get_dragged_obj(lv_obj_t * obj)
|
static lv_obj_t * get_dragged_obj(lv_obj_t * obj)
|
||||||
@@ -1426,13 +1495,14 @@ static void indev_gesture(lv_indev_proc_t * proc)
|
|||||||
|
|
||||||
lv_obj_t * gesture_obj = proc->types.pointer.act_obj;
|
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)) {
|
while(gesture_obj && lv_obj_get_gesture_parent(gesture_obj)) {
|
||||||
gesture_obj = lv_obj_get_parent(gesture_obj);
|
gesture_obj = lv_obj_get_parent(gesture_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gesture_obj == NULL) return;
|
if(gesture_obj == NULL) return;
|
||||||
|
|
||||||
|
|
||||||
if((LV_MATH_ABS(proc->types.pointer.vect.x) < indev_act->driver.gesture_min_velocity) &&
|
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)) {
|
(LV_MATH_ABS(proc->types.pointer.vect.y) < indev_act->driver.gesture_min_velocity)) {
|
||||||
proc->types.pointer.gesture_sum.x = 0;
|
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
|
* Search the most top, clickable object by a point
|
||||||
* @param obj pointer to a start object, typically the screen
|
* @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
|
* @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);
|
lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -21,6 +21,7 @@ extern "C" {
|
|||||||
#include "../lv_misc/lv_types.h"
|
#include "../lv_misc/lv_types.h"
|
||||||
#include "../lv_misc/lv_area.h"
|
#include "../lv_misc/lv_area.h"
|
||||||
#include "../lv_misc/lv_color.h"
|
#include "../lv_misc/lv_color.h"
|
||||||
|
#include "../lv_misc/lv_debug.h"
|
||||||
#include "../lv_hal/lv_hal.h"
|
#include "../lv_hal/lv_hal.h"
|
||||||
#include "../lv_draw/lv_draw_rect.h"
|
#include "../lv_draw/lv_draw_rect.h"
|
||||||
#include "../lv_draw/lv_draw_label.h"
|
#include "../lv_draw/lv_draw_label.h"
|
||||||
@@ -46,6 +47,9 @@ extern "C" {
|
|||||||
#define LV_EXT_CLICK_AREA_TINY 1
|
#define LV_EXT_CLICK_AREA_TINY 1
|
||||||
#define LV_EXT_CLICK_AREA_FULL 2
|
#define LV_EXT_CLICK_AREA_FULL 2
|
||||||
|
|
||||||
|
#define _LV_OBJ_PART_VIRTUAL_FIRST 0x01
|
||||||
|
#define _LV_OBJ_PART_REAL_FIRST 0x40
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
@@ -90,7 +94,7 @@ enum {
|
|||||||
LV_EVENT_DRAG_BEGIN,
|
LV_EVENT_DRAG_BEGIN,
|
||||||
LV_EVENT_DRAG_END,
|
LV_EVENT_DRAG_END,
|
||||||
LV_EVENT_DRAG_THROW_BEGIN,
|
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_KEY,
|
||||||
LV_EVENT_FOCUSED,
|
LV_EVENT_FOCUSED,
|
||||||
LV_EVENT_DEFOCUSED,
|
LV_EVENT_DEFOCUSED,
|
||||||
@@ -209,7 +213,7 @@ typedef struct _lv_obj_t {
|
|||||||
lv_area_t ext_click_pad; /**< Extra click padding area. */
|
lv_area_t ext_click_pad; /**< Extra click padding area. */
|
||||||
#endif
|
#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*/
|
/*Attributes and states*/
|
||||||
uint8_t click : 1; /**< 1: Can be pressed by an input device*/
|
uint8_t click : 1; /**< 1: Can be pressed by an input device*/
|
||||||
@@ -220,7 +224,8 @@ typedef struct _lv_obj_t {
|
|||||||
uint8_t top : 1; /**< 1: If the object or its children is clicked it goes to the foreground*/
|
uint8_t top : 1; /**< 1: If the object or its children is clicked it goes to the foreground*/
|
||||||
uint8_t parent_event : 1; /**< 1: Send the object's events to the parent too. */
|
uint8_t parent_event : 1; /**< 1: Send the object's events to the parent too. */
|
||||||
uint8_t adv_hittest : 1; /**< 1: Use advanced hit-testing (slower) */
|
uint8_t adv_hittest : 1; /**< 1: Use advanced hit-testing (slower) */
|
||||||
uint8_t gesture_parent : 1; /**< 1: Parent will be gesture instead*/
|
uint8_t gesture_parent : 1; /**< 1: Parent will be gesture instead*/
|
||||||
|
uint8_t focus_parent : 1; /**< 1: Parent will be focused instead*/
|
||||||
|
|
||||||
lv_drag_dir_t drag_dir : 3; /**< Which directions the object can be dragged in */
|
lv_drag_dir_t drag_dir : 3; /**< Which directions the object can be dragged in */
|
||||||
lv_bidi_dir_t base_dir : 2; /**< Base direction of texts related to this object */
|
lv_bidi_dir_t base_dir : 2; /**< Base direction of texts related to this object */
|
||||||
@@ -245,8 +250,8 @@ typedef struct _lv_obj_t {
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
LV_OBJ_PART_MAIN,
|
LV_OBJ_PART_MAIN,
|
||||||
_LV_OBJ_PART_VIRTUAL_LAST = 0x01,
|
_LV_OBJ_PART_VIRTUAL_LAST = _LV_OBJ_PART_VIRTUAL_FIRST,
|
||||||
_LV_OBJ_PART_REAL_LAST = 0x40,
|
_LV_OBJ_PART_REAL_LAST = _LV_OBJ_PART_REAL_FIRST,
|
||||||
LV_OBJ_PART_ALL = 0xFF,
|
LV_OBJ_PART_ALL = 0xFF,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -439,7 +444,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.
|
* 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 obj pointer to an object
|
||||||
* @param w new height including margins
|
* @param w new height including margins
|
||||||
*/
|
*/
|
||||||
@@ -447,7 +452,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.
|
* 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 obj pointer to an object
|
||||||
* @param h new height including margins
|
* @param h new height including margins
|
||||||
*/
|
*/
|
||||||
@@ -463,6 +468,24 @@ void lv_obj_set_height_margin(lv_obj_t * obj, lv_coord_t h);
|
|||||||
*/
|
*/
|
||||||
void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align an object to an other object horizontally.
|
||||||
|
* @param obj pointer to an object to align
|
||||||
|
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
|
||||||
|
* @param align type of alignment (see 'lv_align_t' enum)
|
||||||
|
* @param x_ofs x coordinate offset after alignment
|
||||||
|
*/
|
||||||
|
void lv_obj_align_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align an object to an other object vertically.
|
||||||
|
* @param obj pointer to an object to align
|
||||||
|
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
|
||||||
|
* @param align type of alignment (see 'lv_align_t' enum)
|
||||||
|
* @param y_ofs y coordinate offset after alignment
|
||||||
|
*/
|
||||||
|
void lv_obj_align_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Align an object to an other object.
|
* Align an object to an other object.
|
||||||
* @param obj pointer to an object to align
|
* @param obj pointer to an object to align
|
||||||
@@ -473,6 +496,25 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
|
|||||||
*/
|
*/
|
||||||
void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align an object's middle point to an other object horizontally.
|
||||||
|
* @param obj pointer to an object to align
|
||||||
|
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
|
||||||
|
* @param align type of alignment (see 'lv_align_t' enum)
|
||||||
|
* @param x_ofs x coordinate offset after alignment
|
||||||
|
*/
|
||||||
|
void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align an object's middle point to an other object vertically.
|
||||||
|
* @param obj pointer to an object to align
|
||||||
|
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
|
||||||
|
* @param align type of alignment (see 'lv_align_t' enum)
|
||||||
|
* @param y_ofs y coordinate offset after alignment
|
||||||
|
*/
|
||||||
|
void lv_obj_align_origo_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Realign the object based on the last `lv_obj_align` parameters.
|
* Realign the object based on the last `lv_obj_align` parameters.
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
@@ -618,7 +660,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)`
|
* 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.
|
* @note shouldn't be used directly. Use the specific property remove functions instead.
|
||||||
* For example: `lv_obj_style_remove_border_opa()`
|
* 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);
|
bool lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||||
|
|
||||||
@@ -658,7 +700,7 @@ void lv_obj_set_top(lv_obj_t * obj, bool en);
|
|||||||
/**
|
/**
|
||||||
* Enable the dragging of an object
|
* Enable the dragging of an object
|
||||||
* @param obj pointer to 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);
|
void lv_obj_set_drag(lv_obj_t * obj, bool en);
|
||||||
|
|
||||||
@@ -684,6 +726,14 @@ void lv_obj_set_drag_throw(lv_obj_t * obj, bool en);
|
|||||||
*/
|
*/
|
||||||
void lv_obj_set_drag_parent(lv_obj_t * obj, bool en);
|
void lv_obj_set_drag_parent(lv_obj_t * obj, bool en);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable to use parent for focus state.
|
||||||
|
* When object is focused the parent will get the state instead (visual only)
|
||||||
|
* @param obj pointer to an object
|
||||||
|
* @param en true: enable the 'focus parent' for the object
|
||||||
|
*/
|
||||||
|
void lv_obj_set_focus_parent(lv_obj_t * obj, bool en);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable to use parent for gesture related operations.
|
* Enable to use parent for gesture related operations.
|
||||||
* If trying to gesture the object the parent will be moved instead
|
* If trying to gesture the object the parent will be moved instead
|
||||||
@@ -773,6 +823,20 @@ void lv_obj_set_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb);
|
|||||||
*/
|
*/
|
||||||
lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data);
|
lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send LV_EVENT_REFRESH event to an object
|
||||||
|
* @param obj point to an obejct. (Can NOT be NULL)
|
||||||
|
* @return LV_RES_OK: success, LV_RES_INV: to object become invalid (e.g. deleted) due to this event.
|
||||||
|
*/
|
||||||
|
lv_res_t lv_event_send_refresh(lv_obj_t * obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send LV_EVENT_REFRESH event to an object and all of its children
|
||||||
|
* @param obj pointer to an object or NULL to refresh all objects of all displays
|
||||||
|
*/
|
||||||
|
void lv_event_send_refresh_recursive(lv_obj_t * obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call an event function with an object, event, and data.
|
* Call an event function with an object, event, and data.
|
||||||
* @param event_xcb an event callback function. If `NULL` `LV_RES_OK` will return without any actions.
|
* @param event_xcb an event callback function. If `NULL` `LV_RES_OK` will return without any actions.
|
||||||
@@ -847,7 +911,6 @@ lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the display of an object
|
* Get the display of an object
|
||||||
* @param scr pointer to an object
|
|
||||||
* @return pointer the object's display
|
* @return pointer the object's display
|
||||||
*/
|
*/
|
||||||
lv_disp_t * lv_obj_get_disp(const lv_obj_t * obj);
|
lv_disp_t * lv_obj_get_disp(const lv_obj_t * obj);
|
||||||
@@ -956,7 +1019,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.
|
* 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
|
* @param obj pointer to an object
|
||||||
* @return the height including thee margins
|
* @return the height including thee margins
|
||||||
*/
|
*/
|
||||||
@@ -964,7 +1027,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.
|
* 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
|
* @param obj pointer to an object
|
||||||
* @return the height including thee margins
|
* @return the height including thee margins
|
||||||
*/
|
*/
|
||||||
@@ -1043,7 +1106,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 obj pointer to an object.
|
||||||
* @param part part the part of the object which style list should be get.
|
* @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`
|
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
|
||||||
@@ -1162,7 +1225,7 @@ bool lv_obj_get_top(const lv_obj_t * obj);
|
|||||||
/**
|
/**
|
||||||
* Get the drag enable attribute of an object
|
* Get the drag enable attribute of an object
|
||||||
* @param obj pointer to 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);
|
bool lv_obj_get_drag(const lv_obj_t * obj);
|
||||||
|
|
||||||
@@ -1187,6 +1250,15 @@ bool lv_obj_get_drag_throw(const lv_obj_t * obj);
|
|||||||
*/
|
*/
|
||||||
bool lv_obj_get_drag_parent(const lv_obj_t * obj);
|
bool lv_obj_get_drag_parent(const lv_obj_t * obj);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the focus parent attribute of an object
|
||||||
|
* @param obj pointer to an object
|
||||||
|
* @return true: focus parent is enabled
|
||||||
|
*/
|
||||||
|
bool lv_obj_get_focus_parent(const lv_obj_t * obj);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the drag parent attribute of an object
|
* Get the drag parent attribute of an object
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
@@ -1318,6 +1390,13 @@ void * lv_obj_get_group(const lv_obj_t * obj);
|
|||||||
*/
|
*/
|
||||||
bool lv_obj_is_focused(const lv_obj_t * obj);
|
bool lv_obj_is_focused(const lv_obj_t * obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the really focused object by taking `focus_parent` into account.
|
||||||
|
* @param obj the start object
|
||||||
|
* @return the object to really focus
|
||||||
|
*/
|
||||||
|
lv_obj_t * lv_obj_get_focused_obj(const lv_obj_t * obj);
|
||||||
|
|
||||||
/*-------------------
|
/*-------------------
|
||||||
* OTHER FUNCTIONS
|
* OTHER FUNCTIONS
|
||||||
*------------------*/
|
*------------------*/
|
||||||
@@ -1348,7 +1427,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.
|
* 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
|
* @param part part of the object
|
||||||
*/
|
*/
|
||||||
lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part);
|
lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part);
|
||||||
@@ -1369,6 +1448,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);
|
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
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
@@ -1378,7 +1474,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)`
|
* Will be expanded to: `static void <name> (lv_obj_t * obj, lv_event_t e)`
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* LV_EVENT_CB_DECLARE(my_event1); //Protoype declaration
|
* LV_EVENT_CB_DECLARE(my_event1); //Prototype declaration
|
||||||
*
|
*
|
||||||
* LV_EVENT_CB_DECLARE(my_event1)
|
* LV_EVENT_CB_DECLARE(my_event1)
|
||||||
* {
|
* {
|
||||||
@@ -1389,6 +1485,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)
|
#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
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -199,6 +199,102 @@ _LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_COLOR, scale_end_color, lv_color_t, _col
|
|||||||
|
|
||||||
#undef _LV_OBJ_STYLE_SET_GET_DECLARE
|
#undef _LV_OBJ_STYLE_SET_GET_DECLARE
|
||||||
|
|
||||||
|
|
||||||
|
static inline void lv_obj_set_style_local_pad_all(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
|
||||||
|
{
|
||||||
|
lv_obj_set_style_local_pad_top(obj, part, state, value);
|
||||||
|
lv_obj_set_style_local_pad_bottom(obj, part, state, value);
|
||||||
|
lv_obj_set_style_local_pad_left(obj, part, state, value);
|
||||||
|
lv_obj_set_style_local_pad_right(obj, part, state, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void lv_style_set_pad_all(lv_style_t * style, lv_state_t state, lv_style_int_t value)
|
||||||
|
{
|
||||||
|
lv_style_set_pad_top(style, state, value);
|
||||||
|
lv_style_set_pad_bottom(style, state, value);
|
||||||
|
lv_style_set_pad_left(style, state, value);
|
||||||
|
lv_style_set_pad_right(style, state, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void lv_obj_set_style_local_pad_hor(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
|
||||||
|
{
|
||||||
|
lv_obj_set_style_local_pad_left(obj, part, state, value);
|
||||||
|
lv_obj_set_style_local_pad_right(obj, part, state, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void lv_style_set_pad_hor(lv_style_t * style, lv_state_t state, lv_style_int_t value)
|
||||||
|
{
|
||||||
|
lv_style_set_pad_left(style, state, value);
|
||||||
|
lv_style_set_pad_right(style, state, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void lv_obj_set_style_local_pad_ver(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
|
||||||
|
{
|
||||||
|
lv_obj_set_style_local_pad_top(obj, part, state, value);
|
||||||
|
lv_obj_set_style_local_pad_bottom(obj, part, state, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void lv_style_set_pad_ver(lv_style_t * style, lv_state_t state, lv_style_int_t value)
|
||||||
|
{
|
||||||
|
lv_style_set_pad_top(style, state, value);
|
||||||
|
lv_style_set_pad_bottom(style, state, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void lv_obj_set_style_local_margin_all(lv_obj_t * obj, uint8_t part, lv_state_t state,
|
||||||
|
lv_style_int_t value)
|
||||||
|
{
|
||||||
|
lv_obj_set_style_local_margin_top(obj, part, state, value);
|
||||||
|
lv_obj_set_style_local_margin_bottom(obj, part, state, value);
|
||||||
|
lv_obj_set_style_local_margin_left(obj, part, state, value);
|
||||||
|
lv_obj_set_style_local_margin_right(obj, part, state, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void lv_style_set_margin_all(lv_style_t * style, lv_state_t state, lv_style_int_t value)
|
||||||
|
{
|
||||||
|
lv_style_set_margin_top(style, state, value);
|
||||||
|
lv_style_set_margin_bottom(style, state, value);
|
||||||
|
lv_style_set_margin_left(style, state, value);
|
||||||
|
lv_style_set_margin_right(style, state, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void lv_obj_set_style_local_margin_hor(lv_obj_t * obj, uint8_t part, lv_state_t state,
|
||||||
|
lv_style_int_t value)
|
||||||
|
{
|
||||||
|
lv_obj_set_style_local_margin_left(obj, part, state, value);
|
||||||
|
lv_obj_set_style_local_margin_right(obj, part, state, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void lv_style_set_margin_hor(lv_style_t * style, lv_state_t state, lv_style_int_t value)
|
||||||
|
{
|
||||||
|
lv_style_set_margin_left(style, state, value);
|
||||||
|
lv_style_set_margin_right(style, state, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void lv_obj_set_style_local_margin_ver(lv_obj_t * obj, uint8_t part, lv_state_t state,
|
||||||
|
lv_style_int_t value)
|
||||||
|
{
|
||||||
|
lv_obj_set_style_local_margin_top(obj, part, state, value);
|
||||||
|
lv_obj_set_style_local_margin_bottom(obj, part, state, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void lv_style_set_margin_ver(lv_style_t * style, lv_state_t state, lv_style_int_t value)
|
||||||
|
{
|
||||||
|
lv_style_set_margin_top(style, state, value);
|
||||||
|
lv_style_set_margin_bottom(style, state, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ lv_disp_t * _lv_refr_get_disp_refreshing(void)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the display which is being refreshed.
|
* 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.
|
* It can be used to trick the drawing functions about there is an active display.
|
||||||
* @param the display being refreshed
|
* @param the display being refreshed
|
||||||
*/
|
*/
|
||||||
@@ -202,55 +202,60 @@ void _lv_disp_refr_task(lv_task_t * task)
|
|||||||
if(disp_refr->inv_p != 0) {
|
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.
|
/* 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.*/
|
* 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) {
|
if(lv_disp_is_true_double_buf(disp_refr)) {
|
||||||
lv_disp_buf_t * vdb = lv_disp_get_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.");
|
||||||
/*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);
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr);
|
||||||
|
|
||||||
if(copy_buf) _lv_mem_buf_release(copy_buf);
|
/*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);
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(copy_buf) _lv_mem_buf_release(copy_buf);
|
||||||
|
}
|
||||||
} /*End of true double buffer handling*/
|
} /*End of true double buffer handling*/
|
||||||
|
|
||||||
/*Clean up*/
|
/*Clean up*/
|
||||||
@@ -485,7 +490,8 @@ static void lv_refr_area_part(const lv_area_t * area_p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_t * top_p;
|
lv_obj_t * top_act_scr = NULL;
|
||||||
|
lv_obj_t * top_prev_scr = NULL;
|
||||||
|
|
||||||
/*Get the new mask from the original area and the act. VDB
|
/*Get the new mask from the original area and the act. VDB
|
||||||
It will be a part of 'area_p'*/
|
It will be a part of 'area_p'*/
|
||||||
@@ -493,10 +499,55 @@ static void lv_refr_area_part(const lv_area_t * area_p)
|
|||||||
_lv_area_intersect(&start_mask, area_p, &vdb->area);
|
_lv_area_intersect(&start_mask, area_p, &vdb->area);
|
||||||
|
|
||||||
/*Get the most top object which is not covered by others*/
|
/*Get the most top object which is not covered by others*/
|
||||||
top_p = lv_refr_get_top_obj(&start_mask, lv_disp_get_scr_act(disp_refr));
|
top_act_scr = lv_refr_get_top_obj(&start_mask, lv_disp_get_scr_act(disp_refr));
|
||||||
|
if(disp_refr->prev_scr) {
|
||||||
|
top_prev_scr = lv_refr_get_top_obj(&start_mask, disp_refr->prev_scr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Draw a display background if there is no top object*/
|
||||||
|
if(top_act_scr == NULL && top_prev_scr == NULL) {
|
||||||
|
if(disp_refr->bg_img) {
|
||||||
|
lv_draw_img_dsc_t dsc;
|
||||||
|
lv_draw_img_dsc_init(&dsc);
|
||||||
|
dsc.opa = disp_refr->bg_opa;
|
||||||
|
lv_img_header_t header;
|
||||||
|
lv_res_t res;
|
||||||
|
res = lv_img_decoder_get_info(disp_refr->bg_img, &header);
|
||||||
|
if(res == LV_RES_OK) {
|
||||||
|
lv_area_t a;
|
||||||
|
lv_area_set(&a, 0, 0, header.w - 1, header.h - 1);
|
||||||
|
lv_draw_img(&a, &start_mask, disp_refr->bg_img, &dsc);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LV_LOG_WARN("Can't draw the background image")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lv_draw_rect_dsc_t dsc;
|
||||||
|
lv_draw_rect_dsc_init(&dsc);
|
||||||
|
dsc.bg_color = disp_refr->bg_color;
|
||||||
|
dsc.bg_opa = disp_refr->bg_opa;
|
||||||
|
lv_draw_rect(&start_mask, &start_mask, &dsc);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*Refresh the previous screen if any*/
|
||||||
|
if(disp_refr->prev_scr) {
|
||||||
|
/*Get the most top object which is not covered by others*/
|
||||||
|
if(top_prev_scr == NULL) {
|
||||||
|
top_prev_scr = disp_refr->prev_scr;
|
||||||
|
}
|
||||||
|
/*Do the refreshing from the top object*/
|
||||||
|
lv_refr_obj_and_children(top_prev_scr, &start_mask);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(top_act_scr == NULL) {
|
||||||
|
top_act_scr = disp_refr->act_scr;
|
||||||
|
}
|
||||||
/*Do the refreshing from the top object*/
|
/*Do the refreshing from the top object*/
|
||||||
lv_refr_obj_and_children(top_p, &start_mask);
|
lv_refr_obj_and_children(top_act_scr, &start_mask);
|
||||||
|
|
||||||
/*Also refresh top and sys layer unconditionally*/
|
/*Also refresh top and sys layer unconditionally*/
|
||||||
lv_refr_obj_and_children(lv_disp_get_layer_top(disp_refr), &start_mask);
|
lv_refr_obj_and_children(lv_disp_get_layer_top(disp_refr), &start_mask);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ lv_disp_t * _lv_refr_get_disp_refreshing(void);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the display which is being refreshed.
|
* 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.
|
* It can be used to trick the drawing functions about there is an active display.
|
||||||
* @param the display being refreshed
|
* @param the display being refreshed
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
#include "lv_obj.h"
|
#include "lv_obj.h"
|
||||||
#include "../lv_core/lv_debug.h"
|
|
||||||
#include "../lv_misc/lv_mem.h"
|
#include "../lv_misc/lv_mem.h"
|
||||||
#include "../lv_misc/lv_anim.h"
|
#include "../lv_misc/lv_anim.h"
|
||||||
|
|
||||||
@@ -37,6 +36,12 @@
|
|||||||
**********************/
|
**********************/
|
||||||
LV_ATTRIBUTE_FAST_MEM static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop);
|
LV_ATTRIBUTE_FAST_MEM static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop);
|
||||||
static lv_style_t * get_alloc_local_style(lv_style_list_t * list);
|
static lv_style_t * get_alloc_local_style(lv_style_list_t * list);
|
||||||
|
static inline void style_resize(lv_style_t * style, size_t sz);
|
||||||
|
static inline lv_style_property_t get_style_prop(const lv_style_t * style, size_t idx);
|
||||||
|
static inline uint8_t get_style_prop_id(const lv_style_t * style, size_t idx);
|
||||||
|
static inline uint8_t get_style_prop_attr(const lv_style_t * style, size_t idx);
|
||||||
|
static inline size_t get_prop_size(uint8_t prop_id);
|
||||||
|
static inline size_t get_next_prop_index(uint8_t prop_id, size_t id);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* GLOABAL VARIABLES
|
* GLOABAL VARIABLES
|
||||||
@@ -103,16 +108,12 @@ bool lv_style_remove_prop(lv_style_t * style, lv_style_property_t prop)
|
|||||||
lv_style_attr_t attr_found;
|
lv_style_attr_t attr_found;
|
||||||
lv_style_attr_t attr_goal;
|
lv_style_attr_t attr_goal;
|
||||||
|
|
||||||
attr_found.full = *(style->map + id + 1);
|
attr_found = get_style_prop_attr(style, id);
|
||||||
attr_goal.full = (prop >> 8) & 0xFFU;
|
attr_goal = (prop >> 8) & 0xFFU;
|
||||||
|
|
||||||
if(attr_found.bits.state == attr_goal.bits.state) {
|
if(LV_STYLE_ATTR_GET_STATE(attr_found) == LV_STYLE_ATTR_GET_STATE(attr_goal)) {
|
||||||
uint32_t map_size = _lv_style_get_mem_size(style);
|
uint32_t map_size = _lv_style_get_mem_size(style);
|
||||||
uint8_t prop_size = sizeof(lv_style_property_t);
|
uint8_t prop_size = get_prop_size(prop);
|
||||||
if((prop & 0xF) < LV_STYLE_ID_COLOR) prop_size += sizeof(lv_style_int_t);
|
|
||||||
else if((prop & 0xF) < LV_STYLE_ID_OPA) prop_size += sizeof(lv_color_t);
|
|
||||||
else if((prop & 0xF) < LV_STYLE_ID_PTR) prop_size += sizeof(lv_opa_t);
|
|
||||||
else prop_size += sizeof(const void *);
|
|
||||||
|
|
||||||
/*Move the props to fill the space of the property to delete*/
|
/*Move the props to fill the space of the property to delete*/
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@@ -120,7 +121,7 @@ bool lv_style_remove_prop(lv_style_t * style, lv_style_property_t prop)
|
|||||||
style->map[i] = style->map[i + prop_size];
|
style->map[i] = style->map[i + prop_size];
|
||||||
}
|
}
|
||||||
|
|
||||||
style->map = lv_mem_realloc(style->map, map_size - prop_size);
|
style_resize(style, map_size - prop_size);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -256,7 +257,7 @@ void _lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_style_t ** new_classes = lv_mem_realloc(list->style_list, sizeof(lv_style_t *) * (list->style_cnt - 1));
|
lv_style_t ** new_classes = lv_mem_alloc(sizeof(lv_style_t *) * (list->style_cnt - 1));
|
||||||
LV_ASSERT_MEM(new_classes);
|
LV_ASSERT_MEM(new_classes);
|
||||||
if(new_classes == NULL) {
|
if(new_classes == NULL) {
|
||||||
LV_LOG_WARN("lv_style_list_remove_style: couldn't reallocate class list");
|
LV_LOG_WARN("lv_style_list_remove_style: couldn't reallocate class list");
|
||||||
@@ -270,6 +271,8 @@ void _lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lv_mem_free(list->style_list);
|
||||||
|
|
||||||
list->style_cnt--;
|
list->style_cnt--;
|
||||||
list->style_list = new_classes;
|
list->style_list = new_classes;
|
||||||
}
|
}
|
||||||
@@ -336,14 +339,9 @@ uint16_t _lv_style_get_mem_size(const lv_style_t * style)
|
|||||||
if(style->map == NULL) return 0;
|
if(style->map == NULL) return 0;
|
||||||
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
while(style->map[i] != _LV_STYLE_CLOSEING_PROP) {
|
uint8_t prop_id;
|
||||||
/*Go to the next property*/
|
while((prop_id = get_style_prop_id(style, i)) != _LV_STYLE_CLOSEING_PROP) {
|
||||||
if((style->map[i] & 0xF) < LV_STYLE_ID_COLOR) i += sizeof(lv_style_int_t);
|
i = get_next_prop_index(prop_id, i);
|
||||||
else if((style->map[i] & 0xF) < LV_STYLE_ID_OPA) i += sizeof(lv_color_t);
|
|
||||||
else if((style->map[i] & 0xF) < LV_STYLE_ID_PTR) i += sizeof(lv_opa_t);
|
|
||||||
else i += sizeof(const void *);
|
|
||||||
|
|
||||||
i += sizeof(lv_style_property_t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return i + sizeof(lv_style_property_t);
|
return i + sizeof(lv_style_property_t);
|
||||||
@@ -369,10 +367,10 @@ void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_in
|
|||||||
lv_style_attr_t attr_found;
|
lv_style_attr_t attr_found;
|
||||||
lv_style_attr_t attr_goal;
|
lv_style_attr_t attr_goal;
|
||||||
|
|
||||||
attr_found.full = *(style->map + id + 1);
|
attr_found = get_style_prop_attr(style, id);
|
||||||
attr_goal.full = (prop >> 8) & 0xFFU;
|
attr_goal = (prop >> 8) & 0xFFU;
|
||||||
|
|
||||||
if(attr_found.bits.state == attr_goal.bits.state) {
|
if(LV_STYLE_ATTR_GET_STATE(attr_found) == LV_STYLE_ATTR_GET_STATE(attr_goal)) {
|
||||||
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &value, sizeof(lv_style_int_t));
|
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &value, sizeof(lv_style_int_t));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -386,7 +384,7 @@ void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_in
|
|||||||
uint16_t size = _lv_style_get_mem_size(style);
|
uint16_t size = _lv_style_get_mem_size(style);
|
||||||
if(size == 0) size += end_mark_size;
|
if(size == 0) size += end_mark_size;
|
||||||
size += sizeof(lv_style_property_t) + sizeof(lv_style_int_t);
|
size += sizeof(lv_style_property_t) + sizeof(lv_style_int_t);
|
||||||
style->map = lv_mem_realloc(style->map, size);
|
style_resize(style, size);
|
||||||
LV_ASSERT_MEM(style->map);
|
LV_ASSERT_MEM(style->map);
|
||||||
if(style == NULL) return;
|
if(style == NULL) return;
|
||||||
|
|
||||||
@@ -415,10 +413,10 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
|
|||||||
lv_style_attr_t attr_found;
|
lv_style_attr_t attr_found;
|
||||||
lv_style_attr_t attr_goal;
|
lv_style_attr_t attr_goal;
|
||||||
|
|
||||||
attr_found.full = *(style->map + id + 1);
|
attr_found = get_style_prop_attr(style, id);
|
||||||
attr_goal.full = (prop >> 8) & 0xFFU;
|
attr_goal = (prop >> 8) & 0xFFU;
|
||||||
|
|
||||||
if(attr_found.bits.state == attr_goal.bits.state) {
|
if(LV_STYLE_ATTR_GET_STATE(attr_found) == LV_STYLE_ATTR_GET_STATE(attr_goal)) {
|
||||||
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &color, sizeof(lv_color_t));
|
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &color, sizeof(lv_color_t));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -433,7 +431,7 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
|
|||||||
if(size == 0) size += end_mark_size;
|
if(size == 0) size += end_mark_size;
|
||||||
|
|
||||||
size += sizeof(lv_style_property_t) + sizeof(lv_color_t);
|
size += sizeof(lv_style_property_t) + sizeof(lv_color_t);
|
||||||
style->map = lv_mem_realloc(style->map, size);
|
style_resize(style, size);
|
||||||
LV_ASSERT_MEM(style->map);
|
LV_ASSERT_MEM(style->map);
|
||||||
if(style == NULL) return;
|
if(style == NULL) return;
|
||||||
|
|
||||||
@@ -462,10 +460,10 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
|
|||||||
lv_style_attr_t attr_found;
|
lv_style_attr_t attr_found;
|
||||||
lv_style_attr_t attr_goal;
|
lv_style_attr_t attr_goal;
|
||||||
|
|
||||||
attr_found.full = *(style->map + id + 1);
|
attr_found = get_style_prop_attr(style, id);
|
||||||
attr_goal.full = (prop >> 8) & 0xFFU;
|
attr_goal = (prop >> 8) & 0xFFU;
|
||||||
|
|
||||||
if(attr_found.bits.state == attr_goal.bits.state) {
|
if(LV_STYLE_ATTR_GET_STATE(attr_found) == LV_STYLE_ATTR_GET_STATE(attr_goal)) {
|
||||||
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &opa, sizeof(lv_opa_t));
|
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &opa, sizeof(lv_opa_t));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -480,7 +478,7 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
|
|||||||
if(size == 0) size += end_mark_size;
|
if(size == 0) size += end_mark_size;
|
||||||
|
|
||||||
size += sizeof(lv_style_property_t) + sizeof(lv_opa_t);
|
size += sizeof(lv_style_property_t) + sizeof(lv_opa_t);
|
||||||
style->map = lv_mem_realloc(style->map, size);
|
style_resize(style, size);
|
||||||
LV_ASSERT_MEM(style->map);
|
LV_ASSERT_MEM(style->map);
|
||||||
if(style == NULL) return;
|
if(style == NULL) return;
|
||||||
|
|
||||||
@@ -509,10 +507,10 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
|
|||||||
lv_style_attr_t attr_found;
|
lv_style_attr_t attr_found;
|
||||||
lv_style_attr_t attr_goal;
|
lv_style_attr_t attr_goal;
|
||||||
|
|
||||||
attr_found.full = *(style->map + id + 1);
|
attr_found = get_style_prop_attr(style, id);
|
||||||
attr_goal.full = (prop >> 8) & 0xFFU;
|
attr_goal = (prop >> 8) & 0xFFU;
|
||||||
|
|
||||||
if(attr_found.bits.state == attr_goal.bits.state) {
|
if(LV_STYLE_ATTR_GET_STATE(attr_found) == LV_STYLE_ATTR_GET_STATE(attr_goal)) {
|
||||||
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &p, sizeof(const void *));
|
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &p, sizeof(const void *));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -527,7 +525,7 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
|
|||||||
if(size == 0) size += end_mark_size;
|
if(size == 0) size += end_mark_size;
|
||||||
|
|
||||||
size += sizeof(lv_style_property_t) + sizeof(const void *);
|
size += sizeof(lv_style_property_t) + sizeof(const void *);
|
||||||
style->map = lv_mem_realloc(style->map, size);
|
style_resize(style, size);
|
||||||
LV_ASSERT_MEM(style->map);
|
LV_ASSERT_MEM(style->map);
|
||||||
if(style == NULL) return;
|
if(style == NULL) return;
|
||||||
|
|
||||||
@@ -561,12 +559,12 @@ int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, vo
|
|||||||
else {
|
else {
|
||||||
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_style_int_t));
|
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_style_int_t));
|
||||||
lv_style_attr_t attr_act;
|
lv_style_attr_t attr_act;
|
||||||
attr_act.full = style->map[id + 1];
|
attr_act = get_style_prop_attr(style, id);
|
||||||
|
|
||||||
lv_style_attr_t attr_goal;
|
lv_style_attr_t attr_goal;
|
||||||
attr_goal.full = (prop >> 8) & 0xFF;
|
attr_goal = (prop >> 8) & 0xFF;
|
||||||
|
|
||||||
return attr_act.bits.state & attr_goal.bits.state;
|
return LV_STYLE_ATTR_GET_STATE(attr_act) & LV_STYLE_ATTR_GET_STATE(attr_goal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,12 +596,12 @@ int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, vo
|
|||||||
else {
|
else {
|
||||||
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_opa_t));
|
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_opa_t));
|
||||||
lv_style_attr_t attr_act;
|
lv_style_attr_t attr_act;
|
||||||
attr_act.full = style->map[id + 1];
|
attr_act = get_style_prop_attr(style, id);
|
||||||
|
|
||||||
lv_style_attr_t attr_goal;
|
lv_style_attr_t attr_goal;
|
||||||
attr_goal.full = (prop >> 8) & 0xFF;
|
attr_goal = (prop >> 8) & 0xFF;
|
||||||
|
|
||||||
return attr_act.bits.state & attr_goal.bits.state;
|
return LV_STYLE_ATTR_GET_STATE(attr_act) & LV_STYLE_ATTR_GET_STATE(attr_goal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,12 +630,12 @@ int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop,
|
|||||||
else {
|
else {
|
||||||
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_color_t));
|
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_color_t));
|
||||||
lv_style_attr_t attr_act;
|
lv_style_attr_t attr_act;
|
||||||
attr_act.full = style->map[id + 1];
|
attr_act = get_style_prop_attr(style, id);
|
||||||
|
|
||||||
lv_style_attr_t attr_goal;
|
lv_style_attr_t attr_goal;
|
||||||
attr_goal.full = (prop >> 8) & 0xFF;
|
attr_goal = (prop >> 8) & 0xFF;
|
||||||
|
|
||||||
return attr_act.bits.state & attr_goal.bits.state;
|
return LV_STYLE_ATTR_GET_STATE(attr_act) & LV_STYLE_ATTR_GET_STATE(attr_goal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,12 +665,12 @@ int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, vo
|
|||||||
else {
|
else {
|
||||||
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(const void *));
|
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(const void *));
|
||||||
lv_style_attr_t attr_act;
|
lv_style_attr_t attr_act;
|
||||||
attr_act.full = style->map[id + 1];
|
attr_act = get_style_prop_attr(style, id);
|
||||||
|
|
||||||
lv_style_attr_t attr_goal;
|
lv_style_attr_t attr_goal;
|
||||||
attr_goal.full = (prop >> 8) & 0xFF;
|
attr_goal = (prop >> 8) & 0xFF;
|
||||||
|
|
||||||
return attr_act.bits.state & attr_goal.bits.state;
|
return LV_STYLE_ATTR_GET_STATE(attr_act) & LV_STYLE_ATTR_GET_STATE(attr_goal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -820,8 +818,8 @@ lv_res_t _lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop
|
|||||||
if(list->style_list == NULL) return LV_RES_INV;
|
if(list->style_list == NULL) return LV_RES_INV;
|
||||||
|
|
||||||
lv_style_attr_t attr;
|
lv_style_attr_t attr;
|
||||||
attr.full = prop >> 8;
|
attr = prop >> 8;
|
||||||
int16_t weight_goal = attr.full;
|
int16_t weight_goal = attr;
|
||||||
|
|
||||||
int16_t weight = -1;
|
int16_t weight = -1;
|
||||||
|
|
||||||
@@ -872,8 +870,8 @@ lv_res_t _lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t pr
|
|||||||
if(list->style_list == NULL) return LV_RES_INV;
|
if(list->style_list == NULL) return LV_RES_INV;
|
||||||
|
|
||||||
lv_style_attr_t attr;
|
lv_style_attr_t attr;
|
||||||
attr.full = prop >> 8;
|
attr = prop >> 8;
|
||||||
int16_t weight_goal = attr.full;
|
int16_t weight_goal = attr;
|
||||||
|
|
||||||
int16_t weight = -1;
|
int16_t weight = -1;
|
||||||
|
|
||||||
@@ -922,8 +920,8 @@ lv_res_t _lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop
|
|||||||
if(list->style_list == NULL) return LV_RES_INV;
|
if(list->style_list == NULL) return LV_RES_INV;
|
||||||
|
|
||||||
lv_style_attr_t attr;
|
lv_style_attr_t attr;
|
||||||
attr.full = prop >> 8;
|
attr = prop >> 8;
|
||||||
int16_t weight_goal = attr.full;
|
int16_t weight_goal = attr;
|
||||||
|
|
||||||
int16_t weight = -1;
|
int16_t weight = -1;
|
||||||
|
|
||||||
@@ -972,8 +970,8 @@ lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop
|
|||||||
if(list->style_list == NULL) return LV_RES_INV;
|
if(list->style_list == NULL) return LV_RES_INV;
|
||||||
|
|
||||||
lv_style_attr_t attr;
|
lv_style_attr_t attr;
|
||||||
attr.full = prop >> 8;
|
attr = prop >> 8;
|
||||||
int16_t weight_goal = attr.full;
|
int16_t weight_goal = attr;
|
||||||
|
|
||||||
int16_t weight = -1;
|
int16_t weight = -1;
|
||||||
|
|
||||||
@@ -1003,6 +1001,45 @@ lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop
|
|||||||
else return LV_RES_INV;
|
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
|
* STATIC FUNCTIONS
|
||||||
**********************/
|
**********************/
|
||||||
@@ -1023,40 +1060,36 @@ LV_ATTRIBUTE_FAST_MEM static inline int32_t get_property_index(const lv_style_t
|
|||||||
|
|
||||||
uint8_t id_to_find = prop & 0xFF;
|
uint8_t id_to_find = prop & 0xFF;
|
||||||
lv_style_attr_t attr;
|
lv_style_attr_t attr;
|
||||||
attr.full = (prop >> 8) & 0xFF;
|
attr = (prop >> 8) & 0xFF;
|
||||||
|
|
||||||
int16_t weight = -1;
|
int16_t weight = -1;
|
||||||
int16_t id_guess = -1;
|
int16_t id_guess = -1;
|
||||||
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
while(style->map[i] != _LV_STYLE_CLOSEING_PROP) {
|
|
||||||
if(style->map[i] == id_to_find) {
|
uint8_t prop_id;
|
||||||
|
while((prop_id = get_style_prop_id(style, i)) != _LV_STYLE_CLOSEING_PROP) {
|
||||||
|
if(prop_id == id_to_find) {
|
||||||
lv_style_attr_t attr_i;
|
lv_style_attr_t attr_i;
|
||||||
attr_i.full = style->map[i + 1];
|
attr_i = get_style_prop_attr(style, i);
|
||||||
|
|
||||||
/*If the state perfectly matches return this property*/
|
/*If the state perfectly matches return this property*/
|
||||||
if(attr_i.bits.state == attr.bits.state) {
|
if(LV_STYLE_ATTR_GET_STATE(attr_i) == LV_STYLE_ATTR_GET_STATE(attr)) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
/* Be sure the property not specifies other state than the requested.
|
/* Be sure the property not specifies other state than the requested.
|
||||||
* E.g. For HOVER+PRESS, HOVER only is OK, but HOVER+FOCUS not*/
|
* E.g. For HOVER+PRESS, HOVER only is OK, but HOVER+FOCUS not*/
|
||||||
else if((attr_i.bits.state & (~attr.bits.state)) == 0) {
|
else if((LV_STYLE_ATTR_GET_STATE(attr_i) & (~LV_STYLE_ATTR_GET_STATE(attr))) == 0) {
|
||||||
/* Use this property if it describes better the requested state than the current candidate.
|
/* Use this property if it describes better the requested state than the current candidate.
|
||||||
* E.g. for HOVER+FOCUS+PRESS prefer HOVER+FOCUS over FOCUS*/
|
* E.g. for HOVER+FOCUS+PRESS prefer HOVER+FOCUS over FOCUS*/
|
||||||
if(attr_i.bits.state > weight) {
|
if(LV_STYLE_ATTR_GET_STATE(attr_i) > weight) {
|
||||||
weight = attr_i.bits.state;
|
weight = LV_STYLE_ATTR_GET_STATE(attr_i);
|
||||||
id_guess = i;
|
id_guess = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Go to the next property*/
|
i = get_next_prop_index(prop_id, i);
|
||||||
if((style->map[i] & 0xF) < LV_STYLE_ID_COLOR) i += sizeof(lv_style_int_t);
|
|
||||||
else if((style->map[i] & 0xF) < LV_STYLE_ID_OPA) i += sizeof(lv_color_t);
|
|
||||||
else if((style->map[i] & 0xF) < LV_STYLE_ID_PTR) i += sizeof(lv_opa_t);
|
|
||||||
else i += sizeof(const void *);
|
|
||||||
|
|
||||||
i += sizeof(lv_style_property_t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return id_guess;
|
return id_guess;
|
||||||
@@ -1081,9 +1114,85 @@ static lv_style_t * get_alloc_local_style(lv_style_list_t * list)
|
|||||||
}
|
}
|
||||||
lv_style_init(local_style);
|
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);
|
_lv_style_list_add_style(list, local_style);
|
||||||
list->has_local = 1;
|
list->has_local = 1;
|
||||||
|
|
||||||
return local_style;
|
return local_style;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resizes a style map. Useful entry point for debugging.
|
||||||
|
* @param style pointer to the style to be resized.
|
||||||
|
* @param size new size
|
||||||
|
*/
|
||||||
|
static inline void style_resize(lv_style_t * style, size_t sz)
|
||||||
|
{
|
||||||
|
style->map = lv_mem_realloc(style->map, sz);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get style property in index.
|
||||||
|
* @param style pointer to style.
|
||||||
|
* @param idx index of the style in style->map
|
||||||
|
* @return property in style->map + idx
|
||||||
|
*/
|
||||||
|
static inline lv_style_property_t get_style_prop(const lv_style_t * style, size_t idx)
|
||||||
|
{
|
||||||
|
lv_style_property_t prop;
|
||||||
|
uint8_t * prop_p = (uint8_t *)∝
|
||||||
|
prop_p[0] = style->map[idx];
|
||||||
|
prop_p[1] = style->map[idx + 1];
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get style property id in index.
|
||||||
|
* @param style pointer to style.
|
||||||
|
* @param idx index of the style in style->map
|
||||||
|
* @return id of property in style->map + idx
|
||||||
|
*/
|
||||||
|
static inline uint8_t get_style_prop_id(const lv_style_t * style, size_t idx)
|
||||||
|
{
|
||||||
|
return get_style_prop(style, idx) & 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get style property attributes for index.
|
||||||
|
* @param style pointer to style.
|
||||||
|
* @param idx index of the style in style->map
|
||||||
|
* @return attribute of property in style->map + idx
|
||||||
|
*/
|
||||||
|
static inline uint8_t get_style_prop_attr(const lv_style_t * style, size_t idx)
|
||||||
|
{
|
||||||
|
return ((get_style_prop(style, idx) >> 8) & 0xFFU);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get property size.
|
||||||
|
* @param prop_id property id.
|
||||||
|
* @param idx index of the style in style->map
|
||||||
|
* @return attribute of property in style->map + idx
|
||||||
|
*/
|
||||||
|
static inline size_t get_prop_size(uint8_t prop_id)
|
||||||
|
{
|
||||||
|
prop_id &= 0xF;
|
||||||
|
size_t size = sizeof(lv_style_property_t);
|
||||||
|
if(prop_id < LV_STYLE_ID_COLOR) size += sizeof(lv_style_int_t);
|
||||||
|
else if(prop_id < LV_STYLE_ID_OPA) size += sizeof(lv_color_t);
|
||||||
|
else if(prop_id < LV_STYLE_ID_PTR) size += sizeof(lv_opa_t);
|
||||||
|
else size += sizeof(const void *);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get next property index, given current property and index.
|
||||||
|
* @param prop_id property id.
|
||||||
|
* @param idx index of the style in style->map
|
||||||
|
* @return index of next property in style->map
|
||||||
|
*/
|
||||||
|
static inline size_t get_next_prop_index(uint8_t prop_id, size_t idx)
|
||||||
|
{
|
||||||
|
return idx + get_prop_size(prop_id);
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ extern "C" {
|
|||||||
#include "../lv_misc/lv_area.h"
|
#include "../lv_misc/lv_area.h"
|
||||||
#include "../lv_misc/lv_anim.h"
|
#include "../lv_misc/lv_anim.h"
|
||||||
#include "../lv_misc/lv_types.h"
|
#include "../lv_misc/lv_types.h"
|
||||||
|
#include "../lv_misc/lv_debug.h"
|
||||||
#include "../lv_draw/lv_draw_blend.h"
|
#include "../lv_draw/lv_draw_blend.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
@@ -80,13 +81,10 @@ enum {
|
|||||||
|
|
||||||
typedef uint8_t lv_text_decor_t;
|
typedef uint8_t lv_text_decor_t;
|
||||||
|
|
||||||
typedef union {
|
typedef uint8_t lv_style_attr_t;
|
||||||
struct {
|
|
||||||
uint8_t state : 7; /* To which state the property refers to*/
|
#define LV_STYLE_ATTR_GET_INHERIT(f) ((f)&0x80)
|
||||||
uint8_t inherit : 1; /*1: The property can be inherited*/
|
#define LV_STYLE_ATTR_GET_STATE(f) ((f)&0x7F)
|
||||||
} bits;
|
|
||||||
uint8_t full;
|
|
||||||
} lv_style_attr_t;
|
|
||||||
|
|
||||||
#define LV_STYLE_ID_VALUE 0x0 /*max 9 pcs*/
|
#define LV_STYLE_ID_VALUE 0x0 /*max 9 pcs*/
|
||||||
#define LV_STYLE_ID_COLOR 0x9 /*max 3 pcs*/
|
#define LV_STYLE_ID_COLOR 0x9 /*max 3 pcs*/
|
||||||
@@ -101,7 +99,7 @@ enum {
|
|||||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_WIDTH, 0x0, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_WIDTH, 0x0, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_HEIGHT, 0x0, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_HEIGHT, 0x0, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_ANGLE, 0x0, LV_STYLE_ID_VALUE + 6, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_ANGLE, 0x0, LV_STYLE_ID_VALUE + 6, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_ZOOM, 0x0, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_ZOOM, 0x0, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_OPA_SCALE, 0x0, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT),
|
LV_STYLE_PROP_INIT(LV_STYLE_OPA_SCALE, 0x0, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT),
|
||||||
|
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_PAD_TOP, 0x1, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_PAD_TOP, 0x1, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||||
@@ -136,8 +134,8 @@ enum {
|
|||||||
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_OPA, 0x4, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_OPA, 0x4, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
|
||||||
|
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_WIDTH, 0x5, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_WIDTH, 0x5, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_OFS_X, 0x5, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_OFS_X, 0x5, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_OFS_Y, 0x5, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_OFS_Y, 0x5, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_SPREAD, 0x5, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_SPREAD, 0x5, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_BLEND_MODE, 0x5, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_BLEND_MODE, 0x5, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_COLOR, 0x5, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_COLOR, 0x5, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
|
||||||
@@ -193,12 +191,12 @@ enum {
|
|||||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PROP_6, 0xB, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PROP_6, 0xB, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PATH, 0xB, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PATH, 0xB, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
|
||||||
|
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_WIDTH, 0xC, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_WIDTH, 0xC, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_BORDER_WIDTH, 0xC, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_BORDER_WIDTH, 0xC, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_BORDER_WIDTH, 0xC, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_BORDER_WIDTH, 0xC, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_LINE_WIDTH, 0xC, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_LINE_WIDTH, 0xC, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_GRAD_COLOR, 0xC, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_GRAD_COLOR, 0xC, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
|
||||||
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_COLOR, 0xC, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_NONE),
|
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_COLOR, 0xC, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_NONE),
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef uint16_t lv_style_property_t;
|
typedef uint16_t lv_style_property_t;
|
||||||
@@ -541,6 +539,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);
|
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
|
* GLOBAL VARIABLES
|
||||||
@@ -559,9 +570,37 @@ lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop
|
|||||||
* lv_style_init(&my_style);
|
* lv_style_init(&my_style);
|
||||||
* lv_style_copy(&my_style, &style_to_copy);
|
* lv_style_copy(&my_style, &style_to_copy);
|
||||||
*/
|
*/
|
||||||
#define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_init(&name); lv_style_copy(&name, copy);
|
#define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_init(&name); lv_style_copy(&name, copy_p);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#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
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -36,9 +36,11 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
|||||||
lv_color_t color, lv_opa_t opa,
|
lv_color_t color, lv_opa_t opa,
|
||||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||||
|
|
||||||
|
#if LV_USE_BLEND_MODES
|
||||||
static void fill_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
static void fill_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||||
lv_color_t color, lv_opa_t opa,
|
lv_color_t color, lv_opa_t opa,
|
||||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_blend_mode_t mode);
|
const lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_blend_mode_t mode);
|
||||||
|
#endif
|
||||||
|
|
||||||
static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||||
@@ -49,17 +51,23 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
|||||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||||
|
|
||||||
|
#if LV_USE_BLEND_MODES
|
||||||
static void map_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
static void map_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_blend_mode_t mode);
|
const lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_blend_mode_t mode);
|
||||||
|
|
||||||
static inline lv_color_t color_blend_true_color_additive(lv_color_t fg, lv_color_t bg, lv_opa_t opa);
|
static inline lv_color_t color_blend_true_color_additive(lv_color_t fg, lv_color_t bg, lv_opa_t opa);
|
||||||
static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_color_t bg, lv_opa_t opa);
|
static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_color_t bg, lv_opa_t opa);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
#if LV_USE_GPU || LV_USE_GPU_STM32_DMA2D
|
||||||
|
LV_ATTRIBUTE_DMA static lv_color_t blend_buf[LV_HOR_RES_MAX];
|
||||||
|
#endif
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
@@ -163,9 +171,11 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_
|
|||||||
else if(mode == LV_BLEND_MODE_NORMAL) {
|
else if(mode == LV_BLEND_MODE_NORMAL) {
|
||||||
fill_normal(disp_area, disp_buf, &draw_area, color, opa, mask, mask_res);
|
fill_normal(disp_area, disp_buf, &draw_area, color, opa, mask, mask_res);
|
||||||
}
|
}
|
||||||
|
#if LV_USE_BLEND_MODES
|
||||||
else {
|
else {
|
||||||
fill_blended(disp_area, disp_buf, &draw_area, color, opa, mask, mask_res, mode);
|
fill_blended(disp_area, disp_buf, &draw_area, color, opa, mask, mask_res, mode);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -226,9 +236,11 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a
|
|||||||
else if(mode == LV_BLEND_MODE_NORMAL) {
|
else if(mode == LV_BLEND_MODE_NORMAL) {
|
||||||
map_normal(disp_area, disp_buf, &draw_area, map_area, map_buf, opa, mask, mask_res);
|
map_normal(disp_area, disp_buf, &draw_area, map_area, map_buf, opa, mask, mask_res);
|
||||||
}
|
}
|
||||||
|
#if LV_USE_BLEND_MODES
|
||||||
else {
|
else {
|
||||||
map_blended(disp_area, disp_buf, &draw_area, map_area, map_buf, opa, mask, mask_res, mode);
|
map_blended(disp_area, disp_buf, &draw_area, map_area, map_buf, opa, mask, mask_res, mode);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -267,8 +279,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(y = draw_area->y1; y <= draw_area->y2; y++) {
|
||||||
for(x = draw_area->x1; x <= draw_area->x2; x++) {
|
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,
|
if(mask_tmp[x]) {
|
||||||
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
|
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;
|
mask_tmp += draw_area_w;
|
||||||
}
|
}
|
||||||
@@ -336,7 +350,6 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
|||||||
else {
|
else {
|
||||||
#if LV_USE_GPU
|
#if LV_USE_GPU
|
||||||
if(disp->driver.gpu_blend_cb && lv_area_get_size(draw_area) > GPU_SIZE_LIMIT) {
|
if(disp->driver.gpu_blend_cb && lv_area_get_size(draw_area) > GPU_SIZE_LIMIT) {
|
||||||
static lv_color_t blend_buf[LV_HOR_RES_MAX];
|
|
||||||
for(x = 0; x < draw_area_w ; x++) blend_buf[x].full = color.full;
|
for(x = 0; x < draw_area_w ; x++) blend_buf[x].full = color.full;
|
||||||
|
|
||||||
for(y = draw_area->y1; y <= draw_area->y2; y++) {
|
for(y = draw_area->y1; y <= draw_area->y2; y++) {
|
||||||
@@ -350,7 +363,6 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
|||||||
|
|
||||||
#if LV_USE_GPU_STM32_DMA2D
|
#if LV_USE_GPU_STM32_DMA2D
|
||||||
if(lv_area_get_size(draw_area) >= 240) {
|
if(lv_area_get_size(draw_area) >= 240) {
|
||||||
static lv_color_t blend_buf[LV_HOR_RES_MAX] = {0};
|
|
||||||
if(blend_buf[0].full != color.full) lv_color_fill(blend_buf, color, LV_HOR_RES_MAX);
|
if(blend_buf[0].full != color.full) lv_color_fill(blend_buf, color, LV_HOR_RES_MAX);
|
||||||
|
|
||||||
lv_coord_t line_h = LV_HOR_RES_MAX / draw_area_w;
|
lv_coord_t line_h = LV_HOR_RES_MAX / draw_area_w;
|
||||||
@@ -511,7 +523,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LV_USE_BLEND_MODES
|
||||||
/**
|
/**
|
||||||
* Fill an area with a color but apply blending algorithms
|
* Fill an area with a color but apply blending algorithms
|
||||||
* @param disp_area the current display area (destination area)
|
* @param disp_area the current display area (destination area)
|
||||||
@@ -602,6 +614,7 @@ static void fill_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||||
@@ -643,8 +656,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(y = draw_area->y1; y <= draw_area->y2; y++) {
|
||||||
for(x = draw_area->x1; x <= draw_area->x2; x++) {
|
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],
|
if(mask_tmp[x]) {
|
||||||
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
|
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;
|
mask_tmp += draw_area_w;
|
||||||
map_buf_tmp += map_w;
|
map_buf_tmp += map_w;
|
||||||
@@ -839,7 +854,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if LV_USE_BLEND_MODES
|
||||||
static void map_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
static void map_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_blend_mode_t mode)
|
const lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_blend_mode_t mode)
|
||||||
@@ -990,3 +1005,4 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co
|
|||||||
|
|
||||||
return lv_color_mix(fg, bg, opa);
|
return lv_color_mix(fg, bg, opa);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -26,8 +26,10 @@ extern "C" {
|
|||||||
**********************/
|
**********************/
|
||||||
enum {
|
enum {
|
||||||
LV_BLEND_MODE_NORMAL,
|
LV_BLEND_MODE_NORMAL,
|
||||||
|
#if LV_USE_BLEND_MODES
|
||||||
LV_BLEND_MODE_ADDITIVE,
|
LV_BLEND_MODE_ADDITIVE,
|
||||||
LV_BLEND_MODE_SUBTRACTIVE,
|
LV_BLEND_MODE_SUBTRACTIVE,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef uint8_t lv_blend_mode_t;
|
typedef uint8_t lv_blend_mode_t;
|
||||||
|
|||||||
@@ -407,7 +407,6 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*Build the image and a mask line-by-line*/
|
|
||||||
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : lv_area_get_size(&draw_area);
|
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : lv_area_get_size(&draw_area);
|
||||||
lv_color_t * map2 = _lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
|
lv_color_t * map2 = _lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
|
||||||
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
|
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
|
||||||
@@ -420,7 +419,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
|||||||
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
|
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
|
||||||
mask_buf[px_i] = px_opa;
|
mask_buf[px_i] = px_opa;
|
||||||
if(px_opa) {
|
if(px_opa) {
|
||||||
#if LV_COLOR_DEPTH == 8
|
#if LV_COLOR_DEPTH == 8 || LV_COLOR_DEPTH == 1
|
||||||
map2[px_i].full = map_px[0];
|
map2[px_i].full = map_px[0];
|
||||||
#elif LV_COLOR_DEPTH == 16
|
#elif LV_COLOR_DEPTH == 16
|
||||||
map2[px_i].full = map_px[0] + (map_px[1] << 8);
|
map2[px_i].full = map_px[0] + (map_px[1] << 8);
|
||||||
@@ -458,9 +457,9 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
|||||||
/*Most complicated case: transform or other mask or chroma keyed*/
|
/*Most complicated case: transform or other mask or chroma keyed*/
|
||||||
else {
|
else {
|
||||||
/*Build the image and a mask line-by-line*/
|
/*Build the image and a mask line-by-line*/
|
||||||
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : lv_area_get_size(&draw_area);
|
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : lv_area_get_size(&draw_area);
|
||||||
lv_color_t * map2 = _lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
|
lv_color_t * map2 = _lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
|
||||||
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
|
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
|
||||||
|
|
||||||
#if LV_USE_IMG_TRANSFORM
|
#if LV_USE_IMG_TRANSFORM
|
||||||
lv_img_transform_dsc_t trans_dsc;
|
lv_img_transform_dsc_t trans_dsc;
|
||||||
@@ -548,7 +547,9 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
|||||||
mask_buf[px_i] = 0xFF;
|
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];
|
c.full = map_px[0];
|
||||||
#elif LV_COLOR_DEPTH == 16
|
#elif LV_COLOR_DEPTH == 16
|
||||||
c.full = map_px[0] + (map_px[1] << 8);
|
c.full = map_px[0] + (map_px[1] << 8);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "../lv_hal/lv_hal_disp.h"
|
#include "../lv_hal/lv_hal_disp.h"
|
||||||
#include "../lv_core/lv_refr.h"
|
#include "../lv_core/lv_refr.h"
|
||||||
#include "../lv_misc/lv_bidi.h"
|
#include "../lv_misc/lv_bidi.h"
|
||||||
#include "../lv_core/lv_debug.h"
|
#include "../lv_misc/lv_debug.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
@@ -206,26 +206,26 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
|||||||
|
|
||||||
lv_opa_t opa = dsc->opa;
|
lv_opa_t opa = dsc->opa;
|
||||||
|
|
||||||
uint16_t sel_start = dsc->sel_start;
|
uint32_t sel_start = dsc->sel_start;
|
||||||
uint16_t sel_end = dsc->sel_end;
|
uint32_t sel_end = dsc->sel_end;
|
||||||
if(sel_start > sel_end) {
|
if(sel_start > sel_end) {
|
||||||
uint16_t tmp = sel_start;
|
uint32_t tmp = sel_start;
|
||||||
sel_start = sel_end;
|
sel_start = sel_end;
|
||||||
sel_end = tmp;
|
sel_end = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_draw_line_dsc_t line_dsc;
|
lv_draw_line_dsc_t line_dsc;
|
||||||
|
dsc->decor = LV_TEXT_DECOR_UNDERLINE;
|
||||||
if((dsc->decor & LV_TEXT_DECOR_UNDERLINE) || (dsc->decor & LV_TEXT_DECOR_STRIKETHROUGH)) {
|
if((dsc->decor & LV_TEXT_DECOR_UNDERLINE) || (dsc->decor & LV_TEXT_DECOR_STRIKETHROUGH)) {
|
||||||
lv_draw_line_dsc_init(&line_dsc);
|
lv_draw_line_dsc_init(&line_dsc);
|
||||||
line_dsc.color = dsc->color;
|
line_dsc.color = dsc->color;
|
||||||
line_dsc.width = (dsc->font->line_height + 5) / 10; /*+5 for rounding*/
|
line_dsc.width = font->underline_thickness;
|
||||||
line_dsc.opa = dsc->opa;
|
line_dsc.opa = dsc->opa;
|
||||||
line_dsc.blend_mode = dsc->blend_mode;
|
line_dsc.blend_mode = dsc->blend_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_state_t cmd_state = CMD_STATE_WAIT;
|
cmd_state_t cmd_state = CMD_STATE_WAIT;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint16_t par_start = 0;
|
uint32_t par_start = 0;
|
||||||
lv_color_t recolor;
|
lv_color_t recolor;
|
||||||
int32_t letter_w;
|
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
|
#endif
|
||||||
|
|
||||||
while(i < line_end - line_start) {
|
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(sel_start != 0xFFFF && sel_end != 0xFFFF) {
|
||||||
#if LV_USE_BIDI
|
#if LV_USE_BIDI
|
||||||
logical_char_pos = _lv_txt_encoded_get_char_id(txt, line_start);
|
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);
|
logical_char_pos += _lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, dsc->bidi_dir, t, NULL);
|
||||||
#else
|
#else
|
||||||
logical_char_pos = _lv_txt_encoded_get_char_id(txt, line_start + i);
|
logical_char_pos = _lv_txt_encoded_get_char_id(txt, line_start + i);
|
||||||
@@ -342,7 +342,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
|||||||
lv_point_t p1;
|
lv_point_t p1;
|
||||||
lv_point_t p2;
|
lv_point_t p2;
|
||||||
p1.x = pos_x_start;
|
p1.x = pos_x_start;
|
||||||
p1.y = pos.y + dsc->font->line_height - dsc->font->base_line + line_dsc.width / 2 + 1;
|
p1.y = pos.y + dsc->font->line_height - dsc->font->base_line - font->underline_position;
|
||||||
p2.x = pos.x;
|
p2.x = pos.x;
|
||||||
p2.y = p1.y;
|
p2.y = p1.y;
|
||||||
lv_draw_line(&p1, &p2, mask, &line_dsc);
|
lv_draw_line(&p1, &p2, mask, &line_dsc);
|
||||||
@@ -420,7 +420,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Don't draw anything if the character is empty. E.g. space */
|
/* Don't draw anything if the character is empty. E.g. space */
|
||||||
if((g.box_h == 0) && (g.box_w == 0)) return;
|
if((g.box_h == 0) || (g.box_w == 0)) return;
|
||||||
|
|
||||||
int32_t pos_x = pos_p->x + g.ofs_x;
|
int32_t pos_x = pos_p->x + g.ofs_x;
|
||||||
int32_t pos_y = pos_p->y + (font_p->line_height - font_p->base_line) - g.box_h - g.ofs_y;
|
int32_t pos_y = pos_p->y + (font_p->line_height - font_p->base_line) - g.box_h - g.ofs_y;
|
||||||
@@ -607,6 +607,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_
|
|||||||
static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||||
{
|
{
|
||||||
|
#if LV_USE_FONT_SUBPX
|
||||||
const uint8_t * bpp_opa_table;
|
const uint8_t * bpp_opa_table;
|
||||||
uint32_t bitmask_init;
|
uint32_t bitmask_init;
|
||||||
uint32_t bitmask;
|
uint32_t bitmask;
|
||||||
@@ -758,7 +759,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*Go to the next column*/
|
/*Go to the next column*/
|
||||||
if(col_bit < (int32_t) (8 - bpp)) {
|
if(col_bit < (int32_t)(8 - bpp)) {
|
||||||
col_bit += bpp;
|
col_bit += bpp;
|
||||||
bitmask = bitmask >> bpp;
|
bitmask = bitmask >> bpp;
|
||||||
}
|
}
|
||||||
@@ -806,6 +807,9 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
|||||||
|
|
||||||
_lv_mem_buf_release(mask_buf);
|
_lv_mem_buf_release(mask_buf);
|
||||||
_lv_mem_buf_release(color_buf);
|
_lv_mem_buf_release(color_buf);
|
||||||
|
#else
|
||||||
|
LV_LOG_WARN("Can't draw sub-pixel rendered letter because LV_USE_FONT_SUBPX == 0 in lv_conf.h");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ typedef struct {
|
|||||||
lv_opa_t opa;
|
lv_opa_t opa;
|
||||||
lv_style_int_t line_space;
|
lv_style_int_t line_space;
|
||||||
lv_style_int_t letter_space;
|
lv_style_int_t letter_space;
|
||||||
uint16_t sel_start;
|
uint32_t sel_start;
|
||||||
uint16_t sel_end;
|
uint32_t sel_end;
|
||||||
lv_coord_t ofs_x;
|
lv_coord_t ofs_x;
|
||||||
lv_coord_t ofs_y;
|
lv_coord_t ofs_y;
|
||||||
lv_bidi_dir_t bidi_dir;
|
lv_bidi_dir_t bidi_dir;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include "lv_draw_mask.h"
|
#include "lv_draw_mask.h"
|
||||||
#include "../lv_misc/lv_math.h"
|
#include "../lv_misc/lv_math.h"
|
||||||
#include "../lv_misc/lv_log.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"
|
#include "../lv_misc/lv_gc.h"
|
||||||
|
|
||||||
#if defined(LV_GC_INCLUDE)
|
#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 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_x absolute X coordinate where the line to calculate start
|
||||||
* @param abs_y absolute Y 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)
|
* @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_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_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
|
* - `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.
|
*Initialize a line mask from a point and an angle.
|
||||||
* @param param pointer to a `lv_draw_mask_param_t` to initialize
|
* @param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||||
* @param px X coordiante of a point of the line
|
* @param px X coordinate of a point of the line
|
||||||
* @param py X coordiante of a point of the line
|
* @param py X coordinate of a point of the line
|
||||||
* @param angle right 0 deg, bottom: 90
|
* @param angle right 0 deg, bottom: 90
|
||||||
* @param side and element of `lv_draw_mask_line_side_t` to describe which side to keep.
|
* @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
|
* 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 param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||||
* @param rect coordinates of the rectangle to affect (absolute coordinates)
|
* @param rect coordinates of the rectangle to affect (absolute coordinates)
|
||||||
* @param radius radius of the rectangle
|
* @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)
|
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_x absolute X coordinate where the line to calculate start
|
||||||
* @param abs_y absolute Y 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)
|
* @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_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_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
|
* - `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.
|
*Initialize a line mask from a point and an angle.
|
||||||
* @param param pointer to a `lv_draw_mask_param_t` to initialize
|
* @param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||||
* @param px X coordiante of a point of the line
|
* @param px X coordinate of a point of the line
|
||||||
* @param py X coordiante of a point of the line
|
* @param py X coordinate of a point of the line
|
||||||
* @param angle right 0 deg, bottom: 90
|
* @param angle right 0 deg, bottom: 90
|
||||||
* @param side and element of `lv_draw_mask_line_side_t` to describe which side to keep.
|
* @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
|
* 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 param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||||
* @param rect coordinates of the rectangle to affect (absolute coordinates)
|
* @param rect coordinates of the rectangle to affect (absolute coordinates)
|
||||||
* @param radius radius of the rectangle
|
* @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);
|
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_draw_mask.h"
|
||||||
#include "../lv_misc/lv_math.h"
|
#include "../lv_misc/lv_math.h"
|
||||||
#include "../lv_core/lv_refr.h"
|
#include "../lv_core/lv_refr.h"
|
||||||
#include "../lv_core/lv_debug.h"
|
#include "../lv_misc/lv_debug.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
@@ -30,8 +30,10 @@
|
|||||||
LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||||
LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip,
|
LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip,
|
||||||
lv_draw_rect_dsc_t * dsc);
|
lv_draw_rect_dsc_t * dsc);
|
||||||
static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
|
||||||
LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i);
|
#if LV_USE_OUTLINE
|
||||||
|
static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||||
|
#endif
|
||||||
#if LV_USE_SHADOW
|
#if LV_USE_SHADOW
|
||||||
LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip,
|
LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip,
|
||||||
lv_draw_rect_dsc_t * dsc);
|
lv_draw_rect_dsc_t * dsc);
|
||||||
@@ -39,8 +41,17 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
|
|||||||
lv_coord_t r);
|
lv_coord_t r);
|
||||||
LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, uint16_t * sh_ups_buf);
|
LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, uint16_t * sh_ups_buf);
|
||||||
#endif
|
#endif
|
||||||
static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
|
||||||
static void draw_value(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
#if LV_USE_PATTERN
|
||||||
|
static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_VALUE_STR
|
||||||
|
static void draw_value_str(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||||
|
#endif
|
||||||
|
static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * area_outer, const lv_area_t * clip,
|
||||||
|
lv_coord_t radius, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||||
|
LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
@@ -95,10 +106,19 @@ void lv_draw_rect(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
draw_bg(coords, clip, dsc);
|
draw_bg(coords, clip, dsc);
|
||||||
|
|
||||||
|
#if LV_USE_PATTERN
|
||||||
draw_pattern(coords, clip, dsc);
|
draw_pattern(coords, clip, dsc);
|
||||||
|
#endif
|
||||||
draw_border(coords, clip, dsc);
|
draw_border(coords, clip, dsc);
|
||||||
draw_value(coords, clip, dsc);
|
|
||||||
|
#if LV_USE_VALUE_STR
|
||||||
|
draw_value_str(coords, clip, dsc);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_OUTLINE
|
||||||
draw_outline(coords, clip, dsc);
|
draw_outline(coords, clip, dsc);
|
||||||
|
#endif
|
||||||
|
|
||||||
LV_ASSERT_MEM_INTEGRITY();
|
LV_ASSERT_MEM_INTEGRITY();
|
||||||
}
|
}
|
||||||
@@ -185,10 +205,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*/
|
/*Create a mask if there is a radius*/
|
||||||
lv_opa_t * mask_buf = _lv_mem_buf_get(draw_area_w);
|
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();
|
uint16_t other_mask_cnt = lv_draw_mask_get_cnt();
|
||||||
bool simple_mode = true;
|
bool simple_mode = true;
|
||||||
if(other_mask_cnt) simple_mode = false;
|
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;
|
int16_t mask_rout_id = LV_MASK_ID_INV;
|
||||||
|
|
||||||
@@ -201,7 +224,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;
|
if(rout > short_side >> 1) rout = short_side >> 1;
|
||||||
|
|
||||||
/*Most simple case: just a plain rectangle*/
|
/*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,
|
_lv_blend_fill(clip, &coords_bg,
|
||||||
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
|
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
|
||||||
dsc->bg_blend_mode);
|
dsc->bg_blend_mode);
|
||||||
@@ -222,7 +245,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
|||||||
|
|
||||||
lv_color_t * grad_map = NULL;
|
lv_color_t * grad_map = NULL;
|
||||||
/*In case of horizontal gradient pre-compute a line with a gradient*/
|
/*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));
|
grad_map = _lv_mem_buf_get(coords_w * sizeof(lv_color_t));
|
||||||
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
@@ -267,12 +290,12 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*Get the current line color*/
|
/*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);
|
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
|
/* 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 &&
|
if(simple_mode && split &&
|
||||||
(y < coords_bg.y1 + rout + 1 ||
|
(y < coords_bg.y1 + rout + 1 ||
|
||||||
y > coords_bg.y2 - rout - 1)) {
|
y > coords_bg.y2 - rout - 1)) {
|
||||||
@@ -288,7 +311,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);
|
grad_color, mask_buf, mask_res, opa2, dsc->bg_blend_mode);
|
||||||
|
|
||||||
/*Center part*/
|
/*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.x1 = coords_bg.x1 + rout;
|
||||||
fill_area2.x2 = coords_bg.x2 - rout;
|
fill_area2.x2 = coords_bg.x2 - rout;
|
||||||
_lv_blend_fill(clip, &fill_area2,
|
_lv_blend_fill(clip, &fill_area2,
|
||||||
@@ -307,10 +330,10 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
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);
|
_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,
|
_lv_blend_fill(clip, &fill_area,
|
||||||
grad_color, mask_buf, mask_res, opa2, dsc->bg_blend_mode);
|
grad_color, mask_buf, mask_res, opa2, dsc->bg_blend_mode);
|
||||||
}
|
}
|
||||||
@@ -323,7 +346,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
|||||||
fill_area.y2++;
|
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*/
|
/*Central part*/
|
||||||
fill_area.x1 = coords_bg.x1 + rout;
|
fill_area.x1 = coords_bg.x1 + rout;
|
||||||
fill_area.x2 = coords_bg.x2 - rout;
|
fill_area.x2 = coords_bg.x2 - rout;
|
||||||
@@ -367,41 +390,6 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
|||||||
if(dsc->border_width == 0) return;
|
if(dsc->border_width == 0) return;
|
||||||
if(dsc->border_side == LV_BORDER_SIDE_NONE) return;
|
if(dsc->border_side == LV_BORDER_SIDE_NONE) return;
|
||||||
|
|
||||||
lv_opa_t opa = dsc->border_opa;
|
|
||||||
|
|
||||||
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
|
||||||
|
|
||||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
|
||||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
|
||||||
|
|
||||||
/* Get clipped fill area which is the real draw area.
|
|
||||||
* It is always the same or inside `fill_area` */
|
|
||||||
lv_area_t draw_area;
|
|
||||||
bool is_common;
|
|
||||||
is_common = _lv_area_intersect(&draw_area, coords, clip);
|
|
||||||
if(is_common == false) return;
|
|
||||||
|
|
||||||
const lv_area_t * disp_area = &vdb->area;
|
|
||||||
|
|
||||||
/* Now `draw_area` has absolute coordinates.
|
|
||||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
|
||||||
draw_area.x1 -= disp_area->x1;
|
|
||||||
draw_area.y1 -= disp_area->y1;
|
|
||||||
draw_area.x2 -= disp_area->x1;
|
|
||||||
draw_area.y2 -= disp_area->y1;
|
|
||||||
|
|
||||||
int32_t draw_area_w = lv_area_get_width(&draw_area);
|
|
||||||
|
|
||||||
/*Create a mask if there is a radius*/
|
|
||||||
lv_opa_t * mask_buf = _lv_mem_buf_get(draw_area_w);
|
|
||||||
|
|
||||||
uint8_t other_mask_cnt = lv_draw_mask_get_cnt();
|
|
||||||
bool simple_mode = true;
|
|
||||||
if(other_mask_cnt) simple_mode = false;
|
|
||||||
else if(dsc->border_side != LV_BORDER_SIDE_FULL) simple_mode = false;
|
|
||||||
|
|
||||||
int16_t mask_rout_id = LV_MASK_ID_INV;
|
|
||||||
|
|
||||||
int32_t coords_w = lv_area_get_width(coords);
|
int32_t coords_w = lv_area_get_width(coords);
|
||||||
int32_t coords_h = lv_area_get_height(coords);
|
int32_t coords_h = lv_area_get_height(coords);
|
||||||
|
|
||||||
@@ -410,140 +398,80 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
|||||||
int32_t short_side = LV_MATH_MIN(coords_w, coords_h);
|
int32_t short_side = LV_MATH_MIN(coords_w, coords_h);
|
||||||
if(rout > short_side >> 1) rout = short_side >> 1;
|
if(rout > short_side >> 1) rout = short_side >> 1;
|
||||||
|
|
||||||
/*Get the outer area*/
|
|
||||||
lv_draw_mask_radius_param_t mask_rout_param;
|
|
||||||
if(rout > 0) {
|
|
||||||
lv_draw_mask_radius_init(&mask_rout_param, coords, rout, false);
|
|
||||||
mask_rout_id = lv_draw_mask_add(&mask_rout_param, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Get the inner radius*/
|
|
||||||
int32_t rin = rout - dsc->border_width;
|
|
||||||
if(rin < 0) rin = 0;
|
|
||||||
|
|
||||||
/*Get the inner area*/
|
/*Get the inner area*/
|
||||||
lv_area_t area_small;
|
lv_area_t area_inner;
|
||||||
lv_area_copy(&area_small, coords);
|
lv_area_copy(&area_inner, coords);
|
||||||
area_small.x1 += ((dsc->border_side & LV_BORDER_SIDE_LEFT) ? dsc->border_width : - (dsc->border_width + rout));
|
area_inner.x1 += ((dsc->border_side & LV_BORDER_SIDE_LEFT) ? dsc->border_width : - (dsc->border_width + rout));
|
||||||
area_small.x2 -= ((dsc->border_side & LV_BORDER_SIDE_RIGHT) ? dsc->border_width : - (dsc->border_width + rout));
|
area_inner.x2 -= ((dsc->border_side & LV_BORDER_SIDE_RIGHT) ? dsc->border_width : - (dsc->border_width + rout));
|
||||||
area_small.y1 += ((dsc->border_side & LV_BORDER_SIDE_TOP) ? dsc->border_width : - (dsc->border_width + rout));
|
area_inner.y1 += ((dsc->border_side & LV_BORDER_SIDE_TOP) ? dsc->border_width : - (dsc->border_width + rout));
|
||||||
area_small.y2 -= ((dsc->border_side & LV_BORDER_SIDE_BOTTOM) ? dsc->border_width : - (dsc->border_width + rout));
|
area_inner.y2 -= ((dsc->border_side & LV_BORDER_SIDE_BOTTOM) ? dsc->border_width : - (dsc->border_width + rout));
|
||||||
|
|
||||||
/*Create inner the mask*/
|
if(dsc->border_side == LV_BORDER_SIDE_FULL) {
|
||||||
lv_draw_mask_radius_param_t mask_rin_param;
|
draw_full_border(&area_inner, coords, clip, dsc->radius, dsc->border_color, dsc->border_opa, dsc->border_blend_mode);
|
||||||
lv_draw_mask_radius_init(&mask_rin_param, &area_small, rout - dsc->border_width, true);
|
|
||||||
int16_t mask_rin_id = lv_draw_mask_add(&mask_rin_param, NULL);
|
|
||||||
|
|
||||||
int32_t corner_size = LV_MATH_MAX(rout, dsc->border_width - 1);
|
|
||||||
|
|
||||||
int32_t h;
|
|
||||||
lv_draw_mask_res_t mask_res;
|
|
||||||
lv_area_t fill_area;
|
|
||||||
|
|
||||||
lv_color_t color = dsc->border_color;
|
|
||||||
lv_blend_mode_t blend_mode = dsc->border_blend_mode;
|
|
||||||
|
|
||||||
/*Apply some optimization if there is no other mask*/
|
|
||||||
if(simple_mode) {
|
|
||||||
/*Draw the upper corner area*/
|
|
||||||
int32_t upper_corner_end = coords->y1 - disp_area->y1 + corner_size;
|
|
||||||
upper_corner_end = LV_MATH_MIN(upper_corner_end, draw_area.y2);
|
|
||||||
fill_area.x1 = coords->x1;
|
|
||||||
fill_area.x2 = coords->x2;
|
|
||||||
fill_area.y1 = disp_area->y1 + draw_area.y1;
|
|
||||||
fill_area.y2 = fill_area.y1;
|
|
||||||
for(h = draw_area.y1; h <= upper_corner_end; h++) {
|
|
||||||
_lv_memset_ff(mask_buf, draw_area_w);
|
|
||||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
|
||||||
|
|
||||||
lv_area_t fill_area2;
|
|
||||||
fill_area2.y1 = fill_area.y1;
|
|
||||||
fill_area2.y2 = fill_area.y2;
|
|
||||||
|
|
||||||
fill_area2.x1 = coords->x1;
|
|
||||||
fill_area2.x2 = coords->x1 + rout - 1;
|
|
||||||
|
|
||||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
|
||||||
|
|
||||||
/*Draw the top horizontal line*/
|
|
||||||
if(fill_area2.y2 < coords->y1 + dsc->border_width) {
|
|
||||||
fill_area2.x1 = coords->x1 + rout;
|
|
||||||
fill_area2.x2 = coords->x2 - rout;
|
|
||||||
|
|
||||||
_lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
fill_area2.x1 = coords->x2 - rout + 1;
|
|
||||||
fill_area2.x2 = coords->x2;
|
|
||||||
|
|
||||||
int32_t mask_ofs = (coords->x2 - rout + 1) - (vdb->area.x1 + draw_area.x1);
|
|
||||||
if(mask_ofs < 0) mask_ofs = 0;
|
|
||||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
|
||||||
|
|
||||||
fill_area.y1++;
|
|
||||||
fill_area.y2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Draw the lower corner area */
|
|
||||||
int32_t lower_corner_end = coords->y2 - disp_area->y1 - corner_size;
|
|
||||||
lower_corner_end = LV_MATH_MAX(lower_corner_end, draw_area.y1);
|
|
||||||
if(lower_corner_end <= upper_corner_end) lower_corner_end = upper_corner_end + 1;
|
|
||||||
fill_area.y1 = disp_area->y1 + lower_corner_end;
|
|
||||||
fill_area.y2 = fill_area.y1;
|
|
||||||
for(h = lower_corner_end; h <= draw_area.y2; h++) {
|
|
||||||
_lv_memset_ff(mask_buf, draw_area_w);
|
|
||||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
|
||||||
|
|
||||||
lv_area_t fill_area2;
|
|
||||||
fill_area2.x1 = coords->x1;
|
|
||||||
fill_area2.x2 = coords->x1 + rout - 1;
|
|
||||||
fill_area2.y1 = fill_area.y1;
|
|
||||||
fill_area2.y2 = fill_area.y2;
|
|
||||||
|
|
||||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
|
||||||
|
|
||||||
/*Draw the bottom horizontal line*/
|
|
||||||
if(fill_area2.y2 > coords->y2 - dsc->border_width) {
|
|
||||||
fill_area2.x1 = coords->x1 + rout;
|
|
||||||
fill_area2.x2 = coords->x2 - rout;
|
|
||||||
|
|
||||||
_lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
|
||||||
}
|
|
||||||
fill_area2.x1 = coords->x2 - rout + 1;
|
|
||||||
fill_area2.x2 = coords->x2;
|
|
||||||
|
|
||||||
int32_t mask_ofs = (coords->x2 - rout + 1) - (vdb->area.x1 + draw_area.x1);
|
|
||||||
if(mask_ofs < 0) mask_ofs = 0;
|
|
||||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
|
||||||
|
|
||||||
|
|
||||||
fill_area.y1++;
|
|
||||||
fill_area.y2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Draw the left vertical border part*/
|
|
||||||
fill_area.y1 = coords->y1 + corner_size + 1;
|
|
||||||
fill_area.y2 = coords->y2 - corner_size - 1;
|
|
||||||
|
|
||||||
fill_area.x1 = coords->x1;
|
|
||||||
fill_area.x2 = coords->x1 + dsc->border_width - 1;
|
|
||||||
_lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
|
||||||
|
|
||||||
/*Draw the right vertical border*/
|
|
||||||
fill_area.x1 = coords->x2 - dsc->border_width + 1;
|
|
||||||
fill_area.x2 = coords->x2;
|
|
||||||
|
|
||||||
_lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
|
||||||
}
|
}
|
||||||
/*Process line by line if there is other mask too*/
|
|
||||||
else {
|
else {
|
||||||
|
lv_opa_t opa = dsc->border_opa;
|
||||||
|
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
||||||
|
|
||||||
|
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||||
|
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||||
|
|
||||||
|
/* Get clipped fill area which is the real draw area.
|
||||||
|
* It is always the same or inside `fill_area` */
|
||||||
|
lv_area_t draw_area;
|
||||||
|
bool is_common;
|
||||||
|
is_common = _lv_area_intersect(&draw_area, coords, clip);
|
||||||
|
if(is_common == false) return;
|
||||||
|
|
||||||
|
const lv_area_t * disp_area = &vdb->area;
|
||||||
|
|
||||||
|
/* Now `draw_area` has absolute coordinates.
|
||||||
|
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||||
|
draw_area.x1 -= disp_area->x1;
|
||||||
|
draw_area.y1 -= disp_area->y1;
|
||||||
|
draw_area.x2 -= disp_area->x1;
|
||||||
|
draw_area.y2 -= disp_area->y1;
|
||||||
|
|
||||||
|
int32_t draw_area_w = lv_area_get_width(&draw_area);
|
||||||
|
|
||||||
|
/*Create a mask if there is a radius*/
|
||||||
|
lv_opa_t * mask_buf = _lv_mem_buf_get(draw_area_w);
|
||||||
|
|
||||||
|
/*Create mask for the outer area*/
|
||||||
|
int16_t mask_rout_id = LV_MASK_ID_INV;
|
||||||
|
lv_draw_mask_radius_param_t mask_rout_param;
|
||||||
|
if(rout > 0) {
|
||||||
|
lv_draw_mask_radius_init(&mask_rout_param, coords, rout, false);
|
||||||
|
mask_rout_id = lv_draw_mask_add(&mask_rout_param, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Create mask for the inner mask*/
|
||||||
|
int32_t rin = rout - dsc->border_width;
|
||||||
|
if(rin < 0) rin = 0;
|
||||||
|
lv_draw_mask_radius_param_t mask_rin_param;
|
||||||
|
lv_draw_mask_radius_init(&mask_rin_param, &area_inner, rout - dsc->border_width, true);
|
||||||
|
int16_t mask_rin_id = lv_draw_mask_add(&mask_rin_param, NULL);
|
||||||
|
|
||||||
|
int32_t corner_size = LV_MATH_MAX(rout, dsc->border_width - 1);
|
||||||
|
|
||||||
|
int32_t h;
|
||||||
|
lv_draw_mask_res_t mask_res;
|
||||||
|
lv_area_t fill_area;
|
||||||
|
|
||||||
|
lv_color_t color = dsc->border_color;
|
||||||
|
lv_blend_mode_t blend_mode = dsc->border_blend_mode;
|
||||||
|
|
||||||
fill_area.x1 = coords->x1;
|
fill_area.x1 = coords->x1;
|
||||||
fill_area.x2 = coords->x2;
|
fill_area.x2 = coords->x2;
|
||||||
fill_area.y1 = disp_area->y1 + draw_area.y1;
|
fill_area.y1 = disp_area->y1 + draw_area.y1;
|
||||||
fill_area.y2 = fill_area.y1;
|
fill_area.y2 = fill_area.y1;
|
||||||
|
|
||||||
|
uint32_t buf_ofs = 0;
|
||||||
if(dsc->border_side == LV_BORDER_SIDE_LEFT) fill_area.x2 = coords->x1 + corner_size;
|
if(dsc->border_side == LV_BORDER_SIDE_LEFT) fill_area.x2 = coords->x1 + corner_size;
|
||||||
else if(dsc->border_side == LV_BORDER_SIDE_RIGHT) fill_area.x1 = coords->x2 - corner_size;
|
else if(dsc->border_side == LV_BORDER_SIDE_RIGHT) {
|
||||||
|
fill_area.x1 = coords->x2 - corner_size;
|
||||||
|
buf_ofs = fill_area.x1 - coords->x1;
|
||||||
|
}
|
||||||
|
|
||||||
volatile bool top_only = false;
|
volatile bool top_only = false;
|
||||||
volatile bool bottom_only = false;
|
volatile bool bottom_only = false;
|
||||||
@@ -562,16 +490,16 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
|||||||
(bottom_only && fill_area.y1 >= coords->y2 - corner_size)) {
|
(bottom_only && fill_area.y1 >= coords->y2 - corner_size)) {
|
||||||
_lv_memset_ff(mask_buf, draw_area_w);
|
_lv_memset_ff(mask_buf, draw_area_w);
|
||||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||||
_lv_blend_fill(clip, &fill_area, color, mask_buf, mask_res, opa, blend_mode);
|
_lv_blend_fill(clip, &fill_area, color, mask_buf + buf_ofs, mask_res, opa, blend_mode);
|
||||||
}
|
}
|
||||||
fill_area.y1++;
|
fill_area.y1++;
|
||||||
fill_area.y2++;
|
fill_area.y2++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
lv_draw_mask_remove_id(mask_rin_id);
|
||||||
|
lv_draw_mask_remove_id(mask_rout_id);
|
||||||
|
_lv_mem_buf_release(mask_buf);
|
||||||
}
|
}
|
||||||
lv_draw_mask_remove_id(mask_rin_id);
|
|
||||||
lv_draw_mask_remove_id(mask_rout_id);
|
|
||||||
_lv_mem_buf_release(mask_buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i)
|
LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i)
|
||||||
@@ -1044,7 +972,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
|||||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||||
|
|
||||||
_lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
_lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||||
mask_res, LV_OPA_COVER, dsc->shadow_blend_mode);
|
mask_res, LV_OPA_COVER, dsc->shadow_blend_mode);
|
||||||
fa.y1++;
|
fa.y1++;
|
||||||
fa.y2++;
|
fa.y2++;
|
||||||
}
|
}
|
||||||
@@ -1108,7 +1036,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
|
|||||||
_lv_mem_buf_release(mask_line);
|
_lv_mem_buf_release(mask_line);
|
||||||
|
|
||||||
if(sw == 1) {
|
if(sw == 1) {
|
||||||
uint32_t i;
|
int32_t i;
|
||||||
lv_opa_t * res_buf = (lv_opa_t *)sh_buf;
|
lv_opa_t * res_buf = (lv_opa_t *)sh_buf;
|
||||||
for(i = 0; i < size * size; i++) {
|
for(i = 0; i < size * size; i++) {
|
||||||
res_buf[i] = (sh_buf[i] >> SHADOW_UPSACALE_SHIFT);
|
res_buf[i] = (sh_buf[i] >> SHADOW_UPSACALE_SHIFT);
|
||||||
@@ -1137,7 +1065,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
|
|||||||
|
|
||||||
shadow_blur_corner(size, sw, sh_buf);
|
shadow_blur_corner(size, sw, sh_buf);
|
||||||
}
|
}
|
||||||
uint32_t x;
|
int32_t x;
|
||||||
lv_opa_t * res_buf = (lv_opa_t *)sh_buf;
|
lv_opa_t * res_buf = (lv_opa_t *)sh_buf;
|
||||||
for(x = 0; x < size * size; x++) {
|
for(x = 0; x < size * size; x++) {
|
||||||
res_buf[x] = sh_buf[x];
|
res_buf[x] = sh_buf[x];
|
||||||
@@ -1219,6 +1147,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_OUTLINE
|
||||||
static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
|
static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
|
||||||
{
|
{
|
||||||
if(dsc->outline_opa <= LV_OPA_MIN) return;
|
if(dsc->outline_opa <= LV_OPA_MIN) return;
|
||||||
@@ -1228,10 +1157,6 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
|||||||
|
|
||||||
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
||||||
|
|
||||||
uint8_t other_mask_cnt = lv_draw_mask_get_cnt();
|
|
||||||
bool simple_mode = true;
|
|
||||||
if(other_mask_cnt) simple_mode = false;
|
|
||||||
|
|
||||||
/*Get the inner radius*/
|
/*Get the inner radius*/
|
||||||
lv_area_t area_inner;
|
lv_area_t area_inner;
|
||||||
lv_area_copy(&area_inner, coords);
|
lv_area_copy(&area_inner, coords);
|
||||||
@@ -1240,16 +1165,6 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
|||||||
area_inner.x2 += dsc->outline_pad;
|
area_inner.x2 += dsc->outline_pad;
|
||||||
area_inner.y2 += dsc->outline_pad;
|
area_inner.y2 += dsc->outline_pad;
|
||||||
|
|
||||||
int32_t inner_w = lv_area_get_width(&area_inner);
|
|
||||||
int32_t inner_h = lv_area_get_height(&area_inner);
|
|
||||||
|
|
||||||
int32_t rin = dsc->radius;
|
|
||||||
int32_t short_side = LV_MATH_MIN(inner_w, inner_h);
|
|
||||||
if(rin > short_side >> 1) rin = short_side >> 1;
|
|
||||||
|
|
||||||
/*Get the outer area*/
|
|
||||||
int32_t rout = rin + dsc->outline_width;
|
|
||||||
|
|
||||||
lv_area_t area_outer;
|
lv_area_t area_outer;
|
||||||
lv_area_copy(&area_outer, &area_inner);
|
lv_area_copy(&area_outer, &area_inner);
|
||||||
|
|
||||||
@@ -1258,165 +1173,13 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
|||||||
area_outer.y1 -= dsc->outline_width;
|
area_outer.y1 -= dsc->outline_width;
|
||||||
area_outer.y2 += dsc->outline_width;
|
area_outer.y2 += dsc->outline_width;
|
||||||
|
|
||||||
int32_t coords_out_w = lv_area_get_width(&area_outer);
|
draw_full_border(&area_inner, &area_outer, clip, dsc->radius, dsc->outline_color, dsc->outline_opa,
|
||||||
int32_t coords_out_h = lv_area_get_height(&area_outer);
|
dsc->outline_blend_mode);
|
||||||
short_side = LV_MATH_MIN(coords_out_w, coords_out_h);
|
|
||||||
if(rout > short_side >> 1) rout = short_side >> 1;
|
|
||||||
|
|
||||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
|
||||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
|
||||||
|
|
||||||
/* Get clipped fill area which is the real draw area.
|
|
||||||
* It is always the same or inside `fill_area` */
|
|
||||||
lv_area_t draw_area;
|
|
||||||
bool is_common;
|
|
||||||
is_common = _lv_area_intersect(&draw_area, &area_outer, clip);
|
|
||||||
if(is_common == false) return;
|
|
||||||
|
|
||||||
const lv_area_t * disp_area = &vdb->area;
|
|
||||||
|
|
||||||
/* Now `draw_area` has absolute coordinates.
|
|
||||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
|
||||||
draw_area.x1 -= disp_area->x1;
|
|
||||||
draw_area.y1 -= disp_area->y1;
|
|
||||||
draw_area.x2 -= disp_area->x1;
|
|
||||||
draw_area.y2 -= disp_area->y1;
|
|
||||||
|
|
||||||
int32_t draw_area_w = lv_area_get_width(&draw_area);
|
|
||||||
|
|
||||||
/*Create inner the mask*/
|
|
||||||
lv_draw_mask_radius_param_t mask_rin_param;
|
|
||||||
lv_draw_mask_radius_init(&mask_rin_param, &area_inner, rin, true);
|
|
||||||
int16_t mask_rin_id = lv_draw_mask_add(&mask_rin_param, NULL);
|
|
||||||
|
|
||||||
lv_draw_mask_radius_param_t mask_rout_param;
|
|
||||||
lv_draw_mask_radius_init(&mask_rout_param, &area_outer, rout, false);
|
|
||||||
int16_t mask_rout_id = lv_draw_mask_add(&mask_rout_param, NULL);
|
|
||||||
|
|
||||||
lv_opa_t * mask_buf = _lv_mem_buf_get(draw_area_w);
|
|
||||||
|
|
||||||
int32_t corner_size = LV_MATH_MAX(rout, dsc->outline_width - 1);
|
|
||||||
|
|
||||||
int32_t h;
|
|
||||||
lv_draw_mask_res_t mask_res;
|
|
||||||
lv_area_t fill_area;
|
|
||||||
|
|
||||||
lv_color_t color = dsc->outline_color;
|
|
||||||
lv_blend_mode_t blend_mode = dsc->outline_blend_mode;
|
|
||||||
|
|
||||||
/*Apply some optimization if there is no other mask*/
|
|
||||||
if(simple_mode) {
|
|
||||||
/*Draw the upper corner area*/
|
|
||||||
int32_t upper_corner_end = area_outer.y1 - disp_area->y1 + corner_size;
|
|
||||||
|
|
||||||
fill_area.x1 = area_outer.x1;
|
|
||||||
fill_area.x2 = area_outer.x2;
|
|
||||||
fill_area.y1 = disp_area->y1 + draw_area.y1;
|
|
||||||
fill_area.y2 = fill_area.y1;
|
|
||||||
for(h = draw_area.y1; h <= upper_corner_end; h++) {
|
|
||||||
_lv_memset_ff(mask_buf, draw_area_w);
|
|
||||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
|
||||||
|
|
||||||
lv_area_t fill_area2;
|
|
||||||
fill_area2.y1 = fill_area.y1;
|
|
||||||
fill_area2.y2 = fill_area.y2;
|
|
||||||
|
|
||||||
fill_area2.x1 = area_outer.x1;
|
|
||||||
fill_area2.x2 = area_outer.x1 + rout - 1;
|
|
||||||
|
|
||||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
|
||||||
|
|
||||||
/*Draw the top horizontal line*/
|
|
||||||
if(fill_area2.y2 < area_outer.y1 + dsc->outline_width) {
|
|
||||||
fill_area2.x1 = area_outer.x1 + rout;
|
|
||||||
fill_area2.x2 = area_outer.x2 - rout;
|
|
||||||
|
|
||||||
_lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
fill_area2.x1 = area_outer.x2 - rout + 1;
|
|
||||||
fill_area2.x2 = area_outer.x2;
|
|
||||||
|
|
||||||
int32_t mask_ofs = (area_outer.x2 - rout + 1) - (vdb->area.x1 + draw_area.x1);
|
|
||||||
if(mask_ofs < 0) mask_ofs = 0;
|
|
||||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
|
||||||
|
|
||||||
fill_area.y1++;
|
|
||||||
fill_area.y2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Draw the lower corner area */
|
|
||||||
int32_t lower_corner_end = area_outer.y2 - disp_area->y1 - corner_size;
|
|
||||||
if(lower_corner_end <= upper_corner_end) lower_corner_end = upper_corner_end + 1;
|
|
||||||
fill_area.y1 = disp_area->y1 + lower_corner_end;
|
|
||||||
fill_area.y2 = fill_area.y1;
|
|
||||||
for(h = lower_corner_end; h <= draw_area.y2; h++) {
|
|
||||||
_lv_memset_ff(mask_buf, draw_area_w);
|
|
||||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
|
||||||
|
|
||||||
lv_area_t fill_area2;
|
|
||||||
fill_area2.x1 = area_outer.x1;
|
|
||||||
fill_area2.x2 = area_outer.x1 + rout - 1;
|
|
||||||
fill_area2.y1 = fill_area.y1;
|
|
||||||
fill_area2.y2 = fill_area.y2;
|
|
||||||
|
|
||||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
|
||||||
|
|
||||||
/*Draw the bottom horizontal line*/
|
|
||||||
if(fill_area2.y2 > area_outer.y2 - dsc->outline_width) {
|
|
||||||
fill_area2.x1 = area_outer.x1 + rout;
|
|
||||||
fill_area2.x2 = area_outer.x2 - rout;
|
|
||||||
|
|
||||||
_lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
|
||||||
}
|
|
||||||
fill_area2.x1 = area_outer.x2 - rout + 1;
|
|
||||||
fill_area2.x2 = area_outer.x2;
|
|
||||||
|
|
||||||
int32_t mask_ofs = (area_outer.x2 - rout + 1) - (vdb->area.x1 + draw_area.x1);
|
|
||||||
if(mask_ofs < 0) mask_ofs = 0;
|
|
||||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
|
||||||
|
|
||||||
|
|
||||||
fill_area.y1++;
|
|
||||||
fill_area.y2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Draw the left vertical part*/
|
|
||||||
fill_area.y1 = area_outer.y1 + corner_size + 1;
|
|
||||||
fill_area.y2 = area_outer.y2 - corner_size - 1;
|
|
||||||
|
|
||||||
fill_area.x1 = area_outer.x1;
|
|
||||||
fill_area.x2 = area_outer.x1 + dsc->outline_width - 1;
|
|
||||||
_lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
|
||||||
|
|
||||||
/*Draw the right vertical border*/
|
|
||||||
fill_area.x1 = area_outer.x2 - dsc->outline_width + 1;
|
|
||||||
fill_area.x2 = area_outer.x2;
|
|
||||||
|
|
||||||
_lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
|
||||||
}
|
|
||||||
/*Process line by line if there is other mask too*/
|
|
||||||
else {
|
|
||||||
fill_area.x1 = area_outer.x1;
|
|
||||||
fill_area.x2 = area_outer.x2;
|
|
||||||
fill_area.y1 = disp_area->y1 + draw_area.y1;
|
|
||||||
fill_area.y2 = fill_area.y1;
|
|
||||||
|
|
||||||
for(h = draw_area.y1; h <= draw_area.y2; h++) {
|
|
||||||
_lv_memset_ff(mask_buf, draw_area_w);
|
|
||||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
|
||||||
|
|
||||||
_lv_blend_fill(clip, &fill_area, color, mask_buf, mask_res, opa, blend_mode);
|
|
||||||
fill_area.y1++;
|
|
||||||
fill_area.y2++;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lv_draw_mask_remove_id(mask_rin_id);
|
|
||||||
lv_draw_mask_remove_id(mask_rout_id);
|
|
||||||
_lv_mem_buf_release(mask_buf);
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if LV_USE_PATTERN
|
||||||
static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
|
static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
|
||||||
{
|
{
|
||||||
if(dsc->pattern_image == NULL) return;
|
if(dsc->pattern_image == NULL) return;
|
||||||
@@ -1517,9 +1280,11 @@ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
|||||||
lv_draw_mask_remove_id(radius_mask_id);
|
lv_draw_mask_remove_id(radius_mask_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void draw_value(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
|
#if LV_USE_VALUE_STR
|
||||||
|
static void draw_value_str(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
|
||||||
{
|
{
|
||||||
if(dsc->value_str == NULL) return;
|
if(dsc->value_str == NULL) return;
|
||||||
if(dsc->value_opa <= LV_OPA_MIN) return;
|
if(dsc->value_opa <= LV_OPA_MIN) return;
|
||||||
@@ -1552,4 +1317,179 @@ static void draw_value(const lv_area_t * coords, const lv_area_t * clip, lv_draw
|
|||||||
|
|
||||||
lv_draw_label(&value_area, clip, &label_dsc, dsc->value_str, NULL);
|
lv_draw_label(&value_area, clip, &label_dsc, dsc->value_str, NULL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * area_outer, const lv_area_t * clip,
|
||||||
|
lv_coord_t radius, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||||
|
{
|
||||||
|
uint8_t other_mask_cnt = lv_draw_mask_get_cnt();
|
||||||
|
bool simple_mode = true;
|
||||||
|
if(other_mask_cnt) simple_mode = false;
|
||||||
|
|
||||||
|
int32_t inner_w = lv_area_get_width(area_inner);
|
||||||
|
int32_t inner_h = lv_area_get_height(area_inner);
|
||||||
|
lv_coord_t border_width = area_outer->x2 - area_inner->x2;
|
||||||
|
int32_t rin = radius;
|
||||||
|
|
||||||
|
int32_t short_side = LV_MATH_MIN(inner_w, inner_h);
|
||||||
|
if(rin > short_side >> 1) rin = short_side >> 1;
|
||||||
|
|
||||||
|
/*Get the outer area*/
|
||||||
|
int32_t rout = rin + border_width;
|
||||||
|
|
||||||
|
int32_t coords_out_w = lv_area_get_width(area_outer);
|
||||||
|
int32_t coords_out_h = lv_area_get_height(area_outer);
|
||||||
|
short_side = LV_MATH_MIN(coords_out_w, coords_out_h);
|
||||||
|
if(rout > short_side >> 1) rout = short_side >> 1;
|
||||||
|
|
||||||
|
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||||
|
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||||
|
|
||||||
|
/* Get clipped fill area which is the real draw area.
|
||||||
|
* It is always the same or inside `fill_area` */
|
||||||
|
lv_area_t draw_area;
|
||||||
|
bool is_common;
|
||||||
|
is_common = _lv_area_intersect(&draw_area, area_outer, clip);
|
||||||
|
if(is_common == false) return;
|
||||||
|
|
||||||
|
const lv_area_t * disp_area = &vdb->area;
|
||||||
|
|
||||||
|
/* Now `draw_area` has absolute coordinates.
|
||||||
|
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||||
|
draw_area.x1 -= disp_area->x1;
|
||||||
|
draw_area.y1 -= disp_area->y1;
|
||||||
|
draw_area.x2 -= disp_area->x1;
|
||||||
|
draw_area.y2 -= disp_area->y1;
|
||||||
|
|
||||||
|
int32_t draw_area_w = lv_area_get_width(&draw_area);
|
||||||
|
|
||||||
|
/*Create inner the mask*/
|
||||||
|
lv_draw_mask_radius_param_t mask_rin_param;
|
||||||
|
lv_draw_mask_radius_init(&mask_rin_param, area_inner, rin, true);
|
||||||
|
int16_t mask_rin_id = lv_draw_mask_add(&mask_rin_param, NULL);
|
||||||
|
|
||||||
|
lv_draw_mask_radius_param_t mask_rout_param;
|
||||||
|
lv_draw_mask_radius_init(&mask_rout_param, area_outer, rout, false);
|
||||||
|
int16_t mask_rout_id = lv_draw_mask_add(&mask_rout_param, NULL);
|
||||||
|
|
||||||
|
lv_opa_t * mask_buf = _lv_mem_buf_get(draw_area_w);
|
||||||
|
|
||||||
|
int32_t corner_size = LV_MATH_MAX(rout, border_width - 1);
|
||||||
|
|
||||||
|
int32_t h;
|
||||||
|
lv_draw_mask_res_t mask_res;
|
||||||
|
lv_area_t fill_area;
|
||||||
|
|
||||||
|
/*Apply some optimization if there is no other mask*/
|
||||||
|
if(simple_mode) {
|
||||||
|
/*Draw the upper corner area*/
|
||||||
|
int32_t upper_corner_end = area_outer->y1 - disp_area->y1 + corner_size;
|
||||||
|
|
||||||
|
fill_area.x1 = area_outer->x1;
|
||||||
|
fill_area.x2 = area_outer->x2;
|
||||||
|
fill_area.y1 = disp_area->y1 + draw_area.y1;
|
||||||
|
fill_area.y2 = fill_area.y1;
|
||||||
|
for(h = draw_area.y1; h <= upper_corner_end; h++) {
|
||||||
|
_lv_memset_ff(mask_buf, draw_area_w);
|
||||||
|
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||||
|
|
||||||
|
lv_area_t fill_area2;
|
||||||
|
fill_area2.y1 = fill_area.y1;
|
||||||
|
fill_area2.y2 = fill_area.y2;
|
||||||
|
|
||||||
|
fill_area2.x1 = area_outer->x1;
|
||||||
|
fill_area2.x2 = area_outer->x1 + rout - 1;
|
||||||
|
|
||||||
|
_lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
||||||
|
|
||||||
|
/*Draw the top horizontal line*/
|
||||||
|
if(fill_area2.y2 < area_outer->y1 + border_width) {
|
||||||
|
fill_area2.x1 = area_outer->x1 + rout;
|
||||||
|
fill_area2.x2 = area_outer->x2 - rout;
|
||||||
|
|
||||||
|
_lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
fill_area2.x1 = area_outer->x2 - rout + 1;
|
||||||
|
fill_area2.x2 = area_outer->x2;
|
||||||
|
|
||||||
|
int32_t mask_ofs = (area_outer->x2 - rout + 1) - (vdb->area.x1 + draw_area.x1);
|
||||||
|
if(mask_ofs < 0) mask_ofs = 0;
|
||||||
|
_lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
||||||
|
|
||||||
|
fill_area.y1++;
|
||||||
|
fill_area.y2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Draw the lower corner area */
|
||||||
|
int32_t lower_corner_end = area_outer->y2 - disp_area->y1 - corner_size;
|
||||||
|
if(lower_corner_end <= upper_corner_end) lower_corner_end = upper_corner_end + 1;
|
||||||
|
fill_area.y1 = disp_area->y1 + lower_corner_end;
|
||||||
|
fill_area.y2 = fill_area.y1;
|
||||||
|
for(h = lower_corner_end; h <= draw_area.y2; h++) {
|
||||||
|
_lv_memset_ff(mask_buf, draw_area_w);
|
||||||
|
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||||
|
|
||||||
|
lv_area_t fill_area2;
|
||||||
|
fill_area2.x1 = area_outer->x1;
|
||||||
|
fill_area2.x2 = area_outer->x1 + rout - 1;
|
||||||
|
fill_area2.y1 = fill_area.y1;
|
||||||
|
fill_area2.y2 = fill_area.y2;
|
||||||
|
|
||||||
|
_lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
||||||
|
|
||||||
|
/*Draw the bottom horizontal line*/
|
||||||
|
if(fill_area2.y2 > area_outer->y2 - border_width) {
|
||||||
|
fill_area2.x1 = area_outer->x1 + rout;
|
||||||
|
fill_area2.x2 = area_outer->x2 - rout;
|
||||||
|
|
||||||
|
_lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||||
|
}
|
||||||
|
fill_area2.x1 = area_outer->x2 - rout + 1;
|
||||||
|
fill_area2.x2 = area_outer->x2;
|
||||||
|
|
||||||
|
int32_t mask_ofs = (area_outer->x2 - rout + 1) - (vdb->area.x1 + draw_area.x1);
|
||||||
|
if(mask_ofs < 0) mask_ofs = 0;
|
||||||
|
_lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
||||||
|
|
||||||
|
|
||||||
|
fill_area.y1++;
|
||||||
|
fill_area.y2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Draw the left vertical part*/
|
||||||
|
fill_area.y1 = area_outer->y1 + corner_size + 1;
|
||||||
|
fill_area.y2 = area_outer->y2 - corner_size - 1;
|
||||||
|
|
||||||
|
fill_area.x1 = area_outer->x1;
|
||||||
|
fill_area.x2 = area_outer->x1 + border_width - 1;
|
||||||
|
_lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||||
|
|
||||||
|
/*Draw the right vertical border*/
|
||||||
|
fill_area.x1 = area_outer->x2 - border_width + 1;
|
||||||
|
fill_area.x2 = area_outer->x2;
|
||||||
|
|
||||||
|
_lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||||
|
}
|
||||||
|
/*Process line by line if there is other mask too*/
|
||||||
|
else {
|
||||||
|
fill_area.x1 = area_outer->x1;
|
||||||
|
fill_area.x2 = area_outer->x2;
|
||||||
|
fill_area.y1 = disp_area->y1 + draw_area.y1;
|
||||||
|
fill_area.y2 = fill_area.y1;
|
||||||
|
|
||||||
|
for(h = draw_area.y1; h <= draw_area.y2; h++) {
|
||||||
|
_lv_memset_ff(mask_buf, draw_area_w);
|
||||||
|
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||||
|
|
||||||
|
_lv_blend_fill(clip, &fill_area, color, mask_buf, mask_res, opa, blend_mode);
|
||||||
|
fill_area.y1++;
|
||||||
|
fill_area.y2++;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lv_draw_mask_remove_id(mask_rin_id);
|
||||||
|
lv_draw_mask_remove_id(mask_rout_id);
|
||||||
|
_lv_mem_buf_release(mask_buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
uint32_t px = dsc->header.w * y * px_size + x * px_size;
|
||||||
_lv_memcpy_small(&p_color, &buf_u8[px], sizeof(lv_color_t));
|
_lv_memcpy_small(&p_color, &buf_u8[px], sizeof(lv_color_t));
|
||||||
#if LV_COLOR_SIZE == 32
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
else if(dsc->header.cf == LV_IMG_CF_INDEXED_1BIT) {
|
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
|
#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
|
* @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)
|
void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
|
||||||
@@ -471,6 +471,15 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
|
|||||||
lv_point_t * pivot)
|
lv_point_t * pivot)
|
||||||
{
|
{
|
||||||
#if LV_USE_IMG_TRANSFORM
|
#if LV_USE_IMG_TRANSFORM
|
||||||
|
if(angle == 0 && zoom == LV_IMG_ZOOM_NONE) {
|
||||||
|
res->x1 = 0;
|
||||||
|
res->y1 = 0;
|
||||||
|
res->x2 = w - 1;
|
||||||
|
res->y2 = h - 1;
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int32_t angle_low = angle / 10;
|
int32_t angle_low = angle / 10;
|
||||||
int32_t angle_hight = angle_low + 1;
|
int32_t angle_hight = angle_low + 1;
|
||||||
int32_t angle_rem = angle - (angle_low * 10);
|
int32_t angle_rem = angle - (angle_low * 10);
|
||||||
@@ -528,8 +537,8 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
|
|||||||
LV_UNUSED(pivot);
|
LV_UNUSED(pivot);
|
||||||
res->x1 = 0;
|
res->x1 = 0;
|
||||||
res->y1 = 0;
|
res->y1 = 0;
|
||||||
res->x2 = w;
|
res->x2 = w - 1;
|
||||||
res->y2 = h;
|
res->y2 = h - 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,7 +554,7 @@ bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc)
|
|||||||
/*Get the fractional part of the source pixel*/
|
/*Get the fractional part of the source pixel*/
|
||||||
int xs_fract = dsc->tmp.xs & 0xff;
|
int xs_fract = dsc->tmp.xs & 0xff;
|
||||||
int ys_fract = dsc->tmp.ys & 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*/
|
lv_opa_t xr; /*x mix ratio*/
|
||||||
|
|
||||||
if(xs_fract < 0x70) {
|
if(xs_fract < 0x70) {
|
||||||
@@ -563,7 +572,7 @@ bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc)
|
|||||||
xr = 0xFF;
|
xr = 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t yn; /*x neightboor*/
|
int32_t yn; /*x neighbor*/
|
||||||
lv_opa_t yr; /*x mix ratio*/
|
lv_opa_t yr; /*x mix ratio*/
|
||||||
|
|
||||||
if(ys_fract < 0x70) {
|
if(ys_fract < 0x70) {
|
||||||
|
|||||||
@@ -102,10 +102,26 @@ typedef uint8_t lv_img_cf_t;
|
|||||||
/**
|
/**
|
||||||
* LVGL image header
|
* LVGL image header
|
||||||
*/
|
*/
|
||||||
|
/* The first 8 bit is very important to distinguish the different source types.
|
||||||
|
* For more info see `lv_img_get_src_type()` in lv_img.c
|
||||||
|
* On big endian systems the order is reversed so cf and always_zero must be at
|
||||||
|
* the end of the struct.
|
||||||
|
* */
|
||||||
|
#if LV_BIG_ENDIAN_SYSTEM
|
||||||
|
typedef struct {
|
||||||
|
|
||||||
|
uint32_t h : 11; /*Height of the image map*/
|
||||||
|
uint32_t w : 11; /*Width of the image map*/
|
||||||
|
uint32_t reserved : 2; /*Reserved to be used later*/
|
||||||
|
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
|
||||||
|
non-printable character*/
|
||||||
|
uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/
|
||||||
|
|
||||||
|
|
||||||
|
} lv_img_header_t;
|
||||||
|
#else
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/* The first 8 bit is very important to distinguish the different source types.
|
|
||||||
* For more info see `lv_img_get_src_type()` in lv_img.c */
|
|
||||||
uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/
|
uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/
|
||||||
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
|
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
|
||||||
non-printable character*/
|
non-printable character*/
|
||||||
@@ -115,7 +131,7 @@ typedef struct {
|
|||||||
uint32_t w : 11; /*Width of the image map*/
|
uint32_t w : 11; /*Width of the image map*/
|
||||||
uint32_t h : 11; /*Height of the image map*/
|
uint32_t h : 11; /*Height of the image map*/
|
||||||
} lv_img_header_t;
|
} lv_img_header_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Image header it is compatible with
|
/** Image header it is compatible with
|
||||||
* the result from image converter utility*/
|
* the result from image converter utility*/
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/*********************
|
/*********************
|
||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
#include "../lv_core/lv_debug.h"
|
#include "../lv_misc/lv_debug.h"
|
||||||
#include "lv_img_cache.h"
|
#include "lv_img_cache.h"
|
||||||
#include "lv_img_decoder.h"
|
#include "lv_img_decoder.h"
|
||||||
#include "lv_draw_img.h"
|
#include "lv_draw_img.h"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
#include "lv_img_decoder.h"
|
#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_draw/lv_draw_img.h"
|
||||||
#include "../lv_misc/lv_ll.h"
|
#include "../lv_misc/lv_ll.h"
|
||||||
#include "../lv_misc/lv_color.h"
|
#include "../lv_misc/lv_color.h"
|
||||||
@@ -89,6 +89,9 @@ void _lv_img_decoder_init(void)
|
|||||||
lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header)
|
lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header)
|
||||||
{
|
{
|
||||||
header->always_zero = 0;
|
header->always_zero = 0;
|
||||||
|
header->h = 0;
|
||||||
|
header->w = 0;
|
||||||
|
header->cf = LV_IMG_CF_UNKNOWN;
|
||||||
|
|
||||||
lv_res_t res = LV_RES_INV;
|
lv_res_t res = LV_RES_INV;
|
||||||
lv_img_decoder_t * d;
|
lv_img_decoder_t * d;
|
||||||
@@ -150,10 +153,6 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_co
|
|||||||
if(res == LV_RES_OK) break;
|
if(res == LV_RES_OK) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(res == LV_RES_INV) {
|
|
||||||
_lv_memset_00(dsc, sizeof(lv_img_decoder_dsc_t));
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ typedef struct _lv_font_struct {
|
|||||||
lv_coord_t line_height; /**< The real line height where any text fits*/
|
lv_coord_t line_height; /**< The real line height where any text fits*/
|
||||||
lv_coord_t base_line; /**< Base line measured from the top of the line_height*/
|
lv_coord_t base_line; /**< Base line measured from the top of the line_height*/
|
||||||
uint8_t subpx : 2; /**< An element of `lv_font_subpx_t`*/
|
uint8_t subpx : 2; /**< An element of `lv_font_subpx_t`*/
|
||||||
|
|
||||||
|
int8_t underline_position; /**< Distance between the top of the underline and base line (< 0 means below the base line)*/
|
||||||
|
int8_t underline_thickness; /**< Thickness of the underline*/
|
||||||
|
|
||||||
void * dsc; /**< Store implementation specific or run_time data or caching here*/
|
void * dsc; /**< Store implementation specific or run_time data or caching here*/
|
||||||
#if LV_USE_USER_DATA
|
#if LV_USE_USER_DATA
|
||||||
lv_font_user_data_t user_data; /**< Custom user data for font. */
|
lv_font_user_data_t user_data; /**< Custom user data for font. */
|
||||||
@@ -171,6 +175,10 @@ LV_FONT_DECLARE(lv_font_montserrat_30)
|
|||||||
LV_FONT_DECLARE(lv_font_montserrat_32)
|
LV_FONT_DECLARE(lv_font_montserrat_32)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LV_FONT_MONTSERRAT_34
|
||||||
|
LV_FONT_DECLARE(lv_font_montserrat_34)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if LV_FONT_MONTSERRAT_36
|
#if LV_FONT_MONTSERRAT_36
|
||||||
LV_FONT_DECLARE(lv_font_montserrat_36)
|
LV_FONT_DECLARE(lv_font_montserrat_36)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*********************/
|
*********************/
|
||||||
#include "lv_font.h"
|
#include "lv_font.h"
|
||||||
#include "lv_font_fmt_txt.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_draw/lv_draw.h"
|
||||||
#include "../lv_misc/lv_types.h"
|
#include "../lv_misc/lv_types.h"
|
||||||
#include "../lv_misc/lv_log.h"
|
#include "../lv_misc/lv_log.h"
|
||||||
@@ -37,14 +37,13 @@ static int32_t unicode_list_compare(const void * ref, const void * element);
|
|||||||
static int32_t kern_pair_8_compare(const void * ref, const void * element);
|
static int32_t kern_pair_8_compare(const void * ref, const void * element);
|
||||||
static int32_t kern_pair_16_compare(const void * ref, const void * element);
|
static int32_t kern_pair_16_compare(const void * ref, const void * element);
|
||||||
|
|
||||||
static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord_t h, uint8_t bpp);
|
static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord_t h, uint8_t bpp, bool prefilter);
|
||||||
static inline void decompress_line(uint8_t * out, lv_coord_t w);
|
static inline void decompress_line(uint8_t * out, lv_coord_t w);
|
||||||
static inline uint8_t get_bits(const uint8_t * in, uint32_t bit_pos, uint8_t len);
|
static inline uint8_t get_bits(const uint8_t * in, uint32_t bit_pos, uint8_t len);
|
||||||
static inline void bits_write(uint8_t * out, uint32_t bit_pos, uint8_t val, uint8_t len);
|
static inline void bits_write(uint8_t * out, uint32_t bit_pos, uint8_t val, uint8_t len);
|
||||||
static inline void rle_init(const uint8_t * in, uint8_t bpp);
|
static inline void rle_init(const uint8_t * in, uint8_t bpp);
|
||||||
static inline uint8_t rle_next(void);
|
static inline uint8_t rle_next(void);
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
**********************/
|
**********************/
|
||||||
@@ -89,6 +88,7 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
|
|||||||
}
|
}
|
||||||
/*Handle compressed bitmap*/
|
/*Handle compressed bitmap*/
|
||||||
else {
|
else {
|
||||||
|
#if LV_USE_FONT_COMPRESSED
|
||||||
uint32_t gsize = gdsc->box_w * gdsc->box_h;
|
uint32_t gsize = gdsc->box_w * gdsc->box_h;
|
||||||
if(gsize == 0) return NULL;
|
if(gsize == 0) return NULL;
|
||||||
|
|
||||||
@@ -115,8 +115,13 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
|
|||||||
if(decompr_buf == NULL) return NULL;
|
if(decompr_buf == NULL) return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], decompr_buf, gdsc->box_w, gdsc->box_h, (uint8_t)fdsc->bpp);
|
bool prefilter = fdsc->bitmap_format == LV_FONT_FMT_TXT_COMPRESSED ? true : false;
|
||||||
|
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], decompr_buf, gdsc->box_w, gdsc->box_h, (uint8_t)fdsc->bpp,
|
||||||
|
prefilter);
|
||||||
return decompr_buf;
|
return decompr_buf;
|
||||||
|
#else /* !LV_USE_FONT_COMPRESSED */
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*If not returned earlier then the letter is not found in this font*/
|
/*If not returned earlier then the letter is not found in this font*/
|
||||||
@@ -214,7 +219,8 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
|
|||||||
glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_8[rcp];
|
glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_8[rcp];
|
||||||
}
|
}
|
||||||
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_TINY) {
|
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_TINY) {
|
||||||
uint8_t * p = _lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
|
uint16_t key = rcp;
|
||||||
|
uint8_t * p = _lv_utils_bsearch(&key, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
|
||||||
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
|
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
|
||||||
|
|
||||||
if(p) {
|
if(p) {
|
||||||
@@ -224,7 +230,8 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_FULL) {
|
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_FULL) {
|
||||||
uint8_t * p = _lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
|
uint16_t key = rcp;
|
||||||
|
uint8_t * p = _lv_utils_bsearch(&key, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
|
||||||
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
|
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
|
||||||
|
|
||||||
if(p) {
|
if(p) {
|
||||||
@@ -332,8 +339,9 @@ static int32_t kern_pair_16_compare(const void * ref, const void * element)
|
|||||||
* @param out buffer to store the result
|
* @param out buffer to store the result
|
||||||
* @param px_num number of pixels in the glyph (width * height)
|
* @param px_num number of pixels in the glyph (width * height)
|
||||||
* @param bpp bit per pixel (bpp = 3 will be converted to bpp = 4)
|
* @param bpp bit per pixel (bpp = 3 will be converted to bpp = 4)
|
||||||
|
* @param prefilter true: the lines are XORed
|
||||||
*/
|
*/
|
||||||
static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord_t h, uint8_t bpp)
|
static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord_t h, uint8_t bpp, bool prefilter)
|
||||||
{
|
{
|
||||||
uint32_t wrp = 0;
|
uint32_t wrp = 0;
|
||||||
uint8_t wr_size = bpp;
|
uint8_t wr_size = bpp;
|
||||||
@@ -342,7 +350,12 @@ static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord
|
|||||||
rle_init(in, bpp);
|
rle_init(in, bpp);
|
||||||
|
|
||||||
uint8_t * line_buf1 = _lv_mem_buf_get(w);
|
uint8_t * line_buf1 = _lv_mem_buf_get(w);
|
||||||
uint8_t * line_buf2 = _lv_mem_buf_get(w);
|
|
||||||
|
uint8_t * line_buf2 = NULL;
|
||||||
|
|
||||||
|
if(prefilter) {
|
||||||
|
line_buf2 = _lv_mem_buf_get(w);
|
||||||
|
}
|
||||||
|
|
||||||
decompress_line(line_buf1, w);
|
decompress_line(line_buf1, w);
|
||||||
|
|
||||||
@@ -355,12 +368,22 @@ static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(y = 1; y < h; y++) {
|
for(y = 1; y < h; y++) {
|
||||||
decompress_line(line_buf2, w);
|
if(prefilter) {
|
||||||
|
decompress_line(line_buf2, w);
|
||||||
|
|
||||||
for(x = 0; x < w; x++) {
|
for(x = 0; x < w; x++) {
|
||||||
line_buf1[x] = line_buf2[x] ^ line_buf1[x];
|
line_buf1[x] = line_buf2[x] ^ line_buf1[x];
|
||||||
bits_write(out, wrp, line_buf1[x], bpp);
|
bits_write(out, wrp, line_buf1[x], bpp);
|
||||||
wrp += wr_size;
|
wrp += wr_size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
decompress_line(line_buf1, w);
|
||||||
|
|
||||||
|
for(x = 0; x < w; x++) {
|
||||||
|
bits_write(out, wrp, line_buf1[x], bpp);
|
||||||
|
wrp += wr_size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,7 +407,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.
|
* Read bits from an input buffer. The read can cross byte boundary.
|
||||||
* @param in the input buffer to read from.
|
* @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).
|
* @param len number of bits to read (must be <= 8).
|
||||||
* @return the read bits
|
* @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`
|
2 Get the class of the left and right glyphs as `left_class` and `right_class`
|
||||||
left_class = left_class_mapping[glyph_id_left];
|
left_class = left_class_mapping[glyph_id_left];
|
||||||
right_class = right_class_mapping[glyph_id_right];
|
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*/
|
const int8_t * class_pair_values; /*left_class_num * right_class_num value*/
|
||||||
@@ -150,12 +150,13 @@ typedef struct {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
LV_FONT_FMT_TXT_PLAIN = 0,
|
LV_FONT_FMT_TXT_PLAIN = 0,
|
||||||
LV_FONT_FMT_TXT_COMPRESSED = 1,
|
LV_FONT_FMT_TXT_COMPRESSED = 1,
|
||||||
|
LV_FONT_FMT_TXT_COMPRESSED_NO_PREFILTER = 1,
|
||||||
} lv_font_fmt_txt_bitmap_format_t;
|
} lv_font_fmt_txt_bitmap_format_t;
|
||||||
|
|
||||||
|
|
||||||
/*Describe store additional data for fonts */
|
/*Describe store additional data for fonts */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/*The bitmaps os all glyphs*/
|
/*The bitmaps of all glyphs*/
|
||||||
const uint8_t * glyph_bitmap;
|
const uint8_t * glyph_bitmap;
|
||||||
|
|
||||||
/*Describe the glyphs*/
|
/*Describe the glyphs*/
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ extern "C" {
|
|||||||
#include "../lv_conf_internal.h"
|
#include "../lv_conf_internal.h"
|
||||||
|
|
||||||
/*-------------------------------
|
/*-------------------------------
|
||||||
* Symbols from FontAwsome font
|
* Symbols from FontAwesome font
|
||||||
*-----------------------------*/
|
*-----------------------------*/
|
||||||
|
|
||||||
/* In the font converter use this list as range:
|
/* In the font converter use this list as range:
|
||||||
|
|||||||
@@ -11,19 +11,14 @@
|
|||||||
|
|
||||||
#if LV_USE_GPU_STM32_DMA2D
|
#if LV_USE_GPU_STM32_DMA2D
|
||||||
|
|
||||||
#if defined(STM32F4)
|
#include LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||||
#include "stm32f4xx_hal.h"
|
|
||||||
#elif defined(STM32F7)
|
|
||||||
#include "stm32f7xx_hal.h"
|
|
||||||
#else
|
|
||||||
#error "Not supported STM32 family to use DMA2D"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
|
|
||||||
#if LV_COLOR_16_SWAP
|
#if LV_COLOR_16_SWAP
|
||||||
|
// TODO: F7 has red blue swap bit in control register for all layers and output
|
||||||
#error "Can't use DMA2D with LV_COLOR_16_SWAP 1"
|
#error "Can't use DMA2D with LV_COLOR_16_SWAP 1"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -32,11 +27,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_COLOR_DEPTH == 16
|
#if LV_COLOR_DEPTH == 16
|
||||||
#define DMA2D_OUTPUT_FORMAT DMA2D_OUTPUT_RGB565
|
#define LV_DMA2D_COLOR_FORMAT LV_DMA2D_RGB565
|
||||||
#define DMA2D_INPUT_FORMAT DMA2D_INPUT_RGB565
|
|
||||||
#elif LV_COLOR_DEPTH == 32
|
#elif LV_COLOR_DEPTH == 32
|
||||||
#define DMA2D_OUTPUT_FORMAT DMA2D_OUTPUT_ARGB8888
|
#define LV_DMA2D_COLOR_FORMAT LV_DMA2D_ARGB8888
|
||||||
#define DMA2D_INPUT_FORMAT DMA2D_INPUT_ARGB8888
|
|
||||||
#else
|
#else
|
||||||
/*Can't use GPU with other formats*/
|
/*Can't use GPU with other formats*/
|
||||||
#endif
|
#endif
|
||||||
@@ -54,7 +47,6 @@ static void dma2d_wait(void);
|
|||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
**********************/
|
**********************/
|
||||||
static DMA2D_HandleTypeDef hdma2d;
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
@@ -64,6 +56,21 @@ static DMA2D_HandleTypeDef hdma2d;
|
|||||||
* GLOBAL FUNCTIONS
|
* GLOBAL FUNCTIONS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn on the peripheral and set output color mode, this only needs to be done once
|
||||||
|
*/
|
||||||
|
void lv_gpu_stm32_dma2d_init(void)
|
||||||
|
{
|
||||||
|
/* Enable DMA2D clock */
|
||||||
|
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2DEN;
|
||||||
|
|
||||||
|
/* Delay after setting peripheral clock */
|
||||||
|
volatile uint32_t temp = RCC->AHB1ENR;
|
||||||
|
|
||||||
|
/* set output colour mode */
|
||||||
|
DMA2D->OPFCCR = LV_DMA2D_COLOR_FORMAT;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill an area in the buffer with a color
|
* Fill an area in the buffer with a color
|
||||||
* @param buf a buffer which should be filled
|
* @param buf a buffer which should be filled
|
||||||
@@ -77,18 +84,16 @@ void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t colo
|
|||||||
{
|
{
|
||||||
invalidate_cache();
|
invalidate_cache();
|
||||||
|
|
||||||
hdma2d.Instance = DMA2D;
|
DMA2D->CR = 0x30000;
|
||||||
hdma2d.Init.Mode = DMA2D_R2M;
|
DMA2D->OMAR = (uint32_t)buf;
|
||||||
hdma2d.Init.ColorMode = DMA2D_OUTPUT_FORMAT;
|
/* as input color mode is same as output we don't need to convert here do we? */
|
||||||
hdma2d.Init.OutputOffset = buf_w - fill_w;
|
DMA2D->OCOLR = color.full;
|
||||||
hdma2d.LayerCfg[1].InputAlpha = DMA2D_NO_MODIF_ALPHA;
|
DMA2D->OOR = buf_w - fill_w;
|
||||||
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_FORMAT;
|
DMA2D->NLR = (fill_w << DMA2D_NLR_PL_Pos) | (fill_h << DMA2D_NLR_NL_Pos);
|
||||||
hdma2d.LayerCfg[1].InputOffset = 0;
|
|
||||||
|
/* start transfer */
|
||||||
|
DMA2D->CR |= DMA2D_CR_START_Msk;
|
||||||
|
|
||||||
/* DMA2D Initialization */
|
|
||||||
HAL_DMA2D_Init(&hdma2d);
|
|
||||||
HAL_DMA2D_ConfigLayer(&hdma2d, 1);
|
|
||||||
HAL_DMA2D_Start(&hdma2d, (uint32_t)lv_color_to32(color), (uint32_t)buf, fill_w, fill_h);
|
|
||||||
dma2d_wait();
|
dma2d_wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,6 +111,7 @@ void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t colo
|
|||||||
void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask,
|
void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask,
|
||||||
lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h)
|
lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
invalidate_cache();
|
invalidate_cache();
|
||||||
|
|
||||||
/* Configure the DMA2D Mode, Color Mode and line output offset */
|
/* Configure the DMA2D Mode, Color Mode and line output offset */
|
||||||
@@ -134,6 +140,7 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
|
|||||||
HAL_DMA2D_ConfigLayer(&hdma2d, 1);
|
HAL_DMA2D_ConfigLayer(&hdma2d, 1);
|
||||||
HAL_DMA2D_BlendingStart(&hdma2d, (uint32_t) mask, (uint32_t) buf, (uint32_t)buf, fill_w, fill_h);
|
HAL_DMA2D_BlendingStart(&hdma2d, (uint32_t) mask, (uint32_t) buf, (uint32_t)buf, fill_w, fill_h);
|
||||||
dma2d_wait();
|
dma2d_wait();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,7 +148,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 a buffer where map should be copied
|
||||||
* @param buf_w width of the buffer in pixels
|
* @param buf_w width of the buffer in pixels
|
||||||
* @param map an "image" to copy
|
* @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_w width of the area to copy in pixels (<= buf_w)
|
||||||
* @param copy_h height of the area to copy in pixels
|
* @param copy_h height of the area to copy in pixels
|
||||||
* @note `map_w - fill_w` is offset to the next line after copy
|
* @note `map_w - fill_w` is offset to the next line after copy
|
||||||
@@ -151,22 +158,17 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
|
|||||||
{
|
{
|
||||||
invalidate_cache();
|
invalidate_cache();
|
||||||
|
|
||||||
hdma2d.Instance = DMA2D;
|
DMA2D->CR = 0;
|
||||||
hdma2d.Init.Mode = DMA2D_M2M;
|
/* copy output colour mode, this register controls both input and output colour format */
|
||||||
hdma2d.Init.ColorMode = DMA2D_OUTPUT_FORMAT;
|
DMA2D->FGPFCCR = LV_DMA2D_COLOR_FORMAT;
|
||||||
hdma2d.Init.OutputOffset = buf_w - copy_w;
|
DMA2D->FGMAR = (uint32_t)map;
|
||||||
|
DMA2D->FGOR = map_w - copy_w;
|
||||||
|
DMA2D->OMAR = (uint32_t)buf;
|
||||||
|
DMA2D->OOR = buf_w - copy_w;
|
||||||
|
DMA2D->NLR = (copy_w << DMA2D_NLR_PL_Pos) | (copy_h << DMA2D_NLR_NL_Pos);
|
||||||
|
|
||||||
/* Foreground layer */
|
/* start transfer */
|
||||||
hdma2d.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
|
DMA2D->CR |= DMA2D_CR_START_Msk;
|
||||||
hdma2d.LayerCfg[1].InputAlpha = 0xFF;
|
|
||||||
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_FORMAT;
|
|
||||||
hdma2d.LayerCfg[1].InputOffset = map_w - copy_w;
|
|
||||||
|
|
||||||
/* DMA2D Initialization */
|
|
||||||
HAL_DMA2D_Init(&hdma2d);
|
|
||||||
HAL_DMA2D_ConfigLayer(&hdma2d, 0);
|
|
||||||
HAL_DMA2D_ConfigLayer(&hdma2d, 1);
|
|
||||||
HAL_DMA2D_Start(&hdma2d, (uint32_t)map, (uint32_t)buf, copy_w, copy_h);
|
|
||||||
dma2d_wait();
|
dma2d_wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +178,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 buf_w width of the buffer in pixels
|
||||||
* @param map an "image" to copy
|
* @param map an "image" to copy
|
||||||
* @param opa opacity of `map`
|
* @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_w width of the area to copy in pixels (<= buf_w)
|
||||||
* @param copy_h height of the area to copy in pixels
|
* @param copy_h height of the area to copy in pixels
|
||||||
* @note `map_w - fill_w` is offset to the next line after copy
|
* @note `map_w - fill_w` is offset to the next line after copy
|
||||||
@@ -185,28 +187,26 @@ void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color
|
|||||||
lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
|
lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
|
||||||
{
|
{
|
||||||
invalidate_cache();
|
invalidate_cache();
|
||||||
|
DMA2D->CR = 0x20000;
|
||||||
|
|
||||||
hdma2d.Instance = DMA2D;
|
DMA2D->BGPFCCR = LV_DMA2D_COLOR_FORMAT;
|
||||||
hdma2d.Init.Mode = DMA2D_M2M_BLEND;
|
DMA2D->BGMAR = (uint32_t)buf;
|
||||||
hdma2d.Init.ColorMode = DMA2D_OUTPUT_FORMAT;
|
DMA2D->BGOR = buf_w - copy_w;
|
||||||
hdma2d.Init.OutputOffset = buf_w - copy_w;
|
|
||||||
|
|
||||||
/* Background layer */
|
DMA2D->FGPFCCR = (uint32_t)LV_DMA2D_COLOR_FORMAT
|
||||||
hdma2d.LayerCfg[0].AlphaMode = DMA2D_NO_MODIF_ALPHA;
|
/* alpha mode 2, replace with foreground * alpha value */
|
||||||
hdma2d.LayerCfg[0].InputColorMode = DMA2D_INPUT_FORMAT;
|
| (2 << DMA2D_FGPFCCR_AM_Pos)
|
||||||
hdma2d.LayerCfg[0].InputOffset = buf_w - copy_w;
|
/* alpha value */
|
||||||
|
| (opa << DMA2D_FGPFCCR_ALPHA_Pos);
|
||||||
|
DMA2D->FGMAR = (uint32_t)map;
|
||||||
|
DMA2D->FGOR = map_w - copy_w;
|
||||||
|
|
||||||
/* Foreground layer */
|
DMA2D->OMAR = (uint32_t)buf;
|
||||||
hdma2d.LayerCfg[1].AlphaMode = DMA2D_COMBINE_ALPHA;
|
DMA2D->OOR = buf_w - copy_w;
|
||||||
hdma2d.LayerCfg[1].InputAlpha = opa;
|
DMA2D->NLR = (copy_w << DMA2D_NLR_PL_Pos) | (copy_h << DMA2D_NLR_NL_Pos);
|
||||||
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_FORMAT;
|
|
||||||
hdma2d.LayerCfg[1].InputOffset = map_w - copy_w;
|
|
||||||
|
|
||||||
/* DMA2D Initialization */
|
/* start transfer */
|
||||||
HAL_DMA2D_Init(&hdma2d);
|
DMA2D->CR |= DMA2D_CR_START_Msk;
|
||||||
HAL_DMA2D_ConfigLayer(&hdma2d, 0);
|
|
||||||
HAL_DMA2D_ConfigLayer(&hdma2d, 1);
|
|
||||||
HAL_DMA2D_BlendingStart(&hdma2d, (uint32_t)map, (uint32_t)buf, (uint32_t)buf, copy_w, copy_h);
|
|
||||||
dma2d_wait();
|
dma2d_wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ static void invalidate_cache(void)
|
|||||||
static void dma2d_wait(void)
|
static void dma2d_wait(void)
|
||||||
{
|
{
|
||||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||||
while(HAL_DMA2D_PollForTransfer(&hdma2d, 0) == HAL_TIMEOUT) {
|
while(DMA2D->CR & DMA2D_CR_START_Msk) {
|
||||||
if(disp->driver.wait_cb) disp->driver.wait_cb(&disp->driver);
|
if(disp->driver.wait_cb) disp->driver.wait_cb(&disp->driver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,12 @@ extern "C" {
|
|||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
|
|
||||||
|
#define LV_DMA2D_ARGB8888 0
|
||||||
|
#define LV_DMA2D_RGB888 1
|
||||||
|
#define LV_DMA2D_RGB565 2
|
||||||
|
#define LV_DMA2D_ARGB1555 3
|
||||||
|
#define LV_DMA2D_ARGB4444 4
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
@@ -28,6 +34,11 @@ extern "C" {
|
|||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn on the peripheral and set output color mode, this only needs to be done once
|
||||||
|
*/
|
||||||
|
void lv_gpu_stm32_dma2d_init(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill an area in the buffer with a color
|
* Fill an area in the buffer with a color
|
||||||
* @param buf a buffer which should be filled
|
* @param buf a buffer which should be filled
|
||||||
@@ -60,7 +71,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 a buffer where map should be copied
|
||||||
* @param buf_w width of the buffer in pixels
|
* @param buf_w width of the buffer in pixels
|
||||||
* @param map an "image" to copy
|
* @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_w width of the area to copy in pixels (<= buf_w)
|
||||||
* @param copy_h height of the area to copy in pixels
|
* @param copy_h height of the area to copy in pixels
|
||||||
* @note `map_w - fill_w` is offset to the next line after copy
|
* @note `map_w - fill_w` is offset to the next line after copy
|
||||||
@@ -73,7 +84,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 buf_w width of the buffer in pixels
|
||||||
* @param map an "image" to copy
|
* @param map an "image" to copy
|
||||||
* @param opa opacity of `map`
|
* @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_w width of the area to copy in pixels (<= buf_w)
|
||||||
* @param copy_h height of the area to copy in pixels
|
* @param copy_h height of the area to copy in pixels
|
||||||
* @note `map_w - fill_w` is offset to the next line after copy
|
* @note `map_w - fill_w` is offset to the next line after copy
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "lv_hal.h"
|
#include "lv_hal.h"
|
||||||
#include "../lv_misc/lv_mem.h"
|
#include "../lv_misc/lv_mem.h"
|
||||||
#include "../lv_misc/lv_gc.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_obj.h"
|
||||||
#include "../lv_core/lv_refr.h"
|
#include "../lv_core/lv_refr.h"
|
||||||
#include "../lv_themes/lv_theme.h"
|
#include "../lv_themes/lv_theme.h"
|
||||||
@@ -144,6 +144,15 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
|
|||||||
disp->inv_p = 0;
|
disp->inv_p = 0;
|
||||||
disp->last_activity_time = 0;
|
disp->last_activity_time = 0;
|
||||||
|
|
||||||
|
disp->bg_color = LV_COLOR_WHITE;
|
||||||
|
disp->bg_img = NULL;
|
||||||
|
#if LV_COLOR_SCREEN_TRANSP
|
||||||
|
disp->bg_opa = LV_OPA_TRANSP;
|
||||||
|
#else
|
||||||
|
disp->bg_opa = LV_OPA_COVER;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
disp->prev_scr = NULL;
|
||||||
disp->act_scr = lv_obj_create(NULL, NULL); /*Create a default screen on the display*/
|
disp->act_scr = lv_obj_create(NULL, NULL); /*Create a default screen on the display*/
|
||||||
disp->top_layer = lv_obj_create(NULL, NULL); /*Create top layer on the display*/
|
disp->top_layer = lv_obj_create(NULL, NULL); /*Create top layer on the display*/
|
||||||
disp->sys_layer = lv_obj_create(NULL, NULL); /*Create sys layer on the display*/
|
disp->sys_layer = lv_obj_create(NULL, NULL); /*Create sys layer on the display*/
|
||||||
@@ -158,6 +167,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*/
|
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;
|
return disp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,10 +52,10 @@ typedef struct {
|
|||||||
void * buf_act;
|
void * buf_act;
|
||||||
uint32_t size; /*In pixel count*/
|
uint32_t size; /*In pixel count*/
|
||||||
lv_area_t area;
|
lv_area_t area;
|
||||||
volatile int
|
/*1: flushing is in progress. (It can't be a bit field because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
|
||||||
flushing; /*1: flushing is in progress. (It can't be a bitfield because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
|
volatile int flushing;
|
||||||
volatile int
|
/*1: It was the last chunk to flush. (It can't be a bi tfield because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
|
||||||
flushing_last; /*1: It was the last chunk to flush. (It can't be a bitfield because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
|
volatile int flushing_last;
|
||||||
volatile uint32_t last_area : 1; /*1: the last area is being rendered*/
|
volatile uint32_t last_area : 1; /*1: the last area is being rendered*/
|
||||||
volatile uint32_t last_part : 1; /*1: the last part of the current area is being rendered*/
|
volatile uint32_t last_part : 1; /*1: the last part of the current area is being rendered*/
|
||||||
} lv_disp_buf_t;
|
} lv_disp_buf_t;
|
||||||
@@ -146,10 +146,18 @@ typedef struct _disp_t {
|
|||||||
|
|
||||||
/** Screens of the display*/
|
/** Screens of the display*/
|
||||||
lv_ll_t scr_ll;
|
lv_ll_t scr_ll;
|
||||||
struct _lv_obj_t * act_scr; /**< Currently active screen on this display */
|
struct _lv_obj_t * act_scr; /**< Currently active screen on this display */
|
||||||
|
struct _lv_obj_t * prev_scr; /**< Previous screen. Used during screen animations */
|
||||||
struct _lv_obj_t * top_layer; /**< @see lv_disp_get_layer_top */
|
struct _lv_obj_t * top_layer; /**< @see lv_disp_get_layer_top */
|
||||||
struct _lv_obj_t * sys_layer; /**< @see lv_disp_get_layer_sys */
|
struct _lv_obj_t * sys_layer; /**< @see lv_disp_get_layer_sys */
|
||||||
|
|
||||||
|
uint8_t del_prev :
|
||||||
|
1; /**< 1: Automatically delete the previous screen when the screen load animation is ready */
|
||||||
|
|
||||||
|
lv_color_t bg_color; /**< Default display color when screens are transparent*/
|
||||||
|
const void * bg_img; /**< An image source to display as wallpaper*/
|
||||||
|
lv_opa_t bg_opa; /**<Opacity of the background color or wallpaper */
|
||||||
|
|
||||||
/** Invalidated (marked to redraw) areas*/
|
/** Invalidated (marked to redraw) areas*/
|
||||||
lv_area_t inv_areas[LV_INV_BUF_SIZE];
|
lv_area_t inv_areas[LV_INV_BUF_SIZE];
|
||||||
uint8_t inv_area_joined[LV_INV_BUF_SIZE];
|
uint8_t inv_area_joined[LV_INV_BUF_SIZE];
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
/*********************
|
/*********************
|
||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
#include "../lv_core/lv_debug.h"
|
#include "../lv_misc/lv_debug.h"
|
||||||
#include "../lv_hal/lv_hal_indev.h"
|
#include "../lv_hal/lv_hal_indev.h"
|
||||||
#include "../lv_core/lv_indev.h"
|
#include "../lv_core/lv_indev.h"
|
||||||
#include "../lv_misc/lv_mem.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) driver->disp = lv_disp_get_default();
|
||||||
|
|
||||||
if(driver->disp == NULL) {
|
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");
|
"a display");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -143,6 +143,11 @@ bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
|
|||||||
else if(indev->driver.type == LV_INDEV_TYPE_KEYPAD) {
|
else if(indev->driver.type == LV_INDEV_TYPE_KEYPAD) {
|
||||||
data->key = indev->proc.types.keypad.last_key;
|
data->key = indev->proc.types.keypad.last_key;
|
||||||
}
|
}
|
||||||
|
/*For compatibility assume that used button was enter (encoder push) */
|
||||||
|
else if(indev->driver.type == LV_INDEV_TYPE_ENCODER) {
|
||||||
|
data->key = LV_KEY_ENTER;
|
||||||
|
data->enc_diff = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(indev->driver.read_cb) {
|
if(indev->driver.read_cb) {
|
||||||
LV_LOG_TRACE("idnev read started");
|
LV_LOG_TRACE("idnev read started");
|
||||||
|
|||||||
@@ -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_sum; /*Count the dragged pixels to check LV_INDEV_DEF_DRAG_LIMIT*/
|
||||||
lv_point_t drag_throw_vect;
|
lv_point_t drag_throw_vect;
|
||||||
struct _lv_obj_t * act_obj; /*The object being pressed*/
|
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)*/
|
other post-release event)*/
|
||||||
struct _lv_obj_t * last_pressed; /*The lastly pressed object*/
|
struct _lv_obj_t * last_pressed; /*The lastly pressed object*/
|
||||||
|
|
||||||
|
|||||||
@@ -56,12 +56,17 @@ LV_ATTRIBUTE_TICK_INC void lv_tick_inc(uint32_t tick_period)
|
|||||||
uint32_t lv_tick_get(void)
|
uint32_t lv_tick_get(void)
|
||||||
{
|
{
|
||||||
#if LV_TICK_CUSTOM == 0
|
#if LV_TICK_CUSTOM == 0
|
||||||
|
|
||||||
|
/* If `lv_tick_inc` is called from an interrupt while `sys_time` is read
|
||||||
|
* the result might be corrupted.
|
||||||
|
* This loop detects if `lv_tick_inc` was called while reading `sys_time`.
|
||||||
|
* If `tick_irq_flag` was cleared in `lv_tick_inc` try to read again
|
||||||
|
* until `tick_irq_flag` remains `1`. */
|
||||||
uint32_t result;
|
uint32_t result;
|
||||||
do {
|
do {
|
||||||
tick_irq_flag = 1;
|
tick_irq_flag = 1;
|
||||||
result = sys_time;
|
result = sys_time;
|
||||||
} while(!tick_irq_flag); /*'lv_tick_inc()' clears this flag which can be in an interrupt.
|
} while(!tick_irq_flag); /*Continue until see a non interrupted cycle */
|
||||||
Continue until make a non interrupted cycle */
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#if LV_USE_ANIMATION
|
#if LV_USE_ANIMATION
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.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_hal/lv_hal_tick.h"
|
||||||
#include "lv_task.h"
|
#include "lv_task.h"
|
||||||
#include "lv_math.h"
|
#include "lv_math.h"
|
||||||
@@ -64,7 +64,7 @@ void _lv_anim_core_init(void)
|
|||||||
last_task_run = lv_tick_get();
|
last_task_run = lv_tick_get();
|
||||||
_lv_anim_task = lv_task_create(anim_task, LV_DISP_DEF_REFR_PERIOD, LV_ANIM_TASK_PRIO, NULL);
|
_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_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_t a;
|
||||||
* lv_anim_init(&a);
|
* lv_anim_init(&a);
|
||||||
* lv_anim_set_...(&a);
|
* lv_anim_set_...(&a);
|
||||||
* lv_anim_craete(&a);
|
|
||||||
* @param a pointer to an `lv_anim_t` variable to initialize
|
* @param a pointer to an `lv_anim_t` variable to initialize
|
||||||
*/
|
*/
|
||||||
void lv_anim_init(lv_anim_t * a)
|
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
|
* Called when an animation is ready to do the necessary thinks
|
||||||
* e.g. repeat, play back, delete etc.
|
* e.g. repeat, play back, delete etc.
|
||||||
* @param a pointer to an animation descriptor
|
* @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)
|
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*/
|
/*If the animation is not deleted then restart it*/
|
||||||
else {
|
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*/
|
/*Swap the start and end values in play back mode*/
|
||||||
if(a->playback_time != 0) {
|
if(a->playback_time != 0) {
|
||||||
/*If now turning back use the 'playback_pause*/
|
/*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*/
|
/*Toggle the play back state*/
|
||||||
a->playback_now = a->playback_now == 0 ? 1 : 0;
|
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_t a;
|
||||||
* lv_anim_init(&a);
|
* lv_anim_init(&a);
|
||||||
* lv_anim_set_...(&a);
|
* lv_anim_set_...(&a);
|
||||||
* lv_anim_create(&a);
|
|
||||||
* @param a pointer to an `lv_anim_t` variable to initialize
|
* @param a pointer to an `lv_anim_t` variable to initialize
|
||||||
*/
|
*/
|
||||||
void lv_anim_init(lv_anim_t * a);
|
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)
|
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
|
* Call an asynchronous function the next time lv_task_handler() is run. This function is likely to return
|
||||||
* **before** the call actually happens!
|
* **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 'x' in the argument name indicates that its not a fully generic function because it not follows
|
||||||
* the `func_name(object, callback, ...)` convention)
|
* the `func_name(object, callback, ...)` convention)
|
||||||
* @param user_data custom parameter
|
* @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
|
* Can be `NULL` is unused
|
||||||
* @param len length of the line in character count
|
* @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 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 visual_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 is_rtl tell the the char at `visual_pos` is RTL or LTR context
|
||||||
* @return the logical character position
|
* @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,
|
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
|
* Bidi process a paragraph of text
|
||||||
* @param str_in the string to process
|
* @param str_in the string to process
|
||||||
* @param str_out store the result here
|
* @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 base_dir base dir of the text
|
||||||
* @param pos_conv_out an `uint16_t` array to store the related logical position of the character.
|
* @param pos_conv_out an `uint16_t` array to store the related logical position of the character.
|
||||||
* Can be `NULL` is unused
|
* 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
|
* Can be `NULL` is unused
|
||||||
* @param len length of the line in character count
|
* @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 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 visual_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 is_rtl tell the the char at `visual_pos` is RTL or LTR context
|
||||||
* @return the logical character position
|
* @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,
|
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
|
* Bidi process a paragraph of text
|
||||||
* @param str_in the string to process
|
* @param str_in the string to process
|
||||||
* @param str_out store the result here
|
* @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 base_dir base dir of the text
|
||||||
* @param pos_conv_out an `uint16_t` array to store the related logical position of the character.
|
* @param pos_conv_out an `uint16_t` array to store the related logical position of the character.
|
||||||
* Can be `NULL` is unused
|
* Can be `NULL` is unused
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ enum {
|
|||||||
LV_OPA_COVER = 255,
|
LV_OPA_COVER = 255,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LV_OPA_MIN 5 /*Opacities below this will be transparent*/
|
#define LV_OPA_MIN 2 /*Opacities below this will be transparent*/
|
||||||
#define LV_OPA_MAX 250 /*Opacities above this will fully cover*/
|
#define LV_OPA_MAX 253 /*Opacities above this will fully cover*/
|
||||||
|
|
||||||
#if LV_COLOR_DEPTH == 1
|
#if LV_COLOR_DEPTH == 1
|
||||||
#define LV_COLOR_SIZE 8
|
#define LV_COLOR_SIZE 8
|
||||||
@@ -390,7 +390,7 @@ static inline uint32_t lv_color_to32(lv_color_t color)
|
|||||||
{
|
{
|
||||||
#if LV_COLOR_DEPTH == 1
|
#if LV_COLOR_DEPTH == 1
|
||||||
if(color.full == 0)
|
if(color.full == 0)
|
||||||
return 0;
|
return 0xFF000000;
|
||||||
else
|
else
|
||||||
return 0xFFFFFFFF;
|
return 0xFFFFFFFF;
|
||||||
#elif LV_COLOR_DEPTH == 8
|
#elif LV_COLOR_DEPTH == 8
|
||||||
@@ -456,9 +456,12 @@ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t lv_color_mix(lv_color_t c1, lv_co
|
|||||||
lv_color_t ret;
|
lv_color_t ret;
|
||||||
#if LV_COLOR_DEPTH != 1
|
#if LV_COLOR_DEPTH != 1
|
||||||
/*LV_COLOR_DEPTH == 8, 16 or 32*/
|
/*LV_COLOR_DEPTH == 8, 16 or 32*/
|
||||||
LV_COLOR_SET_R(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_R(c1) * mix + LV_COLOR_GET_R(c2) * (255 - mix) + LV_COLOR_MIX_ROUND_OFS));
|
LV_COLOR_SET_R(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_R(c1) * mix + LV_COLOR_GET_R(c2) *
|
||||||
LV_COLOR_SET_G(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_G(c1) * mix + LV_COLOR_GET_G(c2) * (255 - mix) + LV_COLOR_MIX_ROUND_OFS));
|
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
|
||||||
LV_COLOR_SET_B(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_B(c1) * mix + LV_COLOR_GET_B(c2) * (255 - mix) + LV_COLOR_MIX_ROUND_OFS));
|
LV_COLOR_SET_G(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_G(c1) * mix + LV_COLOR_GET_G(c2) *
|
||||||
|
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
|
||||||
|
LV_COLOR_SET_B(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_B(c1) * mix + LV_COLOR_GET_B(c2) *
|
||||||
|
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
|
||||||
LV_COLOR_SET_A(ret, 0xFF);
|
LV_COLOR_SET_A(ret, 0xFF);
|
||||||
#else
|
#else
|
||||||
/*LV_COLOR_DEPTH == 1*/
|
/*LV_COLOR_DEPTH == 1*/
|
||||||
|
|||||||
@@ -6,11 +6,13 @@
|
|||||||
/*********************
|
/*********************
|
||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
#include "lv_obj.h"
|
|
||||||
#include "lv_debug.h"
|
#include "lv_debug.h"
|
||||||
|
|
||||||
#if LV_USE_DEBUG
|
#if LV_USE_DEBUG
|
||||||
|
|
||||||
|
#include "lv_mem.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
@@ -28,7 +30,6 @@
|
|||||||
/**********************
|
/**********************
|
||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find);
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
@@ -54,68 +55,6 @@ bool lv_debug_check_mem_integrity(void)
|
|||||||
return lv_mem_test() == LV_RES_OK ? true : false;
|
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)
|
bool lv_debug_check_str(const void * str)
|
||||||
{
|
{
|
||||||
const uint8_t * s = (const uint8_t *)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 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*/
|
#endif /*LV_USE_DEBUG*/
|
||||||
|
|
||||||
@@ -13,9 +13,10 @@ extern "C" {
|
|||||||
/*********************
|
/*********************
|
||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
#include "lv_obj.h"
|
#include "../lv_conf_internal.h"
|
||||||
|
|
||||||
#if LV_USE_DEBUG
|
#if LV_USE_DEBUG
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
@@ -32,14 +33,6 @@ bool lv_debug_check_null(const void * p);
|
|||||||
|
|
||||||
bool lv_debug_check_mem_integrity(void);
|
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);
|
bool lv_debug_check_str(const void * str);
|
||||||
|
|
||||||
void lv_debug_log_error(const char * msg, uint64_t value);
|
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))
|
lv_debug_check_str(str))
|
||||||
#endif
|
#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
|
* ASSERTS
|
||||||
*-----------------*/
|
*-----------------*/
|
||||||
@@ -133,30 +112,6 @@ void lv_debug_log_error(const char * msg, uint64_t value);
|
|||||||
# endif
|
# endif
|
||||||
#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 */
|
#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_MEM_INTEGRITY() true
|
||||||
#define LV_ASSERT_STR(p) true
|
#define LV_ASSERT_STR(p) true
|
||||||
#define LV_ASSERT_OBJ(obj, obj_type) 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 */
|
#endif /* LV_USE_DEBUG */
|
||||||
/*clang-format on*/
|
/*clang-format on*/
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "lv_fs.h"
|
#include "lv_fs.h"
|
||||||
#if LV_USE_FILESYSTEM
|
#if LV_USE_FILESYSTEM
|
||||||
|
|
||||||
#include "../lv_core/lv_debug.h"
|
#include "../lv_misc/lv_debug.h"
|
||||||
#include "lv_ll.h"
|
#include "lv_ll.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "lv_gc.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.
|
* returned.
|
||||||
* @param letter letter of the drive
|
* @param letter letter of the drive
|
||||||
* @return true: drive is ready; false: drive is not ready
|
* @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);
|
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.
|
* returned.
|
||||||
* @param letter letter of the drive
|
* @param letter letter of the drive
|
||||||
* @return true: drive is ready; false: drive is not ready
|
* @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->head = NULL;
|
||||||
ll_p->tail = NULL;
|
ll_p->tail = NULL;
|
||||||
#ifdef LV_MEM_ENV64
|
#ifdef LV_ARCH_64
|
||||||
/*Round the size up to 8*/
|
/*Round the size up to 8*/
|
||||||
if(node_size & 0x7) {
|
node_size = (node_size + 7) & (~0x7);
|
||||||
node_size = node_size & (~0x7);
|
|
||||||
node_size += 8;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
/*Round the size up to 4*/
|
/*Round the size up to 4*/
|
||||||
if(node_size & 0x3) {
|
node_size = (node_size + 3) & (~0x3);
|
||||||
node_size = node_size & (~0x3);
|
|
||||||
node_size += 4;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ll_p->n_size = node_size;
|
ll_p->n_size = node_size;
|
||||||
@@ -140,7 +134,7 @@ void * _lv_ll_ins_tail(lv_ll_t * ll_p)
|
|||||||
|
|
||||||
if(n_new != NULL) {
|
if(n_new != NULL) {
|
||||||
node_set_next(ll_p, n_new, NULL); /*No next after the new tail*/
|
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*/
|
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);
|
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 ll_p pointer to a linked list
|
||||||
* @param n_act pointer to node to move
|
* @param n_act pointer to node to move
|
||||||
* @param n_after pointer to a node which should be after `n_act`
|
* @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`*/
|
if(act == NULL) return; /*Can't set the prev node of `NULL`*/
|
||||||
|
|
||||||
uint8_t * act8 = (uint8_t *) act;
|
uint8_t * act8 = (uint8_t *) act;
|
||||||
uint8_t * prev8 = (uint8_t *) &prev;
|
|
||||||
|
|
||||||
act8 += LL_PREV_P_OFFSET(ll_p);
|
act8 += LL_PREV_P_OFFSET(ll_p);
|
||||||
|
|
||||||
uint32_t i;
|
lv_ll_node_t ** act_node_p = (lv_ll_node_t **) act8;
|
||||||
for(i = 0; i < sizeof(lv_ll_node_t *); i++) {
|
lv_ll_node_t ** prev_node_p = (lv_ll_node_t **) &prev;
|
||||||
act8[i] = prev8[i];
|
|
||||||
}
|
*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`*/
|
if(act == NULL) return; /*Can't set the next node of `NULL`*/
|
||||||
uint8_t * act8 = (uint8_t *) act;
|
uint8_t * act8 = (uint8_t *) act;
|
||||||
uint8_t * prev8 = (uint8_t *) &next;
|
|
||||||
|
|
||||||
act8 += LL_NEXT_P_OFFSET(ll_p);
|
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;
|
*act_node_p = *next_node_p;
|
||||||
for(i = 0; i < sizeof(lv_ll_node_t *); i++) {
|
|
||||||
act8[i] = prev8[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 ll_p pointer to a linked list
|
||||||
* @param n_act pointer to node to move
|
* @param n_act pointer to node to move
|
||||||
* @param n_after pointer to a node which should be after `n_act`
|
* @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.
|
* Register custom print/write function to call when a log is added.
|
||||||
* It can format its "File path", "Line number" and "Description" as required
|
* 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
|
* @param print_cb a function pointer to print a log
|
||||||
*/
|
*/
|
||||||
void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb)
|
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.
|
* Register custom print/write function to call when a log is added.
|
||||||
* It can format its "File path", "Line number" and "Description" as required
|
* 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
|
* @param print_cb a function pointer to print a log
|
||||||
*/
|
*/
|
||||||
void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb);
|
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
|
* 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 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.
|
* @param mask: optional to skip some iterations if the magnitude of the root is known.
|
||||||
* Set to 0x8000 by default.
|
* Set to 0x8000 by default.
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ uint16_t _lv_atan2(int x, int y);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the square root of a number
|
* 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 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.
|
* @param mask: optional to skip some iterations if the magnitude of the root is known.
|
||||||
* Set to 0x8000 by default.
|
* Set to 0x8000 by default.
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ typedef struct {
|
|||||||
|
|
||||||
static uint32_t zero_mem; /*Give the address of this variable if 0 byte should be allocated*/
|
static uint32_t zero_mem; /*Give the address of this variable if 0 byte should be allocated*/
|
||||||
|
|
||||||
|
#if LV_MEM_CUSTOM == 0
|
||||||
|
static uint32_t mem_max_size; /*Tracks the maximum total size of memory ever used from the internal heap*/
|
||||||
|
#endif
|
||||||
|
|
||||||
static uint8_t mem_buf1_32[MEM_BUF_SMALL_SIZE];
|
static uint8_t mem_buf1_32[MEM_BUF_SMALL_SIZE];
|
||||||
static uint8_t mem_buf2_32[MEM_BUF_SMALL_SIZE];
|
static uint8_t mem_buf2_32[MEM_BUF_SMALL_SIZE];
|
||||||
@@ -108,7 +111,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)
|
void _lv_mem_init(void)
|
||||||
{
|
{
|
||||||
@@ -118,6 +121,7 @@ void _lv_mem_init(void)
|
|||||||
/*Allocate a large array to store the dynamically allocated data*/
|
/*Allocate a large array to store the dynamically allocated data*/
|
||||||
static LV_MEM_ATTR MEM_UNIT work_mem_int[LV_MEM_SIZE / sizeof(MEM_UNIT)];
|
static LV_MEM_ATTR MEM_UNIT work_mem_int[LV_MEM_SIZE / sizeof(MEM_UNIT)];
|
||||||
work_mem = (uint8_t *)work_mem_int;
|
work_mem = (uint8_t *)work_mem_int;
|
||||||
|
mem_max_size = 0;
|
||||||
#else
|
#else
|
||||||
work_mem = (uint8_t *)LV_MEM_ADR;
|
work_mem = (uint8_t *)LV_MEM_ADR;
|
||||||
#endif
|
#endif
|
||||||
@@ -157,16 +161,10 @@ void * lv_mem_alloc(size_t size)
|
|||||||
|
|
||||||
#ifdef LV_ARCH_64
|
#ifdef LV_ARCH_64
|
||||||
/*Round the size up to 8*/
|
/*Round the size up to 8*/
|
||||||
if(size & 0x7) {
|
size = (size + 7) & (~0x7);
|
||||||
size = size & (~0x7);
|
|
||||||
size += 8;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
/*Round the size up to 4*/
|
/*Round the size up to 4*/
|
||||||
if(size & 0x3) {
|
size = (size + 3) & (~0x3);
|
||||||
size = size & (~0x3);
|
|
||||||
size += 4;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
void * alloc = NULL;
|
void * alloc = NULL;
|
||||||
|
|
||||||
@@ -206,7 +204,19 @@ void * lv_mem_alloc(size_t size)
|
|||||||
if(alloc != NULL) _lv_memset(alloc, 0xaa, size);
|
if(alloc != NULL) _lv_memset(alloc, 0xaa, size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(alloc == NULL) LV_LOG_WARN("Couldn't allocate memory");
|
if(alloc == NULL) {
|
||||||
|
LV_LOG_WARN("Couldn't allocate memory");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#if LV_MEM_CUSTOM == 0
|
||||||
|
/* just a safety check, should always be true */
|
||||||
|
if((uintptr_t) alloc > (uintptr_t) work_mem) {
|
||||||
|
if((((uintptr_t) alloc - (uintptr_t) work_mem) + size) > mem_max_size) {
|
||||||
|
mem_max_size = ((uintptr_t) alloc - (uintptr_t) work_mem) + size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return alloc;
|
return alloc;
|
||||||
}
|
}
|
||||||
@@ -281,16 +291,10 @@ void * lv_mem_realloc(void * data_p, size_t new_size)
|
|||||||
|
|
||||||
#ifdef LV_ARCH_64
|
#ifdef LV_ARCH_64
|
||||||
/*Round the size up to 8*/
|
/*Round the size up to 8*/
|
||||||
if(new_size & 0x7) {
|
new_size = (new_size + 7) & (~0x7);
|
||||||
new_size = new_size & (~0x7);
|
|
||||||
new_size += 8;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
/*Round the size up to 4*/
|
/*Round the size up to 4*/
|
||||||
if(new_size & 0x3) {
|
new_size = (new_size + 3) & (~0x3);
|
||||||
new_size = new_size & (~0x3);
|
|
||||||
new_size += 4;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*data_p could be previously freed pointer (in this case it is invalid)*/
|
/*data_p could be previously freed pointer (in this case it is invalid)*/
|
||||||
@@ -436,6 +440,7 @@ void lv_mem_monitor(lv_mem_monitor_t * mon_p)
|
|||||||
e = ent_get_next(e);
|
e = ent_get_next(e);
|
||||||
}
|
}
|
||||||
mon_p->total_size = LV_MEM_SIZE;
|
mon_p->total_size = LV_MEM_SIZE;
|
||||||
|
mon_p->max_used = mem_max_size;
|
||||||
mon_p->used_pct = 100 - (100U * mon_p->free_size) / mon_p->total_size;
|
mon_p->used_pct = 100 - (100U * mon_p->free_size) / mon_p->total_size;
|
||||||
if(mon_p->free_size > 0) {
|
if(mon_p->free_size > 0) {
|
||||||
mon_p->frag_pct = (uint32_t)mon_p->free_biggest_size * 100U / mon_p->free_size;
|
mon_p->frag_pct = (uint32_t)mon_p->free_biggest_size * 100U / mon_p->free_size;
|
||||||
@@ -525,14 +530,13 @@ void * _lv_mem_buf_get(uint32_t size)
|
|||||||
/*if this fails you probably need to increase your LV_MEM_SIZE/heap 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);
|
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) {
|
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;
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,6 +586,7 @@ void _lv_mem_buf_free_all(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LV_MEMCPY_MEMSET_STD == 0
|
||||||
/**
|
/**
|
||||||
* Same as `memcpy` but optimized for 4 byte operation.
|
* Same as `memcpy` but optimized for 4 byte operation.
|
||||||
* @param dst pointer to the destination buffer
|
* @param dst pointer to the destination buffer
|
||||||
@@ -648,7 +653,6 @@ LV_ATTRIBUTE_FAST_MEM void * _lv_memcpy(void * dst, const void * src, size_t len
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as `memset` but optimized for 4 byte operation.
|
* Same as `memset` but optimized for 4 byte operation.
|
||||||
* `dst` should be word aligned else normal `memcpy` will be used
|
|
||||||
* @param dst pointer to the destination buffer
|
* @param dst pointer to the destination buffer
|
||||||
* @param v value to set [0..255]
|
* @param v value to set [0..255]
|
||||||
* @param len number of byte to set
|
* @param len number of byte to set
|
||||||
@@ -703,7 +707,6 @@ LV_ATTRIBUTE_FAST_MEM void _lv_memset(void * dst, uint8_t v, size_t len)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as `memset(dst, 0x00, len)` but optimized for 4 byte operation.
|
* Same as `memset(dst, 0x00, len)` but optimized for 4 byte operation.
|
||||||
* `dst` should be word aligned else normal `memcpy` will be used
|
|
||||||
* @param dst pointer to the destination buffer
|
* @param dst pointer to the destination buffer
|
||||||
* @param len number of byte to set
|
* @param len number of byte to set
|
||||||
*/
|
*/
|
||||||
@@ -753,7 +756,6 @@ LV_ATTRIBUTE_FAST_MEM void _lv_memset_00(void * dst, size_t len)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as `memset(dst, 0xFF, len)` but optimized for 4 byte operation.
|
* Same as `memset(dst, 0xFF, len)` but optimized for 4 byte operation.
|
||||||
* `dst` should be word aligned else normal `memcpy` will be used
|
|
||||||
* @param dst pointer to the destination buffer
|
* @param dst pointer to the destination buffer
|
||||||
* @param len number of byte to set
|
* @param len number of byte to set
|
||||||
*/
|
*/
|
||||||
@@ -801,6 +803,7 @@ LV_ATTRIBUTE_FAST_MEM void _lv_memset_ff(void * dst, size_t len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /*LV_MEMCPY_MEMSET_STD*/
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC FUNCTIONS
|
* STATIC FUNCTIONS
|
||||||
@@ -858,18 +861,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)
|
static void ent_trunc(lv_mem_ent_t * e, size_t size)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef LV_ARCH_64
|
#ifdef LV_ARCH_64
|
||||||
/*Round the size up to 8*/
|
/*Round the size up to 8*/
|
||||||
if(size & 0x7) {
|
size = (size + 7) & (~0x7);
|
||||||
size = size & (~0x7);
|
|
||||||
size += 8;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
/*Round the size up to 4*/
|
/*Round the size up to 4*/
|
||||||
if(size & 0x3) {
|
size = (size + 3) & (~0x3);
|
||||||
size = size & (~0x3);
|
|
||||||
size += 4;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*Don't let empty space only for a header without data*/
|
/*Don't let empty space only for a header without data*/
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ extern "C" {
|
|||||||
#include "lv_log.h"
|
#include "lv_log.h"
|
||||||
#include "lv_types.h"
|
#include "lv_types.h"
|
||||||
|
|
||||||
|
#if LV_MEMCPY_MEMSET_STD
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
@@ -41,6 +45,7 @@ typedef struct {
|
|||||||
uint32_t free_size; /**< Size of available memory */
|
uint32_t free_size; /**< Size of available memory */
|
||||||
uint32_t free_biggest_size;
|
uint32_t free_biggest_size;
|
||||||
uint32_t used_cnt;
|
uint32_t used_cnt;
|
||||||
|
uint32_t max_used; /**< Max size of Heap memory used */
|
||||||
uint8_t used_pct; /**< Percentage used */
|
uint8_t used_pct; /**< Percentage used */
|
||||||
uint8_t frag_pct; /**< Amount of fragmentation */
|
uint8_t frag_pct; /**< Amount of fragmentation */
|
||||||
} lv_mem_monitor_t;
|
} lv_mem_monitor_t;
|
||||||
@@ -59,7 +64,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);
|
void _lv_mem_init(void);
|
||||||
|
|
||||||
@@ -136,6 +141,62 @@ void _lv_mem_buf_free_all(void);
|
|||||||
|
|
||||||
//! @cond Doxygen_Suppress
|
//! @cond Doxygen_Suppress
|
||||||
|
|
||||||
|
#if LV_MEMCPY_MEMSET_STD
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper for the standard memcpy
|
||||||
|
* @param dst pointer to the destination buffer
|
||||||
|
* @param src pointer to the source buffer
|
||||||
|
* @param len number of byte to copy
|
||||||
|
*/
|
||||||
|
static inline void * _lv_memcpy(void * dst, const void * src, size_t len)
|
||||||
|
{
|
||||||
|
return memcpy(dst, src, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper for the standard memcpy
|
||||||
|
* @param dst pointer to the destination buffer
|
||||||
|
* @param src pointer to the source buffer
|
||||||
|
* @param len number of byte to copy
|
||||||
|
*/
|
||||||
|
static inline void * _lv_memcpy_small(void * dst, const void * src, size_t len)
|
||||||
|
{
|
||||||
|
return memcpy(dst, src, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper for the standard memset
|
||||||
|
* @param dst pointer to the destination buffer
|
||||||
|
* @param v value to set [0..255]
|
||||||
|
* @param len number of byte to set
|
||||||
|
*/
|
||||||
|
static inline void _lv_memset(void * dst, uint8_t v, size_t len)
|
||||||
|
{
|
||||||
|
memset(dst, v, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper for the standard memset with fixed 0x00 value
|
||||||
|
* @param dst pointer to the destination buffer
|
||||||
|
* @param len number of byte to set
|
||||||
|
*/
|
||||||
|
static inline void _lv_memset_00(void * dst, size_t len)
|
||||||
|
{
|
||||||
|
memset(dst, 0x00, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper for the standard memset with fixed 0xFF value
|
||||||
|
* @param dst pointer to the destination buffer
|
||||||
|
* @param len number of byte to set
|
||||||
|
*/
|
||||||
|
static inline void _lv_memset_ff(void * dst, size_t len)
|
||||||
|
{
|
||||||
|
memset(dst, 0xFF, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
/**
|
/**
|
||||||
* Same as `memcpy` but optimized for 4 byte operation.
|
* Same as `memcpy` but optimized for 4 byte operation.
|
||||||
* @param dst pointer to the destination buffer
|
* @param dst pointer to the destination buffer
|
||||||
@@ -167,7 +228,6 @@ LV_ATTRIBUTE_FAST_MEM static inline void * _lv_memcpy_small(void * dst, const vo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as `memset` but optimized for 4 byte operation.
|
* Same as `memset` but optimized for 4 byte operation.
|
||||||
* `dst` should be word aligned else normal `memcpy` will be used
|
|
||||||
* @param dst pointer to the destination buffer
|
* @param dst pointer to the destination buffer
|
||||||
* @param v value to set [0..255]
|
* @param v value to set [0..255]
|
||||||
* @param len number of byte to set
|
* @param len number of byte to set
|
||||||
@@ -176,7 +236,6 @@ LV_ATTRIBUTE_FAST_MEM void _lv_memset(void * dst, uint8_t v, size_t len);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as `memset(dst, 0x00, len)` but optimized for 4 byte operation.
|
* Same as `memset(dst, 0x00, len)` but optimized for 4 byte operation.
|
||||||
* `dst` should be word aligned else normal `memcpy` will be used
|
|
||||||
* @param dst pointer to the destination buffer
|
* @param dst pointer to the destination buffer
|
||||||
* @param len number of byte to set
|
* @param len number of byte to set
|
||||||
*/
|
*/
|
||||||
@@ -184,7 +243,6 @@ LV_ATTRIBUTE_FAST_MEM void _lv_memset_00(void * dst, size_t len);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as `memset(dst, 0xFF, len)` but optimized for 4 byte operation.
|
* Same as `memset(dst, 0xFF, len)` but optimized for 4 byte operation.
|
||||||
* `dst` should be word aligned else normal `memcpy` will be used
|
|
||||||
* @param dst pointer to the destination buffer
|
* @param dst pointer to the destination buffer
|
||||||
* @param len number of byte to set
|
* @param len number of byte to set
|
||||||
*/
|
*/
|
||||||
@@ -192,6 +250,9 @@ LV_ATTRIBUTE_FAST_MEM void _lv_memset_ff(void * dst, size_t len);
|
|||||||
|
|
||||||
//! @endcond
|
//! @endcond
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ CSRCS += lv_utils.c
|
|||||||
CSRCS += lv_async.c
|
CSRCS += lv_async.c
|
||||||
CSRCS += lv_printf.c
|
CSRCS += lv_printf.c
|
||||||
CSRCS += lv_bidi.c
|
CSRCS += lv_bidi.c
|
||||||
|
CSRCS += lv_debug.c
|
||||||
|
|
||||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc
|
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc
|
||||||
VPATH += :$(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 <stddef.h>
|
||||||
#include "lv_task.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_hal/lv_hal_tick.h"
|
||||||
#include "lv_gc.h"
|
#include "lv_gc.h"
|
||||||
|
|
||||||
@@ -193,9 +193,9 @@ LV_ATTRIBUTE_TASK_HANDLER uint32_t lv_task_handler(void)
|
|||||||
return time_till_next;
|
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`
|
* `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)
|
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
|
* @param user_data custom parameter
|
||||||
* @return pointer to the new task
|
* @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_task_t * new_task = lv_task_create_basic();
|
||||||
LV_ASSERT_MEM(new_task);
|
LV_ASSERT_MEM(new_task);
|
||||||
if(new_task == NULL) return NULL;
|
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_period(new_task, period);
|
||||||
lv_task_set_prio(new_task, prio);
|
lv_task_set_prio(new_task, prio);
|
||||||
new_task->user_data = user_data;
|
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)
|
* Set the callback the task (the function to call periodically)
|
||||||
* @param task pointer to a task
|
* @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)
|
void lv_task_set_cb(lv_task_t * task, lv_task_cb_t task_cb)
|
||||||
{
|
{
|
||||||
@@ -378,6 +378,17 @@ uint8_t lv_task_get_idle(void)
|
|||||||
return idle_last;
|
return idle_last;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterate through the tasks
|
||||||
|
* @param task NULL to start iteration or the previous return value to get the next task
|
||||||
|
* @return the next task or NULL if there is no more task
|
||||||
|
*/
|
||||||
|
lv_task_t * lv_task_get_next(lv_task_t * task)
|
||||||
|
{
|
||||||
|
if(task == NULL) return _lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll));
|
||||||
|
else return _lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), task);
|
||||||
|
}
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC FUNCTIONS
|
* STATIC FUNCTIONS
|
||||||
**********************/
|
**********************/
|
||||||
|
|||||||
@@ -88,9 +88,9 @@ LV_ATTRIBUTE_TASK_HANDLER uint32_t lv_task_handler(void);
|
|||||||
//! @endcond
|
//! @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`
|
* `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);
|
lv_task_t * lv_task_create_basic(void);
|
||||||
|
|
||||||
@@ -165,6 +165,13 @@ void lv_task_enable(bool en);
|
|||||||
*/
|
*/
|
||||||
uint8_t lv_task_get_idle(void);
|
uint8_t lv_task_get_idle(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterate through the tasks
|
||||||
|
* @param task NULL to start iteration or the previous return value to get the next task
|
||||||
|
* @return the next task or NULL if there is no more task
|
||||||
|
*/
|
||||||
|
lv_task_t * lv_task_get_next(lv_task_t * task);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
|
|||||||
@@ -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.
|
* 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"
|
* txt = "Test text\n"
|
||||||
* 0123456789
|
* 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.
|
* @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)
|
* @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_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)
|
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
|
* @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)
|
* @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)
|
lv_coord_t letter_space, lv_coord_t max_width, lv_txt_flag_t flag)
|
||||||
{
|
{
|
||||||
if(txt == NULL) return 0;
|
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
|
* @param flags settings for the text from 'txt_flag_t' enum
|
||||||
* @return length of a char_num long text
|
* @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)
|
lv_txt_flag_t flag)
|
||||||
{
|
{
|
||||||
if(txt == NULL) return 0;
|
if(txt == NULL) return 0;
|
||||||
@@ -534,6 +534,7 @@ static uint32_t lv_txt_unicode_to_utf8(uint32_t letter_uni)
|
|||||||
*/
|
*/
|
||||||
static uint32_t lv_txt_utf8_conv_wc(uint32_t c)
|
static uint32_t lv_txt_utf8_conv_wc(uint32_t c)
|
||||||
{
|
{
|
||||||
|
#if LV_BIG_ENDIAN_SYSTEM == 0
|
||||||
/*Swap the bytes (UTF-8 is big endian, but the MCUs are little endian)*/
|
/*Swap the bytes (UTF-8 is big endian, but the MCUs are little endian)*/
|
||||||
if((c & 0x80) != 0) {
|
if((c & 0x80) != 0) {
|
||||||
uint32_t swapped;
|
uint32_t swapped;
|
||||||
@@ -547,7 +548,7 @@ static uint32_t lv_txt_utf8_conv_wc(uint32_t c)
|
|||||||
}
|
}
|
||||||
c = swapped;
|
c = swapped;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
* @return the index of the first char of the new line (in byte index not letter index. With UTF-8
|
||||||
* they are different)
|
* 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);
|
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
|
* @param flags settings for the text from 'txt_flag_t' enum
|
||||||
* @return length of a char_num long text
|
* @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);
|
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
|
* @param state pointer to a txt_cmd_state_t variable which stores the current state of command
|
||||||
* processing
|
* processing
|
||||||
* @param c the current character
|
* @param c the current character
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
/*********************
|
/*********************
|
||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
#include "lv_theme.h"
|
#include "../../lvgl.h"
|
||||||
#include "../lv_core/lv_obj.h"
|
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
@@ -20,6 +19,8 @@
|
|||||||
/**********************
|
/**********************
|
||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
|
static void apply_theme(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name);
|
||||||
|
static void clear_styles(lv_obj_t * obj, lv_theme_style_t name);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
@@ -53,6 +54,69 @@ lv_theme_t * lv_theme_get_act(void)
|
|||||||
return act_theme;
|
return act_theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the active theme on an object
|
||||||
|
* @param obj pointer to an object
|
||||||
|
* @param name the name of the theme element to apply. E.g. `LV_THEME_BTN`
|
||||||
|
*/
|
||||||
|
void lv_theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||||
|
{
|
||||||
|
/* Remove the existing styles from all part of the object. */
|
||||||
|
clear_styles(obj, name);
|
||||||
|
|
||||||
|
/*Apply the theme including the base theme(s)*/
|
||||||
|
|
||||||
|
apply_theme(act_theme, obj, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy a theme to an other or initialize a theme
|
||||||
|
* @param theme pointer to a theme to initialize
|
||||||
|
* @param copy pointer to a theme to copy
|
||||||
|
* or `NULL` to initialize `theme` to empty
|
||||||
|
*/
|
||||||
|
void lv_theme_copy(lv_theme_t * theme, const lv_theme_t * copy)
|
||||||
|
{
|
||||||
|
_lv_memset_00(theme, sizeof(lv_theme_t));
|
||||||
|
|
||||||
|
if(copy) {
|
||||||
|
theme->font_small = copy->font_small;
|
||||||
|
theme->font_normal = copy->font_normal;
|
||||||
|
theme->font_subtitle = copy->font_subtitle;
|
||||||
|
theme->font_title = copy->font_title;
|
||||||
|
theme->color_primary = copy->color_primary;
|
||||||
|
theme->color_secondary = copy->color_secondary;
|
||||||
|
theme->flags = copy->flags;
|
||||||
|
theme->base = copy->base;
|
||||||
|
theme->apply_cb = copy->apply_cb;
|
||||||
|
theme->apply_xcb = copy->apply_xcb;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a base theme for a theme.
|
||||||
|
* The styles from the base them will be added before the styles of the current theme.
|
||||||
|
* Arbitrary long chain of themes can be created by setting base themes.
|
||||||
|
* @param new_theme pointer to theme which base should be set
|
||||||
|
* @param base pointer to the base theme
|
||||||
|
*/
|
||||||
|
void lv_theme_set_base(lv_theme_t * new_theme, lv_theme_t * base)
|
||||||
|
{
|
||||||
|
new_theme->base = base;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a callback for a theme.
|
||||||
|
* The callback is used to add styles to different objects
|
||||||
|
* @param theme pointer to theme which callback should be set
|
||||||
|
* @param cb pointer to the callback
|
||||||
|
*/
|
||||||
|
void lv_theme_set_apply_cb(lv_theme_t * theme, lv_theme_apply_cb_t apply_cb)
|
||||||
|
{
|
||||||
|
theme->apply_cb = apply_cb;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the small font of the theme
|
* Get the small font of the theme
|
||||||
* @return pointer to the font
|
* @return pointer to the font
|
||||||
@@ -116,12 +180,299 @@ uint32_t lv_theme_get_flags(void)
|
|||||||
return act_theme->flags;
|
return act_theme->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|
||||||
{
|
|
||||||
act_theme->apply_xcb(obj, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC FUNCTIONS
|
* STATIC FUNCTIONS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
static void apply_theme(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||||
|
{
|
||||||
|
if(th->base) {
|
||||||
|
apply_theme(th->base, obj, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*apply_xcb is deprecated, use apply_cb instead*/
|
||||||
|
if(th->apply_xcb) {
|
||||||
|
th->apply_xcb(obj, name);
|
||||||
|
}
|
||||||
|
else if(th->apply_cb) {
|
||||||
|
th->apply_cb(act_theme, obj, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void clear_styles(lv_obj_t * obj, lv_theme_style_t name)
|
||||||
|
{
|
||||||
|
switch(name) {
|
||||||
|
case LV_THEME_NONE:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LV_THEME_SCR:
|
||||||
|
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||||
|
break;
|
||||||
|
case LV_THEME_OBJ:
|
||||||
|
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#if LV_USE_CONT
|
||||||
|
case LV_THEME_CONT:
|
||||||
|
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_BTN
|
||||||
|
case LV_THEME_BTN:
|
||||||
|
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_BTNMATRIX
|
||||||
|
case LV_THEME_BTNMATRIX:
|
||||||
|
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_KEYBOARD
|
||||||
|
case LV_THEME_KEYBOARD:
|
||||||
|
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_BAR
|
||||||
|
case LV_THEME_BAR:
|
||||||
|
lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_SWITCH
|
||||||
|
case LV_THEME_SWITCH:
|
||||||
|
lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||||
|
lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_CANVAS
|
||||||
|
case LV_THEME_CANVAS:
|
||||||
|
lv_obj_clean_style_list(obj, LV_CANVAS_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_IMG
|
||||||
|
case LV_THEME_IMAGE:
|
||||||
|
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_IMGBTN
|
||||||
|
case LV_THEME_IMGBTN:
|
||||||
|
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_LABEL
|
||||||
|
case LV_THEME_LABEL:
|
||||||
|
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_LINE
|
||||||
|
case LV_THEME_LINE:
|
||||||
|
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_ARC
|
||||||
|
case LV_THEME_ARC:
|
||||||
|
lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_SPINNER
|
||||||
|
case LV_THEME_SPINNER:
|
||||||
|
lv_obj_clean_style_list(obj, LV_SPINNER_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_SLIDER
|
||||||
|
case LV_THEME_SLIDER:
|
||||||
|
lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||||
|
lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_CHECKBOX
|
||||||
|
case LV_THEME_CHECKBOX:
|
||||||
|
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_MSGBOX
|
||||||
|
case LV_THEME_MSGBOX:
|
||||||
|
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BG);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LV_THEME_MSGBOX_BTNS:
|
||||||
|
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#if LV_USE_LED
|
||||||
|
case LV_THEME_LED:
|
||||||
|
lv_obj_clean_style_list(obj, LV_LED_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if LV_USE_PAGE
|
||||||
|
case LV_THEME_PAGE:
|
||||||
|
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||||
|
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if LV_USE_TABVIEW
|
||||||
|
case LV_THEME_TABVIEW:
|
||||||
|
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||||
|
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||||
|
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LV_THEME_TABVIEW_PAGE:
|
||||||
|
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_TILEVIEW
|
||||||
|
case LV_THEME_TILEVIEW:
|
||||||
|
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||||
|
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if LV_USE_ROLLER
|
||||||
|
case LV_THEME_ROLLER:
|
||||||
|
lv_obj_clean_style_list(obj, LV_ROLLER_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if LV_USE_OBJMASK
|
||||||
|
case LV_THEME_OBJMASK:
|
||||||
|
lv_obj_clean_style_list(obj, LV_OBJMASK_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_LIST
|
||||||
|
case LV_THEME_LIST:
|
||||||
|
lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||||
|
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LV_THEME_LIST_BTN:
|
||||||
|
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_DROPDOWN
|
||||||
|
case LV_THEME_DROPDOWN:
|
||||||
|
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||||
|
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||||
|
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||||
|
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_CHART
|
||||||
|
case LV_THEME_CHART:
|
||||||
|
lv_obj_clean_style_list(obj, LV_CHART_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if LV_USE_TABLE
|
||||||
|
case LV_THEME_TABLE:
|
||||||
|
lv_obj_clean_style_list(obj, LV_TABLE_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL1);
|
||||||
|
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL2);
|
||||||
|
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL3);
|
||||||
|
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL4);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_WIN
|
||||||
|
case LV_THEME_WIN:
|
||||||
|
lv_obj_clean_style_list(obj, LV_WIN_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||||
|
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||||
|
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LV_THEME_WIN_BTN:
|
||||||
|
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_TEXTAREA
|
||||||
|
case LV_THEME_TEXTAREA:
|
||||||
|
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||||
|
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||||
|
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if LV_USE_SPINBOX
|
||||||
|
case LV_THEME_SPINBOX:
|
||||||
|
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LV_THEME_SPINBOX_BTN:
|
||||||
|
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_CALENDAR
|
||||||
|
case LV_THEME_CALENDAR:
|
||||||
|
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_BG);
|
||||||
|
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||||
|
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||||
|
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if LV_USE_CPICKER
|
||||||
|
case LV_THEME_CPICKER:
|
||||||
|
lv_obj_clean_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||||
|
lv_obj_clean_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_LINEMETER
|
||||||
|
case LV_THEME_LINEMETER:
|
||||||
|
lv_obj_clean_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if LV_USE_GAUGE
|
||||||
|
case LV_THEME_GAUGE:
|
||||||
|
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||||
|
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||||
|
lv_obj_clean_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ typedef enum {
|
|||||||
#endif
|
#endif
|
||||||
#if LV_USE_SPINBOX
|
#if LV_USE_SPINBOX
|
||||||
LV_THEME_SPINBOX,
|
LV_THEME_SPINBOX,
|
||||||
LV_THEME_SPINBOX_BTN, /*Button extra for spinbox*/
|
LV_THEME_SPINBOX_BTN, /*Control button for the spinbox*/
|
||||||
#endif
|
#endif
|
||||||
#if LV_USE_SPINNER
|
#if LV_USE_SPINNER
|
||||||
LV_THEME_SPINNER,
|
LV_THEME_SPINNER,
|
||||||
@@ -141,13 +141,20 @@ typedef enum {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
_LV_THEME_BUILTIN_LAST,
|
_LV_THEME_BUILTIN_LAST,
|
||||||
_LV_THEME_CUSTOM_START = _LV_THEME_BUILTIN_LAST,
|
LV_THEME_CUSTOM_START = _LV_THEME_BUILTIN_LAST,
|
||||||
_LV_THEME_CUSTOM_LAST = 0xFFFF,
|
_LV_THEME_CUSTOM_LAST = 0xFFFF,
|
||||||
|
|
||||||
} lv_theme_style_t;
|
} lv_theme_style_t;
|
||||||
|
|
||||||
typedef struct {
|
struct _lv_theme_t;
|
||||||
void (*apply_xcb)(lv_obj_t *, lv_theme_style_t);
|
|
||||||
|
typedef void (*lv_theme_apply_cb_t)(struct _lv_theme_t *, lv_obj_t *, lv_theme_style_t);
|
||||||
|
typedef void (*lv_theme_apply_xcb_t)(lv_obj_t *, lv_theme_style_t); /*Deprecated: use `apply_cb` instead*/
|
||||||
|
|
||||||
|
typedef struct _lv_theme_t {
|
||||||
|
lv_theme_apply_cb_t apply_cb;
|
||||||
|
lv_theme_apply_xcb_t apply_xcb; /*Deprecated: use `apply_cb` instead*/
|
||||||
|
struct _lv_theme_t * base; /**< Apply the current theme's style on top of this theme.*/
|
||||||
lv_color_t color_primary;
|
lv_color_t color_primary;
|
||||||
lv_color_t color_secondary;
|
lv_color_t color_secondary;
|
||||||
const lv_font_t * font_small;
|
const lv_font_t * font_small;
|
||||||
@@ -155,6 +162,7 @@ typedef struct {
|
|||||||
const lv_font_t * font_subtitle;
|
const lv_font_t * font_subtitle;
|
||||||
const lv_font_t * font_title;
|
const lv_font_t * font_title;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
|
void * user_data;
|
||||||
} lv_theme_t;
|
} lv_theme_t;
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
@@ -174,9 +182,37 @@ void lv_theme_set_act(lv_theme_t * th);
|
|||||||
*/
|
*/
|
||||||
lv_theme_t * lv_theme_get_act(void);
|
lv_theme_t * lv_theme_get_act(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the active theme on an object
|
||||||
|
* @param obj pointer to an object
|
||||||
|
* @param name the name of the theme element to apply. E.g. `LV_THEME_BTN`
|
||||||
|
*/
|
||||||
void lv_theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
void lv_theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy a theme to an other or initialize a theme
|
||||||
|
* @param theme pointer to a theme to initialize
|
||||||
|
* @param copy pointer to a theme to copy
|
||||||
|
* or `NULL` to initialize `theme` to empty
|
||||||
|
*/
|
||||||
|
void lv_theme_copy(lv_theme_t * theme, const lv_theme_t * copy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a base theme for a theme.
|
||||||
|
* The styles from the base them will be added before the styles of the current theme.
|
||||||
|
* Arbitrary long chain of themes can be created by setting base themes.
|
||||||
|
* @param new_theme pointer to theme which base should be set
|
||||||
|
* @param base pointer to the base theme
|
||||||
|
*/
|
||||||
|
void lv_theme_set_base(lv_theme_t * new_theme, lv_theme_t * base);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an apply callback for a theme.
|
||||||
|
* The apply callback is used to add styles to different objects
|
||||||
|
* @param theme pointer to theme which callback should be set
|
||||||
|
* @param apply_cb pointer to the callback
|
||||||
|
*/
|
||||||
|
void lv_theme_set_apply_cb(lv_theme_t * theme, lv_theme_apply_cb_t apply_cb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the small font of the theme
|
* Get the small font of the theme
|
||||||
@@ -220,7 +256,6 @@ lv_color_t lv_theme_get_color_secondary(void);
|
|||||||
*/
|
*/
|
||||||
uint32_t lv_theme_get_flags(void);
|
uint32_t lv_theme_get_flags(void);
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
|
|||||||
@@ -26,12 +26,12 @@
|
|||||||
**********************/
|
**********************/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
lv_style_t opa_cover;
|
lv_style_t opa_cover;
|
||||||
}theme_styles_t;
|
} theme_styles_t;
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name);
|
||||||
static void style_init_reset(lv_style_t * style);
|
static void style_init_reset(lv_style_t * style);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
@@ -89,13 +89,15 @@ lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_seco
|
|||||||
style_init_reset(&styles->opa_cover);
|
style_init_reset(&styles->opa_cover);
|
||||||
lv_style_set_bg_opa(&styles->opa_cover, LV_STATE_DEFAULT, LV_OPA_COVER);
|
lv_style_set_bg_opa(&styles->opa_cover, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||||
|
|
||||||
theme.apply_xcb = theme_apply;
|
theme.apply_xcb = NULL;
|
||||||
|
theme.apply_cb = theme_apply;
|
||||||
return &theme;
|
return &theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||||
{
|
{
|
||||||
|
LV_UNUSED(th);
|
||||||
if(name == LV_THEME_SCR) {
|
if(name == LV_THEME_SCR) {
|
||||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||||
lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &styles->opa_cover);
|
lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &styles->opa_cover);
|
||||||
|
|||||||
@@ -64,8 +64,9 @@
|
|||||||
#define COLOR_BG_SEC_TEXT (IS_LIGHT ? lv_color_hex(0x31404f) : lv_color_hex(0xa5a8ad))
|
#define COLOR_BG_SEC_TEXT (IS_LIGHT ? lv_color_hex(0x31404f) : lv_color_hex(0xa5a8ad))
|
||||||
#define COLOR_BG_SEC_TEXT_DIS (IS_LIGHT ? lv_color_hex(0xaaaaaa) : lv_color_hex(0xa5a8ad))
|
#define COLOR_BG_SEC_TEXT_DIS (IS_LIGHT ? lv_color_hex(0xaaaaaa) : lv_color_hex(0xa5a8ad))
|
||||||
|
|
||||||
#define TRANSITION_TIME 150
|
#define TRANSITION_TIME ((theme.flags & LV_THEME_MATERIAL_FLAG_NO_TRANSITION) ? 0 : 150)
|
||||||
#define BORDER_WIDTH LV_DPX(2)
|
#define BORDER_WIDTH LV_DPX(2)
|
||||||
|
#define OUTLINE_WIDTH ((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) ? 0 : LV_DPX(2))
|
||||||
#define IS_LIGHT (theme.flags & LV_THEME_MATERIAL_FLAG_LIGHT)
|
#define IS_LIGHT (theme.flags & LV_THEME_MATERIAL_FLAG_LIGHT)
|
||||||
|
|
||||||
#define PAD_DEF (lv_disp_get_size_category(NULL) <= LV_DISP_SIZE_MEDIUM ? LV_DPX(15) : (LV_DPX(30)))
|
#define PAD_DEF (lv_disp_get_size_category(NULL) <= LV_DISP_SIZE_MEDIUM ? LV_DPX(15) : (LV_DPX(30)))
|
||||||
@@ -73,8 +74,7 @@
|
|||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
lv_style_t scr;
|
lv_style_t scr;
|
||||||
lv_style_t bg;
|
lv_style_t bg;
|
||||||
lv_style_t bg_click;
|
lv_style_t bg_click;
|
||||||
@@ -83,101 +83,101 @@ typedef struct
|
|||||||
lv_style_t pad_inner;
|
lv_style_t pad_inner;
|
||||||
lv_style_t pad_small;
|
lv_style_t pad_small;
|
||||||
|
|
||||||
#if LV_USE_ARC
|
#if LV_USE_ARC
|
||||||
lv_style_t arc_indic;
|
lv_style_t arc_indic;
|
||||||
lv_style_t arc_bg;
|
lv_style_t arc_bg;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_BAR
|
#if LV_USE_BAR
|
||||||
lv_style_t bar_bg;
|
lv_style_t bar_bg;
|
||||||
lv_style_t bar_indic;
|
lv_style_t bar_indic;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_CALENDAR
|
#if LV_USE_CALENDAR
|
||||||
lv_style_t calendar_date_nums, calendar_header, calendar_daynames;
|
lv_style_t calendar_date_nums, calendar_header, calendar_daynames;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_CPICKER
|
#if LV_USE_CPICKER
|
||||||
lv_style_t cpicker_bg, cpicker_indic;
|
lv_style_t cpicker_bg, cpicker_indic;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_CHART
|
#if LV_USE_CHART
|
||||||
lv_style_t chart_bg, chart_series_bg, chart_series;
|
lv_style_t chart_bg, chart_series_bg, chart_series;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_CHECKBOX
|
#if LV_USE_CHECKBOX
|
||||||
lv_style_t cb_bg, cb_bullet;
|
lv_style_t cb_bg, cb_bullet;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_DROPDOWN
|
#if LV_USE_DROPDOWN
|
||||||
lv_style_t ddlist_page, ddlist_sel;
|
lv_style_t ddlist_page, ddlist_sel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_GAUGE
|
#if LV_USE_GAUGE
|
||||||
lv_style_t gauge_main, gauge_strong, gauge_needle;
|
lv_style_t gauge_main, gauge_strong, gauge_needle;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_KEYBOARD
|
#if LV_USE_KEYBOARD
|
||||||
lv_style_t kb_bg;
|
lv_style_t kb_bg;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_LED
|
#if LV_USE_LED
|
||||||
lv_style_t led;
|
lv_style_t led;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_LINEMETER
|
#if LV_USE_LINEMETER
|
||||||
lv_style_t lmeter;
|
lv_style_t lmeter;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_LIST
|
#if LV_USE_LIST
|
||||||
lv_style_t list_bg, list_btn;
|
lv_style_t list_bg, list_btn;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_MSGBOX
|
#if LV_USE_MSGBOX
|
||||||
lv_style_t mbox_bg;
|
lv_style_t mbox_bg;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_PAGE
|
#if LV_USE_PAGE
|
||||||
lv_style_t sb;
|
lv_style_t sb;
|
||||||
#if LV_USE_ANIMATION
|
#if LV_USE_ANIMATION
|
||||||
lv_style_t edge_flash;
|
lv_style_t edge_flash;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_ROLLER
|
#if LV_USE_ROLLER
|
||||||
lv_style_t roller_bg, roller_sel;
|
lv_style_t roller_bg, roller_sel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_SLIDER
|
#if LV_USE_SLIDER
|
||||||
lv_style_t slider_knob, slider_bg;
|
lv_style_t slider_knob, slider_bg;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_SPINBOX
|
#if LV_USE_SPINBOX
|
||||||
lv_style_t spinbox_cursor;
|
lv_style_t spinbox_cursor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_SWITCH
|
#if LV_USE_SWITCH
|
||||||
lv_style_t sw_knob;
|
lv_style_t sw_knob;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_TABLE
|
#if LV_USE_TABLE
|
||||||
lv_style_t table_cell;
|
lv_style_t table_cell;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_TABVIEW || LV_USE_WIN
|
#if LV_USE_TABVIEW || LV_USE_WIN
|
||||||
lv_style_t tabview_btns, tabview_btns_bg, tabview_indic, tabview_page_scrl;
|
lv_style_t tabview_btns, tabview_btns_bg, tabview_indic, tabview_page_scrl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_TEXTAREA
|
#if LV_USE_TEXTAREA
|
||||||
lv_style_t ta_cursor, ta_placeholder;
|
lv_style_t ta_cursor, ta_placeholder;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}theme_styles_t;
|
} theme_styles_t;
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name);
|
||||||
static void style_init_reset(lv_style_t * style);
|
static void style_init_reset(lv_style_t * style);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
@@ -211,7 +211,8 @@ static void basic_init(void)
|
|||||||
lv_style_set_bg_opa(&styles->bg, LV_STATE_DEFAULT, LV_OPA_COVER);
|
lv_style_set_bg_opa(&styles->bg, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||||
lv_style_set_bg_color(&styles->bg, LV_STATE_DEFAULT, COLOR_BG);
|
lv_style_set_bg_color(&styles->bg, LV_STATE_DEFAULT, COLOR_BG);
|
||||||
lv_style_set_border_color(&styles->bg, LV_STATE_DEFAULT, COLOR_BG_BORDER);
|
lv_style_set_border_color(&styles->bg, LV_STATE_DEFAULT, COLOR_BG_BORDER);
|
||||||
lv_style_set_border_color(&styles->bg, LV_STATE_FOCUSED, theme.color_primary);
|
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0)lv_style_set_border_color(&styles->bg, LV_STATE_FOCUSED,
|
||||||
|
theme.color_primary);
|
||||||
lv_style_set_border_color(&styles->bg, LV_STATE_EDITED, theme.color_secondary);
|
lv_style_set_border_color(&styles->bg, LV_STATE_EDITED, theme.color_secondary);
|
||||||
lv_style_set_border_width(&styles->bg, LV_STATE_DEFAULT, BORDER_WIDTH);
|
lv_style_set_border_width(&styles->bg, LV_STATE_DEFAULT, BORDER_WIDTH);
|
||||||
lv_style_set_border_post(&styles->bg, LV_STATE_DEFAULT, true);
|
lv_style_set_border_post(&styles->bg, LV_STATE_DEFAULT, true);
|
||||||
@@ -246,7 +247,7 @@ static void basic_init(void)
|
|||||||
lv_style_set_bg_color(&styles->bg_click, LV_STATE_DISABLED, COLOR_BG_DIS);
|
lv_style_set_bg_color(&styles->bg_click, LV_STATE_DISABLED, COLOR_BG_DIS);
|
||||||
lv_style_set_border_width(&styles->bg_click, LV_STATE_CHECKED, 0);
|
lv_style_set_border_width(&styles->bg_click, LV_STATE_CHECKED, 0);
|
||||||
lv_style_set_border_color(&styles->bg_click, LV_STATE_FOCUSED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary,
|
lv_style_set_border_color(&styles->bg_click, LV_STATE_FOCUSED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary,
|
||||||
LV_OPA_20));
|
LV_OPA_20));
|
||||||
lv_style_set_border_color(&styles->bg_click, LV_STATE_PRESSED, COLOR_BG_BORDER_PR);
|
lv_style_set_border_color(&styles->bg_click, LV_STATE_PRESSED, COLOR_BG_BORDER_PR);
|
||||||
lv_style_set_border_color(&styles->bg_click, LV_STATE_CHECKED, COLOR_BG_BORDER_CHK);
|
lv_style_set_border_color(&styles->bg_click, LV_STATE_CHECKED, COLOR_BG_BORDER_CHK);
|
||||||
lv_style_set_border_color(&styles->bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_BORDER_CHK_PR);
|
lv_style_set_border_color(&styles->bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_BORDER_CHK_PR);
|
||||||
@@ -299,7 +300,7 @@ static void basic_init(void)
|
|||||||
lv_style_set_pad_top(&styles->btn, LV_STATE_DEFAULT, LV_DPX(15));
|
lv_style_set_pad_top(&styles->btn, LV_STATE_DEFAULT, LV_DPX(15));
|
||||||
lv_style_set_pad_bottom(&styles->btn, LV_STATE_DEFAULT, LV_DPX(15));
|
lv_style_set_pad_bottom(&styles->btn, LV_STATE_DEFAULT, LV_DPX(15));
|
||||||
lv_style_set_pad_inner(&styles->btn, LV_STATE_DEFAULT, LV_DPX(20));
|
lv_style_set_pad_inner(&styles->btn, LV_STATE_DEFAULT, LV_DPX(20));
|
||||||
lv_style_set_outline_width(&styles->btn, LV_STATE_DEFAULT, 3);
|
lv_style_set_outline_width(&styles->btn, LV_STATE_DEFAULT, OUTLINE_WIDTH);
|
||||||
lv_style_set_outline_opa(&styles->btn, LV_STATE_DEFAULT, LV_OPA_0);
|
lv_style_set_outline_opa(&styles->btn, LV_STATE_DEFAULT, LV_OPA_0);
|
||||||
lv_style_set_outline_opa(&styles->btn, LV_STATE_FOCUSED, LV_OPA_50);
|
lv_style_set_outline_opa(&styles->btn, LV_STATE_FOCUSED, LV_OPA_50);
|
||||||
lv_style_set_outline_color(&styles->btn, LV_STATE_DEFAULT, theme.color_primary);
|
lv_style_set_outline_color(&styles->btn, LV_STATE_DEFAULT, theme.color_primary);
|
||||||
@@ -358,7 +359,7 @@ static void bar_init(void)
|
|||||||
lv_style_set_outline_color(&styles->bar_bg, LV_STATE_EDITED, theme.color_secondary);
|
lv_style_set_outline_color(&styles->bar_bg, LV_STATE_EDITED, theme.color_secondary);
|
||||||
lv_style_set_outline_opa(&styles->bar_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
lv_style_set_outline_opa(&styles->bar_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
||||||
lv_style_set_outline_opa(&styles->bar_bg, LV_STATE_FOCUSED, LV_OPA_50);
|
lv_style_set_outline_opa(&styles->bar_bg, LV_STATE_FOCUSED, LV_OPA_50);
|
||||||
lv_style_set_outline_width(&styles->bar_bg, LV_STATE_DEFAULT, 3);
|
lv_style_set_outline_width(&styles->bar_bg, LV_STATE_DEFAULT, OUTLINE_WIDTH);
|
||||||
lv_style_set_transition_time(&styles->bar_bg, LV_STATE_DEFAULT, TRANSITION_TIME);
|
lv_style_set_transition_time(&styles->bar_bg, LV_STATE_DEFAULT, TRANSITION_TIME);
|
||||||
lv_style_set_transition_prop_6(&styles->bar_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
|
lv_style_set_transition_prop_6(&styles->bar_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
|
||||||
|
|
||||||
@@ -546,21 +547,24 @@ static void calendar_init(void)
|
|||||||
lv_style_set_text_color(&styles->calendar_header, LV_STATE_PRESSED, IS_LIGHT ? lv_color_hex(0x888888) : LV_COLOR_WHITE);
|
lv_style_set_text_color(&styles->calendar_header, LV_STATE_PRESSED, IS_LIGHT ? lv_color_hex(0x888888) : LV_COLOR_WHITE);
|
||||||
|
|
||||||
style_init_reset(&styles->calendar_daynames);
|
style_init_reset(&styles->calendar_daynames);
|
||||||
lv_style_set_text_color(&styles->calendar_daynames, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x31404f) : lv_color_hex3(0xeee));
|
lv_style_set_text_color(&styles->calendar_daynames, LV_STATE_DEFAULT,
|
||||||
|
IS_LIGHT ? lv_color_hex(0x31404f) : lv_color_hex3(0xeee));
|
||||||
lv_style_set_pad_left(&styles->calendar_daynames, LV_STATE_DEFAULT, PAD_DEF);
|
lv_style_set_pad_left(&styles->calendar_daynames, LV_STATE_DEFAULT, PAD_DEF);
|
||||||
lv_style_set_pad_right(&styles->calendar_daynames, LV_STATE_DEFAULT, PAD_DEF);
|
lv_style_set_pad_right(&styles->calendar_daynames, LV_STATE_DEFAULT, PAD_DEF);
|
||||||
lv_style_set_pad_bottom(&styles->calendar_daynames, LV_STATE_DEFAULT, PAD_DEF);
|
lv_style_set_pad_bottom(&styles->calendar_daynames, LV_STATE_DEFAULT, PAD_DEF);
|
||||||
|
|
||||||
style_init_reset(&styles->calendar_date_nums);
|
style_init_reset(&styles->calendar_date_nums);
|
||||||
lv_style_set_radius(&styles->calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(4));
|
lv_style_set_radius(&styles->calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(4));
|
||||||
lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_CHECKED, IS_LIGHT ? lv_color_hex(0x31404f) : LV_COLOR_WHITE);
|
lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_CHECKED,
|
||||||
|
IS_LIGHT ? lv_color_hex(0x31404f) : LV_COLOR_WHITE);
|
||||||
|
|
||||||
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_CHECKED, IS_LIGHT ? LV_OPA_20 : LV_OPA_40);
|
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_CHECKED, IS_LIGHT ? LV_OPA_20 : LV_OPA_40);
|
||||||
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_PRESSED, LV_OPA_20);
|
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_PRESSED, LV_OPA_20);
|
||||||
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_OPA_COVER);
|
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_OPA_COVER);
|
||||||
lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_COLOR_WHITE);
|
lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_COLOR_WHITE);
|
||||||
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, theme.color_primary);
|
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, theme.color_primary);
|
||||||
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x666666) : LV_COLOR_WHITE);
|
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_DEFAULT,
|
||||||
|
IS_LIGHT ? lv_color_hex(0x666666) : LV_COLOR_WHITE);
|
||||||
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_CHECKED, theme.color_primary);
|
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_CHECKED, theme.color_primary);
|
||||||
lv_style_set_border_width(&styles->calendar_date_nums, LV_STATE_CHECKED, 2);
|
lv_style_set_border_width(&styles->calendar_date_nums, LV_STATE_CHECKED, 2);
|
||||||
lv_style_set_border_side(&styles->calendar_date_nums, LV_STATE_CHECKED, LV_BORDER_SIDE_LEFT);
|
lv_style_set_border_side(&styles->calendar_date_nums, LV_STATE_CHECKED, LV_BORDER_SIDE_LEFT);
|
||||||
@@ -606,7 +610,7 @@ static void checkbox_init(void)
|
|||||||
lv_style_set_outline_color(&styles->cb_bg, LV_STATE_DEFAULT, theme.color_primary);
|
lv_style_set_outline_color(&styles->cb_bg, LV_STATE_DEFAULT, theme.color_primary);
|
||||||
lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
||||||
lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_FOCUSED, LV_OPA_50);
|
lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_FOCUSED, LV_OPA_50);
|
||||||
lv_style_set_outline_width(&styles->cb_bg, LV_STATE_DEFAULT, LV_DPX(3));
|
lv_style_set_outline_width(&styles->cb_bg, LV_STATE_DEFAULT, OUTLINE_WIDTH);
|
||||||
lv_style_set_outline_pad(&styles->cb_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
lv_style_set_outline_pad(&styles->cb_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||||
lv_style_set_transition_time(&styles->cb_bg, LV_STATE_DEFAULT, TRANSITION_TIME);
|
lv_style_set_transition_time(&styles->cb_bg, LV_STATE_DEFAULT, TRANSITION_TIME);
|
||||||
lv_style_set_transition_prop_6(&styles->cb_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
|
lv_style_set_transition_prop_6(&styles->cb_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
|
||||||
@@ -684,7 +688,8 @@ static void textarea_init(void)
|
|||||||
lv_style_set_border_side(&styles->ta_cursor, LV_STATE_DEFAULT, LV_BORDER_SIDE_LEFT);
|
lv_style_set_border_side(&styles->ta_cursor, LV_STATE_DEFAULT, LV_BORDER_SIDE_LEFT);
|
||||||
|
|
||||||
style_init_reset(&styles->ta_placeholder);
|
style_init_reset(&styles->ta_placeholder);
|
||||||
lv_style_set_text_color(&styles->ta_placeholder, LV_STATE_DEFAULT, IS_LIGHT ? COLOR_BG_TEXT_DIS : lv_color_hex(0xa1adbd));
|
lv_style_set_text_color(&styles->ta_placeholder, LV_STATE_DEFAULT,
|
||||||
|
IS_LIGHT ? COLOR_BG_TEXT_DIS : lv_color_hex(0xa1adbd));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,6 +739,10 @@ static void list_init(void)
|
|||||||
lv_style_set_border_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_primary);
|
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_border_width(&styles->list_btn, LV_STATE_DEFAULT, 1);
|
||||||
|
|
||||||
|
lv_style_set_outline_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_secondary);
|
||||||
|
lv_style_set_outline_width(&styles->list_btn, LV_STATE_FOCUSED, OUTLINE_WIDTH);
|
||||||
|
lv_style_set_outline_pad(&styles->list_btn, LV_STATE_FOCUSED, -BORDER_WIDTH);
|
||||||
|
|
||||||
lv_style_set_pad_left(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
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_right(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||||
lv_style_set_pad_top(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
lv_style_set_pad_top(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||||
@@ -741,9 +750,10 @@ static void list_init(void)
|
|||||||
lv_style_set_pad_inner(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
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_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_PRESSED, -BORDER_WIDTH);
|
||||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_CHECKED, 0);
|
lv_style_set_transform_width(&styles->list_btn, LV_STATE_CHECKED, -BORDER_WIDTH);
|
||||||
lv_style_set_transform_width(&styles->list_btn, LV_STATE_DISABLED, 0);
|
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_time(&styles->list_btn, LV_STATE_DEFAULT, TRANSITION_TIME);
|
||||||
lv_style_set_transition_prop_6(&styles->list_btn, LV_STATE_DEFAULT, LV_STYLE_BG_COLOR);
|
lv_style_set_transition_prop_6(&styles->list_btn, LV_STATE_DEFAULT, LV_STYLE_BG_COLOR);
|
||||||
@@ -784,6 +794,39 @@ static void roller_init(void)
|
|||||||
static void tabview_init(void)
|
static void tabview_init(void)
|
||||||
{
|
{
|
||||||
#if LV_USE_TABVIEW != 0
|
#if LV_USE_TABVIEW != 0
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void tileview_init(void)
|
||||||
|
{
|
||||||
|
#if LV_USE_TILEVIEW != 0
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void table_init(void)
|
||||||
|
{
|
||||||
|
#if LV_USE_TABLE != 0
|
||||||
|
style_init_reset(&styles->table_cell);
|
||||||
|
lv_style_set_border_color(&styles->table_cell, LV_STATE_DEFAULT, COLOR_BG_BORDER);
|
||||||
|
lv_style_set_border_width(&styles->table_cell, LV_STATE_DEFAULT, 1);
|
||||||
|
lv_style_set_border_side(&styles->table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM);
|
||||||
|
lv_style_set_pad_left(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||||
|
lv_style_set_pad_right(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||||
|
lv_style_set_pad_top(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||||
|
lv_style_set_pad_bottom(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void win_init(void)
|
||||||
|
{
|
||||||
|
#if LV_USE_WIN != 0
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void tabview_win_shared_init(void)
|
||||||
|
{
|
||||||
|
#if LV_USE_TABVIEW || LV_USE_WIN
|
||||||
style_init_reset(&styles->tabview_btns_bg);
|
style_init_reset(&styles->tabview_btns_bg);
|
||||||
lv_style_set_bg_opa(&styles->tabview_btns_bg, LV_STATE_DEFAULT, LV_OPA_COVER);
|
lv_style_set_bg_opa(&styles->tabview_btns_bg, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||||
lv_style_set_bg_color(&styles->tabview_btns_bg, LV_STATE_DEFAULT, COLOR_BG);
|
lv_style_set_bg_color(&styles->tabview_btns_bg, LV_STATE_DEFAULT, COLOR_BG);
|
||||||
@@ -823,34 +866,6 @@ static void tabview_init(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tileview_init(void)
|
|
||||||
{
|
|
||||||
#if LV_USE_TILEVIEW != 0
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static void table_init(void)
|
|
||||||
{
|
|
||||||
#if LV_USE_TABLE != 0
|
|
||||||
style_init_reset(&styles->table_cell);
|
|
||||||
lv_style_set_border_color(&styles->table_cell, LV_STATE_DEFAULT, COLOR_BG_BORDER);
|
|
||||||
lv_style_set_border_width(&styles->table_cell, LV_STATE_DEFAULT, 1);
|
|
||||||
lv_style_set_border_side(&styles->table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM);
|
|
||||||
lv_style_set_pad_left(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
|
||||||
lv_style_set_pad_right(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
|
||||||
lv_style_set_pad_top(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
|
||||||
lv_style_set_pad_bottom(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static void win_init(void)
|
|
||||||
{
|
|
||||||
#if LV_USE_WIN != 0
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* GLOBAL FUNCTIONS
|
* GLOBAL FUNCTIONS
|
||||||
@@ -919,8 +934,10 @@ lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_s
|
|||||||
tileview_init();
|
tileview_init();
|
||||||
table_init();
|
table_init();
|
||||||
win_init();
|
win_init();
|
||||||
|
tabview_win_shared_init();
|
||||||
|
|
||||||
theme.apply_xcb = theme_apply;
|
theme.apply_xcb = NULL;
|
||||||
|
theme.apply_cb = theme_apply;
|
||||||
|
|
||||||
inited = true;
|
inited = true;
|
||||||
|
|
||||||
@@ -930,8 +947,10 @@ lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||||
{
|
{
|
||||||
|
LV_UNUSED(th);
|
||||||
|
|
||||||
lv_style_list_t * list;
|
lv_style_list_t * list;
|
||||||
|
|
||||||
switch(name) {
|
switch(name) {
|
||||||
@@ -939,18 +958,15 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_SCR:
|
case LV_THEME_SCR:
|
||||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->scr);
|
_lv_style_list_add_style(list, &styles->scr);
|
||||||
break;
|
break;
|
||||||
case LV_THEME_OBJ:
|
case LV_THEME_OBJ:
|
||||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
#if LV_USE_CONT
|
#if LV_USE_CONT
|
||||||
case LV_THEME_CONT:
|
case LV_THEME_CONT:
|
||||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
@@ -958,7 +974,6 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_BTN
|
#if LV_USE_BTN
|
||||||
case LV_THEME_BTN:
|
case LV_THEME_BTN:
|
||||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
break;
|
break;
|
||||||
@@ -966,12 +981,10 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_BTNMATRIX
|
#if LV_USE_BTNMATRIX
|
||||||
case LV_THEME_BTNMATRIX:
|
case LV_THEME_BTNMATRIX:
|
||||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->pad_small);
|
_lv_style_list_add_style(list, &styles->pad_small);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->bg_click);
|
_lv_style_list_add_style(list, &styles->bg_click);
|
||||||
@@ -980,12 +993,10 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_KEYBOARD
|
#if LV_USE_KEYBOARD
|
||||||
case LV_THEME_KEYBOARD:
|
case LV_THEME_KEYBOARD:
|
||||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->scr);
|
_lv_style_list_add_style(list, &styles->scr);
|
||||||
_lv_style_list_add_style(list, &styles->kb_bg);
|
_lv_style_list_add_style(list, &styles->kb_bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BTN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->bg_click);
|
_lv_style_list_add_style(list, &styles->bg_click);
|
||||||
@@ -994,11 +1005,9 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_BAR
|
#if LV_USE_BAR
|
||||||
case LV_THEME_BAR:
|
case LV_THEME_BAR:
|
||||||
lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bar_bg);
|
_lv_style_list_add_style(list, &styles->bar_bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->bar_indic);
|
_lv_style_list_add_style(list, &styles->bar_indic);
|
||||||
break;
|
break;
|
||||||
@@ -1006,15 +1015,12 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_SWITCH
|
#if LV_USE_SWITCH
|
||||||
case LV_THEME_SWITCH:
|
case LV_THEME_SWITCH:
|
||||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bar_bg);
|
_lv_style_list_add_style(list, &styles->bar_bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->bar_indic);
|
_lv_style_list_add_style(list, &styles->bar_indic);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||||
_lv_style_list_add_style(list, &styles->sw_knob);
|
_lv_style_list_add_style(list, &styles->sw_knob);
|
||||||
break;
|
break;
|
||||||
@@ -1022,42 +1028,35 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_CANVAS
|
#if LV_USE_CANVAS
|
||||||
case LV_THEME_CANVAS:
|
case LV_THEME_CANVAS:
|
||||||
lv_obj_clean_style_list(obj, LV_CANVAS_PART_MAIN);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_IMG
|
#if LV_USE_IMG
|
||||||
case LV_THEME_IMAGE:
|
case LV_THEME_IMAGE:
|
||||||
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_IMGBTN
|
#if LV_USE_IMGBTN
|
||||||
case LV_THEME_IMGBTN:
|
case LV_THEME_IMGBTN:
|
||||||
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_LABEL
|
#if LV_USE_LABEL
|
||||||
case LV_THEME_LABEL:
|
case LV_THEME_LABEL:
|
||||||
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_LINE
|
#if LV_USE_LINE
|
||||||
case LV_THEME_LINE:
|
case LV_THEME_LINE:
|
||||||
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_ARC
|
#if LV_USE_ARC
|
||||||
case LV_THEME_ARC:
|
case LV_THEME_ARC:
|
||||||
lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->arc_bg);
|
_lv_style_list_add_style(list, &styles->arc_bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->arc_indic);
|
_lv_style_list_add_style(list, &styles->arc_indic);
|
||||||
break;
|
break;
|
||||||
@@ -1065,11 +1064,9 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_SPINNER
|
#if LV_USE_SPINNER
|
||||||
case LV_THEME_SPINNER:
|
case LV_THEME_SPINNER:
|
||||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->arc_bg);
|
_lv_style_list_add_style(list, &styles->arc_bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->arc_indic);
|
_lv_style_list_add_style(list, &styles->arc_indic);
|
||||||
break;
|
break;
|
||||||
@@ -1077,16 +1074,13 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_SLIDER
|
#if LV_USE_SLIDER
|
||||||
case LV_THEME_SLIDER:
|
case LV_THEME_SLIDER:
|
||||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bar_bg);
|
_lv_style_list_add_style(list, &styles->bar_bg);
|
||||||
_lv_style_list_add_style(list, &styles->slider_bg);
|
_lv_style_list_add_style(list, &styles->slider_bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->bar_indic);
|
_lv_style_list_add_style(list, &styles->bar_indic);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||||
_lv_style_list_add_style(list, &styles->slider_knob);
|
_lv_style_list_add_style(list, &styles->slider_knob);
|
||||||
break;
|
break;
|
||||||
@@ -1094,11 +1088,9 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_CHECKBOX
|
#if LV_USE_CHECKBOX
|
||||||
case LV_THEME_CHECKBOX:
|
case LV_THEME_CHECKBOX:
|
||||||
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->cb_bg);
|
_lv_style_list_add_style(list, &styles->cb_bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
_lv_style_list_add_style(list, &styles->cb_bullet);
|
_lv_style_list_add_style(list, &styles->cb_bullet);
|
||||||
@@ -1107,18 +1099,15 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_MSGBOX
|
#if LV_USE_MSGBOX
|
||||||
case LV_THEME_MSGBOX:
|
case LV_THEME_MSGBOX:
|
||||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->mbox_bg);
|
_lv_style_list_add_style(list, &styles->mbox_bg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_MSGBOX_BTNS:
|
case LV_THEME_MSGBOX_BTNS:
|
||||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||||
_lv_style_list_add_style(list, &styles->pad_small);
|
_lv_style_list_add_style(list, &styles->pad_small);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
break;
|
break;
|
||||||
@@ -1126,27 +1115,22 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
#endif
|
#endif
|
||||||
#if LV_USE_LED
|
#if LV_USE_LED
|
||||||
case LV_THEME_LED:
|
case LV_THEME_LED:
|
||||||
lv_obj_clean_style_list(obj, LV_LED_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->led);
|
_lv_style_list_add_style(list, &styles->led);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if LV_USE_PAGE
|
#if LV_USE_PAGE
|
||||||
case LV_THEME_PAGE:
|
case LV_THEME_PAGE:
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||||
_lv_style_list_add_style(list, &styles->pad_inner);
|
_lv_style_list_add_style(list, &styles->pad_inner);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->sb);
|
_lv_style_list_add_style(list, &styles->sb);
|
||||||
|
|
||||||
#if LV_USE_ANIMATION
|
#if LV_USE_ANIMATION
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_EDGE_FLASH);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_EDGE_FLASH);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_EDGE_FLASH);
|
||||||
_lv_style_list_add_style(list, &styles->edge_flash);
|
_lv_style_list_add_style(list, &styles->edge_flash);
|
||||||
#endif
|
#endif
|
||||||
@@ -1154,29 +1138,20 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
#endif
|
#endif
|
||||||
#if LV_USE_TABVIEW
|
#if LV_USE_TABVIEW
|
||||||
case LV_THEME_TABVIEW:
|
case LV_THEME_TABVIEW:
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->scr);
|
_lv_style_list_add_style(list, &styles->scr);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||||
_lv_style_list_add_style(list, &styles->tabview_btns_bg);
|
_lv_style_list_add_style(list, &styles->tabview_btns_bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->tabview_indic);
|
_lv_style_list_add_style(list, &styles->tabview_indic);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||||
_lv_style_list_add_style(list, &styles->tabview_btns);
|
_lv_style_list_add_style(list, &styles->tabview_btns);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_TABVIEW_PAGE:
|
case LV_THEME_TABVIEW_PAGE:
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||||
_lv_style_list_add_style(list, &styles->tabview_page_scrl);
|
_lv_style_list_add_style(list, &styles->tabview_page_scrl);
|
||||||
|
|
||||||
@@ -1185,16 +1160,13 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_TILEVIEW
|
#if LV_USE_TILEVIEW
|
||||||
case LV_THEME_TILEVIEW:
|
case LV_THEME_TILEVIEW:
|
||||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->scr);
|
_lv_style_list_add_style(list, &styles->scr);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->sb);
|
_lv_style_list_add_style(list, &styles->sb);
|
||||||
|
|
||||||
#if LV_USE_ANIMATION
|
#if LV_USE_ANIMATION
|
||||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||||
_lv_style_list_add_style(list, &styles->edge_flash);
|
_lv_style_list_add_style(list, &styles->edge_flash);
|
||||||
#endif
|
#endif
|
||||||
@@ -1204,12 +1176,10 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_ROLLER
|
#if LV_USE_ROLLER
|
||||||
case LV_THEME_ROLLER:
|
case LV_THEME_ROLLER:
|
||||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->roller_bg);
|
_lv_style_list_add_style(list, &styles->roller_bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_SELECTED);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||||
_lv_style_list_add_style(list, &styles->roller_sel);
|
_lv_style_list_add_style(list, &styles->roller_sel);
|
||||||
break;
|
break;
|
||||||
@@ -1218,27 +1188,22 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_OBJMASK
|
#if LV_USE_OBJMASK
|
||||||
case LV_THEME_OBJMASK:
|
case LV_THEME_OBJMASK:
|
||||||
lv_obj_clean_style_list(obj, LV_OBJMASK_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_LIST
|
#if LV_USE_LIST
|
||||||
case LV_THEME_LIST:
|
case LV_THEME_LIST:
|
||||||
lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->list_bg);
|
_lv_style_list_add_style(list, &styles->list_bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->sb);
|
_lv_style_list_add_style(list, &styles->sb);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_LIST_BTN:
|
case LV_THEME_LIST_BTN:
|
||||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->list_btn);
|
_lv_style_list_add_style(list, &styles->list_btn);
|
||||||
break;
|
break;
|
||||||
@@ -1246,22 +1211,18 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_DROPDOWN
|
#if LV_USE_DROPDOWN
|
||||||
case LV_THEME_DROPDOWN:
|
case LV_THEME_DROPDOWN:
|
||||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->bg_click);
|
_lv_style_list_add_style(list, &styles->bg_click);
|
||||||
_lv_style_list_add_style(list, &styles->pad_small);
|
_lv_style_list_add_style(list, &styles->pad_small);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->ddlist_page);
|
_lv_style_list_add_style(list, &styles->ddlist_page);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->sb);
|
_lv_style_list_add_style(list, &styles->sb);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||||
_lv_style_list_add_style(list, &styles->ddlist_sel);
|
_lv_style_list_add_style(list, &styles->ddlist_sel);
|
||||||
break;
|
break;
|
||||||
@@ -1269,41 +1230,33 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_CHART
|
#if LV_USE_CHART
|
||||||
case LV_THEME_CHART:
|
case LV_THEME_CHART:
|
||||||
lv_obj_clean_style_list(obj, LV_CHART_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->chart_bg);
|
_lv_style_list_add_style(list, &styles->chart_bg);
|
||||||
_lv_style_list_add_style(list, &styles->pad_small);
|
_lv_style_list_add_style(list, &styles->pad_small);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||||
_lv_style_list_add_style(list, &styles->pad_small);
|
_lv_style_list_add_style(list, &styles->pad_small);
|
||||||
_lv_style_list_add_style(list, &styles->chart_series_bg);
|
_lv_style_list_add_style(list, &styles->chart_series_bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||||
_lv_style_list_add_style(list, &styles->chart_series);
|
_lv_style_list_add_style(list, &styles->chart_series);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if LV_USE_TABLE
|
#if LV_USE_TABLE
|
||||||
case LV_THEME_TABLE:
|
case LV_THEME_TABLE:
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL1);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
||||||
_lv_style_list_add_style(list, &styles->table_cell);
|
_lv_style_list_add_style(list, &styles->table_cell);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL2);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
||||||
_lv_style_list_add_style(list, &styles->table_cell);
|
_lv_style_list_add_style(list, &styles->table_cell);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL3);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
||||||
_lv_style_list_add_style(list, &styles->table_cell);
|
_lv_style_list_add_style(list, &styles->table_cell);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL4);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
||||||
_lv_style_list_add_style(list, &styles->table_cell);
|
_lv_style_list_add_style(list, &styles->table_cell);
|
||||||
break;
|
break;
|
||||||
@@ -1311,25 +1264,20 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_WIN
|
#if LV_USE_WIN
|
||||||
case LV_THEME_WIN:
|
case LV_THEME_WIN:
|
||||||
lv_obj_clean_style_list(obj, LV_WIN_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->scr);
|
_lv_style_list_add_style(list, &styles->scr);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->sb);
|
_lv_style_list_add_style(list, &styles->sb);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||||
_lv_style_list_add_style(list, &styles->tabview_page_scrl);
|
_lv_style_list_add_style(list, &styles->tabview_page_scrl);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
||||||
_lv_style_list_add_style(list, &styles->tabview_btns_bg);
|
_lv_style_list_add_style(list, &styles->tabview_btns_bg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_WIN_BTN:
|
case LV_THEME_WIN_BTN:
|
||||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->tabview_btns);
|
_lv_style_list_add_style(list, &styles->tabview_btns);
|
||||||
break;
|
break;
|
||||||
@@ -1337,20 +1285,16 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_TEXTAREA
|
#if LV_USE_TEXTAREA
|
||||||
case LV_THEME_TEXTAREA:
|
case LV_THEME_TEXTAREA:
|
||||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->pad_small);
|
_lv_style_list_add_style(list, &styles->pad_small);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||||
_lv_style_list_add_style(list, &styles->ta_placeholder);
|
_lv_style_list_add_style(list, &styles->ta_placeholder);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||||
_lv_style_list_add_style(list, &styles->ta_cursor);
|
_lv_style_list_add_style(list, &styles->ta_cursor);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->sb);
|
_lv_style_list_add_style(list, &styles->sb);
|
||||||
break;
|
break;
|
||||||
@@ -1360,18 +1304,15 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_SPINBOX
|
#if LV_USE_SPINBOX
|
||||||
case LV_THEME_SPINBOX:
|
case LV_THEME_SPINBOX:
|
||||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->pad_small);
|
_lv_style_list_add_style(list, &styles->pad_small);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||||
_lv_style_list_add_style(list, &styles->spinbox_cursor);
|
_lv_style_list_add_style(list, &styles->spinbox_cursor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_SPINBOX_BTN:
|
case LV_THEME_SPINBOX_BTN:
|
||||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->bg_click);
|
_lv_style_list_add_style(list, &styles->bg_click);
|
||||||
@@ -1380,30 +1321,24 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_CALENDAR
|
#if LV_USE_CALENDAR
|
||||||
case LV_THEME_CALENDAR:
|
case LV_THEME_CALENDAR:
|
||||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DATE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||||
_lv_style_list_add_style(list, &styles->calendar_date_nums);
|
_lv_style_list_add_style(list, &styles->calendar_date_nums);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_HEADER);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||||
_lv_style_list_add_style(list, &styles->calendar_header);
|
_lv_style_list_add_style(list, &styles->calendar_header);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||||
_lv_style_list_add_style(list, &styles->calendar_daynames);
|
_lv_style_list_add_style(list, &styles->calendar_daynames);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if LV_USE_CPICKER
|
#if LV_USE_CPICKER
|
||||||
case LV_THEME_CPICKER:
|
case LV_THEME_CPICKER:
|
||||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->cpicker_bg);
|
_lv_style_list_add_style(list, &styles->cpicker_bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_KNOB);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||||
_lv_style_list_add_style(list, &styles->cpicker_indic);
|
_lv_style_list_add_style(list, &styles->cpicker_indic);
|
||||||
break;
|
break;
|
||||||
@@ -1411,7 +1346,6 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_LINEMETER
|
#if LV_USE_LINEMETER
|
||||||
case LV_THEME_LINEMETER:
|
case LV_THEME_LINEMETER:
|
||||||
lv_obj_clean_style_list(obj, LV_LINEMETER_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->lmeter);
|
_lv_style_list_add_style(list, &styles->lmeter);
|
||||||
@@ -1419,16 +1353,13 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
#endif
|
#endif
|
||||||
#if LV_USE_GAUGE
|
#if LV_USE_GAUGE
|
||||||
case LV_THEME_GAUGE:
|
case LV_THEME_GAUGE:
|
||||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->gauge_main);
|
_lv_style_list_add_style(list, &styles->gauge_main);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAJOR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||||
_lv_style_list_add_style(list, &styles->gauge_strong);
|
_lv_style_list_add_style(list, &styles->gauge_strong);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||||
_lv_style_list_add_style(list, &styles->gauge_needle);
|
_lv_style_list_add_style(list, &styles->gauge_needle);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ typedef enum {
|
|||||||
LV_THEME_MATERIAL_FLAG_DARK = 0x01,
|
LV_THEME_MATERIAL_FLAG_DARK = 0x01,
|
||||||
LV_THEME_MATERIAL_FLAG_LIGHT = 0x02,
|
LV_THEME_MATERIAL_FLAG_LIGHT = 0x02,
|
||||||
LV_THEME_MATERIAL_FLAG_NO_TRANSITION = 0x10,
|
LV_THEME_MATERIAL_FLAG_NO_TRANSITION = 0x10,
|
||||||
|
LV_THEME_MATERIAL_FLAG_NO_FOCUS = 0x20,
|
||||||
} lv_theme_material_flag_t;
|
} lv_theme_material_flag_t;
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
|
|||||||
@@ -24,21 +24,21 @@
|
|||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
lv_style_t scr;
|
||||||
lv_style_t scr;
|
lv_style_t bg;
|
||||||
lv_style_t bg;
|
lv_style_t clip_corner;
|
||||||
lv_style_t clip_corner;
|
lv_style_t btn;
|
||||||
lv_style_t btn;
|
lv_style_t round;
|
||||||
lv_style_t round;
|
lv_style_t no_radius;
|
||||||
lv_style_t no_radius;
|
lv_style_t fg_color;
|
||||||
lv_style_t fg_color;
|
lv_style_t border_none;
|
||||||
lv_style_t border_none;
|
lv_style_t big_line_space; /*In roller or dropdownlist*/
|
||||||
lv_style_t big_line_space; /*In roller or dropdownlist*/
|
lv_style_t pad_none;
|
||||||
lv_style_t pad_none;
|
lv_style_t pad_normal;
|
||||||
lv_style_t pad_normal;
|
lv_style_t pad_small;
|
||||||
lv_style_t pad_small;
|
lv_style_t pad_inner;
|
||||||
lv_style_t pad_inner;
|
lv_style_t txt_underline;
|
||||||
|
|
||||||
#if LV_USE_ARC
|
#if LV_USE_ARC
|
||||||
lv_style_t arc_bg, arc_indic;
|
lv_style_t arc_bg, arc_indic;
|
||||||
@@ -79,12 +79,12 @@ lv_style_t pad_inner;
|
|||||||
#if LV_USE_TABVIEW
|
#if LV_USE_TABVIEW
|
||||||
lv_style_t tab_bg;
|
lv_style_t tab_bg;
|
||||||
#endif
|
#endif
|
||||||
}theme_styles_t;
|
} theme_styles_t;
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name);
|
||||||
static void style_init_reset(lv_style_t * style);
|
static void style_init_reset(lv_style_t * style);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
@@ -123,6 +123,8 @@ static void basic_init(void)
|
|||||||
lv_style_set_bg_opa(&styles->bg, LV_STATE_DEFAULT, LV_OPA_COVER);
|
lv_style_set_bg_opa(&styles->bg, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||||
lv_style_set_bg_color(&styles->bg, LV_STATE_DEFAULT, BG_COLOR);
|
lv_style_set_bg_color(&styles->bg, LV_STATE_DEFAULT, BG_COLOR);
|
||||||
lv_style_set_border_width(&styles->bg, LV_STATE_DEFAULT, BORDER_WIDTH);
|
lv_style_set_border_width(&styles->bg, LV_STATE_DEFAULT, BORDER_WIDTH);
|
||||||
|
lv_style_set_border_width(&styles->bg, LV_STATE_FOCUSED, BORDER_WIDTH * 2);
|
||||||
|
lv_style_set_border_width(&styles->bg, LV_STATE_FOCUSED | LV_STATE_EDITED, BORDER_WIDTH * 3);
|
||||||
lv_style_set_border_color(&styles->bg, LV_STATE_DEFAULT, FG_COLOR);
|
lv_style_set_border_color(&styles->bg, LV_STATE_DEFAULT, FG_COLOR);
|
||||||
lv_style_set_line_width(&styles->bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100, 1));
|
lv_style_set_line_width(&styles->bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100, 1));
|
||||||
lv_style_set_scale_end_line_width(&styles->bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100, 1));
|
lv_style_set_scale_end_line_width(&styles->bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100, 1));
|
||||||
@@ -140,10 +142,11 @@ static void basic_init(void)
|
|||||||
style_init_reset(&styles->clip_corner);
|
style_init_reset(&styles->clip_corner);
|
||||||
lv_style_set_clip_corner(&styles->clip_corner, LV_STATE_DEFAULT, true);
|
lv_style_set_clip_corner(&styles->clip_corner, LV_STATE_DEFAULT, true);
|
||||||
|
|
||||||
|
|
||||||
style_init_reset(&styles->btn);
|
style_init_reset(&styles->btn);
|
||||||
lv_style_set_radius(&styles->btn, LV_STATE_DEFAULT, RADIUS);
|
lv_style_set_radius(&styles->btn, LV_STATE_DEFAULT, RADIUS);
|
||||||
lv_style_set_border_width(&styles->btn, LV_STATE_DEFAULT, BORDER_WIDTH);
|
lv_style_set_border_width(&styles->btn, LV_STATE_DEFAULT, BORDER_WIDTH);
|
||||||
|
lv_style_set_border_width(&styles->btn, LV_STATE_FOCUSED, BORDER_WIDTH + 1);
|
||||||
|
lv_style_set_border_width(&styles->btn, LV_STATE_FOCUSED | LV_STATE_EDITED, BORDER_WIDTH + 2);
|
||||||
lv_style_set_border_color(&styles->btn, LV_STATE_DEFAULT, FG_COLOR);
|
lv_style_set_border_color(&styles->btn, LV_STATE_DEFAULT, FG_COLOR);
|
||||||
lv_style_set_bg_color(&styles->btn, LV_STATE_DEFAULT, BG_COLOR);
|
lv_style_set_bg_color(&styles->btn, LV_STATE_DEFAULT, BG_COLOR);
|
||||||
lv_style_set_bg_color(&styles->btn, LV_STATE_PRESSED, FG_COLOR);
|
lv_style_set_bg_color(&styles->btn, LV_STATE_PRESSED, FG_COLOR);
|
||||||
@@ -205,6 +208,9 @@ static void basic_init(void)
|
|||||||
|
|
||||||
style_init_reset(&styles->pad_inner);
|
style_init_reset(&styles->pad_inner);
|
||||||
lv_style_set_pad_inner(&styles->pad_inner, LV_STATE_DEFAULT, LV_DPI / 15);
|
lv_style_set_pad_inner(&styles->pad_inner, LV_STATE_DEFAULT, LV_DPI / 15);
|
||||||
|
|
||||||
|
style_init_reset(&styles->txt_underline);
|
||||||
|
lv_style_set_text_decor(&styles->txt_underline, LV_STATE_FOCUSED, LV_TEXT_DECOR_UNDERLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void arc_init(void)
|
static void arc_init(void)
|
||||||
@@ -553,14 +559,17 @@ lv_theme_t * lv_theme_mono_init(lv_color_t color_primary, lv_color_t color_secon
|
|||||||
table_init();
|
table_init();
|
||||||
win_init();
|
win_init();
|
||||||
|
|
||||||
theme.apply_xcb = theme_apply;
|
theme.apply_xcb = NULL;
|
||||||
|
theme.apply_cb = theme_apply;
|
||||||
|
|
||||||
return &theme;
|
return &theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||||
{
|
{
|
||||||
|
LV_UNUSED(th);
|
||||||
|
|
||||||
lv_style_list_t * list;
|
lv_style_list_t * list;
|
||||||
|
|
||||||
switch(name) {
|
switch(name) {
|
||||||
@@ -568,18 +577,15 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_SCR:
|
case LV_THEME_SCR:
|
||||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->scr);
|
_lv_style_list_add_style(list, &styles->scr);
|
||||||
break;
|
break;
|
||||||
case LV_THEME_OBJ:
|
case LV_THEME_OBJ:
|
||||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
#if LV_USE_CONT
|
#if LV_USE_CONT
|
||||||
case LV_THEME_CONT:
|
case LV_THEME_CONT:
|
||||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
@@ -587,34 +593,31 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_BTN
|
#if LV_USE_BTN
|
||||||
case LV_THEME_BTN:
|
case LV_THEME_BTN:
|
||||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
|
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_BTNMATRIX
|
#if LV_USE_BTNMATRIX
|
||||||
case LV_THEME_BTNMATRIX:
|
case LV_THEME_BTNMATRIX:
|
||||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
|
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_KEYBOARD
|
#if LV_USE_KEYBOARD
|
||||||
case LV_THEME_KEYBOARD:
|
case LV_THEME_KEYBOARD:
|
||||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->pad_small);
|
_lv_style_list_add_style(list, &styles->pad_small);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BTN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
@@ -623,13 +626,11 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_BAR
|
#if LV_USE_BAR
|
||||||
case LV_THEME_BAR:
|
case LV_THEME_BAR:
|
||||||
lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->pad_none);
|
_lv_style_list_add_style(list, &styles->pad_none);
|
||||||
_lv_style_list_add_style(list, &styles->round);
|
_lv_style_list_add_style(list, &styles->round);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->fg_color);
|
_lv_style_list_add_style(list, &styles->fg_color);
|
||||||
@@ -639,18 +640,15 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_SWITCH
|
#if LV_USE_SWITCH
|
||||||
case LV_THEME_SWITCH:
|
case LV_THEME_SWITCH:
|
||||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->pad_none);
|
_lv_style_list_add_style(list, &styles->pad_none);
|
||||||
_lv_style_list_add_style(list, &styles->round);
|
_lv_style_list_add_style(list, &styles->round);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->fg_color);
|
_lv_style_list_add_style(list, &styles->fg_color);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->pad_none);
|
_lv_style_list_add_style(list, &styles->pad_none);
|
||||||
@@ -660,46 +658,39 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_CANVAS
|
#if LV_USE_CANVAS
|
||||||
case LV_THEME_CANVAS:
|
case LV_THEME_CANVAS:
|
||||||
lv_obj_clean_style_list(obj, LV_CANVAS_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CANVAS_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_CANVAS_PART_MAIN);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_IMG
|
#if LV_USE_IMG
|
||||||
case LV_THEME_IMAGE:
|
case LV_THEME_IMAGE:
|
||||||
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_IMGBTN
|
#if LV_USE_IMGBTN
|
||||||
case LV_THEME_IMGBTN:
|
case LV_THEME_IMGBTN:
|
||||||
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_LABEL
|
#if LV_USE_LABEL
|
||||||
case LV_THEME_LABEL:
|
case LV_THEME_LABEL:
|
||||||
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_LINE
|
#if LV_USE_LINE
|
||||||
case LV_THEME_LINE:
|
case LV_THEME_LINE:
|
||||||
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_ARC
|
#if LV_USE_ARC
|
||||||
case LV_THEME_ARC:
|
case LV_THEME_ARC:
|
||||||
lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->arc_bg);
|
_lv_style_list_add_style(list, &styles->arc_bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->arc_indic);
|
_lv_style_list_add_style(list, &styles->arc_indic);
|
||||||
break;
|
break;
|
||||||
@@ -707,12 +698,10 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_SPINNER
|
#if LV_USE_SPINNER
|
||||||
case LV_THEME_SPINNER:
|
case LV_THEME_SPINNER:
|
||||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->tick_line);
|
_lv_style_list_add_style(list, &styles->tick_line);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->fg_color);
|
_lv_style_list_add_style(list, &styles->fg_color);
|
||||||
@@ -722,59 +711,53 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_SLIDER
|
#if LV_USE_SLIDER
|
||||||
case LV_THEME_SLIDER:
|
case LV_THEME_SLIDER:
|
||||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->pad_none);
|
_lv_style_list_add_style(list, &styles->pad_none);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->fg_color);
|
_lv_style_list_add_style(list, &styles->fg_color);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->round);
|
_lv_style_list_add_style(list, &styles->round);
|
||||||
_lv_style_list_add_style(list, &styles->pad_small);
|
_lv_style_list_add_style(list, &styles->pad_small);
|
||||||
|
_lv_style_list_add_style(list, &styles->fg_color);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_CHECKBOX
|
#if LV_USE_CHECKBOX
|
||||||
case LV_THEME_CHECKBOX:
|
case LV_THEME_CHECKBOX:
|
||||||
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->pad_small);
|
_lv_style_list_add_style(list, &styles->pad_small);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
|
_lv_style_list_add_style(list, &styles->pad_small);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_MSGBOX
|
#if LV_USE_MSGBOX
|
||||||
case LV_THEME_MSGBOX:
|
case LV_THEME_MSGBOX:
|
||||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_MSGBOX_BTNS:
|
case LV_THEME_MSGBOX_BTNS:
|
||||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||||
_lv_style_list_add_style(list, &styles->pad_inner);
|
_lv_style_list_add_style(list, &styles->pad_inner);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
|
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#if LV_USE_LED
|
#if LV_USE_LED
|
||||||
case LV_THEME_LED:
|
case LV_THEME_LED:
|
||||||
lv_obj_clean_style_list(obj, LV_LED_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->round);
|
_lv_style_list_add_style(list, &styles->round);
|
||||||
@@ -782,45 +765,32 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
#endif
|
#endif
|
||||||
#if LV_USE_PAGE
|
#if LV_USE_PAGE
|
||||||
case LV_THEME_PAGE:
|
case LV_THEME_PAGE:
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||||
_lv_style_list_add_style(list, &styles->pad_inner);
|
_lv_style_list_add_style(list, &styles->pad_inner);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->sb);
|
_lv_style_list_add_style(list, &styles->sb);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if LV_USE_TABVIEW
|
#if LV_USE_TABVIEW
|
||||||
case LV_THEME_TABVIEW:
|
case LV_THEME_TABVIEW:
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->scr);
|
_lv_style_list_add_style(list, &styles->scr);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||||
_lv_style_list_add_style(list, &styles->tab_bg);
|
_lv_style_list_add_style(list, &styles->tab_bg);
|
||||||
_lv_style_list_add_style(list, &styles->pad_small);
|
_lv_style_list_add_style(list, &styles->pad_small);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
|
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
|
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_TABVIEW_PAGE:
|
case LV_THEME_TABVIEW_PAGE:
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||||
_lv_style_list_add_style(list, &styles->pad_normal);
|
_lv_style_list_add_style(list, &styles->pad_normal);
|
||||||
|
|
||||||
@@ -829,15 +799,12 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_TILEVIEW
|
#if LV_USE_TILEVIEW
|
||||||
case LV_THEME_TILEVIEW:
|
case LV_THEME_TILEVIEW:
|
||||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->sb);
|
_lv_style_list_add_style(list, &styles->sb);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
@@ -846,12 +813,10 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_ROLLER
|
#if LV_USE_ROLLER
|
||||||
case LV_THEME_ROLLER:
|
case LV_THEME_ROLLER:
|
||||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->big_line_space);
|
_lv_style_list_add_style(list, &styles->big_line_space);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_SELECTED);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->fg_color);
|
_lv_style_list_add_style(list, &styles->fg_color);
|
||||||
@@ -862,53 +827,44 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_OBJMASK
|
#if LV_USE_OBJMASK
|
||||||
case LV_THEME_OBJMASK:
|
case LV_THEME_OBJMASK:
|
||||||
lv_obj_clean_style_list(obj, LV_OBJMASK_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_LIST
|
#if LV_USE_LIST
|
||||||
case LV_THEME_LIST:
|
case LV_THEME_LIST:
|
||||||
lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->pad_none);
|
_lv_style_list_add_style(list, &styles->pad_none);
|
||||||
_lv_style_list_add_style(list, &styles->clip_corner);
|
_lv_style_list_add_style(list, &styles->clip_corner);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->sb);
|
_lv_style_list_add_style(list, &styles->sb);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_LIST_BTN:
|
case LV_THEME_LIST_BTN:
|
||||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
_lv_style_list_add_style(list, &styles->list_btn);
|
_lv_style_list_add_style(list, &styles->list_btn);
|
||||||
|
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_DROPDOWN
|
#if LV_USE_DROPDOWN
|
||||||
case LV_THEME_DROPDOWN:
|
case LV_THEME_DROPDOWN:
|
||||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->big_line_space);
|
_lv_style_list_add_style(list, &styles->big_line_space);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->sb);
|
_lv_style_list_add_style(list, &styles->sb);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->fg_color);
|
_lv_style_list_add_style(list, &styles->fg_color);
|
||||||
@@ -918,42 +874,34 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_CHART
|
#if LV_USE_CHART
|
||||||
case LV_THEME_CHART:
|
case LV_THEME_CHART:
|
||||||
lv_obj_clean_style_list(obj, LV_CHART_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->border_none);
|
_lv_style_list_add_style(list, &styles->border_none);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||||
_lv_style_list_add_style(list, &styles->chart_series);
|
_lv_style_list_add_style(list, &styles->chart_series);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if LV_USE_TABLE
|
#if LV_USE_TABLE
|
||||||
case LV_THEME_TABLE:
|
case LV_THEME_TABLE:
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL1);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->no_radius);
|
_lv_style_list_add_style(list, &styles->no_radius);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL2);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->no_radius);
|
_lv_style_list_add_style(list, &styles->no_radius);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL3);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->no_radius);
|
_lv_style_list_add_style(list, &styles->no_radius);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL4);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->no_radius);
|
_lv_style_list_add_style(list, &styles->no_radius);
|
||||||
@@ -962,25 +910,20 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_WIN
|
#if LV_USE_WIN
|
||||||
case LV_THEME_WIN:
|
case LV_THEME_WIN:
|
||||||
lv_obj_clean_style_list(obj, LV_WIN_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->sb);
|
_lv_style_list_add_style(list, &styles->sb);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_WIN_BTN:
|
case LV_THEME_WIN_BTN:
|
||||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
@@ -989,17 +932,12 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_TEXTAREA
|
#if LV_USE_TEXTAREA
|
||||||
case LV_THEME_TEXTAREA:
|
case LV_THEME_TEXTAREA:
|
||||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||||
_lv_style_list_add_style(list, &styles->ta_cursor);
|
_lv_style_list_add_style(list, &styles->ta_cursor);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->sb);
|
_lv_style_list_add_style(list, &styles->sb);
|
||||||
break;
|
break;
|
||||||
@@ -1008,33 +946,30 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_SPINBOX
|
#if LV_USE_SPINBOX
|
||||||
case LV_THEME_SPINBOX:
|
case LV_THEME_SPINBOX:
|
||||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->fg_color);
|
_lv_style_list_add_style(list, &styles->fg_color);
|
||||||
_lv_style_list_add_style(list, &styles->pad_none);
|
_lv_style_list_add_style(list, &styles->pad_none);
|
||||||
_lv_style_list_add_style(list, &styles->no_radius);
|
_lv_style_list_add_style(list, &styles->no_radius);
|
||||||
|
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_SPINBOX_BTN:
|
case LV_THEME_SPINBOX_BTN:
|
||||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
|
_lv_style_list_add_style(list, &styles->txt_underline);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_CALENDAR
|
#if LV_USE_CALENDAR
|
||||||
case LV_THEME_CALENDAR:
|
case LV_THEME_CALENDAR:
|
||||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DATE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
@@ -1042,12 +977,10 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
_lv_style_list_add_style(list, &styles->border_none);
|
_lv_style_list_add_style(list, &styles->border_none);
|
||||||
_lv_style_list_add_style(list, &styles->calendar_date);
|
_lv_style_list_add_style(list, &styles->calendar_date);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_HEADER);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||||
_lv_style_list_add_style(list, &styles->pad_normal);
|
_lv_style_list_add_style(list, &styles->pad_normal);
|
||||||
_lv_style_list_add_style(list, &styles->border_none);
|
_lv_style_list_add_style(list, &styles->border_none);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->pad_small);
|
_lv_style_list_add_style(list, &styles->pad_small);
|
||||||
@@ -1055,11 +988,9 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
#endif
|
#endif
|
||||||
#if LV_USE_CPICKER
|
#if LV_USE_CPICKER
|
||||||
case LV_THEME_CPICKER:
|
case LV_THEME_CPICKER:
|
||||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_KNOB);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->round);
|
_lv_style_list_add_style(list, &styles->round);
|
||||||
@@ -1068,7 +999,6 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_LINEMETER
|
#if LV_USE_LINEMETER
|
||||||
case LV_THEME_LINEMETER:
|
case LV_THEME_LINEMETER:
|
||||||
lv_obj_clean_style_list(obj, LV_LINEMETER_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->round);
|
_lv_style_list_add_style(list, &styles->round);
|
||||||
@@ -1077,16 +1007,13 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
#endif
|
#endif
|
||||||
#if LV_USE_GAUGE
|
#if LV_USE_GAUGE
|
||||||
case LV_THEME_GAUGE:
|
case LV_THEME_GAUGE:
|
||||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->round);
|
_lv_style_list_add_style(list, &styles->round);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAJOR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||||
_lv_style_list_add_style(list, &styles->gauge_major);
|
_lv_style_list_add_style(list, &styles->gauge_major);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||||
_lv_style_list_add_style(list, &styles->gauge_needle);
|
_lv_style_list_add_style(list, &styles->gauge_needle);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ typedef struct {
|
|||||||
/**********************
|
/**********************
|
||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
@@ -80,7 +80,8 @@ static void basic_init(void)
|
|||||||
style_init_reset(&styles->btn);
|
style_init_reset(&styles->btn);
|
||||||
lv_style_set_bg_color(&styles->btn, LV_STATE_PRESSED, lv_color_hex3(0xccc));
|
lv_style_set_bg_color(&styles->btn, LV_STATE_PRESSED, lv_color_hex3(0xccc));
|
||||||
lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED, theme.color_primary);
|
lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED, theme.color_primary);
|
||||||
lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary, LV_OPA_30));
|
lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary,
|
||||||
|
LV_OPA_30));
|
||||||
lv_style_set_bg_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_SILVER);
|
lv_style_set_bg_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_SILVER);
|
||||||
lv_style_set_text_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
|
lv_style_set_text_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
|
||||||
lv_style_set_image_recolor(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
|
lv_style_set_image_recolor(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
|
||||||
@@ -401,14 +402,17 @@ lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_s
|
|||||||
table_init();
|
table_init();
|
||||||
win_init();
|
win_init();
|
||||||
|
|
||||||
theme.apply_xcb = theme_apply;
|
theme.apply_xcb = NULL;
|
||||||
|
theme.apply_cb = theme_apply;
|
||||||
|
|
||||||
return &theme;
|
return &theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||||
{
|
{
|
||||||
|
LV_UNUSED(th);
|
||||||
|
|
||||||
lv_style_list_t * list;
|
lv_style_list_t * list;
|
||||||
|
|
||||||
switch(name) {
|
switch(name) {
|
||||||
@@ -416,19 +420,16 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_SCR:
|
case LV_THEME_SCR:
|
||||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->tight);
|
_lv_style_list_add_style(list, &styles->tight);
|
||||||
break;
|
break;
|
||||||
case LV_THEME_OBJ:
|
case LV_THEME_OBJ:
|
||||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
#if LV_USE_CONT
|
#if LV_USE_CONT
|
||||||
case LV_THEME_CONT:
|
case LV_THEME_CONT:
|
||||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
@@ -436,7 +437,6 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_BTN
|
#if LV_USE_BTN
|
||||||
case LV_THEME_BTN:
|
case LV_THEME_BTN:
|
||||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
@@ -445,11 +445,9 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_BTNMATRIX
|
#if LV_USE_BTNMATRIX
|
||||||
case LV_THEME_BTNMATRIX:
|
case LV_THEME_BTNMATRIX:
|
||||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
@@ -458,11 +456,9 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_KEYBOARD
|
#if LV_USE_KEYBOARD
|
||||||
case LV_THEME_KEYBOARD:
|
case LV_THEME_KEYBOARD:
|
||||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BTN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
@@ -471,12 +467,10 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_BAR
|
#if LV_USE_BAR
|
||||||
case LV_THEME_BAR:
|
case LV_THEME_BAR:
|
||||||
lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->tight);
|
_lv_style_list_add_style(list, &styles->tight);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->color);
|
_lv_style_list_add_style(list, &styles->color);
|
||||||
@@ -485,18 +479,15 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_SWITCH
|
#if LV_USE_SWITCH
|
||||||
case LV_THEME_SWITCH:
|
case LV_THEME_SWITCH:
|
||||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->tight);
|
_lv_style_list_add_style(list, &styles->tight);
|
||||||
_lv_style_list_add_style(list, &styles->round);
|
_lv_style_list_add_style(list, &styles->round);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->color);
|
_lv_style_list_add_style(list, &styles->color);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->tight);
|
_lv_style_list_add_style(list, &styles->tight);
|
||||||
@@ -506,48 +497,41 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_CANVAS
|
#if LV_USE_CANVAS
|
||||||
case LV_THEME_CANVAS:
|
case LV_THEME_CANVAS:
|
||||||
lv_obj_clean_style_list(obj, LV_CANVAS_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CANVAS_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_CANVAS_PART_MAIN);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_IMG
|
#if LV_USE_IMG
|
||||||
case LV_THEME_IMAGE:
|
case LV_THEME_IMAGE:
|
||||||
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_IMGBTN
|
#if LV_USE_IMGBTN
|
||||||
case LV_THEME_IMGBTN:
|
case LV_THEME_IMGBTN:
|
||||||
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_LABEL
|
#if LV_USE_LABEL
|
||||||
case LV_THEME_LABEL:
|
case LV_THEME_LABEL:
|
||||||
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_LINE
|
#if LV_USE_LINE
|
||||||
case LV_THEME_LINE:
|
case LV_THEME_LINE:
|
||||||
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_ARC
|
#if LV_USE_ARC
|
||||||
case LV_THEME_ARC:
|
case LV_THEME_ARC:
|
||||||
lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->tick_line);
|
_lv_style_list_add_style(list, &styles->tick_line);
|
||||||
_lv_style_list_add_style(list, &styles->round);
|
_lv_style_list_add_style(list, &styles->round);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->color);
|
_lv_style_list_add_style(list, &styles->color);
|
||||||
@@ -557,12 +541,10 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_SPINNER
|
#if LV_USE_SPINNER
|
||||||
case LV_THEME_SPINNER:
|
case LV_THEME_SPINNER:
|
||||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->tick_line);
|
_lv_style_list_add_style(list, &styles->tick_line);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->color);
|
_lv_style_list_add_style(list, &styles->color);
|
||||||
@@ -572,16 +554,13 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_SLIDER
|
#if LV_USE_SLIDER
|
||||||
case LV_THEME_SLIDER:
|
case LV_THEME_SLIDER:
|
||||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->color);
|
_lv_style_list_add_style(list, &styles->color);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->round);
|
_lv_style_list_add_style(list, &styles->round);
|
||||||
@@ -590,10 +569,8 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_CHECKBOX
|
#if LV_USE_CHECKBOX
|
||||||
case LV_THEME_CHECKBOX:
|
case LV_THEME_CHECKBOX:
|
||||||
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
@@ -602,17 +579,14 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_MSGBOX
|
#if LV_USE_MSGBOX
|
||||||
case LV_THEME_MSGBOX:
|
case LV_THEME_MSGBOX:
|
||||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_MSGBOX_BTNS:
|
case LV_THEME_MSGBOX_BTNS:
|
||||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
@@ -621,7 +595,6 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
#endif
|
#endif
|
||||||
#if LV_USE_LED
|
#if LV_USE_LED
|
||||||
case LV_THEME_LED:
|
case LV_THEME_LED:
|
||||||
lv_obj_clean_style_list(obj, LV_LED_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->color);
|
_lv_style_list_add_style(list, &styles->color);
|
||||||
@@ -630,53 +603,43 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
#endif
|
#endif
|
||||||
#if LV_USE_PAGE
|
#if LV_USE_PAGE
|
||||||
case LV_THEME_PAGE:
|
case LV_THEME_PAGE:
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->gray);
|
_lv_style_list_add_style(list, &styles->gray);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if LV_USE_TABVIEW
|
#if LV_USE_TABVIEW
|
||||||
case LV_THEME_TABVIEW:
|
case LV_THEME_TABVIEW:
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->color);
|
_lv_style_list_add_style(list, &styles->color);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
|
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->color);
|
_lv_style_list_add_style(list, &styles->color);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_TABVIEW_PAGE:
|
case LV_THEME_TABVIEW_PAGE:
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->gray);
|
_lv_style_list_add_style(list, &styles->gray);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
@@ -685,15 +648,12 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_TILEVIEW
|
#if LV_USE_TILEVIEW
|
||||||
case LV_THEME_TILEVIEW:
|
case LV_THEME_TILEVIEW:
|
||||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
@@ -702,11 +662,9 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_ROLLER
|
#if LV_USE_ROLLER
|
||||||
case LV_THEME_ROLLER:
|
case LV_THEME_ROLLER:
|
||||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_SELECTED);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->color);
|
_lv_style_list_add_style(list, &styles->color);
|
||||||
@@ -716,27 +674,22 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_OBJMASK
|
#if LV_USE_OBJMASK
|
||||||
case LV_THEME_OBJMASK:
|
case LV_THEME_OBJMASK:
|
||||||
lv_obj_clean_style_list(obj, LV_OBJMASK_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_LIST
|
#if LV_USE_LIST
|
||||||
case LV_THEME_LIST:
|
case LV_THEME_LIST:
|
||||||
lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_LIST_BTN:
|
case LV_THEME_LIST_BTN:
|
||||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
@@ -745,20 +698,16 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_DROPDOWN
|
#if LV_USE_DROPDOWN
|
||||||
case LV_THEME_DROPDOWN:
|
case LV_THEME_DROPDOWN:
|
||||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->color);
|
_lv_style_list_add_style(list, &styles->color);
|
||||||
@@ -767,15 +716,12 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_CHART
|
#if LV_USE_CHART
|
||||||
case LV_THEME_CHART:
|
case LV_THEME_CHART:
|
||||||
lv_obj_clean_style_list(obj, LV_CHART_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->tight);
|
_lv_style_list_add_style(list, &styles->tight);
|
||||||
@@ -783,23 +729,18 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
#endif
|
#endif
|
||||||
#if LV_USE_TABLE
|
#if LV_USE_TABLE
|
||||||
case LV_THEME_TABLE:
|
case LV_THEME_TABLE:
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL1);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL2);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL3);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL4);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
@@ -807,25 +748,20 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_WIN
|
#if LV_USE_WIN
|
||||||
case LV_THEME_WIN:
|
case LV_THEME_WIN:
|
||||||
lv_obj_clean_style_list(obj, LV_WIN_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_WIN_BTN:
|
case LV_THEME_WIN_BTN:
|
||||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
@@ -834,20 +770,16 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_TEXTAREA
|
#if LV_USE_TEXTAREA
|
||||||
case LV_THEME_TEXTAREA:
|
case LV_THEME_TEXTAREA:
|
||||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||||
_lv_style_list_add_style(list, &styles->gray);
|
_lv_style_list_add_style(list, &styles->gray);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->tight);
|
_lv_style_list_add_style(list, &styles->tight);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
@@ -856,17 +788,14 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_SPINBOX
|
#if LV_USE_SPINBOX
|
||||||
case LV_THEME_SPINBOX:
|
case LV_THEME_SPINBOX:
|
||||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LV_THEME_SPINBOX_BTN:
|
case LV_THEME_SPINBOX_BTN:
|
||||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
@@ -875,21 +804,17 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_CALENDAR
|
#if LV_USE_CALENDAR
|
||||||
case LV_THEME_CALENDAR:
|
case LV_THEME_CALENDAR:
|
||||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_BG);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DATE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->btn);
|
_lv_style_list_add_style(list, &styles->btn);
|
||||||
_lv_style_list_add_style(list, &styles->tight);
|
_lv_style_list_add_style(list, &styles->tight);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_HEADER);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->tight);
|
_lv_style_list_add_style(list, &styles->tight);
|
||||||
@@ -897,11 +822,9 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
#endif
|
#endif
|
||||||
#if LV_USE_CPICKER
|
#if LV_USE_CPICKER
|
||||||
case LV_THEME_CPICKER:
|
case LV_THEME_CPICKER:
|
||||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_KNOB);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->round);
|
_lv_style_list_add_style(list, &styles->round);
|
||||||
@@ -910,7 +833,6 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
|
|
||||||
#if LV_USE_LINEMETER
|
#if LV_USE_LINEMETER
|
||||||
case LV_THEME_LINEMETER:
|
case LV_THEME_LINEMETER:
|
||||||
lv_obj_clean_style_list(obj, LV_LINEMETER_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->round);
|
_lv_style_list_add_style(list, &styles->round);
|
||||||
@@ -918,16 +840,13 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
#endif
|
#endif
|
||||||
#if LV_USE_GAUGE
|
#if LV_USE_GAUGE
|
||||||
case LV_THEME_GAUGE:
|
case LV_THEME_GAUGE:
|
||||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAIN);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
_lv_style_list_add_style(list, &styles->round);
|
_lv_style_list_add_style(list, &styles->round);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAJOR);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||||
_lv_style_list_add_style(list, &styles->tick_line);
|
_lv_style_list_add_style(list, &styles->tick_line);
|
||||||
|
|
||||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
|
||||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||||
_lv_style_list_add_style(list, &styles->bg);
|
_lv_style_list_add_style(list, &styles->bg);
|
||||||
break;
|
break;
|
||||||
@@ -936,10 +855,7 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lv_obj_refresh_style(obj, LV_STYLE_PROP_ALL);
|
lv_obj_refresh_style(obj, LV_STYLE_PROP_ALL);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "lv_arc.h"
|
#include "lv_arc.h"
|
||||||
#if LV_USE_ARC != 0
|
#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_misc/lv_math.h"
|
||||||
#include "../lv_draw/lv_draw_arc.h"
|
#include "../lv_draw/lv_draw_arc.h"
|
||||||
#include "../lv_themes/lv_theme.h"
|
#include "../lv_themes/lv_theme.h"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "lv_bar.h"
|
#include "lv_bar.h"
|
||||||
#if LV_USE_BAR != 0
|
#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_draw/lv_draw.h"
|
||||||
#include "../lv_themes/lv_theme.h"
|
#include "../lv_themes/lv_theme.h"
|
||||||
#include "../lv_misc/lv_anim.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
|
* Set a new value on the bar
|
||||||
* @param bar pointer to a bar object
|
* @param bar pointer to a bar object
|
||||||
* @param value new value
|
* @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)
|
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
|
* Set a new start value on the bar
|
||||||
* @param bar pointer to a bar object
|
* @param bar pointer to a bar object
|
||||||
* @param value new start value
|
* @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)
|
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
|
* Set a new start value on the bar
|
||||||
* @param bar pointer to a bar object
|
* @param bar pointer to a bar object
|
||||||
* @param value new start value
|
* @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);
|
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 <string.h>
|
||||||
#include "../lv_core/lv_group.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_draw/lv_draw.h"
|
||||||
#include "../lv_themes/lv_theme.h"
|
#include "../lv_themes/lv_theme.h"
|
||||||
#include "../lv_misc/lv_area.h"
|
#include "../lv_misc/lv_area.h"
|
||||||
@@ -202,7 +202,8 @@ lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn)
|
|||||||
if(obj_state & LV_STATE_CHECKED) {
|
if(obj_state & LV_STATE_CHECKED) {
|
||||||
if(obj_state & LV_STATE_PRESSED) return LV_BTN_STATE_CHECKED_PRESSED;
|
if(obj_state & LV_STATE_PRESSED) return LV_BTN_STATE_CHECKED_PRESSED;
|
||||||
else return LV_BTN_STATE_CHECKED_RELEASED;
|
else return LV_BTN_STATE_CHECKED_RELEASED;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if(obj_state & LV_STATE_PRESSED) return LV_BTN_STATE_PRESSED;
|
if(obj_state & LV_STATE_PRESSED) return LV_BTN_STATE_PRESSED;
|
||||||
else return LV_BTN_STATE_RELEASED;
|
else return LV_BTN_STATE_RELEASED;
|
||||||
}
|
}
|
||||||
@@ -288,6 +289,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(sign == LV_SIGNAL_CONTROL) {
|
else if(sign == LV_SIGNAL_CONTROL) {
|
||||||
|
#if LV_USE_GROUP
|
||||||
char c = *((char *)param);
|
char c = *((char *)param);
|
||||||
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
|
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
|
||||||
if(lv_btn_get_checkable(btn)) {
|
if(lv_btn_get_checkable(btn)) {
|
||||||
@@ -308,6 +310,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
|||||||
if(res != LV_RES_OK) return res;
|
if(res != LV_RES_OK) return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "lv_btnmatrix.h"
|
#include "lv_btnmatrix.h"
|
||||||
#if LV_USE_BTNMATRIX != 0
|
#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_core/lv_group.h"
|
||||||
#include "../lv_draw/lv_draw.h"
|
#include "../lv_draw/lv_draw.h"
|
||||||
#include "../lv_core/lv_refr.h"
|
#include "../lv_core/lv_refr.h"
|
||||||
@@ -422,6 +422,23 @@ void lv_btnmatrix_set_one_check(lv_obj_t * btnm, bool one_chk)
|
|||||||
make_one_button_toggled(btnm, 0);
|
make_one_button_toggled(btnm, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the align of the map text (left, right or center)
|
||||||
|
* @param btnm pointer to a btnmatrix object
|
||||||
|
* @param align LV_LABEL_ALIGN_LEFT, LV_LABEL_ALIGN_RIGHT or LV_LABEL_ALIGN_CENTER
|
||||||
|
*/
|
||||||
|
void lv_btnmatrix_set_align(lv_obj_t * btnm, lv_label_align_t align)
|
||||||
|
{
|
||||||
|
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
|
||||||
|
|
||||||
|
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
|
||||||
|
if(ext->align == align) return;
|
||||||
|
|
||||||
|
ext->align = align;
|
||||||
|
|
||||||
|
lv_obj_invalidate(btnm);
|
||||||
|
}
|
||||||
|
|
||||||
/*=====================
|
/*=====================
|
||||||
* Getter functions
|
* Getter functions
|
||||||
*====================*/
|
*====================*/
|
||||||
@@ -563,12 +580,38 @@ bool lv_btnmatrix_get_one_check(const lv_obj_t * btnm)
|
|||||||
return ext->one_check;
|
return ext->one_check;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the align attribute
|
||||||
|
* @param btnm pointer to a btnmatrix object
|
||||||
|
* @return LV_LABEL_ALIGN_LEFT, LV_LABEL_ALIGN_RIGHT or LV_LABEL_ALIGN_CENTER
|
||||||
|
*/
|
||||||
|
lv_label_align_t lv_btnmatrix_get_align(const lv_obj_t * btnm)
|
||||||
|
{
|
||||||
|
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
|
||||||
|
|
||||||
|
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
|
||||||
|
|
||||||
|
lv_label_align_t align = ext->align;
|
||||||
|
|
||||||
|
if(align == LV_LABEL_ALIGN_AUTO) {
|
||||||
|
#if LV_USE_BIDI
|
||||||
|
lv_bidi_dir_t base_dir = lv_obj_get_base_dir(btnm);
|
||||||
|
if(base_dir == LV_BIDI_DIR_RTL) align = LV_LABEL_ALIGN_RIGHT;
|
||||||
|
else align = LV_LABEL_ALIGN_LEFT;
|
||||||
|
#else
|
||||||
|
align = LV_LABEL_ALIGN_LEFT;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return align;
|
||||||
|
}
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC FUNCTIONS
|
* STATIC FUNCTIONS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 btnm pointer to a button matrix object
|
||||||
* @param clip_area the object will be drawn only in this area
|
* @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
|
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||||
@@ -598,7 +641,10 @@ static lv_design_res_t lv_btnmatrix_design(lv_obj_t * btnm, const lv_area_t * cl
|
|||||||
uint16_t btn_i = 0;
|
uint16_t btn_i = 0;
|
||||||
uint16_t txt_i = 0;
|
uint16_t txt_i = 0;
|
||||||
lv_txt_flag_t txt_flag = LV_TXT_FLAG_NONE;
|
lv_txt_flag_t txt_flag = LV_TXT_FLAG_NONE;
|
||||||
if(ext->recolor) txt_flag = LV_TXT_FLAG_RECOLOR;
|
if(ext->recolor) txt_flag |= LV_TXT_FLAG_RECOLOR;
|
||||||
|
lv_label_align_t align = lv_btnmatrix_get_align(btnm);
|
||||||
|
if(align == LV_LABEL_ALIGN_CENTER) txt_flag |= LV_TXT_FLAG_CENTER;
|
||||||
|
if(align == LV_LABEL_ALIGN_RIGHT) txt_flag |= LV_TXT_FLAG_RIGHT;
|
||||||
|
|
||||||
lv_draw_rect_dsc_t draw_rect_rel_dsc;
|
lv_draw_rect_dsc_t draw_rect_rel_dsc;
|
||||||
lv_draw_label_dsc_t draw_label_rel_dsc;
|
lv_draw_label_dsc_t draw_label_rel_dsc;
|
||||||
@@ -612,7 +658,6 @@ static lv_design_res_t lv_btnmatrix_design(lv_obj_t * btnm, const lv_area_t * cl
|
|||||||
lv_draw_rect_dsc_t draw_rect_tmp_dsc;
|
lv_draw_rect_dsc_t draw_rect_tmp_dsc;
|
||||||
lv_draw_label_dsc_t draw_label_tmp_dsc;
|
lv_draw_label_dsc_t draw_label_tmp_dsc;
|
||||||
|
|
||||||
/*The state changes without re-caching the styles, disable the use of cache*/
|
|
||||||
lv_state_t state_ori = btnm->state;
|
lv_state_t state_ori = btnm->state;
|
||||||
btnm->state = LV_STATE_DEFAULT;
|
btnm->state = LV_STATE_DEFAULT;
|
||||||
lv_draw_rect_dsc_init(&draw_rect_rel_dsc);
|
lv_draw_rect_dsc_init(&draw_rect_rel_dsc);
|
||||||
@@ -649,9 +694,20 @@ static lv_design_res_t lv_btnmatrix_design(lv_obj_t * btnm, const lv_area_t * cl
|
|||||||
/*Choose the style*/
|
/*Choose the style*/
|
||||||
lv_draw_rect_dsc_t * draw_rect_dsc_act;
|
lv_draw_rect_dsc_t * draw_rect_dsc_act;
|
||||||
lv_draw_label_dsc_t * draw_label_dsc_act;
|
lv_draw_label_dsc_t * draw_label_dsc_act;
|
||||||
bool tgl_state = button_get_tgl_state(ext->ctrl_bits[btn_i]);
|
lv_state_t btn_state = LV_STATE_DEFAULT;
|
||||||
|
if(button_get_tgl_state(ext->ctrl_bits[btn_i])) btn_state |= LV_STATE_CHECKED;
|
||||||
|
if(button_is_inactive(ext->ctrl_bits[btn_i])) btn_state |= LV_STATE_DISABLED;
|
||||||
|
if(btn_i == ext->btn_id_pr) btn_state |= LV_STATE_PRESSED;
|
||||||
|
if(btn_i == ext->btn_id_focused) {
|
||||||
|
btn_state |= LV_STATE_FOCUSED;
|
||||||
|
if(state_ori & LV_STATE_EDITED) btn_state |= LV_STATE_EDITED;
|
||||||
|
}
|
||||||
|
|
||||||
if(tgl_state) {
|
if(btn_state == LV_STATE_DEFAULT) {
|
||||||
|
draw_rect_dsc_act = &draw_rect_rel_dsc;
|
||||||
|
draw_label_dsc_act = &draw_label_rel_dsc;
|
||||||
|
}
|
||||||
|
else if(btn_state == LV_STATE_CHECKED) {
|
||||||
if(!chk_inited) {
|
if(!chk_inited) {
|
||||||
btnm->state = LV_STATE_CHECKED;
|
btnm->state = LV_STATE_CHECKED;
|
||||||
lv_draw_rect_dsc_init(&draw_rect_chk_dsc);
|
lv_draw_rect_dsc_init(&draw_rect_chk_dsc);
|
||||||
@@ -662,9 +718,10 @@ static lv_design_res_t lv_btnmatrix_design(lv_obj_t * btnm, const lv_area_t * cl
|
|||||||
btnm->state = state_ori;
|
btnm->state = state_ori;
|
||||||
chk_inited = true;
|
chk_inited = true;
|
||||||
}
|
}
|
||||||
|
draw_rect_dsc_act = &draw_rect_chk_dsc;
|
||||||
|
draw_label_dsc_act = &draw_label_chk_dsc;
|
||||||
}
|
}
|
||||||
|
else if(btn_state == LV_STATE_CHECKED) {
|
||||||
if(button_is_inactive(ext->ctrl_bits[btn_i])) {
|
|
||||||
if(!disabled_inited) {
|
if(!disabled_inited) {
|
||||||
btnm->state = LV_STATE_DISABLED;
|
btnm->state = LV_STATE_DISABLED;
|
||||||
lv_draw_rect_dsc_init(&draw_rect_ina_dsc);
|
lv_draw_rect_dsc_init(&draw_rect_ina_dsc);
|
||||||
@@ -678,21 +735,9 @@ static lv_design_res_t lv_btnmatrix_design(lv_obj_t * btnm, const lv_area_t * cl
|
|||||||
draw_rect_dsc_act = &draw_rect_ina_dsc;
|
draw_rect_dsc_act = &draw_rect_ina_dsc;
|
||||||
draw_label_dsc_act = &draw_label_ina_dsc;
|
draw_label_dsc_act = &draw_label_ina_dsc;
|
||||||
}
|
}
|
||||||
/*Simple released or checked buttons button*/
|
/*In other cases get the styles directly without caching them*/
|
||||||
else if(btn_i != ext->btn_id_pr && btn_i != ext->btn_id_focused) {
|
|
||||||
draw_rect_dsc_act = tgl_state ? &draw_rect_chk_dsc : &draw_rect_rel_dsc;
|
|
||||||
draw_label_dsc_act = tgl_state ? &draw_label_chk_dsc : &draw_label_rel_dsc;
|
|
||||||
}
|
|
||||||
/*Focused and/or pressed + checked or released button*/
|
|
||||||
else {
|
else {
|
||||||
btnm->state = LV_STATE_DEFAULT;
|
btnm->state = btn_state;
|
||||||
if(tgl_state) btnm->state = LV_STATE_CHECKED;
|
|
||||||
if(ext->btn_id_pr == btn_i) btnm->state |= LV_STATE_PRESSED;
|
|
||||||
if(ext->btn_id_focused == btn_i) {
|
|
||||||
btnm->state |= LV_STATE_FOCUSED;
|
|
||||||
if(state_ori & LV_STATE_EDITED) btnm->state |= LV_STATE_EDITED;
|
|
||||||
}
|
|
||||||
|
|
||||||
lv_draw_rect_dsc_init(&draw_rect_tmp_dsc);
|
lv_draw_rect_dsc_init(&draw_rect_tmp_dsc);
|
||||||
lv_draw_label_dsc_init(&draw_label_tmp_dsc);
|
lv_draw_label_dsc_init(&draw_label_tmp_dsc);
|
||||||
lv_obj_init_draw_rect_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_rect_tmp_dsc);
|
lv_obj_init_draw_rect_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_rect_tmp_dsc);
|
||||||
@@ -821,11 +866,11 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ext->btn_id_act != LV_BTNMATRIX_BTN_NONE) {
|
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {
|
||||||
if(button_is_click_trig(ext->ctrl_bits[ext->btn_id_act]) == false &&
|
if(button_is_click_trig(ext->ctrl_bits[ext->btn_id_pr]) == false &&
|
||||||
button_is_inactive(ext->ctrl_bits[ext->btn_id_act]) == false &&
|
button_is_inactive(ext->ctrl_bits[ext->btn_id_pr]) == false &&
|
||||||
button_is_hidden(ext->ctrl_bits[ext->btn_id_act]) == false) {
|
button_is_hidden(ext->ctrl_bits[ext->btn_id_pr]) == false) {
|
||||||
uint32_t b = ext->btn_id_act;
|
uint32_t b = ext->btn_id_pr;
|
||||||
res = lv_event_send(btnm, LV_EVENT_VALUE_CHANGED, &b);
|
res = lv_event_send(btnm, LV_EVENT_VALUE_CHANGED, &b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -844,21 +889,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) {
|
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {
|
||||||
invalidate_button_area(btnm, ext->btn_id_pr);
|
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*/
|
lv_indev_reset_long_press(param); /*Start the log press time again on the new button*/
|
||||||
if(btn_pr != LV_BTNMATRIX_BTN_NONE &&
|
if(btn_pr != LV_BTNMATRIX_BTN_NONE &&
|
||||||
button_is_inactive(ext->ctrl_bits[btn_pr]) == false &&
|
button_is_inactive(ext->ctrl_bits[btn_pr]) == false &&
|
||||||
button_is_hidden(ext->ctrl_bits[btn_pr]) == false) {
|
button_is_hidden(ext->ctrl_bits[btn_pr]) == false) {
|
||||||
/* Send VALUE_CHANGED for the newly pressed button */
|
/* 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);
|
res = lv_event_send(btnm, LV_EVENT_VALUE_CHANGED, &b);
|
||||||
if(res == LV_RES_OK) {
|
if(res == LV_RES_OK) {
|
||||||
invalidate_button_area(btnm, btn_pr);
|
invalidate_button_area(btnm, btn_pr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ext->btn_id_pr = btn_pr;
|
|
||||||
ext->btn_id_act = btn_pr;
|
|
||||||
}
|
}
|
||||||
else if(sign == LV_SIGNAL_RELEASED) {
|
else if(sign == LV_SIGNAL_RELEASED) {
|
||||||
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {
|
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {
|
||||||
@@ -924,6 +970,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*/
|
/*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))) {
|
if(lv_group_get_editing(lv_obj_get_group(btnm))) {
|
||||||
ext->btn_id_focused = 0;
|
ext->btn_id_focused = 0;
|
||||||
|
ext->btn_id_act = ext->btn_id_focused;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ext->btn_id_focused = LV_BTNMATRIX_BTN_NONE;
|
ext->btn_id_focused = LV_BTNMATRIX_BTN_NONE;
|
||||||
@@ -931,9 +978,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) {
|
else if(indev_type == LV_INDEV_TYPE_KEYPAD) {
|
||||||
ext->btn_id_focused = 0;
|
ext->btn_id_focused = 0;
|
||||||
|
ext->btn_id_act = ext->btn_id_focused;
|
||||||
}
|
}
|
||||||
|
|
||||||
ext->btn_id_act = ext->btn_id_focused;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if(sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_LEAVE) {
|
else if(sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_LEAVE) {
|
||||||
@@ -944,6 +991,7 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
|
|||||||
ext->btn_id_act = LV_BTNMATRIX_BTN_NONE;
|
ext->btn_id_act = LV_BTNMATRIX_BTN_NONE;
|
||||||
}
|
}
|
||||||
else if(sign == LV_SIGNAL_CONTROL) {
|
else if(sign == LV_SIGNAL_CONTROL) {
|
||||||
|
#if LV_USE_GROUP
|
||||||
char c = *((char *)param);
|
char c = *((char *)param);
|
||||||
if(c == LV_KEY_RIGHT) {
|
if(c == LV_KEY_RIGHT) {
|
||||||
if(ext->btn_id_focused == LV_BTNMATRIX_BTN_NONE)
|
if(ext->btn_id_focused == LV_BTNMATRIX_BTN_NONE)
|
||||||
@@ -1011,10 +1059,13 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
|
|||||||
ext->btn_id_act = ext->btn_id_focused;
|
ext->btn_id_act = ext->btn_id_focused;
|
||||||
lv_obj_invalidate(btnm);
|
lv_obj_invalidate(btnm);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||||
|
#if LV_USE_GROUP
|
||||||
bool * editable = (bool *)param;
|
bool * editable = (bool *)param;
|
||||||
*editable = true;
|
*editable = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ typedef struct {
|
|||||||
uint16_t btn_id_act; /*Index of the active button (being pressed/released etc) or LV_BTNMATRIX_BTN_NONE */
|
uint16_t btn_id_act; /*Index of the active button (being pressed/released etc) or LV_BTNMATRIX_BTN_NONE */
|
||||||
uint8_t recolor : 1; /*Enable button recoloring*/
|
uint8_t recolor : 1; /*Enable button recoloring*/
|
||||||
uint8_t one_check : 1; /*Single button toggled at once*/
|
uint8_t one_check : 1; /*Single button toggled at once*/
|
||||||
|
uint8_t align : 2; /*Align type from 'lv_label_align_t'*/
|
||||||
} lv_btnmatrix_ext_t;
|
} lv_btnmatrix_ext_t;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -170,6 +171,13 @@ void lv_btnmatrix_set_btn_width(lv_obj_t * btnm, uint16_t btn_id, uint8_t width)
|
|||||||
*/
|
*/
|
||||||
void lv_btnmatrix_set_one_check(lv_obj_t * btnm, bool one_chk);
|
void lv_btnmatrix_set_one_check(lv_obj_t * btnm, bool one_chk);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the align of the map text (left, right or center)
|
||||||
|
* @param btnm pointer to a btnmatrix object
|
||||||
|
* @param align LV_LABEL_ALIGN_LEFT, LV_LABEL_ALIGN_RIGHT or LV_LABEL_ALIGN_CENTER
|
||||||
|
*/
|
||||||
|
void lv_btnmatrix_set_align(lv_obj_t * btnm, lv_label_align_t align);
|
||||||
|
|
||||||
/*=====================
|
/*=====================
|
||||||
* Getter functions
|
* Getter functions
|
||||||
*====================*/
|
*====================*/
|
||||||
@@ -236,6 +244,14 @@ bool lv_btnmatrix_get_btn_ctrl(lv_obj_t * btnm, uint16_t btn_id, lv_btnmatrix_ct
|
|||||||
* @return whether "one toggle" mode is enabled
|
* @return whether "one toggle" mode is enabled
|
||||||
*/
|
*/
|
||||||
bool lv_btnmatrix_get_one_check(const lv_obj_t * btnm);
|
bool lv_btnmatrix_get_one_check(const lv_obj_t * btnm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the align attribute
|
||||||
|
* @param btnm pointer to a btnmatrix object
|
||||||
|
* @return LV_LABEL_ALIGN_LEFT, LV_LABEL_ALIGN_RIGHT or LV_LABEL_ALIGN_CENTER
|
||||||
|
*/
|
||||||
|
lv_label_align_t lv_btnmatrix_get_align(const lv_obj_t * btnm);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "lv_calendar.h"
|
#include "lv_calendar.h"
|
||||||
#if LV_USE_CALENDAR != 0
|
#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_draw/lv_draw.h"
|
||||||
#include "../lv_hal/lv_hal_indev.h"
|
#include "../lv_hal/lv_hal_indev.h"
|
||||||
#include "../lv_misc/lv_utils.h"
|
#include "../lv_misc/lv_utils.h"
|
||||||
@@ -57,7 +57,11 @@ static uint8_t is_leap_year(uint32_t year);
|
|||||||
**********************/
|
**********************/
|
||||||
static lv_signal_cb_t ancestor_signal;
|
static lv_signal_cb_t ancestor_signal;
|
||||||
static lv_design_cb_t ancestor_design;
|
static lv_design_cb_t ancestor_design;
|
||||||
|
#if LV_CALENDAR_WEEK_STARTS_MONDAY != 0
|
||||||
|
static const char * day_name[7] = {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"};
|
||||||
|
#else
|
||||||
static const char * day_name[7] = {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"};
|
static const char * day_name[7] = {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"};
|
||||||
|
#endif
|
||||||
static const char * month_name[12] = {"January", "February", "March", "April", "May", "June",
|
static const char * month_name[12] = {"January", "February", "March", "April", "May", "June",
|
||||||
"July", "August", "September", "October", "November", "December"
|
"July", "August", "September", "October", "November", "December"
|
||||||
};
|
};
|
||||||
@@ -515,6 +519,7 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void *
|
|||||||
lv_obj_invalidate(calendar);
|
lv_obj_invalidate(calendar);
|
||||||
}
|
}
|
||||||
else if(sign == LV_SIGNAL_CONTROL) {
|
else if(sign == LV_SIGNAL_CONTROL) {
|
||||||
|
#if LV_USE_GROUP
|
||||||
uint8_t c = *((uint8_t *)param);
|
uint8_t c = *((uint8_t *)param);
|
||||||
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
|
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
|
||||||
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
|
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
|
||||||
@@ -537,6 +542,7 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void *
|
|||||||
}
|
}
|
||||||
lv_obj_invalidate(calendar);
|
lv_obj_invalidate(calendar);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
@@ -1057,14 +1063,18 @@ static uint8_t is_leap_year(uint32_t year)
|
|||||||
* @param year a year
|
* @param year a year
|
||||||
* @param month a month
|
* @param month a month
|
||||||
* @param day a day
|
* @param day a day
|
||||||
* @return [0..6] which means [Sun..Sat]
|
* @return [0..6] which means [Sun..Sat] or [Mon..Sun] depending on LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||||
*/
|
*/
|
||||||
static uint8_t get_day_of_week(uint32_t year, uint32_t month, uint32_t day)
|
static uint8_t get_day_of_week(uint32_t year, uint32_t month, uint32_t day)
|
||||||
{
|
{
|
||||||
uint32_t a = month < 3 ? 1 : 0;
|
uint32_t a = month < 3 ? 1 : 0;
|
||||||
uint32_t b = year - a;
|
uint32_t b = year - a;
|
||||||
|
|
||||||
|
#if LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||||
|
uint32_t day_of_week = (day + (31 * (month - 2 + 12 * a) / 12) + b + (b / 4) - (b / 100) + (b / 400) - 1) % 7;
|
||||||
|
#else
|
||||||
uint32_t day_of_week = (day + (31 * (month - 2 + 12 * a) / 12) + b + (b / 4) - (b / 100) + (b / 400)) % 7;
|
uint32_t day_of_week = (day + (31 * (month - 2 + 12 * a) / 12) + b + (b / 4) - (b / 100) + (b / 400)) % 7;
|
||||||
|
#endif
|
||||||
|
|
||||||
return day_of_week;
|
return day_of_week;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user