disable multi-lang related functions if USE_LV_MULTI_LANG = 0

This commit is contained in:
Gabor Kiss-Vamosi
2019-01-30 10:49:59 +01:00
parent 950fb33206
commit fa28cee957
4 changed files with 14 additions and 19 deletions
+4 -9
View File
@@ -206,6 +206,7 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
lv_obj_invalidate(img);
}
#if USE_LV_MULTI_LANG
/**
* Set an ID which means a the same source but in different languages
* @param img pointer to an image object
@@ -213,16 +214,13 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
*/
void lv_img_set_src_id(lv_obj_t * img, uint32_t src_id)
{
#if USE_LV_MULTI_LANG
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
ext->lang_txt_id = src_id;
/*Apply the new language*/
img->signal_func(img, LV_SIGNAL_LANG_CHG, NULL);
#else
LV_LOG_WARN("lv_img_set_src_id: multiple languages are not enabled. See lv_conf.h USE_LV_MULTI_LANG ")
#endif
}
#endif
/**
* Enable the auto size feature.
@@ -268,6 +266,7 @@ const char * lv_img_get_file_name(const lv_obj_t * img)
else return "";
}
#if USE_LV_MULTI_LANG
/**
* Get the source ID of the image. (Used by the multi-language feature)
* @param img pointer to an image
@@ -275,14 +274,10 @@ const char * lv_img_get_file_name(const lv_obj_t * img)
*/
uint16_t lv_img_get_src_id(lv_obj_t * img)
{
#if USE_LV_MULTI_LANG
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
return ext->lang_txt_id;
#else
LV_LOG_WARN("lv_img_get_text_lang: multiple languages are not enabled. See lv_conf.h USE_LV_MULTI_LANG ")
return 0;
#endif
}
#endif
/**
* Get the auto size enable attribute
+4 -1
View File
@@ -74,13 +74,14 @@ lv_obj_t * lv_img_create(lv_obj_t * par, const lv_obj_t * copy);
*/
void lv_img_set_src(lv_obj_t * img, const void * src_img);
#if USE_LV_MULTI_LANG
/**
* Set an ID which means a the same source but on different languages
* @param img pointer to an image object
* @param src_id ID of the source
*/
void lv_img_set_src_id(lv_obj_t * img, uint32_t txt_id);
#endif
/**
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0.
@@ -141,12 +142,14 @@ const void * lv_img_get_src(lv_obj_t * img);
*/
const char * lv_img_get_file_name(const lv_obj_t * img);
#if USE_LV_MULTI_LANG
/**
* Get the source ID of the image. (Used by the multi-language feature)
* @param img pointer to an image
* @return ID of the source
*/
uint16_t lv_img_get_src_id(lv_obj_t * img);
#endif
/**
* Get the auto size enable attribute
+4 -9
View File
@@ -237,6 +237,7 @@ void lv_label_set_static_text(lv_obj_t * label, const char * text)
lv_label_refr_text(label);
}
#if USE_LV_MULTI_LANG
/**
*Set a text ID which refers a the same text but in a different languages
* @param label pointer to a label object
@@ -244,16 +245,13 @@ void lv_label_set_static_text(lv_obj_t * label, const char * text)
*/
void lv_label_set_text_id(lv_obj_t * label, uint32_t txt_id)
{
#if USE_LV_MULTI_LANG
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
ext->lang_txt_id = txt_id;
/*Apply the new language*/
label->signal_func(label, LV_SIGNAL_LANG_CHG, NULL);
#else
LV_LOG_WARN("lv_label_set_text_multi: multiple languages are not enabled. See lv_conf.h USE_LV_MULTI_LANG ")
#endif
}
#endif
/**
* Set the behavior of the label with longer text then the object size
@@ -367,6 +365,7 @@ char * lv_label_get_text(const lv_obj_t * label)
return ext->text;
}
#if USE_LV_MULTI_LANG
/**
* Get the text ID of the label. (Used by the multi-language feature)
* @param label pointer to a label object
@@ -374,15 +373,11 @@ char * lv_label_get_text(const lv_obj_t * label)
*/
uint16_t lv_label_get_text_id(lv_obj_t * label)
{
#if USE_LV_MULTI_LANG
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->lang_txt_id;
#else
LV_LOG_WARN("lv_label_get_text_multi: multiple languages are not enabled. See lv_conf.h USE_LV_MULTI_LANG ")
return 0;
}
#endif
}
/**
* Get the long mode of a label
* @param label pointer to a label object
+2
View File
@@ -186,12 +186,14 @@ static inline void lv_label_set_style(lv_obj_t *label, lv_style_t *style)
*/
char * lv_label_get_text(const lv_obj_t * label);
#if USE_LV_MULTI_LANG
/**
* Get the text ID of the label. (Used by the multi-language feature)
* @param label pointer to a label object
* @return ID of the text
*/
uint16_t lv_label_get_text_id(lv_obj_t * label);
#endif
/**
* Get the long mode of a label