1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00

Merge remote-tracking branch 'origin/master' into dev-6.1

This commit is contained in:
Themba Dube 2019-08-18 15:25:59 -04:00
commit d5d8eb5afd
6 changed files with 71 additions and 21 deletions

View File

@ -2,7 +2,21 @@
<p align="center">
<a href="https://github.com/littlevgl/lvgl/blob/master/LICENCE.txt"><img src="https://img.shields.io/badge/licence-MIT-blue.svg"></a>
<a href="https://github.com/littlevgl/lvgl/releases/tag/v6.0"><img src="https://img.shields.io/badge/version-6.0-blue.svg"></a>
<br>
</p>
<h2 align="center">Shape the future of LittlevGL</h2>
<p align="center">
<a href="https://www.esurveycreator.com/s/littlevgl-2019"><img src="https://littlevgl.com/external/survey.png"></a>
</p>
<p align="center">
It takes only 5 minutes to tell some information about how you use LittlevGL, what you like about it, what should be improved and the future directions you find reasonable.
</p>
---
<p align="center">
<img src="https://littlevgl.com/github/cover_ori_reduced_2.gif">
</p>

View File

@ -687,12 +687,14 @@ static void indev_proc_press(lv_indev_proc_t * proc)
if(proc->wait_until_release != 0) return;
lv_disp_t * disp = indev_act->driver.disp;
bool new_obj_searched = false;
/*If there is no last object then search*/
if(indev_obj_act == NULL) {
indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_sys(disp));
if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_top(disp));
if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_scr_act(disp));
new_obj_searched = true;
}
/*If there is last object but it is not dragged and not protected also search*/
else if(proc->types.pointer.drag_in_prog == 0 &&
@ -700,14 +702,21 @@ static void indev_proc_press(lv_indev_proc_t * proc)
indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_sys(disp));
if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_top(disp));
if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_scr_act(disp));
new_obj_searched = true;
}
/*If a dragable or a protected object was the last then keep it*/
else {
}
/*The last object might have drag throw. Stop it manually*/
if(new_obj_searched && proc->types.pointer.last_obj) {
proc->types.pointer.drag_throw_vect.x = 0;
proc->types.pointer.drag_throw_vect.y = 0;
indev_drag_throw(proc);
}
/*If a new object was found reset some variables and send a pressed signal*/
if(indev_obj_act != proc->types.pointer.act_obj) {
proc->types.pointer.last_point.x = proc->types.pointer.act_point.x;
proc->types.pointer.last_point.y = proc->types.pointer.act_point.y;
@ -720,6 +729,7 @@ static void indev_proc_press(lv_indev_proc_t * proc)
if(indev_reset_check(proc)) return;
lv_event_send(last_obj, LV_EVENT_PRESS_LOST, NULL);
if(indev_reset_check(proc)) return;
}
proc->types.pointer.act_obj = indev_obj_act; /*Save the pressed object*/
@ -1108,9 +1118,6 @@ static void indev_drag(lv_indev_proc_t * state)
lv_obj_set_y(drag_obj, act_y + state->types.pointer.vect.y);
}
/*If the object didn't moved then clear the invalidated areas*/
if(drag_obj->coords.x1 == prev_x && drag_obj->coords.y1 == prev_y) {
// state->types.pointer.drag_in_prog = 0;

View File

@ -482,6 +482,7 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord
disp.driver.hor_res = dsc->header.w;
disp.driver.ver_res = dsc->header.h;
#if LV_ANTIALIAS
/*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/
lv_color_t ctransp = LV_COLOR_TRANSP;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED &&
@ -490,6 +491,7 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord
{
disp.driver.antialiasing = 0;
}
#endif
lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
lv_refr_set_disp_refreshing(&disp);
@ -642,6 +644,7 @@ void lv_canvas_draw_line(lv_obj_t * canvas, const lv_point_t * points, uint32_t
disp.driver.hor_res = dsc->header.w;
disp.driver.ver_res = dsc->header.h;
#if LV_ANTIALIAS
/*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/
lv_color_t ctransp = LV_COLOR_TRANSP;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED &&
@ -650,6 +653,7 @@ void lv_canvas_draw_line(lv_obj_t * canvas, const lv_point_t * points, uint32_t
{
disp.driver.antialiasing = 0;
}
#endif
lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
lv_refr_set_disp_refreshing(&disp);
@ -694,6 +698,7 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, const lv_point_t * points, uint32
disp.driver.hor_res = dsc->header.w;
disp.driver.ver_res = dsc->header.h;
#if LV_ANTIALIAS
/*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/
lv_color_t ctransp = LV_COLOR_TRANSP;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED &&
@ -702,6 +707,7 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, const lv_point_t * points, uint32
{
disp.driver.antialiasing = 0;
}
#endif
lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
lv_refr_set_disp_refreshing(&disp);
@ -747,6 +753,7 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_
disp.driver.hor_res = dsc->header.w;
disp.driver.ver_res = dsc->header.h;
#if LV_ANTIALIAS
/*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/
lv_color_t ctransp = LV_COLOR_TRANSP;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED &&
@ -755,6 +762,7 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_
{
disp.driver.antialiasing = 0;
}
#endif
lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
lv_refr_set_disp_refreshing(&disp);

View File

@ -142,8 +142,10 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, const lv_obj_t * copy)
ext->draw_arrow = copy_ext->draw_arrow;
ext->stay_open = copy_ext->stay_open;
/*Refresh the style with new signal function*/
lv_obj_refresh_style(new_ddlist);
lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_BG, lv_ddlist_get_style(copy, LV_DDLIST_STYLE_BG));
lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_SB, lv_ddlist_get_style(copy, LV_DDLIST_STYLE_SB));
lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_SEL, lv_ddlist_get_style(copy, LV_DDLIST_STYLE_SEL));
}
LV_LOG_INFO("drop down list created");
@ -230,6 +232,7 @@ void lv_ddlist_set_fix_height(lv_obj_t * ddlist, lv_coord_t h)
*/
void lv_ddlist_set_fix_width(lv_obj_t * ddlist, lv_coord_t w)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
if(w == 0) {
lv_cont_set_fit2(ddlist, LV_FIT_TIGHT, lv_cont_get_fit_bottom(ddlist));
} else {
@ -237,6 +240,12 @@ void lv_ddlist_set_fix_width(lv_obj_t * ddlist, lv_coord_t w)
lv_obj_set_width(ddlist, w);
}
switch(lv_label_get_align(ext->label)) {
case LV_LABEL_ALIGN_LEFT: lv_obj_align(ext->label, NULL, LV_ALIGN_IN_LEFT_MID, 0, 0); break;
case LV_LABEL_ALIGN_CENTER: lv_obj_align(ext->label, NULL, LV_ALIGN_CENTER, 0, 0); break;
case LV_LABEL_ALIGN_RIGHT: lv_obj_align(ext->label, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0); break;
}
lv_ddlist_refr_size(ddlist, false);
}
@ -773,13 +782,16 @@ static lv_res_t release_handler(lv_obj_t * ddlist)
uint16_t new_opt = 0;
const char * txt = lv_label_get_text(ext->label);
uint32_t i = 0;
uint32_t line_cnt = 0;
uint32_t i_prev = 0;
uint32_t letter_cnt = 0;
uint32_t letter;
for(line_cnt = 0; line_cnt < letter_i; line_cnt++) {
for(letter_cnt = 0; letter_cnt < letter_i; letter_cnt++) {
letter = lv_txt_encoded_next(txt, &i);
/*Count he lines to reach the clicked letter. But ignore the last '\n' because it
* still belongs to the clicked line*/
if(letter == '\n' && i != letter_i) new_opt++;
if(letter == '\n' && i_prev != letter_i) new_opt++;
i_prev = i;
}
ext->sel_opt_id = new_opt;

View File

@ -631,14 +631,13 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT;
uint32_t i = line_start;
uint32_t i_current = i;
uint32_t i_act = i;
uint32_t letter;
uint32_t letter_next;
if(new_line_start > 0) {
while(i <= new_line_start - 1) {
/* Get the current letter.
* Be careful 'i' already points to the next character*/
while(i < new_line_start) {
/* Get the current letter.*/
letter = lv_txt_encoded_next(txt, &i);
/*Get the next letter too for kerning*/
@ -652,12 +651,14 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
}
x += lv_font_get_glyph_width(font, letter, letter_next);
if(pos->x < x) {
i = i_current;
/*Finish if the x position or the last char of the line is reached*/
if(pos->x < x || i == new_line_start) {
i = i_act;
break;
}
x += style->text.letter_space;
i_current = i;
i_act = i;
}
}

View File

@ -176,9 +176,17 @@ void lv_roller_set_options(lv_obj_t * roller, const char * options, lv_roller_mo
void lv_roller_set_align(lv_obj_t * roller, lv_label_align_t align)
{
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
lv_mem_assert(ext);
if(ext->ddlist.label == NULL) return; /*Probably the roller is being deleted if the label is NULL.*/
lv_label_set_align(ext->ddlist.label, align);
lv_obj_t * label = ext->ddlist.label;
if(label == NULL) return; /*Probably the roller is being deleted if the label is NULL.*/
lv_label_set_align(label, align);
switch(lv_label_get_align(label)) {
case LV_LABEL_ALIGN_LEFT: lv_obj_align(label, NULL, LV_ALIGN_IN_LEFT_MID, 0, 0); break;
case LV_LABEL_ALIGN_CENTER: lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0); break;
case LV_LABEL_ALIGN_RIGHT: lv_obj_align(label, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0); break;
}
}
/**
@ -498,7 +506,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
lv_coord_t font_h = lv_font_get_line_height(font);
if(sign == LV_SIGNAL_DRAG_END) {
/*If dragged then align the list to there be an element in the middle*/
/*If dragged then align the list to have an element in the middle*/
lv_coord_t label_y1 = ext->ddlist.label->coords.y1 - roller->coords.y1;
lv_coord_t label_unit = font_h + style_label->text.line_space;
lv_coord_t mid = (roller->coords.y2 - roller->coords.y1) / 2;