Cleaning the code
This commit is contained in:
@@ -18,8 +18,6 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_BAR_DEF_WIDTH (LV_DPI * 2)
|
||||
#define LV_BAR_DEF_HEIGHT (LV_DPI / 2)
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -77,7 +75,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Init the new bar object*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_click(new_bar, false);
|
||||
lv_obj_set_size(new_bar, LV_BAR_DEF_WIDTH, LV_BAR_DEF_HEIGHT);
|
||||
lv_obj_set_size(new_bar, LV_DPI * 2, LV_DPI / 3);
|
||||
lv_obj_set_style(new_bar, lv_style_get(LV_STYLE_PRETTY, NULL));
|
||||
lv_bar_set_value(new_bar, ext->act_value);
|
||||
} else {
|
||||
@@ -245,6 +243,9 @@ static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t
|
||||
ancestor_design_f(bar, mask, mode);
|
||||
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
|
||||
|
||||
|
||||
lv_style_t * style_indic = lv_bar_get_style_indic(bar);
|
||||
area_t indic_area;
|
||||
area_cpy(&indic_area, &bar->cords);
|
||||
|
||||
@@ -7,16 +7,16 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include <misc/gfx/area.h>
|
||||
#include <lvgl/lv_obj/lv_obj.h>
|
||||
#include <misc/gfx/color.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_BTN != 0
|
||||
|
||||
#include <string.h>
|
||||
#include "lv_btn.h"
|
||||
#include "lvgl/lv_obj/lv_obj.h"
|
||||
#include "misc/gfx/area.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "lv_btn.h"
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#if USE_LV_BTN != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_btn: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
|
||||
#if USE_LV_CONT == 0
|
||||
#error "lv_btn: lv_cont is required. Enable it in lv_conf.h (USE_LV_CONT 1) "
|
||||
#endif
|
||||
|
||||
#include <lvgl/lv_objx/lv_cont.h>
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#if USE_LV_BTNM != 0
|
||||
|
||||
#include "lv_btnm.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "misc/gfx/text.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_obj/lv_refr.h"
|
||||
|
||||
/*********************
|
||||
@@ -26,7 +26,6 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_t mode);
|
||||
static uint8_t lv_btnm_get_width_unit(const char * btn_str);
|
||||
static uint16_t lv_btnm_get_btn_from_point(lv_obj_t * btnm, point_t * p);
|
||||
|
||||
@@ -13,17 +13,7 @@
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_BTNM != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_btnm: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_BTN == 0
|
||||
#error "lv_btnm: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) "
|
||||
#endif
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include <lvgl/lv_objx/lv_cont.h>
|
||||
#include "lv_label.h"
|
||||
#include "lv_btn.h"
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_btn_set_tgl(new_cb, true);
|
||||
|
||||
lv_obj_set_click(ext->bullet, false);
|
||||
lv_btn_set_styles(ext->bullet, lv_style_get(LV_STYLE_BTN_REL, NULL), lv_style_get(LV_STYLE_BTN_PR, NULL),
|
||||
lv_btn_set_styles(ext->bullet, lv_style_get(LV_STYLE_PRETTY, NULL), lv_style_get(LV_STYLE_PRETTY_COLOR, NULL),
|
||||
lv_style_get(LV_STYLE_BTN_TREL, NULL), lv_style_get(LV_STYLE_BTN_TPR, NULL),
|
||||
lv_style_get(LV_STYLE_BTN_INA, NULL));
|
||||
|
||||
@@ -88,8 +88,6 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refr_style(new_cb);
|
||||
}
|
||||
|
||||
lv_obj_align_us(new_cb, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
return new_cb;
|
||||
}
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_CB != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_BTN == 0
|
||||
#error "lv_cb: lv_rect is required. Enable it in lv_conf.h (USE_LV_BTN 1) "
|
||||
#error "lv_cb: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_LABEL == 0
|
||||
|
||||
@@ -499,7 +499,7 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
|
||||
|
||||
style_point.bwidth = 0;
|
||||
style_point.empty = 0;
|
||||
style_point.radius = LV_DRAW_CIRCLE;
|
||||
style_point.radius = LV_RADIUS_CIRCLE;
|
||||
style_point.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
|
||||
style_point.radius = ext->dl_width;
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_CHARTBG_H
|
||||
#define LV_CHARTBG_H
|
||||
#ifndef LV_CHART_H
|
||||
#define LV_CHART_H
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
@@ -12,17 +12,7 @@
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_CHART != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_chart: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_LINE == 0
|
||||
#error "lv_chart: lv_line is required. Enable it in lv_conf.h (USE_LV_LINE 1) "
|
||||
#endif
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include <lvgl/lv_objx/lv_cont.h>
|
||||
#include "lv_line.h"
|
||||
|
||||
/*********************
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_LV_RECT != 0
|
||||
#if USE_LV_CONT != 0
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
@@ -19,8 +19,6 @@
|
||||
#include "../lv_draw/lv_draw_vbasic.h"
|
||||
#include "misc/gfx/area.h"
|
||||
|
||||
#include "misc/mem/dyn_mem.h"
|
||||
#include "misc/mem/linked_list.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "misc/math/math_base.h"
|
||||
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_RECT != 0
|
||||
#if USE_LV_CONT != 0
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include "../lv_obj/lv_dispi.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#ifndef LV_DDLIST_ANIM_TIME
|
||||
#define LV_DDLIST_ANIM_TIME 100 /*ms*/
|
||||
#endif
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
@@ -11,6 +11,16 @@
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_DDLIST != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_PAGE == 0
|
||||
#error "lv_ddlist: lv_page is required. Enable it in lv_conf.h (USE_LV_PAGE 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_LABEL == 0
|
||||
#error "lv_ddlist: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) "
|
||||
#endif
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include "../lv_objx/lv_page.h"
|
||||
#include "../lv_objx/lv_label.h"
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
#if USE_LV_GAUGE != 0
|
||||
|
||||
#include "lv_gauge.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "misc/gfx/text.h"
|
||||
#include "misc/math/trigo.h"
|
||||
#include "misc/math/math_base.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -434,7 +434,7 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style
|
||||
lv_style_get(LV_STYLE_PLAIN, &style_neddle_mid);
|
||||
style_neddle_mid.mcolor = style->bcolor;
|
||||
style_neddle_mid.gcolor = style->bcolor;
|
||||
style_neddle_mid.radius = LV_DRAW_CIRCLE;
|
||||
style_neddle_mid.radius = LV_RADIUS_CIRCLE;
|
||||
|
||||
area_t nm_cord;
|
||||
nm_cord.x1 = x_ofs - style->opad;
|
||||
|
||||
@@ -14,16 +14,8 @@
|
||||
#if USE_LV_GAUGE != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_gauge: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_LABEL == 0
|
||||
#error "lv_gauge: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_gauge: lv_line is required. Enable it in lv_conf.h (USE_LV_LINE 1) "
|
||||
#if USE_LV_LMETER == 0
|
||||
#error "lv_gauge: lv_lmeter is required. Enable it in lv_conf.h (USE_LV_LMETER 1) "
|
||||
#endif
|
||||
|
||||
#if USE_TRIGO == 0
|
||||
|
||||
@@ -24,7 +24,11 @@
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include "misc/fs/fsint.h"
|
||||
|
||||
#if LV_IMG_ENABLE_SYMBOLS
|
||||
#ifndef LV_IMG_ENABLE_SYMBOLS
|
||||
#define LV_IMG_ENABLE_SYMBOLS 0
|
||||
#endif
|
||||
|
||||
#if LV_IMG_ENABLE_SYMBOLS != 0
|
||||
#include "lv_label.h"
|
||||
#include "misc/gfx/fonts/symbol_def.h"
|
||||
#endif
|
||||
|
||||
@@ -10,13 +10,8 @@
|
||||
|
||||
#if USE_LV_LINE != 0
|
||||
#include "lv_line.h"
|
||||
#include "../lv_draw/lv_draw_vbasic.h"
|
||||
#include "../lv_draw/lv_draw_rbasic.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include <misc/gfx/area.h>
|
||||
#include <misc/math/math_base.h>
|
||||
#include <misc/mem/dyn_mem.h>
|
||||
#include <misc/gfx/color.h>
|
||||
#include "misc/math/math_base.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*Search an replace: line meter -> object normal name with lower case (e.g. button, label etc.)
|
||||
* lmeter -> object short name with lower case(e.g. btn, label etc)
|
||||
* LMETER -> object short name with upper case (e.g. BTN, LABEL etc.)
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
@@ -3,13 +3,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*Search an replace: line meter -> object normal name with lower case (e.g. button, label etc.)
|
||||
* lmeter -> object short name with lower case(e.g. btn, label etc)
|
||||
* LMETER -> object short name with upper case (e.g. BTN, LABEL etc.)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_LMETER_H
|
||||
#define LV_LMETER_H
|
||||
|
||||
@@ -17,8 +10,19 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#include "misc_conf.h"
|
||||
#if USE_LV_LMETER != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_BAR == 0
|
||||
#error "lv_lmeter: lv_bar is required. Enable it in lv_conf.h (USE_LV_BAR 1) "
|
||||
#endif
|
||||
|
||||
#if USE_TRIGO == 0
|
||||
#error "lv_lmeter: trigo is required. Enable it in misc_conf.h (USE_TRIGO 1) "
|
||||
#endif
|
||||
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include "lv_bar.h"
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#if USE_LV_MBOX != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_mbox: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
|
||||
#if USE_LV_CONT == 0
|
||||
#error "lv_mbox: lv_cont is required. Enable it in lv_conf.h (USE_LV_CONT 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_BTN == 0
|
||||
|
||||
@@ -73,7 +73,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->sbh_draw = 0;
|
||||
ext->sbv_draw = 0;
|
||||
ext->style_sb = lv_style_get(LV_STYLE_PRETTY, NULL);
|
||||
ext->sb_width = LV_DPI / 6;
|
||||
ext->sb_width = LV_DPI / 8;
|
||||
ext->sb_mode = LV_PAGE_SB_MODE_ON;
|
||||
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_page);
|
||||
|
||||
@@ -13,12 +13,13 @@
|
||||
#if USE_LV_PAGE != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_page: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
|
||||
#if USE_LV_CONT == 0
|
||||
#error "lv_page: lv_cont is required. Enable it in lv_conf.h (USE_LV_CONT 1) "
|
||||
#endif
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include <lvgl/lv_objx/lv_cont.h>
|
||||
#include "lvgl/lv_objx/lv_cont.h"
|
||||
#include "../lv_obj/lv_dispi.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
||||
@@ -65,7 +65,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->style_header = lv_style_get(LV_STYLE_PLAIN_COLOR, NULL);
|
||||
ext->style_cbtn_rel = lv_style_get(LV_STYLE_BTN_REL, NULL);
|
||||
ext->style_cbtn_pr = lv_style_get(LV_STYLE_BTN_PR, NULL);
|
||||
ext->cbtn_size = (3 * LV_DPI) / 4;
|
||||
ext->cbtn_size = ( LV_DPI) / 2;
|
||||
|
||||
/*Init the new window object*/
|
||||
if(copy == NULL) {
|
||||
@@ -410,7 +410,7 @@ static void lv_win_realign(lv_obj_t * win)
|
||||
if(ext->page == NULL || ext->btnh == NULL || ext->header == NULL || ext->title == NULL) return;
|
||||
|
||||
lv_obj_t * cbtn;
|
||||
/*Refresh the style of all control buttons*/
|
||||
/*Refresh the size of all control buttons*/
|
||||
cbtn = lv_obj_get_child(ext->btnh, NULL);
|
||||
while(cbtn != NULL) {
|
||||
lv_obj_set_size(cbtn, ext->cbtn_size, ext->cbtn_size);
|
||||
|
||||
Reference in New Issue
Block a user