icons moved, app sysmon added, app fsel added
This commit is contained in:
@@ -138,11 +138,17 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void* param)
|
||||
|
||||
case LV_SIGNAL_PRESS_LOST:
|
||||
/*Refresh the state*/
|
||||
if(ext->state == LV_BTN_STATE_PR) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
} else if(ext->state == LV_BTN_STATE_TGL_PR) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
|
||||
}lv_obj_inv(btn);
|
||||
if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
else if(ext->state == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
|
||||
|
||||
lv_obj_inv(btn);
|
||||
break;
|
||||
case LV_SIGNAL_PRESSING:
|
||||
if(lv_dispi_is_dragging(param) != false) {
|
||||
if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
else if(ext->state == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
|
||||
}
|
||||
lv_obj_inv(btn);
|
||||
break;
|
||||
|
||||
case LV_SIGNAL_RELEASED:
|
||||
@@ -218,9 +224,10 @@ void lv_btn_set_tgl(lv_obj_t * btn, bool tgl)
|
||||
void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state)
|
||||
{
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext(btn);
|
||||
|
||||
ext->state = state;
|
||||
lv_obj_inv(btn);
|
||||
if(ext->state != state) {
|
||||
ext->state = state;
|
||||
lv_obj_inv(btn);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -467,7 +474,7 @@ static void lv_btns_init(void)
|
||||
lv_btns_def.rects.round = 4 * LV_DOWNSCALE;
|
||||
lv_btns_def.rects.hpad = 10 * LV_DOWNSCALE;
|
||||
lv_btns_def.rects.vpad = 15 * LV_DOWNSCALE;
|
||||
lv_btns_def.rects.opad = 5 * LV_DOWNSCALE;
|
||||
lv_btns_def.rects.opad = 10 * LV_DOWNSCALE;
|
||||
|
||||
/*Transparent style*/
|
||||
memcpy(&lv_btns_transp, &lv_btns_def, sizeof(lv_btns_t));
|
||||
@@ -501,7 +508,6 @@ static void lv_btns_init(void)
|
||||
lv_btns_border.rects.round = 4 * LV_DOWNSCALE;
|
||||
lv_btns_border.rects.hpad = 10 * LV_DOWNSCALE;
|
||||
lv_btns_border.rects.vpad = 10 * LV_DOWNSCALE;
|
||||
lv_btns_border.rects.vpad = 5 * LV_DOWNSCALE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,6 +40,7 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask);
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_charts_t lv_charts_def;
|
||||
static lv_charts_t lv_charts_transp;
|
||||
static lv_design_f_t ancestor_design_fp;
|
||||
|
||||
/**********************
|
||||
@@ -138,7 +139,7 @@ bool lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param)
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate and add a data line t the chart
|
||||
* Allocate and add a data line to the chart
|
||||
* @param chart pointer to a chart object
|
||||
* @return pointer to the allocated data lie (an array for the data points)
|
||||
*/
|
||||
@@ -289,6 +290,9 @@ lv_charts_t * lv_charts_get(lv_charts_builtin_t style, lv_charts_t * copy)
|
||||
case LV_CHARTS_DEF:
|
||||
style_p = &lv_charts_def;
|
||||
break;
|
||||
case LV_CHARTS_TRANSP:
|
||||
style_p = &lv_charts_transp;
|
||||
break;
|
||||
default:
|
||||
style_p = &lv_charts_def;
|
||||
}
|
||||
@@ -382,14 +386,16 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
lv_charts_t * style = lv_obj_get_style(chart);
|
||||
|
||||
if(style->div_lines.objs.transp != 0) return;
|
||||
|
||||
uint8_t div_i;
|
||||
point_t p1;
|
||||
point_t p2;
|
||||
cord_t w = lv_obj_get_width(chart);
|
||||
cord_t h = lv_obj_get_height(chart);
|
||||
opa_t div_opa = (uint16_t)lv_obj_get_opa(chart) * style->div_line_opa / 100;
|
||||
cord_t x_ofs = lv_obj_get_x(chart);
|
||||
cord_t y_ofs = lv_obj_get_y(chart);
|
||||
cord_t x_ofs = chart->cords.x1;
|
||||
cord_t y_ofs = chart->cords.y1;
|
||||
p1.x = 0 + x_ofs;
|
||||
p2.x = w + x_ofs;
|
||||
for(div_i = 1; div_i <= ext->hdiv_num; div_i ++) {
|
||||
@@ -424,8 +430,8 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
|
||||
cord_t w = lv_obj_get_width(chart);
|
||||
cord_t h = lv_obj_get_height(chart);
|
||||
opa_t opa = (uint16_t)lv_obj_get_opa(chart) * style_p->data_opa / 100;
|
||||
cord_t x_ofs = lv_obj_get_x(chart);
|
||||
cord_t y_ofs = lv_obj_get_y(chart);
|
||||
cord_t x_ofs = chart->cords.x1;
|
||||
cord_t y_ofs = chart->cords.y1;
|
||||
int32_t y_tmp;
|
||||
cord_t ** y_data;
|
||||
uint8_t dl_cnt = 0;
|
||||
@@ -447,7 +453,7 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
|
||||
p1.x = p2.x;
|
||||
p1.y = p2.y;
|
||||
|
||||
p2.x = (w / (ext->pnum - 1)) * i + x_ofs;
|
||||
p2.x = ((w * i) / (ext->pnum - 1)) + x_ofs;
|
||||
|
||||
y_tmp = (int32_t)((int32_t) (*y_data)[i] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
@@ -474,8 +480,8 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
|
||||
cord_t w = lv_obj_get_width(chart);
|
||||
cord_t h = lv_obj_get_height(chart);
|
||||
opa_t opa = (uint16_t)lv_obj_get_opa(chart) * style_p->data_opa / 100;
|
||||
cord_t x_ofs = lv_obj_get_x(chart);
|
||||
cord_t y_ofs = lv_obj_get_y(chart);
|
||||
cord_t x_ofs = chart->cords.x1;
|
||||
cord_t y_ofs = chart->cords.y1;
|
||||
int32_t y_tmp;
|
||||
cord_t ** y_data;
|
||||
uint8_t dl_cnt = 0;
|
||||
@@ -493,7 +499,7 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
|
||||
rects.gcolor = color_mix(COLOR_BLACK, style_p->color[dl_cnt], style_p->dark_eff);
|
||||
|
||||
for(i = 0; i < ext->pnum; i ++) {
|
||||
cir_a.x1 = (w / (ext->pnum - 1)) * i + x_ofs;
|
||||
cir_a.x1 = ((w * i) / (ext->pnum - 1)) + x_ofs;
|
||||
cir_a.x2 = cir_a.x1 + rad;
|
||||
cir_a.x1 -= rad;
|
||||
|
||||
@@ -530,8 +536,8 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
|
||||
cord_t ** y_data;
|
||||
uint8_t dl_cnt = 0;
|
||||
lv_rects_t rects;
|
||||
cord_t x_ofs = w / ((ext->dl_num + 1) * ext->pnum) / 2; /*Shift with a half col.*/
|
||||
|
||||
cord_t col_w = w / (2 * ext->dl_num * ext->pnum); /* Suppose (2 * dl_num) * pnum columns*/
|
||||
cord_t x_ofs = col_w / 2; /*Shift with a half col.*/
|
||||
lv_rects_get(LV_RECTS_DEF, &rects);
|
||||
rects.bwidth = 0;
|
||||
rects.empty = 0;
|
||||
@@ -545,12 +551,16 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
|
||||
rects.gcolor = color_mix(COLOR_BLACK, style_p->color[dl_cnt], style_p->dark_eff);
|
||||
|
||||
for(i = 0; i < ext->pnum; i ++) {
|
||||
/*Calculate the x coordinates. Suppose (dl_num + 1) * pnum columns */
|
||||
col_a.x1 = (int32_t)((int32_t)w * (i * (ext->dl_num + 1) + dl_cnt)) /
|
||||
(ext->pnum * (ext->dl_num + 1)) + chart->cords.x1;
|
||||
col_a.x2 = (int32_t)((int32_t)w * (i * (ext->dl_num + 1) + dl_cnt + 1 )) /
|
||||
(ext->pnum * (ext->dl_num + 1)) + chart->cords.x1 - 1;
|
||||
/* Calculate the x coordinates. Suppose (2 * dl_num) * pnum columns and draw to every second
|
||||
* the other columns will be spaces.
|
||||
* col_w = w / (2 * ext->dl_num * ext->pnum)
|
||||
* act_col_x = col_w * i * ext->dl_num * 2 + 2 * dl_cnt
|
||||
* Reorder the operation to multiply first*/
|
||||
|
||||
col_a.x1 = (int32_t)((int32_t) w * ((i * ext->dl_num * 2) + (2 * dl_cnt))) /
|
||||
(ext->pnum * 2 * ext->dl_num);
|
||||
col_a.x1 += chart->cords.x1;
|
||||
col_a.x2 = col_a.x1 + col_w;
|
||||
col_a.x1 += x_ofs;
|
||||
col_a.x2 += x_ofs;
|
||||
|
||||
@@ -587,17 +597,23 @@ static void lv_charts_init(void)
|
||||
lv_charts_def.div_line_opa = OPA_COVER;
|
||||
|
||||
/*Data lines*/
|
||||
lv_charts_def.width = 3 * LV_DOWNSCALE;
|
||||
lv_charts_def.width = 2 * LV_DOWNSCALE;
|
||||
lv_charts_def.data_opa = 100;
|
||||
lv_charts_def.dark_eff = 150;
|
||||
lv_charts_def.color[0] = COLOR_RED;
|
||||
lv_charts_def.color[1] = COLOR_LIME;
|
||||
lv_charts_def.color[1] = COLOR_GREEN;
|
||||
lv_charts_def.color[2] = COLOR_BLUE;
|
||||
lv_charts_def.color[3] = COLOR_MAGENTA;
|
||||
lv_charts_def.color[4] = COLOR_CYAN;
|
||||
lv_charts_def.color[5] = COLOR_YELLOW;
|
||||
lv_charts_def.color[6] = COLOR_WHITE;
|
||||
lv_charts_def.color[7] = COLOR_GRAY;
|
||||
|
||||
|
||||
memcpy(&lv_charts_transp, &lv_charts_def, sizeof(lv_charts_t));
|
||||
lv_charts_transp.bg_rects.empty = 1;
|
||||
lv_charts_transp.bg_rects.bwidth = 0;
|
||||
lv_charts_transp.div_lines.objs.transp = 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_CHARTBG != 0
|
||||
#if USE_LV_CHART != 0
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include "lv_rect.h"
|
||||
@@ -49,6 +49,7 @@ typedef struct
|
||||
typedef enum
|
||||
{
|
||||
LV_CHARTS_DEF,
|
||||
LV_CHARTS_TRANSP,
|
||||
}lv_charts_builtin_t;
|
||||
|
||||
/*Data of chart background*/
|
||||
|
||||
@@ -249,6 +249,17 @@ lv_list_fit_t lv_list_get_fit(lv_obj_t * list)
|
||||
return LV_EA(list, lv_list_ext_t)->fit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the text of a list element
|
||||
* @param liste pointer to list element
|
||||
* @return pointer to the text
|
||||
*/
|
||||
const char * lv_list_element_get_txt(lv_obj_t * liste)
|
||||
{
|
||||
/*The last child is the label*/
|
||||
lv_obj_t * label = lv_obj_get_child(liste, NULL);
|
||||
return lv_label_get_text(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
|
||||
@@ -72,6 +72,7 @@ void lv_list_down(lv_obj_t * list);
|
||||
void lv_list_up(lv_obj_t * list);
|
||||
void lv_list_set_fit(lv_obj_t * list, lv_list_fit_t fit);
|
||||
lv_list_fit_t lv_list_get_fit(lv_obj_t * list);
|
||||
const char * lv_list_element_get_txt(lv_obj_t * liste);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -71,6 +71,9 @@ lv_obj_t * lv_pb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ancestor_design_fp = lv_obj_get_design_f(new_pb);
|
||||
}
|
||||
|
||||
lv_obj_set_signal_f(new_pb, lv_pb_signal);
|
||||
lv_obj_set_design_f(new_pb, lv_pb_design);
|
||||
|
||||
/*Init the new progress bar object*/
|
||||
if(copy == NULL) {
|
||||
ext->format_str = dm_alloc(strlen(LV_PB_DEF_FORMAT) + 1);
|
||||
@@ -79,12 +82,10 @@ lv_obj_t * lv_pb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->max_value = 100;
|
||||
ext->act_value = 0;
|
||||
|
||||
lv_label_create(new_pb, NULL);
|
||||
ext->label = lv_label_create(new_pb, NULL);
|
||||
|
||||
lv_rect_set_layout(new_pb, LV_RECT_LAYOUT_CENTER);
|
||||
lv_obj_set_signal_f(new_pb, lv_pb_signal);
|
||||
lv_obj_set_style(new_pb, lv_pbs_get(LV_PBS_DEF, NULL));
|
||||
lv_obj_set_design_f(new_pb, lv_pb_design);
|
||||
|
||||
lv_pb_set_value(new_pb, ext->act_value);
|
||||
} else {
|
||||
@@ -95,6 +96,12 @@ lv_obj_t * lv_pb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->max_value = ext_copy->max_value;
|
||||
ext->act_value = ext_copy->act_value;
|
||||
|
||||
ext->label = lv_label_create(new_pb, ext_copy->label);
|
||||
|
||||
lv_obj_set_style(new_pb, lv_obj_get_style(copy));
|
||||
|
||||
lv_pb_set_value(new_pb, ext->act_value);
|
||||
|
||||
}
|
||||
return new_pb;
|
||||
}
|
||||
@@ -116,6 +123,7 @@ bool lv_pb_signal(lv_obj_t * pb, lv_signal_t sign, void * param)
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
lv_pb_ext_t * ext = lv_obj_get_ext(pb);
|
||||
lv_pbs_t * style = lv_obj_get_style(pb);
|
||||
|
||||
switch(sign) {
|
||||
case LV_SIGNAL_CORD_CHG:
|
||||
@@ -124,6 +132,10 @@ bool lv_pb_signal(lv_obj_t * pb, lv_signal_t sign, void * param)
|
||||
case LV_SIGNAL_CLEANUP:
|
||||
dm_free(ext->format_str);
|
||||
break;
|
||||
case LV_SIGNAL_STYLE_CHG:
|
||||
lv_obj_set_style(ext->label, &style->label);
|
||||
lv_pb_set_value(pb, lv_pb_get_value(pb));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -148,7 +160,7 @@ void lv_pb_set_value(lv_obj_t * pb, uint16_t value)
|
||||
|
||||
char buf[LV_PB_TXT_MAX_LENGTH];
|
||||
sprintf(buf, ext->format_str, ext->act_value);
|
||||
lv_label_set_text(lv_obj_get_child(pb, NULL), buf);
|
||||
lv_label_set_text(ext->label, buf);
|
||||
|
||||
lv_obj_inv(pb);
|
||||
}
|
||||
@@ -263,10 +275,19 @@ static bool lv_pb_design(lv_obj_t * pb, const area_t * mask, lv_design_mode_t mo
|
||||
area_t bar_area;
|
||||
uint32_t tmp;
|
||||
area_cpy(&bar_area, &pb->cords);
|
||||
tmp = (uint32_t)ext->act_value * lv_obj_get_width(pb);
|
||||
tmp = (uint32_t) tmp / (ext->max_value - ext->min_value);
|
||||
bar_area.x2 = bar_area.x1 + (cord_t) tmp;
|
||||
|
||||
cord_t w = lv_obj_get_width(pb);
|
||||
cord_t h = lv_obj_get_height(pb);
|
||||
|
||||
if(w >= h) {
|
||||
tmp = (uint32_t)ext->act_value * w;
|
||||
tmp = (uint32_t) tmp / (ext->max_value - ext->min_value);
|
||||
bar_area.x2 = bar_area.x1 + (cord_t) tmp;
|
||||
} else {
|
||||
tmp = (uint32_t)ext->act_value * h;
|
||||
tmp = (uint32_t) tmp / (ext->max_value - ext->min_value);
|
||||
bar_area.y1 = bar_area.y2 - (cord_t) tmp;
|
||||
}
|
||||
lv_pbs_t * style_p = lv_obj_get_style(pb);
|
||||
lv_draw_rect(&bar_area, mask, &style_p->bar, OPA_COVER);
|
||||
}
|
||||
@@ -291,6 +312,7 @@ static void lv_pbs_init(void)
|
||||
|
||||
lv_labels_get(LV_LABELS_DEF, &lv_pbs_def.label);
|
||||
lv_pbs_def.label.objs.color = COLOR_MAKE(0x20, 0x20, 0x20);
|
||||
lv_pbs_def.label.line_space = 0;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -43,6 +43,7 @@ typedef struct
|
||||
{
|
||||
lv_rect_ext_t rect_ext; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_obj_t * label;
|
||||
uint16_t act_value;
|
||||
uint16_t min_value;
|
||||
uint16_t max_value;
|
||||
|
||||
Reference in New Issue
Block a user