From 4fb9468664e9580769eca5cb3bab9fee7b99ff72 Mon Sep 17 00:00:00 2001 From: Gabor Date: Thu, 12 Jan 2017 09:49:13 +0100 Subject: [PATCH] lv_objx: if a define is not provided by lv_conf.h define it by the object --- lv_conf_temp.h | 8 ++++---- lv_objx/lv_label.c | 17 +++++++++++++++++ lv_objx/lv_mbox.c | 24 +++++++++--------------- lv_objx/lv_mbox.h | 2 -- lv_objx/lv_page.c | 4 ++++ lv_objx/lv_ta.c | 9 +++++++++ 6 files changed, 43 insertions(+), 21 deletions(-) diff --git a/lv_conf_temp.h b/lv_conf_temp.h index 835b53559..6c6cfe9fe 100644 --- a/lv_conf_temp.h +++ b/lv_conf_temp.h @@ -93,7 +93,7 @@ /*Line (dependencies: -*/ #define USE_LV_LINE 1 -/*Image (dependencies: from misc: FSINT, UFS)*/ +/*Image (dependencies: from misc: fsint, ufs)*/ #define USE_LV_IMG 1 #if USE_LV_IMG != 0 //#define LV_IMG_DEF_WALLPAPER img_wallpaper_var /*Comment this line to NOT use wallpaper*/ @@ -133,15 +133,15 @@ /*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 - /*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 * =================*/ diff --git a/lv_objx/lv_label.c b/lv_objx/lv_label.c index 401e454b6..64f9cd0bc 100644 --- a/lv_objx/lv_label.c +++ b/lv_objx/lv_label.c @@ -20,6 +20,23 @@ /********************* * DEFINES *********************/ +/*Test configurations*/ +#ifndef LV_LABEL_SCROLL_SPEED +#define LV_LABEL_SCROLL_SPEED (25 * LV_DOWNSCALE) /*Hor, or ver. scroll speed (px/sec) in 'LV_LABEL_LONG_SCROLL' mode*/ +#endif + +#ifndef LV_LABEL_SCROLL_SPEED_VER +#define LV_LABEL_SCROLL_SPEED_VER (10 * LV_DOWNSCALE) /*Ver. scroll speed if hor. scroll is applied too*/ +#endif + +#ifndef LV_LABEL_SCROLL_PLAYBACK_PAUSE +#define LV_LABEL_SCROLL_PLAYBACK_PAUSE 500 /*Wait before the scroll turns back in ms*/ +#endif + +#ifndef LV_LABEL_SCROLL_REPEAT_PAUSE +#define LV_LABEL_SCROLL_REPEAT_PAUSE 500 /*Wait before the scroll begins again in ms*/ +#endif + #define LV_LABEL_DOT_NUM 3 #define LV_LABEL_DOT_END_INV 0xFFFF diff --git a/lv_objx/lv_mbox.c b/lv_objx/lv_mbox.c index 5180102b6..3518aecb6 100644 --- a/lv_objx/lv_mbox.c +++ b/lv_objx/lv_mbox.c @@ -17,6 +17,10 @@ /********************* * DEFINES *********************/ +/*Test configurations*/ +#ifndef LV_MBOX_ANIM_TIME +#define LV_MBOX_ANIM_TIME 250 /*How fast animate out the message box in auto close. 0: no animation [ms]*/ +#endif /********************** * TYPEDEFS @@ -178,17 +182,12 @@ bool lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param) /*Hide the title and/or buttons*/ const char * title_txt = lv_label_get_text(ext->title); - if(style->hide_title != 0 || title_txt[0] == '\0') { - lv_obj_set_hidden(ext->btnh, true); - } else { - lv_obj_set_hidden(ext->btnh, false); - } + if(title_txt[0] == '\0') lv_obj_set_hidden(ext->btnh, true); + else lv_obj_set_hidden(ext->btnh, false); + + if(lv_obj_get_child_num(ext->btnh) == 0) lv_obj_set_hidden(ext->btnh, true); + else lv_obj_set_hidden(ext->btnh, false); - if(style->hide_btns != 0 || lv_obj_get_child_num(ext->btnh) == 0) { - lv_obj_set_hidden(ext->btnh, true); - } else { - lv_obj_set_hidden(ext->btnh, false); - } break; default: break; @@ -448,7 +447,6 @@ static void lv_mbox_realign(lv_obj_t * mbox) btn = lv_obj_get_child(ext->btnh, btn); } - if(style->hide_title != 0) title_w = 0; cord_t w = MATH_MAX(title_w, txt_w); w = MATH_MAX(w, btn_w); lv_obj_set_width(ext->btnh, w ); @@ -482,8 +480,6 @@ static void lv_mboxs_init(void) lv_rects_get(LV_RECTS_TRANSP, &lv_mboxs_def.btnh); lv_mboxs_def.btnh.hpad = 0; lv_mboxs_def.btnh.vpad = 0; - lv_mboxs_def.hide_btns = 0; - lv_mboxs_def.hide_title = 0; memcpy(&lv_mboxs_info, &lv_mboxs_def, sizeof(lv_mboxs_t)); lv_mboxs_info.bg.objs.color = COLOR_BLACK; @@ -500,8 +496,6 @@ static void lv_mboxs_init(void) lv_mboxs_info.btn.gcolor[LV_BTN_STATE_PR] = COLOR_GRAY; lv_mboxs_info.btn.rects.bopa = OPA_COVER; lv_mboxs_info.btn_label.objs.color = COLOR_WHITE; - lv_mboxs_info.hide_btns = 0; - lv_mboxs_info.hide_title = 0; memcpy(&lv_mboxs_warn, &lv_mboxs_info, sizeof(lv_mboxs_t)); lv_mboxs_warn.bg.objs.color = COLOR_MAKE(0xff, 0xb2, 0x66); diff --git a/lv_objx/lv_mbox.h b/lv_objx/lv_mbox.h index 482192231..968714e83 100644 --- a/lv_objx/lv_mbox.h +++ b/lv_objx/lv_mbox.h @@ -49,8 +49,6 @@ typedef struct lv_rects_t btnh; lv_btns_t btn; lv_labels_t btn_label; - uint8_t hide_title :1; - uint8_t hide_btns :1; }lv_mboxs_t; /*Built-in styles of message box*/ diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index b5d04a87b..5eb8596a1 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -19,6 +19,10 @@ /********************* * DEFINES *********************/ +/*Test configurations*/ +#ifndef LV_PAGE_ANIM_FOCUS_TIME +#define LV_PAGE_ANIM_FOCUS_TIME 300 /*List focus animation time [ms] (0: turn off the animation)*/ +#endif /********************** * TYPEDEFS diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index fce2d90ed..730b39dc7 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -17,6 +17,15 @@ /********************* * DEFINES *********************/ +/*Test configuration*/ +#ifndef LV_TA_MAX_LENGTH +#define LV_TA_MAX_LENGTH 256 +#endif + +#ifndef LV_TA_CUR_BLINK_TIME +#define LV_TA_CUR_BLINK_TIME 400 /*ms*/ +#endif + #define LV_TA_DEF_WIDTH (120 * LV_DOWNSCALE) #define LV_TA_DEF_HEIGHT (80 * LV_DOWNSCALE)