mirror of
https://github.com/lvgl/lvgl.git
synced 2024-11-27 19:53:42 +08:00
astyle code formatting
This commit is contained in:
parent
23b65ca454
commit
41695bf9ac
1
astyle_c
1
astyle_c
@ -1 +0,0 @@
|
||||
--style=kr --convert-tabs --indent=spaces=4 --indent-switches --pad-oper --unpad-paren --align-pointer=middle --suffix=.bak --lineend=linux --min-conditional-indent=
|
@ -170,12 +170,12 @@ void lv_label_set_text(lv_obj_t * label, const char * text)
|
||||
Use 4 spaces indentation instead of tab.
|
||||
|
||||
You can use **astyle** to format the code. The required config flies are: `docs/astyle_c` and `docs/astyle_h`.
|
||||
To format the header files:
|
||||
To format the source files:
|
||||
`$ find . -type f -name "*.c" | xargs astyle --options=docs/astyle_c`
|
||||
|
||||
To format the sorce files:
|
||||
To format the header files:
|
||||
`$ find . -type f -name "*.h" | xargs astyle --options=docs/astyle_h`
|
||||
|
||||
Append `-n` to the end to skip creation of backup file or use `$ find . -type f -name "*.bak" -delete` (for source file's backups) and `find . -type f -name "*.orig" -delete` (for header file's backups)
|
||||
Append `-n` to the end to skip creation of backup file OR use `$ find . -type f -name "*.bak" -delete` (for source file's backups) and `find . -type f -name "*.orig" -delete` (for header file's backups)
|
||||
|
||||
|
||||
|
@ -1,39 +0,0 @@
|
||||
# TODOs for major versions
|
||||
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 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
|
||||
- [ ] disp_flush: not const color map
|
||||
- [ ] ext size removal, enable drawing on full parent.
|
||||
- [ ] multiple display support
|
||||
- [ ] lv_ufs removal (was required only in the the old image system)
|
||||
|
||||
## 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
|
||||
- [x] Create a new repository for examples
|
||||
- [x] Convert Applications into simple examples
|
||||
- [x] Add tests for all object types
|
||||
|
||||
**API changes**
|
||||
- [x] Rework lv_style_t structure
|
||||
- [x] Remove LV_DOWNSCALE (LV_ANTIALIAS will be used instead)
|
||||
- [x] Rename (and slightly rework) some function, defines and enums to be more descriptive
|
||||
- [x] lv_btnm: rework width control. Now a control byte is used for *width*, *hide* and *no long press* settings.
|
||||
- [x] LV_LABEL_LONG_DOTS removed, use LV_LABEL_LONG_ROLL instead
|
||||
- [x] *lv_list_set_element_text_roll()* removed.
|
||||
- [x] *lv_ddlist_set_fix_height()* instead of *auto_size*
|
||||
- [x] *lv_list_set_sb_out()* removed because now the scrollbar style can position the scrollbar
|
||||
- [x] *lv_gauge* rework to make it more like line meter (remove background but add scale lines)
|
||||
- [x] rename *lv_dispi_...* to *lv_indev_...*
|
||||
- [x] *lv_dispi_t* removed from *lv_action_type_t*. Use lv_indev_act() instead
|
||||
- [x] make styles to global variable to ensure less typing
|
||||
- [x] make fonts to global variables to ensure less typing and easy user-font adding
|
||||
- [x] join symbol fonts into normal built-in fonts
|
||||
- [x] add inline functions to avoide direct use of anchestor functions (e.g. for buttons: lv_cont_set_fit -> lv_btn_set_fit)
|
@ -1,84 +0,0 @@
|
||||
# TODOs for minor versions
|
||||
Minor versions (x.1.0, x.2.0 ...) released when one or more new feature is addded without changing the API. New features can be added with major versions (1.0.0, 2.0.0 ...) too.
|
||||
|
||||
## Contributing
|
||||
Please create an issue to suggest a new feature instead of adding pull request to this file.
|
||||
|
||||
## Ideas
|
||||
Here are ideas which are not assigned to a minor version yet:
|
||||
- label: add a horzintal line (e.g. underline or line through).
|
||||
- lv_split: new object type, a hor. or ver. line for decoration purpose
|
||||
- lv_valset: new object type, a label with "+" and "-" buttons
|
||||
- lv_listctrl: new object type, a list various controls on th right (sw, cb erc.)
|
||||
- lv_inlist: new object type, inline drop down list (a button wich opens a list in place)
|
||||
- lv_char: new_object type: characteristic set (like chart with draggable points)
|
||||
- lv_vol: new_object type: volume meter (like a bar with segments)
|
||||
- Anim. paths: monentum (tnh(x)), curve (exp), shake
|
||||
- Hover, hover_lost signals
|
||||
- Detached area (for video rendering where LittlevGL don't put pixels)
|
||||
- lv_ta: add placeholder text
|
||||
- image rotate
|
||||
|
||||
## v5.3 (planned)
|
||||
Mainly graphical/drawing improvments and Lua support
|
||||
- [ ] API extension: turn the relevant "lv_obj" functions to the specific type (lv_btn_set_size)
|
||||
- [ ] Lua interface to create GUI with script
|
||||
- [ ] Arabic glyph convert (based on letter position)
|
||||
- [ ] Arc rawing
|
||||
- [ ] Right-to-left write support
|
||||
- [ ] Bit based VDB: 1, 2 or 4 bit
|
||||
- [ ] Ttriangle drawing
|
||||
|
||||
## v5.2 (in progress)
|
||||
Mainly new object and new feauters:
|
||||
- [ ] New object type: Listview (table) #137
|
||||
- [ ] New object type: Calendar
|
||||
- [ ] New object type: Icon (button like image) #182
|
||||
- [ ] New object type: QR code #199
|
||||
- [ ] lv_page: scroll on LV_GROUP_KEY_UP/DOWN/LEFT/RIGHT
|
||||
- [ ] lv_obj_align: option in lv_conf.h sav the last alignment's coordinate ad aply it on lv_obj_realign
|
||||
- [ ] lv_line: perpndicular line ending
|
||||
- [ ] lv_gauge: option to put lables outside of the scale
|
||||
- [ ] lv_img: png support #254
|
||||
- [ ] lv_tabview: add option to put the tab button to the bottom
|
||||
- [ ] Error callback: add an option to register a callback called on error
|
||||
- [ ] Support more character coding (e.g. UTF8, UTF16 etc)
|
||||
|
||||
## 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
|
||||
- [x] Font handling extension for effective Chiese font handling (cutsom read functions)
|
||||
- [x] Remove LV_FONT_ANTIALIAS and add fonts with BPP (bit-per-pixel): 1, 2, 4 and 8
|
||||
- [x] lv_img: add pixel level opacity option (ARGB8888 or ARGB8565) (make image upscale pointless)
|
||||
- [x] LV_ANTIALIAS rework: meaning anti-alias lines and curves
|
||||
- [x] Merge symbol fonts (basic, file and feedback) into one font
|
||||
- [x] lv_group: different default style_mod function with LV_COLOR_DEPTH 1
|
||||
- [x] lv_img_set_src() to handle file path, symbols and const variables with one function
|
||||
- [x] LV_PROTECT_PRESS_LOST: prevent the input devices to NOT find new object when the object's pressing is lost
|
||||
- [x] lv_label: draw style.body.padding.hor/ver greater body if body_draw is enabled
|
||||
- [x] LV_LAYOUT_PRETTY: in one row align obeóject vertically to middle
|
||||
- [x] Add user data option to lv_indev_drv_t and pass it with lv_indev_data_t to the read function. #115
|
||||
- [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 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)
|
||||
- [x] lv_roller: new object type, a roller to select a value (like on smartphones)
|
||||
- [x] lv_kb: new object type, Keyboard
|
||||
- [x] lv_btnm: lv_btnm_set_tgl() to toggle last button
|
||||
- [x] lv_ta: cursor types
|
||||
- [x] add themes with predefined styles
|
||||
- [x] partial border draw in styles
|
||||
|
||||
## 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
|
||||
- [x] lv_btn: add lv_btn_get_..._action
|
||||
- [x] lv_list: add lv_list_get_element_label/img
|
||||
- [x] lv_ta: lv_ta_set_one_line to configure the Text area to one lined input field
|
||||
- [x] style animations add
|
||||
- [x] lv_btnm: besides 0. byte (width dsc) 1. byte: hidden (\177, 0x7F, delete)
|
@ -1,62 +0,0 @@
|
||||
# TODOs for patch versions
|
||||
Patch versions (x.y.1, x.y.2) contain bugfixes without changing the API but they can apppear in minor (x.1.0, x.2.0) or major (1.0.0, 2.0.0) versions too.
|
||||
|
||||
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.1.1 (released on: 20.05.2018)
|
||||
- [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
|
||||
- [x] lv_txt_ut8_size fiy for 4 byte characters
|
||||
- [x] lv_slider: fix knob_in with not zero min value
|
||||
- [x] lv_area_is_on: handled some cases wrong
|
||||
- [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 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
|
||||
- [x] lv_roller: lv_roller_get_selected_str: bugfix (was recursive call)
|
||||
- [x] lv_obj_get_style: with NULL style check if the parent is focused and use the focused style
|
||||
- [x] lv_roller: add missing action handling
|
||||
- [x] Set 24 bit colors upper byte (alpha) to 0xFF
|
||||
|
||||
## 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 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 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()*
|
@ -72,7 +72,7 @@
|
||||
|
||||
/*Color settings*/
|
||||
#define LV_COLOR_DEPTH 16 /*Color depth: 1/8/16/32*/
|
||||
#define LV_COLOR_16_SWAP 0 /*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/
|
||||
#define LV_COLOR_16_SWAP 0 /*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/
|
||||
#define LV_COLOR_SCREEN_TRANSP 0 /*1: Enable screen transparency. Useful for OSD or other overlapping GUIs. Requires ARGB8888 colors*/
|
||||
#define LV_COLOR_TRANSP LV_COLOR_LIME /*Images pixels with this color will not be drawn (with chroma keying)*/
|
||||
|
||||
|
@ -91,11 +91,11 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
|
||||
|
||||
/*If the object is already in a group and focused then defocuse it*/
|
||||
if(obj->group_p) {
|
||||
if(lv_obj_is_focused(obj)) {
|
||||
lv_group_focus_next(obj->group_p);
|
||||
if(lv_obj_is_focused(obj)) {
|
||||
lv_group_focus_next(obj->group_p);
|
||||
|
||||
LV_LOG_INFO("group: assign object to an other group");
|
||||
}
|
||||
LV_LOG_INFO("group: assign object to an other group");
|
||||
}
|
||||
}
|
||||
|
||||
obj->group_p = group;
|
||||
@ -156,7 +156,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
|
||||
lv_obj_t ** i;
|
||||
LL_READ(g->obj_ll, i) {
|
||||
if(*i == obj) {
|
||||
if(g->obj_focus == i) return; /*Don't focus the already focused object again*/
|
||||
if(g->obj_focus == i) return; /*Don't focus the already focused object again*/
|
||||
if(g->obj_focus != NULL) {
|
||||
(*g->obj_focus)->signal_func(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
|
||||
lv_obj_invalidate(*g->obj_focus);
|
||||
@ -294,9 +294,9 @@ void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb)
|
||||
*/
|
||||
void lv_group_set_editing(lv_group_t * group, bool edit)
|
||||
{
|
||||
group->editing = edit ? 1 : 0;
|
||||
lv_obj_t * focused = lv_group_get_focused(group);
|
||||
lv_obj_invalidate(focused);
|
||||
group->editing = edit ? 1 : 0;
|
||||
lv_obj_t * focused = lv_group_get_focused(group);
|
||||
lv_obj_invalidate(focused);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -306,7 +306,7 @@ void lv_group_set_editing(lv_group_t * group, bool edit)
|
||||
*/
|
||||
void lv_group_set_click_focus(lv_group_t * group, bool en)
|
||||
{
|
||||
group->click_focus = en ? 1 : 0;
|
||||
group->click_focus = en ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -320,11 +320,11 @@ lv_style_t * lv_group_mod_style(lv_group_t * group, const lv_style_t * style)
|
||||
lv_style_copy(&group->style_tmp, style);
|
||||
|
||||
if(group->editing) {
|
||||
if(group->style_mod_edit != NULL) group->style_mod_edit(&group->style_tmp);
|
||||
else style_mod_edit_def(&group->style_tmp);
|
||||
if(group->style_mod_edit != NULL) group->style_mod_edit(&group->style_tmp);
|
||||
else style_mod_edit_def(&group->style_tmp);
|
||||
} else {
|
||||
if(group->style_mod != NULL) group->style_mod(&group->style_tmp);
|
||||
else style_mod_def(&group->style_tmp);
|
||||
if(group->style_mod != NULL) group->style_mod(&group->style_tmp);
|
||||
else style_mod_def(&group->style_tmp);
|
||||
}
|
||||
return &group->style_tmp;
|
||||
}
|
||||
@ -349,7 +349,7 @@ lv_obj_t * lv_group_get_focused(const lv_group_t * group)
|
||||
*/
|
||||
lv_group_style_mod_func_t lv_group_get_style_mod_cb(const lv_group_t * group)
|
||||
{
|
||||
if(!group) return false;
|
||||
if(!group) return false;
|
||||
return group->style_mod ;
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ lv_group_style_mod_func_t lv_group_get_style_mod_cb(const lv_group_t * group)
|
||||
*/
|
||||
lv_group_style_mod_func_t lv_group_get_style_mod_edit_cb(const lv_group_t * group)
|
||||
{
|
||||
if(!group) return false;
|
||||
if(!group) return false;
|
||||
return group->style_mod_edit;
|
||||
}
|
||||
|
||||
@ -371,7 +371,7 @@ lv_group_style_mod_func_t lv_group_get_style_mod_edit_cb(const lv_group_t * grou
|
||||
*/
|
||||
lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group)
|
||||
{
|
||||
if(!group) return false;
|
||||
if(!group) return false;
|
||||
return group->focus_cb;
|
||||
}
|
||||
|
||||
@ -382,8 +382,8 @@ lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group)
|
||||
*/
|
||||
bool lv_group_get_editing(const lv_group_t * group)
|
||||
{
|
||||
if(!group) return false;
|
||||
return group->editing ? true : false;
|
||||
if(!group) return false;
|
||||
return group->editing ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -393,8 +393,8 @@ bool lv_group_get_editing(const lv_group_t * group)
|
||||
*/
|
||||
bool lv_group_get_click_focus(const lv_group_t * group)
|
||||
{
|
||||
if(!group) return false;
|
||||
return group->click_focus ? true : false;
|
||||
if(!group) return false;
|
||||
return group->click_focus ? true : false;
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
@ -53,9 +53,9 @@ typedef struct _lv_group_t
|
||||
lv_group_style_mod_func_t style_mod_edit;/*A function which modifies the style of the focused object*/
|
||||
lv_group_focus_cb_t focus_cb; /*A function to call when a new object is focused (optional)*/
|
||||
lv_style_t style_tmp; /*Stores the modified style of the focused object */
|
||||
uint8_t frozen :1; /*1: can't focus to new object*/
|
||||
uint8_t editing :1; /*1: Edit mode, 0: Navigate mode*/
|
||||
uint8_t click_focus :1; /*1: If an object in a group is clicked by an indev then it will be focused */
|
||||
uint8_t frozen :1; /*1: can't focus to new object*/
|
||||
uint8_t editing :1; /*1: Edit mode, 0: Navigate mode*/
|
||||
uint8_t click_focus :1; /*1: If an object in a group is clicked by an indev then it will be focused */
|
||||
} lv_group_t;
|
||||
|
||||
/**********************
|
||||
|
@ -83,9 +83,9 @@ lv_indev_t * lv_indev_get_act(void)
|
||||
*/
|
||||
lv_hal_indev_type_t lv_indev_get_type(const lv_indev_t * indev)
|
||||
{
|
||||
if(indev == NULL) return LV_INDEV_TYPE_NONE;
|
||||
if(indev == NULL) return LV_INDEV_TYPE_NONE;
|
||||
|
||||
return indev->driver.type;
|
||||
return indev->driver.type;
|
||||
}
|
||||
/**
|
||||
* Reset one or all input devices
|
||||
@ -266,7 +266,7 @@ static void indev_proc_task(void * param)
|
||||
(void)param;
|
||||
|
||||
|
||||
LV_LOG_TRACE("indev task started");
|
||||
LV_LOG_TRACE("indev task started");
|
||||
|
||||
lv_indev_data_t data;
|
||||
lv_indev_t * i;
|
||||
@ -284,7 +284,7 @@ static void indev_proc_task(void * param)
|
||||
do {
|
||||
/*Read the data*/
|
||||
more_to_read = lv_indev_read(i, &data);
|
||||
indev_proc_reset_query_handler(i); /*The active object might deleted even in the read function*/
|
||||
indev_proc_reset_query_handler(i); /*The active object might deleted even in the read function*/
|
||||
i->proc.state = data.state;
|
||||
|
||||
if(i->proc.state == LV_INDEV_STATE_PR) {
|
||||
@ -309,7 +309,7 @@ static void indev_proc_task(void * param)
|
||||
|
||||
indev_act = NULL; /*End of indev processing, so no act indev*/
|
||||
|
||||
LV_LOG_TRACE("indev task finished");
|
||||
LV_LOG_TRACE("indev task finished");
|
||||
}
|
||||
|
||||
|
||||
@ -367,14 +367,13 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
else if(data->state == LV_INDEV_STATE_PR && i->proc.last_state == LV_INDEV_STATE_PR) {
|
||||
if(data->key == LV_GROUP_KEY_ENTER &&
|
||||
i->proc.long_pr_sent == 0 &&
|
||||
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME )
|
||||
{
|
||||
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME) {
|
||||
/*On enter long press leave edit mode.*/
|
||||
lv_obj_t * focused = lv_group_get_focused(i->group);
|
||||
if(focused) {
|
||||
lv_obj_t * focused = lv_group_get_focused(i->group);
|
||||
if(focused) {
|
||||
focused->signal_func(focused, LV_SIGNAL_LONG_PRESS, indev_act);
|
||||
i->proc.long_pr_sent = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Release happened*/
|
||||
@ -392,19 +391,14 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
}
|
||||
}
|
||||
|
||||
if(data->key == LV_GROUP_KEY_NEXT)
|
||||
{
|
||||
if(data->key == LV_GROUP_KEY_NEXT) {
|
||||
lv_group_focus_next(i->group);
|
||||
}
|
||||
else if(data->key == LV_GROUP_KEY_PREV)
|
||||
{
|
||||
lv_group_focus_prev(i->group);
|
||||
}
|
||||
else if(data->key == LV_GROUP_KEY_ENTER)
|
||||
{
|
||||
if (!i->proc.long_pr_sent) {
|
||||
lv_group_send_data(i->group, data->key);
|
||||
}
|
||||
} else if(data->key == LV_GROUP_KEY_PREV) {
|
||||
lv_group_focus_prev(i->group);
|
||||
} else if(data->key == LV_GROUP_KEY_ENTER) {
|
||||
if(!i->proc.long_pr_sent) {
|
||||
lv_group_send_data(i->group, data->key);
|
||||
}
|
||||
} else {
|
||||
lv_group_send_data(i->group, data->key);
|
||||
}
|
||||
@ -460,15 +454,14 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
/*Pressing*/
|
||||
else if(data->state == LV_INDEV_STATE_PR && i->proc.last_state == LV_INDEV_STATE_PR) {
|
||||
if(i->proc.long_pr_sent == 0 &&
|
||||
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME )
|
||||
{
|
||||
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME) {
|
||||
/*On enter long press leave edit mode.*/
|
||||
lv_obj_t * focused = lv_group_get_focused(i->group);
|
||||
|
||||
bool editable = false;
|
||||
if(focused) focused->signal_func(focused, LV_SIGNAL_GET_EDITABLE, &editable);
|
||||
|
||||
if (editable) {
|
||||
if(editable) {
|
||||
i->group->editing = i->group->editing ? 0 : 1;
|
||||
if(focused) focused->signal_func(focused, LV_SIGNAL_FOCUS, NULL); /*Focus again. Some object do something on navigate->edit change*/
|
||||
LV_LOG_INFO("Edit mode changed");
|
||||
@ -488,11 +481,11 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
if(focused) focused->signal_func(focused, LV_SIGNAL_GET_EDITABLE, &editable);
|
||||
|
||||
/*The button was released on a non-editable object. Just send enter*/
|
||||
if (!editable) {
|
||||
if(!editable) {
|
||||
lv_group_send_data(i->group, LV_GROUP_KEY_ENTER);
|
||||
}
|
||||
/*An object is being edited and the button is releases. Just send enter */
|
||||
else if (i->group->editing) {
|
||||
else if(i->group->editing) {
|
||||
if(!i->proc.long_pr_sent) lv_group_send_data(i->group, LV_GROUP_KEY_ENTER); /*Ignore long pressed enter release because it comes from mode switch*/
|
||||
}
|
||||
/*If the focused object is editable and now in navigate mode then enter edit mode*/
|
||||
@ -716,9 +709,9 @@ static void indev_proc_release(lv_indev_proc_t * proc)
|
||||
}
|
||||
|
||||
if(g != NULL && parent != NULL)
|
||||
if(lv_group_get_click_focus(g)) {
|
||||
lv_group_focus_obj(parent);
|
||||
}
|
||||
if(lv_group_get_click_focus(g)) {
|
||||
lv_group_focus_obj(parent);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -62,7 +62,7 @@ static lv_ll_t scr_ll; /*Linked list of screens*/
|
||||
*/
|
||||
void lv_init(void)
|
||||
{
|
||||
LV_LOG_TRACE("lv_init started");
|
||||
LV_LOG_TRACE("lv_init started");
|
||||
|
||||
/*Initialize the lv_misc modules*/
|
||||
lv_mem_init();
|
||||
@ -105,7 +105,7 @@ void lv_init(void)
|
||||
#endif
|
||||
|
||||
|
||||
LV_LOG_INFO("lv_init ready");
|
||||
LV_LOG_INFO("lv_init ready");
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
@ -119,13 +119,13 @@ void lv_init(void)
|
||||
* @param copy pointer to a base object, if not NULL then the new object will be copied from it
|
||||
* @return pointer to the new object
|
||||
*/
|
||||
lv_obj_t * lv_obj_create(lv_obj_t * parent,const lv_obj_t * copy)
|
||||
lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
{
|
||||
|
||||
lv_obj_t * new_obj = NULL;
|
||||
/*Create a screen if the parent is NULL*/
|
||||
if(parent == NULL) {
|
||||
LV_LOG_TRACE("Screen create started");
|
||||
LV_LOG_TRACE("Screen create started");
|
||||
|
||||
new_obj = lv_ll_ins_head(&scr_ll);
|
||||
lv_mem_assert(new_obj);
|
||||
@ -181,7 +181,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent,const lv_obj_t * copy)
|
||||
}
|
||||
/*parent != NULL create normal obj. on a parent*/
|
||||
else {
|
||||
LV_LOG_TRACE("Object create started");
|
||||
LV_LOG_TRACE("Object create started");
|
||||
|
||||
new_obj = lv_ll_ins_head(&(parent)->child_ll);
|
||||
lv_mem_assert(new_obj);
|
||||
@ -1099,8 +1099,8 @@ lv_obj_t * lv_layer_sys(void)
|
||||
*/
|
||||
lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj)
|
||||
{
|
||||
const lv_obj_t * par = obj;
|
||||
const lv_obj_t * act_p;
|
||||
const lv_obj_t * par = obj;
|
||||
const lv_obj_t * act_p;
|
||||
|
||||
do {
|
||||
act_p = par;
|
||||
@ -1377,7 +1377,7 @@ lv_opa_t lv_obj_get_opa_scale_enable(const lv_obj_t * obj)
|
||||
*/
|
||||
lv_opa_t lv_obj_get_opa_scale(const lv_obj_t * obj)
|
||||
{
|
||||
const lv_obj_t * parent = obj;
|
||||
const lv_obj_t * parent = obj;
|
||||
|
||||
while(parent) {
|
||||
if(parent->opa_scale_en) return parent->opa_scale;
|
||||
@ -1514,9 +1514,9 @@ void * lv_obj_get_group(const lv_obj_t * obj)
|
||||
*/
|
||||
bool lv_obj_is_focused(const lv_obj_t * obj)
|
||||
{
|
||||
if(obj->group_p) {
|
||||
if(lv_group_get_focused(obj->group_p) == obj) return true;
|
||||
}
|
||||
if(obj->group_p) {
|
||||
if(lv_group_get_focused(obj->group_p) == obj) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ static void lv_refr_task(void * param)
|
||||
{
|
||||
(void)param;
|
||||
|
||||
LV_LOG_TRACE("display refresh task started");
|
||||
LV_LOG_TRACE("display refresh task started");
|
||||
|
||||
uint32_t start = lv_tick_get();
|
||||
|
||||
@ -201,7 +201,7 @@ static void lv_refr_task(void * param)
|
||||
}
|
||||
}
|
||||
|
||||
LV_LOG_TRACE("display refresh task finished");
|
||||
LV_LOG_TRACE("display refresh task finished");
|
||||
}
|
||||
|
||||
|
||||
@ -308,25 +308,25 @@ static void lv_refr_area_with_vdb(const lv_area_t * area_p)
|
||||
|
||||
/*Round down the lines of VDB if rounding is added*/
|
||||
if(round_cb) {
|
||||
lv_area_t tmp;
|
||||
tmp.x1 = 0;
|
||||
tmp.x2 = 0;
|
||||
tmp.y1 = 0;
|
||||
tmp.y2 = max_row;
|
||||
lv_area_t tmp;
|
||||
tmp.x1 = 0;
|
||||
tmp.x2 = 0;
|
||||
tmp.y1 = 0;
|
||||
tmp.y2 = max_row;
|
||||
|
||||
lv_coord_t y_tmp = max_row;
|
||||
do {
|
||||
tmp.y2 = y_tmp;
|
||||
round_cb(&tmp);
|
||||
y_tmp --; /*Decrement the number of line until it is rounded to a smaller (or equal) value then the original. */
|
||||
} while(lv_area_get_height(&tmp) > max_row && y_tmp != 0);
|
||||
lv_coord_t y_tmp = max_row;
|
||||
do {
|
||||
tmp.y2 = y_tmp;
|
||||
round_cb(&tmp);
|
||||
y_tmp --; /*Decrement the number of line until it is rounded to a smaller (or equal) value then the original. */
|
||||
} while(lv_area_get_height(&tmp) > max_row && y_tmp != 0);
|
||||
|
||||
if(y_tmp == 0) {
|
||||
LV_LOG_WARN("Can't set VDB height using the round function. (Wrong round_cb or to small VDB)");
|
||||
return;
|
||||
} else {
|
||||
max_row = tmp.y2 + 1;
|
||||
}
|
||||
if(y_tmp == 0) {
|
||||
LV_LOG_WARN("Can't set VDB height using the round function. (Wrong round_cb or to small VDB)");
|
||||
return;
|
||||
} else {
|
||||
max_row = tmp.y2 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*Always use the full row*/
|
||||
@ -353,9 +353,9 @@ static void lv_refr_area_with_vdb(const lv_area_t * area_p)
|
||||
if(y2 != row_last) {
|
||||
lv_vdb_t * vdb_p = lv_vdb_get();
|
||||
if(!vdb_p) {
|
||||
LV_LOG_WARN("Invalid VDB pointer");
|
||||
return;
|
||||
}
|
||||
LV_LOG_WARN("Invalid VDB pointer");
|
||||
return;
|
||||
}
|
||||
|
||||
/*Calc. the next y coordinates of VDB*/
|
||||
vdb_p->area.x1 = area_p->x1;
|
||||
@ -376,9 +376,9 @@ static void lv_refr_area_part_vdb(const lv_area_t * area_p)
|
||||
{
|
||||
lv_vdb_t * vdb_p = lv_vdb_get();
|
||||
if(!vdb_p) {
|
||||
LV_LOG_WARN("Invalid VDB pointer");
|
||||
return;
|
||||
}
|
||||
LV_LOG_WARN("Invalid VDB pointer");
|
||||
return;
|
||||
}
|
||||
lv_obj_t * top_p;
|
||||
|
||||
/*Get the new mask from the original area and the act. VDB
|
||||
|
@ -217,54 +217,54 @@ void lv_style_copy(lv_style_t * dest, const lv_style_t * src)
|
||||
|
||||
/**
|
||||
* Mix two styles according to a given ratio
|
||||
* @param start start style
|
||||
* @param start start style
|
||||
* @param end end style
|
||||
* @param res store the result style here
|
||||
* @param ratio the ratio of mix [0..256]; 0: `start` style; 256: `end` style
|
||||
*/
|
||||
void lv_style_mix(const lv_style_t * start, const lv_style_t * end, lv_style_t * res, uint16_t ratio)
|
||||
{
|
||||
STYLE_ATTR_MIX(body.opa, ratio);
|
||||
STYLE_ATTR_MIX(body.radius, ratio);
|
||||
STYLE_ATTR_MIX(body.border.width, ratio);
|
||||
STYLE_ATTR_MIX(body.border.opa, ratio);
|
||||
STYLE_ATTR_MIX(body.shadow.width, ratio);
|
||||
STYLE_ATTR_MIX(body.padding.hor, ratio);
|
||||
STYLE_ATTR_MIX(body.padding.ver, ratio);
|
||||
STYLE_ATTR_MIX(body.padding.inner, ratio);
|
||||
STYLE_ATTR_MIX(text.line_space, ratio);
|
||||
STYLE_ATTR_MIX(text.letter_space, ratio);
|
||||
STYLE_ATTR_MIX(text.opa, ratio);
|
||||
STYLE_ATTR_MIX(line.width, ratio);
|
||||
STYLE_ATTR_MIX(line.opa, ratio);
|
||||
STYLE_ATTR_MIX(image.intense, ratio);
|
||||
STYLE_ATTR_MIX(image.opa, ratio);
|
||||
STYLE_ATTR_MIX(body.opa, ratio);
|
||||
STYLE_ATTR_MIX(body.radius, ratio);
|
||||
STYLE_ATTR_MIX(body.border.width, ratio);
|
||||
STYLE_ATTR_MIX(body.border.opa, ratio);
|
||||
STYLE_ATTR_MIX(body.shadow.width, ratio);
|
||||
STYLE_ATTR_MIX(body.padding.hor, ratio);
|
||||
STYLE_ATTR_MIX(body.padding.ver, ratio);
|
||||
STYLE_ATTR_MIX(body.padding.inner, ratio);
|
||||
STYLE_ATTR_MIX(text.line_space, ratio);
|
||||
STYLE_ATTR_MIX(text.letter_space, ratio);
|
||||
STYLE_ATTR_MIX(text.opa, ratio);
|
||||
STYLE_ATTR_MIX(line.width, ratio);
|
||||
STYLE_ATTR_MIX(line.opa, ratio);
|
||||
STYLE_ATTR_MIX(image.intense, ratio);
|
||||
STYLE_ATTR_MIX(image.opa, ratio);
|
||||
|
||||
lv_opa_t opa = ratio == STYLE_MIX_MAX ? LV_OPA_COVER : ratio;
|
||||
lv_opa_t opa = ratio == STYLE_MIX_MAX ? LV_OPA_COVER : ratio;
|
||||
|
||||
res->body.main_color = lv_color_mix(end->body.main_color, start->body.main_color, opa);
|
||||
res->body.grad_color = lv_color_mix(end->body.grad_color, start->body.grad_color, opa);
|
||||
res->body.border.color = lv_color_mix(end->body.border.color, start->body.border.color, opa);
|
||||
res->body.shadow.color = lv_color_mix(end->body.shadow.color, start->body.shadow.color, opa);
|
||||
res->text.color = lv_color_mix(end->text.color, start->text.color, opa);
|
||||
res->image.color = lv_color_mix(end->image.color, start->image.color, opa);
|
||||
res->line.color = lv_color_mix(end->line.color, start->line.color, opa);
|
||||
res->body.main_color = lv_color_mix(end->body.main_color, start->body.main_color, opa);
|
||||
res->body.grad_color = lv_color_mix(end->body.grad_color, start->body.grad_color, opa);
|
||||
res->body.border.color = lv_color_mix(end->body.border.color, start->body.border.color, opa);
|
||||
res->body.shadow.color = lv_color_mix(end->body.shadow.color, start->body.shadow.color, opa);
|
||||
res->text.color = lv_color_mix(end->text.color, start->text.color, opa);
|
||||
res->image.color = lv_color_mix(end->image.color, start->image.color, opa);
|
||||
res->line.color = lv_color_mix(end->line.color, start->line.color, opa);
|
||||
|
||||
if(ratio < (STYLE_MIX_MAX >> 1)) {
|
||||
res->body.empty = start->body.empty;
|
||||
res->body.border.part = start->body.border.part;
|
||||
res->glass = start->glass;
|
||||
res->text.font = start->text.font;
|
||||
res->body.shadow.type = start->body.shadow.type;
|
||||
if(ratio < (STYLE_MIX_MAX >> 1)) {
|
||||
res->body.empty = start->body.empty;
|
||||
res->body.border.part = start->body.border.part;
|
||||
res->glass = start->glass;
|
||||
res->text.font = start->text.font;
|
||||
res->body.shadow.type = start->body.shadow.type;
|
||||
res->line.rounded = start->line.rounded;
|
||||
} else {
|
||||
res->body.empty = end->body.empty;
|
||||
res->body.border.part = end->body.border.part;
|
||||
res->glass = end->glass;
|
||||
res->text.font = end->text.font;
|
||||
res->body.shadow.type = end->body.shadow.type;
|
||||
} else {
|
||||
res->body.empty = end->body.empty;
|
||||
res->body.border.part = end->body.border.part;
|
||||
res->glass = end->glass;
|
||||
res->text.font = end->text.font;
|
||||
res->body.shadow.type = end->body.shadow.type;
|
||||
res->line.rounded = end->line.rounded;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_LV_ANIMATION
|
||||
|
@ -152,7 +152,7 @@ void lv_style_copy(lv_style_t * dest, const lv_style_t * src);
|
||||
|
||||
/**
|
||||
* Mix two styles according to a given ratio
|
||||
* @param start start style
|
||||
* @param start start style
|
||||
* @param end end style
|
||||
* @param res store the result style here
|
||||
* @param ratio the ratio of mix [0..256]; 0: `start` style; 256: `end` style
|
||||
|
@ -21,9 +21,9 @@
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
enum {
|
||||
LV_VDB_STATE_FREE = 0, /*Not used*/
|
||||
LV_VDB_STATE_ACTIVE, /*Being used to render*/
|
||||
LV_VDB_STATE_FLUSH, /*Flushing pixels from it*/
|
||||
LV_VDB_STATE_FREE = 0, /*Not used*/
|
||||
LV_VDB_STATE_ACTIVE, /*Being used to render*/
|
||||
LV_VDB_STATE_FLUSH, /*Flushing pixels from it*/
|
||||
};
|
||||
typedef uint8_t lv_vdb_state_t;
|
||||
|
||||
@ -41,12 +41,12 @@ static volatile lv_vdb_state_t vdb_state = LV_VDB_STATE_ACTIVE;
|
||||
# if LV_VDB_ADR == 0
|
||||
/*If the buffer address is not specified simply allocate it*/
|
||||
static uint8_t vdb_buf[LV_VDB_SIZE_IN_BYTES];
|
||||
static lv_vdb_t vdb = {.buf = (lv_color_t*)vdb_buf};
|
||||
# else /*LV_VDB_ADR != 0*/
|
||||
static lv_vdb_t vdb = {.buf = (lv_color_t *)vdb_buf};
|
||||
# else /*LV_VDB_ADR != 0*/
|
||||
/*If the buffer address is specified use that address*/
|
||||
static lv_vdb_t vdb = {.buf = (lv_color_t *)LV_VDB_ADR};
|
||||
# endif
|
||||
#else /*LV_VDB_DOUBLE != 0*/
|
||||
#else /*LV_VDB_DOUBLE != 0*/
|
||||
/*Double VDB*/
|
||||
static volatile lv_vdb_state_t vdb_state[2] = {LV_VDB_STATE_FREE, LV_VDB_STATE_FREE};
|
||||
# if LV_VDB_ADR == 0
|
||||
@ -54,7 +54,7 @@ static volatile lv_vdb_state_t vdb_state[2] = {LV_VDB_STATE_FREE, LV_VDB_STATE_F
|
||||
static uint8_t vdb_buf1[LV_VDB_SIZE_IN_BYTES];
|
||||
static uint8_t vdb_buf2[LV_VDB_SIZE_IN_BYTES];
|
||||
static lv_vdb_t vdb[2] = {{.buf = (lv_color_t *) vdb_buf1}, {.buf = (lv_color_t *) vdb_buf2}};
|
||||
# else /*LV_VDB_ADR != 0*/
|
||||
# else /*LV_VDB_ADR != 0*/
|
||||
/*If the buffer address is specified use that address*/
|
||||
static lv_vdb_t vdb[2] = {{.buf = (lv_color_t *)LV_VDB_ADR}, {.buf = (lv_color_t *)LV_VDB2_ADR}};
|
||||
# endif
|
||||
@ -79,7 +79,7 @@ lv_vdb_t * lv_vdb_get(void)
|
||||
* user call of 'lv_flush_ready()' in display drivers's flush function*/
|
||||
while(vdb_state != LV_VDB_STATE_ACTIVE);
|
||||
|
||||
if(vdb.buf == (void*)LV_VDB_ADR_INV) {
|
||||
if(vdb.buf == (void *)LV_VDB_ADR_INV) {
|
||||
LV_LOG_ERROR("VDB address is invalid. Use `lv_vdb_set_adr` to set a valid address or use LV_VDB_ADR = 0 in lv_conf.h");
|
||||
return NULL;
|
||||
}
|
||||
@ -111,9 +111,9 @@ void lv_vdb_flush(void)
|
||||
{
|
||||
lv_vdb_t * vdb_act = lv_vdb_get();
|
||||
if(!vdb_act) {
|
||||
LV_LOG_WARN("Invalid VDB pointer");
|
||||
return;
|
||||
}
|
||||
LV_LOG_WARN("Invalid VDB pointer");
|
||||
return;
|
||||
}
|
||||
#if LV_VDB_DOUBLE == 0
|
||||
vdb_state = LV_VDB_STATE_FLUSH; /*User call to 'lv_flush_ready()' will set to ACTIVE 'disp_flush'*/
|
||||
#else
|
||||
|
@ -38,15 +38,15 @@ void (*const px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color
|
||||
void (*const fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_vfill;
|
||||
void (*const letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_vletter;
|
||||
void (*const map_fp)(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_vmap;
|
||||
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_vmap;
|
||||
#else
|
||||
void (*const px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_rpx;
|
||||
void (*const fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_rfill;
|
||||
void (*const letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_rletter;
|
||||
void (*const map_fp)(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_rmap;
|
||||
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_rmap;
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
|
@ -92,8 +92,8 @@ extern void (*const px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, l
|
||||
extern void (*const fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa);
|
||||
extern void (*const letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa);
|
||||
extern void (*const map_fp)(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);
|
||||
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
|
||||
lv_color_t recolor, lv_opa_t recolor_opa);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
@ -372,8 +372,8 @@ static const uint8_t * lv_img_decoder_open(const void * src, const lv_style_t *
|
||||
return LV_IMG_DECODER_OPEN_FAIL;
|
||||
}
|
||||
#else
|
||||
LV_LOG_WARN("Image built-in decoder can read file because USE_LV_FILESYSTEM = 0");
|
||||
return LV_IMG_DECODER_OPEN_FAIL;
|
||||
LV_LOG_WARN("Image built-in decoder can read file because USE_LV_FILESYSTEM = 0");
|
||||
return LV_IMG_DECODER_OPEN_FAIL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -28,38 +28,38 @@ struct _lv_img_t;
|
||||
|
||||
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 always_zero :3; /*It the upper bits of the first byte. Always zero to look like a non-printable character*/
|
||||
/* 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 always_zero :3; /*It the upper bits of the first byte. Always zero to look like a non-printable character*/
|
||||
|
||||
uint32_t reserved :2; /*Reserved to be used later*/
|
||||
uint32_t reserved :2; /*Reserved to be used later*/
|
||||
|
||||
uint32_t w:11; /*Width of the image map*/
|
||||
uint32_t h:11; /*Height of the image map*/
|
||||
}lv_img_header_t;
|
||||
uint32_t w:11; /*Width of the image map*/
|
||||
uint32_t h:11; /*Height of the image map*/
|
||||
} lv_img_header_t;
|
||||
|
||||
/*Image color format*/
|
||||
enum {
|
||||
LV_IMG_CF_UNKOWN = 0,
|
||||
|
||||
LV_IMG_CF_RAW, /*Contains the file as it is. Needs custom decoder function*/
|
||||
LV_IMG_CF_RAW, /*Contains the file as it is. Needs custom decoder function*/
|
||||
LV_IMG_CF_RAW_ALPHA, /*Contains the file as it is. The image has alpha. Needs custom decoder function*/
|
||||
LV_IMG_CF_RAW_CHROMA_KEYED, /*Contains the file as it is. The image is chroma keyed. Needs custom decoder function*/
|
||||
|
||||
LV_IMG_CF_TRUE_COLOR, /*Color format and depth should match with LV_COLOR settings*/
|
||||
LV_IMG_CF_TRUE_COLOR_ALPHA, /*Same as `LV_IMG_CF_TRUE_COLOR` but every pixel has an alpha byte*/
|
||||
LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, /*Same as `LV_IMG_CF_TRUE_COLOR` but LV_COLOR_TRANSP pixels will be transparent*/
|
||||
LV_IMG_CF_TRUE_COLOR, /*Color format and depth should match with LV_COLOR settings*/
|
||||
LV_IMG_CF_TRUE_COLOR_ALPHA, /*Same as `LV_IMG_CF_TRUE_COLOR` but every pixel has an alpha byte*/
|
||||
LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, /*Same as `LV_IMG_CF_TRUE_COLOR` but LV_COLOR_TRANSP pixels will be transparent*/
|
||||
|
||||
LV_IMG_CF_INDEXED_1BIT, /*Can have 2 different colors in a palette (always chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_2BIT, /*Can have 4 different colors in a palette (always chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_4BIT, /*Can have 16 different colors in a palette (always chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_8BIT, /*Can have 256 different colors in a palette (always chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_1BIT, /*Can have 2 different colors in a palette (always chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_2BIT, /*Can have 4 different colors in a palette (always chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_4BIT, /*Can have 16 different colors in a palette (always chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_8BIT, /*Can have 256 different colors in a palette (always chroma keyed)*/
|
||||
|
||||
LV_IMG_CF_ALPHA_1BIT, /*Can have one color and it can be drawn or not*/
|
||||
LV_IMG_CF_ALPHA_2BIT, /*Can have one color but 4 different alpha value*/
|
||||
LV_IMG_CF_ALPHA_4BIT, /*Can have one color but 16 different alpha value*/
|
||||
LV_IMG_CF_ALPHA_8BIT, /*Can have one color but 256 different alpha value*/
|
||||
LV_IMG_CF_ALPHA_1BIT, /*Can have one color and it can be drawn or not*/
|
||||
LV_IMG_CF_ALPHA_2BIT, /*Can have one color but 4 different alpha value*/
|
||||
LV_IMG_CF_ALPHA_4BIT, /*Can have one color but 16 different alpha value*/
|
||||
LV_IMG_CF_ALPHA_8BIT, /*Can have one color but 256 different alpha value*/
|
||||
};
|
||||
typedef uint8_t lv_img_cf_t;
|
||||
|
||||
@ -67,8 +67,8 @@ typedef uint8_t lv_img_cf_t;
|
||||
* the result image converter utility*/
|
||||
typedef struct
|
||||
{
|
||||
lv_img_header_t header;
|
||||
uint32_t data_size;
|
||||
lv_img_header_t header;
|
||||
uint32_t data_size;
|
||||
const uint8_t * data;
|
||||
} lv_img_dsc_t;
|
||||
|
||||
@ -144,7 +144,7 @@ lv_img_src_t lv_img_src_get_type(const void * src);
|
||||
* @param close_fp clode function
|
||||
*/
|
||||
void lv_img_decoder_set_custom(lv_img_decoder_info_f_t info_fp, lv_img_decoder_open_f_t open_fp,
|
||||
lv_img_decoder_read_line_f_t read_fp, lv_img_decoder_close_f_t close_fp);
|
||||
lv_img_decoder_read_line_f_t read_fp, lv_img_decoder_close_f_t close_fp);
|
||||
|
||||
lv_res_t lv_img_dsc_get_info(const char * src, lv_img_header_t * header);
|
||||
|
||||
|
@ -80,17 +80,17 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
|
||||
|
||||
/*Align to middle*/
|
||||
if(flag & LV_TXT_FLAG_CENTER) {
|
||||
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
|
||||
font, style->text.letter_space, flag);
|
||||
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
|
||||
font, style->text.letter_space, flag);
|
||||
|
||||
pos.x += (lv_area_get_width(coords) - line_width) / 2;
|
||||
pos.x += (lv_area_get_width(coords) - line_width) / 2;
|
||||
|
||||
}
|
||||
/*Align to the right*/
|
||||
else if(flag & LV_TXT_FLAG_RIGHT) {
|
||||
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
|
||||
font, style->text.letter_space, flag);
|
||||
pos.x += lv_area_get_width(coords) - line_width;
|
||||
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
|
||||
font, style->text.letter_space, flag);
|
||||
pos.x += lv_area_get_width(coords) - line_width;
|
||||
}
|
||||
|
||||
|
||||
@ -180,16 +180,16 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
|
||||
/*Align to middle*/
|
||||
if(flag & LV_TXT_FLAG_CENTER) {
|
||||
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
|
||||
font, style->text.letter_space, flag);
|
||||
font, style->text.letter_space, flag);
|
||||
|
||||
pos.x += (lv_area_get_width(coords) - line_width) / 2;
|
||||
pos.x += (lv_area_get_width(coords) - line_width) / 2;
|
||||
|
||||
}
|
||||
/*Align to the right*/
|
||||
else if(flag & LV_TXT_FLAG_RIGHT) {
|
||||
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
|
||||
font, style->text.letter_space, flag);
|
||||
pos.x += lv_area_get_width(coords) - line_width;
|
||||
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
|
||||
font, style->text.letter_space, flag);
|
||||
pos.x += lv_area_get_width(coords) - line_width;
|
||||
}
|
||||
|
||||
/*Go the next line position*/
|
||||
|
@ -343,7 +343,7 @@ static void line_draw_skew(line_draw_t * main_line, const lv_area_t * mask, cons
|
||||
lv_draw_aa_hor_seg(main_line->p1.x + pattern[aa_last_corner].x, main_line->p1.y + pattern[aa_last_corner].y - 1,
|
||||
seg_w + main_line->sx, mask, style->line.color, opa);
|
||||
|
||||
lv_draw_aa_hor_seg(main_line->p2.x + pattern[aa_last_corner].x , main_line->p2.y + pattern[aa_last_corner].y + 1,
|
||||
lv_draw_aa_hor_seg(main_line->p2.x + pattern[aa_last_corner].x, main_line->p2.y + pattern[aa_last_corner].y + 1,
|
||||
-(seg_w + main_line->sx), mask, style->line.color, opa);
|
||||
}
|
||||
|
||||
@ -395,7 +395,7 @@ static void line_draw_skew(line_draw_t * main_line, const lv_area_t * mask, cons
|
||||
/* Fill the gaps
|
||||
* When stepping in y one pixel remains empty on every corner (don't do this on the first segment ) */
|
||||
if(i != 0 && pattern[i].x != pattern[i - 1].x && !first_run) {
|
||||
px_fp(draw_area.x1 , draw_area.y1 - main_line->sy, mask, style->line.color, opa);
|
||||
px_fp(draw_area.x1, draw_area.y1 - main_line->sy, mask, style->line.color, opa);
|
||||
}
|
||||
}
|
||||
|
||||
@ -417,7 +417,7 @@ static void line_draw_skew(line_draw_t * main_line, const lv_area_t * mask, cons
|
||||
draw_area.y1 = prev_p.y + pattern[i].y;
|
||||
draw_area.x2 = draw_area.x1 + main_line->p_act.x - prev_p.x;
|
||||
draw_area.y2 = draw_area.y1;
|
||||
fill_fp(&draw_area, mask, style->line.color , opa);
|
||||
fill_fp(&draw_area, mask, style->line.color, opa);
|
||||
|
||||
/* Fill the gaps
|
||||
* When stepping in y one pixel remains empty on every corner */
|
||||
|
@ -1064,15 +1064,15 @@ static void lv_draw_shadow(const lv_area_t * coords, const lv_area_t * mask, con
|
||||
static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale)
|
||||
{
|
||||
|
||||
/* KNOWN ISSUE
|
||||
* The algorithm calculates the shadow only above the middle point of the radius (speaking about the left top corner).
|
||||
* It causes an error because it doesn't consider how long the straight edge is which effects the value of bottom of the corner shadow.
|
||||
* In addition the straight shadow is drawn from the middles point of the radius however
|
||||
* the ends of the straight parts still should be effected by the corner shadow.
|
||||
* It also causes an issue in opacity. A smaller radius means smaller average shadow opacity.
|
||||
* The solution should be to start `line` from `- swidth` and handle if the straight part is short (or zero) and the value is taken from
|
||||
* the other corner. `col` also should start from `- swidth`
|
||||
*/
|
||||
/* KNOWN ISSUE
|
||||
* The algorithm calculates the shadow only above the middle point of the radius (speaking about the left top corner).
|
||||
* It causes an error because it doesn't consider how long the straight edge is which effects the value of bottom of the corner shadow.
|
||||
* In addition the straight shadow is drawn from the middles point of the radius however
|
||||
* the ends of the straight parts still should be effected by the corner shadow.
|
||||
* It also causes an issue in opacity. A smaller radius means smaller average shadow opacity.
|
||||
* The solution should be to start `line` from `- swidth` and handle if the straight part is short (or zero) and the value is taken from
|
||||
* the other corner. `col` also should start from `- swidth`
|
||||
*/
|
||||
|
||||
|
||||
lv_coord_t radius = style->body.radius;
|
||||
@ -1203,19 +1203,19 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
|
||||
for(d = 1; d < col; d++) {
|
||||
|
||||
if(point_lt.x < ofs_lt.x && point_lt.y < ofs_lt.y) {
|
||||
px_fp(point_lt.x, point_lt.y , mask, style->body.shadow.color, line_2d_blur[d]);
|
||||
px_fp(point_lt.x, point_lt.y, mask, style->body.shadow.color, line_2d_blur[d]);
|
||||
}
|
||||
|
||||
if(point_lb.x < ofs_lb.x && point_lb.y > ofs_lb.y) {
|
||||
px_fp(point_lb.x, point_lb.y , mask, style->body.shadow.color, line_2d_blur[d]);
|
||||
px_fp(point_lb.x, point_lb.y, mask, style->body.shadow.color, line_2d_blur[d]);
|
||||
}
|
||||
|
||||
if(point_rt.x > ofs_rt.x && point_rt.y < ofs_rt.y) {
|
||||
px_fp(point_rt.x, point_rt.y , mask, style->body.shadow.color, line_2d_blur[d]);
|
||||
px_fp(point_rt.x, point_rt.y, mask, style->body.shadow.color, line_2d_blur[d]);
|
||||
}
|
||||
|
||||
if(point_rb.x > ofs_rb.x && point_rb.y > ofs_rb.y) {
|
||||
px_fp(point_rb.x, point_rb.y , mask, style->body.shadow.color, line_2d_blur[d]);
|
||||
px_fp(point_rb.x, point_rb.y, mask, style->body.shadow.color, line_2d_blur[d]);
|
||||
}
|
||||
|
||||
point_rb.x++;
|
||||
|
@ -71,9 +71,9 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
|
||||
|
||||
lv_vdb_t * vdb_p = lv_vdb_get();
|
||||
if(!vdb_p) {
|
||||
LV_LOG_WARN("Invalid VDB pointer");
|
||||
return;
|
||||
}
|
||||
LV_LOG_WARN("Invalid VDB pointer");
|
||||
return;
|
||||
}
|
||||
|
||||
/*Pixel out of the mask*/
|
||||
if(x < mask_p->x1 || x > mask_p->x2 ||
|
||||
@ -122,9 +122,9 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
|
||||
bool union_ok;
|
||||
lv_vdb_t * vdb_p = lv_vdb_get();
|
||||
if(!vdb_p) {
|
||||
LV_LOG_WARN("Invalid VDB pointer");
|
||||
return;
|
||||
}
|
||||
LV_LOG_WARN("Invalid VDB pointer");
|
||||
return;
|
||||
}
|
||||
|
||||
/*Get the union of cord and mask*/
|
||||
/* The mask is already truncated to the vdb size
|
||||
@ -672,7 +672,7 @@ static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa,
|
||||
return bg_color;
|
||||
}
|
||||
/*Opaque background: use simple mix*/
|
||||
else if (bg_opa >= LV_OPA_MAX) {
|
||||
else if(bg_opa >= LV_OPA_MAX) {
|
||||
return lv_color_mix(fg_color, bg_color, fg_opa);
|
||||
}
|
||||
/*Both colors have alpha. Expensive calculation need to be applied*/
|
||||
|
@ -5373,7 +5373,7 @@ lv_font_t lv_font_dejavu_10 = {
|
||||
#elif USE_LV_FONT_DEJAVU_10 == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -3637,7 +3637,7 @@ lv_font_t lv_font_dejavu_10_cyrillic = {
|
||||
#elif USE_LV_FONT_DEJAVU_10_CYRILLIC == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -5429,7 +5429,7 @@ lv_font_t lv_font_dejavu_10_latin_sup = {
|
||||
#elif USE_LV_FONT_DEJAVU_10_LATIN_SUP == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -9173,7 +9173,7 @@ lv_font_t lv_font_dejavu_20 = {
|
||||
#elif USE_LV_FONT_DEJAVU_20 == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -6197,7 +6197,7 @@ lv_font_t lv_font_dejavu_20_cyrillic = {
|
||||
#elif USE_LV_FONT_DEJAVU_20_CYRILLIC == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -9269,7 +9269,7 @@ lv_font_t lv_font_dejavu_20_latin_sup = {
|
||||
#elif USE_LV_FONT_DEJAVU_20_LATIN_SUP == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -12973,7 +12973,7 @@ lv_font_t lv_font_dejavu_30 = {
|
||||
#elif USE_LV_FONT_DEJAVU_30 == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -8757,7 +8757,7 @@ lv_font_t lv_font_dejavu_30_cyrillic = {
|
||||
#elif USE_LV_FONT_DEJAVU_30_CYRILLIC == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -13109,7 +13109,7 @@ lv_font_t lv_font_dejavu_30_latin_sup = {
|
||||
#elif USE_LV_FONT_DEJAVU_30_LATIN_SUP == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -16773,7 +16773,7 @@ lv_font_t lv_font_dejavu_40 = {
|
||||
#elif USE_LV_FONT_DEJAVU_40 == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -16949,7 +16949,7 @@ lv_font_t lv_font_dejavu_40_latin_sup = {
|
||||
#elif USE_LV_FONT_DEJAVU_40_LATIN_SUP == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2859,7 +2859,7 @@ lv_font_t lv_font_symbol_10 = {
|
||||
#elif USE_LV_FONT_SYMBOL_10 == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -4859,7 +4859,7 @@ lv_font_t lv_font_symbol_20 = {
|
||||
#elif USE_LV_FONT_SYMBOL_20 == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -6858,7 +6858,7 @@ lv_font_t lv_font_symbol_30 = {
|
||||
#elif USE_LV_FONT_SYMBOL_30 == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -8859,7 +8859,7 @@ lv_font_t lv_font_symbol_40 = {
|
||||
#elif USE_LV_FONT_SYMBOL_40 == 8
|
||||
.bpp = 8, /*Bit per pixel*/
|
||||
#endif
|
||||
.monospace = 0,
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -154,12 +154,12 @@ void lv_disp_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t *
|
||||
if(active == NULL) return;
|
||||
if(active->driver.disp_flush != NULL) {
|
||||
|
||||
LV_LOG_TRACE("disp flush started");
|
||||
active->driver.disp_flush(x1, y1, x2, y2, color_p);
|
||||
LV_LOG_TRACE("disp flush ready");
|
||||
LV_LOG_TRACE("disp flush started");
|
||||
active->driver.disp_flush(x1, y1, x2, y2, color_p);
|
||||
LV_LOG_TRACE("disp flush ready");
|
||||
|
||||
} else {
|
||||
LV_LOG_WARN("disp flush function registered");
|
||||
LV_LOG_WARN("disp flush function registered");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,11 +112,11 @@ bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
|
||||
if(indev->driver.read) {
|
||||
data->user_data = indev->driver.user_data;
|
||||
|
||||
LV_LOG_TRACE("idnev read started");
|
||||
LV_LOG_TRACE("idnev read started");
|
||||
cont = indev->driver.read(data);
|
||||
LV_LOG_TRACE("idnev read finished");
|
||||
LV_LOG_TRACE("idnev read finished");
|
||||
} else {
|
||||
LV_LOG_WARN("indev function registered");
|
||||
LV_LOG_WARN("indev function registered");
|
||||
memset(data, 0, sizeof(lv_indev_data_t));
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ void lv_anim_init(void)
|
||||
*/
|
||||
void lv_anim_create(lv_anim_t * anim_p)
|
||||
{
|
||||
LV_LOG_TRACE("animation create started")
|
||||
LV_LOG_TRACE("animation create started")
|
||||
/* Do not let two animations for the same 'var' with the same 'fp'*/
|
||||
if(anim_p->fp != NULL) lv_anim_del(anim_p->var, anim_p->fp); /*fp == NULL would delete all animations of var*/
|
||||
|
||||
@ -82,7 +82,7 @@ void lv_anim_create(lv_anim_t * anim_p)
|
||||
* It's important if it happens in a ready callback. (see `anim_task`)*/
|
||||
anim_list_changed = true;
|
||||
|
||||
LV_LOG_TRACE("animation created")
|
||||
LV_LOG_TRACE("animation created")
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,7 +105,7 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp)
|
||||
if(a->var == var && (a->fp == fp || fp == NULL)) {
|
||||
lv_ll_rem(&anim_ll, a);
|
||||
lv_mem_free(a);
|
||||
anim_list_changed = true; /*Read by `anim_task`. It need to know if a delete occurred in the linked list*/
|
||||
anim_list_changed = true; /*Read by `anim_task`. It need to know if a delete occurred in the linked list*/
|
||||
del = true;
|
||||
}
|
||||
|
||||
@ -209,40 +209,40 @@ static void anim_task(void * param)
|
||||
|
||||
lv_anim_t * a;
|
||||
LL_READ(anim_ll, a) {
|
||||
a->has_run = 0;
|
||||
a->has_run = 0;
|
||||
}
|
||||
|
||||
uint32_t elaps = lv_tick_elaps(last_task_run);
|
||||
a = lv_ll_get_head(&anim_ll);
|
||||
|
||||
while(a != NULL) {
|
||||
/*It can be set by `lv_anim_del()` typically in `end_cb`. If set then an animation delete happened in `anim_ready_handler`
|
||||
* which could make this linked list reading corrupt because the list is changed meanwhile
|
||||
*/
|
||||
anim_list_changed = false;
|
||||
/*It can be set by `lv_anim_del()` typically in `end_cb`. If set then an animation delete happened in `anim_ready_handler`
|
||||
* which could make this linked list reading corrupt because the list is changed meanwhile
|
||||
*/
|
||||
anim_list_changed = false;
|
||||
|
||||
if(!a->has_run) {
|
||||
a->has_run = 1; /*The list readying might be reseted so need to know which anim has run already*/
|
||||
a->act_time += elaps;
|
||||
if(a->act_time >= 0) {
|
||||
if(a->act_time > a->time) a->act_time = a->time;
|
||||
if(!a->has_run) {
|
||||
a->has_run = 1; /*The list readying might be reseted so need to know which anim has run already*/
|
||||
a->act_time += elaps;
|
||||
if(a->act_time >= 0) {
|
||||
if(a->act_time > a->time) a->act_time = a->time;
|
||||
|
||||
int32_t new_value;
|
||||
new_value = a->path(a);
|
||||
int32_t new_value;
|
||||
new_value = a->path(a);
|
||||
|
||||
if(a->fp != NULL) a->fp(a->var, new_value); /*Apply the calculated value*/
|
||||
if(a->fp != NULL) a->fp(a->var, new_value); /*Apply the calculated value*/
|
||||
|
||||
/*If the time is elapsed the animation is ready*/
|
||||
if(a->act_time >= a->time) {
|
||||
anim_ready_handler(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*If the time is elapsed the animation is ready*/
|
||||
if(a->act_time >= a->time) {
|
||||
anim_ready_handler(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If the linked list changed due to anim. delete then it's not safe to continue
|
||||
* the reading of the list from here -> start from the head*/
|
||||
if(anim_list_changed) a = lv_ll_get_head(&anim_ll);
|
||||
else a = lv_ll_get_next(&anim_ll, a);
|
||||
/* If the linked list changed due to anim. delete then it's not safe to continue
|
||||
* the reading of the list from here -> start from the head*/
|
||||
if(anim_list_changed) a = lv_ll_get_head(&anim_ll);
|
||||
else a = lv_ll_get_next(&anim_ll, a);
|
||||
}
|
||||
|
||||
last_task_run = lv_tick_get();
|
||||
|
@ -56,7 +56,7 @@ typedef struct _lv_anim_t
|
||||
uint8_t repeat :1; /*Repeat the animation infinitely*/
|
||||
/*Animation system use these - user shouldn't set*/
|
||||
uint8_t playback_now :1; /*Play back is in progress*/
|
||||
uint32_t has_run :1; /*Indicates the animation has run it this round*/
|
||||
uint32_t has_run :1; /*Indicates the animation has run it this round*/
|
||||
} lv_anim_t;
|
||||
|
||||
/*Example initialization
|
||||
|
@ -71,17 +71,17 @@ extern "C" {
|
||||
#define LV_OPA_100 255
|
||||
#define LV_OPA_COVER 255
|
||||
|
||||
#define LV_OPA_MIN 16 /*Opacities below this will be transparent*/
|
||||
#define LV_OPA_MAX 251 /*Opacities above this will fully cover*/
|
||||
#define LV_OPA_MIN 16 /*Opacities below this will be transparent*/
|
||||
#define LV_OPA_MAX 251 /*Opacities above this will fully cover*/
|
||||
|
||||
#if LV_COLOR_DEPTH == 1
|
||||
#define LV_COLOR_SIZE 8
|
||||
#define LV_COLOR_SIZE 8
|
||||
#elif LV_COLOR_DEPTH == 8
|
||||
#define LV_COLOR_SIZE 8
|
||||
#define LV_COLOR_SIZE 8
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
#define LV_COLOR_SIZE 16
|
||||
#define LV_COLOR_SIZE 16
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
#define LV_COLOR_SIZE 32
|
||||
#define LV_COLOR_SIZE 32
|
||||
#else
|
||||
#error "Invalid LV_COLOR_DEPTH in lv_conf.h! Set it to 1, 8, 16 or 32!"
|
||||
#endif
|
||||
@ -201,10 +201,10 @@ static inline uint8_t lv_color_to1(lv_color_t color)
|
||||
(color.blue & 0x10)) {
|
||||
return 1;
|
||||
# else
|
||||
if((color.red & 0x10) ||
|
||||
(color.green_h & 0x20) ||
|
||||
(color.blue & 0x10)) {
|
||||
return 1;
|
||||
if((color.red & 0x10) ||
|
||||
(color.green_h & 0x20) ||
|
||||
(color.blue & 0x10)) {
|
||||
return 1;
|
||||
# endif
|
||||
} else {
|
||||
return 0;
|
||||
@ -238,7 +238,7 @@ static inline uint8_t lv_color_to8(lv_color_t color)
|
||||
# else
|
||||
lv_color8_t ret;
|
||||
ret.red = color.red >> 2; /* 5 - 3 = 2*/
|
||||
ret.green = color.green_h; /* 6 - 3 = 3*/
|
||||
ret.green = color.green_h; /* 6 - 3 = 3*/
|
||||
ret.blue = color.blue >> 3; /* 5 - 2 = 3*/
|
||||
return ret.full;
|
||||
# endif
|
||||
@ -310,9 +310,9 @@ static inline uint32_t lv_color_to32(lv_color_t color)
|
||||
return ret.full;
|
||||
# else
|
||||
lv_color32_t ret;
|
||||
ret.red = color.red * 8; /*(2^8 - 1)/(2^5 - 1) = 255/31 = 8*/
|
||||
ret.green = ((color.green_h << 3) + color.green_l) * 4; /*(2^8 - 1)/(2^6 - 1) = 255/63 = 4*/
|
||||
ret.blue = color.blue * 8; /*(2^8 - 1)/(2^5 - 1) = 255/31 = 8*/
|
||||
ret.red = color.red * 8; /*(2^8 - 1)/(2^5 - 1) = 255/31 = 8*/
|
||||
ret.green = ((color.green_h << 3) + color.green_l) * 4; /*(2^8 - 1)/(2^6 - 1) = 255/63 = 4*/
|
||||
ret.blue = color.blue * 8; /*(2^8 - 1)/(2^5 - 1) = 255/31 = 8*/
|
||||
ret.alpha = 0xFF;
|
||||
return ret.full;
|
||||
# endif
|
||||
|
@ -43,7 +43,7 @@
|
||||
*/
|
||||
void lv_font_init(void)
|
||||
{
|
||||
lv_font_builtin_init();
|
||||
lv_font_builtin_init();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,20 +72,20 @@ void lv_font_add(lv_font_t * child, lv_font_t * parent)
|
||||
*/
|
||||
bool lv_font_is_monospace(const lv_font_t * font_p, uint32_t letter)
|
||||
{
|
||||
const lv_font_t * font_i = font_p;
|
||||
int16_t w;
|
||||
while(font_i != NULL) {
|
||||
w = font_i->get_width(font_i, letter);
|
||||
if(w >= 0) {
|
||||
/*Glyph found*/
|
||||
if(font_i->monospace) return true;
|
||||
return false;
|
||||
const lv_font_t * font_i = font_p;
|
||||
int16_t w;
|
||||
while(font_i != NULL) {
|
||||
w = font_i->get_width(font_i, letter);
|
||||
if(w >= 0) {
|
||||
/*Glyph found*/
|
||||
if(font_i->monospace) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
font_i = font_i->next_page;
|
||||
}
|
||||
|
||||
font_i = font_i->next_page;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -120,10 +120,10 @@ uint8_t lv_font_get_width(const lv_font_t * font_p, uint32_t letter)
|
||||
while(font_i != NULL) {
|
||||
w = font_i->get_width(font_i, letter);
|
||||
if(w >= 0) {
|
||||
/*Glyph found*/
|
||||
uint8_t m = font_i->monospace;
|
||||
if(m) w = m;
|
||||
return w;
|
||||
/*Glyph found*/
|
||||
uint8_t m = font_i->monospace;
|
||||
if(m) w = m;
|
||||
return w;
|
||||
}
|
||||
|
||||
font_i = font_i->next_page;
|
||||
|
@ -57,8 +57,8 @@ typedef struct _lv_font_struct
|
||||
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 h_px :8;
|
||||
uint32_t bpp :4; /*Bit per pixel: 1, 2 or 4*/
|
||||
uint32_t monospace :8; /*Fix width (0: normal width)*/
|
||||
uint32_t bpp :4; /*Bit per pixel: 1, 2 or 4*/
|
||||
uint32_t monospace :8; /*Fix width (0: normal width)*/
|
||||
uint16_t glyph_cnt; /*Number of glyphs (letters) in the font*/
|
||||
} lv_font_t;
|
||||
|
||||
|
@ -82,7 +82,7 @@ lv_fs_res_t lv_fs_open(lv_fs_file_t * file_p, const char * path, lv_fs_mode_t mo
|
||||
}
|
||||
|
||||
file_p->file_d = lv_mem_alloc(file_p->drv->file_size);
|
||||
lv_mem_assert(file_p->file_d);
|
||||
lv_mem_assert(file_p->file_d);
|
||||
if(file_p->file_d == NULL) {
|
||||
file_p->drv = NULL;
|
||||
return LV_FS_RES_OUT_OF_MEM; /* Out of memory */
|
||||
@ -253,7 +253,7 @@ lv_fs_res_t lv_fs_tell(lv_fs_file_t * file_p, uint32_t * pos)
|
||||
* @return LV_FS_RES_OK: no error, the file is read
|
||||
* any error from lv_fs_res_t enum
|
||||
*/
|
||||
lv_fs_res_t lv_fs_trunc (lv_fs_file_t * file_p)
|
||||
lv_fs_res_t lv_fs_trunc(lv_fs_file_t * file_p)
|
||||
{
|
||||
if(file_p->drv == NULL) {
|
||||
return LV_FS_RES_INV_PARAM;
|
||||
@ -295,7 +295,7 @@ lv_fs_res_t lv_fs_size(lv_fs_file_t * file_p, uint32_t * size)
|
||||
* @param newname path with the new name
|
||||
* @return LV_FS_RES_OK or any error from 'fs_res_t'
|
||||
*/
|
||||
lv_fs_res_t lv_fs_rename (const char * oldname, const char * newname)
|
||||
lv_fs_res_t lv_fs_rename(const char * oldname, const char * newname)
|
||||
{
|
||||
if(!oldname || !newname) return LV_FS_RES_INV_PARAM;
|
||||
|
||||
@ -343,7 +343,7 @@ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path)
|
||||
}
|
||||
|
||||
rddir_p->dir_d = lv_mem_alloc(rddir_p->drv->rddir_size);
|
||||
lv_mem_assert(rddir_p->dir_d);
|
||||
lv_mem_assert(rddir_p->dir_d);
|
||||
if(rddir_p->dir_d == NULL) {
|
||||
rddir_p->dir_d = NULL;
|
||||
return LV_FS_RES_OUT_OF_MEM; /* Out of memory */
|
||||
|
@ -54,14 +54,14 @@ void lv_ll_init(lv_ll_t * ll_p, uint32_t n_size)
|
||||
#ifdef LV_MEM_ENV64
|
||||
/*Round the size up to 8*/
|
||||
if(n_size & 0x7) {
|
||||
n_size = n_size & (~0x7);
|
||||
n_size = n_size & (~0x7);
|
||||
n_size += 8;
|
||||
}
|
||||
#else
|
||||
/*Round the size up to 4*/
|
||||
if(n_size & 0x3) {
|
||||
n_size = n_size & (~0x3);
|
||||
n_size += 4;
|
||||
n_size = n_size & (~0x3);
|
||||
n_size += 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -272,12 +272,12 @@ void * lv_ll_get_tail(const lv_ll_t * ll_p)
|
||||
* @param n_act pointer a node
|
||||
* @return pointer to the next node
|
||||
*/
|
||||
void * lv_ll_get_next(const lv_ll_t * ll_p,const void * n_act)
|
||||
void * lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act)
|
||||
{
|
||||
void * next = NULL;
|
||||
|
||||
if(ll_p != NULL) {
|
||||
const lv_ll_node_t * n_act_d = n_act;
|
||||
const lv_ll_node_t * n_act_d = n_act;
|
||||
memcpy(&next, n_act_d + LL_NEXT_P_OFFSET(ll_p), sizeof(void *));
|
||||
}
|
||||
|
||||
@ -290,12 +290,12 @@ void * lv_ll_get_next(const lv_ll_t * ll_p,const void * n_act)
|
||||
* @param n_act pointer a node
|
||||
* @return pointer to the previous node
|
||||
*/
|
||||
void * lv_ll_get_prev(const lv_ll_t * ll_p,const void * n_act)
|
||||
void * lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act)
|
||||
{
|
||||
void * prev = NULL;
|
||||
|
||||
if(ll_p != NULL) {
|
||||
const lv_ll_node_t * n_act_d = n_act;
|
||||
const lv_ll_node_t * n_act_d = n_act;
|
||||
memcpy(&prev, n_act_d + LL_PREV_P_OFFSET(ll_p), sizeof(void *));
|
||||
}
|
||||
|
||||
@ -321,20 +321,20 @@ 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*/
|
||||
|
||||
|
||||
void * n_before = lv_ll_get_prev(ll_p, n_after);
|
||||
if(n_act == n_before) return; /*Already before `n_after`*/
|
||||
void * n_before = lv_ll_get_prev(ll_p, n_after);
|
||||
if(n_act == n_before) return; /*Already before `n_after`*/
|
||||
|
||||
/*It's much easier to remove from the list and add again*/
|
||||
lv_ll_rem(ll_p, n_act);
|
||||
|
||||
/*Add again by setting the prev. and next nodes*/
|
||||
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);
|
||||
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);
|
||||
|
||||
/*If `n_act` was moved before NULL then it become the new tail*/
|
||||
if(n_after == NULL) ll_p->tail = n_act;
|
||||
/*If `n_act` was moved before NULL then it become the new tail*/
|
||||
if(n_after == NULL) ll_p->tail = n_act;
|
||||
}
|
||||
|
||||
/**********************
|
||||
@ -349,11 +349,11 @@ void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after)
|
||||
*/
|
||||
static void node_set_prev(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * prev)
|
||||
{
|
||||
if(act == NULL) return; /*Can't set the prev node of `NULL`*/
|
||||
if(act == NULL) return; /*Can't set the prev node of `NULL`*/
|
||||
|
||||
uint32_t node_p_size = sizeof(lv_ll_node_t *);
|
||||
if(prev) memcpy(act + LL_PREV_P_OFFSET(ll_p), &prev, node_p_size);
|
||||
else memset(act + LL_PREV_P_OFFSET(ll_p), 0, node_p_size);
|
||||
uint32_t node_p_size = sizeof(lv_ll_node_t *);
|
||||
if(prev) memcpy(act + LL_PREV_P_OFFSET(ll_p), &prev, node_p_size);
|
||||
else memset(act + LL_PREV_P_OFFSET(ll_p), 0, node_p_size);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -364,10 +364,10 @@ static void node_set_prev(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * pre
|
||||
*/
|
||||
static void node_set_next(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * next)
|
||||
{
|
||||
if(act == NULL) return; /*Can't set the next node of `NULL`*/
|
||||
if(act == NULL) return; /*Can't set the next node of `NULL`*/
|
||||
|
||||
uint32_t node_p_size = sizeof(lv_ll_node_t *);
|
||||
if(next) memcpy(act + LL_NEXT_P_OFFSET(ll_p), &next, node_p_size);
|
||||
uint32_t node_p_size = sizeof(lv_ll_node_t *);
|
||||
if(next) memcpy(act + LL_NEXT_P_OFFSET(ll_p), &next, node_p_size);
|
||||
else memset(act + LL_NEXT_P_OFFSET(ll_p), 0, node_p_size);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static void (*print_cb)(lv_log_level_t , const char *, uint32_t , const char *);
|
||||
static void (*print_cb)(lv_log_level_t, const char *, uint32_t, const char *);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@ -42,9 +42,9 @@ static void (*print_cb)(lv_log_level_t , const char *, uint32_t , const char *)
|
||||
* @param f a function pointer:
|
||||
* `void my_print (lv_log_level_t level, const char * file, uint32_t line, const char * dsc)`
|
||||
*/
|
||||
void lv_log_register_print(void f(lv_log_level_t , const char *, uint32_t , const char *))
|
||||
void lv_log_register_print(void f(lv_log_level_t, const char *, uint32_t, const char *))
|
||||
{
|
||||
print_cb = f;
|
||||
print_cb = f;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,17 +56,17 @@ void lv_log_register_print(void f(lv_log_level_t , const char *, uint32_t , con
|
||||
*/
|
||||
void lv_log_add(lv_log_level_t level, const char * file, uint32_t line, const char * dsc)
|
||||
{
|
||||
if(level >= _LV_LOG_LEVEL_NUM) return; /*Invalid level*/
|
||||
if(level >= _LV_LOG_LEVEL_NUM) return; /*Invalid level*/
|
||||
|
||||
if(level >= LV_LOG_LEVEL) {
|
||||
if(level >= LV_LOG_LEVEL) {
|
||||
|
||||
#if LV_LOG_PRINTF
|
||||
static const char * lvl_prefix[] = {"Trace", "Info", "Warn", "Error"};
|
||||
printf("%s: %s \t(%s #%d)\n", lvl_prefix[level], dsc, file, line);
|
||||
static const char * lvl_prefix[] = {"Trace", "Info", "Warn", "Error"};
|
||||
printf("%s: %s \t(%s #%d)\n", lvl_prefix[level], dsc, file, line);
|
||||
#else
|
||||
if(print_cb) print_cb(level, file, line, dsc);
|
||||
if(print_cb) print_cb(level, file, line, dsc);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
@ -49,7 +49,7 @@ typedef uint8_t lv_log_level_t;
|
||||
* @param f a function pointer:
|
||||
* `void my_print (lv_log_level_t level, const char * file, uint32_t line, const char * dsc)`
|
||||
*/
|
||||
void lv_log_register_print(void f(lv_log_level_t , const char *, uint32_t , const char *));
|
||||
void lv_log_register_print(void f(lv_log_level_t, const char *, uint32_t, const char *));
|
||||
|
||||
/**
|
||||
* Add a log
|
||||
@ -64,10 +64,10 @@ void lv_log_add(lv_log_level_t level, const char * file, uint32_t line, const ch
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#define LV_LOG_TRACE(dsc) lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, dsc);
|
||||
#define LV_LOG_INFO(dsc) lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, dsc);
|
||||
#define LV_LOG_WARN(dsc) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, dsc);
|
||||
#define LV_LOG_ERROR(dsc) lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, dsc);
|
||||
#define LV_LOG_TRACE(dsc) lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, dsc);
|
||||
#define LV_LOG_INFO(dsc) lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, dsc);
|
||||
#define LV_LOG_WARN(dsc) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, dsc);
|
||||
#define LV_LOG_ERROR(dsc) lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, dsc);
|
||||
|
||||
#else /*USE_LV_LOG*/
|
||||
|
||||
|
@ -35,8 +35,8 @@
|
||||
/*The size of this union must be 4 bytes (uint32_t)*/
|
||||
typedef union {
|
||||
struct {
|
||||
MEM_UNIT used: 1; //1: if the entry is used
|
||||
MEM_UNIT d_size: 31; //Size off the data (1 means 4 bytes)
|
||||
MEM_UNIT used: 1; //1: if the entry is used
|
||||
MEM_UNIT d_size: 31; //Size off the data (1 means 4 bytes)
|
||||
};
|
||||
MEM_UNIT header; //The header (used + d_size)
|
||||
} lv_mem_header_t;
|
||||
@ -79,7 +79,7 @@ static uint32_t zero_mem; /*Give the address of this variable if 0 byte sh
|
||||
void lv_mem_init(void)
|
||||
{
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
work_mem = (uint8_t*) work_mem_int;
|
||||
work_mem = (uint8_t *) work_mem_int;
|
||||
lv_mem_ent_t * full = (lv_mem_ent_t *)work_mem;
|
||||
full->header.used = 0;
|
||||
/*The total mem size id reduced by the first header and the close patterns */
|
||||
|
@ -56,12 +56,12 @@ void lv_task_init(void)
|
||||
*/
|
||||
LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
|
||||
{
|
||||
LV_LOG_TRACE("lv_task_handler started");
|
||||
LV_LOG_TRACE("lv_task_handler started");
|
||||
|
||||
/*Avoid concurrent running of the task handler*/
|
||||
static bool task_handler_mutex = false;
|
||||
if(task_handler_mutex) return;
|
||||
task_handler_mutex = true;
|
||||
/*Avoid concurrent running of the task handler*/
|
||||
static bool task_handler_mutex = false;
|
||||
if(task_handler_mutex) return;
|
||||
task_handler_mutex = true;
|
||||
|
||||
static uint32_t idle_period_start = 0;
|
||||
static uint32_t handler_start = 0;
|
||||
@ -136,9 +136,9 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
|
||||
|
||||
}
|
||||
|
||||
task_handler_mutex = false; /*Release the mutex*/
|
||||
task_handler_mutex = false; /*Release the mutex*/
|
||||
|
||||
LV_LOG_TRACE("lv_task_handler ready");
|
||||
LV_LOG_TRACE("lv_task_handler ready");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,23 +52,23 @@ static uint32_t lv_txt_ascii_get_length(const char * txt);
|
||||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
#if LV_TXT_UTF8
|
||||
uint8_t (*lv_txt_encoded_size)(const char *) = lv_txt_utf8_size;
|
||||
uint32_t (*lv_txt_unicode_to_encoded)(uint32_t) = lv_txt_unicode_to_utf8;
|
||||
uint32_t (*lv_txt_encoded_conv_wc)(uint32_t) = lv_txt_utf8_conv_wc;
|
||||
uint32_t (*lv_txt_encoded_next)(const char * , uint32_t *) = lv_txt_utf8_next;
|
||||
uint32_t (*lv_txt_encoded_prev)(const char * , uint32_t * ) = lv_txt_utf8_prev;
|
||||
uint32_t (*lv_txt_encoded_get_byte_id)(const char * , uint32_t) = lv_txt_utf8_get_byte_id;
|
||||
uint32_t (*lv_encoded_get_char_id)(const char * , uint32_t) = lv_txt_utf8_get_char_id;
|
||||
uint32_t (*lv_txt_get_encoded_length)(const char * ) = lv_txt_utf8_get_length;
|
||||
uint8_t (*lv_txt_encoded_size)(const char *) = lv_txt_utf8_size;
|
||||
uint32_t (*lv_txt_unicode_to_encoded)(uint32_t) = lv_txt_unicode_to_utf8;
|
||||
uint32_t (*lv_txt_encoded_conv_wc)(uint32_t) = lv_txt_utf8_conv_wc;
|
||||
uint32_t (*lv_txt_encoded_next)(const char *, uint32_t *) = lv_txt_utf8_next;
|
||||
uint32_t (*lv_txt_encoded_prev)(const char *, uint32_t *) = lv_txt_utf8_prev;
|
||||
uint32_t (*lv_txt_encoded_get_byte_id)(const char *, uint32_t) = lv_txt_utf8_get_byte_id;
|
||||
uint32_t (*lv_encoded_get_char_id)(const char *, uint32_t) = lv_txt_utf8_get_char_id;
|
||||
uint32_t (*lv_txt_get_encoded_length)(const char *) = lv_txt_utf8_get_length;
|
||||
#else
|
||||
uint8_t (*lv_txt_encoded_size)(const char *) = lv_txt_ascii_size;
|
||||
uint32_t (*lv_txt_unicode_to_encoded)(uint32_t) = lv_txt_unicode_to_ascii;
|
||||
uint32_t (*lv_txt_encoded_conv_wc)(uint32_t) = lv_txt_ascii_conv_wc;
|
||||
uint32_t (*lv_txt_encoded_next)(const char * , uint32_t *) = lv_txt_ascii_next;
|
||||
uint32_t (*lv_txt_encoded_prev)(const char * , uint32_t * ) = lv_txt_ascii_prev;
|
||||
uint32_t (*lv_txt_encoded_get_byte_id)(const char * , uint32_t) = lv_txt_ascii_get_byte_id;
|
||||
uint32_t (*lv_encoded_get_char_id)(const char * , uint32_t) = lv_txt_ascii_get_char_id;
|
||||
uint32_t (*lv_txt_get_encoded_length)(const char * ) = lv_txt_ascii_get_length;
|
||||
uint8_t (*lv_txt_encoded_size)(const char *) = lv_txt_ascii_size;
|
||||
uint32_t (*lv_txt_unicode_to_encoded)(uint32_t) = lv_txt_unicode_to_ascii;
|
||||
uint32_t (*lv_txt_encoded_conv_wc)(uint32_t) = lv_txt_ascii_conv_wc;
|
||||
uint32_t (*lv_txt_encoded_next)(const char *, uint32_t *) = lv_txt_ascii_next;
|
||||
uint32_t (*lv_txt_encoded_prev)(const char *, uint32_t *) = lv_txt_ascii_prev;
|
||||
uint32_t (*lv_txt_encoded_get_byte_id)(const char *, uint32_t) = lv_txt_ascii_get_byte_id;
|
||||
uint32_t (*lv_encoded_get_char_id)(const char *, uint32_t) = lv_txt_ascii_get_char_id;
|
||||
uint32_t (*lv_txt_get_encoded_length)(const char *) = lv_txt_ascii_get_length;
|
||||
#endif
|
||||
/**********************
|
||||
* MACROS
|
||||
@ -187,7 +187,7 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font,
|
||||
} else {
|
||||
/* Now this character is out of the area so it will be first character of the next line*/
|
||||
/* But 'i' already points to the next character (because of lv_txt_utf8_next) step beck one*/
|
||||
lv_txt_encoded_prev(txt, &i);
|
||||
lv_txt_encoded_prev(txt, &i);
|
||||
}
|
||||
|
||||
/* Do not let to return without doing nothing.
|
||||
@ -238,8 +238,8 @@ lv_coord_t lv_txt_get_width(const char * txt, uint16_t length,
|
||||
}
|
||||
}
|
||||
|
||||
width += lv_font_get_width(font, letter);
|
||||
width += letter_space;
|
||||
width += lv_font_get_width(font, letter);
|
||||
width += letter_space;
|
||||
}
|
||||
|
||||
width -= letter_space; /*Trim the last letter space. Important if the text is center aligned */
|
||||
@ -390,20 +390,20 @@ static uint32_t lv_txt_unicode_to_utf8(uint32_t letter_uni)
|
||||
*/
|
||||
static uint32_t lv_txt_utf8_conv_wc(uint32_t c)
|
||||
{
|
||||
/*Swap the bytes (UTF-8 is big endian, but the MCUs are little endian)*/
|
||||
if((c & 0x80) != 0) {
|
||||
uint32_t swapped;
|
||||
uint8_t c8[4];
|
||||
memcpy(c8, &c, 4);
|
||||
swapped = (c8[0] << 24) + (c8[1] << 16) + (c8[2] << 8) + (c8[3]);
|
||||
uint8_t i;
|
||||
for(i = 0; i < 4; i++) {
|
||||
if((swapped & 0xFF) == 0) swapped = (swapped >> 8); /*Ignore leading zeros (they were in the end originally)*/
|
||||
}
|
||||
c = swapped;
|
||||
}
|
||||
/*Swap the bytes (UTF-8 is big endian, but the MCUs are little endian)*/
|
||||
if((c & 0x80) != 0) {
|
||||
uint32_t swapped;
|
||||
uint8_t c8[4];
|
||||
memcpy(c8, &c, 4);
|
||||
swapped = (c8[0] << 24) + (c8[1] << 16) + (c8[2] << 8) + (c8[3]);
|
||||
uint8_t i;
|
||||
for(i = 0; i < 4; i++) {
|
||||
if((swapped & 0xFF) == 0) swapped = (swapped >> 8); /*Ignore leading zeros (they were in the end originally)*/
|
||||
}
|
||||
c = swapped;
|
||||
}
|
||||
|
||||
return c;
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -544,7 +544,7 @@ static uint32_t lv_txt_utf8_get_char_id(const char * txt, uint32_t byte_id)
|
||||
uint32_t char_cnt = 0;
|
||||
|
||||
while(i < byte_id) {
|
||||
lv_txt_encoded_next(txt, &i); /*'i' points to the next letter so use the prev. value*/
|
||||
lv_txt_encoded_next(txt, &i); /*'i' points to the next letter so use the prev. value*/
|
||||
char_cnt++;
|
||||
}
|
||||
|
||||
@ -566,7 +566,7 @@ static uint32_t lv_txt_utf8_get_length(const char * txt)
|
||||
uint32_t i = 0;
|
||||
|
||||
while(txt[i] != '\0') {
|
||||
lv_txt_encoded_next(txt, &i);
|
||||
lv_txt_encoded_next(txt, &i);
|
||||
len++;
|
||||
}
|
||||
|
||||
@ -605,7 +605,7 @@ static uint32_t lv_txt_unicode_to_ascii(uint32_t letter_uni)
|
||||
*/
|
||||
static uint32_t lv_txt_ascii_conv_wc(uint32_t c)
|
||||
{
|
||||
return c;
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@ enum
|
||||
LV_TXT_FLAG_RECOLOR = 0x01, /*Enable parsing of recolor command*/
|
||||
LV_TXT_FLAG_EXPAND = 0x02, /*Ignore width to avoid automatic word wrapping*/
|
||||
LV_TXT_FLAG_CENTER = 0x04, /*Align the text to the middle*/
|
||||
LV_TXT_FLAG_RIGHT = 0x08, /*Align the text to the right*/
|
||||
LV_TXT_FLAG_RIGHT = 0x08, /*Align the text to the right*/
|
||||
};
|
||||
typedef uint8_t lv_txt_flag_t;
|
||||
|
||||
@ -151,7 +151,7 @@ extern uint32_t (*lv_txt_encoded_conv_wc) (uint32_t c);
|
||||
* NULL to use txt[0] as index
|
||||
* @return the decoded Unicode character or 0 on invalid data code
|
||||
*/
|
||||
extern uint32_t (*lv_txt_encoded_next)(const char * , uint32_t * );
|
||||
extern uint32_t (*lv_txt_encoded_next)(const char *, uint32_t * );
|
||||
|
||||
/**
|
||||
* Get the previous encoded character form a string.
|
||||
@ -177,7 +177,7 @@ extern uint32_t (*lv_txt_encoded_get_byte_id)(const char *, uint32_t);
|
||||
* @param byte_id byte index
|
||||
* @return character index of the letter at 'byte_id'th position
|
||||
*/
|
||||
extern uint32_t (*lv_encoded_get_char_id)(const char * , uint32_t);
|
||||
extern uint32_t (*lv_encoded_get_char_id)(const char *, uint32_t);
|
||||
|
||||
/**
|
||||
* Get the number of characters (and NOT bytes) in a string.
|
||||
|
@ -495,7 +495,7 @@ static lv_ufs_ent_t * lv_ufs_ent_new(const char * fn)
|
||||
if(new_ent == NULL) return NULL;
|
||||
|
||||
new_ent->fn_d = lv_mem_alloc(strlen(fn) + 1); /*Save the name*/
|
||||
lv_mem_assert(new_ent->fn_d);
|
||||
lv_mem_assert(new_ent->fn_d);
|
||||
if(new_ent->fn_d == NULL) return NULL;
|
||||
|
||||
strcpy(new_ent->fn_d, fn);
|
||||
|
@ -52,7 +52,7 @@ static lv_design_func_t ancestor_design;
|
||||
lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
|
||||
LV_LOG_TRACE("arc create started");
|
||||
LV_LOG_TRACE("arc create started");
|
||||
|
||||
/*Create the ancestor of arc*/
|
||||
lv_obj_t * new_arc = lv_obj_create(par, copy);
|
||||
@ -96,7 +96,7 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_refresh_style(new_arc);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("arc created");
|
||||
LV_LOG_INFO("arc created");
|
||||
|
||||
return new_arc;
|
||||
}
|
||||
|
@ -52,12 +52,12 @@ static lv_signal_func_t ancestor_signal;
|
||||
*/
|
||||
lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("lv_bar create started");
|
||||
LV_LOG_TRACE("lv_bar create started");
|
||||
|
||||
/*Create the ancestor basic object*/
|
||||
lv_obj_t * new_bar = lv_obj_create(par, copy);
|
||||
lv_mem_assert(new_bar);
|
||||
if(new_bar== NULL) return NULL;
|
||||
if(new_bar == NULL) return NULL;
|
||||
|
||||
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_func(new_bar);
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_func(new_bar);
|
||||
@ -100,7 +100,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_bar_set_value(new_bar, ext->cur_value);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("bar created");
|
||||
LV_LOG_INFO("bar created");
|
||||
|
||||
return new_bar;
|
||||
}
|
||||
@ -305,29 +305,29 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
|
||||
|
||||
if(ext->cur_value != ext->min_value) {
|
||||
lv_style_t * style_indic = lv_bar_get_style(bar, LV_BAR_STYLE_INDIC);
|
||||
lv_area_t indic_area;
|
||||
lv_area_copy(&indic_area, &bar->coords);
|
||||
indic_area.x1 += style_indic->body.padding.hor;
|
||||
indic_area.x2 -= style_indic->body.padding.hor;
|
||||
indic_area.y1 += style_indic->body.padding.ver;
|
||||
indic_area.y2 -= style_indic->body.padding.ver;
|
||||
lv_style_t * style_indic = lv_bar_get_style(bar, LV_BAR_STYLE_INDIC);
|
||||
lv_area_t indic_area;
|
||||
lv_area_copy(&indic_area, &bar->coords);
|
||||
indic_area.x1 += style_indic->body.padding.hor;
|
||||
indic_area.x2 -= style_indic->body.padding.hor;
|
||||
indic_area.y1 += style_indic->body.padding.ver;
|
||||
indic_area.y2 -= style_indic->body.padding.ver;
|
||||
|
||||
lv_coord_t w = lv_area_get_width(&indic_area);
|
||||
lv_coord_t h = lv_area_get_height(&indic_area);
|
||||
lv_coord_t w = lv_area_get_width(&indic_area);
|
||||
lv_coord_t h = lv_area_get_height(&indic_area);
|
||||
|
||||
if(w >= h) {
|
||||
indic_area.x2 = (int32_t)((int32_t)w * (ext->cur_value - ext->min_value - 1)) / (ext->max_value - ext->min_value);
|
||||
indic_area.x2 = indic_area.x1 + indic_area.x2;
|
||||
} else {
|
||||
indic_area.y1 = (int32_t)((int32_t)h * (ext->cur_value - ext->min_value - 1)) / (ext->max_value - ext->min_value);
|
||||
indic_area.y1 = indic_area.y2 - indic_area.y1;
|
||||
}
|
||||
if(w >= h) {
|
||||
indic_area.x2 = (int32_t)((int32_t)w * (ext->cur_value - ext->min_value - 1)) / (ext->max_value - ext->min_value);
|
||||
indic_area.x2 = indic_area.x1 + indic_area.x2;
|
||||
} else {
|
||||
indic_area.y1 = (int32_t)((int32_t)h * (ext->cur_value - ext->min_value - 1)) / (ext->max_value - ext->min_value);
|
||||
indic_area.y1 = indic_area.y2 - indic_area.y1;
|
||||
}
|
||||
|
||||
/*Draw the indicator*/
|
||||
lv_draw_rect(&indic_area, mask, style_indic, opa_scale);
|
||||
/*Draw the indicator*/
|
||||
lv_draw_rect(&indic_area, mask, style_indic, opa_scale);
|
||||
}
|
||||
}else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
} else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
#if USE_LV_GROUP
|
||||
/*Draw the border*/
|
||||
if(lv_obj_is_focused(bar)) {
|
||||
|
249
lv_objx/lv_btn.c
249
lv_objx/lv_btn.c
@ -21,8 +21,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_BTN_INK_VALUE_MAX 256
|
||||
#define LV_BTN_INK_VALUE_MAX_SHIFT 8
|
||||
#define LV_BTN_INK_VALUE_MAX 256
|
||||
#define LV_BTN_INK_VALUE_MAX_SHIFT 8
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -71,7 +71,7 @@ static lv_point_t ink_point;
|
||||
*/
|
||||
lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("button create started");
|
||||
LV_LOG_TRACE("button create started");
|
||||
|
||||
lv_obj_t * new_btn;
|
||||
|
||||
@ -149,7 +149,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_refresh_style(new_btn);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("button created");
|
||||
LV_LOG_INFO("button created");
|
||||
|
||||
return new_btn;
|
||||
}
|
||||
@ -432,77 +432,74 @@ lv_style_t * lv_btn_get_style(const lv_obj_t * btn, lv_btn_style_t type)
|
||||
*/
|
||||
static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return false;
|
||||
}
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return false;
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
|
||||
#if USE_LV_ANIMATION && LV_BTN_INK_EFFECT
|
||||
if(btn != ink_obj) {
|
||||
ancestor_design(btn, mask, mode);
|
||||
} else {
|
||||
lv_opa_t opa_scale = lv_obj_get_opa_scale(btn);
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||
if(btn != ink_obj) {
|
||||
ancestor_design(btn, mask, mode);
|
||||
} else {
|
||||
lv_opa_t opa_scale = lv_obj_get_opa_scale(btn);
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||
|
||||
/*Draw the normal button*/
|
||||
if(ink_playback == false) {
|
||||
lv_style_t style_tmp;
|
||||
lv_style_copy(&style_tmp, ext->styles[ink_bg_state]);
|
||||
style_tmp.body.shadow.width = ext->styles[ink_top_state]->body.shadow.width;
|
||||
lv_draw_rect(&btn->coords, mask, &style_tmp, opa_scale);
|
||||
/*Draw the normal button*/
|
||||
if(ink_playback == false) {
|
||||
lv_style_t style_tmp;
|
||||
lv_style_copy(&style_tmp, ext->styles[ink_bg_state]);
|
||||
style_tmp.body.shadow.width = ext->styles[ink_top_state]->body.shadow.width;
|
||||
lv_draw_rect(&btn->coords, mask, &style_tmp, opa_scale);
|
||||
|
||||
lv_coord_t w = lv_obj_get_width(btn);
|
||||
lv_coord_t h = lv_obj_get_height(btn);
|
||||
lv_coord_t r_max = LV_MATH_MIN(w, h) / 2;
|
||||
lv_coord_t w = lv_obj_get_width(btn);
|
||||
lv_coord_t h = lv_obj_get_height(btn);
|
||||
lv_coord_t r_max = LV_MATH_MIN(w, h) / 2;
|
||||
|
||||
/*In the first part of the animation increase the size of the circle (ink effect) */
|
||||
lv_area_t cir_area;
|
||||
/*In the first part of the animation increase the size of the circle (ink effect) */
|
||||
lv_area_t cir_area;
|
||||
|
||||
lv_coord_t coord_state = ink_act_value < LV_BTN_INK_VALUE_MAX / 2 ? ink_act_value : LV_BTN_INK_VALUE_MAX / 2;
|
||||
lv_point_t p_act;
|
||||
p_act.x = ink_point.x;
|
||||
p_act.y = ink_point.y;
|
||||
lv_coord_t x_err = (btn->coords.x1 + w / 2) - p_act.x;
|
||||
lv_coord_t y_err = (btn->coords.y1 + h / 2) - p_act.y;
|
||||
lv_coord_t coord_state = ink_act_value < LV_BTN_INK_VALUE_MAX / 2 ? ink_act_value : LV_BTN_INK_VALUE_MAX / 2;
|
||||
lv_point_t p_act;
|
||||
p_act.x = ink_point.x;
|
||||
p_act.y = ink_point.y;
|
||||
lv_coord_t x_err = (btn->coords.x1 + w / 2) - p_act.x;
|
||||
lv_coord_t y_err = (btn->coords.y1 + h / 2) - p_act.y;
|
||||
|
||||
p_act.x += (x_err * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1);
|
||||
p_act.y += (y_err * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1);
|
||||
p_act.x += (x_err * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1);
|
||||
p_act.y += (y_err * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1);
|
||||
|
||||
lv_coord_t half_side = LV_MATH_MAX(w, h) / 2;
|
||||
cir_area.x1 = p_act.x - ((half_side * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1));
|
||||
cir_area.y1 = p_act.y - ((half_side * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1));
|
||||
cir_area.x2 = p_act.x + ((half_side * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1));
|
||||
cir_area.y2 = p_act.y + ((half_side * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1));
|
||||
lv_coord_t half_side = LV_MATH_MAX(w, h) / 2;
|
||||
cir_area.x1 = p_act.x - ((half_side * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1));
|
||||
cir_area.y1 = p_act.y - ((half_side * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1));
|
||||
cir_area.x2 = p_act.x + ((half_side * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1));
|
||||
cir_area.y2 = p_act.y + ((half_side * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1));
|
||||
|
||||
lv_area_intersect(&cir_area, &btn->coords, &cir_area); /*Limit the area. (It might be too big on the smaller side)*/
|
||||
lv_area_intersect(&cir_area, &btn->coords, &cir_area); /*Limit the area. (It might be too big on the smaller side)*/
|
||||
|
||||
/*In the second part animate the radius. Circle -> body.radius*/
|
||||
lv_coord_t r_state = ink_act_value > LV_BTN_INK_VALUE_MAX / 2 ? ink_act_value - LV_BTN_INK_VALUE_MAX / 2 : 0;
|
||||
/*In the second part animate the radius. Circle -> body.radius*/
|
||||
lv_coord_t r_state = ink_act_value > LV_BTN_INK_VALUE_MAX / 2 ? ink_act_value - LV_BTN_INK_VALUE_MAX / 2 : 0;
|
||||
|
||||
lv_style_copy(&style_tmp, ext->styles[ink_top_state]);
|
||||
style_tmp.body.radius = r_max + (((ext->styles[ink_bg_state]->body.radius - r_max) * r_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1));
|
||||
style_tmp.body.border.width = 0;
|
||||
lv_style_copy(&style_tmp, ext->styles[ink_top_state]);
|
||||
style_tmp.body.radius = r_max + (((ext->styles[ink_bg_state]->body.radius - r_max) * r_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1));
|
||||
style_tmp.body.border.width = 0;
|
||||
|
||||
/*Draw the circle*/
|
||||
lv_draw_rect(&cir_area, mask, &style_tmp, opa_scale);
|
||||
}
|
||||
else {
|
||||
lv_style_t res;
|
||||
lv_style_copy(&res, ext->styles[ink_bg_state]);
|
||||
lv_style_mix(ext->styles[ink_bg_state], ext->styles[ink_top_state], &res, ink_act_value);
|
||||
lv_draw_rect(&btn->coords, mask, &res, opa_scale);
|
||||
/*Draw the circle*/
|
||||
lv_draw_rect(&cir_area, mask, &style_tmp, opa_scale);
|
||||
} else {
|
||||
lv_style_t res;
|
||||
lv_style_copy(&res, ext->styles[ink_bg_state]);
|
||||
lv_style_mix(ext->styles[ink_bg_state], ext->styles[ink_top_state], &res, ink_act_value);
|
||||
lv_draw_rect(&btn->coords, mask, &res, opa_scale);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
ancestor_design(btn, mask, mode);
|
||||
ancestor_design(btn, mask, mode);
|
||||
#endif
|
||||
}
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
ancestor_design(btn, mask, mode);
|
||||
}
|
||||
} else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
ancestor_design(btn, mask, mode);
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -545,31 +542,31 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
#if USE_LV_ANIMATION && LV_BTN_INK_EFFECT
|
||||
/*Forget the old inked button*/
|
||||
if(ink_obj != NULL && ink_obj != btn) {
|
||||
lv_anim_del(ink_obj, (lv_anim_fp_t)lv_btn_ink_effect_anim);
|
||||
lv_obj_invalidate(ink_obj);
|
||||
ink_obj = NULL;
|
||||
lv_anim_del(ink_obj, (lv_anim_fp_t)lv_btn_ink_effect_anim);
|
||||
lv_obj_invalidate(ink_obj);
|
||||
ink_obj = NULL;
|
||||
}
|
||||
/*Save the new data for inking and start it's animation if enabled*/
|
||||
if(ext->ink_in_time > 0) {
|
||||
ink_obj = btn;
|
||||
ink_playback = false;
|
||||
ink_ready = false;
|
||||
lv_indev_get_point(lv_indev_get_act(), &ink_point);
|
||||
ink_obj = btn;
|
||||
ink_playback = false;
|
||||
ink_ready = false;
|
||||
lv_indev_get_point(lv_indev_get_act(), &ink_point);
|
||||
|
||||
lv_anim_t a;
|
||||
a.var = btn;
|
||||
a.start = 0;
|
||||
a.end = LV_BTN_INK_VALUE_MAX;
|
||||
a.fp = (lv_anim_fp_t)lv_btn_ink_effect_anim;
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = lv_btn_ink_effect_anim_ready;
|
||||
a.act_time = 0;
|
||||
a.time = ext->ink_in_time;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
lv_anim_t a;
|
||||
a.var = btn;
|
||||
a.start = 0;
|
||||
a.end = LV_BTN_INK_VALUE_MAX;
|
||||
a.fp = (lv_anim_fp_t)lv_btn_ink_effect_anim;
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = lv_btn_ink_effect_anim_ready;
|
||||
a.act_time = 0;
|
||||
a.time = ext->ink_in_time;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
}
|
||||
#endif
|
||||
/*Call the press action, 'param' is the caller indev_proc*/
|
||||
@ -614,28 +611,28 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
#if USE_LV_ANIMATION && LV_BTN_INK_EFFECT
|
||||
/*Draw the toggled state in the inking instead*/
|
||||
if(ext->toggle) {
|
||||
ink_top_state = ext->state;
|
||||
ink_top_state = ext->state;
|
||||
}
|
||||
/*If not a toggle button and the "IN" inking is ready then start an "OUT" inking*/
|
||||
else if(ink_ready && ext->ink_out_time > 0) {
|
||||
ink_obj = btn;
|
||||
ink_playback = true; /*It is the playback. If not set `lv_btn_ink_effect_anim_ready` will start its own playback*/
|
||||
lv_indev_get_point(lv_indev_get_act(), &ink_point);
|
||||
ink_obj = btn;
|
||||
ink_playback = true; /*It is the playback. If not set `lv_btn_ink_effect_anim_ready` will start its own playback*/
|
||||
lv_indev_get_point(lv_indev_get_act(), &ink_point);
|
||||
|
||||
lv_anim_t a;
|
||||
a.var = ink_obj;
|
||||
a.start = LV_BTN_INK_VALUE_MAX;
|
||||
a.end = 0;
|
||||
a.fp = (lv_anim_fp_t)lv_btn_ink_effect_anim;
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = lv_btn_ink_effect_anim_ready;
|
||||
a.act_time = 0;
|
||||
a.time = ext->ink_out_time;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
lv_anim_t a;
|
||||
a.var = ink_obj;
|
||||
a.start = LV_BTN_INK_VALUE_MAX;
|
||||
a.end = 0;
|
||||
a.fp = (lv_anim_fp_t)lv_btn_ink_effect_anim;
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = lv_btn_ink_effect_anim_ready;
|
||||
a.act_time = 0;
|
||||
a.time = ext->ink_out_time;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
}
|
||||
#endif
|
||||
} else if(sign == LV_SIGNAL_LONG_PRESS) {
|
||||
@ -673,16 +670,14 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
}
|
||||
ext->long_pr_action_executed = 0;
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
} else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
#if USE_LV_ANIMATION && LV_BTN_INK_EFFECT
|
||||
if(btn == ink_obj) {
|
||||
if(btn == ink_obj) {
|
||||
lv_anim_del(ink_obj, (lv_anim_fp_t)lv_btn_ink_effect_anim);
|
||||
ink_obj = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
@ -703,10 +698,10 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
*/
|
||||
static void lv_btn_ink_effect_anim(lv_obj_t * btn, int32_t val)
|
||||
{
|
||||
if(btn) {
|
||||
ink_act_value = val;
|
||||
lv_obj_invalidate(btn);
|
||||
}
|
||||
if(btn) {
|
||||
ink_act_value = val;
|
||||
lv_obj_invalidate(btn);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -720,28 +715,28 @@ static void lv_btn_ink_effect_anim_ready(void * p)
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(ink_obj);
|
||||
lv_btn_state_t state = lv_btn_get_state(ink_obj);
|
||||
|
||||
lv_obj_invalidate(ink_obj);
|
||||
ink_ready = true;
|
||||
lv_obj_invalidate(ink_obj);
|
||||
ink_ready = true;
|
||||
|
||||
if((state == LV_BTN_STATE_REL || state == LV_BTN_STATE_TGL_REL) && ext->toggle == 0 && ink_playback == false) {
|
||||
lv_anim_t a;
|
||||
a.var = ink_obj;
|
||||
a.start = LV_BTN_INK_VALUE_MAX;
|
||||
a.end = 0;
|
||||
a.fp = (lv_anim_fp_t)lv_btn_ink_effect_anim;
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = lv_btn_ink_effect_anim_ready;
|
||||
a.act_time = -ext->ink_wait_time;
|
||||
a.time = ext->ink_out_time;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
if((state == LV_BTN_STATE_REL || state == LV_BTN_STATE_TGL_REL) && ext->toggle == 0 && ink_playback == false) {
|
||||
lv_anim_t a;
|
||||
a.var = ink_obj;
|
||||
a.start = LV_BTN_INK_VALUE_MAX;
|
||||
a.end = 0;
|
||||
a.fp = (lv_anim_fp_t)lv_btn_ink_effect_anim;
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = lv_btn_ink_effect_anim_ready;
|
||||
a.act_time = -ext->ink_wait_time;
|
||||
a.time = ext->ink_out_time;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
|
||||
ink_playback = true;
|
||||
ink_playback = true;
|
||||
} else {
|
||||
ink_obj = NULL;
|
||||
ink_obj = NULL;
|
||||
}
|
||||
}
|
||||
#endif /*USE_LV_ANIMATION*/
|
||||
|
@ -70,9 +70,9 @@ typedef struct
|
||||
lv_style_t * styles[LV_BTN_STATE_NUM]; /*Styles in each state*/
|
||||
lv_btn_state_t state; /*Current state of the button from 'lv_btn_state_t' enum*/
|
||||
#if LV_BTN_INK_EFFECT
|
||||
uint16_t ink_in_time; /*[ms] Time of ink fill effect (0: disable ink effect)*/
|
||||
uint16_t ink_wait_time; /*[ms] Wait before the ink disappears */
|
||||
uint16_t ink_out_time; /*[ms] Time of ink disappearing*/
|
||||
uint16_t ink_in_time; /*[ms] Time of ink fill effect (0: disable ink effect)*/
|
||||
uint16_t ink_wait_time; /*[ms] Wait before the ink disappears */
|
||||
uint16_t ink_out_time; /*[ms] Time of ink disappearing*/
|
||||
#endif
|
||||
uint8_t toggle :1; /*1: Toggle enabled*/
|
||||
uint8_t long_pr_action_executed :1; /*1: Long press action executed (Handled by the library)*/
|
||||
|
@ -600,7 +600,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
lv_indev_get_point(indev, &p1);
|
||||
uint16_t btn_i = get_button_from_point(btnm, &p1);
|
||||
ext->btn_id_pr = btn_i;
|
||||
} else if (indev_type == LV_INDEV_TYPE_ENCODER){
|
||||
} else if(indev_type == LV_INDEV_TYPE_ENCODER) {
|
||||
/*In navigation mode don't select any button but in edit mode select the fist*/
|
||||
if(lv_group_get_editing(lv_obj_get_group(btnm))) ext->btn_id_pr = 0;
|
||||
else ext->btn_id_pr = LV_BTNM_PR_NONE;
|
||||
|
@ -72,7 +72,7 @@ static const char * month_name[12] = {"January", "February", "March", "Ap
|
||||
*/
|
||||
lv_obj_t * lv_calendar_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("calendar create started");
|
||||
LV_LOG_TRACE("calendar create started");
|
||||
|
||||
/*Create the ancestor of calendar*/
|
||||
lv_obj_t * new_calendar = lv_obj_create(par, copy);
|
||||
@ -165,7 +165,7 @@ lv_obj_t * lv_calendar_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_refresh_style(new_calendar);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("calendar created");
|
||||
LV_LOG_INFO("calendar created");
|
||||
|
||||
return new_calendar;
|
||||
}
|
||||
@ -580,7 +580,7 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask)
|
||||
txt_buf[5] = '\0';
|
||||
strcpy(&txt_buf[5], get_month_name(calendar, ext->showed_date.month));
|
||||
header_area.y1 += ext->style_header->body.padding.ver;
|
||||
lv_draw_label(&header_area, mask, ext->style_header, opa_scale, txt_buf , LV_TXT_FLAG_CENTER, NULL);
|
||||
lv_draw_label(&header_area, mask, ext->style_header, opa_scale, txt_buf, LV_TXT_FLAG_CENTER, NULL);
|
||||
|
||||
/*Add the left arrow*/
|
||||
lv_style_t * arrow_style = ext->btn_pressing < 0 ? ext->style_header_pr : ext->style_header;
|
||||
|
@ -51,7 +51,7 @@ static lv_signal_func_t ancestor_signal;
|
||||
lv_obj_t * lv_cb_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
|
||||
LV_LOG_TRACE("check box create started");
|
||||
LV_LOG_TRACE("check box create started");
|
||||
|
||||
/*Create the ancestor basic object*/
|
||||
lv_obj_t * new_cb = lv_btn_create(par, copy);
|
||||
@ -110,7 +110,7 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_set_design_func(ext->bullet, lv_bullet_design);
|
||||
|
||||
|
||||
LV_LOG_INFO("check box created");
|
||||
LV_LOG_INFO("check box created");
|
||||
|
||||
return new_cb;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
|
||||
|
||||
LV_LOG_TRACE("chart create started");
|
||||
LV_LOG_TRACE("chart create started");
|
||||
|
||||
/*Create the ancestor basic object*/
|
||||
lv_obj_t * new_chart = lv_obj_create(par, copy);
|
||||
@ -115,7 +115,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_refresh_style(new_chart);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("chart created");
|
||||
LV_LOG_INFO("chart created");
|
||||
|
||||
|
||||
return new_chart;
|
||||
@ -135,7 +135,7 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
lv_chart_series_t * ser = lv_ll_ins_head(&ext->series_ll);
|
||||
lv_mem_assert(ser);
|
||||
lv_mem_assert(ser);
|
||||
if(ser == NULL) return NULL;
|
||||
|
||||
lv_coord_t def = (ext->ymin + ext->ymax) >> 1; /*half range as default value*/
|
||||
@ -147,9 +147,9 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color)
|
||||
ser->points = lv_mem_alloc(sizeof(lv_coord_t) * ext->point_cnt);
|
||||
lv_mem_assert(ser->points);
|
||||
if(ser->points == NULL) {
|
||||
lv_ll_rem(&ext->series_ll, ser);
|
||||
lv_mem_free(ser);
|
||||
return NULL;
|
||||
lv_ll_rem(&ext->series_ll, ser);
|
||||
lv_mem_free(ser);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint16_t i;
|
||||
|
@ -64,7 +64,7 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
|
||||
|
||||
LV_LOG_TRACE("container create started");
|
||||
LV_LOG_TRACE("container create started");
|
||||
|
||||
/*Create a basic object*/
|
||||
lv_obj_t * new_cont = lv_obj_create(par, copy);
|
||||
@ -105,10 +105,10 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_refresh_style(new_cont);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("container created");
|
||||
LV_LOG_INFO("container created");
|
||||
|
||||
|
||||
return new_cont;
|
||||
return new_cont;
|
||||
}
|
||||
|
||||
/*=====================
|
||||
@ -301,7 +301,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
|
||||
if(lv_obj_get_hidden(child) != false ||
|
||||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
|
||||
|
||||
lv_obj_align(child, cont, align, hpad_corr , last_cord);
|
||||
lv_obj_align(child, cont, align, hpad_corr, last_cord);
|
||||
last_cord += lv_obj_get_height(child) + style->body.padding.inner;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ typedef struct
|
||||
uint8_t layout :4; /*A layout from 'lv_cont_layout_t' enum*/
|
||||
uint8_t hor_fit :1; /*1: Enable horizontal fit to involve all children*/
|
||||
uint8_t ver_fit :1; /*1: Enable horizontal fit to involve all children*/
|
||||
}lv_cont_ext_t;
|
||||
} lv_cont_ext_t;
|
||||
|
||||
|
||||
/**********************
|
||||
|
@ -66,7 +66,7 @@ static lv_design_func_t ancestor_design;
|
||||
*/
|
||||
lv_obj_t * lv_ddlist_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("drop down list create started");
|
||||
LV_LOG_TRACE("drop down list create started");
|
||||
|
||||
/*Create the ancestor drop down list*/
|
||||
lv_obj_t * new_ddlist = lv_page_create(par, copy);
|
||||
@ -141,7 +141,7 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_refresh_style(new_ddlist);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("drop down list created");
|
||||
LV_LOG_INFO("drop down list created");
|
||||
|
||||
|
||||
return new_ddlist;
|
||||
@ -472,30 +472,30 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_desig
|
||||
|
||||
/*Redraw only in opened state*/
|
||||
if(ext->opened) {
|
||||
lv_style_t * style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_BG);
|
||||
const lv_font_t * font = style->text.font;
|
||||
lv_coord_t font_h = lv_font_get_height(font);
|
||||
lv_style_t * style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_BG);
|
||||
const lv_font_t * font = style->text.font;
|
||||
lv_coord_t font_h = lv_font_get_height(font);
|
||||
|
||||
lv_area_t area_sel;
|
||||
area_sel.y1 = ext->label->coords.y1;
|
||||
area_sel.y1 += ext->sel_opt_id * (font_h + style->text.line_space);
|
||||
area_sel.y1 -= style->text.line_space / 2;
|
||||
lv_area_t area_sel;
|
||||
area_sel.y1 = ext->label->coords.y1;
|
||||
area_sel.y1 += ext->sel_opt_id * (font_h + style->text.line_space);
|
||||
area_sel.y1 -= style->text.line_space / 2;
|
||||
|
||||
area_sel.y2 = area_sel.y1 + font_h + style->text.line_space - 1;
|
||||
area_sel.x1 = ddlist->coords.x1;
|
||||
area_sel.x2 = ddlist->coords.x2;
|
||||
lv_area_t mask_sel;
|
||||
bool area_ok;
|
||||
area_ok = lv_area_intersect(&mask_sel, mask, &area_sel);
|
||||
if(area_ok) {
|
||||
lv_style_t * sel_style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_SEL);
|
||||
lv_style_t new_style;
|
||||
lv_style_copy(&new_style, style);
|
||||
new_style.text.color = sel_style->text.color;
|
||||
new_style.text.opa = sel_style->text.opa;
|
||||
lv_draw_label(&ext->label->coords, &mask_sel, &new_style, opa_scale,
|
||||
lv_label_get_text(ext->label), LV_TXT_FLAG_NONE, NULL);
|
||||
}
|
||||
area_sel.y2 = area_sel.y1 + font_h + style->text.line_space - 1;
|
||||
area_sel.x1 = ddlist->coords.x1;
|
||||
area_sel.x2 = ddlist->coords.x2;
|
||||
lv_area_t mask_sel;
|
||||
bool area_ok;
|
||||
area_ok = lv_area_intersect(&mask_sel, mask, &area_sel);
|
||||
if(area_ok) {
|
||||
lv_style_t * sel_style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_SEL);
|
||||
lv_style_t new_style;
|
||||
lv_style_copy(&new_style, style);
|
||||
new_style.text.color = sel_style->text.color;
|
||||
new_style.text.opa = sel_style->text.opa;
|
||||
lv_draw_label(&ext->label->coords, &mask_sel, &new_style, opa_scale,
|
||||
lv_label_get_text(ext->label), LV_TXT_FLAG_NONE, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*Draw the scrollbar in the ancestor page design function*/
|
||||
@ -545,8 +545,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
lv_ddlist_refr_size(ddlist, true);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/*Open the list if closed*/
|
||||
if(!ext->opened) {
|
||||
ext->opened = true;
|
||||
@ -604,8 +603,8 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
}
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
|
@ -60,7 +60,7 @@ static lv_signal_func_t ancestor_signal;
|
||||
*/
|
||||
lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("gauge create started");
|
||||
LV_LOG_TRACE("gauge create started");
|
||||
|
||||
/*Create the ancestor gauge*/
|
||||
lv_obj_t * new_gauge = lv_lmeter_create(par, copy);
|
||||
@ -113,7 +113,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_refresh_style(new_gauge);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("gauge created");
|
||||
LV_LOG_INFO("gauge created");
|
||||
|
||||
return new_gauge;
|
||||
}
|
||||
|
@ -127,10 +127,17 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
|
||||
|
||||
#if LV_LOG_LEVEL >= LV_LOG_LEVEL_INFO
|
||||
switch(src_type) {
|
||||
case LV_IMG_SRC_FILE: LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_FILE` type found"); break;
|
||||
case LV_IMG_SRC_VARIABLE: LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_VARIABLE` type found"); break;
|
||||
case LV_IMG_SRC_SYMBOL: LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_SYMBOL` type found"); break;
|
||||
default: LV_LOG_WARN("lv_img_set_src: unknown type");
|
||||
case LV_IMG_SRC_FILE:
|
||||
LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_FILE` type found");
|
||||
break;
|
||||
case LV_IMG_SRC_VARIABLE:
|
||||
LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_VARIABLE` type found");
|
||||
break;
|
||||
case LV_IMG_SRC_SYMBOL:
|
||||
LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_SYMBOL` type found");
|
||||
break;
|
||||
default:
|
||||
LV_LOG_WARN("lv_img_set_src: unknown type");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -45,7 +45,7 @@ typedef struct
|
||||
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 cf :5; /*Color format from `lv_img_color_format_t`*/
|
||||
uint8_t cf :5; /*Color format from `lv_img_color_format_t`*/
|
||||
} lv_img_ext_t;
|
||||
|
||||
/**********************
|
||||
|
@ -46,7 +46,7 @@ static lv_design_func_t ancestor_design;
|
||||
*/
|
||||
lv_obj_t * lv_imgbtn_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("image button create started");
|
||||
LV_LOG_TRACE("image button create started");
|
||||
|
||||
/*Create the ancestor of image button*/
|
||||
lv_obj_t * new_imgbtn = lv_btn_create(par, copy);
|
||||
@ -89,7 +89,7 @@ lv_obj_t * lv_imgbtn_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_refresh_style(new_imgbtn);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("image button created");
|
||||
LV_LOG_INFO("image button created");
|
||||
|
||||
return new_imgbtn;
|
||||
}
|
||||
@ -223,8 +223,7 @@ static lv_res_t lv_imgbtn_signal(lv_obj_t * imgbtn, lv_signal_t sign, void * par
|
||||
/* If the style changed then the button was clicked, released etc. so probably the state was changed as well
|
||||
* Set the new image for the new state.*/
|
||||
refr_img(imgbtn);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
} else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
|
@ -75,7 +75,7 @@ static const char * kb_map_num[] = {
|
||||
*/
|
||||
lv_obj_t * lv_kb_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("keyboard create started");
|
||||
LV_LOG_TRACE("keyboard create started");
|
||||
|
||||
/*Create the ancestor of keyboard*/
|
||||
lv_obj_t * new_kb = lv_btnm_create(par, copy);
|
||||
@ -135,7 +135,7 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
|
||||
LV_LOG_INFO("keyboard created");
|
||||
LV_LOG_INFO("keyboard created");
|
||||
|
||||
|
||||
return new_kb;
|
||||
|
@ -64,7 +64,7 @@ static lv_signal_func_t ancestor_signal;
|
||||
*/
|
||||
lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("label create started");
|
||||
LV_LOG_TRACE("label create started");
|
||||
|
||||
/*Create a basic object*/
|
||||
lv_obj_t * new_label = lv_obj_create(par, copy);
|
||||
@ -126,7 +126,7 @@ lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
|
||||
LV_LOG_INFO("label created");
|
||||
LV_LOG_INFO("label created");
|
||||
|
||||
return new_label;
|
||||
}
|
||||
@ -469,11 +469,10 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t index, lv_point_t
|
||||
font, style->text.letter_space, flag);
|
||||
x += lv_obj_get_width(label) / 2 - line_w / 2;
|
||||
|
||||
}
|
||||
else if(ext->align == LV_LABEL_ALIGN_RIGHT) {
|
||||
lv_coord_t line_w;
|
||||
line_w = lv_txt_get_width(&txt[line_start], new_line_start - line_start,
|
||||
font, style->text.letter_space, flag);
|
||||
} else if(ext->align == LV_LABEL_ALIGN_RIGHT) {
|
||||
lv_coord_t line_w;
|
||||
line_w = lv_txt_get_width(&txt[line_start], new_line_start - line_start,
|
||||
font, style->text.letter_space, flag);
|
||||
|
||||
x += lv_obj_get_width(label) - line_w;
|
||||
}
|
||||
@ -515,8 +514,8 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
|
||||
while(txt[line_start] != '\0') {
|
||||
new_line_start += lv_txt_get_next_line(&txt[line_start], font, style->text.letter_space, max_w, flag);
|
||||
|
||||
if(pos->y <= y + letter_height) break; /*The line is found (stored in 'line_start')*/
|
||||
y += letter_height + style->text.line_space;
|
||||
if(pos->y <= y + letter_height) break; /*The line is found (stored in 'line_start')*/
|
||||
y += letter_height + style->text.line_space;
|
||||
|
||||
line_start = new_line_start;
|
||||
}
|
||||
@ -667,7 +666,7 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_
|
||||
}
|
||||
|
||||
/*TEST: draw a background for the label*/
|
||||
//lv_draw_rect(&label->coords, mask, &lv_style_plain_color, LV_OPA_COVER);
|
||||
//lv_draw_rect(&label->coords, mask, &lv_style_plain_color, LV_OPA_COVER);
|
||||
|
||||
lv_txt_flag_t flag = LV_TXT_FLAG_NONE;
|
||||
if(ext->recolor != 0) flag |= LV_TXT_FLAG_RECOLOR;
|
||||
@ -678,13 +677,13 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_
|
||||
/* In ROLL mode the CENTER and RIGHT are pointless so remove them.
|
||||
* (In addition they will result mis-alignment is this case)*/
|
||||
if((ext->long_mode == LV_LABEL_LONG_ROLL) &&
|
||||
(ext->align == LV_LABEL_ALIGN_CENTER || ext->align == LV_LABEL_ALIGN_RIGHT)) {
|
||||
lv_point_t size;
|
||||
lv_txt_get_size(&size, ext->text, style->text.font, style->text.letter_space, style->text.line_space, LV_COORD_MAX ,flag);
|
||||
if(size.x > lv_obj_get_width(label)) {
|
||||
flag &= ~LV_TXT_FLAG_RIGHT;
|
||||
flag &= ~LV_TXT_FLAG_CENTER;
|
||||
}
|
||||
(ext->align == LV_LABEL_ALIGN_CENTER || ext->align == LV_LABEL_ALIGN_RIGHT)) {
|
||||
lv_point_t size;
|
||||
lv_txt_get_size(&size, ext->text, style->text.font, style->text.letter_space, style->text.line_space, LV_COORD_MAX, flag);
|
||||
if(size.x > lv_obj_get_width(label)) {
|
||||
flag &= ~LV_TXT_FLAG_RIGHT;
|
||||
flag &= ~LV_TXT_FLAG_CENTER;
|
||||
}
|
||||
}
|
||||
|
||||
lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ext->offset);
|
||||
|
@ -52,7 +52,7 @@ static lv_signal_func_t ancestor_signal;
|
||||
*/
|
||||
lv_obj_t * lv_led_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("led create started");
|
||||
LV_LOG_TRACE("led create started");
|
||||
|
||||
/*Create the ancestor basic object*/
|
||||
lv_obj_t * new_led = lv_obj_create(par, copy);
|
||||
@ -94,7 +94,7 @@ lv_obj_t * lv_led_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
|
||||
LV_LOG_INFO("led created");
|
||||
LV_LOG_INFO("led created");
|
||||
|
||||
return new_led;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ static lv_signal_func_t ancestor_signal;
|
||||
*/
|
||||
lv_obj_t * lv_line_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("line create started");
|
||||
LV_LOG_TRACE("line create started");
|
||||
|
||||
/*Create a basic object*/
|
||||
lv_obj_t * new_line = lv_obj_create(par, copy);
|
||||
@ -90,7 +90,7 @@ lv_obj_t * lv_line_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
|
||||
LV_LOG_INFO("line created");
|
||||
LV_LOG_INFO("line created");
|
||||
|
||||
return new_line;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ static lv_obj_t * last_clicked_btn;
|
||||
*/
|
||||
lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("list create started");
|
||||
LV_LOG_TRACE("list create started");
|
||||
|
||||
/*Create the ancestor basic object*/
|
||||
lv_obj_t * new_list = lv_page_create(par, copy);
|
||||
@ -119,14 +119,14 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
lv_obj_t * copy_btn = lv_list_get_next_btn(copy, NULL);
|
||||
while(copy_btn) {
|
||||
const void * img_src = NULL;
|
||||
const void * img_src = NULL;
|
||||
#if USE_LV_IMG
|
||||
lv_obj_t * copy_img = lv_list_get_btn_img(copy_btn);
|
||||
if(copy_img) img_src = lv_img_get_src(copy_img);
|
||||
#endif
|
||||
lv_list_add(new_list, img_src, lv_list_get_btn_text(copy_btn), lv_btn_get_action(copy_btn, LV_BTN_ACTION_CLICK));
|
||||
// new_btn = lv_btn_create(new_list, copy_btn);
|
||||
copy_btn = lv_list_get_next_btn(copy, copy_btn);
|
||||
lv_list_add(new_list, img_src, lv_list_get_btn_text(copy_btn), lv_btn_get_action(copy_btn, LV_BTN_ACTION_CLICK));
|
||||
// new_btn = lv_btn_create(new_list, copy_btn);
|
||||
copy_btn = lv_list_get_next_btn(copy, copy_btn);
|
||||
}
|
||||
|
||||
lv_list_set_style(new_list, LV_LIST_STYLE_BTN_REL, copy_ext->styles_btn[LV_BTN_STATE_REL]);
|
||||
@ -140,7 +140,7 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
|
||||
LV_LOG_INFO("list created");
|
||||
LV_LOG_INFO("list created");
|
||||
|
||||
|
||||
return new_list;
|
||||
@ -236,23 +236,23 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const void * img_src, const char * txt,
|
||||
*/
|
||||
void lv_list_set_btn_selected(lv_obj_t * list, lv_obj_t * btn)
|
||||
{
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
|
||||
if(ext->selected_btn) {
|
||||
lv_btn_state_t s = lv_btn_get_state(ext->selected_btn);
|
||||
if(s == LV_BTN_STATE_PR) lv_btn_set_state(ext->selected_btn, LV_BTN_STATE_REL);
|
||||
else if(s == LV_BTN_STATE_TGL_PR) lv_btn_set_state(ext->selected_btn, LV_BTN_STATE_TGL_REL);
|
||||
}
|
||||
if(ext->selected_btn) {
|
||||
lv_btn_state_t s = lv_btn_get_state(ext->selected_btn);
|
||||
if(s == LV_BTN_STATE_PR) lv_btn_set_state(ext->selected_btn, LV_BTN_STATE_REL);
|
||||
else if(s == LV_BTN_STATE_TGL_PR) lv_btn_set_state(ext->selected_btn, LV_BTN_STATE_TGL_REL);
|
||||
}
|
||||
|
||||
ext->selected_btn = btn;
|
||||
ext->selected_btn = btn;
|
||||
|
||||
if(ext->selected_btn) {
|
||||
lv_btn_state_t s = lv_btn_get_state(ext->selected_btn);
|
||||
if(s == LV_BTN_STATE_REL) lv_btn_set_state(ext->selected_btn, LV_BTN_STATE_PR);
|
||||
else if(s == LV_BTN_STATE_TGL_REL) lv_btn_set_state(ext->selected_btn, LV_BTN_STATE_TGL_PR);
|
||||
if(ext->selected_btn) {
|
||||
lv_btn_state_t s = lv_btn_get_state(ext->selected_btn);
|
||||
if(s == LV_BTN_STATE_REL) lv_btn_set_state(ext->selected_btn, LV_BTN_STATE_PR);
|
||||
else if(s == LV_BTN_STATE_TGL_REL) lv_btn_set_state(ext->selected_btn, LV_BTN_STATE_TGL_PR);
|
||||
|
||||
lv_page_focus(list, ext->selected_btn, ext->anim_time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -448,7 +448,7 @@ lv_obj_t * lv_list_get_next_btn(const lv_obj_t * list, lv_obj_t * prev_btn)
|
||||
lv_obj_t * lv_list_get_btn_selected(const lv_obj_t * list)
|
||||
{
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
return ext->selected_btn;
|
||||
return ext->selected_btn;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -625,7 +625,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
res = ancestor_page_signal(list, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
|
||||
if(sign == LV_SIGNAL_CORD_CHG) {
|
||||
/*Be sure the width of the buttons are correct*/
|
||||
@ -660,24 +660,24 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_DEFOCUS) {
|
||||
/*De-select the selected btn*/
|
||||
lv_list_set_btn_selected(list, NULL);
|
||||
last_clicked_btn = NULL; /*button click will be set if click happens before focus*/
|
||||
lv_list_set_btn_selected(list, NULL);
|
||||
last_clicked_btn = NULL; /*button click will be set if click happens before focus*/
|
||||
ext->selected_btn = NULL;
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_CONTROLL) {
|
||||
char c = *((char *)param);
|
||||
if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) {
|
||||
/*If there is a valid selected button the make the previous selected*/
|
||||
if(ext->selected_btn) {
|
||||
lv_obj_t * btn_prev = lv_list_get_next_btn(list, ext->selected_btn);
|
||||
if(btn_prev) lv_list_set_btn_selected(list, btn_prev);
|
||||
}
|
||||
/*If there is no selected button the make the first selected*/
|
||||
/*If there is a valid selected button the make the previous selected*/
|
||||
if(ext->selected_btn) {
|
||||
lv_obj_t * btn_prev = lv_list_get_next_btn(list, ext->selected_btn);
|
||||
if(btn_prev) lv_list_set_btn_selected(list, btn_prev);
|
||||
}
|
||||
/*If there is no selected button the make the first selected*/
|
||||
else {
|
||||
lv_obj_t * btn = lv_list_get_next_btn(list, NULL);
|
||||
if(btn) lv_list_set_btn_selected(list, btn); /*If there are no buttons on the list then there is no first button*/
|
||||
lv_obj_t * btn = lv_list_get_next_btn(list, NULL);
|
||||
if(btn) lv_list_set_btn_selected(list, btn); /*If there are no buttons on the list then there is no first button*/
|
||||
}
|
||||
} else if(c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_UP) {
|
||||
/*If there is a valid selected button the make the next selected*/
|
||||
@ -687,8 +687,8 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
}
|
||||
/*If there is no selected button the make the first selected*/
|
||||
else {
|
||||
lv_obj_t * btn = lv_list_get_next_btn(list, NULL);
|
||||
if(btn) lv_list_set_btn_selected(list, btn);
|
||||
lv_obj_t * btn = lv_list_get_next_btn(list, NULL);
|
||||
if(btn) lv_list_set_btn_selected(list, btn);
|
||||
}
|
||||
} else if(c == LV_GROUP_KEY_ENTER) {
|
||||
/*Get the 'pressed' button*/
|
||||
@ -734,26 +734,26 @@ static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * para
|
||||
|
||||
#if USE_LV_GROUP
|
||||
if(sign == LV_SIGNAL_RELEASED) {
|
||||
lv_obj_t * list = lv_obj_get_parent(lv_obj_get_parent(btn));
|
||||
lv_group_t * g = lv_obj_get_group(list);
|
||||
if(lv_group_get_focused(g) == list && lv_indev_is_dragging(lv_indev_get_act()) == false) {
|
||||
/* Is the list is focused then be sure only the button being released
|
||||
* has a pressed state to indicate the selected state on the list*/
|
||||
lv_obj_t * btn_i = lv_list_get_prev_btn(list, NULL);
|
||||
while(btn_i) {
|
||||
lv_btn_state_t s = lv_btn_get_state(btn_i);
|
||||
if(s == LV_BTN_STATE_PR) lv_btn_set_state(btn_i, LV_BTN_STATE_REL);
|
||||
else if(s == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn_i, LV_BTN_STATE_TGL_REL);
|
||||
btn_i = lv_list_get_prev_btn(list, btn_i);
|
||||
}
|
||||
lv_obj_t * list = lv_obj_get_parent(lv_obj_get_parent(btn));
|
||||
lv_group_t * g = lv_obj_get_group(list);
|
||||
if(lv_group_get_focused(g) == list && lv_indev_is_dragging(lv_indev_get_act()) == false) {
|
||||
/* Is the list is focused then be sure only the button being released
|
||||
* has a pressed state to indicate the selected state on the list*/
|
||||
lv_obj_t * btn_i = lv_list_get_prev_btn(list, NULL);
|
||||
while(btn_i) {
|
||||
lv_btn_state_t s = lv_btn_get_state(btn_i);
|
||||
if(s == LV_BTN_STATE_PR) lv_btn_set_state(btn_i, LV_BTN_STATE_REL);
|
||||
else if(s == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn_i, LV_BTN_STATE_TGL_REL);
|
||||
btn_i = lv_list_get_prev_btn(list, btn_i);
|
||||
}
|
||||
|
||||
/*Make the released button "selected"*/
|
||||
lv_list_set_btn_selected(list, btn);
|
||||
}
|
||||
/*Make the released button "selected"*/
|
||||
lv_list_set_btn_selected(list, btn);
|
||||
}
|
||||
|
||||
/* If `click_focus == 1` then LV_SIGNAL_FOCUS need to know which button triggered the focus
|
||||
* to mark it as selected (pressed state)*/
|
||||
last_clicked_btn = btn;
|
||||
/* If `click_focus == 1` then LV_SIGNAL_FOCUS need to know which button triggered the focus
|
||||
* to mark it as selected (pressed state)*/
|
||||
last_clicked_btn = btn;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -52,12 +52,12 @@ static lv_signal_func_t ancestor_signal;
|
||||
*/
|
||||
lv_obj_t * lv_lmeter_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("line meter create started");
|
||||
LV_LOG_TRACE("line meter create started");
|
||||
|
||||
/*Create the ancestor of line meter*/
|
||||
lv_obj_t * new_lmeter = lv_obj_create(par, copy);
|
||||
lv_mem_assert(new_lmeter);
|
||||
if(new_lmeter== NULL) return NULL;
|
||||
if(new_lmeter == NULL) return NULL;
|
||||
|
||||
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_func(new_lmeter);
|
||||
|
||||
@ -102,7 +102,7 @@ lv_obj_t * lv_lmeter_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_refresh_style(new_lmeter);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("line meter created");
|
||||
LV_LOG_INFO("line meter created");
|
||||
|
||||
return new_lmeter;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ static lv_signal_func_t ancestor_signal;
|
||||
*/
|
||||
lv_obj_t * lv_mbox_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("mesasge box create started");
|
||||
LV_LOG_TRACE("mesasge box create started");
|
||||
|
||||
/*Create the ancestor message box*/
|
||||
lv_obj_t * new_mbox = lv_cont_create(par, copy);
|
||||
@ -116,7 +116,7 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
|
||||
LV_LOG_INFO("mesasge box created");
|
||||
LV_LOG_INFO("mesasge box created");
|
||||
|
||||
return new_mbox;
|
||||
}
|
||||
@ -388,9 +388,9 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
|
||||
mbox_realign(mbox);
|
||||
|
||||
} else if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS ||
|
||||
sign == LV_SIGNAL_CONTROLL || sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
sign == LV_SIGNAL_CONTROLL || sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
if(ext->btnm) {
|
||||
ext->btnm->signal_func(ext->btnm, sign, param);
|
||||
ext->btnm->signal_func(ext->btnm, sign, param);
|
||||
}
|
||||
|
||||
/* The button matrix with ENCODER input supposes it's in a group but in this case it isn't (Only the message box's container)
|
||||
@ -399,7 +399,7 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
|
||||
#if USE_LV_GROUP
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_hal_indev_type_t indev_type = lv_indev_get_type(indev);
|
||||
if (indev_type == LV_INDEV_TYPE_ENCODER){
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER) {
|
||||
/*In navigation mode don't select any button but in edit mode select the fist*/
|
||||
lv_btnm_ext_t * btnm_ext = lv_obj_get_ext_attr(ext->btnm);
|
||||
if(lv_group_get_editing(lv_obj_get_group(mbox))) btnm_ext->btn_id_pr = 0;
|
||||
|
@ -13,7 +13,7 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
//#include "lv_templ.h" /*TODO uncomment this*/
|
||||
//#include "lv_templ.h" /*TODO uncomment this*/
|
||||
#if USE_LV_TEMPL != 0
|
||||
|
||||
/*********************
|
||||
@ -52,7 +52,7 @@ static lv_design_func_t ancestor_design;
|
||||
*/
|
||||
lv_obj_t * lv_templ_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("template create started");
|
||||
LV_LOG_TRACE("template create started");
|
||||
|
||||
/*Create the ancestor of template*/
|
||||
/*TODO modify it to the ancestor create function */
|
||||
@ -86,7 +86,7 @@ lv_obj_t * lv_templ_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_refresh_style(new_templ);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("template created");
|
||||
LV_LOG_INFO("template created");
|
||||
|
||||
return new_templ;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_PAGE_SB_MIN_SIZE (LV_DPI / 8)
|
||||
#define LV_PAGE_SCROLL_ANIM_TIME 200 /*[ms] Scroll anim time on `lv_page_scroll_up/down/left/rigth`*/
|
||||
#define LV_PAGE_SCROLL_ANIM_TIME 200 /*[ms] Scroll anim time on `lv_page_scroll_up/down/left/rigth`*/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -57,7 +57,7 @@ static lv_signal_func_t ancestor_signal;
|
||||
*/
|
||||
lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("page create started");
|
||||
LV_LOG_TRACE("page create started");
|
||||
|
||||
/*Create the ancestor object*/
|
||||
lv_obj_t * new_page = lv_cont_create(par, copy);
|
||||
@ -142,7 +142,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
lv_page_sb_refresh(new_page);
|
||||
|
||||
LV_LOG_INFO("page created");
|
||||
LV_LOG_INFO("page created");
|
||||
|
||||
return new_page;
|
||||
}
|
||||
@ -193,11 +193,11 @@ 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;
|
||||
|
||||
if(sb_mode == LV_SB_MODE_HIDE) ext->sb.mode |= LV_SB_MODE_HIDE; /*Set the hidden flag*/
|
||||
else if (sb_mode == LV_SB_MODE_UNHIDE) ext->sb.mode &= (~LV_SB_MODE_HIDE); /*Clear the hidden flag*/
|
||||
if(sb_mode == LV_SB_MODE_HIDE) ext->sb.mode |= LV_SB_MODE_HIDE; /*Set the hidden flag*/
|
||||
else if(sb_mode == LV_SB_MODE_UNHIDE) ext->sb.mode &= (~LV_SB_MODE_HIDE); /*Clear the hidden flag*/
|
||||
else {
|
||||
if(ext->sb.mode & LV_SB_MODE_HIDE) sb_mode |= LV_SB_MODE_HIDE;
|
||||
ext->sb.mode = sb_mode;
|
||||
if(ext->sb.mode & LV_SB_MODE_HIDE) sb_mode |= LV_SB_MODE_HIDE;
|
||||
ext->sb.mode = sb_mode;
|
||||
}
|
||||
|
||||
ext->sb.hor_draw = 0;
|
||||
@ -424,25 +424,25 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, uint16_t anim_time)
|
||||
*/
|
||||
void lv_page_scroll_hor(lv_obj_t * page, lv_coord_t dist)
|
||||
{
|
||||
lv_obj_t * scrl = lv_page_get_scrl(page);
|
||||
lv_obj_t * scrl = lv_page_get_scrl(page);
|
||||
|
||||
#if USE_LV_ANIMATION
|
||||
lv_anim_t a;
|
||||
a.var = scrl;
|
||||
a.start = lv_obj_get_x(scrl);
|
||||
a.end = a.start + dist;
|
||||
a.fp = (lv_anim_fp_t)lv_obj_set_x;
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = LV_PAGE_SCROLL_ANIM_TIME;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
lv_anim_t a;
|
||||
a.var = scrl;
|
||||
a.start = lv_obj_get_x(scrl);
|
||||
a.end = a.start + dist;
|
||||
a.fp = (lv_anim_fp_t)lv_obj_set_x;
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = LV_PAGE_SCROLL_ANIM_TIME;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
#else
|
||||
lv_obj_set_x(scrl, lv_obj_get_x(scrl) + dist);
|
||||
lv_obj_set_x(scrl, lv_obj_get_x(scrl) + dist);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -453,25 +453,25 @@ void lv_page_scroll_hor(lv_obj_t * page, lv_coord_t dist)
|
||||
*/
|
||||
void lv_page_scroll_ver(lv_obj_t * page, lv_coord_t dist)
|
||||
{
|
||||
lv_obj_t * scrl = lv_page_get_scrl(page);
|
||||
lv_obj_t * scrl = lv_page_get_scrl(page);
|
||||
|
||||
#if USE_LV_ANIMATION
|
||||
lv_anim_t a;
|
||||
a.var = scrl;
|
||||
a.start = lv_obj_get_y(scrl);
|
||||
a.end = a.start + dist;
|
||||
a.fp = (lv_anim_fp_t)lv_obj_set_y;
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = LV_PAGE_SCROLL_ANIM_TIME;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
lv_anim_t a;
|
||||
a.var = scrl;
|
||||
a.start = lv_obj_get_y(scrl);
|
||||
a.end = a.start + dist;
|
||||
a.fp = (lv_anim_fp_t)lv_obj_set_y;
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = LV_PAGE_SCROLL_ANIM_TIME;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
#else
|
||||
lv_obj_set_y(scrl, lv_obj_get_x(scrl) + dist);
|
||||
lv_obj_set_y(scrl, lv_obj_get_x(scrl) + dist);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -663,9 +663,9 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
uint32_t c = *((uint32_t *) param);
|
||||
|
||||
if((c == LV_GROUP_KEY_DOWN) && ext->arrow_scroll) {
|
||||
lv_page_scroll_ver(page, - lv_obj_get_height(page) / 4);
|
||||
lv_page_scroll_ver(page, - lv_obj_get_height(page) / 4);
|
||||
} else if((c == LV_GROUP_KEY_UP) && ext->arrow_scroll) {
|
||||
lv_page_scroll_ver(page, lv_obj_get_height(page) / 4);
|
||||
lv_page_scroll_ver(page, lv_obj_get_height(page) / 4);
|
||||
} else if((c == LV_GROUP_KEY_RIGHT) && ext->arrow_scroll) {
|
||||
/*If the page can be scrolled horizontally because it's not wide enough then scroll it vertically*/
|
||||
if(lv_page_get_scrl_width(page) < lv_obj_get_width(page)) lv_page_scroll_ver(page, - lv_obj_get_height(page) / 4);
|
||||
@ -676,8 +676,8 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
else lv_page_scroll_hor(page, lv_obj_get_width(page) / 4);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = lv_page_get_arrow_scroll(page);
|
||||
bool * editable = (bool *)param;
|
||||
*editable = lv_page_get_arrow_scroll(page);
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
|
@ -40,12 +40,12 @@ extern "C" {
|
||||
/*Scrollbar modes: shows when should the scrollbars be visible*/
|
||||
enum
|
||||
{
|
||||
LV_SB_MODE_OFF = 0x0, /*Never show scrollbars*/
|
||||
LV_SB_MODE_ON = 0x1, /*Always show scrollbars*/
|
||||
LV_SB_MODE_DRAG = 0x2, /*Show scrollbars when page is being dragged*/
|
||||
LV_SB_MODE_AUTO = 0x3, /*Show scrollbars when the scrollable container is large enough to be scrolled*/
|
||||
LV_SB_MODE_HIDE = 0x4, /*Hide the scroll bar temporally*/
|
||||
LV_SB_MODE_UNHIDE = 0x5, /*Unhide the previously hidden scrollbar. Recover it's type too*/
|
||||
LV_SB_MODE_OFF = 0x0, /*Never show scrollbars*/
|
||||
LV_SB_MODE_ON = 0x1, /*Always show scrollbars*/
|
||||
LV_SB_MODE_DRAG = 0x2, /*Show scrollbars when page is being dragged*/
|
||||
LV_SB_MODE_AUTO = 0x3, /*Show scrollbars when the scrollable container is large enough to be scrolled*/
|
||||
LV_SB_MODE_HIDE = 0x4, /*Hide the scroll bar temporally*/
|
||||
LV_SB_MODE_UNHIDE = 0x5, /*Unhide the previously hidden scrollbar. Recover it's type too*/
|
||||
};
|
||||
typedef uint8_t lv_sb_mode_t;
|
||||
|
||||
@ -65,7 +65,7 @@ typedef struct
|
||||
uint8_t ver_draw :1; /*1: vertical scrollbar is visible now (Handled by the library)*/
|
||||
lv_sb_mode_t mode:3; /*Scrollbar visibility from 'lv_page_sb_mode_t'*/
|
||||
} sb;
|
||||
uint8_t arrow_scroll :1; /*1: Enable scrolling with LV_GROUP_KEY_LEFT/RIGHT/UP/DOWN*/
|
||||
uint8_t arrow_scroll :1; /*1: Enable scrolling with LV_GROUP_KEY_LEFT/RIGHT/UP/DOWN*/
|
||||
} lv_page_ext_t;
|
||||
|
||||
enum {
|
||||
|
@ -56,7 +56,7 @@ static lv_design_func_t ancestor_design;
|
||||
*/
|
||||
lv_obj_t * lv_preload_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("preload create started");
|
||||
LV_LOG_TRACE("preload create started");
|
||||
|
||||
/*Create the ancestor of pre loader*/
|
||||
lv_obj_t * new_preload = lv_arc_create(par, copy);
|
||||
@ -117,7 +117,7 @@ lv_obj_t * lv_preload_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
|
||||
LV_LOG_INFO("preload created");
|
||||
LV_LOG_INFO("preload created");
|
||||
|
||||
return new_preload;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ static lv_signal_func_t ancestor_scrl_signal;
|
||||
*/
|
||||
lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("roller create started");
|
||||
LV_LOG_TRACE("roller create started");
|
||||
|
||||
/*Create the ancestor of roller*/
|
||||
lv_obj_t * new_roller = lv_ddlist_create(par, copy);
|
||||
@ -112,7 +112,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
|
||||
LV_LOG_INFO("roller created");
|
||||
LV_LOG_INFO("roller created");
|
||||
|
||||
|
||||
return new_roller;
|
||||
|
@ -53,7 +53,7 @@ static lv_signal_func_t ancestor_signal;
|
||||
*/
|
||||
lv_obj_t * lv_slider_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("slider create started");
|
||||
LV_LOG_TRACE("slider create started");
|
||||
|
||||
/*Create the ancestor slider*/
|
||||
lv_obj_t * new_slider = lv_bar_create(par, copy);
|
||||
@ -104,7 +104,7 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
|
||||
LV_LOG_INFO("slider created");
|
||||
LV_LOG_INFO("slider created");
|
||||
|
||||
|
||||
return new_slider;
|
||||
@ -503,8 +503,8 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
|
||||
if(ext->action != NULL) ext->action(slider);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
|
@ -50,7 +50,7 @@ static lv_signal_func_t ancestor_signal;
|
||||
*/
|
||||
lv_obj_t * lv_sw_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("switch create started");
|
||||
LV_LOG_TRACE("switch create started");
|
||||
|
||||
/*Create the ancestor of switch*/
|
||||
lv_obj_t * new_sw = lv_slider_create(par, copy);
|
||||
@ -102,7 +102,7 @@ lv_obj_t * lv_sw_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_refresh_style(new_sw);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("switch created");
|
||||
LV_LOG_INFO("switch created");
|
||||
|
||||
return new_sw;
|
||||
}
|
||||
@ -262,8 +262,8 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
|
||||
if(slider_action) slider_action(sw);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = false; /*The ancestor slider is editable the switch is not*/
|
||||
bool * editable = (bool *)param;
|
||||
*editable = false; /*The ancestor slider is editable the switch is not*/
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
|
112
lv_objx/lv_ta.c
112
lv_objx/lv_ta.c
@ -75,7 +75,7 @@ static lv_signal_func_t scrl_signal;
|
||||
*/
|
||||
lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("text area create started");
|
||||
LV_LOG_TRACE("text area create started");
|
||||
|
||||
/*Create the ancestor object*/
|
||||
lv_obj_t * new_ta = lv_page_create(par, copy);
|
||||
@ -168,7 +168,7 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_anim_create(&a);
|
||||
#endif
|
||||
|
||||
LV_LOG_INFO("text area created");
|
||||
LV_LOG_INFO("text area created");
|
||||
|
||||
return new_ta;
|
||||
}
|
||||
@ -188,15 +188,15 @@ void lv_ta_add_char(lv_obj_t * ta, uint32_t c)
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
|
||||
if(ext->one_line && (c == '\n' || c == '\n')) {
|
||||
LV_LOG_INFO("Text area: line break ignored in one-line mode");
|
||||
return;
|
||||
LV_LOG_INFO("Text area: line break ignored in one-line mode");
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t c_uni = lv_txt_encoded_next((const char *)&c, NULL);
|
||||
|
||||
if(char_is_accepted(ta, c_uni) == false) {
|
||||
LV_LOG_INFO("Character is no accepted by the text area (too long text or not in the accepted list)");
|
||||
return;
|
||||
LV_LOG_INFO("Character is no accepted by the text area (too long text or not in the accepted list)");
|
||||
return;
|
||||
}
|
||||
|
||||
if(ext->pwd_mode != 0) pwd_char_hider(ta); /*Make sure all the current text contains only '*'*/
|
||||
@ -252,12 +252,12 @@ void lv_ta_add_text(lv_obj_t * ta, const char * txt)
|
||||
|
||||
/*Add the character one-by-one if not all characters are accepted or there is character limit.*/
|
||||
if(lv_ta_get_accepted_chars(ta) || lv_ta_get_max_length(ta)) {
|
||||
uint32_t i = 0;
|
||||
while(txt[i] != '\0') {
|
||||
uint32_t c = lv_txt_encoded_next(txt, &i);
|
||||
lv_ta_add_char(ta,lv_txt_unicode_to_encoded(c));
|
||||
}
|
||||
return;
|
||||
uint32_t i = 0;
|
||||
while(txt[i] != '\0') {
|
||||
uint32_t c = lv_txt_encoded_next(txt, &i);
|
||||
lv_ta_add_char(ta, lv_txt_unicode_to_encoded(c));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*Insert the text*/
|
||||
@ -347,20 +347,20 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt)
|
||||
{
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
|
||||
/*Add the character one-by-one if not all characters are accepted or there is character limit.*/
|
||||
if(lv_ta_get_accepted_chars(ta) || lv_ta_get_max_length(ta)) {
|
||||
lv_label_set_text(ext->label, "");
|
||||
lv_ta_set_cursor_pos(ta, LV_TA_CURSOR_LAST);
|
||||
/*Add the character one-by-one if not all characters are accepted or there is character limit.*/
|
||||
if(lv_ta_get_accepted_chars(ta) || lv_ta_get_max_length(ta)) {
|
||||
lv_label_set_text(ext->label, "");
|
||||
lv_ta_set_cursor_pos(ta, LV_TA_CURSOR_LAST);
|
||||
|
||||
uint32_t i = 0;
|
||||
while(txt[i] != '\0') {
|
||||
uint32_t c = lv_txt_encoded_next(txt, &i);
|
||||
lv_ta_add_char(ta,lv_txt_unicode_to_encoded(c));
|
||||
}
|
||||
} else {
|
||||
lv_label_set_text(ext->label, txt);
|
||||
lv_ta_set_cursor_pos(ta, LV_TA_CURSOR_LAST);
|
||||
}
|
||||
uint32_t i = 0;
|
||||
while(txt[i] != '\0') {
|
||||
uint32_t c = lv_txt_encoded_next(txt, &i);
|
||||
lv_ta_add_char(ta, lv_txt_unicode_to_encoded(c));
|
||||
}
|
||||
} else {
|
||||
lv_label_set_text(ext->label, txt);
|
||||
lv_ta_set_cursor_pos(ta, LV_TA_CURSOR_LAST);
|
||||
}
|
||||
|
||||
/*Don't let 'width == 0' because the cursor will not be visible*/
|
||||
if(lv_obj_get_width(ext->label) == 0) {
|
||||
@ -738,8 +738,8 @@ const char * lv_ta_get_accepted_chars(lv_obj_t * ta)
|
||||
*/
|
||||
uint16_t lv_ta_get_max_length(lv_obj_t * ta)
|
||||
{
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
return ext->max_length;
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
return ext->max_length;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1083,17 +1083,17 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_CONTROLL) {
|
||||
uint32_t c = *((uint32_t *)param); /*uint32_t because can be UTF-8*/
|
||||
if(c == LV_GROUP_KEY_RIGHT) lv_ta_cursor_right(ta);
|
||||
if(c == LV_GROUP_KEY_RIGHT) lv_ta_cursor_right(ta);
|
||||
else if(c == LV_GROUP_KEY_LEFT) lv_ta_cursor_left(ta);
|
||||
else if(c == LV_GROUP_KEY_UP) lv_ta_cursor_up(ta);
|
||||
else if(c == LV_GROUP_KEY_UP) lv_ta_cursor_up(ta);
|
||||
else if(c == LV_GROUP_KEY_DOWN) lv_ta_cursor_down(ta);
|
||||
else if(c == LV_GROUP_KEY_DEL) lv_ta_del_char(ta);
|
||||
else if(c == LV_GROUP_KEY_DEL) lv_ta_del_char(ta);
|
||||
else {
|
||||
lv_ta_add_char(ta, c);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
@ -1101,15 +1101,11 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_ta";
|
||||
}
|
||||
else if (sign == LV_SIGNAL_DEFOCUS)
|
||||
{
|
||||
} else if(sign == LV_SIGNAL_DEFOCUS) {
|
||||
lv_cursor_type_t cur_type;
|
||||
cur_type = lv_ta_get_cursor_type(ta);
|
||||
lv_ta_set_cursor_type(ta, cur_type | LV_CURSOR_HIDDEN);
|
||||
}
|
||||
else if (sign == LV_SIGNAL_FOCUS)
|
||||
{
|
||||
} else if(sign == LV_SIGNAL_FOCUS) {
|
||||
lv_cursor_type_t cur_type;
|
||||
cur_type = lv_ta_get_cursor_type(ta);
|
||||
lv_ta_set_cursor_type(ta, cur_type & (~LV_CURSOR_HIDDEN));
|
||||
@ -1210,30 +1206,30 @@ static void pwd_char_hider(lv_obj_t * ta)
|
||||
*/
|
||||
static bool char_is_accepted(lv_obj_t * ta, uint32_t c)
|
||||
{
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
|
||||
/*If no restriction accept it*/
|
||||
if(ext->accapted_chars == NULL && ext->max_length == 0) return true;
|
||||
/*If no restriction accept it*/
|
||||
if(ext->accapted_chars == NULL && ext->max_length == 0) return true;
|
||||
|
||||
/*Too many characters?*/
|
||||
if(ext->max_length > 0 &&
|
||||
lv_txt_get_encoded_length(lv_ta_get_text(ta)) >= ext->max_length) {
|
||||
return false;
|
||||
}
|
||||
/*Too many characters?*/
|
||||
if(ext->max_length > 0 &&
|
||||
lv_txt_get_encoded_length(lv_ta_get_text(ta)) >= ext->max_length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*Accepted character?*/
|
||||
if(ext->accapted_chars) {
|
||||
uint32_t i = 0;
|
||||
uint32_t a;
|
||||
while(ext->accapted_chars[i] != '\0') {
|
||||
a = lv_txt_encoded_next(ext->accapted_chars, &i);
|
||||
if(a == c) return true; /*Accepted*/
|
||||
}
|
||||
/*Accepted character?*/
|
||||
if(ext->accapted_chars) {
|
||||
uint32_t i = 0;
|
||||
uint32_t a;
|
||||
while(ext->accapted_chars[i] != '\0') {
|
||||
a = lv_txt_encoded_next(ext->accapted_chars, &i);
|
||||
if(a == c) return true; /*Accepted*/
|
||||
}
|
||||
|
||||
return false; /*The character wasn't in the list*/
|
||||
} else {
|
||||
return true; /*If the accepted char list in not specified the accept the character*/
|
||||
}
|
||||
return false; /*The character wasn't in the list*/
|
||||
} else {
|
||||
return true; /*If the accepted char list in not specified the accept the character*/
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -61,7 +61,7 @@ typedef struct
|
||||
lv_obj_t * label; /*Label of the text area*/
|
||||
char * pwd_tmp; /*Used to store the original text in password mode*/
|
||||
const char * accapted_chars;/*Only these characters will be accepted. NULL: accept all*/
|
||||
uint16_t max_length; /*The max. number of characters. 0: no limit*/
|
||||
uint16_t max_length; /*The max. number of characters. 0: no limit*/
|
||||
uint8_t pwd_mode :1; /*Replace characters with '*' */
|
||||
uint8_t one_line :1; /*One line mode (ignore line breaks)*/
|
||||
struct {
|
||||
@ -190,7 +190,7 @@ void lv_ta_set_max_length(lv_obj_t * ta, uint16_t num);
|
||||
*/
|
||||
static inline void lv_ta_set_action(lv_obj_t * ta, lv_action_t action)
|
||||
{
|
||||
lv_page_set_rel_action(ta, action);
|
||||
lv_page_set_rel_action(ta, action);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -285,7 +285,7 @@ uint16_t lv_ta_get_max_length(lv_obj_t * ta);
|
||||
*/
|
||||
static inline lv_action_t lv_ta_get_action(lv_obj_t * ta)
|
||||
{
|
||||
return lv_page_get_rel_action(ta);
|
||||
return lv_page_get_rel_action(ta);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +66,7 @@ static const char * tab_def[] = {""};
|
||||
*/
|
||||
lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("tab view create started");
|
||||
LV_LOG_TRACE("tab view create started");
|
||||
|
||||
/*Create the ancestor of tab*/
|
||||
lv_obj_t * new_tabview = lv_obj_create(par, copy);
|
||||
@ -99,11 +99,11 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
/*Init the new tab tab*/
|
||||
if(copy == NULL) {
|
||||
ext->tab_name_ptr = lv_mem_alloc(sizeof(char *));
|
||||
lv_mem_assert(ext->tab_name_ptr);
|
||||
if(ext->tab_name_ptr == NULL) return NULL;
|
||||
ext->tab_name_ptr[0] = "";
|
||||
ext->tab_cnt = 0;
|
||||
ext->tab_name_ptr = lv_mem_alloc(sizeof(char *));
|
||||
lv_mem_assert(ext->tab_name_ptr);
|
||||
if(ext->tab_name_ptr == NULL) return NULL;
|
||||
ext->tab_name_ptr[0] = "";
|
||||
ext->tab_cnt = 0;
|
||||
|
||||
lv_obj_set_size(new_tabview, LV_HOR_RES, LV_VER_RES);
|
||||
|
||||
@ -174,7 +174,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
|
||||
LV_LOG_INFO("tab view created");
|
||||
LV_LOG_INFO("tab view created");
|
||||
|
||||
return new_tabview;
|
||||
}
|
||||
@ -581,8 +581,8 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
ext->btns->signal_func(ext->btns, sign, param);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
|
@ -46,7 +46,7 @@ static lv_signal_func_t ancestor_signal;
|
||||
*/
|
||||
lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("window create started");
|
||||
LV_LOG_TRACE("window create started");
|
||||
|
||||
/*Create the ancestor object*/
|
||||
lv_obj_t * new_win = lv_obj_create(par, copy);
|
||||
@ -137,7 +137,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
lv_win_realign(new_win);
|
||||
|
||||
LV_LOG_INFO("window created");
|
||||
LV_LOG_INFO("window created");
|
||||
|
||||
return new_win;
|
||||
}
|
||||
@ -233,7 +233,7 @@ void lv_win_set_btn_size(lv_obj_t * win, lv_coord_t size)
|
||||
* @param win pointer to a window object
|
||||
* @param layout the layout from 'lv_layout_t'
|
||||
*/
|
||||
void lv_win_set_layout(lv_obj_t *win, lv_layout_t layout)
|
||||
void lv_win_set_layout(lv_obj_t * win, lv_layout_t layout)
|
||||
{
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
lv_page_set_scrl_layout(ext->page, layout);
|
||||
@ -244,7 +244,7 @@ void lv_win_set_layout(lv_obj_t *win, lv_layout_t layout)
|
||||
* @param win pointer to a window object
|
||||
* @param sb_mode the new scroll bar mode from 'lv_sb_mode_t'
|
||||
*/
|
||||
void lv_win_set_sb_mode(lv_obj_t *win, lv_sb_mode_t sb_mode)
|
||||
void lv_win_set_sb_mode(lv_obj_t * win, lv_sb_mode_t sb_mode)
|
||||
{
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
lv_page_set_sb_mode(ext->page, sb_mode);
|
||||
@ -356,7 +356,7 @@ lv_obj_t * lv_win_get_from_btn(const lv_obj_t * ctrl_btn)
|
||||
* @param win pointer to a window object
|
||||
* @return the layout of the window (from 'lv_layout_t')
|
||||
*/
|
||||
lv_layout_t lv_win_get_layout(lv_obj_t *win)
|
||||
lv_layout_t lv_win_get_layout(lv_obj_t * win)
|
||||
{
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
return lv_page_get_scrl_layout(ext->page);
|
||||
@ -367,7 +367,7 @@ lv_layout_t lv_win_get_layout(lv_obj_t *win)
|
||||
* @param win pointer to a window object
|
||||
* @return the scroll bar mode of the window (from 'lv_sb_mode_t')
|
||||
*/
|
||||
lv_sb_mode_t lv_win_get_sb_mode(lv_obj_t *win)
|
||||
lv_sb_mode_t lv_win_get_sb_mode(lv_obj_t * win)
|
||||
{
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
return lv_page_get_sb_mode(ext->page);
|
||||
@ -483,12 +483,10 @@ static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
|
||||
ext->header = NULL; /*These objects were children so they are already invalid*/
|
||||
ext->page = NULL;
|
||||
ext->title = NULL;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROLL) {
|
||||
/*Forward all the control signals to the page*/
|
||||
ext->page->signal_func(ext->page, sign, param);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
} else if(sign == LV_SIGNAL_CONTROLL) {
|
||||
/*Forward all the control signals to the page*/
|
||||
ext->page->signal_func(ext->page, sign, param);
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
|
@ -239,8 +239,8 @@ void lv_win_focus(lv_obj_t * win, lv_obj_t * obj, uint16_t anim_time);
|
||||
*/
|
||||
static inline void lv_win_scroll_hor(lv_obj_t * win, lv_coord_t dist)
|
||||
{
|
||||
lv_win_ext_t * ext = (lv_win_ext_t *)lv_obj_get_ext_attr(win);
|
||||
lv_page_scroll_hor(ext->page, dist);
|
||||
lv_win_ext_t * ext = (lv_win_ext_t *)lv_obj_get_ext_attr(win);
|
||||
lv_page_scroll_hor(ext->page, dist);
|
||||
}
|
||||
/**
|
||||
* Scroll the window vertically
|
||||
@ -249,8 +249,8 @@ static inline void lv_win_scroll_hor(lv_obj_t * win, lv_coord_t dist)
|
||||
*/
|
||||
static inline void lv_win_scroll_ver(lv_obj_t * win, lv_coord_t dist)
|
||||
{
|
||||
lv_win_ext_t * ext = (lv_win_ext_t *)lv_obj_get_ext_attr(win);
|
||||
lv_page_scroll_ver(ext->page, dist);
|
||||
lv_win_ext_t * ext = (lv_win_ext_t *)lv_obj_get_ext_attr(win);
|
||||
lv_page_scroll_ver(ext->page, dist);
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
@ -55,12 +55,12 @@ static lv_theme_t current_theme;
|
||||
* From now, all the created objects will use styles from this theme by default
|
||||
* @param th pointer to theme (return value of: 'lv_theme_init_xxx()')
|
||||
*/
|
||||
void lv_theme_set_current(lv_theme_t *th)
|
||||
void lv_theme_set_current(lv_theme_t * th)
|
||||
{
|
||||
#if LV_THEME_LIVE_UPDATE == 0
|
||||
current_theme = th;
|
||||
#else
|
||||
uint32_t style_num = sizeof(lv_theme_t) / sizeof(lv_style_t*); /*Number of styles in a theme*/
|
||||
uint32_t style_num = sizeof(lv_theme_t) / sizeof(lv_style_t *); /*Number of styles in a theme*/
|
||||
|
||||
if(!inited) {
|
||||
/*It's not sure `th_styles` is big enough. Check it now!*/
|
||||
@ -74,7 +74,7 @@ void lv_theme_set_current(lv_theme_t *th)
|
||||
lv_style_t ** cur_th_style_p = (lv_style_t **) ¤t_theme;
|
||||
for(i = 0; i < style_num; i++) {
|
||||
uint64_t adr = (uint64_t)&th_styles[i];
|
||||
memcpy(&cur_th_style_p[i], &adr, sizeof(lv_style_t*));
|
||||
memcpy(&cur_th_style_p[i], &adr, sizeof(lv_style_t *));
|
||||
}
|
||||
inited = true;
|
||||
}
|
||||
@ -85,7 +85,7 @@ void lv_theme_set_current(lv_theme_t *th)
|
||||
lv_style_t ** th_style = (lv_style_t **) th;
|
||||
for(i = 0; i < style_num; i++) {
|
||||
uint64_t s = (uint64_t)th_style[i];
|
||||
if(s) memcpy(&th_styles[i], (void*)s, sizeof(lv_style_t));
|
||||
if(s) memcpy(&th_styles[i], (void *)s, sizeof(lv_style_t));
|
||||
}
|
||||
|
||||
/*Let the object know their style might change*/
|
||||
|
@ -137,7 +137,7 @@ typedef struct {
|
||||
lv_style_t *inactive_days;
|
||||
lv_style_t *week_box;
|
||||
lv_style_t *today_box;
|
||||
}calendar;
|
||||
} calendar;
|
||||
#endif
|
||||
|
||||
#if USE_LV_CB != 0
|
||||
|
@ -450,7 +450,7 @@ static void calendar_init(void)
|
||||
theme.calendar.today_box = &today_box;
|
||||
theme.calendar.day_names = &color_text;
|
||||
theme.calendar.highlighted_days = &color_text;
|
||||
theme.calendar.inactive_days= &gray_text;
|
||||
theme.calendar.inactive_days = &gray_text;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -289,7 +289,7 @@ static void led_init(void)
|
||||
lv_style_copy(&led, &lv_style_pretty_color);
|
||||
led.body.shadow.width = LV_DPI / 10;
|
||||
led.body.radius = LV_RADIUS_CIRCLE;
|
||||
led.body.border.width= LV_DPI / 30;
|
||||
led.body.border.width = LV_DPI / 30;
|
||||
led.body.border.opa = LV_OPA_30;
|
||||
led.body.main_color = lv_color_hsv_to_rgb(_hue, 100, 100);
|
||||
led.body.grad_color = lv_color_hsv_to_rgb(_hue, 100, 40);
|
||||
@ -444,7 +444,7 @@ static void calendar_init(void)
|
||||
theme.calendar.highlighted_days = theme.label.sec;
|
||||
theme.calendar.week_box = &week_box;
|
||||
theme.calendar.today_box = &week_box;
|
||||
theme.calendar.header_pr= theme.label.prim;
|
||||
theme.calendar.header_pr = theme.label.prim;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -760,7 +760,7 @@ static void win_init(void)
|
||||
* @param font pointer to a font (NULL to use the default)
|
||||
* @return pointer to the initialized theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_nemo_init(uint16_t hue, lv_font_t *font)
|
||||
lv_theme_t * lv_theme_nemo_init(uint16_t hue, lv_font_t * font)
|
||||
{
|
||||
if(font == NULL) font = LV_FONT_DEFAULT;
|
||||
|
||||
@ -769,8 +769,8 @@ lv_theme_t * lv_theme_nemo_init(uint16_t hue, lv_font_t *font)
|
||||
|
||||
/*For backward compatibility initialize all theme elements with a default style */
|
||||
uint16_t i;
|
||||
lv_style_t **style_p = (lv_style_t**) &theme;
|
||||
for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t*); i++) {
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme;
|
||||
for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t *); i++) {
|
||||
*style_p = &def;
|
||||
style_p++;
|
||||
}
|
||||
|
@ -323,8 +323,8 @@ static void calendar_init(void)
|
||||
cal_bg.body.border.color = LV_COLOR_HEX3(0x333);
|
||||
cal_bg.body.border.width = 1;
|
||||
cal_bg.body.radius = LV_DPI / 20;
|
||||
cal_bg.body.padding.hor = LV_DPI/10;
|
||||
cal_bg.body.padding.ver = LV_DPI/10;
|
||||
cal_bg.body.padding.hor = LV_DPI / 10;
|
||||
cal_bg.body.padding.ver = LV_DPI / 10;
|
||||
|
||||
static lv_style_t cal_header;
|
||||
lv_style_copy(&cal_header, &bg);
|
||||
@ -333,8 +333,8 @@ static void calendar_init(void)
|
||||
cal_header.body.radius = 0;
|
||||
cal_header.body.border.width = 1;
|
||||
cal_header.body.border.color = LV_COLOR_HEX3(0x333);
|
||||
cal_header.body.padding.hor = LV_DPI/10;
|
||||
cal_header.body.padding.ver = LV_DPI/10;
|
||||
cal_header.body.padding.hor = LV_DPI / 10;
|
||||
cal_header.body.padding.ver = LV_DPI / 10;
|
||||
|
||||
static lv_style_t week_box;
|
||||
lv_style_copy(&week_box, &panel);
|
||||
|
@ -354,7 +354,7 @@ static void calendar_init(void)
|
||||
static void cb_init(void)
|
||||
{
|
||||
#if USE_LV_CB != 0
|
||||
static lv_style_t rel , pr, tgl_rel, tgl_pr, ina;
|
||||
static lv_style_t rel, pr, tgl_rel, tgl_pr, ina;
|
||||
lv_style_copy(&rel, &def);
|
||||
rel.body.radius = LV_DPI / 20;
|
||||
rel.body.shadow.width = 0;
|
||||
@ -397,7 +397,7 @@ static void cb_init(void)
|
||||
static void btnm_init(void)
|
||||
{
|
||||
#if USE_LV_BTNM
|
||||
static lv_style_t bg, rel , pr, tgl_rel, tgl_pr, ina;
|
||||
static lv_style_t bg, rel, pr, tgl_rel, tgl_pr, ina;
|
||||
|
||||
lv_style_copy(&bg, &lv_style_transp);
|
||||
bg.glass = 0;
|
||||
@ -446,7 +446,7 @@ static void btnm_init(void)
|
||||
static void kb_init(void)
|
||||
{
|
||||
#if USE_LV_KB
|
||||
static lv_style_t bg, rel , pr, tgl_rel, tgl_pr, ina;
|
||||
static lv_style_t bg, rel, pr, tgl_rel, tgl_pr, ina;
|
||||
lv_style_copy(&bg, &def);
|
||||
bg.body.main_color = LV_COLOR_HEX3(0x666);
|
||||
bg.body.grad_color = bg.body.main_color;
|
||||
|
Loading…
Reference in New Issue
Block a user