refactor: disp->display, res->result/resolution, hor/ver->horizontal/vertical, txt->text, angle->rotation, zoom->scale

This commit is contained in:
Gabor Kiss-Vamosi
2023-09-18 22:57:30 +02:00
parent 57a83cb2ad
commit 0721884ee9
202 changed files with 1894 additions and 1814 deletions
+2 -2
View File
@@ -1026,8 +1026,8 @@ menu "LVGL configuration"
config LV_USE_BMP
bool "BMP decoder library"
config LV_USE_SJPG
bool "JPG + split JPG decoder library"
config LV_USE_JPG
bool "JPG decoder library"
config LV_USE_GIF
bool "GIF decoder library"
+25 -25
View File
@@ -9,7 +9,7 @@
#include "lv_demo_benchmark.h"
#if LV_USE_DEMO_BENCHMARK
#include "../../src/disp/lv_disp_private.h"
#include "../../src/display/lv_display_private.h"
/*********************
* DEFINES
@@ -74,7 +74,7 @@ static lv_style_t style_common;
static bool scene_with_opa = true;
static uint32_t last_flush_cb_call;
static uint32_t render_start_time;
static void (*flush_cb_ori)(lv_disp_t *, const lv_area_t *, uint8_t *);
static void (*flush_cb_ori)(lv_display_t *, const lv_area_t *, uint8_t *);
static uint32_t disp_ori_timer_period;
static uint32_t anim_ori_timer_period;
@@ -100,10 +100,10 @@ static void benchmark_event_remove(void);
static void show_scene_report(void);
static void calc_scene_statistics(void);
static lv_res_t load_next_scene(void);
static lv_result_t load_next_scene(void);
static void next_scene_timer_cb(lv_timer_t * timer);
static void single_scene_finsih_timer_cb(lv_timer_t * timer);
static void dummy_flush_cb(lv_disp_t * drv, const lv_area_t * area, uint8_t * pxmap);
static void dummy_flush_cb(lv_display_t * drv, const lv_area_t * area, uint8_t * pxmap);
static void generate_report(void);
static void rect_create(lv_style_t * style);
@@ -666,7 +666,7 @@ void lv_demo_benchmark(lv_demo_benchmark_mode_t _mode)
benchmark_init();
if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_ONLY) {
while(load_next_scene() == LV_RES_OK) {
while(load_next_scene() == LV_RESULT_OK) {
uint32_t i;
for(i = 0; i < RENDER_REPEAT_CNT; i++) {
/*Wait a little to be sure something happens with the animations*/
@@ -733,9 +733,9 @@ void lv_demo_benchmark_run_scene(lv_demo_benchmark_mode_t _mode, uint16_t scene_
static void benchmark_init(void)
{
lv_disp_t * disp = lv_disp_get_default();
lv_display_t * disp = lv_display_get_default();
lv_disp_add_event(disp, benchmark_event_cb, LV_EVENT_ALL, NULL);
lv_display_add_event(disp, benchmark_event_cb, LV_EVENT_ALL, NULL);
flush_cb_ori = disp->flush_cb;
disp->flush_cb = dummy_flush_cb;
@@ -785,12 +785,12 @@ static void benchmark_event_cb(lv_event_t * e)
static void benchmark_event_remove(void)
{
lv_disp_t * disp = lv_disp_get_default();
lv_display_t * disp = lv_display_get_default();
uint32_t i;
for(i = 0; i < lv_disp_get_event_count(disp); i++) {
lv_event_dsc_t * dsc = lv_disp_get_event_dsc(disp, i);
for(i = 0; i < lv_display_get_event_count(disp); i++) {
lv_event_dsc_t * dsc = lv_display_get_event_dsc(disp, i);
if(lv_event_dsc_get_cb(dsc) == benchmark_event_cb) {
lv_disp_remove_event(disp, i);
lv_display_remove_event(disp, i);
return;
}
}
@@ -827,9 +827,9 @@ static void calc_scene_statistics(void)
}
}
static lv_res_t load_next_scene(void)
static lv_result_t load_next_scene(void)
{
if(scene_act >= 0 && scenes[scene_act].create_cb == NULL) return LV_RES_INV;
if(scene_act >= 0 && scenes[scene_act].create_cb == NULL) return LV_RESULT_INVALID;
lv_obj_clean(scene_bg);
@@ -841,14 +841,14 @@ static lv_res_t load_next_scene(void)
scene_with_opa = true;
}
if(scene_act >= 0 && scenes[scene_act].create_cb == NULL) return LV_RES_INV;
if(scene_act >= 0 && scenes[scene_act].create_cb == NULL) return LV_RESULT_INVALID;
last_flush_cb_call = 0;
rnd_reset();
scenes[scene_act].create_cb();
lv_label_set_text_fmt(title, "%s%s", scenes[scene_act].name, scene_with_opa ? " + opa" : "");
return LV_RES_OK;
return LV_RESULT_OK;
}
static void next_scene_timer_cb(lv_timer_t * timer)
@@ -857,9 +857,9 @@ static void next_scene_timer_cb(lv_timer_t * timer)
calc_scene_statistics();
show_scene_report();
lv_res_t res = load_next_scene();
lv_result_t res = load_next_scene();
if(res == LV_RES_INV) {
if(res == LV_RESULT_INVALID) {
lv_timer_del(timer);
generate_report();
}
@@ -870,7 +870,7 @@ static void single_scene_finsih_timer_cb(lv_timer_t * timer)
LV_UNUSED(timer);
calc_scene_statistics();
lv_disp_t * disp = lv_disp_get_default();
lv_display_t * disp = lv_display_get_default();
disp->flush_cb = flush_cb_ori;
if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_ONLY) {
@@ -886,13 +886,13 @@ static void single_scene_finsih_timer_cb(lv_timer_t * timer)
lv_obj_invalidate(lv_scr_act());
}
static void dummy_flush_cb(lv_disp_t * drv, const lv_area_t * area, uint8_t * pxmap)
static void dummy_flush_cb(lv_display_t * drv, const lv_area_t * area, uint8_t * pxmap)
{
LV_UNUSED(area);
if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_AND_DRIVER) {
/*Measure the time since render start after flushing*/
bool last = lv_disp_flush_is_last(drv);
bool last = lv_display_flush_is_last(drv);
flush_cb_ori(drv, area, pxmap);
if(last) {
@@ -908,7 +908,7 @@ static void dummy_flush_cb(lv_disp_t * drv, const lv_area_t * area, uint8_t * px
}
}
else if(mode == LV_DEMO_BENCHMARK_MODE_REAL) {
bool last = lv_disp_flush_is_last(drv);
bool last = lv_display_flush_is_last(drv);
flush_cb_ori(drv, area, pxmap);
/*Measure the time since the previous last flush (full render)*/
@@ -929,10 +929,10 @@ static void dummy_flush_cb(lv_disp_t * drv, const lv_area_t * area, uint8_t * px
}
}
else if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_ONLY) {
bool last = lv_disp_flush_is_last(drv);
bool last = lv_display_flush_is_last(drv);
/*Just bypass the driver and measure the pure rendering time*/
lv_disp_flush_ready(drv);
lv_display_flush_ready(drv);
if(last) {
uint32_t t = lv_tick_elaps(render_start_time);
@@ -950,7 +950,7 @@ static void dummy_flush_cb(lv_disp_t * drv, const lv_area_t * area, uint8_t * px
static void generate_report(void)
{
lv_disp_t * disp = lv_disp_get_default();
lv_display_t * disp = lv_display_get_default();
disp->flush_cb = flush_cb_ori;
if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_ONLY) {
@@ -1114,7 +1114,7 @@ static void img_create(lv_style_t * style, const void * src, bool rotate, bool z
lv_image_set_src(obj, src);
lv_obj_set_style_image_recolor(obj, lv_color_hex(rnd_next(0, 0xFFFFF0)), 0);
if(rotate) lv_image_set_angle(obj, rnd_next(0, 3599));
if(rotate) lv_image_set_rotation(obj, rnd_next(0, 3599));
if(zoom) lv_image_set_zoom(obj, rnd_next(IMG_ZOOM_MIN, IMG_ZOOM_MAX));
lv_image_set_antialias(obj, aa);
+2 -2
View File
@@ -249,8 +249,8 @@ static void inactive_timer_cb(lv_timer_t * t)
return;
}
if(lv_disp_get_inactive_time(NULL) > 8000) {
lv_disp_trig_activity(NULL);
if(lv_display_get_inactive_time(NULL) > 8000) {
lv_display_trig_activity(NULL);
lv_obj_scroll_by(cont, 100, 0, LV_ANIM_ON);
lv_obj_add_flag(lv_layer_top(), LV_OBJ_FLAG_CLICKABLE);
scrolled = true;
+6 -6
View File
@@ -281,7 +281,7 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
lv_anim_set_var(&a, album_image_obj);
lv_anim_set_time(&a, 1000);
lv_anim_set_delay(&a, INTRO_TIME + 1000);
lv_anim_set_values(&a, 1, LV_ZOOM_NONE);
lv_anim_set_values(&a, 1, LV_SCALE_NONE);
lv_anim_set_exec_cb(&a, _image_set_zoom_anim_cb);
lv_anim_set_ready_cb(&a, NULL);
lv_anim_start(&a);
@@ -305,7 +305,7 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
lv_anim_set_var(&a, logo);
lv_anim_set_time(&a, 400);
lv_anim_set_delay(&a, INTRO_TIME + 800);
lv_anim_set_values(&a, LV_ZOOM_NONE, 10);
lv_anim_set_values(&a, LV_SCALE_NONE, 10);
lv_anim_set_ready_cb(&a, lv_obj_del_anim_ready_cb);
lv_anim_start(&a);
@@ -373,7 +373,7 @@ void _lv_demo_music_pause(void)
spectrum_i = 0;
lv_anim_del(spectrum_obj, spectrum_anim_cb);
lv_obj_invalidate(spectrum_obj);
lv_image_set_zoom(album_image_obj, LV_ZOOM_NONE);
lv_image_set_zoom(album_image_obj, LV_SCALE_NONE);
if(sec_counter_timer) lv_timer_pause(sec_counter_timer);
lv_obj_clear_state(play_obj, LV_STATE_CHECKED);
}
@@ -720,7 +720,7 @@ static void track_load(uint32_t id)
lv_anim_set_path_cb(&a, lv_anim_path_linear);
lv_anim_set_var(&a, album_image_obj);
lv_anim_set_time(&a, 500);
lv_anim_set_values(&a, LV_ZOOM_NONE, LV_ZOOM_NONE / 2);
lv_anim_set_values(&a, LV_SCALE_NONE, LV_SCALE_NONE / 2);
lv_anim_set_exec_cb(&a, _image_set_zoom_anim_cb);
lv_anim_set_ready_cb(&a, NULL);
lv_anim_start(&a);
@@ -731,7 +731,7 @@ static void track_load(uint32_t id)
lv_anim_set_var(&a, album_image_obj);
lv_anim_set_time(&a, 500);
lv_anim_set_delay(&a, 100);
lv_anim_set_values(&a, LV_ZOOM_NONE / 4, LV_ZOOM_NONE);
lv_anim_set_values(&a, LV_SCALE_NONE / 4, LV_SCALE_NONE);
lv_anim_set_exec_cb(&a, _image_set_zoom_anim_cb);
lv_anim_set_ready_cb(&a, NULL);
lv_anim_start(&a);
@@ -924,7 +924,7 @@ static void spectrum_anim_cb(void * a, int32_t v)
}
if(spectrum[spectrum_i][0] < 4) bar_rot += dir;
lv_image_set_zoom(album_image_obj, LV_ZOOM_NONE + spectrum[spectrum_i][0]);
lv_image_set_zoom(album_image_obj, LV_SCALE_NONE + spectrum[spectrum_i][0]);
}
static void start_anim_cb(void * a, int32_t v)
+2 -2
View File
@@ -62,8 +62,8 @@ static void obj_test_task_cb(lv_timer_t * tmr)
switch(state) {
case -1: {
lv_res_t res = lv_mem_test();
if(res != LV_RES_OK) {
lv_result_t res = lv_mem_test();
if(res != LV_RESULT_OK) {
LV_LOG_ERROR("Memory integrity error");
}
+3 -3
View File
@@ -87,7 +87,7 @@ void lv_demo_transform(void)
card_to_transform = card_create();
lv_obj_center(card_to_transform);
lv_coord_t disp_w = lv_disp_get_hor_res(NULL);
lv_coord_t disp_w = lv_display_get_horizontal_resolution(NULL);
lv_obj_t * arc = lv_arc_create(lv_scr_act());
lv_obj_set_size(arc, disp_w - 20, disp_w - 20);
lv_arc_set_range(arc, 0, 270);
@@ -148,14 +148,14 @@ static void arc_event_cb(lv_event_t * e)
lv_obj_t * arc = lv_event_get_target(e);
int32_t v = lv_arc_get_angle_end(arc);
lv_obj_set_style_transform_angle(card_to_transform, v * 10, 0);
lv_obj_set_style_transform_rotation(card_to_transform, v * 10, 0);
}
static void slider_event_cb(lv_event_t * e)
{
lv_obj_t * slider = lv_event_get_target(e);
int32_t v = lv_slider_get_value(slider);
lv_obj_set_style_transform_zoom(card_to_transform, v, 0);
lv_obj_set_style_transform_scale(card_to_transform, v, 0);
}
#endif
+2 -2
View File
@@ -1284,7 +1284,7 @@ static void slider_event_cb(lv_event_t * e)
lv_snprintf(buf, sizeof(buf), "%"LV_PRId32, lv_slider_get_value(obj));
lv_point_t text_size;
lv_txt_get_size(&text_size, buf, font_normal, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE);
lv_text_get_size(&text_size, buf, font_normal, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE);
lv_area_t txt_area;
txt_area.x1 = draw_task->area.x1 + lv_area_get_width(&draw_task->area) / 2 - text_size.x / 2;
@@ -1437,7 +1437,7 @@ static void chart_event_cb(lv_event_t * e)
lv_snprintf(buf, sizeof(buf), "%"LV_PRIu32, ser->y_points[base_dsc->id2]);
lv_point_t text_size;
lv_txt_get_size(&text_size, buf, font_normal, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE);
lv_text_get_size(&text_size, buf, font_normal, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE);
lv_area_t txt_area;
if(lv_chart_get_type(obj) == LV_CHART_TYPE_BAR) {
+21 -21
View File
@@ -120,8 +120,8 @@ Move the object with this value in Y direction. Applied after layouts, aligns an
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul>
### transform_zoom
Zoom an objects. The value 256 (or `LV_ZOOM_NONE`) means normal size, 128 half size, 512 double size, and so on
### transform_scale
Zoom an objects. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 half size, 512 double size, and so on
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -129,7 +129,7 @@ Zoom an objects. The value 256 (or `LV_ZOOM_NONE`) means normal size, 128 half s
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> Yes</li>
</ul>
### transform_angle
### transform_rotation
Rotate an objects. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg.
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
@@ -217,7 +217,7 @@ Sets the padding between the columns. Used by the layouts.
Properties to describe spacing around an object. Very similar to the margin properties in HTML.
### margin_top
Sets the margin on the top. The object will keep this space from its siblings in layouts.
Sets the margin on the top. The object will keep this space from its siblings in layouts.
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -327,8 +327,8 @@ Set the dithering mode of the gradient of the background. The possible values ar
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul>
### bg_img_src
Set a background image. Can be a pointer to `lv_img_dsc_t`, a path to a file or an `LV_SYMBOL_...`
### bg_image_src
Set a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or an `LV_SYMBOL_...`
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `NULL`</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -336,7 +336,7 @@ Set a background image. Can be a pointer to `lv_img_dsc_t`, a path to a file or
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> Yes</li>
</ul>
### bg_img_opa
### bg_image_opa
Set the opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency.
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `LV_OPA_COVER`</li>
@@ -345,7 +345,7 @@ Set the opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP`
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul>
### bg_img_recolor
### bg_image_recolor
Set a color to mix to the background image.
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `0x000000`</li>
@@ -354,7 +354,7 @@ Set a color to mix to the background image.
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul>
### bg_img_recolor_opa
### bg_image_recolor_opa
Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted proportionally.
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `LV_OPA_TRANSP`</li>
@@ -363,7 +363,7 @@ Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul>
### bg_img_tiled
### bg_image_tiled
If enabled the background image will be tiled. The possible values are `true` or `false`.
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
@@ -424,7 +424,7 @@ Sets whether the border should be drawn before or after the children are drawn.
Properties to describe the outline. It's like a border but drawn outside of the rectangles.
### outline_width
Set the width of the outline in pixels.
Set the width of the outline in pixels.
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -472,7 +472,7 @@ Set the width of the shadow in pixels. The value should be >= 0.
</ul>
### shadow_ofs_x
Set an offset on the shadow in pixels in X direction.
Set an offset on the shadow in pixels in X direction.
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -481,7 +481,7 @@ Set an offset on the shadow in pixels in X direction.
</ul>
### shadow_ofs_y
Set an offset on the shadow in pixels in Y direction.
Set an offset on the shadow in pixels in Y direction.
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -519,7 +519,7 @@ Set the opacity of the shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means full
## Image
Properties to describe the images
### img_opa
### image_opa
Set the opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency.
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `LV_OPA_COVER`</li>
@@ -528,7 +528,7 @@ Set the opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul>
### img_recolor
### image_recolor
Set color to mixt to the image.
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `0x000000`</li>
@@ -537,7 +537,7 @@ Set color to mixt to the image.
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul>
### img_recolor_opa
### image_recolor_opa
Set the intensity of the color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency.
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
@@ -577,7 +577,7 @@ Set the gap between dashes in pixel. Note that dash works only on horizontal and
</ul>
### line_rounded
Make the end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending
Make the end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -616,7 +616,7 @@ Set the width (thickness) of the arcs in pixel.
</ul>
### arc_rounded
Make the end points of the arcs rounded. `true`: rounded, `false`: perpendicular line ending
Make the end points of the arcs rounded. `true`: rounded, `false`: perpendicular line ending
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -642,8 +642,8 @@ Set the opacity of the arcs.
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul>
### arc_img_src
Set an image from which the arc will be masked out. It's useful to display complex effects on the arcs. Can be a pointer to `lv_img_dsc_t` or a path to a file
### arc_image_src
Set an image from which the arc will be masked out. It's useful to display complex effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `NULL`</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -673,7 +673,7 @@ Set the opacity of the text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully
</ul>
### text_font
Set the font of the text (a pointer `lv_font_t *`).
Set the font of the text (a pointer `lv_font_t *`).
<ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `LV_FONT_DEFAULT`</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> Yes</li>
+2 -2
View File
@@ -277,7 +277,7 @@
/*Maximum buffer size to allocate for rotation.
*Only used if software rotation is enabled in the display driver.*/
#define LV_DISP_ROT_MAX_BUF (10*1024)
#define LV_DISPLAY_ROT_MAX_BUF (10*1024)
/*Garbage Collector settings
*Used if lvgl is bound to higher level language and the memory is managed by that language*/
@@ -315,7 +315,7 @@
/*Define a custom attribute to `lv_timer_handler` function*/
#define LV_ATTRIBUTE_TIMER_HANDLER
/*Define a custom attribute to `lv_disp_flush_ready` function*/
/*Define a custom attribute to `lv_display_flush_ready` function*/
#define LV_ATTRIBUTE_FLUSH_READY
/*Required alignment size for buffers*/
@@ -31,7 +31,7 @@ void lv_example_snapshot_1(void)
lv_obj_set_style_bg_color(snapshot_obj, lv_palette_main(LV_PALETTE_PURPLE), 0);
lv_obj_set_style_bg_opa(snapshot_obj, LV_OPA_100, 0);
lv_image_set_zoom(snapshot_obj, 128);
lv_image_set_angle(snapshot_obj, 300);
lv_image_set_rotation(snapshot_obj, 300);
/*Create the container and its children*/
lv_obj_t * container = lv_obj_create(root);
@@ -48,7 +48,7 @@ void lv_example_snapshot_1(void)
lv_image_set_src(img, &img_star);
lv_obj_set_style_bg_color(img, lv_color_black(), 0);
lv_obj_set_style_bg_opa(img, LV_OPA_COVER, 0);
// lv_obj_set_style_transform_zoom(img, 400, LV_STATE_PRESSED);
// lv_obj_set_style_transform_scale(img, 400, LV_STATE_PRESSED);
lv_obj_add_flag(img, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_event(img, event_cb, LV_EVENT_PRESSED, snapshot_obj);
lv_obj_add_event(img, event_cb, LV_EVENT_RELEASED, snapshot_obj);
@@ -44,7 +44,7 @@ root.set_style_bg_color(lv.palette_main(lv.PALETTE.LIGHT_BLUE), 0)
snapshot_obj = lv.image(root)
snapshot_obj.set_style_bg_color(lv.palette_main(lv.PALETTE.PURPLE), 0)
snapshot_obj.set_style_bg_opa(lv.OPA.COVER, 0)
snapshot_obj.set_zoom(128)
snapshot_obj.set_scale(128)
# Create the container and its children
container = lv.obj(root)
@@ -59,7 +59,7 @@ for i in range(4):
image.set_src(image_star)
image.set_style_bg_color(lv.palette_main(lv.PALETTE.GREY), 0)
image.set_style_bg_opa(lv.OPA.COVER, 0)
image.set_style_transform_zoom(400, lv.STATE.PRESSED)
image.set_style_transform_scale(400, lv.STATE.PRESSED)
image.add_flag(image.FLAG.CLICKABLE)
image.add_event(lambda e: event_cb(e, snapshot_obj), lv.EVENT.PRESSED, None)
image.add_event(lambda e: event_cb(e, snapshot_obj), lv.EVENT.RELEASED, None)
+10 -10
View File
@@ -34,7 +34,7 @@
**********************/
static void disp_init(void);
static void disp_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * px_map);
static void disp_flush(lv_display_t * disp, const lv_area_t * area, lv_color_t * px_map);
/**********************
* STATIC VARIABLES
@@ -58,27 +58,27 @@ void lv_port_disp_init(void)
/*------------------------------------
* Create a display and set a flush_cb
* -----------------------------------*/
lv_disp_t * disp = lv_disp_create(MY_DISP_HOR_RES, MY_DISP_VER_RES);
lv_disp_set_flush_cb(disp, disp_flush);
lv_display_t * disp = lv_display_create(MY_DISP_HOR_RES, MY_DISP_VER_RES);
lv_display_set_flush_cb(disp, disp_flush);
/* Example 1
* One buffer for partial rendering*/
static lv_color_t buf_1_1[MY_DISP_HOR_RES * 10]; /*A buffer for 10 rows*/
lv_disp_set_draw_buffers(disp, buf_1_1, NULL, sizeof(buf_1_1), LV_DISP_RENDER_MODE_PARTIAL);
lv_display_set_draw_buffers(disp, buf_1_1, NULL, sizeof(buf_1_1), LV_DISPLAY_RENDER_MODE_PARTIAL);
/* Example 2
* Two buffers for partial rendering
* In flush_cb DMA or similar hardware should be used to update the display in the background.*/
static lv_color_t buf_2_1[MY_DISP_HOR_RES * 10];
static lv_color_t buf_2_2[MY_DISP_HOR_RES * 10];
lv_disp_set_draw_buffers(disp, buf_2_1, buf_2_2, sizeof(buf_2_1), LV_DISP_RENDER_MODE_PARTIAL);
lv_display_set_draw_buffers(disp, buf_2_1, buf_2_2, sizeof(buf_2_1), LV_DISPLAY_RENDER_MODE_PARTIAL);
/* Example 3
* Two buffers screen sized buffer for double buffering.
* Both LV_DISP_RENDER_MODE_DIRECT and LV_DISP_RENDER_MODE_FULL works, see their comments*/
* Both LV_DISPLAY_RENDER_MODE_DIRECT and LV_DISPLAY_RENDER_MODE_FULL works, see their comments*/
static lv_color_t buf_3_1[MY_DISP_HOR_RES * MY_DISP_VER_RES];
static lv_color_t buf_3_2[MY_DISP_HOR_RES * MY_DISP_VER_RES];
lv_disp_set_draw_buffers(disp, buf_3_1, buf_3_2, sizeof(buf_3_1), LV_DISP_RENDER_MODE_DIRECT);
lv_display_set_draw_buffers(disp, buf_3_1, buf_3_2, sizeof(buf_3_1), LV_DISPLAY_RENDER_MODE_DIRECT);
}
@@ -111,8 +111,8 @@ void disp_disable_update(void)
/*Flush the content of the internal buffer the specific area on the display.
*`px_map` contains the rendered image as raw pixel map and it should be copied to `area` on the display.
*You can use DMA or any hardware acceleration to do this operation in the background but
*'lv_disp_flush_ready()' has to be called when it's finished.*/
static void disp_flush(lv_disp_t * disp_drv, const lv_area_t * area, lv_color_t * px_map)
*'lv_display_flush_ready()' has to be called when it's finished.*/
static void disp_flush(lv_display_t * disp_drv, const lv_area_t * area, lv_color_t * px_map)
{
if(disp_flush_enabled) {
/*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/
@@ -130,7 +130,7 @@ static void disp_flush(lv_disp_t * disp_drv, const lv_area_t * area, lv_color_t
/*IMPORTANT!!!
*Inform the graphics library that you are ready with the flushing*/
lv_disp_flush_ready(disp_drv);
lv_display_flush_ready(disp_drv);
}
#else /*Enable this file at the top*/
+2 -2
View File
@@ -24,7 +24,7 @@ static void new_theme_init_and_set(void)
lv_style_set_border_width(&style_btn, 3);
/*Initialize the new theme from the current theme*/
lv_theme_t * th_act = lv_disp_get_theme(NULL);
lv_theme_t * th_act = lv_display_get_theme(NULL);
static lv_theme_t th_new;
th_new = *th_act;
@@ -33,7 +33,7 @@ static void new_theme_init_and_set(void)
lv_theme_set_apply_cb(&th_new, new_theme_apply_cb);
/*Assign the new theme to the current display*/
lv_disp_set_theme(NULL, &th_new);
lv_display_set_theme(NULL, &th_new);
}
+1 -1
View File
@@ -49,7 +49,7 @@ class ExampleStyle_14:
# Initialize the new theme from the current theme
self.th_new = NewTheme()
self.th_new.set_apply_cb(self.new_theme_apply_cb)
lv.disp_get_default().set_theme(self.th_new)
lv.display_get_default().set_theme(self.th_new)
exampleStyle_14 = ExampleStyle_14()
+2 -2
View File
@@ -35,8 +35,8 @@ void lv_example_style_15(void)
*The button and the label is rendered to a layer first and that layer is transformed*/
btn = lv_button_create(lv_scr_act());
lv_obj_set_size(btn, 100, 40);
lv_obj_set_style_transform_angle(btn, 150, 0); /*15 deg*/
lv_obj_set_style_transform_zoom(btn, 256 + 64, 0); /*1.25x*/
lv_obj_set_style_transform_rotation(btn, 150, 0); /*15 deg*/
lv_obj_set_style_transform_scale(btn, 256 + 64, 0); /*1.25x*/
lv_obj_set_style_transform_pivot_x(btn, 50, 0);
lv_obj_set_style_transform_pivot_y(btn, 20, 0);
lv_obj_set_style_opa(btn, LV_OPA_50, 0);
+2 -2
View File
@@ -26,8 +26,8 @@ label.center()
# The button and the label is rendered to a layer first and that layer is transformed
button = lv.button(lv.scr_act())
button.set_size(100, 40)
button.set_style_transform_angle(150, 0) # 15 deg
button.set_style_transform_zoom(256 + 64, 0) # 1.25x
button.set_style_transform_rotation(150, 0) # 15 deg
button.set_style_transform_scale(256 + 64, 0) # 1.25x
button.set_style_transform_pivot_x(50, 0)
button.set_style_transform_pivot_y(20, 0)
button.set_style_opa(lv.OPA._50, 0)
+1 -1
View File
@@ -18,7 +18,7 @@ void lv_example_style_6(void)
lv_style_set_image_recolor(&style, lv_palette_main(LV_PALETTE_BLUE));
lv_style_set_image_recolor_opa(&style, LV_OPA_50);
lv_style_set_transform_angle(&style, 300);
lv_style_set_transform_rotation(&style, 300);
/*Create an object with the new style*/
lv_obj_t * obj = lv_image_create(lv_scr_act());
+1 -1
View File
@@ -26,7 +26,7 @@ style.set_border_color(lv.palette_main(lv.PALETTE.BLUE))
style.set_image_recolor(lv.palette_main(lv.PALETTE.BLUE))
style.set_image_recolor_opa(lv.OPA._50)
style.set_transform_angle(300)
style.set_transform_rotation(300)
# Create an object with the new style
obj = lv.image(lv.scr_act())
+2 -2
View File
@@ -18,8 +18,8 @@ static void event_cb(lv_event_t * e)
lv_snprintf(buf, sizeof(buf), "%d", (int)lv_bar_get_value(obj));
lv_point_t txt_size;
lv_txt_get_size(&txt_size, buf, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX,
label_dsc.flag);
lv_text_get_size(&txt_size, buf, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX,
label_dsc.flag);
lv_area_t txt_area;
txt_area.x1 = 0;
@@ -48,8 +48,8 @@ static void event_cb(lv_event_t * e)
if(draw_task->type == LV_DRAW_TASK_TYPE_FILL) {
LV_IMAGE_DECLARE(img_star);
lv_image_header_t header;
lv_res_t res = lv_image_decoder_get_info(&img_star, &header);
if(res != LV_RES_OK) return;
lv_result_t res = lv_image_decoder_get_info(&img_star, &header);
if(res != LV_RESULT_OK) return;
lv_area_t a;
a.x1 = 0;
@@ -5,7 +5,7 @@ def event_handler(e):
if code == lv.EVENT.VALUE_CHANGED:
source = e.get_current_target_obj()
date = lv.calendar_date_t()
if source.get_pressed_date(date) == lv.RES.OK:
if source.get_pressed_date(date) == lv.RESULT.OK:
calendar.set_today_date(date.year, date.month, date.day)
print("Clicked date: %02d.%02d.%02d"%(date.day, date.month, date.year))
@@ -64,7 +64,7 @@ void lv_example_canvas_1(void)
lv_draw_image_dsc_t img_dsc;
lv_draw_image_dsc_init(&img_dsc);
img_dsc.angle = 120;
img_dsc.rotation = 120;
img_dsc.src = &img;
img_dsc.pivot.x = CANVAS_WIDTH / 2;
img_dsc.pivot.y = CANVAS_HEIGHT / 2;
@@ -72,7 +72,7 @@ canvas.fill_bg(lv.palette_lighten(lv.PALETTE.GREY, 3), lv.OPA.COVER)
image_dsc = lv.draw_image_dsc_t()
image_dsc.init();
image_dsc.angle = 120;
image_dsc.rotation = 120;
image_dsc.src = image;
image_dsc.pivot.x = _CANVAS_WIDTH // 2;
image_dsc.pivot.y = _CANVAS_HEIGHT // 2;
+2 -2
View File
@@ -84,13 +84,13 @@ void lv_example_chart_5(void)
lv_obj_t * slider;
slider = lv_slider_create(lv_scr_act());
lv_slider_set_range(slider, LV_ZOOM_NONE, LV_ZOOM_NONE * 10);
lv_slider_set_range(slider, LV_SCALE_NONE, LV_SCALE_NONE * 10);
lv_obj_add_event(slider, slider_x_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_set_size(slider, 200, 10);
lv_obj_align_to(slider, chart, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
slider = lv_slider_create(lv_scr_act());
lv_slider_set_range(slider, LV_ZOOM_NONE, LV_ZOOM_NONE * 10);
lv_slider_set_range(slider, LV_SCALE_NONE, LV_SCALE_NONE * 10);
lv_obj_add_event(slider, slider_y_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_set_size(slider, 10, 150);
lv_obj_align_to(slider, chart, LV_ALIGN_OUT_RIGHT_MID, 20, 0);
+2 -2
View File
@@ -76,13 +76,13 @@ chart.set_point_count(pcnt)
chart.set_ext_y_array(ser, ecg_sample)
slider = lv.slider(lv.scr_act())
slider.set_range(lv.ZOOM_NONE, lv.ZOOM_NONE * 10)
slider.set_range(lv.SCALE_NONE, lv.SCALE_NONE * 10)
slider.add_event(slider_x_event_cb, lv.EVENT.VALUE_CHANGED, None)
slider.set_size(200,10)
slider.align_to(chart, lv.ALIGN.OUT_BOTTOM_MID, 0, 20)
slider = lv.slider(lv.scr_act())
slider.set_range(lv.ZOOM_NONE, lv.ZOOM_NONE * 10)
slider.set_range(lv.SCALE_NONE, lv.SCALE_NONE * 10)
slider.add_event(slider_y_event_cb, lv.EVENT.VALUE_CHANGED, None)
slider.set_size(10, 150)
slider.align_to(chart, lv.ALIGN.OUT_RIGHT_MID, 20, 0)
@@ -32,7 +32,7 @@ void lv_example_dropdown_3(void)
/*Use a custom image as down icon and flip it when the list is opened*/
LV_IMAGE_DECLARE(img_caret_down)
lv_dropdown_set_symbol(dropdown, &img_caret_down);
lv_obj_set_style_transform_angle(dropdown, 1800, LV_PART_INDICATOR | LV_STATE_CHECKED);
lv_obj_set_style_transform_rotation(dropdown, 1800, LV_PART_INDICATOR | LV_STATE_CHECKED);
/*In a menu we don't need to show the last clicked item*/
lv_dropdown_set_selected_highlight(dropdown, false);
@@ -37,7 +37,7 @@ dropdown.set_text("Menu")
# Use a custom image as down icon and flip it when the list is opened
# LV_IMAGE_DECLARE(image_caret_down)
dropdown.set_symbol(image_caret_down_argb)
dropdown.set_style_transform_angle(1800, lv.PART.INDICATOR | lv.STATE.CHECKED)
dropdown.set_style_transform_rotation(1800, lv.PART.INDICATOR | lv.STATE.CHECKED)
# In a menu we don't need to show the last clicked item
dropdown.set_selected_highlight(False)
+1 -1
View File
@@ -3,7 +3,7 @@
static void set_angle(void * img, int32_t v)
{
lv_image_set_angle(img, v);
lv_image_set_rotation(img, v);
}
static void set_zoom(void * img, int32_t v)
+1 -1
View File
@@ -5,7 +5,7 @@ void lv_example_menu_1(void)
{
/*Create a menu object*/
lv_obj_t * menu = lv_menu_create(lv_scr_act());
lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL));
lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
lv_obj_center(menu);
lv_obj_t * cont;
+1 -1
View File
@@ -17,7 +17,7 @@ void lv_example_menu_2(void)
lv_obj_t * menu = lv_menu_create(lv_scr_act());
lv_menu_set_mode_root_back_button(menu, LV_MENU_ROOT_BACK_BUTTON_ENABLED);
lv_obj_add_event(menu, back_event_handler, LV_EVENT_CLICKED, menu);
lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL));
lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
lv_obj_center(menu);
lv_obj_t * cont;
+1 -1
View File
@@ -5,7 +5,7 @@ void lv_example_menu_3(void)
{
/*Create a menu object*/
lv_obj_t * menu = lv_menu_create(lv_scr_act());
lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL));
lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
lv_obj_center(menu);
/*Modify the header*/
+1 -1
View File
@@ -32,7 +32,7 @@ void lv_example_menu_4(void)
{
/*Create a menu object*/
menu = lv_menu_create(lv_scr_act());
lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL));
lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
lv_obj_center(menu);
lv_obj_t * cont;
+1 -1
View File
@@ -30,7 +30,7 @@ void lv_example_menu_5(void)
}
lv_menu_set_mode_root_back_button(menu, LV_MENU_ROOT_BACK_BUTTON_ENABLED);
lv_obj_add_event(menu, back_event_handler, LV_EVENT_CLICKED, menu);
lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL));
lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
lv_obj_center(menu);
lv_obj_t * cont;
+1 -1
View File
@@ -7,7 +7,7 @@
void lv_example_scale_5(void)
{
lv_obj_t * scale = lv_scale_create(lv_scr_act());
lv_obj_set_size(scale, lv_disp_get_hor_res(NULL) / 2, lv_disp_get_ver_res(NULL) / 2);
lv_obj_set_size(scale, lv_display_get_horizontal_resolution(NULL) / 2, lv_display_get_vertical_resolution(NULL) / 2);
lv_scale_set_label_show(scale, true);
lv_scale_set_total_tick_count(scale, 10);
@@ -40,7 +40,7 @@ static void slider_event_cb(lv_event_t * e)
lv_snprintf(buf, sizeof(buf), "%d - %d", (int)lv_slider_get_left_value(obj), (int)lv_slider_get_value(obj));
lv_point_t label_size;
lv_txt_get_size(&label_size, buf, LV_FONT_DEFAULT, 0, 0, LV_COORD_MAX, 0);
lv_text_get_size(&label_size, buf, LV_FONT_DEFAULT, 0, 0, LV_COORD_MAX, 0);
lv_area_t label_area;
label_area.x1 = 0;
label_area.x2 = label_size.x - 1;
@@ -12,7 +12,7 @@ def slider_event_cb(e):
if base_dsc.part == lv.PART.INDICATOR:
label_text = "{:d} - {:d}".format(obj.get_left_value(),slider.get_value())
label_size = lv.point_t()
lv.txt_get_size(label_size, label_text, lv.font_default(), 0, 0, lv.COORD.MAX, 0)
lv.text_get_size(label_size, label_text, lv.font_default(), 0, 0, lv.COORD.MAX, 0)
# print(label_size.x,label_size.y)
label_area = lv.area_t()
label_area.x1 = dsc.area.x1 + dsc.area.get_width() // 2 - label_size.x // 2
+4 -4
View File
@@ -239,7 +239,7 @@
/*Maximum buffer size to allocate for rotation.
*Only used if software rotation is enabled in the display driver.*/
#define LV_DISP_ROT_MAX_BUF (10*1024)
#define LV_DISPLAY_ROT_MAX_BUF (10*1024)
#define LV_ENABLE_GLOBAL_CUSTOM 0
#if LV_ENABLE_GLOBAL_CUSTOM
@@ -278,7 +278,7 @@
/*Define a custom attribute to `lv_timer_handler` function*/
#define LV_ATTRIBUTE_TIMER_HANDLER
/*Define a custom attribute to `lv_disp_flush_ready` function*/
/*Define a custom attribute to `lv_display_flush_ready` function*/
#define LV_ATTRIBUTE_FLUSH_READY
/*Required alignment size for buffers*/
@@ -721,7 +721,7 @@
#define LV_USE_SDL 0
#if LV_USE_SDL
#define LV_SDL_INCLUDE_PATH <SDL2/SDL.h>
#define LV_SDL_RENDER_MODE LV_DISP_RENDER_MODE_DIRECT /*LV_DISP_RENDER_MODE_DIRECT is recommended for best performance*/
#define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /*LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance*/
#define LV_SDL_BUF_COUNT 1 /*1 or 2*/
#define LV_SDL_FULLSCREEN 0 /*1: Make the window full screen by default*/
#define LV_SDL_DIRECT_EXIT 1 /*1: Exit the application when all SDL widows are closed*/
@@ -732,7 +732,7 @@
#if LV_USE_LINUX_FBDEV
#define LV_LINUX_FBDEV_BSD 0
#define LV_LINUX_FBDEV_NUTTX 0
#define LV_LINUX_FBDEV_RENDER_MODE LV_DISP_RENDER_MODE_PARTIAL
#define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL
#define LV_LINUX_FBDEV_BUFFER_COUNT 0
#define LV_LINUX_FBDEV_BUFFER_SIZE 60
#endif
+4 -4
View File
@@ -40,7 +40,7 @@ extern "C" {
#include "src/core/lv_group.h"
#include "src/indev/lv_indev.h"
#include "src/core/lv_refr.h"
#include "src/disp/lv_disp.h"
#include "src/display/lv_display.h"
#include "src/font/lv_font.h"
#include "src/font/lv_font_loader.h"
@@ -114,9 +114,9 @@ extern "C" {
#include "src/dev/sdl/lv_sdl_mousewheel.h"
#include "src/dev/sdl/lv_sdl_keyboard.h"
#include "src/dev/disp/drm/lv_linux_drm.h"
#include "src/dev/disp/fb/lv_linux_fbdev.h"
#include "src/dev/disp/lcd/lv_nuttx_lcd.h"
#include "src/dev/display/drm/lv_linux_drm.h"
#include "src/dev/display/fb/lv_linux_fbdev.h"
#include "src/dev/display/lcd/lv_nuttx_lcd.h"
#include "src/dev/input/touchscreen/lv_nuttx_touchscreen.h"
+12 -12
View File
@@ -58,11 +58,11 @@ props = [
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Move the object with this value in Y direction. Applied after layouts, aligns and other positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height." },
{'name': 'TRANSFORM_ZOOM',
{'name': 'TRANSFORM_SCALE',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
'dsc': "Zoom an objects. The value 256 (or `LV_ZOOM_NONE`) means normal size, 128 half size, 512 double size, and so on" },
'dsc': "Zoom an objects. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 half size, 512 double size, and so on" },
{'name': 'TRANSFORM_ANGLE',
{'name': 'TRANSFORM_ROTATION',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
'dsc': "Rotate an objects. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg."},
@@ -149,23 +149,23 @@ props = [
'style_type': 'num', 'var_type': 'lv_dither_mode_t', 'default':'`LV_DITHER_NONE`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the dithering mode of the gradient of the background. The possible values are `LV_DITHER_NONE/ORDERED/ERR_DIFF`."},
{'name': 'BG_IMG_SRC',
{'name': 'BG_IMAGE_SRC',
'style_type': 'ptr', 'var_type': 'const void *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Set a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or an `LV_SYMBOL_...`"},
{'name': 'BG_IMG_OPA',
{'name': 'BG_IMAGE_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
{'name': 'BG_IMG_RECOLOR',
{'name': 'BG_IMAGE_RECOLOR',
'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Set a color to mix to the background image."},
{'name': 'BG_IMG_RECOLOR_OPA',
{'name': 'BG_IMAGE_RECOLOR_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted proportionally."},
{'name': 'BG_IMG_TILED',
{'name': 'BG_IMAGE_TILED',
'style_type': 'num', 'var_type': 'bool', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "If enabled the background image will be tiled. The possible values are `true` or `false`."},
@@ -233,15 +233,15 @@ props = [
'dsc': "Set the opacity of the shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
{'section': 'Image', 'dsc':'Properties to describe the images' },
{'name': 'IMG_OPA',
{'name': 'IMAGE_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
{'name': 'IMG_RECOLOR',
{'name': 'IMAGE_RECOLOR',
'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Set color to mixt to the image."},
{'name': 'IMG_RECOLOR_OPA',
{'name': 'IMAGE_RECOLOR_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the intensity of the color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
@@ -287,7 +287,7 @@ props = [
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the opacity of the arcs."},
{'name': 'ARC_IMG_SRC',
{'name': 'ARC_IMAGE_SRC',
'style_type': 'ptr', 'var_type': 'const void *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set an image from which the arc will be masked out. It's useful to display complex effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file"},
+3 -3
View File
@@ -49,7 +49,7 @@ extern "C" {
* TYPEDEFS
**********************/
struct _lv_disp_t;
struct _lv_display_t;
struct _lv_group_t;
struct _my_theme_t;
struct _lv_indev_t;
@@ -68,8 +68,8 @@ typedef struct _lv_global_t {
bool inited;
lv_ll_t disp_ll;
struct _lv_disp_t * disp_refresh;
struct _lv_disp_t * disp_default;
struct _lv_display_t * disp_refresh;
struct _lv_display_t * disp_default;
lv_ll_t style_trans_ll;
bool style_refresh;
+13 -13
View File
@@ -246,8 +246,8 @@ void lv_group_focus_obj(lv_obj_t * obj)
_LV_LL_READ(&g->obj_ll, i) {
if(*i == obj) {
if(g->obj_focus != NULL && obj != *g->obj_focus) { /*Do not defocus if the same object needs to be focused again*/
lv_res_t res = lv_obj_send_event(*g->obj_focus, LV_EVENT_DEFOCUSED, get_indev(g));
if(res != LV_RES_OK) return;
lv_result_t res = lv_obj_send_event(*g->obj_focus, LV_EVENT_DEFOCUSED, get_indev(g));
if(res != LV_RESULT_OK) return;
lv_obj_invalidate(*g->obj_focus);
}
@@ -255,8 +255,8 @@ void lv_group_focus_obj(lv_obj_t * obj)
if(g->obj_focus != NULL) {
if(g->focus_cb) g->focus_cb(g);
lv_res_t res = lv_obj_send_event(*g->obj_focus, LV_EVENT_FOCUSED, get_indev(g));
if(res != LV_RES_OK) return;
lv_result_t res = lv_obj_send_event(*g->obj_focus, LV_EVENT_FOCUSED, get_indev(g));
if(res != LV_RESULT_OK) return;
lv_obj_invalidate(*g->obj_focus);
}
break;
@@ -288,12 +288,12 @@ void lv_group_focus_freeze(lv_group_t * group, bool en)
else group->frozen = 1;
}
lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c)
lv_result_t lv_group_send_data(lv_group_t * group, uint32_t c)
{
lv_obj_t * act = lv_group_get_focused(group);
if(act == NULL) return LV_RES_OK;
if(act == NULL) return LV_RESULT_OK;
if(lv_obj_has_state(act, LV_STATE_DISABLED)) return LV_RES_OK;
if(lv_obj_has_state(act, LV_STATE_DISABLED)) return LV_RESULT_OK;
return lv_obj_send_event(act, LV_EVENT_KEY, &c);
}
@@ -319,8 +319,8 @@ void lv_group_set_editing(lv_group_t * group, bool edit)
lv_obj_t * focused = lv_group_get_focused(group);
if(focused) {
lv_res_t res = lv_obj_send_event(*group->obj_focus, LV_EVENT_FOCUSED, get_indev(group));
if(res != LV_RES_OK) return;
lv_result_t res = lv_obj_send_event(*group->obj_focus, LV_EVENT_FOCUSED, get_indev(group));
if(res != LV_RESULT_OK) return;
lv_obj_invalidate(focused);
}
@@ -449,15 +449,15 @@ static bool focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
if(obj_next == group->obj_focus) return focus_changed; /*There's only one visible object and it's already focused*/
if(group->obj_focus) {
lv_res_t res = lv_obj_send_event(*group->obj_focus, LV_EVENT_DEFOCUSED, get_indev(group));
if(res != LV_RES_OK) return focus_changed;
lv_result_t res = lv_obj_send_event(*group->obj_focus, LV_EVENT_DEFOCUSED, get_indev(group));
if(res != LV_RESULT_OK) return focus_changed;
lv_obj_invalidate(*group->obj_focus);
}
group->obj_focus = obj_next;
lv_res_t res = lv_obj_send_event(*group->obj_focus, LV_EVENT_FOCUSED, get_indev(group));
if(res != LV_RES_OK) return focus_changed;
lv_result_t res = lv_obj_send_event(*group->obj_focus, LV_EVENT_FOCUSED, get_indev(group));
if(res != LV_RESULT_OK) return focus_changed;
lv_obj_invalidate(*group->obj_focus);
+1 -1
View File
@@ -178,7 +178,7 @@ void lv_group_focus_freeze(lv_group_t * group, bool en);
* @param c a character (use LV_KEY_.. to navigate)
* @return result of focused object in group.
*/
lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c);
lv_result_t lv_group_send_data(lv_group_t * group, uint32_t c);
/**
* Set a function for a group which will be called when a new object is focused
+15 -15
View File
@@ -11,8 +11,8 @@
#include "../indev/lv_indev_private.h"
#include "lv_refr.h"
#include "lv_group.h"
#include "../disp/lv_disp.h"
#include "../disp/lv_disp_private.h"
#include "../display/lv_display.h"
#include "../display/lv_display_private.h"
#include "../themes/lv_theme.h"
#include "../misc/lv_assert.h"
#include "../misc/lv_math.h"
@@ -42,7 +42,7 @@ static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj);
static void lv_obj_draw(lv_event_t * e);
static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e);
static void draw_scrollbar(lv_obj_t * obj, lv_layer_t * layer);
static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc);
static lv_result_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc);
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find);
static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state);
@@ -259,7 +259,7 @@ const lv_obj_class_t * lv_obj_get_class(const lv_obj_t * obj)
bool lv_obj_is_valid(const lv_obj_t * obj)
{
lv_disp_t * disp = lv_disp_get_next(NULL);
lv_display_t * disp = lv_display_get_next(NULL);
while(disp) {
uint32_t i;
for(i = 0; i < disp->screen_cnt; i++) {
@@ -268,7 +268,7 @@ bool lv_obj_is_valid(const lv_obj_t * obj)
if(found) return true;
}
disp = lv_disp_get_next(disp);
disp = lv_display_get_next(disp);
}
return false;
@@ -435,8 +435,8 @@ static void draw_scrollbar(lv_obj_t * obj, lv_layer_t * layer)
if(lv_area_get_size(&hor_area) <= 0 && lv_area_get_size(&ver_area) <= 0) return;
lv_draw_rect_dsc_t draw_dsc;
lv_res_t sb_res = scrollbar_init_draw_dsc(obj, &draw_dsc);
if(sb_res != LV_RES_OK) return;
lv_result_t sb_res = scrollbar_init_draw_dsc(obj, &draw_dsc);
if(sb_res != LV_RESULT_OK) return;
if(lv_area_get_size(&hor_area) > 0) {
draw_dsc.base.id1 = 0;
@@ -452,9 +452,9 @@ static void draw_scrollbar(lv_obj_t * obj, lv_layer_t * layer)
* Initialize the draw descriptor for the scrollbar
* @param obj pointer to an object
* @param dsc the draw descriptor to initialize
* @return LV_RES_OK: the scrollbar is visible; LV_RES_INV: the scrollbar is not visible
* @return LV_RESULT_OK: the scrollbar is visible; LV_RESULT_INVALID: the scrollbar is not visible
*/
static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc)
static lv_result_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc)
{
lv_draw_rect_dsc_init(dsc);
dsc->bg_opa = lv_obj_get_style_bg_opa(obj, LV_PART_SCROLLBAR);
@@ -495,10 +495,10 @@ static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc
if(dsc->bg_opa != LV_OPA_TRANSP || dsc->border_opa != LV_OPA_TRANSP || dsc->shadow_opa != LV_OPA_TRANSP) {
dsc->radius = lv_obj_get_style_radius(obj, LV_PART_SCROLLBAR);
return LV_RES_OK;
return LV_RESULT_OK;
}
else {
return LV_RES_INV;
return LV_RESULT_INVALID;
}
}
@@ -519,8 +519,8 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
if(!(lv_obj_get_state(obj) & LV_STATE_CHECKED)) lv_obj_add_state(obj, LV_STATE_CHECKED);
else lv_obj_clear_state(obj, LV_STATE_CHECKED);
lv_res_t res = lv_obj_send_event(obj, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return;
lv_result_t res = lv_obj_send_event(obj, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RESULT_OK) return;
}
}
else if(code == LV_EVENT_PRESS_LOST) {
@@ -545,8 +545,8 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
/*With Enter LV_EVENT_RELEASED will send VALUE_CHANGE event*/
if(c != LV_KEY_ENTER) {
lv_res_t res = lv_obj_send_event(obj, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return;
lv_result_t res = lv_obj_send_event(obj, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RESULT_OK) return;
}
}
else if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_WITH_ARROW) && !lv_obj_is_editable(obj)) {
+5 -5
View File
@@ -8,8 +8,8 @@
*********************/
#include "lv_obj.h"
#include "../themes/lv_theme.h"
#include "../disp/lv_disp.h"
#include "../disp/lv_disp_private.h"
#include "../display/lv_display.h"
#include "../display/lv_display_private.h"
#include "../stdlib/lv_string.h"
/*********************
@@ -56,7 +56,7 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
/*Create a screen*/
if(parent == NULL) {
LV_TRACE_OBJ_CREATE("creating a screen");
lv_disp_t * disp = lv_disp_get_default();
lv_display_t * disp = lv_display_get_default();
if(!disp) {
LV_LOG_WARN("No display created yet. No place to assign the new screen");
lv_free(obj);
@@ -74,8 +74,8 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
/*Set coordinates to full screen size*/
obj->coords.x1 = 0;
obj->coords.y1 = 0;
obj->coords.x2 = lv_disp_get_hor_res(NULL) - 1;
obj->coords.y2 = lv_disp_get_ver_res(NULL) - 1;
obj->coords.x2 = lv_display_get_horizontal_resolution(NULL) - 1;
obj->coords.y2 = lv_display_get_vertical_resolution(NULL) - 1;
}
/*Create a normal object*/
else {
+3 -3
View File
@@ -8,7 +8,7 @@
*********************/
#include "lv_obj_draw.h"
#include "lv_obj.h"
#include "../disp/lv_disp.h"
#include "../display/lv_display.h"
#include "../indev/lv_indev.h"
#include "../stdlib/lv_string.h"
@@ -186,8 +186,8 @@ void lv_obj_init_draw_image_dsc(lv_obj_t * obj, uint32_t part, lv_draw_image_dsc
}
if(draw_dsc->opa <= LV_OPA_MIN) return;
draw_dsc->angle = 0;
draw_dsc->zoom = LV_ZOOM_NONE;
draw_dsc->rotation = 0;
draw_dsc->zoom = LV_SCALE_NONE;
draw_dsc->pivot.x = lv_area_get_width(&obj->coords) / 2;
draw_dsc->pivot.y = lv_area_get_height(&obj->coords) / 2;
+17 -17
View File
@@ -22,7 +22,7 @@
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t event_send_core(lv_event_t * e);
static lv_result_t event_send_core(lv_event_t * e);
static bool event_is_bubbled(lv_event_t * e);
/**********************
@@ -42,9 +42,9 @@ static bool event_is_bubbled(lv_event_t * e);
* GLOBAL FUNCTIONS
**********************/
lv_res_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * param)
lv_result_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * param)
{
if(obj == NULL) return LV_RES_OK;
if(obj == NULL) return LV_RESULT_OK;
LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -61,7 +61,7 @@ lv_res_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * pa
_lv_event_push(&e);
/*Send the event*/
lv_res_t res = event_send_core(&e);
lv_result_t res = event_send_core(&e);
/*Remove this element from the list*/
_lv_event_pop(&e);
@@ -70,7 +70,7 @@ lv_res_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * pa
}
lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e)
lv_result_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e)
{
const lv_obj_class_t * base;
if(class_p == NULL) base = ((lv_obj_t *)e->current_target)->class_p;
@@ -79,16 +79,16 @@ lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e)
/*Find a base in which call the ancestor's event handler_cb if set*/
while(base && base->event_cb == NULL) base = base->base_class;
if(base == NULL) return LV_RES_OK;
if(base->event_cb == NULL) return LV_RES_OK;
if(base == NULL) return LV_RESULT_OK;
if(base->event_cb == NULL) return LV_RESULT_OK;
/*Call the actual event callback*/
e->user_data = NULL;
base->event_cb(base, e);
lv_res_t res = LV_RES_OK;
lv_result_t res = LV_RESULT_OK;
/*Stop if the object is deleted*/
if(e->deleted) res = LV_RES_INV;
if(e->deleted) res = LV_RESULT_INVALID;
return res;
}
@@ -285,7 +285,7 @@ lv_draw_task_t * lv_event_get_draw_task(lv_event_t * e)
* STATIC FUNCTIONS
**********************/
static lv_res_t event_send_core(lv_event_t * e)
static lv_result_t event_send_core(lv_event_t * e)
{
EVENT_TRACE("Sending event %d to %p with %p param", e->code, (void *)e->original_target, e->param);
@@ -293,28 +293,28 @@ static lv_res_t event_send_core(lv_event_t * e)
lv_indev_t * indev_act = lv_indev_get_act();
if(indev_act) {
if(indev_act->feedback_cb) indev_act->feedback_cb(indev_act, e);
if(e->stop_processing) return LV_RES_OK;
if(e->deleted) return LV_RES_INV;
if(e->stop_processing) return LV_RESULT_OK;
if(e->deleted) return LV_RESULT_INVALID;
}
lv_obj_t * target = e->current_target;
lv_res_t res = LV_RES_OK;
lv_result_t res = LV_RESULT_OK;
lv_event_list_t * list = target->spec_attr ? &target->spec_attr->event_list : NULL;
res = lv_event_send(list, e, true);
if(res != LV_RES_OK) return res;
if(res != LV_RESULT_OK) return res;
res = lv_obj_event_base(NULL, e);
if(res != LV_RES_OK) return res;
if(res != LV_RESULT_OK) return res;
res = lv_event_send(list, e, false);
if(res != LV_RES_OK) return res;
if(res != LV_RESULT_OK) return res;
lv_obj_t * parent = lv_obj_get_parent(e->current_target);
if(parent && event_is_bubbled(e)) {
e->current_target = parent;
res = event_send_core(e);
if(res != LV_RES_OK) return res;
if(res != LV_RESULT_OK) return res;
}
return res;
+4 -4
View File
@@ -67,17 +67,17 @@ typedef struct {
* @param obj pointer to an object
* @param event_code the type of the event from `lv_event_t`
* @param param arbitrary data depending on the widget type and the event. (Usually `NULL`)
* @return LV_RES_OK: `obj` was not deleted in the event; LV_RES_INV: `obj` was deleted in the event_code
* @return LV_RESULT_OK: `obj` was not deleted in the event; LV_RESULT_INVALID: `obj` was deleted in the event_code
*/
lv_res_t lv_obj_send_event(struct _lv_obj_t * obj, lv_event_code_t event_code, void * param);
lv_result_t lv_obj_send_event(struct _lv_obj_t * obj, lv_event_code_t event_code, void * param);
/**
* Used by the widgets internally to call the ancestor widget types's event handler
* @param class_p pointer to the class of the widget (NOT the ancestor class)
* @param e pointer to the event descriptor
* @return LV_RES_OK: the target object was not deleted in the event; LV_RES_INV: it was deleted in the event_code
* @return LV_RESULT_OK: the target object was not deleted in the event; LV_RESULT_INVALID: it was deleted in the event_code
*/
lv_res_t lv_obj_event_base(const struct _lv_obj_class_t * class_p, lv_event_t * e);
lv_result_t lv_obj_event_base(const struct _lv_obj_class_t * class_p, lv_event_t * e);
/**
* Get the current target of the event. It's the object which event handler being called.
+23 -23
View File
@@ -7,8 +7,8 @@
* INCLUDES
*********************/
#include "lv_obj.h"
#include "../disp/lv_disp.h"
#include "../disp/lv_disp_private.h"
#include "../display/lv_display.h"
#include "../display/lv_display_private.h"
#include "lv_refr.h"
#include "../core/lv_global.h"
@@ -54,12 +54,12 @@ void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_res_t res_x;
lv_result_t res_x;
lv_style_value_t v_x;
res_x = lv_obj_get_local_style_prop(obj, LV_STYLE_X, &v_x, 0);
if((res_x == LV_RES_OK && v_x.num != x) || res_x == LV_RES_INV) {
if((res_x == LV_RESULT_OK && v_x.num != x) || res_x == LV_RESULT_INVALID) {
lv_obj_set_style_x(obj, x, 0);
}
}
@@ -68,12 +68,12 @@ void lv_obj_set_y(lv_obj_t * obj, lv_coord_t y)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_res_t res_y;
lv_result_t res_y;
lv_style_value_t v_y;
res_y = lv_obj_get_local_style_prop(obj, LV_STYLE_Y, &v_y, 0);
if((res_y == LV_RES_OK && v_y.num != y) || res_y == LV_RES_INV) {
if((res_y == LV_RESULT_OK && v_y.num != y) || res_y == LV_RESULT_INVALID) {
lv_obj_set_style_y(obj, y, 0);
}
}
@@ -215,12 +215,12 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_res_t res_w;
lv_result_t res_w;
lv_style_value_t v_w;
res_w = lv_obj_get_local_style_prop(obj, LV_STYLE_WIDTH, &v_w, 0);
if((res_w == LV_RES_OK && v_w.num != w) || res_w == LV_RES_INV) {
if((res_w == LV_RESULT_OK && v_w.num != w) || res_w == LV_RESULT_INVALID) {
lv_obj_set_style_width(obj, w, 0);
}
}
@@ -228,12 +228,12 @@ void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w)
void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_res_t res_h;
lv_result_t res_h;
lv_style_value_t v_h;
res_h = lv_obj_get_local_style_prop(obj, LV_STYLE_HEIGHT, &v_h, 0);
if((res_h == LV_RES_OK && v_h.num != h) || res_h == LV_RES_INV) {
if((res_h == LV_RESULT_OK && v_h.num != h) || res_h == LV_RESULT_INVALID) {
lv_obj_set_style_height(obj, h, 0);
}
}
@@ -282,8 +282,8 @@ void lv_obj_mark_layout_as_dirty(lv_obj_t * obj)
scr->scr_layout_inv = 1;
/*Make the display refreshing*/
lv_disp_t * disp = lv_obj_get_disp(scr);
lv_disp_send_event(disp, LV_EVENT_REFR_REQUEST, NULL);
lv_display_t * disp = lv_obj_get_disp(scr);
lv_display_send_event(disp, LV_EVENT_REFR_REQUEST, NULL);
}
void lv_obj_update_layout(const lv_obj_t * obj)
@@ -802,8 +802,8 @@ void lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_disp_t * disp = lv_obj_get_disp(obj);
if(!lv_disp_is_invalidation_enabled(disp)) return;
lv_display_t * disp = lv_obj_get_disp(obj);
if(!lv_display_is_invalidation_enabled(disp)) return;
lv_area_t area_tmp;
lv_area_copy(&area_tmp, area);
@@ -834,12 +834,12 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
/*Invalidate the object only if it belongs to the current or previous or one of the layers'*/
lv_obj_t * obj_scr = lv_obj_get_screen(obj);
lv_disp_t * disp = lv_obj_get_disp(obj_scr);
if(obj_scr != lv_disp_get_scr_act(disp) &&
obj_scr != lv_disp_get_scr_prev(disp) &&
obj_scr != lv_disp_get_layer_bottom(disp) &&
obj_scr != lv_disp_get_layer_top(disp) &&
obj_scr != lv_disp_get_layer_sys(disp)) {
lv_display_t * disp = lv_obj_get_disp(obj_scr);
if(obj_scr != lv_display_get_scr_act(disp) &&
obj_scr != lv_display_get_scr_prev(disp) &&
obj_scr != lv_display_get_layer_bottom(disp) &&
obj_scr != lv_display_get_layer_top(disp) &&
obj_scr != lv_display_get_layer_sys(disp)) {
return false;
}
@@ -1118,10 +1118,10 @@ static void layout_update_core(lv_obj_t * obj)
static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv)
{
lv_coord_t angle = lv_obj_get_style_transform_angle(obj, 0);
lv_coord_t zoom = lv_obj_get_style_transform_zoom_safe(obj, 0);
lv_coord_t angle = lv_obj_get_style_transform_rotation(obj, 0);
lv_coord_t zoom = lv_obj_get_style_transform_scale_safe(obj, 0);
if(angle == 0 && zoom == LV_ZOOM_NONE) return;
if(angle == 0 && zoom == LV_SCALE_NONE) return;
lv_point_t pivot = {
.x = lv_obj_get_style_transform_pivot_x(obj, 0),
+19 -19
View File
@@ -10,7 +10,7 @@
#include "lv_obj.h"
#include "../indev/lv_indev.h"
#include "../indev/lv_indev_scroll.h"
#include "../disp/lv_disp.h"
#include "../display/lv_display.h"
/*********************
* DEFINES
@@ -306,14 +306,14 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab
{
if(dx == 0 && dy == 0) return;
if(anim_en == LV_ANIM_ON) {
lv_disp_t * d = lv_obj_get_disp(obj);
lv_display_t * d = lv_obj_get_disp(obj);
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, obj);
lv_anim_set_ready_cb(&a, scroll_anim_ready_cb);
if(dx) {
uint32_t t = lv_anim_speed_to_time((lv_disp_get_hor_res(d) * 2) >> 2, 0, dx);
uint32_t t = lv_anim_speed_to_time((lv_display_get_horizontal_resolution(d) * 2) >> 2, 0, dx);
if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN;
if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX;
lv_anim_set_time(&a, t);
@@ -322,14 +322,14 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab
lv_anim_set_exec_cb(&a, scroll_x_anim);
lv_anim_set_path_cb(&a, lv_anim_path_ease_out);
lv_res_t res;
lv_result_t res;
res = lv_obj_send_event(obj, LV_EVENT_SCROLL_BEGIN, &a);
if(res != LV_RES_OK) return;
if(res != LV_RESULT_OK) return;
lv_anim_start(&a);
}
if(dy) {
uint32_t t = lv_anim_speed_to_time((lv_disp_get_ver_res(d) * 2) >> 2, 0, dy);
uint32_t t = lv_anim_speed_to_time((lv_display_get_vertical_resolution(d) * 2) >> 2, 0, dy);
if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN;
if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX;
lv_anim_set_time(&a, t);
@@ -338,9 +338,9 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab
lv_anim_set_exec_cb(&a, scroll_y_anim);
lv_anim_set_path_cb(&a, lv_anim_path_ease_out);
lv_res_t res;
lv_result_t res;
res = lv_obj_send_event(obj, LV_EVENT_SCROLL_BEGIN, &a);
if(res != LV_RES_OK) return;
if(res != LV_RESULT_OK) return;
lv_anim_start(&a);
}
}
@@ -349,15 +349,15 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab
lv_anim_del(obj, scroll_y_anim);
lv_anim_del(obj, scroll_x_anim);
lv_res_t res;
lv_result_t res;
res = lv_obj_send_event(obj, LV_EVENT_SCROLL_BEGIN, NULL);
if(res != LV_RES_OK) return;
if(res != LV_RESULT_OK) return;
res = _lv_obj_scroll_by_raw(obj, dx, dy);
if(res != LV_RES_OK) return;
if(res != LV_RESULT_OK) return;
res = lv_obj_send_event(obj, LV_EVENT_SCROLL_END, NULL);
if(res != LV_RES_OK) return;
if(res != LV_RESULT_OK) return;
}
}
@@ -411,9 +411,9 @@ void lv_obj_scroll_to_view_recursive(lv_obj_t * obj, lv_anim_enable_t anim_en)
}
}
lv_res_t _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
lv_result_t _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
{
if(x == 0 && y == 0) return LV_RES_OK;
if(x == 0 && y == 0) return LV_RESULT_OK;
lv_obj_allocate_spec_attr(obj);
@@ -421,10 +421,10 @@ lv_res_t _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
obj->spec_attr->scroll.y += y;
lv_obj_move_children_by(obj, x, y, true);
lv_res_t res = lv_obj_send_event(obj, LV_EVENT_SCROLL, NULL);
if(res != LV_RES_OK) return res;
lv_result_t res = lv_obj_send_event(obj, LV_EVENT_SCROLL, NULL);
if(res != LV_RESULT_OK) return res;
lv_obj_invalidate(obj);
return LV_RES_OK;
return LV_RESULT_OK;
}
@@ -785,9 +785,9 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
bool y_del = lv_anim_del(parent, scroll_y_anim);
bool x_del = lv_anim_del(parent, scroll_x_anim);
if(y_del || x_del) {
lv_res_t res;
lv_result_t res;
res = lv_obj_send_event(parent, LV_EVENT_SCROLL_END, NULL);
if(res != LV_RES_OK) return;
if(res != LV_RESULT_OK) return;
}
if((scroll_dir & LV_DIR_LEFT) == 0 && x_scroll < 0) x_scroll = 0;
+3 -3
View File
@@ -265,10 +265,10 @@ void lv_obj_scroll_to_view_recursive(struct _lv_obj_t * obj, lv_anim_enable_t an
* @param obj pointer to an object to scroll
* @param x pixels to scroll horizontally
* @param y pixels to scroll vertically
* @return `LV_RES_INV`: to object was deleted in `LV_EVENT_SCROLL`;
* `LV_RES_OK`: if the object is still valid
* @return `LV_RESULT_INVALID`: to object was deleted in `LV_EVENT_SCROLL`;
* `LV_RESULT_OK`: if the object is still valid
*/
lv_res_t _lv_obj_scroll_by_raw(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
lv_result_t _lv_obj_scroll_by_raw(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
/**
* Tell whether an object is being scrolled or not at this moment

Some files were not shown because too many files have changed in this diff Show More