run clang format

This commit is contained in:
Gabor Kiss-Vamosi
2019-04-04 07:15:40 +02:00
parent 80e2a1d5d5
commit ba2160042a
146 changed files with 9591 additions and 9330 deletions

View File

@@ -8,7 +8,6 @@
*********************/
#include "lv_theme.h"
#if LV_USE_THEME_MONO
/*********************
@@ -38,7 +37,6 @@ static lv_style_t dark_frame;
/*Saved input parameters*/
static lv_font_t * _font;
/**********************
* MACROS
**********************/
@@ -49,33 +47,33 @@ static lv_font_t * _font;
static void basic_init(void)
{
lv_style_copy(&def, &lv_style_plain); /*Initialize the default style*/
def.body.main_color = LV_COLOR_WHITE;
def.body.grad_color = LV_COLOR_WHITE;
def.body.radius = 0;
def.body.opa = LV_OPA_COVER;
def.body.padding.left = LV_DPI / 10;
def.body.padding.right = LV_DPI / 10;
def.body.padding.top = LV_DPI / 10;
lv_style_copy(&def, &lv_style_plain); /*Initialize the default style*/
def.body.main_color = LV_COLOR_WHITE;
def.body.grad_color = LV_COLOR_WHITE;
def.body.radius = 0;
def.body.opa = LV_OPA_COVER;
def.body.padding.left = LV_DPI / 10;
def.body.padding.right = LV_DPI / 10;
def.body.padding.top = LV_DPI / 10;
def.body.padding.bottom = LV_DPI / 10;
def.body.padding.inner = LV_DPI / 10;
def.body.border.color = LV_COLOR_BLACK;
def.body.border.width = 1;
def.body.border.opa = LV_OPA_COVER;
def.body.border.part = LV_BORDER_FULL;
def.body.padding.inner = LV_DPI / 10;
def.body.border.color = LV_COLOR_BLACK;
def.body.border.width = 1;
def.body.border.opa = LV_OPA_COVER;
def.body.border.part = LV_BORDER_FULL;
def.text.font = _font;
def.text.color = LV_COLOR_BLACK;
def.text.font = _font;
def.text.color = LV_COLOR_BLACK;
def.text.letter_space = 1;
def.text.line_space = 1;
def.text.line_space = 1;
def.line.color = LV_COLOR_BLACK;
def.line.opa = LV_OPA_COVER;
def.line.opa = LV_OPA_COVER;
def.line.width = 1;
def.image.color = LV_COLOR_BLACK;
def.image.color = LV_COLOR_BLACK;
def.image.intense = LV_OPA_TRANSP;
def.image.opa = LV_OPA_COVER;
def.image.opa = LV_OPA_COVER;
lv_style_copy(&light_plain, &def);
@@ -83,26 +81,24 @@ static void basic_init(void)
light_frame.body.radius = LV_DPI / 20;
lv_style_copy(&dark_plain, &light_plain);
dark_plain.body.main_color = LV_COLOR_BLACK;
dark_plain.body.grad_color = LV_COLOR_BLACK;
dark_plain.body.main_color = LV_COLOR_BLACK;
dark_plain.body.grad_color = LV_COLOR_BLACK;
dark_plain.body.border.color = LV_COLOR_WHITE;
dark_plain.text.color = LV_COLOR_WHITE;
dark_plain.line.color = LV_COLOR_WHITE;
dark_plain.image.color = LV_COLOR_WHITE;
dark_plain.text.color = LV_COLOR_WHITE;
dark_plain.line.color = LV_COLOR_WHITE;
dark_plain.image.color = LV_COLOR_WHITE;
lv_style_copy(&dark_frame, &dark_plain);
dark_frame.body.radius = LV_DPI / 20;
theme.style.bg = &def;
theme.style.bg = &def;
theme.style.panel = &light_frame;
}
static void cont_init(void)
{
#if LV_USE_CONT != 0
theme.style.cont = &def;
#endif
}
@@ -111,23 +107,20 @@ static void btn_init(void)
{
#if LV_USE_BTN != 0
theme.style.btn.rel = &light_frame;
theme.style.btn.pr = &dark_frame;
theme.style.btn.rel = &light_frame;
theme.style.btn.pr = &dark_frame;
theme.style.btn.tgl_rel = &dark_frame;
theme.style.btn.tgl_pr = &light_frame;
theme.style.btn.ina = &light_frame;
theme.style.btn.tgl_pr = &light_frame;
theme.style.btn.ina = &light_frame;
#endif
}
static void label_init(void)
{
#if LV_USE_LABEL != 0
theme.style.label.prim = NULL;
theme.style.label.sec = NULL;
theme.style.label.sec = NULL;
theme.style.label.hint = NULL;
#endif
}
@@ -136,9 +129,8 @@ static void img_init(void)
{
#if LV_USE_IMG != 0
theme.style.img.light = &def;
theme.style.img.dark = &def;
theme.style.img.dark = &def;
#endif
}
@@ -154,10 +146,10 @@ static void led_init(void)
#if LV_USE_LED != 0
static lv_style_t led;
lv_style_copy(&led, &light_frame);
led.body.radius = LV_RADIUS_CIRCLE;
led.body.radius = LV_RADIUS_CIRCLE;
led.body.shadow.width = LV_DPI / 8;
led.body.shadow.color = LV_COLOR_BLACK;
led.body.shadow.type = LV_SHADOW_FULL;
led.body.shadow.type = LV_SHADOW_FULL;
theme.style.led = &led;
#endif
@@ -170,20 +162,20 @@ static void bar_init(void)
static lv_style_t bar_indic;
lv_style_copy(&bar_bg, &light_frame);
bar_bg.body.padding.left = LV_DPI / 15;
bar_bg.body.padding.right = LV_DPI / 15;
bar_bg.body.padding.top = LV_DPI / 15;
bar_bg.body.padding.left = LV_DPI / 15;
bar_bg.body.padding.right = LV_DPI / 15;
bar_bg.body.padding.top = LV_DPI / 15;
bar_bg.body.padding.bottom = LV_DPI / 15;
bar_bg.body.radius = LV_RADIUS_CIRCLE;
bar_bg.body.radius = LV_RADIUS_CIRCLE;
lv_style_copy(&bar_indic, &dark_frame);
bar_indic.body.padding.left = LV_DPI / 30;
bar_indic.body.padding.right = LV_DPI / 30;
bar_indic.body.padding.top = LV_DPI / 30;
bar_indic.body.padding.left = LV_DPI / 30;
bar_indic.body.padding.right = LV_DPI / 30;
bar_indic.body.padding.top = LV_DPI / 30;
bar_indic.body.padding.bottom = LV_DPI / 30;
bar_indic.body.radius = LV_RADIUS_CIRCLE;
bar_indic.body.radius = LV_RADIUS_CIRCLE;
theme.style.bar.bg = &bar_bg;
theme.style.bar.bg = &bar_bg;
theme.style.bar.indic = &bar_indic;
#endif
}
@@ -193,15 +185,15 @@ static void slider_init(void)
#if LV_USE_SLIDER != 0
static lv_style_t slider_knob;
lv_style_copy(&slider_knob, &light_frame);
slider_knob.body.radius = LV_RADIUS_CIRCLE;
slider_knob.body.padding.left = LV_DPI / 30;
slider_knob.body.padding.right = LV_DPI / 30;
slider_knob.body.padding.top = LV_DPI / 30;
slider_knob.body.radius = LV_RADIUS_CIRCLE;
slider_knob.body.padding.left = LV_DPI / 30;
slider_knob.body.padding.right = LV_DPI / 30;
slider_knob.body.padding.top = LV_DPI / 30;
slider_knob.body.padding.bottom = LV_DPI / 30;
theme.style.slider.bg = theme.style.bar.bg;
theme.style.slider.bg = theme.style.bar.bg;
theme.style.slider.indic = theme.style.bar.indic;
theme.style.slider.knob = &slider_knob;
theme.style.slider.knob = &slider_knob;
#endif
}
@@ -209,27 +201,25 @@ static void sw_init(void)
{
#if LV_USE_SW != 0
theme.style.sw.bg = theme.style.slider.bg;
theme.style.sw.indic = theme.style.slider.indic;
theme.style.sw.bg = theme.style.slider.bg;
theme.style.sw.indic = theme.style.slider.indic;
theme.style.sw.knob_off = theme.style.slider.knob;
theme.style.sw.knob_on = theme.style.slider.knob;
theme.style.sw.knob_on = theme.style.slider.knob;
#endif
}
static void lmeter_init(void)
{
#if LV_USE_LMETER != 0
static lv_style_t lmeter_bg;
lv_style_copy(&lmeter_bg, &light_frame);
lmeter_bg.body.opa = LV_OPA_TRANSP;
lmeter_bg.body.main_color = LV_COLOR_BLACK;
lmeter_bg.body.grad_color = LV_COLOR_BLACK;
lmeter_bg.body.padding.left = LV_DPI / 20;
lmeter_bg.body.opa = LV_OPA_TRANSP;
lmeter_bg.body.main_color = LV_COLOR_BLACK;
lmeter_bg.body.grad_color = LV_COLOR_BLACK;
lmeter_bg.body.padding.left = LV_DPI / 20;
lmeter_bg.body.padding.inner = LV_DPI / 8;
lmeter_bg.line.color = LV_COLOR_WHITE;
lmeter_bg.line.width = 1;
lmeter_bg.line.color = LV_COLOR_WHITE;
lmeter_bg.line.width = 1;
theme.style.lmeter = &lmeter_bg;
#endif
@@ -243,7 +233,6 @@ static void gauge_init(void)
gauge_bg.line.color = LV_COLOR_BLACK;
gauge_bg.line.width = 1;
theme.style.gauge = &gauge_bg;
#endif
}
@@ -260,11 +249,11 @@ static void calendar_init(void)
#if LV_USE_CALENDAR
static lv_style_t box;
lv_style_copy(&box, &light_plain);
box.body.padding.top = LV_DPI / 20;
box.body.padding.top = LV_DPI / 20;
box.body.padding.bottom = LV_DPI / 20;
/*Can't handle highlighted dates in this theme*/
theme.style.calendar.week_box = &box;
theme.style.calendar.week_box = &box;
theme.style.calendar.today_box = &box;
#endif
}
@@ -273,53 +262,48 @@ static void cb_init(void)
{
#if LV_USE_CB != 0
theme.style.cb.bg = &lv_style_transp;
theme.style.cb.box.rel = &light_frame;
theme.style.cb.box.pr = &dark_frame;
theme.style.cb.bg = &lv_style_transp;
theme.style.cb.box.rel = &light_frame;
theme.style.cb.box.pr = &dark_frame;
theme.style.cb.box.tgl_rel = &dark_frame;
theme.style.cb.box.tgl_pr = &light_frame;
theme.style.cb.box.ina = &light_frame;
theme.style.cb.box.tgl_pr = &light_frame;
theme.style.cb.box.ina = &light_frame;
#endif
}
static void btnm_init(void)
{
#if LV_USE_BTNM
theme.style.btnm.bg = &light_frame;
theme.style.btnm.btn.rel = &light_frame;
theme.style.btnm.btn.pr = &dark_frame;
theme.style.btnm.bg = &light_frame;
theme.style.btnm.btn.rel = &light_frame;
theme.style.btnm.btn.pr = &dark_frame;
theme.style.btnm.btn.tgl_rel = &dark_frame;
theme.style.btnm.btn.tgl_pr = &light_frame;
theme.style.btnm.btn.ina = &light_frame;
theme.style.btnm.btn.tgl_pr = &light_frame;
theme.style.btnm.btn.ina = &light_frame;
#endif
}
static void kb_init(void)
{
#if LV_USE_KB
theme.style.kb.bg = &lv_style_transp_fit;
theme.style.kb.btn.rel = &light_frame;
theme.style.kb.btn.pr = &light_frame;
theme.style.kb.bg = &lv_style_transp_fit;
theme.style.kb.btn.rel = &light_frame;
theme.style.kb.btn.pr = &light_frame;
theme.style.kb.btn.tgl_rel = &dark_frame;
theme.style.kb.btn.tgl_pr = &dark_frame;
theme.style.kb.btn.ina = &light_frame;
theme.style.kb.btn.tgl_pr = &dark_frame;
theme.style.kb.btn.ina = &light_frame;
#endif
}
static void mbox_init(void)
{
#if LV_USE_MBOX
theme.style.mbox.bg = &dark_frame;
theme.style.mbox.btn.bg = &lv_style_transp_fit;
theme.style.mbox.bg = &dark_frame;
theme.style.mbox.btn.bg = &lv_style_transp_fit;
theme.style.mbox.btn.rel = &light_frame;
theme.style.mbox.btn.pr = &dark_frame;
theme.style.mbox.btn.pr = &dark_frame;
#endif
}
@@ -327,10 +311,9 @@ static void page_init(void)
{
#if LV_USE_PAGE
theme.style.page.bg = &light_frame;
theme.style.page.bg = &light_frame;
theme.style.page.scrl = &light_frame;
theme.style.page.sb = &dark_frame;
theme.style.page.sb = &dark_frame;
#endif
}
@@ -338,11 +321,10 @@ static void ta_init(void)
{
#if LV_USE_TA
theme.style.ta.area = &light_frame;
theme.style.ta.area = &light_frame;
theme.style.ta.oneline = &light_frame;
theme.style.ta.cursor = NULL; /*Let library to calculate the cursor's style*/
theme.style.ta.sb = &dark_frame;
theme.style.ta.cursor = NULL; /*Let library to calculate the cursor's style*/
theme.style.ta.sb = &dark_frame;
#endif
}
@@ -350,15 +332,14 @@ static void list_init(void)
{
#if LV_USE_LIST != 0
theme.style.list.sb = &dark_frame;
theme.style.list.bg = &light_frame;
theme.style.list.scrl = &lv_style_transp_fit;
theme.style.list.btn.rel = &light_plain;
theme.style.list.btn.pr = &dark_plain;
theme.style.list.sb = &dark_frame;
theme.style.list.bg = &light_frame;
theme.style.list.scrl = &lv_style_transp_fit;
theme.style.list.btn.rel = &light_plain;
theme.style.list.btn.pr = &dark_plain;
theme.style.list.btn.tgl_rel = &dark_plain;
theme.style.list.btn.tgl_pr = &light_plain;
theme.style.list.btn.ina = &light_plain;
theme.style.list.btn.tgl_pr = &light_plain;
theme.style.list.btn.ina = &light_plain;
#endif
}
@@ -369,9 +350,9 @@ static void ddlist_init(void)
lv_style_copy(&bg, &light_frame);
bg.text.line_space = LV_DPI / 12;
theme.style.ddlist.bg = &bg;
theme.style.ddlist.bg = &bg;
theme.style.ddlist.sel = &dark_plain;
theme.style.ddlist.sb = &dark_frame;
theme.style.ddlist.sb = &dark_frame;
#endif
}
@@ -382,7 +363,7 @@ static void roller_init(void)
lv_style_copy(&bg, &light_frame);
bg.text.line_space = LV_DPI / 12;
theme.style.roller.bg = &bg;
theme.style.roller.bg = &bg;
theme.style.roller.sel = &dark_frame;
#endif
}
@@ -391,35 +372,33 @@ static void tabview_init(void)
{
#if LV_USE_TABVIEW != 0
theme.style.tabview.bg = &light_frame;
theme.style.tabview.indic = &light_plain;
theme.style.tabview.btn.bg = &lv_style_transp_fit;
theme.style.tabview.btn.rel = &light_frame;
theme.style.tabview.btn.pr = &dark_frame;
theme.style.tabview.bg = &light_frame;
theme.style.tabview.indic = &light_plain;
theme.style.tabview.btn.bg = &lv_style_transp_fit;
theme.style.tabview.btn.rel = &light_frame;
theme.style.tabview.btn.pr = &dark_frame;
theme.style.tabview.btn.tgl_rel = &dark_frame;
theme.style.tabview.btn.tgl_pr = &light_frame;
theme.style.tabview.btn.tgl_pr = &light_frame;
#endif
}
static void win_init(void)
{
#if LV_USE_WIN != 0
static lv_style_t win_header;
lv_style_copy(&win_header, &dark_plain);
win_header.body.padding.left = LV_DPI / 30;
win_header.body.padding.right = LV_DPI / 30;
win_header.body.padding.top = LV_DPI / 30;
win_header.body.padding.left = LV_DPI / 30;
win_header.body.padding.right = LV_DPI / 30;
win_header.body.padding.top = LV_DPI / 30;
win_header.body.padding.bottom = LV_DPI / 30;
theme.style.win.bg = &light_frame;
theme.style.win.sb = &dark_frame;
theme.style.win.header = &win_header;
theme.style.win.content.bg = &lv_style_transp;
theme.style.win.bg = &light_frame;
theme.style.win.sb = &dark_frame;
theme.style.win.header = &win_header;
theme.style.win.content.bg = &lv_style_transp;
theme.style.win.content.scrl = &lv_style_transp;
theme.style.win.btn.rel = &light_frame;
theme.style.win.btn.pr = &dark_frame;
theme.style.win.btn.rel = &light_frame;
theme.style.win.btn.pr = &dark_frame;
#endif
}
@@ -427,16 +406,17 @@ static void win_init(void)
static void style_mod(lv_group_t * group, lv_style_t * style)
{
(void) group; /*Unused*/
(void)group; /*Unused*/
#if LV_COLOR_DEPTH != 1
/*Make the style to be a little bit orange*/
style->body.border.opa = LV_OPA_COVER;
style->body.border.opa = LV_OPA_COVER;
style->body.border.color = LV_COLOR_BLACK;
/*If not empty or has border then emphasis the border*/
if (style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0)
style->body.border.width = LV_DPI / 20;
#else
style->body.border.opa = LV_OPA_COVER;
style->body.border.opa = LV_OPA_COVER;
style->body.border.color = LV_COLOR_BLACK;
style->body.border.width = 2;
#endif
@@ -444,16 +424,17 @@ static void style_mod(lv_group_t * group, lv_style_t * style)
static void style_mod_edit(lv_group_t * group, lv_style_t * style)
{
(void) group; /*Unused*/
(void)group; /*Unused*/
#if LV_COLOR_DEPTH != 1
/*Make the style to be a little bit orange*/
style->body.border.opa = LV_OPA_COVER;
style->body.border.opa = LV_OPA_COVER;
style->body.border.color = LV_COLOR_BLACK;
/*If not empty or has border then emphasis the border*/
if (style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0)
style->body.border.width = LV_DPI / 20;
#else
style->body.border.opa = LV_OPA_COVER;
style->body.border.opa = LV_OPA_COVER;
style->body.border.color = LV_COLOR_BLACK;
style->body.border.width = 3;
#endif
@@ -465,18 +446,17 @@ static void style_mod_edit(lv_group_t * group, lv_style_t * style)
* GLOBAL FUNCTIONS
**********************/
/**
* Initialize the mono theme
* @param hue [0..360] hue value from HSV color space to define the theme's base color; is not used in lv_theme_mono
* @param hue [0..360] hue value from HSV color space to define the theme's base color; is not used
* in lv_theme_mono
* @param font pointer to a font (NULL to use the default)
* @return pointer to the initialized theme
*/
lv_theme_t * lv_theme_mono_init(uint16_t hue, lv_font_t * font)
{
(void)hue; /*Unused*/
(void)hue; /*Unused*/
if(font == NULL) font = LV_FONT_DEFAULT;
@@ -484,7 +464,7 @@ lv_theme_t * lv_theme_mono_init(uint16_t hue, lv_font_t * font)
/*For backward compatibility initialize all theme elements with a default style */
uint16_t i;
lv_style_t ** style_p = (lv_style_t **) &theme.style;
lv_style_t ** style_p = (lv_style_t **)&theme.style;
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
*style_p = &def;
style_p++;
@@ -517,7 +497,7 @@ lv_theme_t * lv_theme_mono_init(uint16_t hue, lv_font_t * font)
win_init();
#if LV_USE_GROUP
theme.group.style_mod = style_mod;
theme.group.style_mod = style_mod;
theme.group.style_mod_edit = style_mod_edit;
#endif
@@ -538,4 +518,3 @@ lv_theme_t * lv_theme_get_mono(void)
**********************/
#endif