From a78687ee5d3ae9132664e7eb5639e85f1067691d Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 12 May 2020 21:29:16 +0200 Subject: [PATCH] add LV_USE_API_EXTENSION_V6 and LV_USE_IMG_TRANSFORM config options --- lv_conf_template.h | 6 +++ src/lv_api_map.h | 31 ++++++++++++++++ src/lv_conf_internal.h | 10 +++++ src/lv_core/lv_obj.h | 2 +- src/lv_draw/lv_draw_img.c | 50 ++++++++++++++++--------- src/lv_draw/lv_img_buf.c | 15 ++++++-- src/lv_draw/lv_img_buf.h | 4 +- src/lv_themes/lv_theme_material.c | 10 ++--- src/lv_themes/lv_theme_mono.c | 10 ++--- src/lv_themes/lv_theme_template.c | 12 +++--- src/lv_widgets/lv_canvas.c | 4 ++ src/lv_widgets/lv_dropdown.c | 17 +++++---- src/lv_widgets/lv_list.c | 20 +++++----- src/lv_widgets/lv_list.h | 10 ++--- src/lv_widgets/lv_page.c | 62 +++++++++++++++---------------- src/lv_widgets/lv_page.h | 54 +++++++++++++-------------- src/lv_widgets/lv_roller.c | 20 +++++----- src/lv_widgets/lv_spinbox.c | 2 +- src/lv_widgets/lv_tabview.c | 36 +++++++++--------- src/lv_widgets/lv_tabview.h | 2 +- src/lv_widgets/lv_textarea.c | 28 +++++++------- src/lv_widgets/lv_textarea.h | 14 +++---- src/lv_widgets/lv_tileview.c | 14 +++---- src/lv_widgets/lv_tileview.h | 2 +- src/lv_widgets/lv_win.c | 16 ++++---- src/lv_widgets/lv_win.h | 6 +-- tests/build.py | 8 ++++ 27 files changed, 275 insertions(+), 190 deletions(-) diff --git a/lv_conf_template.h b/lv_conf_template.h index e3a80a6f9..162fda021 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -169,6 +169,9 @@ typedef void * lv_anim_user_data_t; /* 1: Use the `opa_scale` style property to set the opacity of an object and its children at once*/ #define LV_USE_OPA_SCALE 1 +/* 1: Use image zoom and rotation*/ +#define LV_USE_IMG_TRANSFORM 1 + /* 1: Enable object groups (for keyboard/encoder navigation) */ #define LV_USE_GROUP 1 #if LV_USE_GROUP @@ -192,6 +195,9 @@ typedef void * lv_fs_drv_user_data_t; /*1: Show CPU usage and FPS count in the right bottom corner*/ #define LV_USE_PERF_MONITOR 0 +/*1: Use the functions and types from the older API if possible */ +#define LV_USE_API_EXTENSION_V6 1 + /*======================== * Image decoder and cache *========================*/ diff --git a/src/lv_api_map.h b/src/lv_api_map.h index bf85135aa..f194a5881 100644 --- a/src/lv_api_map.h +++ b/src/lv_api_map.h @@ -30,6 +30,7 @@ extern "C" { /*--------------------- * V6.0 COMPATIBILITY *--------------------*/ +#if LV_USE_API_EXTENSION_V6 static inline void lv_task_once(lv_task_t * task) { @@ -147,6 +148,36 @@ static inline void lv_roller_set_fix_width(lv_obj_t * roller, lv_coord_t w) #endif + +#if LV_USE_PAGE +#define lv_scrlbar_mode_t lv_scrollbar_mode_t + +#define LV_SCRLBAR_MODE_OFF LV_SCROLLBAR_MODE_OFF +#define LV_SCRLBAR_MODE_ON LV_SCRILLBAR_MODE_ON +#define LV_SCRLBAR_MODE_DRAG LV_SCROLLBAR_MODE_DRAG +#define LV_SCRLBAR_MODE_AUTO LV_SCROLLBAR_MODE_AUTO +#define LV_SCRLBAR_MODE_HIDE LV_SCROLLBAR_MODE_HIDE +#define LV_SCRLBAR_MODE_UNHIDE LV_SCROLLBAR_MODE_UNHIDE + + +static inline void lv_page_set_scrlbar_mode(lv_obj_t * page, lv_scrlbar_mode_t sb_mode) +{ + lv_page_set_scrollbar_mode(page, sb_mode); +} +static inline lv_scrollbar_mode_t lv_page_get_scrlbar_mode(lv_obj_t * page) +{ + return lv_page_get_scrollbar_mode(page); +} + + +static inline lv_obj_t * lv_page_get_scrl(lv_obj_t * page) +{ + return lv_page_get_scrllable(page); +} +#endif + +#endif /*LV_USE_API_EXTENSION_V6*/ + /********************** * MACROS **********************/ diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index daf6ff4c9..4ab279751 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -252,6 +252,11 @@ #define LV_USE_OPA_SCALE 1 #endif +/* 1: Use image zoom and rotation*/ +#ifndef LV_USE_IMG_TRANSFORM +#define LV_USE_IMG_TRANSFORM 1 +#endif + /* 1: Enable object groups (for keyboard/encoder navigation) */ #ifndef LV_USE_GROUP #define LV_USE_GROUP 1 @@ -285,6 +290,11 @@ #define LV_USE_PERF_MONITOR 0 #endif +/*1: Use the functions and types from the older API if possible */ +#ifndef LV_USE_API_EXTENSION_V6 +#define LV_USE_API_EXTENSION_V6 1 +#endif + /*======================== * Image decoder and cache *========================*/ diff --git a/src/lv_core/lv_obj.h b/src/lv_core/lv_obj.h index 5be82c970..c2b862025 100644 --- a/src/lv_core/lv_obj.h +++ b/src/lv_core/lv_obj.h @@ -1324,7 +1324,7 @@ lv_res_t lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name); /** * Initialize a rectangle descriptor from an object's styles * @param obj pointer to an object - * @param type type of style. E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_STYLE_REL` or `LV_PAGE_STYLE_SCRL` + * @param type type of style. E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_SLIDER_KOB` * @param draw_dsc the descriptor the initialize * @note Only the relevant fields will be set. * E.g. if `border width == 0` the other border properties won't be evaluated. diff --git a/src/lv_draw/lv_draw_img.c b/src/lv_draw/lv_draw_img.c index 0baf2a9a5..411635a6a 100644 --- a/src/lv_draw/lv_draw_img.c +++ b/src/lv_draw/lv_draw_img.c @@ -377,7 +377,6 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const /*Go to the first displayed pixel of the map*/ int32_t map_w = lv_area_get_width(map_area); - int32_t map_h = lv_area_get_height(map_area); const uint8_t * map_buf_tmp = map_p; map_buf_tmp += map_w * (draw_area.y1 - (map_area->y1 - disp_area->y1)) * px_size_byte; map_buf_tmp += (draw_area.x1 - (map_area->x1 - disp_area->x1)) * px_size_byte; @@ -397,8 +396,11 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_coord_t draw_area_h = lv_area_get_height(&draw_area); lv_coord_t draw_area_w = lv_area_get_width(&draw_area); +#if LV_USE_IMG_TRANSFORM bool transform = draw_dsc->angle != 0 || draw_dsc->zoom != LV_IMG_ZOOM_NONE ? true : false; - +#else + bool transform = false; +#endif /*Simple ARGB image. Handle it as special case because it's very common*/ if(other_mask_cnt == 0 && !transform && !chroma_key && draw_dsc->recolor_opa == LV_OPA_TRANSP && alpha_byte) { #if LV_USE_GPU_STM32_DMA2D && LV_COLOR_DEPTH == 32 @@ -457,6 +459,8 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const } /*Most complicated case: transform or other mask or chroma keyed*/ else { + +#if LV_USE_IMG_TRANSFORM lv_img_transform_dsc_t trans_dsc; lv_memset_00(&trans_dsc, sizeof(lv_img_transform_dsc_t)); if(transform) { @@ -468,7 +472,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const trans_dsc.cfg.zoom = draw_dsc->zoom; trans_dsc.cfg.src = map_p; trans_dsc.cfg.src_w = map_w; - trans_dsc.cfg.src_h = map_h; + trans_dsc.cfg.src_h = lv_area_get_height(map_area);; trans_dsc.cfg.cf = cf; trans_dsc.cfg.pivot_x = draw_dsc->pivot.x; trans_dsc.cfg.pivot_y = draw_dsc->pivot.y; @@ -477,7 +481,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_img_buf_transform_init(&trans_dsc); } - +#endif uint16_t recolor_premult[3] = {0}; lv_opa_t recolor_opa_inv = 255 - draw_dsc->recolor_opa; if(draw_dsc->recolor_opa != 0) { @@ -496,15 +500,38 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const int32_t x; int32_t y; +#if LV_USE_IMG_TRANSFORM int32_t rot_y = disp_area->y1 + draw_area.y1 - map_area->y1; +#endif for(y = 0; y < draw_area_h; y++) { map_px = map_buf_tmp; uint32_t px_i_start = px_i; +#if LV_USE_IMG_TRANSFORM int32_t rot_x = disp_area->x1 + draw_area.x1 - map_area->x1; +#endif for(x = 0; x < draw_area_w; x++, map_px += px_size_byte, px_i++) { - if(transform == false) { + +#if LV_USE_IMG_TRANSFORM + if(transform) { + + /*Transform*/ + bool ret; + ret = lv_img_buf_transform(&trans_dsc, rot_x + x, rot_y + y); + if(ret == false) { + mask_buf[px_i] = LV_OPA_TRANSP; + continue; + } + else { + mask_buf[px_i] = trans_dsc.res.opa; + c.full = trans_dsc.res.color.full; + } + } + /*No transform*/ + else +#endif + { if(alpha_byte) { lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1]; mask_buf[px_i] = px_opa; @@ -531,19 +558,6 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const } } } - else { - /*Transform*/ - bool ret; - ret = lv_img_buf_transform(&trans_dsc, rot_x + x, rot_y + y); - if(ret == false) { - mask_buf[px_i] = LV_OPA_TRANSP; - continue; - } - else { - mask_buf[px_i] = trans_dsc.res.opa; - c.full = trans_dsc.res.color.full; - } - } if(draw_dsc->recolor_opa != 0) { c = lv_color_mix_premult(recolor_premult, c, recolor_opa_inv); diff --git a/src/lv_draw/lv_img_buf.c b/src/lv_draw/lv_img_buf.c index e44cbb89c..3ae690e4b 100644 --- a/src/lv_draw/lv_img_buf.c +++ b/src/lv_draw/lv_img_buf.c @@ -411,6 +411,8 @@ uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf) } } + +#if LV_USE_IMG_TRANSFORM /** * Initialize a descriptor to tranform an image * @param dsc pointer to an `lv_img_transform_dsc_t` variable whose `cfg` field is initialized @@ -454,7 +456,7 @@ void lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc) dsc->res.opa = LV_OPA_COVER; dsc->res.color = dsc->cfg.color; } - +#endif /** * Get the area of a rectangle if its rotated and scaled @@ -468,7 +470,7 @@ void lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc) void lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, int16_t angle, uint16_t zoom, lv_point_t * pivot) { - +#if LV_USE_IMG_TRANSFORM int32_t angle_low = angle / 10; int32_t angle_hight = angle_low + 1; int32_t angle_rem = angle - (angle_low * 10); @@ -520,9 +522,15 @@ void lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h res->x2 = LV_MATH_MAX4(lb.x, lt.x, rb.x, rt.x); res->y1 = LV_MATH_MIN4(lb.y, lt.y, rb.y, rt.y); res->y2 = LV_MATH_MAX4(lb.y, lt.y, rb.y, rt.y); - +#else + res->x1 = 0; + res->y1 = 0; + res->x2 = w; + res->y2 = h; +#endif } +#if LV_USE_IMG_TRANSFORM /** * Continue transformation by taking the neighbors into account * @param dsc pointer to the transformation descriptor @@ -642,6 +650,7 @@ bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc) return true; } +#endif /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/lv_draw/lv_img_buf.h b/src/lv_draw/lv_img_buf.h index 7666e2097..dc71ec719 100644 --- a/src/lv_draw/lv_img_buf.h +++ b/src/lv_draw/lv_img_buf.h @@ -252,6 +252,7 @@ void lv_img_buf_free(lv_img_dsc_t * dsc); uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf); +#if LV_USE_IMG_TRANSFORM /** * Initialize a descriptor to rotate an image * @param dsc pointer to an `lv_img_transform_dsc_t` variable whose `cfg` field is initialized @@ -264,6 +265,7 @@ void lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc); */ bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc); + /** * Get which color and opa would come to a pixel if it were rotated * @param dsc a descriptor initialized by `lv_img_buf_rotate_init` @@ -351,7 +353,7 @@ static inline bool lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_t return ret; } - +#endif /** * Get the area of a rectangle if its rotated and scaled * @param res store the coordinates here diff --git a/src/lv_themes/lv_theme_material.c b/src/lv_themes/lv_theme_material.c index 96f9ddb7b..2dcbdb2bf 100644 --- a/src/lv_themes/lv_theme_material.c +++ b/src/lv_themes/lv_theme_material.c @@ -1129,7 +1129,7 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name) list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG); lv_style_list_add_style(list, &scr); - lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRL); + lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE); lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG); list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG); @@ -1160,8 +1160,8 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name) list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG); lv_style_list_add_style(list, &scr); - lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCRLBAR); - list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCRLBAR); + lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR); lv_style_list_add_style(list, &sb); #if LV_USE_ANIMATION @@ -1321,8 +1321,8 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name) list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR); lv_style_list_add_style(list, &ta_cursor); - lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCRLBAR); - list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCRLBAR); + lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR); lv_style_list_add_style(list, &sb); break; diff --git a/src/lv_themes/lv_theme_mono.c b/src/lv_themes/lv_theme_mono.c index f743443f0..cccbd5df4 100644 --- a/src/lv_themes/lv_theme_mono.c +++ b/src/lv_themes/lv_theme_mono.c @@ -779,7 +779,7 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name) list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG); lv_style_list_add_style(list, &style_scr); - lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRL); + lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE); lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG); list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG); @@ -811,8 +811,8 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name) list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG); lv_style_list_add_style(list, &style_bg); - lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCRLBAR); - list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCRLBAR); + lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR); lv_style_list_add_style(list, &style_sb); lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH); @@ -977,8 +977,8 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name) list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR); lv_style_list_add_style(list, &style_ta_cursor); - lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCRLBAR); - list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCRLBAR); + lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR); lv_style_list_add_style(list, &style_sb); break; #endif diff --git a/src/lv_themes/lv_theme_template.c b/src/lv_themes/lv_theme_template.c index 317b33fc7..1593e2041 100644 --- a/src/lv_themes/lv_theme_template.c +++ b/src/lv_themes/lv_theme_template.c @@ -623,8 +623,8 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name) list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG); lv_style_list_add_style(list, &style_bg); - lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRL); - list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCRL); + lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE); + list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE); lv_style_list_add_style(list, &style_bg); lv_style_list_add_style(list, &style_color); @@ -662,8 +662,8 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name) list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG); lv_style_list_add_style(list, &style_bg); - lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCRLBAR); - list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCRLBAR); + lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR); lv_style_list_add_style(list, &style_bg); lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH); @@ -820,8 +820,8 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name) lv_style_list_add_style(list, &style_bg); lv_style_list_add_style(list, &style_tight); - lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCRLBAR); - list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCRLBAR); + lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR); lv_style_list_add_style(list, &style_bg); break; #endif diff --git a/src/lv_widgets/lv_canvas.c b/src/lv_widgets/lv_canvas.c index 7e7b141da..5cf5dad8a 100644 --- a/src/lv_widgets/lv_canvas.c +++ b/src/lv_widgets/lv_canvas.c @@ -278,6 +278,7 @@ void lv_canvas_transform(lv_obj_t * canvas, lv_img_dsc_t * img, int16_t angle, u lv_coord_t offset_y, int32_t pivot_x, int32_t pivot_y, bool antialias) { +#if LV_USE_IMG_TRANSFORM LV_ASSERT_OBJ(canvas, LV_OBJX_NAME); LV_ASSERT_NULL(img); @@ -362,6 +363,9 @@ void lv_canvas_transform(lv_obj_t * canvas, lv_img_dsc_t * img, int16_t angle, u } lv_obj_invalidate(canvas); +#else + LV_LOG_WARN("LV_USE_IMG_TRANSFORM is disabled in lv_conf.h"); +#endif } diff --git a/src/lv_widgets/lv_dropdown.c b/src/lv_widgets/lv_dropdown.c index 2250fe419..82783a77e 100644 --- a/src/lv_widgets/lv_dropdown.c +++ b/src/lv_widgets/lv_dropdown.c @@ -586,10 +586,10 @@ void lv_dropdown_open(lv_obj_t * ddlist) ext->page = lv_page_create(lv_obj_get_screen(ddlist), NULL); lv_obj_add_protect(ext->page, LV_PROTECT_POS | LV_PROTECT_CLICK_FOCUS); - lv_obj_add_protect(lv_page_get_scrl(ext->page), LV_PROTECT_CLICK_FOCUS); + lv_obj_add_protect(lv_page_get_scrllable(ext->page), LV_PROTECT_CLICK_FOCUS); if(ancestor_page_signal == NULL) ancestor_page_signal = lv_obj_get_signal_cb(ext->page); - if(ancestor_page_scrl_signal == NULL) ancestor_page_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrl(ext->page)); + if(ancestor_page_scrl_signal == NULL) ancestor_page_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrllable(ext->page)); if(ancestor_page_design == NULL) ancestor_page_design = lv_obj_get_design_cb(ext->page); lv_dropdown_page_ext_t * page_ext = lv_obj_allocate_ext_attr(ext->page, sizeof(lv_dropdown_page_ext_t)); @@ -603,7 +603,8 @@ void lv_dropdown_open(lv_obj_t * ddlist) lv_obj_set_design_cb(ext->page, lv_dropdown_page_design); lv_obj_set_signal_cb(ext->page, lv_dropdown_page_signal); - lv_obj_set_signal_cb(lv_page_get_scrl(ext->page), lv_dropdown_page_scrl_signal); + lv_obj_set_signal_cb(lv_page_get_scrllable(ext->page), lv_dropdown_page_scrl_signal); + lv_page_set_scrollbar_mode(ext->page, LV_SCRILLBAR_MODE_ON); lv_style_list_copy(lv_obj_get_style_list(ext->page, LV_PAGE_PART_BG), &ext->style_page); lv_style_list_copy(lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCROLLBAR), &ext->style_scrlbar); @@ -849,11 +850,11 @@ static lv_design_res_t lv_dropdown_page_design(lv_obj_t * page, const lv_area_t has_common = lv_area_intersect(&clip_area_core, clip_area, &ext->page->coords); if(has_common) { if(ext->pr_opt_id != LV_DROPDOWN_PR_NONE) { - draw_box_label(ddlist, clip_area, ext->pr_opt_id, LV_STATE_PRESSED); + draw_box_label(ddlist, &clip_area_core, ext->pr_opt_id, LV_STATE_PRESSED); } if(ext->show_selected) { - draw_box_label(ddlist, clip_area, ext->sel_opt_id, LV_STATE_DEFAULT); + draw_box_label(ddlist, &clip_area_core, ext->sel_opt_id, LV_STATE_DEFAULT); } } } @@ -1022,7 +1023,7 @@ static lv_res_t lv_dropdown_page_signal(lv_obj_t * page, lv_signal_t sign, void * (The scrollabel is scrolled the "select rectangle" is drawn on the bg too)*/ lv_style_int_t left = lv_obj_get_style_pad_left(ddlist, LV_DROPDOWN_PART_LIST); lv_style_int_t right = lv_obj_get_style_pad_right(ddlist, LV_DROPDOWN_PART_LIST); - lv_obj_t * scrl = lv_page_get_scrl(page); + lv_obj_t * scrl = lv_page_get_scrllable(page); scrl->ext_draw_pad = LV_MATH_MAX3(scrl->ext_draw_pad, left, right); } else if(sign == LV_SIGNAL_RELEASED) { @@ -1296,7 +1297,7 @@ static void position_to_selected(lv_obj_t * ddlist) const lv_font_t * font = lv_obj_get_style_text_font(ddlist, LV_DROPDOWN_PART_LIST); lv_coord_t font_h = lv_font_get_line_height(font); - lv_obj_t * scrl = lv_page_get_scrl(ext->page); + lv_obj_t * scrl = lv_page_get_scrllable(ext->page); lv_obj_t * label = get_label(ddlist); if(label == NULL) return; @@ -1316,7 +1317,7 @@ static lv_obj_t * get_label(const lv_obj_t * ddlist) lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist); if(ext->page == NULL) return NULL; - return lv_obj_get_child(lv_page_get_scrl(ext->page), NULL); + return lv_obj_get_child(lv_page_get_scrllable(ext->page), NULL); } #endif diff --git a/src/lv_widgets/lv_list.c b/src/lv_widgets/lv_list.c index 483551d08..65c79bd2b 100644 --- a/src/lv_widgets/lv_list.c +++ b/src/lv_widgets/lv_list.c @@ -94,10 +94,10 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy) /*Init the new list object*/ if(copy == NULL) { lv_page_set_anim_time(list, LV_LIST_DEF_ANIM_TIME); - lv_page_set_scrl_fit2(list, LV_FIT_PARENT, LV_FIT_TIGHT); + lv_page_set_scrllable_fit2(list, LV_FIT_PARENT, LV_FIT_TIGHT); lv_obj_set_size(list, 2 * LV_DPI, 3 * LV_DPI); lv_page_set_scrl_layout(list, LV_LIST_LAYOUT_DEF); - lv_list_set_sb_mode(list, LV_SCRLBAR_MODE_DRAG); + lv_list_set_scrollbar_mode(list, LV_SCROLLBAR_MODE_DRAG); lv_theme_apply(list, LV_THEME_LIST); @@ -131,7 +131,7 @@ void lv_list_clean(lv_obj_t * list) { LV_ASSERT_OBJ(list, LV_OBJX_NAME); - lv_obj_t * scrl = lv_page_get_scrl(list); + lv_obj_t * scrl = lv_page_get_scrllable(list); lv_obj_clean(scrl); } @@ -155,7 +155,7 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * t lv_coord_t pos_x_ori = lv_obj_get_x(list); lv_coord_t pos_y_ori = lv_obj_get_y(list); - lv_obj_t * scrl = lv_page_get_scrl(list); + lv_obj_t * scrl = lv_page_get_scrllable(list); lv_obj_add_protect(scrl, LV_PROTECT_CHILD_CHG); /*Create a list element with the image an the text*/ @@ -328,10 +328,10 @@ void lv_list_set_layout(lv_obj_t * list, lv_layout_t layout) } if(layout == LV_LAYOUT_COLUMN_MID || layout == LV_LAYOUT_COLUMN_LEFT || layout == LV_LAYOUT_COLUMN_RIGHT) { - lv_page_set_scrl_fit2(list, LV_FIT_PARENT, LV_FIT_TIGHT); + lv_page_set_scrllable_fit2(list, LV_FIT_PARENT, LV_FIT_TIGHT); } else if(layout == LV_LAYOUT_ROW_MID || layout == LV_LAYOUT_ROW_TOP || layout == LV_LAYOUT_ROW_BOTTOM) { - lv_page_set_scrl_fit2(list, LV_FIT_TIGHT, LV_FIT_TIGHT); + lv_page_set_scrllable_fit2(list, LV_FIT_TIGHT, LV_FIT_TIGHT); lv_cont_set_fit2(list, LV_FIT_NONE, LV_FIT_TIGHT); } @@ -414,7 +414,7 @@ lv_obj_t * lv_list_get_prev_btn(const lv_obj_t * list, lv_obj_t * prev_btn) * When getting the next button try to be sure that it is at least a button */ lv_obj_t * btn; - lv_obj_t * scrl = lv_page_get_scrl(list); + lv_obj_t * scrl = lv_page_get_scrllable(list); btn = lv_obj_get_child(scrl, prev_btn); if(btn == NULL) return NULL; @@ -441,7 +441,7 @@ lv_obj_t * lv_list_get_next_btn(const lv_obj_t * list, lv_obj_t * prev_btn) * When getting the next button try to be sure that it is at least a button */ lv_obj_t * btn; - lv_obj_t * scrl = lv_page_get_scrl(list); + lv_obj_t * scrl = lv_page_get_scrllable(list); btn = lv_obj_get_child_back(scrl, prev_btn); if(btn == NULL) return NULL; @@ -540,7 +540,7 @@ void lv_list_up(const lv_obj_t * list) /*Search the first list element which 'y' coordinate is below the parent * and position the list to show this element on the bottom*/ - lv_obj_t * scrl = lv_page_get_scrl(list); + lv_obj_t * scrl = lv_page_get_scrllable(list); lv_obj_t * e; lv_obj_t * e_prev = NULL; @@ -581,7 +581,7 @@ void lv_list_down(const lv_obj_t * list) /*Search the first list element which 'y' coordinate is above the parent * and position the list to show this element on the top*/ - lv_obj_t * scrl = lv_page_get_scrl(list); + lv_obj_t * scrl = lv_page_get_scrllable(list); lv_obj_t * e; e = lv_list_get_prev_btn(list, NULL); while(e != NULL) { diff --git a/src/lv_widgets/lv_list.h b/src/lv_widgets/lv_list.h index 9de27ac68..92e521a14 100644 --- a/src/lv_widgets/lv_list.h +++ b/src/lv_widgets/lv_list.h @@ -122,9 +122,9 @@ void lv_list_focus_btn(lv_obj_t * list, lv_obj_t * btn); * @param list pointer to a list object * @param sb_mode the new mode from 'lv_page_sb_mode_t' enum */ -static inline void lv_list_set_sb_mode(lv_obj_t * list, lv_scrlbar_mode_t mode) +static inline void lv_list_set_scrollbar_mode(lv_obj_t * list, lv_scrollbar_mode_t mode) { - lv_page_set_scrlbar_mode(list, mode); + lv_page_set_scrollbar_mode(list, mode); } /** @@ -239,11 +239,11 @@ lv_layout_t lv_list_get_layout(lv_obj_t * list); /** * Get the scroll bar mode of a list * @param list pointer to a list object - * @return scrollbar mode from 'lv_page_sb_mode_t' enum + * @return scrollbar mode from 'lv_scrollbar_mode_t' enum */ -static inline lv_scrlbar_mode_t lv_list_get_sb_mode(const lv_obj_t * list) +static inline lv_scrollbar_mode_t lv_list_get_scrollbar_mode(const lv_obj_t * list) { - return lv_page_get_sb_mode(list); + return lv_page_get_scrollbar_mode(list); } /** diff --git a/src/lv_widgets/lv_page.c b/src/lv_widgets/lv_page.c index f2208898e..141c68fb9 100644 --- a/src/lv_widgets/lv_page.c +++ b/src/lv_widgets/lv_page.c @@ -101,7 +101,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy) lv_style_list_init(&ext->scrlbar.style); ext->scrlbar.hor_draw = 0; ext->scrlbar.ver_draw = 0; - ext->scrlbar.mode = LV_SCRLBAR_MODE_AUTO; + ext->scrlbar.mode = LV_SCROLLBAR_MODE_AUTO; #if LV_USE_ANIMATION lv_style_list_init(&ext->edge_flash.style); ext->edge_flash.enabled = 0; @@ -131,7 +131,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy) lv_obj_set_signal_cb(page, lv_page_signal); lv_obj_set_design_cb(page, lv_page_design); - lv_page_set_scrlbar_mode(page, ext->scrlbar.mode); + lv_page_set_scrollbar_mode(page, ext->scrlbar.mode); lv_theme_apply(page, LV_THEME_PAGE); @@ -151,7 +151,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy) lv_obj_set_signal_cb(page, lv_page_signal); lv_obj_set_design_cb(page, lv_page_design); - lv_page_set_scrlbar_mode(page, copy_ext->scrlbar.mode); + lv_page_set_scrollbar_mode(page, copy_ext->scrlbar.mode); } @@ -170,7 +170,7 @@ void lv_page_clean(lv_obj_t * page) { LV_ASSERT_OBJ(page, LV_OBJX_NAME); - lv_obj_t * scrl = lv_page_get_scrl(page); + lv_obj_t * scrl = lv_page_get_scrllable(page); lv_obj_clean(scrl); } @@ -183,19 +183,19 @@ void lv_page_clean(lv_obj_t * page) * @param page pointer to a page object * @param sb_mode the new mode from 'lv_page_sb.mode_t' enum */ -void lv_page_set_scrlbar_mode(lv_obj_t * page, lv_scrlbar_mode_t sb_mode) +void lv_page_set_scrollbar_mode(lv_obj_t * page, lv_scrollbar_mode_t sb_mode) { LV_ASSERT_OBJ(page, LV_OBJX_NAME); lv_page_ext_t * ext = lv_obj_get_ext_attr(page); if(ext->scrlbar.mode == sb_mode) return; - if(sb_mode == LV_SCRLBAR_MODE_HIDE) - ext->scrlbar.mode |= LV_SCRLBAR_MODE_HIDE; /*Set the hidden flag*/ - else if(sb_mode == LV_SCRLBAR_MODE_UNHIDE) - ext->scrlbar.mode &= (~LV_SCRLBAR_MODE_HIDE); /*Clear the hidden flag*/ + if(sb_mode == LV_SCROLLBAR_MODE_HIDE) + ext->scrlbar.mode |= LV_SCROLLBAR_MODE_HIDE; /*Set the hidden flag*/ + else if(sb_mode == LV_SCROLLBAR_MODE_UNHIDE) + ext->scrlbar.mode &= (~LV_SCROLLBAR_MODE_HIDE); /*Clear the hidden flag*/ else { - if(ext->scrlbar.mode & LV_SCRLBAR_MODE_HIDE) sb_mode |= LV_SCRLBAR_MODE_HIDE; + if(ext->scrlbar.mode & LV_SCROLLBAR_MODE_HIDE) sb_mode |= LV_SCROLLBAR_MODE_HIDE; ext->scrlbar.mode = sb_mode; } @@ -270,7 +270,7 @@ void lv_page_set_edge_flash(lv_obj_t * page, bool en) * @param page pointer to a page object * @return pointer to a container which is the scrollable part of the page */ -lv_obj_t * lv_page_get_scrl(const lv_obj_t * page) +lv_obj_t * lv_page_get_scrllable(const lv_obj_t * page) { LV_ASSERT_OBJ(page, LV_OBJX_NAME); @@ -302,7 +302,7 @@ uint16_t lv_page_get_anim_time(const lv_obj_t * page) * @param page pointer to a page object * @return the mode from 'lv_page_sb.mode_t' enum */ -lv_scrlbar_mode_t lv_page_get_sb_mode(const lv_obj_t * page) +lv_scrollbar_mode_t lv_page_get_scrollbar_mode(const lv_obj_t * page) { LV_ASSERT_OBJ(page, LV_OBJX_NAME); @@ -435,7 +435,7 @@ lv_coord_t lv_page_get_height_grid(lv_obj_t * page, uint8_t div, uint8_t span) */ bool lv_page_on_edge(lv_obj_t * page, lv_page_edge_t edge) { - lv_obj_t * scrl = lv_page_get_scrl(page); + lv_obj_t * scrl = lv_page_get_scrllable(page); lv_area_t page_coords; lv_area_t scrl_coords; @@ -571,7 +571,7 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, lv_anim_enable_t anim_ */ void lv_page_scroll_hor(lv_obj_t * page, lv_coord_t dist) { - lv_obj_t * scrl = lv_page_get_scrl(page); + lv_obj_t * scrl = lv_page_get_scrllable(page); #if LV_USE_ANIMATION lv_anim_t a; @@ -593,7 +593,7 @@ void lv_page_scroll_hor(lv_obj_t * page, lv_coord_t dist) */ void lv_page_scroll_ver(lv_obj_t * page, lv_coord_t dist) { - lv_obj_t * scrl = lv_page_get_scrl(page); + lv_obj_t * scrl = lv_page_get_scrllable(page); #if LV_USE_ANIMATION lv_anim_t a; @@ -707,11 +707,11 @@ static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_ar lv_draw_rect_dsc_t rect_dsc; lv_draw_rect_dsc_init(&rect_dsc); lv_obj_init_draw_rect_dsc(page, LV_PAGE_PART_SCROLLBAR, &rect_dsc); - if(ext->scrlbar.hor_draw && (ext->scrlbar.mode & LV_SCRLBAR_MODE_HIDE) == 0) { + if(ext->scrlbar.hor_draw && (ext->scrlbar.mode & LV_SCROLLBAR_MODE_HIDE) == 0) { lv_draw_rect(&sb_hor_area, clip_area, &rect_dsc); } - if(ext->scrlbar.ver_draw && (ext->scrlbar.mode & LV_SCRLBAR_MODE_HIDE) == 0) { + if(ext->scrlbar.ver_draw && (ext->scrlbar.mode & LV_SCROLLBAR_MODE_HIDE) == 0) { lv_draw_rect(&sb_ver_area, clip_area, &rect_dsc); } } @@ -758,7 +758,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) } else if(sign == LV_SIGNAL_GET_STATE_DSC) { lv_get_state_info_t * info = param; - if(info->part == LV_PAGE_PART_SCROLLABLE) info->result = lv_obj_get_state(lv_page_get_scrl(page), LV_CONT_PART_MAIN); + if(info->part == LV_PAGE_PART_SCROLLABLE) info->result = lv_obj_get_state(lv_page_get_scrllable(page), LV_CONT_PART_MAIN); else info->result = lv_obj_get_state(page, info->part); return LV_RES_OK; } @@ -948,7 +948,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi scrl_reposition(page); } else if(sign == LV_SIGNAL_DRAG_BEGIN) { - if(page_ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG) { + if(page_ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) { scrlbar_refresh(page); } } @@ -959,10 +959,10 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi lv_page_ext_t * scroller_page_ext = lv_obj_get_ext_attr(scroller_page); page_ext->scroll_prop_obj = NULL; lv_obj_set_drag_parent(scroller_page, false); - lv_obj_set_drag_parent(lv_page_get_scrl(scroller_page), false); + lv_obj_set_drag_parent(lv_page_get_scrllable(scroller_page), false); /*Hide scrollbars if required*/ - if(scroller_page_ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG) { + if(scroller_page_ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) { lv_area_t sb_area_tmp; if(scroller_page_ext->scrlbar.hor_draw) { lv_area_copy(&sb_area_tmp, &scroller_page_ext->scrlbar.hor_area); @@ -990,10 +990,10 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi scroller_page = scroller_ext->scroll_prop_obj; scroller_ext->scroll_prop_obj = NULL; lv_obj_set_drag_parent(scroller_page, false); - lv_obj_set_drag_parent(lv_page_get_scrl(scroller_page), false); + lv_obj_set_drag_parent(lv_page_get_scrllable(scroller_page), false); /*Hide scrollbars if required*/ - if(scroller_page_ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG) { + if(scroller_page_ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) { scroller_page_ext->scrlbar.hor_draw = 0; scroller_page_ext->scrlbar.ver_draw = 0; lv_obj_invalidate(scroller_page); @@ -1003,7 +1003,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi } /*Hide scrollbars if required*/ - if(page_ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG) { + if(page_ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) { lv_area_t sb_area_tmp; if(page_ext->scrlbar.hor_draw) { lv_area_copy(&sb_area_tmp, &page_ext->scrlbar.hor_area); @@ -1112,7 +1112,7 @@ static void scrl_reposition(lv_obj_t * page) { /*Limit the position of the scrollable object to be always visible * (Do not let its edge inner then its parent respective edge)*/ - lv_obj_t * scrl = lv_page_get_scrl(page); + lv_obj_t * scrl = lv_page_get_scrllable(page); lv_coord_t new_x = lv_obj_get_x(scrl); lv_coord_t new_y = lv_obj_get_y(scrl); bool refr_x = false; @@ -1209,9 +1209,9 @@ static void scrlbar_refresh(lv_obj_t * page) lv_coord_t sb_hor_pad = LV_MATH_MAX(sb_width, sb_right); lv_coord_t sb_ver_pad = LV_MATH_MAX(sb_width, sb_bottom); - if(ext->scrlbar.mode == LV_SCRLBAR_MODE_OFF) return; + if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_OFF) return; - if(ext->scrlbar.mode == LV_SCRLBAR_MODE_ON) { + if(ext->scrlbar.mode == LV_SCRILLBAR_MODE_ON) { ext->scrlbar.hor_draw = 1; ext->scrlbar.ver_draw = 1; } @@ -1240,7 +1240,7 @@ static void scrlbar_refresh(lv_obj_t * page) lv_area_set_width(&ext->scrlbar.hor_area, obj_w - 2 * sb_hor_pad); lv_area_set_pos(&ext->scrlbar.hor_area, sb_hor_pad, obj_h - sb_width - sb_bottom); - if(ext->scrlbar.mode == LV_SCRLBAR_MODE_AUTO || ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG) ext->scrlbar.hor_draw = 0; + if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO || ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) ext->scrlbar.hor_draw = 0; } /*Smaller horizontal scrollbar*/ else { @@ -1255,7 +1255,7 @@ static void scrlbar_refresh(lv_obj_t * page) (scrl_w + bg_left + bg_right - obj_w), obj_h - sb_width - sb_bottom); - if(ext->scrlbar.mode == LV_SCRLBAR_MODE_AUTO || ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG) ext->scrlbar.hor_draw = 1; + if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO || ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) ext->scrlbar.hor_draw = 1; } /*Full sized vertical scroll bar*/ @@ -1263,7 +1263,7 @@ static void scrlbar_refresh(lv_obj_t * page) lv_area_set_height(&ext->scrlbar.ver_area, obj_h - 2 * sb_ver_pad); lv_area_set_pos(&ext->scrlbar.ver_area, obj_w - sb_width - sb_right, sb_ver_pad); - if(ext->scrlbar.mode == LV_SCRLBAR_MODE_AUTO || ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG) ext->scrlbar.ver_draw = 0; + if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO || ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) ext->scrlbar.ver_draw = 0; } /*Smaller vertical scroll bar*/ else { @@ -1278,7 +1278,7 @@ static void scrlbar_refresh(lv_obj_t * page) (obj_h - size_tmp - 2 * sb_ver_pad)) / (scrl_h + bg_top + bg_bottom - obj_h)); - if(ext->scrlbar.mode == LV_SCRLBAR_MODE_AUTO || ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG) ext->scrlbar.ver_draw = 1; + if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO || ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) ext->scrlbar.ver_draw = 1; } /*Invalidate the new scrollbar areas*/ diff --git a/src/lv_widgets/lv_page.h b/src/lv_widgets/lv_page.h index 367f3c6b0..df807ba09 100644 --- a/src/lv_widgets/lv_page.h +++ b/src/lv_widgets/lv_page.h @@ -36,14 +36,14 @@ extern "C" { /** Scrollbar modes: shows when should the scrollbars be visible*/ enum { - LV_SCRLBAR_MODE_OFF = 0x0, /**< Never show scroll bars*/ - LV_SCRLBAR_MODE_ON = 0x1, /**< Always show scroll bars*/ - LV_SCRLBAR_MODE_DRAG = 0x2, /**< Show scroll bars when page is being dragged*/ - LV_SCRLBAR_MODE_AUTO = 0x3, /**< Show scroll bars when the scrollable container is large enough to be scrolled*/ - LV_SCRLBAR_MODE_HIDE = 0x4, /**< Hide the scroll bar temporally*/ - LV_SCRLBAR_MODE_UNHIDE = 0x5, /**< Unhide the previously hidden scroll bar. Recover original mode too*/ + LV_SCROLLBAR_MODE_OFF = 0x0, /**< Never show scroll bars*/ + LV_SCRILLBAR_MODE_ON = 0x1, /**< Always show scroll bars*/ + LV_SCROLLBAR_MODE_DRAG = 0x2, /**< Show scroll bars when page is being dragged*/ + LV_SCROLLBAR_MODE_AUTO = 0x3, /**< Show scroll bars when the scrollable container is large enough to be scrolled*/ + LV_SCROLLBAR_MODE_HIDE = 0x4, /**< Hide the scroll bar temporally*/ + LV_SCROLLBAR_MODE_UNHIDE = 0x5, /**< Unhide the previously hidden scroll bar. Recover original mode too*/ }; -typedef uint8_t lv_scrlbar_mode_t; +typedef uint8_t lv_scrollbar_mode_t; /** Edges: describes the four edges of the page*/ enum { LV_PAGE_EDGE_LEFT = 0x1, LV_PAGE_EDGE_TOP = 0x2, LV_PAGE_EDGE_RIGHT = 0x4, LV_PAGE_EDGE_BOTTOM = 0x8 }; @@ -60,7 +60,7 @@ typedef struct { lv_area_t ver_area; /*Vertical scrollbar area relative to the page (Handled by the library)*/ uint8_t hor_draw : 1; /*1: horizontal scrollbar is visible now (Handled by the library)*/ uint8_t ver_draw : 1; /*1: vertical scrollbar is visible now (Handled by the library)*/ - lv_scrlbar_mode_t mode : 3; /*Scrollbar visibility from 'lv_page_sb_mode_t'*/ + lv_scrollbar_mode_t mode : 3; /*Scrollbar visibility from 'lv_scrollbar_mode_t'*/ } scrlbar; #if LV_USE_ANIMATION struct { @@ -117,7 +117,7 @@ void lv_page_clean(lv_obj_t * page); * @param page pointer to a page object * @return pointer to a container which is the scrollable part of the page */ -lv_obj_t * lv_page_get_scrl(const lv_obj_t * page); +lv_obj_t * lv_page_get_scrllable(const lv_obj_t * page); /** * Get the animation time @@ -135,7 +135,7 @@ uint16_t lv_page_get_anim_time(const lv_obj_t * page); * @param page pointer to a page object * @param sb_mode the new mode from 'lv_page_sb.mode_t' enum */ -void lv_page_set_scrlbar_mode(lv_obj_t * page, lv_scrlbar_mode_t sb_mode); +void lv_page_set_scrollbar_mode(lv_obj_t * page, lv_scrollbar_mode_t sb_mode); /** * Set the animation time for the page @@ -170,9 +170,9 @@ void lv_page_set_edge_flash(lv_obj_t * page, bool en); * @param top bottom fit policy from `lv_fit_t` * @param bottom bottom fit policy from `lv_fit_t` */ -static inline void lv_page_set_scrl_fit4(lv_obj_t * page, lv_fit_t left, lv_fit_t right, lv_fit_t top, lv_fit_t bottom) +static inline void lv_page_set_scrllable_fit4(lv_obj_t * page, lv_fit_t left, lv_fit_t right, lv_fit_t top, lv_fit_t bottom) { - lv_cont_set_fit4(lv_page_get_scrl(page), left, right, top, bottom); + lv_cont_set_fit4(lv_page_get_scrllable(page), left, right, top, bottom); } /** @@ -182,9 +182,9 @@ static inline void lv_page_set_scrl_fit4(lv_obj_t * page, lv_fit_t left, lv_fit_ * @param hot horizontal fit policy from `lv_fit_t` * @param ver vertical fit policy from `lv_fit_t` */ -static inline void lv_page_set_scrl_fit2(lv_obj_t * page, lv_fit_t hor, lv_fit_t ver) +static inline void lv_page_set_scrllable_fit2(lv_obj_t * page, lv_fit_t hor, lv_fit_t ver) { - lv_cont_set_fit2(lv_page_get_scrl(page), hor, ver); + lv_cont_set_fit2(lv_page_get_scrllable(page), hor, ver); } /** @@ -193,9 +193,9 @@ static inline void lv_page_set_scrl_fit2(lv_obj_t * page, lv_fit_t hor, lv_fit_t * @param page pointer to a button object * @param fit fit policy from `lv_fit_t` */ -static inline void lv_page_set_scrl_fit(lv_obj_t * page, lv_fit_t fit) +static inline void lv_page_set_scrllable_fit(lv_obj_t * page, lv_fit_t fit) { - lv_cont_set_fit(lv_page_get_scrl(page), fit); + lv_cont_set_fit(lv_page_get_scrllable(page), fit); } /** @@ -205,7 +205,7 @@ static inline void lv_page_set_scrl_fit(lv_obj_t * page, lv_fit_t fit) */ static inline void lv_page_set_scrl_width(lv_obj_t * page, lv_coord_t w) { - lv_obj_set_width(lv_page_get_scrl(page), w); + lv_obj_set_width(lv_page_get_scrllable(page), w); } /** @@ -215,7 +215,7 @@ static inline void lv_page_set_scrl_width(lv_obj_t * page, lv_coord_t w) */ static inline void lv_page_set_scrl_height(lv_obj_t * page, lv_coord_t h) { - lv_obj_set_height(lv_page_get_scrl(page), h); + lv_obj_set_height(lv_page_get_scrllable(page), h); } /** @@ -225,7 +225,7 @@ static inline void lv_page_set_scrl_height(lv_obj_t * page, lv_coord_t h) */ static inline void lv_page_set_scrl_layout(lv_obj_t * page, lv_layout_t layout) { - lv_cont_set_layout(lv_page_get_scrl(page), layout); + lv_cont_set_layout(lv_page_get_scrllable(page), layout); } /*===================== @@ -237,7 +237,7 @@ static inline void lv_page_set_scrl_layout(lv_obj_t * page, lv_layout_t layout) * @param page pointer to a page object * @return the mode from 'lv_page_sb.mode_t' enum */ -lv_scrlbar_mode_t lv_page_get_sb_mode(const lv_obj_t * page); +lv_scrollbar_mode_t lv_page_get_scrollbar_mode(const lv_obj_t * page); /** * Get the scroll propagation property @@ -300,7 +300,7 @@ lv_coord_t lv_page_get_height_grid(lv_obj_t * page, uint8_t div, uint8_t span); */ static inline lv_coord_t lv_page_get_scrl_width(const lv_obj_t * page) { - return lv_obj_get_width(lv_page_get_scrl(page)); + return lv_obj_get_width(lv_page_get_scrllable(page)); } /** @@ -310,7 +310,7 @@ static inline lv_coord_t lv_page_get_scrl_width(const lv_obj_t * page) */ static inline lv_coord_t lv_page_get_scrl_height(const lv_obj_t * page) { - return lv_obj_get_height(lv_page_get_scrl(page)); + return lv_obj_get_height(lv_page_get_scrllable(page)); } /** @@ -320,7 +320,7 @@ static inline lv_coord_t lv_page_get_scrl_height(const lv_obj_t * page) */ static inline lv_layout_t lv_page_get_scrl_layout(const lv_obj_t * page) { - return lv_cont_get_layout(lv_page_get_scrl(page)); + return lv_cont_get_layout(lv_page_get_scrllable(page)); } /** @@ -330,7 +330,7 @@ static inline lv_layout_t lv_page_get_scrl_layout(const lv_obj_t * page) */ static inline lv_fit_t lv_page_get_scrl_fit_left(const lv_obj_t * page) { - return lv_cont_get_fit_left(lv_page_get_scrl(page)); + return lv_cont_get_fit_left(lv_page_get_scrllable(page)); } /** @@ -340,7 +340,7 @@ static inline lv_fit_t lv_page_get_scrl_fit_left(const lv_obj_t * page) */ static inline lv_fit_t lv_page_get_scrl_fit_right(const lv_obj_t * page) { - return lv_cont_get_fit_right(lv_page_get_scrl(page)); + return lv_cont_get_fit_right(lv_page_get_scrllable(page)); } /** @@ -350,7 +350,7 @@ static inline lv_fit_t lv_page_get_scrl_fit_right(const lv_obj_t * page) */ static inline lv_fit_t lv_page_get_scrl_fit_top(const lv_obj_t * page) { - return lv_cont_get_fit_top(lv_page_get_scrl(page)); + return lv_cont_get_fit_top(lv_page_get_scrllable(page)); } /** @@ -360,7 +360,7 @@ static inline lv_fit_t lv_page_get_scrl_fit_top(const lv_obj_t * page) */ static inline lv_fit_t lv_page_get_scrl_fit_bottom(const lv_obj_t * page) { - return lv_cont_get_fit_bottom(lv_page_get_scrl(page)); + return lv_cont_get_fit_bottom(lv_page_get_scrllable(page)); } /*===================== diff --git a/src/lv_widgets/lv_roller.c b/src/lv_widgets/lv_roller.c index ff090f800..e2fe13d45 100644 --- a/src/lv_widgets/lv_roller.c +++ b/src/lv_widgets/lv_roller.c @@ -75,7 +75,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy) LV_ASSERT_MEM(roller); if(roller == NULL) return NULL; - if(ancestor_scrl_signal == NULL) ancestor_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrl(roller)); + if(ancestor_scrl_signal == NULL) ancestor_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrllable(roller)); if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(roller); /*Allocate the roller type specific extended data*/ @@ -103,9 +103,9 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy) lv_obj_t * label = lv_label_create(roller, NULL); lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); - lv_obj_t * scrl = lv_page_get_scrl(roller); + lv_obj_t * scrl = lv_page_get_scrllable(roller); lv_obj_set_drag(scrl, true); - lv_page_set_scrl_fit2(roller, LV_FIT_PARENT, LV_FIT_NONE); /*Height is specified directly*/ + lv_page_set_scrllable_fit2(roller, LV_FIT_PARENT, LV_FIT_NONE); /*Height is specified directly*/ lv_roller_set_anim_time(roller, LV_ROLLER_DEF_ANIM_TIME); lv_roller_set_options(roller, "Option 1\nOption 2\nOption 3\nOption 4\nOption 5", LV_ROLLER_MODE_NORMAL); @@ -122,7 +122,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy) lv_roller_ext_t * copy_ext = lv_obj_get_ext_attr(copy); lv_roller_set_options(roller, lv_roller_get_options(copy), copy_ext->mode); ext->auto_fit = copy_ext->auto_fit; - lv_obj_t * scrl = lv_page_get_scrl(roller); + lv_obj_t * scrl = lv_page_get_scrllable(roller); lv_obj_set_signal_cb(scrl, lv_roller_scrl_signal); } @@ -498,7 +498,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par if(lv_obj_get_width(roller) != lv_area_get_width(param) || lv_obj_get_height(roller) != lv_area_get_height(param)) { #if LV_USE_ANIMATION - lv_anim_del(lv_page_get_scrl(roller), (lv_anim_exec_xcb_t)lv_obj_set_y); + lv_anim_del(lv_page_get_scrllable(roller), (lv_anim_exec_xcb_t)lv_obj_set_y); #endif refr_position(roller, false); refr_width(roller); @@ -648,7 +648,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, } else if(sign == LV_SIGNAL_PARENT_SIZE_CHG) { #if LV_USE_ANIMATION - lv_anim_del(lv_page_get_scrl(roller), (lv_anim_exec_xcb_t)lv_obj_set_y); + lv_anim_del(lv_page_get_scrllable(roller), (lv_anim_exec_xcb_t)lv_obj_set_y); #endif refr_position(roller, false); refr_width(roller); @@ -729,7 +729,7 @@ static void refr_position(lv_obj_t * roller, lv_anim_enable_t anim_en) anim_en = LV_ANIM_OFF; #endif - lv_obj_t * roller_scrl = lv_page_get_scrl(roller); + lv_obj_t * roller_scrl = lv_page_get_scrllable(roller); lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller); const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG); lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG); @@ -869,10 +869,10 @@ static void refr_height(lv_obj_t * roller) lv_obj_t * label = get_label(roller); if(label == NULL) return; - lv_obj_set_height(lv_page_get_scrl(roller), lv_obj_get_height(label) + lv_obj_get_height(roller)); + lv_obj_set_height(lv_page_get_scrllable(roller), lv_obj_get_height(label) + lv_obj_get_height(roller)); #if LV_USE_ANIMATION - lv_anim_del(lv_page_get_scrl(roller), (lv_anim_exec_xcb_t)lv_obj_set_y); + lv_anim_del(lv_page_get_scrllable(roller), (lv_anim_exec_xcb_t)lv_obj_set_y); #endif refr_position(roller, LV_ANIM_OFF); } @@ -910,7 +910,7 @@ static void inf_normalize(void * scrl) static lv_obj_t * get_label(const lv_obj_t * roller) { - lv_obj_t * scrl = lv_page_get_scrl(roller); + lv_obj_t * scrl = lv_page_get_scrllable(roller); if(scrl == NULL) return NULL; /*The roller is being deleted, the scrollable already not exists*/ return lv_obj_get_child(scrl, NULL); } diff --git a/src/lv_widgets/lv_spinbox.c b/src/lv_widgets/lv_spinbox.c index a08151ebb..9a8cfb820 100644 --- a/src/lv_widgets/lv_spinbox.c +++ b/src/lv_widgets/lv_spinbox.c @@ -89,7 +89,7 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy) if(copy == NULL) { /* No scrolling will happen here so make the scrollable non-clickable * It allows to handle input events in the bg object only.*/ - lv_obj_set_click(lv_page_get_scrl(spinbox), false); + lv_obj_set_click(lv_page_get_scrllable(spinbox), false); lv_textarea_set_one_line(spinbox, true); lv_textarea_set_cursor_click_pos(spinbox, true); lv_obj_set_width(spinbox, LV_DPI); diff --git a/src/lv_widgets/lv_tabview.c b/src/lv_widgets/lv_tabview.c index 00a1afc6c..3904582e0 100644 --- a/src/lv_widgets/lv_tabview.c +++ b/src/lv_widgets/lv_tabview.c @@ -129,18 +129,18 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy) ext->btns = lv_btnmatrix_create(tabview, NULL); ext->indic = lv_obj_create(ext->btns, NULL); - if(ancestor_scrl_signal == NULL) ancestor_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrl(ext->content)); - lv_obj_set_signal_cb(lv_page_get_scrl(ext->content), tabview_scrl_signal); + if(ancestor_scrl_signal == NULL) ancestor_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrllable(ext->content)); + lv_obj_set_signal_cb(lv_page_get_scrllable(ext->content), tabview_scrl_signal); lv_btnmatrix_set_map(ext->btns, tab_def); lv_obj_set_event_cb(ext->btns, tab_btnm_event_cb); lv_obj_set_click(ext->indic, false); - lv_obj_set_drag_dir(lv_page_get_scrl(ext->content), LV_DRAG_DIR_ONE); + lv_obj_set_drag_dir(lv_page_get_scrllable(ext->content), LV_DRAG_DIR_ONE); - lv_page_set_scrl_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_PARENT); + lv_page_set_scrllable_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_PARENT); lv_page_set_scrl_layout(ext->content, LV_LAYOUT_ROW_TOP); - lv_page_set_scrlbar_mode(ext->content, LV_SCRLBAR_MODE_OFF); + lv_page_set_scrollbar_mode(ext->content, LV_SCROLLBAR_MODE_OFF); lv_obj_clean_style_list(ext->content, LV_PAGE_PART_BG); @@ -165,8 +165,8 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy) ext->tab_name_ptr[0] = ""; lv_btnmatrix_set_map(ext->btns, ext->tab_name_ptr); - lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_BG_SCRL), lv_obj_get_style_list(copy, - LV_TABVIEW_PART_BG_SCRL)); + lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_BG_SCRLLABLE), lv_obj_get_style_list(copy, + LV_TABVIEW_PART_BG_SCRLLABLE)); lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_TAB_BG), lv_obj_get_style_list(copy, LV_TABVIEW_PART_TAB_BG)); lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_TAB_BTN), lv_obj_get_style_list(copy, @@ -214,7 +214,7 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name) /*Create the container page*/ lv_obj_t * h = lv_page_create(ext->content, NULL); lv_obj_set_size(h, lv_obj_get_width(tabview), lv_obj_get_height(ext->content)); - lv_page_set_scrlbar_mode(h, LV_SCRLBAR_MODE_AUTO); + lv_page_set_scrollbar_mode(h, LV_SCROLLBAR_MODE_AUTO); lv_page_set_scroll_propagation(h, true); lv_theme_apply(h, LV_THEME_TABVIEW_PAGE); @@ -306,7 +306,7 @@ void lv_tabview_clean_tab(lv_obj_t * tab) { LV_ASSERT_OBJ(tab, "lv_page"); - lv_obj_t * scrl = lv_page_get_scrl(tab); + lv_obj_t * scrl = lv_page_get_scrllable(tab); lv_obj_clean(scrl); } @@ -357,15 +357,15 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an } if(anim == LV_ANIM_OFF || lv_tabview_get_anim_time(tabview) == 0) { - lv_obj_set_x(lv_page_get_scrl(ext->content), cont_x); + lv_obj_set_x(lv_page_get_scrllable(ext->content), cont_x); } #if LV_USE_ANIMATION else { lv_anim_t a; lv_anim_init(&a); - lv_anim_set_var(&a, lv_page_get_scrl(ext->content)); + lv_anim_set_var(&a, lv_page_get_scrllable(ext->content)); lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_x); - lv_anim_set_values(&a, lv_obj_get_x(lv_page_get_scrl(ext->content)), cont_x); + lv_anim_set_values(&a, lv_obj_get_x(lv_page_get_scrllable(ext->content)), cont_x); lv_anim_set_time(&a, ext->anim_time); lv_anim_start(&a); } @@ -529,7 +529,7 @@ lv_obj_t * lv_tabview_get_tab(const lv_obj_t * tabview, uint16_t id) LV_ASSERT_OBJ(tabview, LV_OBJX_NAME); lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview); - lv_obj_t * content_scrl = lv_page_get_scrl(ext->content); + lv_obj_t * content_scrl = lv_page_get_scrllable(ext->content); uint16_t i = 0; lv_obj_t * page = lv_obj_get_child_back(content_scrl, NULL); @@ -599,7 +599,7 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p if(info->part == LV_TABVIEW_PART_TAB_BG) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BG); else if(info->part == LV_TABVIEW_PART_TAB_BTN) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BTN); else if(info->part == LV_TABVIEW_PART_INDIC) info->result = lv_obj_get_state(ext->indic, LV_OBJ_PART_MAIN); - else if(info->part == LV_TABVIEW_PART_BG_SCRL) info->result = lv_obj_get_state(ext->content, LV_PAGE_PART_SCROLLABLE); + else if(info->part == LV_TABVIEW_PART_BG_SCRLLABLE) info->result = lv_obj_get_state(ext->content, LV_PAGE_PART_SCROLLABLE); return LV_RES_OK; } @@ -769,7 +769,7 @@ static lv_style_list_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part) case LV_TABVIEW_PART_BG: style_dsc_p = &tabview->style_list; break; - case LV_TABVIEW_PART_BG_SCRL: + case LV_TABVIEW_PART_BG_SCRLLABLE: style_dsc_p = lv_obj_get_style_list(ext->content, LV_PAGE_PART_SCROLLABLE); break; case LV_TABVIEW_PART_TAB_BG: @@ -963,10 +963,10 @@ static void refr_content_size(lv_obj_t * tabview) lv_obj_set_size(ext->content, cont_w, cont_h); /*Refresh the size of the tab pages too. `ext->content` has a layout to align the pages*/ - lv_style_int_t bg_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_BG_SCRL); - lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_BG_SCRL); + lv_style_int_t bg_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_BG_SCRLLABLE); + lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_BG_SCRLLABLE); cont_h -= bg_top + bg_bottom; - lv_obj_t * content_scrl = lv_page_get_scrl(ext->content); + lv_obj_t * content_scrl = lv_page_get_scrllable(ext->content); lv_obj_t * pages = lv_obj_get_child(content_scrl, NULL); while(pages != NULL) { /*Be sure adjust only the pages (user can other things)*/ diff --git a/src/lv_widgets/lv_tabview.h b/src/lv_widgets/lv_tabview.h index 55471eb05..50530ee85 100644 --- a/src/lv_widgets/lv_tabview.h +++ b/src/lv_widgets/lv_tabview.h @@ -69,7 +69,7 @@ enum { LV_TABVIEW_PART_BG = LV_OBJ_PART_MAIN, _LV_TABVIEW_PART_VIRTUAL_LAST = _LV_OBJ_PART_VIRTUAL_LAST, - LV_TABVIEW_PART_BG_SCRL = _LV_OBJ_PART_REAL_LAST, + LV_TABVIEW_PART_BG_SCRLLABLE = _LV_OBJ_PART_REAL_LAST, LV_TABVIEW_PART_TAB_BG, LV_TABVIEW_PART_TAB_BTN, LV_TABVIEW_PART_INDIC, diff --git a/src/lv_widgets/lv_textarea.c b/src/lv_widgets/lv_textarea.c index 002113d3c..805e03031 100644 --- a/src/lv_widgets/lv_textarea.c +++ b/src/lv_widgets/lv_textarea.c @@ -95,8 +95,8 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy) if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(ta); if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(ta); - if(scrl_signal == NULL) scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrl(ta)); - if(scrl_design == NULL) scrl_design = lv_obj_get_design_cb(lv_page_get_scrl(ta)); + if(scrl_signal == NULL) scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrllable(ta)); + if(scrl_design == NULL) scrl_design = lv_obj_get_design_cb(lv_page_get_scrllable(ta)); /*Allocate the object type specific extended data*/ lv_textarea_ext_t * ext = lv_obj_allocate_ext_attr(ta, sizeof(lv_textarea_ext_t)); @@ -133,12 +133,12 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy) #endif lv_obj_set_signal_cb(ta, lv_textarea_signal); - lv_obj_set_signal_cb(lv_page_get_scrl(ta), lv_textarea_scrollable_signal); + lv_obj_set_signal_cb(lv_page_get_scrllable(ta), lv_textarea_scrollable_signal); lv_obj_set_design_cb(ta, lv_textarea_design); /*Init the new text area object*/ if(copy == NULL) { - lv_page_set_scrl_fit2(ta, LV_FIT_PARENT, LV_FIT_TIGHT); + lv_page_set_scrllable_fit2(ta, LV_FIT_PARENT, LV_FIT_TIGHT); ext->label = lv_label_create(ta, NULL); @@ -148,7 +148,7 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy) lv_label_set_text(ext->label, "Text area"); lv_obj_set_click(ext->label, false); lv_obj_set_size(ta, LV_TEXTAREA_DEF_WIDTH, LV_TEXTAREA_DEF_HEIGHT); - lv_textarea_set_sb_mode(ta, LV_SCRLBAR_MODE_DRAG); + lv_textarea_set_sscrollbar_mode(ta, LV_SCROLLBAR_MODE_DRAG); lv_obj_reset_style_list(ta, LV_PAGE_PART_SCROLLABLE); lv_theme_apply(ta, LV_THEME_TEXTAREA); @@ -764,20 +764,20 @@ void lv_textarea_set_one_line(lv_obj_t * ta, bool en) lv_coord_t font_h = lv_font_get_line_height(font); ext->one_line = 1; - lv_page_set_scrl_fit2(ta, LV_FIT_MAX, LV_FIT_PARENT); + lv_page_set_scrllable_fit2(ta, LV_FIT_MAX, LV_FIT_PARENT); lv_obj_set_height(ta, font_h + top + bottom); lv_label_set_long_mode(ext->label, LV_LABEL_LONG_EXPAND); - lv_obj_set_pos(lv_page_get_scrl(ta), left, top); + lv_obj_set_pos(lv_page_get_scrllable(ta), left, top); } else { lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG); lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_BG); ext->one_line = 0; - lv_page_set_scrl_fit2(ta, LV_FIT_PARENT, LV_FIT_TIGHT); + lv_page_set_scrllable_fit2(ta, LV_FIT_PARENT, LV_FIT_TIGHT); lv_label_set_long_mode(ext->label, LV_LABEL_LONG_BREAK); lv_obj_set_height(ta, LV_TEXTAREA_DEF_HEIGHT); - lv_obj_set_pos(lv_page_get_scrl(ta), left, top); + lv_obj_set_pos(lv_page_get_scrllable(ta), left, top); } /* `refr_cursor_area` is called at the end of lv_ta_set_text_align */ @@ -804,7 +804,7 @@ void lv_textarea_set_text_align(lv_obj_t * ta, lv_label_align_t align) /*Normal left align. Just let the text expand*/ if(align == LV_LABEL_ALIGN_LEFT) { lv_label_set_long_mode(label, LV_LABEL_LONG_EXPAND); - lv_page_set_scrl_fit2(ta, LV_FIT_MAX, LV_FIT_PARENT); + lv_page_set_scrllable_fit2(ta, LV_FIT_MAX, LV_FIT_PARENT); lv_label_set_align(label, align); } /*Else use fix label width equal to the Text area width*/ @@ -812,7 +812,7 @@ void lv_textarea_set_text_align(lv_obj_t * ta, lv_label_align_t align) lv_label_set_long_mode(label, LV_LABEL_LONG_CROP); lv_obj_set_width(label, lv_page_get_width_fit(ta)); lv_label_set_align(label, align); - lv_page_set_scrl_fit2(ta, LV_FIT_PARENT, LV_FIT_PARENT); + lv_page_set_scrllable_fit2(ta, LV_FIT_PARENT, LV_FIT_PARENT); } } @@ -1566,7 +1566,7 @@ static lv_style_list_t * lv_textarea_get_style(lv_obj_t * ta, uint8_t part) case LV_TEXTAREA_PART_BG: style_dsc_p = &ta->style_list; break; - case LV_TEXTAREA_PART_SCRLBAR: + case LV_TEXTAREA_PART_SCROLLBAR: style_dsc_p = &ext->page.scrlbar.style; break; case LV_TEXTAREA_PART_CURSOR: @@ -1842,7 +1842,7 @@ static void update_cursor_position_on_click(lv_obj_t * ta, lv_signal_t sign, lv_ ext->sel_start = char_id_at_click; ext->sel_end = LV_LABEL_TEXT_SEL_OFF; ext->text_sel_in_prog = 1; - lv_obj_set_drag(lv_page_get_scrl(ta), false); + lv_obj_set_drag(lv_page_get_scrllable(ta), false); } else if(ext->text_sel_in_prog && sign == LV_SIGNAL_PRESSING) { /*Input device may be moving. Store the end position */ @@ -1850,7 +1850,7 @@ static void update_cursor_position_on_click(lv_obj_t * ta, lv_signal_t sign, lv_ } else if(ext->text_sel_in_prog && (sign == LV_SIGNAL_PRESS_LOST || sign == LV_SIGNAL_RELEASED)) { /*Input device is released. Check if anything was selected.*/ - lv_obj_set_drag(lv_page_get_scrl(ta), true); + lv_obj_set_drag(lv_page_get_scrllable(ta), true); } } diff --git a/src/lv_widgets/lv_textarea.h b/src/lv_widgets/lv_textarea.h index 47ff097df..36fcbf89c 100644 --- a/src/lv_widgets/lv_textarea.h +++ b/src/lv_widgets/lv_textarea.h @@ -78,7 +78,7 @@ typedef struct { /** Possible text areas tyles. */ enum { LV_TEXTAREA_PART_BG = LV_PAGE_PART_BG, /**< Text area background style */ - LV_TEXTAREA_PART_SCRLBAR = LV_PAGE_PART_SCROLLBAR, /**< Scrollbar style */ + LV_TEXTAREA_PART_SCROLLBAR = LV_PAGE_PART_SCROLLBAR, /**< Scrollbar style */ LV_TEXTAREA_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, /**< Edge flash style */ LV_TEXTAREA_PART_CURSOR = _LV_PAGE_PART_VIRTUAL_LAST, /**< Cursor style */ LV_TEXTAREA_PART_PLACEHOLDER, /**< Placeholder style */ @@ -222,11 +222,11 @@ void lv_textarea_set_insert_replace(lv_obj_t * ta, const char * txt); /** * Set the scroll bar mode of a text area * @param ta pointer to a text area object - * @param sb_mode the new mode from 'lv_page_sb_mode_t' enum + * @param sb_mode the new mode from 'lv_scrollbar_mode_t' enum */ -static inline void lv_textarea_set_sb_mode(lv_obj_t * ta, lv_scrlbar_mode_t mode) +static inline void lv_textarea_set_sscrollbar_mode(lv_obj_t * ta, lv_scrollbar_mode_t mode) { - lv_page_set_scrlbar_mode(ta, mode); + lv_page_set_scrollbar_mode(ta, mode); } /** @@ -348,11 +348,11 @@ uint16_t lv_textarea_get_max_length(lv_obj_t * ta); /** * Get the scroll bar mode of a text area * @param ta pointer to a text area object - * @return scrollbar mode from 'lv_page_sb_mode_t' enum + * @return scrollbar mode from 'lv_scrollbar_mode_t' enum */ -static inline lv_scrlbar_mode_t lv_textarea_get_sb_mode(const lv_obj_t * ta) +static inline lv_scrollbar_mode_t lv_textarea_get_scrollbar_mode(const lv_obj_t * ta) { - return lv_page_get_sb_mode(ta); + return lv_page_get_scrollbar_mode(ta); } /** diff --git a/src/lv_widgets/lv_tileview.c b/src/lv_widgets/lv_tileview.c index d6f2eae1d..ccc220074 100644 --- a/src/lv_widgets/lv_tileview.c +++ b/src/lv_widgets/lv_tileview.c @@ -80,7 +80,7 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy) } if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_tileview); - if(ancestor_scrl_signal == NULL) ancestor_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrl(new_tileview)); + if(ancestor_scrl_signal == NULL) ancestor_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrllable(new_tileview)); if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_tileview); /*Initialize the allocated 'ext' */ @@ -94,7 +94,7 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy) /*The signal and design functions are not copied so set them here*/ lv_obj_set_signal_cb(new_tileview, lv_tileview_signal); - lv_obj_set_signal_cb(lv_page_get_scrl(new_tileview), lv_tileview_scrl_signal); + lv_obj_set_signal_cb(lv_page_get_scrllable(new_tileview), lv_tileview_scrl_signal); /*Init the new tileview*/ if(copy == NULL) { @@ -113,10 +113,10 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy) } lv_obj_set_size(new_tileview, w, h); - lv_obj_set_drag_throw(lv_page_get_scrl(new_tileview), true); - lv_obj_set_drag_dir(lv_page_get_scrl(new_tileview), LV_DRAG_DIR_ONE); + lv_obj_set_drag_throw(lv_page_get_scrllable(new_tileview), true); + lv_obj_set_drag_dir(lv_page_get_scrllable(new_tileview), LV_DRAG_DIR_ONE); - lv_page_set_scrl_fit(new_tileview, LV_FIT_TIGHT); + lv_page_set_scrllable_fit(new_tileview, LV_FIT_TIGHT); lv_obj_reset_style_list(new_tileview, LV_PAGE_PART_SCROLLABLE); lv_theme_apply(new_tileview, LV_THEME_TILEVIEW); @@ -227,7 +227,7 @@ void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, l lv_coord_t x_coord = -x * lv_obj_get_width(tileview); lv_coord_t y_coord = -y * lv_obj_get_height(tileview); - lv_obj_t * scrl = lv_page_get_scrl(tileview); + lv_obj_t * scrl = lv_page_get_scrllable(tileview); if(anim) { #if LV_USE_ANIMATION lv_coord_t x_act = lv_obj_get_x(scrl); @@ -399,7 +399,7 @@ static void drag_end_handler(lv_obj_t * tileview) lv_indev_t * indev = lv_indev_get_act(); lv_point_t point_act; lv_indev_get_point(indev, &point_act); - lv_obj_t * scrl = lv_page_get_scrl(tileview); + lv_obj_t * scrl = lv_page_get_scrllable(tileview); lv_point_t p; p.x = -(scrl->coords.x1 - lv_obj_get_width(tileview) / 2); diff --git a/src/lv_widgets/lv_tileview.h b/src/lv_widgets/lv_tileview.h index 78d2370bc..d0b0317dd 100644 --- a/src/lv_widgets/lv_tileview.h +++ b/src/lv_widgets/lv_tileview.h @@ -46,7 +46,7 @@ typedef struct { /*Parts of the Tileview*/ enum { LV_TILEVIEW_PART_BG = LV_PAGE_PART_BG, - LV_TILEVIEW_PART_SCRLBAR = LV_PAGE_PART_SCROLLBAR, + LV_TILEVIEW_PART_SCROLLBAR = LV_PAGE_PART_SCROLLBAR, LV_TILEVIEW_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, _LV_TILEVIEW_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST, _LV_TILEVIEW_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST diff --git a/src/lv_widgets/lv_win.c b/src/lv_widgets/lv_win.c index d024749ac..a52cf9345 100644 --- a/src/lv_widgets/lv_win.c +++ b/src/lv_widgets/lv_win.c @@ -97,7 +97,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy) ext->page = lv_page_create(new_win, NULL); lv_obj_add_protect(ext->page, LV_PROTECT_PARENT); - lv_page_set_scrlbar_mode(ext->page, LV_SCRLBAR_MODE_AUTO); + lv_page_set_scrollbar_mode(ext->page, LV_SCROLLBAR_MODE_AUTO); lv_obj_clean_style_list(ext->page, LV_PAGE_PART_BG); /*Create a holder for the header*/ @@ -154,7 +154,7 @@ void lv_win_clean(lv_obj_t * win) { LV_ASSERT_OBJ(win, LV_OBJX_NAME); - lv_obj_t * scrl = lv_page_get_scrl(win); + lv_obj_t * scrl = lv_page_get_scrllable(win); lv_obj_clean(scrl); } @@ -293,12 +293,12 @@ void lv_win_set_layout(lv_obj_t * win, lv_layout_t layout) * @param win pointer to a window object * @param sb_mode the new scroll bar mode from 'lv_sb_mode_t' */ -void lv_win_set_scrlbar_mode(lv_obj_t * win, lv_scrlbar_mode_t sb_mode) +void lv_win_set_scrollbar_mode(lv_obj_t * win, lv_scrollbar_mode_t sb_mode) { LV_ASSERT_OBJ(win, LV_OBJX_NAME); lv_win_ext_t * ext = lv_obj_get_ext_attr(win); - lv_page_set_scrlbar_mode(ext->page, sb_mode); + lv_page_set_scrollbar_mode(ext->page, sb_mode); } /** * Set focus animation duration on `lv_win_focus()` @@ -418,12 +418,12 @@ lv_layout_t lv_win_get_layout(lv_obj_t * win) * @param win pointer to a window object * @return the scroll bar mode of the window (from 'lv_sb_mode_t') */ -lv_scrlbar_mode_t lv_win_get_sb_mode(lv_obj_t * win) +lv_scrollbar_mode_t lv_win_get_sb_mode(lv_obj_t * win) { LV_ASSERT_OBJ(win, LV_OBJX_NAME); lv_win_ext_t * ext = lv_obj_get_ext_attr(win); - return lv_page_get_sb_mode(ext->page); + return lv_page_get_scrollbar_mode(ext->page); } /** @@ -448,7 +448,7 @@ lv_coord_t lv_win_get_width(lv_obj_t * win) LV_ASSERT_OBJ(win, LV_OBJX_NAME); lv_win_ext_t * ext = lv_obj_get_ext_attr(win); - lv_obj_t * scrl = lv_page_get_scrl(ext->page); + lv_obj_t * scrl = lv_page_get_scrllable(ext->page); lv_coord_t left = lv_obj_get_style_pad_left(win, LV_WIN_PART_BG); lv_coord_t right = lv_obj_get_style_pad_left(win, LV_WIN_PART_BG); @@ -547,7 +547,7 @@ static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param) else if(sign == LV_SIGNAL_GET_STATE_DSC) { lv_win_ext_t * ext = lv_obj_get_ext_attr(win); lv_get_state_info_t * info = param; - if(info->part == LV_WIN_PART_CONTENT_SCROLLABLE) info->result = lv_obj_get_state(lv_page_get_scrl(ext->page), + if(info->part == LV_WIN_PART_CONTENT_SCROLLABLE) info->result = lv_obj_get_state(lv_page_get_scrllable(ext->page), LV_CONT_PART_MAIN); else if(info->part == LV_WIN_PART_SCROLLBAR) info->result = lv_obj_get_state(ext->page, LV_PAGE_PART_SCROLLBAR); else if(info->part == LV_WIN_PART_HEADER) info->result = lv_obj_get_state(ext->header, LV_OBJ_PART_MAIN); diff --git a/src/lv_widgets/lv_win.h b/src/lv_widgets/lv_win.h index af4ae16e1..6c868ee50 100644 --- a/src/lv_widgets/lv_win.h +++ b/src/lv_widgets/lv_win.h @@ -149,9 +149,9 @@ void lv_win_set_layout(lv_obj_t * win, lv_layout_t layout); /** * Set the scroll bar mode of a window * @param win pointer to a window object - * @param sb_mode the new scroll bar mode from 'lv_sb_mode_t' + * @param sb_mode the new scroll bar mode from 'lv_scrollbar_mode_t' */ -void lv_win_set_scrlbar_mode(lv_obj_t * win, lv_scrlbar_mode_t sb_mode); +void lv_win_set_scrollbar_mode(lv_obj_t * win, lv_scrollbar_mode_t sb_mode); /** * Set focus animation duration on `lv_win_focus()` @@ -220,7 +220,7 @@ lv_layout_t lv_win_get_layout(lv_obj_t * win); * @param win pointer to a window object * @return the scroll bar mode of the window (from 'lv_sb_mode_t') */ -lv_scrlbar_mode_t lv_win_get_sb_mode(lv_obj_t * win); +lv_scrollbar_mode_t lv_win_get_sb_mode(lv_obj_t * win); /** * Get focus animation duration diff --git a/tests/build.py b/tests/build.py index d32ddde0a..804d56396 100755 --- a/tests/build.py +++ b/tests/build.py @@ -62,6 +62,8 @@ minimal_monochrome = { "LV_ANTIALIAS":0, "LV_GPU":0, "LV_USE_FILESYSTEM":0, + "LV_USE_IMG_TRANSFORM":0, + "LV_USE_API_EXTENSION_V6":0, "LV_USE_USER_DATA":0, "LV_USE_USER_DATA_FREE":0, "LV_USE_LOG":0, @@ -139,6 +141,8 @@ all_obj_minimal_features = { "LV_ANTIALIAS":0, "LV_GPU":0, "LV_USE_FILESYSTEM":0, + "LV_USE_IMG_TRANSFORM":0, + "LV_USE_API_EXTENSION_V6":0, "LV_USE_USER_DATA":0, "LV_USE_USER_DATA_FREE":0, "LV_USE_LOG":0, @@ -214,6 +218,8 @@ all_obj_all_features = { "LV_ANTIALIAS":1, "LV_GPU":1, "LV_USE_FILESYSTEM":1, + "LV_USE_IMG_TRANSFORM":1, + "LV_USE_API_EXTENSION_V6":1, "LV_USE_USER_DATA":1, "LV_USE_USER_DATA_FREE":0, "LV_USE_LOG":1, @@ -293,6 +299,8 @@ advanced_features = { "LV_ANTIALIAS":1, "LV_GPU":1, "LV_USE_FILESYSTEM":1, + "LV_USE_IMG_TRANSFORM":1, + "LV_USE_API_EXTENSION_V6":1, "LV_USE_USER_DATA":1, "LV_USE_USER_DATA_FREE":1, "LV_USER_DATA_FREE_INCLUDE":"\\\"\\\"",