diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index 5bcbee6f34..09f7b1f3f4 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -112,7 +112,7 @@ void lv_init(void) /*Init. the sstyles*/ // lv_style_built_in_init(); - lv_theme_t * th = lv_theme_alien_init(0, NULL); + lv_theme_t * th = lv_theme_default_init(0, NULL); lv_theme_set_act(th); /*Initialize the screen refresh system*/ @@ -3049,15 +3049,15 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param) #if LV_USE_GROUP else if(sign == LV_SIGNAL_FOCUS) { if(lv_group_get_editing(lv_obj_get_group(obj))) { - uint8_t state = LV_STATE_FOCUS; - state |= LV_STATE_EDIT; + uint8_t state = LV_STATE_FOCUSED; + state |= LV_STATE_EDITED; lv_obj_add_state(obj, state); } else { - lv_obj_add_state(obj, LV_STATE_FOCUS); - lv_obj_clear_state(obj, LV_STATE_EDIT); + lv_obj_add_state(obj, LV_STATE_FOCUSED); + lv_obj_clear_state(obj, LV_STATE_EDITED); } } else if(sign == LV_SIGNAL_DEFOCUS) { - lv_obj_clear_state(obj, LV_STATE_FOCUS | LV_STATE_EDIT); + lv_obj_clear_state(obj, LV_STATE_FOCUSED | LV_STATE_EDITED); } #endif else if(sign == LV_SIGNAL_CLEANUP) { diff --git a/src/lv_core/lv_obj.h b/src/lv_core/lv_obj.h index f9dc47f255..9d3788335a 100644 --- a/src/lv_core/lv_obj.h +++ b/src/lv_core/lv_obj.h @@ -179,11 +179,11 @@ enum { typedef uint8_t lv_protect_t; enum { - LV_STATE_NORMAL = 0x00, + LV_STATE_NORMAL = 0x00, LV_STATE_CHECKED = 0x01, - LV_STATE_FOCUS = 0x02, - LV_STATE_EDIT = 0x04, - LV_STATE_HOVER = 0x08, + LV_STATE_FOCUSED = 0x02, + LV_STATE_EDITED = 0x04, + LV_STATE_HOVERED = 0x08, LV_STATE_PRESSED = 0x10, LV_STATE_DISABLED = 0x20, }; @@ -210,7 +210,6 @@ typedef struct _lv_obj_t void * ext_attr; /**< Object type specific extended data*/ lv_style_list_t style_list; - #if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY uint8_t ext_click_pad_hor; /**< Extra click padding in horizontal direction */ uint8_t ext_click_pad_ver; /**< Extra click padding in vertical direction */ @@ -229,7 +228,7 @@ typedef struct _lv_obj_t uint8_t top :1; /**< 1: If the object or its children is clicked it goes to the foreground*/ uint8_t parent_event :1; /**< 1: Send the object's events to the parent too. */ uint8_t adv_hittest :1; /**< 1: Use advanced hit-testing (slower) */ - uint8_t gesture_parent : 1; /**< 1: Parent will be gesture instead*/ + uint8_t gesture_parent : 1; /**< 1: Parent will be gesture instead*/ lv_drag_dir_t drag_dir :2; /**< Which directions the object can be dragged in */ lv_bidi_dir_t base_dir :2; /**< Base direction of texts related to this object */ diff --git a/src/lv_objx/lv_btnmatrix.c b/src/lv_objx/lv_btnmatrix.c index 8d9e32322a..0e1d767515 100644 --- a/src/lv_objx/lv_btnmatrix.c +++ b/src/lv_objx/lv_btnmatrix.c @@ -693,7 +693,7 @@ static lv_design_res_t lv_btnmatrix_design(lv_obj_t * btnm, const lv_area_t * cl btnm->state_dsc.act = LV_STATE_NORMAL; if(tgl_state) btnm->state_dsc.act = LV_STATE_CHECKED; if(ext->btn_id_pr == btn_i) btnm->state_dsc.act |= LV_STATE_PRESSED; - if(ext->btn_id_focused == btn_i) btnm->state_dsc.act |= LV_STATE_FOCUS; + if(ext->btn_id_focused == btn_i) btnm->state_dsc.act |= LV_STATE_FOCUSED; btnm->state_dsc.prev = btnm->state_dsc.act; lv_draw_rect_dsc_init(&draw_rect_tmp_dsc); diff --git a/src/lv_objx/lv_calendar.c b/src/lv_objx/lv_calendar.c index 0b3aff8c84..0fe0deb536 100644 --- a/src/lv_objx/lv_calendar.c +++ b/src/lv_objx/lv_calendar.c @@ -865,7 +865,7 @@ static void draw_dates(lv_obj_t * calendar, const lv_area_t * clip_area) day_state |= LV_STATE_CHECKED; } if(month_of_today_shown && day_cnt == ext->today.day && draw_state == DAY_DRAW_ACT_MONTH) { - day_state |= LV_STATE_FOCUS; + day_state |= LV_STATE_FOCUSED; } if(prev_state != day_state) { diff --git a/src/lv_objx/lv_checkbox.c b/src/lv_objx/lv_checkbox.c index dddfb7bf5e..60c3f20d0f 100644 --- a/src/lv_objx/lv_checkbox.c +++ b/src/lv_objx/lv_checkbox.c @@ -78,7 +78,7 @@ lv_obj_t * lv_checkbox_create(lv_obj_t * par, const lv_obj_t * copy) ext->label = lv_label_create(cb, NULL); lv_checkbox_set_text(cb, "Check box"); - lv_btn_set_layout(cb, LV_LAYOUT_ROW_M); + lv_btn_set_layout(cb, LV_LAYOUT_ROW_MID); lv_btn_set_fit(cb, LV_FIT_TIGHT); lv_btn_set_checkable(cb, true); lv_obj_set_protect(cb, LV_PROTECT_PRESS_LOST); diff --git a/src/lv_objx/lv_cont.c b/src/lv_objx/lv_cont.c index f48fb47a60..746ffe8e51 100644 --- a/src/lv_objx/lv_cont.c +++ b/src/lv_objx/lv_cont.c @@ -317,9 +317,9 @@ static void lv_cont_refr_layout(lv_obj_t * cont) if(type == LV_LAYOUT_CENTER) { lv_cont_layout_center(cont); - } else if(type == LV_LAYOUT_COL_L || type == LV_LAYOUT_COL_M || type == LV_LAYOUT_COL_R) { + } else if(type == LV_LAYOUT_COLUMN_LEFT || type == LV_LAYOUT_COLUMN_MID || type == LV_LAYOUT_COLUMN_RIGHT) { lv_cont_layout_col(cont); - } else if(type == LV_LAYOUT_ROW_T || type == LV_LAYOUT_ROW_M || type == LV_LAYOUT_ROW_B) { + } else if(type == LV_LAYOUT_ROW_TOP || type == LV_LAYOUT_ROW_MID || type == LV_LAYOUT_ROW_BOTTOM) { lv_cont_layout_row(cont); } else if(type == LV_LAYOUT_PRETTY) { lv_cont_layout_pretty(cont); @@ -347,15 +347,15 @@ static void lv_cont_layout_col(lv_obj_t * cont) lv_coord_t hpad_corr; switch(type) { - case LV_LAYOUT_COL_L: + case LV_LAYOUT_COLUMN_LEFT: hpad_corr = left; align = LV_ALIGN_IN_TOP_LEFT; break; - case LV_LAYOUT_COL_M: + case LV_LAYOUT_COLUMN_MID: hpad_corr = 0; align = LV_ALIGN_IN_TOP_MID; break; - case LV_LAYOUT_COL_R: + case LV_LAYOUT_COLUMN_RIGHT: hpad_corr = -right; align = LV_ALIGN_IN_TOP_RIGHT; break; @@ -396,15 +396,15 @@ static void lv_cont_layout_row(lv_obj_t * cont) lv_coord_t vpad_corr; lv_bidi_dir_t base_dir = lv_obj_get_base_dir(cont); switch(type) { - case LV_LAYOUT_ROW_T: + case LV_LAYOUT_ROW_TOP: vpad_corr = lv_obj_get_style_pad_top(cont, LV_CONT_PART_MAIN); align = base_dir == LV_BIDI_DIR_RTL ? LV_ALIGN_IN_TOP_RIGHT : LV_ALIGN_IN_TOP_LEFT; break; - case LV_LAYOUT_ROW_M: + case LV_LAYOUT_ROW_MID: vpad_corr = 0; align = base_dir == LV_BIDI_DIR_RTL ? LV_ALIGN_IN_RIGHT_MID: LV_ALIGN_IN_LEFT_MID; break; - case LV_LAYOUT_ROW_B: + case LV_LAYOUT_ROW_BOTTOM: vpad_corr = -lv_obj_get_style_pad_bottom(cont, LV_CONT_PART_MAIN); align = base_dir == LV_BIDI_DIR_RTL ? LV_ALIGN_IN_BOTTOM_RIGHT: LV_ALIGN_IN_BOTTOM_LEFT; break; @@ -684,29 +684,29 @@ static void lv_cont_refr_autofit(lv_obj_t * cont) switch(ext->fit_left) { case LV_FIT_TIGHT: new_area.x1 = tight_area.x1; break; - case LV_FIT_FLOOD: new_area.x1 = flood_area.x1; break; - case LV_FIT_FILL: new_area.x1 = has_children ? LV_MATH_MIN(tight_area.x1, flood_area.x1) : flood_area.x1; break; + case LV_FIT_PARENT: new_area.x1 = flood_area.x1; break; + case LV_FIT_MAX: new_area.x1 = has_children ? LV_MATH_MIN(tight_area.x1, flood_area.x1) : flood_area.x1; break; default: break; } switch(ext->fit_right) { case LV_FIT_TIGHT: new_area.x2 = tight_area.x2; break; - case LV_FIT_FLOOD: new_area.x2 = flood_area.x2; break; - case LV_FIT_FILL: new_area.x2 = has_children ? LV_MATH_MAX(tight_area.x2, flood_area.x2) : flood_area.x2; break; + case LV_FIT_PARENT: new_area.x2 = flood_area.x2; break; + case LV_FIT_MAX: new_area.x2 = has_children ? LV_MATH_MAX(tight_area.x2, flood_area.x2) : flood_area.x2; break; default: break; } switch(ext->fit_top) { case LV_FIT_TIGHT: new_area.y1 = tight_area.y1; break; - case LV_FIT_FLOOD: new_area.y1 = flood_area.y1; break; - case LV_FIT_FILL: new_area.y1 = has_children ? LV_MATH_MIN(tight_area.y1, flood_area.y1) : flood_area.y1; break; + case LV_FIT_PARENT: new_area.y1 = flood_area.y1; break; + case LV_FIT_MAX: new_area.y1 = has_children ? LV_MATH_MIN(tight_area.y1, flood_area.y1) : flood_area.y1; break; default: break; } switch(ext->fit_bottom) { case LV_FIT_TIGHT: new_area.y2 = tight_area.y2; break; - case LV_FIT_FLOOD: new_area.y2 = flood_area.y2; break; - case LV_FIT_FILL: new_area.y2 = has_children ? LV_MATH_MAX(tight_area.y2, flood_area.y2) : flood_area.y2; break; + case LV_FIT_PARENT: new_area.y2 = flood_area.y2; break; + case LV_FIT_MAX: new_area.y2 = has_children ? LV_MATH_MAX(tight_area.y2, flood_area.y2) : flood_area.y2; break; default: break; } diff --git a/src/lv_objx/lv_cont.h b/src/lv_objx/lv_cont.h index c997bd453d..12dc809830 100644 --- a/src/lv_objx/lv_cont.h +++ b/src/lv_objx/lv_cont.h @@ -31,15 +31,15 @@ extern "C" { enum { LV_LAYOUT_OFF = 0, /**< No layout */ LV_LAYOUT_CENTER, /**< Center objects */ - LV_LAYOUT_COL_L, /**< Column left align*/ - LV_LAYOUT_COL_M, /**< Column middle align*/ - LV_LAYOUT_COL_R, /**< Column right align*/ - LV_LAYOUT_ROW_T, /**< Row top align*/ - LV_LAYOUT_ROW_M, /**< Row middle align*/ - LV_LAYOUT_ROW_B, /**< Row bottom align*/ + LV_LAYOUT_COLUMN_LEFT, /**< Column left align*/ + LV_LAYOUT_COLUMN_MID, /**< Column middle align*/ + LV_LAYOUT_COLUMN_RIGHT, /**< Column right align*/ + LV_LAYOUT_ROW_TOP, /**< Row top align*/ + LV_LAYOUT_ROW_MID, /**< Row middle align*/ + LV_LAYOUT_ROW_BOTTOM, /**< Row bottom align*/ LV_LAYOUT_PRETTY, /**< Put as many object as possible in row and begin a new row*/ LV_LAYOUT_GRID, /**< Align same-sized object into a grid*/ - _LV_LAYOUT_NUM + _LV_LAYOUT_LAST }; typedef uint8_t lv_layout_t; @@ -49,10 +49,10 @@ typedef uint8_t lv_layout_t; enum { LV_FIT_NONE, /**< Do not change the size automatically*/ LV_FIT_TIGHT, /**< Shrink wrap around the children */ - LV_FIT_FLOOD, /**< Align the size to the parent's edge*/ - LV_FIT_FILL, /**< Align the size to the parent's edge first but if there is an object out of it + LV_FIT_PARENT, /**< Align the size to the parent's edge*/ + LV_FIT_MAX, /**< Align the size to the parent's edge first but if there is an object out of it then get larger */ - _LV_FIT_NUM + _LV_FIT_LAST }; typedef uint8_t lv_fit_t; @@ -67,13 +67,12 @@ typedef struct lv_fit_t fit_bottom : 2; /*A fit type from `lv_fit_t` enum */ } lv_cont_ext_t; -/*Styles*/ +/*Part of the container*/ enum { LV_CONT_PART_MAIN = LV_OBJ_PART_MAIN, _LV_CONT_PART_VIRTUAL_LAST = _LV_OBJ_PART_VIRTUAL_LAST, _LV_CONT_PART_REAL_LAST = _LV_OBJ_PART_REAL_LAST, }; -typedef uint8_t lv_cont_part_t; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_objx/lv_list.c b/src/lv_objx/lv_list.c index 875629a909..223ee6882d 100644 --- a/src/lv_objx/lv_list.c +++ b/src/lv_objx/lv_list.c @@ -94,7 +94,7 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy) /*Init the new list object*/ if(copy == NULL) { lv_page_set_anim_time(list, LV_LIST_DEF_ANIM_TIME); - lv_page_set_scrl_fit2(list, LV_FIT_FLOOD, LV_FIT_TIGHT); + lv_page_set_scrl_fit2(list, LV_FIT_PARENT, LV_FIT_TIGHT); lv_obj_set_size(list, 2 * LV_DPI, 3 * LV_DPI); lv_page_set_scrl_layout(list, LV_LIST_LAYOUT_DEF); lv_list_set_sb_mode(list, LV_SB_MODE_DRAG); @@ -170,16 +170,16 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * t lv_theme_apply(btn, LV_THEME_LIST_BTN); lv_page_glue_obj(btn, true); - lv_btn_set_layout(btn, LV_LAYOUT_ROW_M); + lv_btn_set_layout(btn, LV_LAYOUT_ROW_MID); lv_layout_t list_layout = lv_list_get_layout(list); bool layout_ver = false; - if(list_layout == LV_LAYOUT_COL_M || list_layout == LV_LAYOUT_COL_L || list_layout == LV_LAYOUT_COL_R) { + if(list_layout == LV_LAYOUT_COLUMN_MID || list_layout == LV_LAYOUT_COLUMN_LEFT || list_layout == LV_LAYOUT_COLUMN_RIGHT) { layout_ver = true; } if(layout_ver) { - lv_btn_set_fit2(btn, LV_FIT_FLOOD, LV_FIT_TIGHT); + lv_btn_set_fit2(btn, LV_FIT_PARENT, LV_FIT_TIGHT); } else { lv_coord_t w = last_btn ? lv_obj_get_width(last_btn) : (LV_DPI * 3) / 2; lv_btn_set_fit2(btn, LV_FIT_NONE, LV_FIT_TIGHT); @@ -275,7 +275,7 @@ void lv_list_focus_btn(lv_obj_t * list, lv_obj_t * btn) lv_list_ext_t * ext = lv_obj_get_ext_attr(list); /*Defocus the current button*/ - if(ext->act_sel_btn) lv_obj_clear_state(ext->act_sel_btn, LV_STATE_FOCUS); + if(ext->act_sel_btn) lv_obj_clear_state(ext->act_sel_btn, LV_STATE_FOCUSED); /*Don't forget which button was selected. @@ -286,7 +286,7 @@ void lv_list_focus_btn(lv_obj_t * list, lv_obj_t * btn) ext->act_sel_btn = btn; if(ext->act_sel_btn) { - lv_obj_add_state(ext->act_sel_btn, LV_STATE_FOCUS); + lv_obj_add_state(ext->act_sel_btn, LV_STATE_FOCUSED); lv_page_focus(list, ext->act_sel_btn, LV_ANIM_ON); } } @@ -311,20 +311,20 @@ void lv_list_focus_btn(lv_obj_t * list, lv_obj_t * btn) /* Visit all buttons on the list and update their layout */ while(btn != NULL) { /*If a column layout set the buttons' width to list width*/ - if(layout == LV_LAYOUT_COL_M || layout == LV_LAYOUT_COL_L || layout == LV_LAYOUT_COL_R) { - lv_btn_set_fit2(btn, LV_FIT_FLOOD, LV_FIT_TIGHT); + if(layout == LV_LAYOUT_COLUMN_MID || layout == LV_LAYOUT_COLUMN_LEFT || layout == LV_LAYOUT_COLUMN_RIGHT) { + lv_btn_set_fit2(btn, LV_FIT_PARENT, LV_FIT_TIGHT); } /*If a row layout set the buttons' width according to the content*/ - else if (layout == LV_LAYOUT_ROW_M || layout == LV_LAYOUT_ROW_T || layout == LV_LAYOUT_ROW_B) { + else if (layout == LV_LAYOUT_ROW_MID || layout == LV_LAYOUT_ROW_TOP || layout == LV_LAYOUT_ROW_BOTTOM) { lv_btn_set_fit(btn, LV_FIT_TIGHT); } btn = lv_list_get_prev_btn(list, btn); } - if(layout == LV_LAYOUT_COL_M || layout == LV_LAYOUT_COL_L || layout == LV_LAYOUT_COL_R) { - lv_page_set_scrl_fit2(list, LV_FIT_FLOOD, LV_FIT_TIGHT); - } else if (layout == LV_LAYOUT_ROW_M || layout == LV_LAYOUT_ROW_T || layout == LV_LAYOUT_ROW_B) { + if(layout == LV_LAYOUT_COLUMN_MID || layout == LV_LAYOUT_COLUMN_LEFT || layout == LV_LAYOUT_COLUMN_RIGHT) { + lv_page_set_scrl_fit2(list, LV_FIT_PARENT, LV_FIT_TIGHT); + } else if (layout == LV_LAYOUT_ROW_MID || layout == LV_LAYOUT_ROW_TOP || layout == LV_LAYOUT_ROW_BOTTOM) { lv_page_set_scrl_fit2(list, LV_FIT_TIGHT, LV_FIT_TIGHT); lv_cont_set_fit2(list, LV_FIT_NONE, LV_FIT_TIGHT); } diff --git a/src/lv_objx/lv_msgbox.c b/src/lv_objx/lv_msgbox.c index 580320f99b..7de2713a0a 100644 --- a/src/lv_objx/lv_msgbox.c +++ b/src/lv_objx/lv_msgbox.c @@ -100,7 +100,7 @@ lv_obj_t * lv_msgbox_create(lv_obj_t * par, const lv_obj_t * copy) lv_label_set_long_mode(ext->text, LV_LABEL_LONG_BREAK); lv_label_set_text(ext->text, "Message"); - lv_cont_set_layout(mbox, LV_LAYOUT_COL_M); + lv_cont_set_layout(mbox, LV_LAYOUT_COLUMN_MID); lv_cont_set_fit2(mbox, LV_FIT_NONE, LV_FIT_TIGHT); lv_obj_set_width(mbox, LV_DPI * 2); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); diff --git a/src/lv_objx/lv_page.c b/src/lv_objx/lv_page.c index ad5a4e896e..37a9a4fe72 100644 --- a/src/lv_objx/lv_page.c +++ b/src/lv_objx/lv_page.c @@ -119,7 +119,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy) lv_obj_set_drag(ext->scrl, true); lv_obj_set_drag_throw(ext->scrl, true); lv_obj_set_protect(ext->scrl, LV_PROTECT_PARENT | LV_PROTECT_PRESS_LOST); - lv_cont_set_fit4(ext->scrl, LV_FIT_FILL, LV_FIT_FILL, LV_FIT_FILL, LV_FIT_FILL); + lv_cont_set_fit4(ext->scrl, LV_FIT_MAX, LV_FIT_MAX, LV_FIT_MAX, LV_FIT_MAX); lv_obj_set_event_cb(ext->scrl, scrl_def_event_cb); /*Propagate some event to the background object by default for convenience */ lv_obj_set_signal_cb(ext->scrl, lv_page_scrollable_signal); @@ -791,18 +791,18 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) /* Reposition the child to take padding into account (Only if it's on (0;0) or (widht;height) coordinates now) * It's required to keep new the object on the same coordinate if FIT is enabled.*/ if((tmp->coords.x1 == page->coords.x1) && - (fit_left == LV_FIT_TIGHT || fit_left == LV_FIT_FILL) && + (fit_left == LV_FIT_TIGHT || fit_left == LV_FIT_MAX) && base_dir != LV_BIDI_DIR_RTL) { tmp->coords.x1 += scrl_left; tmp->coords.x2 += scrl_left; } else if((tmp->coords.x2 == page->coords.x2) && - (fit_right == LV_FIT_TIGHT || fit_right == LV_FIT_FILL) + (fit_right == LV_FIT_TIGHT || fit_right == LV_FIT_MAX) && base_dir == LV_BIDI_DIR_RTL) { tmp->coords.x1 -= scrl_right; tmp->coords.x2 -= scrl_right; } - if((tmp->coords.y1 == page->coords.y1) && (fit_top == LV_FIT_TIGHT || fit_top == LV_FIT_FILL)) { + if((tmp->coords.y1 == page->coords.y1) && (fit_top == LV_FIT_TIGHT || fit_top == LV_FIT_MAX)) { tmp->coords.y1 += scrl_top; tmp->coords.y2 += scrl_top; } diff --git a/src/lv_objx/lv_roller.c b/src/lv_objx/lv_roller.c index cd53c642ee..683c2adf61 100644 --- a/src/lv_objx/lv_roller.c +++ b/src/lv_objx/lv_roller.c @@ -105,7 +105,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy) lv_obj_t * scrl = lv_page_get_scrl(roller); lv_obj_set_drag(scrl, true); /*In ddlist it might be disabled*/ - lv_page_set_scrl_fit2(roller, LV_FIT_FLOOD, LV_FIT_NONE); /*Height is specified directly*/ + lv_page_set_scrl_fit2(roller, LV_FIT_PARENT, LV_FIT_NONE); /*Height is specified directly*/ lv_roller_set_anim_time(roller, LV_ROLLER_DEF_ANIM_TIME); lv_roller_set_options(roller, "Option 1\nOption 2\nOption 3", LV_ROLLER_MODE_NORMAL); lv_roller_set_visible_row_count(roller, 3); diff --git a/src/lv_objx/lv_tabview.c b/src/lv_objx/lv_tabview.c index a9779c8097..4f1a918356 100644 --- a/src/lv_objx/lv_tabview.c +++ b/src/lv_objx/lv_tabview.c @@ -136,8 +136,8 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy) lv_obj_set_click(ext->indic, false); - lv_page_set_scrl_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_FLOOD); - lv_page_set_scrl_layout(ext->content, LV_LAYOUT_ROW_T); + lv_page_set_scrl_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_PARENT); + lv_page_set_scrl_layout(ext->content, LV_LAYOUT_ROW_TOP); lv_page_set_sb_mode(ext->content, LV_SB_MODE_OFF); lv_obj_set_drag_dir(lv_page_get_scrl(ext->content), LV_DRAG_DIR_ONE); diff --git a/src/lv_objx/lv_textarea.c b/src/lv_objx/lv_textarea.c index fef3db79e7..1f0da61965 100644 --- a/src/lv_objx/lv_textarea.c +++ b/src/lv_objx/lv_textarea.c @@ -135,7 +135,7 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy) /*Init the new text area object*/ if(copy == NULL) { - lv_page_set_scrl_fit2(ta, LV_FIT_FLOOD, LV_FIT_TIGHT); + lv_page_set_scrl_fit2(ta, LV_FIT_PARENT, LV_FIT_TIGHT); ext->label = lv_label_create(ta, NULL); @@ -741,7 +741,7 @@ void lv_textarea_set_one_line(lv_obj_t * ta, bool en) lv_coord_t font_h = lv_font_get_line_height(font); ext->one_line = 1; - lv_page_set_scrl_fit2(ta, LV_FIT_TIGHT, LV_FIT_FLOOD); + lv_page_set_scrl_fit2(ta, LV_FIT_TIGHT, LV_FIT_PARENT); lv_obj_set_height(ta, font_h + top + bottom); lv_label_set_long_mode(ext->label, LV_LABEL_LONG_EXPAND); if(ext->placeholder) lv_label_set_long_mode(ext->placeholder, LV_LABEL_LONG_EXPAND); @@ -750,7 +750,7 @@ void lv_textarea_set_one_line(lv_obj_t * ta, bool en) lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG); lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_BG); ext->one_line = 0; - lv_page_set_scrl_fit2(ta, LV_FIT_FLOOD, LV_FIT_TIGHT); + lv_page_set_scrl_fit2(ta, LV_FIT_PARENT, LV_FIT_TIGHT); lv_label_set_long_mode(ext->label, LV_LABEL_LONG_BREAK); if(ext->placeholder) lv_label_set_long_mode(ext->placeholder, LV_LABEL_LONG_BREAK); @@ -782,7 +782,7 @@ void lv_textarea_set_text_align(lv_obj_t * ta, lv_label_align_t align) /*Normal left align. Just let the text expand*/ if(align == LV_LABEL_ALIGN_LEFT) { lv_label_set_long_mode(label, LV_LABEL_LONG_EXPAND); - lv_page_set_scrl_fit2(ta, LV_FIT_TIGHT, LV_FIT_FLOOD); + lv_page_set_scrl_fit2(ta, LV_FIT_TIGHT, LV_FIT_PARENT); lv_label_set_align(label, align); if(ext->placeholder) lv_label_set_align(ext->placeholder, align); @@ -790,7 +790,7 @@ void lv_textarea_set_text_align(lv_obj_t * ta, lv_label_align_t align) /*Else use fix label width equal to the Text area width*/ else { lv_label_set_long_mode(label, LV_LABEL_LONG_CROP); - lv_page_set_scrl_fit2(ta, LV_FIT_FLOOD, LV_FIT_FLOOD); + lv_page_set_scrl_fit2(ta, LV_FIT_PARENT, LV_FIT_PARENT); lv_label_set_align(label, align); if(ext->placeholder) lv_label_set_align(ext->placeholder, align); diff --git a/src/lv_themes/lv_theme.h b/src/lv_themes/lv_theme.h index 9a15a0fd8a..928f11ac3e 100644 --- a/src/lv_themes/lv_theme.h +++ b/src/lv_themes/lv_theme.h @@ -142,14 +142,7 @@ lv_style_t * lv_theme_get_style_part(lv_theme_style_t name, uint8_t part); /********************** * POST INCLUDE *********************/ -#include "lv_theme_templ.h" -#include "lv_theme_default.h" -#include "lv_theme_alien.h" -#include "lv_theme_night.h" -#include "lv_theme_zen.h" -#include "lv_theme_mono.h" -#include "lv_theme_nemo.h" -#include "lv_theme_material.h" +#include "lv_theme_def.h" #ifdef __cplusplus } /* extern "C" */ diff --git a/src/lv_themes/lv_theme_def.c b/src/lv_themes/lv_theme_def.c index aab19a61ea..da9cc2ed66 100644 --- a/src/lv_themes/lv_theme_def.c +++ b/src/lv_themes/lv_theme_def.c @@ -165,7 +165,7 @@ static void basic_init(void) lv_style_set_image_recolor(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); lv_style_set_line_color(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); lv_style_set_line_width(&panel, LV_STATE_NORMAL, 1); - lv_style_set_border_color(&panel, LV_STATE_FOCUS, COLOR_ACCENT); + lv_style_set_border_color(&panel, LV_STATE_FOCUSED, COLOR_ACCENT); lv_style_set_transition_time(&panel, LV_STATE_NORMAL, 500); lv_style_init(&btn); @@ -186,9 +186,9 @@ static void basic_init(void) lv_style_set_pad_inner(&btn, LV_STATE_NORMAL, LV_DPI / 10); lv_style_set_transition_time(&btn, LV_STATE_NORMAL, 300); - lv_style_set_outline_width(&btn, LV_STATE_FOCUS, 3); - lv_style_set_outline_opa(&btn, LV_STATE_FOCUS, LV_OPA_50); - lv_style_set_outline_color(&btn, LV_STATE_FOCUS, COLOR_ACCENT); + lv_style_set_outline_width(&btn, LV_STATE_FOCUSED, 3); + lv_style_set_outline_opa(&btn, LV_STATE_FOCUSED, LV_OPA_50); + lv_style_set_outline_color(&btn, LV_STATE_FOCUSED, COLOR_ACCENT); } static void cont_init(void) @@ -219,9 +219,9 @@ static void bar_init(void) lv_style_set_radius(&bar_bg, LV_STATE_NORMAL, LV_RADIUS_CIRCLE); lv_style_set_bg_opa(&bar_bg, LV_STATE_NORMAL, LV_OPA_COVER); lv_style_set_bg_color(&bar_bg, LV_STATE_NORMAL, COLOR_BACKGROUND); - lv_style_set_outline_color(&bar_bg, LV_STATE_FOCUS, COLOR_ACCENT); - lv_style_set_outline_opa(&bar_bg, LV_STATE_FOCUS, LV_OPA_50); - lv_style_set_outline_width(&bar_bg, LV_STATE_FOCUS, 3); + lv_style_set_outline_color(&bar_bg, LV_STATE_FOCUSED, COLOR_ACCENT); + lv_style_set_outline_opa(&bar_bg, LV_STATE_FOCUSED, LV_OPA_50); + lv_style_set_outline_width(&bar_bg, LV_STATE_FOCUSED, 3); lv_style_init(&bar_indic); lv_style_set_bg_opa(&bar_indic, LV_STATE_NORMAL, LV_OPA_COVER); @@ -416,7 +416,7 @@ static void calendar_init(void) lv_style_init(&calendar_date_nums); lv_style_set_radius(&calendar_date_nums, LV_STATE_NORMAL, LV_DPI / 50); lv_style_set_text_color(&calendar_date_nums, LV_STATE_CHECKED, LV_COLOR_WHITE); - lv_style_set_text_color(&calendar_date_nums, LV_STATE_FOCUS, COLOR_ACCENT); + lv_style_set_text_color(&calendar_date_nums, LV_STATE_FOCUSED, COLOR_ACCENT); lv_style_set_bg_opa(&calendar_date_nums, LV_STATE_CHECKED , LV_OPA_20); lv_style_set_bg_opa(&calendar_date_nums, LV_STATE_PRESSED , LV_OPA_20); @@ -466,10 +466,10 @@ static void cb_init(void) // lv_style_set_pad_bottom(&cb_bg, LV_STATE_NORMAL, LV_DPI / 20); // lv_style_set_pad_top(&cb_bg, LV_STATE_NORMAL, LV_DPI / 20); lv_style_set_pad_inner(&cb_bg, LV_STATE_NORMAL , LV_DPI / 20); - lv_style_set_outline_color(&cb_bg, LV_STATE_FOCUS, COLOR_ACCENT); - lv_style_set_outline_opa(&cb_bg, LV_STATE_FOCUS, LV_OPA_50); - lv_style_set_outline_width(&cb_bg, LV_STATE_FOCUS, 3); - lv_style_set_outline_pad(&cb_bg, LV_STATE_FOCUS, LV_DPI/20); + lv_style_set_outline_color(&cb_bg, LV_STATE_FOCUSED, COLOR_ACCENT); + lv_style_set_outline_opa(&cb_bg, LV_STATE_FOCUSED, LV_OPA_50); + lv_style_set_outline_width(&cb_bg, LV_STATE_FOCUSED, 3); + lv_style_set_outline_pad(&cb_bg, LV_STATE_FOCUSED, LV_DPI/20); lv_style_init(&cb_bullet); lv_style_set_radius(&cb_bullet, LV_STATE_NORMAL, LV_DPI / 50); @@ -495,7 +495,7 @@ static void btnm_init(void) lv_style_set_clip_corner(&btnm_bg, LV_STATE_NORMAL, true); lv_style_set_border_post(&btnm_bg, LV_STATE_NORMAL, true); lv_style_set_bg_color(&btnm_bg, LV_STATE_NORMAL, COLOR_CONTAINER); - lv_style_set_border_color(&btnm_bg, LV_STATE_FOCUS, lv_color_hex3(0xf66)); + lv_style_set_border_color(&btnm_bg, LV_STATE_FOCUSED, lv_color_hex3(0xf66)); lv_style_init(&btnm_btn); lv_style_set_border_width(&btnm_btn, LV_STATE_NORMAL, LV_DPI / 70 > 0? LV_DPI / 70 : 1); @@ -507,7 +507,7 @@ static void btnm_init(void) lv_style_set_bg_color(&btnm_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(COLOR_ACCENT, LV_OPA_40)); lv_style_set_text_color(&btnm_btn, LV_STATE_NORMAL, LV_COLOR_WHITE); lv_style_set_text_color(&btnm_btn, LV_STATE_DISABLED , LV_COLOR_GRAY); - lv_style_set_text_color(&btnm_btn, LV_STATE_FOCUS, LV_COLOR_RED); + lv_style_set_text_color(&btnm_btn, LV_STATE_FOCUSED, LV_COLOR_RED); lv_style_set_bg_opa(&btnm_btn, LV_STATE_CHECKED, LV_OPA_COVER); lv_style_set_bg_opa(&btnm_btn, LV_STATE_PRESSED, LV_OPA_COVER); lv_style_set_bg_opa(&btnm_btn, LV_STATE_DISABLED, LV_OPA_COVER); @@ -602,8 +602,8 @@ static void list_init(void) lv_style_set_text_color(&list_btn, LV_STATE_NORMAL, lv_color_hex(0xffffff)); lv_style_set_text_color(&list_btn, LV_STATE_PRESSED, lv_color_darken(lv_color_hex(0xffffff), LV_OPA_20)); lv_style_set_text_color(&list_btn, LV_STATE_DISABLED, lv_color_hex(0x686b70)); - lv_style_set_text_color(&list_btn, LV_STATE_FOCUS, lv_color_hex(0xff0000)); - lv_style_set_text_color(&list_btn, LV_STATE_FOCUS| LV_STATE_PRESSED, lv_color_hex(0xffff00)); + lv_style_set_text_color(&list_btn, LV_STATE_FOCUSED, lv_color_hex(0xff0000)); + lv_style_set_text_color(&list_btn, LV_STATE_FOCUSED| LV_STATE_PRESSED, lv_color_hex(0xffff00)); lv_style_set_image_recolor(&list_btn, LV_STATE_NORMAL, LV_COLOR_WHITE); lv_style_set_image_recolor(&list_btn, LV_STATE_PRESSED, lv_color_darken(lv_color_hex(0xffffff), LV_OPA_20)); lv_style_set_border_opa(&list_btn, LV_STATE_NORMAL, LV_OPA_COVER); @@ -678,7 +678,7 @@ static void tabview_init(void) lv_style_set_bg_opa(&tabview_btns, LV_STATE_PRESSED, LV_OPA_COVER); lv_style_set_bg_color(&tabview_btns, LV_STATE_PRESSED, lv_color_hex(0x444444)); lv_style_set_text_color(&tabview_btns, LV_STATE_CHECKED, COLOR_ACCENT); - lv_style_set_text_color(&tabview_btns, LV_STATE_FOCUS, LV_COLOR_RED); + lv_style_set_text_color(&tabview_btns, LV_STATE_FOCUSED, LV_COLOR_RED); lv_style_set_pad_top(&tabview_btns, LV_STATE_NORMAL, LV_DPI / 5); lv_style_set_pad_bottom(&tabview_btns, LV_STATE_NORMAL, LV_DPI / 5); @@ -736,7 +736,7 @@ static void win_init(void) * @param hue [0..360] hue value from HSV color space to define the theme's base color * @param font pointer to a font (NULL to use the default) */ -lv_theme_t * lv_theme_alien_init(uint16_t hue, lv_font_t * font) +lv_theme_t * lv_theme_default_init(uint16_t hue, lv_font_t * font) { lv_mem_monitor_t mon1; diff --git a/src/lv_themes/lv_theme_def.h b/src/lv_themes/lv_theme_def.h index 250fa8be4c..7ebf3437c3 100644 --- a/src/lv_themes/lv_theme_def.h +++ b/src/lv_themes/lv_theme_def.h @@ -34,7 +34,7 @@ extern "C" { * @param hue [0..360] hue value from HSV color space to define the theme's base color * @param font pointer to a font (NULL to use the default) */ -lv_theme_t * lv_theme_alien_init(uint16_t hue, lv_font_t * font); +lv_theme_t * lv_theme_default_init(uint16_t hue, lv_font_t * font); lv_theme_t * lv_theme_alien_get(void); lv_style_t * lv_theme_alien_get_style_part(lv_theme_style_t name, uint8_t part);