exclude some code when USE_LV_GROUP 0
This commit is contained in:
@@ -411,6 +411,9 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
|
||||
i->proc.last_state = data->state;
|
||||
i->proc.last_key = data->key;
|
||||
#else
|
||||
(void)data; /*Unused*/
|
||||
(void)i; /*Unused*/
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -504,6 +507,9 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
|
||||
i->proc.last_state = data->state;
|
||||
i->proc.last_key = data->key;
|
||||
#else
|
||||
(void)data; /*Unused*/
|
||||
(void)i; /*Unused*/
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*Set the default styles*/
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
lv_arc_set_style(new_arc, LV_ARC_STYLE_MAIN, th->preload);
|
||||
lv_arc_set_style(new_arc, LV_ARC_STYLE_MAIN, th->arc);
|
||||
} else {
|
||||
lv_arc_set_style(new_arc, LV_ARC_STYLE_MAIN, &lv_style_plain_color);
|
||||
}
|
||||
|
||||
@@ -233,6 +233,8 @@ void lv_btn_set_ink_in_time(lv_obj_t * btn, uint16_t time)
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||
ext->ink_in_time = time;
|
||||
#else
|
||||
(void)btn; /*Unused*/
|
||||
(void)time; /*Unused*/
|
||||
LV_LOG_WARN("`lv_btn_set_ink_ink_time` has no effect if LV_BTN_INK_EFEFCT or USE_LV_ANIMATION is disabled")
|
||||
#endif
|
||||
}
|
||||
@@ -249,6 +251,8 @@ void lv_btn_set_ink_wait_time(lv_obj_t * btn, uint16_t time)
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||
ext->ink_wait_time = time;
|
||||
#else
|
||||
(void)btn; /*Unused*/
|
||||
(void)time; /*Unused*/
|
||||
LV_LOG_WARN("`lv_btn_set_ink_wait_time` has no effect if LV_BTN_INK_EFEFCT or USE_LV_ANIMATION is disabled")
|
||||
#endif
|
||||
}
|
||||
@@ -264,6 +268,8 @@ void lv_btn_set_ink_out_time(lv_obj_t * btn, uint16_t time)
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||
ext->ink_out_time = time;
|
||||
#else
|
||||
(void)btn; /*Unused*/
|
||||
(void)time; /*Unused*/
|
||||
LV_LOG_WARN("`lv_btn_set_ink_out_time` has no effect if LV_BTN_INK_EFEFCT or USE_LV_ANIMATION is disabled")
|
||||
#endif
|
||||
}
|
||||
@@ -352,6 +358,7 @@ uint16_t lv_btn_get_ink_in_time(const lv_obj_t * btn)
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||
return ext->ink_in_time;
|
||||
#else
|
||||
(void)btn; /*Unused*/
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
@@ -368,6 +375,7 @@ uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn)
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||
return ext->ink_wait_time;
|
||||
#else
|
||||
(void)btn; /*Unused*/
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
@@ -382,6 +390,7 @@ uint16_t lv_btn_get_ink_out_time(const lv_obj_t * btn)
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||
return ext->ink_in_time;
|
||||
#else
|
||||
(void)btn; /*Unused*/
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -526,10 +526,12 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
} else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
ext->label = NULL;
|
||||
} else if(sign == LV_SIGNAL_FOCUS) {
|
||||
bool editing = false;
|
||||
#if USE_LV_GROUP
|
||||
lv_group_t * g = lv_obj_get_group(ddlist);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
editing = lv_group_get_editing(g);
|
||||
#endif
|
||||
lv_hal_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
|
||||
/*Encoders need special handling*/
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER) {
|
||||
/*Open the list if editing*/
|
||||
@@ -587,10 +589,11 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
ext->sel_opt_id_ori = ext->sel_opt_id;
|
||||
ext->opened = 0;
|
||||
if(ext->action) ext->action(ddlist);
|
||||
|
||||
#if USE_LV_GROUP
|
||||
lv_group_t * g = lv_obj_get_group(ddlist);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
if(editing) lv_group_set_editing(g, false); /*In edit mode go to navigate mode if an option is selected*/
|
||||
#endif
|
||||
} else {
|
||||
ext->opened = 1;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,9 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->styles_btn[LV_BTN_STATE_TGL_PR] = &lv_style_btn_tgl_pr;
|
||||
ext->styles_btn[LV_BTN_STATE_INA] = &lv_style_btn_ina;
|
||||
ext->anim_time = LV_LIST_FOCUS_TIME;
|
||||
#if USE_LV_GROUP
|
||||
ext->selected_btn = NULL;
|
||||
#endif
|
||||
|
||||
lv_obj_set_signal_func(new_list, lv_list_signal);
|
||||
|
||||
@@ -625,8 +627,6 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
res = ancestor_page_signal(list, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
|
||||
if(sign == LV_SIGNAL_CORD_CHG) {
|
||||
/*Be sure the width of the buttons are correct*/
|
||||
lv_coord_t w = lv_obj_get_width(list);
|
||||
@@ -637,10 +637,11 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
/*Because of the possible change of horizontal and vertical padding refresh buttons width */
|
||||
refr_btn_width(list);
|
||||
} else if(sign == LV_SIGNAL_FOCUS) {
|
||||
|
||||
#if USE_LV_GROUP
|
||||
lv_hal_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
/*With ENCODER select the first button only in edit mode*/
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER) {
|
||||
|
||||
lv_group_t * g = lv_obj_get_group(list);
|
||||
if(lv_group_get_editing(g)) {
|
||||
lv_list_set_btn_selected(list, lv_list_get_next_btn(list, NULL));
|
||||
@@ -658,17 +659,25 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
lv_list_set_btn_selected(list, lv_list_get_next_btn(list, NULL));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else if(sign == LV_SIGNAL_DEFOCUS) {
|
||||
|
||||
#if USE_LV_GROUP
|
||||
/*De-select the selected btn*/
|
||||
lv_list_set_btn_selected(list, NULL);
|
||||
last_clicked_btn = NULL; /*button click will be set if click happens before focus*/
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
ext->selected_btn = NULL;
|
||||
#endif
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_CONTROLL) {
|
||||
|
||||
#if USE_LV_GROUP
|
||||
char c = *((char *)param);
|
||||
if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) {
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
/*If there is a valid selected button the make the previous selected*/
|
||||
if(ext->selected_btn) {
|
||||
lv_obj_t * btn_prev = lv_list_get_next_btn(list, ext->selected_btn);
|
||||
@@ -680,6 +689,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
if(btn) lv_list_set_btn_selected(list, btn); /*If there are no buttons on the list then there is no first button*/
|
||||
}
|
||||
} else if(c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_UP) {
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
/*If there is a valid selected button the make the next selected*/
|
||||
if(ext->selected_btn != NULL) {
|
||||
lv_obj_t * btn_next = lv_list_get_prev_btn(list, ext->selected_btn);
|
||||
@@ -704,6 +714,8 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
rel_action = lv_btn_get_action(btn, LV_BTN_ACTION_CLICK);
|
||||
if(rel_action != NULL) rel_action(btn);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
@@ -712,7 +724,6 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
}
|
||||
buf->type[i] = "lv_list";
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -224,6 +224,7 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay)
|
||||
lv_obj_animate(mbox, LV_ANIM_NONE, ext->anim_time, delay, (void (*)(lv_obj_t *))lv_obj_del);
|
||||
}
|
||||
#else
|
||||
(void)delay; /*Unused*/
|
||||
lv_obj_del(mbox);
|
||||
#endif
|
||||
}
|
||||
@@ -236,6 +237,8 @@ void lv_mbox_stop_auto_close(lv_obj_t * mbox)
|
||||
{
|
||||
#if USE_LV_ANIMATION
|
||||
lv_anim_del(mbox, NULL);
|
||||
#else
|
||||
(void)mbox; /*Unused*/
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -315,8 +315,11 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
refr_position(roller, false);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_FOCUS) {
|
||||
bool editing = false;
|
||||
#if USE_LV_GROUP
|
||||
lv_group_t * g = lv_obj_get_group(roller);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
editing = lv_group_get_editing(g);
|
||||
#endif
|
||||
lv_hal_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
|
||||
/*Encoders need special handling*/
|
||||
@@ -357,10 +360,12 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
} else if(c == LV_GROUP_KEY_ENTER) {
|
||||
ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id; /*Set the entered value as default*/
|
||||
if(ext->ddlist.action) ext->ddlist.action(roller);
|
||||
|
||||
#if USE_LV_GROUP
|
||||
lv_group_t * g = lv_obj_get_group(roller);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
|
||||
if(editing) lv_group_set_editing(g, false); /*In edit mode go to navigate mode if an option is selected*/
|
||||
#endif
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
|
||||
@@ -486,6 +486,7 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_CONTROLL) {
|
||||
char c = *((char *)param);
|
||||
#if USE_LV_GROUP
|
||||
lv_group_t * g = lv_obj_get_group(slider);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
lv_hal_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
@@ -494,7 +495,7 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER && c == LV_GROUP_KEY_ENTER) {
|
||||
if(editing) lv_group_set_editing(g, false);
|
||||
}
|
||||
|
||||
#endif
|
||||
if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_UP) {
|
||||
lv_slider_set_value(slider, lv_slider_get_value(slider) + 1);
|
||||
if(ext->action != NULL) ext->action(slider);
|
||||
|
||||
Reference in New Issue
Block a user