BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lvgl
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
lvgl
Commits
d93844bd
Commit
d93844bd
authored
Apr 13, 2017
by
Gabor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv_rect renamed to lv_cont (container)
parent
092c0da4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
178 additions
and
179 deletions
+178
-179
lv_app.c
lv_app/lv_app.c
+10
-10
lv_app_fsel.c
lv_app/lv_app_util/lv_app_fsel.c
+1
-2
lv_app_notice.c
lv_app/lv_app_util/lv_app_notice.c
+3
-3
lv_app_files.c
lv_appx/lv_app_files.c
+7
-7
lv_app_sysmon.c
lv_appx/lv_app_sysmon.c
+2
-4
lv_app_terminal.c
lv_appx/lv_app_terminal.c
+2
-2
lv_draw.c
lv_draw/lv_draw.c
+24
-24
lv_draw.h
lv_draw/lv_draw.h
+1
-1
lv_obj.c
lv_obj/lv_obj.c
+1
-1
lv_bar.c
lv_objx/lv_bar.c
+2
-2
lv_bar.h
lv_objx/lv_bar.h
+1
-1
lv_btn.c
lv_objx/lv_btn.c
+3
-3
lv_btn.h
lv_objx/lv_btn.h
+2
-2
lv_btnm.c
lv_objx/lv_btnm.c
+2
-2
lv_btnm.h
lv_objx/lv_btnm.h
+2
-2
lv_cb.c
lv_objx/lv_cb.c
+2
-2
lv_chart.c
lv_objx/lv_chart.c
+14
-14
lv_chart.h
lv_objx/lv_chart.h
+1
-1
lv_cont.c
lv_objx/lv_cont.c
+0
-0
lv_cont.h
lv_objx/lv_cont.h
+41
-41
lv_ddlist.c
lv_objx/lv_ddlist.c
+1
-1
lv_gauge.c
lv_objx/lv_gauge.c
+5
-4
lv_gauge.h
lv_objx/lv_gauge.h
+1
-1
lv_img.c
lv_objx/lv_img.c
+1
-1
lv_led.c
lv_objx/lv_led.c
+3
-3
lv_led.h
lv_objx/lv_led.h
+1
-1
lv_line.c
lv_objx/lv_line.c
+2
-2
lv_list.c
lv_objx/lv_list.c
+5
-5
lv_mbox.c
lv_objx/lv_mbox.c
+9
-9
lv_mbox.h
lv_objx/lv_mbox.h
+2
-2
lv_page.c
lv_objx/lv_page.c
+8
-8
lv_page.h
lv_objx/lv_page.h
+4
-4
lv_slider.c
lv_objx/lv_slider.c
+2
-1
lv_win.c
lv_objx/lv_win.c
+8
-8
lv_win.h
lv_objx/lv_win.h
+4
-4
lvgl.h
lvgl.h
+1
-1
No files found.
lv_app/lv_app.c
View file @
d93844bd
...
...
@@ -257,7 +257,7 @@ lv_obj_t * lv_app_sc_open(lv_app_inst_t * app)
lv_obj_set_free_p
(
app
->
sc
,
app
);
lv_btn_set_styles
(
app
->
sc
,
&
app_style
.
sc_rel
,
&
app_style
.
sc_pr
,
NULL
,
NULL
,
NULL
);
lv_obj_set_size
(
app
->
sc
,
LV_APP_SC_WIDTH
,
LV_APP_SC_HEIGHT
);
lv_
rect_set_layout
(
app
->
sc
,
LV_REC
T_LAYOUT_OFF
);
lv_
cont_set_layout
(
app
->
sc
,
LV_CON
T_LAYOUT_OFF
);
lv_btn_set_rel_action
(
app
->
sc
,
lv_app_sc_rel_action
);
lv_btn_set_lpr_action
(
app
->
sc
,
lv_app_sc_lpr_action
);
...
...
@@ -545,23 +545,23 @@ lv_app_style_t * lv_app_style_get(void)
static
void
lv_app_init_desktop
(
void
)
{
/*Menu on the top*/
menuh
=
lv_
rec
t_create
(
lv_scr_act
(),
NULL
);
menuh
=
lv_
con
t_create
(
lv_scr_act
(),
NULL
);
lv_obj_set_width
(
menuh
,
LV_HOR_RES
);
lv_
rec
t_set_fit
(
menuh
,
false
,
true
);
lv_
con
t_set_fit
(
menuh
,
false
,
true
);
lv_obj_set_style
(
menuh
,
&
app_style
.
menu
);
app_btn
=
lv_btn_create
(
menuh
,
NULL
);
lv_btn_set_styles
(
app_btn
,
&
app_style
.
menu_btn_rel
,
&
app_style
.
menu_btn_pr
,
NULL
,
NULL
,
NULL
);
lv_
rec
t_set_fit
(
app_btn
,
true
,
true
);
lv_
con
t_set_fit
(
app_btn
,
true
,
true
);
lv_btn_set_rel_action
(
app_btn
,
lv_app_menu_rel_action
);
lv_obj_t
*
app_label
=
lv_label_create
(
app_btn
,
NULL
);
lv_label_set_text
(
app_label
,
"Apps"
);
lv_obj_set_pos
(
app_btn
,
0
,
0
);
lv_obj_set_pos
(
menuh
,
0
,
0
);
/*
sys_apph = lv_
rec
t_create(menuh, NULL);
lv_
rect_set_layout(sys_apph, LV_REC
T_LAYOUT_ROW_M);
lv_
rec
t_set_fit(sys_apph, true, false);
sys_apph = lv_
con
t_create(menuh, NULL);
lv_
cont_set_layout(sys_apph, LV_CON
T_LAYOUT_ROW_M);
lv_
con
t_set_fit(sys_apph, true, false);
lv_obj_set_style(sys_apph, lv_rects_get(LV_RECTS_TRANSP, NULL));
lv_obj_t * clock = lv_label_create(sys_apph, NULL);
lv_obj_set_style(clock, &app_style.menu_btn_label);
...
...
@@ -576,8 +576,8 @@ static void lv_app_init_desktop(void)
lv_obj_set_size
(
sc_page
,
LV_HOR_RES
,
LV_VER_RES
-
lv_obj_get_height
(
menuh
));
lv_obj_set_pos
(
sc_page
,
0
,
lv_obj_get_height
(
menuh
));
lv_obj_set_width
(
lv_page_get_scrl
(
sc_page
),
LV_HOR_RES
-
20
);
lv_
rec
t_set_fit
(
lv_page_get_scrl
(
sc_page
),
false
,
true
);
lv_
rect_set_layout
(
lv_page_get_scrl
(
sc_page
),
LV_REC
T_LAYOUT_GRID
);
lv_
con
t_set_fit
(
lv_page_get_scrl
(
sc_page
),
false
,
true
);
lv_
cont_set_layout
(
lv_page_get_scrl
(
sc_page
),
LV_CON
T_LAYOUT_GRID
);
lv_page_set_rel_action
(
sc_page
,
lv_app_sc_page_rel_action
);
lv_page_set_sb_mode
(
sc_page
,
LV_PAGE_SB_MODE_AUTO
);
...
...
@@ -849,7 +849,7 @@ static lv_action_res_t lv_app_win_conf_action(lv_obj_t * set_btn, lv_dispi_t * d
sprintf
(
buf
,
"%s settings"
,
app
->
dsc
->
name
);
lv_win_set_title
(
app
->
conf_win
,
buf
);
lv_obj_t
*
scrl
=
lv_page_get_scrl
(
app
->
conf_win
);
lv_
rect_set_layout
(
scrl
,
LV_REC
T_LAYOUT_COL_L
);
lv_
cont_set_layout
(
scrl
,
LV_CON
T_LAYOUT_COL_L
);
lv_win_add_ctrl_btn
(
app
->
conf_win
,
"U:/icon_close"
,
lv_win_close_action
);
...
...
lv_app/lv_app_util/lv_app_fsel.c
View file @
d93844bd
...
...
@@ -91,7 +91,6 @@ void lv_app_fsel_open(const char * path, const char * filter, void * param, void
if
(
fsel_filter
==
NULL
)
fsel_filter
=
""
;
/*Create a window for the File selector*/
lv_app_style_t
*
app_style
=
lv_app_style_get
();
fsel_win
=
lv_win_create
(
lv_scr_act
(),
NULL
);
lv_obj_set_size
(
fsel_win
,
LV_HOR_RES
,
LV_VER_RES
);
...
...
@@ -142,7 +141,7 @@ static void fsel_refr(void)
//TODO lv_obj_set_style(fsel_list, lv_lists_get(LV_LISTS_TRANSP, NULL));
lv_obj_set_drag_parent
(
fsel_list
,
true
);
lv_obj_set_drag_parent
(
lv_page_get_scrl
(
fsel_list
),
true
);
lv_
rec
t_set_fit
(
fsel_list
,
false
,
true
);
lv_
con
t_set_fit
(
fsel_list
,
false
,
true
);
fs_res_t
res
=
FS_RES_OK
;
...
...
lv_app/lv_app_util/lv_app_notice.c
View file @
d93844bd
...
...
@@ -9,7 +9,7 @@
#include "lv_app_notice.h"
#if LV_APP_ENABLE != 0
#include
"lvgl/lv_objx/lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lvgl/lv_objx/lv_label.h"
#include "lvgl/lv_misc/anim.h"
...
...
@@ -56,12 +56,12 @@ static lv_obj_t * notice_h;
*/
void
lv_app_notice_init
(
void
)
{
notice_h
=
lv_
rec
t_create
(
lv_scr_act
(),
NULL
);
notice_h
=
lv_
con
t_create
(
lv_scr_act
(),
NULL
);
lv_obj_set_size
(
notice_h
,
LV_HOR_RES
,
LV_VER_RES
-
LV_DPI
);
lv_obj_set_y
(
notice_h
,
LV_DPI
);
lv_obj_set_click
(
notice_h
,
false
);
lv_obj_set_style
(
notice_h
,
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
));
lv_
rect_set_layout
(
notice_h
,
LV_REC
T_LAYOUT_COL_R
);
lv_
cont_set_layout
(
notice_h
,
LV_CON
T_LAYOUT_COL_R
);
}
/**
...
...
lv_appx/lv_app_files.c
View file @
d93844bd
...
...
@@ -299,11 +299,11 @@ static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win)
/*Create a text area to type chunk size*/
lv_obj_t
*
val_set_h
;
val_set_h
=
lv_
rec
t_create
(
conf_win
,
NULL
);
val_set_h
=
lv_
con
t_create
(
conf_win
,
NULL
);
lv_obj_set_style
(
val_set_h
,
lv_style_get
(
LV_STYLE_PLAIN_COLOR
,
NULL
));
lv_obj_set_click
(
val_set_h
,
false
);
lv_
rec
t_set_fit
(
val_set_h
,
true
,
true
);
lv_
rect_set_layout
(
val_set_h
,
LV_REC
T_LAYOUT_ROW_M
);
lv_
con
t_set_fit
(
val_set_h
,
true
,
true
);
lv_
cont_set_layout
(
val_set_h
,
LV_CON
T_LAYOUT_ROW_M
);
lv_obj_t
*
label
;
label
=
lv_label_create
(
val_set_h
,
NULL
);
...
...
@@ -312,7 +312,7 @@ static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win)
lv_obj_t
*
ta
;
char
buf
[
32
];
ta
=
lv_ta_create
(
val_set_h
,
NULL
);
lv_
rec
t_set_fit
(
ta
,
false
,
true
);
lv_
con
t_set_fit
(
ta
,
false
,
true
);
lv_obj_set_free_num
(
ta
,
SEND_SETTINGS_CHUNK_SIZE
);
lv_obj_set_free_p
(
ta
,
app
);
lv_page_set_rel_action
(
ta
,
win_send_settings_element_rel_action
);
...
...
@@ -320,7 +320,7 @@ static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win)
lv_ta_set_text
(
ta
,
buf
);
/*Create a text area to type the chunk delay*/
val_set_h
=
lv_
rec
t_create
(
conf_win
,
val_set_h
);
val_set_h
=
lv_
con
t_create
(
conf_win
,
val_set_h
);
label
=
lv_label_create
(
val_set_h
,
NULL
);
lv_label_set_text
(
label
,
"Inter-chunk delay"
);
...
...
@@ -353,8 +353,8 @@ static void win_create_list(lv_app_inst_t * app)
//TODO lv_obj_set_style(win_data->file_list, lv_lists_get(LV_LISTS_TRANSP, NULL));
lv_obj_set_drag_parent
(
win_data
->
file_list
,
true
);
lv_obj_set_drag_parent
(
lv_page_get_scrl
(
win_data
->
file_list
),
true
);
lv_
rec
t_set_fit
(
win_data
->
file_list
,
false
,
true
);
lv_
rect_set_layout
(
lv_page_get_scrl
(
win_data
->
file_list
),
LV_REC
T_LAYOUT_COL_L
);
lv_
con
t_set_fit
(
win_data
->
file_list
,
false
,
true
);
lv_
cont_set_layout
(
lv_page_get_scrl
(
win_data
->
file_list
),
LV_CON
T_LAYOUT_COL_L
);
}
/**
...
...
lv_appx/lv_app_sysmon.c
View file @
d93844bd
...
...
@@ -308,8 +308,7 @@ static void sysmon_task(void * param)
static
bool
mem_warn_report
=
false
;
if
(
mem_mon
.
size_free
<
LV_APP_SYSMON_MEM_WARN
&&
mem_warn_report
==
false
)
{
mem_warn_report
=
true
;
lv_obj_t
*
not
=
lv_app_notice_add
(
"Critically low memory"
);
//TODO lv_obj_set_style(not, lv_mboxs_get(LV_MBOXS_WARN, NULL));
lv_app_notice_add
(
"Critically low memory"
);
}
if
(
mem_mon
.
size_free
>
LV_APP_SYSMON_MEM_WARN
)
mem_warn_report
=
false
;
...
...
@@ -318,8 +317,7 @@ static void sysmon_task(void * param)
if
(
mem_mon
.
pct_frag
>
LV_APP_SYSMON_FRAG_WARN
)
{
if
(
frag_warn_report
==
false
)
{
frag_warn_report
=
true
;
lv_obj_t
*
not
=
lv_app_notice_add
(
"Critical memory
\n
fragmentation"
);
//TODO lv_obj_set_style(not, lv_mboxs_get(LV_MBOXS_WARN, NULL));
lv_app_notice_add
(
"Critical memory
\n
fragmentation"
);
dm_defrag
();
/*Defrag. if the fragmentation is critical*/
}
...
...
lv_appx/lv_app_terminal.c
View file @
d93844bd
...
...
@@ -12,10 +12,10 @@
#include <lvgl/lv_obj/lv_dispi.h>
#include <lvgl/lv_obj/lv_obj.h>
#include <lvgl/lv_objx/lv_btn.h>
#include <lvgl/lv_objx/lv_cont.h>
#include <lvgl/lv_objx/lv_ddlist.h>
#include <lvgl/lv_objx/lv_label.h>
#include <lvgl/lv_objx/lv_page.h>
#include <lvgl/lv_objx/lv_rect.h>
#include <lvgl/lv_objx/lv_ta.h>
#include <misc/others/color.h>
#include <stdbool.h>
...
...
@@ -263,7 +263,7 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win)
/*Create a clear button*/
win_data
->
clear_btn
=
lv_btn_create
(
win
,
NULL
);
lv_
rec
t_set_fit
(
win_data
->
clear_btn
,
true
,
true
);
lv_
con
t_set_fit
(
win_data
->
clear_btn
,
true
,
true
);
lv_obj_set_free_p
(
win_data
->
clear_btn
,
app
);
lv_btn_set_rel_action
(
win_data
->
clear_btn
,
win_clear_rel_action
);
lv_obj_t
*
btn_label
=
lv_label_create
(
win_data
->
clear_btn
,
NULL
);
...
...
lv_draw/lv_draw.c
View file @
d93844bd
...
...
@@ -43,12 +43,12 @@ typedef enum
* STATIC PROTOTYPES
**********************/
#if USE_LV_RECT != 0
static
void
lv_draw_
rec
t_main_mid
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
);
static
void
lv_draw_
rec
t_main_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
);
static
void
lv_draw_
rec
t_border_straight
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
);
static
void
lv_draw_
rec
t_border_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
);
static
void
lv_draw_
rec
t_shadow
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
);
static
uint16_t
lv_draw_
rec
t_radius_corr
(
uint16_t
r
,
cord_t
w
,
cord_t
h
);
static
void
lv_draw_
con
t_main_mid
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
);
static
void
lv_draw_
con
t_main_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
);
static
void
lv_draw_
con
t_border_straight
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
);
static
void
lv_draw_
con
t_border_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
);
static
void
lv_draw_
con
t_shadow
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
);
static
uint16_t
lv_draw_
con
t_radius_corr
(
uint16_t
r
,
cord_t
w
,
cord_t
h
);
#endif
/*USE_LV_RECT != 0*/
...
...
@@ -90,23 +90,23 @@ void lv_draw_rect(const area_t * cords_p, const area_t * mask_p, const lv_style_
if
(
area_get_height
(
cords_p
)
<
1
||
area_get_width
(
cords_p
)
<
1
)
return
;
if
(
style_p
->
empty
==
0
){
lv_draw_
rec
t_main_mid
(
cords_p
,
mask_p
,
style_p
);
lv_draw_
con
t_main_mid
(
cords_p
,
mask_p
,
style_p
);
if
(
style_p
->
radius
!=
0
)
{
lv_draw_
rec
t_main_corner
(
cords_p
,
mask_p
,
style_p
);
lv_draw_
con
t_main_corner
(
cords_p
,
mask_p
,
style_p
);
}
}
if
(
style_p
->
bwidth
!=
0
)
{
lv_draw_
rec
t_border_straight
(
cords_p
,
mask_p
,
style_p
);
lv_draw_
con
t_border_straight
(
cords_p
,
mask_p
,
style_p
);
if
(
style_p
->
radius
!=
0
)
{
lv_draw_
rec
t_border_corner
(
cords_p
,
mask_p
,
style_p
);
lv_draw_
con
t_border_corner
(
cords_p
,
mask_p
,
style_p
);
}
}
if
(
style_p
->
swidth
!=
0
)
{
lv_draw_
rec
t_shadow
(
cords_p
,
mask_p
,
style_p
);
lv_draw_
con
t_shadow
(
cords_p
,
mask_p
,
style_p
);
}
}
#endif
/*USE_LV_RECT != 0*/
...
...
@@ -573,7 +573,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
* @param mask_p the rectangle will be drawn only on this area
* @param rects_p pointer to a rectangle style
*/
static
void
lv_draw_
rec
t_main_mid
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
)
static
void
lv_draw_
con
t_main_mid
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
)
{
uint16_t
radius
=
style
->
radius
;
...
...
@@ -584,7 +584,7 @@ static void lv_draw_rect_main_mid(const area_t * cords_p, const area_t * mask_p,
cord_t
height
=
area_get_height
(
cords_p
);
cord_t
width
=
area_get_width
(
cords_p
);
radius
=
lv_draw_
rec
t_radius_corr
(
radius
,
width
,
height
);
radius
=
lv_draw_
con
t_radius_corr
(
radius
,
width
,
height
);
/*If the radius is too big then there is no body*/
if
(
radius
>
height
/
2
)
return
;
...
...
@@ -623,7 +623,7 @@ static void lv_draw_rect_main_mid(const area_t * cords_p, const area_t * mask_p,
* @param mask_p the rectangle will be drawn only on this area
* @param rects_p pointer to a rectangle style
*/
static
void
lv_draw_
rec
t_main_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
)
static
void
lv_draw_
con
t_main_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
)
{
uint16_t
radius
=
style_p
->
radius
;
...
...
@@ -635,7 +635,7 @@ static void lv_draw_rect_main_corner(const area_t * cords_p, const area_t * mask
cord_t
height
=
area_get_height
(
cords_p
);
cord_t
width
=
area_get_width
(
cords_p
);
radius
=
lv_draw_
rec
t_radius_corr
(
radius
,
width
,
height
);
radius
=
lv_draw_
con
t_radius_corr
(
radius
,
width
,
height
);
point_t
lt_origo
;
/*Left Top origo*/
point_t
lb_origo
;
/*Left Bottom origo*/
...
...
@@ -794,7 +794,7 @@ if(edge_top_area.y1 != mid_top_area.y1) {
* @param mask_p the rectangle will be drawn only on this area
* @param rects_p pointer to a rectangle style
*/
static
void
lv_draw_
rec
t_border_straight
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
)
static
void
lv_draw_
con
t_border_straight
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style_p
)
{
uint16_t
radius
=
style_p
->
radius
;
...
...
@@ -809,7 +809,7 @@ static void lv_draw_rect_border_straight(const area_t * cords_p, const area_t *
/*the 0 px border width drawn as 1 px, so decrement the b_width*/
bwidth
--
;
radius
=
lv_draw_
rec
t_radius_corr
(
radius
,
width
,
height
);
radius
=
lv_draw_
con
t_radius_corr
(
radius
,
width
,
height
);
if
(
radius
<
bwidth
)
{
length_corr
=
bwidth
-
radius
;
...
...
@@ -910,7 +910,7 @@ static void lv_draw_rect_border_straight(const area_t * cords_p, const area_t *
* @param rects_p pointer to a rectangle style
* @param opa opacity of the rectangle (0..255)
*/
static
void
lv_draw_
rec
t_border_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
)
static
void
lv_draw_
con
t_border_corner
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
)
{
uint16_t
radius
=
style
->
radius
;
uint16_t
bwidth
=
style
->
bwidth
;
...
...
@@ -923,7 +923,7 @@ static void lv_draw_rect_border_corner(const area_t * cords_p, const area_t * ma
cord_t
width
=
area_get_width
(
cords_p
);
cord_t
height
=
area_get_height
(
cords_p
);
radius
=
lv_draw_
rec
t_radius_corr
(
radius
,
width
,
height
);
radius
=
lv_draw_
con
t_radius_corr
(
radius
,
width
,
height
);
point_t
lt_origo
;
/*Left Top origo*/
point_t
lb_origo
;
/*Left Bottom origo*/
...
...
@@ -1045,7 +1045,7 @@ static void lv_draw_rect_border_corner(const area_t * cords_p, const area_t * ma
* @param rect pointer to rectangle object
* @param mask pointer to a mask area (from the design functions)
*/
static
void
lv_draw_
rec
t_shadow
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
)
static
void
lv_draw_
con
t_shadow
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_style_t
*
style
)
{
cord_t
swidth
=
style
->
swidth
;
if
(
swidth
==
0
)
return
;
...
...
@@ -1061,7 +1061,7 @@ static void lv_draw_rect_shadow(const area_t * cords_p, const area_t * mask_p, c
shadow_style
.
empty
=
1
;
shadow_style
.
bwidth
=
swidth
;
shadow_style
.
radius
=
style
->
radius
;
if
(
shadow_style
.
radius
==
LV_
REC
T_CIRCLE
)
{
if
(
shadow_style
.
radius
==
LV_
CON
T_CIRCLE
)
{
shadow_style
.
radius
=
MATH_MIN
(
area_get_width
(
cords_p
),
area_get_height
(
cords_p
));
}
shadow_style
.
radius
+=
swidth
+
1
;
...
...
@@ -1077,8 +1077,8 @@ static void lv_draw_rect_shadow(const area_t * cords_p, const area_t * mask_p, c
shadow_style
.
opa
=
style
->
opa
/
(
swidth
/
res
);
for
(
i
=
1
;
i
<
swidth
;
i
+=
res
)
{
lv_draw_
rec
t_border_straight
(
&
shadow_area
,
mask_p
,
&
shadow_style
);
lv_draw_
rec
t_border_corner
(
&
shadow_area
,
mask_p
,
&
shadow_style
);
lv_draw_
con
t_border_straight
(
&
shadow_area
,
mask_p
,
&
shadow_style
);
lv_draw_
con
t_border_corner
(
&
shadow_area
,
mask_p
,
&
shadow_style
);
shadow_style
.
radius
-=
res
;
shadow_style
.
bwidth
-=
res
;
shadow_area
.
x1
+=
res
;
...
...
@@ -1089,7 +1089,7 @@ static void lv_draw_rect_shadow(const area_t * cords_p, const area_t * mask_p, c
}
static
uint16_t
lv_draw_
rec
t_radius_corr
(
uint16_t
r
,
cord_t
w
,
cord_t
h
)
static
uint16_t
lv_draw_
con
t_radius_corr
(
uint16_t
r
,
cord_t
w
,
cord_t
h
)
{
if
(
r
>=
(
w
>>
1
)){
r
=
(
w
>>
1
);
...
...
lv_draw/lv_draw.h
View file @
d93844bd
...
...
@@ -16,7 +16,7 @@
/*********************
* DEFINES
*********************/
#define LV_
REC
T_CIRCLE ((cord_t)-1)
/*A very big radius to always draw as circle*/
#define LV_
CON
T_CIRCLE ((cord_t)-1)
/*A very big radius to always draw as circle*/
/**********************
* TYPEDEFS
...
...
lv_obj/lv_obj.c
View file @
d93844bd
...
...
@@ -1440,7 +1440,7 @@ static bool lv_obj_design(lv_obj_t * obj, const area_t * mask_p, lv_design_mode
uint16_t
r
=
style
->
radius
;
if
(
r
==
LV_
REC
T_CIRCLE
)
return
false
;
if
(
r
==
LV_
CON
T_CIRCLE
)
return
false
;
area_t
area_tmp
;
...
...
lv_objx/lv_bar.c
View file @
d93844bd
...
...
@@ -67,7 +67,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy)
ext
->
act_value
=
0
;
ext
->
style_indic
=
lv_style_get
(
LV_STYLE_PRETTY_COLOR
,
NULL
);
/* Save the
rectangle
design function.
/* Save the
ancient
design function.
* It will be used in the bar design function*/
if
(
ancestor_design_f
==
NULL
)
ancestor_design_f
=
lv_obj_get_design_f
(
new_bar
);
...
...
@@ -106,7 +106,7 @@ bool lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param)
bool
valid
;
/* Include the ancient signal function */
valid
=
lv_
rec
t_signal
(
bar
,
sign
,
param
);
valid
=
lv_
con
t_signal
(
bar
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
lv_objx/lv_bar.h
View file @
d93844bd
...
...
@@ -22,7 +22,7 @@
#endif
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_btn.h"
#include "lv_label.h"
...
...
lv_objx/lv_btn.c
View file @
d93844bd
...
...
@@ -55,7 +55,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy)
{
lv_obj_t
*
new_btn
;
new_btn
=
lv_
rec
t_create
(
par
,
copy
);
new_btn
=
lv_
con
t_create
(
par
,
copy
);
dm_assert
(
new_btn
);
/*Allocate the extended data*/
lv_btn_ext_t
*
ext
=
lv_obj_alloc_ext
(
new_btn
,
sizeof
(
lv_btn_ext_t
));
...
...
@@ -77,7 +77,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy)
/*If no copy do the basic initialization*/
if
(
copy
==
NULL
)
{
lv_
rect_set_layout
(
new_btn
,
LV_REC
T_LAYOUT_CENTER
);
lv_
cont_set_layout
(
new_btn
,
LV_CON
T_LAYOUT_CENTER
);
lv_obj_set_style
(
new_btn
,
ext
->
styles
[
LV_BTN_STATE_REL
]);
}
/*Copy 'copy'*/
...
...
@@ -113,7 +113,7 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
bool
valid
;
/* Include the ancient signal function */
valid
=
lv_
rec
t_signal
(
btn
,
sign
,
param
);
valid
=
lv_
con
t_signal
(
btn
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
lv_objx/lv_btn.h
View file @
d93844bd
...
...
@@ -17,7 +17,7 @@
#error "lv_btn: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
#endif
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "../lv_obj/lv_dispi.h"
/*********************
...
...
@@ -42,7 +42,7 @@ typedef enum
/*Data of button*/
typedef
struct
{
lv_
rect_ext_t
rec
t
;
/*Ext. of ancestor*/
lv_
cont_ext_t
con
t
;
/*Ext. of ancestor*/
/*New data for this type */
lv_action_t
pr_action
;
/*A function to call when the button is pressed (NULL if unused)*/
lv_action_t
rel_action
;
/*A function to call when the button is released (NULL if unused)*/
...
...
lv_objx/lv_btnm.c
View file @
d93844bd
...
...
@@ -61,7 +61,7 @@ static lv_design_f_t ancestor_design_f;
lv_obj_t
*
lv_btnm_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
{
/*Create the ancestor object*/
lv_obj_t
*
new_btnm
=
lv_
rec
t_create
(
par
,
copy
);
lv_obj_t
*
new_btnm
=
lv_
con
t_create
(
par
,
copy
);
dm_assert
(
new_btnm
);
/*Allocate the object type specific extended data*/
...
...
@@ -106,7 +106,7 @@ bool lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
bool
valid
;
/* Include the ancient signal function */
valid
=
lv_
rec
t_signal
(
btnm
,
sign
,
param
);
valid
=
lv_
con
t_signal
(
btnm
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
lv_objx/lv_btnm.h
View file @
d93844bd
...
...
@@ -23,7 +23,7 @@
#endif
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_label.h"
#include "lv_btn.h"
...
...
@@ -43,7 +43,7 @@ typedef lv_action_res_t (*lv_btnm_callback_t) (lv_obj_t *, uint16_t);
/*Data of button matrix*/
typedef
struct
{
lv_
rec
t_ext_t
bg
;
/*Ext. of ancestor*/
lv_
con
t_ext_t
bg
;
/*Ext. of ancestor*/
/*New data for this type */
const
char
**
map_p
;
/*Pointer to the current map*/
area_t
*
btn_areas
;
/*Array of areas for the buttons (Handled by the library)*/
...
...
lv_objx/lv_cb.c
View file @
d93844bd
...
...
@@ -68,8 +68,8 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
lv_btn_set_styles
(
new_cb
,
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
),
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
),
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
),
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
),
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
));
lv_
rect_set_layout
(
new_cb
,
LV_REC
T_LAYOUT_ROW_M
);
lv_
rec
t_set_fit
(
new_cb
,
true
,
true
);
lv_
cont_set_layout
(
new_cb
,
LV_CON
T_LAYOUT_ROW_M
);
lv_
con
t_set_fit
(
new_cb
,
true
,
true
);
lv_btn_set_tgl
(
new_cb
,
true
);
lv_obj_set_click
(
ext
->
bullet
,
false
);
...
...
lv_objx/lv_chart.c
View file @
d93844bd
...
...
@@ -484,32 +484,32 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
int32_t
y_tmp
;
lv_chart_dl_t
*
dl
;
uint8_t
dl_cnt
=
0
;
lv_style_t
rects
;
lv_style_get
(
LV_STYLE_PLAIN
,
&
rects
);
lv_style_t
style_point
;
lv_style_get
(
LV_STYLE_PLAIN
,
&
style_point
);
rects
.
bwidth
=
0
;
rects
.
empty
=
0
;
rects
.
radius
=
LV_REC
T_CIRCLE
;
rects
.
opa
=
(
uint16_t
)((
uint16_t
)
style
->
opa
*
ext
->
data_opa
)
>>
8
;
style_point
.
bwidth
=
0
;
style_point
.
empty
=
0
;
style_point
.
radius
=
LV_CON
T_CIRCLE
;
style_point
.
opa
=
(
uint16_t
)((
uint16_t
)
style
->
opa
*
ext
->
data_opa
)
>>
8
;
/*Go through all data lines*/
LL_READ_BACK
(
ext
->
dl_ll
,
dl
)
{
rects
.
radius
=
dl
->
width
;
rects
.
mcolor
=
dl
->
color
;
rects
.
gcolor
=
color_mix
(
COLOR_BLACK
,
dl
->
color
,
ext
->
dark_eff
);
style_point
.
radius
=
dl
->
width
;
style_point
.
mcolor
=
dl
->
color
;
style_point
.
gcolor
=
color_mix
(
COLOR_BLACK
,
dl
->
color
,
ext
->
dark_eff
);
for
(
i
=
0
;
i
<
ext
->
pnum
;
i
++
)
{
cir_a
.
x1
=
((
w
*
i
)
/
(
ext
->
pnum
-
1
))
+
x_ofs
;
cir_a
.
x2
=
cir_a
.
x1
+
rects
.
radius
;
cir_a
.
x1
-=
rects
.
radius
;
cir_a
.
x2
=
cir_a
.
x1
+
style_point
.
radius
;
cir_a
.
x1
-=
style_point
.
radius
;
y_tmp
=
(
int32_t
)((
int32_t
)
dl
->
points
[
i
]
-
ext
->
ymin
)
*
h
;
y_tmp
=
y_tmp
/
(
ext
->
ymax
-
ext
->
ymin
);
cir_a
.
y1
=
h
-
y_tmp
+
y_ofs
;
cir_a
.
y2
=
cir_a
.
y1
+
rects
.
radius
;
cir_a
.
y1
-=
rects
.
radius
;
cir_a
.
y2
=
cir_a
.
y1
+
style_point
.
radius
;
cir_a
.
y1
-=
style_point
.
radius
;
lv_draw_rect
(
&
cir_a
,
mask
,
&
rects
);
lv_draw_rect
(
&
cir_a
,
mask
,
&
style_point
);
}
dl_cnt
++
;
}
...
...
lv_objx/lv_chart.h
View file @
d93844bd
...
...
@@ -22,7 +22,7 @@
#endif
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_line.h"
/*********************
...
...
lv_objx/lv_
rec
t.c
→
lv_objx/lv_
con
t.c
View file @
d93844bd
This diff is collapsed.
Click to expand it.
lv_objx/lv_
rec
t.h
→
lv_objx/lv_
con
t.h
View file @
d93844bd
/**
* @file lv_
rec
t.h
* @file lv_
con
t.h
*
*/
#ifndef LV_
REC
T_H
#define LV_
REC
T_H
#ifndef LV_
CON
T_H
#define LV_
CON
T_H
/*********************
* INCLUDES
...
...
@@ -26,83 +26,83 @@
/*Layout options*/
typedef
enum
{
LV_
REC
T_LAYOUT_OFF
=
0
,
LV_
REC
T_LAYOUT_CENTER
,
LV_
REC
T_LAYOUT_COL_L
,
/*Column left align*/
LV_
REC
T_LAYOUT_COL_M
,
/*Column middle align*/
LV_
REC
T_LAYOUT_COL_R
,
/*Column right align*/
LV_
REC
T_LAYOUT_ROW_T
,
/*Row left align*/
LV_
REC
T_LAYOUT_ROW_M
,
/*Row middle align*/
LV_
REC
T_LAYOUT_ROW_B
,
/*Row right align*/
LV_
REC
T_LAYOUT_PRETTY
,
/*Put as many object as possible in row and begin a new row*/
LV_
REC
T_LAYOUT_GRID
,
/*Align same-sized object into a grid*/
}
lv_
rec
t_layout_t
;
LV_
CON
T_LAYOUT_OFF
=
0
,
LV_
CON
T_LAYOUT_CENTER
,
LV_
CON
T_LAYOUT_COL_L
,
/*Column left align*/
LV_
CON
T_LAYOUT_COL_M
,
/*Column middle align*/
LV_
CON
T_LAYOUT_COL_R
,
/*Column right align*/
LV_
CON
T_LAYOUT_ROW_T
,
/*Row left align*/
LV_
CON
T_LAYOUT_ROW_M
,
/*Row middle align*/
LV_
CON
T_LAYOUT_ROW_B
,
/*Row right align*/
LV_
CON
T_LAYOUT_PRETTY
,
/*Put as many object as possible in row and begin a new row*/
LV_
CON
T_LAYOUT_GRID
,
/*Align same-sized object into a grid*/
}
lv_
con
t_layout_t
;
typedef
struct
{
/*Inherited from 'base_obj' so no inherited ext. */
/*Ext. of ancestor*/
/*New data for this type */
uint8_t
layout
:
5
;
/*Set a layout from 'lv_
rec
t_layout_t' enum*/
uint8_t
layout
:
5
;
/*Set a layout from 'lv_
con
t_layout_t' enum*/
uint8_t
hpad_en
:
1
;
/*Enable horizontal padding according to the children*/
uint8_t
vpad_en
:
1
;
/*Enable horizontal padding according to the children*/
}
lv_
rec
t_ext_t
;
}
lv_
con
t_ext_t
;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a
rectangle
objects
* @param par pointer to an object, it will be the parent of the new
rectangle
* @param copy pointer to a
rectangle
object, if not NULL then the new object will be copied from it
* @return pointer to the created
rectangle
* Create a
container
objects
* @param par pointer to an object, it will be the parent of the new
container
* @param copy pointer to a
container
object, if not NULL then the new object will be copied from it
* @return pointer to the created
container
*/
lv_obj_t
*
lv_
rec
t_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
);
lv_obj_t
*
lv_
con
t_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
);
/**
* Signal function of the
rectangle
* @param
rect pointer to a rectangle
object
* Signal function of the
container
* @param
cont pointer to a container
object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
*/
bool
lv_
rect_signal
(
lv_obj_t
*
rec
t
,
lv_signal_t
sign
,
void
*
param
);
bool
lv_
cont_signal
(
lv_obj_t
*
con
t
,
lv_signal_t
sign
,
void
*
param
);
/**
* Set the layout on a
rectangle
* @param
rect pointer to a rectangle
object
* @param layout a layout from 'lv_
rec
t_layout_t'
* Set the layout on a
container
* @param
cont pointer to a container
object
* @param layout a layout from 'lv_
con
t_layout_t'
*/
void
lv_
rect_set_layout
(
lv_obj_t
*
rect
,
lv_rec
t_layout_t
layout
);
void
lv_
cont_set_layout
(
lv_obj_t
*
cont
,
lv_con
t_layout_t
layout
);
/**
* Enable the horizontal or vertical fit.
* The
rectangle
size will be set to involve the children horizontally or vertically.
* @param
rect pointer to a rectangle
object
* The
container
size will be set to involve the children horizontally or vertically.
* @param
cont pointer to a container
object
* @param hor_en true: enable the horizontal padding
* @param ver_en true: enable the vertical padding
*/
void
lv_
rect_set_fit
(
lv_obj_t
*
rec
t
,
bool
hor_en
,
bool
ver_en
);
void
lv_
cont_set_fit
(
lv_obj_t
*
con
t
,
bool
hor_en
,
bool
ver_en
);
/**
* Get the layout of a
rectangle
* @param
rect pointer to rectangle
object
* @return the layout from 'lv_
rec
t_layout_t'
* Get the layout of a
container
* @param
cont pointer to container
object
* @return the layout from 'lv_
con
t_layout_t'
*/
lv_
rect_layout_t
lv_rect_get_layout
(
lv_obj_t
*
rec
t
);
lv_
cont_layout_t
lv_cont_get_layout
(
lv_obj_t
*
con
t
);
/**
* Get horizontal fit enable attribute of a
rectangle
* @param
rect pointer to a rectangle
object
* Get horizontal fit enable attribute of a
container
* @param
cont pointer to a container
object
* @return true: horizontal padding is enabled
*/
bool
lv_
rect_get_hfit
(
lv_obj_t
*
rec
t
);
bool
lv_
cont_get_hfit
(
lv_obj_t
*
con
t
);
/**
* Get vertical fit enable attribute of a
rectangle
* @param obj pointer to a
rectangle
object
* Get vertical fit enable attribute of a
container
* @param obj pointer to a
container
object
* @return true: vertical padding is enabled
*/
bool
lv_
rect_get_vfit
(
lv_obj_t
*
rec
t
);
bool
lv_
cont_get_vfit
(
lv_obj_t
*
con
t
);
/**********************
...
...
lv_objx/lv_ddlist.c
View file @
d93844bd
...
...
@@ -86,7 +86,7 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
ext
->
opt_label
=
lv_label_create
(
new_ddlist
,
NULL
);
lv_obj_set_style
(
ext
->
opt_label
,
NULL
);
/*Inherit the style*/
lv_
rec
t_set_fit
(
new_ddlist
,
true
,
false
);
lv_
con
t_set_fit
(
new_ddlist
,
true
,
false
);
lv_page_set_rel_action
(
new_ddlist
,
lv_ddlist_rel_action
);
lv_page_set_sb_mode
(
new_ddlist
,
LV_PAGE_SB_MODE_DRAG
);
lv_obj_set_style
(
new_ddlist
,
lv_style_get
(
LV_STYLE_PRETTY
,
NULL
));
...
...
lv_objx/lv_gauge.c
View file @
d93844bd
...
...
@@ -24,6 +24,7 @@
#define LV_GAUGE_DEF_WIDTH (3 * LV_DPI)
#define LV_GAUGE_DEF_HEIGHT (3 * LV_DPI)
#define LV_GAUGE_DEF_NEEDLE_COLOR COLOR_RED
#define LV_GAUGE_DEF_ANGLE 220
/**********************
* TYPEDEFS
**********************/
...
...
@@ -61,7 +62,7 @@ static lv_design_f_t ancestor_design_f = NULL;
lv_obj_t
*
lv_gauge_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
{
/*Create the ancestor gauge*/
lv_obj_t
*
new_gauge
=
lv_
rec
t_create
(
par
,
copy
);
lv_obj_t
*
new_gauge
=
lv_
con
t_create
(
par
,
copy
);
dm_assert
(
new_gauge
);
/*Allocate the gauge type specific extended data*/
...
...
@@ -75,7 +76,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
ext
->
values
=
NULL
;
ext
->
needle_color
=
NULL
;
ext
->
low_critical
=
0
;
ext
->
scale_angle
=
120
;
ext
->
scale_angle
=
LV_GAUGE_DEF_ANGLE
;
ext
->
scale_label_num
=
6
;
ext
->
style_critical
=
lv_style_get
(
LV_STYLE_PRETTY_COLOR
,
NULL
);
...
...
@@ -123,7 +124,7 @@ bool lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param)
bool
valid
;
/* Include the ancient signal function */
valid
=
lv_
rec
t_signal
(
gauge
,
sign
,
param
);
valid
=
lv_
con
t_signal
(
gauge
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
@@ -457,7 +458,7 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style
lv_style_get
(
LV_STYLE_PLAIN
,
&
style_neddle_mid
);
style_neddle_mid
.
mcolor
=
style
->
bcolor
;
style_neddle_mid
.
gcolor
=
style
->
bcolor
;
style_neddle_mid
.
radius
=
LV_
REC
T_CIRCLE
;
style_neddle_mid
.
radius
=
LV_
CON
T_CIRCLE
;
area_t
nm_cord
;
nm_cord
.
x1
=
x_ofs
-
style
->
opad
;
...
...
lv_objx/lv_gauge.h
View file @
d93844bd
...
...
@@ -32,7 +32,7 @@
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_label.h"
#include "lv_line.h"
...
...
lv_objx/lv_img.c
View file @
d93844bd
...
...
@@ -49,7 +49,7 @@ static bool lv_img_is_symbol(const char * txt);
/**
* Create an image objects
* @param par pointer to an object, it will be the parent of the new button
* @param copy pointer to a
rectangl
e object, if not NULL then the new object will be copied from it
* @param copy pointer to a
imag
e object, if not NULL then the new object will be copied from it
* @return pointer to the created image
*/
lv_obj_t
*
lv_img_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
...
...
lv_objx/lv_led.c
View file @
d93844bd
...
...
@@ -9,7 +9,7 @@
#include "lv_conf.h"
#if USE_LV_LED != 0
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_led.h"
#include "../lv_draw/lv_draw.h"
...
...
@@ -56,7 +56,7 @@ static lv_design_f_t ancestor_design_f;
lv_obj_t
*
lv_led_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
{
/*Create the ancestor basic object*/
lv_obj_t
*
new_led
=
lv_
rec
t_create
(
par
,
copy
);
lv_obj_t
*
new_led
=
lv_
con
t_create
(
par
,
copy
);
dm_assert
(
new_led
);
/*Allocate the object type specific extended data*/
...
...
@@ -98,7 +98,7 @@ bool lv_led_signal(lv_obj_t * led, lv_signal_t sign, void * param)
bool
valid
;
/* Include the ancient signal function */
valid
=
lv_
rec
t_signal
(
led
,
sign
,
param
);
valid
=
lv_
con
t_signal
(
led
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
lv_objx/lv_led.h
View file @
d93844bd
...
...
@@ -30,7 +30,7 @@
/*Data of led*/
typedef
struct
{
lv_
rec
t_ext_t
bg_rect
;
/*Ext. of ancestor*/
lv_
con
t_ext_t
bg_rect
;
/*Ext. of ancestor*/
/*New data for this type */
uint8_t
bright
;
/*Current brightness of the LED (0..255)*/
}
lv_led_ext_t
;
...
...
lv_objx/lv_line.c
View file @
d93844bd
...
...
@@ -58,7 +58,7 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t
*
new_line
=
lv_obj_create
(
par
,
copy
);
dm_assert
(
new_line
);
/*Extend the basic object to
rectangl
e object*/
/*Extend the basic object to
lin
e object*/
lv_line_ext_t
*
ext
=
lv_obj_alloc_ext
(
new_line
,
sizeof
(
lv_line_ext_t
));
dm_assert
(
ext
);
ext
->
point_num
=
0
;
...
...
@@ -70,7 +70,7 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_set_design_f
(
new_line
,
lv_line_design
);
lv_obj_set_signal_f
(
new_line
,
lv_line_signal
);
/*Init the new
rectangl
e*/
/*Init the new
lin
e*/
if
(
copy
==
NULL
)
{
lv_obj_set_style
(
new_line
,
lv_style_get
(
LV_STYLE_PLAIN
,
NULL
));
}
...
...
lv_objx/lv_list.c
View file @
d93844bd
...
...
@@ -10,13 +10,13 @@
#if USE_LV_LIST != 0
#include "lv_list.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "misc/math/math_base.h"
/*********************
* DEFINES
*********************/
#define LV_LIST_LAYOUT_DEF LV_
REC
T_LAYOUT_COL_M
#define LV_LIST_LAYOUT_DEF LV_
CON
T_LAYOUT_COL_M
/**********************
* TYPEDEFS
...
...
@@ -71,7 +71,7 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
/*Init the new list object*/
if
(
copy
==
NULL
)
{
lv_obj_set_size_us
(
new_list
,
2
*
LV_DPI
,
3
*
LV_DPI
);
lv_
rec
t_set_layout
(
ext
->
page
.
scrl
,
LV_LIST_LAYOUT_DEF
);
lv_
con
t_set_layout
(
ext
->
page
.
scrl
,
LV_LIST_LAYOUT_DEF
);
lv_obj_set_style
(
new_list
,
lv_style_get
(
LV_STYLE_TRANSP_TIGHT
,
NULL
));
lv_obj_set_style
(
lv_page_get_scrl
(
new_list
),
lv_style_get
(
LV_STYLE_PRETTY
,
NULL
));
lv_page_set_sb_mode
(
new_list
,
LV_PAGE_SB_MODE_AUTO
);
...
...
@@ -121,8 +121,8 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l
lv_btn_set_rel_action
(
liste
,
rel_action
);
lv_page_glue_obj
(
liste
,
true
);
lv_
rect_set_layout
(
liste
,
LV_REC
T_LAYOUT_ROW_M
);
lv_
rec
t_set_fit
(
liste
,
false
,
true
);
lv_
cont_set_layout
(
liste
,
LV_CON
T_LAYOUT_ROW_M
);
lv_
con
t_set_fit
(
liste
,
false
,
true
);
if
(
img_fn
!=
NULL
&&
img_fn
[
0
]
!=
'\0'
)
{
lv_obj_t
*
img
=
lv_img_create
(
liste
,
NULL
);
...
...
lv_objx/lv_mbox.c
View file @
d93844bd
...
...
@@ -59,7 +59,7 @@ static void lv_mbox_disable_fit(lv_obj_t * mbox);
lv_obj_t
*
lv_mbox_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
{
/*Create the ancestor message box*/
lv_obj_t
*
new_mbox
=
lv_
rec
t_create
(
par
,
copy
);
lv_obj_t
*
new_mbox
=
lv_
con
t_create
(
par
,
copy
);
dm_assert
(
new_mbox
);
/*Allocate the message box type specific extended data*/
...
...
@@ -78,8 +78,8 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy)
/*Init the new message box message box*/
if
(
copy
==
NULL
)
{
lv_
rect_set_layout
(
new_mbox
,
LV_REC
T_LAYOUT_COL_L
);
lv_
rec
t_set_fit
(
new_mbox
,
true
,
true
);
lv_
cont_set_layout
(
new_mbox
,
LV_CON
T_LAYOUT_COL_L
);
lv_
con
t_set_fit
(
new_mbox
,
true
,
true
);
ext
->
txt
=
lv_label_create
(
new_mbox
,
NULL
);
lv_label_set_text
(
ext
->
txt
,
"Text of the message box"
);
...
...
@@ -126,7 +126,7 @@ bool lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
bool
valid
;
/* Include the ancient signal function */
valid
=
lv_
rec
t_signal
(
mbox
,
sign
,
param
);
valid
=
lv_
con
t_signal
(
mbox
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
@@ -201,11 +201,11 @@ lv_obj_t * lv_mbox_add_btn(lv_obj_t * mbox, const char * btn_txt, lv_action_t re
/*Create a button if it is not existed yet*/
if
(
ext
->
btnh
==
NULL
)
{
ext
->
btnh
=
lv_
rec
t_create
(
mbox
,
NULL
);
ext
->
btnh
=
lv_
con
t_create
(
mbox
,
NULL
);
lv_obj_set_style
(
ext
->
btnh
,
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
));
lv_obj_set_click
(
ext
->
btnh
,
false
);
lv_
rec
t_set_fit
(
ext
->
btnh
,
false
,
true
);
lv_
rect_set_layout
(
ext
->
btnh
,
LV_REC
T_LAYOUT_PRETTY
);
lv_
con
t_set_fit
(
ext
->
btnh
,
false
,
true
);
lv_
cont_set_layout
(
ext
->
btnh
,
LV_CON
T_LAYOUT_PRETTY
);
}
lv_obj_t
*
btn
;
...
...
@@ -214,7 +214,7 @@ lv_obj_t * lv_mbox_add_btn(lv_obj_t * mbox, const char * btn_txt, lv_action_t re
lv_btn_set_styles
(
btn
,
ext
->
styles_btn
[
LV_BTN_STATE_REL
],
ext
->
styles_btn
[
LV_BTN_STATE_PR
],
ext
->
styles_btn
[
LV_BTN_STATE_TREL
],
ext
->
styles_btn
[
LV_BTN_STATE_TPR
],
ext
->
styles_btn
[
LV_BTN_STATE_INA
]);
lv_
rec
t_set_fit
(
btn
,
true
,
true
);
lv_
con
t_set_fit
(
btn
,
true
,
true
);
lv_obj_t
*
label
;
label
=
lv_label_create
(
btn
,
NULL
);
...
...
@@ -405,7 +405,7 @@ static void lv_mbox_realign(lv_obj_t * mbox)
*/
static
void
lv_mbox_disable_fit
(
lv_obj_t
*
mbox
)
{
lv_
rec
t_set_fit
(
mbox
,
false
,
false
);
lv_
con
t_set_fit
(
mbox
,
false
,
false
);
}
#endif
lv_objx/lv_mbox.h
View file @
d93844bd
...
...
@@ -27,7 +27,7 @@
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_btn.h"
#include "lv_label.h"
...
...
@@ -42,7 +42,7 @@
/*Data of message box*/
typedef
struct
{
lv_
rec
t_ext_t
bg
;
/*Ext. of ancestor*/
lv_
con
t_ext_t
bg
;
/*Ext. of ancestor*/
/*New data for this type */
lv_obj_t
*
txt
;
/*Text of the message box*/
lv_obj_t
*
btnh
;
/*Holder of the buttons*/
...
...
lv_objx/lv_page.c
View file @
d93844bd
...
...
@@ -11,7 +11,7 @@
#include "misc/math/math_base.h"
#include "../lv_objx/lv_page.h"
#include "../lv_objx/lv_
rec
t.h"
#include "../lv_objx/lv_
con
t.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_obj/lv_refr.h"
#include "../lv_misc/anim.h"
...
...
@@ -61,7 +61,7 @@ static lv_design_f_t ancestor_design_f;
lv_obj_t
*
lv_page_create
(
lv_obj_t
*
par
,
lv_obj_t
*
copy
)
{
/*Create the ancestor object*/
lv_obj_t
*
new_page
=
lv_
rec
t_create
(
par
,
copy
);
lv_obj_t
*
new_page
=
lv_
con
t_create
(
par
,
copy
);
dm_assert
(
new_page
);
/*Allocate the object type specific extended data*/
...
...
@@ -81,12 +81,12 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
/*Init the new page object*/
if
(
copy
==
NULL
)
{
lv_style_t
*
style
=
lv_style_get
(
LV_STYLE_PRETTY_COLOR
,
NULL
);
ext
->
scrl
=
lv_
rec
t_create
(
new_page
,
NULL
);
ext
->
scrl
=
lv_
con
t_create
(
new_page
,
NULL
);
lv_obj_set_signal_f
(
ext
->
scrl
,
lv_scrl_signal
);
lv_obj_set_drag
(
ext
->
scrl
,
true
);
lv_obj_set_drag_throw
(
ext
->
scrl
,
true
);
lv_obj_set_protect
(
ext
->
scrl
,
LV_PROTECT_PARENT
);
lv_
rec
t_set_fit
(
ext
->
scrl
,
true
,
true
);
lv_
con
t_set_fit
(
ext
->
scrl
,
true
,
true
);
lv_obj_set_style
(
ext
->
scrl
,
lv_style_get
(
LV_STYLE_PRETTY
,
NULL
));
/* Add the signal function only if 'scrolling' is created
...
...
@@ -96,7 +96,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_set_style
(
new_page
,
style
);
}
else
{
lv_page_ext_t
*
copy_ext
=
lv_obj_get_ext
(
copy
);
ext
->
scrl
=
lv_
rec
t_create
(
new_page
,
copy_ext
->
scrl
);
ext
->
scrl
=
lv_
con
t_create
(
new_page
,
copy_ext
->
scrl
);
lv_obj_set_signal_f
(
ext
->
scrl
,
lv_scrl_signal
);
lv_page_set_pr_action
(
new_page
,
copy_ext
->
pr_action
);
...
...
@@ -128,7 +128,7 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
bool
obj_valid
=
true
;
/* Include the ancient signal function */
obj_valid
=
lv_
rec
t_signal
(
page
,
sign
,
param
);
obj_valid
=
lv_
con
t_signal
(
page
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
@@ -209,7 +209,7 @@ static bool lv_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void* param)
bool
obj_valid
=
true
;
/* Include the ancient signal function */
obj_valid
=
lv_
rec
t_signal
(
scrl
,
sign
,
param
);
obj_valid
=
lv_
con
t_signal
(
scrl
,
sign
,
param
);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
...
...
@@ -480,7 +480,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, bool anim_en)
/**
* Get the scrollable object of a page-
* @param page pointer to page object
* @return pointer to
rectangle
which is the scrollable part of the page
* @return pointer to
a container
which is the scrollable part of the page
*/
lv_obj_t
*
lv_page_get_scrl
(
lv_obj_t
*
page
)
{
...
...
lv_objx/lv_page.h
View file @
d93844bd
...
...
@@ -18,7 +18,7 @@
#endif
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
/*********************
* DEFINES
...
...
@@ -34,13 +34,13 @@ typedef enum
LV_PAGE_SB_MODE_OFF
,
/*Never show scrollbars*/
LV_PAGE_SB_MODE_ON
,
/*Always show scrollbars*/
LV_PAGE_SB_MODE_DRAG
,
/*Show scrollbars when page is being dragged*/
LV_PAGE_SB_MODE_AUTO
,
/*Show scrollbars when the scrollable
rect.
is large enough to be scrolled*/
LV_PAGE_SB_MODE_AUTO
,
/*Show scrollbars when the scrollable
container
is large enough to be scrolled*/
}
lv_page_sb_mode_t
;
/*Data of page*/
typedef
struct
{
lv_
rec
t_ext_t
bg_rect
;
/*Ext. of ancestor*/
lv_
con
t_ext_t
bg_rect
;
/*Ext. of ancestor*/
/*New data for this type */
lv_obj_t
*
scrl
;
/*The scrollable object on the background*/
lv_action_t
rel_action
;
/*Function to call when the page is released*/
...
...
@@ -110,7 +110,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, bool anim_en);
/**
* Get the scrollable object of a page-
* @param page pointer to page object
* @return pointer to
rectangle
which is the scrollable part of the page
* @return pointer to
container
which is the scrollable part of the page
*/
lv_obj_t
*
lv_page_get_scrl
(
lv_obj_t
*
page
);
...
...
lv_objx/lv_slider.c
View file @
d93844bd
...
...
@@ -80,7 +80,8 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, lv_obj_t * copy)
/*Copy an existing slider*/
else
{
lv_slider_ext_t
*
copy_ext
=
lv_obj_get_ext
(
copy
);
ext
->
style_knob
=
copy_ext
->
style_knob
;
ext
->
cb
=
copy_ext
->
cb
;
/*Refresh the style with new signal function*/
lv_obj_refr_style
(
new_slider
);
}
...
...
lv_objx/lv_win.c
View file @
d93844bd
...
...
@@ -79,12 +79,12 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
lv_page_set_sb_mode
(
ext
->
page
,
LV_PAGE_SB_MODE_AUTO
);
lv_obj_t
*
scrl
=
lv_page_get_scrl
(
ext
->
page
);
lv_
rec
t_set_fit
(
scrl
,
false
,
true
);
lv_
con
t_set_fit
(
scrl
,
false
,
true
);
lv_obj_set_style
(
scrl
,
lv_style_get
(
LV_STYLE_TRANSP
,
NULL
));
/*Create a holder for the header*/
ext
->
header
=
lv_
rec
t_create
(
new_win
,
NULL
);
lv_
rec
t_set_fit
(
ext
->
header
,
false
,
true
);
ext
->
header
=
lv_
con
t_create
(
new_win
,
NULL
);
lv_
con
t_set_fit
(
ext
->
header
,
false
,
true
);
/*Move back the header because it is automatically moved to the scrollable */
lv_obj_set_protect
(
ext
->
header
,
LV_PROTECT_PARENT
);
lv_obj_set_parent
(
ext
->
header
,
new_win
);
...
...
@@ -95,10 +95,10 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
lv_label_set_text
(
ext
->
title
,
"My title"
);
/*Create a holder for the control buttons*/
ext
->
btnh
=
lv_
rec
t_create
(
ext
->
header
,
NULL
);
lv_
rec
t_set_fit
(
ext
->
btnh
,
true
,
false
);
ext
->
btnh
=
lv_
con
t_create
(
ext
->
header
,
NULL
);
lv_
con
t_set_fit
(
ext
->
btnh
,
true
,
false
);
lv_obj_set_style
(
ext
->
btnh
,
lv_style_get
(
LV_STYLE_TRANSP_TIGHT
,
NULL
));
lv_
rect_set_layout
(
ext
->
btnh
,
LV_REC
T_LAYOUT_ROW_M
);
lv_
cont_set_layout
(
ext
->
btnh
,
LV_CON
T_LAYOUT_ROW_M
);
lv_obj_set_signal_f
(
new_win
,
lv_win_signal
);
lv_obj_set_size
(
new_win
,
LV_HOR_RES
,
LV_VER_RES
);
...
...
@@ -107,13 +107,13 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
else
{
lv_win_ext_t
*
copy_ext
=
lv_obj_get_ext
(
copy
);
/*Create the objects*/
ext
->
header
=
lv_
rec
t_create
(
new_win
,
copy_ext
->
header
);
ext
->
header
=
lv_
con
t_create
(
new_win
,
copy_ext
->
header
);
/*Move back the header because it is automatically moved to the scrollable */
lv_obj_set_protect
(
ext
->
header
,
LV_PROTECT_PARENT
);
lv_obj_set_parent
(
ext
->
header
,
new_win
);
ext
->
title
=
lv_label_create
(
ext
->
header
,
copy_ext
->
title
);
ext
->
btnh
=
lv_
rec
t_create
(
ext
->
header
,
copy_ext
->
btnh
);
ext
->
btnh
=
lv_
con
t_create
(
ext
->
header
,
copy_ext
->
btnh
);
/*Copy the control buttons*/
lv_obj_t
*
child
;
...
...
lv_objx/lv_win.h
View file @
d93844bd
...
...
@@ -38,7 +38,7 @@
#endif
#include "../lv_obj/lv_obj.h"
#include
"lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_btn.h"
#include "lv_label.h"
#include "lv_img.h"
...
...
@@ -58,10 +58,10 @@ typedef struct
/*Ext. of ancestor*/
/*New data for this type */
lv_obj_t
*
page
;
lv_obj_t
*
header
;
/*Pointer to the header
rectangle
of the window*/
lv_obj_t
*
header
;
/*Pointer to the header
container
of the window*/
lv_obj_t
*
title
;
/*Pointer to the title label of the window*/
lv_obj_t
*
btnh
;
/*Pointer to the control button holder
rectangle
of the window*/
lv_style_t
*
style_header
;
/*Style of the header
rectangle
*/
lv_obj_t
*
btnh
;
/*Pointer to the control button holder
container
of the window*/
lv_style_t
*
style_header
;
/*Style of the header
container
*/
lv_style_t
*
style_cbtn_rel
;
/*Control button releases style*/
lv_style_t
*
style_cbtn_pr
;
/*Control button pressed style*/
cord_t
cbtn_size
;
/*Size of the control buttons (square)*/
...
...
lvgl.h
View file @
d93844bd
...
...
@@ -34,7 +34,7 @@
#include "lv_objx/lv_label.h"
#include "lv_objx/lv_line.h"
#include "lv_objx/lv_page.h"
#include
"lv_objx/lv_rect.h"
#include
<lvgl/lv_objx/lv_cont.h>
#include "lv_objx/lv_list.h"
#include "lv_objx/lv_chart.h"
#include "lv_objx/lv_cb.h"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment