rename a lot of functions in lv_misc

This commit is contained in:
Gabor Kiss-Vamosi
2017-11-23 21:28:36 +01:00
parent c3471fd04e
commit 1fcda8092e
175 changed files with 2257 additions and 2289 deletions

View File

@@ -28,7 +28,7 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t mode);
static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param);
/**********************
@@ -129,12 +129,12 @@ void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time)
new_value = value > ext->max_value ? ext->max_value : value;
new_value = new_value < ext->min_value ? ext->min_value : new_value;
anim_t a;
lv_anim_t a;
a.var = bar;
a.start = ext->cur_value;
a.end = new_value;
a.fp = (anim_fp_t)lv_bar_set_value;
a.path = anim_get_path(ANIM_PATH_LIN);
a.fp = (lv_anim_fp_t)lv_bar_set_value;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.end_cb = NULL;
a.act_time = 0;
a.time = anim_time;
@@ -143,7 +143,7 @@ void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time)
a.repeat = 0;
a.repeat_pause = 0;
anim_create(&a);
lv_anim_create(&a);
}
@@ -263,7 +263,7 @@ lv_style_t * lv_bar_get_style(lv_obj_t *bar, lv_bar_style_t type)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t mode)
static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
/*Return false if the object is not covers the mask area*/
@@ -274,15 +274,15 @@ static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
lv_style_t *style_indic = lv_bar_get_style(bar, LV_BAR_STYLE_INDIC);
area_t indic_area;
lv_area_t indic_area;
area_cpy(&indic_area, &bar->coords);
indic_area.x1 += style_indic->body.padding.hor;
indic_area.x2 -= style_indic->body.padding.hor;
indic_area.y1 += style_indic->body.padding.ver;
indic_area.y2 -= style_indic->body.padding.ver;
cord_t w = area_get_width(&indic_area);
cord_t h = area_get_height(&indic_area);
lv_coord_t w = area_get_width(&indic_area);
lv_coord_t h = area_get_height(&indic_area);
if(w >= h) {
indic_area.x2 = (int32_t) ((int32_t)w * (ext->cur_value - ext->min_value)) / (ext->max_value - ext->min_value);

View File

@@ -29,13 +29,13 @@
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param);
static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_t mode);
static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mode_t mode);
static uint8_t get_button_width(const char * btn_str);
static bool button_is_hidden(const char * btn_str);
static bool button_is_repeat_disabled(const char * btn_str);
static bool button_is_inactive(const char * btn_str);
const char * cut_ctrl_byte(const char * btn_str);
static uint16_t get_button_from_point(lv_obj_t * btnm, point_t * p);
static uint16_t get_button_from_point(lv_obj_t * btnm, lv_point_t * p);
static uint16_t get_button_text(lv_obj_t * btnm, uint16_t btn_id);
static void create_buttons(lv_obj_t * btnm, const char ** map);
@@ -151,9 +151,9 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
/*Set size and positions of the buttons*/
lv_style_t * btnms = lv_obj_get_style(btnm);
cord_t max_w = lv_obj_get_width(btnm) - 2 * btnms->body.padding.hor;
cord_t max_h = lv_obj_get_height(btnm) - 2 * btnms->body.padding.ver;
cord_t act_y = btnms->body.padding.ver;
lv_coord_t max_w = lv_obj_get_width(btnm) - 2 * btnms->body.padding.hor;
lv_coord_t max_h = lv_obj_get_height(btnm) - 2 * btnms->body.padding.ver;
lv_coord_t act_y = btnms->body.padding.ver;
/*Count the lines to calculate button height*/
uint8_t line_cnt = 1;
@@ -162,7 +162,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
if(strcmp(map[li], "\n") == 0) line_cnt ++;
}
cord_t btn_h = max_h - ((line_cnt - 1) * btnms->body.padding.inner);
lv_coord_t btn_h = max_h - ((line_cnt - 1) * btnms->body.padding.inner);
btn_h = btn_h / line_cnt;
/* Count the units and the buttons in a line
@@ -188,12 +188,12 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
/*Only deal with the non empty lines*/
if(btn_cnt != 0) {
/*Calculate the width of all units*/
cord_t all_unit_w = max_w - ((btn_cnt-1) * btnms->body.padding.inner);
lv_coord_t all_unit_w = max_w - ((btn_cnt-1) * btnms->body.padding.inner);
/*Set the button size and positions and set the texts*/
uint16_t i;
cord_t act_x = btnms->body.padding.hor;
cord_t act_unit_w;
lv_coord_t act_x = btnms->body.padding.hor;
lv_coord_t act_unit_w;
unit_act_cnt = 0;
for(i = 0; i < btn_cnt; i++) {
/* one_unit_w = all_unit_w / unit_cnt
@@ -204,7 +204,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
/*Always recalculate act_x because of rounding errors */
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * btnms->body.padding.inner + btnms->body.padding.hor;
area_set(&ext->button_areas[btn_i], act_x,
lv_area_set(&ext->button_areas[btn_i], act_x,
act_y,
act_x + act_unit_w,
act_y + btn_h);
@@ -369,7 +369,7 @@ lv_style_t * lv_btnm_get_style(lv_obj_t *btnm, lv_btnm_style_t type)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_t mode)
static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
return ancestor_design_f(btnm, mask, mode);
@@ -383,12 +383,12 @@ static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_
lv_style_t * bg_style = lv_obj_get_style(btnm);
lv_style_t * btn_style;
area_t area_btnm;
lv_area_t area_btnm;
lv_obj_get_coords(btnm, &area_btnm);
area_t area_tmp;
cord_t btn_w;
cord_t btn_h;
lv_area_t area_tmp;
lv_coord_t btn_w;
lv_coord_t btn_h;
bool border_mod = false;
uint16_t btn_i = 0;
@@ -433,8 +433,8 @@ static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_
/*Calculate the size of the text*/
const font_t * font = btn_style->text.font;
point_t txt_size;
const lv_font_t * font = btn_style->text.font;
lv_point_t txt_size;
txt_get_size(&txt_size, ext->map_p[txt_i], font,
btn_style->text.letter_space, btn_style->text.line_space,
area_get_width(&area_btnm), TXT_FLAG_NONE);
@@ -468,11 +468,11 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
if(res != LV_RES_OK) return res;
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
area_t btnm_area;
area_t btn_area;
point_t p;
lv_area_t btnm_area;
lv_area_t btn_area;
lv_point_t p;
if(sign == LV_SIGNAL_CLEANUP) {
dm_free(ext->button_areas);
lv_mem_free(ext->button_areas);
}
else if(sign == LV_SIGNAL_STYLE_CHG || sign == LV_SIGNAL_CORD_CHG) {
lv_btnm_set_map(btnm, ext->map_p);
@@ -604,11 +604,11 @@ static void create_buttons(lv_obj_t * btnm, const char ** map)
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(ext->button_areas != NULL) {
dm_free(ext->button_areas);
lv_mem_free(ext->button_areas);
ext->button_areas = NULL;
}
ext->button_areas = dm_alloc(sizeof(area_t) * btn_cnt);
ext->button_areas = lv_mem_alloc(sizeof(lv_area_t) * btn_cnt);
ext->btn_cnt = btn_cnt;
}
@@ -673,10 +673,10 @@ const char * cut_ctrl_byte(const char * btn_str)
* @param p a point with absolute coordinates
* @return the id of the button or LV_BTNM_PR_NONE.
*/
static uint16_t get_button_from_point(lv_obj_t * btnm, point_t * p)
static uint16_t get_button_from_point(lv_obj_t * btnm, lv_point_t * p)
{
area_t btnm_cords;
area_t btn_area;
lv_area_t btnm_cords;
lv_area_t btn_area;
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
uint16_t i;
lv_obj_get_coords(btnm, &btnm_cords);
@@ -687,7 +687,7 @@ static uint16_t get_button_from_point(lv_obj_t * btnm, point_t * p)
btn_area.y1 += btnm_cords.y1;
btn_area.x2 += btnm_cords.x1;
btn_area.y2 += btnm_cords.y1;
if(area_is_point_on(&btn_area, p) != false) {
if(lv_area_is_point_on(&btn_area, p) != false) {
break;
}
}

View File

@@ -48,7 +48,7 @@ typedef struct
/*No inherited ext.*/ /*Ext. of ancestor*/
/*New data for this type */
const char ** map_p; /*Pointer to the current map*/
area_t *button_areas; /*Array of areas of buttons*/
lv_area_t *button_areas; /*Array of areas of buttons*/
lv_btnm_action_t action; /*A function to call when a button is releases*/
lv_style_t *styles_btn[LV_BTN_STATE_NUM]; /*Styles of buttons in each state*/
uint16_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/

View File

@@ -24,8 +24,8 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool lv_cb_design(lv_obj_t * cb, const area_t * mask, lv_design_mode_t mode);
static bool lv_bullet_design(lv_obj_t * bullet, const area_t * mask, lv_design_mode_t mode);
static bool lv_cb_design(lv_obj_t * cb, const lv_area_t * mask, lv_design_mode_t mode);
static bool lv_bullet_design(lv_obj_t * bullet, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param);
/**********************
@@ -211,7 +211,7 @@ lv_style_t * lv_cb_get_style(lv_obj_t * cb, lv_cb_style_t type)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_cb_design(lv_obj_t * cb, const area_t * mask, lv_design_mode_t mode)
static bool lv_cb_design(lv_obj_t * cb, const lv_area_t * mask, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
/*Return false if the object is not covers the mask_p area*/
@@ -242,7 +242,7 @@ static bool lv_cb_design(lv_obj_t * cb, const area_t * mask, lv_design_mode_t mo
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_bullet_design(lv_obj_t * bullet, const area_t * mask, lv_design_mode_t mode)
static bool lv_bullet_design(lv_obj_t * bullet, const lv_area_t * mask, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
return ancestor_bullet_design(bullet, mask, mode);
@@ -255,7 +255,7 @@ static bool lv_bullet_design(lv_obj_t * bullet, const area_t * mask, lv_design_m
lv_obj_t * bg = lv_obj_get_parent(bullet);
lv_style_t * style_page = lv_obj_get_style(bg);
lv_group_t * g = lv_obj_get_group(bg);
if(style_page->body.empty != 0 || style_page->body.opa == OPA_TRANSP) { /*Background is visible?*/
if(style_page->body.empty != 0 || style_page->body.opa == LV_OPA_TRANSP) { /*Background is visible?*/
if(lv_group_get_focused(g) == bg) {
lv_style_t * style_mod;
style_mod = lv_group_mod_style(g, style_ori);
@@ -295,7 +295,7 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
lv_style_t * style = lv_obj_get_style(cb);
if(sign == LV_SIGNAL_STYLE_CHG) {
lv_obj_set_size(ext->bullet, font_get_height_scale(style->text.font), font_get_height_scale(style->text.font));
lv_obj_set_size(ext->bullet, lv_font_get_height_scale(style->text.font), lv_font_get_height_scale(style->text.font));
lv_btn_set_state(ext->bullet, lv_btn_get_state(cb));
} else if(sign == LV_SIGNAL_PRESSED ||
sign == LV_SIGNAL_RELEASED ||

View File

@@ -29,12 +29,12 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool lv_chart_design(lv_obj_t * chart, const area_t * mask, lv_design_mode_t mode);
static bool lv_chart_design(lv_obj_t * chart, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param);
static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask);
static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask);
static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask);
static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask);
static void lv_chart_draw_div(lv_obj_t * chart, const lv_area_t * mask);
static void lv_chart_draw_lines(lv_obj_t * chart, const lv_area_t * mask);
static void lv_chart_draw_points(lv_obj_t * chart, const lv_area_t * mask);
static void lv_chart_draw_cols(lv_obj_t * chart, const lv_area_t * mask);
/**********************
* STATIC VARIABLES
@@ -73,8 +73,8 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
ext->vdiv_cnt = LV_CHART_VDIV_DEF;
ext->point_cnt = LV_CHART_PNUM_DEF;
ext->type = LV_CHART_TYPE_LINE;
ext->series.opa = OPA_COVER;
ext->series.dark = OPA_50;
ext->series.opa = LV_OPA_COVER;
ext->series.dark = LV_OPA_50;
ext->series.width = 2 << LV_ANTIALIAS;
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_func(new_chart);
@@ -122,20 +122,20 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
* @param color color of the data series
* @return pointer to the allocated data series
*/
lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, color_t color)
lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_chart_series_t *ser = ll_ins_head(&ext->series_ll);
cord_t def = (ext->ymin + ext->ymax) >> 1; /*half range as default value*/
lv_coord_t def = (ext->ymin + ext->ymax) >> 1; /*half range as default value*/
if(ser == NULL) return NULL;
ser->color = color;
ser->points = dm_alloc(sizeof(cord_t) * ext->point_cnt);
ser->points = lv_mem_alloc(sizeof(lv_coord_t) * ext->point_cnt);
uint16_t i;
cord_t * p_tmp = ser->points;
lv_coord_t * p_tmp = ser->points;
for(i = 0; i < ext->point_cnt; i++) {
*p_tmp = def;
p_tmp++;
@@ -172,7 +172,7 @@ void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv)
* @param ymin y minimum value
* @param ymax y maximum value
*/
void lv_chart_set_range(lv_obj_t * chart, cord_t ymin, cord_t ymax)
void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coord_t ymax)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
@@ -206,12 +206,12 @@ void lv_chart_set_point_count(lv_obj_t * chart, uint16_t point_cnt)
lv_chart_series_t *ser;
uint16_t point_cnt_old = ext->point_cnt;
uint16_t i;
cord_t def = (ext->ymin + ext->ymax) >> 1; /*half range as default value*/
lv_coord_t def = (ext->ymin + ext->ymax) >> 1; /*half range as default value*/
if(point_cnt < 1) point_cnt = 1;
LL_READ_BACK(ext->series_ll, ser) {
ser->points = dm_realloc(ser->points, sizeof(cord_t) * point_cnt);
ser->points = lv_mem_realloc(ser->points, sizeof(lv_coord_t) * point_cnt);
/*Initialize the new points*/
if(point_cnt > point_cnt_old) {
@@ -230,7 +230,7 @@ void lv_chart_set_point_count(lv_obj_t * chart, uint16_t point_cnt)
* @param chart pointer to a chart object
* @param opa opacity of the data series
*/
void lv_chart_set_series_opa(lv_obj_t * chart, opa_t opa)
void lv_chart_set_series_opa(lv_obj_t * chart, lv_opa_t opa)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->series.opa = opa;
@@ -242,7 +242,7 @@ void lv_chart_set_series_opa(lv_obj_t * chart, opa_t opa)
* @param chart pointer to a chart object
* @param width the new width
*/
void lv_chart_set_series_width(lv_obj_t * chart, cord_t width)
void lv_chart_set_series_width(lv_obj_t * chart, lv_coord_t width)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->series.width = width;
@@ -251,9 +251,9 @@ void lv_chart_set_series_width(lv_obj_t * chart, cord_t width)
/**
* Set the dark effect on the bottom of the points or columns
* @param chart pointer to a chart object
* @param dark_eff dark effect level (OPA_TRANSP to turn off)
* @param dark_eff dark effect level (LV_OPA_TRANSP to turn off)
*/
void lv_chart_set_series_darking(lv_obj_t * chart, opa_t dark_eff)
void lv_chart_set_series_darking(lv_obj_t * chart, lv_opa_t dark_eff)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->series.dark = dark_eff;
@@ -265,7 +265,7 @@ void lv_chart_set_series_darking(lv_obj_t * chart, opa_t dark_eff)
* @param ser pointer to a data series on 'chart'
* @param y the new value of the most right data
*/
void lv_chart_set_next(lv_obj_t * chart, lv_chart_series_t * ser, cord_t y)
void lv_chart_set_next(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
@@ -310,7 +310,7 @@ uint16_t lv_chart_get_point_cnt(lv_obj_t * chart)
* @param chart pointer to chart object
* @return the opacity of the data series
*/
opa_t lv_chart_get_series_opa(lv_obj_t * chart)
lv_opa_t lv_chart_get_series_opa(lv_obj_t * chart)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
return ext->series.opa;
@@ -321,7 +321,7 @@ opa_t lv_chart_get_series_opa(lv_obj_t * chart)
* @param chart pointer to chart object
* @return the width the data series (lines or points)
*/
cord_t lv_chart_get_series_width(lv_obj_t * chart)
lv_coord_t lv_chart_get_series_width(lv_obj_t * chart)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
return ext->series.width;
@@ -330,9 +330,9 @@ cord_t lv_chart_get_series_width(lv_obj_t * chart)
/**
* Get the dark effect level on the bottom of the points or columns
* @param chart pointer to chart object
* @return dark effect level (OPA_TRANSP to turn off)
* @return dark effect level (LV_OPA_TRANSP to turn off)
*/
opa_t lv_chart_get_series_darking(lv_obj_t * chart, opa_t dark_eff)
lv_opa_t lv_chart_get_series_darking(lv_obj_t * chart, lv_opa_t dark_eff)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
return ext->series.dark;
@@ -365,7 +365,7 @@ void lv_chart_refresh(lv_obj_t * chart)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_chart_design(lv_obj_t * chart, const area_t * mask, lv_design_mode_t mode)
static bool lv_chart_design(lv_obj_t * chart, const lv_area_t * mask, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
/*Return false if the object is not covers the mask_p area*/
@@ -400,10 +400,10 @@ static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_CLEANUP) {
cord_t ** datal;
lv_coord_t ** datal;
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
LL_READ(ext->series_ll, datal) {
dm_free(*datal);
lv_mem_free(*datal);
}
ll_clear(&ext->series_ll);
}
@@ -416,7 +416,7 @@ static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param
* @param chart pointer to chart object
* @param mask mask, inherited from the design function
*/
static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
static void lv_chart_draw_div(lv_obj_t * chart, const lv_area_t * mask)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_style_t * style = lv_obj_get_style(chart);
@@ -424,12 +424,12 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
uint8_t div_i;
uint8_t div_i_end;
uint8_t div_i_start;
point_t p1;
point_t p2;
cord_t w = lv_obj_get_width(chart);
cord_t h = lv_obj_get_height(chart);
cord_t x_ofs = chart->coords.x1;
cord_t y_ofs = chart->coords.y1;
lv_point_t p1;
lv_point_t p2;
lv_coord_t w = lv_obj_get_width(chart);
lv_coord_t h = lv_obj_get_height(chart);
lv_coord_t x_ofs = chart->coords.x1;
lv_coord_t y_ofs = chart->coords.y1;
if(ext->hdiv_cnt != 0) {
/*Draw slide lines if no border*/
@@ -481,17 +481,17 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
* Draw the data lines as lines on a chart
* @param obj pointer to chart object
*/
static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
static void lv_chart_draw_lines(lv_obj_t * chart, const lv_area_t * mask)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
uint8_t i;
point_t p1;
point_t p2;
cord_t w = lv_obj_get_width(chart);
cord_t h = lv_obj_get_height(chart);
cord_t x_ofs = chart->coords.x1;
cord_t y_ofs = chart->coords.y1;
lv_point_t p1;
lv_point_t p2;
lv_coord_t w = lv_obj_get_width(chart);
lv_coord_t h = lv_obj_get_height(chart);
lv_coord_t x_ofs = chart->coords.x1;
lv_coord_t y_ofs = chart->coords.y1;
int32_t y_tmp;
lv_chart_series_t *ser;
lv_style_t lines;
@@ -529,16 +529,16 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
* @param chart pointer to chart object
* @param mask mask, inherited from the design function
*/
static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
static void lv_chart_draw_points(lv_obj_t * chart, const lv_area_t * mask)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
uint8_t i;
area_t cir_a;
cord_t w = lv_obj_get_width(chart);
cord_t h = lv_obj_get_height(chart);
cord_t x_ofs = chart->coords.x1;
cord_t y_ofs = chart->coords.y1;
lv_area_t cir_a;
lv_coord_t w = lv_obj_get_width(chart);
lv_coord_t h = lv_obj_get_height(chart);
lv_coord_t x_ofs = chart->coords.x1;
lv_coord_t y_ofs = chart->coords.y1;
int32_t y_tmp;
lv_chart_series_t * ser;
uint8_t series_cnt = 0;
@@ -554,7 +554,7 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
/*Go through all data lines*/
LL_READ_BACK(ext->series_ll, ser) {
style_point.body.main_color = ser->color;
style_point.body.grad_color = color_mix(COLOR_BLACK, ser->color, ext->series.dark);
style_point.body.grad_color = lv_color_mix(LV_COLOR_BLACK, ser->color, ext->series.dark);
for(i = 0; i < ext->point_cnt; i ++) {
cir_a.x1 = ((w * i) / (ext->point_cnt - 1)) + x_ofs;
@@ -578,21 +578,21 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
* @param chart pointer to chart object
* @param mask mask, inherited from the design function
*/
static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
static void lv_chart_draw_cols(lv_obj_t * chart, const lv_area_t * mask)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
uint8_t i;
area_t col_a;
area_t col_mask;
lv_area_t col_a;
lv_area_t col_mask;
bool mask_ret;
cord_t w = lv_obj_get_width(chart);
cord_t h = lv_obj_get_height(chart);
lv_coord_t w = lv_obj_get_width(chart);
lv_coord_t h = lv_obj_get_height(chart);
int32_t y_tmp;
lv_chart_series_t *ser;
lv_style_t rects;
cord_t col_w = w / ((ext->series.num + 1) * ext->point_cnt); /* Suppose + 1 series as separator*/
cord_t x_ofs = col_w / 2; /*Shift with a half col.*/
lv_coord_t col_w = w / ((ext->series.num + 1) * ext->point_cnt); /* Suppose + 1 series as separator*/
lv_coord_t x_ofs = col_w / 2; /*Shift with a half col.*/
lv_style_copy(&rects, &lv_style_plain);
rects.body.border.width = 0;
@@ -602,7 +602,7 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
col_a.y2 = chart->coords.y2;
cord_t x_act;
lv_coord_t x_act;
/*Go through all points*/
for(i = 0; i < ext->point_cnt; i ++) {
@@ -612,7 +612,7 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
/*Draw the current point of all data line*/
LL_READ_BACK(ext->series_ll, ser) {
rects.body.main_color = ser->color;
rects.body.grad_color = color_mix(COLOR_BLACK, ser->color, ext->series.dark);
rects.body.grad_color = lv_color_mix(LV_COLOR_BLACK, ser->color, ext->series.dark);
col_a.x1 = x_act;
col_a.x2 = col_a.x1 + col_w;
x_act += col_w;
@@ -621,7 +621,7 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
y_tmp = y_tmp / (ext->ymax - ext->ymin);
col_a.y1 = h - y_tmp + chart->coords.y1;
mask_ret = area_union(&col_mask, mask, &col_a);
mask_ret = lv_area_union(&col_mask, mask, &col_a);
if(mask_ret != false) {
lv_draw_rect(&chart->coords, &col_mask, &rects);
}

View File

@@ -28,8 +28,8 @@ extern "C" {
**********************/
typedef struct
{
cord_t * points;
color_t color;
lv_coord_t * points;
lv_color_t color;
}lv_chart_series_t;
/*Data of chart */
@@ -38,17 +38,17 @@ typedef struct
/*No inherited ext*/ /*Ext. of ancestor*/
/*New data for this type */
ll_dsc_t series_ll; /*Linked list for the data line pointers (stores lv_chart_dl_t)*/
cord_t ymin; /*y min value (used to scale the data)*/
cord_t ymax; /*y max value (used to scale the data)*/
lv_coord_t ymin; /*y min value (used to scale the data)*/
lv_coord_t ymax; /*y max value (used to scale the data)*/
uint8_t hdiv_cnt; /*Number of horizontal division lines*/
uint8_t vdiv_cnt; /*Number of vertical division lines*/
uint16_t point_cnt; /*Point number in a data line*/
uint8_t type :3; /*Line, column or point chart (from 'lv_chart_type_t')*/
struct {
cord_t width; /*Line width or point radius*/
lv_coord_t width; /*Line width or point radius*/
uint8_t num; /*Number of data lines in dl_ll*/
opa_t opa; /*Opacity of data lines*/
opa_t dark; /*Dark level of the point/column bottoms*/
lv_opa_t opa; /*Opacity of data lines*/
lv_opa_t dark; /*Dark level of the point/column bottoms*/
}series;
}lv_chart_ext_t;
@@ -83,7 +83,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy);
* @param color color of the data series
* @return pointer to the allocated data series
*/
lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, color_t color);
lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color);
/*=====================
* Setter functions
@@ -103,7 +103,7 @@ void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv);
* @param ymin y minimum value
* @param ymax y maximum value
*/
void lv_chart_set_range(lv_obj_t * chart, cord_t ymin, cord_t ymax);
void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coord_t ymax);
/**
* Set a new type for a chart
@@ -124,21 +124,21 @@ void lv_chart_set_point_count(lv_obj_t * chart, uint16_t point_cnt);
* @param chart pointer to a chart object
* @param opa opacity of the data series
*/
void lv_chart_set_series_opa(lv_obj_t * chart, opa_t opa);
void lv_chart_set_series_opa(lv_obj_t * chart, lv_opa_t opa);
/**
* Set the line width or point radius of the data series
* @param chart pointer to a chart object
* @param width the new width
*/
void lv_chart_set_series_width(lv_obj_t * chart, cord_t width);
void lv_chart_set_series_width(lv_obj_t * chart, lv_coord_t width);
/**
* Set the dark effect on the bottom of the points or columns
* @param chart pointer to a chart object
* @param dark_eff dark effect level (OPA_TRANSP to turn off)
* @param dark_eff dark effect level (LV_OPA_TRANSP to turn off)
*/
void lv_chart_set_series_darking(lv_obj_t * chart, opa_t dark_eff);
void lv_chart_set_series_darking(lv_obj_t * chart, lv_opa_t dark_eff);
/**
* Shift all data right and set the most right data on a data line
@@ -146,7 +146,7 @@ void lv_chart_set_series_darking(lv_obj_t * chart, opa_t dark_eff);
* @param ser pointer to a data series on 'chart'
* @param y the new value of the most right data
*/
void lv_chart_set_next(lv_obj_t * chart, lv_chart_series_t * ser, cord_t y);
void lv_chart_set_next(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y);
/**
* Set the style of a chart
@@ -181,21 +181,21 @@ uint16_t lv_chart_get_point_cnt(lv_obj_t * chart);
* @param chart pointer to chart object
* @return the opacity of the data series
*/
opa_t lv_chart_get_series_opa(lv_obj_t * chart);
lv_opa_t lv_chart_get_series_opa(lv_obj_t * chart);
/**
* Get the data series width
* @param chart pointer to chart object
* @return the width the data series (lines or points)
*/
cord_t lv_chart_get_series_width(lv_obj_t * chart);
lv_coord_t lv_chart_get_series_width(lv_obj_t * chart);
/**
* Get the dark effect level on the bottom of the points or columns
* @param chart pointer to chart object
* @return dark effect level (OPA_TRANSP to turn off)
* @return dark effect level (LV_OPA_TRANSP to turn off)
*/
opa_t lv_chart_get_series_darking(lv_obj_t * chart, opa_t dark_eff);
lv_opa_t lv_chart_get_series_darking(lv_obj_t * chart, lv_opa_t dark_eff);
/**
* Get the style of an chart object

View File

@@ -250,7 +250,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
/*Adjust margin and get the alignment type*/
lv_align_t align;
lv_style_t * style = lv_obj_get_style(cont);
cord_t hpad_corr;
lv_coord_t hpad_corr;
switch(type) {
case LV_LAYOUT_COL_L:
@@ -275,7 +275,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
* an unnecessary child change signals could be sent*/
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
/* Align the children */
cord_t last_cord = style->body.padding.ver;
lv_coord_t last_cord = style->body.padding.ver;
LL_READ_BACK(cont->child_ll, child) {
if(lv_obj_get_hidden(child) != false ||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
@@ -299,7 +299,7 @@ static void lv_cont_layout_row(lv_obj_t * cont)
/*Adjust margin and get the alignment type*/
lv_align_t align;
lv_style_t * style = lv_obj_get_style(cont);
cord_t vpad_corr = style->body.padding.ver;
lv_coord_t vpad_corr = style->body.padding.ver;
switch(type) {
case LV_LAYOUT_ROW_T:
@@ -325,7 +325,7 @@ static void lv_cont_layout_row(lv_obj_t * cont)
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
/* Align the children */
cord_t last_cord = style->body.padding.hor;
lv_coord_t last_cord = style->body.padding.hor;
LL_READ_BACK(cont->child_ll, child) {
if(lv_obj_get_hidden(child) != false ||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
@@ -346,7 +346,7 @@ static void lv_cont_layout_center(lv_obj_t * cont)
lv_obj_t * child;
lv_style_t * style = lv_obj_get_style(cont);
uint32_t obj_num = 0;
cord_t h_tot = 0;
lv_coord_t h_tot = 0;
LL_READ(cont->child_ll, child) {
if(lv_obj_get_hidden(child) != false ||
@@ -364,7 +364,7 @@ static void lv_cont_layout_center(lv_obj_t * cont)
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
/* Align the children */
cord_t last_cord = - (h_tot / 2);
lv_coord_t last_cord = - (h_tot / 2);
LL_READ_BACK(cont->child_ll, child) {
if(lv_obj_get_hidden(child) != false ||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
@@ -387,8 +387,8 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
lv_obj_t * child_rc; /* Row closer child */
lv_obj_t * child_tmp; /* Temporary child */
lv_style_t * style = lv_obj_get_style(cont);
cord_t w_obj = lv_obj_get_width(cont);
cord_t act_y = style->body.padding.ver;
lv_coord_t w_obj = lv_obj_get_width(cont);
lv_coord_t act_y = style->body.padding.ver;
/* Disable child change action because the children will be moved a lot
* an unnecessary child change signals could be sent*/
@@ -399,8 +399,8 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
child_rc = child_rs; /*Initially the the row starter and closer is the same*/
while(child_rs != NULL) {
cord_t h_row = 0;
cord_t w_row = style->body.padding.hor * 2; /*The width is at least the left+right hpad*/
lv_coord_t h_row = 0;
lv_coord_t w_row = style->body.padding.hor * 2; /*The width is at least the left+right hpad*/
uint32_t obj_num = 0;
/*Find the row closer object and collect some data*/
@@ -441,15 +441,15 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
lv_obj_t * obj1 = child_rs;
lv_obj_t * obj2 = ll_get_prev(&cont->child_ll, child_rs);
w_row = lv_obj_get_width(obj1) + lv_obj_get_width(obj2);
cord_t pad = (w_obj - w_row) / 3;
lv_coord_t pad = (w_obj - w_row) / 3;
lv_obj_align(obj1, cont, LV_ALIGN_IN_TOP_LEFT, pad, act_y);
lv_obj_align(obj2, cont, LV_ALIGN_IN_TOP_RIGHT, -pad, act_y);
}
/* Align the children (from child_rs to child_rc)*/
else {
w_row -= style->body.padding.inner * obj_num;
cord_t new_opad = (w_obj - w_row) / (obj_num - 1);
cord_t act_x = style->body.padding.hor; /*x init*/
lv_coord_t new_opad = (w_obj - w_row) / (obj_num - 1);
lv_coord_t act_x = style->body.padding.hor; /*x init*/
child_tmp = child_rs;
while(child_tmp != NULL) {
if(lv_obj_get_hidden(child_tmp) == false &&
@@ -479,25 +479,25 @@ static void lv_cont_layout_grid(lv_obj_t * cont)
{
lv_obj_t * child;
lv_style_t * style = lv_obj_get_style(cont);
cord_t w_tot = lv_obj_get_width(cont);
cord_t w_obj = lv_obj_get_width(lv_obj_get_child(cont, NULL));
cord_t h_obj = lv_obj_get_height(lv_obj_get_child(cont, NULL));
lv_coord_t w_tot = lv_obj_get_width(cont);
lv_coord_t w_obj = lv_obj_get_width(lv_obj_get_child(cont, NULL));
lv_coord_t h_obj = lv_obj_get_height(lv_obj_get_child(cont, NULL));
uint16_t obj_row = (w_tot - (2 * style->body.padding.hor)) / (w_obj + style->body.padding.inner); /*Obj. num. in a row*/
cord_t x_ofs;
lv_coord_t x_ofs;
if(obj_row > 1) {
x_ofs = w_obj + (w_tot - (2 * style->body.padding.hor) - (obj_row * w_obj)) / (obj_row - 1);
} else {
x_ofs = w_tot / 2 - w_obj / 2;
}
cord_t y_ofs = h_obj + style->body.padding.inner;
lv_coord_t y_ofs = h_obj + style->body.padding.inner;
/* Disable child change action because the children will be moved a lot
* an unnecessary child change signals could be sent*/
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
/* Align the children */
cord_t act_x = style->body.padding.hor;
cord_t act_y = style->body.padding.ver;
lv_coord_t act_x = style->body.padding.hor;
lv_coord_t act_y = style->body.padding.ver;
uint16_t obj_cnt = 0;
LL_READ_BACK(cont->child_ll, child) {
if(lv_obj_get_hidden(child) != false ||
@@ -534,21 +534,21 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
return;
}
area_t new_cords;
area_t ori;
lv_area_t new_cords;
lv_area_t ori;
lv_style_t * style = lv_obj_get_style(cont);
lv_obj_t * i;
cord_t hpad = style->body.padding.hor;
cord_t vpad = style->body.padding.ver;
lv_coord_t hpad = style->body.padding.hor;
lv_coord_t vpad = style->body.padding.ver;
/*Search the side coordinates of the children*/
lv_obj_get_coords(cont, &ori);
lv_obj_get_coords(cont, &new_cords);
new_cords.x1 = CORD_MAX;
new_cords.y1 = CORD_MAX;
new_cords.x2 = CORD_MIN;
new_cords.y2 = CORD_MIN;
new_cords.x1 = LV_COORD_MAX;
new_cords.y1 = LV_COORD_MAX;
new_cords.x2 = LV_COORD_MIN;
new_cords.y2 = LV_COORD_MIN;
LL_READ(cont->child_ll, i) {
if(lv_obj_get_hidden(i) != false) continue;
@@ -559,7 +559,7 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
}
/*If the value is not the init value then the page has >=1 child.*/
if(new_cords.x1 != CORD_MAX) {
if(new_cords.x1 != LV_COORD_MAX) {
if(ext->hor_fit != 0) {
new_cords.x1 -= hpad;
new_cords.x2 += hpad;

View File

@@ -30,7 +30,7 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool lv_ddlist_design(lv_obj_t * ddlist, const area_t * mask, lv_design_mode_t mode);
static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param);
static lv_res_t lv_ddlist_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
static lv_res_t lv_ddlist_release_action(lv_obj_t * ddlist);
@@ -191,7 +191,7 @@ void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_t action)
* @param ddlist pointer to a drop down list
* @param h the height when the list is opened (0: auto size)
*/
void lv_ddlist_set_fix_height(lv_obj_t * ddlist, cord_t h)
void lv_ddlist_set_fix_height(lv_obj_t * ddlist, lv_coord_t h)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
ext->fix_height = h;
@@ -317,7 +317,7 @@ lv_action_t lv_ddlist_get_action(lv_obj_t * ddlist)
* @param ddlist pointer to a drop down list object
* @return the height if the ddlist is opened (0: auto size)
*/
cord_t lv_ddlist_get_fix_height(lv_obj_t * ddlist)
lv_coord_t lv_ddlist_get_fix_height(lv_obj_t * ddlist)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
return ext->fix_height;
@@ -399,7 +399,7 @@ void lv_ddlist_close(lv_obj_t * ddlist, bool anim)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_ddlist_design(lv_obj_t * ddlist, const area_t * mask, lv_design_mode_t mode)
static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
@@ -414,11 +414,11 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const area_t * mask, lv_design_m
/*If the list is opened draw a rectangle under the selected item*/
if(ext->opened != 0) {
lv_style_t *style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_BG);
const font_t * font = style->text.font;
cord_t font_h = font_get_height_scale(font);
const lv_font_t * font = style->text.font;
lv_coord_t font_h = lv_font_get_height_scale(font);
/*Draw the selected*/
area_t rect_area;
lv_area_t rect_area;
rect_area.y1 = ext->label->coords.y1;
rect_area.y1 += ext->sel_opt_id * (font_h + style->text.line_space);
rect_area.y1 -= style->text.line_space / 2;
@@ -543,7 +543,7 @@ static lv_res_t lv_ddlist_release_action(lv_obj_t * ddlist)
/*Search the clicked option*/
lv_indev_t *indev = lv_indev_get_act();
point_t p;
lv_point_t p;
lv_indev_get_point(indev, &p);
p.x -= ext->label->coords.x1;
p.y -= ext->label->coords.y1;
@@ -578,27 +578,27 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, uint16_t anim_time)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
lv_style_t * style = lv_obj_get_style(ddlist);
cord_t new_height;
lv_coord_t new_height;
if(ext->opened) { /*Open the list*/
if(ext->fix_height == 0) new_height = lv_obj_get_height(lv_page_get_scrl(ddlist)) + 2 * style->body.padding.ver;
else new_height = ext->fix_height;
} else { /*Close the list*/
const font_t * font = style->text.font;
const lv_font_t * font = style->text.font;
lv_style_t * label_style = lv_obj_get_style(ext->label);
cord_t font_h = font_get_height_scale(font);
lv_coord_t font_h = lv_font_get_height_scale(font);
new_height = font_h + 2 * label_style->text.line_space;
}
if(anim_time == 0) {
lv_obj_set_height(ddlist, new_height);
lv_ddlist_pos_current_option(ddlist);
} else {
anim_t a;
lv_anim_t a;
a.var = ddlist;
a.start = lv_obj_get_height(ddlist);
a.end = new_height;
a.fp = (anim_fp_t)lv_obj_set_height;
a.path = anim_get_path(ANIM_PATH_LIN);
a.end_cb = (anim_cb_t)lv_ddlist_pos_current_option;
a.fp = (lv_anim_fp_t)lv_obj_set_height;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.end_cb = (lv_anim_cb_t)lv_ddlist_pos_current_option;
a.act_time = 0;
a.time = ext->anim_time;
a.playback = 0;
@@ -606,7 +606,7 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, uint16_t anim_time)
a.repeat = 0;
a.repeat_pause = 0;
anim_create(&a);
lv_anim_create(&a);
}
}
@@ -618,13 +618,13 @@ static void lv_ddlist_pos_current_option(lv_obj_t * ddlist)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
lv_style_t * style = lv_obj_get_style(ddlist);
const font_t * font = style->text.font;
cord_t font_h = font_get_height_scale(font);
const lv_font_t * font = style->text.font;
lv_coord_t font_h = lv_font_get_height_scale(font);
lv_style_t * label_style = lv_obj_get_style(ext->label);
lv_obj_t * scrl = lv_page_get_scrl(ddlist);
cord_t h = lv_obj_get_height(ddlist);
cord_t line_y1 = ext->sel_opt_id * (font_h + label_style->text.line_space) + ext->label->coords.y1 - scrl->coords.y1;
lv_coord_t h = lv_obj_get_height(ddlist);
lv_coord_t line_y1 = ext->sel_opt_id * (font_h + label_style->text.line_space) + ext->label->coords.y1 - scrl->coords.y1;
lv_obj_set_y(scrl, - line_y1 + (h - font_h) / 2);

View File

@@ -48,7 +48,7 @@ typedef struct
uint16_t sel_opt_id; /*Index of the current option*/
uint16_t anim_time; /*Open/Close animation time [ms]*/
uint8_t opened :1; /*1: The list is opened*/
cord_t fix_height; /*Height if the ddlist is opened. (0: auto-size)*/
lv_coord_t fix_height; /*Height if the ddlist is opened. (0: auto-size)*/
}lv_ddlist_ext_t;
typedef enum {
@@ -99,7 +99,7 @@ void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_t action);
* @param ddlist pointer to a drop down list
* @param h the height when the list is opened (0: auto size)
*/
void lv_ddlist_set_fix_height(lv_obj_t * ddlist, cord_t h);
void lv_ddlist_set_fix_height(lv_obj_t * ddlist, lv_coord_t h);
/**
* Enable or disable the horizontal fit to the content
@@ -171,7 +171,7 @@ lv_action_t lv_ddlist_get_action(lv_obj_t * ddlist);
* @param ddlist pointer to a drop down list object
* @return the height if the ddlist is opened (0: auto size)
*/
cord_t lv_ddlist_get_fix_height(lv_obj_t * ddlist);
lv_coord_t lv_ddlist_get_fix_height(lv_obj_t * ddlist);
/**
* Get the scroll bar mode of a drop down list

View File

@@ -22,7 +22,7 @@
/*********************
* DEFINES
*********************/
#define LV_GAUGE_DEF_NEEDLE_COLOR COLOR_RED
#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
@@ -35,10 +35,10 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool lv_gauge_design(lv_obj_t * gauge, const area_t * mask, lv_design_mode_t mode);
static bool lv_gauge_design(lv_obj_t * gauge, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param);
static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask);
static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask);
static void lv_gauge_draw_scale(lv_obj_t * gauge, const lv_area_t * mask);
static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * mask);
/**********************
* STATIC VARIABLES
@@ -123,15 +123,15 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
* @param needle_cnt new count of needles
* @param colors an array of colors for needles (with 'num' elements)
*/
void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, color_t * colors)
void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, lv_color_t * colors)
{
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
if(ext->values != NULL) {
dm_free(ext->values);
lv_mem_free(ext->values);
ext->values = NULL;
}
ext->values = dm_realloc(ext->values, needle_cnt * sizeof(int16_t));
ext->values = lv_mem_realloc(ext->values, needle_cnt * sizeof(int16_t));
int16_t min = lv_gauge_get_min_value(gauge);
uint8_t n;
@@ -239,7 +239,7 @@ uint8_t lv_gauge_get_label_count(lv_obj_t * gauge)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_gauge_design(lv_obj_t * gauge, const area_t * mask, lv_design_mode_t mode)
static bool lv_gauge_design(lv_obj_t * gauge, const lv_area_t * mask, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
@@ -306,7 +306,7 @@ static lv_res_t lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
if(sign == LV_SIGNAL_CLEANUP) {
dm_free(ext->values);
lv_mem_free(ext->values);
ext->values = NULL;
}
@@ -318,15 +318,15 @@ static lv_res_t lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param
* @param gauge pointer to gauge object
* @param mask mask of drawing
*/
static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask)
static void lv_gauge_draw_scale(lv_obj_t * gauge, const lv_area_t * mask)
{
char scale_txt[16];
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
lv_style_t * style = lv_obj_get_style(gauge);
cord_t r = lv_obj_get_width(gauge) / 2 - (3 * style->body.padding.hor) - style->body.padding.inner;
cord_t x_ofs = lv_obj_get_width(gauge) / 2 + gauge->coords.x1;
cord_t y_ofs = lv_obj_get_height(gauge) / 2 + gauge->coords.y1;
lv_coord_t r = lv_obj_get_width(gauge) / 2 - (3 * style->body.padding.hor) - style->body.padding.inner;
lv_coord_t x_ofs = lv_obj_get_width(gauge) / 2 + gauge->coords.x1;
lv_coord_t y_ofs = lv_obj_get_height(gauge) / 2 + gauge->coords.y1;
int16_t scale_angle = lv_lmeter_get_scale_angle(gauge);
uint16_t label_num = ext->label_count;
int16_t angle_ofs = 90 + (360 - scale_angle) / 2;
@@ -338,21 +338,21 @@ static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask)
/*Calculate the position a scale label*/
int16_t angle = (i * scale_angle) / (label_num - 1) + angle_ofs;
cord_t y = (int32_t)((int32_t)trigo_sin(angle) * r) / TRIGO_SIN_MAX;
lv_coord_t y = (int32_t)((int32_t)trigo_sin(angle) * r) / TRIGO_SIN_MAX;
y += y_ofs;
cord_t x = (int32_t)((int32_t)trigo_sin(angle + 90) * r) / TRIGO_SIN_MAX;
lv_coord_t x = (int32_t)((int32_t)trigo_sin(angle + 90) * r) / TRIGO_SIN_MAX;
x += x_ofs;
int16_t scale_act = (int32_t)((int32_t)(max - min) * i) / (label_num - 1);
scale_act += min;
sprintf(scale_txt, "%d", scale_act);
area_t label_cord;
point_t label_size;
lv_area_t label_cord;
lv_point_t label_size;
txt_get_size(&label_size, scale_txt, style->text.font,
style->text.letter_space, style->text.line_space,
CORD_MAX, TXT_FLAG_NONE);
LV_COORD_MAX, TXT_FLAG_NONE);
/*Draw the label*/
label_cord.x1 = x - label_size.x / 2;
@@ -368,21 +368,21 @@ static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask)
* @param gauge pointer to gauge object
* @param mask mask of drawing
*/
static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask)
static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * mask)
{
lv_style_t style_needle;
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
lv_style_t * style = lv_obj_get_style(gauge);
cord_t r = lv_obj_get_width(gauge) / 2 - style->body.padding.hor;
cord_t x_ofs = lv_obj_get_width(gauge) / 2 + gauge->coords.x1;
cord_t y_ofs = lv_obj_get_height(gauge) / 2 + gauge->coords.y1;
lv_coord_t r = lv_obj_get_width(gauge) / 2 - style->body.padding.hor;
lv_coord_t x_ofs = lv_obj_get_width(gauge) / 2 + gauge->coords.x1;
lv_coord_t y_ofs = lv_obj_get_height(gauge) / 2 + gauge->coords.y1;
uint16_t angle = lv_lmeter_get_scale_angle(gauge);
int16_t angle_ofs = 90 + (360 - angle) / 2;
int16_t min = lv_gauge_get_min_value(gauge);
int16_t max = lv_gauge_get_max_value(gauge);
point_t p_mid;
point_t p_end;
lv_point_t p_mid;
lv_point_t p_end;
uint8_t i;
memcpy(&style_needle, style, sizeof(lv_style_t));
@@ -409,7 +409,7 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask)
style_neddle_mid.body.grad_color = style->body.border.color;
style_neddle_mid.body.radius = LV_RADIUS_CIRCLE;
area_t nm_cord;
lv_area_t nm_cord;
nm_cord.x1 = x_ofs - style->body.padding.ver;
nm_cord.y1 = y_ofs - style->body.padding.ver;
nm_cord.x2 = x_ofs + style->body.padding.ver;

View File

@@ -46,7 +46,7 @@ typedef struct
lv_lmeter_ext_t lmeter; /*Ext. of ancestor*/
/*New data for this type */
int16_t * values; /*Array of the set values (for needles) */
color_t * needle_colors; /*Color of the needles (color_t my_colors[needle_num])*/
lv_color_t * needle_colors; /*Color of the needles (lv_color_t my_colors[needle_num])*/
uint8_t needle_count; /*Number of needles*/
uint8_t label_count; /*Number of labels on the scale*/
}lv_gauge_ext_t;
@@ -73,7 +73,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy);
* @param needle_cnt new count of needles
* @param colors an array of colors for needles (with 'num' elements)
*/
void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, color_t * colors);
void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, lv_color_t * colors);
/**
* Set the value of a needle

View File

@@ -28,7 +28,7 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool lv_img_design(lv_obj_t * img, const area_t * mask, lv_design_mode_t mode);
static bool lv_img_design(lv_obj_t * img, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param);
static bool lv_img_is_symbol(const char * txt);
@@ -106,7 +106,7 @@ fs_res_t lv_img_create_file(const char * fn, const color_int_t * data)
#if USE_UFS != 0
const lv_img_raw_header_t * raw_p = (lv_img_raw_header_t *) data;
fs_res_t res;
res = ufs_create_const(fn, data, raw_p->w * raw_p->h * sizeof(color_t) + sizeof(lv_img_raw_header_t));
res = ufs_create_const(fn, data, raw_p->w * raw_p->h * sizeof(lv_color_t) + sizeof(lv_img_raw_header_t));
return res;
#else
@@ -162,15 +162,15 @@ void lv_img_set_file(lv_obj_t * img, const char * fn)
/*Handle symbol texts*/
else {
lv_style_t * style = lv_obj_get_style(img);
point_t size;
txt_get_size(&size, fn, style->text.font, style->text.letter_space, style->text.line_space, CORD_MAX, TXT_FLAG_NONE);
lv_point_t size;
txt_get_size(&size, fn, style->text.font, style->text.letter_space, style->text.line_space, LV_COORD_MAX, TXT_FLAG_NONE);
ext->w = size.x;
ext->h = size.y;
ext->transp = 1; /*Symbols always have transparent parts*/
}
if(fn != NULL) {
ext->fn = dm_realloc(ext->fn, strlen(fn) + 1);
ext->fn = lv_mem_realloc(ext->fn, strlen(fn) + 1);
strcpy(ext->fn, fn);
} else {
ext->fn = NULL;
@@ -273,25 +273,25 @@ bool lv_img_get_upscale(lv_obj_t * img)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_img_design(lv_obj_t * img, const area_t * mask, lv_design_mode_t mode)
static bool lv_img_design(lv_obj_t * img, const lv_area_t * mask, lv_design_mode_t mode)
{
lv_style_t * style = lv_obj_get_style(img);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
if(mode == LV_DESIGN_COVER_CHK) {
bool cover = false;
if(ext->transp == 0) cover = area_is_in(mask, &img->coords);
if(ext->transp == 0) cover = lv_area_is_in(mask, &img->coords);
return cover;
} else if(mode == LV_DESIGN_DRAW_MAIN) {
if(ext->h == 0 || ext->w == 0) return true;
area_t cords;
lv_area_t cords;
/*Create a default style for symbol texts*/
bool sym = lv_img_is_symbol(ext->fn);
lv_obj_get_coords(img, &cords);
area_t cords_tmp;
lv_area_t cords_tmp;
cords_tmp.y1 = cords.y1;
cords_tmp.y2 = cords.y1 + ext->h - 1;
@@ -327,7 +327,7 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
if(sign == LV_SIGNAL_CLEANUP) {
dm_free(ext->fn);
lv_mem_free(ext->fn);
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
/*Refresh the file name to refresh the symbol text size*/

View File

@@ -42,8 +42,8 @@ typedef struct
/*No inherited ext. because inherited from the base object*/ /*Ext. of ancestor*/
/*New data for this type */
char* fn; /*Image file name. E.g. "U:/my_image"*/
cord_t w; /*Width of the image (doubled when upscaled) (Handled by the library)*/
cord_t h; /*Height of the image (doubled when upscaled) (Handled by the library)*/
lv_coord_t w; /*Width of the image (doubled when upscaled) (Handled by the library)*/
lv_coord_t h; /*Height of the image (doubled when upscaled) (Handled by the library)*/
uint8_t auto_size :1; /*1: automatically set the object size to the image size*/
uint8_t upscale :1; /*1: upscale to double size with antialaissing*/
uint8_t transp :1; /*Transp. bit in the image header (Handled by the library)*/

View File

@@ -39,11 +39,11 @@
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param);
static bool lv_label_design(lv_obj_t * label, const area_t * mask, lv_design_mode_t mode);
static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_mode_t mode);
static void lv_label_refr_text(lv_obj_t * label);
static void lv_label_revert_dots(lv_obj_t *label);
static void lv_label_set_offset_x(lv_obj_t * label, cord_t x);
static void lv_label_set_offset_y(lv_obj_t * label, cord_t y);
static void lv_label_set_offset_x(lv_obj_t * label, lv_coord_t x);
static void lv_label_set_offset_y(lv_obj_t * label, lv_coord_t y);
/**********************
* STATIC VARIABLES
@@ -109,7 +109,7 @@ lv_obj_t * lv_label_create(lv_obj_t * par, lv_obj_t * copy)
/*In DOT mode save the text byte-to-byte because a '\0' can be in the middle*/
if(copy_ext->long_mode == LV_LABEL_LONG_DOT) {
ext->text = dm_realloc(ext->text, dm_get_size(copy_ext->text));
ext->text = lv_mem_realloc(ext->text, dm_get_size(copy_ext->text));
memcpy(ext->text, copy_ext->text, dm_get_size(copy_ext->text));
}
@@ -145,16 +145,16 @@ void lv_label_set_text(lv_obj_t * label, const char * text)
if(ext->text == text) {
/*If set its own text then reallocate it (maybe its size changed)*/
ext->text = dm_realloc(ext->text, strlen(ext->text) + 1);
ext->text = lv_mem_realloc(ext->text, strlen(ext->text) + 1);
} else {
/*Allocate space for the new text*/
uint32_t len = strlen(text) + 1;
if(ext->text != NULL && ext->static_txt == 0) {
dm_free(ext->text);
lv_mem_free(ext->text);
ext->text = NULL;
}
ext->text = dm_alloc(len);
ext->text = lv_mem_alloc(len);
strcpy(ext->text, text);
ext->static_txt = 0; /*Now the text is dynamically allocated*/
}
@@ -182,10 +182,10 @@ void lv_label_set_array_text(lv_obj_t * label, const char * array, uint16_t size
/*Allocate space for the new text*/
if(ext->text != NULL && ext->static_txt == 0) {
dm_free(ext->text);
lv_mem_free(ext->text);
ext->text = NULL;
}
ext->text = dm_alloc(size + 1);
ext->text = lv_mem_alloc(size + 1);
memcpy(ext->text, array, size);
ext->text[size] = '\0';
ext->static_txt = 0; /*Now the text is dynamically allocated*/
@@ -203,7 +203,7 @@ void lv_label_set_static_text(lv_obj_t * label, const char * text)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if(ext->static_txt == 0 && ext->text != NULL) {
dm_free(ext->text);
lv_mem_free(ext->text);
ext->text = NULL;
}
@@ -225,10 +225,10 @@ void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode)
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
/*Delete the old animation (if exists)*/
anim_del(label, (anim_fp_t) lv_obj_set_x);
anim_del(label, (anim_fp_t) lv_obj_set_y);
anim_del(label, (anim_fp_t) lv_label_set_offset_x);
anim_del(label, (anim_fp_t) lv_label_set_offset_y);
lv_anim_del(label, (lv_anim_fp_t) lv_obj_set_x);
lv_anim_del(label, (lv_anim_fp_t) lv_obj_set_y);
lv_anim_del(label, (lv_anim_fp_t) lv_label_set_offset_x);
lv_anim_del(label, (lv_anim_fp_t) lv_label_set_offset_y);
ext->offset.x = 0;
ext->offset.y = 0;
@@ -398,17 +398,17 @@ uint16_t lv_label_get_anim_speed(lv_obj_t *label)
* @param index index of the letter [0 ... text length]. Expressed in character index, not byte index (different in UTF-8)
* @param pos store the result here (E.g. index = 0 gives 0;0 coordinates)
*/
void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos)
void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, lv_point_t * pos)
{
const char * txt = lv_label_get_text(label);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
uint32_t line_start = 0;
uint32_t new_line_start = 0;
cord_t max_w = lv_obj_get_width(label);
lv_coord_t max_w = lv_obj_get_width(label);
lv_style_t * style = lv_obj_get_style(label);
const font_t * font = style->text.font;
uint8_t letter_height = font_get_height_scale(font);
cord_t y = 0;
const lv_font_t * font = style->text.font;
uint8_t letter_height = lv_font_get_height_scale(font);
lv_coord_t y = 0;
txt_flag_t flag = TXT_FLAG_NONE;
if(ext->recolor != 0) flag |= TXT_FLAG_RECOLOR;
@@ -418,7 +418,7 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos)
/*If the width will be expanded the set the max length to very big */
if(ext->long_mode == LV_LABEL_LONG_EXPAND || ext->long_mode == LV_LABEL_LONG_SCROLL) {
max_w = CORD_MAX;
max_w = LV_COORD_MAX;
}
index = txt_utf8_get_byte_id(txt, index);
@@ -439,7 +439,7 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos)
}
/*Calculate the x coordinate*/
cord_t x = 0;
lv_coord_t x = 0;
uint32_t i = line_start;
uint32_t cnt = line_start; /*Count the letter (in UTF-8 1 letter not 1 byte)*/
txt_cmd_state_t cmd_state = TXT_CMD_STATE_WAIT;
@@ -453,11 +453,11 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos)
continue; /*Skip the letter is it is part of a command*/
}
}
x += font_get_width_scale(font, letter) + style->text.letter_space;
x += lv_font_get_width_scale(font, letter) + style->text.letter_space;
}
if(ext->align == LV_LABEL_ALIGN_CENTER) {
cord_t line_w;
lv_coord_t line_w;
line_w = txt_get_width(&txt[line_start], new_line_start - line_start,
font, style->text.letter_space, flag);
x += lv_obj_get_width(label) / 2 - line_w / 2;
@@ -475,17 +475,17 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos)
* @return the index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter)
* Expressed in character index and not byte index (different in UTF-8)
*/
uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos)
uint16_t lv_label_get_letter_on(lv_obj_t * label, lv_point_t * pos)
{
const char * txt = lv_label_get_text(label);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
uint32_t line_start = 0;
uint32_t new_line_start = 0;
cord_t max_w = lv_obj_get_width(label);
lv_coord_t max_w = lv_obj_get_width(label);
lv_style_t * style = lv_obj_get_style(label);
const font_t * font = style->text.font;
uint8_t letter_height = font_get_height_scale(font);
cord_t y = 0;
const lv_font_t * font = style->text.font;
uint8_t letter_height = lv_font_get_height_scale(font);
lv_coord_t y = 0;
txt_flag_t flag = TXT_FLAG_NONE;
if(ext->recolor != 0) flag |= TXT_FLAG_RECOLOR;
@@ -495,7 +495,7 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos)
/*If the width will be expanded set the max length to very big */
if(ext->long_mode == LV_LABEL_LONG_EXPAND || ext->long_mode == LV_LABEL_LONG_SCROLL) {
max_w = CORD_MAX;
max_w = LV_COORD_MAX;
}
/*Search the line of the index letter */;
@@ -507,9 +507,9 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos)
}
/*Calculate the x coordinate*/
cord_t x = 0;
lv_coord_t x = 0;
if(ext->align == LV_LABEL_ALIGN_CENTER) {
cord_t line_w;
lv_coord_t line_w;
line_w = txt_get_width(&txt[line_start], new_line_start - line_start,
font, style->text.letter_space, flag);
x += lv_obj_get_width(label) / 2 - line_w / 2;
@@ -528,7 +528,7 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos)
}
}
x += font_get_width_scale(font, letter);
x += lv_font_get_width_scale(font, letter);
if(pos->x < x) {
i = i_current;
break;
@@ -566,7 +566,7 @@ void lv_label_ins_text(lv_obj_t * label, uint32_t pos, const char * txt)
uint32_t old_len = strlen(ext->text);
uint32_t ins_len = strlen(txt);
uint32_t new_len = ins_len + old_len;
ext->text = dm_realloc(ext->text, new_len + 1);
ext->text = lv_mem_realloc(ext->text, new_len + 1);
if(pos == LV_LABEL_POS_LAST) {
#if TXT_UTF8 == 0
@@ -619,12 +619,12 @@ void lv_label_cut_text(lv_obj_t * label, uint32_t pos, uint32_t cnt)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_label_design(lv_obj_t * label, const area_t * mask, lv_design_mode_t mode)
static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_mode_t mode)
{
/* A label never covers an area */
if(mode == LV_DESIGN_COVER_CHK) return false;
else if(mode == LV_DESIGN_DRAW_MAIN) {
area_t cords;
lv_area_t cords;
lv_style_t * style = lv_obj_get_style(label);
lv_obj_get_coords(label, &cords);
@@ -640,7 +640,7 @@ static bool lv_label_design(lv_obj_t * label, const area_t * mask, lv_design_mod
if(ext->body_draw) lv_draw_rect(&cords, mask, style);
/*TEST: draw a background for the label*/
// lv_vfill(&label->coords, mask, COLOR_LIME, OPA_COVER);
// lv_vfill(&label->coords, mask, LV_COLOR_LIME, LV_OPA_COVER);
txt_flag_t flag = TXT_FLAG_NONE;
if(ext->recolor != 0) flag |= TXT_FLAG_RECOLOR;
@@ -673,7 +673,7 @@ static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if(sign == LV_SIGNAL_CLEANUP) {
if(ext->static_txt == 0) {
dm_free(ext->text);
lv_mem_free(ext->text);
ext->text = NULL;
}
}
@@ -705,18 +705,18 @@ static void lv_label_refr_text(lv_obj_t * label)
if(ext->text == NULL) return;
cord_t max_w = lv_obj_get_width(label);
lv_coord_t max_w = lv_obj_get_width(label);
lv_style_t * style = lv_obj_get_style(label);
const font_t * font = style->text.font;
const lv_font_t * font = style->text.font;
/*If the width will be expanded set the max length to very big */
if(ext->long_mode == LV_LABEL_LONG_EXPAND ||
ext->long_mode == LV_LABEL_LONG_SCROLL) {
max_w = CORD_MAX;
max_w = LV_COORD_MAX;
}
/*Calc. the height and longest line*/
point_t size;
lv_point_t size;
txt_flag_t flag = TXT_FLAG_NONE;
if(ext->recolor != 0) flag |= TXT_FLAG_RECOLOR;
if(ext->expand != 0) flag |= TXT_FLAG_EXPAND;
@@ -732,69 +732,69 @@ static void lv_label_refr_text(lv_obj_t * label)
lv_obj_t * parent = lv_obj_get_parent(label);
/*Delete the potential previous scroller animations*/
anim_del(label, (anim_fp_t) lv_obj_set_x);
anim_del(label, (anim_fp_t) lv_obj_set_y);
lv_anim_del(label, (lv_anim_fp_t) lv_obj_set_x);
lv_anim_del(label, (lv_anim_fp_t) lv_obj_set_y);
anim_t anim;
lv_anim_t anim;
anim.var = label;
anim.repeat = 1;
anim.playback = 1;
anim.start = font_get_width_scale(font, ' ');
anim.start = lv_font_get_width_scale(font, ' ');
anim.act_time = 0;
anim.end_cb = NULL;
anim.path = anim_get_path(ANIM_PATH_LIN);
anim.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
anim.time = 3000;
anim.playback_pause = (((font_get_width_scale(style->text.font, ' ') + style->text.letter_space) * 1000) /ext->anim_speed)
anim.playback_pause = (((lv_font_get_width_scale(style->text.font, ' ') + style->text.letter_space) * 1000) /ext->anim_speed)
* ANIM_WAIT_CHAR_COUNT;
anim.repeat_pause = anim.playback_pause;
if(lv_obj_get_width(label) > lv_obj_get_width(parent)) {
anim.end = lv_obj_get_width(parent) - lv_obj_get_width(label) - font_get_width_scale(font, ' ');
anim.fp = (anim_fp_t) lv_obj_set_x;
anim.time = anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
anim_create(&anim);
anim.end = lv_obj_get_width(parent) - lv_obj_get_width(label) - lv_font_get_width_scale(font, ' ');
anim.fp = (lv_anim_fp_t) lv_obj_set_x;
anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
lv_anim_create(&anim);
} else if(lv_obj_get_height(label) > lv_obj_get_height(parent)) {
anim.end = lv_obj_get_height(parent) - lv_obj_get_height(label) - font_get_height_scale(font);
anim.fp = (anim_fp_t)lv_obj_set_y;
anim.time = anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
anim_create(&anim);
anim.end = lv_obj_get_height(parent) - lv_obj_get_height(label) - lv_font_get_height_scale(font);
anim.fp = (lv_anim_fp_t)lv_obj_set_y;
anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
lv_anim_create(&anim);
}
}
}
/*In roll mode keep the size but start offset animations*/
else if(ext->long_mode == LV_LABEL_LONG_ROLL) {
anim_t anim;
lv_anim_t anim;
anim.var = label;
anim.repeat = 1;
anim.playback = 1;
anim.start = font_get_width_scale(font, ' ');
anim.start = lv_font_get_width_scale(font, ' ');
anim.act_time = 0;
anim.end_cb = NULL;
anim.path = anim_get_path(ANIM_PATH_LIN);
anim.playback_pause = (((font_get_width_scale(style->text.font, ' ') + style->text.letter_space) * 1000) / ext->anim_speed) * ANIM_WAIT_CHAR_COUNT;;
anim.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
anim.playback_pause = (((lv_font_get_width_scale(style->text.font, ' ') + style->text.letter_space) * 1000) / ext->anim_speed) * ANIM_WAIT_CHAR_COUNT;;
anim.repeat_pause = anim.playback_pause;
bool hor_anim = false;
if(size.x > lv_obj_get_width(label)) {
anim.end = lv_obj_get_width(label) - size.x - font_get_width_scale(font, ' ');
anim.fp = (anim_fp_t) lv_label_set_offset_x;
anim.time = anim_speed_to_time(LV_LABEL_SCROLL_SPEED, anim.start, anim.end);
anim_create(&anim);
anim.end = lv_obj_get_width(label) - size.x - lv_font_get_width_scale(font, ' ');
anim.fp = (lv_anim_fp_t) lv_label_set_offset_x;
anim.time = lv_anim_speed_to_time(LV_LABEL_SCROLL_SPEED, anim.start, anim.end);
lv_anim_create(&anim);
hor_anim = true;
} else {
/*Delete the offset animation if not required*/
anim_del(label, (anim_fp_t) lv_label_set_offset_x);
lv_anim_del(label, (lv_anim_fp_t) lv_label_set_offset_x);
ext->offset.x = 0;
}
if(size.y > lv_obj_get_height(label) && hor_anim == false) {
anim.end = lv_obj_get_height(label) - size.y - (font_get_height_scale(font));
anim.fp = (anim_fp_t)lv_label_set_offset_y;
anim.time = anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
anim_create(&anim);
anim.end = lv_obj_get_height(label) - size.y - (lv_font_get_height_scale(font));
anim.fp = (lv_anim_fp_t)lv_label_set_offset_y;
anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
lv_anim_create(&anim);
} else {
/*Delete the offset animation if not required*/
anim_del(label, (anim_fp_t) lv_label_set_offset_y);
lv_anim_del(label, (lv_anim_fp_t) lv_label_set_offset_y);
ext->offset.y = 0;
}
}
@@ -804,10 +804,10 @@ static void lv_label_refr_text(lv_obj_t * label)
} else if(txt_len(ext->text) <= LV_LABEL_DOT_NUM) { /*Don't turn to dots all the characters*/
ext->dot_end = LV_LABEL_DOT_END_INV;
} else {
point_t p;
p.x = lv_obj_get_width(label) - (font_get_width_scale(style->text.font, '.') + style->text.letter_space) * LV_LABEL_DOT_NUM; /*Shrink with dots*/
lv_point_t p;
p.x = lv_obj_get_width(label) - (lv_font_get_width_scale(style->text.font, '.') + style->text.letter_space) * LV_LABEL_DOT_NUM; /*Shrink with dots*/
p.y = lv_obj_get_height(label);
p.y -= p.y % (font_get_height_scale(style->text.font) + style->text.line_space); /*Round down to the last line*/
p.y -= p.y % (lv_font_get_height_scale(style->text.font) + style->text.line_space); /*Round down to the last line*/
p.y -= style->text.line_space; /*Trim the last line space*/
uint32_t letter_id = lv_label_get_letter_on(label, &p);
@@ -882,14 +882,14 @@ static void lv_label_revert_dots(lv_obj_t *label)
ext->dot_end = LV_LABEL_DOT_END_INV;
}
static void lv_label_set_offset_x(lv_obj_t * label, cord_t x)
static void lv_label_set_offset_x(lv_obj_t * label, lv_coord_t x)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
ext->offset.x = x;
lv_obj_invalidate(label);
}
static void lv_label_set_offset_y(lv_obj_t * label, cord_t y)
static void lv_label_set_offset_y(lv_obj_t * label, lv_coord_t y)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
ext->offset.y = y;

