Skip to content

Commit cb593b3

Browse files
W-MaiuLipe
authored andcommitted
chore(arc_label): documentation, formatting, redundant code fixes
1 parent 059eb4a commit cb593b3

File tree

7 files changed

+20
-21
lines changed

7 files changed

+20
-21
lines changed

examples/widgets/arc_label/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Simple Arc Label
2-
----------
2+
----------------
33

44
.. lv_example:: widgets/arc_label/lv_example_arc_label_1
55
:language: c

examples/widgets/arc_label/lv_example_arc_label_1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#if LV_USE_ARC_LABEL && LV_BUILD_EXAMPLES
44

5-
const char * ARC_LABEL_TEXT =
5+
static const char * ARC_LABEL_TEXT =
66
"I'm on an #FA7C45 ARC#! Centered with #12c2E9 C##8B68E8 O##c471ed L##B654E5 O##C84AB2 R##DB417A F##f64659 U##ff8888 L# feature!\n";
77

88
void lv_example_arc_label_1(void)

lv_conf_template.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@
699699
* - lv_dropdown_t : Options set to "Option 1", "Option 2", "Option 3", else no values are set.
700700
* - lv_roller_t : Options set to "Option 1", "Option 2", "Option 3", "Option 4", "Option 5", else no values are set.
701701
* - lv_label_t : Text set to "Text", else empty string.
702+
* - lv_arc_label_t : Text set to "Arced Text", else empty string.
702703
* */
703704
#define LV_WIDGETS_HAS_DEFAULT_VALUE 1
704705

src/lv_conf_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,6 +2030,7 @@
20302030
* - lv_dropdown_t : Options set to "Option 1", "Option 2", "Option 3", else no values are set.
20312031
* - lv_roller_t : Options set to "Option 1", "Option 2", "Option 3", "Option 4", "Option 5", else no values are set.
20322032
* - lv_label_t : Text set to "Text", else empty string.
2033+
* - lv_arc_label_t : Text set to "Arced Text", else empty string.
20332034
* */
20342035
#ifndef LV_WIDGETS_HAS_DEFAULT_VALUE
20352036
#ifdef LV_KCONFIG_PRESENT

src/widgets/arc_label/lv_arc_label.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ void lv_arc_label_set_text_fmt(lv_obj_t * obj, const char * fmt, ...)
137137
LV_ASSERT_OBJ(obj, MY_CLASS);
138138
LV_ASSERT_NULL(fmt);
139139

140-
lv_obj_invalidate(obj);
141140
lv_arc_label_t * arc_label = (lv_arc_label_t *)obj;
142141

143142
/*If text is NULL then refresh*/
@@ -346,11 +345,9 @@ static void lv_arc_label_constructor(const lv_obj_class_t * class_p, lv_obj_t *
346345
arc->dir = LV_ARC_LABEL_DIR_CLOCKWISE;
347346
arc->recolor = false;
348347

349-
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE);
350-
lv_arc_label_set_text(obj, LV_ARC_LABEL_DEFAULT_TEXT);
348+
lv_arc_label_set_text_static(obj, LV_ARC_LABEL_DEFAULT_TEXT);
351349

352-
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE);
353-
lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLL_CHAIN | LV_OBJ_FLAG_SCROLLABLE);
350+
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLL_CHAIN | LV_OBJ_FLAG_SCROLLABLE);
354351

355352
LV_TRACE_OBJ_CREATE("finished");
356353
}

src/widgets/arc_label/lv_arc_label.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arc_label_class;
5151
**********************/
5252

5353
/**
54-
* Create an arc object
55-
* @param parent pointer to an object, it will be the parent of the new arc
56-
* @return pointer to the created arc
54+
* Create an arc label object
55+
* @param parent pointer to an object, it will be the parent of the new arc label
56+
* @return pointer to the created arc label
5757
*/
5858
lv_obj_t * lv_arc_label_create(lv_obj_t * parent);
5959

