From 422c9e5bd639405dbb16ab86a0cc413b3802d7a7 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 14 Apr 2021 15:31:54 +0200 Subject: [PATCH 001/152] feat(event) rework the prototype of lv_event_cb It encapsulates all event related parameters into a single lv_event_t obejct. --- docs/get-started/quick-overview.md | 2 +- docs/overview/event.md | 2 +- .../get_started/lv_example_get_started_1.c | 6 +- .../get_started/lv_example_get_started_3.c | 7 +- examples/scroll/lv_example_scroll_2.c | 9 +- examples/scroll/lv_example_scroll_3.c | 9 +- examples/widgets/bar/lv_example_bar_6.c | 4 +- examples/widgets/btn/lv_example_btn_1.c | 9 +- .../btnmatrix/lv_example_btnmatrix_1.c | 6 +- .../btnmatrix/lv_example_btnmatrix_2.c | 12 +- .../btnmatrix/lv_example_btnmatrix_3.c | 6 +- .../widgets/calendar/lv_example_calendar_1.c | 7 +- examples/widgets/chart/lv_example_chart_2.c | 9 +- examples/widgets/chart/lv_example_chart_3.c | 8 +- examples/widgets/chart/lv_example_chart_4.c | 15 ++- examples/widgets/chart/lv_example_chart_5.c | 12 +- examples/widgets/chart/lv_example_chart_6.c | 11 +- .../widgets/checkbox/lv_example_checkbox_1.c | 6 +- .../widgets/dropdown/lv_example_dropdown_1.c | 8 +- .../widgets/dropdown/lv_example_dropdown_3.c | 6 +- examples/widgets/img/lv_example_img_2.c | 8 +- .../widgets/keyboard/lv_example_keyboard_1.c | 10 +- examples/widgets/list/lv_example_list_1.c | 6 +- examples/widgets/msgbox/lv_example_msgbox_1.c | 6 +- examples/widgets/roller/lv_example_roller_1.c | 6 +- examples/widgets/roller/lv_example_roller_2.c | 6 +- examples/widgets/slider/lv_example_slider_1.c | 8 +- examples/widgets/slider/lv_example_slider_2.c | 2 +- examples/widgets/slider/lv_example_slider_3.c | 2 +- .../widgets/spinbox/lv_example_spinbox_1.c | 12 +- examples/widgets/switch/lv_example_switch_1.c | 6 +- examples/widgets/table/lv_example_table_1.c | 8 +- examples/widgets/table/lv_example_table_2.c | 10 +- .../widgets/textarea/lv_example_textarea_1.c | 8 +- .../widgets/textarea/lv_example_textarea_2.c | 12 +- .../widgets/textarea/lv_example_textarea_3.c | 8 +- examples/widgets/win/lv_example_win_1.c | 6 +- src/core/lv_obj.c | 122 ++++++++++-------- src/core/lv_obj.h | 31 +++-- src/extra/widgets/calendar/lv_calendar.c | 10 +- .../calendar/lv_calendar_header_arrow.c | 12 +- .../calendar/lv_calendar_header_dropdown.c | 20 +-- src/extra/widgets/colorwheel/lv_colorwheel.c | 54 ++++---- src/extra/widgets/imgbtn/lv_imgbtn.c | 25 ++-- src/extra/widgets/keyboard/lv_keyboard.c | 8 +- src/extra/widgets/keyboard/lv_keyboard.h | 2 +- src/extra/widgets/led/lv_led.c | 12 +- src/extra/widgets/msgbox/lv_msgbox.c | 8 +- src/extra/widgets/spinbox/lv_spinbox.c | 14 +- src/extra/widgets/tabview/lv_tabview.c | 18 ++- src/extra/widgets/tileview/lv_tileview.c | 8 +- src/misc/lv_mem.c | 2 +- src/widgets/lv_arc.c | 33 ++--- src/widgets/lv_bar.c | 26 ++-- src/widgets/lv_btnmatrix.c | 45 ++++--- src/widgets/lv_chart.c | 25 ++-- src/widgets/lv_checkbox.c | 32 +++-- src/widgets/lv_dropdown.c | 60 +++++---- src/widgets/lv_img.c | 53 ++++---- src/widgets/lv_label.c | 26 ++-- src/widgets/lv_line.c | 21 +-- src/widgets/lv_meter.c | 12 +- src/widgets/lv_roller.c | 75 ++++++----- src/widgets/lv_slider.c | 41 +++--- src/widgets/lv_switch.c | 26 ++-- src/widgets/lv_table.c | 35 ++--- src/widgets/lv_textarea.c | 60 +++++---- 67 files changed, 688 insertions(+), 506 deletions(-) diff --git a/docs/get-started/quick-overview.md b/docs/get-started/quick-overview.md index 4425ca97d..6dccdce3c 100644 --- a/docs/get-started/quick-overview.md +++ b/docs/get-started/quick-overview.md @@ -117,7 +117,7 @@ lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to t void btn_event_cb(lv_obj_t * btn, lv_event_t event) { - if(event == LV_EVENT_CLICKED) { + if(code == LV_EVENT_CLICKED) { printf("Clicked\n"); } } diff --git a/docs/overview/event.md b/docs/overview/event.md index 8b560dce8..6d7859a3b 100644 --- a/docs/overview/event.md +++ b/docs/overview/event.md @@ -176,7 +176,7 @@ There are 2 custom pointer that are available in the events: - `user_data`: set when the event is registered. - `event_param`: set when the event is sent in `lv_event_send` -In any event callback these pointer can be get with `lv_event_get_user_data()` and `lv_event_get_param()`. +In any event callback these pointer can be get with `lv_event_get_user_data(e)` and `lv_event_get_param(e)`. ## Event bubbling diff --git a/examples/get_started/lv_example_get_started_1.c b/examples/get_started/lv_example_get_started_1.c index 02f7896e1..77c4c18e8 100644 --- a/examples/get_started/lv_example_get_started_1.c +++ b/examples/get_started/lv_example_get_started_1.c @@ -1,9 +1,11 @@ #include "../lv_examples.h" #if LV_BUILD_EXAMPLES && LV_USE_BTN -static void btn_event_cb(lv_obj_t * btn, lv_event_t event) +static void btn_event_cb(lv_event_t * e) { - if(event == LV_EVENT_CLICKED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * btn = lv_event_get_target(e); + if(code == LV_EVENT_CLICKED) { static uint8_t cnt = 0; cnt++; diff --git a/examples/get_started/lv_example_get_started_3.c b/examples/get_started/lv_example_get_started_3.c index f2e8355e2..e49792c22 100644 --- a/examples/get_started/lv_example_get_started_3.c +++ b/examples/get_started/lv_example_get_started_3.c @@ -3,9 +3,12 @@ static lv_obj_t * label; -static void slider_event_cb(lv_obj_t * slider, lv_event_t event) +static void slider_event_cb(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * slider = lv_event_get_target(e); + + if(code == LV_EVENT_VALUE_CHANGED) { /*Refresh the text*/ lv_label_set_text_fmt(label, "%d", lv_slider_get_value(slider)); lv_obj_align_to(label, slider, LV_ALIGN_OUT_TOP_MID, 0, -15); /*Align below the slider*/ diff --git a/examples/scroll/lv_example_scroll_2.c b/examples/scroll/lv_example_scroll_2.c index 932c26274..ea5db7da5 100644 --- a/examples/scroll/lv_example_scroll_2.c +++ b/examples/scroll/lv_example_scroll_2.c @@ -1,10 +1,13 @@ #include "../lv_examples.h" #if LV_BUILD_EXAMPLES && LV_USE_FLEX -static void sw_event_cb(lv_obj_t * sw, lv_event_t e) +static void sw_event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { - lv_obj_t * list = lv_event_get_user_data(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * sw = lv_event_get_target(e); + + if(code == LV_EVENT_VALUE_CHANGED) { + lv_obj_t * list = lv_event_get_user_data(e); if(lv_obj_has_state(sw, LV_STATE_CHECKED)) lv_obj_add_flag(list, LV_OBJ_FLAG_SCROLL_ONE); else lv_obj_clear_flag(list, LV_OBJ_FLAG_SCROLL_ONE); diff --git a/examples/scroll/lv_example_scroll_3.c b/examples/scroll/lv_example_scroll_3.c index 98f47ac19..c576883ff 100644 --- a/examples/scroll/lv_example_scroll_3.c +++ b/examples/scroll/lv_example_scroll_3.c @@ -3,10 +3,13 @@ static uint32_t btn_cnt = 1; -static void float_btn_event_cb(lv_obj_t * float_btn, lv_event_t e) +static void float_btn_event_cb(lv_event_t * e) { - if(e == LV_EVENT_CLICKED) { - lv_obj_t * list = lv_event_get_user_data(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * float_btn = lv_event_get_target(e); + + if(code == LV_EVENT_CLICKED) { + lv_obj_t * list = lv_event_get_user_data(e); char buf[32]; lv_snprintf(buf, sizeof(buf), "Track %d", btn_cnt); lv_obj_t * list_btn = lv_list_add_btn(list, LV_SYMBOL_AUDIO, buf, NULL); diff --git a/examples/widgets/bar/lv_example_bar_6.c b/examples/widgets/bar/lv_example_bar_6.c index 0d6ed7159..0d8ae1bb0 100644 --- a/examples/widgets/bar/lv_example_bar_6.c +++ b/examples/widgets/bar/lv_example_bar_6.c @@ -8,7 +8,7 @@ //static void event_cb(lv_obj_t * obj, lv_event_t e) //{ -// if(e == LV_EVENT_DRAW_POST_END) { +// if(code == LV_EVENT_DRAW_POST_END) { // lv_bar_t * bar = (lv_bar_t *)obj; // // lv_draw_label_dsc_t dsc; @@ -38,7 +38,7 @@ // txt_area.y1 = bar->indic_area.y1 + (lv_area_get_height(&bar->indic_area) - txt_size.y) / 2; // txt_area.y2 = txt_area.y1 + txt_size.y - 1; // -// const lv_area_t * clip_area = lv_event_get_param(); +// const lv_area_t * clip_area = lv_event_get_param(e); // lv_draw_label(&txt_area, clip_area, &dsc, buf, NULL); // } //} diff --git a/examples/widgets/btn/lv_example_btn_1.c b/examples/widgets/btn/lv_example_btn_1.c index d02dd18a6..98966d0eb 100644 --- a/examples/widgets/btn/lv_example_btn_1.c +++ b/examples/widgets/btn/lv_example_btn_1.c @@ -1,13 +1,14 @@ #include "../../lv_examples.h" #if LV_USE_BTN && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - LV_UNUSED(obj); - if(event == LV_EVENT_CLICKED) { + lv_event_code_t code = lv_event_get_code(e); + + if(code == LV_EVENT_CLICKED) { LV_LOG_USER("Clicked"); } - else if(event == LV_EVENT_VALUE_CHANGED) { + else if(code == LV_EVENT_VALUE_CHANGED) { LV_LOG_USER("Toggled"); } } diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c b/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c index 74e5ed7fe..a80445d07 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c @@ -1,9 +1,11 @@ #include "../../lv_examples.h" #if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { uint32_t id = lv_btnmatrix_get_selected_btn(obj); const char * txt = lv_btnmatrix_get_btn_text(obj, id); diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c b/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c index 8a2173fad..a72aab677 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c @@ -2,10 +2,12 @@ #if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * obj, lv_event_t e) +static void event_cb(lv_event_t * e) { - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_DRAW_PART_BEGIN) { + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); /*Change the draw descriptor the 2nd button*/ if(dsc->id == 1) { @@ -31,8 +33,8 @@ static void event_cb(lv_obj_t * obj, lv_event_t e) } } - if(e == LV_EVENT_DRAW_PART_END) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); + if(code == LV_EVENT_DRAW_PART_END) { + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); /*Add custom content to the 4th button when the button itself was drawn*/ if(dsc->id == 3) { diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c b/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c index 025b408da..46d3bddce 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c @@ -1,9 +1,11 @@ #include "../../lv_examples.h" #if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * obj, lv_event_t e) +static void event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { uint32_t id = lv_btnmatrix_get_selected_btn(obj); bool prev = id == 0 ? true : false; bool next = id == 6 ? true : false; diff --git a/examples/widgets/calendar/lv_example_calendar_1.c b/examples/widgets/calendar/lv_example_calendar_1.c index da1a80481..bc9fc9a8e 100644 --- a/examples/widgets/calendar/lv_example_calendar_1.c +++ b/examples/widgets/calendar/lv_example_calendar_1.c @@ -1,9 +1,12 @@ #include "../../lv_examples.h" #if LV_USE_CALENDAR && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if(code == LV_EVENT_VALUE_CHANGED) { lv_calendar_date_t date; if(lv_calendar_get_pressed_date(obj, &date)) { LV_LOG_USER("Clicked date: %02d.%02d.%d", date.day, date.month, date.year); diff --git a/examples/widgets/chart/lv_example_chart_2.c b/examples/widgets/chart/lv_example_chart_2.c index 1e32e54aa..32ed105b4 100644 --- a/examples/widgets/chart/lv_example_chart_2.c +++ b/examples/widgets/chart/lv_example_chart_2.c @@ -5,11 +5,14 @@ static lv_obj_t * chart1; static lv_chart_series_t * ser1; static lv_chart_series_t * ser2; -static void event_cb(lv_obj_t * obj, lv_event_t e) +static void event_cb(lv_event_t * e) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + /*Add the faded area before the lines are drawn*/ - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); + if(code == LV_EVENT_DRAW_PART_BEGIN) { + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); if(dsc->part != LV_PART_ITEMS) return; if(!dsc->p1 || !dsc->p2) return; diff --git a/examples/widgets/chart/lv_example_chart_3.c b/examples/widgets/chart/lv_example_chart_3.c index 08f22a28f..c06ab25e8 100644 --- a/examples/widgets/chart/lv_example_chart_3.c +++ b/examples/widgets/chart/lv_example_chart_3.c @@ -1,11 +1,11 @@ #include "../../lv_examples.h" #if LV_USE_CHART && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * chart, lv_event_t e) +static void event_cb(lv_event_t * e) { - LV_UNUSED(chart); - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); + lv_event_code_t code = lv_event_get_code(e); + if(code == LV_EVENT_DRAW_PART_BEGIN) { + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); if(dsc->part == LV_PART_TICKS && dsc->id == LV_CHART_AXIS_X) { const char * month[] = {"Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"}; lv_snprintf(dsc->text, sizeof(dsc->text), "%s", month[dsc->value]); diff --git a/examples/widgets/chart/lv_example_chart_4.c b/examples/widgets/chart/lv_example_chart_4.c index cee75bd77..eb085aa92 100644 --- a/examples/widgets/chart/lv_example_chart_4.c +++ b/examples/widgets/chart/lv_example_chart_4.c @@ -2,16 +2,19 @@ #if LV_USE_CHART && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * chart, lv_event_t e) +static void event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * chart = lv_event_get_target(e); + + if(code == LV_EVENT_VALUE_CHANGED) { lv_obj_invalidate(chart); } - if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t * s = lv_event_get_param(); + if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX(*s, 20); } - else if(e == LV_EVENT_DRAW_POST_END) { + else if(code == LV_EVENT_DRAW_POST_END) { int32_t id = lv_chart_get_pressed_point(chart); if(id == LV_CHART_POINT_NONE) return; @@ -42,7 +45,7 @@ static void event_cb(lv_obj_t * chart, lv_event_t e) a.y1 = chart->coords.y1 + p.y - 30; a.y2 = chart->coords.y1 + p.y - 10; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_draw_rect(&a, clip_area, &draw_rect_dsc); ser = lv_chart_get_series_next(chart, ser); diff --git a/examples/widgets/chart/lv_example_chart_5.c b/examples/widgets/chart/lv_example_chart_5.c index d4eedee7f..50a5bcfdf 100644 --- a/examples/widgets/chart/lv_example_chart_5.c +++ b/examples/widgets/chart/lv_example_chart_5.c @@ -46,17 +46,21 @@ static const lv_coord_t ecg_sample[] = { 70, 74, 76, 79, 82, 79, 75, 62, }; -static void slider_x_event_cb(lv_obj_t * obj, lv_event_t e) +static void slider_x_event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { int32_t v = lv_slider_get_value(obj); lv_chart_set_zoom_x(chart, v); } } -static void slider_y_event_cb(lv_obj_t * obj, lv_event_t e) +static void slider_y_event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { lv_chart_set_zoom_y(chart, lv_slider_get_value(obj)); } } diff --git a/examples/widgets/chart/lv_example_chart_6.c b/examples/widgets/chart/lv_example_chart_6.c index 9297164ef..61c222f23 100644 --- a/examples/widgets/chart/lv_example_chart_6.c +++ b/examples/widgets/chart/lv_example_chart_6.c @@ -5,10 +5,13 @@ static lv_obj_t * chart; static lv_chart_series_t * ser; static lv_chart_cursor_t * cursor; -static void event_cb(lv_obj_t * obj, lv_event_t e) +static void event_cb(lv_event_t * e) { static int32_t last_id = -1; - if(e == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if(code == LV_EVENT_VALUE_CHANGED) { last_id = lv_chart_get_pressed_point(obj); if(last_id != LV_CHART_POINT_NONE) { lv_point_t p; @@ -16,8 +19,8 @@ static void event_cb(lv_obj_t * obj, lv_event_t e) lv_chart_set_cursor_point(obj, cursor, &p); } } - else if(e == LV_EVENT_DRAW_PART_END) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); + else if(code == LV_EVENT_DRAW_PART_END) { + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); if(dsc->part == LV_PART_CURSOR && dsc->p1 && dsc->p2 && dsc->p1->y == dsc->p2->y && last_id >= 0) { lv_coord_t * data_array = lv_chart_get_array(chart, ser); lv_coord_t v = data_array[last_id]; diff --git a/examples/widgets/checkbox/lv_example_checkbox_1.c b/examples/widgets/checkbox/lv_example_checkbox_1.c index 50cd4cca7..1d0b4e76f 100644 --- a/examples/widgets/checkbox/lv_example_checkbox_1.c +++ b/examples/widgets/checkbox/lv_example_checkbox_1.c @@ -1,9 +1,11 @@ #include "../../lv_examples.h" #if LV_USE_CHECKBOX && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { const char * txt = lv_checkbox_get_text(obj); const char * state = lv_obj_get_state(obj) & LV_STATE_CHECKED ? "Checked" : "Unchecked"; LV_LOG_USER("%s: %s\n", txt, state); diff --git a/examples/widgets/dropdown/lv_example_dropdown_1.c b/examples/widgets/dropdown/lv_example_dropdown_1.c index 8d68569f6..0f4a83f43 100644 --- a/examples/widgets/dropdown/lv_example_dropdown_1.c +++ b/examples/widgets/dropdown/lv_example_dropdown_1.c @@ -1,14 +1,14 @@ #include "../../lv_examples.h" #if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { -#if LV_USE_LOG /*To avoid warnings if LV_LOG_USER is empty*/ + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { char buf[32]; lv_dropdown_get_selected_str(obj, buf, sizeof(buf)); LV_LOG_USER("Option: %s", buf); -#endif } } diff --git a/examples/widgets/dropdown/lv_example_dropdown_3.c b/examples/widgets/dropdown/lv_example_dropdown_3.c index 7cd3285d9..eda649b0a 100644 --- a/examples/widgets/dropdown/lv_example_dropdown_3.c +++ b/examples/widgets/dropdown/lv_example_dropdown_3.c @@ -1,9 +1,11 @@ #include "../../lv_examples.h" #if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * dropdown, lv_event_t e) +static void event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * dropdown = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { char buf[64]; lv_dropdown_get_selected_str(dropdown, buf, sizeof(buf)); LV_LOG_USER("'%s' is selected", buf); diff --git a/examples/widgets/img/lv_example_img_2.c b/examples/widgets/img/lv_example_img_2.c index 686d7d9d5..f2cd80520 100644 --- a/examples/widgets/img/lv_example_img_2.c +++ b/examples/widgets/img/lv_example_img_2.c @@ -2,7 +2,7 @@ #if LV_USE_IMG && LV_USE_SLIDER && LV_BUILD_EXAMPLES static lv_obj_t * create_slider(lv_color_t color); -static void slider_event_cb(lv_obj_t * slider, lv_event_t event); +static void slider_event_cb(lv_event_t * e); static lv_obj_t * red_slider, * green_slider, * blue_slider, * intense_slider; static lv_obj_t * img1; @@ -38,11 +38,11 @@ void lv_example_img_2(void) lv_event_send(intense_slider, LV_EVENT_VALUE_CHANGED, NULL); } -static void slider_event_cb(lv_obj_t * slider, lv_event_t event) +static void slider_event_cb(lv_event_t * e) { - LV_UNUSED(slider); - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + if(code == LV_EVENT_VALUE_CHANGED) { /*Recolor the image based on the sliders' values*/ lv_color_t color = lv_color_make(lv_slider_get_value(red_slider), lv_slider_get_value(green_slider), lv_slider_get_value(blue_slider)); lv_opa_t intense = lv_slider_get_value(intense_slider); diff --git a/examples/widgets/keyboard/lv_example_keyboard_1.c b/examples/widgets/keyboard/lv_example_keyboard_1.c index a19424757..f7918d1c3 100644 --- a/examples/widgets/keyboard/lv_example_keyboard_1.c +++ b/examples/widgets/keyboard/lv_example_keyboard_1.c @@ -1,15 +1,17 @@ #include "../../lv_examples.h" #if LV_USE_KEYBOARD && LV_BUILD_EXAMPLES -static void ta_event_cb(lv_obj_t * ta, lv_event_t e) +static void ta_event_cb(lv_event_t * e) { - lv_obj_t * kb = lv_event_get_user_data(); - if(e == LV_EVENT_FOCUSED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * ta = lv_event_get_target(e); + lv_obj_t * kb = lv_event_get_user_data(e); + if(code == LV_EVENT_FOCUSED) { lv_keyboard_set_textarea(kb, ta); lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN); } - if(e == LV_EVENT_DEFOCUSED) { + if(code == LV_EVENT_DEFOCUSED) { lv_keyboard_set_textarea(kb, NULL); lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN); } diff --git a/examples/widgets/list/lv_example_list_1.c b/examples/widgets/list/lv_example_list_1.c index b7cea3d26..5ad51a298 100644 --- a/examples/widgets/list/lv_example_list_1.c +++ b/examples/widgets/list/lv_example_list_1.c @@ -2,9 +2,11 @@ #if LV_USE_LIST && LV_BUILD_EXAMPLES static lv_obj_t * list1; -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_CLICKED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_CLICKED) { LV_LOG_USER("Clicked: %s", lv_list_get_btn_text(list1, obj)); } } diff --git a/examples/widgets/msgbox/lv_example_msgbox_1.c b/examples/widgets/msgbox/lv_example_msgbox_1.c index 15ec5adab..b9eb42c5a 100644 --- a/examples/widgets/msgbox/lv_example_msgbox_1.c +++ b/examples/widgets/msgbox/lv_example_msgbox_1.c @@ -1,9 +1,11 @@ #include "../../lv_examples.h" #if LV_USE_MSGBOX && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * obj, lv_event_t event) +static void event_cb(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { LV_LOG_USER("Button %s clicked", lv_msgbox_get_active_btn_text(obj)); } } diff --git a/examples/widgets/roller/lv_example_roller_1.c b/examples/widgets/roller/lv_example_roller_1.c index fb00d746e..e9781eb77 100644 --- a/examples/widgets/roller/lv_example_roller_1.c +++ b/examples/widgets/roller/lv_example_roller_1.c @@ -1,9 +1,11 @@ #include "../../lv_examples.h" #if LV_USE_ROLLER && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { char buf[32]; lv_roller_get_selected_str(obj, buf, sizeof(buf)); LV_LOG_USER("Selected month: %s\n", buf); diff --git a/examples/widgets/roller/lv_example_roller_2.c b/examples/widgets/roller/lv_example_roller_2.c index 2c1d2457b..daef45305 100644 --- a/examples/widgets/roller/lv_example_roller_2.c +++ b/examples/widgets/roller/lv_example_roller_2.c @@ -1,9 +1,11 @@ #include "../../lv_examples.h" #if LV_USE_ROLLER && LV_FONT_MONTSERRAT_22 && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { char buf[32]; lv_roller_get_selected_str(obj, buf, sizeof(buf)); LV_LOG_USER("Selected value: %s\n", buf); diff --git a/examples/widgets/slider/lv_example_slider_1.c b/examples/widgets/slider/lv_example_slider_1.c index 0b9a5d4a5..69363c64d 100644 --- a/examples/widgets/slider/lv_example_slider_1.c +++ b/examples/widgets/slider/lv_example_slider_1.c @@ -1,7 +1,7 @@ #include "../../lv_examples.h" #if LV_USE_SLIDER && LV_BUILD_EXAMPLES -static void slider_event_cb(lv_obj_t * slider, lv_event_t event); +static void slider_event_cb(lv_event_t * e); static lv_obj_t * slider_label; /** @@ -21,9 +21,11 @@ void lv_example_slider_1(void) lv_obj_align_to(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); } -static void slider_event_cb(lv_obj_t * slider, lv_event_t event) +static void slider_event_cb(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * slider = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { char buf[8]; lv_snprintf(buf, sizeof(buf), "%d%%", lv_slider_get_value(slider)); lv_label_set_text(slider_label, buf); diff --git a/examples/widgets/slider/lv_example_slider_2.c b/examples/widgets/slider/lv_example_slider_2.c index 6dc750050..6d8004f42 100644 --- a/examples/widgets/slider/lv_example_slider_2.c +++ b/examples/widgets/slider/lv_example_slider_2.c @@ -31,7 +31,7 @@ void lv_example_slider_2(void) // //static void slider_event_cb(lv_obj_t * slider, lv_event_t event) //{ -// if(event == LV_EVENT_VALUE_CHANGED) { +// if(code == LV_EVENT_VALUE_CHANGED) { // static char buf[8]; // lv_snprintf(buf, sizeof(buf), "%u", lv_slider_get_value(slider)); // lv_obj_set_style_content_text(slider, LV_PART_KNOB, LV_STATE_DEFAULT, buf); diff --git a/examples/widgets/slider/lv_example_slider_3.c b/examples/widgets/slider/lv_example_slider_3.c index fbf1facaf..b61221f12 100644 --- a/examples/widgets/slider/lv_example_slider_3.c +++ b/examples/widgets/slider/lv_example_slider_3.c @@ -29,7 +29,7 @@ void lv_example_slider_3(void) // //static void slider_event_cb(lv_obj_t * slider, lv_event_t event) //{ -// if(event == LV_EVENT_VALUE_CHANGED) { +// if(code == LV_EVENT_VALUE_CHANGED) { // static char buf[8]; // lv_snprintf(buf, sizeof(buf), "%d - %d", lv_slider_get_value(slider), lv_slider_get_left_value(slider)); // lv_obj_set_style_content_text(slider, LV_PART_INDICATOR, LV_STATE_DEFAULT, buf); diff --git a/examples/widgets/spinbox/lv_example_spinbox_1.c b/examples/widgets/spinbox/lv_example_spinbox_1.c index 69a212873..494c6f636 100644 --- a/examples/widgets/spinbox/lv_example_spinbox_1.c +++ b/examples/widgets/spinbox/lv_example_spinbox_1.c @@ -4,18 +4,18 @@ static lv_obj_t * spinbox; -static void lv_spinbox_increment_event_cb(lv_obj_t * btn, lv_event_t e) +static void lv_spinbox_increment_event_cb(lv_event_t * e) { - LV_UNUSED(btn); - if(e == LV_EVENT_SHORT_CLICKED || e == LV_EVENT_LONG_PRESSED_REPEAT) { + lv_event_code_t code = lv_event_get_code(e); + if(code == LV_EVENT_SHORT_CLICKED || code == LV_EVENT_LONG_PRESSED_REPEAT) { lv_spinbox_increment(spinbox); } } -static void lv_spinbox_decrement_event_cb(lv_obj_t * btn, lv_event_t e) +static void lv_spinbox_decrement_event_cb(lv_event_t * e) { - LV_UNUSED(btn); - if(e == LV_EVENT_SHORT_CLICKED || e == LV_EVENT_LONG_PRESSED_REPEAT) { + lv_event_code_t code = lv_event_get_code(e); + if(code == LV_EVENT_SHORT_CLICKED || code == LV_EVENT_LONG_PRESSED_REPEAT) { lv_spinbox_decrement(spinbox); } } diff --git a/examples/widgets/switch/lv_example_switch_1.c b/examples/widgets/switch/lv_example_switch_1.c index 30eb8d09e..ff4c848aa 100644 --- a/examples/widgets/switch/lv_example_switch_1.c +++ b/examples/widgets/switch/lv_example_switch_1.c @@ -1,9 +1,11 @@ #include "../../lv_examples.h" #if LV_USE_SWITCH && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { LV_LOG_USER("State: %s\n", lv_obj_has_state(obj, LV_STATE_CHECKED) ? "On" : "Off"); } } diff --git a/examples/widgets/table/lv_example_table_1.c b/examples/widgets/table/lv_example_table_1.c index 8efbd53c9..6c9af6fbe 100644 --- a/examples/widgets/table/lv_example_table_1.c +++ b/examples/widgets/table/lv_example_table_1.c @@ -1,10 +1,12 @@ #include "../../lv_examples.h" #if LV_USE_TABLE && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * obj, lv_event_t e) +static void event_cb(lv_event_t * e) { - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_DRAW_PART_BEGIN) { + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); /*If the cells are drawn...*/ if(dsc->part == LV_PART_ITEMS) { uint32_t row = dsc->id / lv_table_get_col_cnt(obj); diff --git a/examples/widgets/table/lv_example_table_2.c b/examples/widgets/table/lv_example_table_2.c index a3edc115e..eda42e4bd 100644 --- a/examples/widgets/table/lv_example_table_2.c +++ b/examples/widgets/table/lv_example_table_2.c @@ -3,10 +3,12 @@ #define ITEM_CNT 200 -static void event_cb(lv_obj_t * obj, lv_event_t e) +static void event_cb(lv_event_t * e) { - if(e == LV_EVENT_DRAW_PART_END) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_DRAW_PART_END) { + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); /*If the cells are drawn...*/ if(dsc->part == LV_PART_ITEMS) { bool chk = lv_table_has_cell_ctrl(obj, dsc->id, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); @@ -36,7 +38,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e) lv_draw_rect(&sw_area, dsc->clip_area, &rect_dsc); } } - else if(e == LV_EVENT_VALUE_CHANGED) { + else if(code == LV_EVENT_VALUE_CHANGED) { uint16_t col; uint16_t row; lv_table_get_selected_cell(obj, &row, &col); diff --git a/examples/widgets/textarea/lv_example_textarea_1.c b/examples/widgets/textarea/lv_example_textarea_1.c index 2d69fd729..232fbb134 100644 --- a/examples/widgets/textarea/lv_example_textarea_1.c +++ b/examples/widgets/textarea/lv_example_textarea_1.c @@ -2,10 +2,12 @@ #if LV_USE_TEXTAREA && LV_BUILD_EXAMPLES -static void btnm_event_handler(lv_obj_t * obj, lv_event_t event) +static void btnm_event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { - lv_obj_t * ta = lv_event_get_user_data(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { + lv_obj_t * ta = lv_event_get_user_data(e); const char * txt = lv_btnmatrix_get_btn_text(obj, lv_btnmatrix_get_selected_btn(obj)); if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) lv_textarea_del_char(ta); diff --git a/examples/widgets/textarea/lv_example_textarea_2.c b/examples/widgets/textarea/lv_example_textarea_2.c index c1c2052a8..40bdcc713 100644 --- a/examples/widgets/textarea/lv_example_textarea_2.c +++ b/examples/widgets/textarea/lv_example_textarea_2.c @@ -1,7 +1,7 @@ #include "../../lv_examples.h" #if LV_USE_TEXTAREA && LV_USE_KEYBOARD && LV_BUILD_EXAMPLES -static void ta_event_cb(lv_obj_t * ta, lv_event_t event); +static void ta_event_cb(lv_event_t * e); static lv_obj_t * kb; @@ -39,16 +39,18 @@ void lv_example_textarea_2(void) lv_keyboard_set_textarea(kb, pwd_ta); /*Focus it on one of the text areas to start*/ } -static void ta_event_cb(lv_obj_t * ta, lv_event_t event) +static void ta_event_cb(lv_event_t * e) { - if(event == LV_EVENT_CLICKED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * ta = lv_event_get_target(e); + if(code == LV_EVENT_CLICKED) { /*Focus on the clicked text area*/ if(kb != NULL) lv_keyboard_set_textarea(kb, ta); } - else if(event == LV_EVENT_INSERT) { - const char * str = lv_event_get_param(); + else if(code == LV_EVENT_INSERT) { + const char * str = lv_event_get_param(e); if(str[0] == '\n') { LV_LOG_USER("Ready\n"); } diff --git a/examples/widgets/textarea/lv_example_textarea_3.c b/examples/widgets/textarea/lv_example_textarea_3.c index 9c9d91adf..5bfc0b838 100644 --- a/examples/widgets/textarea/lv_example_textarea_3.c +++ b/examples/widgets/textarea/lv_example_textarea_3.c @@ -1,7 +1,7 @@ #include "../../lv_examples.h" #if LV_USE_TEXTAREA && LV_USE_KEYBOARD && LV_BUILD_EXAMPLES -static void ta_event_cb(lv_obj_t * ta, lv_event_t event); +static void ta_event_cb(lv_event_t * e); static lv_obj_t * kb; @@ -26,9 +26,11 @@ void lv_example_textarea_3(void) lv_keyboard_set_textarea(kb, ta); } -static void ta_event_cb(lv_obj_t * ta, lv_event_t event) +static void ta_event_cb(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * ta = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { const char * txt = lv_textarea_get_text(ta); if(txt[0] >= '0' && txt[0] <= '9' && txt[1] >= '0' && txt[1] <= '9' && diff --git a/examples/widgets/win/lv_example_win_1.c b/examples/widgets/win/lv_example_win_1.c index f3bb32f10..f91fdc502 100644 --- a/examples/widgets/win/lv_example_win_1.c +++ b/examples/widgets/win/lv_example_win_1.c @@ -2,9 +2,11 @@ #if LV_USE_WIN && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_CLICKED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_CLICKED) { LV_LOG_USER("Button %d clicked", lv_obj_get_child_id(obj)); } } diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index 4a51bae05..e1d6363a4 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -66,15 +66,15 @@ typedef struct _lv_event_dsc_t{ **********************/ static void lv_obj_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_obj_draw(lv_obj_t * obj, lv_event_t e); -static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e); +static void lv_obj_draw(lv_event_t * e); +static void lv_obj_event_cb(lv_event_t * e); static void draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area); static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc); static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find); -static lv_res_t event_send_core(lv_obj_t * obj, lv_event_t event, void * param); +static lv_res_t event_send_core(lv_obj_t * obj, lv_event_code_t event_code, void * param); static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state); static void base_dir_refr_children(lv_obj_t * obj); -static bool event_is_bubbled(lv_event_t e); +static bool event_is_bubbled(lv_event_code_t e); /********************** * STATIC VARIABLES @@ -200,7 +200,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent) * Event/Signal sending *---------------------*/ -lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param) +lv_res_t lv_event_send(lv_obj_t * obj, lv_event_code_t event, void * param) { if(obj == NULL) return LV_RES_OK; @@ -220,10 +220,10 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param) } -lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, struct _lv_obj_t * obj, lv_event_t e) +lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e) { const lv_obj_class_t * base; - if(class_p == NULL) base = obj->class_p; + if(class_p == NULL) base = e->target->class_p; else base = class_p->base_class; /*Find a base in which Call the ancestor's event handler_cb is set*/ @@ -232,12 +232,11 @@ lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, struct _lv_obj_t * ob if(base == NULL) return LV_RES_OK; if(base->event_cb == NULL) return LV_RES_OK; - /* Build a simple linked list from the objects used in the events * It's important to know if an this object was deleted by a nested event * called from this `event_cb`. */ lv_event_temp_data_t event_temp_data; - event_temp_data.obj = obj; + event_temp_data.obj = e->target; event_temp_data.deleted = false; event_temp_data.prev = NULL; @@ -247,7 +246,8 @@ lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, struct _lv_obj_t * ob event_temp_data_head = &event_temp_data; /*Call the actual event callback*/ - base->event_cb(obj, e); + e->user_data = NULL; + base->event_cb(e); lv_res_t res = LV_RES_OK; /*Stop if the object is deleted*/ @@ -260,14 +260,24 @@ lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, struct _lv_obj_t * ob } -void * lv_event_get_param(void) +lv_obj_t * lv_event_get_target(lv_event_t * e) { - return event_act_param; + return e->target; } -void * lv_event_get_user_data(void) +lv_event_code_t lv_event_get_code(lv_event_t * e) { - return event_act_user_data_cb; + return e->code; +} + +void * lv_event_get_param(lv_event_t * e) +{ + return e->param; +} + +void * lv_event_get_user_data(lv_event_t * e) +{ + return e->user_data; } lv_obj_t * lv_event_get_original_target(void) @@ -625,10 +635,12 @@ static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) } -static void lv_obj_draw(lv_obj_t * obj, lv_event_t e) +static void lv_obj_draw(lv_event_t * e) { - if(e == LV_EVENT_COVER_CHECK) { - lv_cover_check_info_t * info = lv_event_get_param(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_COVER_CHECK) { + lv_cover_check_info_t * info = lv_event_get_param(e); if(info->res == LV_DRAW_RES_MASKED) return; if(lv_obj_get_style_clip_corner(obj, LV_PART_MAIN)) { info->res = LV_DRAW_RES_MASKED; @@ -670,8 +682,8 @@ static void lv_obj_draw(lv_obj_t * obj, lv_event_t e) info->res = LV_DRAW_RES_COVER; } - else if(e == LV_EVENT_DRAW_MAIN) { - const lv_area_t * clip_area = lv_event_get_param(); + else if(code == LV_EVENT_DRAW_MAIN) { + const lv_area_t * clip_area = lv_event_get_param(e); lv_draw_rect_dsc_t draw_dsc; lv_draw_rect_dsc_init(&draw_dsc); /*If the border is drawn later disable loading its properties*/ @@ -702,8 +714,8 @@ static void lv_obj_draw(lv_obj_t * obj, lv_event_t e) } #endif } - else if(e == LV_EVENT_DRAW_POST) { - const lv_area_t * clip_area = lv_event_get_param(); + else if(code == LV_EVENT_DRAW_POST) { + const lv_area_t * clip_area = lv_event_get_param(e); draw_scrollbar(obj, clip_area); #if LV_DRAW_COMPLEX @@ -797,27 +809,29 @@ static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc #include "lvgl/lvgl.h" -static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e) +static void lv_obj_event_cb(lv_event_t * e) { - if(e == LV_EVENT_PRESSED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_PRESSED) { lv_obj_add_state(obj, LV_STATE_PRESSED); } - else if(e == LV_EVENT_RELEASED) { + else if(code == LV_EVENT_RELEASED) { lv_obj_clear_state(obj, LV_STATE_PRESSED); - void * param = lv_event_get_param(); + void * param = lv_event_get_param(e); /*Go the checked state if enabled*/ if(lv_indev_get_scroll_obj(param) == NULL && lv_obj_has_flag(obj, LV_OBJ_FLAG_CHECKABLE)) { if(!(lv_obj_get_state(obj) & LV_STATE_CHECKED)) lv_obj_add_state(obj, LV_STATE_CHECKED); else lv_obj_clear_state(obj, LV_STATE_CHECKED); } } - else if(e == LV_EVENT_PRESS_LOST) { + else if(code == LV_EVENT_PRESS_LOST) { lv_obj_clear_state(obj, LV_STATE_PRESSED); } - else if(e == LV_EVENT_KEY) { + else if(code == LV_EVENT_KEY) { if(lv_obj_has_flag(obj, LV_OBJ_FLAG_CHECKABLE)) { uint32_t state = 0; - char c = *((char *)lv_event_get_param()); + char c = *((char *)lv_event_get_param(e)); if(c == LV_KEY_RIGHT || c == LV_KEY_UP) { lv_obj_add_state(obj, LV_STATE_CHECKED); state = 1; @@ -830,7 +844,7 @@ static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e) if(res != LV_RES_OK) return; } } - else if(e == LV_EVENT_FOCUSED) { + else if(code == LV_EVENT_FOCUSED) { if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS)) { lv_obj_scroll_to_view_recursive(obj, LV_ANIM_ON); } @@ -856,19 +870,19 @@ static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e) lv_obj_clear_state(obj, LV_STATE_EDITED); } } - else if(e == LV_EVENT_SCROLL_BEGIN) { + else if(code == LV_EVENT_SCROLL_BEGIN) { lv_obj_add_state(obj, LV_STATE_SCROLLED); } - else if(e == LV_EVENT_SCROLL_END) { + else if(code == LV_EVENT_SCROLL_END) { lv_obj_clear_state(obj, LV_STATE_SCROLLED); } - else if(e == LV_EVENT_DEFOCUSED) { + else if(code == LV_EVENT_DEFOCUSED) { /*if using focus mode, change target to parent*/ obj = lv_obj_get_focused_obj(obj); lv_obj_clear_state(obj, LV_STATE_FOCUSED | LV_STATE_EDITED | LV_STATE_FOCUS_KEY); } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { uint32_t i; for(i = 0; i < lv_obj_get_child_cnt(obj); i++) { lv_obj_t * child = lv_obj_get_child(obj, i); @@ -883,7 +897,7 @@ static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e) lv_obj_mark_layout_as_dirty(obj); } } - else if(e == LV_EVENT_CHILD_CHANGED) { + else if(code == LV_EVENT_CHILD_CHANGED) { lv_coord_t w = lv_obj_get_style_width(obj, LV_PART_MAIN); lv_coord_t h = lv_obj_get_style_height(obj, LV_PART_MAIN); lv_coord_t align = lv_obj_get_style_align(obj, LV_PART_MAIN); @@ -892,22 +906,22 @@ static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e) lv_obj_mark_layout_as_dirty(obj); } } - else if(e == LV_EVENT_BASE_DIR_CHANGED) { + else if(code == LV_EVENT_BASE_DIR_CHANGED) { /*The layout might depend on the base dir. *E.g. the first is element is on the left or right*/ lv_obj_mark_layout_as_dirty(obj); } - else if(e == LV_EVENT_SCROLL_END) { + else if(code == LV_EVENT_SCROLL_END) { if(lv_obj_get_scrollbar_mode(obj) == LV_SCROLLBAR_MODE_ACTIVE) { lv_obj_invalidate(obj); } } - else if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t * s = lv_event_get_param(); + else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_coord_t * s = lv_event_get_param(e); lv_coord_t d = lv_obj_calculate_ext_draw_size(obj, LV_PART_MAIN); *s = LV_MAX(*s, d); } - else if(e == LV_EVENT_STYLE_CHANGED) { + else if(code == LV_EVENT_STYLE_CHANGED) { /*Padding might have changed so the layout should be recalculated*/ uint32_t i; for(i = 0; i < lv_obj_get_child_cnt(obj); i++) { @@ -921,8 +935,8 @@ static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e) lv_obj_refresh_ext_draw_size(obj); } - else if(e == LV_EVENT_DRAW_MAIN || e == LV_EVENT_DRAW_POST || e == LV_EVENT_COVER_CHECK) { - lv_obj_draw(obj, e); + else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST || code == LV_EVENT_COVER_CHECK) { + lv_obj_draw(e); } } @@ -1033,9 +1047,9 @@ static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_fin return false; } -static lv_res_t event_send_core(lv_obj_t * obj, lv_event_t event, void * param) +static lv_res_t event_send_core(lv_obj_t * obj, lv_event_code_t event_code, void * param) { - EVENT_TRACE("Sending event %d to %p with %p param", event, obj, param); + EVENT_TRACE("Sending event %d to %p with %p param", event_code, obj, param); /*Build a simple linked list from the objects used in the events *It's important to know if an this object was deleted by a nested event @@ -1058,12 +1072,17 @@ static lv_res_t event_send_core(lv_obj_t * obj, lv_event_t event, void * param) /*Call the input device's feedback callback if set*/ lv_indev_t * indev_act = lv_indev_get_act(); if(indev_act) { - if(indev_act->driver->feedback_cb) indev_act->driver->feedback_cb(indev_act->driver, event); + if(indev_act->driver->feedback_cb) indev_act->driver->feedback_cb(indev_act->driver, event_code); } lv_event_dsc_t * event_dsc = lv_obj_get_event_dsc(obj, 0); lv_res_t res = LV_RES_OK; - res = lv_obj_event_base(NULL, obj, event); + lv_event_t e; + e.code = event_code; + e.target = obj; + e.original_target = obj; + e.param = param; + res = lv_obj_event_base(NULL, &e); uint32_t i = 0; while(event_dsc && res == LV_RES_OK) { @@ -1071,7 +1090,8 @@ static lv_res_t event_send_core(lv_obj_t * obj, lv_event_t event, void * param) void * event_act_user_data_cb_save = event_act_user_data_cb; event_act_user_data_cb = event_dsc->user_data; - event_dsc->cb(obj, event); + e.user_data = event_dsc->user_data; + event_dsc->cb(&e); event_act_user_data_cb = event_act_user_data_cb_save; @@ -1086,23 +1106,23 @@ static lv_res_t event_send_core(lv_obj_t * obj, lv_event_t event, void * param) event_dsc = lv_obj_get_event_dsc(obj, i); } - /*Restore the event param*/ + /*Restore the event_code param*/ event_act_param = event_act_param_save; /*Remove this element from the list*/ event_temp_data_head = event_temp_data_head->prev; - if(res == LV_RES_OK && event_is_bubbled(event)) { + if(res == LV_RES_OK && event_is_bubbled(event_code)) { if(lv_obj_has_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE) && obj->parent) { - res = event_send_core(obj->parent, event, param); + res = event_send_core(obj->parent, event_code, param); if(res != LV_RES_OK) return LV_RES_INV; } } - return LV_RES_OK; + return res; } -static bool event_is_bubbled(lv_event_t e) +static bool event_is_bubbled(lv_event_code_t e) { switch(e) { case LV_EVENT_HIT_TEST: diff --git a/src/core/lv_obj.h b/src/core/lv_obj.h index 015113e11..7fa4586c9 100644 --- a/src/core/lv_obj.h +++ b/src/core/lv_obj.h @@ -91,6 +91,15 @@ typedef enum { LV_EVENT_GET_SELF_SIZE, /**< Get the internal size of a widget*/ _LV_EVENT_LAST /** Number of default events*/ +}lv_event_code_t; + + +typedef struct { + struct _lv_obj_t * target; + struct _lv_obj_t * original_target; + lv_event_code_t code; + void * user_data; + void * param; }lv_event_t; /** @@ -98,7 +107,7 @@ typedef enum { * Events are used to notify the user of some action being taken on the object. * For details, see ::lv_event_t. */ -typedef void (*lv_event_cb_t)(struct _lv_obj_t * obj, lv_event_t event); +typedef void (*lv_event_cb_t)(lv_event_t * e); /*--------------------- * EVENTS @@ -301,21 +310,17 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent); * @param param arbitrary data depending on the object type and the event. (Usually `NULL`) * @return LV_RES_OK: `obj` was not deleted in the event; LV_RES_INV: `obj` was deleted in the event */ -lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param); +lv_res_t lv_event_send(lv_obj_t * obj, lv_event_code_t event, void * param); -lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, struct _lv_obj_t * obj, lv_event_t e); +lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e); -/** - * Get the `param` parameter of the current event - * @return the `param` parameter - */ -void * lv_event_get_param(void); +lv_obj_t * lv_event_get_target(lv_event_t * e); -/** - * Get the user data of the event callback. (Set when the callback is registered) - * @return the user data parameter - */ -void * lv_event_get_user_data(void); +lv_event_code_t lv_event_get_code(lv_event_t * e); + +void * lv_event_get_param(lv_event_t * e); + +void * lv_event_get_user_data(lv_event_t * e); /** * Get the original target of the event. It's different than the "normal" target if the event is bubbled. diff --git a/src/extra/widgets/calendar/lv_calendar.c b/src/extra/widgets/calendar/lv_calendar.c index 32f27e5b1..58d0ff2d4 100644 --- a/src/extra/widgets/calendar/lv_calendar.c +++ b/src/extra/widgets/calendar/lv_calendar.c @@ -24,7 +24,7 @@ * STATIC PROTOTYPES **********************/ static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void draw_event_cb(lv_obj_t * obj, lv_event_t e); +static void draw_event_cb(lv_event_t * e); static uint8_t get_day_of_week(uint32_t year, uint32_t month, uint32_t day); static uint8_t get_month_length(int32_t year, int32_t month); @@ -252,10 +252,12 @@ static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) } -static void draw_event_cb(lv_obj_t * obj, lv_event_t e) +static void draw_event_cb(lv_event_t * e) { - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_DRAW_PART_BEGIN) { + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); if(dsc->part == LV_PART_ITEMS) { /*Day name styles*/ if(dsc->id < 7) { diff --git a/src/extra/widgets/calendar/lv_calendar_header_arrow.c b/src/extra/widgets/calendar/lv_calendar_header_arrow.c index 5dcaa6842..20e13b7ea 100644 --- a/src/extra/widgets/calendar/lv_calendar_header_arrow.c +++ b/src/extra/widgets/calendar/lv_calendar_header_arrow.c @@ -25,7 +25,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void month_event_cb(lv_obj_t * btn, lv_event_t e); +static void month_event_cb(lv_event_t * e); /********************** * STATIC VARIABLES @@ -86,12 +86,16 @@ lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent, lv_obj_t * calenda * STATIC FUNCTIONS **********************/ -static void month_event_cb(lv_obj_t * btn, lv_event_t e) +static void month_event_cb(lv_event_t * e) { - if(e != LV_EVENT_CLICKED) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * btn = lv_event_get_target(e); + + if(code != LV_EVENT_CLICKED) return; + lv_obj_t * header = lv_obj_get_parent(btn); - lv_obj_t * calendar = lv_event_get_user_data(); + lv_obj_t * calendar = lv_event_get_user_data(e); const lv_calendar_date_t * d; d = lv_calendar_get_showed_date(calendar); diff --git a/src/extra/widgets/calendar/lv_calendar_header_dropdown.c b/src/extra/widgets/calendar/lv_calendar_header_dropdown.c index 13a6343b8..c70371ff2 100644 --- a/src/extra/widgets/calendar/lv_calendar_header_dropdown.c +++ b/src/extra/widgets/calendar/lv_calendar_header_dropdown.c @@ -24,8 +24,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void year_event_cb(lv_obj_t * btn, lv_event_t e); -static void month_event_cb(lv_obj_t * btn, lv_event_t e); +static void year_event_cb(lv_event_t * e); +static void month_event_cb(lv_event_t * e); /********************** * STATIC VARIABLES @@ -89,11 +89,13 @@ lv_obj_t * lv_calendar_header_dropdown_create(lv_obj_t * parent, lv_obj_t * cale * STATIC FUNCTIONS **********************/ -static void month_event_cb(lv_obj_t * dropdown, lv_event_t e) +static void month_event_cb(lv_event_t * e) { - if(e != LV_EVENT_VALUE_CHANGED) return; + lv_event_code_t code = lv_event_get_code(e); + if(code != LV_EVENT_VALUE_CHANGED) return; - lv_obj_t * calendar = lv_event_get_user_data(); + lv_obj_t * dropdown = lv_event_get_target(e); + lv_obj_t * calendar = lv_event_get_user_data(e); uint16_t sel = lv_dropdown_get_selected(dropdown); @@ -104,11 +106,13 @@ static void month_event_cb(lv_obj_t * dropdown, lv_event_t e) lv_calendar_set_showed_date(calendar, newd.year, newd.month); } -static void year_event_cb(lv_obj_t * dropdown, lv_event_t e) +static void year_event_cb(lv_event_t * e) { - if(e != LV_EVENT_VALUE_CHANGED) return; + lv_event_code_t code = lv_event_get_code(e); + if(code != LV_EVENT_VALUE_CHANGED) return; - lv_obj_t * calendar = lv_event_get_user_data(); + lv_obj_t * dropdown = lv_event_get_target(e); + lv_obj_t * calendar = lv_event_get_user_data(e); uint16_t sel = lv_dropdown_get_selected(dropdown); diff --git a/src/extra/widgets/colorwheel/lv_colorwheel.c b/src/extra/widgets/colorwheel/lv_colorwheel.c index 048150d9d..0866cd7ea 100644 --- a/src/extra/widgets/colorwheel/lv_colorwheel.c +++ b/src/extra/widgets/colorwheel/lv_colorwheel.c @@ -33,10 +33,10 @@ * STATIC PROTOTYPES **********************/ static void lv_colorwheel_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_colorwheel_event(lv_obj_t * obj, lv_event_t e); +static void lv_colorwheel_event(lv_event_t * e); -static void draw_disc_grad(lv_obj_t * obj); -static void draw_knob(lv_obj_t * obj); +static void draw_disc_grad(lv_event_t * e); +static void draw_knob(lv_event_t * e); static void invalidate_knob(lv_obj_t * obj); static lv_area_t get_knob_area(lv_obj_t * obj); @@ -225,9 +225,10 @@ static void lv_colorwheel_constructor(const lv_obj_class_t * class_p, lv_obj_t * refr_knob_pos(obj); } -static void draw_disc_grad(lv_obj_t * obj) +static void draw_disc_grad(lv_event_t * e) { - const lv_area_t * clip_area = lv_event_get_param(); + lv_obj_t * obj = lv_event_get_target(e); + const lv_area_t * clip_area = lv_event_get_param(e); lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); lv_coord_t cx = obj->coords.x1 + w / 2; @@ -286,9 +287,10 @@ static void draw_disc_grad(lv_obj_t * obj) #endif } -static void draw_knob(lv_obj_t * obj) +static void draw_knob(lv_event_t * e) { - const lv_area_t * clip_area = lv_event_get_param(); + lv_obj_t * obj = lv_event_get_target(e); + const lv_area_t * clip_area = lv_event_get_param(e); lv_colorwheel_t * colorwheel = (lv_colorwheel_t *)obj; lv_draw_rect_dsc_t cir_dsc; @@ -335,39 +337,41 @@ static lv_area_t get_knob_area(lv_obj_t * obj) return knob_area; } -static void lv_colorwheel_event(lv_obj_t * obj, lv_event_t e) +static void lv_colorwheel_event(lv_event_t * e) { /*Call the ancestor's event handler*/ - lv_res_t res = lv_obj_event_base(MY_CLASS, obj, e); + lv_res_t res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_colorwheel_t * colorwheel = (lv_colorwheel_t *)obj; - if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { lv_coord_t left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); lv_coord_t right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); lv_coord_t top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); lv_coord_t bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); lv_coord_t knob_pad = LV_MAX4(left, right, top, bottom) + 2; - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX(*s, knob_pad); } - else if(e == LV_EVENT_SIZE_CHANGED) { - void * param = lv_event_get_param(); + else if(code == LV_EVENT_SIZE_CHANGED) { + void * param = lv_event_get_param(e); /*Refresh extended draw area to make knob visible*/ if(lv_obj_get_width(obj) != lv_area_get_width(param) || lv_obj_get_height(obj) != lv_area_get_height(param)) { refr_knob_pos(obj); } } - else if(e == LV_EVENT_STYLE_CHANGED) { + else if(code == LV_EVENT_STYLE_CHANGED) { /*Refresh extended draw area to make knob visible*/ refr_knob_pos(obj); } - else if(e == LV_EVENT_KEY) { - uint32_t c = *((uint32_t *)lv_event_get_param()); /*uint32_t because can be UTF-8*/ + else if(code == LV_EVENT_KEY) { + uint32_t c = *((uint32_t *)lv_event_get_param(e)); /*uint32_t because can be UTF-8*/ if(c == LV_KEY_RIGHT || c == LV_KEY_UP) { lv_color_hsv_t hsv_cur; @@ -412,13 +416,13 @@ static void lv_colorwheel_event(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_PRESSED) { + else if(code == LV_EVENT_PRESSED) { colorwheel->last_change_time = lv_tick_get(); lv_indev_get_point(lv_indev_get_act(), &colorwheel->last_press_point); res = double_click_reset(obj); if(res != LV_RES_OK) return; } - else if(e == LV_EVENT_PRESSING) { + else if(code == LV_EVENT_PRESSING) { lv_indev_t * indev = lv_indev_get_act(); if(indev == NULL) return; @@ -498,18 +502,18 @@ static void lv_colorwheel_event(lv_obj_t * obj, lv_event_t e) if(res != LV_RES_OK) return; } } - else if(e == LV_EVENT_HIT_TEST) { - lv_hit_test_info_t * info = lv_event_get_param();; + else if(code == LV_EVENT_HIT_TEST) { + lv_hit_test_info_t * info = lv_event_get_param(e);; /*Valid clicks can be only in the circle*/ info->result = _lv_area_is_point_on(&obj->coords, info->point, LV_RADIUS_CIRCLE); } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_disc_grad(obj); - draw_knob(obj); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_disc_grad(e); + draw_knob(e); } - else if(e == LV_EVENT_COVER_CHECK) { - lv_cover_check_info_t * info = lv_event_get_param(); + else if(code == LV_EVENT_COVER_CHECK) { + lv_cover_check_info_t * info = lv_event_get_param(e); if(info->res != LV_DRAW_RES_MASKED) info->res = LV_DRAW_RES_NOT_COVER; } } diff --git a/src/extra/widgets/imgbtn/lv_imgbtn.c b/src/extra/widgets/imgbtn/lv_imgbtn.c index 51da085de..f85140a6a 100644 --- a/src/extra/widgets/imgbtn/lv_imgbtn.c +++ b/src/extra/widgets/imgbtn/lv_imgbtn.c @@ -24,8 +24,8 @@ * STATIC PROTOTYPES **********************/ static void lv_imgbtn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void draw_main(lv_obj_t * obj); -static void lv_imgbtn_event(lv_obj_t * imgbtn, lv_event_t e); +static void draw_main(lv_event_t * e); +static void lv_imgbtn_event(lv_event_t * e); static void refr_img(lv_obj_t * imgbtn); static lv_imgbtn_state_t suggest_state(lv_obj_t * imgbtn, lv_imgbtn_state_t state); lv_imgbtn_state_t get_state(const lv_obj_t * imgbtn); @@ -160,27 +160,30 @@ static void lv_imgbtn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj } -static void lv_imgbtn_event(lv_obj_t * obj, lv_event_t e) +static void lv_imgbtn_event(lv_event_t * e) { - lv_res_t res = lv_obj_event_base(&lv_imgbtn_class, obj, e); + lv_res_t res = lv_obj_event_base(&lv_imgbtn_class, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_PRESSED || e == LV_EVENT_RELEASED || e == LV_EVENT_PRESS_LOST) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_PRESSED || code == LV_EVENT_RELEASED || code == LV_EVENT_PRESS_LOST) { refr_img(obj); } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_main(obj); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_main(e); } - else if(e == LV_EVENT_COVER_CHECK) { - lv_cover_check_info_t * info = lv_event_get_param(); + else if(code == LV_EVENT_COVER_CHECK) { + lv_cover_check_info_t * info = lv_event_get_param(e); if(info->res != LV_DRAW_RES_MASKED) info->res = LV_DRAW_RES_NOT_COVER; } } -static void draw_main(lv_obj_t * obj) +static void draw_main(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_imgbtn_t * imgbtn = (lv_imgbtn_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); /*Just draw_main an image*/ lv_imgbtn_state_t state = suggest_state(obj, get_state(obj)); diff --git a/src/extra/widgets/keyboard/lv_keyboard.c b/src/extra/widgets/keyboard/lv_keyboard.c index 44731d2b5..45955b31b 100644 --- a/src/extra/widgets/keyboard/lv_keyboard.c +++ b/src/extra/widgets/keyboard/lv_keyboard.c @@ -220,15 +220,17 @@ lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * obj) * @param kb pointer to a keyboard * @param event the triggering event */ -void lv_keyboard_def_event_cb(lv_obj_t * obj, lv_event_t event) +void lv_keyboard_def_event_cb(lv_event_t * e) { - if(event != LV_EVENT_VALUE_CHANGED) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code != LV_EVENT_VALUE_CHANGED) return; lv_keyboard_t * keyboard = (lv_keyboard_t *)obj; uint16_t btn_id = lv_btnmatrix_get_selected_btn(obj); if(btn_id == LV_BTNMATRIX_BTN_NONE) return; if(lv_btnmatrix_has_btn_ctrl(obj, btn_id, LV_BTNMATRIX_CTRL_HIDDEN | LV_BTNMATRIX_CTRL_DISABLED)) return; - if(lv_btnmatrix_has_btn_ctrl(obj, btn_id, LV_BTNMATRIX_CTRL_NO_REPEAT) && event == LV_EVENT_LONG_PRESSED_REPEAT) return; + if(lv_btnmatrix_has_btn_ctrl(obj, btn_id, LV_BTNMATRIX_CTRL_NO_REPEAT) && code == LV_EVENT_LONG_PRESSED_REPEAT) return; const char * txt = lv_btnmatrix_get_btn_text(obj, lv_btnmatrix_get_selected_btn(obj)); if(txt == NULL) return; diff --git a/src/extra/widgets/keyboard/lv_keyboard.h b/src/extra/widgets/keyboard/lv_keyboard.h index 32ee85833..2aa2f3d11 100644 --- a/src/extra/widgets/keyboard/lv_keyboard.h +++ b/src/extra/widgets/keyboard/lv_keyboard.h @@ -130,7 +130,7 @@ static inline const char ** lv_keyboard_get_map_array(const lv_obj_t * kb) * @param kb pointer to a keyboard * @param event the triggering event */ -void lv_keyboard_def_event_cb(lv_obj_t * kb, lv_event_t event); +void lv_keyboard_def_event_cb(lv_event_t * e); /********************** * MACROS diff --git a/src/extra/widgets/led/lv_led.c b/src/extra/widgets/led/lv_led.c index e50ae975d..f7f0249a9 100644 --- a/src/extra/widgets/led/lv_led.c +++ b/src/extra/widgets/led/lv_led.c @@ -30,7 +30,7 @@ * STATIC PROTOTYPES **********************/ static void lv_led_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_led_event(lv_obj_t * obj, lv_event_t e); +static void lv_led_event(lv_event_t * e); /********************** * STATIC VARIABLES @@ -156,15 +156,17 @@ static void lv_led_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) led->bright = LV_LED_BRIGHT_MAX; } -static void lv_led_event(lv_obj_t * obj, lv_event_t e) +static void lv_led_event(lv_event_t * e) { lv_res_t res; /* Call the ancestor's event handler */ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_DRAW_MAIN) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_DRAW_MAIN) { /*Make darker colors in a temporary style according to the brightness*/ lv_led_t * led = (lv_led_t *)obj; @@ -193,7 +195,7 @@ static void lv_led_event(lv_obj_t * obj, lv_event_t e) rect_dsc.shadow_spread = ((led->bright - LV_LED_BRIGHT_MIN) * rect_dsc.shadow_spread) / (LV_LED_BRIGHT_MAX - LV_LED_BRIGHT_MIN); - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_draw_rect(&obj->coords, clip_area, &rect_dsc); } } diff --git a/src/extra/widgets/msgbox/lv_msgbox.c b/src/extra/widgets/msgbox/lv_msgbox.c index 32754ef04..6c7ce6a4a 100644 --- a/src/extra/widgets/msgbox/lv_msgbox.c +++ b/src/extra/widgets/msgbox/lv_msgbox.c @@ -21,7 +21,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void msgbox_close_event_cb(lv_obj_t * btn, lv_event_t e); +static void msgbox_close_event_cb(lv_event_t * e); /********************** * STATIC VARIABLES @@ -138,9 +138,11 @@ void lv_msgbox_close(lv_obj_t * mbox) * STATIC FUNCTIONS **********************/ -static void msgbox_close_event_cb(lv_obj_t * btn, lv_event_t e) +static void msgbox_close_event_cb(lv_event_t * e) { - if(e == LV_EVENT_CLICKED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * btn = lv_event_get_target(e); + if(code == LV_EVENT_CLICKED) { lv_obj_t * mbox = lv_obj_get_parent(btn); lv_msgbox_close(mbox); } diff --git a/src/extra/widgets/spinbox/lv_spinbox.c b/src/extra/widgets/spinbox/lv_spinbox.c index db50fbde6..27b340b47 100644 --- a/src/extra/widgets/spinbox/lv_spinbox.c +++ b/src/extra/widgets/spinbox/lv_spinbox.c @@ -23,7 +23,7 @@ **********************/ static void lv_spinbox_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_spinbox_event(lv_obj_t * obj, lv_event_t e); +static void lv_spinbox_event(lv_event_t * e); static void lv_spinbox_updatevalue(lv_obj_t * obj); /********************** @@ -294,15 +294,17 @@ static void lv_spinbox_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob LV_LOG_TRACE("Spinbox constructor finished"); } -static void lv_spinbox_event(lv_obj_t * obj, lv_event_t e) +static void lv_spinbox_event(lv_event_t * e) { /*Call the ancestor's event handler*/ lv_res_t res = LV_RES_OK; - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_spinbox_t * spinbox = (lv_spinbox_t *)obj; - if(e == LV_EVENT_RELEASED) { + if(code == LV_EVENT_RELEASED) { /*If released with an ENCODER then move to the next digit*/ lv_indev_t * indev = lv_indev_get_act(); if(lv_indev_get_type(indev) == LV_INDEV_TYPE_ENCODER) { @@ -352,10 +354,10 @@ static void lv_spinbox_event(lv_obj_t * obj, lv_event_t e) for(i = 0; i < pos; i++) spinbox->step *= 10; } } - else if(e == LV_EVENT_KEY) { + else if(code == LV_EVENT_KEY) { lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act()); - uint32_t c = *((uint32_t *)lv_event_get_param()); /*uint32_t because can be UTF-8*/ + uint32_t c = *((uint32_t *)lv_event_get_param(e)); /*uint32_t because can be UTF-8*/ if(c == LV_KEY_RIGHT) { if(indev_type == LV_INDEV_TYPE_ENCODER) lv_spinbox_increment(obj); diff --git a/src/extra/widgets/tabview/lv_tabview.c b/src/extra/widgets/tabview/lv_tabview.c index a51383ac5..c513f9173 100644 --- a/src/extra/widgets/tabview/lv_tabview.c +++ b/src/extra/widgets/tabview/lv_tabview.c @@ -22,8 +22,8 @@ **********************/ static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_tabview_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void btns_event_cb(lv_obj_t * btns, lv_event_t e); -static void cont_event_cb(lv_obj_t * cont, lv_event_t e); +static void btns_event_cb(lv_event_t * e); +static void cont_event_cb(lv_event_t * e); /********************** * STATIC VARIABLES @@ -228,17 +228,23 @@ static void lv_tabview_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj tabview->map = NULL; } -static void btns_event_cb(lv_obj_t * btns, lv_event_t e) +static void btns_event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * btns = lv_event_get_target(e); + + if(code == LV_EVENT_VALUE_CHANGED) { lv_obj_t * tv = lv_obj_get_parent(btns); uint32_t id = lv_btnmatrix_get_selected_btn(btns); lv_tabview_set_act(tv, id, LV_ANIM_ON); } } -static void cont_event_cb(lv_obj_t * cont, lv_event_t e) +static void cont_event_cb(lv_event_t * e) { - if(e == LV_EVENT_SCROLL_END) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * cont = lv_event_get_target(e); + + if(code == LV_EVENT_SCROLL_END) { lv_obj_t * tv = lv_obj_get_parent(cont); lv_point_t p; diff --git a/src/extra/widgets/tileview/lv_tileview.c b/src/extra/widgets/tileview/lv_tileview.c index 4edb5a1ac..892480536 100644 --- a/src/extra/widgets/tileview/lv_tileview.c +++ b/src/extra/widgets/tileview/lv_tileview.c @@ -22,7 +22,7 @@ **********************/ static void lv_tileview_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_tileview_tile_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void tileview_event_cb(lv_obj_t * tv, lv_event_t e); +static void tileview_event_cb(lv_event_t * e); /********************** * STATIC VARIABLES @@ -127,9 +127,11 @@ static void lv_tileview_tile_constructor(const lv_obj_class_t * class_p, lv_obj_ } } -static void tileview_event_cb(lv_obj_t * tv, lv_event_t e) +static void tileview_event_cb(lv_event_t * e) { - if(e == LV_EVENT_SCROLL_END) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * tv = lv_event_get_target(e); + if(code == LV_EVENT_SCROLL_END) { lv_coord_t w = lv_obj_get_width_fit(tv); lv_coord_t h = lv_obj_get_height_fit(tv); diff --git a/src/misc/lv_mem.c b/src/misc/lv_mem.c index 453e16722..49781bfe8 100644 --- a/src/misc/lv_mem.c +++ b/src/misc/lv_mem.c @@ -421,7 +421,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset(void * dst, uint8_t v, size_t len) } } - uint32_t v32 = v + (v << 8) + (v << 16) + (v << 24); + uint32_t v32 = (uint32_t)v + ((uint32_t)v << 8) + ((uint32_t)v << 16) + ((uint32_t)v << 24); uint32_t * d32 = (uint32_t *)d8; diff --git a/src/widgets/lv_arc.c b/src/widgets/lv_arc.c index 80db692d0..7ea0526bf 100644 --- a/src/widgets/lv_arc.c +++ b/src/widgets/lv_arc.c @@ -31,8 +31,8 @@ **********************/ static void lv_arc_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_arc_draw(lv_obj_t * obj); -static void lv_arc_event(lv_obj_t * obj, lv_event_t e); +static void lv_arc_draw(lv_event_t * e); +static void lv_arc_event(lv_event_t * e); static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angle, lv_part_t part); static void get_center(lv_obj_t * obj, lv_point_t * center, lv_coord_t * arc_r); static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t r, lv_area_t * knob_area); @@ -509,16 +509,18 @@ static void lv_arc_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_arc_event(lv_obj_t * obj, lv_event_t e) +static void lv_arc_event(lv_event_t * e) { lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - lv_arc_t * arc = (lv_arc_t *)obj; - if(e == LV_EVENT_PRESSING) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + lv_arc_t * arc = (lv_arc_t *)e->target; + if(code == LV_EVENT_PRESSING) { lv_indev_t * indev = lv_indev_get_act(); if(indev == NULL) return; @@ -622,7 +624,7 @@ static void lv_arc_event(lv_obj_t * obj, lv_event_t e) arc->last_tick = lv_tick_get(); /*Cache timestamp for the next iteration*/ } } - else if(e == LV_EVENT_RELEASED || e == LV_EVENT_PRESS_LOST) { + else if(code == LV_EVENT_RELEASED || code == LV_EVENT_PRESS_LOST) { arc->dragging = false; /*Leave edit mode if released. (No need to wait for LONG_PRESS)*/ @@ -634,8 +636,8 @@ static void lv_arc_event(lv_obj_t * obj, lv_event_t e) } } - else if(e == LV_EVENT_KEY) { - char c = *((char *)lv_event_get_param()); + else if(code == LV_EVENT_KEY) { + char c = *((char *)lv_event_get_param(e)); int16_t old_value =arc->value; if(c == LV_KEY_RIGHT || c == LV_KEY_UP) { @@ -650,7 +652,7 @@ static void lv_arc_event(lv_obj_t * obj, lv_event_t e) if(res != LV_RES_OK) return; } } - else if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { lv_coord_t bg_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); lv_coord_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); lv_coord_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); @@ -663,18 +665,19 @@ static void lv_arc_event(lv_obj_t * obj, lv_event_t e) lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); lv_coord_t knob_pad = LV_MAX4(knob_left, knob_right, knob_top, knob_bottom) + 2; - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX(*s, knob_pad - bg_pad); - } else if(e == LV_EVENT_DRAW_MAIN) { - lv_arc_draw(obj); + } else if(code == LV_EVENT_DRAW_MAIN) { + lv_arc_draw(e); } } -static void lv_arc_draw(lv_obj_t * obj) +static void lv_arc_draw(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_arc_t * arc = (lv_arc_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_point_t center; lv_coord_t arc_r; diff --git a/src/widgets/lv_bar.c b/src/widgets/lv_bar.c index 6de4d2bcd..16f857687 100644 --- a/src/widgets/lv_bar.c +++ b/src/widgets/lv_bar.c @@ -47,8 +47,8 @@ **********************/ static void lv_bar_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_bar_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_bar_event(lv_obj_t * bar, lv_event_t e); -static void draw_indic(lv_obj_t * bar); +static void lv_bar_event(lv_event_t * e); +static void draw_indic(lv_event_t * e); static void lv_bar_set_value_with_anim(lv_obj_t * obj, int16_t new_value, int16_t * value_ptr, lv_bar_anim_t * anim_info, lv_anim_enable_t en); static void lv_bar_init_anim(lv_obj_t * bar, lv_bar_anim_t * bar_anim); @@ -231,11 +231,12 @@ static void lv_bar_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_anim_del(&bar->start_value_anim, NULL); } -static void draw_indic(lv_obj_t * obj) +static void draw_indic(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_bar_t * bar = (lv_bar_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_area_t bar_coords; lv_obj_get_coords(obj, &bar_coords); @@ -465,21 +466,24 @@ static void draw_indic(lv_obj_t * obj) #endif } -static void lv_bar_event(lv_obj_t * obj, lv_event_t e) +static void lv_bar_event(lv_event_t * e) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { lv_coord_t indic_size; indic_size = lv_obj_calculate_ext_draw_size(obj, LV_PART_INDICATOR); /*Bg size is handled by lv_obj*/ - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX(*s, indic_size); /*Calculate the indicator area*/ @@ -492,11 +496,11 @@ static void lv_bar_event(lv_obj_t * obj, lv_event_t e) if(pad < 0) { *s = LV_MAX(*s, -pad); } - } else if(e == LV_EVENT_PRESSED || e == LV_EVENT_RELEASED) { + } else if(code == LV_EVENT_PRESSED || code == LV_EVENT_RELEASED) { lv_bar_t * bar = (lv_bar_t *)obj; lv_obj_invalidate_area(obj, &bar->indic_area); - } else if(e == LV_EVENT_DRAW_MAIN) { - draw_indic(obj); + } else if(code == LV_EVENT_DRAW_MAIN) { + draw_indic(e); } } diff --git a/src/widgets/lv_btnmatrix.c b/src/widgets/lv_btnmatrix.c index 70d65a997..c971bd26c 100644 --- a/src/widgets/lv_btnmatrix.c +++ b/src/widgets/lv_btnmatrix.c @@ -34,8 +34,8 @@ **********************/ static void lv_btnmatrix_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_btnmatrix_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e); -static void draw_main(lv_obj_t * obj); +static void lv_btnmatrix_event(lv_event_t * e); +static void draw_main(lv_event_t * e); static uint8_t get_button_width(lv_btnmatrix_ctrl_t ctrl_bits); static bool button_is_hidden(lv_btnmatrix_ctrl_t ctrl_bits); @@ -386,25 +386,27 @@ static void lv_btnmatrix_destructor(const lv_obj_class_t * class_p, lv_obj_t * o LV_TRACE_OBJ_CREATE("finshed"); } -static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) +static void lv_btnmatrix_event(lv_event_t * e) { lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; lv_point_t p; - if(e == LV_EVENT_STYLE_CHANGED) { + if(code == LV_EVENT_STYLE_CHANGED) { lv_btnmatrix_set_map(obj, btnm->map_p); } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { lv_btnmatrix_set_map(obj, btnm->map_p); } - else if(e == LV_EVENT_PRESSED) { - void * param = lv_event_get_param(); + else if(code == LV_EVENT_PRESSED) { + void * param = lv_event_get_param(e); invalidate_button_area(obj, btnm->btn_id_sel); lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act()); @@ -433,8 +435,8 @@ static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_PRESSING) { - void * param = lv_event_get_param(); + else if(code == LV_EVENT_PRESSING) { + void * param = lv_event_get_param(e); uint16_t btn_pr = LV_BTNMATRIX_BTN_NONE; /*Search the pressed area*/ lv_indev_t * indev = lv_indev_get_act(); @@ -465,7 +467,7 @@ static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_RELEASED) { + else if(code == LV_EVENT_RELEASED) { if(btnm->btn_id_sel != LV_BTNMATRIX_BTN_NONE) { /*Toggle the button if enabled*/ if(button_is_tgl_enabled(btnm->ctrl_bits[btnm->btn_id_sel]) && @@ -497,7 +499,7 @@ static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; } } - else if(e == LV_EVENT_LONG_PRESSED_REPEAT) { + else if(code == LV_EVENT_LONG_PRESSED_REPEAT) { if(btnm->btn_id_sel != LV_BTNMATRIX_BTN_NONE) { if(button_is_repeat_disabled(btnm->ctrl_bits[btnm->btn_id_sel]) == false && button_is_inactive(btnm->ctrl_bits[btnm->btn_id_sel]) == false && @@ -508,11 +510,11 @@ static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_PRESS_LOST) { + else if(code == LV_EVENT_PRESS_LOST) { invalidate_button_area(obj, btnm->btn_id_sel); btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; } - else if(e == LV_EVENT_FOCUSED) { + else if(code == LV_EVENT_FOCUSED) { lv_indev_t * indev = lv_indev_get_act(); lv_indev_type_t indev_type = lv_indev_get_type(indev); @@ -541,15 +543,15 @@ static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) btnm->btn_id_sel = b; } } - else if(e == LV_EVENT_DEFOCUSED || e == LV_EVENT_LEAVE) { + else if(code == LV_EVENT_DEFOCUSED || code == LV_EVENT_LEAVE) { if(btnm->btn_id_sel != LV_BTNMATRIX_BTN_NONE) invalidate_button_area(obj, btnm->btn_id_sel); btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; } - else if(e == LV_EVENT_KEY) { + else if(code == LV_EVENT_KEY) { invalidate_button_area(obj, btnm->btn_id_sel); - char c = *((char *)lv_event_get_param()); + char c = *((char *)lv_event_get_param(e)); if(c == LV_KEY_RIGHT) { if(btnm->btn_id_sel == LV_BTNMATRIX_BTN_NONE) btnm->btn_id_sel = 0; else btnm->btn_id_sel++; @@ -626,18 +628,19 @@ static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) } invalidate_button_area(obj, btnm->btn_id_sel); - } else if(e == LV_EVENT_DRAW_MAIN) { - draw_main(obj); + } else if(code == LV_EVENT_DRAW_MAIN) { + draw_main(e); } } -static void draw_main(lv_obj_t * obj) +static void draw_main(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; if(btnm->btn_cnt == 0) return; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); obj->skip_trans = 1; lv_area_t area_obj; diff --git a/src/widgets/lv_chart.c b/src/widgets/lv_chart.c index df56d87f8..2a9b1e5c8 100644 --- a/src/widgets/lv_chart.c +++ b/src/widgets/lv_chart.c @@ -38,7 +38,7 @@ **********************/ static void lv_chart_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_chart_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_chart_event(lv_obj_t * obj, lv_event_t e); +static void lv_chart_event(lv_event_t * e); static void draw_div_lines(lv_obj_t * obj , const lv_area_t * mask); static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area); @@ -611,16 +611,19 @@ static void lv_chart_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_chart_event(lv_obj_t * obj, lv_event_t e) +static void lv_chart_event(lv_event_t * e) { /*Call the ancestor's event handler*/ lv_res_t res; - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + lv_chart_t * chart = (lv_chart_t *)obj; - if(e == LV_EVENT_PRESSED) { + if(code == LV_EVENT_PRESSED) { lv_indev_t * indev = lv_indev_get_act(); lv_point_t p; lv_indev_get_point(indev, &p); @@ -633,19 +636,19 @@ static void lv_chart_event(lv_obj_t * obj, lv_event_t e) chart->pressed_point_id = id; lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL); } - } else if(e == LV_EVENT_RELEASED) { + } else if(code == LV_EVENT_RELEASED) { invalidate_point(obj, chart->pressed_point_id); chart->pressed_point_id = LV_CHART_POINT_NONE; - } else if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t * s = lv_event_get_param(); + } else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX4(*s, chart->tick[LV_CHART_AXIS_X].draw_size, chart->tick[LV_CHART_AXIS_PRIMARY_Y].draw_size, chart->tick[LV_CHART_AXIS_SECONDARY_Y].draw_size); - } else if(e == LV_EVENT_GET_SELF_SIZE) { - lv_point_t * p = lv_event_get_param(); + } else if(code == LV_EVENT_GET_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e); p->x = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; p->y = (lv_obj_get_height_fit(obj) * chart->zoom_y) >> 8; - } else if(e == LV_EVENT_DRAW_MAIN) { - const lv_area_t * clip_area = lv_event_get_param(); + } else if(code == LV_EVENT_DRAW_MAIN) { + const lv_area_t * clip_area = lv_event_get_param(e); draw_div_lines(obj, clip_area); draw_axes(obj, clip_area); diff --git a/src/widgets/lv_checkbox.c b/src/widgets/lv_checkbox.c index dc433e167..4f1a1e9d6 100644 --- a/src/widgets/lv_checkbox.c +++ b/src/widgets/lv_checkbox.c @@ -28,8 +28,8 @@ **********************/ static void lv_checkbox_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_checkbox_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_checkbox_event(lv_obj_t * obj, lv_event_t e); -static void lv_checkbox_draw(lv_obj_t * obj); +static void lv_checkbox_event(lv_event_t * e); +static void lv_checkbox_draw(lv_event_t * e); /********************** * STATIC VARIABLES @@ -140,18 +140,21 @@ static void lv_checkbox_destructor(const lv_obj_class_t * class_p, lv_obj_t * ob LV_TRACE_OBJ_CREATE("finished"); } -static void lv_checkbox_event(lv_obj_t * obj, lv_event_t e) +static void lv_checkbox_event(lv_event_t * e) { lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if (e == LV_EVENT_PRESSED || e == LV_EVENT_RELEASED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if (code == LV_EVENT_PRESSED || code == LV_EVENT_RELEASED) { lv_obj_invalidate(obj); } - else if (e == LV_EVENT_GET_SELF_SIZE) { - lv_point_t * p = lv_event_get_param(); + else if (code == LV_EVENT_GET_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e); lv_checkbox_t * cb = (lv_checkbox_t *)obj; const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); @@ -175,27 +178,28 @@ static void lv_checkbox_event(lv_obj_t * obj, lv_event_t e) p->x = marker_size.x + txt_size.x + bg_colp; p->y = LV_MAX(marker_size.y, txt_size.y); } - else if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t *s = lv_event_get_param();; + else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_coord_t *s = lv_event_get_param(e);; lv_coord_t m = lv_obj_calculate_ext_draw_size(obj, LV_PART_INDICATOR); *s = LV_MAX(*s, m); } - else if(e == LV_EVENT_RELEASED) { + else if(code == LV_EVENT_RELEASED) { uint32_t v = lv_obj_get_state(obj) & LV_STATE_CHECKED ? 1 : 0; res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, &v); if(res != LV_RES_OK) return; lv_obj_invalidate(obj); - } else if(e == LV_EVENT_DRAW_MAIN) { - lv_checkbox_draw(obj); + } else if(code == LV_EVENT_DRAW_MAIN) { + lv_checkbox_draw(e); } } -static void lv_checkbox_draw(lv_obj_t * obj) +static void lv_checkbox_draw(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_checkbox_t * cb = (lv_checkbox_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); lv_coord_t font_h = lv_font_get_line_height(font); diff --git a/src/widgets/lv_dropdown.c b/src/widgets/lv_dropdown.c index 423b69576..24c4c6936 100644 --- a/src/widgets/lv_dropdown.c +++ b/src/widgets/lv_dropdown.c @@ -39,13 +39,13 @@ static lv_obj_t * lv_dropdown_list_create(lv_obj_t * parent); static void lv_dropdown_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_dropdown_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_dropdown_event(lv_obj_t * obj, lv_event_t e); -static void draw_main(lv_obj_t * obj); +static void lv_dropdown_event(lv_event_t * e); +static void draw_main(lv_event_t * e); static void lv_dropdownlist_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_dropdownlist_destructor(const lv_obj_class_t * class_p, lv_obj_t * list_obj); -static void lv_dropdown_list_event(lv_obj_t * list, lv_event_t e); -static void draw_list(lv_obj_t * obj); +static void lv_dropdown_list_event(lv_event_t * e); +static void draw_list(lv_event_t * e); static void draw_box(lv_obj_t * dropdown_obj, const lv_area_t * clip_area, uint16_t id, lv_state_t state); static void draw_box_label(lv_obj_t * dropdown_obj, const lv_area_t * clip_area, uint16_t id, lv_state_t state); @@ -601,17 +601,19 @@ static void lv_dropdownlist_destructor(const lv_obj_class_t * class_p, lv_obj_t dropdown->list = NULL; } -static void lv_dropdown_event(lv_obj_t * obj, lv_event_t e) +static void lv_dropdown_event(lv_event_t * e) { lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_dropdown_t * dropdown = (lv_dropdown_t *)obj; - if(e == LV_EVENT_FOCUSED) { + if(code == LV_EVENT_FOCUSED) { lv_group_t * g = lv_obj_get_group(obj); bool editing = lv_group_get_editing(g); lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act()); @@ -625,10 +627,10 @@ static void lv_dropdown_event(lv_obj_t * obj, lv_event_t e) lv_dropdown_close(obj); } } - else if(e == LV_EVENT_DEFOCUSED || e == LV_EVENT_LEAVE) { + else if(code == LV_EVENT_DEFOCUSED || code == LV_EVENT_LEAVE) { lv_dropdown_close(obj); } - else if(e == LV_EVENT_RELEASED) { + else if(code == LV_EVENT_RELEASED) { lv_indev_t * indev = lv_indev_get_act(); if(lv_indev_get_scroll_obj(indev) == NULL) { if(dropdown->list) { @@ -654,16 +656,16 @@ static void lv_dropdown_event(lv_obj_t * obj, lv_event_t e) lv_obj_invalidate(obj); } } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { if(dropdown->list) lv_dropdown_close(obj); } - else if(e == LV_EVENT_GET_SELF_SIZE) { - lv_point_t * p = lv_event_get_param(); + else if(code == LV_EVENT_GET_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); p->y = lv_font_get_line_height(font); } - else if(e == LV_EVENT_KEY) { - char c = *((char *)lv_event_get_param()); + else if(code == LV_EVENT_KEY) { + char c = *((char *)lv_event_get_param(e)); if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN) { if(dropdown->list == NULL) { lv_dropdown_open(obj); @@ -688,44 +690,47 @@ static void lv_dropdown_event(lv_obj_t * obj, lv_event_t e) lv_dropdown_close(obj); } } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_main(obj); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_main(e); } } -static void lv_dropdown_list_event(lv_obj_t * list, lv_event_t e) +static void lv_dropdown_list_event(lv_event_t * e) { lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS_LIST, list, e); + res = lv_obj_event_base(MY_CLASS_LIST, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * list = lv_event_get_target(e); lv_obj_t * dropdown_obj = ((lv_dropdown_list_t *)list)->dropdown; lv_dropdown_t * dropdown = (lv_dropdown_t *)dropdown_obj; - if(e == LV_EVENT_RELEASED) { + if(code == LV_EVENT_RELEASED) { if(lv_indev_get_scroll_obj(lv_indev_get_act()) == NULL) { list_release_handler(list); } } - else if(e == LV_EVENT_PRESSED) { + else if(code == LV_EVENT_PRESSED) { page_press_handler(list); } - else if(e == LV_EVENT_SCROLL_BEGIN) { + else if(code == LV_EVENT_SCROLL_BEGIN) { dropdown->pr_opt_id = LV_DROPDOWN_PR_NONE; lv_obj_invalidate(list); } - else if(e == LV_EVENT_DRAW_POST) { - draw_list(list); + else if(code == LV_EVENT_DRAW_POST) { + draw_list(e); } } -static void draw_main(lv_obj_t * obj) +static void draw_main(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_dropdown_t * dropdown = (lv_dropdown_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_coord_t left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); lv_coord_t right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); @@ -823,12 +828,13 @@ static void draw_main(lv_obj_t * obj) } } -static void draw_list(lv_obj_t * list_obj) +static void draw_list(lv_event_t * e) { + lv_obj_t * list_obj = lv_event_get_target(e); lv_dropdown_list_t * list = (lv_dropdown_list_t *)list_obj; lv_obj_t * dropdown_obj = list->dropdown; lv_dropdown_t * dropdown = (lv_dropdown_t *)dropdown_obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); /*Draw the box labels if the list is not being deleted*/ if(dropdown->list) { diff --git a/src/widgets/lv_img.c b/src/widgets/lv_img.c index fcc55f37b..6df402f11 100644 --- a/src/widgets/lv_img.c +++ b/src/widgets/lv_img.c @@ -30,8 +30,8 @@ **********************/ static void lv_img_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_img_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_img_event(lv_obj_t * obj, lv_event_t e); -static void draw_img(lv_obj_t * obj, lv_event_t e); +static void lv_img_event(lv_event_t * e); +static void draw_img(lv_event_t * e); /********************** * STATIC VARIABLES @@ -397,26 +397,29 @@ static void lv_img_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) } } -static void lv_img_event(lv_obj_t * obj, lv_event_t e) +static void lv_img_event(lv_event_t * e) { + lv_event_code_t code = lv_event_get_code(e); + /*Ancestor events will be called during drawing*/ - if(e != LV_EVENT_DRAW_MAIN && e != LV_EVENT_DRAW_POST) { + if(code != LV_EVENT_DRAW_MAIN && code != LV_EVENT_DRAW_POST) { /*Call the ancestor's event handler*/ - lv_res_t res = lv_obj_event_base(MY_CLASS, obj, e); + lv_res_t res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; } - lv_img_t * img = (lv_img_t *)obj; + lv_obj_t * obj = lv_event_get_target(e); + lv_img_t * img = (lv_img_t *)obj; - if(e == LV_EVENT_STYLE_CHANGED) { + if(code == LV_EVENT_STYLE_CHANGED) { /*Refresh the file name to refresh the symbol text size*/ if(img->src_type == LV_IMG_SRC_SYMBOL) { lv_img_set_src(obj, img->src); } } - else if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); transf_zoom = (transf_zoom * img->zoom) >> 8; @@ -436,8 +439,8 @@ static void lv_img_event(lv_obj_t * obj, lv_event_t e) *s = LV_MAX(*s, pad_ori + a.y2 - h); } } - else if(e == LV_EVENT_HIT_TEST) { - lv_hit_test_info_t * info = lv_event_get_param(); + else if(code == LV_EVENT_HIT_TEST) { + lv_hit_test_info_t * info = lv_event_get_param(e); lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); zoom = (zoom * img->zoom) >> 8; @@ -447,7 +450,7 @@ static void lv_img_event(lv_obj_t * obj, lv_event_t e) /*If the object is exactly image sized (not cropped, not mosaic) and transformed *perform hit test on it's transformed area*/ if(img->w == lv_obj_get_width(obj) && img->h == lv_obj_get_height(obj) && - (zoom != LV_IMG_ZOOM_NONE || angle != 0 || img->pivot.x != img->w / 2 || img->pivot.y != img->h / 2)) { + (zoom != LV_IMG_ZOOM_NONE || angle != 0 || img->pivot.x != img->w / 2 || img->pivot.y != img->h / 2)) { lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); @@ -466,21 +469,23 @@ static void lv_img_event(lv_obj_t * obj, lv_event_t e) info->result = _lv_area_is_point_on(&a, info->point, 0); } } - else if(e == LV_EVENT_GET_SELF_SIZE) { - lv_point_t * p = lv_event_get_param();; + else if(code == LV_EVENT_GET_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e);; p->x = img->w; p->y = img->h; } - else if(e == LV_EVENT_DRAW_MAIN || e == LV_EVENT_DRAW_POST || e == LV_EVENT_COVER_CHECK) { - draw_img(obj, e); + else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST || code == LV_EVENT_COVER_CHECK) { + draw_img(e); } } -static void draw_img(lv_obj_t * obj, lv_event_t e) +static void draw_img(lv_event_t * e) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_img_t * img = (lv_img_t *)obj; - if(e == LV_EVENT_COVER_CHECK) { - lv_cover_check_info_t * info = lv_event_get_param(); + if(code == LV_EVENT_COVER_CHECK) { + lv_cover_check_info_t * info = lv_event_get_param(e); if(info->res == LV_DRAW_RES_MASKED) return; if(img->src_type == LV_IMG_SRC_UNKNOWN || img->src_type == LV_IMG_SRC_SYMBOL) { info->res = LV_DRAW_RES_NOT_COVER; @@ -511,7 +516,7 @@ static void draw_img(lv_obj_t * obj, lv_event_t e) zoom_final = (zoom_final * img->zoom) >> 8; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); if(zoom_final == LV_IMG_ZOOM_NONE) { if(_lv_area_is_in(clip_area, &obj->coords, 0) == false) { info->res = LV_DRAW_RES_NOT_COVER; @@ -532,7 +537,7 @@ static void draw_img(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_DRAW_MAIN || e == LV_EVENT_DRAW_POST) { + else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST) { int32_t zoom_final = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); zoom_final = (zoom_final * img->zoom) >> 8; @@ -565,16 +570,16 @@ static void draw_img(lv_obj_t * obj, lv_event_t e) lv_area_copy(&ori_coords, &obj->coords); lv_area_copy(&obj->coords, &bg_coords); - lv_res_t res = lv_obj_event_base(MY_CLASS, obj, e); + lv_res_t res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; lv_area_copy(&obj->coords, &ori_coords); - if(e == LV_EVENT_DRAW_MAIN) { + if(code == LV_EVENT_DRAW_MAIN) { if(img->h == 0 || img->w == 0) return; if(zoom_final == 0) return; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_area_t img_max_area; lv_area_copy(&img_max_area, &obj->coords); diff --git a/src/widgets/lv_label.c b/src/widgets/lv_label.c index 25edcc164..aa0a3faf3 100644 --- a/src/widgets/lv_label.c +++ b/src/widgets/lv_label.c @@ -36,8 +36,8 @@ **********************/ static void lv_label_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_label_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_label_event_cb(lv_obj_t * obj, lv_event_t e); -static void draw_main(lv_obj_t * obj); +static void lv_label_event_cb(lv_event_t * e); +static void draw_main(lv_event_t * e); static void lv_label_refr_text(lv_obj_t * obj); static void lv_label_revert_dots(lv_obj_t * label); @@ -738,39 +738,43 @@ static void lv_label_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) label->text = NULL; } -static void lv_label_event_cb(lv_obj_t * obj, lv_event_t e) +static void lv_label_event_cb(lv_event_t * e) { lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_STYLE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if(code == LV_EVENT_STYLE_CHANGED) { /*Revert dots for proper refresh*/ lv_label_revert_dots(obj); lv_label_refr_text(obj); } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { lv_label_revert_dots(obj); lv_label_refr_text(obj); } - else if(e == LV_EVENT_BASE_DIR_CHANGED) { + else if(code == LV_EVENT_BASE_DIR_CHANGED) { #if LV_USE_BIDI lv_label_t * label = (lv_label_t *)obj; if(label->static_txt == 0) lv_label_set_text(obj, NULL); #endif } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_main(obj); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_main(e); } } -static void draw_main(lv_obj_t * obj) +static void draw_main(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_label_t * label = (lv_label_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_area_t txt_coords; get_txt_coords(obj, &txt_coords); diff --git a/src/widgets/lv_line.c b/src/widgets/lv_line.c index fddef75f1..047ec68aa 100644 --- a/src/widgets/lv_line.c +++ b/src/widgets/lv_line.c @@ -29,7 +29,7 @@ * STATIC PROTOTYPES **********************/ static void lv_line_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_line_event(lv_obj_t * obj, lv_event_t e); +static void lv_line_event(lv_event_t * e); /********************** * STATIC VARIABLES @@ -119,24 +119,27 @@ static void lv_line_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_line_event(lv_obj_t * obj, lv_event_t e) +static void lv_line_event(lv_event_t * e) { lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { /*The corner of the skew lines is out of the intended area*/ lv_coord_t line_width = lv_obj_get_style_line_width(obj, LV_PART_MAIN); - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); if(*s < line_width) *s = line_width; } - else if(e == LV_EVENT_GET_SELF_SIZE) { + else if(code == LV_EVENT_GET_SELF_SIZE) { lv_line_t * line = (lv_line_t *)obj; - lv_point_t * p = lv_event_get_param(); + lv_point_t * p = lv_event_get_param(e); lv_coord_t w = 0; lv_coord_t h = 0; if(line->point_num > 0) { @@ -152,9 +155,9 @@ static void lv_line_event(lv_obj_t * obj, lv_event_t e) p->x = w; p->y = h; } - } else if(e == LV_EVENT_DRAW_MAIN) { + } else if(code == LV_EVENT_DRAW_MAIN) { lv_line_t * line = (lv_line_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); if(line->point_num == 0 || line->point_array == NULL) return; diff --git a/src/widgets/lv_meter.c b/src/widgets/lv_meter.c index 3f1639cf2..e1989937f 100644 --- a/src/widgets/lv_meter.c +++ b/src/widgets/lv_meter.c @@ -29,7 +29,7 @@ **********************/ static void lv_meter_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_meter_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_meter_event(lv_obj_t * obj, lv_event_t e); +static void lv_meter_event(lv_event_t * e); static void draw_arcs(lv_obj_t * obj, const lv_area_t * clip_area, const lv_area_t * scale_area); static void draw_ticks_and_labels(lv_obj_t * obj, const lv_area_t * clip_area, const lv_area_t * scale_area); static void draw_needles(lv_obj_t * obj, const lv_area_t * clip_area, const lv_area_t * scale_area); @@ -278,13 +278,15 @@ static void lv_meter_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) } -static void lv_meter_event(lv_obj_t * obj, lv_event_t e) +static void lv_meter_event(lv_event_t * e) { - lv_res_t res = lv_obj_event_base(MY_CLASS, obj, e); + lv_res_t res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_DRAW_MAIN) { - const lv_area_t * clip_area = lv_event_get_param(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_DRAW_MAIN) { + const lv_area_t * clip_area = lv_event_get_param(e); lv_area_t scale_area; lv_obj_get_coords_fit(obj, &scale_area); diff --git a/src/widgets/lv_roller.c b/src/widgets/lv_roller.c index 3fcc384d8..a1a55f9b2 100644 --- a/src/widgets/lv_roller.c +++ b/src/widgets/lv_roller.c @@ -29,10 +29,10 @@ * STATIC PROTOTYPES **********************/ static void lv_roller_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_roller_event(lv_obj_t * obj, lv_event_t e); -static void lv_roller_label_event(lv_obj_t * label, lv_event_t e); -static void draw_main(lv_obj_t * obj, lv_event_t e); -static void draw_label(lv_obj_t * label_obj); +static void lv_roller_event(lv_event_t * e); +static void lv_roller_label_event(lv_event_t * e); +static void draw_main(lv_event_t * e); +static void draw_label(lv_event_t * e); static void refr_position(lv_obj_t * obj, lv_anim_enable_t animen); static lv_res_t release_handler(lv_obj_t * obj); static void inf_normalize(lv_obj_t * obj_scrl); @@ -302,35 +302,37 @@ static void lv_roller_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj LV_LOG_TRACE("finshed"); } -static void lv_roller_event(lv_obj_t * obj, lv_event_t e) +static void lv_roller_event(lv_event_t * e) { lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_roller_t * roller = (lv_roller_t*)obj; - if(e == LV_EVENT_GET_SELF_SIZE) { - lv_point_t * p = lv_event_get_param(); + if(code == LV_EVENT_GET_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e); p->x = get_selected_label_width(obj); } - else if(e == LV_EVENT_STYLE_CHANGED) { + else if(code == LV_EVENT_STYLE_CHANGED) { lv_obj_t * label = get_label(obj); /*Be sure the label's style is updated before processing the roller*/ if(label) lv_event_send(label, LV_EVENT_STYLE_CHANGED, NULL); lv_obj_handle_self_size_chg(obj); refr_position(obj, false); } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { refr_position(obj, false); } - else if(e == LV_EVENT_PRESSED) { + else if(code == LV_EVENT_PRESSED) { roller->moved = 0; lv_anim_del(get_label(obj), set_y_anim); } - else if(e == LV_EVENT_PRESSING) { + else if(code == LV_EVENT_PRESSING) { lv_indev_t * indev = lv_indev_get_act(); lv_point_t p; lv_indev_get_vect(indev, &p); @@ -340,10 +342,10 @@ static void lv_roller_event(lv_obj_t * obj, lv_event_t e) roller->moved = 1; } } - else if(e == LV_EVENT_RELEASED) { + else if(code == LV_EVENT_RELEASED) { release_handler(obj); } - else if(e == LV_EVENT_FOCUSED) { + else if(code == LV_EVENT_FOCUSED) { lv_group_t * g = lv_obj_get_group(obj); bool editing = lv_group_get_editing(g); lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act()); @@ -367,15 +369,15 @@ static void lv_roller_event(lv_obj_t * obj, lv_event_t e) ENTER won't be pressed*/ } } - else if(e == LV_EVENT_DEFOCUSED) { + else if(code == LV_EVENT_DEFOCUSED) { /*Revert the original state*/ if(roller->sel_opt_id != roller->sel_opt_id_ori) { roller->sel_opt_id = roller->sel_opt_id_ori; refr_position(obj, true); } } - else if(e == LV_EVENT_KEY) { - char c = *((char *)lv_event_get_param()); + else if(code == LV_EVENT_KEY) { + char c = *((char *)lv_event_get_param(e)); if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN) { if(roller->sel_opt_id + 1 < roller->option_cnt) { uint16_t ori_id = roller->sel_opt_id_ori; /*lv_roller_set_selected will overwrite this*/ @@ -392,44 +394,48 @@ static void lv_roller_event(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_DRAW_MAIN || e == LV_EVENT_DRAW_POST) { - draw_main(obj, e); + else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST) { + draw_main(e); } } -static void lv_roller_label_event(lv_obj_t * label, lv_event_t e) +static void lv_roller_label_event(lv_event_t * e) { lv_res_t res; + lv_event_code_t code = lv_event_get_code(e); /*LV_EVENT_DRAW_MAIN will be called in the draw function*/ - if(e != LV_EVENT_DRAW_MAIN) { + if(code != LV_EVENT_DRAW_MAIN) { /* Call the ancestor's event handler */ - res = lv_obj_event_base(MY_CLASS_LABEL, label, e); + res = lv_obj_event_base(MY_CLASS_LABEL, e); if(res != LV_RES_OK) return; } - if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_obj_t * label = lv_event_get_target(e); + if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { /*If the selected text has a larger font it needs some extra space to draw it*/ - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); lv_obj_t * obj = lv_obj_get_parent(label); lv_coord_t sel_w = get_selected_label_width(obj); lv_coord_t label_w = lv_obj_get_width(label); *s = LV_MAX(*s, sel_w - label_w); } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { refr_position(lv_obj_get_parent(label), LV_ANIM_OFF); } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_label(label); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_label(e); } } -static void draw_main(lv_obj_t * obj, lv_event_t e) +static void draw_main(lv_event_t * e) { - if(e == LV_EVENT_DRAW_MAIN) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_DRAW_MAIN) { /*Draw the selected rectangle*/ - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); lv_coord_t font_h = lv_font_get_line_height(font); @@ -448,8 +454,8 @@ static void draw_main(lv_obj_t * obj, lv_event_t e) lv_draw_rect(&rect_area, clip_area, &sel_dsc); } /*Post draw when the children are drawn*/ - else if(e == LV_EVENT_DRAW_POST) { - const lv_area_t * clip_area = lv_event_get_param(); + else if(code == LV_EVENT_DRAW_POST) { + const lv_area_t * clip_area = lv_event_get_param(e); lv_draw_label_dsc_t label_dsc; lv_draw_label_dsc_init(&label_dsc); @@ -504,10 +510,11 @@ static void draw_main(lv_obj_t * obj, lv_event_t e) } } -static void draw_label(lv_obj_t * label_obj) +static void draw_label(lv_event_t * e) { /* Split the drawing of the label into an upper (above the selected area) * and a lower (below the selected area)*/ + lv_obj_t * label_obj = lv_event_get_target(e); lv_obj_t * roller = lv_obj_get_parent(label_obj); lv_draw_label_dsc_t label_draw_dsc; lv_draw_label_dsc_init(&label_draw_dsc); @@ -515,7 +522,7 @@ static void draw_label(lv_obj_t * label_obj) const lv_font_t * font = label_draw_dsc.font; lv_coord_t line_space = label_draw_dsc.line_space; lv_coord_t font_h = lv_font_get_line_height(font); - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_area_t rect_area; rect_area.y1 = roller->coords.y1 + (lv_obj_get_height(roller) - font_h - line_space) / 2; diff --git a/src/widgets/lv_slider.c b/src/widgets/lv_slider.c index 62927c5f9..ef8f57eba 100644 --- a/src/widgets/lv_slider.c +++ b/src/widgets/lv_slider.c @@ -32,9 +32,9 @@ * STATIC PROTOTYPES **********************/ static void lv_slider_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_slider_event(lv_obj_t * obj, lv_event_t e); +static void lv_slider_event(lv_event_t * e); static void position_knob(lv_obj_t * obj, lv_area_t * knob_area, lv_coord_t knob_size, bool hor); -static void draw_knob(lv_obj_t * obj); +static void draw_knob(lv_event_t * e); /********************** * STATIC VARIABLES @@ -90,20 +90,22 @@ static void lv_slider_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj lv_obj_set_height(obj, LV_DPX(10)); } -static void lv_slider_event(lv_obj_t * obj, lv_event_t e) +static void lv_slider_event(lv_event_t * e) { lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_slider_t * slider = (lv_slider_t *)obj; lv_slider_mode_t type = lv_slider_get_mode(obj); /*Advanced hit testing: react only on dragging the knob(s)*/ - if(e == LV_EVENT_HIT_TEST) { - lv_hit_test_info_t * info = lv_event_get_param(); + if(code == LV_EVENT_HIT_TEST) { + lv_hit_test_info_t * info = lv_event_get_param(e); /*Ordinary slider: was the knob area hit?*/ info->result = _lv_area_is_point_on(&slider->right_knob_area, info->point, 0); @@ -113,7 +115,7 @@ static void lv_slider_event(lv_obj_t * obj, lv_event_t e) info->result = _lv_area_is_point_on(&slider->left_knob_area, info->point, 0); } } - else if(e == LV_EVENT_PRESSED) { + else if(code == LV_EVENT_PRESSED) { lv_point_t p; slider->dragging = true; if(type == LV_SLIDER_MODE_NORMAL || type == LV_SLIDER_MODE_SYMMETRICAL) { @@ -175,7 +177,7 @@ static void lv_slider_event(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_PRESSING && slider->value_to_set != NULL) { + else if(code == LV_EVENT_PRESSING && slider->value_to_set != NULL) { lv_indev_t * indev = lv_indev_get_act(); if(lv_indev_get_type(indev) != LV_INDEV_TYPE_POINTER) return; @@ -233,7 +235,7 @@ static void lv_slider_event(lv_obj_t * obj, lv_event_t e) } } - else if(e == LV_EVENT_RELEASED || e == LV_EVENT_PRESS_LOST) { + else if(code == LV_EVENT_RELEASED || code == LV_EVENT_PRESS_LOST) { slider->dragging = false; slider->value_to_set = NULL; @@ -257,16 +259,16 @@ static void lv_slider_event(lv_obj_t * obj, lv_event_t e) } } - else if(e == LV_EVENT_FOCUSED) { + else if(code == LV_EVENT_FOCUSED) { lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act()); if(indev_type == LV_INDEV_TYPE_ENCODER || indev_type == LV_INDEV_TYPE_KEYPAD) { slider->left_knob_focus = 0; } } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { lv_obj_refresh_ext_draw_size(obj); } - else if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { lv_coord_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); lv_coord_t knob_right = lv_obj_get_style_pad_right(obj,LV_PART_KNOB); lv_coord_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); @@ -282,12 +284,12 @@ static void lv_slider_event(lv_obj_t * obj, lv_event_t e) knob_size += lv_obj_calculate_ext_draw_size(obj, LV_PART_KNOB); /*Indic. size is handled by bar*/ - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX(*s, knob_size); } - else if(e == LV_EVENT_KEY) { - char c = *((char *)lv_event_get_param()); + else if(code == LV_EVENT_KEY) { + char c = *((char *)lv_event_get_param(e)); if(c == LV_KEY_RIGHT || c == LV_KEY_UP) { if(!slider->left_knob_focus) lv_slider_set_value(obj, lv_slider_get_value(obj) + 1, LV_ANIM_ON); @@ -303,15 +305,16 @@ static void lv_slider_event(lv_obj_t * obj, lv_event_t e) res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL); if(res != LV_RES_OK) return; } - } else if(e == LV_EVENT_DRAW_MAIN) { - draw_knob(obj); + } else if(code == LV_EVENT_DRAW_MAIN) { + draw_knob(e); } } -static void draw_knob(lv_obj_t * obj) +static void draw_knob(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_slider_t * slider = (lv_slider_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_bidi_dir_t base_dir = lv_obj_get_base_dir(obj); lv_coord_t objw = lv_obj_get_width(obj); diff --git a/src/widgets/lv_switch.c b/src/widgets/lv_switch.c index 62887a92b..752f93a81 100644 --- a/src/widgets/lv_switch.c +++ b/src/widgets/lv_switch.c @@ -34,8 +34,8 @@ * STATIC PROTOTYPES **********************/ static void lv_switch_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_switch_event(lv_obj_t * obj, lv_event_t e); -static void draw_main(lv_obj_t * obj); +static void lv_switch_event(lv_event_t * e); +static void draw_main(lv_event_t * e); /********************** * STATIC VARIABLES @@ -80,15 +80,18 @@ static void lv_switch_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj } -static void lv_switch_event(lv_obj_t * obj, lv_event_t e) +static void lv_switch_event(lv_event_t * e) { lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { lv_coord_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); lv_coord_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); lv_coord_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); @@ -99,25 +102,26 @@ static void lv_switch_event(lv_obj_t * obj, lv_event_t e) knob_size += 2; /*For rounding error*/ knob_size += lv_obj_calculate_ext_draw_size(obj, LV_PART_KNOB); - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX(*s, knob_size); *s = LV_MAX(*s, lv_obj_calculate_ext_draw_size(obj, LV_PART_INDICATOR)); } - else if(e == LV_EVENT_CLICKED) { + else if(code == LV_EVENT_CLICKED) { uint32_t v = lv_obj_get_state(obj) & LV_STATE_CHECKED ? 1 : 0; res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, &v); if(res != LV_RES_OK) return; lv_obj_invalidate(obj); } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_main(obj); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_main(e); } } -static void draw_main(lv_obj_t * obj) +static void draw_main(lv_event_t * e) { - const lv_area_t * clip_area = lv_event_get_param(); + lv_obj_t * obj = lv_event_get_target(e); + const lv_area_t * clip_area = lv_event_get_param(e); lv_bidi_dir_t base_dir = lv_obj_get_base_dir(obj); /*Calculate the indicator area*/ diff --git a/src/widgets/lv_table.c b/src/widgets/lv_table.c index 7de7e0518..184d9ed2e 100644 --- a/src/widgets/lv_table.c +++ b/src/widgets/lv_table.c @@ -31,8 +31,8 @@ **********************/ static void lv_table_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_table_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_table_event(lv_obj_t * obj, lv_event_t e); -static void draw_main(lv_obj_t * obj); +static void lv_table_event(lv_event_t * e); +static void draw_main(lv_event_t * e); static lv_coord_t get_row_height(lv_obj_t * obj, uint16_t row_id, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t line_space, lv_coord_t cell_left, lv_coord_t cell_right, lv_coord_t cell_top, lv_coord_t cell_bottom); @@ -438,21 +438,23 @@ static void lv_table_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) if(table->row_h) lv_mem_free(table->row_h); } -static void lv_table_event(lv_obj_t * obj, lv_event_t e) +static void lv_table_event(lv_event_t * e) { lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_table_t * table = (lv_table_t *)obj; - if(e == LV_EVENT_STYLE_CHANGED) { + if(code == LV_EVENT_STYLE_CHANGED) { refr_size(obj, 0); } - else if(e == LV_EVENT_GET_SELF_SIZE) { - lv_point_t * p = lv_event_get_param(); + else if(code == LV_EVENT_GET_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e); uint32_t i; lv_coord_t w = 0; for(i = 0; i < table->col_cnt; i++) w += table->col_w[i]; @@ -463,7 +465,7 @@ static void lv_table_event(lv_obj_t * obj, lv_event_t e) p->x = w; p->y = h; } - else if(e == LV_EVENT_PRESSED || e == LV_EVENT_PRESSING) { + else if(code == LV_EVENT_PRESSED || code == LV_EVENT_PRESSING) { uint16_t col; uint16_t row; lv_res_t pr_res = get_pressed_cell(obj, &row, &col); @@ -474,7 +476,7 @@ static void lv_table_event(lv_obj_t * obj, lv_event_t e) } lv_obj_invalidate(obj); } - else if(e == LV_EVENT_RELEASED) { + else if(code == LV_EVENT_RELEASED) { lv_obj_invalidate(obj); lv_indev_t * indev = lv_indev_get_act(); lv_obj_t * scroll_obj = lv_indev_get_scroll_obj(indev); @@ -489,10 +491,10 @@ static void lv_table_event(lv_obj_t * obj, lv_event_t e) table->row_act = LV_TABLE_CELL_NONE; } } - else if(e == LV_EVENT_FOCUSED) { + else if(code == LV_EVENT_FOCUSED) { lv_obj_invalidate(obj); - } else if(e == LV_EVENT_KEY) { - int32_t c = *((int32_t *)lv_event_get_param()); + } else if(code == LV_EVENT_KEY) { + int32_t c = *((int32_t *)lv_event_get_param(e)); int32_t col = table->col_act; int32_t row = table->row_act; if(col == LV_TABLE_CELL_NONE || row == LV_TABLE_CELL_NONE) { @@ -541,16 +543,17 @@ static void lv_table_event(lv_obj_t * obj, lv_event_t e) res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL); if(res != LV_RES_OK) return; } - } else if(e == LV_EVENT_DRAW_MAIN) { - draw_main(obj); + } else if(code == LV_EVENT_DRAW_MAIN) { + draw_main(e); } } -static void draw_main(lv_obj_t * obj) +static void draw_main(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_table_t * table = (lv_table_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_point_t txt_size; lv_area_t cell_area; diff --git a/src/widgets/lv_textarea.c b/src/widgets/lv_textarea.c index d68c45eb9..a12a44ab7 100644 --- a/src/widgets/lv_textarea.c +++ b/src/widgets/lv_textarea.c @@ -44,7 +44,7 @@ **********************/ static void lv_textarea_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_textarea_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_textarea_event(lv_obj_t * obj, lv_event_t e); +static void lv_textarea_event(lv_event_t * e); static void cursor_blink_anim_cb(void * obj, int32_t show); static void pwd_char_hider_anim(void * obj, int32_t x); static void pwd_char_hider_anim_ready(lv_anim_t * a); @@ -52,10 +52,10 @@ static void pwd_char_hider(lv_obj_t * obj); static bool char_is_accepted(lv_obj_t * obj, uint32_t c); static void start_cursor_blink(lv_obj_t * obj); static void refr_cursor_area(lv_obj_t * obj); -static void update_cursor_position_on_click(lv_obj_t * obj, lv_event_t e); +static void update_cursor_position_on_click(lv_event_t * e); static lv_res_t insert_handler(lv_obj_t * obj, const char * txt); -static void draw_placeholder(lv_obj_t * obj); -static void draw_cursor(lv_obj_t * obj); +static void draw_placeholder(lv_event_t * e); +static void draw_cursor(lv_event_t * e); /********************** * STATIC VARIABLES @@ -843,26 +843,28 @@ static void lv_textarea_destructor(const lv_obj_class_t * class_p, lv_obj_t * ob } } -static void lv_textarea_event(lv_obj_t * obj, lv_event_t e) +static void lv_textarea_event(lv_event_t * e) { lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_textarea_t * ta = (lv_textarea_t *)obj; - if(e == LV_EVENT_STYLE_CHANGED) { + if(code == LV_EVENT_STYLE_CHANGED) { if(ta->label) { lv_label_set_text(ta->label, NULL); refr_cursor_area(obj); start_cursor_blink(obj); } } - else if(e == LV_EVENT_FOCUSED) { + else if(code == LV_EVENT_FOCUSED) { start_cursor_blink(obj); } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { /*Set the label width according to the text area width*/ if(ta->label) { lv_obj_set_width(ta->label, lv_obj_get_width_fit(obj)); @@ -872,8 +874,8 @@ static void lv_textarea_event(lv_obj_t * obj, lv_event_t e) refr_cursor_area(obj); } } - else if(e == LV_EVENT_KEY) { - uint32_t c = *((uint32_t *)lv_event_get_param()); /*uint32_t because can be UTF-8*/ + else if(code == LV_EVENT_KEY) { + uint32_t c = *((uint32_t *)lv_event_get_param(e)); /*uint32_t because can be UTF-8*/ if(c == LV_KEY_RIGHT) lv_textarea_cursor_right(obj); else if(c == LV_KEY_LEFT) @@ -896,15 +898,15 @@ static void lv_textarea_event(lv_obj_t * obj, lv_event_t e) lv_textarea_add_char(obj, c); } } - else if(e == LV_EVENT_PRESSED || e == LV_EVENT_PRESSING || e == LV_EVENT_PRESS_LOST || - e == LV_EVENT_RELEASED) { - update_cursor_position_on_click(obj, e); + else if(code == LV_EVENT_PRESSED || code == LV_EVENT_PRESSING || code == LV_EVENT_PRESS_LOST || + code == LV_EVENT_RELEASED) { + update_cursor_position_on_click(e); } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_placeholder(obj); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_placeholder(e); } - else if(e == LV_EVENT_DRAW_POST) { - draw_cursor(obj); + else if(code == LV_EVENT_DRAW_POST) { + draw_cursor(e); } } @@ -1129,11 +1131,13 @@ static void refr_cursor_area(lv_obj_t * obj) lv_obj_invalidate_area(obj, &area_tmp); } -static void update_cursor_position_on_click(lv_obj_t * obj, lv_event_t e) +static void update_cursor_position_on_click(lv_event_t * e) { lv_indev_t * click_source = lv_indev_get_act(); if(click_source == NULL) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_textarea_t * ta = (lv_textarea_t *)obj; if(ta->cursor.click_pos == 0) return; @@ -1184,11 +1188,11 @@ static void update_cursor_position_on_click(lv_obj_t * obj, lv_event_t e) ta->text_sel_in_prog = 1; lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_CHAIN); } - else if(ta->text_sel_in_prog && e == LV_EVENT_PRESSING) { + else if(ta->text_sel_in_prog && code == LV_EVENT_PRESSING) { /*Input device may be moving. Store the end position*/ ta->sel_end = char_id_at_click; } - else if(ta->text_sel_in_prog && (e == LV_EVENT_PRESS_LOST || e == LV_EVENT_RELEASED)) { + else if(ta->text_sel_in_prog && (code == LV_EVENT_PRESS_LOST || code == LV_EVENT_RELEASED)) { /*Input device is released. Check if anything was selected.*/ lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_CHAIN); } @@ -1222,7 +1226,7 @@ static void update_cursor_position_on_click(lv_obj_t * obj, lv_event_t e) } } /*Finish selection if necessary*/ - if(e == LV_EVENT_PRESS_LOST || e == LV_EVENT_RELEASED) { + if(code == LV_EVENT_PRESS_LOST || code == LV_EVENT_RELEASED) { ta->text_sel_in_prog = 0; } } @@ -1239,7 +1243,7 @@ static void update_cursor_position_on_click(lv_obj_t * obj, lv_event_t e) char_id_at_click = lv_label_get_letter_on(ta->label, &rel_pos); } - if(e == LV_EVENT_PRESSED) lv_textarea_set_cursor_pos(obj, char_id_at_click); + if(code == LV_EVENT_PRESSED) lv_textarea_set_cursor_pos(obj, char_id_at_click); #endif } @@ -1260,10 +1264,11 @@ static lv_res_t insert_handler(lv_obj_t * obj, const char * txt) return LV_RES_OK; } -static void draw_placeholder(lv_obj_t * obj) +static void draw_placeholder(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_textarea_t * ta = (lv_textarea_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); const char * txt = lv_label_get_text(ta->label); /*Draw the place holder*/ @@ -1286,10 +1291,11 @@ static void draw_placeholder(lv_obj_t * obj) } } -static void draw_cursor(lv_obj_t * obj) +static void draw_cursor(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_textarea_t * ta = (lv_textarea_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); const char * txt = lv_label_get_text(ta->label); if(ta->cursor.show == 0) return; From 9787d38781ff1dca134565b1567afdb1dbcea922 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 15 Apr 2021 18:31:50 +0200 Subject: [PATCH 002/152] feat(style) add transform_x/y --- examples/layouts/flex/lv_example_flex_1.c | 4 +-- examples/layouts/grid/lv_example_grid_1.c | 2 +- scripts/style_api_gen.py | 2 ++ src/core/lv_obj_pos.c | 12 ++++----- src/core/lv_obj_style.c | 8 +++++- src/core/lv_obj_style_gen.h | 28 ++++++++++++++++++++ src/extra/layouts/flex/lv_flex.c | 4 +-- src/extra/layouts/grid/lv_grid.c | 4 +++ src/extra/themes/default/lv_theme_default.c | 1 + src/misc/lv_style.h | 29 ++++++++++++--------- src/misc/lv_style_gen.h | 16 ++++++++++++ 11 files changed, 85 insertions(+), 25 deletions(-) diff --git a/examples/layouts/flex/lv_example_flex_1.c b/examples/layouts/flex/lv_example_flex_1.c index 60c157e56..7e6f1e971 100644 --- a/examples/layouts/flex/lv_example_flex_1.c +++ b/examples/layouts/flex/lv_example_flex_1.c @@ -24,7 +24,7 @@ void lv_example_flex_1(void) lv_obj_t * label; /*Add items to the row*/ - obj= lv_obj_create(cont_row); + obj= lv_btn_create(cont_row); lv_obj_set_size(obj, 100, LV_SIZE_PCT(100)); label = lv_label_create(obj); @@ -32,7 +32,7 @@ void lv_example_flex_1(void) lv_obj_center(label); /*Add items to the column*/ - obj = lv_obj_create(cont_col); + obj = lv_btn_create(cont_col); lv_obj_set_size(obj, LV_SIZE_PCT(100), LV_SIZE_CONTENT); label = lv_label_create(obj); diff --git a/examples/layouts/grid/lv_example_grid_1.c b/examples/layouts/grid/lv_example_grid_1.c index 05ddcb4af..fbf0251b9 100644 --- a/examples/layouts/grid/lv_example_grid_1.c +++ b/examples/layouts/grid/lv_example_grid_1.c @@ -25,7 +25,7 @@ void lv_example_grid_1(void) uint8_t col = i % 3; uint8_t row = i / 3; - obj = lv_obj_create(cont); + obj = lv_btn_create(cont); /*Stretch the cell horizontally and vertically too *Set span to 1 to make the cell 1 column/row sized*/ lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1, diff --git a/scripts/style_api_gen.py b/scripts/style_api_gen.py index 0bb883180..32b3f68ed 100755 --- a/scripts/style_api_gen.py +++ b/scripts/style_api_gen.py @@ -7,6 +7,8 @@ props = [ {'name': 'CLIP_CORNER', 'style_type': 'num', 'var_type': 'bool' }, {'name': 'TRANSFORM_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, {'name': 'TRANSFORM_HEIGHT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, +{'name': 'TRANSFORM_X', 'style_type': 'num', 'var_type': 'lv_coord_t' }, +{'name': 'TRANSFORM_Y', 'style_type': 'num', 'var_type': 'lv_coord_t' }, {'name': 'TRANSFORM_ZOOM', 'style_type': 'num', 'var_type': 'lv_coord_t' }, {'name': 'TRANSFORM_ANGLE', 'style_type': 'num', 'var_type': 'lv_coord_t' }, {'name': 'OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 4d57c3bd1..4695e6aaf 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -589,9 +589,11 @@ bool lv_obj_handle_self_size_chg(struct _lv_obj_t * obj) void lv_obj_refr_pos(lv_obj_t * obj) { + if(lv_obj_is_layout_positioned(obj)) return; + lv_obj_t * parent = lv_obj_get_parent(obj); - lv_coord_t x = lv_obj_get_style_x(obj, LV_PART_MAIN); - lv_coord_t y = lv_obj_get_style_y(obj, LV_PART_MAIN); + lv_coord_t x = lv_obj_get_style_x(obj, LV_PART_MAIN) + lv_obj_get_style_transform_x(obj, LV_PART_MAIN); + lv_coord_t y = lv_obj_get_style_y(obj, LV_PART_MAIN) + lv_obj_get_style_transform_y(obj, LV_PART_MAIN); if(parent == NULL) { lv_obj_move_to(obj, x, y); return; @@ -645,8 +647,6 @@ void lv_obj_refr_pos(lv_obj_t * obj) void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) { - if(lv_obj_is_layout_positioned(obj)) return; - /*Convert x and y to absolute coordinates*/ lv_obj_t * parent = obj->parent; @@ -924,13 +924,13 @@ static void layout_update_core(lv_obj_t * obj) /*Be sure the left side is not remains scrolled in*/ if(sr < 0 && sl > 0) { sr = LV_MIN(sl, -sr); - lv_obj_scroll_by(obj, 0, sr, LV_ANIM_OFF); + lv_obj_scroll_by(obj, sr, 0, LV_ANIM_OFF); } } else { /*Be sure the right side is not remains scrolled in*/ if(sl < 0 && sr > 0) { sr = LV_MIN(sr, -sl); - lv_obj_scroll_by(obj, 0, sl, LV_ANIM_OFF); + lv_obj_scroll_by(obj, sl, 0, LV_ANIM_OFF); } } diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index a91f472e8..7062d46cc 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -174,7 +174,13 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_PROP_LAYOUT_REFR))) { lv_event_send(obj, LV_EVENT_STYLE_CHANGED, NULL); /*To update layout*/ - } else if(prop & LV_STYLE_PROP_EXT_DRAW) { + if(obj->parent) obj->parent->layout_inv = 1; + } + if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_PROP_PARENT_LAYOUT_REFR))) { + lv_obj_t * parent = lv_obj_get_parent(obj); + if(parent) lv_obj_mark_layout_as_dirty(parent); + } + else if(prop & LV_STYLE_PROP_EXT_DRAW) { lv_obj_refresh_ext_draw_size(obj); } lv_obj_invalidate(obj); diff --git a/src/core/lv_obj_style_gen.h b/src/core/lv_obj_style_gen.h index 3bd67450d..888a7a48e 100644 --- a/src/core/lv_obj_style_gen.h +++ b/src/core/lv_obj_style_gen.h @@ -22,6 +22,18 @@ static inline lv_coord_t lv_obj_get_style_transform_height(const struct _lv_obj_ return (lv_coord_t)v.num; } +static inline lv_coord_t lv_obj_get_style_transform_x(const struct _lv_obj_t * obj, uint32_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_X); + return (lv_coord_t)v.num; +} + +static inline lv_coord_t lv_obj_get_style_transform_y(const struct _lv_obj_t * obj, uint32_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_Y); + return (lv_coord_t)v.num; +} + static inline lv_coord_t lv_obj_get_style_transform_zoom(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ZOOM); @@ -546,6 +558,22 @@ static inline void lv_obj_set_style_transform_height(struct _lv_obj_t * obj, lv_ lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_HEIGHT, v, selector); } +static inline void lv_obj_set_style_transform_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_X, v, selector); +} + +static inline void lv_obj_set_style_transform_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_Y, v, selector); +} + static inline void lv_obj_set_style_transform_zoom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) { lv_style_value_t v = { diff --git a/src/extra/layouts/flex/lv_flex.c b/src/extra/layouts/flex/lv_flex.c index da4a42849..ce41dfb17 100644 --- a/src/extra/layouts/flex/lv_flex.c +++ b/src/extra/layouts/flex/lv_flex.c @@ -399,8 +399,8 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i if(f->row && rtl) main_pos -= area_get_main_size(&item->coords); - lv_coord_t diff_x = abs_x - item->coords.x1; - lv_coord_t diff_y = abs_y - item->coords.y1; + lv_coord_t diff_x = abs_x - item->coords.x1 + lv_obj_get_style_transform_x(item, 0); + lv_coord_t diff_y = abs_y - item->coords.y1 + lv_obj_get_style_transform_y(item, 0); diff_x += f->row ? main_pos : cross_pos; diff_y += f->row ? cross_pos : main_pos; diff --git a/src/extra/layouts/grid/lv_grid.c b/src/extra/layouts/grid/lv_grid.c index 171b3144d..ed7f5e300 100644 --- a/src/extra/layouts/grid/lv_grid.c +++ b/src/extra/layouts/grid/lv_grid.c @@ -444,6 +444,10 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * lv_event_send(lv_obj_get_parent(item), LV_EVENT_CHILD_CHANGED, item); } + + x += lv_obj_get_style_transform_x(item, LV_PART_MAIN); + y += lv_obj_get_style_transform_y(item, LV_PART_MAIN); + lv_coord_t diff_x = hint->grid_abs.x + x - item->coords.x1; lv_coord_t diff_y = hint->grid_abs.y + y - item->coords.y1; if(diff_x || diff_y) { diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index c37fb398f..e692f029a 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -193,6 +193,7 @@ static void style_init(void) static const lv_style_prop_t trans_props[] = { LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR, LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, + LV_STYLE_TRANSFORM_Y, LV_STYLE_TRANSFORM_X, LV_STYLE_TRANSFORM_ZOOM, LV_STYLE_TRANSFORM_ANGLE, LV_STYLE_COLOR_FILTER_OPA, LV_STYLE_COLOR_FILTER_DSC, 0 diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index 87225e6b6..d2bf25400 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -31,10 +31,11 @@ extern "C" { /** * Flags for style properties */ -#define LV_STYLE_PROP_INHERIT (1 << 10) /*Inherited*/ -#define LV_STYLE_PROP_EXT_DRAW (1 << 11) /*Requires ext. draw size update when changed*/ -#define LV_STYLE_PROP_LAYOUT_REFR (1 << 12) /*Requires layout update when changed*/ -#define LV_STYLE_PROP_FILTER (1 << 13) /*Apply color filter*/ +#define LV_STYLE_PROP_INHERIT (1 << 10) /*Inherited*/ +#define LV_STYLE_PROP_EXT_DRAW (1 << 11) /*Requires ext. draw size update when changed*/ +#define LV_STYLE_PROP_LAYOUT_REFR (1 << 12) /*Requires layout update when changed*/ +#define LV_STYLE_PROP_PARENT_LAYOUT_REFR (1 << 13) /*Requires layout update on parent when changed*/ +#define LV_STYLE_PROP_FILTER (1 << 14) /*Apply color filter*/ /** * Other constants @@ -115,16 +116,18 @@ typedef enum { LV_STYLE_CLIP_CORNER = 2, LV_STYLE_TRANSFORM_WIDTH = 3 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_TRANSFORM_HEIGHT = 4 | LV_STYLE_PROP_EXT_DRAW, - LV_STYLE_TRANSFORM_ZOOM = 5 | LV_STYLE_PROP_EXT_DRAW, - LV_STYLE_TRANSFORM_ANGLE = 6 | LV_STYLE_PROP_EXT_DRAW, - LV_STYLE_OPA = 7 | LV_STYLE_PROP_INHERIT, + LV_STYLE_TRANSFORM_X = 5 | LV_STYLE_PROP_PARENT_LAYOUT_REFR, + LV_STYLE_TRANSFORM_Y = 6 | LV_STYLE_PROP_PARENT_LAYOUT_REFR, + LV_STYLE_TRANSFORM_ZOOM = 7 | LV_STYLE_PROP_EXT_DRAW, + LV_STYLE_TRANSFORM_ANGLE = 8 | LV_STYLE_PROP_EXT_DRAW, + LV_STYLE_OPA = 9 | LV_STYLE_PROP_INHERIT, - LV_STYLE_COLOR_FILTER_DSC = 8, - LV_STYLE_COLOR_FILTER_OPA = 9, - LV_STYLE_ANIM_TIME = 10, - LV_STYLE_TRANSITION = 11, - LV_STYLE_SIZE = 12, - LV_STYLE_BLEND_MODE = 13, + LV_STYLE_COLOR_FILTER_DSC = 10, + LV_STYLE_COLOR_FILTER_OPA = 11, + LV_STYLE_ANIM_TIME = 12, + LV_STYLE_TRANSITION = 13, + LV_STYLE_SIZE = 14, + LV_STYLE_BLEND_MODE = 15, /*Group 1*/ LV_STYLE_PAD_TOP = 16 | LV_STYLE_PROP_LAYOUT_REFR, diff --git a/src/misc/lv_style_gen.h b/src/misc/lv_style_gen.h index b75a98eb8..11cdb6823 100644 --- a/src/misc/lv_style_gen.h +++ b/src/misc/lv_style_gen.h @@ -30,6 +30,22 @@ static inline void lv_style_set_transform_height(lv_style_t * style, lv_coord_t lv_style_set_prop(style, LV_STYLE_TRANSFORM_HEIGHT, v); } +static inline void lv_style_set_transform_x(lv_style_t * style, lv_coord_t value) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_style_set_prop(style, LV_STYLE_TRANSFORM_X, v); +} + +static inline void lv_style_set_transform_y(lv_style_t * style, lv_coord_t value) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_style_set_prop(style, LV_STYLE_TRANSFORM_Y, v); +} + static inline void lv_style_set_transform_zoom(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { From 5f8445966b0fe5fe74633f78a0f2ac61c1ced105 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 15 Apr 2021 18:46:21 +0200 Subject: [PATCH 003/152] fix build error --- src/widgets/lv_bar.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/widgets/lv_bar.c b/src/widgets/lv_bar.c index 16f857687..9c0d1a410 100644 --- a/src/widgets/lv_bar.c +++ b/src/widgets/lv_bar.c @@ -468,7 +468,6 @@ static void draw_indic(lv_event_t * e) static void lv_bar_event(lv_event_t * e) { - LV_ASSERT_OBJ(obj, MY_CLASS); lv_res_t res; /*Call the ancestor's event handler*/ From aa800841bc73ae1dccb2e193c920846c94d573b6 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 15 Apr 2021 19:13:41 +0200 Subject: [PATCH 004/152] fix(gc root) add the layouts' list to GC roots --- src/core/lv_obj_pos.c | 10 +++++----- src/misc/lv_gc.h | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 4695e6aaf..1c6cbad9f 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -9,6 +9,7 @@ #include "lv_obj.h" #include "lv_disp.h" #include "lv_refr.h" +#include "../misc/lv_gc.h" /********************* * DEFINES @@ -28,7 +29,6 @@ static void layout_update_core(lv_obj_t * obj); /********************** * STATIC VARIABLES **********************/ -static lv_layout_update_cb_t * layouts; static uint32_t layout_cnt; /********************** @@ -296,10 +296,10 @@ void lv_obj_update_layout(const lv_obj_t * obj) uint32_t lv_layout_register(lv_layout_update_cb_t cb) { layout_cnt++; - layouts = lv_mem_realloc(layouts, layout_cnt * sizeof(lv_layout_update_cb_t)); - LV_ASSERT_MALLOC(layouts); + LV_GC_ROOT(_lv_layout_list) = lv_mem_realloc(LV_GC_ROOT(_lv_layout_list), layout_cnt * sizeof(lv_layout_update_cb_t)); + LV_ASSERT_MALLOC(LV_GC_ROOT(_lv_layout_list)); - layouts[layout_cnt - 1] = cb; + LV_GC_ROOT(_lv_layout_list)[layout_cnt - 1] = cb; return layout_cnt; /*No -1 to skip 0th index*/ } @@ -937,7 +937,7 @@ static void layout_update_core(lv_obj_t * obj) if(lv_obj_get_child_cnt(obj) > 0) { uint32_t layout_id = lv_obj_get_style_layout(obj, LV_PART_MAIN); if(layout_id > 0 && layout_id <= layout_cnt) { - layouts[layout_id -1](obj); + LV_GC_ROOT(_lv_layout_list)[layout_id -1](obj); } } } diff --git a/src/misc/lv_gc.h b/src/misc/lv_gc.h index 08a34357d..3f4eac329 100644 --- a/src/misc/lv_gc.h +++ b/src/misc/lv_gc.h @@ -20,6 +20,7 @@ extern "C" { #include "lv_timer.h" #include "../draw/lv_img_cache.h" #include "../draw/lv_draw_mask.h" +#include "../core/lv_obj_pos.h" /********************* * DEFINES @@ -47,6 +48,7 @@ extern "C" { LV_DISPATCH(f, lv_ll_t, _lv_group_ll) \ LV_DISPATCH(f, lv_ll_t, _lv_img_decoder_ll) \ LV_DISPATCH(f, lv_ll_t, _lv_obj_style_trans_ll) \ + LV_DISPATCH(f, lv_layout_update_cb_t *, _lv_layout_list) \ LV_DISPATCH_COND(f, lv_img_cache_entry_t*, _lv_img_cache_array, LV_IMG_CACHE_DEF, 1) \ LV_DISPATCH_COND(f, lv_img_cache_entry_t, _lv_img_cache_single, LV_IMG_CACHE_DEF, 0) \ LV_DISPATCH(f, lv_timer_t*, _lv_timer_act) \ From a9d0de5998f9b7b8fde373143cf253a7ae53485e Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 15 Apr 2021 23:36:06 +0200 Subject: [PATCH 005/152] refactor: remove some unused functions and prototypes --- src/hal/lv_hal_disp.c | 22 ---------------------- src/hal/lv_hal_disp.h | 19 ------------------- 2 files changed, 41 deletions(-) diff --git a/src/hal/lv_hal_disp.c b/src/hal/lv_hal_disp.c index c4bdebca0..f2b39920b 100644 --- a/src/hal/lv_hal_disp.c +++ b/src/hal/lv_hal_disp.c @@ -360,28 +360,6 @@ lv_disp_draw_buf_t * lv_disp_get_draw_buf(lv_disp_t * disp) return disp->driver->draw_buf; } -/** - * Get the number of areas in the buffer - * @return number of invalid areas - */ -uint16_t lv_disp_get_inv_buf_size(lv_disp_t * disp) -{ - return disp->inv_p; -} - -/** - * Pop (delete) the last 'num' invalidated areas from the buffer - * @param num number of areas to delete - */ -void _lv_disp_pop_from_inv_buf(lv_disp_t * disp, uint16_t num) -{ - - if(disp->inv_p < num) - disp->inv_p = 0; - else - disp->inv_p -= num; -} - /** * Set the rotation of this display. * @param disp pointer to a display (NULL to use the default display) diff --git a/src/hal/lv_hal_disp.h b/src/hal/lv_hal_disp.h index 2e76be23d..fbeb93b9d 100644 --- a/src/hal/lv_hal_disp.h +++ b/src/hal/lv_hal_disp.h @@ -313,25 +313,6 @@ lv_disp_t * lv_disp_get_next(lv_disp_t * disp); */ lv_disp_draw_buf_t * lv_disp_get_draw_buf(lv_disp_t * disp); -/** - * Get the number of areas in the buffer - * @return number of invalid areas - */ -uint16_t lv_disp_get_inv_buf_size(lv_disp_t * disp); - -/** - * Pop (delete) the last 'num' invalidated areas from the buffer - * @param num number of areas to delete - */ -void _lv_disp_pop_from_inv_buf(lv_disp_t * disp, uint16_t num); - -/** - * Check the driver configuration if it's double buffered (both `buf1` and `buf2` are set) - * @param disp pointer to to display to check - * @return true: double buffered; false: not double buffered - */ -bool lv_disp_is_double_buf(lv_disp_t * disp); - /********************** * MACROS **********************/ From e1355dbeee2363f9cfd057a0e9ab37155e41a58a Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 17 Apr 2021 17:33:57 +0200 Subject: [PATCH 006/152] feat(style) add transform_x/y --- scripts/style_api_gen.py | 1 - src/core/lv_obj.c | 37 +++++----- src/core/lv_obj_draw.c | 5 -- src/core/lv_obj_pos.c | 3 + src/core/lv_obj_scroll.c | 75 +++++++++++---------- src/core/lv_obj_style.c | 5 +- src/core/lv_obj_style.h | 5 ++ src/core/lv_obj_style_gen.h | 14 ---- src/core/lv_refr.c | 2 +- src/extra/layouts/flex/lv_flex.c | 6 +- src/extra/layouts/grid/lv_grid.c | 3 + src/extra/themes/default/lv_theme_default.c | 17 ++--- src/misc/lv_area.c | 52 +++++++++----- src/misc/lv_area.h | 14 ++-- src/misc/lv_style.c | 3 - src/misc/lv_style.h | 16 +++-- src/misc/lv_style_gen.h | 8 --- src/widgets/lv_bar.c | 17 ++--- src/widgets/lv_chart.c | 72 ++++++++++---------- src/widgets/lv_meter.c | 11 +-- 20 files changed, 179 insertions(+), 187 deletions(-) diff --git a/scripts/style_api_gen.py b/scripts/style_api_gen.py index 32b3f68ed..007696996 100755 --- a/scripts/style_api_gen.py +++ b/scripts/style_api_gen.py @@ -16,7 +16,6 @@ props = [ {'name': 'COLOR_FILTER_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, {'name': 'ANIM_TIME', 'style_type': 'num', 'var_type': 'uint32_t' }, {'name': 'TRANSITION', 'style_type': 'ptr', 'var_type': 'const lv_style_transition_dsc_t *' }, -{'name': 'SIZE', 'style_type': 'num', 'var_type': 'lv_coord_t' }, {'name': 'BLEND_MODE', 'style_type': 'num', 'var_type': 'lv_blend_mode_t' }, {'name': 'PAD_TOP', 'style_type': 'num', 'var_type': 'lv_coord_t' }, {'name': 'PAD_BOTTOM', 'style_type': 'num', 'var_type': 'lv_coord_t' }, diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index e1d6363a4..516caa1a5 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -649,14 +649,9 @@ static void lv_obj_draw(lv_event_t * e) /*Most trivial test. Is the mask fully IN the object? If no it surely doesn't cover it*/ lv_coord_t r = lv_obj_get_style_radius(obj, LV_PART_MAIN); - lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); - lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); + lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); lv_area_t coords; - lv_area_copy(&coords, &obj->coords); - coords.x1 -= w; - coords.x2 += w; - coords.y1 -= h; - coords.y2 += h; + lv_area_zoom(zoom, &obj->coords, &coords); if(_lv_area_is_in(info->area, &coords, r) == false) { info->res = LV_DRAW_RES_NOT_COVER; @@ -693,14 +688,9 @@ static void lv_obj_draw(lv_event_t * e) lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &draw_dsc); - lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); - lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); + lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); lv_area_t coords; - lv_area_copy(&coords, &obj->coords); - coords.x1 -= w; - coords.x2 += w; - coords.y1 -= h; - coords.y2 += h; + lv_area_zoom(zoom, &obj->coords, &coords); lv_draw_rect(&coords, clip_area, &draw_dsc); @@ -734,14 +724,10 @@ static void lv_obj_draw(lv_event_t * e) draw_dsc.shadow_opa = LV_OPA_TRANSP; lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &draw_dsc); - lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); - lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); + lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); lv_area_t coords; - lv_area_copy(&coords, &obj->coords); - coords.x1 -= w; - coords.x2 += w; - coords.y1 -= h; - coords.y2 += h; + lv_area_zoom(zoom, &obj->coords, &coords); + lv_draw_rect(&coords, clip_area, &draw_dsc); } } @@ -920,6 +906,14 @@ static void lv_obj_event_cb(lv_event_t * e) lv_coord_t * s = lv_event_get_param(e); lv_coord_t d = lv_obj_calculate_ext_draw_size(obj, LV_PART_MAIN); *s = LV_MAX(*s, d); + + + lv_area_t zoomed_coords; + lv_area_zoom(lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN), &obj->coords, &zoomed_coords); + *s = LV_MAX(*s, obj->coords.x1 - zoomed_coords.x1); + *s = LV_MAX(*s, obj->coords.y1 - zoomed_coords.y1); + *s = LV_MAX(*s, zoomed_coords.x2 - obj->coords.x2); + *s = LV_MAX(*s, zoomed_coords.x2 - obj->coords.x2); } else if(code == LV_EVENT_STYLE_CHANGED) { /*Padding might have changed so the layout should be recalculated*/ @@ -1140,7 +1134,6 @@ static bool event_is_bubbled(lv_event_code_t e) case LV_EVENT_DELETE: case LV_EVENT_CHILD_CHANGED: case LV_EVENT_SIZE_CHANGED: - case LV_EVENT_STYLE_CHANGED: case LV_EVENT_GET_SELF_SIZE: return false; default: diff --git a/src/core/lv_obj_draw.c b/src/core/lv_obj_draw.c index 244377661..142d62976 100644 --- a/src/core/lv_obj_draw.c +++ b/src/core/lv_obj_draw.c @@ -315,11 +315,6 @@ lv_coord_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part) } } - lv_coord_t w = lv_obj_get_style_transform_width(obj, part); - lv_coord_t h = lv_obj_get_style_transform_height(obj, part); - lv_coord_t wh = LV_MAX(w, h); - if(wh > 0) s += wh; - return s; } diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 1c6cbad9f..99ca8b5ef 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -125,6 +125,9 @@ void lv_obj_refr_size(lv_obj_t * obj) if(pct_w) w = (LV_COORD_GET_PCT(w) * parent_w) / 100; if(pct_h) h = (LV_COORD_GET_PCT(h) * parent_h) / 100; + w += lv_obj_get_style_transform_width(obj, LV_PART_MAIN); + h += lv_obj_get_style_transform_height(obj, LV_PART_MAIN); + lv_coord_t minw = lv_obj_get_style_min_width(obj, LV_PART_MAIN); lv_coord_t maxw = lv_obj_get_style_max_width(obj, LV_PART_MAIN); w = lv_clamp_width(w, minw, maxw, parent_w); diff --git a/src/core/lv_obj_scroll.c b/src/core/lv_obj_scroll.c index 295c1ac22..c60da7da5 100644 --- a/src/core/lv_obj_scroll.c +++ b/src/core/lv_obj_scroll.c @@ -420,7 +420,7 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * lv_coord_t end_space = lv_obj_get_style_pad_top(obj, LV_PART_SCROLLBAR); lv_coord_t side_space = lv_obj_get_style_pad_right(obj, LV_PART_SCROLLBAR); - lv_coord_t tickness = lv_obj_get_style_size(obj, LV_PART_SCROLLBAR); + lv_coord_t tickness = lv_obj_get_style_width(obj, LV_PART_SCROLLBAR); lv_coord_t obj_h = lv_obj_get_height(obj); lv_coord_t obj_w = lv_obj_get_width(obj); @@ -439,35 +439,35 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * /*Draw horizontal scrollbar if the mode is ON or can be scrolled in this direction*/ lv_coord_t content_h = obj_h + st + sb; if(ver_draw && content_h) { - hor_area->y1 = obj->coords.y1; - hor_area->y2 = obj->coords.y2; - hor_area->x2 = obj->coords.x2 - side_space; - hor_area->x1 = hor_area->x2 - tickness; + ver_area->y1 = obj->coords.y1; + ver_area->y2 = obj->coords.y2; + ver_area->x2 = obj->coords.x2 - side_space; + ver_area->x1 = ver_area->x2 - tickness; lv_coord_t sb_h = ((obj_h - end_space * 2 - hor_req_space) * obj_h) / content_h; sb_h = LV_MAX(sb_h, SCROLLBAR_MIN_SIZE); rem = (obj_h - end_space * 2 - hor_req_space) - sb_h; /*Remaining size from the scrollbar track that is not the scrollbar itself*/ lv_coord_t scroll_h = content_h - obj_h; /*The size of the content which can be really scrolled*/ if(scroll_h <= 0) { - hor_area->y1 = obj->coords.y1 + end_space; - hor_area->y2 = obj->coords.y2 - end_space - hor_req_space - 1; - hor_area->x2 = obj->coords.x2 - side_space; - hor_area->x1 = hor_area->x2 - tickness + 1; + ver_area->y1 = obj->coords.y1 + end_space; + ver_area->y2 = obj->coords.y2 - end_space - hor_req_space - 1; + ver_area->x2 = obj->coords.x2 - side_space; + ver_area->x1 = ver_area->x2 - tickness + 1; } else { lv_coord_t sb_y = (rem * sb) / scroll_h; sb_y = rem - sb_y; - hor_area->y1 = obj->coords.y1 + sb_y + end_space; - hor_area->y2 = hor_area->y1 + sb_h - 1; - hor_area->x2 = obj->coords.x2 - side_space; - hor_area->x1 = hor_area->x2 - tickness; - if(hor_area->y1 < obj->coords.y1 + end_space) { - hor_area->y1 = obj->coords.y1 + end_space; - if(hor_area->y1 + SCROLLBAR_MIN_SIZE > hor_area->y2) hor_area->y2 = hor_area->y1 + SCROLLBAR_MIN_SIZE; + ver_area->y1 = obj->coords.y1 + sb_y + end_space; + ver_area->y2 = ver_area->y1 + sb_h - 1; + ver_area->x2 = obj->coords.x2 - side_space; + ver_area->x1 = ver_area->x2 - tickness; + if(ver_area->y1 < obj->coords.y1 + end_space) { + ver_area->y1 = obj->coords.y1 + end_space; + if(ver_area->y1 + SCROLLBAR_MIN_SIZE > ver_area->y2) ver_area->y2 = ver_area->y1 + SCROLLBAR_MIN_SIZE; } - if(hor_area->y2 > obj->coords.y2 - hor_req_space - end_space) { - hor_area->y2 = obj->coords.y2 - hor_req_space - end_space; - if(hor_area->y2 - SCROLLBAR_MIN_SIZE < hor_area->y1) hor_area->y1 = hor_area->y2 - SCROLLBAR_MIN_SIZE; + if(ver_area->y2 > obj->coords.y2 - hor_req_space - end_space) { + ver_area->y2 = obj->coords.y2 - hor_req_space - end_space; + if(ver_area->y2 - SCROLLBAR_MIN_SIZE < ver_area->y1) ver_area->y1 = ver_area->y2 - SCROLLBAR_MIN_SIZE; } } } @@ -475,35 +475,35 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * /*Draw horizontal scrollbar if the mode is ON or can be scrolled in this direction*/ lv_coord_t content_w = obj_w + sl + sr; if(hor_draw && content_w) { - ver_area->y2 = obj->coords.y2 - side_space; - ver_area->y1 = ver_area->y2 - tickness; - ver_area->x1 = obj->coords.x1; - ver_area->x2 = obj->coords.x2; + hor_area->y2 = obj->coords.y2 - side_space; + hor_area->y1 = hor_area->y2 - tickness; + hor_area->x1 = obj->coords.x1; + hor_area->x2 = obj->coords.x2; lv_coord_t sb_w = ((obj_w - end_space * 2 - ver_reg_space) * obj_w) / content_w; sb_w = LV_MAX(sb_w, SCROLLBAR_MIN_SIZE); rem = (obj_w - end_space * 2 - ver_reg_space) - sb_w; /*Remaining size from the scrollbar track that is not the scrollbar itself*/ lv_coord_t scroll_w = content_w - obj_w; /*The size of the content which can be really scrolled*/ if(scroll_w <= 0) { - ver_area->y2 = obj->coords.y2 - side_space; - ver_area->y1 = ver_area->y2 - tickness + 1; - ver_area->x1 = obj->coords.x1 + end_space; - ver_area->x2 = obj->coords.x2 - end_space - ver_reg_space - 1; + hor_area->y2 = obj->coords.y2 - side_space; + hor_area->y1 = hor_area->y2 - tickness + 1; + hor_area->x1 = obj->coords.x1 + end_space; + hor_area->x2 = obj->coords.x2 - end_space - ver_reg_space - 1; } else { lv_coord_t sb_x = (rem * sr) / scroll_w; sb_x = rem - sb_x; - ver_area->x1 = obj->coords.x1 + sb_x + end_space; - ver_area->x2 = ver_area->x1 + sb_w - 1; - ver_area->y2 = obj->coords.y2 - side_space; - ver_area->y1 = ver_area->y2 - tickness; - if(ver_area->x1 < obj->coords.x1 + end_space) { - ver_area->x1 = obj->coords.x1 + end_space; - if(ver_area->x1 + SCROLLBAR_MIN_SIZE > ver_area->x2) ver_area->x2 = ver_area->x1 + SCROLLBAR_MIN_SIZE; + hor_area->x1 = obj->coords.x1 + sb_x + end_space; + hor_area->x2 = hor_area->x1 + sb_w - 1; + hor_area->y2 = obj->coords.y2 - side_space; + hor_area->y1 = hor_area->y2 - tickness; + if(hor_area->x1 < obj->coords.x1 + end_space) { + hor_area->x1 = obj->coords.x1 + end_space; + if(hor_area->x1 + SCROLLBAR_MIN_SIZE > hor_area->x2) hor_area->x2 = hor_area->x1 + SCROLLBAR_MIN_SIZE; } - if(ver_area->x2 > obj->coords.x2 - ver_reg_space - end_space) { - ver_area->x2 = obj->coords.x2 - ver_reg_space - end_space; - if(ver_area->x2 - SCROLLBAR_MIN_SIZE < ver_area->x1) ver_area->x1 = ver_area->x2 - SCROLLBAR_MIN_SIZE; + if(hor_area->x2 > obj->coords.x2 - ver_reg_space - end_space) { + hor_area->x2 = obj->coords.x2 - ver_reg_space - end_space; + if(hor_area->x2 - SCROLLBAR_MIN_SIZE < hor_area->x1) hor_area->x1 = hor_area->x2 - SCROLLBAR_MIN_SIZE; } } } @@ -517,6 +517,7 @@ void lv_obj_scrollbar_invalidate(lv_obj_t * obj) if(lv_area_get_size(&hor_area) <= 0 && lv_area_get_size(&ver_area) <= 0) return; + printf("h: %d\n", hor_area.x2); if(lv_area_get_size(&hor_area) > 0) lv_obj_invalidate_area(obj, &hor_area); if(lv_area_get_size(&ver_area) > 0) lv_obj_invalidate_area(obj, &ver_area); } diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index 7062d46cc..0e81ea6de 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -173,8 +173,7 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style lv_part_t part = lv_obj_style_get_selector_part(selector); if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_PROP_LAYOUT_REFR))) { - lv_event_send(obj, LV_EVENT_STYLE_CHANGED, NULL); /*To update layout*/ - if(obj->parent) obj->parent->layout_inv = 1; + lv_event_send(obj, LV_EVENT_STYLE_CHANGED, NULL); /*To update layout and sizes*/ } if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_PROP_PARENT_LAYOUT_REFR))) { lv_obj_t * parent = lv_obj_get_parent(obj); @@ -224,7 +223,7 @@ lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_ } if(!found) { - if(prop == LV_STYLE_WIDTH || prop == LV_STYLE_HEIGHT) { + if(part == LV_PART_MAIN && (prop == LV_STYLE_WIDTH || prop == LV_STYLE_HEIGHT)) { const lv_obj_class_t * cls = obj->class_p; while(cls) { if(prop == LV_STYLE_WIDTH) { diff --git a/src/core/lv_obj_style.h b/src/core/lv_obj_style.h index b15488d75..2245810fd 100644 --- a/src/core/lv_obj_style.h +++ b/src/core/lv_obj_style.h @@ -208,6 +208,11 @@ static inline void lv_obj_set_style_pad_gap(struct _lv_obj_t * obj, lv_coord_t lv_obj_set_style_pad_column(obj, value, selector); } +static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) { + lv_obj_set_style_width(obj, value, selector); + lv_obj_set_style_height(obj, value, selector); +} + /********************** * MACROS **********************/ diff --git a/src/core/lv_obj_style_gen.h b/src/core/lv_obj_style_gen.h index 888a7a48e..0925a33d0 100644 --- a/src/core/lv_obj_style_gen.h +++ b/src/core/lv_obj_style_gen.h @@ -76,12 +76,6 @@ static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(cons return (const lv_style_transition_dsc_t *)v.ptr; } -static inline lv_coord_t lv_obj_get_style_size(const struct _lv_obj_t * obj, uint32_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SIZE); - return (lv_coord_t)v.num; -} - static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLEND_MODE); @@ -630,14 +624,6 @@ static inline void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_ lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSITION, v, selector); } -static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) -{ - lv_style_value_t v = { - .num = (int32_t)value - }; - lv_obj_set_local_style_prop(obj, LV_STYLE_SIZE, v, selector); -} - static inline void lv_obj_set_style_blend_mode(struct _lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector) { lv_style_value_t v = { diff --git a/src/core/lv_refr.c b/src/core/lv_refr.c index 883c784ee..06b5c2176 100644 --- a/src/core/lv_refr.c +++ b/src/core/lv_refr.c @@ -191,7 +191,7 @@ void _lv_disp_refr_timer(lv_timer_t * tmr) #if LV_USE_PERF_MONITOR == 0 /** * Ensure the timer does not run again automatically. - * This is done before refreshing in case refreshing invalidates something else. + * This is done before refreshing because invalidations later should restart the timer. */ lv_timer_pause(tmr, true); #endif diff --git a/src/extra/layouts/flex/lv_flex.c b/src/extra/layouts/flex/lv_flex.c index ce41dfb17..3577efd8e 100644 --- a/src/extra/layouts/flex/lv_flex.c +++ b/src/extra/layouts/flex/lv_flex.c @@ -206,12 +206,16 @@ static void flex_update(lv_obj_t * cont) *cross_pos += t.track_cross_size + gap + track_gap; } } - LV_ASSERT_MEM_INTEGRITY(); if(w_set == LV_SIZE_CONTENT || h_set == LV_SIZE_CONTENT) { lv_obj_refr_size(cont); } + /*To update e.g. scrollbars */ + lv_obj_invalidate(cont); + + LV_ASSERT_MEM_INTEGRITY(); + LV_TRACE_LAYOUT("finished"); } diff --git a/src/extra/layouts/grid/lv_grid.c b/src/extra/layouts/grid/lv_grid.c index ed7f5e300..6de28d7cf 100644 --- a/src/extra/layouts/grid/lv_grid.c +++ b/src/extra/layouts/grid/lv_grid.c @@ -180,6 +180,9 @@ static void grid_update(lv_obj_t * cont) lv_obj_refr_size(cont); } + /*To update e.g. scrollbars */ + lv_obj_invalidate(cont); + LV_TRACE_LAYOUT("finished"); } diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index e692f029a..070d65873 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -107,7 +107,7 @@ typedef struct { #endif #if LV_USE_METER - lv_style_t meter_marker, meter_indic; + lv_style_t meter_indic; #endif #if LV_USE_TEXTAREA @@ -225,7 +225,7 @@ static void style_init(void) lv_style_set_radius(&styles->scrollbar, LV_RADIUS_CIRCLE); lv_style_set_pad_right(&styles->scrollbar, LV_DPX(7)); lv_style_set_pad_top(&styles->scrollbar, LV_DPX(7)); - lv_style_set_size(&styles->scrollbar, LV_DPX(5)); + lv_style_set_width(&styles->scrollbar, LV_DPX(5)); lv_style_set_bg_opa(&styles->scrollbar, LV_OPA_40); lv_style_set_transition(&styles->scrollbar, &trans_normal); @@ -363,8 +363,8 @@ static void style_init(void) #if LV_THEME_DEFAULT_GROW style_init_reset(&styles->grow); - lv_style_set_transform_width(&styles->grow, LV_DPX(3)); - lv_style_set_transform_height(&styles->grow, LV_DPX(3)); + lv_style_set_transform_width(&styles->grow, 20); + lv_style_set_transform_height(&styles->grow, 20); #endif style_init_reset(&styles->knob); @@ -435,17 +435,12 @@ static void style_init(void) #endif #if LV_USE_METER - style_init_reset(&styles->meter_marker); - lv_style_set_line_width(&styles->meter_marker, LV_DPX(5)); - lv_style_set_line_color(&styles->meter_marker, lv_color_grey_darken_4()); - lv_style_set_size(&styles->meter_marker, LV_DPX(20)); - lv_style_set_pad_left(&styles->meter_marker, LV_DPX(15)); - style_init_reset(&styles->meter_indic); lv_style_set_radius(&styles->meter_indic, LV_RADIUS_CIRCLE); lv_style_set_bg_color(&styles->meter_indic, lv_color_grey_darken_4()); lv_style_set_bg_opa(&styles->meter_indic, LV_OPA_COVER); - lv_style_set_size(&styles->meter_indic, LV_DPX(15)); + lv_style_set_width(&styles->meter_indic, LV_DPX(15)); + lv_style_set_height(&styles->meter_indic, LV_DPX(15)); #endif #if LV_USE_TABLE diff --git a/src/misc/lv_area.c b/src/misc/lv_area.c index 4ba14eec8..2ddddfe11 100644 --- a/src/misc/lv_area.c +++ b/src/misc/lv_area.c @@ -73,21 +73,6 @@ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h) area_p->y2 = area_p->y1 + h - 1; } -/** - * Set the position of an area (width and height will be kept) - * @param area_p pointer to an area - * @param x the new x coordinate of the area - * @param y the new y coordinate of the area - */ -void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y) -{ - lv_coord_t w = lv_area_get_width(area_p); - lv_coord_t h = lv_area_get_height(area_p); - area_p->x1 = x; - area_p->y1 = y; - lv_area_set_width(area_p, w); - lv_area_set_height(area_p, h); -} /** * Return with area of an area (x * y) @@ -103,6 +88,43 @@ uint32_t lv_area_get_size(const lv_area_t * area_p) return size; } +void lv_area_zoom(int32_t zoom, const lv_area_t * area_in, lv_area_t * area_out) +{ + if(zoom == 256) { + lv_area_copy(area_out, area_in); + return; + } else { + /* Zoom symmetrically + * extra_width_on_left = (((w * zoom) >> 8) - w) / 2 + * extra_width_on_left = (w * (zoom >> 8) - 1) / 2 + * extra_width_on_left = (w * (zoom - 256) >> 8) / 2 */ + lv_coord_t w = lv_area_get_width(area_in); + lv_coord_t h = lv_area_get_height(area_in); + lv_coord_t w_extra = (w * (zoom - 256) >> 8) / 2; + lv_coord_t h_extra = (h * (zoom - 256) >> 8) / 2; + + lv_area_copy(area_out, area_in); + lv_area_increase(area_out, w_extra, h_extra); + + } +} + +void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra) +{ + area->x1 -= w_extra; + area->x2 += w_extra; + area->y1 -= h_extra; + area->y2 += h_extra; +} + +void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs) +{ + area->x1 += x_ofs; + area->x2 += x_ofs; + area->y1 += y_ofs; + area->y2 += y_ofs; +} + /** * Get the common parts of two areas * @param res_p pointer to an area, the result will be stored here diff --git a/src/misc/lv_area.h b/src/misc/lv_area.h index 20ac488d5..393a8d9d9 100644 --- a/src/misc/lv_area.h +++ b/src/misc/lv_area.h @@ -158,14 +158,6 @@ void lv_area_set_width(lv_area_t * area_p, lv_coord_t w); */ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h); -/** - * Set the position of an area (width and height will be kept) - * @param area_p pointer to an area - * @param x the new x coordinate of the area - * @param y the new y coordinate of the area - */ -void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y); - /** * Return with area of an area (x * y) * @param area_p pointer to an area @@ -173,6 +165,12 @@ void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y); */ uint32_t lv_area_get_size(const lv_area_t * area_p); +void lv_area_zoom(int32_t zoom, const lv_area_t * area_in, lv_area_t * area_out); + +void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra); + +void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs); + /** * Get the common parts of two areas * @param res_p pointer to an area, the result will be stored her diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index cc3476347..35cf9857a 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -237,9 +237,6 @@ lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop) case LV_STYLE_TEXT_FONT: value.ptr = LV_FONT_DEFAULT; break; - case LV_STYLE_SIZE: - value.num = 5; - break; case LV_STYLE_MAX_WIDTH: case LV_STYLE_MAX_HEIGHT: value.num = LV_COORD_MAX; diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index d2bf25400..68b503730 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -114,10 +114,10 @@ typedef enum { /*Group 0*/ LV_STYLE_RADIUS = 1, LV_STYLE_CLIP_CORNER = 2, - LV_STYLE_TRANSFORM_WIDTH = 3 | LV_STYLE_PROP_EXT_DRAW, - LV_STYLE_TRANSFORM_HEIGHT = 4 | LV_STYLE_PROP_EXT_DRAW, - LV_STYLE_TRANSFORM_X = 5 | LV_STYLE_PROP_PARENT_LAYOUT_REFR, - LV_STYLE_TRANSFORM_Y = 6 | LV_STYLE_PROP_PARENT_LAYOUT_REFR, + LV_STYLE_TRANSFORM_WIDTH = 3 | LV_STYLE_PROP_LAYOUT_REFR, + LV_STYLE_TRANSFORM_HEIGHT = 4 | LV_STYLE_PROP_LAYOUT_REFR, + LV_STYLE_TRANSFORM_X = 5 | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR, + LV_STYLE_TRANSFORM_Y = 6 | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR, LV_STYLE_TRANSFORM_ZOOM = 7 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_TRANSFORM_ANGLE = 8 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_OPA = 9 | LV_STYLE_PROP_INHERIT, @@ -126,8 +126,7 @@ typedef enum { LV_STYLE_COLOR_FILTER_OPA = 11, LV_STYLE_ANIM_TIME = 12, LV_STYLE_TRANSITION = 13, - LV_STYLE_SIZE = 14, - LV_STYLE_BLEND_MODE = 15, + LV_STYLE_BLEND_MODE = 14, /*Group 1*/ LV_STYLE_PAD_TOP = 16 | LV_STYLE_PROP_LAYOUT_REFR, @@ -418,6 +417,11 @@ static inline void lv_style_set_pad_gap(lv_style_t * style, lv_coord_t value) { lv_style_set_pad_column(style, value); } +static inline void lv_style_set_size(lv_style_t * style, lv_coord_t value) { + lv_style_set_width(style, value); + lv_style_set_height(style, value); +} + /************************* * GLOBAL VARIABLES diff --git a/src/misc/lv_style_gen.h b/src/misc/lv_style_gen.h index 11cdb6823..6506a6560 100644 --- a/src/misc/lv_style_gen.h +++ b/src/misc/lv_style_gen.h @@ -102,14 +102,6 @@ static inline void lv_style_set_transition(lv_style_t * style, const lv_style_tr lv_style_set_prop(style, LV_STYLE_TRANSITION, v); } -static inline void lv_style_set_size(lv_style_t * style, lv_coord_t value) -{ - lv_style_value_t v = { - .num = (int32_t)value - }; - lv_style_set_prop(style, LV_STYLE_SIZE, v); -} - static inline void lv_style_set_blend_mode(lv_style_t * style, lv_blend_mode_t value) { lv_style_value_t v = { diff --git a/src/widgets/lv_bar.c b/src/widgets/lv_bar.c index 9c0d1a410..f89f1ae61 100644 --- a/src/widgets/lv_bar.c +++ b/src/widgets/lv_bar.c @@ -238,17 +238,8 @@ static void draw_indic(lv_event_t * e) const lv_area_t * clip_area = lv_event_get_param(e); - lv_area_t bar_coords; - lv_obj_get_coords(obj, &bar_coords); - - lv_coord_t transf_w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); - lv_coord_t transf_h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); - bar_coords.x1 -= transf_w; - bar_coords.x2 += transf_w; - bar_coords.y1 -= transf_h; - bar_coords.y2 += transf_h; - lv_coord_t barw = lv_area_get_width(&bar_coords); - lv_coord_t barh = lv_area_get_height(&bar_coords); + lv_coord_t barw = lv_obj_get_width(obj); + lv_coord_t barh = lv_obj_get_height(obj); int32_t range = bar->max_value - bar->min_value; bool hor = barw >= barh ? true : false; bool sym = false; @@ -261,7 +252,7 @@ static void draw_indic(lv_event_t * e) lv_coord_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); lv_coord_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); /*Respect padding and minimum width/height too*/ - lv_area_copy(&bar->indic_area, &bar_coords); + lv_area_copy(&bar->indic_area, &obj->coords); bar->indic_area.x1 += bg_left; bar->indic_area.x2 -= bg_right; bar->indic_area.y1 += bg_top; @@ -429,7 +420,7 @@ static void draw_indic(lv_event_t * e) /*Get the max possible indicator area. The gradient should be applied on this*/ lv_area_t mask_indic_max_area; - lv_area_copy(&mask_indic_max_area, &bar_coords); + lv_area_copy(&mask_indic_max_area, &obj->coords); mask_indic_max_area.x1 += bg_left; mask_indic_max_area.y1 += bg_top; mask_indic_max_area.x2 -= bg_right; diff --git a/src/widgets/lv_chart.c b/src/widgets/lv_chart.c index 2a9b1e5c8..3d046668c 100644 --- a/src/widgets/lv_chart.c +++ b/src/widgets/lv_chart.c @@ -739,18 +739,21 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) lv_draw_rect_dsc_init(&point_dsc_default); point_dsc_default.radius = LV_RADIUS_CIRCLE; - lv_coord_t point_size = lv_obj_get_style_size(obj, LV_PART_ITEMS); + lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; + lv_coord_t point_h = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; obj->state = LV_STATE_PRESSED; - lv_coord_t point_size_pr = lv_obj_get_style_size(obj, LV_PART_ITEMS); + lv_coord_t point_w_pr = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; + lv_coord_t point_h_pr = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; obj->state = state_ori; obj->skip_trans = 0; - lv_coord_t point_size_act; + lv_coord_t point_w_act; + lv_coord_t point_h_act; /*Do not bother with line ending is the point will over it*/ - if(point_size > line_dsc_default.width / 2) line_dsc_default.raw_end = 1; + if(LV_MIN(point_w, point_h) > line_dsc_default.width / 2) line_dsc_default.raw_end = 1; if(line_dsc_default.width == 1) line_dsc_default.raw_end = 1; /*If there are mire points than pixels draw only vertical lines*/ @@ -787,9 +790,10 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) p1.x = p2.x; p1.y = p2.y; - point_size_act = p_act == chart->pressed_point_id ? point_size_pr : point_size; + point_w_act = p_act == chart->pressed_point_id ? point_w_pr : point_w; + point_h_act = p_act == chart->pressed_point_id ? point_h_pr : point_h; - if(p1.x > clip_area->x2 + point_size_act + 1) break; + if(p1.x > clip_area->x2 + point_w_act + 1) break; p2.x = ((w * i) / (chart->point_cnt - 1)) + x_ofs; p_act = (start_point + i) % chart->point_cnt; @@ -798,7 +802,7 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) y_tmp = y_tmp / (chart->ymax[ser->y_axis] - chart->ymin[ser->y_axis]); p2.y = h - y_tmp + y_ofs; - if(p2.x < clip_area->x1 - point_size_act - 1) { + if(p2.x < clip_area->x1 - point_w_act - 1) { p_prev = p_act; continue; } @@ -825,10 +829,10 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) } } else { lv_area_t point_area; - point_area.x1 = p1.x - point_size_act; - point_area.x2 = p1.x + point_size_act; - point_area.y1 = p1.y - point_size_act; - point_area.y2 = p1.y + point_size_act; + point_area.x1 = p1.x - point_w_act; + point_area.x2 = p1.x + point_w_act; + point_area.y1 = p1.y - point_h_act; + point_area.y2 = p1.y + point_h_act; dsc.id = i - 1; dsc.p1 = ser->points[p_prev] != LV_CHART_POINT_NONE ? &p1 : NULL; @@ -842,7 +846,7 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) lv_draw_line(&p1, &p2, &series_mask, &line_dsc_default); } - if(point_size_act && ser->points[p_act] != LV_CHART_POINT_NONE) { + if(point_w_act && point_h_act && ser->points[p_act] != LV_CHART_POINT_NONE) { lv_draw_rect(&point_area, &series_mask, &point_dsc_default); } @@ -854,15 +858,16 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) } /*Draw the last point*/ - point_size_act = p_act == chart->pressed_point_id ? point_size_pr : point_size; - if(!crowded_mode && point_size_act && i == chart->point_cnt) { + point_w_act = p_act == chart->pressed_point_id ? point_w_pr : point_w; + point_h_act = p_act == chart->pressed_point_id ? point_h_pr : point_h; + if(!crowded_mode && point_w_act && point_h_act && i == chart->point_cnt) { if(ser->points[p_act] != LV_CHART_POINT_NONE) { lv_area_t point_area; - point_area.x1 = p2.x - point_size_act; - point_area.x2 = p2.x + point_size_act; - point_area.y1 = p2.y - point_size_act; - point_area.y2 = p2.y + point_size_act; + point_area.x1 = p2.x - point_w_act; + point_area.x2 = p2.x + point_w_act; + point_area.y1 = p2.y - point_h_act; + point_area.y2 = p2.y + point_h_act; dsc.id = i - 1; dsc.p1 = NULL; @@ -978,10 +983,8 @@ static void draw_cursors(lv_obj_t * obj, const lv_area_t * clip_area) lv_draw_line_dsc_t line_dsc_tmp; lv_draw_rect_dsc_t point_dsc_tmp; - lv_coord_t point_radius = lv_obj_get_style_size(obj, LV_PART_CURSOR); - - /*Do not bother with line ending is the point will over it*/ - if(point_radius > line_dsc_ori.width / 2) line_dsc_ori.raw_end = 1; + lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; + lv_coord_t point_h = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; lv_obj_draw_dsc_t dsc; lv_obj_draw_dsc_init(&dsc, clip_area); @@ -1025,13 +1028,13 @@ static void draw_cursors(lv_obj_t * obj, const lv_area_t * clip_area) lv_event_send(obj, LV_EVENT_DRAW_PART_END, &dsc); } - if(point_radius) { + if(point_w && point_h) { lv_area_t point_area; - point_area.x1 = cx - point_radius; - point_area.x2 = cx + point_radius; - point_area.y1 = cy - point_radius; - point_area.y2 = cy + point_radius; + point_area.x1 = cx - point_w; + point_area.x2 = cx + point_w; + point_area.y1 = cy - point_h; + point_area.y2 = cy + point_h; dsc.draw_area = &point_area; dsc.p1 = NULL; @@ -1281,22 +1284,23 @@ static void invalidate_point(lv_obj_t * obj, uint16_t i) if(chart->type == LV_CHART_TYPE_LINE) { lv_coord_t x_ofs = obj->coords.x1 + lv_obj_get_style_pad_left(obj, LV_PART_MAIN) - scroll_left; lv_coord_t line_width = lv_obj_get_style_line_width(obj, LV_PART_ITEMS); - lv_coord_t point_radius = lv_obj_get_style_size(obj, LV_PART_ITEMS); + lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_ITEMS) / 2 + 1; + lv_coord_t point_h = lv_obj_get_style_height(obj, LV_PART_ITEMS) / 2 + 1; lv_area_t coords; lv_area_copy(&coords, &obj->coords); - coords.y1 -= line_width + point_radius; - coords.y2 += line_width + point_radius; + coords.y1 -= LV_MAX(line_width, point_h); + coords.y2 += LV_MAX(line_width, point_h); if(i < chart->point_cnt - 1) { - coords.x1 = ((w * i) / (chart->point_cnt - 1)) + x_ofs - line_width - point_radius; - coords.x2 = ((w * (i + 1)) / (chart->point_cnt - 1)) + x_ofs + line_width + point_radius; + coords.x1 = ((w * i) / (chart->point_cnt - 1)) + x_ofs - LV_MAX(line_width, point_w); + coords.x2 = ((w * (i + 1)) / (chart->point_cnt - 1)) + x_ofs + LV_MAX(line_width, point_w); lv_obj_invalidate_area(obj, &coords); } if(i > 0) { - coords.x1 = ((w * (i - 1)) / (chart->point_cnt - 1)) + x_ofs - line_width - point_radius; - coords.x2 = ((w * i) / (chart->point_cnt - 1)) + x_ofs + line_width + point_radius; + coords.x1 = ((w * (i - 1)) / (chart->point_cnt - 1)) + x_ofs - LV_MAX(line_width, point_w); + coords.x2 = ((w * i) / (chart->point_cnt - 1)) + x_ofs + LV_MAX(line_width, point_w); lv_obj_invalidate_area(obj, &coords); } } diff --git a/src/widgets/lv_meter.c b/src/widgets/lv_meter.c index e1989937f..10f3a255a 100644 --- a/src/widgets/lv_meter.c +++ b/src/widgets/lv_meter.c @@ -302,12 +302,13 @@ static void lv_meter_event(lv_event_t * e) lv_draw_rect_dsc_t mid_dsc; lv_draw_rect_dsc_init(&mid_dsc); lv_obj_init_draw_rect_dsc(obj, LV_PART_INDICATOR, &mid_dsc); - lv_coord_t size = lv_obj_get_style_size(obj, LV_PART_INDICATOR) / 2; + lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR) / 2; + lv_coord_t point_h = lv_obj_get_style_height(obj, LV_PART_INDICATOR) / 2; lv_area_t nm_cord; - nm_cord.x1 = scale_center.x - size; - nm_cord.y1 = scale_center.y - size; - nm_cord.x2 = scale_center.x + size; - nm_cord.y2 = scale_center.y + size; + nm_cord.x1 = scale_center.x - point_w; + nm_cord.y1 = scale_center.y - point_w; + nm_cord.x2 = scale_center.x + point_h; + nm_cord.y2 = scale_center.y + point_h; lv_draw_rect(&nm_cord, clip_area, &mid_dsc); } } From 88979ccff9397adf23b1e9914ebabb3566d41eb0 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 17 Apr 2021 20:46:41 +0200 Subject: [PATCH 007/152] fix(obj) fix infinit loop in object repositioning --- src/core/lv_obj_pos.c | 80 +++++++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 99ca8b5ef..11dcac65f 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -96,45 +96,59 @@ void lv_obj_refr_size(lv_obj_t * obj) if(parent == NULL) return; lv_coord_t w; - lv_coord_t h; - if(obj->w_layout) w = lv_obj_get_width(obj); - else w = lv_obj_get_style_width(obj, LV_PART_MAIN); - if(obj->h_layout) h = lv_obj_get_height(obj); - else h = lv_obj_get_style_height(obj, LV_PART_MAIN); - - /*Calculate the required auto sizes*/ - bool w_content = w == LV_SIZE_CONTENT ? true : false; - bool h_content = h == LV_SIZE_CONTENT ? true : false; - - /*Be sure the object is not scrolled when it has auto size*/ lv_coord_t sl_ori = lv_obj_get_scroll_left(obj); - if(w_content) lv_obj_scroll_to_x(obj, 0, LV_ANIM_OFF); + bool w_content = false; + if(obj->w_layout) { + w = lv_obj_get_width(obj); + } else { + w = lv_obj_get_style_width(obj, LV_PART_MAIN); + w_content = w == LV_SIZE_CONTENT ? true : false; + + /*Be sure the object is not scrolled when it has auto size*/ + if(w_content) { + lv_obj_scroll_to_x(obj, 0, LV_ANIM_OFF); + calc_auto_size(obj, &w, NULL); + } + + /*Calculate the sizes in percentage*/ + bool pct_w = LV_COORD_IS_PCT(w) ? true : false; + + lv_coord_t parent_w = lv_obj_get_width_fit(parent); + if(pct_w) w = (LV_COORD_GET_PCT(w) * parent_w) / 100; + + w += lv_obj_get_style_transform_width(obj, LV_PART_MAIN); + + lv_coord_t minw = lv_obj_get_style_min_width(obj, LV_PART_MAIN); + lv_coord_t maxw = lv_obj_get_style_max_width(obj, LV_PART_MAIN); + w = lv_clamp_width(w, minw, maxw, parent_w); + } + + lv_coord_t h; lv_coord_t st_ori = lv_obj_get_scroll_top(obj); - if(h_content) lv_obj_scroll_to_y(obj, 0, LV_ANIM_OFF); + bool h_content = false; + if(obj->h_layout) { + h = lv_obj_get_height(obj); + } else { + h = lv_obj_get_style_height(obj, LV_PART_MAIN); + h_content = h == LV_SIZE_CONTENT ? true : false; - if(w_content && h_content) calc_auto_size(obj, &w, &h); - else if(w_content) calc_auto_size(obj, &w, NULL); - else if(h_content) calc_auto_size(obj, NULL, &h); + /*Be sure the object is not scrolled when it has auto size*/ + if(h_content) { + lv_obj_scroll_to_y(obj, 0, LV_ANIM_OFF); + calc_auto_size(obj, NULL, &h); + } - /*Calculate the required auto sizes*/ - bool pct_w = LV_COORD_IS_PCT(w) ? true : false; - bool pct_h = LV_COORD_IS_PCT(h) ? true : false; + /*Calculate the sizes in percentage*/ + bool pct_h = LV_COORD_IS_PCT(h) ? true : false; + lv_coord_t parent_h = lv_obj_get_height_fit(parent); + if(pct_h) h = (LV_COORD_GET_PCT(h) * parent_h) / 100; - lv_coord_t parent_w = lv_obj_get_width_fit(parent); - lv_coord_t parent_h = lv_obj_get_height_fit(parent); - if(pct_w) w = (LV_COORD_GET_PCT(w) * parent_w) / 100; - if(pct_h) h = (LV_COORD_GET_PCT(h) * parent_h) / 100; + h += lv_obj_get_style_transform_height(obj, LV_PART_MAIN); - w += lv_obj_get_style_transform_width(obj, LV_PART_MAIN); - h += lv_obj_get_style_transform_height(obj, LV_PART_MAIN); - - lv_coord_t minw = lv_obj_get_style_min_width(obj, LV_PART_MAIN); - lv_coord_t maxw = lv_obj_get_style_max_width(obj, LV_PART_MAIN); - w = lv_clamp_width(w, minw, maxw, parent_w); - - lv_coord_t minh = lv_obj_get_style_min_height(obj, LV_PART_MAIN); - lv_coord_t maxh = lv_obj_get_style_max_height(obj, LV_PART_MAIN); - h = lv_clamp_width(h, minh, maxh, parent_h); + lv_coord_t minh = lv_obj_get_style_min_height(obj, LV_PART_MAIN); + lv_coord_t maxh = lv_obj_get_style_max_height(obj, LV_PART_MAIN); + h = lv_clamp_width(h, minh, maxh, parent_h); + } /*calc_auto_size set the scroll x/y to 0 so revert the original value*/ if(w_content || h_content) { From da367337c9c4baaef867b3649e32613d18deb0d3 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 17 Apr 2021 20:50:10 +0200 Subject: [PATCH 008/152] feat(anim) remove lv_anim_path_t and use a callback directly lv_anim_path_t was required for the MicroPython binding becase the callback couldn't attached dircetly to the styles However, in v8, path_cb is used in the style transitons which has user_data and that user data is passed to the transition animation. Hence the path_cb sees the the same user data during the animaton as when it was registered to the transiton. --- examples/widgets/btn/lv_example_btn_2.c | 2 +- examples/widgets/btn/lv_example_btn_3.c | 14 +---- examples/widgets/imgbtn/lv_example_imgbtn_1.c | 2 +- src/core/lv_obj.c | 19 +++--- src/core/lv_obj_scroll.c | 9 +-- src/core/lv_obj_style.c | 24 ++++---- src/core/lv_obj_style.h | 19 ++++-- src/extra/themes/default/lv_theme_default.c | 9 ++- src/extra/widgets/spinner/lv_spinner.c | 6 +- src/misc/lv_anim.c | 58 +++---------------- src/misc/lv_anim.h | 58 +++++-------------- src/misc/lv_style.c | 4 +- src/misc/lv_style.h | 23 ++++---- src/widgets/lv_bar.c | 12 ++-- src/widgets/lv_roller.c | 6 +- src/widgets/lv_slider.c | 11 ++-- src/widgets/lv_textarea.c | 24 ++------ 17 files changed, 98 insertions(+), 202 deletions(-) diff --git a/examples/widgets/btn/lv_example_btn_2.c b/examples/widgets/btn/lv_example_btn_2.c index eeece57d3..179857efd 100644 --- a/examples/widgets/btn/lv_example_btn_2.c +++ b/examples/widgets/btn/lv_example_btn_2.c @@ -9,7 +9,7 @@ void lv_example_btn_2(void) { static lv_style_transition_dsc_t trans; static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, 0}; - lv_style_transition_dsc_init(&trans, props, &lv_anim_path_def, 300, 0); + lv_style_transition_dsc_init(&trans, props, lv_anim_path_linear, 300, 0); static lv_style_t style; lv_style_init(&style); diff --git a/examples/widgets/btn/lv_example_btn_3.c b/examples/widgets/btn/lv_example_btn_3.c index 3c4485cb3..8b28b657b 100644 --- a/examples/widgets/btn/lv_example_btn_3.c +++ b/examples/widgets/btn/lv_example_btn_3.c @@ -12,25 +12,15 @@ void lv_example_btn_3(void) LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, LV_STYLE_TEXT_LETTER_SPACE, 0 }; - /*Define animation paths*/ - static lv_anim_path_t path_ease_in_out; - lv_anim_path_init(&path_ease_in_out); - lv_anim_path_set_cb(&path_ease_in_out, lv_anim_path_ease_in_out); - - static lv_anim_path_t path_overshoot; - lv_anim_path_init(&path_overshoot); - lv_anim_path_set_cb(&path_overshoot, lv_anim_path_overshoot); - - /*Transition descriptor when going back to the default state. *Add some delay to be sure the press transition is visible even if the press was very short*/ static lv_style_transition_dsc_t transition_dsc_def; - lv_style_transition_dsc_init(&transition_dsc_def, props, &path_overshoot, 250, 100); + lv_style_transition_dsc_init(&transition_dsc_def, props, lv_anim_path_overshoot, 250, 100); /*Transition descriptor when going to pressed state. *No delay, go to presses state immediately*/ static lv_style_transition_dsc_t transition_dsc_pr; - lv_style_transition_dsc_init(&transition_dsc_pr, props, &path_ease_in_out, 250, 0); + lv_style_transition_dsc_init(&transition_dsc_pr, props, lv_anim_path_ease_in_out, 250, 0); /*Add only the new transition to he default state*/ static lv_style_t style_def; diff --git a/examples/widgets/imgbtn/lv_example_imgbtn_1.c b/examples/widgets/imgbtn/lv_example_imgbtn_1.c index 9ac3358d0..ef51b3f5c 100644 --- a/examples/widgets/imgbtn/lv_example_imgbtn_1.c +++ b/examples/widgets/imgbtn/lv_example_imgbtn_1.c @@ -10,7 +10,7 @@ void lv_example_imgbtn_1(void) /*Create a transition animation on width transformation and recolor.*/ static lv_style_prop_t tr_prop[] = {LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_IMG_RECOLOR_OPA, 0}; static lv_style_transition_dsc_t tr; - lv_style_transition_dsc_init(&tr, tr_prop, &lv_anim_path_def, 200, 0); + lv_style_transition_dsc_init(&tr, tr_prop, lv_anim_path_linear, 200, 0); static lv_style_t style_def; lv_style_init(&style_def); diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index 516caa1a5..6f9fddc3d 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -48,14 +48,6 @@ typedef struct _lv_event_temp_data { struct _lv_event_temp_data * prev; } lv_event_temp_data_t; -typedef struct { - uint16_t time; - uint16_t delay; - lv_style_selector_t selector; - lv_style_prop_t prop; - const lv_anim_path_t * path; -}trans_set_t; - typedef struct _lv_event_dsc_t{ lv_event_cb_t cb; void * user_data; @@ -953,8 +945,8 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) /*If there is no difference in styles there is nothing else to do*/ if(cmp_res == _LV_STYLE_STATE_CMP_SAME) return; - trans_set_t * ts = lv_mem_buf_get(sizeof(trans_set_t) * STYLE_TRANSITION_MAX); - lv_memset_00(ts, sizeof(trans_set_t) * STYLE_TRANSITION_MAX); + _lv_obj_style_transition_dsc_t * ts = lv_mem_buf_get(sizeof(_lv_obj_style_transition_dsc_t) * STYLE_TRANSITION_MAX); + lv_memset_00(ts, sizeof(_lv_obj_style_transition_dsc_t) * STYLE_TRANSITION_MAX); uint32_t tsi = 0; uint32_t i; for(i = 0; i < obj->style_cnt && tsi < STYLE_TRANSITION_MAX; i++) { @@ -980,8 +972,11 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) if(t == tsi) { ts[tsi].time = tr->time; ts[tsi].delay = tr->delay; - ts[tsi].path = tr->path; + ts[tsi].path_cb = tr->path_cb; ts[tsi].prop = tr->props[j]; +#if LV_USE_USER_DATA + ts[tsi].user_data = tr->user_data; +#endif ts[tsi].selector = obj_style->selector; tsi++; } @@ -990,7 +985,7 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) for(i = 0;i < tsi; i++) { lv_part_t part_act = lv_obj_style_get_selector_part(ts[i].selector); - _lv_obj_style_create_transition(obj, ts[i].prop, part_act, prev_state, new_state, ts[i].time, ts[i].delay, ts[i].path); + _lv_obj_style_create_transition(obj, part_act, prev_state, new_state, &ts[i]); } lv_mem_buf_release(ts); diff --git a/src/core/lv_obj_scroll.c b/src/core/lv_obj_scroll.c index c60da7da5..08eceb23a 100644 --- a/src/core/lv_obj_scroll.c +++ b/src/core/lv_obj_scroll.c @@ -248,10 +248,6 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable lv_anim_set_var(&a, obj); lv_anim_set_ready_cb(&a, scroll_anim_ready_cb); - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_ease_out); - if(x) { lv_res_t res; res = lv_event_send(obj, LV_EVENT_SCROLL_BEGIN, NULL); @@ -264,7 +260,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable lv_coord_t sx = lv_obj_get_scroll_x(obj); lv_anim_set_values(&a, -sx, -sx + x); lv_anim_set_exec_cb(&a, scroll_x_anim); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_ease_out); lv_anim_start(&a); } @@ -280,7 +276,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable lv_coord_t sy = lv_obj_get_scroll_y(obj); lv_anim_set_values(&a, -sy, -sy + y); lv_anim_set_exec_cb(&a, scroll_y_anim); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_ease_out); lv_anim_start(&a); } } else { @@ -517,7 +513,6 @@ void lv_obj_scrollbar_invalidate(lv_obj_t * obj) if(lv_area_get_size(&hor_area) <= 0 && lv_area_get_size(&ver_area) <= 0) return; - printf("h: %d\n", hor_area.x2); if(lv_area_get_size(&hor_area) > 0) lv_obj_invalidate_area(obj, &hor_area); if(lv_area_get_size(&ver_area) > 0) lv_obj_invalidate_area(obj, &ver_area); } diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index 0e81ea6de..65678cf72 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -284,28 +284,27 @@ bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_sty return lv_style_remove_prop(obj->styles[i].style, prop); } -void _lv_obj_style_create_transition(lv_obj_t * obj, lv_style_prop_t prop, lv_part_t part, lv_state_t prev_state, - lv_state_t new_state, uint32_t time, uint32_t delay, const lv_anim_path_t * path) +void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state, const _lv_obj_style_transition_dsc_t * tr_dsc) { trans_t * tr; /*Get the previous and current values*/ obj->skip_trans = 1; obj->state = prev_state; - lv_style_value_t v1 = lv_obj_get_style_prop(obj, part, prop); + lv_style_value_t v1 = lv_obj_get_style_prop(obj, part, tr_dsc->prop); obj->state = new_state; - lv_style_value_t v2 = lv_obj_get_style_prop(obj, part, prop); + lv_style_value_t v2 = lv_obj_get_style_prop(obj, part, tr_dsc->prop); obj->skip_trans = 0; if(v1.ptr == v2.ptr && v1.num == v2.num && v1.color.full == v2.color.full) return; obj->state = prev_state; - v1 = lv_obj_get_style_prop(obj, part, prop); + v1 = lv_obj_get_style_prop(obj, part, tr_dsc->prop); obj->state = new_state; lv_obj_style_t * style_trans = get_trans_style(obj, part); - lv_style_set_prop(style_trans->style, prop, v1); /*Be sure `trans_style` has a valid value*/ + lv_style_set_prop(style_trans->style, tr_dsc->prop, v1); /*Be sure `trans_style` has a valid value*/ - if(prop == LV_STYLE_RADIUS) { + if(tr_dsc->prop == LV_STYLE_RADIUS) { if(v1.num == LV_RADIUS_CIRCLE || v2.num == LV_RADIUS_CIRCLE) { lv_coord_t whalf = lv_obj_get_width(obj) / 2; lv_coord_t hhalf = lv_obj_get_width(obj) / 2; @@ -322,7 +321,7 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_style_prop_t prop, lv_pa if(tr) { tr->obj = obj; - tr->prop = prop; + tr->prop = tr_dsc->prop; tr->selector = part; lv_anim_t a; @@ -332,10 +331,11 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_style_prop_t prop, lv_pa lv_anim_set_start_cb(&a, trans_anim_start_cb); lv_anim_set_ready_cb(&a, trans_anim_ready_cb); lv_anim_set_values(&a, 0x00, 0xFF); - lv_anim_set_time(&a, time); - lv_anim_set_delay(&a, delay); - lv_anim_set_path(&a, path); - a.early_apply = 0; + lv_anim_set_time(&a, tr_dsc->time); + lv_anim_set_delay(&a, tr_dsc->delay); + lv_anim_set_path_cb(&a, tr_dsc->path_cb); + lv_anim_set_early_apply(&a, false); + a.user_data = tr_dsc->user_data; lv_anim_start(&a); } } diff --git a/src/core/lv_obj_style.h b/src/core/lv_obj_style.h index 2245810fd..693cd3d4e 100644 --- a/src/core/lv_obj_style.h +++ b/src/core/lv_obj_style.h @@ -42,6 +42,17 @@ typedef struct { uint32_t is_trans :1; }lv_obj_style_t; +typedef struct { + uint16_t time; + uint16_t delay; + lv_style_selector_t selector; + lv_style_prop_t prop; + lv_anim_path_cb_t path_cb; +#if LV_USE_USER_DATA + void * user_data; +#endif +}_lv_obj_style_transition_dsc_t; + /********************** * GLOBAL PROTOTYPES **********************/ @@ -144,16 +155,12 @@ bool lv_obj_remove_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop /** * Used internally to create a style tarnsition * @param obj - * @param prop * @param part * @param prev_state * @param new_state - * @param time - * @param delay - * @param path + * @param tr */ -void _lv_obj_style_create_transition(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_part_t part, lv_state_t prev_state, - lv_state_t new_state, uint32_t time, uint32_t delay, const lv_anim_path_t * path); +void _lv_obj_style_create_transition(struct _lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state, const _lv_obj_style_transition_dsc_t * tr); /** * Used internally to compare the appearance of an object in 2 states diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index 070d65873..0201027d6 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -208,10 +208,10 @@ static void style_init(void) theme.color_secondary = color_secondary_accent; static lv_style_transition_dsc_t trans_delayed; - lv_style_transition_dsc_init(&trans_delayed, trans_props, &lv_anim_path_def, TRANSITION_TIME, 70); + lv_style_transition_dsc_init(&trans_delayed, trans_props, lv_anim_path_linear, TRANSITION_TIME, 70); static lv_style_transition_dsc_t trans_normal; - lv_style_transition_dsc_init(&trans_normal, trans_props, &lv_anim_path_def, TRANSITION_TIME, 0); + lv_style_transition_dsc_init(&trans_normal, trans_props, lv_anim_path_linear, TRANSITION_TIME, 0); style_init_reset(&styles->transition_delayed); lv_style_set_transition(&styles->transition_delayed, &trans_delayed); /*Go back to default state with delay*/ @@ -363,8 +363,7 @@ static void style_init(void) #if LV_THEME_DEFAULT_GROW style_init_reset(&styles->grow); - lv_style_set_transform_width(&styles->grow, 20); - lv_style_set_transform_height(&styles->grow, 20); + lv_style_set_transform_zoom(&styles->grow, 400); #endif style_init_reset(&styles->knob); @@ -424,7 +423,7 @@ static void style_init(void) style_init_reset(&styles->chart_series); lv_style_set_line_width(&styles->chart_series, LV_DPX(3)); lv_style_set_radius(&styles->chart_series, LV_DPX(3)); - lv_style_set_size(&styles->chart_series, LV_DPX(4)); + lv_style_set_size(&styles->chart_series, LV_DPX(8)); lv_style_set_pad_column(&styles->chart_series, LV_DPX(2)); style_init_reset(&styles->chart_ticks); diff --git a/src/extra/widgets/spinner/lv_spinner.c b/src/extra/widgets/spinner/lv_spinner.c index 36c6c1367..972575ac9 100644 --- a/src/extra/widgets/spinner/lv_spinner.c +++ b/src/extra/widgets/spinner/lv_spinner.c @@ -49,10 +49,6 @@ lv_obj_t * lv_spinner_create(lv_obj_t * parent, uint32_t time, uint32_t arc_leng lv_obj_remove_style(spinner, NULL, LV_PART_KNOB | LV_STATE_ANY); - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_ease_in_out); - lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, spinner); @@ -62,7 +58,7 @@ lv_obj_t * lv_spinner_create(lv_obj_t * parent, uint32_t time, uint32_t arc_leng lv_anim_set_values(&a, arc_length, 360 + arc_length); lv_anim_start(&a); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_ease_in_out); lv_anim_set_values(&a, 0, 360); lv_anim_set_exec_cb(&a, arc_anim_start_angle); lv_anim_start(&a); diff --git a/src/misc/lv_anim.c b/src/misc/lv_anim.c index 6aa223eaa..0eddc0bb8 100644 --- a/src/misc/lv_anim.c +++ b/src/misc/lv_anim.c @@ -41,7 +41,6 @@ static uint32_t last_timer_run; static bool anim_list_changed; static bool anim_run_round; static lv_timer_t * _lv_anim_tmr; -const lv_anim_path_t lv_anim_path_def = {.cb = lv_anim_path_linear}; /********************** * MACROS @@ -82,8 +81,8 @@ void lv_anim_init(lv_anim_t * a) a->time = 500; a->start_value = 0; a->end_value = 100; - lv_memcpy_small(&a->path, &lv_anim_path_def, sizeof(lv_anim_path_cb_t)); a->repeat_cnt = 1; + a->path_cb = lv_anim_path_linear; a->early_apply = 1; } /** @@ -130,27 +129,6 @@ void lv_anim_start(lv_anim_t * a) TRACE_ANIM("finished"); } -/** - * Initialize an animation path - * @param path pointer to path - */ -void lv_anim_path_init(lv_anim_path_t * path) -{ - lv_memset_00(path, sizeof(lv_anim_path_t)); -} - - -/** - * Set the path (curve) of the animation. - * @param a pointer to an initialized `lv_anim_t` variable - * @param path_cb a function the get the current value of the animation. - * The built in functions starts with `lv_anim_path_...` - */ -void lv_anim_set_path(lv_anim_t * a, const lv_anim_path_t * path) -{ - lv_memcpy_small(&a->path, path, sizeof(lv_anim_path_t)); -} - /** * Delete an animation of a variable with a given animator function * @param var pointer to variable @@ -258,10 +236,8 @@ void lv_anim_refr_now(void) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_linear(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_linear(const lv_anim_t * a) { - LV_UNUSED(path); - /*Calculate the current step*/ int32_t step = lv_map(a->act_time, 0, a->time, 0, LV_ANIM_RESOLUTION); @@ -280,12 +256,9 @@ int32_t lv_anim_path_linear(const lv_anim_path_t * path, const lv_anim_t * a) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_ease_in(const lv_anim_t * a) { - LV_UNUSED(path); - /*Calculate the current step*/ - uint32_t t = lv_map(a->act_time, 0, a->time, 0, 1024); int32_t step = lv_bezier3(t, 0, 50, 100, 1024); @@ -302,10 +275,8 @@ int32_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_t * a) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_ease_out(const lv_anim_t * a) { - LV_UNUSED(path); - /*Calculate the current step*/ uint32_t t = lv_map(a->act_time, 0, a->time, 0, 1024); int32_t step = lv_bezier3(t, 0, 900, 950, 1024); @@ -323,10 +294,8 @@ int32_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim_t * a) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_ease_in_out(const lv_anim_t * a) { - LV_UNUSED(path); - /*Calculate the current step*/ uint32_t t = lv_map(a->act_time, 0, a->time, 0, 1024); int32_t step = lv_bezier3(t, 0, 50, 952, 1024); @@ -344,12 +313,9 @@ int32_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_anim_t * * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_overshoot(const lv_anim_t * a) { - LV_UNUSED(path); - /*Calculate the current step*/ - uint32_t t = lv_map(a->act_time, 0, a->time, 0, 1024); int32_t step = lv_bezier3(t, 0, 1000, 1300, 1024); @@ -366,12 +332,9 @@ int32_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_anim_t * a) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_bounce(const lv_anim_t * a) { - LV_UNUSED(path); - /*Calculate the current step*/ - uint32_t t = lv_map(a->act_time, 0, a->time, 0, 1024); int32_t diff = (a->end_value - a->start_value); @@ -425,10 +388,8 @@ int32_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t * a) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_step(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_step(const lv_anim_t * a) { - LV_UNUSED(path); - if(a->act_time >= a->time) return a->end_value; else @@ -479,8 +440,7 @@ static void anim_timer(lv_timer_t * param) if(a->act_time > a->time) a->act_time = a->time; int32_t new_value; - if(a->path.cb) new_value = a->path.cb(&a->path, a); - else new_value = lv_anim_path_linear(&a->path, a); + new_value = a->path_cb(a); if(new_value != a->current_value) { a->current_value = new_value; diff --git a/src/misc/lv_anim.h b/src/misc/lv_anim.h index d4e6fb7e8..6ea049320 100644 --- a/src/misc/lv_anim.h +++ b/src/misc/lv_anim.h @@ -38,12 +38,7 @@ typedef enum { struct _lv_anim_t; struct _lv_anim_path_t; /** Get the current value during an animation*/ -typedef int32_t (*lv_anim_path_cb_t)(const struct _lv_anim_path_t *, const struct _lv_anim_t *); - -typedef struct _lv_anim_path_t { - lv_anim_path_cb_t cb; - void * user_data; -} lv_anim_path_t; +typedef int32_t (*lv_anim_path_cb_t)(const struct _lv_anim_t *); /** Generic prototype of "animator" functions. * First parameter is the variable to animate. @@ -76,7 +71,7 @@ typedef struct _lv_anim_t { #if LV_USE_USER_DATA void * user_data; /**< Custom user data*/ #endif - lv_anim_path_t path; /**< Describe the path (curve) of animations*/ + lv_anim_path_cb_t path_cb; /**< Describe the path (curve) of animations*/ int32_t start_value; /**< Start value*/ int32_t current_value; /**< Current value*/ int32_t end_value; /**< End value*/ @@ -186,10 +181,12 @@ static inline void lv_anim_set_custom_exec_cb(lv_anim_t * a, lv_anim_custom_exec /** * Set the path (curve) of the animation. * @param a pointer to an initialized `lv_anim_t` variable - * @param path a function the get the current value of the animation. - * The built in functions starts with `lv_anim_path_...` + * @param path_cb a function the get the current value of the animation. */ -void lv_anim_set_path(lv_anim_t * a, const lv_anim_path_t * path); +static inline void lv_anim_set_path_cb(lv_anim_t * a, lv_anim_path_cb_t path_cb) +{ + a->path_cb = path_cb; +} /** * Set a function call when the animation really starts (considering `delay`) @@ -278,32 +275,6 @@ static inline void lv_anim_set_early_apply(lv_anim_t * a, bool en) */ void lv_anim_start(lv_anim_t * a); -/** - * Initialize an animation path - * @param path pointer to path - */ -void lv_anim_path_init(lv_anim_path_t * path); - -/** - * Set a callback for a path - * @param path pointer to an initialized path - * @param cb the callback - */ -static inline void lv_anim_path_set_cb(lv_anim_path_t * path, lv_anim_path_cb_t cb) -{ - path->cb = cb; -} - -/** - * Set a user data for a path - * @param path pointer to an initialized path - * @param user_data pointer to the user data - */ -static inline void lv_anim_path_set_user_data(lv_anim_path_t * path, void * user_data) -{ - path->user_data = user_data; -} - /** * Get a delay before starting the animation * @param a pointer to an initialized `lv_anim_t` variable @@ -381,42 +352,42 @@ void lv_anim_refr_now(void); * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_linear(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_linear(const lv_anim_t * a); /** * Calculate the current value of an animation slowing down the start phase * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_ease_in(const lv_anim_t * a); /** * Calculate the current value of an animation slowing down the end phase * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_ease_out(const lv_anim_t * a); /** * Calculate the current value of an animation applying an "S" characteristic (cosine) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_ease_in_out(const lv_anim_t * a); /** * Calculate the current value of an animation with overshoot at the end * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_overshoot(const lv_anim_t * a); /** * Calculate the current value of an animation with 3 bounces * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_bounce(const lv_anim_t * a); /** * Calculate the current value of an animation applying step characteristic. @@ -424,12 +395,11 @@ int32_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t * a); * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_step(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_step(const lv_anim_t * a); /********************** * GLOBAL VARIABLES **********************/ -extern const lv_anim_path_t lv_anim_path_def; /********************** * MACROS diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index 35cf9857a..c4d779b91 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -198,11 +198,11 @@ lv_res_t lv_style_get_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_va return lv_style_get_prop_inlined(style, prop, value); } -void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, const lv_anim_path_t * path, uint32_t time, uint32_t delay) +void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay) { lv_memset_00(tr, sizeof(lv_style_transition_dsc_t)); tr->props = props; - tr->path = path == NULL ? &lv_anim_path_def : path; + tr->path_cb = path_cb == NULL ? lv_anim_path_linear : path_cb; tr->time = time; tr->delay = delay; } diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index 68b503730..ac335cccd 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -227,17 +227,14 @@ typedef enum { */ typedef struct _lv_style_transiton_t { const lv_style_prop_t * props; /**< An array with the properties to animate.*/ - const lv_anim_path_t * path; /**< A path for the animation.*/ +#if LV_USE_USER_DATA + void * user_data; /**< A custom user data that will be passed to the animation's user_data */ +#endif + lv_anim_path_cb_t path_cb; /**< A path for the animation.*/ uint32_t time; /**< Duration of the transition in [ms]*/ uint32_t delay; /**< Delay before the transition in [ms]*/ }lv_style_transition_dsc_t; -#if LV_USE_ASSERT_STYLE -# define _LV_STYLE_SENTINEL uint32_t sentinel; -#else -# define _LV_STYLE_SENTINEL -#endif - /** * Descriptor of a style (a collection of properties and values). */ @@ -358,18 +355,18 @@ static inline lv_res_t lv_style_get_prop_inlined(lv_style_t * style, lv_style_pr /** * Initialize a transition descriptor. - * @param tr pointer to a transition descriptor to initialize - * @param props an array with the properties to transition. The last element must be zero. - * @param path and animation path. If `NULL` a default liner path will be used. - * @param time duration of the transition in [ms] - * @param delay delay before the transition in [ms] + * @param tr pointer to a transition descriptor to initialize + * @param props an array with the properties to transition. The last element must be zero. + * @param path_cb and animation path (ease) callback. If `NULL` liner path will be used. + * @param time duration of the transition in [ms] + * @param delay delay before the transition in [ms] * @example * const static lv_style_prop_t trans_props[] = { LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR, 0 }; * static lv_style_transition_dsc_t trans1; * lv_style_transition_dsc_init(&trans1, trans_props, NULL, 300, 0); * @note For performance reasons there are no sanity check on `style` */ -void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, const lv_anim_path_t * path, uint32_t time, uint32_t delay); +void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay); /** * Get the default value of a property diff --git a/src/widgets/lv_bar.c b/src/widgets/lv_bar.c index f89f1ae61..f7638efc4 100644 --- a/src/widgets/lv_bar.c +++ b/src/widgets/lv_bar.c @@ -238,8 +238,12 @@ static void draw_indic(lv_event_t * e) const lv_area_t * clip_area = lv_event_get_param(e); - lv_coord_t barw = lv_obj_get_width(obj); - lv_coord_t barh = lv_obj_get_height(obj); + lv_area_t bar_coords; + lv_area_zoom(lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN), &obj->coords, &bar_coords); + lv_obj_get_coords(obj, &bar_coords); + + lv_coord_t barw = lv_area_get_width(&bar_coords); + lv_coord_t barh = lv_area_get_height(&bar_coords); int32_t range = bar->max_value - bar->min_value; bool hor = barw >= barh ? true : false; bool sym = false; @@ -252,7 +256,7 @@ static void draw_indic(lv_event_t * e) lv_coord_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); lv_coord_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); /*Respect padding and minimum width/height too*/ - lv_area_copy(&bar->indic_area, &obj->coords); + lv_area_copy(&bar->indic_area, &bar_coords); bar->indic_area.x1 += bg_left; bar->indic_area.x2 -= bg_right; bar->indic_area.y1 += bg_top; @@ -420,7 +424,7 @@ static void draw_indic(lv_event_t * e) /*Get the max possible indicator area. The gradient should be applied on this*/ lv_area_t mask_indic_max_area; - lv_area_copy(&mask_indic_max_area, &obj->coords); + lv_area_copy(&mask_indic_max_area, &bar_coords); mask_indic_max_area.x1 += bg_left; mask_indic_max_area.y1 += bg_top; mask_indic_max_area.x2 -= bg_right; diff --git a/src/widgets/lv_roller.c b/src/widgets/lv_roller.c index a1a55f9b2..8cb3d1eb9 100644 --- a/src/widgets/lv_roller.c +++ b/src/widgets/lv_roller.c @@ -590,7 +590,6 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) inf_normalize(obj); } - int32_t id = roller->sel_opt_id; lv_coord_t sel_y1 = id * (font_h + line_space); lv_coord_t mid_y1 = h / 2 - font_h / 2; @@ -602,9 +601,6 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) lv_obj_set_y(label, new_y); } else { - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_ease_out); lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, label); @@ -612,7 +608,7 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) lv_anim_set_values(&a, lv_obj_get_y(label), new_y); lv_anim_set_time(&a, anim_time); lv_anim_set_ready_cb(&a, scroll_anim_ready_cb); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_ease_out); lv_anim_start(&a); } } diff --git a/src/widgets/lv_slider.c b/src/widgets/lv_slider.c index ef8f57eba..a969ccd70 100644 --- a/src/widgets/lv_slider.c +++ b/src/widgets/lv_slider.c @@ -275,12 +275,13 @@ static void lv_slider_event(lv_event_t * e) lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); /*The smaller size is the knob diameter*/ - lv_coord_t trans_w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); - lv_coord_t trans_h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); + lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_KNOB); + lv_coord_t trans_w = lv_obj_get_style_transform_width(obj, LV_PART_KNOB); + lv_coord_t trans_h = lv_obj_get_style_transform_height(obj, LV_PART_KNOB); lv_coord_t knob_size = LV_MIN(lv_obj_get_width(obj) + 2 * trans_w, lv_obj_get_height(obj) + 2 * trans_h) >> 1; + knob_size = (knob_size * zoom) >> 8; knob_size += LV_MAX(LV_MAX(knob_left, knob_right), LV_MAX(knob_bottom, knob_top)); knob_size += 2; /*For rounding error*/ - knob_size += lv_obj_calculate_ext_draw_size(obj, LV_PART_KNOB); /*Indic. size is handled by bar*/ @@ -401,7 +402,6 @@ static void draw_knob(lv_event_t * e) lv_draw_rect(&slider->left_knob_area, clip_area, &knob_rect_dsc); lv_event_send(obj, LV_EVENT_DRAW_PART_END, &dsc); } - } static void position_knob(lv_obj_t * obj, lv_area_t * knob_area, lv_coord_t knob_size, bool hor) @@ -420,6 +420,9 @@ static void position_knob(lv_obj_t * obj, lv_area_t * knob_area, lv_coord_t knob knob_area->x2 = obj->coords.x2; } + lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_KNOB); + lv_area_zoom(zoom, knob_area, knob_area); + lv_coord_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); lv_coord_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); lv_coord_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); diff --git a/src/widgets/lv_textarea.c b/src/widgets/lv_textarea.c index a12a44ab7..452611753 100644 --- a/src/widgets/lv_textarea.c +++ b/src/widgets/lv_textarea.c @@ -147,17 +147,13 @@ void lv_textarea_add_char(lv_obj_t * obj, uint32_t c) pwd_char_hider(obj); } else { - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_step); - lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, ta); lv_anim_set_exec_cb(&a, pwd_char_hider_anim); lv_anim_set_time(&a, ta->pwd_show_time); lv_anim_set_values(&a, 0, 1); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_step); lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready); lv_anim_start(&a); } @@ -213,17 +209,13 @@ void lv_textarea_add_text(lv_obj_t * obj, const char * txt) pwd_char_hider(obj); } else { - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_step); - lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, ta); lv_anim_set_exec_cb(&a, pwd_char_hider_anim); lv_anim_set_time(&a, ta->pwd_show_time); lv_anim_set_values(&a, 0, 1); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_step); lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready); lv_anim_start(&a); } @@ -337,17 +329,13 @@ void lv_textarea_set_text(lv_obj_t * obj, const char * txt) pwd_char_hider(obj); } else { - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_step); - lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, ta); lv_anim_set_exec_cb(&a, pwd_char_hider_anim); lv_anim_set_time(&a, ta->pwd_show_time); lv_anim_set_values(&a, 0, 1); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_step); lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready); lv_anim_start(&a); } @@ -1031,10 +1019,6 @@ static void start_cursor_blink(lv_obj_t * obj) lv_anim_del(obj, cursor_blink_anim_cb); ta->cursor.show = 1; } else { - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_step); - lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, ta); @@ -1042,7 +1026,7 @@ static void start_cursor_blink(lv_obj_t * obj) lv_anim_set_time(&a, blink_time); lv_anim_set_playback_time(&a, blink_time); lv_anim_set_values(&a, 1, 0); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_step); lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); lv_anim_start(&a); } From 511d9d8c504d6717f7d3d844bffb8ff5cca5e317 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 18 Apr 2021 00:55:11 +0200 Subject: [PATCH 009/152] fix(theme) update the tabview's theme Allow setting background color directly on the tabview --- src/extra/themes/default/lv_theme_default.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index 0201027d6..ed736e827 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -589,13 +589,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) lv_obj_t * parent = lv_obj_get_parent(obj); /*Tabview content area*/ if(lv_obj_check_type(parent, &lv_tabview_class)) { - lv_obj_add_style(obj, &styles->bg_color_grey, 0); - lv_obj_add_style(obj, &styles->pad_gap, 0); return; } /*Tabview pages*/ else if(lv_obj_check_type(lv_obj_get_parent(parent), &lv_tabview_class)) { - lv_obj_add_style(obj, &styles->scr, 0); lv_obj_add_style(obj, &styles->pad_normal, 0); lv_obj_add_style(obj, &styles->scrollbar, LV_PART_SCROLLBAR); lv_obj_add_style(obj, &styles->scrollbar_scrolled, LV_PART_SCROLLBAR | LV_STATE_SCROLLED); @@ -915,6 +912,13 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) } #endif +#if LV_USE_TABVIEW + if(lv_obj_check_type(obj, &lv_tabview_class)) { + lv_obj_add_style(obj, &styles->scr, 0); + return; + } +#endif + #if LV_USE_COLORWHEEL else if(lv_obj_check_type(obj, &lv_colorwheel_class)) { lv_obj_add_style(obj, &styles->colorwheel_main, 0); From 03efd13e4f22edb666b88370b3d295c347ab2e06 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 18 Apr 2021 01:08:12 +0200 Subject: [PATCH 010/152] fix build error --- src/core/lv_obj_style.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index 65678cf72..8d75a865a 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -335,7 +335,9 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t lv_anim_set_delay(&a, tr_dsc->delay); lv_anim_set_path_cb(&a, tr_dsc->path_cb); lv_anim_set_early_apply(&a, false); +#if LV_USE_USER_DATA a.user_data = tr_dsc->user_data; +#endif lv_anim_start(&a); } } From 2fb8b672aebfb9f16075e6b3f9438c38955f4cf8 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 18 Apr 2021 12:19:02 +0200 Subject: [PATCH 011/152] refactor(coords) rename LV_SIZE_PCT to LV_PCT --- examples/layouts/flex/lv_example_flex_1.c | 4 ++-- .../widgets/tileview/lv_example_tileview_1.c | 2 +- src/extra/widgets/keyboard/lv_keyboard.c | 4 ++-- src/extra/widgets/list/lv_list.c | 4 ++-- src/extra/widgets/msgbox/lv_msgbox.c | 6 +++--- src/extra/widgets/tabview/lv_tabview.c | 16 ++++++++-------- src/extra/widgets/tileview/lv_tileview.c | 4 ++-- src/extra/widgets/win/lv_win.c | 10 +++++----- src/misc/lv_area.h | 2 +- src/widgets/lv_chart.c | 2 +- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/examples/layouts/flex/lv_example_flex_1.c b/examples/layouts/flex/lv_example_flex_1.c index 7e6f1e971..f9494da7d 100644 --- a/examples/layouts/flex/lv_example_flex_1.c +++ b/examples/layouts/flex/lv_example_flex_1.c @@ -25,7 +25,7 @@ void lv_example_flex_1(void) /*Add items to the row*/ obj= lv_btn_create(cont_row); - lv_obj_set_size(obj, 100, LV_SIZE_PCT(100)); + lv_obj_set_size(obj, 100, LV_PCT(100)); label = lv_label_create(obj); lv_label_set_text_fmt(label, "Item: %d", i); @@ -33,7 +33,7 @@ void lv_example_flex_1(void) /*Add items to the column*/ obj = lv_btn_create(cont_col); - lv_obj_set_size(obj, LV_SIZE_PCT(100), LV_SIZE_CONTENT); + lv_obj_set_size(obj, LV_PCT(100), LV_SIZE_CONTENT); label = lv_label_create(obj); lv_label_set_text_fmt(label, "Item: %d", i); diff --git a/examples/widgets/tileview/lv_example_tileview_1.c b/examples/widgets/tileview/lv_example_tileview_1.c index 9d562efb8..e36d54246 100644 --- a/examples/widgets/tileview/lv_example_tileview_1.c +++ b/examples/widgets/tileview/lv_example_tileview_1.c @@ -31,7 +31,7 @@ void lv_example_tileview_1(void) /*Tile3: a list*/ lv_obj_t * tile3 = lv_tileview_add_tile(tv, 1, 1, LV_DIR_LEFT); lv_obj_t * list = lv_list_create(tile3); - lv_obj_set_size(list, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); + lv_obj_set_size(list, LV_PCT(100), LV_PCT(100)); lv_list_add_btn(list, NULL, "One", NULL); lv_list_add_btn(list, NULL, "Two", NULL); diff --git a/src/extra/widgets/keyboard/lv_keyboard.c b/src/extra/widgets/keyboard/lv_keyboard.c index 45955b31b..1f8433079 100644 --- a/src/extra/widgets/keyboard/lv_keyboard.c +++ b/src/extra/widgets/keyboard/lv_keyboard.c @@ -32,8 +32,8 @@ static void lv_keyboard_update_map(lv_obj_t * obj); **********************/ const lv_obj_class_t lv_keyboard_class = { .constructor_cb = lv_keyboard_constructor, - .width_def = LV_SIZE_PCT(100), - .height_def = LV_SIZE_PCT(50), + .width_def = LV_PCT(100), + .height_def = LV_PCT(50), .instance_size = sizeof(lv_keyboard_t), .editable = 1, .base_class = &lv_btnmatrix_class diff --git a/src/extra/widgets/list/lv_list.c b/src/extra/widgets/list/lv_list.c index 7bcc0d546..cbba06563 100644 --- a/src/extra/widgets/list/lv_list.c +++ b/src/extra/widgets/list/lv_list.c @@ -66,14 +66,14 @@ lv_obj_t * lv_list_add_text(lv_obj_t * list, const char * txt) lv_obj_t * label = lv_obj_create_from_class(&lv_list_text_class, list); lv_label_set_text(label, txt); lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR); - lv_obj_set_width(label, LV_SIZE_PCT(100)); + lv_obj_set_width(label, LV_PCT(100)); return label; } lv_obj_t * lv_list_add_btn(lv_obj_t * list, const char * icon, const char * txt, lv_event_cb_t event_cb) { lv_obj_t * btn = lv_obj_create_from_class(&lv_list_btn_class, list); - lv_obj_set_size(btn, LV_SIZE_PCT(100), LV_SIZE_CONTENT); + lv_obj_set_size(btn, LV_PCT(100), LV_SIZE_CONTENT); lv_obj_add_event_cb(btn, event_cb, NULL); if(icon) { diff --git a/src/extra/widgets/msgbox/lv_msgbox.c b/src/extra/widgets/msgbox/lv_msgbox.c index 6c7ce6a4a..8237fad90 100644 --- a/src/extra/widgets/msgbox/lv_msgbox.c +++ b/src/extra/widgets/msgbox/lv_msgbox.c @@ -44,7 +44,7 @@ const lv_obj_class_t lv_msgbox_class = {.base_class = &lv_obj_class}; lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * btn_txts[], bool add_close_btn) { lv_obj_t * parent = lv_obj_create(lv_layer_top()); - lv_obj_set_size(parent, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); + lv_obj_set_size(parent, LV_PCT(100), LV_PCT(100)); lv_obj_remove_style_all(parent); lv_obj_set_style_bg_color(parent, lv_color_grey(), 0); @@ -65,7 +65,7 @@ lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * b lv_label_set_text(label, title); lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR); if(add_close_btn) lv_obj_set_flex_grow(label, 1); - else lv_obj_set_width(label, LV_SIZE_PCT(100)); + else lv_obj_set_width(label, LV_PCT(100)); if(add_close_btn) { lv_obj_t * close_btn = lv_btn_create(mbox); @@ -81,7 +81,7 @@ lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * b label = lv_label_create(mbox); lv_label_set_text(label, txt); lv_label_set_long_mode(label, LV_LABEL_LONG_WRAP); - lv_obj_set_width(label, LV_SIZE_PCT(100)); + lv_obj_set_width(label, LV_PCT(100)); lv_obj_t * btns = lv_btnmatrix_create(mbox); lv_btnmatrix_set_map(btns, btn_txts); diff --git a/src/extra/widgets/tabview/lv_tabview.c b/src/extra/widgets/tabview/lv_tabview.c index c513f9173..7c617441c 100644 --- a/src/extra/widgets/tabview/lv_tabview.c +++ b/src/extra/widgets/tabview/lv_tabview.c @@ -31,8 +31,8 @@ static void cont_event_cb(lv_event_t * e); const lv_obj_class_t lv_tabview_class = { .constructor_cb = lv_tabview_constructor, .destructor_cb = lv_tabview_destructor, - .width_def = LV_SIZE_PCT(100), - .height_def = LV_SIZE_PCT(100), + .width_def = LV_PCT(100), + .height_def = LV_PCT(100), .base_class = &lv_obj_class, .instance_size = sizeof(lv_tabview_t)}; @@ -60,7 +60,7 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name) lv_obj_t * cont = lv_tabview_get_content(obj); lv_obj_t * page = lv_obj_create(cont); - lv_obj_set_size(page, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); + lv_obj_set_size(page, LV_PCT(100), LV_PCT(100)); lv_obj_clear_flag(page, LV_OBJ_FLAG_CLICK_FOCUSABLE); uint32_t tab_id = lv_obj_get_child_cnt(cont); @@ -168,7 +168,7 @@ static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob break; } - lv_obj_set_size(obj, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); + lv_obj_set_size(obj, LV_PCT(100), LV_PCT(100)); lv_obj_t * btnm; lv_obj_t * cont; @@ -189,14 +189,14 @@ static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob switch(tabview->tab_pos) { case LV_DIR_TOP: case LV_DIR_BOTTOM: - lv_obj_set_size(btnm, LV_SIZE_PCT(100), tabsize_create); - lv_obj_set_width(cont, LV_SIZE_PCT(100)); + lv_obj_set_size(btnm, LV_PCT(100), tabsize_create); + lv_obj_set_width(cont, LV_PCT(100)); lv_obj_set_flex_grow(cont, 1); break; case LV_DIR_LEFT: case LV_DIR_RIGHT: - lv_obj_set_size(btnm, tabsize_create, LV_SIZE_PCT(100)); - lv_obj_set_height(cont, LV_SIZE_PCT(100)); + lv_obj_set_size(btnm, tabsize_create, LV_PCT(100)); + lv_obj_set_height(cont, LV_PCT(100)); lv_obj_set_flex_grow(cont, 1); break; } diff --git a/src/extra/widgets/tileview/lv_tileview.c b/src/extra/widgets/tileview/lv_tileview.c index 892480536..c7b36ea7e 100644 --- a/src/extra/widgets/tileview/lv_tileview.c +++ b/src/extra/widgets/tileview/lv_tileview.c @@ -104,7 +104,7 @@ void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim static void lv_tileview_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { LV_UNUSED(class_p); - lv_obj_set_size(obj, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); + lv_obj_set_size(obj, LV_PCT(100), LV_PCT(100)); lv_obj_add_event_cb(obj, tileview_event_cb, NULL); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ONE); lv_obj_set_scroll_snap_x(obj, LV_SCROLL_SNAP_CENTER); @@ -116,7 +116,7 @@ static void lv_tileview_tile_constructor(const lv_obj_class_t * class_p, lv_obj_ { LV_UNUSED(class_p); lv_obj_t * parent = lv_obj_get_parent(obj); - lv_obj_set_size(obj, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); + lv_obj_set_size(obj, LV_PCT(100), LV_PCT(100)); lv_obj_set_pos(obj, create_col_id * lv_obj_get_width_fit(parent), create_row_id * lv_obj_get_height_fit(parent)); lv_tileview_tile_t * tile = (lv_tileview_tile_t *)obj; diff --git a/src/extra/widgets/win/lv_win.c b/src/extra/widgets/win/lv_win.c index 74b622b0a..9c8a37294 100644 --- a/src/extra/widgets/win/lv_win.c +++ b/src/extra/widgets/win/lv_win.c @@ -28,8 +28,8 @@ static void lv_win_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); **********************/ const lv_obj_class_t lv_win_class = { .constructor_cb = lv_win_constructor, - .width_def = LV_SIZE_PCT(100), - .height_def = LV_SIZE_PCT(100), + .width_def = LV_PCT(100), + .height_def = LV_PCT(100), .base_class = &lv_obj_class, .instance_size = sizeof(lv_win_t) }; @@ -62,7 +62,7 @@ lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * icon, lv_coord_t btn_w, l { lv_obj_t * header = lv_win_get_header(win); lv_obj_t * btn = lv_btn_create(header); - lv_obj_set_size(btn, btn_w, LV_SIZE_PCT(100)); + lv_obj_set_size(btn, btn_w, LV_PCT(100)); lv_obj_add_event_cb(btn, event_cb, NULL); lv_obj_t * img = lv_img_create(btn); @@ -94,13 +94,13 @@ static void lv_win_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_COLUMN); lv_obj_t * header = lv_obj_create(obj); - lv_obj_set_size(header, LV_SIZE_PCT(100), create_header_height); + lv_obj_set_size(header, LV_PCT(100), create_header_height); lv_obj_set_flex_flow(header, LV_FLEX_FLOW_ROW); lv_obj_set_flex_place(header, LV_FLEX_PLACE_START, LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_CENTER); lv_obj_t * cont = lv_obj_create(obj); lv_obj_set_flex_grow(cont, 1); - lv_obj_set_width(cont, LV_SIZE_PCT(100)); + lv_obj_set_width(cont, LV_PCT(100)); } #endif diff --git a/src/misc/lv_area.h b/src/misc/lv_area.h index 393a8d9d9..f7bae42e6 100644 --- a/src/misc/lv_area.h +++ b/src/misc/lv_area.h @@ -241,7 +241,7 @@ void _lv_area_align(const lv_area_t * base, const lv_area_t * to_align, lv_align #define LV_COORD_SET_SPEC(x) ((x) | _LV_COORD_TYPE_SPEC) /*Special coordinates*/ -#define LV_SIZE_PCT(x) LV_COORD_SET_SPEC(x) +#define LV_PCT(x) LV_COORD_SET_SPEC(x) #define LV_COORD_IS_PCT(x) ((LV_COORD_IS_SPEC(x) && _LV_COORD_PLAIN(x) <= 1000) ? true : false) #define LV_COORD_GET_PCT(x) _LV_COORD_PLAIN(x) #define LV_SIZE_CONTENT LV_COORD_SET_SPEC(1001) diff --git a/src/widgets/lv_chart.c b/src/widgets/lv_chart.c index 3d046668c..761147000 100644 --- a/src/widgets/lv_chart.c +++ b/src/widgets/lv_chart.c @@ -55,7 +55,7 @@ const lv_obj_class_t lv_chart_class = { .constructor_cb = lv_chart_constructor, .destructor_cb = lv_chart_destructor, .event_cb = lv_chart_event, - .width_def = LV_SIZE_PCT(100), + .width_def = LV_PCT(100), .height_def = LV_DPI_DEF * 2, .instance_size = sizeof(lv_chart_t), .base_class = &lv_obj_class From 5b4e9fc6f35b2be5cd8687d84012d245b5f971e1 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 18 Apr 2021 13:15:48 +0200 Subject: [PATCH 012/152] feat(style) make transform_zoom use pixel or percentage value --- .../widgets/tabview/lv_example_tabview_1.c | 19 +++- src/core/lv_obj_pos.c | 8 +- src/extra/themes/default/lv_theme_default.c | 3 +- src/misc/lv_area.c | 23 ++--- src/misc/lv_style.c | 3 - src/widgets/lv_img.c | 86 ++++++++++--------- 6 files changed, 83 insertions(+), 59 deletions(-) diff --git a/examples/widgets/tabview/lv_example_tabview_1.c b/examples/widgets/tabview/lv_example_tabview_1.c index 17fc82e48..9e679a19e 100644 --- a/examples/widgets/tabview/lv_example_tabview_1.c +++ b/examples/widgets/tabview/lv_example_tabview_1.c @@ -14,10 +14,13 @@ void lv_example_tabview_1(void) /*Add content to the tabs*/ lv_obj_t * label = lv_label_create(tab1); - lv_label_set_text(label, "This the first tab\n\n" + lv_label_set_text(label, "This the first tab\n" + "\n" + "\n" + "\n" "If the content\n" "of a tab\n" - "becomes too\n" + "becomes\n" "longer\n" "than the\n" "container\n" @@ -28,7 +31,17 @@ void lv_example_tabview_1(void) "\n" "\n" "\n" - "Can you see it?"); + "Here a couple\n" + "of more extra\n" + "line to sure\n" + "the label is long\n" + "enough even on\n" + "large screens.\n" + "\n" + "\n" + "\n" + "Can you see the\n" + "scrollbars?"); label = lv_label_create(tab2); lv_label_set_text(label, "Second tab"); diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 11dcac65f..239b13a8c 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -609,8 +609,12 @@ void lv_obj_refr_pos(lv_obj_t * obj) if(lv_obj_is_layout_positioned(obj)) return; lv_obj_t * parent = lv_obj_get_parent(obj); - lv_coord_t x = lv_obj_get_style_x(obj, LV_PART_MAIN) + lv_obj_get_style_transform_x(obj, LV_PART_MAIN); - lv_coord_t y = lv_obj_get_style_y(obj, LV_PART_MAIN) + lv_obj_get_style_transform_y(obj, LV_PART_MAIN); + lv_coord_t tr_x = lv_obj_get_style_transform_x(obj, LV_PART_MAIN); + lv_coord_t tr_y = lv_obj_get_style_transform_y(obj, LV_PART_MAIN); + if(LV_COORD_IS_PCT(tr_x)) tr_x = (lv_obj_get_width(obj) * LV_COORD_GET_PCT(tr_x)) / 100; + if(LV_COORD_IS_PCT(tr_y)) tr_y = (lv_obj_get_height(obj) * LV_COORD_GET_PCT(tr_y)) / 100; + lv_coord_t x = lv_obj_get_style_x(obj, LV_PART_MAIN) + tr_x; + lv_coord_t y = lv_obj_get_style_y(obj, LV_PART_MAIN) + tr_y; if(parent == NULL) { lv_obj_move_to(obj, x, y); return; diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index ed736e827..c89747953 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -363,7 +363,7 @@ static void style_init(void) #if LV_THEME_DEFAULT_GROW style_init_reset(&styles->grow); - lv_style_set_transform_zoom(&styles->grow, 400); + lv_style_set_transform_zoom(&styles->grow, 5); #endif style_init_reset(&styles->knob); @@ -915,6 +915,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #if LV_USE_TABVIEW if(lv_obj_check_type(obj, &lv_tabview_class)) { lv_obj_add_style(obj, &styles->scr, 0); + lv_obj_add_style(obj, &styles->pad_zero, 0); return; } #endif diff --git a/src/misc/lv_area.c b/src/misc/lv_area.c index 2ddddfe11..4aa8afa3d 100644 --- a/src/misc/lv_area.c +++ b/src/misc/lv_area.c @@ -90,22 +90,25 @@ uint32_t lv_area_get_size(const lv_area_t * area_p) void lv_area_zoom(int32_t zoom, const lv_area_t * area_in, lv_area_t * area_out) { - if(zoom == 256) { + if(zoom == 0) { lv_area_copy(area_out, area_in); return; } else { - /* Zoom symmetrically - * extra_width_on_left = (((w * zoom) >> 8) - w) / 2 - * extra_width_on_left = (w * (zoom >> 8) - 1) / 2 - * extra_width_on_left = (w * (zoom - 256) >> 8) / 2 */ - lv_coord_t w = lv_area_get_width(area_in); - lv_coord_t h = lv_area_get_height(area_in); - lv_coord_t w_extra = (w * (zoom - 256) >> 8) / 2; - lv_coord_t h_extra = (h * (zoom - 256) >> 8) / 2; + lv_coord_t w_extra; + lv_coord_t h_extra; + if(LV_COORD_IS_PCT(zoom)) { + lv_coord_t w = lv_area_get_width(area_in); + lv_coord_t h = lv_area_get_height(area_in); + w_extra = (w * zoom) / 100; + h_extra = (h * zoom) / 100; + + } else { + w_extra = zoom; + h_extra = zoom; + } lv_area_copy(area_out, area_in); lv_area_increase(area_out, w_extra, h_extra); - } } diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index c4d779b91..a8ba34019 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -211,9 +211,6 @@ lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop) { lv_style_value_t value; switch(prop) { - case LV_STYLE_TRANSFORM_ZOOM: - value.num = LV_IMG_ZOOM_NONE; - break; case LV_STYLE_BG_COLOR: value.color = lv_color_white(); break; diff --git a/src/widgets/lv_img.c b/src/widgets/lv_img.c index 6df402f11..61c2f814b 100644 --- a/src/widgets/lv_img.c +++ b/src/widgets/lv_img.c @@ -32,6 +32,8 @@ static void lv_img_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_img_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_img_event(lv_event_t * e); static void draw_img(lv_event_t * e); +static lv_coord_t get_zoom_final(lv_obj_t * obj); +static lv_coord_t get_angle_final(lv_obj_t * obj); /********************** * STATIC VARIABLES @@ -188,15 +190,14 @@ void lv_img_set_angle(lv_obj_t * obj, int16_t angle) lv_img_t * img = (lv_img_t *)obj; if(angle == img->angle) return; - lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); - transf_zoom = (transf_zoom * img->zoom) >> 8; - - lv_coord_t transf_angle = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); + lv_coord_t zoom_final = get_zoom_final(obj); + lv_coord_t angle_final = get_angle_final(obj); lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); lv_area_t a; - _lv_img_buf_get_transformed_area(&a, w, h, transf_angle + img->angle, transf_zoom, &img->pivot); + + _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); a.x1 += obj->coords.x1; a.y1 += obj->coords.y1; a.x2 += obj->coords.x1; @@ -206,7 +207,7 @@ void lv_img_set_angle(lv_obj_t * obj, int16_t angle) img->angle = angle; lv_obj_refresh_ext_draw_size(obj); - _lv_img_buf_get_transformed_area(&a, w, h, transf_angle + img->angle, transf_zoom, &img->pivot); + _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); a.x1 += obj->coords.x1; a.y1 += obj->coords.y1; a.x2 += obj->coords.x1; @@ -219,16 +220,13 @@ void lv_img_set_pivot(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) lv_img_t * img = (lv_img_t *)obj; if(img->pivot.x == x && img->pivot.y == y) return; - lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); - transf_zoom = (transf_zoom * img->zoom) >> 8; - - lv_coord_t transf_angle = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); - transf_angle += img->angle; + lv_coord_t zoom_final = get_zoom_final(obj); + lv_coord_t angle_final = get_angle_final(obj); lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); lv_area_t a; - _lv_img_buf_get_transformed_area(&a, w, h, transf_angle, transf_zoom, &img->pivot); + _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); a.x1 += obj->coords.x1; a.y1 += obj->coords.y1; a.x2 += obj->coords.x1; @@ -239,7 +237,7 @@ void lv_img_set_pivot(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) img->pivot.y = y; lv_obj_refresh_ext_draw_size(obj); - _lv_img_buf_get_transformed_area(&a, w, h, transf_angle, transf_zoom, &img->pivot); + _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); a.x1 += obj->coords.x1; a.y1 += obj->coords.y1; a.x2 += obj->coords.x1; @@ -254,15 +252,13 @@ void lv_img_set_zoom(lv_obj_t * obj, uint16_t zoom) if(zoom == 0) zoom = 1; - lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); - - lv_coord_t transf_angle = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); - transf_angle += img->angle; + lv_coord_t zoom_final = get_zoom_final(obj); + lv_coord_t angle_final = get_angle_final(obj); lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); lv_area_t a; - _lv_img_buf_get_transformed_area(&a, w, h, transf_angle, (transf_zoom * img->zoom) >> 8, &img->pivot); + _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); a.x1 += obj->coords.x1 - 1; a.y1 += obj->coords.y1 - 1; a.x2 += obj->coords.x1 + 1; @@ -272,7 +268,7 @@ void lv_img_set_zoom(lv_obj_t * obj, uint16_t zoom) img->zoom = zoom; lv_obj_refresh_ext_draw_size(obj); - _lv_img_buf_get_transformed_area(&a, w, h, transf_angle, (transf_zoom * img->zoom) >> 8, &img->pivot); + _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); a.x1 += obj->coords.x1 - 1; a.y1 += obj->coords.y1 - 1; a.x2 += obj->coords.x1 + 1; @@ -420,18 +416,16 @@ static void lv_img_event(lv_event_t * e) else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { lv_coord_t * s = lv_event_get_param(e); - lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); - transf_zoom = (transf_zoom * img->zoom) >> 8; - lv_coord_t transf_angle = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); - transf_angle += img->angle; + lv_coord_t zoom_final = get_zoom_final(obj); + lv_coord_t angle_final = get_angle_final(obj); /*If the image has angle provide enough room for the rotated corners*/ - if(transf_angle || transf_zoom != LV_IMG_ZOOM_NONE) { + if(angle_final || zoom_final != LV_IMG_ZOOM_NONE) { lv_area_t a; lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); - _lv_img_buf_get_transformed_area(&a, w, h, transf_angle, transf_zoom, &img->pivot); + _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); lv_coord_t pad_ori = *s; *s = LV_MAX(*s, pad_ori - a.x1); *s = LV_MAX(*s, pad_ori - a.y1); @@ -441,21 +435,19 @@ static void lv_img_event(lv_event_t * e) } else if(code == LV_EVENT_HIT_TEST) { lv_hit_test_info_t * info = lv_event_get_param(e); - lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); - zoom = (zoom * img->zoom) >> 8; - lv_coord_t angle = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); - angle += img->angle; + lv_coord_t zoom_final = get_zoom_final(obj); + lv_coord_t angle_final = get_angle_final(obj); /*If the object is exactly image sized (not cropped, not mosaic) and transformed *perform hit test on it's transformed area*/ if(img->w == lv_obj_get_width(obj) && img->h == lv_obj_get_height(obj) && - (zoom != LV_IMG_ZOOM_NONE || angle != 0 || img->pivot.x != img->w / 2 || img->pivot.y != img->h / 2)) { + (zoom_final != LV_IMG_ZOOM_NONE || angle_final != 0 || img->pivot.x != img->w / 2 || img->pivot.y != img->h / 2)) { lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); lv_area_t coords; - _lv_img_buf_get_transformed_area(&coords, w, h, angle, zoom, &img->pivot); + _lv_img_buf_get_transformed_area(&coords, w, h, angle_final, zoom_final, &img->pivot); coords.x1 += obj->coords.x1; coords.y1 += obj->coords.y1; coords.x2 += obj->coords.x1; @@ -504,17 +496,14 @@ static void draw_img(lv_event_t * e) return; } - int32_t angle_final = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); - angle_final += img->angle; + lv_coord_t angle_final = get_angle_final(obj); if(angle_final != 0) { info->res = LV_DRAW_RES_NOT_COVER; return; } - int32_t zoom_final = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); - zoom_final = (zoom_final * img->zoom) >> 8; - + lv_coord_t zoom_final = get_zoom_final(obj); const lv_area_t * clip_area = lv_event_get_param(e); if(zoom_final == LV_IMG_ZOOM_NONE) { @@ -539,11 +528,9 @@ static void draw_img(lv_event_t * e) } else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST) { - int32_t zoom_final = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); - zoom_final = (zoom_final * img->zoom) >> 8; - int32_t angle_final = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); - angle_final += img->angle; + lv_coord_t zoom_final = get_zoom_final(obj); + lv_coord_t angle_final = get_angle_final(obj); lv_coord_t obj_w = lv_obj_get_width(obj); lv_coord_t obj_h = lv_obj_get_height(obj); @@ -638,4 +625,23 @@ static void draw_img(lv_event_t * e) } } +static lv_coord_t get_zoom_final(lv_obj_t * obj) +{ + lv_img_t * img = (lv_img_t *)obj; + lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); + if(LV_COORD_IS_PCT(transf_zoom)) { + transf_zoom = (LV_COORD_GET_PCT(transf_zoom) * LV_IMG_ZOOM_NONE) / 100; + return (img->zoom * transf_zoom) >> 8; + } else { + return img->zoom; + } +} + +static lv_coord_t get_angle_final(lv_obj_t * obj) +{ + lv_img_t * img = (lv_img_t *)obj; + lv_coord_t transf_angle = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); + return transf_angle + img->angle; +} + #endif From 32bd067778b8c0085fe1e3a169bb0afef48b1406 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 18 Apr 2021 19:31:38 +0200 Subject: [PATCH 013/152] Revert "feat(style) make transform_zoom use pixel or percentage value" This reverts commit 5b4e9fc6f35b2be5cd8687d84012d245b5f971e1. --- .../widgets/tabview/lv_example_tabview_1.c | 19 +--- src/core/lv_obj_pos.c | 8 +- src/extra/themes/default/lv_theme_default.c | 3 +- src/misc/lv_area.c | 23 +++-- src/misc/lv_style.c | 3 + src/widgets/lv_img.c | 86 +++++++++---------- 6 files changed, 59 insertions(+), 83 deletions(-) diff --git a/examples/widgets/tabview/lv_example_tabview_1.c b/examples/widgets/tabview/lv_example_tabview_1.c index 9e679a19e..17fc82e48 100644 --- a/examples/widgets/tabview/lv_example_tabview_1.c +++ b/examples/widgets/tabview/lv_example_tabview_1.c @@ -14,13 +14,10 @@ void lv_example_tabview_1(void) /*Add content to the tabs*/ lv_obj_t * label = lv_label_create(tab1); - lv_label_set_text(label, "This the first tab\n" - "\n" - "\n" - "\n" + lv_label_set_text(label, "This the first tab\n\n" "If the content\n" "of a tab\n" - "becomes\n" + "becomes too\n" "longer\n" "than the\n" "container\n" @@ -31,17 +28,7 @@ void lv_example_tabview_1(void) "\n" "\n" "\n" - "Here a couple\n" - "of more extra\n" - "line to sure\n" - "the label is long\n" - "enough even on\n" - "large screens.\n" - "\n" - "\n" - "\n" - "Can you see the\n" - "scrollbars?"); + "Can you see it?"); label = lv_label_create(tab2); lv_label_set_text(label, "Second tab"); diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 239b13a8c..11dcac65f 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -609,12 +609,8 @@ void lv_obj_refr_pos(lv_obj_t * obj) if(lv_obj_is_layout_positioned(obj)) return; lv_obj_t * parent = lv_obj_get_parent(obj); - lv_coord_t tr_x = lv_obj_get_style_transform_x(obj, LV_PART_MAIN); - lv_coord_t tr_y = lv_obj_get_style_transform_y(obj, LV_PART_MAIN); - if(LV_COORD_IS_PCT(tr_x)) tr_x = (lv_obj_get_width(obj) * LV_COORD_GET_PCT(tr_x)) / 100; - if(LV_COORD_IS_PCT(tr_y)) tr_y = (lv_obj_get_height(obj) * LV_COORD_GET_PCT(tr_y)) / 100; - lv_coord_t x = lv_obj_get_style_x(obj, LV_PART_MAIN) + tr_x; - lv_coord_t y = lv_obj_get_style_y(obj, LV_PART_MAIN) + tr_y; + lv_coord_t x = lv_obj_get_style_x(obj, LV_PART_MAIN) + lv_obj_get_style_transform_x(obj, LV_PART_MAIN); + lv_coord_t y = lv_obj_get_style_y(obj, LV_PART_MAIN) + lv_obj_get_style_transform_y(obj, LV_PART_MAIN); if(parent == NULL) { lv_obj_move_to(obj, x, y); return; diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index c89747953..ed736e827 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -363,7 +363,7 @@ static void style_init(void) #if LV_THEME_DEFAULT_GROW style_init_reset(&styles->grow); - lv_style_set_transform_zoom(&styles->grow, 5); + lv_style_set_transform_zoom(&styles->grow, 400); #endif style_init_reset(&styles->knob); @@ -915,7 +915,6 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #if LV_USE_TABVIEW if(lv_obj_check_type(obj, &lv_tabview_class)) { lv_obj_add_style(obj, &styles->scr, 0); - lv_obj_add_style(obj, &styles->pad_zero, 0); return; } #endif diff --git a/src/misc/lv_area.c b/src/misc/lv_area.c index 4aa8afa3d..2ddddfe11 100644 --- a/src/misc/lv_area.c +++ b/src/misc/lv_area.c @@ -90,25 +90,22 @@ uint32_t lv_area_get_size(const lv_area_t * area_p) void lv_area_zoom(int32_t zoom, const lv_area_t * area_in, lv_area_t * area_out) { - if(zoom == 0) { + if(zoom == 256) { lv_area_copy(area_out, area_in); return; } else { - lv_coord_t w_extra; - lv_coord_t h_extra; - if(LV_COORD_IS_PCT(zoom)) { - lv_coord_t w = lv_area_get_width(area_in); - lv_coord_t h = lv_area_get_height(area_in); - w_extra = (w * zoom) / 100; - h_extra = (h * zoom) / 100; - - } else { - w_extra = zoom; - h_extra = zoom; - } + /* Zoom symmetrically + * extra_width_on_left = (((w * zoom) >> 8) - w) / 2 + * extra_width_on_left = (w * (zoom >> 8) - 1) / 2 + * extra_width_on_left = (w * (zoom - 256) >> 8) / 2 */ + lv_coord_t w = lv_area_get_width(area_in); + lv_coord_t h = lv_area_get_height(area_in); + lv_coord_t w_extra = (w * (zoom - 256) >> 8) / 2; + lv_coord_t h_extra = (h * (zoom - 256) >> 8) / 2; lv_area_copy(area_out, area_in); lv_area_increase(area_out, w_extra, h_extra); + } } diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index a8ba34019..c4d779b91 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -211,6 +211,9 @@ lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop) { lv_style_value_t value; switch(prop) { + case LV_STYLE_TRANSFORM_ZOOM: + value.num = LV_IMG_ZOOM_NONE; + break; case LV_STYLE_BG_COLOR: value.color = lv_color_white(); break; diff --git a/src/widgets/lv_img.c b/src/widgets/lv_img.c index 61c2f814b..6df402f11 100644 --- a/src/widgets/lv_img.c +++ b/src/widgets/lv_img.c @@ -32,8 +32,6 @@ static void lv_img_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_img_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_img_event(lv_event_t * e); static void draw_img(lv_event_t * e); -static lv_coord_t get_zoom_final(lv_obj_t * obj); -static lv_coord_t get_angle_final(lv_obj_t * obj); /********************** * STATIC VARIABLES @@ -190,14 +188,15 @@ void lv_img_set_angle(lv_obj_t * obj, int16_t angle) lv_img_t * img = (lv_img_t *)obj; if(angle == img->angle) return; - lv_coord_t zoom_final = get_zoom_final(obj); - lv_coord_t angle_final = get_angle_final(obj); + lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); + transf_zoom = (transf_zoom * img->zoom) >> 8; + + lv_coord_t transf_angle = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); lv_area_t a; - - _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); + _lv_img_buf_get_transformed_area(&a, w, h, transf_angle + img->angle, transf_zoom, &img->pivot); a.x1 += obj->coords.x1; a.y1 += obj->coords.y1; a.x2 += obj->coords.x1; @@ -207,7 +206,7 @@ void lv_img_set_angle(lv_obj_t * obj, int16_t angle) img->angle = angle; lv_obj_refresh_ext_draw_size(obj); - _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); + _lv_img_buf_get_transformed_area(&a, w, h, transf_angle + img->angle, transf_zoom, &img->pivot); a.x1 += obj->coords.x1; a.y1 += obj->coords.y1; a.x2 += obj->coords.x1; @@ -220,13 +219,16 @@ void lv_img_set_pivot(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) lv_img_t * img = (lv_img_t *)obj; if(img->pivot.x == x && img->pivot.y == y) return; - lv_coord_t zoom_final = get_zoom_final(obj); - lv_coord_t angle_final = get_angle_final(obj); + lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); + transf_zoom = (transf_zoom * img->zoom) >> 8; + + lv_coord_t transf_angle = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); + transf_angle += img->angle; lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); lv_area_t a; - _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); + _lv_img_buf_get_transformed_area(&a, w, h, transf_angle, transf_zoom, &img->pivot); a.x1 += obj->coords.x1; a.y1 += obj->coords.y1; a.x2 += obj->coords.x1; @@ -237,7 +239,7 @@ void lv_img_set_pivot(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) img->pivot.y = y; lv_obj_refresh_ext_draw_size(obj); - _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); + _lv_img_buf_get_transformed_area(&a, w, h, transf_angle, transf_zoom, &img->pivot); a.x1 += obj->coords.x1; a.y1 += obj->coords.y1; a.x2 += obj->coords.x1; @@ -252,13 +254,15 @@ void lv_img_set_zoom(lv_obj_t * obj, uint16_t zoom) if(zoom == 0) zoom = 1; - lv_coord_t zoom_final = get_zoom_final(obj); - lv_coord_t angle_final = get_angle_final(obj); + lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); + + lv_coord_t transf_angle = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); + transf_angle += img->angle; lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); lv_area_t a; - _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); + _lv_img_buf_get_transformed_area(&a, w, h, transf_angle, (transf_zoom * img->zoom) >> 8, &img->pivot); a.x1 += obj->coords.x1 - 1; a.y1 += obj->coords.y1 - 1; a.x2 += obj->coords.x1 + 1; @@ -268,7 +272,7 @@ void lv_img_set_zoom(lv_obj_t * obj, uint16_t zoom) img->zoom = zoom; lv_obj_refresh_ext_draw_size(obj); - _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); + _lv_img_buf_get_transformed_area(&a, w, h, transf_angle, (transf_zoom * img->zoom) >> 8, &img->pivot); a.x1 += obj->coords.x1 - 1; a.y1 += obj->coords.y1 - 1; a.x2 += obj->coords.x1 + 1; @@ -416,16 +420,18 @@ static void lv_img_event(lv_event_t * e) else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { lv_coord_t * s = lv_event_get_param(e); + lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); + transf_zoom = (transf_zoom * img->zoom) >> 8; - lv_coord_t zoom_final = get_zoom_final(obj); - lv_coord_t angle_final = get_angle_final(obj); + lv_coord_t transf_angle = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); + transf_angle += img->angle; /*If the image has angle provide enough room for the rotated corners*/ - if(angle_final || zoom_final != LV_IMG_ZOOM_NONE) { + if(transf_angle || transf_zoom != LV_IMG_ZOOM_NONE) { lv_area_t a; lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); - _lv_img_buf_get_transformed_area(&a, w, h, angle_final, zoom_final, &img->pivot); + _lv_img_buf_get_transformed_area(&a, w, h, transf_angle, transf_zoom, &img->pivot); lv_coord_t pad_ori = *s; *s = LV_MAX(*s, pad_ori - a.x1); *s = LV_MAX(*s, pad_ori - a.y1); @@ -435,19 +441,21 @@ static void lv_img_event(lv_event_t * e) } else if(code == LV_EVENT_HIT_TEST) { lv_hit_test_info_t * info = lv_event_get_param(e); + lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); + zoom = (zoom * img->zoom) >> 8; - lv_coord_t zoom_final = get_zoom_final(obj); - lv_coord_t angle_final = get_angle_final(obj); + lv_coord_t angle = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); + angle += img->angle; /*If the object is exactly image sized (not cropped, not mosaic) and transformed *perform hit test on it's transformed area*/ if(img->w == lv_obj_get_width(obj) && img->h == lv_obj_get_height(obj) && - (zoom_final != LV_IMG_ZOOM_NONE || angle_final != 0 || img->pivot.x != img->w / 2 || img->pivot.y != img->h / 2)) { + (zoom != LV_IMG_ZOOM_NONE || angle != 0 || img->pivot.x != img->w / 2 || img->pivot.y != img->h / 2)) { lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); lv_area_t coords; - _lv_img_buf_get_transformed_area(&coords, w, h, angle_final, zoom_final, &img->pivot); + _lv_img_buf_get_transformed_area(&coords, w, h, angle, zoom, &img->pivot); coords.x1 += obj->coords.x1; coords.y1 += obj->coords.y1; coords.x2 += obj->coords.x1; @@ -496,14 +504,17 @@ static void draw_img(lv_event_t * e) return; } + int32_t angle_final = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); + angle_final += img->angle; - lv_coord_t angle_final = get_angle_final(obj); if(angle_final != 0) { info->res = LV_DRAW_RES_NOT_COVER; return; } - lv_coord_t zoom_final = get_zoom_final(obj); + int32_t zoom_final = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); + zoom_final = (zoom_final * img->zoom) >> 8; + const lv_area_t * clip_area = lv_event_get_param(e); if(zoom_final == LV_IMG_ZOOM_NONE) { @@ -528,9 +539,11 @@ static void draw_img(lv_event_t * e) } else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST) { + int32_t zoom_final = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); + zoom_final = (zoom_final * img->zoom) >> 8; - lv_coord_t zoom_final = get_zoom_final(obj); - lv_coord_t angle_final = get_angle_final(obj); + int32_t angle_final = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); + angle_final += img->angle; lv_coord_t obj_w = lv_obj_get_width(obj); lv_coord_t obj_h = lv_obj_get_height(obj); @@ -625,23 +638,4 @@ static void draw_img(lv_event_t * e) } } -static lv_coord_t get_zoom_final(lv_obj_t * obj) -{ - lv_img_t * img = (lv_img_t *)obj; - lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); - if(LV_COORD_IS_PCT(transf_zoom)) { - transf_zoom = (LV_COORD_GET_PCT(transf_zoom) * LV_IMG_ZOOM_NONE) / 100; - return (img->zoom * transf_zoom) >> 8; - } else { - return img->zoom; - } -} - -static lv_coord_t get_angle_final(lv_obj_t * obj) -{ - lv_img_t * img = (lv_img_t *)obj; - lv_coord_t transf_angle = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); - return transf_angle + img->angle; -} - #endif From 6db12e4997b117dab061a4565691296f8c25fd6f Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 18 Apr 2021 20:28:06 +0200 Subject: [PATCH 014/152] revert(style) revert the usage of transform width/height --- src/core/lv_obj.c | 37 ++++++++----- src/core/lv_obj_draw.c | 5 ++ src/core/lv_obj_pos.c | 4 -- src/core/lv_obj_scroll.c | 38 ++++++------- src/core/lv_obj_style.c | 5 +- src/core/lv_refr.c | 2 +- src/extra/layouts/flex/lv_flex.c | 6 +- src/extra/layouts/grid/lv_grid.c | 3 - src/extra/themes/default/lv_theme_default.c | 16 ++++-- src/misc/lv_area.c | 52 +++++------------- src/misc/lv_area.h | 14 +++-- src/misc/lv_style.c | 3 + src/misc/lv_style.h | 11 ++-- src/widgets/lv_bar.c | 7 ++- src/widgets/lv_chart.c | 61 ++++++++------------- src/widgets/lv_meter.c | 12 ++-- src/widgets/lv_slider.c | 3 - 17 files changed, 127 insertions(+), 152 deletions(-) diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index 6f9fddc3d..0924ee705 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -641,9 +641,14 @@ static void lv_obj_draw(lv_event_t * e) /*Most trivial test. Is the mask fully IN the object? If no it surely doesn't cover it*/ lv_coord_t r = lv_obj_get_style_radius(obj, LV_PART_MAIN); - lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); + lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); + lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); lv_area_t coords; - lv_area_zoom(zoom, &obj->coords, &coords); + lv_area_copy(&coords, &obj->coords); + coords.x1 -= w; + coords.x2 += w; + coords.y1 -= h; + coords.y2 += h; if(_lv_area_is_in(info->area, &coords, r) == false) { info->res = LV_DRAW_RES_NOT_COVER; @@ -680,9 +685,14 @@ static void lv_obj_draw(lv_event_t * e) lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &draw_dsc); - lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); + lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); + lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); lv_area_t coords; - lv_area_zoom(zoom, &obj->coords, &coords); + lv_area_copy(&coords, &obj->coords); + coords.x1 -= w; + coords.x2 += w; + coords.y1 -= h; + coords.y2 += h; lv_draw_rect(&coords, clip_area, &draw_dsc); @@ -716,10 +726,14 @@ static void lv_obj_draw(lv_event_t * e) draw_dsc.shadow_opa = LV_OPA_TRANSP; lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &draw_dsc); - lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); + lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); + lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); lv_area_t coords; - lv_area_zoom(zoom, &obj->coords, &coords); - + lv_area_copy(&coords, &obj->coords); + coords.x1 -= w; + coords.x2 += w; + coords.y1 -= h; + coords.y2 += h; lv_draw_rect(&coords, clip_area, &draw_dsc); } } @@ -898,14 +912,6 @@ static void lv_obj_event_cb(lv_event_t * e) lv_coord_t * s = lv_event_get_param(e); lv_coord_t d = lv_obj_calculate_ext_draw_size(obj, LV_PART_MAIN); *s = LV_MAX(*s, d); - - - lv_area_t zoomed_coords; - lv_area_zoom(lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN), &obj->coords, &zoomed_coords); - *s = LV_MAX(*s, obj->coords.x1 - zoomed_coords.x1); - *s = LV_MAX(*s, obj->coords.y1 - zoomed_coords.y1); - *s = LV_MAX(*s, zoomed_coords.x2 - obj->coords.x2); - *s = LV_MAX(*s, zoomed_coords.x2 - obj->coords.x2); } else if(code == LV_EVENT_STYLE_CHANGED) { /*Padding might have changed so the layout should be recalculated*/ @@ -1129,6 +1135,7 @@ static bool event_is_bubbled(lv_event_code_t e) case LV_EVENT_DELETE: case LV_EVENT_CHILD_CHANGED: case LV_EVENT_SIZE_CHANGED: + case LV_EVENT_STYLE_CHANGED: case LV_EVENT_GET_SELF_SIZE: return false; default: diff --git a/src/core/lv_obj_draw.c b/src/core/lv_obj_draw.c index 142d62976..244377661 100644 --- a/src/core/lv_obj_draw.c +++ b/src/core/lv_obj_draw.c @@ -315,6 +315,11 @@ lv_coord_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part) } } + lv_coord_t w = lv_obj_get_style_transform_width(obj, part); + lv_coord_t h = lv_obj_get_style_transform_height(obj, part); + lv_coord_t wh = LV_MAX(w, h); + if(wh > 0) s += wh; + return s; } diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 11dcac65f..e36ddbc38 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -116,8 +116,6 @@ void lv_obj_refr_size(lv_obj_t * obj) lv_coord_t parent_w = lv_obj_get_width_fit(parent); if(pct_w) w = (LV_COORD_GET_PCT(w) * parent_w) / 100; - w += lv_obj_get_style_transform_width(obj, LV_PART_MAIN); - lv_coord_t minw = lv_obj_get_style_min_width(obj, LV_PART_MAIN); lv_coord_t maxw = lv_obj_get_style_max_width(obj, LV_PART_MAIN); w = lv_clamp_width(w, minw, maxw, parent_w); @@ -143,8 +141,6 @@ void lv_obj_refr_size(lv_obj_t * obj) lv_coord_t parent_h = lv_obj_get_height_fit(parent); if(pct_h) h = (LV_COORD_GET_PCT(h) * parent_h) / 100; - h += lv_obj_get_style_transform_height(obj, LV_PART_MAIN); - lv_coord_t minh = lv_obj_get_style_min_height(obj, LV_PART_MAIN); lv_coord_t maxh = lv_obj_get_style_max_height(obj, LV_PART_MAIN); h = lv_clamp_width(h, minh, maxh, parent_h); diff --git a/src/core/lv_obj_scroll.c b/src/core/lv_obj_scroll.c index 08eceb23a..efd3a6bf2 100644 --- a/src/core/lv_obj_scroll.c +++ b/src/core/lv_obj_scroll.c @@ -425,45 +425,43 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * lv_coord_t hor_req_space = hor_draw ? tickness + side_space : 0; lv_coord_t rem; - if(lv_obj_get_style_bg_opa(obj, LV_PART_SCROLLBAR) < LV_OPA_MIN && lv_obj_get_style_border_opa(obj, LV_PART_SCROLLBAR) < LV_OPA_MIN) { return; } - /*Draw horizontal scrollbar if the mode is ON or can be scrolled in this direction*/ lv_coord_t content_h = obj_h + st + sb; if(ver_draw && content_h) { - ver_area->y1 = obj->coords.y1; - ver_area->y2 = obj->coords.y2; - ver_area->x2 = obj->coords.x2 - side_space; - ver_area->x1 = ver_area->x2 - tickness; + ver_area->y1 = obj->coords.y1; + ver_area->y2 = obj->coords.y2; + ver_area->x2 = obj->coords.x2 - side_space; + ver_area->x1 =ver_area->x2 - tickness; lv_coord_t sb_h = ((obj_h - end_space * 2 - hor_req_space) * obj_h) / content_h; sb_h = LV_MAX(sb_h, SCROLLBAR_MIN_SIZE); rem = (obj_h - end_space * 2 - hor_req_space) - sb_h; /*Remaining size from the scrollbar track that is not the scrollbar itself*/ lv_coord_t scroll_h = content_h - obj_h; /*The size of the content which can be really scrolled*/ if(scroll_h <= 0) { - ver_area->y1 = obj->coords.y1 + end_space; - ver_area->y2 = obj->coords.y2 - end_space - hor_req_space - 1; - ver_area->x2 = obj->coords.x2 - side_space; - ver_area->x1 = ver_area->x2 - tickness + 1; + ver_area->y1 = obj->coords.y1 + end_space; + ver_area->y2 = obj->coords.y2 - end_space - hor_req_space - 1; + ver_area->x2 = obj->coords.x2 - side_space; + ver_area->x1 =ver_area->x2 - tickness + 1; } else { lv_coord_t sb_y = (rem * sb) / scroll_h; sb_y = rem - sb_y; - ver_area->y1 = obj->coords.y1 + sb_y + end_space; - ver_area->y2 = ver_area->y1 + sb_h - 1; - ver_area->x2 = obj->coords.x2 - side_space; - ver_area->x1 = ver_area->x2 - tickness; - if(ver_area->y1 < obj->coords.y1 + end_space) { - ver_area->y1 = obj->coords.y1 + end_space; - if(ver_area->y1 + SCROLLBAR_MIN_SIZE > ver_area->y2) ver_area->y2 = ver_area->y1 + SCROLLBAR_MIN_SIZE; + ver_area->y1 = obj->coords.y1 + sb_y + end_space; + ver_area->y2 =ver_area->y1 + sb_h - 1; + ver_area->x2 = obj->coords.x2 - side_space; + ver_area->x1 =ver_area->x2 - tickness; + if(hor_area->y1 < obj->coords.y1 + end_space) { + ver_area->y1 = obj->coords.y1 + end_space; + if(hor_area->y1 + SCROLLBAR_MIN_SIZE >ver_area->y2)ver_area->y2 =ver_area->y1 + SCROLLBAR_MIN_SIZE; } - if(ver_area->y2 > obj->coords.y2 - hor_req_space - end_space) { - ver_area->y2 = obj->coords.y2 - hor_req_space - end_space; - if(ver_area->y2 - SCROLLBAR_MIN_SIZE < ver_area->y1) ver_area->y1 = ver_area->y2 - SCROLLBAR_MIN_SIZE; + if(hor_area->y2 > obj->coords.y2 - hor_req_space - end_space) { + ver_area->y2 = obj->coords.y2 - hor_req_space - end_space; + if(hor_area->y2 - SCROLLBAR_MIN_SIZE y1)ver_area->y1 =ver_area->y2 - SCROLLBAR_MIN_SIZE; } } } diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index 8d75a865a..7d0201476 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -173,7 +173,8 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style lv_part_t part = lv_obj_style_get_selector_part(selector); if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_PROP_LAYOUT_REFR))) { - lv_event_send(obj, LV_EVENT_STYLE_CHANGED, NULL); /*To update layout and sizes*/ + lv_event_send(obj, LV_EVENT_STYLE_CHANGED, NULL); /*To update layout*/ + if(obj->parent) obj->parent->layout_inv = 1; } if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_PROP_PARENT_LAYOUT_REFR))) { lv_obj_t * parent = lv_obj_get_parent(obj); @@ -223,7 +224,7 @@ lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_ } if(!found) { - if(part == LV_PART_MAIN && (prop == LV_STYLE_WIDTH || prop == LV_STYLE_HEIGHT)) { + if(prop == LV_STYLE_WIDTH || prop == LV_STYLE_HEIGHT) { const lv_obj_class_t * cls = obj->class_p; while(cls) { if(prop == LV_STYLE_WIDTH) { diff --git a/src/core/lv_refr.c b/src/core/lv_refr.c index 06b5c2176..883c784ee 100644 --- a/src/core/lv_refr.c +++ b/src/core/lv_refr.c @@ -191,7 +191,7 @@ void _lv_disp_refr_timer(lv_timer_t * tmr) #if LV_USE_PERF_MONITOR == 0 /** * Ensure the timer does not run again automatically. - * This is done before refreshing because invalidations later should restart the timer. + * This is done before refreshing in case refreshing invalidates something else. */ lv_timer_pause(tmr, true); #endif diff --git a/src/extra/layouts/flex/lv_flex.c b/src/extra/layouts/flex/lv_flex.c index 3577efd8e..ce41dfb17 100644 --- a/src/extra/layouts/flex/lv_flex.c +++ b/src/extra/layouts/flex/lv_flex.c @@ -206,16 +206,12 @@ static void flex_update(lv_obj_t * cont) *cross_pos += t.track_cross_size + gap + track_gap; } } + LV_ASSERT_MEM_INTEGRITY(); if(w_set == LV_SIZE_CONTENT || h_set == LV_SIZE_CONTENT) { lv_obj_refr_size(cont); } - /*To update e.g. scrollbars */ - lv_obj_invalidate(cont); - - LV_ASSERT_MEM_INTEGRITY(); - LV_TRACE_LAYOUT("finished"); } diff --git a/src/extra/layouts/grid/lv_grid.c b/src/extra/layouts/grid/lv_grid.c index 6de28d7cf..ed7f5e300 100644 --- a/src/extra/layouts/grid/lv_grid.c +++ b/src/extra/layouts/grid/lv_grid.c @@ -180,9 +180,6 @@ static void grid_update(lv_obj_t * cont) lv_obj_refr_size(cont); } - /*To update e.g. scrollbars */ - lv_obj_invalidate(cont); - LV_TRACE_LAYOUT("finished"); } diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index ed736e827..b7f62ed10 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -107,7 +107,7 @@ typedef struct { #endif #if LV_USE_METER - lv_style_t meter_indic; + lv_style_t meter_marker, meter_indic; #endif #if LV_USE_TEXTAREA @@ -225,7 +225,7 @@ static void style_init(void) lv_style_set_radius(&styles->scrollbar, LV_RADIUS_CIRCLE); lv_style_set_pad_right(&styles->scrollbar, LV_DPX(7)); lv_style_set_pad_top(&styles->scrollbar, LV_DPX(7)); - lv_style_set_width(&styles->scrollbar, LV_DPX(5)); + lv_style_set_size(&styles->scrollbar, LV_DPX(5)); lv_style_set_bg_opa(&styles->scrollbar, LV_OPA_40); lv_style_set_transition(&styles->scrollbar, &trans_normal); @@ -363,7 +363,8 @@ static void style_init(void) #if LV_THEME_DEFAULT_GROW style_init_reset(&styles->grow); - lv_style_set_transform_zoom(&styles->grow, 400); + lv_style_set_transform_width(&styles->grow, LV_DPX(3)); + lv_style_set_transform_height(&styles->grow, LV_DPX(3)); #endif style_init_reset(&styles->knob); @@ -434,12 +435,17 @@ static void style_init(void) #endif #if LV_USE_METER + style_init_reset(&styles->meter_marker); + lv_style_set_line_width(&styles->meter_marker, LV_DPX(5)); + lv_style_set_line_color(&styles->meter_marker, lv_color_grey_darken_4()); + lv_style_set_size(&styles->meter_marker, LV_DPX(20)); + lv_style_set_pad_left(&styles->meter_marker, LV_DPX(15)); + style_init_reset(&styles->meter_indic); lv_style_set_radius(&styles->meter_indic, LV_RADIUS_CIRCLE); lv_style_set_bg_color(&styles->meter_indic, lv_color_grey_darken_4()); lv_style_set_bg_opa(&styles->meter_indic, LV_OPA_COVER); - lv_style_set_width(&styles->meter_indic, LV_DPX(15)); - lv_style_set_height(&styles->meter_indic, LV_DPX(15)); + lv_style_set_size(&styles->meter_indic, LV_DPX(15)); #endif #if LV_USE_TABLE diff --git a/src/misc/lv_area.c b/src/misc/lv_area.c index 2ddddfe11..4ba14eec8 100644 --- a/src/misc/lv_area.c +++ b/src/misc/lv_area.c @@ -73,6 +73,21 @@ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h) area_p->y2 = area_p->y1 + h - 1; } +/** + * Set the position of an area (width and height will be kept) + * @param area_p pointer to an area + * @param x the new x coordinate of the area + * @param y the new y coordinate of the area + */ +void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y) +{ + lv_coord_t w = lv_area_get_width(area_p); + lv_coord_t h = lv_area_get_height(area_p); + area_p->x1 = x; + area_p->y1 = y; + lv_area_set_width(area_p, w); + lv_area_set_height(area_p, h); +} /** * Return with area of an area (x * y) @@ -88,43 +103,6 @@ uint32_t lv_area_get_size(const lv_area_t * area_p) return size; } -void lv_area_zoom(int32_t zoom, const lv_area_t * area_in, lv_area_t * area_out) -{ - if(zoom == 256) { - lv_area_copy(area_out, area_in); - return; - } else { - /* Zoom symmetrically - * extra_width_on_left = (((w * zoom) >> 8) - w) / 2 - * extra_width_on_left = (w * (zoom >> 8) - 1) / 2 - * extra_width_on_left = (w * (zoom - 256) >> 8) / 2 */ - lv_coord_t w = lv_area_get_width(area_in); - lv_coord_t h = lv_area_get_height(area_in); - lv_coord_t w_extra = (w * (zoom - 256) >> 8) / 2; - lv_coord_t h_extra = (h * (zoom - 256) >> 8) / 2; - - lv_area_copy(area_out, area_in); - lv_area_increase(area_out, w_extra, h_extra); - - } -} - -void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra) -{ - area->x1 -= w_extra; - area->x2 += w_extra; - area->y1 -= h_extra; - area->y2 += h_extra; -} - -void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs) -{ - area->x1 += x_ofs; - area->x2 += x_ofs; - area->y1 += y_ofs; - area->y2 += y_ofs; -} - /** * Get the common parts of two areas * @param res_p pointer to an area, the result will be stored here diff --git a/src/misc/lv_area.h b/src/misc/lv_area.h index f7bae42e6..ca09f8c35 100644 --- a/src/misc/lv_area.h +++ b/src/misc/lv_area.h @@ -158,6 +158,14 @@ void lv_area_set_width(lv_area_t * area_p, lv_coord_t w); */ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h); +/** + * Set the position of an area (width and height will be kept) + * @param area_p pointer to an area + * @param x the new x coordinate of the area + * @param y the new y coordinate of the area + */ +void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y); + /** * Return with area of an area (x * y) * @param area_p pointer to an area @@ -165,12 +173,6 @@ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h); */ uint32_t lv_area_get_size(const lv_area_t * area_p); -void lv_area_zoom(int32_t zoom, const lv_area_t * area_in, lv_area_t * area_out); - -void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra); - -void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs); - /** * Get the common parts of two areas * @param res_p pointer to an area, the result will be stored her diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index c4d779b91..f49ff0f14 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -237,6 +237,9 @@ lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop) case LV_STYLE_TEXT_FONT: value.ptr = LV_FONT_DEFAULT; break; + case LV_STYLE_SIZE: + value.num = 5; + break; case LV_STYLE_MAX_WIDTH: case LV_STYLE_MAX_HEIGHT: value.num = LV_COORD_MAX; diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index ac335cccd..c8ee5b7c9 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -114,10 +114,10 @@ typedef enum { /*Group 0*/ LV_STYLE_RADIUS = 1, LV_STYLE_CLIP_CORNER = 2, - LV_STYLE_TRANSFORM_WIDTH = 3 | LV_STYLE_PROP_LAYOUT_REFR, - LV_STYLE_TRANSFORM_HEIGHT = 4 | LV_STYLE_PROP_LAYOUT_REFR, - LV_STYLE_TRANSFORM_X = 5 | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR, - LV_STYLE_TRANSFORM_Y = 6 | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR, + LV_STYLE_TRANSFORM_WIDTH = 3 | LV_STYLE_PROP_EXT_DRAW, + LV_STYLE_TRANSFORM_HEIGHT = 4 | LV_STYLE_PROP_EXT_DRAW, + LV_STYLE_TRANSFORM_X = 5 | LV_STYLE_PROP_PARENT_LAYOUT_REFR, + LV_STYLE_TRANSFORM_Y = 6 | LV_STYLE_PROP_PARENT_LAYOUT_REFR, LV_STYLE_TRANSFORM_ZOOM = 7 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_TRANSFORM_ANGLE = 8 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_OPA = 9 | LV_STYLE_PROP_INHERIT, @@ -126,7 +126,8 @@ typedef enum { LV_STYLE_COLOR_FILTER_OPA = 11, LV_STYLE_ANIM_TIME = 12, LV_STYLE_TRANSITION = 13, - LV_STYLE_BLEND_MODE = 14, + LV_STYLE_SIZE = 14, + LV_STYLE_BLEND_MODE = 15, /*Group 1*/ LV_STYLE_PAD_TOP = 16 | LV_STYLE_PROP_LAYOUT_REFR, diff --git a/src/widgets/lv_bar.c b/src/widgets/lv_bar.c index f7638efc4..9c0d1a410 100644 --- a/src/widgets/lv_bar.c +++ b/src/widgets/lv_bar.c @@ -239,9 +239,14 @@ static void draw_indic(lv_event_t * e) const lv_area_t * clip_area = lv_event_get_param(e); lv_area_t bar_coords; - lv_area_zoom(lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN), &obj->coords, &bar_coords); lv_obj_get_coords(obj, &bar_coords); + lv_coord_t transf_w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); + lv_coord_t transf_h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); + bar_coords.x1 -= transf_w; + bar_coords.x2 += transf_w; + bar_coords.y1 -= transf_h; + bar_coords.y2 += transf_h; lv_coord_t barw = lv_area_get_width(&bar_coords); lv_coord_t barh = lv_area_get_height(&bar_coords); int32_t range = bar->max_value - bar->min_value; diff --git a/src/widgets/lv_chart.c b/src/widgets/lv_chart.c index 761147000..14bba52ca 100644 --- a/src/widgets/lv_chart.c +++ b/src/widgets/lv_chart.c @@ -728,29 +728,18 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) bool mask_ret = _lv_area_intersect(&series_mask, &obj->coords, clip_area); if(mask_ret == false) return; - lv_state_t state_ori = obj->state; - obj->state = LV_STATE_DEFAULT; - obj->skip_trans = 1; lv_draw_line_dsc_t line_dsc_default; lv_draw_line_dsc_init(&line_dsc_default); lv_obj_init_draw_line_dsc(obj, LV_PART_ITEMS, &line_dsc_default); lv_draw_rect_dsc_t point_dsc_default; lv_draw_rect_dsc_init(&point_dsc_default); - point_dsc_default.radius = LV_RADIUS_CIRCLE; + lv_obj_init_draw_rect_dsc(obj, LV_PART_ITEMS, &point_dsc_default); - lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; - lv_coord_t point_h = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; + lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_ITEMS) / 2; + lv_coord_t point_h = lv_obj_get_style_height(obj, LV_PART_ITEMS) / 2; - obj->state = LV_STATE_PRESSED; - lv_coord_t point_w_pr = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; - lv_coord_t point_h_pr = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; - obj->state = state_ori; - obj->skip_trans = 0; - - lv_coord_t point_w_act; - lv_coord_t point_h_act; /*Do not bother with line ending is the point will over it*/ if(LV_MIN(point_w, point_h) > line_dsc_default.width / 2) line_dsc_default.raw_end = 1; @@ -790,10 +779,7 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) p1.x = p2.x; p1.y = p2.y; - point_w_act = p_act == chart->pressed_point_id ? point_w_pr : point_w; - point_h_act = p_act == chart->pressed_point_id ? point_h_pr : point_h; - - if(p1.x > clip_area->x2 + point_w_act + 1) break; + if(p1.x > clip_area->x2 + point_w + 1) break; p2.x = ((w * i) / (chart->point_cnt - 1)) + x_ofs; p_act = (start_point + i) % chart->point_cnt; @@ -802,7 +788,7 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) y_tmp = y_tmp / (chart->ymax[ser->y_axis] - chart->ymin[ser->y_axis]); p2.y = h - y_tmp + y_ofs; - if(p2.x < clip_area->x1 - point_w_act - 1) { + if(p2.x < clip_area->x1 - point_w - 1) { p_prev = p_act; continue; } @@ -829,10 +815,10 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) } } else { lv_area_t point_area; - point_area.x1 = p1.x - point_w_act; - point_area.x2 = p1.x + point_w_act; - point_area.y1 = p1.y - point_h_act; - point_area.y2 = p1.y + point_h_act; + point_area.x1 = p1.x - point_w; + point_area.x2 = p1.x + point_w; + point_area.y1 = p1.y - point_h; + point_area.y2 = p1.y + point_h; dsc.id = i - 1; dsc.p1 = ser->points[p_prev] != LV_CHART_POINT_NONE ? &p1 : NULL; @@ -846,7 +832,7 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) lv_draw_line(&p1, &p2, &series_mask, &line_dsc_default); } - if(point_w_act && point_h_act && ser->points[p_act] != LV_CHART_POINT_NONE) { + if(point_w && point_h && ser->points[p_act] != LV_CHART_POINT_NONE) { lv_draw_rect(&point_area, &series_mask, &point_dsc_default); } @@ -858,16 +844,14 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) } /*Draw the last point*/ - point_w_act = p_act == chart->pressed_point_id ? point_w_pr : point_w; - point_h_act = p_act == chart->pressed_point_id ? point_h_pr : point_h; - if(!crowded_mode && point_w_act && point_h_act && i == chart->point_cnt) { + if(!crowded_mode && i == chart->point_cnt) { if(ser->points[p_act] != LV_CHART_POINT_NONE) { lv_area_t point_area; - point_area.x1 = p2.x - point_w_act; - point_area.x2 = p2.x + point_w_act; - point_area.y1 = p2.y - point_h_act; - point_area.y2 = p2.y + point_h_act; + point_area.x1 = p2.x - point_w; + point_area.x2 = p2.x + point_w; + point_area.y1 = p2.y - point_h; + point_area.y2 = p2.y + point_h; dsc.id = i - 1; dsc.p1 = NULL; @@ -1284,23 +1268,22 @@ static void invalidate_point(lv_obj_t * obj, uint16_t i) if(chart->type == LV_CHART_TYPE_LINE) { lv_coord_t x_ofs = obj->coords.x1 + lv_obj_get_style_pad_left(obj, LV_PART_MAIN) - scroll_left; lv_coord_t line_width = lv_obj_get_style_line_width(obj, LV_PART_ITEMS); - lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_ITEMS) / 2 + 1; - lv_coord_t point_h = lv_obj_get_style_height(obj, LV_PART_ITEMS) / 2 + 1; + lv_coord_t point_radius = lv_obj_get_style_width(obj, LV_PART_ITEMS); lv_area_t coords; lv_area_copy(&coords, &obj->coords); - coords.y1 -= LV_MAX(line_width, point_h); - coords.y2 += LV_MAX(line_width, point_h); + coords.y1 -= line_width + point_radius; + coords.y2 += line_width + point_radius; if(i < chart->point_cnt - 1) { - coords.x1 = ((w * i) / (chart->point_cnt - 1)) + x_ofs - LV_MAX(line_width, point_w); - coords.x2 = ((w * (i + 1)) / (chart->point_cnt - 1)) + x_ofs + LV_MAX(line_width, point_w); + coords.x1 = ((w * i) / (chart->point_cnt - 1)) + x_ofs - line_width - point_radius; + coords.x2 = ((w * (i + 1)) / (chart->point_cnt - 1)) + x_ofs + line_width + point_radius; lv_obj_invalidate_area(obj, &coords); } if(i > 0) { - coords.x1 = ((w * (i - 1)) / (chart->point_cnt - 1)) + x_ofs - LV_MAX(line_width, point_w); - coords.x2 = ((w * i) / (chart->point_cnt - 1)) + x_ofs + LV_MAX(line_width, point_w); + coords.x1 = ((w * (i - 1)) / (chart->point_cnt - 1)) + x_ofs - line_width - point_radius; + coords.x2 = ((w * i) / (chart->point_cnt - 1)) + x_ofs + line_width + point_radius; lv_obj_invalidate_area(obj, &coords); } } diff --git a/src/widgets/lv_meter.c b/src/widgets/lv_meter.c index 10f3a255a..e65f0ced7 100644 --- a/src/widgets/lv_meter.c +++ b/src/widgets/lv_meter.c @@ -302,13 +302,13 @@ static void lv_meter_event(lv_event_t * e) lv_draw_rect_dsc_t mid_dsc; lv_draw_rect_dsc_init(&mid_dsc); lv_obj_init_draw_rect_dsc(obj, LV_PART_INDICATOR, &mid_dsc); - lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR) / 2; - lv_coord_t point_h = lv_obj_get_style_height(obj, LV_PART_INDICATOR) / 2; + lv_coord_t w = lv_obj_get_style_width(obj, LV_PART_INDICATOR) / 2; + lv_coord_t h = lv_obj_get_style_height(obj, LV_PART_INDICATOR) / 2; lv_area_t nm_cord; - nm_cord.x1 = scale_center.x - point_w; - nm_cord.y1 = scale_center.y - point_w; - nm_cord.x2 = scale_center.x + point_h; - nm_cord.y2 = scale_center.y + point_h; + nm_cord.x1 = scale_center.x - w; + nm_cord.y1 = scale_center.y - h; + nm_cord.x2 = scale_center.x + w; + nm_cord.y2 = scale_center.y + h; lv_draw_rect(&nm_cord, clip_area, &mid_dsc); } } diff --git a/src/widgets/lv_slider.c b/src/widgets/lv_slider.c index a969ccd70..35836676a 100644 --- a/src/widgets/lv_slider.c +++ b/src/widgets/lv_slider.c @@ -420,9 +420,6 @@ static void position_knob(lv_obj_t * obj, lv_area_t * knob_area, lv_coord_t knob knob_area->x2 = obj->coords.x2; } - lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_KNOB); - lv_area_zoom(zoom, knob_area, knob_area); - lv_coord_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); lv_coord_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); lv_coord_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); From 14bc4e9f8fbc7ee46a374ce3bea70fcde74ba6bf Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 18 Apr 2021 20:39:47 +0200 Subject: [PATCH 015/152] Revert "feat(style) make transform_zoom use pixel or percentage value" This reverts commit 5b4e9fc6f35b2be5cd8687d84012d245b5f971e1. --- src/extra/themes/default/lv_theme_default.c | 10 ++++++++-- src/misc/lv_area.c | 16 +++++++++++++++ src/misc/lv_area.h | 4 ++++ src/widgets/lv_chart.c | 22 ++++++++++----------- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index b7f62ed10..ae64e52f7 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -87,7 +87,7 @@ typedef struct { #endif #if LV_USE_CHART - lv_style_t chart_series, chart_ticks, chart_bg; + lv_style_t chart_series, chart_indic, chart_ticks, chart_bg; #endif #if LV_USE_CHECKBOX @@ -427,6 +427,12 @@ static void style_init(void) lv_style_set_size(&styles->chart_series, LV_DPX(8)); lv_style_set_pad_column(&styles->chart_series, LV_DPX(2)); + style_init_reset(&styles->chart_indic); + lv_style_set_radius(&styles->chart_indic,LV_RADIUS_CIRCLE); + lv_style_set_size(&styles->chart_indic, LV_DPX(8)); + lv_style_set_bg_color(&styles->chart_indic, theme.color_primary); + lv_style_set_bg_opa(&styles->chart_indic, LV_OPA_COVER); + style_init_reset(&styles->chart_ticks); lv_style_set_line_width(&styles->chart_ticks, LV_DPX(1)); lv_style_set_line_color(&styles->chart_ticks, COLOR_SCR_TEXT); @@ -772,7 +778,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) lv_obj_add_style(obj, &styles->scrollbar, LV_PART_SCROLLBAR); lv_obj_add_style(obj, &styles->scrollbar_scrolled, LV_PART_SCROLLBAR | LV_STATE_SCROLLED); lv_obj_add_style(obj, &styles->chart_series, LV_PART_ITEMS); - lv_obj_add_style(obj, &styles->bg_color_primary, LV_PART_ITEMS | LV_STATE_PRESSED); + lv_obj_add_style(obj, &styles->chart_indic, LV_PART_INDICATOR); lv_obj_add_style(obj, &styles->chart_ticks, LV_PART_TICKS); lv_obj_add_style(obj, &styles->chart_series, LV_PART_CURSOR); } diff --git a/src/misc/lv_area.c b/src/misc/lv_area.c index 4ba14eec8..d10782388 100644 --- a/src/misc/lv_area.c +++ b/src/misc/lv_area.c @@ -103,6 +103,22 @@ uint32_t lv_area_get_size(const lv_area_t * area_p) return size; } +void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra) +{ + area->x1 -= w_extra; + area->x2 += w_extra; + area->y1 -= h_extra; + area->y2 += h_extra; +} + +void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs) +{ + area->x1 += x_ofs; + area->x2 += x_ofs; + area->y1 += y_ofs; + area->y2 += y_ofs; +} + /** * Get the common parts of two areas * @param res_p pointer to an area, the result will be stored here diff --git a/src/misc/lv_area.h b/src/misc/lv_area.h index ca09f8c35..6d7736d7d 100644 --- a/src/misc/lv_area.h +++ b/src/misc/lv_area.h @@ -173,6 +173,10 @@ void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y); */ uint32_t lv_area_get_size(const lv_area_t * area_p); +void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra); + +void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs); + /** * Get the common parts of two areas * @param res_p pointer to an area, the result will be stored her diff --git a/src/widgets/lv_chart.c b/src/widgets/lv_chart.c index 14bba52ca..f518e700b 100644 --- a/src/widgets/lv_chart.c +++ b/src/widgets/lv_chart.c @@ -734,12 +734,10 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) lv_draw_rect_dsc_t point_dsc_default; lv_draw_rect_dsc_init(&point_dsc_default); - lv_obj_init_draw_rect_dsc(obj, LV_PART_ITEMS, &point_dsc_default); - - lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_ITEMS) / 2; - lv_coord_t point_h = lv_obj_get_style_height(obj, LV_PART_ITEMS) / 2; - + lv_obj_init_draw_rect_dsc(obj, LV_PART_INDICATOR, &point_dsc_default); + lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR) / 2; + lv_coord_t point_h = lv_obj_get_style_height(obj, LV_PART_INDICATOR) / 2; /*Do not bother with line ending is the point will over it*/ if(LV_MIN(point_w, point_h) > line_dsc_default.width / 2) line_dsc_default.raw_end = 1; @@ -1268,22 +1266,22 @@ static void invalidate_point(lv_obj_t * obj, uint16_t i) if(chart->type == LV_CHART_TYPE_LINE) { lv_coord_t x_ofs = obj->coords.x1 + lv_obj_get_style_pad_left(obj, LV_PART_MAIN) - scroll_left; lv_coord_t line_width = lv_obj_get_style_line_width(obj, LV_PART_ITEMS); - lv_coord_t point_radius = lv_obj_get_style_width(obj, LV_PART_ITEMS); + lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR); lv_area_t coords; lv_area_copy(&coords, &obj->coords); - coords.y1 -= line_width + point_radius; - coords.y2 += line_width + point_radius; + coords.y1 -= line_width + point_w; + coords.y2 += line_width + point_w; if(i < chart->point_cnt - 1) { - coords.x1 = ((w * i) / (chart->point_cnt - 1)) + x_ofs - line_width - point_radius; - coords.x2 = ((w * (i + 1)) / (chart->point_cnt - 1)) + x_ofs + line_width + point_radius; + coords.x1 = ((w * i) / (chart->point_cnt - 1)) + x_ofs - line_width - point_w; + coords.x2 = ((w * (i + 1)) / (chart->point_cnt - 1)) + x_ofs + line_width + point_w; lv_obj_invalidate_area(obj, &coords); } if(i > 0) { - coords.x1 = ((w * (i - 1)) / (chart->point_cnt - 1)) + x_ofs - line_width - point_radius; - coords.x2 = ((w * i) / (chart->point_cnt - 1)) + x_ofs + line_width + point_radius; + coords.x1 = ((w * (i - 1)) / (chart->point_cnt - 1)) + x_ofs - line_width - point_w; + coords.x2 = ((w * i) / (chart->point_cnt - 1)) + x_ofs + line_width + point_w; lv_obj_invalidate_area(obj, &coords); } } From a9ed244bb1f64c7dbb620b43e526896222e0f05b Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 19 Apr 2021 09:44:03 +0200 Subject: [PATCH 016/152] feat(layout) add user_data to layout callbacks It was required for compatibility with the MicroPython binding. --- src/core/lv_obj_pos.c | 39 ++++++++++++++++++++++++-------- src/core/lv_obj_pos.h | 11 +++++++-- src/extra/layouts/flex/lv_flex.c | 19 ++++++++++++---- src/extra/layouts/grid/lv_grid.c | 19 ++++++++++++---- src/misc/lv_gc.h | 2 +- 5 files changed, 67 insertions(+), 23 deletions(-) diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index e36ddbc38..4b92b79c0 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -306,13 +306,16 @@ void lv_obj_update_layout(const lv_obj_t * obj) mutex = false; } -uint32_t lv_layout_register(lv_layout_update_cb_t cb) +uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data) { layout_cnt++; - LV_GC_ROOT(_lv_layout_list) = lv_mem_realloc(LV_GC_ROOT(_lv_layout_list), layout_cnt * sizeof(lv_layout_update_cb_t)); + LV_GC_ROOT(_lv_layout_list) = lv_mem_realloc(LV_GC_ROOT(_lv_layout_list), layout_cnt * sizeof(lv_layout_dsc_t)); LV_ASSERT_MALLOC(LV_GC_ROOT(_lv_layout_list)); - LV_GC_ROOT(_lv_layout_list)[layout_cnt - 1] = cb; + LV_GC_ROOT(_lv_layout_list)[layout_cnt - 1].cb = cb; +#if LV_USE_USER_DATA + LV_GC_ROOT(_lv_layout_list)[layout_cnt - 1].user_data = user_data; +#endif return layout_cnt; /*No -1 to skip 0th index*/ } @@ -605,22 +608,37 @@ void lv_obj_refr_pos(lv_obj_t * obj) if(lv_obj_is_layout_positioned(obj)) return; lv_obj_t * parent = lv_obj_get_parent(obj); - lv_coord_t x = lv_obj_get_style_x(obj, LV_PART_MAIN) + lv_obj_get_style_transform_x(obj, LV_PART_MAIN); - lv_coord_t y = lv_obj_get_style_y(obj, LV_PART_MAIN) + lv_obj_get_style_transform_y(obj, LV_PART_MAIN); + lv_coord_t x = lv_obj_get_style_x(obj, LV_PART_MAIN); + lv_coord_t y = lv_obj_get_style_y(obj, LV_PART_MAIN); + if(parent == NULL) { lv_obj_move_to(obj, x, y); return; } + /*Handle percentage value*/ + lv_coord_t pw = lv_obj_get_width_fit(parent); + lv_coord_t ph = lv_obj_get_height_fit(parent); + if(LV_COORD_IS_PCT(x)) x = (pw * LV_COORD_GET_PCT(x)) / 100; + if(LV_COORD_IS_PCT(y)) y = (ph * LV_COORD_GET_PCT(y)) / 100; + + /*Handle percentage value of translate*/ + lv_coord_t tr_x = lv_obj_get_style_transform_x(obj, LV_PART_MAIN); + lv_coord_t tr_y = lv_obj_get_style_transform_y(obj, LV_PART_MAIN); + lv_coord_t w = lv_obj_get_width(obj); + lv_coord_t h = lv_obj_get_height(obj); + if(LV_COORD_IS_PCT(tr_x)) tr_x = (w * LV_COORD_GET_PCT(tr_x)) / 100; + if(LV_COORD_IS_PCT(tr_y)) tr_y = (h * LV_COORD_GET_PCT(tr_y)) / 100; + + /*Use the translation*/ + x += tr_x; + y += tr_y; + lv_align_t align = lv_obj_get_style_align(obj, LV_PART_MAIN); if(align == LV_ALIGN_TOP_LEFT) { lv_obj_move_to(obj, x, y); } else { - lv_coord_t pw = lv_obj_get_width_fit(parent); - lv_coord_t ph = lv_obj_get_height_fit(parent); - lv_coord_t w = lv_obj_get_width(obj); - lv_coord_t h = lv_obj_get_height(obj); switch(align) { case LV_ALIGN_TOP_MID: @@ -950,7 +968,8 @@ static void layout_update_core(lv_obj_t * obj) if(lv_obj_get_child_cnt(obj) > 0) { uint32_t layout_id = lv_obj_get_style_layout(obj, LV_PART_MAIN); if(layout_id > 0 && layout_id <= layout_cnt) { - LV_GC_ROOT(_lv_layout_list)[layout_id -1](obj); + void * user_data = LV_GC_ROOT(_lv_layout_list)[layout_id -1].user_data; + LV_GC_ROOT(_lv_layout_list)[layout_id -1].cb(obj, user_data); } } } diff --git a/src/core/lv_obj_pos.h b/src/core/lv_obj_pos.h index ab171bcf0..80ee76e1b 100644 --- a/src/core/lv_obj_pos.h +++ b/src/core/lv_obj_pos.h @@ -23,7 +23,13 @@ extern "C" { * TYPEDEFS **********************/ struct _lv_obj_t; -typedef void (*lv_layout_update_cb_t)(struct _lv_obj_t *); +typedef void (*lv_layout_update_cb_t)(struct _lv_obj_t *, void * user_data); +typedef struct { + lv_layout_update_cb_t cb; +#if LV_USE_USER_DATA + void * user_data; +#endif +}lv_layout_dsc_t; /********************** * GLOBAL PROTOTYPES @@ -133,9 +139,10 @@ void lv_obj_update_layout(const struct _lv_obj_t * obj); /** * Regsiter a new layout * @param cb the layout update callback + * @param user_data custom data that will be passed to `cb` * @return the ID of the new layout */ -uint32_t lv_layout_register(lv_layout_update_cb_t cb); +uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data); /** * Align an object to an other object. diff --git a/src/extra/layouts/flex/lv_flex.c b/src/extra/layouts/flex/lv_flex.c index ce41dfb17..b07330569 100644 --- a/src/extra/layouts/flex/lv_flex.c +++ b/src/extra/layouts/flex/lv_flex.c @@ -53,7 +53,7 @@ typedef struct { /********************** * STATIC PROTOTYPES **********************/ -static void flex_update(lv_obj_t * cont); +static void flex_update(lv_obj_t * cont, void * user_data); static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id, lv_coord_t item_gap, lv_coord_t max_main_size, track_t * t); static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, int32_t item_last_id, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t max_main_size, lv_coord_t item_gap, track_t * t); static void place_content(lv_flex_place_t place, lv_coord_t max_size, lv_coord_t content_size, lv_coord_t item_cnt, lv_coord_t * start_pos, lv_coord_t * gap); @@ -88,7 +88,7 @@ lv_style_prop_t LV_STYLE_FLEX_GROW; void lv_flex_init(void) { - LV_LAYOUT_FLEX = lv_layout_register(flex_update); + LV_LAYOUT_FLEX = lv_layout_register(flex_update, NULL); LV_STYLE_FLEX_FLOW = lv_style_register_prop(); LV_STYLE_FLEX_MAIN_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; @@ -119,9 +119,10 @@ void lv_obj_set_flex_grow(struct _lv_obj_t * obj, uint8_t grow) * STATIC FUNCTIONS **********************/ -static void flex_update(lv_obj_t * cont) +static void flex_update(lv_obj_t * cont, void * user_data) { LV_LOG_INFO("update %p container", cont); + LV_UNUSED(user_data); flex_t f; lv_flex_flow_t flow = lv_obj_get_style_flex_flow(cont, LV_PART_MAIN); @@ -399,8 +400,16 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i if(f->row && rtl) main_pos -= area_get_main_size(&item->coords); - lv_coord_t diff_x = abs_x - item->coords.x1 + lv_obj_get_style_transform_x(item, 0); - lv_coord_t diff_y = abs_y - item->coords.y1 + lv_obj_get_style_transform_y(item, 0); + /*Handle percentage value of translate*/ + lv_coord_t tr_x = lv_obj_get_style_transform_x(item, LV_PART_MAIN); + lv_coord_t tr_y = lv_obj_get_style_transform_y(item, LV_PART_MAIN); + lv_coord_t w = lv_obj_get_width(item); + lv_coord_t h = lv_obj_get_height(item); + if(LV_COORD_IS_PCT(tr_x)) tr_x = (w * LV_COORD_GET_PCT(tr_x)) / 100; + if(LV_COORD_IS_PCT(tr_y)) tr_y = (h * LV_COORD_GET_PCT(tr_y)) / 100; + + lv_coord_t diff_x = abs_x - item->coords.x1 + tr_x; + lv_coord_t diff_y = abs_y - item->coords.y1 + tr_y; diff_x += f->row ? main_pos : cross_pos; diff_y += f->row ? cross_pos : main_pos; diff --git a/src/extra/layouts/grid/lv_grid.c b/src/extra/layouts/grid/lv_grid.c index ed7f5e300..89c92afd4 100644 --- a/src/extra/layouts/grid/lv_grid.c +++ b/src/extra/layouts/grid/lv_grid.c @@ -48,7 +48,7 @@ typedef struct { /********************** * STATIC PROTOTYPES **********************/ -static void grid_update(lv_obj_t * cont); +static void grid_update(lv_obj_t * cont, void * user_data); static void calc(struct _lv_obj_t * obj, _lv_grid_calc_t * calc); static void calc_free(_lv_grid_calc_t * calc); static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c); @@ -98,7 +98,7 @@ lv_style_prop_t LV_STYLE_GRID_CELL_ROW_PLACE; void lv_grid_init(void) { - LV_LAYOUT_GRID = lv_layout_register(grid_update); + LV_LAYOUT_GRID = lv_layout_register(grid_update, NULL); LV_STYLE_GRID_COLUMN_DSC_ARRAY = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; LV_STYLE_GRID_ROW_DSC_ARRAY = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; @@ -146,9 +146,10 @@ void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_place_t hor_place, uint8_t col * STATIC FUNCTIONS **********************/ -static void grid_update(lv_obj_t * cont) +static void grid_update(lv_obj_t * cont, void * user_data) { LV_LOG_INFO("update %p container", cont); + LV_UNUSED(user_data); const lv_coord_t * col_templ = get_col_dsc(cont); const lv_coord_t * row_templ = get_row_dsc(cont); @@ -445,8 +446,16 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * } - x += lv_obj_get_style_transform_x(item, LV_PART_MAIN); - y += lv_obj_get_style_transform_y(item, LV_PART_MAIN); + /*Handle percentage value of translate*/ + lv_coord_t tr_x = lv_obj_get_style_transform_x(item, LV_PART_MAIN); + lv_coord_t tr_y = lv_obj_get_style_transform_y(item, LV_PART_MAIN); + lv_coord_t w = lv_obj_get_width(item); + lv_coord_t h = lv_obj_get_height(item); + if(LV_COORD_IS_PCT(tr_x)) tr_x = (w * LV_COORD_GET_PCT(tr_x)) / 100; + if(LV_COORD_IS_PCT(tr_y)) tr_y = (h * LV_COORD_GET_PCT(tr_y)) / 100; + + x += tr_x; + y += tr_y; lv_coord_t diff_x = hint->grid_abs.x + x - item->coords.x1; lv_coord_t diff_y = hint->grid_abs.y + y - item->coords.y1; diff --git a/src/misc/lv_gc.h b/src/misc/lv_gc.h index 3f4eac329..5f00f4377 100644 --- a/src/misc/lv_gc.h +++ b/src/misc/lv_gc.h @@ -48,7 +48,7 @@ extern "C" { LV_DISPATCH(f, lv_ll_t, _lv_group_ll) \ LV_DISPATCH(f, lv_ll_t, _lv_img_decoder_ll) \ LV_DISPATCH(f, lv_ll_t, _lv_obj_style_trans_ll) \ - LV_DISPATCH(f, lv_layout_update_cb_t *, _lv_layout_list) \ + LV_DISPATCH(f, lv_layout_dsc_t *, _lv_layout_list) \ LV_DISPATCH_COND(f, lv_img_cache_entry_t*, _lv_img_cache_array, LV_IMG_CACHE_DEF, 1) \ LV_DISPATCH_COND(f, lv_img_cache_entry_t, _lv_img_cache_single, LV_IMG_CACHE_DEF, 0) \ LV_DISPATCH(f, lv_timer_t*, _lv_timer_act) \ From 1c53d26bccf75885ff6b3b56a2fb2cd2696b5972 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 19 Apr 2021 10:02:16 +0200 Subject: [PATCH 017/152] feat(event) add lv_obj_remove_event_dsc and remove user_data from lv_obj_remove_event_cb --- src/core/lv_obj.c | 55 +++++++++++++++++++++++++++++++---------------- src/core/lv_obj.h | 16 +++++++++----- 2 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index 0924ee705..c28348e6f 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -361,7 +361,7 @@ void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state) } } -void lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data) +struct _lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_obj_allocate_spec_attr(obj); @@ -372,9 +372,11 @@ void lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_dat obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1].cb = event_cb; obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1].user_data = user_data; + + return &obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1]; } -bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data) +bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb) { LV_ASSERT_OBJ(obj, MY_CLASS); if(obj->spec_attr == NULL) return false; @@ -382,27 +384,44 @@ bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_ int32_t i = 0; for(i = 0; i < obj->spec_attr->event_dsc_cnt; i++) { if(obj->spec_attr->event_dsc[i].cb == event_cb) { - /*Check if user_data matches or if the requested user_data is NULL*/ - if(user_data == NULL || obj->spec_attr->event_dsc[i].user_data == user_data) { - /*Found*/ - break; + /*Shift the remaining event handlers forward*/ + for(; i < (obj->spec_attr->event_dsc_cnt-1); i++) { + obj->spec_attr->event_dsc[i].cb = obj->spec_attr->event_dsc[i+1].cb; + obj->spec_attr->event_dsc[i].user_data = obj->spec_attr->event_dsc[i+1].user_data; } + obj->spec_attr->event_dsc_cnt--; + obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc, obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t)); + LV_ASSERT_MALLOC(obj->spec_attr->event_dsc); + return true; } } - if(i >= obj->spec_attr->event_dsc_cnt) { - /*No event handler found*/ - return false; + + /*No event handler found*/ + return false; +} + +bool lv_obj_remove_event_dsc(lv_obj_t * obj, struct _lv_event_dsc_t * event_dsc) +{ + LV_ASSERT_OBJ(obj, MY_CLASS); + if(obj->spec_attr == NULL) return false; + + int32_t i = 0; + for(i = 0; i < obj->spec_attr->event_dsc_cnt; i++) { + if(&obj->spec_attr->event_dsc[i] == event_dsc) { + /*Shift the remaining event handlers forward*/ + for(; i < (obj->spec_attr->event_dsc_cnt-1); i++) { + obj->spec_attr->event_dsc[i].cb = obj->spec_attr->event_dsc[i+1].cb; + obj->spec_attr->event_dsc[i].user_data = obj->spec_attr->event_dsc[i+1].user_data; + } + obj->spec_attr->event_dsc_cnt--; + obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc, obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t)); + LV_ASSERT_MALLOC(obj->spec_attr->event_dsc); + return true; + } } - /*Shift the remaining event handlers forward*/ - for(; i < (obj->spec_attr->event_dsc_cnt-1); i++) { - obj->spec_attr->event_dsc[i].cb = obj->spec_attr->event_dsc[i+1].cb; - obj->spec_attr->event_dsc[i].user_data = obj->spec_attr->event_dsc[i+1].user_data; - } - obj->spec_attr->event_dsc_cnt--; - obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc, obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t)); - LV_ASSERT_MALLOC(obj->spec_attr->event_dsc); - return true; + /*No event handler found*/ + return false; } void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir) diff --git a/src/core/lv_obj.h b/src/core/lv_obj.h index 7fa4586c9..94dc59bca 100644 --- a/src/core/lv_obj.h +++ b/src/core/lv_obj.h @@ -390,19 +390,25 @@ void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state); * @param obj pointer to an object * @param event_cb the new event function * @param user_data custom data data will be available in `event_cb` + * @return a pointer the event descriptor. Can be used in ::lv_obj_remove_event_dsc */ -void lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data); +struct _lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data); /** * Remove an event handler function for an object. - * Used by the user to react on event which happens with the object. - * An object can have multiple event handler. They will be called in the same order as they were added. * @param obj pointer to an object * @param event_cb the event function to remove - * @param user_data if NULL, remove the first event handler with the same cb, otherwise remove the first event handler with the same cb and user_data * @return true if any event handlers were removed */ -bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data); +bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb); + +/** + * Remove an event handler function for an object. + * @param obj pointer to an object + * @param event_dsc pointer to an event descriptor to remove (returned by ::lv_obj_add_event_cb) + * @return true if any event handlers were removed + */ +bool lv_obj_remove_event_dsc(lv_obj_t * obj, struct _lv_event_dsc_t * event_dsc); /** * Set the base direction of the object From 0a10d45c51e7cbcf78e5afdee95362404121209e Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 19 Apr 2021 10:03:17 +0200 Subject: [PATCH 018/152] fix(scroll) fix refactoring issue in scrollbar size calculation --- src/core/lv_obj_scroll.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/lv_obj_scroll.c b/src/core/lv_obj_scroll.c index efd3a6bf2..553e84c3e 100644 --- a/src/core/lv_obj_scroll.c +++ b/src/core/lv_obj_scroll.c @@ -455,13 +455,13 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * ver_area->y2 =ver_area->y1 + sb_h - 1; ver_area->x2 = obj->coords.x2 - side_space; ver_area->x1 =ver_area->x2 - tickness; - if(hor_area->y1 < obj->coords.y1 + end_space) { + if(ver_area->y1 < obj->coords.y1 + end_space) { ver_area->y1 = obj->coords.y1 + end_space; - if(hor_area->y1 + SCROLLBAR_MIN_SIZE >ver_area->y2)ver_area->y2 =ver_area->y1 + SCROLLBAR_MIN_SIZE; + if(ver_area->y1 + SCROLLBAR_MIN_SIZE >ver_area->y2)ver_area->y2 =ver_area->y1 + SCROLLBAR_MIN_SIZE; } - if(hor_area->y2 > obj->coords.y2 - hor_req_space - end_space) { + if(ver_area->y2 > obj->coords.y2 - hor_req_space - end_space) { ver_area->y2 = obj->coords.y2 - hor_req_space - end_space; - if(hor_area->y2 - SCROLLBAR_MIN_SIZE y1)ver_area->y1 =ver_area->y2 - SCROLLBAR_MIN_SIZE; + if(ver_area->y2 - SCROLLBAR_MIN_SIZE y1)ver_area->y1 =ver_area->y2 - SCROLLBAR_MIN_SIZE; } } } From ddea17afe2b8224a63516bdf1a87bcb27ffc573e Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 19 Apr 2021 10:04:08 +0200 Subject: [PATCH 019/152] feat(theme) add outline padding for the focused state in the default theme --- src/extra/themes/default/lv_theme_default.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index ae64e52f7..4e77f460c 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -91,7 +91,7 @@ typedef struct { #endif #if LV_USE_CHECKBOX - lv_style_t cb_marker, cb_marker_checked, cb_bg_outline_pad; + lv_style_t cb_marker, cb_marker_checked; #endif #if LV_USE_SWITCH @@ -256,6 +256,7 @@ static void style_init(void) style_init_reset(&styles->outline_primary); lv_style_set_outline_color(&styles->outline_primary, color_primary_accent); lv_style_set_outline_width(&styles->outline_primary, OUTLINE_WIDTH); + lv_style_set_outline_pad(&styles->outline_primary, OUTLINE_WIDTH); lv_style_set_outline_opa(&styles->outline_primary, LV_OPA_50); style_init_reset(&styles->outline_secondary); @@ -399,9 +400,6 @@ static void style_init(void) lv_style_set_bg_img_src(&styles->cb_marker_checked, LV_SYMBOL_OK); lv_style_set_text_color(&styles->cb_marker_checked, lv_color_white()); lv_style_set_text_font(&styles->cb_marker_checked, theme.font_small); - - style_init_reset(&styles->cb_bg_outline_pad); - lv_style_set_outline_pad(&styles->cb_bg_outline_pad, LV_DPX(5)); #endif #if LV_USE_SWITCH @@ -740,7 +738,6 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) else if(lv_obj_check_type(obj, &lv_checkbox_class)) { lv_obj_add_style(obj, &styles->pad_gap, 0); lv_obj_add_style(obj, &styles->outline_primary, LV_STATE_FOCUS_KEY); - lv_obj_add_style(obj, &styles->cb_bg_outline_pad, LV_STATE_FOCUS_KEY); lv_obj_add_style(obj, &styles->disabled, LV_PART_INDICATOR | LV_STATE_DISABLED); lv_obj_add_style(obj, &styles->cb_marker, LV_PART_INDICATOR); lv_obj_add_style(obj, &styles->bg_color_primary, LV_PART_INDICATOR | LV_STATE_CHECKED); From bbfcb2454e28c679fc0863d925c6e600dcc0549c Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 19 Apr 2021 11:15:28 +0200 Subject: [PATCH 020/152] feat(event) add event filter to lv_event_send --- .../get_started/lv_example_get_started_1.c | 2 +- .../get_started/lv_example_get_started_3.c | 11 +-- examples/scroll/lv_example_scroll_2.c | 2 +- examples/scroll/lv_example_scroll_3.c | 2 +- examples/widgets/btn/lv_example_btn_1.c | 4 +- .../btnmatrix/lv_example_btnmatrix_1.c | 2 +- .../btnmatrix/lv_example_btnmatrix_2.c | 2 +- .../btnmatrix/lv_example_btnmatrix_3.c | 31 ++++---- .../widgets/calendar/lv_example_calendar_1.c | 2 +- examples/widgets/chart/lv_example_chart_2.c | 59 +++++++-------- examples/widgets/chart/lv_example_chart_3.c | 15 ++-- examples/widgets/chart/lv_example_chart_4.c | 2 +- examples/widgets/chart/lv_example_chart_5.c | 17 ++--- examples/widgets/chart/lv_example_chart_6.c | 2 +- .../widgets/checkbox/lv_example_checkbox_1.c | 8 +- .../widgets/dropdown/lv_example_dropdown_1.c | 2 +- .../widgets/dropdown/lv_example_dropdown_3.c | 11 +-- examples/widgets/img/lv_example_img_2.c | 16 ++-- .../widgets/keyboard/lv_example_keyboard_1.c | 4 +- examples/widgets/msgbox/lv_example_msgbox_1.c | 7 +- examples/widgets/roller/lv_example_roller_1.c | 2 +- examples/widgets/roller/lv_example_roller_2.c | 6 +- examples/widgets/slider/lv_example_slider_1.c | 13 ++-- .../widgets/spinbox/lv_example_spinbox_1.c | 4 +- examples/widgets/switch/lv_example_switch_1.c | 8 +- examples/widgets/table/lv_example_table_1.c | 45 ++++++----- examples/widgets/table/lv_example_table_2.c | 75 ++++++++++--------- .../widgets/textarea/lv_example_textarea_1.c | 15 ++-- .../widgets/textarea/lv_example_textarea_2.c | 2 +- .../widgets/textarea/lv_example_textarea_3.c | 19 ++--- src/core/lv_obj.c | 6 +- src/core/lv_obj.h | 5 +- src/extra/themes/default/lv_theme_default.c | 2 +- src/extra/widgets/calendar/lv_calendar.c | 67 ++++++++--------- .../calendar/lv_calendar_header_arrow.c | 8 +- .../calendar/lv_calendar_header_dropdown.c | 10 +-- src/extra/widgets/keyboard/lv_keyboard.c | 6 +- src/extra/widgets/list/lv_list.c | 2 +- src/extra/widgets/msgbox/lv_msgbox.c | 13 ++-- src/extra/widgets/tabview/lv_tabview.c | 38 ++++------ src/extra/widgets/tileview/lv_tileview.c | 2 +- src/extra/widgets/win/lv_win.c | 2 +- src/misc/lv_color.h | 4 +- 43 files changed, 249 insertions(+), 306 deletions(-) diff --git a/examples/get_started/lv_example_get_started_1.c b/examples/get_started/lv_example_get_started_1.c index 77c4c18e8..c63e94d06 100644 --- a/examples/get_started/lv_example_get_started_1.c +++ b/examples/get_started/lv_example_get_started_1.c @@ -23,7 +23,7 @@ void lv_example_get_started_1(void) lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button the current screen*/ lv_obj_set_pos(btn, 10, 10); /*Set its position*/ lv_obj_set_size(btn, 120, 50); /*Set its size*/ - lv_obj_add_event_cb(btn, btn_event_cb, NULL); /*Assign a callback to the button*/ + lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_ALL, NULL); /*Assign a callback to the button*/ lv_obj_t * label = lv_label_create(btn); /*Add a label to the button*/ lv_label_set_text(label, "Button"); /*Set the labels text*/ diff --git a/examples/get_started/lv_example_get_started_3.c b/examples/get_started/lv_example_get_started_3.c index e49792c22..853b879c7 100644 --- a/examples/get_started/lv_example_get_started_3.c +++ b/examples/get_started/lv_example_get_started_3.c @@ -5,14 +5,11 @@ static lv_obj_t * label; static void slider_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * slider = lv_event_get_target(e); - if(code == LV_EVENT_VALUE_CHANGED) { - /*Refresh the text*/ - lv_label_set_text_fmt(label, "%d", lv_slider_get_value(slider)); - lv_obj_align_to(label, slider, LV_ALIGN_OUT_TOP_MID, 0, -15); /*Align below the slider*/ - } + /*Refresh the text*/ + lv_label_set_text_fmt(label, "%d", lv_slider_get_value(slider)); + lv_obj_align_to(label, slider, LV_ALIGN_OUT_TOP_MID, 0, -15); /*Align below the slider*/ } /** @@ -24,7 +21,7 @@ void lv_example_get_started_3(void) lv_obj_t * slider = lv_slider_create(lv_scr_act()); lv_obj_set_width(slider, 200); /*Set the width*/ lv_obj_center(slider); /*Align to the center of the parent (screen)*/ - lv_obj_add_event_cb(slider, slider_event_cb, NULL); /*Assign an event function*/ + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); /*Assign an event function*/ /*Create a label below the slider*/ label = lv_label_create(lv_scr_act()); diff --git a/examples/scroll/lv_example_scroll_2.c b/examples/scroll/lv_example_scroll_2.c index ea5db7da5..c39c15c08 100644 --- a/examples/scroll/lv_example_scroll_2.c +++ b/examples/scroll/lv_example_scroll_2.c @@ -46,7 +46,7 @@ void lv_example_scroll_2(void) /*Switch between "One scroll" and "Normal scroll" mode*/ lv_obj_t * sw = lv_switch_create(lv_scr_act()); lv_obj_align(sw, LV_ALIGN_TOP_RIGHT, -20, 10); - lv_obj_add_event_cb(sw, sw_event_cb, panel); + lv_obj_add_event_cb(sw, sw_event_cb, LV_EVENT_ALL, panel); lv_obj_t * label = lv_label_create(lv_scr_act()); lv_label_set_text(label, "One scroll"); lv_obj_align_to(label, sw, LV_ALIGN_OUT_BOTTOM_MID, 0, 5); diff --git a/examples/scroll/lv_example_scroll_3.c b/examples/scroll/lv_example_scroll_3.c index c576883ff..89a0696f3 100644 --- a/examples/scroll/lv_example_scroll_3.c +++ b/examples/scroll/lv_example_scroll_3.c @@ -40,7 +40,7 @@ void lv_example_scroll_3(void) lv_obj_set_size(float_btn, 50, 50); lv_obj_add_flag(float_btn, LV_OBJ_FLAG_FLOATING); lv_obj_align(float_btn, LV_ALIGN_BOTTOM_RIGHT, 0, -lv_obj_get_style_pad_right(list, LV_PART_MAIN)); - lv_obj_add_event_cb(float_btn, float_btn_event_cb, list); + lv_obj_add_event_cb(float_btn, float_btn_event_cb, LV_EVENT_ALL, list); lv_obj_set_style_radius(float_btn, LV_RADIUS_CIRCLE, 0); lv_obj_set_style_bg_img_src(float_btn, LV_SYMBOL_PLUS, 0); lv_obj_set_style_text_font(float_btn, lv_theme_get_font_large(float_btn), 0); diff --git a/examples/widgets/btn/lv_example_btn_1.c b/examples/widgets/btn/lv_example_btn_1.c index 98966d0eb..1845e2094 100644 --- a/examples/widgets/btn/lv_example_btn_1.c +++ b/examples/widgets/btn/lv_example_btn_1.c @@ -18,7 +18,7 @@ void lv_example_btn_1(void) lv_obj_t * label; lv_obj_t * btn1 = lv_btn_create(lv_scr_act()); - lv_obj_add_event_cb(btn1, event_handler, NULL); + lv_obj_add_event_cb(btn1, event_handler, LV_EVENT_ALL, NULL); lv_obj_align(btn1, LV_ALIGN_CENTER, 0, -40); label = lv_label_create(btn1); @@ -26,7 +26,7 @@ void lv_example_btn_1(void) lv_obj_center(label); lv_obj_t * btn2 = lv_btn_create(lv_scr_act()); - lv_obj_add_event_cb(btn2, event_handler, NULL); + lv_obj_add_event_cb(btn2, event_handler, LV_EVENT_ALL, NULL); lv_obj_align(btn2, LV_ALIGN_CENTER, 0, 40); lv_obj_add_flag(btn2, LV_OBJ_FLAG_CHECKABLE); lv_obj_set_height(btn2, LV_SIZE_CONTENT); diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c b/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c index a80445d07..3119ede17 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c @@ -26,7 +26,7 @@ void lv_example_btnmatrix_1(void) lv_btnmatrix_set_btn_ctrl(btnm1, 10, LV_BTNMATRIX_CTRL_CHECKABLE); lv_btnmatrix_set_btn_ctrl(btnm1, 11, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align(btnm1, LV_ALIGN_CENTER, 0, 0); - lv_obj_add_event_cb(btnm1, event_handler, NULL); + lv_obj_add_event_cb(btnm1, event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c b/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c index a72aab677..9be774ce3 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c @@ -65,7 +65,7 @@ static void event_cb(lv_event_t * e) void lv_example_btnmatrix_2(void) { lv_obj_t * btnm = lv_btnmatrix_create(lv_scr_act()); - lv_obj_add_event_cb(btnm, event_cb, NULL); + lv_obj_add_event_cb(btnm, event_cb, LV_EVENT_ALL, NULL); lv_obj_center(btnm); } diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c b/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c index 46d3bddce..f35043d0e 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c @@ -3,24 +3,21 @@ static void event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); - if(code == LV_EVENT_VALUE_CHANGED) { - uint32_t id = lv_btnmatrix_get_selected_btn(obj); - bool prev = id == 0 ? true : false; - bool next = id == 6 ? true : false; - if(prev || next) { - /*Find the checked button*/ - uint32_t i; - for(i = 1; i < 7; i++) { - if(lv_btnmatrix_has_btn_ctrl(obj, i, LV_BTNMATRIX_CTRL_CHECKED)) break; - } - - if(prev && i > 1) i--; - else if(next && i < 5) i++; - - lv_btnmatrix_set_btn_ctrl(obj, i, LV_BTNMATRIX_CTRL_CHECKED); + uint32_t id = lv_btnmatrix_get_selected_btn(obj); + bool prev = id == 0 ? true : false; + bool next = id == 6 ? true : false; + if(prev || next) { + /*Find the checked button*/ + uint32_t i; + for(i = 1; i < 7; i++) { + if(lv_btnmatrix_has_btn_ctrl(obj, i, LV_BTNMATRIX_CTRL_CHECKED)) break; } + + if(prev && i > 1) i--; + else if(next && i < 5) i++; + + lv_btnmatrix_set_btn_ctrl(obj, i, LV_BTNMATRIX_CTRL_CHECKED); } } @@ -53,7 +50,7 @@ void lv_example_btnmatrix_3(void) lv_btnmatrix_set_map(btnm, map); lv_obj_add_style(btnm, &style_bg, 0); lv_obj_add_style(btnm, &style_btn, LV_PART_ITEMS); - lv_obj_add_event_cb(btnm, event_cb, NULL); + lv_obj_add_event_cb(btnm, event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_set_size(btnm, 225, 35); /*Allow selecting on one number at time*/ diff --git a/examples/widgets/calendar/lv_example_calendar_1.c b/examples/widgets/calendar/lv_example_calendar_1.c index bc9fc9a8e..6ccd7976c 100644 --- a/examples/widgets/calendar/lv_example_calendar_1.c +++ b/examples/widgets/calendar/lv_example_calendar_1.c @@ -19,7 +19,7 @@ void lv_example_calendar_1(void) lv_obj_t * calendar = lv_calendar_create(lv_scr_act()); lv_obj_set_size(calendar, 200, 200); lv_obj_align(calendar, LV_ALIGN_CENTER, 0, 20); - lv_obj_add_event_cb(calendar, event_handler, NULL); + lv_obj_add_event_cb(calendar, event_handler, LV_EVENT_ALL, NULL); lv_calendar_set_today_date(calendar, 2021, 02, 23); lv_calendar_set_showed_date(calendar, 2021, 02); diff --git a/examples/widgets/chart/lv_example_chart_2.c b/examples/widgets/chart/lv_example_chart_2.c index 32ed105b4..63a430432 100644 --- a/examples/widgets/chart/lv_example_chart_2.c +++ b/examples/widgets/chart/lv_example_chart_2.c @@ -5,45 +5,42 @@ static lv_obj_t * chart1; static lv_chart_series_t * ser1; static lv_chart_series_t * ser2; -static void event_cb(lv_event_t * e) +static void draw_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); /*Add the faded area before the lines are drawn*/ - if(code == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); - if(dsc->part != LV_PART_ITEMS) return; - if(!dsc->p1 || !dsc->p2) return; + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); + if(dsc->part != LV_PART_ITEMS) return; + if(!dsc->p1 || !dsc->p2) return; - /*Add a line mask that keeps the area below the line*/ - lv_draw_mask_line_param_t line_mask_param; - lv_draw_mask_line_points_init(&line_mask_param, dsc->p1->x, dsc->p1->y, dsc->p2->x, dsc->p2->y, LV_DRAW_MASK_LINE_SIDE_BOTTOM); - int16_t line_mask_id = lv_draw_mask_add(&line_mask_param, NULL); + /*Add a line mask that keeps the area below the line*/ + lv_draw_mask_line_param_t line_mask_param; + lv_draw_mask_line_points_init(&line_mask_param, dsc->p1->x, dsc->p1->y, dsc->p2->x, dsc->p2->y, LV_DRAW_MASK_LINE_SIDE_BOTTOM); + int16_t line_mask_id = lv_draw_mask_add(&line_mask_param, NULL); - /*Add a fade effect: transparent bottom covering top*/ - lv_coord_t h = lv_obj_get_height(obj); - lv_draw_mask_fade_param_t fade_mask_param; - lv_draw_mask_fade_init(&fade_mask_param, &obj->coords, LV_OPA_COVER, obj->coords.y1 + h / 8, LV_OPA_TRANSP,obj->coords.y2); - int16_t fade_mask_id = lv_draw_mask_add(&fade_mask_param, NULL); + /*Add a fade effect: transparent bottom covering top*/ + lv_coord_t h = lv_obj_get_height(obj); + lv_draw_mask_fade_param_t fade_mask_param; + lv_draw_mask_fade_init(&fade_mask_param, &obj->coords, LV_OPA_COVER, obj->coords.y1 + h / 8, LV_OPA_TRANSP,obj->coords.y2); + int16_t fade_mask_id = lv_draw_mask_add(&fade_mask_param, NULL); - /*Draw a rectangle that will be affected by the mask*/ - lv_draw_rect_dsc_t draw_rect_dsc; - lv_draw_rect_dsc_init(&draw_rect_dsc); - draw_rect_dsc.bg_opa = LV_OPA_20; - draw_rect_dsc.bg_color = dsc->line_dsc->color; + /*Draw a rectangle that will be affected by the mask*/ + lv_draw_rect_dsc_t draw_rect_dsc; + lv_draw_rect_dsc_init(&draw_rect_dsc); + draw_rect_dsc.bg_opa = LV_OPA_20; + draw_rect_dsc.bg_color = dsc->line_dsc->color; - lv_area_t a; - a.x1 = dsc->p1->x; - a.x2 = dsc->p2->x - 1; - a.y1 = LV_MIN(dsc->p1->y, dsc->p2->y); - a.y2 = obj->coords.y2; - lv_draw_rect(&a, dsc->clip_area, &draw_rect_dsc); + lv_area_t a; + a.x1 = dsc->p1->x; + a.x2 = dsc->p2->x - 1; + a.y1 = LV_MIN(dsc->p1->y, dsc->p2->y); + a.y2 = obj->coords.y2; + lv_draw_rect(&a, dsc->clip_area, &draw_rect_dsc); - /*Remove the masks*/ - lv_draw_mask_remove_id(line_mask_id); - lv_draw_mask_remove_id(fade_mask_id); - } + /*Remove the masks*/ + lv_draw_mask_remove_id(line_mask_id); + lv_draw_mask_remove_id(fade_mask_id); } static void add_data(lv_timer_t * timer) @@ -68,7 +65,7 @@ void lv_example_chart_2(void) lv_obj_center(chart1); lv_chart_set_type(chart1, LV_CHART_TYPE_LINE); /*Show lines and points too*/ - lv_obj_add_event_cb(chart1, event_cb, NULL); + lv_obj_add_event_cb(chart1, draw_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL); lv_chart_set_update_mode(chart1, LV_CHART_UPDATE_MODE_CIRCULAR); /*Add two data series*/ diff --git a/examples/widgets/chart/lv_example_chart_3.c b/examples/widgets/chart/lv_example_chart_3.c index c06ab25e8..ab41e0703 100644 --- a/examples/widgets/chart/lv_example_chart_3.c +++ b/examples/widgets/chart/lv_example_chart_3.c @@ -1,15 +1,12 @@ #include "../../lv_examples.h" #if LV_USE_CHART && LV_BUILD_EXAMPLES -static void event_cb(lv_event_t * e) +static void draw_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); - if(code == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); - if(dsc->part == LV_PART_TICKS && dsc->id == LV_CHART_AXIS_X) { - const char * month[] = {"Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"}; - lv_snprintf(dsc->text, sizeof(dsc->text), "%s", month[dsc->value]); - } + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); + if(dsc->part == LV_PART_TICKS && dsc->id == LV_CHART_AXIS_X) { + const char * month[] = {"Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"}; + lv_snprintf(dsc->text, sizeof(dsc->text), "%s", month[dsc->value]); } } @@ -27,7 +24,7 @@ void lv_example_chart_3(void) lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, 0, 100); lv_chart_set_range(chart, LV_CHART_AXIS_SECONDARY_Y, 0, 400); lv_chart_set_point_count(chart, 12); - lv_obj_add_event_cb(chart, event_cb, NULL); + lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL); /*Add ticks and label to every axis*/ lv_chart_set_axis_tick(chart, LV_CHART_AXIS_X, 10, 5, 12, 3, true, 40); diff --git a/examples/widgets/chart/lv_example_chart_4.c b/examples/widgets/chart/lv_example_chart_4.c index eb085aa92..4d86c986e 100644 --- a/examples/widgets/chart/lv_example_chart_4.c +++ b/examples/widgets/chart/lv_example_chart_4.c @@ -64,7 +64,7 @@ void lv_example_chart_4(void) lv_obj_set_size(chart, 200, 150); lv_obj_center(chart); - lv_obj_add_event_cb(chart, event_cb, NULL); + lv_obj_add_event_cb(chart, event_cb, LV_EVENT_ALL, NULL); lv_obj_refresh_ext_draw_size(chart); /*Zoom in a little in X*/ diff --git a/examples/widgets/chart/lv_example_chart_5.c b/examples/widgets/chart/lv_example_chart_5.c index 50a5bcfdf..9089604c1 100644 --- a/examples/widgets/chart/lv_example_chart_5.c +++ b/examples/widgets/chart/lv_example_chart_5.c @@ -48,21 +48,16 @@ static const lv_coord_t ecg_sample[] = { static void slider_x_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); - if(code == LV_EVENT_VALUE_CHANGED) { - int32_t v = lv_slider_get_value(obj); - lv_chart_set_zoom_x(chart, v); - } + int32_t v = lv_slider_get_value(obj); + lv_chart_set_zoom_x(chart, v); } static void slider_y_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); - if(code == LV_EVENT_VALUE_CHANGED) { - lv_chart_set_zoom_y(chart, lv_slider_get_value(obj)); - } + int32_t v = lv_slider_get_value(obj); + lv_chart_set_zoom_y(chart, v); } /** @@ -90,13 +85,13 @@ void lv_example_chart_5(void) lv_obj_t * slider; slider = lv_slider_create(lv_scr_act()); lv_slider_set_range(slider, LV_IMG_ZOOM_NONE, LV_IMG_ZOOM_NONE * 10); - lv_obj_add_event_cb(slider, slider_x_event_cb, NULL); + lv_obj_add_event_cb(slider, slider_x_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_set_size(slider, lv_obj_get_width(chart), 10); lv_obj_align_to(slider, chart, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); slider = lv_slider_create(lv_scr_act()); lv_slider_set_range(slider, LV_IMG_ZOOM_NONE, LV_IMG_ZOOM_NONE * 10); - lv_obj_add_event_cb(slider, slider_y_event_cb, NULL); + lv_obj_add_event_cb(slider, slider_y_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_set_size(slider, 10, lv_obj_get_height(chart)); lv_obj_align_to(slider, chart, LV_ALIGN_OUT_RIGHT_MID, 20, 0); } diff --git a/examples/widgets/chart/lv_example_chart_6.c b/examples/widgets/chart/lv_example_chart_6.c index 61c222f23..4d5a84311 100644 --- a/examples/widgets/chart/lv_example_chart_6.c +++ b/examples/widgets/chart/lv_example_chart_6.c @@ -67,7 +67,7 @@ void lv_example_chart_6(void) lv_chart_set_axis_tick(chart, LV_CHART_AXIS_PRIMARY_Y, 10, 5, 6, 5, true, 40); lv_chart_set_axis_tick(chart, LV_CHART_AXIS_X, 10, 5, 10, 1, true, 30); - lv_obj_add_event_cb(chart, event_cb, NULL); + lv_obj_add_event_cb(chart, event_cb, LV_EVENT_ALL, NULL); lv_obj_refresh_ext_draw_size(chart); cursor = lv_chart_add_cursor(chart, lv_color_blue(), LV_DIR_LEFT | LV_DIR_BOTTOM); diff --git a/examples/widgets/checkbox/lv_example_checkbox_1.c b/examples/widgets/checkbox/lv_example_checkbox_1.c index 1d0b4e76f..5a9fd8896 100644 --- a/examples/widgets/checkbox/lv_example_checkbox_1.c +++ b/examples/widgets/checkbox/lv_example_checkbox_1.c @@ -20,22 +20,22 @@ void lv_example_checkbox_1(void) lv_obj_t * cb; cb = lv_checkbox_create(lv_scr_act()); lv_checkbox_set_text(cb, "Apple"); - lv_obj_add_event_cb(cb, event_handler, NULL); + lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL); cb = lv_checkbox_create(lv_scr_act()); lv_checkbox_set_text(cb, "Banana"); lv_obj_add_state(cb, LV_STATE_CHECKED); - lv_obj_add_event_cb(cb, event_handler, NULL); + lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL); cb = lv_checkbox_create(lv_scr_act()); lv_checkbox_set_text(cb, "Lemon"); lv_obj_add_state(cb, LV_STATE_DISABLED); - lv_obj_add_event_cb(cb, event_handler, NULL); + lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL); cb = lv_checkbox_create(lv_scr_act()); lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED); lv_checkbox_set_text(cb, "Melon"); - lv_obj_add_event_cb(cb, event_handler, NULL); + lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/dropdown/lv_example_dropdown_1.c b/examples/widgets/dropdown/lv_example_dropdown_1.c index 0f4a83f43..f35b337d3 100644 --- a/examples/widgets/dropdown/lv_example_dropdown_1.c +++ b/examples/widgets/dropdown/lv_example_dropdown_1.c @@ -29,7 +29,7 @@ void lv_example_dropdown_1(void) "Nuts"); lv_obj_align(dd, LV_ALIGN_TOP_MID, 0, 20); - lv_obj_add_event_cb(dd, event_handler, NULL); + lv_obj_add_event_cb(dd, event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/dropdown/lv_example_dropdown_3.c b/examples/widgets/dropdown/lv_example_dropdown_3.c index eda649b0a..5010f1fd1 100644 --- a/examples/widgets/dropdown/lv_example_dropdown_3.c +++ b/examples/widgets/dropdown/lv_example_dropdown_3.c @@ -3,13 +3,10 @@ static void event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * dropdown = lv_event_get_target(e); - if(code == LV_EVENT_VALUE_CHANGED) { - char buf[64]; - lv_dropdown_get_selected_str(dropdown, buf, sizeof(buf)); - LV_LOG_USER("'%s' is selected", buf); - } + char buf[64]; + lv_dropdown_get_selected_str(dropdown, buf, sizeof(buf)); + LV_LOG_USER("'%s' is selected", buf); } /** @@ -38,7 +35,7 @@ void lv_example_dropdown_3(void) /*In a menu we don't need to show the last clicked item*/ lv_dropdown_set_selected_highlight(dropdown, false); - lv_obj_add_event_cb(dropdown, event_cb, NULL); + lv_obj_add_event_cb(dropdown, event_cb, LV_EVENT_VALUE_CHANGED, NULL); } #endif diff --git a/examples/widgets/img/lv_example_img_2.c b/examples/widgets/img/lv_example_img_2.c index f2cd80520..2d62da7fc 100644 --- a/examples/widgets/img/lv_example_img_2.c +++ b/examples/widgets/img/lv_example_img_2.c @@ -40,15 +40,13 @@ void lv_example_img_2(void) static void slider_event_cb(lv_event_t * e) { + LV_UNUSED(e); - lv_event_code_t code = lv_event_get_code(e); - if(code == LV_EVENT_VALUE_CHANGED) { - /*Recolor the image based on the sliders' values*/ - lv_color_t color = lv_color_make(lv_slider_get_value(red_slider), lv_slider_get_value(green_slider), lv_slider_get_value(blue_slider)); - lv_opa_t intense = lv_slider_get_value(intense_slider); - lv_obj_set_style_img_recolor_opa(img1, intense, 0); - lv_obj_set_style_img_recolor(img1, color, 0); - } + /*Recolor the image based on the sliders' values*/ + lv_color_t color = lv_color_make(lv_slider_get_value(red_slider), lv_slider_get_value(green_slider), lv_slider_get_value(blue_slider)); + lv_opa_t intense = lv_slider_get_value(intense_slider); + lv_obj_set_style_img_recolor_opa(img1, intense, 0); + lv_obj_set_style_img_recolor(img1, color, 0); } static lv_obj_t * create_slider(lv_color_t color) @@ -58,7 +56,7 @@ static lv_obj_t * create_slider(lv_color_t color) lv_obj_set_size(slider, 10, 200); lv_obj_set_style_bg_color(slider, color, LV_PART_KNOB); lv_obj_set_style_bg_color(slider, lv_color_darken(color, LV_OPA_40), LV_PART_INDICATOR); - lv_obj_add_event_cb(slider, slider_event_cb, NULL); + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); return slider; } diff --git a/examples/widgets/keyboard/lv_example_keyboard_1.c b/examples/widgets/keyboard/lv_example_keyboard_1.c index f7918d1c3..dbcdecea5 100644 --- a/examples/widgets/keyboard/lv_example_keyboard_1.c +++ b/examples/widgets/keyboard/lv_example_keyboard_1.c @@ -26,12 +26,12 @@ void lv_example_keyboard_1(void) lv_obj_t * ta; ta = lv_textarea_create(lv_scr_act()); lv_obj_align(ta, LV_ALIGN_TOP_LEFT, 10, 10); - lv_obj_add_event_cb(ta, ta_event_cb, kb); + lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_ALL, kb); lv_textarea_set_placeholder_text(ta, "Hello"); ta = lv_textarea_create(lv_scr_act()); lv_obj_align(ta, LV_ALIGN_TOP_RIGHT, -10, 10); - lv_obj_add_event_cb(ta, ta_event_cb, kb); + lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_ALL, kb); lv_keyboard_set_textarea(kb, ta); } diff --git a/examples/widgets/msgbox/lv_example_msgbox_1.c b/examples/widgets/msgbox/lv_example_msgbox_1.c index b9eb42c5a..d6a84246e 100644 --- a/examples/widgets/msgbox/lv_example_msgbox_1.c +++ b/examples/widgets/msgbox/lv_example_msgbox_1.c @@ -3,11 +3,8 @@ static void event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); - if(code == LV_EVENT_VALUE_CHANGED) { - LV_LOG_USER("Button %s clicked", lv_msgbox_get_active_btn_text(obj)); - } + LV_LOG_USER("Button %s clicked", lv_msgbox_get_active_btn_text(obj)); } void lv_example_msgbox_1(void) @@ -15,7 +12,7 @@ void lv_example_msgbox_1(void) static const char * btns[] ={"Apply", "Close", ""}; lv_obj_t * mbox1 = lv_msgbox_create("Hello", "This is a message box with two buttons.", btns, true); - lv_obj_add_event_cb(mbox1, event_cb, NULL); + lv_obj_add_event_cb(mbox1, event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_center(mbox1); } diff --git a/examples/widgets/roller/lv_example_roller_1.c b/examples/widgets/roller/lv_example_roller_1.c index e9781eb77..2aa3523a8 100644 --- a/examples/widgets/roller/lv_example_roller_1.c +++ b/examples/widgets/roller/lv_example_roller_1.c @@ -35,7 +35,7 @@ void lv_example_roller_1(void) lv_roller_set_visible_row_count(roller1, 4); lv_obj_center(roller1); - lv_obj_add_event_cb(roller1, event_handler, NULL); + lv_obj_add_event_cb(roller1, event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/roller/lv_example_roller_2.c b/examples/widgets/roller/lv_example_roller_2.c index daef45305..55712b754 100644 --- a/examples/widgets/roller/lv_example_roller_2.c +++ b/examples/widgets/roller/lv_example_roller_2.c @@ -33,7 +33,7 @@ void lv_example_roller_2(void) lv_obj_add_style(roller, &style_sel, LV_PART_SELECTED); lv_obj_set_style_text_align(roller, LV_TEXT_ALIGN_LEFT, 0); lv_obj_align(roller, LV_ALIGN_LEFT_MID, 10, 0); - lv_obj_add_event_cb(roller, event_handler, NULL); + lv_obj_add_event_cb(roller, event_handler, LV_EVENT_ALL, NULL); lv_roller_set_selected(roller, 2, LV_ANIM_OFF); /*A roller on the middle with center aligned text, and auto (default) width*/ @@ -42,7 +42,7 @@ void lv_example_roller_2(void) lv_roller_set_visible_row_count(roller, 3); lv_obj_add_style(roller, &style_sel, LV_PART_SELECTED); lv_obj_align(roller, LV_ALIGN_CENTER, 0, 0); - lv_obj_add_event_cb(roller, event_handler, NULL); + lv_obj_add_event_cb(roller, event_handler, LV_EVENT_ALL, NULL); lv_roller_set_selected(roller, 5, LV_ANIM_OFF); /*A roller on the right with right aligned text, and custom width*/ @@ -53,7 +53,7 @@ void lv_example_roller_2(void) lv_obj_add_style(roller, &style_sel, LV_PART_SELECTED); lv_obj_set_style_text_align(roller, LV_TEXT_ALIGN_RIGHT, 0); lv_obj_align(roller, LV_ALIGN_RIGHT_MID, -10, 0); - lv_obj_add_event_cb(roller, event_handler, NULL); + lv_obj_add_event_cb(roller, event_handler, LV_EVENT_ALL, NULL); lv_roller_set_selected(roller, 8, LV_ANIM_OFF); } diff --git a/examples/widgets/slider/lv_example_slider_1.c b/examples/widgets/slider/lv_example_slider_1.c index 69363c64d..b8f661bbf 100644 --- a/examples/widgets/slider/lv_example_slider_1.c +++ b/examples/widgets/slider/lv_example_slider_1.c @@ -12,7 +12,7 @@ void lv_example_slider_1(void) /*Create a slider in the center of the display*/ lv_obj_t * slider = lv_slider_create(lv_scr_act()); lv_obj_center(slider); - lv_obj_add_event_cb(slider, slider_event_cb, NULL); + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); /*Create a label below the slider*/ slider_label = lv_label_create(lv_scr_act()); @@ -23,14 +23,11 @@ void lv_example_slider_1(void) static void slider_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * slider = lv_event_get_target(e); - if(code == LV_EVENT_VALUE_CHANGED) { - char buf[8]; - lv_snprintf(buf, sizeof(buf), "%d%%", lv_slider_get_value(slider)); - lv_label_set_text(slider_label, buf); - lv_obj_align_to(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); - } + char buf[8]; + lv_snprintf(buf, sizeof(buf), "%d%%", lv_slider_get_value(slider)); + lv_label_set_text(slider_label, buf); + lv_obj_align_to(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); } #endif diff --git a/examples/widgets/spinbox/lv_example_spinbox_1.c b/examples/widgets/spinbox/lv_example_spinbox_1.c index 494c6f636..2395aa4e0 100644 --- a/examples/widgets/spinbox/lv_example_spinbox_1.c +++ b/examples/widgets/spinbox/lv_example_spinbox_1.c @@ -36,13 +36,13 @@ void lv_example_spinbox_1(void) lv_obj_set_size(btn, h, h); lv_obj_align_to(btn, spinbox, LV_ALIGN_OUT_RIGHT_MID, 5, 0); lv_obj_set_style_bg_img_src(btn, LV_SYMBOL_PLUS, 0); - lv_obj_add_event_cb(btn, lv_spinbox_increment_event_cb, NULL); + lv_obj_add_event_cb(btn, lv_spinbox_increment_event_cb, LV_EVENT_ALL, NULL); btn = lv_btn_create(lv_scr_act()); lv_obj_set_size(btn, h, h); lv_obj_align_to(btn, spinbox, LV_ALIGN_OUT_LEFT_MID, -5, 0); lv_obj_set_style_bg_img_src(btn, LV_SYMBOL_MINUS, 0); - lv_obj_add_event_cb(btn, lv_spinbox_decrement_event_cb, NULL); + lv_obj_add_event_cb(btn, lv_spinbox_decrement_event_cb, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/switch/lv_example_switch_1.c b/examples/widgets/switch/lv_example_switch_1.c index ff4c848aa..39fd8a7c7 100644 --- a/examples/widgets/switch/lv_example_switch_1.c +++ b/examples/widgets/switch/lv_example_switch_1.c @@ -18,19 +18,19 @@ void lv_example_switch_1(void) lv_obj_t * sw; sw = lv_switch_create(lv_scr_act()); - lv_obj_add_event_cb(sw, event_handler, NULL); + lv_obj_add_event_cb(sw, event_handler, LV_EVENT_ALL, NULL); sw = lv_switch_create(lv_scr_act()); lv_obj_add_state(sw, LV_STATE_CHECKED); - lv_obj_add_event_cb(sw, event_handler, NULL); + lv_obj_add_event_cb(sw, event_handler, LV_EVENT_ALL, NULL); sw = lv_switch_create(lv_scr_act()); lv_obj_add_state(sw, LV_STATE_DISABLED); - lv_obj_add_event_cb(sw, event_handler, NULL); + lv_obj_add_event_cb(sw, event_handler, LV_EVENT_ALL, NULL); sw = lv_switch_create(lv_scr_act()); lv_obj_add_state(sw, LV_STATE_CHECKED | LV_STATE_DISABLED); - lv_obj_add_event_cb(sw, event_handler, NULL); + lv_obj_add_event_cb(sw, event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/table/lv_example_table_1.c b/examples/widgets/table/lv_example_table_1.c index 6c9af6fbe..cd2b80a39 100644 --- a/examples/widgets/table/lv_example_table_1.c +++ b/examples/widgets/table/lv_example_table_1.c @@ -1,33 +1,30 @@ #include "../../lv_examples.h" #if LV_USE_TABLE && LV_BUILD_EXAMPLES -static void event_cb(lv_event_t * e) +static void draw_part_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); - if(code == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); - /*If the cells are drawn...*/ - if(dsc->part == LV_PART_ITEMS) { - uint32_t row = dsc->id / lv_table_get_col_cnt(obj); - uint32_t col = dsc->id - row * lv_table_get_col_cnt(obj); + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); + /*If the cells are drawn...*/ + if(dsc->part == LV_PART_ITEMS) { + uint32_t row = dsc->id / lv_table_get_col_cnt(obj); + uint32_t col = dsc->id - row * lv_table_get_col_cnt(obj); - /*Make the texts in the first cell center aligned*/ - if(row == 0) { - dsc->label_dsc->align = LV_TEXT_ALIGN_CENTER; - dsc->rect_dsc->bg_color = lv_color_mix(lv_color_blue(), dsc->rect_dsc->bg_color, LV_OPA_20); - dsc->rect_dsc->bg_opa = LV_OPA_COVER; - } - /*In the first column align the texts to the right*/ - else if(col == 0) { - dsc->label_dsc->flag = LV_TEXT_ALIGN_RIGHT; - } + /*Make the texts in the first cell center aligned*/ + if(row == 0) { + dsc->label_dsc->align = LV_TEXT_ALIGN_CENTER; + dsc->rect_dsc->bg_color = lv_color_mix(lv_color_blue(), dsc->rect_dsc->bg_color, LV_OPA_20); + dsc->rect_dsc->bg_opa = LV_OPA_COVER; + } + /*In the first column align the texts to the right*/ + else if(col == 0) { + dsc->label_dsc->flag = LV_TEXT_ALIGN_RIGHT; + } - /*MAke every 2nd row grayish*/ - if((row != 0 && row % 2) == 0) { - dsc->rect_dsc->bg_color = lv_color_mix(lv_color_grey(), dsc->rect_dsc->bg_color, LV_OPA_10); - dsc->rect_dsc->bg_opa = LV_OPA_COVER; - } + /*MAke every 2nd row grayish*/ + if((row != 0 && row % 2) == 0) { + dsc->rect_dsc->bg_color = lv_color_mix(lv_color_grey(), dsc->rect_dsc->bg_color, LV_OPA_10); + dsc->rect_dsc->bg_opa = LV_OPA_COVER; } } } @@ -62,7 +59,7 @@ void lv_example_table_1(void) lv_obj_center(table); /*Add an event callback to to apply some custom drawing*/ - lv_obj_add_event_cb(table, event_cb, NULL); + lv_obj_add_event_cb(table, draw_part_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL); } #endif diff --git a/examples/widgets/table/lv_example_table_2.c b/examples/widgets/table/lv_example_table_2.c index eda42e4bd..86193b314 100644 --- a/examples/widgets/table/lv_example_table_2.c +++ b/examples/widgets/table/lv_example_table_2.c @@ -3,49 +3,49 @@ #define ITEM_CNT 200 -static void event_cb(lv_event_t * e) +static void draw_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); - if(code == LV_EVENT_DRAW_PART_END) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); - /*If the cells are drawn...*/ - if(dsc->part == LV_PART_ITEMS) { - bool chk = lv_table_has_cell_ctrl(obj, dsc->id, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); + /*If the cells are drawn...*/ + if(dsc->part == LV_PART_ITEMS) { + bool chk = lv_table_has_cell_ctrl(obj, dsc->id, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); - lv_draw_rect_dsc_t rect_dsc; - lv_draw_rect_dsc_init(&rect_dsc); - rect_dsc.bg_color = chk ? lv_theme_get_color_primary(obj) : lv_color_grey_lighten_2(); - rect_dsc.radius = LV_RADIUS_CIRCLE; + lv_draw_rect_dsc_t rect_dsc; + lv_draw_rect_dsc_init(&rect_dsc); + rect_dsc.bg_color = chk ? lv_theme_get_color_primary(obj) : lv_color_grey_lighten_2(); + rect_dsc.radius = LV_RADIUS_CIRCLE; - lv_area_t sw_area; - sw_area.x1 = dsc->draw_area->x2 - 50; - sw_area.x2 = sw_area.x1 + 40; - sw_area.y1 = dsc->draw_area->y1 + lv_area_get_height(dsc->draw_area) / 2 - 10; - sw_area.y2 = sw_area.y1 + 20; - lv_draw_rect(&sw_area, dsc->clip_area, &rect_dsc); + lv_area_t sw_area; + sw_area.x1 = dsc->draw_area->x2 - 50; + sw_area.x2 = sw_area.x1 + 40; + sw_area.y1 = dsc->draw_area->y1 + lv_area_get_height(dsc->draw_area) / 2 - 10; + sw_area.y2 = sw_area.y1 + 20; + lv_draw_rect(&sw_area, dsc->clip_area, &rect_dsc); - rect_dsc.bg_color = lv_color_white(); - if(chk) { - sw_area.x2 -= 2; - sw_area.x1 = sw_area.x2 - 16; - } else { - sw_area.x1 += 2; - sw_area.x2 = sw_area.x1 + 16; - } - sw_area.y1 += 2; - sw_area.y2 -= 2; - lv_draw_rect(&sw_area, dsc->clip_area, &rect_dsc); + rect_dsc.bg_color = lv_color_white(); + if(chk) { + sw_area.x2 -= 2; + sw_area.x1 = sw_area.x2 - 16; + } else { + sw_area.x1 += 2; + sw_area.x2 = sw_area.x1 + 16; } + sw_area.y1 += 2; + sw_area.y2 -= 2; + lv_draw_rect(&sw_area, dsc->clip_area, &rect_dsc); } - else if(code == LV_EVENT_VALUE_CHANGED) { - uint16_t col; - uint16_t row; - lv_table_get_selected_cell(obj, &row, &col); - bool chk = lv_table_has_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); - if(chk) lv_table_clear_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); - else lv_table_add_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); - } +} + +static void change_event_cb(lv_event_t * e) +{ + lv_obj_t * obj = lv_event_get_target(e); + uint16_t col; + uint16_t row; + lv_table_get_selected_cell(obj, &row, &col); + bool chk = lv_table_has_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); + if(chk) lv_table_clear_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); + else lv_table_add_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); } @@ -80,7 +80,8 @@ void lv_example_table_2(void) lv_obj_align(table, LV_ALIGN_CENTER, 0, -20); /*Add an event callback to to apply some custom drawing*/ - lv_obj_add_event_cb(table, event_cb, NULL); + lv_obj_add_event_cb(table, draw_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL); + lv_obj_add_event_cb(table, change_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_mem_monitor_t mon2; lv_mem_monitor(&mon2); diff --git a/examples/widgets/textarea/lv_example_textarea_1.c b/examples/widgets/textarea/lv_example_textarea_1.c index 232fbb134..f5939790a 100644 --- a/examples/widgets/textarea/lv_example_textarea_1.c +++ b/examples/widgets/textarea/lv_example_textarea_1.c @@ -4,17 +4,14 @@ static void btnm_event_handler(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); - if(code == LV_EVENT_VALUE_CHANGED) { - lv_obj_t * ta = lv_event_get_user_data(e); - const char * txt = lv_btnmatrix_get_btn_text(obj, lv_btnmatrix_get_selected_btn(obj)); + lv_obj_t * ta = lv_event_get_user_data(e); + const char * txt = lv_btnmatrix_get_btn_text(obj, lv_btnmatrix_get_selected_btn(obj)); - if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) lv_textarea_del_char(ta); - else if(strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) lv_textarea_add_char(ta, '\n'); - else lv_textarea_add_text(ta, txt); + if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) lv_textarea_del_char(ta); + else if(strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) lv_textarea_add_char(ta, '\n'); + else lv_textarea_add_text(ta, txt); - } } void lv_example_textarea_1(void) @@ -32,7 +29,7 @@ void lv_example_textarea_1(void) lv_obj_t * btnm = lv_btnmatrix_create(lv_scr_act()); lv_obj_set_size(btnm, 200, 150); lv_obj_align(btnm, LV_ALIGN_BOTTOM_MID, 0, -10); - lv_obj_add_event_cb(btnm, btnm_event_handler, ta); + lv_obj_add_event_cb(btnm, btnm_event_handler, LV_EVENT_VALUE_CHANGED, ta); lv_obj_clear_flag(btnm, LV_OBJ_FLAG_CLICK_FOCUSABLE); /*To keep the text area focused on button clicks*/ lv_btnmatrix_set_map(btnm, btnm_map); } diff --git a/examples/widgets/textarea/lv_example_textarea_2.c b/examples/widgets/textarea/lv_example_textarea_2.c index 40bdcc713..44749fa41 100644 --- a/examples/widgets/textarea/lv_example_textarea_2.c +++ b/examples/widgets/textarea/lv_example_textarea_2.c @@ -14,7 +14,7 @@ void lv_example_textarea_2(void) lv_textarea_set_one_line(pwd_ta, true); lv_obj_set_width(pwd_ta, LV_HOR_RES / 2 - 20); lv_obj_set_pos(pwd_ta, 5, 20); - lv_obj_add_event_cb(pwd_ta, ta_event_cb, NULL); + lv_obj_add_event_cb(pwd_ta, ta_event_cb, LV_EVENT_ALL, NULL); /*Create a label and position it above the text box*/ lv_obj_t * pwd_label = lv_label_create(lv_scr_act()); diff --git a/examples/widgets/textarea/lv_example_textarea_3.c b/examples/widgets/textarea/lv_example_textarea_3.c index 5bfc0b838..21cb31bb1 100644 --- a/examples/widgets/textarea/lv_example_textarea_3.c +++ b/examples/widgets/textarea/lv_example_textarea_3.c @@ -13,7 +13,7 @@ void lv_example_textarea_3(void) { /*Create the text area*/ lv_obj_t * ta = lv_textarea_create(lv_scr_act()); - lv_obj_add_event_cb(ta, ta_event_cb, NULL); + lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_textarea_set_accepted_chars(ta, "0123456789:"); lv_textarea_set_max_length(ta, 5); lv_textarea_set_one_line(ta, true); @@ -28,17 +28,14 @@ void lv_example_textarea_3(void) static void ta_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * ta = lv_event_get_target(e); - if(code == LV_EVENT_VALUE_CHANGED) { - const char * txt = lv_textarea_get_text(ta); - if(txt[0] >= '0' && txt[0] <= '9' && - txt[1] >= '0' && txt[1] <= '9' && - txt[2] != ':') - { - lv_textarea_set_cursor_pos(ta, 2); - lv_textarea_add_char(ta, ':'); - } + const char * txt = lv_textarea_get_text(ta); + if(txt[0] >= '0' && txt[0] <= '9' && + txt[1] >= '0' && txt[1] <= '9' && + txt[2] != ':') + { + lv_textarea_set_cursor_pos(ta, 2); + lv_textarea_add_char(ta, ':'); } } diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index c28348e6f..96d73f875 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -51,6 +51,7 @@ typedef struct _lv_event_temp_data { typedef struct _lv_event_dsc_t{ lv_event_cb_t cb; void * user_data; + lv_event_code_t filter :8; }lv_event_dsc_t; /********************** @@ -361,7 +362,7 @@ void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state) } } -struct _lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data) +struct _lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_obj_allocate_spec_attr(obj); @@ -371,6 +372,7 @@ struct _lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event LV_ASSERT_MALLOC(obj->spec_attr->event_dsc); obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1].cb = event_cb; + obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1].filter = filter; obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1].user_data = user_data; return &obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1]; @@ -1100,7 +1102,7 @@ static lv_res_t event_send_core(lv_obj_t * obj, lv_event_code_t event_code, void uint32_t i = 0; while(event_dsc && res == LV_RES_OK) { - if(event_dsc->cb) { + if(event_dsc->cb && (event_dsc->filter == LV_EVENT_ALL || event_dsc->filter == event_code)) { void * event_act_user_data_cb_save = event_act_user_data_cb; event_act_user_data_cb = event_dsc->user_data; diff --git a/src/core/lv_obj.h b/src/core/lv_obj.h index 94dc59bca..4a3e22eb7 100644 --- a/src/core/lv_obj.h +++ b/src/core/lv_obj.h @@ -44,6 +44,8 @@ struct _lv_event_dsc_t; * Type of event being sent to the object. */ typedef enum { + LV_EVENT_ALL = 0, + /** Input device events*/ LV_EVENT_PRESSED, /**< The object has been pressed*/ LV_EVENT_PRESSING, /**< The object is being pressed (called continuously while pressing)*/ @@ -388,11 +390,12 @@ void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state); * Used by the user to react on event which happens with the object. * An object can have multiple event handler. They will be called in the same order as they were added. * @param obj pointer to an object + * @param filter and event code (e.g. `LV_EVENT_CLICKED`) on which the event should be called. `LV_EVENT_ALL` can be sued the receive all the events. * @param event_cb the new event function * @param user_data custom data data will be available in `event_cb` * @return a pointer the event descriptor. Can be used in ::lv_obj_remove_event_dsc */ -struct _lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data); +struct _lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data); /** * Remove an event handler function for an object. diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index 4e77f460c..6b38d4169 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -32,7 +32,7 @@ static lv_color_t color_secondary_muted; #define TRANSITION_TIME LV_THEME_DEFAULT_TRANSITON_TIME #define BORDER_WIDTH LV_DPX(2) -#define OUTLINE_WIDTH LV_DPX(4) +#define OUTLINE_WIDTH LV_DPX(3) #define PAD_DEF (disp_size == DISP_LARGE ? LV_DPX(24) : disp_size == DISP_MEDIUM ? LV_DPX(20) : LV_DPX(20)) #define PAD_SMALL (disp_size == DISP_LARGE ? LV_DPX(14) : disp_size == DISP_MEDIUM ? LV_DPX(12) : LV_DPX(12)) diff --git a/src/extra/widgets/calendar/lv_calendar.c b/src/extra/widgets/calendar/lv_calendar.c index 58d0ff2d4..5b4095d67 100644 --- a/src/extra/widgets/calendar/lv_calendar.c +++ b/src/extra/widgets/calendar/lv_calendar.c @@ -23,8 +23,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void draw_event_cb(lv_event_t * e); +static void lv_calendar_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void draw_part_begin_event_cb(lv_event_t * e); static uint8_t get_day_of_week(uint32_t year, uint32_t month, uint32_t day); static uint8_t get_month_length(int32_t year, int32_t month); @@ -35,7 +35,7 @@ static void highlight_update(lv_obj_t * calendar); * STATIC VARIABLES **********************/ const lv_obj_class_t lv_calendar_class = { - .constructor_cb = my_constructor, + .constructor_cb = lv_calendar_constructor, .width_def = (LV_DPI_DEF * 3) / 2, .height_def =(LV_DPI_DEF * 3) / 2, .instance_size = sizeof(lv_calendar_t), @@ -206,7 +206,7 @@ bool lv_calendar_get_pressed_date(const lv_obj_t * obj, lv_calendar_date_t * dat * STATIC FUNCTIONS **********************/ -static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) +static void lv_calendar_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { LV_UNUSED(class_p); lv_calendar_t * calendar = (lv_calendar_t *)obj; @@ -247,44 +247,41 @@ static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_calendar_set_showed_date(obj, calendar->showed_date.year, calendar->showed_date.month); lv_calendar_set_today_date(obj, calendar->today.year, calendar->today.month, calendar->today.day); - lv_obj_add_event_cb(obj, draw_event_cb, NULL); + lv_obj_add_event_cb(obj, draw_part_begin_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL); } -static void draw_event_cb(lv_event_t * e) +static void draw_part_begin_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); - if(code == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); - if(dsc->part == LV_PART_ITEMS) { - /*Day name styles*/ - if(dsc->id < 7) { - dsc->rect_dsc->bg_opa = LV_OPA_TRANSP; - dsc->rect_dsc->border_opa = LV_OPA_TRANSP; - } - else if(lv_btnmatrix_has_btn_ctrl(obj, dsc->id, LV_BTNMATRIX_CTRL_DISABLED)) { - dsc->rect_dsc->bg_opa = LV_OPA_TRANSP; - dsc->rect_dsc->border_opa = LV_OPA_TRANSP; - dsc->label_dsc->color = lv_color_grey(); - } - - if(lv_btnmatrix_has_btn_ctrl(obj, dsc->id, LV_CALENDAR_CTRL_HIGHLIGHT)) { - dsc->rect_dsc->bg_opa = LV_OPA_40; - dsc->rect_dsc->bg_color = lv_theme_get_color_primary(obj); - if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) { - dsc->rect_dsc->bg_opa = LV_OPA_70; - } - } - - if(lv_btnmatrix_has_btn_ctrl(obj, dsc->id, LV_CALENDAR_CTRL_TODAY)) { - dsc->rect_dsc->border_opa = LV_OPA_COVER; - dsc->rect_dsc->border_color = lv_theme_get_color_primary(obj); - dsc->rect_dsc->border_width += 1; - } - + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); + if(dsc->part == LV_PART_ITEMS) { + /*Day name styles*/ + if(dsc->id < 7) { + dsc->rect_dsc->bg_opa = LV_OPA_TRANSP; + dsc->rect_dsc->border_opa = LV_OPA_TRANSP; } + else if(lv_btnmatrix_has_btn_ctrl(obj, dsc->id, LV_BTNMATRIX_CTRL_DISABLED)) { + dsc->rect_dsc->bg_opa = LV_OPA_TRANSP; + dsc->rect_dsc->border_opa = LV_OPA_TRANSP; + dsc->label_dsc->color = lv_color_grey(); + } + + if(lv_btnmatrix_has_btn_ctrl(obj, dsc->id, LV_CALENDAR_CTRL_HIGHLIGHT)) { + dsc->rect_dsc->bg_opa = LV_OPA_40; + dsc->rect_dsc->bg_color = lv_theme_get_color_primary(obj); + if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) { + dsc->rect_dsc->bg_opa = LV_OPA_70; + } + } + + if(lv_btnmatrix_has_btn_ctrl(obj, dsc->id, LV_CALENDAR_CTRL_TODAY)) { + dsc->rect_dsc->border_opa = LV_OPA_COVER; + dsc->rect_dsc->border_color = lv_theme_get_color_primary(obj); + dsc->rect_dsc->border_width += 1; + } + } } diff --git a/src/extra/widgets/calendar/lv_calendar_header_arrow.c b/src/extra/widgets/calendar/lv_calendar_header_arrow.c index 20e13b7ea..6a7a64471 100644 --- a/src/extra/widgets/calendar/lv_calendar_header_arrow.c +++ b/src/extra/widgets/calendar/lv_calendar_header_arrow.c @@ -62,7 +62,7 @@ lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent, lv_obj_t * calenda lv_obj_t * mo_prev = lv_btn_create(header); lv_obj_set_style_bg_img_src(mo_prev, LV_SYMBOL_LEFT, 0); lv_obj_set_size(mo_prev, btn_size, btn_size); - lv_obj_add_event_cb(mo_prev, month_event_cb, calendar); + lv_obj_add_event_cb(mo_prev, month_event_cb, LV_EVENT_CLICKED, calendar); lv_obj_clear_flag(mo_prev, LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_t * label = lv_label_create(header); @@ -74,7 +74,7 @@ lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent, lv_obj_t * calenda lv_obj_t * mo_next = lv_btn_create(header); lv_obj_set_style_bg_img_src(mo_next, LV_SYMBOL_RIGHT, 0); lv_obj_set_size(mo_next, btn_size, btn_size); - lv_obj_add_event_cb(mo_next, month_event_cb, calendar); + lv_obj_add_event_cb(mo_next, month_event_cb, LV_EVENT_CLICKED, calendar); lv_obj_clear_flag(mo_next, LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_align_to(header, calendar, LV_ALIGN_OUT_TOP_MID, 0, 0); @@ -88,12 +88,8 @@ lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent, lv_obj_t * calenda static void month_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * btn = lv_event_get_target(e); - if(code != LV_EVENT_CLICKED) return; - - lv_obj_t * header = lv_obj_get_parent(btn); lv_obj_t * calendar = lv_event_get_user_data(e); diff --git a/src/extra/widgets/calendar/lv_calendar_header_dropdown.c b/src/extra/widgets/calendar/lv_calendar_header_dropdown.c index c70371ff2..90b04b7b7 100644 --- a/src/extra/widgets/calendar/lv_calendar_header_dropdown.c +++ b/src/extra/widgets/calendar/lv_calendar_header_dropdown.c @@ -71,13 +71,13 @@ lv_obj_t * lv_calendar_header_dropdown_create(lv_obj_t * parent, lv_obj_t * cale lv_obj_t * year_dd = lv_dropdown_create(header); lv_dropdown_set_options(year_dd, year_list); lv_dropdown_set_selected(year_dd, 2023 - cur_date->year); - lv_obj_add_event_cb(year_dd, year_event_cb, calendar); + lv_obj_add_event_cb(year_dd, year_event_cb, LV_EVENT_VALUE_CHANGED, calendar); lv_obj_set_flex_grow(year_dd, 1); lv_obj_t * month_dd = lv_dropdown_create(header); lv_dropdown_set_options(month_dd, month_list); lv_dropdown_set_selected(month_dd, cur_date->month - 1); - lv_obj_add_event_cb(month_dd, month_event_cb, calendar); + lv_obj_add_event_cb(month_dd, month_event_cb, LV_EVENT_VALUE_CHANGED, calendar); lv_obj_set_flex_grow(month_dd, 1); lv_obj_align_to(header, calendar, LV_ALIGN_OUT_TOP_MID, 0, 0); @@ -91,9 +91,6 @@ lv_obj_t * lv_calendar_header_dropdown_create(lv_obj_t * parent, lv_obj_t * cale static void month_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); - if(code != LV_EVENT_VALUE_CHANGED) return; - lv_obj_t * dropdown = lv_event_get_target(e); lv_obj_t * calendar = lv_event_get_user_data(e); @@ -108,9 +105,6 @@ static void month_event_cb(lv_event_t * e) } static void year_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); - if(code != LV_EVENT_VALUE_CHANGED) return; - lv_obj_t * dropdown = lv_event_get_target(e); lv_obj_t * calendar = lv_event_get_user_data(e); diff --git a/src/extra/widgets/keyboard/lv_keyboard.c b/src/extra/widgets/keyboard/lv_keyboard.c index 1f8433079..f0877def3 100644 --- a/src/extra/widgets/keyboard/lv_keyboard.c +++ b/src/extra/widgets/keyboard/lv_keyboard.c @@ -222,15 +222,11 @@ lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * obj) */ void lv_keyboard_def_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); - if(code != LV_EVENT_VALUE_CHANGED) return; lv_keyboard_t * keyboard = (lv_keyboard_t *)obj; uint16_t btn_id = lv_btnmatrix_get_selected_btn(obj); if(btn_id == LV_BTNMATRIX_BTN_NONE) return; - if(lv_btnmatrix_has_btn_ctrl(obj, btn_id, LV_BTNMATRIX_CTRL_HIDDEN | LV_BTNMATRIX_CTRL_DISABLED)) return; - if(lv_btnmatrix_has_btn_ctrl(obj, btn_id, LV_BTNMATRIX_CTRL_NO_REPEAT) && code == LV_EVENT_LONG_PRESSED_REPEAT) return; const char * txt = lv_btnmatrix_get_btn_text(obj, lv_btnmatrix_get_selected_btn(obj)); if(txt == NULL) return; @@ -332,7 +328,7 @@ static void lv_keyboard_constructor(const lv_obj_class_t * class_p, lv_obj_t * o keyboard->mode = LV_KEYBOARD_MODE_TEXT_LOWER; lv_obj_align(obj, LV_ALIGN_BOTTOM_MID, 0, 0); - lv_obj_add_event_cb(obj, lv_keyboard_def_event_cb, NULL); + lv_obj_add_event_cb(obj, lv_keyboard_def_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_set_base_dir(obj, LV_BIDI_DIR_LTR); lv_btnmatrix_set_map(obj, kb_map[keyboard->mode]); diff --git a/src/extra/widgets/list/lv_list.c b/src/extra/widgets/list/lv_list.c index cbba06563..b34315420 100644 --- a/src/extra/widgets/list/lv_list.c +++ b/src/extra/widgets/list/lv_list.c @@ -74,7 +74,7 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const char * icon, const char * txt, { lv_obj_t * btn = lv_obj_create_from_class(&lv_list_btn_class, list); lv_obj_set_size(btn, LV_PCT(100), LV_SIZE_CONTENT); - lv_obj_add_event_cb(btn, event_cb, NULL); + lv_obj_add_event_cb(btn, event_cb, LV_EVENT_ALL, NULL); if(icon) { lv_obj_t * img = lv_img_create(btn); diff --git a/src/extra/widgets/msgbox/lv_msgbox.c b/src/extra/widgets/msgbox/lv_msgbox.c index 8237fad90..f452b9779 100644 --- a/src/extra/widgets/msgbox/lv_msgbox.c +++ b/src/extra/widgets/msgbox/lv_msgbox.c @@ -21,7 +21,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void msgbox_close_event_cb(lv_event_t * e); +static void msgbox_close_click_event_cb(lv_event_t * e); /********************** * STATIC VARIABLES @@ -70,7 +70,7 @@ lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * b if(add_close_btn) { lv_obj_t * close_btn = lv_btn_create(mbox); lv_obj_set_ext_click_area(close_btn, LV_DPX(10)); - lv_obj_add_event_cb(close_btn, msgbox_close_event_cb, NULL); + lv_obj_add_event_cb(close_btn, msgbox_close_click_event_cb, LV_EVENT_CLICKED, NULL); label = lv_label_create(close_btn); lv_label_set_text(label, LV_SYMBOL_CLOSE); lv_coord_t close_btn_size = LV_MAX(lv_obj_get_width(label), lv_obj_get_height(label)) + LV_DPX(10); @@ -138,14 +138,11 @@ void lv_msgbox_close(lv_obj_t * mbox) * STATIC FUNCTIONS **********************/ -static void msgbox_close_event_cb(lv_event_t * e) +static void msgbox_close_click_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * btn = lv_event_get_target(e); - if(code == LV_EVENT_CLICKED) { - lv_obj_t * mbox = lv_obj_get_parent(btn); - lv_msgbox_close(mbox); - } + lv_obj_t * mbox = lv_obj_get_parent(btn); + lv_msgbox_close(mbox); } #endif /*LV_USE_MSGBOX*/ diff --git a/src/extra/widgets/tabview/lv_tabview.c b/src/extra/widgets/tabview/lv_tabview.c index 7c617441c..8acc34329 100644 --- a/src/extra/widgets/tabview/lv_tabview.c +++ b/src/extra/widgets/tabview/lv_tabview.c @@ -22,8 +22,8 @@ **********************/ static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_tabview_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void btns_event_cb(lv_event_t * e); -static void cont_event_cb(lv_event_t * e); +static void btns_value_changed_event_cb(lv_event_t * e); +static void cont_scroll_end_event_cb(lv_event_t * e); /********************** * STATIC VARIABLES @@ -180,10 +180,10 @@ static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob tabview->map = lv_mem_alloc(sizeof(const char *)); tabview->map[0] = ""; lv_btnmatrix_set_map(btnm, (const char **)tabview->map); - lv_obj_add_event_cb(btnm, btns_event_cb, NULL); + lv_obj_add_event_cb(btnm, btns_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_add_flag(btnm, LV_OBJ_FLAG_EVENT_BUBBLE); - lv_obj_add_event_cb(cont, cont_event_cb, NULL); + lv_obj_add_event_cb(cont, cont_scroll_end_event_cb, LV_EVENT_SCROLL_END, NULL); lv_obj_set_scrollbar_mode(cont, LV_SCROLLBAR_MODE_OFF); switch(tabview->tab_pos) { @@ -228,32 +228,26 @@ static void lv_tabview_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj tabview->map = NULL; } -static void btns_event_cb(lv_event_t * e) +static void btns_value_changed_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * btns = lv_event_get_target(e); - if(code == LV_EVENT_VALUE_CHANGED) { - lv_obj_t * tv = lv_obj_get_parent(btns); - uint32_t id = lv_btnmatrix_get_selected_btn(btns); - lv_tabview_set_act(tv, id, LV_ANIM_ON); - } + lv_obj_t * tv = lv_obj_get_parent(btns); + uint32_t id = lv_btnmatrix_get_selected_btn(btns); + lv_tabview_set_act(tv, id, LV_ANIM_ON); } -static void cont_event_cb(lv_event_t * e) +static void cont_scroll_end_event_cb(lv_event_t * e) { - lv_event_code_t code = lv_event_get_code(e); lv_obj_t * cont = lv_event_get_target(e); - if(code == LV_EVENT_SCROLL_END) { - lv_obj_t * tv = lv_obj_get_parent(cont); + lv_obj_t * tv = lv_obj_get_parent(cont); - lv_point_t p; - lv_obj_get_scroll_end(cont, &p); + lv_point_t p; + lv_obj_get_scroll_end(cont, &p); - lv_coord_t w = lv_obj_get_width_fit(cont); - lv_coord_t t = (p.x + w/ 2) / w; - if(t < 0) t = 0; - lv_tabview_set_act(tv, t, LV_ANIM_ON); - } + lv_coord_t w = lv_obj_get_width_fit(cont); + lv_coord_t t = (p.x + w/ 2) / w; + if(t < 0) t = 0; + lv_tabview_set_act(tv, t, LV_ANIM_ON); } #endif /*LV_USE_TABVIEW*/ diff --git a/src/extra/widgets/tileview/lv_tileview.c b/src/extra/widgets/tileview/lv_tileview.c index c7b36ea7e..ba45b5e2c 100644 --- a/src/extra/widgets/tileview/lv_tileview.c +++ b/src/extra/widgets/tileview/lv_tileview.c @@ -105,7 +105,7 @@ static void lv_tileview_constructor(const lv_obj_class_t * class_p, lv_obj_t * o { LV_UNUSED(class_p); lv_obj_set_size(obj, LV_PCT(100), LV_PCT(100)); - lv_obj_add_event_cb(obj, tileview_event_cb, NULL); + lv_obj_add_event_cb(obj, tileview_event_cb, LV_EVENT_ALL, NULL); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ONE); lv_obj_set_scroll_snap_x(obj, LV_SCROLL_SNAP_CENTER); lv_obj_set_scroll_snap_y(obj, LV_SCROLL_SNAP_CENTER); diff --git a/src/extra/widgets/win/lv_win.c b/src/extra/widgets/win/lv_win.c index 9c8a37294..d44cddb8a 100644 --- a/src/extra/widgets/win/lv_win.c +++ b/src/extra/widgets/win/lv_win.c @@ -63,7 +63,7 @@ lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * icon, lv_coord_t btn_w, l lv_obj_t * header = lv_win_get_header(win); lv_obj_t * btn = lv_btn_create(header); lv_obj_set_size(btn, btn_w, LV_PCT(100)); - lv_obj_add_event_cb(btn, event_cb, NULL); + lv_obj_add_event_cb(btn, event_cb, LV_EVENT_ALL, NULL); lv_obj_t * img = lv_img_create(btn); lv_img_set_src(img, icon); diff --git a/src/misc/lv_color.h b/src/misc/lv_color.h index 1a3f788cf..7114b3aa9 100644 --- a/src/misc/lv_color.h +++ b/src/misc/lv_color.h @@ -276,7 +276,6 @@ typedef struct _lv_color_filter_dsc_t { typedef enum { - LV_COLOR_PALETTE_NONE, LV_COLOR_PALETTE_RED, LV_COLOR_PALETTE_PINK, LV_COLOR_PALETTE_PURPLE, @@ -296,7 +295,8 @@ typedef enum { LV_COLOR_PALETTE_BROWN, LV_COLOR_PALETTE_BLUE_GREY, LV_COLOR_PALETTE_GREY, - _LV_COLOR_PALETTE_LAST + _LV_COLOR_PALETTE_LAST, + LV_COLOR_PALETTE_NONE = 0xff, }lv_color_palette_t; /********************** From 866740252430eb72ce04c62013b8dc30065987a0 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 19 Apr 2021 11:21:44 +0200 Subject: [PATCH 021/152] minor fixes --- src/core/lv_obj_pos.c | 2 -- src/core/lv_obj_pos.h | 2 -- src/widgets/lv_textarea.c | 4 ++-- tests/build.py | 1 + 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 4b92b79c0..432b3100b 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -313,9 +313,7 @@ uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data) LV_ASSERT_MALLOC(LV_GC_ROOT(_lv_layout_list)); LV_GC_ROOT(_lv_layout_list)[layout_cnt - 1].cb = cb; -#if LV_USE_USER_DATA LV_GC_ROOT(_lv_layout_list)[layout_cnt - 1].user_data = user_data; -#endif return layout_cnt; /*No -1 to skip 0th index*/ } diff --git a/src/core/lv_obj_pos.h b/src/core/lv_obj_pos.h index 80ee76e1b..3a8c33281 100644 --- a/src/core/lv_obj_pos.h +++ b/src/core/lv_obj_pos.h @@ -26,9 +26,7 @@ struct _lv_obj_t; typedef void (*lv_layout_update_cb_t)(struct _lv_obj_t *, void * user_data); typedef struct { lv_layout_update_cb_t cb; -#if LV_USE_USER_DATA void * user_data; -#endif }lv_layout_dsc_t; /********************** diff --git a/src/widgets/lv_textarea.c b/src/widgets/lv_textarea.c index 452611753..114d00786 100644 --- a/src/widgets/lv_textarea.c +++ b/src/widgets/lv_textarea.c @@ -1165,7 +1165,7 @@ static void update_cursor_position_on_click(lv_event_t * e) } if(ta->text_sel_en) { - if(!ta->text_sel_in_prog && !click_outside_label && e == LV_EVENT_PRESSED) { + if(!ta->text_sel_in_prog && !click_outside_label && code == LV_EVENT_PRESSED) { /*Input device just went down. Store the selection start position*/ ta->sel_start = char_id_at_click; ta->sel_end = LV_LABEL_TEXT_SEL_OFF; @@ -1182,7 +1182,7 @@ static void update_cursor_position_on_click(lv_event_t * e) } } - if(ta->text_sel_in_prog || e == LV_EVENT_PRESSED) lv_textarea_set_cursor_pos(obj, char_id_at_click); + if(ta->text_sel_in_prog || code == LV_EVENT_PRESSED) lv_textarea_set_cursor_pos(obj, char_id_at_click); if(ta->text_sel_in_prog) { /*If the selected area has changed then update the real values and*/ diff --git a/tests/build.py b/tests/build.py index da8116d3e..101611a43 100755 --- a/tests/build.py +++ b/tests/build.py @@ -197,6 +197,7 @@ full_32bit = { "LV_USE_PERF_MONITOR":1, "LV_USE_MEM_MONITOR":1, + "LV_LABEL_TEXT_SEL":1, "LV_BUILD_EXAMPLES":1, From 13d7256528b4444d66751ce3de7361d6ee8645ed Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 19 Apr 2021 15:01:39 +0200 Subject: [PATCH 022/152] fix(btn) set default width to LV_SIZE_CONTENT --- src/widgets/lv_btn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/lv_btn.c b/src/widgets/lv_btn.c index 668b04567..803022ac1 100644 --- a/src/widgets/lv_btn.c +++ b/src/widgets/lv_btn.c @@ -30,7 +30,7 @@ static void lv_btn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); **********************/ const lv_obj_class_t lv_btn_class = { .constructor_cb = lv_btn_constructor, - .width_def = LV_DPI_DEF, + .width_def = LV_SIZE_CONTENT, .height_def = LV_SIZE_CONTENT, .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE, .instance_size = sizeof(lv_btn_t), From d857de043ea63dc31aadc1787ca9106c14aed0da Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 19 Apr 2021 15:56:34 +0200 Subject: [PATCH 023/152] fix(table) fix memory leak See https://forum.lvgl.io/t/possible-memory-leak-in-table-widget/5254 --- src/widgets/lv_table.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/widgets/lv_table.c b/src/widgets/lv_table.c index 184d9ed2e..1bd8cc7ab 100644 --- a/src/widgets/lv_table.c +++ b/src/widgets/lv_table.c @@ -207,6 +207,16 @@ void lv_table_set_row_cnt(lv_obj_t * obj, uint16_t row_cnt) LV_ASSERT_MALLOC(table->row_h); if(table->row_h == NULL) return; + /*Free the unused cells*/ + if(old_row_cnt > row_cnt) { + uint16_t old_cell_cnt = old_row_cnt * table->col_cnt; + uint32_t new_cell_cnt = table->col_cnt * table->row_cnt; + uint32_t i; + for(i = new_cell_cnt; i < old_cell_cnt; i++) { + lv_mem_free(table->cell_data[i]); + } + } + table->cell_data = lv_mem_realloc(table->cell_data, table->row_cnt * table->col_cnt * sizeof(char *)); LV_ASSERT_MALLOC(table->cell_data); if(table->cell_data == NULL) return; @@ -232,6 +242,16 @@ void lv_table_set_col_cnt(lv_obj_t * obj, uint16_t col_cnt) LV_ASSERT_MALLOC(table->col_w); if(table->col_w == NULL) return; + /*Free the unused cells*/ + if(old_col_cnt > col_cnt) { + uint16_t old_cell_cnt = old_col_cnt * table->row_cnt; + uint32_t new_cell_cnt = table->col_cnt * table->row_cnt; + uint32_t i; + for(i = new_cell_cnt; i < old_cell_cnt; i++) { + lv_mem_free(table->cell_data[i]); + } + } + char ** new_cell_data = lv_mem_alloc(table->row_cnt * table->col_cnt * sizeof(char *)); LV_ASSERT_MALLOC(new_cell_data); if(new_cell_data == NULL) return; From 75f40e590cc6479ae179ebe183e0b4dc3b12bd73 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 19 Apr 2021 15:59:38 +0200 Subject: [PATCH 024/152] fix(example) fix table_2 example --- examples/widgets/table/lv_example_table_2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/widgets/table/lv_example_table_2.c b/examples/widgets/table/lv_example_table_2.c index 86193b314..39e151df9 100644 --- a/examples/widgets/table/lv_example_table_2.c +++ b/examples/widgets/table/lv_example_table_2.c @@ -80,7 +80,7 @@ void lv_example_table_2(void) lv_obj_align(table, LV_ALIGN_CENTER, 0, -20); /*Add an event callback to to apply some custom drawing*/ - lv_obj_add_event_cb(table, draw_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL); + lv_obj_add_event_cb(table, draw_event_cb, LV_EVENT_DRAW_PART_END, NULL); lv_obj_add_event_cb(table, change_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_mem_monitor_t mon2; @@ -91,9 +91,9 @@ void lv_example_table_2(void) uint32_t elaps = lv_tick_elaps(t); lv_obj_t * label = lv_label_create(lv_scr_act()); - lv_label_set_text_fmt(label, "%d bytes are used by the table\n" - "and %d items were added in %d ms", - mem_used, ITEM_CNT, elaps); + lv_label_set_text_fmt(label, "%d items were created in %d ms\n" + "using %d bytes of memory", + ITEM_CNT, elaps, mem_used); lv_obj_align(label, LV_ALIGN_BOTTOM_MID, 0, -10); From a995695cdf51d8ee476f19e619851fd40d7c90cf Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 19 Apr 2021 19:04:46 +0200 Subject: [PATCH 025/152] feat(conf) automatically enable LV_LVGL_H_INCLUDE_SIMPLE if lvgl.h can be included --- scripts/lv_conf_checker.py | 5 +++++ src/lv_conf_internal.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/scripts/lv_conf_checker.py b/scripts/lv_conf_checker.py index d7cdaa2a4..f83607958 100755 --- a/scripts/lv_conf_checker.py +++ b/scripts/lv_conf_checker.py @@ -42,6 +42,11 @@ fout.write( # define LV_CONF_INCLUDE_SIMPLE # endif # endif +# if __has_include("lvgl.h") +# ifndef LV_LVGL_H_INCLUDE_SIMPLE +# define LV_LVGL_H_INCLUDE_SIMPLE +# endif +# endif #endif /*If lv_conf.h is not skipped include it*/ diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index b06911ff6..5632b41e6 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -25,6 +25,11 @@ # define LV_CONF_INCLUDE_SIMPLE # endif # endif +# if __has_include("lvgl.h") +# ifndef LV_LVGL_H_INCLUDE_SIMPLE +# define LV_LVGL_H_INCLUDE_SIMPLE +# endif +# endif #endif /*If lv_conf.h is not skipped include it*/ From 37c3162bbebf75320c48024cbd7d575617aaa8a6 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 19 Apr 2021 20:22:38 +0200 Subject: [PATCH 026/152] Revert "feat(conf) automatically enable LV_LVGL_H_INCLUDE_SIMPLE if lvgl.h can be included" This reverts commit a995695cdf51d8ee476f19e619851fd40d7c90cf. __has_include("lvgl.h") is always true beacsue it's next to lv_conf_internal.h. --- scripts/lv_conf_checker.py | 5 ----- src/lv_conf_internal.h | 5 ----- 2 files changed, 10 deletions(-) diff --git a/scripts/lv_conf_checker.py b/scripts/lv_conf_checker.py index f83607958..d7cdaa2a4 100755 --- a/scripts/lv_conf_checker.py +++ b/scripts/lv_conf_checker.py @@ -42,11 +42,6 @@ fout.write( # define LV_CONF_INCLUDE_SIMPLE # endif # endif -# if __has_include("lvgl.h") -# ifndef LV_LVGL_H_INCLUDE_SIMPLE -# define LV_LVGL_H_INCLUDE_SIMPLE -# endif -# endif #endif /*If lv_conf.h is not skipped include it*/ diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index 5632b41e6..b06911ff6 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -25,11 +25,6 @@ # define LV_CONF_INCLUDE_SIMPLE # endif # endif -# if __has_include("lvgl.h") -# ifndef LV_LVGL_H_INCLUDE_SIMPLE -# define LV_LVGL_H_INCLUDE_SIMPLE -# endif -# endif #endif /*If lv_conf.h is not skipped include it*/ From 5b3df1336669841d8778480247f37d6cd74412c3 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 19 Apr 2021 22:10:01 +0200 Subject: [PATCH 027/152] docs: add some skeleton files for the new features --- docs/layouts/flex.md | 0 docs/layouts/grid.md | 0 docs/layouts/index.md | 0 docs/overview/coords.md | 51 ++++++++++++++++++++++++ docs/overview/event.md | 79 ++++++++++++------------------------- docs/overview/new_widget.md | 0 docs/overview/scroll.md | 44 +++++++++++++++++++++ 7 files changed, 120 insertions(+), 54 deletions(-) create mode 100644 docs/layouts/flex.md create mode 100644 docs/layouts/grid.md create mode 100644 docs/layouts/index.md create mode 100644 docs/overview/coords.md create mode 100644 docs/overview/new_widget.md create mode 100644 docs/overview/scroll.md diff --git a/docs/layouts/flex.md b/docs/layouts/flex.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/layouts/grid.md b/docs/layouts/grid.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/layouts/index.md b/docs/layouts/index.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/overview/coords.md b/docs/overview/coords.md new file mode 100644 index 000000000..4fd541ec7 --- /dev/null +++ b/docs/overview/coords.md @@ -0,0 +1,51 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/overview/coords.md +``` +# Positions, sizes, and layouts + +## Overview +Inspired by CSS. +Stored in style + +## Units +pixel +LV_PCT +LV_SIZE_CONTENT + +## Boxing model +Border, padding, content + + +## Position + +### Simple way +`lv_obj_set_pos/x/y` + +### Align +`lv_obj_align` +`lv_obj_align_to` +`lv_obj_center` + +### Translate positon + +## Size + +### Simple way +`lv_obj_set_size/width/height/_fit` + +### Min/max size + +### Transform width + +## Layout + +### Overview + +### Built-in layout + +### Adding new layouts + +### Examples + + diff --git a/docs/overview/event.md b/docs/overview/event.md index 6d7859a3b..3ddfb6af0 100644 --- a/docs/overview/event.md +++ b/docs/overview/event.md @@ -12,58 +12,34 @@ Events are triggered in LVGL when something happens which might be interesting t ## Add events to the object -The user can assign callback functions to an object to see these events. In practice, it looks like this: +The user can assign callback functions to an object to see its events. In practice, it looks like this: ```c lv_obj_t * btn = lv_btn_create(lv_scr_act()); -lv_obj_add_event_cb(btn, my_event_cb, NULL); /*Assign an event callback*/ +lv_obj_add_event_cb(btn, my_event_cb, LV_EVENT_CLICKED, NULL); /*Assign an event callback*/ ... -static void my_event_cb(lv_obj_t * obj, lv_event_t event) +static void my_event_cb(lv_event_t * event) { - switch(event) { - case LV_EVENT_PRESSED: - printf("Pressed\n"); - break; - - case LV_EVENT_SHORT_CLICKED: - printf("Short clicked\n"); - break; - - case LV_EVENT_CLICKED: - printf("Clicked\n"); - break; - - case LV_EVENT_LONG_PRESSED: - printf("Long press\n"); - break; - - case LV_EVENT_LONG_PRESSED_REPEAT: - printf("Long press repeat\n"); - break; - - case LV_EVENT_RELEASED: - printf("Released\n"); - break; - } - - /*Etc.*/ + printf("Clicked\n"); } ``` +In the example `LV_EVENT_CLICKED` means that only the click event will call `my_event_cb`. See the [list of event codes](#event-codes) for all the options. +`LV_EVENT_ALL` can be used to receive all the events. The last parameter of `lv_obj_add_event_cb` is a pointer to any custom data that will be available in the event. It will be described later in more detail. More events can be added to an object, like this: ```c -lv_obj_add_event_cb(obj, my_event_cb_1, NULL); -lv_obj_add_event_cb(obj, my_event_cb_2, NULL); -lv_obj_add_event_cb(obj, my_event_cb_3, NULL); +lv_obj_add_event_cb(obj, my_event_cb_1, LV_EVENT_CLICKED, NULL); +lv_obj_add_event_cb(obj, my_event_cb_2, LV_EVENT_PRESSED, NULL); +lv_obj_add_event_cb(obj, my_event_cb_3, LV_EVENT_ALL, NULL); /*No filtering, receive all events*/ ``` Even the same event callback can be used on an object with different `user_data`. For example: ```c -lv_obj_add_event_cb(obj, increment_on_click, &num1); -lv_obj_add_event_cb(obj, increment_on_click, &num2); +lv_obj_add_event_cb(obj, increment_on_click, LV_EVENT_CLICKED, &num1); +lv_obj_add_event_cb(obj, increment_on_click, LV_EVENT_CLICKED, &num2); ``` The events will be called in the order as they were added. @@ -74,7 +50,7 @@ More objects can use the same *event callback*. ## Remove event(s) from an object -Events can be removed fro man object with the `lv_obj_remove_event_cb(obj, event_cb, user_data)` function. If `user_data = NULL` the first matching `event_cb` will be removed regardless its `user_data`. +Events can be removed from an object with the `lv_obj_remove_event_cb(obj, event_cb)` function or `lv_obj_remove_event_dsc(obj, event_dsc)`. `event_dsc` is a pointer returned by `lv_obj_add_event_cb`. ## Event codes @@ -87,11 +63,11 @@ The event codes can be grouped into these categories: All objects (such as Buttons/Labels/Sliders etc.) regardless their type receive the *Input device*, *Drawing* and *Other* events. -However the *Special events* are specific to a particular object type. See the [widgets' documentation](/widgets/index) to learn when they are sent, +However the *Special events* are specific to a particular widget type. See the [widgets' documentation](/widgets/index) to learn when they are sent, -*Custom events* are added by the user and therefore these are never sent by LVGL +*Custom events* are added by the user and therefore these are never sent by LVGL. -The following event types exist: +The following event codes exist: ### Input device events - `LV_EVENT_PRESSED` The object has been pressed @@ -142,18 +118,13 @@ The following event types exist: ### Custom events -Any custom event can be added from `_LV_EVENT_LAST`. For example: -```c -#define MY_EVENT_1 (_LV_EVENT_LAST + 0) -#define MY_EVENT_2 (_LV_EVENT_LAST + 1) -#define MY_EVENT_3 (_LV_EVENT_LAST + 2) -``` +Any custom event codes can be registered by `uint32_t MY_EVENT_1 = lv_event_register_id();` And can be sent to any object with `lv_event_send(obj, MY_EVENT_1, &some_data)` ## Sending events -To manually send events to an object, use `lv_event_send(obj, LV_EVENT_..., &some_data)`. +To manually send events to an object, use `lv_event_send(obj, &some_data)`. For example, it can be used to manually close a message box by simulating a button press (although there are simpler ways of doing this): ```c @@ -170,19 +141,19 @@ lv_event_send(mbox, LV_EVENT_VALUE_CHANGED, &btn_id); - enable a button if some conditions are met (e.g. the correct PIN is entered) - add/remove styles to/from an object if a limit is exceeded, etc +## Fields of lv_event_t -## User data and event parameter -There are 2 custom pointer that are available in the events: -- `user_data`: set when the event is registered. -- `event_param`: set when the event is sent in `lv_event_send` - -In any event callback these pointer can be get with `lv_event_get_user_data(e)` and `lv_event_get_param(e)`. +`lv_event_t` is the only parameter passed to event callback and it contains all the data about the event. The following values can be get from it: +- `lv_event_get_code(e)` get the event code +- `lv_event_get_target(e)` get the object to which the event is sent +- `lv_event_get_original_target(e)` get the object to which the event is sent originally sent (different from `lv_event_get_target` if [event bubbling](event-bubbling) is enabled) +- `lv_event_get_user_data(e)` get the pointer passed as the last parameter of `lv_obj_add_event_cb`. +- `lv_event_get_param(e)` get the parameter passed as the last parameter of `lv_event_send` ## Event bubbling If `lv_obj_add_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE)` is enabled all events will be sent to the object's parent too. If the parent also has `LV_OBJ_FLAG_EVENT_BUBBLE` enabled the event will be sent to its parent too, and so on. -The `lv_obj_t * obj` argument of the event handler is always the current target object, not the original object. To get the original target call `lv_event_get_original_target()` in the event handler. - +The *target* parameter of the event is always the current target object, not the original object. To get the original target call `lv_event_get_original_target(e)` in the event handler. diff --git a/docs/overview/new_widget.md b/docs/overview/new_widget.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/overview/scroll.md b/docs/overview/scroll.md new file mode 100644 index 000000000..bfb87b356 --- /dev/null +++ b/docs/overview/scroll.md @@ -0,0 +1,44 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/overview/scroll.md +``` +# Scroll + +## Overview +How it works +Scrollbar +Directions +Everything is scrollable + +### Scrolled state +Scrolled state + +### Events +Scroll events + +## Basic example + +## Styling + +## Features of scrolling + +### Scrollable +scroll_dir too + +### Scroll momentum + +### Scroll chain + +### Scroll on focus + +### Snaping + +### Scroll one + +### Elastic scroll + +## Scroll thorw + +## Self size + +## Examples From 8cb2cbff81f48489d6b6b4193aa8f8db6b56ee57 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 19 Apr 2021 22:11:06 +0200 Subject: [PATCH 028/152] feat(obj) remove lv_obj_get_width/height_visible They can be replaced by max/min-width/height --- src/core/lv_obj_pos.c | 28 ---------------------------- src/core/lv_obj_pos.h | 18 ------------------ 2 files changed, 46 deletions(-) diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 432b3100b..51414f896 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -549,34 +549,6 @@ void lv_obj_get_coords_fit(const lv_obj_t * obj, lv_area_t * area) } -lv_coord_t lv_obj_get_height_visible(const lv_obj_t * obj) -{ - lv_obj_update_layout(obj); - - lv_coord_t h = LV_COORD_MAX; - lv_obj_t * parent = lv_obj_get_parent(obj); - while(parent) { - h = LV_MIN(lv_obj_get_height_fit(parent), h); - parent = lv_obj_get_parent(parent); - } - - return h == LV_COORD_MAX ? LV_DPI_DEF : h; -} - -lv_coord_t lv_obj_get_width_visible(const lv_obj_t * obj) -{ - lv_obj_update_layout(obj); - - lv_coord_t w = LV_COORD_MAX; - lv_obj_t * parent = lv_obj_get_parent(obj); - while(parent) { - w = LV_MIN(lv_obj_get_width_fit(parent), w); - parent = lv_obj_get_parent(parent); - } - - return w == LV_COORD_MAX ? LV_DPI_DEF : w; -} - lv_coord_t lv_obj_get_self_width(struct _lv_obj_t * obj) { lv_point_t p = {0, LV_COORD_MIN}; diff --git a/src/core/lv_obj_pos.h b/src/core/lv_obj_pos.h index 3a8c33281..c5e23de8b 100644 --- a/src/core/lv_obj_pos.h +++ b/src/core/lv_obj_pos.h @@ -255,24 +255,6 @@ lv_coord_t lv_obj_get_height_fit(const struct _lv_obj_t * obj); */ void lv_obj_get_coords_fit(const struct _lv_obj_t * obj, lv_area_t * area); -/** - * Get the height which is visible on the the given object without causing overflow. - * If there are smaller grand parents than their height will be considered. - * Useful on nested scrollable objects to get a height that fills the entire visible height. - * @param obj pointer to an object - * @return the visible height - */ -lv_coord_t lv_obj_get_height_visible(const struct _lv_obj_t * obj); - -/** - * Get the widht which is visible on the the given object without causing overflow. - * If there are smaller grand parents than their width will be considered. - * Useful on nested scrollable objects to get a width that fills the entire visible width. - * @param obj pointer to an object - * @return the visible width - */ -lv_coord_t lv_obj_get_width_visible(const struct _lv_obj_t * obj); - /** * Get the width occupied by the "parts" of the widget. E.g. the width of all columns of a table. * @param obj pointer to an objects From cbb13f4ea5cee70ce4fc5451169bc138379c6f8e Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 20 Apr 2021 13:26:57 +0200 Subject: [PATCH 029/152] fix(group) add some more widgets to default group --- src/extra/widgets/calendar/lv_calendar.c | 1 + src/extra/widgets/msgbox/lv_msgbox.c | 5 ++--- src/widgets/lv_btnmatrix.c | 1 + src/widgets/lv_roller.c | 1 + src/widgets/lv_table.c | 1 + 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/extra/widgets/calendar/lv_calendar.c b/src/extra/widgets/calendar/lv_calendar.c index 5b4095d67..60de506e8 100644 --- a/src/extra/widgets/calendar/lv_calendar.c +++ b/src/extra/widgets/calendar/lv_calendar.c @@ -38,6 +38,7 @@ const lv_obj_class_t lv_calendar_class = { .constructor_cb = lv_calendar_constructor, .width_def = (LV_DPI_DEF * 3) / 2, .height_def =(LV_DPI_DEF * 3) / 2, + .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE, .instance_size = sizeof(lv_calendar_t), .base_class = &lv_btnmatrix_class }; diff --git a/src/extra/widgets/msgbox/lv_msgbox.c b/src/extra/widgets/msgbox/lv_msgbox.c index f452b9779..224dd57a5 100644 --- a/src/extra/widgets/msgbox/lv_msgbox.c +++ b/src/extra/widgets/msgbox/lv_msgbox.c @@ -43,12 +43,11 @@ const lv_obj_class_t lv_msgbox_class = {.base_class = &lv_obj_class}; */ lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * btn_txts[], bool add_close_btn) { - lv_obj_t * parent = lv_obj_create(lv_layer_top()); - lv_obj_set_size(parent, LV_PCT(100), LV_PCT(100)); - + lv_obj_t * parent = lv_obj_create(lv_scr_act()); lv_obj_remove_style_all(parent); lv_obj_set_style_bg_color(parent, lv_color_grey(), 0); lv_obj_set_style_bg_opa(parent, LV_OPA_50, 0); + lv_obj_set_size(parent, LV_PCT(100), LV_PCT(100)); lv_obj_t * mbox = lv_obj_create_from_class(&lv_msgbox_class, parent); LV_ASSERT_MALLOC(mbox); diff --git a/src/widgets/lv_btnmatrix.c b/src/widgets/lv_btnmatrix.c index c971bd26c..eed8c536c 100644 --- a/src/widgets/lv_btnmatrix.c +++ b/src/widgets/lv_btnmatrix.c @@ -62,6 +62,7 @@ const lv_obj_class_t lv_btnmatrix_class = { .height_def = LV_DPI_DEF, .instance_size = sizeof(lv_btnmatrix_t), .editable = LV_OBJ_CLASS_EDITABLE_TRUE, + .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE, .base_class = &lv_obj_class }; diff --git a/src/widgets/lv_roller.c b/src/widgets/lv_roller.c index 8cb3d1eb9..852cb4d4e 100644 --- a/src/widgets/lv_roller.c +++ b/src/widgets/lv_roller.c @@ -51,6 +51,7 @@ const lv_obj_class_t lv_roller_class = { .height_def = LV_DPI_DEF, .instance_size = sizeof(lv_roller_t), .editable = LV_OBJ_CLASS_EDITABLE_TRUE, + .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE, .base_class = &lv_obj_class }; diff --git a/src/widgets/lv_table.c b/src/widgets/lv_table.c index 1bd8cc7ab..5863cb181 100644 --- a/src/widgets/lv_table.c +++ b/src/widgets/lv_table.c @@ -50,6 +50,7 @@ const lv_obj_class_t lv_table_class = { .height_def = LV_SIZE_CONTENT, .base_class = &lv_obj_class, .editable = LV_OBJ_CLASS_EDITABLE_TRUE, + .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE, .instance_size = sizeof(lv_table_t), }; /********************** From 48e70e97f010c9229f3f7cf740d7dc55c50c8602 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 20 Apr 2021 13:31:40 +0200 Subject: [PATCH 030/152] fix(roller) fix left shift negative value reported by ASAN --- src/widgets/lv_roller.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/lv_roller.c b/src/widgets/lv_roller.c index 852cb4d4e..00ba380b5 100644 --- a/src/widgets/lv_roller.c +++ b/src/widgets/lv_roller.c @@ -485,8 +485,8 @@ static void draw_main(lv_event_t * e) lv_coord_t roller_h = lv_obj_get_height(obj); int32_t label_y_prop = label->coords.y1 - (roller_h / 2 + obj->coords.y1); /*label offset from the middle line of the roller*/ - label_y_prop = (label_y_prop << 14) / lv_obj_get_height( - label); /*Proportional position from the middle line (upscaled)*/ + label_y_prop = (label_y_prop * 16384) / lv_obj_get_height( + label); /*Proportional position from the middle line (upscaled by << 14)*/ /*Apply a correction with different line heights*/ const lv_font_t * normal_label_font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); From d412a98e548e28da1ede5e470943fcc303f0f205 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 20 Apr 2021 13:46:49 +0200 Subject: [PATCH 031/152] fix(chart) don't draw division lines on the sides if there no padding but have a visible border --- src/widgets/lv_chart.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/widgets/lv_chart.c b/src/widgets/lv_chart.c index f518e700b..3c2ae7a43 100644 --- a/src/widgets/lv_chart.c +++ b/src/widgets/lv_chart.c @@ -667,7 +667,9 @@ static void draw_div_lines(lv_obj_t * obj, const lv_area_t * clip_area) bool mask_ret = _lv_area_intersect(&series_mask, &obj->coords, clip_area); if(mask_ret == false) return; - uint16_t i; + int16_t i; + int16_t i_start; + int16_t i_end; lv_point_t p1; lv_point_t p2; lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); @@ -679,13 +681,25 @@ static void draw_div_lines(lv_obj_t * obj, const lv_area_t * clip_area) lv_draw_line_dsc_init(&line_dsc); lv_obj_init_draw_line_dsc(obj, LV_PART_MAIN, &line_dsc); + lv_opa_t border_opa = lv_obj_get_style_border_opa(obj, LV_PART_MAIN); + lv_coord_t border_w = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + lv_border_side_t border_side = lv_obj_get_style_border_side(obj, LV_PART_MAIN); + lv_coord_t scroll_left = lv_obj_get_scroll_left(obj); lv_coord_t scroll_top = lv_obj_get_scroll_top(obj); if(chart->hdiv_cnt != 0) { lv_coord_t y_ofs = obj->coords.y1 + pad_top - scroll_top; p1.x = obj->coords.x1; p2.x = obj->coords.x2; - for(i = 0; i < chart->hdiv_cnt; i++) { + + i_start = 0; + i_end = chart->hdiv_cnt; + if(border_opa > LV_OPA_MIN && border_w > 0) { + if(border_side & LV_BORDER_SIDE_TOP) i_start++; + if(border_side & LV_BORDER_SIDE_BOTTOM) i_end--; + } + + for(i = i_start; i < i_end; i++) { p1.y = (int32_t)((int32_t)(h - line_dsc.width) * i) / (chart->hdiv_cnt - 1); p1.y += y_ofs; p2.y = p1.y; @@ -697,7 +711,14 @@ static void draw_div_lines(lv_obj_t * obj, const lv_area_t * clip_area) lv_coord_t x_ofs = obj->coords.x1 + pad_left - scroll_left; p1.y = obj->coords.y1; p2.y = obj->coords.y2; - for(i = 0; i < chart->vdiv_cnt; i++) { + i_start = 0; + i_end = chart->vdiv_cnt; + if(border_opa > LV_OPA_MIN && border_w > 0) { + if(border_side & LV_BORDER_SIDE_LEFT) i_start++; + if(border_side & LV_BORDER_SIDE_RIGHT) i_end--; + } + + for(i = i_start; i < i_end; i++) { p1.x = (int32_t)((int32_t)(w - line_dsc.width) * i) / (chart->vdiv_cnt - 1); p1.x += x_ofs; p2.x = p1.x; From c2d6c3805cebccd2d3659e39bdaf4ffb337578a5 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 20 Apr 2021 13:50:19 +0200 Subject: [PATCH 032/152] fix(coords) make lv_pct and LV_SIZE_CONTENT available to the MicroPython binding --- src/misc/lv_area.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/misc/lv_area.h b/src/misc/lv_area.h index 6d7736d7d..e56fb4bc7 100644 --- a/src/misc/lv_area.h +++ b/src/misc/lv_area.h @@ -252,6 +252,19 @@ void _lv_area_align(const lv_area_t * base, const lv_area_t * to_align, lv_align #define LV_COORD_GET_PCT(x) _LV_COORD_PLAIN(x) #define LV_SIZE_CONTENT LV_COORD_SET_SPEC(1001) +LV_EXPORT_CONST_INT(LV_SIZE_CONTENT); + +/** + * Convert a percentage value to `lv_coord_t`. + * Percentage values are stored in special range + * @param x the percentage (0..1000) + * @return a coordinate that stores the percentage + */ +static inline lv_coord_t lv_pct(lv_coord_t x) +{ + return LV_PCT(x); +} + #ifdef __cplusplus } /*extern "C"*/ #endif From 13d38f6a529039222d035544dcd744f1bd3c0a97 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 20 Apr 2021 13:54:35 +0200 Subject: [PATCH 033/152] fix(style) rename path_cb to path_xcb in lv_style_transition_dsc_init It was required for the MicroPython binding --- src/misc/lv_style.c | 4 ++-- src/misc/lv_style.h | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index f49ff0f14..b195080bd 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -198,11 +198,11 @@ lv_res_t lv_style_get_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_va return lv_style_get_prop_inlined(style, prop, value); } -void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay) +void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, lv_anim_path_cb_t path_xcb, uint32_t time, uint32_t delay) { lv_memset_00(tr, sizeof(lv_style_transition_dsc_t)); tr->props = props; - tr->path_cb = path_cb == NULL ? lv_anim_path_linear : path_cb; + tr->path_cb = path_xcb == NULL ? lv_anim_path_linear : path_xcb; tr->time = time; tr->delay = delay; } diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index c8ee5b7c9..090e03c66 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -358,16 +358,15 @@ static inline lv_res_t lv_style_get_prop_inlined(lv_style_t * style, lv_style_pr * Initialize a transition descriptor. * @param tr pointer to a transition descriptor to initialize * @param props an array with the properties to transition. The last element must be zero. - * @param path_cb and animation path (ease) callback. If `NULL` liner path will be used. + * @param path_xcb and animation path (ease) callback. If `NULL` liner path will be used. * @param time duration of the transition in [ms] * @param delay delay before the transition in [ms] * @example * const static lv_style_prop_t trans_props[] = { LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR, 0 }; * static lv_style_transition_dsc_t trans1; * lv_style_transition_dsc_init(&trans1, trans_props, NULL, 300, 0); - * @note For performance reasons there are no sanity check on `style` */ -void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay); +void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, lv_anim_path_cb_t path_xcb, uint32_t time, uint32_t delay); /** * Get the default value of a property From 4b0c85426ab3dc66cf8e0461420e3e502a24591a Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 20 Apr 2021 14:57:56 +0200 Subject: [PATCH 034/152] feat(lv_init) check if LV_BIG_ENDIAN_SYSTEM is enabled on big endian systems --- src/core/lv_obj.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index 96d73f875..07d519131 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -147,6 +147,16 @@ void lv_init(void) LV_LOG_WARN("The strings has no UTF-8 encoding. Non-ASCII characters won't be displayed.") } + uint32_t endianess_test = 0x11223344; + uint8_t * endianess_test_p = (uint8_t*) &endianess_test; + bool big_endian = endianess_test_p[0] == 0x11 ? true : false; + + if(big_endian) { + LV_ASSERT_MSG(LV_BIG_ENDIAN_SYSTEM == 1, "It's a big endian system but LV_BIG_ENDIAN_SYSTEM is not enabled in lv_conf.h"); + } else { + LV_ASSERT_MSG(LV_BIG_ENDIAN_SYSTEM == 0, "It's a little endian system but LV_BIG_ENDIAN_SYSTEM is enabled in lv_conf.h"); + } + #if LV_USE_ASSERT_MEM_INTEGRITY LV_LOG_WARN("Memory integrity checks are enabled via LV_USE_ASSERT_MEM_INTEGRITY which makes LVGL much slower") #endif From 4324cf72f3302dee6dfb63d860335876470cd903 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 20 Apr 2021 21:08:16 +0200 Subject: [PATCH 035/152] refactor(style, obj) lv_obj_get_width/height_fit -> lv_objget_get_content_width/height, style_tranform_x/y -> style_translate_x/y --- docs/overview/coords.md | 297 +++++++++++++++++- examples/widgets/btn/lv_example_btn_3.c | 2 +- examples/widgets/imgbtn/lv_example_imgbtn_1.c | 2 +- scripts/style_api_gen.py | 4 +- src/core/lv_obj_pos.c | 51 +-- src/core/lv_obj_pos.h | 22 +- src/core/lv_obj_style.c | 8 +- src/core/lv_obj_style_gen.h | 32 +- src/core/lv_theme.h | 1 + src/extra/layouts/flex/lv_flex.c | 8 +- src/extra/layouts/flex/lv_flex.h | 2 - src/extra/layouts/grid/lv_grid.c | 12 +- src/extra/widgets/msgbox/lv_msgbox.c | 2 +- src/extra/widgets/tabview/lv_tabview.c | 2 +- src/extra/widgets/tileview/lv_tileview.c | 10 +- src/misc/lv_style.c | 6 +- src/misc/lv_style.h | 12 +- src/misc/lv_style_gen.h | 16 +- src/widgets/lv_btnmatrix.c | 4 +- src/widgets/lv_chart.c | 28 +- src/widgets/lv_dropdown.c | 6 +- src/widgets/lv_label.c | 4 +- src/widgets/lv_meter.c | 6 +- src/widgets/lv_roller.c | 8 +- src/widgets/lv_textarea.c | 4 +- 25 files changed, 413 insertions(+), 136 deletions(-) diff --git a/docs/overview/coords.md b/docs/overview/coords.md index 4fd541ec7..7ff1df19a 100644 --- a/docs/overview/coords.md +++ b/docs/overview/coords.md @@ -5,47 +5,310 @@ # Positions, sizes, and layouts ## Overview -Inspired by CSS. -Stored in style +Similarly to many other parts of LVGL, the concept of setting the coordinates were inspired by CSS. It doesn't mean a perfect copy of the standard but parts that are reasonable were adopted in LVGL. +It shorts it means: +- the set corrdintates (size, position, layouts, etc) are stored in styles +- support min-width, max-width, min-height, max-height +- have pixel, percentage, and "content" units +- a subset of felxbox and grid layouts are supported by default + +### Units +- pixel: Simply a position in pixels. A simple integer always mean pixel. E.g. `lv_obj_set_x(btn, 10)` +- percentage: The percentage of the size of the obejct or its parent (dependeing on the property). The `lv_pct(value)` converts a value to percentage. E.g. `lv_obj_set_width(btn, lv_pct(50))` +- `LV_SIZE_CONTENT`: Specai lvalue to set the width/height of an object to involve all the children. Its similar to `auto` in CSS. E.g. `lv_obj_set_width(btn, LV_SIZE_CONTENT)`. -## Units -pixel -LV_PCT -LV_SIZE_CONTENT +### Boxing model +An object's "box" is built from the following parts: +- bounding box: the width/height of the elements. +- padding: space between the sides of the object and its children. +- content: the content area which size if the bounding box reduced by the size of the paddings. -## Boxing model -Border, padding, content +The border is drawn inside the bounding box and doesn't take an extra space. (It's different from CSS in which increasing the border width makes the object larger.) +The outline is drawn outside of the bounding box. ## Position ### Simple way -`lv_obj_set_pos/x/y` +To simple set the x and y coordinates of an object use +```c +lv_obj_set_x(obj, 10); +lv_obj_set_y(obj, 20); +lv_obj_set_pos(obj, 10, 20); //Or in one function +``` + +By default the the x and y coordinates are measured from the top left corner of the parent's content area. +For example if the parent has 5 pixel padding on every side, the above code will place `obj` to (15, 25) becasue the content area starts after the padding. + +If percentage values are calculated from the parents content area size. +```c +lv_obj_set_x(btn, lv_pct(10)); //x = 10 % of parant content area width +``` ### Align -`lv_obj_align` -`lv_obj_align_to` -`lv_obj_center` +In some cases it's convinient to change the origin of the positioning from the the default top left. If the the orogin is changed e.g. to bottom-right, the (0,0) positon means: align to the bottom-right corner. +To change the origin use: +```c +lv_obj_set_align(obj, align); +``` -### Translate positon +To change the alignment and set new coordiantes: +```c +lv_obj_align(obj, align, x, y); +``` + +The following alignment options can be used: +- `LV_ALIGN_TOP_LEFT` +- `LV_ALIGN_TOP_MID` +- `LV_ALIGN_TOP_RIGHT` +- `LV_ALIGN_BOTTOM_LEFT` +- `LV_ALIGN_BOTTOM_MID` +- `LV_ALIGN_BOTTOM_RIGHT` +- `LV_ALIGN_LEFT_MID` +- `LV_ALIGN_RIGHT_MID` +- `LV_ALIGN_CENTER` + +It quite common to align a children to the center of its parent, tehre fore is a dedicated function for it: +```c +lv_obj_center(obj); + +//Has the same effect +lv_obj_align(obj, LV_ALIGN_CENTER, 0, 0); +``` + +If the parent's size changes the set alignment and position of the children is applied again automatically. + +The functions introduced above aligns the obejct to its parent. However it's also possible to align an obejct to an arbitrary object. +```c +lv_obj_align_to(obj_to_align, reference_obj, align, x, y); +``` + +Besides the alignments optins above the follwing can be used to align the object outside of the refrence object: + +- `LV_ALIGN_OUT_TOP_LEFT` +- `LV_ALIGN_OUT_TOP_MID` +- `LV_ALIGN_OUT_TOP_RIGHT` +- `LV_ALIGN_OUT_BOTTOM_LEFT` +- `LV_ALIGN_OUT_BOTTOM_MID` +- `LV_ALIGN_OUT_BOTTOM_RIGHT` +- `LV_ALIGN_OUT_LEFT_TOP` +- `LV_ALIGN_OUT_LEFT_MID` +- `LV_ALIGN_OUT_LEFT_BOTTOM` +- `LV_ALIGN_OUT_RIGHT_TOP` +- `LV_ALIGN_OUT_RIGHT_MID` +- `LV_ALIGN_OUT_RIGHT_BOTTOM` + +For example to align a label above a button and center the label is horizontally: +```c +lv_obj_align_to(label, btn, LV_ALIGN_OUT_TOP_MID, 0, -10); +``` + +Not that - unlike with `lv_obj_align()` - `lv_obj_align_to()` can not realign the object if its coordinates or the reference object's coordinates changes. ## Size ### Simple way -`lv_obj_set_size/width/height/_fit` +The width and the height of an object can be set easily as well: +```c +lv_obj_set_width(obj, 200); +lv_obj_set_height(obj, 100); +lv_obj_set_size(obj, 200, 100); //Or in one function +``` -### Min/max size +Percentage values aer calculated based on the parent's content area size. For example to set the object's height to the screen height: +```c +lv_obj_set_height(obj, lv_pct(100)); +``` -### Transform width +Size setting supports a value: `LV_SIZE_CONTENT`. It means the object's size in the respective direction will be set to involv its the children. +Note that only children on the right and bottom will be considered and children o nthe top and left remains cropped. This limitation makes the behavior more predictible. + +Object with `LV_OBJ_FLAG_HIDDEN` or `LV_OBJ_FLAG_FLOATING` will be ignored by `LV_SIZE_CONTENT` calculation. + +The above functions set the size of the bounding box of the object but the size of the content area can be set as well. It means the obejct's bounding box will be larger with the paddings than the set size. +```c +lv_obj_set_content_width(obj, 50); +lv_obj_set_content_height(obj, 30); +``` + +The size of the bounding box and the content area can be get with the following functions: +```c +lv_coord_t w = lv_obj_get_width(obj); +lv_coord_t h = lv_obj_get_height(obj); +lv_coord_t content_w = lv_obj_get_content_width(obj); +lv_coord_t content_h = lv_obj_get_content_height(obj); +``` + +## Using styles +Under the hood the position, size and alignment properties are style properties. +The above described "simple functions" hide the style related code for the sake of simplicity and set the position, size, and alignment properties in the local styles of the obejct. + +However, using styles as to set the coordinates has some great advantages: +- It makes easy to set the width/height/etc for several obejct togother with ease. E.g. all make all the sliders 100x10 pixels sized. +- It also makes possibel to modify the values in one place. +- The values can be overwritten by other styles. For example `style_btn` makes the object `100x50` by default but adding `style_full_width` overwrites only the width of the object. +- The object can have different position or size in different state. E.g. 100 px wide in `LV_STATE_DEFAULT` but 120 px in `LV_STATE_PRESSED`. +- Style transitions can be used to make the coordinate changes smooth. + + +Here are some examples to set an object's size using a style: +```c +static lv_style_t style; +lv_style_init(&style); +lv_style_set_width(&style, 100); + +lv_obj_t * btn = lv_btn_create(lv_scr_act()); +lv_obj_add_style(btn, &style, LV_PART_MAIN); +``` + +As you will see below there are some other great fetures of size and position setting. +However, to keep the LVGL's API lean only the most common coordinate setting features have a "simple" version and the more complex features can be used via styles. + +### Translations and transformations + +### Translation + +Let's say the there are 3 buttons next to each other. Their position is set as described above. +Now you want to move a buttons up a little when it's pressed. + +One way to achive this is setting a new Y coordinate for pressed state: +```c +static lv_style_t style_normal; +lv_style_init(&style_normal); +lv_style_set_y(&style_normal, 100); + +static lv_style_t style_pressed; +lv_style_init(&style_pressed); +lv_style_set_y(&style_pressed, 80); + +lv_obj_add_style(btn1, &style_normal, LV_STATE_DEFAULT); +lv_obj_add_style(btn1, &style_pressed, LV_STATE_PRESSED); + +lv_obj_add_style(btn2, &style_normal, LV_STATE_DEFAULT); +lv_obj_add_style(btn2, &style_pressed, LV_STATE_PRESSED); + +lv_obj_add_style(btn3, &style_normal, LV_STATE_DEFAULT); +lv_obj_add_style(btn3, &style_pressed, LV_STATE_PRESSED); +``` + +It workes but it's not really flexible becasue the pressed coordinate is hardcoded. If the buttons are not at y=100 `style_pressed` won't work as expected. To solve this translations can be used: +```c +static lv_style_t style_normal; +lv_style_init(&style_normal); +lv_style_set_y(&style_normal, 100); + +static lv_style_t style_pressed; +lv_style_init(&style_pressed); +lv_style_set_translate_y(&style_pressed, -20); + +lv_obj_add_style(btn1, &style_normal, LV_STATE_DEFAULT); +lv_obj_add_style(btn1, &style_pressed, LV_STATE_PRESSED); + +lv_obj_add_style(btn2, &style_normal, LV_STATE_DEFAULT); +lv_obj_add_style(btn2, &style_pressed, LV_STATE_PRESSED); + +lv_obj_add_style(btn3, &style_normal, LV_STATE_DEFAULT); +lv_obj_add_style(btn3, &style_pressed, LV_STATE_PRESSED); +``` + +Translation is applied from the current position of the object. + +Perecentage values can be used in translations as well. In this case the percentage is releative to the size of the object. For example `lv_pct(50)` will move the object with half of its wifth/height. + +The translations is applied when the layouts are calcualted. Therefore, even the layouted objects' position can be translated. + +The translation actually moves the object. It means it makes the scrollbars and `LV_SIZE_CONTENT` sized objects react on the position change. + + +### Transformation +Similarly to the position the size can be changed relative to the current size as well. The transformed width and hight is added on both sides of the object. That is 10 px transformed width amkes the object 2x10 pixel larger. + +Unlike position translation, the size transformation doesn't make the object "really" larget. In other words scrollbars, layouts, `LV_SIZE_CONTENT` will not consider the transformed size. +Hence size transformation if "only" a visual effect. + +This code makes the a button larger when it's pressed: +```c +static lv_style_t style_pressed; +lv_style_init(&style_pressed); +lv_style_set_transform_width(&style_pressed, 10); +lv_style_set_transform_height(&style_pressed, 10); + +lv_obj_add_style(btn, &style_pressed, LV_STATE_PRESSED); +``` + +### Min and Max size +Similarly to CSS, LVGL also support `min-width`, `max-width`, `min-height` and `max-height`. These are limits preventing an obejct's size to be smaller/larger then these values. +They are espically useful if the size is set by percentage or `LV_SIZE_CONTENT`. +```c +static lv_style_t style_max_height; +lv_style_init(&style_max_height); +lv_style_set_y(&style_max_height, 200); + +lv_obj_set_height(obj, lv_pct(100)); +lv_obj_add_style(obj, &style_max_height, LV_STATE_DEFAULT); //Limit height to 200 +``` ## Layout ### Overview +Layouts can update the the position and size of an object's children. They can be used to automatically arrange the children into a line or column, or in much more complicated ways. + +The position and size set by the layout overwrites the "normal" x, y, width, and height settings. + +There is only one function that is the same for every layout: `lv_obj_set_layout(obj, )` sets the layout on an obejct. +For the further settings of the parent and children for a specific layout see the documentions of the given layout. ### Built-in layout +LVGL comes with two very powerful layouts: +- Flexbox +- Grid + +Both are heavily inspired by the CSS layouts with the same name. + +### Flags +There are some flags that can be used on object to affect how they behave with layouts: +- `LV_OBJ_FLAG_HIDDEN` Hidden object are ignored from layout calcualtions. +- `LV_OBJ_FLAG_IGNORE_LAYOUT` The object is simply ignored by the layouts. It's coordinate can be set as usual. +- `LV_OBJ_FLAG_FLOATING` Same as `LV_OBJ_FLAG_IGNORE_LAYOUT` but the object with `LV_OBJ_FLAG_FLOATING` will be ignored from `LV_SIZE_CONTENT` calculations. + +These falgs can be added/remoevd with `lv_obj_add/clear_flag(obj, FLAG);` ### Adding new layouts -### Examples +LVGL can be freely extended by a custom layouts like this: +```c +uint32_t MY_LAYOUT; + +... + +MY_LAYOUT = lv_layout_register(my_layout_update, &user_data); + +... + +void my_layout_update(lv_obj_t * obj, void * user_data) +{ + /*Will be called automatically if required to reposition/resize the children of "obj" */ +} +``` + +Custom style properties can be added too that can be get and used in the update callback. For example: +```c +uint32_t MY_PROP; +... + +LV_STYLE_MY_PROP = lv_style_register_prop(); + +... +static inline void lv_style_set_my_prop(lv_style_t * style, uint32_t value) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_style_set_prop(style, LV_STYLE_MY_PROP, v); +} + +``` + +## Examples diff --git a/examples/widgets/btn/lv_example_btn_3.c b/examples/widgets/btn/lv_example_btn_3.c index 8b28b657b..633b52fe5 100644 --- a/examples/widgets/btn/lv_example_btn_3.c +++ b/examples/widgets/btn/lv_example_btn_3.c @@ -9,7 +9,7 @@ void lv_example_btn_3(void) { /*Properties to transition*/ static lv_style_prop_t props[] = { - LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, LV_STYLE_TEXT_LETTER_SPACE, 0 + LV_STYLE_TRANSLATE_WIDTH, LV_STYLE_TRANSLATE_HEIGHT, LV_STYLE_TEXT_LETTER_SPACE, 0 }; /*Transition descriptor when going back to the default state. diff --git a/examples/widgets/imgbtn/lv_example_imgbtn_1.c b/examples/widgets/imgbtn/lv_example_imgbtn_1.c index ef51b3f5c..f4cdfbac8 100644 --- a/examples/widgets/imgbtn/lv_example_imgbtn_1.c +++ b/examples/widgets/imgbtn/lv_example_imgbtn_1.c @@ -8,7 +8,7 @@ void lv_example_imgbtn_1(void) LV_IMG_DECLARE(imgbtn_mid); /*Create a transition animation on width transformation and recolor.*/ - static lv_style_prop_t tr_prop[] = {LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_IMG_RECOLOR_OPA, 0}; + static lv_style_prop_t tr_prop[] = {LV_STYLE_TRANSLATE_WIDTH, LV_STYLE_IMG_RECOLOR_OPA, 0}; static lv_style_transition_dsc_t tr; lv_style_transition_dsc_init(&tr, tr_prop, lv_anim_path_linear, 200, 0); diff --git a/scripts/style_api_gen.py b/scripts/style_api_gen.py index 007696996..adb41ccd8 100755 --- a/scripts/style_api_gen.py +++ b/scripts/style_api_gen.py @@ -7,8 +7,8 @@ props = [ {'name': 'CLIP_CORNER', 'style_type': 'num', 'var_type': 'bool' }, {'name': 'TRANSFORM_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, {'name': 'TRANSFORM_HEIGHT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TRANSFORM_X', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TRANSFORM_Y', 'style_type': 'num', 'var_type': 'lv_coord_t' }, +{'name': 'TRANSLATE_X', 'style_type': 'num', 'var_type': 'lv_coord_t' }, +{'name': 'TRANSLATE_Y', 'style_type': 'num', 'var_type': 'lv_coord_t' }, {'name': 'TRANSFORM_ZOOM', 'style_type': 'num', 'var_type': 'lv_coord_t' }, {'name': 'TRANSFORM_ANGLE', 'style_type': 'num', 'var_type': 'lv_coord_t' }, {'name': 'OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 51414f896..faf28c66d 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -113,7 +113,7 @@ void lv_obj_refr_size(lv_obj_t * obj) /*Calculate the sizes in percentage*/ bool pct_w = LV_COORD_IS_PCT(w) ? true : false; - lv_coord_t parent_w = lv_obj_get_width_fit(parent); + lv_coord_t parent_w = lv_obj_get_content_width(parent); if(pct_w) w = (LV_COORD_GET_PCT(w) * parent_w) / 100; lv_coord_t minw = lv_obj_get_style_min_width(obj, LV_PART_MAIN); @@ -138,7 +138,7 @@ void lv_obj_refr_size(lv_obj_t * obj) /*Calculate the sizes in percentage*/ bool pct_h = LV_COORD_IS_PCT(h) ? true : false; - lv_coord_t parent_h = lv_obj_get_height_fit(parent); + lv_coord_t parent_h = lv_obj_get_content_height(parent); if(pct_h) h = (LV_COORD_GET_PCT(h) * parent_h) / 100; lv_coord_t minh = lv_obj_get_style_min_height(obj, LV_PART_MAIN); @@ -164,7 +164,7 @@ void lv_obj_refr_size(lv_obj_t * obj) /*Check if the object inside the parent or not*/ lv_area_t parent_fit_area; - lv_obj_get_coords_fit(parent, &parent_fit_area); + lv_obj_get_content_coords(parent, &parent_fit_area); /*If the object is already out of the parent and its position is changes *surely the scrollbars also changes so invalidate them*/ @@ -317,6 +317,11 @@ uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data) return layout_cnt; /*No -1 to skip 0th index*/ } +void lv_obj_set_align(struct _lv_obj_t * obj, lv_align_t align) +{ + lv_obj_set_style_align(obj, align, 0); +} + void lv_obj_align(lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs) { lv_obj_set_style_align(obj, align, 0); @@ -339,45 +344,45 @@ void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv lv_coord_t ptop = lv_obj_get_style_pad_top(parent, LV_PART_MAIN); switch(align) { case LV_ALIGN_CENTER: - x = lv_obj_get_width_fit(base) / 2 - lv_obj_get_width(obj) / 2; - y = lv_obj_get_height_fit(base) / 2 - lv_obj_get_height(obj) / 2; + x = lv_obj_get_content_width(base) / 2 - lv_obj_get_width(obj) / 2; + y = lv_obj_get_content_height(base) / 2 - lv_obj_get_height(obj) / 2; break; case LV_ALIGN_TOP_LEFT: x = 0; y = 0; break; case LV_ALIGN_TOP_MID: - x = lv_obj_get_width_fit(base) / 2 - lv_obj_get_width(obj) / 2; + x = lv_obj_get_content_width(base) / 2 - lv_obj_get_width(obj) / 2; y = 0; break; case LV_ALIGN_TOP_RIGHT: - x = lv_obj_get_width_fit(base) - lv_obj_get_width(obj); + x = lv_obj_get_content_width(base) - lv_obj_get_width(obj); y = 0; break; case LV_ALIGN_BOTTOM_LEFT: x = 0; - y = lv_obj_get_height_fit(base) - lv_obj_get_height(obj); + y = lv_obj_get_content_height(base) - lv_obj_get_height(obj); break; case LV_ALIGN_BOTTOM_MID: - x = lv_obj_get_width_fit(base) / 2 - lv_obj_get_width(obj) / 2; - y = lv_obj_get_height_fit(base) - lv_obj_get_height(obj); + x = lv_obj_get_content_width(base) / 2 - lv_obj_get_width(obj) / 2; + y = lv_obj_get_content_height(base) - lv_obj_get_height(obj); break; case LV_ALIGN_BOTTOM_RIGHT: - x = lv_obj_get_width_fit(base) - lv_obj_get_width(obj); - y = lv_obj_get_height_fit(base) - lv_obj_get_height(obj); + x = lv_obj_get_content_width(base) - lv_obj_get_width(obj); + y = lv_obj_get_content_height(base) - lv_obj_get_height(obj); break; case LV_ALIGN_LEFT_MID: x = 0; - y = lv_obj_get_height_fit(base) / 2 - lv_obj_get_height(obj) / 2; + y = lv_obj_get_content_height(base) / 2 - lv_obj_get_height(obj) / 2; break; case LV_ALIGN_RIGHT_MID: - x = lv_obj_get_width_fit(base) - lv_obj_get_width(obj); - y = lv_obj_get_height_fit(base) / 2 - lv_obj_get_height(obj) / 2; + x = lv_obj_get_content_width(base) - lv_obj_get_width(obj); + y = lv_obj_get_content_height(base) / 2 - lv_obj_get_height(obj) / 2; break; case LV_ALIGN_OUT_TOP_LEFT: @@ -517,7 +522,7 @@ lv_coord_t lv_obj_get_height(const lv_obj_t * obj) return lv_area_get_height(&obj->coords); } -lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj) +lv_coord_t lv_obj_get_content_width(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -527,7 +532,7 @@ lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj) return lv_obj_get_width(obj) - left - right; } -lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj) +lv_coord_t lv_obj_get_content_height(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -537,7 +542,7 @@ lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj) return lv_obj_get_height(obj) - top - bottom; } -void lv_obj_get_coords_fit(const lv_obj_t * obj, lv_area_t * area) +void lv_obj_get_content_coords(const lv_obj_t * obj, lv_area_t * area) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -587,14 +592,14 @@ void lv_obj_refr_pos(lv_obj_t * obj) } /*Handle percentage value*/ - lv_coord_t pw = lv_obj_get_width_fit(parent); - lv_coord_t ph = lv_obj_get_height_fit(parent); + lv_coord_t pw = lv_obj_get_content_width(parent); + lv_coord_t ph = lv_obj_get_content_height(parent); if(LV_COORD_IS_PCT(x)) x = (pw * LV_COORD_GET_PCT(x)) / 100; if(LV_COORD_IS_PCT(y)) y = (ph * LV_COORD_GET_PCT(y)) / 100; /*Handle percentage value of translate*/ - lv_coord_t tr_x = lv_obj_get_style_transform_x(obj, LV_PART_MAIN); - lv_coord_t tr_y = lv_obj_get_style_transform_y(obj, LV_PART_MAIN); + lv_coord_t tr_x = lv_obj_get_style_translate_x(obj, LV_PART_MAIN); + lv_coord_t tr_y = lv_obj_get_style_translate_y(obj, LV_PART_MAIN); lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); if(LV_COORD_IS_PCT(tr_x)) tr_x = (w * LV_COORD_GET_PCT(tr_x)) / 100; @@ -685,7 +690,7 @@ void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) lv_area_t parent_fit_area; bool on1 = false; if(parent) { - lv_obj_get_coords_fit(parent, &parent_fit_area); + lv_obj_get_content_coords(parent, &parent_fit_area); /*If the object is already out of the parent and its position is changes *surely the scrollbars also changes so invalidate them*/ diff --git a/src/core/lv_obj_pos.h b/src/core/lv_obj_pos.h index c5e23de8b..70bb6cfcb 100644 --- a/src/core/lv_obj_pos.h +++ b/src/core/lv_obj_pos.h @@ -77,7 +77,7 @@ void lv_obj_refr_size(struct _lv_obj_t * obj); * @note possible values are: * pixel simple set the size accordingly * LV_SIZE_CONTENT set the size to involve all children in the given direction - * LV_SIZE_PCT(x) to set size in percentage of the parent's content area size (the size without paddings). + * lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings). * x should be in [0..1000]% range */ void lv_obj_set_width(struct _lv_obj_t * obj, lv_coord_t w); @@ -89,7 +89,7 @@ void lv_obj_set_width(struct _lv_obj_t * obj, lv_coord_t w); * @note possible values are: * pixel simple set the size accordingly * LV_SIZE_CONTENT set the size to involve all children in the given direction - * LV_SIZE_PCT(x) to set size in percentage of the parent's content area size (the size without paddings). + * lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings). * x should be in [0..1000]% range */ void lv_obj_set_height(struct _lv_obj_t * obj, lv_coord_t h); @@ -143,7 +143,17 @@ void lv_obj_update_layout(const struct _lv_obj_t * obj); uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data); /** - * Align an object to an other object. + * Change the alignment of an object. + * @param obj pointer to an object to align + * @param align type of alignment (see 'lv_align_t' enum) `LV_ALIGN_OUT_...` can't be used. + */ +void lv_obj_set_align(struct _lv_obj_t * obj, lv_align_t align); + +/** + * Change the alignment of an object and set new coordinates. + * Equivalent to: + * lv_obj_set_align(obj, align); + * lv_obj_set_pos(obj, x_ofs, y_ofs); * @param obj pointer to an object to align * @param align type of alignment (see 'lv_align_t' enum) `LV_ALIGN_OUT_...` can't be used. * @param x_ofs x coordinate offset after alignment @@ -239,21 +249,21 @@ lv_coord_t lv_obj_get_height(const struct _lv_obj_t * obj); * @param obj pointer to an object * @return the width which still fits into its parent without causing overflow (making the parent scrollable) */ -lv_coord_t lv_obj_get_width_fit(const struct _lv_obj_t * obj); +lv_coord_t lv_obj_get_content_width(const struct _lv_obj_t * obj); /** * Get the height reduced by the top an bottom padding. * @param obj pointer to an object * @return the height which still fits into the parent without causing overflow (making the parent scrollable) */ -lv_coord_t lv_obj_get_height_fit(const struct _lv_obj_t * obj); +lv_coord_t lv_obj_get_content_height(const struct _lv_obj_t * obj); /** * Get the area reduced by the paddings. * @param obj pointer to an object * @param area the area which still fits into the parent without causing overflow (making the parent scrollable) */ -void lv_obj_get_coords_fit(const struct _lv_obj_t * obj, lv_area_t * area); +void lv_obj_get_content_coords(const struct _lv_obj_t * obj, lv_area_t * area); /** * Get the width occupied by the "parts" of the widget. E.g. the width of all columns of a table. diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index 7d0201476..2c1892354 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -385,10 +385,10 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta } /*Check for draw pad changes*/ - if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_HEIGHT, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_ANGLE, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_ZOOM, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + if(lv_style_get_prop(style, LV_STYLE_TRANSLATE_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_TRANSLATE_HEIGHT, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_TRANSLATE_ANGLE, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_TRANSLATE_ZOOM, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_OPA, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_PAD, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_SHADOW_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; diff --git a/src/core/lv_obj_style_gen.h b/src/core/lv_obj_style_gen.h index 0925a33d0..aace0c9d9 100644 --- a/src/core/lv_obj_style_gen.h +++ b/src/core/lv_obj_style_gen.h @@ -12,37 +12,37 @@ static inline bool lv_obj_get_style_clip_corner(const struct _lv_obj_t * obj, ui static inline lv_coord_t lv_obj_get_style_transform_width(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_WIDTH); + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_WIDTH); return (lv_coord_t)v.num; } static inline lv_coord_t lv_obj_get_style_transform_height(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_HEIGHT); + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_HEIGHT); return (lv_coord_t)v.num; } -static inline lv_coord_t lv_obj_get_style_transform_x(const struct _lv_obj_t * obj, uint32_t part) +static inline lv_coord_t lv_obj_get_style_translate_x(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_X); + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_X); return (lv_coord_t)v.num; } -static inline lv_coord_t lv_obj_get_style_transform_y(const struct _lv_obj_t * obj, uint32_t part) +static inline lv_coord_t lv_obj_get_style_translate_y(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_Y); + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_Y); return (lv_coord_t)v.num; } static inline lv_coord_t lv_obj_get_style_transform_zoom(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ZOOM); + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_ZOOM); return (lv_coord_t)v.num; } static inline lv_coord_t lv_obj_get_style_transform_angle(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ANGLE); + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_ANGLE); return (lv_coord_t)v.num; } @@ -541,7 +541,7 @@ static inline void lv_obj_set_style_transform_width(struct _lv_obj_t * obj, lv_c lv_style_value_t v = { .num = (int32_t)value }; - lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_WIDTH, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSLATE_WIDTH, v, selector); } static inline void lv_obj_set_style_transform_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) @@ -549,23 +549,23 @@ static inline void lv_obj_set_style_transform_height(struct _lv_obj_t * obj, lv_ lv_style_value_t v = { .num = (int32_t)value }; - lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_HEIGHT, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSLATE_HEIGHT, v, selector); } -static inline void lv_obj_set_style_transform_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_translate_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value }; - lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_X, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSLATE_X, v, selector); } -static inline void lv_obj_set_style_transform_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_translate_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value }; - lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_Y, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSLATE_Y, v, selector); } static inline void lv_obj_set_style_transform_zoom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) @@ -573,7 +573,7 @@ static inline void lv_obj_set_style_transform_zoom(struct _lv_obj_t * obj, lv_co lv_style_value_t v = { .num = (int32_t)value }; - lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_ZOOM, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSLATE_ZOOM, v, selector); } static inline void lv_obj_set_style_transform_angle(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) @@ -581,7 +581,7 @@ static inline void lv_obj_set_style_transform_angle(struct _lv_obj_t * obj, lv_c lv_style_value_t v = { .num = (int32_t)value }; - lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_ANGLE, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSLATE_ANGLE, v, selector); } static inline void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector) diff --git a/src/core/lv_theme.h b/src/core/lv_theme.h index c46617db1..8c5a01838 100644 --- a/src/core/lv_theme.h +++ b/src/core/lv_theme.h @@ -40,6 +40,7 @@ typedef struct _lv_theme_t { const lv_font_t * font_small; const lv_font_t * font_normal; const lv_font_t * font_large; + uint32_t flags; /*Any custom flag used by the theme*/ } lv_theme_t; /********************** diff --git a/src/extra/layouts/flex/lv_flex.c b/src/extra/layouts/flex/lv_flex.c index b07330569..3bee4807e 100644 --- a/src/extra/layouts/flex/lv_flex.c +++ b/src/extra/layouts/flex/lv_flex.c @@ -136,7 +136,7 @@ static void flex_update(lv_obj_t * cont, void * user_data) bool rtl = lv_obj_get_base_dir(cont) == LV_BIDI_DIR_RTL ? true : false; lv_coord_t track_gap = !f.row ? lv_obj_get_style_pad_column(cont, LV_PART_MAIN) : lv_obj_get_style_pad_row(cont, LV_PART_MAIN); lv_coord_t item_gap = f.row ? lv_obj_get_style_pad_column(cont, LV_PART_MAIN) : lv_obj_get_style_pad_row(cont, LV_PART_MAIN); - lv_coord_t max_main_size = (f.row ? lv_obj_get_width_fit(cont) : lv_obj_get_height_fit(cont)); + lv_coord_t max_main_size = (f.row ? lv_obj_get_content_width(cont) : lv_obj_get_content_height(cont)); lv_coord_t abs_y = cont->coords.y1 + lv_obj_get_style_pad_top(cont, LV_PART_MAIN) - lv_obj_get_scroll_y(cont); lv_coord_t abs_x = cont->coords.x1 + lv_obj_get_style_pad_left(cont, LV_PART_MAIN) - lv_obj_get_scroll_x(cont); @@ -178,7 +178,7 @@ static void flex_update(lv_obj_t * cont, void * user_data) if(track_cnt) total_track_cross_size -= track_gap; /*No gap after the last track*/ /*Place the tracks to get the start position*/ - lv_coord_t max_cross_size = (f.row ? lv_obj_get_height_fit(cont) : lv_obj_get_width_fit(cont)); + lv_coord_t max_cross_size = (f.row ? lv_obj_get_content_height(cont) : lv_obj_get_content_width(cont)); place_content(track_cross_place, max_cross_size, total_track_cross_size, track_cnt, cross_pos, &gap); } @@ -401,8 +401,8 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i /*Handle percentage value of translate*/ - lv_coord_t tr_x = lv_obj_get_style_transform_x(item, LV_PART_MAIN); - lv_coord_t tr_y = lv_obj_get_style_transform_y(item, LV_PART_MAIN); + lv_coord_t tr_x = lv_obj_get_style_translate_x(item, LV_PART_MAIN); + lv_coord_t tr_y = lv_obj_get_style_translate_y(item, LV_PART_MAIN); lv_coord_t w = lv_obj_get_width(item); lv_coord_t h = lv_obj_get_height(item); if(LV_COORD_IS_PCT(tr_x)) tr_x = (w * LV_COORD_GET_PCT(tr_x)) / 100; diff --git a/src/extra/layouts/flex/lv_flex.h b/src/extra/layouts/flex/lv_flex.h index f5f1ae586..679e989bd 100644 --- a/src/extra/layouts/flex/lv_flex.h +++ b/src/extra/layouts/flex/lv_flex.h @@ -97,8 +97,6 @@ void lv_obj_set_flex_place(lv_obj_t * obj, lv_flex_place_t main_place, lv_flex_p */ void lv_obj_set_flex_grow(lv_obj_t * obj, uint8_t grow); - - static inline void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t value) { lv_style_value_t v = { diff --git a/src/extra/layouts/grid/lv_grid.c b/src/extra/layouts/grid/lv_grid.c index 89c92afd4..73a69470b 100644 --- a/src/extra/layouts/grid/lv_grid.c +++ b/src/extra/layouts/grid/lv_grid.c @@ -208,11 +208,11 @@ static void calc(struct _lv_obj_t * cont, _lv_grid_calc_t * calc_out) lv_coord_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); lv_coord_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN); bool auto_w = w_set == LV_SIZE_CONTENT ? true : false; - lv_coord_t cont_w = lv_obj_get_width_fit(cont); + lv_coord_t cont_w = lv_obj_get_content_width(cont); calc_out->grid_w = grid_place(cont_w, auto_w, get_grid_col_place(cont), col_gap, calc_out->col_num, calc_out->w, calc_out->x, rev); bool auto_h = h_set == LV_SIZE_CONTENT ? true : false; - lv_coord_t cont_h = lv_obj_get_height_fit(cont); + lv_coord_t cont_h = lv_obj_get_content_height(cont); calc_out->grid_h = grid_place(cont_h, auto_h, get_grid_row_place(cont), row_gap, calc_out->row_num, calc_out->h, calc_out->y, false); LV_ASSERT_MEM_INTEGRITY(); @@ -233,7 +233,7 @@ static void calc_free(_lv_grid_calc_t * calc) static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c) { const lv_coord_t * col_templ = get_col_dsc(cont); - lv_coord_t cont_w = lv_obj_get_width_fit(cont); + lv_coord_t cont_w = lv_obj_get_content_width(cont); c->col_num = count_tracks(col_templ); c->x = lv_mem_buf_get(sizeof(lv_coord_t) * c->col_num); @@ -338,7 +338,7 @@ static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c) } lv_coord_t row_gap = lv_obj_get_style_pad_row(cont, LV_PART_MAIN); - lv_coord_t cont_h = lv_obj_get_height_fit(cont) - row_gap * (c->row_num - 1); + lv_coord_t cont_h = lv_obj_get_content_height(cont) - row_gap * (c->row_num - 1); lv_coord_t free_h = cont_h - grid_h; if(free_h < 0) free_h = 0; @@ -447,8 +447,8 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * } /*Handle percentage value of translate*/ - lv_coord_t tr_x = lv_obj_get_style_transform_x(item, LV_PART_MAIN); - lv_coord_t tr_y = lv_obj_get_style_transform_y(item, LV_PART_MAIN); + lv_coord_t tr_x = lv_obj_get_style_translate_x(item, LV_PART_MAIN); + lv_coord_t tr_y = lv_obj_get_style_translate_y(item, LV_PART_MAIN); lv_coord_t w = lv_obj_get_width(item); lv_coord_t h = lv_obj_get_height(item); if(LV_COORD_IS_PCT(tr_x)) tr_x = (w * LV_COORD_GET_PCT(tr_x)) / 100; diff --git a/src/extra/widgets/msgbox/lv_msgbox.c b/src/extra/widgets/msgbox/lv_msgbox.c index 224dd57a5..862419fae 100644 --- a/src/extra/widgets/msgbox/lv_msgbox.c +++ b/src/extra/widgets/msgbox/lv_msgbox.c @@ -53,7 +53,7 @@ lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * b LV_ASSERT_MALLOC(mbox); if(mbox == NULL) return NULL; - lv_coord_t w = lv_obj_get_width_fit(parent); + lv_coord_t w = lv_obj_get_content_width(parent); if(w > 2 * LV_DPI_DEF) w = 2 * LV_DPI_DEF; lv_obj_set_size(mbox, w, LV_SIZE_CONTENT); diff --git a/src/extra/widgets/tabview/lv_tabview.c b/src/extra/widgets/tabview/lv_tabview.c index 8acc34329..452812864 100644 --- a/src/extra/widgets/tabview/lv_tabview.c +++ b/src/extra/widgets/tabview/lv_tabview.c @@ -245,7 +245,7 @@ static void cont_scroll_end_event_cb(lv_event_t * e) lv_point_t p; lv_obj_get_scroll_end(cont, &p); - lv_coord_t w = lv_obj_get_width_fit(cont); + lv_coord_t w = lv_obj_get_content_width(cont); lv_coord_t t = (p.x + w/ 2) / w; if(t < 0) t = 0; lv_tabview_set_act(tv, t, LV_ANIM_ON); diff --git a/src/extra/widgets/tileview/lv_tileview.c b/src/extra/widgets/tileview/lv_tileview.c index ba45b5e2c..9975b6619 100644 --- a/src/extra/widgets/tileview/lv_tileview.c +++ b/src/extra/widgets/tileview/lv_tileview.c @@ -77,8 +77,8 @@ void lv_obj_set_tile(lv_obj_t * tv, lv_obj_t * tile_obj, lv_anim_enable_t anim_e void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim_enable_t anim_en) { - lv_coord_t w = lv_obj_get_width_fit(tv); - lv_coord_t h = lv_obj_get_height_fit(tv); + lv_coord_t w = lv_obj_get_content_width(tv); + lv_coord_t h = lv_obj_get_content_height(tv); lv_coord_t tx = col_id * w; lv_coord_t ty = row_id * h; @@ -117,7 +117,7 @@ static void lv_tileview_tile_constructor(const lv_obj_class_t * class_p, lv_obj_ LV_UNUSED(class_p); lv_obj_t * parent = lv_obj_get_parent(obj); lv_obj_set_size(obj, LV_PCT(100), LV_PCT(100)); - lv_obj_set_pos(obj, create_col_id * lv_obj_get_width_fit(parent), create_row_id * lv_obj_get_height_fit(parent)); + lv_obj_set_pos(obj, create_col_id * lv_obj_get_content_width(parent), create_row_id * lv_obj_get_content_height(parent)); lv_tileview_tile_t * tile = (lv_tileview_tile_t *)obj; tile->dir = create_dir; @@ -132,8 +132,8 @@ static void tileview_event_cb(lv_event_t * e) lv_event_code_t code = lv_event_get_code(e); lv_obj_t * tv = lv_event_get_target(e); if(code == LV_EVENT_SCROLL_END) { - lv_coord_t w = lv_obj_get_width_fit(tv); - lv_coord_t h = lv_obj_get_height_fit(tv); + lv_coord_t w = lv_obj_get_content_width(tv); + lv_coord_t h = lv_obj_get_content_height(tv); lv_point_t scroll_end; lv_obj_get_scroll_end(tv, &scroll_end); diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index b195080bd..0239a980e 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -198,11 +198,11 @@ lv_res_t lv_style_get_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_va return lv_style_get_prop_inlined(style, prop, value); } -void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, lv_anim_path_cb_t path_xcb, uint32_t time, uint32_t delay) +void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay) { lv_memset_00(tr, sizeof(lv_style_transition_dsc_t)); tr->props = props; - tr->path_cb = path_xcb == NULL ? lv_anim_path_linear : path_xcb; + tr->path_cb = path_cb == NULL ? lv_anim_path_linear : path_cb; tr->time = time; tr->delay = delay; } @@ -211,7 +211,7 @@ lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop) { lv_style_value_t value; switch(prop) { - case LV_STYLE_TRANSFORM_ZOOM: + case LV_STYLE_TRANSLATE_ZOOM: value.num = LV_IMG_ZOOM_NONE; break; case LV_STYLE_BG_COLOR: diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index 090e03c66..9385a48af 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -114,12 +114,12 @@ typedef enum { /*Group 0*/ LV_STYLE_RADIUS = 1, LV_STYLE_CLIP_CORNER = 2, - LV_STYLE_TRANSFORM_WIDTH = 3 | LV_STYLE_PROP_EXT_DRAW, - LV_STYLE_TRANSFORM_HEIGHT = 4 | LV_STYLE_PROP_EXT_DRAW, - LV_STYLE_TRANSFORM_X = 5 | LV_STYLE_PROP_PARENT_LAYOUT_REFR, - LV_STYLE_TRANSFORM_Y = 6 | LV_STYLE_PROP_PARENT_LAYOUT_REFR, - LV_STYLE_TRANSFORM_ZOOM = 7 | LV_STYLE_PROP_EXT_DRAW, - LV_STYLE_TRANSFORM_ANGLE = 8 | LV_STYLE_PROP_EXT_DRAW, + LV_STYLE_TRANSLATE_WIDTH = 3 | LV_STYLE_PROP_EXT_DRAW, + LV_STYLE_TRANSLATE_HEIGHT = 4 | LV_STYLE_PROP_EXT_DRAW, + LV_STYLE_TRANSLATE_X = 5 | LV_STYLE_PROP_PARENT_LAYOUT_REFR, + LV_STYLE_TRANSLATE_Y = 6 | LV_STYLE_PROP_PARENT_LAYOUT_REFR, + LV_STYLE_TRANSLATE_ZOOM = 7 | LV_STYLE_PROP_EXT_DRAW, + LV_STYLE_TRANSLATE_ANGLE = 8 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_OPA = 9 | LV_STYLE_PROP_INHERIT, LV_STYLE_COLOR_FILTER_DSC = 10, diff --git a/src/misc/lv_style_gen.h b/src/misc/lv_style_gen.h index 6506a6560..b05d8371b 100644 --- a/src/misc/lv_style_gen.h +++ b/src/misc/lv_style_gen.h @@ -19,7 +19,7 @@ static inline void lv_style_set_transform_width(lv_style_t * style, lv_coord_t v lv_style_value_t v = { .num = (int32_t)value }; - lv_style_set_prop(style, LV_STYLE_TRANSFORM_WIDTH, v); + lv_style_set_prop(style, LV_STYLE_TRANSLATE_WIDTH, v); } static inline void lv_style_set_transform_height(lv_style_t * style, lv_coord_t value) @@ -27,23 +27,23 @@ static inline void lv_style_set_transform_height(lv_style_t * style, lv_coord_t lv_style_value_t v = { .num = (int32_t)value }; - lv_style_set_prop(style, LV_STYLE_TRANSFORM_HEIGHT, v); + lv_style_set_prop(style, LV_STYLE_TRANSLATE_HEIGHT, v); } -static inline void lv_style_set_transform_x(lv_style_t * style, lv_coord_t value) +static inline void lv_style_set_translate_x(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { .num = (int32_t)value }; - lv_style_set_prop(style, LV_STYLE_TRANSFORM_X, v); + lv_style_set_prop(style, LV_STYLE_TRANSLATE_X, v); } -static inline void lv_style_set_transform_y(lv_style_t * style, lv_coord_t value) +static inline void lv_style_set_translate_y(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { .num = (int32_t)value }; - lv_style_set_prop(style, LV_STYLE_TRANSFORM_Y, v); + lv_style_set_prop(style, LV_STYLE_TRANSLATE_Y, v); } static inline void lv_style_set_transform_zoom(lv_style_t * style, lv_coord_t value) @@ -51,7 +51,7 @@ static inline void lv_style_set_transform_zoom(lv_style_t * style, lv_coord_t va lv_style_value_t v = { .num = (int32_t)value }; - lv_style_set_prop(style, LV_STYLE_TRANSFORM_ZOOM, v); + lv_style_set_prop(style, LV_STYLE_TRANSLATE_ZOOM, v); } static inline void lv_style_set_transform_angle(lv_style_t * style, lv_coord_t value) @@ -59,7 +59,7 @@ static inline void lv_style_set_transform_angle(lv_style_t * style, lv_coord_t v lv_style_value_t v = { .num = (int32_t)value }; - lv_style_set_prop(style, LV_STYLE_TRANSFORM_ANGLE, v); + lv_style_set_prop(style, LV_STYLE_TRANSLATE_ANGLE, v); } static inline void lv_style_set_opa(lv_style_t * style, lv_opa_t value) diff --git a/src/widgets/lv_btnmatrix.c b/src/widgets/lv_btnmatrix.c index eed8c536c..8a38e4a51 100644 --- a/src/widgets/lv_btnmatrix.c +++ b/src/widgets/lv_btnmatrix.c @@ -103,8 +103,8 @@ void lv_btnmatrix_set_map(lv_obj_t * obj, const char * map[]) lv_coord_t prow = lv_obj_get_style_pad_row(obj, LV_PART_MAIN); lv_coord_t pcol = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); - lv_coord_t max_w = lv_obj_get_width_fit(obj); - lv_coord_t max_h = lv_obj_get_height_fit(obj); + lv_coord_t max_w = lv_obj_get_content_width(obj); + lv_coord_t max_h = lv_obj_get_content_height(obj); /*Count the lines to calculate button height*/ uint8_t row_cnt = 1; diff --git a/src/widgets/lv_chart.c b/src/widgets/lv_chart.c index 3c2ae7a43..0f19e64ea 100644 --- a/src/widgets/lv_chart.c +++ b/src/widgets/lv_chart.c @@ -279,7 +279,7 @@ void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint1 return; } - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; if(chart->type & LV_CHART_TYPE_LINE) { p_out->x = (w * id) / (chart->point_cnt - 1); @@ -305,7 +305,7 @@ void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint1 p_out->x += lv_obj_get_style_pad_left(obj, LV_PART_MAIN); p_out->x -= lv_obj_get_scroll_left(obj); - lv_coord_t h = (lv_obj_get_height_fit(obj) * chart->zoom_y) >> 8; + lv_coord_t h = (lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; p_out->y = (int32_t)((int32_t)ser->points[id] - chart->ymin[ser->y_axis]) * h; p_out->y = p_out->y / (chart->ymax[ser->y_axis] - chart->ymin[ser->y_axis]); @@ -645,8 +645,8 @@ static void lv_chart_event(lv_event_t * e) chart->tick[LV_CHART_AXIS_PRIMARY_Y].draw_size, chart->tick[LV_CHART_AXIS_SECONDARY_Y].draw_size); } else if(code == LV_EVENT_GET_SELF_SIZE) { lv_point_t * p = lv_event_get_param(e); - p->x = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; - p->y = (lv_obj_get_height_fit(obj) * chart->zoom_y) >> 8; + p->x = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; + p->y = (lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; } else if(code == LV_EVENT_DRAW_MAIN) { const lv_area_t * clip_area = lv_event_get_param(e); draw_div_lines(obj, clip_area); @@ -674,8 +674,8 @@ static void draw_div_lines(lv_obj_t * obj, const lv_area_t * clip_area) lv_point_t p2; lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; - lv_coord_t h = (lv_obj_get_height_fit(obj) * chart->zoom_y) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; + lv_coord_t h = (lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; lv_draw_line_dsc_t line_dsc; lv_draw_line_dsc_init(&line_dsc); @@ -739,8 +739,8 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) lv_point_t p2; lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; - lv_coord_t h = (lv_obj_get_height_fit(obj) * chart->zoom_y) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; + lv_coord_t h = (lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; lv_coord_t x_ofs = obj->coords.x1 + pad_left - lv_obj_get_scroll_left(obj); lv_coord_t y_ofs = obj->coords.y1 + pad_top - lv_obj_get_scroll_top(obj); lv_chart_series_t * ser; @@ -896,8 +896,8 @@ static void draw_series_bar(lv_obj_t * obj, const lv_area_t * clip_area) lv_area_t col_a; lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; - lv_coord_t h = (lv_obj_get_height_fit(obj) * chart->zoom_y) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; + lv_coord_t h = (lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; int32_t y_tmp; lv_chart_series_t * ser; uint32_t ser_cnt = _lv_ll_get_len(&chart->series_ll); @@ -1065,7 +1065,7 @@ static void draw_y_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a lv_point_t p2; lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t h = (lv_obj_get_height_fit(obj) * chart->zoom_y) >> 8; + lv_coord_t h = (lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; lv_coord_t y_ofs = obj->coords.y1 + pad_top - lv_obj_get_scroll_top(obj); lv_coord_t label_gap; @@ -1172,7 +1172,7 @@ static void draw_x_ticks(lv_obj_t * obj, const lv_area_t * clip_area) lv_point_t p2; lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; lv_coord_t x_ofs = obj->coords.x1 + pad_left - lv_obj_get_scroll_left(obj); lv_coord_t y_ofs = obj->coords.y2; @@ -1265,7 +1265,7 @@ static void draw_axes(lv_obj_t * obj, const lv_area_t * mask) static uint32_t get_index_from_x(lv_obj_t * obj, lv_coord_t x) { lv_chart_t * chart = (lv_chart_t *)obj; - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); x-= pad_left; @@ -1282,7 +1282,7 @@ static void invalidate_point(lv_obj_t * obj, uint16_t i) lv_chart_t * chart = (lv_chart_t *)obj; if(i >= chart->point_cnt) return; - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; lv_coord_t scroll_left = lv_obj_get_scroll_left(obj); if(chart->type == LV_CHART_TYPE_LINE) { lv_coord_t x_ofs = obj->coords.x1 + lv_obj_get_style_pad_left(obj, LV_PART_MAIN) - scroll_left; diff --git a/src/widgets/lv_dropdown.c b/src/widgets/lv_dropdown.c index 24c4c6936..8e25677b4 100644 --- a/src/widgets/lv_dropdown.c +++ b/src/widgets/lv_dropdown.c @@ -511,10 +511,10 @@ void lv_dropdown_open(lv_obj_t * dropdown_obj) lv_obj_set_x(label, 0); break; case LV_TEXT_ALIGN_RIGHT: - lv_obj_set_x(label, lv_obj_get_width_fit(dropdown->list) - lv_obj_get_width(label)); + lv_obj_set_x(label, lv_obj_get_content_width(dropdown->list) - lv_obj_get_width(label)); break; case LV_TEXT_ALIGN_CENTER: - lv_obj_set_x(label, lv_obj_get_width_fit(dropdown->list) / 2 - lv_obj_get_width(label) / 2); + lv_obj_set_x(label, lv_obj_get_content_width(dropdown->list) / 2 - lv_obj_get_width(label) / 2); break; } @@ -1029,7 +1029,7 @@ static void position_to_selected(lv_obj_t * dropdown_obj) lv_obj_t * label = get_label(dropdown_obj); if(label == NULL) return; - if(lv_obj_get_height(label) <= lv_obj_get_height_fit(dropdown_obj)) return; + if(lv_obj_get_height(label) <= lv_obj_get_content_height(dropdown_obj)) return; const lv_font_t * font = lv_obj_get_style_text_font(label, LV_PART_MAIN); lv_coord_t font_h = lv_font_get_line_height(font); diff --git a/src/widgets/lv_label.c b/src/widgets/lv_label.c index aa0a3faf3..ddec0a391 100644 --- a/src/widgets/lv_label.c +++ b/src/widgets/lv_label.c @@ -294,10 +294,10 @@ void lv_label_get_letter_pos(const lv_obj_t * obj, uint32_t char_id, lv_point_t pos->x = 0; break; case LV_TEXT_ALIGN_RIGHT: - pos->x = lv_obj_get_width_fit(obj); + pos->x = lv_obj_get_content_width(obj); break; case LV_TEXT_ALIGN_CENTER: - pos->x = lv_obj_get_width_fit(obj) / 2; + pos->x = lv_obj_get_content_width(obj) / 2; break; } return; diff --git a/src/widgets/lv_meter.c b/src/widgets/lv_meter.c index e65f0ced7..57a925af3 100644 --- a/src/widgets/lv_meter.c +++ b/src/widgets/lv_meter.c @@ -288,7 +288,7 @@ static void lv_meter_event(lv_event_t * e) if(code == LV_EVENT_DRAW_MAIN) { const lv_area_t * clip_area = lv_event_get_param(e); lv_area_t scale_area; - lv_obj_get_coords_fit(obj, &scale_area); + lv_obj_get_content_coords(obj, &scale_area); draw_arcs(obj, clip_area, &scale_area); draw_ticks_and_labels(obj, clip_area, &scale_area); @@ -617,7 +617,7 @@ static void inv_arc(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t old_va bool rounded = lv_obj_get_style_arc_rounded(obj, LV_PART_ITEMS); lv_area_t scale_area; - lv_obj_get_coords_fit(obj, &scale_area); + lv_obj_get_content_coords(obj, &scale_area); lv_coord_t r_out = lv_area_get_width(&scale_area) / 2; lv_point_t scale_center; @@ -639,7 +639,7 @@ static void inv_arc(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t old_va static void inv_line(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t value) { lv_area_t scale_area; - lv_obj_get_coords_fit(obj, &scale_area); + lv_obj_get_content_coords(obj, &scale_area); lv_coord_t r_out = lv_area_get_width(&scale_area) / 2; lv_point_t scale_center; diff --git a/src/widgets/lv_roller.c b/src/widgets/lv_roller.c index 00ba380b5..1cae20497 100644 --- a/src/widgets/lv_roller.c +++ b/src/widgets/lv_roller.c @@ -567,10 +567,10 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) lv_text_align_t align = lv_obj_get_style_text_align(label, LV_PART_MAIN); switch(align) { case LV_TEXT_ALIGN_CENTER: - lv_obj_set_x(label, (lv_obj_get_width_fit(obj) - lv_obj_get_width(label)) / 2); + lv_obj_set_x(label, (lv_obj_get_content_width(obj) - lv_obj_get_width(label)) / 2); break; case LV_TEXT_ALIGN_RIGHT: - lv_obj_set_x(label, lv_obj_get_width_fit(obj) - lv_obj_get_width(label)); + lv_obj_set_x(label, lv_obj_get_content_width(obj) - lv_obj_get_width(label)); break; case LV_TEXT_ALIGN_LEFT: lv_obj_set_x(label, 0); @@ -582,7 +582,7 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); lv_coord_t font_h = lv_font_get_line_height(font); - lv_coord_t h = lv_obj_get_height_fit(obj); + lv_coord_t h = lv_obj_get_content_height(obj); uint16_t anim_time = lv_obj_get_style_anim_time(obj, LV_PART_MAIN); /*Normally the animation's `end_cb` sets correct position of the roller if infinite. @@ -707,7 +707,7 @@ static void inf_normalize(lv_obj_t * obj) const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); lv_coord_t font_h = lv_font_get_line_height(font); - lv_coord_t h = lv_obj_get_height_fit(obj); + lv_coord_t h = lv_obj_get_content_height(obj); lv_obj_t * label = get_label(obj); diff --git a/src/widgets/lv_textarea.c b/src/widgets/lv_textarea.c index 114d00786..9e0271343 100644 --- a/src/widgets/lv_textarea.c +++ b/src/widgets/lv_textarea.c @@ -410,7 +410,7 @@ void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos) lv_obj_scroll_to_y(obj, cur_pos.y, LV_ANIM_ON); } /*Check the bottom*/ - lv_coord_t h = lv_obj_get_height_fit(obj); + lv_coord_t h = lv_obj_get_content_height(obj); if(cur_pos.y + font_h - lv_obj_get_scroll_top(obj) > h) { lv_obj_scroll_to_y(obj, cur_pos.y - h + font_h, LV_ANIM_ON); } @@ -855,7 +855,7 @@ static void lv_textarea_event(lv_event_t * e) else if(code == LV_EVENT_SIZE_CHANGED) { /*Set the label width according to the text area width*/ if(ta->label) { - lv_obj_set_width(ta->label, lv_obj_get_width_fit(obj)); + lv_obj_set_width(ta->label, lv_obj_get_content_width(obj)); lv_obj_set_pos(ta->label, 0, 0); lv_label_set_text(ta->label, NULL); /*Refresh the label*/ From 078b15da555eefa813285dea3eecfae13f10d9ec Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 20 Apr 2021 21:36:24 +0200 Subject: [PATCH 036/152] feat(theme) add experimental dark mode to the default theme --- src/extra/themes/default/lv_theme_default.c | 134 +++++++++++--------- src/extra/themes/default/lv_theme_default.h | 2 +- src/hal/lv_hal_disp.c | 2 +- 3 files changed, 76 insertions(+), 62 deletions(-) diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index 6b38d4169..9aa018d40 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -16,19 +16,18 @@ /********************* * DEFINES *********************/ - -static lv_color_t color_primary_accent; -static lv_color_t color_secondary_accent; -static lv_color_t color_primary_muted; -static lv_color_t color_secondary_muted; - -#define COLOR_GREY lv_color_grey_lighten_2() - +#define MODE_DARK 1 #define RADIUS_DEFAULT (disp_size == DISP_LARGE ? LV_DPX(12) : LV_DPX(8)) /*SCREEN*/ -#define COLOR_SCR lv_color_grey_lighten_4() -#define COLOR_SCR_TEXT lv_color_grey_darken_4() +#define LIGHT_COLOR_SCR lv_color_grey_lighten_4() +#define LIGHT_COLOR_CARD lv_color_white() +#define LIGHT_COLOR_TEXT lv_color_grey_darken_4() +#define LIGHT_COLOR_GREY lv_color_grey_lighten_2() +#define DARK_COLOR_SCR lv_color_grey_darken_4() +#define DARK_COLOR_CARD lv_color_grey_darken_3() +#define DARK_COLOR_TEXT lv_color_grey_lighten_5() +#define DARK_COLOR_GREY lv_color_grey_darken_1() #define TRANSITION_TIME LV_THEME_DEFAULT_TRANSITON_TIME #define BORDER_WIDTH LV_DPX(2) @@ -166,6 +165,13 @@ static my_theme_styles_t * styles; static lv_theme_t theme; static disp_size_t disp_size; static bool inited; +static lv_color_t color_primary; +static lv_color_t color_secondary; +static lv_color_t color_scr; +static lv_color_t color_text; +static lv_color_t color_card; +static lv_color_t color_grey; + /********************** * MACROS @@ -185,27 +191,31 @@ static lv_color_t dark_color_filter_cb(const lv_color_filter_dsc_t * f, lv_color static lv_color_t grey_filter_cb(const lv_color_filter_dsc_t * f, lv_color_t color, lv_opa_t opa) { LV_UNUSED(f); - return lv_color_mix(lv_color_grey_lighten_2(), color, opa); + if(theme.flags & MODE_DARK) return lv_color_mix(lv_color_grey_darken_2(), color, opa); + else return lv_color_mix(lv_color_grey_lighten_2(), color, opa); } static void style_init(void) { static const lv_style_prop_t trans_props[] = { LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR, - LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, - LV_STYLE_TRANSFORM_Y, LV_STYLE_TRANSFORM_X, - LV_STYLE_TRANSFORM_ZOOM, LV_STYLE_TRANSFORM_ANGLE, + LV_STYLE_TRANSLATE_WIDTH, LV_STYLE_TRANSLATE_HEIGHT, + LV_STYLE_TRANSLATE_Y, LV_STYLE_TRANSLATE_X, + LV_STYLE_TRANSLATE_ZOOM, LV_STYLE_TRANSLATE_ANGLE, LV_STYLE_COLOR_FILTER_OPA, LV_STYLE_COLOR_FILTER_DSC, 0 }; - color_primary_accent = lv_color_get_palette_main(theme.palette_primary); - color_secondary_accent = lv_color_get_palette_main(theme.palette_secondary); - color_primary_muted = lv_color_get_palette_lighten_5(theme.palette_primary); - color_secondary_muted = lv_color_get_palette_lighten_5(theme.palette_secondary); + color_primary = lv_color_get_palette_main(theme.palette_primary); + color_secondary = lv_color_get_palette_main(theme.palette_secondary); - theme.color_primary = color_primary_accent; - theme.color_secondary = color_secondary_accent; + color_scr = theme.flags & MODE_DARK ? DARK_COLOR_SCR : LIGHT_COLOR_SCR; + color_text = theme.flags & MODE_DARK ? DARK_COLOR_TEXT : LIGHT_COLOR_TEXT; + color_card = theme.flags & MODE_DARK ? DARK_COLOR_CARD : LIGHT_COLOR_CARD; + color_grey = theme.flags & MODE_DARK ? DARK_COLOR_GREY : LIGHT_COLOR_GREY; + + theme.color_primary = color_primary; + theme.color_secondary = color_secondary; static lv_style_transition_dsc_t trans_delayed; lv_style_transition_dsc_init(&trans_delayed, trans_props, lv_anim_path_linear, TRANSITION_TIME, 70); @@ -234,19 +244,19 @@ static void style_init(void) style_init_reset(&styles->scr); lv_style_set_bg_opa(&styles->scr, LV_OPA_COVER); - lv_style_set_bg_color(&styles->scr, COLOR_SCR); - lv_style_set_text_color(&styles->scr, COLOR_SCR_TEXT); + lv_style_set_bg_color(&styles->scr, color_scr); + lv_style_set_text_color(&styles->scr, color_text); lv_style_set_pad_row(&styles->scr, PAD_SMALL); lv_style_set_pad_column(&styles->scr, PAD_SMALL); style_init_reset(&styles->card); lv_style_set_radius(&styles->card, RADIUS_DEFAULT); lv_style_set_bg_opa(&styles->card, LV_OPA_COVER); - lv_style_set_bg_color(&styles->card, lv_color_white()); - lv_style_set_border_color(&styles->card, COLOR_GREY); + lv_style_set_bg_color(&styles->card, color_card); + lv_style_set_border_color(&styles->card, color_grey); lv_style_set_border_width(&styles->card, BORDER_WIDTH); lv_style_set_border_post(&styles->card, true); - lv_style_set_text_color(&styles->card, lv_color_grey_darken_4()); + lv_style_set_text_color(&styles->card, color_text); lv_style_set_pad_all(&styles->card, PAD_DEF); lv_style_set_pad_row(&styles->card, PAD_SMALL); lv_style_set_pad_column(&styles->card, PAD_SMALL); @@ -254,24 +264,26 @@ static void style_init(void) lv_style_set_line_width(&styles->card, LV_DPX(1)); style_init_reset(&styles->outline_primary); - lv_style_set_outline_color(&styles->outline_primary, color_primary_accent); + lv_style_set_outline_color(&styles->outline_primary, color_primary); lv_style_set_outline_width(&styles->outline_primary, OUTLINE_WIDTH); lv_style_set_outline_pad(&styles->outline_primary, OUTLINE_WIDTH); lv_style_set_outline_opa(&styles->outline_primary, LV_OPA_50); style_init_reset(&styles->outline_secondary); - lv_style_set_outline_color(&styles->outline_secondary, color_secondary_accent); + lv_style_set_outline_color(&styles->outline_secondary, color_secondary); lv_style_set_outline_width(&styles->outline_secondary, OUTLINE_WIDTH); lv_style_set_outline_opa(&styles->outline_secondary, LV_OPA_50); style_init_reset(&styles->btn); lv_style_set_radius(&styles->btn, (disp_size == DISP_LARGE ? LV_DPX(16) : disp_size == DISP_MEDIUM ? LV_DPX(12) : LV_DPX(8))); lv_style_set_bg_opa(&styles->btn, LV_OPA_COVER); - lv_style_set_bg_color(&styles->btn, COLOR_GREY); - lv_style_set_shadow_color(&styles->btn, lv_color_grey_lighten_3()); - lv_style_set_shadow_width(&styles->btn, 1); - lv_style_set_shadow_ofs_y(&styles->btn, LV_DPX(4)); - lv_style_set_text_color(&styles->btn, lv_color_grey_darken_4()); + lv_style_set_bg_color(&styles->btn, color_grey); + if(!(theme.flags & MODE_DARK)) { + lv_style_set_shadow_color(&styles->btn, lv_color_grey_lighten_3()); + lv_style_set_shadow_width(&styles->btn, 1); + lv_style_set_shadow_ofs_y(&styles->btn, LV_DPX(4)); + } + lv_style_set_text_color(&styles->btn, color_text); lv_style_set_pad_hor(&styles->btn, PAD_DEF); lv_style_set_pad_ver(&styles->btn, PAD_SMALL); lv_style_set_pad_column(&styles->btn, LV_DPX(5)); @@ -327,34 +339,34 @@ static void style_init(void) lv_style_set_pad_column(&styles->pad_tiny, PAD_TINY); style_init_reset(&styles->bg_color_primary); - lv_style_set_bg_color(&styles->bg_color_primary, color_primary_accent); + lv_style_set_bg_color(&styles->bg_color_primary, color_primary); lv_style_set_text_color(&styles->bg_color_primary, lv_color_white()); lv_style_set_bg_opa(&styles->bg_color_primary, LV_OPA_COVER); style_init_reset(&styles->bg_color_primary_muted); - lv_style_set_bg_color(&styles->bg_color_primary_muted, color_primary_muted); - lv_style_set_text_color(&styles->bg_color_primary_muted, color_primary_accent); - lv_style_set_bg_opa(&styles->bg_color_primary_muted, LV_OPA_COVER); + lv_style_set_bg_color(&styles->bg_color_primary_muted, color_primary); + lv_style_set_text_color(&styles->bg_color_primary_muted, color_primary); + lv_style_set_bg_opa(&styles->bg_color_primary_muted, LV_OPA_20); style_init_reset(&styles->bg_color_secondary); - lv_style_set_bg_color(&styles->bg_color_secondary, color_secondary_accent); + lv_style_set_bg_color(&styles->bg_color_secondary, color_secondary); lv_style_set_text_color(&styles->bg_color_secondary, lv_color_white()); lv_style_set_bg_opa(&styles->bg_color_secondary, LV_OPA_COVER); style_init_reset(&styles->bg_color_secondary_muted); - lv_style_set_bg_color(&styles->bg_color_secondary_muted, color_secondary_muted); - lv_style_set_text_color(&styles->bg_color_secondary_muted, color_secondary_accent); - lv_style_set_bg_opa(&styles->bg_color_secondary_muted, LV_OPA_COVER); + lv_style_set_bg_color(&styles->bg_color_secondary_muted, color_secondary); + lv_style_set_text_color(&styles->bg_color_secondary_muted, color_secondary); + lv_style_set_bg_opa(&styles->bg_color_secondary_muted, LV_OPA_20); style_init_reset(&styles->bg_color_grey); - lv_style_set_bg_color(&styles->bg_color_grey, COLOR_GREY); + lv_style_set_bg_color(&styles->bg_color_grey, color_grey); lv_style_set_bg_opa(&styles->bg_color_grey, LV_OPA_COVER); - lv_style_set_text_color(&styles->bg_color_grey, lv_color_grey_darken_4()); + lv_style_set_text_color(&styles->bg_color_grey, color_text); style_init_reset(&styles->bg_color_white); - lv_style_set_bg_color(&styles->bg_color_white, lv_color_white()); + lv_style_set_bg_color(&styles->bg_color_white, color_card); lv_style_set_bg_opa(&styles->bg_color_white, LV_OPA_COVER); - lv_style_set_text_color(&styles->bg_color_white, lv_color_grey_darken_4()); + lv_style_set_text_color(&styles->bg_color_white, color_text); style_init_reset(&styles->circle); lv_style_set_radius(&styles->circle, LV_RADIUS_CIRCLE); @@ -369,7 +381,7 @@ static void style_init(void) #endif style_init_reset(&styles->knob); - lv_style_set_bg_color(&styles->knob, color_primary_accent); + lv_style_set_bg_color(&styles->knob, color_primary); lv_style_set_bg_opa(&styles->knob, LV_OPA_COVER); lv_style_set_pad_all(&styles->knob, LV_DPX(6)); lv_style_set_radius(&styles->knob, LV_RADIUS_CIRCLE); @@ -379,19 +391,19 @@ static void style_init(void) #if LV_USE_ARC style_init_reset(&styles->arc_indic); - lv_style_set_arc_color(&styles->arc_indic, COLOR_GREY); + lv_style_set_arc_color(&styles->arc_indic, color_grey); lv_style_set_arc_width(&styles->arc_indic, LV_DPX(15)); lv_style_set_arc_rounded(&styles->arc_indic, true); style_init_reset(&styles->arc_indic_primary); - lv_style_set_arc_color(&styles->arc_indic_primary, color_primary_accent); + lv_style_set_arc_color(&styles->arc_indic_primary, color_primary); #endif #if LV_USE_CHECKBOX style_init_reset(&styles->cb_marker); lv_style_set_pad_all(&styles->cb_marker, LV_DPX(3)); lv_style_set_border_width(&styles->cb_marker, BORDER_WIDTH); - lv_style_set_border_color(&styles->cb_marker, color_primary_accent); + lv_style_set_border_color(&styles->cb_marker, color_primary); lv_style_set_bg_color(&styles->cb_marker, lv_color_white()); lv_style_set_bg_opa(&styles->cb_marker, LV_OPA_COVER); lv_style_set_radius(&styles->cb_marker, RADIUS_DEFAULT / 2); @@ -405,19 +417,20 @@ static void style_init(void) #if LV_USE_SWITCH style_init_reset(&styles->switch_knob); lv_style_set_pad_all(&styles->switch_knob, - LV_DPX(4)); + lv_style_set_bg_color(&styles->switch_knob, lv_color_white()); #endif #if LV_USE_LINE style_init_reset(&styles->line); lv_style_set_line_width(&styles->line, 1); - lv_style_set_line_color(&styles->line, COLOR_SCR_TEXT); + lv_style_set_line_color(&styles->line, color_text); #endif #if LV_USE_CHART style_init_reset(&styles->chart_bg); lv_style_set_border_post(&styles->chart_bg, false); lv_style_set_pad_column(&styles->chart_bg, LV_DPX(10)); - lv_style_set_line_color(&styles->chart_bg, COLOR_GREY); + lv_style_set_line_color(&styles->chart_bg, color_grey); style_init_reset(&styles->chart_series); lv_style_set_line_width(&styles->chart_series, LV_DPX(3)); @@ -433,7 +446,7 @@ static void style_init(void) style_init_reset(&styles->chart_ticks); lv_style_set_line_width(&styles->chart_ticks, LV_DPX(1)); - lv_style_set_line_color(&styles->chart_ticks, COLOR_SCR_TEXT); + lv_style_set_line_color(&styles->chart_ticks, color_text); lv_style_set_pad_all(&styles->chart_ticks, LV_DPX(2)); lv_style_set_text_color(&styles->chart_ticks, lv_color_grey()); #endif @@ -441,13 +454,13 @@ static void style_init(void) #if LV_USE_METER style_init_reset(&styles->meter_marker); lv_style_set_line_width(&styles->meter_marker, LV_DPX(5)); - lv_style_set_line_color(&styles->meter_marker, lv_color_grey_darken_4()); + lv_style_set_line_color(&styles->meter_marker, color_text); lv_style_set_size(&styles->meter_marker, LV_DPX(20)); lv_style_set_pad_left(&styles->meter_marker, LV_DPX(15)); style_init_reset(&styles->meter_indic); lv_style_set_radius(&styles->meter_indic, LV_RADIUS_CIRCLE); - lv_style_set_bg_color(&styles->meter_indic, lv_color_grey_darken_4()); + lv_style_set_bg_color(&styles->meter_indic, color_text); lv_style_set_bg_opa(&styles->meter_indic, LV_OPA_COVER); lv_style_set_size(&styles->meter_indic, LV_DPX(15)); #endif @@ -455,13 +468,13 @@ static void style_init(void) #if LV_USE_TABLE style_init_reset(&styles->table_cell); lv_style_set_border_width(&styles->table_cell, LV_DPX(1)); - lv_style_set_border_color(&styles->table_cell, color_primary_muted); + lv_style_set_border_color(&styles->table_cell, color_grey); lv_style_set_border_side(&styles->table_cell, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM ); #endif #if LV_USE_TEXTAREA style_init_reset(&styles->ta_cursor); - lv_style_set_border_color(&styles->ta_cursor, COLOR_SCR_TEXT); + lv_style_set_border_color(&styles->ta_cursor, color_text); lv_style_set_border_width(&styles->ta_cursor, LV_DPX(2)); lv_style_set_pad_left(&styles->ta_cursor, LV_DPX(1)); lv_style_set_border_side(&styles->ta_cursor, LV_BORDER_SIDE_LEFT); @@ -479,8 +492,8 @@ static void style_init(void) style_init_reset(&styles->calendar_day); lv_style_set_border_width(&styles->calendar_day, LV_DPX(1)); - lv_style_set_border_color(&styles->calendar_day, color_primary_muted); - lv_style_set_bg_opa(&styles->calendar_day, LV_OPA_COVER); + lv_style_set_border_color(&styles->calendar_day, color_grey); + lv_style_set_bg_opa(&styles->calendar_day, LV_OPA_20); #endif #if LV_USE_COLORWHEEL @@ -501,7 +514,7 @@ static void style_init(void) #if LV_USE_TABVIEW style_init_reset(&styles->tab_btn); - lv_style_set_border_color(&styles->tab_btn, color_primary_accent); + lv_style_set_border_color(&styles->tab_btn, color_primary); lv_style_set_border_width(&styles->tab_btn, BORDER_WIDTH * 2); lv_style_set_border_side(&styles->tab_btn, LV_BORDER_SIDE_BOTTOM); #endif @@ -515,7 +528,7 @@ static void style_init(void) style_init_reset(&styles->list_btn); lv_style_set_border_width(&styles->list_btn, LV_DPX(1)); - lv_style_set_border_color(&styles->list_btn, color_primary_muted); + lv_style_set_border_color(&styles->list_btn, color_grey); lv_style_set_border_side(&styles->list_btn, LV_BORDER_SIDE_BOTTOM); lv_style_set_pad_all(&styles->list_btn, PAD_SMALL); lv_style_set_pad_column(&styles->list_btn, PAD_SMALL); @@ -544,7 +557,7 @@ static void style_init(void) * GLOBAL FUNCTIONS **********************/ -lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_palette_t palette_primary, lv_color_palette_t palette_secondary, +lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_palette_t palette_primary, lv_color_palette_t palette_secondary, bool dark, const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_large) { @@ -567,6 +580,7 @@ lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_palette_t palette_ theme.font_normal = font_normal; theme.font_large = font_large; theme.apply_cb = theme_apply; + theme.flags = dark ? MODE_DARK : 0; style_init(); diff --git a/src/extra/themes/default/lv_theme_default.h b/src/extra/themes/default/lv_theme_default.h index 02d010d17..0d5140b30 100644 --- a/src/extra/themes/default/lv_theme_default.h +++ b/src/extra/themes/default/lv_theme_default.h @@ -37,7 +37,7 @@ extern "C" { * @return a pointer to reference this theme later */ lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_palette_t palette_primary, lv_color_palette_t palette_secondary, - const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_large); + bool dark, const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_large); bool lv_theme_default_is_inited(void); diff --git a/src/hal/lv_hal_disp.c b/src/hal/lv_hal_disp.c index f2b39920b..9f7fe5573 100644 --- a/src/hal/lv_hal_disp.c +++ b/src/hal/lv_hal_disp.c @@ -132,7 +132,7 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver) #if LV_USE_THEME_DEFAULT if(lv_theme_default_is_inited() == false) { - disp->theme = lv_theme_default_init(disp, LV_COLOR_PALETTE_BLUE, LV_COLOR_PALETTE_CYAN, LV_FONT_DEFAULT, LV_FONT_DEFAULT, LV_FONT_DEFAULT); + disp->theme = lv_theme_default_init(disp, LV_COLOR_PALETTE_BLUE, LV_COLOR_PALETTE_CYAN, false, LV_FONT_DEFAULT, LV_FONT_DEFAULT, LV_FONT_DEFAULT); } #endif From 663f8c26723cf889ea49d4a0b977c6082eb5b3b4 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 21 Apr 2021 09:02:39 +0200 Subject: [PATCH 037/152] fix(style) rename path_cb to to path_xcb in lv_style_transition_dsc_t This way the MicroPython won't allow manually setting this field. And it can't be set manually becasue the user data needs to be set too. So lv_style_transition_dsc_init() should be used to initialize the fields of lv_style_transition_dsc_t --- src/core/lv_obj.c | 2 +- src/misc/lv_style.c | 2 +- src/misc/lv_style.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index 07d519131..458a634d5 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -1009,7 +1009,7 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) if(t == tsi) { ts[tsi].time = tr->time; ts[tsi].delay = tr->delay; - ts[tsi].path_cb = tr->path_cb; + ts[tsi].path_cb = tr->path_xcb; ts[tsi].prop = tr->props[j]; #if LV_USE_USER_DATA ts[tsi].user_data = tr->user_data; diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index 0239a980e..68bebf13f 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -202,7 +202,7 @@ void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style { lv_memset_00(tr, sizeof(lv_style_transition_dsc_t)); tr->props = props; - tr->path_cb = path_cb == NULL ? lv_anim_path_linear : path_cb; + tr->path_xcb = path_cb == NULL ? lv_anim_path_linear : path_cb; tr->time = time; tr->delay = delay; } diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index 9385a48af..5c2b04fcf 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -231,7 +231,7 @@ typedef struct _lv_style_transiton_t { #if LV_USE_USER_DATA void * user_data; /**< A custom user data that will be passed to the animation's user_data */ #endif - lv_anim_path_cb_t path_cb; /**< A path for the animation.*/ + lv_anim_path_cb_t path_xcb; /**< A path for the animation.*/ uint32_t time; /**< Duration of the transition in [ms]*/ uint32_t delay; /**< Delay before the transition in [ms]*/ }lv_style_transition_dsc_t; From 6c863cabb74475cb80402f45e151c6500962e920 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 21 Apr 2021 09:55:21 +0200 Subject: [PATCH 038/152] feat(obj_class) use different prototype for the event_cb in lv_obj_class_t It adds lv_obj_class_t * as the first arguement for MicroPython compatibility --- src/core/lv_obj.c | 12 ++++++------ src/core/lv_obj.h | 3 +-- src/core/lv_obj_class.h | 10 +++++++--- src/extra/widgets/colorwheel/lv_colorwheel.c | 6 ++++-- src/extra/widgets/imgbtn/lv_imgbtn.c | 6 ++++-- src/extra/widgets/led/lv_led.c | 6 ++++-- src/extra/widgets/spinbox/lv_spinbox.c | 6 ++++-- src/misc/lv_style.h | 4 ++-- src/widgets/lv_arc.c | 6 ++++-- src/widgets/lv_bar.c | 6 ++++-- src/widgets/lv_btnmatrix.c | 6 ++++-- src/widgets/lv_chart.c | 6 ++++-- src/widgets/lv_checkbox.c | 6 ++++-- src/widgets/lv_dropdown.c | 12 ++++++++---- src/widgets/lv_img.c | 6 ++++-- src/widgets/lv_label.c | 8 +++++--- src/widgets/lv_line.c | 6 ++++-- src/widgets/lv_meter.c | 6 ++++-- src/widgets/lv_roller.c | 12 ++++++++---- src/widgets/lv_slider.c | 6 ++++-- src/widgets/lv_switch.c | 6 ++++-- src/widgets/lv_table.c | 6 ++++-- src/widgets/lv_textarea.c | 6 ++++-- 23 files changed, 101 insertions(+), 56 deletions(-) diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index 458a634d5..7dcbe6e3f 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -60,7 +60,7 @@ typedef struct _lv_event_dsc_t{ static void lv_obj_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_obj_draw(lv_event_t * e); -static void lv_obj_event_cb(lv_event_t * e); +static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area); static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc); static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find); @@ -80,7 +80,7 @@ static lv_obj_t * event_original_target; const lv_obj_class_t lv_obj_class = { .constructor_cb = lv_obj_constructor, .destructor_cb = lv_obj_destructor, - .event_cb = lv_obj_event_cb, + .event_cb = lv_obj_event, .width_def = LV_DPI_DEF, .height_def = LV_DPI_DEF, .editable = LV_OBJ_CLASS_EDITABLE_FALSE, @@ -250,7 +250,7 @@ lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e) /*Call the actual event callback*/ e->user_data = NULL; - base->event_cb(e); + base->event_cb(base, e); lv_res_t res = LV_RES_OK; /*Stop if the object is deleted*/ @@ -830,10 +830,10 @@ static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc #endif } -#include "lvgl/lvgl.h" - -static void lv_obj_event_cb(lv_event_t * e) +static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); if(code == LV_EVENT_PRESSED) { diff --git a/src/core/lv_obj.h b/src/core/lv_obj.h index 4a3e22eb7..d88ee31b4 100644 --- a/src/core/lv_obj.h +++ b/src/core/lv_obj.h @@ -27,7 +27,6 @@ extern "C" { /********************* * DEFINES *********************/ -#define _LV_EVENT_FLAG_BUBBLED 0x80 /********************** * TYPEDEFS @@ -96,7 +95,7 @@ typedef enum { }lv_event_code_t; -typedef struct { +typedef struct _lv_event_t { struct _lv_obj_t * target; struct _lv_obj_t * original_target; lv_event_code_t code; diff --git a/src/core/lv_obj_class.h b/src/core/lv_obj_class.h index 9c232b160..25af37b2a 100644 --- a/src/core/lv_obj_class.h +++ b/src/core/lv_obj_class.h @@ -26,6 +26,8 @@ extern "C" { **********************/ struct _lv_obj_t; +struct _lv_obj_class_t; +struct _lv_event_t; typedef enum { LV_OBJ_CLASS_EDITABLE_INHERIT, /**< Check the base class. Must have 0 value to let zero initialized class inherit*/ @@ -39,6 +41,8 @@ typedef enum { LV_OBJ_CLASS_GROUP_DEF_FALSE, }lv_obj_class_group_def_t; + +typedef void (*lv_obj_class_event_cb_t)(struct _lv_obj_class_t * class_p, struct _lv_event_t * e); /** * Describe the common methods of every object. * Similar to a C++ class. @@ -50,11 +54,11 @@ typedef struct _lv_obj_class_t { #if LV_USE_USER_DATA void * user_data; #endif - lv_event_cb_t event_cb; /**< Object type specific event function*/ + void (*event_cb)(const struct _lv_obj_class_t * class_p, struct _lv_event_t * e); /**< Widget type specific event function*/ lv_coord_t width_def; lv_coord_t height_def; - uint32_t editable : 2; /**< Value from ::lv_obj_class_editable_t*/ - uint32_t group_def : 2; /**< Value from ::lv_obj_class_group_def_t*/ + uint32_t editable : 2; /**< Value from ::lv_obj_class_editable_t*/ + uint32_t group_def : 2; /**< Value from ::lv_obj_class_group_def_t*/ uint32_t instance_size : 16; }lv_obj_class_t; diff --git a/src/extra/widgets/colorwheel/lv_colorwheel.c b/src/extra/widgets/colorwheel/lv_colorwheel.c index 0866cd7ea..23f6d33af 100644 --- a/src/extra/widgets/colorwheel/lv_colorwheel.c +++ b/src/extra/widgets/colorwheel/lv_colorwheel.c @@ -33,7 +33,7 @@ * STATIC PROTOTYPES **********************/ static void lv_colorwheel_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_colorwheel_event(lv_event_t * e); +static void lv_colorwheel_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_disc_grad(lv_event_t * e); static void draw_knob(lv_event_t * e); @@ -337,8 +337,10 @@ static lv_area_t get_knob_area(lv_obj_t * obj) return knob_area; } -static void lv_colorwheel_event(lv_event_t * e) +static void lv_colorwheel_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + /*Call the ancestor's event handler*/ lv_res_t res = lv_obj_event_base(MY_CLASS, e); diff --git a/src/extra/widgets/imgbtn/lv_imgbtn.c b/src/extra/widgets/imgbtn/lv_imgbtn.c index f85140a6a..7865dfb4b 100644 --- a/src/extra/widgets/imgbtn/lv_imgbtn.c +++ b/src/extra/widgets/imgbtn/lv_imgbtn.c @@ -25,7 +25,7 @@ **********************/ static void lv_imgbtn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void draw_main(lv_event_t * e); -static void lv_imgbtn_event(lv_event_t * e); +static void lv_imgbtn_event(const lv_obj_class_t * class_p, lv_event_t * e); static void refr_img(lv_obj_t * imgbtn); static lv_imgbtn_state_t suggest_state(lv_obj_t * imgbtn, lv_imgbtn_state_t state); lv_imgbtn_state_t get_state(const lv_obj_t * imgbtn); @@ -160,8 +160,10 @@ static void lv_imgbtn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj } -static void lv_imgbtn_event(lv_event_t * e) +static void lv_imgbtn_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res = lv_obj_event_base(&lv_imgbtn_class, e); if(res != LV_RES_OK) return; diff --git a/src/extra/widgets/led/lv_led.c b/src/extra/widgets/led/lv_led.c index f7f0249a9..0f6f73178 100644 --- a/src/extra/widgets/led/lv_led.c +++ b/src/extra/widgets/led/lv_led.c @@ -30,7 +30,7 @@ * STATIC PROTOTYPES **********************/ static void lv_led_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_led_event(lv_event_t * e); +static void lv_led_event(const lv_obj_class_t * class_p, lv_event_t * e); /********************** * STATIC VARIABLES @@ -156,8 +156,10 @@ static void lv_led_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) led->bright = LV_LED_BRIGHT_MAX; } -static void lv_led_event(lv_event_t * e) +static void lv_led_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /* Call the ancestor's event handler */ diff --git a/src/extra/widgets/spinbox/lv_spinbox.c b/src/extra/widgets/spinbox/lv_spinbox.c index 27b340b47..762c3ae6d 100644 --- a/src/extra/widgets/spinbox/lv_spinbox.c +++ b/src/extra/widgets/spinbox/lv_spinbox.c @@ -23,7 +23,7 @@ **********************/ static void lv_spinbox_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_spinbox_event(lv_event_t * e); +static void lv_spinbox_event(const lv_obj_class_t * class_p, lv_event_t * e); static void lv_spinbox_updatevalue(lv_obj_t * obj); /********************** @@ -294,8 +294,10 @@ static void lv_spinbox_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob LV_LOG_TRACE("Spinbox constructor finished"); } -static void lv_spinbox_event(lv_event_t * e) +static void lv_spinbox_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + /*Call the ancestor's event handler*/ lv_res_t res = LV_RES_OK; res = lv_obj_event_base(MY_CLASS, e); diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index 5c2b04fcf..c7cbb972f 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -358,7 +358,7 @@ static inline lv_res_t lv_style_get_prop_inlined(lv_style_t * style, lv_style_pr * Initialize a transition descriptor. * @param tr pointer to a transition descriptor to initialize * @param props an array with the properties to transition. The last element must be zero. - * @param path_xcb and animation path (ease) callback. If `NULL` liner path will be used. + * @param path_cb and animation path (ease) callback. If `NULL` liner path will be used. * @param time duration of the transition in [ms] * @param delay delay before the transition in [ms] * @example @@ -366,7 +366,7 @@ static inline lv_res_t lv_style_get_prop_inlined(lv_style_t * style, lv_style_pr * static lv_style_transition_dsc_t trans1; * lv_style_transition_dsc_init(&trans1, trans_props, NULL, 300, 0); */ -void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, lv_anim_path_cb_t path_xcb, uint32_t time, uint32_t delay); +void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay); /** * Get the default value of a property diff --git a/src/widgets/lv_arc.c b/src/widgets/lv_arc.c index 7ea0526bf..f87c6df91 100644 --- a/src/widgets/lv_arc.c +++ b/src/widgets/lv_arc.c @@ -32,7 +32,7 @@ static void lv_arc_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_arc_draw(lv_event_t * e); -static void lv_arc_event(lv_event_t * e); +static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e); static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angle, lv_part_t part); static void get_center(lv_obj_t * obj, lv_point_t * center, lv_coord_t * arc_r); static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t r, lv_area_t * knob_area); @@ -509,8 +509,10 @@ static void lv_arc_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_arc_event(lv_event_t * e) +static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ diff --git a/src/widgets/lv_bar.c b/src/widgets/lv_bar.c index 9c0d1a410..b5daa3f14 100644 --- a/src/widgets/lv_bar.c +++ b/src/widgets/lv_bar.c @@ -47,7 +47,7 @@ **********************/ static void lv_bar_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_bar_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_bar_event(lv_event_t * e); +static void lv_bar_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_indic(lv_event_t * e); static void lv_bar_set_value_with_anim(lv_obj_t * obj, int16_t new_value, int16_t * value_ptr, lv_bar_anim_t * anim_info, lv_anim_enable_t en); @@ -466,8 +466,10 @@ static void draw_indic(lv_event_t * e) #endif } -static void lv_bar_event(lv_event_t * e) +static void lv_bar_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ diff --git a/src/widgets/lv_btnmatrix.c b/src/widgets/lv_btnmatrix.c index 8a38e4a51..d894782ec 100644 --- a/src/widgets/lv_btnmatrix.c +++ b/src/widgets/lv_btnmatrix.c @@ -34,7 +34,7 @@ **********************/ static void lv_btnmatrix_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_btnmatrix_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_btnmatrix_event(lv_event_t * e); +static void lv_btnmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_main(lv_event_t * e); static uint8_t get_button_width(lv_btnmatrix_ctrl_t ctrl_bits); @@ -387,8 +387,10 @@ static void lv_btnmatrix_destructor(const lv_obj_class_t * class_p, lv_obj_t * o LV_TRACE_OBJ_CREATE("finshed"); } -static void lv_btnmatrix_event(lv_event_t * e) +static void lv_btnmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ diff --git a/src/widgets/lv_chart.c b/src/widgets/lv_chart.c index 0f19e64ea..dd8d33873 100644 --- a/src/widgets/lv_chart.c +++ b/src/widgets/lv_chart.c @@ -38,7 +38,7 @@ **********************/ static void lv_chart_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_chart_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_chart_event(lv_event_t * e); +static void lv_chart_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_div_lines(lv_obj_t * obj , const lv_area_t * mask); static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area); @@ -611,8 +611,10 @@ static void lv_chart_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_chart_event(lv_event_t * e) +static void lv_chart_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + /*Call the ancestor's event handler*/ lv_res_t res; diff --git a/src/widgets/lv_checkbox.c b/src/widgets/lv_checkbox.c index 4f1a1e9d6..58bb0ba7b 100644 --- a/src/widgets/lv_checkbox.c +++ b/src/widgets/lv_checkbox.c @@ -28,7 +28,7 @@ **********************/ static void lv_checkbox_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_checkbox_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_checkbox_event(lv_event_t * e); +static void lv_checkbox_event(const lv_obj_class_t * class_p, lv_event_t * e); static void lv_checkbox_draw(lv_event_t * e); /********************** @@ -140,8 +140,10 @@ static void lv_checkbox_destructor(const lv_obj_class_t * class_p, lv_obj_t * ob LV_TRACE_OBJ_CREATE("finished"); } -static void lv_checkbox_event(lv_event_t * e) +static void lv_checkbox_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ res = lv_obj_event_base(MY_CLASS, e); diff --git a/src/widgets/lv_dropdown.c b/src/widgets/lv_dropdown.c index 8e25677b4..44662b151 100644 --- a/src/widgets/lv_dropdown.c +++ b/src/widgets/lv_dropdown.c @@ -39,12 +39,12 @@ static lv_obj_t * lv_dropdown_list_create(lv_obj_t * parent); static void lv_dropdown_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_dropdown_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_dropdown_event(lv_event_t * e); +static void lv_dropdown_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_main(lv_event_t * e); static void lv_dropdownlist_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_dropdownlist_destructor(const lv_obj_class_t * class_p, lv_obj_t * list_obj); -static void lv_dropdown_list_event(lv_event_t * e); +static void lv_dropdown_list_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_list(lv_event_t * e); static void draw_box(lv_obj_t * dropdown_obj, const lv_area_t * clip_area, uint16_t id, lv_state_t state); @@ -601,8 +601,10 @@ static void lv_dropdownlist_destructor(const lv_obj_class_t * class_p, lv_obj_t dropdown->list = NULL; } -static void lv_dropdown_event(lv_event_t * e) +static void lv_dropdown_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ @@ -695,8 +697,10 @@ static void lv_dropdown_event(lv_event_t * e) } } -static void lv_dropdown_list_event(lv_event_t * e) +static void lv_dropdown_list_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ diff --git a/src/widgets/lv_img.c b/src/widgets/lv_img.c index 6df402f11..ce46906f1 100644 --- a/src/widgets/lv_img.c +++ b/src/widgets/lv_img.c @@ -30,7 +30,7 @@ **********************/ static void lv_img_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_img_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_img_event(lv_event_t * e); +static void lv_img_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_img(lv_event_t * e); /********************** @@ -397,8 +397,10 @@ static void lv_img_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) } } -static void lv_img_event(lv_event_t * e) +static void lv_img_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_event_code_t code = lv_event_get_code(e); /*Ancestor events will be called during drawing*/ diff --git a/src/widgets/lv_label.c b/src/widgets/lv_label.c index ddec0a391..32d3c5745 100644 --- a/src/widgets/lv_label.c +++ b/src/widgets/lv_label.c @@ -36,7 +36,7 @@ **********************/ static void lv_label_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_label_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_label_event_cb(lv_event_t * e); +static void lv_label_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_main(lv_event_t * e); static void lv_label_refr_text(lv_obj_t * obj); @@ -55,7 +55,7 @@ static void set_ofs_y_anim(void * obj, int32_t v); const lv_obj_class_t lv_label_class = { .constructor_cb = lv_label_constructor, .destructor_cb = lv_label_destructor, - .event_cb = lv_label_event_cb, + .event_cb = lv_label_event, .instance_size = sizeof(lv_label_t), .base_class = &lv_obj_class }; @@ -738,8 +738,10 @@ static void lv_label_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) label->text = NULL; } -static void lv_label_event_cb(lv_event_t * e) +static void lv_label_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ diff --git a/src/widgets/lv_line.c b/src/widgets/lv_line.c index 047ec68aa..ba0c5f0b8 100644 --- a/src/widgets/lv_line.c +++ b/src/widgets/lv_line.c @@ -29,7 +29,7 @@ * STATIC PROTOTYPES **********************/ static void lv_line_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_line_event(lv_event_t * e); +static void lv_line_event(const lv_obj_class_t * class_p, lv_event_t * e); /********************** * STATIC VARIABLES @@ -119,8 +119,10 @@ static void lv_line_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_line_event(lv_event_t * e) +static void lv_line_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ diff --git a/src/widgets/lv_meter.c b/src/widgets/lv_meter.c index 57a925af3..723d12660 100644 --- a/src/widgets/lv_meter.c +++ b/src/widgets/lv_meter.c @@ -29,7 +29,7 @@ **********************/ static void lv_meter_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_meter_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_meter_event(lv_event_t * e); +static void lv_meter_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_arcs(lv_obj_t * obj, const lv_area_t * clip_area, const lv_area_t * scale_area); static void draw_ticks_and_labels(lv_obj_t * obj, const lv_area_t * clip_area, const lv_area_t * scale_area); static void draw_needles(lv_obj_t * obj, const lv_area_t * clip_area, const lv_area_t * scale_area); @@ -278,8 +278,10 @@ static void lv_meter_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) } -static void lv_meter_event(lv_event_t * e) +static void lv_meter_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; diff --git a/src/widgets/lv_roller.c b/src/widgets/lv_roller.c index 1cae20497..874aa8785 100644 --- a/src/widgets/lv_roller.c +++ b/src/widgets/lv_roller.c @@ -29,8 +29,8 @@ * STATIC PROTOTYPES **********************/ static void lv_roller_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_roller_event(lv_event_t * e); -static void lv_roller_label_event(lv_event_t * e); +static void lv_roller_event(const lv_obj_class_t * class_p, lv_event_t * e); +static void lv_roller_label_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_main(lv_event_t * e); static void draw_label(lv_event_t * e); static void refr_position(lv_obj_t * obj, lv_anim_enable_t animen); @@ -303,8 +303,10 @@ static void lv_roller_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj LV_LOG_TRACE("finshed"); } -static void lv_roller_event(lv_event_t * e) +static void lv_roller_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ @@ -400,8 +402,10 @@ static void lv_roller_event(lv_event_t * e) } } -static void lv_roller_label_event(lv_event_t * e) +static void lv_roller_label_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; lv_event_code_t code = lv_event_get_code(e); diff --git a/src/widgets/lv_slider.c b/src/widgets/lv_slider.c index 35836676a..891661de1 100644 --- a/src/widgets/lv_slider.c +++ b/src/widgets/lv_slider.c @@ -32,7 +32,7 @@ * STATIC PROTOTYPES **********************/ static void lv_slider_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_slider_event(lv_event_t * e); +static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e); static void position_knob(lv_obj_t * obj, lv_area_t * knob_area, lv_coord_t knob_size, bool hor); static void draw_knob(lv_event_t * e); @@ -90,8 +90,10 @@ static void lv_slider_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj lv_obj_set_height(obj, LV_DPX(10)); } -static void lv_slider_event(lv_event_t * e) +static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ diff --git a/src/widgets/lv_switch.c b/src/widgets/lv_switch.c index 752f93a81..c5b257854 100644 --- a/src/widgets/lv_switch.c +++ b/src/widgets/lv_switch.c @@ -34,7 +34,7 @@ * STATIC PROTOTYPES **********************/ static void lv_switch_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_switch_event(lv_event_t * e); +static void lv_switch_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_main(lv_event_t * e); /********************** @@ -80,8 +80,10 @@ static void lv_switch_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj } -static void lv_switch_event(lv_event_t * e) +static void lv_switch_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ diff --git a/src/widgets/lv_table.c b/src/widgets/lv_table.c index 5863cb181..bf0556b74 100644 --- a/src/widgets/lv_table.c +++ b/src/widgets/lv_table.c @@ -31,7 +31,7 @@ **********************/ static void lv_table_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_table_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_table_event(lv_event_t * e); +static void lv_table_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_main(lv_event_t * e); static lv_coord_t get_row_height(lv_obj_t * obj, uint16_t row_id, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t line_space, @@ -459,8 +459,10 @@ static void lv_table_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) if(table->row_h) lv_mem_free(table->row_h); } -static void lv_table_event(lv_event_t * e) +static void lv_table_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ diff --git a/src/widgets/lv_textarea.c b/src/widgets/lv_textarea.c index 9e0271343..b413fd965 100644 --- a/src/widgets/lv_textarea.c +++ b/src/widgets/lv_textarea.c @@ -44,7 +44,7 @@ **********************/ static void lv_textarea_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_textarea_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_textarea_event(lv_event_t * e); +static void lv_textarea_event(const lv_obj_class_t * class_p, lv_event_t * e); static void cursor_blink_anim_cb(void * obj, int32_t show); static void pwd_char_hider_anim(void * obj, int32_t x); static void pwd_char_hider_anim_ready(lv_anim_t * a); @@ -831,8 +831,10 @@ static void lv_textarea_destructor(const lv_obj_class_t * class_p, lv_obj_t * ob } } -static void lv_textarea_event(lv_event_t * e) +static void lv_textarea_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ res = lv_obj_event_base(MY_CLASS, e); From fb0481cec0ac06dc3d23b61ccdcbc199a4d1a9ed Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 21 Apr 2021 12:30:37 +0200 Subject: [PATCH 039/152] minor fixes --- src/core/lv_indev_scroll.c | 6 ++++++ src/core/lv_obj_pos.c | 1 + 2 files changed, 7 insertions(+) diff --git a/src/core/lv_indev_scroll.c b/src/core/lv_indev_scroll.c index 6e5c9c915..97b1f6802 100644 --- a/src/core/lv_indev_scroll.c +++ b/src/core/lv_indev_scroll.c @@ -437,6 +437,9 @@ static lv_coord_t find_snap_point_x(const lv_obj_t * obj, lv_coord_t min, lv_coo case LV_SCROLL_SNAP_CENTER: x_child = child->coords.x1 + lv_area_get_width(&child->coords) / 2; x_parent = obj->coords.x1 + pad_left + (lv_area_get_width(&obj->coords) - pad_left - pad_right) / 2; + break; + default: + continue; } x_child += ofs; @@ -487,6 +490,9 @@ static lv_coord_t find_snap_point_y(const lv_obj_t * obj, lv_coord_t min, lv_coo case LV_SCROLL_SNAP_CENTER: y_child = child->coords.y1 + lv_area_get_height(&child->coords) / 2; y_parent = obj->coords.y1 + pad_top + (lv_area_get_height(&obj->coords) - pad_top - pad_bottom) / 2; + break; + default: + continue; } y_child += ofs; diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index faf28c66d..c5b93be45 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -916,6 +916,7 @@ static void layout_update_core(lv_obj_t * obj) lv_obj_refr_size(obj); lv_obj_refr_pos(obj); + if() /*Be sure the bottom side is not remains scrolled in*/ lv_coord_t st = lv_obj_get_scroll_top(obj); lv_coord_t sb = lv_obj_get_scroll_bottom(obj); From 4417ee9d918ff16b67c6098d639045a967d8da3a Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 21 Apr 2021 12:30:52 +0200 Subject: [PATCH 040/152] docs(scroll) add docs for scrolling --- docs/overview/coords.md | 83 ++++++++++++---------- docs/overview/scroll.md | 149 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 180 insertions(+), 52 deletions(-) diff --git a/docs/overview/coords.md b/docs/overview/coords.md index 7ff1df19a..97b9438b1 100644 --- a/docs/overview/coords.md +++ b/docs/overview/coords.md @@ -7,15 +7,15 @@ ## Overview Similarly to many other parts of LVGL, the concept of setting the coordinates were inspired by CSS. It doesn't mean a perfect copy of the standard but parts that are reasonable were adopted in LVGL. It shorts it means: -- the set corrdintates (size, position, layouts, etc) are stored in styles +- the set coordinates (size, position, layouts, etc) are stored in styles - support min-width, max-width, min-height, max-height - have pixel, percentage, and "content" units -- a subset of felxbox and grid layouts are supported by default +- a subset of flexbox and grid layouts are supported by default ### Units - pixel: Simply a position in pixels. A simple integer always mean pixel. E.g. `lv_obj_set_x(btn, 10)` -- percentage: The percentage of the size of the obejct or its parent (dependeing on the property). The `lv_pct(value)` converts a value to percentage. E.g. `lv_obj_set_width(btn, lv_pct(50))` -- `LV_SIZE_CONTENT`: Specai lvalue to set the width/height of an object to involve all the children. Its similar to `auto` in CSS. E.g. `lv_obj_set_width(btn, LV_SIZE_CONTENT)`. +- percentage: The percentage of the size of the object or its parent (depending on the property). The `lv_pct(value)` converts a value to percentage. E.g. `lv_obj_set_width(btn, lv_pct(50))` +- `LV_SIZE_CONTENT`: Special value to set the width/height of an object to involve all the children. Its similar to `auto` in CSS. E.g. `lv_obj_set_width(btn, LV_SIZE_CONTENT)`. ### Boxing model An object's "box" is built from the following parts: @@ -38,7 +38,7 @@ lv_obj_set_pos(obj, 10, 20); //Or in one function ``` By default the the x and y coordinates are measured from the top left corner of the parent's content area. -For example if the parent has 5 pixel padding on every side, the above code will place `obj` to (15, 25) becasue the content area starts after the padding. +For example if the parent has 5 pixel padding on every side, the above code will place `obj` to (15, 25) because the content area starts after the padding. If percentage values are calculated from the parents content area size. ```c @@ -46,13 +46,13 @@ lv_obj_set_x(btn, lv_pct(10)); //x = 10 % of parant content area width ``` ### Align -In some cases it's convinient to change the origin of the positioning from the the default top left. If the the orogin is changed e.g. to bottom-right, the (0,0) positon means: align to the bottom-right corner. +In some cases it's convenient to change the origin of the positioning from the the default top left. If the the orogin is changed e.g. to bottom-right, the (0,0) position means: align to the bottom-right corner. To change the origin use: ```c lv_obj_set_align(obj, align); ``` -To change the alignment and set new coordiantes: +To change the alignment and set new coordinates: ```c lv_obj_align(obj, align, x, y); ``` @@ -68,7 +68,7 @@ The following alignment options can be used: - `LV_ALIGN_RIGHT_MID` - `LV_ALIGN_CENTER` -It quite common to align a children to the center of its parent, tehre fore is a dedicated function for it: +It quite common to align a children to the center of its parent, there fore is a dedicated function for it: ```c lv_obj_center(obj); @@ -78,12 +78,12 @@ lv_obj_align(obj, LV_ALIGN_CENTER, 0, 0); If the parent's size changes the set alignment and position of the children is applied again automatically. -The functions introduced above aligns the obejct to its parent. However it's also possible to align an obejct to an arbitrary object. +The functions introduced above aligns the object to its parent. However it's also possible to align an object to an arbitrary object. ```c lv_obj_align_to(obj_to_align, reference_obj, align, x, y); ``` -Besides the alignments optins above the follwing can be used to align the object outside of the refrence object: +Besides the alignments options above the following can be used to align the object outside of the reference object: - `LV_ALIGN_OUT_TOP_LEFT` - `LV_ALIGN_OUT_TOP_MID` @@ -120,15 +120,15 @@ Percentage values aer calculated based on the parent's content area size. For ex lv_obj_set_height(obj, lv_pct(100)); ``` -Size setting supports a value: `LV_SIZE_CONTENT`. It means the object's size in the respective direction will be set to involv its the children. -Note that only children on the right and bottom will be considered and children o nthe top and left remains cropped. This limitation makes the behavior more predictible. +Size setting supports a value: `LV_SIZE_CONTENT`. It means the object's size in the respective direction will be set to involve its the children. +Note that only children on the right and bottom will be considered and children o nthe top and left remains cropped. This limitation makes the behavior more predictable. Object with `LV_OBJ_FLAG_HIDDEN` or `LV_OBJ_FLAG_FLOATING` will be ignored by `LV_SIZE_CONTENT` calculation. -The above functions set the size of the bounding box of the object but the size of the content area can be set as well. It means the obejct's bounding box will be larger with the paddings than the set size. +The above functions set the size of the bounding box of the object but the size of the content area can be set as well. It means the object's bounding box will be larger with the paddings than the set size. ```c -lv_obj_set_content_width(obj, 50); -lv_obj_set_content_height(obj, 30); +lv_obj_set_content_width(obj, 50); //The actual width: padding left + 50 + padding right +lv_obj_set_content_height(obj, 30); //The actual width: padding top + 30 + padding bottom ``` The size of the bounding box and the content area can be get with the following functions: @@ -144,8 +144,8 @@ Under the hood the position, size and alignment properties are style properties. The above described "simple functions" hide the style related code for the sake of simplicity and set the position, size, and alignment properties in the local styles of the obejct. However, using styles as to set the coordinates has some great advantages: -- It makes easy to set the width/height/etc for several obejct togother with ease. E.g. all make all the sliders 100x10 pixels sized. -- It also makes possibel to modify the values in one place. +- It makes easy to set the width/height/etc for several object together with ease. E.g. all make all the sliders 100x10 pixels sized. +- It also makes possible to modify the values in one place. - The values can be overwritten by other styles. For example `style_btn` makes the object `100x50` by default but adding `style_full_width` overwrites only the width of the object. - The object can have different position or size in different state. E.g. 100 px wide in `LV_STATE_DEFAULT` but 120 px in `LV_STATE_PRESSED`. - Style transitions can be used to make the coordinate changes smooth. @@ -161,17 +161,15 @@ lv_obj_t * btn = lv_btn_create(lv_scr_act()); lv_obj_add_style(btn, &style, LV_PART_MAIN); ``` -As you will see below there are some other great fetures of size and position setting. +As you will see below there are some other great features of size and position setting. However, to keep the LVGL's API lean only the most common coordinate setting features have a "simple" version and the more complex features can be used via styles. - -### Translations and transformations -### Translation +## Translation Let's say the there are 3 buttons next to each other. Their position is set as described above. Now you want to move a buttons up a little when it's pressed. -One way to achive this is setting a new Y coordinate for pressed state: +One way to achieve this is setting a new Y coordinate for pressed state: ```c static lv_style_t style_normal; lv_style_init(&style_normal); @@ -191,7 +189,7 @@ lv_obj_add_style(btn3, &style_normal, LV_STATE_DEFAULT); lv_obj_add_style(btn3, &style_pressed, LV_STATE_PRESSED); ``` -It workes but it's not really flexible becasue the pressed coordinate is hardcoded. If the buttons are not at y=100 `style_pressed` won't work as expected. To solve this translations can be used: +It works but it's not really flexible because the pressed coordinate is hard-coded. If the buttons are not at y=100 `style_pressed` won't work as expected. To solve this translations can be used: ```c static lv_style_t style_normal; lv_style_init(&style_normal); @@ -213,17 +211,18 @@ lv_obj_add_style(btn3, &style_pressed, LV_STATE_PRESSED); Translation is applied from the current position of the object. -Perecentage values can be used in translations as well. In this case the percentage is releative to the size of the object. For example `lv_pct(50)` will move the object with half of its wifth/height. +Percentage values can be used in translations as well. The percentage is relative to the size of the object (and not to the size of the parent). For example `lv_pct(50)` will move the object with half of its width/height. -The translations is applied when the layouts are calcualted. Therefore, even the layouted objects' position can be translated. +The translations is applied after the layouts are calculated. Therefore, even the layouted objects' position can be translated. The translation actually moves the object. It means it makes the scrollbars and `LV_SIZE_CONTENT` sized objects react on the position change. -### Transformation -Similarly to the position the size can be changed relative to the current size as well. The transformed width and hight is added on both sides of the object. That is 10 px transformed width amkes the object 2x10 pixel larger. +## Transformation +Similarly to the position the size can be changed relative to the current size as well. +The transformed width and height is added on both sides of the object. That is 10 px transformed width makes the object 2x10 pixel wider. -Unlike position translation, the size transformation doesn't make the object "really" larget. In other words scrollbars, layouts, `LV_SIZE_CONTENT` will not consider the transformed size. +Unlike position translation, the size transformation doesn't make the object "really" larger. In other words scrollbars, layouts, `LV_SIZE_CONTENT` will not consider the transformed size. Hence size transformation if "only" a visual effect. This code makes the a button larger when it's pressed: @@ -237,26 +236,36 @@ lv_obj_add_style(btn, &style_pressed, LV_STATE_PRESSED); ``` ### Min and Max size -Similarly to CSS, LVGL also support `min-width`, `max-width`, `min-height` and `max-height`. These are limits preventing an obejct's size to be smaller/larger then these values. -They are espically useful if the size is set by percentage or `LV_SIZE_CONTENT`. +Similarly to CSS, LVGL also support `min-width`, `max-width`, `min-height` and `max-height`. These are limits preventing an object's size to be smaller/larger then these values. +They are especially useful if the size is set by percentage or `LV_SIZE_CONTENT`. ```c static lv_style_t style_max_height; lv_style_init(&style_max_height); lv_style_set_y(&style_max_height, 200); lv_obj_set_height(obj, lv_pct(100)); -lv_obj_add_style(obj, &style_max_height, LV_STATE_DEFAULT); //Limit height to 200 +lv_obj_add_style(obj, &style_max_height, LV_STATE_DEFAULT); //Limit the height to 200 px +``` + +Percentage values can be used as well which are relative to the size of the parent's content area size. +```c +static lv_style_t style_max_height; +lv_style_init(&style_max_height); +lv_style_set_y(&style_max_height, lv_pct(50)); + +lv_obj_set_height(obj, lv_pct(100)); +lv_obj_add_style(obj, &style_max_height, LV_STATE_DEFAULT); //Limit the height to half parent height ``` ## Layout ### Overview -Layouts can update the the position and size of an object's children. They can be used to automatically arrange the children into a line or column, or in much more complicated ways. +Layouts can update the position and size of an object's children. They can be used to automatically arrange the children into a line or column, or in much more complicated forms. The position and size set by the layout overwrites the "normal" x, y, width, and height settings. -There is only one function that is the same for every layout: `lv_obj_set_layout(obj, )` sets the layout on an obejct. -For the further settings of the parent and children for a specific layout see the documentions of the given layout. +There is only one function that is the same for every layout: `lv_obj_set_layout(obj, )` sets the layout on an object. +For the further settings of the parent and children see the documentations of the given layout. ### Built-in layout LVGL comes with two very powerful layouts: @@ -267,11 +276,11 @@ Both are heavily inspired by the CSS layouts with the same name. ### Flags There are some flags that can be used on object to affect how they behave with layouts: -- `LV_OBJ_FLAG_HIDDEN` Hidden object are ignored from layout calcualtions. -- `LV_OBJ_FLAG_IGNORE_LAYOUT` The object is simply ignored by the layouts. It's coordinate can be set as usual. +- `LV_OBJ_FLAG_HIDDEN` Hidden object are ignored from layout calculations. +- `LV_OBJ_FLAG_IGNORE_LAYOUT` The object is simply ignored by the layouts. Its coordinates can be set as usual. - `LV_OBJ_FLAG_FLOATING` Same as `LV_OBJ_FLAG_IGNORE_LAYOUT` but the object with `LV_OBJ_FLAG_FLOATING` will be ignored from `LV_SIZE_CONTENT` calculations. -These falgs can be added/remoevd with `lv_obj_add/clear_flag(obj, FLAG);` +These flags can be added/removed with `lv_obj_add/clear_flag(obj, FLAG);` ### Adding new layouts diff --git a/docs/overview/scroll.md b/docs/overview/scroll.md index bfb87b356..ea99bc7ea 100644 --- a/docs/overview/scroll.md +++ b/docs/overview/scroll.md @@ -5,40 +5,159 @@ # Scroll ## Overview -How it works -Scrollbar -Directions -Everything is scrollable +In LVGL scrolling works very intuitively: if an object is out of its parent content area (the size without paddings), the parent becomes scrollable and scrollbar(s) will appear. That's it. -### Scrolled state -Scrolled state +Any object can be scrollable including `lv_obj_t`, `lv_img`, `lv_btn`, `lv_meter`, etc + +The obejct can be scrolled either horizontally or vertically at a time, that is diagonal scrolling is not possible. + +### Scrollbar + +#### Mode +The scrollbars are displayed according to the set `mode`. The following `mode`s exist: +- `LV_SCROLLBAR_MODE_OFF` Never show the scrollbars +- `LV_SCROLLBAR_MODE_ON` Always show the scrollbars +- `LV_SCROLLBAR_MODE_ACTIVE` Show scroll bars while object is being scrolled +- `LV_SCROLLBAR_MODE_AUTO` Show scroll bars when the content is large enough to be scrolled + +`lv_obj_set_scrollbar_mode(obj, LV_SCROLLBAR_MODE_...)` set the scrollbar mode on an object. + + +#### Styling +The scrollbars have its own dedicated part, called `LV_PART_SCROLLBAR`. For example a scrollbar can turned to red like this: +```c +static lv_style_t style_red; +lv_style_init(&style_red); +lv_style_set_bg_color(&style_red, lv_color_red()); + +... + +lv_obj_add_style(obj, &style_red, LV_PART_SCROLLBAR); +``` + +The object goes to `LV_STATE_SCROLLED` state while it's being scrolled. It allows adding different style to the scrollbar or the object itself when scrolled. +This code makes the scrollbar blue when the object is scrolled: +```c +static lv_style_t style_blue; +lv_style_init(&style_blue); +lv_style_set_bg_color(&style_red, lv_color_blue()); + +... + +lv_obj_add_style(obj, &style_blue, LV_STATE_SCROLLED | LV_PART_SCROLLBAR); +``` ### Events +The following events are related to scrolling: +- `LV_EVENT_SCROLL_BEGIN` Scrolling begins +- `LV_EVENT_SCROLL_END` Scrolling ends +- `LV_EVENT_SCROLL` Scroll happened. Triggered on every position change. Scroll events ## Basic example - -## Styling +TODO ## Features of scrolling -### Scrollable -scroll_dir too +Besides managing "normal" scrolling there are many interesting and useful additional features too. + + +### Scrollable + +It's possible to make an object non-scrollable with `lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLLABLE)`. + +Non-scrollable object can still propagate the scrolling (chain) to the parents. + +The direction in which scrolling can happen can be controlled by `lv_obj_set_scroll_dir(obj, LV_DIR_...)`. +The following values are possible for the direction: +- `LV_DIR_TOP` only scroll up +- `LV_DIR_LEFT` only scroll left +- `LV_DIR_BOTTOM` only scroll down +- `LV_DIR_RIGHT` only scroll right +- `LV_DIR_HOR` only scroll horizontally +- `LV_DIR_TOP` only scroll vertically +- `LV_DIR_ALL` scroll any directions + +OR-ed values are also possible. E.g. `LV_DIR_TOP | LV_DIR_LEFT`. -### Scroll momentum ### Scroll chain +If an object can't be scrolled further (e.g. it's content has reached the bottom most position) the scrolling is propagated to it's parent. If the parent an be scrolled in that direction than it will be scrolled instead. +It goes to the grad parent and grand grandparents too. -### Scroll on focus +The propagation on scrolling in called "scroll chaining" and it can be enabled/disabled with the `LV_OBJ_FLAG_SCROLL_CHAIN` flag. +If chaining is disabled the propagation stops on the object and the parent(s) won't be scrolled. -### Snaping +### Scroll momentum +When the user scrolls an object and releases it LVGL can emulate a momentum for the scrolling. It's like to object were thrown and the scrolling slows down smoothly. -### Scroll one +The scroll momentum can be enabled/disabled with the `LV_OBJ_FLAG_SCROLL_MOMENTUM` flag. ### Elastic scroll +Normally the content can't be scrolled inside the object. That is the top side of the content can't be below the top side of the object. -## Scroll thorw +However, with `LV_OBJ_FLAG_SCROLL_ELASTIC` a fancy effect can be added when the user "over-scrolls" the content. The scrolling slows down, and the content can be scrolled inside the object. +When the object is releases the content is scrolled in it will be animated back to the valid position. + +### Snaping +The children of an object can be snapped according to specific rules when scrolling ends. Children can be made snapable individually with the `LV_OBJ_FLAG_SNAPABLE` flag. +The object can align the snapped children in 4 ways: +- `LV_SCROLL_SNAP_NONE` Snapping is disabled. (default) +- `LV_SCROLL_SNAP_START` Align the children to the left/top side of the scrolled object +- `LV_SCROLL_SNAP_END` Align the children to the right/bottom side of the scrolled object +- `LV_SCROLL_SNAP_CENTER` Align the children to the center of the scrolled object + +The alignment can be set with `lv_obj_set_scroll_snap_x/y(obj, LV_SCROLL_SNAP_...)`: + +Under the hood the followings happen +1. User scrolls an object and releases the screen +2. LVGL calculates where would the scroll end considering scroll momentum +3. LVGL finds the nearest scroll point +4. LVGL scrolls the snap point with an animation + +### Scroll one +The "scroll one" feature tells LVGL to allow scrolling only one snapable children at a time. +So it requires to make the children snapable and and set a scroll snap alignment different from `LV_SCROLL_SNAP_NONE`. + +This feature can be enabled by the `LV_OBJ_FLAG_SCROLL_ONE` flag. + +### Scroll on focus +Imagine that there a lot of objects in a group that are on scrollable object. Pressing the "Tab" button focuses the next object but it might be out of the visible area of the scrollable object. +If the "scroll on focus" features is enabled LVGL will automatically scroll to the objects to bring the children into the view. +The scrolling happens recursively therefore even nested scrollable object are handled properly. +The object will be scrolled to the view even if it's on a different page of a tabview. + +## Scroll manually +The following API functions allow to manually scroll objects: +- `lv_obj_scroll_by(obj, x, y, LV_ANIM_ON/OFF)` scroll by `x` and `y` values +- `lv_obj_scroll_to(obj, x, y, LV_ANIM_ON/OFF)` scroll to bring the given coordinate to the top left corner +- `lv_obj_scroll_to_x(obj, x, LV_ANIM_ON/OFF)` scroll to bring the given coordinate to the left side +- `lv_obj_scroll_to_y(obj, y, LV_ANIM_ON/OFF)` scroll to bring the given coordinate to the left side ## Self size +Self size is a property of an object. Normally, the user shouldn't use this parameter but if a custom widget is created it might be useful. + +In short, self size tell the size of the content. To understand it better take the example of a table. +Let's say it has 10 rows each with 50 px height. So the total height of the content is 500 px. In other words the "self height" is 500 px. +If the user sets only 200 px height for the table LVGL will see that the self size is larger and make the table scrollable. + +It means not only the children can make an object scrollable but a larger self size too. + +LVGL uses the `LV_EVENT_GET_SELF_SIZE` event to get the self size of an object. Here is an example to see how to handle the event +```c +if(event_code == LV_EVENT_GET_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e); + + //If x or y < 0 then it doesn't neesd to be calculated now + if(p->x >= 0) { + p->x = 200; //Set or calculate the self width + } + + if(p->x >= 0) { + p->y = 50; //Set or calculate the self height + } +} +``` + ## Examples From 36a699fbe43425417c79afb1deac09ecfa2f5cfe Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 21 Apr 2021 12:34:41 +0200 Subject: [PATCH 041/152] minor fix --- src/core/lv_obj_pos.c | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index c5b93be45..8066faeb6 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -916,28 +916,33 @@ static void layout_update_core(lv_obj_t * obj) lv_obj_refr_size(obj); lv_obj_refr_pos(obj); - if() + /*Be sure the bottom side is not remains scrolled in*/ - lv_coord_t st = lv_obj_get_scroll_top(obj); - lv_coord_t sb = lv_obj_get_scroll_bottom(obj); - if(sb < 0 && st > 0) { - sb = LV_MIN(st, -sb); - lv_obj_scroll_by(obj, 0, sb, LV_ANIM_OFF); + /*With snapping the content can't be scrolled in*/ + if(lv_obj_get_scroll_snap_y(obj) == LV_SCROLL_SNAP_NONE) { + lv_coord_t st = lv_obj_get_scroll_top(obj); + lv_coord_t sb = lv_obj_get_scroll_bottom(obj); + if(sb < 0 && st > 0) { + sb = LV_MIN(st, -sb); + lv_obj_scroll_by(obj, 0, sb, LV_ANIM_OFF); + } } - lv_coord_t sl = lv_obj_get_scroll_left(obj); - lv_coord_t sr = lv_obj_get_scroll_right(obj); - if(lv_obj_get_base_dir(obj) != LV_BIDI_DIR_RTL) { - /*Be sure the left side is not remains scrolled in*/ - if(sr < 0 && sl > 0) { - sr = LV_MIN(sl, -sr); - lv_obj_scroll_by(obj, sr, 0, LV_ANIM_OFF); - } - } else { - /*Be sure the right side is not remains scrolled in*/ - if(sl < 0 && sr > 0) { - sr = LV_MIN(sr, -sl); - lv_obj_scroll_by(obj, sl, 0, LV_ANIM_OFF); + if(lv_obj_get_scroll_snap_x(obj) == LV_SCROLL_SNAP_NONE) { + lv_coord_t sl = lv_obj_get_scroll_left(obj); + lv_coord_t sr = lv_obj_get_scroll_right(obj); + if(lv_obj_get_base_dir(obj) != LV_BIDI_DIR_RTL) { + /*Be sure the left side is not remains scrolled in*/ + if(sr < 0 && sl > 0) { + sr = LV_MIN(sl, -sr); + lv_obj_scroll_by(obj, sr, 0, LV_ANIM_OFF); + } + } else { + /*Be sure the right side is not remains scrolled in*/ + if(sl < 0 && sr > 0) { + sr = LV_MIN(sr, -sl); + lv_obj_scroll_by(obj, sl, 0, LV_ANIM_OFF); + } } } From 7522858d0769eb4714f6986a5f24c1ad92722c47 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 21 Apr 2021 13:22:55 +0200 Subject: [PATCH 042/152] fix(examples) use LV_PART_INDICATOR to target the points on line chart --- examples/widgets/chart/lv_example_chart_5.c | 2 +- examples/widgets/chart/lv_example_chart_6.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/widgets/chart/lv_example_chart_5.c b/examples/widgets/chart/lv_example_chart_5.c index 9089604c1..552c12018 100644 --- a/examples/widgets/chart/lv_example_chart_5.c +++ b/examples/widgets/chart/lv_example_chart_5.c @@ -74,7 +74,7 @@ void lv_example_chart_5(void) lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, -1000, 1000); /*Do not display points on the data*/ - lv_obj_set_style_size(chart, 0, LV_PART_ITEMS); + lv_obj_set_style_size(chart, 0, LV_PART_INDICATOR); lv_chart_series_t * ser = lv_chart_add_series(chart, lv_color_red(), LV_CHART_AXIS_PRIMARY_Y); diff --git a/examples/widgets/chart/lv_example_chart_6.c b/examples/widgets/chart/lv_example_chart_6.c index 4d5a84311..dda8c6519 100644 --- a/examples/widgets/chart/lv_example_chart_6.c +++ b/examples/widgets/chart/lv_example_chart_6.c @@ -83,7 +83,6 @@ void lv_example_chart_6(void) lv_obj_t * label = lv_label_create(lv_scr_act()); lv_label_set_text(label, "Click on a point"); lv_obj_align_to(label, chart, LV_ALIGN_OUT_TOP_MID, 0, -5); - } #endif From 980c18fa518df83a1815768ab7b584843f6a605b Mon Sep 17 00:00:00 2001 From: Themba Dube Date: Wed, 21 Apr 2021 13:09:55 -0400 Subject: [PATCH 043/152] fix(canvas) allocate a fake driver on the stack As of v8 drivers are no longer stored inside lv_disp_t, so a driver needs to be allocated as well. Fixes #2204 --- src/widgets/lv_canvas.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/widgets/lv_canvas.c b/src/widgets/lv_canvas.c index 7066bae8f..937335816 100644 --- a/src/widgets/lv_canvas.c +++ b/src/widgets/lv_canvas.c @@ -579,7 +579,10 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord coords.y2 = y + h - 1; lv_disp_t disp; + /*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/ + lv_disp_drv_t driver; lv_memset_00(&disp, sizeof(lv_disp_t)); + disp.driver = &driver; lv_disp_draw_buf_t draw_buf; lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); @@ -637,7 +640,10 @@ void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord coords.y2 = dsc->header.h - 1; lv_disp_t disp; + /*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/ + lv_disp_drv_t driver; lv_memset_00(&disp, sizeof(lv_disp_t)); + disp.driver = &driver; lv_disp_draw_buf_t draw_buf; lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); @@ -695,7 +701,10 @@ void lv_canvas_draw_img(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, const voi coords.y2 = y + header.h - 1; lv_disp_t disp; + /*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/ + lv_disp_drv_t driver; lv_memset_00(&disp, sizeof(lv_disp_t)); + disp.driver = &driver; lv_disp_draw_buf_t draw_buf; lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); @@ -739,7 +748,10 @@ void lv_canvas_draw_line(lv_obj_t * canvas, const lv_point_t points[], uint32_t mask.y2 = dsc->header.h - 1; lv_disp_t disp; + /*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/ + lv_disp_drv_t driver; lv_memset_00(&disp, sizeof(lv_disp_t)); + disp.driver = &driver; lv_disp_draw_buf_t draw_buf; lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); @@ -794,7 +806,10 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, const lv_point_t points[], uint32 mask.y2 = dsc->header.h - 1; lv_disp_t disp; + /*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/ + lv_disp_drv_t driver; lv_memset_00(&disp, sizeof(lv_disp_t)); + disp.driver = &driver; lv_disp_draw_buf_t draw_buf; lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); @@ -847,7 +862,10 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_ mask.y2 = dsc->header.h - 1; lv_disp_t disp; + /*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/ + lv_disp_drv_t driver; lv_memset_00(&disp, sizeof(lv_disp_t)); + disp.driver = &driver; lv_disp_draw_buf_t draw_buf; lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); From d9c7fd14f11b0d826e6e57c9ecd0af89a0d27188 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 22 Apr 2021 15:34:54 +0200 Subject: [PATCH 044/152] feat(font) add LV_SYMBOL_BARS (hamburder menu icon) --- scripts/built_in_font/built_in_font_gen.py | 2 +- src/font/lv_font_dejavu_16_persian_hebrew.c | 572 ++++++++++---------- src/font/lv_font_montserrat_10.c | 63 ++- src/font/lv_font_montserrat_12.c | 65 ++- src/font/lv_font_montserrat_12_subpx.c | 65 ++- src/font/lv_font_montserrat_14.c | 67 ++- src/font/lv_font_montserrat_16.c | 70 ++- src/font/lv_font_montserrat_18.c | 72 ++- src/font/lv_font_montserrat_20.c | 77 ++- src/font/lv_font_montserrat_22.c | 80 ++- src/font/lv_font_montserrat_24.c | 84 ++- src/font/lv_font_montserrat_26.c | 88 ++- src/font/lv_font_montserrat_28.c | 93 +++- src/font/lv_font_montserrat_28_compressed.c | 67 ++- src/font/lv_font_montserrat_30.c | 98 +++- src/font/lv_font_montserrat_32.c | 103 +++- src/font/lv_font_montserrat_34.c | 108 +++- src/font/lv_font_montserrat_36.c | 115 +++- src/font/lv_font_montserrat_38.c | 121 ++++- src/font/lv_font_montserrat_40.c | 127 ++++- src/font/lv_font_montserrat_42.c | 134 ++++- src/font/lv_font_montserrat_44.c | 143 ++++- src/font/lv_font_montserrat_46.c | 150 ++++- src/font/lv_font_montserrat_48.c | 157 +++++- src/font/lv_font_montserrat_8.c | 57 +- src/font/lv_font_simsun_16_cjk.c | 66 ++- src/font/lv_symbol_def.h | 1 + 27 files changed, 1922 insertions(+), 923 deletions(-) diff --git a/scripts/built_in_font/built_in_font_gen.py b/scripts/built_in_font/built_in_font_gen.py index fd913cdc9..ca9565d79 100755 --- a/scripts/built_in_font/built_in_font_gen.py +++ b/scripts/built_in_font/built_in_font_gen.py @@ -52,7 +52,7 @@ if len(args.symbols[0]) != 0: args.symbols[0] = "--symbols " + args.symbols[0] #Built in symbols -syms = "61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650" +syms = "61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650" #Run the command (Add degree and bbullet symbol) cmd = "lv_font_conv {} --bpp {} --size {} --font {} -r {} {} --font FontAwesome5-Solid+Brands+Regular.woff -r {} --format lvgl -o {} --force-fast-kern-format".format(compr, args.bpp, args.size, args.font, args.range[0], args.symbols[0], syms, args.output) diff --git a/src/font/lv_font_dejavu_16_persian_hebrew.c b/src/font/lv_font_dejavu_16_persian_hebrew.c index 8eb425c6b..6d7ebde59 100644 --- a/src/font/lv_font_dejavu_16_persian_hebrew.c +++ b/src/font/lv_font_dejavu_16_persian_hebrew.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 16 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 16 --font DejaVuSans.ttf -r 0x20-0x7f,0x5d0-0x5ea,0x600-0x6FF,0xFB50-0xFDFF,0xFE70-0xFEFF --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_dejavu_16_persian_hebrew.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 16 --font DejaVuSans.ttf -r 0x20-0x7f,0x5d0-0x5ea,0x600-0x6FF,0xFB50-0xFDFF,0xFE70-0xFEFF --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_dejavu_16_persian_hebrew.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -3161,6 +3161,21 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + /* U+F0C9 "" */ + 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x12, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x21, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x12, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x21, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x21, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x12, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x21, + /* U+F0E0 "" */ 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -6182,275 +6197,276 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 18573, .adv_w = 224, .box_w = 15, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 18678, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 18790, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 18888, .adv_w = 256, .box_w = 16, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 18984, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 19080, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 19192, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 19304, .adv_w = 288, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 19412, .adv_w = 256, .box_w = 18, .box_h = 18, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 19574, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 19670, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 19820, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 19920, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 20020, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 20120, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 20220, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 20320, .adv_w = 320, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 20467, .adv_w = 224, .box_w = 12, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 20563, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 20675, .adv_w = 256, .box_w = 17, .box_h = 17, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 20820, .adv_w = 320, .box_w = 20, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 20940, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 21036, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 21130, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 21202, .adv_w = 251, .box_w = 15, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 21277, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 21302, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 21332, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 21404, .adv_w = 251, .box_w = 15, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 21479, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 21504, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 21534, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 21606, .adv_w = 251, .box_w = 15, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 21681, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 21706, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 21736, .adv_w = 241, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 21788, .adv_w = 251, .box_w = 15, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 21848, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 21873, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 21903, .adv_w = 241, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 21955, .adv_w = 251, .box_w = 15, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 22015, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22040, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22070, .adv_w = 241, .box_w = 13, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 22135, .adv_w = 251, .box_w = 15, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 22203, .adv_w = 71, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22236, .adv_w = 77, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22269, .adv_w = 265, .box_w = 15, .box_h = 14, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 22374, .adv_w = 265, .box_w = 16, .box_h = 12, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 22470, .adv_w = 122, .box_w = 8, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22518, .adv_w = 130, .box_w = 10, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22573, .adv_w = 265, .box_w = 15, .box_h = 14, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 22678, .adv_w = 265, .box_w = 16, .box_h = 12, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 22774, .adv_w = 122, .box_w = 8, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22822, .adv_w = 130, .box_w = 10, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22877, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 22937, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 23002, .adv_w = 158, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23062, .adv_w = 165, .box_w = 12, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23134, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 23199, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 23259, .adv_w = 158, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 23309, .adv_w = 165, .box_w = 12, .box_h = 10, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 23369, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 23429, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 23489, .adv_w = 158, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23549, .adv_w = 165, .box_w = 12, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23621, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 23681, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 23741, .adv_w = 158, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23801, .adv_w = 165, .box_w = 12, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23873, .adv_w = 114, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 23908, .adv_w = 134, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 23953, .adv_w = 114, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 23988, .adv_w = 134, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 24033, .adv_w = 114, .box_w = 7, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 24075, .adv_w = 134, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 24129, .adv_w = 114, .box_w = 7, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 24171, .adv_w = 134, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 24225, .adv_w = 124, .box_w = 9, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 24288, .adv_w = 141, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 24358, .adv_w = 124, .box_w = 9, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 24430, .adv_w = 141, .box_w = 10, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 24510, .adv_w = 229, .box_w = 14, .box_h = 14, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 24608, .adv_w = 229, .box_w = 15, .box_h = 14, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 24713, .adv_w = 122, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 24772, .adv_w = 141, .box_w = 10, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 24837, .adv_w = 229, .box_w = 14, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 24949, .adv_w = 229, .box_w = 15, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 25069, .adv_w = 122, .box_w = 9, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 25137, .adv_w = 141, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 25212, .adv_w = 229, .box_w = 14, .box_h = 20, .ofs_x = 1, .ofs_y = -6}, - {.bitmap_index = 25352, .adv_w = 229, .box_w = 15, .box_h = 21, .ofs_x = 1, .ofs_y = -6}, - {.bitmap_index = 25510, .adv_w = 122, .box_w = 9, .box_h = 20, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 25600, .adv_w = 141, .box_w = 10, .box_h = 20, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 25700, .adv_w = 229, .box_w = 14, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 25812, .adv_w = 229, .box_w = 15, .box_h = 15, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 25925, .adv_w = 122, .box_w = 9, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 25988, .adv_w = 141, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 26058, .adv_w = 188, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 26108, .adv_w = 195, .box_w = 12, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 26168, .adv_w = 188, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 26238, .adv_w = 195, .box_w = 12, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 26316, .adv_w = 71, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 26349, .adv_w = 77, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 26382, .adv_w = 179, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 26427, .adv_w = 162, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 26482, .adv_w = 135, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 26523, .adv_w = 118, .box_w = 9, .box_h = 11, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 26573, .adv_w = 211, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 26650, .adv_w = 216, .box_w = 13, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 26741, .adv_w = 122, .box_w = 9, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 26809, .adv_w = 141, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 26884, .adv_w = 124, .box_w = 8, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 26944, .adv_w = 132, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27019, .adv_w = 124, .box_w = 8, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27075, .adv_w = 132, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27145, .adv_w = 124, .box_w = 8, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27209, .adv_w = 132, .box_w = 10, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27289, .adv_w = 124, .box_w = 8, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27345, .adv_w = 132, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27415, .adv_w = 200, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = -7}, - {.bitmap_index = 27492, .adv_w = 213, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = -7}, - {.bitmap_index = 27570, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27595, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27625, .adv_w = 71, .box_w = 5, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 27638, .adv_w = 77, .box_w = 6, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 27653, .adv_w = 200, .box_w = 11, .box_h = 10, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 27708, .adv_w = 213, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 27760, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 27780, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 27804, .adv_w = 75, .box_w = 5, .box_h = 5, .ofs_x = 0, .ofs_y = 9}, - {.bitmap_index = 27817, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 27859, .adv_w = 75, .box_w = 5, .box_h = 5, .ofs_x = 0, .ofs_y = 9}, - {.bitmap_index = 27872, .adv_w = 67, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 27880, .adv_w = 75, .box_w = 5, .box_h = 4, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 27890, .adv_w = 75, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = 9}, - {.bitmap_index = 27898, .adv_w = 75, .box_w = 6, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 27934, .adv_w = 75, .box_w = 5, .box_h = 5, .ofs_x = 0, .ofs_y = 9}, - {.bitmap_index = 27947, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 27989, .adv_w = 75, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 27997, .adv_w = 75, .box_w = 6, .box_h = 5, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 28012, .adv_w = 75, .box_w = 6, .box_h = 5, .ofs_x = -1, .ofs_y = 10}, - {.bitmap_index = 28027, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 28069, .adv_w = 75, .box_w = 5, .box_h = 4, .ofs_x = 0, .ofs_y = 10}, - {.bitmap_index = 28079, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 28121, .adv_w = 120, .box_w = 6, .box_h = 8, .ofs_x = 1, .ofs_y = 1}, - {.bitmap_index = 28145, .adv_w = 71, .box_w = 7, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 28198, .adv_w = 78, .box_w = 7, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 28251, .adv_w = 71, .box_w = 4, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 28285, .adv_w = 78, .box_w = 6, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 28336, .adv_w = 124, .box_w = 8, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 28396, .adv_w = 132, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 28471, .adv_w = 71, .box_w = 4, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 28503, .adv_w = 78, .box_w = 6, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 28551, .adv_w = 200, .box_w = 11, .box_h = 12, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 28617, .adv_w = 213, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 28689, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 28714, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 28744, .adv_w = 71, .box_w = 2, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 28756, .adv_w = 78, .box_w = 5, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 28786, .adv_w = 241, .box_w = 13, .box_h = 9, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 28845, .adv_w = 251, .box_w = 15, .box_h = 9, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 28913, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 28933, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 28957, .adv_w = 134, .box_w = 7, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 28989, .adv_w = 137, .box_w = 8, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 29021, .adv_w = 241, .box_w = 13, .box_h = 6, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 29060, .adv_w = 251, .box_w = 15, .box_h = 6, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 29105, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29125, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29149, .adv_w = 241, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 29201, .adv_w = 251, .box_w = 15, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 29261, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29286, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29316, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 29381, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 29441, .adv_w = 158, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 29491, .adv_w = 165, .box_w = 12, .box_h = 10, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 29551, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 29611, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 29676, .adv_w = 158, .box_w = 10, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29711, .adv_w = 165, .box_w = 12, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29753, .adv_w = 165, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 29823, .adv_w = 165, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 29893, .adv_w = 158, .box_w = 10, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29938, .adv_w = 165, .box_w = 12, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29992, .adv_w = 114, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 30017, .adv_w = 134, .box_w = 9, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 30049, .adv_w = 114, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 30084, .adv_w = 134, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 30129, .adv_w = 124, .box_w = 8, .box_h = 9, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 30165, .adv_w = 141, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 30215, .adv_w = 124, .box_w = 8, .box_h = 12, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 30263, .adv_w = 141, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 30323, .adv_w = 313, .box_w = 18, .box_h = 10, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 30413, .adv_w = 326, .box_w = 20, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 30523, .adv_w = 215, .box_w = 14, .box_h = 6, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 30565, .adv_w = 228, .box_w = 16, .box_h = 6, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 30613, .adv_w = 313, .box_w = 18, .box_h = 14, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 30739, .adv_w = 326, .box_w = 20, .box_h = 14, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 30879, .adv_w = 215, .box_w = 14, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 30942, .adv_w = 228, .box_w = 16, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 31022, .adv_w = 310, .box_w = 18, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 31130, .adv_w = 314, .box_w = 19, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 31244, .adv_w = 217, .box_w = 14, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 31293, .adv_w = 222, .box_w = 16, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 31349, .adv_w = 310, .box_w = 18, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 31457, .adv_w = 314, .box_w = 19, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 31571, .adv_w = 217, .box_w = 14, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 31620, .adv_w = 222, .box_w = 16, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 31676, .adv_w = 237, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 31754, .adv_w = 243, .box_w = 15, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 31844, .adv_w = 204, .box_w = 13, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 31922, .adv_w = 210, .box_w = 15, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32012, .adv_w = 237, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 32090, .adv_w = 243, .box_w = 15, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 32180, .adv_w = 204, .box_w = 13, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32258, .adv_w = 210, .box_w = 15, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32348, .adv_w = 153, .box_w = 10, .box_h = 14, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 32418, .adv_w = 136, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 32478, .adv_w = 153, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32519, .adv_w = 124, .box_w = 9, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32551, .adv_w = 153, .box_w = 10, .box_h = 15, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 32626, .adv_w = 136, .box_w = 10, .box_h = 14, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 32696, .adv_w = 134, .box_w = 9, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32746, .adv_w = 124, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32787, .adv_w = 265, .box_w = 15, .box_h = 12, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 32877, .adv_w = 265, .box_w = 16, .box_h = 10, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 32957, .adv_w = 122, .box_w = 8, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32997, .adv_w = 130, .box_w = 10, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33042, .adv_w = 199, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 33126, .adv_w = 214, .box_w = 14, .box_h = 13, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 33217, .adv_w = 122, .box_w = 8, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33257, .adv_w = 130, .box_w = 10, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33302, .adv_w = 211, .box_w = 11, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 33368, .adv_w = 216, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 33446, .adv_w = 122, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33505, .adv_w = 141, .box_w = 10, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33570, .adv_w = 186, .box_w = 10, .box_h = 15, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 33645, .adv_w = 194, .box_w = 12, .box_h = 15, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 33735, .adv_w = 78, .box_w = 5, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33765, .adv_w = 85, .box_w = 7, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33807, .adv_w = 159, .box_w = 8, .box_h = 10, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 33847, .adv_w = 170, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 33892, .adv_w = 137, .box_w = 9, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33915, .adv_w = 148, .box_w = 11, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33943, .adv_w = 188, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 33998, .adv_w = 195, .box_w = 12, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 34058, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 34078, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 34102, .adv_w = 134, .box_w = 7, .box_h = 7, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 34127, .adv_w = 137, .box_w = 8, .box_h = 6, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 34151, .adv_w = 135, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 34192, .adv_w = 118, .box_w = 9, .box_h = 11, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 34242, .adv_w = 124, .box_w = 8, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 34282, .adv_w = 132, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 34332, .adv_w = 200, .box_w = 11, .box_h = 10, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 34387, .adv_w = 213, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 34439, .adv_w = 200, .box_w = 11, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 34505, .adv_w = 213, .box_w = 13, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 34570, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 34590, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 34614, .adv_w = 146, .box_w = 10, .box_h = 14, .ofs_x = -2, .ofs_y = 0}, - {.bitmap_index = 34684, .adv_w = 153, .box_w = 12, .box_h = 14, .ofs_x = -2, .ofs_y = 0}, - {.bitmap_index = 34768, .adv_w = 146, .box_w = 9, .box_h = 16, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 34840, .adv_w = 153, .box_w = 11, .box_h = 16, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 34928, .adv_w = 146, .box_w = 8, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 34992, .adv_w = 153, .box_w = 10, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 35072, .adv_w = 146, .box_w = 8, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 35120, .adv_w = 153, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 35180, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 18888, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 18986, .adv_w = 256, .box_w = 16, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 19082, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 19178, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 19290, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 19402, .adv_w = 288, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 19510, .adv_w = 256, .box_w = 18, .box_h = 18, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 19672, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 19768, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 19918, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 20018, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 20118, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 20218, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 20318, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 20418, .adv_w = 320, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 20565, .adv_w = 224, .box_w = 12, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 20661, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 20773, .adv_w = 256, .box_w = 17, .box_h = 17, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 20918, .adv_w = 320, .box_w = 20, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 21038, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 21134, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 21228, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 21300, .adv_w = 251, .box_w = 15, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 21375, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 21400, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 21430, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 21502, .adv_w = 251, .box_w = 15, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 21577, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 21602, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 21632, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 21704, .adv_w = 251, .box_w = 15, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 21779, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 21804, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 21834, .adv_w = 241, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 21886, .adv_w = 251, .box_w = 15, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 21946, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 21971, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22001, .adv_w = 241, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 22053, .adv_w = 251, .box_w = 15, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 22113, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22138, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22168, .adv_w = 241, .box_w = 13, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 22233, .adv_w = 251, .box_w = 15, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 22301, .adv_w = 71, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22334, .adv_w = 77, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22367, .adv_w = 265, .box_w = 15, .box_h = 14, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 22472, .adv_w = 265, .box_w = 16, .box_h = 12, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 22568, .adv_w = 122, .box_w = 8, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22616, .adv_w = 130, .box_w = 10, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22671, .adv_w = 265, .box_w = 15, .box_h = 14, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 22776, .adv_w = 265, .box_w = 16, .box_h = 12, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 22872, .adv_w = 122, .box_w = 8, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22920, .adv_w = 130, .box_w = 10, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22975, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 23035, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 23100, .adv_w = 158, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23160, .adv_w = 165, .box_w = 12, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23232, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 23297, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 23357, .adv_w = 158, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 23407, .adv_w = 165, .box_w = 12, .box_h = 10, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 23467, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 23527, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 23587, .adv_w = 158, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23647, .adv_w = 165, .box_w = 12, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23719, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 23779, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 23839, .adv_w = 158, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23899, .adv_w = 165, .box_w = 12, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23971, .adv_w = 114, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 24006, .adv_w = 134, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 24051, .adv_w = 114, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 24086, .adv_w = 134, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 24131, .adv_w = 114, .box_w = 7, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 24173, .adv_w = 134, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 24227, .adv_w = 114, .box_w = 7, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 24269, .adv_w = 134, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 24323, .adv_w = 124, .box_w = 9, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 24386, .adv_w = 141, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 24456, .adv_w = 124, .box_w = 9, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 24528, .adv_w = 141, .box_w = 10, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 24608, .adv_w = 229, .box_w = 14, .box_h = 14, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 24706, .adv_w = 229, .box_w = 15, .box_h = 14, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 24811, .adv_w = 122, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 24870, .adv_w = 141, .box_w = 10, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 24935, .adv_w = 229, .box_w = 14, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 25047, .adv_w = 229, .box_w = 15, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 25167, .adv_w = 122, .box_w = 9, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 25235, .adv_w = 141, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 25310, .adv_w = 229, .box_w = 14, .box_h = 20, .ofs_x = 1, .ofs_y = -6}, + {.bitmap_index = 25450, .adv_w = 229, .box_w = 15, .box_h = 21, .ofs_x = 1, .ofs_y = -6}, + {.bitmap_index = 25608, .adv_w = 122, .box_w = 9, .box_h = 20, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 25698, .adv_w = 141, .box_w = 10, .box_h = 20, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 25798, .adv_w = 229, .box_w = 14, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 25910, .adv_w = 229, .box_w = 15, .box_h = 15, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 26023, .adv_w = 122, .box_w = 9, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26086, .adv_w = 141, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26156, .adv_w = 188, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 26206, .adv_w = 195, .box_w = 12, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 26266, .adv_w = 188, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 26336, .adv_w = 195, .box_w = 12, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 26414, .adv_w = 71, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26447, .adv_w = 77, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26480, .adv_w = 179, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 26525, .adv_w = 162, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 26580, .adv_w = 135, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26621, .adv_w = 118, .box_w = 9, .box_h = 11, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 26671, .adv_w = 211, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 26748, .adv_w = 216, .box_w = 13, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 26839, .adv_w = 122, .box_w = 9, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26907, .adv_w = 141, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26982, .adv_w = 124, .box_w = 8, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27042, .adv_w = 132, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27117, .adv_w = 124, .box_w = 8, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27173, .adv_w = 132, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27243, .adv_w = 124, .box_w = 8, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27307, .adv_w = 132, .box_w = 10, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27387, .adv_w = 124, .box_w = 8, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27443, .adv_w = 132, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27513, .adv_w = 200, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = -7}, + {.bitmap_index = 27590, .adv_w = 213, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = -7}, + {.bitmap_index = 27668, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27693, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27723, .adv_w = 71, .box_w = 5, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 27736, .adv_w = 77, .box_w = 6, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 27751, .adv_w = 200, .box_w = 11, .box_h = 10, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 27806, .adv_w = 213, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 27858, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 27878, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 27902, .adv_w = 75, .box_w = 5, .box_h = 5, .ofs_x = 0, .ofs_y = 9}, + {.bitmap_index = 27915, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 27957, .adv_w = 75, .box_w = 5, .box_h = 5, .ofs_x = 0, .ofs_y = 9}, + {.bitmap_index = 27970, .adv_w = 67, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 27978, .adv_w = 75, .box_w = 5, .box_h = 4, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 27988, .adv_w = 75, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = 9}, + {.bitmap_index = 27996, .adv_w = 75, .box_w = 6, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28032, .adv_w = 75, .box_w = 5, .box_h = 5, .ofs_x = 0, .ofs_y = 9}, + {.bitmap_index = 28045, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28087, .adv_w = 75, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 28095, .adv_w = 75, .box_w = 6, .box_h = 5, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 28110, .adv_w = 75, .box_w = 6, .box_h = 5, .ofs_x = -1, .ofs_y = 10}, + {.bitmap_index = 28125, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28167, .adv_w = 75, .box_w = 5, .box_h = 4, .ofs_x = 0, .ofs_y = 10}, + {.bitmap_index = 28177, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28219, .adv_w = 120, .box_w = 6, .box_h = 8, .ofs_x = 1, .ofs_y = 1}, + {.bitmap_index = 28243, .adv_w = 71, .box_w = 7, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28296, .adv_w = 78, .box_w = 7, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28349, .adv_w = 71, .box_w = 4, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 28383, .adv_w = 78, .box_w = 6, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 28434, .adv_w = 124, .box_w = 8, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 28494, .adv_w = 132, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 28569, .adv_w = 71, .box_w = 4, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 28601, .adv_w = 78, .box_w = 6, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 28649, .adv_w = 200, .box_w = 11, .box_h = 12, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 28715, .adv_w = 213, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 28787, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28812, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28842, .adv_w = 71, .box_w = 2, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 28854, .adv_w = 78, .box_w = 5, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 28884, .adv_w = 241, .box_w = 13, .box_h = 9, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 28943, .adv_w = 251, .box_w = 15, .box_h = 9, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 29011, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 29031, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 29055, .adv_w = 134, .box_w = 7, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 29087, .adv_w = 137, .box_w = 8, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 29119, .adv_w = 241, .box_w = 13, .box_h = 6, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 29158, .adv_w = 251, .box_w = 15, .box_h = 6, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 29203, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 29223, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 29247, .adv_w = 241, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 29299, .adv_w = 251, .box_w = 15, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 29359, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 29384, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 29414, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 29479, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 29539, .adv_w = 158, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 29589, .adv_w = 165, .box_w = 12, .box_h = 10, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 29649, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 29709, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 29774, .adv_w = 158, .box_w = 10, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 29809, .adv_w = 165, .box_w = 12, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 29851, .adv_w = 165, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 29921, .adv_w = 165, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 29991, .adv_w = 158, .box_w = 10, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 30036, .adv_w = 165, .box_w = 12, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 30090, .adv_w = 114, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 30115, .adv_w = 134, .box_w = 9, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 30147, .adv_w = 114, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 30182, .adv_w = 134, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 30227, .adv_w = 124, .box_w = 8, .box_h = 9, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 30263, .adv_w = 141, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 30313, .adv_w = 124, .box_w = 8, .box_h = 12, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 30361, .adv_w = 141, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 30421, .adv_w = 313, .box_w = 18, .box_h = 10, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 30511, .adv_w = 326, .box_w = 20, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 30621, .adv_w = 215, .box_w = 14, .box_h = 6, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 30663, .adv_w = 228, .box_w = 16, .box_h = 6, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 30711, .adv_w = 313, .box_w = 18, .box_h = 14, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 30837, .adv_w = 326, .box_w = 20, .box_h = 14, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 30977, .adv_w = 215, .box_w = 14, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 31040, .adv_w = 228, .box_w = 16, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 31120, .adv_w = 310, .box_w = 18, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 31228, .adv_w = 314, .box_w = 19, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 31342, .adv_w = 217, .box_w = 14, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 31391, .adv_w = 222, .box_w = 16, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 31447, .adv_w = 310, .box_w = 18, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 31555, .adv_w = 314, .box_w = 19, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 31669, .adv_w = 217, .box_w = 14, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 31718, .adv_w = 222, .box_w = 16, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 31774, .adv_w = 237, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 31852, .adv_w = 243, .box_w = 15, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 31942, .adv_w = 204, .box_w = 13, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32020, .adv_w = 210, .box_w = 15, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32110, .adv_w = 237, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 32188, .adv_w = 243, .box_w = 15, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 32278, .adv_w = 204, .box_w = 13, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32356, .adv_w = 210, .box_w = 15, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32446, .adv_w = 153, .box_w = 10, .box_h = 14, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 32516, .adv_w = 136, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 32576, .adv_w = 153, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32617, .adv_w = 124, .box_w = 9, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32649, .adv_w = 153, .box_w = 10, .box_h = 15, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 32724, .adv_w = 136, .box_w = 10, .box_h = 14, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 32794, .adv_w = 134, .box_w = 9, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32844, .adv_w = 124, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32885, .adv_w = 265, .box_w = 15, .box_h = 12, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 32975, .adv_w = 265, .box_w = 16, .box_h = 10, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 33055, .adv_w = 122, .box_w = 8, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33095, .adv_w = 130, .box_w = 10, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33140, .adv_w = 199, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 33224, .adv_w = 214, .box_w = 14, .box_h = 13, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 33315, .adv_w = 122, .box_w = 8, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33355, .adv_w = 130, .box_w = 10, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33400, .adv_w = 211, .box_w = 11, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 33466, .adv_w = 216, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 33544, .adv_w = 122, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33603, .adv_w = 141, .box_w = 10, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33668, .adv_w = 186, .box_w = 10, .box_h = 15, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 33743, .adv_w = 194, .box_w = 12, .box_h = 15, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 33833, .adv_w = 78, .box_w = 5, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33863, .adv_w = 85, .box_w = 7, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33905, .adv_w = 159, .box_w = 8, .box_h = 10, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 33945, .adv_w = 170, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 33990, .adv_w = 137, .box_w = 9, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 34013, .adv_w = 148, .box_w = 11, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 34041, .adv_w = 188, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 34096, .adv_w = 195, .box_w = 12, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 34156, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 34176, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 34200, .adv_w = 134, .box_w = 7, .box_h = 7, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 34225, .adv_w = 137, .box_w = 8, .box_h = 6, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 34249, .adv_w = 135, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 34290, .adv_w = 118, .box_w = 9, .box_h = 11, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 34340, .adv_w = 124, .box_w = 8, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 34380, .adv_w = 132, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 34430, .adv_w = 200, .box_w = 11, .box_h = 10, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 34485, .adv_w = 213, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 34537, .adv_w = 200, .box_w = 11, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 34603, .adv_w = 213, .box_w = 13, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 34668, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 34688, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 34712, .adv_w = 146, .box_w = 10, .box_h = 14, .ofs_x = -2, .ofs_y = 0}, + {.bitmap_index = 34782, .adv_w = 153, .box_w = 12, .box_h = 14, .ofs_x = -2, .ofs_y = 0}, + {.bitmap_index = 34866, .adv_w = 146, .box_w = 9, .box_h = 16, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 34938, .adv_w = 153, .box_w = 11, .box_h = 16, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 35026, .adv_w = 146, .box_w = 8, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 35090, .adv_w = 153, .box_w = 10, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 35170, .adv_w = 146, .box_w = 8, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 35218, .adv_w = 153, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 35278, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -6476,9 +6492,9 @@ static const uint16_t unicode_list_7[] = { 0xe978, 0xe97d, 0xe982, 0xe985, 0xe986, 0xe987, 0xe98b, 0xe98c, 0xe98d, 0xe98e, 0xe9a1, 0xe9a2, 0xe9a8, 0xe9aa, 0xe9ab, 0xe9ae, 0xe9b1, 0xe9b2, 0xe9b3, 0xe9b5, 0xe9cd, 0xe9cf, 0xe9fe, 0xe9ff, - 0xea01, 0xea1a, 0xea21, 0xea24, 0xea2d, 0xea56, 0xea5e, 0xea95, - 0xeb25, 0xeb7a, 0xeb7b, 0xeb7c, 0xeb7d, 0xeb7e, 0xebc1, 0xebcd, - 0xec27, 0xec3e, 0xee94, 0xf0fc, 0xf1dc + 0xea01, 0xea03, 0xea1a, 0xea21, 0xea24, 0xea2d, 0xea56, 0xea5e, + 0xea95, 0xeb25, 0xeb7a, 0xeb7b, 0xeb7c, 0xeb7d, 0xeb7e, 0xebc1, + 0xebcd, 0xec27, 0xec3e, 0xee94, 0xf0fc, 0xf1dc }; static const uint16_t unicode_list_9[] = { @@ -6521,22 +6537,22 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 1734, .range_length = 61917, .glyph_id_start = 270, - .unicode_list = unicode_list_7, .glyph_id_ofs_list = NULL, .list_length = 77, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_7, .glyph_id_ofs_list = NULL, .list_length = 78, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY }, { - .range_start = 64338, .range_length = 82, .glyph_id_start = 347, + .range_start = 64338, .range_length = 82, .glyph_id_start = 348, .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY }, { - .range_start = 64426, .range_length = 715, .glyph_id_start = 429, + .range_start = 64426, .range_length = 715, .glyph_id_start = 430, .unicode_list = unicode_list_9, .glyph_id_ofs_list = NULL, .list_length = 31, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY }, { - .range_start = 65142, .range_length = 135, .glyph_id_start = 460, + .range_start = 65142, .range_length = 135, .glyph_id_start = 461, .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY }, { - .range_start = 65279, .range_length = 1, .glyph_id_start = 595, + .range_start = 65279, .range_length = 1, .glyph_id_start = 596, .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY } }; diff --git a/src/font/lv_font_montserrat_10.c b/src/font/lv_font_montserrat_10.c index 33928bb11..b6a806d5a 100644 --- a/src/font/lv_font_montserrat_10.c +++ b/src/font/lv_font_montserrat_10.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 10 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 10 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_10.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 10 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_10.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -791,6 +791,14 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0x20, 0x9f, 0xf9, 0xff, 0xfc, 0x7f, 0xff, 0x9a, 0xdd, 0xdd, 0xdd, 0xd4, + /* U+F0C9 "" */ + 0x67, 0x77, 0x77, 0x77, 0x4e, 0xff, 0xff, 0xff, + 0xfb, 0x0, 0x0, 0x0, 0x0, 0x6, 0x77, 0x77, + 0x77, 0x74, 0xef, 0xff, 0xff, 0xff, 0xb0, 0x0, + 0x0, 0x0, 0x0, 0x45, 0x55, 0x55, 0x55, 0x3f, + 0xff, 0xff, 0xff, 0xfb, 0x11, 0x11, 0x11, 0x11, + 0x0, + /* U+F0E0 "" */ 0x58, 0x88, 0x88, 0x88, 0x84, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xff, 0xff, 0xff, 0xf6, 0xc5, @@ -1108,26 +1116,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 3376, .adv_w = 140, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 3421, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 3471, .adv_w = 140, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 3516, .adv_w = 160, .box_w = 10, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3556, .adv_w = 100, .box_w = 8, .box_h = 11, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 3600, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3650, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3700, .adv_w = 180, .box_w = 12, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3748, .adv_w = 160, .box_w = 12, .box_h = 11, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 3814, .adv_w = 120, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3858, .adv_w = 200, .box_w = 13, .box_h = 10, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 3923, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3969, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4015, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4061, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4107, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4153, .adv_w = 200, .box_w = 13, .box_h = 9, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 4212, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4262, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4312, .adv_w = 160, .box_w = 11, .box_h = 11, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 4373, .adv_w = 200, .box_w = 13, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4425, .adv_w = 120, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4469, .adv_w = 161, .box_w = 11, .box_h = 7, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 3516, .adv_w = 140, .box_w = 9, .box_h = 9, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 3557, .adv_w = 160, .box_w = 10, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3597, .adv_w = 100, .box_w = 8, .box_h = 11, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 3641, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3691, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3741, .adv_w = 180, .box_w = 12, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3789, .adv_w = 160, .box_w = 12, .box_h = 11, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 3855, .adv_w = 120, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3899, .adv_w = 200, .box_w = 13, .box_h = 10, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 3964, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 4010, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 4056, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 4102, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 4148, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 4194, .adv_w = 200, .box_w = 13, .box_h = 9, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 4253, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4303, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4353, .adv_w = 160, .box_w = 11, .box_h = 11, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 4414, .adv_w = 200, .box_w = 13, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 4466, .adv_w = 120, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4510, .adv_w = 161, .box_w = 11, .box_h = 7, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -1140,9 +1149,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -1154,7 +1163,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -1185,7 +1194,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -1210,7 +1219,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_12.c b/src/font/lv_font_montserrat_12.c index aedca1f87..e3a1ee91c 100644 --- a/src/font/lv_font_montserrat_12.c +++ b/src/font/lv_font_montserrat_12.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 12 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 12 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_12.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 12 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_12.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -1000,6 +1000,16 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0x4f, 0xff, 0xfc, 0xaf, 0xff, 0xf4, 0xaf, 0xff, 0xff, 0xff, 0xfd, 0x10, + /* U+F0C9 "" */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xff, 0xff, + 0xff, 0xff, 0xf7, 0x9a, 0xaa, 0xaa, 0xaa, 0xaa, + 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x89, 0x99, + 0x99, 0x99, 0x99, 0x3f, 0xff, 0xff, 0xff, 0xff, + 0xf7, 0x12, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x9a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x4f, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0xbf, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4e, 0xff, 0xff, 0xff, @@ -1367,26 +1377,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 5020, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 5081, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 5153, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 5214, .adv_w = 192, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5268, .adv_w = 120, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 5327, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 5399, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 5471, .adv_w = 216, .box_w = 14, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5534, .adv_w = 192, .box_w = 14, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 5625, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 5684, .adv_w = 240, .box_w = 15, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 5774, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5842, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5910, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5978, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6046, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6114, .adv_w = 240, .box_w = 16, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 6202, .adv_w = 168, .box_w = 10, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 6267, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 6339, .adv_w = 192, .box_w = 13, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 6424, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6492, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 6551, .adv_w = 193, .box_w = 13, .box_h = 9, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 5214, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 5275, .adv_w = 192, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5329, .adv_w = 120, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 5388, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 5460, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 5532, .adv_w = 216, .box_w = 14, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5595, .adv_w = 192, .box_w = 14, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 5686, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 5745, .adv_w = 240, .box_w = 15, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 5835, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5903, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5971, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6039, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6107, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6175, .adv_w = 240, .box_w = 16, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 6263, .adv_w = 168, .box_w = 10, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 6328, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 6400, .adv_w = 192, .box_w = 13, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 6485, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6553, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 6612, .adv_w = 193, .box_w = 13, .box_h = 9, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -1399,9 +1410,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -1413,7 +1424,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -1444,7 +1455,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -1469,7 +1480,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_12_subpx.c b/src/font/lv_font_montserrat_12_subpx.c index 232699e5e..c9d1d4f9f 100644 --- a/src/font/lv_font_montserrat_12_subpx.c +++ b/src/font/lv_font_montserrat_12_subpx.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 12 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 12 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_12_subpx.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 12 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_12_subpx.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -1000,6 +1000,16 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0x4f, 0xff, 0xfc, 0xaf, 0xff, 0xf4, 0xaf, 0xff, 0xff, 0xff, 0xfd, 0x10, + /* U+F0C9 "" */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xff, 0xff, + 0xff, 0xff, 0xf7, 0x9a, 0xaa, 0xaa, 0xaa, 0xaa, + 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x89, 0x99, + 0x99, 0x99, 0x99, 0x3f, 0xff, 0xff, 0xff, 0xff, + 0xf7, 0x12, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x9a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x4f, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0xbf, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4e, 0xff, 0xff, 0xff, @@ -1367,26 +1377,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 5020, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 5081, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 5153, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 5214, .adv_w = 192, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5268, .adv_w = 120, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 5327, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 5399, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 5471, .adv_w = 216, .box_w = 14, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5534, .adv_w = 192, .box_w = 14, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 5625, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 5684, .adv_w = 240, .box_w = 15, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 5774, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5842, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5910, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5978, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6046, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6114, .adv_w = 240, .box_w = 16, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 6202, .adv_w = 168, .box_w = 10, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 6267, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 6339, .adv_w = 192, .box_w = 13, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 6424, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6492, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 6551, .adv_w = 193, .box_w = 13, .box_h = 9, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 5214, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 5275, .adv_w = 192, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5329, .adv_w = 120, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 5388, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 5460, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 5532, .adv_w = 216, .box_w = 14, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5595, .adv_w = 192, .box_w = 14, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 5686, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 5745, .adv_w = 240, .box_w = 15, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 5835, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5903, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5971, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6039, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6107, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6175, .adv_w = 240, .box_w = 16, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 6263, .adv_w = 168, .box_w = 10, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 6328, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 6400, .adv_w = 192, .box_w = 13, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 6485, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6553, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 6612, .adv_w = 193, .box_w = 13, .box_h = 9, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -1399,9 +1410,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -1413,7 +1424,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -1444,7 +1455,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -1469,7 +1480,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_14.c b/src/font/lv_font_montserrat_14.c index 5deda6ee0..86dd97cdf 100644 --- a/src/font/lv_font_montserrat_14.c +++ b/src/font/lv_font_montserrat_14.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 14 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 14 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_14.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 14 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_14.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -1211,6 +1211,18 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xed, 0xff, 0xff, 0xf6, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x10, + /* U+F0C9 "" */ + 0xcd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0x2f, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xf3, 0x12, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xde, + 0xee, 0xee, 0xee, 0xee, 0xee, 0x20, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0xd, 0xee, 0xee, 0xee, 0xee, 0xee, + 0xe2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x30, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0x37, 0x88, 0x88, 0x88, 0x88, 0x88, 0x73, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xef, 0xff, @@ -1641,26 +1653,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 6614, .adv_w = 196, .box_w = 13, .box_h = 13, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 6699, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 6797, .adv_w = 196, .box_w = 13, .box_h = 13, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 6882, .adv_w = 224, .box_w = 14, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6959, .adv_w = 140, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 7034, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 7132, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 7230, .adv_w = 252, .box_w = 16, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 7318, .adv_w = 224, .box_w = 16, .box_h = 15, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 7438, .adv_w = 168, .box_w = 11, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 7521, .adv_w = 280, .box_w = 18, .box_h = 13, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 7638, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 7728, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 7818, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 7908, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 7998, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 8088, .adv_w = 280, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 8196, .adv_w = 196, .box_w = 12, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 8286, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 8384, .adv_w = 224, .box_w = 15, .box_h = 15, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 8497, .adv_w = 280, .box_w = 18, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 8596, .adv_w = 168, .box_w = 11, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 8679, .adv_w = 225, .box_w = 15, .box_h = 10, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 6882, .adv_w = 196, .box_w = 13, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 6960, .adv_w = 224, .box_w = 14, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 7037, .adv_w = 140, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 7112, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 7210, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 7308, .adv_w = 252, .box_w = 16, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 7396, .adv_w = 224, .box_w = 16, .box_h = 15, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 7516, .adv_w = 168, .box_w = 11, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 7599, .adv_w = 280, .box_w = 18, .box_h = 13, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 7716, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 7806, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 7896, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 7986, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 8076, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 8166, .adv_w = 280, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 8274, .adv_w = 196, .box_w = 12, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 8364, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 8462, .adv_w = 224, .box_w = 15, .box_h = 15, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 8575, .adv_w = 280, .box_w = 18, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 8674, .adv_w = 168, .box_w = 11, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 8757, .adv_w = 225, .box_w = 15, .box_h = 10, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -1673,9 +1686,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -1687,7 +1700,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -1718,7 +1731,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -1743,7 +1756,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_16.c b/src/font/lv_font_montserrat_16.c index 860528da3..b1dde1745 100644 --- a/src/font/lv_font_montserrat_16.c +++ b/src/font/lv_font_montserrat_16.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 16 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 16 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_16.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 16 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_16.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -1437,6 +1437,21 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + /* U+F0C9 "" */ + 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x12, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x21, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x12, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x21, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x21, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x12, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x21, + /* U+F0E0 "" */ 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -1907,26 +1922,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 8435, .adv_w = 224, .box_w = 15, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 8540, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 8652, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 8750, .adv_w = 256, .box_w = 16, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 8846, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 8942, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 9054, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 9166, .adv_w = 288, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 9274, .adv_w = 256, .box_w = 18, .box_h = 18, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 9436, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 9532, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 9682, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 9782, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 9882, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 9982, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 10082, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 10182, .adv_w = 320, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 10329, .adv_w = 224, .box_w = 12, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 10425, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 10537, .adv_w = 256, .box_w = 17, .box_h = 17, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 10682, .adv_w = 320, .box_w = 20, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 10802, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 10898, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 8750, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 8848, .adv_w = 256, .box_w = 16, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 8944, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 9040, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 9152, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 9264, .adv_w = 288, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 9372, .adv_w = 256, .box_w = 18, .box_h = 18, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 9534, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 9630, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 9780, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 9880, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 9980, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 10080, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 10180, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 10280, .adv_w = 320, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 10427, .adv_w = 224, .box_w = 12, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 10523, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 10635, .adv_w = 256, .box_w = 17, .box_h = 17, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 10780, .adv_w = 320, .box_w = 20, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 10900, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 10996, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -1939,9 +1955,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -1953,7 +1969,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -1984,7 +2000,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -2009,7 +2025,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_18.c b/src/font/lv_font_montserrat_18.c index 0f08f8875..1583b97fb 100644 --- a/src/font/lv_font_montserrat_18.c +++ b/src/font/lv_font_montserrat_18.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 18 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 18 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_18.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 18 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_18.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -1740,6 +1740,23 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x1, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0x0, + /* U+F0C9 "" */ + 0x79, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x95, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, + 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, + 0x68, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x84, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, + 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0x3, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x30, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -2305,26 +2322,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 10691, .adv_w = 252, .box_w = 16, .box_h = 17, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 10827, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 10979, .adv_w = 252, .box_w = 16, .box_h = 17, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 11115, .adv_w = 288, .box_w = 18, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 11241, .adv_w = 180, .box_w = 13, .box_h = 19, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 11365, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 11517, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 11669, .adv_w = 324, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 11816, .adv_w = 288, .box_w = 20, .box_h = 20, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 12016, .adv_w = 216, .box_w = 14, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 12149, .adv_w = 360, .box_w = 23, .box_h = 18, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 12356, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 12494, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 12632, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 12770, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 12908, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 13046, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 13219, .adv_w = 252, .box_w = 14, .box_h = 19, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 13352, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 13504, .adv_w = 288, .box_w = 19, .box_h = 19, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 13685, .adv_w = 360, .box_w = 23, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 13846, .adv_w = 216, .box_w = 14, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 13979, .adv_w = 290, .box_w = 19, .box_h = 12, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 11115, .adv_w = 252, .box_w = 16, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 11235, .adv_w = 288, .box_w = 18, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 11361, .adv_w = 180, .box_w = 13, .box_h = 19, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 11485, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 11637, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 11789, .adv_w = 324, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 11936, .adv_w = 288, .box_w = 20, .box_h = 20, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 12136, .adv_w = 216, .box_w = 14, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 12269, .adv_w = 360, .box_w = 23, .box_h = 18, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 12476, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 12614, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 12752, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 12890, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 13028, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 13166, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 13339, .adv_w = 252, .box_w = 14, .box_h = 19, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 13472, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 13624, .adv_w = 288, .box_w = 19, .box_h = 19, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 13805, .adv_w = 360, .box_w = 23, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 13966, .adv_w = 216, .box_w = 14, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 14099, .adv_w = 290, .box_w = 19, .box_h = 12, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -2337,9 +2355,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -2351,7 +2369,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -2382,7 +2400,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -2407,7 +2425,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_20.c b/src/font/lv_font_montserrat_20.c index 61e884e52..ee916d99d 100644 --- a/src/font/lv_font_montserrat_20.c +++ b/src/font/lv_font_montserrat_20.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 20 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 20 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_20.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 20 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_20.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -2018,6 +2018,28 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xa0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0C9 "" */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf8, 0xac, 0xcc, 0xcc, 0xcc, 0xcc, + 0xcc, 0xcc, 0xcc, 0xc4, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xd5, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf8, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0xac, 0xcc, 0xcc, + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xc4, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xef, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf6, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, + /* U+F0E0 "" */ 0x5e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe5, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -2657,26 +2679,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 12730, .adv_w = 280, .box_w = 18, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 12901, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 13090, .adv_w = 280, .box_w = 18, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 13261, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 13411, .adv_w = 200, .box_w = 14, .box_h = 21, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 13558, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 13747, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 13936, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 14109, .adv_w = 320, .box_w = 22, .box_h = 21, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 14340, .adv_w = 240, .box_w = 15, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 14498, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 14736, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 14899, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 15062, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 15225, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 15388, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 15551, .adv_w = 400, .box_w = 26, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 15772, .adv_w = 280, .box_w = 16, .box_h = 21, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 15940, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 16129, .adv_w = 320, .box_w = 21, .box_h = 21, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 16350, .adv_w = 400, .box_w = 25, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 16538, .adv_w = 240, .box_w = 15, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 16696, .adv_w = 322, .box_w = 21, .box_h = 13, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 13261, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 13414, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 13564, .adv_w = 200, .box_w = 14, .box_h = 21, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 13711, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 13900, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 14089, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 14262, .adv_w = 320, .box_w = 22, .box_h = 21, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 14493, .adv_w = 240, .box_w = 15, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 14651, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 14889, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15052, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15215, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15378, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15541, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15704, .adv_w = 400, .box_w = 26, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 15925, .adv_w = 280, .box_w = 16, .box_h = 21, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 16093, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 16282, .adv_w = 320, .box_w = 21, .box_h = 21, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 16503, .adv_w = 400, .box_w = 25, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 16691, .adv_w = 240, .box_w = 15, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 16849, .adv_w = 322, .box_w = 21, .box_h = 13, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -2689,9 +2712,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -2703,7 +2726,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -2734,7 +2757,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -2759,7 +2782,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_22.c b/src/font/lv_font_montserrat_22.c index a28eb8381..cee57dce3 100644 --- a/src/font/lv_font_montserrat_22.c +++ b/src/font/lv_font_montserrat_22.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 22 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 22 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_22.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 22 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_22.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -2340,6 +2340,31 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xb0, 0x0, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0x0, + /* U+F0C9 "" */ + 0xce, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, + 0xee, 0xd1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x13, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x20, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdf, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe2, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xf3, 0x12, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x10, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0xdf, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xe2, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf3, 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x10, + /* U+F0E0 "" */ 0x2, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x20, 0x7f, 0xff, 0xff, 0xff, 0xff, @@ -3083,26 +3108,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 15442, .adv_w = 308, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 15642, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 15872, .adv_w = 308, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 16072, .adv_w = 352, .box_w = 22, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 16259, .adv_w = 220, .box_w = 15, .box_h = 23, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 16432, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 16662, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 16892, .adv_w = 396, .box_w = 25, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 17105, .adv_w = 352, .box_w = 24, .box_h = 23, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 17381, .adv_w = 264, .box_w = 17, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 17577, .adv_w = 440, .box_w = 28, .box_h = 21, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 17871, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 18081, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 18291, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 18501, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 18711, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 18921, .adv_w = 440, .box_w = 28, .box_h = 18, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 19173, .adv_w = 308, .box_w = 17, .box_h = 23, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 19369, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 19599, .adv_w = 352, .box_w = 23, .box_h = 23, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 19864, .adv_w = 440, .box_w = 28, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 20102, .adv_w = 264, .box_w = 17, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 20298, .adv_w = 354, .box_w = 23, .box_h = 14, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 16072, .adv_w = 308, .box_w = 20, .box_h = 18, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 16252, .adv_w = 352, .box_w = 22, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 16439, .adv_w = 220, .box_w = 15, .box_h = 23, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 16612, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 16842, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 17072, .adv_w = 396, .box_w = 25, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 17285, .adv_w = 352, .box_w = 24, .box_h = 23, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 17561, .adv_w = 264, .box_w = 17, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 17757, .adv_w = 440, .box_w = 28, .box_h = 21, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 18051, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 18261, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 18471, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 18681, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 18891, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 19101, .adv_w = 440, .box_w = 28, .box_h = 18, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 19353, .adv_w = 308, .box_w = 17, .box_h = 23, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 19549, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 19779, .adv_w = 352, .box_w = 23, .box_h = 23, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 20044, .adv_w = 440, .box_w = 28, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 20282, .adv_w = 264, .box_w = 17, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 20478, .adv_w = 354, .box_w = 23, .box_h = 14, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -3115,9 +3141,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -3129,7 +3155,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -3160,7 +3186,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -3185,7 +3211,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_24.c b/src/font/lv_font_montserrat_24.c index b6667d38e..44ecf1757 100644 --- a/src/font/lv_font_montserrat_24.c +++ b/src/font/lv_font_montserrat_24.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 24 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 24 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_24.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 24 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_24.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -2668,6 +2668,35 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xb1, 0x8b, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0x81, + /* U+F0C9 "" */ + 0x13, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfe, 0x13, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x10, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x57, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x5f, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xfc, 0xee, 0xee, 0xee, 0xee, + 0xee, 0xee, 0xee, 0xee, 0xee, 0xeb, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x31, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe1, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x31, + /* U+F0E0 "" */ 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd3, 0xdf, 0xff, 0xff, 0xff, @@ -3490,26 +3519,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 17894, .adv_w = 336, .box_w = 22, .box_h = 22, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 18136, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 18388, .adv_w = 336, .box_w = 21, .box_h = 22, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 18619, .adv_w = 384, .box_w = 24, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 18835, .adv_w = 240, .box_w = 17, .box_h = 24, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 19039, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 19291, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 19543, .adv_w = 432, .box_w = 27, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 19786, .adv_w = 384, .box_w = 26, .box_h = 26, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 20124, .adv_w = 288, .box_w = 18, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 20340, .adv_w = 480, .box_w = 30, .box_h = 23, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 20685, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 20925, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 21165, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 21405, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 21645, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 21885, .adv_w = 480, .box_w = 31, .box_h = 20, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 22195, .adv_w = 336, .box_w = 19, .box_h = 24, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 22423, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 22675, .adv_w = 384, .box_w = 25, .box_h = 25, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 22988, .adv_w = 480, .box_w = 30, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 23258, .adv_w = 288, .box_w = 18, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 23474, .adv_w = 386, .box_w = 25, .box_h = 16, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 18619, .adv_w = 336, .box_w = 21, .box_h = 20, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 18829, .adv_w = 384, .box_w = 24, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 19045, .adv_w = 240, .box_w = 17, .box_h = 24, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 19249, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 19501, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 19753, .adv_w = 432, .box_w = 27, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 19996, .adv_w = 384, .box_w = 26, .box_h = 26, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 20334, .adv_w = 288, .box_w = 18, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 20550, .adv_w = 480, .box_w = 30, .box_h = 23, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 20895, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 21135, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 21375, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 21615, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 21855, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 22095, .adv_w = 480, .box_w = 31, .box_h = 20, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 22405, .adv_w = 336, .box_w = 19, .box_h = 24, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 22633, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 22885, .adv_w = 384, .box_w = 25, .box_h = 25, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23198, .adv_w = 480, .box_w = 30, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 23468, .adv_w = 288, .box_w = 18, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 23684, .adv_w = 386, .box_w = 25, .box_h = 16, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -3522,9 +3552,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -3536,7 +3566,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -3567,7 +3597,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -3592,7 +3622,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_26.c b/src/font/lv_font_montserrat_26.c index b61124274..b08e87769 100644 --- a/src/font/lv_font_montserrat_26.c +++ b/src/font/lv_font_montserrat_26.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 26 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 26 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_26.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 26 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_26.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -3072,6 +3072,39 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x41, 0x9d, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdc, 0x60, + /* U+F0C9 "" */ + 0x8b, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xbb, 0xbb, 0x5f, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x69, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x4f, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcd, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x69, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x4f, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xcd, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, + /* U+F0E0 "" */ 0x1, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x10, 0x4f, 0xff, 0xff, @@ -4021,26 +4054,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 20933, .adv_w = 364, .box_w = 24, .box_h = 24, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 21221, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, {.bitmap_index = 21532, .adv_w = 364, .box_w = 23, .box_h = 24, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 21808, .adv_w = 416, .box_w = 26, .box_h = 20, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 22068, .adv_w = 260, .box_w = 18, .box_h = 27, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 22311, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 22622, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 22933, .adv_w = 468, .box_w = 30, .box_h = 20, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 23233, .adv_w = 416, .box_w = 28, .box_h = 28, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23625, .adv_w = 312, .box_w = 20, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 23895, .adv_w = 520, .box_w = 33, .box_h = 24, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 24291, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 24572, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 24853, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 25134, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 25415, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 25696, .adv_w = 520, .box_w = 33, .box_h = 21, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 26043, .adv_w = 364, .box_w = 21, .box_h = 27, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 26327, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 26638, .adv_w = 416, .box_w = 27, .box_h = 27, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 27003, .adv_w = 520, .box_w = 33, .box_h = 20, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 27333, .adv_w = 312, .box_w = 20, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 27603, .adv_w = 418, .box_w = 27, .box_h = 18, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 21808, .adv_w = 364, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 22050, .adv_w = 416, .box_w = 26, .box_h = 20, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 22310, .adv_w = 260, .box_w = 18, .box_h = 27, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 22553, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 22864, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 23175, .adv_w = 468, .box_w = 30, .box_h = 20, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 23475, .adv_w = 416, .box_w = 28, .box_h = 28, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23867, .adv_w = 312, .box_w = 20, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 24137, .adv_w = 520, .box_w = 33, .box_h = 24, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 24533, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 24814, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 25095, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 25376, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 25657, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 25938, .adv_w = 520, .box_w = 33, .box_h = 21, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 26285, .adv_w = 364, .box_w = 21, .box_h = 27, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 26569, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 26880, .adv_w = 416, .box_w = 27, .box_h = 27, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 27245, .adv_w = 520, .box_w = 33, .box_h = 20, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 27575, .adv_w = 312, .box_w = 20, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 27845, .adv_w = 418, .box_w = 27, .box_h = 18, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -4053,9 +4087,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -4067,7 +4101,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -4098,7 +4132,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -4123,7 +4157,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_28.c b/src/font/lv_font_montserrat_28.c index d981e0b8d..a5fed0853 100644 --- a/src/font/lv_font_montserrat_28.c +++ b/src/font/lv_font_montserrat_28.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 28 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 28 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_28.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 28 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_28.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -3503,6 +3503,44 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x0, + /* U+F0C9 "" */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0xd, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf8, 0xae, 0xee, 0xee, 0xee, 0xee, 0xee, + 0xee, 0xee, 0xee, 0xee, 0xee, 0xed, 0x40, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x7, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xbb, 0xbb, 0xbb, 0xa2, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xef, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x61, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x30, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0xae, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, + 0xee, 0xee, 0xee, 0xee, 0xed, 0x4f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8d, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf5, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0x1b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb1, 0xbf, 0xff, @@ -4565,26 +4603,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 24249, .adv_w = 392, .box_w = 25, .box_h = 25, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 24562, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, {.bitmap_index = 24925, .adv_w = 392, .box_w = 25, .box_h = 25, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 25238, .adv_w = 448, .box_w = 28, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 25532, .adv_w = 280, .box_w = 19, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 25808, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 26171, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 26534, .adv_w = 504, .box_w = 32, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 26870, .adv_w = 448, .box_w = 30, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 27305, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 27610, .adv_w = 560, .box_w = 35, .box_h = 26, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 28065, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 28398, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 28731, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 29064, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 29397, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 29730, .adv_w = 560, .box_w = 36, .box_h = 23, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 30144, .adv_w = 392, .box_w = 22, .box_h = 29, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 30463, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 30826, .adv_w = 448, .box_w = 29, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 31247, .adv_w = 560, .box_w = 35, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 31615, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 31920, .adv_w = 451, .box_w = 29, .box_h = 19, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 25238, .adv_w = 392, .box_w = 25, .box_h = 23, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 25526, .adv_w = 448, .box_w = 28, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 25820, .adv_w = 280, .box_w = 19, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 26096, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 26459, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 26822, .adv_w = 504, .box_w = 32, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 27158, .adv_w = 448, .box_w = 30, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 27593, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 27898, .adv_w = 560, .box_w = 35, .box_h = 26, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 28353, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 28686, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 29019, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 29352, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 29685, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 30018, .adv_w = 560, .box_w = 36, .box_h = 23, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 30432, .adv_w = 392, .box_w = 22, .box_h = 29, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 30751, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 31114, .adv_w = 448, .box_w = 29, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 31535, .adv_w = 560, .box_w = 35, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 31903, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 32208, .adv_w = 451, .box_w = 29, .box_h = 19, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -4597,9 +4636,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -4611,7 +4650,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -4642,7 +4681,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -4667,7 +4706,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_28_compressed.c b/src/font/lv_font_montserrat_28_compressed.c index be54f644c..82c43679a 100644 --- a/src/font/lv_font_montserrat_28_compressed.c +++ b/src/font/lv_font_montserrat_28_compressed.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 28 px * Bpp: 4 - * Opts: --bpp 4 --size 28 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_28_compressed.c --force-fast-kern-format + * Opts: --bpp 4 --size 28 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_28_compressed.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -2155,6 +2155,18 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xf3, 0xa8, 0x7, 0xff, 0x28, 0x4e, 0xd4, 0x40, 0x3f, 0xf8, 0xe7, 0xa0, + /* U+F0C9 "" */ + 0x0, 0xff, 0xe6, 0xef, 0xff, 0xff, 0x2d, 0x48, + 0x3, 0xff, 0x97, 0xa0, 0x1f, 0xfc, 0xd5, 0x11, + 0xff, 0xe5, 0x16, 0x57, 0x77, 0xff, 0x2b, 0x50, + 0x3, 0xff, 0xfe, 0xf7, 0x7f, 0xfc, 0xaa, 0x28, + 0x44, 0xff, 0xe5, 0x2a, 0x80, 0x3f, 0xf9, 0x9e, + 0x20, 0x1f, 0xfc, 0xbe, 0xfb, 0xbf, 0xfe, 0x56, + 0x30, 0xa2, 0x7f, 0xf2, 0x8c, 0x3, 0xff, 0xfe, + 0x15, 0xdd, 0xff, 0xca, 0xd4, 0x51, 0x1f, 0xfe, + 0x51, 0x60, 0x7, 0xff, 0x34, 0x80, 0x3f, 0xf9, + 0x7b, 0xaf, 0xff, 0xfe, 0x5a, 0x80, + /* U+F0E0 "" */ 0x1b, 0xff, 0xff, 0xe6, 0x58, 0xd2, 0x0, 0x7f, 0xf3, 0x12, 0x90, 0x3, 0xff, 0x9c, 0x80, 0x1f, @@ -2721,26 +2733,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 13945, .adv_w = 392, .box_w = 25, .box_h = 25, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 14184, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, {.bitmap_index = 14291, .adv_w = 392, .box_w = 25, .box_h = 25, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 14423, .adv_w = 448, .box_w = 28, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 14556, .adv_w = 280, .box_w = 19, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 14713, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 14840, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 15006, .adv_w = 504, .box_w = 32, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 15203, .adv_w = 448, .box_w = 30, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 15385, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 15459, .adv_w = 560, .box_w = 35, .box_h = 26, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 15716, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 15817, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 15919, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 16020, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 16120, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 16211, .adv_w = 560, .box_w = 36, .box_h = 23, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 16422, .adv_w = 392, .box_w = 22, .box_h = 29, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 16665, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 16785, .adv_w = 448, .box_w = 29, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 17012, .adv_w = 560, .box_w = 35, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 17213, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 17309, .adv_w = 451, .box_w = 29, .box_h = 19, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 14423, .adv_w = 392, .box_w = 25, .box_h = 23, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 14501, .adv_w = 448, .box_w = 28, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 14634, .adv_w = 280, .box_w = 19, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 14791, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 14918, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 15084, .adv_w = 504, .box_w = 32, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 15281, .adv_w = 448, .box_w = 30, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 15463, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 15537, .adv_w = 560, .box_w = 35, .box_h = 26, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 15794, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15895, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15997, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 16098, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 16198, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 16289, .adv_w = 560, .box_w = 36, .box_h = 23, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 16500, .adv_w = 392, .box_w = 22, .box_h = 29, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 16743, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 16863, .adv_w = 448, .box_w = 29, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 17090, .adv_w = 560, .box_w = 35, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 17291, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 17387, .adv_w = 451, .box_w = 29, .box_h = 19, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -2753,9 +2766,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -2767,7 +2780,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -2798,7 +2811,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -2823,7 +2836,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_30.c b/src/font/lv_font_montserrat_30.c index fd605ad6b..22f736a64 100644 --- a/src/font/lv_font_montserrat_30.c +++ b/src/font/lv_font_montserrat_30.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 30 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 30 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_30.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 30 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_30.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -3949,6 +3949,49 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x0, + /* U+F0C9 "" */ + 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x4f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x24, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x43, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x2, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x30, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4c, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xe1, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x4f, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf4, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x21, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x20, + /* U+F0E0 "" */ 0x0, 0x34, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x43, 0x0, 0x2d, @@ -5142,26 +5185,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 27677, .adv_w = 420, .box_w = 27, .box_h = 27, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 28042, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, {.bitmap_index = 28461, .adv_w = 420, .box_w = 27, .box_h = 27, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 28826, .adv_w = 480, .box_w = 30, .box_h = 23, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 29171, .adv_w = 300, .box_w = 20, .box_h = 31, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 29481, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 29900, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 30319, .adv_w = 540, .box_w = 34, .box_h = 23, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 30710, .adv_w = 480, .box_w = 32, .box_h = 31, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 31206, .adv_w = 360, .box_w = 23, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 31563, .adv_w = 600, .box_w = 38, .box_h = 28, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 32095, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 32475, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 32855, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 33235, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 33615, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 33995, .adv_w = 600, .box_w = 38, .box_h = 24, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 34451, .adv_w = 420, .box_w = 24, .box_h = 31, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 34823, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 35242, .adv_w = 480, .box_w = 31, .box_h = 31, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 35723, .adv_w = 600, .box_w = 38, .box_h = 23, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 36160, .adv_w = 360, .box_w = 23, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 36517, .adv_w = 483, .box_w = 31, .box_h = 20, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 28826, .adv_w = 420, .box_w = 27, .box_h = 24, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 29150, .adv_w = 480, .box_w = 30, .box_h = 23, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 29495, .adv_w = 300, .box_w = 20, .box_h = 31, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 29805, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 30224, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 30643, .adv_w = 540, .box_w = 34, .box_h = 23, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 31034, .adv_w = 480, .box_w = 32, .box_h = 31, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 31530, .adv_w = 360, .box_w = 23, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 31887, .adv_w = 600, .box_w = 38, .box_h = 28, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 32419, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 32799, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 33179, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 33559, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 33939, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 34319, .adv_w = 600, .box_w = 38, .box_h = 24, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 34775, .adv_w = 420, .box_w = 24, .box_h = 31, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 35147, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 35566, .adv_w = 480, .box_w = 31, .box_h = 31, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 36047, .adv_w = 600, .box_w = 38, .box_h = 23, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 36484, .adv_w = 360, .box_w = 23, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 36841, .adv_w = 483, .box_w = 31, .box_h = 20, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -5174,9 +5218,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -5188,7 +5232,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -5219,7 +5263,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -5244,7 +5288,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_32.c b/src/font/lv_font_montserrat_32.c index 2042edb63..3c2fbb59c 100644 --- a/src/font/lv_font_montserrat_32.c +++ b/src/font/lv_font_montserrat_32.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 32 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 32 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_32.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 32 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_32.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -4348,6 +4348,54 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xf8, 0x8, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x80, + /* U+F0C9 "" */ + 0x47, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x47, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x77, 0x74, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x47, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0x8, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x80, @@ -5626,26 +5674,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 30759, .adv_w = 448, .box_w = 29, .box_h = 28, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 31165, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, {.bitmap_index = 31613, .adv_w = 448, .box_w = 28, .box_h = 28, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 32005, .adv_w = 512, .box_w = 32, .box_h = 24, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 32389, .adv_w = 320, .box_w = 22, .box_h = 32, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 32741, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 33189, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 33637, .adv_w = 576, .box_w = 36, .box_h = 24, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 34069, .adv_w = 512, .box_w = 34, .box_h = 34, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 34647, .adv_w = 384, .box_w = 24, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 35031, .adv_w = 640, .box_w = 40, .box_h = 29, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 35611, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 36011, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 36411, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 36811, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 37211, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 37611, .adv_w = 640, .box_w = 41, .box_h = 26, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 38144, .adv_w = 448, .box_w = 24, .box_h = 32, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 38528, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 38976, .adv_w = 512, .box_w = 33, .box_h = 33, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 39521, .adv_w = 640, .box_w = 40, .box_h = 24, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 40001, .adv_w = 384, .box_w = 24, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 40385, .adv_w = 515, .box_w = 33, .box_h = 21, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 32005, .adv_w = 448, .box_w = 28, .box_h = 26, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 32369, .adv_w = 512, .box_w = 32, .box_h = 24, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 32753, .adv_w = 320, .box_w = 22, .box_h = 32, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 33105, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 33553, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 34001, .adv_w = 576, .box_w = 36, .box_h = 24, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 34433, .adv_w = 512, .box_w = 34, .box_h = 34, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 35011, .adv_w = 384, .box_w = 24, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 35395, .adv_w = 640, .box_w = 40, .box_h = 29, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 35975, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 36375, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 36775, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 37175, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 37575, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 37975, .adv_w = 640, .box_w = 41, .box_h = 26, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 38508, .adv_w = 448, .box_w = 24, .box_h = 32, .ofs_x = 2, .ofs_y = -4}, + {.bitmap_index = 38892, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 39340, .adv_w = 512, .box_w = 33, .box_h = 33, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 39885, .adv_w = 640, .box_w = 40, .box_h = 24, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 40365, .adv_w = 384, .box_w = 24, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 40749, .adv_w = 515, .box_w = 33, .box_h = 21, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -5658,9 +5707,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -5672,7 +5721,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -5703,7 +5752,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -5728,7 +5777,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_34.c b/src/font/lv_font_montserrat_34.c index 1ece618be..a583b199c 100644 --- a/src/font/lv_font_montserrat_34.c +++ b/src/font/lv_font_montserrat_34.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 34 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 34 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_34.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 34 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_34.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -4960,6 +4960,59 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x10, 0x0, + /* U+F0C9 "" */ + 0x8c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xc5, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xfb, 0xcf, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0xcf, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xfb, 0x7b, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xb5, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x7b, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xb5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xcf, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0x0, 0x24, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x42, @@ -6420,26 +6473,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 35465, .adv_w = 476, .box_w = 31, .box_h = 31, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 35946, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, {.bitmap_index = 36471, .adv_w = 476, .box_w = 30, .box_h = 31, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 36936, .adv_w = 544, .box_w = 34, .box_h = 26, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 37378, .adv_w = 340, .box_w = 23, .box_h = 35, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 37781, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 38306, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 38831, .adv_w = 612, .box_w = 39, .box_h = 26, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 39338, .adv_w = 544, .box_w = 36, .box_h = 36, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 39986, .adv_w = 408, .box_w = 26, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 40441, .adv_w = 680, .box_w = 43, .box_h = 32, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 41129, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 41602, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 42075, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 42548, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 43021, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 43494, .adv_w = 680, .box_w = 43, .box_h = 27, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 44075, .adv_w = 476, .box_w = 26, .box_h = 35, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 44530, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 45055, .adv_w = 544, .box_w = 35, .box_h = 35, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 45668, .adv_w = 680, .box_w = 43, .box_h = 26, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 46227, .adv_w = 408, .box_w = 26, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 46682, .adv_w = 547, .box_w = 35, .box_h = 22, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 36936, .adv_w = 476, .box_w = 30, .box_h = 27, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 37341, .adv_w = 544, .box_w = 34, .box_h = 26, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 37783, .adv_w = 340, .box_w = 23, .box_h = 35, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 38186, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 38711, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 39236, .adv_w = 612, .box_w = 39, .box_h = 26, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 39743, .adv_w = 544, .box_w = 36, .box_h = 36, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 40391, .adv_w = 408, .box_w = 26, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 40846, .adv_w = 680, .box_w = 43, .box_h = 32, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 41534, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 42007, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 42480, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 42953, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 43426, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 43899, .adv_w = 680, .box_w = 43, .box_h = 27, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 44480, .adv_w = 476, .box_w = 26, .box_h = 35, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 44935, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 45460, .adv_w = 544, .box_w = 35, .box_h = 35, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 46073, .adv_w = 680, .box_w = 43, .box_h = 26, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 46632, .adv_w = 408, .box_w = 26, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 47087, .adv_w = 547, .box_w = 35, .box_h = 22, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -6452,9 +6506,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -6466,7 +6520,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -6497,7 +6551,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -6522,7 +6576,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_36.c b/src/font/lv_font_montserrat_36.c index b60e0c1cb..750ddd5f2 100644 --- a/src/font/lv_font_montserrat_36.c +++ b/src/font/lv_font_montserrat_36.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 36 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 36 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_36.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 36 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_36.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -5461,6 +5461,66 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0C9 "" */ + 0x1, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, + 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5, + 0x1, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, + /* U+F0E0 "" */ 0x5, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -7057,26 +7117,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 39236, .adv_w = 504, .box_w = 32, .box_h = 33, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 39764, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, {.bitmap_index = 40356, .adv_w = 504, .box_w = 32, .box_h = 33, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 40884, .adv_w = 576, .box_w = 36, .box_h = 27, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 41370, .adv_w = 360, .box_w = 24, .box_h = 37, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 41814, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 42406, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 42998, .adv_w = 648, .box_w = 41, .box_h = 27, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 43552, .adv_w = 576, .box_w = 38, .box_h = 38, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 44274, .adv_w = 432, .box_w = 27, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 44774, .adv_w = 720, .box_w = 45, .box_h = 34, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 45539, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 46057, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 46575, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 47093, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 47611, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 48129, .adv_w = 720, .box_w = 46, .box_h = 29, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 48796, .adv_w = 504, .box_w = 28, .box_h = 37, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 49314, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 49906, .adv_w = 576, .box_w = 37, .box_h = 37, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 50591, .adv_w = 720, .box_w = 45, .box_h = 27, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 51199, .adv_w = 432, .box_w = 27, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 51699, .adv_w = 579, .box_w = 37, .box_h = 23, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 40884, .adv_w = 504, .box_w = 32, .box_h = 29, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 41348, .adv_w = 576, .box_w = 36, .box_h = 27, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 41834, .adv_w = 360, .box_w = 24, .box_h = 37, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 42278, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 42870, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 43462, .adv_w = 648, .box_w = 41, .box_h = 27, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 44016, .adv_w = 576, .box_w = 38, .box_h = 38, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 44738, .adv_w = 432, .box_w = 27, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 45238, .adv_w = 720, .box_w = 45, .box_h = 34, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 46003, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 46521, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 47039, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 47557, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 48075, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 48593, .adv_w = 720, .box_w = 46, .box_h = 29, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 49260, .adv_w = 504, .box_w = 28, .box_h = 37, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 49778, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 50370, .adv_w = 576, .box_w = 37, .box_h = 37, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 51055, .adv_w = 720, .box_w = 45, .box_h = 27, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 51663, .adv_w = 432, .box_w = 27, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 52163, .adv_w = 579, .box_w = 37, .box_h = 23, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -7089,9 +7150,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -7103,7 +7164,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -7134,7 +7195,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -7159,7 +7220,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_38.c b/src/font/lv_font_montserrat_38.c index bb9f2db79..1ecfe953b 100644 --- a/src/font/lv_font_montserrat_38.c +++ b/src/font/lv_font_montserrat_38.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 38 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 38 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_38.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 38 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_38.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -6024,6 +6024,72 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x10, 0x0, + /* U+F0C9 "" */ + 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xd1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xf4, 0xef, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xf2, 0x26, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x40, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0xaf, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xd1, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, + 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf2, 0x26, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xf4, 0xef, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xf2, 0x14, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x20, + /* U+F0E0 "" */ 0x0, 0x14, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, @@ -7796,26 +7862,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 43535, .adv_w = 532, .box_w = 34, .box_h = 34, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 44113, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, {.bitmap_index = 44776, .adv_w = 532, .box_w = 34, .box_h = 34, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 45354, .adv_w = 608, .box_w = 38, .box_h = 29, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 45905, .adv_w = 380, .box_w = 26, .box_h = 39, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 46412, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 47075, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 47738, .adv_w = 684, .box_w = 43, .box_h = 29, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 48362, .adv_w = 608, .box_w = 40, .box_h = 39, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 49142, .adv_w = 456, .box_w = 29, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 49708, .adv_w = 760, .box_w = 48, .box_h = 35, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 50548, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 51148, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 51748, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 52348, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 52948, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 53548, .adv_w = 760, .box_w = 48, .box_h = 30, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 54268, .adv_w = 532, .box_w = 30, .box_h = 39, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 54853, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 55516, .adv_w = 608, .box_w = 39, .box_h = 39, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 56277, .adv_w = 760, .box_w = 48, .box_h = 29, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 56973, .adv_w = 456, .box_w = 29, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 57539, .adv_w = 612, .box_w = 39, .box_h = 25, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 45354, .adv_w = 532, .box_w = 34, .box_h = 30, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 45864, .adv_w = 608, .box_w = 38, .box_h = 29, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 46415, .adv_w = 380, .box_w = 26, .box_h = 39, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 46922, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 47585, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 48248, .adv_w = 684, .box_w = 43, .box_h = 29, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 48872, .adv_w = 608, .box_w = 40, .box_h = 39, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 49652, .adv_w = 456, .box_w = 29, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 50218, .adv_w = 760, .box_w = 48, .box_h = 35, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 51058, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 51658, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 52258, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 52858, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 53458, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 54058, .adv_w = 760, .box_w = 48, .box_h = 30, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 54778, .adv_w = 532, .box_w = 30, .box_h = 39, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 55363, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 56026, .adv_w = 608, .box_w = 39, .box_h = 39, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 56787, .adv_w = 760, .box_w = 48, .box_h = 29, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 57483, .adv_w = 456, .box_w = 29, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 58049, .adv_w = 612, .box_w = 39, .box_h = 25, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -7828,9 +7895,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -7842,7 +7909,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -7873,7 +7940,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -7898,7 +7965,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_40.c b/src/font/lv_font_montserrat_40.c index b4a131709..0a6d36cad 100644 --- a/src/font/lv_font_montserrat_40.c +++ b/src/font/lv_font_montserrat_40.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 40 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 40 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_40.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 40 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_40.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -6728,6 +6728,78 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xb7, 0x10, + /* U+F0C9 "" */ + 0x48, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xfc, 0x1, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x5, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xa5, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xaf, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x90, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x83, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, + /* U+F0E0 "" */ 0x3, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -8638,26 +8710,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 49090, .adv_w = 560, .box_w = 36, .box_h = 36, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 49738, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, {.bitmap_index = 50438, .adv_w = 560, .box_w = 35, .box_h = 36, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 51068, .adv_w = 640, .box_w = 40, .box_h = 30, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 51668, .adv_w = 400, .box_w = 27, .box_h = 40, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 52208, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 52908, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 53608, .adv_w = 720, .box_w = 45, .box_h = 30, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 54283, .adv_w = 640, .box_w = 42, .box_h = 42, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 55165, .adv_w = 480, .box_w = 30, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 55765, .adv_w = 800, .box_w = 50, .box_h = 37, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 56690, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 57340, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 57990, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 58640, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 59290, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 59940, .adv_w = 800, .box_w = 51, .box_h = 32, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 60756, .adv_w = 560, .box_w = 31, .box_h = 40, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 61376, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 62076, .adv_w = 640, .box_w = 41, .box_h = 41, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 62917, .adv_w = 800, .box_w = 50, .box_h = 30, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 63667, .adv_w = 480, .box_w = 30, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 64267, .adv_w = 644, .box_w = 41, .box_h = 26, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 51068, .adv_w = 560, .box_w = 35, .box_h = 32, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 51628, .adv_w = 640, .box_w = 40, .box_h = 30, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 52228, .adv_w = 400, .box_w = 27, .box_h = 40, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 52768, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 53468, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 54168, .adv_w = 720, .box_w = 45, .box_h = 30, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 54843, .adv_w = 640, .box_w = 42, .box_h = 42, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 55725, .adv_w = 480, .box_w = 30, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 56325, .adv_w = 800, .box_w = 50, .box_h = 37, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 57250, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 57900, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 58550, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 59200, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 59850, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 60500, .adv_w = 800, .box_w = 51, .box_h = 32, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 61316, .adv_w = 560, .box_w = 31, .box_h = 40, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 61936, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 62636, .adv_w = 640, .box_w = 41, .box_h = 41, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 63477, .adv_w = 800, .box_w = 50, .box_h = 30, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 64227, .adv_w = 480, .box_w = 30, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 64827, .adv_w = 644, .box_w = 41, .box_h = 26, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -8670,9 +8743,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -8684,7 +8757,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -8715,7 +8788,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -8740,7 +8813,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_42.c b/src/font/lv_font_montserrat_42.c index dbbf43f34..dd92e2864 100644 --- a/src/font/lv_font_montserrat_42.c +++ b/src/font/lv_font_montserrat_42.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 42 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 42 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_42.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 42 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_42.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -7363,6 +7363,85 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xb5, 0x0, + /* U+F0C9 "" */ + 0x8d, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0x4f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x8, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xd4, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfb, 0xbf, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x70, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, + 0xcc, 0xcc, 0xcc, 0x4f, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0x1, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x0, + /* U+F0E0 "" */ 0x0, 0x3, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, @@ -9473,26 +9552,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 53937, .adv_w = 588, .box_w = 38, .box_h = 38, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 54659, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, {.bitmap_index = 55455, .adv_w = 588, .box_w = 37, .box_h = 38, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 56158, .adv_w = 672, .box_w = 42, .box_h = 32, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 56830, .adv_w = 420, .box_w = 28, .box_h = 43, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 57432, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 58228, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 59024, .adv_w = 756, .box_w = 48, .box_h = 32, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 59792, .adv_w = 672, .box_w = 44, .box_h = 44, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 60760, .adv_w = 504, .box_w = 32, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 61448, .adv_w = 840, .box_w = 53, .box_h = 39, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 62482, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 63198, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 63914, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 64630, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 65346, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 66062, .adv_w = 840, .box_w = 53, .box_h = 33, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 66937, .adv_w = 588, .box_w = 33, .box_h = 43, .ofs_x = 2, .ofs_y = -6}, - {.bitmap_index = 67647, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 68443, .adv_w = 672, .box_w = 43, .box_h = 43, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 69368, .adv_w = 840, .box_w = 53, .box_h = 32, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 70216, .adv_w = 504, .box_w = 32, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 70904, .adv_w = 676, .box_w = 43, .box_h = 28, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 56158, .adv_w = 588, .box_w = 37, .box_h = 33, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 56769, .adv_w = 672, .box_w = 42, .box_h = 32, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 57441, .adv_w = 420, .box_w = 28, .box_h = 43, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 58043, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 58839, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 59635, .adv_w = 756, .box_w = 48, .box_h = 32, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 60403, .adv_w = 672, .box_w = 44, .box_h = 44, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 61371, .adv_w = 504, .box_w = 32, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 62059, .adv_w = 840, .box_w = 53, .box_h = 39, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 63093, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 63809, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 64525, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 65241, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 65957, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 66673, .adv_w = 840, .box_w = 53, .box_h = 33, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 67548, .adv_w = 588, .box_w = 33, .box_h = 43, .ofs_x = 2, .ofs_y = -6}, + {.bitmap_index = 68258, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 69054, .adv_w = 672, .box_w = 43, .box_h = 43, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 69979, .adv_w = 840, .box_w = 53, .box_h = 32, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 70827, .adv_w = 504, .box_w = 32, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 71515, .adv_w = 676, .box_w = 43, .box_h = 28, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -9505,9 +9585,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -9519,7 +9599,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -9550,7 +9630,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -9575,7 +9655,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_44.c b/src/font/lv_font_montserrat_44.c index 687212bd1..86d0f0cd2 100644 --- a/src/font/lv_font_montserrat_44.c +++ b/src/font/lv_font_montserrat_44.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 44 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 44 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_44.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 44 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_44.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -7997,6 +7997,94 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xeb, 0x30, 0x0, + /* U+F0C9 "" */ + 0x3, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x32, 0xc, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xf7, 0x8f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, + 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x15, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x64, 0xd, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x6c, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdb, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfd, 0x2f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x7c, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, 0x3, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x32, 0x0, + /* U+F0E0 "" */ 0x1, 0xae, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -10290,26 +10378,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 58697, .adv_w = 616, .box_w = 39, .box_h = 39, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 59458, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, {.bitmap_index = 60336, .adv_w = 616, .box_w = 39, .box_h = 39, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 61097, .adv_w = 704, .box_w = 44, .box_h = 33, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 61823, .adv_w = 440, .box_w = 29, .box_h = 45, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 62476, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 63354, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 64232, .adv_w = 792, .box_w = 50, .box_h = 33, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 65057, .adv_w = 704, .box_w = 46, .box_h = 46, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 66115, .adv_w = 528, .box_w = 33, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 66858, .adv_w = 880, .box_w = 55, .box_h = 41, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 67986, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 68784, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 69582, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 70380, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 71178, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 71976, .adv_w = 880, .box_w = 56, .box_h = 35, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 72956, .adv_w = 616, .box_w = 34, .box_h = 45, .ofs_x = 2, .ofs_y = -6}, - {.bitmap_index = 73721, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 74599, .adv_w = 704, .box_w = 45, .box_h = 45, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 75612, .adv_w = 880, .box_w = 55, .box_h = 33, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 76520, .adv_w = 528, .box_w = 33, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 77263, .adv_w = 708, .box_w = 45, .box_h = 29, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 61097, .adv_w = 616, .box_w = 39, .box_h = 35, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 61780, .adv_w = 704, .box_w = 44, .box_h = 33, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 62506, .adv_w = 440, .box_w = 29, .box_h = 45, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 63159, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 64037, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 64915, .adv_w = 792, .box_w = 50, .box_h = 33, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 65740, .adv_w = 704, .box_w = 46, .box_h = 46, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 66798, .adv_w = 528, .box_w = 33, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 67541, .adv_w = 880, .box_w = 55, .box_h = 41, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 68669, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 69467, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 70265, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 71063, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 71861, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 72659, .adv_w = 880, .box_w = 56, .box_h = 35, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 73639, .adv_w = 616, .box_w = 34, .box_h = 45, .ofs_x = 2, .ofs_y = -6}, + {.bitmap_index = 74404, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 75282, .adv_w = 704, .box_w = 45, .box_h = 45, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 76295, .adv_w = 880, .box_w = 55, .box_h = 33, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 77203, .adv_w = 528, .box_w = 33, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 77946, .adv_w = 708, .box_w = 45, .box_h = 29, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -10322,9 +10411,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -10336,7 +10425,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -10367,7 +10456,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -10392,7 +10481,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_46.c b/src/font/lv_font_montserrat_46.c index f3f2ccd88..9d3f9a25d 100644 --- a/src/font/lv_font_montserrat_46.c +++ b/src/font/lv_font_montserrat_46.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 46 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 46 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_46.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 46 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_46.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -8744,6 +8744,101 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xeb, 0x30, 0x0, + /* U+F0C9 "" */ + 0x8e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xfb, 0xf, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x4f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4e, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf2, 0x27, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x84, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x27, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x74, 0xe, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf2, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x4f, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x4f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf3, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x10, 0xa, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd0, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x4f, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf3, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x11, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0x55, 0x20, + /* U+F0E0 "" */ 0x0, 0x2, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, @@ -11235,26 +11330,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 64467, .adv_w = 644, .box_w = 41, .box_h = 41, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 65308, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, {.bitmap_index = 66272, .adv_w = 644, .box_w = 41, .box_h = 41, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 67113, .adv_w = 736, .box_w = 46, .box_h = 35, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 67918, .adv_w = 460, .box_w = 31, .box_h = 47, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 68647, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 69611, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 70575, .adv_w = 828, .box_w = 52, .box_h = 35, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 71485, .adv_w = 736, .box_w = 48, .box_h = 47, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 72613, .adv_w = 552, .box_w = 35, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 73436, .adv_w = 920, .box_w = 58, .box_h = 42, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 74654, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 75524, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 76394, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 77264, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 78134, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 79004, .adv_w = 920, .box_w = 58, .box_h = 36, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 80048, .adv_w = 644, .box_w = 36, .box_h = 47, .ofs_x = 2, .ofs_y = -6}, - {.bitmap_index = 80894, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 81858, .adv_w = 736, .box_w = 47, .box_h = 47, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 82963, .adv_w = 920, .box_w = 58, .box_h = 35, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 83978, .adv_w = 552, .box_w = 35, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 84801, .adv_w = 740, .box_w = 47, .box_h = 30, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 67113, .adv_w = 644, .box_w = 41, .box_h = 36, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 67851, .adv_w = 736, .box_w = 46, .box_h = 35, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 68656, .adv_w = 460, .box_w = 31, .box_h = 47, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 69385, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 70349, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 71313, .adv_w = 828, .box_w = 52, .box_h = 35, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 72223, .adv_w = 736, .box_w = 48, .box_h = 47, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 73351, .adv_w = 552, .box_w = 35, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 74174, .adv_w = 920, .box_w = 58, .box_h = 42, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 75392, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 76262, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 77132, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 78002, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 78872, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 79742, .adv_w = 920, .box_w = 58, .box_h = 36, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 80786, .adv_w = 644, .box_w = 36, .box_h = 47, .ofs_x = 2, .ofs_y = -6}, + {.bitmap_index = 81632, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 82596, .adv_w = 736, .box_w = 47, .box_h = 47, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 83701, .adv_w = 920, .box_w = 58, .box_h = 35, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 84716, .adv_w = 552, .box_w = 35, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 85539, .adv_w = 740, .box_w = 47, .box_h = 30, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -11267,9 +11363,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -11281,7 +11377,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -11312,7 +11408,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -11337,7 +11433,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_48.c b/src/font/lv_font_montserrat_48.c index a05ab34b0..c627fdde3 100644 --- a/src/font/lv_font_montserrat_48.c +++ b/src/font/lv_font_montserrat_48.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 48 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 48 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_48.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 48 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_48.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -9304,6 +9304,108 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x0, + /* U+F0C9 "" */ + 0x39, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x93, 0xef, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaf, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfa, 0x2, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x20, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x39, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x93, + 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, 0x2, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x93, 0xef, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xaf, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xfa, 0x2, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x20, + /* U+F0E0 "" */ 0x0, 0x8d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -11929,26 +12031,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 68831, .adv_w = 672, .box_w = 43, .box_h = 42, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 69734, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, {.bitmap_index = 70742, .adv_w = 672, .box_w = 42, .box_h = 42, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 71624, .adv_w = 768, .box_w = 48, .box_h = 36, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 72488, .adv_w = 480, .box_w = 32, .box_h = 48, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 73256, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 74264, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 75272, .adv_w = 864, .box_w = 54, .box_h = 36, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 76244, .adv_w = 768, .box_w = 50, .box_h = 50, .ofs_x = -1, .ofs_y = -7}, - {.bitmap_index = 77494, .adv_w = 576, .box_w = 36, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 78358, .adv_w = 960, .box_w = 60, .box_h = 44, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 79678, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, - {.bitmap_index = 80578, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, - {.bitmap_index = 81478, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, - {.bitmap_index = 82378, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, - {.bitmap_index = 83278, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, - {.bitmap_index = 84178, .adv_w = 960, .box_w = 61, .box_h = 38, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 85337, .adv_w = 672, .box_w = 36, .box_h = 48, .ofs_x = 3, .ofs_y = -6}, - {.bitmap_index = 86201, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 87209, .adv_w = 768, .box_w = 49, .box_h = 49, .ofs_x = -1, .ofs_y = -7}, - {.bitmap_index = 88410, .adv_w = 960, .box_w = 60, .box_h = 36, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 89490, .adv_w = 576, .box_w = 36, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 90354, .adv_w = 773, .box_w = 49, .box_h = 31, .ofs_x = 0, .ofs_y = 3} + {.bitmap_index = 71624, .adv_w = 672, .box_w = 42, .box_h = 38, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 72422, .adv_w = 768, .box_w = 48, .box_h = 36, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 73286, .adv_w = 480, .box_w = 32, .box_h = 48, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 74054, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 75062, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 76070, .adv_w = 864, .box_w = 54, .box_h = 36, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 77042, .adv_w = 768, .box_w = 50, .box_h = 50, .ofs_x = -1, .ofs_y = -7}, + {.bitmap_index = 78292, .adv_w = 576, .box_w = 36, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 79156, .adv_w = 960, .box_w = 60, .box_h = 44, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 80476, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, + {.bitmap_index = 81376, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, + {.bitmap_index = 82276, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, + {.bitmap_index = 83176, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, + {.bitmap_index = 84076, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, + {.bitmap_index = 84976, .adv_w = 960, .box_w = 61, .box_h = 38, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 86135, .adv_w = 672, .box_w = 36, .box_h = 48, .ofs_x = 3, .ofs_y = -6}, + {.bitmap_index = 86999, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 88007, .adv_w = 768, .box_w = 49, .box_h = 49, .ofs_x = -1, .ofs_y = -7}, + {.bitmap_index = 89208, .adv_w = 960, .box_w = 60, .box_h = 36, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 90288, .adv_w = 576, .box_w = 36, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 91152, .adv_w = 773, .box_w = 49, .box_h = 31, .ofs_x = 0, .ofs_y = 3} }; /*--------------------- @@ -11961,9 +12064,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -11975,7 +12078,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -12006,7 +12109,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -12031,7 +12134,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_8.c b/src/font/lv_font_montserrat_8.c index 25ced69c3..8cd303f69 100644 --- a/src/font/lv_font_montserrat_8.c +++ b/src/font/lv_font_montserrat_8.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 8 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 8 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_8.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 8 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_8.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -626,6 +626,12 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xf9, 0x9, 0xff, 0xff, 0xd5, 0xdf, 0xf8, 0xbb, 0xbb, 0xb8, + /* U+F0C9 "" */ + 0x1, 0x11, 0x11, 0xf, 0xff, 0xff, 0xff, 0x1, + 0x11, 0x11, 0x5, 0x55, 0x55, 0x55, 0xcc, 0xcc, + 0xcc, 0xc0, 0x11, 0x11, 0x10, 0xff, 0xff, 0xff, + 0xf0, 0x11, 0x11, 0x10, + /* U+F0E0 "" */ 0xdf, 0xff, 0xff, 0xfd, 0x9f, 0xff, 0xff, 0xf9, 0xb7, 0xff, 0xff, 0x7b, 0xfe, 0x7c, 0xc7, 0xef, @@ -896,26 +902,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 2160, .adv_w = 112, .box_w = 8, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 2192, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 2220, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2248, .adv_w = 128, .box_w = 8, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2272, .adv_w = 80, .box_w = 7, .box_h = 8, .ofs_x = -1, .ofs_y = -1}, - {.bitmap_index = 2300, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2248, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2276, .adv_w = 128, .box_w = 8, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2300, .adv_w = 80, .box_w = 7, .box_h = 8, .ofs_x = -1, .ofs_y = -1}, {.bitmap_index = 2328, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2356, .adv_w = 144, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2383, .adv_w = 128, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 2433, .adv_w = 96, .box_w = 6, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2457, .adv_w = 160, .box_w = 10, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2497, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2527, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2557, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2587, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2617, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2647, .adv_w = 160, .box_w = 11, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2691, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2356, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2384, .adv_w = 144, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2411, .adv_w = 128, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 2461, .adv_w = 96, .box_w = 6, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2485, .adv_w = 160, .box_w = 10, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2525, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2555, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2585, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2615, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2645, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2675, .adv_w = 160, .box_w = 11, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 2719, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2747, .adv_w = 128, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 2788, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2818, .adv_w = 96, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2846, .adv_w = 129, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 2747, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2775, .adv_w = 128, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 2816, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2846, .adv_w = 96, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2874, .adv_w = 129, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -928,9 +935,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -942,7 +949,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -973,7 +980,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -998,7 +1005,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_simsun_16_cjk.c b/src/font/lv_font_simsun_16_cjk.c index ef6b03961..dee4a98f2 100644 --- a/src/font/lv_font_simsun_16_cjk.c +++ b/src/font/lv_font_simsun_16_cjk.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 16 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 16 --font SimSun.woff -r 0x20-0x7f --symbols 一在有個我不這了他也就人都說而我們你了要會對及和與以很種的大能著她那上但年還可以最自己為來所他們兩各可為或好等又將因為於由從更被才已者每次把三什麼問題其讓此做再所以只與則台灣卻並位想去呢學生表示到公司將如果社會看小天因此新但是它中使工作全覺得使用這些裡並由於時候知道這樣一認為時間事過向可能中國美國到和幾系統政府大家國家許多生活跟已經大學研究因本二活動該世界應四希望方式內項啊下環境一些必須文化高孩子沒有不能如開始元不同仍網路日本用中心來對雖然重要地方進行關係市場太老師提供學校應該指出經濟其他家發展教育成為多非常便方面很多吃然後未發現電腦一樣而且心不過無法企業正服務較不會臺灣曾嗎空間看到五如何國內們無對於以及之後可是當人員比先產品資訊資料比較先生地除了大陸需要像在給歲請月些名另若亦地區技術至特別其實國際不要發生參加一定其中問台北包括講造成看像常即喜歡去沒出現政治話走單位一直吧是否當然整處理歷史了解那怎麼機會家聽所有只要朋友令甚至用真六呀情況還是錢方法點任何經驗藝術你們十主要媽媽增加提出為什麼以您計畫作利用東西在條設計找之間成長能夠決定學習誰見半時代完成帶相當同學件能力別人生命下來場會議容易開發民眾事情書事實有關自組織言多愛建立相關均產生多業者解決完全的話接受知約一般推動過程管理功能手打水要求小朋友教授難我國告訴內容結果調查家庭成立選擇經營然而父母寫人類至於買尤其配合進入例如得討論依作品情形資源原因啦妳運動觀念給軟體品質經過如此嗯精神影響之過好像成參與以後於是部分另外公園透過訓練努力研究具有共同所謂下行為合作經合作目標起來考慮長意見辦法音樂連受廠商隻受到一切或是中央某女性教學極獲得真的路來快國小部份工程女人舉行句只是段根據現象人民土地面對注意這裡新聞繼續相信政策變成計劃強調學人士前前存在制度意義代表課程該沒至需求人生那些成功爸爸產業負責民間雖影響直接幾乎分實際團體價值使得類形成科技這麼當七不但往本身標準似乎應用或者動物電話態度建設事業老那麼常常字坐舉辦自我有的具目的塊條件即使好十分多少放又電影科學執行邊委員會溝通開一起張針對員工引起自然那麼安全總統此外擁有並且事件設計研究所語言嚴重故事學術片設備之外車基本實在久套達到改善死結構住皆改變拿小組支持座醫院既僅值得學者八交通階段就是申請主管申請同感覺電視母親嘛香港記者壓力快樂喝敢院也許人們談生產怕就身體規定程度積極知識作為機構而是鼓勵角色狀況專家據清楚不僅比賽玩效果越保護共開放附近上父親專業經費曾經工作願意分別重視不少歡迎小孩小時中國人顯示中共出男人避免屬於實施聲音主義行動不可只有校園興趣山表現得回來主任裡面經常不再電子受思想頭終於謝謝協助除當地正式真正低性份因素推出上價格去認識方向責任說明工業大量做逐漸心理一點供須簡單運用觀察往往規劃減少重新業務報導仍然感到開放領域有效女要從事發揮人才反而行政銀行公共媒體提高代自然社區力量啊教育部愈超過維持家長結合校長通常缺乏委員特色結果有時教師之前遠控制本否則法少原則要臉通過建議工具作業達節目智慧來自而變化同樣形式站以為健康擔任人口規劃剛特殊原來道分傳統總是前往投資加強不斷對象追求加上比思考製作台北市取得出來加入台安排兒童國中範圍老人雙方牠北京年輕結束教程式婦女找到彼此全球成本回到部而已之下等變期間非小姐整體採用根本叫歐洲正在加以充滿系列隨著早等等頗不足總分析深報告不錯在於旁笑故消費者意識公尺民族為主大眾到底願度大概對方官員發表進一步自由正確豐富國民黨戰爭怎麼樣只好明顯改革表達肯定強高興哪樹適合茶別國外關心蘇聯成績人物聽到創造不必不論尚居民不管美麗伊拉克帶來有般永遠感情兒子這樣子起全部 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_simsun_16_cjk.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 16 --font SimSun.woff -r 0x20-0x7f --symbols 一在有個我不這了他也就人都說而我們你了要會對及和與以很種的大能著她那上但年還可以最自己為來所他們兩各可為或好等又將因為於由從更被才已者每次把三什麼問題其讓此做再所以只與則台灣卻並位想去呢學生表示到公司將如果社會看小天因此新但是它中使工作全覺得使用這些裡並由於時候知道這樣一認為時間事過向可能中國美國到和幾系統政府大家國家許多生活跟已經大學研究因本二活動該世界應四希望方式內項啊下環境一些必須文化高孩子沒有不能如開始元不同仍網路日本用中心來對雖然重要地方進行關係市場太老師提供學校應該指出經濟其他家發展教育成為多非常便方面很多吃然後未發現電腦一樣而且心不過無法企業正服務較不會臺灣曾嗎空間看到五如何國內們無對於以及之後可是當人員比先產品資訊資料比較先生地除了大陸需要像在給歲請月些名另若亦地區技術至特別其實國際不要發生參加一定其中問台北包括講造成看像常即喜歡去沒出現政治話走單位一直吧是否當然整處理歷史了解那怎麼機會家聽所有只要朋友令甚至用真六呀情況還是錢方法點任何經驗藝術你們十主要媽媽增加提出為什麼以您計畫作利用東西在條設計找之間成長能夠決定學習誰見半時代完成帶相當同學件能力別人生命下來場會議容易開發民眾事情書事實有關自組織言多愛建立相關均產生多業者解決完全的話接受知約一般推動過程管理功能手打水要求小朋友教授難我國告訴內容結果調查家庭成立選擇經營然而父母寫人類至於買尤其配合進入例如得討論依作品情形資源原因啦妳運動觀念給軟體品質經過如此嗯精神影響之過好像成參與以後於是部分另外公園透過訓練努力研究具有共同所謂下行為合作經合作目標起來考慮長意見辦法音樂連受廠商隻受到一切或是中央某女性教學極獲得真的路來快國小部份工程女人舉行句只是段根據現象人民土地面對注意這裡新聞繼續相信政策變成計劃強調學人士前前存在制度意義代表課程該沒至需求人生那些成功爸爸產業負責民間雖影響直接幾乎分實際團體價值使得類形成科技這麼當七不但往本身標準似乎應用或者動物電話態度建設事業老那麼常常字坐舉辦自我有的具目的塊條件即使好十分多少放又電影科學執行邊委員會溝通開一起張針對員工引起自然那麼安全總統此外擁有並且事件設計研究所語言嚴重故事學術片設備之外車基本實在久套達到改善死結構住皆改變拿小組支持座醫院既僅值得學者八交通階段就是申請主管申請同感覺電視母親嘛香港記者壓力快樂喝敢院也許人們談生產怕就身體規定程度積極知識作為機構而是鼓勵角色狀況專家據清楚不僅比賽玩效果越保護共開放附近上父親專業經費曾經工作願意分別重視不少歡迎小孩小時中國人顯示中共出男人避免屬於實施聲音主義行動不可只有校園興趣山表現得回來主任裡面經常不再電子受思想頭終於謝謝協助除當地正式真正低性份因素推出上價格去認識方向責任說明工業大量做逐漸心理一點供須簡單運用觀察往往規劃減少重新業務報導仍然感到開放領域有效女要從事發揮人才反而行政銀行公共媒體提高代自然社區力量啊教育部愈超過維持家長結合校長通常缺乏委員特色結果有時教師之前遠控制本否則法少原則要臉通過建議工具作業達節目智慧來自而變化同樣形式站以為健康擔任人口規劃剛特殊原來道分傳統總是前往投資加強不斷對象追求加上比思考製作台北市取得出來加入台安排兒童國中範圍老人雙方牠北京年輕結束教程式婦女找到彼此全球成本回到部而已之下等變期間非小姐整體採用根本叫歐洲正在加以充滿系列隨著早等等頗不足總分析深報告不錯在於旁笑故消費者意識公尺民族為主大眾到底願度大概對方官員發表進一步自由正確豐富國民黨戰爭怎麼樣只好明顯改革表達肯定強高興哪樹適合茶別國外關心蘇聯成績人物聽到創造不必不論尚居民不管美麗伊拉克帶來有般永遠感情兒子這樣子起全部 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_simsun_16_cjk.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -12343,6 +12343,21 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + /* U+F0C9 "" */ + 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x12, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x21, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x12, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x21, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x21, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x12, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x21, + /* U+F0E0 "" */ 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -13461,26 +13476,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 84593, .adv_w = 224, .box_w = 15, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 84698, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 84810, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 84908, .adv_w = 256, .box_w = 16, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 85004, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 85100, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 85212, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 85324, .adv_w = 288, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 85432, .adv_w = 256, .box_w = 18, .box_h = 18, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 85594, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 85690, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 85840, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 85940, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 86040, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 86140, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 86240, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 86340, .adv_w = 320, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 86487, .adv_w = 224, .box_w = 12, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 86583, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 86695, .adv_w = 256, .box_w = 17, .box_h = 17, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 86840, .adv_w = 320, .box_w = 20, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 86960, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 87056, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 84908, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 85006, .adv_w = 256, .box_w = 16, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 85102, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 85198, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 85310, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 85422, .adv_w = 288, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 85530, .adv_w = 256, .box_w = 18, .box_h = 18, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 85692, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 85788, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 85938, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 86038, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 86138, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 86238, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 86338, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 86438, .adv_w = 320, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 86585, .adv_w = 224, .box_w = 12, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 86681, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 86793, .adv_w = 256, .box_w = 17, .box_h = 17, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 86938, .adv_w = 320, .box_w = 20, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 87058, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 87154, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -13574,9 +13590,9 @@ static const uint16_t unicode_list_1[] = { 0xa243, 0xa248, 0xa24b, 0xa24c, 0xa24d, 0xa251, 0xa252, 0xa253, 0xa254, 0xa267, 0xa268, 0xa26e, 0xa270, 0xa271, 0xa274, 0xa277, 0xa278, 0xa279, 0xa27b, 0xa293, 0xa295, 0xa2c4, 0xa2c5, 0xa2c7, - 0xa2e0, 0xa2e7, 0xa2ea, 0xa2f3, 0xa31c, 0xa324, 0xa35b, 0xa3eb, - 0xa440, 0xa441, 0xa442, 0xa443, 0xa444, 0xa487, 0xa493, 0xa4ed, - 0xa504, 0xa75a, 0xa9c2, 0xaaa2 + 0xa2c9, 0xa2e0, 0xa2e7, 0xa2ea, 0xa2f3, 0xa31c, 0xa324, 0xa35b, + 0xa3eb, 0xa440, 0xa441, 0xa442, 0xa443, 0xa444, 0xa487, 0xa493, + 0xa4ed, 0xa504, 0xa75a, 0xa9c2, 0xaaa2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -13588,7 +13604,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 19968, .range_length = 43683, .glyph_id_start = 97, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 708, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 709, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; diff --git a/src/font/lv_symbol_def.h b/src/font/lv_symbol_def.h index ef9bdd486..0e619e74b 100644 --- a/src/font/lv_symbol_def.h +++ b/src/font/lv_symbol_def.h @@ -62,6 +62,7 @@ extern "C" { #define LV_SYMBOL_CUT "\xef\x83\x84" /*61636, 0xF0C4*/ #define LV_SYMBOL_COPY "\xef\x83\x85" /*61637, 0xF0C5*/ #define LV_SYMBOL_SAVE "\xef\x83\x87" /*61639, 0xF0C7*/ +#define LV_SYMBOL_BARS "\xef\x83\x89" /*61641, 0xF0C9*/ #define LV_SYMBOL_CHARGE "\xef\x83\xa7" /*61671, 0xF0E7*/ #define LV_SYMBOL_PASTE "\xef\x83\xAA" /*61674, 0xF0EA*/ #define LV_SYMBOL_BELL "\xef\x83\xb3" /*61683, 0xF0F3*/ From e8f84271ee5de8951d1c45f09cb6025628ddeccb Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 22 Apr 2021 15:36:09 +0200 Subject: [PATCH 045/152] fix(theme) fix textarea cursor style in lv_theme_basic --- src/extra/themes/basic/lv_theme_basic.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/extra/themes/basic/lv_theme_basic.c b/src/extra/themes/basic/lv_theme_basic.c index 40eaac55e..d69a5aec4 100644 --- a/src/extra/themes/basic/lv_theme_basic.c +++ b/src/extra/themes/basic/lv_theme_basic.c @@ -22,7 +22,7 @@ #define COLOR_MID lv_color_grey_lighten_1() #define COLOR_DARK lv_color_grey() #define COLOR_DIM lv_color_grey_darken_2() -#define PAD_DEF LV_DPX(10) +#define PAD_DEF LV_DPX(5) /********************** * TYPEDEFS @@ -35,6 +35,9 @@ typedef struct { lv_style_t pressed; lv_style_t disabled; lv_style_t pad_zero; +#if LV_USE_TEXTAREA + lv_style_t ta_cursor; +#endif } my_theme_styles_t; @@ -77,7 +80,7 @@ static void style_init(void) style_init_reset(&styles->scrollbar); lv_style_set_bg_opa(&styles->scrollbar, LV_OPA_COVER); lv_style_set_bg_color(&styles->scrollbar, lv_color_grey_darken_2()); - lv_style_set_size(&styles->scrollbar, PAD_DEF / 2); + lv_style_set_width(&styles->scrollbar, PAD_DEF); style_init_reset(&styles->scr); lv_style_set_bg_opa(&styles->scr, LV_OPA_COVER); @@ -132,6 +135,15 @@ static void style_init(void) style_init_reset(&styles->pad_zero); lv_style_set_pad_all(&styles->pad_zero, 0); lv_style_set_pad_gap(&styles->pad_zero, 0); + +#if LV_USE_TEXTAREA + style_init_reset(&styles->ta_cursor); + lv_style_set_border_side(&styles->ta_cursor, LV_BORDER_SIDE_LEFT); + lv_style_set_border_color(&styles->ta_cursor, COLOR_DIM); + lv_style_set_border_width(&styles->ta_cursor, 2); + lv_style_set_bg_opa(&styles->ta_cursor, LV_OPA_TRANSP); + lv_style_set_anim_time(&styles->ta_cursor, 500); +#endif } @@ -334,7 +346,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) else if(lv_obj_check_type(obj, &lv_textarea_class)) { lv_obj_add_style(obj, &styles->light, 0); lv_obj_add_style(obj, &styles->scrollbar, LV_PART_SCROLLBAR); - lv_obj_add_style(obj, &styles->dark, LV_PART_CURSOR); + lv_obj_add_style(obj, &styles->ta_cursor, LV_PART_CURSOR); lv_obj_add_style(obj, &styles->light, LV_PART_TEXTAREA_PLACEHOLDER); } #endif From e29bfc5dc5effe92b3c7235692d45991010d1901 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 22 Apr 2021 15:36:40 +0200 Subject: [PATCH 046/152] minor fixes --- src/core/lv_disp.c | 1 + src/widgets/lv_label.c | 2 +- src/widgets/lv_textarea.c | 36 +++++++++++++++++++----------------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/core/lv_disp.c b/src/core/lv_disp.c index 37aaa8e1d..0507ea5b9 100644 --- a/src/core/lv_disp.c +++ b/src/core/lv_disp.c @@ -127,6 +127,7 @@ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp) */ void lv_disp_set_theme(lv_disp_t * disp, lv_theme_t * th) { + if(disp == NULL) disp = lv_disp_get_default(); disp->theme = th; if(disp->screen_cnt == 3 && diff --git a/src/widgets/lv_label.c b/src/widgets/lv_label.c index 32d3c5745..05d5795e1 100644 --- a/src/widgets/lv_label.c +++ b/src/widgets/lv_label.c @@ -505,8 +505,8 @@ uint32_t lv_label_get_letter_on(const lv_obj_t * obj, lv_point_t * pos_in) logical_pos = _lv_bidi_get_logical_pos(&txt[line_start], NULL, txt_len, lv_obj_get_base_dir(obj), cid, &is_rtl); if(is_rtl) logical_pos++; - lv_mem_buf_release(bidi_txt); } + lv_mem_buf_release(bidi_txt); #else logical_pos = _lv_txt_encoded_get_char_id(bidi_txt, i); #endif diff --git a/src/widgets/lv_textarea.c b/src/widgets/lv_textarea.c index b413fd965..3698251a7 100644 --- a/src/widgets/lv_textarea.c +++ b/src/widgets/lv_textarea.c @@ -395,24 +395,26 @@ void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos) ta->cursor.pos = pos; - /*Position the label to make the cursor show*/ - lv_point_t cur_pos; - const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - lv_area_t label_cords; - lv_area_t ta_cords; - lv_label_get_letter_pos(ta->label, pos, &cur_pos); - lv_obj_get_coords(obj, &ta_cords); - lv_obj_get_coords(ta->label, &label_cords); + /*Position the label to make the cursor visible*/ + lv_point_t cur_pos; + const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); + lv_area_t label_cords; + lv_area_t ta_cords; + lv_label_get_letter_pos(ta->label, pos, &cur_pos); + lv_obj_get_coords(obj, &ta_cords); + lv_obj_get_coords(ta->label, &label_cords); - /*Check the top*/ - lv_coord_t font_h = lv_font_get_line_height(font); - if(cur_pos.y < lv_obj_get_scroll_top(obj)) { - lv_obj_scroll_to_y(obj, cur_pos.y, LV_ANIM_ON); - } - /*Check the bottom*/ - lv_coord_t h = lv_obj_get_content_height(obj); - if(cur_pos.y + font_h - lv_obj_get_scroll_top(obj) > h) { - lv_obj_scroll_to_y(obj, cur_pos.y - h + font_h, LV_ANIM_ON); + if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLLABLE)) { + /*Check the top*/ + lv_coord_t font_h = lv_font_get_line_height(font); + if(cur_pos.y < lv_obj_get_scroll_top(obj)) { + lv_obj_scroll_to_y(obj, cur_pos.y, LV_ANIM_ON); + } + /*Check the bottom*/ + lv_coord_t h = lv_obj_get_content_height(obj); + if(cur_pos.y + font_h - lv_obj_get_scroll_top(obj) > h) { + lv_obj_scroll_to_y(obj, cur_pos.y - h + font_h, LV_ANIM_ON); + } } ta->cursor.valid_x = cur_pos.x; From d7735a486b22e146fe7d7e564f0225f2c70a73ef Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 22 Apr 2021 16:00:30 +0200 Subject: [PATCH 047/152] fix(msgbox) fix the alignment of the items --- src/extra/widgets/msgbox/lv_msgbox.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/extra/widgets/msgbox/lv_msgbox.c b/src/extra/widgets/msgbox/lv_msgbox.c index 862419fae..ed0d1a67b 100644 --- a/src/extra/widgets/msgbox/lv_msgbox.c +++ b/src/extra/widgets/msgbox/lv_msgbox.c @@ -58,6 +58,7 @@ lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * b lv_obj_set_size(mbox, w, LV_SIZE_CONTENT); lv_obj_set_flex_flow(mbox, LV_FLEX_FLOW_ROW_WRAP); + lv_obj_set_flex_place(mbox, LV_FLEX_PLACE_START, LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_START); lv_obj_t * label; label = lv_label_create(mbox); From 21489eddc8416c2320bc77d71b4f6925475205c9 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 22 Apr 2021 17:47:36 +0200 Subject: [PATCH 048/152] docs(object) update to v8 --- docs/overview/object.md | 130 +++++++++++++++++++++------------------- 1 file changed, 70 insertions(+), 60 deletions(-) diff --git a/docs/overview/object.md b/docs/overview/object.md index 4fedafab7..23599d27f 100644 --- a/docs/overview/object.md +++ b/docs/overview/object.md @@ -9,6 +9,8 @@ For example a [Button](/widgets/btn), [Label](/widgets/label), [Image](/widgets/ Check all the [Object types](/widgets/index) here. +All objects are referenced using an `lv_obj_t` pointer as a handle. This pointer can later be used to set or get the attributes of the object. + ## Attributes ### Basic attributes @@ -17,59 +19,56 @@ All object types share some basic attributes: - Position - Size - Parent -- Drag enable -- Click enable etc. +- Styles +- Event handlers +- Etc You can set/get these attributes with `lv_obj_set_...` and `lv_obj_get_...` functions. For example: ```c /*Set basic object attributes*/ -lv_obj_set_size(btn1, 100, 50); /*Button size*/ -lv_obj_set_pos(btn1, 20,30); /*Button position*/ +lv_obj_set_size(btn1, 100, 50); /*Set a button's size*/ +lv_obj_set_pos(btn1, 20,30); /*Set a button's position*/ ``` -To see all the available functions visit the Base object's [documentation](/widgets/obj). +To see all the available functions visit the [Base object's documentation](/widgets/obj). ### Specific attributes The object types have special attributes too. For example, a slider has -- Min. max. values +- Minimum and maximum values - Current value -- Custom styles For these attributes, every object type have unique API functions. For example for a slider: ```c /*Set slider specific attributes*/ -lv_slider_set_range(slider1, 0, 100); /*Set min. and max. values*/ -lv_slider_set_value(slider1, 40, LV_ANIM_ON); /*Set the current value (position)*/ -lv_slider_set_action(slider1, my_action); /*Set a callback function*/ +lv_slider_set_range(slider1, 0, 100); /*Set the min. and max. values*/ +lv_slider_set_value(slider1, 40, LV_ANIM_ON); /*Set the current value (position)*/ ``` -The API of the object types are described in their [Documentation](/widgets/index) but you can also check the respective header files (e.g. *lv_objx/lv_slider.h*) +The API of the widgets is described in their [Documentation](/widgets/index) but you can also check the respective header files (e.g. *widgets/lv_slider.h*) ## Working mechanisms ### Parent-child structure -A parent object can be considered as the container of its children. Every object has exactly one parent object (except screens), but a parent can have an unlimited number of children. +A parent object can be considered as the container of its children. Every object has exactly one parent object (except screens), but a parent can have any number of children. There is no limitation for the type of the parent but, there are typical parent (e.g. button) and typical child (e.g. label) objects. ### Moving together -If the position of the parent is changed the children will move with the parent. +If the position of the parent changes the children will move with the parent. Therefore all positions are relative to the parent. -The (0;0) coordinates mean the objects will remain in the top left-hand corner of the parent independently from the position of the parent. - ![](/misc/par_child1.png "Objects are moving together 1") ```c -lv_obj_t * par = lv_obj_create(lv_scr_act(), NULL); /*Create a parent object on the current screen*/ -lv_obj_set_size(par, 100, 80); /*Set the size of the parent*/ +lv_obj_t * parent = lv_obj_create(lv_scr_act()); /*Create a parent object on the current screen*/ +lv_obj_set_size(parent, 100, 80); /*Set the size of the parent*/ -lv_obj_t * obj1 = lv_obj_create(par, NULL); /*Create an object on the previously created parent object*/ -lv_obj_set_pos(obj1, 10, 10); /*Set the position of the new object*/ +lv_obj_t * obj1 = lv_obj_create(parent); /*Create an object on the previously created parent object*/ +lv_obj_set_pos(obj1, 10, 10); /*Set the position of the new object*/ ``` Modify the position of the parent: @@ -77,7 +76,7 @@ Modify the position of the parent: ![](/misc/par_child2.png "Graphical objects are moving together 2") ```c -lv_obj_set_pos(par, 50, 50); /*Move the parent. The child will move with it.*/ +lv_obj_set_pos(parent, 50, 50); /*Move the parent. The child will move with it.*/ ``` (For simplicity the adjusting of colors of the objects is not shown in the example.) @@ -89,28 +88,27 @@ If a child is partially or fully out of its parent then the parts outside will n ![](/misc/par_child3.png "A graphical object is visible on its parent") ```c -lv_obj_set_x(obj1, -30); /*Move the child a little bit of the parent*/ +lv_obj_set_x(obj1, -30); /*Move the child a little bit off the parent*/ ``` -### Create - delete objects +### Create and delete objects -In LVGL objects can be created and deleted dynamically in run-time. -It means only the currently created objects consume RAM. -For example, if you need a chart, you can create it when required and delete it when it is not visible or necessary. +In LVGL objects can be created and deleted dynamically in run time. It means only the currently created (exisiting) objects consume RAM. -Every object type has its own **create** function with a unified prototype. -It needs two parameters: -- A pointer to the *parent* object. To create a screen give *NULL* as parent. -- Optionally, a pointer to *copy* object with the same type to copy it. This *copy* object can be *NULL* to avoid the copy operation. - -All objects are referenced in C code using an `lv_obj_t` pointer as a handle. This pointer can later be used to set or get the attributes of the object. - -The create functions look like this: +It allows to create a screen just when a button is clicked to open it. A delete the screen when a new screen is loaded. +Or the UI can be created based on the current enviroment of the device. For example create meter, charts, bars, slider etc according to the currently attached sensors. + +Every widget has its own **create** function with a protype like this: ```c -lv_obj_t * lv_ _create(lv_obj_t * parent, lv_obj_t * copy); +lv_obj_t * lv__create(lv_obj_t * parent, ); ``` +In most of the cases the create functions have only a *parent* paramter that tells on which object create the new widget. + +The return value is a poinr to the created oject with `lv_obj_t *` type. + + There is a common **delete** function for all object types. It deletes the object and all of its children. ```c @@ -118,27 +116,24 @@ void lv_obj_del(lv_obj_t * obj); ``` `lv_obj_del` will delete the object immediately. -If for any reason you can't delete the object immediately you can use `lv_obj_del_async(obj)`. +If for any reason you can't delete the object immediately you can use `lv_obj_del_async(obj)` that will perefome the deletion on hte next call of `lv_timer_handler()`. It is useful e.g. if you want to delete the parent of an object in the child's `LV_EVENT_DELETE` signal. -You can remove all the children of an object (but not the object itself) using `lv_obj_clean`: +You can remove all the children of an object (but not the object itself) using `lv_obj_clean(obj)`. -```c -void lv_obj_clean(lv_obj_t * obj); -``` ## Screens ### Create screens The screens are special objects which have no parent object. So they can be created like: ```c -lv_obj_t * scr1 = lv_obj_create(NULL, NULL); +lv_obj_t * scr1 = lv_obj_create(NULL); ``` Screens can be created with any object type. For example, a [Base object](/widgets/obj) or an image to make a wallpaper. ### Get the active screen -There is always an active screen on each display. By default, the library creates and loads a "Base object" as a screen for each display. +There is always an active screen on each display. By default, the library creates and loads a "Base object" as a screen for each display. To get the currently active screen use the `lv_scr_act()` function. @@ -149,9 +144,9 @@ To load a new screen, use `lv_scr_load(scr1)`. #### Load screen with animation A new screen can be loaded with animation too using `lv_scr_load_anim(scr, transition_type, time, delay, auto_del)`. The following transition types exist: -- `LV_SCR_LOAD_ANIM_NONE`: switch immediately after `delay` ms -- `LV_SCR_LOAD_ANIM_OVER_LEFT/RIGHT/TOP/BOTTOM` move the new screen over the other towards the given direction -- `LV_SCR_LOAD_ANIM_MOVE_LEFT/RIGHT/TOP/BOTTOM` move both the old and new screens towards the given direction +- `LV_SCR_LOAD_ANIM_NONE`: switch immediately after `delay` milliseconds +- `LV_SCR_LOAD_ANIM_OVER_LEFT/RIGHT/TOP/BOTTOM` move the new screen over the current towards the given direction +- `LV_SCR_LOAD_ANIM_MOVE_LEFT/RIGHT/TOP/BOTTOM` move both the current and new screens towards the given direction - `LV_SCR_LOAD_ANIM_FADE_ON` fade the new screen over the old screen Setting `auto_del` to `true` will automatically delete the old screen when the animation is finished. @@ -168,28 +163,43 @@ Visit [Multi-display support](/overview/display) to learn more. ## Parts -The widgets can have multiple parts. For example a [Button](/widgets/btn) has only a main part but a [Slider](/widgets/slider) is built from a background, an indicator and a knob. +The widgets are built from multiple parts. For example a [Base object](/widgets/obj) uses the main aand scrollbar parts but a [Slider](/widgets/slider) uses the main, the indicator and the knob parts. +Parts are similar to *pseudo elements* in CSS. -The name of the parts is constructed like `LV_ + _PART_ `. For example `LV_BTN_PART_MAIN` or `LV_SLIDER_PART_KNOB`. The parts are usually used when styles are add to the objects. -Using parts different styles can be assigned to the different parts of the objects. - -To learn more about the parts read the related section of the [Style overview](/overview/style#parts). +The following predefined parts exist in LVGL: +- `LV_PART_MAIN` A background like rectangle*/ +- `LV_PART_SCROLLBAR` The scrollbar(s) +- `LV_PART_INDICATOR` Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox +- `LV_PART_KNOB` Like a handle to grab to adjust the value*/ +- `LV_PART_SELECTED` Indicate the currently selected option or section +- `LV_PART_ITEMS` Used if the widget has multiple similar elements (e.g. tabel cells)*/ +- `LV_PART_TICKS` Ticks on scales e.g. for a chart or meter +- `LV_PART_CURSOR` Mark a specific place e.g. text area's or chart's cursor +- `LV_PART_CUSTOM_FIRST` Custom parts can be added from here. +The main purpose of parts to allow styleing the "components" of the widgets. +Therefore the parts are described in more dteal in the [Style overview](/overview/style) section. ## States The object can be in a combinations of the following states: -- **LV_STATE_DEFAULT** Normal, released -- **LV_STATE_CHECKED** Toggled or checked -- **LV_STATE_FOCUSED** Focused via keypad or encoder or clicked via touchpad/mouse -- **LV_STATE_EDITED**  Edit by an encoder -- **LV_STATE_HOVERED** Hovered by mouse (not supported now) -- **LV_STATE_PRESSED** Pressed -- **LV_STATE_DISABLED** Disabled or inactive +- `LV_STATE_DEFAULT` Normal, released state +- `LV_STATE_CHECKED` Toggled or checked state +- `LV_STATE_FOCUSED` Focused via keypad or encoder or clicked via touchpad/mouse +- `LV_STATE_FOCUS_KEY` Focused via keypad or encoder but not via touchpad/mouse +- `LV_STATE_EDITED` Edit by an encoder +- `LV_STATE_HOVERED` Hovered by mouse (not supported now) +- `LV_STATE_PRESSED` Being pressed +- `LV_STATE_SCROLLED` Being scrolled +- `LV_STATE_DISABLED` Disabled state +- `LV_STATE_USER_1` Custom state +- `LV_STATE_USER_2` Custom state +- `LV_STATE_USER_3` Custom state +- `LV_STATE_USER_4` Custom state The states are usually automatically changed by the library as the user presses, releases, focuses etc an object. -However, the states can be changed manually too. To completely overwrite the current state use `lv_obj_set_state(obj, part, LV_STATE...)`. -To set or clear given state (but leave to other states untouched) use `lv_obj_add/clear_state(obj, part, LV_STATE_...)` -In both cases ORed state values can be used as well. E.g. `lv_obj_set_state(obj, part, LV_STATE_PRESSED | LV_PRESSED_CHECKED)`. +However, the states can be changed manually too. +To set or clear given state (but leave the other states untouched) use `lv_obj_add/clear_state(obj, LV_STATE_...)` +In both cases ORed state values can be used as well. E.g. `lv_obj_add_state(obj, part, LV_STATE_PRESSED | LV_PRESSED_CHECKED)`. -To learn more about the states read the related section of the [Style overview](/overview/style#states). +To learn more about the states read the related section of the [Style overview](/overview/style). From eaed66057bada58f91aa724a2e9edd2d23ac7a97 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 23 Apr 2021 10:35:36 +0200 Subject: [PATCH 049/152] refactor(style) rename LV_STYLE_PROP_ALL to LV_STYLE_PROP_ANY --- docs/misc/boxmodel.png | Bin 0 -> 14553 bytes docs/overview/object.md | 16 +- docs/overview/style.md | 256 ++++++++++++++-------- scripts/style_api_gen.py | 456 +++++++++++++++++++++++++++++++-------- src/core/lv_obj.c | 2 +- src/core/lv_obj_style.c | 18 +- src/core/lv_obj_style.h | 7 +- src/misc/lv_style.c | 3 - src/misc/lv_style.h | 3 +- 9 files changed, 557 insertions(+), 204 deletions(-) create mode 100644 docs/misc/boxmodel.png diff --git a/docs/misc/boxmodel.png b/docs/misc/boxmodel.png new file mode 100644 index 0000000000000000000000000000000000000000..be3fe4f3ef7514e8a2ed8bf6637b4ff030721b2b GIT binary patch literal 14553 zcmbum1zc3$x;KsmA|N6yr63{F-Keybf|R7x5YjL(#31scOF+7m?w0Ouqv^7U81PO>2JgX>2N)O_cyh9mDi|2IPQd$x z`rdb$!*#zr=v41L*_#V$HfS0e3SU_<&RZQ6 zLE`f9@#)mN9yfgM?TLB`P6U@d@Y=CdS0|bGyb;x{g=W0*c_1JxtXgevf^gkt9Y_{U zFp8^oSXZfqS_Mnf(ZBuv!+9SeDI;^UT1R{Mh&w=}#Trp(URqYhjk>tdW~Jb_PV62S z7`Pi-@p;Oyghf#+SaF&>^fDiUcJJwwzjUS ztsSX%b2cSWV!5{V?yZUuEUxjW&M&ynFYq0nd}1 z4>^x}W7s>VrsAZ6NQjwitgi+9494@d&d$!j;R7VnXsXnNq_cf~o`#f^G?Yf%x+GN4 zVaqfLcihv}QEG5UPBGFN+J5@MY85p#EA!A8pO5xv+c zV`w6xqDtDYtFEs11R>d9LbW!SVl!}YvEP_5J2$8J%W{G*BRxGd&oRniZ zyl_a_e%ClzhEfW?F*KwVhVCqk7icGnz=jiT`eHfrHA`-P0mC)misOh==t~iwH}n7# z4%r&bk(81mprILzAr+Qvq4C=_~j zey&pIVuxHky`0t8Z-k3dQ&Z>bR6iCM7k@y^ELmpSfB(S)=HC?!rwF&B?TN6*^lumT z_6CYSwf;FdVPIj&Z@Qo%CT{;J;aBCf9WBTzC`j(+=C-rDTW}~WES!K`;oq-6+M7#g z_Qq08mBbDte%bNm)}4)+N_G$o=xv->1cqLBbut4c(3{U{+V*JUJ;+Nk)%L57Z-SVL zgJ!D-8!RW-f-bfzuMWiAlujoc98Pw$wkC?gYHMqyYEn{Y=;fpPPNCq-qs#>$B|T?g zSc6f4;A}JI3QtVz3#XIW7|y`ahok7dG4V?8cWrKNre|eoM>SHV+hFZpuGGhX@2yp2L{T91p945Q9ap>QdpNvY!d!ysp@5uj-9xFOg21#K5F0s;c=VqqCs zS|%8M>&K7m{=Uy8oi@bWZ@@uhrmLi+bcRBe*e<@QtFLEeSd4n1iuq+EOIbTg*lCLh z1LT~3XT-&3S2&$cmF=xBX)<9EadA0>T9RJ6&$ZK}LpYvp zNMBW+dW_|&k-(OhmL^M#u)rqDayeK+4Y;uj)@$uU<0~sG1zDdx^J;2(B_b+HE(~R< zh3*=TX21WBk(UYz2@Pkzr+Y{((gl)>`Dix5!-o&oR(UPQ)6Irb-A|?!a(m#pS$cn43@kw#tLo(0p0Cl?oUL_|c$%E}tt zTwj6wWP7kA^@P{Lcwh!3VGus#{MMAOU%yVz%(P$YBd>AZSF*R~0!zyB4&fHZZ$q8p zaYD|?$=TM?!DZ4z)NsD_GLYznp`A~zzEfQ!D<-mUAN+kYqAawE?fVy7%O#|?KkF%v!1Q`WN&X@v%PFB zSPv_7+8$?MXD@Qw(=XDixA#CM=H=yWPUw4r(qq5UMTtB=JBwXfUdBm0wGOLw+8ka@ z4y*M*_VcTUF?MuzCe+o{DS#Z!sax-=##rW0?Mzsbhgt zu`yy98JXMn{&05 z=t*ocVD8GNA_y1PtaIUHZ@lEvuK3(-XIkff>A_G^yy%~fmg5peEZ)&|NBGf3l?G*#K*!Osz2%|JjHxM z2Fb>+9pB)+puKT8uSpR34yCGkRo3J~V(yc;oAbV!%)@PTd5rDXn5^fwC=)~E0C%7E z0R>h|;UmHr$+!p~bJT}>zDMT4&M^EuE(h<2oK~-y7zf%H*Op{!qoc^htLW)PbVq;C zKG>nf*Hf_^ry;`0&D1kIz*4{!LO{>!t9?M=qoWmFa1-?3;fp13A*2x@!XJjRlD_^ zA%oN7Q?{VZ$|^j}W<@HGIZ!ljy-yPdG%w&#x+R09DsD38MRrbNW8^onuT}dS74;X*w zIt7P9KO8c*9GWNDaZQ()DNc%RUo2nuf3(L)QRn7RrwN-cE7PjroK0k>qrdXo?PZ(v-{lv#X^Wo6j;OnP1`|S-Wt9h8&iwKQQQdC*IO;T?x@&~JE?258>y8i~ z-;%N`AQ|iJ3oKXhQAOKf!z0|NE0vQj${$7vxoajrKgHbII1Db5ic6&);IY|gUrU03 z8B28;dUKi&IT_a1`h}`OIiKZdy5efK7L?<Euf(n_i znm`+Scrc=aGQpUDQ?+fJevG}dl(KEHtRGG{51IJoF!j>d*mO0oP&_o9%A-^DSHA+3 zCU_;`U>Dm=V=i%BWmFNvy)K_|RITvc-7i6&8^*K!@hM6ii>>46YYtr?jE0LVCa0f} z2|#f`&|&;xULKfL7Peh+!S(L2p{M6fYP!xtFSW4><7cbm!EgSzYeo1N`se(>1_$f; z?y$QXH|~rZgXY9MxGYjsd6cQUG$+Y?{C5zT=PD9tx)q^~7|pQn_fgyvn(EJb6X#Zp zcFw$|_R<=cxg=TN%I@?(aV6lX4^pc~uj+pN$@42$-t@n+aP|tNeXnYOFp|l-| zkh$?lmnw2Cl!=CgdUs)-+|}V-#qGnG8FpsAa0!C5Nt z(_Z!&bB+-~vyd7h_Ap!sqnm~L3+WWn?Zb}~LTg8;yocQU8~mZk!HXUJ+9W1yGV?q) zH&b2PJeKdMoi);=s2g+JUo4u#rUb=d`n^SkK0!MVSuNoCqla&RyU2;+jUZuW0$1eNv5&2>0C z%gKWtYVOcArGK(QnNMh)T)T#gv5#jM&E$g4nrL#>j{DCsBkD4(qMGdnT+m(MlXhXR zO@_%@4t3;<{h9A6b<#51?@O8u>K}SH+v?BscbkRjk1erW*3s4COP4xIR0$TxywD>1 z0-osL_@JE0`C`~}N~Q4hN|RcUy5Fal|H}^SQCyr>4KDj3#zxUwYV&y(amj;JpUIjH z`lW{r%I5(;jgzPcri*UpAG*dktiPHhE@VvqnC_S4UlPBYoKokh)?T_tdB0YnC8dy0 zGBJ?;d`my?<;z~lkFE>>-R5iMnDC5Sn#aqWL3MTq-8++>$@UpKNFKX~2HVLF)tRuE zS_gdb#WmL37e&n@t#O=pw2Lnco~LE*j$*TbOlsIaFn~!4!FnJl`0blZ5Z;W^@O~ss z!J+7U&4UR-mCf`0C`wUs2^IS%&wi5LcX1xm@43)GA3We!*+h8q5@Z?5Dak#YLZ zfy731LY9;32MgRNG9hf!ZsUG(tOs(0e~7$cPvyngR;@P(W>#y7Bl3m-WK3b1i;9eI z!^mHtkZ?iQ*q}SYMTD9w@SB8ekS4X(A-SBNPNc z3Yp#@x%f98_3}$y-U#0>-R~YGp9#J4V@D1*{h~yiF-VCfI&lS=wXxk!JLiXN2w#6^ z-}UwOW*uWDHW}Z5Y)<5Psp;YKGroyFP3>*WT~z7vYGHfm2+w>X&br}MU$5weyjBAj z!PXiNB26v~lz)b$qf5DYp3e@Bzux)vJP+Gl5cOHsvIEaT&ZAL<2x`~V+#KCQ9Qfx% z{#c;yfHgV${V?r~KfM3UqR(M8TL%{lOIsvJU?k6h^-c6~kE%!I@$UPW92#*&pVGa_ znVENK_MFiQdy+*1Q~QVF@HOTuF;uv;Q!iJpr-Or_vj&}fR^6+kF-ceasUL(|D`H%+ z3aGdT&rzR*kR?xEKVUhFnKvJE;M_lkN3i==cw|>t9ZYlRk(Y<2kR1I8X{>xWF8++{ zA3fGyj94pwiTT9~!{rG7AZ63JXu>)!7f}qVnGf&p1jr_DQrC7#7|h$moViXt%R6Gb z$(1hi)w6g?Fyybh^8T>@?8MPRJ8GEzfsu`kcUTM--8rvOcRJ~)0Br<&P3JWR_`bgg zSM#gWNnUhI_)j#}f4u#dQN#oUD2l(|=3!HTb|o3W9)Nvn0)$GsEP;^oUSEk(C(Gd~H0%mA=8oIr zc>MhQfLp-6fB&hFP&}YER2tz|l-oMxW&{ll4FW$4uw4pCLQ&b-OaS1JbDQEaL9mm+S^xr6&B08IWa_rnXokN73&LXQEUre9axYExBVeNTq5^Bwfb_}AVgYPS{yO`{Xs-{ z9$jDTC&*NJUb8cHhEgqqwFMhUJLC^3n~v<;w-4;>?5f9|_htpR#_}K!w<^c7-+Kc# zWKA>Ed?XW;K;{omIXT}$zWDny72goUVD7A}th04%=giwbN<(yepOdGtJwkezg!RR;& zNB`;FHG_Py=hlKNx2_Xxr}r{=|Ag`PLppQlQF0Ddj8o)gMj1@YZriNY5< z`+~-MfG8}3Ax#}z3qJlrkMrc@+#kiAdtWyy1@_jD*$<~E8-5^;34T(6um6N z1BqeleJGb`D_qEa;6(QOj9A!IEcvrb=fj7{{YlI2K7FUyIV?JCU8GQ<50w)%NaS{D zslsOj%op|&z6^>mC_hZ9r5vm&xlP~1LJrvW!;P}w(_h~yB?h(jw}(SnUvk53<=?v0 zWWQeBrzx44nJF_LVaQZUdJFhyTPU<+Y%EI1X^R6O{02ZB)kd>_EN4Pv=e^lDG-lW2#2Hh*97-vff`ec`z>SC}W!PXlONQbA6 zJJ)K0QY+{r9;chNqicy=c4{6y%`73CHF#= z=#c5?Rpm2BCnj#Uf%Kc6>rq(YzXo<2C#NSlJeQCn^O+A~QXg+{U%J5&7s3FWLHe4a z@8MuZNpC+jZ@X>;oEHsX*CaoGW&ztWU%N6?Ll1WEODL7_HTP{*SB5NjV@H>{aM@{I ze^TXvkFPG~k6!MEXbo{^oU6gsQFU5&=cqqjIPK4m z{jl)lu^X5!$N{q$cZ-xTHnT-_@D@?A-fHsWEEc zJDX~i`z6=vWzW!J>%$KRMQ?u6`cx5kc;_|h(>p3Mb-aEbxsy;ypTz^fxaTz<3@;>@5*!m9l})g(yeSHN-Q zeQUk??rBa-!Sc;V*hAPvYa_O!<;$Sfc^U>6YmRmN6vh`~0TE*K<_FR^A5TjX`_4P90)m2# zkl*{;5(5@jbJ#~Nf33j~S(l@zs&`p>)Z0yZjc^b3BE73Hk*A`-5drwU!>kOCah3&2U`h7 zZ*UK-m2bxs5nd{CEY7r$SGzqQ*c%`*fwCj|5hiZ?j!jBZoEKwLRWbHiA4e=s^SS9n zz1fp*z7jrT+yk5X&-S^#Ac=c$m@`}=ogqkSj%FjRDC2Q@unjpI zO=I7ZSCAluYcw7q-*1n)Rkz0{MYGCbgRZ}eEhToScBlBnFY*PZ6qW+YxxWC}UI1HT$G(Jz-3z;bveCtXs{dlKm;$u@*5sGF)Md%NxImwYeMr3Oz= zvT02}$E2Sp0y#-(Hs;cDPx}$*Nt}1=;tG50z{a5Lq$dWC17!eV+kb^{Hq@alY}eh_ zPI4}@9AbkG%y+l@2c^%-mS{q+dYtku$F$XNdN01u3ytLr?u}wu1saTnb&~Ckd`NPA zZ{Qg#)y}|aH=yV1Q8H(t^@$XV0nf_vTDPH`q7`A@l5H-Gy<;Od@gpJz%X|Lw(PV|u z)Dsi*R#0tBOwIKi6N%ye)`*X@>T-j?SUD(o1cP}AE;H9r)HhwcE=V zOd3~8$LN89N5-8Jd9F;j5vax_ZLIm6Kh;_@c-lsCexW5C2Q0zbMbK9a%!C~-&xZ7e z?@I0Ez+x?p6f5`BJguSGQ-@eX-D~emEEOKb&0`f!>j_i~eKN9a{Tbqy&rmg|2tV0` zkL4)U3mx01+;)?e#suoO=TizE&}NHWpAAsV0D<`IWX5I+$c3PhSD*iMlZ7UdB+k#d z(~CTld+UfbV=8ZNZ?Rl^XBP38%xKIA)ZVb9C4^)3$2zU~lxLde78&wi(IrTR1_&GFapKVLd=>StTVL`8$}tA=qHKOdBj42Rr~ zWkvSwn+J@iiN@U*@`q~9@Y7BB=s(6;3p@uC6EUQEE?(##ph2mqs_uWx1Z}HA9M@_g zjFyg$T-22Z=xIPuO+iac@-b{fpsA>^n(1f@AOwIUI5d8x2VtgsqjnW{*b`0Scho2ycw*&p~M=eT}i`D?_j!JfLM|4FTHd<42Fa44I{?WV~h3Z=i%g zASA3G9S5CQ^yx7vyD8L)rDc`N^}PE-%VpFq zqKiHt$#%3z_lz;iTr}^(JO;K;>j!4*{v6LqR;Xbx3TlRxMw*D$+Knz;;l zd{}~>3WDxWe>}v+ZZ9t{OITQJ>F$@f!C>JL5pUkSxs5;|9QP4P0C`}f9Smfofu)XS z*H@C1yxY(aO&7hM>=sG`Kl9qyFbgDQhfg$JANI13{Ib+gFD!@CoL!=jn`3#T80&*6 zSxQMlE-=_ZFMA`fEnws0X90%?u(+fEI1kiV?FDEx4UHG<+jTdM7XfT?<%A&CkAZB1 zjw9^Uzy9e!iny|Z0&Y%D4gjhghHdvhmYcnP+mqC(!=_tfyvKB@wc0bqPT8G<{1yo$ zP7b>z$<)+T|A2r`hb!HaQ&XI_3$Kt?cm9p&ey#EjP#!25OsIGBD*!|81GN+c1hByn z0&MH^fOxXfh6c37{OgKJN*xFUwVT^^Tps|)Ya+0rT4x(fd}@V&$Mj49mZu)tzzzXG7b%8->k$(G z%0g%gz)Ms-lv=b0JP0d83$NL4j4x_=>RKxyK|w%Lr~1yWe_cqper*QKNPtCkb4wTj zaQZ$jZrjL6Bp_Q#f#5G4@+5;>LQ;}i4*xQ$wAB}{)r{xx5;>@vqe8EuqJoyPL2k)Hc;9(@JS0r)+~01w<9)_k;-K}($jHb|z)~b{CxID?da04AQKSdxmuMEP7T~Cn z3a6Dan?4#4j=nhBY(*j0f%63iVBn?7dAQNeWJ$U8Ts&|gY~vCTgv-43qH(qyPR9ng zeZWo&AW#9@rxy<1HgyM>z`M}TsSh4*s==eS-2?ePO`6kwMK-SvZ05gweV6w3;1jzw zS5?|T%FUO)Hb7O)%vL+VmP7c-gdCZ`RNO128O&47dI;<&lw$6&slazqWp`Ya;6Iz$ zIk&QZ*u>uMdA^wyOu-)tQ2F~R+fRu}NjcyP;JYSZCe$$(0PIxi8y1G(fVLp^%B>i5$ic||CvS3sW(N}Nh7w3@&p7C53P4zZ(W^E6IClZryrF$H^96abqnHdRNWWDM3$0 zZBuJ>g;BCr8ok!As(}v^S3b7Bhgdt4KgcI9^DRzksUmkH1dS4p%ge$H(<#Ut~j zcxYX$gAUrAG9~Z1I#0*vaPmgP+&u2Dl)#M6FT5<89%LB8!W0b&v)FFJ6oAWTI95M_ zaI`9Sa2Xsa^W^A<-Zad7z>AZ4DW=!la*ZR{fE2*y#7<|(v_II8QV-MVk0mjxigJ8; zIxy)LRN~O(5#MvJJb~O5o=2a+HOvK`DpEHH%Gt2%qVibf0p+L+FO^i+*GGl=)k>z) z3=?d6%blCzhp>ym0R zS?Bq|b_xG9@+7q~&cW&-VW?75r4Rd1RvHREe0pyh5t3rHB0Y*{A+DXkiPg!mK26y{ z^`w(-iM%t9`94dJXp)}B)j6*f-J`XP_!vsza4!5}+?+|H26_lKcD=#C z1S-zrX!m_sToC^6wJ3V9fF_76DkhDOF&fCUnGNeYu4Cd{-aKDzIsU{4!td9sh3+cd zzY9=nzFJ)R*>jR3{iYy7y|$5F?#^T1!Uy!+qLC*wSQsPi(2Ot$O<`h{VM*vhb#vX?~_KxLehhpxL(?3oS@i=xk86!$|S6H`z>Ij)QuNEU!hK1%3x@Fd3Mm)QFtuvD-}NxK4H}r1V+m8q}YGbp~N`d#1@>de|+BKE=AXP z@oZ}}=yvVOLf3&An@+>6rlH6ZV^h-VKhu2^ zdo`hFy;DiWOHujy*&kZ6?qW=^>E3B7t7EK(95ZmSM3~U9(y`KqXchIfG~^sr>)iI5>-MGor*m{86bkIn`0nWMf%LK`E3X$J@JyM z2QJrF&v8?T`T(Fot<;lPv^A2AHo})J0ctev3X`z4wdY`$my`W;?YTArdMlB)ZnI9J z<}b{_%o;*$t{9E&;}S;Y}OMc7F_q`xr*erj$w&|bWoXO%eV@io4{a?MhF z<=T16iCmAz&{MV_cvDh5>SJQ7o&)VB_Hb9M;e78YwY79SACt|%1muiiK)+^SNsfyA zT#2woY`b?du6D9yzwSxN7l2@6sRfdXSwFe|xxxa75@Coc4U2xC^NBwBfy-9%w!N+W zQ*OG*;GJP@=0BE<2EPK09o`JsL(n`4uq3%ikh?i1Wg>A5W<5P?5m>s6xEpiHUx00(S)!aMi43cv%Y8 z9ViC63gmGjpFQLA%F)fTKWr-Es)wjVHVijt<)iUQ#)14|Ojl1|&%vRSTuMY;{f1Rg z`O0>8;?1r|s1Ieo6R9!9o?qRbpQiKHOAV$sMFYP$FyzN+>MgV2y)7|jW7)KgR6(XY zeY)k=I^k=|t~t-7Km}Etr*?`vKN$JIv>jSskH^bQYSg`=bhM>I@nsoOh!%s*KUA`$ zozKVBt?pSEZ+<8BZ-|%Oe?~F-4fV)@&$ooN)BftvNo@KsT1-jYy!Wteg#y9gDXH;WqNTwL0LFSGSIbAglaxjE#Khr6~`(TC_&j%nVEwA zYt9sV443P+dFB4Q1Q>$WRK?SaOtKnuUhwNZ zsfw;TGv-Y6AWqIWhTRVZABc1qwA9iS`F9Ne0_R-6_f9HXG#Gw&PJVW6N+ za@t^l%e5JB{F!Z92O;Q8So-uYKr0@2cGKYg=`Gctygr6LfDxgI3HN=!mDwB{M6pO@ zU=pa3)B^?l=;o~v@2+2k$O(tYj5^VPgW zJkj2r2~%#@c{8wSFs8z4sZa;^W#A%)YLJD$Ue!^!keX5KW$YoHu%D1f{w{u+C$t-K zfEh)7P3Ru*~g*(*Gr6Ve!fp{h7$7 zL{^w^T(3~A@QCv#{l}?3HsX`B?$4{HzjCz%)RqeEkvf5^W7H@B^6tGjx*N?_~cYXxT^cRp#LomvXrE#>aHwP zWa|K^qu!oin%RiQ$!r$y2vFK&zU^%FNsh0-) zH*4jb+;7hISE$rs=-jdqKViqZlPw+P$Nx9M{><-phD*54mhaS-b4Dn29D)MQ=zt#PP1Q20q5k3 z=VlIL&tsl?oLz0TOa(a&w2`hzC)jSk^6rA^FslRN-%2Ee(7|((BD~fP2(GqsiphAy zowM?Iuaa|@%jBf~(vZb9cXD#AGpxSOcAMLsgF3%7I}=SB4VSrn2~?pQ7=ggh-8Gk< z1+m{cwG2+IAp8<)l^Y-P57~#r1myOSx}T)s8jrz5_o#}N#a#C^%6wki@o^a*=E4>y zmJhpSsabq(dlGf`zjf@G7>kTX%S}qN0EC^zEJH2sJc`w~wVO`^&>>yD zIn^DOKhi2EbpFhbzg{ZF6UAjTbPLm?=2+@l?FP(mki~VX9L<5G42nGkvzI`b#mE}$1Xgw63dQJ&wy)oxaa?iXA!VD#SlH;+ zas41|0M9EmZWf2&9Agi6MK34YiE<( z&i zftg)FeX;XPNJsyyV$=gESc4)ln-u+T$k}Ony6Nw-NPU3!E0_40|EWT+=IuXRS~N`u z?zc5}4_}+5%Z%;MT4#?7o~W%<8Vv;}RR@iSy!`k%0hj@T?mzk;wxsd`lrw7B8rLlg z8~D1O7vER})kW2burRdF$!Arlp=?|D(8eTM4`5#;yYVbV%>IyInI~$NvAGz@eSdOw zDrhuQa`VRoT}N9f=F_wN${wb68FfKdfcbw67hm=g`m33)uTf7cuu9l&d5zWj`o_e0 z-=5mhMk7f|-?3$)bA;A2h_RkYZPv#je4;ws1qT?HYDBktBf8lav{n$WPr44s#xEVe z=G=J1pTjc*;C!L!-+A0$!njtKvo@!4NHD-oT=l8c`29oOoWy;cfP&%<22e(m^L2gM zNqrvMoinpTvva(eV5UsNZ$thl3r4$YTzaQDx68v>^e8%BdXFEBe5EcwI92!Vny0`$ zDm?SVRZJ%QA71aPTf?GI0+{hvue}n>{~tM6@HdXd-+Uwg$6ld-VsJ m_s{=iS^AfU!aK)rZVl69Co<>le@6cgLpdoW$-*}VU;h^g*7UIe literal 0 HcmV?d00001 diff --git a/docs/overview/object.md b/docs/overview/object.md index 23599d27f..3fa3d5577 100644 --- a/docs/overview/object.md +++ b/docs/overview/object.md @@ -93,20 +93,20 @@ lv_obj_set_x(obj1, -30); /*Move the child a little bit off the parent*/ ### Create and delete objects -In LVGL objects can be created and deleted dynamically in run time. It means only the currently created (exisiting) objects consume RAM. +In LVGL objects can be created and deleted dynamically in run time. It means only the currently created (existing) objects consume RAM. It allows to create a screen just when a button is clicked to open it. A delete the screen when a new screen is loaded. -Or the UI can be created based on the current enviroment of the device. For example create meter, charts, bars, slider etc according to the currently attached sensors. +Or the UI can be created based on the current environment of the device. For example create meter, charts, bars, slider etc according to the currently attached sensors. -Every widget has its own **create** function with a protype like this: +Every widget has its own **create** function with a prototype like this: ```c lv_obj_t * lv__create(lv_obj_t * parent, ); ``` -In most of the cases the create functions have only a *parent* paramter that tells on which object create the new widget. +In most of the cases the create functions have only a *parent* parameter that tells on which object create the new widget. -The return value is a poinr to the created oject with `lv_obj_t *` type. +The return value is a pointer to the created object with `lv_obj_t *` type. There is a common **delete** function for all object types. It deletes the object and all of its children. @@ -163,7 +163,7 @@ Visit [Multi-display support](/overview/display) to learn more. ## Parts -The widgets are built from multiple parts. For example a [Base object](/widgets/obj) uses the main aand scrollbar parts but a [Slider](/widgets/slider) uses the main, the indicator and the knob parts. +The widgets are built from multiple parts. For example a [Base object](/widgets/obj) uses the main and scroll bar parts but a [Slider](/widgets/slider) uses the main, the indicator and the knob parts. Parts are similar to *pseudo elements* in CSS. The following predefined parts exist in LVGL: @@ -177,8 +177,8 @@ The following predefined parts exist in LVGL: - `LV_PART_CURSOR` Mark a specific place e.g. text area's or chart's cursor - `LV_PART_CUSTOM_FIRST` Custom parts can be added from here. -The main purpose of parts to allow styleing the "components" of the widgets. -Therefore the parts are described in more dteal in the [Style overview](/overview/style) section. +The main purpose of parts to allow styling the "components" of the widgets. +Therefore the parts are described in more detail in the [Style overview](/overview/style) section. ## States The object can be in a combinations of the following states: diff --git a/docs/overview/style.md b/docs/overview/style.md index 18030825b..b3d5697c1 100644 --- a/docs/overview/style.md +++ b/docs/overview/style.md @@ -6,32 +6,40 @@ *Styles* are used to set the appearance of the objects. Styles in lvgl are heavily inspired by CSS. The concept in nutshell is the following: -- A style is an `lv_style_t` variable which can hold properties, for example border width, text color and so on. It's similar to `class` in CSS. -- Not all properties have to be specified. Unspecified properties will use a default value. -- Styles can be assigned to objects to change their appearance. -- A style can be used by any number of objects. -- Styles can be cascaded which means multiple styles can be assigned to an object and each style can have different properties.   +- A style is an `lv_style_t` variable which can hold properties, for example border width, text color and so on. It's similar to a `class` in CSS. +- Styles can be assigned to objects to change their appearance. During the assignment the target part (*pseudo element* in CSS) and target state (*pseudo class*) can be specified. +For example add `style_blue` to the knob of a slider when it's in pressed state. +- The same style can be used by any number of objects. +- Styles can be cascaded which means multiple styles can be assigned to an object and each style can have different properties. +Therefore not all properties have to be specified in style. LVLG will look for a property until a style defines it or use a default if it's not spefied by any of the styles. For example `style_btn` can result in a default gray button and `style_btn_red` can add only a `background-color=red` to overwrite the background color. - Later added styles have higher precedence. It means if a property is specified in two styles the later added will be used. - Some properties (e.g. text color) can be inherited from the parent(s) if it's not specified in the object. - Objects can have local styles that have higher precedence than "normal" styles. -- Unlike CSS (where pseudo-classes describes different states, e.g. `:hover`), in lvgl a property is assigned to a given state. (I.e. not the "class" is related to state but every single property has a state) +- Unlike CSS (where pseudo-classes describe different states, e.g. `:focus`), in LVGL a property is assigned to a given state. - Transitions can be applied when the object changes state. ## States -The objects can be in the following states: -- **LV_STATE_DEFAULT** (0x00): Normal, released -- **LV_STATE_CHECKED** (0x01): Toggled or checked -- **LV_STATE_FOCUSED** (0x02): Focused via keypad or encoder or clicked via touchpad/mouse -- **LV_STATE_EDITED**  (0x04): Edit by an encoder -- **LV_STATE_HOVERED** (0x08): Hovered by mouse (not supported now) -- **LV_STATE_PRESSED** (0x10): Pressed -- **LV_STATE_DISABLED** (0x20): Disabled or inactive +The objects can be in the combination of the following states: +- `LV_STATE_DEFAULT` (0x0000) Normal, released state +- `LV_STATE_CHECKED` (0x0001) Toggled or checked state +- `LV_STATE_FOCUSED` (0x0002) Focused via keypad or encoder or clicked via touchpad/mouse +- `LV_STATE_FOCUS_KEY` (0x0004) Focused via keypad or encoder but not via touchpad/mouse +- `LV_STATE_EDITED` (0x0008) Edit by an encoder +- `LV_STATE_HOVERED` (0x0010) Hovered by mouse (not supported now) +- `LV_STATE_PRESSED` (0x0020) Being pressed +- `LV_STATE_SCROLLED` (0x0040) Being scrolled +- `LV_STATE_DISABLED` (0x0080) Disabled state +- `LV_STATE_USER_1` (0x1000) Custom state +- `LV_STATE_USER_2` (0x2000) Custom state +- `LV_STATE_USER_3` (0x4000) Custom state +- `LV_STATE_USER_4` (0x8000) Custom state -Combination of states is also possible, for example `LV_STATE_FOCUSED | LV_STATE_PRESSED`. +The combination states the object can be focused and pressed at the same time. It represented as `LV_STATE_FOCUSED | LV_STATE_PRESSED`. -The style properties can be defined in every state and state combination. For example, setting a different background color for default and pressed state. +The style can be added to any state and state combination. +For example, setting a different background color for default and pressed state. If a property is not defined in a state the best matching state's property will be used. Typically it means the property with `LV_STATE_DEFAULT` state.˛ If the property is not set even for the default state the default value will be used. (See later) @@ -42,16 +50,18 @@ To determine which state's property to use let's use an example. Let's see the b - `LV_STATE_PRESSED`: gray - `LV_STATE_FOCUSED`: red -1. By the default the object is in default state, so it's a simple case: the property is perfectly defined in the object's current state as white +1. By the default the object is in default state, so it's a simple case: the property is perfectly defined in the object's current state as white. 2. When the object is pressed there are 2 related properties: default with white (default is related to every state) and pressed with gray. -The pressed state has 0x10 precedence which is higher than the default state's 0x00 precedence, so gray color will be used. +The pressed state has 0x0020 precedence which is higher than the default state's 0x0000 precedence, so gray color will be used. 3. When the object is focused the same thing happens as in pressed state and red color will be used. (Focused state has higher precedence than default state). 4. When the object is focused and pressed both gray and red would work, but the pressed state has higher precedence than focused so gray color will be used. 5. It's possible to set e.g rose color for `LV_STATE_PRESSED | LV_STATE_FOCUSED`. In this case, this combined state has 0x02 + 0x10 = 0x12 precedence, which higher than the pressed states precedence so rose color would be used. -6. When the object is checked there is no property to set the background color for this state. So in lack of a better option, the object remains white from the default state's property. +6. When the object is in checked state there is no property to set the background color for this state. So in lack of a better option, the object remains white from the default state's property. Some practical notes: +- The precedence (value) of states is quite intuitve and it's somthing the user would expect naturally. E.g. if an object is focused, the user still want to see if it's pressed, therefore pressed state has a higher perecedence. +If the foced state had higer precedence it would overwrite the pressed color. - If you want to set a property for all state (e.g. red background color) just set it for the default state. If the object can't find a property for its current state it will fall back to the default state's property. - Use ORed states to describe the properties for complex cases. (E.g. pressed + checked + focused) - It might be a good idea to use different style elements for different states. @@ -59,7 +69,7 @@ For example, finding background colors for released, pressed, checked + pressed, Instead, for example, use the background color for pressed and checked states and indicate the focused state with a different border color. ## Cascading styles -It's not required to set all the properties in one style. It's possible to add more styles to an object and let the later added style to modify or extend the properties in the other styles. +It's not required to set all the properties in one style. It's possible to add more styles to an object and let the later added style to modify or extend appearance. For example, create a general gray button style and create a new for red buttons where only the new background color is set. It's the same concept when in CSS all the used classes are listed like `
`. @@ -74,105 +84,134 @@ In this case, when the button is released (it's in default state) it will be red When the button is pressed the light-gray color is a better match because it describes the current state perfectly, so the button will be light-gray. ## Inheritance -Some properties (typically that are related to texts) can be inherited from the parent object's styles. Inheritance is applied only if the given property is not set in the object's styles (even in default state). -In this case, if the property is inheritable, the property's value will be searched in the parent too until a part can tell a value for the property. The parents will use their own state to tell the value. -So is button is pressed, and text color comes from here, the pressed text color will be used. +Some properties (typically that are related to texts) can be inherited from the parent object's styles. +Inheritance is applied only if the given property is not set in the object's styles (even in default state). +In this case, if the property is inheritable, the property's value will be searched in the parents too until an object can tell a value for the property. The parents will use their own state to tell the value. +So if a button is pressed, and the text color comes from here, the pressed text color will be used. ## Parts -Objects can have *parts* which can have their own style. For example a [page](/widgets/page) has four parts: +Objects can have *parts* which can have their own styles. + +The following predefined parts exist in LVGL: +- `LV_PART_MAIN` A background like rectangle*/ +- `LV_PART_SCROLLBAR` The scrollbar(s) +- `LV_PART_INDICATOR` Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox +- `LV_PART_KNOB` Like a handle to grab to adjust the value*/ +- `LV_PART_SELECTED` Indicate the currently selected option or section +- `LV_PART_ITEMS` Used if the widget has multiple similar elements (e.g. tabel cells)*/ +- `LV_PART_TICKS` Ticks on scales e.g. for a chart or meter +- `LV_PART_CURSOR` Mark a specific place e.g. text area's or chart's cursor +- `LV_PART_CUSTOM_FIRST` Custom parts can be added from here. + + +For example a [Slider](/widgets/slider) has three parts: - Background -- Scrollable -- Scrollbar -- Edge flash +- Indiactor +- Knob -There is three types of object parts **main**, **virtual** and **real**. - -The main part is usually the background and largest part of the object. Some object has only a main part. For example, a button has only a background. - -The virtual parts are additional parts just drawn on the fly to the main part. There is no "real" object behind them. -For example, the page's scrollbar is not a real object, it's just drawn when the page's background is drawn. -The virtual parts always have the same state as the main part. -If the property can be inherited, the main part will be also considered before going to the parent. - -The real parts are real objects created and managed by the main object. For example, the page's scrollable part is real object. -Real parts can be in different state than the main part. - -To see which parts an object has visit their documentation page. +It means the all three parts of teh slider can have their own styles. See later how to add style styles to objects and parts. ## Initialize styles and set/get properties -Styles are stored in `lv_style_t` variables. Style variables should be `static`, global or dynamically allocated. In other words they can not be local variables in functions which are destroyed when the function exists. +Styles are stored in `lv_style_t` variables. Style variables should be `static`, global or dynamically allocated. +In other words they can not be local variables in functions which are destroyed when the function exists. Before using a style it should be initialized with `lv_style_init(&my_style)`. After initializing the style properties can be set or added to it. -Property set functions looks like this: `lv_style_set_(&style, , );` -For example the [above mentioned](#states) example looks like this: -```c -static lv_style_t style1; -lv_style_set_bg_color(&style1, LV_STATE_DEFAULT, LV_COLOR_WHITE); -lv_style_set_bg_color(&style1, LV_STATE_PRESSED, LV_COLOR_GRAY); -lv_style_set_bg_color(&style1, LV_STATE_FOCUSED, LV_COLOR_RED); -lv_style_set_bg_color(&style1, LV_STATE_FOCUSED | LV_STATE_PRESSED, lv_color_hex(0xf88)); -``` -It's possible to copy a style with `lv_style_copy(&style_destination, &style_source)`. After copy properties still can be added freely. +Property set functions looks like this: `lv_style_set_(&style, );` For example: +```c +static lv_style_t style_btn; +lv_style_init(&style_btn); +lv_style_set_bg_color(&style_btn, lv_color_grey()); +lv_style_set_bg_opa(&style_btn, LV_OPA_50); +lv_style_set_border_width(&style_btn, 2); +lv_style_set_border_color(&style_btn, lv_color_black()); + +static lv_style_t style_btn_red; +lv_style_init(&style_btn_red); +lv_style_set_bg_color(&style_btn_red, lv_color_red()); +lv_style_set_bg_opa(&style_btn_red, LV_OPA_COVER); +``` To remove a property use: ```c -lv_style_remove_prop(&style, LV_STYLE_BG_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)); +lv_style_remove_prop(&style, LV_STYLE_BG_COLOR); ``` -To get the value from style in a given state functions with the following prototype are available: `_lv_style_get_color/int/opa/ptr(&style, , );`. -The best matching property will be selected and it's precedence will be returned. `-1` will be returned if the property is not found. - -The form of the function (`...color/int/opa/ptr`) should be used according to the type of ``. - -For example: - +To get a properties value from style: ```c -lv_color_t color; -int16_t res; -res = _lv_style_get_color(&style1, LV_STYLE_BG_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS), &color); -if(res >= 0) { - //the bg_color is loaded into `color` +lv_style_value_t v; +lv_res_t res = lv_style_rget_prop(&style, LV_STYLE_BG_COLOR, &v); +if(res == LV_RES_OK) { /*Found*/ + do_something(v.color); } ``` -To reset a style (free all it's data) use +`lv_style_value_t` has 3 fields: +- `num` for integer, boolean and opacity prpperties +- `color` for color properies +- `ptr` for pointer properties + +To reset a style (free all its data) use ```c lv_style_reset(&style); ``` -## Managing style list +## Add and remove styles to a widget A style on its own not that useful. It should be assigned to an object to take its effect. -Every part of the objects stores a *style list* which is the list of assigned styles. -To add a style to an object use `lv_obj_add_style(obj, , &style)` -For example: +### Add styles +To add a style to an object use `lv_obj_add_style(obj, &style, )`. `` is an OR-ed value of parts and state to which the style should be added. Some examples: +- `LV_PART_MAIN | LV_STATE_DEFAULT` +- `LV_STATE_PRESSED`: The main part in pressed state. `LV_PART_MAIN` can be omited +- `LV_PART_SCROLLBAR`: The scrollbar part in the default state. `LV_STATE_DEFAULT` can be omited. +- `LV_PART_SCROLLBAR | LV_STATE_SCROLLED`: The scrollbar part when the obejct is being scrolled +- `0` Same as `LV_PART_MAIN | LV_STATE_DEFAULT`. +- `LV_PART_INDICATOR | LV_STATE_PRESSED | LV_STATE_CHECKED` The indicator part when the obejct is pressed and checked at the same time. + +Using `lv_obj_add_style`: ```c -lv_obj_add_style(btn, LV_BTN_PART_MAIN, &btn); /*Default button style*/ -lv_obj_add_style(btn, LV_BTN_PART_MAIN, &btn_red);  /*Overwrite only a some colors to red*/ +lv_obj_add_style(btn, &style_btn, 0); /*Default button style*/ +lv_obj_add_style(btn, &btn_red, LV_STATE_PRESSED);  /*Overwrite only a some colors to red when pressed*/ ``` -An objects style list can be reset with `lv_obj_reset_style_list(obj, )` +### Remove styles +To remove all styles from an object use `lv_obj_reove_style_all(obj)`. -If a style which is already assigned to an object changes (i.e. one of it's property is set to a new value) the objects using that style should be notified with `lv_obj_refresh_style(obj, part, property)`. To refresh all parts and proeprties use `lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL)`. +To remove specific styles use `lv_obj_remoev_style(obj, style, selector)`. This function will remove `style` only if the `selector` matches with the `selector` used in `lv_obj_add_style`. +`style` can be `NULL` to check only the `selector` and remove all matching styles. The `selector` can use the `LV_STATE_ANY` and `LV_PART_ANY` values to remove the style with any state or part. -To get a final value of property, including cascading, inheritance, local styles and transitions (see below), get functions like this can be used: `lv_obj_get_style_(obj, )`. + +### Report style changes +If a style - which is already assigned to objecty - changes (i.e. one of it's property is set to a new value) the objects using that style should be notified. There are 3 options to do this: +1. If you know that the changed proeprties can be applied by a simple (e.g. color or opacity changes) redraw just call `lv_obj_invalidate(obj)`, `lv_obj_invalideate(lv_scr_act())`. +2. If something more complex change happened on a style and you know which object(s) are affacted by that style call `lv_obj_refresh_style(obj, part, property)`. +To refresh all parts and properties use `lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY)`. +3. No make LVGL check all object wheter thy use the style and refresh them use `lv_obj_report_style_change(&style)`. If `style` is `NULL` all object's will be notified. + +### Get a property's value on an object +To get a final value of property - cosidering cascading, inheritance, local styles and transitions (see below) - get functions like this can be used: +`lv_obj_get_style_(obj, )`. These functions uses the object's current state and if no better candidate returns a default value.   For example: ```c -lv_color_t color = lv_obj_get_style_bg_color(btn, LV_BTN_PART_MAIN); +lv_color_t color = lv_obj_get_style_bg_color(btn, LV_PART_MAIN); ``` ## Local styles -In the object's style lists, so-called local properties can be stored as well. It's the same concept than CSS's `
`. -The local style is the same as a normal style, but it belongs only to a given object and can not be shared with other objects. -To set a local property use functions like `lv_obj_set_style_local_(obj, , , );`   +Besides "normal" styles, the objects can store local styles too. This concept is similar to inline styles in CSS (e.g. `
`) with some modification. + +So local styles are like normal styles but they can't be shared among other objects. If used, local styles are allocated automatically, and freed whe nthe object is deleted. +They are usuful to add local customizations to the object. + +Unlike in CSS, in LVGL local styles can be assiged to states (*pseudo-classes*) and parts (pseudo-elements). + +To set a local property use functions like `lv_obj_set_style_local_(obj, , );`   For example: ```c -lv_obj_set_style_local_bg_color(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); +lv_obj_set_style_local_bg_color(slider, lv_color_red(), LV_PART_INDICATOR | LV_STATE_FOCUSED); ``` ## Transitions @@ -182,27 +221,64 @@ For example, on pressing a button its background color can be animated to the pr The parameters of the transitions are stored in the styles. It's possible to set - the time of the transition - the delay before starting the transition -- the animation path (also known as timing function) +- the animation path (also known as timing or easing function) - the properties to animate -The transition properties can be defined for each state. -For example, setting 500 ms transition time in default state will mean that when the object goes to default state 500 ms transition time will be applied. +The transition properties can be defined for each state. For example, setting 500 ms transition time in default state will mean that when the object goes to default state 500 ms transition time will be applied. Setting 100 ms transition time in the pressed state will mean a 100 ms transition time when going to presses state. So this example configuration will result in fast going to presses state and slow going back to default. +To describe a transition an `lv_transition_dsc_t` variable needs to initialized and added to a style: +```c +/*Only its pointer is saved so must static, global or dynamically allocated */ +static const lv_style_prop_t trans_props[] = { + LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR, + 0, /*End marker*/ +}; + +static lv_style_transition_dsc_t trans1; +lv_style_transition_dsc_init(&trans1, trans_props, lv_anim_path_easeout, duration_ms, delay_ms); + +lv_style_set_transition(&style1, &trans1); +``` + ## Properties The following properties can be used in the styles. + + + ### Mixed properties -- **radius** (`lv_style_int_t`): Set the radius of the background. 0: no radius, `LV_RADIUS_CIRCLE`: maximal radius. Default value: 0. -- **clip_corner** (`bool`): `true`: enable to clip the overflowed content on the rounded (radius > 0) corners. Default value: `false`. -- **size** (`lv_style_int_t`): Size of internal elements of the widgets. See the documentation of the widgets if this property is used or not. Default value: `LV_DPI / 20`. -- **transform_width**  (`lv_style_int_t`): Make the object wider on both sides with this value. Default value: 0. -- **transform_height**  (`lv_style_int_t`) Make the object higher on both sides with this value. Default value: 0. -- **transform_angle**  (`lv_style_int_t`): Rotate the image-like objects. It's uinit is 0.1 deg, for 45 deg use 450. Default value: 0. -- **transform_zoom**  (`lv_style_int_t`) Zoom image-like objects. 256 (or `LV_IMG_ZOOM_NONE`) for normal size, 128 half size, 512 double size, ans so on. Default value: `LV_IMG_ZOOM_NONE`. -- **opa_scale** (`lv_style_int_t`): Inherited. Scale down all opacity values of the object by this factor. As it's inherited the children objects will be affected too. Default value: `LV_OPA_COVER`. +| Name | Description | Values | Default | Inherited | Layout | Ext. draw | +|------|--------|---------|-------------|------------|--------|-----------| +| **radius** | Set the radius on every corner | px (>= 0) or `LV_RADIUS_CIRCLE` for max. radius | 0 | No | No | No | +| **clip_corner** | Enable to clip the overflowed content on the rounded corners | `true`, `false` | `false` | No | No | No | +| **transform_width** | Make the object wider on both sides with this value. Percentage values are relative to the object's width. | px or `lv_pct()` | 0 | No | Yes | No | +| **transform_height** | Make the object higher on both sides with this value. Percentage values are relative to the object's height. | `px or `lv_pct()` | 0 | No | Yes | No | +| **translate_x** | Move the object with this value in X direction. Applied after layouts positioning. Percentage values are relative to the object's width. | `px or `lv_pct()` | 0 | Yes | No | No | +| **translate_y** | Move the object with this value in Y direction. Applied after layouts positioning. Percentage values are relative to the object's height. | `px or `lv_pct()` | 0 | Yes | No | No | +| **transform_angle** | Rotate image-like objects. Multiplied with the zoom set on the object. Added to the rotation set on the object.| 0.1 degree, e.g. 45 deg. = 450 | 0 | Yes | No | No | +| **transform_zoom** | Zoom image-like objects. Multiplied with the zoom set on the object. | 256 (or `LV_IMG_ZOOM_NONE`): normal size, 128: half size, 512: double size, and so on | 256 | Yes | No | No | +| **opa** | Scale down all opacity values of the object by this factor. | 0..255 or `LV_OPA_...` | `LV_OPA_COVER` | Yes | No | Yes | + +### radius +Set the radius on every corner. It's value can be in px (>= 0) or `LV_RADIUS_CIRCLE` for maximal radius + +| Default | Inherited | Layout | Ext. draw | +|---------|------------|--------|-----------| +| 0 | No | No | No | + + +| **clip_corner** | Enable to clip the overflowed content on the rounded corners | `true`, `false` | `false` | No | No | No | +| **transform_width** | Make the object wider on both sides with this value. Percentage values are relative to the object's width. | px or `lv_pct()` | 0 | No | Yes | No | +| **transform_height** | Make the object higher on both sides with this value. Percentage values are relative to the object's height. | `px or `lv_pct()` | 0 | No | Yes | No | +| **translate_x** | Move the object with this value in X direction. Applied after layouts positioning. Percentage values are relative to the object's width. | `px or `lv_pct()` | 0 | Yes | No | No | +| **translate_y** | Move the object with this value in Y direction. Applied after layouts positioning. Percentage values are relative to the object's height. | `px or `lv_pct()` | 0 | Yes | No | No | +| **transform_angle** | Rotate image-like objects. Multiplied with the zoom set on the object. Added to the rotation set on the object.| 0.1 degree, e.g. 45 deg. = 450 | 0 | Yes | No | No | +| **transform_zoom** | Zoom image-like objects. Multiplied with the zoom set on the object. | 256 (or `LV_IMG_ZOOM_NONE`): normal size, 128: half size, 512: double size, and so on | 256 | Yes | No | No | +| **opa** | Scale down all opacity values of the object by this factor. | 0..255 or `LV_OPA_...` | `LV_OPA_COVER` | Yes | No | Yes | + ### Padding and margin properties *Padding* sets the space on the inner sides of the edges. It means "I don't want my children too close to my sides, so keep this space". diff --git a/scripts/style_api_gen.py b/scripts/style_api_gen.py index adb41ccd8..56966d80f 100755 --- a/scripts/style_api_gen.py +++ b/scripts/style_api_gen.py @@ -3,93 +3,342 @@ import sys, os props = [ -{'name': 'RADIUS', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'CLIP_CORNER', 'style_type': 'num', 'var_type': 'bool' }, -{'name': 'TRANSFORM_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TRANSFORM_HEIGHT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TRANSLATE_X', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TRANSLATE_Y', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TRANSFORM_ZOOM', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TRANSFORM_ANGLE', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'COLOR_FILTER_DSC', 'style_type': 'ptr', 'var_type': 'const lv_color_filter_dsc_t *' }, -{'name': 'COLOR_FILTER_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'ANIM_TIME', 'style_type': 'num', 'var_type': 'uint32_t' }, -{'name': 'TRANSITION', 'style_type': 'ptr', 'var_type': 'const lv_style_transition_dsc_t *' }, -{'name': 'BLEND_MODE', 'style_type': 'num', 'var_type': 'lv_blend_mode_t' }, -{'name': 'PAD_TOP', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'PAD_BOTTOM', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'PAD_LEFT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'PAD_RIGHT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'PAD_ROW', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'PAD_COLUMN', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'MIN_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'MAX_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'HEIGHT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'MIN_HEIGHT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'MAX_HEIGHT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'X', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'Y', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'ALIGN', 'style_type': 'num', 'var_type': 'lv_align_t' }, -{'name': 'LAYOUT', 'style_type': 'num', 'var_type': 'uint16_t' }, -{'name': 'BG_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BG_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BG_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'BG_GRAD_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BG_GRAD_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BG_GRAD_DIR', 'style_type': 'num', 'var_type': 'lv_grad_dir_t' }, -{'name': 'BG_MAIN_STOP', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'BG_GRAD_STOP', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'BG_IMG_SRC', 'style_type': 'ptr', 'var_type': 'const void *' }, -{'name': 'BG_IMG_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'BG_IMG_RECOLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BG_IMG_RECOLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BG_IMG_RECOLOR_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'BG_IMG_TILED', 'style_type': 'num', 'var_type': 'bool' }, -{'name': 'BORDER_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BORDER_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BORDER_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'BORDER_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'BORDER_SIDE', 'style_type': 'num', 'var_type': 'lv_border_side_t' }, -{'name': 'BORDER_POST', 'style_type': 'num', 'var_type': 'bool' }, -{'name': 'TEXT_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'TEXT_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'TEXT_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'TEXT_FONT', 'style_type': 'ptr', 'var_type': 'const lv_font_t *' }, -{'name': 'TEXT_LETTER_SPACE', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TEXT_LINE_SPACE', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TEXT_DECOR', 'style_type': 'num', 'var_type': 'lv_text_decor_t' }, -{'name': 'TEXT_ALIGN', 'style_type': 'num', 'var_type': 'lv_text_align_t' }, -{'name': 'IMG_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'IMG_RECOLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'IMG_RECOLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'IMG_RECOLOR_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'OUTLINE_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'OUTLINE_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'OUTLINE_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'OUTLINE_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'OUTLINE_PAD', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'SHADOW_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'SHADOW_OFS_X', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'SHADOW_OFS_Y', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'SHADOW_SPREAD', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'SHADOW_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'SHADOW_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'SHADOW_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'LINE_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'LINE_DASH_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'LINE_DASH_GAP', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'LINE_ROUNDED', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'LINE_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'LINE_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'LINE_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'ARC_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'ARC_ROUNDED', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'ARC_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'ARC_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'ARC_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'ARC_IMG_SRC', 'style_type': 'ptr', 'var_type': 'const void *' }, +{'name': 'RADIUS', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the radius on every corner. The value is interpreted in pixel (>= 0) or `LV_RADIUS_CIRCLE` for max. radius"}, + +{'name': 'CLIP_CORNER', + 'style_type': 'num', 'var_type': 'bool', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Enable to clip the overflowed content on the rounded corner. Can be `true` or `false`." }, + +{'name': 'TRANSFORM_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Make the object wider on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's width." }, + +{'name': 'TRANSFORM_HEIGHT', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Make the object higher on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height." }, + +{'name': 'TRANSLATE_X', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Move the object with this value in X direction. Applied after layouts, aligns and other positionings. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's width." }, + +{'name': 'TRANSLATE_Y', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Move the object with this value in Y direction. Applied after layouts, aligns and other positionings. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height." }, + +{'name': 'TRANSFORM_ZOOM', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Zoom image-like objects. Multiplied with the zoom set on the object. The value 256 (or `LV_IMG_ZOOM_NONE`) maens normal size, 128 half size, 512 double size, and so on" }, + +{'name': 'TRANSFORM_ANGLE', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': " Rotate image-like objects. Added to the rotation set on the object. The value is interpreted in 0.1 degree unit. E.g. 45 deg. = 450 " }, + +{'name': 'OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Scale down all opacity values of the object by this factor. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency." }, + +{'name': 'COLOR_FILTER_DSC', + 'style_type': 'ptr', 'var_type': 'const lv_color_filter_dsc_t *', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Mix a color to all colors of the object." }, + +{'name': 'COLOR_FILTER_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "The intensity of mixing of color filter."}, + +{'name': 'ANIM_TIME', + 'style_type': 'num', 'var_type': 'uint32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "The animation time in milliseconds. It's meaning is widget specific. E.g. blink time of the cursor on the text area or scroll speed of a roller. See the widgets' documentation to learn more."}, + +{'name': 'TRANSITION', + 'style_type': 'ptr', 'var_type': 'const lv_style_transition_dsc_t *' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "An initialized `lv_style_transition_dsc_t` to describe a transition."}, + +{'name': 'BLEND_MODE', + 'style_type': 'num', 'var_type': 'lv_blend_mode_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Describes how to blend the colors to the background. The possibel values are `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`"}, + +{'name': 'PAD_TOP', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the padding on the top. It makes the content arae smaller in this direction."}, + +{'name': 'PAD_BOTTOM', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the padding on the bottom. It makes the content arae smaller in this direction."}, + +{'name': 'PAD_LEFT', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the padding on the left. It makes the content arae smaller in this direction."}, + +{'name': 'PAD_RIGHT', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the padding on the right. It makes the content arae smaller in this direction."}, + +{'name': 'PAD_ROW', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the padding between the rows. Used by the layouts."}, + +{'name': 'PAD_COLUMN', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the padding between the columns. Used by the layouts."}, + +{'name': 'WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the width of object. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. Percentage values are relative to the width of the parent's content area."}, + +{'name': 'MIN_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets a minimal width. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."}, + +{'name': 'MAX_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets a maximal width. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."}, + +{'name': 'HEIGHT', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the height of object. Pixel, percentage and `LV_SIZE_CONTENT` can be used. Percentage values are relative to the height of the parent's content area."}, + +{'name': 'MIN_HEIGHT', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets a minimal height. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."}, + +{'name': 'MAX_HEIGHT', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets a maximal height. Pixel and percentage values can be used. Percentage values are relative to the height of the parent's content area."}, + +{'name': 'X', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the X coordinate of the object considering the set `align`. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."}, + +{'name': 'Y', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the Y coordinate of the object considering the set `align`. Pixel and percentage values can be used. Percentage values are relative to the height of the parent's content area."}, + +{'name': 'ALIGN', + 'style_type': 'num', 'var_type': 'lv_align_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the alignment whcih tells from which point of teh aprent the X and Y coordinates should be interptreted. The possibel values are: `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER`"}, + +{'name': 'LAYOUT', + 'style_type': 'num', 'var_type': 'uint16_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the layout if the object. The children will be repositioned and resized according to the policies set for the layout. For the possible values see the documentation of the layouts."}, + +{'name': 'BG_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the background color of the object."}, + +{'name': 'BG_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t' }, +{'name': 'BG_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of the bacground. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'BG_GRAD_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the gradien color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`"}, + +{'name': 'BG_GRAD_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t' }, + +{'name': 'BG_GRAD_DIR', + 'style_type': 'num', 'var_type': 'lv_grad_dir_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the direction of the gradient of the background. The possible values are `LV_GRAD_DIR_NONE/HOR/VER`."}, + +{'name': 'BG_MAIN_STOP', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the point from which the backround color should start for gradients. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on"}, + +{'name': 'BG_GRAD_STOP', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the point from which the backround's gradient color should start. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on"}, + +{'name': 'BG_IMG_SRC', + 'style_type': 'ptr', 'var_type': 'const void *', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set a background image. Can be a pointer to `lv_img_dsc_t`, a path to a file or an `LV_SYMBOL_...`"}, + +{'name': 'BG_IMG_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'BG_IMG_RECOLOR', + 'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set a color to mix to the background image."}, + +{'name': 'BG_IMG_RECOLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t'}, + +{'name': 'BG_IMG_RECOLOR_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means no mixing, 256, `LV_OPA_100` or `LV_OPA_COVER` means full recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted proportinally."}, + +{'name': 'BG_IMG_TILED', + 'style_type': 'num', 'var_type': 'bool', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "If enbaled the background image will be tiled. The possible values are `ture` or `false`."}, + +{'name': 'BORDER_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the color of the border"}, + +{'name': 'BORDER_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t' }, + +{'name': 'BORDER_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opcitiy of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'BORDER_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set hte width of the border. Only pixel values can be used."}, + +{'name': 'BORDER_SIDE', + 'style_type': 'num', 'var_type': 'lv_border_side_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set ony which side(s) the border should be drawn. The possible values are `LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL`. OR-ed calues an be used as well, e.g. `LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT`."}, + +{'name': 'BORDER_POST', +'style_type': 'num', 'var_type': 'bool' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets wheter the the border should be drawn before or after the children ar drawn. `true`: after children, `false`: before children"}, + +{'name': 'TEXT_COLOR', +'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the color of the text."}, + +{'name': 'TEXT_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t'}, + +{'name': 'TEXT_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opícity of the text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'TEXT_FONT', + 'style_type': 'ptr', 'var_type': 'const lv_font_t *', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the font of the text (a pointer `lv_font_t *`). "}, + +{'name': 'TEXT_LETTER_SPACE', +'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the letter space in pixels"}, + +{'name': 'TEXT_LINE_SPACE', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the line space in pixels."}, + +{'name': 'TEXT_DECOR', + 'style_type': 'num', 'var_type': 'lv_text_decor_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set decoration for the text. The possible values are `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well." }, + +{'name': 'TEXT_ALIGN', +'style_type': 'num', 'var_type': 'lv_text_align_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set how to align the lines of the text. Note that it doesn't align the object itself, only the lines inside the obejct. The possibel values are `LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO`. `LV_TEXT_ALIGN_AUTO` detect the text base direction and uses left or right alignment accordingly"}, + +{'name': 'IMG_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'IMG_RECOLOR', + 'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set color to mixt to the image."}, + +{'name': 'IMG_RECOLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t'}, + +{'name': 'IMG_RECOLOR_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the intensity of the color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'OUTLINE_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the width of the outline in pixels. "}, + +{'name': 'OUTLINE_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the color of the outline."}, + +{'name': 'OUTLINE_COLOR_FILTERED', +'style_type': 'color', 'var_type': 'lv_color_t'}, + +{'name': 'OUTLINE_OPA', +'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of the outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'OUTLINE_PAD', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the padding of the outline, i.e. the gap between object and the outline."}, + +{'name': 'SHADOW_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the width of the shadow in pixels. The value should be >= 0."}, + +{'name': 'SHADOW_OFS_X', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set an offset on the shadow in pixels in X direction. "}, + +{'name': 'SHADOW_OFS_Y', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set an offset on the shadow in pixels in Y direction. "}, + +{'name': 'SHADOW_SPREAD', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Make the shadow calcuation to use a larger or smaller rectangle as base. The value can be in pixel t make the area larger/smaller"}, + +{'name': 'SHADOW_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the color of the shadow"}, + +{'name': 'SHADOW_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t'}, + +{'name': 'SHADOW_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of the shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'LINE_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the width of the lines in pixel."}, + +{'name': 'LINE_DASH_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the width of dashes in pixel. Note that dash works only on horizontal and vertical lines"}, + +{'name': 'LINE_DASH_GAP', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the gap between dashes in pixel. Note that dash works only on horizontal and vertical lines"}, + +{'name': 'LINE_ROUNDED', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Make the end points of the lines rounded. `true`: rounded, `false`: perpadicular line ending "}, + +{'name': 'LINE_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the color fo the lines."}, + +{'name': 'LINE_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t'}, + +{'name': 'LINE_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of the lines."}, + +{'name': 'ARC_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the width (ticjkness) of the arcs in pixel."}, + +{'name': 'ARC_ROUNDED', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Make the end points of the arcs rounded. `true`: rounded, `false`: perpadicular line ending "}, + +{'name': 'ARC_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the color of the arc."}, + +{'name': 'ARC_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t' }, + +{'name': 'ARC_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of the arcs."}, + +{'name': 'ARC_IMG_SRC', + 'style_type': 'ptr', 'var_type': 'const void *', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set an image from which the arc will be masked out. It's useful to display complex exxects on the arcs. Can be a pointer to `lv_img_dsc_t` or a path to a file"}, ] def style_get_cast(style_type, var_type): @@ -135,6 +384,31 @@ def local_style_set(p): print("}") print("") +def docs(p): + if "dsc" not in p: return + + d = str(p["default"]) + + i = "No" + if p["inherited"]: i = "Yes" + + l = "No" + if p["layout"]: l = "Yes" + + e = "No" + if p["ext_draw"]: e = "Yes" + + print("### " + p["name"]) + print(p["dsc"]) + + print("
    ") + print("
  • Default " + d + "
  • ") + print("
  • Inherited " + i + "
  • ") + print("
  • Layout " + l + "
  • ") + print("
  • Ext. draw " + e + "
  • ") + print("
") + print("") + base_dir = os.path.abspath(os.path.dirname(__file__)) sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.h', 'w') @@ -148,3 +422,11 @@ sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.h', 'w') for p in props: style_set(p) + +sys.stdout = open(base_dir + '/style_props.md', 'w') + +for p in props: + docs(p) + + + diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index 7dcbe6e3f..6b018b364 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -1030,7 +1030,7 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) lv_obj_invalidate(obj); if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_LAYOUT) { - lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ALL); + lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY); } else if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) { lv_obj_refresh_ext_draw_size(obj); diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index 2c1892354..9faa10105 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -75,7 +75,7 @@ void _lv_obj_style_init(void) void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector) { - trans_del(obj, selector, LV_STYLE_PROP_ALL, NULL); + trans_del(obj, selector, LV_STYLE_PROP_ANY, NULL); uint32_t i; /*Go after the transition and local styles*/ @@ -100,7 +100,7 @@ void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selec obj->styles[i].style = style; obj->styles[i].selector = selector; - lv_obj_refresh_style(obj, selector, LV_STYLE_PROP_ALL); + lv_obj_refresh_style(obj, selector, LV_STYLE_PROP_ANY); } void lv_obj_remove_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector) @@ -121,7 +121,7 @@ void lv_obj_remove_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t } if(obj->styles[i].is_trans) { - trans_del(obj, part, LV_STYLE_PROP_ALL, NULL); + trans_del(obj, part, LV_STYLE_PROP_ANY, NULL); } if(obj->styles[i].is_local || obj->styles[i].is_trans) { @@ -144,7 +144,7 @@ void lv_obj_remove_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t *Therefore it doesn't needs to be incremented*/ } if(deleted) { - lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL); + lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ANY); } } @@ -172,11 +172,11 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style lv_part_t part = lv_obj_style_get_selector_part(selector); - if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_PROP_LAYOUT_REFR))) { + if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ANY || (prop & LV_STYLE_PROP_LAYOUT_REFR))) { lv_event_send(obj, LV_EVENT_STYLE_CHANGED, NULL); /*To update layout*/ if(obj->parent) obj->parent->layout_inv = 1; } - if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_PROP_PARENT_LAYOUT_REFR))) { + if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ANY || (prop & LV_STYLE_PROP_PARENT_LAYOUT_REFR))) { lv_obj_t * parent = lv_obj_get_parent(obj); if(parent) lv_obj_mark_layout_as_dirty(parent); } @@ -185,7 +185,7 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style } lv_obj_invalidate(obj); - if(prop == LV_STYLE_PROP_ALL || + if(prop == LV_STYLE_PROP_ANY || ((prop & LV_STYLE_PROP_INHERIT) && ((prop & LV_STYLE_PROP_EXT_DRAW) || (prop & LV_STYLE_PROP_LAYOUT_REFR)))) { if(part != LV_PART_SCROLLBAR) { @@ -604,7 +604,7 @@ static void report_style_change_core(void * style, lv_obj_t * obj) uint32_t i; for(i = 0; i < obj->style_cnt; i++) { if(style == NULL || obj->styles[i].style == style) { - lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ALL); + lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY); break; } } @@ -653,7 +653,7 @@ static bool trans_del(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, tran /*'tr' might be deleted, so get the next object while 'tr' is valid*/ tr_prev = _lv_ll_get_prev(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr); - if(tr->obj == obj && (part == tr->selector || part == LV_PART_ANY) && (prop == tr->prop || prop == LV_STYLE_PROP_ALL)) { + if(tr->obj == obj && (part == tr->selector || part == LV_PART_ANY) && (prop == tr->prop || prop == LV_STYLE_PROP_ANY)) { /*Remove the transitioned property from trans. style *to allow changing it by normal styles*/ uint32_t i; diff --git a/src/core/lv_obj_style.h b/src/core/lv_obj_style.h index 693cd3d4e..1fdc8ba7b 100644 --- a/src/core/lv_obj_style.h +++ b/src/core/lv_obj_style.h @@ -76,9 +76,8 @@ void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selec /** * Add a style to an object. * @param obj pointer to an object - * @param part a part of the object from which the style should be removed E.g. `LV_PART_MAIN` or `LV_PART_KNOB` - * @param state a state or combination of states from which the style should be removed - * @param style pointer to a style to remove + * @param style pointer to a style to remove. Can be NULL to check only the selector + * @param selector OR-ed values of states and a part to remove only styles with matching selectors. LV_STATE_ANY and LV_PART_ANY can be used * @example lv_obj_remove_style(obj, LV_PART_ANY, LV_STATE_ANY, &style); //Remove a specific style * @example lv_obj_remove_style(obj, LV_PART_MAIN, LV_STATE_ANY, &style); //Remove all styles from the main part * @example lv_obj_remove_style(obj, LV_PART_ANY, LV_STATE_ANY, NULL); //Remove all styles @@ -105,7 +104,7 @@ void lv_obj_report_style_change(lv_style_t * style); * Notify an object and its children about its style is modified. * @param obj pointer to an object * @param part the part whose style was changed. E.g. `LV_PART_ANY`, `LV_PART_MAIN` - * @param prop `LV_STYLE_PROP_ALL` or an `LV_STYLE_...` property. + * @param prop `LV_STYLE_PROP_ANY` or an `LV_STYLE_...` property. * It is used to optimize what needs to be refreshed. * `LV_STYLE_PROP_INV` to perform only a style cache update */ diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index 68bebf13f..c5782ef43 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -237,9 +237,6 @@ lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop) case LV_STYLE_TEXT_FONT: value.ptr = LV_FONT_DEFAULT; break; - case LV_STYLE_SIZE: - value.num = 5; - break; case LV_STYLE_MAX_WIDTH: case LV_STYLE_MAX_HEIGHT: value.num = LV_COORD_MAX; diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index c7cbb972f..08acd87ee 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -126,7 +126,6 @@ typedef enum { LV_STYLE_COLOR_FILTER_OPA = 11, LV_STYLE_ANIM_TIME = 12, LV_STYLE_TRANSITION = 13, - LV_STYLE_SIZE = 14, LV_STYLE_BLEND_MODE = 15, /*Group 1*/ @@ -220,7 +219,7 @@ typedef enum { _LV_STYLE_LAST_BUILT_IN_PROP = 111, - LV_STYLE_PROP_ALL = 0xFFFF + LV_STYLE_PROP_ANY = 0xFFFF }lv_style_prop_t; /** From a9bedcf3355dcaff698fa36b9eb17d442c2ea08a Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 23 Apr 2021 11:34:59 +0200 Subject: [PATCH 050/152] minor fixes --- docs/overview/style.md | 415 ++++-------------- examples/widgets/btn/lv_example_btn_3.c | 2 +- examples/widgets/imgbtn/lv_example_imgbtn_1.c | 2 +- scripts/style_api_gen.py | 6 +- src/core/lv_disp.c | 1 + src/core/lv_obj_style.c | 8 +- src/core/lv_obj_style_gen.h | 16 +- src/extra/themes/default/lv_theme_default.c | 4 +- src/misc/lv_style.c | 2 +- src/misc/lv_style.h | 8 +- src/misc/lv_style_gen.h | 8 +- 11 files changed, 118 insertions(+), 354 deletions(-) diff --git a/docs/overview/style.md b/docs/overview/style.md index b3d5697c1..0024508ac 100644 --- a/docs/overview/style.md +++ b/docs/overview/style.md @@ -4,7 +4,6 @@ ``` # Styles - *Styles* are used to set the appearance of the objects. Styles in lvgl are heavily inspired by CSS. The concept in nutshell is the following: - A style is an `lv_style_t` variable which can hold properties, for example border width, text color and so on. It's similar to a `class` in CSS. - Styles can be assigned to objects to change their appearance. During the assignment the target part (*pseudo element* in CSS) and target state (*pseudo class*) can be specified. @@ -56,12 +55,12 @@ The pressed state has 0x0020 precedence which is higher than the default state's 3. When the object is focused the same thing happens as in pressed state and red color will be used. (Focused state has higher precedence than default state). 4. When the object is focused and pressed both gray and red would work, but the pressed state has higher precedence than focused so gray color will be used. 5. It's possible to set e.g rose color for `LV_STATE_PRESSED | LV_STATE_FOCUSED`. -In this case, this combined state has 0x02 + 0x10 = 0x12 precedence, which higher than the pressed states precedence so rose color would be used. +In this case, this combined state has 0x0020 + 0x0002 = 0x0022 precedence, which higher than the pressed states precedence so rose color would be used. 6. When the object is in checked state there is no property to set the background color for this state. So in lack of a better option, the object remains white from the default state's property. Some practical notes: -- The precedence (value) of states is quite intuitve and it's somthing the user would expect naturally. E.g. if an object is focused, the user still want to see if it's pressed, therefore pressed state has a higher perecedence. -If the foced state had higer precedence it would overwrite the pressed color. +- The precedence (value) of states is quite intuitive and it's something the user would expect naturally. E.g. if an object is focused, the user still want to see if it's pressed, therefore pressed state has a higher precedence. +If the focused state had higher precedence it would overwrite the pressed color. - If you want to set a property for all state (e.g. red background color) just set it for the default state. If the object can't find a property for its current state it will fall back to the default state's property. - Use ORed states to describe the properties for complex cases. (E.g. pressed + checked + focused) - It might be a good idea to use different style elements for different states. @@ -150,8 +149,8 @@ if(res == LV_RES_OK) { /*Found*/ ``` `lv_style_value_t` has 3 fields: -- `num` for integer, boolean and opacity prpperties -- `color` for color properies +- `num` for integer, boolean and opacity properties +- `color` for color properties - `ptr` for pointer properties To reset a style (free all its data) use @@ -165,11 +164,11 @@ A style on its own not that useful. It should be assigned to an object to take i ### Add styles To add a style to an object use `lv_obj_add_style(obj, &style, )`. `` is an OR-ed value of parts and state to which the style should be added. Some examples: - `LV_PART_MAIN | LV_STATE_DEFAULT` -- `LV_STATE_PRESSED`: The main part in pressed state. `LV_PART_MAIN` can be omited -- `LV_PART_SCROLLBAR`: The scrollbar part in the default state. `LV_STATE_DEFAULT` can be omited. -- `LV_PART_SCROLLBAR | LV_STATE_SCROLLED`: The scrollbar part when the obejct is being scrolled +- `LV_STATE_PRESSED`: The main part in pressed state. `LV_PART_MAIN` can be omitted +- `LV_PART_SCROLLBAR`: The scrollbar part in the default state. `LV_STATE_DEFAULT` can be omitted. +- `LV_PART_SCROLLBAR | LV_STATE_SCROLLED`: The scrollbar part when the object is being scrolled - `0` Same as `LV_PART_MAIN | LV_STATE_DEFAULT`. -- `LV_PART_INDICATOR | LV_STATE_PRESSED | LV_STATE_CHECKED` The indicator part when the obejct is pressed and checked at the same time. +- `LV_PART_INDICATOR | LV_STATE_PRESSED | LV_STATE_CHECKED` The indicator part when the object is pressed and checked at the same time. Using `lv_obj_add_style`: ```c @@ -185,14 +184,14 @@ To remove specific styles use `lv_obj_remoev_style(obj, style, selector)`. This ### Report style changes -If a style - which is already assigned to objecty - changes (i.e. one of it's property is set to a new value) the objects using that style should be notified. There are 3 options to do this: -1. If you know that the changed proeprties can be applied by a simple (e.g. color or opacity changes) redraw just call `lv_obj_invalidate(obj)`, `lv_obj_invalideate(lv_scr_act())`. -2. If something more complex change happened on a style and you know which object(s) are affacted by that style call `lv_obj_refresh_style(obj, part, property)`. +If a style - which is already assigned to object - changes (i.e. one of it's property is set to a new value) the objects using that style should be notified. There are 3 options to do this: +1. If you know that the changed properties can be applied by a simple (e.g. color or opacity changes) redraw just call `lv_obj_invalidate(obj)`, `lv_obj_invalideate(lv_scr_act())`. +2. If something more complex change happened on a style and you know which object(s) are affected by that style call `lv_obj_refresh_style(obj, part, property)`. To refresh all parts and properties use `lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY)`. -3. No make LVGL check all object wheter thy use the style and refresh them use `lv_obj_report_style_change(&style)`. If `style` is `NULL` all object's will be notified. +3. No make LVGL check all object whether thy use the style and refresh them use `lv_obj_report_style_change(&style)`. If `style` is `NULL` all object's will be notified. ### Get a property's value on an object -To get a final value of property - cosidering cascading, inheritance, local styles and transitions (see below) - get functions like this can be used: +To get a final value of property - considering cascading, inheritance, local styles and transitions (see below) - get functions like this can be used: `lv_obj_get_style_(obj, )`. These functions uses the object's current state and if no better candidate returns a default value.   For example: @@ -203,10 +202,10 @@ lv_color_t color = lv_obj_get_style_bg_color(btn, LV_PART_MAIN); ## Local styles Besides "normal" styles, the objects can store local styles too. This concept is similar to inline styles in CSS (e.g. `
`) with some modification. -So local styles are like normal styles but they can't be shared among other objects. If used, local styles are allocated automatically, and freed whe nthe object is deleted. -They are usuful to add local customizations to the object. +So local styles are like normal styles but they can't be shared among other objects. If used, local styles are allocated automatically, and freed when the object is deleted. +They are usuful to add local customization to the object. -Unlike in CSS, in LVGL local styles can be assiged to states (*pseudo-classes*) and parts (pseudo-elements). +Unlike in CSS, in LVGL local styles can be assigned to states (*pseudo-classes*) and parts (pseudo-elements). To set a local property use functions like `lv_obj_set_style_local_(obj, , );`   For example: @@ -214,6 +213,20 @@ For example: lv_obj_set_style_local_bg_color(slider, lv_color_red(), LV_PART_INDICATOR | LV_STATE_FOCUSED); ``` + +## Properties + +TODO include properties generated by style_api_gen.py + + +### Typical background properties +In the documentation of the widgets you will see sentences like "The widget use the typical background properties". The "typical background properties" are the ones related to: +- Background +- Border +- Outline +- Shadow + + ## Transitions By default, when an object changes state (e.g. it's pressed) the new properties from the new state are set immediately. However, with transitions it's possible to play an animation on state change. For example, on pressing a button its background color can be animated to the pressed color over 300 ms. @@ -237,349 +250,95 @@ static const lv_style_prop_t trans_props[] = { }; static lv_style_transition_dsc_t trans1; -lv_style_transition_dsc_init(&trans1, trans_props, lv_anim_path_easeout, duration_ms, delay_ms); +lv_style_transition_dsc_init(&trans1, trans_props, lv_anim_path_ease_out, duration_ms, delay_ms); lv_style_set_transition(&style1, &trans1); ``` -## Properties +## Color filter +TODO -The following properties can be used in the styles. - - - - -### Mixed properties -| Name | Description | Values | Default | Inherited | Layout | Ext. draw | -|------|--------|---------|-------------|------------|--------|-----------| -| **radius** | Set the radius on every corner | px (>= 0) or `LV_RADIUS_CIRCLE` for max. radius | 0 | No | No | No | -| **clip_corner** | Enable to clip the overflowed content on the rounded corners | `true`, `false` | `false` | No | No | No | -| **transform_width** | Make the object wider on both sides with this value. Percentage values are relative to the object's width. | px or `lv_pct()` | 0 | No | Yes | No | -| **transform_height** | Make the object higher on both sides with this value. Percentage values are relative to the object's height. | `px or `lv_pct()` | 0 | No | Yes | No | -| **translate_x** | Move the object with this value in X direction. Applied after layouts positioning. Percentage values are relative to the object's width. | `px or `lv_pct()` | 0 | Yes | No | No | -| **translate_y** | Move the object with this value in Y direction. Applied after layouts positioning. Percentage values are relative to the object's height. | `px or `lv_pct()` | 0 | Yes | No | No | -| **transform_angle** | Rotate image-like objects. Multiplied with the zoom set on the object. Added to the rotation set on the object.| 0.1 degree, e.g. 45 deg. = 450 | 0 | Yes | No | No | -| **transform_zoom** | Zoom image-like objects. Multiplied with the zoom set on the object. | 256 (or `LV_IMG_ZOOM_NONE`): normal size, 128: half size, 512: double size, and so on | 256 | Yes | No | No | -| **opa** | Scale down all opacity values of the object by this factor. | 0..255 or `LV_OPA_...` | `LV_OPA_COVER` | Yes | No | Yes | - -### radius -Set the radius on every corner. It's value can be in px (>= 0) or `LV_RADIUS_CIRCLE` for maximal radius - -| Default | Inherited | Layout | Ext. draw | -|---------|------------|--------|-----------| -| 0 | No | No | No | - - -| **clip_corner** | Enable to clip the overflowed content on the rounded corners | `true`, `false` | `false` | No | No | No | -| **transform_width** | Make the object wider on both sides with this value. Percentage values are relative to the object's width. | px or `lv_pct()` | 0 | No | Yes | No | -| **transform_height** | Make the object higher on both sides with this value. Percentage values are relative to the object's height. | `px or `lv_pct()` | 0 | No | Yes | No | -| **translate_x** | Move the object with this value in X direction. Applied after layouts positioning. Percentage values are relative to the object's width. | `px or `lv_pct()` | 0 | Yes | No | No | -| **translate_y** | Move the object with this value in Y direction. Applied after layouts positioning. Percentage values are relative to the object's height. | `px or `lv_pct()` | 0 | Yes | No | No | -| **transform_angle** | Rotate image-like objects. Multiplied with the zoom set on the object. Added to the rotation set on the object.| 0.1 degree, e.g. 45 deg. = 450 | 0 | Yes | No | No | -| **transform_zoom** | Zoom image-like objects. Multiplied with the zoom set on the object. | 256 (or `LV_IMG_ZOOM_NONE`): normal size, 128: half size, 512: double size, and so on | 256 | Yes | No | No | -| **opa** | Scale down all opacity values of the object by this factor. | 0..255 or `LV_OPA_...` | `LV_OPA_COVER` | Yes | No | Yes | - - -### Padding and margin properties -*Padding* sets the space on the inner sides of the edges. It means "I don't want my children too close to my sides, so keep this space". -*Padding inner* set the "gap" between the children. -*Margin* sets the space on the outer side of the edges. It means "I want this space around me". - -These properties are typically used by [Container](/widgets/cont) object if [layout](/widgets/cont#layout) or -[auto fit](/widgets/cont#auto-fit) is enabled. -However other widgets also use them to set spacing. See the documentation of the widgets for the details. -- **pad_top** (`lv_style_int_t`): Set the padding on the top. Default value: 0. -- **pad_bottom** (`lv_style_int_t`): Set the padding on the bottom. Default value: 0. -- **pad_left** (`lv_style_int_t`): Set the padding on the left. Default value: 0. -- **pad_right** (`lv_style_int_t`): Set the padding on the right. Default value: 0. -- **pad_inner** (`lv_style_int_t`): Set the padding inside the object between children. Default value: 0. -- **margin_top** (`lv_style_int_t`): Set the margin on the top. Default value: 0. -- **margin_bottom** (`lv_style_int_t`): Set the margin on the bottom. Default value: 0. -- **margin_left** (`lv_style_int_t`): Set the margin on the left. Default value: 0. -- **margin_right** (`lv_style_int_t`): Set the margin on the right. Default value: 0. - -### Background properties -The background is a simple rectangle which can have gradient and `radius` rounding. -- **bg_color** (`lv_color_t`) Specifies the color of the background. Default value: `LV_COLOR_WHITE`. -- **bg_opa** (`lv_opa_t`) Specifies opacity of the background. Default value: `LV_OPA_TRANSP`. -- **bg_grad_color** (`lv_color_t`) Specifies the color of the background's gradient. The color on the right or bottom is `bg_grad_dir != LV_GRAD_DIR_NONE`. Default value: `LV_COLOR_WHITE`. -- **bg_main_stop** (`uint8_t`): Specifies where should the gradient start. 0: at left/top most position, 255: at right/bottom most position. Default value: 0. -- **bg_grad_stop** (`uint8_t`): Specifies where should the gradient stop. 0: at left/top most position, 255: at right/bottom most position. Default value: 255. -- **bg_grad_dir** (`lv_grad_dir_t`) Specifies the direction of the gradient. Can be `LV_GRAD_DIR_NONE/HOR/VER`. Default value: `LV_GRAD_DIR_NONE`. -- **bg_blend_mode** (`lv_blend_mode_t`): Set the blend mode the background. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_1.* - :alt: Styling the background in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_1.c - :language: c -``` - -### Border properties -The border is drawn on top of the *background*. It has `radius` rounding. -- **border_color** (`lv_color_t`) Specifies the color of the border. Default value: `LV_COLOR_BLACK`. -- **border_opa** (`lv_opa_t`) Specifies opacity of the border. Default value: `LV_OPA_COVER`. -- **border_width** (`lv_style_int_t`): Set the width of the border. Default value: 0. -- **border_side** (`lv_border_side_t`) Specifies which sides of the border to draw. Can be `LV_BORDER_SIDE_NONE/LEFT/RIGHT/TOP/BOTTOM/FULL`. ORed values are also possible. Default value: `LV_BORDER_SIDE_FULL`. -- **border_post** (`bool`): If `true` the border will be drawn after all children have been drawn. Default value: `false`. -- **border_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the border. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_2.* - :alt: Styling the border in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_2.c - :language: c -``` - -### Outline properties -The outline is similar to *border* but is drawn outside of the object. -- **outline_color** (`lv_color_t`) Specifies the color of the outline. Default value: `LV_COLOR_BLACK`. -- **outline_opa** (`lv_opa_t`) Specifies opacity of the outline. Default value: `LV_OPA_COVER`. -- **outline_width** (`lv_style_int_t`): Set the width of the outline. Default value: 0. -- **outline_pad** (`lv_style_int_t`) Set the space between the object and the outline. Default value: 0. -- **outline_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the outline. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_3.* - :alt: Styling the outline in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_3.c - :language: c -``` - -### Shadow properties -The shadow is a blurred area under the object. -- **shadow_color** (`lv_color_t`) Specifies the color of the shadow. Default value: `LV_COLOR_BLACK`. -- **shadow_opa** (`lv_opa_t`) Specifies opacity of the shadow. Default value: `LV_OPA_TRANSP`. -- **shadow_width** (`lv_style_int_t`): Set the width (blur size) of the outline. Default value: 0. -- **shadow_ofs_x** (`lv_style_int_t`): Set the an X offset for the shadow. Default value: 0. -- **shadow_ofs_y** (`lv_style_int_t`): Set the an Y offset for the shadow. Default value: 0. -- **shadow_spread** (`lv_style_int_t`): make the shadow larger than the background in every direction by this value. Default value: 0. -- **shadow_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the shadow. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_4.* - :alt: Styling the shadow in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_4.c - :language: c -``` - -### Pattern properties -The pattern is an image (or symbol) drawn in the middle of the background or repeated to fill the whole background. -- **pattern_image** (`const void *`): Pointer to an `lv_img_dsc_t` variable, a path to an image file or a symbol. Default value: `NULL`. -- **pattern_opa** (`lv_opa_t`): Specifies opacity of the pattern. Default value: `LV_OPA_COVER`. -- **pattern_recolor** (`lv_color_t`): Mix this color to the pattern image. In case of symbols (texts) it will be the text color. Default value: `LV_COLOR_BLACK`. -- **pattern_recolor_opa** (`lv_opa_t`): Intensity of recoloring. Default value: `LV_OPA_TRANSP` (no recoloring). -- **pattern_repeat** (`bool`): `true`: the pattern will be repeated as a mosaic. `false`: place the pattern in the middle of the background. Default value: `false`. -- **pattern_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the pattern. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_5.* - :alt: Styling the shadow in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_5.c - :language: c -``` - -### Value properties -Value is an arbitrary text drawn to the background. It can be a lightweighted replacement of creating label objects. - -- **value_str** (`const char *`): Pointer to text to display. Only the pointer is saved! (Don't use local variable with lv_style_set_value_str, instead use static, global or dynamically allocated data). Default value: `NULL`. -- **value_color** (`lv_color_t`): Color of the text. Default value: `LV_COLOR_BLACK`. -- **value_opa** (`lv_opa_t`): Opacity of the text. Default value: `LV_OPA_COVER`. -- **value_font** (`const lv_font_t *`): Pointer to font of the text. Default value: `NULL`. -- **value_letter_space** (`lv_style_int_t`): Letter space of the text. Default value: 0. -- **value_line_space** (`lv_style_int_t`): Line space of the text. Default value: 0. -- **value_align** (`lv_align_t`): Alignment of the text. Can be `LV_ALIGN_...`. Default value: `LV_ALIGN_CENTER`. -- **value_ofs_x** (`lv_style_int_t`): X offset from the original position of the alignment. Default value: 0. -- **value_ofs_y** (`lv_style_int_t`): Y offset from the original position of the alignment. Default value: 0. -- **value_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the text. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_6.* - :alt: Styling the value text in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_6.c - :language: c -``` - -### Text properties -Properties for textual object. -- **text_color** (`lv_color_t`): Color of the text. Default value: `LV_COLOR_BLACK`. -- **text_opa** (`lv_opa_t`): Opacity of the text. Default value: `LV_OPA_COVER`. -- **text_font** (`const lv_font_t *`): Pointer to font of the text. Default value: `NULL`. -- **text_letter_space** (`lv_style_int_t`): Letter space of the text. Default value: 0. -- **text_line_space** (`lv_style_int_t`): Line space of the text. Default value: 0. -- **text_decor** (`lv_text_decor_t`): Add text decoration. Can be `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. Default value: `LV_TEXT_DECOR_NONE`. -- **text_sel_color** (`lv_color_t`): Set color of the text selection. Default value: `LV_COLOR_BLACK` -- **text_sel_bg_color** (`lv_color_t`): Set background color of text selection. Default value: `LV_COLOR_BLUE` -- **text_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the text. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_7.* - :alt: Styling a text in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_7.c - :language: c -``` - -### Line properties -Properties of lines. -- **line_color** (`lv_color_t`): Color of the line. Default value: `LV_COLOR_BLACK` -- **line_opa** (`lv_opa_t`): Opacity of the line. Default value: `LV_OPA_COVER` -- **line_width** (`lv_style_int_t`): Width of the line. Default value: 0. -- **line_dash_width** (`lv_style_int_t`): Width of dash. Dashing is drawn only for horizontal or vertical lines. 0: disable dash. Default value: 0. -- **line_dash_gap** (`lv_style_int_t`): Gap between two dash line. Dashing is drawn only for horizontal or vertical lines. 0: disable dash. Default value: 0. -- **line_rounded** (`bool`): `true`: draw rounded line endings. Default value: `false`. -- **line_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the line. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_8.* - :alt: Styling a line in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_8.c - :language: c -``` - -### Image properties -Properties of image. -- **image_recolor** (`lv_color_t`):  Mix this color to the pattern image. In case of symbols (texts) it will be the text color. Default value: `LV_COLOR_BLACK` -- **image_recolor_opa** (`lv_opa_t`): Intensity of recoloring. Default value: `LV_OPA_TRANSP` (no recoloring). Default value: `LV_OPA_TRANSP` -- **image_opa** (`lv_opa_t`): Opacity of the image. Default value: `LV_OPA_COVER` -- **image_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the image. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_9.* - :alt: Styling an image in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_9.c - :language: c -``` - -### Transition properties -Properties to describe state change animations. -- **transition_time** (`lv_style_int_t`): Time of the transition. Default value: 0. -- **transition_delay** (`lv_style_int_t`): Delay before the transition. Default value: 0. -- **transition_prop_1** (`property name`): A property on which transition should be applied. Use the property name with upper case with `LV_STYLE_` prefix, e.g. `LV_STYLE_BG_COLOR`. Default value: 0 (none). -- **transition_prop_2** (`property name`): Same as *transition_1* just for another property. Default value: 0 (none). -- **transition_prop_3** (`property name`): Same as *transition_1* just for another property. Default value: 0 (none). -- **transition_prop_4** (`property name`): Same as *transition_1* just for another property. Default value: 0 (none). -- **transition_prop_5** (`property name`): Same as *transition_1* just for another property. Default value: 0 (none). -- **transition_prop_6** (`property name`): Same as *transition_1* just for another property. Default value: 0 (none). -- **transition_path** (`lv_anim_path_t`): An animation path for the transition. (Needs to be static or global variable because only its pointer is saved). -Default value: `lv_anim_path_def` (linear path). -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_10.* - :alt: Styling an transitions in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_10.c - :language: c -``` - -### Scale properties -Auxiliary properties for scale-like elements. Scales have a normal and end region. -As the name implies the end region is the end of the scale where can be critical values or inactive values. The normal region is before the end region. -Both regions could have different properties. -- **scale_grad_color** (`lv_color_t`):  In normal region make gradient to this color on the scale lines. Default value: `LV_COLOR_BLACK`. -- **scale_end_color** (`lv_color_t`):  Color of the scale lines in the end region. Default value: `LV_COLOR_BLACK`. -- **scale_width** (`lv_style_int_t`): Width of the scale. Default value: `LV_DPI / 8`. Default value: `LV_DPI / 8`. -- **scale_border_width** (`lv_style_int_t`): Width of a border drawn on the outer side of the scale in the normal region. Default value: 0. -- **scale_end_border_width** (`lv_style_int_t`): Width of a border drawn on the outer side of the scale in the end region. Default value: 0. -- **scale_end_line_width** (`lv_style_int_t`): Width of a scale lines in the end region. Default value: 0. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_11.* - :alt: Styling a scale in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_11.c - :language: c -``` - -In the documentation of the widgets you will see sentences like "The widget use the typical background properties". The "typical background" properties are: -- Background -- Border -- Outline -- Shadow -- Pattern -- Value ## Themes -Themes are a collection of styles. There is always an active theme whose styles are automatically applied when an object is created. +Themes are a collection of styles. If there is an active theme LVGL applies it on the every created widget. It gives a default appearance to UI which can be modified by adding further styles. -The default theme is set in `lv_conf.h` with `LV_THEME_...` defines. Every theme has the following properties -- primary color -- secondary color -- small font -- normal font -- subtitle font -- title font -- flags (specific to the given theme) +Every display can have a different theme. For example a colorful theme on a TFT and monochrome theme on a secondary monochrome display. -It up to the theme how to use these properties. +To set a theme for a display 2 steps are required: +1. Initialize a theme +2. Assign the initialized theme to a display. -There are 3 built-in themes: -- empty: no default styles are added -- material: an impressive, modern theme - mono: simple black and white theme for monochrome displays -- template: a very simple theme which can be copied to create a custom theme  +Theme initialization functions can have different prototype. This example shows how to set the "default" theme: +```c +lv_theme_t * th = lv_theme_default_init(display, /*Use the DPI, size, etc from this display*/ + LV_COLOR_PALETTE_BLUE, LV_COLOR_PALETTE_CYAN, /*Primary and secondary palette*/ + false, /*Light or dark mode*/ + &lv_font_montserrat_10, &lv_font_montserrat_14, &lv_font_montserrat_18); /*Small, normal, large fonts*/ + +lv_disp_set_theme(display, th); /*Assign the theme to the display*/ +``` + + +The themes can be enabled in `lv_conf.h`. If the default theme is enabled by `LV_USE_THEME_DEFAULT 1` LVGL automatically initializes and sets it when a display is created. ### Extending themes -Built-in themes can be extended by custom theme. If a custom theme is created a "base theme" can be selected. The base theme's styles will be added before the custom theme. Any number of themes can be chained this was. E.g. material theme -> custom theme -> dark theme. +Built-in themes can be extended. +If a custom theme is created a parent theme can be selected. The parent theme's styles will be added before the custom theme's styles. +Any number of themes can be chained this way. E.g. default theme -> custom theme -> dark theme. -Here is an example about how to create a custom theme based on the currently active built-in theme. +Here is an example about creating a custom theme based on the currently active theme. ```c - /*Get the current theme (e.g. material). It will be the base of the custom theme.*/ -lv_theme_t * base_theme = lv_theme_get_act(); +/*Declare the style used in the theme*/ +static lv_style_t style_btn; +... -/*Initialize a custom theme*/ -static lv_theme_t custom_theme; /*Declare a theme*/ -lv_theme_copy(&custom_theme, base_theme); /*Initialize the custom theme from the base theme*/ -lv_theme_set_apply_cb(&custom_theme, custom_apply_cb); /*Set a custom theme apply callback*/ -lv_theme_set_base(custom_theme, base_theme); /*Set the base theme of the csutom theme*/ +/*Initialize the styles*/ +lv_style_init(&style_btn); +lv_style_set_bg_color(&style_btn, lv_color_green()); -/*Initialize styles for the new theme*/ -static lv_style_t style1; -lv_style_init(&style1); -lv_style_set_bg_color(&style1, LV_STATE_DEFAULT, custom_theme.color_primary); +/*Initialize the new theme from the current theme*/ +lv_theme_t * th_act = lv_disp_get_theme(NULL); +static lv_theme_t th_new; +th_new = *th_act; + +/*Set the parent theme ans the style applay callback for the new theme*/ +lv_theme_set_parent(&th_new, th_act); +lv_theme_set_apply_cb(&th_new, new_theme_apply_cb); + +/*Assign the new theme the the current display*/ +lv_disp_set_theme(NULL, &th_new); ... -/*Add a custom apply callback*/ -static void custom_apply_cb(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name) +/*Will be called when the styles of the base theme are already added + to add new styles*/ +void new_theme_apply_cb(lv_theme_t * th, lv_obj_t * obj) { - lv_style_list_t * list; - - switch(name) { - case LV_THEME_BTN: - list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); - _lv_style_list_add_style(list, &my_style); - break; + if(lv_obj_check_type(obj, &lv_btn_class)) { + lv_obj_add_style(obj, &style_btn, 0); } } ``` +## Examples -## Example - -### Styling a button -```eval_rst -.. image:: /lv_examples/src/lv_ex_get_started/lv_ex_get_started_2.* - :alt: Styling a button in LVGL - -.. literalinclude:: /lv_examples/src/lv_ex_get_started/lv_ex_get_started_2.c - :language: c -``` - ## API ```eval_rst +.. doxygenfile:: lv_obj_style.h + :project: lvgl + +.. doxygenfile:: lv_obj_style_dec.h + :project: lvgl + .. doxygenfile:: lv_style.h :project: lvgl + +.. doxygenfile:: lv_style_dec.h + :project: lvgl .. doxygenfile:: lv_theme.h :project: lvgl diff --git a/examples/widgets/btn/lv_example_btn_3.c b/examples/widgets/btn/lv_example_btn_3.c index 633b52fe5..8b28b657b 100644 --- a/examples/widgets/btn/lv_example_btn_3.c +++ b/examples/widgets/btn/lv_example_btn_3.c @@ -9,7 +9,7 @@ void lv_example_btn_3(void) { /*Properties to transition*/ static lv_style_prop_t props[] = { - LV_STYLE_TRANSLATE_WIDTH, LV_STYLE_TRANSLATE_HEIGHT, LV_STYLE_TEXT_LETTER_SPACE, 0 + LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, LV_STYLE_TEXT_LETTER_SPACE, 0 }; /*Transition descriptor when going back to the default state. diff --git a/examples/widgets/imgbtn/lv_example_imgbtn_1.c b/examples/widgets/imgbtn/lv_example_imgbtn_1.c index f4cdfbac8..ef51b3f5c 100644 --- a/examples/widgets/imgbtn/lv_example_imgbtn_1.c +++ b/examples/widgets/imgbtn/lv_example_imgbtn_1.c @@ -8,7 +8,7 @@ void lv_example_imgbtn_1(void) LV_IMG_DECLARE(imgbtn_mid); /*Create a transition animation on width transformation and recolor.*/ - static lv_style_prop_t tr_prop[] = {LV_STYLE_TRANSLATE_WIDTH, LV_STYLE_IMG_RECOLOR_OPA, 0}; + static lv_style_prop_t tr_prop[] = {LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_IMG_RECOLOR_OPA, 0}; static lv_style_transition_dsc_t tr; lv_style_transition_dsc_init(&tr, tr_prop, lv_anim_path_linear, 200, 0); diff --git a/scripts/style_api_gen.py b/scripts/style_api_gen.py index 56966d80f..3cf878509 100755 --- a/scripts/style_api_gen.py +++ b/scripts/style_api_gen.py @@ -384,6 +384,8 @@ def local_style_set(p): print("}") print("") + + def docs(p): if "dsc" not in p: return @@ -398,7 +400,9 @@ def docs(p): e = "No" if p["ext_draw"]: e = "Yes" - print("### " + p["name"]) + li_style = "style='display:inline; margin-right: 20px" + + print("

" + p["name"].lower() + "

") print(p["dsc"]) print("