diff --git a/img_conf_templ.h b/img_conf_templ.h new file mode 100644 index 000000000..b32a77704 --- /dev/null +++ b/img_conf_templ.h @@ -0,0 +1,41 @@ +/** + * @file img_conf.h + * + */ + +#if 0 /*Remove this to enable the content (Delete the last #endif too!)*/ + +#ifndef IMG_CONF_H +#define IMG_CONF_H + +/********************* + * INCLUDES + *********************/ + +/********************* + * DEFINES + *********************/ + +/* Enable here the used images + * For example: + * #define USE_IMG_EXAMPLE 1 + * + * This is compatible with the images + * generated by the image converter utility + * For more information see: www.littlev.hu */ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif + +#endif /*Remove this to enable the content*/ diff --git a/lv_app/lv_app.c b/lv_app/lv_app.c index c0461ccba..a5a6ba0d6 100644 --- a/lv_app/lv_app.c +++ b/lv_app/lv_app.c @@ -11,8 +11,15 @@ #if LV_APP_ENABLE != 0 #include "lv_app_util/lv_app_kb.h" #include "lv_app_util/lv_app_notice.h" +#include "lv_app_util/lv_app_fsel.h" + #include "lvgl/lv_misc/anim.h" +#include "../lv_appx/lv_app_example.h" +#include "../lv_appx/lv_app_sysmon.h" +#include "../lv_appx/lv_app_terminal.h" +#include "../lv_appx/lv_app_files.h" + /********************* * DEFINES *********************/ @@ -44,6 +51,7 @@ static lv_action_res_t lv_app_win_open_anim_create(lv_app_inst_t * app); static lv_action_res_t lv_app_win_minim_anim_create(lv_app_inst_t * app); #if LV_APP_EFFECT_ANIM != 0 && LV_APP_ANIM_WIN != 0 static void lv_app_win_close_anim_cb(lv_obj_t * app_win); +static void lv_app_win_minim_anim_cb(lv_obj_t * app_win); #endif static void lv_app_init_icons(void); @@ -64,33 +72,43 @@ static lv_obj_t * sc_page; /*A page for the shortcuts */ static lv_app_inst_t * con_send; /*The sender application in connection mode. Not NLL means connection mode is active*/ static lv_app_style_t app_style; /*Styles for application related things*/ - /*Declare icons*/ -LV_IMG_DECLARE(img_add); -LV_IMG_DECLARE(img_battery_empty); -LV_IMG_DECLARE(img_battery_full); -LV_IMG_DECLARE(img_battery_half); -LV_IMG_DECLARE(img_bubble); -LV_IMG_DECLARE(img_calendar); -LV_IMG_DECLARE(img_clock); +#if USE_IMG_CLOSE != 0 LV_IMG_DECLARE(img_close); +#endif + +#if USE_IMG_DOWN != 0 LV_IMG_DECLARE(img_down); +#endif + +#if USE_IMG_DRIVER != 0 LV_IMG_DECLARE(img_driver); -LV_IMG_DECLARE(img_eject); +#endif + +#if USE_IMG_FILE != 0 +LV_IMG_DECLARE(img_file); +#endif + +#if USE_IMG_FOLDER != 0 LV_IMG_DECLARE(img_folder); -LV_IMG_DECLARE(img_image); +#endif + +#if USE_IMG_LEFT != 0 LV_IMG_DECLARE(img_left); -LV_IMG_DECLARE(img_music); +#endif + +#if USE_IMG_OK != 0 LV_IMG_DECLARE(img_ok); -LV_IMG_DECLARE(img_play); +#endif + +#if USE_IMG_RIGHT != 0 LV_IMG_DECLARE(img_right); -LV_IMG_DECLARE(img_settings); -LV_IMG_DECLARE(img_shut_down); -LV_IMG_DECLARE(img_star); +#endif + +#if USE_IMG_UP != 0 LV_IMG_DECLARE(img_up); -LV_IMG_DECLARE(img_user); -LV_IMG_DECLARE(img_video); -LV_IMG_DECLARE(img_volume); +#endif + /********************** * MACROS @@ -120,6 +138,7 @@ void lv_app_init(void) /*Init. the utilities*/ lv_app_kb_init(); lv_app_notice_init(); + lv_app_fsel_init(); /*Initialize all application descriptors*/ /*ADD NEW APPLICATION INITS HERE!!!*/ @@ -128,15 +147,30 @@ void lv_app_init(void) dsc = ll_ins_head(&app_dsc_ll); *dsc = lv_app_example_init(); #endif + +#if USE_LV_APP_SYSMON != 0 + dsc = ll_ins_head(&app_dsc_ll); + *dsc = lv_app_sysmon_init(); +#endif + +#if USE_LV_APP_TERMINAL != 0 + dsc = ll_ins_head(&app_dsc_ll); + *dsc = lv_app_terminal_init(); +#endif + +#if USE_LV_APP_FILES != 0 + dsc = ll_ins_head(&app_dsc_ll); + *dsc = lv_app_files_init(); +#endif } /** * Run an application according to 'app_dsc' * @param app_dsc pointer to an application descriptor - * @param cstr a Create STRing which can give initial parameters to the application (NULL or "" if unused) + * @param conf pointer to an application specific configuration structure or NULL if unused * @return pointer to the opened application or NULL if any error occurred */ -lv_app_inst_t * lv_app_run(const lv_app_dsc_t * app_dsc, const char * cstr) +lv_app_inst_t * lv_app_run(const lv_app_dsc_t * app_dsc, void * conf) { /*Add a new application and initialize it*/ lv_app_inst_t * app; @@ -144,10 +178,15 @@ lv_app_inst_t * lv_app_run(const lv_app_dsc_t * app_dsc, const char * cstr) app->dsc = app_dsc; app->app_data = dm_alloc(app_dsc->app_data_size); app->name = NULL; + app->sc = NULL; + app->sc_data = NULL; + app->sc_title = NULL; + app->win = NULL; + app->win_data = NULL; lv_app_rename(app, app_dsc->name); /*Set a default name*/ /*Call the application specific run function*/ - app_dsc->app_run(app, cstr); + app_dsc->app_run(app, conf); return app; } @@ -161,10 +200,18 @@ void lv_app_close(lv_app_inst_t * app) lv_app_win_close(app); lv_app_sc_close(app); + /*Clear the connection list*/ + lv_app_con_del(app, NULL); + lv_app_con_del(NULL, app); + app->dsc->app_close(app); + memset(app->app_data, 0, app->dsc->app_data_size); dm_free(app->app_data); dm_free(app->name); + + ll_rem(&app_inst_ll, app); + dm_free(app); } /** @@ -175,7 +222,7 @@ void lv_app_close(lv_app_inst_t * app) lv_obj_t * lv_app_sc_open(lv_app_inst_t * app) { /*Save the current position of the scrollable part of the page*/ - cord_t scrl_y = lv_obj_get_y(lv_page_get_scrable(sc_page)); + cord_t scrl_y = lv_obj_get_y(lv_page_get_scrl(sc_page)); /*Create a basic shortcut*/ app->sc = lv_btn_create(sc_page, NULL); @@ -208,7 +255,7 @@ lv_obj_t * lv_app_sc_open(lv_app_inst_t * app) /* Restore position of the scrollable part of the page because * it moved when the shortcut is created*/ - lv_obj_set_y(lv_page_get_scrable(sc_page), scrl_y); + lv_obj_set_y(lv_page_get_scrl(sc_page), scrl_y); #if LV_APP_EFFECT_ANIM == 0 lv_page_focus(sc_page, app->sc, false); #else @@ -228,6 +275,7 @@ void lv_app_sc_close(lv_app_inst_t * app) lv_obj_del(app->sc); app->sc = NULL; app->sc_title = NULL; + memset(app->sc_data, 0, app->dsc->sc_data_size); dm_free(app->sc_data); app->sc_data = NULL; } @@ -239,7 +287,6 @@ void lv_app_sc_close(lv_app_inst_t * app) */ lv_obj_t * lv_app_win_open(lv_app_inst_t * app) { - /*Close the app list if opened*/ if(app_list != NULL) { lv_obj_del(app_list); @@ -249,12 +296,13 @@ lv_obj_t * lv_app_win_open(lv_app_inst_t * app) app->win = lv_win_create(lv_scr_act(), NULL); lv_obj_set_free_p(app->win, app); lv_obj_set_style(app->win, &app_style.win_style); - lv_obj_t * win_content = lv_page_get_scrable(lv_win_get_content(app->win)); + lv_win_set_title(app->win, app->dsc->name); + lv_obj_t * win_content = lv_page_get_scrl(app->win); lv_rect_set_fit(win_content, false, true); - lv_obj_set_width(win_content, LV_HOR_RES - 2 * app_style.win_style.content.bg_rects.hpad); + lv_obj_set_width(win_content, LV_HOR_RES - 2 * app_style.win_style.pages.bg_rects.hpad); - lv_win_add_ctrl_btn(app->win, "U:/icon_down", lv_app_win_minim_action); - lv_win_add_ctrl_btn(app->win, "U:/icon_close", lv_app_win_close_action); + lv_win_add_ctrl_btn(app->win, "U:/icon_down" ,lv_app_win_minim_action); + lv_win_add_ctrl_btn(app->win, "U:/icon_close" ,lv_app_win_close_action); app->win_data = dm_alloc(app->dsc->win_data_size); app->dsc->win_open(app, app->win); @@ -274,6 +322,8 @@ void lv_app_win_close(lv_app_inst_t * app) lv_obj_del(app->win); app->win = NULL; + + memset(app->win_data, 0, app->dsc->win_data_size); dm_free(app->win_data); app->win_data = NULL; } @@ -282,23 +332,20 @@ void lv_app_win_close(lv_app_inst_t * app) * @param app_send pointer to the application which is sending the message * @param type type of data from 'lv_app_com_type_t' enum * @param data pointer to the sent data - * @param len length of 'data' in bytes + * @param size length of 'data' in bytes * @return number application which were received the message */ -uint16_t lv_app_com_send(lv_app_inst_t * app_send, lv_app_com_type_t type , const void * data, uint32_t len) +uint16_t lv_app_com_send(lv_app_inst_t * app_send, lv_app_com_type_t type , const void * data, uint32_t size) { + if(type == LV_APP_COM_TYPE_INV) return 0; + lv_app_con_t * con; uint16_t rec_cnt = 0; - /*Add the notifications to the notice utility*/ - if(type == LV_APP_COM_TYPE_NOTICE) { - lv_app_notice_add(data); - } - LL_READ(app_con_ll, con) { if(con->sender == app_send) { if(con->receiver->dsc->com_rec != NULL) - con->receiver->dsc->com_rec(app_send, con->receiver, type, data, len); + con->receiver->dsc->com_rec(app_send, con->receiver, type, data, size); rec_cnt ++; } } @@ -342,15 +389,16 @@ void lv_app_con_set(lv_app_inst_t * sender, lv_app_inst_t * receiver) /** * Delete a communication connection - * @param sender pointer to a data sender application - * @param receiver pointer to a data receiver application + * @param sender pointer to a data sender application or NULL to be true for all sender + * @param receiver pointer to a data receiver application or NULL to be true for all receiver */ void lv_app_con_del(lv_app_inst_t * sender, lv_app_inst_t * receiver) { lv_app_con_t * con; LL_READ(app_con_ll, con) { - if(con->sender == sender && con->receiver == receiver) { + if((con->sender == sender || sender == NULL) && + (con->receiver == receiver || receiver == NULL)) { ll_rem(&app_con_ll, con); dm_free(con); } @@ -426,23 +474,47 @@ lv_app_inst_t * lv_app_get_next(lv_app_inst_t * prev, lv_app_dsc_t * dsc) if(next->dsc == dsc || dsc == NULL) return next; + prev = next; + }; return NULL; } +/** + * Read the list of applications descriptors. (Get he next element) + * @param prev the previous application descriptors(at the first call give NULL to get the first) + * @return pointer to the next application descriptors or NULL if no more + */ +lv_app_dsc_t ** lv_app_dsc_get_next(lv_app_dsc_t ** prev) +{ + lv_app_dsc_t ** next; + + if(prev == NULL) next = ll_get_head(&app_dsc_ll); + else next = ll_get_next(&app_dsc_ll, prev); + + if(next == NULL) return NULL; + + return next; +} /** * Refresh the style of the applications * */ -void lv_app_refr_style(void) +void lv_app_style_refr(void) { lv_style_refr_all(NULL); lv_obj_set_opa(menuh, app_style.menu_opa); lv_obj_set_opa(app_btn, app_style.menu_btn_opa); - lv_obj_set_width(lv_page_get_scrable(sc_page), + lv_obj_set_width(lv_page_get_scrl(sc_page), LV_HOR_RES - 2 * (app_style.sc_page_style.bg_rects.hpad)); + + app_style.win_useful_w = LV_HOR_RES - 2 * (app_style.win_style.pages.bg_rects.hpad + + app_style.win_style.pages.scrl_rects.hpad); + + app_style.win_useful_h = LV_VER_RES - 2 * (app_style.win_style.pages.bg_rects.vpad + + app_style.win_style.pages.scrl_rects.vpad); } @@ -450,7 +522,7 @@ void lv_app_refr_style(void) * Get a pointer to the application style structure. If modified then 'lv_app_refr_style' should be called * @return pointer to the application style structure */ -lv_app_style_t * lv_app_get_style(void) +lv_app_style_t * lv_app_style_get(void) { return &app_style; } @@ -469,8 +541,8 @@ static void lv_app_init_desktop(void) lv_obj_set_style(sc_page, &app_style.sc_page_style); lv_obj_set_size(sc_page, LV_HOR_RES, LV_VER_RES); lv_obj_set_pos(sc_page, 0, 0); - lv_rect_set_fit(lv_page_get_scrable(sc_page), false, true); - lv_rect_set_layout(lv_page_get_scrable(sc_page), LV_RECT_LAYOUT_GRID); + lv_rect_set_fit(lv_page_get_scrl(sc_page), false, true); + lv_rect_set_layout(lv_page_get_scrl(sc_page), LV_RECT_LAYOUT_GRID); lv_page_set_rel_action(sc_page, lv_app_sc_page_rel_action); /*Menu on the top*/ @@ -500,7 +572,7 @@ static void lv_app_init_desktop(void) */ lv_obj_align(sys_apph, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0); - lv_app_refr_style(); + lv_app_style_refr(); } /*----------------------- @@ -524,7 +596,7 @@ static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_dispi_t * d else { app_list = lv_list_create(lv_scr_act(), NULL); lv_obj_set_style(app_list, &app_style.app_list_style); - lv_obj_set_opa(app_list, app_style.menu_opa); + lv_obj_set_opar(app_list, app_style.menu_opa); lv_obj_set_size(app_list, app_style.app_list_w, app_style.app_list_h); lv_obj_set_y(app_list, app_style.menu_h); @@ -555,7 +627,7 @@ static lv_action_res_t lv_app_menu_elem_rel_action(lv_obj_t * app_elem_btn, lv_d lv_obj_del(app_list); app_list = NULL; - lv_app_inst_t * app = lv_app_run(dsc, ""); + lv_app_inst_t * app = lv_app_run(dsc, NULL); lv_app_sc_open(app); #if LV_APP_EFFECT_ANIM != 0 && LV_APP_EFFECT_OPA_ANIM != 0 && LV_APP_ANIM_SC != 0 @@ -710,7 +782,8 @@ static lv_action_res_t lv_app_win_close_action(lv_obj_t * close_btn, lv_dispi_t lv_app_kb_close(false); #if LV_APP_EFFECT_ANIM != 0 && LV_APP_EFFECT_OPA != 0 && LV_APP_ANIM_WIN != 0 - lv_obj_anim(app->win, LV_ANIM_FADE | ANIM_OUT, LV_APP_ANIM_WIN, 0, lv_app_win_close_anim_cb); + lv_obj_anim(app->win, LV_ANIM_FLOAT_BOTTOM | ANIM_OUT, LV_APP_ANIM_WIN, 0, NULL); + lv_obj_anim(app->win, LV_ANIM_FLOAT_LEFT | ANIM_OUT, LV_APP_ANIM_WIN, 0, lv_app_win_close_anim_cb); lv_app_sc_close(app); /*The animation will close the window*/ return LV_ACTION_RES_OK; @@ -793,12 +866,6 @@ static lv_action_res_t lv_app_win_open_anim_create(lv_app_inst_t * app) a.fp = (anim_fp_t) lv_obj_set_y; anim_create(&a); -#if LV_APP_EFFECT_OPA_ANIM != 0 - a.start = OPA_TRANSP; - a.end = OPA_COVER; - a.fp = (anim_fp_t) lv_obj_set_opar; - anim_create(&a); -#endif /*LV_APP_EFFECT_OPA != 0*/ #endif /*LV_APP_EFFECT_ANIM != 0 && LV_APP_ANIM_WIN != 0*/ return LV_ACTION_RES_OK; @@ -832,36 +899,27 @@ static lv_action_res_t lv_app_win_minim_anim_create(lv_app_inst_t * app) a.path = anim_get_path(ANIM_PATH_LIN); - a.end = lv_obj_get_width(app->sc); a.start = LV_HOR_RES; + a.end = lv_obj_get_width(app->sc); a.fp = (anim_fp_t) lv_obj_set_width; anim_create(&a); - a.end = lv_obj_get_height(app->sc); a.start = LV_VER_RES; + a.end = lv_obj_get_height(app->sc); a.fp = (anim_fp_t) lv_obj_set_height; anim_create(&a); - a.end = cords.x1; a.start = 0; + a.end = cords.x1; a.fp = (anim_fp_t) lv_obj_set_x; anim_create(&a); - a.end = cords.y1; a.start = 0; + a.end = cords.y1; a.fp = (anim_fp_t) lv_obj_set_y; -#if LV_APP_EFFECT_OPA_ANIM == 0 - a.end_cb = (void (*)(void *))lv_app_win_close_anim_cb; -#endif + a.end_cb = (void (*)(void *))lv_app_win_minim_anim_cb; anim_create(&a); -#if LV_APP_EFFECT_OPA_ANIM != 0 - a.end = OPA_TRANSP; - a.start = OPA_COVER; - a.fp = (anim_fp_t) lv_obj_set_opar; - a.end_cb = (void (*)(void *))lv_app_win_close_anim_cb; - anim_create(&a); -#endif return LV_ACTION_RES_OK; #else /*LV_APP_ANIM_WIN == 0 || LV_APP_ANIM_LEVEL == 0*/ lv_app_win_close(app); @@ -871,10 +929,19 @@ static lv_action_res_t lv_app_win_minim_anim_create(lv_app_inst_t * app) #if LV_APP_EFFECT_ANIM != 0 /** - * Called when the window close or minimization animation is ready to close the window + * Called when the window close animation is ready to close the application * @param app_win pointer to a window */ static void lv_app_win_close_anim_cb(lv_obj_t * app_win) +{ + lv_app_inst_t * app = lv_obj_get_free_p(app_win); + lv_app_close(app); +} +/** + * Called when the window minimization animation is ready to close the window + * @param app_win pointer to a window + */ +static void lv_app_win_minim_anim_cb(lv_obj_t * app_win) { lv_app_inst_t * app = lv_obj_get_free_p(app_win); lv_app_win_close(app); @@ -889,7 +956,7 @@ static void lv_app_init_style(void) /*Coordinates*/ app_style.menu_h = 40 * LV_DOWNSCALE; app_style.app_list_w = LV_HOR_RES / 3; - app_style.app_list_h = (2 * LV_VER_RES) / 3; + app_style.app_list_h = (3 * LV_VER_RES) / 4; app_style.sc_title_margin = 2 * LV_DOWNSCALE; /*Opacity*/ @@ -933,17 +1000,13 @@ static void lv_app_init_style(void) app_style.menu_btn_img_style.recolor_opa = OPA_90; /*App list styles*/ - lv_lists_get(LV_LISTS_DEF,&app_style.app_list_style); - memcpy(&app_style.app_list_style.liste_btns, &app_style.menu_btn_style, sizeof(lv_btns_t)); - memcpy(&app_style.app_list_style.bg_pages.bg_rects, &app_style.menu_style, sizeof(lv_rects_t)); + lv_lists_get(LV_LISTS_SCRL,&app_style.app_list_style); + memcpy(&app_style.app_list_style.bg_pages.scrl_rects, &app_style.menu_style, sizeof(lv_rects_t)); + app_style.app_list_style.bg_pages.scrl_rects.hpad = 0 * LV_DOWNSCALE; + app_style.app_list_style.bg_pages.scrl_rects.vpad = 0 * LV_DOWNSCALE; + app_style.app_list_style.bg_pages.scrl_rects.opad = 0 * LV_DOWNSCALE; memcpy(&app_style.app_list_style.liste_labels, &app_style.menu_btn_label_style, sizeof(lv_labels_t)); - app_style.app_list_style.bg_pages.bg_rects.vpad = 0; - app_style.app_list_style.bg_pages.bg_rects.hpad = 0; - app_style.app_list_style.bg_pages.bg_rects.opad = 0; - app_style.app_list_style.bg_pages.scrable_rects.objs.transp = 1; - app_style.app_list_style.bg_pages.scrable_rects.vpad = 0; - app_style.app_list_style.bg_pages.scrable_rects.hpad = 0; - app_style.app_list_style.bg_pages.scrable_rects.opad = 0; + memcpy(&app_style.app_list_style.liste_btns, &app_style.menu_btn_style, sizeof(lv_btns_t)); app_style.app_list_style.bg_pages.sb_rects.objs.color = COLOR_GRAY; app_style.app_list_style.bg_pages.sb_rects.gcolor = COLOR_GRAY; app_style.app_list_style.bg_pages.sb_width = 8 * LV_DOWNSCALE; @@ -956,10 +1019,10 @@ static void lv_app_init_style(void) app_style.sc_page_style.bg_rects.vpad = app_style.menu_h; app_style.sc_page_style.bg_rects.hpad = 0; app_style.sc_page_style.bg_rects.opad = 0; - app_style.sc_page_style.scrable_rects.objs.transp = 1; - app_style.sc_page_style.scrable_rects.hpad = 20 * LV_DOWNSCALE; - app_style.sc_page_style.scrable_rects.vpad = 20 * LV_DOWNSCALE; - app_style.sc_page_style.scrable_rects.opad = 20 * LV_DOWNSCALE; + app_style.sc_page_style.scrl_rects.objs.transp = 1; + app_style.sc_page_style.scrl_rects.hpad = 20 * LV_DOWNSCALE; + app_style.sc_page_style.scrl_rects.vpad = 20 * LV_DOWNSCALE; + app_style.sc_page_style.scrl_rects.opad = 20 * LV_DOWNSCALE; /*Shortcut styles*/ lv_btns_get(LV_BTNS_DEF,&app_style.sc_style); @@ -998,28 +1061,38 @@ static void lv_app_init_style(void) app_style.sc_rec_style.rects.bopa = 30; app_style.sc_rec_style.rects.bwidth = 3 * LV_DOWNSCALE; - lv_labels_get(LV_LABELS_DEF,&app_style.sc_title_style); app_style.sc_title_style.font = LV_APP_FONT_SMALL; - app_style.sc_title_style.objs.color = COLOR_MAKE(0x20, 0x30, 0x40); + app_style.sc_title_style.objs.color = COLOR_MAKE(0x10, 0x18, 0x20); app_style.sc_title_style.mid = 1; + lv_labels_get(LV_LABELS_DEF,&app_style.sc_txt_style); + app_style.sc_txt_style.font = LV_APP_FONT_MEDIUM; + app_style.sc_txt_style.objs.color = COLOR_MAKE(0x10, 0x18, 0x20); + app_style.sc_txt_style.mid = 1; + /*Window styles*/ lv_wins_get(LV_WINS_DEF,&app_style.win_style); memcpy(&app_style.win_style.header, &app_style.menu_style, sizeof(lv_rects_t)); memcpy(&app_style.win_style.title, &app_style.menu_btn_label_style, sizeof(lv_labels_t)); memcpy(&app_style.win_style.ctrl_btn, &app_style.menu_btn_style, sizeof(lv_btns_t)); memcpy(&app_style.win_style.ctrl_img, &app_style.menu_btn_img_style, sizeof(lv_imgs_t)); - app_style.win_style.header_on_content = 1; app_style.win_style.header_opa = app_style.menu_opa; app_style.win_style.ctrl_btn_opa = app_style.menu_btn_opa; app_style.win_style.header.vpad = 5 * LV_DOWNSCALE; app_style.win_style.header.hpad = 5 * LV_DOWNSCALE; app_style.win_style.header.opad = 5 * LV_DOWNSCALE; - app_style.win_style.content.bg_rects.vpad = app_style.win_style.ctrl_btn_h + + app_style.win_style.pages.bg_rects.vpad = app_style.win_style.ctrl_btn_h + 2 * app_style.win_style.header.vpad; - app_style.win_style.content.bg_rects.hpad = 5 * LV_DOWNSCALE; - app_style.win_style.content.scrable_rects.objs.transp = 1; + app_style.win_style.pages.bg_rects.hpad = 5 * LV_DOWNSCALE; + app_style.win_style.pages.scrl_rects.objs.transp = 1; + app_style.win_style.pages.sb_mode = LV_PAGE_SB_MODE_AUTO; + + lv_labels_get(LV_LABELS_DEF,&app_style.win_txt_style); + app_style.win_txt_style.font = LV_APP_FONT_MEDIUM; + app_style.win_txt_style.objs.color = COLOR_MAKE(0x20, 0x20, 0x20); + app_style.win_txt_style.mid = 0; + app_style.win_txt_style.letter_space = 1 * LV_DOWNSCALE; } /** @@ -1027,31 +1100,41 @@ static void lv_app_init_style(void) */ static void lv_app_init_icons(void) { - lv_img_create_file("icon_add", img_add); - lv_img_create_file("icon_battery_empty", img_battery_empty); - lv_img_create_file("icon_battery_full", img_battery_full); - lv_img_create_file("icon_battery_half", img_battery_half); - lv_img_create_file("icon_bubble", img_bubble); - lv_img_create_file("icon_calendar", img_calendar); - lv_img_create_file("icon_clock", img_clock); +#if USE_IMG_CLOSE != 0 lv_img_create_file("icon_close", img_close); +#endif + +#if USE_IMG_DOWN != 0 lv_img_create_file("icon_down", img_down); +#endif + +#if USE_IMG_DRIVER != 0 lv_img_create_file("icon_driver", img_driver); - lv_img_create_file("icon_eject", img_eject); +#endif + +#if USE_IMG_FILE != 0 + lv_img_create_file("icon_file", img_file); +#endif + +#if USE_IMG_FOLDER != 0 lv_img_create_file("icon_folder", img_folder); - lv_img_create_file("icon_image", img_image); +#endif + +#if USE_IMG_LEFT != 0 lv_img_create_file("icon_left", img_left); - lv_img_create_file("icon_music", img_music); +#endif + +#if USE_IMG_OK != 0 lv_img_create_file("icon_ok", img_ok); - lv_img_create_file("icon_play", img_play); +#endif + +#if USE_IMG_RIGHT != 0 lv_img_create_file("icon_right", img_right); - lv_img_create_file("icon_settings", img_settings); - lv_img_create_file("icon_shut_down", img_shut_down); - lv_img_create_file("icon_star", img_star); +#endif + +#if USE_IMG_UP != 0 lv_img_create_file("icon_up", img_up); - lv_img_create_file("icon_user", img_user); - lv_img_create_file("icon_video", img_video); - lv_img_create_file("icon_volume", img_volume); +#endif } #endif /*LV_APP_ENABLE != 0*/ diff --git a/lv_app/lv_app.h b/lv_app/lv_app.h index 00ba12a4e..0e0e17a74 100644 --- a/lv_app/lv_app.h +++ b/lv_app/lv_app.h @@ -29,12 +29,12 @@ typedef enum typedef enum { - LV_APP_COM_TYPE_STR, /*String data to process*/ - LV_APP_COM_TYPE_BIN, /*Binary data as 'int32_t' array*/ - LV_APP_COM_TYPE_SYS, /*System level event*/ + LV_APP_COM_TYPE_CHAR, /*Stream of characters. Always '\0' terminated*/ + LV_APP_COM_TYPE_INT, /*Stream of 'int32_t' numbers*/ LV_APP_COM_TYPE_LOG, /*String about an event to log*/ - LV_APP_COM_TYPE_NOTICE, /*String to display to the user as a notification*/ LV_APP_COM_TYPE_TRIG, /*A trigger to do some specific action (data is ignored)*/ + LV_APP_COM_TYPE_INV, /*Invalid type*/ + LV_APP_COM_TYPE_NUM, /*Indicates the number of com. types*/ }lv_app_com_type_t; struct __LV_APP_DSC_T; @@ -55,7 +55,7 @@ typedef struct __LV_APP_DSC_T { const char * name; lv_app_mode_t mode; - void (*app_run)(lv_app_inst_t *, const char *); + void (*app_run)(lv_app_inst_t *, void *); void (*app_close) (lv_app_inst_t *); void (*com_rec) (lv_app_inst_t *, lv_app_inst_t *, lv_app_com_type_t, const void *, uint32_t); void (*sc_open) (lv_app_inst_t *, lv_obj_t *); @@ -74,11 +74,14 @@ typedef struct { lv_imgs_t menu_btn_img_style; lv_lists_t app_list_style; lv_pages_t sc_page_style; + lv_labels_t win_txt_style; lv_wins_t win_style; lv_btns_t sc_style; lv_btns_t sc_send_style; lv_btns_t sc_rec_style; lv_labels_t sc_title_style; + lv_labels_t sc_txt_style; + opa_t menu_opa; opa_t menu_btn_opa; @@ -88,6 +91,10 @@ typedef struct { cord_t app_list_w; cord_t app_list_h; cord_t sc_title_margin; + + /*Calculated values, do not set them!*/ + cord_t win_useful_w; + cord_t win_useful_h; }lv_app_style_t; @@ -95,9 +102,9 @@ typedef struct { * GLOBAL PROTOTYPES **********************/ void lv_app_init(void); -lv_app_inst_t * lv_app_run(const lv_app_dsc_t * app_dsc, const char * cstr); +lv_app_inst_t * lv_app_run(const lv_app_dsc_t * app_dsc, void * conf); void lv_app_close(lv_app_inst_t * app); -uint16_t lv_app_com_send(lv_app_inst_t * app_send, lv_app_com_type_t type , const void * data, uint32_t len); +uint16_t lv_app_com_send(lv_app_inst_t * app_send, lv_app_com_type_t type , const void * data, uint32_t size); lv_obj_t * lv_app_sc_open(lv_app_inst_t * app); void lv_app_sc_close(lv_app_inst_t * app); lv_obj_t * lv_app_win_open(lv_app_inst_t * app); @@ -105,12 +112,15 @@ void lv_app_win_close(lv_app_inst_t * app); lv_obj_t * lv_app_win_get_from_obj(lv_obj_t * obj); const lv_app_dsc_t * lv_app_dsc_get(const char * name); +bool lv_app_con_check(lv_app_inst_t * sender, lv_app_inst_t * receiver); void lv_app_con_set(lv_app_inst_t * sender, lv_app_inst_t * receiver); -lv_app_style_t * lv_app_get_style(void); +void lv_app_con_del(lv_app_inst_t * sender, lv_app_inst_t * receiver); +lv_app_style_t * lv_app_style_get(void); void lv_app_rename(lv_app_inst_t * app, const char * name); -void lv_app_refr_style(void); +void lv_app_style_refr(void); lv_app_inst_t * lv_app_get_next(lv_app_inst_t * prev, lv_app_dsc_t * dsc); +lv_app_dsc_t ** lv_app_dsc_get_next(lv_app_dsc_t ** prev); const lv_app_dsc_t * lv_app_example_init(void); diff --git a/lv_app/lv_app_util/lv_app_fsel.c b/lv_app/lv_app_util/lv_app_fsel.c new file mode 100644 index 000000000..39d432e24 --- /dev/null +++ b/lv_app/lv_app_util/lv_app_fsel.c @@ -0,0 +1,382 @@ +/** + * @file lv_app_fsel.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "lv_app_fsel.h" +#if LV_APP_ENABLE != 0 + +#include +#include "lv_app_notice.h" + +/********************* + * DEFINES + *********************/ +#define LV_APP_FSEL_FN_MAX_LEN 128 +#define LV_APP_FSEL_PATH_MAX_LEN 256 +#define LV_APP_FSEL_PAGE_SIZE 8 + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ +static void fsel_refr(void); +static lv_action_res_t fsel_close_action(lv_obj_t * close, lv_dispi_t * dispi); +static lv_action_res_t fsel_up_action(lv_obj_t * up, lv_dispi_t * dispi); +static lv_action_res_t fsel_next_action(lv_obj_t * next, lv_dispi_t * dispi); +static lv_action_res_t fsel_prev_action(lv_obj_t * prev, lv_dispi_t * dispi); +static lv_action_res_t fsel_drv_action(lv_obj_t * drv, lv_dispi_t * dispi); +static lv_action_res_t fsel_drv_lpr_action(lv_obj_t * drv, lv_dispi_t * dispi); +static lv_action_res_t fsel_folder_action(lv_obj_t * folder, lv_dispi_t * dispi); +static lv_action_res_t fsel_folder_lpr_action(lv_obj_t * folder, lv_dispi_t * dispi); +static lv_action_res_t fsel_file_action(lv_obj_t * file, lv_dispi_t * dispi); + +/********************** + * STATIC VARIABLES + **********************/ +static const char * fsel_filter; +static char fsel_path[LV_APP_FSEL_PATH_MAX_LEN]; +static uint16_t fsel_file_cnt; +static lv_obj_t * fsel_win; +static lv_obj_t * fsel_list; +static lv_lists_t fsel_lists; +static void * fsel_param; +static void (*fsel_ok_action)(void *, const char *); + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +/** + * Initialize the File selector utility + */ +void lv_app_fsel_init(void) +{ + lv_lists_get(LV_LISTS_TRANSP, &fsel_lists); +} + +/** + * Open the File selector + * @param path start path + * @param filter show only files with a specific extension, e.g. "wav". + * "/" means filter to folders. + * @param param a free parameter which will be added to 'ok_action' + * @param ok_action an action to call when a file or folder is chosen + */ +void lv_app_fsel_open(const char * path, const char * filter, void * param, void (*ok_action)(void *, const char *)) +{ + /*Save the parameters*/ + strcpy(fsel_path, path); + fsel_filter = filter; + fsel_file_cnt = 0; + fsel_param = param; + fsel_ok_action = ok_action; + + /*Trim the extra '\' or '/' from the end of path*/ + uint16_t i; + for(i = strlen(fsel_path) -1 ; fsel_path[i] == '/' || fsel_path[i] == '\\'; i--) { + fsel_path[i] = '\0'; + } + + /*Check filter: NULL and "" mean no filtering*/ + if(fsel_filter == NULL) fsel_filter = ""; + + /*Create a window for the File selector*/ + lv_app_style_t * app_style = lv_app_style_get(); + fsel_win = lv_win_create(lv_scr_act(), NULL); + lv_obj_set_size(fsel_win, LV_HOR_RES, LV_VER_RES); + lv_obj_set_style(fsel_win, &app_style->win_style); + + lv_win_add_ctrl_btn(fsel_win, "U:/icon_close", fsel_close_action); + + fsel_refr(); /*Refresh the list*/ + + /*Show instruction when first open with folder filter*/ + static bool first_folder_call = false; + if(first_folder_call == false && fsel_filter[0] == '/') { + lv_app_notice_add("Press a folder long\nto choose it!"); + first_folder_call = true; + } +} + +/** + * Close the File selector + */ +void lv_app_fsel_close(void) +{ + if(fsel_win != NULL) { + lv_obj_del(fsel_win); + } + + fsel_win = NULL; + fsel_list = NULL; +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +/** + * Refresh the file list according to the current path and filter + */ +static void fsel_refr(void) +{ + /*Delete the previous list*/ + if(fsel_list != NULL) { + lv_obj_del(fsel_list); + } + + lv_win_set_title(fsel_win, fsel_path); + + /*Create a new list*/ + lv_app_style_t * app_style = lv_app_style_get(); + fsel_list = lv_list_create(fsel_win, NULL); + lv_obj_set_width(fsel_list, app_style->win_useful_w); + lv_obj_set_style(fsel_list, lv_lists_get(LV_LISTS_TRANSP, NULL)); + lv_list_set_fit(fsel_list, LV_LIST_FIT_WIDTH_SB); + lv_obj_set_drag_parent(fsel_list, true); + lv_obj_set_drag_parent(lv_page_get_scrl(fsel_list), true); + lv_rect_set_fit(fsel_list, false, true); + + fs_res_t res = FS_RES_OK; + + /*At empty path show the drivers */ + if(fsel_path[0] == '\0') { + char drv[16]; + char buf[2]; + lv_obj_t * liste; + fs_get_letters(drv); + uint8_t i; + for(i = 0; drv[i] != '\0'; i++) { + buf[0] = drv[i]; + buf[1] = '\0'; + liste = lv_list_add(fsel_list, "U:/icon_driver", buf, fsel_drv_action); + /*Add long press action to choose the driver as a folder*/ + if(fsel_filter[0] == '/') lv_btn_set_lpr_action(liste, fsel_drv_lpr_action); + } + } + /*List the files/folders with fs interface*/ + else { + lv_list_add(fsel_list, "U:/icon_up", "Up", fsel_up_action); + + fs_readdir_t rd; + res = fs_readdir_init(&rd, fsel_path); + if(res != FS_RES_OK) { + lv_app_notice_add("Can not read the path\nin File selector"); + return; + } + + /*At not first page add prev. page button */ + if(fsel_file_cnt != 0) { + lv_list_add(fsel_list, "U:/icon_left", "Previous page", fsel_prev_action); + } + + char fn[LV_APP_FSEL_FN_MAX_LEN]; + + /*Read the files from the previous pages*/ + uint16_t file_cnt = 0; + while(file_cnt <= fsel_file_cnt) { + res = fs_readdir(&rd, fn); + if(res != FS_RES_OK || fn[0] == '\0'){ + lv_app_notice_add("Can not read the path\nin File selector"); + return; + } + file_cnt ++; + } + + /*Add list elements from the files and folders*/ + while(res == FS_RES_OK && fn[0] != '\0') { + if(fn[0] == '/') { /*Add a folder*/ + lv_obj_t * liste; + liste = lv_list_add(fsel_list, "U:/icon_folder", &fn[1], fsel_folder_action); + /*Add long press action to choose a folder*/ + if(fsel_filter[0] == '/') lv_btn_set_lpr_action(liste, fsel_folder_lpr_action); + + fsel_file_cnt ++; + file_cnt ++; + } + /*Add a file if it is not filtered*/ + else if(fsel_filter[0] == '\0' || /*No filtering or ...*/ + (strcmp(fs_get_ext(fn), fsel_filter) == 0 && /*.. the filter matches*/ + fsel_filter[0] != '/')) { + lv_list_add(fsel_list, "U:/icon_file", fn, fsel_file_action); + fsel_file_cnt ++; + file_cnt ++; + } + + /*Get the next element*/ + res = fs_readdir(&rd, fn); + + /*Show only LV_APP_FSEL_MAX_FILE elements and add a Next page button*/ + if(fsel_file_cnt != 0 && fsel_file_cnt % LV_APP_FSEL_PAGE_SIZE == 0) { + lv_list_add(fsel_list, "U:/icon_right", "Next page", fsel_next_action); + break; + } + } + + /*Close the read directory*/ + fs_readdir_close(&rd); + } + + if(res != FS_RES_OK) { + lv_app_notice_add("Can not read the path\nin File selector"); + } + + /*Focus to the top of the list*/ + lv_obj_set_y(lv_page_get_scrl(fsel_list), 0); +} + +/** + * Called when the File selector window close button is released + * @param close pointer to the close button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the window is deleted in the function + */ +static lv_action_res_t fsel_close_action(lv_obj_t * close, lv_dispi_t * dispi) +{ + lv_app_fsel_close(); + return LV_ACTION_RES_INV; +} + +/** + * Called when the Up list element is released to step one level + * @param up pointer to the Up button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_up_action(lv_obj_t * up, lv_dispi_t * dispi) +{ + fs_up(fsel_path); + fsel_file_cnt = 0; + fsel_refr(); + return LV_ACTION_RES_INV; +} + +/** + * Called when the Next list element is released to go to the next page + * @param next pointer to the Next button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_next_action(lv_obj_t * next, lv_dispi_t * dispi) +{ + fsel_refr(); + return LV_ACTION_RES_INV; +} + +/** + * Called when the Prev list element is released to previous page + * @param prev pointer to the Prev button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_prev_action(lv_obj_t * prev, lv_dispi_t * dispi) +{ + if(fsel_file_cnt <= 2 * LV_APP_FSEL_PAGE_SIZE) fsel_file_cnt = 0; + else if(fsel_file_cnt % LV_APP_FSEL_PAGE_SIZE == 0) { + fsel_file_cnt -= 2 * LV_APP_FSEL_PAGE_SIZE; + } else { + fsel_file_cnt = ((fsel_file_cnt / LV_APP_FSEL_PAGE_SIZE) - 1) * LV_APP_FSEL_PAGE_SIZE; + } + + fsel_refr(); + return LV_ACTION_RES_INV; +} + + +/** + * Called when the Driver list element is released to step into a driver + * @param drv pointer to the Driver button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_drv_action(lv_obj_t * drv, lv_dispi_t * dispi) +{ + sprintf(fsel_path, "%s:", lv_list_element_get_txt(drv)); + fsel_file_cnt = 0; + fsel_refr(); + return LV_ACTION_RES_INV; +} + +/** + * Called when the Driver list element is long pressed to choose it + * @param drv pointer to the Driver button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_drv_lpr_action(lv_obj_t * drv, lv_dispi_t * dispi) +{ + sprintf(fsel_path, "%s:", lv_list_element_get_txt(drv)); + + if(fsel_ok_action != NULL) { + fsel_ok_action(fsel_param, fsel_path); + } + + lv_app_fsel_close(); + + return LV_ACTION_RES_INV; +} + +/** + * Called when a folder list element is released to enter into it + * @param folder pointer to a folder button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_folder_action(lv_obj_t * folder, lv_dispi_t * dispi) +{ + sprintf(fsel_path, "%s/%s", fsel_path, lv_list_element_get_txt(folder)); + fsel_file_cnt = 0; + fsel_refr(); + return LV_ACTION_RES_INV; +} + +/** + * Called when a folder list element is long pressed to choose it + * @param folder pointer to a folder button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_folder_lpr_action(lv_obj_t * folder, lv_dispi_t * dispi) +{ + sprintf(fsel_path, "%s/%s", fsel_path, lv_list_element_get_txt(folder)); + + if(fsel_ok_action != NULL) { + fsel_ok_action(fsel_param, fsel_path); + } + + lv_app_fsel_close(); + + return LV_ACTION_RES_INV; +} + +/** + * Called when a file list element is released to choose it + * @param file pointer to a file button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_file_action(lv_obj_t * file, lv_dispi_t * dispi) +{ + sprintf(fsel_path, "%s/%s", fsel_path, lv_list_element_get_txt(file)); + + if(fsel_ok_action != NULL) { + fsel_ok_action(fsel_param, fsel_path); + } + + lv_app_fsel_close(); + + return LV_ACTION_RES_INV; +} + +#endif /*LV_APP_ENABLE != 0*/ diff --git a/lv_app/lv_app_util/lv_app_fsel.h b/lv_app/lv_app_util/lv_app_fsel.h new file mode 100644 index 000000000..01af59d27 --- /dev/null +++ b/lv_app/lv_app_util/lv_app_fsel.h @@ -0,0 +1,36 @@ +/** + * @file lv_app_fsel.h + * + */ + +#ifndef LV_APP_FSEL_H +#define LV_APP_FSEL_H + +/********************* + * INCLUDES + *********************/ +#include "../lv_app.h" +#if LV_APP_ENABLE != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ +void lv_app_fsel_init(void); +void lv_app_fsel_open(const char * path, const char * filter, void * param, void (*ok_action)(void *, const char *)); +void lv_app_fsel_close(); + +/********************** + * MACROS + **********************/ + +#endif /*LV_APP_ENABLE != 0*/ + +#endif /*LV_APP_FSEL_H*/ diff --git a/lv_app/lv_app_util/lv_app_kb.c b/lv_app/lv_app_util/lv_app_kb.c index e3fe17ce7..913472919 100644 --- a/lv_app/lv_app_util/lv_app_kb.c +++ b/lv_app/lv_app_util/lv_app_kb.c @@ -1,5 +1,5 @@ /** - * @file lv_app_sup.c + * @file lv_app_kb.c * */ @@ -34,21 +34,21 @@ static lv_obj_t * kb_ta; static const char * kb_map_lc[] = { "\0051#", "\004q", "\004w", "\004e", "\004r", "\004t", "\004y", "\004u", "\004i", "\004o", "\004p", "\007Del", "\n", "\007ABC", "\004a", "\004s", "\004d", "\004f", "\004g", "\004h", "\004j", "\004k", "\004l", "\010Enter", "\n", -"*", "-", "z", "x", "c", "v", "b", "n", "m", ".", ",", ";", "\n", +"_", "-", "z", "x", "c", "v", "b", "n", "m", ".", ",", ":", "\n", "\002Hide", "\002Left", "\006 ", "\002Right", "\002Ok", "" }; static const char * kb_map_uc[] = { "\0051#", "\004Q", "\004W", "\004E", "\004R", "\004T", "\004Y", "\004U", "\004I", "\004O", "\004P", "\007Del", "\n", "\007abc", "\004A", "\004S", "\004D", "\004F", "\004G", "\004H", "\004J", "\004K", "\004L", "\010Enter", "\n", -"*", "/", "Z", "X", "C", "V", "B", "N", "M", ".", ",", ";", "\n", +"_", "-", "Z", "X", "C", "V", "B", "N", "M", ".", ",", ":", "\n", "\002Hide", "\002Left", "\006 ", "\002Right", "\002Ok", "" }; static const char * kb_map_spec[] = { -"0", "1", "2", "3", "4", "5", "6", "4", "8", "9", "\002Del", "\n", -"\002abc", "+", "-", "=", "%", "!", "?", "#", "<", ">", "\002Enter", "\n", -"\\", "@", "$", "_", "(", ")", "{", "}", "[", "]", ":", "\"", "'", "\n", +"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "\002Del", "\n", +"\002abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n", +"\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n", "\002Hide", "\002Left", "\006 ", "\002Right", "\002Ok", "" }; @@ -61,7 +61,6 @@ static const char * kb_map_num[] = { static cord_t kb_ta_ori_size; static uint8_t kb_mode; -static bool kb_first; static void (*kb_close_action)(lv_obj_t *); static void (*kb_ok_action)(lv_obj_t *); static lv_btnms_t kb_btnms; @@ -77,10 +76,16 @@ static lv_btnms_t kb_btnms; void lv_app_kb_init(void) { lv_btnms_get(LV_BTNMS_DEF, &kb_btnms); + kb_btnms.rects.gcolor = COLOR_WHITE; + kb_btnms.rects.objs.color = COLOR_WHITE; kb_btnms.rects.opad = 4 + LV_DOWNSCALE; kb_btnms.rects.vpad = 3 + LV_DOWNSCALE; kb_btnms.rects.hpad = 3 + LV_DOWNSCALE; kb_btnms.rects.round = 0; + kb_btnms.rects.bwidth = 0; + + // kb_btnms.btns.rects.bwidth = 0; + kb_btnms.btns.rects.round = 0; } /** @@ -102,7 +107,6 @@ void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t kb_mode = mode; kb_close_action = close; kb_ok_action = ok; - kb_first = false; /*Create a button matrix for the keyboard */ kb_btnm = lv_btnm_create(lv_scr_act(), NULL); @@ -125,11 +129,11 @@ void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t lv_obj_set_y(kb_win, 0); /*If the text area is higher then the new size of the window redus its size too*/ - lv_app_style_t * app_style = lv_app_get_style(); - cord_t win_cont_h = lv_obj_get_height(lv_win_get_content(kb_win)) - 2 * app_style->win_style.content.scrable_rects.vpad; + lv_app_style_t * app_style = lv_app_style_get(); + cord_t win_h = lv_obj_get_height(kb_win) - 2 * app_style->win_style.pages.scrl_rects.vpad; kb_ta_ori_size = lv_obj_get_height(kb_ta); - if(lv_obj_get_height(kb_ta) > win_cont_h) { - lv_obj_set_height(kb_ta, win_cont_h); + if(lv_obj_get_height(kb_ta) > win_h) { + lv_obj_set_height(kb_ta, win_h); } lv_ta_set_cursor_pos(kb_ta, LV_TA_CUR_LAST); @@ -137,7 +141,7 @@ void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t #if LV_APP_ANIM_LEVEL != 0 lv_page_focus(lv_win_get_content(kb_win), kb_ta, true); #else - lv_page_focus(lv_win_get_content(kb_win), kb_ta, false); + lv_page_focus(kb_win, kb_ta, false); #endif } @@ -195,34 +199,14 @@ static lv_action_res_t lv_app_kb_action(lv_obj_t * btnm, uint16_t i) } else if(strcmp(txt, "1#") == 0) { lv_btnm_set_map(btnm, kb_map_spec); } else if(strcmp(txt, "Enter") == 0) { - if((kb_mode & LV_APP_KB_MODE_CLR) != 0 && kb_first == false) { - lv_ta_set_text(kb_ta, ""); - kb_first = true; - } lv_ta_add_char(kb_ta, '\n'); } else if(strcmp(txt, "Left") == 0) { - if((kb_mode & LV_APP_KB_MODE_CLR) != 0 && kb_first == false) { - lv_ta_set_text(kb_ta, ""); - kb_first = true; - } lv_ta_cursor_left(kb_ta); } else if(strcmp(txt, "Right") == 0) { - if((kb_mode & LV_APP_KB_MODE_CLR) != 0 && kb_first == false) { - lv_ta_set_text(kb_ta, ""); - kb_first = true; - } lv_ta_cursor_right(kb_ta); } else if(strcmp(txt, "Del") == 0) { - if((kb_mode & LV_APP_KB_MODE_CLR) != 0 && kb_first == false) { - lv_ta_set_text(kb_ta, ""); - kb_first = true; - } lv_ta_del(kb_ta); } else if(strcmp(txt, "+/-") == 0) { - if((kb_mode & LV_APP_KB_MODE_CLR) != 0 && kb_first == false) { - lv_ta_set_text(kb_ta, ""); - kb_first = true; - } uint16_t cur = lv_ta_get_cursor_pos(kb_ta); const char * ta_txt = lv_ta_get_txt(kb_ta); if(ta_txt[0] == '-') { @@ -247,17 +231,13 @@ static lv_action_res_t lv_app_kb_action(lv_obj_t * btnm, uint16_t i) lv_app_kb_close(true); return LV_ACTION_RES_INV; } else { - if((kb_mode & LV_APP_KB_MODE_CLR) != 0 && kb_first == false) { - lv_ta_set_text(kb_ta, ""); - kb_first = true; - } lv_ta_add_text(kb_ta, txt); } #if LV_APP_ANIM_LEVEL != 0 lv_page_focus(lv_win_get_content(kb_win), kb_ta, true); #else - lv_page_focus(lv_win_get_content(kb_win), kb_ta, false); + lv_page_focus(kb_win, kb_ta, false); #endif return LV_ACTION_RES_OK; } diff --git a/lv_app/lv_app_util/lv_app_kb.h b/lv_app/lv_app_util/lv_app_kb.h index 3c5b4b646..cd92ed3f7 100644 --- a/lv_app/lv_app_util/lv_app_kb.h +++ b/lv_app/lv_app_util/lv_app_kb.h @@ -1,10 +1,10 @@ /** - * @file lv_app_sup.h + * @file lv_app_kb.h * */ -#ifndef LV_APP_SUP_H -#define LV_APP_SUP_H +#ifndef LV_APP_KB_H +#define LV_APP_KB_H /********************* * INCLUDES @@ -23,7 +23,6 @@ typedef enum { LV_APP_KB_MODE_TXT = 0x01, LV_APP_KB_MODE_NUM = 0x02, - LV_APP_KB_MODE_CLR = 0x04, /*Clear when the first character is pressed*/ }lv_app_kb_mode_t; /********************** @@ -38,4 +37,4 @@ void lv_app_kb_close(bool ok); **********************/ #endif /*LV_APP_ENABLE != 0*/ -#endif /*LV_APP_SUP_H*/ +#endif /*LV_APP_KB_H*/ diff --git a/lv_app/lv_app_util/lv_app_notice.c b/lv_app/lv_app_util/lv_app_notice.c index d9d04ca21..01d818163 100644 --- a/lv_app/lv_app_util/lv_app_notice.c +++ b/lv_app/lv_app_util/lv_app_notice.c @@ -13,6 +13,7 @@ #include "lvgl/lv_objx/lv_label.h" #include "lvgl/lv_misc/anim.h" +#include /********************* * DEFINES @@ -25,13 +26,14 @@ /********************** * STATIC PROTOTYPES **********************/ +static lv_action_res_t notice_rel_action(lv_obj_t * n, lv_dispi_t * dispi); /********************** * STATIC VARIABLES **********************/ static lv_obj_t * notice_h; -static lv_rects_t notice_rects; +static lv_btns_t notice_btns; static lv_labels_t notice_labels; /********************** @@ -41,16 +43,24 @@ static lv_labels_t notice_labels; /********************** * GLOBAL FUNCTIONS **********************/ +/** + * Initialize the Notifications + */ void lv_app_notice_init(void) { - lv_app_style_t * app_style = lv_app_get_style(); + lv_app_style_t * app_style = lv_app_style_get(); - memcpy(¬ice_rects, &app_style->menu_style, sizeof(lv_rects_t)); - notice_rects.round = 5 * LV_DOWNSCALE; - notice_rects.bcolor = COLOR_WHITE; - notice_rects.bwidth = 1 * LV_DOWNSCALE; - notice_rects.bopa = 90; - notice_rects.light = 5 * LV_DOWNSCALE; + memcpy(¬ice_btns, &app_style->menu_style, sizeof(lv_rects_t)); + notice_btns.rects.round = 5 * LV_DOWNSCALE; + notice_btns.bcolor[LV_BTN_STATE_REL] = COLOR_WHITE; + notice_btns.mcolor[LV_BTN_STATE_REL] = COLOR_BLACK; + notice_btns.gcolor[LV_BTN_STATE_REL] = COLOR_BLACK; + notice_btns.bcolor[LV_BTN_STATE_PR] = COLOR_WHITE; + notice_btns.mcolor[LV_BTN_STATE_PR] = COLOR_GRAY; + notice_btns.gcolor[LV_BTN_STATE_PR] = COLOR_GRAY; + notice_btns.rects.bwidth = 1 * LV_DOWNSCALE; + notice_btns.rects.bopa = 90; + notice_btns.rects.light = 5 * LV_DOWNSCALE; memcpy(¬ice_labels, &app_style->menu_btn_label_style, sizeof(lv_labels_t)); notice_labels.mid = 0; @@ -64,15 +74,27 @@ void lv_app_notice_init(void) lv_rect_set_layout(notice_h, LV_RECT_LAYOUT_COL_R); } -void lv_app_notice_add(const char * txt) +/** + * Add a notification with a given text + * @param format pritntf-like format string + */ +void lv_app_notice_add(const char * format, ...) { - lv_app_style_t * app_style = lv_app_get_style(); + char txt[LV_APP_NOTICE_MAX_LEN]; + + va_list va; + va_start(va, format); + vsprintf(txt,format, va); + va_end(va); + + lv_app_style_t * app_style = lv_app_style_get(); lv_obj_t * n; - n = lv_rect_create(notice_h, NULL); + n = lv_btn_create(notice_h, NULL); lv_rect_set_fit(n, true, true); - lv_obj_set_style(n, ¬ice_rects); + lv_obj_set_style(n, ¬ice_btns); lv_obj_set_opa(n, app_style->menu_opa); + lv_btn_set_rel_action(n, notice_rel_action); lv_obj_t * l; l = lv_label_create(n, NULL); @@ -109,7 +131,7 @@ void lv_app_notice_add(const char * txt) a.fp = (anim_fp_t) lv_obj_set_height; a.start = lv_obj_get_height(n); a.end = 0; - a.end_cb = lv_obj_del; + a.end_cb = (anim_cb_t)lv_obj_del; anim_create(&a); #else anim_t a; @@ -132,4 +154,12 @@ void lv_app_notice_add(const char * txt) /********************** * STATIC FUNCTIONS **********************/ + +static lv_action_res_t notice_rel_action(lv_obj_t * n, lv_dispi_t * dispi) +{ + lv_obj_del(n); + + return LV_ACTION_RES_INV; +} + #endif diff --git a/lv_app/lv_app_util/lv_app_notice.h b/lv_app/lv_app_util/lv_app_notice.h index 8301c915b..4b122a192 100644 --- a/lv_app/lv_app_util/lv_app_notice.h +++ b/lv_app/lv_app_util/lv_app_notice.h @@ -10,6 +10,7 @@ * INCLUDES *********************/ #include "../lv_app.h" +#include #if LV_APP_ENABLE != 0 /********************* @@ -24,7 +25,7 @@ * GLOBAL PROTOTYPES **********************/ void lv_app_notice_init(void); -void lv_app_notice_add(const char * txt); +void lv_app_notice_add(const char * format, ...); /********************** * MACROS diff --git a/lv_app/lv_icon/x2/img_add.c b/lv_app/lv_icon/x2/img_add.c deleted file mode 100644 index d00d57751..000000000 --- a/lv_app/lv_icon/x2/img_add.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_ADD != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_add [] = { /*Width = 37, Height = 37*/ -37, /*Width*/ -37, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 33808, 33808, 33808, 33808, 31695, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27501, 14791, 14791, 14823, 14823, 14791, 12678, 25356, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19017, 2113, 2145, 2145, 2145, 2113, 0, 14823, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 0, 0, 0, 0, 10565, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 10565, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 2016, 2016, 27469, 8452, 0, 0, 0, 0, 0, 0, 6339, 25356, 2016, 2016, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 31695, 2016, 2016, 2016, 2016, -2016, 2016, 27501, 14791, 14791, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 16904, 12678, 2145, 0, 0, 0, 0, 0, 0, 2145, 10597, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14791, 12678, 25356, 2016, 2016, 2016, -2016, 2016, 19017, 2113, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 4226, 2145, 32, 0, 0, 0, 0, 0, 0, 0, 2113, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2113, 0, 14823, 2016, 2016, 2016, -2016, 2016, 14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 2016, 2016, 2016, -2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, -2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, -2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8484, 2016, 2016, 2016, -2016, 2016, 21162, 6339, 6371, 6371, 6371, 6371, 6371, 6371, 6371, 8452, 8452, 6339, 2113, 0, 0, 0, 0, 0, 0, 32, 4258, 8452, 6371, 6371, 6371, 6371, 6371, 6371, 6371, 6339, 4226, 19017, 2016, 2016, 2016, -2016, 2016, 2016, 31695, 31695, 31695, 31695, 31695, 31695, 31695, 31695, 31727, 2016, 25388, 6371, 0, 0, 0, 0, 0, 0, 6339, 23275, 31727, 31727, 31727, 31727, 31695, 31695, 31695, 31695, 31695, 29582, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 0, 0, 0, 0, 0, 8484, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 8484, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21162, 6339, 6371, 6371, 6371, 6339, 4226, 19017, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 31695, 31695, 31695, 31695, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_battery_empty.c b/lv_app/lv_icon/x2/img_battery_empty.c deleted file mode 100644 index 849d07539..000000000 --- a/lv_app/lv_icon/x2/img_battery_empty.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_BATTERY_EMPTY != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_battery_empty [] = { /*Width = 32, Height = 18*/ -32, /*Width*/ -18, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 31727, 31695, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 31695, 2016, 2016, 2016, -27469, 14823, 21130, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 21130, 12710, 25356, 2016, 2016, -16904, 8452, 27469, 35953, 38066, 38066, 35953, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35953, 38034, 27501, 6371, 14823, 2016, 2016, -10597, 6339, 35921, 48599, 42260, 42260, 46486, 48631, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48631, 52825, 38034, 6339, 8452, 2016, 2016, -10597, 10565, 46518, 57051, 35921, 35921, 52857, 63390, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 63390, 65535, 48631, 12678, 2145, 21162, 2016, -10597, 10597, 52857, 59164, 27469, 25388, 54970, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 14823, 0, 6371, 25356, -10597, 12678, 52857, 54938, 14823, 14791, 50712, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 14823, 0, 0, 14823, -10597, 12678, 52857, 52857, 10565, 8484, 48599, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 14823, 0, 0, 10565, -10597, 12678, 52857, 52857, 10597, 10565, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 14823, 0, 0, 10597, -10597, 12678, 52857, 52857, 12678, 10565, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 14823, 0, 0, 12678, -10597, 12678, 52857, 52857, 12678, 10565, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 14823, 0, 0, 12678, -10597, 12678, 52857, 52857, 10597, 10565, 48599, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 14823, 0, 0, 10597, -10597, 12678, 52857, 52825, 8484, 8452, 48599, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 8484, -10597, 12678, 52857, 57051, 19049, 19017, 52825, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 14823, 0, 32, 19017, -10597, 10597, 52857, 63422, 42260, 40179, 61277, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54970, 14791, 2145, 21130, 2016, -10597, 8452, 42292, 54938, 44405, 44373, 52857, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 59164, 61277, 44405, 8484, 6339, 2016, 2016, -10597, 32, 21162, 29614, 27501, 27501, 29614, 31695, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 31695, 33808, 23243, 32, 8452, 2016, 2016, -21130, 8484, 19017, 23275, 25356, 25356, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 25356, 19017, 6371, 19017, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_battery_full.c b/lv_app/lv_icon/x2/img_battery_full.c deleted file mode 100644 index d404b3e1c..000000000 --- a/lv_app/lv_icon/x2/img_battery_full.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_BATTERY_FULL != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_battery_full [] = { /*Width = 32, Height = 18*/ -32, /*Width*/ -18, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 31727, 31695, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 31695, 2016, 2016, 2016, -27469, 14823, 21130, 23275, 23275, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 23275, 21130, 12710, 25356, 2016, 2016, -16904, 8452, 27469, 35953, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 27501, 6371, 14791, 2016, 2016, -10597, 6339, 35921, 48599, 42292, 40179, 40147, 40147, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40147, 40147, 42292, 50712, 38034, 6339, 8452, 2016, 2016, -10597, 10565, 46518, 57051, 38034, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 27501, 27469, 35953, 59164, 50712, 12678, 2145, 21162, 2016, -10597, 10597, 52857, 59196, 29614, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 14823, 12710, 27501, 59196, 54970, 14823, 0, 6371, 25356, -10597, 12678, 52857, 57051, 19049, 2145, 2145, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 2113, 0, 16936, 54970, 54970, 16904, 0, 0, 14823, -10597, 12678, 52857, 54938, 14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 52857, 54970, 16904, 0, 0, 10565, -10597, 12678, 52857, 54938, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 54938, 54970, 16904, 0, 0, 10597, -10597, 12678, 52857, 54938, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 54938, 54970, 16904, 0, 0, 12678, -10597, 12678, 52857, 54938, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 54938, 54970, 16904, 0, 0, 12678, -10597, 12678, 52857, 54938, 14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 52857, 54970, 16904, 0, 0, 10597, -10597, 12678, 52857, 54938, 14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 52857, 54970, 16904, 0, 0, 8484, -10597, 12678, 52857, 57083, 23275, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 4258, 21130, 57083, 54970, 16904, 0, 32, 19017, -10597, 10597, 52857, 63422, 44373, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 31727, 42292, 65503, 57051, 14791, 2145, 21130, 2016, -10597, 8452, 42292, 54970, 46486, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40147, 44405, 57051, 44405, 8484, 6339, 2016, 2016, -10597, 32, 21162, 29614, 27501, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 25388, 27501, 31727, 23243, 32, 8452, 2016, 2016, -21130, 8484, 19017, 23275, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 19017, 6371, 19017, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_battery_half.c b/lv_app/lv_icon/x2/img_battery_half.c deleted file mode 100644 index 585ba7596..000000000 --- a/lv_app/lv_icon/x2/img_battery_half.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_BATTERY_HALF != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_battery_half [] = { /*Width = 32, Height = 18*/ -32, /*Width*/ -18, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 31695, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 2016, 2016, 2016, -25388, 14791, 19049, 23243, 23243, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 19049, 12678, 23275, 2016, 2016, -16904, 8452, 27469, 38034, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 38066, 38034, 35953, 35953, 35953, 35953, 38034, 38066, 29582, 6371, 14791, 2016, 2016, -10597, 6339, 35953, 48631, 44373, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 44373, 48599, 50712, 50712, 50712, 50712, 50744, 52857, 38066, 6371, 8452, 2016, 2016, -10597, 10565, 48599, 57083, 38034, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 38034, 54970, 63422, 63390, 63390, 63390, 63422, 65535, 48631, 12678, 2145, 21130, 2016, -10597, 12678, 52857, 59196, 29582, 14791, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14791, 16904, 23275, 38034, 59196, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 14823, 0, 6339, 23275, -10597, 12678, 52857, 57051, 19049, 2113, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 4226, 2113, 0, 8452, 27501, 46486, 61309, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 16904, 0, 0, 14791, -10597, 12678, 52857, 54938, 14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 38034, 54970, 63422, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 10565, -10597, 12678, 52857, 54938, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 21130, 50744, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 10597, -10597, 12678, 52857, 54938, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 16904, 35921, 59196, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, -10597, 12678, 52857, 54938, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8452, 35921, 54938, 63422, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, -10597, 12678, 52857, 54938, 14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 16936, 48631, 65503, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 10597, -10597, 12678, 52857, 54938, 14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 31727, 57051, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 8484, -10597, 12678, 52857, 57083, 23275, 8452, 8452, 8484, 8484, 8484, 8484, 8452, 6371, 14791, 31695, 46518, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 14823, 0, 32, 19017, -10597, 12678, 52857, 65503, 46486, 35953, 35953, 35953, 35953, 35953, 35953, 35921, 33840, 40179, 52857, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54970, 14791, 4226, 21162, 2016, -10597, 8452, 42260, 54970, 46486, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 40179, 44405, 52857, 57083, 57051, 57051, 57051, 57051, 57051, 57051, 57051, 57051, 57051, 57083, 61277, 44405, 8484, 6371, 2016, 2016, -10597, 32, 21130, 29582, 27469, 25388, 25388, 25388, 25388, 25388, 25388, 25388, 25356, 25388, 27501, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29614, 31695, 21162, 0, 8452, 2016, 2016, -21162, 8484, 16936, 23243, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23275, 19017, 8452, 19017, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_bubble.c b/lv_app/lv_icon/x2/img_bubble.c deleted file mode 100644 index fdb713020..000000000 --- a/lv_app/lv_icon/x2/img_bubble.c +++ /dev/null @@ -1,46 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_BUBBLE != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_bubble [] = { /*Width = 32, Height = 30*/ -32, /*Width*/ -30, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 2016, 2016, 2016, 2016, -2016, 2016, 29582, 19017, 14823, 12710, 12710, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 12710, 12710, 14791, 16936, 27469, 2016, 2016, -2016, 21162, 8484, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 6371, 14823, 31727, -25356, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19017, -19017, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, -14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, -14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, -23243, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16936, -2016, 14823, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 29582, -2016, 33808, 14823, 6371, 8452, 6339, 2113, 0, 0, 0, 0, 0, 0, 2113, 6339, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 6371, 14791, 27501, 2016, -2016, 2016, 2016, 2016, 2016, 25388, 8452, 0, 0, 0, 0, 0, 32, 10565, 27469, 2016, 2016, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 0, 0, 0, 4226, 14791, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 0, 32, 14791, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 4226, 14791, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 14791, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 14823, 2145, 14791, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 19017, 14791, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 31727, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_calendar.c b/lv_app/lv_icon/x2/img_calendar.c deleted file mode 100644 index 4822d5fd2..000000000 --- a/lv_app/lv_icon/x2/img_calendar.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_CALENDAR != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_calendar [] = { /*Width = 32, Height = 31*/ -32, /*Width*/ -31, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 23275, 23243, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23275, 23243, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 14791, 14791, 2016, 2016, 2016, 31695, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31695, 29614, 2016, 2016, 2016, 14791, 14791, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 25388, 29614, 2016, 2016, 10565, 10565, 2016, 2016, 27501, 12710, 12710, 12710, 14791, 14791, 14791, 14791, 14791, 12678, 10565, 25388, 2016, 2016, 10565, 8484, 2016, 2016, 31695, 25388, 2016, 2016, -2016, 21130, 4258, 16904, 2016, 2016, 8484, 8484, 2016, 2016, 19049, 2113, 2113, 2145, 2145, 2145, 2145, 2145, 2145, 2113, 0, 16904, 2016, 2016, 8484, 8484, 2016, 2016, 19049, 6339, 14823, 33808, -25356, 4258, 0, 10565, 2016, 2016, 19049, 21130, 2016, 2016, 14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 19049, 21130, 2016, 2016, 12710, 0, 0, 19049, -19017, 0, 0, 10565, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 0, 12710, -14823, 0, 0, 6339, 29582, 2016, 2016, 2016, 2016, 33808, 6371, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6339, 29582, 2016, 2016, 2016, 2016, 33808, 6371, 0, 0, 10597, -16904, 0, 0, 0, 4258, 12710, 21162, 23243, 14823, 6371, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4258, 12710, 21162, 23243, 14823, 6371, 0, 0, 0, 12678, -14823, 0, 4258, 6371, 6339, 10565, 21130, 21130, 10597, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 6339, 10565, 21130, 21130, 10597, 6371, 8452, 4258, 0, 12678, -12710, 4226, 23275, 33808, 33808, 33840, 35953, 35953, 33840, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 31727, 33808, 35953, 35953, 33840, 33808, 35921, 25356, 2145, 10597, -12678, 8452, 38034, 52825, 52825, 50744, 50712, 50744, 52825, 52825, 52825, 52857, 52825, 52825, 52825, 50744, 52825, 52825, 52825, 52825, 52825, 52825, 52825, 50744, 50712, 50712, 50744, 52825, 54970, 40179, 8452, 10597, -12678, 10565, 46486, 63422, 63422, 63390, 63390, 63422, 65503, 65535, 65535, 65535, 65535, 65503, 63422, 63390, 63390, 63422, 65503, 65535, 65535, 65535, 65503, 63422, 63390, 61309, 63390, 63422, 65535, 48631, 10597, 10565, -10597, 10597, 50712, 65535, 65535, 65535, 65535, 63422, 59196, 57083, 57051, 57083, 59164, 61309, 65535, 65535, 65535, 65503, 61277, 57083, 57083, 59164, 61277, 63422, 65535, 65535, 65535, 65535, 65535, 52857, 12678, 10565, -10597, 10565, 48631, 65535, 65535, 65535, 63390, 52825, 35921, 25388, 23275, 25388, 31695, 42292, 61309, 65535, 65503, 52857, 35953, 27501, 27501, 31727, 40147, 50712, 63390, 65535, 65535, 65535, 65535, 52825, 10597, 10565, -10597, 10565, 48631, 65535, 65535, 65535, 61309, 50744, 33840, 25356, 25356, 23243, 19017, 29614, 57051, 63422, 54938, 42292, 31695, 27469, 29582, 29582, 25356, 35921, 59164, 65535, 65535, 65535, 65535, 52825, 10597, 10565, -10597, 10565, 48631, 65535, 65535, 65535, 63422, 61277, 57051, 54970, 57083, 46518, 21162, 23243, 48631, 52857, 35921, 31727, 42292, 52825, 61277, 48631, 16936, 19049, 54938, 65535, 65535, 65535, 65535, 52825, 10597, 10565, -10597, 10565, 48631, 65535, 65535, 65535, 65503, 65535, 65535, 65535, 65535, 57083, 21162, 16936, 46486, 50744, 33840, 31695, 42292, 52857, 63422, 50744, 16904, 16936, 52857, 65535, 65535, 65535, 65535, 52825, 10597, 10565, -10597, 10565, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 57051, 19017, 14823, 46518, 59164, 50712, 40179, 29614, 29614, 40147, 38034, 23243, 29582, 57051, 65535, 65535, 65535, 65535, 52825, 10597, 10565, -10597, 10565, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 63390, 46518, 16936, 19017, 50712, 63390, 57051, 44373, 25356, 19049, 27469, 27501, 21162, 31695, 57083, 65535, 65535, 65535, 65535, 52825, 10597, 10565, -10597, 10565, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 63390, 44373, 29582, 19017, 27501, 57051, 65503, 52857, 40179, 25388, 21162, 27469, 25356, 14823, 25356, 54938, 65535, 65535, 65535, 65535, 52825, 10597, 10565, -10597, 10565, 48631, 65535, 65535, 65535, 65535, 65535, 63422, 50744, 29582, 21162, 29614, 44373, 63390, 63390, 42292, 33808, 33840, 35953, 40147, 31727, 14823, 21162, 50744, 65535, 65535, 65535, 65535, 52825, 10597, 10565, -10597, 10565, 48631, 65535, 65535, 65535, 65535, 63422, 46486, 31695, 19017, 25356, 50712, 65535, 65535, 54970, 23275, 21162, 48631, 63422, 65503, 50744, 23275, 23243, 46486, 61277, 65503, 65535, 65535, 52825, 10597, 10565, -10597, 10565, 48631, 65535, 65535, 65535, 61309, 48599, 27469, 14791, 12678, 23275, 48631, 63422, 65535, 54938, 21130, 19017, 48599, 63422, 65535, 52857, 25356, 23243, 46518, 61277, 65503, 65535, 65535, 52825, 10597, 10565, -10597, 10565, 48631, 65535, 65535, 59196, 38066, 21130, 4258, 2113, 10565, 16936, 25356, 38066, 61277, 59164, 33808, 23275, 29614, 35953, 42260, 35953, 19017, 23275, 52825, 65535, 65535, 65535, 65535, 52825, 10597, 10565, -10597, 10565, 48631, 65535, 65535, 59164, 33808, 16904, 6371, 8452, 16936, 21162, 19049, 31695, 57083, 63390, 48599, 38034, 31727, 31727, 35953, 35921, 27501, 35921, 59164, 65535, 65535, 65535, 65535, 52825, 10597, 10565, -10597, 10565, 48631, 65535, 65535, 61277, 44373, 33840, 31727, 33808, 35921, 35953, 35921, 42292, 59196, 65535, 63390, 57083, 52825, 48631, 48631, 50744, 54938, 59164, 65503, 65535, 65535, 65535, 65535, 52825, 10597, 10565, -10597, 10565, 48631, 65535, 65535, 65503, 54970, 50744, 52825, 52825, 52825, 50744, 50712, 54938, 63390, 65535, 65535, 65535, 65503, 61309, 59196, 61309, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 10597, 10565, -10597, 10597, 50744, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65503, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 10597, 10565, -19017, 14823, 42292, 57051, 57051, 57083, 57083, 59164, 59164, 59164, 59164, 59164, 59164, 57083, 57083, 57051, 57051, 57051, 57083, 57083, 57083, 57083, 57051, 57051, 57051, 57051, 57051, 57083, 59196, 44405, 12710, 14823, -33808, 21162, 25356, 27469, 29582, 29582, 29582, 29614, 29614, 29614, 29614, 29614, 29614, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 25388, 16936, 27501, -2016, 2016, 27469, 21162, 21162, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 25388, 31695, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_clock.c b/lv_app/lv_icon/x2/img_clock.c deleted file mode 100644 index 1b2370d3c..000000000 --- a/lv_app/lv_icon/x2/img_clock.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_CLOCK != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_clock [] = { /*Width = 32, Height = 31*/ -32, /*Width*/ -31, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27469, 21162, 19017, 16936, 16904, 19017, 21130, 25388, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 19049, 12678, 6371, 4258, 2145, 2113, 32, 32, 2113, 2145, 4226, 6371, 10597, 16936, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 12678, 32, 0, 0, 0, 2145, 4226, 4258, 4258, 4226, 2145, 32, 0, 0, 0, 10565, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 19017, 4258, 0, 0, 0, 2113, 12678, 21130, 25356, 27501, 27501, 25388, 21162, 14791, 4226, 0, 0, 0, 4226, 16904, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 21162, 2113, 0, 32, 6371, 12710, 21162, 31727, 40147, 44405, 48599, 46518, 44405, 40179, 33808, 23275, 14823, 8452, 2113, 0, 0, 16904, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16936, 2113, 0, 0, 12710, 29582, 46486, 54970, 57083, 61277, 63422, 63422, 63390, 61277, 59196, 59164, 57051, 48599, 31727, 16904, 32, 0, 0, 14823, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 27501, 4226, 0, 0, 12678, 31695, 48599, 63390, 65535, 65535, 65535, 61309, 61277, 65535, 65535, 65535, 65535, 65535, 65503, 50744, 33840, 14823, 2113, 0, 2113, 23243, 2016, 2016, 2016, -2016, 2016, 27469, 8452, 0, 32, 14823, 31727, 52825, 63422, 65535, 65535, 65535, 59196, 40147, 38066, 59164, 65535, 65535, 65535, 65535, 65535, 63422, 54938, 38066, 21130, 2113, 0, 4226, 23243, 2016, 2016, -2016, 2016, 14791, 0, 0, 8484, 31695, 50712, 65503, 65535, 65535, 65535, 65535, 54970, 23275, 23243, 52825, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54970, 38034, 10597, 0, 0, 10597, 2016, 2016, -2016, 2016, 8452, 0, 32, 19017, 48631, 65503, 65535, 65535, 65535, 65535, 65535, 52857, 14791, 12710, 50712, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52825, 23243, 4258, 0, 6339, 29614, 2016, -2016, 23275, 4226, 0, 10565, 29614, 59164, 65535, 65535, 65535, 65535, 65535, 65535, 50744, 10565, 8484, 48599, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 61277, 35921, 16904, 2113, 2113, 19017, 2016, -2016, 14791, 32, 4226, 23275, 44373, 61309, 65535, 65535, 65535, 65535, 65535, 65535, 52825, 10597, 10565, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 63390, 48631, 29614, 6339, 0, 8484, 27501, -27469, 8452, 0, 6371, 33840, 52857, 63422, 65535, 65535, 65535, 65535, 65535, 65535, 52825, 10597, 10597, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65503, 59196, 40179, 8484, 0, 2113, 21162, -23243, 2145, 0, 8484, 42260, 61277, 65503, 65535, 65535, 65535, 65535, 65535, 65535, 52825, 10597, 10597, 50744, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 48599, 10597, 0, 0, 16904, -19049, 0, 0, 10565, 46486, 65503, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52825, 10597, 8452, 42260, 57083, 57083, 57051, 57051, 59164, 63422, 65535, 65535, 65535, 65535, 52825, 12710, 0, 0, 12710, -16936, 0, 0, 10597, 48599, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52825, 10597, 32, 19049, 29582, 29582, 27501, 27469, 35953, 57083, 65535, 65535, 65535, 65535, 52857, 14791, 0, 0, 12678, -16936, 0, 0, 10597, 46518, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 21162, 8484, 19017, 23243, 23243, 21162, 19049, 31695, 54970, 65535, 65535, 65535, 65535, 52825, 14791, 0, 0, 12678, -21130, 32, 0, 10565, 44373, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 59196, 42260, 33808, 35921, 35953, 35953, 35953, 33840, 42292, 59164, 65535, 65535, 65535, 65535, 50712, 12678, 0, 0, 14823, -25356, 4258, 0, 8452, 38066, 57083, 63422, 65535, 65535, 65535, 65535, 65535, 65535, 63422, 54970, 50744, 50712, 50712, 50712, 50712, 48631, 52857, 61309, 65535, 65535, 65535, 63390, 44405, 10565, 0, 0, 19049, -31695, 10597, 0, 6339, 29614, 48631, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 63422, 63390, 63390, 63390, 63390, 61309, 61309, 63390, 65503, 65535, 65535, 63422, 54938, 35921, 6371, 0, 6339, 25356, -2016, 19049, 2113, 2113, 19017, 38034, 59196, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 61277, 42292, 23275, 4226, 32, 14791, 33808, -2016, 29614, 4258, 0, 4226, 23243, 54970, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 57083, 27501, 8452, 0, 4226, 25356, 2016, -2016, 2016, 10597, 0, 0, 12678, 42260, 59196, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 63390, 46486, 14823, 0, 0, 8484, 2016, 2016, -2016, 2016, 21130, 2145, 0, 4226, 19049, 38066, 61277, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 63390, 44373, 25356, 6339, 0, 0, 16904, 2016, 2016, -2016, 2016, 2016, 16904, 2113, 0, 4258, 21130, 44405, 59164, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 63422, 59196, 46518, 25356, 8484, 0, 0, 10597, 29614, 2016, 2016, -2016, 2016, 2016, 2016, 8484, 0, 0, 4258, 16904, 31695, 50712, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65503, 52857, 33840, 19017, 6371, 0, 0, 6339, 33808, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 25388, 8452, 32, 0, 32, 10597, 29614, 44373, 52825, 57051, 57083, 57083, 57083, 57083, 57051, 52857, 46518, 33840, 14791, 2145, 0, 0, 6339, 23243, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 10597, 0, 0, 0, 6339, 10597, 16936, 23275, 29582, 31695, 31695, 29582, 25356, 19017, 12678, 6339, 32, 0, 0, 8452, 29614, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 29614, 14823, 8452, 2113, 0, 0, 0, 4226, 8484, 12678, 12678, 10565, 4258, 0, 0, 0, 32, 6371, 12678, 27469, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 19017, 4258, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 14823, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25356, 16904, 10597, 8452, 6371, 6371, 6371, 6371, 8452, 10597, 14823, 23243, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_eject.c b/lv_app/lv_icon/x2/img_eject.c deleted file mode 100644 index 60459a01d..000000000 --- a/lv_app/lv_icon/x2/img_eject.c +++ /dev/null @@ -1,43 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_EJECT != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_eject [] = { /*Width = 28, Height = 27*/ -28, /*Width*/ -27, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21130, 14791, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 8484, 32, 6339, 23243, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 14823, 2113, 0, 0, 8452, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 32, 0, 0, 0, 2113, 10565, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25356, 4226, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21162, 4258, 0, 0, 0, 0, 0, 0, 0, 4226, 16904, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 8452, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 19017, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 29614, 12678, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6371, 23243, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 8452, 25356, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 21130, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 31727, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 23243, 6339, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 14823, 33808, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 31727, 10565, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 14791, 2016, 2016, 2016, 2016, -2016, 2016, 31727, 14823, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 21162, 2016, 2016, 2016, -2016, 2016, 12678, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14823, 2016, 2016, -2016, 2016, 12710, 4226, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6339, 4226, 14791, 2016, 2016, -2016, 2016, 2016, 31727, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 31695, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 33808, 31727, 29614, 2016, -27469, 12678, 12710, 12710, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 12678, 10565, 23275, -19017, 2113, 2113, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2113, 0, 14791, -14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, -12710, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8484, -23243, 6371, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 4226, 19017, -2016, 31727, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 31727, 31695, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_image.c b/lv_app/lv_icon/x2/img_image.c deleted file mode 100644 index d83125e52..000000000 --- a/lv_app/lv_icon/x2/img_image.c +++ /dev/null @@ -1,43 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_IMAGE != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_image [] = { /*Width = 32, Height = 27*/ -32, /*Width*/ -27, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29582, 19017, 14823, 12710, 12710, 14791, 14791, 14791, 14791, 14791, 14791, 12710, 12710, 14791, 16936, 27469, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 21162, 8484, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 6371, 16904, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 23243, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 16936, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 25388, 10565, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6371, 25356, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 29582, 19017, 16904, 10565, 2145, 0, 0, 0, 0, 0, 32, 2145, 4258, 6339, 6339, 6339, 4226, 2113, 0, 0, 0, 0, 0, 32, 10565, 14823, 16936, 27469, 2016, 2016, -2016, 21162, 8484, 2145, 2145, 2113, 0, 0, 0, 0, 0, 0, 6339, 12710, 23243, 27501, 27501, 25356, 16936, 8484, 0, 0, 0, 0, 0, 0, 2113, 2145, 2145, 6371, 16904, 33808, -25356, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 10597, 23243, 31727, 42260, 46518, 46518, 44373, 35953, 25388, 14791, 6339, 32, 0, 0, 0, 0, 0, 0, 0, 32, 19049, -19017, 32, 0, 0, 0, 0, 0, 0, 0, 4226, 23243, 38066, 52825, 59196, 63390, 63422, 63422, 63390, 61277, 54938, 44405, 29582, 6371, 0, 0, 0, 0, 0, 0, 0, 0, 14791, -14823, 0, 0, 0, 0, 0, 0, 0, 32, 14791, 40147, 57083, 65535, 65535, 65503, 63390, 61309, 63422, 65535, 65535, 63390, 46518, 19049, 4258, 32, 0, 0, 0, 0, 0, 0, 10597, -14823, 0, 0, 0, 0, 0, 0, 2145, 12710, 31695, 54938, 65535, 65535, 63422, 50712, 42292, 42260, 48599, 61309, 65535, 65535, 57083, 40147, 21162, 4258, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 6339, 25388, 44405, 63390, 65535, 61277, 48631, 31727, 23275, 23243, 29582, 44373, 57051, 65535, 65535, 54938, 35921, 8452, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 8484, 38034, 57051, 65535, 61309, 42292, 25388, 10597, 4226, 4226, 8452, 16936, 33840, 59164, 65535, 65535, 46518, 12678, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 10597, 44405, 65503, 65535, 57083, 29614, 10565, 0, 0, 0, 0, 32, 19049, 54938, 65535, 65535, 52857, 14791, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 10597, 48599, 65535, 65535, 54970, 23243, 4226, 0, 0, 0, 0, 0, 12710, 52825, 65535, 65535, 54938, 16936, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 10597, 46518, 65535, 65535, 57051, 25388, 6371, 0, 0, 0, 0, 0, 16904, 52857, 65535, 65535, 52857, 16936, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 10565, 44373, 63390, 65535, 59196, 38034, 16936, 32, 0, 0, 0, 8452, 27501, 57051, 65535, 65535, 50744, 14791, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 8452, 33840, 52857, 65535, 65503, 50744, 33840, 16904, 6371, 6371, 12710, 27469, 42292, 61309, 65535, 63390, 44373, 10597, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 4258, 21130, 40147, 61309, 65535, 65503, 57051, 44405, 38066, 38034, 42260, 52857, 61309, 65535, 65503, 48631, 29614, 6371, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 2113, 8484, 25388, 50712, 65503, 65535, 65535, 63390, 59164, 57083, 61277, 65535, 65535, 65535, 54938, 33808, 16904, 4226, 0, 0, 0, 0, 0, 0, 12678, -14823, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 29614, 48631, 65503, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54970, 38034, 14791, 2113, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 14791, 29582, 46518, 57051, 59164, 59196, 61277, 59196, 57083, 50712, 35953, 21130, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 8452, 14791, 23243, 31727, 35953, 38034, 33808, 25388, 16936, 10565, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, -23243, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 12678, 16936, 16936, 12710, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16936, -2016, 14823, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 29582, -2016, 33808, 14823, 6371, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 6371, 6339, 6339, 6339, 6339, 6371, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 6371, 14791, 27501, 2016, -2016, 2016, 2016, 2016, 2016, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 31727, 31727, 31727, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_music.c b/lv_app/lv_icon/x2/img_music.c deleted file mode 100644 index dfd7ec2c4..000000000 --- a/lv_app/lv_icon/x2/img_music.c +++ /dev/null @@ -1,48 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_MUSIC != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_music [] = { /*Width = 33, Height = 32*/ -33, /*Width*/ -32, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 16904, 14791, 12710, 12710, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 12710, 12710, 12710, 12710, 27469, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19049, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2113, 0, 14823, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 32, 6339, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6339, 2113, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 6339, 25356, 2016, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 2016, 2016, 27469, 8452, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 8484, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 10565, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 10565, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 29614, 21162, 19017, 19017, 21162, 16936, 4258, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 21162, 19017, 19017, 21162, 16936, 4258, 0, 0, 12678, 2016, -2016, 2016, 23243, 8484, 6339, 4258, 4226, 4226, 4258, 4226, 32, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 8484, 6339, 4258, 4226, 4226, 4258, 4226, 32, 0, 0, 12678, 2016, -2016, 31695, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 31695, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, -31695, 12710, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 31695, 12710, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, -21162, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 21162, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, -19049, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, 2016, 2016, 2016, 19049, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, -27469, 8452, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4258, 23275, 2016, 2016, 2016, 2016, 27469, 8452, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4258, 23275, 2016, -2016, 23243, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 23243, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 23243, 2016, 2016, -2016, 2016, 16904, 4258, 2145, 2113, 32, 32, 2113, 2145, 6339, 19017, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 4258, 2145, 2113, 32, 32, 2113, 2145, 6339, 19017, 2016, 2016, 2016, -2016, 2016, 2016, 31695, 19017, 10565, 6371, 6371, 10565, 19017, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 19017, 10565, 6371, 6371, 10565, 19017, 33808, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 27501, 25356, 25356, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27501, 25356, 25356, 27501, 2016, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_play.c b/lv_app/lv_icon/x2/img_play.c deleted file mode 100644 index 7b7e2a64c..000000000 --- a/lv_app/lv_icon/x2/img_play.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_PLAY != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_play [] = { /*Width = 23, Height = 31*/ -23, /*Width*/ -31, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 21162, 12710, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 12678, 0, 10597, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 14791, 0, 32, 8452, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 4226, 16936, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 4226, 10597, 27469, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 8484, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 32, 6339, 16936, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 16936, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 10597, 25388, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8484, 23275, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 6371, 16904, 31727, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 16904, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 8484, 21130, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 16936, 33808, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 16904, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6339, 27469, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 8484, 23243, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 32, 12710, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 32, 6371, 16904, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 10565, 25388, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 16904, 0, 0, 0, 2145, 12678, 27469, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 14823, 0, 0, 2145, 21130, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 14823, 0, 6339, 19017, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 14823, 8452, 31695, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 27501, 25388, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_settings.c b/lv_app/lv_icon/x2/img_settings.c deleted file mode 100644 index 7cca26464..000000000 --- a/lv_app/lv_icon/x2/img_settings.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_SETTINGS != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_settings [] = { /*Width = 32, Height = 33*/ -32, /*Width*/ -33, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27469, 10597, 10565, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16936, 0, 0, 14791, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 8484, 0, 0, 6371, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 21130, 23243, 2016, 2016, 29614, 19049, 12710, 6371, 2113, 0, 0, 32, 8452, 14823, 23275, 2016, 2016, 2016, 31727, 29614, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 16936, 2145, 4258, 25356, 27469, 10597, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 6339, 19017, 2016, 33808, 14791, 10597, 23275, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 14823, 0, 0, 32, 6339, 6339, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 4226, 8452, 8452, 2145, 32, 2113, 16904, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 31727, 14791, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 8452, 25388, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 19017, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 10597, 29614, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 29614, 10597, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 6339, 25356, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 21162, 4226, 32, 0, 0, 0, 0, 0, 2113, 4258, 8484, 10597, 10597, 8484, 4226, 32, 0, 0, 0, 0, 0, 0, 2113, 19017, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 2113, 8484, 21162, 38066, 46518, 46486, 35953, 19017, 6371, 32, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 31727, 6371, 0, 0, 0, 0, 0, 0, 6339, 23275, 40179, 57083, 65503, 65503, 54970, 35953, 19049, 4258, 0, 0, 0, 0, 0, 0, 6371, 31727, 2016, 2016, 2016, -2016, 29582, 23275, 14823, 2145, 0, 0, 0, 0, 0, 0, 12710, 44373, 61309, 65503, 65535, 65535, 63422, 59164, 40179, 10565, 0, 0, 0, 0, 0, 0, 2145, 16904, 25356, 27501, 2016, -27469, 10565, 6371, 4226, 32, 0, 0, 0, 0, 0, 0, 16936, 54970, 65535, 65535, 65535, 65535, 65535, 65535, 52825, 14791, 0, 0, 0, 0, 0, 0, 32, 4258, 6371, 8452, 23275, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 19049, 57051, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -21162, 4226, 2145, 2113, 0, 0, 0, 0, 0, 0, 32, 16936, 50744, 65535, 65535, 65535, 65535, 65535, 65535, 48631, 14791, 0, 0, 0, 0, 0, 0, 0, 2145, 4226, 2113, 16936, -2016, 29582, 21162, 12678, 2145, 0, 0, 0, 0, 0, 0, 10597, 40147, 59164, 65535, 65535, 65535, 65535, 54938, 35921, 8484, 0, 0, 0, 0, 0, 0, 4226, 16936, 25388, 29582, 2016, -2016, 2016, 2016, 23275, 4258, 0, 0, 0, 0, 0, 0, 4258, 25356, 40179, 52825, 59164, 59164, 50744, 35921, 21130, 4226, 0, 0, 0, 0, 0, 0, 6371, 31695, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 8452, 0, 0, 0, 0, 0, 0, 32, 4258, 12678, 23243, 27469, 27469, 21130, 10565, 4226, 32, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4258, 8452, 6371, 4226, 0, 0, 0, 0, 0, 0, 0, 32, 4226, 23243, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 27469, 8452, 2113, 0, 0, 0, 0, 0, 0, 0, 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 4258, 21162, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 27501, 10565, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6339, 25388, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 19017, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 16904, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 14791, 0, 0, 0, 2113, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 8452, 27469, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 14823, 0, 0, 0, 10597, 12678, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 32, 0, 0, 2145, 21130, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 27501, 12710, 8484, 14791, 29582, 29614, 19017, 10597, 8452, 4226, 32, 0, 0, 0, 2113, 4226, 6339, 10597, 19017, 16936, 8452, 6371, 14791, 29614, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 21130, 4258, 0, 0, 2113, 8484, 19017, 29614, 2016, 2016, 2016, 29582, 27469, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 8484, 0, 0, 4226, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 0, 6371, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 4258, 2145, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 31695, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_shut_down.c b/lv_app/lv_icon/x2/img_shut_down.c deleted file mode 100644 index a10bd8558..000000000 --- a/lv_app/lv_icon/x2/img_shut_down.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_SHUT_DOWN != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_shut_down [] = { /*Width = 28, Height = 31*/ -28, /*Width*/ -31, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27469, 10597, 10565, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19017, 0, 0, 14791, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 10565, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 21130, 23275, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 25356, 19049, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 31695, 12710, 2113, 12710, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 16936, 2145, 10565, 27501, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 12710, 0, 0, 10597, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 16904, 0, 0, 10565, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 19017, 4226, 0, 0, 16936, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 23243, 4226, 0, 2113, 12710, 31727, 2016, 2016, -2016, 2016, 21162, 4226, 0, 2113, 14823, 33808, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 19049, 4258, 0, 0, 16936, 2016, 2016, -2016, 2016, 12678, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 10565, 2016, 2016, -2016, 31695, 6339, 0, 4226, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 27501, 8452, 0, 4226, 25356, 2016, -2016, 19017, 2113, 2113, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 8484, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25356, 4226, 0, 12678, 31695, -29582, 10565, 0, 6339, 31695, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 4258, 2145, 19017, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 8452, 0, 2145, 21162, -25356, 4258, 0, 8484, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 31695, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 10597, 0, 0, 16904, -21162, 2113, 0, 10565, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 12710, -19017, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 12678, -16936, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 12710, -21130, 32, 0, 10565, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 0, 14823, -25388, 6339, 0, 8452, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 8484, 0, 0, 19049, -31727, 12710, 32, 4226, 25356, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 6339, 0, 8452, 27469, -2016, 23275, 4226, 0, 12710, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19017, 2113, 2113, 16936, 2016, -2016, 2016, 6371, 0, 0, 16936, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21130, 2145, 0, 4258, 29614, 2016, -2016, 2016, 14823, 0, 0, 6339, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 8452, 0, 0, 12710, 2016, 2016, -2016, 2016, 29614, 10597, 0, 0, 6339, 21130, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23275, 8484, 0, 0, 6371, 25356, 2016, 2016, -2016, 2016, 2016, 27501, 10565, 0, 0, 2145, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 6339, 0, 0, 6371, 23243, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 25388, 8484, 0, 0, 2145, 8484, 14791, 21130, 27501, 31695, 31695, 27501, 23243, 16904, 10565, 4226, 0, 0, 4258, 21130, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 27469, 12678, 2145, 0, 0, 0, 32, 8452, 12678, 12678, 8484, 2113, 0, 0, 0, 2113, 10565, 23243, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 6371, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27469, 16904, 10597, 8452, 6371, 6339, 6339, 6371, 8452, 10565, 14791, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_star.c b/lv_app/lv_icon/x2/img_star.c deleted file mode 100644 index de8e45510..000000000 --- a/lv_app/lv_icon/x2/img_star.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_STAR != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_star [] = { /*Width = 34, Height = 33*/ -34, /*Width*/ -33, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 16936, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25356, 6371, 4226, 16936, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 6371, 0, 0, 6339, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21130, 4226, 0, 0, 2145, 12710, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 8452, 32, 0, 0, 0, 2145, 21130, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 6371, 0, 0, 0, 0, 0, 0, 6339, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 25388, 21162, 14823, 8484, 2113, 0, 0, 0, 0, 0, 0, 32, 6371, 12710, 21130, 25388, 29582, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 27469, 23275, 21130, 16904, 12678, 8452, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 6371, 10597, 14823, 19049, 23243, 25388, 33808, 2016, 2016, 2016, -2016, 2016, 2016, 14791, 2145, 4226, 4226, 2145, 2113, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 2113, 2145, 4226, 4226, 2113, 12678, 33808, 2016, 2016, -2016, 2016, 2016, 19017, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 14791, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 27501, 4258, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 23243, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 21162, 6339, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 19017, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 29614, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 25356, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 21162, 6339, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 4226, 16936, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29582, 6371, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4258, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 10597, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8484, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 10597, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 10597, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 10565, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8452, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 8452, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6371, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 6371, 0, 0, 0, 0, 0, 0, 2113, 2145, 2113, 0, 0, 0, 0, 0, 6339, 25356, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 4258, 0, 0, 32, 4258, 10565, 16904, 21130, 21162, 19017, 10597, 4258, 2113, 0, 0, 4226, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19049, 2113, 0, 0, 6339, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 8484, 0, 0, 0, 12710, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 16904, 8452, 6371, 12710, 25356, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27501, 14823, 8452, 6371, 10565, 27469, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 27469, 16904, 23243, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 10597, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25356, 31695, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_user.c b/lv_app/lv_icon/x2/img_user.c deleted file mode 100644 index 8ba77743f..000000000 --- a/lv_app/lv_icon/x2/img_user.c +++ /dev/null @@ -1,46 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_USER != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_user [] = { /*Width = 32, Height = 30*/ -32, /*Width*/ -30, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29582, 21130, 16904, 16904, 21130, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 4258, 4226, 4226, 4226, 4226, 4258, 14791, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19017, 2113, 0, 0, 0, 0, 0, 0, 32, 14823, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 21130, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 10597, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 4258, 32, 0, 0, 0, 0, 0, 0, 0, 32, 19017, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 2145, 0, 0, 0, 0, 0, 0, 2113, 10597, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27501, 6339, 0, 0, 0, 0, 0, 0, 4258, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 10565, 0, 0, 0, 0, 0, 0, 8484, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 14791, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23275, 6371, 32, 0, 0, 32, 4258, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21130, 8452, 2113, 0, 0, 32, 6339, 16936, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21162, 14791, 8452, 4258, 2113, 0, 0, 0, 0, 32, 4226, 8452, 12710, 21130, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 14823, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 12710, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 27469, 14791, 6339, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 6339, 12710, 25356, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 23275, 8484, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6371, 19049, 2016, 2016, 2016, 2016, -2016, 2016, 23243, 8484, 4258, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 4226, 8452, 21130, 2016, 2016, -2016, 27469, 4258, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 21162, 2016, -25388, 6371, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 21130, -19017, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -23243, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16904, -2016, 19049, 10597, 6371, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 8484, 14791, 29614, -2016, 2016, 2016, 31727, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 31727, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_video.c b/lv_app/lv_icon/x2/img_video.c deleted file mode 100644 index 96c34d31e..000000000 --- a/lv_app/lv_icon/x2/img_video.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_VIDEO != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_video [] = { /*Width = 32, Height = 21*/ -32, /*Width*/ -21, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 29582, 19017, 14823, 12710, 12710, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 12710, 12710, 14791, 16936, 27469, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 21162, 8484, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 6371, 16904, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -25356, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -19017, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, 2016, 2016, 2016, 2016, 2016, 21162, 21162, -14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 31727, 4258, 10565, -14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 23275, 6339, 0, 10597, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 31727, 6371, 0, 0, 10597, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 23275, 8452, 32, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8484, 2016, 2016, 8452, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 16936, 16936, 2145, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4258, 21130, 21130, 6371, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 2016, 2016, 19049, 4258, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, 2016, 2016, 19049, 6339, 0, 0, 10597, -14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 19049, 2145, 0, 10565, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 16936, 2113, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 16904, -23243, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16936, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 29614, -2016, 14823, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 33808, 14823, 6371, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 6371, 14791, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_volume.c b/lv_app/lv_icon/x2/img_volume.c deleted file mode 100644 index 640b07118..000000000 --- a/lv_app/lv_icon/x2/img_volume.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_VOLUME != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_volume [] = { /*Width = 25, Height = 26*/ -25, /*Width*/ -26, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21130, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 4226, 8484, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27469, 8484, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 10597, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29582, 10597, 2145, 0, 0, 12678, 2016, 2016, 2016, 2016, 29614, 29614, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 10597, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 23243, 19017, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 12678, 2145, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 31727, 21130, 23275, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 29614, 14791, 21162, 2016, -2016, 31695, 31727, 31727, 33808, 29614, 23243, 14791, 4226, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 14791, 2016, -27469, 12678, 12710, 14791, 14791, 12678, 4258, 32, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 21130, 14823, 2016, -19017, 2113, 2113, 2145, 2145, 2113, 32, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 23275, 2016, -14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29582, 29614, -14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 29582, -14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 29582, -12710, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 31695, -23243, 6371, 8452, 8484, 8484, 8452, 4258, 2113, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 27469, 19049, 2016, -2016, 2016, 2016, 2016, 2016, 33808, 21162, 10597, 32, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 27469, 8484, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 14823, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25356, 8484, 32, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 21162, 19049, 31695, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25356, 8452, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 25356, 16936, 31727, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 6371, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 29614, 27501, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 8452, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23275, 6371, 0, 10565, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21162, 2145, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 16904, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 31695, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_appx/lv_app_example.c b/lv_appx/lv_app_example.c index 5e0224842..7da186140 100644 --- a/lv_appx/lv_app_example.c +++ b/lv_appx/lv_app_example.c @@ -10,7 +10,6 @@ #if LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0 #include "../lv_app/lv_app_util/lv_app_kb.h" -#include "misc/os/ptask.h" #include /********************* @@ -42,9 +41,9 @@ typedef struct /********************** * STATIC PROTOTYPES **********************/ -static void my_app_run(lv_app_inst_t * app, const char * cstr); +static void my_app_run(lv_app_inst_t * app, void * conf); static void my_app_close(lv_app_inst_t * app); -static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, lv_app_com_type_t type , const void * data, uint32_t len); +static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, lv_app_com_type_t type , const void * data, uint32_t size); static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc); static void my_sc_close(lv_app_inst_t * app); static void my_win_open(lv_app_inst_t * app, lv_obj_t * win); @@ -80,6 +79,10 @@ static lv_app_dsc_t my_app_dsc = * GLOBAL FUNCTIONS **********************/ +/** + * Initialize the application + * @return pointer to the application descriptor of this application + */ const lv_app_dsc_t * lv_app_example_init(void) { return &my_app_dsc; @@ -92,17 +95,12 @@ const lv_app_dsc_t * lv_app_example_init(void) /** * Run an application according to 'app_dsc' * @param app_dsc pointer to an application descriptor - * @param cstr a Create STRing which can give initial parameters to the application (NULL or "" if unused) + * @param conf pointer to a lv_app_example_conf_t structure with configuration data or NULL if unused * @return pointer to the opened application or NULL if any error occurred */ -static void my_app_run(lv_app_inst_t * app, const char * cstr) +static void my_app_run(lv_app_inst_t * app, void * conf) { /*Initialize the application*/ - if(cstr != NULL && cstr[0] != '\0') { - char buf[256]; - sprintf(buf,"%s - %s", my_app_dsc.name, cstr); - lv_app_rename(app, buf); - } } /** @@ -122,24 +120,18 @@ static void my_app_close(lv_app_inst_t * app) * @param app_rec pointer to an application which is receiving the message * @param type type of data from 'lv_app_com_type_t' enum * @param data pointer to the sent data - * @param len length of 'data' in bytes + * @param size length of 'data' in bytes */ static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, - lv_app_com_type_t type , const void * data, uint32_t len) + lv_app_com_type_t type , const void * data, uint32_t size) { - if(type == LV_APP_COM_TYPE_STR) { /*data: string*/ + if(type == LV_APP_COM_TYPE_CHAR) { /*data: string*/ my_sc_data_t * sc_data = app_rec->sc_data; if (sc_data->label != NULL) { - lv_label_set_text(sc_data->label, data); + lv_label_set_text_array(sc_data->label, data, size); lv_obj_align(sc_data->label , NULL,LV_ALIGN_CENTER, 0, 0); } } - else if(type == LV_APP_COM_TYPE_BIN) { /*data: array of 'int32_t' */ - - } - else if(type == LV_APP_COM_TYPE_TRIG) { /*data: ignored' */ - - } } /** @@ -151,10 +143,11 @@ static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc) { my_sc_data_t * sc_data = app->sc_data; + lv_app_style_t * app_style = lv_app_style_get(); sc_data->label = lv_label_create(sc, NULL); lv_label_set_text(sc_data->label, "Empty"); - lv_obj_set_style(sc_data->label, lv_labels_get(LV_LABELS_DEF, NULL)); + lv_obj_set_style(sc_data->label, &app_style->sc_txt_style); lv_obj_align(sc_data->label, NULL, LV_ALIGN_CENTER, 0, 0); } @@ -206,7 +199,8 @@ static void my_win_close(lv_app_inst_t * app) */ static lv_action_res_t ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi) { - lv_app_kb_open(ta, LV_APP_KB_MODE_TXT | LV_APP_KB_MODE_CLR, NULL, kb_ok_action); + lv_ta_set_text(ta, ""); /*Clear the ta*/ + lv_app_kb_open(ta, LV_APP_KB_MODE_TXT, NULL, kb_ok_action); return LV_ACTION_RES_OK; } @@ -218,7 +212,7 @@ static void kb_ok_action(lv_obj_t * ta) { lv_app_inst_t * app = lv_obj_get_free_p(ta); const char * txt = lv_ta_get_txt(ta); - lv_app_com_send(app, LV_APP_COM_TYPE_NOTICE, txt, strlen(txt) + 1); + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, txt, strlen(txt)); } #endif /*LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0*/ diff --git a/lv_appx/lv_app_example.h b/lv_appx/lv_app_example.h index 65bb6c40e..38c9dcffc 100644 --- a/lv_appx/lv_app_example.h +++ b/lv_appx/lv_app_example.h @@ -28,6 +28,7 @@ typedef struct /********************** * GLOBAL PROTOTYPES **********************/ +const lv_app_dsc_t * lv_app_example_init(void); /********************** * MACROS @@ -35,4 +36,4 @@ typedef struct #endif /*LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0*/ -#endif /* LV_APP_EXAMPLE */ +#endif /* LV_APP_EXAMPLE_H */ diff --git a/lv_appx/lv_app_files.c b/lv_appx/lv_app_files.c new file mode 100644 index 000000000..58668aa16 --- /dev/null +++ b/lv_appx/lv_app_files.c @@ -0,0 +1,931 @@ +/** + * @file lv_app_example.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "lv_app_files.h" +#if LV_APP_ENABLE != 0 && USE_LV_APP_FILES != 0 + +#include +#include "misc/os/ptask.h" +#include "../lv_app/lv_app_util/lv_app_kb.h" +#include "../lv_app/lv_app_util/lv_app_notice.h" + +/********************* + * DEFINES + *********************/ +#define LV_APP_FILES_CHUNK_MIN_SIZE 32 +#define LV_APP_FILES_CHUNK_MIN_TIME 10 +#define LV_APP_FILES_CHUNK_MAX_TIME 10000 + +/********************** + * TYPEDEFS + **********************/ + +/*Application specific data for an instance of this application*/ +typedef struct +{ + char path[LV_APP_FILES_PATH_MAX_LEN]; + char fn[LV_APP_FILES_FN_MAX_LEN]; + fs_file_t file; + uint8_t file_cnt; + uint16_t chunk_delay; + uint16_t chunk_size; + uint8_t send_fn :1; + uint8_t send_size :1; + uint8_t send_crc :1; + uint8_t send_in_prog :1; + ptask_t * send_task; +}my_app_data_t; + +/*Application specific data a window of this application*/ +typedef struct +{ + lv_obj_t * file_list; + lv_obj_t * send_set_h; +}my_win_data_t; + +/*Application specific data for a shortcut of this application*/ +typedef struct +{ + lv_obj_t * label; +}my_sc_data_t; + +typedef enum +{ + SEND_SETTINGS_FN, + SEND_SETTINGS_SIZE, + SEND_SETTINGS_CRC, + SEND_SETTINGS_CHUNK_SIZE, + SEND_SETTINGS_CHUNK_DELAY, +}send_settings_id_t; + +/********************** + * STATIC PROTOTYPES + **********************/ +static void my_app_run(lv_app_inst_t * app, void * conf); +static void my_app_close(lv_app_inst_t * app); +static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, lv_app_com_type_t type , const void * data, uint32_t size); +static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc); +static void my_sc_close(lv_app_inst_t * app); +static void my_win_open(lv_app_inst_t * app, lv_obj_t * win); +static void my_win_close(lv_app_inst_t * app); + +static void win_load_file_list(lv_app_inst_t * app); +static void win_create_list(lv_app_inst_t * app); +static lv_action_res_t win_up_action(lv_obj_t * up, lv_dispi_t * dispi); +static lv_action_res_t win_next_action(lv_obj_t * next, lv_dispi_t * dispi); +static lv_action_res_t win_prev_action(lv_obj_t * prev, lv_dispi_t * dispi); +static lv_action_res_t win_drv_action(lv_obj_t * drv, lv_dispi_t * dispi); +static lv_action_res_t win_folder_action(lv_obj_t * folder, lv_dispi_t * dispi); +static lv_action_res_t win_file_action(lv_obj_t * file, lv_dispi_t * dispi); +static lv_action_res_t win_send_rel_action(lv_obj_t * send, lv_dispi_t * dispi); +static lv_action_res_t win_send_lpr_action(lv_obj_t * send, lv_dispi_t * dispi); +static lv_action_res_t win_send_settings_element_rel_action(lv_obj_t * element, lv_dispi_t * dispi); +static lv_action_res_t win_back_action(lv_obj_t * back, lv_dispi_t * dispi); +static lv_action_res_t win_del_rel_action(lv_obj_t * del, lv_dispi_t * dispi); +static lv_action_res_t win_del_lpr_action(lv_obj_t * del, lv_dispi_t * dispi); +static void send_settings_kb_close_action(lv_obj_t * ta); +static void send_settings_kb_ok_action(lv_obj_t * ta); +static void start_send(lv_app_inst_t * app, const char * path); +static void send_task(void * param); + +/********************** + * STATIC VARIABLES + **********************/ +static lv_app_dsc_t my_app_dsc = +{ + .name = "Files", + .mode = LV_APP_MODE_NONE, + .app_run = my_app_run, + .app_close = my_app_close, + .com_rec = my_com_rec, + .win_open = my_win_open, + .win_close = my_win_close, + .sc_open = my_sc_open, + .sc_close = my_sc_close, + .app_data_size = sizeof(my_app_data_t), + .sc_data_size = sizeof(my_sc_data_t), + .win_data_size = sizeof(my_win_data_t), +}; + +static lv_labels_t sc_labels; + + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +/** + * Initialize the application + * @return pointer to the application descriptor of this application + */ +const lv_app_dsc_t * lv_app_files_init(void) +{ + lv_app_style_t * app_style = lv_app_style_get(); + memcpy(&sc_labels, &app_style->sc_txt_style, sizeof(lv_labels_t)); + sc_labels.font = LV_APP_FONT_LARGE; + + + return &my_app_dsc; +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +/** + * Run an application according to 'app_dsc' + * @param app_dsc pointer to an application descriptor + * @param conf pointer to a lv_app_example_conf_t structure with configuration data or NULL if unused + * @return pointer to the opened application or NULL if any error occurred + */ +static void my_app_run(lv_app_inst_t * app, void * conf) +{ + /*Initialize the application*/ + my_app_data_t * app_data = app->app_data; + app_data->file_cnt = 0; + app_data->path[0] = '\0'; + app_data->fn[0] = '\0'; + app_data->send_fn = 0; + app_data->send_size = 0; + app_data->send_crc = 0; + app_data->chunk_size = LV_APP_FILES_CHUNK_DEF_SIZE; + app_data->chunk_delay = LV_APP_FILES_CHUNK_DEF_TIME; + app_data->send_in_prog = 0; + + app_data->send_task = ptask_create(send_task, LV_APP_FILES_CHUNK_DEF_TIME, PTASK_PRIO_OFF, app); +} + +/** + * Close a running application. + * Close the Window and the Shortcut too if opened. + * Free all the allocated memory by this application. + * @param app pointer to an application + */ +static void my_app_close(lv_app_inst_t * app) +{ + /*No dynamically allocated data in 'my_app_data'*/ + my_app_data_t * app_data = app->app_data; + ptask_del(app_data->send_task); + if(app_data->send_in_prog != 0) fs_close(&app_data->file); + +} + +/** + * Read the data have been sent to this application + * @param app_send pointer to an application which sent the message + * @param app_rec pointer to an application which is receiving the message + * @param type type of data from 'lv_app_com_type_t' enum + * @param data pointer to the sent data + * @param size length of 'data' in bytes + */ +static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, + lv_app_com_type_t type , const void * data, uint32_t size) +{ + if(type == LV_APP_COM_TYPE_CHAR) { + /*Check for file query. E.g. "U:/file.txt?"*/ + const char * path = data; + if(path[size - 1] == '?') { + if(size > LV_APP_FILES_PATH_MAX_LEN + LV_APP_FILES_FN_MAX_LEN) { + lv_app_notice_add("Can not send file:\ntoo long path"); + } + + char path_fn[LV_APP_FILES_PATH_MAX_LEN + LV_APP_FILES_FN_MAX_LEN]; + memcpy(path_fn, data, size - 1); /*-1 to ignore the '?' at the end*/ + path_fn[size - 1] = '\0'; + start_send(app_rec, path_fn); + } + } +} + +/** + * Open a shortcut for an application + * @param app pointer to an application + * @param sc pointer to an object where the application + * can create content of the shortcut + */ +static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc) +{ + my_sc_data_t * sc_data = app->sc_data; + my_app_data_t * app_data = app->app_data; + + + sc_data->label = lv_label_create(sc, NULL); + lv_obj_set_style(sc_data->label, &sc_labels); + lv_label_set_text(sc_data->label, fs_get_last(app_data->path)); + lv_obj_align(sc_data->label, NULL, LV_ALIGN_CENTER, 0, 0); +} + +/** + * Close the shortcut of an application + * @param app pointer to an application + */ +static void my_sc_close(lv_app_inst_t * app) +{ + /*No dynamically allocated data in 'my_sc_data'*/ +} + + +/** + * Open the application in a window + * @param app pointer to an application + * @param win pointer to a window object where + * the application can create content + */ +static void my_win_open(lv_app_inst_t * app, lv_obj_t * win) +{ + my_win_data_t * win_data = app->win_data; + my_app_data_t * app_data = app->app_data; + + app_data->file_cnt = 0; + win_data->file_list = NULL; + win_data->send_set_h = NULL; + + lv_win_set_title(win, app_data->path); + + win_load_file_list(app); +} + +/** + * Close the window of an application + * @param app pointer to an application + */ +static void my_win_close(lv_app_inst_t * app) +{ + +} + +/*-------------------- + * OTHER FUNCTIONS + ---------------------*/ +/** + * Create an mpty list on the window. 'win_load_file_list' will fill it. + * @param app pointer to a Files application + */ +static void win_create_list(lv_app_inst_t * app) +{ + lv_app_style_t * app_style = lv_app_style_get(); + my_win_data_t * win_data = app->win_data; + + /*Delete the previous list*/ + if(win_data->file_list != NULL) { + lv_obj_del(win_data->file_list); + } + + /*Create a new list*/ + win_data->file_list = lv_list_create(app->win, NULL); + lv_obj_set_width(win_data->file_list, app_style->win_useful_w); + lv_obj_set_style(win_data->file_list, lv_lists_get(LV_LISTS_TRANSP, NULL)); + lv_list_set_fit(win_data->file_list, LV_LIST_FIT_WIDTH_SB); + lv_obj_set_drag_parent(win_data->file_list, true); + lv_obj_set_drag_parent(lv_page_get_scrl(win_data->file_list), true); + lv_rect_set_fit(win_data->file_list, false, true); + lv_rect_set_layout(lv_page_get_scrl(win_data->file_list), LV_RECT_LAYOUT_COL_L); +} + +/** + * Load the file list from the current path on the window + * @param app pointer to a Files application + */ +static void win_load_file_list(lv_app_inst_t * app) +{ + my_app_data_t * app_data = app->app_data; + my_win_data_t * win_data = app->win_data; + + /*Create a new list*/ + win_create_list(app); + + fs_res_t res = FS_RES_OK; + + /*At empty path show the drivers */ + lv_obj_t * liste; + if(app_data->path[0] == '\0') { + char drv[16]; + char buf[2]; + fs_get_letters(drv); + uint8_t i; + for(i = 0; drv[i] != '\0'; i++) { + buf[0] = drv[i]; + buf[1] = '\0'; + liste = lv_list_add(win_data->file_list, "U:/icon_driver", buf, win_drv_action); + lv_obj_set_free_p(liste, app); + } + } + /*List the files/folders with fs interface*/ + else { + liste = lv_list_add(win_data->file_list, "U:/icon_up", "Up", win_up_action); + lv_obj_set_free_p(liste, app); + + fs_readdir_t rd; + res = fs_readdir_init(&rd, app_data->path); + if(res != FS_RES_OK) { + lv_app_notice_add("Can not read the\npath in Files"); + return; + } + + /*At not first page add prev. page button */ + if(app_data->file_cnt != 0) { + liste = lv_list_add(win_data->file_list, "U:/icon_left", "Previous page", win_prev_action); + lv_obj_set_free_p(liste, app); + } + + char fn[LV_APP_FILES_FN_MAX_LEN]; + + /*Read the files from the previous pages*/ + uint16_t file_cnt = 0; + while(file_cnt <= app_data->file_cnt) { + res = fs_readdir(&rd, fn); + if(res != FS_RES_OK || fn[0] == '\0'){ + lv_app_notice_add("Can not read\nthe path in Files"); + return; + } + file_cnt ++; + } + + /*Add list elements from the files and folders*/ + while(res == FS_RES_OK && fn[0] != '\0') { + if(fn[0] == '/') { /*Add a folder*/ + lv_obj_t * liste; + liste = lv_list_add(win_data->file_list, "U:/icon_folder", &fn[1], win_folder_action); + lv_obj_set_free_p(liste, app); + app_data->file_cnt ++; + } + /*Add a file*/ + else { + liste = lv_list_add(win_data->file_list, "U:/icon_file", fn, win_file_action); + lv_obj_set_free_p(liste, app); + app_data->file_cnt ++; + } + + /*Get the next element*/ + res = fs_readdir(&rd, fn); + + /*Show only LV_APP_FSEL_MAX_FILE elements and add a Next page button*/ + if(app_data->file_cnt != 0 && app_data->file_cnt % LV_APP_FILES_PAGE_SIZE == 0) { + liste = lv_list_add(win_data->file_list, "U:/icon_right", "Next page", win_next_action); + lv_obj_set_free_p(liste, app); + break; + } + } + + /*Close the read directory*/ + fs_readdir_close(&rd); + } + + if(res != FS_RES_OK) { + lv_app_notice_add("Can not read\nthe path in Files"); + } + + /*Focus to the top of the list*/ + lv_obj_set_y(lv_page_get_scrl(win_data->file_list), 0); + return; +} + + +/** + * Called when the Up list element is released to step one level + * @param up pointer to the Up button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t win_up_action(lv_obj_t * up, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(up); + my_app_data_t * app_data = app->app_data; + fs_up(app_data->path); + app_data->file_cnt = 0; + lv_win_set_title(app->win, app_data->path); + + my_sc_data_t * sc_data = app->sc_data; + if(sc_data != NULL) { + lv_label_set_text(sc_data->label, fs_get_last(app_data->path)); + lv_obj_align(sc_data->label, NULL, LV_ALIGN_CENTER, 0, 0); + } + + win_load_file_list(app); + return LV_ACTION_RES_INV; +} + +/** + * Called when the Next list element is released to go to the next page + * @param next pointer to the Next button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t win_next_action(lv_obj_t * next, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(next); + win_load_file_list(app); + return LV_ACTION_RES_INV; +} + +/** + * Called when the Prev list element is released to previous page + * @param prev pointer to the Prev button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t win_prev_action(lv_obj_t * prev, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(prev); + my_app_data_t * app_data = app->app_data; + if(app_data->file_cnt <= 2 * LV_APP_FILES_PAGE_SIZE) app_data->file_cnt = 0; + else if(app_data->file_cnt % LV_APP_FILES_PAGE_SIZE == 0) { + app_data->file_cnt -= 2 * LV_APP_FILES_PAGE_SIZE; + } else { + app_data->file_cnt = ((app_data->file_cnt / LV_APP_FILES_PAGE_SIZE) - 1) * LV_APP_FILES_PAGE_SIZE; + } + + win_load_file_list(app); + return LV_ACTION_RES_INV; +} + + +/** + * Called when the Driver list element is released to step into a driver + * @param drv pointer to the Driver button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t win_drv_action(lv_obj_t * drv, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(drv); + my_app_data_t * app_data = app->app_data; + sprintf(app_data->path, "%s:", lv_list_element_get_txt(drv)); + app_data->file_cnt = 0; + lv_win_set_title(app->win, app_data->path); + my_sc_data_t * sc_data = app->sc_data; + if(sc_data != NULL) { + lv_label_set_text(sc_data->label, fs_get_last(app_data->path)); + lv_obj_align(sc_data->label, NULL, LV_ALIGN_CENTER, 0, 0); + } + + win_load_file_list(app); + return LV_ACTION_RES_INV; +} + + +/** + * Called when a folder list element is released to enter into it + * @param folder pointer to a folder button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t win_folder_action(lv_obj_t * folder, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(folder); + my_app_data_t * app_data = app->app_data; + sprintf(app_data->path, "%s/%s", app_data->path, lv_list_element_get_txt(folder)); + app_data->file_cnt = 0; + + lv_win_set_title(app->win, app_data->path); + my_sc_data_t * sc_data = app->sc_data; + if(sc_data != NULL) { + lv_label_set_text(sc_data->label, fs_get_last(app_data->path)); + lv_obj_align(sc_data->label, NULL, LV_ALIGN_CENTER, 0, 0); + } + + + win_load_file_list(app); + return LV_ACTION_RES_INV; +} + + +/** + * Called when a file list element is released to show the list of operation on it + * @param file pointer to a file button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t win_file_action(lv_obj_t * file, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(file); + my_app_data_t * app_data = app->app_data; + my_win_data_t * win_data = app->win_data; + + sprintf(app_data->fn, "%s", lv_list_element_get_txt(file)); + + win_create_list(app); + + /*Create the list of operations*/ + lv_obj_t * liste; + liste = lv_list_add(win_data->file_list, "U:/icon_left", "Back", win_back_action); + lv_obj_set_free_p(liste, app); + + /*Send button*/ + liste = lv_list_add(win_data->file_list, NULL, "Send", win_send_rel_action); + lv_obj_set_free_p(liste, app); + lv_btn_set_lpr_action(liste, win_send_lpr_action); + lv_obj_set_free_p(liste, app); + + /*Delete button*/ + liste = lv_list_add(win_data->file_list, NULL, "Delete", win_del_rel_action); + lv_btn_set_lpr_action(liste, win_del_lpr_action); + lv_obj_set_free_p(liste, app); + + return LV_ACTION_RES_INV; +} + +/** + * Called when the Back list element is released to when a file chosen to + * go back to the file list from file operation + * @param back pointer to the back button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t win_back_action(lv_obj_t * up, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(up); + my_app_data_t * app_data = app->app_data; + + app_data->file_cnt = 0; + win_load_file_list(app); + return LV_ACTION_RES_INV; +} + +/** + * Called when the Send list element is released to send the file + * @param sed pointer to the Up button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_OK because the list is NOT deleted in the function + */ +static lv_action_res_t win_send_rel_action(lv_obj_t * send, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(send); + my_app_data_t * app_data = app->app_data; + + if(app_data->send_in_prog != 0) { + lv_app_notice_add("File sending\nin progress"); + return LV_ACTION_RES_OK; + } + + char path_fn[LV_APP_FILES_PATH_MAX_LEN + LV_APP_FILES_FN_MAX_LEN]; + sprintf(path_fn, "%s/%s", app_data->path, app_data->fn); + start_send(app, path_fn); + + return LV_ACTION_RES_OK; +} + +/** + * Called when the Send list element is long pressed to show/hide send settings + * @param send pointer to the Up button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_OK because the list is NOT deleted in the function + */ +static lv_action_res_t win_send_lpr_action(lv_obj_t * send, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(send); + my_app_data_t * app_data = app->app_data; + my_win_data_t * win_data = app->win_data; + + /*Close the settings if it is opened*/ + if(win_data->send_set_h != NULL) { + lv_obj_del(win_data->send_set_h); + win_data->send_set_h = NULL; + lv_dispi_wait_release(dispi); + lv_btn_set_state(send, LV_BTN_STATE_REL); + return LV_ACTION_RES_OK; + } + + /*Create the settings*/ + lv_btn_set_state(send, LV_BTN_STATE_REL); + lv_rect_set_layout(send, LV_RECT_LAYOUT_COL_L); + + /*Create holder for the settings*/ + win_data->send_set_h = lv_rect_create(send, NULL); + lv_obj_set_style(win_data->send_set_h, lv_rects_get(LV_RECTS_TRANSP, NULL)); + lv_obj_set_click(win_data->send_set_h, false); + lv_rect_set_fit(win_data->send_set_h, true, true); + lv_rect_set_layout(win_data->send_set_h, LV_RECT_LAYOUT_COL_L); + + /*Create check boxes*/ + lv_obj_t * cb; + + /*Send file name check box*/ + cb = lv_cb_create(win_data->send_set_h, NULL); + lv_cb_set_text(cb, "Send file name"); + lv_obj_set_free_num(cb, SEND_SETTINGS_FN); + lv_obj_set_free_p(cb, app); + lv_btn_set_rel_action(cb, win_send_settings_element_rel_action); + if(app_data->send_fn != 0) lv_btn_set_state(cb, LV_BTN_STATE_TGL_REL); + else lv_btn_set_state(cb, LV_BTN_STATE_REL); + + /*Send size check box*/ + cb = lv_cb_create(win_data->send_set_h, cb); + lv_cb_set_text(cb, "Send size"); + lv_obj_set_free_num(cb, SEND_SETTINGS_SIZE); + if(app_data->send_size != 0) lv_btn_set_state(cb, LV_BTN_STATE_TGL_REL); + else lv_btn_set_state(cb, LV_BTN_STATE_REL); + + /*Send CRC check box*/ + cb = lv_cb_create(win_data->send_set_h, cb); + lv_cb_set_text(cb, "Send CRC"); + lv_obj_set_free_num(cb, SEND_SETTINGS_CRC); + if(app_data->send_crc != 0) lv_btn_set_state(cb, LV_BTN_STATE_TGL_REL); + else lv_btn_set_state(cb, LV_BTN_STATE_REL); + + /*Create a text area the type chunk size*/ + lv_obj_t * val_set_h; + val_set_h = lv_rect_create(win_data->send_set_h, NULL); + lv_obj_set_style(val_set_h, lv_rects_get(LV_RECTS_TRANSP, NULL)); + lv_obj_set_click(val_set_h, false); + lv_rect_set_fit(val_set_h, true, true); + lv_rect_set_layout(val_set_h, LV_RECT_LAYOUT_ROW_M); + + lv_obj_t * label; + label = lv_label_create(val_set_h, NULL); + lv_label_set_text(label, "Chunk size"); + + lv_obj_t * ta; + char buf[32]; + ta = lv_ta_create(val_set_h, NULL); + lv_obj_set_style(ta, lv_tas_get(LV_TAS_SIMPLE, NULL)); + lv_rect_set_fit(ta, false, true); + lv_obj_set_free_num(ta, SEND_SETTINGS_CHUNK_SIZE); + lv_obj_set_free_p(ta, app); + lv_page_set_rel_action(ta, win_send_settings_element_rel_action); + sprintf(buf, "%d", app_data->chunk_size); + lv_ta_set_text(ta, buf); + + /*Create a text area to type the chunk delay*/ + val_set_h = lv_rect_create(win_data->send_set_h, val_set_h); + + label = lv_label_create(val_set_h, NULL); + lv_label_set_text(label, "Inter-chunk delay"); + + ta = lv_ta_create(val_set_h, ta); + lv_obj_set_free_num(ta, SEND_SETTINGS_CHUNK_DELAY); + sprintf(buf, "%d", app_data->chunk_delay); + lv_ta_set_text(ta, buf); + + return LV_ACTION_RES_OK; +} +/** + * Called when a send settings element is released + * @param element pointer to a chekbox or text area + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_OK because the list is NOT deleted in the function + */ +static lv_action_res_t win_send_settings_element_rel_action(lv_obj_t * element, lv_dispi_t * dispi) +{ + send_settings_id_t id = lv_obj_get_free_num(element); + lv_app_inst_t * app = lv_obj_get_free_p(element); + my_app_data_t * app_data = app->app_data; + + if(id == SEND_SETTINGS_FN) { + app_data->send_fn = lv_btn_get_state(element) == LV_BTN_STATE_REL ? 0 : 1; + } else if(id == SEND_SETTINGS_SIZE) { + app_data->send_size = lv_btn_get_state(element) == LV_BTN_STATE_REL ? 0 : 1; + } else if(id == SEND_SETTINGS_CRC) { + app_data->send_crc = lv_btn_get_state(element) == LV_BTN_STATE_REL ? 0 : 1; + + /*TODO CRC sending is not supported yet*/ + if(app_data->send_crc != 0) { + lv_app_notice_add("CRC sending is\nnot supported yet"); + } + } else if(id == SEND_SETTINGS_CHUNK_SIZE) { + lv_app_kb_open(element, LV_APP_KB_MODE_NUM, send_settings_kb_close_action, send_settings_kb_ok_action); + } else if(id == SEND_SETTINGS_CHUNK_DELAY) { + lv_app_kb_open(element, LV_APP_KB_MODE_NUM, send_settings_kb_close_action, send_settings_kb_ok_action); + } + + return LV_ACTION_RES_OK; +} + + +/** + * Called when the Delete list element is released. + * It will show a notification to long press the Delete button to remove the file + * @param del pointer to the back button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_OK because the list is NOT deleted in the function + */ +static lv_action_res_t win_del_rel_action(lv_obj_t * del, lv_dispi_t * dispi) +{ + lv_app_notice_add("Press long the Delete button\n" + "to remove the file"); + + return LV_ACTION_RES_OK; +} +/** + * Called when the Delete list element is long pressed to remove a file + * @param del pointer to the Delete button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_OK because the list is NOT deleted in the function + */ +static lv_action_res_t win_del_lpr_action(lv_obj_t * del, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(del); + my_app_data_t * app_data = app->app_data; + + char path_fn[LV_APP_FILES_PATH_MAX_LEN + LV_APP_FILES_FN_MAX_LEN]; + sprintf(path_fn, "%s/%s", app_data->path, app_data->fn); + + fs_res_t res = fs_remove(path_fn); + if(res == FS_RES_OK) lv_app_notice_add("%s deleted", app_data->fn); + else lv_app_notice_add("Can not delete\n%s", app_data->fn); + + return LV_ACTION_RES_OK; +} + +/** + * Called when a send setting is typed and 'Close' pressed on the App. keyboard. + * The function reverts the original value in the text area. + * @param ta pointer to a text area + */ +static void send_settings_kb_close_action(lv_obj_t * ta) +{ + send_settings_id_t id = lv_obj_get_free_num(ta); + lv_app_inst_t * app = lv_obj_get_free_p(ta); + my_app_data_t * app_data = app->app_data; + + char buf[32]; + buf[0] = '\0'; + + if(id == SEND_SETTINGS_CHUNK_DELAY) { + sprintf(buf, "%d", app_data->chunk_size); + } else if(id == SEND_SETTINGS_CHUNK_SIZE) { + sprintf(buf, "%d", app_data->chunk_size); + } + lv_ta_set_text(ta, buf); +} + +/** + * Called when a send setting is typed and 'Ok' pressed on the App. keyboard. + * The function saves teh new value. + * @param ta pointer to a text area + */ +static void send_settings_kb_ok_action(lv_obj_t * ta) +{ + send_settings_id_t id = lv_obj_get_free_num(ta); + lv_app_inst_t * app = lv_obj_get_free_p(ta); + my_app_data_t * app_data = app->app_data; + + int num; + sscanf(lv_ta_get_txt(ta), "%d", &num); + + if(id == SEND_SETTINGS_CHUNK_DELAY) { + if(num > LV_APP_FILES_CHUNK_MAX_TIME) num = LV_APP_FILES_CHUNK_MAX_TIME; + if(num < LV_APP_FILES_CHUNK_MIN_TIME) num = LV_APP_FILES_CHUNK_MIN_TIME; + app_data->chunk_delay = (uint16_t) num; + } else if(id == SEND_SETTINGS_CHUNK_SIZE) { + if(num > LV_APP_FILES_CHUNK_MAX_SIZE) num = LV_APP_FILES_CHUNK_MAX_SIZE; + if(num < LV_APP_FILES_CHUNK_MIN_SIZE) num = LV_APP_FILES_CHUNK_MIN_SIZE; + app_data->chunk_size= (uint16_t) num; + } + +} + +/** + * Start the sending of a file + * @param app pointer to a Files application + * @param path path of the file to send + */ +static void start_send(lv_app_inst_t * app, const char * path) +{ + my_app_data_t * app_data = app->app_data; + + /*Open the file*/ + fs_res_t res = fs_open(&app_data->file, path, FS_MODE_RD); + if(res == FS_RES_OK) { + uint32_t rn; + char rd_buf[LV_APP_FILES_CHUNK_MAX_SIZE]; + + /*Read the first chunk*/ + res = fs_read(&app_data->file, rd_buf, app_data->chunk_size, &rn); + if(res == FS_RES_OK) { + app_data->send_in_prog = 1; + + /*Send the header*/ + if(app_data->send_fn != 0) { + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, app_data->path, strlen(app_data->path)); + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "/", 1); + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, app_data->fn, strlen(app_data->fn)); + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "\n", 1); + } + + if(app_data->send_size != 0) { + char buf[64]; + uint32_t size; + fs_size(&app_data->file, &size); + sprintf(buf,"%d", (int) size); + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, buf, strlen(buf)); + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "\n", 1); + } + if(app_data->send_crc != 0) { + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "0x0000", 6); + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "\n", 1); + } + + /*Add an extra \n to separate the header from the file data*/ + if(app_data->send_fn != 0 || app_data->send_size != 0 || app_data->send_crc != 0) { + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "\n", 1); + } + + } + } + + /*If an error occurred close the file*/ + if(res != FS_RES_OK) { + fs_close(&app_data->file); + ptask_set_prio(app_data->send_task, PTASK_PRIO_OFF); + app_data->send_in_prog = 0; + lv_app_notice_add("Can not send\nthe file in Files"); + } + /*If no error show notification, start the sender task and refresh the shortcut*/ + else { + /*Start the sender task*/ + ptask_set_period(app_data->send_task, app_data->chunk_delay); + ptask_reset(app_data->send_task); + ptask_set_prio(app_data->send_task, PTASK_PRIO_HIGH); + lv_app_notice_add("Sending\n%s", fs_get_last(path)); + + /*Refresh the shortcut with the percentage of the sending*/ + if(app->sc_data != NULL) { + my_sc_data_t * sc_data = app->sc_data; + + uint32_t size; + fs_size(&app_data->file, &size); + uint32_t pos; + fs_tell(&app_data->file, &pos); + + int pct = (uint32_t) (pos * 100) / size; + + char buf[256]; + sprintf(buf, "Sending\n%d%%", pct); + lv_label_set_text(sc_data->label, buf); + lv_obj_align(sc_data->label, NULL, LV_ALIGN_CENTER, 0, 0); + } + } +} + +/** + * Periodically send the next chunk of the file + * @param app pointer to a Files application + */ +static void send_task(void * param) +{ + lv_app_inst_t * app = param; + my_app_data_t * app_data = app->app_data; + + if(app_data->send_in_prog == 0) return; + + /*Read a chunk*/ + uint32_t rn; + char rd_buf[LV_APP_FILES_CHUNK_MAX_SIZE]; + fs_res_t res = fs_read(&app_data->file, rd_buf, app_data->chunk_size, &rn); + if(res == FS_RES_OK) { + app_data->send_in_prog = 1; + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, rd_buf, rn); + } + + /*If the read failed close the file and show an error*/ + if(res != FS_RES_OK) { + fs_close(&app_data->file); + app_data->send_in_prog = 0; + lv_app_notice_add("Can not send\nthe file in Files"); + } + /*If the read was successful*/ + else { + my_sc_data_t * sc_data = app->sc_data; + + /*If the file is read close it a show a notification*/ + if(rn < app_data->chunk_size) { + lv_app_notice_add("File sent"); + fs_close(&app_data->file); + app_data->send_in_prog = 0; + + /*Refresh the shortut*/ + if(sc_data != NULL) { + lv_label_set_text(sc_data->label, fs_get_last(app_data->path)); + lv_obj_align(sc_data->label, NULL, LV_ALIGN_CENTER, 0, 0); + } + } + /*If the file is not sent yet refresh the shortcut with percentage of sending*/ + else { + if(sc_data != NULL) { + uint32_t size; + fs_size(&app_data->file, &size); + uint32_t pos; + fs_tell(&app_data->file, &pos); + + uint8_t pct = (uint32_t) (pos * 100) / size; + + char buf[256]; + sprintf(buf, "Sending\n%d%%", pct); + lv_label_set_text(sc_data->label, buf); + lv_obj_align(sc_data->label, NULL, LV_ALIGN_CENTER, 0, 0); + } + } + } +} + +#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_FILES != 0*/ diff --git a/lv_appx/lv_app_files.h b/lv_appx/lv_app_files.h new file mode 100644 index 000000000..1fb316b2c --- /dev/null +++ b/lv_appx/lv_app_files.h @@ -0,0 +1,39 @@ +/** + * @file lv_app_files.h + * + */ + +#ifndef LV_APP_FILES_H +#define LV_APP_FILES_H + +/********************* + * INCLUDES + *********************/ +#include "lvgl/lv_app/lv_app.h" + +#if LV_APP_ENABLE != 0 && USE_LV_APP_FILES != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +typedef struct +{ + +}lv_app_files_conf_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ +const lv_app_dsc_t * lv_app_files_init(void); + +/********************** + * MACROS + **********************/ + +#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_FILES != 0*/ + +#endif /* LV_APP_EXAMPLE_H */ diff --git a/lv_appx/lv_app_sysmon.c b/lv_appx/lv_app_sysmon.c new file mode 100644 index 000000000..0d9a581fa --- /dev/null +++ b/lv_appx/lv_app_sysmon.c @@ -0,0 +1,388 @@ +/** + * @file lv_app_sysmon.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "lv_app_sysmon.h" +#if LV_APP_ENABLE != 0 && USE_LV_APP_SYSMON != 0 + +#include +#include "misc/os/ptask.h" +#include "misc/os/idle.h" +#include "lvgl/lv_objx/lv_chart.h" +#include "lvgl/lv_app/lv_app_util/lv_app_notice.h" +#include "hal/systick/systick.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Application specific data for an instance of this application*/ +typedef struct +{ + +}my_app_data_t; + +/*Application specific data a window of this application*/ +typedef struct +{ + lv_obj_t * chart; + cord_t * cpu_dl; + cord_t * mem_dl; + lv_obj_t * label; +}my_win_data_t; + +/*Application specific data for a shortcut of this application*/ +typedef struct +{ + lv_obj_t * pb_cpu; + lv_obj_t * pb_mem; +}my_sc_data_t; + +/********************** + * STATIC PROTOTYPES + **********************/ +static void my_app_run(lv_app_inst_t * app, void * conf); +static void my_app_close(lv_app_inst_t * app); +static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, lv_app_com_type_t type , const void * data, uint32_t size); +static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc); +static void my_sc_close(lv_app_inst_t * app); +static void my_win_open(lv_app_inst_t * app, lv_obj_t * win); +static void my_win_close(lv_app_inst_t * app); + +static void sysmon_task(void * param); +static void lv_app_sysmon_refr(void); + +/********************** + * STATIC VARIABLES + **********************/ +static lv_app_dsc_t my_app_dsc = +{ + .name = "Sys. monitor", + .mode = LV_APP_MODE_NONE, + .app_run = my_app_run, + .app_close = my_app_close, + .com_rec = my_com_rec, + .win_open = my_win_open, + .win_close = my_win_close, + .sc_open = my_sc_open, + .sc_close = my_sc_close, + .app_data_size = sizeof(my_app_data_t), + .sc_data_size = sizeof(my_sc_data_t), + .win_data_size = sizeof(my_win_data_t), +}; + +static uint8_t mem_pct[LV_APP_SYSMON_PNUM]; +static uint8_t cpu_pct[LV_APP_SYSMON_PNUM]; +static lv_pbs_t cpu_pbs; +static lv_pbs_t mem_pbs; +#if USE_DYN_MEM != 0 && DM_CUSTOM == 0 +static dm_mon_t mem_mon; +#endif + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +/** + * Initialize the application + * @return pointer to the application descriptor of this application + */ +const lv_app_dsc_t * lv_app_sysmon_init(void) +{ + ptask_create(sysmon_task, LV_APP_SYSMON_REFR_TIME, PTASK_PRIO_LOW, NULL); + + memset(mem_pct, 0, sizeof(mem_pct)); + memset(cpu_pct, 0, sizeof(cpu_pct)); + + /*Create progress bar styles for the shortcut*/ + lv_pbs_get(LV_PBS_DEF, &cpu_pbs); + cpu_pbs.bg.gcolor = COLOR_MAKE(0xFF, 0xE0, 0xE0); + cpu_pbs.bg.objs.color = COLOR_MAKE(0xFF, 0xD0, 0xD0); + cpu_pbs.bg.bcolor = COLOR_MAKE(0xFF, 0x20, 0x20); + cpu_pbs.bg.bwidth = 1 * LV_DOWNSCALE; + + cpu_pbs.bar.gcolor = COLOR_MARRON; + cpu_pbs.bar.objs.color = COLOR_RED; + cpu_pbs.bar.bwidth = 0; + + cpu_pbs.label.objs.color = COLOR_MAKE(0x40, 0x00, 0x00); + cpu_pbs.label.font = LV_APP_FONT_MEDIUM; + cpu_pbs.label.line_space = 0; + cpu_pbs.label.mid = 1; + + memcpy(&mem_pbs, &cpu_pbs, sizeof(mem_pbs)); + mem_pbs.bg.gcolor = COLOR_MAKE(0xD0, 0xFF, 0xD0); + mem_pbs.bg.objs.color = COLOR_MAKE(0xE0, 0xFF, 0xE0); + mem_pbs.bg.bcolor = COLOR_MAKE(0x20, 0xFF, 0x20); + + mem_pbs.bar.gcolor = COLOR_GREEN; + mem_pbs.bar.objs.color = COLOR_LIME; + + mem_pbs.label.objs.color = COLOR_MAKE(0x00, 0x40, 0x00); + + return &my_app_dsc; +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +/** + * Run an application according to 'app_dsc' + * @param app_dsc pointer to an application descriptor + * @param conf pointer to a lv_app_sysmon_conf_t structure with configuration data or NULL if unused + * @return pointer to the opened application or NULL if any error occurred + */ +static void my_app_run(lv_app_inst_t * app, void * conf) +{ + +} + +/** + * Close a running application. + * Close the Window and the Shortcut too if opened. + * Free all the allocated memory by this application. + * @param app pointer to an application + */ +static void my_app_close(lv_app_inst_t * app) +{ + /*No dynamically allocated data in 'my_app_data'*/ +} + +/** + * Read the data have been sent to this application + * @param app_send pointer to an application which sent the message + * @param app_rec pointer to an application which is receiving the message + * @param type type of data from 'lv_app_com_type_t' enum + * @param data pointer to the sent data + * @param size length of 'data' in bytes + */ +static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, + lv_app_com_type_t type , const void * data, uint32_t size) +{ + +} + +/** + * Open a shortcut for an application + * @param app pointer to an application + * @param sc pointer to an object where the application + * can create content of the shortcut + */ +static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc) +{ + my_sc_data_t * sc_data = app->sc_data; + + cord_t w = lv_obj_get_width(sc) / 5; + + /*Create 2 progress bars fr the CPU and the Memory*/ + sc_data->pb_cpu = lv_pb_create(sc, NULL); + lv_obj_set_size(sc_data->pb_cpu, w, 5 * lv_obj_get_height(sc) / 8); + lv_obj_align(sc_data->pb_cpu, NULL, LV_ALIGN_IN_BOTTOM_LEFT, w, - lv_obj_get_height(sc) / 8); + lv_obj_set_style(sc_data->pb_cpu, &cpu_pbs); + lv_obj_set_click(sc_data->pb_cpu, false); + lv_pb_set_min_max_value(sc_data->pb_cpu, 0, 100); + lv_pb_set_format_str(sc_data->pb_cpu, "C\nP\nU"); + + sc_data->pb_mem = lv_pb_create(sc, sc_data->pb_cpu); + lv_obj_align(sc_data->pb_mem, sc_data->pb_cpu, LV_ALIGN_OUT_RIGHT_MID, w, 0); + lv_obj_set_style(sc_data->pb_mem, &mem_pbs); + lv_pb_set_format_str(sc_data->pb_mem, "M\ne\nm"); + + lv_app_sysmon_refr(); +} + +/** + * Close the shortcut of an application + * @param app pointer to an application + */ +static void my_sc_close(lv_app_inst_t * app) +{ + /*No dynamically allocated data in 'my_sc_data'*/ +} + + +/** + * Open the application in a window + * @param app pointer to an application + * @param win pointer to a window object where + * the application can create content + */ +static void my_win_open(lv_app_inst_t * app, lv_obj_t * win) +{ + my_win_data_t * win_data = app->win_data; + lv_app_style_t * app_style = lv_app_style_get(); + + /*Create a chart with two data lines*/ + win_data->chart = lv_chart_create(win, NULL); + lv_obj_set_size(win_data->chart, LV_HOR_RES / 2, LV_VER_RES / 2); + lv_chart_set_pnum(win_data->chart, LV_APP_SYSMON_PNUM); + lv_chart_set_range(win_data->chart, 0, 100); + lv_chart_set_type(win_data->chart, LV_CHART_LINE); + + win_data->cpu_dl = lv_chart_add_dataline(win_data->chart); + win_data->mem_dl = lv_chart_add_dataline(win_data->chart); + + uint16_t i; + for(i = 0; i < LV_APP_SYSMON_PNUM; i ++) { + win_data->cpu_dl[i] = cpu_pct[i]; + win_data->mem_dl[i] = mem_pct[i]; + } + + /*Create a label for the details of Memory and CPU usage*/ + cord_t opad = app_style->win_style.pages.scrl_rects.opad; + win_data->label = lv_label_create(win, NULL); + lv_obj_align(win_data->label, win_data->chart, LV_ALIGN_OUT_RIGHT_MID, opad, 0); + lv_obj_set_style(win_data->label, &app_style->win_txt_style); + + lv_app_sysmon_refr(); +} + +/** + * Close the window of an application + * @param app pointer to an application + */ +static void my_win_close(lv_app_inst_t * app) +{ + +} + +/*-------------------- + * OTHER FUNCTIONS + ---------------------*/ + +/** + * Called periodically to monitor the CPU and memory usage. + * It refreshes the shortcuts and windows and also add notifications if there is any problem. + * @param param unused + */ +static void sysmon_task(void * param) +{ + /*Shift out the oldest data*/ + uint16_t i; + for(i = 1; i < LV_APP_SYSMON_PNUM; i++) { + mem_pct[i - 1] = mem_pct[i]; + cpu_pct[i - 1] = cpu_pct[i]; + } + + /*Get CPU and memory information */ + uint8_t cpu_busy = 0; +#if USE_IDLE != 0 + cpu_busy = 100 - idle_get(); +#endif + + uint8_t mem_used_pct = 0; +#if USE_DYN_MEM != 0 && DM_CUSTOM == 0 + dm_monitor(&mem_mon); + mem_used_pct = mem_mon.pct_used; +#endif + + /*Add the CPU and memory data*/ + cpu_pct[LV_APP_SYSMON_PNUM - 1] = cpu_busy; + mem_pct[LV_APP_SYSMON_PNUM - 1] = mem_used_pct; + + /*Refresh the shortcuts and windows*/ + lv_app_sysmon_refr(); + +#if USE_DYN_MEM != 0 && DM_CUSTOM == 0 + + /*Handle periodic defrag. if enabled*/ +#if LV_APP_SYSMON_DEFRAG_PERIOD != 0 + static uint32_t last_defrag = 0; + + if(systick_elaps(last_defrag) > LV_APP_SYSMON_DEFRAG_PERIOD) { + dm_defrag(); + last_defrag = systick_get(); + } +#endif + /*Add notifications if something is critical*/ + static bool mem_warn_report = false; + if(mem_mon.size_free < LV_APP_SYSMON_MEM_WARN && mem_warn_report == false) { + mem_warn_report = true; + lv_app_notice_add("Critically low memory"); + } + + if(mem_mon.size_free > LV_APP_SYSMON_MEM_WARN) mem_warn_report = false; + + static bool frag_warn_report = false; + if(mem_mon.pct_frag > LV_APP_SYSMON_FRAG_WARN) { + if(frag_warn_report == false) { + frag_warn_report = true; + lv_app_notice_add("Critically memory fragmentation"); + dm_defrag(); /*Defrag. if the fragmentation is critical*/ + } + } + + if(mem_mon.pct_frag < LV_APP_SYSMON_FRAG_WARN) frag_warn_report = false; +#endif +} + +/** + * Refresh the shortcuts and windows. + */ +static void lv_app_sysmon_refr(void) +{ + + char buf_long[256]; + char buf_short[128]; +#if USE_IDLE != 0 + sprintf(buf_long, "CPU: %d %%\n\n", cpu_pct[LV_APP_SYSMON_PNUM - 1]); + sprintf(buf_short, "CPU: %d %%\n", cpu_pct[LV_APP_SYSMON_PNUM - 1]); +#else + strcpy(buf_long, "CPU: N/A\n\n"); + strcpy(buf_short, "CPU: N/A\n"); +#endif + +#if USE_DYN_MEM != 0 && DM_CUSTOM == 0 + sprintf(buf_long, "%sMEMORY: %d %%\nTotal: %d bytes\nUsed: %d bytes\nFree: %d bytes\nFrag: %d %%", + buf_long, + mem_pct[LV_APP_SYSMON_PNUM - 1], + mem_mon.size_total, + mem_mon.size_total - mem_mon.size_free, mem_mon.size_free, mem_mon.pct_frag); + + sprintf(buf_short, "%sMem: %d %%\nFrag: %d %%\n", + buf_short, mem_pct[LV_APP_SYSMON_PNUM - 1], mem_mon.pct_frag); +#else + sprintf(buf_long, "%sMEMORY: N/A", buf_long); + sprintf(buf_short, "%sMem: N/A\nFrag: N/A", buf_short); +#endif + lv_app_style_t * app_style = lv_app_style_get(); + cord_t opad = app_style->win_style.pages.scrl_rects.opad; + lv_app_inst_t * app; + app = lv_app_get_next(NULL, &my_app_dsc); + while(app != NULL) { + /*Refresh the windows*/ + my_win_data_t * win_data = app->win_data; + if(win_data != NULL) { + lv_label_set_text(win_data->label, buf_long); + lv_obj_align(win_data->label, win_data->chart, LV_ALIGN_OUT_RIGHT_TOP, opad, 0); + + lv_chart_set_next(win_data->chart, win_data->mem_dl, mem_pct[LV_APP_SYSMON_PNUM - 1]); + lv_chart_set_next(win_data->chart, win_data->cpu_dl, cpu_pct[LV_APP_SYSMON_PNUM - 1]); + + } + /*Refresh the shortcut*/ + my_sc_data_t * sc_data = app->sc_data; + if(sc_data != NULL) { + lv_pb_set_value(sc_data->pb_cpu, cpu_pct[LV_APP_SYSMON_PNUM - 1]); + lv_pb_set_value(sc_data->pb_mem, mem_pct[LV_APP_SYSMON_PNUM - 1]); + } + + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, buf_short, strlen(buf_short)); + + app = lv_app_get_next(app, &my_app_dsc); + } +} +#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_SYSMON != 0*/ diff --git a/lv_appx/lv_app_sysmon.h b/lv_appx/lv_app_sysmon.h new file mode 100644 index 000000000..3f6a83fa2 --- /dev/null +++ b/lv_appx/lv_app_sysmon.h @@ -0,0 +1,39 @@ +/** + * @file lv_app_example.h + * + */ + +#ifndef LV_APP_SYSMON_H +#define LV_APP_SYSMON_H + +/********************* + * INCLUDES + *********************/ +#include "lvgl/lv_app/lv_app.h" + +#if LV_APP_ENABLE != 0 && USE_LV_APP_SYSMON != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +typedef struct +{ + +}lv_app_sysmon_conf_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ +const lv_app_dsc_t * lv_app_sysmon_init(void); + +/********************** + * MACROS + **********************/ + +#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_SYSMON != 0*/ + +#endif /* LV_APP_SYSMON_H */ diff --git a/lv_appx/lv_app_terminal.c b/lv_appx/lv_app_terminal.c new file mode 100644 index 000000000..ce429f14f --- /dev/null +++ b/lv_appx/lv_app_terminal.c @@ -0,0 +1,446 @@ +/** + * @file lv_app_terminal.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "lv_app_terminal.h" +#if LV_APP_ENABLE != 0 && USE_LV_APP_TERMINAL != 0 + +#include "lvgl/lv_app/lv_app_util/lv_app_kb.h" +#include + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Application specific data for an instance of this application*/ +typedef struct +{ + char txt[LV_APP_TERMINAL_LENGTH + 1]; + lv_app_com_type_t com_type; + lv_app_inst_t * last_sender; +}my_app_data_t; + +/*Application specific data a window of this application*/ +typedef struct +{ + lv_obj_t * label; + lv_obj_t * ta; + lv_obj_t * com_type_btn; + lv_obj_t * clear_btn; +}my_win_data_t; + +/*Application specific data for a shortcut of this application*/ +typedef struct +{ + lv_obj_t * label; +}my_sc_data_t; + +/********************** + * STATIC PROTOTYPES + **********************/ +static void my_app_run(lv_app_inst_t * app, void * conf); +static void my_app_close(lv_app_inst_t * app); +static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, lv_app_com_type_t type , const void * data, uint32_t size); +static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc); +static void my_sc_close(lv_app_inst_t * app); +static void my_win_open(lv_app_inst_t * app, lv_obj_t * win); +static void my_win_close(lv_app_inst_t * app); + +static void add_data(lv_app_inst_t * app, const void * data, uint16_t data_len); +static lv_action_res_t win_ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi); +static lv_action_res_t win_comch_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); +static lv_action_res_t win_clear_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); +static void win_ta_kb_ok_action(lv_obj_t * ta); + +/********************** + * STATIC VARIABLES + **********************/ +static lv_app_dsc_t my_app_dsc = +{ + .name = "Terminal", + .mode = LV_APP_MODE_NONE, + .app_run = my_app_run, + .app_close = my_app_close, + .com_rec = my_com_rec, + .win_open = my_win_open, + .win_close = my_win_close, + .sc_open = my_sc_open, + .sc_close = my_sc_close, + .app_data_size = sizeof(my_app_data_t), + .sc_data_size = sizeof(my_sc_data_t), + .win_data_size = sizeof(my_win_data_t), +}; + +const char * com_type_txt [LV_APP_COM_TYPE_NUM]; +lv_objs_t sc_txt_bgs; +lv_labels_t sc_txts; + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +/** + * Initialize the application + * @return pointer to the application descriptor of this application + */ +const lv_app_dsc_t * lv_app_terminal_init(void) +{ + com_type_txt[LV_APP_COM_TYPE_INT] = "Ch: Num"; + com_type_txt[LV_APP_COM_TYPE_CHAR] = "Ch: Chars"; + com_type_txt[LV_APP_COM_TYPE_LOG] = "Ch: Log"; + com_type_txt[LV_APP_COM_TYPE_INV] = "Ch: None"; + + lv_app_style_t * app_style = lv_app_style_get(); + + memcpy(&sc_txts, &app_style->sc_txt_style, sizeof(lv_labels_t)); + sc_txts.line_space = 0; + sc_txts.letter_space = 0; + sc_txts.mid = 0; + sc_txts.objs.color = COLOR_WHITE; + + lv_objs_get(LV_OBJS_DEF, &sc_txt_bgs); + sc_txt_bgs.color = COLOR_MAKE(0x20, 0x20, 0x20); + + + return &my_app_dsc; +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +/** + * Run an application according to 'app_dsc' + * @param app_dsc pointer to an application descriptor + * @param conf pointer to a lv_app_example_conf_t structure with configuration data or NULL if unused + * @return pointer to the opened application or NULL if any error occurred + */ +static void my_app_run(lv_app_inst_t * app, void * conf) +{ + /*Initialize the application*/ + my_app_data_t * app_data = app->app_data; + app_data->com_type = LV_APP_COM_TYPE_CHAR; + app_data->last_sender = NULL; + memset(app_data->txt, 0, sizeof(app_data->txt)); +} + +/** + * Close a running application. + * Close the Window and the Shortcut too if opened. + * Free all the allocated memory by this application. + * @param app pointer to an application + */ +static void my_app_close(lv_app_inst_t * app) +{ + /*No dynamically allocated data in 'my_app_data'*/ +} + +/** + * Read the data have been sent to this applicationstring + * @param app_send pointer to an application which sent the message + * @param app_rec pointer to an application which is receiving the message + * @param type type of data from 'lv_app_com_type_t' enum + * @param data pointer to the sent data + * @param size length of 'data' in bytes + */ +static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, + lv_app_com_type_t type , const void * data, uint32_t size) +{ + my_app_data_t * app_data = app_rec->app_data; + + /*Add the recevied data if the type is matches*/ + if(type == app_data->com_type) { + + /*Insert the name of the sender application if it is not the last*/ + if(app_data->last_sender != app_send) { + if(app_data->txt[0] != '\0') add_data(app_rec, "\n", 1); + add_data(app_rec, "@", 1); + add_data(app_rec, app_send->name, strlen(app_send->name)); + add_data(app_rec, "\n", 1); + } + add_data(app_rec, data, size); + } + + app_data->last_sender = app_send; +} + +/** + * Open a shortcut for an application + * @param app pointer to an application + * @param sc pointer to an object where the application + * can create content of the shortcut + */ +static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc) +{ + my_sc_data_t * sc_data = app->sc_data; + my_app_data_t * app_data = app->app_data; + + /*Create a dark background*/ + lv_obj_t * txt_bg = lv_obj_create(sc, NULL); + lv_obj_set_size(txt_bg, 7 * LV_APP_SC_WIDTH / 8 , app->sc->cords.y2 - app->sc_title->cords.y2 - 10 * LV_DOWNSCALE); + lv_obj_set_style(txt_bg, &sc_txt_bgs); + lv_obj_align(txt_bg, app->sc_title, LV_ALIGN_OUT_BOTTOM_MID, 0, 3 * LV_DOWNSCALE); + lv_obj_set_click(txt_bg, false); + + /*Add a text with the text of the terminal*/ + sc_data->label = lv_label_create(txt_bg, NULL); + lv_obj_set_style(sc_data->label, &sc_txts); + lv_label_set_long_mode(sc_data->label, LV_LABEL_LONG_BREAK); + lv_obj_set_width(sc_data->label, lv_obj_get_width(txt_bg) - LV_APP_SC_WIDTH / 8); + lv_label_set_text_static(sc_data->label, app_data->txt); + lv_obj_align(sc_data->label, txt_bg, LV_ALIGN_IN_BOTTOM_MID, 0, 0); +} + +/** + * Close the shortcut of an application + * @param app pointer to an application + */ +static void my_sc_close(lv_app_inst_t * app) +{ + /*No dynamically allocated data in 'my_sc_data'*/ +} + +/** + * Open the application in a window + * @param app pointer to an application + * @param win pointer to a window object where + * the application can create content + */ +static void my_win_open(lv_app_inst_t * app, lv_obj_t * win) +{ + my_win_data_t * win_data = app->win_data; + my_app_data_t * app_data = app->app_data; + lv_app_style_t * app_style = lv_app_style_get(); + + cord_t opad = app_style->win_style.pages.scrl_rects.opad; + + /*Create a label for the text of the terminal*/ + win_data->label = lv_label_create(win, NULL); + lv_label_set_long_mode(win_data->label, LV_LABEL_LONG_BREAK); + lv_obj_set_width(win_data->label, LV_HOR_RES - + 2 * (app_style->win_style.pages.bg_rects.hpad + + app_style->win_style.pages.scrl_rects.hpad)); + + lv_obj_set_style(win_data->label, &app_style->win_txt_style); + lv_label_set_text_static(win_data->label, app_data->txt); /*Use the app. data text directly*/ + + /*Create a text area. Text can be added to the terminal from here by app. keyboard.*/ + win_data->ta = lv_ta_create(win, NULL); + lv_obj_set_size(win_data->ta, LV_HOR_RES / 2, LV_VER_RES / 4); + lv_obj_set_free_p(win_data->ta, app); + lv_page_set_rel_action(win_data->ta, win_ta_rel_action); + lv_ta_set_text(win_data->ta, ""); + lv_obj_set_style(win_data->ta, lv_tas_get(LV_TAS_DEF, NULL)); + lv_obj_align(win_data->ta, win_data->label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, opad); + + + /*Create a button to set the communication type (char, integer etc.)*/ + win_data->com_type_btn = lv_btn_create(win, NULL); + lv_rect_set_fit(win_data->com_type_btn, true, true); + lv_obj_set_free_p(win_data->com_type_btn, app); + lv_btn_set_rel_action(win_data->com_type_btn, win_comch_rel_action); + lv_obj_t * btn_label = lv_label_create(win_data->com_type_btn, NULL); + lv_obj_set_style(btn_label, lv_labels_get(LV_LABELS_BTN, NULL)); + lv_label_set_text(btn_label, com_type_txt[app_data->com_type]); + lv_obj_align(win_data->com_type_btn, win_data->ta, LV_ALIGN_OUT_RIGHT_TOP, opad, 0); + + + /*Create a clear button*/ + win_data->clear_btn = lv_btn_create(win, win_data->com_type_btn); + lv_btn_set_rel_action(win_data->clear_btn, win_clear_rel_action); + btn_label = lv_label_create(win_data->clear_btn, NULL); + lv_obj_set_style(btn_label, lv_labels_get(LV_LABELS_BTN, NULL)); + lv_label_set_text(btn_label, "Clear"); + lv_obj_align(win_data->clear_btn, win_data->com_type_btn, LV_ALIGN_OUT_RIGHT_TOP, opad, 0); + + /*Align the window to see the text area on the bottom*/ + lv_obj_align(lv_page_get_scrl(app->win), NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, + - app_style->win_style.pages.scrl_rects.vpad); + +} + +/** + * Close the window of an application + * @param app pointer to an application + */ +static void my_win_close(lv_app_inst_t * app) +{ + +} + +/*-------------------- + * OTHER FUNCTIONS + ---------------------*/ + +/** + * Called when the Text area is released to open the app. keybard + * @param ta pointer to the text area + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_OK because the text area is not deleted + */ +static lv_action_res_t win_ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi) +{ + lv_app_kb_open(ta, LV_APP_KB_MODE_TXT, NULL, win_ta_kb_ok_action); + + return LV_ACTION_RES_OK; +} + +/** + * Called when the communication type button is released to change the type + * @param btn pointer to the comm. type button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_OK because the button is not deleted + */ +static lv_action_res_t win_comch_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(btn); + my_app_data_t * app_data = app->app_data; + my_win_data_t * win_data = app->win_data; + + if(app_data->com_type == LV_APP_COM_TYPE_CHAR) app_data->com_type = LV_APP_COM_TYPE_LOG; + else if(app_data->com_type == LV_APP_COM_TYPE_LOG) app_data->com_type = LV_APP_COM_TYPE_INT; + else if(app_data->com_type == LV_APP_COM_TYPE_INT) app_data->com_type = LV_APP_COM_TYPE_INV; + else app_data->com_type = LV_APP_COM_TYPE_CHAR; + + lv_label_set_text(lv_obj_get_child(win_data->com_type_btn, NULL), com_type_txt[app_data->com_type]); + return LV_ACTION_RES_OK; +} + +/** + * Called when the Clear button is released to clear the ex od the terminal + * @param btn pointer to the clear button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_OK because the button is not deleted + */ +static lv_action_res_t win_clear_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +{ + lv_app_inst_t * app = lv_obj_get_free_p(btn); + my_app_data_t * app_data = app->app_data; + my_win_data_t * win_data = app->win_data; + my_sc_data_t * sc_data = app->sc_data; + + app_data->txt[0] = '\0'; + + if(sc_data != NULL) { + lv_label_set_text_static(sc_data->label, app_data->txt); + lv_obj_align(sc_data->label, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); + } + + if(win_data != NULL) { + lv_app_style_t * app_style =lv_app_style_get(); + cord_t opad = app_style->win_style.pages.scrl_rects.opad; + lv_label_set_text_static(win_data->label, app_data->txt); + lv_obj_align(win_data->ta, win_data->label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, opad); + lv_obj_align(win_data->com_type_btn, win_data->ta, LV_ALIGN_OUT_RIGHT_TOP, opad, 0); + lv_obj_align(win_data->clear_btn, win_data->com_type_btn, LV_ALIGN_OUT_RIGHT_TOP, opad, 0); + lv_obj_align(lv_page_get_scrl(app->win), NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, + - app_style->win_style.pages.scrl_rects.vpad); + } + + return LV_ACTION_RES_OK; +} + +/** + * Called when the 'Ok' button of the keyboard in the window + * is pressed to write to the Terminal + * @param ta pointer to the Text area in the window + */ +static void win_ta_kb_ok_action(lv_obj_t * ta) +{ + lv_app_inst_t * app = lv_obj_get_free_p(ta); + my_app_data_t * app_data = app->app_data; + const char * ta_txt = lv_ta_get_txt(ta); + uint32_t ta_txt_len = strlen(ta_txt); + if(app_data->txt[0] != '\0') add_data(app, "\n", 1); + add_data(app, ">", 1); + add_data(app, ta_txt, ta_txt_len); + + lv_app_com_send(app, app_data->com_type, ta_txt, ta_txt_len); + + lv_ta_set_text(ta, ""); +} + +/** + * Add data to the terminal + * @param app pointer to a Terminal application + * @param data pointer to the data + * @param data_len length of 'data' in bytes + */ +static void add_data(lv_app_inst_t * app, const void * data, uint16_t data_len) +{ + my_app_data_t * app_data = app->app_data; + uint16_t old_len = strlen(app_data->txt); + const char * txt = data; + + /*IF the data is longer then the terminal ax size show the last part of data*/ + if(data_len > LV_APP_TERMINAL_LENGTH) { + txt += (data_len - LV_APP_TERMINAL_LENGTH); + data_len = LV_APP_TERMINAL_LENGTH; + old_len = 0; + } + /*If the text become too long 'forget' the oldest lines*/ + else if(old_len + data_len > LV_APP_TERMINAL_LENGTH) { + uint16_t new_start; + for(new_start = 0; new_start < old_len; new_start++) { + if(app_data->txt[new_start] == '\n') { + /*If there is enough space break*/ + if(new_start >= data_len) { + /*Ignore line breaks*/ + while(app_data->txt[new_start] == '\n' || app_data->txt[new_start] == '\r') new_start++; + break; + } + } + } + + /* If it wasn't able to make enough space on line breaks + * simply forget the oldest characters*/ + if(new_start == old_len) { + new_start = old_len - (LV_APP_TERMINAL_LENGTH - data_len); + } + /*Move the remaining text to the beginning*/ + uint16_t j; + for(j = new_start; j < old_len; j++) { + app_data->txt[j - new_start] = app_data->txt[j]; + } + old_len = old_len - new_start; + app_data->txt[old_len] = '\0'; + + } + + memcpy(&app_data->txt[old_len], txt, data_len); + app_data->txt[old_len + data_len] = '\0'; + + my_win_data_t * win_data = app->win_data; + my_sc_data_t * sc_data = app->sc_data; + lv_app_style_t * app_style = lv_app_style_get(); + + if(win_data != NULL) { + cord_t opad = app_style->win_style.pages.scrl_rects.opad; + lv_label_set_text_static(win_data->label, app_data->txt); + lv_obj_align(win_data->ta, win_data->label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, opad); + lv_obj_align(win_data->com_type_btn, win_data->ta, LV_ALIGN_OUT_RIGHT_TOP, opad, 0); + lv_obj_align(win_data->clear_btn, win_data->com_type_btn, LV_ALIGN_OUT_RIGHT_TOP, opad, 0); + lv_obj_align(lv_page_get_scrl(app->win), NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, + - app_style->win_style.pages.scrl_rects.vpad); + } + + /*Set the last line on the shortcut*/ + if(sc_data != NULL) { + lv_label_set_text_static(sc_data->label, app_data->txt); + lv_obj_align(sc_data->label, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); + } +} + +#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_TERMINAL != 0*/ diff --git a/lv_appx/lv_app_terminal.h b/lv_appx/lv_app_terminal.h new file mode 100644 index 000000000..8043b5153 --- /dev/null +++ b/lv_appx/lv_app_terminal.h @@ -0,0 +1,39 @@ +/** + * @file lv_app_terminal.h + * + */ + +#ifndef LV_APP_TERMINAL_H +#define LV_APP_TERMINAL_H + +/********************* + * INCLUDES + *********************/ +#include "lvgl/lv_app/lv_app.h" + +#if LV_APP_ENABLE != 0 && USE_LV_APP_TERMINAL != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +typedef struct +{ + +}lv_app_terminal_conf_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ +const lv_app_dsc_t * lv_app_terminal_init(void); + +/********************** + * MACROS + **********************/ + +#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_TERMINAL != 0*/ + +#endif /* LV_APP_TERMINAL_H */ diff --git a/lv_conf_temp.h b/lv_conf_temp.h index 26b37debd..ceb00f110 100644 --- a/lv_conf_temp.h +++ b/lv_conf_temp.h @@ -3,12 +3,12 @@ * */ +#if 0 /*Remove this to enable the content (Delete the last #endif too!)*/ + #ifndef LV_CONF_H #define LV_CONF_H -#if 0 /*Remove this to enable the content*/ - -/*===================== +/*=================== Graphical settings *=====================*/ @@ -18,117 +18,200 @@ #define LV_VER_RES (320 * LV_DOWNSCALE) /* Buffered rendering: >= LV_DOWNSCALE * LV_HOR_RES or 0 to disable buffering*/ -#define LV_VDB_SIZE (LV_HOR_RES * LV_VER_RES / 20) -/* Anti-aliasing with downscaling everything - * 1: disabled - * 2: 2x anti-alias -> half size - * 4: 4x anti-alias -> quarter size */ -#define LV_DOWNSCALE 2 +#define LV_VDB_SIZE (LV_HOR_RES * (LV_VER_RES / 20)) -#define LV_UPSCALE_FONT 0 /*Scale up fonts to compensate LV_DOWNSCALE*/ -#define LV_UPSCALE_MAP 0 /*Scale up maps (e.g. images) elements to compensate LV_DOWNSCALE*/ -#define LV_UPSCALE_SYTLE 1 /*Scale up default styles to compensate LV_DOWNSCALE*/ +/* Enable antialaiassing + * If enabled everything will half-sized + * Use LV_DOWNSCALE to compensate + * the down scaling effect of antialiassing*/ +#define LV_ANTIALIAS 1 +/*Set the downscaling value*/ +#if LV_ANTIALIAS == 0 +#define LV_DOWNSCALE 1 +#else +#define LV_DOWNSCALE 2 +#endif -#define LV_REFR_PERIOD 50 /*Screen refresh period in milliseconds*/ +#define LV_REFR_PERIOD 40 /*Screen refresh period in milliseconds*/ #define LV_INV_FIFO_SIZE 32 /*The average number of objects on a screen */ /*================= Misc. setting *=================*/ /*Display Input settings*/ -#define LV_DISPI_READ_PERIOD 50 /*Input device read period milliseconds*/ -#define LV_DISPI_TP_MARKER 0 /*Mark the pressed points*/ -#define LV_DISPI_DRAG_LIMIT 10 /*Drag threshold in pixels */ -#define LV_DISPI_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */ -#define LV_DISPI_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/ +#define LV_DISPI_READ_PERIOD 50 /*Input device read period milliseconds*/ +#define LV_DISPI_TP_MARKER 0 /*Mark the pressed points*/ +#define LV_DISPI_DRAG_LIMIT 10 /*Drag threshold in pixels */ +#define LV_DISPI_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */ +#define LV_DISPI_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/ +#define LV_DISPI_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */ /*Coordinates*/ -#define LV_CORD_TYPE int16_t /*Coordinate type*/ +#define LV_CORD_TYPE int16_t /*Coordinate type*/ #define LV_CORD_MAX (32000) #define LV_CORD_MIN (-32000) /*Fonts and texts*/ +#define USE_FONT_DEJAVU_8 1 +#define USE_FONT_DEJAVU_10 1 #define USE_FONT_DEJAVU_14 1 #define USE_FONT_DEJAVU_20 1 #define USE_FONT_DEJAVU_30 1 #define USE_FONT_DEJAVU_40 1 #define USE_FONT_DEJAVU_60 1 #define USE_FONT_DEJAVU_80 1 -#define LV_FONT_DEFAULT FONT_DEJAVU_40 /*Always set a default font*/ -#define LV_TXT_BREAK_CHARS " ,.;-" /*Can break texts on these chars*/ +#define LV_FONT_DEFAULT FONT_DEJAVU_30 /*Always set a default font*/ +#define LV_TXT_BREAK_CHARS " ,.;-" /*Can break texts on these chars*/ /*lv_obj (base object) settings*/ -#define LV_OBJ_FREE_P 1 /*Enable the free pointer attribute*/ -#define LV_OBJ_DEF_SCR_COLOR COLOR_WHITE /*Default screen color*/ +#define LV_OBJ_FREE_P 1 /*Enable the free pointer attribute*/ +#define LV_OBJ_DEF_SCR_COLOR COLOR_SILVER /*Default screen color*/ + +/*Others*/ +#define LV_COLOR_TRANSP COLOR_LIME /*================== * LV OBJ X USAGE * ================*/ + +/*Rectangle (dependencies: -*/ #define USE_LV_RECT 1 +/*Label (dependencies: -*/ #define USE_LV_LABEL 1 #if USE_LV_LABEL != 0 -#define LV_LABEL_SCROLL_SPEED (25 * LV_DOWNSCALE) /*Hor, or ver. scroll speed (px/sec) in 'LV_LABEL_LONG_SCROLL' mode*/ +#define LV_LABEL_SCROLL_SPEED (25 * LV_DOWNSCALE) /*Hor, or ver. scroll speed (px/sec) in 'LV_LABEL_LONG_SCROLL' mode*/ #define LV_LABEL_SCROLL_SPEED_VER (10 * LV_DOWNSCALE) /*Ver. scroll speed if hor. scroll is applied too*/ -#define LV_LABEL_SCROLL_PLAYBACK_PAUSE 500 /*Wait before the scroll turns back in ms*/ -#define LV_LABEL_SCROLL_REPEAT_PAUSE 500 /*Wait before the scroll begins again in ms*/ +#define LV_LABEL_SCROLL_PLAYBACK_PAUSE 500 /*Wait before the scroll turns back in ms*/ +#define LV_LABEL_SCROLL_REPEAT_PAUSE 500 /*Wait before the scroll begins again in ms*/ #endif +/*Button (dependencies: lv_rect*/ #define USE_LV_BTN 1 +/*Line (dependencies: -*/ #define USE_LV_LINE 1 +/*Image (dependencies: from misc: FSINT, UFS)*/ #define USE_LV_IMG 1 #if USE_LV_IMG != 0 -#define LV_IMG_COLOR_TRANSP COLOR_LIME -#define LV_IMG_DEF_WALLPAPER img_bubbles_vflip +//#define LV_IMG_DEF_WALLPAPER img_wallpaper_var /*Comment this line to NOT use wallpaper*/ #endif /*USE_LV_IMG*/ +/*Page (dependencies: lv_rect)*/ #define USE_LV_PAGE 1 #if USE_LV_PAGE != 0 #define LV_PAGE_ANIM_FOCUS_TIME 300 /*List focus animation time [ms] (0: turn off the animation)*/ #endif -#define USE_LV_LED 1 +/*List (dependencies: lv_btn, lv_label, lv_img)*/ +#define USE_LV_LIST 1 -#define USE_LV_PB 1 +/*Check box (dependencies: lv_btn, lv_label)*/ +#define USE_LV_CB 1 -#define USE_LV_CB 1 +/*Progress bar (dependencies: lv_rect, lv_label)*/ +#define USE_LV_PB 1 -#define USE_LV_LIST 1 +/*LED (dependencies: lv_rect)*/ +#define USE_LV_LED 1 -#define USE_LV_BTNM 1 +/*Chart (dependencies: lv_rect, lv_line)*/ +#define USE_LV_CHART 1 -#define USE_LV_WIN 1 +/*Text area (dependencies: lv_label, lv_page)*/ +#define USE_LV_TA 1 +#if USE_LV_TA != 0 +#define LV_TA_MAX_LENGTH 256 +#define LV_TA_CUR_BLINK_TIME 400 /*ms*/ +#endif -#define USE_LV_TA 1 +/*Button matrix (dependencies: lv_rect, lv_label)*/ +#define USE_LV_BTNM 1 -#define USE_LV_MBOX 1 +/*Window (dependencies: lv_rect, lv_btn, lv_label, lv_img, lv_page)*/ +#define USE_LV_WIN 1 + +/*Message box (dependencies: lv_rect, lv_btn, lv_label)*/ +#define USE_LV_MBOX 1 /*================== * LV APP SETTINGS * =================*/ -#define LV_APP_SC_WIDTH (LV_HOR_RES / 4) -#define LV_APP_SC_HEIGHT (LV_VER_RES / 3) -#define LV_APP_USE_INTERNAL_ICONS 1 +/*Enable the application system*/ +#define LV_APP_ENABLE 1 -#define LV_APP_ANIM_WIN_OPEN 300 /*Animation time in milliseconds (0: turn off animation)*/ -#define LV_APP_ANIM_WIN_OPEN_COMPLEX 1 /*1: Make more complex animation on window open*/ -#define LV_APP_ANIM_WIN_MINIM 300 /*Animation time in milliseconds (0: turn off animation)*/ -#define LV_APP_ANIM_WIN_CLOSE 300 /*Animation time in milliseconds (0: turn off animation)*/ +#if LV_APP_ENABLE != 0 +#define LV_APP_SC_WIDTH (LV_HOR_RES / 4) /*Shortcut width*/ +#define LV_APP_SC_HEIGHT (LV_VER_RES / 3) /*Shortcut height*/ +#define LV_APP_FONT_SMALL FONT_DEJAVU_20 +#define LV_APP_FONT_MEDIUM LV_FONT_DEFAULT +#define LV_APP_FONT_LARGE FONT_DEJAVU_40 -/* If the internal icons are not used - * set others */ -#if LV_APP_USE_INTERNAL_ICONS == 0 +/* Internal icons: + * 0: Do not use internal icons (img_close, img_add etc. icons have to be provided) + * 1: Use simple sized icons + * 2: Use double sized icons*/ +#define LV_APP_USE_INTERNAL_ICONS 2 +/*Enable or disable the internal icons individually*/ +#if LV_APP_USE_INTERNAL_ICONS != 0 +#define USE_IMG_CLOSE 1 +#define USE_IMG_DOWN 1 +#define USE_IMG_DRIVER 1 +#define USE_IMG_FILE 1 +#define USE_IMG_FOLDER 1 +#define USE_IMG_LEFT 1 +#define USE_IMG_OK 1 +#define USE_IMG_RIGHT 1 +#define USE_IMG_UP 1 #endif +/*Animation settings*/ +#define LV_APP_EFFECT_OPA 1 /*Enable the opacity in the application style (can be modified)*/ +#define LV_APP_EFFECT_ANIM 1 /*Enable the animation of the applications*/ +#define LV_APP_EFFECT_OPA_ANIM 1 /*Enable the using opacity in the application animations*/ +#define LV_APP_ANIM_WIN 200 /*Animation time in milliseconds (0: turn off animation)*/ +#define LV_APP_ANIM_SC 200 /*Animation time in milliseconds (0: turn off animation)*/ +#define LV_APP_ANIM_NOTICE 300 /*How fast animate out a notice [ms]*/ + +/* App. utility settings */ +#define LV_APP_NOTICE_SHOW_TIME 4000 /*Notices will be shown for this time [ms]*/ +#define LV_APP_NOTICE_MAX_LEN 256 /*Max. number of characters on a notice*/ /*================== * LV APP X USAGE * ================*/ +#define USE_LV_APP_EXAMPLE 1 + +#define USE_LV_APP_SYSMON 1 +#if USE_LV_APP_SYSMON != 0 +#define LV_APP_SYSMON_REFR_TIME 500 /*[ms]*/ +#define LV_APP_SYSMON_PNUM 64 +#define LV_APP_SYSMON_MEM_WARN (4 * 1024) +#define LV_APP_SYSMON_FRAG_WARN (70) /*[%]*/ +#define LV_APP_SYSMON_DEFRAG_PERIOD (5000) /*[%]*/ +#endif /*USE_LV_APP_SYSMON != 0*/ + +#define USE_LV_APP_TERMINAL 1 +#if USE_LV_APP_TERMINAL != 0 +#define LV_APP_TERMINAL_LENGTH 512 /*Memory of the terminal*/ +#endif /*USE_LV_APP_TERMINAL != 0*/ + +#define USE_LV_APP_FILES 1 +#if USE_LV_APP_FILES != 0 +#define LV_APP_FILES_PAGE_SIZE 8 /*Max. number of files/folder on a page*/ +#define LV_APP_FILES_FN_MAX_LEN 128 +#define LV_APP_FILES_PATH_MAX_LEN 256 +#define LV_APP_FILES_CHUNK_DEF_SIZE 256 +#define LV_APP_FILES_CHUNK_DEF_TIME 100 +#define LV_APP_FILES_CHUNK_MAX_SIZE 1024 +#endif /*USE_LV_APP_FILES != 0*/ +#endif /*LV_APP_ENABLE != 0*/ + +#endif /*LV_CONF_H*/ + #endif /*Remove this to enable the content*/ -#endif diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index 6dba62280..e8f3fdfb6 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -31,11 +31,13 @@ /********************** * STATIC PROTOTYPES **********************/ +#if USE_LV_RECT != 0 static void lv_draw_rect_main_mid(const area_t * cords_p, const area_t * mask_p, const lv_rects_t * rects_p, opa_t opa); static void lv_draw_rect_main_corner(const area_t * cords_p, const area_t * mask_p, const lv_rects_t * rects_p, opa_t opa); static void lv_draw_rect_border_straight(const area_t * cords_p, const area_t * mask_p, const lv_rects_t * rects_p, opa_t opa); static void lv_draw_rect_border_corner(const area_t * cords_p, const area_t * mask_p, const lv_rects_t * rects_p, opa_t opa); static uint16_t lv_draw_rect_radius_corr(uint16_t r, cord_t w, cord_t h); +#endif /*USE_LV_RECT != 0*/ /********************** * STATIC VARIABLES @@ -51,6 +53,7 @@ static void (*map_fp)(const area_t * cords_p, const area_t * mask_p, const color #endif +#if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0 static lv_rects_t lv_img_no_pic_rects = { .objs.color = COLOR_BLACK, .gcolor = COLOR_BLACK, .bcolor = COLOR_RED, .bwidth = 2 * LV_DOWNSCALE, .bopa = 100, @@ -62,6 +65,7 @@ static lv_labels_t lv_img_no_pic_labels = { .letter_space = 1 * LV_DOWNSCALE, .line_space = 1 * LV_DOWNSCALE, .mid = 1, }; +#endif /********************** * MACROS @@ -70,6 +74,8 @@ static lv_labels_t lv_img_no_pic_labels = { /********************** * GLOBAL FUNCTIONS **********************/ + +#if USE_LV_RECT != 0 /** * Draw a rectangle * @param cords_p the coordinates of the rectangle @@ -98,7 +104,9 @@ void lv_draw_rect(const area_t * cords_p, const area_t * mask_p, } } } +#endif /*USE_LV_RECT != 0*/ +#if USE_LV_LABEL != 0 /** * Write a text * @param cords_p coordinates of the label @@ -156,7 +164,9 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, } } +#endif /* USE_LV_LABEL != 0*/ +#if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0 /** * Draw an image * @param cords_p the coordinates of the image @@ -178,21 +188,6 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p, color_t buf[LV_HOR_RES]; uint32_t br; area_t act_area; - uint8_t ds_shift = 0; - uint8_t ds_num = 0; - #if LV_DOWNSCALE <= 1 || LV_UPSCALE_MAP == 0 - ds_shift = 0; - ds_num = 1; - #elif LV_DOWNSCALE == 2 - ds_shift = 1; - ds_num = 2; - #elif LV_DOWNSCALE == 4 - ds_shift = 2; - ds_num = 4; - #else - #error "LV: not supported LV_DOWNSCALE value" - #endif - area_t mask_sub; bool union_ok; @@ -205,32 +200,28 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p, res = fs_read(&file, &header, sizeof(lv_img_raw_header_t), &br); uint32_t start_offset = sizeof(lv_img_raw_header_t); - start_offset += (area_get_width(cords_p) >> ds_shift) * - ((mask_sub.y1 - cords_p->y1) >> ds_shift) * sizeof(color_t); /*First row*/ - start_offset += ((mask_sub.x1 - cords_p->x1) >> ds_shift) * sizeof(color_t); /*First col*/ + start_offset += area_get_width(cords_p) * + (mask_sub.y1 - cords_p->y1) * sizeof(color_t); /*First row*/ + start_offset += (mask_sub.x1 - cords_p->x1) * sizeof(color_t); /*First col*/ fs_seek(&file, start_offset); - uint32_t useful_data = (area_get_width(&mask_sub) >> ds_shift) * sizeof(color_t); - uint32_t next_row = (area_get_width(cords_p) >> ds_shift) * sizeof(color_t) - useful_data; + uint32_t useful_data = area_get_width(&mask_sub) * sizeof(color_t); + uint32_t next_row = area_get_width(cords_p) * sizeof(color_t) - useful_data; area_cpy(&act_area, &mask_sub); - /* Round down the start coordinate, because the upscaled images - * can start only LV_DOWNSCALE 'y' coordinates */ - act_area.y1 &= ~(cord_t)(ds_num - 1) ; - act_area.y2 = act_area.y1 + ds_num - 1; + act_area.y2 = act_area.y1; uint32_t act_pos; - for(row = mask_sub.y1; row <= mask_sub.y2; row += ds_num) { + for(row = mask_sub.y1; row <= mask_sub.y2; row ++) { res = fs_read(&file, buf, useful_data, &br); map_fp(&act_area, &mask_sub, buf, opa, header.transp, imgs_p->objs.color, imgs_p->recolor_opa); fs_tell(&file, &act_pos); fs_seek(&file, act_pos + next_row); - act_area.y1 += ds_num; - act_area.y2 += ds_num; + act_area.y1 ++; + act_area.y2 ++; } - } fs_close(&file); @@ -241,8 +232,9 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p, } } +#endif /*USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0*/ - +#if USE_LV_LINE != 0 /** * Draw a line * @param p1 first point of the line @@ -258,9 +250,9 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, if(p1->x == p2->x && p1->y == p2->y) return; - cord_t dx = abs(p2->x - p1->x); + cord_t dx = MATH_ABS(p2->x - p1->x); cord_t sx = p1->x < p2->x ? 1 : -1; - cord_t dy = abs(p2->y - p1->y); + cord_t dy = MATH_ABS(p2->y - p1->y); cord_t sy = p1->y < p2->y ? 1 : -1; cord_t err = (dx > dy ? dx : -dy) / 2; cord_t e2; @@ -370,11 +362,13 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, fill_fp(&draw_area, mask_p, lines_p->objs.color, opa); } } +#endif /*USE_LV_LINE != 0*/ /********************** * STATIC FUNCTIONS **********************/ +#if USE_LV_RECT != 0 /** * Draw the middle part (rectangular) of a rectangle * @param cords_p the coordinates of the original rectangle @@ -862,3 +856,6 @@ static uint16_t lv_draw_rect_radius_corr(uint16_t r, cord_t w, cord_t h) return r; } + +#endif /*USE_LV_RECT != 0*/ + diff --git a/lv_draw/lv_draw.h b/lv_draw/lv_draw.h index 9b2af6f6f..ece7a29fc 100644 --- a/lv_draw/lv_draw.h +++ b/lv_draw/lv_draw.h @@ -15,6 +15,8 @@ #include "../lv_objx/lv_img.h" #include "../lv_objx/lv_label.h" +#include "misc_conf.h" + /********************* * DEFINES *********************/ @@ -26,14 +28,25 @@ /********************** * GLOBAL PROTOTYPES **********************/ +#if USE_LV_RECT != 0 void lv_draw_rect(const area_t * cords_p, const area_t * mask_p, const lv_rects_t * rects_p, opa_t opa); +#endif + +#if USE_LV_LABEL != 0 void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_labels_t * labels_p, opa_t opa, const char * txt); +#endif + +#if USE_LV_LINE != 0 void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, const lv_lines_t * lines_p, opa_t opa); +#endif + +#if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0 void lv_draw_img(const area_t * cords_p, const area_t * mask_p, const lv_imgs_t * imgs_p, opa_t opa, const char * fn); +#endif /********************** * MACROS **********************/ diff --git a/lv_draw/lv_draw_rbasic.c b/lv_draw/lv_draw_rbasic.c index 74508df99..06eda9a3d 100644 --- a/lv_draw/lv_draw_rbasic.c +++ b/lv_draw/lv_draw_rbasic.c @@ -136,7 +136,7 @@ void lv_rmap(const area_t * cords_p, const area_t * mask_p, map_p += map_width; } }else { - color_t transp_color = LV_IMG_COLOR_TRANSP; + color_t transp_color = LV_COLOR_TRANSP; cord_t row; for(row = 0; row < area_get_height(&masked_a); row++) { cord_t col; diff --git a/lv_draw/lv_draw_vbasic.c b/lv_draw/lv_draw_vbasic.c index 73b7c5dff..9308e9cbf 100644 --- a/lv_draw/lv_draw_vbasic.c +++ b/lv_draw/lv_draw_vbasic.c @@ -160,7 +160,6 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p, col_bit = 7; col_byte_cnt ++; map_p ++; - } } @@ -192,25 +191,14 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, /*If there are common part of the three area then draw to the vdb*/ if(union_ok == false) return; - - uint8_t ds_shift = 0; -#if LV_DOWNSCALE <= 1 || LV_UPSCALE_MAP == 0 - ds_shift = 0; -#elif LV_DOWNSCALE == 2 - ds_shift = 1; -#elif LV_DOWNSCALE == 4 - ds_shift = 2; -#else -#error "LV: not supported LV_DOWNSCALE value" -#endif /*If the map starts OUT of the masked area then calc. the first pixel*/ - cord_t map_width = area_get_width(cords_p) >> ds_shift; + cord_t map_width = area_get_width(cords_p); if(cords_p->y1 < masked_a.y1) { - map_p += (uint32_t) map_width * ((masked_a.y1 - cords_p->y1) >> ds_shift); + map_p += (uint32_t) map_width * (masked_a.y1 - cords_p->y1); } if(cords_p->x1 < masked_a.x1) { - map_p += (masked_a.x1 - cords_p->x1) >> ds_shift; + map_p += (masked_a.x1 - cords_p->x1); } /*Stores coordinates relative to the act vdb*/ @@ -223,32 +211,9 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, color_t * vdb_buf_tmp = vdb_p->buf; vdb_buf_tmp += (uint32_t) vdb_width * masked_a.y1; /*Move to the first row*/ - map_p -= (masked_a.x1 >> ds_shift); + map_p -= masked_a.x1; -#if LV_DOWNSCALE > 1 && LV_UPSCALE_MAP != 0 - cord_t row; - cord_t col; - cord_t row_cnt = 0; - color_t transp_color = LV_IMG_COLOR_TRANSP; - color_t color_tmp; - cord_t map_i; - map_p -= map_width; /*Compensate the first row % LV_DOWNSCALE*/ - for(row = masked_a.y1, row_cnt = 0; row <= masked_a.y2; row++, row_cnt ++) { - if(row_cnt % LV_DOWNSCALE == 0) map_p += map_width; /*Next row on the map*/ - map_i = masked_a.x1 >> ds_shift; - map_i--; /*Compensate the first col % LV_DOWNSCALE*/ - for(col = masked_a.x1; col <= masked_a.x2; col++) { - if(col % LV_DOWNSCALE == 0) { - map_i++; - color_tmp = map_p[map_i];//color_mix(recolor, map_p[map_i], recolor_opa); - } - if(transp == false || map_p[map_i].full != transp_color.full) { - vdb_buf_tmp[col] = color_tmp;//color_mix(color_tmp, vdb_buf_tmp[col], opa); - } - } - vdb_buf_tmp += vdb_width; /*Next row on the VDB*/ - } -#else + /*No transparent pixels on the image*/ if(transp == false) { /*Simply copy the pixels to the VDB*/ cord_t row; @@ -279,7 +244,7 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, } else { /*transp == true: Check all pixels */ cord_t row; cord_t col; - color_t transp_color = LV_IMG_COLOR_TRANSP; + color_t transp_color = LV_COLOR_TRANSP; if(recolor_opa == OPA_TRANSP)/*No recolor*/ { @@ -294,7 +259,7 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, map_p += map_width; /*Next row on the map*/ vdb_buf_tmp += vdb_width; /*Next row on the VDB*/ } - } else { + } else { /*Image opacity ut no recolor*/ for(row = masked_a.y1; row <= masked_a.y2; row++) { for(col = masked_a.x1; col <= masked_a.x2; col ++) { if(map_p[col].full != transp_color.full) { @@ -320,7 +285,7 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, map_p += map_width; /*Next row on the map*/ vdb_buf_tmp += vdb_width; /*Next row on the VDB*/ } - } else { + } else { /*Image opacity with recolor*/ for(row = masked_a.y1; row <= masked_a.y2; row++) { for(col = masked_a.x1; col <= masked_a.x2; col ++) { if(map_p[col].full != transp_color.full) { @@ -333,10 +298,8 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, vdb_buf_tmp += vdb_width; /*Next row on the VDB*/ } } - } } -#endif /*No upscale and no downscale*/ } @@ -344,9 +307,4 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, * STATIC FUNCTIONS **********************/ - #endif - - - - diff --git a/lv_icon/x1/img_close.c b/lv_icon/x1/img_close.c new file mode 100644 index 000000000..677bd9885 --- /dev/null +++ b/lv_icon/x1/img_close.c @@ -0,0 +1,31 @@ +#include "img_conf.h" +#include "lv_conf.h" + +#if USE_IMG_CLOSE != 0 && LV_APP_USE_INTERNAL_ICONS == 1 + +#include +#include "misc/others/color.h" + +const color_int_t img_close [] = { /*Width = 14, Height = 15*/ +14, /*Width*/ +15, /*Heigth*/ +16, /*Color depth = 16*/ +1, /*Flags: Transp = 1*/ +2016, 6339, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 4258, 2016, +6371, 0, 32, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2113, 0, 4226, +10597, 0, 0, 0, 2016, 2016, 2016, 2016, 2016, 2016, 32, 0, 0, 8452, +2016, 10597, 0, 0, 0, 2016, 2016, 2016, 2016, 32, 0, 0, 8452, 2016, +2016, 2016, 10597, 0, 0, 0, 2016, 2016, 32, 0, 0, 8452, 2016, 2016, +2016, 2016, 2016, 10565, 0, 0, 32, 2113, 0, 0, 6339, 2016, 2016, 2016, +2016, 2016, 2016, 2016, 10597, 0, 0, 0, 0, 8452, 2016, 2016, 2016, 2016, +2016, 2016, 2016, 2016, 2016, 0, 0, 0, 0, 35953, 2016, 2016, 2016, 2016, +2016, 2016, 2016, 2016, 32, 0, 0, 0, 0, 0, 2016, 2016, 2016, 2016, +2016, 2016, 2016, 2113, 0, 0, 6339, 8484, 0, 0, 32, 2016, 2016, 2016, +2016, 2016, 32, 0, 0, 8452, 2016, 2016, 10597, 0, 0, 0, 2016, 2016, +2016, 32, 0, 0, 8452, 2016, 2016, 2016, 2016, 10597, 0, 0, 0, 2016, +2113, 0, 0, 6339, 2016, 2016, 2016, 2016, 2016, 2016, 10565, 0, 0, 32, +19049, 0, 8452, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 14823, +2016, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 2016, +}; + +#endif diff --git a/lv_icon/x1/img_down.c b/lv_icon/x1/img_down.c new file mode 100644 index 000000000..66f46ade8 --- /dev/null +++ b/lv_icon/x1/img_down.c @@ -0,0 +1,26 @@ +#include "img_conf.h" +#include "lv_conf.h" + +#if USE_IMG_DOWN != 0 && LV_APP_USE_INTERNAL_ICONS == 1 + +#include +#include "misc/others/color.h" + +const color_int_t img_down [] = { /*Width = 15, Height = 10*/ +15, /*Width*/ +10, /*Heigth*/ +16, /*Color depth = 16*/ +1, /*Flags: Transp = 1*/ +2016, 2016, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33840, 2016, 2016, +2016, 12710, 0, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 4226, 0, 35953, 2016, +14791, 0, 0, 0, 19049, 2016, 2016, 2016, 2016, 2016, 4226, 0, 0, 0, 35953, +10565, 0, 0, 0, 0, 16936, 2016, 2016, 2016, 2145, 0, 0, 0, 0, 29614, +2016, 8484, 0, 0, 0, 0, 19049, 2016, 4226, 0, 0, 0, 0, 29582, 2016, +2016, 2016, 10565, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31695, 2016, 2016, +2016, 2016, 2016, 8484, 0, 0, 0, 0, 0, 0, 0, 29582, 2016, 2016, 2016, +2016, 2016, 2016, 2016, 8484, 0, 0, 0, 0, 0, 29582, 2016, 2016, 2016, 2016, +2016, 2016, 2016, 2016, 2016, 8484, 0, 0, 0, 29582, 2016, 2016, 2016, 2016, 2016, +2016, 2016, 2016, 2016, 2016, 2016, 8484, 0, 29582, 2016, 2016, 2016, 2016, 2016, 2016, +}; + +#endif diff --git a/lv_icon/x1/img_driver.c b/lv_icon/x1/img_driver.c new file mode 100644 index 000000000..88eba73a6 --- /dev/null +++ b/lv_icon/x1/img_driver.c @@ -0,0 +1,30 @@ +#include "img_conf.h" +#include "lv_conf.h" + +#if USE_IMG_DRIVER != 0 && LV_APP_USE_INTERNAL_ICONS == 1 + +#include +#include "misc/others/color.h" + +const color_int_t img_driver [] = { /*Width = 16, Height = 14*/ +16, /*Width*/ +14, /*Heigth*/ +16, /*Color depth = 16*/ +1, /*Flags: Transp = 1*/ +2016, 2016, 2016, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 2016, 2016, 2016, +2016, 2016, 2016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33808, 2016, 2016, +2016, 2016, 14823, 2113, 44373, 44373, 44373, 44373, 44373, 44373, 44373, 44373, 6339, 8452, 2016, 2016, +2016, 2016, 0, 23275, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 27469, 0, 2016, 2016, +2016, 29614, 0, 46518, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 48599, 0, 23275, 2016, +2016, 4258, 4258, 65503, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65503, 4226, 2113, 2016, +2016, 0, 27501, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 23243, 0, 40147, +21130, 0, 50744, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 44373, 0, 12710, +4226, 0, 21162, 21162, 21162, 57083, 65535, 65535, 65535, 65535, 61309, 21162, 21162, 19017, 0, 0, +2145, 0, 0, 0, 0, 23275, 65535, 65535, 65535, 65535, 31695, 0, 0, 0, 0, 0, +2145, 0, 0, 0, 0, 32, 21162, 21162, 21162, 21162, 2145, 0, 0, 0, 0, 0, +2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +#endif diff --git a/lv_icon/x1/img_file.c b/lv_icon/x1/img_file.c new file mode 100644 index 000000000..222a5a5c0 --- /dev/null +++ b/lv_icon/x1/img_file.c @@ -0,0 +1,32 @@ +#include "img_conf.h" +#include "lv_conf.h" + +#if USE_IMG_FILE != 0 && LV_APP_USE_INTERNAL_ICONS == 1 + +#include +#include "misc/others/color.h" + +const color_int_t img_file [] = { /*Width = 12, Height = 16*/ +12, /*Width*/ +16, /*Heigth*/ +16, /*Color depth = 16*/ +1, /*Flags: Transp = 1*/ +23275, 21162, 21162, 21162, 21162, 21162, 2016, 2016, 2016, 2016, 2016, 2016, +2145, 0, 0, 0, 0, 0, 2113, 2016, 2016, 2016, 2016, 2016, +2145, 0, 42260, 44373, 44373, 2113, 12678, 2145, 2016, 2016, 2016, 2016, +2145, 0, 63390, 65535, 65535, 2145, 59196, 16904, 2113, 2016, 2016, 2016, +2145, 0, 63390, 65535, 65535, 2145, 63390, 63422, 16904, 2113, 2016, 2016, +2145, 0, 63390, 65535, 65535, 2145, 63390, 65535, 63422, 16904, 2113, 2016, +2145, 0, 63390, 65535, 65535, 2145, 21130, 21162, 21162, 19017, 0, 2145, +2145, 0, 63390, 65535, 65535, 44405, 44373, 44373, 44373, 44373, 2113, 0, +2145, 0, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 2145, 0, +2145, 0, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 2145, 0, +2145, 0, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 2145, 0, +2145, 0, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 2145, 0, +2145, 0, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 2145, 0, +2145, 0, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 2145, 0, +2145, 0, 21130, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 32, 0, +2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +#endif diff --git a/lv_icon/x1/img_folder.c b/lv_icon/x1/img_folder.c new file mode 100644 index 000000000..b1d914817 --- /dev/null +++ b/lv_icon/x1/img_folder.c @@ -0,0 +1,28 @@ +#include "img_conf.h" +#include "lv_conf.h" + +#if USE_IMG_FOLDER != 0 && LV_APP_USE_INTERNAL_ICONS == 1 + +#include +#include "misc/others/color.h" + +const color_int_t img_folder [] = { /*Width = 16, Height = 12*/ +16, /*Width*/ +12, /*Heigth*/ +16, /*Color depth = 16*/ +1, /*Flags: Transp = 1*/ +2016, 2016, 40147, 21162, 21162, 21162, 35921, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +2016, 23275, 2113, 0, 0, 0, 0, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 2016, +2016, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2016, +2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +25388, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, +12678, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6339, +21130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14791, +29582, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23243, +38034, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31695, +2016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38066, +2016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2016, +2016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2016, +}; + +#endif diff --git a/lv_icon/x1/img_left.c b/lv_icon/x1/img_left.c new file mode 100644 index 000000000..d2151238b --- /dev/null +++ b/lv_icon/x1/img_left.c @@ -0,0 +1,31 @@ +#include "img_conf.h" +#include "lv_conf.h" + +#if USE_IMG_LEFT != 0 && LV_APP_USE_INTERNAL_ICONS == 1 + +#include +#include "misc/others/color.h" + +const color_int_t img_left [] = { /*Width = 10, Height = 15*/ +10, /*Width*/ +15, /*Heigth*/ +16, /*Color depth = 16*/ +1, /*Flags: Transp = 1*/ +2016, 2016, 2016, 2016, 2016, 2016, 27501, 21130, 2016, 2016, +2016, 2016, 2016, 2016, 2016, 29582, 0, 0, 21130, 2016, +2016, 2016, 2016, 2016, 31695, 0, 0, 0, 0, 27469, +2016, 2016, 2016, 29582, 0, 0, 0, 0, 4226, 2016, +2016, 2016, 29582, 0, 0, 0, 0, 4226, 2016, 2016, +2016, 29582, 0, 0, 0, 0, 4226, 2016, 2016, 2016, +29582, 0, 0, 0, 0, 4226, 2016, 2016, 2016, 2016, +0, 0, 0, 0, 0, 2016, 2016, 2016, 2016, 2016, +19049, 0, 0, 0, 0, 8484, 2016, 2016, 2016, 2016, +2016, 19049, 0, 0, 0, 0, 8484, 2016, 2016, 2016, +2016, 2016, 21130, 0, 0, 0, 0, 8484, 2016, 2016, +2016, 2016, 2016, 21130, 0, 0, 0, 0, 8484, 2016, +2016, 2016, 2016, 2016, 19017, 0, 0, 0, 0, 23243, +2016, 2016, 2016, 2016, 2016, 21130, 0, 0, 12710, 2016, +2016, 2016, 2016, 2016, 2016, 2016, 21130, 14791, 2016, 2016, +}; + +#endif diff --git a/lv_icon/x1/img_ok.c b/lv_icon/x1/img_ok.c new file mode 100644 index 000000000..b450f2448 --- /dev/null +++ b/lv_icon/x1/img_ok.c @@ -0,0 +1,28 @@ +#include "img_conf.h" +#include "lv_conf.h" + +#if USE_IMG_OK != 0 && LV_APP_USE_INTERNAL_ICONS == 1 + +#include +#include "misc/others/color.h" + +const color_int_t img_ok [] = { /*Width = 16, Height = 12*/ +16, /*Width*/ +12, /*Heigth*/ +16, /*Color depth = 16*/ +1, /*Flags: Transp = 1*/ +2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 32, 2113, 2016, +2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2113, 0, 0, 10597, +2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 32, 0, 0, 8452, 2016, +2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 32, 0, 0, 8452, 2016, 2016, +2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 32, 0, 0, 8452, 2016, 2016, 2016, +2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2113, 0, 0, 6371, 2016, 2016, 2016, 2016, +2016, 4258, 0, 40147, 2016, 2016, 2016, 32, 0, 0, 8452, 2016, 2016, 2016, 2016, 2016, +16936, 0, 0, 32, 2016, 2016, 2113, 0, 0, 6371, 2016, 2016, 2016, 2016, 2016, 2016, +2016, 10565, 0, 0, 32, 2113, 0, 0, 6371, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +2016, 2016, 12710, 0, 0, 0, 0, 8452, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +2016, 2016, 2016, 12710, 0, 0, 8484, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +2016, 2016, 2016, 2016, 12710, 8484, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +}; + +#endif diff --git a/lv_icon/x1/img_right.c b/lv_icon/x1/img_right.c new file mode 100644 index 000000000..d56e6c81c --- /dev/null +++ b/lv_icon/x1/img_right.c @@ -0,0 +1,31 @@ +#include "img_conf.h" +#include "lv_conf.h" + +#if USE_IMG_RIGHT != 0 && LV_APP_USE_INTERNAL_ICONS == 1 + +#include +#include "misc/others/color.h" + +const color_int_t img_right [] = { /*Width = 10, Height = 15*/ +10, /*Width*/ +15, /*Heigth*/ +16, /*Color depth = 16*/ +1, /*Flags: Transp = 1*/ +2016, 2016, 21130, 27501, 2016, 2016, 2016, 2016, 2016, 2016, +2016, 21130, 0, 0, 29582, 2016, 2016, 2016, 2016, 2016, +27469, 0, 0, 0, 0, 31695, 2016, 2016, 2016, 2016, +2016, 4226, 0, 0, 0, 0, 29582, 2016, 2016, 2016, +2016, 2016, 4226, 0, 0, 0, 0, 29582, 2016, 2016, +2016, 2016, 2016, 4226, 0, 0, 0, 0, 29582, 2016, +2016, 2016, 2016, 2016, 4226, 0, 0, 0, 0, 29582, +2016, 2016, 2016, 2016, 2016, 0, 0, 0, 0, 0, +2016, 2016, 2016, 2016, 8484, 0, 0, 0, 0, 19049, +2016, 2016, 2016, 8484, 0, 0, 0, 0, 19049, 2016, +2016, 2016, 8484, 0, 0, 0, 0, 21130, 2016, 2016, +2016, 8484, 0, 0, 0, 0, 21130, 2016, 2016, 2016, +23243, 0, 0, 0, 0, 19017, 2016, 2016, 2016, 2016, +2016, 12710, 0, 0, 21130, 2016, 2016, 2016, 2016, 2016, +2016, 2016, 14791, 21130, 2016, 2016, 2016, 2016, 2016, 2016, +}; + +#endif diff --git a/lv_icon/x1/img_up.c b/lv_icon/x1/img_up.c new file mode 100644 index 000000000..1b1ce885d --- /dev/null +++ b/lv_icon/x1/img_up.c @@ -0,0 +1,26 @@ +#include "img_conf.h" +#include "lv_conf.h" + +#if USE_IMG_UP != 0 && LV_APP_USE_INTERNAL_ICONS == 1 + +#include +#include "misc/others/color.h" + +const color_int_t img_up [] = { /*Width = 15, Height = 10*/ +15, /*Width*/ +10, /*Heigth*/ +16, /*Color depth = 16*/ +1, /*Flags: Transp = 1*/ +2016, 2016, 2016, 2016, 2016, 2016, 8484, 0, 29582, 2016, 2016, 2016, 2016, 2016, 2016, +2016, 2016, 2016, 2016, 2016, 8484, 0, 0, 0, 29582, 2016, 2016, 2016, 2016, 2016, +2016, 2016, 2016, 2016, 8484, 0, 0, 0, 0, 0, 29582, 2016, 2016, 2016, 2016, +2016, 2016, 2016, 8484, 0, 0, 0, 0, 0, 0, 0, 29582, 2016, 2016, 2016, +2016, 2016, 10565, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31695, 2016, 2016, +2016, 8484, 0, 0, 0, 0, 19049, 2016, 4226, 0, 0, 0, 0, 29582, 2016, +10565, 0, 0, 0, 0, 16936, 2016, 2016, 2016, 2145, 0, 0, 0, 0, 29614, +14791, 0, 0, 0, 19049, 2016, 2016, 2016, 2016, 2016, 4226, 0, 0, 0, 35953, +2016, 12710, 0, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 4226, 0, 35953, 2016, +2016, 2016, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33840, 2016, 2016, +}; + +#endif diff --git a/lv_app/lv_icon/x2/img_close.c b/lv_icon/x2/img_close.c similarity index 98% rename from lv_app/lv_icon/x2/img_close.c rename to lv_icon/x2/img_close.c index 9be127a50..1360602aa 100644 --- a/lv_app/lv_icon/x2/img_close.c +++ b/lv_icon/x2/img_close.c @@ -1,7 +1,7 @@ #include "img_conf.h" #include "lv_conf.h" -#if USE_IMG_CLOSE != 0 || LV_APP_USE_INTERNAL_ICONS == 2 +#if USE_IMG_CLOSE != 0 && LV_APP_USE_INTERNAL_ICONS == 2 #include #include "misc/others/color.h" diff --git a/lv_app/lv_icon/x2/img_down.c b/lv_icon/x2/img_down.c similarity index 97% rename from lv_app/lv_icon/x2/img_down.c rename to lv_icon/x2/img_down.c index 05da91b3e..a10e7e22d 100644 --- a/lv_app/lv_icon/x2/img_down.c +++ b/lv_icon/x2/img_down.c @@ -1,7 +1,7 @@ #include "img_conf.h" #include "lv_conf.h" -#if USE_IMG_DOWN != 0 || LV_APP_USE_INTERNAL_ICONS == 2 +#if USE_IMG_DOWN != 0 && LV_APP_USE_INTERNAL_ICONS == 2 #include #include "misc/others/color.h" diff --git a/lv_app/lv_icon/x2/img_driver.c b/lv_icon/x2/img_driver.c similarity index 98% rename from lv_app/lv_icon/x2/img_driver.c rename to lv_icon/x2/img_driver.c index 7ee6eed79..0c5b95b7d 100644 --- a/lv_app/lv_icon/x2/img_driver.c +++ b/lv_icon/x2/img_driver.c @@ -1,7 +1,7 @@ #include "img_conf.h" #include "lv_conf.h" -#if USE_IMG_DRIVER != 0 || LV_APP_USE_INTERNAL_ICONS == 2 +#if USE_IMG_DRIVER != 0 && LV_APP_USE_INTERNAL_ICONS == 2 #include #include "misc/others/color.h" diff --git a/lv_icon/x2/img_file.c b/lv_icon/x2/img_file.c new file mode 100644 index 000000000..d6cde6c25 --- /dev/null +++ b/lv_icon/x2/img_file.c @@ -0,0 +1,49 @@ +#include "img_conf.h" +#include "lv_conf.h" + +#if USE_IMG_FILE != 0 && LV_APP_USE_INTERNAL_ICONS == 2 + +#include +#include "misc/others/color.h" + +const color_int_t img_file [] = { /*Width = 24, Height = 33*/ +24, /*Width*/ +33, /*Heigth*/ +16, /*Color depth = 16*/ +1, /*Flags: Transp = 1*/ +2016, 31695, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31695, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +27469, 12678, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12678, 12678, 19017, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +19017, 2113, 2113, 2113, 32, 0, 0, 0, 0, 0, 2113, 4226, 6339, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +14791, 0, 0, 0, 4226, 6339, 6339, 6339, 6371, 4258, 0, 0, 0, 6371, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +14823, 0, 0, 4258, 23275, 33808, 33808, 33808, 35921, 25388, 6371, 0, 4226, 6339, 6371, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +16904, 0, 0, 8484, 38066, 52857, 52825, 52857, 54970, 40179, 10565, 2145, 19017, 19049, 4226, 6371, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +16904, 0, 0, 10597, 46518, 63422, 63422, 65503, 65535, 48631, 10597, 8484, 42260, 46486, 19017, 6339, 6339, 19049, 2016, 2016, 2016, 2016, 2016, 2016, +16904, 0, 0, 12678, 50712, 65535, 65535, 65535, 65535, 52857, 12678, 10597, 52825, 61309, 38066, 19017, 2145, 6339, 27501, 2016, 2016, 2016, 2016, 2016, +16904, 0, 0, 12678, 50712, 65535, 65535, 65535, 65535, 52825, 10597, 10597, 50712, 65535, 61277, 44405, 19017, 4258, 6339, 19017, 2016, 2016, 2016, 2016, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 52825, 10597, 10597, 50712, 65535, 65535, 61309, 38066, 19049, 4226, 6371, 27501, 2016, 2016, 2016, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 52825, 10597, 10597, 50744, 65535, 65535, 65535, 63390, 48599, 21162, 8452, 6371, 19049, 2016, 2016, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 52825, 10597, 8452, 42260, 57083, 57083, 59164, 61277, 50712, 27469, 10565, 0, 4226, 27501, 2016, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 52825, 10597, 32, 19049, 29582, 29582, 29614, 29614, 27469, 21130, 10597, 32, 0, 4258, 23275, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 54938, 21162, 8484, 19017, 23243, 23243, 23243, 23243, 23243, 25356, 19017, 4226, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 59196, 42260, 33808, 35921, 35953, 35953, 35953, 35953, 38034, 40147, 29614, 8452, 0, 0, 10597, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 63422, 54970, 50744, 50712, 50712, 50712, 50712, 50712, 50744, 52857, 40179, 12678, 0, 0, 10597, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 63422, 63390, 63390, 63390, 63390, 63390, 63390, 63422, 65535, 50712, 14823, 0, 0, 10597, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 50712, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 52825, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 57051, 16904, 0, 0, 12678, +16904, 0, 0, 10565, 42292, 59164, 59164, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 59164, 61309, 46518, 14791, 0, 0, 12678, +16904, 0, 0, 4258, 23275, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 33840, 25388, 8452, 0, 0, 12678, +14823, 0, 0, 32, 8484, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 10565, 2113, 0, 0, 10597, +12710, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8484, +23243, 6371, 6371, 6371, 6371, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6371, 6371, 6371, 4226, 19017, +2016, 31727, 33808, 33808, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 33808, 31727, 31695, 2016, +}; + +#endif diff --git a/lv_app/lv_icon/x2/img_folder.c b/lv_icon/x2/img_folder.c similarity index 98% rename from lv_app/lv_icon/x2/img_folder.c rename to lv_icon/x2/img_folder.c index 49f498c8f..39ea32130 100644 --- a/lv_app/lv_icon/x2/img_folder.c +++ b/lv_icon/x2/img_folder.c @@ -1,7 +1,7 @@ #include "img_conf.h" #include "lv_conf.h" -#if USE_IMG_FOLDER != 0 || LV_APP_USE_INTERNAL_ICONS == 2 +#if USE_IMG_FOLDER != 0 && LV_APP_USE_INTERNAL_ICONS == 2 #include #include "misc/others/color.h" diff --git a/lv_app/lv_icon/x2/img_left.c b/lv_icon/x2/img_left.c similarity index 96% rename from lv_app/lv_icon/x2/img_left.c rename to lv_icon/x2/img_left.c index 9614e3c98..359bacbd0 100644 --- a/lv_app/lv_icon/x2/img_left.c +++ b/lv_icon/x2/img_left.c @@ -1,7 +1,7 @@ #include "img_conf.h" #include "lv_conf.h" -#if USE_IMG_LEFT != 0 || LV_APP_USE_INTERNAL_ICONS == 2 +#if USE_IMG_LEFT != 0 && LV_APP_USE_INTERNAL_ICONS == 2 #include #include "misc/others/color.h" diff --git a/lv_app/lv_icon/x2/img_ok.c b/lv_icon/x2/img_ok.c similarity index 98% rename from lv_app/lv_icon/x2/img_ok.c rename to lv_icon/x2/img_ok.c index 4bfef4062..3c6da7e59 100644 --- a/lv_app/lv_icon/x2/img_ok.c +++ b/lv_icon/x2/img_ok.c @@ -1,7 +1,7 @@ #include "img_conf.h" #include "lv_conf.h" -#if USE_IMG_OK != 0 || LV_APP_USE_INTERNAL_ICONS == 2 +#if USE_IMG_OK != 0 && LV_APP_USE_INTERNAL_ICONS == 2 #include #include "misc/others/color.h" diff --git a/lv_app/lv_icon/x2/img_right.c b/lv_icon/x2/img_right.c similarity index 96% rename from lv_app/lv_icon/x2/img_right.c rename to lv_icon/x2/img_right.c index ef13c934d..59d06c90a 100644 --- a/lv_app/lv_icon/x2/img_right.c +++ b/lv_icon/x2/img_right.c @@ -1,7 +1,7 @@ #include "img_conf.h" #include "lv_conf.h" -#if USE_IMG_RIGHT != 0 || LV_APP_USE_INTERNAL_ICONS == 2 +#if USE_IMG_RIGHT != 0 && LV_APP_USE_INTERNAL_ICONS == 2 #include #include "misc/others/color.h" diff --git a/lv_app/lv_icon/x2/img_up.c b/lv_icon/x2/img_up.c similarity index 97% rename from lv_app/lv_icon/x2/img_up.c rename to lv_icon/x2/img_up.c index 0777aab1e..dec34790b 100644 --- a/lv_app/lv_icon/x2/img_up.c +++ b/lv_icon/x2/img_up.c @@ -1,7 +1,7 @@ #include "img_conf.h" #include "lv_conf.h" -#if USE_IMG_UP != 0 || LV_APP_USE_INTERNAL_ICONS == 2 +#if USE_IMG_UP != 0 && LV_APP_USE_INTERNAL_ICONS == 2 #include #include "misc/others/color.h" diff --git a/lv_misc/anim.c b/lv_misc/anim.c index cdd2bfa59..df97f8187 100644 --- a/lv_misc/anim.c +++ b/lv_misc/anim.c @@ -28,7 +28,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void anim_task (void); +static void anim_task (void * param); static bool anim_ready_handler(anim_t * a); /********************** @@ -65,7 +65,7 @@ void anim_init(void) { ll_init(&anim_ll, sizeof(anim_t)); last_task_run = systick_get(); - ptask_create(anim_task, LV_REFR_PERIOD, PTASK_PRIO_MID); + ptask_create(anim_task, LV_REFR_PERIOD, PTASK_PRIO_MID, NULL); } /** @@ -83,7 +83,7 @@ void anim_create(anim_t * anim_p) memcpy(new_anim, anim_p, sizeof(anim_t)); /*Set the start value*/ - new_anim->fp(new_anim->var, new_anim->start); + if(new_anim->fp != NULL) new_anim->fp(new_anim->var, new_anim->start); } /** @@ -125,7 +125,7 @@ bool anim_del(void * var, anim_fp_t fp) */ uint16_t anim_speed_to_time(uint16_t speed, int32_t start, int32_t end) { - int32_t d = abs((int32_t) start - end); + int32_t d = MATH_ABS((int32_t) start - end); uint16_t time = (int32_t)((int32_t)(d * 1000) / speed); if(time == 0) { @@ -160,8 +160,9 @@ anim_path_t * anim_get_path(anim_path_name_t name) /** * Periodically handle the animations. + * @param param unused */ -static void anim_task (void) +static void anim_task (void * param) { uint32_t elaps; elaps = systick_elaps(last_task_run); @@ -191,7 +192,7 @@ static void anim_task (void) new_val = new_val >> ANIM_PATH_NORM_SHIFT; new_val += a->start; - a->fp(a->var, new_val); /*Apply the calculated value*/ + if(a->fp != NULL) a->fp(a->var, new_val); /*Apply the calculated value*/ /*If the time is elapsed the animation is ready*/ if(a->act_time >= a->time) { diff --git a/lv_misc/anim.h b/lv_misc/anim.h index 1c1de9017..5c9e7b264 100644 --- a/lv_misc/anim.h +++ b/lv_misc/anim.h @@ -28,12 +28,13 @@ typedef enum typedef uint8_t anim_path_t; typedef void (*anim_fp_t)(void *, int32_t); +typedef void (*anim_cb_t)(void *); typedef struct { void * var; /*Variable to animate*/ anim_fp_t fp; /*Animator function*/ - void (*end_cb) (void *); /*Call it when the animation is ready*/ + anim_cb_t end_cb; /*Call it when the animation is ready*/ anim_path_t * path; /*An array with the steps of animations*/ int32_t start; /*Start value*/ int32_t end; /*End value*/ diff --git a/lv_misc/font.h b/lv_misc/font.h index 3fb8e4376..eec23cbe5 100644 --- a/lv_misc/font.h +++ b/lv_misc/font.h @@ -11,6 +11,7 @@ *********************/ #include "lv_conf.h" #include +#include /********************* * DEFINES @@ -77,6 +78,8 @@ const font_t * font_get(font_types_t letter); */ static inline const uint8_t * font_get_bitmap(const font_t * font_p, uint8_t letter) { + if(letter < font_p->start_ascii || letter >= font_p->start_ascii + font_p->letter_cnt) return NULL; + uint32_t index = (letter - font_p->start_ascii) * font_p->height_row * font_p->width_byte; return &font_p->bitmaps_a[index]; } diff --git a/lv_misc/fonts/dejavu_40.c b/lv_misc/fonts/dejavu_40.c index ba6b894db..1a34d8296 100644 --- a/lv_misc/fonts/dejavu_40.c +++ b/lv_misc/fonts/dejavu_40.c @@ -3258,21 +3258,21 @@ static const uint8_t dejavu_40_bitmaps[35840] = 0x1d, 0xfe, 0x3f, 0x80, // ---OOO-OOOOOOOO---OOOOOOO-----.. 0x1f, 0xfe, 0x7f, 0xc0, // ---OOOOOOOOOOOO--OOOOOOOOO----.. 0x1e, 0x0f, 0xc1, 0xe0, // ---OOOO-----OOOOOO-----OOOO---.. - 0x1e, 0x07, 0x80, 0xe0, // ---OOOO------OOOO-------OOO---.. - 0x1c, 0x07, 0x80, 0xe0, // ---OOO-------OOOO-------OOO---.. + 0x1e, 0x07, 0xC0, 0xe0, // ---OOOO------OOOOO------OOO---.. + 0x1c, 0x07, 0xC0, 0xe0, // ---OOO-------OOOOO------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. 0x00, 0x00, 0x00, 0x00, // ------------------------------.. 0x00, 0x00, 0x00, 0x00, // ------------------------------.. 0x00, 0x00, 0x00, 0x00, // ------------------------------.. @@ -9497,4 +9497,4 @@ const font_t * dejavu_40_get_dsc(void) } -#endif \ No newline at end of file +#endif diff --git a/lv_obj/lv_dispi.c b/lv_obj/lv_dispi.c index b111258fb..040c525ab 100644 --- a/lv_obj/lv_dispi.c +++ b/lv_obj/lv_dispi.c @@ -27,7 +27,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void dispi_task(void); +static void dispi_task(void * param); static void dispi_proc_point(lv_dispi_t * dispi_p, cord_t x, cord_t y); static void dispi_proc_press(lv_dispi_t * dispi_p); static void disi_proc_release(lv_dispi_t * dispi_p); @@ -59,7 +59,7 @@ void lv_dispi_init(void) lv_dispi_reset_now = false; #if LV_DISPI_READ_PERIOD != 0 - dispi_task_p = ptask_create(dispi_task, LV_DISPI_READ_PERIOD, PTASK_PRIO_MID); + dispi_task_p = ptask_create(dispi_task, LV_DISPI_READ_PERIOD, PTASK_PRIO_MID, NULL); #else dispi_task_p = ptask_create(dispi_task, 1, PTASK_PRIO_OFF); /*Not use lv_dispi*/ #endif @@ -105,14 +105,24 @@ void lv_dispi_get_vect(lv_dispi_t * dispi_p, point_t * point_p) point_p->y = dispi_p->vect.y; } +/** + * Do nothing until the next release + * @param dispi_p pointer to a display input + */ +void lv_dispi_wait_release(lv_dispi_t * dispi_p) +{ + dispi_p->wait_release = 1; +} + /********************** * STATIC FUNCTIONS **********************/ /** * Called periodically to handle the display inputs + * @param param unused */ -static void dispi_task(void) +static void dispi_task(void * param) { static lv_dispi_t dispi[INDEV_NUM]; @@ -145,7 +155,7 @@ static void dispi_task(void) */ static void dispi_proc_point(lv_dispi_t * dispi_p, cord_t x, cord_t y) { -#if LV_DOWNSCALE > 1 && LV_VDB_SIZE != 0 +#if LV_ANTIALIAS != 0 && LV_VDB_SIZE != 0 dispi_p->act_point.x = x * LV_DOWNSCALE; dispi_p->act_point.y = y * LV_DOWNSCALE; #else @@ -191,6 +201,8 @@ static void dispi_proc_press(lv_dispi_t * dispi_p) { lv_obj_t * pr_obj = dispi_p->act_obj; + if(dispi_p->wait_release != 0) return; + /*If there is no last object then search*/ if(dispi_p->act_obj == NULL) { pr_obj = dispi_search_obj(dispi_p, lv_scr_act()); @@ -294,11 +306,18 @@ static void dispi_proc_press(lv_dispi_t * dispi_p) */ static void disi_proc_release(lv_dispi_t * dispi_p) { + if(dispi_p->wait_release != 0) { + dispi_p->act_obj = NULL; + dispi_p->last_obj = NULL; + dispi_p->press_time_stamp = 0; + dispi_p->lpr_rep_time_stamp = 0; + dispi_p->wait_release = 0; + } + /*Forgot the act obj and send a released signal */ if(dispi_p->act_obj != NULL) { - dispi_p->act_obj->signal_f(dispi_p->act_obj, - LV_SIGNAL_RELEASED, dispi_p); - + dispi_p->act_obj->signal_f(dispi_p->act_obj, + LV_SIGNAL_RELEASED, dispi_p); dispi_p->act_obj = NULL; dispi_p->press_time_stamp = 0; dispi_p->lpr_rep_time_stamp = 0; @@ -309,6 +328,7 @@ static void disi_proc_release(lv_dispi_t * dispi_p) if(dispi_p->last_obj != NULL && lv_dispi_reset_qry == false) { dispi_drag_throw(dispi_p); } + } /** @@ -376,8 +396,8 @@ static void dispi_drag(lv_dispi_t * dispi_p) dispi_p->vect_sum.y += dispi_p->vect.y; /*If a move is greater then LV_DRAG_LIMIT then begin the drag*/ - if(abs(dispi_p->vect_sum.x) >= LV_DISPI_DRAG_LIMIT || - abs(dispi_p->vect_sum.y) >= LV_DISPI_DRAG_LIMIT) + if(MATH_ABS(dispi_p->vect_sum.x) >= LV_DISPI_DRAG_LIMIT || + MATH_ABS(dispi_p->vect_sum.y) >= LV_DISPI_DRAG_LIMIT) { dispi_p->drag_in_prog = 1; drag_obj->signal_f(drag_obj, diff --git a/lv_obj/lv_dispi.h b/lv_obj/lv_dispi.h index bd7a19a08..6ea81e6ea 100644 --- a/lv_obj/lv_dispi.h +++ b/lv_obj/lv_dispi.h @@ -33,6 +33,7 @@ typedef struct /*Flags*/ uint8_t drag_in_prog :1; uint8_t long_press_sent :1; + uint8_t wait_release :1; }lv_dispi_t; @@ -52,6 +53,7 @@ void lv_dispi_reset(void); bool lv_dispi_is_dragging(lv_dispi_t * dispi_p); void lv_dispi_get_point(lv_dispi_t * dispi_p, point_t * point_p); void lv_dispi_get_vect(lv_dispi_t * dispi_p, point_t * point_p); +void lv_dispi_wait_release(lv_dispi_t * dispi_p); /********************** * MACROS diff --git a/lv_obj/lv_obj.c b/lv_obj/lv_obj.c index 1cbe9d16f..d6dc1837c 100644 --- a/lv_obj/lv_obj.c +++ b/lv_obj/lv_obj.c @@ -49,6 +49,7 @@ static lv_objs_t lv_objs_def = {.color = COLOR_MAKE(0xa0, 0xc0, 0xe0), .transp = static lv_objs_t lv_objs_scr = {.color = LV_OBJ_DEF_SCR_COLOR, .transp = 0}; static lv_objs_t lv_objs_transp = {.transp = 1}; + #ifdef LV_IMG_DEF_WALLPAPER LV_IMG_DECLARE(LV_IMG_DEF_WALLPAPER); #endif @@ -138,7 +139,7 @@ void lv_obj_inv(lv_obj_t * obj) } /** - * Notify an object if its style is modified + * Notify an object about its style is modified * @param obj pointer to an object */ void lv_obj_refr_style(lv_obj_t * obj) @@ -198,6 +199,12 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) lv_obj_set_signal_f(new_obj, lv_obj_signal); lv_obj_set_design_f(new_obj, lv_obj_design); + /*Set free data*/ + new_obj->free_num = 0; +#if LV_OBJ_FREE_P != 0 + new_obj->free_p = NULL; +#endif + /*Set attributes*/ new_obj->click_en = 0; new_obj->drag_en = 0; @@ -206,13 +213,15 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) new_obj->style_iso = 0; new_obj->hidden = 0; new_obj->top_en = 0; + new_obj->protect = LV_PROTECT_NONE; + new_obj->ext = NULL; } /*parent != NULL create normal obj. on a parent*/ else { new_obj = ll_ins_head(&(parent)->child_ll); - + new_obj->par = parent; /*Set the parent*/ ll_init(&(new_obj->child_ll), sizeof(lv_obj_t)); @@ -232,6 +241,12 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) /*Set virtual functions*/ lv_obj_set_signal_f(new_obj, lv_obj_signal); lv_obj_set_design_f(new_obj, lv_obj_design); + + /*Set free data*/ + new_obj->free_num = 0; +#if LV_OBJ_FREE_P != 0 + new_obj->free_p = NULL; +#endif /*Set attributes*/ new_obj->click_en = 1; @@ -241,6 +256,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) new_obj->style_iso = 0; new_obj->hidden = 0; new_obj->top_en = 0; + new_obj->protect = LV_PROTECT_NONE; new_obj->ext = NULL; @@ -249,23 +265,30 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) if(copy != NULL) { area_cpy(&new_obj->cords, ©->cords); new_obj->ext_size = copy->ext_size; - /*Set attributes*/ + + new_obj->opa = copy->opa; + + /*Set free data*/ + new_obj->free_num = copy->free_num; +#if LV_OBJ_FREE_P != 0 + new_obj->free_p = copy->free_p; +#endif + /*Set attributes*/ new_obj->click_en = copy->click_en; new_obj->drag_en = copy->drag_en; new_obj->drag_throw_en = copy->drag_throw_en; new_obj->drag_parent = copy->drag_parent; new_obj->hidden = copy->hidden; new_obj->top_en = copy->top_en; + new_obj->protect = copy->protect; - new_obj->style_p = copy->style_p; + new_obj->style_p = copy->style_p; if(copy->style_iso != 0) { - lv_obj_iso_style(new_obj, dm_get_size(copy->style_p)); + lv_obj_iso_style(new_obj, dm_get_size(copy->style_p)); } lv_obj_set_pos(new_obj, lv_obj_get_x(copy), lv_obj_get_y(copy)); - - new_obj->opa = copy->opa; } @@ -347,7 +370,7 @@ bool lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param) switch(sign) { case LV_SIGNAL_CHILD_CHG: /*Return 'invalid' if the child change signal is not enabled*/ - if(obj->child_chg_off != 0) valid = false; + if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) valid = false; break; default: break; @@ -814,7 +837,8 @@ void lv_obj_set_style(lv_obj_t * obj, void * style) obj->style_p = style; /*Send a style change signal to the object*/ - obj->signal_f(obj, LV_SIGNAL_STYLE_CHG, NULL); + lv_obj_refr_style(obj); + lv_obj_inv(obj); } @@ -865,7 +889,8 @@ void lv_obj_set_opar(lv_obj_t * obj, uint8_t opa) lv_obj_set_opar(i, opa); } - if(obj->opa_protect == 0) obj->opa = opa; + /*Set the opacity is the object is not protected*/ + if(lv_obj_is_protected(obj, LV_PROTECT_OPA) == false) obj->opa = opa; lv_obj_inv(obj); } @@ -943,14 +968,26 @@ void lv_obj_set_drag_parent(lv_obj_t * obj, bool en) } /** - * Do not let 'lv_obj_set_opar' to set the opacity + * Set a bit or bits in the protect filed * @param obj pointer to an object - * @param en true: enable the 'opa_protect' for the object + * @param prot 'OR'-ed values from lv_obj_prot_t */ -void lv_obj_set_opa_protect(lv_obj_t * obj, bool en) +void lv_obj_set_protect(lv_obj_t * obj, uint8_t prot) { - obj->opa_protect = (en == true ? 1 : 0); + obj->protect |= prot; } + +/** + * Clear a bit or bits in the protect filed + * @param obj pointer to an object + * @param prot 'OR'-ed values from lv_obj_prot_t + */ +void lv_obj_clr_protect(lv_obj_t * obj, uint8_t prot) +{ + prot = (~prot) & 0xFF; + obj->protect &= prot; +} + /** * Set the signal function of an object. * Always call the previous signal function in the new. @@ -1041,8 +1078,6 @@ void lv_obj_anim(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t bool out = (type & ANIM_DIR_MASK) == ANIM_IN ? false : true; type = type & (~ANIM_DIR_MASK); - if(type == LV_ANIM_NONE) return; - anim_t a; a.var = obj; a.time = time; @@ -1091,6 +1126,11 @@ void lv_obj_anim(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t a.start = 0; a.end = lv_obj_get_height(obj); break; + case LV_ANIM_NONE: + a.fp = NULL; + a.start = 0; + a.end = 0; + break; default: break; } @@ -1350,13 +1390,34 @@ bool lv_obj_get_drag_parent(lv_obj_t * obj) } /** - * Get the opa_protect attribute of an object + * Get the style isolation attribute of an object * @param obj pointer to an object - * @return true: opa_protect is enabled + * @return pointer to a style */ -bool lv_obj_get_opa_protect(lv_obj_t * obj) +bool lv_obj_get_style_iso(lv_obj_t * obj) { - return obj->opa_protect == 0 ? false : true; + return obj->style_iso == 0 ? false : true; +} + +/** + * Get the protect field of an object + * @param obj pointer to an object + * @return protect field ('OR'ed values of lv_obj_prot_t) + */ +uint8_t lv_obj_get_protect(lv_obj_t * obj) +{ + return obj->protect ; +} + +/** + * Check at least one bit of a given protect bitfield is set + * @param obj pointer to an object + * @param prot protect bits to test ('OR'ed values of lv_obj_prot_t) + * @return false: none of the given bits are set, true: at least one bit is set + */ +bool lv_obj_is_protected(lv_obj_t * obj, uint8_t prot) +{ + return (obj->protect & prot) == 0 ? false : true ; } /** diff --git a/lv_obj/lv_obj.h b/lv_obj/lv_obj.h index 472d27bac..babdb166e 100644 --- a/lv_obj/lv_obj.h +++ b/lv_obj/lv_obj.h @@ -24,11 +24,11 @@ #error "LV: LV_HOR_RES and LV_VER_RES must be greater then 0" #endif -#if LV_DOWNSCALE != 1 && LV_DOWNSCALE != 2 && LV_DOWNSCALE != 4 -#error "LV: LV_DOWNSCALE can be only 1, 2 or 4" +#if LV_DOWNSCALE != 1 && LV_DOWNSCALE != 2 +#error "LV: LV_DOWNSCALE can be only 1 or 2" #endif -#if LV_VDB_SIZE == 0 && (LV_DOWNSCALE != 1 || LV_UPSCALE_MAP != 0 || LV_UPSCALE_STYLE != 0) +#if LV_VDB_SIZE == 0 && LV_DOWNSCALE != 1 #error "LV: If LV_VDB_SIZE == 0 then LV_DOWNSCALE must be 1, LV_UPSCALE_MAP 0, LV_UPSCALE_STYLE 0" #endif @@ -84,7 +84,7 @@ typedef struct __LV_OBJ_T lv_signal_f_t signal_f; lv_design_f_t design_f; - void * ext; /*The object attributes can be extended here*/ + void * ext; /*The object attributes can be extended here*/ void * style_p; /*Object specific style*/ #if LV_OBJ_FREE_P != 0 @@ -92,23 +92,35 @@ typedef struct __LV_OBJ_T #endif /*Attributes and states*/ - uint16_t click_en :1; /*1: can be pressed by a display input device*/ - uint16_t drag_en :1; /*1: enable the dragging*/ - uint16_t drag_throw_en:1; /*1: Enable throwing with drag*/ - uint16_t drag_parent :1; /*1. Parent will be dragged instead*/ - uint16_t style_iso :1; /*1: The object has got an own style*/ - uint16_t hidden :1; /*1: Object is hidden*/ - uint16_t top_en :1; /*1: If the object or its children is clicked it goes to the foreground*/ - uint16_t child_chg_off:1; /*1: Disable the child change signal. Used by the library*/ - uint16_t opa_protect :1; /*1: Do not let 'lv_obj_set_opar' to set the opacity*/ + uint8_t click_en :1; /*1: can be pressed by a display input device*/ + uint8_t drag_en :1; /*1: enable the dragging*/ + uint8_t drag_throw_en:1; /*1: Enable throwing with drag*/ + uint8_t drag_parent :1; /*1. Parent will be dragged instead*/ + uint8_t style_iso :1; /*1: The object has got an own style*/ + uint8_t hidden :1; /*1: Object is hidden*/ + uint8_t top_en :1; /*1: If the object or its children is clicked it goes to the foreground*/ + uint8_t reserved :1; + + uint8_t protect; /*Automatically happening actions can be prevented. 'OR'ed values from lv_obj_prot_t*/ + cord_t ext_size; /*EXTtend the size of the object in every direction. Used to draw shadow, shine etc.*/ - uint8_t free_num; /*Application specific identifier (set it freely)*/ + uint8_t free_num; /*Application specific identifier (set it freely)*/ opa_t opa; }lv_obj_t; +/*Protect some attributes (max. 8 bit)*/ +typedef enum +{ + LV_PROTECT_NONE = 0x00, + LV_PROTECT_CHILD_CHG = 0x01, /*Disable the child change signal. Used by the library*/ + LV_PROTECT_OPA = 0x02, /*Prevent lv_obj_set_opar to modify the opacity*/ + LV_PROTECT_PARENT = 0x04, /*Prevent automatic parent change (e.g. in lv_page)*/ + LV_PROTECT_POS = 0x08, /*Prevent automatic positioning (e.g. in lv_rect layout)*/ +}lv_obj_protect_t; + typedef enum { LV_ALIGN_CENTER = 0, @@ -204,7 +216,8 @@ void lv_obj_set_top(lv_obj_t * obj, bool en); void lv_obj_set_drag(lv_obj_t * obj, bool en); void lv_obj_set_drag_throw(lv_obj_t * obj, bool en); void lv_obj_set_drag_parent(lv_obj_t * obj, bool en); -void lv_obj_set_opa_protect(lv_obj_t * obj, bool en); +void lv_obj_set_protect(lv_obj_t * obj, uint8_t prot); +void lv_obj_clr_protect(lv_obj_t * obj, uint8_t prot); /*Other set*/ void lv_obj_set_signal_f(lv_obj_t * obj, lv_signal_f_t fp); void lv_obj_set_design_f(lv_obj_t * obj, lv_design_f_t fp); @@ -241,7 +254,9 @@ bool lv_obj_get_top(lv_obj_t * obj); bool lv_obj_get_drag(lv_obj_t * obj); bool lv_obj_get_drag_throw(lv_obj_t * obj); bool lv_obj_get_drag_parent(lv_obj_t * obj); -bool lv_obj_get_opa_potect(lv_obj_t * obj); +bool lv_obj_get_style_iso(lv_obj_t * obj); +uint8_t lv_obj_get_protect(lv_obj_t * obj); +bool lv_obj_is_protected(lv_obj_t * obj, uint8_t prot); /*Virtual functions get*/ lv_design_f_t lv_obj_get_design_f(lv_obj_t * obj); diff --git a/lv_obj/lv_refr.c b/lv_obj/lv_refr.c index b9489d886..2738df6b2 100644 --- a/lv_obj/lv_refr.c +++ b/lv_obj/lv_refr.c @@ -29,7 +29,7 @@ typedef struct /********************** * STATIC PROTOTYPES **********************/ -static void lv_refr_task(void); +static void lv_refr_task(void * param); static void lv_refr_join_area(void); static void lv_refr_areas(void); #if LV_VDB_SIZE == 0 @@ -65,7 +65,7 @@ void lv_refr_init(void) memset(inv_buf, 0, sizeof(inv_buf)); ptask_t* task; - task = ptask_create(lv_refr_task, LV_REFR_PERIOD, PTASK_PRIO_MID); + task = ptask_create(lv_refr_task, LV_REFR_PERIOD, PTASK_PRIO_MID, NULL); dm_assert(task); } @@ -96,11 +96,6 @@ void lv_inv_area(const area_t * area_p) com_area.y1 = com_area.y1 & (~0x1); com_area.x2 = com_area.x2 | 0x1; com_area.y2 = com_area.y2 | 0x1; -#elif LV_DOWNSCALE == 4 - com_area.x1 = com_area.x1 & (~0x3); - com_area.y1 = com_area.y1 & (~0x3); - com_area.x2 = com_area.x2 | 0x3; - com_area.y2 = com_area.y2 | 0x3; #endif /*Save only if this area is not in one of the saved areas*/ @@ -127,8 +122,9 @@ void lv_inv_area(const area_t * area_p) /** * Called periodically to handle the refreshing + * @param param unused */ -static void lv_refr_task(void) +static void lv_refr_task(void * param) { lv_refr_join_area(); @@ -239,8 +235,6 @@ static void lv_refr_area_with_vdb(const area_t * area_p) /*Round the row number with downscale*/ #if LV_DOWNSCALE == 2 max_row &= (~0x1); -#elif LV_DOWNSCALE == 4 - max_row &= (~0x3); #endif /*Refresh all rows*/ @@ -282,7 +276,7 @@ static void lv_refr_area_part_vdb(const area_t * area_p) /*Get the most top object which is not covered by others*/ top_p = lv_refr_get_top_obj(&start_mask, lv_scr_act()); - /*Do the refreshing*/ + /*Do the refreshing from the top object*/ lv_refr_make(top_p, &start_mask); /*Flush the content of the VDB*/ @@ -342,7 +336,7 @@ static void lv_refr_make(lv_obj_t * top_p, const area_t * mask_p) /*Refresh the top object and its children*/ lv_refr_obj(top_p, mask_p); - /*Draw the 'younger' objects because they can be on top_obj */ + /*Draw the 'younger' sibling objects because they can be on top_obj */ lv_obj_t * par; lv_obj_t * i; lv_obj_t * border_p = top_p; @@ -366,6 +360,13 @@ static void lv_refr_make(lv_obj_t * top_p, const area_t * mask_p) /*Go a level deeper*/ par = lv_obj_get_parent(par); } + + /*Call the post draw design function of the parents of the to object*/ + par = lv_obj_get_parent(top_p); + while(par != NULL) { + par->design_f(par, mask_p, LV_DESIGN_DRAW_POST); + par = lv_obj_get_parent(par); + } } /** diff --git a/lv_obj/lv_vdb.c b/lv_obj/lv_vdb.c index df1839e03..e42561aa1 100644 --- a/lv_obj/lv_vdb.c +++ b/lv_obj/lv_vdb.c @@ -52,11 +52,10 @@ lv_vdb_t * lv_vdb_get(void) */ void lv_vdb_flush(void) { -#if LV_DOWNSCALE < 2 +#if LV_ANTIALIAS == 0 disp_area(DISP_ID_ALL, vdb.vdb_area.x1 , vdb.vdb_area.y1, vdb.vdb_area.x2, vdb.vdb_area.y2); disp_map(DISP_ID_ALL, vdb.buf); -#elif LV_DOWNSCALE == 2 - +#else color_t row_buf[LV_HOR_RES / LV_DOWNSCALE]; color_t * row_buf_p; cord_t x; @@ -88,55 +87,7 @@ void lv_vdb_flush(void) disp_area(DISP_ID_ALL, vdb.vdb_area.x1 >> 1, y, vdb.vdb_area.x2 >> 1, y); disp_map(DISP_ID_ALL, row_buf); } -#elif LV_DOWNSCALE == 4 - color_t row_buf[LV_HOR_RES / LV_DOWNSCALE]; - color_t * row_buf_p; - cord_t x; - cord_t y; - cord_t w = area_get_width(&vdb.vdb_area); - cord_t i; - color_t * buf_p = vdb.buf; - for(y = vdb.vdb_area.y1 >> 2; y <= vdb.vdb_area.y2 >> 2; y ++) { - i = 0; - row_buf_p = row_buf; - for(x = vdb.vdb_area.x1; x < vdb.vdb_area.x2; x += 4, i += 4) { - row_buf_p->red = (buf_p[i].red + buf_p[i + 1].red + - buf_p[i + 2].red + buf_p[i + 3].red + - buf_p[i + w].red + buf_p[i + w + 1].red + - buf_p[i + w + 2].red + buf_p[i + w + 3].red + - buf_p[i + 2 * w].red + buf_p[i + 2 * w + 1].red + - buf_p[i + 2 * w + 2].red + buf_p[i + 2 * w + 3].red + - buf_p[i + 3 * w].red + buf_p[i + 3 * w + 1].red + - buf_p[i + 3 * w + 2].red + buf_p[i + 3 * w + 3].red) >>4 ; - row_buf_p->green = (buf_p[i].green + buf_p[i + 1].green + - buf_p[i + 2].green + buf_p[i + 3].green + - buf_p[i + w].green + buf_p[i + w + 1].green + - buf_p[i + w + 2].green + buf_p[i + w + 3].green + - buf_p[i + 2 * w].green + buf_p[i + 2 * w + 1].green + - buf_p[i + 2 * w + 2].green + buf_p[i + 2 * w + 3].green + - buf_p[i + 3 * w].green + buf_p[i + 3 * w + 1].green + - buf_p[i + 3 * w + 2].green + buf_p[i + 3 * w + 3].green) >>4 ; - - row_buf_p->blue = (buf_p[i].blue + buf_p[i + 1].blue + - buf_p[i + 2].blue + buf_p[i + 3].blue + - buf_p[i + w].blue + buf_p[i + w + 1].blue + - buf_p[i + w + 2].blue + buf_p[i + w + 3].blue + - buf_p[i + 2 * w].blue + buf_p[i + 2 * w + 1].blue + - buf_p[i + 2 * w + 2].blue + buf_p[i + 2 * w + 3].blue + - buf_p[i + 3 * w].blue + buf_p[i + 3 * w + 1].blue + - buf_p[i + 3 * w + 2].blue + buf_p[i + 3 * w + 3].blue) >>4 ; - row_buf_p++; - } - buf_p += LV_DOWNSCALE * w; - - disp_area(DISP_ID_ALL, vdb.vdb_area.x1 >> 2, y, vdb.vdb_area.x2 >> 2, y); - disp_map(DISP_ID_ALL, row_buf); - } -#else -#error "LV: Not supported LV_DOWNSCALE" #endif - - } /********************** diff --git a/lv_objx/lv_btn.c b/lv_objx/lv_btn.c index 759c3681b..dfa17074e 100644 --- a/lv_objx/lv_btn.c +++ b/lv_objx/lv_btn.c @@ -61,42 +61,42 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_t * new_btn; new_btn = lv_rect_create(par, copy); + dm_assert(new_btn); /*Allocate the extended data*/ - lv_obj_alloc_ext(new_btn, sizeof(lv_btn_ext_t)); + lv_btn_ext_t * ext = lv_obj_alloc_ext(new_btn, sizeof(lv_btn_ext_t)); + dm_assert(ext); + ext->state = LV_BTN_STATE_REL; + ext->pr_action = NULL; + ext->rel_action = NULL; + ext->lpr_action = NULL; + ext->lpr_rep_action = NULL; + ext->lpr_exec = 0; + ext->tgl = 0; - if(ancestor_design_f == NULL) { - ancestor_design_f = lv_obj_get_design_f(new_btn); - } + if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_btn); lv_obj_set_signal_f(new_btn, lv_btn_signal); lv_obj_set_design_f(new_btn, lv_btn_design); - lv_btn_ext_t * ext = lv_obj_get_ext(new_btn); - ext->lpr_exec = 0; - - /*If no copy do the basic initialization*/ - if(copy == NULL) - { - ext->state = LV_BTN_STATE_REL; - ext->pr_action = NULL; - ext->rel_action = NULL; - ext->lpr_action = NULL; - ext->tgl = 0; + if(copy == NULL) { lv_rect_set_layout(new_btn, LV_RECT_LAYOUT_CENTER); + lv_obj_set_style(new_btn, lv_btns_get(LV_BTNS_DEF, NULL)); } /*Copy 'copy'*/ - else{ - lv_btn_ext_t * ori_btn_ext = lv_obj_get_ext(copy); - ext->state = ori_btn_ext->state; - ext->pr_action = ori_btn_ext->pr_action; - ext->rel_action = ori_btn_ext->rel_action; - ext->lpr_action = ori_btn_ext->lpr_action; - ext->tgl = ori_btn_ext->tgl; + else { + lv_btn_ext_t * copy_ext = lv_obj_get_ext(copy); + ext->state = copy_ext->state; + ext->pr_action = copy_ext->pr_action; + ext->rel_action = copy_ext->rel_action; + ext->lpr_action = copy_ext->lpr_action; + ext->lpr_rep_action = copy_ext->lpr_action; + ext->tgl = copy_ext->tgl; + + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_btn); } - lv_obj_set_style(new_btn, lv_btns_get(LV_BTNS_DEF, NULL)); - return new_btn; } @@ -106,7 +106,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy) * @param sign a signal type from lv_signal_t enum * @param param pointer to a signal specific variable */ -bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void* param) +bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param) { bool valid; @@ -138,11 +138,18 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void* param) case LV_SIGNAL_PRESS_LOST: /*Refresh the state*/ - if(ext->state == LV_BTN_STATE_PR) { - lv_btn_set_state(btn, LV_BTN_STATE_REL); - } else if(ext->state == LV_BTN_STATE_TGL_PR) { - lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL); - }lv_obj_inv(btn); + if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL); + else if(ext->state == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL); + + lv_obj_inv(btn); + break; + case LV_SIGNAL_PRESSING: + /*When the button begins to drag revert pressed states to released*/ + if(lv_dispi_is_dragging(param) != false) { + if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL); + else if(ext->state == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL); + } + lv_obj_inv(btn); break; case LV_SIGNAL_RELEASED: @@ -218,9 +225,10 @@ void lv_btn_set_tgl(lv_obj_t * btn, bool tgl) void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state) { lv_btn_ext_t * ext = lv_obj_get_ext(btn); - - ext->state = state; - lv_obj_inv(btn); + if(ext->state != state) { + ext->state = state; + lv_obj_inv(btn); + } } /** @@ -368,7 +376,7 @@ static bool lv_btn_design(lv_obj_t * btn, const area_t * mask, lv_design_mode_t btn->style_p = btns_tmp; /*Reload the original button style*/ } return ret; - } else if(mode == LV_DESIGN_DRAW_MAIN) { + } else if(mode == LV_DESIGN_DRAW_MAIN || mode == LV_DESIGN_DRAW_POST) { area_t area; lv_obj_get_cords(btn, &area); @@ -415,33 +423,33 @@ static void lv_btn_style_load(lv_obj_t * btn, lv_rects_t * new_rects) static void lv_btns_init(void) { /*Default style*/ - lv_btns_def.mcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0x40, 0x60, 0x80); - lv_btns_def.gcolor[LV_BTN_STATE_REL] = COLOR_BLACK; - lv_btns_def.bcolor[LV_BTN_STATE_REL] = COLOR_WHITE; + lv_btns_def.mcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0x60, 0x88, 0xb0); + lv_btns_def.gcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0x20, 0x30, 0x40); + lv_btns_def.bcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0x60, 0x70, 0x80); lv_btns_def.lcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0x30, 0x40, 0x50); lv_btns_def.flags[LV_BTN_STATE_REL].light_en = 0; lv_btns_def.flags[LV_BTN_STATE_REL].transp = 0; lv_btns_def.flags[LV_BTN_STATE_REL].empty = 0; - lv_btns_def.mcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x60, 0x80, 0xa0); - lv_btns_def.gcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x20, 0x30, 0x40); - lv_btns_def.bcolor[LV_BTN_STATE_PR] = COLOR_WHITE; + lv_btns_def.mcolor[LV_BTN_STATE_PR] =COLOR_MAKE(0x50, 0x68, 0x80); + lv_btns_def.gcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x18, 0x20, 0x28); + lv_btns_def.bcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x40, 0x60, 0x80); lv_btns_def.lcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x30, 0x40, 0x50); - lv_btns_def.flags[LV_BTN_STATE_PR].light_en = 1; + lv_btns_def.flags[LV_BTN_STATE_PR].light_en = 0; lv_btns_def.flags[LV_BTN_STATE_PR].transp = 0; lv_btns_def.flags[LV_BTN_STATE_PR].empty = 0; - lv_btns_def.mcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x80, 0x00, 0x00); - lv_btns_def.gcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x20, 0x20, 0x20); - lv_btns_def.bcolor[LV_BTN_STATE_TGL_REL] = COLOR_WHITE; + lv_btns_def.mcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x40, 0x60, 0x80); + lv_btns_def.gcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x10, 0x18, 0x20); + lv_btns_def.bcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x20, 0x30, 0x40); lv_btns_def.lcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x30, 0x40, 0x50); - lv_btns_def.flags[LV_BTN_STATE_TGL_REL].light_en = 0; + lv_btns_def.flags[LV_BTN_STATE_TGL_REL].light_en = 1; lv_btns_def.flags[LV_BTN_STATE_TGL_REL].transp = 0; lv_btns_def.flags[LV_BTN_STATE_TGL_REL].empty = 0; - lv_btns_def.mcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0xf0, 0x26, 0x26); - lv_btns_def.gcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x40, 0x40, 0x40); - lv_btns_def.bcolor[LV_BTN_STATE_TGL_PR] = COLOR_WHITE; + lv_btns_def.mcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x60, 0x80, 0xa0); + lv_btns_def.gcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x20, 0x30, 0x40); + lv_btns_def.bcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x20, 0x30, 0x40); lv_btns_def.lcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x30, 0x40, 0x50); lv_btns_def.flags[LV_BTN_STATE_TGL_PR].light_en = 1; lv_btns_def.flags[LV_BTN_STATE_TGL_PR].transp = 0; @@ -460,28 +468,34 @@ static void lv_btns_init(void) lv_btns_def.rects.bcolor = lv_btns_def.bcolor[LV_BTN_STATE_REL]; lv_btns_def.rects.objs.transp = 0; lv_btns_def.rects.empty = 0; - lv_btns_def.rects.light = 0; + lv_btns_def.rects.light = 6 * LV_DOWNSCALE; lv_btns_def.rects.bwidth = 2 * LV_DOWNSCALE; - lv_btns_def.rects.bopa = 50; + lv_btns_def.rects.bopa = 70; lv_btns_def.rects.empty = 0; lv_btns_def.rects.round = 4 * LV_DOWNSCALE; lv_btns_def.rects.hpad = 10 * LV_DOWNSCALE; lv_btns_def.rects.vpad = 15 * LV_DOWNSCALE; - lv_btns_def.rects.opad = 5 * LV_DOWNSCALE; + lv_btns_def.rects.opad = 10 * LV_DOWNSCALE; /*Transparent style*/ memcpy(&lv_btns_transp, &lv_btns_def, sizeof(lv_btns_t)); lv_btns_transp.rects.bwidth = 0; lv_btns_transp.flags[LV_BTN_STATE_REL].transp = 1; lv_btns_transp.flags[LV_BTN_STATE_REL].empty = 1; + lv_btns_transp.flags[LV_BTN_STATE_REL].light_en = 0; + lv_btns_transp.flags[LV_BTN_STATE_PR].transp = 1; lv_btns_transp.flags[LV_BTN_STATE_PR].empty = 1; + lv_btns_transp.flags[LV_BTN_STATE_PR].light_en = 0; lv_btns_transp.flags[LV_BTN_STATE_TGL_REL].transp = 1; lv_btns_transp.flags[LV_BTN_STATE_TGL_REL].empty = 1; + lv_btns_transp.flags[LV_BTN_STATE_TGL_REL].light_en = 0; lv_btns_transp.flags[LV_BTN_STATE_TGL_PR].transp = 1; lv_btns_transp.flags[LV_BTN_STATE_TGL_PR].empty = 1; + lv_btns_transp.flags[LV_BTN_STATE_TGL_PR].light_en = 0; lv_btns_transp.flags[LV_BTN_STATE_INA].transp = 1; lv_btns_transp.flags[LV_BTN_STATE_INA].empty = 1; + lv_btns_transp.flags[LV_BTN_STATE_INA].light_en = 0; /*Border style*/ @@ -492,16 +506,20 @@ static void lv_btns_init(void) lv_btns_border.bcolor[LV_BTN_STATE_TGL_PR] = COLOR_BLACK; lv_btns_border.bcolor[LV_BTN_STATE_INA] = COLOR_GRAY; lv_btns_border.flags[LV_BTN_STATE_REL].empty = 1; - lv_btns_border.flags[LV_BTN_STATE_PR].empty = 1; - lv_btns_border.flags[LV_BTN_STATE_TGL_REL].empty = 1; - lv_btns_border.flags[LV_BTN_STATE_TGL_PR].empty = 1; + lv_btns_border.flags[LV_BTN_STATE_PR].empty = 0; + lv_btns_border.flags[LV_BTN_STATE_TGL_REL].empty = 0; + lv_btns_border.flags[LV_BTN_STATE_TGL_PR].empty = 0; lv_btns_border.flags[LV_BTN_STATE_INA].empty = 1; + lv_btns_border.flags[LV_BTN_STATE_REL].light_en = 0; + lv_btns_border.flags[LV_BTN_STATE_PR].light_en = 0; + lv_btns_border.flags[LV_BTN_STATE_TGL_REL].light_en = 0; + lv_btns_border.flags[LV_BTN_STATE_TGL_PR].light_en = 0; + lv_btns_border.flags[LV_BTN_STATE_INA].light_en = 0; lv_btns_border.rects.bwidth = 2 * LV_DOWNSCALE; lv_btns_border.rects.bopa = 50; lv_btns_border.rects.round = 4 * LV_DOWNSCALE; lv_btns_border.rects.hpad = 10 * LV_DOWNSCALE; lv_btns_border.rects.vpad = 10 * LV_DOWNSCALE; - lv_btns_border.rects.vpad = 5 * LV_DOWNSCALE; } #endif diff --git a/lv_objx/lv_btn.h b/lv_objx/lv_btn.h index 5e4687b10..eb3e19646 100644 --- a/lv_objx/lv_btn.h +++ b/lv_objx/lv_btn.h @@ -12,6 +12,11 @@ #include "lv_conf.h" #if USE_LV_BTN != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_btn: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + #include "lv_rect.h" #include "../lv_obj/lv_dispi.h" diff --git a/lv_objx/lv_btnm.c b/lv_objx/lv_btnm.c index 3829f3ec3..7a99a35a4 100644 --- a/lv_objx/lv_btnm.c +++ b/lv_objx/lv_btnm.c @@ -68,14 +68,17 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy) /*Allocate the object type specific extended data*/ lv_btnm_ext_t * ext = lv_obj_alloc_ext(new_btnm, sizeof(lv_btnm_ext_t)); dm_assert(ext); + ext->btn_cnt = 0; + ext->btn_pr = LV_BTNM_BTN_PR_INVALID; + ext->btn_areas = NULL; + ext->cb = NULL; + ext->map_p = NULL; if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_btnm); lv_obj_set_signal_f(new_btnm, lv_btnm_signal); lv_obj_set_design_f(new_btnm, lv_btnm_design); - ext->btn_cnt = 0; - ext->btn_pr = LV_BTNM_BTN_PR_INVALID; /*Init the new button matrix object*/ if(copy == NULL) { @@ -85,7 +88,7 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy) } /*Copy an existing object*/ else { - + lv_btnm_set_map(new_btnm, lv_btnm_get_map(copy)); } return new_btnm; @@ -206,7 +209,8 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map) /* Count the units and the buttons in a line * (A button can be 1,2,3... unit wide)*/ - uint16_t unit_cnt; + uint16_t unit_cnt; /*Number of units in a row*/ + uint16_t unit_act_cnt; /*Number of units currently put in a row*/ uint16_t btn_cnt; /*Number of buttons in a row*/ uint16_t i_tot = 0; /*Act. index in the str map*/ uint16_t btn_i = 0; /*Act. index of button areas*/ @@ -233,17 +237,22 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map) uint16_t i; cord_t act_x = btnms->rects.hpad; cord_t act_unit_w; + unit_act_cnt = 0; for(i = 0; i < btn_cnt; i++) { /* one_unit_w = all_unit_w / unit_cnt * act_unit_w = one_unit_w * button_width - * do this two operation but the multiplications first to divide a greater number */ + * do this two operation but the multiply first to divide a greater number */ act_unit_w = (all_unit_w * lv_btnm_get_width_unit(map_p_tmp[i])) / unit_cnt; + + /*Always recalculate act_x because of rounding errors */ + act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * btnms->rects.opad + btnms->rects.hpad; + area_set(&ext->btn_areas[btn_i], act_x, act_y, act_x + act_unit_w, act_y + btn_h); - act_x += act_unit_w + btnms->rects.opad; + unit_act_cnt += lv_btnm_get_width_unit(map_p_tmp[i]); i_tot ++; btn_i ++; @@ -256,7 +265,6 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map) } lv_obj_inv(btnm); - } /** @@ -378,7 +386,7 @@ static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_ lv_rects_t new_rects; lv_btn_state_t state; state = ext->btn_pr == btn_i ? LV_BTN_STATE_PR : LV_BTN_STATE_REL; - memcpy(&new_rects, &style->rects, sizeof(lv_rects_t)); + memcpy(&new_rects, &style->btns, sizeof(lv_rects_t)); new_rects.objs.color = style->btns.mcolor[state]; new_rects.gcolor = style->btns.gcolor[state]; new_rects.bcolor = style->btns.bcolor[state]; diff --git a/lv_objx/lv_btnm.h b/lv_objx/lv_btnm.h index 04b117ba0..c7cd78836 100644 --- a/lv_objx/lv_btnm.h +++ b/lv_objx/lv_btnm.h @@ -13,6 +13,15 @@ #include "lv_conf.h" #if USE_LV_BTNM != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_btnm: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + +#if USE_LV_BTN == 0 +#error "lv_btnm: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) " +#endif + #include "../lv_obj/lv_obj.h" #include "lv_rect.h" #include "lv_label.h" diff --git a/lv_objx/lv_cb.c b/lv_objx/lv_cb.c index 2d0ea676f..af30f5017 100644 --- a/lv_objx/lv_cb.c +++ b/lv_objx/lv_cb.c @@ -22,16 +22,14 @@ /********************** * STATIC PROTOTYPES **********************/ -#if 0 /*The ancestor design function is used */ static bool lv_cb_design(lv_obj_t * cb, const area_t * mask, lv_design_mode_t mode); -#endif static void lv_cbs_init(void); /********************** * STATIC VARIABLES **********************/ static lv_cbs_t lv_cbs_def; - +static lv_design_f_t ancestor_design_f; /********************** * MACROS **********************/ @@ -58,8 +56,13 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy) lv_cb_ext_t * ext = lv_obj_alloc_ext(new_cb, sizeof(lv_cb_ext_t)); dm_assert(ext); + ext->bullet = NULL; + ext->label = NULL; + + if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_cb); lv_obj_set_signal_f(new_cb, lv_cb_signal); + lv_obj_set_design_f(new_cb, lv_cb_design); /*Init the new checkbox object*/ if(copy == NULL) { @@ -79,7 +82,8 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy) ext->bullet = lv_btn_create(new_cb, copy_ext->bullet); ext->label = lv_label_create(new_cb, copy_ext->label); - lv_obj_set_style(new_cb, lv_obj_get_style(copy)); + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_cb); } lv_obj_align_us(new_cb, NULL, LV_ALIGN_CENTER, 0, 0); @@ -199,7 +203,6 @@ lv_cbs_t * lv_cbs_get(lv_cbs_builtin_t style, lv_cbs_t * copy) * STATIC FUNCTIONS **********************/ -#if 0 /*The ancestor design function is used */ /** * Handle the drawing related tasks of the check boxes * @param cb pointer to an object @@ -214,14 +217,23 @@ static bool lv_cb_design(lv_obj_t * cb, const area_t * mask, lv_design_mode_t mo { if(mode == LV_DESIGN_COVER_CHK) { /*Return false if the object is not covers the mask_p area*/ - return false; + return ancestor_design_f(cb, mask, mode); + } else if(mode == LV_DESIGN_DRAW_MAIN || mode == LV_DESIGN_DRAW_POST) { + lv_cb_ext_t * cb_ext = lv_obj_get_ext(cb); + lv_btn_ext_t * bullet_ext = lv_obj_get_ext(cb_ext->bullet); + + /*Be sure he state of the bullet is the same as the parent button*/ + bullet_ext->state = cb_ext->bg_btn.state; + + return ancestor_design_f(cb, mask, mode); + } /*Draw the object*/ return true; } -#endif + /** * Initialize the rectangle styles */ @@ -231,8 +243,8 @@ static void lv_cbs_init(void) /*Bg style*/ lv_btns_get(LV_RECTS_TRANSP, &lv_cbs_def.bg); - lv_cbs_def.bg.rects.hpad = 0 * LV_DOWNSCALE; - lv_cbs_def.bg.rects.vpad = 0 * LV_DOWNSCALE; + lv_cbs_def.bg.rects.hpad = 6 * LV_DOWNSCALE; + lv_cbs_def.bg.rects.vpad = 6 * LV_DOWNSCALE; lv_cbs_def.bg.rects.opad = 5 * LV_DOWNSCALE; /*Bullet style*/ @@ -251,12 +263,12 @@ static void lv_cbs_init(void) lv_cbs_def.bullet.mcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x20, 0x30, 0x40); lv_cbs_def.bullet.gcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x10, 0x20, 0x30); lv_cbs_def.bullet.bcolor[LV_BTN_STATE_TGL_REL] = COLOR_WHITE; - lv_cbs_def.bullet.flags[LV_BTN_STATE_TGL_REL].light_en = 0; + lv_cbs_def.bullet.flags[LV_BTN_STATE_TGL_REL].light_en = 1; lv_cbs_def.bullet.mcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x50, 0x70, 0x90); lv_cbs_def.bullet.gcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x20, 0x30, 0x40); lv_cbs_def.bullet.bcolor[LV_BTN_STATE_TGL_PR] = COLOR_WHITE; - lv_cbs_def.bullet.flags[LV_BTN_STATE_TGL_PR].light_en = 0; + lv_cbs_def.bullet.flags[LV_BTN_STATE_TGL_PR].light_en = 1; lv_cbs_def.bullet.mcolor[LV_BTN_STATE_INA] = COLOR_SILVER; lv_cbs_def.bullet.gcolor[LV_BTN_STATE_INA] = COLOR_GRAY; @@ -265,6 +277,7 @@ static void lv_cbs_init(void) lv_cbs_def.bullet.rects.bwidth = 2 * LV_DOWNSCALE; lv_cbs_def.bullet.rects.bopa = 70; + lv_cbs_def.bullet.rects.light = 6 * LV_DOWNSCALE; lv_cbs_def.bullet.rects.empty = 0; lv_cbs_def.bullet.rects.round = LV_OBJ_DEF_WIDTH / 3 / 4; lv_cbs_def.bullet.rects.hpad = 0 * LV_DOWNSCALE; diff --git a/lv_objx/lv_cb.h b/lv_objx/lv_cb.h index 27a18bcaa..d97d9303c 100644 --- a/lv_objx/lv_cb.h +++ b/lv_objx/lv_cb.h @@ -11,6 +11,14 @@ *********************/ #include "lv_conf.h" #if USE_LV_CB != 0 +/*Testing of dependencies*/ +#if USE_LV_BTN == 0 +#error "lv_cb: lv_rect is required. Enable it in lv_conf.h (USE_LV_BTN 1) " +#endif + +#if USE_LV_LABEL == 0 +#error "lv_cb: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) " +#endif #include "../lv_obj/lv_obj.h" #include "lv_btn.h" diff --git a/lv_objx/lv_chart.c b/lv_objx/lv_chart.c index 2041e5f49..e9c3443f6 100644 --- a/lv_objx/lv_chart.c +++ b/lv_objx/lv_chart.c @@ -40,7 +40,8 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask); * STATIC VARIABLES **********************/ static lv_charts_t lv_charts_def; -static lv_design_f_t ancestor_design_fp; +static lv_charts_t lv_charts_transp; +static lv_design_f_t ancestor_design_f; /********************** * MACROS @@ -69,26 +70,23 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy) /*Allocate the object type specific extended data*/ lv_chart_ext_t * ext = lv_obj_alloc_ext(new_chart, sizeof(lv_chart_ext_t)); dm_assert(ext); - - if(ancestor_design_fp == NULL) { - ancestor_design_fp = lv_obj_get_design_f(new_chart); - } - ll_init(&ext->dl_ll, sizeof(cord_t *)); ext->dl_num = 0; + ext->ymin = LV_CHART_YMIN_DEF; + ext->ymax = LV_CHART_YMAX_DEF; + ext->hdiv_num = LV_CHART_HDIV_DEF; + ext->vdiv_num = LV_CHART_VDIV_DEF; + ext->pnum = LV_CHART_PNUM_DEF; + ext->type = LV_CHART_LINE; + + if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_chart); lv_obj_set_signal_f(new_chart, lv_chart_signal); lv_obj_set_design_f(new_chart, lv_chart_design); /*Init the new chart background object*/ if(copy == NULL) { - ext->type = LV_CHART_LINE; lv_obj_set_style(new_chart, lv_charts_get(LV_CHARTS_DEF, NULL)); - ext->ymin = LV_CHART_YMIN_DEF; - ext->ymax = LV_CHART_YMAX_DEF; - ext->hdiv_num = LV_CHART_HDIV_DEF; - ext->vdiv_num = LV_CHART_VDIV_DEF; - ext->pnum = LV_CHART_PNUM_DEF; } else { lv_chart_ext_t * ext_copy = lv_obj_get_ext(copy); ext->type = ext_copy->type; @@ -97,6 +95,9 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy) ext->hdiv_num = ext_copy->hdiv_num; ext->vdiv_num = ext_copy->vdiv_num; ext->pnum = ext_copy->pnum; + + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_chart); } return new_chart; @@ -138,7 +139,7 @@ bool lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param) } /** - * Allocate and add a data line t the chart + * Allocate and add a data line to the chart * @param chart pointer to a chart object * @return pointer to the allocated data lie (an array for the data points) */ @@ -289,6 +290,9 @@ lv_charts_t * lv_charts_get(lv_charts_builtin_t style, lv_charts_t * copy) case LV_CHARTS_DEF: style_p = &lv_charts_def; break; + case LV_CHARTS_TRANSP: + style_p = &lv_charts_transp; + break; default: style_p = &lv_charts_def; } @@ -344,10 +348,10 @@ static bool lv_chart_design(lv_obj_t * chart, const area_t * mask, lv_design_mod { if(mode == LV_DESIGN_COVER_CHK) { /*Return false if the object is not covers the mask_p area*/ - return ancestor_design_fp(chart, mask, mode); + return ancestor_design_f(chart, mask, mode); } else if(mode == LV_DESIGN_DRAW_MAIN) { /*Draw the rectangle ancient*/ - ancestor_design_fp(chart, mask, mode); + ancestor_design_f(chart, mask, mode); /*Draw the object*/ @@ -382,14 +386,16 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask) lv_chart_ext_t * ext = lv_obj_get_ext(chart); lv_charts_t * style = lv_obj_get_style(chart); + if(style->div_lines.objs.transp != 0) return; + uint8_t div_i; point_t p1; point_t p2; cord_t w = lv_obj_get_width(chart); cord_t h = lv_obj_get_height(chart); opa_t div_opa = (uint16_t)lv_obj_get_opa(chart) * style->div_line_opa / 100; - cord_t x_ofs = lv_obj_get_x(chart); - cord_t y_ofs = lv_obj_get_y(chart); + cord_t x_ofs = chart->cords.x1; + cord_t y_ofs = chart->cords.y1; p1.x = 0 + x_ofs; p2.x = w + x_ofs; for(div_i = 1; div_i <= ext->hdiv_num; div_i ++) { @@ -424,8 +430,8 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask) cord_t w = lv_obj_get_width(chart); cord_t h = lv_obj_get_height(chart); opa_t opa = (uint16_t)lv_obj_get_opa(chart) * style_p->data_opa / 100; - cord_t x_ofs = lv_obj_get_x(chart); - cord_t y_ofs = lv_obj_get_y(chart); + cord_t x_ofs = chart->cords.x1; + cord_t y_ofs = chart->cords.y1; int32_t y_tmp; cord_t ** y_data; uint8_t dl_cnt = 0; @@ -447,7 +453,7 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask) p1.x = p2.x; p1.y = p2.y; - p2.x = (w / (ext->pnum - 1)) * i + x_ofs; + p2.x = ((w * i) / (ext->pnum - 1)) + x_ofs; y_tmp = (int32_t)((int32_t) (*y_data)[i] - ext->ymin) * h; y_tmp = y_tmp / (ext->ymax - ext->ymin); @@ -474,8 +480,8 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask) cord_t w = lv_obj_get_width(chart); cord_t h = lv_obj_get_height(chart); opa_t opa = (uint16_t)lv_obj_get_opa(chart) * style_p->data_opa / 100; - cord_t x_ofs = lv_obj_get_x(chart); - cord_t y_ofs = lv_obj_get_y(chart); + cord_t x_ofs = chart->cords.x1; + cord_t y_ofs = chart->cords.y1; int32_t y_tmp; cord_t ** y_data; uint8_t dl_cnt = 0; @@ -493,7 +499,7 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask) rects.gcolor = color_mix(COLOR_BLACK, style_p->color[dl_cnt], style_p->dark_eff); for(i = 0; i < ext->pnum; i ++) { - cir_a.x1 = (w / (ext->pnum - 1)) * i + x_ofs; + cir_a.x1 = ((w * i) / (ext->pnum - 1)) + x_ofs; cir_a.x2 = cir_a.x1 + rad; cir_a.x1 -= rad; @@ -530,8 +536,8 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask) cord_t ** y_data; uint8_t dl_cnt = 0; lv_rects_t rects; - cord_t x_ofs = w / ((ext->dl_num + 1) * ext->pnum) / 2; /*Shift with a half col.*/ - + cord_t col_w = w / (2 * ext->dl_num * ext->pnum); /* Suppose (2 * dl_num) * pnum columns*/ + cord_t x_ofs = col_w / 2; /*Shift with a half col.*/ lv_rects_get(LV_RECTS_DEF, &rects); rects.bwidth = 0; rects.empty = 0; @@ -545,12 +551,16 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask) rects.gcolor = color_mix(COLOR_BLACK, style_p->color[dl_cnt], style_p->dark_eff); for(i = 0; i < ext->pnum; i ++) { - /*Calculate the x coordinates. Suppose (dl_num + 1) * pnum columns */ - col_a.x1 = (int32_t)((int32_t)w * (i * (ext->dl_num + 1) + dl_cnt)) / - (ext->pnum * (ext->dl_num + 1)) + chart->cords.x1; - col_a.x2 = (int32_t)((int32_t)w * (i * (ext->dl_num + 1) + dl_cnt + 1 )) / - (ext->pnum * (ext->dl_num + 1)) + chart->cords.x1 - 1; + /* Calculate the x coordinates. Suppose (2 * dl_num) * pnum columns and draw to every second + * the other columns will be spaces. + * col_w = w / (2 * ext->dl_num * ext->pnum) + * act_col_x = col_w * i * ext->dl_num * 2 + 2 * dl_cnt + * Reorder the operation to multiply first*/ + col_a.x1 = (int32_t)((int32_t) w * ((i * ext->dl_num * 2) + (2 * dl_cnt))) / + (ext->pnum * 2 * ext->dl_num); + col_a.x1 += chart->cords.x1; + col_a.x2 = col_a.x1 + col_w; col_a.x1 += x_ofs; col_a.x2 += x_ofs; @@ -587,17 +597,23 @@ static void lv_charts_init(void) lv_charts_def.div_line_opa = OPA_COVER; /*Data lines*/ - lv_charts_def.width = 3 * LV_DOWNSCALE; + lv_charts_def.width = 2 * LV_DOWNSCALE; lv_charts_def.data_opa = 100; lv_charts_def.dark_eff = 150; lv_charts_def.color[0] = COLOR_RED; - lv_charts_def.color[1] = COLOR_LIME; + lv_charts_def.color[1] = COLOR_GREEN; lv_charts_def.color[2] = COLOR_BLUE; lv_charts_def.color[3] = COLOR_MAGENTA; lv_charts_def.color[4] = COLOR_CYAN; lv_charts_def.color[5] = COLOR_YELLOW; lv_charts_def.color[6] = COLOR_WHITE; lv_charts_def.color[7] = COLOR_GRAY; + + + memcpy(&lv_charts_transp, &lv_charts_def, sizeof(lv_charts_t)); + lv_charts_transp.bg_rects.empty = 1; + lv_charts_transp.bg_rects.bwidth = 0; + lv_charts_transp.div_lines.objs.transp = 1; } #endif diff --git a/lv_objx/lv_chart.h b/lv_objx/lv_chart.h index 25182cfdd..54c09ae3b 100644 --- a/lv_objx/lv_chart.h +++ b/lv_objx/lv_chart.h @@ -10,7 +10,16 @@ * INCLUDES *********************/ #include "lv_conf.h" -#if USE_LV_CHARTBG != 0 +#if USE_LV_CHART != 0 + +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_chart: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + +#if USE_LV_LINE == 0 +#error "lv_chart: lv_line is required. Enable it in lv_conf.h (USE_LV_LINE 1) " +#endif #include "../lv_obj/lv_obj.h" #include "lv_rect.h" @@ -49,6 +58,7 @@ typedef struct typedef enum { LV_CHARTS_DEF, + LV_CHARTS_TRANSP, }lv_charts_builtin_t; /*Data of chart background*/ diff --git a/lv_objx/lv_img.c b/lv_objx/lv_img.c index 41a72181f..cd0d4d932 100644 --- a/lv_objx/lv_img.c +++ b/lv_objx/lv_img.c @@ -7,7 +7,8 @@ * INCLUDES *********************/ #include "lv_conf.h" -#if USE_LV_IMG != 0 +#include "misc_conf.h" +#if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0 #include "lv_img.h" #include "../lv_draw/lv_draw.h" @@ -55,32 +56,33 @@ lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy) /*Create a basic object*/ new_img = lv_obj_create(par, copy); + dm_assert(new_img); /*Extend the basic object to image object*/ - lv_obj_alloc_ext(new_img, sizeof(lv_img_ext_t)); + lv_img_ext_t * ext = lv_obj_alloc_ext(new_img, sizeof(lv_img_ext_t)); + dm_assert(ext); + ext->fn = NULL; + ext->w = lv_obj_get_width(new_img); + ext->h = lv_obj_get_height(new_img); + ext->transp = 0; /*Init the new object*/ lv_obj_set_signal_f(new_img, lv_img_signal); lv_obj_set_design_f(new_img, lv_img_design); - lv_img_ext_t * img_ext = lv_obj_get_ext(new_img); - if(copy == NULL) { - img_ext->fn = NULL; - img_ext->w = lv_obj_get_width(new_img); - img_ext->h = lv_obj_get_height(new_img); - img_ext->transp = 0; - - /*Enable auto size for non screens*/ - if(par != NULL) { - img_ext->auto_size = 1; - } else { - img_ext->auto_size = 0; - } + /* Enable auto size for non screens + * because image screens are wallpapers + * and must be screen sized*/ + if(par != NULL) ext->auto_size = 1; + else ext->auto_size = 0; lv_obj_set_style(new_img, lv_imgs_get(LV_IMGS_DEF, NULL)); } else { - img_ext->auto_size = LV_EA(copy, lv_img_ext_t)->auto_size; + ext->auto_size = lv_img_get_auto_size(copy); lv_img_set_file(new_img, LV_EA(copy, lv_img_ext_t)->fn); + + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_img); } return new_img; @@ -205,10 +207,7 @@ void lv_img_set_file(lv_obj_t * img, const char * fn) ext->w = header.w; ext->h = header.h; ext->transp = header.transp; -#if LV_UPSCALE_MAP != 0 - ext->w *= LV_DOWNSCALE; - ext->h *= LV_DOWNSCALE; -#endif + if(fn != NULL) { ext->fn = dm_realloc(ext->fn, strlen(fn) + 1); strcpy(ext->fn, fn); diff --git a/lv_objx/lv_img.h b/lv_objx/lv_img.h index 2f57bb0bd..b3ac611f4 100644 --- a/lv_objx/lv_img.h +++ b/lv_objx/lv_img.h @@ -10,7 +10,8 @@ * INCLUDES *********************/ #include "lv_conf.h" -#if USE_LV_IMG != 0 +#include "misc_conf.h" +#if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0 #include "../lv_obj/lv_obj.h" #include "misc/fs/fsint.h" diff --git a/lv_objx/lv_label.c b/lv_objx/lv_label.c index 0b2f1f693..401e454b6 100644 --- a/lv_objx/lv_label.c +++ b/lv_objx/lv_label.c @@ -31,6 +31,7 @@ * STATIC PROTOTYPES **********************/ static bool lv_label_design(lv_obj_t * label, const area_t * mask, lv_design_mode_t mode); +static void lv_label_refr_text(lv_obj_t * label); static void lv_labels_init(void); /********************** @@ -65,14 +66,17 @@ lv_obj_t * lv_label_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_alloc_ext(new_label, sizeof(lv_label_ext_t)); lv_label_ext_t * ext = lv_obj_get_ext(new_label); + dm_assert(ext); ext->txt = NULL; + ext->static_txt = 0; + ext->dot_end = LV_LABEL_DOT_END_INV; + ext->long_mode = LV_LABEL_LONG_EXPAND; lv_obj_set_design_f(new_label, lv_label_design); lv_obj_set_signal_f(new_label, lv_label_signal); /*Init the new label*/ if(copy == NULL) { - ext->dot_end = LV_LABEL_DOT_END_INV; lv_obj_set_opa(new_label, OPA_COVER); lv_obj_set_click(new_label, false); lv_obj_set_style(new_label, lv_labels_get(LV_LABELS_DEF, NULL)); @@ -81,8 +85,13 @@ lv_obj_t * lv_label_create(lv_obj_t * par, lv_obj_t * copy) } /*Copy 'copy' if not NULL*/ else { - lv_label_set_long_mode(new_label, lv_label_get_long_mode(copy)); - lv_label_set_text(new_label, lv_label_get_text(copy)); + lv_label_ext_t * copy_ext = lv_obj_get_ext(copy); + lv_label_set_long_mode(new_label, lv_label_get_long_mode(copy)); + if(copy_ext->static_txt == 0) lv_label_set_text(new_label, lv_label_get_text(copy)); + else lv_label_set_text_static(new_label, lv_label_get_text(copy)); + + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_label); } return new_label; } @@ -104,12 +113,14 @@ bool lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param) /* The object can be deleted so check its validity and then * make the object specific signal handling */ if(valid != false) { - lv_label_ext_t * label_p = lv_obj_get_ext(label); + lv_label_ext_t * ext = lv_obj_get_ext(label); /*No signal handling*/ switch(sign) { case LV_SIGNAL_CLEANUP: - dm_free(label_p->txt); - label_p->txt = NULL; + if(ext->static_txt == 0) { + dm_free(ext->txt); + ext->txt = NULL; + } break; case LV_SIGNAL_STYLE_CHG: lv_label_set_text(label, NULL); @@ -128,9 +139,9 @@ bool lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param) *====================*/ /** - * Set a new text for a label + * Set a new text for a label. Memory will be allocated to store the text by the label. * @param label pointer to a label object - * @param text '\0' terminated character string. If NULL then refresh with the current text. + * @param text '\0' terminated character string. NULL to refresh with the current text. */ void lv_label_set_text(lv_obj_t * label, const char * text) { @@ -138,131 +149,74 @@ void lv_label_set_text(lv_obj_t * label, const char * text) lv_label_ext_t * ext = lv_obj_get_ext(label); - /*If trying to set its own text then use NULL - * because NULL means text refresh*/ - if(text == ext->txt) text = NULL; + /*If trying to set its own text or the text is NULL then refresh */ + if(text == ext->txt || text == NULL) { + lv_label_refr_text(label); + return; + } /*Allocate space for the new text*/ - if(text != NULL) { - uint32_t len = strlen(text) + 1; - if(ext->txt != NULL) { - dm_free(ext->txt); - } - ext->txt = dm_alloc(len); - strcpy(ext->txt, text); - } - /*Do not allocate just use the current text*/ - else { - text = ext->txt; + uint32_t len = strlen(text) + 1; + if(ext->txt != NULL && ext->static_txt == 0) { + dm_free(ext->txt); } + ext->txt = dm_alloc(len); + strcpy(ext->txt, text); + ext->static_txt = 0; /*Now the text is dynamically allocated*/ - /*If 'text" still NULL then nothing to do: return*/ - if(text == NULL) return; - - cord_t max_w = lv_obj_get_width(label); - lv_labels_t * style = lv_obj_get_style(label); - const font_t * font = font_get(style->font); - - ext->dot_end = LV_LABEL_DOT_END_INV; /*Initialize the dot end index*/ - - /*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 = LV_CORD_MAX; - } - - /*Calc. the height and longest line*/ - point_t size; - txt_get_size(&size, ext->txt, font, style->letter_space, style->line_space, max_w); - - /*Refresh the full size in expand mode*/ - if(ext->long_mode == LV_LABEL_LONG_EXPAND || ext->long_mode == LV_LABEL_LONG_SCROLL) { - lv_obj_set_size(label, size.x, size.y); - - /*Start scrolling if the label is greater then its parent*/ - if(ext->long_mode == LV_LABEL_LONG_SCROLL) { - 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); - - anim_t anim; - anim.var = label; - anim.repeat = 1; - anim.playback = 1; - anim.start = font_get_width(font, ' '); - anim.act_time = 0; - anim.end_cb = NULL; - anim.path = anim_get_path(ANIM_PATH_LIN); - anim.time = 3000; - anim.playback_pause = LV_LABEL_SCROLL_PLAYBACK_PAUSE; - anim.repeat_pause = LV_LABEL_SCROLL_REPEAT_PAUSE; - - bool hor_anim = false; - 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(font, ' '); - anim.fp = (anim_fp_t) lv_obj_set_x; - anim.time = anim_speed_to_time(LV_LABEL_SCROLL_SPEED, anim.start, anim.end); - anim_create(&anim); - hor_anim = true; - } - - 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(font); - anim.fp = (anim_fp_t)lv_obj_set_y; - - /*Different animation speed if horizontal animation is created too*/ - if(hor_anim == false) { - anim.time = anim_speed_to_time(LV_LABEL_SCROLL_SPEED, anim.start, anim.end); - } else { - anim.time = anim_speed_to_time(LV_LABEL_SCROLL_SPEED_VER, anim.start, anim.end); - } - anim_create(&anim); - } - } - } - /*In break mode only the height can change*/ - else if (ext->long_mode == LV_LABEL_LONG_BREAK) { - lv_obj_set_height(label, size.y); - } - /*Replace the last 'LV_LABEL_DOT_NUM' characters with dots - * and save these characters*/ - else if(ext->long_mode == LV_LABEL_LONG_DOTS) { - point_t point; - point.x = lv_obj_get_width(label) - 1; - point.y = lv_obj_get_height(label) - 1; - uint16_t index = lv_label_get_letter_on(label, &point); - - if(index < strlen(text) - 1) { - - /* Change the last 'LV_LABEL_DOT_NUM' to dots - * (if there are at least 'LV_LABEL_DOT_NUM' characters*/ - if(index > LV_LABEL_DOT_NUM) { - uint8_t i; - for(i = 0; i < LV_LABEL_DOT_NUM; i++) { - ext->dot_tmp[i] = ext->txt[index - LV_LABEL_DOT_NUM + i]; - ext->txt[index - LV_LABEL_DOT_NUM + i] = '.'; - } - /*The last character is '\0'*/ - ext->dot_tmp[i] = ext->txt[index]; - ext->txt[index] = '\0'; - } - /*Else with short text change all characters to dots*/ - else { - uint8_t i; - for(i = 0; i < LV_LABEL_DOT_NUM; i++) { - ext->txt[i] = '.'; - } - ext->txt[i] = '\0'; - } - /*Save the dot end index*/ - ext->dot_end = index; - } - } - + lv_label_refr_text(label); +} +/** + * Set a new text for a label from a character array. The array don't has to be '\0' terminated. + * Memory will be allocated to store the array by the label. + * @param label pointer to a label object + * @param array array of characters or NULL to refresh the label + * @param size the size of 'array' in bytes + */ +void lv_label_set_text_array(lv_obj_t * label, const char * array, uint16_t size) +{ lv_obj_inv(label); + + lv_label_ext_t * ext = lv_obj_get_ext(label); + + /*If trying to set its own text or the array is NULL then refresh */ + if(array == ext->txt || array == NULL) { + lv_label_refr_text(label); + return; + } + + /*Allocate space for the new text*/ + if(ext->txt != NULL && ext->static_txt == 0) { + dm_free(ext->txt); + } + ext->txt = dm_alloc(size + 1); + memcpy(ext->txt, array, size); + ext->txt[size] = '\0'; + ext->static_txt = 0; /*Now the text is dynamically allocated*/ + + lv_label_refr_text(label); } +/** + * Set a static text. It will not be saved by the label so the 'text' variable + * has to be 'alive' while the label exist. + * @param label pointer to a label object + * @param text pointer to a text. NULL to refresh with the current text. + */ +void lv_label_set_text_static(lv_obj_t * label, const char * text) +{ + lv_label_ext_t * ext = lv_obj_get_ext(label); + if(ext->static_txt == 0 && ext->txt != NULL) { + dm_free(ext->txt); + } + + if(text != NULL) { + ext->static_txt = 1; + ext->txt = (char *) text; + } + + lv_label_refr_text(label); +} /** * Set the behavior of the label with longer text then the object size * @param label pointer to a label object @@ -288,7 +242,7 @@ void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode) } ext->long_mode = long_mode; - lv_label_set_text(label, NULL); + lv_label_refr_text(label); } /*===================== @@ -503,6 +457,120 @@ static bool lv_label_design(lv_obj_t * label, const area_t * mask, lv_design_mod return true; } +/** + * Refresh the label with its text stored in its extended data + * @param label pointer to a label object + */ +static void lv_label_refr_text(lv_obj_t * label) +{ + lv_label_ext_t * ext = lv_obj_get_ext(label); + + if(ext->txt == NULL) return; + + cord_t max_w = lv_obj_get_width(label); + lv_labels_t * style = lv_obj_get_style(label); + const font_t * font = font_get(style->font); + + ext->dot_end = LV_LABEL_DOT_END_INV; /*Initialize the dot end index*/ + + /*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 = LV_CORD_MAX; + } + + /*Calc. the height and longest line*/ + point_t size; + txt_get_size(&size, ext->txt, font, style->letter_space, style->line_space, max_w); + + /*Refresh the full size in expand mode*/ + if(ext->long_mode == LV_LABEL_LONG_EXPAND || ext->long_mode == LV_LABEL_LONG_SCROLL) { + lv_obj_set_size(label, size.x, size.y); + + /*Start scrolling if the label is greater then its parent*/ + if(ext->long_mode == LV_LABEL_LONG_SCROLL) { + 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); + + anim_t anim; + anim.var = label; + anim.repeat = 1; + anim.playback = 1; + anim.start = font_get_width(font, ' '); + anim.act_time = 0; + anim.end_cb = NULL; + anim.path = anim_get_path(ANIM_PATH_LIN); + anim.time = 3000; + anim.playback_pause = LV_LABEL_SCROLL_PLAYBACK_PAUSE; + anim.repeat_pause = LV_LABEL_SCROLL_REPEAT_PAUSE; + + bool hor_anim = false; + 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(font, ' '); + anim.fp = (anim_fp_t) lv_obj_set_x; + anim.time = anim_speed_to_time(LV_LABEL_SCROLL_SPEED, anim.start, anim.end); + anim_create(&anim); + hor_anim = true; + } + + 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(font); + anim.fp = (anim_fp_t)lv_obj_set_y; + + /*Different animation speed if horizontal animation is created too*/ + if(hor_anim == false) { + anim.time = anim_speed_to_time(LV_LABEL_SCROLL_SPEED, anim.start, anim.end); + } else { + anim.time = anim_speed_to_time(LV_LABEL_SCROLL_SPEED_VER, anim.start, anim.end); + } + anim_create(&anim); + } + } + } + /*In break mode only the height can change*/ + else if (ext->long_mode == LV_LABEL_LONG_BREAK) { + lv_obj_set_height(label, size.y); + } + /*Replace the last 'LV_LABEL_DOT_NUM' characters with dots + * and save these characters*/ + else if(ext->long_mode == LV_LABEL_LONG_DOTS) { + point_t point; + point.x = lv_obj_get_width(label) - 1; + point.y = lv_obj_get_height(label) - 1; + uint16_t index = lv_label_get_letter_on(label, &point); + + if(index < strlen(ext->txt) - 1) { + + /* Change the last 'LV_LABEL_DOT_NUM' to dots + * (if there are at least 'LV_LABEL_DOT_NUM' characters*/ + if(index > LV_LABEL_DOT_NUM) { + uint8_t i; + for(i = 0; i < LV_LABEL_DOT_NUM; i++) { + ext->dot_tmp[i] = ext->txt[index - LV_LABEL_DOT_NUM + i]; + ext->txt[index - LV_LABEL_DOT_NUM + i] = '.'; + } + /*The last character is '\0'*/ + ext->dot_tmp[i] = ext->txt[index]; + ext->txt[index] = '\0'; + } + /*Else with short text change all characters to dots*/ + else { + uint8_t i; + for(i = 0; i < LV_LABEL_DOT_NUM; i++) { + ext->txt[i] = '.'; + } + ext->txt[i] = '\0'; + } + /*Save the dot end index*/ + ext->dot_end = index; + } + } + + lv_obj_inv(label); +} + /** * Initialize the label styles */ diff --git a/lv_objx/lv_label.h b/lv_objx/lv_label.h index 4d09affa8..0b8ce94b1 100644 --- a/lv_objx/lv_label.h +++ b/lv_objx/lv_label.h @@ -60,8 +60,9 @@ typedef struct /*New data for this type */ char * txt; lv_label_long_mode_t long_mode; - char dot_tmp[LV_LABEL_DOT_NUM + 10]; /*Store character which are replaced with dots*/ - uint16_t dot_end; /*The text end in dot mode*/ + char dot_tmp[LV_LABEL_DOT_NUM]; /*Store character which are replaced with dots*/ + uint16_t dot_end; /* The text end in dot mode*/ + uint8_t static_txt :1; /* Flag to indicate the text is static*/ }lv_label_ext_t; /********************** @@ -73,6 +74,8 @@ bool lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param); lv_labels_t * lv_labels_get(lv_labels_builtin_t style, lv_labels_t * copy); void lv_label_set_text(lv_obj_t * label, const char * text); +void lv_label_set_text_array(lv_obj_t * label, const char * array, uint16_t size); +void lv_label_set_text_static(lv_obj_t * label, const char * text); void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode); const char * lv_label_get_text(lv_obj_t * label); lv_label_long_mode_t lv_label_get_long_mode(lv_obj_t * label); diff --git a/lv_objx/lv_led.c b/lv_objx/lv_led.c index a64a54d5e..c4a183ae2 100644 --- a/lv_objx/lv_led.c +++ b/lv_objx/lv_led.c @@ -64,13 +64,13 @@ lv_obj_t * lv_led_create(lv_obj_t * par, lv_obj_t * copy) /*Allocate the object type specific extended data*/ lv_led_ext_t * ext = lv_obj_alloc_ext(new_led, sizeof(lv_led_ext_t)); dm_assert(ext); + ext->bright = LV_LED_BRIGHTNESS_DEF; lv_obj_set_signal_f(new_led, lv_led_signal); lv_obj_set_design_f(new_led, lv_led_design); /*Init the new led object*/ if(copy == NULL) { - ext->bright = LV_LED_BRIGHTNESS_DEF; lv_obj_set_style(new_led, lv_leds_get(LV_LEDS_DEF, NULL)); lv_obj_set_size_us(new_led, 40, 40); } @@ -78,6 +78,9 @@ lv_obj_t * lv_led_create(lv_obj_t * par, lv_obj_t * copy) else { lv_led_ext_t * copy_ext = lv_obj_get_ext(copy); ext->bright = copy_ext->bright; + + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_led); } return new_led; diff --git a/lv_objx/lv_led.h b/lv_objx/lv_led.h index 71dcdc946..0ca8e0e82 100644 --- a/lv_objx/lv_led.h +++ b/lv_objx/lv_led.h @@ -12,6 +12,11 @@ #include "lv_conf.h" #if USE_LV_LED != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_led: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + #include "../lv_obj/lv_obj.h" /********************* diff --git a/lv_objx/lv_line.c b/lv_objx/lv_line.c index 1b1f72e8d..aa869f8cd 100644 --- a/lv_objx/lv_line.c +++ b/lv_objx/lv_line.c @@ -64,16 +64,18 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy) /*Extend the basic object to rectangle object*/ lv_line_ext_t * ext = lv_obj_alloc_ext(new_line, sizeof(lv_line_ext_t)); + dm_assert(ext); + ext->point_num = 0; + ext->point_array = NULL; + ext->auto_size = 1; + ext->y_inv = 0; + ext->upscale = 0; + lv_obj_set_design_f(new_line, lv_line_design); lv_obj_set_signal_f(new_line, lv_line_signal); /*Init the new rectangle*/ if(copy == NULL) { - ext->point_num = 0; - ext->point_array = NULL; - ext->auto_size = 1; - ext->y_inv = 0; - ext->upscale = 0; lv_obj_set_style(new_line, lv_lines_get(LV_LINES_DEF, NULL)); } /*Copy an existing object*/ @@ -84,9 +86,10 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy) lv_line_set_upscale(new_line,lv_line_get_upscale(copy)); lv_line_set_points(new_line, LV_EA(copy, lv_line_ext_t)->point_array, LV_EA(copy, lv_line_ext_t)->point_num); + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_line); } - return new_line; } diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index f4ad85e46..8043d1e83 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -34,7 +34,8 @@ static void lv_lists_init(void); * STATIC VARIABLES **********************/ static lv_lists_t lv_lists_def; -static lv_lists_t lv_lists_tight; +static lv_lists_t lv_lists_scrl; +static lv_lists_t lv_lists_transp; /********************** * MACROS @@ -60,18 +61,22 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_t * new_list = lv_page_create(par, copy); dm_assert(new_list); lv_list_ext_t * ext = lv_obj_alloc_ext(new_list, sizeof(lv_list_ext_t)); + dm_assert(ext); + ext ->fit = LV_LIST_FIT_WIDTH_SB; lv_obj_set_signal_f(new_list, lv_list_signal); /*Init the new list object*/ if(copy == NULL) { - ext ->fit = LV_LIST_FIT_HOLDER; lv_obj_set_size_us(new_list, 120, 150); lv_obj_set_style(new_list, lv_lists_get(LV_LISTS_DEF, NULL)); - lv_rect_set_layout(LV_EA(new_list, lv_list_ext_t)->page_ext.scrolling, LV_LIST_LAYOUT_DEF); + lv_rect_set_layout(LV_EA(new_list, lv_list_ext_t)->page_ext.scrl, LV_LIST_LAYOUT_DEF); } else { lv_list_ext_t * copy_ext = lv_obj_get_ext(copy); ext ->fit = copy_ext->fit; + + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_list); } return new_list; @@ -123,6 +128,7 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l lv_page_glue_obj(liste, true); lv_rect_set_layout(liste, lists->liste_layout); lv_rect_set_fit(liste, true, true); /*hor. fit might be disabled later*/ +// lv_btn_set_state(liste, LV_BTN_STATE_TGL_REL); if(img_fn != NULL) { lv_obj_t * img = lv_img_create(liste, NULL); @@ -139,12 +145,17 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l } /*Make the size adjustment*/ - if(ext->fit == LV_LIST_FIT_HOLDER) { + if(ext->fit == LV_LIST_FIT_WIDTH || ext->fit == LV_LIST_FIT_WIDTH_SB) { /*Now the width will be adjusted (so disable hor. auto fit)*/ lv_rect_set_fit(liste, false, true); cord_t w = lv_obj_get_width(list); - w -= lists->bg_pages.bg_rects.hpad * 2; - w -= lists->bg_pages.scrable_rects.hpad * 2; + cord_t hpad_tot = lists->bg_pages.bg_rects.hpad + lists->bg_pages.scrl_rects.hpad; + w -= hpad_tot * 2; + + /*Make place for the scrollbar if hpad_tot is too small*/ + if(ext->fit == LV_LIST_FIT_WIDTH_SB) { + if(hpad_tot < lists->bg_pages.sb_width) w -= lists->bg_pages.sb_width - hpad_tot; + } lv_obj_set_width(liste, w); } else if(ext->fit == LV_LIST_FIT_LONGEST) { /*In this case the width will be adjusted*/ @@ -249,6 +260,17 @@ lv_list_fit_t lv_list_get_fit(lv_obj_t * list) return LV_EA(list, lv_list_ext_t)->fit; } +/** + * Get the text of a list element + * @param liste pointer to list element + * @return pointer to the text + */ +const char * lv_list_element_get_txt(lv_obj_t * liste) +{ + /*The last child is the label*/ + lv_obj_t * label = lv_obj_get_child(liste, NULL); + return lv_label_get_text(label); +} /** * Return with a pointer to a built-in style and/or copy it to a variable @@ -270,11 +292,13 @@ lv_lists_t * lv_lists_get(lv_lists_builtin_t style, lv_lists_t * list) switch(style) { case LV_LISTS_DEF: - case LV_LISTS_GAP: - style_p = &lv_lists_def; - break; - case LV_LISTS_TIGHT: - style_p = &lv_lists_tight; + style_p = &lv_lists_def; + break; + case LV_LISTS_SCRL: + style_p = &lv_lists_scrl; + break; + case LV_LISTS_TRANSP: + style_p = &lv_lists_transp; break; default: style_p = &lv_lists_def; @@ -323,32 +347,98 @@ static bool lv_list_design(lv_obj_t * list, const area_t * mask, lv_design_mode_ static void lv_lists_init(void) { /*Default style*/ - lv_pages_get(LV_PAGES_TRANSP, &lv_lists_def.bg_pages); + lv_pages_get(LV_PAGES_DEF, &lv_lists_def.bg_pages); lv_lists_def.bg_pages.bg_rects.vpad = 0 * LV_DOWNSCALE; lv_lists_def.bg_pages.bg_rects.hpad = 0 * LV_DOWNSCALE; lv_lists_def.bg_pages.bg_rects.opad = 0 * LV_DOWNSCALE; - lv_lists_def.bg_pages.scrable_rects.vpad = 10 * LV_DOWNSCALE; - lv_lists_def.bg_pages.scrable_rects.hpad = 10 * LV_DOWNSCALE; - lv_lists_def.bg_pages.scrable_rects.opad = 5 * LV_DOWNSCALE; + lv_lists_def.bg_pages.scrl_rects.vpad = 0 * LV_DOWNSCALE; + lv_lists_def.bg_pages.scrl_rects.hpad = 0 * LV_DOWNSCALE; + lv_lists_def.bg_pages.scrl_rects.opad = 5 * LV_DOWNSCALE; lv_btns_get(LV_BTNS_DEF, &lv_lists_def.liste_btns); /*List element button style*/ + lv_lists_def.liste_btns.mcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0x90, 0xa8, 0xc0); + lv_lists_def.liste_btns.gcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0x90, 0xa8, 0xc0); + lv_lists_def.liste_btns.bcolor[LV_BTN_STATE_REL] = COLOR_BLACK; + lv_lists_def.liste_btns.lcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0x30, 0x40, 0x50); + lv_lists_def.liste_btns.flags[LV_BTN_STATE_REL].light_en = 0; + lv_lists_def.liste_btns.flags[LV_BTN_STATE_REL].transp = 0; + lv_lists_def.liste_btns.flags[LV_BTN_STATE_REL].empty = 0; - lv_labels_get(LV_LABELS_BTN, &lv_lists_def.liste_labels); /*List element label style*/ + lv_lists_def.liste_btns.mcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x40, 0x60, 0x80);// COLOR_MAKE(0x60, 0x80, 0xa0); + lv_lists_def.liste_btns.gcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x40, 0x60, 0x80);//COLOR_MAKE(0x20, 0x30, 0x40); + lv_lists_def.liste_btns.bcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x20, 0x30, 0x40); + lv_lists_def.liste_btns.lcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x30, 0x40, 0x50); + lv_lists_def.liste_btns.flags[LV_BTN_STATE_PR].light_en = 0; + lv_lists_def.liste_btns.flags[LV_BTN_STATE_PR].transp = 0; + lv_lists_def.liste_btns.flags[LV_BTN_STATE_PR].empty = 0; + + lv_lists_def.liste_btns.mcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x20, 0x30, 0x40); + lv_lists_def.liste_btns.gcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x20, 0x30, 0x40); + lv_lists_def.liste_btns.bcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x20, 0x30, 0x40); + lv_lists_def.liste_btns.lcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x30, 0x40, 0x50); + lv_lists_def.liste_btns.flags[LV_BTN_STATE_TGL_REL].light_en = 0; + lv_lists_def.liste_btns.flags[LV_BTN_STATE_TGL_REL].transp = 0; + lv_lists_def.liste_btns.flags[LV_BTN_STATE_TGL_REL].empty = 0; + + lv_lists_def.liste_btns.mcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x40, 0x60, 0x80); + lv_lists_def.liste_btns.gcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x40, 0x60, 0x80); + lv_lists_def.liste_btns.bcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x20, 0x30, 0x40); + lv_lists_def.liste_btns.lcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x30, 0x40, 0x50); + lv_lists_def.liste_btns.flags[LV_BTN_STATE_TGL_PR].light_en = 0; + lv_lists_def.liste_btns.flags[LV_BTN_STATE_TGL_PR].transp = 0; + lv_lists_def.liste_btns.flags[LV_BTN_STATE_TGL_PR].empty = 0; + + lv_lists_def.liste_btns.mcolor[LV_BTN_STATE_INA] = COLOR_SILVER; + lv_lists_def.liste_btns.gcolor[LV_BTN_STATE_INA] = COLOR_GRAY; + lv_lists_def.liste_btns.bcolor[LV_BTN_STATE_INA] = COLOR_WHITE; + lv_lists_def.liste_btns.lcolor[LV_BTN_STATE_INA] = COLOR_MAKE(0x30, 0x40, 0x50); + lv_lists_def.liste_btns.flags[LV_BTN_STATE_INA].light_en = 0; + lv_lists_def.liste_btns.flags[LV_BTN_STATE_INA].transp= 0; + lv_lists_def.liste_btns.flags[LV_BTN_STATE_INA].empty = 0; + + lv_lists_def.liste_btns.rects.objs.color = lv_lists_def.liste_btns.mcolor[LV_BTN_STATE_REL]; + lv_lists_def.liste_btns.rects.gcolor = lv_lists_def.liste_btns.gcolor[LV_BTN_STATE_REL]; + lv_lists_def.liste_btns.rects.bcolor = lv_lists_def.liste_btns.bcolor[LV_BTN_STATE_REL]; + lv_lists_def.liste_btns.rects.objs.transp = 0; + lv_lists_def.liste_btns.rects.empty = 0; + lv_lists_def.liste_btns.rects.light = 6 * LV_DOWNSCALE; + lv_lists_def.liste_btns.rects.bwidth = 0 * LV_DOWNSCALE; + lv_lists_def.liste_btns.rects.bopa = 70; + lv_lists_def.liste_btns.rects.empty = 0; + lv_lists_def.liste_btns.rects.round = 0 * LV_DOWNSCALE; + + lv_labels_get(LV_LABELS_DEF, &lv_lists_def.liste_labels); /*List element label style*/ lv_lists_def.liste_labels.mid = 0; lv_imgs_get(LV_IMGS_DEF, &lv_lists_def.liste_imgs); /*Lit element image style*/ lv_lists_def.liste_layout = LV_RECT_LAYOUT_ROW_M; - memcpy(&lv_lists_tight, &lv_lists_def, sizeof(lv_lists_t)); - lv_lists_tight.bg_pages.bg_rects.vpad = 0 * LV_DOWNSCALE; - lv_lists_tight.bg_pages.bg_rects.hpad = 0 * LV_DOWNSCALE; - lv_lists_tight.bg_pages.bg_rects.opad = 0 * LV_DOWNSCALE; + /*Only the scrollable part is visible style*/ + memcpy(&lv_lists_scrl, &lv_lists_def, sizeof(lv_lists_t)); + lv_pages_get(LV_PAGES_TRANSP, &lv_lists_scrl.bg_pages); + lv_lists_scrl.bg_pages.bg_rects.vpad = 0 * LV_DOWNSCALE; + lv_lists_scrl.bg_pages.bg_rects.hpad = 0 * LV_DOWNSCALE; + lv_lists_scrl.bg_pages.bg_rects.opad = 0 * LV_DOWNSCALE; - lv_lists_tight.bg_pages.scrable_rects.vpad = 0 * LV_DOWNSCALE; - lv_lists_tight.bg_pages.scrable_rects.hpad = 0 * LV_DOWNSCALE; - lv_lists_tight.bg_pages.scrable_rects.opad = 0 * LV_DOWNSCALE; + lv_lists_scrl.bg_pages.scrl_rects.objs.transp = 0; + lv_lists_scrl.bg_pages.scrl_rects.empty = 0; + lv_lists_scrl.bg_pages.scrl_rects.bwidth = 1 * LV_DOWNSCALE; + lv_lists_scrl.bg_pages.scrl_rects.vpad = 0 * LV_DOWNSCALE; + lv_lists_scrl.bg_pages.scrl_rects.hpad = 0 * LV_DOWNSCALE; + lv_lists_scrl.bg_pages.scrl_rects.opad = 0 * LV_DOWNSCALE; + + /*Transparent list background*/ + memcpy(&lv_lists_transp, &lv_lists_def, sizeof(lv_lists_t)); + lv_pages_get(LV_PAGES_TRANSP, &lv_lists_transp.bg_pages); + lv_lists_transp.bg_pages.bg_rects.vpad = 0 * LV_DOWNSCALE; + lv_lists_transp.bg_pages.bg_rects.hpad = 0 * LV_DOWNSCALE; + lv_lists_transp.bg_pages.bg_rects.opad = 0 * LV_DOWNSCALE; + + lv_lists_transp.bg_pages.scrl_rects.vpad = 0 * LV_DOWNSCALE; + lv_lists_transp.bg_pages.scrl_rects.hpad = 0 * LV_DOWNSCALE; + lv_lists_transp.bg_pages.scrl_rects.opad = 5 * LV_DOWNSCALE; } #endif diff --git a/lv_objx/lv_list.h b/lv_objx/lv_list.h index 97755d972..e0bb81089 100644 --- a/lv_objx/lv_list.h +++ b/lv_objx/lv_list.h @@ -12,6 +12,19 @@ #include "lv_conf.h" #if USE_LV_LIST != 0 +/*Testing of dependencies*/ +#if USE_LV_BTN == 0 +#error "lv_list: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) " +#endif + +#if USE_LV_LABEL == 0 +#error "lv_list: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) " +#endif + +#if USE_LV_IMG == 0 +#error "lv_list: lv_img is required. Enable it in lv_conf.h (USE_LV_IMG 1) " +#endif + #include "../lv_obj/lv_obj.h" #include "lv_page.h" #include "lv_btn.h" @@ -41,14 +54,15 @@ typedef struct typedef enum { LV_LISTS_DEF, - LV_LISTS_GAP, - LV_LISTS_TIGHT, + LV_LISTS_SCRL, + LV_LISTS_TRANSP, }lv_lists_builtin_t; typedef enum { + LV_LIST_FIT_WIDTH, + LV_LIST_FIT_WIDTH_SB, /*Let space for the scrollbar*/ LV_LIST_FIT_CONTENT, - LV_LIST_FIT_HOLDER, LV_LIST_FIT_LONGEST, }lv_list_fit_t; @@ -72,6 +86,7 @@ void lv_list_down(lv_obj_t * list); void lv_list_up(lv_obj_t * list); void lv_list_set_fit(lv_obj_t * list, lv_list_fit_t fit); lv_list_fit_t lv_list_get_fit(lv_obj_t * list); +const char * lv_list_element_get_txt(lv_obj_t * liste); /********************** * MACROS diff --git a/lv_objx/lv_mbox.c b/lv_objx/lv_mbox.c index 25977756f..f53fa9328 100644 --- a/lv_objx/lv_mbox.c +++ b/lv_objx/lv_mbox.c @@ -27,7 +27,7 @@ #if 0 /*Unused*/ static bool lv_mbox_design(lv_obj_t * mbox, const area_t * mask, lv_design_mode_t mode); #endif -static void lv_temps_init(void); +static void lv_mboxs_init(void); static void lv_mbox_realign(lv_obj_t * mbox); /********************** @@ -62,13 +62,13 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy) /*Allocate the message box type specific extended data*/ lv_mbox_ext_t * ext = lv_obj_alloc_ext(new_mbox, sizeof(lv_mbox_ext_t)); dm_assert(ext); + ext->txt = NULL; + ext->title = NULL; + ext->btnh = NULL; /*The signal and design functions are not copied so set them here*/ lv_obj_set_signal_f(new_mbox, lv_mbox_signal); - /* Let the design function of rect - lv_obj_set_design_f(new_mbox, lv_mbox_design); */ - /*Init the new message box message box*/ if(copy == NULL) { lv_rect_set_layout(new_mbox, LV_RECT_LAYOUT_COL_L); @@ -85,15 +85,20 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy) lv_rect_set_layout(ext->btnh, LV_RECT_LAYOUT_PRETTY); lv_obj_set_style(new_mbox, lv_mboxs_get(LV_MBOXS_DEF, NULL)); - - lv_mbox_realign(new_mbox); } /*Copy an existing message box*/ else { -// lv_mbox_ext_t * copy_ext = lv_obj_get_ext(copy); - /*TODO*/ + lv_mbox_ext_t * copy_ext = lv_obj_get_ext(copy); + ext->title = lv_label_create(new_mbox, copy_ext->title); + ext->txt = lv_label_create(new_mbox, copy_ext->txt); + ext->btnh = lv_rect_create(new_mbox, copy_ext->btnh); + + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_mbox); } + lv_mbox_realign(new_mbox); + return new_mbox; } @@ -308,7 +313,7 @@ lv_mboxs_t * lv_mboxs_get(lv_mboxs_builtin_t style, lv_mboxs_t * copy) /*Make the style initialization if it is not done yet*/ if(style_inited == false) { - lv_temps_init(); + lv_mboxs_init(); style_inited = true; } @@ -368,7 +373,7 @@ static bool lv_mbox_design(lv_obj_t * mbox, const area_t * mask, lv_design_mode_ /** * Initialize the message box styles */ -static void lv_temps_init(void) +static void lv_mboxs_init(void) { /*Default style*/ lv_rects_get(LV_RECTS_DEF, &lv_mboxs_def.bg); @@ -407,6 +412,4 @@ static void lv_mbox_realign(lv_obj_t * mbox) lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); } - - #endif diff --git a/lv_objx/lv_mbox.h b/lv_objx/lv_mbox.h index 840754bd9..d6099fad2 100644 --- a/lv_objx/lv_mbox.h +++ b/lv_objx/lv_mbox.h @@ -12,6 +12,20 @@ #include "lv_conf.h" #if USE_LV_MBOX != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_mbox: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + +#if USE_LV_BTN == 0 +#error "lv_mbox: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) " +#endif + +#if USE_LV_LABEL == 0 +#error "lv_mbox: lv_rlabel is required. Enable it in lv_conf.h (USE_LV_LABEL 1) " +#endif + + #include "../lv_obj/lv_obj.h" #include "lv_rect.h" #include "lv_btn.h" diff --git a/lv_objx/lv_objx_templ.c b/lv_objx/lv_objx_templ.c index e4e6c3fe6..b6178a14d 100644 --- a/lv_objx/lv_objx_templ.c +++ b/lv_objx/lv_objx_templ.c @@ -58,24 +58,30 @@ lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy) { /*Create the ancestor template*/ /*TODO modify it to the ancestor create function */ - lv_obj_t * new_templ = lv_obj_create(par, copy); + lv_obj_t * new_templ = lv_ANCESTOR_create(par, copy); dm_assert(new_templ); /*Allocate the template type specific extended data*/ lv_templ_ext_t * ext = lv_obj_alloc_ext(new_templ, sizeof(lv_templ_ext_t)); dm_assert(ext); + /*Initialize the allocated 'ext' */ + + /*The signal and design functions are not copied so set them here*/ lv_obj_set_signal_f(new_templ, lv_templ_signal); lv_obj_set_design_f(new_templ, lv_templ_design); /*Init the new template template*/ if(copy == NULL) { - + lv_obj_set_style(new_templ, lv_templs_get(LV_TEMPLS_DEF, NULL)); } /*Copy an existing template*/ else { lv_templ_ext_t * copy_ext = lv_obj_get_ext(copy); + + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_templ); } return new_templ; @@ -94,7 +100,7 @@ bool lv_templ_signal(lv_obj_t * templ, lv_signal_t sign, void * param) /* Include the ancient signal function */ /* TODO update it to the ancestor's signal function*/ - valid = lv_obj_signal(templ, sign, param); + valid = lv_ANCESTOR_signal(templ, sign, param); /* The object can be deleted so check its validity and then * make the object specific signal handling */ @@ -171,20 +177,25 @@ lv_templs_t * lv_templs_get(lv_templs_builtin_t style, lv_templs_t * copy) */ static bool lv_templ_design(lv_obj_t * templ, const 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) { - /*Return false if the object is not covers the mask_p area*/ return false; } - - /*Draw the object*/ + else if(mode == LV_DESIGN_DRAW_MAIN) { + + } + /*Post draw when the children are drawn*/ + else if(mode == LV_DESIGN_DRAW_POST) { + + } return true; } /** - * Initialize the template styles + * Initialize the built-in template styles */ static void lv_temps_init(void) { diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index 9b5f4988c..95011178b 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -29,13 +29,14 @@ **********************/ static void lv_page_sb_refresh(lv_obj_t * main); static bool lv_page_design(lv_obj_t * page, const area_t * mask, lv_design_mode_t mode); -static bool lv_scrolling_signal(lv_obj_t * page, lv_signal_t sign, void* param); +static bool lv_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void* param); static void lv_pages_init(void); /********************** * STATIC VARIABLES **********************/ static lv_pages_t lv_pages_def; +static lv_pages_t lv_pages_simple; static lv_pages_t lv_pages_transp; static lv_design_f_t ancestor_design_f; @@ -66,20 +67,24 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy) /*Allocate the object type specific extended data*/ lv_page_ext_t * ext = lv_obj_alloc_ext(new_page, sizeof(lv_page_ext_t)); dm_assert(ext); + ext->scrl = NULL; + ext->pr_action = NULL; + ext->rel_action = NULL; + ext->sbh_draw = 0; + ext->sbv_draw = 0; - if(ancestor_design_f == NULL) { - ancestor_design_f = lv_obj_get_design_f(new_page); - } + if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_page); /*Init the new page object*/ if(copy == NULL) { lv_pages_t * pages = lv_pages_get(LV_PAGES_DEF, NULL); - ext->scrolling = lv_rect_create(new_page, NULL); - lv_obj_set_signal_f(ext->scrolling, lv_scrolling_signal); - lv_obj_set_drag(ext->scrolling, true); - lv_obj_set_drag_throw(ext->scrolling, true); - lv_rect_set_fit(ext->scrolling, true, true); - lv_obj_set_style(ext->scrolling, &pages->scrable_rects); + ext->scrl = lv_rect_create(new_page, NULL); + lv_obj_set_signal_f(ext->scrl, lv_scrl_signal); + lv_obj_set_drag(ext->scrl, true); + lv_obj_set_drag_throw(ext->scrl, true); + lv_obj_set_protect(ext->scrl, LV_PROTECT_PARENT); + lv_rect_set_fit(ext->scrl, true, true); + lv_obj_set_style(ext->scrl, &pages->scrl_rects); /* Add the signal function only if 'scrolling' is created * because everything has to be ready before any signal is received*/ @@ -88,14 +93,19 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_set_style(new_page, pages); } else { lv_page_ext_t * copy_ext = lv_obj_get_ext(copy); - ext->scrolling = lv_rect_create(new_page, copy_ext->scrolling); - lv_obj_set_signal_f(ext->scrolling, lv_scrolling_signal); + ext->scrl = lv_rect_create(new_page, copy_ext->scrl); + lv_obj_set_signal_f(ext->scrl, lv_scrl_signal); + + lv_page_set_pr_action(new_page, copy_ext->pr_action); + lv_page_set_rel_action(new_page, copy_ext->rel_action); /* Add the signal function only if 'scrolling' is created * because everything has to be ready before any signal is received*/ lv_obj_set_signal_f(new_page, lv_page_signal); lv_obj_set_design_f(new_page, lv_page_design); - lv_obj_set_style(new_page, lv_obj_get_style(copy)); + + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_page); } lv_page_sb_refresh(new_page); @@ -124,13 +134,13 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) lv_pages_t * pages = lv_obj_get_style(page); lv_obj_t * child; switch(sign) { - case LV_SIGNAL_CHILD_CHG: /*Be sure, only scrollable object is on the page*/ + case LV_SIGNAL_CHILD_CHG: /*Move children to the scrollable object*/ child = lv_obj_get_child(page, NULL); while(child != NULL) { - if(child != ext->scrolling) { + if(lv_obj_is_protected(child, LV_PROTECT_PARENT) == false) { lv_obj_t * tmp = child; child = lv_obj_get_child(page, child); /*Get the next child before move this*/ - lv_obj_set_parent(tmp, ext->scrolling); + lv_obj_set_parent(tmp, ext->scrl); } else { child = lv_obj_get_child(page, child); } @@ -140,7 +150,7 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) case LV_SIGNAL_STYLE_CHG: area_set_height(&ext->sbh, pages->sb_width); area_set_width(&ext->sbv, pages->sb_width); - lv_obj_set_style(ext->scrolling, &pages->scrable_rects); + lv_obj_set_style(ext->scrl, &pages->scrl_rects); if(pages->sb_mode == LV_PAGE_SB_MODE_ON) { ext->sbh_draw = 1; @@ -154,9 +164,16 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) break; case LV_SIGNAL_CORD_CHG: - if(ext->scrolling != NULL) { - ext->scrolling->signal_f(ext->scrolling, LV_SIGNAL_CORD_CHG, &ext->scrolling->cords); + /*Refresh the scrollbar and notify the scrl if the size is changed*/ + if(ext->scrl != NULL && + (lv_obj_get_width(page) != area_get_width(param) || + lv_obj_get_height(page) != area_get_height(param))) { + ext->scrl->signal_f(ext->scrl, LV_SIGNAL_CORD_CHG, &ext->scrl->cords); + + /*The scrolbars are important olny if they are visible now*/ + if(ext->sbh_draw != 0 || ext->sbv_draw != 0) lv_page_sb_refresh(page); + } break; case LV_SIGNAL_PRESSED: @@ -182,16 +199,16 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) /** * Signal function of the scrollable part of a page - * @param scrolling pointer to the scrollable object + * @param scrl pointer to the scrollable object * @param sign a signal type from lv_signal_t enum * @param param pointer to a signal specific variable */ -static bool lv_scrolling_signal(lv_obj_t * scrolling, lv_signal_t sign, void* param) +static bool lv_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void* param) { bool obj_valid = true; /* Include the ancient signal function */ - obj_valid = lv_rect_signal(scrolling, sign, param); + obj_valid = lv_rect_signal(scrl, sign, param); /* The object can be deleted so check its validity and then * make the object specific signal handling */ @@ -203,17 +220,17 @@ static bool lv_scrolling_signal(lv_obj_t * scrolling, lv_signal_t sign, void* pa bool refr_y = false; area_t page_cords; area_t obj_cords; - lv_obj_t * page = lv_obj_get_parent(scrolling); - lv_pages_t * pages = lv_obj_get_style(page); + lv_obj_t * page = lv_obj_get_parent(scrl); + lv_pages_t * style = lv_obj_get_style(page); lv_page_ext_t * page_ext = lv_obj_get_ext(page); - cord_t hpad = pages->bg_rects.hpad; - cord_t vpad = pages->bg_rects.vpad; + cord_t hpad = style->bg_rects.hpad; + cord_t vpad = style->bg_rects.vpad; switch(sign) { case LV_SIGNAL_CORD_CHG: - new_x = lv_obj_get_x(scrolling); - new_y = lv_obj_get_y(scrolling); - lv_obj_get_cords(scrolling, &obj_cords); + new_x = lv_obj_get_x(scrl); + new_y = lv_obj_get_y(scrl); + lv_obj_get_cords(scrl, &obj_cords); lv_obj_get_cords(page, &page_cords); /*scrollable width smaller then page width? -> align to left*/ @@ -252,31 +269,46 @@ static bool lv_scrolling_signal(lv_obj_t * scrolling, lv_signal_t sign, void* pa } } if(refr_x != false || refr_y != false) { - lv_obj_set_pos(scrolling, new_x, new_y); + lv_obj_set_pos(scrl, new_x, new_y); } lv_page_sb_refresh(page); break; case LV_SIGNAL_DRAG_BEGIN: - if(pages->sb_mode == LV_PAGE_SB_MODE_AUTO ) { - if(area_get_height(&page_ext->sbv) < lv_obj_get_height(scrolling) - pages->sb_width) { + if(style->sb_mode == LV_PAGE_SB_MODE_DRAG ) { + cord_t sbh_pad = max(style->sb_width, style->bg_rects.hpad); + cord_t sbv_pad = max(style->sb_width, style->bg_rects.vpad); + if(area_get_height(&page_ext->sbv) < lv_obj_get_height(scrl) - 2 * sbv_pad) { page_ext->sbv_draw = 1; - lv_inv_area(&page_ext->sbv); } - if(area_get_width(&page_ext->sbh) < lv_obj_get_width(scrolling) - pages->sb_width) { + if(area_get_width(&page_ext->sbh) < lv_obj_get_width(scrl) - 2 * sbh_pad) { page_ext->sbh_draw = 1; - lv_inv_area(&page_ext->sbh); } } break; case LV_SIGNAL_DRAG_END: - if(pages->sb_mode == LV_PAGE_SB_MODE_AUTO) { - page_ext->sbh_draw = 0; - page_ext->sbv_draw = 0; - lv_inv_area(&page_ext->sbh); - lv_inv_area(&page_ext->sbv); + if(style->sb_mode == LV_PAGE_SB_MODE_DRAG) { + area_t sb_area_tmp; + if(page_ext->sbh_draw != 0) { + area_cpy(&sb_area_tmp, &page_ext->sbh); + sb_area_tmp.x1 += page->cords.x1; + sb_area_tmp.y1 += page->cords.y1; + sb_area_tmp.x2 += page->cords.x2; + sb_area_tmp.y2 += page->cords.y2; + lv_inv_area(&sb_area_tmp); + page_ext->sbh_draw = 0; + } + if(page_ext->sbv_draw != 0) { + area_cpy(&sb_area_tmp, &page_ext->sbv); + sb_area_tmp.x1 += page->cords.x1; + sb_area_tmp.y1 += page->cords.y1; + sb_area_tmp.x2 += page->cords.x2; + sb_area_tmp.y2 += page->cords.y2; + lv_inv_area(&sb_area_tmp); + page_ext->sbv_draw = 0; + } } break; case LV_SIGNAL_PRESSED: @@ -346,13 +378,12 @@ void lv_page_glue_obj(lv_obj_t * obj, bool glue) */ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, bool anim_en) { - lv_page_ext_t * ext = lv_obj_get_ext(page); lv_pages_t * style = lv_obj_get_style(page); - cord_t obj_y = lv_obj_get_y(obj); + cord_t obj_y = obj->cords.y1 - ext->scrl->cords.y1; cord_t obj_h = lv_obj_get_height(obj); - cord_t scrlable_y = lv_obj_get_y(ext->scrolling); + cord_t scrlable_y = lv_obj_get_y(ext->scrl); cord_t page_h = lv_obj_get_height(page); bool refr = false; @@ -363,38 +394,38 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, bool anim_en) /*If obj is higher then the page focus where the "error" is smaller*/ /*Out of the page on the top*/ if((obj_h <= page_h && top_err > 0) || - (obj_h > page_h && top_err >= bot_err)) { + (obj_h > page_h && top_err < bot_err)) { /*Calculate a new position and to let scrable_rects.vpad space above*/ - scrlable_y = -(obj_y - style->scrable_rects.vpad - style->bg_rects.vpad); - scrlable_y += style->scrable_rects.vpad; + scrlable_y = -(obj_y - style->scrl_rects.vpad - style->bg_rects.vpad); + scrlable_y += style->scrl_rects.vpad; refr = true; } /*Out of the page on the bottom*/ else if((obj_h <= page_h && bot_err > 0) || - (obj_h > page_h && top_err < bot_err)) { + (obj_h > page_h && top_err >= bot_err)) { /*Calculate a new position and to let scrable_rects.vpad space below*/ scrlable_y = -obj_y; scrlable_y += page_h - obj_h; - scrlable_y -= style->scrable_rects.vpad; + scrlable_y -= style->scrl_rects.vpad; refr = true; } if(refr != false) { #if LV_PAGE_ANIM_FOCUS_TIME == 0 - lv_obj_set_y(ext->scrolling, scrlable_y); + lv_obj_set_y(ext->scrl, scrlable_y); #else if(anim_en == false) { - lv_obj_set_y(ext->scrolling, scrlable_y); + lv_obj_set_y(ext->scrl, scrlable_y); } else { anim_t a; a.act_time = 0; - a.start = lv_obj_get_y(ext->scrolling); + a.start = lv_obj_get_y(ext->scrl); a.end = scrlable_y; a.time = LV_PAGE_ANIM_FOCUS_TIME;//anim_speed_to_time(LV_PAGE_ANIM_SPEED, a.start, a.end); a.end_cb = NULL; a.playback = 0; a.repeat = 0; - a.var = ext->scrolling; + a.var = ext->scrl; a.path = anim_get_path(ANIM_PATH_LIN); a.fp = (anim_fp_t) lv_obj_set_y; @@ -413,11 +444,11 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, bool anim_en) * @param page pointer to page object * @return pointer to rectangle which is the scrollable part of the page */ -lv_obj_t * lv_page_get_scrable(lv_obj_t * page) +lv_obj_t * lv_page_get_scrl(lv_obj_t * page) { lv_page_ext_t * ext = lv_obj_get_ext(page); - return ext->scrolling; + return ext->scrl; } /** @@ -442,6 +473,9 @@ lv_pages_t * lv_pages_get(lv_pages_builtin_t style, lv_pages_t * copy) case LV_PAGES_DEF: style_p = &lv_pages_def; break; + case LV_PAGES_SIMPLE: + style_p = &lv_pages_simple; + break; case LV_PAGES_TRANSP: style_p = &lv_pages_transp; break; @@ -485,12 +519,25 @@ static bool lv_page_design(lv_obj_t * page, const area_t * mask, lv_design_mode_ opa_t sb_opa = lv_obj_get_opa(page) * style->sb_opa /100; /*Draw the scrollbars*/ + area_t sb_area; if(ext->sbh_draw != 0) { - lv_draw_rect(&ext->sbh, mask, &style->sb_rects, sb_opa); + /*Convert the relative coordinates to absolute*/ + area_cpy(&sb_area, &ext->sbh); + sb_area.x1 += page->cords.x1; + sb_area.y1 += page->cords.y1; + sb_area.x2 += page->cords.x1; + sb_area.y2 += page->cords.y1; + lv_draw_rect(&sb_area, mask, &style->sb_rects, sb_opa); } if(ext->sbv_draw != 0) { - lv_draw_rect(&ext->sbv, mask, &style->sb_rects, sb_opa); + /*Convert the relative coordinates to absolute*/ + area_cpy(&sb_area, &ext->sbv); + sb_area.x1 += page->cords.x1; + sb_area.y1 += page->cords.y1; + sb_area.x2 += page->cords.x1; + sb_area.y2 += page->cords.y1; + lv_draw_rect(&sb_area, mask, &style->sb_rects, sb_opa); } } @@ -503,63 +550,100 @@ static bool lv_page_design(lv_obj_t * page, const area_t * mask, lv_design_mode_ */ static void lv_page_sb_refresh(lv_obj_t * page) { + /*Always let sb_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 */ + lv_page_ext_t * page_ext = lv_obj_get_ext(page); - lv_pages_t * pages = lv_obj_get_style(page); - lv_obj_t * scrolling = page_ext->scrolling; + lv_pages_t * style = lv_obj_get_style(page); + lv_obj_t * scrl = page_ext->scrl; cord_t size_tmp; - cord_t scrolling_w = lv_obj_get_width(scrolling); - cord_t scrolling_h = lv_obj_get_height(scrolling); - cord_t hpad = pages->bg_rects.hpad; - cord_t vpad = pages->bg_rects.vpad; + cord_t scrl_w = lv_obj_get_width(scrl); + cord_t scrl_h = lv_obj_get_height(scrl); + cord_t hpad = style->bg_rects.hpad; + cord_t vpad = style->bg_rects.vpad; cord_t obj_w = lv_obj_get_width(page); cord_t obj_h = lv_obj_get_height(page); - cord_t page_x0 = page->cords.x1; - cord_t page_y0 = page->cords.y1; + cord_t sbh_pad = max(style->sb_width, style->bg_rects.hpad); + cord_t sbv_pad = max(style->sb_width, style->bg_rects.vpad); + if(style->sb_mode == LV_PAGE_SB_MODE_OFF) return; - if(pages->sb_mode == LV_PAGE_SB_MODE_OFF) return; + if(style->sb_mode == LV_PAGE_SB_MODE_ON) { + page_ext->sbh_draw = 1; + page_ext->sbv_draw = 1; + } /*Invalidate the current (old) scrollbar areas*/ - if(page_ext->sbh_draw != 0) lv_inv_area(&page_ext->sbh); - if(page_ext->sbv_draw != 0) lv_inv_area(&page_ext->sbv); + area_t sb_area_tmp; + if(page_ext->sbh_draw != 0) { + area_cpy(&sb_area_tmp, &page_ext->sbh); + sb_area_tmp.x1 += page->cords.x1; + sb_area_tmp.y1 += page->cords.y1; + sb_area_tmp.x2 += page->cords.x2; + sb_area_tmp.y2 += page->cords.y2; + lv_inv_area(&sb_area_tmp); + } + if(page_ext->sbv_draw != 0) { + area_cpy(&sb_area_tmp, &page_ext->sbv); + sb_area_tmp.x1 += page->cords.x1; + sb_area_tmp.y1 += page->cords.y1; + sb_area_tmp.x2 += page->cords.x2; + sb_area_tmp.y2 += page->cords.y2; + lv_inv_area(&sb_area_tmp); + } /*Horizontal scrollbar*/ - if(scrolling_w <= obj_w - 2 * hpad) { /*Full sized scroll bar*/ - area_set_width(&page_ext->sbh, obj_w - pages->sb_width); - area_set_pos(&page_ext->sbh, page_x0, page_y0 + obj_h - pages->sb_width); + if(scrl_w <= obj_w - 2 * hpad) { /*Full sized scroll bar*/ + area_set_width(&page_ext->sbh, obj_w - 2 * sbh_pad); + area_set_pos(&page_ext->sbh, sbh_pad, obj_h - style->sb_width); + if(style->sb_mode == LV_PAGE_SB_MODE_AUTO) page_ext->sbh_draw = 0; } else { - if(pages->sb_mode == LV_PAGE_SB_MODE_ON) { - page_ext->sbh_draw = 1; - } - size_tmp = (((obj_w - hpad) * (obj_w - pages->sb_width)) / scrolling_w); + size_tmp = (obj_w * (obj_w - (2 * sbh_pad))) / (scrl_w + 2 * hpad); area_set_width(&page_ext->sbh, size_tmp); - area_set_pos(&page_ext->sbh, page_x0 + - ( -(lv_obj_get_x(scrolling) - hpad) * (obj_w - size_tmp - pages->sb_width)) / - (scrolling_w - obj_w + 2 * hpad), - page_y0 + obj_h - pages->sb_width); + area_set_pos(&page_ext->sbh, sbh_pad + + (-(lv_obj_get_x(scrl) - hpad) * (obj_w - size_tmp - 2 * sbh_pad)) / + (scrl_w + 2 * hpad - obj_w ), obj_h - style->sb_width); + + if(style->sb_mode == LV_PAGE_SB_MODE_AUTO) page_ext->sbh_draw = 1; } /*Vertical scrollbar*/ - if(scrolling_h <= obj_h - 2 * vpad) { /*Full sized scroll bar*/ - area_set_height(&page_ext->sbv, obj_h - pages->sb_width); - area_set_pos(&page_ext->sbv, page_x0 + obj_w - pages->sb_width, 0); + if(scrl_h <= obj_h - 2 * vpad) { /*Full sized scroll bar*/ + area_set_height(&page_ext->sbv, obj_h - 2 * sbv_pad); + area_set_pos(&page_ext->sbv, obj_w - style->sb_width, sbv_pad); + if(style->sb_mode == LV_PAGE_SB_MODE_AUTO) page_ext->sbv_draw = 0; } else { - if(pages->sb_mode == LV_PAGE_SB_MODE_ON) { - page_ext->sbv_draw = 1; - } - size_tmp = (((obj_h - vpad) * (obj_h - pages->sb_width)) / scrolling_h); + size_tmp = (obj_h * (obj_h - (2 * sbv_pad))) / (scrl_h + 2 * vpad); area_set_height(&page_ext->sbv, size_tmp); - area_set_pos(&page_ext->sbv, page_x0 + obj_w - pages->sb_width, - page_y0 + - (-(lv_obj_get_y(scrolling) - vpad) * (obj_h - size_tmp - pages->sb_width)) / - (scrolling_h - obj_h + 2 * vpad)); + area_set_pos(&page_ext->sbv, obj_w - style->sb_width, + sbv_pad + + (-(lv_obj_get_y(scrl) - vpad) * (obj_h - size_tmp - 2 * sbv_pad)) / + (scrl_h + 2 * vpad - obj_h )); + + if(style->sb_mode == LV_PAGE_SB_MODE_AUTO) page_ext->sbv_draw = 1; } /*Invalidate the new scrollbar areas*/ - if(page_ext->sbh_draw != 0) lv_inv_area(&page_ext->sbh); - if(page_ext->sbv_draw != 0) lv_inv_area(&page_ext->sbv); + if(page_ext->sbh_draw != 0) { + area_cpy(&sb_area_tmp, &page_ext->sbh); + sb_area_tmp.x1 += page->cords.x1; + sb_area_tmp.y1 += page->cords.y1; + sb_area_tmp.x2 += page->cords.x2; + sb_area_tmp.y2 += page->cords.y2; + lv_inv_area(&sb_area_tmp); + } + if(page_ext->sbv_draw != 0) { + area_cpy(&sb_area_tmp, &page_ext->sbv); + sb_area_tmp.x1 += page->cords.x1; + sb_area_tmp.y1 += page->cords.y1; + sb_area_tmp.x2 += page->cords.x2; + sb_area_tmp.y2 += page->cords.y2; + lv_inv_area(&sb_area_tmp); + } } /** @@ -570,10 +654,10 @@ static void lv_pages_init(void) /*Default style*/ lv_rects_get(LV_RECTS_DEF, &lv_pages_def.bg_rects); - lv_rects_get(LV_RECTS_DEF, &lv_pages_def.scrable_rects); - lv_pages_def.scrable_rects.objs.color = COLOR_WHITE; - lv_pages_def.scrable_rects.gcolor = COLOR_SILVER; - lv_pages_def.scrable_rects.bcolor = COLOR_GRAY; + lv_rects_get(LV_RECTS_DEF, &lv_pages_def.scrl_rects); + lv_pages_def.scrl_rects.objs.color = COLOR_WHITE; + lv_pages_def.scrl_rects.gcolor = COLOR_SILVER; + lv_pages_def.scrl_rects.bcolor = COLOR_GRAY; lv_rects_get(LV_RECTS_DEF, &lv_pages_def.sb_rects); lv_pages_def.sb_rects.objs.color = COLOR_BLACK; @@ -586,11 +670,21 @@ static void lv_pages_init(void) lv_pages_def.sb_opa=50; lv_pages_def.sb_mode = LV_PAGE_SB_MODE_AUTO; - /*Transparent style*/ - memcpy(&lv_pages_transp, &lv_pages_def, sizeof(lv_pages_t)); - lv_pages_transp.scrable_rects.objs.transp = 1; - lv_pages_transp.scrable_rects.empty = 1; - lv_pages_transp.scrable_rects.bwidth = 0; + /*No (transparent) scrollable style*/ + memcpy(&lv_pages_simple, &lv_pages_def, sizeof(lv_pages_t)); + lv_rects_get(LV_RECTS_TRANSP, &lv_pages_simple.scrl_rects); + lv_pages_simple.scrl_rects.vpad = 0 * LV_DOWNSCALE; + lv_pages_simple.scrl_rects.hpad = 0 * LV_DOWNSCALE; + /*Transparent style*/ + memcpy(&lv_pages_transp, &lv_pages_simple, sizeof(lv_pages_t)); + lv_rects_get(LV_RECTS_TRANSP, &lv_pages_transp.bg_rects); + lv_pages_transp.bg_rects.vpad = 10 * LV_DOWNSCALE; + lv_pages_transp.bg_rects.hpad = 10 * LV_DOWNSCALE; + lv_pages_transp.bg_rects.opad = 10 * LV_DOWNSCALE; + /* Make transparent bg. only witth bwidth = 0 nad empty = 1 + * because with transp = 1 the design function will not be called + * to draw the scrollbars*/ + lv_pages_transp.bg_rects.objs.transp = 0; } #endif diff --git a/lv_objx/lv_page.h b/lv_objx/lv_page.h index 28351e476..38e64f991 100644 --- a/lv_objx/lv_page.h +++ b/lv_objx/lv_page.h @@ -12,6 +12,11 @@ #include "lv_conf.h" #if USE_LV_PAGE != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_page: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + #include "../lv_obj/lv_obj.h" #include "lv_rect.h" @@ -26,7 +31,8 @@ typedef enum { LV_PAGE_SB_MODE_OFF, LV_PAGE_SB_MODE_ON, - LV_PAGE_SB_MODE_AUTO, + LV_PAGE_SB_MODE_DRAG, + LV_PAGE_SB_MODE_AUTO, }lv_page_sb_mode_t; @@ -35,7 +41,7 @@ typedef struct { lv_rects_t bg_rects; /*Style of ancestor*/ /*New style element for this type */ - lv_rects_t scrable_rects; + lv_rects_t scrl_rects; lv_rects_t sb_rects; cord_t sb_width; lv_page_sb_mode_t sb_mode; @@ -46,6 +52,7 @@ typedef struct typedef enum { LV_PAGES_DEF, + LV_PAGES_SIMPLE, LV_PAGES_TRANSP, }lv_pages_builtin_t; @@ -54,7 +61,7 @@ typedef struct { lv_rect_ext_t rect_ext; /*Ext. of ancestor*/ /*New data for this type */ - lv_obj_t * scrolling; /*The scrollable object on the background*/ + lv_obj_t * scrl; /*The scrollable object on the background*/ lv_action_t rel_action; lv_action_t pr_action; area_t sbh; /*Horizontal scrollbar*/ @@ -76,7 +83,7 @@ void lv_page_set_rel_action(lv_obj_t * page, lv_action_t rel_action); void lv_page_set_pr_action(lv_obj_t * page, lv_action_t pr_action); void lv_page_glue_obj(lv_obj_t * page, bool glue); void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, bool anim_en); -lv_obj_t * lv_page_get_scrable(lv_obj_t * page); +lv_obj_t * lv_page_get_scrl(lv_obj_t * page); /********************** * MACROS diff --git a/lv_objx/lv_pb.c b/lv_objx/lv_pb.c index 159ba1b6a..bee074166 100644 --- a/lv_objx/lv_pb.c +++ b/lv_objx/lv_pb.c @@ -35,7 +35,7 @@ static void lv_pbs_init(void); * STATIC VARIABLES **********************/ static lv_pbs_t lv_pbs_def; -static lv_design_f_t ancestor_design_fp; +static lv_design_f_t ancestor_design_f; /********************** * MACROS @@ -64,27 +64,28 @@ lv_obj_t * lv_pb_create(lv_obj_t * par, lv_obj_t * copy) /*Allocate the object type specific extended data*/ lv_pb_ext_t * ext = lv_obj_alloc_ext(new_pb, sizeof(lv_pb_ext_t)); dm_assert(ext); + ext->min_value = 0; + ext->max_value = 100; + ext->act_value = 0; + ext->format_str = NULL; + ext->label = NULL; /* Save the rectangle design function. * It will be used in the progress bar design function*/ - if(ancestor_design_fp == NULL) { - ancestor_design_fp = lv_obj_get_design_f(new_pb); - } + if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_pb); + + lv_obj_set_signal_f(new_pb, lv_pb_signal); + lv_obj_set_design_f(new_pb, lv_pb_design); /*Init the new progress bar object*/ if(copy == NULL) { ext->format_str = dm_alloc(strlen(LV_PB_DEF_FORMAT) + 1); strcpy(ext->format_str, LV_PB_DEF_FORMAT); - ext->min_value = 0; - ext->max_value = 100; - ext->act_value = 0; - lv_label_create(new_pb, NULL); + ext->label = lv_label_create(new_pb, NULL); lv_rect_set_layout(new_pb, LV_RECT_LAYOUT_CENTER); - lv_obj_set_signal_f(new_pb, lv_pb_signal); lv_obj_set_style(new_pb, lv_pbs_get(LV_PBS_DEF, NULL)); - lv_obj_set_design_f(new_pb, lv_pb_design); lv_pb_set_value(new_pb, ext->act_value); } else { @@ -94,6 +95,12 @@ lv_obj_t * lv_pb_create(lv_obj_t * par, lv_obj_t * copy) ext->min_value = ext_copy->min_value; ext->max_value = ext_copy->max_value; ext->act_value = ext_copy->act_value; + ext->label = lv_label_create(new_pb, ext_copy->label); + + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_pb); + + lv_pb_set_value(new_pb, ext->act_value); } return new_pb; @@ -116,6 +123,7 @@ bool lv_pb_signal(lv_obj_t * pb, lv_signal_t sign, void * param) * make the object specific signal handling */ if(valid != false) { lv_pb_ext_t * ext = lv_obj_get_ext(pb); + lv_pbs_t * style = lv_obj_get_style(pb); switch(sign) { case LV_SIGNAL_CORD_CHG: @@ -123,7 +131,12 @@ bool lv_pb_signal(lv_obj_t * pb, lv_signal_t sign, void * param) break; case LV_SIGNAL_CLEANUP: dm_free(ext->format_str); + ext->format_str = NULL; break; + case LV_SIGNAL_STYLE_CHG: + lv_obj_set_style(ext->label, &style->label); + lv_pb_set_value(pb, lv_pb_get_value(pb)); + break; default: break; } @@ -148,7 +161,7 @@ void lv_pb_set_value(lv_obj_t * pb, uint16_t value) char buf[LV_PB_TXT_MAX_LENGTH]; sprintf(buf, ext->format_str, ext->act_value); - lv_label_set_text(lv_obj_get_child(pb, NULL), buf); + lv_label_set_text(ext->label, buf); lv_obj_inv(pb); } @@ -251,22 +264,31 @@ lv_pbs_t * lv_pbs_get(lv_pbs_builtin_t style, lv_pbs_t * copy) */ static bool lv_pb_design(lv_obj_t * pb, const area_t * mask, lv_design_mode_t mode) { - if(ancestor_design_fp == NULL) return false; + if(ancestor_design_f == NULL) return false; if(mode == LV_DESIGN_COVER_CHK) { /*Return false if the object is not covers the mask_p area*/ - return ancestor_design_fp(pb, mask, mode); + return ancestor_design_f(pb, mask, mode); } else if(mode == LV_DESIGN_DRAW_MAIN) { - ancestor_design_fp(pb, mask, mode); + ancestor_design_f(pb, mask, mode); lv_pb_ext_t * ext = lv_obj_get_ext(pb); area_t bar_area; uint32_t tmp; area_cpy(&bar_area, &pb->cords); - tmp = (uint32_t)ext->act_value * lv_obj_get_width(pb); - tmp = (uint32_t) tmp / (ext->max_value - ext->min_value); - bar_area.x2 = bar_area.x1 + (cord_t) tmp; + cord_t w = lv_obj_get_width(pb); + cord_t h = lv_obj_get_height(pb); + + if(w >= h) { + tmp = (uint32_t)ext->act_value * w; + tmp = (uint32_t) tmp / (ext->max_value - ext->min_value); + bar_area.x2 = bar_area.x1 + (cord_t) tmp; + } else { + tmp = (uint32_t)ext->act_value * h; + tmp = (uint32_t) tmp / (ext->max_value - ext->min_value); + bar_area.y1 = bar_area.y2 - (cord_t) tmp; + } lv_pbs_t * style_p = lv_obj_get_style(pb); lv_draw_rect(&bar_area, mask, &style_p->bar, OPA_COVER); } @@ -291,6 +313,7 @@ static void lv_pbs_init(void) lv_labels_get(LV_LABELS_DEF, &lv_pbs_def.label); lv_pbs_def.label.objs.color = COLOR_MAKE(0x20, 0x20, 0x20); + lv_pbs_def.label.line_space = 0; } #endif diff --git a/lv_objx/lv_pb.h b/lv_objx/lv_pb.h index 4f50da372..cf096a233 100644 --- a/lv_objx/lv_pb.h +++ b/lv_objx/lv_pb.h @@ -12,6 +12,15 @@ #include "lv_conf.h" #if USE_LV_PB != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_pb: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + +#if USE_LV_LABEL == 0 +#error "lv_pb: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) " +#endif + #include "../lv_obj/lv_obj.h" #include "lv_rect.h" #include "lv_label.h" @@ -43,6 +52,7 @@ typedef struct { lv_rect_ext_t rect_ext; /*Ext. of ancestor*/ /*New data for this type */ + lv_obj_t * label; uint16_t act_value; uint16_t min_value; uint16_t max_value; diff --git a/lv_objx/lv_rect.c b/lv_objx/lv_rect.c index b7030c7f5..a9262ad74 100644 --- a/lv_objx/lv_rect.c +++ b/lv_objx/lv_rect.c @@ -77,22 +77,29 @@ lv_obj_t * lv_rect_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_t * new_rect = lv_obj_create(par, copy); dm_assert(new_rect); lv_obj_alloc_ext(new_rect, sizeof(lv_rect_ext_t)); - lv_rect_ext_t * rect_ext = lv_obj_get_ext(new_rect); + lv_rect_ext_t * ext = lv_obj_get_ext(new_rect); + dm_assert(ext); + ext->hfit_en = 0; + ext->vfit_en = 0; + ext->layout = LV_RECT_LAYOUT_OFF; + lv_obj_set_design_f(new_rect, lv_rect_design); lv_obj_set_signal_f(new_rect, lv_rect_signal); /*Init the new rectangle*/ if(copy == NULL) { lv_obj_set_style(new_rect, lv_rects_get(LV_RECTS_DEF, NULL)); - rect_ext->hfit_en = 0; - rect_ext->vfit_en = 0; } /*Copy an existing object*/ else { lv_rect_ext_t * copy_ext = lv_obj_get_ext(copy); - rect_ext->hfit_en = copy_ext->hfit_en; - rect_ext->vfit_en = copy_ext->vfit_en; - rect_ext->layout = copy_ext->layout; + ext->hfit_en = copy_ext->hfit_en; + ext->vfit_en = copy_ext->vfit_en; + ext->layout = copy_ext->layout; + + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_rect); + } return new_rect; @@ -333,7 +340,7 @@ static void lv_rect_draw_light(lv_obj_t * rect, const area_t * mask) light_style.empty = 1; light_style.bwidth = light_size; - light_style.round = style->round + light_size; + light_style.round = style->round + light_size + 1; light_style.bcolor = style->lcolor; light_style.bopa = 100; @@ -399,7 +406,7 @@ static void lv_rect_layout_col(lv_obj_t * rect) switch(type) { case LV_RECT_LAYOUT_COL_L: - hpad_corr = style->hpad; + hpad_corr = style->hpad; align = LV_ALIGN_IN_TOP_LEFT; break; case LV_RECT_LAYOUT_COL_M: @@ -418,17 +425,18 @@ static void lv_rect_layout_col(lv_obj_t * rect) /* Disable child change action because the children will be moved a lot * an unnecessary child change signals could be sent*/ - rect->child_chg_off = 1; + lv_obj_set_protect(rect, LV_PROTECT_CHILD_CHG); /* Align the children */ cord_t last_cord = style->vpad; LL_READ_BACK(rect->child_ll, child) { - if(lv_obj_get_hidden(child) != false) continue; + if(lv_obj_get_hidden(child) != false || + lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue; lv_obj_align(child, rect, align, hpad_corr , last_cord); last_cord += lv_obj_get_height(child) + style->opad; } - rect->child_chg_off = 0; + lv_obj_clr_protect(rect, LV_PROTECT_CHILD_CHG); } /** @@ -466,18 +474,19 @@ static void lv_rect_layout_row(lv_obj_t * rect) /* Disable child change action because the children will be moved a lot * an unnecessary child change signals could be sent*/ - rect->child_chg_off = 1; + lv_obj_set_protect(rect, LV_PROTECT_CHILD_CHG); /* Align the children */ cord_t last_cord = style->hpad; LL_READ_BACK(rect->child_ll, child) { - if(lv_obj_get_hidden(child) != false) continue; + if(lv_obj_get_hidden(child) != false || + lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue; lv_obj_align(child, rect, align, last_cord, vpad_corr); last_cord += lv_obj_get_width(child) + style->opad; } - rect->child_chg_off = 0; + lv_obj_clr_protect(rect, LV_PROTECT_CHILD_CHG); } /** @@ -502,18 +511,19 @@ static void lv_rect_layout_center(lv_obj_t * rect) /* Disable child change action because the children will be moved a lot * an unnecessary child change signals could be sent*/ - rect->child_chg_off = 1; + lv_obj_set_protect(rect, LV_PROTECT_CHILD_CHG); /* Align the children */ cord_t last_cord = - (h_tot / 2); LL_READ_BACK(rect->child_ll, child) { - if(lv_obj_get_hidden(child) != false) continue; + if(lv_obj_get_hidden(child) != false || + lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue; lv_obj_align(child, rect, LV_ALIGN_CENTER, 0, last_cord + lv_obj_get_height(child) / 2); last_cord += lv_obj_get_height(child) + style->opad; } - rect->child_chg_off = 0; + lv_obj_clr_protect(rect, LV_PROTECT_CHILD_CHG); } /** @@ -535,7 +545,7 @@ static void lv_rect_layout_pretty(lv_obj_t * rect) child_rs = ll_get_tail(&rect->child_ll); /*Set the row starter child*/ if(child_rs == NULL) return; /*Return if no child*/ - rect->child_chg_off = 1; + lv_obj_set_protect(rect, LV_PROTECT_CHILD_CHG); child_rc = child_rs; /*Initially the the row starter and closer is the same*/ while(child_rs != NULL) { @@ -543,8 +553,10 @@ static void lv_rect_layout_pretty(lv_obj_t * rect) cord_t w_row = style->hpad * 2; /*The width is minimum the left-right hpad*/ uint32_t obj_num = 0; - /*Find the row closer object and collect some data*/ do { - if(lv_obj_get_hidden(child_rc) == false) { + /*Find the row closer object and collect some data*/ + do { + if(lv_obj_get_hidden(child_rc) == false && + lv_obj_is_protected(child_rc, LV_PROTECT_POS) == false) { if(w_row + lv_obj_get_width(child_rc) > w_obj) break; /*If the next object is already not fit then break*/ w_row += lv_obj_get_width(child_rc) + style->opad; /*Add the object width + opad*/ h_row = max(h_row, lv_obj_get_height(child_rc)); /*Search the highest object*/ @@ -575,7 +587,8 @@ static void lv_rect_layout_pretty(lv_obj_t * rect) cord_t act_x = style->hpad; /*x init*/ child_tmp = child_rs; do{ - if(lv_obj_get_hidden(child_tmp) == false) { + if(lv_obj_get_hidden(child_tmp) == false && + lv_obj_is_protected(child_tmp, LV_PROTECT_POS) == false) { lv_obj_align(child_tmp, rect, LV_ALIGN_IN_TOP_LEFT, act_x, act_y); act_x += lv_obj_get_width(child_tmp) + new_opad; } @@ -589,7 +602,7 @@ static void lv_rect_layout_pretty(lv_obj_t * rect) child_rs = ll_get_prev(&rect->child_ll, child_rc); /*Go to the next object*/ child_rc = child_rs; } - rect->child_chg_off = 0; + lv_obj_clr_protect(rect, LV_PROTECT_CHILD_CHG); } /** @@ -614,14 +627,15 @@ static void lv_rect_layout_grid(lv_obj_t * rect) /* Disable child change action because the children will be moved a lot * an unnecessary child change signals could be sent*/ - rect->child_chg_off = 1; + lv_obj_set_protect(rect, LV_PROTECT_CHILD_CHG); /* Align the children */ cord_t act_x = style->hpad; cord_t act_y = style->vpad; uint16_t obj_cnt = 0; LL_READ_BACK(rect->child_ll, child) { - if(lv_obj_get_hidden(child) != false) continue; + if(lv_obj_get_hidden(child) != false || + lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue; if(obj_row > 1) { lv_obj_set_pos(child, act_x, act_y); @@ -638,8 +652,7 @@ static void lv_rect_layout_grid(lv_obj_t * rect) } } - rect->child_chg_off = 0; - + lv_obj_clr_protect(rect, LV_PROTECT_CHILD_CHG); } /** diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index 00646160e..fce2d90ed 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -17,6 +17,8 @@ /********************* * DEFINES *********************/ +#define LV_TA_DEF_WIDTH (120 * LV_DOWNSCALE) +#define LV_TA_DEF_HEIGHT (80 * LV_DOWNSCALE) /********************** * TYPEDEFS @@ -35,9 +37,11 @@ static void lv_tas_init(void); * STATIC VARIABLES **********************/ static lv_tas_t lv_tas_def; +static lv_tas_t lv_tas_simple; +static lv_tas_t lv_tas_transp; lv_design_f_t ancestor_design_f; -lv_design_f_t scrling_design_f; +lv_design_f_t scrl_design_f; /********************** * MACROS @@ -66,42 +70,38 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy) /*Allocate the object type specific extended data*/ lv_ta_ext_t * ext = lv_obj_alloc_ext(new_ta, sizeof(lv_ta_ext_t)); dm_assert(ext); + ext->cur_hide = 0; + ext->cursor_pos = 0; + ext->cursor_valid_x = 0; + ext->label = NULL; - if(ancestor_design_f == NULL) { - ancestor_design_f = lv_obj_get_design_f(new_ta); - } + if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_ta); + if(scrl_design_f == NULL) scrl_design_f = lv_obj_get_design_f(ext->page.scrl); lv_obj_set_signal_f(new_ta, lv_ta_signal); lv_obj_set_design_f(new_ta, lv_ta_design); - ext->cursor_valid_x = 0; - ext->cursor_pos = 0; - ext->cur_hide = 0; - /*Init the new text area object*/ if(copy == NULL) { ext->label = lv_label_create(new_ta, NULL); - if(scrling_design_f == NULL) { - scrling_design_f = lv_obj_get_design_f(ext->page.scrolling); - } - lv_obj_set_design_f(ext->page.scrolling, lv_ta_scrling_design); + lv_obj_set_design_f(ext->page.scrl, lv_ta_scrling_design); lv_label_set_long_mode(ext->label, LV_LABEL_LONG_BREAK); lv_label_set_text(ext->label, "Text area"); lv_page_glue_obj(ext->label, true); lv_obj_set_click(ext->label, false); lv_obj_set_style(new_ta, lv_tas_get(LV_TAS_DEF, NULL)); - lv_obj_set_size_us(new_ta, LV_TA_DEF_WIDTH, LV_TA_DEF_HEIGHT); + lv_obj_set_size(new_ta, LV_TA_DEF_WIDTH, LV_TA_DEF_HEIGHT); } /*Copy an existing object*/ else { - lv_obj_set_design_f(ext->page.scrolling, lv_ta_scrling_design); + lv_obj_set_design_f(ext->page.scrl, lv_ta_scrling_design); lv_ta_ext_t * copy_ext = lv_obj_get_ext(copy); ext->label = lv_label_create(new_ta, copy_ext->label); lv_page_glue_obj(ext->label, true); - /*Refresh the style when everything is ready*/ - lv_obj_set_style(new_ta, lv_obj_get_style(copy)); + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_ta); } /*Create a cursor blinker animation*/ @@ -148,16 +148,20 @@ bool lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param) * (The created label will be deleted automatically) */ break; case LV_SIGNAL_STYLE_CHG: - lv_obj_set_style(ext->label, &style->labels); - lv_obj_set_width(ext->label, lv_obj_get_width(ta) - 2 * - (style->pages.bg_rects.hpad + style->pages.scrable_rects.hpad)); - lv_label_set_text(ext->label, NULL); + if(ext->label) { + lv_obj_set_style(ext->label, &style->labels); + lv_obj_set_width(ext->label, lv_obj_get_width(ta) - 2 * + (style->pages.bg_rects.hpad + style->pages.scrl_rects.hpad)); + lv_label_set_text(ext->label, NULL); + } break; /*Set the label width according to the text area width*/ case LV_SIGNAL_CORD_CHG: - lv_obj_set_width(ext->label, lv_obj_get_width(ta) - 2 * - (style->pages.bg_rects.hpad + style->pages.scrable_rects.hpad)); - lv_label_set_text(ext->label, NULL); + if(ext->label != NULL) { + lv_obj_set_width(ext->label, lv_obj_get_width(ta) - 2 * + (style->pages.bg_rects.hpad + style->pages.scrl_rects.hpad)); + lv_label_set_text(ext->label, NULL); + } break; default: break; @@ -180,10 +184,13 @@ void lv_ta_add_char(lv_obj_t * ta, char c) { lv_ta_ext_t * ext = lv_obj_get_ext(ta); - /*Insert the character*/ - char buf[LV_TA_MAX_LENGTH]; const char * label_txt = lv_label_get_text(ext->label); + /*Test the new length: txt length + 1 (closing'\0') + 1 (c character)*/ + if((strlen(label_txt) + 2) > LV_TA_MAX_LENGTH) return; + char buf[LV_TA_MAX_LENGTH]; + + /*Insert the character*/ memcpy(buf, label_txt, ext->cursor_pos); buf[ext->cursor_pos] = c; memcpy(buf+ext->cursor_pos+1, label_txt+ext->cursor_pos, strlen(label_txt) - ext->cursor_pos + 1); @@ -207,15 +214,19 @@ void lv_ta_add_text(lv_obj_t * ta, const char * txt) { lv_ta_ext_t * ext = lv_obj_get_ext(ta); - /*Insert the text*/ - char buf[LV_TA_MAX_LENGTH]; const char * label_txt = lv_label_get_text(ext->label); - uint16_t label_len = strlen(label_txt); - uint16_t txt_len = strlen(txt); + uint16_t label_len = strlen(label_txt); + uint16_t txt_len = strlen(txt); + + /*Test the new length (+ 1 for the closing '\0')*/ + if((label_len + txt_len + 1) > LV_TA_MAX_LENGTH) return; + + /*Insert the text*/ + char buf[LV_TA_MAX_LENGTH]; memcpy(buf, label_txt, ext->cursor_pos); - memcpy(buf+ext->cursor_pos, txt, txt_len); - memcpy(buf+ext->cursor_pos + txt_len, label_txt+ext->cursor_pos, label_len - ext->cursor_pos + 1); + memcpy(buf + ext->cursor_pos, txt, txt_len); + memcpy(buf + ext->cursor_pos + txt_len, label_txt+ext->cursor_pos, label_len - ext->cursor_pos + 1); /*Refresh the label*/ lv_label_set_text(ext->label, buf); @@ -294,7 +305,11 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) point_t cur_pos; lv_tas_t * style = lv_obj_get_style(ta); const font_t * font_p = font_get(style->labels.font); + area_t label_cords; + area_t ta_cords; lv_label_get_letter_pos(ext->label, pos, &cur_pos); + lv_obj_get_cords(ta, &ta_cords); + lv_obj_get_cords(ext->label, &label_cords); /*Check the top*/ if(lv_obj_get_y(label_par) + cur_pos.y < 0) { @@ -302,9 +317,9 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) } /*Check the bottom*/ - if(lv_obj_get_y(label_par) + cur_pos.y + font_get_height(font_p) > lv_obj_get_height(ta)) { + if(label_cords.y1 + cur_pos.y + font_get_height(font_p) + style->pages.scrl_rects.vpad > ta_cords.y2) { lv_obj_set_y(label_par, -(cur_pos.y - lv_obj_get_height(ta) + - font_get_height(font_p) + style->pages.scrable_rects.vpad * 2)); + font_get_height(font_p) + 2 * style->pages.scrl_rects.vpad)); } lv_obj_inv(ta); @@ -437,6 +452,12 @@ lv_tas_t * lv_tas_get(lv_tas_builtin_t style, lv_tas_t * copy) case LV_TAS_DEF: style_p = &lv_tas_def; break; + case LV_TAS_SIMPLE: + style_p = &lv_tas_simple; + break; + case LV_TAS_TRANSP: + style_p = &lv_tas_transp; + break; default: style_p = &lv_tas_def; } @@ -491,12 +512,12 @@ static bool lv_ta_scrling_design(lv_obj_t * scrling, const area_t * mask, lv_des { if(mode == LV_DESIGN_COVER_CHK) { /*Return false if the object is not covers the mask_p area*/ - return scrling_design_f(scrling, mask, mode); + return scrl_design_f(scrling, mask, mode); } else if(mode == LV_DESIGN_DRAW_MAIN) { /*Draw the object*/ - scrling_design_f(scrling, mask, mode); + scrl_design_f(scrling, mask, mode); } else if(mode == LV_DESIGN_DRAW_POST) { - scrling_design_f(scrling, mask, mode); + scrl_design_f(scrling, mask, mode); /*Draw the cursor too*/ lv_obj_t * ta = lv_obj_get_parent(scrling); @@ -562,6 +583,7 @@ static void lv_tas_init(void) { /*Default style*/ lv_pages_get(LV_PAGES_DEF, &lv_tas_def.pages); + lv_tas_def.pages.sb_mode = LV_PAGE_SB_MODE_DRAG; lv_labels_get(LV_LABELS_TXT, &lv_tas_def.labels); lv_tas_def.labels.objs.color = COLOR_MAKE(0x20, 0x20, 0x20); @@ -569,5 +591,18 @@ static void lv_tas_init(void) lv_tas_def.cursor_color = COLOR_MAKE(0x10, 0x10, 0x10); lv_tas_def.cursor_width = 1 * LV_DOWNSCALE; /*>=1 px for visible cursor*/ lv_tas_def.cursor_show = 1; + + memcpy(&lv_tas_simple, &lv_tas_def, sizeof(lv_tas_t)); + lv_pages_get(LV_PAGES_SIMPLE, &lv_tas_simple.pages); + lv_tas_simple.pages.sb_mode = LV_PAGE_SB_MODE_DRAG; + lv_tas_simple.pages.scrl_rects.objs.transp = 0; /*if transp == 1 the cursor will not be drawn*/ + lv_tas_simple.pages.bg_rects.objs.color = COLOR_WHITE; + lv_tas_simple.pages.bg_rects.gcolor = COLOR_SILVER; + lv_tas_simple.pages.bg_rects.bcolor = COLOR_GRAY; + + memcpy(&lv_tas_transp, &lv_tas_def, sizeof(lv_tas_t)); + lv_pages_get(LV_PAGES_TRANSP, &lv_tas_transp.pages); + lv_tas_transp.pages.scrl_rects.objs.transp = 0; /*if transp == 1 the cursor will not be drawn*/ + } #endif diff --git a/lv_objx/lv_ta.h b/lv_objx/lv_ta.h index a4f7f3d70..e656ac37c 100644 --- a/lv_objx/lv_ta.h +++ b/lv_objx/lv_ta.h @@ -12,6 +12,15 @@ #include "lv_conf.h" #if USE_LV_TA != 0 +/*Testing of dependencies*/ +#if USE_LV_PAGE == 0 +#error "lv_ta: lv_page is required. Enable it in lv_conf.h (USE_LV_PAGE 1) " +#endif + +#if USE_LV_LABEL == 0 +#error "lv_ta: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) " +#endif + #include "../lv_obj/lv_obj.h" #include "lv_page.h" #include "lv_label.h" @@ -40,6 +49,8 @@ typedef struct typedef enum { LV_TAS_DEF, + LV_TAS_SIMPLE, + LV_TAS_TRANSP, }lv_tas_builtin_t; /*Data of text area*/ diff --git a/lv_objx/lv_win.c b/lv_objx/lv_win.c index 2e9545d2e..f21e53be6 100644 --- a/lv_objx/lv_win.c +++ b/lv_objx/lv_win.c @@ -57,28 +57,30 @@ static lv_wins_t lv_wins_def; lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy) { /*Create the ancestor object*/ - lv_obj_t * new_win = lv_obj_create(par, copy); + lv_obj_t * new_win = lv_page_create(par, copy); dm_assert(new_win); /*Allocate the object type specific extended data*/ lv_win_ext_t * ext = lv_obj_alloc_ext(new_win, sizeof(lv_win_ext_t)); dm_assert(ext); + ext->ctrl_holder = NULL; + ext->header = NULL; + ext->title = NULL; - /*The signal and design functions are not copied so set them here*/ lv_obj_set_signal_f(new_win, lv_win_signal); - /* The design function is not changed - lv_obj_set_design_f(new_obj, lv_win_design); */ - - lv_obj_set_size(new_win, LV_HOR_RES, LV_VER_RES); /*Init the new window object*/ if(copy == NULL) { - /*Create a page for the content*/ - ext->content = lv_page_create(new_win, NULL); + + lv_obj_set_size(new_win, lv_obj_get_width(new_win), lv_obj_get_height(new_win)); + lv_obj_set_pos(new_win, 0, 0); /*Create a holder for the header*/ ext->header = lv_rect_create(new_win, NULL); lv_rect_set_fit(ext->header, false, true); + /*Move back the header because it is automatically moved to the scrollable */ + lv_obj_set_protect(ext->header, LV_PROTECT_PARENT); + lv_obj_set_parent(ext->header, new_win); /*Create a title on the header*/ ext->title = lv_label_create(ext->header, NULL); @@ -91,16 +93,19 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_set_style(new_win, lv_wins_get(LV_WINS_DEF, NULL)); - lv_win_realign(new_win); + lv_obj_set_size(new_win, LV_HOR_RES, LV_VER_RES); } /*Copy an existing object*/ else { lv_win_ext_t * copy_ext = lv_obj_get_ext(copy); /*Create the objects*/ ext->header = lv_rect_create(new_win, copy_ext->header); + /*Move back the header because it is automatically moved to the scrollable */ + lv_obj_set_protect(ext->header, LV_PROTECT_PARENT); + lv_obj_set_parent(ext->header, new_win); + ext->title = lv_label_create(ext->header, copy_ext->title); ext->ctrl_holder = lv_rect_create(ext->header, copy_ext->ctrl_holder); - ext->content = lv_page_create(new_win, copy_ext->content); /*Copy the control buttons*/ lv_obj_t * child; @@ -112,11 +117,12 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy) child = lv_obj_get_child(copy_ext->ctrl_holder, child); } - lv_obj_set_style(new_win, lv_obj_get_style(copy)); - - lv_win_realign(new_win); + /*Refresh the style with new signal function*/ + lv_obj_refr_style(new_win); } + lv_win_realign(new_win); + return new_win; } @@ -132,12 +138,11 @@ bool lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param) bool valid; /* Include the ancient signal function */ - valid = lv_obj_signal(win, sign, param); + valid = lv_page_signal(win, sign, param); lv_win_ext_t * ext = lv_obj_get_ext(win); lv_wins_t * style = lv_obj_get_style(win); lv_obj_t * child; - /* The object can be deleted so check its validity and then * make the object specific signal handling */ if(valid != false) { @@ -146,28 +151,18 @@ bool lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param) /*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/ break; case LV_SIGNAL_STYLE_CHG: - lv_obj_set_style(ext->content, &style->content); lv_obj_set_style(ext->ctrl_holder, &style->ctrl_holder); lv_obj_set_style(ext->title, &style->title); lv_obj_set_style(ext->header, &style->header); lv_obj_set_opa(ext->header, style->header_opa); - if(style->header_opa == OPA_COVER || style->header_opa == OPA_TRANSP) { - lv_obj_set_opa_protect(ext->header, false); - } else { - lv_obj_set_opa_protect(ext->header, true); - } /*Refresh the style of all control buttons*/ child = lv_obj_get_child(ext->ctrl_holder, NULL); while(child != NULL) { lv_obj_set_style(child, &style->ctrl_btn); lv_obj_set_opa(child, style->ctrl_btn_opa); - if(style->ctrl_btn_opa == OPA_COVER || style->ctrl_btn_opa == OPA_TRANSP) { - lv_obj_set_opa_protect(child, false); - } else { - lv_obj_set_opa_protect(child, true); - } + /*Refresh the image style too*/ lv_obj_set_style(lv_obj_get_child(child, NULL), &style->ctrl_img); child = lv_obj_get_child(ext->ctrl_holder, child); @@ -175,16 +170,6 @@ bool lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param) lv_win_realign(win); - break; - case LV_SIGNAL_CHILD_CHG: - /*If a child added move it to the 'content' object*/ - /*(A window can be only 2 children: the header and the content)*/ - child = lv_obj_get_child(win, NULL); - if(ext->content != NULL && ext->header != NULL && - child != ext->content && child != ext->header && - param != NULL) { - lv_obj_set_parent(param, ext->content); - } break; case LV_SIGNAL_CORD_CHG: /*If the size is changed refresh the window*/ @@ -223,12 +208,6 @@ lv_obj_t * lv_win_add_ctrl_btn(lv_obj_t * win, const char * img_path, lv_action_ lv_obj_set_size(btn, style->ctrl_btn_w, style->ctrl_btn_h); lv_btn_set_rel_action(btn, rel_action); - if(style->ctrl_btn_opa == OPA_COVER || style->ctrl_btn_opa == OPA_TRANSP) { - lv_obj_set_opa_protect(btn, false); - } else { - lv_obj_set_opa_protect(btn, true); - } - lv_obj_t * img = lv_img_create(btn, NULL); lv_obj_set_click(img, false); lv_obj_set_style(img, &style->ctrl_img); @@ -282,18 +261,6 @@ const char * lv_win_get_title(lv_obj_t * win) return lv_label_get_text(ext->title); } -/** - * Get the content object (lv_page type) of a window - * @param win pointer to a window object - * @return pointer to the content page object of a window - */ -lv_obj_t * lv_win_get_content(lv_obj_t * win) -{ - lv_win_ext_t * ext = lv_obj_get_ext(win); - - return ext->content; -} - /** * Get the pointer of a widow from one of its control button. * It is useful in the action of the control buttons where only button is known. @@ -382,19 +349,15 @@ static bool lv_win_design(lv_obj_t * win, const area_t * mask, lv_design_mode_t */ static void lv_wins_init(void) { - /*Transparent background. It will be always covered*/ - lv_objs_get(LV_OBJS_TRANSP, &lv_wins_def.bg); - /*Style for the content*/ - lv_pages_get(LV_PAGES_DEF, &lv_wins_def.content); - lv_wins_def.content.bg_rects.objs.color = COLOR_WHITE; - lv_wins_def.content.bg_rects.gcolor = COLOR_WHITE; - lv_wins_def.content.bg_rects.bwidth = 1 * LV_DOWNSCALE; - lv_wins_def.content.bg_rects.bcolor = COLOR_GRAY; - lv_wins_def.content.bg_rects.round = 0; - lv_wins_def.content.bg_rects.hpad = 0; - lv_wins_def.content.bg_rects.vpad = 0; - lv_wins_def.header_on_content = 0; + lv_pages_get(LV_PAGES_DEF, &lv_wins_def.pages); + lv_wins_def.pages.bg_rects.objs.color = COLOR_WHITE; + lv_wins_def.pages.bg_rects.gcolor = COLOR_WHITE; + lv_wins_def.pages.bg_rects.bwidth = 1 * LV_DOWNSCALE; + lv_wins_def.pages.bg_rects.bcolor = COLOR_GRAY; + lv_wins_def.pages.bg_rects.round = 0; + lv_wins_def.pages.bg_rects.hpad = 0; + lv_wins_def.pages.bg_rects.vpad = 0; /*Styles for the header*/ lv_rects_get(LV_RECTS_DEF, &lv_wins_def.header); @@ -443,7 +406,7 @@ static void lv_win_realign(lv_obj_t * win) lv_win_ext_t * ext = lv_obj_get_ext(win); lv_wins_t * style = lv_obj_get_style(win); - if(ext->content == NULL || ext->ctrl_holder == NULL || ext->header == NULL || ext->title == NULL) return; + if(ext->ctrl_holder == NULL || ext->header == NULL || ext->title == NULL) return; lv_obj_t * cbtn; /*Refresh the style of all control buttons*/ @@ -467,13 +430,6 @@ static void lv_win_realign(lv_obj_t * win) lv_obj_set_pos_us(ext->header, 0, 0); - if(style->header_on_content == 0) { - lv_obj_set_size(ext->content, lv_obj_get_width(win), lv_obj_get_height(win) - lv_obj_get_height(ext->header)); - lv_obj_align_us(ext->content, ext->header, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, 0); - } else { - lv_obj_set_size(ext->content, lv_obj_get_width(win), lv_obj_get_height(win)); - lv_obj_set_pos(ext->content, 0, 0); - } } #endif diff --git a/lv_objx/lv_win.h b/lv_objx/lv_win.h index 1dacc2894..901c37787 100644 --- a/lv_objx/lv_win.h +++ b/lv_objx/lv_win.h @@ -12,6 +12,31 @@ #include "lv_conf.h" #if USE_LV_WIN != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_win: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + +#if USE_LV_BTN == 0 +#error "lv_win: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) " +#endif + +#if USE_LV_LABEL == 0 +#error "lv_win: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) " +#endif + +#if USE_LV_IMG == 0 +#error "lv_win: lv_img is required. Enable it in lv_conf.h (USE_LV_IMG 1) " +#endif + +#if USE_LV_PAGE == 0 +#error "lv_win: lv_page is required. Enable it in lv_conf.h (USE_LV_PAGE 1) " +#endif + +#if USE_LV_PAGE == 0 +#error "lv_win: lv_page is required. Enable it in lv_conf.h (USE_LV_PAGE 1) " +#endif + #include "../lv_obj/lv_obj.h" #include "lv_rect.h" #include "lv_btn.h" @@ -30,7 +55,7 @@ /*Style of window*/ typedef struct { - lv_objs_t bg; /*Style of ancestor*/ + lv_pages_t pages; /*Style of ancestor*/ /*New style element for this type */ /*Header settings*/ lv_rects_t header; @@ -42,9 +67,6 @@ typedef struct cord_t ctrl_btn_h; opa_t ctrl_btn_opa; opa_t header_opa; - /*Content settings*/ - lv_pages_t content; - uint8_t header_on_content:1; }lv_wins_t; /*Built-in styles of window*/ @@ -56,12 +78,11 @@ typedef enum /*Data of window*/ typedef struct { - /*Inherited from 'base_obj' so there is no ext. data*/ /*Ext. of ancestor*/ + lv_page_ext_t page; /*Ext. of ancestor*/ /*New data for this type */ lv_obj_t * header; lv_obj_t * title; lv_obj_t * ctrl_holder; - lv_obj_t * content; }lv_win_ext_t; /********************** @@ -76,7 +97,6 @@ bool lv_win_close_action(lv_obj_t * btn, lv_dispi_t * dispi); void lv_win_set_title(lv_obj_t * win, const char * title); const char * lv_win_get_title(lv_obj_t * win); -lv_obj_t * lv_win_get_content(lv_obj_t * win); lv_obj_t * lv_win_get_from_ctrl_btn(lv_obj_t * ctrl_btn); /********************** * MACROS diff --git a/lvgl.h b/lvgl.h index 888356b69..c22cf6dd6 100644 --- a/lvgl.h +++ b/lvgl.h @@ -32,8 +32,7 @@ * DEFINES *********************/ #define LVGL_VERSION_MAJOR 2 -#define LVGL_VERSION_MINOR 0 -#define LVGL_VERSION_BUGFIX 1 +#define LVGL_VERSION_MINOR 1 /********************** * TYPEDEFS