@@ -98,35 +98,35 @@ void lv_arc_label_set_text_static(lv_obj_t * obj, const char * text);
9898

9999
/**
100100
* Set the start angle of an arc. 0 deg: right, 90 bottom, etc.
101-
* @param obj pointer to an arc object
101+
* @param obj pointer to an arc label object
102102
* @param start the start angle. (if `LV_USE_FLOAT` is enabled it can be fractional too.)
103103
*/
104104
void lv_arc_label_set_angle_start(lv_obj_t * obj, lv_value_precise_t start);
105105

106106
/**
107107
* Set the end angle of an arc. 0 deg: right, 90 bottom, etc.
108-
* @param obj pointer to an arc object
108+
* @param obj pointer to an arc label object
109109
* @param size the angle size (if `LV_USE_FLOAT` is enabled it can be fractional too.)
110110
*/
111111
void lv_arc_label_set_angle_size(lv_obj_t * obj, lv_value_precise_t size);
112112

113113
/**
114114
* Set the rotation for the whole arc
115-
* @param obj pointer to an arc object
115+
* @param obj pointer to an arc label object
116116
* @param offset rotation angle
117117
*/
118118
void lv_arc_label_set_offset(lv_obj_t * obj, int32_t offset);
119119

120120
/**
121121
* Set the type of arc.
122-
* @param obj pointer to arc object
122+
* @param obj pointer to and arc label object
123123
* @param dir arc label's direction
124124
*/
125125
void lv_arc_label_set_dir(lv_obj_t * obj, lv_arc_label_dir_t dir);
126126

127127
/**
128128
* Enable the recoloring by in-line commands
129-
* @param obj pointer to a label object
129+
* @param obj pointer to an arc label object
130130
* @param en true: enable recoloring, false: disable
131131
* Example: "This is a #ff0000 red# word"
132132
*/
@@ -174,21 +174,21 @@ void lv_arc_label_set_text_horizontal_align(lv_obj_t * obj, lv_arc_label_text_al
174174

175175
/**
176176
* Get the start angle of an arc label.
177-
* @param obj pointer to an arc object
177+
* @param obj pointer to an arc label object
178178
* @return the start angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.)
179179
*/
180180
lv_value_precise_t lv_arc_label_get_angle_start(lv_obj_t * obj);
181181

182182
/**
183183
* Get the angle size of an arc label.
184-
* @param obj pointer to an arc object
184+
* @param obj pointer to an arc label object
185185
* @return the end angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.)
186186
*/
187187
lv_value_precise_t lv_arc_label_get_angle_size(lv_obj_t * obj);
188188

189189
/**
190-
* Get whether the arc is type or not.
191-
* @param obj pointer to an arc object
190+
* Get whether the arc label is type or not.
191+
* @param obj pointer to an arc label object
192192
* @return arc label's direction
193193
*/
194194
lv_arc_label_dir_t lv_arc_label_get_dir(const lv_obj_t * obj);
@@ -205,7 +205,7 @@ bool lv_arc_label_get_recolor(lv_obj_t * obj);
205205

206206
/**
207207
* Get the text of the arc label.
208-
* @param obj pointer to an arc object
208+
* @param obj pointer to an arc label object
209209
* @return the radius of the arc label
210210
*/
211211
uint32_t lv_arc_label_get_radius(lv_obj_t * obj);

tests/src/test_cases/widgets/test_arc_label.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define EXT_NAME ".lp32.png"
1717
#endif
1818

19-
const char * ARC_LABEL_TEXT =
19+
static const char * ARC_LABEL_TEXT =
2020
"I'm on an #FA7C45 ARC#! Centered with #12c2E9 C##8B68E8 O##c471ed L##B654E5 O##C84AB2 R##DB417A F##f64659 U##ff8888 L# 特性! \n";
2121

2222
static lv_font_t * font;

0 commit comments

Comments
 (0)