astyle code formatting

This commit is contained in:
Gabor Kiss-Vamosi
2018-10-05 17:22:49 +02:00
parent 23b65ca454
commit 41695bf9ac
95 changed files with 5399 additions and 5603 deletions

View File

@@ -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=

View File

@@ -1 +0,0 @@
--convert-tabs --indent=spaces=4

View File

@@ -170,12 +170,12 @@ void lv_label_set_text(lv_obj_t * label, const char * text)
Use 4 spaces indentation instead of tab. 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`. 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` `$ 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` `$ 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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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()*

View File

@@ -367,8 +367,7 @@ 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) { else if(data->state == LV_INDEV_STATE_PR && i->proc.last_state == LV_INDEV_STATE_PR) {
if(data->key == LV_GROUP_KEY_ENTER && if(data->key == LV_GROUP_KEY_ENTER &&
i->proc.long_pr_sent == 0 && 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.*/ /*On enter long press leave edit mode.*/
lv_obj_t * focused = lv_group_get_focused(i->group); lv_obj_t * focused = lv_group_get_focused(i->group);
if(focused) { if(focused) {
@@ -392,17 +391,12 @@ 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); lv_group_focus_next(i->group);
} } else if(data->key == LV_GROUP_KEY_PREV) {
else if(data->key == LV_GROUP_KEY_PREV)
{
lv_group_focus_prev(i->group); lv_group_focus_prev(i->group);
} } else if(data->key == LV_GROUP_KEY_ENTER) {
else if(data->key == LV_GROUP_KEY_ENTER) if(!i->proc.long_pr_sent) {
{
if (!i->proc.long_pr_sent) {
lv_group_send_data(i->group, data->key); lv_group_send_data(i->group, data->key);
} }
} else { } else {
@@ -460,15 +454,14 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
/*Pressing*/ /*Pressing*/
else if(data->state == LV_INDEV_STATE_PR && i->proc.last_state == LV_INDEV_STATE_PR) { else if(data->state == LV_INDEV_STATE_PR && i->proc.last_state == LV_INDEV_STATE_PR) {
if(i->proc.long_pr_sent == 0 && 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.*/ /*On enter long press leave edit mode.*/
lv_obj_t * focused = lv_group_get_focused(i->group); lv_obj_t * focused = lv_group_get_focused(i->group);
bool editable = false; bool editable = false;
if(focused) focused->signal_func(focused, LV_SIGNAL_GET_EDITABLE, &editable); if(focused) focused->signal_func(focused, LV_SIGNAL_GET_EDITABLE, &editable);
if (editable) { if(editable) {
i->group->editing = i->group->editing ? 0 : 1; 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*/ 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"); 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); if(focused) focused->signal_func(focused, LV_SIGNAL_GET_EDITABLE, &editable);
/*The button was released on a non-editable object. Just send enter*/ /*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); lv_group_send_data(i->group, LV_GROUP_KEY_ENTER);
} }
/*An object is being edited and the button is releases. Just send 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(!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*/ /*If the focused object is editable and now in navigate mode then enter edit mode*/

View File

@@ -119,7 +119,7 @@ void lv_init(void)
* @param copy pointer to a base object, if not NULL then the new object will be copied from it * @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 * @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; lv_obj_t * new_obj = NULL;

View File

@@ -41,7 +41,7 @@ static volatile lv_vdb_state_t vdb_state = LV_VDB_STATE_ACTIVE;
# if LV_VDB_ADR == 0 # if LV_VDB_ADR == 0
/*If the buffer address is not specified simply allocate it*/ /*If the buffer address is not specified simply allocate it*/
static uint8_t vdb_buf[LV_VDB_SIZE_IN_BYTES]; static uint8_t vdb_buf[LV_VDB_SIZE_IN_BYTES];
static lv_vdb_t vdb = {.buf = (lv_color_t*)vdb_buf}; static lv_vdb_t vdb = {.buf = (lv_color_t *)vdb_buf};
# else /*LV_VDB_ADR != 0*/ # else /*LV_VDB_ADR != 0*/
/*If the buffer address is specified use that address*/ /*If the buffer address is specified use that address*/
static lv_vdb_t vdb = {.buf = (lv_color_t *)LV_VDB_ADR}; static lv_vdb_t vdb = {.buf = (lv_color_t *)LV_VDB_ADR};
@@ -79,7 +79,7 @@ lv_vdb_t * lv_vdb_get(void)
* user call of 'lv_flush_ready()' in display drivers's flush function*/ * user call of 'lv_flush_ready()' in display drivers's flush function*/
while(vdb_state != LV_VDB_STATE_ACTIVE); 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"); 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; return NULL;
} }

View File

@@ -37,7 +37,7 @@ typedef struct {
uint32_t w:11; /*Width of the image map*/ uint32_t w:11; /*Width of the image map*/
uint32_t h:11; /*Height of the image map*/ uint32_t h:11; /*Height of the image map*/
}lv_img_header_t; } lv_img_header_t;
/*Image color format*/ /*Image color format*/
enum { enum {

View File

@@ -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, 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); 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); -(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 /* Fill the gaps
* When stepping in y one pixel remains empty on every corner (don't do this on the first segment ) */ * 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) { 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.y1 = prev_p.y + pattern[i].y;
draw_area.x2 = draw_area.x1 + main_line->p_act.x - prev_p.x; draw_area.x2 = draw_area.x1 + main_line->p_act.x - prev_p.x;
draw_area.y2 = draw_area.y1; 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 /* Fill the gaps
* When stepping in y one pixel remains empty on every corner */ * When stepping in y one pixel remains empty on every corner */

View File

@@ -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++) { for(d = 1; d < col; d++) {
if(point_lt.x < ofs_lt.x && point_lt.y < ofs_lt.y) { 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) { 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) { 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) { 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++; point_rb.x++;

View File

@@ -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; return bg_color;
} }
/*Opaque background: use simple mix*/ /*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); return lv_color_mix(fg_color, bg_color, fg_opa);
} }
/*Both colors have alpha. Expensive calculation need to be applied*/ /*Both colors have alpha. Expensive calculation need to be applied*/

View File

@@ -8,8 +8,7 @@
***********************************************************************************/ ***********************************************************************************/
/*Store the image of the letters (glyph)*/ /*Store the image of the letters (glyph)*/
static const uint8_t lv_font_monospace_8_glyph_bitmap[] = static const uint8_t lv_font_monospace_8_glyph_bitmap[] = {
{
#if USE_LV_FONT_MONOSPACE_8 == 1 #if USE_LV_FONT_MONOSPACE_8 == 1
/*Unicode: U+0020 ( ) , Width: 3 */ /*Unicode: U+0020 ( ) , Width: 3 */
0x00, //... 0x00, //...
@@ -4203,8 +4202,7 @@ static const uint8_t lv_font_monospace_8_glyph_bitmap[] =
/*Store the glyph descriptions*/ /*Store the glyph descriptions*/
static const lv_font_glyph_dsc_t lv_font_monospace_8_glyph_dsc[] = static const lv_font_glyph_dsc_t lv_font_monospace_8_glyph_dsc[] = {
{
#if USE_LV_FONT_MONOSPACE_8 == 1 #if USE_LV_FONT_MONOSPACE_8 == 1
{.w_px = 3, .glyph_index = 0}, /*Unicode: U+0020 ( )*/ {.w_px = 3, .glyph_index = 0}, /*Unicode: U+0020 ( )*/
{.w_px = 1, .glyph_index = 8}, /*Unicode: U+0021 (!)*/ {.w_px = 1, .glyph_index = 8}, /*Unicode: U+0021 (!)*/
@@ -4596,8 +4594,7 @@ static const lv_font_glyph_dsc_t lv_font_monospace_8_glyph_dsc[] =
#endif #endif
}; };
lv_font_t lv_font_monospace_8 = lv_font_t lv_font_monospace_8 = {
{
.unicode_first = 32, /*First Unicode letter in this font*/ .unicode_first = 32, /*First Unicode letter in this font*/
.unicode_last = 126, /*Last Unicode letter in this font*/ .unicode_last = 126, /*Last Unicode letter in this font*/
.h_px = 8, /*Font height in pixels*/ .h_px = 8, /*Font height in pixels*/
@@ -4608,11 +4605,11 @@ lv_font_t lv_font_monospace_8 =
.get_width = lv_font_get_width_continuous, /*Function pointer to get glyph's width*/ .get_width = lv_font_get_width_continuous, /*Function pointer to get glyph's width*/
#if USE_LV_FONT_MONOSPACE_8 == 1 #if USE_LV_FONT_MONOSPACE_8 == 1
.bpp = 1, /*Bit per pixel*/ .bpp = 1, /*Bit per pixel*/
#elif USE_LV_FONT_MONOSPACE_8 == 2 #elif USE_LV_FONT_MONOSPACE_8 == 2
.bpp = 2, /*Bit per pixel*/ .bpp = 2, /*Bit per pixel*/
#elif USE_LV_FONT_MONOSPACE_8 == 4 #elif USE_LV_FONT_MONOSPACE_8 == 4
.bpp = 4, /*Bit per pixel*/ .bpp = 4, /*Bit per pixel*/
#elif USE_LV_FONT_MONOSPACE_8 == 8 #elif USE_LV_FONT_MONOSPACE_8 == 8
.bpp = 8, /*Bit per pixel*/ .bpp = 8, /*Bit per pixel*/
#endif #endif
.monospace = 6, /*Fix width (0: if not used)*/ .monospace = 6, /*Fix width (0: if not used)*/

View File

@@ -83,9 +83,9 @@ bool lv_font_is_monospace(const lv_font_t * font_p, uint32_t letter)
} }
font_i = font_i->next_page; font_i = font_i->next_page;
} }
return 0; return 0;
} }
/** /**

View File

@@ -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 * @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum * 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) { if(file_p->drv == NULL) {
return LV_FS_RES_INV_PARAM; 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 * @param newname path with the new name
* @return LV_FS_RES_OK or any error from 'fs_res_t' * @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; if(!oldname || !newname) return LV_FS_RES_INV_PARAM;

View File

@@ -272,7 +272,7 @@ void * lv_ll_get_tail(const lv_ll_t * ll_p)
* @param n_act pointer a node * @param n_act pointer a node
* @return pointer to the next 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; void * next = NULL;
@@ -290,7 +290,7 @@ void * lv_ll_get_next(const lv_ll_t * ll_p,const void * n_act)
* @param n_act pointer a node * @param n_act pointer a node
* @return pointer to the previous 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; void * prev = NULL;

View File

@@ -27,7 +27,7 @@
/********************** /**********************
* STATIC VARIABLES * 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 * MACROS
@@ -42,7 +42,7 @@ static void (*print_cb)(lv_log_level_t , const char *, uint32_t , const char *)
* @param f a function pointer: * @param f a function pointer:
* `void my_print (lv_log_level_t level, const char * file, uint32_t line, const char * dsc)` * `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;
} }

