diff --git a/src/base/dialog_highlighter_factory.c b/src/base/dialog_highlighter_factory.c index 26bfc17f0..4c5cd93ef 100644 --- a/src/base/dialog_highlighter_factory.c +++ b/src/base/dialog_highlighter_factory.c @@ -113,7 +113,7 @@ dialog_highlighter_t* dialog_highlighter_factory_create_highlighter( return h; #else return NULL; -#endif/*WITHOUT_DIALOG_HIGHLIGHTER*/ +#endif /*WITHOUT_DIALOG_HIGHLIGHTER*/ } ret_t dialog_highlighter_factory_set(dialog_highlighter_factory_t* factory) { diff --git a/src/base/style_const.c b/src/base/style_const.c index 9c3f58fc8..66864e689 100644 --- a/src/base/style_const.c +++ b/src/base/style_const.c @@ -97,7 +97,7 @@ static ret_t style_const_apply_props(style_t* s, widget_t* widget) { if (focusable != NULL) { widget->focusable = *focusable == 'T' || *focusable == 't'; } - + if (feedback != NULL) { widget->feedback = *feedback == 'T' || *feedback == 't'; } diff --git a/src/base/types_def.h b/src/base/types_def.h index 1458593f5..6363abf4b 100644 --- a/src/base/types_def.h +++ b/src/base/types_def.h @@ -359,7 +359,7 @@ typedef struct _system_info_t system_info_t; #ifdef WITHOUT_WINDOW_ANIMATOR_CACHE #define WITHOUT_DIALOG_HIGHLIGHTER 1 -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ /** * @enum bitmap_format_t diff --git a/src/base/window_animator.h b/src/base/window_animator.h old mode 100755 new mode 100644 index 21978780f..43ee5a8c2 --- a/src/base/window_animator.h +++ b/src/base/window_animator.h @@ -136,7 +136,7 @@ struct _window_animator_t { #ifndef WITHOUT_WINDOW_ANIMATOR_CACHE bitmap_t prev_img; bitmap_t curr_img; -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ bool_t open; float_t ratio; float_t percent; diff --git a/src/base/window_base.h b/src/base/window_base.h index a0711d8f3..f3d5eea59 100644 --- a/src/base/window_base.h +++ b/src/base/window_base.h @@ -239,7 +239,7 @@ typedef struct _window_base_t { * 单例。如果窗口存在,先关闭再打开。 */ bool_t single_instance; - + /** * @property {bool_t} strongly_focus * @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"] diff --git a/src/ext_widgets/gif_image/gif_image.c b/src/ext_widgets/gif_image/gif_image.c index c3b158bc0..80b76a46a 100644 --- a/src/ext_widgets/gif_image/gif_image.c +++ b/src/ext_widgets/gif_image/gif_image.c @@ -184,11 +184,10 @@ ret_t gif_image_stop(widget_t* widget) { return RET_OK; } - TK_DECL_VTABLE(gif_image) = {.size = sizeof(gif_image_t), .type = WIDGET_TYPE_GIF_IMAGE, - .space_key_to_activate = TRUE, - .return_key_to_activate = TRUE, + .space_key_to_activate = TRUE, + .return_key_to_activate = TRUE, .clone_properties = s_gif_image_properties, .persistent_properties = s_gif_image_properties, .parent = TK_PARENT_VTABLE(image_base), diff --git a/src/image_loader/image_loader_stb.c b/src/image_loader/image_loader_stb.c index 884a1bb62..d53428a04 100644 --- a/src/image_loader/image_loader_stb.c +++ b/src/image_loader/image_loader_stb.c @@ -64,7 +64,8 @@ ret_t stb_load_image(int32_t subtype, const uint8_t* buff, uint32_t buff_size, b if (subtype != ASSET_TYPE_IMAGE_GIF) { uint8_t* data = NULL; int out_channel_order; - uint8_t* stb_data = stbi_load_from_memory_ex(buff, buff_size, &w, &h, &n, &out_channel_order, 0); + uint8_t* stb_data = + stbi_load_from_memory_ex(buff, buff_size, &w, &h, &n, &out_channel_order, 0); return_value_if_fail(stb_data != NULL, RET_FAIL); if (n == 2) { @@ -74,11 +75,11 @@ ret_t stb_load_image(int32_t subtype, const uint8_t* buff, uint32_t buff_size, b data = stb_data; } #ifdef WITH_LCD_MONO - if (out_channel_order == STBI_ORDER_RGB) { - ret = bitmap_init_from_rgba(image, w, h, BITMAP_FMT_MONO, data, n); - } else { - ret = bitmap_init_from_bgra(image, w, h, BITMAP_FMT_MONO, data, n); - } + if (out_channel_order == STBI_ORDER_RGB) { + ret = bitmap_init_from_rgba(image, w, h, BITMAP_FMT_MONO, data, n); + } else { + ret = bitmap_init_from_bgra(image, w, h, BITMAP_FMT_MONO, data, n); + } #else if (out_channel_order == STBI_ORDER_RGB) { if (enable_bgr565 && rgba_data_is_opaque(data, w, h, n)) { diff --git a/src/native_window/native_window_sdl.c b/src/native_window/native_window_sdl.c index e148b51de..6d981616b 100644 --- a/src/native_window/native_window_sdl.c +++ b/src/native_window/native_window_sdl.c @@ -474,7 +474,7 @@ static native_window_t* native_window_create_internal(const char* title, uint32_ if (system_info()->app_type == APP_DESKTOP) { flags |= SDL_WINDOW_RESIZABLE; } -#endif/*NATIVE_WINDOW_NOT_RESIZABLE*/ +#endif /*NATIVE_WINDOW_NOT_RESIZABLE*/ #ifndef WITH_NANOVG_SOFT flags |= SDL_WINDOW_OPENGL | SDL_WINDOW_ALLOW_HIGHDPI; diff --git a/src/widgets/edit.c b/src/widgets/edit.c index 9a7984930..1e79c986f 100644 --- a/src/widgets/edit.c +++ b/src/widgets/edit.c @@ -1087,9 +1087,9 @@ static bool_t widget_has_uint_min_max(widget_t* widget) { return_value_if_fail(edit != NULL, FALSE); input_type = edit->input_type; - - return input_type == INPUT_TEXT || input_type == INPUT_ASCII || input_type == INPUT_PASSWORD - || input_type == INPUT_EMAIL || input_type == INPUT_UINT; + + return input_type == INPUT_TEXT || input_type == INPUT_ASCII || input_type == INPUT_PASSWORD || + input_type == INPUT_EMAIL || input_type == INPUT_UINT; } ret_t edit_get_prop(widget_t* widget, const char* name, value_t* v) { diff --git a/src/window_animators/window_animator_center_scale.c b/src/window_animators/window_animator_center_scale.c index 92fc2e897..a1c28daec 100644 --- a/src/window_animators/window_animator_center_scale.c +++ b/src/window_animators/window_animator_center_scale.c @@ -22,20 +22,19 @@ #include "window_animators/window_animator_center_scale.h" #ifdef WITH_NANOVG_GPU -#define START_PERCENT 0.5f +#define START_PERCENT 0.5f #else -#define START_PERCENT 0.9f +#define START_PERCENT 0.9f #endif static ret_t window_animator_center_scale_update_percent(window_animator_t* wa) { - if (wa->open) { - wa->percent = START_PERCENT + (1-START_PERCENT) * wa->easing(wa->time_percent); + wa->percent = START_PERCENT + (1 - START_PERCENT) * wa->easing(wa->time_percent); if (wa->easing(wa->time_percent) == 0) { wa->percent = 0; } } else { - wa->percent = 1.0f - (1-START_PERCENT) * wa->easing(wa->time_percent); + wa->percent = 1.0f - (1 - START_PERCENT) * wa->easing(wa->time_percent); } return RET_OK; @@ -64,9 +63,9 @@ static ret_t window_animator_center_scale_draw_curr(window_animator_t* wa) { #else #ifdef WITH_NANOVG_GPU vgcanvas_t* vg = canvas_get_vgcanvas(c); - float x = win->x + (win->w/2); - float y = win->y + (win->h/2); - float alpha = 1-(1-scale) / (1 - START_PERCENT); + float x = win->x + (win->w / 2); + float y = win->y + (win->h / 2); + float alpha = 1 - (1 - scale) / (1 - START_PERCENT); vgcanvas_save(vg); vgcanvas_translate(vg, x, y); @@ -79,9 +78,9 @@ static ret_t window_animator_center_scale_draw_curr(window_animator_t* wa) { #else assert(!"not supported"); return RET_FAIL; -#endif/*WITH_NANOVG_GPU*/ +#endif /*WITH_NANOVG_GPU*/ -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ } static const window_animator_vtable_t s_window_animator_center_scale_vt = { diff --git a/src/window_animators/window_animator_common.c b/src/window_animators/window_animator_common.c index 716fd9b09..662d66640 100644 --- a/src/window_animators/window_animator_common.c +++ b/src/window_animators/window_animator_common.c @@ -46,12 +46,12 @@ ret_t window_animator_to_bottom_draw_curr(window_animator_t* wa) { return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst); #else - int32_t y = -win->h * (1-percent); + int32_t y = -win->h * (1 - percent); canvas_translate(c, 0, y); widget_paint(win, c); canvas_untranslate(c, 0, y); return RET_OK; -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ } ret_t window_animator_to_top_draw_curr(window_animator_t* wa) { @@ -71,12 +71,12 @@ ret_t window_animator_to_top_draw_curr(window_animator_t* wa) { return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst); #else - int32_t y = win->h * (1-percent); + int32_t y = win->h * (1 - percent); canvas_translate(c, 0, y); widget_paint(win, c); canvas_untranslate(c, 0, y); return RET_OK; -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ } ret_t window_animator_to_left_draw_curr(window_animator_t* wa) { @@ -96,13 +96,13 @@ ret_t window_animator_to_left_draw_curr(window_animator_t* wa) { return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst); #else - int32_t x = -win->w * (1-percent); + int32_t x = -win->w * (1 - percent); canvas_translate(c, x, 0); widget_paint(win, c); canvas_untranslate(c, x, 0); return RET_OK; -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ } ret_t window_animator_to_right_draw_curr(window_animator_t* wa) { @@ -121,13 +121,13 @@ ret_t window_animator_to_right_draw_curr(window_animator_t* wa) { return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst); #else - int32_t x = win->w * (1-percent); + int32_t x = win->w * (1 - percent); canvas_translate(c, x, 0); widget_paint(win, c); canvas_untranslate(c, x, 0); return RET_OK; -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ } static ret_t window_animator_paint_system_bar(window_animator_t* wa); @@ -141,7 +141,7 @@ static ret_t window_animator_open_destroy(window_animator_t* wa) { bitmap_destroy(&(wa->prev_img)); } bitmap_destroy(&(wa->curr_img)); -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ memset(wa, 0x00, sizeof(window_animator_t)); TKMEM_FREE(wa); @@ -234,7 +234,7 @@ ret_t window_animator_prepare(window_animator_t* wa, canvas_t* c, widget_t* prev window_manager_snap_prev_window(wm, prev_win, &(wa->prev_img)); window_manager_snap_curr_window(wm, curr_win, &(wa->curr_img)); wa->dialog_highlighter = window_manager_get_dialog_highlighter(wm); -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ return RET_OK; } @@ -316,7 +316,7 @@ ret_t window_animator_overlap_default_draw_prev(window_animator_t* wa) { #else widget_paint(win, c); return RET_OK; -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ } ret_t window_animator_begin_frame(window_animator_t* wa) { @@ -336,6 +336,6 @@ ret_t window_animator_end_frame(window_animator_t* wa) { if (tk_str_eq(wa->vt->type, WINDOW_ANIMATOR_VTRANSLATE)) { window_animator_paint_system_bar(wa); } - + return canvas_end_frame(wa->canvas); } diff --git a/src/window_animators/window_animator_fade.c b/src/window_animators/window_animator_fade.c index d9717a892..2a6c5d436 100644 --- a/src/window_animators/window_animator_fade.c +++ b/src/window_animators/window_animator_fade.c @@ -37,7 +37,7 @@ static ret_t window_animator_fade_draw_curr(window_animator_t* wa) { lcd_set_global_alpha(c->lcd, global_alpha); return widget_paint(win, c); -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ } static const window_animator_vtable_t s_window_animator_fade_vt = { diff --git a/src/window_animators/window_animator_htranslate.c b/src/window_animators/window_animator_htranslate.c index 1b11ef629..34357e93c 100644 --- a/src/window_animators/window_animator_htranslate.c +++ b/src/window_animators/window_animator_htranslate.c @@ -49,7 +49,7 @@ static ret_t window_animator_htranslate_draw_prev(window_animator_t* wa) { widget_paint(win, c); canvas_untranslate(c, -x, 0); return RET_OK; -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ } static ret_t window_animator_htranslate_draw_curr(window_animator_t* wa) { @@ -70,7 +70,7 @@ static ret_t window_animator_htranslate_draw_curr(window_animator_t* wa) { canvas_untranslate(c, x, 0); return RET_OK; -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ } static const window_animator_vtable_t s_window_animator_htranslate_vt = { diff --git a/src/window_animators/window_animator_vtranslate.c b/src/window_animators/window_animator_vtranslate.c index b7ee1e6f4..4f9dcae9b 100644 --- a/src/window_animators/window_animator_vtranslate.c +++ b/src/window_animators/window_animator_vtranslate.c @@ -50,7 +50,7 @@ static ret_t window_animator_vtranslate_draw_prev(window_animator_t* wa) { widget_paint(win, c); canvas_untranslate(c, 0, -y); return RET_OK; -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ } static ret_t window_animator_vtranslate_draw_curr(window_animator_t* wa) { @@ -66,13 +66,13 @@ static ret_t window_animator_vtranslate_draw_curr(window_animator_t* wa) { return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst); #else - y = win->h * (1-percent); + y = win->h * (1 - percent); canvas_translate(c, 0, y); widget_paint(win, c); canvas_untranslate(c, 0, y); return RET_OK; -#endif/*WITHOUT_WINDOW_ANIMATOR_CACHE*/ +#endif /*WITHOUT_WINDOW_ANIMATOR_CACHE*/ } static const window_animator_vtable_t s_window_animator_vtranslate_vt = { diff --git a/src/window_manager/window_manager_default.c b/src/window_manager/window_manager_default.c index b08877e59..54e26a849 100644 --- a/src/window_manager/window_manager_default.c +++ b/src/window_manager/window_manager_default.c @@ -137,7 +137,8 @@ ret_t window_manager_default_snap_curr_window(widget_t* widget, widget_t* curr_w r = rect_init(curr_win->x, curr_win->y, curr_win->w, curr_win->h); canvas_save(c); - canvas = canvas_offline_create(canvas_get_width(c), canvas_get_height(c), lcd_get_desired_bitmap_format(c->lcd)); + canvas = canvas_offline_create(canvas_get_width(c), canvas_get_height(c), + lcd_get_desired_bitmap_format(c->lcd)); canvas_offline_begin_draw(canvas); canvas_set_clip_rect(canvas, &r); ENSURE(widget_on_paint_background(widget, canvas) == RET_OK); @@ -203,7 +204,8 @@ ret_t window_manager_default_snap_prev_window(widget_t* widget, widget_t* prev_w r = rect_init(prev_win->x, prev_win->y, prev_win->w, prev_win->h); canvas_save(c); - canvas = canvas_offline_create(canvas_get_width(c), canvas_get_height(c), lcd_get_desired_bitmap_format(c->lcd)); + canvas = canvas_offline_create(canvas_get_width(c), canvas_get_height(c), + lcd_get_desired_bitmap_format(c->lcd)); canvas_offline_begin_draw(canvas); canvas_set_clip_rect(canvas, &r); ENSURE(widget_on_paint_background(widget, canvas) == RET_OK); diff --git a/tests/button_test.cc b/tests/button_test.cc index 195ef697c..a5c85f130 100644 --- a/tests/button_test.cc +++ b/tests/button_test.cc @@ -185,7 +185,9 @@ TEST(Button, to_xml) { widget_set_text_utf8(w1, "<>&\""); widget_to_xml(w1, &str); log_debug("w1:%s\n", str.str); - ASSERT_STREQ(str.str, "\r\n\n"); + ASSERT_STREQ(str.str, + "\r\n\n"); widget_destroy(w1); str_reset(&str); diff --git a/tests/gauge_pointer_test.cc b/tests/gauge_pointer_test.cc index f1f8ac716..cd1648c27 100644 --- a/tests/gauge_pointer_test.cc +++ b/tests/gauge_pointer_test.cc @@ -30,7 +30,7 @@ TEST(GuagePointer, set_angle) { EXPECT_TRUE(gauge_pointer_set_angle(gauge_pointer, -10) == RET_OK); EXPECT_TRUE(gauge_pointer_set_angle(gauge_pointer, 370) == RET_OK); - + EXPECT_TRUE(gauge_pointer_set_angle(gauge_pointer, 10.5) == RET_OK); EXPECT_TRUE(gauge_pointer_tmp->angle == 10.5); diff --git a/tests/gif_image_test.cc b/tests/gif_image_test.cc index fe2bcd35a..4303fd460 100644 --- a/tests/gif_image_test.cc +++ b/tests/gif_image_test.cc @@ -38,7 +38,7 @@ TEST(GifImage, state) { gif_image_play(img); ASSERT_EQ(GIF_IMAGE(img)->running, TRUE); - + gif_image_pause(img); ASSERT_EQ(GIF_IMAGE(img)->running, FALSE); diff --git a/tests/widget_test.cc b/tests/widget_test.cc index 221bded49..fbdb365d1 100644 --- a/tests/widget_test.cc +++ b/tests/widget_test.cc @@ -1330,7 +1330,7 @@ TEST(Widget, is_focusable) { ASSERT_EQ(widget_is_focusable(w), FALSE); widget_set_enable(w, TRUE); ASSERT_EQ(widget_is_focusable(w), TRUE); - + widget_set_sensitive(w, FALSE); ASSERT_EQ(widget_is_focusable(w), FALSE); widget_set_sensitive(w, TRUE); @@ -1388,4 +1388,3 @@ TEST(Widget, update_style4) { widget_destroy(w); } - diff --git a/tests/window_test.cc b/tests/window_test.cc index bdcaf4ea7..6d905361d 100644 --- a/tests/window_test.cc +++ b/tests/window_test.cc @@ -122,11 +122,11 @@ TEST(Window, focused_widget) { widget_t* b = button_create(w, 0, 0, 60, 30); widget_set_focusable(b, TRUE); widget_set_name(b, "b1"); - + b = button_create(w, 0, 30, 60, 30); widget_set_focusable(b, TRUE); widget_set_name(b, "b2"); - + b = button_create(w, 0, 30, 60, 30); widget_set_focusable(b, TRUE); widget_set_name(b, "b3");