renames and fixes

This commit is contained in:
Gabor Kiss-Vamosi
2020-02-15 00:33:26 +01:00
parent 8a1a5e524f
commit b8676b26b2
40 changed files with 384 additions and 238 deletions

View File

@@ -288,18 +288,6 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
#endif /*LV_USE_DEBUG*/ #endif /*LV_USE_DEBUG*/
/*================
* THEME USAGE
*================*/
#define LV_USE_THEME_TEMPL 0 /*Just for test*/
#define LV_USE_THEME_DEFAULT 0 /*Built mainly from the built-in styles. Consumes very few RAM*/
#define LV_USE_THEME_ALIEN 0 /*Dark futuristic theme*/
#define LV_USE_THEME_NIGHT 0 /*Dark elegant theme*/
#define LV_USE_THEME_MONO 0 /*Mono color theme for monochrome displays*/
#define LV_USE_THEME_MATERIAL 0 /*Flat theme with bold colors and light shadows*/
#define LV_USE_THEME_ZEN 0 /*Peaceful, mainly light theme */
#define LV_USE_THEME_NEMO 0 /*Water-like theme based on the movie "Finding Nemo"*/
/*================== /*==================
* FONT USAGE * FONT USAGE
*===================*/ *===================*/
@@ -333,9 +321,6 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
*/ */
#define LV_FONT_CUSTOM_DECLARE #define LV_FONT_CUSTOM_DECLARE
/*Always set a default font from the built-in fonts*/
#define LV_FONT_DEFAULT &lv_font_roboto_16
/* Enable it if you have fonts with a lot of characters. /* Enable it if you have fonts with a lot of characters.
* The limit depends on the font size, font face and bpp * The limit depends on the font size, font face and bpp
* 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.*/
@@ -350,6 +335,23 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
/*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;
/*================
* THEME USAGE
*================*/
/*Always enable at least on theme*/
#define LV_USE_THEME_MATERIAL 1 /*A fast and impressive theme*/
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
#define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED
#define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE
#define LV_THEME_DEFAULT_FLAGS LV_THEME_MATERIAL_FLAG_NONE
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_roboto_12
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_roboto_16
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_roboto_22
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_roboto_28
/*================= /*=================
* Text settings * Text settings
*=================*/ *=================*/
@@ -564,14 +566,14 @@ typedef void * lv_obj_user_data_t;
#endif #endif
/*Table (dependencies: lv_label)*/ /*Table (dependencies: lv_label)*/
#define LV_USE_TEXTAREABLE 1 #define LV_USE_TABLE 1
#if LV_USE_TEXTAREABLE #if LV_USE_TABLE
# define LV_TABLE_COL_MAX 12 # define LV_TABLE_COL_MAX 12
#endif #endif
/*Tab (dependencies: lv_page, lv_btnm)*/ /*Tab (dependencies: lv_page, lv_btnm)*/
#define LV_USE_TEXTAREABVIEW 1 #define LV_USE_TABVIEW 1
# if LV_USE_TEXTAREABVIEW != 0 # if LV_USE_TABVIEW != 0
/*Time of slide animation [ms] (0: no animation)*/ /*Time of slide animation [ms] (0: no animation)*/
# define LV_TABVIEW_DEF_ANIM_TIME 300 # define LV_TABVIEW_DEF_ANIM_TIME 300
#endif #endif

View File

@@ -824,20 +824,20 @@
#endif #endif
/*Table (dependencies: lv_label)*/ /*Table (dependencies: lv_label)*/
#ifndef LV_USE_TEXTAREABLE #ifndef LV_USE_TABLE
#define LV_USE_TEXTAREABLE 1 #define LV_USE_TABLE 1
#endif #endif
#if LV_USE_TEXTAREABLE #if LV_USE_TABLE
#ifndef LV_TABLE_COL_MAX #ifndef LV_TABLE_COL_MAX
# define LV_TABLE_COL_MAX 12 # define LV_TABLE_COL_MAX 12
#endif #endif
#endif #endif
/*Tab (dependencies: lv_page, lv_btnm)*/ /*Tab (dependencies: lv_page, lv_btnm)*/
#ifndef LV_USE_TEXTAREABVIEW #ifndef LV_USE_TABVIEW
#define LV_USE_TEXTAREABVIEW 1 #define LV_USE_TABVIEW 1
#endif #endif
# if LV_USE_TEXTAREABVIEW != 0 # if LV_USE_TABVIEW != 0
/*Time of slide animation [ms] (0: no animation)*/ /*Time of slide animation [ms] (0: no animation)*/
#ifndef LV_TABVIEW_DEF_ANIM_TIME #ifndef LV_TABVIEW_DEF_ANIM_TIME
# define LV_TABVIEW_DEF_ANIM_TIME 300 # define LV_TABVIEW_DEF_ANIM_TIME 300

View File

