diff --git a/lv_app/lv_app_util/lv_app_kb.c b/lv_app/lv_app_util/lv_app_kb.c index 052b1af80..913472919 100644 --- a/lv_app/lv_app_util/lv_app_kb.c +++ b/lv_app/lv_app_util/lv_app_kb.c @@ -84,7 +84,7 @@ void lv_app_kb_init(void) kb_btnms.rects.round = 0; kb_btnms.rects.bwidth = 0; - kb_btnms.btns.rects.bwidth = 0; + // kb_btnms.btns.rects.bwidth = 0; kb_btnms.btns.rects.round = 0; } diff --git a/lv_appx/lv_app_sysmon.c b/lv_appx/lv_app_sysmon.c index 2c78ff3c8..0d9a581fa 100644 --- a/lv_appx/lv_app_sysmon.c +++ b/lv_appx/lv_app_sysmon.c @@ -83,7 +83,7 @@ static uint8_t mem_pct[LV_APP_SYSMON_PNUM]; static uint8_t cpu_pct[LV_APP_SYSMON_PNUM]; static lv_pbs_t cpu_pbs; static lv_pbs_t mem_pbs; -#if USE_DYN_MEM != 0 +#if USE_DYN_MEM != 0 && DM_CUSTOM == 0 static dm_mon_t mem_mon; #endif @@ -284,9 +284,9 @@ static void sysmon_task(void * param) #endif uint8_t mem_used_pct = 0; -#if USE_DYN_MEM != 0 +#if USE_DYN_MEM != 0 && DM_CUSTOM == 0 dm_monitor(&mem_mon); - mem_used_pct = (uint32_t) ((DM_MEM_SIZE - mem_mon.size_free) * 100 ) / DM_MEM_SIZE; + mem_used_pct = mem_mon.pct_used; #endif /*Add the CPU and memory data*/ @@ -296,7 +296,7 @@ static void sysmon_task(void * param) /*Refresh the shortcuts and windows*/ lv_app_sysmon_refr(); -#if USE_DYN_MEM != 0 +#if USE_DYN_MEM != 0 && DM_CUSTOM == 0 /*Handle periodic defrag. if enabled*/ #if LV_APP_SYSMON_DEFRAG_PERIOD != 0 @@ -307,7 +307,6 @@ static void sysmon_task(void * param) last_defrag = systick_get(); } #endif - /*Add notifications if something is critical*/ static bool mem_warn_report = false; if(mem_mon.size_free < LV_APP_SYSMON_MEM_WARN && mem_warn_report == false) { @@ -346,12 +345,12 @@ static void lv_app_sysmon_refr(void) strcpy(buf_short, "CPU: N/A\n"); #endif -#if USE_DYN_MEM != 0 +#if USE_DYN_MEM != 0 && DM_CUSTOM == 0 sprintf(buf_long, "%sMEMORY: %d %%\nTotal: %d bytes\nUsed: %d bytes\nFree: %d bytes\nFrag: %d %%", buf_long, mem_pct[LV_APP_SYSMON_PNUM - 1], - DM_MEM_SIZE, - DM_MEM_SIZE - mem_mon.size_free, mem_mon.size_free, mem_mon.pct_frag); + mem_mon.size_total, + mem_mon.size_total - mem_mon.size_free, mem_mon.size_free, mem_mon.pct_frag); sprintf(buf_short, "%sMem: %d %%\nFrag: %d %%\n", buf_short, mem_pct[LV_APP_SYSMON_PNUM - 1], mem_mon.pct_frag); diff --git a/lv_conf_temp.h b/lv_conf_temp.h index c1b6cc19f..ceb00f110 100644 --- a/lv_conf_temp.h +++ b/lv_conf_temp.h @@ -21,7 +21,10 @@ #define LV_VDB_SIZE (LV_HOR_RES * (LV_VER_RES / 20)) -/*Enable anti alaiassing */ +/* Enable antialaiassing + * If enabled everything will half-sized + * Use LV_DOWNSCALE to compensate + * the down scaling effect of antialiassing*/ #define LV_ANTIALIAS 1 /*Set the downscaling value*/ #if LV_ANTIALIAS == 0 @@ -30,7 +33,6 @@ #define LV_DOWNSCALE 2 #endif -#define LV_UPSCALE_MAP 0 /*Scale up maps (e.g. images) elements to compensate LV_DOWNSCALE*/ #define LV_REFR_PERIOD 40 /*Screen refresh period in milliseconds*/ #define LV_INV_FIFO_SIZE 32 /*The average number of objects on a screen */ @@ -177,7 +179,7 @@ /* App. utility settings */ #define LV_APP_NOTICE_SHOW_TIME 4000 /*Notices will be shown for this time [ms]*/ - +#define LV_APP_NOTICE_MAX_LEN 256 /*Max. number of characters on a notice*/ /*================== * LV APP X USAGE * ================*/ diff --git a/lv_obj/lv_obj.c b/lv_obj/lv_obj.c index 4ffad1a1e..d6dc1837c 100644 --- a/lv_obj/lv_obj.c +++ b/lv_obj/lv_obj.c @@ -48,10 +48,11 @@ static ll_dsc_t scr_ll; static lv_objs_t lv_objs_def = {.color = COLOR_MAKE(0xa0, 0xc0, 0xe0), .transp = 0}; static lv_objs_t lv_objs_scr = {.color = LV_OBJ_DEF_SCR_COLOR, .transp = 0}; static lv_objs_t lv_objs_transp = {.transp = 1}; -/* + + #ifdef LV_IMG_DEF_WALLPAPER LV_IMG_DECLARE(LV_IMG_DEF_WALLPAPER); -#endif*/ +#endif /********************** * MACROS @@ -80,10 +81,10 @@ void lv_init(void) /*Create the default screen*/ ll_init(&scr_ll, sizeof(lv_obj_t)); #ifdef LV_IMG_DEF_WALLPAPER - // lv_img_create_file("def_wp", LV_IMG_DEF_WALLPAPER); + lv_img_create_file("def_wp", LV_IMG_DEF_WALLPAPER); def_scr = lv_img_create(NULL, NULL); lv_img_set_auto_size(def_scr, false); - lv_img_set_file(def_scr, LV_IMG_DEF_WALLPAPER); + lv_img_set_file(def_scr, "U:/def_wp"); #else def_scr = lv_obj_create(NULL, NULL); #endif @@ -212,7 +213,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) new_obj->style_iso = 0; new_obj->hidden = 0; new_obj->top_en = 0; - new_obj->protect = LV_OBJ_PROT_NONE; + new_obj->protect = LV_PROTECT_NONE; new_obj->ext = NULL; } @@ -255,7 +256,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) new_obj->style_iso = 0; new_obj->hidden = 0; new_obj->top_en = 0; - new_obj->protect = LV_OBJ_PROT_NONE; + new_obj->protect = LV_PROTECT_NONE; new_obj->ext = NULL; @@ -278,15 +279,13 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) new_obj->drag_throw_en = copy->drag_throw_en; new_obj->drag_parent = copy->drag_parent; new_obj->hidden = copy->hidden; - new_obj->style_iso = copy->style_iso; new_obj->top_en = copy->top_en; new_obj->protect = copy->protect; - if(copy->style_iso == 0) { - new_obj->style_p = copy->style_p; - } else { - new_obj->style_p = dm_alloc(sizeof(lv_objs_t)); - memcpy(new_obj->style_p, copy->style_p, sizeof(lv_objs_t)); + 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)); @@ -371,7 +370,7 @@ bool lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param) switch(sign) { case LV_SIGNAL_CHILD_CHG: /*Return 'invalid' if the child change signal is not enabled*/ - if(lv_obj_is_protected(obj, LV_OBJ_PROT_CHILD_CHG) != false) valid = false; + if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) valid = false; break; default: break; @@ -891,7 +890,7 @@ void lv_obj_set_opar(lv_obj_t * obj, uint8_t opa) } /*Set the opacity is the object is not protected*/ - if(lv_obj_is_protected(obj, LV_OBJ_PROT_OPA) == false) obj->opa = opa; + if(lv_obj_is_protected(obj, LV_PROTECT_OPA) == false) obj->opa = opa; lv_obj_inv(obj); } diff --git a/lv_obj/lv_obj.h b/lv_obj/lv_obj.h index c22d0f36f..babdb166e 100644 --- a/lv_obj/lv_obj.h +++ b/lv_obj/lv_obj.h @@ -111,12 +111,14 @@ typedef struct __LV_OBJ_T }lv_obj_t; +/*Protect some attributes (max. 8 bit)*/ typedef enum { - LV_OBJ_PROT_NONE = 0x00, - LV_OBJ_PROT_CHILD_CHG = 0x01, /*Disable the child change signal. Used by the library*/ - LV_OBJ_PROT_OPA = 0x02, /*Prevent lv_obj_set_opar to modify the opacity*/ - LV_OBJ_PROT_PARENT = 0x04, /*Prevent automatic (hidden) parent change (e.g. in lv_page)*/ + LV_PROTECT_NONE = 0x00, + LV_PROTECT_CHILD_CHG = 0x01, /*Disable the child change signal. Used by the library*/ + LV_PROTECT_OPA = 0x02, /*Prevent lv_obj_set_opar to modify the opacity*/ + LV_PROTECT_PARENT = 0x04, /*Prevent automatic parent change (e.g. in lv_page)*/ + LV_PROTECT_POS = 0x08, /*Prevent automatic positioning (e.g. in lv_rect layout)*/ }lv_obj_protect_t; typedef enum diff --git a/lv_objx/lv_btn.c b/lv_objx/lv_btn.c index ccf26f643..dfa17074e 100644 --- a/lv_objx/lv_btn.c +++ b/lv_objx/lv_btn.c @@ -93,13 +93,8 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy) ext->lpr_rep_action = copy_ext->lpr_action; ext->tgl = copy_ext->tgl; - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_btn) == false) { - lv_obj_set_style(new_btn, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_btn, lv_obj_get_style(copy)); - lv_obj_iso_style(new_btn, sizeof(lv_btns_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_btn); } return new_btn; @@ -511,9 +506,9 @@ static void lv_btns_init(void) lv_btns_border.bcolor[LV_BTN_STATE_TGL_PR] = COLOR_BLACK; lv_btns_border.bcolor[LV_BTN_STATE_INA] = COLOR_GRAY; lv_btns_border.flags[LV_BTN_STATE_REL].empty = 1; - lv_btns_border.flags[LV_BTN_STATE_PR].empty = 1; - lv_btns_border.flags[LV_BTN_STATE_TGL_REL].empty = 1; - lv_btns_border.flags[LV_BTN_STATE_TGL_PR].empty = 1; + lv_btns_border.flags[LV_BTN_STATE_PR].empty = 0; + lv_btns_border.flags[LV_BTN_STATE_TGL_REL].empty = 0; + lv_btns_border.flags[LV_BTN_STATE_TGL_PR].empty = 0; lv_btns_border.flags[LV_BTN_STATE_INA].empty = 1; lv_btns_border.flags[LV_BTN_STATE_REL].light_en = 0; lv_btns_border.flags[LV_BTN_STATE_PR].light_en = 0; diff --git a/lv_objx/lv_btnm.c b/lv_objx/lv_btnm.c index d788e2552..7a99a35a4 100644 --- a/lv_objx/lv_btnm.c +++ b/lv_objx/lv_btnm.c @@ -88,13 +88,6 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy) } /*Copy an existing object*/ else { - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_btnm) == false) { - lv_obj_set_style(new_btnm, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_btnm, lv_obj_get_style(copy)); - lv_obj_iso_style(new_btnm, sizeof(lv_btnms_t)); - } lv_btnm_set_map(new_btnm, lv_btnm_get_map(copy)); } diff --git a/lv_objx/lv_cb.c b/lv_objx/lv_cb.c index 3f374e489..af30f5017 100644 --- a/lv_objx/lv_cb.c +++ b/lv_objx/lv_cb.c @@ -82,13 +82,8 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy) ext->bullet = lv_btn_create(new_cb, copy_ext->bullet); ext->label = lv_label_create(new_cb, copy_ext->label); - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_cb) == false) { - lv_obj_set_style(new_cb, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_cb, lv_obj_get_style(copy)); - lv_obj_iso_style(new_cb, sizeof(lv_cbs_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_cb); } lv_obj_align_us(new_cb, NULL, LV_ALIGN_CENTER, 0, 0); diff --git a/lv_objx/lv_chart.c b/lv_objx/lv_chart.c index 70d061fd9..e9c3443f6 100644 --- a/lv_objx/lv_chart.c +++ b/lv_objx/lv_chart.c @@ -96,13 +96,8 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy) ext->vdiv_num = ext_copy->vdiv_num; ext->pnum = ext_copy->pnum; - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_chart) == false) { - lv_obj_set_style(new_chart, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_chart, lv_obj_get_style(copy)); - lv_obj_iso_style(new_chart, sizeof(lv_charts_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_chart); } return new_chart; diff --git a/lv_objx/lv_img.c b/lv_objx/lv_img.c index fdb0f6c94..cd0d4d932 100644 --- a/lv_objx/lv_img.c +++ b/lv_objx/lv_img.c @@ -81,13 +81,8 @@ lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy) ext->auto_size = lv_img_get_auto_size(copy); lv_img_set_file(new_img, LV_EA(copy, lv_img_ext_t)->fn); - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_img) == false) { - lv_obj_set_style(new_img, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_img, lv_obj_get_style(copy)); - lv_obj_iso_style(new_img, sizeof(lv_imgs_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_img); } return new_img; diff --git a/lv_objx/lv_label.c b/lv_objx/lv_label.c index 97514e5d5..401e454b6 100644 --- a/lv_objx/lv_label.c +++ b/lv_objx/lv_label.c @@ -90,13 +90,8 @@ lv_obj_t * lv_label_create(lv_obj_t * par, lv_obj_t * copy) if(copy_ext->static_txt == 0) lv_label_set_text(new_label, lv_label_get_text(copy)); else lv_label_set_text_static(new_label, lv_label_get_text(copy)); - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_label) == false) { - lv_obj_set_style(new_label, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_label, lv_obj_get_style(copy)); - lv_obj_iso_style(new_label, sizeof(lv_labels_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_label); } return new_label; } diff --git a/lv_objx/lv_led.c b/lv_objx/lv_led.c index f7663dd69..c4a183ae2 100644 --- a/lv_objx/lv_led.c +++ b/lv_objx/lv_led.c @@ -79,13 +79,8 @@ lv_obj_t * lv_led_create(lv_obj_t * par, lv_obj_t * copy) lv_led_ext_t * copy_ext = lv_obj_get_ext(copy); ext->bright = copy_ext->bright; - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_led) == false) { - lv_obj_set_style(new_led, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_led, lv_obj_get_style(copy)); - lv_obj_iso_style(new_led, sizeof(lv_leds_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_led); } return new_led; diff --git a/lv_objx/lv_line.c b/lv_objx/lv_line.c index 18c0ea660..aa869f8cd 100644 --- a/lv_objx/lv_line.c +++ b/lv_objx/lv_line.c @@ -86,7 +86,8 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy) lv_line_set_upscale(new_line,lv_line_get_upscale(copy)); lv_line_set_points(new_line, LV_EA(copy, lv_line_ext_t)->point_array, LV_EA(copy, lv_line_ext_t)->point_num); - lv_obj_set_style(new_line, lv_obj_get_style(copy)); + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_line); } return new_line; diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index b97d92595..8043d1e83 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -75,13 +75,8 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy) lv_list_ext_t * copy_ext = lv_obj_get_ext(copy); ext ->fit = copy_ext->fit; - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_list) == false) { - lv_obj_set_style(new_list, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_list, lv_obj_get_style(copy)); - lv_obj_iso_style(new_list, sizeof(lv_lists_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_list); } return new_list; diff --git a/lv_objx/lv_mbox.c b/lv_objx/lv_mbox.c index dd97a3c37..f53fa9328 100644 --- a/lv_objx/lv_mbox.c +++ b/lv_objx/lv_mbox.c @@ -93,13 +93,8 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy) ext->txt = lv_label_create(new_mbox, copy_ext->txt); ext->btnh = lv_rect_create(new_mbox, copy_ext->btnh); - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_mbox) == false) { - lv_obj_set_style(new_mbox, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_mbox, lv_obj_get_style(copy)); - lv_obj_iso_style(new_mbox, sizeof(lv_mboxs_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_mbox); } lv_mbox_realign(new_mbox); diff --git a/lv_objx/lv_objx_templ.c b/lv_objx/lv_objx_templ.c index 4cc27d2c2..b6178a14d 100644 --- a/lv_objx/lv_objx_templ.c +++ b/lv_objx/lv_objx_templ.c @@ -80,13 +80,8 @@ lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy) else { lv_templ_ext_t * copy_ext = lv_obj_get_ext(copy); - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_templ) == false) { - lv_obj_set_style(new_templ, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_templ, lv_obj_get_style(copy)); - lv_obj_iso_style(new_templ, sizeof(lv_templs_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_templ); } return new_templ; diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index d68dd3c35..95011178b 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -82,7 +82,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_set_signal_f(ext->scrl, lv_scrl_signal); lv_obj_set_drag(ext->scrl, true); lv_obj_set_drag_throw(ext->scrl, true); - lv_obj_set_protect(ext->scrl, LV_OBJ_PROT_PARENT); + lv_obj_set_protect(ext->scrl, LV_PROTECT_PARENT); lv_rect_set_fit(ext->scrl, true, true); lv_obj_set_style(ext->scrl, &pages->scrl_rects); @@ -96,22 +96,16 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy) ext->scrl = lv_rect_create(new_page, copy_ext->scrl); lv_obj_set_signal_f(ext->scrl, lv_scrl_signal); + lv_page_set_pr_action(new_page, copy_ext->pr_action); + lv_page_set_rel_action(new_page, copy_ext->rel_action); + /* Add the signal function only if 'scrolling' is created * because everything has to be ready before any signal is received*/ lv_obj_set_signal_f(new_page, lv_page_signal); lv_obj_set_design_f(new_page, lv_page_design); - - lv_page_set_pr_action(new_page, copy_ext->pr_action); - lv_page_set_rel_action(new_page, copy_ext->rel_action); - - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_page) == false) { - lv_obj_set_style(new_page, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_page, lv_obj_get_style(copy)); - lv_obj_iso_style(new_page, sizeof(lv_pages_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_page); } lv_page_sb_refresh(new_page); @@ -143,7 +137,7 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) case LV_SIGNAL_CHILD_CHG: /*Move children to the scrollable object*/ child = lv_obj_get_child(page, NULL); while(child != NULL) { - if(lv_obj_is_protected(child, LV_OBJ_PROT_PARENT) == false) { + if(lv_obj_is_protected(child, LV_PROTECT_PARENT) == false) { lv_obj_t * tmp = child; child = lv_obj_get_child(page, child); /*Get the next child before move this*/ lv_obj_set_parent(tmp, ext->scrl); diff --git a/lv_objx/lv_pb.c b/lv_objx/lv_pb.c index d1d16a74e..bee074166 100644 --- a/lv_objx/lv_pb.c +++ b/lv_objx/lv_pb.c @@ -97,13 +97,8 @@ lv_obj_t * lv_pb_create(lv_obj_t * par, lv_obj_t * copy) ext->act_value = ext_copy->act_value; ext->label = lv_label_create(new_pb, ext_copy->label); - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_pb) == false) { - lv_obj_set_style(new_pb, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_pb, lv_obj_get_style(copy)); - lv_obj_iso_style(new_pb, sizeof(lv_pbs_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_pb); lv_pb_set_value(new_pb, ext->act_value); diff --git a/lv_objx/lv_rect.c b/lv_objx/lv_rect.c index 5189f577e..a9262ad74 100644 --- a/lv_objx/lv_rect.c +++ b/lv_objx/lv_rect.c @@ -97,13 +97,8 @@ lv_obj_t * lv_rect_create(lv_obj_t * par, lv_obj_t * copy) ext->vfit_en = copy_ext->vfit_en; ext->layout = copy_ext->layout; - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_rect) == false) { - lv_obj_set_style(new_rect, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_rect, lv_obj_get_style(copy)); - lv_obj_iso_style(new_rect, sizeof(lv_rects_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_rect); } @@ -430,17 +425,18 @@ static void lv_rect_layout_col(lv_obj_t * rect) /* Disable child change action because the children will be moved a lot * an unnecessary child change signals could be sent*/ - lv_obj_set_protect(rect, LV_OBJ_PROT_CHILD_CHG); + lv_obj_set_protect(rect, LV_PROTECT_CHILD_CHG); /* Align the children */ cord_t last_cord = style->vpad; LL_READ_BACK(rect->child_ll, child) { - if(lv_obj_get_hidden(child) != false) continue; + if(lv_obj_get_hidden(child) != false || + lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue; lv_obj_align(child, rect, align, hpad_corr , last_cord); last_cord += lv_obj_get_height(child) + style->opad; } - lv_obj_clr_protect(rect, LV_OBJ_PROT_CHILD_CHG); + lv_obj_clr_protect(rect, LV_PROTECT_CHILD_CHG); } /** @@ -478,18 +474,19 @@ static void lv_rect_layout_row(lv_obj_t * rect) /* Disable child change action because the children will be moved a lot * an unnecessary child change signals could be sent*/ - lv_obj_set_protect(rect, LV_OBJ_PROT_CHILD_CHG); + lv_obj_set_protect(rect, LV_PROTECT_CHILD_CHG); /* Align the children */ cord_t last_cord = style->hpad; LL_READ_BACK(rect->child_ll, child) { - if(lv_obj_get_hidden(child) != false) continue; + if(lv_obj_get_hidden(child) != false || + lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue; lv_obj_align(child, rect, align, last_cord, vpad_corr); last_cord += lv_obj_get_width(child) + style->opad; } - lv_obj_clr_protect(rect, LV_OBJ_PROT_CHILD_CHG); + lv_obj_clr_protect(rect, LV_PROTECT_CHILD_CHG); } /** @@ -514,18 +511,19 @@ static void lv_rect_layout_center(lv_obj_t * rect) /* Disable child change action because the children will be moved a lot * an unnecessary child change signals could be sent*/ - lv_obj_set_protect(rect, LV_OBJ_PROT_CHILD_CHG); + lv_obj_set_protect(rect, LV_PROTECT_CHILD_CHG); /* Align the children */ cord_t last_cord = - (h_tot / 2); LL_READ_BACK(rect->child_ll, child) { - if(lv_obj_get_hidden(child) != false) continue; + if(lv_obj_get_hidden(child) != false || + lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue; lv_obj_align(child, rect, LV_ALIGN_CENTER, 0, last_cord + lv_obj_get_height(child) / 2); last_cord += lv_obj_get_height(child) + style->opad; } - lv_obj_clr_protect(rect, LV_OBJ_PROT_CHILD_CHG); + lv_obj_clr_protect(rect, LV_PROTECT_CHILD_CHG); } /** @@ -547,7 +545,7 @@ static void lv_rect_layout_pretty(lv_obj_t * rect) child_rs = ll_get_tail(&rect->child_ll); /*Set the row starter child*/ if(child_rs == NULL) return; /*Return if no child*/ - lv_obj_set_protect(rect, LV_OBJ_PROT_CHILD_CHG); + lv_obj_set_protect(rect, LV_PROTECT_CHILD_CHG); child_rc = child_rs; /*Initially the the row starter and closer is the same*/ while(child_rs != NULL) { @@ -557,7 +555,8 @@ static void lv_rect_layout_pretty(lv_obj_t * rect) /*Find the row closer object and collect some data*/ do { - if(lv_obj_get_hidden(child_rc) == false) { + if(lv_obj_get_hidden(child_rc) == false && + lv_obj_is_protected(child_rc, LV_PROTECT_POS) == false) { if(w_row + lv_obj_get_width(child_rc) > w_obj) break; /*If the next object is already not fit then break*/ w_row += lv_obj_get_width(child_rc) + style->opad; /*Add the object width + opad*/ h_row = max(h_row, lv_obj_get_height(child_rc)); /*Search the highest object*/ @@ -588,7 +587,8 @@ static void lv_rect_layout_pretty(lv_obj_t * rect) cord_t act_x = style->hpad; /*x init*/ child_tmp = child_rs; do{ - if(lv_obj_get_hidden(child_tmp) == false) { + if(lv_obj_get_hidden(child_tmp) == false && + lv_obj_is_protected(child_tmp, LV_PROTECT_POS) == false) { lv_obj_align(child_tmp, rect, LV_ALIGN_IN_TOP_LEFT, act_x, act_y); act_x += lv_obj_get_width(child_tmp) + new_opad; } @@ -602,7 +602,7 @@ static void lv_rect_layout_pretty(lv_obj_t * rect) child_rs = ll_get_prev(&rect->child_ll, child_rc); /*Go to the next object*/ child_rc = child_rs; } - lv_obj_clr_protect(rect, LV_OBJ_PROT_CHILD_CHG); + lv_obj_clr_protect(rect, LV_PROTECT_CHILD_CHG); } /** @@ -627,14 +627,15 @@ static void lv_rect_layout_grid(lv_obj_t * rect) /* Disable child change action because the children will be moved a lot * an unnecessary child change signals could be sent*/ - lv_obj_set_protect(rect, LV_OBJ_PROT_CHILD_CHG); + lv_obj_set_protect(rect, LV_PROTECT_CHILD_CHG); /* Align the children */ cord_t act_x = style->hpad; cord_t act_y = style->vpad; uint16_t obj_cnt = 0; LL_READ_BACK(rect->child_ll, child) { - if(lv_obj_get_hidden(child) != false) continue; + if(lv_obj_get_hidden(child) != false || + lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue; if(obj_row > 1) { lv_obj_set_pos(child, act_x, act_y); @@ -651,7 +652,7 @@ static void lv_rect_layout_grid(lv_obj_t * rect) } } - lv_obj_clr_protect(rect, LV_OBJ_PROT_CHILD_CHG); + lv_obj_clr_protect(rect, LV_PROTECT_CHILD_CHG); } /** diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index 97eb700ea..fce2d90ed 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -100,13 +100,8 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy) ext->label = lv_label_create(new_ta, copy_ext->label); lv_page_glue_obj(ext->label, true); - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_ta) == false) { - lv_obj_set_style(new_ta, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_ta, lv_obj_get_style(copy)); - lv_obj_iso_style(new_ta, sizeof(lv_rects_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_ta); } /*Create a cursor blinker animation*/ diff --git a/lv_objx/lv_win.c b/lv_objx/lv_win.c index 6fbe16724..f21e53be6 100644 --- a/lv_objx/lv_win.c +++ b/lv_objx/lv_win.c @@ -79,7 +79,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy) ext->header = lv_rect_create(new_win, NULL); lv_rect_set_fit(ext->header, false, true); /*Move back the header because it is automatically moved to the scrollable */ - lv_obj_set_protect(ext->header, LV_OBJ_PROT_PARENT); + lv_obj_set_protect(ext->header, LV_PROTECT_PARENT); lv_obj_set_parent(ext->header, new_win); /*Create a title on the header*/ @@ -101,7 +101,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy) /*Create the objects*/ ext->header = lv_rect_create(new_win, copy_ext->header); /*Move back the header because it is automatically moved to the scrollable */ - lv_obj_set_protect(ext->header, LV_OBJ_PROT_PARENT); + lv_obj_set_protect(ext->header, LV_PROTECT_PARENT); lv_obj_set_parent(ext->header, new_win); ext->title = lv_label_create(ext->header, copy_ext->title); @@ -117,13 +117,8 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy) child = lv_obj_get_child(copy_ext->ctrl_holder, child); } - /*Set the style of 'copy' and isolate it if it is necessary*/ - if(lv_obj_get_style_iso(new_win) == false) { - lv_obj_set_style(new_win, lv_obj_get_style(copy)); - } else { - lv_obj_set_style(new_win, lv_obj_get_style(copy)); - lv_obj_iso_style(new_win, sizeof(lv_wins_t)); - } + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_win); } lv_win_realign(new_win); diff --git a/lvgl.h b/lvgl.h index 888356b69..c22cf6dd6 100644 --- a/lvgl.h +++ b/lvgl.h @@ -32,8 +32,7 @@ * DEFINES *********************/ #define LVGL_VERSION_MAJOR 2 -#define LVGL_VERSION_MINOR 0 -#define LVGL_VERSION_BUGFIX 1 +#define LVGL_VERSION_MINOR 1 /********************** * TYPEDEFS