Run code formatter

This commit is contained in:
Gabor Kiss-Vamosi
2020-07-07 09:36:59 +02:00
parent d8585d2ea3
commit 43f5e4d2e0
18 changed files with 200 additions and 188 deletions

View File

@@ -621,7 +621,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
i->proc.pr_timestamp = lv_tick_get();
if (data->key == LV_KEY_ENTER) {
if(data->key == LV_KEY_ENTER) {
bool editable = false;
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
@@ -632,13 +632,16 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL);
if(indev_reset_check(&i->proc)) return;
}
} else if(data->key == LV_KEY_LEFT) {
}
else if(data->key == LV_KEY_LEFT) {
/*emulate encoder left*/
data->enc_diff--;
} else if(data->key == LV_KEY_RIGHT) {
}
else if(data->key == LV_KEY_RIGHT) {
/*emulate encoder right*/
data->enc_diff++;
} else if(data->key == LV_KEY_ESC) {
}
else if(data->key == LV_KEY_ESC) {
/*Send the ESC as a normal KEY*/
lv_group_send_data(g, LV_KEY_ESC);
@@ -658,7 +661,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
i->proc.long_pr_sent = 1;
i->proc.longpr_rep_timestamp = lv_tick_get();
if (data->key == LV_KEY_ENTER) {
if(data->key == LV_KEY_ENTER) {
bool editable = false;
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
@@ -694,10 +697,12 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
else if(data->key == LV_KEY_LEFT) {
/*emulate encoder left*/
data->enc_diff--;
} else if(data->key == LV_KEY_RIGHT) {
}
else if(data->key == LV_KEY_RIGHT) {
/*emulate encoder right*/
data->enc_diff++;
} else {
}
else {
lv_group_send_data(g, data->key);
if(indev_reset_check(&i->proc)) return;
}
@@ -708,7 +713,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
/*Release happened*/
else if(data->state == LV_INDEV_STATE_REL && last_state == LV_INDEV_STATE_PR) {
if (data->key == LV_KEY_ENTER) {
if(data->key == LV_KEY_ENTER) {
bool editable = false;
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
@@ -758,7 +763,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
indev_obj_act = NULL;
/*if encoder steps or simulated steps via left/right keys*/
if (data->enc_diff != 0) {
if(data->enc_diff != 0) {
/*In edit mode send LEFT/RIGHT keys*/
if(lv_group_get_editing(g)) {
int32_t s;
@@ -1214,7 +1219,8 @@ static void indev_click_focus(lv_indev_proc_t * proc)
if(g_act) {
lv_group_focus_obj(indev_obj_act);
if(indev_reset_check(proc)) return;
} else {
}
else {
lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL);
if(indev_reset_check(proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);

View File

@@ -39,7 +39,7 @@
#include LV_THEME_DEFAULT_INCLUDE
#if LV_USE_GPU_STM32_DMA2D
#include "../lv_gpu/lv_gpu_stm32_dma2d.h"
#include "../lv_gpu/lv_gpu_stm32_dma2d.h"
#endif
/*********************
@@ -1570,8 +1570,8 @@ void lv_obj_set_gesture_parent(lv_obj_t * obj, bool en)
*/
void lv_obj_set_focus_parent(lv_obj_t * obj, bool en)
{
if (lv_obj_is_focused(obj)) {
if (en) {
if(lv_obj_is_focused(obj)) {
if(en) {
obj->focus_parent = 1;
lv_obj_clear_state(obj, LV_STATE_FOCUSED | LV_STATE_EDITED);
lv_obj_set_state(lv_obj_get_focused_obj(obj), LV_STATE_FOCUSED);
@@ -3707,7 +3707,7 @@ lv_obj_t * lv_obj_get_focused_obj(const lv_obj_t * obj)
focus_obj = lv_obj_get_parent(focus_obj);
}
return (lv_obj_t*)focus_obj;
return (lv_obj_t *)focus_obj;
}
/**

View File

@@ -246,7 +246,8 @@ static inline void lv_style_set_pad_ver(lv_style_t * style, lv_state_t state, lv
}
static inline void lv_obj_set_style_local_margin_all(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
static inline void lv_obj_set_style_local_margin_all(lv_obj_t * obj, uint8_t part, lv_state_t state,
lv_style_int_t value)
{
lv_obj_set_style_local_margin_top(obj, part, state, value);
lv_obj_set_style_local_margin_bottom(obj, part, state, value);
@@ -264,7 +265,8 @@ static inline void lv_style_set_margin_all(lv_style_t * style, lv_state_t state,
}
static inline void lv_obj_set_style_local_margin_hor(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
static inline void lv_obj_set_style_local_margin_hor(lv_obj_t * obj, uint8_t part, lv_state_t state,
lv_style_int_t value)
{
lv_obj_set_style_local_margin_left(obj, part, state, value);
lv_obj_set_style_local_margin_right(obj, part, state, value);
@@ -278,7 +280,8 @@ static inline void lv_style_set_margin_hor(lv_style_t * style, lv_state_t state,
}
static inline void lv_obj_set_style_local_margin_ver(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
static inline void lv_obj_set_style_local_margin_ver(lv_obj_t * obj, uint8_t part, lv_state_t state,
lv_style_int_t value)
{
lv_obj_set_style_local_margin_top(obj, part, state, value);
lv_obj_set_style_local_margin_bottom(obj, part, state, value);

View File

@@ -36,10 +36,10 @@
**********************/
LV_ATTRIBUTE_FAST_MEM static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop);
static lv_style_t * get_alloc_local_style(lv_style_list_t * list);
static inline void style_resize(lv_style_t *style, size_t sz);
static inline lv_style_property_t get_style_prop(const lv_style_t *style, size_t idx);
static inline uint8_t get_style_prop_id(const lv_style_t *style, size_t idx);
static inline uint8_t get_style_prop_attr(const lv_style_t *style, size_t idx);
static inline void style_resize(lv_style_t * style, size_t sz);
static inline lv_style_property_t get_style_prop(const lv_style_t * style, size_t idx);
static inline uint8_t get_style_prop_id(const lv_style_t * style, size_t idx);
static inline uint8_t get_style_prop_attr(const lv_style_t * style, size_t idx);
static inline size_t get_prop_size(uint8_t prop_id);
static inline size_t get_next_prop_index(uint8_t prop_id, size_t id);
@@ -1124,7 +1124,7 @@ static lv_style_t * get_alloc_local_style(lv_style_list_t * list)
* @param style pointer to the style to be resized.
* @param size new size
*/
static inline void style_resize(lv_style_t *style, size_t sz)
static inline void style_resize(lv_style_t * style, size_t sz)
{
style->map = lv_mem_realloc(style->map, sz);
}
@@ -1135,10 +1135,10 @@ static inline void style_resize(lv_style_t *style, size_t sz)
* @param idx index of the style in style->map
* @return property in style->map + idx
*/
static inline lv_style_property_t get_style_prop(const lv_style_t *style, size_t idx)
static inline lv_style_property_t get_style_prop(const lv_style_t * style, size_t idx)
{
lv_style_property_t prop;
uint8_t *prop_p = (uint8_t*)∝
uint8_t * prop_p = (uint8_t *)∝
prop_p[0] = style->map[idx];
prop_p[1] = style->map[idx + 1];
return prop;
@@ -1150,7 +1150,7 @@ static inline lv_style_property_t get_style_prop(const lv_style_t *style, size_t
* @param idx index of the style in style->map
* @return id of property in style->map + idx
*/
static inline uint8_t get_style_prop_id(const lv_style_t *style, size_t idx)
static inline uint8_t get_style_prop_id(const lv_style_t * style, size_t idx)
{
return get_style_prop(style, idx) & 0xFF;
}
@@ -1161,7 +1161,7 @@ static inline uint8_t get_style_prop_id(const lv_style_t *style, size_t idx)
* @param idx index of the style in style->map
* @return attribute of property in style->map + idx
*/
static inline uint8_t get_style_prop_attr(const lv_style_t *style, size_t idx)
static inline uint8_t get_style_prop_attr(const lv_style_t * style, size_t idx)
{
return ((get_style_prop(style, idx) >> 8) & 0xFFU);
}

View File

@@ -61,7 +61,7 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co
**********************/
#if LV_USE_GPU || LV_USE_GPU_STM32_DMA2D
LV_ATTRIBUTE_DMA static lv_color_t blend_buf[LV_HOR_RES_MAX];
LV_ATTRIBUTE_DMA static lv_color_t blend_buf[LV_HOR_RES_MAX];
#endif
/**********************

View File

@@ -87,7 +87,7 @@ typedef struct {
static uint32_t zero_mem; /*Give the address of this variable if 0 byte should be allocated*/
#if LV_MEM_CUSTOM == 0
static uint32_t mem_max_size; /*Tracks the maximum total size of memory ever used from the internal heap*/
static uint32_t mem_max_size; /*Tracks the maximum total size of memory ever used from the internal heap*/
#endif
static uint8_t mem_buf1_32[MEM_BUF_SMALL_SIZE];
@@ -206,15 +206,16 @@ void * lv_mem_alloc(size_t size)
if(alloc == NULL) {
LV_LOG_WARN("Couldn't allocate memory");
}else{
#if LV_MEM_CUSTOM == 0
}
else {
#if LV_MEM_CUSTOM == 0
/* just a safety check, should always be true */
if ((uintptr_t) alloc > (uintptr_t) work_mem) {
if ((((uintptr_t) alloc - (uintptr_t) work_mem) + size) > mem_max_size) {
if((uintptr_t) alloc > (uintptr_t) work_mem) {
if((((uintptr_t) alloc - (uintptr_t) work_mem) + size) > mem_max_size) {
mem_max_size = ((uintptr_t) alloc - (uintptr_t) work_mem) + size;
}
}
#endif
#endif
}
return alloc;

View File

@@ -427,12 +427,12 @@ void lv_btnmatrix_set_one_check(lv_obj_t * btnm, bool one_chk)
* @param btnm pointer to a btnmatrix object
* @param align LV_LABEL_ALIGN_LEFT, LV_LABEL_ALIGN_RIGHT or LV_LABEL_ALIGN_CENTER
*/
void lv_btnmatrix_set_align(lv_obj_t* btnm, lv_label_align_t align)
void lv_btnmatrix_set_align(lv_obj_t * btnm, lv_label_align_t align)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t* ext = lv_obj_get_ext_attr(btnm);
if (ext->align == align) return;
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(ext->align == align) return;
ext->align = align;
@@ -585,18 +585,18 @@ bool lv_btnmatrix_get_one_check(const lv_obj_t * btnm)
* @param btnm pointer to a btnmatrix object
* @return LV_LABEL_ALIGN_LEFT, LV_LABEL_ALIGN_RIGHT or LV_LABEL_ALIGN_CENTER
*/
lv_label_align_t lv_btnmatrix_get_align(const lv_obj_t* btnm)
lv_label_align_t lv_btnmatrix_get_align(const lv_obj_t * btnm)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t* ext = lv_obj_get_ext_attr(btnm);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
lv_label_align_t align = ext->align;
if (align == LV_LABEL_ALIGN_AUTO) {
if(align == LV_LABEL_ALIGN_AUTO) {
#if LV_USE_BIDI
lv_bidi_dir_t base_dir = lv_obj_get_base_dir(btnm);
if (base_dir == LV_BIDI_DIR_RTL) align = LV_LABEL_ALIGN_RIGHT;
if(base_dir == LV_BIDI_DIR_RTL) align = LV_LABEL_ALIGN_RIGHT;
else align = LV_LABEL_ALIGN_LEFT;
#else
align = LV_LABEL_ALIGN_LEFT;
@@ -641,10 +641,10 @@ static lv_design_res_t lv_btnmatrix_design(lv_obj_t * btnm, const lv_area_t * cl
uint16_t btn_i = 0;
uint16_t txt_i = 0;
lv_txt_flag_t txt_flag = LV_TXT_FLAG_NONE;
if (ext->recolor) txt_flag |= LV_TXT_FLAG_RECOLOR;
if(ext->recolor) txt_flag |= LV_TXT_FLAG_RECOLOR;
lv_label_align_t align = lv_btnmatrix_get_align(btnm);
if (align == LV_LABEL_ALIGN_CENTER) txt_flag |= LV_TXT_FLAG_CENTER;
if (align == LV_LABEL_ALIGN_RIGHT) txt_flag |= LV_TXT_FLAG_RIGHT;
if(align == LV_LABEL_ALIGN_CENTER) txt_flag |= LV_TXT_FLAG_CENTER;
if(align == LV_LABEL_ALIGN_RIGHT) txt_flag |= LV_TXT_FLAG_RIGHT;
lv_draw_rect_dsc_t draw_rect_rel_dsc;
lv_draw_label_dsc_t draw_label_rel_dsc;

View File

@@ -176,7 +176,7 @@ void lv_btnmatrix_set_one_check(lv_obj_t * btnm, bool one_chk);
* @param btnm pointer to a btnmatrix object
* @param align LV_LABEL_ALIGN_LEFT, LV_LABEL_ALIGN_RIGHT or LV_LABEL_ALIGN_CENTER
*/
void lv_btnmatrix_set_align(lv_obj_t* btnm, lv_label_align_t align);
void lv_btnmatrix_set_align(lv_obj_t * btnm, lv_label_align_t align);
/*=====================
* Getter functions
@@ -250,7 +250,7 @@ bool lv_btnmatrix_get_one_check(const lv_obj_t * btnm);
* @param btnm pointer to a btnmatrix object
* @return LV_LABEL_ALIGN_LEFT, LV_LABEL_ALIGN_RIGHT or LV_LABEL_ALIGN_CENTER
*/
lv_label_align_t lv_btnmatrix_get_align(const lv_obj_t* btnm);
lv_label_align_t lv_btnmatrix_get_align(const lv_obj_t * btnm);
/**********************
* MACROS

View File

@@ -198,7 +198,7 @@ void lv_roller_set_options(lv_obj_t * roller, const char * options, lv_roller_mo
refr_height(roller);
refr_width(roller);
// refr_position(roller, LV_ANIM_OFF);
// refr_position(roller, LV_ANIM_OFF);
}
/**

View File

@@ -264,14 +264,14 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
/* Advanced hit testing: react only on dragging the knob(s) */
if (sign == LV_SIGNAL_HIT_TEST) {
lv_hit_test_info_t *info = param;
if(sign == LV_SIGNAL_HIT_TEST) {
lv_hit_test_info_t * info = param;
/* Ordinary slider: was the knob area hit? */
info->result = _lv_area_is_point_on(&ext->right_knob_area, info->point, 0);
/* There's still a change we have a hit, if we have another knob */
if ((info->result == false) && (type == LV_SLIDER_TYPE_RANGE)) {
if((info->result == false) && (type == LV_SLIDER_TYPE_RANGE)) {
info->result = _lv_area_is_point_on(&ext->left_knob_area, info->point, 0);
}
}

View File

@@ -231,16 +231,16 @@ void lv_textarea_add_char(lv_obj_t * ta, uint32_t c)
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
const char *letter_buf;
const char * letter_buf;
uint32_t u32_buf[2];
u32_buf[0] = c;
u32_buf[1] = 0;
letter_buf = (char*)&u32_buf;
letter_buf = (char *)&u32_buf;
#if LV_BIG_ENDIAN_SYSTEM
if (c != 0) while (*letter_buf == 0) ++letter_buf;
if(c != 0) while(*letter_buf == 0) ++letter_buf;
#endif
ta_insert_replace = NULL;

View File

@@ -559,7 +559,7 @@ static lv_design_res_t lv_win_header_design(lv_obj_t * header, const lv_area_t *
lv_coord_t left_btn_offset = 0;
btn = lv_obj_get_child_back(ext->header, NULL);
while(btn != NULL) {
if (LV_WIN_BTN_ALIGN_LEFT == lv_win_btn_get_alignment(btn)) {
if(LV_WIN_BTN_ALIGN_LEFT == lv_win_btn_get_alignment(btn)) {
left_btn_offset += btn_w + header_inner;
}
@@ -716,26 +716,28 @@ static void lv_win_realign(lv_obj_t * win)
lv_obj_set_size(btn, btn_w, btn_h);
uint8_t btn_alignment = lv_win_btn_get_alignment(btn);
if (LV_WIN_BTN_ALIGN_RIGHT == btn_alignment) {
if (is_header_right_side_empty) {
if(LV_WIN_BTN_ALIGN_RIGHT == btn_alignment) {
if(is_header_right_side_empty) {
/* Align the button to the right of the header */
lv_obj_align(btn, ext->header, LV_ALIGN_IN_RIGHT_MID, -header_right, 0);
is_header_right_side_empty = false;
} else {
}
else {
/* Align the button to the left of the previous button */
lv_obj_align(btn, btn_prev_at_right, LV_ALIGN_OUT_LEFT_MID, -header_inner, 0);
}
btn_prev_at_right = btn;
}
else if (LV_WIN_BTN_ALIGN_LEFT == btn_alignment) {
if (is_header_left_side_empty) {
else if(LV_WIN_BTN_ALIGN_LEFT == btn_alignment) {
if(is_header_left_side_empty) {
/* Align the button to the right of the header */
lv_obj_align(btn, ext->header, LV_ALIGN_IN_LEFT_MID, header_left, 0);
is_header_left_side_empty = false;
} else {
}
else {
/* Align the button to the right of the previous button */
lv_obj_align(btn, btn_prev_at_left, LV_ALIGN_OUT_RIGHT_MID, header_inner, 0);
}