mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
Merge branch 'dev-7.0' of github.com:littlevgl/lvgl into dev-7.0
This commit is contained in:
commit
6c1f784d25
@ -176,7 +176,7 @@ typedef void * lv_group_user_data_t;
|
||||
#endif /*LV_USE_GROUP*/
|
||||
|
||||
/* 1: Enable GPU interface*/
|
||||
#define LV_USE_GPU 1
|
||||
#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */
|
||||
#define LV_USE_GPU_STM32_DMA2D 0
|
||||
|
||||
/* 1: Enable file system (might be required for images */
|
||||
|
2
lvgl.h
2
lvgl.h
@ -33,8 +33,6 @@ extern "C" {
|
||||
|
||||
#include "src/lv_font/lv_font.h"
|
||||
#include "src/lv_font/lv_font_fmt_txt.h"
|
||||
#include "src/lv_misc/lv_bidi.h"
|
||||
#include "src/lv_misc/lv_txt_ap.h"
|
||||
#include "src/lv_misc/lv_printf.h"
|
||||
|
||||
#include "src/lv_widgets/lv_btn.h"
|
||||
|
@ -140,14 +140,14 @@ void lv_port_indev_init(void)
|
||||
|
||||
/*Register a encoder input device*/
|
||||
lv_indev_drv_init(&indev_drv);
|
||||
indev_drv.type = LV_INDEV_TYPE_KEYPAD;
|
||||
indev_drv.type = LV_INDEV_TYPE_ENCODER;
|
||||
indev_drv.read_cb = encoder_read;
|
||||
indev_encoder = lv_indev_drv_register(&indev_drv);
|
||||
|
||||
/* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
|
||||
* add objects to the group with `lv_group_add_obj(group, obj)`
|
||||
* and assign this input device to group to navigate in it:
|
||||
* `lv_indev_set_group(indev_keypad, group);` */
|
||||
* `lv_indev_set_group(indev_encoder, group);` */
|
||||
|
||||
/*------------------
|
||||
* Button
|
||||
|
@ -261,7 +261,7 @@
|
||||
|
||||
/* 1: Enable GPU interface*/
|
||||
#ifndef LV_USE_GPU
|
||||
#define LV_USE_GPU 1
|
||||
#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */
|
||||
#endif
|
||||
#ifndef LV_USE_GPU_STM32_DMA2D
|
||||
#define LV_USE_GPU_STM32_DMA2D 0
|
||||
|
@ -735,6 +735,12 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
*/
|
||||
static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
{
|
||||
/* Die gracefully if i->btn_points is NULL */
|
||||
if (i->btn_points == NULL) {
|
||||
LV_LOG_WARN("indev_button_proc: btn_points was NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
i->proc.types.pointer.act_point.x = i->btn_points[data->btn_id].x;
|
||||
i->proc.types.pointer.act_point.y = i->btn_points[data->btn_id].y;
|
||||
|
||||
|
@ -220,6 +220,11 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
new_obj->base_dir = LV_BIDI_DIR_LTR;
|
||||
#endif
|
||||
|
||||
/*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*/
|
||||
new_obj->coords.x1 = 0;
|
||||
new_obj->coords.y1 = 0;
|
||||
@ -245,6 +250,11 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
new_obj->base_dir = LV_BIDI_DIR_LTR;
|
||||
#endif
|
||||
|
||||
/*Set the callbacks (signal:cb is required in `lv_obj_get_base_dir` if `LV_USE_ASSERT_OBJ` is enabled)*/
|
||||
new_obj->signal_cb = lv_obj_signal;
|
||||
new_obj->design_cb = lv_obj_design;
|
||||
new_obj->event_cb = NULL;
|
||||
|
||||
new_obj->coords.y1 = parent->coords.y1;
|
||||
new_obj->coords.y2 = parent->coords.y1 + LV_OBJ_DEF_HEIGHT;
|
||||
if(lv_obj_get_base_dir(new_obj) == LV_BIDI_DIR_RTL) {
|
||||
@ -260,10 +270,6 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
|
||||
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;
|
||||
|
||||
new_obj->ext_draw_pad = 0;
|
||||
|
||||
@ -2728,6 +2734,8 @@ bool lv_obj_get_parent_event(const lv_obj_t * obj)
|
||||
|
||||
lv_bidi_dir_t lv_obj_get_base_dir(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
#if LV_USE_BIDI
|
||||
const lv_obj_t * parent = obj;
|
||||
|
||||
|
@ -23,7 +23,6 @@ extern "C" {
|
||||
#include "../lv_misc/lv_mem.h"
|
||||
#include "../lv_misc/lv_ll.h"
|
||||
#include "../lv_misc/lv_color.h"
|
||||
#include "../lv_misc/lv_bidi.h"
|
||||
#include "../lv_hal/lv_hal.h"
|
||||
#include "../lv_draw/lv_draw_rect.h"
|
||||
#include "../lv_draw/lv_draw_label.h"
|
||||
|
@ -385,7 +385,7 @@ static void lv_refr_area(const lv_area_t * area_p)
|
||||
lv_coord_t w = lv_area_get_width(area_p);
|
||||
lv_coord_t h = lv_area_get_height(area_p);
|
||||
lv_coord_t y2 =
|
||||
area_p->y2 >= lv_disp_get_ver_res(disp_refr) ? y2 = lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2;
|
||||
area_p->y2 >= lv_disp_get_ver_res(disp_refr) ? lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2;
|
||||
|
||||
int32_t max_row = (uint32_t)vdb->size / w;
|
||||
|
||||
|
@ -121,8 +121,6 @@ LV_ATTRIBUTE_FAST_MEM void lv_blend_fill(const lv_area_t * clip_area, const lv_a
|
||||
lv_color_t color, lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa,
|
||||
lv_blend_mode_t mode)
|
||||
{
|
||||
static int asd = 0;
|
||||
asd++;
|
||||
/*Do not draw transparent things*/
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
if(mask_res == LV_DRAW_MASK_RES_TRANSP) return;
|
||||
@ -464,8 +462,8 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
||||
const lv_opa_t * mask_tmp_x = mask;
|
||||
for(x = 0; x < draw_area_w; x++) {
|
||||
if(*mask_tmp_x) {
|
||||
if(*mask_tmp_x != last_mask) opa_tmp = *mask_tmp_x == LV_OPA_COVER ? opa : (uint32_t)((uint32_t)(
|
||||
*mask_tmp_x) * opa) >> 8;
|
||||
if(*mask_tmp_x != last_mask) opa_tmp = *mask_tmp_x == LV_OPA_COVER ? opa :
|
||||
(uint32_t)((uint32_t)(*mask_tmp_x) * opa) >> 8;
|
||||
if(*mask_tmp_x != last_mask || last_dest_color.full != disp_buf_first[x].full) {
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
if(disp->driver.screen_transp) {
|
||||
|
@ -518,7 +518,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_
|
||||
uint32_t col_bit;
|
||||
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
|
||||
|
||||
uint32_t mask_buf_size = box_w * box_h > LV_HOR_RES_MAX ? box_w * box_h : LV_HOR_RES_MAX;
|
||||
uint32_t mask_buf_size = box_w * box_h > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : box_w * box_h;
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
int32_t mask_p = 0;
|
||||
|
||||
@ -572,7 +572,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_
|
||||
}
|
||||
}
|
||||
|
||||
if((uint32_t) mask_p + (row_end - row_start) < mask_buf_size) {
|
||||
if((uint32_t) mask_p + (col_end - col_start) < mask_buf_size) {
|
||||
fill_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
@ -655,7 +655,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
int32_t col_bit;
|
||||
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
|
||||
|
||||
int32_t mask_buf_size = box_w * box_h > LV_HOR_RES_MAX ? g->box_w * g->box_h : LV_HOR_RES_MAX;
|
||||
int32_t mask_buf_size = box_w * box_h > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : g->box_w * g->box_h;
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
int32_t mask_p = 0;
|
||||
|
||||
@ -727,7 +727,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
#endif
|
||||
|
||||
#if LV_FONT_SUBPX_BGR
|
||||
res_color.ch.blue = (uint326_t)((uint32_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[0] * (255 - font_rgb[0]))) >> 8;
|
||||
res_color.ch.blue = (uint32_t)((uint32_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[0] * (255 - font_rgb[0]))) >> 8;
|
||||
res_color.ch.red = (uint32_t)((uint32_t)txt_rgb[2] * font_rgb[2] + (bg_rgb[2] * (255 - font_rgb[2]))) >> 8;
|
||||
#else
|
||||
res_color.ch.red = (uint32_t)((uint16_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[0] * (255 - font_rgb[0]))) >> 8;
|
||||
@ -742,6 +742,10 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
res_color.ch.green_l = green & 0x7;
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
res_color.ch.alpha = 0xff;
|
||||
#endif
|
||||
|
||||
if(font_rgb[0] == 0 && font_rgb[1] == 0 && font_rgb[2] == 0) mask_buf[mask_p] = LV_OPA_TRANSP;
|
||||
else mask_buf[mask_p] = LV_OPA_COVER;
|
||||
color_buf[mask_p] = res_color;
|
||||
@ -772,7 +776,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
}
|
||||
}
|
||||
|
||||
if((uint32_t) mask_p + (row_end - row_start) < mask_buf_size) {
|
||||
if((uint32_t) mask_p + (col_end - col_start) < mask_buf_size) {
|
||||
map_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
|
@ -496,10 +496,6 @@ bool lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
if(ys_int >= dsc->cfg.src_h) return false;
|
||||
else if(ys_int < 0) return false;
|
||||
|
||||
/* If the fractional < 0x70 mix the source pixel with the left/top pixel
|
||||
* If the fractional > 0x90 mix the source pixel with the right/bottom pixel
|
||||
* In the 0x70..0x90 range use the unchanged source pixel */
|
||||
|
||||
uint8_t px_size;
|
||||
uint32_t pxi;
|
||||
if(dsc->tmp.native_color) {
|
||||
|
@ -10,7 +10,14 @@
|
||||
#include "../lv_core/lv_refr.h"
|
||||
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
#include "stm32f7xx_hal.h"
|
||||
|
||||
#if defined(STM32F4)
|
||||
#include "stm32f4xx_hal.h"
|
||||
#elif defined(STM32F7)
|
||||
#include "stm32f7xx_hal.h"
|
||||
#else
|
||||
#error "Not supported STM32 family to use DMA2D"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -154,9 +161,6 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
|
||||
hdma2d.LayerCfg[1].InputAlpha = 0xFF;
|
||||
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_FORMAT;
|
||||
hdma2d.LayerCfg[1].InputOffset = map_w - copy_w;
|
||||
#ifndef STM32F746G_DISCO
|
||||
hdma2d.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA;
|
||||
#endif
|
||||
|
||||
/* DMA2D Initialization */
|
||||
HAL_DMA2D_Init(&hdma2d);
|
||||
@ -191,18 +195,12 @@ void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color
|
||||
hdma2d.LayerCfg[0].AlphaMode = DMA2D_NO_MODIF_ALPHA;
|
||||
hdma2d.LayerCfg[0].InputColorMode = DMA2D_INPUT_FORMAT;
|
||||
hdma2d.LayerCfg[0].InputOffset = buf_w - copy_w;
|
||||
#ifndef STM32F746G_DISCO
|
||||
hdma2d.LayerCfg[0].AlphaInverted = DMA2D_REGULAR_ALPHA;
|
||||
#endif
|
||||
|
||||
/* Foreground layer */
|
||||
hdma2d.LayerCfg[1].AlphaMode = DMA2D_COMBINE_ALPHA;
|
||||
hdma2d.LayerCfg[1].InputAlpha = opa;
|
||||
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_FORMAT;
|
||||
hdma2d.LayerCfg[1].InputOffset = map_w - copy_w;
|
||||
#ifndef STM32F746G_DISCO
|
||||
hdma2d.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA;
|
||||
#endif
|
||||
|
||||
/* DMA2D Initialization */
|
||||
HAL_DMA2D_Init(&hdma2d);
|
||||
|
@ -125,9 +125,9 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lv_memset_00(disp, sizeof(lv_disp_t));
|
||||
lv_memcpy(&disp->driver, driver, sizeof(lv_disp_drv_t));
|
||||
lv_memset_00(&disp->inv_area_joined, sizeof(disp->inv_area_joined));
|
||||
lv_memset_00(&disp->inv_areas, sizeof(disp->inv_areas));
|
||||
|
||||
lv_ll_init(&disp->scr_ll, sizeof(lv_obj_t));
|
||||
disp->last_activity_time = 0;
|
||||
|
||||
|
@ -34,6 +34,13 @@ typedef struct {
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static uint32_t lv_bidi_get_next_paragraph(const char * txt);
|
||||
static lv_bidi_dir_t lv_bidi_get_letter_dir(uint32_t letter);
|
||||
static bool lv_bidi_letter_is_weak(uint32_t letter);
|
||||
static bool lv_bidi_letter_is_rtl(uint32_t letter);
|
||||
static bool lv_bidi_letter_is_neutral(uint32_t letter);
|
||||
|
||||
static lv_bidi_dir_t get_next_run(const char * txt, lv_bidi_dir_t base_dir, uint32_t max_len, uint32_t * len,
|
||||
uint16_t * pos_conv_len);
|
||||
static void rtl_reverse(char * dest, const char * src, uint32_t len, uint16_t * pos_conv_out, uint16_t pos_conv_rd_base,
|
||||
@ -114,71 +121,6 @@ lv_bidi_dir_t lv_bidi_detect_base_dir(const char * txt)
|
||||
if(LV_BIDI_BASE_DIR_DEF == LV_BIDI_DIR_AUTO) return LV_BIDI_DIR_LTR;
|
||||
else return LV_BIDI_BASE_DIR_DEF;
|
||||
}
|
||||
/**
|
||||
* Get the direction of a character
|
||||
* @param letter an Unicode character
|
||||
* @return `LV_BIDI_DIR_RTL/LTR/WEAK/NEUTRAL`
|
||||
*/
|
||||
lv_bidi_dir_t lv_bidi_get_letter_dir(uint32_t letter)
|
||||
{
|
||||
if(lv_bidi_letter_is_rtl(letter)) return LV_BIDI_DIR_RTL;
|
||||
if(lv_bidi_letter_is_neutral(letter)) return LV_BIDI_DIR_NEUTRAL;
|
||||
if(lv_bidi_letter_is_weak(letter)) return LV_BIDI_DIR_WEAK;
|
||||
|
||||
return LV_BIDI_DIR_LTR;
|
||||
}
|
||||
/**
|
||||
* Tell whether a character is weak or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
bool lv_bidi_letter_is_weak(uint32_t letter)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
static const char weaks[] = "0123456789";
|
||||
|
||||
do {
|
||||
uint32_t x = lv_txt_encoded_next(weaks, &i);
|
||||
if(letter == x) {
|
||||
return true;
|
||||
}
|
||||
} while(weaks[i] != '\0');
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Tell whether a character is RTL or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
bool lv_bidi_letter_is_rtl(uint32_t letter)
|
||||
{
|
||||
if(letter >= 0x5d0 && letter <= 0x5ea) return true;
|
||||
if(letter == 0x202E) return true; /*Unicode of LV_BIDI_RLO*/
|
||||
|
||||
/* Check for Persian and Arabic characters [https://en.wikipedia.org/wiki/Arabic_script_in_Unicode]*/
|
||||
if(letter >= 0x600 && letter <= 0x6FF) return true;
|
||||
if(letter >= 0xFB50 && letter <= 0xFDFF) return true;
|
||||
if(letter >= 0xFE70 && letter <= 0xFEFF) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell whether a character is neutral or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
bool lv_bidi_letter_is_neutral(uint32_t letter)
|
||||
{
|
||||
uint16_t i;
|
||||
static const char neutrals[] = " \t\n\r.,:;'\"`!?%/\\-=()[]{}<>@#&$|";
|
||||
for(i = 0; neutrals[i] != '\0'; i++) {
|
||||
if(letter == (uint32_t)neutrals[i]) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the logical position of a character in a line
|
||||
@ -363,12 +305,16 @@ void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Get the next paragraph from a text
|
||||
* @param txt the text to process
|
||||
* @return the length of the current paragraph in byte count
|
||||
*/
|
||||
uint32_t lv_bidi_get_next_paragraph(const char * txt)
|
||||
static uint32_t lv_bidi_get_next_paragraph(const char * txt)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
|
||||
@ -381,9 +327,71 @@ uint32_t lv_bidi_get_next_paragraph(const char * txt)
|
||||
return i;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
/**
|
||||
* Get the direction of a character
|
||||
* @param letter an Unicode character
|
||||
* @return `LV_BIDI_DIR_RTL/LTR/WEAK/NEUTRAL`
|
||||
*/
|
||||
static lv_bidi_dir_t lv_bidi_get_letter_dir(uint32_t letter)
|
||||
{
|
||||
if(lv_bidi_letter_is_rtl(letter)) return LV_BIDI_DIR_RTL;
|
||||
if(lv_bidi_letter_is_neutral(letter)) return LV_BIDI_DIR_NEUTRAL;
|
||||
if(lv_bidi_letter_is_weak(letter)) return LV_BIDI_DIR_WEAK;
|
||||
|
||||
return LV_BIDI_DIR_LTR;
|
||||
}
|
||||
/**
|
||||
* Tell whether a character is weak or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
static bool lv_bidi_letter_is_weak(uint32_t letter)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
static const char weaks[] = "0123456789";
|
||||
|
||||
do {
|
||||
uint32_t x = lv_txt_encoded_next(weaks, &i);
|
||||
if(letter == x) {
|
||||
return true;
|
||||
}
|
||||
} while(weaks[i] != '\0');
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Tell whether a character is RTL or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
static bool lv_bidi_letter_is_rtl(uint32_t letter)
|
||||
{
|
||||
if(letter >= 0x5d0 && letter <= 0x5ea) return true;
|
||||
if(letter == 0x202E) return true; /*Unicode of LV_BIDI_RLO*/
|
||||
|
||||
/* Check for Persian and Arabic characters [https://en.wikipedia.org/wiki/Arabic_script_in_Unicode]*/
|
||||
if(letter >= 0x600 && letter <= 0x6FF) return true;
|
||||
if(letter >= 0xFB50 && letter <= 0xFDFF) return true;
|
||||
if(letter >= 0xFE70 && letter <= 0xFEFF) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell whether a character is neutral or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
static bool lv_bidi_letter_is_neutral(uint32_t letter)
|
||||
{
|
||||
uint16_t i;
|
||||
static const char neutrals[] = " \t\n\r.,:;'\"`!?%/\\-=()[]{}<>@#&$|";
|
||||
for(i = 0; neutrals[i] != '\0'; i++) {
|
||||
if(letter == (uint32_t)neutrals[i]) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static uint32_t get_txt_len(const char * txt, uint32_t max_len)
|
||||
{
|
||||
|
@ -63,34 +63,6 @@ void lv_bidi_process(const char * str_in, char * str_out, lv_bidi_dir_t base_dir
|
||||
*/
|
||||
lv_bidi_dir_t lv_bidi_detect_base_dir(const char * txt);
|
||||
|
||||
/**
|
||||
* Get the direction of a character
|
||||
* @param letter an Unicode character
|
||||
* @return `LV_BIDI_DIR_RTL/LTR/WEAK/NEUTRAL`
|
||||
*/
|
||||
lv_bidi_dir_t lv_bidi_get_letter_dir(uint32_t letter);
|
||||
|
||||
/**
|
||||
* Tell whether a character is weak or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
bool lv_bidi_letter_is_weak(uint32_t letter);
|
||||
|
||||
/**
|
||||
* Tell whether a character is RTL or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
bool lv_bidi_letter_is_rtl(uint32_t letter);
|
||||
|
||||
/**
|
||||
* Tell whether a character is neutral or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
bool lv_bidi_letter_is_neutral(uint32_t letter);
|
||||
|
||||
/**
|
||||
* Get the logical position of a character in a line
|
||||
* @param str_in the input string. Can be only one line.
|
||||
@ -134,13 +106,6 @@ uint16_t lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t
|
||||
void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_bidi_dir_t base_dir,
|
||||
uint16_t * pos_conv_out, uint16_t pos_conv_len);
|
||||
|
||||
/**
|
||||
* Get the next paragraph from a text
|
||||
* @param txt the text to process
|
||||
* @return the length of the current paragraph in byte count
|
||||
*/
|
||||
uint32_t lv_bidi_get_next_paragraph(const char * txt);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
@ -213,6 +213,26 @@ uint16_t lv_atan2(int x, int y)
|
||||
return degree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the integer exponents.
|
||||
* @param base
|
||||
* @param power
|
||||
* @return base raised to the power exponent
|
||||
*/
|
||||
int64_t lv_pow(int64_t base, int8_t exp)
|
||||
{
|
||||
int64_t result = 1;
|
||||
while (exp)
|
||||
{
|
||||
if (exp & 1)
|
||||
result *= base;
|
||||
exp >>= 1;
|
||||
base *= base;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
@ -96,6 +96,14 @@ uint16_t lv_atan2(int x, int y);
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask);
|
||||
|
||||
/**
|
||||
* Calculate the integer exponents.
|
||||
* @param base
|
||||
* @param power
|
||||
* @return base raised to the power exponent
|
||||
*/
|
||||
int64_t lv_pow(int64_t base, int8_t exp);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
@ -66,6 +66,8 @@ typedef struct {
|
||||
#define ALIGN_MASK 0x3
|
||||
#endif
|
||||
|
||||
#define MEM_BUF_SMALL_SIZE 16
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
@ -84,6 +86,13 @@ typedef struct {
|
||||
|
||||
static uint32_t zero_mem; /*Give the address of this variable if 0 byte should be allocated*/
|
||||
|
||||
|
||||
static uint8_t mem_buf1_32[MEM_BUF_SMALL_SIZE];
|
||||
static uint8_t mem_buf2_32[MEM_BUF_SMALL_SIZE];
|
||||
|
||||
static lv_mem_buf_t mem_buf_small[] = {{.p = mem_buf1_32, .size = MEM_BUF_SMALL_SIZE, .used = 0},
|
||||
{.p = mem_buf2_32, .size = MEM_BUF_SMALL_SIZE, .used = 0}};
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@ -472,15 +481,41 @@ void * lv_mem_buf_get(uint32_t size)
|
||||
{
|
||||
if(size == 0) return NULL;
|
||||
|
||||
/*Try to find a free buffer with suitable size */
|
||||
/*Try small static buffers first*/
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) {
|
||||
if(LV_GC_ROOT(_lv_mem_buf[i]).used == 0 && LV_GC_ROOT(_lv_mem_buf[i]).size >= size) {
|
||||
LV_GC_ROOT(_lv_mem_buf[i]).used = 1;
|
||||
return LV_GC_ROOT(_lv_mem_buf[i]).p;
|
||||
if(size <= MEM_BUF_SMALL_SIZE) {
|
||||
for(i = 0; i < sizeof(mem_buf_small) / sizeof(mem_buf_small[0]); i++) {
|
||||
if(mem_buf_small[i].used == 0) {
|
||||
mem_buf_small[i].used = 1;
|
||||
return mem_buf_small[i].p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Try to find a free buffer with suitable size */
|
||||
int8_t i_guess = -1;
|
||||
for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) {
|
||||
if(LV_GC_ROOT(_lv_mem_buf[i]).used == 0 && LV_GC_ROOT(_lv_mem_buf[i]).size >= size) {
|
||||
if(LV_GC_ROOT(_lv_mem_buf[i]).size == size) {
|
||||
LV_GC_ROOT(_lv_mem_buf[i]).used = 1;
|
||||
return LV_GC_ROOT(_lv_mem_buf[i]).p;
|
||||
}
|
||||
else if(i_guess < 0) {
|
||||
i_guess = i;
|
||||
}
|
||||
/*If size of `i` is closer to `size` prefer it*/
|
||||
else if(LV_GC_ROOT(_lv_mem_buf[i]).size < LV_GC_ROOT(_lv_mem_buf[i_guess]).size) {
|
||||
i_guess = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(i_guess >= 0) {
|
||||
LV_GC_ROOT(_lv_mem_buf[i_guess]).used = 1;
|
||||
return LV_GC_ROOT(_lv_mem_buf[i_guess]).p;
|
||||
}
|
||||
|
||||
|
||||
/*Reallocate a free buffer*/
|
||||
for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) {
|
||||
if(LV_GC_ROOT(_lv_mem_buf[i]).used == 0) {
|
||||
@ -507,6 +542,15 @@ void * lv_mem_buf_get(uint32_t size)
|
||||
void lv_mem_buf_release(void * p)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
/*Try small static buffers first*/
|
||||
for(i = 0; i < sizeof(mem_buf_small) / sizeof(mem_buf_small[0]); i++) {
|
||||
if(mem_buf_small[i].p == p) {
|
||||
mem_buf_small[i].used = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) {
|
||||
if(LV_GC_ROOT(_lv_mem_buf[i]).p == p) {
|
||||
LV_GC_ROOT(_lv_mem_buf[i]).used = 0;
|
||||
@ -523,6 +567,10 @@ void lv_mem_buf_release(void * p)
|
||||
void lv_mem_buf_free_all(void)
|
||||
{
|
||||
uint8_t i;
|
||||
for(i = 0; i < sizeof(mem_buf_small) / sizeof(mem_buf_small[0]); i++) {
|
||||
mem_buf_small[i].used = 0;
|
||||
}
|
||||
|
||||
for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) {
|
||||
if(LV_GC_ROOT(_lv_mem_buf[i]).p) {
|
||||
lv_mem_free(LV_GC_ROOT(_lv_mem_buf[i]).p);
|
||||
|
@ -14,7 +14,6 @@ extern "C" {
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stddef.h>
|
||||
#include "lv_bidi.h"
|
||||
#include "lv_txt.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
|
||||
|
@ -209,11 +209,11 @@ static void basic_init(void)
|
||||
lv_style_set_image_recolor(&bg, LV_STATE_DEFAULT, COLOR_BG_TEXT);
|
||||
lv_style_set_line_color(&bg, LV_STATE_DEFAULT, COLOR_BG_TEXT);
|
||||
lv_style_set_line_width(&bg, LV_STATE_DEFAULT, 1);
|
||||
lv_style_set_pad_left(&bg, LV_STATE_DEFAULT, LV_DPX(20) + BORDER_WIDTH);
|
||||
lv_style_set_pad_right(&bg, LV_STATE_DEFAULT, LV_DPX(20) + BORDER_WIDTH);
|
||||
lv_style_set_pad_top(&bg, LV_STATE_DEFAULT, LV_DPX(20) + BORDER_WIDTH);
|
||||
lv_style_set_pad_bottom(&bg, LV_STATE_DEFAULT, LV_DPX(20) + BORDER_WIDTH);
|
||||
lv_style_set_pad_inner(&bg, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&bg, LV_STATE_DEFAULT, LV_DPX(15) + BORDER_WIDTH);
|
||||
lv_style_set_pad_right(&bg, LV_STATE_DEFAULT, LV_DPX(15) + BORDER_WIDTH);
|
||||
lv_style_set_pad_top(&bg, LV_STATE_DEFAULT, LV_DPX(15) + BORDER_WIDTH);
|
||||
lv_style_set_pad_bottom(&bg, LV_STATE_DEFAULT, LV_DPX(15) + BORDER_WIDTH);
|
||||
lv_style_set_pad_inner(&bg, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_transition_time(&bg, LV_STATE_DEFAULT, TRANSITION_TIME);
|
||||
lv_style_set_transition_prop_6(&bg, LV_STATE_DEFAULT, LV_STYLE_BORDER_COLOR);
|
||||
|
||||
@ -393,10 +393,10 @@ static void slider_init(void)
|
||||
lv_style_set_bg_color(&slider_knob, LV_STATE_DEFAULT, IS_LIGHT ? theme.color_primary : LV_COLOR_WHITE);
|
||||
lv_style_set_value_color(&slider_knob, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x31404f) : LV_COLOR_WHITE);
|
||||
lv_style_set_radius(&slider_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
lv_style_set_pad_left(&slider_knob, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_right(&slider_knob, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_top(&slider_knob, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_bottom(&slider_knob, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_left(&slider_knob, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
lv_style_set_pad_right(&slider_knob, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
lv_style_set_pad_top(&slider_knob, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
lv_style_set_pad_bottom(&slider_knob, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
|
||||
style_init_reset(&slider_bg);
|
||||
lv_style_set_margin_left(&slider_bg, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
@ -414,10 +414,10 @@ static void switch_init(void)
|
||||
lv_style_set_bg_opa(&sw_knob, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&sw_knob, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
||||
lv_style_set_radius(&sw_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
lv_style_set_pad_top(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(8));
|
||||
lv_style_set_pad_bottom(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(8));
|
||||
lv_style_set_pad_left(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(8));
|
||||
lv_style_set_pad_right(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(8));
|
||||
lv_style_set_pad_top(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(4));
|
||||
lv_style_set_pad_bottom(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(4));
|
||||
lv_style_set_pad_left(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(4));
|
||||
lv_style_set_pad_right(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(4));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -454,7 +454,7 @@ static void gauge_init(void)
|
||||
lv_style_set_pad_right(&gauge_main, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_top(&gauge_main, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_inner(&gauge_main, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_scale_width(&gauge_main, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_scale_width(&gauge_main, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_radius(&gauge_main, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
|
||||
style_init_reset(&gauge_strong);
|
||||
@ -463,7 +463,7 @@ static void gauge_init(void)
|
||||
lv_style_set_scale_end_color(&gauge_strong, LV_STATE_DEFAULT, theme.color_primary);
|
||||
lv_style_set_line_width(&gauge_strong, LV_STATE_DEFAULT, LV_DPX(8));
|
||||
lv_style_set_scale_end_line_width(&gauge_strong, LV_STATE_DEFAULT, LV_DPX(8));
|
||||
lv_style_set_scale_width(&gauge_strong, LV_STATE_DEFAULT, LV_DPX(30));
|
||||
lv_style_set_scale_width(&gauge_strong, LV_STATE_DEFAULT, LV_DPX(25));
|
||||
|
||||
style_init_reset(&gauge_needle);
|
||||
lv_style_set_line_color(&gauge_needle, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x464b5b) : LV_COLOR_WHITE);
|
||||
@ -510,8 +510,8 @@ static void chart_init(void)
|
||||
lv_style_set_line_color(&chart_series_bg, LV_STATE_DEFAULT, COLOR_BG_BORDER);
|
||||
|
||||
style_init_reset(&chart_series);
|
||||
lv_style_set_line_width(&chart_series, LV_STATE_DEFAULT, LV_DPX(4));
|
||||
lv_style_set_size(&chart_series, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_line_width(&chart_series, LV_STATE_DEFAULT, LV_DPX(3));
|
||||
lv_style_set_size(&chart_series, LV_STATE_DEFAULT, LV_DPX(4));
|
||||
lv_style_set_pad_inner(&chart_series, LV_STATE_DEFAULT, LV_DPX(2)); /*Space between columns*/
|
||||
lv_style_set_radius(&chart_series, LV_STATE_DEFAULT, LV_DPX(1));
|
||||
|
||||
@ -523,17 +523,17 @@ static void calendar_init(void)
|
||||
#if LV_USE_CALENDAR
|
||||
|
||||
style_init_reset(&calendar_header);
|
||||
lv_style_set_pad_top(&calendar_header, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&calendar_header, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_right(&calendar_header, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_bottom(&calendar_header, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_top(&calendar_header, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_left(&calendar_header, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_right(&calendar_header, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_bottom(&calendar_header, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_text_color(&calendar_header, LV_STATE_PRESSED, IS_LIGHT ? lv_color_hex(0x888888) : LV_COLOR_WHITE);
|
||||
|
||||
style_init_reset(&calendar_daynames);
|
||||
lv_style_set_text_color(&calendar_daynames, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x31404f) : lv_color_hex3(0xeee));
|
||||
lv_style_set_pad_left(&calendar_daynames, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_right(&calendar_daynames, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_bottom(&calendar_daynames, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&calendar_daynames, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_right(&calendar_daynames, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_bottom(&calendar_daynames, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
|
||||
style_init_reset(&calendar_date_nums);
|
||||
lv_style_set_radius(&calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(4));
|
||||
@ -550,9 +550,9 @@ static void calendar_init(void)
|
||||
lv_style_set_border_side(&calendar_date_nums, LV_STATE_CHECKED, LV_BORDER_SIDE_LEFT);
|
||||
lv_style_set_border_color(&calendar_date_nums, LV_STATE_CHECKED, theme.color_primary);
|
||||
lv_style_set_pad_inner(&calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(3));
|
||||
lv_style_set_pad_left(&calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_right(&calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_bottom(&calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_right(&calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_bottom(&calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -617,11 +617,11 @@ static void keyboard_init(void)
|
||||
lv_style_set_border_side(&kb_bg, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP);
|
||||
lv_style_set_border_color(&kb_bg, LV_STATE_DEFAULT, IS_LIGHT ? COLOR_BG_TEXT : LV_COLOR_BLACK);
|
||||
lv_style_set_border_color(&kb_bg, LV_STATE_EDITED, theme.color_secondary);
|
||||
lv_style_set_pad_left(&kb_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_right(&kb_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_top(&kb_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_bottom(&kb_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_inner(&kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_pad_left(&kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_pad_right(&kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_pad_top(&kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_pad_bottom(&kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_pad_inner(&kb_bg, LV_STATE_DEFAULT, LV_DPX(3));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -714,13 +714,13 @@ static void list_init(void)
|
||||
lv_style_set_border_color(&list_btn, LV_STATE_FOCUSED, theme.color_primary);
|
||||
lv_style_set_border_width(&list_btn, LV_STATE_DEFAULT, 1);
|
||||
|
||||
lv_style_set_pad_left(&list_btn, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_right(&list_btn, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_top(&list_btn, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_bottom(&list_btn, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_inner(&list_btn, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&list_btn, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_right(&list_btn, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_top(&list_btn, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_bottom(&list_btn, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_inner(&list_btn, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
|
||||
lv_style_set_transform_width(&list_btn, LV_STATE_DEFAULT, - LV_DPX(20));
|
||||
lv_style_set_transform_width(&list_btn, LV_STATE_DEFAULT, - LV_DPX(15));
|
||||
lv_style_set_transform_width(&list_btn, LV_STATE_PRESSED, 0);
|
||||
lv_style_set_transform_width(&list_btn, LV_STATE_CHECKED, 0);
|
||||
lv_style_set_transform_width(&list_btn, LV_STATE_DISABLED, 0);
|
||||
@ -794,11 +794,11 @@ static void tabview_init(void)
|
||||
lv_style_set_radius(&tabview_indic, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
|
||||
style_init_reset(&tabview_page_scrl);
|
||||
lv_style_set_pad_top(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_bottom(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_right(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_inner(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_top(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_bottom(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_left(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_right(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_inner(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -815,10 +815,10 @@ static void table_init(void)
|
||||
lv_style_set_border_color(&table_cell, LV_STATE_DEFAULT, COLOR_BG_BORDER);
|
||||
lv_style_set_border_width(&table_cell, LV_STATE_DEFAULT, 1);
|
||||
lv_style_set_border_side(&table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM);
|
||||
lv_style_set_pad_left(&table_cell, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_right(&table_cell, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_top(&table_cell, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_bottom(&table_cell, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&table_cell, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_right(&table_cell, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_top(&table_cell, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_pad_bottom(&table_cell, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
|
||||
#endif
|
||||
}
|
||||
@ -1228,8 +1228,8 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &ddlist_page);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCRLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &sb);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
@ -1408,7 +1408,6 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
lv_obj_refresh_style(obj, LV_STYLE_PROP_ALL);
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ static lv_theme_t theme;
|
||||
|
||||
static lv_style_t style_scr;
|
||||
static lv_style_t style_bg;
|
||||
static lv_style_t style_clip_corner;
|
||||
static lv_style_t style_btn;
|
||||
static lv_style_t style_round;
|
||||
static lv_style_t style_no_radius;
|
||||
@ -123,6 +124,10 @@ static void basic_init(void)
|
||||
lv_style_set_pad_bottom(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10);
|
||||
lv_style_set_pad_inner(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10);
|
||||
|
||||
lv_style_init(&style_clip_corner);
|
||||
lv_style_set_clip_corner(&style_clip_corner, LV_STATE_DEFAULT, true);
|
||||
|
||||
|
||||
lv_style_init(&style_btn);
|
||||
lv_style_set_radius(&style_btn, LV_STATE_DEFAULT, RADIUS);
|
||||
lv_style_set_border_width(&style_btn, LV_STATE_DEFAULT, BORDER_WIDTH);
|
||||
@ -846,6 +851,7 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_pad_none);
|
||||
lv_style_list_add_style(list, &style_clip_corner);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||
|
||||
@ -876,8 +882,8 @@ static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_big_line_space);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCRLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &style_sb);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
|
@ -727,8 +727,8 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCRLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "../lv_misc/lv_area.h"
|
||||
#include "../lv_misc/lv_color.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_misc/lv_bidi.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
@ -867,7 +867,7 @@ static lv_res_t lv_dropdown_signal(lv_obj_t * ddlist, lv_signal_t sign, void * p
|
||||
else if(sign == LV_SIGNAL_GET_STATE_DSC) {
|
||||
lv_get_state_info_t * info = param;
|
||||
if(info->part == LV_DROPDOWN_PART_LIST ||
|
||||
info->part == LV_DROPDOWN_PART_SCRLBAR ||
|
||||
info->part == LV_DROPDOWN_PART_SCROLLBAR ||
|
||||
info->part == LV_DROPDOWN_PART_SELECTED) {
|
||||
info->result = lv_obj_get_state(ext->page, LV_PAGE_PART_BG);
|
||||
}
|
||||
@ -1085,7 +1085,7 @@ static lv_style_list_t * lv_dropdown_get_style(lv_obj_t * ddlist, uint8_t part)
|
||||
case LV_DROPDOWN_PART_LIST:
|
||||
style_dsc_p = &ext->style_page;
|
||||
break;
|
||||
case LV_DROPDOWN_PART_SCRLBAR:
|
||||
case LV_DROPDOWN_PART_SCROLLBAR:
|
||||
style_dsc_p = &ext->style_scrlbar;
|
||||
break;
|
||||
case LV_DROPDOWN_PART_SELECTED:
|
||||
|
@ -70,7 +70,7 @@ typedef struct {
|
||||
enum {
|
||||
LV_DROPDOWN_PART_MAIN = LV_OBJ_PART_MAIN,
|
||||
LV_DROPDOWN_PART_LIST = _LV_OBJ_PART_REAL_LAST,
|
||||
LV_DROPDOWN_PART_SCRLBAR,
|
||||
LV_DROPDOWN_PART_SCROLLBAR,
|
||||
LV_DROPDOWN_PART_SELECTED,
|
||||
};
|
||||
typedef uint8_t lv_dropdown_part_t;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "../lv_misc/lv_color.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_misc/lv_bidi.h"
|
||||
#include "../lv_misc/lv_txt_ap.h"
|
||||
#include "../lv_misc/lv_printf.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
|
||||
|
@ -331,10 +331,11 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
|
||||
|
||||
if(w >= h) {
|
||||
lv_coord_t indic_w = w - bg_left - bg_right;
|
||||
if(base_dir == LV_BIDI_DIR_RTL)
|
||||
if(base_dir == LV_BIDI_DIR_RTL) {
|
||||
new_value = (slider->coords.x2 - bg_right) - p.x; /*Make the point relative to the indicator*/
|
||||
else
|
||||
} else {
|
||||
new_value = p.x - (slider->coords.x1 + bg_left); /*Make the point relative to the indicator*/
|
||||
}
|
||||
new_value = (new_value * range) / indic_w;
|
||||
new_value += ext->bar.min_value;
|
||||
}
|
||||
|
@ -173,6 +173,13 @@ void lv_spinbox_set_digit_format(lv_obj_t * spinbox, uint8_t digit_count, uint8_
|
||||
if(separator_position >= digit_count) separator_position = 0;
|
||||
if(separator_position > LV_SPINBOX_MAX_DIGIT_COUNT) separator_position = LV_SPINBOX_MAX_DIGIT_COUNT;
|
||||
|
||||
if(digit_count < LV_SPINBOX_MAX_DIGIT_COUNT)
|
||||
{
|
||||
uint64_t max_val = lv_pow(10, digit_count);
|
||||
if(ext->range_max > max_val - 1) ext->range_max = max_val - 1;
|
||||
if(ext->range_min < - max_val + 1) ext->range_min = - max_val + 1;
|
||||
}
|
||||
|
||||
ext->digit_count = digit_count;
|
||||
ext->dec_point_pos = separator_position;
|
||||
|
||||
|
@ -28,7 +28,7 @@ extern "C" {
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_SPINBOX_MAX_DIGIT_COUNT 16
|
||||
#define LV_SPINBOX_MAX_DIGIT_COUNT 10
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
|
@ -90,7 +90,7 @@ lv_obj_t * lv_switch_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_click(sw, true);
|
||||
lv_obj_add_protect(sw, LV_PROTECT_PRESS_LOST);
|
||||
lv_obj_set_size(sw, LV_DPX(70), LV_DPX(40));
|
||||
lv_obj_set_size(sw, LV_DPX(60), LV_DPX(35));
|
||||
lv_bar_set_range(sw, 0, 1);
|
||||
|
||||
lv_theme_apply(sw, LV_THEME_SWITCH);
|
||||
|
Loading…
x
Reference in New Issue
Block a user