From 31474538ad1d862d0065c057479bc70ff88086f6 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 24 Apr 2021 16:48:24 +0200 Subject: [PATCH] refactor(layout) rename place keywords to align --- examples/layouts/flex/lv_example_flex_2.c | 2 +- examples/layouts/grid/lv_example_grid_1.c | 4 +- examples/layouts/grid/lv_example_grid_2.c | 20 ++-- examples/layouts/grid/lv_example_grid_3.c | 4 +- examples/layouts/grid/lv_example_grid_4.c | 6 +- examples/layouts/grid/lv_example_grid_5.c | 4 +- examples/layouts/grid/lv_example_grid_6.c | 4 +- .../widgets/checkbox/lv_example_checkbox_1.c | 2 +- examples/widgets/switch/lv_example_switch_1.c | 2 +- src/extra/layouts/flex/lv_flex.c | 44 ++++----- src/extra/layouts/flex/lv_flex.h | 46 ++++----- src/extra/layouts/grid/lv_grid.c | 98 +++++++++---------- src/extra/layouts/grid/lv_grid.h | 89 +++++++++-------- .../calendar/lv_calendar_header_arrow.c | 2 +- .../calendar/lv_calendar_header_dropdown.c | 2 +- src/extra/widgets/msgbox/lv_msgbox.c | 2 +- src/extra/widgets/win/lv_win.c | 2 +- 17 files changed, 166 insertions(+), 167 deletions(-) diff --git a/examples/layouts/flex/lv_example_flex_2.c b/examples/layouts/flex/lv_example_flex_2.c index deb7905e0..a449df2e4 100644 --- a/examples/layouts/flex/lv_example_flex_2.c +++ b/examples/layouts/flex/lv_example_flex_2.c @@ -9,7 +9,7 @@ void lv_example_flex_2(void) static lv_style_t style; lv_style_init(&style); lv_style_set_flex_flow(&style, LV_FLEX_FLOW_ROW_WRAP); - lv_style_set_flex_main_place(&style, LV_FLEX_PLACE_SPACE_EVENLY); + lv_style_set_flex_main_place(&style, LV_FLEX_ALIGN_SPACE_EVENLY); lv_style_set_layout(&style, LV_LAYOUT_FLEX); lv_obj_t * cont = lv_obj_create(lv_scr_act()); diff --git a/examples/layouts/grid/lv_example_grid_1.c b/examples/layouts/grid/lv_example_grid_1.c index fbf0251b9..f3e5c3df6 100644 --- a/examples/layouts/grid/lv_example_grid_1.c +++ b/examples/layouts/grid/lv_example_grid_1.c @@ -28,8 +28,8 @@ void lv_example_grid_1(void) 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, - LV_GRID_STRETCH, row, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1, + LV_GRID_ALIGN_STRETCH, row, 1); label = lv_label_create(obj); lv_label_set_text_fmt(label, "c%d, r%d", col, row); diff --git a/examples/layouts/grid/lv_example_grid_2.c b/examples/layouts/grid/lv_example_grid_2.c index 09cd34c79..7e13a4007 100644 --- a/examples/layouts/grid/lv_example_grid_2.c +++ b/examples/layouts/grid/lv_example_grid_2.c @@ -22,40 +22,40 @@ void lv_example_grid_2(void) /*Cell to 0;0 and align to to the start (left/top) horizontally and vertically too*/ obj = lv_obj_create(cont); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_grid_cell(obj, LV_GRID_START, 0, 1, - LV_GRID_START, 0, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 0, 1, + LV_GRID_ALIGN_START, 0, 1); label = lv_label_create(obj); lv_label_set_text(label, "c0, r0"); /*Cell to 1;0 and align to to the start (left) horizontally and center vertically too*/ obj = lv_obj_create(cont); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_grid_cell(obj, LV_GRID_START, 1, 1, - LV_GRID_CENTER, 0, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 1, 1, + LV_GRID_ALIGN_CENTER, 0, 1); label = lv_label_create(obj); lv_label_set_text(label, "c1, r0"); /*Cell to 2;0 and align to to the start (left) horizontally and end (bottom) vertically too*/ obj = lv_obj_create(cont); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_grid_cell(obj, LV_GRID_START, 2, 1, - LV_GRID_END, 0, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 2, 1, + LV_GRID_ALIGN_END, 0, 1); label = lv_label_create(obj); lv_label_set_text(label, "c2, r0"); /*Cell to 1;1 but 2 column wide (span = 2).Set width and height to stretched.*/ obj = lv_obj_create(cont); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, 1, 2, - LV_GRID_STRETCH, 1, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, 1, 2, + LV_GRID_ALIGN_STRETCH, 1, 1); label = lv_label_create(obj); lv_label_set_text(label, "c1-2, r1"); /*Cell to 0;1 but 2 rows tall (span = 2).Set width and height to stretched.*/ obj = lv_obj_create(cont); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, 0, 1, - LV_GRID_STRETCH, 1, 2); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, 0, 1, + LV_GRID_ALIGN_STRETCH, 1, 2); label = lv_label_create(obj); lv_label_set_text(label, "c0\nr1-2"); } diff --git a/examples/layouts/grid/lv_example_grid_3.c b/examples/layouts/grid/lv_example_grid_3.c index 82cf2831a..36150dabe 100644 --- a/examples/layouts/grid/lv_example_grid_3.c +++ b/examples/layouts/grid/lv_example_grid_3.c @@ -32,8 +32,8 @@ void lv_example_grid_3(void) obj = lv_obj_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, - LV_GRID_STRETCH, row, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1, + LV_GRID_ALIGN_STRETCH, row, 1); label = lv_label_create(obj); lv_label_set_text_fmt(label, "%d,%d", col, row); diff --git a/examples/layouts/grid/lv_example_grid_4.c b/examples/layouts/grid/lv_example_grid_4.c index 55076c492..65fdb73b9 100644 --- a/examples/layouts/grid/lv_example_grid_4.c +++ b/examples/layouts/grid/lv_example_grid_4.c @@ -14,7 +14,7 @@ void lv_example_grid_4(void) /*Create a container with grid*/ lv_obj_t * cont = lv_obj_create(lv_scr_act()); - lv_obj_set_grid_place(cont, LV_GRID_SPACE_BETWEEN, LV_GRID_END); + lv_obj_set_grid_align(cont, LV_GRID_ALIGN_SPACE_BETWEEN, LV_GRID_ALIGN_END); lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc); lv_obj_set_size(cont, 300, 220); lv_obj_center(cont); @@ -29,8 +29,8 @@ void lv_example_grid_4(void) obj = lv_obj_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, - LV_GRID_STRETCH, row, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1, + LV_GRID_ALIGN_STRETCH, row, 1); label = lv_label_create(obj); lv_label_set_text_fmt(label, "%d,%d", col, row); diff --git a/examples/layouts/grid/lv_example_grid_5.c b/examples/layouts/grid/lv_example_grid_5.c index 5623f7170..b57057d5a 100644 --- a/examples/layouts/grid/lv_example_grid_5.c +++ b/examples/layouts/grid/lv_example_grid_5.c @@ -35,8 +35,8 @@ void lv_example_grid_5(void) uint8_t row = i / 3; obj = lv_obj_create(cont); - lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1, - LV_GRID_STRETCH, row, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1, + LV_GRID_ALIGN_STRETCH, row, 1); label = lv_label_create(obj); lv_label_set_text_fmt(label, "%d,%d", col, row); lv_obj_center(label); diff --git a/examples/layouts/grid/lv_example_grid_6.c b/examples/layouts/grid/lv_example_grid_6.c index 666adb4c4..59e678dd5 100644 --- a/examples/layouts/grid/lv_example_grid_6.c +++ b/examples/layouts/grid/lv_example_grid_6.c @@ -27,8 +27,8 @@ void lv_example_grid_6(void) obj = lv_obj_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, - LV_GRID_STRETCH, row, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1, + LV_GRID_ALIGN_STRETCH, row, 1); label = lv_label_create(obj); lv_label_set_text_fmt(label, "%d,%d", col, row); diff --git a/examples/widgets/checkbox/lv_example_checkbox_1.c b/examples/widgets/checkbox/lv_example_checkbox_1.c index 72f284200..cbd31cbae 100644 --- a/examples/widgets/checkbox/lv_example_checkbox_1.c +++ b/examples/widgets/checkbox/lv_example_checkbox_1.c @@ -15,7 +15,7 @@ static void event_handler(lv_event_t * e) void lv_example_checkbox_1(void) { lv_obj_set_flex_flow(lv_scr_act(), LV_FLEX_FLOW_COLUMN); - lv_obj_set_flex_place(lv_scr_act(), LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_START, LV_FLEX_PLACE_CENTER); + lv_obj_set_flex_align(lv_scr_act(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER); lv_obj_t * cb; cb = lv_checkbox_create(lv_scr_act()); diff --git a/examples/widgets/switch/lv_example_switch_1.c b/examples/widgets/switch/lv_example_switch_1.c index 39fd8a7c7..f496a901e 100644 --- a/examples/widgets/switch/lv_example_switch_1.c +++ b/examples/widgets/switch/lv_example_switch_1.c @@ -13,7 +13,7 @@ static void event_handler(lv_event_t * e) void lv_example_switch_1(void) { lv_obj_set_flex_flow(lv_scr_act(), LV_FLEX_FLOW_COLUMN); - lv_obj_set_flex_place(lv_scr_act(), LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_CENTER); + lv_obj_set_flex_align(lv_scr_act(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_t * sw; diff --git a/src/extra/layouts/flex/lv_flex.c b/src/extra/layouts/flex/lv_flex.c index 3bee4807e..dc1d8bba9 100644 --- a/src/extra/layouts/flex/lv_flex.c +++ b/src/extra/layouts/flex/lv_flex.c @@ -18,9 +18,9 @@ * TYPEDEFS **********************/ typedef struct { - lv_flex_place_t main_place; - lv_flex_place_t cross_place; - lv_flex_place_t track_place; + lv_flex_align_t main_place; + lv_flex_align_t cross_place; + lv_flex_align_t track_place; uint8_t row :1; uint8_t wrap :1; uint8_t rev :1; @@ -56,7 +56,7 @@ typedef struct { 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); +static void place_content(lv_flex_align_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); static lv_obj_t * get_next_item(lv_obj_t * cont, bool rev, int32_t * item_id); /********************** @@ -102,7 +102,7 @@ void lv_obj_set_flex_flow(lv_obj_t * obj, lv_flex_flow_t flow) lv_obj_set_style_layout(obj, LV_LAYOUT_FLEX, 0); } -void lv_obj_set_flex_place(lv_obj_t * obj, lv_flex_place_t main_place, lv_flex_place_t cross_place, lv_flex_place_t track_place) +void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place, lv_flex_align_t track_place) { lv_obj_set_style_flex_main_place(obj, main_place, 0); lv_obj_set_style_flex_cross_place(obj, cross_place, 0); @@ -140,7 +140,7 @@ static void flex_update(lv_obj_t * cont, void * user_data) 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); - lv_flex_place_t track_cross_place = f.track_place; + lv_flex_align_t track_cross_place = f.track_place; lv_coord_t * cross_pos = (f.row ? &abs_y : &abs_x); lv_coord_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); @@ -149,12 +149,12 @@ static void flex_update(lv_obj_t * cont, void * user_data) if((f.row && h_set == LV_SIZE_CONTENT) || (!f.row && w_set == LV_SIZE_CONTENT)) { - track_cross_place = LV_FLEX_PLACE_START; + track_cross_place = LV_FLEX_ALIGN_START; } if(rtl && !f.row) { - if(track_cross_place == LV_FLEX_PLACE_START) track_cross_place = LV_FLEX_PLACE_END; - else if(track_cross_place == LV_FLEX_PLACE_END) track_cross_place = LV_FLEX_PLACE_START; + if(track_cross_place == LV_FLEX_ALIGN_START) track_cross_place = LV_FLEX_ALIGN_END; + else if(track_cross_place == LV_FLEX_ALIGN_END) track_cross_place = LV_FLEX_ALIGN_START; } lv_coord_t total_track_cross_size = 0; @@ -163,7 +163,7 @@ static void flex_update(lv_obj_t * cont, void * user_data) int32_t track_first_item; int32_t next_track_first_item; - if(track_cross_place != LV_FLEX_PLACE_START) { + if(track_cross_place != LV_FLEX_ALIGN_START) { track_first_item = f.rev ? cont->spec_attr->child_cnt - 1 : 0; track_t t; while(track_first_item < (int32_t)cont->spec_attr->child_cnt && track_first_item >= 0) { @@ -385,12 +385,12 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i lv_coord_t cross_pos = 0; switch(f->cross_place) { - case LV_FLEX_PLACE_CENTER: + case LV_FLEX_ALIGN_CENTER: /*Round up the cross size to avoid rounding error when dividing by 2 *The issue comes up e,g, with column direction with center cross direction if an element's width changes*/ cross_pos = (((t->track_cross_size + 1) & (~1)) - area_get_cross_size(&item->coords)) / 2; break; - case LV_FLEX_PLACE_END: + case LV_FLEX_ALIGN_END: cross_pos = t->track_cross_size - area_get_cross_size(&item->coords); break; default: @@ -433,14 +433,14 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i /** * Tell a start coordinate and gap for a placement type. */ -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) +static void place_content(lv_flex_align_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) { if(item_cnt <= 1) { switch(place) { - case LV_FLEX_PLACE_SPACE_BETWEEN: - case LV_FLEX_PLACE_SPACE_AROUND: - case LV_FLEX_PLACE_SPACE_EVENLY: - place = LV_FLEX_PLACE_CENTER; + case LV_FLEX_ALIGN_SPACE_BETWEEN: + case LV_FLEX_ALIGN_SPACE_AROUND: + case LV_FLEX_ALIGN_SPACE_EVENLY: + place = LV_FLEX_ALIGN_CENTER; break; default: break; @@ -448,22 +448,22 @@ static void place_content(lv_flex_place_t place, lv_coord_t max_size, lv_coord_t } switch(place) { - case LV_FLEX_PLACE_CENTER: + case LV_FLEX_ALIGN_CENTER: *gap = 0; *start_pos += (max_size - content_size) / 2; break; - case LV_FLEX_PLACE_END: + case LV_FLEX_ALIGN_END: *gap = 0; *start_pos += max_size - content_size; break; - case LV_FLEX_PLACE_SPACE_BETWEEN: + case LV_FLEX_ALIGN_SPACE_BETWEEN: *gap = (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt - 1); break; - case LV_FLEX_PLACE_SPACE_AROUND: + case LV_FLEX_ALIGN_SPACE_AROUND: *gap += (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt); *start_pos += *gap / 2; break; - case LV_FLEX_PLACE_SPACE_EVENLY: + case LV_FLEX_ALIGN_SPACE_EVENLY: *gap = (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt + 1); *start_pos += *gap; break; diff --git a/src/extra/layouts/flex/lv_flex.h b/src/extra/layouts/flex/lv_flex.h index 679e989bd..3044c5273 100644 --- a/src/extra/layouts/flex/lv_flex.h +++ b/src/extra/layouts/flex/lv_flex.h @@ -35,13 +35,13 @@ LV_EXPORT_CONST_INT(LV_OBJ_FLAG_FLEX_IN_NEW_TRACK); struct _lv_obj_t; typedef enum { - LV_FLEX_PLACE_START, - LV_FLEX_PLACE_END, - LV_FLEX_PLACE_CENTER, - LV_FLEX_PLACE_SPACE_EVENLY, - LV_FLEX_PLACE_SPACE_AROUND, - LV_FLEX_PLACE_SPACE_BETWEEN, -}lv_flex_place_t; + LV_FLEX_ALIGN_START, + LV_FLEX_ALIGN_END, + LV_FLEX_ALIGN_CENTER, + LV_FLEX_ALIGN_SPACE_EVENLY, + LV_FLEX_ALIGN_SPACE_AROUND, + LV_FLEX_ALIGN_SPACE_BETWEEN, +}lv_flex_align_t; typedef enum { LV_FLEX_FLOW_ROW = 0x00, @@ -84,11 +84,11 @@ void lv_obj_set_flex_flow(lv_obj_t * obj, lv_flex_flow_t flow); /** * Set how to place (where to align) the items an tracks * @param flex pointer: to a flex layout descriptor - * @param main_place where to place the items on main axis (in their track). Any value of `lv_flex_place_t`. - * @param cross_place where to place the item in their track on the cross axis. `LV_FLEX_PLACE_START/END/CENTER` - * @param track_place where to place the tracks in the cross direction. Any value of `lv_flex_place_t`. + * @param main_place where to place the items on main axis (in their track). Any value of `lv_flex_align_t`. + * @param cross_place where to place the item in their track on the cross axis. `LV_FLEX_ALIGN_START/END/CENTER` + * @param track_place where to place the tracks in the cross direction. Any value of `lv_flex_align_t`. */ -void lv_obj_set_flex_place(lv_obj_t * obj, lv_flex_place_t main_place, lv_flex_place_t cross_place, lv_flex_place_t track_cross_place); +void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place, lv_flex_align_t track_cross_place); /** * Sets the width or height (on main axis) to grow the object in order fill the free space @@ -105,7 +105,7 @@ static inline void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t val lv_style_set_prop(style, LV_STYLE_FLEX_FLOW, v); } -static inline void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_place_t value) +static inline void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_align_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -113,7 +113,7 @@ static inline void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_plac lv_style_set_prop(style, LV_STYLE_FLEX_MAIN_PLACE, v); } -static inline void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_place_t value) +static inline void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_align_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -121,7 +121,7 @@ static inline void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_pla lv_style_set_prop(style, LV_STYLE_FLEX_CROSS_PLACE, v); } -static inline void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_place_t value) +static inline void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_align_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -147,7 +147,7 @@ static inline void lv_obj_set_style_flex_flow(lv_obj_t * obj, lv_flex_flow_t val lv_obj_set_local_style_prop(obj, LV_STYLE_FLEX_FLOW, v, selector); } -static inline void lv_obj_set_style_flex_main_place(lv_obj_t * obj, lv_flex_place_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_flex_main_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t) value @@ -155,7 +155,7 @@ static inline void lv_obj_set_style_flex_main_place(lv_obj_t * obj, lv_flex_plac lv_obj_set_local_style_prop(obj, LV_STYLE_FLEX_MAIN_PLACE, v, selector); } -static inline void lv_obj_set_style_flex_cross_place(lv_obj_t * obj, lv_flex_place_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_flex_cross_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t) value @@ -163,7 +163,7 @@ static inline void lv_obj_set_style_flex_cross_place(lv_obj_t * obj, lv_flex_pla lv_obj_set_local_style_prop(obj, LV_STYLE_FLEX_CROSS_PLACE, v, selector); } -static inline void lv_obj_set_style_flex_track_place(lv_obj_t * obj, lv_flex_place_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_flex_track_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t) value @@ -185,22 +185,22 @@ static inline lv_flex_flow_t lv_obj_get_style_flex_flow(const lv_obj_t * obj, ui return (lv_flex_flow_t)v.num; } -static inline lv_flex_place_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, uint32_t part) +static inline lv_flex_align_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_MAIN_PLACE); - return (lv_flex_place_t)v.num; + return (lv_flex_align_t)v.num; } -static inline lv_flex_place_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, uint32_t part) +static inline lv_flex_align_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_CROSS_PLACE); - return (lv_flex_place_t)v.num; + return (lv_flex_align_t)v.num; } -static inline lv_flex_place_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, uint32_t part) +static inline lv_flex_align_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_TRACK_PLACE); - return (lv_flex_place_t)v.num; + return (lv_flex_align_t)v.num; } static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, uint32_t part) diff --git a/src/extra/layouts/grid/lv_grid.c b/src/extra/layouts/grid/lv_grid.c index 73a69470b..248d5e8d7 100644 --- a/src/extra/layouts/grid/lv_grid.c +++ b/src/extra/layouts/grid/lv_grid.c @@ -54,7 +54,7 @@ static void calc_free(_lv_grid_calc_t * calc); static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c); static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c); static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * hint); -static lv_coord_t grid_place(lv_coord_t cont_size, bool auto_size, uint8_t place, lv_coord_t gap, uint32_t track_num, lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse); +static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, uint8_t align, lv_coord_t gap, uint32_t track_num, lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse); static uint32_t count_tracks(const lv_coord_t * templ); static inline const lv_coord_t * get_col_dsc(lv_obj_t * obj) {return lv_obj_get_style_grid_column_dsc_array(obj, 0); } @@ -63,25 +63,25 @@ static inline uint8_t get_col_pos(lv_obj_t * obj) {return lv_obj_get_style_grid_ static inline uint8_t get_row_pos(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_row_pos(obj, 0); } static inline uint8_t get_col_span(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_column_span(obj, 0); } static inline uint8_t get_row_span(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_row_span(obj, 0); } -static inline uint8_t get_cell_col_place(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_x_place(obj, 0); } -static inline uint8_t get_cell_row_place(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_y_place(obj, 0); } -static inline uint8_t get_grid_col_place(lv_obj_t * obj) {return lv_obj_get_style_grid_column_place(obj, 0); } -static inline uint8_t get_grid_row_place(lv_obj_t * obj) {return lv_obj_get_style_grid_row_place(obj, 0); } +static inline uint8_t get_cell_col_align(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_x_align(obj, 0); } +static inline uint8_t get_cell_row_align(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_y_align(obj, 0); } +static inline uint8_t get_grid_col_align(lv_obj_t * obj) {return lv_obj_get_style_grid_column_align(obj, 0); } +static inline uint8_t get_grid_row_align(lv_obj_t * obj) {return lv_obj_get_style_grid_row_align(obj, 0); } /********************** * GLOBAL VARIABLES **********************/ uint32_t LV_LAYOUT_GRID; lv_style_prop_t LV_STYLE_GRID_COLUMN_DSC_ARRAY; -lv_style_prop_t LV_STYLE_GRID_COLUMN_PLACE; +lv_style_prop_t LV_STYLE_GRID_COLUMN_ALIGN; lv_style_prop_t LV_STYLE_GRID_ROW_DSC_ARRAY; -lv_style_prop_t LV_STYLE_GRID_ROW_PLACE; +lv_style_prop_t LV_STYLE_GRID_ROW_ALIGN; lv_style_prop_t LV_STYLE_GRID_CELL_COL_POS; lv_style_prop_t LV_STYLE_GRID_CELL_COL_SPAN; -lv_style_prop_t LV_STYLE_GRID_CELL_COL_PLACE; +lv_style_prop_t LV_STYLE_GRID_CELL_X_ALIGN; lv_style_prop_t LV_STYLE_GRID_CELL_ROW_POS; lv_style_prop_t LV_STYLE_GRID_CELL_ROW_SPAN; -lv_style_prop_t LV_STYLE_GRID_CELL_ROW_PLACE; +lv_style_prop_t LV_STYLE_GRID_CELL_Y_ALIGN; /********************** * STATIC VARIABLES @@ -102,15 +102,15 @@ void lv_grid_init(void) 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; - LV_STYLE_GRID_COLUMN_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; - LV_STYLE_GRID_ROW_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; + LV_STYLE_GRID_COLUMN_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; + LV_STYLE_GRID_ROW_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; LV_STYLE_GRID_CELL_ROW_SPAN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; LV_STYLE_GRID_CELL_ROW_POS = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; LV_STYLE_GRID_CELL_COL_SPAN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; LV_STYLE_GRID_CELL_COL_POS = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; - LV_STYLE_GRID_CELL_COL_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; - LV_STYLE_GRID_CELL_ROW_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; + LV_STYLE_GRID_CELL_X_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; + LV_STYLE_GRID_CELL_Y_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; } void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_dsc[], const lv_coord_t row_dsc[]) @@ -120,23 +120,23 @@ void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_dsc[], const lv_obj_set_style_layout(obj, LV_LAYOUT_GRID, 0); } -void lv_obj_set_grid_place(lv_obj_t * obj, lv_grid_place_t hor_place, lv_grid_place_t ver_place) +void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid_align_t row_align) { - lv_obj_set_style_grid_column_place(obj, hor_place, 0); - lv_obj_set_style_grid_row_place(obj, ver_place, 0); + lv_obj_set_style_grid_column_align(obj, column_align, 0); + lv_obj_set_style_grid_row_align(obj, row_align, 0); } -void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_place_t hor_place, uint8_t col_pos, uint8_t col_span, - lv_grid_place_t ver_place, uint8_t row_pos, uint8_t row_span) +void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t x_align, uint8_t col_pos, uint8_t col_span, + lv_grid_align_t y_align, uint8_t row_pos, uint8_t row_span) { lv_obj_set_style_grid_cell_column_pos(obj, col_pos, 0); lv_obj_set_style_grid_cell_row_pos(obj, row_pos, 0); - lv_obj_set_style_grid_cell_x_place(obj, hor_place, 0); + lv_obj_set_style_grid_cell_x_align(obj, x_align, 0); lv_obj_set_style_grid_cell_column_span(obj, col_span, 0); lv_obj_set_style_grid_cell_row_span(obj, row_span, 0); - lv_obj_set_style_grid_cell_y_place(obj, ver_place, 0); + lv_obj_set_style_grid_cell_y_align(obj, y_align, 0); lv_obj_mark_layout_as_dirty(lv_obj_get_parent(obj)); } @@ -209,11 +209,11 @@ static void calc(struct _lv_obj_t * cont, _lv_grid_calc_t * calc_out) 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_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); + calc_out->grid_w = grid_align(cont_w, auto_w, get_grid_col_align(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_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); + calc_out->grid_h = grid_align(cont_h, auto_h, get_grid_row_align(cont), row_gap, calc_out->row_num, calc_out->h, calc_out->y, false); LV_ASSERT_MEM_INTEGRITY(); } @@ -367,8 +367,8 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * uint32_t col_pos = get_col_pos(item); uint32_t row_pos = get_row_pos(item); - lv_grid_place_t col_place = get_cell_col_place(item); - lv_grid_place_t row_place = get_cell_row_place(item); + lv_grid_align_t col_align = get_cell_col_align(item); + lv_grid_align_t row_align = get_cell_row_align(item); lv_coord_t col_x1 = c->x[col_pos]; @@ -382,8 +382,8 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * /*If the item has RTL base dir switch start and end*/ if(lv_obj_get_base_dir(item) == LV_BIDI_DIR_RTL) { - if(col_place == LV_GRID_START) col_place = LV_GRID_END; - else if(col_place == LV_GRID_END) col_place = LV_GRID_START; + if(col_align == LV_GRID_ALIGN_START) col_align = LV_GRID_ALIGN_END; + else if(col_align == LV_GRID_ALIGN_END) col_align = LV_GRID_ALIGN_START; } lv_coord_t x; @@ -391,43 +391,43 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * lv_coord_t item_w = lv_area_get_width(&item->coords); lv_coord_t item_h = lv_area_get_height(&item->coords); - switch(col_place) { + switch(col_align) { default: - case LV_GRID_START: + case LV_GRID_ALIGN_START: x = c->x[col_pos]; item->w_layout = 0; break; - case LV_GRID_STRETCH: + case LV_GRID_ALIGN_STRETCH: x = c->x[col_pos]; item_w = col_w; item->w_layout = 1; break; - case LV_GRID_CENTER: + case LV_GRID_ALIGN_CENTER: x = c->x[col_pos] + (col_w - item_w) / 2; item->w_layout = 0; break; - case LV_GRID_END: + case LV_GRID_ALIGN_END: x = c->x[col_pos] + col_w - lv_obj_get_width(item); item->w_layout = 0; break; } - switch(row_place) { + switch(row_align) { default: - case LV_GRID_START: + case LV_GRID_ALIGN_START: y = c->y[row_pos]; item->h_layout = 0; break; - case LV_GRID_STRETCH: + case LV_GRID_ALIGN_STRETCH: y = c->y[row_pos]; item_h = row_h; item->h_layout = 1; break; - case LV_GRID_CENTER: + case LV_GRID_ALIGN_CENTER: y = c->y[row_pos] + (row_h - item_h) / 2; item->h_layout = 0; break; - case LV_GRID_END: + case LV_GRID_ALIGN_END: y = c->y[row_pos] + row_h - lv_obj_get_height(item); item->h_layout = 0; break; @@ -471,18 +471,18 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * } /** - * Place the grid track according to place methods. It keeps the track sizes but sets their position. + * Place the grid track according to align methods. It keeps the track sizes but sets their position. * It can process both columns or rows according to the passed parameters. * @param cont_size size of the containers content area (width/height) * @param auto_size true: the container has auto size in the current direction - * @param place placeing method + * @param align align method * @param gap grid gap * @param track_num number of tracks * @param size_array array with the track sizes * @param pos_array write the positions of the tracks here * @return the total size of the grid */ -static lv_coord_t grid_place(lv_coord_t cont_size, bool auto_size, uint8_t place, lv_coord_t gap, uint32_t track_num, lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse) +static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, uint8_t align, lv_coord_t gap, uint32_t track_num, lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse) { lv_coord_t grid_size = 0; uint32_t i; @@ -490,10 +490,10 @@ static lv_coord_t grid_place(lv_coord_t cont_size, bool auto_size, uint8_t plac if(auto_size) { pos_array[0] = 0; } else { - /*With spaced placements gap will be calculated from the remaining space*/ - if(place == LV_GRID_SPACE_AROUND || place == LV_GRID_SPACE_BETWEEN || place == LV_GRID_SPACE_EVENLY) { + /*With spaced alignment gap will be calculated from the remaining space*/ + if(align == LV_GRID_ALIGN_SPACE_AROUND || align == LV_GRID_ALIGN_SPACE_BETWEEN || align == LV_GRID_ALIGN_SPACE_EVENLY) { gap = 0; - if(track_num == 1) place = LV_GRID_CENTER; + if(track_num == 1) align = LV_GRID_ALIGN_CENTER; } /*Get the full grid size with gap*/ @@ -503,25 +503,25 @@ static lv_coord_t grid_place(lv_coord_t cont_size, bool auto_size, uint8_t plac grid_size -= gap; /*Calculate the position of the first item and set gap is necessary*/ - switch(place) { - case LV_GRID_START: + switch(align) { + case LV_GRID_ALIGN_START: pos_array[0] = 0; break; - case LV_GRID_CENTER: + case LV_GRID_ALIGN_CENTER: pos_array[0] = (cont_size - grid_size) / 2; break; - case LV_GRID_END: + case LV_GRID_ALIGN_END: pos_array[0] = cont_size - grid_size; break; - case LV_GRID_SPACE_BETWEEN: + case LV_GRID_ALIGN_SPACE_BETWEEN: pos_array[0] = 0; gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num - 1); break; - case LV_GRID_SPACE_AROUND: + case LV_GRID_ALIGN_SPACE_AROUND: gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num); pos_array[0] = gap / 2; break; - case LV_GRID_SPACE_EVENLY: + case LV_GRID_ALIGN_SPACE_EVENLY: gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num + 1); pos_array[0] = gap; break; diff --git a/src/extra/layouts/grid/lv_grid.h b/src/extra/layouts/grid/lv_grid.h index c2c37a9f2..5d9557c2f 100644 --- a/src/extra/layouts/grid/lv_grid.h +++ b/src/extra/layouts/grid/lv_grid.h @@ -36,14 +36,14 @@ extern "C" { struct _lv_obj_t; typedef enum { - LV_GRID_START, - LV_GRID_CENTER, - LV_GRID_END, - LV_GRID_STRETCH, - LV_GRID_SPACE_EVENLY, - LV_GRID_SPACE_AROUND, - LV_GRID_SPACE_BETWEEN, -}lv_grid_place_t; + LV_GRID_ALIGN_START, + LV_GRID_ALIGN_CENTER, + LV_GRID_ALIGN_END, + LV_GRID_ALIGN_STRETCH, + LV_GRID_ALIGN_SPACE_EVENLY, + LV_GRID_ALIGN_SPACE_AROUND, + LV_GRID_ALIGN_SPACE_BETWEEN, +}lv_grid_align_t; /********************** * GLOBAL VARIABLES @@ -51,15 +51,15 @@ typedef enum { extern uint32_t LV_LAYOUT_GRID; extern lv_style_prop_t LV_STYLE_GRID_COLUMN_DSC_ARRAY; -extern lv_style_prop_t LV_STYLE_GRID_COLUMN_PLACE; +extern lv_style_prop_t LV_STYLE_GRID_COLUMN_ALIGN; extern lv_style_prop_t LV_STYLE_GRID_ROW_DSC_ARRAY; -extern lv_style_prop_t LV_STYLE_GRID_ROW_PLACE; +extern lv_style_prop_t LV_STYLE_GRID_ROW_ALIGN; extern lv_style_prop_t LV_STYLE_GRID_CELL_COL_POS; extern lv_style_prop_t LV_STYLE_GRID_CELL_COL_SPAN; -extern lv_style_prop_t LV_STYLE_GRID_CELL_COL_PLACE; +extern lv_style_prop_t LV_STYLE_GRID_CELL_X_ALIGN; extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_POS; extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_SPAN; -extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_PLACE; +extern lv_style_prop_t LV_STYLE_GRID_CELL_Y_ALIGN; /********************** * GLOBAL PROTOTYPES @@ -67,9 +67,9 @@ extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_PLACE; void lv_grid_init(void); -void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_templ[], const lv_coord_t row_templ[]); +void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_dsc[], const lv_coord_t row_dsc[]); -void lv_obj_set_grid_place(lv_obj_t * obj, lv_grid_place_t hor_place, lv_grid_place_t ver_place); +void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid_align_t row_align); /** * Set the cell of an object. The object's parent needs to have grid layout, else nothing will happen @@ -81,8 +81,8 @@ void lv_obj_set_grid_place(lv_obj_t * obj, lv_grid_place_t hor_place, lv_grid_pl * @param row_pos row ID * @param row_span number of rows to take (>= 1) */ -void lv_obj_set_grid_cell(struct _lv_obj_t * obj, lv_grid_place_t hor_place, uint8_t col_pos, uint8_t col_span, - lv_grid_place_t ver_place, uint8_t row_pos, uint8_t row_span); +void lv_obj_set_grid_cell(struct _lv_obj_t * obj, lv_grid_align_t column_align, uint8_t col_pos, uint8_t col_span, + lv_grid_align_t row_align, uint8_t row_pos, uint8_t row_span); /** * Just a wrapper to `LV_GRID_FR` for bindings. @@ -108,20 +108,20 @@ static inline void lv_style_set_grid_column_dsc_array(lv_style_t * style, const lv_style_set_prop(style, LV_STYLE_GRID_COLUMN_DSC_ARRAY, v); } -static inline void lv_style_set_grid_row_place(lv_style_t * style, lv_grid_place_t value) +static inline void lv_style_set_grid_row_align(lv_style_t * style, lv_grid_align_t value) { lv_style_value_t v = { - .num = (lv_grid_place_t)value + .num = (lv_grid_align_t)value }; - lv_style_set_prop(style, LV_STYLE_GRID_ROW_PLACE, v); + lv_style_set_prop(style, LV_STYLE_GRID_ROW_ALIGN, v); } -static inline void lv_style_set_grid_col_place(lv_style_t * style, lv_grid_place_t value) +static inline void lv_style_set_grid_column_align(lv_style_t * style, lv_grid_align_t value) { lv_style_value_t v = { - .num = (lv_grid_place_t)value + .num = (lv_grid_align_t)value }; - lv_style_set_prop(style, LV_STYLE_GRID_COLUMN_PLACE, v); + lv_style_set_prop(style, LV_STYLE_GRID_COLUMN_ALIGN, v); } @@ -157,20 +157,20 @@ static inline void lv_style_set_grid_cell_row_span(lv_style_t * style, lv_coord_ lv_style_set_prop(style, LV_STYLE_GRID_CELL_ROW_SPAN, v); } -static inline void lv_style_set_grid_cell_x_place(lv_style_t * style, lv_coord_t value) +static inline void lv_style_set_grid_cell_x_align(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { .num = value }; - lv_style_set_prop(style, LV_STYLE_GRID_CELL_COL_PLACE, v); + lv_style_set_prop(style, LV_STYLE_GRID_CELL_X_ALIGN, v); } -static inline void lv_style_set_grid_cell_y_place(lv_style_t * style, lv_coord_t value) +static inline void lv_style_set_grid_cell_y_align(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { .num = value }; - lv_style_set_prop(style, LV_STYLE_GRID_CELL_ROW_PLACE, v); + lv_style_set_prop(style, LV_STYLE_GRID_CELL_Y_ALIGN, v); } static inline void lv_obj_set_style_grid_row_dsc_array(lv_obj_t * obj, const lv_coord_t value[], lv_style_selector_t selector) @@ -190,20 +190,20 @@ static inline void lv_obj_set_style_grid_column_dsc_array(lv_obj_t * obj, const } -static inline void lv_obj_set_style_grid_row_place(lv_obj_t * obj, lv_grid_place_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_grid_row_align(lv_obj_t * obj, lv_grid_align_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_GRID_ROW_PLACE, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_ROW_ALIGN, v, selector); } -static inline void lv_obj_set_style_grid_column_place(lv_obj_t * obj, lv_grid_place_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_grid_column_align(lv_obj_t * obj, lv_grid_align_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_GRID_COLUMN_PLACE, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_COLUMN_ALIGN, v, selector); } @@ -239,20 +239,20 @@ static inline void lv_obj_set_style_grid_cell_row_span(lv_obj_t * obj, lv_coord_ lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_ROW_SPAN, v, selector); } -static inline void lv_obj_set_style_grid_cell_x_place(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_grid_cell_x_align(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = value }; - lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_COL_PLACE, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_X_ALIGN, v, selector); } -static inline void lv_obj_set_style_grid_cell_y_place(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_grid_cell_y_align(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = value }; - lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_ROW_PLACE, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_Y_ALIGN, v, selector); } static inline const lv_coord_t * lv_obj_get_style_grid_row_dsc_array(const struct _lv_obj_t * obj, uint32_t part) @@ -267,16 +267,16 @@ static inline const lv_coord_t * lv_obj_get_style_grid_column_dsc_array(const st return (const lv_coord_t *)v.ptr; } -static inline lv_grid_place_t lv_obj_get_style_grid_row_place(const struct _lv_obj_t * obj, uint32_t part) +static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_PLACE); - return (lv_grid_place_t)v.num; + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_ALIGN); + return (lv_grid_align_t)v.num; } -static inline lv_grid_place_t lv_obj_get_style_grid_column_place(const struct _lv_obj_t * obj, uint32_t part) +static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_PLACE); - return (lv_grid_place_t)v.num; + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_ALIGN); + return (lv_grid_align_t)v.num; } static inline lv_coord_t lv_obj_get_style_grid_cell_column_pos(const struct _lv_obj_t * obj, uint32_t part) @@ -291,7 +291,6 @@ static inline lv_coord_t lv_obj_get_style_grid_cell_column_span(const struct _lv return (lv_coord_t)v.num; } - static inline lv_coord_t lv_obj_get_style_grid_cell_row_pos(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_POS); @@ -304,15 +303,15 @@ static inline lv_coord_t lv_obj_get_style_grid_cell_row_span(const struct _lv_ob return (lv_coord_t)v.num; } -static inline lv_coord_t lv_obj_get_style_grid_cell_x_place(const struct _lv_obj_t * obj, uint32_t part) +static inline lv_coord_t lv_obj_get_style_grid_cell_x_align(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COL_PLACE); + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_X_ALIGN); return (lv_coord_t)v.num; } -static inline lv_coord_t lv_obj_get_style_grid_cell_y_place(const struct _lv_obj_t * obj, uint32_t part) +static inline lv_coord_t lv_obj_get_style_grid_cell_y_align(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_PLACE); + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_Y_ALIGN); return (lv_coord_t)v.num; } diff --git a/src/extra/widgets/calendar/lv_calendar_header_arrow.c b/src/extra/widgets/calendar/lv_calendar_header_arrow.c index 6a7a64471..f31d4134b 100644 --- a/src/extra/widgets/calendar/lv_calendar_header_arrow.c +++ b/src/extra/widgets/calendar/lv_calendar_header_arrow.c @@ -57,7 +57,7 @@ lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent, lv_obj_t * calenda lv_coord_t w = lv_obj_get_width(calendar); lv_obj_set_size(header, w, LV_SIZE_CONTENT); 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_START); + lv_obj_set_flex_align(header, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START); lv_obj_t * mo_prev = lv_btn_create(header); lv_obj_set_style_bg_img_src(mo_prev, LV_SYMBOL_LEFT, 0); diff --git a/src/extra/widgets/calendar/lv_calendar_header_dropdown.c b/src/extra/widgets/calendar/lv_calendar_header_dropdown.c index 90b04b7b7..ccd3fd8d5 100644 --- a/src/extra/widgets/calendar/lv_calendar_header_dropdown.c +++ b/src/extra/widgets/calendar/lv_calendar_header_dropdown.c @@ -66,7 +66,7 @@ lv_obj_t * lv_calendar_header_dropdown_create(lv_obj_t * parent, lv_obj_t * cale lv_coord_t w = lv_obj_get_width(calendar); lv_obj_set_size(header, w, LV_SIZE_CONTENT); 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_START); + lv_obj_set_flex_align(header, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START); lv_obj_t * year_dd = lv_dropdown_create(header); lv_dropdown_set_options(year_dd, year_list); diff --git a/src/extra/widgets/msgbox/lv_msgbox.c b/src/extra/widgets/msgbox/lv_msgbox.c index f36944c01..faa253b26 100644 --- a/src/extra/widgets/msgbox/lv_msgbox.c +++ b/src/extra/widgets/msgbox/lv_msgbox.c @@ -58,7 +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_set_flex_align(mbox, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START); lv_obj_t * label; label = lv_label_create(mbox); diff --git a/src/extra/widgets/win/lv_win.c b/src/extra/widgets/win/lv_win.c index d44cddb8a..a783106f7 100644 --- a/src/extra/widgets/win/lv_win.c +++ b/src/extra/widgets/win/lv_win.c @@ -96,7 +96,7 @@ static void lv_win_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_obj_t * header = lv_obj_create(obj); 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_set_flex_align(header, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_t * cont = lv_obj_create(obj); lv_obj_set_flex_grow(cont, 1);