From 855dc44e32686313e24d8fbb684545f712336979 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 28 Jan 2019 16:02:11 +0100 Subject: [PATCH] solve warings --- lv_core/lv_core.mk | 1 + lv_misc/lv_txt.c | 6 +++--- lv_objx/lv_table.c | 10 +++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lv_core/lv_core.mk b/lv_core/lv_core.mk index cf393b9de..9992e3fe7 100644 --- a/lv_core/lv_core.mk +++ b/lv_core/lv_core.mk @@ -4,6 +4,7 @@ CSRCS += lv_obj.c CSRCS += lv_refr.c CSRCS += lv_style.c CSRCS += lv_vdb.c +CSRCS += lv_lang.c DEPPATH += --dep-path $(LVGL_DIR)/lvgl/lv_core VPATH += :$(LVGL_DIR)/lvgl/lv_core diff --git a/lv_misc/lv_txt.c b/lv_misc/lv_txt.c index 81d874de9..ded96332a 100644 --- a/lv_misc/lv_txt.c +++ b/lv_misc/lv_txt.c @@ -233,15 +233,15 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font, break; } n_char_since_last_break++; - lv_coord_t letter_width = lv_font_get_width(font, letter); - cur_w += letter_width; + lv_coord_t letter_width2 = lv_font_get_width(font, letter); + cur_w += letter_width2; if(cur_w > max_width) { /* Current letter already exceeds, return previous */ lv_txt_encoded_prev(txt, &i); other = false; break; } - if(letter_width > 0){ + if(letter_width2 > 0){ cur_w += letter_space; } } diff --git a/lv_objx/lv_table.c b/lv_objx/lv_table.c index 9936a5660..f1446ce33 100644 --- a/lv_objx/lv_table.c +++ b/lv_objx/lv_table.c @@ -663,10 +663,17 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ lv_draw_rect(&cell_area, mask, cell_style, opa_scale); if(ext->cell_data[cell]) { + txt_area.x1 = cell_area.x1 + cell_style->body.padding.hor; txt_area.x2 = cell_area.x2 - cell_style->body.padding.hor; txt_area.y1 = cell_area.y1 + cell_style->body.padding.ver; txt_area.y2 = cell_area.y2 - cell_style->body.padding.ver; + /*Align the content to the middle if not cropped*/ + if(format.crop == 0) { + txt_flags = LV_TXT_FLAG_NONE; + } else { + txt_flags = LV_TXT_FLAG_EXPAND; + } lv_txt_get_size(&txt_size, ext->cell_data[cell] + 1, cell_style->text.font, cell_style->text.letter_space, cell_style->text.line_space, lv_area_get_width(&txt_area), txt_flags); @@ -675,9 +682,6 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ if(format.crop == 0) { txt_area.y1 = cell_area.y1 + h_row / 2 - txt_size.y / 2; txt_area.y2 = cell_area.y1 + h_row / 2 + txt_size.y / 2; - txt_flags = LV_TXT_FLAG_NONE; - } else { - txt_flags = LV_TXT_FLAG_EXPAND; } switch(format.align) {