From fd4f9cdf113f4e6c46096f0d5278a769f85eae4a Mon Sep 17 00:00:00 2001 From: Gabor Date: Mon, 11 Jul 2016 16:16:53 +0200 Subject: [PATCH] dejavu14 fixes, img_draw bugfix --- lv_draw/lv_draw.c | 6 +- lv_draw/lv_draw_vbasic.c | 11 +- lv_misc/fonts/dejavu_14.c | 383 +++++++++++++++++++------------------- lv_obj/lv_dispi.c | 2 + lv_objx/lv_btn.c | 2 +- lv_objx/lv_list.c | 28 +-- lv_objx/lv_list.h | 2 +- lv_objx/lv_page.c | 45 ++--- lv_objx/lv_page.h | 2 - lv_objx/lv_rect.c | 3 - 10 files changed, 242 insertions(+), 242 deletions(-) diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index 673810ce4..f54636cf4 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -208,10 +208,14 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p, start_offset += ((mask_sub.x1 - cords_p->x1) >> ds_shift) * sizeof(color_t); /*First col*/ fs_seek(&file, start_offset); - uint32_t useful_data = (area_get_width(&mask_sub) >> ds_shift)* sizeof(color_t); + uint32_t useful_data = (area_get_width(&mask_sub) >> ds_shift) * sizeof(color_t); uint32_t next_row = (area_get_width(cords_p) >> ds_shift) * sizeof(color_t) - useful_data; area_cpy(&act_area, &mask_sub); + + /* Round down the start coordinate, because the upscaled images + * can start only LV_DOWNSCALE 'y' coordinates */ + act_area.y1 &= ~(cord_t)(ds_num - 1) ; act_area.y2 = act_area.y1 + ds_num - 1; uint32_t act_pos; diff --git a/lv_draw/lv_draw_vbasic.c b/lv_draw/lv_draw_vbasic.c index bb4a99c25..0bab48175 100644 --- a/lv_draw/lv_draw_vbasic.c +++ b/lv_draw/lv_draw_vbasic.c @@ -191,26 +191,27 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, color_t * vdb_buf_tmp = vdb_p->buf; vdb_buf_tmp += (uint32_t) vdb_width * masked_a.y1; /*Move to the first row*/ - map_p -= masked_a.x1 >> ds_shift; + map_p -= (masked_a.x1 >> ds_shift); #if LV_DOWNSCALE > 1 && LV_UPSCALE_MAP != 0 cord_t row; cord_t col; + cord_t row_cnt = 0; color_t transp_color = LV_IMG_COLOR_TRANSP; color_t color_tmp; cord_t map_i; map_p -= map_width; /*Compensate the first row % LV_DOWNSCALE*/ - for(row = masked_a.y1; row <= masked_a.y2; row++) { - if(row % LV_DOWNSCALE == 0) map_p += map_width; /*Next row on the map*/ + for(row = masked_a.y1, row_cnt = 0; row <= masked_a.y2; row++, row_cnt ++) { + if(row_cnt % LV_DOWNSCALE == 0) map_p += map_width; /*Next row on the map*/ map_i = masked_a.x1 >> ds_shift; map_i--; /*Compensate the first col % LV_DOWNSCALE*/ for(col = masked_a.x1; col <= masked_a.x2; col++) { if(col % LV_DOWNSCALE == 0) { map_i++; - color_tmp = color_mix(recolor, map_p[map_i], recolor_opa); + color_tmp = map_p[map_i];//color_mix(recolor, map_p[map_i], recolor_opa); } if(transp == false || map_p[map_i].full != transp_color.full) { - vdb_buf_tmp[col] = color_mix(color_tmp, vdb_buf_tmp[col], opa); + vdb_buf_tmp[col] = color_tmp;//color_mix(color_tmp, vdb_buf_tmp[col], opa); } } vdb_buf_tmp += vdb_width; /*Next row on the VDB*/ diff --git a/lv_misc/fonts/dejavu_14.c b/lv_misc/fonts/dejavu_14.c index 3d7fc7e42..30dd5b5bd 100644 --- a/lv_misc/fonts/dejavu_14.c +++ b/lv_misc/fonts/dejavu_14.c @@ -6,21 +6,21 @@ static const uint8_t dejavu_14_bitmaps[6272] = { - // ASCII: 32, char width: 4 - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ + // ASCII: 32, char width: 2 //white space + 0x00, 0x00, // --.............. + 0x00, 0x00, // --.............. + 0x00, 0x00, // --.............. + 0x00, 0x00, // --.............. + 0x00, 0x00, // --.............. + 0x00, 0x00, // --.............. + 0x00, 0x00, // --.............. + 0x00, 0x00, // --.............. + 0x00, 0x00, // --.............. + 0x00, 0x00, // --.............. + 0x00, 0x00, // --.............. + 0x00, 0x00, // --.............. + 0x00, 0x00, // --.............. + 0x00, 0x00, // --.............. // ASCII: 33, char width: 4 0x00, 0x00, // ----............ @@ -62,9 +62,9 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x14, 0x00, // ---O-O---....... 0x7f, 0x00, // -OOOOOOO-....... 0x24, 0x00, // --O--O---....... - 0x2c, 0x00, // --O-OO---....... - 0x7e, 0x00, // -OOOOOO--....... - 0x28, 0x00, // --O-O----....... + 0x24, 0x00, // --O--O---....... + 0xfe, 0x00, // OOOOOOO--....... + 0x48, 0x00, // -O--O----....... 0x48, 0x00, // -O--O----....... 0x00, 0x00, // ---------....... 0x00, 0x00, // ---------....... @@ -81,7 +81,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x08, 0x00, // ----O--......... 0x08, 0x00, // ----O--......... 0xf8, 0x00, // OOOOO--......... - 0x30, 0x00, // --OO---......... + 0x20, 0x00, // --O----......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... @@ -89,15 +89,15 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 37, char width: 10 0x00, 0x00, // ----------...... 0x00, 0x00, // ----------...... - 0x62, 0x00, // -OO---O---...... + 0x60, 0x80, // -OO-----O-...... + 0x91, 0x00, // O--O---O--...... 0x92, 0x00, // O--O--O---...... 0x94, 0x00, // O--O-O----...... - 0x94, 0x00, // O--O-O----...... - 0x69, 0x00, // -OO-O--O--...... - 0x0a, 0x80, // ----O-O-O-...... - 0x14, 0x80, // ---O-O--O-...... - 0x00, 0x80, // --------O-...... - 0x23, 0x80, // --O---OOO-...... + 0x69, 0x80, // -OO-O--OO-...... + 0x0a, 0x40, // ----O-O--O...... + 0x12, 0x40, // ---O--O--O...... + 0x20, 0x40, // --O---O--O...... + 0x41, 0x80, // -O-----OO-...... 0x00, 0x00, // ----------...... 0x00, 0x00, // ----------...... 0x00, 0x00, // ----------...... @@ -136,14 +136,14 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 40, char width: 4 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ + 0x20, 0x00, // --O-............ 0x40, 0x00, // -O--............ 0x40, 0x00, // -O--............ - 0x40, 0x00, // -O--............ - 0xc0, 0x00, // OO--............ 0x80, 0x00, // O---............ - 0xc0, 0x00, // OO--............ - 0x40, 0x00, // -O--............ + 0x80, 0x00, // O---............ + 0x80, 0x00, // O---............ + 0x80, 0x00, // O---............ + 0x80, 0x00, // O---............ 0x40, 0x00, // -O--............ 0x40, 0x00, // -O--............ 0x20, 0x00, // --O-............ @@ -152,17 +152,17 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 41, char width: 4 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ - 0x40, 0x00, // -O--............ + 0x80, 0x00, // O---............ 0x40, 0x00, // -O--............ 0x40, 0x00, // -O--............ 0x20, 0x00, // --O-............ 0x20, 0x00, // --O-............ 0x20, 0x00, // --O-............ 0x20, 0x00, // --O-............ + 0x20, 0x00, // --O-............ 0x40, 0x00, // -O--............ 0x40, 0x00, // -O--............ - 0x40, 0x00, // -O--............ + 0x80, 0x00, // O---............ 0x00, 0x00, // ----............ 0x00, 0x00, // ----............ @@ -170,10 +170,10 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // -----........... 0x00, 0x00, // -----........... 0x20, 0x00, // --O--........... - 0x28, 0x00, // --O-O........... - 0x30, 0x00, // --OO-........... - 0x70, 0x00, // -OOO-........... + 0xf8, 0x00, // OOOOO........... 0x20, 0x00, // --O--........... + 0x50, 0x00, // -O-O-........... + 0x00, 0x00, // -----........... 0x00, 0x00, // -----........... 0x00, 0x00, // -----........... 0x00, 0x00, // -----........... @@ -253,7 +253,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x20, 0x00, // --O............. 0x20, 0x00, // --O............. 0x20, 0x00, // --O............. - 0x00, 0x00, // ---............. + 0x20, 0x00, // --O............. 0x40, 0x00, // -O-............. 0x40, 0x00, // -O-............. 0x40, 0x00, // -O-............. @@ -267,13 +267,13 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // -------......... 0x30, 0x00, // --OO---......... 0x48, 0x00, // -O--O--......... - 0xc8, 0x00, // OO--O--......... - 0x8c, 0x00, // O---OO-......... 0x84, 0x00, // O----O-......... - 0x8c, 0x00, // O---OO-......... - 0x8c, 0x00, // O---OO-......... + 0x84, 0x00, // O----O-......... + 0x84, 0x00, // O----O-......... + 0x84, 0x00, // O----O-......... + 0x84, 0x00, // O----O-......... 0x48, 0x00, // -O--O--......... - 0x78, 0x00, // -OOOO--......... + 0x30, 0x00, // --OO---......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... @@ -301,8 +301,8 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x88, 0x00, // O---O--......... 0x08, 0x00, // ----O--......... 0x08, 0x00, // ----O--......... - 0x18, 0x00, // ---OO--......... - 0x30, 0x00, // --OO---......... + 0x08, 0x00, // ----O--......... + 0x10, 0x00, // ---O---......... 0x20, 0x00, // --O----......... 0x40, 0x00, // -O-----......... 0xf8, 0x00, // OOOOO--......... @@ -317,7 +317,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x08, 0x00, // ----O--......... 0x08, 0x00, // ----O--......... 0x08, 0x00, // ----O--......... - 0x38, 0x00, // --OOO--......... + 0x30, 0x00, // --OO---......... 0x08, 0x00, // ----O--......... 0x08, 0x00, // ----O--......... 0x08, 0x00, // ----O--......... @@ -329,12 +329,12 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 52, char width: 7 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... - 0x10, 0x00, // ---O---......... + 0x08, 0x00, // ----O--......... 0x18, 0x00, // ---OO--......... - 0x38, 0x00, // --OOO--......... + 0x28, 0x00, // --O-O--......... 0x48, 0x00, // -O--O--......... 0x48, 0x00, // -O--O--......... - 0x98, 0x00, // O--OO--......... + 0x88, 0x00, // O---O--......... 0xfc, 0x00, // OOOOOO-......... 0x08, 0x00, // ----O--......... 0x08, 0x00, // ----O--......... @@ -342,18 +342,20 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... + + // ASCII: 53, char width: 7 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... - 0x78, 0x00, // -OOOO--......... - 0x40, 0x00, // -O-----......... - 0x40, 0x00, // -O-----......... - 0x70, 0x00, // -OOO---......... - 0x18, 0x00, // ---OO--......... - 0x08, 0x00, // ----O--......... - 0x08, 0x00, // ----O--......... - 0x08, 0x00, // ----O--......... 0xf8, 0x00, // OOOOO--......... + 0x80, 0x00, // O------......... + 0x80, 0x00, // O------......... + 0xf0, 0x00, // OOOO---......... + 0x08, 0x00, // ----O--......... + 0x08, 0x00, // ----O--......... + 0x08, 0x00, // ----O--......... + 0x08, 0x00, // ----O--......... + 0xf0, 0x00, // OOOO---......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... @@ -363,13 +365,13 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // -------......... 0x38, 0x00, // --OOO--......... 0x40, 0x00, // -O-----......... - 0x40, 0x00, // -O-----......... + 0x80, 0x00, // O------......... 0xf0, 0x00, // OOOO---......... - 0xc8, 0x00, // OO--O--......... - 0xcc, 0x00, // OO--OO-......... - 0xc4, 0x00, // OO---O-......... - 0x48, 0x00, // -O--O--......... - 0x78, 0x00, // -OOOO--......... + 0x84, 0x00, // O----O-......... + 0x84, 0x00, // O----O-......... + 0x84, 0x00, // O----O-......... + 0x44, 0x00, // -O---O-......... + 0x38, 0x00, // --OOO--......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... @@ -377,7 +379,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 55, char width: 7 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... - 0xf8, 0x00, // OOOOO--......... + 0xf8, 0x00, // OOOOOO-......... 0x08, 0x00, // ----O--......... 0x08, 0x00, // ----O--......... 0x10, 0x00, // ---O---......... @@ -393,14 +395,14 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 56, char width: 7 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... - 0x70, 0x00, // -OOO---......... + 0x30, 0x00, // --OO---......... + 0x48, 0x00, // -O--O--......... 0x48, 0x00, // -O--O--......... - 0xc8, 0x00, // OO--O--......... 0x48, 0x00, // -O--O--......... 0x78, 0x00, // -OOOO--......... - 0xc8, 0x00, // OO--O--......... - 0x8c, 0x00, // O---OO-......... - 0xcc, 0x00, // OO--OO-......... + 0x84, 0x00, // O----O-......... + 0x84, 0x00, // O----O-......... + 0x84, 0x00, // O----O-......... 0x78, 0x00, // -OOOO--......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... @@ -409,13 +411,13 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 57, char width: 7 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... - 0x70, 0x00, // -OOO---......... - 0xc8, 0x00, // OO--O--......... - 0x88, 0x00, // O---O--......... - 0x8c, 0x00, // O---OO-......... - 0xcc, 0x00, // OO--OO-......... + 0x78, 0x00, // -OOOO--......... + 0x84, 0x00, // O----O-......... + 0x84, 0x00, // O----O-......... + 0x84, 0x00, // O---.O-......... + 0x84, 0x00, // O----O-......... 0x7c, 0x00, // -OOOOO-......... - 0x08, 0x00, // ----O--......... + 0x04, 0x00, // -----O-......... 0x08, 0x00, // ----O--......... 0x70, 0x00, // -OOO---......... 0x00, 0x00, // -------......... @@ -460,11 +462,11 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // ---------....... 0x00, 0x00, // ---------....... 0x07, 0x00, // -----OOO-....... - 0x1c, 0x00, // ---OOO---....... + 0x18, 0x00, // ---OO----....... 0x60, 0x00, // -OO------....... - 0x30, 0x00, // --OO-----....... - 0x0e, 0x00, // ----OOO--....... - 0x01, 0x00, // -------O-....... + 0x18, 0x00, // ---OO----....... + 0x07, 0x00, // -----OOO-....... + 0x00, 0x00, // ---------....... 0x00, 0x00, // ---------....... 0x00, 0x00, // ---------....... 0x00, 0x00, // ---------....... @@ -492,11 +494,11 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // ---------....... 0x00, 0x00, // ---------....... 0x70, 0x00, // -OOO-----....... - 0x1c, 0x00, // ---OOO---....... + 0x0c, 0x00, // ----OO---....... 0x03, 0x00, // ------OO-....... - 0x06, 0x00, // -----OO--....... - 0x38, 0x00, // --OOO----....... - 0x40, 0x00, // -O-------....... + 0x0c, 0x00, // ----OO---....... + 0x70, 0x00, // -OOO-----....... + 0x40, 0x00, // ---------....... 0x00, 0x00, // ---------....... 0x00, 0x00, // ---------....... 0x00, 0x00, // ---------....... @@ -505,7 +507,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 63, char width: 5 0x00, 0x00, // -----........... 0x00, 0x00, // -----........... - 0x70, 0x00, // -OOO-........... + 0x60, 0x00, // -OO--........... 0x90, 0x00, // O--O-........... 0x10, 0x00, // ---O-........... 0x10, 0x00, // ---O-........... @@ -524,27 +526,27 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x1e, 0x00, // ---OOOO----..... 0x21, 0x00, // --O----O---..... 0x40, 0x80, // -O------O--..... - 0x9e, 0x00, // O--OOOO----..... + 0x99, 0x00, // O---OO---O-..... + 0x92, 0x40, // O--O--O--O-..... 0x92, 0x40, // O--O--O--O-..... - 0x92, 0x00, // O--O--O----..... 0x92, 0x80, // O--O--O-O--..... - 0x1f, 0x00, // ---OOOOO---..... + 0x8f, 0x00, // O---OOOO---..... 0x40, 0x00, // -O---------..... - 0x33, 0x00, // --OO--OO---..... - 0x0c, 0x00, // ----OO-----..... + 0x21, 0x00, // --O----O---..... + 0x1e, 0x00, // ---OOOO----..... 0x00, 0x00, // -----------..... // ASCII: 65, char width: 7 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... 0x10, 0x00, // ---O---......... - 0x18, 0x00, // ---OO--......... 0x28, 0x00, // --O-O--......... 0x28, 0x00, // --O-O--......... - 0x24, 0x00, // --O--O-......... - 0x64, 0x00, // -OO--O-......... + 0x44, 0x00, // -O---O-......... + 0x44, 0x00, // -O---O-......... + 0x44, 0x00, // -O---O-......... 0x7c, 0x00, // -OOOOO-......... - 0x42, 0x00, // -O----O......... + 0x82, 0x00, // O-----O......... 0x82, 0x00, // O-----O......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... @@ -585,15 +587,15 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 68, char width: 8 0x00, 0x00, // --------........ 0x00, 0x00, // --------........ - 0x78, 0x00, // -OOOO---........ - 0x46, 0x00, // -O---OO-........ - 0x42, 0x00, // -O----O-........ - 0x43, 0x00, // -O----OO........ - 0x43, 0x00, // -O----OO........ - 0x43, 0x00, // -O----OO........ - 0x42, 0x00, // -O----O-........ - 0x46, 0x00, // -O---OO-........ - 0x7c, 0x00, // -OOOOO--........ + 0xf8, 0x00, // OOOOO---........ + 0x84, 0x00, // O----O--........ + 0x82, 0x00, // O-----O-........ + 0x82, 0x00, // O-----O-........ + 0x82, 0x00, // O-----O-........ + 0x82, 0x00, // O-----O-........ + 0x82, 0x00, // O-----O-........ + 0x84, 0x00, // O----O-........ + 0xf8, 0x00, // OOOOO--........ 0x00, 0x00, // --------........ 0x00, 0x00, // --------........ 0x00, 0x00, // --------........ @@ -634,12 +636,12 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // --------........ 0x00, 0x00, // --------........ 0x3c, 0x00, // --OOOO--........ - 0x62, 0x00, // -OO---O-........ - 0xc0, 0x00, // OO------........ + 0x42, 0x00, // -O----O-........ + 0x80, 0x00, // O-------........ 0x80, 0x00, // O-------........ 0x86, 0x00, // O----OO-........ - 0x86, 0x00, // O----OO-........ - 0xc2, 0x00, // OO----O-........ + 0x82, 0x00, // O-----O-........ + 0x82, 0x00, // O-----O-........ 0x42, 0x00, // -O----O-........ 0x3e, 0x00, // --OOOOO-........ 0x00, 0x00, // --------........ @@ -691,21 +693,21 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x40, 0x00, // -O-............. 0x40, 0x00, // -O-............. 0x40, 0x00, // -O-............. - 0xc0, 0x00, // OO-............. + 0x40, 0x00, // -O-............. 0x00, 0x00, // ---............. // ASCII: 75, char width: 7 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... - 0x46, 0x00, // -O---OO......... - 0x4c, 0x00, // -O--OO-......... - 0x58, 0x00, // -O-OO--......... + 0x42, 0x00, // -O----O......... + 0x44, 0x00, // -O---O-......... + 0x48, 0x00, // -O--O--......... 0x70, 0x00, // -OOO---......... 0x60, 0x00, // -OO----......... 0x50, 0x00, // -O-O---......... 0x48, 0x00, // -O--O--......... 0x44, 0x00, // -O---O-......... - 0x46, 0x00, // -O---OO......... + 0x42, 0x00, // -O----O......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... @@ -729,10 +731,10 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 77, char width: 9 0x00, 0x00, // ---------....... 0x00, 0x00, // ---------....... - 0x61, 0x00, // -OO----O-....... + 0x41, 0x00, // -O-----O-....... 0x63, 0x00, // -OO---OO-....... 0x63, 0x00, // -OO---OO-....... - 0x53, 0x00, // -O-O--OO-....... + 0x55, 0x00, // -O-O-O-O-....... 0x55, 0x00, // -O-O-O-O-....... 0x5d, 0x00, // -O-OOO-O-....... 0x49, 0x00, // -O--O--O-....... @@ -747,11 +749,11 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // --------........ 0x42, 0x00, // -O----O-........ 0x62, 0x00, // -OO---O-........ - 0x72, 0x00, // -OOO--O-........ + 0x52, 0x00, // -O-O--O-........ 0x52, 0x00, // -O-O--O-........ 0x5a, 0x00, // -O-OO-O-........ 0x4a, 0x00, // -O--O-O-........ - 0x4e, 0x00, // -O--OOO-........ + 0x4A, 0x00, // -O--O-O-........ 0x46, 0x00, // -O---OO-........ 0x46, 0x00, // -O---OO-........ 0x00, 0x00, // --------........ @@ -761,14 +763,14 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 79, char width: 8 0x00, 0x00, // --------........ 0x00, 0x00, // --------........ - 0x38, 0x00, // --OOO---........ + 0x3c, 0x00, // --OOOO--........ + 0x66, 0x00, // -OO--OO-........ + 0xc3, 0x00, // OO----OO........ + 0x81, 0x00, // O------O........ + 0x81, 0x00, // O------O........ + 0x81, 0x00, // O------O........ + 0xc3, 0x00, // OO----OO........ 0x66, 0x00, // -OO--OO-........ - 0xc2, 0x00, // OO----O-........ - 0x82, 0x00, // O-----O-........ - 0x82, 0x00, // O-----O-........ - 0x82, 0x00, // O-----O-........ - 0xc2, 0x00, // OO----O-........ - 0x46, 0x00, // -O---OO-........ 0x3c, 0x00, // --OOOO--........ 0x00, 0x00, // --------........ 0x00, 0x00, // --------........ @@ -782,7 +784,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x44, 0x00, // -O---O.......... 0x44, 0x00, // -O---O.......... 0x7c, 0x00, // -OOOOO.......... - 0x70, 0x00, // -OOO--.......... + 0x40, 0x00, // -O----.......... 0x40, 0x00, // -O----.......... 0x40, 0x00, // -O----.......... 0x40, 0x00, // -O----.......... @@ -794,16 +796,16 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // --------........ 0x00, 0x00, // --------........ 0x38, 0x00, // --OOO---........ - 0x66, 0x00, // -OO--OO-........ - 0xc2, 0x00, // OO----O-........ + 0x44, 0x00, // -O---O--........ 0x82, 0x00, // O-----O-........ 0x82, 0x00, // O-----O-........ 0x82, 0x00, // O-----O-........ - 0xc2, 0x00, // OO----O-........ - 0x46, 0x00, // -O---OO-........ + 0x82, 0x00, // O-----O-........ + 0x82, 0x00, // O-----O-........ + 0x44, 0x00, // -O----O-........ 0x3c, 0x00, // --OOOO--........ 0x0c, 0x00, // ----OO--........ - 0x00, 0x00, // --------........ + 0x02, 0x00, // ------O-........ 0x00, 0x00, // --------........ // ASCII: 82, char width: 7 @@ -816,7 +818,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x78, 0x00, // -OOOO--......... 0x48, 0x00, // -O--O--......... 0x44, 0x00, // -O---O-......... - 0x46, 0x00, // -O---OO......... + 0x42, 0x00, // -O----O......... 0x42, 0x00, // -O----O......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... @@ -842,7 +844,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // ------.......... 0x00, 0x00, // ------.......... 0xfc, 0x00, // OOOOOO.......... - 0x30, 0x00, // --OO--.......... + 0x10, 0x00, // ---O--.......... 0x10, 0x00, // ---O--.......... 0x10, 0x00, // ---O--.......... 0x10, 0x00, // ---O--.......... @@ -857,15 +859,15 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 85, char width: 8 0x00, 0x00, // --------........ 0x00, 0x00, // --------........ - 0x04, 0x00, // -----O--........ - 0x84, 0x00, // O----O--........ - 0x84, 0x00, // O----O--........ - 0x84, 0x00, // O----O--........ - 0x84, 0x00, // O----O--........ - 0x84, 0x00, // O----O--........ - 0xc4, 0x00, // OO---O--........ - 0x44, 0x00, // -O---O--........ - 0x7c, 0x00, // -OOOOO--........ + 0x42, 0x00, // -O----O-........ + 0x42, 0x00, // -O----O-........ + 0x42, 0x00, // -O----O-........ + 0x42, 0x00, // -O----O-........ + 0x42, 0x00, // -O----O-........ + 0x42, 0x00, // -O----O-........ + 0x42, 0x00, // -O----O-........ + 0x42, 0x00, // -O----O-........ + 0x3c, 0x00, // --OOOO--........ 0x00, 0x00, // --------........ 0x00, 0x00, // --------........ 0x00, 0x00, // --------........ @@ -874,11 +876,11 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... 0x82, 0x00, // O-----O......... - 0xc2, 0x00, // OO----O......... - 0x46, 0x00, // -O---OO......... + 0x82, 0x00, // O-----O......... + 0x44, 0x00, // -O---O......... 0x44, 0x00, // -O---O-......... - 0x64, 0x00, // -OO--O-......... - 0x2c, 0x00, // --O-OO-......... + 0x44, 0x00, // -O---O-......... + 0x28, 0x00, // --O-O--......... 0x28, 0x00, // --O-O--......... 0x38, 0x00, // --OOO--......... 0x10, 0x00, // ---O---......... @@ -889,15 +891,15 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 87, char width: 10 0x00, 0x00, // ----------...... 0x00, 0x00, // ----------...... - 0x04, 0x40, // -----O---O...... - 0x4c, 0x40, // -O--OO---O...... - 0x4c, 0x40, // -O--OO---O...... - 0x4a, 0xc0, // -O--O-O-OO...... - 0x4a, 0x80, // -O--O-O-O-...... - 0x72, 0x80, // -OOO--O-O-...... - 0x33, 0x80, // --OO--OOO-...... - 0x31, 0x80, // --OO---OO-...... - 0x31, 0x00, // --OO---O--...... + 0x44, 0x40, // -O---O---O...... + 0x44, 0x40, // -O---O---O...... + 0x44, 0x40, // -O---O---O...... + 0x44, 0x40, // -O---O---O...... + 0x44, 0x40, // -O---O---O...... + 0x2a, 0x80, // --O-O-O-O-...... + 0x20, 0x80, // --O-----O-...... + 0x20, 0x80, // --O-----O-...... + 0x20, 0x80, // --O-----O-...... 0x00, 0x00, // ----------...... 0x00, 0x00, // ----------...... 0x00, 0x00, // ----------...... @@ -938,13 +940,13 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... 0x7e, 0x00, // -OOOOOO......... - 0x06, 0x00, // -----OO......... - 0x0c, 0x00, // ----OO-......... + 0x02, 0x00, // ------O......... + 0x04, 0x00, // -----O-......... 0x08, 0x00, // ----O--......... 0x10, 0x00, // ---O---......... - 0x30, 0x00, // --OO---......... - 0x20, 0x00, // --O----......... + 0x30, 0x00, // --O----......... 0x40, 0x00, // -O-----......... + 0x80, 0x00, // O------......... 0xfe, 0x00, // OOOOOOO......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... @@ -1051,8 +1053,8 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // ------.......... 0x00, 0x00, // ------.......... 0x00, 0x00, // ------.......... - 0x70, 0x00, // -OOO--.......... - 0x18, 0x00, // ---OO-.......... + 0xf0, 0x00, // OOOO--.......... + 0x08, 0x00, // ----O-.......... 0x08, 0x00, // ----O-.......... 0x78, 0x00, // -OOOO-.......... 0x88, 0x00, // O---O-.......... @@ -1072,8 +1074,8 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x84, 0x00, // O----O-......... 0x84, 0x00, // O----O-......... 0x84, 0x00, // O----O-......... - 0x88, 0x00, // O---O--......... - 0xf0, 0x00, // OOOO---......... + 0x84, 0x00, // O----O-......... + 0xf8, 0x00, // OOOOO--......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... @@ -1083,7 +1085,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // ------.......... 0x00, 0x00, // ------.......... 0x00, 0x00, // ------.......... - 0x30, 0x00, // --OO--.......... + 0x38, 0x00, // --OOO-.......... 0x40, 0x00, // -O----.......... 0x80, 0x00, // O-----.......... 0x80, 0x00, // O-----.......... @@ -1115,10 +1117,10 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // ------.......... 0x00, 0x00, // ------.......... 0x00, 0x00, // ------.......... - 0x30, 0x00, // --OO--.......... - 0x48, 0x00, // -O--O-.......... - 0x88, 0x00, // O---O-.......... - 0xf8, 0x00, // OOOOO-.......... + 0x38, 0x00, // --OOO-.......... + 0x44, 0x00, // -O---O.......... + 0x84, 0x00, // O----O.......... + 0xfC, 0x00, // OOOOOO.......... 0x80, 0x00, // O-----.......... 0x80, 0x00, // O-----.......... 0x78, 0x00, // -OOOO-.......... @@ -1128,8 +1130,9 @@ static const uint8_t dejavu_14_bitmaps[6272] = // ASCII: 102, char width: 4 0x00, 0x00, // ----............ + 0x00, 0x00, // ----............ 0x30, 0x00, // --OO............ - 0x60, 0x00, // -OO-............ + 0x40, 0x00, // -O--............ 0x40, 0x00, // -O--............ 0xf0, 0x00, // OOOO............ 0x40, 0x00, // -O--............ @@ -1137,8 +1140,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x40, 0x00, // -O--............ 0x40, 0x00, // -O--............ 0x40, 0x00, // -O--............ - 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ + 0x40, 0x00, // -O--............ 0x00, 0x00, // ----............ 0x00, 0x00, // ----............ @@ -1163,6 +1165,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // -------......... 0x80, 0x00, // O------......... 0x80, 0x00, // O------......... + 0x80, 0x00, // O------......... 0xf0, 0x00, // OOOO---......... 0x88, 0x00, // O---O--......... 0x88, 0x00, // O---O--......... @@ -1172,10 +1175,10 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... 0x00, 0x00, // -------......... - 0x00, 0x00, // -------......... // ASCII: 105, char width: 3 0x00, 0x00, // ---............. + 0x00, 0x00, // ---............. 0x80, 0x00, // O--............. 0x00, 0x00, // ---............. 0x00, 0x00, // ---............. @@ -1188,7 +1191,6 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // ---............. 0x00, 0x00, // ---............. 0x00, 0x00, // ---............. - 0x00, 0x00, // ---............. // ASCII: 106, char width: 3 0x00, 0x00, // ---............. @@ -1211,16 +1213,16 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // ------.......... 0x80, 0x00, // O-----.......... 0x80, 0x00, // O-----.......... - 0x88, 0x00, // O---O-.......... + 0x80, 0x00, // O-----.......... 0x90, 0x00, // O--O--.......... - 0xc0, 0x00, // O-O---.......... + 0xa0, 0x00, // O-O---.......... 0xe0, 0x00, // OOO---.......... - 0x90, 0x00, // O--O--.......... + 0xa0, 0x00, // O-O---.......... + 0x89, 0x00, // O--O--.......... 0x88, 0x00, // O---O-.......... 0x00, 0x00, // ------.......... 0x00, 0x00, // ------.......... 0x00, 0x00, // ------.......... - 0x00, 0x00, // ------.......... // ASCII: 108, char width: 2 0x00, 0x00, // --.............. @@ -1244,7 +1246,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // ----------...... 0x00, 0x00, // ----------...... 0xb3, 0x00, // O-OO--OO--...... - 0xcd, 0x80, // OO--OO-OO-...... + 0xcd, 0x80, // OO--OO--O-...... 0x88, 0x80, // O---O---O-...... 0x88, 0x80, // O---O---O-...... 0x88, 0x80, // O---O---O-...... @@ -1300,7 +1302,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0xf0, 0x00, // OOOO---......... 0x80, 0x00, // O------......... 0x80, 0x00, // O------......... - 0x00, 0x00, // -------......... + 0x80, 0x00, // O------......... // ASCII: 113, char width: 7 0x00, 0x00, // -------......... @@ -1360,18 +1362,18 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x40, 0x00, // -O--............ 0x40, 0x00, // -O--............ 0x40, 0x00, // -O--............ + 0x40, 0x00, // -O--............ 0x20, 0x00, // --O-............ 0x00, 0x00, // ----............ 0x00, 0x00, // ----............ 0x00, 0x00, // ----............ - 0x00, 0x00, // ----............ // ASCII: 117, char width: 7 0x00, 0x00, // ------.......... 0x00, 0x00, // ------.......... 0x00, 0x00, // ------.......... 0x00, 0x00, // ------.......... - 0x00, 0x00, // ------.......... + 0x88, 0x00, // O---O-.......... 0x88, 0x00, // O---O-.......... 0x88, 0x00, // O---O-.......... 0x88, 0x00, // O---O-........... @@ -1405,10 +1407,10 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // ---------....... 0x49, 0x00, // -O--O--O-....... 0x49, 0x00, // -O--O--O-....... - 0x59, 0x00, // -O-OO--O-....... + 0x49, 0x00, // -O--O--O-....... 0x55, 0x00, // -O-O-O-O-....... - 0x76, 0x00, // -OOO-OO--....... - 0x26, 0x00, // --O--OO--....... + 0x22, 0x00, // --O---O--....... + 0x22, 0x00, // --O---O--....... 0x22, 0x00, // --O---O--....... 0x00, 0x00, // ---------....... 0x00, 0x00, // ---------....... @@ -1422,8 +1424,8 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // ------.......... 0x88, 0x00, // O---O-.......... 0x50, 0x00, // -O-O--.......... - 0x40, 0x00, // --O---.......... - 0x40, 0x00, // --O---.......... + 0x20, 0x00, // --O---.......... + 0x20, 0x00, // --O---.......... 0x50, 0x00, // -O-O--.......... 0x88, 0x00, // O---O-.......... 0x00, 0x00, // ------.......... @@ -1437,8 +1439,8 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // ------.......... 0x84, 0x00, // O----O.......... 0x44, 0x00, // -O---O.......... - 0x48, 0x00, // -O--O-.......... - 0x48, 0x00, // -O--O-.......... + 0x44, 0x00, // -O---O.......... + 0x44, 0x00, // -O---O.......... 0x28, 0x00, // --O-O-.......... 0x30, 0x00, // --OO--.......... 0x20, 0x00, // --O---.......... @@ -1451,10 +1453,10 @@ static const uint8_t dejavu_14_bitmaps[6272] = 0x00, 0x00, // -----........... 0x00, 0x00, // -----........... 0x00, 0x00, // -----........... - 0x78, 0x00, // -OOOO........... - 0x18, 0x00, // ---OO........... + 0xf8, 0x00, // OOOOO........... + 0x08, 0x00, // ----O........... + 0x08, 0x00, // ----O........... 0x10, 0x00, // ---O-........... - 0x30, 0x00, // --OO-........... 0x20, 0x00, // --O--........... 0x40, 0x00, // -O---........... 0xf8, 0x00, // OOOOO........... @@ -3626,7 +3628,7 @@ static const uint8_t dejavu_14_bitmaps[6272] = static const uint8_t dejavu_14_widths[224] = { - 4, 4, 5, 9, 7, 10, 8, 3, + 2, 4, 5, 9, 7, 10, 8, 3, 4, 4, 5, 9, 3, 4, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 9, 9, 9, 5, @@ -3656,7 +3658,7 @@ static const uint8_t dejavu_14_widths[224] = 6, 7, 7, 7, 7, 6, 7, 6, }; -static const font_t dejavu_14_dsc = +static const font_t dejavu_14_dsc = { 224, // Letter count 32, // First ascii code @@ -3667,6 +3669,7 @@ static const font_t dejavu_14_dsc = dejavu_14_bitmaps }; + const font_t * dejavu_14_get_dsc(void) { return &dejavu_14_dsc; diff --git a/lv_obj/lv_dispi.c b/lv_obj/lv_dispi.c index d3fab3cde..79150094d 100644 --- a/lv_obj/lv_dispi.c +++ b/lv_obj/lv_dispi.c @@ -385,6 +385,8 @@ static void dispi_drag(lv_dispi_t * dispi_p) */ static void dispi_drag_throw(lv_dispi_t * dispi_p) { + if(dispi_p->drag_in_prog == 0) return; + /*Set new position if the vector is not zero*/ lv_obj_t* par_dp = lv_obj_get_parent(dispi_p->last_obj_dp); lv_obj_t* drag_obj_dp = dispi_p->last_obj_dp; diff --git a/lv_objx/lv_btn.c b/lv_objx/lv_btn.c index b38ee2ca6..ff41ca284 100644 --- a/lv_objx/lv_btn.c +++ b/lv_objx/lv_btn.c @@ -62,7 +62,7 @@ static lv_btns_t lv_btns_def = .rects.round = 4 * LV_STYLE_MULT, .rects.hpad = 10 * LV_STYLE_MULT, .rects.vpad = 15 * LV_STYLE_MULT, - .rects.opad = 5 * LV_STYLE_MULT, + .rects.opad = 3 * LV_STYLE_MULT, }; static lv_btns_t lv_btns_transp = { diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index e8c2308bf..bbda15341 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -12,6 +12,7 @@ #include "lv_list.h" #include "lv_rect.h" #include "lv_label.h" +#include "lv_img.h" /********************* * DEFINES @@ -33,20 +34,17 @@ static bool lv_list_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo static lv_lists_t lv_lists_def = { /*Page style*/ - .pages.bg_rects.objs.color = COLOR_WHITE, .pages.bg_rects.gcolor = COLOR_SILVER, .pages.bg_rects.bcolor = COLOR_GRAY, + .pages.bg_rects.objs.color = COLOR_MAKE(0x20, 0x50, 0x80), .pages.bg_rects.gcolor = COLOR_SILVER, .pages.bg_rects.bcolor = COLOR_GRAY, .pages.bg_rects.bopa = 50, .pages.bg_rects.bwidth = 0 * LV_STYLE_MULT, .pages.bg_rects.round = 2 * LV_STYLE_MULT, - .pages.bg_rects.empty = 1, - .pages.bg_rects.vpad = 0 * LV_STYLE_MULT, - .pages.bg_rects.hpad = 0 * LV_STYLE_MULT, + .pages.bg_rects.empty = 0, + .pages.bg_rects.vpad = 10 * LV_STYLE_MULT, + .pages.bg_rects.hpad = 10 * LV_STYLE_MULT, .pages.bg_rects.opad = 5 * LV_STYLE_MULT, .pages.sb_rects.objs.color = COLOR_BLACK, .pages.sb_rects.gcolor = COLOR_BLACK, .pages.sb_rects.bcolor = COLOR_WHITE, .pages.sb_rects.bopa = 50, .pages.sb_rects.bwidth = 1 * LV_STYLE_MULT, .pages.sb_rects.round = 5 * LV_STYLE_MULT, .pages.sb_rects.empty = 0, .pages.sb_width= 8 * LV_STYLE_MULT, .pages.sb_opa=50, .pages.sb_mode = LV_PAGE_SB_MODE_AUTO, - .pages.margin_ver = 0 * LV_STYLE_MULT, - .pages.margin_hor = 0 * LV_STYLE_MULT, - /*List element style*/ .liste_btns.mcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0xa0, 0xa0, 0xa0), .liste_btns.gcolor[LV_BTN_STATE_REL] = COLOR_WHITE, .liste_btns.bcolor[LV_BTN_STATE_REL] = COLOR_WHITE, .liste_btns.mcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x60, 0x80, 0xa0), .liste_btns.gcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0xd0, 0xd0, 0xd0), .liste_btns.bcolor[LV_BTN_STATE_PR] = COLOR_WHITE, @@ -57,9 +55,9 @@ static lv_lists_t lv_lists_def = .liste_btns.rects.empty = 0, .liste_btns.rects.round = 4 * LV_STYLE_MULT, .liste_btns.rects.hpad = 10 * LV_STYLE_MULT, .liste_btns.rects.vpad = 10 * LV_STYLE_MULT, - .liste_btns.rects.opad = 3 * LV_STYLE_MULT, + .liste_btns.rects.opad = 5 * LV_STYLE_MULT, - .liste_layout = LV_RECT_LAYOUT_CENTER + .liste_layout = LV_RECT_LAYOUT_ROW_M }; /********************** @@ -87,7 +85,7 @@ lv_obj_t* lv_list_create(lv_obj_t* par_dp, lv_obj_t * copy_dp) dm_assert(new_obj_dp); /*Init the new list object*/ - lv_obj_set_style(new_obj_dp, &lv_lists_def.pages); + lv_obj_set_style(new_obj_dp, &lv_lists_def); lv_rect_set_layout(new_obj_dp, LV_LIST_LAYOUT_DEF); return new_obj_dp; @@ -121,17 +119,23 @@ bool lv_list_signal(lv_obj_t* obj_dp, lv_signal_t sign, void * param) void lv_list_add(lv_obj_t * obj_dp, const char * img_fn, const char * txt, void (*release) (lv_obj_t *)) { + lv_lists_t * lists = lv_obj_get_style(obj_dp); lv_obj_t * liste; liste = lv_btn_create(obj_dp, NULL); - lv_obj_set_style(liste, &lv_lists_def.liste_btns); + lv_obj_set_style(liste, &lists->liste_btns); //lv_btn_set_rel_action(liste, release); lv_page_glue_obj(liste, true); lv_rect_set_layout(liste, lv_lists_def.liste_layout); lv_rect_set_fit(liste, false, true); - if(img_fn != NULL) { + cord_t w = lv_obj_get_width(lv_obj_get_parent(obj_dp)); + w -= lists->pages.bg_rects.hpad * 2; + lv_obj_set_width(liste, w); + if(img_fn != NULL) { + lv_obj_t * img = lv_img_create(liste, NULL); + lv_img_set_file(img, img_fn); } lv_obj_t * label = lv_label_create(liste, NULL); diff --git a/lv_objx/lv_list.h b/lv_objx/lv_list.h index 6a4c871c3..8c40bec2f 100644 --- a/lv_objx/lv_list.h +++ b/lv_objx/lv_list.h @@ -43,7 +43,7 @@ typedef enum typedef struct { lv_page_ext_t page_ext; - uint8_t fit_size :1; /*Automatically set the size of list elements to the holder */ + uint8_t fit_size :1; /*Automatically set the adjust size of list elements to longest element */ uint8_t sel_en :1; /*Enable selecting list elements by toggling them */ uint8_t sel_one :1; /*Enable to select only one list element*/ }lv_list_ext_t; diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index 166a7ee71..6085afcec 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -58,9 +58,6 @@ static lv_pages_t lv_pages_def = .sb_opa=50, .sb_mode = LV_PAGE_SB_MODE_ON, - .margin_hor = 10 * LV_STYLE_MULT, - .margin_ver = 10 * LV_STYLE_MULT, - }; static lv_pages_t lv_pages_paper = @@ -90,9 +87,6 @@ static lv_pages_t lv_pages_paper = .sb_width = 10 * LV_STYLE_MULT, .sb_opa=50, .sb_mode = LV_PAGE_SB_MODE_ON, - - .margin_hor = 15 * LV_STYLE_MULT, - .margin_ver = 15 * LV_STYLE_MULT, }; static lv_pages_t lv_pages_transp = @@ -117,9 +111,6 @@ static lv_pages_t lv_pages_transp = .sb_opa = 50, .sb_mode = LV_PAGE_SB_MODE_AUTO, - .margin_hor = 0 * LV_STYLE_MULT, - .margin_ver = 0 * LV_STYLE_MULT, - }; /********************** * MACROS @@ -226,34 +217,34 @@ bool lv_page_signal(lv_obj_t* obj_dp, lv_signal_t sign, void* param) lv_obj_get_cords(obj_dp, &page_cords); /*page width smaller then parent width? -> align to left*/ - if(area_get_width(&page_cords) <= area_get_width(&par_cords) - pages_p->margin_hor * 2) { - if(page_cords.x1 - pages_p->margin_hor != par_cords.x1) { - new_x = pages_p->margin_hor; + if(area_get_width(&page_cords) <= area_get_width(&par_cords)) { + if(page_cords.x1 != par_cords.x1) { + new_x = 0; refr_x = true; } } else { - if(page_cords.x2 + pages_p->margin_hor < par_cords.x2) { - new_x = area_get_width(&par_cords) - area_get_width(&page_cords) - pages_p->margin_hor; /* Right align */ + if(page_cords.x2 < par_cords.x2) { + new_x = area_get_width(&par_cords) - area_get_width(&page_cords); /* Right align */ refr_x = true; } - if (page_cords.x1 - pages_p->margin_hor > par_cords.x1) { - new_x = pages_p->margin_hor; /*Left align*/ + if (page_cords.x1 > par_cords.x1) { + new_x = 0; /*Left align*/ refr_x = true; } } /*Wrong in y?*/ - if(area_get_height(&page_cords) <= area_get_height(&par_cords) - pages_p->margin_ver * 2) { - if(page_cords.y1 - pages_p->margin_ver != par_cords.y1) { - new_y = pages_p->margin_ver; + if(area_get_height(&page_cords) <= area_get_height(&par_cords)) { + if(page_cords.y1 != par_cords.y1) { + new_y = 0; refr_y = true; } } else { - if(page_cords.y2 + pages_p->margin_ver < par_cords.y2) { - new_y = area_get_height(&par_cords) - area_get_height(&page_cords) - pages_p->margin_ver; /* Bottom align */ + if(page_cords.y2 < par_cords.y2) { + new_y = area_get_height(&par_cords) - area_get_height(&page_cords); /* Bottom align */ refr_y = true; } - if (page_cords.y1 - pages_p->margin_ver > par_cords.y1) { - new_y = pages_p->margin_ver; /*Top align*/ + if (page_cords.y1 > par_cords.y1) { + new_y = 0; /*Top align*/ refr_y = true; } } @@ -384,8 +375,8 @@ static void lv_page_sb_refresh(lv_obj_t* page_dp) lv_pages_t * pages_p = lv_obj_get_style(page_dp); lv_obj_t* par_dp = lv_obj_get_parent(page_dp); cord_t size_tmp; - cord_t page_w = lv_obj_get_width(page_dp) + 2 * pages_p->margin_hor; - cord_t page_h = lv_obj_get_height(page_dp) + 2 * pages_p->margin_ver; + cord_t page_w = lv_obj_get_width(page_dp); + cord_t page_h = lv_obj_get_height(page_dp); cord_t par_w = lv_obj_get_width(par_dp); cord_t par_h = lv_obj_get_height(par_dp); @@ -403,7 +394,7 @@ static void lv_page_sb_refresh(lv_obj_t* page_dp) lv_obj_set_width(page_p->sbh_dp, size_tmp); lv_obj_set_pos(page_p->sbh_dp, - ( -(lv_obj_get_x(page_dp) - pages_p->margin_hor) * (par_w - size_tmp - pages_p->sb_width)) / + ( -(lv_obj_get_x(page_dp)) * (par_w - size_tmp - pages_p->sb_width)) / (page_w - par_w), par_h - pages_p->sb_width); } @@ -422,7 +413,7 @@ static void lv_page_sb_refresh(lv_obj_t* page_dp) lv_obj_set_pos(page_p->sbv_dp, par_w - pages_p->sb_width, - (-(lv_obj_get_y(page_dp) - pages_p->margin_ver) * (par_h - size_tmp - pages_p->sb_width)) / + (-(lv_obj_get_y(page_dp)) * (par_h - size_tmp - pages_p->sb_width)) / (page_h - par_h)); } diff --git a/lv_objx/lv_page.h b/lv_objx/lv_page.h index 5a798c56f..a9b809ab0 100644 --- a/lv_objx/lv_page.h +++ b/lv_objx/lv_page.h @@ -34,8 +34,6 @@ typedef struct lv_rects_t bg_rects; lv_rects_t sb_rects; cord_t sb_width; - cord_t margin_hor; /*Extra size between the parent and the page horizontally*/ - cord_t margin_ver; /*Extra size between the parent and the page vertically*/ lv_page_sb_mode_t sb_mode; uint8_t sb_opa; }lv_pages_t; diff --git a/lv_objx/lv_rect.c b/lv_objx/lv_rect.c index 67b9ab4f0..58a6f0fe7 100644 --- a/lv_objx/lv_rect.c +++ b/lv_objx/lv_rect.c @@ -489,10 +489,7 @@ void lv_rect_refr_autofit(lv_obj_t * obj_dp) lv_obj_t * par_dp = lv_obj_get_parent(obj_dp); par_dp->signal_f(par_dp, LV_SIGNAL_CHILD_CHG, obj_dp); - } else { - lv_obj_set_size(obj_dp, LV_OBJ_DEF_WIDTH, LV_OBJ_DEF_HEIGHT); } - } #endif