BigW Consortium Gitlab

Commit 056d449f by Kiss-Vamosi Gabor

LV_PROTECT_FOLLOW added to 'line break' to LV_CONT_LAYOUT_PRETTY

parent 889807b4
...@@ -242,8 +242,8 @@ ...@@ -242,8 +242,8 @@
#define LV_APP_FILES_CHUNK_MAX_SIZE 1024 /*Max chunk size when the user sets it*/ #define LV_APP_FILES_CHUNK_MAX_SIZE 1024 /*Max chunk size when the user sets it*/
#endif /*USE_LV_APP_FILES != 0*/ #endif /*USE_LV_APP_FILES != 0*/
/*WiFi*/ /*WiFi (requires hal/wifi)*/
#define USE_LV_APP_WIFI 1 #define USE_LV_APP_WIFI 0
#if USE_LV_APP_WIFI != 0 #if USE_LV_APP_WIFI != 0
#define LV_APP_WIFI_SSID_DEF "my_ssid" #define LV_APP_WIFI_SSID_DEF "my_ssid"
#define LV_APP_WIFI_PWD_DEF "my_pasword" #define LV_APP_WIFI_PWD_DEF "my_pasword"
...@@ -252,8 +252,8 @@ ...@@ -252,8 +252,8 @@
#define LV_APP_WIFI_AUTO_CONNECT 1 /*Try to connect at start up to the deafult SSID and IP:PORT*/ #define LV_APP_WIFI_AUTO_CONNECT 1 /*Try to connect at start up to the deafult SSID and IP:PORT*/
#endif /*USE_LV_APP_WIFI != 0*/ #endif /*USE_LV_APP_WIFI != 0*/
/*GSM*/ /*GSM (requires hal/gsm)*/
#define USE_LV_APP_GSM 1 #define USE_LV_APP_GSM 0
#if USE_LV_APP_GSM != 0 #if USE_LV_APP_GSM != 0
#define LV_APP_GSM_APN_DEF "my_apn" #define LV_APP_GSM_APN_DEF "my_apn"
#define LV_APP_GSM_IP_DEF "10.11.12.13" #define LV_APP_GSM_IP_DEF "10.11.12.13"
......
...@@ -126,7 +126,8 @@ typedef enum ...@@ -126,7 +126,8 @@ typedef enum
LV_PROTECT_NONE = 0x00, LV_PROTECT_NONE = 0x00,
LV_PROTECT_CHILD_CHG = 0x01, /*Disable the child change signal. Used by the library*/ LV_PROTECT_CHILD_CHG = 0x01, /*Disable the child change signal. Used by the library*/
LV_PROTECT_PARENT = 0x02, /*Prevent automatic parent change (e.g. in lv_page)*/ LV_PROTECT_PARENT = 0x02, /*Prevent automatic parent change (e.g. in lv_page)*/
LV_PROTECT_POS = 0x04, /*Prevent automatic positioning (e.g. in lv_rect layout)*/ LV_PROTECT_POS = 0x04, /*Prevent automatic positioning (e.g. in lv_cont layout)*/
LV_PROTECT_FOLLOW = 0x08, /*Prevent an object follow in automatic ordering (e.g. in lv_cont PRETTY layout)*/
}lv_protect_t; }lv_protect_t;
typedef enum typedef enum
......
...@@ -438,17 +438,21 @@ static void lv_cont_layout_pretty(lv_obj_t * cont) ...@@ -438,17 +438,21 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
do { 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) { 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*/ if(w_row + lv_obj_get_width(child_rc) > w_obj) break; /*If this object is already not fit then break*/
w_row += lv_obj_get_width(child_rc) + style->opad; /*Add the object width + opad*/ w_row += lv_obj_get_width(child_rc) + style->opad; /*Add the object width + opad*/
h_row = MATH_MAX(h_row, lv_obj_get_height(child_rc)); /*Search the highest object*/ h_row = MATH_MAX(h_row, lv_obj_get_height(child_rc)); /*Search the highest object*/
obj_num ++; obj_num ++;
if(lv_obj_is_protected(child_rc, LV_PROTECT_FOLLOW)) break; /*If can not be followed by an other object then break here*/
} }
child_rc = ll_get_prev(&cont->child_ll, child_rc); /*Load the next object*/ child_rc = ll_get_prev(&cont->child_ll, child_rc); /*Load the next object*/
if(obj_num == 0) child_rs = child_rc; /*If the first object was hidden (or too long) then set the next as first */ 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); }while(child_rc != NULL);
/*Step back one child because the last already not fit*/ /*Step back one child because the last already not fit (except follow protected)*/
if(child_rc != NULL && obj_num != 0) child_rc = ll_get_next(&cont->child_ll, child_rc); if(child_rc != NULL && obj_num != 0 && !lv_obj_is_protected(child_rc, LV_PROTECT_FOLLOW)) {
child_rc = ll_get_next(&cont->child_ll, child_rc);
}
/*If the object is too long then align it to the middle*/ /*If the object is too long then align it to the middle*/
if(obj_num == 0) { if(obj_num == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment