mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
fix conflict
This commit is contained in:
commit
8867df8f18
@ -768,7 +768,7 @@
|
||||
#endif
|
||||
#if LV_USE_LED
|
||||
#ifndef LV_LED_BRIGHT_MIN
|
||||
# define LV_LED_BRIGHT_MIN 60 /*Minimal brightness*/
|
||||
# define LV_LED_BRIGHT_MIN 100 /*Minimal brightness*/
|
||||
#endif
|
||||
#ifndef LV_LED_BRIGHT_MAX
|
||||
# define LV_LED_BRIGHT_MAX 255 /*Maximal brightness*/
|
||||
|
@ -3842,10 +3842,22 @@ static void trans_anim_ready_cb(lv_anim_t * a)
|
||||
lv_style_trans_t * tr = a->var;
|
||||
|
||||
/* Remove the transitioned property from trans. style
|
||||
* to allow changing it by normal styles*/
|
||||
lv_style_list_t * list = lv_obj_get_style_list(tr->obj, tr->part);
|
||||
lv_style_t * style_trans = lv_style_list_get_transition_style(list);
|
||||
lv_style_remove_prop(style_trans, tr->prop);
|
||||
* if there no more transitions for this property
|
||||
* It allows changing it by normal styles*/
|
||||
|
||||
bool running = false;
|
||||
lv_style_trans_t * tr_i;
|
||||
LV_LL_READ(LV_GC_ROOT(_lv_obj_style_trans_ll), tr_i) {
|
||||
if(tr_i != tr && tr_i->obj == tr->obj && tr_i->part == tr->part && tr_i->prop == tr->prop) {
|
||||
running = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!running) {
|
||||
lv_style_list_t * list = lv_obj_get_style_list(tr->obj, tr->part);
|
||||
lv_style_t * style_trans = lv_style_list_get_transition_style(list);
|
||||
lv_style_remove_prop(style_trans, tr->prop);
|
||||
}
|
||||
|
||||
lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
lv_mem_free(tr);
|
||||
|
@ -347,7 +347,7 @@ static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2,
|
||||
if(flat) wcorr_i = (LV_MATH_ABS(ydiff) << 5) / LV_MATH_ABS(xdiff);
|
||||
else wcorr_i = (LV_MATH_ABS(xdiff) << 5) / LV_MATH_ABS(ydiff);
|
||||
|
||||
w = (w * wcorr[wcorr_i]) >> 7;
|
||||
w = (w * wcorr[wcorr_i] + 63) >> 7; /*+ 63 for rounding*/
|
||||
int32_t w_half0 = w >> 1;
|
||||
int32_t w_half1 = w_half0 + (w & 0x1); /*Compensate rounding error*/
|
||||
|
||||
|
@ -133,7 +133,6 @@ typedef enum {
|
||||
#endif
|
||||
#if LV_USE_TEXTAREA
|
||||
LV_THEME_TEXTAREA,
|
||||
LV_THEME_TEXTAREA_ONELINE,
|
||||
#endif
|
||||
#if LV_USE_TILEVIEW
|
||||
LV_THEME_TILEVIEW,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,17 +20,21 @@ extern "C" {
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_THEME_MATERIAL_FLAG_NONE 0
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef enum {
|
||||
LV_THEME_MATERIAL_PALETTE_LIGHT,
|
||||
LV_THEME_MATERIAL_PALETTE_DARK,
|
||||
}lv_theme_material_palette_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the default
|
||||
* @param color_primary the primary color of the theme
|
||||
|
@ -828,24 +828,6 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_tight);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_TEXTAREA_ONELINE:
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_tight);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
|
@ -635,19 +635,22 @@ void lv_dropdown_open(lv_obj_t * ddlist, lv_anim_enable_t anim)
|
||||
else if(ext->dir == LV_DROPDOWN_DIR_RIGHT)lv_obj_align(ext->page, ddlist, LV_ALIGN_OUT_RIGHT_TOP, 0, 0);
|
||||
|
||||
lv_obj_t * scr = lv_scr_act();
|
||||
bool moved = false;
|
||||
if(ext->dir != LV_DROPDOWN_DIR_UP) {
|
||||
if(ext->page->coords.y2 > scr->coords.y2) {
|
||||
lv_obj_set_y(ext->page, lv_obj_get_y(ext->page) - (ext->page->coords.y2 - scr->coords.y2));
|
||||
moved = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(ext->page->coords.y1 < 0) {
|
||||
lv_obj_set_y(ext->page, 0);
|
||||
moved = true;
|
||||
}
|
||||
}
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
if(anim == LV_ANIM_ON && ext->dir != LV_DROPDOWN_DIR_UP) {
|
||||
if(anim == LV_ANIM_ON && ext->dir != LV_DROPDOWN_DIR_UP && !moved) {
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, ddlist);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* @file lv_gauge.c
|
||||
*
|
||||
*/
|
||||
@ -27,7 +27,7 @@
|
||||
#define LV_GAUGE_DEF_NEEDLE_COLOR LV_COLOR_RED
|
||||
#define LV_GAUGE_DEF_LABEL_COUNT 6
|
||||
#define LV_GAUGE_DEF_LINE_COUNT 21 /*Should be: ((label_cnt - 1) * internal_lines) + 1*/
|
||||
#define LV_GAUGE_DEF_ANGLE 220
|
||||
#define LV_GAUGE_DEF_ANGLE 270
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
|
@ -73,8 +73,8 @@ lv_obj_t * lv_linemeter_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->min_value = 0;
|
||||
ext->max_value = 100;
|
||||
ext->cur_value = 0;
|
||||
ext->line_cnt = 21; /*Odd scale number looks better*/
|
||||
ext->scale_angle = 240; /*(scale_num - 1) * N looks better */
|
||||
ext->line_cnt = 18;
|
||||
ext->scale_angle = 240;
|
||||
ext->angle_ofs = 0;
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
|
@ -43,7 +43,8 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void lv_page_sb_refresh(lv_obj_t * page);
|
||||
static void scrlbar_refresh(lv_obj_t * page);
|
||||
static void scrl_reposition(lv_obj_t * page);
|
||||
static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param);
|
||||
static lv_style_list_t * lv_page_get_style(lv_obj_t * page, uint8_t part);
|
||||
@ -152,7 +153,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
|
||||
lv_page_sb_refresh(page);
|
||||
scrlbar_refresh(page);
|
||||
|
||||
LV_LOG_INFO("page created");
|
||||
|
||||
@ -199,7 +200,7 @@ void lv_page_set_scrlbar_mode(lv_obj_t * page, lv_scrlbar_mode_t sb_mode)
|
||||
ext->scrlbar.hor_draw = 0;
|
||||
ext->scrlbar.ver_draw = 0;
|
||||
|
||||
lv_page_sb_refresh(page);
|
||||
scrlbar_refresh(page);
|
||||
lv_obj_invalidate(page);
|
||||
}
|
||||
|
||||
@ -807,14 +808,12 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
ext->scrl->signal_cb(ext->scrl, LV_SIGNAL_COORD_CHG, &ext->scrl->coords);
|
||||
|
||||
lv_style_int_t sb_width = lv_obj_get_style_size(page, LV_PAGE_PART_SCRLBAR);
|
||||
lv_area_set_height(&ext->scrlbar.hor_area, sb_width);
|
||||
lv_area_set_width(&ext->scrlbar.ver_area, sb_width);
|
||||
|
||||
/*The scrollbars are important only if they are visible now*/
|
||||
if(ext->scrlbar.hor_draw || ext->scrlbar.ver_draw) lv_page_sb_refresh(page);
|
||||
if(ext->scrlbar.hor_draw || ext->scrlbar.ver_draw) scrlbar_refresh(page);
|
||||
|
||||
/*Refresh the ext. size because the scrollbars might be positioned out of the page*/
|
||||
refr_ext_draw_pad(page);
|
||||
@ -827,7 +826,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
ext->scrl->signal_cb(ext->scrl, LV_SIGNAL_COORD_CHG, &ext->scrl->coords);
|
||||
|
||||
/*The scrollbars are important only if they are visible now*/
|
||||
if(ext->scrlbar.hor_draw || ext->scrlbar.ver_draw) lv_page_sb_refresh(page);
|
||||
if(ext->scrlbar.hor_draw || ext->scrlbar.ver_draw) scrlbar_refresh(page);
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
|
||||
@ -893,17 +892,6 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
|
||||
lv_page_ext_t * page_ext = lv_obj_get_ext_attr(page);
|
||||
|
||||
if(sign == LV_SIGNAL_COORD_CHG) {
|
||||
/*Limit the position of the scrollable object to be always visible
|
||||
* (Do not let its edge inner then its parent respective edge)*/
|
||||
lv_coord_t new_x = lv_obj_get_x(scrl);
|
||||
lv_coord_t new_y = lv_obj_get_y(scrl);
|
||||
bool refr_x = false;
|
||||
bool refr_y = false;
|
||||
lv_area_t page_coords;
|
||||
lv_area_t scrl_coords;
|
||||
lv_obj_get_coords(scrl, &scrl_coords);
|
||||
lv_obj_get_coords(page, &page_coords);
|
||||
|
||||
lv_obj_t * page_parent = lv_obj_get_parent(page);
|
||||
|
||||
/*Handle scroll propagation*/
|
||||
@ -933,64 +921,14 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
|
||||
}
|
||||
}
|
||||
|
||||
lv_style_int_t left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG);
|
||||
lv_style_int_t right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG);
|
||||
lv_style_int_t top = lv_obj_get_style_pad_top(page, LV_PAGE_PART_BG);
|
||||
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_BG);
|
||||
|
||||
/*scrollable width smaller then page width? -> align to left*/
|
||||
if(lv_area_get_width(&scrl_coords) + left + right <= lv_area_get_width(&page_coords)) {
|
||||
if(scrl_coords.x1 != page_coords.x1 + left) {
|
||||
new_x = left;
|
||||
refr_x = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*The edges of the scrollable can not be in the page (minus hpad) */
|
||||
if(scrl_coords.x2 < page_coords.x2 - right) {
|
||||
new_x = lv_area_get_width(&page_coords) - lv_area_get_width(&scrl_coords) - right; /* Right align */
|
||||
refr_x = true;
|
||||
lv_page_start_edge_flash(page, LV_PAGE_EDGE_RIGHT);
|
||||
}
|
||||
else if(scrl_coords.x1 > page_coords.x1 + left) {
|
||||
new_x = left; /*Left align*/
|
||||
refr_x = true;
|
||||
lv_page_start_edge_flash(page, LV_PAGE_EDGE_LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
/*scrollable height smaller then page height? -> align to top*/
|
||||
if(lv_area_get_height(&scrl_coords) + top + bottom <= lv_area_get_height(&page_coords)) {
|
||||
if(scrl_coords.y1 != page_coords.y1 + top) {
|
||||
new_y = top;
|
||||
refr_y = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*The edges of the scrollable can not be in the page (minus vpad) */
|
||||
if(scrl_coords.y2 < page_coords.y2 - bottom) {
|
||||
new_y = lv_area_get_height(&page_coords) - lv_area_get_height(&scrl_coords) - bottom; /* Bottom align */
|
||||
refr_y = true;
|
||||
lv_page_start_edge_flash(page, LV_PAGE_EDGE_BOTTOM);
|
||||
}
|
||||
else if(scrl_coords.y1 > page_coords.y1 + top) {
|
||||
new_y = top; /*Top align*/
|
||||
refr_y = true;
|
||||
lv_page_start_edge_flash(page, LV_PAGE_EDGE_TOP);
|
||||
}
|
||||
}
|
||||
|
||||
if(refr_x || refr_y) {
|
||||
lv_obj_set_pos(scrl, new_x, new_y);
|
||||
}
|
||||
|
||||
lv_page_sb_refresh(page);
|
||||
scrl_reposition(page);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
scrl_reposition(page);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_DRAG_BEGIN) {
|
||||
if(page_ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG) {
|
||||
page_ext->scrlbar.ver_draw = 1;
|
||||
page_ext->scrlbar.hor_draw = 1;
|
||||
lv_obj_invalidate(page);
|
||||
scrlbar_refresh(page);
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_DRAG_END) {
|
||||
@ -1126,12 +1064,78 @@ static lv_style_list_t * lv_page_get_style(lv_obj_t * page, uint8_t part)
|
||||
return style_dsc_p;
|
||||
}
|
||||
|
||||
static void scrl_reposition(lv_obj_t * page)
|
||||
{
|
||||
/*Limit the position of the scrollable object to be always visible
|
||||
* (Do not let its edge inner then its parent respective edge)*/
|
||||
lv_obj_t * scrl = lv_page_get_scrl(page);
|
||||
lv_coord_t new_x = lv_obj_get_x(scrl);
|
||||
lv_coord_t new_y = lv_obj_get_y(scrl);
|
||||
bool refr_x = false;
|
||||
bool refr_y = false;
|
||||
lv_area_t page_coords;
|
||||
lv_area_t scrl_coords;
|
||||
lv_obj_get_coords(scrl, &scrl_coords);
|
||||
lv_obj_get_coords(page, &page_coords);
|
||||
|
||||
lv_style_int_t left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG);
|
||||
lv_style_int_t right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG);
|
||||
lv_style_int_t top = lv_obj_get_style_pad_top(page, LV_PAGE_PART_BG);
|
||||
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_BG);
|
||||
|
||||
/*scrollable width smaller then page width? -> align to left*/
|
||||
if(lv_area_get_width(&scrl_coords) + left + right <= lv_area_get_width(&page_coords)) {
|
||||
if(scrl_coords.x1 != page_coords.x1 + left) {
|
||||
new_x = left;
|
||||
refr_x = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*The edges of the scrollable can not be in the page (minus hpad) */
|
||||
if(scrl_coords.x2 < page_coords.x2 - right) {
|
||||
new_x = lv_area_get_width(&page_coords) - lv_area_get_width(&scrl_coords) - right; /* Right align */
|
||||
refr_x = true;
|
||||
lv_page_start_edge_flash(page, LV_PAGE_EDGE_RIGHT);
|
||||
}
|
||||
else if(scrl_coords.x1 > page_coords.x1 + left) {
|
||||
new_x = left; /*Left align*/
|
||||
refr_x = true;
|
||||
lv_page_start_edge_flash(page, LV_PAGE_EDGE_LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
/*scrollable height smaller then page height? -> align to top*/
|
||||
if(lv_area_get_height(&scrl_coords) + top + bottom <= lv_area_get_height(&page_coords)) {
|
||||
if(scrl_coords.y1 != page_coords.y1 + top) {
|
||||
new_y = top;
|
||||
refr_y = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*The edges of the scrollable can not be in the page (minus vpad) */
|
||||
if(scrl_coords.y2 < page_coords.y2 - bottom) {
|
||||
new_y = lv_area_get_height(&page_coords) - lv_area_get_height(&scrl_coords) - bottom; /* Bottom align */
|
||||
refr_y = true;
|
||||
lv_page_start_edge_flash(page, LV_PAGE_EDGE_BOTTOM);
|
||||
}
|
||||
else if(scrl_coords.y1 > page_coords.y1 + top) {
|
||||
new_y = top; /*Top align*/
|
||||
refr_y = true;
|
||||
lv_page_start_edge_flash(page, LV_PAGE_EDGE_TOP);
|
||||
}
|
||||
}
|
||||
|
||||
if(refr_x || refr_y) {
|
||||
lv_obj_set_pos(scrl, new_x, new_y);
|
||||
}
|
||||
scrlbar_refresh(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the position and size of the scroll bars.
|
||||
* @param page pointer to a page object
|
||||
*/
|
||||
static void lv_page_sb_refresh(lv_obj_t * page)
|
||||
static void scrlbar_refresh(lv_obj_t * page)
|
||||
{
|
||||
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
|
||||
lv_obj_t * scrl = ext->scrl;
|
||||
@ -1183,10 +1187,19 @@ static void lv_page_sb_refresh(lv_obj_t * page)
|
||||
lv_obj_invalidate_area(page, &sb_area_tmp);
|
||||
}
|
||||
|
||||
if(ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG && lv_indev_is_dragging(lv_indev_get_act()) == false) {
|
||||
ext->scrlbar.hor_draw = 0;
|
||||
ext->scrlbar.ver_draw = 0;
|
||||
return;
|
||||
if(ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG) {
|
||||
lv_obj_t * indev_obj = lv_indev_get_obj_act();
|
||||
|
||||
if(indev_obj == NULL) return;
|
||||
while(indev_obj && lv_obj_get_drag_parent(indev_obj)) {
|
||||
indev_obj = lv_obj_get_parent(indev_obj);
|
||||
}
|
||||
|
||||
if(indev_obj != scrl) {
|
||||
ext->scrlbar.hor_draw = 0;
|
||||
ext->scrlbar.ver_draw = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*Full sized horizontal scrollbar*/
|
||||
@ -1232,7 +1245,7 @@ static void lv_page_sb_refresh(lv_obj_t * page)
|
||||
(obj_h - size_tmp - 2 * sb_ver_pad)) /
|
||||
(scrl_h + bg_top + bg_bottom - obj_h));
|
||||
|
||||
if(ext->scrlbar.mode == LV_SCRLBAR_MODE_AUTO) ext->scrlbar.ver_draw = 1;
|
||||
if(ext->scrlbar.mode == LV_SCRLBAR_MODE_AUTO || ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG) ext->scrlbar.ver_draw = 1;
|
||||
}
|
||||
|
||||
/*Invalidate the new scrollbar areas*/
|
||||
|
@ -89,7 +89,7 @@ lv_obj_t * lv_switch_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_click(sw, true);
|
||||
lv_obj_add_protect(sw, LV_PROTECT_PRESS_LOST);
|
||||
lv_obj_set_size(sw, LV_DPI / 2, LV_DPI / 4);
|
||||
lv_obj_set_size(sw, 4 * LV_DPI / 10, LV_DPI / 4);
|
||||
lv_bar_set_range(sw, 0, 1);
|
||||
|
||||
lv_theme_apply(sw, LV_THEME_SWITCH);
|
||||
|
Loading…
x
Reference in New Issue
Block a user