Merge branch 'master' into dev
This commit is contained in:
40
.github/workflows/build_micropython.yml
vendored
Normal file
40
.github/workflows/build_micropython.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
name: Build Micropython with LVGL submodule
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Install SDL
|
||||
run: |
|
||||
sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
|
||||
sudo apt-get update -y -qq
|
||||
sudo apt-get install libsdl2-dev
|
||||
- name: Clone lv_micropython
|
||||
run: git clone https://github.com/lvgl/lv_micropython.git .
|
||||
- name: Update submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Checkout lv_bindings
|
||||
working-directory: ./lib/lv_bindings/lvgl
|
||||
run: |
|
||||
git fetch
|
||||
git checkout $GITHUB_SHA
|
||||
- name: Build mpy-cross
|
||||
run: make -j $(nproc) -C mpy-cross
|
||||
- name: Build the unix port
|
||||
run: make -j $(nproc) -C ports/unix
|
||||
- name: Run advanced_demo
|
||||
run: >
|
||||
echo "import gc,utime;
|
||||
utime.sleep(5);
|
||||
gc.collect();
|
||||
utime.sleep(5)" |
|
||||
ports/unix/micropython -i lib/lv_bindings/examples/advanced_demo.py
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
- Add `gpu_wait_cb` to wait until the GPU is working. It allows to run CPU a wait only when the rendered data is needed.
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- Fix unexpeted DEFOCUS on lv_page when clicking to bg after the scrollable
|
||||
- Fix `lv_obj_del` and `lv_obj_clean` if the children list changed during deletion.
|
||||
- Adjust button matrix button width to include padding when spanning multiple units.
|
||||
|
||||
## v7.4.0 (01.09.2020)
|
||||
|
||||
|
||||
@@ -12,23 +12,24 @@ Planned to September/October 2020
|
||||
- Support "elastic" scrolling when scrolled in
|
||||
- Support scroll chaining among any objects types (not only `lv_pages`s)
|
||||
- Remove `lv_drag`. Similar effect can be achieved by setting the position in `LV_EVENT_PRESSING`
|
||||
- Add snapping?
|
||||
- Add snapping
|
||||
- Add snap stop to scroll max 1 snap point
|
||||
- Already working
|
||||
- New layouts:
|
||||
- See [#1615](https://github.com/lvgl/lvgl/issues/1615) issue
|
||||
- [CSS Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)-like layout support
|
||||
- Besides setting width/height in `px` add support to `partent percentage` and `screen percentage`.
|
||||
- [CSS Grid](https://css-tricks.com/snippets/css/a-guide-to-grid/)-like layout support
|
||||
- Work in progress
|
||||
- Simplified File system interface ([feat/new_fs_api](https://github.com/lvgl/lvgl/tree/feat/new-fs-api) branch) to make porting easier
|
||||
- Work in progress
|
||||
- RGB888 support [#1722](https://github.com/lvgl/lvgl/issues/1722)
|
||||
- Remove the align parameter from `lv_canvas_draw_text`
|
||||
|
||||
## v9
|
||||
- Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3).
|
||||
|
||||
## Ideas
|
||||
- Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3).7
|
||||
- Unit testing (gtest?). See [#1658](https://github.com/lvgl/lvgl/issues/1658)
|
||||
- Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660)
|
||||
|
||||
## Ideas
|
||||
- CPP binding. See [Forum](https://forum.lvgl.io/t/is-it-possible-to-officially-support-optional-cpp-api/2736)
|
||||
- Optmize font decompression
|
||||
- Switch to RGBA colors in styles
|
||||
|
||||
@@ -54,7 +54,9 @@ void lv_port_disp_init(void)
|
||||
* Create a buffer for drawing
|
||||
*----------------------------*/
|
||||
|
||||
/* LVGL requires a buffer where it draws the objects. The buffer's has to be greater than 1 display row
|
||||
/* LVGL requires a buffer where it internally draws the widgets.
|
||||
* Later this buffer will passed your display drivers `flush_cb` to copy its content to your dispay.
|
||||
* The buffer has to be greater than 1 display row
|
||||
*
|
||||
* There are three buffering configurations:
|
||||
* 1. Create ONE buffer with some rows:
|
||||
@@ -73,21 +75,21 @@ void lv_port_disp_init(void)
|
||||
* */
|
||||
|
||||
/* Example for 1) */
|
||||
static lv_disp_buf_t disp_buf_1;
|
||||
static lv_color_t buf1_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
|
||||
lv_disp_buf_init(&disp_buf_1, buf1_1, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
|
||||
static lv_disp_buf_t draw_buf_dsc_1;
|
||||
static lv_color_t draw_buf_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
|
||||
lv_disp_buf_init(&draw_buf_dsc_1, draw_buf_1, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
|
||||
|
||||
/* Example for 2) */
|
||||
static lv_disp_buf_t disp_buf_2;
|
||||
static lv_color_t buf2_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
|
||||
static lv_color_t buf2_2[LV_HOR_RES_MAX * 10]; /*An other buffer for 10 rows*/
|
||||
lv_disp_buf_init(&disp_buf_2, buf2_1, buf2_2, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
|
||||
static lv_disp_buf_t draw_buf_dsc_2;
|
||||
static lv_color_t draw_buf_2_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
|
||||
static lv_color_t draw_buf_2_1[LV_HOR_RES_MAX * 10]; /*An other buffer for 10 rows*/
|
||||
lv_disp_buf_init(&draw_buf_dsc_2, draw_buf_2_1, draw_buf_2_1, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
|
||||
|
||||
/* Example for 3) */
|
||||
static lv_disp_buf_t disp_buf_3;
|
||||
static lv_color_t buf3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*A screen sized buffer*/
|
||||
static lv_color_t buf3_2[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*An other screen sized buffer*/
|
||||
lv_disp_buf_init(&disp_buf_3, buf3_1, buf3_2, LV_HOR_RES_MAX * LV_VER_RES_MAX); /*Initialize the display buffer*/
|
||||
static lv_disp_buf_t draw_buf_dsc_3;
|
||||
static lv_color_t draw_buf_3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*A screen sized buffer*/
|
||||
static lv_color_t draw_buf_3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*An other screen sized buffer*/
|
||||
lv_disp_buf_init(&draw_buf_dsc_3, draw_buf_3_1, draw_buf_3_2, LV_HOR_RES_MAX * LV_VER_RES_MAX); /*Initialize the display buffer*/
|
||||
|
||||
|
||||
/*-----------------------------------
|
||||
@@ -107,7 +109,7 @@ void lv_port_disp_init(void)
|
||||
disp_drv.flush_cb = disp_flush;
|
||||
|
||||
/*Set a display buffer*/
|
||||
disp_drv.buffer = &disp_buf_2;
|
||||
disp_drv.buffer = &draw_buf_dsc_1;
|
||||
|
||||
#if LV_USE_GPU
|
||||
/*Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)*/
|
||||
|
||||
@@ -653,7 +653,7 @@ typedef void * lv_obj_user_data_t;
|
||||
* 1: Some extra precision
|
||||
* 2: Best precision
|
||||
*/
|
||||
# define LV_LINEMETER_PRECISE 0
|
||||
# define LV_LINEMETER_PRECISE 1
|
||||
#endif
|
||||
|
||||
/*Mask (dependencies: -)*/
|
||||
|
||||
@@ -1181,9 +1181,9 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL);
|
||||
lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
|
||||
lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
}
|
||||
@@ -1222,9 +1222,9 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
else {
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL);
|
||||
lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
|
||||
lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,42 @@ typedef struct {
|
||||
} end_value;
|
||||
} lv_style_trans_t;
|
||||
|
||||
typedef struct {
|
||||
lv_draw_rect_dsc_t rect;
|
||||
lv_draw_label_dsc_t label;
|
||||
lv_draw_line_dsc_t line;
|
||||
lv_draw_img_dsc_t img;
|
||||
lv_style_int_t pad_top;
|
||||
lv_style_int_t pad_bottom;
|
||||
lv_style_int_t pad_right;
|
||||
lv_style_int_t pad_left;
|
||||
lv_style_int_t pad_inner;
|
||||
lv_style_int_t margin_top;
|
||||
lv_style_int_t margin_bottom;
|
||||
lv_style_int_t margin_left;
|
||||
lv_style_int_t margin_right;
|
||||
lv_style_int_t size;
|
||||
lv_style_int_t transform_width;
|
||||
lv_style_int_t transform_height;
|
||||
lv_style_int_t transform_angle;
|
||||
lv_style_int_t transform_zoom;
|
||||
lv_style_int_t scale_width;
|
||||
lv_style_int_t scale_border_width;
|
||||
lv_style_int_t scale_end_border_width;
|
||||
lv_style_int_t scale_end_line_width;
|
||||
lv_color_t scale_grad_color;
|
||||
lv_color_t scale_end_color;
|
||||
lv_opa_t opa_scale;
|
||||
uint32_t clip_corder :1;
|
||||
uint32_t border_post :1;
|
||||
}style_snapshot_t;
|
||||
|
||||
typedef enum {
|
||||
STYLE_COMPARE_SAME,
|
||||
STYLE_COMPARE_VISUAL_DIFF,
|
||||
STYLE_COMPARE_DIFF,
|
||||
} style_snapshot_res_t;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
@@ -106,6 +142,10 @@ static void obj_del_core(lv_obj_t * obj);
|
||||
static void update_style_cache(lv_obj_t * obj, uint8_t part, uint16_t prop);
|
||||
static void update_style_cache_children(lv_obj_t * obj);
|
||||
static void invalidate_style_cache(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
static void style_snapshot(lv_obj_t * obj, uint8_t part, style_snapshot_t * shot);
|
||||
static style_snapshot_res_t style_snapshot_compare(style_snapshot_t * shot1, style_snapshot_t * shot2);
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
@@ -392,6 +432,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
|
||||
new_obj->protect = copy->protect;
|
||||
new_obj->gesture_parent = copy->gesture_parent;
|
||||
new_obj->focus_parent = copy->focus_parent;
|
||||
|
||||
#if LV_USE_GROUP
|
||||
/*Add to the same group*/
|
||||
@@ -485,13 +526,9 @@ void lv_obj_clean(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
||||
lv_obj_t * child_next;
|
||||
while(child) {
|
||||
/* Read the next child before deleting the current
|
||||
* because the next couldn't be read from a deleted (invalid) node*/
|
||||
child_next = lv_obj_get_child(obj, child);
|
||||
lv_obj_del(child);
|
||||
child = child_next;
|
||||
child = lv_obj_get_child(obj, NULL); /*Get the new first child*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1673,9 +1710,49 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
#else
|
||||
lv_state_t prev_state = obj->state;
|
||||
obj->state = new_state;
|
||||
|
||||
style_snapshot_res_t cmp_res = STYLE_COMPARE_SAME;
|
||||
uint8_t part;
|
||||
for(part = 0; part < _LV_OBJ_PART_REAL_FIRST; part++) {
|
||||
lv_style_list_t * style_list = lv_obj_get_style_list(obj, part);
|
||||
if(style_list == NULL) break; /*No more style lists*/
|
||||
obj->state = prev_state;
|
||||
style_snapshot_t shot_pre;
|
||||
style_snapshot(obj, part, &shot_pre);
|
||||
obj->state = new_state;
|
||||
style_snapshot_t shot_post;
|
||||
style_snapshot(obj, part, &shot_post);
|
||||
|
||||
style_snapshot_res_t r = style_snapshot_compare(&shot_pre, &shot_post);
|
||||
if(r == STYLE_COMPARE_DIFF) {
|
||||
cmp_res = STYLE_COMPARE_DIFF;
|
||||
break;
|
||||
}
|
||||
if(r == STYLE_COMPARE_VISUAL_DIFF) {
|
||||
cmp_res = STYLE_COMPARE_VISUAL_DIFF;
|
||||
}
|
||||
}
|
||||
for(part = _LV_OBJ_PART_REAL_FIRST; part < 0xFF; part++) {
|
||||
lv_style_list_t * style_list = lv_obj_get_style_list(obj, part);
|
||||
if(style_list == NULL) break; /*No more style lists*/
|
||||
obj->state = prev_state;
|
||||
style_snapshot_t shot_pre;
|
||||
style_snapshot(obj, part, &shot_pre);
|
||||
obj->state = new_state;
|
||||
style_snapshot_t shot_post;
|
||||
style_snapshot(obj, part, &shot_post);
|
||||
|
||||
style_snapshot_res_t r = style_snapshot_compare(&shot_pre, &shot_post);
|
||||
if(r == STYLE_COMPARE_DIFF) {
|
||||
cmp_res = STYLE_COMPARE_DIFF;
|
||||
break;
|
||||
}
|
||||
if(r == STYLE_COMPARE_VISUAL_DIFF) {
|
||||
cmp_res = STYLE_COMPARE_VISUAL_DIFF;
|
||||
}
|
||||
}
|
||||
|
||||
if(cmp_res == STYLE_COMPARE_SAME) return;
|
||||
|
||||
for(part = 0; part < _LV_OBJ_PART_REAL_LAST; part++) {
|
||||
lv_style_list_t * style_list = lv_obj_get_style_list(obj, part);
|
||||
if(style_list == NULL) break; /*No more style lists*/
|
||||
@@ -1721,8 +1798,9 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
|
||||
}
|
||||
}
|
||||
lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL);
|
||||
if(cmp_res == STYLE_COMPARE_DIFF) lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL);
|
||||
}
|
||||
if(cmp_res == STYLE_COMPARE_VISUAL_DIFF) lv_obj_invalidate(obj);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3709,17 +3787,13 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
|
||||
/*Recursively delete the children*/
|
||||
lv_obj_t * i;
|
||||
lv_obj_t * i_next;
|
||||
i = _lv_ll_get_head(&(obj->child_ll));
|
||||
while(i != NULL) {
|
||||
/*Get the next object before delete this*/
|
||||
i_next = _lv_ll_get_next(&(obj->child_ll), i);
|
||||
|
||||
/*Call the recursive del to the child too*/
|
||||
/*Call the recursive delete to the child too*/
|
||||
obj_del_core(i);
|
||||
|
||||
/*Set i to the next node*/
|
||||
i = i_next;
|
||||
/*Set i to the new head node*/
|
||||
i = _lv_ll_get_head(&(obj->child_ll));
|
||||
}
|
||||
|
||||
lv_event_mark_deleted(obj);
|
||||
@@ -4666,3 +4740,80 @@ static void invalidate_style_cache(lv_obj_t * obj, uint8_t part, lv_style_proper
|
||||
}
|
||||
}
|
||||
|
||||
static void style_snapshot(lv_obj_t * obj, uint8_t part, style_snapshot_t * shot)
|
||||
{
|
||||
_lv_obj_disable_style_caching(obj, true);
|
||||
_lv_memset_00(shot, sizeof(style_snapshot_t));
|
||||
lv_draw_rect_dsc_init(&shot->rect);
|
||||
lv_draw_label_dsc_init(&shot->label);
|
||||
lv_draw_img_dsc_init(&shot->img);
|
||||
lv_draw_line_dsc_init(&shot->line);
|
||||
|
||||
lv_obj_init_draw_rect_dsc(obj, part, &shot->rect);
|
||||
lv_obj_init_draw_label_dsc(obj, part, &shot->label);
|
||||
lv_obj_init_draw_img_dsc(obj, part, &shot->img);
|
||||
lv_obj_init_draw_line_dsc(obj, part, &shot->line);
|
||||
|
||||
|
||||
shot->pad_top = lv_obj_get_style_pad_top(obj, part);
|
||||
shot->pad_bottom = lv_obj_get_style_pad_bottom(obj, part);
|
||||
shot->pad_right = lv_obj_get_style_pad_right(obj, part);
|
||||
shot->pad_left = lv_obj_get_style_pad_left(obj, part);
|
||||
shot->pad_inner = lv_obj_get_style_pad_inner(obj, part);
|
||||
shot->margin_top = lv_obj_get_style_margin_top(obj, part);
|
||||
shot->margin_bottom = lv_obj_get_style_margin_bottom(obj, part);
|
||||
shot->margin_left = lv_obj_get_style_margin_left(obj, part);
|
||||
shot->margin_right = lv_obj_get_style_margin_right(obj, part);
|
||||
shot->size = lv_obj_get_style_size(obj, part);
|
||||
shot->transform_width = lv_obj_get_style_transform_width(obj, part);
|
||||
shot->transform_height = lv_obj_get_style_transform_height(obj, part);
|
||||
shot->transform_angle = lv_obj_get_style_transform_angle(obj, part);
|
||||
shot->transform_zoom = lv_obj_get_style_transform_zoom(obj, part);
|
||||
shot->scale_width = lv_obj_get_style_scale_width(obj, part);
|
||||
shot->scale_border_width = lv_obj_get_style_scale_border_width(obj, part);
|
||||
shot->scale_end_border_width = lv_obj_get_style_scale_end_border_width(obj, part);
|
||||
shot->scale_end_line_width = lv_obj_get_style_scale_end_line_width(obj, part);
|
||||
shot->scale_grad_color = lv_obj_get_style_scale_grad_color(obj, part);
|
||||
shot->scale_end_color = lv_obj_get_style_scale_end_color(obj, part);
|
||||
shot->opa_scale = lv_obj_get_style_opa_scale(obj, part);
|
||||
shot->clip_corder = lv_obj_get_style_clip_corner(obj, part);
|
||||
shot->border_post = lv_obj_get_style_border_post(obj, part);
|
||||
|
||||
_lv_obj_disable_style_caching(obj, false);
|
||||
}
|
||||
|
||||
static style_snapshot_res_t style_snapshot_compare(style_snapshot_t * shot1, style_snapshot_t * shot2)
|
||||
{
|
||||
if(memcmp(shot1, shot2, sizeof(style_snapshot_t)) == 0) return STYLE_COMPARE_SAME;
|
||||
|
||||
|
||||
if(shot1->pad_top != shot2->pad_top) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->pad_bottom != shot2->pad_bottom) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->pad_left != shot2->pad_right) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->pad_right != shot2->pad_right) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->pad_top != shot2->pad_top) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->pad_inner != shot2->pad_inner) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->margin_top != shot2->margin_top) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->margin_bottom != shot2->margin_bottom) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->margin_left != shot2->margin_right) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->margin_right != shot2->margin_right) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->margin_top != shot2->margin_top) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->transform_width != shot2->transform_width) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->transform_height != shot2->transform_height) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->transform_angle != shot2->transform_angle) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->transform_zoom != shot2->transform_zoom) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->rect.outline_width != shot2->rect.outline_width) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->rect.outline_pad != shot2->rect.outline_pad) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->rect.value_font != shot2->rect.value_font) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->rect.value_align != shot2->rect.value_align) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->rect.value_font != shot2->rect.value_font) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->rect.shadow_spread != shot2->rect.shadow_spread) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->rect.shadow_width != shot2->rect.shadow_width) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->rect.shadow_ofs_x != shot2->rect.shadow_ofs_x) return STYLE_COMPARE_DIFF;
|
||||
if(shot1->rect.shadow_ofs_y != shot2->rect.shadow_ofs_y) return STYLE_COMPARE_DIFF;
|
||||
|
||||
/*If not returned earlier its just a visual difference, a simple redraw is enough*/
|
||||
return STYLE_COMPARE_VISUAL_DIFF;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -400,36 +400,7 @@ void lv_arc_set_value(lv_obj_t * arc, int16_t value)
|
||||
if(ext->cur_value == new_value) return;
|
||||
ext->cur_value = new_value;
|
||||
|
||||
int16_t bg_midpoint, range_midpoint, bg_end = ext->bg_angle_end;
|
||||
if(ext->bg_angle_end < ext->bg_angle_start) bg_end = ext->bg_angle_end + 360;
|
||||
|
||||
int16_t angle;
|
||||
switch(ext->type) {
|
||||
case LV_ARC_TYPE_SYMMETRIC:
|
||||
bg_midpoint = (ext->bg_angle_start + bg_end) / 2;
|
||||
range_midpoint = (int32_t)(ext->min_value + ext->max_value) / 2;
|
||||
|
||||
if(ext->cur_value < range_midpoint) {
|
||||
angle = _lv_map(ext->cur_value, ext->min_value, range_midpoint, ext->bg_angle_start, bg_midpoint);
|
||||
lv_arc_set_start_angle(arc, angle);
|
||||
lv_arc_set_end_angle(arc, bg_midpoint);
|
||||
}
|
||||
else {
|
||||
angle = _lv_map(ext->cur_value, range_midpoint, ext->max_value, bg_midpoint, bg_end);
|
||||
lv_arc_set_start_angle(arc, bg_midpoint);
|
||||
lv_arc_set_end_angle(arc, angle);
|
||||
}
|
||||
break;
|
||||
case LV_ARC_TYPE_REVERSE:
|
||||
angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end);
|
||||
lv_arc_set_start_angle(arc, angle);
|
||||
break;
|
||||
default: /** LV_ARC_TYPE_NORMAL*/
|
||||
angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end);
|
||||
lv_arc_set_start_angle(arc, ext->bg_angle_start);
|
||||
lv_arc_set_end_angle(arc, angle);
|
||||
}
|
||||
ext->last_angle = angle; /*Cache angle for slew rate limiting*/
|
||||
value_update(arc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -208,7 +208,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
|
||||
/*Only deal with the non empty lines*/
|
||||
if(btn_cnt != 0) {
|
||||
/*Calculate the width of all units*/
|
||||
lv_coord_t all_unit_w = max_w - ((btn_cnt - 1) * inner);
|
||||
lv_coord_t all_unit_w = max_w - ((unit_cnt - 1) * inner);
|
||||
|
||||
/*Set the button size and positions and set the texts*/
|
||||
uint16_t i;
|
||||
@@ -216,19 +216,20 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
|
||||
|
||||
unit_act_cnt = 0;
|
||||
for(i = 0; i < btn_cnt; i++) {
|
||||
uint8_t btn_unit_w = get_button_width(ext->ctrl_bits[btn_i]);
|
||||
/* one_unit_w = all_unit_w / unit_cnt
|
||||
* act_unit_w = one_unit_w * button_width
|
||||
* do this two operations but the multiply first to divide a greater number */
|
||||
lv_coord_t act_unit_w = (all_unit_w * get_button_width(ext->ctrl_bits[btn_i])) / unit_cnt;
|
||||
lv_coord_t act_unit_w = (all_unit_w * btn_unit_w) / unit_cnt + inner * (btn_unit_w - 1);
|
||||
act_unit_w--; /*-1 because e.g. width = 100 means 101 pixels (0..100)*/
|
||||
|
||||
/*Always recalculate act_x because of rounding errors */
|
||||
if(base_dir == LV_BIDI_DIR_RTL) {
|
||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * inner;
|
||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + unit_act_cnt * inner;
|
||||
act_x = lv_obj_get_width(btnm) - right - act_x - act_unit_w - 1;
|
||||
}
|
||||
else {
|
||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * inner +
|
||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + unit_act_cnt * inner +
|
||||
left;
|
||||
}
|
||||
/* Set the button's area.
|
||||
@@ -243,7 +244,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
|
||||
lv_area_set(&ext->button_areas[btn_i], act_x, act_y, act_x + act_unit_w, act_y + btn_h);
|
||||
}
|
||||
|
||||
unit_act_cnt += get_button_width(ext->ctrl_bits[btn_i]);
|
||||
unit_act_cnt += btn_unit_w;
|
||||
|
||||
i_tot++;
|
||||
btn_i++;
|
||||
|
||||
@@ -76,6 +76,7 @@ lv_obj_t * lv_linemeter_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->line_cnt = 18;
|
||||
ext->scale_angle = 240;
|
||||
ext->angle_ofs = 0;
|
||||
ext->mirrored = 0;
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_cb(linemeter, lv_linemeter_signal);
|
||||
|
||||
@@ -118,6 +118,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*Init the new page object*/
|
||||
if(copy == NULL) {
|
||||
ext->scrl = lv_cont_create(page, NULL);
|
||||
lv_obj_set_focus_parent(ext->scrl, true);
|
||||
lv_obj_set_drag(ext->scrl, true);
|
||||
lv_obj_set_drag_throw(ext->scrl, true);
|
||||
lv_obj_add_protect(ext->scrl, LV_PROTECT_PARENT | LV_PROTECT_PRESS_LOST);
|
||||
@@ -131,6 +132,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_set_signal_cb(page, lv_page_signal);
|
||||
lv_obj_set_design_cb(page, lv_page_design);
|
||||
|
||||
|
||||
lv_page_set_scrollbar_mode(page, ext->scrlbar.mode);
|
||||
|
||||
lv_theme_apply(page, LV_THEME_PAGE);
|
||||
@@ -1043,32 +1045,6 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_FOCUS) {
|
||||
#if LV_USE_GROUP
|
||||
if(lv_obj_get_group(page)) {
|
||||
lv_group_focus_obj(page);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
res = lv_signal_send(page, LV_SIGNAL_FOCUS, NULL);
|
||||
if(res != LV_RES_OK) return res;
|
||||
res = lv_event_send(page, LV_EVENT_FOCUSED, NULL);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_DEFOCUS) {
|
||||
bool in_group = false;
|
||||
#if LV_USE_GROUP
|
||||
in_group = lv_obj_get_group(page) ? true : false;
|
||||
#endif
|
||||
if(in_group == false) {
|
||||
res = lv_signal_send(page, LV_SIGNAL_DEFOCUS, NULL);
|
||||
if(res != LV_RES_OK) return res;
|
||||
res = lv_event_send(page, LV_EVENT_DEFOCUSED, NULL);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
page_ext->scrl = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user