View File

@@ -49,7 +49,7 @@ typedef uint8_t lv_log_level_t;
* @param f a function pointer: * @param f a function pointer:
* `void my_print (lv_log_level_t level, const char * file, uint32_t line, const char * dsc)` * `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 * Add a log

View File

@@ -79,7 +79,7 @@ static uint32_t zero_mem; /*Give the address of this variable if 0 byte sh
void lv_mem_init(void) void lv_mem_init(void)
{ {
#if LV_MEM_CUSTOM == 0 #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; lv_mem_ent_t * full = (lv_mem_ent_t *)work_mem;
full->header.used = 0; full->header.used = 0;
/*The total mem size id reduced by the first header and the close patterns */ /*The total mem size id reduced by the first header and the close patterns */

View File

@@ -55,20 +55,20 @@ static uint32_t lv_txt_ascii_get_length(const char * txt);
uint8_t (*lv_txt_encoded_size)(const char *) = lv_txt_utf8_size; 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_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_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_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_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_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_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; uint32_t (*lv_txt_get_encoded_length)(const char *) = lv_txt_utf8_get_length;
#else #else
uint8_t (*lv_txt_encoded_size)(const char *) = lv_txt_ascii_size; 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_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_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_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_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_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_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; uint32_t (*lv_txt_get_encoded_length)(const char *) = lv_txt_ascii_get_length;
#endif #endif
/********************** /**********************
* MACROS * MACROS

View File

@@ -151,7 +151,7 @@ extern uint32_t (*lv_txt_encoded_conv_wc) (uint32_t c);
* NULL to use txt[0] as index * NULL to use txt[0] as index
* @return the decoded Unicode character or 0 on invalid data code * @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. * 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 * @param byte_id byte index
* @return character index of the letter at 'byte_id'th position * @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. * Get the number of characters (and NOT bytes) in a string.

View File

@@ -57,7 +57,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy)
/*Create the ancestor basic object*/ /*Create the ancestor basic object*/
lv_obj_t * new_bar = lv_obj_create(par, copy); lv_obj_t * new_bar = lv_obj_create(par, copy);
lv_mem_assert(new_bar); 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_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); if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_func(new_bar);
@@ -327,7 +327,7 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode
/*Draw the indicator*/ /*Draw the indicator*/
lv_draw_rect(&indic_area, mask, style_indic, opa_scale); 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 #if USE_LV_GROUP
/*Draw the border*/ /*Draw the border*/
if(lv_obj_is_focused(bar)) { if(lv_obj_is_focused(bar)) {

View File

@@ -434,8 +434,7 @@ static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode
{ {
if(mode == LV_DESIGN_COVER_CHK) { if(mode == LV_DESIGN_COVER_CHK) {
return false; return false;
} } else if(mode == LV_DESIGN_DRAW_MAIN) {
else if(mode == LV_DESIGN_DRAW_MAIN) {
#if USE_LV_ANIMATION && LV_BTN_INK_EFFECT #if USE_LV_ANIMATION && LV_BTN_INK_EFFECT
if(btn != ink_obj) { if(btn != ink_obj) {
@@ -485,8 +484,7 @@ static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode
/*Draw the circle*/ /*Draw the circle*/
lv_draw_rect(&cir_area, mask, &style_tmp, opa_scale); lv_draw_rect(&cir_area, mask, &style_tmp, opa_scale);
} } else {
else {
lv_style_t res; lv_style_t res;
lv_style_copy(&res, ext->styles[ink_bg_state]); 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_style_mix(ext->styles[ink_bg_state], ext->styles[ink_top_state], &res, ink_act_value);
@@ -497,8 +495,7 @@ static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode
#else #else
ancestor_design(btn, mask, mode); ancestor_design(btn, mask, mode);
#endif #endif
} } else if(mode == LV_DESIGN_DRAW_POST) {
else if(mode == LV_DESIGN_DRAW_POST) {
ancestor_design(btn, mask, mode); ancestor_design(btn, mask, mode);
} }
@@ -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; 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 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); lv_anim_del(ink_obj, (lv_anim_fp_t)lv_btn_ink_effect_anim);
ink_obj = NULL; ink_obj = NULL;
} }
#endif #endif
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@@ -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); lv_indev_get_point(indev, &p1);
uint16_t btn_i = get_button_from_point(btnm, &p1); uint16_t btn_i = get_button_from_point(btnm, &p1);
ext->btn_id_pr = btn_i; 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*/ /*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; if(lv_group_get_editing(lv_obj_get_group(btnm))) ext->btn_id_pr = 0;
else ext->btn_id_pr = LV_BTNM_PR_NONE; else ext->btn_id_pr = LV_BTNM_PR_NONE;

View File

@@ -580,7 +580,7 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask)
txt_buf[5] = '\0'; txt_buf[5] = '\0';
strcpy(&txt_buf[5], get_month_name(calendar, ext->showed_date.month)); strcpy(&txt_buf[5], get_month_name(calendar, ext->showed_date.month));
header_area.y1 += ext->style_header->body.padding.ver; 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*/ /*Add the left arrow*/
lv_style_t * arrow_style = ext->btn_pressing < 0 ? ext->style_header_pr : ext->style_header; lv_style_t * arrow_style = ext->btn_pressing < 0 ? ext->style_header_pr : ext->style_header;

View File

@@ -301,7 +301,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
if(lv_obj_get_hidden(child) != false || if(lv_obj_get_hidden(child) != false ||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue; 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; last_cord += lv_obj_get_height(child) + style->body.padding.inner;
} }

View File

@@ -54,7 +54,7 @@ typedef struct
uint8_t layout :4; /*A layout from 'lv_cont_layout_t' enum*/ 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 hor_fit :1; /*1: Enable horizontal fit to involve all children*/
uint8_t ver_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;
/********************** /**********************

View File

@@ -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); lv_ddlist_refr_size(ddlist, true);
} }
} } else {
else {
/*Open the list if closed*/ /*Open the list if closed*/
if(!ext->opened) { if(!ext->opened) {
ext->opened = true; ext->opened = true;

View File

@@ -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 #if LV_LOG_LEVEL >= LV_LOG_LEVEL_INFO
switch(src_type) { 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_FILE:
case LV_IMG_SRC_VARIABLE: LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_VARIABLE` type found"); break; LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_FILE` type found");
case LV_IMG_SRC_SYMBOL: LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_SYMBOL` type found"); break; break;
default: LV_LOG_WARN("lv_img_set_src: unknown type"); 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 #endif

View File

@@ -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 /* 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.*/ * Set the new image for the new state.*/
refr_img(imgbtn); refr_img(imgbtn);
} } else if(sign == LV_SIGNAL_CLEANUP) {
else if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/ /*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
} else if(sign == LV_SIGNAL_GET_TYPE) { } else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;

View File

@@ -469,8 +469,7 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t index, lv_point_t
font, style->text.letter_space, flag); font, style->text.letter_space, flag);
x += lv_obj_get_width(label) / 2 - line_w / 2; x += lv_obj_get_width(label) / 2 - line_w / 2;
} } else if(ext->align == LV_LABEL_ALIGN_RIGHT) {
else if(ext->align == LV_LABEL_ALIGN_RIGHT) {
lv_coord_t line_w; lv_coord_t line_w;
line_w = lv_txt_get_width(&txt[line_start], new_line_start - line_start, line_w = lv_txt_get_width(&txt[line_start], new_line_start - line_start,
font, style->text.letter_space, flag); font, style->text.letter_space, flag);
@@ -680,7 +679,7 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_
if((ext->long_mode == LV_LABEL_LONG_ROLL) && if((ext->long_mode == LV_LABEL_LONG_ROLL) &&
(ext->align == LV_LABEL_ALIGN_CENTER || ext->align == LV_LABEL_ALIGN_RIGHT)) { (ext->align == LV_LABEL_ALIGN_CENTER || ext->align == LV_LABEL_ALIGN_RIGHT)) {
lv_point_t size; 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); 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)) { if(size.x > lv_obj_get_width(label)) {
flag &= ~LV_TXT_FLAG_RIGHT; flag &= ~LV_TXT_FLAG_RIGHT;
flag &= ~LV_TXT_FLAG_CENTER; flag &= ~LV_TXT_FLAG_CENTER;

View File

@@ -57,7 +57,7 @@ lv_obj_t * lv_lmeter_create(lv_obj_t * par, const lv_obj_t * copy)
/*Create the ancestor of line meter*/ /*Create the ancestor of line meter*/
lv_obj_t * new_lmeter = lv_obj_create(par, copy); lv_obj_t * new_lmeter = lv_obj_create(par, copy);
lv_mem_assert(new_lmeter); 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); if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_func(new_lmeter);

View File

@@ -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 #if USE_LV_GROUP
lv_indev_t * indev = lv_indev_get_act(); lv_indev_t * indev = lv_indev_get_act();
lv_hal_indev_type_t indev_type = lv_indev_get_type(indev); 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*/ /*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); 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; if(lv_group_get_editing(lv_obj_get_group(mbox))) btnm_ext->btn_id_pr = 0;

View File

@@ -194,7 +194,7 @@ void lv_page_set_sb_mode(lv_obj_t * page, lv_sb_mode_t sb_mode)
if(ext->sb.mode == sb_mode) return; 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*/ 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(sb_mode == LV_SB_MODE_UNHIDE) ext->sb.mode &= (~LV_SB_MODE_HIDE); /*Clear the hidden flag*/
else { else {
if(ext->sb.mode & LV_SB_MODE_HIDE) sb_mode |= LV_SB_MODE_HIDE; if(ext->sb.mode & LV_SB_MODE_HIDE) sb_mode |= LV_SB_MODE_HIDE;
ext->sb.mode = sb_mode; ext->sb.mode = sb_mode;

View File

@@ -255,7 +255,7 @@ void lv_ta_add_text(lv_obj_t * ta, const char * txt)
uint32_t i = 0; uint32_t i = 0;
while(txt[i] != '\0') { while(txt[i] != '\0') {
uint32_t c = lv_txt_encoded_next(txt, &i); uint32_t c = lv_txt_encoded_next(txt, &i);
lv_ta_add_char(ta,lv_txt_unicode_to_encoded(c)); lv_ta_add_char(ta, lv_txt_unicode_to_encoded(c));
} }
return; return;
} }
@@ -355,7 +355,7 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt)
uint32_t i = 0; uint32_t i = 0;
while(txt[i] != '\0') { while(txt[i] != '\0') {
uint32_t c = lv_txt_encoded_next(txt, &i); uint32_t c = lv_txt_encoded_next(txt, &i);
lv_ta_add_char(ta,lv_txt_unicode_to_encoded(c)); lv_ta_add_char(ta, lv_txt_unicode_to_encoded(c));
} }
} else { } else {
lv_label_set_text(ext->label, txt); lv_label_set_text(ext->label, txt);
@@ -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; if(buf->type[i] == NULL) break;
} }
buf->type[i] = "lv_ta"; buf->type[i] = "lv_ta";
} } else if(sign == LV_SIGNAL_DEFOCUS) {
else if (sign == LV_SIGNAL_DEFOCUS)
{
lv_cursor_type_t cur_type; lv_cursor_type_t cur_type;
cur_type = lv_ta_get_cursor_type(ta); cur_type = lv_ta_get_cursor_type(ta);
lv_ta_set_cursor_type(ta, cur_type | LV_CURSOR_HIDDEN); 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; lv_cursor_type_t cur_type;
cur_type = lv_ta_get_cursor_type(ta); cur_type = lv_ta_get_cursor_type(ta);
lv_ta_set_cursor_type(ta, cur_type & (~LV_CURSOR_HIDDEN)); lv_ta_set_cursor_type(ta, cur_type & (~LV_CURSOR_HIDDEN));

View File

@@ -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 win pointer to a window object
* @param layout the layout from 'lv_layout_t' * @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_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_page_set_scrl_layout(ext->page, layout); 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 win pointer to a window object
* @param sb_mode the new scroll bar mode from 'lv_sb_mode_t' * @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_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_page_set_sb_mode(ext->page, sb_mode); 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 * @param win pointer to a window object
* @return the layout of the window (from 'lv_layout_t') * @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); lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return lv_page_get_scrl_layout(ext->page); 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 * @param win pointer to a window object
* @return the scroll bar mode of the window (from 'lv_sb_mode_t') * @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); lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return lv_page_get_sb_mode(ext->page); 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->header = NULL; /*These objects were children so they are already invalid*/
ext->page = NULL; ext->page = NULL;
ext->title = NULL; ext->title = NULL;
} } else if(sign == LV_SIGNAL_CONTROLL) {
else if(sign == LV_SIGNAL_CONTROLL) {
/*Forward all the control signals to the page*/ /*Forward all the control signals to the page*/
ext->page->signal_func(ext->page, sign, param); ext->page->signal_func(ext->page, sign, param);
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@@ -55,12 +55,12 @@ static lv_theme_t current_theme;
* From now, all the created objects will use styles from this theme by default * 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()') * @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 #if LV_THEME_LIVE_UPDATE == 0
current_theme = th; current_theme = th;
#else #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) { if(!inited) {
/*It's not sure `th_styles` is big enough. Check it now!*/ /*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 **) &current_theme; lv_style_t ** cur_th_style_p = (lv_style_t **) &current_theme;
for(i = 0; i < style_num; i++) { for(i = 0; i < style_num; i++) {
uint64_t adr = (uint64_t)&th_styles[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; inited = true;
} }
@@ -85,7 +85,7 @@ void lv_theme_set_current(lv_theme_t *th)
lv_style_t ** th_style = (lv_style_t **) th; lv_style_t ** th_style = (lv_style_t **) th;
for(i = 0; i < style_num; i++) { for(i = 0; i < style_num; i++) {
uint64_t s = (uint64_t)th_style[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*/ /*Let the object know their style might change*/

View File

@@ -137,7 +137,7 @@ typedef struct {
lv_style_t *inactive_days; lv_style_t *inactive_days;
lv_style_t *week_box; lv_style_t *week_box;
lv_style_t *today_box; lv_style_t *today_box;
}calendar; } calendar;
#endif #endif
#if USE_LV_CB != 0 #if USE_LV_CB != 0

View File

@@ -450,7 +450,7 @@ static void calendar_init(void)
theme.calendar.today_box = &today_box; theme.calendar.today_box = &today_box;
theme.calendar.day_names = &color_text; theme.calendar.day_names = &color_text;
theme.calendar.highlighted_days = &color_text; theme.calendar.highlighted_days = &color_text;
theme.calendar.inactive_days= &gray_text; theme.calendar.inactive_days = &gray_text;
#endif #endif
} }

View File

@@ -289,7 +289,7 @@ static void led_init(void)
lv_style_copy(&led, &lv_style_pretty_color); lv_style_copy(&led, &lv_style_pretty_color);
led.body.shadow.width = LV_DPI / 10; led.body.shadow.width = LV_DPI / 10;
led.body.radius = LV_RADIUS_CIRCLE; 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.border.opa = LV_OPA_30;
led.body.main_color = lv_color_hsv_to_rgb(_hue, 100, 100); led.body.main_color = lv_color_hsv_to_rgb(_hue, 100, 100);
led.body.grad_color = lv_color_hsv_to_rgb(_hue, 100, 40); 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.highlighted_days = theme.label.sec;
theme.calendar.week_box = &week_box; theme.calendar.week_box = &week_box;
theme.calendar.today_box = &week_box; theme.calendar.today_box = &week_box;
theme.calendar.header_pr= theme.label.prim; theme.calendar.header_pr = theme.label.prim;
#endif #endif
} }
@@ -760,7 +760,7 @@ static void win_init(void)
* @param font pointer to a font (NULL to use the default) * @param font pointer to a font (NULL to use the default)
* @return pointer to the initialized theme * @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; 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 */ /*For backward compatibility initialize all theme elements with a default style */
uint16_t i; uint16_t i;
lv_style_t **style_p = (lv_style_t**) &theme; lv_style_t ** style_p = (lv_style_t **) &theme;
for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t*); i++) { for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t *); i++) {
*style_p = &def; *style_p = &def;
style_p++; style_p++;
} }

View File

@@ -323,8 +323,8 @@ static void calendar_init(void)
cal_bg.body.border.color = LV_COLOR_HEX3(0x333); cal_bg.body.border.color = LV_COLOR_HEX3(0x333);
cal_bg.body.border.width = 1; cal_bg.body.border.width = 1;
cal_bg.body.radius = LV_DPI / 20; cal_bg.body.radius = LV_DPI / 20;
cal_bg.body.padding.hor = LV_DPI/10; cal_bg.body.padding.hor = LV_DPI / 10;
cal_bg.body.padding.ver = LV_DPI/10; cal_bg.body.padding.ver = LV_DPI / 10;
static lv_style_t cal_header; static lv_style_t cal_header;
lv_style_copy(&cal_header, &bg); lv_style_copy(&cal_header, &bg);
@@ -333,8 +333,8 @@ static void calendar_init(void)
cal_header.body.radius = 0; cal_header.body.radius = 0;
cal_header.body.border.width = 1; cal_header.body.border.width = 1;
cal_header.body.border.color = LV_COLOR_HEX3(0x333); cal_header.body.border.color = LV_COLOR_HEX3(0x333);
cal_header.body.padding.hor = LV_DPI/10; cal_header.body.padding.hor = LV_DPI / 10;
cal_header.body.padding.ver = LV_DPI/10; cal_header.body.padding.ver = LV_DPI / 10;
static lv_style_t week_box; static lv_style_t week_box;
lv_style_copy(&week_box, &panel); lv_style_copy(&week_box, &panel);

View File

@@ -354,7 +354,7 @@ static void calendar_init(void)
static void cb_init(void) static void cb_init(void)
{ {
#if USE_LV_CB != 0 #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); lv_style_copy(&rel, &def);
rel.body.radius = LV_DPI / 20; rel.body.radius = LV_DPI / 20;
rel.body.shadow.width = 0; rel.body.shadow.width = 0;
@@ -397,7 +397,7 @@ static void cb_init(void)
static void btnm_init(void) static void btnm_init(void)
{ {
#if USE_LV_BTNM #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); lv_style_copy(&bg, &lv_style_transp);
bg.glass = 0; bg.glass = 0;
@@ -446,7 +446,7 @@ static void btnm_init(void)
static void kb_init(void) static void kb_init(void)
{ {
#if USE_LV_KB #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); lv_style_copy(&bg, &def);
bg.body.main_color = LV_COLOR_HEX3(0x666); bg.body.main_color = LV_COLOR_HEX3(0x666);
bg.body.grad_color = bg.body.main_color; bg.body.grad_color = bg.body.main_color;