Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5d4bf8fc4 | ||
|
|
1254020b8b | ||
|
|
7f03c17a08 | ||
|
|
4440506858 | ||
|
|
01b4820b93 | ||
|
|
fc8ee11955 | ||
|
|
fe30f9739b | ||
|
|
6be0089cac | ||
|
|
80cb93f8e1 | ||
|
|
a3ad4b3616 | ||
|
|
89b5907eb6 | ||
|
|
68d262ba93 | ||
|
|
ee3a44388c | ||
|
|
51e15ced3f | ||
|
|
aac716d497 | ||
|
|
2353ca0621 | ||
|
|
8bc5770c28 | ||
|
|
913517f19d | ||
|
|
0d385c237a | ||
|
|
94bf21b9be | ||
|
|
a4b697f41e | ||
|
|
b047c1318f | ||
|
|
a5d6881e9e | ||
|
|
eddbbc58b1 | ||
|
|
908db3cd59 | ||
|
|
8a42ab14ad | ||
|
|
c2f70d1cc7 | ||
|
|
89452a9d8e | ||
|
|
563411a33a | ||
|
|
d1889b77e5 | ||
|
|
e8a9d1bdc7 | ||
|
|
9b2de5f215 | ||
|
|
779cac9b77 | ||
|
|
a4d77bec6b | ||
|
|
dd6bad1b6e | ||
|
|
0d93816827 | ||
|
|
ca95d76659 | ||
|
|
d58a83cda7 | ||
|
|
69c5373db0 | ||
|
|
a55d02dd31 | ||
|
|
02d318e66d | ||
|
|
9f72ca2329 | ||
|
|
2d12ad9251 | ||
|
|
09c072bda6 | ||
|
|
9909a4123f | ||
|
|
63c59b6570 | ||
|
|
ee4cd4756b |
@@ -33,10 +33,11 @@ Homepage: https://littlevgl.com
|
||||
## Porting
|
||||
In the most sime case you need 4 things:
|
||||
1. Call `lv_tick_inc(1)` in every millisecods in a Timer or Task
|
||||
2. Register a function which can **copy a pixel array** to an area of the screen
|
||||
2. Register a function which can **copy a pixel array** to an area of the screen.
|
||||
3. Register a function which can **read an input device**. (E.g. touch pad)
|
||||
4. Call `lv_task_handler()` periodically in every few milliseconds
|
||||
For more information visit https://littlevgl.com/porting
|
||||
Or check the [Porting tutorial](https://github.com/littlevgl/lv_examples/blob/master/lv_tutorial/0_porting/lv_tutorial_porting.c)
|
||||
|
||||
## Project set-up
|
||||
1. **Clone** or [Download](https://littlevgl.com/download) the lvgl repository: `git clone https://github.com/littlevgl/lvgl.git`
|
||||
|
||||
@@ -1,72 +1,71 @@
|
||||
# Contributing to Littlev Graphics Library
|
||||
First of all thank you for reading these guide before contributing!
|
||||
It's glad to see that you are interested in Contributing to LittlevGL!
|
||||
|
||||
In this guide you can read how can you help in developing the Littlev Graphic Library. If you have a constructive idea just create pull request on this document!
|
||||
In this guide you can learn how can you help to develop LittlevGL.
|
||||
|
||||
### Table Of Content
|
||||
* [Who can contribute?](#who-can-contribute)
|
||||
* [How to report an issue?](#how-to-report-an-issue)
|
||||
* [Simple issue](#simple-issue)
|
||||
* [Complex issue](#complex-issue)
|
||||
* [How to report an issue?](#how-to-report-a-bug)
|
||||
* [How to suggest a feature?](#how-to-suggest-a-feature)
|
||||
* [How to implement a feature?](#how-to-implement-a-feature)
|
||||
* [Styling guide](#styling-guide)
|
||||
* [File format](#file-format)
|
||||
* [Functions](#functions)
|
||||
* [Variables](#variables)
|
||||
* [Defines](#defines)
|
||||
* [Typedefs](#typedefs)
|
||||
* [Comments](#comments)
|
||||
* [Formatting](#formatting)
|
||||
|
||||
|
||||
## Who can contribute?
|
||||
As graphical interfaces for embedded systems has an increasing relevance today. You also might find important to work with a good graphics library. Now - independently from skills, programming level or any personal attributes - you can influence the development of the graphics library with:
|
||||
As graphical interfaces for embedded systems has an increasing relevance today you also might find important to work with a good graphics library. Now - independently from skills, programming level or any personal attributes - you can influence and help the development of Littlev Graphics Library with:
|
||||
* Report an issue
|
||||
* Suggest feature
|
||||
* Fix an issue
|
||||
* Implement a feature
|
||||
* Help with testing bugfixes and new features
|
||||
|
||||
Please, take a look at [CODE_OF_CONDUCT](https://github.com/littlevgl/lvgl/blob/master/docs/CODE_OF_CONDUCT.md)
|
||||
|
||||
Continue reading to know how you can be part of the development! We are waiting for you!
|
||||
There a few general rules:
|
||||
* We use [GitHub's issue tracker](https://github.com/littlevgl/lvgl/issues)
|
||||
* Be kind and respectful. Strating with "Hi" is always a good idea :)
|
||||
* If somebedy helped you give a feedback.
|
||||
* Always create an issue before creating a [Pull request](https://help.github.com/articles/about-pull-requests/) (maybe somebeody already working on this issue)
|
||||
* One issue should be about one topic. If you have other questions please open a new issue.
|
||||
* Tell your remarks in a structured way. Use paragraphs and the [Markdown](https://guides.github.com/features/mastering-markdown/) support of GitHub.
|
||||
* Be sure you are using the lates version (from `master` branch)
|
||||
|
||||
## How to report an issue?
|
||||
## How to report a bug?
|
||||
If you found a **simple and straightforward bug** like:
|
||||
* misspelling (in comments function/variable names or grammatical issues in comments)
|
||||
* not handled error cases (negative array index, overflow etc)
|
||||
* anything else which can be fixed locally with a few lines of code
|
||||
* or defective documentation
|
||||
|
||||
### Simple issue
|
||||
If you find an issue which is very simple to fix, and you fixed it, please send a pull request against `beta` branch.
|
||||
A simple issue could be:
|
||||
* Misspelled names
|
||||
* Comment: misspelling or grammatical error in comments
|
||||
* Variable: misspelled variable name (e.g. ***ojb**_next* instead of ***obj**_next*)
|
||||
* Define: only local defines in files because global defines affect API
|
||||
* Function: only static function name because global functions affect API
|
||||
* Not handled error case:
|
||||
* A parameter can be NULL (during normal usage)
|
||||
* Negative index in array or over indexing
|
||||
* Overflow in variable
|
||||
* Anything which is local an can be fixed with a few lines of code
|
||||
then tell
|
||||
* where you found the bug (which file/function/variable)
|
||||
* how can it cause problem
|
||||
* what is your suggeseted solution if you have
|
||||
|
||||
### Complex issue
|
||||
If you find a complex issue which:
|
||||
If you faced with **something more clomplex** like:
|
||||
* might be simple but you don't know its origin
|
||||
* affects a whole file, module or even the architecture
|
||||
* needs deeper discussion
|
||||
|
||||
please create a **new issue** and describe
|
||||
* what you experience
|
||||
* how to reproduce the issue (maybe with example code)
|
||||
* version you are using (lvgl.h)
|
||||
* misc library version (misc.h)
|
||||
then please
|
||||
* tell what do you experience
|
||||
* tell what do you expect to happen
|
||||
* tell how to reproduce the issue
|
||||
* provide a simlified code example (better if can be tested with copy-paste)
|
||||
* attache your lv_conf.h (if you feel it's important)
|
||||
* logs and long codes should be attached in a file (instead of copying into a comment)
|
||||
|
||||
## How to suggest a feature?
|
||||
If you have a good and useful idea you can use GitHub issues to suggest a new feature. Please note the followings on feature requests:
|
||||
If you have a good and useful idea open issue to tell it! Please note the followings on suggesting new features:
|
||||
* What the new feature is about?
|
||||
* Why/Where/In which case is it useful/helpful/relevant?
|
||||
* Can you mention real life usecases/examples for the use this feature?
|
||||
* Can you help in implementing it?
|
||||
|
||||
After a discussion we figure out the specification of the new feature and the technical details/implementation possibilities.
|
||||
With the knowledge of how to do it somebody can implement the new feature.
|
||||
Your suggestion can have 4 possible outcomes:
|
||||
1. This feature is already exists. In this case you will learn how to achive your goal.
|
||||
2. You can simply realize it with the current functionality.
|
||||
3. Although it's a new feature but it would break LittlevGL's platform independent and/or resource minimalist nature.
|
||||
4. It's really a new feature which would be good to be in LittlevGL. Hurray! In a discussion we figure out the technical details andimplementation options. With the knowledge of how to do it somebody can implement the new feature.
|
||||
|
||||
Keep in mind if you wouldn't like to do the implementation there is no guarantee that it will be ready in the new future.
|
||||
However if you would like to force it, take a look at this page: [Feature request service](http://www.gl.littlev.hu/services#feature)
|
||||
@@ -79,55 +78,35 @@ The new feature should be in a new branch.
|
||||
## Styling guide
|
||||
|
||||
### File format
|
||||
Use [misc/templ/templ.c](https://github.com/littlevgl/misc/blob/master/templ/templ.c) and [misc/templ/templ.h](https://github.com/littlevgl/misc/blob/master/templ/templ.h)
|
||||
Use [lv_misc/lv_templ.c](https://github.com/littlevgl/lvgl/blob/master/lv_misc/lv_templ.c) and [lv_misc/lv_templ.h](https://github.com/littlevgl/lvgl/blob/master/lv_misc/lv_templ.h)
|
||||
|
||||
### Abbreviations
|
||||
Please read this document to see the list of accepted abbreviations: [abbreviations-in-code](https://github.com/kisvegabor/abbreviations-in-code)
|
||||
### Naming conventions
|
||||
* Words are sparated by '_'
|
||||
* In variable and function names use only lower case letters (e.g. *height_tmp*)
|
||||
* In enums and defines use only upper case letters (e.g. *e.g. MAX_LINE_NUM*)
|
||||
* Global names (API):
|
||||
* starts with *lv*
|
||||
* followed by module name: *btn*, *label*, *style* etc.
|
||||
* followed by the action (for functions): *set*, *get*, *refr* etc.
|
||||
* closed with the subject: *name*, *size*, *state* etc.
|
||||
* Typedefs
|
||||
* prefer `typedef struct` and `typedef enum` instead of `struct name` and `enum name`
|
||||
* always add a closing *..._t*
|
||||
* Abbreviations:
|
||||
* Use abbreviations on public names only if they become longer then 32 characters
|
||||
* Use only very straightforward (e.g. pos: position) or well established (e.g. pr: press) abbreviatons
|
||||
|
||||
### Functions
|
||||
* try to write function shorter then is 40 lines
|
||||
* always shorter then 100 lines (except very straightforwards)
|
||||
* in function names:
|
||||
* words sparated by '_'
|
||||
* only lower case letters
|
||||
* only clear abbreviation (OK: *lv_xy_get_title_txt*, BAD: *lv_xy_get_ttxt*)
|
||||
|
||||
#### Global functions names (API)
|
||||
An example: *lv_btn_set_state()*
|
||||
* starts with *lv*
|
||||
* followed by module name: *btn*, *label*, *style* etc.
|
||||
* followed by the action: *set*, *get*, *refr* etc.
|
||||
* closed with subject: *name*, *size*, *state* etc.
|
||||
* optional like in *lv_obj_del()* it is missing
|
||||
* could contain more words: *long_mode*, *point_all*
|
||||
|
||||
#### Static functions names
|
||||
Names can be used freely.
|
||||
|
||||
### Variables
|
||||
* words sparated by '_'
|
||||
* always lower case
|
||||
* one line, one declaration (BAD: char x, y;)
|
||||
* use `<stdint.h>` (*uint8_t*, *int32_t* etc)
|
||||
* declare variables when needed (not all at function start)
|
||||
* use the smallest required scope
|
||||
* variables in a file (outside functions) are always *static*
|
||||
* do not use global variables (use functions to set/get static variables)
|
||||
|
||||
### Defines
|
||||
* always upper case
|
||||
* starts with *LV_*
|
||||
* followed by the modul: *OBJ*, *BTN* etc.
|
||||
* closed by the subject: *ANIM_TIME*, *VALUE_MIN*, *WIDTH_DEF*
|
||||
|
||||
### Typedefs
|
||||
- prefer `typedef struct` instead of `struct name`
|
||||
- prefer `typedef enum` instead of `enum name`
|
||||
- types always lowercase speperated by '_'
|
||||
- first word for public typedefs is *lv_...*
|
||||
- next word identifies the modul: *lv_obj_...*, *lv_btn_...*
|
||||
- always add closing *..._t*
|
||||
- Examples: *lv_obj_t*, *lv_cont_layout_t*
|
||||
### Coding guide
|
||||
* Functions:
|
||||
* Try to write function shorter then is 50 lines
|
||||
* Always shorter then 100 lines (except very straightforwards)
|
||||
* Variables:
|
||||
* One line, one declaration (BAD: char x, y;)
|
||||
* Use `<stdint.h>` (*uint8_t*, *int32_t* etc)
|
||||
* Declare variables when needed (not all at function start)
|
||||
* Use the smallest required scope
|
||||
* Variables in a file (outside functions) are always *static*
|
||||
* Do not use global variables (use functions to set/get static variables)
|
||||
|
||||
### Comments
|
||||
Before every function have a comment like this:
|
||||
@@ -152,7 +131,7 @@ You should write **why** have you done this:
|
||||
|
||||
Short "code summaries" of a few lines are accepted. E.g. `/*Calculate the new coordinates*/`
|
||||
|
||||
In comments use `' '` when refering to a variable. E.g. `/*Update the value of 'x_act'*/`
|
||||
In comments use \` \` when refering to a variable. E.g. ``/*Update the value of `x_act`*/``
|
||||
|
||||
### Formatting
|
||||
Here is example to show bracket placing and using of white spaces:
|
||||
@@ -163,7 +142,7 @@ Here is example to show bracket placing and using of white spaces:
|
||||
* @param text '\0' terminated character string. NULL to refresh with the current text.
|
||||
*/
|
||||
void lv_label_set_text(lv_obj_t * label, const char * text)
|
||||
{ /*Main bracket in new line*/
|
||||
{ /* Main bracket of functions in new line*/
|
||||
|
||||
if(label == NULL) return; /*No bracket only if the command is inline with the if statement*/
|
||||
|
||||
@@ -172,14 +151,12 @@ void lv_label_set_text(lv_obj_t * label, const char * text)
|
||||
lv_label_ext_t * ext = lv_obj_get_ext(label);
|
||||
|
||||
/*Comment before a section */
|
||||
if(text == ext->txt || text == NULL) { /*Bracket start inline*/
|
||||
if(text == ext->txt || text == NULL) { /*Bracket of statements start inline*/
|
||||
lv_label_refr_text(label);
|
||||
return;
|
||||
}
|
||||
|
||||
.
|
||||
.
|
||||
.
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ Major versions released typically when API changes are required
|
||||
## Contributing
|
||||
Please create an issue to suggest a new feature instead of adding pull request to this file.
|
||||
|
||||
## v6 (released at: in progrss)
|
||||
## v6 (released on: in progrss)
|
||||
- [ ] lv_img_upscale removal (generate image with with opacity instead)
|
||||
- [ ] disp_map and disp_fill removal
|
||||
- [ ] disp_flush, mem_blend, mem_fill rework: usea lv_area_t as parameter an GPU support 2D area
|
||||
@@ -13,7 +13,7 @@ Please create an issue to suggest a new feature instead of adding pull request t
|
||||
- [ ] multiple display support
|
||||
- [ ] lv_ufs removal (was required only in the the old image system)
|
||||
|
||||
## v5 (released at: 20.12.2017)
|
||||
## v5 (released on: 20.12.2017)
|
||||
**Architectural changes**
|
||||
- [x] Rename repository from *proj_pc* to *pc_simulator*
|
||||
- [x] Integrate *hal* in LittlevGL as a normal folder
|
||||
|
||||
@@ -20,7 +20,7 @@ Here are ideas which are not assigned to a minor version yet:
|
||||
- image rotate
|
||||
|
||||
|
||||
## v5.2 (planned)
|
||||
## v5.2 (in progress)
|
||||
- [ ] Lua interface to craete GUI with script
|
||||
- [ ] Arabic glyph convert (based on letter position)
|
||||
- [ ] Right-to-left write support
|
||||
@@ -31,7 +31,7 @@ Here are ideas which are not assigned to a minor version yet:
|
||||
- [ ] user defined error callback
|
||||
- [ ] Support more character coding (e.g. UTF8, UTF16 etc)
|
||||
|
||||
## v5.1 (released at: in progress)
|
||||
## v5.1 (released on: 09.03.2018)
|
||||
- [x] lv_refr_set_roundig_callback: set a function to modify the invalidated area for special display controllers
|
||||
- [x] lv_group_set_focus_callback: set function to call when a new object is focused #94
|
||||
- [x] lv_obj_get_type() return string, e.g. "lv_slider", "lv_btn" etc #91
|
||||
@@ -49,7 +49,7 @@ Here are ideas which are not assigned to a minor version yet:
|
||||
- [x] LV_GROUP_KEY_ENTER_LONG: sent by the library on long press of LV_GROUP_KEY_ENTER to trigger long press of the object #113
|
||||
- [x] LV_INDEV_TYPE_BUTTON: for a hatdware buttons which press a point on a screen
|
||||
|
||||
## v5.0 (released at: 20.12.2017)
|
||||
## v5.0 (released on: 20.12.2017)
|
||||
- [x] UTF-8 support
|
||||
- [x] lv_tabview: new object type to organise content with tabs
|
||||
- [x] lv_sw: new object type, switch, turn on/off by tap (a little slider)
|
||||
@@ -60,7 +60,7 @@ Here are ideas which are not assigned to a minor version yet:
|
||||
- [x] add themes with predefined styles
|
||||
- [x] partial border draw in styles
|
||||
|
||||
## v4.2 (released at: 17.08.2017)
|
||||
## v4.2 (released on: 17.08.2017)
|
||||
- [x] Double VDB support: one for rendering, another to transfer former rendered image to frame buffer in the background (e.g. with DMA) [#15](https://github.com/littlevgl/lvgl/issues/15)
|
||||
- [x] lv_group: to control without touch pad. Issue [#14](https://github.com/littlevgl/lvgl/issues/14)
|
||||
- [x] lv_page: scrl def fit modification: hor:false, ver:true, and always set width to parent width
|
||||
|
||||
@@ -6,7 +6,24 @@ The bugfixes of the still not released version are in `beta` branche.
|
||||
## Contributing
|
||||
Please create an issue to introduce a bug instead of adding pull request to this file.
|
||||
|
||||
## v5.0.3 (in progress)
|
||||
## v5.1.1 (in progress)
|
||||
- [x] lv_line: set line.width ext. size to not trim parts on x = 0, y = 0 coordinates
|
||||
- [x] lv_conf.h: add LV_COMPILER_VLA_SUPPORTED
|
||||
- [x] lv_group_create: init focus_cb
|
||||
- [x] fix of 16 bit image drawing with alpha bytes
|
||||
- [x] fix text opacity
|
||||
- [x] lv_mbox: enable navigation with LV_GROUP_KEY_DOWN/UP too
|
||||
- [x] lv_conf.h: add LV_COMPILER_VLA_SUPPORTED
|
||||
- [x] lv_slider: inicator draw bugfix
|
||||
- [x] lv_slider: draw greater background on negative padding if knob_in == 1
|
||||
- [x] mono theme: fix typo
|
||||
- [x] style animations: add opacity handling to image, text and line
|
||||
- [x] lv_kb: before ok/close action don't deassign the lv_ta if there is user defined action
|
||||
- [x] in lv_objx_set_... functions apply the new value only if it's different from the current
|
||||
- [x] don't invalide hidden objects
|
||||
- [x] lv_group_del: remove the objects from the groups too
|
||||
|
||||
## v5.0.3 (released on: 09.03.2018)
|
||||
- [x] lv_chart: Fix the use of point_num more then 256 (Thanks to upbeat27)
|
||||
- [x] lv_label: fix 'offset' with LV_ANTIALIAS (LV_LABEL_LONG_ROLL was effected)
|
||||
- [x] lv_label: anim. time wasn't allyed for LV_LABEL_LONG_ROLL
|
||||
@@ -16,7 +33,7 @@ Please create an issue to introduce a bug instead of adding pull request to this
|
||||
- [x] lv_indev: buffered indevs (return *true* in indev_read) was handled as non-buffered
|
||||
- [x] drag: don't invalidate if the object wasn't moved
|
||||
|
||||
## v5.0.2 (released at: 19.01.2018)
|
||||
## v5.0.2 (released on: 19.01.2018)
|
||||
- [x] Fix dependencied (Thanks to Zaltora)
|
||||
- [x] lv_group: fix memory leak (Thanks to BenQoo)
|
||||
- [x] LV_INDEV_READ_PERIOD 0 build bugfix
|
||||
@@ -25,21 +42,21 @@ Please create an issue to introduce a bug instead of adding pull request to this
|
||||
- [x] lv_roller: add missing action handling
|
||||
- [x] Set 24 bit colors upper byte (alpha) to 0xFF
|
||||
|
||||
## v5.0.1 (released at: 02.01.2018)
|
||||
## v5.0.1 (released on: 02.01.2018)
|
||||
- [x] lv_list: fixed when mouse and keyboard used together
|
||||
- [x] lv_btnm: fix bottom border visibility
|
||||
- [x] theme updates
|
||||
- [x] line width fix width anti-aliasing
|
||||
- [x] lv_conf_templ.h add more info
|
||||
|
||||
## v5.0 (released at: 21.12.2017)
|
||||
## v5.0 (released on: 21.12.2017)
|
||||
- [x] lv_btnm: check hide code (\177) at 0. byte position too (if width is not specified)
|
||||
- [x] lv_img: define *lv_img_raw_header* in *lv_draw.h* because now lv_img can't be disabled
|
||||
- [x] lv_list: ignore image related things when *lv_img* is not enebled
|
||||
- [x] lv_ta: fix hegiht if *one_line* and *FONT_ANTIALIAS*
|
||||
- [x] lv_obj_set_style: fix to update self style too (not only children)
|
||||
|
||||
## v4.2 (released at: 17.08.2017)
|
||||
## v4.2 (released on: 17.08.2017)
|
||||
- [x] lv_slider: don't let indicator or bar to disappear because of hpad/vpad
|
||||
- [x] lv_ta: memory leak if deleted in password mode
|
||||
- [x] lv_list: work without *lv_img* by ignore the image file name parameter of *lv_list_add()*
|
||||
|
||||
@@ -81,9 +81,10 @@
|
||||
#define USE_LV_REAL_DRAW 1 /*1: Enable function which draw directly to the frame buffer instead of VDB (required if LV_VDB_SIZE = 0)*/
|
||||
#define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images*/
|
||||
|
||||
/*Compiler attributes*/
|
||||
#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to tick increment function */
|
||||
#define LV_ATTRIBUTE_TASK_HANDLER
|
||||
/*Compiler settings*/
|
||||
#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_tick_inc` function */
|
||||
#define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */
|
||||
#define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/
|
||||
|
||||
/*================
|
||||
* THEME USAGE
|
||||
@@ -242,6 +243,13 @@
|
||||
/*Switch (dependencies: lv_slider)*/
|
||||
#define USE_LV_SW 1
|
||||
|
||||
/*************************
|
||||
* Non-user section
|
||||
*************************/
|
||||
#ifdef _MSC_VER /* Disable warnings for Visual Studio*/
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#endif /*LV_CONF_H*/
|
||||
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ lv_group_t * lv_group_create(void)
|
||||
group->style_mod = style_mod_def;
|
||||
group->obj_focus = NULL;
|
||||
group->frozen = 0;
|
||||
group->focus_cb = NULL;
|
||||
|
||||
return group;
|
||||
}
|
||||
@@ -57,6 +58,18 @@ lv_group_t * lv_group_create(void)
|
||||
*/
|
||||
void lv_group_del(lv_group_t * group)
|
||||
{
|
||||
/*Defocus the the currently focussed object*/
|
||||
if(group->obj_focus != NULL) {
|
||||
(*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
|
||||
lv_obj_invalidate(*group->obj_focus);
|
||||
}
|
||||
|
||||
/*Remove the objects from the group*/
|
||||
lv_obj_t ** obj;
|
||||
LL_READ(group->obj_ll, obj) {
|
||||
(*obj)->group_p = NULL;
|
||||
}
|
||||
|
||||
lv_ll_clear(&(group->obj_ll));
|
||||
lv_mem_free(group);
|
||||
}
|
||||
@@ -88,6 +101,10 @@ void lv_group_remove_obj(lv_obj_t * obj)
|
||||
lv_group_t * g = obj->group_p;
|
||||
if(g == NULL) return;
|
||||
|
||||
if(*g->obj_focus == obj) {
|
||||
lv_group_focus_next(g);
|
||||
}
|
||||
|
||||
/*Search the object and remove it from its group */
|
||||
lv_obj_t ** i;
|
||||
LL_READ(g->obj_ll, i) {
|
||||
@@ -97,11 +114,6 @@ void lv_group_remove_obj(lv_obj_t * obj)
|
||||
obj->group_p = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if(*g->obj_focus == obj) {
|
||||
g->obj_focus = NULL;
|
||||
lv_group_focus_next(g);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +128,6 @@ void lv_group_focus_obj(lv_obj_t * obj)
|
||||
if(g->frozen != 0) return;
|
||||
|
||||
lv_obj_t ** i;
|
||||
|
||||
LL_READ(g->obj_ll, i) {
|
||||
if(*i == obj) {
|
||||
if(g->obj_focus != NULL) {
|
||||
|
||||
@@ -61,6 +61,12 @@ typedef struct _lv_group_t
|
||||
*/
|
||||
lv_group_t * lv_group_create(void);
|
||||
|
||||
/**
|
||||
* Delete a group object
|
||||
* @param group pointer to a group
|
||||
*/
|
||||
void lv_group_del(lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Add an object to a group
|
||||
* @param group pointer to a group
|
||||
|
||||
@@ -655,10 +655,14 @@ static void indev_drag(lv_indev_proc_t * state)
|
||||
lv_coord_t act_y = lv_obj_get_y(drag_obj);
|
||||
uint16_t inv_buf_size = lv_refr_get_buf_size(); /*Get the number of currently invalidated areas*/
|
||||
|
||||
lv_coord_t prev_x = drag_obj->coords.x1;
|
||||
lv_coord_t prev_y = drag_obj->coords.y1;
|
||||
|
||||
lv_obj_set_pos(drag_obj, act_x + state->vect.x, act_y + state->vect.y);
|
||||
|
||||
/*Set the drag in progress flag if the object is really moved*/
|
||||
if(lv_obj_get_x(drag_obj) != act_x || lv_obj_get_y(drag_obj) != act_y) {
|
||||
|
||||
if(drag_obj->coords.x1 != prev_x || drag_obj->coords.y1 != prev_y) {
|
||||
if(state->drag_range_out != 0) { /*Send the drag begin signal on first move*/
|
||||
drag_obj->signal_func(drag_obj, LV_SIGNAL_DRAG_BEGIN, indev_act);
|
||||
if(state->reset_query != 0) return;
|
||||
|
||||
@@ -284,20 +284,17 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
|
||||
lv_anim_del(obj, NULL);
|
||||
#endif
|
||||
|
||||
/*Delete from the group*/
|
||||
#if USE_LV_GROUP
|
||||
if(obj->group_p != NULL) lv_group_remove_obj(obj);
|
||||
#endif
|
||||
|
||||
/* Reset all input devices if
|
||||
* the currently pressed object is deleted*/
|
||||
lv_indev_t * indev = lv_indev_next(NULL);
|
||||
lv_obj_t * dpar;
|
||||
while(indev) {
|
||||
dpar = obj;
|
||||
while(dpar != NULL) {
|
||||
if(indev->proc.act_obj == dpar ||
|
||||
indev->proc.last_obj == dpar) {
|
||||
lv_indev_reset(indev);
|
||||
break;
|
||||
} else {
|
||||
dpar = lv_obj_get_parent(dpar);
|
||||
}
|
||||
if(indev->proc.act_obj == obj || indev->proc.last_obj == obj) {
|
||||
lv_indev_reset(indev);
|
||||
}
|
||||
indev = lv_indev_next(indev);
|
||||
}
|
||||
@@ -346,11 +343,14 @@ void lv_obj_clean(lv_obj_t *obj)
|
||||
*/
|
||||
void lv_obj_invalidate(lv_obj_t * obj)
|
||||
{
|
||||
if(lv_obj_get_hidden(obj)) return;
|
||||
|
||||
/*Invalidate the object only if it belongs to the 'act_scr'*/
|
||||
lv_obj_t * obj_scr = lv_obj_get_screen(obj);
|
||||
if(obj_scr == lv_scr_act() ||
|
||||
obj_scr == lv_layer_top() ||
|
||||
obj_scr == lv_layer_sys()) {
|
||||
obj_scr == lv_layer_sys())
|
||||
{
|
||||
/*Truncate recursively to the parents*/
|
||||
lv_area_t area_trunc;
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
@@ -366,7 +366,8 @@ void lv_obj_invalidate(lv_obj_t * obj)
|
||||
/*Check through all parents*/
|
||||
while(par != NULL) {
|
||||
union_ok = lv_area_union(&area_trunc, &area_trunc, &par->coords);
|
||||
if(union_ok == false) break; /*If no common parts with parent break;*/
|
||||
if(union_ok == false) break; /*If no common parts with parent break;*/
|
||||
if(lv_obj_get_hidden(par)) return; /*If the parent is hidden then the child is hidden and won't be drawn*/
|
||||
|
||||
par = lv_obj_get_parent(par);
|
||||
}
|
||||
@@ -753,12 +754,15 @@ void lv_obj_report_style_mod(lv_style_t * style)
|
||||
*/
|
||||
void lv_obj_set_hidden(lv_obj_t * obj, bool en)
|
||||
{
|
||||
if(!obj->hidden) lv_obj_invalidate(obj); /*Invalidate when not hidden (hidden objects are ignored) */
|
||||
|
||||
obj->hidden = en == false ? 0 : 1;
|
||||
|
||||
|
||||
if(!obj->hidden) lv_obj_invalidate(obj); /*Invalidate when not hidden (hidden objects are ignored) */
|
||||
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
par->signal_func(par, LV_SIGNAL_CHILD_CHG, obj);
|
||||
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1586,6 +1590,16 @@ static void delete_children(lv_obj_t * obj)
|
||||
if(obj->group_p != NULL) lv_group_remove_obj(obj);
|
||||
#endif
|
||||
|
||||
/* Reset the input devices if
|
||||
* the currently pressed object is deleted*/
|
||||
lv_indev_t * indev = lv_indev_next(NULL);
|
||||
while(indev) {
|
||||
if(indev->proc.act_obj == obj || indev->proc.last_obj == obj) {
|
||||
lv_indev_reset(indev);
|
||||
}
|
||||
indev = lv_indev_next(indev);
|
||||
}
|
||||
|
||||
/*Remove the object from parent's children list*/
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
lv_ll_rem(&(par->child_ll), obj);
|
||||
|
||||
@@ -429,7 +429,7 @@ void lv_obj_set_design_func(lv_obj_t * obj, lv_design_func_t fp);
|
||||
* Allocate a new ext. data for an object
|
||||
* @param obj pointer to an object
|
||||
* @param ext_size the size of the new ext. data
|
||||
* @return Normal pointer to the allocated ext
|
||||
* @return pointer to the allocated ext
|
||||
*/
|
||||
void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size);
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ void lv_refr_init(void)
|
||||
|
||||
lv_task_t* task;
|
||||
task = lv_task_create(lv_refr_task, LV_REFR_PERIOD, LV_TASK_PRIO_MID, NULL);
|
||||
lv_mem_assert(task);
|
||||
lv_task_ready(task); /*Be sure the screen will be refreshed immediately on start up*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -272,8 +272,11 @@ static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val)
|
||||
STYLE_ATTR_ANIM(body.padding.inner, val);
|
||||
STYLE_ATTR_ANIM(text.line_space, val);
|
||||
STYLE_ATTR_ANIM(text.letter_space, val);
|
||||
STYLE_ATTR_ANIM(text.opa, val);
|
||||
STYLE_ATTR_ANIM(line.width, val);
|
||||
STYLE_ATTR_ANIM(line.opa, val);
|
||||
STYLE_ATTR_ANIM(image.intense, val);
|
||||
STYLE_ATTR_ANIM(image.opa, val);
|
||||
|
||||
lv_opa_t opa = val == LV_STYLE_ANIM_RES ? LV_OPA_COVER : val;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#define LABEL_RECOLOR_PAR_LENGTH 6
|
||||
|
||||
#define SHADOW_OPA_EXTRA_PRECISION 8 /*Calculate with 2^x bigger shadow opacity values to avoid rounding errors*/
|
||||
#define SHADOW_OPA_EXTRA_PRECISION 0 /*Calculate with 2^x bigger shadow opacity values to avoid rounding errors*/
|
||||
#define SHADOW_BOTTOM_AA_EXTRA_RADIUS 3 /*Add extra radius with LV_SHADOW_BOTTOM to cover anti-aliased corners*/
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -448,7 +448,15 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
|
||||
|
||||
lv_coord_t row;
|
||||
uint32_t act_pos;
|
||||
#if LV_COMPILER_VLA_SUPPORTED
|
||||
lv_color_t buf[lv_area_get_width(&mask_com)];
|
||||
#else
|
||||
# if LV_HOR_RES > LV_VER_RES
|
||||
lv_color_t buf[LV_HOR_RES];
|
||||
# else
|
||||
lv_color_t buf[LV_VER_RES];
|
||||
# endif
|
||||
#endif
|
||||
for(row = mask_com.y1; row <= mask_com.y2; row ++) {
|
||||
res = lv_fs_read(&file, buf, useful_data, &br);
|
||||
|
||||
@@ -1713,8 +1721,15 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
|
||||
if(radius != 0) radius -= LV_ANTIALIAS;
|
||||
swidth += LV_ANTIALIAS;
|
||||
|
||||
|
||||
#if LV_COMPILER_VLA_SUPPORTED
|
||||
lv_coord_t curve_x[radius + swidth + 1]; /*Stores the 'x' coordinates of a quarter circle.*/
|
||||
#else
|
||||
# if LV_HOR_RES > LV_VER_RES
|
||||
lv_coord_t curve_x[LV_HOR_RES];
|
||||
# else
|
||||
lv_coord_t curve_x[LV_VER_RES];
|
||||
# endif
|
||||
#endif
|
||||
memset(curve_x, 0, sizeof(curve_x));
|
||||
lv_point_t circ;
|
||||
lv_coord_t circ_tmp;
|
||||
@@ -1727,15 +1742,30 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
|
||||
int16_t line;
|
||||
|
||||
int16_t filter_width = 2 * swidth + 1;
|
||||
#if LV_COMPILER_VLA_SUPPORTED
|
||||
uint32_t line_1d_blur[filter_width];
|
||||
|
||||
#else
|
||||
# if LV_HOR_RES > LV_VER_RES
|
||||
uint32_t line_1d_blur[LV_HOR_RES];
|
||||
# else
|
||||
uint32_t line_1d_blur[LV_VER_RES];
|
||||
# endif
|
||||
#endif
|
||||
/*1D Blur horizontally*/
|
||||
for(line = 0; line < filter_width; line++) {
|
||||
line_1d_blur[line] = (uint32_t)((uint32_t)(filter_width - line) * (style->body.opa * 2) << SHADOW_OPA_EXTRA_PRECISION) / (filter_width * filter_width);
|
||||
}
|
||||
|
||||
uint16_t col;
|
||||
#if LV_COMPILER_VLA_SUPPORTED
|
||||
lv_opa_t line_2d_blur[radius + swidth];
|
||||
#else
|
||||
# if LV_HOR_RES > LV_VER_RES
|
||||
lv_opa_t line_2d_blur[LV_HOR_RES];
|
||||
# else
|
||||
lv_opa_t line_2d_blur[LV_VER_RES];
|
||||
# endif
|
||||
#endif
|
||||
|
||||
lv_point_t point_rt;
|
||||
lv_point_t point_rb;
|
||||
@@ -1759,7 +1789,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
|
||||
bool line_ready;
|
||||
for(line = 1; line <= radius + swidth; line++) { /*Check all rows and make the 1D blur to 2D*/
|
||||
line_ready = false;
|
||||
for(col = 1; col < radius + swidth + 10; col++) { /*Check all pixels in a 1D blur line (from the origo to last shadow pixel (radius + swidth))*/
|
||||
for(col = 1; col < radius + swidth; col++) { /*Check all pixels in a 1D blur line (from the origo to last shadow pixel (radius + swidth))*/
|
||||
|
||||
/*Sum the opacities from the lines above and below this 'row'*/
|
||||
int16_t line_rel;
|
||||
@@ -1776,7 +1806,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
|
||||
}
|
||||
|
||||
/*Add the value of the 1D blur on 'col_rel' position*/
|
||||
if(col_rel < -swidth) { /*Outside of the burred area. */
|
||||
if(col_rel < -swidth) { /*Outside of the blurred area. */
|
||||
if(line_rel == -swidth) line_ready = true; /*If no data even on the very first line then it wont't be anything else in this line*/
|
||||
break; /*Break anyway because only smaller 'col_rel' values will come */
|
||||
}
|
||||
@@ -1785,7 +1815,10 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
|
||||
}
|
||||
|
||||
line_2d_blur[col] = px_opa_sum >> SHADOW_OPA_EXTRA_PRECISION;
|
||||
if(line_ready) break;
|
||||
if(line_ready) {
|
||||
col++; /*To make this line to the last one ( drawing will go to '< col')*/
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1803,7 +1836,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
|
||||
point_lb.y = ofs_lb.y + line;
|
||||
|
||||
uint16_t d;
|
||||
for(d = 1; d <= col; d++) {
|
||||
for(d = 1; d < col; d++) {
|
||||
|
||||
if(point_rt.x != point_lt.x) {
|
||||
px_fp(point_lt.x,point_lt.y , mask, style->body.shadow.color, line_2d_blur[d]);
|
||||
@@ -1845,8 +1878,15 @@ static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * ma
|
||||
radius = lv_draw_cont_radius_corr(radius, width, height);
|
||||
radius += LV_ANTIALIAS * SHADOW_BOTTOM_AA_EXTRA_RADIUS;
|
||||
swidth += LV_ANTIALIAS;
|
||||
|
||||
#if LV_COMPILER_VLA_SUPPORTED
|
||||
lv_coord_t curve_x[radius + 1]; /*Stores the 'x' coordinates of a quarter circle.*/
|
||||
#else
|
||||
# if LV_HOR_RES > LV_VER_RES
|
||||
lv_coord_t curve_x[LV_HOR_RES];
|
||||
# else
|
||||
lv_coord_t curve_x[LV_VER_RES];
|
||||
# endif
|
||||
#endif
|
||||
lv_point_t circ;
|
||||
lv_coord_t circ_tmp;
|
||||
lv_circ_init(&circ, &circ_tmp, radius);
|
||||
@@ -1857,7 +1897,15 @@ static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * ma
|
||||
}
|
||||
|
||||
int16_t col;
|
||||
#if LV_COMPILER_VLA_SUPPORTED
|
||||
lv_opa_t line_1d_blur[swidth];
|
||||
#else
|
||||
# if LV_HOR_RES > LV_VER_RES
|
||||
lv_opa_t line_1d_blur[LV_HOR_RES];
|
||||
# else
|
||||
lv_opa_t line_1d_blur[LV_VER_RES];
|
||||
# endif
|
||||
#endif
|
||||
|
||||
for(col = 0; col < swidth; col++) {
|
||||
line_1d_blur[col] = (uint32_t)((uint32_t)(swidth - col) * style->body.opa / 2) / (swidth);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_color_t letter_bg_color = LV_COLOR_WHITE;
|
||||
static lv_color_t letter_bg_color;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -167,7 +167,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
|
||||
}
|
||||
/*Fill with opacity*/
|
||||
else {
|
||||
/*Use hw blend if present*/
|
||||
/*Use hw blend if present*/
|
||||
if(lv_disp_is_mem_blend_supported()) {
|
||||
if(color_array_tmp[0].full != color.full || last_width != w) {
|
||||
uint16_t i;
|
||||
@@ -317,7 +317,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
|
||||
*/
|
||||
void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
|
||||
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
|
||||
lv_color_t recolor, lv_opa_t recolor_opa)
|
||||
lv_color_t recolor, lv_opa_t recolor_opa)
|
||||
{
|
||||
lv_area_t masked_a;
|
||||
bool union_ok;
|
||||
@@ -384,31 +384,43 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
|
||||
for(row = masked_a.y1; row <= masked_a.y2; row++) {
|
||||
for(col = 0; col < map_useful_w; col++) {
|
||||
lv_opa_t opa_result = opa;
|
||||
lv_color_t * px_color = (lv_color_t *) &map_p[(uint32_t)col * px_size_byte];
|
||||
|
||||
/*Handle chroma key*/
|
||||
if(chroma_key && px_color->full == chroma_key_color.full) continue;
|
||||
uint8_t * px_color_p = (uint8_t *) &map_p[(uint32_t)col * px_size_byte];
|
||||
lv_color_t px_color;
|
||||
|
||||
/*Calculate with the pixel level alpha*/
|
||||
if(alpha_byte) {
|
||||
lv_opa_t px_opa = (*(((uint8_t *) px_color) + LV_IMG_PX_SIZE_ALPHA_BYTE - 1));
|
||||
#if LV_COLOR_DEPTH == 8
|
||||
px_color.full = px_color_p[0];
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
/*Because of Alpha byte 16 bit color can start on odd address which can cause crash*/
|
||||
px_color.full = px_color_p[0] + (px_color_p[1] << 8);
|
||||
#elif LV_COLOR_DEPTH == 24
|
||||
px_color = *((lv_color_t*)px_color_p);
|
||||
#endif
|
||||
lv_opa_t px_opa = *(px_color_p + LV_IMG_PX_SIZE_ALPHA_BYTE - 1);
|
||||
if(px_opa == LV_OPA_TRANSP) continue;
|
||||
else if(px_opa != LV_OPA_COVER) opa_result = (uint32_t)((uint32_t)px_opa * opa_result) >> 8;
|
||||
}
|
||||
else {
|
||||
px_color = *((lv_color_t*)px_color_p);
|
||||
}
|
||||
|
||||
/*Handle chroma key*/
|
||||
if(chroma_key && px_color.full == chroma_key_color.full) continue;
|
||||
|
||||
/*Re-color the pixel if required*/
|
||||
if(recolor_opa != LV_OPA_TRANSP) {
|
||||
|
||||
if(last_img_px.full != px_color->full) { /*Minor acceleration: calculate only for new colors (save the last)*/
|
||||
last_img_px = *px_color;
|
||||
recolored_px = lv_color_mix(recolor, last_img_px, recolor_opa);
|
||||
}
|
||||
if(last_img_px.full != px_color.full) { /*Minor acceleration: calculate only for new colors (save the last)*/
|
||||
last_img_px = px_color;
|
||||
recolored_px = lv_color_mix(recolor, last_img_px, recolor_opa);
|
||||
}
|
||||
|
||||
if(opa_result == LV_OPA_COVER) vdb_buf_tmp[col].full = recolored_px.full;
|
||||
else vdb_buf_tmp[col] = lv_color_mix(recolored_px, vdb_buf_tmp[col], opa_result);
|
||||
} else {
|
||||
if(opa_result == LV_OPA_COVER) vdb_buf_tmp[col].full = px_color->full;
|
||||
else vdb_buf_tmp[col] = lv_color_mix(*px_color, vdb_buf_tmp[col], opa_result);
|
||||
if(opa_result == LV_OPA_COVER) vdb_buf_tmp[col] = px_color;
|
||||
else vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result);
|
||||
}
|
||||
|
||||
|
||||
@@ -441,8 +453,8 @@ static void sw_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t len
|
||||
} else {
|
||||
uint32_t col;
|
||||
for(col = 0; col < length; col++) {
|
||||
dest[col] = lv_color_mix(src[col], dest[col], opa);
|
||||
}
|
||||
dest[col] = lv_color_mix(src[col], dest[col], opa);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,9 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp)
|
||||
uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end)
|
||||
{
|
||||
int32_t d = LV_MATH_ABS((int32_t) start - end);
|
||||
uint16_t time = (int32_t)((int32_t)(d * 1000) / speed);
|
||||
uint32_t time = (int32_t)((int32_t)(d * 1000) / speed);
|
||||
|
||||
if(time > UINT16_MAX) time = UINT16_MAX;
|
||||
|
||||
if(time == 0) {
|
||||
time++;
|
||||
|
||||
@@ -43,7 +43,7 @@ typedef struct _lv_anim_t
|
||||
lv_anim_path_t path; /*An array with the steps of animations*/
|
||||
int32_t start; /*Start value*/
|
||||
int32_t end; /*End value*/
|
||||
int16_t time; /*Animation time in ms*/
|
||||
uint16_t time; /*Animation time in ms*/
|
||||
int16_t act_time; /*Current time in animation. Set to negative to make delay.*/
|
||||
uint16_t playback_pause; /*Wait before play back*/
|
||||
uint16_t repeat_pause; /*Wait before repeat*/
|
||||
|
||||
@@ -292,7 +292,7 @@ const uint8_t * lv_font_get_bitmap_sparse(const lv_font_t * font, uint32_t unico
|
||||
* @param unicode_letter an unicode letter which width should be get
|
||||
* @return width of the gylph or -1 if not found
|
||||
*/
|
||||
const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unicode_letter)
|
||||
int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unicode_letter)
|
||||
{
|
||||
/*Check the range*/
|
||||
if(unicode_letter < font->unicode_first || unicode_letter > font->unicode_last) {
|
||||
@@ -309,7 +309,7 @@ const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unic
|
||||
* @param unicode_letter an unicode letter which width should be get
|
||||
* @return width of the glyph or -1 if not found
|
||||
*/
|
||||
const int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter)
|
||||
int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter)
|
||||
{
|
||||
/*Check the range*/
|
||||
if(unicode_letter < font->unicode_first || unicode_letter > font->unicode_last) return -1;
|
||||
|
||||
@@ -50,7 +50,7 @@ typedef struct _lv_font_struct
|
||||
const lv_font_glyph_dsc_t * glyph_dsc;
|
||||
const uint32_t * unicode_list;
|
||||
const uint8_t * (*get_bitmap)(const struct _lv_font_struct * ,uint32_t); /*Get a glyph's bitmap from a font*/
|
||||
const int16_t (*get_width)(const struct _lv_font_struct * ,uint32_t); /*Get a glyph's with with a given font*/
|
||||
int16_t (*get_width)(const struct _lv_font_struct * ,uint32_t); /*Get a glyph's with with a given font*/
|
||||
struct _lv_font_struct * next_page; /*Pointer to a font extension*/
|
||||
uint32_t bpp :4; /*Bit per pixel: 1, 2 or 4*/
|
||||
}lv_font_t;
|
||||
@@ -126,7 +126,7 @@ const uint8_t * lv_font_get_bitmap_sparse(const lv_font_t * font, uint32_t unico
|
||||
* @param unicode_letter an unicode letter which width should be get
|
||||
* @return width of the gylph or -1 if not found
|
||||
*/
|
||||
const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unicode_letter);
|
||||
int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unicode_letter);
|
||||
|
||||
/**
|
||||
* Generic glyph width get function used in 'font->get_bitmap' when the font NOT contains all characters in the range (sparse)
|
||||
@@ -134,7 +134,7 @@ const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unic
|
||||
* @param unicode_letter an unicode letter which width should be get
|
||||
* @return width of the glyph or -1 if not found
|
||||
*/
|
||||
const int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter);
|
||||
int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -163,7 +163,7 @@ lv_fs_res_t lv_fs_remove (const char * path)
|
||||
lv_fs_res_t lv_fs_read (lv_fs_file_t * file_p, void * buf, uint32_t btr, uint32_t * br)
|
||||
{
|
||||
if(br != NULL) *br = 0;
|
||||
if(file_p->drv == NULL || file_p->drv == NULL) return LV_FS_RES_INV_PARAM;
|
||||
if(file_p->drv == NULL) return LV_FS_RES_INV_PARAM;
|
||||
if(file_p->drv->read == NULL) return LV_FS_RES_NOT_IMP;
|
||||
|
||||
uint32_t br_tmp = 0;
|
||||
@@ -185,7 +185,7 @@ lv_fs_res_t lv_fs_write (lv_fs_file_t * file_p, const void * buf, uint32_t btw,
|
||||
{
|
||||
if(bw != NULL) *bw = 0;
|
||||
|
||||
if(file_p->drv == NULL || file_p->drv == NULL) {
|
||||
if(file_p->drv == NULL) {
|
||||
return LV_FS_RES_INV_PARAM;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ lv_fs_res_t lv_fs_write (lv_fs_file_t * file_p, const void * buf, uint32_t btw,
|
||||
*/
|
||||
lv_fs_res_t lv_fs_seek (lv_fs_file_t * file_p, uint32_t pos)
|
||||
{
|
||||
if(file_p->drv == NULL || file_p->drv == NULL) {
|
||||
if(file_p->drv == NULL) {
|
||||
return LV_FS_RES_INV_PARAM;
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ lv_fs_res_t lv_fs_seek (lv_fs_file_t * file_p, uint32_t pos)
|
||||
*/
|
||||
lv_fs_res_t lv_fs_tell (lv_fs_file_t * file_p, uint32_t * pos)
|
||||
{
|
||||
if(file_p->drv == NULL || file_p->drv == NULL) {
|
||||
if(file_p->drv == NULL) {
|
||||
pos = 0;
|
||||
return LV_FS_RES_INV_PARAM;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ lv_fs_res_t lv_fs_tell (lv_fs_file_t * file_p, uint32_t * pos)
|
||||
*/
|
||||
lv_fs_res_t lv_fs_size (lv_fs_file_t * file_p, uint32_t * size)
|
||||
{
|
||||
if(file_p->drv == NULL || file_p->drv == NULL) {
|
||||
if(file_p->drv == NULL) {
|
||||
return LV_FS_RES_INV_PARAM;
|
||||
}
|
||||
|
||||
|
||||
@@ -306,6 +306,32 @@ void lv_ll_swap(lv_ll_t * ll_p, void * n1_p, void * n2_p)
|
||||
/*TODO*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a nodw before an other node in the same linked list
|
||||
* @param ll_p pointer to a linked list
|
||||
* @param n_act pointer to node to move
|
||||
* @param n_after pointer to a node which should be after `n_act`
|
||||
*/
|
||||
void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after)
|
||||
{
|
||||
if(n_act == n_after) return; /*Can't move before itself*/
|
||||
|
||||
if(n_after == NULL) {
|
||||
void * n_before = lv_ll_get_tail(ll_p);
|
||||
node_set_next(ll_p, n_before, n_act);
|
||||
node_set_prev(ll_p, n_act, n_before);
|
||||
node_set_next(ll_p, n_act, NULL);
|
||||
ll_p->tail = n_act;
|
||||
} else {
|
||||
void * n_before = lv_ll_get_prev(ll_p, n_after);
|
||||
/*Move the node between `n_before` and `n_after`*/
|
||||
node_set_next(ll_p, n_before, n_act);
|
||||
node_set_prev(ll_p, n_act, n_before);
|
||||
node_set_prev(ll_p, n_after, n_act);
|
||||
node_set_next(ll_p, n_act, n_after);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -122,6 +122,14 @@ void * lv_ll_get_next(lv_ll_t * ll_p, void * n_act);
|
||||
*/
|
||||
void * lv_ll_get_prev(lv_ll_t * ll_p, void * n_act);
|
||||
|
||||
/**
|
||||
* Move a nodw before an other node in the same linked list
|
||||
* @param ll_p pointer to a linked list
|
||||
* @param n_act pointer to node to move
|
||||
* @param n_after pointer to a node which should be after `n_act`
|
||||
*/
|
||||
void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -69,27 +69,32 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
|
||||
* If a lower priority task is executed check task again from the highest priority
|
||||
* but on the priority of executed tasks don't run tasks before the executed*/
|
||||
lv_task_t * task_interruper = NULL;
|
||||
lv_task_t * tmp;
|
||||
lv_task_t * next;
|
||||
bool end_flag;
|
||||
do {
|
||||
end_flag = true;
|
||||
LL_READ(lv_task_ll,tmp){
|
||||
lv_task_t * act = lv_ll_get_head(&lv_task_ll);
|
||||
while(act){
|
||||
/* The task might be deleted if it runs only once ('once = 1')
|
||||
* So get next element until the current is surely valid*/
|
||||
next = lv_ll_get_next(&lv_task_ll, act);
|
||||
|
||||
/*Here is the interrupter task. Don't execute it again.*/
|
||||
if(tmp == task_interruper) {
|
||||
if(act == task_interruper) {
|
||||
task_interruper = NULL; /*From this point only task after the interrupter comes, so the interrupter is not interesting anymore*/
|
||||
continue;
|
||||
act = next;
|
||||
continue; /*Load the next task*/
|
||||
}
|
||||
|
||||
/*Just try to run the tasks with highest priority.*/
|
||||
if(tmp->prio == LV_TASK_PRIO_HIGHEST) {
|
||||
lv_task_exec(tmp);
|
||||
if(act->prio == LV_TASK_PRIO_HIGHEST) {
|
||||
lv_task_exec(act);
|
||||
}
|
||||
/*Tasks with higher priority then the interrupted shall be run in every case*/
|
||||
else if(task_interruper) {
|
||||
if(tmp->prio > task_interruper->prio) {
|
||||
if(lv_task_exec(tmp)) {
|
||||
task_interruper = tmp; /*Check all tasks again from the highest priority */
|
||||
if(act->prio > task_interruper->prio) {
|
||||
if(lv_task_exec(act)) {
|
||||
task_interruper = act; /*Check all tasks again from the highest priority */
|
||||
end_flag = false;
|
||||
break;
|
||||
}
|
||||
@@ -98,12 +103,13 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
|
||||
/* It is no interrupter task or we already reached it earlier.
|
||||
* Just run the remaining tasks*/
|
||||
else {
|
||||
if(lv_task_exec(tmp)) {
|
||||
task_interruper = tmp; /*Check all tasks again from the highest priority */
|
||||
if(lv_task_exec(act)) {
|
||||
task_interruper = act; /*Check all tasks again from the highest priority */
|
||||
end_flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
act = next; /*Load the next task*/
|
||||
}
|
||||
} while(!end_flag);
|
||||
|
||||
@@ -183,15 +189,22 @@ void lv_task_del(lv_task_t* lv_task_p)
|
||||
*/
|
||||
void lv_task_set_prio(lv_task_t* lv_task_p, lv_task_prio_t prio)
|
||||
{
|
||||
/*It's easier to create a new task with the new priority rather then modify the linked list*/
|
||||
lv_task_t * new_task = lv_task_create(lv_task_p->task, lv_task_p->period, prio, lv_task_p->param);
|
||||
lv_mem_assert(new_task);
|
||||
new_task->once = lv_task_p->once;
|
||||
new_task->last_run = lv_task_p->last_run;
|
||||
/*Find the tasks with new priority*/
|
||||
lv_task_t * i;
|
||||
LL_READ(lv_task_ll, i) {
|
||||
if(i->prio <= prio) {
|
||||
if(i != lv_task_p) lv_ll_move_before(&lv_task_ll, lv_task_p, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*Delete the old task*/
|
||||
lv_ll_rem(&lv_task_ll, lv_task_p);
|
||||
lv_mem_free(lv_task_p);
|
||||
/*There was no such a low priority so far then add the node to the tail*/
|
||||
if(i == NULL) {
|
||||
lv_ll_move_before(&lv_task_ll, lv_task_p, NULL);
|
||||
}
|
||||
|
||||
|
||||
lv_task_p->prio = prio;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -110,6 +110,8 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
void lv_bar_set_value(lv_obj_t * bar, int16_t value)
|
||||
{
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
|
||||
if(ext->cur_value == value) return;
|
||||
|
||||
ext->cur_value = value > ext->max_value ? ext->max_value : value;
|
||||
ext->cur_value = ext->cur_value < ext->min_value ? ext->min_value : ext->cur_value;
|
||||
lv_obj_invalidate(bar);
|
||||
@@ -125,6 +127,8 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value)
|
||||
void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time)
|
||||
{
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
|
||||
if(ext->cur_value == value) return;
|
||||
|
||||
int16_t new_value;
|
||||
new_value = value > ext->max_value ? ext->max_value : value;
|
||||
new_value = new_value < ext->min_value ? ext->min_value : new_value;
|
||||
@@ -157,6 +161,8 @@ void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time)
|
||||
void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max)
|
||||
{
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
|
||||
if(ext->min_value == min && ext->max_value == max) return;
|
||||
|
||||
ext->max_value = max;
|
||||
ext->min_value = min;
|
||||
if(ext->cur_value > max) {
|
||||
@@ -286,10 +292,10 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode
|
||||
|
||||
if(w >= h) {
|
||||
indic_area.x2 = (int32_t) ((int32_t)w * (ext->cur_value - ext->min_value)) / (ext->max_value - ext->min_value);
|
||||
indic_area.x2 += indic_area.x1;
|
||||
indic_area.x2 = indic_area.x1 + indic_area.x2 - 1;
|
||||
} else {
|
||||
indic_area.y1 = (int32_t) ((int32_t)h * (ext->cur_value - ext->min_value)) / (ext->max_value - ext->min_value);
|
||||
indic_area.y1 = indic_area.y2 - indic_area.y1;
|
||||
indic_area.y1 = indic_area.y2 - indic_area.y1 + 1;
|
||||
}
|
||||
|
||||
/*Draw the indicator*/
|
||||
|
||||
@@ -602,7 +602,8 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
break;
|
||||
}
|
||||
}
|
||||
ext->btn_id_pr = area_below;
|
||||
|
||||
if(area_below < ext->btn_cnt) ext->btn_id_pr = area_below;
|
||||
}
|
||||
lv_obj_invalidate(btnm);
|
||||
} else if(c == LV_GROUP_KEY_UP) {
|
||||
@@ -611,10 +612,10 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
if(ext->btn_id_pr == LV_BTNM_PR_NONE) {
|
||||
ext->btn_id_pr = 0;
|
||||
} else {
|
||||
uint16_t area_above;
|
||||
int16_t area_above;
|
||||
lv_coord_t pr_center = ext->button_areas[ext->btn_id_pr].x1 + (lv_area_get_width(&ext->button_areas[ext->btn_id_pr]) >> 1);
|
||||
|
||||
for(area_above = ext->btn_id_pr; area_above > 0; area_above --) {
|
||||
for(area_above = ext->btn_id_pr; area_above >= 0; area_above --) {
|
||||
if(ext->button_areas[area_above].y1 < ext->button_areas[ext->btn_id_pr].y1 &&
|
||||
pr_center >= ext->button_areas[area_above].x1 - style->body.padding.hor &&
|
||||
pr_center <= ext->button_areas[area_above].x2)
|
||||
@@ -622,7 +623,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
break;
|
||||
}
|
||||
}
|
||||
ext->btn_id_pr = area_above;
|
||||
if(area_above >= 0) ext->btn_id_pr = area_above;
|
||||
|
||||
}
|
||||
lv_obj_invalidate(btnm);
|
||||
|
||||
@@ -159,6 +159,7 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color)
|
||||
void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(ext->hdiv_cnt == hdiv && ext->vdiv_cnt == vdiv) return;
|
||||
|
||||
ext->hdiv_cnt = hdiv;
|
||||
ext->vdiv_cnt = vdiv;
|
||||
@@ -175,6 +176,7 @@ void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv)
|
||||
void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coord_t ymax)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(ext->ymin == ymin && ext->ymax == ymax) return;
|
||||
|
||||
ext->ymin = ymin;
|
||||
ext->ymax = ymax;
|
||||
@@ -190,6 +192,8 @@ void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coord_t ymax)
|
||||
void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(ext->type == type) return;
|
||||
|
||||
ext->type = type;
|
||||
|
||||
lv_chart_refresh(chart);
|
||||
@@ -203,6 +207,8 @@ void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type)
|
||||
void lv_chart_set_point_count(lv_obj_t * chart, uint16_t point_cnt)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(ext->point_cnt == point_cnt) return;
|
||||
|
||||
lv_chart_series_t *ser;
|
||||
uint16_t point_cnt_old = ext->point_cnt;
|
||||
uint16_t i;
|
||||
@@ -233,6 +239,8 @@ void lv_chart_set_point_count(lv_obj_t * chart, uint16_t point_cnt)
|
||||
void lv_chart_set_series_opa(lv_obj_t * chart, lv_opa_t opa)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(ext->series.opa == opa) return;
|
||||
|
||||
ext->series.opa = opa;
|
||||
lv_obj_invalidate(chart);
|
||||
}
|
||||
@@ -245,6 +253,8 @@ void lv_chart_set_series_opa(lv_obj_t * chart, lv_opa_t opa)
|
||||
void lv_chart_set_series_width(lv_obj_t * chart, lv_coord_t width)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(ext->series.width == width) return;
|
||||
|
||||
ext->series.width = width;
|
||||
lv_obj_invalidate(chart);
|
||||
}
|
||||
@@ -256,7 +266,10 @@ void lv_chart_set_series_width(lv_obj_t * chart, lv_coord_t width)
|
||||
void lv_chart_set_series_darking(lv_obj_t * chart, lv_opa_t dark_eff)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(ext->series.dark == dark_eff) return;
|
||||
|
||||
ext->series.dark = dark_eff;
|
||||
lv_obj_invalidate(chart);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -113,6 +113,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
void lv_cont_set_layout(lv_obj_t * cont, lv_layout_t layout)
|
||||
{
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
|
||||
if(ext->layout == layout) return;
|
||||
|
||||
ext->layout = layout;
|
||||
|
||||
/*Send a signal to refresh the layout*/
|
||||
@@ -131,11 +133,15 @@ void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en)
|
||||
{
|
||||
lv_obj_invalidate(cont);
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
|
||||
if(ext->hor_fit == hor_en && ext->ver_fit == ver_en) return;
|
||||
|
||||
ext->hor_fit = hor_en == false ? 0 : 1;
|
||||
ext->ver_fit = ver_en == false ? 0 : 1;
|
||||
|
||||
/*Send a signal to set a new size*/
|
||||
cont->signal_func(cont, LV_SIGNAL_CORD_CHG, cont);
|
||||
lv_area_t area;
|
||||
lv_obj_get_coords(cont, &area);
|
||||
cont->signal_func(cont, LV_SIGNAL_CORD_CHG, &area);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
|
||||
@@ -172,6 +172,7 @@ void lv_ddlist_set_options(lv_obj_t * ddlist, const char * options)
|
||||
void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
if(ext->sel_opt_id == sel_opt) return;
|
||||
|
||||
ext->sel_opt_id = sel_opt < ext->option_cnt ? sel_opt : ext->option_cnt - 1;
|
||||
|
||||
@@ -203,6 +204,8 @@ void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_t action)
|
||||
void lv_ddlist_set_fix_height(lv_obj_t * ddlist, lv_coord_t h)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
if(ext->fix_height == h) return;
|
||||
|
||||
ext->fix_height = h;
|
||||
|
||||
lv_ddlist_refr_size(ddlist, false);
|
||||
@@ -218,7 +221,6 @@ void lv_ddlist_set_hor_fit(lv_obj_t * ddlist, bool fit_en)
|
||||
lv_cont_set_fit(ddlist, fit_en, lv_cont_get_ver_fit(ddlist));
|
||||
lv_page_set_scrl_fit(ddlist, fit_en, lv_page_get_scrl_fit_ver(ddlist));
|
||||
|
||||
|
||||
lv_ddlist_refr_size(ddlist, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -127,20 +127,24 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, const lv_color_t * colors)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
if(ext->values != NULL) {
|
||||
lv_mem_free(ext->values);
|
||||
ext->values = NULL;
|
||||
|
||||
if(ext->needle_count != needle_cnt) {
|
||||
if(ext->values != NULL) {
|
||||
lv_mem_free(ext->values);
|
||||
ext->values = NULL;
|
||||
}
|
||||
|
||||
ext->values = lv_mem_realloc(ext->values, needle_cnt * sizeof(int16_t));
|
||||
|
||||
int16_t min = lv_gauge_get_min_value(gauge);
|
||||
uint8_t n;
|
||||
for(n = ext->needle_count; n < needle_cnt; n++) {
|
||||
ext->values[n] = min;
|
||||
}
|
||||
|
||||
ext->needle_count = needle_cnt;
|
||||
}
|
||||
|
||||
ext->values = lv_mem_realloc(ext->values, needle_cnt * sizeof(int16_t));
|
||||
|
||||
int16_t min = lv_gauge_get_min_value(gauge);
|
||||
uint8_t n;
|
||||
for(n = ext->needle_count; n < needle_cnt; n++) {
|
||||
ext->values[n] = min;
|
||||
}
|
||||
|
||||
ext->needle_count = needle_cnt;
|
||||
ext->needle_colors = colors;
|
||||
lv_obj_invalidate(gauge);
|
||||
}
|
||||
@@ -156,6 +160,8 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int16_t value)
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
|
||||
if(needle_id >= ext->needle_count) return;
|
||||
if(ext->values[needle_id] == value) return;
|
||||
|
||||
|
||||
int16_t min = lv_gauge_get_min_value(gauge);
|
||||
int16_t max = lv_gauge_get_max_value(gauge);
|
||||
@@ -183,6 +189,7 @@ void lv_gauge_set_scale(lv_obj_t * gauge, uint16_t angle, uint8_t line_cnt, uint
|
||||
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
ext->label_count = label_cnt;
|
||||
lv_obj_invalidate(gauge);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
|
||||
@@ -36,8 +36,8 @@ typedef struct
|
||||
/*New data for this type */
|
||||
const void * src; /*Image source: Pointer to an array or a file or a symbol*/
|
||||
|
||||
lv_coord_t w; /*Width of the image (doubled when upscaled) (Handled by the library)*/
|
||||
lv_coord_t h; /*Height of the image (doubled when upscaled) (Handled by the library)*/
|
||||
lv_coord_t w; /*Width of the image (Handled by the library)*/
|
||||
lv_coord_t h; /*Height of the image (Handled by the library)*/
|
||||
uint8_t src_type :2; /*See: lv_img_src_t*/
|
||||
uint8_t auto_size :1; /*1: automatically set the object size to the image size*/
|
||||
uint8_t chroma_keyed :1; /*1: Chroma keyed image, LV_COLOR_TRANSP (lv_conf.h) pixels will be transparent (Handled by the library)*/
|
||||
@@ -70,8 +70,8 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img);
|
||||
/**
|
||||
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0.
|
||||
* Use 'lv_img_set_src()' instead.
|
||||
* @param img
|
||||
* @param fn
|
||||
* @param img -
|
||||
* @param fn -
|
||||
*/
|
||||
static inline void lv_img_set_file(lv_obj_t * img, const char * fn)
|
||||
{
|
||||
@@ -98,8 +98,8 @@ static inline void lv_img_set_style(lv_obj_t *img, lv_style_t *style)
|
||||
|
||||
/**
|
||||
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
|
||||
* @param img
|
||||
* @param upscale
|
||||
* @param img -
|
||||
* @param upscale -
|
||||
*/
|
||||
static inline void lv_img_set_upscale(lv_obj_t * img, bool upcale)
|
||||
{
|
||||
@@ -147,7 +147,7 @@ static inline lv_style_t* lv_img_get_style(lv_obj_t *img)
|
||||
|
||||
/**
|
||||
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
|
||||
* @param img
|
||||
* @param img -
|
||||
* @return false
|
||||
*/
|
||||
static inline bool lv_img_get_upscale(lv_obj_t * img)
|
||||
|
||||
@@ -146,6 +146,7 @@ void lv_kb_set_ta(lv_obj_t * kb, lv_obj_t * ta)
|
||||
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
|
||||
lv_cursor_type_t cur_type;
|
||||
|
||||
/*Hide the cursor of the old Text area if cursor management is enabled*/
|
||||
if(ext->ta && ext->cursor_mng) {
|
||||
cur_type = lv_ta_get_cursor_type(ext->ta);
|
||||
lv_ta_set_cursor_type(ext->ta, cur_type | LV_CURSOR_HIDDEN);
|
||||
@@ -153,6 +154,7 @@ void lv_kb_set_ta(lv_obj_t * kb, lv_obj_t * ta)
|
||||
|
||||
ext->ta = ta;
|
||||
|
||||
/*Show the cursor of the new Text area if cursor management is enabled*/
|
||||
if(ext->ta && ext->cursor_mng) {
|
||||
cur_type = lv_ta_get_cursor_type(ext->ta);
|
||||
lv_ta_set_cursor_type(ext->ta, cur_type & (~LV_CURSOR_HIDDEN));
|
||||
@@ -167,6 +169,8 @@ void lv_kb_set_ta(lv_obj_t * kb, lv_obj_t * ta)
|
||||
void lv_kb_set_mode(lv_obj_t * kb, lv_kb_mode_t mode)
|
||||
{
|
||||
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
|
||||
if(ext->mode == mode) return;
|
||||
|
||||
ext->mode = mode;
|
||||
if(mode == LV_KB_MODE_TEXT) lv_btnm_set_map(kb, kb_map_lc);
|
||||
else if(mode == LV_KB_MODE_NUM) lv_btnm_set_map(kb, kb_map_num);
|
||||
@@ -181,6 +185,8 @@ void lv_kb_set_mode(lv_obj_t * kb, lv_kb_mode_t mode)
|
||||
void lv_kb_set_cursor_manage(lv_obj_t * kb, bool en)
|
||||
{
|
||||
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
|
||||
if(ext->cursor_mng == en) return;
|
||||
|
||||
ext->cursor_mng = en == false? 0 : 1;
|
||||
|
||||
if(ext->ta) {
|
||||
@@ -387,14 +393,18 @@ static lv_res_t lv_app_kb_action(lv_obj_t * kb, const char * txt)
|
||||
return LV_RES_OK;
|
||||
}
|
||||
else if(strcmp(txt, SYMBOL_CLOSE) == 0) {
|
||||
lv_kb_set_ta(kb, NULL); /*De-assign the text area*/
|
||||
if(ext->hide_action) ext->hide_action(kb);
|
||||
else lv_obj_del(kb);
|
||||
else {
|
||||
lv_kb_set_ta(kb, NULL); /*De-assign the text area to hide it cursor if needed*/
|
||||
lv_obj_del(kb);
|
||||
}
|
||||
return LV_RES_INV;
|
||||
} else if(strcmp(txt, SYMBOL_OK) == 0) {
|
||||
lv_kb_set_ta(kb, NULL); /*De-assign the text area*/
|
||||
if(ext->ok_action) ext->ok_action(kb);
|
||||
else lv_obj_del(kb);
|
||||
else {
|
||||
lv_kb_set_ta(kb, NULL); /*De-assign the text area to hide it cursor if needed*/
|
||||
lv_obj_del(kb);
|
||||
}
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
|
||||
@@ -253,6 +253,7 @@ void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode)
|
||||
void lv_label_set_align(lv_obj_t *label, lv_label_align_t align)
|
||||
{
|
||||
lv_label_ext_t *ext = lv_obj_get_ext_attr(label);
|
||||
if(ext->align == align) return;
|
||||
|
||||
ext->align = align;
|
||||
|
||||
@@ -268,6 +269,7 @@ void lv_label_set_align(lv_obj_t *label, lv_label_align_t align)
|
||||
void lv_label_set_recolor(lv_obj_t * label, bool recolor_en)
|
||||
{
|
||||
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
|
||||
if(ext->recolor == recolor_en) return;
|
||||
|
||||
ext->recolor = recolor_en == false ? 0 : 1;
|
||||
|
||||
@@ -282,6 +284,8 @@ void lv_label_set_recolor(lv_obj_t * label, bool recolor_en)
|
||||
void lv_label_set_no_break(lv_obj_t * label, bool no_break_en)
|
||||
{
|
||||
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
|
||||
if(ext->no_break == no_break_en) return;
|
||||
|
||||
ext->no_break = no_break_en == false ? 0 : 1;
|
||||
|
||||
lv_label_refr_text(label);
|
||||
@@ -295,6 +299,8 @@ void lv_label_set_no_break(lv_obj_t * label, bool no_break_en)
|
||||
void lv_label_set_body_draw(lv_obj_t *label, bool body_en)
|
||||
{
|
||||
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
|
||||
if(ext->body_draw == body_en) return;
|
||||
|
||||
ext->body_draw = body_en == false ? 0 : 1;
|
||||
|
||||
lv_obj_refresh_ext_size(label);
|
||||
@@ -310,6 +316,8 @@ void lv_label_set_body_draw(lv_obj_t *label, bool body_en)
|
||||
void lv_label_set_anim_speed(lv_obj_t *label, uint16_t anim_speed)
|
||||
{
|
||||
lv_label_ext_t *ext = lv_obj_get_ext_attr(label);
|
||||
if(ext->anim_speed == anim_speed) return;
|
||||
|
||||
ext->anim_speed = anim_speed;
|
||||
|
||||
if(ext->long_mode == LV_LABEL_LONG_ROLL || ext->long_mode == LV_LABEL_LONG_SCROLL) {
|
||||
|
||||
@@ -104,6 +104,8 @@ void lv_led_set_bright(lv_obj_t * led, uint8_t bright)
|
||||
{
|
||||
/*Set the brightness*/
|
||||
lv_led_ext_t * ext = lv_obj_get_ext_attr(led);
|
||||
if(ext->bright == bright) return;
|
||||
|
||||
ext->bright = bright;
|
||||
|
||||
/*Invalidate the object there fore it will be redrawn*/
|
||||
|
||||
@@ -129,6 +129,7 @@ void lv_line_set_points(lv_obj_t * line, const lv_point_t * point_a, uint16_t po
|
||||
void lv_line_set_auto_size(lv_obj_t * line, bool autosize_en)
|
||||
{
|
||||
lv_line_ext_t * ext = lv_obj_get_ext_attr(line);
|
||||
if(ext->auto_size == autosize_en) return;
|
||||
|
||||
ext->auto_size = autosize_en == false ? 0 : 1;
|
||||
|
||||
@@ -146,6 +147,7 @@ void lv_line_set_auto_size(lv_obj_t * line, bool autosize_en)
|
||||
void lv_line_set_y_invert(lv_obj_t * line, bool yinv_en)
|
||||
{
|
||||
lv_line_ext_t * ext = lv_obj_get_ext_attr(line);
|
||||
if(ext->y_inv == yinv_en) return;
|
||||
|
||||
ext->y_inv = yinv_en == false ? 0 : 1;
|
||||
|
||||
@@ -255,6 +257,11 @@ static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param)
|
||||
}
|
||||
buf->type[i] = "lv_line";
|
||||
}
|
||||
else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
|
||||
lv_style_t * style = lv_line_get_style(line);
|
||||
if(line->ext_size < style->line.width) line->ext_size = style->line.width;
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -90,8 +90,8 @@ static inline void lv_line_set_style(lv_obj_t *line, lv_style_t *style)
|
||||
|
||||
/**
|
||||
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
|
||||
* @param line
|
||||
* @param upscale
|
||||
* @param line -
|
||||
* @param upscale -
|
||||
*/
|
||||
static inline void lv_line_set_upscale(lv_obj_t * line, bool upcale)
|
||||
{
|
||||
@@ -127,7 +127,7 @@ static inline lv_style_t* lv_line_get_style(lv_obj_t *line)
|
||||
|
||||
/**
|
||||
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
|
||||
* @param line
|
||||
* @param line -
|
||||
* @return false
|
||||
*/
|
||||
static inline bool lv_line_get_upscale(lv_obj_t * line)
|
||||
|
||||
@@ -211,6 +211,8 @@ void lv_list_set_anim_time(lv_obj_t *list, uint16_t anim_time)
|
||||
#if USE_LV_ANIMATION == 0
|
||||
anim_time = 0;
|
||||
#endif
|
||||
|
||||
if(ext->anim_time == anim_time) return;
|
||||
ext->anim_time = anim_time;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,8 +112,10 @@ lv_obj_t * lv_lmeter_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
*/
|
||||
void lv_lmeter_set_value(lv_obj_t *lmeter, int16_t value)
|
||||
{
|
||||
lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
|
||||
ext->cur_value = value > ext->max_value ? ext->max_value : value;
|
||||
lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
|
||||
if(ext->cur_value == value) return;
|
||||
|
||||
ext->cur_value = value > ext->max_value ? ext->max_value : value;
|
||||
ext->cur_value = ext->cur_value < ext->min_value ? ext->min_value : ext->cur_value;
|
||||
lv_obj_invalidate(lmeter);
|
||||
}
|
||||
@@ -127,6 +129,8 @@ void lv_lmeter_set_value(lv_obj_t *lmeter, int16_t value)
|
||||
void lv_lmeter_set_range(lv_obj_t *lmeter, int16_t min, int16_t max)
|
||||
{
|
||||
lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
|
||||
if(ext->min_value == min && ext->max_value == max) return;
|
||||
|
||||
ext->max_value = max;
|
||||
ext->min_value = min;
|
||||
if(ext->cur_value > max) {
|
||||
@@ -149,6 +153,8 @@ void lv_lmeter_set_range(lv_obj_t *lmeter, int16_t min, int16_t max)
|
||||
void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt)
|
||||
{
|
||||
lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
|
||||
if(ext->scale_angle == angle && ext->line_cnt == line_cnt) return;
|
||||
|
||||
ext->scale_angle = angle;
|
||||
ext->line_cnt = line_cnt;
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt);
|
||||
* Set the styles of a line meter
|
||||
* @param lmeter pointer to a line meter object
|
||||
* @param bg set the style of the line meter
|
||||
* */
|
||||
*/
|
||||
static inline void lv_lmeter_set_style(lv_obj_t *lmeter, lv_style_t *bg)
|
||||
{
|
||||
lv_obj_set_style(lmeter, bg);
|
||||
|
||||
@@ -191,6 +191,7 @@ void lv_mbox_set_anim_time(lv_obj_t * mbox, uint16_t anim_time)
|
||||
#if USE_LV_ANIMATION == 0
|
||||
anim_time = 0;
|
||||
#endif
|
||||
|
||||
ext->anim_time = anim_time;
|
||||
}
|
||||
|
||||
@@ -348,6 +349,16 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
|
||||
{
|
||||
lv_res_t res;
|
||||
|
||||
/*Translate LV_GROUP_KEY_UP/DOWN to LV_GROUP_KEY_LEFT/RIGHT */
|
||||
char c_trans = 0;
|
||||
if(sign == LV_SIGNAL_CONTROLL) {
|
||||
c_trans = *((char*)param);
|
||||
if(c_trans == LV_GROUP_KEY_DOWN) c_trans = LV_GROUP_KEY_LEFT;
|
||||
if(c_trans == LV_GROUP_KEY_UP) c_trans = LV_GROUP_KEY_RIGHT;
|
||||
|
||||
param = &c_trans;
|
||||
}
|
||||
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(mbox, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
@@ -356,7 +367,6 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
|
||||
if(sign == LV_SIGNAL_CORD_CHG) {
|
||||
if(lv_obj_get_width(mbox) != lv_area_get_width(param)) {
|
||||
mbox_realign(mbox);
|
||||
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
|
||||
@@ -170,6 +170,8 @@ void lv_page_set_pr_action(lv_obj_t * page, lv_action_t pr_action)
|
||||
void lv_page_set_sb_mode(lv_obj_t * page, lv_sb_mode_t sb_mode)
|
||||
{
|
||||
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
|
||||
if(ext->sb.mode == sb_mode) return;
|
||||
|
||||
ext->sb.mode = sb_mode;
|
||||
ext->sb.hor_draw = 0;
|
||||
ext->sb.ver_draw = 0;
|
||||
|
||||
@@ -160,7 +160,7 @@ static inline void lv_page_set_scrl_layout(lv_obj_t * page, lv_layout_t layout)
|
||||
* @param page pointer to a page object
|
||||
* @param type which style should be set
|
||||
* @param style pointer to a style
|
||||
* */
|
||||
*/
|
||||
void lv_page_set_style(lv_obj_t *page, lv_page_style_t type, lv_style_t *style);
|
||||
|
||||
/*=====================
|
||||
@@ -229,7 +229,7 @@ static inline bool lv_page_get_scrl_fit_ver(lv_obj_t * page)
|
||||
* @param page pointer to page object
|
||||
* @param type which style should be get
|
||||
* @return style pointer to a style
|
||||
* */
|
||||
*/
|
||||
lv_style_t * lv_page_get_style(lv_obj_t *page, lv_page_style_t type);
|
||||
|
||||
/*=====================
|
||||
|
||||
@@ -125,6 +125,9 @@ void lv_roller_set_selected(lv_obj_t *roller, uint16_t sel_opt, bool anim_en)
|
||||
#if USE_LV_ANIMATION == 0
|
||||
anim_en = false;
|
||||
#endif
|
||||
|
||||
if(lv_roller_get_selected(roller) == sel_opt) return;
|
||||
|
||||
lv_ddlist_set_selected(roller, sel_opt);
|
||||
refr_position(roller, anim_en);
|
||||
}
|
||||
|
||||
@@ -127,6 +127,8 @@ void lv_slider_set_action(lv_obj_t * slider, lv_action_t action)
|
||||
void lv_slider_set_knob_in(lv_obj_t * slider, bool in)
|
||||
{
|
||||
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
|
||||
if(ext->knob_in == in) return;
|
||||
|
||||
ext->knob_in = in == false ? 0 : 1;
|
||||
lv_obj_invalidate(slider);
|
||||
}
|
||||
@@ -273,11 +275,21 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
|
||||
pad_hor_bg = (lv_area_get_width(&area_bg) - LV_SLIDER_SIZE_MIN) >> 1;
|
||||
}
|
||||
|
||||
/*Let space only in the perpendicular directions*/
|
||||
area_bg.x1 += slider_w < slider_h ? pad_hor_bg : 0; /*Pad only for vertical slider*/
|
||||
area_bg.x2 -= slider_w < slider_h ? pad_hor_bg : 0; /*Pad only for vertical slider*/
|
||||
area_bg.y1 += slider_w > slider_h ? pad_ver_bg : 0; /*Pad only for horizontal slider*/
|
||||
area_bg.y2 -= slider_w > slider_h ? pad_ver_bg : 0; /*Pad only for horizontal slider*/
|
||||
if(ext->knob_in) { /*Enable extra size if the knob is inside */
|
||||
if(pad_hor_bg < 0) {
|
||||
area_bg.x1 += pad_hor_bg;
|
||||
area_bg.x2 -= pad_hor_bg;
|
||||
}
|
||||
if(pad_ver_bg < 0) {
|
||||
area_bg.y1 += pad_hor_bg;
|
||||
area_bg.y2 -= pad_hor_bg;
|
||||
}
|
||||
} else { /*Let space only in the perpendicular directions*/
|
||||
area_bg.x1 += slider_w < slider_h ? pad_hor_bg : 0; /*Pad only for vertical slider*/
|
||||
area_bg.x2 -= slider_w < slider_h ? pad_hor_bg : 0; /*Pad only for vertical slider*/
|
||||
area_bg.y1 += slider_w > slider_h ? pad_ver_bg : 0; /*Pad only for horizontal slider*/
|
||||
area_bg.y2 -= slider_w > slider_h ? pad_ver_bg : 0; /*Pad only for horizontal slider*/
|
||||
}
|
||||
lv_draw_rect(&area_bg, mask, style_bg);
|
||||
|
||||
/*Draw the indicator*/
|
||||
@@ -309,11 +321,11 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
|
||||
|
||||
if(slider_w >= slider_h) {
|
||||
area_indic.x2 = (int32_t) ((int32_t)lv_area_get_width(&area_indic) * (cur_value - min_value)) / (max_value - min_value);
|
||||
area_indic.x2 += area_indic.x1;
|
||||
area_indic.x2 = area_indic.x1 + area_indic.x2 - 1;
|
||||
|
||||
} else {
|
||||
area_indic.y1 = (int32_t) ((int32_t)lv_area_get_height(&area_indic) * (cur_value - min_value)) / (max_value - min_value);
|
||||
area_indic.y1 = area_indic.y2 - area_indic.y1;
|
||||
area_indic.y1 = area_indic.y2 - area_indic.y1 + 1;
|
||||
}
|
||||
|
||||
if(cur_value != min_value) lv_draw_rect(&area_indic, mask, style_indic);
|
||||
|
||||
@@ -112,6 +112,8 @@ lv_obj_t * lv_sw_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
*/
|
||||
void lv_sw_on(lv_obj_t *sw)
|
||||
{
|
||||
if(lv_sw_get_state(sw)) return; /*Do nothing is already turned on*/
|
||||
|
||||
lv_sw_ext_t *ext = lv_obj_get_ext_attr(sw);
|
||||
lv_slider_set_value(sw, 1);
|
||||
lv_slider_set_style(sw, LV_SLIDER_STYLE_KNOB,ext->style_knob_on);
|
||||
@@ -123,6 +125,8 @@ void lv_sw_on(lv_obj_t *sw)
|
||||
*/
|
||||
void lv_sw_off(lv_obj_t *sw)
|
||||
{
|
||||
if(!lv_sw_get_state(sw)) return; /*Do nothing is already turned off*/
|
||||
|
||||
lv_sw_ext_t *ext = lv_obj_get_ext_attr(sw);
|
||||
lv_slider_set_value(sw, 0);
|
||||
lv_slider_set_style(sw, LV_SLIDER_STYLE_KNOB,ext->style_knob_off);
|
||||
|
||||
@@ -347,6 +347,8 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt)
|
||||
void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
|
||||
{
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
if(ext->cursor.pos == pos) return;
|
||||
|
||||
uint16_t len = lv_txt_get_length(lv_label_get_text(ext->label));
|
||||
|
||||
if(pos < 0) pos = len + pos;
|
||||
@@ -419,6 +421,8 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
|
||||
void lv_ta_set_cursor_type(lv_obj_t * ta, lv_cursor_type_t cur_type)
|
||||
{
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
if(ext->cursor.type == cur_type) return;
|
||||
|
||||
ext->cursor.type = cur_type;
|
||||
lv_obj_invalidate(ta);
|
||||
}
|
||||
@@ -431,6 +435,7 @@ void lv_ta_set_cursor_type(lv_obj_t * ta, lv_cursor_type_t cur_type)
|
||||
void lv_ta_set_pwd_mode(lv_obj_t * ta, bool pwd_en)
|
||||
{
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
if(ext->pwd_mode == pwd_en) return;
|
||||
|
||||
/*Pwd mode is now enabled*/
|
||||
if(ext->pwd_mode == 0 && pwd_en != false) {
|
||||
@@ -464,8 +469,10 @@ void lv_ta_set_pwd_mode(lv_obj_t * ta, bool pwd_en)
|
||||
*/
|
||||
void lv_ta_set_one_line(lv_obj_t * ta, bool en)
|
||||
{
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
if(ext->one_line == en) return;
|
||||
|
||||
if(en != false) {
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
lv_style_t * style_ta = lv_obj_get_style(ta);
|
||||
lv_style_t * style_scrl = lv_obj_get_style(lv_page_get_scrl(ta));
|
||||
lv_style_t * style_label = lv_obj_get_style(ext->label);
|
||||
@@ -478,7 +485,6 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en)
|
||||
lv_label_set_no_break(ext->label, true);
|
||||
lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->body.padding.hor, style_ta->body.padding.ver);
|
||||
} else {
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
lv_style_t * style_ta = lv_obj_get_style(ta);
|
||||
|
||||
ext->one_line = 0;
|
||||
@@ -1044,7 +1050,10 @@ static void pwd_char_hider(lv_obj_t * ta)
|
||||
int16_t len = lv_txt_get_length(txt);
|
||||
bool refr = false;
|
||||
uint16_t i;
|
||||
for(i = 0; i < len; i++) txt[i] = '*';
|
||||
for(i = 0; i < len; i++) {
|
||||
txt[i] = '*';
|
||||
refr = true;
|
||||
}
|
||||
|
||||
txt[i] = '\0';
|
||||
|
||||
|
||||
@@ -241,6 +241,7 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
|
||||
anim_en = false;
|
||||
#endif
|
||||
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
|
||||
|
||||
lv_style_t * style = lv_obj_get_style(ext->content);
|
||||
|
||||
if(id >= ext->tab_cnt) id = ext->tab_cnt - 1;
|
||||
|
||||
@@ -207,6 +207,8 @@ void lv_win_set_title(lv_obj_t * win, const char * title)
|
||||
void lv_win_set_btn_size(lv_obj_t * win, lv_coord_t size)
|
||||
{
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
if(ext->btn_size == size) return;
|
||||
|
||||
ext->btn_size = size;
|
||||
|
||||
lv_win_realign(win);
|
||||
|
||||
@@ -258,6 +258,7 @@ lv_theme_t * lv_theme_get_current(void);
|
||||
#include "lv_theme_default.h"
|
||||
#include "lv_theme_alien.h"
|
||||
#include "lv_theme_night.h"
|
||||
#include "lv_theme_zen.h"
|
||||
#include "lv_theme_mono.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -366,9 +366,9 @@ static void gauge_init(void)
|
||||
lv_style_copy(&gauge_bg, &def);
|
||||
gauge_bg.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 70);
|
||||
gauge_bg.body.grad_color = gauge_bg.body.main_color;
|
||||
gauge_bg.body.padding.hor = LV_DPI / 12; /*Scale line length*/
|
||||
gauge_bg.body.padding.hor = LV_DPI / 16; /*Scale line length*/
|
||||
gauge_bg.body.padding.ver = LV_DPI / 10; /*Needle center size*/
|
||||
gauge_bg.body.padding.inner = LV_DPI / 8; /*Label - scale distance*/
|
||||
gauge_bg.body.padding.inner = LV_DPI / 12; /*Label - scale distance*/
|
||||
gauge_bg.body.border.color = LV_COLOR_HEX3(0x777);
|
||||
gauge_bg.line.color = lv_color_hsv_to_rgb(_hue, 80, 75);
|
||||
gauge_bg.line.width = 2;
|
||||
|
||||
@@ -456,7 +456,7 @@ lv_theme_t * lv_theme_mono_init(uint16_t hue, lv_font_t *font)
|
||||
* Get a pointer to the theme
|
||||
* @return pointer to the theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_templ(void)
|
||||
lv_theme_t * lv_theme_get_mono(void)
|
||||
{
|
||||
return &theme;
|
||||
}
|
||||
|
||||
@@ -283,10 +283,10 @@ static void gauge_init(void)
|
||||
|
||||
lv_style_copy(&gauge, &def);
|
||||
gauge.line.color = lv_color_hsv_to_rgb(_hue, 50, 70);
|
||||
gauge.line.width = 2;
|
||||
gauge.line.width = 1;
|
||||
gauge.body.main_color = LV_COLOR_HEX3(0x999);
|
||||
gauge.body.grad_color = gauge.body.main_color;
|
||||
gauge.body.padding.hor = LV_DPI / 12;
|
||||
gauge.body.padding.hor = LV_DPI / 16;
|
||||
gauge.body.border.color = LV_COLOR_HEX3(0x666); /*Needle middle color*/
|
||||
|
||||
theme.gauge = &gauge;
|
||||
|
||||
Reference in New Issue
Block a user