Merge pull request #405 from aenchevich/dev-5.2
Fixing some compile-time errors and warning (on mipsel-gcc 4.6)
This commit is contained in:
@@ -64,7 +64,7 @@ static lv_signal_func_t ancestor_signal;
|
||||
*/
|
||||
lv_obj_t * lv_btnm_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("button matrix create started");
|
||||
LV_LOG_TRACE("button matrix create started");
|
||||
|
||||
/*Create the ancestor object*/
|
||||
lv_obj_t * new_btnm = lv_obj_create(par, copy);
|
||||
@@ -124,7 +124,7 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_btnm_set_map(new_btnm, lv_btnm_get_map(copy));
|
||||
}
|
||||
|
||||
LV_LOG_INFO("button matrix created");
|
||||
LV_LOG_INFO("button matrix created");
|
||||
|
||||
return new_btnm;
|
||||
}
|
||||
@@ -505,11 +505,9 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
lv_point_t p;
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
lv_mem_free(ext->button_areas);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_STYLE_CHG || sign == LV_SIGNAL_CORD_CHG) {
|
||||
} else if(sign == LV_SIGNAL_STYLE_CHG || sign == LV_SIGNAL_CORD_CHG) {
|
||||
lv_btnm_set_map(btnm, ext->map_p);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESSING) {
|
||||
} else if(sign == LV_SIGNAL_PRESSING) {
|
||||
uint16_t btn_pr;
|
||||
/*Search the pressed area*/
|
||||
lv_indev_get_point(param, &p);
|
||||
@@ -549,8 +547,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_RELEASED) {
|
||||
} else if(sign == LV_SIGNAL_RELEASED) {
|
||||
if(ext->btn_id_pr != LV_BTNM_PR_NONE) {
|
||||
if(ext->action) {
|
||||
uint16_t txt_i = get_button_text(btnm, ext->btn_id_pr);
|
||||
@@ -586,34 +583,31 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
/*Leave the clicked button as pressed if this the focused object in a group*/
|
||||
lv_group_t * g = lv_obj_get_group(btnm);
|
||||
if(lv_group_get_focused(g) != btnm) {
|
||||
ext->btn_id_pr = LV_BTNM_PR_NONE;
|
||||
ext->btn_id_pr = LV_BTNM_PR_NONE;
|
||||
}
|
||||
#else
|
||||
ext->btn_id_pr = LV_BTNM_PR_NONE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESS_LOST || sign == LV_SIGNAL_DEFOCUS) {
|
||||
} else if(sign == LV_SIGNAL_PRESS_LOST || sign == LV_SIGNAL_DEFOCUS) {
|
||||
ext->btn_id_pr = LV_BTNM_PR_NONE;
|
||||
lv_obj_invalidate(btnm);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_FOCUS) {
|
||||
} else if(sign == LV_SIGNAL_FOCUS) {
|
||||
#if USE_LV_GROUP
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
if(lv_obj_is_focused(btnm) && lv_indev_get_type(indev) == LV_INDEV_TYPE_POINTER) {
|
||||
lv_point_t p;
|
||||
lv_indev_get_point(indev, &p);
|
||||
uint16_t btn_i = get_button_from_point(btnm, &p);
|
||||
ext->btn_id_pr = btn_i;
|
||||
} else {
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
if(lv_obj_is_focused(btnm) && lv_indev_get_type(indev) == LV_INDEV_TYPE_POINTER) {
|
||||
lv_point_t p1;
|
||||
lv_indev_get_point(indev, &p1);
|
||||
uint16_t btn_i = get_button_from_point(btnm, &p1);
|
||||
ext->btn_id_pr = btn_i;
|
||||
} else {
|
||||
ext->btn_id_pr = 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
ext->btn_id_pr = 0;
|
||||
#endif
|
||||
lv_obj_invalidate(btnm);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROLL) {
|
||||
} else if(sign == LV_SIGNAL_CONTROLL) {
|
||||
char c = *((char *)param);
|
||||
if(c == LV_GROUP_KEY_RIGHT) {
|
||||
if(ext->btn_id_pr == LV_BTNM_PR_NONE) ext->btn_id_pr = 0;
|
||||
@@ -624,8 +618,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
if(ext->btn_id_pr == LV_BTNM_PR_NONE) ext->btn_id_pr = 0;
|
||||
if(ext->btn_id_pr > 0) ext->btn_id_pr--;
|
||||
lv_obj_invalidate(btnm);
|
||||
}
|
||||
else if(c == LV_GROUP_KEY_DOWN) {
|
||||
} else if(c == LV_GROUP_KEY_DOWN) {
|
||||
lv_style_t * style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BG);
|
||||
/*Find the area below the the current*/
|
||||
if(ext->btn_id_pr == LV_BTNM_PR_NONE) {
|
||||
@@ -645,8 +638,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
if(area_below < ext->btn_cnt) ext->btn_id_pr = area_below;
|
||||
}
|
||||
lv_obj_invalidate(btnm);
|
||||
}
|
||||
else if(c == LV_GROUP_KEY_UP) {
|
||||
} else if(c == LV_GROUP_KEY_UP) {
|
||||
lv_style_t * style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BG);
|
||||
/*Find the area below the the current*/
|
||||
if(ext->btn_id_pr == LV_BTNM_PR_NONE) {
|
||||
@@ -666,8 +658,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
|
||||
}
|
||||
lv_obj_invalidate(btnm);
|
||||
}
|
||||
else if(c == LV_GROUP_KEY_ENTER) {
|
||||
} else if(c == LV_GROUP_KEY_ENTER) {
|
||||
if(ext->action != NULL) {
|
||||
uint16_t txt_i = get_button_text(btnm, ext->btn_id_pr);
|
||||
if(txt_i != LV_BTNM_PR_NONE) {
|
||||
@@ -675,19 +666,17 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_btnm";
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
|
||||
if(buf->type[i] == NULL) break;
|
||||
}
|
||||
buf->type[i] = "lv_btnm";
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
|
||||
@@ -54,7 +54,7 @@ static lv_signal_func_t ancestor_signal;
|
||||
*/
|
||||
lv_obj_t * lv_img_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
{
|
||||
LV_LOG_TRACE("image create started");
|
||||
LV_LOG_TRACE("image create started");
|
||||
|
||||
lv_obj_t * new_img = NULL;
|
||||
|
||||
@@ -83,15 +83,15 @@ lv_obj_t * lv_img_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_click(new_img, false);
|
||||
/* Enable auto size for non screens
|
||||
/* Enable auto size for non screens
|
||||
* because image screens are wallpapers
|
||||
* and must be screen sized*/
|
||||
if(par != NULL) {
|
||||
ext->auto_size = 1;
|
||||
lv_obj_set_style(new_img, NULL); /*Inherit the style by default*/
|
||||
ext->auto_size = 1;
|
||||
lv_obj_set_style(new_img, NULL); /*Inherit the style by default*/
|
||||
} else {
|
||||
ext->auto_size = 0;
|
||||
lv_obj_set_style(new_img, &lv_style_plain); /*Set a style for screens*/
|
||||
ext->auto_size = 0;
|
||||
lv_obj_set_style(new_img, &lv_style_plain); /*Set a style for screens*/
|
||||
}
|
||||
} else {
|
||||
lv_img_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
@@ -103,7 +103,7 @@ lv_obj_t * lv_img_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
|
||||
LV_LOG_INFO("image created");
|
||||
LV_LOG_INFO("image created");
|
||||
|
||||
return new_img;
|
||||
}
|
||||
@@ -135,13 +135,12 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
|
||||
}
|
||||
|
||||
lv_img_header_t header;
|
||||
lv_img_dsc_get_info(src_img, &header);
|
||||
lv_img_dsc_get_info(src_img, &header);
|
||||
|
||||
/*Save the source*/
|
||||
if(src_type == LV_IMG_SRC_VARIABLE) {
|
||||
ext->src = src_img;
|
||||
}
|
||||
else if(src_type == LV_IMG_SRC_FILE || src_type == LV_IMG_SRC_SYMBOL) {
|
||||
/*Save the source*/
|
||||
if(src_type == LV_IMG_SRC_VARIABLE) {
|
||||
ext->src = src_img;
|
||||
} else if(src_type == LV_IMG_SRC_FILE || src_type == LV_IMG_SRC_SYMBOL) {
|
||||
/* If the new and the old src are the same then it was only a refresh.*/
|
||||
if(ext->src != src_img) {
|
||||
lv_mem_free(ext->src);
|
||||
@@ -151,21 +150,19 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
|
||||
strcpy(new_str, src_img);
|
||||
ext->src = new_str;
|
||||
}
|
||||
}
|
||||
|
||||
if(src_type == LV_IMG_SRC_SYMBOL) {
|
||||
/*`lv_img_dsc_get_info` couldn't set the with and height of a font so set it here*/
|
||||
lv_style_t * style = lv_img_get_style(img);
|
||||
lv_point_t size;
|
||||
lv_txt_get_size(&size, src_img, style->text.font, style->text.letter_space, style->text.line_space, LV_COORD_MAX, LV_TXT_FLAG_NONE);
|
||||
header.w = size.x;
|
||||
header.h = size.y;
|
||||
}
|
||||
} else if(src_type == LV_IMG_SRC_SYMBOL) {
|
||||
/*`lv_img_dsc_get_info` couldn't set the with and height of a font so set it here*/
|
||||
lv_style_t * style = lv_img_get_style(img);
|
||||
lv_point_t size;
|
||||
lv_txt_get_size(&size, src_img, style->text.font, style->text.letter_space, style->text.line_space, LV_COORD_MAX, LV_TXT_FLAG_NONE);
|
||||
header.w = size.x;
|
||||
header.h = size.y;
|
||||
}
|
||||
|
||||
ext->src_type = src_type;
|
||||
ext->w = header.w;
|
||||
ext->h = header.h;
|
||||
ext->cf = header.cf;
|
||||
ext->w = header.w;
|
||||
ext->h = header.h;
|
||||
ext->cf = header.cf;
|
||||
|
||||
if(lv_img_get_auto_size(img) != false) {
|
||||
lv_obj_set_size(img, ext->w, ext->h);
|
||||
@@ -278,12 +275,9 @@ static bool lv_img_design(lv_obj_t * img, const lv_area_t * mask, lv_design_mode
|
||||
}
|
||||
} else if(ext->src_type == LV_IMG_SRC_SYMBOL) {
|
||||
lv_draw_label(&coords, mask, style, opa_scale, ext->src, LV_TXT_FLAG_NONE, NULL);
|
||||
|
||||
} else {
|
||||
|
||||
/*Trigger the error handler of image drawer*/
|
||||
lv_draw_img(&img->coords, mask, NULL, style, opa_scale);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user