@@ -92,10 +92,24 @@ bool lv_debug_check_style(const lv_style_t * style)
if(style == NULL) return true; /*NULL style is still valid*/ if(style == NULL) return true; /*NULL style is still valid*/
#if LV_USE_ASSERT_STYLE #if LV_USE_ASSERT_STYLE
// if(style->debug_sentinel != LV_STYLE_DEGUG_SENTINEL_VALUE) { if(style->sentinel != LV_DEBUG_STYLE_SENTINEL_VALUE) {
// LV_LOG_WARN("Invalid style (local variable or not initialized?)"); LV_LOG_WARN("Invalid style (local variable or not initialized?)");
// return false; return false;
// } }
#endif
return true;
}
bool lv_debug_check_style_list(const lv_style_list_t * list)
{
if(list == NULL) return true; /*NULL list is still valid*/
#if LV_USE_ASSERT_STYLE
if(list->sentinel != LV_DEBUG_STYLE_LIST_SENTINEL_VALUE) {
LV_LOG_WARN("Invalid style (local variable or not initialized?)");
return false;
}
#endif #endif
return true; return true;

View File

@@ -38,6 +38,8 @@ bool lv_debug_check_obj_valid(const lv_obj_t * obj);
bool lv_debug_check_style(const lv_style_t * style); bool lv_debug_check_style(const lv_style_t * style);
bool lv_debug_check_style_list(const lv_style_list_t * list);
bool lv_debug_check_str(const void * str); bool lv_debug_check_str(const void * str);
void lv_debug_log_error(const char * msg, uint64_t value); void lv_debug_log_error(const char * msg, uint64_t value);
@@ -85,6 +87,10 @@ do { \
#define LV_DEBUG_IS_STYLE(style_p) (lv_debug_check_style(style_p)) #define LV_DEBUG_IS_STYLE(style_p) (lv_debug_check_style(style_p))
#endif #endif
#ifndef LV_DEBUG_IS_STYLE_LIST
#define LV_DEBUG_IS_STYLE_LIST(list_p) (lv_debug_check_style_list(list_p))
#endif
/*----------------- /*-----------------
* ASSERTS * ASSERTS
*-----------------*/ *-----------------*/
@@ -144,8 +150,12 @@ do { \
# ifndef LV_ASSERT_STYLE # ifndef LV_ASSERT_STYLE
# define LV_ASSERT_STYLE(style_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE(style_p), "Invalid style", style_p); # define LV_ASSERT_STYLE(style_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE(style_p), "Invalid style", style_p);
# endif # endif
# ifndef LV_ASSERT_STYLE_LIST
# define LV_ASSERT_STYLE_LIST(list_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE_LIST(list_p), "Invalid style list", list_p);
# endif
#else #else
# define LV_ASSERT_STYLE(style) true # define LV_ASSERT_STYLE(style_p) true
# define LV_ASSERT_STYLE_LIST(list_p) true
#endif #endif
#else /* LV_USE_DEBUG == 0 */ #else /* LV_USE_DEBUG == 0 */

View File

@@ -108,7 +108,10 @@ void lv_init(void)
#endif #endif
lv_theme_t * th = lv_theme_default_init(0, NULL);
lv_theme_t * th = LV_THEME_DEFAULT_INIT(LV_THEME_DEFAULT_COLOR_PRIMARY, LV_THEME_DEFAULT_COLOR_SECONDARY,
LV_THEME_DEFAULT_FLAGS,
LV_THEME_DEFAULT_FONT_SMALL, LV_THEME_DEFAULT_FONT_NORMAL, LV_THEME_DEFAULT_FONT_SUBTITLE, LV_THEME_DEFAULT_FONT_TITLE);
lv_theme_set_act(th); lv_theme_set_act(th);
/*Initialize the screen refresh system*/ /*Initialize the screen refresh system*/
@@ -2852,7 +2855,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
draw_dsc->pattern_repeat = lv_obj_get_style_pattern_repeat(obj, part); draw_dsc->pattern_repeat = lv_obj_get_style_pattern_repeat(obj, part);
if(lv_img_src_get_type(draw_dsc->pattern_image) == LV_IMG_SRC_SYMBOL) { if(lv_img_src_get_type(draw_dsc->pattern_image) == LV_IMG_SRC_SYMBOL) {
draw_dsc->pattern_recolor = lv_obj_get_style_pattern_recolor(obj, part); draw_dsc->pattern_recolor = lv_obj_get_style_pattern_recolor(obj, part);
draw_dsc->pattern_font = lv_obj_get_style_font(obj, part); draw_dsc->pattern_font = lv_obj_get_style_text_font(obj, part);
} else if(draw_dsc->pattern_recolor_opa > LV_OPA_MIN ) { } else if(draw_dsc->pattern_recolor_opa > LV_OPA_MIN ) {
draw_dsc->pattern_recolor = lv_obj_get_style_pattern_recolor(obj, part); draw_dsc->pattern_recolor = lv_obj_get_style_pattern_recolor(obj, part);
} }
@@ -2914,8 +2917,11 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint8_t part, lv_draw_label_dsc_
draw_dsc->color = lv_obj_get_style_text_color(obj, part); draw_dsc->color = lv_obj_get_style_text_color(obj, part);
draw_dsc->letter_space = lv_obj_get_style_text_letter_space(obj, part); draw_dsc->letter_space = lv_obj_get_style_text_letter_space(obj, part);
draw_dsc->line_space = lv_obj_get_style_text_line_space(obj, part); draw_dsc->line_space = lv_obj_get_style_text_line_space(obj, part);
draw_dsc->blend_mode = lv_obj_get_style_text_blend_mode(obj, part);
draw_dsc->underline = lv_obj_get_style_text_underline(obj, part);
draw_dsc->strikethrough = lv_obj_get_style_text_strikethrough(obj, part);
draw_dsc->font = lv_obj_get_style_font(obj, part); draw_dsc->font = lv_obj_get_style_text_font(obj, part);
if(draw_dsc->sel_start != LV_DRAW_LABEL_NO_TXT_SEL && draw_dsc->sel_end != LV_DRAW_LABEL_NO_TXT_SEL) { if(draw_dsc->sel_start != LV_DRAW_LABEL_NO_TXT_SEL && draw_dsc->sel_end != LV_DRAW_LABEL_NO_TXT_SEL) {
draw_dsc->color = lv_obj_get_style_text_sel_color(obj, part); draw_dsc->color = lv_obj_get_style_text_sel_color(obj, part);

View File

@@ -26,6 +26,9 @@ extern "C" {
#include "../lv_misc/lv_bidi.h" #include "../lv_misc/lv_bidi.h"
#include "../lv_hal/lv_hal.h" #include "../lv_hal/lv_hal.h"
#include "../lv_draw/lv_draw_rect.h" #include "../lv_draw/lv_draw_rect.h"
#include "../lv_draw/lv_draw_label.h"
#include "../lv_draw/lv_draw_line.h"
#include "../lv_draw/lv_draw_img.h"
/********************* /*********************
* DEFINES * DEFINES
@@ -1099,11 +1102,13 @@ _LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_FONT, value_font, const lv_font_t * , _ptr);
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_STR, value_str, const char * , _ptr); _LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_STR, value_str, const char * , _ptr);
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LETTER_SPACE, text_letter_space, lv_style_int_t, _int); _LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LETTER_SPACE, text_letter_space, lv_style_int_t, _int);
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LINE_SPACE, text_line_space, lv_style_int_t, _int); _LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LINE_SPACE, text_line_space, lv_style_int_t, _int);
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_UNDERLINE, text_underline, bool, _int);
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_STRIKETHROUGH, text_strikethrough, bool, _int);
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_BLEND_MODE, text_blend_mode, lv_blend_mode_t, _int); _LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_BLEND_MODE, text_blend_mode, lv_blend_mode_t, _int);
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_COLOR, text_color, lv_color_t, _color); _LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_COLOR, text_color, lv_color_t, _color);
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_SEL_COLOR, text_sel_color, lv_color_t, _color); _LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_SEL_COLOR, text_sel_color, lv_color_t, _color);
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_OPA, text_opa, lv_opa_t, _opa); _LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_OPA, text_opa, lv_opa_t, _opa);
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_FONT, font, const lv_font_t * , _ptr); _LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_FONT, text_font, const lv_font_t * , _ptr);
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_WIDTH, line_width, lv_style_int_t, _int); _LV_OBJ_STYLE_SET_GET_DECLARE(LINE_WIDTH, line_width, lv_style_int_t, _int);
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_BLEND_MODE, line_blend_mode, lv_blend_mode_t, _int); _LV_OBJ_STYLE_SET_GET_DECLARE(LINE_BLEND_MODE, line_blend_mode, lv_blend_mode_t, _int);
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_WIDTH, line_dash_width, lv_style_int_t, _int); _LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_WIDTH, line_dash_width, lv_style_int_t, _int);

View File

@@ -41,7 +41,6 @@ static lv_style_t * get_local_style(lv_style_list_t * list);
/********************** /**********************
* GLOABAL VARIABLES * GLOABAL VARIABLES
**********************/ **********************/
//lv_style_t lv_style_transp_tight;
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -62,6 +61,9 @@ static lv_style_t * get_local_style(lv_style_list_t * list);
void lv_style_init(lv_style_t * style) void lv_style_init(lv_style_t * style)
{ {
style->map = NULL; style->map = NULL;
#if LV_USE_ASSERT_STYLE
style->sentinel = LV_DEBUG_STYLE_SENTINEL_VALUE;
#endif
} }
/** /**
@@ -71,6 +73,9 @@ void lv_style_init(lv_style_t * style)
*/ */
void lv_style_copy(lv_style_t * style_dest, const lv_style_t * style_src) void lv_style_copy(lv_style_t * style_dest, const lv_style_t * style_src)
{ {
LV_ASSERT_STYLE(style_dest);
LV_ASSERT_STYLE(style_src);
if(style_src == NULL) return; if(style_src == NULL) return;
if(style_src->map == NULL) return; if(style_src->map == NULL) return;
@@ -89,6 +94,9 @@ void lv_style_list_init(lv_style_list_t * list)
list->style_list = NULL; list->style_list = NULL;
list->style_cnt = 0; list->style_cnt = 0;
list->has_local = 0; list->has_local = 0;
#if LV_USE_ASSERT_STYLE
list->sentinel = LV_DEBUG_STYLE_LIST_SENTINEL_VALUE;
#endif
} }
/** /**
@@ -98,6 +106,9 @@ void lv_style_list_init(lv_style_list_t * list)
*/ */
void lv_style_list_copy(lv_style_list_t * list_dest, const lv_style_list_t * list_src) void lv_style_list_copy(lv_style_list_t * list_dest, const lv_style_list_t * list_src)
{ {
LV_ASSERT_STYLE_LIST(list_dest);
LV_ASSERT_STYLE_LIST(list_src);
lv_style_list_reset(list_dest); lv_style_list_reset(list_dest);
if(list_src->style_list == NULL) return; if(list_src->style_list == NULL) return;
@@ -126,6 +137,9 @@ void lv_style_list_copy(lv_style_list_t * list_dest, const lv_style_list_t * lis
*/ */
void lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style) void lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style)
{ {
LV_ASSERT_STYLE_LIST(list);
LV_ASSERT_STYLE(style);
if(list == NULL) return; if(list == NULL) return;
/*Remove the style first if already exists*/ /*Remove the style first if already exists*/
@@ -159,6 +173,9 @@ void lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style)
*/ */
void lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style) void lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style)
{ {
LV_ASSERT_STYLE_LIST(list);
LV_ASSERT_STYLE(style);
if(list->style_cnt == 0) return; if(list->style_cnt == 0) return;
/*Check if the style really exists here*/ /*Check if the style really exists here*/
@@ -204,7 +221,10 @@ void lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style)
*/ */
void lv_style_list_reset(lv_style_list_t * list) void lv_style_list_reset(lv_style_list_t * list)
{ {
LV_ASSERT_STYLE_LIST(list);
if(list == NULL) return; if(list == NULL) return;
if(list->has_local) { if(list->has_local) {
lv_style_t * local = lv_style_list_get_style(list, 0); lv_style_t * local = lv_style_list_get_style(list, 0);
lv_style_reset(local); lv_style_reset(local);
@@ -222,6 +242,8 @@ void lv_style_list_reset(lv_style_list_t * list)
*/ */
void lv_style_reset(lv_style_t * style) void lv_style_reset(lv_style_t * style)
{ {
LV_ASSERT_STYLE(style);
lv_mem_free(style->map); lv_mem_free(style->map);
style->map = NULL; style->map = NULL;
} }
@@ -233,6 +255,8 @@ void lv_style_reset(lv_style_t * style)
*/ */
uint16_t lv_style_get_mem_size(const lv_style_t * style) uint16_t lv_style_get_mem_size(const lv_style_t * style)
{ {
LV_ASSERT_STYLE(style);
if(style->map == NULL) return 0; if(style->map == NULL) return 0;
size_t i = 0; size_t i = 0;
@@ -261,6 +285,8 @@ uint16_t lv_style_get_mem_size(const lv_style_t * style)
*/ */
void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_int_t value) void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_int_t value)
{ {
LV_ASSERT_STYLE(style);
int32_t id = get_property_index(style, prop); int32_t id = get_property_index(style, prop);
/*The property already exists but not sure it's state is the same*/ /*The property already exists but not sure it's state is the same*/
if(id >= 0) { if(id >= 0) {
@@ -305,6 +331,8 @@ void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_in
*/ */
void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_t color) void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_t color)
{ {
LV_ASSERT_STYLE(style);
int32_t id = get_property_index(style, prop); int32_t id = get_property_index(style, prop);
/*The property already exists but not sure it's state is the same*/ /*The property already exists but not sure it's state is the same*/
if(id >= 0) { if(id >= 0) {
@@ -350,6 +378,8 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
*/ */
void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa) void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa)
{ {
LV_ASSERT_STYLE(style);
int32_t id = get_property_index(style, prop); int32_t id = get_property_index(style, prop);
/*The property already exists but not sure it's state is the same*/ /*The property already exists but not sure it's state is the same*/
if(id >= 0) { if(id >= 0) {
@@ -395,6 +425,8 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
*/ */
void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void * p) void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void * p)
{ {
LV_ASSERT_STYLE(style);
int32_t id = get_property_index(style, prop); int32_t id = get_property_index(style, prop);
/*The property already exists but not sure it's state is the same*/ /*The property already exists but not sure it's state is the same*/
if(id >= 0) { if(id >= 0) {
@@ -441,6 +473,8 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
*/ */
int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv_style_int_t * res) int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv_style_int_t * res)
{ {
LV_ASSERT_STYLE(style);
if(style == NULL) return -1; if(style == NULL) return -1;
if(style->map == NULL) return -1; if(style->map == NULL) return -1;
int32_t id = get_property_index(style, prop); int32_t id = get_property_index(style, prop);
@@ -473,6 +507,8 @@ int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv
*/ */
int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv_opa_t * res) int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv_opa_t * res)
{ {
LV_ASSERT_STYLE(style);
if(style == NULL) return -1; if(style == NULL) return -1;
if(style->map == NULL) return -1; if(style->map == NULL) return -1;
int32_t id = get_property_index(style, prop); int32_t id = get_property_index(style, prop);
@@ -565,6 +601,8 @@ int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, vo
*/ */
void lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t value) void lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t value)
{ {
LV_ASSERT_STYLE_LIST(list);
lv_style_t * local = get_local_style(list); lv_style_t * local = get_local_style(list);
_lv_style_set_int(local, prop, value); _lv_style_set_int(local, prop, value);
} }
@@ -579,6 +617,8 @@ void lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t pro
*/ */
void lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t value) void lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t value)
{ {
LV_ASSERT_STYLE_LIST(list);
lv_style_t * local = get_local_style(list); lv_style_t * local = get_local_style(list);
_lv_style_set_opa(local, prop, value); _lv_style_set_opa(local, prop, value);
} }
@@ -593,6 +633,8 @@ void lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t pro
*/ */
void lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t value) void lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t value)
{ {
LV_ASSERT_STYLE_LIST(list);
lv_style_t * local = get_local_style(list); lv_style_t * local = get_local_style(list);
_lv_style_set_color(local, prop, value); _lv_style_set_color(local, prop, value);
} }
@@ -607,6 +649,8 @@ void lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t p
*/ */
void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, const void * value) void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, const void * value)
{ {
LV_ASSERT_STYLE_LIST(list);
lv_style_t * local = get_local_style(list); lv_style_t * local = get_local_style(list);
_lv_style_set_ptr(local, prop, value); _lv_style_set_ptr(local, prop, value);
} }
@@ -624,6 +668,8 @@ void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t pro
*/ */
lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t * res) lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t * res)
{ {
LV_ASSERT_STYLE_LIST(list);
if(list == NULL) return LV_RES_INV; if(list == NULL) return LV_RES_INV;
if(list->style_list == NULL) return LV_RES_INV; if(list->style_list == NULL) return LV_RES_INV;
@@ -670,6 +716,8 @@ lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop,
*/ */
lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t * res) lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t * res)
{ {
LV_ASSERT_STYLE_LIST(list);
if(list == NULL) return LV_RES_INV; if(list == NULL) return LV_RES_INV;
if(list->style_list == NULL) return LV_RES_INV; if(list->style_list == NULL) return LV_RES_INV;
@@ -715,6 +763,8 @@ lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t pro
*/ */
lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t * res) lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t * res)
{ {
LV_ASSERT_STYLE_LIST(list);
if(list == NULL) return LV_RES_INV; if(list == NULL) return LV_RES_INV;
if(list->style_list == NULL) return LV_RES_INV; if(list->style_list == NULL) return LV_RES_INV;
@@ -760,6 +810,8 @@ lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop,
*/ */
lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, void ** res) lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, void ** res)
{ {
LV_ASSERT_STYLE_LIST(list);
if(list == NULL) return LV_RES_INV; if(list == NULL) return LV_RES_INV;
if(list->style_list == NULL) return LV_RES_INV; if(list->style_list == NULL) return LV_RES_INV;
@@ -806,6 +858,9 @@ lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop,
*/ */
static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop) static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop)
{ {
LV_ASSERT_STYLE(style);
if(style->map == NULL) return -1; if(style->map == NULL) return -1;
uint8_t id_to_find = prop & 0xFF; uint8_t id_to_find = prop & 0xFF;
@@ -856,6 +911,8 @@ static inline int32_t get_property_index(const lv_style_t * style, lv_style_prop
*/ */
static lv_style_t * get_local_style(lv_style_list_t * list) static lv_style_t * get_local_style(lv_style_list_t * list)
{ {
LV_ASSERT_STYLE_LIST(list);
if(list->has_local) return lv_style_list_get_style(list, 0); if(list->has_local) return lv_style_list_get_style(list, 0);
lv_style_t * local_style = lv_mem_alloc(sizeof(lv_style_t)); lv_style_t * local_style = lv_mem_alloc(sizeof(lv_style_t));

View File

@@ -25,9 +25,11 @@ extern "C" {
* DEFINES * DEFINES
*********************/ *********************/
#define LV_RADIUS_CIRCLE (LV_COORD_MAX) /**< A very big radius to always draw as circle*/ #define LV_RADIUS_CIRCLE (LV_COORD_MAX) /**< A very big radius to always draw as circle*/
LV_EXPORT_CONST_INT(LV_RADIUS_CIRCLE); LV_EXPORT_CONST_INT(LV_RADIUS_CIRCLE);
#define LV_DEBUG_STYLE_SENTINEL_VALUE 0x2288AAEE
#define LV_DEBUG_STYLE_LIST_SENTINEL_VALUE 0x9977CCBB
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
@@ -135,9 +137,11 @@ enum {
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_FONT, 0x7, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE), LV_STYLE_PROP_INIT(LV_STYLE_VALUE_FONT, 0x7, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_STR, 0x7, LV_STYLE_ID_PTR + 1, LV_STYLE_ATTR_NONE), LV_STYLE_PROP_INIT(LV_STYLE_VALUE_STR, 0x7, LV_STYLE_ID_PTR + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LETTER_SPACE, 0x8, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_INHERIT), LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LETTER_SPACE, 0x8, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LINE_SPACE, 0x8, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_INHERIT), LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LINE_SPACE, 0x8, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_BLEND_MODE, 0x8, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_INHERIT), LV_STYLE_PROP_INIT(LV_STYLE_TEXT_UNDERLINE, 0x8, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_STRIKETHROUGH, 0x8, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_BLEND_MODE, 0x8, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_COLOR, 0x8, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_INHERIT), LV_STYLE_PROP_INIT(LV_STYLE_TEXT_COLOR, 0x8, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_SEL_COLOR, 0x8, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_INHERIT), LV_STYLE_PROP_INIT(LV_STYLE_TEXT_SEL_COLOR, 0x8, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_OPA, 0x8, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT), LV_STYLE_PROP_INIT(LV_STYLE_TEXT_OPA, 0x8, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT),
@@ -174,6 +178,9 @@ typedef uint16_t lv_style_state_t;
typedef struct { typedef struct {
uint8_t * map; uint8_t * map;
#if LV_USE_ASSERT_STYLE
uint32_t sentinel;
#endif
}lv_style_t; }lv_style_t;
typedef int16_t lv_style_int_t; typedef int16_t lv_style_int_t;
@@ -181,6 +188,9 @@ typedef int16_t lv_style_int_t;
typedef struct { typedef struct {
lv_style_t ** style_list; lv_style_t ** style_list;
#if LV_USE_ASSERT_STYLE
uint32_t sentinel;
#endif
uint8_t style_cnt; uint8_t style_cnt;
uint8_t has_local :1; uint8_t has_local :1;
}lv_style_list_t; }lv_style_list_t;

View File

@@ -7,6 +7,7 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_draw_arc.h" #include "lv_draw_arc.h"
#include "lv_draw_rect.h"
#include "lv_draw_mask.h" #include "lv_draw_mask.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"

View File

@@ -13,7 +13,6 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_draw.h"
#include "lv_draw_line.h" #include "lv_draw_line.h"
/********************* /*********************

View File

@@ -13,7 +13,6 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_draw.h"
#include "lv_img_decoder.h" #include "lv_img_decoder.h"
#include "lv_img_buf.h" #include "lv_img_buf.h"

View File

@@ -180,14 +180,14 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, lv_draw_lab
sel_end = tmp; sel_end = tmp;
} }
// lv_style_t line_style; lv_draw_line_dsc_t line_dsc;
// if(dsc->underline || dsc->strikethrough) { if(dsc->underline || dsc->strikethrough) {
// lv_style_copy(&line_style, style); lv_draw_line_dsc_init(&line_dsc);
// line_style.line.color = dsc->color; line_dsc.color = dsc->color;
// line_style.line.width = (dsc->font->line_height + 5) / 10; /*+5 for rounding*/ line_dsc.width = (dsc->font->line_height + 5) / 10; /*+5 for rounding*/
// line_style.line.opa = dsc->opa; line_dsc.opa = dsc->opa;
// line_style.line.blend_mode = dsc->blend_mode; line_dsc.blend_mode = dsc->blend_mode;
// } }
cmd_state_t cmd_state = CMD_STATE_WAIT; cmd_state_t cmd_state = CMD_STATE_WAIT;
uint32_t i; uint32_t i;
@@ -294,25 +294,25 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, lv_draw_lab
} }
} }
// if(dsc->strikethrough) { if(dsc->strikethrough) {
// lv_point_t p1; lv_point_t p1;
// lv_point_t p2; lv_point_t p2;
// p1.x = pos_x_start; p1.x = pos_x_start;
// p1.y = pos.y + (dsc->font->line_height / 2) + style->line.width / 2; p1.y = pos.y + (dsc->font->line_height / 2) + line_dsc.width / 2;
// p2.x = pos.x; p2.x = pos.x;
// p2.y = p1.y; p2.y = p1.y;
// lv_draw_line(&p1, &p2, mask, &line_style, opa_scale); lv_draw_line(&p1, &p2, mask, &line_dsc);
// } }
//
// if(dsc->underline) { if(dsc->underline) {
// lv_point_t p1; lv_point_t p1;
// lv_point_t p2; lv_point_t p2;
// p1.x = pos_x_start; p1.x = pos_x_start;
// p1.y = pos.y + dsc->font->line_height - dsc->font->base_line + style->line.width / 2 + 1; p1.y = pos.y + dsc->font->line_height - dsc->font->base_line + line_dsc.width / 2 + 1;
// p2.x = pos.x; p2.x = pos.x;
// p2.y = p1.y; p2.y = p1.y;
// lv_draw_line(&p1, &p2, mask, &line_style, opa_scale); lv_draw_line(&p1, &p2, mask, &line_dsc);
// } }
#if LV_USE_BIDI #if LV_USE_BIDI
lv_mem_buf_release(bidi_txt); lv_mem_buf_release(bidi_txt);

View File

@@ -13,8 +13,9 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_draw.h"
#include "../lv_misc/lv_bidi.h" #include "../lv_misc/lv_bidi.h"
#include "../lv_misc/lv_txt.h"
#include "../lv_core/lv_style.h"
/********************* /*********************
* DEFINES * DEFINES
@@ -38,6 +39,9 @@ typedef struct {
lv_coord_t ofs_y; lv_coord_t ofs_y;
lv_bidi_dir_t bidi_dir; lv_bidi_dir_t bidi_dir;
lv_txt_flag_t flag; lv_txt_flag_t flag;
lv_blend_mode_t blend_mode;
uint8_t underline :1;
uint8_t strikethrough :1;
}lv_draw_label_dsc_t; }lv_draw_label_dsc_t;
/** Store some info to speed up drawing of very large texts /** Store some info to speed up drawing of very large texts
@@ -63,7 +67,6 @@ typedef struct {
void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc); void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
/** /**
* Write a text * Write a text
* @param coords coordinates of the label * @param coords coordinates of the label

View File

@@ -8,7 +8,6 @@
*********************/ *********************/
#include <stdio.h> #include <stdio.h>
#include <stdbool.h> #include <stdbool.h>
#include "lv_draw.h"
#include "lv_draw_mask.h" #include "lv_draw_mask.h"
#include "lv_draw_blend.h" #include "lv_draw_blend.h"
#include "../lv_core/lv_refr.h" #include "../lv_core/lv_refr.h"

View File

@@ -13,6 +13,7 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_core/lv_style.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@@ -13,7 +13,6 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_draw.h"
#include "../lv_core/lv_style.h" #include "../lv_core/lv_style.h"
/********************* /*********************

View File

@@ -35,15 +35,14 @@
**********************/ **********************/
/** /**
* * Draw a triangle
* @param points pointer to an array with 3 points * @param points pointer to an array with 3 points
* @param clip_area the triangle will be drawn only in this area * @param clip_area the triangle will be drawn only in this area
* @param style style for of the triangle * @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
* @param opa_scale scale down all opacities by the factor (0..255)
*/ */
void lv_draw_triangle(const lv_point_t * points, const lv_area_t * clip_area, const lv_style_t * style, lv_opa_t opa_scale) void lv_draw_triangle(const lv_point_t * points, const lv_area_t * clip_area, lv_draw_rect_dsc_t * draw_dsc)
{ {
lv_draw_polygon(points, 3, clip_area, style, opa_scale); lv_draw_polygon(points, 3, clip_area, draw_dsc);
} }
/** /**
@@ -51,11 +50,9 @@ void lv_draw_triangle(const lv_point_t * points, const lv_area_t * clip_area, co
* @param points an array of points * @param points an array of points
* @param point_cnt number of points * @param point_cnt number of points
* @param clip_area polygon will be drawn only in this area * @param clip_area polygon will be drawn only in this area
* @param style style of the polygon * @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
* @param opa_scale scale down all opacities by the factor (0..255)
*/ */
void lv_draw_polygon(const lv_point_t * points, uint16_t point_cnt, const lv_area_t * clip_area, const lv_style_t * style, void lv_draw_polygon(const lv_point_t * points, uint16_t point_cnt, const lv_area_t * clip_area, lv_draw_rect_dsc_t * draw_dsc)
lv_opa_t opa_scale)
{ {
if(point_cnt < 3) return; if(point_cnt < 3) return;
if(points == NULL) return; if(points == NULL) return;
@@ -153,9 +150,7 @@ void lv_draw_polygon(const lv_point_t * points, uint16_t point_cnt, const lv_are
}while( mask_cnt < point_cnt); }while( mask_cnt < point_cnt);
lv_draw_rect(&poly_coords, clip_area, draw_dsc);
lv_draw_rect(&poly_coords, &poly_mask, style);
lv_draw_mask_remove_custom(mp); lv_draw_mask_remove_custom(mp);

View File

@@ -13,7 +13,7 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_draw.h" #include "lv_draw_rect.h"
/********************* /*********************
* DEFINES * DEFINES
@@ -27,26 +27,22 @@ extern "C" {
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
/** /**
* Draw a triangle * Draw a triangle
* @param points pointer to an array with 3 points * @param points pointer to an array with 3 points
* @param clip_area the triangle will be drawn only in this area * @param clip_area the triangle will be drawn only in this area
* @param style style for of the triangle * @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
* @param opa_scale scale down all opacities by the factor (0..255)
*/ */
void lv_draw_triangle(const lv_point_t * points, const lv_area_t * clip, const lv_style_t * style, lv_opa_t opa_scale); void lv_draw_triangle(const lv_point_t * points, const lv_area_t * clip, lv_draw_rect_dsc_t * draw_dsc);
/** /**
* Draw a polygon. Only convex polygons are supported. * Draw a polygon. Only convex polygons are supported.
* @param points an array of points * @param points an array of points
* @param point_cnt number of points * @param point_cnt number of points
* @param clip_area polygon will be drawn only in this area * @param clip_area polygon will be drawn only in this area
* @param style style of the polygon * @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
* @param opa_scale scale down all opacities by the factor (0..255)
*/ */
void lv_draw_polygon(const lv_point_t * points, uint16_t point_cnt, const lv_area_t * mask, const lv_style_t * style, void lv_draw_polygon(const lv_point_t * points, uint16_t point_cnt, const lv_area_t * mask, lv_draw_rect_dsc_t * draw_dsc);
lv_opa_t opa_scale);
/********************** /**********************
* MACROS * MACROS

View File

@@ -111,7 +111,7 @@ lv_style_t * lv_theme_get_style_part(lv_theme_style_t name, uint8_t part);
/********************** /**********************
* POST INCLUDE * POST INCLUDE
*********************/ *********************/
#include "lv_theme_def.h" #include <lvgl/src/lv_themes/lv_theme_material.h>
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

View File

@@ -1,54 +0,0 @@
/**
* @file lv_theme_alien.h
*
*/
#ifndef LV_THEME_ALIEN_H
#define LV_THEME_ALIEN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_THEME_ALIEN
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the alien theme
* @param hue [0..360] hue value from HSV color space to define the theme's base color
* @param font pointer to a font (NULL to use the default)
*/
lv_theme_t * lv_theme_default_init(uint16_t hue, lv_font_t * font);
lv_theme_t * lv_theme_alien_get(void);
lv_style_t * lv_theme_alien_get_style_part(lv_theme_style_t name, uint8_t part);
lv_style_t * lv_theme_alien_get_style(lv_theme_style_t name);
/**********************
* MACROS
**********************/
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_THEME_ALIEN_H*/

View File

@@ -1,5 +1,5 @@
/** /**
* @file lv_theme_alien.c * @file lv_theme_material.c
* *
*/ */
@@ -11,16 +11,11 @@
#include "../lv_widgets/lv_img.h" #include "../lv_widgets/lv_img.h"
#include "../lv_misc/lv_types.h" #include "../lv_misc/lv_types.h"
#if LV_USE_THEME_ALIEN #if LV_USE_THEME_MATERIAL
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
//#define COLOR_SCREEN lv_color_hex3(0x34a)
//#define COLOR_CONTAINER lv_color_hex3(0x888)
//#define COLOR_BACKGROUND lv_color_hex3(0x0f0)
//#define COLOR_ACCENT lv_color_hex3(0xf00)
//#define COLOR_DISABLED lv_color_hex3(0x999)
#define COLOR_SCREEN lv_color_hex(0x22252a) #define COLOR_SCREEN lv_color_hex(0x22252a)
#define COLOR_CONTAINER lv_color_hex(0x282b30) #define COLOR_CONTAINER lv_color_hex(0x282b30)
@@ -35,13 +30,20 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
void lv_theme_alien_apply(lv_obj_t * obj, lv_theme_style_t name); static void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_theme_t theme; static lv_theme_t theme;
static lv_color_t _color_primary;
static lv_color_t _color_secondary;
static uint32_t _flags;
static lv_font_t * _font_small;
static lv_font_t * _font_normal;
static lv_font_t * _font_subtitle;
static lv_font_t * _font_title;
static lv_style_t scr; static lv_style_t scr;
@@ -118,11 +120,11 @@ static lv_style_t cpicker_bg, cpicker_indic;
static lv_style_t mbox_btn, mbox_btn_bg; static lv_style_t mbox_btn, mbox_btn_bg;
#endif #endif
#if LV_USE_TEXTAREABVIEW #if LV_USE_TABVIEW
static lv_style_t tabview_btns, tabview_btns_bg, tabview_indic, tabview_page_scrl; static lv_style_t tabview_btns, tabview_btns_bg, tabview_indic, tabview_page_scrl;
#endif #endif
#if LV_USE_TEXTAREABLE #if LV_USE_TABLE
static lv_style_t table_cell; static lv_style_t table_cell;
#endif #endif
@@ -164,7 +166,7 @@ static void basic_init(void)
lv_style_set_pad_inner(&panel, LV_STATE_NORMAL, LV_DPI / 5); lv_style_set_pad_inner(&panel, LV_STATE_NORMAL, LV_DPI / 5);
lv_style_set_text_color(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); lv_style_set_text_color(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f));
lv_style_set_value_color(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); lv_style_set_value_color(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f));
lv_style_set_font(&panel, LV_STATE_NORMAL, &lv_font_roboto_16); lv_style_set_text_font(&panel, LV_STATE_NORMAL, &lv_font_roboto_16);
lv_style_set_image_recolor(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); lv_style_set_image_recolor(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f));
lv_style_set_line_color(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); lv_style_set_line_color(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f));
lv_style_set_line_width(&panel, LV_STATE_NORMAL, 1); lv_style_set_line_width(&panel, LV_STATE_NORMAL, 1);
@@ -222,6 +224,7 @@ static void bar_init(void)
lv_style_set_radius(&bar_bg, LV_STATE_NORMAL, LV_RADIUS_CIRCLE); lv_style_set_radius(&bar_bg, LV_STATE_NORMAL, LV_RADIUS_CIRCLE);
lv_style_set_bg_opa(&bar_bg, LV_STATE_NORMAL, LV_OPA_COVER); lv_style_set_bg_opa(&bar_bg, LV_STATE_NORMAL, LV_OPA_COVER);
lv_style_set_bg_color(&bar_bg, LV_STATE_NORMAL, COLOR_BACKGROUND); lv_style_set_bg_color(&bar_bg, LV_STATE_NORMAL, COLOR_BACKGROUND);
lv_style_set_value_color(&bar_bg, LV_STATE_NORMAL, LV_COLOR_WHITE);
lv_style_set_outline_color(&bar_bg, LV_STATE_FOCUSED, COLOR_ACCENT); lv_style_set_outline_color(&bar_bg, LV_STATE_FOCUSED, COLOR_ACCENT);
lv_style_set_outline_opa(&bar_bg, LV_STATE_FOCUSED, LV_OPA_50); lv_style_set_outline_opa(&bar_bg, LV_STATE_FOCUSED, LV_OPA_50);
lv_style_set_outline_width(&bar_bg, LV_STATE_FOCUSED, 3); lv_style_set_outline_width(&bar_bg, LV_STATE_FOCUSED, 3);
@@ -231,6 +234,7 @@ static void bar_init(void)
lv_style_set_radius(&bar_indic, LV_STATE_NORMAL, LV_RADIUS_CIRCLE); lv_style_set_radius(&bar_indic, LV_STATE_NORMAL, LV_RADIUS_CIRCLE);
lv_style_set_bg_color(&bar_indic, LV_STATE_NORMAL, COLOR_ACCENT); lv_style_set_bg_color(&bar_indic, LV_STATE_NORMAL, COLOR_ACCENT);
lv_style_set_bg_color(&bar_indic, LV_STATE_DISABLED, COLOR_DISABLED); lv_style_set_bg_color(&bar_indic, LV_STATE_DISABLED, COLOR_DISABLED);
lv_style_set_value_color(&bar_indic, LV_STATE_NORMAL, LV_COLOR_WHITE);
#endif #endif
} }
@@ -270,6 +274,7 @@ static void slider_init(void)
lv_style_init(&slider_knob); lv_style_init(&slider_knob);
lv_style_set_bg_opa(&slider_knob, LV_STATE_NORMAL, LV_OPA_COVER); lv_style_set_bg_opa(&slider_knob, LV_STATE_NORMAL, LV_OPA_COVER);
lv_style_set_bg_color(&slider_knob, LV_STATE_NORMAL, LV_COLOR_WHITE); lv_style_set_bg_color(&slider_knob, LV_STATE_NORMAL, LV_COLOR_WHITE);
lv_style_set_value_color(&slider_knob, LV_STATE_NORMAL, LV_COLOR_WHITE);
lv_style_set_radius(&slider_knob, LV_STATE_NORMAL, LV_RADIUS_CIRCLE); lv_style_set_radius(&slider_knob, LV_STATE_NORMAL, LV_RADIUS_CIRCLE);
lv_style_set_pad_left(&slider_knob, LV_STATE_NORMAL, LV_DPI/20); lv_style_set_pad_left(&slider_knob, LV_STATE_NORMAL, LV_DPI/20);
lv_style_set_pad_right(&slider_knob, LV_STATE_NORMAL, LV_DPI/20); lv_style_set_pad_right(&slider_knob, LV_STATE_NORMAL, LV_DPI/20);
@@ -278,7 +283,7 @@ static void slider_init(void)
#endif #endif
} }
static void sw_init(void) static void switch_init(void)
{ {
#if LV_USE_SWITCH != 0 #if LV_USE_SWITCH != 0
lv_style_init(&sw_knob); lv_style_init(&sw_knob);
@@ -292,7 +297,7 @@ static void sw_init(void)
#endif #endif
} }
static void lmeter_init(void) static void linemeter_init(void)
{ {
#if LV_USE_LMETER != 0 #if LV_USE_LMETER != 0
lv_style_init(&lmeter); lv_style_init(&lmeter);
@@ -370,7 +375,7 @@ static void arc_init(void)
#endif #endif
} }
static void preload_init(void) static void spinner_init(void)
{ {
#if LV_USE_SPINNER != 0 #if LV_USE_SPINNER != 0
#endif #endif
@@ -463,15 +468,11 @@ static void cpicker_init(void)
#endif #endif
} }
static void cb_init(void) static void checkbox_init(void)
{ {
#if LV_USE_CHECKBOX != 0 #if LV_USE_CHECKBOX != 0
lv_style_init(&cb_bg); lv_style_init(&cb_bg);
lv_style_set_radius(&cb_bg, LV_STATE_NORMAL, LV_DPI / 50); lv_style_set_radius(&cb_bg, LV_STATE_NORMAL, LV_DPI / 50);
// lv_style_set_pad_left(&cb_bg, LV_STATE_NORMAL, LV_DPI / 20);
// lv_style_set_pad_right(&cb_bg, LV_STATE_NORMAL, LV_DPI / 20);
// lv_style_set_pad_bottom(&cb_bg, LV_STATE_NORMAL, LV_DPI / 20);
// lv_style_set_pad_top(&cb_bg, LV_STATE_NORMAL, LV_DPI / 20);
lv_style_set_pad_inner(&cb_bg, LV_STATE_NORMAL , LV_DPI / 20); lv_style_set_pad_inner(&cb_bg, LV_STATE_NORMAL , LV_DPI / 20);
lv_style_set_outline_color(&cb_bg, LV_STATE_FOCUSED, COLOR_ACCENT); lv_style_set_outline_color(&cb_bg, LV_STATE_FOCUSED, COLOR_ACCENT);
lv_style_set_outline_opa(&cb_bg, LV_STATE_FOCUSED, LV_OPA_50); lv_style_set_outline_opa(&cb_bg, LV_STATE_FOCUSED, LV_OPA_50);
@@ -486,12 +487,15 @@ static void cb_init(void)
lv_style_set_bg_color(&cb_bullet, LV_STATE_NORMAL, COLOR_ACCENT); lv_style_set_bg_color(&cb_bullet, LV_STATE_NORMAL, COLOR_ACCENT);
lv_style_set_bg_opa(&cb_bullet, LV_STATE_NORMAL , LV_OPA_TRANSP); lv_style_set_bg_opa(&cb_bullet, LV_STATE_NORMAL , LV_OPA_TRANSP);
lv_style_set_bg_opa(&cb_bullet, LV_STATE_CHECKED , LV_OPA_COVER); lv_style_set_bg_opa(&cb_bullet, LV_STATE_CHECKED , LV_OPA_COVER);
lv_style_set_pattern_image(&cb_bullet, LV_STATE_CHECKED, LV_SYMBOL_OK);
lv_style_set_pattern_recolor(&cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE);
lv_style_set_text_font(&cb_bullet, LV_STATE_CHECKED, _font_small);
lv_style_set_border_opa(&cb_bullet, LV_STATE_CHECKED , LV_OPA_80); lv_style_set_border_opa(&cb_bullet, LV_STATE_CHECKED , LV_OPA_80);
lv_style_set_transition_time(&cb_bullet, LV_STATE_NORMAL , 300); lv_style_set_transition_time(&cb_bullet, LV_STATE_NORMAL , 300);
#endif #endif
} }
static void btnm_init(void) static void btnmatrix_init(void)
{ {
#if LV_USE_BTNMATRIX #if LV_USE_BTNMATRIX
lv_style_init(&btnm_bg); lv_style_init(&btnm_bg);
@@ -522,7 +526,7 @@ static void btnm_init(void)
#endif #endif
} }
static void kb_init(void) static void keyboard_init(void)
{ {
#if LV_USE_KEYBOARD #if LV_USE_KEYBOARD
lv_style_init(&kb_btn); lv_style_init(&kb_btn);
@@ -540,7 +544,7 @@ static void kb_init(void)
#endif #endif
} }
static void mbox_init(void) static void msgbox_init(void)
{ {
#if LV_USE_MSGBOX #if LV_USE_MSGBOX
lv_style_init(&mbox_btn); lv_style_init(&mbox_btn);
@@ -578,7 +582,7 @@ static void page_init(void)
#endif #endif
} }
static void ta_init(void) static void textarea_init(void)
{ {
#if LV_USE_TEXTAREA #if LV_USE_TEXTAREA
lv_style_init(&ta_bg); lv_style_init(&ta_bg);
@@ -707,7 +711,7 @@ static void roller_init(void)
static void tabview_init(void) static void tabview_init(void)
{ {
#if LV_USE_TEXTAREABVIEW != 0 #if LV_USE_TABVIEW != 0
lv_style_init(&tabview_btns_bg); lv_style_init(&tabview_btns_bg);
lv_style_set_bg_opa(&tabview_btns_bg, LV_STATE_NORMAL, LV_OPA_COVER); lv_style_set_bg_opa(&tabview_btns_bg, LV_STATE_NORMAL, LV_OPA_COVER);
lv_style_set_bg_color(&tabview_btns_bg, LV_STATE_NORMAL, COLOR_CONTAINER); lv_style_set_bg_color(&tabview_btns_bg, LV_STATE_NORMAL, COLOR_CONTAINER);
@@ -715,7 +719,7 @@ static void tabview_init(void)
lv_style_set_border_width(&tabview_btns_bg, LV_STATE_NORMAL, LV_DPI / 30 > 0 ? LV_DPI / 30 : 1); lv_style_set_border_width(&tabview_btns_bg, LV_STATE_NORMAL, LV_DPI / 30 > 0 ? LV_DPI / 30 : 1);
lv_style_set_border_side(&tabview_btns_bg, LV_STATE_NORMAL , LV_BORDER_SIDE_BOTTOM); lv_style_set_border_side(&tabview_btns_bg, LV_STATE_NORMAL , LV_BORDER_SIDE_BOTTOM);
lv_style_set_text_color(&tabview_btns_bg, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); lv_style_set_text_color(&tabview_btns_bg, LV_STATE_NORMAL, lv_color_hex(0x979a9f));
lv_style_set_font(&tabview_btns_bg, LV_STATE_NORMAL, &lv_font_roboto_16); lv_style_set_text_font(&tabview_btns_bg, LV_STATE_NORMAL, &lv_font_roboto_16);
lv_style_set_image_recolor(&tabview_btns_bg, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); lv_style_set_image_recolor(&tabview_btns_bg, LV_STATE_NORMAL, lv_color_hex(0x979a9f));
@@ -751,7 +755,7 @@ static void tileview_init(void)
static void table_init(void) static void table_init(void)
{ {
#if LV_USE_TEXTAREABLE != 0 #if LV_USE_TABLE != 0
lv_style_init(&table_cell); lv_style_init(&table_cell);
lv_style_set_border_color(&table_cell, LV_STATE_NORMAL, lv_color_hex(0x303338)); lv_style_set_border_color(&table_cell, LV_STATE_NORMAL, lv_color_hex(0x303338));
lv_style_set_border_width(&table_cell, LV_STATE_NORMAL, 1); lv_style_set_border_width(&table_cell, LV_STATE_NORMAL, 1);
@@ -777,15 +781,27 @@ static void win_init(void)
**********************/ **********************/
/** /**
* Initialize the alien theme * Initialize the default
* @param hue [0..360] hue value from HSV color space to define the theme's base color * @param color_primary the primary color of the theme
* @param font pointer to a font (NULL to use the default) * @param color_secondary the secondary color for the theme
* @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...`
* @param font_small pointer to a small font
* @param font_normal pointer to a normal font
* @param font_subtitle pointer to a large font
* @param font_title pointer to a extra large font
* @return a pointer to reference this theme later
*/ */
lv_theme_t * lv_theme_default_init(uint16_t hue, lv_font_t * font) lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
lv_font_t * font_small, lv_font_t * font_normal, lv_font_t * font_subtitle, lv_font_t * font_title)
{ {
lv_mem_monitor_t mon1; _color_primary = color_primary;
lv_mem_monitor(&mon1); _color_secondary = color_secondary;
_flags = flags;
_font_small = font_small;
_font_normal = font_normal;
_font_subtitle = font_subtitle;
_font_title = font_title;
basic_init(); basic_init();
cont_init(); cont_init();
@@ -796,20 +812,20 @@ lv_theme_t * lv_theme_default_init(uint16_t hue, lv_font_t * font)
line_init(); line_init();
led_init(); led_init();
slider_init(); slider_init();
sw_init(); switch_init();
lmeter_init(); linemeter_init();
gauge_init(); gauge_init();
arc_init(); arc_init();
preload_init(); spinner_init();
chart_init(); chart_init();
calendar_init(); calendar_init();
cpicker_init(); cpicker_init();
cb_init(); checkbox_init();
btnm_init(); btnmatrix_init();
kb_init(); keyboard_init();
mbox_init(); msgbox_init();
page_init(); page_init();
ta_init(); textarea_init();
spinbox_init(); spinbox_init();
list_init(); list_init();
ddlist_init(); ddlist_init();
@@ -819,11 +835,8 @@ lv_theme_t * lv_theme_default_init(uint16_t hue, lv_font_t * font)
table_init(); table_init();
win_init(); win_init();
theme.apply_cb = lv_theme_alien_apply; theme.apply_cb = lv_theme_material_apply;
lv_mem_monitor_t mon2;
lv_mem_monitor(&mon2);
printf("theme size: %d\n", mon1.free_size - mon2.free_size);
return &theme; return &theme;
} }
@@ -837,7 +850,7 @@ lv_theme_t * lv_theme_alien_get(void)
} }
void lv_theme_alien_apply(lv_obj_t * obj, lv_theme_style_t name) void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
{ {
lv_style_list_t * list; lv_style_list_t * list;
@@ -891,7 +904,7 @@ void lv_theme_alien_apply(lv_obj_t * obj, lv_theme_style_t name)
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN); list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
lv_style_list_reset(list); lv_style_list_reset(list);
lv_style_list_add_style(list, &btnm_btn); lv_style_list_add_style(list, &kb_btn);
break; break;
#endif #endif
@@ -1049,7 +1062,7 @@ void lv_theme_alien_apply(lv_obj_t * obj, lv_theme_style_t name)
lv_style_list_add_style(list, &sb); lv_style_list_add_style(list, &sb);
break; break;
#endif #endif
#if LV_USE_TEXTAREABVIEW #if LV_USE_TABVIEW
case LV_THEME_TABVIEW: case LV_THEME_TABVIEW:
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG); list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
lv_style_list_reset(list); lv_style_list_reset(list);
@@ -1176,7 +1189,7 @@ void lv_theme_alien_apply(lv_obj_t * obj, lv_theme_style_t name)
lv_style_list_add_style(list, &chart_series); lv_style_list_add_style(list, &chart_series);
break; break;
#endif #endif
#if LV_USE_TEXTAREABLE #if LV_USE_TABLE
case LV_THEME_TABLE: case LV_THEME_TABLE:
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG); list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
lv_style_list_reset(list); lv_style_list_reset(list);
@@ -1262,6 +1275,23 @@ void lv_theme_alien_apply(lv_obj_t * obj, lv_theme_style_t name)
break; break;
#endif #endif
#if LV_USE_SPINBOX
case LV_THEME_SPINBOX:
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
lv_style_list_reset(list);
lv_style_list_add_style(list, &ta_oneline);
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
lv_style_list_reset(list);
lv_style_list_add_style(list, &ta_cursor);
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_SCRLBAR);
lv_style_list_reset(list);
lv_style_list_add_style(list, &sb);
break;
#endif
#if LV_USE_CALENDAR #if LV_USE_CALENDAR
case LV_THEME_CALENDAR: case LV_THEME_CALENDAR:
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG); list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);

View File

@@ -0,0 +1,57 @@
/**
* @file lv_theme_material.h
*
*/
#ifndef LV_THEME_MATERIAL_H
#define LV_THEME_MATERIAL_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_THEME_MATERIAL
/*********************
* DEFINES
*********************/
#define LV_THEME_MATERIAL_FLAG_NONE 0
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the default
* @param color_primary the primary color of the theme
* @param color_secondary the secondary color for the theme
* @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...`
* @param font_small pointer to a small font
* @param font_normal pointer to a normal font
* @param font_subtitle pointer to a large font
* @param font_title pointer to a extra large font
* @return a pointer to reference this theme later
*/
lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
lv_font_t * font_small, lv_font_t * font_normal, lv_font_t * font_subtitle, lv_font_t * font_title);
/**********************
* MACROS
**********************/
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_THEME_ALIEN_H*/

View File

@@ -372,6 +372,17 @@ static lv_design_res_t lv_bar_design(lv_obj_t * bar, const lv_area_t * clip_area
draw_bg(bar, clip_area); draw_bg(bar, clip_area);
draw_indic(bar, clip_area); draw_indic(bar, clip_area);
/*Get the value and draw it after the indicator*/
lv_draw_rect_dsc_t draw_dsc;
lv_draw_rect_dsc_init(&draw_dsc);
draw_dsc.bg_opa = LV_OPA_TRANSP;
draw_dsc.border_opa = LV_OPA_TRANSP;
draw_dsc.shadow_opa = LV_OPA_TRANSP;
draw_dsc.pattern_opa = LV_OPA_TRANSP;
draw_dsc.outline_opa = LV_OPA_TRANSP;
lv_obj_init_draw_rect_dsc(bar, LV_BAR_PART_BG, &draw_dsc);
lv_draw_rect(&bar->coords, clip_area, &draw_dsc);
} else if(mode == LV_DESIGN_DRAW_POST) { } else if(mode == LV_DESIGN_DRAW_POST) {
} }
@@ -565,15 +576,20 @@ static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area)
draw_indic_dsc.shadow_opa = shadow_opa; draw_indic_dsc.shadow_opa = shadow_opa;
draw_indic_dsc.value_opa = value_opa; draw_indic_dsc.value_opa = value_opa;
/*Draw the border and the value*/ /*Draw the border*/
draw_indic_dsc.bg_opa = LV_OPA_TRANSP; draw_indic_dsc.bg_opa = LV_OPA_TRANSP;
draw_indic_dsc.shadow_opa = LV_OPA_TRANSP; draw_indic_dsc.shadow_opa = LV_OPA_TRANSP;
draw_indic_dsc.value_opa = LV_OPA_TRANSP;
draw_indic_dsc.pattern_image = NULL; draw_indic_dsc.pattern_image = NULL;
lv_draw_rect(&ext->indic_area, clip_area, &draw_indic_dsc); lv_draw_rect(&ext->indic_area, clip_area, &draw_indic_dsc);
lv_draw_mask_remove_id(mask_indic_id); lv_draw_mask_remove_id(mask_indic_id);
lv_draw_mask_remove_id(mask_bg_id); lv_draw_mask_remove_id(mask_bg_id);
/*When not masks draw the value*/
draw_indic_dsc.value_opa = value_opa;
lv_draw_rect(&ext->indic_area, clip_area, &draw_indic_dsc);
} }
/** /**

View File

@@ -269,7 +269,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
* An element of the map should look like e.g.: * An element of the map should look like e.g.:
* `ctrl_map[0] = width | LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_TGL_ENABLE` * `ctrl_map[0] = width | LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_TGL_ENABLE`
*/ */
void lv_btnmatrix_set_ctrl_map(const lv_obj_t * btnm, const lv_btnmatrix_ctrl_t ctrl_map[]) void lv_btnmatrix_set_ctrl_map(lv_obj_t * btnm, const lv_btnmatrix_ctrl_t ctrl_map[])
{ {
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME); LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
@@ -285,7 +285,7 @@ void lv_btnmatrix_set_ctrl_map(const lv_obj_t * btnm, const lv_btnmatrix_ctrl_t
* @param btnm pointer to button matrix object * @param btnm pointer to button matrix object
* @param id index of the currently pressed button (`LV_BTNMATRIX_BTN_NONE` to unpress) * @param id index of the currently pressed button (`LV_BTNMATRIX_BTN_NONE` to unpress)
*/ */
void lv_btnmatrix_set_pressed(const lv_obj_t * btnm, uint16_t id) void lv_btnmatrix_set_pressed(lv_obj_t * btnm, uint16_t id)
{ {
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME); LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);

View File

@@ -106,7 +106,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[]);
* An element of the map should look like e.g.: * An element of the map should look like e.g.:
* `ctrl_map[0] = width | LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_TGL_ENABLE` * `ctrl_map[0] = width | LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_TGL_ENABLE`
*/ */
void lv_btnmatrix_set_ctrl_map(const lv_obj_t * btnm, const lv_btnmatrix_ctrl_t ctrl_map[]); void lv_btnmatrix_set_ctrl_map(lv_obj_t * btnm, const lv_btnmatrix_ctrl_t ctrl_map[]);
/** /**
* Set the pressed button i.e. visually highlight it. * Set the pressed button i.e. visually highlight it.
@@ -114,7 +114,7 @@ void lv_btnmatrix_set_ctrl_map(const lv_obj_t * btnm, const lv_btnmatrix_ctrl_t
* @param btnm pointer to button matrix object * @param btnm pointer to button matrix object
* @param id index of the currently pressed button (`LV_BTNMATRIX_BTN_NONE` to unpress) * @param id index of the currently pressed button (`LV_BTNMATRIX_BTN_NONE` to unpress)
*/ */
void lv_btnmatrix_set_pressed(const lv_obj_t * btnm, uint16_t id); void lv_btnmatrix_set_pressed(lv_obj_t * btnm, uint16_t id);
/** /**
* Set a style of a button matrix * Set a style of a button matrix

View File

@@ -622,7 +622,7 @@ static bool calculate_touched_day(lv_obj_t * calendar, const lv_point_t * touche
*/ */
static lv_coord_t get_header_height(lv_obj_t * calendar) static lv_coord_t get_header_height(lv_obj_t * calendar)
{ {
const lv_font_t * font = lv_obj_get_style_font(calendar, LV_CALENDAR_PART_HEADER); const lv_font_t * font = lv_obj_get_style_text_font(calendar, LV_CALENDAR_PART_HEADER);
lv_style_int_t top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_HEADER); lv_style_int_t top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_HEADER);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_HEADER); lv_style_int_t bottom = lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_HEADER);
@@ -636,7 +636,7 @@ static lv_coord_t get_header_height(lv_obj_t * calendar)
*/ */
static lv_coord_t get_day_names_height(lv_obj_t * calendar) static lv_coord_t get_day_names_height(lv_obj_t * calendar)
{ {
const lv_font_t * font = lv_obj_get_style_font(calendar, LV_CALENDAR_PART_DAY_NAMES); const lv_font_t * font = lv_obj_get_style_text_font(calendar, LV_CALENDAR_PART_DAY_NAMES);
lv_style_int_t top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_DAY_NAMES); lv_style_int_t top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_DAY_NAMES);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_DAY_NAMES); lv_style_int_t bottom = lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_DAY_NAMES);
@@ -653,7 +653,7 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask)
lv_style_int_t header_top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_HEADER); lv_style_int_t header_top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_HEADER);
lv_style_int_t header_left = lv_obj_get_style_pad_left(calendar, LV_CALENDAR_PART_HEADER); lv_style_int_t header_left = lv_obj_get_style_pad_left(calendar, LV_CALENDAR_PART_HEADER);
lv_style_int_t header_right = lv_obj_get_style_pad_right(calendar, LV_CALENDAR_PART_HEADER); lv_style_int_t header_right = lv_obj_get_style_pad_right(calendar, LV_CALENDAR_PART_HEADER);
const lv_font_t * font = lv_obj_get_style_font(calendar, LV_CALENDAR_PART_HEADER); const lv_font_t * font = lv_obj_get_style_text_font(calendar, LV_CALENDAR_PART_HEADER);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar); lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
@@ -740,7 +740,7 @@ static void draw_day_names(lv_obj_t * calendar, const lv_area_t * mask)
lv_style_int_t left = lv_obj_get_style_pad_left(calendar, LV_CALENDAR_PART_DAY_NAMES); lv_style_int_t left = lv_obj_get_style_pad_left(calendar, LV_CALENDAR_PART_DAY_NAMES);
lv_style_int_t right = lv_obj_get_style_pad_right(calendar, LV_CALENDAR_PART_DAY_NAMES); lv_style_int_t right = lv_obj_get_style_pad_right(calendar, LV_CALENDAR_PART_DAY_NAMES);
lv_style_int_t top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_DAY_NAMES); lv_style_int_t top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_DAY_NAMES);
const lv_font_t * font = lv_obj_get_style_font(calendar, LV_CALENDAR_PART_DAY_NAMES); const lv_font_t * font = lv_obj_get_style_text_font(calendar, LV_CALENDAR_PART_DAY_NAMES);
lv_coord_t w = lv_obj_get_width(calendar) - left - right; lv_coord_t w = lv_obj_get_width(calendar) - left - right;
@@ -773,7 +773,7 @@ static void draw_dates(lv_obj_t * calendar, const lv_area_t * clip_area)
{ {
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar); lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
const lv_font_t * nums_font = lv_obj_get_style_font(calendar, LV_CALENDAR_PART_DATE); const lv_font_t * nums_font = lv_obj_get_style_text_font(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t date_top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_DATE); lv_style_int_t date_top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t date_bottom = lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_DATE); lv_style_int_t date_bottom = lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_DATE);

View File

@@ -178,7 +178,7 @@ static lv_res_t lv_checkbox_signal(lv_obj_t * cb, lv_signal_t sign, void * param
lv_checkbox_ext_t * ext = lv_obj_get_ext_attr(cb); lv_checkbox_ext_t * ext = lv_obj_get_ext_attr(cb);
if(sign == LV_SIGNAL_STYLE_CHG) { if(sign == LV_SIGNAL_STYLE_CHG) {
const lv_font_t * font = lv_obj_get_style_font(ext->label, LV_LABEL_PART_MAIN); const lv_font_t * font = lv_obj_get_style_text_font(ext->label, LV_LABEL_PART_MAIN);
lv_coord_t line_height = lv_font_get_line_height(font); lv_coord_t line_height = lv_font_get_line_height(font);
lv_obj_set_size(ext->bullet, line_height, line_height); lv_obj_set_size(ext->bullet, line_height, line_height);
lv_obj_set_state(ext->bullet, lv_obj_get_state(cb, LV_CHECKBOX_PART_BG)); lv_obj_set_state(ext->bullet, lv_obj_get_state(cb, LV_CHECKBOX_PART_BG));

View File

@@ -776,7 +776,7 @@ static lv_res_t lv_dropdown_signal(lv_obj_t * ddlist, lv_signal_t sign, void * p
else if(sign == LV_SIGNAL_STYLE_CHG) { else if(sign == LV_SIGNAL_STYLE_CHG) {
lv_style_int_t top = lv_obj_get_style_pad_top(ddlist, LV_DROPDOWN_PART_BTN); lv_style_int_t top = lv_obj_get_style_pad_top(ddlist, LV_DROPDOWN_PART_BTN);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ddlist, LV_DROPDOWN_PART_BTN); lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ddlist, LV_DROPDOWN_PART_BTN);
const lv_font_t * font = lv_obj_get_style_font(ddlist, LV_DROPDOWN_PART_BTN); const lv_font_t * font = lv_obj_get_style_text_font(ddlist, LV_DROPDOWN_PART_BTN);
lv_obj_set_height(ddlist, top + bottom + lv_font_get_line_height(font)); lv_obj_set_height(ddlist, top + bottom + lv_font_get_line_height(font));
if(ext->page) lv_obj_refresh_style(ext->page); if(ext->page) lv_obj_refresh_style(ext->page);
@@ -940,7 +940,7 @@ static void draw_box(lv_obj_t * ddlist, const lv_area_t * clip_area, uint16_t id
page->state_dsc.prev = page->state_dsc.act; page->state_dsc.prev = page->state_dsc.act;
/*Draw a rectangle under the selected item*/ /*Draw a rectangle under the selected item*/
const lv_font_t * font = lv_obj_get_style_font(ddlist, LV_DROPDOWN_PART_LIST); const lv_font_t * font = lv_obj_get_style_text_font(ddlist, LV_DROPDOWN_PART_LIST);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(ddlist, LV_DROPDOWN_PART_LIST); lv_style_int_t line_space = lv_obj_get_style_text_line_space(ddlist, LV_DROPDOWN_PART_LIST);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
@@ -1095,7 +1095,7 @@ static void pos_selected(lv_obj_t * ddlist)
{ {
lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist); lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist);
const lv_font_t * font = lv_obj_get_style_font(ddlist, LV_DROPDOWN_PART_LIST); const lv_font_t * font = lv_obj_get_style_text_font(ddlist, LV_DROPDOWN_PART_LIST);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
lv_obj_t * scrl = lv_page_get_scrl(ext->page); lv_obj_t * scrl = lv_page_get_scrl(ext->page);
lv_obj_t * label = get_label(ddlist); lv_obj_t * label = get_label(ddlist);

View File

@@ -192,7 +192,7 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
if(src_type == LV_IMG_SRC_SYMBOL) { if(src_type == LV_IMG_SRC_SYMBOL) {
/*`lv_img_dsc_get_info` couldn't set the with and height of a font so set it here*/ /*`lv_img_dsc_get_info` couldn't set the with and height of a font so set it here*/
const lv_font_t * font = lv_obj_get_style_font(img, LV_IMG_PART_MAIN); const lv_font_t * font = lv_obj_get_style_text_font(img, LV_IMG_PART_MAIN);
lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(img, LV_IMG_PART_MAIN); lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(img, LV_IMG_PART_MAIN);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(img, LV_IMG_PART_MAIN); lv_style_int_t line_space = lv_obj_get_style_text_line_space(img, LV_IMG_PART_MAIN);
lv_point_t size; lv_point_t size;

View File

@@ -402,7 +402,7 @@ static void refr_img(lv_obj_t * imgbtn)
lv_res_t info_res = LV_RES_OK; lv_res_t info_res = LV_RES_OK;
if(lv_img_src_get_type(src) == LV_IMG_SRC_SYMBOL) { if(lv_img_src_get_type(src) == LV_IMG_SRC_SYMBOL) {
const lv_font_t * font = lv_obj_get_style_font(imgbtn, LV_IMGBTN_PART_MAIN); const lv_font_t * font = lv_obj_get_style_text_font(imgbtn, LV_IMGBTN_PART_MAIN);
header.h = lv_font_get_line_height(font); header.h = lv_font_get_line_height(font);
header.w = lv_txt_get_width(src, (uint16_t)strlen(src), font, 0, LV_TXT_FLAG_NONE); header.w = lv_txt_get_width(src, (uint16_t)strlen(src), font, 0, LV_TXT_FLAG_NONE);
header.always_zero = 0; header.always_zero = 0;

View File

@@ -565,7 +565,7 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t char_id, lv_point_
uint32_t line_start = 0; uint32_t line_start = 0;
uint32_t new_line_start = 0; uint32_t new_line_start = 0;
lv_coord_t max_w = lv_area_get_width(&txt_coords); lv_coord_t max_w = lv_area_get_width(&txt_coords);
const lv_font_t * font = lv_obj_get_style_font(label, LV_LABEL_PART_MAIN); const lv_font_t * font = lv_obj_get_style_text_font(label, LV_LABEL_PART_MAIN);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(label, LV_LABEL_PART_MAIN); lv_style_int_t line_space = lv_obj_get_style_text_line_space(label, LV_LABEL_PART_MAIN);
lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(label, LV_LABEL_PART_MAIN); lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(label, LV_LABEL_PART_MAIN);
lv_coord_t letter_height = lv_font_get_line_height(font); lv_coord_t letter_height = lv_font_get_line_height(font);
@@ -671,7 +671,7 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
uint32_t line_start = 0; uint32_t line_start = 0;
uint32_t new_line_start = 0; uint32_t new_line_start = 0;
lv_coord_t max_w = lv_area_get_width(&txt_coords); lv_coord_t max_w = lv_area_get_width(&txt_coords);
const lv_font_t * font = lv_obj_get_style_font(label, LV_LABEL_PART_MAIN); const lv_font_t * font = lv_obj_get_style_text_font(label, LV_LABEL_PART_MAIN);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(label, LV_LABEL_PART_MAIN); lv_style_int_t line_space = lv_obj_get_style_text_line_space(label, LV_LABEL_PART_MAIN);
lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(label, LV_LABEL_PART_MAIN); lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(label, LV_LABEL_PART_MAIN);
lv_coord_t letter_height = lv_font_get_line_height(font); lv_coord_t letter_height = lv_font_get_line_height(font);
@@ -834,7 +834,7 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos)
uint32_t line_start = 0; uint32_t line_start = 0;
uint32_t new_line_start = 0; uint32_t new_line_start = 0;
lv_coord_t max_w = lv_area_get_width(&txt_coords); lv_coord_t max_w = lv_area_get_width(&txt_coords);
const lv_font_t * font = lv_obj_get_style_font(label, LV_LABEL_PART_MAIN); const lv_font_t * font = lv_obj_get_style_text_font(label, LV_LABEL_PART_MAIN);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(label, LV_LABEL_PART_MAIN); lv_style_int_t line_space = lv_obj_get_style_text_line_space(label, LV_LABEL_PART_MAIN);
lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(label, LV_LABEL_PART_MAIN); lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(label, LV_LABEL_PART_MAIN);
lv_coord_t letter_height = lv_font_get_line_height(font); lv_coord_t letter_height = lv_font_get_line_height(font);
@@ -1179,7 +1179,7 @@ static void lv_label_refr_text(lv_obj_t * label)
lv_area_t txt_coords; lv_area_t txt_coords;
get_txt_coords(label, &txt_coords); get_txt_coords(label, &txt_coords);
lv_coord_t max_w = lv_area_get_width(&txt_coords); lv_coord_t max_w = lv_area_get_width(&txt_coords);
const lv_font_t * font = lv_obj_get_style_font(label, LV_LABEL_PART_MAIN); const lv_font_t * font = lv_obj_get_style_text_font(label, LV_LABEL_PART_MAIN);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(label, LV_LABEL_PART_MAIN); lv_style_int_t line_space = lv_obj_get_style_text_line_space(label, LV_LABEL_PART_MAIN);
lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(label, LV_LABEL_PART_MAIN); lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(label, LV_LABEL_PART_MAIN);

View File

@@ -778,7 +778,7 @@ static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * para
sign == LV_SIGNAL_STYLE_CHG) { sign == LV_SIGNAL_STYLE_CHG) {
lv_obj_t * label = lv_list_get_btn_label(btn); lv_obj_t * label = lv_list_get_btn_label(btn);
if(label) { if(label) {
const lv_font_t * font = lv_obj_get_style_font(label, LV_LABEL_PART_MAIN); const lv_font_t * font = lv_obj_get_style_text_font(label, LV_LABEL_PART_MAIN);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
if(lv_obj_get_base_dir(btn) == LV_BIDI_DIR_RTL) { if(lv_obj_get_base_dir(btn) == LV_BIDI_DIR_RTL) {
lv_coord_t pad = lv_obj_get_style_pad_left(btn, LV_BTN_PART_MAIN); lv_coord_t pad = lv_obj_get_style_pad_left(btn, LV_BTN_PART_MAIN);

View File

@@ -515,7 +515,7 @@ static void mbox_realign(lv_obj_t * mbox)
lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(mbox, LV_MSGBOX_PART_BTN_BG); lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(mbox, LV_MSGBOX_PART_BTN_BG);
lv_style_int_t btn_top = lv_obj_get_style_pad_top(mbox, LV_MSGBOX_PART_BTN); lv_style_int_t btn_top = lv_obj_get_style_pad_top(mbox, LV_MSGBOX_PART_BTN);
lv_style_int_t btn_bottom = lv_obj_get_style_pad_bottom(mbox, LV_MSGBOX_PART_BTN); lv_style_int_t btn_bottom = lv_obj_get_style_pad_bottom(mbox, LV_MSGBOX_PART_BTN);
const lv_font_t * font = lv_obj_get_style_font(mbox, LV_MSGBOX_PART_BTN); const lv_font_t * font = lv_obj_get_style_text_font(mbox, LV_MSGBOX_PART_BTN);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
lv_obj_set_size(ext->btnm, w, font_h + btn_top + btn_bottom + bg_top + bg_bottom); lv_obj_set_size(ext->btnm, w, font_h + btn_top + btn_bottom + bg_top + bg_bottom);

View File

@@ -241,7 +241,7 @@ void lv_roller_set_visible_row_count(lv_obj_t * roller, uint8_t row_cnt)
LV_ASSERT_OBJ(roller, LV_OBJX_NAME); LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
uint8_t n_line_space = (row_cnt > 1) ? row_cnt - 1 : 1; uint8_t n_line_space = (row_cnt > 1) ? row_cnt - 1 : 1;
const lv_font_t * font = lv_obj_get_style_font(roller, LV_ROLLER_PART_BG); const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG); lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG);
lv_obj_set_height(roller, lv_font_get_line_height(font) * row_cnt + line_space * n_line_space); lv_obj_set_height(roller, lv_font_get_line_height(font) * row_cnt + line_space * n_line_space);
@@ -371,7 +371,7 @@ static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * cli
else if(mode == LV_DESIGN_DRAW_MAIN) { else if(mode == LV_DESIGN_DRAW_MAIN) {
draw_bg(roller, clip_area); draw_bg(roller, clip_area);
const lv_font_t * font = lv_obj_get_style_font(roller, LV_ROLLER_PART_BG); const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG); lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
lv_area_t rect_area; lv_area_t rect_area;
@@ -572,7 +572,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
int32_t id = -1; int32_t id = -1;
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller); lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
const lv_font_t * font = lv_obj_get_style_font(roller, LV_ROLLER_PART_BG); const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG); lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
@@ -677,7 +677,7 @@ static void refr_position(lv_obj_t * roller, lv_anim_enable_t anim_en)
lv_obj_t * roller_scrl = lv_page_get_scrl(roller); lv_obj_t * roller_scrl = lv_page_get_scrl(roller);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller); lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
const lv_font_t * font = lv_obj_get_style_font(roller, LV_ROLLER_PART_BG); const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG); lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
lv_coord_t h = lv_obj_get_height(roller); lv_coord_t h = lv_obj_get_height(roller);
@@ -821,7 +821,7 @@ static void inf_normalize(void * scrl)
ext->sel_opt_id += (LV_ROLLER_INF_PAGES / 2) * real_id_cnt; /*Select the middle page*/ ext->sel_opt_id += (LV_ROLLER_INF_PAGES / 2) * real_id_cnt; /*Select the middle page*/
/*Move to the new id*/ /*Move to the new id*/
const lv_font_t * font = lv_obj_get_style_font(roller, LV_ROLLER_PART_BG); const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG); lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
lv_coord_t h = lv_obj_get_height(roller); lv_coord_t h = lv_obj_get_height(roller);

View File

@@ -23,7 +23,7 @@ extern "C" {
#endif #endif
#include "../lv_core/lv_obj.h" #include "../lv_core/lv_obj.h"
#include "../lv_widgets/lv_ta.h" #include "../lv_widgets/lv_textarea.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@@ -7,7 +7,7 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_table.h" #include "lv_table.h"
#if LV_USE_TEXTAREABLE != 0 #if LV_USE_TABLE != 0
#include "../lv_core/lv_debug.h" #include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_txt.h" #include "../lv_misc/lv_txt.h"
@@ -863,7 +863,7 @@ static void refr_size(lv_obj_t * table)
cell_bottom[i] = lv_obj_get_style_pad_bottom(table, LV_TABLE_PART_CELL1 + i); cell_bottom[i] = lv_obj_get_style_pad_bottom(table, LV_TABLE_PART_CELL1 + i);
letter_space[i] = lv_obj_get_style_text_letter_space(table, LV_TABLE_PART_CELL1 + i); letter_space[i] = lv_obj_get_style_text_letter_space(table, LV_TABLE_PART_CELL1 + i);
line_space[i] = lv_obj_get_style_text_line_space(table, LV_TABLE_PART_CELL1 + i); line_space[i] = lv_obj_get_style_text_line_space(table, LV_TABLE_PART_CELL1 + i);
font[i] = lv_obj_get_style_font(table, LV_TABLE_PART_CELL1 + i); font[i] = lv_obj_get_style_text_font(table, LV_TABLE_PART_CELL1 + i);
} }

View File

@@ -15,7 +15,7 @@ extern "C" {
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#if LV_USE_TEXTAREABLE != 0 #if LV_USE_TABLE != 0
/*Testing of dependencies*/ /*Testing of dependencies*/
#if LV_USE_LABEL == 0 #if LV_USE_LABEL == 0
@@ -238,7 +238,7 @@ bool lv_table_get_cell_merge_right(lv_obj_t * table, uint16_t row, uint16_t col)
* MACROS * MACROS
**********************/ **********************/
#endif /*LV_USE_TEXTAREABLE*/ #endif /*LV_USE_TABLE*/
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

View File

@@ -7,7 +7,7 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_tabview.h" #include "lv_tabview.h"
#if LV_USE_TEXTAREABVIEW != 0 #if LV_USE_TABVIEW != 0
#include "lv_btnmatrix.h" #include "lv_btnmatrix.h"
#include "../lv_core/lv_debug.h" #include "../lv_core/lv_debug.h"
@@ -864,7 +864,7 @@ static void refr_btns_size(lv_obj_t * tabview)
lv_style_int_t tab_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_TAB); lv_style_int_t tab_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_TAB);
lv_style_int_t tab_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_TAB); lv_style_int_t tab_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_TAB);
const lv_font_t * font = lv_obj_get_style_font(tabview, LV_TABVIEW_PART_TAB); const lv_font_t * font = lv_obj_get_style_text_font(tabview, LV_TABVIEW_PART_TAB);
/*Set the tabs height/width*/ /*Set the tabs height/width*/
lv_coord_t btns_w; lv_coord_t btns_w;

View File

@@ -15,7 +15,7 @@ extern "C" {
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#if LV_USE_TEXTAREABVIEW != 0 #if LV_USE_TABVIEW != 0
/*Testing of dependencies*/ /*Testing of dependencies*/
#if LV_USE_BTNMATRIX == 0 #if LV_USE_BTNMATRIX == 0
@@ -176,7 +176,7 @@ lv_tabview_btns_pos_t lv_tabview_get_btns_pos(const lv_obj_t * tabview);
* MACROS * MACROS
**********************/ **********************/
#endif /*LV_USE_TEXTAREABVIEW*/ #endif /*LV_USE_TABVIEW*/
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

View File

@@ -160,6 +160,7 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy)
ext->max_length = copy_ext->max_length; ext->max_length = copy_ext->max_length;
ext->cursor.pos = copy_ext->cursor.pos; ext->cursor.pos = copy_ext->cursor.pos;
ext->cursor.valid_x = copy_ext->cursor.valid_x; ext->cursor.valid_x = copy_ext->cursor.valid_x;
ext->cursor.hidden = copy_ext->cursor.hidden;
lv_style_list_copy(&ext->cursor.style, &copy_ext->cursor.style); lv_style_list_copy(&ext->cursor.style, &copy_ext->cursor.style);
@@ -591,7 +592,7 @@ void lv_textarea_set_cursor_pos(lv_obj_t * ta, int16_t pos)
/*Position the label to make the cursor visible*/ /*Position the label to make the cursor visible*/
lv_obj_t * label_par = lv_obj_get_parent(ext->label); lv_obj_t * label_par = lv_obj_get_parent(ext->label);
lv_point_t cur_pos; lv_point_t cur_pos;
const lv_font_t * font = lv_obj_get_style_font(ta, LV_TEXTAREA_PART_BG); const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG); lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_BG); lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_BG);
lv_area_t label_cords; lv_area_t label_cords;
@@ -739,7 +740,7 @@ void lv_textarea_set_one_line(lv_obj_t * ta, bool en)
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG); lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_BG); lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_BG); lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_BG);
const lv_font_t * font = lv_obj_get_style_font(ta, LV_TEXTAREA_PART_BG); const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
ext->one_line = 1; ext->one_line = 1;
@@ -1215,7 +1216,7 @@ void lv_textarea_cursor_down(lv_obj_t * ta)
/*Increment the y with one line and keep the valid x*/ /*Increment the y with one line and keep the valid x*/
lv_style_int_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_BG); lv_style_int_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_BG);
const lv_font_t * font = lv_obj_get_style_font(ta, LV_TEXTAREA_PART_BG); const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
pos.y += font_h + line_space + 1; pos.y += font_h + line_space + 1;
pos.x = ext->cursor.valid_x; pos.x = ext->cursor.valid_x;
@@ -1247,7 +1248,7 @@ void lv_textarea_cursor_up(lv_obj_t * ta)
/*Decrement the y with one line and keep the valid x*/ /*Decrement the y with one line and keep the valid x*/
lv_style_int_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_BG); lv_style_int_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_BG);
const lv_font_t * font = lv_obj_get_style_font(ta, LV_TEXTAREA_PART_BG); const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
pos.y -= font_h + line_space - 1; pos.y -= font_h + line_space - 1;
pos.x = ext->cursor.valid_x; pos.x = ext->cursor.valid_x;
@@ -1397,7 +1398,7 @@ static lv_res_t lv_textarea_signal(lv_obj_t * ta, lv_signal_t sign, void * param
if(ext->one_line) { if(ext->one_line) {
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG); lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_BG); lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_BG);
const lv_font_t * font = lv_obj_get_style_font(ta, LV_TEXTAREA_PART_BG); const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
/*In one line mode refresh the Text Area height because 'vpad' can modify it*/ /*In one line mode refresh the Text Area height because 'vpad' can modify it*/
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
@@ -1511,7 +1512,7 @@ static lv_res_t lv_textarea_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign,
if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
/*Set ext. size because the cursor might be out of this object*/ /*Set ext. size because the cursor might be out of this object*/
lv_style_int_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_BG); lv_style_int_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_BG);
const lv_font_t * font = lv_obj_get_style_font(ta, LV_TEXTAREA_PART_BG); const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
scrl->ext_draw_pad = LV_MATH_MAX(scrl->ext_draw_pad, line_space + font_h); scrl->ext_draw_pad = LV_MATH_MAX(scrl->ext_draw_pad, line_space + font_h);
} else if(sign == LV_SIGNAL_COORD_CHG) { } else if(sign == LV_SIGNAL_COORD_CHG) {