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
f06534eb
Commit
f06534eb
authored
Oct 10, 2017
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/beta' into dev-5.0
parents
a78ea8f2
57619fca
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
39 deletions
+52
-39
lv_obj.c
lv_obj/lv_obj.c
+4
-1
lv_cont.c
lv_objx/lv_cont.c
+5
-11
lv_page.c
lv_objx/lv_page.c
+12
-8
lv_ta.c
lv_objx/lv_ta.c
+31
-19
No files found.
lv_obj/lv_obj.c
View file @
f06534eb
...
...
@@ -817,6 +817,9 @@ void lv_obj_set_style(lv_obj_t * obj, lv_style_t * style)
/*Send a signal about style change to every children with NULL style*/
lv_child_refr_style
(
obj
);
/*Notify the object about the style change too*/
lv_obj_refr_style
(
obj
);
}
/**
...
...
@@ -1557,7 +1560,7 @@ static void lv_child_refr_style(lv_obj_t * obj)
while
(
child
!=
NULL
)
{
if
(
child
->
style_p
==
NULL
)
{
lv_child_refr_style
(
child
);
/*Check children too*/
lv_obj_refr_style
(
obj
);
/*Send a style change signal to the object
*/
lv_obj_refr_style
(
child
);
/*Notify the child about the style change
*/
}
else
if
(
child
->
style_p
->
glass
)
{
/*Children with 'glass' parent might be effected if their style == NULL*/
lv_child_refr_style
(
child
);
...
...
lv_objx/lv_cont.c
View file @
f06534eb
...
...
@@ -116,24 +116,18 @@ bool lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param)
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if
(
valid
!=
false
)
{
switch
(
sign
)
{
case
LV_SIGNAL_STYLE_CHG
:
/*Recalculate the padding if the style changed*/
if
(
sign
==
LV_SIGNAL_STYLE_CHG
)
{
/*Recalculate the padding if the style changed*/
lv_cont_refr_layout
(
cont
);
lv_cont_refr_autofit
(
cont
);
break
;
case
LV_SIGNAL_CHILD_CHG
:
}
else
if
(
sign
==
LV_SIGNAL_CHILD_CHG
)
{
lv_cont_refr_layout
(
cont
);
lv_cont_refr_autofit
(
cont
);
break
;
case
LV_SIGNAL_CORD_CHG
:
if
(
lv_obj_get_width
(
cont
)
!=
area_get_width
(
param
)
||
lv_obj_get_height
(
cont
)
!=
area_get_height
(
param
))
{
}
else
if
(
sign
==
LV_SIGNAL_CORD_CHG
)
{
if
(
lv_obj_get_width
(
cont
)
!=
area_get_width
(
param
)
||
lv_obj_get_height
(
cont
)
!=
area_get_height
(
param
))
{
lv_cont_refr_layout
(
cont
);
lv_cont_refr_autofit
(
cont
);
}
break
;
default:
break
;
}
}
...
...
lv_objx/lv_page.c
View file @
f06534eb
...
...
@@ -157,6 +157,8 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
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
->
hpad
);
}
else
{
ext
->
scrl
->
signal_f
(
ext
->
scrl
,
LV_SIGNAL_CORD_CHG
,
&
ext
->
scrl
->
cords
);
}
if
(
ext
->
sb_mode
==
LV_PAGE_SB_MODE_ON
)
{
...
...
@@ -172,8 +174,8 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
lv_style_t
*
style
=
lv_obj_get_style
(
page
);
/*Refresh the scrollbar and notify the scrl if the size is changed*/
if
(
ext
->
scrl
!=
NULL
&&
(
lv_obj_get_width
(
page
)
!=
area_get_width
(
param
)
||
lv_obj_get_height
(
page
)
!=
area_get_height
(
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
->
hpad
);
...
...
@@ -181,9 +183,9 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
ext
->
scrl
->
signal_f
(
ext
->
scrl
,
LV_SIGNAL_CORD_CHG
,
&
ext
->
scrl
->
cords
);
/*The scrollbars are important o
ln
y if they are visible now*/
/*The scrollbars are important o
nl
y if they are visible now*/
if
(
ext
->
sbh_draw
!=
0
||
ext
->
sbv_draw
!=
0
)
lv_page_sb_refresh
(
page
);
lv_page_sb_refresh
(
page
);
}
}
else
if
(
sign
==
LV_SIGNAL_PRESSED
)
{
...
...
@@ -224,6 +226,12 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
lv_page_ext_t
*
page_ext
=
lv_obj_get_ext
(
page
);
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
->
hpad
);
}
cord_t
new_x
;
cord_t
new_y
;
bool
refr_x
=
false
;
...
...
@@ -278,10 +286,6 @@ 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_CORD_CHG
)
{
if
(
lv_cont_get_hfit
(
scrl
)
==
false
)
{
lv_obj_set_width
(
scrl
,
lv_obj_get_width
(
page
)
-
2
*
page_style
->
hpad
);
}
}
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
->
hpad
);
...
...
lv_objx/lv_ta.c
View file @
f06534eb
...
...
@@ -172,9 +172,16 @@ bool lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
}
else
if
(
sign
==
LV_SIGNAL_STYLE_CHG
)
{
if
(
ext
->
label
)
{
lv_obj_t
*
scrl
=
lv_page_get_scrl
(
ta
);
lv_style_t
*
style_ta
=
lv_obj_get_style
(
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
->
hpad
);
lv_obj_set_pos
(
ext
->
label
,
style_scrl
->
hpad
,
style_scrl
->
vpad
);
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
->
font
)
>>
FONT_ANTIALIAS
;
lv_obj_set_height
(
ta
,
font_h
+
(
style_ta
->
vpad
+
style_scrl
->
vpad
)
*
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
->
hpad
);
lv_obj_set_pos
(
ext
->
label
,
style_scrl
->
hpad
,
style_scrl
->
vpad
);
/*Be sure the Label is in the correct position*/
}
lv_label_set_text
(
ext
->
label
,
NULL
);
lv_obj_refr_ext_size
(
lv_page_get_scrl
(
ta
));
...
...
@@ -670,12 +677,13 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en)
if
(
en
!=
false
)
{
lv_ta_ext_t
*
ext
=
lv_obj_get_ext
(
ta
);
lv_style_t
*
style_ta
=
lv_obj_get_style
(
ta
);
lv_style_t
*
style_scrl
=
lv_obj_get_style
(
lv_page_get_scrl
(
ta
));
lv_style_t
*
style_label
=
lv_obj_get_style
(
ext
->
label
);
cord_t
font_h
=
font_get_height
(
style_label
->
font
)
>>
FONT_ANTIALIAS
;
ext
->
one_line
=
1
;
lv_cont_set_fit
(
lv_page_get_scrl
(
ta
),
true
,
true
);
lv_obj_set_height
(
ta
,
font_h
+
style_ta
->
vpad
*
2
);
lv_obj_set_height
(
ta
,
font_h
+
(
style_ta
->
vpad
+
style_scrl
->
vpad
)
*
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
->
hpad
,
style_ta
->
vpad
);
...
...
@@ -863,6 +871,8 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
cur_style
.
radius
=
0
;
cur_style
.
empty
=
0
;
cur_style
.
opa
=
OPA_COVER
;
cur_style
.
hpad
=
0
;
cur_style
.
vpad
=
0
;
}
uint16_t
cur_pos
=
lv_ta_get_cursor_pos
(
ta
);
...
...
@@ -907,16 +917,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
->
cords
.
x1
-
(
cur_style
.
line_width
>>
1
)
-
(
cur_style
.
line_width
&
0x1
);
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
(
cur_style
.
line_width
>>
1
);
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
letter_h
;
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
cur_style
.
hpad
-
(
cur_style
.
line_width
>>
1
)
-
(
cur_style
.
line_width
&
0x1
);
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
cur_style
.
vpad
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
cur_style
.
hpad
+
(
cur_style
.
line_width
>>
1
);
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
cur_style
.
vpad
+
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
->
cords
.
x1
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
letter_h
;
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
-
cur_style
.
hpad
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
-
cur_style
.
vpad
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
cur_style
.
hpad
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
cur_style
.
vpad
+
letter_h
;
lv_draw_rect
(
&
cur_area
,
mask
,
&
cur_style
);
...
...
@@ -929,22 +939,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
.
hpad
;
cur_area
.
y1
+=
cur_style
.
vpad
;
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
->
cords
.
x1
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
letter_h
;
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
-
cur_style
.
hpad
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
-
cur_style
.
vpad
;
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
cur_style
.
hpad
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
-
cur_style
.
vpad
+
letter_h
;
cur_style
.
empty
=
1
;
if
(
cur_style
.
bwidth
==
0
)
cur_style
.
bwidth
=
1
*
LV_DOWNSCALE
;
/*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
->
cords
.
x1
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
letter_h
-
(
cur_style
.
line_width
>>
1
);
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
letter_h
+
(
cur_style
.
line_width
>>
1
)
+
(
cur_style
.
line_width
&
0x1
);
cur_area
.
x1
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
cur_style
.
hpad
;
cur_area
.
y1
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
cur_style
.
vpad
+
letter_h
-
(
cur_style
.
line_width
>>
1
);
cur_area
.
x2
=
letter_pos
.
x
+
ta_ext
->
label
->
cords
.
x1
+
cur_style
.
hpad
+
letter_w
;
cur_area
.
y2
=
letter_pos
.
y
+
ta_ext
->
label
->
cords
.
y1
+
cur_style
.
vpad
+
letter_h
+
(
cur_style
.
line_width
>>
1
)
+
(
cur_style
.
line_width
&
0x1
);
lv_draw_rect
(
&
cur_area
,
mask
,
&
cur_style
);
}
...
...
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