minor fixes and renames

This commit is contained in:
Gabor Kiss-Vamosi
2020-03-04 16:29:21 +01:00
parent 4afd47e5ab
commit 4e10efd642
15 changed files with 54 additions and 51 deletions

View File

@@ -66,7 +66,7 @@ static inline bool lv_dropdown_get_draw_arrow(lv_obj_t * ddlist)
static inline void lv_bar_set_sym(lv_obj_t * bar, bool en)
{
if(en)
lv_bar_set_type(bar, LV_BAR_TYPE_SYM);
lv_bar_set_type(bar, LV_BAR_TYPE_SYMMETRICAL);
else
lv_bar_set_type(bar, LV_BAR_TYPE_NORMAL);
}
@@ -79,7 +79,7 @@ static inline void lv_bar_set_sym(lv_obj_t * bar, bool en)
*/
static inline bool lv_bar_get_sym(lv_obj_t * bar)
{
return lv_bar_get_type(bar) == LV_BAR_TYPE_SYM;
return lv_bar_get_type(bar) == LV_BAR_TYPE_SYMMETRICAL;
}
#endif

View File

@@ -1016,8 +1016,8 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
lv_style_list_add_style(list, &arc_bg);
lv_obj_clean_style_list(obj, LV_ARC_PART_ARC);
list = lv_obj_get_style_list(obj, LV_ARC_PART_ARC);
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
lv_style_list_add_style(list, &arc);
break;
#endif

View File

@@ -528,8 +528,8 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
lv_style_list_add_style(list, &style_tick_line);
lv_style_list_add_style(list, &style_round);
lv_obj_clean_style_list(obj, LV_ARC_PART_ARC);
list = lv_obj_get_style_list(obj, LV_ARC_PART_ARC);
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
lv_style_list_add_style(list, &style_bg);
lv_style_list_add_style(list, &style_color);
lv_style_list_add_style(list, &style_tick_line);

View File

@@ -368,13 +368,13 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
lv_draw_rect(&arc->coords, clip_area, &bg_dsc);
lv_coord_t left = lv_obj_get_style_pad_left(arc, LV_ARC_PART_BG);
lv_coord_t right = lv_obj_get_style_pad_right(arc, LV_ARC_PART_BG);
lv_coord_t top = lv_obj_get_style_pad_top(arc, LV_ARC_PART_BG);
lv_coord_t bottom = lv_obj_get_style_pad_bottom(arc, LV_ARC_PART_BG);
lv_coord_t r = (LV_MATH_MIN(lv_obj_get_width(arc) - left - right, lv_obj_get_height(arc) - top - bottom)) / 2;
lv_coord_t x = arc->coords.x1 + r + left;
lv_coord_t y = arc->coords.y1 + r + top;
lv_coord_t left_bg = lv_obj_get_style_pad_left(arc, LV_ARC_PART_BG);
lv_coord_t right_bg = lv_obj_get_style_pad_right(arc, LV_ARC_PART_BG);
lv_coord_t top_bg = lv_obj_get_style_pad_top(arc, LV_ARC_PART_BG);
lv_coord_t bottom_bg = lv_obj_get_style_pad_bottom(arc, LV_ARC_PART_BG);
lv_coord_t r = (LV_MATH_MIN(lv_obj_get_width(arc) - left_bg - right_bg, lv_obj_get_height(arc) - top_bg - bottom_bg)) / 2;
lv_coord_t x = arc->coords.x1 + r + left_bg;
lv_coord_t y = arc->coords.y1 + r + top_bg;
lv_draw_line_dsc_t arc_dsc;
lv_draw_line_dsc_init(&arc_dsc);
@@ -383,7 +383,14 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
lv_draw_arc(x, y, r, ext->bg_angle_start, ext->bg_angle_end, clip_area, &arc_dsc);
lv_draw_line_dsc_init(&arc_dsc);
lv_obj_init_draw_line_dsc(arc, LV_ARC_PART_ARC, &arc_dsc);
lv_obj_init_draw_line_dsc(arc, LV_ARC_PART_INDIC, &arc_dsc);
/*make the indicator arc smaller or larger according to its greatest padding value*/
lv_coord_t left_indic = lv_obj_get_style_pad_left(arc, LV_ARC_PART_INDIC);
lv_coord_t right_indic = lv_obj_get_style_pad_right(arc, LV_ARC_PART_INDIC);
lv_coord_t top_indic = lv_obj_get_style_pad_top(arc, LV_ARC_PART_INDIC);
lv_coord_t bottom_indic = lv_obj_get_style_pad_bottom(arc, LV_ARC_PART_INDIC);
r-= LV_MATH_MAX4(left_indic, right_indic, top_indic, bottom_indic);
lv_draw_arc(x, y, r, ext->arc_angle_start, ext->arc_angle_end, clip_area, &arc_dsc);
}
@@ -418,7 +425,7 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_CLEANUP) {
lv_obj_clean_style_list(arc, LV_ARC_PART_ARC);
lv_obj_clean_style_list(arc, LV_ARC_PART_INDIC);
}
return res;
@@ -442,7 +449,7 @@ static lv_style_list_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part)
case LV_ARC_PART_BG:
style_dsc_p = &arc->style_list;
break;
case LV_ARC_PART_ARC:
case LV_ARC_PART_INDIC:
style_dsc_p = &ext->style_arc;
break;
default:
@@ -467,8 +474,8 @@ static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angl
lv_coord_t rout = (LV_MATH_MIN(lv_obj_get_width(arc) - left - right, lv_obj_get_height(arc) - top - bottom)) / 2;
lv_coord_t x = arc->coords.x1 + rout + left;
lv_coord_t y = arc->coords.y1 + rout + top;
lv_style_int_t w = lv_obj_get_style_line_width(arc, LV_ARC_PART_ARC);
lv_style_int_t rounded = lv_obj_get_style_line_rounded(arc, LV_ARC_PART_ARC);
lv_style_int_t w = lv_obj_get_style_line_width(arc, LV_ARC_PART_INDIC);
lv_style_int_t rounded = lv_obj_get_style_line_rounded(arc, LV_ARC_PART_INDIC);
lv_coord_t rin = rout - w;
lv_coord_t extra_area = rounded ? w / 2 + 2 : 0;