View File

@@ -61,7 +61,7 @@ typedef struct
#endif
uint16_t dot_end; /*The text end position in dot mode (Handled by the library)*/
uint16_t anim_speed; /*Speed of scroll and roll animation in px/sec unit*/
point_t offset; /*Text draw position offset*/
lv_point_t offset; /*Text draw position offset*/
uint8_t static_txt :1; /*Flag to indicate the text is static*/
uint8_t align :2; /*Align type from 'lv_label_align_t'*/
uint8_t recolor :1; /*Enable in-line letter re-coloring*/
@@ -220,7 +220,7 @@ uint16_t lv_label_get_anim_speed(lv_obj_t *label);
* @param index index of the letter [0 ... text length]. Expressed in character index, not byte index (different in UTF-8)
* @param pos store the result here (E.g. index = 0 gives 0;0 coordinates)
*/
void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos);
void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, lv_point_t * pos);
/**
* Get the index of letter on a relative point of a label
@@ -229,7 +229,7 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos);
* @return the index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter)
* Expressed in character index and not byte index (different in UTF-8)
*/
uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos);
uint16_t lv_label_get_letter_on(lv_obj_t * label, lv_point_t * pos);
/**
* Get the style of an label object

View File

@@ -28,7 +28,7 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool lv_led_design(lv_obj_t * led, const area_t * mask, lv_design_mode_t mode);
static bool lv_led_design(lv_obj_t * led, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_led_signal(lv_obj_t * led, lv_signal_t sign, void * param);
/**********************
@@ -169,7 +169,7 @@ uint8_t lv_led_get_bright(lv_obj_t * led)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_led_design(lv_obj_t * led, const area_t * mask, lv_design_mode_t mode)
static bool lv_led_design(lv_obj_t * led, const lv_area_t * mask, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
/*Return false if the object is not covers the mask area*/
@@ -189,9 +189,9 @@ static bool lv_led_design(lv_obj_t * led, const area_t * mask, lv_design_mode_t
memcpy(&leds_tmp, style, sizeof(leds_tmp));
/*Mix. the color with black proportionally with brightness*/
leds_tmp.body.main_color = color_mix(leds_tmp.body.main_color, COLOR_BLACK, ext->bright);
leds_tmp.body.grad_color = color_mix(leds_tmp.body.grad_color, COLOR_BLACK, ext->bright);
leds_tmp.body.border.color = color_mix(leds_tmp.body.border.color, COLOR_BLACK, ext->bright);
leds_tmp.body.main_color = lv_color_mix(leds_tmp.body.main_color, LV_COLOR_BLACK, ext->bright);
leds_tmp.body.grad_color = lv_color_mix(leds_tmp.body.grad_color, LV_COLOR_BLACK, ext->bright);
leds_tmp.body.border.color = lv_color_mix(leds_tmp.body.border.color, LV_COLOR_BLACK, ext->bright);
/*Set the current swidth according to brightness proportionally between LV_LED_BRIGHT_OFF and LV_LED_BRIGHT_ON*/
uint16_t bright_tmp = ext->bright;

View File

@@ -28,7 +28,7 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool lv_line_design(lv_obj_t * line, const area_t * mask, lv_design_mode_t mode);
static bool lv_line_design(lv_obj_t * line, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param);
/**********************
@@ -99,7 +99,7 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy)
* so the array can NOT be a local variable which will be destroyed
* @param point_num number of points in 'point_a'
*/
void lv_line_set_points(lv_obj_t * line, const point_t * point_a, uint16_t point_num)
void lv_line_set_points(lv_obj_t * line, const lv_point_t * point_a, uint16_t point_num)
{
lv_line_ext_t * ext = lv_obj_get_ext_attr(line);
ext->point_array = point_a;
@@ -112,8 +112,8 @@ void lv_line_set_points(lv_obj_t * line, const point_t * point_a, uint16_t point
if(point_num > 0 && ext->auto_size != 0) {
uint16_t i;
cord_t xmax = CORD_MIN;
cord_t ymax = CORD_MIN;
lv_coord_t xmax = LV_COORD_MIN;
lv_coord_t ymax = LV_COORD_MIN;
for(i = 0; i < point_num; i++) {
xmax = MATH_MAX(point_a[i].x * us, xmax);
ymax = MATH_MAX(point_a[i].y * us, ymax);
@@ -225,7 +225,7 @@ bool lv_line_get_upscale(lv_obj_t * line)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_line_design(lv_obj_t * line, const area_t * mask, lv_design_mode_t mode)
static bool lv_line_design(lv_obj_t * line, const lv_area_t * mask, lv_design_mode_t mode)
{
/*A line never covers an area*/
if(mode == LV_DESIGN_COVER_CHK) return false;
@@ -235,13 +235,13 @@ static bool lv_line_design(lv_obj_t * line, const area_t * mask, lv_design_mode_
if(ext->point_num == 0 || ext->point_array == NULL) return false;
lv_style_t * style = lv_obj_get_style(line);
area_t area;
lv_area_t area;
lv_obj_get_coords(line, &area);
cord_t x_ofs = area.x1;
cord_t y_ofs = area.y1;
point_t p1;
point_t p2;
cord_t h = lv_obj_get_height(line);
lv_coord_t x_ofs = area.x1;
lv_coord_t y_ofs = area.y1;
lv_point_t p1;
lv_point_t p2;
lv_coord_t h = lv_obj_get_height(line);
uint16_t i;
uint8_t us = 1;
if(ext->upscale != 0) {

View File

@@ -30,7 +30,7 @@ extern "C" {
typedef struct
{
/*Inherited from 'base_obj' so no inherited ext.*/ /*Ext. of ancestor*/
const point_t * point_array; /*Pointer to an array with the points of the line*/
const lv_point_t * point_array; /*Pointer to an array with the points of the line*/
uint16_t point_num; /*Number of points in 'point_array' */
uint8_t auto_size :1; /*1: set obj. width to x max and obj. height to y max */
uint8_t y_inv :1; /*1: y == 0 will be on the bottom*/
@@ -60,7 +60,7 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy);
* so the array can NOT be a local variable which will be destroyed
* @param point_num number of points in 'point_a'
*/
void lv_line_set_points(lv_obj_t * line, const point_t * point_a, uint16_t point_num);
void lv_line_set_points(lv_obj_t * line, const lv_point_t * point_a, uint16_t point_num);
/**
* Enable (or disable) the auto-size option. The size of the object will fit to its points.

View File

@@ -156,9 +156,9 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l
if(btn_signal == NULL) btn_signal = lv_obj_get_signal_func(liste);
/*Make the size adjustment*/
cord_t w = lv_obj_get_width(list);
lv_coord_t w = lv_obj_get_width(list);
lv_style_t * style_scrl = lv_obj_get_style(lv_page_get_scrl(list));
cord_t pad_hor_tot = style->body.padding.hor + style_scrl->body.padding.hor;
lv_coord_t pad_hor_tot = style->body.padding.hor + style_scrl->body.padding.hor;
w -= pad_hor_tot * 2;
lv_obj_set_width(liste, w);
@@ -367,17 +367,17 @@ void lv_list_up(lv_obj_t * list)
while(e != NULL) {
if(e->coords.y2 <= list->coords.y2) {
if(e_prev != NULL) {
cord_t new_y = lv_obj_get_height(list) - (lv_obj_get_y(e_prev) + lv_obj_get_height(e_prev));
lv_coord_t new_y = lv_obj_get_height(list) - (lv_obj_get_y(e_prev) + lv_obj_get_height(e_prev));
lv_list_ext_t *ext = lv_obj_get_ext_attr(list);
if(ext->anim_time == 0) {
lv_obj_set_y(scrl, new_y);
} else {
anim_t a;
lv_anim_t a;
a.var = scrl;
a.start = lv_obj_get_y(scrl);
a.end = new_y;
a.fp = (anim_fp_t)lv_obj_set_y;
a.path = anim_get_path(ANIM_PATH_LIN);
a.fp = (lv_anim_fp_t)lv_obj_set_y;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.end_cb = NULL;
a.act_time = 0;
a.time = LV_LIST_FOCUS_TIME;
@@ -385,7 +385,7 @@ void lv_list_up(lv_obj_t * list)
a.playback_pause = 0;
a.repeat = 0;
a.repeat_pause = 0;
anim_create(&a);
lv_anim_create(&a);
}
}
break;
@@ -408,17 +408,17 @@ void lv_list_down(lv_obj_t * list)
e = get_next_btn(list, NULL);
while(e != NULL) {
if(e->coords.y1 < list->coords.y1) {
cord_t new_y = -lv_obj_get_y(e);
lv_coord_t new_y = -lv_obj_get_y(e);
lv_list_ext_t *ext = lv_obj_get_ext_attr(list);
if(ext->anim_time == 0) {
lv_obj_set_y(scrl, new_y);
} else {
anim_t a;
lv_anim_t a;
a.var = scrl;
a.start = lv_obj_get_y(scrl);
a.end = new_y;
a.fp = (anim_fp_t)lv_obj_set_y;
a.path = anim_get_path(ANIM_PATH_LIN);
a.fp = (lv_anim_fp_t)lv_obj_set_y;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.end_cb = NULL;
a.act_time = 0;
a.time = LV_LIST_FOCUS_TIME;
@@ -426,7 +426,7 @@ void lv_list_down(lv_obj_t * list)
a.playback_pause = 0;
a.repeat = 0;
a.repeat_pause = 0;
anim_create(&a);
lv_anim_create(&a);
}
break;
}
@@ -467,7 +467,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
if(sign == LV_SIGNAL_CORD_CHG) {
/*Be sure the width of the buttons are correct*/
cord_t w = lv_obj_get_width(list);
lv_coord_t w = lv_obj_get_width(list);
if(w != area_get_width(param)) { /*Width changed*/
refr_btn_width(list);
}
@@ -588,8 +588,8 @@ static void refr_btn_width(lv_obj_t *list)
{
lv_style_t *style = lv_list_get_style(list, LV_LIST_STYLE_BG);
lv_style_t *style_scrl = lv_obj_get_style(lv_page_get_scrl(list));
cord_t w = lv_obj_get_width(list);
cord_t btn_w = w - (style->body.padding.hor + style_scrl->body.padding.hor) * 2;
lv_coord_t w = lv_obj_get_width(list);
lv_coord_t btn_w = w - (style->body.padding.hor + style_scrl->body.padding.hor) * 2;
lv_obj_t *btn = get_next_btn(list, NULL);
while(btn) {

View File

@@ -26,7 +26,7 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool lv_lmeter_design(lv_obj_t * lmeter, const area_t * mask, lv_design_mode_t mode);
static bool lv_lmeter_design(lv_obj_t * lmeter, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_lmeter_signal(lv_obj_t * lmeter, lv_signal_t sign, void * param);
/**********************
@@ -227,7 +227,7 @@ uint16_t lv_lmeter_get_scale_angle(lv_obj_t * lmeter)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_lmeter_design(lv_obj_t * lmeter, const area_t * mask, lv_design_mode_t mode)
static bool lv_lmeter_design(lv_obj_t * lmeter, const lv_area_t * mask, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
@@ -249,10 +249,10 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const area_t * mask, lv_design_m
}
#endif
cord_t r_out = lv_obj_get_width(lmeter) / 2;
cord_t r_in = r_out - style->body.padding.hor;
cord_t x_ofs = lv_obj_get_width(lmeter) / 2 + lmeter->coords.x1;
cord_t y_ofs = lv_obj_get_height(lmeter) / 2 + lmeter->coords.y1;
lv_coord_t r_out = lv_obj_get_width(lmeter) / 2;
lv_coord_t r_in = r_out - style->body.padding.hor;
lv_coord_t x_ofs = lv_obj_get_width(lmeter) / 2 + lmeter->coords.x1;
lv_coord_t y_ofs = lv_obj_get_height(lmeter) / 2 + lmeter->coords.y1;
int16_t angle_ofs = 90 + (360 - ext->scale_angle) / 2;
int16_t level = (int32_t)((int32_t)(ext->cur_value - ext->min_value) * ext->line_cnt) / (ext->max_value - ext->min_value);
uint8_t i;
@@ -263,13 +263,13 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const area_t * mask, lv_design_m
/*Calculate the position a scale label*/
int16_t angle = (i * ext->scale_angle) / (ext->line_cnt - 1) + angle_ofs;
cord_t y_out = (int32_t)((int32_t)trigo_sin(angle) * r_out) / TRIGO_SIN_MAX;
cord_t x_out = (int32_t)((int32_t)trigo_sin(angle + 90) * r_out) / TRIGO_SIN_MAX;
cord_t y_in = (int32_t)((int32_t)trigo_sin(angle) * r_in) / TRIGO_SIN_MAX;
cord_t x_in = (int32_t)((int32_t)trigo_sin(angle + 90) * r_in) / TRIGO_SIN_MAX;
lv_coord_t y_out = (int32_t)((int32_t)trigo_sin(angle) * r_out) / TRIGO_SIN_MAX;
lv_coord_t x_out = (int32_t)((int32_t)trigo_sin(angle + 90) * r_out) / TRIGO_SIN_MAX;
lv_coord_t y_in = (int32_t)((int32_t)trigo_sin(angle) * r_in) / TRIGO_SIN_MAX;
lv_coord_t x_in = (int32_t)((int32_t)trigo_sin(angle + 90) * r_in) / TRIGO_SIN_MAX;
point_t p1;
point_t p2;
lv_point_t p1;
lv_point_t p2;
p2.x = x_in + x_ofs;
p2.y = y_in + y_ofs;
@@ -279,7 +279,7 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const area_t * mask, lv_design_m
if(i > level) style_tmp.line.color = style->line.color;
else {
style_tmp.line.color = color_mix(style->body.grad_color, style->body.main_color, (255 * i) / ext->line_cnt);
style_tmp.line.color = lv_color_mix(style->body.grad_color, style->body.main_color, (255 * i) / ext->line_cnt);
}
lv_draw_line(&p1, &p2, mask, &style_tmp);

View File

@@ -210,7 +210,7 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay)
*/
void lv_mbox_stop_auto_close(lv_obj_t * mbox)
{
anim_del(mbox, NULL);
lv_anim_del(mbox, NULL);
}
/**
@@ -364,7 +364,7 @@ static void mbox_realign(lv_obj_t *mbox)
lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
lv_style_t *style = lv_mbox_get_style(mbox, LV_MBOX_STYLE_BG);
cord_t w = lv_obj_get_width(mbox) - 2 * style->body.padding.hor;
lv_coord_t w = lv_obj_get_width(mbox) - 2 * style->body.padding.hor;
if(ext->text) {
lv_obj_set_width(ext->text, w);
@@ -373,7 +373,7 @@ static void mbox_realign(lv_obj_t *mbox)
if(ext->btnm) {
lv_style_t *btn_bg_style = lv_mbox_get_style(mbox, LV_MBOX_STYLE_BTN_BG);
lv_style_t *btn_rel_style = lv_mbox_get_style(mbox, LV_MBOX_STYLE_BTN_REL);
cord_t font_h = font_get_height_scale(btn_rel_style->text.font);
lv_coord_t font_h = lv_font_get_height_scale(btn_rel_style->text.font);
lv_obj_set_size(ext->btnm, w, font_h + 2 * btn_rel_style->body.padding.ver + 2 * btn_bg_style->body.padding.ver);
}
}

View File

@@ -30,8 +30,8 @@
* STATIC PROTOTYPES
**********************/
static void lv_page_sb_refresh(lv_obj_t * main);
static bool lv_page_design(lv_obj_t * scrl, const area_t * mask, lv_design_mode_t mode);
static bool lv_scrl_design(lv_obj_t * scrl, const area_t * mask, lv_design_mode_t mode);
static bool lv_page_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode);
static bool lv_scrl_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param);
static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
@@ -190,8 +190,8 @@ void lv_page_set_style(lv_obj_t *page, lv_page_style_t type, lv_style_t *style)
break;
case LV_PAGE_STYLE_SB:
ext->sb.style = style;
area_set_height(&ext->sb.hor_area, ext->sb.style->body.padding.inner);
area_set_width(&ext->sb.ver_area, ext->sb.style->body.padding.inner);
lv_area_set_height(&ext->sb.hor_area, ext->sb.style->body.padding.inner);
lv_area_set_width(&ext->sb.ver_area, ext->sb.style->body.padding.inner);
lv_page_sb_refresh(page);
lv_obj_refresh_ext_size(page);
lv_obj_invalidate(page);
@@ -274,13 +274,13 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
lv_style_t * style = lv_page_get_style(page, LV_PAGE_STYLE_BG);
lv_style_t * style_scrl = lv_page_get_style(page, LV_PAGE_STYLE_SCRL);
cord_t obj_y = obj->coords.y1 - ext->scrl->coords.y1;
cord_t obj_h = lv_obj_get_height(obj);
cord_t scrlable_y = lv_obj_get_y(ext->scrl);
cord_t page_h = lv_obj_get_height(page);
lv_coord_t obj_y = obj->coords.y1 - ext->scrl->coords.y1;
lv_coord_t obj_h = lv_obj_get_height(obj);
lv_coord_t scrlable_y = lv_obj_get_y(ext->scrl);
lv_coord_t page_h = lv_obj_get_height(page);
cord_t top_err = -(scrlable_y + obj_y);
cord_t bot_err = scrlable_y + obj_y + obj_h - page_h;
lv_coord_t top_err = -(scrlable_y + obj_y);
lv_coord_t bot_err = scrlable_y + obj_y + obj_h - page_h;
/*If obj is higher then the page focus where the "error" is smaller*/
@@ -307,7 +307,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
lv_obj_set_y(ext->scrl, scrlable_y);
}
else {
anim_t a;
lv_anim_t a;
a.act_time = 0;
a.start = lv_obj_get_y(ext->scrl);
a.end = scrlable_y;
@@ -316,9 +316,9 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
a.playback = 0;
a.repeat = 0;
a.var = ext->scrl;
a.path = anim_get_path(ANIM_PATH_LIN);
a.fp = (anim_fp_t) lv_obj_set_y;
anim_create(&a);
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.fp = (lv_anim_fp_t) lv_obj_set_y;
lv_anim_create(&a);
}
}
@@ -336,7 +336,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_page_design(lv_obj_t * scrl, const area_t * mask, lv_design_mode_t mode)
static bool lv_page_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
return ancestor_design(scrl, mask, mode);
@@ -347,7 +347,7 @@ static bool lv_page_design(lv_obj_t * scrl, const area_t * mask, lv_design_mode_
lv_page_ext_t * ext = lv_obj_get_ext_attr(scrl);
/*Draw the scrollbars*/
area_t sb_area;
lv_area_t sb_area;
if(ext->sb.hor_draw) {
/*Convert the relative coordinates to absolute*/
area_cpy(&sb_area, &ext->sb.hor_area);
@@ -382,7 +382,7 @@ static bool lv_page_design(lv_obj_t * scrl, const area_t * mask, lv_design_mode_
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_scrl_design(lv_obj_t * scrl, const area_t * mask, lv_design_mode_t mode)
static bool lv_scrl_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
return ancestor_design(scrl, mask, mode);
@@ -395,7 +395,7 @@ static bool lv_scrl_design(lv_obj_t * scrl, const area_t * mask, lv_design_mode_
lv_obj_t * page = lv_obj_get_parent(scrl);
lv_style_t * style_page = lv_obj_get_style(page);
lv_group_t * g = lv_obj_get_group(page);
if(style_page->body.empty != 0 || style_page->body.opa == OPA_TRANSP) { /*Background is visible?*/
if(style_page->body.empty != 0 || style_page->body.opa == LV_OPA_TRANSP) { /*Background is visible?*/
if(lv_group_get_focused(g) == page) {
lv_style_t * style_mod;
style_mod = lv_group_mod_style(g, style_ori);
@@ -523,14 +523,14 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
/*Limit the position of the scrollable object to be always visible
* (Do not let its edge inner then its parent respective edge)*/
cord_t new_x;
cord_t new_y;
lv_coord_t new_x;
lv_coord_t new_y;
bool refr_x = false;
bool refr_y = false;
area_t page_cords;
area_t scrl_cords;
cord_t hpad = page_style->body.padding.hor;
cord_t vpad = page_style->body.padding.ver;
lv_area_t page_cords;
lv_area_t scrl_cords;
lv_coord_t hpad = page_style->body.padding.hor;
lv_coord_t vpad = page_style->body.padding.ver;
new_x = lv_obj_get_x(scrl);
new_y = lv_obj_get_y(scrl);
@@ -581,7 +581,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
else if(sign == LV_SIGNAL_DRAG_END) {
/*Hide scrollbars if required*/
if(page_ext->sb.mode == LV_SB_MODE_DRAG) {
area_t sb_area_tmp;
lv_area_t sb_area_tmp;
if(page_ext->sb.hor_draw) {
area_cpy(&sb_area_tmp, &page_ext->sb.hor_area);
sb_area_tmp.x1 += page->coords.x1;
@@ -629,20 +629,20 @@ static void lv_page_sb_refresh(lv_obj_t * page)
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
lv_style_t * style = lv_obj_get_style(page);
lv_obj_t * scrl = ext->scrl;
cord_t size_tmp;
cord_t scrl_w = lv_obj_get_width(scrl);
cord_t scrl_h = lv_obj_get_height(scrl);
cord_t hpad = style->body.padding.hor;
cord_t vpad = style->body.padding.ver;
cord_t obj_w = lv_obj_get_width(page);
cord_t obj_h = lv_obj_get_height(page);
lv_coord_t size_tmp;
lv_coord_t scrl_w = lv_obj_get_width(scrl);
lv_coord_t scrl_h = lv_obj_get_height(scrl);
lv_coord_t hpad = style->body.padding.hor;
lv_coord_t vpad = style->body.padding.ver;
lv_coord_t obj_w = lv_obj_get_width(page);
lv_coord_t obj_h = lv_obj_get_height(page);
/*Always let 'scrollbar width' padding above, under, left and right to the scrollbars
* else:
* - horizontal and vertical scrollbars can overlap on the corners
* - if the page has radius the scrollbar can be out of the radius */
cord_t sb_hor_pad = MATH_MAX(ext->sb.style->body.padding.inner, style->body.padding.hor);
cord_t sb_ver_pad = MATH_MAX(ext->sb.style->body.padding.inner, style->body.padding.ver);
lv_coord_t sb_hor_pad = MATH_MAX(ext->sb.style->body.padding.inner, style->body.padding.hor);
lv_coord_t sb_ver_pad = MATH_MAX(ext->sb.style->body.padding.inner, style->body.padding.ver);
if(ext->sb.mode == LV_SB_MODE_OFF) return;
@@ -652,7 +652,7 @@ static void lv_page_sb_refresh(lv_obj_t * page)
}
/*Invalidate the current (old) scrollbar areas*/
area_t sb_area_tmp;
lv_area_t sb_area_tmp;
if(ext->sb.hor_draw != 0) {
area_cpy(&sb_area_tmp, &ext->sb.hor_area);
sb_area_tmp.x1 += page->coords.x1;
@@ -680,15 +680,15 @@ static void lv_page_sb_refresh(lv_obj_t * page)
/*Horizontal scrollbar*/
if(scrl_w <= obj_w - 2 * hpad) { /*Full sized scroll bar*/
area_set_width(&ext->sb.hor_area, obj_w - 2 * sb_hor_pad);
area_set_pos(&ext->sb.hor_area, sb_hor_pad, obj_h - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.ver);
lv_area_set_width(&ext->sb.hor_area, obj_w - 2 * sb_hor_pad);
lv_area_set_pos(&ext->sb.hor_area, sb_hor_pad, obj_h - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.ver);
if(ext->sb.mode == LV_SB_MODE_AUTO || ext->sb.mode == LV_SB_MODE_DRAG) ext->sb.hor_draw = 0;
} else {
size_tmp = (obj_w * (obj_w - (2 * sb_hor_pad))) / (scrl_w + 2 * hpad);
if(size_tmp < LV_PAGE_SB_MIN_SIZE) size_tmp = LV_PAGE_SB_MIN_SIZE;
area_set_width(&ext->sb.hor_area, size_tmp);
lv_area_set_width(&ext->sb.hor_area, size_tmp);
area_set_pos(&ext->sb.hor_area, sb_hor_pad +
lv_area_set_pos(&ext->sb.hor_area, sb_hor_pad +
(-(lv_obj_get_x(scrl) - hpad) * (obj_w - size_tmp - 2 * sb_hor_pad)) /
(scrl_w + 2 * hpad - obj_w ),
obj_h - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.ver);
@@ -698,15 +698,15 @@ static void lv_page_sb_refresh(lv_obj_t * page)
/*Vertical scrollbar*/
if(scrl_h <= obj_h - 2 * vpad) { /*Full sized scroll bar*/
area_set_height(&ext->sb.ver_area, obj_h - 2 * sb_ver_pad);
area_set_pos(&ext->sb.ver_area, obj_w - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.hor, sb_ver_pad);
lv_area_set_height(&ext->sb.ver_area, obj_h - 2 * sb_ver_pad);
lv_area_set_pos(&ext->sb.ver_area, obj_w - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.hor, sb_ver_pad);
if(ext->sb.mode == LV_SB_MODE_AUTO || ext->sb.mode == LV_SB_MODE_DRAG) ext->sb.ver_draw = 0;
} else {
size_tmp = (obj_h * (obj_h - (2 * sb_ver_pad))) / (scrl_h + 2 * vpad);
if(size_tmp < LV_PAGE_SB_MIN_SIZE) size_tmp = LV_PAGE_SB_MIN_SIZE;
area_set_height(&ext->sb.ver_area, size_tmp);
lv_area_set_height(&ext->sb.ver_area, size_tmp);
area_set_pos(&ext->sb.ver_area, obj_w - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.hor,
lv_area_set_pos(&ext->sb.ver_area, obj_w - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.hor,
sb_ver_pad +
(-(lv_obj_get_y(scrl) - vpad) * (obj_h - size_tmp - 2 * sb_ver_pad)) /
(scrl_h + 2 * vpad - obj_h ));

View File

@@ -51,8 +51,8 @@ typedef struct
lv_action_t pr_action; /*Function to call when the page is pressed*/
struct {
lv_style_t *style; /*Style of scrollbars*/
area_t hor_area; /*Horizontal scrollbar area relative to the page. (Handled by the library) */
area_t ver_area; /*Vertical scrollbar area relative to the page (Handled by the library)*/
lv_area_t hor_area; /*Horizontal scrollbar area relative to the page. (Handled by the library) */
lv_area_t ver_area; /*Vertical scrollbar area relative to the page (Handled by the library)*/
uint8_t hor_draw :1; /*1: horizontal scrollbar is visible now (Handled by the library)*/
uint8_t ver_draw :1; /*1: vertical scrollbar is visible now (Handled by the library)*/
uint8_t mode :3; /*Scrollbar visibility from 'lv_page_sb_mode_t'*/
@@ -129,7 +129,7 @@ static inline void lv_page_set_scrl_fit(lv_obj_t *page, bool hor_en, bool ver_en
* @param page pointer to a page object
* @param w the new width of the scrollable (it ha no effect is horizontal fit is enabled)
*/
static inline void lv_page_set_scrl_width(lv_obj_t *page, cord_t w)
static inline void lv_page_set_scrl_width(lv_obj_t *page, lv_coord_t w)
{
lv_obj_set_width(lv_page_get_scrl(page), w);
}
@@ -139,7 +139,7 @@ static inline void lv_page_set_scrl_width(lv_obj_t *page, cord_t w)
* @param page pointer to a page object
* @param h the new height of the scrollable (it ha no effect is vertical fit is enabled)
*/
static inline void lv_page_set_scrl_height(lv_obj_t *page, cord_t h)
static inline void lv_page_set_scrl_height(lv_obj_t *page, lv_coord_t h)
{
lv_obj_set_height(lv_page_get_scrl(page), h);
@@ -179,7 +179,7 @@ lv_sb_mode_t lv_page_get_sb_mode(lv_obj_t * page);
* @param page pointer to a page object
* @return the width of the scrollable
*/
static inline cord_t lv_page_get_scrl_width(lv_obj_t *page)
static inline lv_coord_t lv_page_get_scrl_width(lv_obj_t *page)
{
return lv_obj_get_width(lv_page_get_scrl(page));
}
@@ -189,7 +189,7 @@ static inline cord_t lv_page_get_scrl_width(lv_obj_t *page)
* @param page pointer to a page object
* @return the height of the scrollable
*/
static inline cord_t lv_page_get_scrl_height(lv_obj_t *page)
static inline lv_coord_t lv_page_get_scrl_height(lv_obj_t *page)
{
return lv_obj_get_height(lv_page_get_scrl(page));
}

View File

@@ -25,11 +25,11 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool lv_roller_design(lv_obj_t * roller, const area_t * mask, lv_design_mode_t mode);
static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * param);
static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param);
static void refr_position(lv_obj_t *roller, bool anim_en);
static void draw_bg(lv_obj_t *roller, const area_t *mask);
static void draw_bg(lv_obj_t *roller, const lv_area_t *mask);
/**********************
* STATIC VARIABLES
@@ -75,7 +75,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, lv_obj_t * copy)
lv_page_set_scrl_fit(new_roller, true, false); /*Height is specified directly*/
lv_ddlist_open(new_roller, false);
lv_style_t * style_label = lv_obj_get_style(ext->ddlist.label);
lv_ddlist_set_fix_height(new_roller, font_get_height_scale(style_label->text.font) * 3 + style_label->text.line_space * 4);
lv_ddlist_set_fix_height(new_roller, lv_font_get_height_scale(style_label->text.font) * 3 + style_label->text.line_space * 4);
lv_label_set_align(ext->ddlist.label, LV_LABEL_ALIGN_CENTER);
@@ -184,7 +184,7 @@ lv_style_t * lv_roller_get_style(lv_obj_t *roller, lv_roller_style_t type)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_roller_design(lv_obj_t * roller, const area_t * mask, lv_design_mode_t mode)
static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
@@ -195,10 +195,10 @@ static bool lv_roller_design(lv_obj_t * roller, const area_t * mask, lv_design_m
draw_bg(roller, mask);
lv_style_t *style = lv_roller_get_style(roller, LV_ROLLER_STYLE_BG);
const font_t * font = style->text.font;
const lv_font_t * font = style->text.font;
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
cord_t font_h = font_get_height_scale(font);
area_t rect_area;
lv_coord_t font_h = lv_font_get_height_scale(font);
lv_area_t rect_area;
rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.line_space / 2;
rect_area.y2 = rect_area.y1 + font_h + style->text.line_space;
rect_area.x1 = roller->coords.x1;
@@ -210,17 +210,17 @@ static bool lv_roller_design(lv_obj_t * roller, const area_t * mask, lv_design_m
else if(mode == LV_DESIGN_DRAW_POST) {
lv_style_t *style = lv_roller_get_style(roller, LV_ROLLER_STYLE_BG);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
const font_t * font = style->text.font;
cord_t font_h = font_get_height_scale(font);
const lv_font_t * font = style->text.font;
lv_coord_t font_h = lv_font_get_height_scale(font);
/*Redraw the text on the selected area with a different color*/
area_t rect_area;
lv_area_t rect_area;
rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.line_space / 2;
rect_area.y2 = rect_area.y1 + font_h + style->text.line_space;
rect_area.x1 = roller->coords.x1;
rect_area.x2 = roller->coords.x2;
area_t mask_sel;
lv_area_t mask_sel;
bool area_ok;
area_ok = area_union(&mask_sel, mask, &rect_area);
area_ok = lv_area_union(&mask_sel, mask, &rect_area);
if(area_ok) {
lv_style_t *sel_style = lv_roller_get_style(roller, LV_ROLLER_STYLE_SEL);
lv_style_t new_style;
@@ -316,14 +316,14 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
lv_obj_t * roller = lv_obj_get_parent(roller_scrl);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
lv_style_t * style_label = lv_obj_get_style(ext->ddlist.label);
const font_t * font = style_label->text.font;
cord_t font_h = font_get_height_scale(font);
const lv_font_t * font = style_label->text.font;
lv_coord_t font_h = lv_font_get_height_scale(font);
if(sign == LV_SIGNAL_DRAG_END) {
/*If dragged then align the list to there be an element in the middle*/
cord_t label_y1 = ext->ddlist.label->coords.y1 - roller->coords.y1;
cord_t label_unit = font_h + style_label->text.line_space;
cord_t mid = (roller->coords.y2 - roller->coords.y1) / 2;
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;
id = (mid - label_y1 + style_label->text.line_space / 2) / label_unit;
if(id < 0) id = 0;
if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
@@ -332,7 +332,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
else if(sign == LV_SIGNAL_RELEASED) {
/*If picked an option by clicking then set it*/
if(!lv_indev_is_dragging(indev)) {
point_t p;
lv_point_t p;
lv_indev_get_point(indev, &p);
p.y = p.y - ext->ddlist.label->coords.y1;
id = p.y / (font_h + style_label->text.line_space);
@@ -355,12 +355,12 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
* @param roller pointer to a roller object
* @param mask pointer to the current mask (from the design function)
*/
static void draw_bg(lv_obj_t *roller, const area_t *mask)
static void draw_bg(lv_obj_t *roller, const lv_area_t *mask)
{
lv_style_t *style = lv_roller_get_style(roller, LV_ROLLER_STYLE_BG);
area_t half_mask;
area_t half_roller;
cord_t h = lv_obj_get_height(roller);
lv_area_t half_mask;
lv_area_t half_roller;
lv_coord_t h = lv_obj_get_height(roller);
bool union_ok;
area_cpy(&half_roller, &roller->coords);
@@ -369,7 +369,7 @@ static void draw_bg(lv_obj_t *roller, const area_t *mask)
half_roller.y1 -= roller->ext_size;
half_roller.y2 = roller->coords.y1 + h / 2;
union_ok = area_union(&half_mask, &half_roller, mask);
union_ok = lv_area_union(&half_mask, &half_roller, mask);
half_roller.x1 += roller->ext_size; /*Revert ext. size adding*/
half_roller.x2 -= roller->ext_size;
@@ -386,7 +386,7 @@ static void draw_bg(lv_obj_t *roller, const area_t *mask)
half_roller.y1 = roller->coords.y1 + h / 2;
if((h & 0x1) == 0) half_roller.y1++; /*With even height the pixels in the middle would be drawn twice*/
union_ok = area_union(&half_mask, &half_roller, mask);
union_ok = lv_area_union(&half_mask, &half_roller, mask);
half_roller.x1 += roller->ext_size; /*Revert ext. size adding*/
half_roller.x2 -= roller->ext_size;
@@ -394,8 +394,8 @@ static void draw_bg(lv_obj_t *roller, const area_t *mask)
half_roller.y1 -= style->body.radius;
if(union_ok){
color_t main_tmp = style->body.main_color;
color_t grad_tmp = style->body.grad_color;
lv_color_t main_tmp = style->body.main_color;
lv_color_t grad_tmp = style->body.grad_color;
style->body.main_color = grad_tmp;
style->body.grad_color = main_tmp;
@@ -416,22 +416,22 @@ static void refr_position(lv_obj_t *roller, bool anim_en)
lv_obj_t *roller_scrl = lv_page_get_scrl(roller);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
lv_style_t * style_label = lv_obj_get_style(ext->ddlist.label);
const font_t * font = style_label->text.font;
cord_t font_h = font_get_height_scale(font);
cord_t h = lv_obj_get_height(roller);
const lv_font_t * font = style_label->text.font;
lv_coord_t font_h = lv_font_get_height_scale(font);
lv_coord_t h = lv_obj_get_height(roller);
int32_t id = ext->ddlist.sel_opt_id;
cord_t line_y1 = id * (font_h + style_label->text.line_space) + ext->ddlist.label->coords.y1 - roller_scrl->coords.y1;
cord_t new_y = - line_y1 + (h - font_h) / 2;
lv_coord_t line_y1 = id * (font_h + style_label->text.line_space) + ext->ddlist.label->coords.y1 - roller_scrl->coords.y1;
lv_coord_t new_y = - line_y1 + (h - font_h) / 2;
if(ext->ddlist.anim_time == 0 || anim_en == false) {
lv_obj_set_y(roller_scrl, new_y);
} else {
anim_t a;
lv_anim_t a;
a.var = roller_scrl;
a.start = lv_obj_get_y(roller_scrl);
a.end = new_y;
a.fp = (anim_fp_t)lv_obj_set_y;
a.path = anim_get_path(ANIM_PATH_LIN);
a.fp = (lv_anim_fp_t)lv_obj_set_y;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.end_cb = NULL;
a.act_time = 0;
a.time = ext->ddlist.anim_time;
@@ -439,7 +439,7 @@ static void refr_position(lv_obj_t *roller, bool anim_en)
a.playback_pause = 0;
a.repeat = 0;
a.repeat_pause = 0;
anim_create(&a);
lv_anim_create(&a);
}
}

View File

@@ -28,7 +28,7 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_mode_t mode);
static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param);
/**********************
@@ -227,7 +227,7 @@ lv_style_t * lv_slider_get_style(lv_obj_t *slider, lv_slider_style_t type)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_mode_t mode)
static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
@@ -242,11 +242,11 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
lv_style_t * style_indic = lv_slider_get_style(slider, LV_SLIDER_STYLE_INDIC);
/*Draw the bar*/
area_t area_bar;
lv_area_t area_bar;
area_cpy(&area_bar, &slider->coords);
/*Be sure at least vpad/hpad width bar will remain*/
cord_t pad_ver_bar = style_slider->body.padding.ver;
cord_t pad_hor_bar = style_slider->body.padding.hor;
lv_coord_t pad_ver_bar = style_slider->body.padding.ver;
lv_coord_t pad_hor_bar = style_slider->body.padding.hor;
if(pad_ver_bar * 2 + LV_SLIDER_SIZE_MIN > area_get_height(&area_bar)) {
pad_ver_bar = (area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
}
@@ -261,12 +261,12 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
lv_draw_rect(&area_bar, mask, style_slider);
/*Draw the indicator*/
area_t area_indic;
lv_area_t area_indic;
area_cpy(&area_indic, &area_bar);
/*Be sure at least vpad/hpad width indicator will remain*/
cord_t pad_ver_indic = style_indic->body.padding.ver;
cord_t pad_hor_indic = style_indic->body.padding.hor;
lv_coord_t pad_ver_indic = style_indic->body.padding.ver;
lv_coord_t pad_hor_indic = style_indic->body.padding.hor;
if(pad_ver_indic * 2 + LV_SLIDER_SIZE_MIN > area_get_height(&area_bar)) {
pad_ver_indic = (area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
}
@@ -279,12 +279,12 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
area_indic.y1 += pad_ver_indic;
area_indic.y2 -= pad_ver_indic;
cord_t slider_w = area_get_width(&slider->coords);
cord_t slider_h = area_get_height(&slider->coords);
lv_coord_t slider_w = area_get_width(&slider->coords);
lv_coord_t slider_h = area_get_height(&slider->coords);
cord_t cur_value = lv_slider_get_value(slider);
cord_t min_value = lv_slider_get_min_value(slider);
cord_t max_value = lv_slider_get_max_value(slider);
lv_coord_t cur_value = lv_slider_get_value(slider);
lv_coord_t min_value = lv_slider_get_min_value(slider);
lv_coord_t max_value = lv_slider_get_max_value(slider);
/*If dragged draw to the drag position*/
if(ext->drag_value != LV_SLIDER_NOT_PRESSED) cur_value = ext->drag_value;
@@ -301,7 +301,7 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
if(cur_value != min_value) lv_draw_rect(&area_indic, mask, style_indic);
/*Draw the knob*/
area_t knob_area;
lv_area_t knob_area;
area_cpy(&knob_area, &slider->coords);
if(slider_w >= slider_h) {
@@ -357,9 +357,9 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
if(res != LV_RES_OK) return res;
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
point_t p;
cord_t w = lv_obj_get_width(slider);
cord_t h = lv_obj_get_height(slider);
lv_point_t p;
lv_coord_t w = lv_obj_get_width(slider);
lv_coord_t h = lv_obj_get_height(slider);
if(sign == LV_SIGNAL_PRESSED) {
ext->drag_value = lv_slider_get_value(slider);
@@ -367,12 +367,12 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
else if(sign == LV_SIGNAL_PRESSING) {
lv_indev_get_point(param, &p);
if(w > h) {
cord_t knob_w = h;
lv_coord_t knob_w = h;
p.x -= slider->coords.x1 + h / 2; /*Modify the point to shift with half knob (important on the start and end)*/
ext->drag_value = (int32_t) ((int32_t) p.x * (ext->bar.max_value - ext->bar.min_value + 1)) / (w - knob_w);
ext->drag_value += ext->bar.min_value;
} else {
cord_t knob_h = w;
lv_coord_t knob_h = w;
p.y -= slider->coords.y1 + w / 2; /*Modify the point to shift with half knob (important on the start and end)*/
ext->drag_value = (int32_t) ((int32_t) p.y * (ext->bar.max_value - ext->bar.min_value + 1)) / (h - knob_h);
ext->drag_value = ext->bar.max_value - ext->drag_value; /*Invert the value: smaller value means higher y*/
@@ -402,12 +402,12 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
} else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
lv_style_t *style = lv_slider_get_style(slider, LV_SLIDER_STYLE_BG);
lv_style_t *knob_style = lv_slider_get_style(slider, LV_SLIDER_STYLE_KNOB);
cord_t shadow_w = knob_style->body.shadow.width;
lv_coord_t shadow_w = knob_style->body.shadow.width;
if(ext->knob_in == 0) {
cord_t x = MATH_MIN(w / 2 + shadow_w, h / 2 + shadow_w); /*The smaller size is the knob diameter*/
lv_coord_t x = MATH_MIN(w / 2 + shadow_w, h / 2 + shadow_w); /*The smaller size is the knob diameter*/
if(slider->ext_size < x) slider->ext_size = x;
} else {
cord_t pad = MATH_MIN(style->body.padding.hor, style->body.padding.ver);
lv_coord_t pad = MATH_MIN(style->body.padding.hor, style->body.padding.ver);
if(pad < 0) {
pad = -pad;
if(slider->ext_size < pad) slider->ext_size = pad;

View File

@@ -41,8 +41,8 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool lv_ta_design(lv_obj_t * ta, const area_t * mask, lv_design_mode_t mode);
static bool lv_ta_scrollable_design(lv_obj_t * scrl, const area_t * mask, lv_design_mode_t mode);
static bool lv_ta_design(lv_obj_t * ta, const lv_area_t * mask, lv_design_mode_t mode);
static bool lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param);
static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
static void cursor_blink_anim(lv_obj_t * ta, uint8_t show);
@@ -139,9 +139,9 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy)
}
/*Create a cursor blinker animation*/
anim_t a;
lv_anim_t a;
a.var = new_ta;
a.fp = (anim_fp_t)cursor_blink_anim;
a.fp = (lv_anim_fp_t)cursor_blink_anim;
a.time = LV_TA_CURSOR_BLINK_TIME;
a.act_time = 0;
a.end_cb = NULL;
@@ -151,8 +151,8 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy)
a.repeat_pause = 0;
a.playback = 1;
a.playback_pause = 0;
a.path = anim_get_path(ANIM_PATH_STEP);
anim_create(&a);
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
lv_anim_create(&a);
return new_ta;
}
@@ -179,24 +179,24 @@ void lv_ta_add_char(lv_obj_t * ta, char c)
if(ext->pwd_mode != 0) {
ext->pwd_tmp = dm_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + 2); /*+2: the new char + \0 */
ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + 2); /*+2: the new char + \0 */
dm_assert(ext->pwd_tmp);
txt_ins(ext->pwd_tmp, ext->cursor.pos, letter_buf);
anim_t a;
lv_anim_t a;
a.var = ta;
a.fp = (anim_fp_t)pwd_char_hider_anim;
a.fp = (lv_anim_fp_t)pwd_char_hider_anim;
a.time = LV_TA_PWD_SHOW_TIME;
a.act_time = 0;
a.end_cb = (anim_cb_t)pwd_char_hider;
a.end_cb = (lv_anim_cb_t)pwd_char_hider;
a.start = 0;
a.end = 1;
a.repeat = 0;
a.repeat_pause = 0;
a.playback = 0;
a.playback_pause = 0;
a.path = anim_get_path(ANIM_PATH_STEP);
anim_create(&a);
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
lv_anim_create(&a);
}
/*Move the cursor after the new character*/
@@ -218,25 +218,25 @@ void lv_ta_add_text(lv_obj_t * ta, const char * txt)
lv_label_ins_text(ext->label, ext->cursor.pos, txt);
if(ext->pwd_mode != 0) {
ext->pwd_tmp = dm_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + strlen(txt) + 1);
ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + strlen(txt) + 1);
dm_assert(ext->pwd_tmp);
txt_ins(ext->pwd_tmp, ext->cursor.pos, txt);
anim_t a;
lv_anim_t a;
a.var = ta;
a.fp = (anim_fp_t)pwd_char_hider_anim;
a.fp = (lv_anim_fp_t)pwd_char_hider_anim;
a.time = LV_TA_PWD_SHOW_TIME;
a.act_time = 0;
a.end_cb = (anim_cb_t)pwd_char_hider;
a.end_cb = (lv_anim_cb_t)pwd_char_hider;
a.start = 0;
a.end = 1;
a.repeat = 0;
a.repeat_pause = 0;
a.playback = 0;
a.playback_pause = 0;
a.path = anim_get_path(ANIM_PATH_STEP);
anim_create(&a);
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
lv_anim_create(&a);
}
/*Move the cursor after the new text*/
@@ -273,7 +273,7 @@ void lv_ta_del_char(lv_obj_t * ta)
uint32_t byte_pos = txt_utf8_get_byte_id(ext->pwd_tmp, ext->cursor.pos - 1);
txt_cut(ext->pwd_tmp, ext->cursor.pos - 1, txt_utf8_size(label_txt[byte_pos]));
#endif
ext->pwd_tmp = dm_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + 1);
ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + 1);
dm_assert(ext->pwd_tmp);
}
@@ -299,27 +299,27 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt)
/*Don't let 'width == 0' because cursor will not be visible*/
if(lv_obj_get_width(ext->label) == 0) {
lv_style_t * style = lv_obj_get_style(ext->label);
lv_obj_set_width(ext->label, font_get_width_scale(style->text.font, ' '));
lv_obj_set_width(ext->label, lv_font_get_width_scale(style->text.font, ' '));
}
if(ext->pwd_mode != 0) {
ext->pwd_tmp = dm_realloc(ext->pwd_tmp, strlen(txt) + 1);
ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(txt) + 1);
strcpy(ext->pwd_tmp, txt);
anim_t a;
lv_anim_t a;
a.var = ta;
a.fp = (anim_fp_t)pwd_char_hider_anim;
a.fp = (lv_anim_fp_t)pwd_char_hider_anim;
a.time = LV_TA_PWD_SHOW_TIME;
a.act_time = 0;
a.end_cb = (anim_cb_t)pwd_char_hider;
a.end_cb = (lv_anim_cb_t)pwd_char_hider;
a.start = 0;
a.end = 1;
a.repeat = 0;
a.repeat_pause = 0;
a.playback = 0;
a.playback_pause = 0;
a.path = anim_get_path(ANIM_PATH_STEP);
anim_create(&a);
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
lv_anim_create(&a);
}
}
@@ -343,17 +343,17 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
/*Position the label to make the cursor visible*/
lv_obj_t * label_par = lv_obj_get_parent(ext->label);
point_t cur_pos;
lv_point_t cur_pos;
lv_style_t * style = lv_obj_get_style(ta);
const font_t * font_p = style->text.font;
area_t label_cords;
area_t ta_cords;
const lv_font_t * font_p = style->text.font;
lv_area_t label_cords;
lv_area_t ta_cords;
lv_label_get_letter_pos(ext->label, pos, &cur_pos);
lv_obj_get_coords(ta, &ta_cords);
lv_obj_get_coords(ext->label, &label_cords);
/*Check the top*/
cord_t font_h = font_get_height_scale(font_p);
lv_coord_t font_h = lv_font_get_height_scale(font_p);
if(lv_obj_get_y(label_par) + cur_pos.y < 0) {
lv_obj_set_y(label_par, - cur_pos.y + style->body.padding.ver);
}
@@ -377,9 +377,9 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
ext->cursor.valid_x = cur_pos.x;
/*Reset cursor blink animation*/
anim_t a;
lv_anim_t a;
a.var = ta;
a.fp = (anim_fp_t)cursor_blink_anim;
a.fp = (lv_anim_fp_t)cursor_blink_anim;
a.time = LV_TA_CURSOR_BLINK_TIME;
a.act_time = 0;
a.end_cb = NULL;
@@ -389,8 +389,8 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
a.repeat_pause = 0;
a.playback = 1;
a.playback_pause = 0;
a.path = anim_get_path(ANIM_PATH_STEP);
anim_create(&a);
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
lv_anim_create(&a);
lv_obj_invalidate(ta);
}
@@ -420,7 +420,7 @@ void lv_ta_set_pwd_mode(lv_obj_t * ta, bool pwd_en)
if(ext->pwd_mode == 0 && pwd_en != false) {
char * txt = lv_label_get_text(ext->label);
uint16_t len = strlen(txt);
ext->pwd_tmp = dm_alloc(len + 1);
ext->pwd_tmp = lv_mem_alloc(len + 1);
strcpy(ext->pwd_tmp, txt);
uint16_t i;
@@ -434,7 +434,7 @@ void lv_ta_set_pwd_mode(lv_obj_t * ta, bool pwd_en)
/*Pwd mode is now disabled*/
else if(ext->pwd_mode == 1 && pwd_en == false) {
lv_label_set_text(ext->label, ext->pwd_tmp);
dm_free(ext->pwd_tmp);
lv_mem_free(ext->pwd_tmp);
ext->pwd_tmp = NULL;
}
@@ -453,7 +453,7 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en)
lv_style_t * style_ta = lv_obj_get_style(ta);
lv_style_t * style_scrl = lv_obj_get_style(lv_page_get_scrl(ta));
lv_style_t * style_label = lv_obj_get_style(ext->label);
cord_t font_h = font_get_height_scale(style_label->text.font);
lv_coord_t font_h = lv_font_get_height_scale(style_label->text.font);
ext->one_line = 1;
lv_page_set_scrl_fit(ta, true, true);
@@ -634,15 +634,15 @@ void lv_ta_cursor_left(lv_obj_t * ta)
void lv_ta_cursor_down(lv_obj_t * ta)
{
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
point_t pos;
lv_point_t pos;
/*Get the position of the current letter*/
lv_label_get_letter_pos(ext->label, lv_ta_get_cursor_pos(ta), &pos);
/*Increment the y with one line and keep the valid x*/
lv_style_t * label_style = lv_obj_get_style(ext->label);
const font_t * font_p = label_style->text.font;
cord_t font_h = font_get_height_scale(font_p);
const lv_font_t * font_p = label_style->text.font;
lv_coord_t font_h = lv_font_get_height_scale(font_p);
pos.y += font_h + label_style->text.line_space + 1;
pos.x = ext->cursor.valid_x;
@@ -651,7 +651,7 @@ void lv_ta_cursor_down(lv_obj_t * ta)
/*Get the letter index on the new cursor position and set it*/
uint16_t new_cur_pos = lv_label_get_letter_on(ext->label, &pos);
cord_t cur_valid_x_tmp = ext->cursor.valid_x; /*Cursor position set overwrites the valid positon */
lv_coord_t cur_valid_x_tmp = ext->cursor.valid_x; /*Cursor position set overwrites the valid positon */
lv_ta_set_cursor_pos(ta, new_cur_pos);
ext->cursor.valid_x = cur_valid_x_tmp;
}
@@ -664,22 +664,22 @@ void lv_ta_cursor_down(lv_obj_t * ta)
void lv_ta_cursor_up(lv_obj_t * ta)
{
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
point_t pos;
lv_point_t pos;
/*Get the position of the current letter*/
lv_label_get_letter_pos(ext->label, lv_ta_get_cursor_pos(ta), &pos);
/*Decrement the y with one line and keep the valid x*/
lv_style_t * label_style = lv_obj_get_style(ext->label);
const font_t * font = label_style->text.font;
cord_t font_h = font_get_height_scale(font);
const lv_font_t * font = label_style->text.font;
lv_coord_t font_h = lv_font_get_height_scale(font);
pos.y -= font_h + label_style->text.line_space - 1;
pos.x = ext->cursor.valid_x;
/*Get the letter index on the new cursor position and set it*/
uint16_t new_cur_pos = lv_label_get_letter_on(ext->label, &pos);
cord_t cur_valid_x_tmp = ext->cursor.valid_x; /*Cursor position set overwrites the valid positon */
lv_coord_t cur_valid_x_tmp = ext->cursor.valid_x; /*Cursor position set overwrites the valid positon */
lv_ta_set_cursor_pos(ta, new_cur_pos);
ext->cursor.valid_x = cur_valid_x_tmp;
}
@@ -698,7 +698,7 @@ void lv_ta_cursor_up(lv_obj_t * ta)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
*/
static bool lv_ta_design(lv_obj_t * ta, const area_t * masp, lv_design_mode_t mode)
static bool lv_ta_design(lv_obj_t * ta, const lv_area_t * masp, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
/*Return false if the object is not covers the mask_p area*/
@@ -723,7 +723,7 @@ static bool lv_ta_design(lv_obj_t * ta, const area_t * masp, lv_design_mode_t mo
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @return return true/false, depends on 'mode'
*/
static bool lv_ta_scrollable_design(lv_obj_t * scrl, const area_t * mask, lv_design_mode_t mode)
static bool lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
/*Return false if the object is not covers the mask_p area*/
@@ -741,7 +741,7 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const area_t * mask, lv_des
if(ta_ext->cursor.type == LV_CURSOR_NONE ||
(ta_ext->cursor.type & LV_CURSOR_HIDDEN) ||
ta_ext->cursor.state == 0 ||
label_style->body.opa == OPA_TRANSP)
label_style->body.opa == LV_OPA_TRANSP)
{
return true; /*The cursor is not visible now*/
}
@@ -754,12 +754,12 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const area_t * mask, lv_des
else {
/*If cursor style is not specified then use the modified label style */
lv_style_copy(&cur_style, label_style);
color_t ccolor_tmp = cur_style.text.color; /*Make letter color to cursor color*/
lv_color_t clv_color_tmp = cur_style.text.color; /*Make letter color to cursor color*/
cur_style.text.color = cur_style.body.main_color; /*In block mode the letter color will be current background color*/
cur_style.body.main_color = ccolor_tmp;
cur_style.body.grad_color = ccolor_tmp;
cur_style.body.border.color = ccolor_tmp;
cur_style.body.border.opa = OPA_COVER;
cur_style.body.main_color = clv_color_tmp;
cur_style.body.grad_color = clv_color_tmp;
cur_style.body.border.color = clv_color_tmp;
cur_style.body.border.opa = LV_OPA_COVER;
cur_style.body.border.width = 1 << LV_ANTIALIAS;
cur_style.body.shadow.width = 0;
cur_style.body.radius = 0;
@@ -767,7 +767,7 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const area_t * mask, lv_des
cur_style.body.padding.hor = 0;
cur_style.body.padding.ver = 0;
cur_style.line.width = 1 << LV_ANTIALIAS;
cur_style.body.opa = OPA_COVER;
cur_style.body.opa = LV_OPA_COVER;
}
uint16_t cur_pos = lv_ta_get_cursor_pos(ta);
@@ -780,16 +780,16 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const area_t * mask, lv_des
#endif
uint32_t letter = txt_utf8_next(&txt[byte_pos], NULL);
cord_t letter_h = font_get_height_scale(label_style->text.font);
lv_coord_t letter_h = lv_font_get_height_scale(label_style->text.font);
/*Set letter_w (set not 0 on non printable but valid chars)*/
cord_t letter_w;
lv_coord_t letter_w;
if(letter == '\0' || letter == '\n' || letter == '\r') {
letter_w = font_get_width_scale(label_style->text.font, ' ');
letter_w = lv_font_get_width_scale(label_style->text.font, ' ');
} else {
letter_w = font_get_width_scale(label_style->text.font, letter);
letter_w = lv_font_get_width_scale(label_style->text.font, letter);
}
point_t letter_pos;
lv_point_t letter_pos;
lv_label_get_letter_pos(ta_ext->label, cur_pos, &letter_pos);
/*If the cursor is out of the text (most right) draw it to the next line*/
@@ -803,14 +803,14 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const area_t * mask, lv_des
}
if(letter == '\0' || letter == '\n' || letter == '\r') {
letter_w = font_get_width_scale(label_style->text.font, ' ');
letter_w = lv_font_get_width_scale(label_style->text.font, ' ');
} else {
letter_w = font_get_width_scale(label_style->text.font, letter);
letter_w = lv_font_get_width_scale(label_style->text.font, letter);
}
}
/*Draw he cursor according to the type*/
area_t cur_area;
lv_area_t cur_area;
if(ta_ext->cursor.type == LV_CURSOR_LINE) {
cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor - (cur_style.line.width >> 1) - (cur_style.line.width & 0x1);
cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.ver;
@@ -878,7 +878,7 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
if(sign == LV_SIGNAL_CLEANUP) {
if(ext->pwd_tmp != NULL) dm_free(ext->pwd_tmp);
if(ext->pwd_tmp != NULL) lv_mem_free(ext->pwd_tmp);
/* (The created label will be deleted automatically) */
} else if(sign == LV_SIGNAL_STYLE_CHG) {
@@ -889,7 +889,7 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
if(ext->one_line) {
/*In one line mode refresh the Text Area height because 'vpad' can modify it*/
lv_style_t * style_label = lv_obj_get_style(ext->label);
cord_t font_h = font_get_height_scale(style_label->text.font);
lv_coord_t font_h = lv_font_get_height_scale(style_label->text.font);
lv_obj_set_height(ta, font_h + (style_ta->body.padding.ver + style_scrl->body.padding.ver) * 2);
} else {
/*In not one line mode refresh the Label width because 'hpad' can modify it*/
@@ -966,7 +966,7 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
lv_obj_t * ta = lv_obj_get_parent(scrl);
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
lv_style_t * style_label = lv_obj_get_style(ext->label);
cord_t font_h = font_get_height_scale(style_label->text.font);
lv_coord_t font_h = lv_font_get_height_scale(style_label->text.font);
scrl->ext_size = MATH_MAX(scrl->ext_size, style_label->text.line_space + font_h);
}

View File

@@ -58,7 +58,7 @@ typedef struct
uint8_t one_line :1; /*One line mode (ignore line breaks)*/
struct {
lv_style_t *style; /*Style of the cursor (NULL to use label's style)*/
cord_t valid_x; /*Used when stepping up/down in text area when stepping to a shorter line. (Handled by the library)*/
lv_coord_t valid_x; /*Used when stepping up/down in text area when stepping to a shorter line. (Handled by the library)*/
uint16_t pos; /*The current cursor position (0: before 1. letter; 1: before 2. letter etc.)*/
lv_cursor_type_t type; /*Shape of the cursor*/
uint8_t state :1; /*Indicates that the cursor is visible now or not (Handled by the library)*/

View File

@@ -79,7 +79,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, lv_obj_t * copy)
ext->btns = NULL;
ext->tab_load_action = NULL;
ext->anim_time = LV_TABVIEW_ANIM_TIME;
ext->tab_name_ptr = dm_alloc(sizeof(char*));
ext->tab_name_ptr = lv_mem_alloc(sizeof(char*));
ext->tab_name_ptr[0] = "";
/*The signal and design functions are not copied so set them here*/
@@ -134,7 +134,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, lv_obj_t * copy)
ext->anim_time = copy_ext->anim_time;
ext->tab_load_action = copy_ext->tab_load_action;
ext->tab_name_ptr = dm_alloc(sizeof(char*));
ext->tab_name_ptr = lv_mem_alloc(sizeof(char*));
ext->tab_name_ptr[0] = "";
lv_btnm_set_map(ext->btns, ext->tab_name_ptr);
@@ -185,15 +185,15 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
/*Extend the button matrix map with the new name*/
char *name_dm;
if((name[0] & LV_BTNM_CTRL_MASK) == LV_BTNM_CTRL_CODE) { /*If control byte presented let is*/
name_dm = dm_alloc(strlen(name) + 1); /*+1 for the the closing '\0' */
name_dm = lv_mem_alloc(strlen(name) + 1); /*+1 for the the closing '\0' */
strcpy(name_dm, name);
} else { /*Set a no long press control byte is not presented*/
name_dm = dm_alloc(strlen(name) + 2); /*+1 for the the closing '\0' and +1 for the control byte */
name_dm = lv_mem_alloc(strlen(name) + 2); /*+1 for the the closing '\0' and +1 for the control byte */
name_dm[0] = '\221';
strcpy(&name_dm[1], name);
}
ext->tab_cnt++;
ext->tab_name_ptr = dm_realloc(ext->tab_name_ptr, sizeof(char *) * (ext->tab_cnt + 1));
ext->tab_name_ptr = lv_mem_realloc(ext->tab_name_ptr, sizeof(char *) * (ext->tab_cnt + 1));
ext->tab_name_ptr[ext->tab_cnt - 1] = name_dm;
ext->tab_name_ptr[ext->tab_cnt] = "";
@@ -201,7 +201,7 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
/*Modify the indicator size*/
lv_style_t * style_tabs = lv_obj_get_style(ext->btns);
cord_t indic_width = (lv_obj_get_width(tabview) - style_tabs->body.padding.inner * (ext->tab_cnt - 1) - 2 * style_tabs->body.padding.hor) / ext->tab_cnt;
lv_coord_t indic_width = (lv_obj_get_width(tabview) - style_tabs->body.padding.inner * (ext->tab_cnt - 1) - 2 * style_tabs->body.padding.hor) / ext->tab_cnt;
lv_obj_set_width(ext->indic, indic_width);
lv_obj_set_x(ext->indic, indic_width * ext->tab_cur + style_tabs->body.padding.inner * ext->tab_cur + style_tabs->body.padding.hor);
@@ -235,16 +235,16 @@ void lv_tabview_set_current_tab(lv_obj_t * tabview, uint16_t id, bool anim_en)
ext->tab_cur = id;
cord_t cont_x = -(lv_obj_get_width(tabview) * id + style->body.padding.inner * id + style->body.padding.hor);
lv_coord_t cont_x = -(lv_obj_get_width(tabview) * id + style->body.padding.inner * id + style->body.padding.hor);
if(ext->anim_time == 0 || anim_en == false) {
lv_obj_set_x(ext->content, cont_x);
} else {
anim_t a;
lv_anim_t a;
a.var = ext->content;
a.start = lv_obj_get_x(ext->content);
a.end = cont_x;
a.fp = (anim_fp_t)lv_obj_set_x;
a.path = anim_get_path(ANIM_PATH_LIN);
a.fp = (lv_anim_fp_t)lv_obj_set_x;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.end_cb = NULL;
a.act_time = 0;
a.time = ext->anim_time;
@@ -252,23 +252,23 @@ void lv_tabview_set_current_tab(lv_obj_t * tabview, uint16_t id, bool anim_en)
a.playback_pause = 0;
a.repeat = 0;
a.repeat_pause = 0;
anim_create(&a);
lv_anim_create(&a);
}
/*Move the indicator*/
cord_t indic_width = lv_obj_get_width(ext->indic);
lv_coord_t indic_width = lv_obj_get_width(ext->indic);
lv_style_t * tabs_style = lv_obj_get_style(ext->btns);
cord_t indic_x = indic_width * id + tabs_style->body.padding.inner * id + tabs_style->body.padding.hor;
lv_coord_t indic_x = indic_width * id + tabs_style->body.padding.inner * id + tabs_style->body.padding.hor;
if(ext->anim_time == 0 || anim_en == false ) {
lv_obj_set_x(ext->indic, indic_x);
} else {
anim_t a;
lv_anim_t a;
a.var = ext->indic;
a.start = lv_obj_get_x(ext->indic);
a.end = indic_x;
a.fp = (anim_fp_t)lv_obj_set_x;
a.path = anim_get_path(ANIM_PATH_LIN);
a.fp = (lv_anim_fp_t)lv_obj_set_x;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.end_cb = NULL;
a.act_time = 0;
a.time = ext->anim_time;
@@ -276,7 +276,7 @@ void lv_tabview_set_current_tab(lv_obj_t * tabview, uint16_t id, bool anim_en)
a.playback_pause = 0;
a.repeat = 0;
a.repeat_pause = 0;
anim_create(&a);
lv_anim_create(&a);
}
lv_btnm_set_toggle(ext->btns, true, ext->tab_cur);
@@ -459,9 +459,9 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
if(sign == LV_SIGNAL_CLEANUP) {
uint8_t i;
for(i = 0; ext->tab_name_ptr[i][0] != '\0'; i++) dm_free(ext->tab_name_ptr[i]);
for(i = 0; ext->tab_name_ptr[i][0] != '\0'; i++) lv_mem_free(ext->tab_name_ptr[i]);
dm_free(ext->tab_name_ptr);
lv_mem_free(ext->tab_name_ptr);
ext->tab_name_ptr = NULL;
}
else if(sign == LV_SIGNAL_CORD_CHG) {
@@ -563,10 +563,10 @@ static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
lv_indev_t * indev = lv_indev_get_act();
point_t point_act;
lv_point_t point_act;
lv_indev_get_point(indev, &point_act);
cord_t x_diff = point_act.x - ext->point_last.x;
cord_t y_diff = point_act.y - ext->point_last.y;
lv_coord_t x_diff = point_act.x - ext->point_last.x;
lv_coord_t y_diff = point_act.y - ext->point_last.y;
if(ext->draging == 0) {
if(x_diff >= LV_INDEV_DRAG_LIMIT || x_diff<= -LV_INDEV_DRAG_LIMIT) {
@@ -584,10 +584,10 @@ static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage)
ext->point_last.y = point_act.y;
/*Move the indicator*/
cord_t indic_width = lv_obj_get_width(ext->indic);
lv_coord_t indic_width = lv_obj_get_width(ext->indic);
lv_style_t * tabs_style = lv_obj_get_style(ext->btns);
lv_style_t * indic_style = lv_obj_get_style(ext->indic);
cord_t p = ((tabpage->coords.x1 - tabview->coords.x1) * (indic_width + tabs_style->body.padding.inner)) / lv_obj_get_width(tabview);
lv_coord_t p = ((tabpage->coords.x1 - tabview->coords.x1) * (indic_width + tabs_style->body.padding.inner)) / lv_obj_get_width(tabview);
lv_obj_set_x(ext->indic, indic_width * ext->tab_cur + tabs_style->body.padding.inner * ext->tab_cur + indic_style->body.padding.hor - p);
}
@@ -607,20 +607,20 @@ static void tabpage_press_lost_hadler(lv_obj_t * tabview, lv_obj_t * tabpage)
lv_obj_set_drag(lv_page_get_scrl(tabpage), true);
lv_indev_t * indev = lv_indev_get_act();
point_t point_act;
lv_point_t point_act;
lv_indev_get_point(indev, &point_act);
point_t vect;
lv_point_t vect;
lv_indev_get_vect(indev, &vect);
cord_t x_predict = 0;
lv_coord_t x_predict = 0;
while(vect.x != 0) {
x_predict += vect.x;
vect.x = vect.x * (100 - LV_INDEV_DRAG_THROW) / 100;
}
cord_t page_x1 = tabpage->coords.x1 - tabview->coords.x1 + x_predict;
cord_t page_x2 = page_x1 + lv_obj_get_width(tabpage);
cord_t treshold = lv_obj_get_width(tabview) / 2;
lv_coord_t page_x1 = tabpage->coords.x1 - tabview->coords.x1 + x_predict;
lv_coord_t page_x2 = page_x1 + lv_obj_get_width(tabpage);
lv_coord_t treshold = lv_obj_get_width(tabview) / 2;
uint16_t tab_cur = ext->tab_cur;
if(page_x1 > treshold) {
@@ -670,12 +670,12 @@ static void tabview_realign(lv_obj_t * tabview)
lv_style_t * style_btn_rel = lv_tabview_get_style(tabview, LV_TABVIEW_STYLE_BTN_REL);
/*Set the indicator widths*/
cord_t indic_width = (lv_obj_get_width(tabview) - style_btn_bg->body.padding.inner * (ext->tab_cnt - 1) -
lv_coord_t indic_width = (lv_obj_get_width(tabview) - style_btn_bg->body.padding.inner * (ext->tab_cnt - 1) -
2 * style_btn_bg->body.padding.hor) / ext->tab_cnt;
lv_obj_set_width(ext->indic, indic_width);
/*Set the tabs height*/
cord_t btns_height = font_get_height_scale(style_btn_rel->text.font) +
lv_coord_t btns_height = lv_font_get_height_scale(style_btn_rel->text.font) +
2 * style_btn_rel->body.padding.ver +
2 * style_btn_bg->body.padding.ver;
lv_obj_set_height(ext->btns, btns_height);

View File

@@ -50,7 +50,7 @@ typedef struct
lv_obj_t * indic;
lv_obj_t * content; /*A rectangle to show the current tab*/
const char ** tab_name_ptr;
point_t point_last;
lv_point_t point_last;
uint16_t tab_cur;
uint16_t tab_cnt;
uint16_t anim_time;

View File

@@ -204,7 +204,7 @@ void lv_win_set_title(lv_obj_t * win, const char * title)
* @param win pointer to a window object
* @param size control button size
*/
void lv_win_set_btn_size(lv_obj_t * win, cord_t size)
void lv_win_set_btn_size(lv_obj_t * win, lv_coord_t size)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
ext->btn_size = size;
@@ -305,7 +305,7 @@ const char * lv_win_get_title(lv_obj_t * win)
* @param win pointer to a window object
* @return control button size
*/
cord_t lv_win_get_btn_size(lv_obj_t * win)
lv_coord_t lv_win_get_btn_size(lv_obj_t * win)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return ext->btn_size;
@@ -338,7 +338,7 @@ lv_sb_mode_t lv_win_get_sb_mode(lv_obj_t *win)
* @param win pointer to a window object
* @return the width of the content_bg area
*/
cord_t lv_win_get_width(lv_obj_t * win)
lv_coord_t lv_win_get_width(lv_obj_t * win)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_obj_t * scrl = lv_page_get_scrl(ext->page);

View File

@@ -60,7 +60,7 @@ typedef struct
lv_style_t * style_header; /*Style of the header container*/
lv_style_t * style_btn_rel; /*Control button releases style*/
lv_style_t * style_btn_pr; /*Control button pressed style*/
cord_t btn_size; /*Size of the control buttons (square)*/
lv_coord_t btn_size; /*Size of the control buttons (square)*/
}lv_win_ext_t;
typedef enum {
@@ -122,14 +122,14 @@ void lv_win_set_title(lv_obj_t * win, const char * title);
* @param win pointer to a window object
* @return control button size
*/
void lv_win_set_btn_size(lv_obj_t * win, cord_t size);
void lv_win_set_btn_size(lv_obj_t * win, lv_coord_t size);
/**
* Set the control button size of a window
* @param win pointer to a window object
* @param size control button size
*/
void lv_win_set_btn_size(lv_obj_t * win, cord_t size);
void lv_win_set_btn_size(lv_obj_t * win, lv_coord_t size);
/**
* Set the scroll bar mode of a window
@@ -169,7 +169,7 @@ const char * lv_win_get_title(lv_obj_t * win);
* @param win pointer to a window object
* @return control button size
*/
cord_t lv_win_get_btn_size(lv_obj_t * win);
lv_coord_t lv_win_get_btn_size(lv_obj_t * win);
/**
* Get the layout of a window
@@ -190,7 +190,7 @@ lv_sb_mode_t lv_win_get_sb_mode(lv_obj_t *win);
* @param win pointer to a window object
* @return the width of the content area
*/
cord_t lv_win_get_width(lv_obj_t * win);
lv_coord_t lv_win_get_width(lv_obj_t * win);
/**
* Get the pointer of a widow from one of its control button.