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
f0080b94
Commit
f0080b94
authored
Oct 26, 2017
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes and updates according to test results
parent
816327f4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
270 additions
and
234 deletions
+270
-234
lv_draw.c
lv_draw/lv_draw.c
+22
-22
lv_refr.c
lv_obj/lv_refr.c
+3
-3
lv_style.c
lv_obj/lv_style.c
+10
-10
lv_style.h
lv_obj/lv_style.h
+5
-5
lv_bar.c
lv_objx/lv_bar.c
+4
-4
lv_btnm.c
lv_objx/lv_btnm.c
+5
-5
lv_cb.c
lv_objx/lv_cb.c
+7
-6
lv_chart.c
lv_objx/lv_chart.c
+38
-27
lv_chart.h
lv_objx/lv_chart.h
+7
-8
lv_cont.c
lv_objx/lv_cont.c
+31
-31
lv_cont.h
lv_objx/lv_cont.h
+6
-5
lv_ddlist.c
lv_objx/lv_ddlist.c
+0
-0
lv_ddlist.h
lv_objx/lv_ddlist.h
+38
-14
lv_gauge.c
lv_objx/lv_gauge.c
+0
-0
lv_gauge.h
lv_objx/lv_gauge.h
+4
-4
lv_list.c
lv_objx/lv_list.c
+1
-1
lv_lmeter.c
lv_objx/lv_lmeter.c
+1
-1
lv_page.c
lv_objx/lv_page.c
+19
-19
lv_roller.c
lv_objx/lv_roller.c
+18
-18
lv_slider.c
lv_objx/lv_slider.c
+5
-5
lv_ta.c
lv_objx/lv_ta.c
+33
-33
lv_tabview.c
lv_objx/lv_tabview.c
+6
-6
lv_win.c
lv_objx/lv_win.c
+7
-7
No files found.
lv_draw/lv_draw.c
View file @
f0080b94
...
...
@@ -62,18 +62,18 @@ static void point_swap(point_t * p1, point_t * p2);
* STATIC VARIABLES
**********************/
#if LV_VDB_SIZE != 0
static
void
(
*
px_fp
)(
cord_t
x
,
cord_t
y
,
const
area_t
*
mask_p
,
color_t
color
,
opa_t
opa
city
)
=
lv_vpx
;
static
void
(
*
fill_fp
)(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
color_t
color
,
opa_t
opa
city
)
=
lv_vfill
;
static
void
(
*
letter_fp
)(
const
point_t
*
pos_p
,
const
area_t
*
mask_p
,
const
font_t
*
font_p
,
uint32_t
letter
,
color_t
color
,
opa_t
opa
city
)
=
lv_vletter
;
static
void
(
*
px_fp
)(
cord_t
x
,
cord_t
y
,
const
area_t
*
mask_p
,
color_t
color
,
opa_t
opa
)
=
lv_vpx
;
static
void
(
*
fill_fp
)(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
color_t
color
,
opa_t
opa
)
=
lv_vfill
;
static
void
(
*
letter_fp
)(
const
point_t
*
pos_p
,
const
area_t
*
mask_p
,
const
font_t
*
font_p
,
uint32_t
letter
,
color_t
color
,
opa_t
opa
)
=
lv_vletter
;
#if USE_FSINT != 0
static
void
(
*
map_fp
)(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
color_t
*
map_p
,
opa_t
opa
city
,
bool
transp
,
bool
upscale
,
color_t
recolor
,
opa_t
recolor_opa
)
=
lv_vmap
;
static
void
(
*
map_fp
)(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
color_t
*
map_p
,
opa_t
opa
,
bool
transp
,
bool
upscale
,
color_t
recolor
,
opa_t
recolor_opa
)
=
lv_vmap
;
#endif
#else
static
void
(
*
px_fp
)(
cord_t
x
,
cord_t
y
,
const
area_t
*
mask_p
,
color_t
color
,
opa_t
opa
city
)
=
lv_rpx
;
static
void
(
*
fill_fp
)(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
color_t
color
,
opa_t
opa
city
)
=
lv_rfill
;
static
void
(
*
letter_fp
)(
const
point_t
*
pos_p
,
const
area_t
*
mask_p
,
const
font_t
*
font_p
,
uint32_t
letter
,
color_t
color
,
opa_t
opa
city
)
=
lv_rletter
;
static
void
(
*
px_fp
)(
cord_t
x
,
cord_t
y
,
const
area_t
*
mask_p
,
color_t
color
,
opa_t
opa
)
=
lv_rpx
;
static
void
(
*
fill_fp
)(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
color_t
color
,
opa_t
opa
)
=
lv_rfill
;
static
void
(
*
letter_fp
)(
const
point_t
*
pos_p
,
const
area_t
*
mask_p
,
const
font_t
*
font_p
,
uint32_t
letter
,
color_t
color
,
opa_t
opa
)
=
lv_rletter
;
#if USE_LV_IMG != 0 && USE_FSINT != 0
static
void
(
*
map_fp
)(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
color_t
*
map_p
,
opa_t
opa
city
,
bool
transp
,
bool
upscale
,
color_t
recolor
,
opa_t
recolor_opa
)
=
lv_rmap
;
static
void
(
*
map_fp
)(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
color_t
*
map_p
,
opa_t
opa
,
bool
transp
,
bool
upscale
,
color_t
recolor
,
opa_t
recolor_opa
)
=
lv_rmap
;
#endif
#endif
...
...
@@ -322,7 +322,7 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_style_
color_t
color
=
style
->
text
.
color
;
if
(
cmd_state
==
CMD_STATE_IN
)
color
=
recolor
;
letter_fp
(
&
pos
,
mask_p
,
font
,
letter
,
color
,
style
->
opa
city
);
letter_fp
(
&
pos
,
mask_p
,
font
,
letter
,
color
,
style
->
opa
);
pos
.
x
+=
(
font_get_width
(
font
,
letter
)
>>
FONT_ANTIALIAS
)
+
style
->
text
.
space_letter
;
...
...
@@ -395,7 +395,7 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
const_data
=
true
;
uint8_t
*
f_data
=
((
ufs_file_t
*
)
file
.
file_d
)
->
ent
->
data_d
;
f_data
+=
sizeof
(
lv_img_raw_header_t
);
map_fp
(
cords_p
,
&
mask_com
,
(
void
*
)
f_data
,
style
->
opa
city
,
header
.
transp
,
upscale
,
style
->
image
.
color
,
style
->
image
.
intense
);
map_fp
(
cords_p
,
&
mask_com
,
(
void
*
)
f_data
,
style
->
opa
,
header
.
transp
,
upscale
,
style
->
image
.
color
,
style
->
image
.
intense
);
}
#endif
...
...
@@ -429,7 +429,7 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
for
(
row
=
mask_com
.
y1
;
row
<=
mask_com
.
y2
;
row
+=
us_val
)
{
res
=
fs_read
(
&
file
,
buf
,
useful_data
,
&
br
);
map_fp
(
&
line
,
&
mask_com
,
buf
,
style
->
opa
city
,
header
.
transp
,
upscale
,
map_fp
(
&
line
,
&
mask_com
,
buf
,
style
->
opa
,
header
.
transp
,
upscale
,
style
->
image
.
color
,
style
->
image
.
intense
);
fs_tell
(
&
file
,
&
act_pos
);
...
...
@@ -515,7 +515,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
draw_area
.
x2
=
MATH_MAX
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
y1
=
MATH_MIN
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y2
=
MATH_MAX
(
act_area
.
y1
,
act_area
.
y2
);
fill_fp
(
&
draw_area
,
mask_p
,
style
->
line
.
color
,
style
->
opa
city
);
fill_fp
(
&
draw_area
,
mask_p
,
style
->
line
.
color
,
style
->
opa
);
}
if
(
hor
==
false
&&
last_x
!=
act_point
.
x
)
{
area_t
act_area
;
...
...
@@ -531,7 +531,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
draw_area
.
x2
=
MATH_MAX
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
y1
=
MATH_MIN
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y2
=
MATH_MAX
(
act_area
.
y1
,
act_area
.
y2
);
fill_fp
(
&
draw_area
,
mask_p
,
style
->
line
.
color
,
style
->
opa
city
);
fill_fp
(
&
draw_area
,
mask_p
,
style
->
line
.
color
,
style
->
opa
);
}
/*Calc. the next point of the line*/
...
...
@@ -559,7 +559,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
draw_area
.
x2
=
MATH_MAX
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
y1
=
MATH_MIN
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y2
=
MATH_MAX
(
act_area
.
y1
,
act_area
.
y2
);
fill_fp
(
&
draw_area
,
mask_p
,
style
->
line
.
color
,
style
->
opa
city
);
fill_fp
(
&
draw_area
,
mask_p
,
style
->
line
.
color
,
style
->
opa
);
}
if
(
hor
==
false
)
{
area_t
act_area
;
...
...
@@ -573,7 +573,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
draw_area
.
x2
=
MATH_MAX
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
y1
=
MATH_MIN
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y2
=
MATH_MAX
(
act_area
.
y1
,
act_area
.
y2
);
fill_fp
(
&
draw_area
,
mask_p
,
style
->
line
.
color
,
style
->
opa
city
);
fill_fp
(
&
draw_area
,
mask_p
,
style
->
line
.
color
,
style
->
opa
);
}
}
...
...
@@ -595,7 +595,7 @@ static void lv_draw_rect_main_mid(const area_t * cords_p, const area_t * mask_p,
color_t
mcolor
=
style
->
body
.
color_main
;
color_t
gcolor
=
style
->
body
.
color_gradient
;
uint8_t
mix
;
opa_t
opa
=
style
->
opa
city
;
opa_t
opa
=
style
->
opa
;
cord_t
height
=
area_get_height
(
cords_p
);
cord_t
width
=
area_get_width
(
cords_p
);
...
...
@@ -645,7 +645,7 @@ static void lv_draw_rect_main_corner(const area_t * cords_p, const area_t * mask
color_t
mcolor
=
style_p
->
body
.
color_main
;
color_t
gcolor
=
style_p
->
body
.
color_gradient
;
color_t
act_color
;
opa_t
opa
=
style_p
->
opa
city
;
opa_t
opa
=
style_p
->
opa
;
uint8_t
mix
;
cord_t
height
=
area_get_height
(
cords_p
);
cord_t
width
=
area_get_width
(
cords_p
);
...
...
@@ -816,7 +816,7 @@ static void lv_draw_rect_border_straight(const area_t * cords_p, const area_t *
cord_t
width
=
area_get_width
(
cords_p
);
cord_t
height
=
area_get_height
(
cords_p
);
uint16_t
bwidth
=
style_p
->
body
.
border
.
width
;
opa_t
bopa
=
(
uint16_t
)((
uint16_t
)
style_p
->
opa
city
*
style_p
->
body
.
border
.
opa
)
>>
8
;
opa_t
bopa
=
(
uint16_t
)((
uint16_t
)
style_p
->
opa
*
style_p
->
body
.
border
.
opa
)
>>
8
;
area_t
work_area
;
cord_t
length_corr
=
0
;
cord_t
corner_size
=
0
;
...
...
@@ -930,7 +930,7 @@ static void lv_draw_rect_border_corner(const area_t * cords_p, const area_t * ma
uint16_t
radius
=
style
->
body
.
radius
;
uint16_t
bwidth
=
style
->
body
.
border
.
width
;
color_t
bcolor
=
style
->
body
.
border
.
color
;
opa_t
bopa
=
(
uint16_t
)((
uint16_t
)
style
->
opa
city
*
style
->
body
.
border
.
opa
)
>>
8
;
opa_t
bopa
=
(
uint16_t
)((
uint16_t
)
style
->
opa
*
style
->
body
.
border
.
opa
)
>>
8
;
/*0 px border width drawn as 1 px, so decrement the bwidth*/
bwidth
--
;
...
...
@@ -1112,7 +1112,7 @@ static void lv_draw_cont_shadow_full(const area_t * cords_p, const area_t * mask
int16_t
filter_size
=
2
*
style
->
body
.
shadow
.
width
+
1
;
for
(
row
=
0
;
row
<
filter_size
;
row
++
)
{
opa_h_result
[
row
]
=
(
uint32_t
)((
uint32_t
)(
filter_size
-
row
)
*
style
->
opa
city
*
2
)
/
(
filter_size
);
opa_h_result
[
row
]
=
(
uint32_t
)((
uint32_t
)(
filter_size
-
row
)
*
style
->
opa
*
2
)
/
(
filter_size
);
}
uint16_t
p
;
...
...
@@ -1157,7 +1157,7 @@ static void lv_draw_cont_shadow_full(const area_t * cords_p, const area_t * mask
{
int16_t
p_tmp
=
p
-
(
cruve_x
[
row_v
]
-
cruve_x
[
row
]);
if
(
p_tmp
<
-
style
->
body
.
shadow
.
width
)
{
/*Cols before the filtered shadow (still not blurred)*/
opa_tmp
+=
style
->
opa
city
*
2
;
opa_tmp
+=
style
->
opa
*
2
;
}
/*Cols after the filtered shadow (already no effect) */
else
if
(
p_tmp
>
style
->
body
.
shadow
.
width
)
{
...
...
@@ -1252,7 +1252,7 @@ static void lv_draw_cont_shadow_bottom(const area_t * cords_p, const area_t * ma
int16_t
filter_size
=
2
*
style
->
body
.
shadow
.
width
+
1
;
for
(
row
=
0
;
row
<
filter_size
;
row
++
)
{
opa_h_result
[
row
]
=
(
uint32_t
)((
uint32_t
)(
filter_size
-
row
)
*
style
->
opa
city
)
/
(
filter_size
);
opa_h_result
[
row
]
=
(
uint32_t
)((
uint32_t
)(
filter_size
-
row
)
*
style
->
opa
)
/
(
filter_size
);
}
point_t
point_l
;
...
...
lv_obj/lv_refr.c
View file @
f0080b94
...
...
@@ -352,7 +352,7 @@ static lv_obj_t * lv_refr_get_top_obj(const area_t * area_p, lv_obj_t * obj)
/*If no better children check this object*/
if
(
found_p
==
NULL
)
{
lv_style_t
*
style
=
lv_obj_get_style
(
obj
);
if
(
style
->
opa
city
==
OPA_COVER
&&
if
(
style
->
opa
==
OPA_COVER
&&
obj
->
design_func
(
obj
,
area_p
,
LV_DESIGN_COVER_CHK
)
!=
false
)
{
found_p
=
obj
;
}
...
...
@@ -439,7 +439,7 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p)
/* Redraw the object */
lv_style_t
*
style
=
lv_obj_get_style
(
obj
);
if
(
style
->
opa
city
!=
OPA_TRANSP
)
{
if
(
style
->
opa
!=
OPA_TRANSP
)
{
obj
->
design_func
(
obj
,
&
obj_ext_mask
,
LV_DESIGN_DRAW_MAIN
);
//tick_wait_ms(100); /*DEBUG: Wait after every object draw to see the order of drawing*/
}
...
...
@@ -472,7 +472,7 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p)
}
/* If all the children are redrawn make 'post draw' design */
if
(
style
->
opa
city
!=
OPA_TRANSP
)
{
if
(
style
->
opa
!=
OPA_TRANSP
)
{
obj
->
design_func
(
obj
,
&
obj_ext_mask
,
LV_DESIGN_DRAW_POST
);
}
}
...
...
lv_obj/lv_style.c
View file @
f0080b94
...
...
@@ -68,12 +68,12 @@ void lv_style_init (void)
* HUE = 210*/
/*Screen style*/
lv_style_scr
.
opa
city
=
OPA_COVER
;
lv_style_scr
.
opa
=
OPA_COVER
;
lv_style_scr
.
body
.
color_main
=
COLOR_WHITE
;
lv_style_scr
.
body
.
color_gradient
=
COLOR_WHITE
;
lv_style_scr
.
body
.
radius
=
0
;
lv_style_scr
.
body
.
padding
.
ver
tical
=
LV_DPI
/
12
;
lv_style_scr
.
body
.
padding
.
hor
izontal
=
LV_DPI
/
12
;
lv_style_scr
.
body
.
padding
.
ver
=
LV_DPI
/
12
;
lv_style_scr
.
body
.
padding
.
hor
=
LV_DPI
/
12
;
lv_style_scr
.
body
.
padding
.
inner
=
LV_DPI
/
12
;
lv_style_scr
.
body
.
empty
=
0
;
lv_style_scr
.
glass
=
0
;
...
...
@@ -138,16 +138,16 @@ void lv_style_init (void)
/*Transparent tight style*/
memcpy
(
&
lv_style_transparent_tight
,
&
lv_style_transparent
,
sizeof
(
lv_style_t
));
lv_style_transparent_tight
.
body
.
padding
.
hor
izontal
=
0
;
lv_style_transparent_tight
.
body
.
padding
.
ver
tical
=
0
;
lv_style_transparent_tight
.
body
.
padding
.
hor
=
0
;
lv_style_transparent_tight
.
body
.
padding
.
ver
=
0
;
/*Button released style*/
memcpy
(
&
lv_style_button_off_released
,
&
lv_style_plain
,
sizeof
(
lv_style_t
));
lv_style_button_off_released
.
body
.
color_main
=
COLOR_MAKE
(
0x76
,
0xa2
,
0xd0
);
lv_style_button_off_released
.
body
.
color_gradient
=
COLOR_MAKE
(
0x19
,
0x3a
,
0x5d
);
lv_style_button_off_released
.
body
.
radius
=
LV_DPI
/
15
;
lv_style_button_off_released
.
body
.
padding
.
hor
izontal
=
LV_DPI
/
4
;
lv_style_button_off_released
.
body
.
padding
.
ver
tical
=
LV_DPI
/
6
;
lv_style_button_off_released
.
body
.
padding
.
hor
=
LV_DPI
/
4
;
lv_style_button_off_released
.
body
.
padding
.
ver
=
LV_DPI
/
6
;
lv_style_button_off_released
.
body
.
padding
.
inner
=
LV_DPI
/
10
;
lv_style_button_off_released
.
body
.
border
.
color
=
COLOR_MAKE
(
0x0b
,
0x19
,
0x28
);
lv_style_button_off_released
.
body
.
border
.
width
=
LV_DPI
/
50
>=
1
?
LV_DPI
/
50
:
1
;
...
...
@@ -300,12 +300,12 @@ static void lv_style_aimator(lv_style_anim_dsc_t * dsc, int32_t val)
const
lv_style_t
*
end
=
dsc
->
style_end
;
lv_style_t
*
act
=
dsc
->
style_anim
;
STYLE_ATTR_ANIM
(
opa
city
,
val
);
STYLE_ATTR_ANIM
(
opa
,
val
);
STYLE_ATTR_ANIM
(
body
.
radius
,
val
);
STYLE_ATTR_ANIM
(
body
.
border
.
width
,
val
);
STYLE_ATTR_ANIM
(
body
.
shadow
.
width
,
val
);
STYLE_ATTR_ANIM
(
body
.
padding
.
hor
izontal
,
val
);
STYLE_ATTR_ANIM
(
body
.
padding
.
ver
tical
,
val
);
STYLE_ATTR_ANIM
(
body
.
padding
.
hor
,
val
);
STYLE_ATTR_ANIM
(
body
.
padding
.
ver
,
val
);
STYLE_ATTR_ANIM
(
body
.
padding
.
inner
,
val
);
STYLE_ATTR_ANIM
(
text
.
space_line
,
val
);
STYLE_ATTR_ANIM
(
text
.
space_letter
,
val
);
...
...
lv_obj/lv_style.h
View file @
f0080b94
...
...
@@ -42,18 +42,18 @@ typedef enum
typedef
struct
{
opa_t
opa
city
;
opa_t
opa
;
uint8_t
glass
:
1
;
/*1: Do not inherit this style*/
struct
{
color_t
color_main
;
color_t
color_gradient
;
cord_t
radius
;
/*Corner radius of background*/
cord_t
radius
;
struct
{
color_t
color
;
cord_t
width
;
opa_t
opa
;
/*Opacity of background border*/
opa_t
opa
;
}
border
;
struct
{
...
...
@@ -63,8 +63,8 @@ typedef struct
}
shadow
;
struct
{
cord_t
ver
tical
;
cord_t
hor
izontal
;
cord_t
ver
;
cord_t
hor
;
cord_t
inner
;
}
padding
;
...
...
lv_objx/lv_bar.c
View file @
f0080b94
...
...
@@ -285,10 +285,10 @@ static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t
lv_style_t
*
style_indic
=
lv_bar_get_indicator_style
(
bar
);
area_t
indic_area
;
area_cpy
(
&
indic_area
,
&
bar
->
coords
);
indic_area
.
x1
+=
style_indic
->
body
.
padding
.
hor
izontal
;
indic_area
.
x2
-=
style_indic
->
body
.
padding
.
hor
izontal
;
indic_area
.
y1
+=
style_indic
->
body
.
padding
.
ver
tical
;
indic_area
.
y2
-=
style_indic
->
body
.
padding
.
ver
tical
;
indic_area
.
x1
+=
style_indic
->
body
.
padding
.
hor
;
indic_area
.
x2
-=
style_indic
->
body
.
padding
.
hor
;
indic_area
.
y1
+=
style_indic
->
body
.
padding
.
ver
;
indic_area
.
y2
-=
style_indic
->
body
.
padding
.
ver
;
cord_t
w
=
area_get_width
(
&
indic_area
);
cord_t
h
=
area_get_height
(
&
indic_area
);
...
...
lv_objx/lv_btnm.c
View file @
f0080b94
...
...
@@ -267,9 +267,9 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
/*Set size and positions of the buttons*/
lv_style_t
*
btnms
=
lv_obj_get_style
(
btnm
);
cord_t
max_w
=
lv_obj_get_width
(
btnm
)
-
2
*
btnms
->
body
.
padding
.
hor
izontal
;
cord_t
max_h
=
lv_obj_get_height
(
btnm
)
-
2
*
btnms
->
body
.
padding
.
ver
tical
;
cord_t
act_y
=
btnms
->
body
.
padding
.
ver
tical
;
cord_t
max_w
=
lv_obj_get_width
(
btnm
)
-
2
*
btnms
->
body
.
padding
.
hor
;
cord_t
max_h
=
lv_obj_get_height
(
btnm
)
-
2
*
btnms
->
body
.
padding
.
ver
;
cord_t
act_y
=
btnms
->
body
.
padding
.
ver
;
/*Count the lines to calculate button height*/
uint8_t
line_cnt
=
1
;
...
...
@@ -308,7 +308,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
/*Set the button size and positions and set the texts*/
uint16_t
i
;
cord_t
act_x
=
btnms
->
body
.
padding
.
hor
izontal
;
cord_t
act_x
=
btnms
->
body
.
padding
.
hor
;
cord_t
act_unit_w
;
unit_act_cnt
=
0
;
for
(
i
=
0
;
i
<
btn_cnt
;
i
++
)
{
...
...
@@ -318,7 +318,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
act_unit_w
=
(
all_unit_w
*
get_button_width
(
map_p_tmp
[
i
]))
/
unit_cnt
;
/*Always recalculate act_x because of rounding errors */
act_x
=
(
unit_act_cnt
*
all_unit_w
)
/
unit_cnt
+
i
*
btnms
->
body
.
padding
.
inner
+
btnms
->
body
.
padding
.
hor
izontal
;
act_x
=
(
unit_act_cnt
*
all_unit_w
)
/
unit_cnt
+
i
*
btnms
->
body
.
padding
.
inner
+
btnms
->
body
.
padding
.
hor
;
area_set
(
&
ext
->
button_areas
[
btn_i
],
act_x
,
act_y
,
...
...
lv_objx/lv_cb.c
View file @
f0080b94
...
...
@@ -69,7 +69,6 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
/*Init the new checkbox object*/
if
(
copy
==
NULL
)
{
ext
->
bullet
=
lv_btn_create
(
new_cb
,
NULL
);
if
(
ancestor_bullet_design_f
==
NULL
)
ancestor_bullet_design_f
=
lv_obj_get_design_func
(
ext
->
bullet
);
lv_btn_set_style
(
new_cb
,
LV_BTN_STATE_OFF_RELEASED
,
lv_style_get
(
LV_STYLE_TRANSPARENT
));
lv_btn_set_style
(
new_cb
,
LV_BTN_STATE_OFF_PRESSED
,
lv_style_get
(
LV_STYLE_TRANSPARENT
));
lv_btn_set_style
(
new_cb
,
LV_BTN_STATE_ON_RELEASED
,
lv_style_get
(
LV_STYLE_TRANSPARENT
));
...
...
@@ -80,11 +79,12 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
lv_cont_set_fit
(
new_cb
,
true
,
true
);
lv_btn_set_toggle
(
new_cb
,
true
);
if
(
ancestor_bullet_design_f
==
NULL
)
ancestor_bullet_design_f
=
lv_obj_get_design_func
(
ext
->
bullet
);
lv_obj_set_click
(
ext
->
bullet
,
false
);
lv_btn_set_style
(
new_cb
,
LV_BTN_STATE_OFF_RELEASED
,
lv_style_get
(
LV_STYLE_PRETTY
));
lv_btn_set_style
(
new_cb
,
LV_BTN_STATE_OFF_PRESSED
,
lv_style_get
(
LV_STYLE_PRETTY_COLOR
));
lv_btn_set_style
(
new_cb
,
LV_BTN_STATE_ON_RELEASED
,
lv_style_get
(
LV_STYLE_BUTTON_ON_RELEASED
));
lv_btn_set_style
(
new_cb
,
LV_BTN_STATE_ON_PRESSED
,
lv_style_get
(
LV_STYLE_BUTTON_ON_PRESSED
));
lv_btn_set_style
(
ext
->
bullet
,
LV_BTN_STATE_OFF_RELEASED
,
lv_style_get
(
LV_STYLE_PRETTY
));
lv_btn_set_style
(
ext
->
bullet
,
LV_BTN_STATE_OFF_PRESSED
,
lv_style_get
(
LV_STYLE_PRETTY_COLOR
));
lv_btn_set_style
(
ext
->
bullet
,
LV_BTN_STATE_ON_RELEASED
,
lv_style_get
(
LV_STYLE_BUTTON_ON_RELEASED
));
lv_btn_set_style
(
ext
->
bullet
,
LV_BTN_STATE_ON_PRESSED
,
lv_style_get
(
LV_STYLE_BUTTON_ON_PRESSED
));
ext
->
label
=
lv_label_create
(
new_cb
,
NULL
);
lv_obj_set_style
(
ext
->
label
,
NULL
);
/*Inherit the style of the parent*/
...
...
@@ -125,6 +125,7 @@ bool lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
if
(
valid
!=
false
)
{
if
(
sign
==
LV_SIGNAL_STYLE_CHG
)
{
lv_obj_set_size
(
ext
->
bullet
,
font_get_height
(
style
->
text
.
font
),
font_get_height
(
style
->
text
.
font
));
lv_btn_set_state
(
lv_cb_get_bullet
(
cb
),
lv_btn_get_state
(
cb
));
}
else
if
(
sign
==
LV_SIGNAL_PRESSED
||
sign
==
LV_SIGNAL_RELEASED
||
sign
==
LV_SIGNAL_PRESS_LOST
)
{
...
...
@@ -243,7 +244,7 @@ static bool lv_bullet_design(lv_obj_t * bullet, const area_t * mask, lv_design_m
lv_obj_t
*
bg
=
lv_obj_get_parent
(
bullet
);
lv_style_t
*
style_page
=
lv_obj_get_style
(
bg
);
lv_group_t
*
g
=
lv_obj_get_group
(
bg
);
if
(
style_page
->
body
.
empty
!=
0
||
style_page
->
opa
city
==
OPA_TRANSP
)
{
/*Background is visible?*/
if
(
style_page
->
body
.
empty
!=
0
||
style_page
->
opa
==
OPA_TRANSP
)
{
/*Background is visible?*/
if
(
lv_group_get_focused
(
g
)
==
bg
)
{
lv_style_t
*
style_mod
;
style_mod
=
lv_group_mod_style
(
g
,
style_ori
);
...
...
lv_objx/lv_chart.c
View file @
f0080b94
...
...
@@ -71,10 +71,10 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
ext
->
dl_num
=
0
;
ext
->
ymin
=
LV_CHART_YMIN_DEF
;
ext
->
ymax
=
LV_CHART_YMAX_DEF
;
ext
->
hdiv_
num
=
LV_CHART_HDIV_DEF
;
ext
->
vdiv_
num
=
LV_CHART_VDIV_DEF
;
ext
->
hdiv_
cnt
=
LV_CHART_HDIV_DEF
;
ext
->
vdiv_
cnt
=
LV_CHART_VDIV_DEF
;
ext
->
pnum
=
LV_CHART_PNUM_DEF
;
ext
->
type
=
LV_CHART_LINE
;
ext
->
type
=
LV_CHART_
TYPE_
LINE
;
ext
->
dl_opa
=
OPA_COVER
;
ext
->
dl_dark
=
OPA_50
;
ext
->
dl_width
=
2
<<
LV_ANTIALIAS
;
...
...
@@ -87,13 +87,14 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
/*Init the new chart background object*/
if
(
copy
==
NULL
)
{
lv_obj_set_style
(
new_chart
,
lv_style_get
(
LV_STYLE_PRETTY
));
lv_obj_set_size
(
new_chart
,
LV_HOR_RES
/
2
,
LV_VER_RES
/
2
);
}
else
{
lv_chart_ext_t
*
ext_copy
=
lv_obj_get_ext_attr
(
copy
);
ext
->
type
=
ext_copy
->
type
;
ext
->
ymin
=
ext_copy
->
ymin
;
ext
->
ymax
=
ext_copy
->
ymax
;
ext
->
hdiv_
num
=
ext_copy
->
hdiv_num
;
ext
->
vdiv_
num
=
ext_copy
->
vdiv_num
;
ext
->
hdiv_
cnt
=
ext_copy
->
hdiv_cnt
;
ext
->
vdiv_
cnt
=
ext_copy
->
vdiv_cnt
;
ext
->
pnum
=
ext_copy
->
pnum
;
ext
->
dl_opa
=
ext_copy
->
dl_opa
;
...
...
@@ -167,7 +168,7 @@ lv_chart_dl_t * lv_chart_add_data_line(lv_obj_t * chart, color_t color)
* Refresh a chart if its data line has changed
* @param chart pointer to chart object
*/
void
lv_chart_refr
(
lv_obj_t
*
chart
)
void
lv_chart_refr
esh
(
lv_obj_t
*
chart
)
{
lv_obj_invalidate
(
chart
);
}
...
...
@@ -181,12 +182,12 @@ void lv_chart_refr(lv_obj_t * chart)
* @param hdiv number of horizontal division lines
* @param vdiv number of vertical division lines
*/
void
lv_chart_set_
hvdiv
(
lv_obj_t
*
chart
,
uint8_t
hdiv
,
uint8_t
vdiv
)
void
lv_chart_set_
div_line_count
(
lv_obj_t
*
chart
,
uint8_t
hdiv
,
uint8_t
vdiv
)
{
lv_chart_ext_t
*
ext
=
lv_obj_get_ext_attr
(
chart
);
ext
->
hdiv_
num
=
hdiv
;
ext
->
vdiv_
num
=
vdiv
;
ext
->
hdiv_
cnt
=
hdiv
;
ext
->
vdiv_
cnt
=
vdiv
;
lv_obj_invalidate
(
chart
);
}
...
...
@@ -206,7 +207,7 @@ void lv_chart_set_range(lv_obj_t * chart, cord_t ymin, cord_t ymax)
ext
->
ymin
=
ymin
;
ext
->
ymax
=
ymax
;
lv_chart_refr
(
chart
);
lv_chart_refr
esh
(
chart
);
}
/**
...
...
@@ -219,7 +220,7 @@ void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type)
lv_chart_ext_t
*
ext
=
lv_obj_get_ext_attr
(
chart
);
ext
->
type
=
type
;
lv_chart_refr
(
chart
);
lv_chart_refr
esh
(
chart
);
}
/**
...
...
@@ -231,15 +232,25 @@ void lv_chart_set_pnum(lv_obj_t * chart, uint16_t pnum)
{
lv_chart_ext_t
*
ext
=
lv_obj_get_ext_attr
(
chart
);
lv_chart_dl_t
*
dl
;
uint16_t
pnum_old
=
ext
->
pnum
;
uint16_t
i
;
cord_t
def
=
(
ext
->
ymin
+
ext
->
ymax
)
>>
1
;
/*half range as default value*/
if
(
pnum
<
1
)
pnum
=
1
;
LL_READ_BACK
(
ext
->
dl_ll
,
dl
)
{
dl
->
points
=
dm_realloc
(
dl
->
points
,
sizeof
(
cord_t
)
*
pnum
);
/*Initialize the new points*/
if
(
pnum
>
pnum_old
)
{
for
(
i
=
pnum_old
-
1
;
i
<
pnum
;
i
++
)
{
dl
->
points
[
i
]
=
def
;
}
}
}
ext
->
pnum
=
pnum
;
lv_chart_refr
(
chart
);
lv_chart_refr
esh
(
chart
);
}
/**
...
...
@@ -291,7 +302,7 @@ void lv_chart_set_next(lv_obj_t * chart, lv_chart_dl_t * dl, cord_t y)
}
dl
->
points
[
ext
->
pnum
-
1
]
=
y
;
lv_chart_refr
(
chart
);
lv_chart_refr
esh
(
chart
);
}
...
...
@@ -384,9 +395,9 @@ static bool lv_chart_design(lv_obj_t * chart, const area_t * mask, lv_design_mod
lv_chart_draw_div
(
chart
,
mask
);
if
(
ext
->
type
&
LV_CHART_LINE
)
lv_chart_draw_lines
(
chart
,
mask
);
if
(
ext
->
type
&
LV_CHART_
COL
)
lv_chart_draw_cols
(
chart
,
mask
);
if
(
ext
->
type
&
LV_CHART_POINT
)
lv_chart_draw_points
(
chart
,
mask
);
if
(
ext
->
type
&
LV_CHART_
TYPE_
LINE
)
lv_chart_draw_lines
(
chart
,
mask
);
if
(
ext
->
type
&
LV_CHART_
TYPE_COLUMN
)
lv_chart_draw_cols
(
chart
,
mask
);
if
(
ext
->
type
&
LV_CHART_
TYPE_
POINT
)
lv_chart_draw_points
(
chart
,
mask
);
}
return
true
;
}
...
...
@@ -411,20 +422,20 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
cord_t
x_ofs
=
chart
->
coords
.
x1
;
cord_t
y_ofs
=
chart
->
coords
.
y1
;
if
(
ext
->
hdiv_
num
!=
0
)
{
if
(
ext
->
hdiv_
cnt
!=
0
)
{
/*Draw slide lines if no border*/
if
(
style
->
body
.
border
.
width
!=
0
)
{
div_i_start
=
1
;
div_i_end
=
ext
->
hdiv_
num
;
div_i_end
=
ext
->
hdiv_
cnt
;
}
else
{
div_i_start
=
0
;
div_i_end
=
ext
->
hdiv_
num
+
1
;
div_i_end
=
ext
->
hdiv_
cnt
+
1
;
}
p1
.
x
=
0
+
x_ofs
;
p2
.
x
=
w
+
x_ofs
;
for
(
div_i
=
div_i_start
;
div_i
<=
div_i_end
;
div_i
++
)
{
p1
.
y
=
(
int32_t
)((
int32_t
)
h
*
div_i
)
/
(
ext
->
hdiv_
num
+
1
);
p1
.
y
=
(
int32_t
)((
int32_t
)
h
*
div_i
)
/
(
ext
->
hdiv_
cnt
+
1
);
p1
.
y
+=
y_ofs
;
if
(
div_i
==
div_i_start
)
p1
.
y
+=
(
style
->
line
.
width
>>
1
)
+
1
;
/*The first line might not be visible*/
if
(
div_i
==
div_i_end
)
p1
.
y
-=
(
style
->
line
.
width
>>
1
)
+
1
;
/*The last line might not be visible*/
...
...
@@ -434,20 +445,20 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
}
}
if
(
ext
->
vdiv_
num
!=
0
)
{
if
(
ext
->
vdiv_
cnt
!=
0
)
{
/*Draw slide lines if no border*/
if
(
style
->
body
.
border
.
width
!=
0
)
{
div_i_start
=
1
;
div_i_end
=
ext
->
vdiv_
num
;
div_i_end
=
ext
->
vdiv_
cnt
;
}
else
{
div_i_start
=
0
;
div_i_end
=
ext
->
vdiv_
num
+
1
;
div_i_end
=
ext
->
vdiv_
cnt
+
1
;
}
p1
.
y
=
0
+
y_ofs
;
p2
.
y
=
h
+
y_ofs
;
for
(
div_i
=
div_i_start
;
div_i
<=
div_i_end
;
div_i
++
)
{
p1
.
x
=
(
int32_t
)((
int32_t
)
w
*
div_i
)
/
(
ext
->
vdiv_
num
+
1
);
p1
.
x
=
(
int32_t
)((
int32_t
)
w
*
div_i
)
/
(
ext
->
vdiv_
cnt
+
1
);
p1
.
x
+=
x_ofs
;
if
(
div_i
==
div_i_start
)
p1
.
x
+=
(
style
->
line
.
width
>>
1
)
+
1
;
/*The first line might not be visible*/
if
(
div_i
==
div_i_end
)
p1
.
x
-=
(
style
->
line
.
width
>>
1
)
+
1
;
/*The last line might not be visible*/
...
...
@@ -477,7 +488,7 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
lv_chart_dl_t
*
dl
;
lv_style_t
lines
;
lv_style_copy
(
&
lines
,
lv_style_get
(
LV_STYLE_PLAIN
));
lines
.
opa
city
=
(
uint16_t
)((
uint16_t
)
style
->
opacity
*
ext
->
dl_opa
)
>>
8
;
lines
.
opa
=
(
uint16_t
)((
uint16_t
)
style
->
opa
*
ext
->
dl_opa
)
>>
8
;
lines
.
line
.
width
=
ext
->
dl_width
;
/*Go through all data lines*/
...
...
@@ -530,7 +541,7 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
style_point
.
body
.
border
.
width
=
0
;
style_point
.
body
.
empty
=
0
;
style_point
.
body
.
radius
=
LV_RADIUS_CIRCLE
;
style_point
.
opa
city
=
(
uint16_t
)((
uint16_t
)
style
->
opacity
*
ext
->
dl_opa
)
>>
8
;
style_point
.
opa
=
(
uint16_t
)((
uint16_t
)
style
->
opa
*
ext
->
dl_opa
)
>>
8
;
style_point
.
body
.
radius
=
ext
->
dl_width
;
/*Go through all data lines*/
...
...
@@ -581,7 +592,7 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
rects
.
body
.
border
.
width
=
0
;
rects
.
body
.
empty
=
0
;
rects
.
body
.
radius
=
0
;
rects
.
opa
city
=
(
uint16_t
)((
uint16_t
)
style
->
opacity
*
ext
->
dl_opa
)
>>
8
;
rects
.
opa
=
(
uint16_t
)((
uint16_t
)
style
->
opa
*
ext
->
dl_opa
)
>>
8
;
col_a
.
y2
=
chart
->
coords
.
y2
;
...
...
lv_objx/lv_chart.h
View file @
f0080b94
...
...
@@ -40,8 +40,8 @@ typedef struct
ll_dsc_t
dl_ll
;
/*Linked list for the data line pointers (stores lv_chart_dl_t)*/
cord_t
ymin
;
/*y min value (used to scale the data)*/
cord_t
ymax
;
/*y max value (used to scale the data)*/
uint8_t
hdiv_
num
;
/*Number of horizontal division lines*/
uint8_t
vdiv_
num
;
/*Number of vertical division lines*/
uint8_t
hdiv_
cnt
;
/*Number of horizontal division lines*/
uint8_t
vdiv_
cnt
;
/*Number of vertical division lines*/
uint16_t
pnum
;
/*Point number in a data line*/
cord_t
dl_width
;
/*Line width or point radius*/
uint8_t
dl_num
;
/*Number of data lines in dl_ll*/
...
...
@@ -53,10 +53,9 @@ typedef struct
/*Chart types*/
typedef
enum
{
LV_CHART_NONE
=
0
,
LV_CHART_LINE
=
0x01
,
LV_CHART_COL
=
0x02
,
LV_CHART_POINT
=
0x04
,
LV_CHART_TYPE_LINE
=
0x01
,
LV_CHART_TYPE_COLUMN
=
0x02
,
LV_CHART_TYPE_POINT
=
0x04
,
}
lv_chart_type_t
;
...
...
@@ -92,7 +91,7 @@ lv_chart_dl_t * lv_chart_add_data_line(lv_obj_t * chart, color_t color);
* Refresh a chart if its data line has changed
* @param chart pointer to chart object
*/
void
lv_chart_refr
(
lv_obj_t
*
chart
);
void
lv_chart_refr
esh
(
lv_obj_t
*
chart
);
/**
* Set the number of horizontal and vertical division lines
...
...
@@ -100,7 +99,7 @@ void lv_chart_refr(lv_obj_t * chart);
* @param hdiv number of horizontal division lines
* @param vdiv number of vertical division lines
*/
void
lv_chart_set_
hvdiv
(
lv_obj_t
*
chart
,
uint8_t
hdiv
,
uint8_t
vdiv
);
void
lv_chart_set_
div_line_count
(
lv_obj_t
*
chart
,
uint8_t
hdiv
,
uint8_t
vdiv
);
/**
* Set the minimal and maximal x and y values
...
...
lv_objx/lv_cont.c
View file @
f0080b94
...
...
@@ -75,8 +75,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_allocate_ext_attr
(
new_rect
,
sizeof
(
lv_cont_ext_t
));
lv_cont_ext_t
*
ext
=
lv_obj_get_ext_attr
(
new_rect
);
dm_assert
(
ext
);
ext
->
h
fit_en
=
0
;
ext
->
v
fit_en
=
0
;
ext
->
h
or_fit
=
0
;
ext
->
v
er_fit
=
0
;
ext
->
layout
=
LV_CONT_LAYOUT_OFF
;
lv_obj_set_signal_func
(
new_rect
,
lv_cont_signal
);
...
...
@@ -88,8 +88,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
/*Copy an existing object*/
else
{
lv_cont_ext_t
*
copy_ext
=
lv_obj_get_ext_attr
(
copy
);
ext
->
h
fit_en
=
copy_ext
->
hfit_en
;
ext
->
v
fit_en
=
copy_ext
->
vfit_en
;
ext
->
h
or_fit
=
copy_ext
->
hor_fit
;
ext
->
v
er_fit
=
copy_ext
->
ver_fit
;
ext
->
layout
=
copy_ext
->
layout
;
/*Refresh the style with new signal function*/
...
...
@@ -164,8 +164,8 @@ void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en)
{
lv_obj_invalidate
(
cont
);
lv_cont_ext_t
*
ext
=
lv_obj_get_ext_attr
(
cont
);
ext
->
h
fit_en
=
hor_en
==
false
?
0
:
1
;
ext
->
v
fit_en
=
ver_en
==
false
?
0
:
1
;
ext
->
h
or_fit
=
hor_en
==
false
?
0
:
1
;
ext
->
v
er_fit
=
ver_en
==
false
?
0
:
1
;
/*Send a signal to set a new size*/
cont
->
signal_func
(
cont
,
LV_SIGNAL_CORD_CHG
,
cont
);
...
...
@@ -191,10 +191,10 @@ lv_cont_layout_t lv_cont_get_layout(lv_obj_t * cont)
* @param cont pointer to a container object
* @return true: horizontal padding is enabled
*/
bool
lv_cont_get_hfit
(
lv_obj_t
*
cont
)
bool
lv_cont_get_h
or_
fit
(
lv_obj_t
*
cont
)
{
lv_cont_ext_t
*
ext
=
lv_obj_get_ext_attr
(
cont
);
return
ext
->
h
fit_en
==
0
?
false
:
true
;
return
ext
->
h
or_fit
==
0
?
false
:
true
;
}
/**
...
...
@@ -202,10 +202,10 @@ bool lv_cont_get_hfit(lv_obj_t * cont)
* @param cont pointer to a container object
* @return true: vertical padding is enabled
*/
bool
lv_cont_get_vfit
(
lv_obj_t
*
cont
)
bool
lv_cont_get_v
er_
fit
(
lv_obj_t
*
cont
)
{
lv_cont_ext_t
*
ext
=
lv_obj_get_ext_attr
(
cont
);
return
ext
->
v
fit_en
==
0
?
false
:
true
;
return
ext
->
v
er_fit
==
0
?
false
:
true
;
}
...
...
@@ -281,7 +281,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
switch
(
type
)
{
case
LV_CONT_LAYOUT_COL_L
:
hpad_corr
=
style
->
body
.
padding
.
hor
izontal
;
hpad_corr
=
style
->
body
.
padding
.
hor
;
align
=
LV_ALIGN_IN_TOP_LEFT
;
break
;
case
LV_CONT_LAYOUT_COL_M
:
...
...
@@ -289,7 +289,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
align
=
LV_ALIGN_IN_TOP_MID
;
break
;
case
LV_CONT_LAYOUT_COL_R
:
hpad_corr
=
-
style
->
body
.
padding
.
hor
izontal
;
hpad_corr
=
-
style
->
body
.
padding
.
hor
;
align
=
LV_ALIGN_IN_TOP_RIGHT
;
break
;
default:
...
...
@@ -302,7 +302,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
* an unnecessary child change signals could be sent*/
lv_obj_set_protect
(
cont
,
LV_PROTECT_CHILD_CHG
);
/* Align the children */
cord_t
last_cord
=
style
->
body
.
padding
.
ver
tical
;
cord_t
last_cord
=
style
->
body
.
padding
.
ver
;
LL_READ_BACK
(
cont
->
child_ll
,
child
)
{
if
(
lv_obj_get_hidden
(
child
)
!=
false
||
lv_obj_is_protected
(
child
,
LV_PROTECT_POS
)
!=
false
)
continue
;
...
...
@@ -326,11 +326,11 @@ static void lv_cont_layout_row(lv_obj_t * cont)
/*Adjust margin and get the alignment type*/
lv_align_t
align
;
lv_style_t
*
style
=
lv_obj_get_style
(
cont
);
cord_t
vpad_corr
=
style
->
body
.
padding
.
ver
tical
;
cord_t
vpad_corr
=
style
->
body
.
padding
.
ver
;
switch
(
type
)
{
case
LV_CONT_LAYOUT_ROW_T
:
vpad_corr
=
style
->
body
.
padding
.
ver
tical
;
vpad_corr
=
style
->
body
.
padding
.
ver
;
align
=
LV_ALIGN_IN_TOP_LEFT
;
break
;
case
LV_CONT_LAYOUT_ROW_M
:
...
...
@@ -338,7 +338,7 @@ static void lv_cont_layout_row(lv_obj_t * cont)
align
=
LV_ALIGN_IN_LEFT_MID
;
break
;
case
LV_CONT_LAYOUT_ROW_B
:
vpad_corr
=
-
style
->
body
.
padding
.
ver
tical
;
vpad_corr
=
-
style
->
body
.
padding
.
ver
;
align
=
LV_ALIGN_IN_BOTTOM_LEFT
;
break
;
default:
...
...
@@ -352,7 +352,7 @@ static void lv_cont_layout_row(lv_obj_t * cont)
lv_obj_set_protect
(
cont
,
LV_PROTECT_CHILD_CHG
);
/* Align the children */
cord_t
last_cord
=
style
->
body
.
padding
.
hor
izontal
;
cord_t
last_cord
=
style
->
body
.
padding
.
hor
;
LL_READ_BACK
(
cont
->
child_ll
,
child
)
{
if
(
lv_obj_get_hidden
(
child
)
!=
false
||
lv_obj_is_protected
(
child
,
LV_PROTECT_POS
)
!=
false
)
continue
;
...
...
@@ -415,7 +415,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
lv_obj_t
*
child_tmp
;
/* Temporary child */
lv_style_t
*
style
=
lv_obj_get_style
(
cont
);
cord_t
w_obj
=
lv_obj_get_width
(
cont
);
cord_t
act_y
=
style
->
body
.
padding
.
ver
tical
;
cord_t
act_y
=
style
->
body
.
padding
.
ver
;
/* Disable child change action because the children will be moved a lot
* an unnecessary child change signals could be sent*/
...
...
@@ -427,7 +427,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
child_rc
=
child_rs
;
/*Initially the the row starter and closer is the same*/
while
(
child_rs
!=
NULL
)
{
cord_t
h_row
=
0
;
cord_t
w_row
=
style
->
body
.
padding
.
hor
izontal
*
2
;
/*The width is at least the left+right hpad*/
cord_t
w_row
=
style
->
body
.
padding
.
hor
*
2
;
/*The width is at least the left+right hpad*/
uint32_t
obj_num
=
0
;
/*Find the row closer object and collect some data*/
...
...
@@ -476,7 +476,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
else
{
w_row
-=
style
->
body
.
padding
.
inner
*
obj_num
;
cord_t
new_opad
=
(
w_obj
-
w_row
)
/
(
obj_num
-
1
);
cord_t
act_x
=
style
->
body
.
padding
.
hor
izontal
;
/*x init*/
cord_t
act_x
=
style
->
body
.
padding
.
hor
;
/*x init*/
child_tmp
=
child_rs
;
while
(
child_tmp
!=
NULL
)
{
if
(
lv_obj_get_hidden
(
child_tmp
)
==
false
&&
...
...
@@ -509,10 +509,10 @@ static void lv_cont_layout_grid(lv_obj_t * cont)
cord_t
w_tot
=
lv_obj_get_width
(
cont
);
cord_t
w_obj
=
lv_obj_get_width
(
lv_obj_get_child
(
cont
,
NULL
));
cord_t
h_obj
=
lv_obj_get_height
(
lv_obj_get_child
(
cont
,
NULL
));
uint16_t
obj_row
=
(
w_tot
-
(
2
*
style
->
body
.
padding
.
hor
izontal
))
/
(
w_obj
+
style
->
body
.
padding
.
inner
);
/*Obj. num. in a row*/
uint16_t
obj_row
=
(
w_tot
-
(
2
*
style
->
body
.
padding
.
hor
))
/
(
w_obj
+
style
->
body
.
padding
.
inner
);
/*Obj. num. in a row*/
cord_t
x_ofs
;
if
(
obj_row
>
1
)
{
x_ofs
=
w_obj
+
(
w_tot
-
(
2
*
style
->
body
.
padding
.
hor
izontal
)
-
(
obj_row
*
w_obj
))
/
(
obj_row
-
1
);
x_ofs
=
w_obj
+
(
w_tot
-
(
2
*
style
->
body
.
padding
.
hor
)
-
(
obj_row
*
w_obj
))
/
(
obj_row
-
1
);
}
else
{
x_ofs
=
w_tot
/
2
-
w_obj
/
2
;
}
...
...
@@ -523,8 +523,8 @@ static void lv_cont_layout_grid(lv_obj_t * cont)
lv_obj_set_protect
(
cont
,
LV_PROTECT_CHILD_CHG
);
/* Align the children */
cord_t
act_x
=
style
->
body
.
padding
.
hor
izontal
;
cord_t
act_y
=
style
->
body
.
padding
.
ver
tical
;
cord_t
act_x
=
style
->
body
.
padding
.
hor
;
cord_t
act_y
=
style
->
body
.
padding
.
ver
;
uint16_t
obj_cnt
=
0
;
LL_READ_BACK
(
cont
->
child_ll
,
child
)
{
if
(
lv_obj_get_hidden
(
child
)
!=
false
||
...
...
@@ -540,7 +540,7 @@ static void lv_cont_layout_grid(lv_obj_t * cont)
if
(
obj_cnt
>=
obj_row
)
{
obj_cnt
=
0
;
act_x
=
style
->
body
.
padding
.
hor
izontal
;
act_x
=
style
->
body
.
padding
.
hor
;
act_y
+=
y_ofs
;
}
}
...
...
@@ -556,8 +556,8 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
{
lv_cont_ext_t
*
ext
=
lv_obj_get_ext_attr
(
cont
);
if
(
ext
->
h
fit_en
==
0
&&
ext
->
v
fit_en
==
0
)
{
if
(
ext
->
h
or_fit
==
0
&&
ext
->
v
er_fit
==
0
)
{
return
;
}
...
...
@@ -565,8 +565,8 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
area_t
ori
;
lv_style_t
*
style
=
lv_obj_get_style
(
cont
);
lv_obj_t
*
i
;
cord_t
hpad
=
style
->
body
.
padding
.
hor
izontal
;
cord_t
vpad
=
style
->
body
.
padding
.
ver
tical
;
cord_t
hpad
=
style
->
body
.
padding
.
hor
;
cord_t
vpad
=
style
->
body
.
padding
.
ver
;
/*Search the side coordinates of the children*/
lv_obj_get_coords
(
cont
,
&
ori
);
...
...
@@ -587,14 +587,14 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
/*If the value is not the init value then the page has >=1 child.*/
if
(
new_cords
.
x1
!=
CORD_MAX
)
{
if
(
ext
->
h
fit_en
!=
0
)
{
if
(
ext
->
h
or_fit
!=
0
)
{
new_cords
.
x1
-=
hpad
;
new_cords
.
x2
+=
hpad
;
}
else
{
new_cords
.
x1
=
cont
->
coords
.
x1
;
new_cords
.
x2
=
cont
->
coords
.
x2
;
}
if
(
ext
->
v
fit_en
!=
0
)
{
if
(
ext
->
v
er_fit
!=
0
)
{
new_cords
.
y1
-=
vpad
;
new_cords
.
y2
+=
vpad
;
}
else
{
...
...
lv_objx/lv_cont.h
View file @
f0080b94
...
...
@@ -45,15 +45,16 @@ typedef struct
{
/*Inherited from 'base_obj' so no inherited ext. */
/*Ext. of ancestor*/
/*New data for this type */
uint8_t
layout
:
5
;
/*A layout from 'lv_cont_layout_t' enum*/
uint8_t
h
fit_en
:
1
;
/*Enable horizontal padding
to involve all children*/
uint8_t
v
fit_en
:
1
;
/*Enable horizontal padding
to involve all children*/
uint8_t
layout
:
4
;
/*A layout from 'lv_cont_layout_t' enum*/
uint8_t
h
or_fit
:
1
;
/*1: Enable horizontal fit
to involve all children*/
uint8_t
v
er_fit
:
1
;
/*1: Enable horizontal fir
to involve all children*/
}
lv_cont_ext_t
;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a container objects
* @param par pointer to an object, it will be the parent of the new container
...
...
@@ -98,14 +99,14 @@ lv_cont_layout_t lv_cont_get_layout(lv_obj_t * cont);
* @param cont pointer to a container object
* @return true: horizontal padding is enabled
*/
bool
lv_cont_get_hfit
(
lv_obj_t
*
cont
);
bool
lv_cont_get_h
or_
fit
(
lv_obj_t
*
cont
);
/**
* Get vertical fit enable attribute of a container
* @param cont pointer to a container object
* @return true: vertical padding is enabled
*/
bool
lv_cont_get_vfit
(
lv_obj_t
*
cont
);
bool
lv_cont_get_v
er_
fit
(
lv_obj_t
*
cont
);
/**********************
* MACROS
...
...
lv_objx/lv_ddlist.c
View file @
f0080b94
This diff is collapsed.
Click to expand it.
lv_objx/lv_ddlist.h
View file @
f0080b94
...
...
@@ -41,11 +41,11 @@ typedef struct
{
lv_page_ext_t
page
;
/*Ext. of ancestor*/
/*New data for this type */
lv_obj_t
*
opt_label
;
/*Label for the options*/
lv_style_t
*
s
tyle_sel
;
/*Style of the selected option*/
lv_action_t
c
b
;
/*Pointer to function to call when an option is selected*/
uint16_t
num_op
t
;
/*Number of options*/
uint16_t
sel
_opt
;
/*Index of the current option*/
lv_obj_t
*
opt
ions
_label
;
/*Label for the options*/
lv_style_t
*
s
elected_style
;
/*Style of the selected option*/
lv_action_t
c
allback
;
/*Pointer to function to call when an option is selected*/
uint16_t
option_cn
t
;
/*Number of options*/
uint16_t
sel
ected_option_id
;
/*Index of the current option*/
uint16_t
anim_time
;
/*Open/Close animation time [ms]*/
uint8_t
opened
:
1
;
/*1: The list is opened*/
cord_t
fix_height
;
/*Height if the ddlist is opened. (0: auto-size)*/
...
...
@@ -74,15 +74,21 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy);
bool
lv_ddlist_signal
(
lv_obj_t
*
ddlist
,
lv_signal_t
sign
,
void
*
param
);
/**
* Set the options in a drop down list
* Set the options in a drop down list
from an array
* @param ddlist pointer to drop down list object
* @param options an array of strings wit the text of the options.
* @param options an array of strings wit
h
the text of the options.
* The lest element has to be "" (empty string)
* E.g. const char * opts[] = {"apple", "banana", "orange", ""};
*/
void
lv_ddlist_set_options
(
lv_obj_t
*
ddlist
,
const
char
**
options
);
/**
* Set the options in a drop down list from a string
* @param ddlist pointer to drop down list object
* @param options a string with '\n' separated options. E.g. "One\nTwo\nThree"
*/
void
lv_ddlist_set_options_str
(
lv_obj_t
*
ddlist
,
const
char
*
options
);
/**
* Set the selected option
* @param ddlist pointer to drop down list object
...
...
@@ -90,7 +96,6 @@ void lv_ddlist_set_options_str(lv_obj_t * ddlist, const char * options);
*/
void
lv_ddlist_set_selected
(
lv_obj_t
*
ddlist
,
uint16_t
sel_opt
);
/**
* Set a function to call when a new option is chosen
* @param ddlist pointer to a drop down list
...
...
@@ -107,19 +112,32 @@ void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_t cb);
void
lv_ddlist_set_fix_height
(
lv_obj_t
*
ddlist
,
cord_t
h
);
/**
* Set the open/close animation time.
* @param ddlist pointer to a drop down list
* @param anim_time: open/close animation time [ms]
*/
void
lv_ddlist_set_anim_time
(
lv_obj_t
*
ddlist
,
uint16_t
anim_time
);
/**
* Set the style of the rectangle on the selected option
* @param ddlist pointer to a drop down list object
* @param style pointer the new style of the select rectangle
*/
void
lv_ddlist_set_s
tyle_select
(
lv_obj_t
*
ddlist
,
lv_style_t
*
style
);
void
lv_ddlist_set_s
elected_style
(
lv_obj_t
*
ddlist
,
lv_style_t
*
style
);
/**
* Open
or Collapse the drop down list
* Open
the drop down list with or without animation
* @param ddlist pointer to drop down list object
* @param state true: open; false: collapse
* @param anim true: use animations; false: not use animations
* @param anim true: use animation; false: not use animations
*/
void
lv_ddlist_open
(
lv_obj_t
*
ddlist
,
bool
state
,
bool
anim
);
void
lv_ddlist_open
(
lv_obj_t
*
ddlist
,
bool
anim
);
/**
* Close (Collapse) the drop down list
* @param ddlist pointer to drop down list object
* @param anim true: use animation; false: not use animations
*/
void
lv_ddlist_close
(
lv_obj_t
*
ddlist
,
bool
anim
);
/**
* Get the options of a drop down list
...
...
@@ -142,7 +160,6 @@ uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist);
*/
void
lv_ddlist_get_selected_str
(
lv_obj_t
*
ddlist
,
char
*
buf
);
/**
* Get the fix height value.
* @param ddlist pointer to a drop down list object
...
...
@@ -157,6 +174,13 @@ cord_t lv_ddlist_get_fix_height(lv_obj_t * ddlist);
*/
lv_style_t
*
lv_ddlist_get_style_select
(
lv_obj_t
*
ddlist
);
/**
* Get the open/close animation time.
* @param ddlist pointer to a drop down list
* @return open/close animation time [ms]
*/
uint16_t
lv_ddlist_get_anim_time
(
lv_obj_t
*
ddlist
);
/**********************
* MACROS
**********************/
...
...
lv_objx/lv_gauge.c
View file @
f0080b94
This diff is collapsed.
Click to expand it.
lv_objx/lv_gauge.h
View file @
f0080b94
...
...
@@ -46,10 +46,9 @@ typedef struct
lv_lmeter_ext_t
lmeter
;
/*Ext. of ancestor*/
/*New data for this type */
int16_t
*
values
;
/*Array of the set values (for needles) */
lv_style_t
*
style_critical
;
/*Fade to this style nearer to the critical value*/
color_t
*
needle_colors
;
/*Color of the needles (color_t my_colors[needle_num])*/
uint8_t
needle_
num
;
/*Number of needles*/
uint8_t
l
ow_critical
:
1
;
/*0: the higher value is more critical, 1: the lower value is more critical
*/
uint8_t
needle_
count
;
/*Number of needles*/
uint8_t
l
abel_count
;
/*Number of labels on the scale
*/
}
lv_gauge_ext_t
;
/**********************
...
...
@@ -108,8 +107,9 @@ void lv_gauge_set_style_critical(lv_obj_t * gauge, lv_style_t * style);
* @param gauge pointer to gauge
* @return number of needles
*/
uint8_t
lv_gauge_get_needle_
num
(
lv_obj_t
*
gauge
);
uint8_t
lv_gauge_get_needle_
count
(
lv_obj_t
*
gauge
);
uint8_t
lv_gauge_get_label_count
(
lv_obj_t
*
gauge
);
/**
* Get the value of a needle
* @param gauge pointer to gauge object
...
...
lv_objx/lv_list.c
View file @
f0080b94
...
...
@@ -223,7 +223,7 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l
/*Make the size adjustment*/
cord_t
w
=
lv_obj_get_width
(
list
);
lv_style_t
*
style_scrl
=
lv_obj_get_style
(
lv_page_get_scrl
(
list
));
cord_t
pad_hor_tot
=
style
->
body
.
padding
.
hor
izontal
+
style_scrl
->
body
.
padding
.
horizontal
;
cord_t
pad_hor_tot
=
style
->
body
.
padding
.
hor
+
style_scrl
->
body
.
padding
.
hor
;
w
-=
pad_hor_tot
*
2
;
/*Make place for the scrollbar if pad_hor_tot is too small*/
...
...
lv_objx/lv_lmeter.c
View file @
f0080b94
...
...
@@ -186,7 +186,7 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const area_t * mask, lv_design_m
memcpy
(
&
style_tmp
,
style
,
sizeof
(
lv_style_t
));
cord_t
r_out
=
lv_obj_get_width
(
lmeter
)
/
2
;
cord_t
r_in
=
r_out
-
style
->
body
.
padding
.
horizontal
;
cord_t
r_in
=
r_out
-
style
->
body
.
padding
.
hor
;
cord_t
x_ofs
=
lv_obj_get_width
(
lmeter
)
/
2
+
lmeter
->
coords
.
x1
;
cord_t
y_ofs
=
lv_obj_get_height
(
lmeter
)
/
2
+
lmeter
->
coords
.
y1
;
int16_t
angle_ofs
=
90
+
(
360
-
ext
->
scale_angle
)
/
2
;
...
...
lv_objx/lv_page.c
View file @
f0080b94
...
...
@@ -89,7 +89,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_set_style
(
ext
->
scrl
,
lv_style_get
(
LV_STYLE_PRETTY
));
lv_obj_set_design_func
(
ext
->
scrl
,
lv_scrl_design
);
lv_page_set_sb_width
(
new_page
,
style
->
body
.
padding
.
hor
izontal
);
lv_page_set_sb_width
(
new_page
,
style
->
body
.
padding
.
hor
);
lv_page_set_sb_mode
(
new_page
,
ext
->
sb_mode
);
lv_page_set_style_sb
(
new_page
,
ext
->
style_sb
);
...
...
@@ -155,8 +155,8 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
}
}
else
if
(
sign
==
LV_SIGNAL_STYLE_CHG
)
{
lv_style_t
*
style
=
lv_obj_get_style
(
page
);
if
(
lv_cont_get_hfit
(
ext
->
scrl
)
==
false
)
{
lv_obj_set_width
(
ext
->
scrl
,
lv_obj_get_width
(
page
)
-
2
*
style
->
body
.
padding
.
hor
izontal
);
if
(
lv_cont_get_h
or_
fit
(
ext
->
scrl
)
==
false
)
{
lv_obj_set_width
(
ext
->
scrl
,
lv_obj_get_width
(
page
)
-
2
*
style
->
body
.
padding
.
hor
);
}
else
{
ext
->
scrl
->
signal_func
(
ext
->
scrl
,
LV_SIGNAL_CORD_CHG
,
&
ext
->
scrl
->
coords
);
}
...
...
@@ -177,8 +177,8 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
(
lv_obj_get_width
(
page
)
!=
area_get_width
(
param
)
||
lv_obj_get_height
(
page
)
!=
area_get_height
(
param
)))
{
if
(
lv_cont_get_hfit
(
ext
->
scrl
)
==
false
)
{
lv_obj_set_width
(
ext
->
scrl
,
lv_obj_get_width
(
page
)
-
2
*
style
->
body
.
padding
.
hor
izontal
);
if
(
lv_cont_get_h
or_
fit
(
ext
->
scrl
)
==
false
)
{
lv_obj_set_width
(
ext
->
scrl
,
lv_obj_get_width
(
page
)
-
2
*
style
->
body
.
padding
.
hor
);
}
ext
->
scrl
->
signal_func
(
ext
->
scrl
,
LV_SIGNAL_CORD_CHG
,
&
ext
->
scrl
->
coords
);
...
...
@@ -228,8 +228,8 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
if
(
sign
==
LV_SIGNAL_CORD_CHG
)
{
/*Be sure the width of the scrollable is correct*/
if
(
lv_cont_get_hfit
(
scrl
)
==
false
)
{
lv_obj_set_width
(
scrl
,
lv_obj_get_width
(
page
)
-
2
*
page_style
->
body
.
padding
.
hor
izontal
);
if
(
lv_cont_get_h
or_
fit
(
scrl
)
==
false
)
{
lv_obj_set_width
(
scrl
,
lv_obj_get_width
(
page
)
-
2
*
page_style
->
body
.
padding
.
hor
);
}
cord_t
new_x
;
...
...
@@ -238,8 +238,8 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
bool
refr_y
=
false
;
area_t
page_cords
;
area_t
scrl_cords
;
cord_t
hpad
=
page_style
->
body
.
padding
.
hor
izontal
;
cord_t
vpad
=
page_style
->
body
.
padding
.
ver
tical
;
cord_t
hpad
=
page_style
->
body
.
padding
.
hor
;
cord_t
vpad
=
page_style
->
body
.
padding
.
ver
;
new_x
=
lv_obj_get_x
(
scrl
);
new_y
=
lv_obj_get_y
(
scrl
);
...
...
@@ -288,8 +288,8 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
lv_page_sb_refresh
(
page
);
}
else
if
(
sign
==
LV_SIGNAL_DRAG_BEGIN
)
{
if
(
page_ext
->
sb_mode
==
LV_PAGE_SB_MODE_DRAG
)
{
cord_t
sbh_pad
=
MATH_MAX
(
page_ext
->
sb_width
,
page_style
->
body
.
padding
.
hor
izontal
);
cord_t
sbv_pad
=
MATH_MAX
(
page_ext
->
sb_width
,
page_style
->
body
.
padding
.
ver
tical
);
cord_t
sbh_pad
=
MATH_MAX
(
page_ext
->
sb_width
,
page_style
->
body
.
padding
.
hor
);
cord_t
sbv_pad
=
MATH_MAX
(
page_ext
->
sb_width
,
page_style
->
body
.
padding
.
ver
);
if
(
area_get_height
(
&
page_ext
->
sbv
)
<
lv_obj_get_height
(
scrl
)
-
2
*
sbv_pad
)
{
page_ext
->
sbv_draw
=
1
;
}
...
...
@@ -438,8 +438,8 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
if
((
obj_h
<=
page_h
&&
top_err
>
0
)
||
(
obj_h
>
page_h
&&
top_err
<
bot_err
))
{
/*Calculate a new position and to let scrable_rects.vpad space above*/
scrlable_y
=
-
(
obj_y
-
style_scrl
->
body
.
padding
.
ver
tical
-
style
->
body
.
padding
.
vertical
);
scrlable_y
+=
style_scrl
->
body
.
padding
.
ver
tical
;
scrlable_y
=
-
(
obj_y
-
style_scrl
->
body
.
padding
.
ver
-
style
->
body
.
padding
.
ver
);
scrlable_y
+=
style_scrl
->
body
.
padding
.
ver
;
}
/*Out of the page on the bottom*/
else
if
((
obj_h
<=
page_h
&&
bot_err
>
0
)
||
...
...
@@ -447,7 +447,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
/*Calculate a new position and to let scrable_rects.vpad space below*/
scrlable_y
=
-
obj_y
;
scrlable_y
+=
page_h
-
obj_h
;
scrlable_y
-=
style_scrl
->
body
.
padding
.
ver
tical
;
scrlable_y
-=
style_scrl
->
body
.
padding
.
ver
;
}
else
{
/*Alraedy in focus*/
return
;
...
...
@@ -594,7 +594,7 @@ static bool lv_scrl_design(lv_obj_t * scrl, const area_t * mask, lv_design_mode_
lv_obj_t
*
page
=
lv_obj_get_parent
(
scrl
);
lv_style_t
*
style_page
=
lv_obj_get_style
(
page
);
lv_group_t
*
g
=
lv_obj_get_group
(
page
);
if
(
style_page
->
body
.
empty
!=
0
||
style_page
->
opa
city
==
OPA_TRANSP
)
{
/*Background is visible?*/
if
(
style_page
->
body
.
empty
!=
0
||
style_page
->
opa
==
OPA_TRANSP
)
{
/*Background is visible?*/
if
(
lv_group_get_focused
(
g
)
==
page
)
{
lv_style_t
*
style_mod
;
style_mod
=
lv_group_mod_style
(
g
,
style_ori
);
...
...
@@ -633,12 +633,12 @@ static void lv_page_sb_refresh(lv_obj_t * page)
cord_t
size_tmp
;
cord_t
scrl_w
=
lv_obj_get_width
(
scrl
);
cord_t
scrl_h
=
lv_obj_get_height
(
scrl
);
cord_t
hpad
=
style
->
body
.
padding
.
hor
izontal
;
cord_t
vpad
=
style
->
body
.
padding
.
ver
tical
;
cord_t
hpad
=
style
->
body
.
padding
.
hor
;
cord_t
vpad
=
style
->
body
.
padding
.
ver
;
cord_t
obj_w
=
lv_obj_get_width
(
page
);
cord_t
obj_h
=
lv_obj_get_height
(
page
);
cord_t
sbh_pad
=
MATH_MAX
(
ext
->
sb_width
,
style
->
body
.
padding
.
hor
izontal
);
cord_t
sbv_pad
=
MATH_MAX
(
ext
->
sb_width
,
style
->
body
.
padding
.
ver
tical
);
cord_t
sbh_pad
=
MATH_MAX
(
ext
->
sb_width
,
style
->
body
.
padding
.
hor
);
cord_t
sbv_pad
=
MATH_MAX
(
ext
->
sb_width
,
style
->
body
.
padding
.
ver
);
if
(
ext
->
sb_mode
==
LV_PAGE_SB_MODE_OFF
)
return
;
...
...
lv_objx/lv_roller.c
View file @
f0080b94
...
...
@@ -74,9 +74,9 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, lv_obj_t * copy)
lv_page_set_rel_action
(
new_roller
,
NULL
);
/*Handle roller specific actions*/
lv_cont_set_fit
(
lv_page_get_scrl
(
new_roller
),
true
,
false
);
/*Height is specified directly*/
lv_obj_set_signal_func
(
scrl
,
roller_scrl_signal
);
lv_ddlist_open
(
new_roller
,
true
,
0
);
lv_ddlist_open
(
new_roller
,
false
);
lv_style_t
*
style_label
=
lv_obj_get_style
(
ext
->
ddlist
.
opt_label
);
lv_style_t
*
style_label
=
lv_obj_get_style
(
ext
->
ddlist
.
opt
ions
_label
);
lv_ddlist_set_fix_height
(
new_roller
,
(
font_get_height
(
style_label
->
text
.
font
)
>>
FONT_ANTIALIAS
)
*
3
+
style_label
->
text
.
space_line
*
4
);
lv_obj_refresh_style
(
new_roller
);
/*To set scrollable size automatically*/
...
...
@@ -112,15 +112,15 @@ bool lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param)
lv_roller_ext_t
*
ext
=
lv_obj_get_ext_attr
(
roller
);
if
(
sign
==
LV_SIGNAL_STYLE_CHG
)
{
lv_obj_set_height
(
lv_page_get_scrl
(
roller
),
lv_obj_get_height
(
ext
->
ddlist
.
opt_label
)
+
lv_obj_get_height
(
roller
));
lv_obj_align
(
ext
->
ddlist
.
opt_label
,
NULL
,
LV_ALIGN_CENTER
,
0
,
0
);
lv_ddlist_set_selected
(
roller
,
ext
->
ddlist
.
sel
_opt
);
lv_obj_get_height
(
ext
->
ddlist
.
opt
ions
_label
)
+
lv_obj_get_height
(
roller
));
lv_obj_align
(
ext
->
ddlist
.
opt
ions
_label
,
NULL
,
LV_ALIGN_CENTER
,
0
,
0
);
lv_ddlist_set_selected
(
roller
,
ext
->
ddlist
.
sel
ected_option_id
);
}
else
if
(
sign
==
LV_SIGNAL_CORD_CHG
)
{
lv_ddlist_set_fix_height
(
roller
,
lv_obj_get_height
(
roller
));
lv_obj_set_height
(
lv_page_get_scrl
(
roller
),
lv_obj_get_height
(
ext
->
ddlist
.
opt_label
)
+
lv_obj_get_height
(
roller
));
lv_obj_align
(
ext
->
ddlist
.
opt_label
,
NULL
,
LV_ALIGN_CENTER
,
0
,
0
);
lv_ddlist_set_selected
(
roller
,
ext
->
ddlist
.
sel
_opt
);
lv_obj_get_height
(
ext
->
ddlist
.
opt
ions
_label
)
+
lv_obj_get_height
(
roller
));
lv_obj_align
(
ext
->
ddlist
.
opt
ions
_label
,
NULL
,
LV_ALIGN_CENTER
,
0
,
0
);
lv_ddlist_set_selected
(
roller
,
ext
->
ddlist
.
sel
ected_option_id
);
}
}
...
...
@@ -193,10 +193,10 @@ static bool lv_roller_design(lv_obj_t * roller, const area_t * mask, lv_design_m
area_t
rect_area
;
rect_area
.
y1
=
roller
->
coords
.
y1
+
lv_obj_get_height
(
roller
)
/
2
-
font_h
/
2
-
style
->
text
.
space_line
-
2
;
rect_area
.
y2
=
rect_area
.
y1
+
font_h
+
style
->
text
.
space_line
;
rect_area
.
x1
=
ext
->
ddlist
.
opt
_label
->
coords
.
x1
-
style
->
body
.
padding
.
horizontal
;
rect_area
.
x1
=
ext
->
ddlist
.
opt
ions_label
->
coords
.
x1
-
style
->
body
.
padding
.
hor
;
rect_area
.
x2
=
rect_area
.
x1
+
lv_obj_get_width
(
lv_page_get_scrl
(
roller
));
lv_draw_rect
(
&
rect_area
,
mask
,
ext
->
ddlist
.
s
tyle_sel
);
lv_draw_rect
(
&
rect_area
,
mask
,
ext
->
ddlist
.
s
elected_style
);
}
/*Post draw when the children are drawn*/
else
if
(
mode
==
LV_DESIGN_DRAW_POST
)
{
...
...
@@ -227,36 +227,36 @@ static bool roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void *
int32_t
id
=
-
1
;
lv_obj_t
*
roller
=
lv_obj_get_parent
(
roller_scrl
);
lv_roller_ext_t
*
ext
=
lv_obj_get_ext_attr
(
roller
);
lv_style_t
*
style_label
=
lv_obj_get_style
(
ext
->
ddlist
.
opt_label
);
lv_style_t
*
style_label
=
lv_obj_get_style
(
ext
->
ddlist
.
opt
ions
_label
);
const
font_t
*
font
=
style_label
->
text
.
font
;
cord_t
font_h
=
font_get_height
(
font
)
>>
FONT_ANTIALIAS
;
if
(
sign
==
LV_SIGNAL_DRAG_END
)
{
/*If dragged then align the list to there be an element in the middle*/
cord_t
label_y1
=
ext
->
ddlist
.
opt_label
->
coords
.
y1
-
roller
->
coords
.
y1
;
cord_t
label_y1
=
ext
->
ddlist
.
opt
ions
_label
->
coords
.
y1
-
roller
->
coords
.
y1
;
cord_t
label_unit
=
(
font_get_height
(
style_label
->
text
.
font
)
>>
FONT_ANTIALIAS
)
+
style_label
->
text
.
space_line
/
2
;
cord_t
mid
=
(
roller
->
coords
.
y2
-
roller
->
coords
.
y1
)
/
2
;
id
=
(
mid
-
label_y1
)
/
label_unit
;
if
(
id
<
0
)
id
=
0
;
if
(
id
>=
ext
->
ddlist
.
num_opt
)
id
=
ext
->
ddlist
.
num_op
t
-
1
;
ext
->
ddlist
.
sel
_opt
=
id
;
if
(
id
>=
ext
->
ddlist
.
option_cnt
)
id
=
ext
->
ddlist
.
option_cn
t
-
1
;
ext
->
ddlist
.
sel
ected_option_id
=
id
;
}
else
if
(
sign
==
LV_SIGNAL_RELEASED
)
{
/*If picked an option by clicking then set it*/
if
(
!
lv_indev_is_dragging
(
indev
))
{
point_t
p
;
lv_indev_get_point
(
indev
,
&
p
);
p
.
y
=
p
.
y
-
ext
->
ddlist
.
opt_label
->
coords
.
y1
;
p
.
y
=
p
.
y
-
ext
->
ddlist
.
opt
ions
_label
->
coords
.
y1
;
id
=
p
.
y
/
(
font_h
+
style_label
->
text
.
space_line
);
if
(
id
<
0
)
id
=
0
;
if
(
id
>=
ext
->
ddlist
.
num_opt
)
id
=
ext
->
ddlist
.
num_op
t
-
1
;
ext
->
ddlist
.
sel
_opt
=
id
;
if
(
id
>=
ext
->
ddlist
.
option_cnt
)
id
=
ext
->
ddlist
.
option_cn
t
-
1
;
ext
->
ddlist
.
sel
ected_option_id
=
id
;
}
}
/*Position the scrollable according to the new selected option*/
if
(
id
!=
-
1
)
{
cord_t
h
=
lv_obj_get_height
(
roller
);
cord_t
line_y1
=
id
*
(
font_h
+
style_label
->
text
.
space_line
)
+
ext
->
ddlist
.
opt_label
->
coords
.
y1
-
roller_scrl
->
coords
.
y1
;
cord_t
line_y1
=
id
*
(
font_h
+
style_label
->
text
.
space_line
)
+
ext
->
ddlist
.
opt
ions
_label
->
coords
.
y1
-
roller_scrl
->
coords
.
y1
;
cord_t
new_y
=
-
line_y1
+
(
h
-
font_h
)
/
2
;
if
(
ext
->
ddlist
.
anim_time
==
0
)
{
...
...
lv_objx/lv_slider.c
View file @
f0080b94
...
...
@@ -155,7 +155,7 @@ bool lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param)
if
(
slider
->
ext_size
<
x
)
slider
->
ext_size
=
x
;
}
else
{
lv_style_t
*
style
=
lv_obj_get_style
(
slider
);
cord_t
pad
=
MATH_MIN
(
style
->
body
.
padding
.
hor
izontal
,
style
->
body
.
padding
.
vertical
);
cord_t
pad
=
MATH_MIN
(
style
->
body
.
padding
.
hor
,
style
->
body
.
padding
.
ver
);
if
(
pad
<
0
)
{
pad
=
-
pad
;
if
(
slider
->
ext_size
<
pad
)
slider
->
ext_size
=
pad
;
...
...
@@ -290,8 +290,8 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
area_t
area_bar
;
area_cpy
(
&
area_bar
,
&
slider
->
coords
);
/*Be sure at least vpad/hpad width bar will remain*/
cord_t
pad_ver_bar
=
style_slider
->
body
.
padding
.
ver
tical
;
cord_t
pad_hor_bar
=
style_slider
->
body
.
padding
.
hor
izontal
;
cord_t
pad_ver_bar
=
style_slider
->
body
.
padding
.
ver
;
cord_t
pad_hor_bar
=
style_slider
->
body
.
padding
.
hor
;
if
(
pad_ver_bar
*
2
+
LV_SLIDER_SIZE_MIN
>
area_get_height
(
&
area_bar
))
{
pad_ver_bar
=
(
area_get_height
(
&
area_bar
)
-
LV_SLIDER_SIZE_MIN
)
>>
1
;
}
...
...
@@ -310,8 +310,8 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
area_cpy
(
&
area_indic
,
&
area_bar
);
/*Be sure at least vpad/hpad width indicator will remain*/
cord_t
pad_ver_indic
=
style_indic
->
body
.
padding
.
ver
tical
;
cord_t
pad_hor_indic
=
style_indic
->
body
.
padding
.
hor
izontal
;
cord_t
pad_ver_indic
=
style_indic
->
body
.
padding
.
ver
;
cord_t
pad_hor_indic
=
style_indic
->
body
.
padding
.
hor
;
if
(
pad_ver_indic
*
2
+
LV_SLIDER_SIZE_MIN
>
area_get_height
(
&
area_bar
))
{
pad_ver_indic
=
(
area_get_height
(
&
area_bar
)
-
LV_SLIDER_SIZE_MIN
)
>>
1
;
}
...
...
lv_objx/lv_ta.c
View file @
f0080b94
...
...
@@ -177,10 +177,10 @@ bool lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
if
(
ext
->
one_line
)
{
/*In one line mode refresh the Text Area height because 'vpad' can modify it*/
lv_style_t
*
style_label
=
lv_obj_get_style
(
ext
->
label
);
cord_t
font_h
=
font_get_height
(
style_label
->
text
.
font
)
>>
FONT_ANTIALIAS
;
lv_obj_set_height
(
ta
,
font_h
+
(
style_ta
->
body
.
padding
.
ver
tical
+
style_scrl
->
body
.
padding
.
vertical
)
*
2
);
lv_obj_set_height
(
ta
,
font_h
+
(
style_ta
->
body
.
padding
.
ver
+
style_scrl
->
body
.
padding
.
ver
)
*
2
);
}
else
{
/*In not one line mode refresh the Label width because 'hpad' can modify it*/
lv_obj_set_width
(
ext
->
label
,
lv_obj_get_width
(
scrl
)
-
2
*
style_scrl
->
body
.
padding
.
hor
izontal
);
lv_obj_set_pos
(
ext
->
label
,
style_scrl
->
body
.
padding
.
hor
izontal
,
style_scrl
->
body
.
padding
.
vertical
);
/*Be sure the Label is in the correct position*/
lv_obj_set_width
(
ext
->
label
,
lv_obj_get_width
(
scrl
)
-
2
*
style_scrl
->
body
.
padding
.
hor
);
lv_obj_set_pos
(
ext
->
label
,
style_scrl
->
body
.
padding
.
hor
,
style_scrl
->
body
.
padding
.
ver
);
/*Be sure the Label is in the correct position*/
}
lv_label_set_text
(
ext
->
label
,
NULL
);
...
...
@@ -193,8 +193,8 @@ bool lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
lv_obj_get_height
(
ta
)
!=
area_get_height
(
param
))
{
lv_obj_t
*
scrl
=
lv_page_get_scrl
(
ta
);
lv_style_t
*
style_scrl
=
lv_obj_get_style
(
scrl
);
lv_obj_set_width
(
ext
->
label
,
lv_obj_get_width
(
scrl
)
-
2
*
style_scrl
->
body
.
padding
.
hor
izontal
);
lv_obj_set_pos
(
ext
->
label
,
style_scrl
->
body
.
padding
.
hor
izontal
,
style_scrl
->
body
.
padding
.
vertical
);
lv_obj_set_width
(
ext
->
label
,
lv_obj_get_width
(
scrl
)
-
2
*
style_scrl
->
body
.
padding
.
hor
);
lv_obj_set_pos
(
ext
->
label
,
style_scrl
->
body
.
padding
.
hor
,
style_scrl
->
body
.
padding
.
ver
);
lv_label_set_text
(
ext
->
label
,
NULL
);
/*Refresh the label*/
}
}
...
...
@@ -478,9 +478,9 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
/*Check the bottom*/
cord_t
font_h
=
font_get_height
(
font_p
)
>>
FONT_ANTIALIAS
;
if
(
label_cords
.
y1
+
cur_pos
.
y
+
font_h
+
style_scrl
->
body
.
padding
.
ver
tical
>
ta_cords
.
y2
)
{
if
(
label_cords
.
y1
+
cur_pos
.
y
+
font_h
+
style_scrl
->
body
.
padding
.
ver
>
ta_cords
.
y2
)
{
lv_obj_set_y
(
label_par
,
-
(
cur_pos
.
y
-
lv_obj_get_height
(
ta
)
+
font_h
+
2
*
style_scrl
->
body
.
padding
.
ver
tical
));
font_h
+
2
*
style_scrl
->
body
.
padding
.
ver
));
}
/*Check the left (use the font_h as general unit)*/
if
(
lv_obj_get_x
(
label_par
)
+
cur_pos
.
x
<
font_h
)
{
...
...
@@ -488,9 +488,9 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
}
/*Check the right (use the font_h as general unit)*/
if
(
label_cords
.
x1
+
cur_pos
.
x
+
font_h
+
style_scrl
->
body
.
padding
.
hor
izontal
>
ta_cords
.
x2
)
{
if
(
label_cords
.
x1
+
cur_pos
.
x
+
font_h
+
style_scrl
->
body
.
padding
.
hor
>
ta_cords
.
x2
)
{
lv_obj_set_x
(
label_par
,
-
(
cur_pos
.
x
-
lv_obj_get_width
(
ta
)
+
font_h
+
2
*
style_scrl
->
body
.
padding
.
hor
izontal
));
font_h
+
2
*
style_scrl
->
body
.
padding
.
hor
));
}
/*Reset cursor blink animation*/
...
...
@@ -682,10 +682,10 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en)
ext
->
one_line
=
1
;
lv_cont_set_fit
(
lv_page_get_scrl
(
ta
),
true
,
true
);
lv_obj_set_height
(
ta
,
font_h
+
(
style_ta
->
body
.
padding
.
ver
tical
+
style_scrl
->
body
.
padding
.
vertical
)
*
2
);
lv_obj_set_height
(
ta
,
font_h
+
(
style_ta
->
body
.
padding
.
ver
+
style_scrl
->
body
.
padding
.
ver
)
*
2
);
lv_label_set_long_mode
(
ext
->
label
,
LV_LABEL_LONG_EXPAND
);
lv_label_set_no_break
(
ext
->
label
,
true
);
lv_obj_set_pos
(
lv_page_get_scrl
(
ta
),
style_ta
->
body
.
padding
.
hor
izontal
,
style_ta
->
body
.
padding
.
vertical
);
lv_obj_set_pos
(
lv_page_get_scrl
(
ta
),
style_ta
->
body
.
padding
.
hor
,
style_ta
->
body
.
padding
.
ver
);
}
else
{
lv_ta_ext_t
*
ext
=
lv_obj_get_ext_attr
(
ta
);
lv_style_t
*
style_ta
=
lv_obj_get_style
(
ta
);
...
...
@@ -695,7 +695,7 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en)
lv_label_set_long_mode
(
ext
->
label
,
LV_LABEL_LONG_BREAK
);
lv_label_set_no_break
(
ext
->
label
,
false
);
lv_obj_set_height
(
ta
,
LV_TA_DEF_HEIGHT
);
lv_obj_set_pos
(
lv_page_get_scrl
(
ta
),
style_ta
->
body
.
padding
.
hor
izontal
,
style_ta
->
body
.
padding
.
vertical
);
lv_obj_set_pos
(
lv_page_get_scrl
(
ta
),
style_ta
->
body
.
padding
.
hor
,
style_ta
->
body
.
padding
.
ver
);
}
}
...
...
@@ -868,10 +868,10 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
cur_style
.
body
.
shadow
.
width
=
0
;
cur_style
.
body
.
radius
=
0
;
cur_style
.
body
.
empty
=
0
;
cur_style
.
body
.
padding
.
hor
izontal
=
0
;
cur_style
.
body
.
padding
.
ver
tical
=
0
;
cur_style
.
body
.
padding
.
hor
=
0
;
cur_style
.
body
.
padding
.
ver
=
0
;
cur_style
.
line
.
width
=
1
<<
LV_ANTIALIAS
;
cur_style
.
opa
city
=
OPA_COVER
;
cur_style
.
opa
=
OPA_COVER
;
}
uint16_t
cur_pos
=
lv_ta_get_cursor_pos
(
ta
);
...
...
@@ -916,16 +916,16 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
/*Draw he cursor according to the type*/
area_t
cur_area
;
if
(
ta_ext
->
cursor_type
==
LV_TA_CURSOR_LINE
)
{
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
+
cur_style
.
body
.
padding
.
hor
izontal
-
(
cur_style
.
line
.
width
>>
1
)
-
(
cur_style
.
line
.
width
&
0x1
);
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
+
cur_style
.
body
.
padding
.
ver
tical
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
+
cur_style
.
body
.
padding
.
hor
izontal
+
(
cur_style
.
line
.
width
>>
1
);
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
+
cur_style
.
body
.
padding
.
ver
tical
+
letter_h
;
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
+
cur_style
.
body
.
padding
.
hor
-
(
cur_style
.
line
.
width
>>
1
)
-
(
cur_style
.
line
.
width
&
0x1
);
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
+
cur_style
.
body
.
padding
.
ver
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
+
cur_style
.
body
.
padding
.
hor
+
(
cur_style
.
line
.
width
>>
1
);
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
+
cur_style
.
body
.
padding
.
ver
+
letter_h
;
lv_draw_rect
(
&
cur_area
,
mask
,
&
cur_style
);
}
else
if
(
ta_ext
->
cursor_type
==
LV_TA_CURSOR_BLOCK
)
{
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
-
cur_style
.
body
.
padding
.
hor
izontal
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
-
cur_style
.
body
.
padding
.
ver
tical
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
+
cur_style
.
body
.
padding
.
hor
izontal
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
+
cur_style
.
body
.
padding
.
ver
tical
+
letter_h
;
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
-
cur_style
.
body
.
padding
.
hor
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
-
cur_style
.
body
.
padding
.
ver
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
+
cur_style
.
body
.
padding
.
hor
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
+
cur_style
.
body
.
padding
.
ver
+
letter_h
;
lv_draw_rect
(
&
cur_area
,
mask
,
&
cur_style
);
...
...
@@ -938,24 +938,24 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
char
letter_buf
[
8
]
=
{
0
};
memcpy
(
letter_buf
,
&
txt
[
byte_pos
],
txt_utf8_size
(
txt
[
byte_pos
]));
#endif
cur_area
.
x1
+=
cur_style
.
body
.
padding
.
hor
izontal
;
cur_area
.
y1
+=
cur_style
.
body
.
padding
.
ver
tical
;
cur_area
.
x1
+=
cur_style
.
body
.
padding
.
hor
;
cur_area
.
y1
+=
cur_style
.
body
.
padding
.
ver
;
lv_draw_label
(
&
cur_area
,
mask
,
&
cur_style
,
letter_buf
,
TXT_FLAG_NONE
,
0
);
}
else
if
(
ta_ext
->
cursor_type
==
LV_TA_CURSOR_OUTLINE
)
{
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
-
cur_style
.
body
.
padding
.
hor
izontal
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
-
cur_style
.
body
.
padding
.
ver
tical
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
+
cur_style
.
body
.
padding
.
hor
izontal
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
-
cur_style
.
body
.
padding
.
ver
tical
+
letter_h
;
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
-
cur_style
.
body
.
padding
.
hor
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
-
cur_style
.
body
.
padding
.
ver
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
+
cur_style
.
body
.
padding
.
hor
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
-
cur_style
.
body
.
padding
.
ver
+
letter_h
;
cur_style
.
body
.
empty
=
1
;
if
(
cur_style
.
body
.
border
.
width
==
0
)
cur_style
.
body
.
border
.
width
=
1
<<
LV_ANTIALIAS
;
/*Be sure the border will be drawn*/
lv_draw_rect
(
&
cur_area
,
mask
,
&
cur_style
);
}
else
if
(
ta_ext
->
cursor_type
==
LV_TA_CURSOR_UNDERLINE
)
{
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
+
cur_style
.
body
.
padding
.
hor
izontal
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
+
cur_style
.
body
.
padding
.
ver
tical
+
letter_h
-
(
cur_style
.
line
.
width
>>
1
);
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
+
cur_style
.
body
.
padding
.
hor
izontal
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
+
cur_style
.
body
.
padding
.
ver
tical
+
letter_h
+
(
cur_style
.
line
.
width
>>
1
)
+
(
cur_style
.
line
.
width
&
0x1
);
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
+
cur_style
.
body
.
padding
.
hor
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
+
cur_style
.
body
.
padding
.
ver
+
letter_h
-
(
cur_style
.
line
.
width
>>
1
);
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
coords
.
x1
+
cur_style
.
body
.
padding
.
hor
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
coords
.
y1
+
cur_style
.
body
.
padding
.
ver
+
letter_h
+
(
cur_style
.
line
.
width
>>
1
)
+
(
cur_style
.
line
.
width
&
0x1
);
lv_draw_rect
(
&
cur_area
,
mask
,
&
cur_style
);
}
...
...
lv_objx/lv_tabview.c
View file @
f0080b94
...
...
@@ -201,9 +201,9 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
/*Modify the indicator size*/
lv_style_t
*
style_tabs
=
lv_obj_get_style
(
ext
->
tabs
);
cord_t
indic_width
=
(
lv_obj_get_width
(
tabview
)
-
style_tabs
->
body
.
padding
.
inner
*
(
ext
->
tab_cnt
-
1
)
-
2
*
style_tabs
->
body
.
padding
.
hor
izontal
)
/
ext
->
tab_cnt
;
cord_t
indic_width
=
(
lv_obj_get_width
(
tabview
)
-
style_tabs
->
body
.
padding
.
inner
*
(
ext
->
tab_cnt
-
1
)
-
2
*
style_tabs
->
body
.
padding
.
hor
)
/
ext
->
tab_cnt
;
lv_obj_set_width
(
ext
->
indic
,
indic_width
);
lv_obj_set_x
(
ext
->
indic
,
indic_width
*
ext
->
tab_act
+
style_tabs
->
body
.
padding
.
inner
*
ext
->
tab_act
+
style_tabs
->
body
.
padding
.
hor
izontal
);
lv_obj_set_x
(
ext
->
indic
,
indic_width
*
ext
->
tab_act
+
style_tabs
->
body
.
padding
.
inner
*
ext
->
tab_act
+
style_tabs
->
body
.
padding
.
hor
);
/*Set the first tab as active*/
if
(
ext
->
tab_cnt
==
1
)
{
...
...
@@ -235,7 +235,7 @@ void lv_tabview_set_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
anim_en
=
false
;
#endif
cord_t
cont_x
=
-
(
lv_obj_get_width
(
tabview
)
*
id
+
style
->
body
.
padding
.
inner
*
id
+
style
->
body
.
padding
.
hor
izontal
);
cord_t
cont_x
=
-
(
lv_obj_get_width
(
tabview
)
*
id
+
style
->
body
.
padding
.
inner
*
id
+
style
->
body
.
padding
.
hor
);
if
(
anim_en
==
false
)
{
lv_obj_set_x
(
ext
->
content
,
cont_x
);
}
else
{
...
...
@@ -258,7 +258,7 @@ void lv_tabview_set_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
/*Move the indicator*/
cord_t
indic_width
=
lv_obj_get_width
(
ext
->
indic
);
lv_style_t
*
tabs_style
=
lv_obj_get_style
(
ext
->
tabs
);
cord_t
indic_x
=
indic_width
*
id
+
tabs_style
->
body
.
padding
.
inner
*
id
+
tabs_style
->
body
.
padding
.
hor
izontal
;
cord_t
indic_x
=
indic_width
*
id
+
tabs_style
->
body
.
padding
.
inner
*
id
+
tabs_style
->
body
.
padding
.
hor
;
if
(
anim_en
==
false
)
{
lv_obj_set_x
(
ext
->
indic
,
indic_x
);
...
...
@@ -376,7 +376,7 @@ void lv_tabview_realign(lv_obj_t * tabview)
if
(
ext
->
tab_cnt
!=
0
)
{
lv_style_t
*
style_tabs
=
lv_obj_get_style
(
ext
->
tabs
);
cord_t
indic_width
=
(
lv_obj_get_width
(
tabview
)
-
style_tabs
->
body
.
padding
.
inner
*
(
ext
->
tab_cnt
-
1
)
-
2
*
style_tabs
->
body
.
padding
.
hor
izontal
)
/
ext
->
tab_cnt
;
2
*
style_tabs
->
body
.
padding
.
hor
)
/
ext
->
tab_cnt
;
lv_obj_set_width
(
ext
->
indic
,
indic_width
);
}
...
...
@@ -534,7 +534,7 @@ static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage)
lv_style_t
*
indic_style
=
lv_obj_get_style
(
ext
->
indic
);
cord_t
p
=
((
tabpage
->
coords
.
x1
-
tabview
->
coords
.
x1
)
*
(
indic_width
+
tabs_style
->
body
.
padding
.
inner
))
/
lv_obj_get_width
(
tabview
);
lv_obj_set_x
(
ext
->
indic
,
indic_width
*
ext
->
tab_act
+
tabs_style
->
body
.
padding
.
inner
*
ext
->
tab_act
+
indic_style
->
body
.
padding
.
hor
izontal
-
p
);
lv_obj_set_x
(
ext
->
indic
,
indic_width
*
ext
->
tab_act
+
tabs_style
->
body
.
padding
.
inner
*
ext
->
tab_act
+
indic_style
->
body
.
padding
.
hor
-
p
);
}
}
...
...
lv_objx/lv_win.c
View file @
f0080b94
...
...
@@ -343,7 +343,7 @@ cord_t lv_win_get_width(lv_obj_t * win)
lv_obj_t
*
scrl
=
lv_page_get_scrl
(
ext
->
page
);
lv_style_t
*
style_scrl
=
lv_obj_get_style
(
scrl
);
return
lv_obj_get_width
(
scrl
)
-
2
*
style_scrl
->
body
.
padding
.
hor
izontal
;
return
lv_obj_get_width
(
scrl
)
-
2
*
style_scrl
->
body
.
padding
.
hor
;
}
/**
...
...
@@ -414,16 +414,16 @@ static void lv_win_realign(lv_obj_t * win)
}
lv_style_t
*
btnh_style
=
lv_obj_get_style
(
ext
->
btnh
);
lv_obj_set_height
(
ext
->
btnh
,
ext
->
cbtn_size
+
2
*
btnh_style
->
body
.
padding
.
ver
tical
*
2
);
lv_obj_set_height
(
ext
->
btnh
,
ext
->
cbtn_size
+
2
*
btnh_style
->
body
.
padding
.
ver
*
2
);
lv_obj_set_width
(
ext
->
header
,
lv_obj_get_width
(
win
));
/*Align the higher object first to make the correct header size first*/
if
(
lv_obj_get_height
(
ext
->
title
)
>
lv_obj_get_height
(
ext
->
btnh
))
{
lv_obj_align
(
ext
->
title
,
NULL
,
LV_ALIGN_IN_LEFT_MID
,
ext
->
style_header
->
body
.
padding
.
hor
izontal
,
0
);
lv_obj_align
(
ext
->
btnh
,
NULL
,
LV_ALIGN_IN_RIGHT_MID
,
-
ext
->
style_header
->
body
.
padding
.
hor
izontal
,
0
);
lv_obj_align
(
ext
->
title
,
NULL
,
LV_ALIGN_IN_LEFT_MID
,
ext
->
style_header
->
body
.
padding
.
hor
,
0
);
lv_obj_align
(
ext
->
btnh
,
NULL
,
LV_ALIGN_IN_RIGHT_MID
,
-
ext
->
style_header
->
body
.
padding
.
hor
,
0
);
}
else
{
lv_obj_align
(
ext
->
btnh
,
NULL
,
LV_ALIGN_IN_RIGHT_MID
,
-
ext
->
style_header
->
body
.
padding
.
hor
izontal
,
0
);
lv_obj_align
(
ext
->
title
,
NULL
,
LV_ALIGN_IN_LEFT_MID
,
ext
->
style_header
->
body
.
padding
.
hor
izontal
,
0
);
lv_obj_align
(
ext
->
btnh
,
NULL
,
LV_ALIGN_IN_RIGHT_MID
,
-
ext
->
style_header
->
body
.
padding
.
hor
,
0
);
lv_obj_align
(
ext
->
title
,
NULL
,
LV_ALIGN_IN_LEFT_MID
,
ext
->
style_header
->
body
.
padding
.
hor
,
0
);
}
lv_obj_set_pos_scale
(
ext
->
header
,
0
,
0
);
...
...
@@ -435,7 +435,7 @@ static void lv_win_realign(lv_obj_t * win)
lv_style_t
*
style_page
=
lv_obj_get_style
(
page
);
lv_obj_t
*
scrl
=
lv_page_get_scrl
(
page
);
lv_obj_set_width
(
scrl
,
lv_obj_get_width
(
page
)
-
2
*
style_page
->
body
.
padding
.
hor
izontal
);
lv_obj_set_width
(
scrl
,
lv_obj_get_width
(
page
)
-
2
*
style_page
->
body
.
padding
.
hor
);
}
#endif
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