1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-02-04 07:13:00 +08:00

Cleaning the code

This commit is contained in:
Gabor 2017-04-24 16:16:36 +02:00
parent dadb8973bf
commit 24128ae325
33 changed files with 193 additions and 219 deletions

View File

@ -805,11 +805,12 @@ static lv_action_res_t lv_app_win_conf_action(lv_obj_t * set_btn, lv_dispi_t * d
char buf[256]; char buf[256];
sprintf(buf, "%s settings", app->dsc->name); sprintf(buf, "%s settings", app->dsc->name);
lv_win_add_ctrl_btn(app->conf_win, SYMBOL_CLOSE ,lv_win_close_action);
lv_win_set_title(app->conf_win, buf); lv_win_set_title(app->conf_win, buf);
lv_obj_t * scrl = lv_page_get_scrl(app->conf_win); lv_win_set_style_cbtn(app->conf_win, &app_style.win_cbtn_rel, &app_style.win_cbtn_pr);
lv_obj_t * scrl = lv_page_get_scrl(lv_win_get_page(app->conf_win));
lv_cont_set_layout(scrl, LV_CONT_LAYOUT_COL_L); lv_cont_set_layout(scrl, LV_CONT_LAYOUT_COL_L);
lv_win_add_ctrl_btn(app->conf_win, "U:/icon_close" ,lv_win_close_action);
app->dsc->conf_open(app, app->conf_win); app->dsc->conf_open(app, app->conf_win);
@ -1018,9 +1019,9 @@ static void lv_app_init_style(void)
app_style.menu.radius = 0; app_style.menu.radius = 0;
app_style.menu.bwidth = 0; app_style.menu.bwidth = 0;
app_style.menu.swidth = 0; app_style.menu.swidth = 0;
app_style.menu.vpad = LV_DPI / 10; app_style.menu.vpad = LV_DPI / 12;
app_style.menu.hpad = LV_DPI / 10; app_style.menu.hpad = LV_DPI / 12;
app_style.menu.opad = LV_DPI / 10; app_style.menu.opad = LV_DPI / 12;
lv_style_get(LV_STYLE_BTN_REL,&app_style.menu_btn_rel); lv_style_get(LV_STYLE_BTN_REL,&app_style.menu_btn_rel);
app_style.menu_btn_rel.ccolor = COLOR_MAKE(0xd0, 0xe0, 0xf0); app_style.menu_btn_rel.ccolor = COLOR_MAKE(0xd0, 0xe0, 0xf0);
@ -1032,6 +1033,9 @@ static void lv_app_init_style(void)
app_style.menu_btn_rel.empty = 1; app_style.menu_btn_rel.empty = 1;
app_style.menu_btn_rel.font = font_get(LV_APP_FONT_LARGE); app_style.menu_btn_rel.font = font_get(LV_APP_FONT_LARGE);
app_style.menu_btn_rel.img_recolor = OPA_90; app_style.menu_btn_rel.img_recolor = OPA_90;
app_style.menu_btn_rel.vpad = LV_DPI / 10;
app_style.menu_btn_rel.hpad = LV_DPI / 10;
app_style.menu_btn_rel.opad = LV_DPI / 10;
memcpy(&app_style.menu_btn_pr, &app_style.menu_btn_rel, sizeof(lv_style_t)); memcpy(&app_style.menu_btn_pr, &app_style.menu_btn_rel, sizeof(lv_style_t));
app_style.menu_btn_pr.mcolor = COLOR_GRAY; app_style.menu_btn_pr.mcolor = COLOR_GRAY;
@ -1075,21 +1079,21 @@ static void lv_app_init_style(void)
app_style.sc_send_pr.gcolor = COLOR_MAKE(0x20, 0x10, 0x00); app_style.sc_send_pr.gcolor = COLOR_MAKE(0x20, 0x10, 0x00);
app_style.sc_send_pr.gcolor = COLOR_BLACK; app_style.sc_send_pr.gcolor = COLOR_BLACK;
app_style.sc_send_pr.bopa = OPA_30; app_style.sc_send_pr.bopa = OPA_30;
app_style.sc_send_pr.bwidth = 3 * LV_DOWNSCALE; app_style.sc_send_pr.bwidth = 2 * LV_DOWNSCALE;
memcpy(&app_style.sc_rec_rel, &app_style.sc_send_rel, sizeof(lv_style_t)); memcpy(&app_style.sc_rec_rel, &app_style.sc_send_rel, sizeof(lv_style_t));
app_style.sc_rec_rel.mcolor = COLOR_MAKE(0xE0, 0xFF, 0xE0); app_style.sc_rec_rel.mcolor = COLOR_MAKE(0xE0, 0xFF, 0xE0);
app_style.sc_rec_rel.gcolor = COLOR_MAKE(0x20, 0x50, 0x20); app_style.sc_rec_rel.gcolor = COLOR_MAKE(0x20, 0x50, 0x20);
app_style.sc_rec_rel.bcolor = COLOR_BLACK; app_style.sc_rec_rel.bcolor = COLOR_BLACK;
app_style.sc_rec_rel.bopa = OPA_30; app_style.sc_rec_rel.bopa = OPA_30;
app_style.sc_rec_rel.bwidth = 3 * LV_DOWNSCALE; app_style.sc_rec_rel.bwidth = 2 * LV_DOWNSCALE;
memcpy(&app_style.sc_rec_pr, &app_style.sc_send_pr, sizeof(lv_style_t)); memcpy(&app_style.sc_rec_pr, &app_style.sc_send_pr, sizeof(lv_style_t));
app_style.sc_rec_pr.mcolor = COLOR_MAKE(0xB0, 0xFF, 0xB0); app_style.sc_rec_pr.mcolor = COLOR_MAKE(0xB0, 0xFF, 0xB0);
app_style.sc_rec_pr.gcolor = COLOR_MAKE(0x20, 0x20, 0x10); app_style.sc_rec_pr.gcolor = COLOR_MAKE(0x20, 0x20, 0x10);
app_style.sc_rec_pr.bcolor = COLOR_BLACK; app_style.sc_rec_pr.bcolor = COLOR_BLACK;
app_style.sc_rec_pr.bopa = OPA_30; app_style.sc_rec_pr.bopa = OPA_30;
app_style.sc_rec_pr.bwidth = 3 * LV_DOWNSCALE; app_style.sc_rec_pr.bwidth = 2 * LV_DOWNSCALE;
memcpy(&app_style.sc_title, &app_style.sc_rel, sizeof(lv_style_t)); memcpy(&app_style.sc_title, &app_style.sc_rel, sizeof(lv_style_t));
app_style.sc_title.font = font_get(LV_APP_FONT_SMALL); app_style.sc_title.font = font_get(LV_APP_FONT_SMALL);

View File

@ -57,8 +57,8 @@ static lv_obj_t * notice_h;
void lv_app_notice_init(void) void lv_app_notice_init(void)
{ {
notice_h = lv_cont_create(lv_scr_act(), NULL); notice_h = lv_cont_create(lv_scr_act(), NULL);
lv_obj_set_size(notice_h, LV_HOR_RES, LV_VER_RES - LV_DPI); lv_obj_set_size(notice_h, LV_HOR_RES, LV_VER_RES - LV_DPI / 8);
lv_obj_set_y(notice_h, LV_DPI); lv_obj_set_y(notice_h, LV_DPI / 8);
lv_obj_set_click(notice_h, false); lv_obj_set_click(notice_h, false);
lv_obj_set_style(notice_h, lv_style_get(LV_STYLE_TRANSP, NULL)); lv_obj_set_style(notice_h, lv_style_get(LV_STYLE_TRANSP, NULL));
lv_cont_set_layout(notice_h, LV_CONT_LAYOUT_COL_R); lv_cont_set_layout(notice_h, LV_CONT_LAYOUT_COL_R);

View File

@ -119,6 +119,8 @@ const lv_app_dsc_t * lv_app_sysmon_init(void)
cpu_bars.font = font_get(LV_APP_FONT_MEDIUM); cpu_bars.font = font_get(LV_APP_FONT_MEDIUM);
cpu_bars.line_space = 0; cpu_bars.line_space = 0;
cpu_bars.txt_align = 1; cpu_bars.txt_align = 1;
cpu_bars.hpad = 0;
cpu_bars.vpad = 0;
memcpy(&mem_bars, &cpu_bars, sizeof(cpu_bars)); memcpy(&mem_bars, &cpu_bars, sizeof(cpu_bars));
mem_bars.gcolor = COLOR_GREEN; mem_bars.gcolor = COLOR_GREEN;
@ -228,9 +230,9 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win)
lv_chart_set_pnum(win_data->chart, LV_APP_SYSMON_PNUM); lv_chart_set_pnum(win_data->chart, LV_APP_SYSMON_PNUM);
lv_chart_set_range(win_data->chart, 0, 100); lv_chart_set_range(win_data->chart, 0, 100);
lv_chart_set_type(win_data->chart, LV_CHART_LINE); lv_chart_set_type(win_data->chart, LV_CHART_LINE);
lv_chart_set_dl_width(win_data->chart, 2 * LV_DOWNSCALE);
win_data->cpu_dl = lv_chart_add_dataline(win_data->chart, COLOR_RED, 2 * LV_DOWNSCALE); win_data->cpu_dl = lv_chart_add_dataline(win_data->chart, COLOR_RED);
win_data->mem_dl = lv_chart_add_dataline(win_data->chart, COLOR_BLUE, 2 * LV_DOWNSCALE); win_data->mem_dl = lv_chart_add_dataline(win_data->chart, COLOR_BLUE);
uint16_t i; uint16_t i;
for(i = 0; i < LV_APP_SYSMON_PNUM; i ++) { for(i = 0; i < LV_APP_SYSMON_PNUM; i ++) {

View File

@ -75,8 +75,8 @@ static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win);
static void add_data(lv_app_inst_t * app, const void * data, uint16_t data_len); 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_ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi);
static lv_action_res_t win_comtype_action(lv_obj_t * btn, uint16_t opt); static lv_action_res_t win_comtype_action(lv_obj_t * ddlist, lv_dispi_t * dispi);
static lv_action_res_t win_format_action(lv_obj_t * btn, uint16_t opt); static lv_action_res_t win_format_action(lv_obj_t * ddlist, lv_dispi_t * dispi);
static lv_action_res_t win_clear_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 void win_ta_kb_ok_action(lv_obj_t * ta);
@ -334,15 +334,15 @@ static lv_action_res_t win_ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi)
/** /**
* Called when an option is chosen in the communication type drop down list on the configuration window * Called when an option is chosen in the communication type drop down list on the configuration window
* @param ddl pointer to the drop down list * @param ddl pointer to the drop down list
* @param opt id of the chosen option * @param dispi pointer to the caller display input
* @return LV_ACTION_RES_OK because the list is not deleted * @return LV_ACTION_RES_OK because the list is not deleted
*/ */
static lv_action_res_t win_comtype_action(lv_obj_t * btn, uint16_t opt) static lv_action_res_t win_comtype_action(lv_obj_t * ddlist, lv_dispi_t * dispi)
{ {
lv_app_inst_t * app = lv_obj_get_free_p(btn); lv_app_inst_t * app = lv_obj_get_free_p(ddlist);
my_app_data_t * app_data = app->app_data; my_app_data_t * app_data = app->app_data;
app_data->com_type = com_type_list[opt]; app_data->com_type = com_type_list[lv_ddlist_get_selected(ddlist)];
return LV_ACTION_RES_OK; return LV_ACTION_RES_OK;
} }
@ -350,14 +350,14 @@ static lv_action_res_t win_comtype_action(lv_obj_t * btn, uint16_t opt)
/** /**
* Called when an option is chosen in the format drop down list on the configuration window * Called when an option is chosen in the format drop down list on the configuration window
* @param ddl pointer to the drop down list * @param ddl pointer to the drop down list
* @param opt id of the chosen option * @param dispi pointer to the caller display input
* @return LV_ACTION_RES_OK because the list is not deleted * @return LV_ACTION_RES_OK because the list is not deleted
*/ */
static lv_action_res_t win_format_action(lv_obj_t * btn, uint16_t opt) static lv_action_res_t win_format_action(lv_obj_t * ddlist, lv_dispi_t * dispi)
{ {
lv_app_inst_t * app = lv_obj_get_free_p(btn); lv_app_inst_t * app = lv_obj_get_free_p(ddlist);
my_app_data_t * app_data = app->app_data; my_app_data_t * app_data = app->app_data;
uint16_t opt = lv_ddlist_get_selected(ddlist);
if(strcmp(txt_format_list_txt[opt], "Hexadecimal") == 0) { if(strcmp(txt_format_list_txt[opt], "Hexadecimal") == 0) {
app_data->format = LV_APP_TERMINAL_FORMAT_HEX; app_data->format = LV_APP_TERMINAL_FORMAT_HEX;
} else if (strcmp(txt_format_list_txt[opt], "ASCII") == 0) { } else if (strcmp(txt_format_list_txt[opt], "ASCII") == 0) {

View File

@ -14,19 +14,19 @@
/* Horizontal and vertical resolution of the library. /* Horizontal and vertical resolution of the library.
* Screen resolution multiplied by LV_DOWN_SCALE*/ * Screen resolution multiplied by LV_DOWN_SCALE*/
#define LV_HOR_RES (480 * LV_DOWNSCALE) #define LV_HOR_RES (320 * LV_DOWNSCALE)
#define LV_VER_RES (320 * LV_DOWNSCALE) #define LV_VER_RES (240 * LV_DOWNSCALE)
#define LV_DPI (80 * LV_DOWNSCALE)
/* Buffered rendering: >= LV_DOWNSCALE * LV_HOR_RES or 0 to disable buffering*/ /* Buffered rendering: >= LV_DOWNSCALE * LV_HOR_RES or 0 to disable buffering*/
#define LV_VDB_SIZE (LV_HOR_RES * 20)
#define LV_VDB_SIZE (LV_HOR_RES * (LV_VER_RES / 20))
/* Enable antialaiassing /* Enable antialaiassing
* If enabled everything will half-sized * If enabled everything will half-sized
* Use LV_DOWNSCALE to compensate * Use LV_DOWNSCALE to compensate
* the down scaling effect of antialiassing*/ * the down scaling effect of antialiassing*/
#define LV_ANTIALIAS 1 #define LV_ANTIALIAS 1
#define FONT_ANTIALIAS 0
/*Set the downscaling value*/ /*Set the downscaling value*/
#if LV_ANTIALIAS == 0 #if LV_ANTIALIAS == 0
#define LV_DOWNSCALE 1 #define LV_DOWNSCALE 1
@ -48,28 +48,9 @@
#define LV_DISPI_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/ #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] */ #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_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 USE_FONT_SYMBOL_30 1
#define USE_FONT_SYMBOL_60 1
#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*/ /*lv_obj (base object) settings*/
#define LV_OBJ_FREE_NUM 1 /*Enable the free number attribute*/
#define LV_OBJ_FREE_P 1 /*Enable the free pointer attribute*/ #define LV_OBJ_FREE_P 1 /*Enable the free pointer attribute*/
#define LV_OBJ_DEF_SCR_COLOR COLOR_SILVER /*Default screen color*/
/*Others*/ /*Others*/
#define LV_COLOR_TRANSP COLOR_LIME #define LV_COLOR_TRANSP COLOR_LIME
@ -78,8 +59,9 @@
* LV OBJ X USAGE * LV OBJ X USAGE
* ================*/ * ================*/
/*Rectangle (dependencies: -*/ /*****************
#define USE_LV_RECT 1 * Simple object
*****************/
/*Label (dependencies: -*/ /*Label (dependencies: -*/
#define USE_LV_LABEL 1 #define USE_LV_LABEL 1
@ -90,16 +72,10 @@
#define LV_LABEL_SCROLL_REPEAT_PAUSE 500 /*Wait before the scroll begins again in ms*/ #define LV_LABEL_SCROLL_REPEAT_PAUSE 500 /*Wait before the scroll begins again in ms*/
#endif #endif
/*Button (dependencies: lv_rect*/
#define USE_LV_BTN 1
/*Line (dependencies: -*/
#define USE_LV_LINE 1
/*Image (dependencies: lv_label (if symbols are enabled) from misc: FSINT, UFS)*/ /*Image (dependencies: lv_label (if symbols are enabled) from misc: FSINT, UFS)*/
#define USE_LV_IMG 1 #define USE_LV_IMG 1
#if USE_LV_IMG != 0 #if USE_LV_IMG != 0
#define LV_IMG_DEF_WALLPAPER img_square_x2 /*Comment this line to NOT use wallpaper*/ //#define LV_IMG_DEF_WALLPAPER img_square_x1 /*Comment this line to NOT use wallpaper*/
/* 1: enables to interpret the file names as symbol name /* 1: enables to interpret the file names as symbol name
* from symbol_def.h if they begin with a lower case letter. * from symbol_def.h if they begin with a lower case letter.
* (driver letters are always upper case)*/ * (driver letters are always upper case)*/
@ -109,26 +85,49 @@
#endif /*LV_IMG_ENABLE_SYMBOLS*/ #endif /*LV_IMG_ENABLE_SYMBOLS*/
#endif /*USE_LV_IMG*/ #endif /*USE_LV_IMG*/
/*Line (dependencies: -*/
#define USE_LV_LINE 1
/*******************
* Container object
*******************/
/*Container (dependencies: -*/
#define USE_LV_CONT 1
/*Page (dependencies: lv_rect)*/ /*Page (dependencies: lv_rect)*/
#define USE_LV_PAGE 1 #define USE_LV_PAGE 1
#if USE_LV_PAGE != 0 #if USE_LV_PAGE != 0
#define LV_PAGE_ANIM_FOCUS_TIME 300 /*List focus animation time [ms] (0: turn off the animation)*/ #define LV_PAGE_ANIM_FOCUS_TIME 300 /*List focus animation time [ms] (0: turn off the animation)*/
#endif #endif
/*List (dependencies: lv_btn, lv_label, lv_img)*/ /*Window (dependencies: lv_rect, lv_btn, lv_label, lv_img, lv_page)*/
#define USE_LV_LIST 1 #define USE_LV_WIN 1
/*Check box (dependencies: lv_btn, lv_label)*/ /*************************
#define USE_LV_CB 1 * Data visualizer object
*************************/
/*Progress bar (dependencies: lv_rect, lv_label)*/ /*Bar (dependencies: -)*/
#define USE_LV_PB 1 #define USE_LV_BAR 1
/*Line meter (dependencies: bar, misc: trigo)*/
#define USE_LV_LMETER 1
/*Gauge (dependencies: misc: trigo)*/
#define USE_LV_GAUGE 1
/*Chart (dependencies: -)*/
#define USE_LV_CHART 1
/*LED (dependencies: lv_rect)*/ /*LED (dependencies: lv_rect)*/
#define USE_LV_LED 1 #define USE_LV_LED 1
/*Chart (dependencies: lv_rect, lv_line)*/ /*Message box (dependencies: lv_rect, lv_btn, lv_label)*/
#define USE_LV_CHART 1 #define USE_LV_MBOX 1
#if USE_LV_MBOX != 0
#define LV_MBOX_ANIM_TIME 200 /*How fast animate out the message box in auto close. 0: no animation [ms]*/
#endif
/*Text area (dependencies: lv_label, lv_page)*/ /*Text area (dependencies: lv_label, lv_page)*/
#define USE_LV_TA 1 #define USE_LV_TA 1
@ -137,26 +136,31 @@
#define LV_TA_CUR_BLINK_TIME 400 /*ms*/ #define LV_TA_CUR_BLINK_TIME 400 /*ms*/
#endif #endif
/*Button matrix (dependencies: lv_rect, lv_label)*/ /*************************
* User input object
*************************/
/*Button (dependencies: lv_cont*/
#define USE_LV_BTN 1
/*Button matrix (dependencies: -)*/
#define USE_LV_BTNM 1 #define USE_LV_BTNM 1
/*Drop down list (dependencies: lv_page, lv_btn_t, lv_label_t)*/ /*Check box (dependencies: lv_btn, lv_label)*/
#define USE_LV_DDLIST 1 #define USE_LV_CB 1
/*List (dependencies: lv_btn, lv_label, lv_img)*/
#define USE_LV_LIST 1
/*Drop down list (dependencies: lv_page, lv_label)*/
#define USE_LV_DDLIST 1
#if USE_LV_DDLIST != 0 #if USE_LV_DDLIST != 0
#define LV_DDLIST_ANIM_TIME 100 /*DDL open/close animation in milliseconds (0: disable animation)*/ #define LV_DDLIST_ANIM_TIME 100 /*DDL open/close animation in milliseconds (0: disable animation)*/
#endif #endif
/*Window (dependencies: lv_rect, lv_btn, lv_label, lv_img, lv_page)*/ /*Bar (dependencies: lv_bar)*/
#define USE_LV_WIN 1 #define USE_LV_SLIDER 1
/*Message box (dependencies: lv_rect, lv_btn, lv_label)*/
#define USE_LV_MBOX 1
#if USE_LV_MBOX != 0
#define LV_MBOX_ANIM_TIME 250 /*How fast animate out the message box in auto close. 0: no animation [ms]*/
#endif
/*Gauge (dependencies: lv_rect, lv_label, lv_line, misc: trigo)*/
#define USE_LV_GAUGE 1
/*================== /*==================
* LV APP SETTINGS * LV APP SETTINGS

View File

@ -42,18 +42,16 @@ typedef enum
/********************** /**********************
* STATIC PROTOTYPES * 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_style_t * style);
static void lv_draw_cont_main_mid(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style); static void lv_draw_rect_main_corner(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style_p);
static void lv_draw_cont_main_corner(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style_p); static void lv_draw_rect_border_straight(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style_p);
static void lv_draw_cont_border_straight(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style_p); static void lv_draw_rect_border_corner(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style);
static void lv_draw_cont_border_corner(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style); static void lv_draw_rect_shadow(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style);
static void lv_draw_cont_shadow(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style);
static void lv_draw_cont_shadow_full(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style); static void lv_draw_cont_shadow_full(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style);
static void lv_draw_cont_shadow_bottom(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style); static void lv_draw_cont_shadow_bottom(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style);
static void lv_draw_cont_shadow_full_straight(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style, const opa_t * map); static void lv_draw_cont_shadow_full_straight(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style, const opa_t * map);
static uint16_t lv_draw_cont_radius_corr(uint16_t r, cord_t w, cord_t h); static uint16_t lv_draw_cont_radius_corr(uint16_t r, cord_t w, cord_t h);
#endif /*USE_LV_RECT != 0*/
#if USE_LV_TRIANGLE != 0 #if USE_LV_TRIANGLE != 0
@ -84,7 +82,6 @@ static void (*map_fp)(const area_t * cords_p, const area_t * mask_p, const color
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
#if USE_LV_RECT != 0
/** /**
* Draw a rectangle * Draw a rectangle
* @param cords_p the coordinates of the rectangle * @param cords_p the coordinates of the rectangle
@ -96,29 +93,27 @@ void lv_draw_rect(const area_t * cords_p, const area_t * mask_p, const lv_style_
if(area_get_height(cords_p) < 1 || area_get_width(cords_p) < 1) return; if(area_get_height(cords_p) < 1 || area_get_width(cords_p) < 1) return;
if(style_p->swidth != 0) { if(style_p->swidth != 0) {
lv_draw_cont_shadow(cords_p, mask_p, style_p); lv_draw_rect_shadow(cords_p, mask_p, style_p);
} }
if(style_p->empty == 0){ if(style_p->empty == 0){
lv_draw_cont_main_mid(cords_p, mask_p, style_p); lv_draw_rect_main_mid(cords_p, mask_p, style_p);
if(style_p->radius != 0) { if(style_p->radius != 0) {
lv_draw_cont_main_corner(cords_p, mask_p, style_p); lv_draw_rect_main_corner(cords_p, mask_p, style_p);
} }
} }
if(style_p->bwidth != 0) { if(style_p->bwidth != 0) {
lv_draw_cont_border_straight(cords_p, mask_p, style_p); lv_draw_rect_border_straight(cords_p, mask_p, style_p);
if(style_p->radius != 0) { if(style_p->radius != 0) {
lv_draw_cont_border_corner(cords_p, mask_p, style_p); lv_draw_rect_border_corner(cords_p, mask_p, style_p);
} }
} }
} }
#endif /*USE_LV_RECT != 0*/
#if USE_LV_TRIANGLE != 0 #if USE_LV_TRIANGE != 0
/** /**
* *
* @param points pointer to an array with 3 points * @param points pointer to an array with 3 points
@ -224,10 +219,8 @@ void lv_draw_triangle(const point_t * points, const area_t * mask_p, color_t col
} while(edge2.y == y2_tmp); } while(edge2.y == y2_tmp);
} }
} }
#endif #endif
#if USE_LV_LABEL != 0
/** /**
* Write a text * Write a text
* @param cords_p coordinates of the label * @param cords_p coordinates of the label
@ -326,9 +319,6 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_style_
} }
} }
#endif /* USE_LV_LABEL != 0*/
#if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0
/** /**
* Draw an image * Draw an image
* @param cords_p the coordinates of the image * @param cords_p the coordinates of the image
@ -438,9 +428,6 @@ 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 * Draw a line
* @param p1 first point of the line * @param p1 first point of the line
@ -567,20 +554,19 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
fill_fp(&draw_area, mask_p, style->ccolor, style->opa); fill_fp(&draw_area, mask_p, style->ccolor, style->opa);
} }
} }
#endif /*USE_LV_LINE != 0*/
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
#if USE_LV_RECT != 0
/** /**
* Draw the middle part (rectangular) of a rectangle * Draw the middle part (rectangular) of a rectangle
* @param cords_p the coordinates of the original rectangle * @param cords_p the coordinates of the original rectangle
* @param mask_p the rectangle will be drawn only on this area * @param mask_p the rectangle will be drawn only on this area
* @param rects_p pointer to a rectangle style * @param rects_p pointer to a rectangle style
*/ */
static void lv_draw_cont_main_mid(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style) static void lv_draw_rect_main_mid(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style)
{ {
uint16_t radius = style->radius; uint16_t radius = style->radius;
@ -630,7 +616,7 @@ static void lv_draw_cont_main_mid(const area_t * cords_p, const area_t * mask_p,
* @param mask_p the rectangle will be drawn only on this area * @param mask_p the rectangle will be drawn only on this area
* @param rects_p pointer to a rectangle style * @param rects_p pointer to a rectangle style
*/ */
static void lv_draw_cont_main_corner(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style_p) static void lv_draw_rect_main_corner(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style_p)
{ {
uint16_t radius = style_p->radius; uint16_t radius = style_p->radius;
@ -801,7 +787,7 @@ if(edge_top_area.y1 != mid_top_area.y1) {
* @param mask_p the rectangle will be drawn only on this area * @param mask_p the rectangle will be drawn only on this area
* @param rects_p pointer to a rectangle style * @param rects_p pointer to a rectangle style
*/ */
static void lv_draw_cont_border_straight(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style_p) static void lv_draw_rect_border_straight(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style_p)
{ {
uint16_t radius = style_p->radius; uint16_t radius = style_p->radius;
@ -917,7 +903,7 @@ static void lv_draw_cont_border_straight(const area_t * cords_p, const area_t *
* @param rects_p pointer to a rectangle style * @param rects_p pointer to a rectangle style
* @param opa opacity of the rectangle (0..255) * @param opa opacity of the rectangle (0..255)
*/ */
static void lv_draw_cont_border_corner(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style) static void lv_draw_rect_border_corner(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style)
{ {
uint16_t radius = style->radius; uint16_t radius = style->radius;
uint16_t bwidth = style->bwidth; uint16_t bwidth = style->bwidth;
@ -1051,7 +1037,7 @@ static void lv_draw_cont_border_corner(const area_t * cords_p, const area_t * ma
* @param rect pointer to rectangle object * @param rect pointer to rectangle object
* @param mask pointer to a mask area (from the design functions) * @param mask pointer to a mask area (from the design functions)
*/ */
static void lv_draw_cont_shadow(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style) static void lv_draw_rect_shadow(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style)
{ {
/* If mask is in the middle of cords do not draw shadow*/ /* If mask is in the middle of cords do not draw shadow*/
cord_t radius = style->radius; cord_t radius = style->radius;
@ -1347,8 +1333,6 @@ static uint16_t lv_draw_cont_radius_corr(uint16_t r, cord_t w, cord_t h)
return r; return r;
} }
#endif /*USE_LV_RECT != 0*/
#if USE_LV_TRIANGLE != 0 #if USE_LV_TRIANGLE != 0
/** /**

View File

@ -31,9 +31,7 @@
* @param mask_p the rectangle will be drawn only in this mask * @param mask_p the rectangle will be drawn only in this mask
* @param style_p pointer to a style * @param style_p pointer to a style
*/ */
#if USE_LV_RECT != 0
void lv_draw_rect(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style_p); void lv_draw_rect(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style_p);
#endif
/*Experimental use for 3D modeling*/ /*Experimental use for 3D modeling*/
@ -56,10 +54,8 @@ void lv_draw_triangle(const point_t * points, const area_t * mask_p, color_t col
* @param txt 0 terminated text to write * @param txt 0 terminated text to write
* @param flags settings for the text from 'txt_flag_t' enum * @param flags settings for the text from 'txt_flag_t' enum
*/ */
#if USE_LV_LABEL != 0
void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_style_t * style_p, void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_style_t * style_p,
const char * txt, txt_flag_t flag); const char * txt, txt_flag_t flag);
#endif
/** /**
* Draw an image * Draw an image
@ -67,10 +63,8 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_style_
* @param mask_p the image will be drawn only in this area * @param mask_p the image will be drawn only in this area
* @param map_p pointer to a color_t array which contains the pixels of the image * @param map_p pointer to a color_t array which contains the pixels of the image
*/ */
#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, void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
const lv_style_t * style_p, const char * fn); const lv_style_t * style_p, const char * fn);
#endif
/** /**
* Draw a line * Draw a line
@ -79,10 +73,8 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
* @param mask_pthe line will be drawn only on this area * @param mask_pthe line will be drawn only on this area
* @param style_p pointer to a style * @param style_p pointer to a style
*/ */
#if USE_LV_LINE != 0
void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
const lv_style_t * style_p); const lv_style_t * style_p);
#endif
/********************** /**********************
* MACROS * MACROS

View File

@ -134,7 +134,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
new_obj->ext_size = 0; new_obj->ext_size = 0;
/*Set appearance*/ /*Set appearance*/
new_obj->style_p = lv_style_get(LV_STYLE_PLAIN, NULL); new_obj->style_p = lv_style_get(LV_STYLE_SCR, NULL);
/*Set virtual functions*/ /*Set virtual functions*/
lv_obj_set_signal_f(new_obj, lv_obj_signal); lv_obj_set_signal_f(new_obj, lv_obj_signal);
@ -979,6 +979,7 @@ void lv_obj_refr_ext_size(lv_obj_t * obj)
lv_obj_inv(obj); lv_obj_inv(obj);
} }
#if LV_OBJ_FREE_NUM != 0
/** /**
* Set an application specific number for an object. * Set an application specific number for an object.
* It can help to identify objects in the application. * It can help to identify objects in the application.
@ -989,6 +990,7 @@ void lv_obj_set_free_num(lv_obj_t * obj, uint8_t free_num)
{ {
obj->free_num = free_num; obj->free_num = free_num;
} }
#endif
#if LV_OBJ_FREE_P != 0 #if LV_OBJ_FREE_P != 0
/** /**
@ -1253,7 +1255,9 @@ lv_style_t * lv_obj_get_style(lv_obj_t * obj)
lv_obj_t * par = obj->par; lv_obj_t * par = obj->par;
while(par != NULL) { while(par != NULL) {
if(par->style_p != NULL) return par->style_p; if(par->style_p != NULL) {
if(par->style_p->glass == 0) return par->style_p;
}
par = par->par; par = par->par;
} }
} }
@ -1393,7 +1397,7 @@ void * lv_obj_get_ext(lv_obj_t * obj)
return obj->ext; return obj->ext;
} }
#if LV_OBJ_FREE_NUM != 0
/** /**
* Get the free number * Get the free number
* @param obj pointer to an object * @param obj pointer to an object
@ -1403,6 +1407,7 @@ uint8_t lv_obj_get_free_num(lv_obj_t * obj)
{ {
return obj->free_num; return obj->free_num;
} }
#endif
#if LV_OBJ_FREE_P != 0 #if LV_OBJ_FREE_P != 0
/** /**
@ -1440,7 +1445,7 @@ static bool lv_obj_design(lv_obj_t * obj, const area_t * mask_p, lv_design_mode
uint16_t r = style->radius; uint16_t r = style->radius;
if(r == LV_DRAW_CIRCLE) return false; if(r == LV_RADIUS_CIRCLE) return false;
area_t area_tmp; area_t area_tmp;

View File

@ -9,7 +9,6 @@
#include "lv_conf.h" #include "lv_conf.h"
#include "lv_style.h" #include "lv_style.h"
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
@ -60,9 +59,9 @@ void lv_style_init (void)
lv_style_set_ccolor(&lv_style_scr, COLOR_MAKE(0x20, 0x20, 0x20)); lv_style_set_ccolor(&lv_style_scr, COLOR_MAKE(0x20, 0x20, 0x20));
lv_style_set_opa(&lv_style_scr, OPA_COVER); lv_style_set_opa(&lv_style_scr, OPA_COVER);
lv_style_set_mcolor(&lv_style_scr, COLOR_WHITE); lv_style_set_mcolor(&lv_style_scr, COLOR_WHITE);//MAKE(0xc9, 0xdb, 0xee));
lv_style_set_gcolor(&lv_style_scr, COLOR_WHITE); lv_style_set_gcolor(&lv_style_scr, COLOR_WHITE);//MAKE(0x4d, 0x91, 0xd5));
lv_style_set_bcolor(&lv_style_scr, COLOR_WHITE); lv_style_set_bcolor(&lv_style_scr, COLOR_BLACK);
lv_style_set_scolor(&lv_style_scr, COLOR_GRAY); lv_style_set_scolor(&lv_style_scr, COLOR_GRAY);
lv_style_set_radius(&lv_style_scr, 0); lv_style_set_radius(&lv_style_scr, 0);
lv_style_set_bwidth(&lv_style_scr, 0); lv_style_set_bwidth(&lv_style_scr, 0);
@ -73,6 +72,7 @@ void lv_style_init (void)
lv_style_set_bopa(&lv_style_scr, OPA_COVER); lv_style_set_bopa(&lv_style_scr, OPA_COVER);
lv_style_set_empty(&lv_style_scr, false); lv_style_set_empty(&lv_style_scr, false);
lv_style_set_stype(&lv_style_scr, LV_STYPE_FULL); lv_style_set_stype(&lv_style_scr, LV_STYPE_FULL);
lv_style_scr.glass = 0;
lv_style_set_font(&lv_style_scr, font_get(FONT_DEFAULT)); lv_style_set_font(&lv_style_scr, font_get(FONT_DEFAULT));
lv_style_set_letter_space(&lv_style_scr, 1 * LV_DOWNSCALE); lv_style_set_letter_space(&lv_style_scr, 1 * LV_DOWNSCALE);
@ -83,8 +83,11 @@ void lv_style_init (void)
lv_style_set_line_width(&lv_style_scr, 1 * LV_DOWNSCALE); lv_style_set_line_width(&lv_style_scr, 1 * LV_DOWNSCALE);
/*Plain style (by default the same as the screen style)*/ /*Plain style (by default near the same as the screen style)*/
memcpy(&lv_style_plain, &lv_style_scr, sizeof(lv_style_t)); memcpy(&lv_style_plain, &lv_style_scr, sizeof(lv_style_t));
lv_style_set_mcolor(&lv_style_plain, COLOR_WHITE);
lv_style_set_gcolor(&lv_style_plain, COLOR_WHITE);
lv_style_set_bcolor(&lv_style_plain, COLOR_WHITE);
/*Plain color style*/ /*Plain color style*/
memcpy(&lv_style_plain_color, &lv_style_plain, sizeof(lv_style_t)); memcpy(&lv_style_plain_color, &lv_style_plain, sizeof(lv_style_t));
@ -98,7 +101,7 @@ void lv_style_init (void)
lv_style_set_mcolor(&lv_style_pretty, COLOR_WHITE); lv_style_set_mcolor(&lv_style_pretty, COLOR_WHITE);
lv_style_set_gcolor(&lv_style_pretty, COLOR_SILVER); lv_style_set_gcolor(&lv_style_pretty, COLOR_SILVER);
lv_style_set_bcolor(&lv_style_pretty, COLOR_MAKE(0x40, 0x40, 0x40)); lv_style_set_bcolor(&lv_style_pretty, COLOR_MAKE(0x40, 0x40, 0x40));
lv_style_set_radius(&lv_style_pretty, LV_DPI / 10); lv_style_set_radius(&lv_style_pretty, LV_DPI / 12);
lv_style_set_bwidth(&lv_style_pretty, LV_DPI / 40 >= 1 ? LV_DPI / 40 : 1); lv_style_set_bwidth(&lv_style_pretty, LV_DPI / 40 >= 1 ? LV_DPI / 40 : 1);
lv_style_set_bopa(&lv_style_pretty, OPA_50); lv_style_set_bopa(&lv_style_pretty, OPA_50);
@ -115,6 +118,7 @@ void lv_style_init (void)
memcpy(&lv_style_transp, &lv_style_plain, sizeof(lv_style_t)); memcpy(&lv_style_transp, &lv_style_plain, sizeof(lv_style_t));
lv_style_set_empty(&lv_style_transp, true); lv_style_set_empty(&lv_style_transp, true);
lv_style_set_bwidth(&lv_style_transp, 0); lv_style_set_bwidth(&lv_style_transp, 0);
lv_style_transp.glass = 1;
/*Transparent tight style*/ /*Transparent tight style*/
memcpy(&lv_style_transp_tight, &lv_style_transp, sizeof(lv_style_t)); memcpy(&lv_style_transp_tight, &lv_style_transp, sizeof(lv_style_t));
@ -128,7 +132,7 @@ void lv_style_init (void)
lv_style_set_bcolor(&lv_style_btn_rel, COLOR_MAKE(0x0b, 0x19, 0x28)); lv_style_set_bcolor(&lv_style_btn_rel, COLOR_MAKE(0x0b, 0x19, 0x28));
lv_style_set_ccolor(&lv_style_btn_rel, COLOR_MAKE(0xff, 0xff, 0xff)); lv_style_set_ccolor(&lv_style_btn_rel, COLOR_MAKE(0xff, 0xff, 0xff));
lv_style_set_bwidth(&lv_style_btn_rel, LV_DPI / 40 >= 1 ? LV_DPI / 40 : 1); lv_style_set_bwidth(&lv_style_btn_rel, LV_DPI / 40 >= 1 ? LV_DPI / 40 : 1);
lv_style_set_radius(&lv_style_btn_rel, LV_DPI / 10); lv_style_set_radius(&lv_style_btn_rel, LV_DPI / 12);
lv_style_set_bopa(&lv_style_btn_rel, OPA_70); lv_style_set_bopa(&lv_style_btn_rel, OPA_70);
lv_style_set_scolor(&lv_style_btn_rel, COLOR_GRAY); lv_style_set_scolor(&lv_style_btn_rel, COLOR_GRAY);
lv_style_set_swidth(&lv_style_btn_rel, 0); lv_style_set_swidth(&lv_style_btn_rel, 0);

View File

@ -17,7 +17,7 @@
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define LV_DRAW_CIRCLE (CORD_MAX) /*A very big radius to always draw as circle*/ #define LV_RADIUS_CIRCLE (CORD_MAX) /*A very big radius to always draw as circle*/
/********************** /**********************
* TYPEDEFS * TYPEDEFS
@ -41,6 +41,7 @@ typedef struct
/*Object level styles*/ /*Object level styles*/
color_t ccolor; /*Content color (e.g. text or image re-color )*/ color_t ccolor; /*Content color (e.g. text or image re-color )*/
opa_t opa; /*Opacity of the object*/ opa_t opa; /*Opacity of the object*/
uint8_t glass :1; /*1: Do not inherit this style*/
uint8_t empty :1; /*Transparent background (border drawn)*/ uint8_t empty :1; /*Transparent background (border drawn)*/
uint8_t stype :3; /*Shadow type from 'lv_shadow_type_t'*/ uint8_t stype :3; /*Shadow type from 'lv_shadow_type_t'*/
color_t mcolor; /*Main color of background*/ color_t mcolor; /*Main color of background*/

View File

@ -18,8 +18,6 @@
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define LV_BAR_DEF_WIDTH (LV_DPI * 2)
#define LV_BAR_DEF_HEIGHT (LV_DPI / 2)
/********************** /**********************
* TYPEDEFS * TYPEDEFS
@ -77,7 +75,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy)
/*Init the new bar object*/ /*Init the new bar object*/
if(copy == NULL) { if(copy == NULL) {
lv_obj_set_click(new_bar, false); lv_obj_set_click(new_bar, false);
lv_obj_set_size(new_bar, LV_BAR_DEF_WIDTH, LV_BAR_DEF_HEIGHT); lv_obj_set_size(new_bar, LV_DPI * 2, LV_DPI / 3);
lv_obj_set_style(new_bar, lv_style_get(LV_STYLE_PRETTY, NULL)); lv_obj_set_style(new_bar, lv_style_get(LV_STYLE_PRETTY, NULL));
lv_bar_set_value(new_bar, ext->act_value); lv_bar_set_value(new_bar, ext->act_value);
} else { } else {
@ -245,6 +243,9 @@ static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t
ancestor_design_f(bar, mask, mode); ancestor_design_f(bar, mask, mode);
lv_bar_ext_t * ext = lv_obj_get_ext(bar); lv_bar_ext_t * ext = lv_obj_get_ext(bar);
lv_style_t * style_indic = lv_bar_get_style_indic(bar); lv_style_t * style_indic = lv_bar_get_style_indic(bar);
area_t indic_area; area_t indic_area;
area_cpy(&indic_area, &bar->cords); area_cpy(&indic_area, &bar->cords);

View File

@ -7,16 +7,16 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include <misc/gfx/area.h> #include "lv_conf.h"
#include <lvgl/lv_obj/lv_obj.h>
#include <misc/gfx/color.h>
#include <stdbool.h>
#if USE_LV_BTN != 0 #if USE_LV_BTN != 0
#include <string.h> #include "lvgl/lv_obj/lv_obj.h"
#include "lv_btn.h" #include "misc/gfx/area.h"
#include "misc/gfx/color.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "lv_btn.h"
#include <stdbool.h>
#include <string.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -13,8 +13,8 @@
#if USE_LV_BTN != 0 #if USE_LV_BTN != 0
/*Testing of dependencies*/ /*Testing of dependencies*/
#if USE_LV_RECT == 0 #if USE_LV_CONT == 0
#error "lv_btn: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " #error "lv_btn: lv_cont is required. Enable it in lv_conf.h (USE_LV_CONT 1) "
#endif #endif
#include <lvgl/lv_objx/lv_cont.h> #include <lvgl/lv_objx/lv_cont.h>

View File

@ -10,8 +10,8 @@
#if USE_LV_BTNM != 0 #if USE_LV_BTNM != 0
#include "lv_btnm.h" #include "lv_btnm.h"
#include "../lv_draw/lv_draw.h"
#include "misc/gfx/text.h" #include "misc/gfx/text.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_obj/lv_refr.h" #include "../lv_obj/lv_refr.h"
/********************* /*********************
@ -26,7 +26,6 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_t mode); static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_t mode);
static uint8_t lv_btnm_get_width_unit(const char * btn_str); static uint8_t lv_btnm_get_width_unit(const char * btn_str);
static uint16_t lv_btnm_get_btn_from_point(lv_obj_t * btnm, point_t * p); static uint16_t lv_btnm_get_btn_from_point(lv_obj_t * btnm, point_t * p);

View File

@ -13,17 +13,7 @@
#include "lv_conf.h" #include "lv_conf.h"
#if USE_LV_BTNM != 0 #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_obj/lv_obj.h"
#include <lvgl/lv_objx/lv_cont.h>
#include "lv_label.h" #include "lv_label.h"
#include "lv_btn.h" #include "lv_btn.h"

View File

@ -73,7 +73,7 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
lv_btn_set_tgl(new_cb, true); lv_btn_set_tgl(new_cb, true);
lv_obj_set_click(ext->bullet, false); lv_obj_set_click(ext->bullet, false);
lv_btn_set_styles(ext->bullet, lv_style_get(LV_STYLE_BTN_REL, NULL), lv_style_get(LV_STYLE_BTN_PR, NULL), lv_btn_set_styles(ext->bullet, lv_style_get(LV_STYLE_PRETTY, NULL), lv_style_get(LV_STYLE_PRETTY_COLOR, NULL),
lv_style_get(LV_STYLE_BTN_TREL, NULL), lv_style_get(LV_STYLE_BTN_TPR, NULL), lv_style_get(LV_STYLE_BTN_TREL, NULL), lv_style_get(LV_STYLE_BTN_TPR, NULL),
lv_style_get(LV_STYLE_BTN_INA, NULL)); lv_style_get(LV_STYLE_BTN_INA, NULL));
@ -88,8 +88,6 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
/*Refresh the style with new signal function*/ /*Refresh the style with new signal function*/
lv_obj_refr_style(new_cb); lv_obj_refr_style(new_cb);
} }
lv_obj_align_us(new_cb, NULL, LV_ALIGN_CENTER, 0, 0);
return new_cb; return new_cb;
} }

View File

@ -11,9 +11,10 @@
*********************/ *********************/
#include "lv_conf.h" #include "lv_conf.h"
#if USE_LV_CB != 0 #if USE_LV_CB != 0
/*Testing of dependencies*/ /*Testing of dependencies*/
#if USE_LV_BTN == 0 #if USE_LV_BTN == 0
#error "lv_cb: lv_rect is required. Enable it in lv_conf.h (USE_LV_BTN 1) " #error "lv_cb: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) "
#endif #endif
#if USE_LV_LABEL == 0 #if USE_LV_LABEL == 0

View File

@ -499,7 +499,7 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
style_point.bwidth = 0; style_point.bwidth = 0;
style_point.empty = 0; style_point.empty = 0;
style_point.radius = LV_DRAW_CIRCLE; style_point.radius = LV_RADIUS_CIRCLE;
style_point.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8; style_point.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
style_point.radius = ext->dl_width; style_point.radius = ext->dl_width;

View File

@ -3,8 +3,8 @@
* *
*/ */
#ifndef LV_CHARTBG_H #ifndef LV_CHART_H
#define LV_CHARTBG_H #define LV_CHART_H
/********************* /*********************
* INCLUDES * INCLUDES
@ -12,17 +12,7 @@
#include "lv_conf.h" #include "lv_conf.h"
#if USE_LV_CHART != 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_obj/lv_obj.h"
#include <lvgl/lv_objx/lv_cont.h>
#include "lv_line.h" #include "lv_line.h"
/********************* /*********************

View File

@ -8,7 +8,7 @@
*********************/ *********************/
#include "lv_conf.h" #include "lv_conf.h"
#if USE_LV_RECT != 0 #if USE_LV_CONT != 0
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
@ -19,8 +19,6 @@
#include "../lv_draw/lv_draw_vbasic.h" #include "../lv_draw/lv_draw_vbasic.h"
#include "misc/gfx/area.h" #include "misc/gfx/area.h"
#include "misc/mem/dyn_mem.h"
#include "misc/mem/linked_list.h"
#include "misc/gfx/color.h" #include "misc/gfx/color.h"
#include "misc/math/math_base.h" #include "misc/math/math_base.h"

View File

@ -10,10 +10,9 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_conf.h" #include "lv_conf.h"
#if USE_LV_RECT != 0 #if USE_LV_CONT != 0
#include "../lv_obj/lv_obj.h" #include "../lv_obj/lv_obj.h"
#include "../lv_obj/lv_dispi.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -17,7 +17,9 @@
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#ifndef LV_DDLIST_ANIM_TIME
#define LV_DDLIST_ANIM_TIME 100 /*ms*/
#endif
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/

View File

@ -11,6 +11,16 @@
*********************/ *********************/
#include "lv_conf.h" #include "lv_conf.h"
#if USE_LV_DDLIST != 0 #if USE_LV_DDLIST != 0
/*Testing of dependencies*/
#if USE_LV_PAGE == 0
#error "lv_ddlist: lv_page is required. Enable it in lv_conf.h (USE_LV_PAGE 1) "
#endif
#if USE_LV_LABEL == 0
#error "lv_ddlist: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) "
#endif
#include "../lv_obj/lv_obj.h" #include "../lv_obj/lv_obj.h"
#include "../lv_objx/lv_page.h" #include "../lv_objx/lv_page.h"
#include "../lv_objx/lv_label.h" #include "../lv_objx/lv_label.h"

View File

@ -11,12 +11,12 @@
#if USE_LV_GAUGE != 0 #if USE_LV_GAUGE != 0
#include "lv_gauge.h" #include "lv_gauge.h"
#include <stdio.h>
#include <string.h>
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "misc/gfx/text.h" #include "misc/gfx/text.h"
#include "misc/math/trigo.h" #include "misc/math/trigo.h"
#include "misc/math/math_base.h" #include "misc/math/math_base.h"
#include <stdio.h>
#include <string.h>
/********************* /*********************
* DEFINES * DEFINES
@ -434,7 +434,7 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style
lv_style_get(LV_STYLE_PLAIN, &style_neddle_mid); lv_style_get(LV_STYLE_PLAIN, &style_neddle_mid);
style_neddle_mid.mcolor = style->bcolor; style_neddle_mid.mcolor = style->bcolor;
style_neddle_mid.gcolor = style->bcolor; style_neddle_mid.gcolor = style->bcolor;
style_neddle_mid.radius = LV_DRAW_CIRCLE; style_neddle_mid.radius = LV_RADIUS_CIRCLE;
area_t nm_cord; area_t nm_cord;
nm_cord.x1 = x_ofs - style->opad; nm_cord.x1 = x_ofs - style->opad;

View File

@ -14,16 +14,8 @@
#if USE_LV_GAUGE != 0 #if USE_LV_GAUGE != 0
/*Testing of dependencies*/ /*Testing of dependencies*/
#if USE_LV_RECT == 0 #if USE_LV_LMETER == 0
#error "lv_gauge: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " #error "lv_gauge: lv_lmeter is required. Enable it in lv_conf.h (USE_LV_LMETER 1) "
#endif
#if USE_LV_LABEL == 0
#error "lv_gauge: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) "
#endif
#if USE_LV_RECT == 0
#error "lv_gauge: lv_line is required. Enable it in lv_conf.h (USE_LV_LINE 1) "
#endif #endif
#if USE_TRIGO == 0 #if USE_TRIGO == 0

View File

@ -24,7 +24,11 @@
#include "../lv_obj/lv_obj.h" #include "../lv_obj/lv_obj.h"
#include "misc/fs/fsint.h" #include "misc/fs/fsint.h"
#if LV_IMG_ENABLE_SYMBOLS #ifndef LV_IMG_ENABLE_SYMBOLS
#define LV_IMG_ENABLE_SYMBOLS 0
#endif
#if LV_IMG_ENABLE_SYMBOLS != 0
#include "lv_label.h" #include "lv_label.h"
#include "misc/gfx/fonts/symbol_def.h" #include "misc/gfx/fonts/symbol_def.h"
#endif #endif

View File

@ -10,13 +10,8 @@
#if USE_LV_LINE != 0 #if USE_LV_LINE != 0
#include "lv_line.h" #include "lv_line.h"
#include "../lv_draw/lv_draw_vbasic.h"
#include "../lv_draw/lv_draw_rbasic.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include <misc/gfx/area.h> #include "misc/math/math_base.h"
#include <misc/math/math_base.h>
#include <misc/mem/dyn_mem.h>
#include <misc/gfx/color.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>

View File

@ -3,12 +3,6 @@
* *
*/ */
/*Search an replace: line meter -> object normal name with lower case (e.g. button, label etc.)
* lmeter -> object short name with lower case(e.g. btn, label etc)
* LMETER -> object short name with upper case (e.g. BTN, LABEL etc.)
*
*/
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/

View File

@ -3,13 +3,6 @@
* *
*/ */
/*Search an replace: line meter -> object normal name with lower case (e.g. button, label etc.)
* lmeter -> object short name with lower case(e.g. btn, label etc)
* LMETER -> object short name with upper case (e.g. BTN, LABEL etc.)
*
*/
#ifndef LV_LMETER_H #ifndef LV_LMETER_H
#define LV_LMETER_H #define LV_LMETER_H
@ -17,8 +10,19 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_conf.h" #include "lv_conf.h"
#include "misc_conf.h"
#if USE_LV_LMETER != 0 #if USE_LV_LMETER != 0
/*Testing of dependencies*/
#if USE_LV_BAR == 0
#error "lv_lmeter: lv_bar is required. Enable it in lv_conf.h (USE_LV_BAR 1) "
#endif
#if USE_TRIGO == 0
#error "lv_lmeter: trigo is required. Enable it in misc_conf.h (USE_TRIGO 1) "
#endif
#include "../lv_obj/lv_obj.h" #include "../lv_obj/lv_obj.h"
#include "lv_bar.h" #include "lv_bar.h"

View File

@ -13,8 +13,8 @@
#if USE_LV_MBOX != 0 #if USE_LV_MBOX != 0
/*Testing of dependencies*/ /*Testing of dependencies*/
#if USE_LV_RECT == 0 #if USE_LV_CONT == 0
#error "lv_mbox: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " #error "lv_mbox: lv_cont is required. Enable it in lv_conf.h (USE_LV_CONT 1) "
#endif #endif
#if USE_LV_BTN == 0 #if USE_LV_BTN == 0

View File

@ -73,7 +73,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
ext->sbh_draw = 0; ext->sbh_draw = 0;
ext->sbv_draw = 0; ext->sbv_draw = 0;
ext->style_sb = lv_style_get(LV_STYLE_PRETTY, NULL); ext->style_sb = lv_style_get(LV_STYLE_PRETTY, NULL);
ext->sb_width = LV_DPI / 6; ext->sb_width = LV_DPI / 8;
ext->sb_mode = LV_PAGE_SB_MODE_ON; ext->sb_mode = LV_PAGE_SB_MODE_ON;
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);

View File

@ -13,12 +13,13 @@
#if USE_LV_PAGE != 0 #if USE_LV_PAGE != 0
/*Testing of dependencies*/ /*Testing of dependencies*/
#if USE_LV_RECT == 0 #if USE_LV_CONT == 0
#error "lv_page: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " #error "lv_page: lv_cont is required. Enable it in lv_conf.h (USE_LV_CONT 1) "
#endif #endif
#include "../lv_obj/lv_obj.h" #include "../lv_obj/lv_obj.h"
#include <lvgl/lv_objx/lv_cont.h> #include "lvgl/lv_objx/lv_cont.h"
#include "../lv_obj/lv_dispi.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -65,7 +65,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
ext->style_header = lv_style_get(LV_STYLE_PLAIN_COLOR, NULL); ext->style_header = lv_style_get(LV_STYLE_PLAIN_COLOR, NULL);
ext->style_cbtn_rel = lv_style_get(LV_STYLE_BTN_REL, NULL); ext->style_cbtn_rel = lv_style_get(LV_STYLE_BTN_REL, NULL);
ext->style_cbtn_pr = lv_style_get(LV_STYLE_BTN_PR, NULL); ext->style_cbtn_pr = lv_style_get(LV_STYLE_BTN_PR, NULL);
ext->cbtn_size = (3 * LV_DPI) / 4; ext->cbtn_size = ( LV_DPI) / 2;
/*Init the new window object*/ /*Init the new window object*/
if(copy == NULL) { if(copy == NULL) {
@ -410,7 +410,7 @@ static void lv_win_realign(lv_obj_t * win)
if(ext->page == NULL || ext->btnh == NULL || ext->header == NULL || ext->title == NULL) return; if(ext->page == NULL || ext->btnh == NULL || ext->header == NULL || ext->title == NULL) return;
lv_obj_t * cbtn; lv_obj_t * cbtn;
/*Refresh the style of all control buttons*/ /*Refresh the size of all control buttons*/
cbtn = lv_obj_get_child(ext->btnh, NULL); cbtn = lv_obj_get_child(ext->btnh, NULL);
while(cbtn != NULL) { while(cbtn != NULL) {
lv_obj_set_size(cbtn, ext->cbtn_size, ext->cbtn_size); lv_obj_set_size(cbtn, ext->cbtn_size, ext->cbtn_size);