merge dev-6.1
This commit is contained in:
@@ -307,6 +307,10 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
|
|||||||
#define LV_FONT_ROBOTO_22 0
|
#define LV_FONT_ROBOTO_22 0
|
||||||
#define LV_FONT_ROBOTO_28 0
|
#define LV_FONT_ROBOTO_28 0
|
||||||
|
|
||||||
|
/* Demonstrate special features */
|
||||||
|
#define LV_FONT_ROBOTO_12_SUBPX 1
|
||||||
|
#define LV_FONT_ROBOTO_28_COMPRESSED 1 /*bpp = 3*/
|
||||||
|
|
||||||
/*Pixel perfect monospace font
|
/*Pixel perfect monospace font
|
||||||
* http://pelulamu.net/unscii/ */
|
* http://pelulamu.net/unscii/ */
|
||||||
#define LV_FONT_UNSCII_8 0
|
#define LV_FONT_UNSCII_8 0
|
||||||
@@ -327,6 +331,12 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
|
|||||||
* but with > 10,000 characters if you see issues probably you need to enable it.*/
|
* but with > 10,000 characters if you see issues probably you need to enable it.*/
|
||||||
#define LV_FONT_FMT_TXT_LARGE 0
|
#define LV_FONT_FMT_TXT_LARGE 0
|
||||||
|
|
||||||
|
/* Set the pixel order of the display.
|
||||||
|
* Important only if "subpx fonts" are used.
|
||||||
|
* With "normal" font it doesn't matter.
|
||||||
|
*/
|
||||||
|
#define LV_FONT_SUBPX_BGR 0
|
||||||
|
|
||||||
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
|
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
|
||||||
typedef void * lv_font_user_data_t;
|
typedef void * lv_font_user_data_t;
|
||||||
|
|
||||||
@@ -344,7 +354,6 @@ typedef void * lv_font_user_data_t;
|
|||||||
/*Can break (wrap) texts on these chars*/
|
/*Can break (wrap) texts on these chars*/
|
||||||
#define LV_TXT_BREAK_CHARS " ,.;:-_"
|
#define LV_TXT_BREAK_CHARS " ,.;:-_"
|
||||||
|
|
||||||
|
|
||||||
/* If a word is at least this long, will break wherever "prettiest"
|
/* If a word is at least this long, will break wherever "prettiest"
|
||||||
* To disable, set to a value <= 0 */
|
* To disable, set to a value <= 0 */
|
||||||
#define LV_TXT_LINE_BREAK_LONG_LEN 12
|
#define LV_TXT_LINE_BREAK_LONG_LEN 12
|
||||||
@@ -356,7 +365,10 @@ typedef void * lv_font_user_data_t;
|
|||||||
/* Minimum number of characters in a long word to put on a line after a break.
|
/* Minimum number of characters in a long word to put on a line after a break.
|
||||||
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
|
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
|
||||||
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
|
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
|
||||||
|
|
||||||
|
/* The control character to use for signalling text recoloring. */
|
||||||
|
#define LV_TXT_COLOR_CMD "#"
|
||||||
|
|
||||||
/* Support bidirectional texts.
|
/* Support bidirectional texts.
|
||||||
* Allows mixing Left-to-Right and Right-to-Left texts.
|
* Allows mixing Left-to-Right and Right-to-Left texts.
|
||||||
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
|
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
|
||||||
@@ -378,12 +390,6 @@ typedef void * lv_font_user_data_t;
|
|||||||
# define lv_vsnprintf vsnprintf
|
# define lv_vsnprintf vsnprintf
|
||||||
#endif /*LV_SPRINTF_CUSTOM*/
|
#endif /*LV_SPRINTF_CUSTOM*/
|
||||||
|
|
||||||
/* Set the pixel order of the display.
|
|
||||||
* Important only if "subpx fonts" are used.
|
|
||||||
* With "normal" font it doesn't matter.
|
|
||||||
*/
|
|
||||||
#define LV_SUBPX_BGR 0
|
|
||||||
|
|
||||||
/*===================
|
/*===================
|
||||||
* LV_OBJ SETTINGS
|
* LV_OBJ SETTINGS
|
||||||
*==================*/
|
*==================*/
|
||||||
|
|||||||
1
lvgl.h
1
lvgl.h
@@ -34,6 +34,7 @@ extern "C" {
|
|||||||
#include "src/lv_font/lv_font.h"
|
#include "src/lv_font/lv_font.h"
|
||||||
#include "src/lv_font/lv_font_fmt_txt.h"
|
#include "src/lv_font/lv_font_fmt_txt.h"
|
||||||
#include "src/lv_misc/lv_bidi.h"
|
#include "src/lv_misc/lv_bidi.h"
|
||||||
|
#include "src/lv_misc/lv_printf.h"
|
||||||
|
|
||||||
#include "src/lv_objx/lv_btn.h"
|
#include "src/lv_objx/lv_btn.h"
|
||||||
#include "src/lv_objx/lv_imgbtn.h"
|
#include "src/lv_objx/lv_imgbtn.h"
|
||||||
|
|||||||
Binary file not shown.
BIN
scripts/built_in_font/FontAwesome5-Solid+Brands+Regular.woff
Normal file
BIN
scripts/built_in_font/FontAwesome5-Solid+Brands+Regular.woff
Normal file
Binary file not shown.
@@ -40,8 +40,8 @@ else:
|
|||||||
compr = ""
|
compr = ""
|
||||||
|
|
||||||
#Built in symbols
|
#Built in symbols
|
||||||
syms = "61441,61448,61451,61452,61453,61457,61459,61460,61461,61465,61468,61473,61478,61479,61480,61502,61504,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61671,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62099"
|
syms = "61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650"
|
||||||
|
|
||||||
#Run the command
|
#Run the command
|
||||||
cmd = "lv_font_conv {} --bpp {} --size {} --font ./Roboto-Regular.woff -r {} --font FontAwesome.ttf -r {} --format lvgl -o {} --force-fast-kern-format".format(compr, args.bpp, args.size, args.range[0], syms, args.output)
|
cmd = "lv_font_conv {} --bpp {} --size {} --font Roboto-Regular.woff -r {} --font FontAwesome5-Solid+Brands+Regular.woff -r {} --format lvgl -o {} --force-fast-kern-format".format(compr, args.bpp, args.size, args.range[0], syms, args.output)
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|||||||
@@ -66,6 +66,35 @@ static inline bool lv_ddlist_get_draw_arrow(lv_obj_t * ddlist)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LV_USE_BAR
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make the bar symmetric to zero. The indicator will grow from zero instead of the minimum
|
||||||
|
* position.
|
||||||
|
* @param bar pointer to a bar object
|
||||||
|
* @param en true: enable disable symmetric behavior; false: disable
|
||||||
|
* @deprecated As of v7.0, you should use `lv_bar_set_type` instead.
|
||||||
|
*/
|
||||||
|
static inline void lv_bar_set_sym(lv_obj_t * bar, bool en)
|
||||||
|
{
|
||||||
|
if(en)
|
||||||
|
lv_bar_set_type(bar, LV_BAR_TYPE_SYM);
|
||||||
|
else
|
||||||
|
lv_bar_set_type(bar, LV_BAR_TYPE_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get whether the bar is symmetric or not.
|
||||||
|
* @param bar pointer to a bar object
|
||||||
|
* @return true: symmetric is enabled; false: disable
|
||||||
|
* @deprecated As of v7.0, you should use `lv_bar_get_type` instead.
|
||||||
|
*/
|
||||||
|
static inline bool lv_bar_get_sym(lv_obj_t * bar) {
|
||||||
|
return lv_bar_get_type(bar) == LV_BAR_TYPE_SYM;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#if LV_USE_SLIDER
|
#if LV_USE_SLIDER
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,35 +121,6 @@ static inline bool lv_slider_get_sym(lv_obj_t * slider) {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_BAR
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make the bar symmetric to zero. The indicator will grow from zero instead of the minimum
|
|
||||||
* position.
|
|
||||||
* @param bar pointer to a bar object
|
|
||||||
* @param en true: enable disable symmetric behavior; false: disable
|
|
||||||
* @deprecated As of v7.0, you should use `lv_bar_set_type` instead.
|
|
||||||
*/
|
|
||||||
static inline void lv_bar_set_sym(lv_obj_t * bar, bool en)
|
|
||||||
{
|
|
||||||
if(en)
|
|
||||||
lv_bar_set_type(bar, LV_BAR_TYPE_SYM);
|
|
||||||
else
|
|
||||||
lv_bar_set_type(bar, LV_BAR_TYPE_NORMAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get whether the bar is symmetric or not.
|
|
||||||
* @param bar pointer to a bar object
|
|
||||||
* @return true: symmetric is enabled; false: disable
|
|
||||||
* @deprecated As of v7.0, you should use `lv_bar_get_type` instead.
|
|
||||||
*/
|
|
||||||
static inline bool lv_bar_get_sym(lv_obj_t * bar) {
|
|
||||||
return lv_bar_get_type(bar) == LV_BAR_TYPE_SYM;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
|
|||||||
@@ -427,6 +427,14 @@
|
|||||||
#define LV_FONT_ROBOTO_28 0
|
#define LV_FONT_ROBOTO_28 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Demonstrate special features */
|
||||||
|
#ifndef LV_FONT_ROBOTO_12_SUBPX
|
||||||
|
#define LV_FONT_ROBOTO_12_SUBPX 1
|
||||||
|
#endif
|
||||||
|
#ifndef LV_FONT_ROBOTO_28_COMPRESSED
|
||||||
|
#define LV_FONT_ROBOTO_28_COMPRESSED 1 /*bpp = 3*/
|
||||||
|
#endif
|
||||||
|
|
||||||
/*Pixel perfect monospace font
|
/*Pixel perfect monospace font
|
||||||
* http://pelulamu.net/unscii/ */
|
* http://pelulamu.net/unscii/ */
|
||||||
#ifndef LV_FONT_UNSCII_8
|
#ifndef LV_FONT_UNSCII_8
|
||||||
@@ -455,6 +463,14 @@
|
|||||||
#define LV_FONT_FMT_TXT_LARGE 0
|
#define LV_FONT_FMT_TXT_LARGE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Set the pixel order of the display.
|
||||||
|
* Important only if "subpx fonts" are used.
|
||||||
|
* With "normal" font it doesn't matter.
|
||||||
|
*/
|
||||||
|
#ifndef LV_FONT_SUBPX_BGR
|
||||||
|
#define LV_FONT_SUBPX_BGR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
|
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
|
||||||
|
|
||||||
/*=================
|
/*=================
|
||||||
@@ -475,7 +491,6 @@
|
|||||||
#define LV_TXT_BREAK_CHARS " ,.;:-_"
|
#define LV_TXT_BREAK_CHARS " ,.;:-_"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* If a word is at least this long, will break wherever "prettiest"
|
/* If a word is at least this long, will break wherever "prettiest"
|
||||||
* To disable, set to a value <= 0 */
|
* To disable, set to a value <= 0 */
|
||||||
#ifndef LV_TXT_LINE_BREAK_LONG_LEN
|
#ifndef LV_TXT_LINE_BREAK_LONG_LEN
|
||||||
@@ -493,7 +508,12 @@
|
|||||||
#ifndef LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN
|
#ifndef LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN
|
||||||
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
|
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* The control character to use for signalling text recoloring. */
|
||||||
|
#ifndef LV_TXT_COLOR_CMD
|
||||||
|
#define LV_TXT_COLOR_CMD "#"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Support bidirectional texts.
|
/* Support bidirectional texts.
|
||||||
* Allows mixing Left-to-Right and Right-to-Left texts.
|
* Allows mixing Left-to-Right and Right-to-Left texts.
|
||||||
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
|
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
|
||||||
@@ -527,14 +547,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif /*LV_SPRINTF_CUSTOM*/
|
#endif /*LV_SPRINTF_CUSTOM*/
|
||||||
|
|
||||||
/* Set the pixel order of the display.
|
|
||||||
* Important only if "subpx fonts" are used.
|
|
||||||
* With "normal" font it doesn't matter.
|
|
||||||
*/
|
|
||||||
#ifndef LV_SUBPX_BGR
|
|
||||||
#define LV_SUBPX_BGR 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*===================
|
/*===================
|
||||||
* LV_OBJ SETTINGS
|
* LV_OBJ SETTINGS
|
||||||
*==================*/
|
*==================*/
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ void lv_debug_log_error(const char * msg, uint64_t value)
|
|||||||
{
|
{
|
||||||
static const char hex[] = "0123456789ABCDEF";
|
static const char hex[] = "0123456789ABCDEF";
|
||||||
|
|
||||||
uint32_t msg_len = strlen(msg);
|
size_t msg_len = strlen(msg);
|
||||||
uint32_t value_len = sizeof(unsigned long int);
|
uint32_t value_len = sizeof(unsigned long int);
|
||||||
|
|
||||||
if(msg_len < 230) {
|
if(msg_len < 230) {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void lv_debug_log_error(const char * msg, uint64_t value);
|
|||||||
do { \
|
do { \
|
||||||
if(!(expr)) { \
|
if(!(expr)) { \
|
||||||
LV_LOG_ERROR(__func__); \
|
LV_LOG_ERROR(__func__); \
|
||||||
lv_debug_log_error(msg, (unsigned long int)value); \
|
lv_debug_log_error(msg, (uint64_t)value); \
|
||||||
while(1); \
|
while(1); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ static inline lv_obj_t * lv_layer_top(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the active screen of the deafult display
|
* Get the active screen of the default display
|
||||||
* @return pointer to the sys layer
|
* @return pointer to the sys layer
|
||||||
*/
|
*/
|
||||||
static inline lv_obj_t * lv_layer_sys(void)
|
static inline lv_obj_t * lv_layer_sys(void)
|
||||||
|
|||||||
@@ -154,6 +154,11 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
|||||||
new_obj->par = NULL; /*Screens has no a parent*/
|
new_obj->par = NULL; /*Screens has no a parent*/
|
||||||
lv_ll_init(&(new_obj->child_ll), sizeof(lv_obj_t));
|
lv_ll_init(&(new_obj->child_ll), sizeof(lv_obj_t));
|
||||||
|
|
||||||
|
/*Set the callbacks*/
|
||||||
|
new_obj->signal_cb = lv_obj_signal;
|
||||||
|
new_obj->design_cb = lv_obj_design;
|
||||||
|
new_obj->event_cb = NULL;
|
||||||
|
|
||||||
/*Set coordinates to full screen size*/
|
/*Set coordinates to full screen size*/
|
||||||
new_obj->coords.x1 = 0;
|
new_obj->coords.x1 = 0;
|
||||||
new_obj->coords.y1 = 0;
|
new_obj->coords.y1 = 0;
|
||||||
@@ -186,10 +191,6 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
|||||||
} else {
|
} else {
|
||||||
new_obj->style_p = &lv_style_scr;
|
new_obj->style_p = &lv_style_scr;
|
||||||
}
|
}
|
||||||
/*Set the callbacks*/
|
|
||||||
new_obj->signal_cb = lv_obj_signal;
|
|
||||||
new_obj->design_cb = lv_obj_design;
|
|
||||||
new_obj->event_cb = NULL;
|
|
||||||
|
|
||||||
/*Init. user date*/
|
/*Init. user date*/
|
||||||
#if LV_USE_USER_DATA
|
#if LV_USE_USER_DATA
|
||||||
@@ -235,6 +236,11 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
|||||||
new_obj->par = parent; /*Set the parent*/
|
new_obj->par = parent; /*Set the parent*/
|
||||||
lv_ll_init(&(new_obj->child_ll), sizeof(lv_obj_t));
|
lv_ll_init(&(new_obj->child_ll), sizeof(lv_obj_t));
|
||||||
|
|
||||||
|
/*Set the callbacks*/
|
||||||
|
new_obj->signal_cb = lv_obj_signal;
|
||||||
|
new_obj->design_cb = lv_obj_design;
|
||||||
|
new_obj->event_cb = NULL;
|
||||||
|
|
||||||
#if LV_USE_BIDI
|
#if LV_USE_BIDI
|
||||||
new_obj->base_dir = LV_BIDI_DIR_INHERIT;
|
new_obj->base_dir = LV_BIDI_DIR_INHERIT;
|
||||||
#else
|
#else
|
||||||
@@ -278,11 +284,6 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
|||||||
new_obj->style_p = &lv_style_plain_color;
|
new_obj->style_p = &lv_style_plain_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Set the callbacks*/
|
|
||||||
new_obj->signal_cb = lv_obj_signal;
|
|
||||||
new_obj->design_cb = lv_obj_design;
|
|
||||||
new_obj->event_cb = NULL;
|
|
||||||
|
|
||||||
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
|
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
|
||||||
memset(&new_obj->ext_click_pad, 0, sizeof(new_obj->ext_click_pad));
|
memset(&new_obj->ext_click_pad, 0, sizeof(new_obj->ext_click_pad));
|
||||||
#endif
|
#endif
|
||||||
@@ -1855,7 +1856,7 @@ lv_coord_t lv_obj_get_height(const lv_obj_t * obj)
|
|||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @return the width which still fits into the container
|
* @return the width which still fits into the container
|
||||||
*/
|
*/
|
||||||
lv_coord_t lv_obj_get_width_fit(lv_obj_t * obj)
|
lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||||
|
|
||||||
@@ -1869,7 +1870,7 @@ lv_coord_t lv_obj_get_width_fit(lv_obj_t * obj)
|
|||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @return the height which still fits into the container
|
* @return the height which still fits into the container
|
||||||
*/
|
*/
|
||||||
lv_coord_t lv_obj_get_height_fit(lv_obj_t * obj)
|
lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||||
|
|
||||||
@@ -1883,7 +1884,7 @@ lv_coord_t lv_obj_get_height_fit(lv_obj_t * obj)
|
|||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @return true: auto realign is enabled; false: auto realign is disabled
|
* @return true: auto realign is enabled; false: auto realign is disabled
|
||||||
*/
|
*/
|
||||||
bool lv_obj_get_auto_realign(lv_obj_t * obj)
|
bool lv_obj_get_auto_realign(const lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||||
|
|
||||||
@@ -2145,6 +2146,7 @@ lv_bidi_dir_t lv_obj_get_base_dir(const lv_obj_t * obj)
|
|||||||
|
|
||||||
return LV_BIDI_BASE_DIR_DEF;
|
return LV_BIDI_BASE_DIR_DEF;
|
||||||
#else
|
#else
|
||||||
|
(void) obj; /*Unused*/
|
||||||
return LV_BIDI_DIR_LTR;
|
return LV_BIDI_DIR_LTR;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -2265,7 +2267,7 @@ void * lv_obj_get_ext_attr(const lv_obj_t * obj)
|
|||||||
* @param obj pointer to an object which type should be get
|
* @param obj pointer to an object which type should be get
|
||||||
* @param buf pointer to an `lv_obj_type_t` buffer to store the types
|
* @param buf pointer to an `lv_obj_type_t` buffer to store the types
|
||||||
*/
|
*/
|
||||||
void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf)
|
void lv_obj_get_type(const lv_obj_t * obj, lv_obj_type_t * buf)
|
||||||
{
|
{
|
||||||
LV_ASSERT_NULL(buf);
|
LV_ASSERT_NULL(buf);
|
||||||
LV_ASSERT_NULL(obj);
|
LV_ASSERT_NULL(obj);
|
||||||
@@ -2275,7 +2277,7 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf)
|
|||||||
memset(buf, 0, sizeof(lv_obj_type_t));
|
memset(buf, 0, sizeof(lv_obj_type_t));
|
||||||
memset(&tmp, 0, sizeof(lv_obj_type_t));
|
memset(&tmp, 0, sizeof(lv_obj_type_t));
|
||||||
|
|
||||||
obj->signal_cb(obj, LV_SIGNAL_GET_TYPE, &tmp);
|
obj->signal_cb((lv_obj_t *)obj, LV_SIGNAL_GET_TYPE, &tmp);
|
||||||
|
|
||||||
uint8_t cnt;
|
uint8_t cnt;
|
||||||
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
|
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
|
||||||
@@ -2296,7 +2298,7 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf)
|
|||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @return user data
|
* @return user data
|
||||||
*/
|
*/
|
||||||
lv_obj_user_data_t lv_obj_get_user_data(lv_obj_t * obj)
|
lv_obj_user_data_t lv_obj_get_user_data(const lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||||
|
|
||||||
@@ -2308,11 +2310,11 @@ lv_obj_user_data_t lv_obj_get_user_data(lv_obj_t * obj)
|
|||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @return pointer to the user data
|
* @return pointer to the user data
|
||||||
*/
|
*/
|
||||||
lv_obj_user_data_t * lv_obj_get_user_data_ptr(lv_obj_t * obj)
|
lv_obj_user_data_t * lv_obj_get_user_data_ptr(const lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||||
|
|
||||||
return &obj->user_data;
|
return (lv_obj_user_data_t *)&obj->user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2366,8 +2368,8 @@ bool lv_obj_is_focused(const lv_obj_t * obj)
|
|||||||
/**
|
/**
|
||||||
* Used in the signal callback to handle `LV_SIGNAL_GET_TYPE` signal
|
* Used in the signal callback to handle `LV_SIGNAL_GET_TYPE` signal
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @param buf pointer to `lv_obj_type_t`. (`param` i nteh signal callback)
|
* @param buf pointer to `lv_obj_type_t`. (`param` in the signal callback)
|
||||||
* @param name name of the object. E.g. "lv_btn". (Only teh pointer is saved)
|
* @param name name of the object. E.g. "lv_btn". (Only the pointer is saved)
|
||||||
* @return LV_RES_OK
|
* @return LV_RES_OK
|
||||||
*/
|
*/
|
||||||
lv_res_t lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name)
|
lv_res_t lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name)
|
||||||
|
|||||||
@@ -735,21 +735,21 @@ lv_coord_t lv_obj_get_height(const lv_obj_t * obj);
|
|||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @return the width which still fits into the container
|
* @return the width which still fits into the container
|
||||||
*/
|
*/
|
||||||
lv_coord_t lv_obj_get_width_fit(lv_obj_t * obj);
|
lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get that height reduced by the top an bottom padding.
|
* Get that height reduced by the top an bottom padding.
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @return the height which still fits into the container
|
* @return the height which still fits into the container
|
||||||
*/
|
*/
|
||||||
lv_coord_t lv_obj_get_height_fit(lv_obj_t * obj);
|
lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the automatic realign property of the object.
|
* Get the automatic realign property of the object.
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @return true: auto realign is enabled; false: auto realign is disabled
|
* @return true: auto realign is enabled; false: auto realign is disabled
|
||||||
*/
|
*/
|
||||||
bool lv_obj_get_auto_realign(lv_obj_t * obj);
|
bool lv_obj_get_auto_realign(const lv_obj_t * obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the left padding of extended clickable area
|
* Get the left padding of extended clickable area
|
||||||
@@ -928,7 +928,7 @@ void * lv_obj_get_ext_attr(const lv_obj_t * obj);
|
|||||||
* @param obj pointer to an object which type should be get
|
* @param obj pointer to an object which type should be get
|
||||||
* @param buf pointer to an `lv_obj_type_t` buffer to store the types
|
* @param buf pointer to an `lv_obj_type_t` buffer to store the types
|
||||||
*/
|
*/
|
||||||
void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf);
|
void lv_obj_get_type(const lv_obj_t * obj, lv_obj_type_t * buf);
|
||||||
|
|
||||||
#if LV_USE_USER_DATA
|
#if LV_USE_USER_DATA
|
||||||
/**
|
/**
|
||||||
@@ -936,14 +936,14 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf);
|
|||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @return user data
|
* @return user data
|
||||||
*/
|
*/
|
||||||
lv_obj_user_data_t lv_obj_get_user_data(lv_obj_t * obj);
|
lv_obj_user_data_t lv_obj_get_user_data(const lv_obj_t * obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a pointer to the object's user data
|
* Get a pointer to the object's user data
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @return pointer to the user data
|
* @return pointer to the user data
|
||||||
*/
|
*/
|
||||||
lv_obj_user_data_t * lv_obj_get_user_data_ptr(lv_obj_t * obj);
|
lv_obj_user_data_t * lv_obj_get_user_data_ptr(const lv_obj_t * obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the object's user data. The data will be copied.
|
* Set the object's user data. The data will be copied.
|
||||||
@@ -977,8 +977,8 @@ bool lv_obj_is_focused(const lv_obj_t * obj);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used in the signal callback to handle `LV_SIGNAL_GET_TYPE` signal
|
* Used in the signal callback to handle `LV_SIGNAL_GET_TYPE` signal
|
||||||
* @param buf pointer to `lv_obj_type_t`. (`param` i nteh signal callback)
|
* @param buf pointer to `lv_obj_type_t`. (`param` in the signal callback)
|
||||||
* @param name name of the object. E.g. "lv_btn". (Only teh pointer is saved)
|
* @param name name of the object. E.g. "lv_btn". (Only the pointer is saved)
|
||||||
* @return LV_RES_OK
|
* @return LV_RES_OK
|
||||||
*/
|
*/
|
||||||
lv_res_t lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name);
|
lv_res_t lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name);
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, const
|
|||||||
dsc->user_data = NULL;
|
dsc->user_data = NULL;
|
||||||
|
|
||||||
if(dsc->src_type == LV_IMG_SRC_FILE) {
|
if(dsc->src_type == LV_IMG_SRC_FILE) {
|
||||||
uint16_t fnlen = strlen(src);
|
size_t fnlen = strlen(src);
|
||||||
dsc->src = lv_mem_alloc(fnlen + 1);
|
dsc->src = lv_mem_alloc(fnlen + 1);
|
||||||
strcpy((char *)dsc->src, src);
|
strcpy((char *)dsc->src, src);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ typedef struct _lv_font_struct
|
|||||||
lv_coord_t line_height; /**< The real line height where any text fits*/
|
lv_coord_t line_height; /**< The real line height where any text fits*/
|
||||||
lv_coord_t base_line; /**< Base line measured from the top of the line_height*/
|
lv_coord_t base_line; /**< Base line measured from the top of the line_height*/
|
||||||
uint8_t subpx :2; /**< An element of `lv_font_subpx_t`*/
|
uint8_t subpx :2; /**< An element of `lv_font_subpx_t`*/
|
||||||
void * dsc; /**< Store implementation specific data here*/
|
void * dsc; /**< Store implementation specific or run_time data or caching here*/
|
||||||
#if LV_USE_USER_DATA
|
#if LV_USE_USER_DATA
|
||||||
lv_font_user_data_t user_data; /**< Custom user data for font. */
|
lv_font_user_data_t user_data; /**< Custom user data for font. */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
|
|||||||
|
|
||||||
lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *) font->dsc;
|
lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *) font->dsc;
|
||||||
uint32_t gid = get_glyph_dsc_id(font, unicode_letter);
|
uint32_t gid = get_glyph_dsc_id(font, unicode_letter);
|
||||||
if(!gid) return false;
|
if(!gid) return NULL;
|
||||||
|
|
||||||
const lv_font_fmt_txt_glyph_dsc_t * gdsc = &fdsc->glyph_dsc[gid];
|
const lv_font_fmt_txt_glyph_dsc_t * gdsc = &fdsc->glyph_dsc[gid];
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
|
|||||||
if(buf == NULL) return NULL;
|
if(buf == NULL) return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], buf, gdsc->box_w , gdsc->box_h, fdsc->bpp);
|
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], buf, gdsc->box_w , gdsc->box_h, (uint8_t)fdsc->bpp);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t *
|
|||||||
dsc_out->box_w = gdsc->box_w;
|
dsc_out->box_w = gdsc->box_w;
|
||||||
dsc_out->ofs_x = gdsc->ofs_x;
|
dsc_out->ofs_x = gdsc->ofs_x;
|
||||||
dsc_out->ofs_y = gdsc->ofs_y;
|
dsc_out->ofs_y = gdsc->ofs_y;
|
||||||
dsc_out->bpp = fdsc->bpp;
|
dsc_out->bpp = (uint8_t)fdsc->bpp;
|
||||||
|
|
||||||
if(is_tab) dsc_out->box_w = dsc_out->box_w * 2;
|
if(is_tab) dsc_out->box_w = dsc_out->box_w * 2;
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
|
|||||||
uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length, sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
|
uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length, sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
|
||||||
|
|
||||||
if(p) {
|
if(p) {
|
||||||
uint32_t ofs = (lv_uintptr_t)p - (lv_uintptr_t) fdsc->cmaps[i].unicode_list;
|
lv_uintptr_t ofs = (lv_uintptr_t)p - (lv_uintptr_t) fdsc->cmaps[i].unicode_list;
|
||||||
ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/
|
ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/
|
||||||
glyph_id = fdsc->cmaps[i].glyph_id_start + ofs;
|
glyph_id = fdsc->cmaps[i].glyph_id_start + ofs;
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
|
|||||||
uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length, sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
|
uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length, sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
|
||||||
|
|
||||||
if(p) {
|
if(p) {
|
||||||
uint32_t ofs = (lv_uintptr_t)p - (lv_uintptr_t) fdsc->cmaps[i].unicode_list;
|
lv_uintptr_t ofs = (lv_uintptr_t)p - (lv_uintptr_t) fdsc->cmaps[i].unicode_list;
|
||||||
ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/
|
ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/
|
||||||
const uint8_t * gid_ofs_16 = fdsc->cmaps[i].glyph_id_ofs_list;
|
const uint8_t * gid_ofs_16 = fdsc->cmaps[i].glyph_id_ofs_list;
|
||||||
glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_16[ofs];
|
glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_16[ofs];
|
||||||
@@ -244,7 +244,7 @@ static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t
|
|||||||
|
|
||||||
/*If the `g_id_both` were found get its index from the pointer*/
|
/*If the `g_id_both` were found get its index from the pointer*/
|
||||||
if(kid_p) {
|
if(kid_p) {
|
||||||
uint32_t ofs = (lv_uintptr_t)kid_p - (lv_uintptr_t)g_ids;
|
lv_uintptr_t ofs = (lv_uintptr_t)kid_p - (lv_uintptr_t)g_ids;
|
||||||
ofs = ofs >> 1; /*ofs is for pair, divide by 2 to refer as a single value*/
|
ofs = ofs >> 1; /*ofs is for pair, divide by 2 to refer as a single value*/
|
||||||
value = kdsc->values[ofs];
|
value = kdsc->values[ofs];
|
||||||
}
|
}
|
||||||
@@ -252,12 +252,12 @@ static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t
|
|||||||
/* Use binary search to find the kern value.
|
/* Use binary search to find the kern value.
|
||||||
* The pairs are ordered left_id first, then right_id secondly. */
|
* The pairs are ordered left_id first, then right_id secondly. */
|
||||||
const uint16_t * g_ids = kdsc->glyph_ids;
|
const uint16_t * g_ids = kdsc->glyph_ids;
|
||||||
uint32_t g_id_both = (uint32_t)((uint32_t)gid_right << 8) + gid_left; /*Create one number from the ids*/
|
lv_uintptr_t g_id_both = (uint32_t)((uint32_t)gid_right << 8) + gid_left; /*Create one number from the ids*/
|
||||||
uint8_t * kid_p = lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 4, kern_pair_16_compare);
|
uint8_t * kid_p = lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 4, kern_pair_16_compare);
|
||||||
|
|
||||||
/*If the `g_id_both` were found get its index from the pointer*/
|
/*If the `g_id_both` were found get its index from the pointer*/
|
||||||
if(kid_p) {
|
if(kid_p) {
|
||||||
uint32_t ofs = (lv_uintptr_t)kid_p - (lv_uintptr_t)g_ids;
|
lv_uintptr_t ofs = (lv_uintptr_t)kid_p - (lv_uintptr_t)g_ids;
|
||||||
ofs = ofs >> 4; /*ofs is 4 byte pairs, divide by 4 to refer as a single value*/
|
ofs = ofs >> 4; /*ofs is 4 byte pairs, divide by 4 to refer as a single value*/
|
||||||
value = kdsc->values[ofs];
|
value = kdsc->values[ofs];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ typedef struct {
|
|||||||
uint16_t list_length;
|
uint16_t list_length;
|
||||||
|
|
||||||
/** Type of this character map*/
|
/** Type of this character map*/
|
||||||
lv_font_fmt_txt_cmap_type_t type :2;
|
lv_font_fmt_txt_cmap_type_t type;
|
||||||
}lv_font_fmt_txt_cmap_t;
|
}lv_font_fmt_txt_cmap_t;
|
||||||
|
|
||||||
/** A simple mapping of kern values from pairs*/
|
/** A simple mapping of kern values from pairs*/
|
||||||
@@ -195,7 +195,6 @@ typedef struct {
|
|||||||
* from `lv_font_fmt_txt_bitmap_format_t`
|
* from `lv_font_fmt_txt_bitmap_format_t`
|
||||||
*/
|
*/
|
||||||
uint16_t bitmap_format :2;
|
uint16_t bitmap_format :2;
|
||||||
uint16_t subpx :1;
|
|
||||||
|
|
||||||
/*Cache the last letter and is glyph id*/
|
/*Cache the last letter and is glyph id*/
|
||||||
uint32_t last_letter;
|
uint32_t last_letter;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
3419
src/lv_font/lv_font_roboto_12_subpx.c
Normal file
3419
src/lv_font/lv_font_roboto_12_subpx.c
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2451
src/lv_font/lv_font_roboto_28_compressed.c
Normal file
2451
src/lv_font/lv_font_roboto_28_compressed.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -114,7 +114,7 @@ enum {
|
|||||||
# define LV_COLOR_GET_B8(c) (c).ch.blue
|
# define LV_COLOR_GET_B8(c) (c).ch.blue
|
||||||
# define LV_COLOR_GET_A8(c) 0xFF
|
# define LV_COLOR_GET_A8(c) 0xFF
|
||||||
|
|
||||||
# define LV_COLOR_SET_R16(c, v) (c).ch.red = (uint8_t)((v) & 0x1F);
|
# define LV_COLOR_SET_R16(c, v) (c).ch.red = (uint8_t)(((uint8_t)(v)) & 0x1F);
|
||||||
# define LV_COLOR_SET_G16(c, v) (c).ch.green = (uint8_t)((v) & 0x3F);
|
# define LV_COLOR_SET_G16(c, v) (c).ch.green = (uint8_t)((v) & 0x3F);
|
||||||
# define LV_COLOR_SET_G16_SWAP(c, v) {(c).ch.green_h = (uint8_t)(((v) >> 3) & 0x7); (c).ch.green_l = (uint8_t)((v) & 0x7);}
|
# define LV_COLOR_SET_G16_SWAP(c, v) {(c).ch.green_h = (uint8_t)(((v) >> 3) & 0x7); (c).ch.green_l = (uint8_t)((v) & 0x7);}
|
||||||
# define LV_COLOR_SET_B16(c, v) (c).ch.blue = (uint8_t)((v) & 0x1F);
|
# define LV_COLOR_SET_B16(c, v) (c).ch.blue = (uint8_t)((v) & 0x1F);
|
||||||
@@ -390,7 +390,7 @@ static inline uint32_t lv_color_to32(lv_color_t color)
|
|||||||
LV_COLOR_SET_R32(ret, LV_COLOR_GET_R(color) * 36); /*(2^8 - 1)/(2^3 - 1) = 255/7 = 36*/
|
LV_COLOR_SET_R32(ret, LV_COLOR_GET_R(color) * 36); /*(2^8 - 1)/(2^3 - 1) = 255/7 = 36*/
|
||||||
LV_COLOR_SET_G32(ret, LV_COLOR_GET_G(color) * 36); /*(2^8 - 1)/(2^3 - 1) = 255/7 = 36*/
|
LV_COLOR_SET_G32(ret, LV_COLOR_GET_G(color) * 36); /*(2^8 - 1)/(2^3 - 1) = 255/7 = 36*/
|
||||||
LV_COLOR_SET_B32(ret, LV_COLOR_GET_B(color) * 85); /*(2^8 - 1)/(2^2 - 1) = 255/3 = 85*/
|
LV_COLOR_SET_B32(ret, LV_COLOR_GET_B(color) * 85); /*(2^8 - 1)/(2^2 - 1) = 255/3 = 85*/
|
||||||
LV_COLOR_SET_A32(color, 0xFF);
|
LV_COLOR_SET_A32(ret, 0xFF);
|
||||||
return ret.full;
|
return ret.full;
|
||||||
#elif LV_COLOR_DEPTH == 16
|
#elif LV_COLOR_DEPTH == 16
|
||||||
/**
|
/**
|
||||||
@@ -533,51 +533,23 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
|
|||||||
/* The most simple macro to create a color from R,G and B values */
|
/* The most simple macro to create a color from R,G and B values */
|
||||||
#if LV_COLOR_DEPTH == 1
|
#if LV_COLOR_DEPTH == 1
|
||||||
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){.full = (b8 >> 7 | g8 >> 7 | r8 >> 7)})
|
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){.full = (b8 >> 7 | g8 >> 7 | r8 >> 7)})
|
||||||
static inline lv_color_t lv_color_make(int r8, int g8, int b8)
|
|
||||||
{
|
|
||||||
lv_color_t color = { 0 };
|
|
||||||
color.full = (b8 >> 7 | g8 >> 7 | r8 >> 7);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
#elif LV_COLOR_DEPTH == 8
|
#elif LV_COLOR_DEPTH == 8
|
||||||
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 6, g8 >> 5, r8 >> 5}})
|
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 6, g8 >> 5, r8 >> 5}})
|
||||||
static inline lv_color_t lv_color_make(uint8_t r8, int g8, int b8)
|
|
||||||
{
|
|
||||||
lv_color_t color;
|
|
||||||
LV_COLOR_SET_B(color, b8 >> 6);
|
|
||||||
LV_COLOR_SET_G(color, g8 >> 5);
|
|
||||||
LV_COLOR_SET_R(color, r8 >> 5);
|
|
||||||
LV_COLOR_SET_A(color, 0xFF);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
#elif LV_COLOR_DEPTH == 16
|
#elif LV_COLOR_DEPTH == 16
|
||||||
#if LV_COLOR_16_SWAP == 0
|
#if LV_COLOR_16_SWAP == 0
|
||||||
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 3, g8 >> 2, r8 >> 3}})
|
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 3, g8 >> 2, r8 >> 3}})
|
||||||
#else
|
#else
|
||||||
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{g8 >> 5, r8 >> 3, b8 >> 3, (g8 >> 2) & 0x7}})
|
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{g8 >> 5, r8 >> 3, b8 >> 3, (g8 >> 2) & 0x7}})
|
||||||
#endif
|
#endif
|
||||||
static inline lv_color_t lv_color_make(uint8_t r8, uint8_t g8, uint8_t b8)
|
|
||||||
{
|
|
||||||
lv_color_t color;
|
|
||||||
LV_COLOR_SET_B(color, b8 >> 3);
|
|
||||||
LV_COLOR_SET_G(color, g8 >> 2);
|
|
||||||
LV_COLOR_SET_R(color, r8 >> 3);
|
|
||||||
LV_COLOR_SET_A(color, 0xFF);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
#elif LV_COLOR_DEPTH == 32
|
#elif LV_COLOR_DEPTH == 32
|
||||||
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8, g8, r8, 0xff}}) /*Fix 0xff alpha*/
|
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8, g8, r8, 0xff}}) /*Fix 0xff alpha*/
|
||||||
static inline lv_color_t lv_color_make(uint8_t r8, uint8_t g8, uint8_t b8)
|
|
||||||
{
|
|
||||||
lv_color_t color;
|
|
||||||
LV_COLOR_SET_B(color, b8);
|
|
||||||
LV_COLOR_SET_G(color, g8);
|
|
||||||
LV_COLOR_SET_R(color, r8);
|
|
||||||
LV_COLOR_SET_A(color, 0xFF);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static inline lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b)
|
||||||
|
{
|
||||||
|
return LV_COLOR_MAKE(r, g, b);
|
||||||
|
}
|
||||||
|
|
||||||
static inline lv_color_t lv_color_hex(uint32_t c)
|
static inline lv_color_t lv_color_hex(uint32_t c)
|
||||||
{
|
{
|
||||||
return lv_color_make((uint8_t)((c >> 16) & 0xFF), (uint8_t)((c >> 8) & 0xFF), (uint8_t)(c & 0xFF));
|
return lv_color_make((uint8_t)((c >> 16) & 0xFF), (uint8_t)((c >> 8) & 0xFF), (uint8_t)(c & 0xFF));
|
||||||
|
|||||||
@@ -539,7 +539,7 @@ char * lv_fs_get_letters(char * buf)
|
|||||||
*/
|
*/
|
||||||
const char * lv_fs_get_ext(const char * fn)
|
const char * lv_fs_get_ext(const char * fn)
|
||||||
{
|
{
|
||||||
uint16_t i;
|
size_t i;
|
||||||
for(i = strlen(fn); i > 0; i--) {
|
for(i = strlen(fn); i > 0; i--) {
|
||||||
if(fn[i] == '.') {
|
if(fn[i] == '.') {
|
||||||
return &fn[i + 1];
|
return &fn[i + 1];
|
||||||
@@ -558,7 +558,7 @@ const char * lv_fs_get_ext(const char * fn)
|
|||||||
*/
|
*/
|
||||||
char * lv_fs_up(char * path)
|
char * lv_fs_up(char * path)
|
||||||
{
|
{
|
||||||
uint16_t len = strlen(path);
|
size_t len = strlen(path);
|
||||||
if(len == 0) return path;
|
if(len == 0) return path;
|
||||||
|
|
||||||
len--; /*Go before the trailing '\0'*/
|
len--; /*Go before the trailing '\0'*/
|
||||||
@@ -589,7 +589,7 @@ char * lv_fs_up(char * path)
|
|||||||
*/
|
*/
|
||||||
const char * lv_fs_get_last(const char * path)
|
const char * lv_fs_get_last(const char * path)
|
||||||
{
|
{
|
||||||
uint16_t len = strlen(path);
|
size_t len = strlen(path);
|
||||||
if(len == 0) return path;
|
if(len == 0) return path;
|
||||||
|
|
||||||
len--; /*Go before the trailing '\0'*/
|
len--; /*Go before the trailing '\0'*/
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ void lv_mem_init(void)
|
|||||||
* @param size size of the memory to allocate in bytes
|
* @param size size of the memory to allocate in bytes
|
||||||
* @return pointer to the allocated memory
|
* @return pointer to the allocated memory
|
||||||
*/
|
*/
|
||||||
void * lv_mem_alloc(uint32_t size)
|
void * lv_mem_alloc(size_t size)
|
||||||
{
|
{
|
||||||
if(size == 0) {
|
if(size == 0) {
|
||||||
return &zero_mem;
|
return &zero_mem;
|
||||||
@@ -223,7 +223,7 @@ void lv_mem_free(const void * data)
|
|||||||
|
|
||||||
#if LV_ENABLE_GC == 0
|
#if LV_ENABLE_GC == 0
|
||||||
|
|
||||||
void * lv_mem_realloc(void * data_p, uint32_t new_size)
|
void * lv_mem_realloc(void * data_p, size_t new_size)
|
||||||
{
|
{
|
||||||
/*data_p could be previously freed pointer (in this case it is invalid)*/
|
/*data_p could be previously freed pointer (in this case it is invalid)*/
|
||||||
if(data_p != NULL) {
|
if(data_p != NULL) {
|
||||||
|
|||||||
@@ -22,21 +22,11 @@ extern "C" {
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "lv_log.h"
|
#include "lv_log.h"
|
||||||
|
#include "lv_types.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
// Check windows
|
|
||||||
#ifdef __WIN64
|
|
||||||
#define LV_MEM_ENV64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Check GCC
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#if defined(__x86_64__) || defined(__ppc64__)
|
|
||||||
#define LV_MEM_ENV64
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef LV_MEM_BUF_MAX_NUM
|
#ifndef LV_MEM_BUF_MAX_NUM
|
||||||
#define LV_MEM_BUF_MAX_NUM 16
|
#define LV_MEM_BUF_MAX_NUM 16
|
||||||
@@ -80,7 +70,7 @@ void lv_mem_init(void);
|
|||||||
* @param size size of the memory to allocate in bytes
|
* @param size size of the memory to allocate in bytes
|
||||||
* @return pointer to the allocated memory
|
* @return pointer to the allocated memory
|
||||||
*/
|
*/
|
||||||
void * lv_mem_alloc(uint32_t size);
|
void * lv_mem_alloc(size_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free an allocated data
|
* Free an allocated data
|
||||||
@@ -95,7 +85,7 @@ void lv_mem_free(const void * data);
|
|||||||
* @param new_size the desired new size in byte
|
* @param new_size the desired new size in byte
|
||||||
* @return pointer to the new memory
|
* @return pointer to the new memory
|
||||||
*/
|
*/
|
||||||
void * lv_mem_realloc(void * data_p, uint32_t new_size);
|
void * lv_mem_realloc(void * data_p, size_t new_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join the adjacent free memory blocks
|
* Join the adjacent free memory blocks
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t *
|
|||||||
*/
|
*/
|
||||||
static uint16_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
|
static uint16_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
|
||||||
lv_coord_t letter_space, lv_coord_t max_width,
|
lv_coord_t letter_space, lv_coord_t max_width,
|
||||||
lv_txt_flag_t flag, uint32_t *word_w_ptr, bool force)
|
lv_txt_flag_t flag, uint32_t *word_w_ptr, lv_txt_cmd_state_t * cmd_state, bool force)
|
||||||
{
|
{
|
||||||
if(txt == NULL || txt[0] == '\0') return 0;
|
if(txt == NULL || txt[0] == '\0') return 0;
|
||||||
if(font == NULL) return 0;
|
if(font == NULL) return 0;
|
||||||
@@ -171,7 +171,6 @@ static uint16_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
|
|||||||
if(flag & LV_TXT_FLAG_EXPAND) max_width = LV_COORD_MAX;
|
if(flag & LV_TXT_FLAG_EXPAND) max_width = LV_COORD_MAX;
|
||||||
|
|
||||||
uint32_t i = 0, i_next = 0, i_next_next = 0; /* Iterating index into txt */
|
uint32_t i = 0, i_next = 0, i_next_next = 0; /* Iterating index into txt */
|
||||||
lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT;
|
|
||||||
uint32_t letter = 0; /* Letter at i */
|
uint32_t letter = 0; /* Letter at i */
|
||||||
uint32_t letter_next = 0; /* Letter at i_next */
|
uint32_t letter_next = 0; /* Letter at i_next */
|
||||||
lv_coord_t letter_w;
|
lv_coord_t letter_w;
|
||||||
@@ -190,7 +189,7 @@ static uint16_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
|
|||||||
|
|
||||||
/*Handle the recolor command*/
|
/*Handle the recolor command*/
|
||||||
if((flag & LV_TXT_FLAG_RECOLOR) != 0) {
|
if((flag & LV_TXT_FLAG_RECOLOR) != 0) {
|
||||||
if(lv_txt_is_cmd(&cmd_state, letter) != false) {
|
if(lv_txt_is_cmd(cmd_state, letter) != false) {
|
||||||
i = i_next;
|
i = i_next;
|
||||||
i_next = i_next_next;
|
i_next = i_next_next;
|
||||||
letter = letter_next;
|
letter = letter_next;
|
||||||
@@ -289,12 +288,12 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font,
|
|||||||
if(font == NULL) return 0;
|
if(font == NULL) return 0;
|
||||||
|
|
||||||
if(flag & LV_TXT_FLAG_EXPAND) max_width = LV_COORD_MAX;
|
if(flag & LV_TXT_FLAG_EXPAND) max_width = LV_COORD_MAX;
|
||||||
|
lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT;
|
||||||
uint32_t i = 0; /* Iterating index into txt */
|
uint32_t i = 0; /* Iterating index into txt */
|
||||||
|
|
||||||
while(txt[i] != '\0' && max_width > 0) {
|
while(txt[i] != '\0' && max_width > 0) {
|
||||||
uint32_t word_w = 0;
|
uint32_t word_w = 0;
|
||||||
uint32_t advance = lv_txt_get_next_word(&txt[i], font, letter_space, max_width, flag, &word_w, i==0);
|
uint32_t advance = lv_txt_get_next_word(&txt[i], font, letter_space, max_width, flag, &word_w, &cmd_state, i==0);
|
||||||
max_width -= word_w;
|
max_width -= word_w;
|
||||||
|
|
||||||
if( advance == 0 ){
|
if( advance == 0 ){
|
||||||
@@ -417,8 +416,8 @@ bool lv_txt_is_cmd(lv_txt_cmd_state_t * state, uint32_t c)
|
|||||||
*/
|
*/
|
||||||
void lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt)
|
void lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt)
|
||||||
{
|
{
|
||||||
uint32_t old_len = strlen(txt_buf);
|
size_t old_len = strlen(txt_buf);
|
||||||
uint32_t ins_len = strlen(ins_txt);
|
size_t ins_len = strlen(ins_txt);
|
||||||
uint32_t new_len = ins_len + old_len;
|
uint32_t new_len = ins_len + old_len;
|
||||||
pos = lv_txt_encoded_get_byte_id(txt_buf, pos); /*Convert to byte index instead of letter index*/
|
pos = lv_txt_encoded_get_byte_id(txt_buf, pos); /*Convert to byte index instead of letter index*/
|
||||||
|
|
||||||
@@ -442,7 +441,7 @@ void lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt)
|
|||||||
void lv_txt_cut(char * txt, uint32_t pos, uint32_t len)
|
void lv_txt_cut(char * txt, uint32_t pos, uint32_t len)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint32_t old_len = strlen(txt);
|
size_t old_len = strlen(txt);
|
||||||
|
|
||||||
pos = lv_txt_encoded_get_byte_id(txt, pos); /*Convert to byte index instead of letter index*/
|
pos = lv_txt_encoded_get_byte_id(txt, pos); /*Convert to byte index instead of letter index*/
|
||||||
len = lv_txt_encoded_get_byte_id(&txt[pos], len);
|
len = lv_txt_encoded_get_byte_id(&txt[pos], len);
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ extern "C" {
|
|||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
|
#ifndef LV_TXT_COLOR_CMD
|
||||||
#define LV_TXT_COLOR_CMD "#"
|
#define LV_TXT_COLOR_CMD "#"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LV_TXT_ENC_UTF8 1
|
#define LV_TXT_ENC_UTF8 1
|
||||||
#define LV_TXT_ENC_ASCII 2
|
#define LV_TXT_ENC_ASCII 2
|
||||||
|
|||||||
@@ -17,6 +17,17 @@ extern "C" {
|
|||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
|
// Check windows
|
||||||
|
#ifdef __WIN64
|
||||||
|
#define LV_ARCH_64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Check GCC
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#if defined(__x86_64__) || defined(__ppc64__)
|
||||||
|
#define LV_ARCH_64
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
@@ -32,7 +43,11 @@ enum {
|
|||||||
};
|
};
|
||||||
typedef uint8_t lv_res_t;
|
typedef uint8_t lv_res_t;
|
||||||
|
|
||||||
typedef unsigned long int lv_uintptr_t;
|
#ifdef LV_ARCH_64
|
||||||
|
typedef uint64_t lv_uintptr_t;
|
||||||
|
#else
|
||||||
|
typedef uint32_t lv_uintptr_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
ext->ink_wait_time = copy_ext->ink_wait_time;
|
ext->ink_wait_time = copy_ext->ink_wait_time;
|
||||||
ext->ink_out_time = copy_ext->ink_out_time;
|
ext->ink_out_time = copy_ext->ink_out_time;
|
||||||
#endif
|
#endif
|
||||||
memcpy(ext->styles, copy_ext->styles, sizeof(ext->styles));
|
memcpy((void*) ext->styles, copy_ext->styles, sizeof(ext->styles));
|
||||||
|
|
||||||
/*Refresh the style with new signal function*/
|
/*Refresh the style with new signal function*/
|
||||||
lv_obj_refresh_style(new_btn);
|
lv_obj_refresh_style(new_btn);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
/*Copy an existing object*/
|
/*Copy an existing object*/
|
||||||
else {
|
else {
|
||||||
lv_btnm_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
lv_btnm_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||||
memcpy(ext->styles_btn, copy_ext->styles_btn, sizeof(ext->styles_btn));
|
memcpy((void*)ext->styles_btn, copy_ext->styles_btn, sizeof(ext->styles_btn));
|
||||||
lv_btnm_set_map(new_btnm, lv_btnm_get_map_array(copy));
|
lv_btnm_set_map(new_btnm, lv_btnm_get_map_array(copy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ void lv_calendar_set_showed_date(lv_obj_t * calendar, lv_calendar_date_t * showe
|
|||||||
* WILL BE SAVED! CAN'T BE LOCAL ARRAY.
|
* WILL BE SAVED! CAN'T BE LOCAL ARRAY.
|
||||||
* @param date_num number of dates in the array
|
* @param date_num number of dates in the array
|
||||||
*/
|
*/
|
||||||
void lv_calendar_set_highlighted_dates(lv_obj_t * calendar, lv_calendar_date_t * highlighted, uint16_t date_num)
|
void lv_calendar_set_highlighted_dates(lv_obj_t * calendar, lv_calendar_date_t highlighted[], uint16_t date_num)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
|
||||||
LV_ASSERT_NULL(highlighted);
|
LV_ASSERT_NULL(highlighted);
|
||||||
@@ -700,7 +700,7 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask)
|
|||||||
/*Add the right arrow*/
|
/*Add the right arrow*/
|
||||||
arrow_style = ext->btn_pressing > 0 ? ext->style_header_pr : ext->style_header;
|
arrow_style = ext->btn_pressing > 0 ? ext->style_header_pr : ext->style_header;
|
||||||
header_area.x1 = header_area.x2 - ext->style_header->body.padding.right -
|
header_area.x1 = header_area.x2 - ext->style_header->body.padding.right -
|
||||||
lv_txt_get_width(LV_SYMBOL_RIGHT, strlen(LV_SYMBOL_RIGHT), arrow_style->text.font,
|
lv_txt_get_width(LV_SYMBOL_RIGHT, (uint16_t)strlen(LV_SYMBOL_RIGHT), arrow_style->text.font,
|
||||||
arrow_style->text.line_space, LV_TXT_FLAG_NONE);
|
arrow_style->text.line_space, LV_TXT_FLAG_NONE);
|
||||||
lv_draw_label(&header_area, mask, arrow_style, opa_scale, LV_SYMBOL_RIGHT, LV_TXT_FLAG_NONE, NULL, NULL, NULL, bidi_dir);
|
lv_draw_label(&header_area, mask, arrow_style, opa_scale, LV_SYMBOL_RIGHT, LV_TXT_FLAG_NONE, NULL, NULL, NULL, bidi_dir);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ typedef struct
|
|||||||
lv_calendar_date_t showed_date; /*Currently visible month (day is ignored)*/
|
lv_calendar_date_t showed_date; /*Currently visible month (day is ignored)*/
|
||||||
lv_calendar_date_t * highlighted_dates; /*Apply different style on these days (pointer to an
|
lv_calendar_date_t * highlighted_dates; /*Apply different style on these days (pointer to an
|
||||||
array defined by the user)*/
|
array defined by the user)*/
|
||||||
uint8_t highlighted_dates_num; /*Number of elements in `highlighted_days`*/
|
|
||||||
int8_t btn_pressing; /*-1: prev month pressing, +1 next month pressing on the header*/
|
int8_t btn_pressing; /*-1: prev month pressing, +1 next month pressing on the header*/
|
||||||
|
uint16_t highlighted_dates_num; /*Number of elements in `highlighted_days`*/
|
||||||
lv_calendar_date_t pressed_date;
|
lv_calendar_date_t pressed_date;
|
||||||
const char ** day_names; /*Pointer to an array with the name of the days (NULL: use default names)*/
|
const char ** day_names; /*Pointer to an array with the name of the days (NULL: use default names)*/
|
||||||
const char ** month_names; /*Pointer to an array with the name of the month (NULL. use default names)*/
|
const char ** month_names; /*Pointer to an array with the name of the month (NULL. use default names)*/
|
||||||
@@ -122,7 +122,7 @@ void lv_calendar_set_showed_date(lv_obj_t * calendar, lv_calendar_date_t * showe
|
|||||||
* WILL BE SAVED! CAN'T BE LOCAL ARRAY.
|
* WILL BE SAVED! CAN'T BE LOCAL ARRAY.
|
||||||
* @param date_num number of dates in the array
|
* @param date_num number of dates in the array
|
||||||
*/
|
*/
|
||||||
void lv_calendar_set_highlighted_dates(lv_obj_t * calendar, lv_calendar_date_t * highlighted, uint16_t date_num);
|
void lv_calendar_set_highlighted_dates(lv_obj_t * calendar, lv_calendar_date_t highlighted[], uint16_t date_num);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the days
|
* Set the name of the days
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t x, l
|
|||||||
LV_ASSERT_NULL(to_copy);
|
LV_ASSERT_NULL(to_copy);
|
||||||
|
|
||||||
lv_canvas_ext_t * ext = lv_obj_get_ext_attr(canvas);
|
lv_canvas_ext_t * ext = lv_obj_get_ext_attr(canvas);
|
||||||
if(x + w >= ext->dsc.header.w || y + h >= ext->dsc.header.h) {
|
if(x + w >= (lv_coord_t)ext->dsc.header.w || y + h >= (lv_coord_t)ext->dsc.header.h) {
|
||||||
LV_LOG_WARN("lv_canvas_copy_buf: x or y out of the canvas");
|
LV_LOG_WARN("lv_canvas_copy_buf: x or y out of the canvas");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,6 +207,7 @@ const lv_style_t * lv_cb_get_style(const lv_obj_t * cb, lv_cb_style_t type)
|
|||||||
lv_cb_ext_t * ext = lv_obj_get_ext_attr(cb);
|
lv_cb_ext_t * ext = lv_obj_get_ext_attr(cb);
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
|
case LV_CB_STYLE_BG: style = lv_btn_get_style(cb, LV_BTN_STYLE_REL); break;
|
||||||
case LV_CB_STYLE_BOX_REL: style = lv_btn_get_style(ext->bullet, LV_BTN_STYLE_REL); break;
|
case LV_CB_STYLE_BOX_REL: style = lv_btn_get_style(ext->bullet, LV_BTN_STYLE_REL); break;
|
||||||
case LV_CB_STYLE_BOX_PR: style = lv_btn_get_style(ext->bullet, LV_BTN_STYLE_PR); break;
|
case LV_CB_STYLE_BOX_PR: style = lv_btn_get_style(ext->bullet, LV_BTN_STYLE_PR); break;
|
||||||
case LV_CB_STYLE_BOX_TGL_REL: style = lv_btn_get_style(ext->bullet, LV_BTN_STYLE_TGL_REL); break;
|
case LV_CB_STYLE_BOX_TGL_REL: style = lv_btn_get_style(ext->bullet, LV_BTN_STYLE_TGL_REL); break;
|
||||||
|
|||||||
@@ -692,7 +692,7 @@ static lv_area_t get_indic_area(lv_obj_t * cpicker)
|
|||||||
const lv_style_t * style_main = lv_cpicker_get_style(cpicker, LV_CPICKER_STYLE_MAIN);
|
const lv_style_t * style_main = lv_cpicker_get_style(cpicker, LV_CPICKER_STYLE_MAIN);
|
||||||
const lv_style_t * style_indic = lv_cpicker_get_style(cpicker, LV_CPICKER_STYLE_INDICATOR);
|
const lv_style_t * style_indic = lv_cpicker_get_style(cpicker, LV_CPICKER_STYLE_INDICATOR);
|
||||||
|
|
||||||
uint16_t r;
|
uint16_t r = 0;
|
||||||
if(ext->type == LV_CPICKER_TYPE_DISC) r = style_main->line.width / 2;
|
if(ext->type == LV_CPICKER_TYPE_DISC) r = style_main->line.width / 2;
|
||||||
else if(ext->type == LV_CPICKER_TYPE_RECT) {
|
else if(ext->type == LV_CPICKER_TYPE_RECT) {
|
||||||
lv_coord_t h = lv_obj_get_height(cpicker);
|
lv_coord_t h = lv_obj_get_height(cpicker);
|
||||||
@@ -822,7 +822,7 @@ static lv_res_t lv_cpicker_signal(lv_obj_t * cpicker, lv_signal_t sign, void * p
|
|||||||
if(ext->type == LV_CPICKER_TYPE_RECT) {
|
if(ext->type == LV_CPICKER_TYPE_RECT) {
|
||||||
/*If pressed long enough without change go to next color mode*/
|
/*If pressed long enough without change go to next color mode*/
|
||||||
uint32_t diff = lv_tick_elaps(ext->last_change_time);
|
uint32_t diff = lv_tick_elaps(ext->last_change_time);
|
||||||
if(diff > indev->driver.long_press_time * 2 && !ext->color_mode_fixed) {
|
if(diff > (uint32_t)indev->driver.long_press_time * 2 && !ext->color_mode_fixed) {
|
||||||
next_color_mode(cpicker);
|
next_color_mode(cpicker);
|
||||||
lv_indev_wait_release(lv_indev_get_act());
|
lv_indev_wait_release(lv_indev_get_act());
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ void lv_ddlist_get_selected_str(const lv_obj_t * ddlist, char * buf, uint16_t bu
|
|||||||
uint16_t i;
|
uint16_t i;
|
||||||
uint16_t line = 0;
|
uint16_t line = 0;
|
||||||
const char * opt_txt = lv_label_get_text(ext->label);
|
const char * opt_txt = lv_label_get_text(ext->label);
|
||||||
uint16_t txt_len = strlen(opt_txt);
|
size_t txt_len = strlen(opt_txt);
|
||||||
|
|
||||||
for(i = 0; i < txt_len && line != ext->sel_opt_id; i++) {
|
for(i = 0; i < txt_len && line != ext->sel_opt_id; i++) {
|
||||||
if(opt_txt[i] == '\n') line++;
|
if(opt_txt[i] == '\n') line++;
|
||||||
@@ -626,7 +626,8 @@ static lv_design_res_t lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * cli
|
|||||||
new_style.text.color = sel_style->text.color;
|
new_style.text.color = sel_style->text.color;
|
||||||
new_style.text.opa = sel_style->text.opa;
|
new_style.text.opa = sel_style->text.opa;
|
||||||
lv_area_t area_icon;
|
lv_area_t area_icon;
|
||||||
lv_coord_t icon_width = lv_txt_get_width(ext->symbol, strlen(ext->symbol), sel_style->text.font, 0, 0);
|
lv_coord_t icon_width = lv_txt_get_width(ext->symbol, (uint16_t)strlen(ext->symbol), sel_style->text.font, 0, 0);
|
||||||
|
|
||||||
if(lv_label_get_align(ext->label) != LV_LABEL_ALIGN_RIGHT) {
|
if(lv_label_get_align(ext->label) != LV_LABEL_ALIGN_RIGHT) {
|
||||||
area_icon.x2 = ddlist->coords.x2 - style->body.padding.right;
|
area_icon.x2 = ddlist->coords.x2 - style->body.padding.right;
|
||||||
area_icon.x1 = area_icon.x2 - icon_width;
|
area_icon.x1 = area_icon.x2 - icon_width;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ lv_obj_t * lv_imgbtn_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
|
|
||||||
/*Initialize the allocated 'ext' */
|
/*Initialize the allocated 'ext' */
|
||||||
#if LV_IMGBTN_TILED == 0
|
#if LV_IMGBTN_TILED == 0
|
||||||
memset(ext->img_src, 0, sizeof(ext->img_src));
|
memset((void*)ext->img_src, 0, sizeof(ext->img_src));
|
||||||
#else
|
#else
|
||||||
memset(ext->img_src_left, 0, sizeof(ext->img_src_left));
|
memset(ext->img_src_left, 0, sizeof(ext->img_src_left));
|
||||||
memset(ext->img_src_mid, 0, sizeof(ext->img_src_mid));
|
memset(ext->img_src_mid, 0, sizeof(ext->img_src_mid));
|
||||||
@@ -89,11 +89,11 @@ lv_obj_t * lv_imgbtn_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
else {
|
else {
|
||||||
lv_imgbtn_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
lv_imgbtn_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||||
#if LV_IMGBTN_TILED == 0
|
#if LV_IMGBTN_TILED == 0
|
||||||
memcpy(ext->img_src, copy_ext->img_src, sizeof(ext->img_src));
|
memcpy(ext->img_src, (void*)copy_ext->img_src, sizeof(ext->img_src));
|
||||||
#else
|
#else
|
||||||
memcpy(ext->img_src_left, copy_ext->img_src_left, sizeof(ext->img_src_left));
|
memcpy(ext->img_src_left, (void*)copy_ext->img_src_left, sizeof(ext->img_src_left));
|
||||||
memcpy(ext->img_src_mid, copy_ext->img_src_mid, sizeof(ext->img_src_mid));
|
memcpy(ext->img_src_mid, (void*)copy_ext->img_src_mid, sizeof(ext->img_src_mid));
|
||||||
memcpy(ext->img_src_right, copy_ext->img_src_right, sizeof(ext->img_src_right));
|
memcpy(ext->img_src_right, (void*)copy_ext->img_src_right, sizeof(ext->img_src_right));
|
||||||
#endif
|
#endif
|
||||||
/*Refresh the style with new signal function*/
|
/*Refresh the style with new signal function*/
|
||||||
lv_obj_refresh_style(new_imgbtn);
|
lv_obj_refresh_style(new_imgbtn);
|
||||||
@@ -420,7 +420,7 @@ static void refr_img(lv_obj_t * imgbtn)
|
|||||||
if(lv_img_src_get_type(src) == LV_IMG_SRC_SYMBOL) {
|
if(lv_img_src_get_type(src) == LV_IMG_SRC_SYMBOL) {
|
||||||
const lv_style_t * style = ext->btn.styles[state];
|
const lv_style_t * style = ext->btn.styles[state];
|
||||||
header.h = lv_font_get_line_height(style->text.font);
|
header.h = lv_font_get_line_height(style->text.font);
|
||||||
header.w = lv_txt_get_width(src, strlen(src), style->text.font, style->text.letter_space, LV_TXT_FLAG_NONE);
|
header.w = lv_txt_get_width(src, (uint16_t)strlen(src), style->text.font, style->text.letter_space, LV_TXT_FLAG_NONE);
|
||||||
header.always_zero = 0;
|
header.always_zero = 0;
|
||||||
header.cf = LV_IMG_CF_ALPHA_1BIT;
|
header.cf = LV_IMG_CF_ALPHA_1BIT;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(copy_ext->dot_tmp_alloc && copy_ext->dot.tmp_ptr) {
|
if(copy_ext->dot_tmp_alloc && copy_ext->dot.tmp_ptr) {
|
||||||
int len = strlen(copy_ext->dot.tmp_ptr);
|
uint16_t len = (uint16_t )strlen(copy_ext->dot.tmp_ptr);
|
||||||
lv_label_set_dot_tmp(new_label, ext->dot.tmp_ptr, len);
|
lv_label_set_dot_tmp(new_label, ext->dot.tmp_ptr, len);
|
||||||
} else {
|
} else {
|
||||||
memcpy(ext->dot.tmp, copy_ext->dot.tmp, sizeof(ext->dot.tmp));
|
memcpy(ext->dot.tmp, copy_ext->dot.tmp, sizeof(ext->dot.tmp));
|
||||||
@@ -196,7 +196,7 @@ void lv_label_set_text(lv_obj_t * label, const char * text)
|
|||||||
if(ext->text == NULL) return;
|
if(ext->text == NULL) return;
|
||||||
} else {
|
} else {
|
||||||
/*Allocate space for the new text*/
|
/*Allocate space for the new text*/
|
||||||
uint32_t len = strlen(text) + 1;
|
size_t len = strlen(text) + 1;
|
||||||
if(ext->text != NULL && ext->static_txt == 0) {
|
if(ext->text != NULL && ext->static_txt == 0) {
|
||||||
lv_mem_free(ext->text);
|
lv_mem_free(ext->text);
|
||||||
ext->text = NULL;
|
ext->text = NULL;
|
||||||
@@ -953,9 +953,9 @@ void lv_label_ins_text(lv_obj_t * label, uint32_t pos, const char * txt)
|
|||||||
lv_obj_invalidate(label);
|
lv_obj_invalidate(label);
|
||||||
|
|
||||||
/*Allocate space for the new text*/
|
/*Allocate space for the new text*/
|
||||||
uint32_t old_len = strlen(ext->text);
|
size_t old_len = strlen(ext->text);
|
||||||
uint32_t ins_len = strlen(txt);
|
size_t ins_len = strlen(txt);
|
||||||
uint32_t new_len = ins_len + old_len;
|
size_t new_len = ins_len + old_len;
|
||||||
ext->text = lv_mem_realloc(ext->text, new_len + 1);
|
ext->text = lv_mem_realloc(ext->text, new_len + 1);
|
||||||
LV_ASSERT_MEM(ext->text);
|
LV_ASSERT_MEM(ext->text);
|
||||||
if(ext->text == NULL) return;
|
if(ext->text == NULL) return;
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ void lv_list_set_btn_selected(lv_obj_t * list, lv_obj_t * btn)
|
|||||||
else if(s == LV_BTN_STATE_TGL_REL)
|
else if(s == LV_BTN_STATE_TGL_REL)
|
||||||
lv_btn_set_state(ext->selected_btn, LV_BTN_STATE_TGL_PR);
|
lv_btn_set_state(ext->selected_btn, LV_BTN_STATE_TGL_PR);
|
||||||
|
|
||||||
lv_page_focus(list, ext->selected_btn, lv_list_get_anim_time(list));
|
lv_page_focus(list, ext->selected_btn, LV_ANIM_ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ void lv_lmeter_set_range(lv_obj_t * lmeter, int16_t min, int16_t max)
|
|||||||
* @param angle angle of the scale (0..360)
|
* @param angle angle of the scale (0..360)
|
||||||
* @param line_cnt number of lines
|
* @param line_cnt number of lines
|
||||||
*/
|
*/
|
||||||
void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt)
|
void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint16_t line_cnt)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ typedef struct
|
|||||||
/*New data for this type */
|
/*New data for this type */
|
||||||
uint16_t scale_angle; /*Angle of the scale in deg. (0..360)*/
|
uint16_t scale_angle; /*Angle of the scale in deg. (0..360)*/
|
||||||
uint16_t angle_ofs;
|
uint16_t angle_ofs;
|
||||||
uint8_t line_cnt; /*Count of lines */
|
uint16_t line_cnt; /*Count of lines */
|
||||||
int16_t cur_value;
|
int16_t cur_value;
|
||||||
int16_t min_value;
|
int16_t min_value;
|
||||||
int16_t max_value;
|
int16_t max_value;
|
||||||
@@ -87,7 +87,7 @@ void lv_lmeter_set_range(lv_obj_t * lmeter, int16_t min, int16_t max);
|
|||||||
* @param angle angle of the scale (0..360)
|
* @param angle angle of the scale (0..360)
|
||||||
* @param line_cnt number of lines
|
* @param line_cnt number of lines
|
||||||
*/
|
*/
|
||||||
void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt);
|
void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint16_t line_cnt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the set an offset for the line meter's angles to rotate it.
|
* Set the set an offset for the line meter's angles to rotate it.
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
* @param btn_map button descriptor (button matrix map).
|
* @param btn_map button descriptor (button matrix map).
|
||||||
* E.g. a const char *txt[] = {"ok", "close", ""} (Can not be local variable)
|
* E.g. a const char *txt[] = {"ok", "close", ""} (Can not be local variable)
|
||||||
*/
|
*/
|
||||||
void lv_mbox_add_btns(lv_obj_t * mbox, const char ** btn_map)
|
void lv_mbox_add_btns(lv_obj_t * mbox, const char * btn_map[])
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
|
||||||
LV_ASSERT_NULL(btn_map);
|
LV_ASSERT_NULL(btn_map);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, const lv_obj_t * copy);
|
|||||||
* @param btn_map button descriptor (button matrix map).
|
* @param btn_map button descriptor (button matrix map).
|
||||||
* E.g. a const char *txt[] = {"ok", "close", ""} (Can not be local variable)
|
* E.g. a const char *txt[] = {"ok", "close", ""} (Can not be local variable)
|
||||||
*/
|
*/
|
||||||
void lv_mbox_add_btns(lv_obj_t * mbox, const char ** btn_mapaction);
|
void lv_mbox_add_btns(lv_obj_t * mbox, const char * btn_mapaction[]);
|
||||||
|
|
||||||
/*=====================
|
/*=====================
|
||||||
* Setter functions
|
* Setter functions
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ void lv_roller_set_options(lv_obj_t * roller, const char * options, lv_roller_mo
|
|||||||
} else {
|
} else {
|
||||||
ext->mode = LV_ROLLER_MODE_INIFINITE;
|
ext->mode = LV_ROLLER_MODE_INIFINITE;
|
||||||
|
|
||||||
uint32_t opt_len = strlen(options) + 1; /*+1 to add '\n' after option lists*/
|
size_t opt_len = strlen(options) + 1; /*+1 to add '\n' after option lists*/
|
||||||
char * opt_extra = lv_mem_alloc(opt_len * LV_ROLLER_INF_PAGES);
|
char * opt_extra = lv_mem_alloc(opt_len * LV_ROLLER_INF_PAGES);
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
for(i = 0; i < LV_ROLLER_INF_PAGES; i++) {
|
for(i = 0; i < LV_ROLLER_INF_PAGES; i++) {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ static inline void lv_slider_set_value(lv_obj_t * slider, int16_t value, lv_anim
|
|||||||
* @param left_value new value
|
* @param left_value new value
|
||||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||||
*/
|
*/
|
||||||
static inline void lv_slider_set_left_value(const lv_obj_t * slider, int16_t left_value, lv_anim_enable_t anim)
|
static inline void lv_slider_set_left_value(lv_obj_t * slider, int16_t left_value, lv_anim_enable_t anim)
|
||||||
{
|
{
|
||||||
lv_bar_set_start_value(slider, left_value, anim);
|
lv_bar_set_start_value(slider, left_value, anim);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -330,8 +330,6 @@ void lv_spinbox_decrement(lv_obj_t * spinbox)
|
|||||||
static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * param)
|
static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * param)
|
||||||
{
|
{
|
||||||
|
|
||||||
lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox);
|
|
||||||
|
|
||||||
lv_res_t res = LV_RES_OK;
|
lv_res_t res = LV_RES_OK;
|
||||||
|
|
||||||
/* Include the ancient signal function */
|
/* Include the ancient signal function */
|
||||||
@@ -341,6 +339,8 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
|
|||||||
}
|
}
|
||||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
|
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
|
||||||
|
|
||||||
|
|
||||||
|
lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox);
|
||||||
if(sign == LV_SIGNAL_CLEANUP) {
|
if(sign == LV_SIGNAL_CLEANUP) {
|
||||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||||
@@ -412,7 +412,7 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox)
|
|||||||
buf_p++;
|
buf_p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
int32_t i;
|
||||||
/*padding left*/
|
/*padding left*/
|
||||||
for(i = 0; i < ext->digit_padding_left; i++) {
|
for(i = 0; i < ext->digit_padding_left; i++) {
|
||||||
(*buf_p) = ' ';
|
(*buf_p) = ' ';
|
||||||
@@ -426,7 +426,7 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox)
|
|||||||
/*Add leading zeros*/
|
/*Add leading zeros*/
|
||||||
int lz_cnt = ext->digit_count - (int)strlen(digits);
|
int lz_cnt = ext->digit_count - (int)strlen(digits);
|
||||||
if(lz_cnt > 0) {
|
if(lz_cnt > 0) {
|
||||||
for(i = strlen(digits); i >= 0; i--) {
|
for(i = (uint16_t)strlen(digits); i >= 0; i--) {
|
||||||
digits[i + lz_cnt] = digits[i];
|
digits[i + lz_cnt] = digits[i];
|
||||||
}
|
}
|
||||||
for(i = 0; i < lz_cnt; i++) {
|
for(i = 0; i < lz_cnt; i++) {
|
||||||
@@ -459,7 +459,7 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox)
|
|||||||
|
|
||||||
/*Set the cursor position*/
|
/*Set the cursor position*/
|
||||||
int32_t step = ext->step;
|
int32_t step = ext->step;
|
||||||
uint8_t cur_pos = ext->digit_count;
|
uint8_t cur_pos = (uint8_t)ext->digit_count;
|
||||||
while(step >= 10) {
|
while(step >= 10) {
|
||||||
step /= 10;
|
step /= 10;
|
||||||
cur_pos--;
|
cur_pos--;
|
||||||
|
|||||||
@@ -689,7 +689,7 @@ void lv_ta_set_pwd_mode(lv_obj_t * ta, bool en)
|
|||||||
/*Pwd mode is now enabled*/
|
/*Pwd mode is now enabled*/
|
||||||
if(ext->pwd_mode == 0 && en != false) {
|
if(ext->pwd_mode == 0 && en != false) {
|
||||||
char * txt = lv_label_get_text(ext->label);
|
char * txt = lv_label_get_text(ext->label);
|
||||||
uint16_t len = strlen(txt);
|
size_t len = strlen(txt);
|
||||||
ext->pwd_tmp = lv_mem_alloc(len + 1);
|
ext->pwd_tmp = lv_mem_alloc(len + 1);
|
||||||
LV_ASSERT_MEM(ext->pwd_tmp);
|
LV_ASSERT_MEM(ext->pwd_tmp);
|
||||||
if(ext->pwd_tmp == NULL) return;
|
if(ext->pwd_tmp == NULL) return;
|
||||||
@@ -1707,7 +1707,6 @@ static void get_cursor_style(lv_obj_t * ta, lv_style_t * style_res)
|
|||||||
style_res->body.padding.top = 0;
|
style_res->body.padding.top = 0;
|
||||||
style_res->body.padding.bottom = 0;
|
style_res->body.padding.bottom = 0;
|
||||||
style_res->line.width = 1;
|
style_res->line.width = 1;
|
||||||
style_res->body.opa = LV_OPA_COVER;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -235,6 +235,20 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
|
|||||||
|
|
||||||
ext->tab_cnt++;
|
ext->tab_cnt++;
|
||||||
|
|
||||||
|
switch(ext->btns_pos) {
|
||||||
|
case LV_TABVIEW_BTNS_POS_TOP:
|
||||||
|
case LV_TABVIEW_BTNS_POS_BOTTOM:
|
||||||
|
ext->tab_name_ptr = lv_mem_realloc((void*)ext->tab_name_ptr, sizeof(char *) * (ext->tab_cnt + 1));
|
||||||
|
break;
|
||||||
|
case LV_TABVIEW_BTNS_POS_LEFT:
|
||||||
|
case LV_TABVIEW_BTNS_POS_RIGHT:
|
||||||
|
ext->tab_name_ptr = lv_mem_realloc((void*)ext->tab_name_ptr, sizeof(char *) * (ext->tab_cnt * 2));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
LV_ASSERT_MEM(ext->tab_name_ptr);
|
||||||
|
if(ext->tab_name_ptr == NULL) return NULL;
|
||||||
|
|
||||||
/* FIXME: It is not possible yet to switch tab button position from/to top/bottom from/to left/right at runtime.
|
/* FIXME: It is not possible yet to switch tab button position from/to top/bottom from/to left/right at runtime.
|
||||||
* Method: clean extra \n when switch from LV_TABVIEW_BTNS_POS_LEFT or LV_TABVIEW_BTNS_POS_RIGHT
|
* Method: clean extra \n when switch from LV_TABVIEW_BTNS_POS_LEFT or LV_TABVIEW_BTNS_POS_RIGHT
|
||||||
* to LV_TABVIEW_BTNS_POS_TOP or LV_TABVIEW_BTNS_POS_BOTTOM.
|
* to LV_TABVIEW_BTNS_POS_TOP or LV_TABVIEW_BTNS_POS_BOTTOM.
|
||||||
|
|||||||
@@ -157,11 +157,11 @@ void lv_tileview_add_element(lv_obj_t * tileview, lv_obj_t * element)
|
|||||||
/**
|
/**
|
||||||
* Set the valid position's indices. The scrolling will be possible only to these positions.
|
* Set the valid position's indices. The scrolling will be possible only to these positions.
|
||||||
* @param tileview pointer to a Tileview object
|
* @param tileview pointer to a Tileview object
|
||||||
* @param valid_pos array width the indices. E.g. `lv_point_t p[] = {{0,0}, {1,0}, {1,1}`. Only the
|
* @param valid_pos array width the indices. E.g. `lv_point_t p[] = {{0,0}, {1,0}, {1,1}`.
|
||||||
* pointer is saved so can't be a local variable.
|
* Only the pointer is saved so can't be a local variable.
|
||||||
* @param valid_pos_cnt numner of elements in `valid_pos` array
|
* @param valid_pos_cnt numner of elements in `valid_pos` array
|
||||||
*/
|
*/
|
||||||
void lv_tileview_set_valid_positions(lv_obj_t * tileview, const lv_point_t * valid_pos, uint16_t valid_pos_cnt)
|
void lv_tileview_set_valid_positions(lv_obj_t * tileview, const lv_point_t valid_pos[], uint16_t valid_pos_cnt)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(tileview, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(tileview, LV_OBJX_NAME);
|
||||||
LV_ASSERT_NULL(valid_pos);
|
LV_ASSERT_NULL(valid_pos);
|
||||||
@@ -175,7 +175,7 @@ void lv_tileview_set_valid_positions(lv_obj_t * tileview, const lv_point_t * val
|
|||||||
/*If valid pos. is selected do nothing*/
|
/*If valid pos. is selected do nothing*/
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
for(i = 0; i < valid_pos_cnt; i++) {
|
for(i = 0; i < valid_pos_cnt; i++) {
|
||||||
if(valid_pos->x == ext->act_id.x && valid_pos->y == ext->act_id.y) {
|
if(valid_pos[i].x == ext->act_id.x && valid_pos[i].y == ext->act_id.y) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,11 +84,11 @@ void lv_tileview_add_element(lv_obj_t * tileview, lv_obj_t * element);
|
|||||||
/**
|
/**
|
||||||
* Set the valid position's indices. The scrolling will be possible only to these positions.
|
* Set the valid position's indices. The scrolling will be possible only to these positions.
|
||||||
* @param tileview pointer to a Tileview object
|
* @param tileview pointer to a Tileview object
|
||||||
* @param valid_pos array width the indices. E.g. `lv_point_t p[] = {{0,0}, {1,0}, {1,1}`. Only the
|
* @param valid_pos array width the indices. E.g. `lv_point_t p[] = {{0,0}, {1,0}, {1,1}`.
|
||||||
* pointer is saved so can't be a local variable.
|
* Only the pointer is saved so can't be a local variable.
|
||||||
* @param valid_pos_cnt numner of elements in `valid_pos` array
|
* @param valid_pos_cnt numner of elements in `valid_pos` array
|
||||||
*/
|
*/
|
||||||
void lv_tileview_set_valid_positions(lv_obj_t * tileview, const lv_point_t * valid_pos, uint16_t valid_pos_cnt);
|
void lv_tileview_set_valid_positions(lv_obj_t * tileview, const lv_point_t valid_pos[], uint16_t valid_pos_cnt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the tile to be shown
|
* Set the tile to be shown
|
||||||
|
|||||||
@@ -619,7 +619,6 @@ static void list_init(void)
|
|||||||
list_rel.text.font = _font;
|
list_rel.text.font = _font;
|
||||||
|
|
||||||
lv_style_copy(&list_pr, &list_rel);
|
lv_style_copy(&list_pr, &list_rel);
|
||||||
list_pr.body.opa = LV_OPA_TRANSP;
|
|
||||||
list_pr.body.opa = LV_OPA_COVER;
|
list_pr.body.opa = LV_OPA_COVER;
|
||||||
list_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 34, 41);
|
list_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 34, 41);
|
||||||
list_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 34, 41);
|
list_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 34, 41);
|
||||||
|
|||||||
Reference in New Issue
Block a user