diff --git a/lv_app/lv_app.c b/lv_app/lv_app.c index 87f6e8e1b..b3b4f958f 100644 --- a/lv_app/lv_app.c +++ b/lv_app/lv_app.c @@ -290,7 +290,7 @@ lv_obj_t * lv_app_win_open(lv_app_inst_t * app) lv_obj_set_free_p(app->win, app); lv_obj_set_style(lv_win_get_header(app->win), &app_style.win_header); lv_win_set_title(app->win, app->dsc->name); - lv_page_set_sb_mode(lv_win_get_page(app->win), LV_PAGE_SB_MODE_ON); + lv_page_set_sb_mode(lv_win_get_page(app->win), LV_PAGE_SB_MODE_AUTO); lv_win_set_styles_cbtn(app->win, &app_style.win_cbtn_rel, &app_style.win_cbtn_pr); if(app->dsc->conf_open != NULL) { @@ -809,6 +809,7 @@ static lv_action_res_t lv_app_win_conf_action(lv_obj_t * set_btn, lv_dispi_t * d char buf[256]; sprintf(buf, "%s settings", app->dsc->name); lv_win_add_cbtn(app->conf_win, SYMBOL_CLOSE ,lv_win_close_action); + lv_obj_set_style(lv_win_get_header(app->conf_win), &app_style.win_header); lv_win_set_title(app->conf_win, buf); lv_win_set_styles_cbtn(app->conf_win, &app_style.win_cbtn_rel, &app_style.win_cbtn_pr); lv_obj_t * scrl = lv_page_get_scrl(lv_win_get_page(app->conf_win)); @@ -934,12 +935,12 @@ static lv_action_res_t lv_app_win_minim_anim_create(lv_app_inst_t * app) a.start = LV_HOR_RES; - a.end = lv_obj_get_width(app->sc); + a.end = lv_obj_get_width(&cords); a.fp = (anim_fp_t) lv_obj_set_width; anim_create(&a); a.start = LV_VER_RES; - a.end = lv_obj_get_height(app->sc); + a.end = lv_obj_get_height(&cords); a.fp = (anim_fp_t) lv_obj_set_height; anim_create(&a); @@ -1097,14 +1098,17 @@ static void lv_app_init_style(void) /*Window*/ lv_style_get(LV_STYLE_PLAIN_COLOR, &app_style.win_header); - app_style.win_header.font = font_get(LV_APP_FONT_LARGE); + memcpy(&app_style.win_header, &app_style.menu, sizeof(lv_style_t)); + app_style.win_header.font = font_get(LV_APP_FONT_LARGE); lv_style_get(LV_STYLE_TRANSP, &app_style.win_scrl); lv_style_get(LV_STYLE_BTN_REL, &app_style.win_cbtn_rel); + memcpy(&app_style.win_cbtn_rel, &app_style.menu_btn_rel, sizeof(lv_style_t)); app_style.win_cbtn_rel.font = font_get(LV_IMG_DEF_SYMBOL_FONT); lv_style_get(LV_STYLE_BTN_PR, &app_style.win_cbtn_pr); + memcpy(&app_style.win_cbtn_pr, &app_style.menu_btn_pr, sizeof(lv_style_t)); app_style.win_cbtn_pr.font = font_get(LV_IMG_DEF_SYMBOL_FONT); } diff --git a/lv_app/lv_app_util/lv_app_kb.c b/lv_app/lv_app_util/lv_app_kb.c index c666ce42d..9530d3ec5 100644 --- a/lv_app/lv_app_util/lv_app_kb.c +++ b/lv_app/lv_app_util/lv_app_kb.c @@ -79,14 +79,19 @@ static lv_style_t style_btn_pr; */ void lv_app_kb_init(void) { - lv_style_get(LV_STYLE_PLAIN, &style_bg); + lv_app_style_t * app_style = lv_app_style_get(); + + memcpy(&style_bg, &app_style->menu, sizeof(lv_style_t)); + style_bg.opa = OPA_COVER; style_bg.hpad = 0; style_bg.vpad = 0; style_bg.opad = 0; - lv_style_get(LV_STYLE_BTN_REL, &style_btn_rel); + + memcpy(&style_btn_rel, &app_style->menu_btn_rel, sizeof(lv_style_t)); style_btn_rel.radius = 0; style_btn_rel.bwidth = 1 * LV_DOWNSCALE; - lv_style_get(LV_STYLE_BTN_PR, &style_btn_pr); + + memcpy(&style_btn_pr, &app_style->menu_btn_pr, sizeof(lv_style_t)); style_btn_pr.radius = 0; style_btn_pr.bwidth = 1 * LV_DOWNSCALE; } diff --git a/lv_appx/lv_app_sysmon.c b/lv_appx/lv_app_sysmon.c index 1090bf552..936933576 100644 --- a/lv_appx/lv_app_sysmon.c +++ b/lv_appx/lv_app_sysmon.c @@ -20,7 +20,7 @@ * DEFINES *********************/ #define CPU_LABEL_COLOR "FF0000" -#define MEM_LABEL_COLOR "008000" +#define MEM_LABEL_COLOR "0000FF" /********************** * TYPEDEFS @@ -291,8 +291,10 @@ static void sysmon_task(void * param) /*Get CPU and memory information */ uint8_t cpu_busy = 0; -#if USE_IDLE != 0 +#if USE_IDLE != 0 /*Use the more precise idle module if enabled*/ cpu_busy = 100 - idle_get(); +#else + cpu_busy = 100 - ptask_get_idle(); #endif uint8_t mem_used_pct = 0; @@ -350,13 +352,8 @@ static void lv_app_sysmon_refr(void) char buf_long[256]; char buf_short[128]; -#if USE_IDLE != 0 sprintf(buf_long, "%c%s CPU: %d %%%c\n\n",TXT_RECOLOR_CMD, CPU_LABEL_COLOR, cpu_pct[LV_APP_SYSMON_PNUM - 1], TXT_RECOLOR_CMD); sprintf(buf_short, "CPU: %d %%\n", cpu_pct[LV_APP_SYSMON_PNUM - 1]); -#else - sprintf(buf_long, "%c%s CPU: N/A%c\n\n",TXT_RECOLOR_CMD, CPU_LABEL_COLOR, TXT_RECOLOR_CMD); - strcpy(buf_short, "CPU: N/A\n"); -#endif #if USE_DYN_MEM != 0 && DM_CUSTOM == 0 sprintf(buf_long, "%s%c%s MEMORY: %d %%%c\nTotal: %d bytes\nUsed: %d bytes\nFree: %d bytes\nFrag: %d %%", diff --git a/lv_appx/lv_app_terminal.c b/lv_appx/lv_app_terminal.c index 02071a84c..ba5b4b5cc 100644 --- a/lv_appx/lv_app_terminal.c +++ b/lv_appx/lv_app_terminal.c @@ -254,6 +254,8 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win) my_win_data_t * win_data = app->win_data; my_app_data_t * app_data = app->app_data; + lv_cont_set_layout(lv_page_get_scrl(lv_win_get_page(win)), LV_CONT_LAYOUT_PRETTY); + /*Create a label for the text of the terminal*/ win_data->label = lv_label_create(win, NULL); lv_label_set_long_mode(win_data->label, LV_LABEL_LONG_BREAK); @@ -262,21 +264,20 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win) /*Create a text area. Text can be added to the terminal from here by app. keyboard.*/ win_data->ta = lv_ta_create(win, NULL); - lv_obj_set_size(win_data->ta, LV_HOR_RES / 2, LV_VER_RES / 4); + lv_obj_set_size(win_data->ta, lv_win_get_width(win), LV_VER_RES / 4); lv_obj_set_free_p(win_data->ta, app); lv_page_set_rel_action(win_data->ta, win_ta_rel_action); + lv_page_glue_obj(win_data->ta, true); lv_ta_set_text(win_data->ta, ""); - if(app_data->txt[0] != '\0') lv_obj_align(win_data->ta, win_data->label, LV_ALIGN_OUT_BOTTOM_LEFT, OBJ_PAD, OBJ_PAD); - else lv_obj_align(win_data->ta, NULL, LV_ALIGN_IN_TOP_LEFT, OBJ_PAD, OBJ_PAD); /*Create a clear button*/ win_data->clear_btn = lv_btn_create(win, NULL); lv_cont_set_fit(win_data->clear_btn, true, true); lv_obj_set_free_p(win_data->clear_btn, app); + lv_page_glue_obj(win_data->ta, true); lv_btn_set_rel_action(win_data->clear_btn, win_clear_rel_action); lv_obj_t * btn_label = lv_label_create(win_data->clear_btn, NULL); lv_label_set_text(btn_label, "Clear"); - lv_obj_align(win_data->clear_btn, win_data->ta, LV_ALIGN_OUT_RIGHT_TOP, OBJ_PAD, 0); /*Align the window to see the text area on the bottom*/ lv_obj_t * page = lv_win_get_page(app->win); @@ -398,8 +399,6 @@ static lv_action_res_t win_clear_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) if(win_data != NULL) { lv_label_set_text_static(win_data->label, app_data->txt); - lv_obj_align(win_data->ta, NULL, LV_ALIGN_IN_TOP_LEFT, OBJ_PAD, OBJ_PAD); - lv_obj_align(win_data->clear_btn, win_data->ta, LV_ALIGN_OUT_RIGHT_TOP, OBJ_PAD, 0); lv_obj_t * page = lv_win_get_page(app->win); lv_obj_align(lv_page_get_scrl(page), NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, - LV_VER_RES); } @@ -482,8 +481,6 @@ static void add_data(lv_app_inst_t * app, const void * data, uint16_t data_len) if(win_data != NULL) { lv_label_set_text_static(win_data->label, app_data->txt); - lv_obj_align(win_data->ta, win_data->label, LV_ALIGN_OUT_BOTTOM_LEFT, OBJ_PAD, OBJ_PAD); - lv_obj_align(win_data->clear_btn, win_data->ta, LV_ALIGN_OUT_RIGHT_TOP, OBJ_PAD, 0); lv_obj_t * page = lv_win_get_page(app->win); lv_obj_align(lv_page_get_scrl(page), NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, - LV_VER_RES); } diff --git a/lv_obj/lv_obj.c b/lv_obj/lv_obj.c index 0b171afe5..7da18e76e 100644 --- a/lv_obj/lv_obj.c +++ b/lv_obj/lv_obj.c @@ -73,9 +73,6 @@ void lv_init(void) /*Init. the screen refresh system*/ lv_refr_init(); - - /*Init. the animations*/ - anim_init(); /*Create the default screen*/ ll_init(&scr_ll, sizeof(lv_obj_t)); @@ -151,7 +148,6 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) new_obj->drag_en = 0; new_obj->drag_throw_en = 0; new_obj->drag_parent = 0; - new_obj->style_iso = 0; new_obj->hidden = 0; new_obj->top_en = 0; new_obj->protect = LV_PROTECT_NONE; @@ -193,7 +189,6 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) new_obj->drag_en = 0; new_obj->drag_throw_en = 0; new_obj->drag_parent = 0; - new_obj->style_iso = 0; new_obj->hidden = 0; new_obj->top_en = 0; new_obj->protect = LV_PROTECT_NONE; @@ -222,10 +217,6 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) new_obj->style_p = copy->style_p; - if(copy->style_iso != 0) { - lv_obj_iso_style(new_obj, dm_get_size(copy->style_p)); - } - lv_obj_set_pos(new_obj, lv_obj_get_x(copy), lv_obj_get_y(copy)); } @@ -243,7 +234,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) /** * Delete 'obj' and all of its children - * @param obj + * @param obj pointer to an object to delete */ void lv_obj_del(lv_obj_t * obj) { @@ -281,7 +272,6 @@ void lv_obj_del(lv_obj_t * obj) /*Delete the base objects*/ if(obj->ext != NULL) dm_free(obj->ext); - if(obj->style_iso != 0) dm_free(obj->style_p); dm_free(obj); /*Free the object itself*/ /* Reset all display input (dispi) because @@ -461,7 +451,7 @@ void lv_obj_set_pos(lv_obj_t * obj, cord_t x, cord_t y) /** * Set relative the position of an object (relative to the parent). - * The coordinates will be upscaled to compensate LV_DOWNSCALE. + * The coordinates will be upscaled with LV_DOWNSCALE. * @param obj pointer to an object * @param x new distance from the left side of the parent. (will be multiplied with LV_DOWNSCALE) * @param y new distance from the top of the parent. (will be multiplied with LV_DOWNSCALE) @@ -483,7 +473,7 @@ void lv_obj_set_x(lv_obj_t * obj, cord_t x) /** * Set the x coordinate of a object. - * The coordinate will be upscaled to compensate LV_DOWNSCALE. + * The coordinate will be upscaled with LV_DOWNSCALE. * @param obj pointer to an object * @param x new distance from the left side from the parent. (will be multiplied with LV_DOWNSCALE) */ @@ -504,7 +494,7 @@ void lv_obj_set_y(lv_obj_t * obj, cord_t y) /** * Set the y coordinate of a object. - * The coordinate will be upscaled to compensate LV_DOWNSCALE. + * The coordinate will be upscaled with LV_DOWNSCALE. * @param obj pointer to an object * @param y new distance from the top of the parent. (will be multiplied with LV_DOWNSCALE) */ @@ -553,7 +543,7 @@ void lv_obj_set_size(lv_obj_t * obj, cord_t w, cord_t h) } /** - * Set the size of an object. The coordinates will be upscaled to compensate LV_DOWNSCALE. + * Set the size of an object. The coordinates will be upscaled with LV_DOWNSCALE. * @param obj pointer to an object * @param w new width (will be multiplied with LV_DOWNSCALE) * @param h new height (will be multiplied with LV_DOWNSCALE) @@ -574,7 +564,7 @@ void lv_obj_set_width(lv_obj_t * obj, cord_t w) } /** - * Set the width of an object. The width will be upscaled to compensate LV_DOWNSCALE + * Set the width of an object. The width will be upscaled with LV_DOWNSCALE * @param obj pointer to an object * @param w new width (will be multiplied with LV_DOWNSCALE) */ @@ -594,7 +584,7 @@ void lv_obj_set_height(lv_obj_t * obj, cord_t h) } /** - * Set the height of an object. The height will be upscaled to compensate LV_DOWNSCALE + * Set the height of an object. The height will be upscaled with LV_DOWNSCALE * @param obj pointer to an object * @param h new height (will be multiplied with LV_DOWNSCALE) */ @@ -742,7 +732,7 @@ void lv_obj_align(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, cord_t x_mod /** - * Align an object to an other object. The coordinates will be upscaled to compensate LV_DOWNSCALE. + * Align an object to an other object. The coordinates will be upscaled with LV_DOWNSCALE. * @param obj pointer to an object to align * @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it. * @param align type of alignment (see 'lv_align_t' enum) @@ -777,10 +767,6 @@ void lv_obj_set_ext_size(lv_obj_t * obj, cord_t ext_size) */ void lv_obj_set_style(lv_obj_t * obj, lv_style_t * style) { - if(obj->style_iso != 0) { - dm_free(obj->style_p); - obj->style_iso = 0; - } obj->style_p = style; /*Send a signal about style change to every children with NULL style*/ @@ -788,28 +774,6 @@ void lv_obj_set_style(lv_obj_t * obj, lv_style_t * style) } -/** - * Isolate the style of an object. In other words a unique style will be created - * for this object which can be freely modified independently from the style of the - * other objects. - */ -void * lv_obj_iso_style(lv_obj_t * obj, uint32_t style_size) -{ - if(obj->style_iso != 0) return obj->style_p; - - void * ori_style_p = lv_obj_get_style(obj); - void * iso_style = dm_alloc(style_size); - dm_assert(iso_style); - memcpy(iso_style, ori_style_p, style_size); - - obj->style_iso = 1; - obj->style_p = iso_style; - - lv_obj_refr_style(obj); - - return obj->style_p; -} - /** * Notify an object about its style is modified * @param obj pointer to an object @@ -827,7 +791,7 @@ void lv_obj_refr_style(lv_obj_t * obj) * @param style pointer to a style. Only the objects with this style will be notified * (NULL to notify all objects) */ -void lv_style_refr_all(void * style) +void lv_style_refr_objs(void * style) { lv_obj_t * i; LL_READ(scr_ll, i) { @@ -1330,16 +1294,6 @@ bool lv_obj_get_drag_parent(lv_obj_t * obj) return obj->drag_parent == 0 ? false : true; } -/** - * Get the style isolation attribute of an object - * @param obj pointer to an object - * @return pointer to a style - */ -bool lv_obj_get_style_iso(lv_obj_t * obj) -{ - return obj->style_iso == 0 ? false : true; -} - /** * Get the protect field of an object * @param obj pointer to an object @@ -1559,7 +1513,6 @@ static void lv_obj_del_child(lv_obj_t * obj) /*Delete the base objects*/ if(obj->ext != NULL) dm_free(obj->ext); - if(obj->style_iso != 0) dm_free(obj->style_p); dm_free(obj); /*Free the object itself*/ } diff --git a/lv_obj/lv_obj.h b/lv_obj/lv_obj.h index f4ddee676..df95fda42 100644 --- a/lv_obj/lv_obj.h +++ b/lv_obj/lv_obj.h @@ -79,34 +79,33 @@ typedef bool (* lv_signal_f_t) (struct __LV_OBJ_T * obj, lv_signal_t sign, void typedef struct __LV_OBJ_T { - struct __LV_OBJ_T * par; - ll_dsc_t child_ll; + struct __LV_OBJ_T * par; /*Pointer to the parent object*/ + ll_dsc_t child_ll; /*Linked list to store the children objects*/ - area_t cords; + area_t cords; /*Coordinates of the object (x1, y1, x2, y2)*/ - lv_signal_f_t signal_f; - lv_design_f_t design_f; + lv_signal_f_t signal_f; /*Object type specific signal function*/ + lv_design_f_t design_f; /*Object type specific design function*/ - void * ext; /*The object attributes can be extended here*/ - lv_style_t * style_p; /*Object specific style*/ + void * ext; /*Object type specific extended data*/ + lv_style_t * style_p; /*Pointer to the object's style*/ #if LV_OBJ_FREE_P != 0 - void * free_p; /*Application specific pointer (set it freely)*/ + void * free_p; /*Application specific pointer (set it freely)*/ #endif /*Attributes and states*/ - uint8_t click_en :1; /*1: can be pressed by a display input device*/ - uint8_t drag_en :1; /*1: enable the dragging*/ + uint8_t click_en :1; /*1: Can be pressed by a display input device*/ + uint8_t drag_en :1; /*1: Enable the dragging*/ uint8_t drag_throw_en:1; /*1: Enable throwing with drag*/ - uint8_t drag_parent :1; /*1. Parent will be dragged instead*/ - uint8_t style_iso :1; /*1: The object has got an own style*/ + uint8_t drag_parent :1; /*1: Parent will be dragged instead*/ uint8_t hidden :1; /*1: Object is hidden*/ - uint8_t top_en :1; /*1: If the object or its children is clicked it goes to the foreground*/ + uint8_t top_en :1; /*1: If the object or its children is clicked it goes to the foreground*/ uint8_t reserved :1; uint8_t protect; /*Automatically happening actions can be prevented. 'OR'ed values from lv_obj_prot_t*/ - cord_t ext_size; /*EXTtend the size of the object in every direction. Used to draw shadow, shine etc.*/ + cord_t ext_size; /*EXTtend the size of the object in every direction. E.g. for shadow drawing*/ #if LV_OBJ_FREE_NUM != 0 uint8_t free_num; /*Application specific identifier (set it freely)*/ @@ -125,26 +124,26 @@ typedef enum typedef enum { LV_ALIGN_CENTER = 0, - LV_ALIGN_IN_TOP_LEFT, - LV_ALIGN_IN_TOP_MID, - LV_ALIGN_IN_TOP_RIGHT, - LV_ALIGN_IN_BOTTOM_LEFT, - LV_ALIGN_IN_BOTTOM_MID, - LV_ALIGN_IN_BOTTOM_RIGHT, - LV_ALIGN_IN_LEFT_MID, - LV_ALIGN_IN_RIGHT_MID, - LV_ALIGN_OUT_TOP_LEFT, - LV_ALIGN_OUT_TOP_MID, - LV_ALIGN_OUT_TOP_RIGHT, - LV_ALIGN_OUT_BOTTOM_LEFT, - LV_ALIGN_OUT_BOTTOM_MID, - LV_ALIGN_OUT_BOTTOM_RIGHT, - LV_ALIGN_OUT_LEFT_TOP, - LV_ALIGN_OUT_LEFT_MID, - LV_ALIGN_OUT_LEFT_BOTTOM, - LV_ALIGN_OUT_RIGHT_TOP, - LV_ALIGN_OUT_RIGHT_MID, - LV_ALIGN_OUT_RIGHT_BOTTOM, + LV_ALIGN_IN_TOP_LEFT, + LV_ALIGN_IN_TOP_MID, + LV_ALIGN_IN_TOP_RIGHT, + LV_ALIGN_IN_BOTTOM_LEFT, + LV_ALIGN_IN_BOTTOM_MID, + LV_ALIGN_IN_BOTTOM_RIGHT, + LV_ALIGN_IN_LEFT_MID, + LV_ALIGN_IN_RIGHT_MID, + LV_ALIGN_OUT_TOP_LEFT, + LV_ALIGN_OUT_TOP_MID, + LV_ALIGN_OUT_TOP_RIGHT, + LV_ALIGN_OUT_BOTTOM_LEFT, + LV_ALIGN_OUT_BOTTOM_MID, + LV_ALIGN_OUT_BOTTOM_RIGHT, + LV_ALIGN_OUT_LEFT_TOP, + LV_ALIGN_OUT_LEFT_MID, + LV_ALIGN_OUT_LEFT_BOTTOM, + LV_ALIGN_OUT_RIGHT_TOP, + LV_ALIGN_OUT_RIGHT_MID, + LV_ALIGN_OUT_RIGHT_BOTTOM, }lv_align_t; @@ -191,7 +190,7 @@ void lv_obj_refr_style(lv_obj_t * obj); * @param style pinter to a style. Only objects with this style will be notified * (NULL to notify all objects) */ -void lv_style_refr_all(void * style); +void lv_style_refr_objs(void * style); /** * Create a basic object @@ -204,7 +203,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy); /** * Delete 'obj' and all of its children - * @param obj + * @param obj pointer to an object to delete */ void lv_obj_del(lv_obj_t * obj); @@ -355,13 +354,6 @@ void lv_obj_set_ext_size(lv_obj_t * obj, cord_t ext_size); */ void lv_obj_set_style(lv_obj_t * obj, lv_style_t * style); -/** - * Isolate the style of an object. In other words a unique style will be created - * for this object which can be freely modified independently from the style of the - * other objects. - */ -void * lv_obj_iso_style(lv_obj_t * obj, uint32_t style_size); - /** * Hide an object. It won't be visible and clickable. * @param obj pointer to an object @@ -449,6 +441,7 @@ void * lv_obj_alloc_ext(lv_obj_t * obj, uint16_t ext_size); */ void lv_obj_refr_ext_size(lv_obj_t * obj); +#if LV_OBJ_FREE_NUM != 0 /** * Set an application specific number for an object. * It can help to identify objects in the application. @@ -456,7 +449,9 @@ void lv_obj_refr_ext_size(lv_obj_t * obj); * @param free_num the new free number */ void lv_obj_set_free_num(lv_obj_t * obj, uint8_t free_num); +#endif +#if LV_OBJ_FREE_P != 0 /** * Set an application specific pointer for an object. * It can help to identify objects in the application. @@ -464,6 +459,7 @@ void lv_obj_set_free_num(lv_obj_t * obj, uint8_t free_num); * @param free_p the new free pinter */ void lv_obj_set_free_p(lv_obj_t * obj, void * free_p); +#endif /** * Animate an object @@ -602,13 +598,6 @@ bool lv_obj_get_drag_throw(lv_obj_t * obj); */ bool lv_obj_get_drag_parent(lv_obj_t * obj); -/** - * Get the style isolation attribute of an object - * @param obj pointer to an object - * @return pointer to a style - */ -bool lv_obj_get_style_iso(lv_obj_t * obj); - /** * Get the protect field of an object * @param obj pointer to an object @@ -646,19 +635,23 @@ lv_design_f_t lv_obj_get_design_f(lv_obj_t * obj); */ void * lv_obj_get_ext(lv_obj_t * obj); +#if LV_OBJ_FREE_NUM != 0 /** * Get the free number * @param obj pointer to an object * @return the free number */ uint8_t lv_obj_get_free_num(lv_obj_t * obj); +#endif +#if LV_OBJ_FREE_P != 0 /** * Get the free pointer * @param obj pointer to an object * @return the free pointer */ void * lv_obj_get_free_p(lv_obj_t * obj); +#endif /********************** * MACROS diff --git a/lv_objx/lv_cont.c b/lv_objx/lv_cont.c index 0220d896d..94fb6993e 100644 --- a/lv_objx/lv_cont.c +++ b/lv_objx/lv_cont.c @@ -431,7 +431,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont) child_rc = child_rs; /*Initially the the row starter and closer is the same*/ while(child_rs != NULL) { cord_t h_row = 0; - cord_t w_row = style->hpad * 2; /*The width is at least the left-right hpad*/ + cord_t w_row = style->hpad * 2; /*The width is at least the left+right hpad*/ uint32_t obj_num = 0; /*Find the row closer object and collect some data*/ @@ -447,13 +447,12 @@ static void lv_cont_layout_pretty(lv_obj_t * cont) if(obj_num == 0) child_rs = child_rc; /*If the first object was hidden (or too long) then set the next as first */ }while(child_rc != NULL); - /*Step back one child because the last is already not fit*/ + /*Step back one child because the last already not fit*/ if(child_rc != NULL && obj_num != 0) child_rc = ll_get_next(&cont->child_ll, child_rc); /*If the object is too long then align it to the middle*/ if(obj_num == 0) { if(child_rc != NULL) { - h_row = lv_obj_get_height(child_rc); lv_obj_align(child_rc, cont, LV_ALIGN_IN_TOP_MID, 0, act_y); } } @@ -467,14 +466,15 @@ static void lv_cont_layout_pretty(lv_obj_t * cont) cord_t new_opad = (w_obj - w_row) / (obj_num - 1); cord_t act_x = style->hpad; /*x init*/ child_tmp = child_rs; - do{ + while(child_tmp != NULL) { if(lv_obj_get_hidden(child_tmp) == false && lv_obj_is_protected(child_tmp, LV_PROTECT_POS) == false) { lv_obj_align(child_tmp, cont, LV_ALIGN_IN_TOP_LEFT, act_x, act_y); act_x += lv_obj_get_width(child_tmp) + new_opad; } + if(child_tmp == child_rc) break; child_tmp = ll_get_prev(&cont->child_ll, child_tmp); - }while(child_tmp != child_rc); + } } diff --git a/lv_objx/lv_win.c b/lv_objx/lv_win.c index 09b1e73a8..4d8253aed 100644 --- a/lv_objx/lv_win.c +++ b/lv_objx/lv_win.c @@ -285,7 +285,6 @@ void lv_win_set_styles_cbtn(lv_obj_t * win, lv_style_t * rel, lv_style_t * pr) lv_btn_set_styles(cbtn, ext->style_cbtn_rel, ext->style_cbtn_pr, NULL, NULL, NULL); cbtn = lv_obj_get_child(ext->btnh, cbtn); } - } /*=====================