View File

@@ -39,7 +39,7 @@ typedef struct {
/*Parts of the arc*/
enum {
LV_ARC_PART_BG = LV_OBJ_PART_MAIN,
LV_ARC_PART_ARC,
LV_ARC_PART_INDIC,
_LV_ARC_PART_VIRTUAL_LAST,
_LV_ARC_PART_REAL_LAST = _LV_OBJ_PART_REAL_LAST,

View File

@@ -412,7 +412,7 @@ static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area)
int32_t range = ext->max_value - ext->min_value;
bool hor = objw >= objh ? true : false;
bool sym = false;
if(ext->type == LV_BAR_TYPE_SYM && ext->min_value < 0 && ext->max_value > 0 &&
if(ext->type == LV_BAR_TYPE_SYMMETRICAL && ext->min_value < 0 && ext->max_value > 0 &&
ext->start_value == ext->min_value) sym = true;
/*Calculate the indicator area*/

View File

@@ -45,7 +45,7 @@ extern "C" {
enum {
LV_BAR_TYPE_NORMAL,
LV_BAR_TYPE_SYM,
LV_BAR_TYPE_SYMMETRICAL,
LV_BAR_TYPE_CUSTOM
};
typedef uint8_t lv_bar_type_t;

View File

@@ -95,7 +95,7 @@ lv_obj_t * lv_btnmatrix_create(lv_obj_t * par, const lv_obj_t * copy)
ext->ctrl_bits = NULL;
ext->map_p = NULL;
ext->recolor = 0;
ext->one_toggle = 0;
ext->one_check = 0;
lv_style_list_init(&ext->style_btn);
ext->style_btn.ignore_trans = 1;
@@ -406,19 +406,17 @@ void lv_btnmatrix_set_btn_width(lv_obj_t * btnm, uint16_t btn_id, uint8_t width)
/**
* Make the button matrix like a selector widget (only one button may be toggled at a time).
*
* Toggling must be enabled on the buttons you want to be selected with `lv_btnmatrix_set_ctrl` or
* `Checkable` must be enabled on the buttons you want to be selected with `lv_btnmatrix_set_ctrl` or
* `lv_btnmatrix_set_btn_ctrl_all`.
*
* @param btnm Button matrix object
* @param one_toggle Whether "one toggle" mode is enabled
* @param one_chk Whether "one check" mode is enabled
*/
void lv_btnmatrix_set_one_toggle(lv_obj_t * btnm, bool one_toggle)
void lv_btnmatrix_set_one_check(lv_obj_t * btnm, bool one_chk)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
ext->one_toggle = one_toggle;
ext->one_check = one_chk;
/*If more than one button is toggled only the first one should be*/
make_one_button_toggled(btnm, 0);
@@ -552,17 +550,17 @@ bool lv_btnmatrix_get_btn_ctrl(lv_obj_t * btnm, uint16_t btn_id, lv_btnmatrix_ct
/**
* Find whether "one toggle" mode is enabled.
* Find whether "one check" mode is enabled.
* @param btnm Button matrix object
* @return whether "one toggle" mode is enabled
* @return whether "one check" mode is enabled
*/
bool lv_btnmatrix_get_one_toggle(const lv_obj_t * btnm)
bool lv_btnmatrix_get_one_check(const lv_obj_t * btnm)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
return ext->one_toggle;
return ext->one_check;
}
/**********************
@@ -867,7 +865,7 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
else {
ext->ctrl_bits[ext->btn_id_pr] |= LV_BTNMATRIX_CTRL_CHECK_STATE;
}
if(ext->one_toggle) make_one_button_toggled(btnm, ext->btn_id_pr);
if(ext->one_check) make_one_button_toggled(btnm, ext->btn_id_pr);
}
/*Invalidate to old pressed area*/;
@@ -1105,7 +1103,7 @@ static bool button_is_repeat_disabled(lv_btnmatrix_ctrl_t ctrl_bits)
static bool button_is_inactive(lv_btnmatrix_ctrl_t ctrl_bits)
{
return (ctrl_bits & LV_BTNMATRIX_CTRL_INACTIVE) ? true : false;
return (ctrl_bits & LV_BTNMATRIX_CTRL_DISABLED) ? true : false;
}
static bool button_is_click_trig(lv_btnmatrix_ctrl_t ctrl_bits)

View File

@@ -38,7 +38,7 @@ LV_EXPORT_CONST_INT(LV_BTNMATRIX_BTN_NONE);
enum {
LV_BTNMATRIX_CTRL_HIDDEN = 0x0008, /**< Button hidden */
LV_BTNMATRIX_CTRL_NO_REPEAT = 0x0010, /**< Do not repeat press this button. */
LV_BTNMATRIX_CTRL_INACTIVE = 0x0020, /**< Disable this button. */
LV_BTNMATRIX_CTRL_DISABLED = 0x0020, /**< Disable this button. */
LV_BTNMATRIX_CTRL_CHECKABLE = 0x0040, /**< Button *can* be toggled. */
LV_BTNMATRIX_CTRL_CHECK_STATE = 0x0080, /**< Button is currently toggled (e.g. checked). */
LV_BTNMATRIX_CTRL_CLICK_TRIG = 0x0100, /**< 1: Send LV_EVENT_SELECTED on CLICK, 0: Send LV_EVENT_SELECTED on PRESS*/
@@ -58,7 +58,7 @@ typedef struct {
uint16_t btn_id_focused; /*Index of the currently focused button or LV_BTNMATRIX_BTN_NONE*/
uint16_t btn_id_act; /*Index of the active button (being pressed/released etc) or LV_BTNMATRIX_BTN_NONE */
uint8_t recolor : 1; /*Enable button recoloring*/
uint8_t one_toggle : 1; /*Single button toggled at once*/
uint8_t one_check : 1; /*Single button toggled at once*/
} lv_btnmatrix_ext_t;
enum {
@@ -172,14 +172,12 @@ void lv_btnmatrix_set_btn_width(lv_obj_t * btnm, uint16_t btn_id, uint8_t width)
/**
* Make the button matrix like a selector widget (only one button may be toggled at a time).
*
* Toggling must be enabled on the buttons you want to be selected with `lv_btnmatrix_set_ctrl` or
* `Checkable` must be enabled on the buttons you want to be selected with `lv_btnmatrix_set_ctrl` or
* `lv_btnmatrix_set_btn_ctrl_all`.
*
* @param btnm Button matrix object
* @param one_toggle Whether "one toggle" mode is enabled
* @param one_chk Whether "one check" mode is enabled
*/
void lv_btnmatrix_set_one_toggle(lv_obj_t * btnm, bool one_toggle);
void lv_btnmatrix_set_one_check(lv_obj_t * btnm, bool one_chk);
/*=====================
* Getter functions
@@ -247,7 +245,7 @@ bool lv_btnmatrix_get_btn_ctrl(lv_obj_t * btnm, uint16_t btn_id, lv_btnmatrix_ct
* @param btnm Button matrix object
* @return whether "one toggle" mode is enabled
*/
bool lv_btnmatrix_get_one_toggle(const lv_obj_t * btnm);
bool lv_btnmatrix_get_one_check(const lv_obj_t * btnm);
/**********************
* MACROS
**********************/

View File

@@ -262,8 +262,8 @@ void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t x, l
/**
* Transform and image and store the result on a canvas.
* @param canvas pointer to a canvas object
* @param img pointer to an image descriptor.
* @param canvas pointer to a canvas object to store the result of the transformation.
* @param img pointer to an image descriptor to transform.
* Can be the image descriptor of an other canvas too (`lv_canvas_get_img()`).
* @param angle the angle of rotation (0..3600), 0.1 deg resolution
* @param zoom zoom factor (256 no zoom);

View File

@@ -131,8 +131,8 @@ void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t x, l
/**
* Transform and image and store the result on a canvas.
* @param canvas pointer to a canvas object
* @param img pointer to an image descriptor.
* @param canvas pointer to a canvas object to store the result of the transformation.
* @param img pointer to an image descriptor to transform.
* Can be the image descriptor of an other canvas too (`lv_canvas_get_img()`).
* @param angle the angle of rotation (0..3600), 0.1 deg resolution
* @param zoom zoom factor (256 no zoom);

View File

@@ -340,7 +340,7 @@ void lv_keyboard_def_event_cb(lv_obj_t * kb, lv_event_t event)
lv_keyboard_ext_t * ext = lv_obj_get_ext_attr(kb);
uint16_t btn_id = lv_btnmatrix_get_active_btn(kb);
if(btn_id == LV_BTNMATRIX_BTN_NONE) return;
if(lv_btnmatrix_get_btn_ctrl(kb, btn_id, LV_BTNMATRIX_CTRL_HIDDEN | LV_BTNMATRIX_CTRL_INACTIVE)) return;
if(lv_btnmatrix_get_btn_ctrl(kb, btn_id, LV_BTNMATRIX_CTRL_HIDDEN | LV_BTNMATRIX_CTRL_DISABLED)) return;
if(lv_btnmatrix_get_btn_ctrl(kb, btn_id, LV_BTNMATRIX_CTRL_NO_REPEAT) && event == LV_EVENT_LONG_PRESSED_REPEAT) return;
const char * txt = lv_btnmatrix_get_active_btn_text(kb);

View File

@@ -173,7 +173,7 @@ static lv_design_res_t lv_slider_design(lv_obj_t * slider, const lv_area_t * cli
bool hor = objw >= objh ? true : false;
lv_coord_t knob_size = hor ? objh : objw;
bool sym = false;
if(ext->bar.type == LV_BAR_TYPE_SYM && ext->bar.min_value < 0 && ext->bar.max_value > 0) sym = true;
if(ext->bar.type == LV_BAR_TYPE_SYMMETRICAL && ext->bar.min_value < 0 && ext->bar.max_value > 0) sym = true;
lv_area_t knob_area;

View File

@@ -128,7 +128,7 @@ static inline void lv_slider_set_type(lv_obj_t * slider, lv_slider_type_t type)
if(type == LV_SLIDER_TYPE_NORMAL)
lv_bar_set_type(slider, LV_BAR_TYPE_NORMAL);
else if(type == LV_SLIDER_TYPE_SYM)
lv_bar_set_type(slider, LV_BAR_TYPE_SYM);
lv_bar_set_type(slider, LV_BAR_TYPE_SYMMETRICAL);
else if(type == LV_SLIDER_TYPE_RANGE)
lv_bar_set_type(slider, LV_BAR_TYPE_CUSTOM);
}
@@ -206,7 +206,7 @@ static inline uint16_t lv_slider_get_anim_time(lv_obj_t * slider)
static inline lv_slider_type_t lv_slider_get_type(lv_obj_t * slider)
{
lv_bar_type_t type = lv_bar_get_type(slider);
if(type == LV_BAR_TYPE_SYM)
if(type == LV_BAR_TYPE_SYMMETRICAL)
return LV_SLIDER_TYPE_SYM;
else if(type == LV_BAR_TYPE_CUSTOM)
return LV_SLIDER_TYPE_RANGE;

View File

@@ -70,7 +70,7 @@ typedef struct {
/*Parts of the spinner*/
enum {
LV_SPINNER_PART_BG = LV_ARC_PART_BG,
LV_SPINNER_PART_ARC = LV_ARC_PART_ARC,
LV_SPINNER_PART_ARC = LV_ARC_PART_INDIC,
_LV_SPINNER_PART_VIRTUAL_LAST,
_LV_SPINNER_PART_REAL_LAST = _LV_ARC_PART_REAL_LAST,