BigW Consortium Gitlab

Commit 9edaf13c by Gabor

minor updates during tests

parent 24128ae3
......@@ -19,6 +19,7 @@
#include "../lv_appx/lv_app_example.h"
#include "../lv_appx/lv_app_phantom.h"
#include "../lv_appx/lv_app_sysmon.h"
#include "../lv_appx/lv_app_terminal.h"
#include "../lv_appx/lv_app_files.h"
......@@ -77,7 +78,6 @@ static lv_obj_t * app_scr; /*Screen of the applications*/
#if LV_APP_DESKTOP != 0
static lv_obj_t * menuh; /*Holder of timg_bubbleshe menu on the top*/
static lv_obj_t * app_btn; /*The "Apps" button on the menu*/
//static lv_obj_t * sys_apph; /*Holder of the system app. buttons*/
static lv_obj_t * sc_page; /*A page for the shortcuts */
#endif
......@@ -124,6 +124,12 @@ void lv_app_init(void)
*dsc = lv_app_example_init();
#endif
#if USE_LV_APP_PHANTOM != 0
dsc = ll_ins_head(&app_dsc_ll);
*dsc = lv_app_phantom_init();
#endif
#if USE_LV_APP_SYSMON != 0
dsc = ll_ins_head(&app_dsc_ll);
*dsc = lv_app_sysmon_init();
......@@ -185,7 +191,7 @@ void lv_app_close(lv_app_inst_t * app)
lv_app_con_del(app, NULL);
lv_app_con_del(NULL, app);
app->dsc->app_close(app);
if(app->dsc->app_close != NULL) app->dsc->app_close(app);
memset(app->app_data, 0, app->dsc->app_data_size);
dm_free(app->app_data);
......@@ -203,6 +209,8 @@ void lv_app_close(lv_app_inst_t * app)
lv_obj_t * lv_app_sc_open(lv_app_inst_t * app)
{
if(app->dsc->sc_open == NULL) return NULL;
/*Create a basic shortcut*/
#if LV_APP_DESKTOP != 0
app->sc = lv_btn_create(sc_page, NULL);
......@@ -254,6 +262,7 @@ lv_obj_t * lv_app_sc_open(lv_app_inst_t * app)
void lv_app_sc_close(lv_app_inst_t * app)
{
if(app->sc == NULL) return;
if(app->dsc->sc_close != NULL) app->dsc->sc_close(app);
lv_obj_del(app->sc);
app->sc = NULL;
app->sc_title = NULL;
......@@ -275,22 +284,24 @@ lv_obj_t * lv_app_win_open(lv_app_inst_t * app)
app_list = NULL;
}
if(app->dsc->win_open == NULL) return NULL;
app->win = lv_win_create(lv_scr_act(), NULL);
lv_obj_set_free_p(app->win, app);
lv_obj_set_style(lv_win_get_header(app->win), &app_style.win_header);
lv_win_set_title(app->win, app->dsc->name);
lv_win_set_style_cbtn(app->win, &app_style.win_cbtn_rel, &app_style.win_cbtn_pr);
lv_page_set_sb_mode(lv_win_get_page(app->win), LV_PAGE_SB_MODE_ON);
lv_win_set_styles_cbtn(app->win, &app_style.win_cbtn_rel, &app_style.win_cbtn_pr);
if(app->dsc->conf_open != NULL) {
lv_win_add_ctrl_btn(app->win, SYMBOL_SETUP, lv_app_win_conf_action);
lv_win_add_cbtn(app->win, SYMBOL_SETUP, lv_app_win_conf_action);
}
lv_win_add_ctrl_btn(app->win, SYMBOL_DOWN, lv_app_win_minim_action);
lv_win_add_ctrl_btn(app->win, SYMBOL_CLOSE,lv_app_win_close_action);
lv_win_add_cbtn(app->win, SYMBOL_DOWN, lv_app_win_minim_action);
lv_win_add_cbtn(app->win, SYMBOL_CLOSE,lv_app_win_close_action);
app->win_data = dm_alloc(app->dsc->win_data_size);
app->dsc->win_open(app, app->win);
app->dsc->win_open(app, app->win);
return app->win;
}
......@@ -303,7 +314,9 @@ void lv_app_win_close(lv_app_inst_t * app)
{
if(app->win == NULL) return;
lv_app_kb_close(false);
lv_app_kb_close(false);
if(app->dsc->win_close != NULL) app->dsc->win_close(app);
lv_obj_del(app->win);
app->win = NULL;
......@@ -516,16 +529,6 @@ static void lv_app_init_desktop(void)
lv_label_set_text(app_label, "Apps");
lv_obj_set_pos(app_btn, 0, 0);
lv_obj_set_pos(menuh, 0, 0);
/*
sys_apph = lv_cont_create(menuh, NULL);
lv_cont_set_layout(sys_apph, LV_CONT_LAYOUT_ROW_M);
lv_cont_set_fit(sys_apph, true, false);
lv_obj_set_style(sys_apph, lv_rects_get(LV_RECTS_TRANSP, NULL));
lv_obj_t * clock = lv_label_create(sys_apph, NULL);
lv_obj_set_style(clock, &app_style.menu_btn_label);
lv_label_set_text(clock, "20:17");
lv_obj_align(sys_apph, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0);*/
/*Shortcut area*/
sc_page = lv_page_create(lv_scr_act(), NULL);
......@@ -736,7 +739,7 @@ static lv_action_res_t lv_app_sc_lpr_action(lv_obj_t * sc, lv_dispi_t * dispi)
*/
static lv_action_res_t lv_app_win_close_action(lv_obj_t * close_btn, lv_dispi_t * dispi)
{
lv_obj_t * win = lv_win_get_from_ctrl_btn(close_btn);
lv_obj_t * win = lv_win_get_from_cbtn(close_btn);
lv_app_inst_t * app = lv_obj_get_free_p(win);
lv_app_kb_close(false);
......@@ -771,7 +774,7 @@ static lv_action_res_t lv_app_win_close_action(lv_obj_t * close_btn, lv_dispi_t
*/
static lv_action_res_t lv_app_win_minim_action(lv_obj_t * minim_btn, lv_dispi_t * dispi)
{
lv_obj_t * win = lv_win_get_from_ctrl_btn(minim_btn);
lv_obj_t * win = lv_win_get_from_cbtn(minim_btn);
lv_app_inst_t * app = lv_obj_get_free_p(win);
lv_app_kb_close(false);
......@@ -797,7 +800,7 @@ static lv_action_res_t lv_app_win_conf_action(lv_obj_t * set_btn, lv_dispi_t * d
app_list = NULL;
}
lv_obj_t * win = lv_win_get_from_ctrl_btn(set_btn);
lv_obj_t * win = lv_win_get_from_cbtn(set_btn);
lv_app_inst_t * app = lv_obj_get_free_p(win);
app->conf_win = lv_win_create(lv_scr_act(), NULL);
......@@ -805,9 +808,9 @@ static lv_action_res_t lv_app_win_conf_action(lv_obj_t * set_btn, lv_dispi_t * d
char buf[256];
sprintf(buf, "%s settings", app->dsc->name);
lv_win_add_ctrl_btn(app->conf_win, SYMBOL_CLOSE ,lv_win_close_action);
lv_win_add_cbtn(app->conf_win, SYMBOL_CLOSE ,lv_win_close_action);
lv_win_set_title(app->conf_win, buf);
lv_win_set_style_cbtn(app->conf_win, &app_style.win_cbtn_rel, &app_style.win_cbtn_pr);
lv_win_set_styles_cbtn(app->conf_win, &app_style.win_cbtn_rel, &app_style.win_cbtn_pr);
lv_obj_t * scrl = lv_page_get_scrl(lv_win_get_page(app->conf_win));
lv_cont_set_layout(scrl, LV_CONT_LAYOUT_COL_L);
......@@ -840,8 +843,6 @@ static lv_action_res_t lv_app_win_open_anim_create(lv_app_inst_t * app)
lv_obj_get_cords(app->sc, &cords);
}
/*Temporally set a simpler style for the window during the animation*/
lv_obj_t * win_page = lv_win_get_page(app->win);
lv_page_set_sb_mode(win_page, LV_PAGE_SB_MODE_OFF);
......@@ -921,12 +922,6 @@ static lv_action_res_t lv_app_win_minim_anim_create(lv_app_inst_t * app)
lv_obj_set_hidden(((lv_win_ext_t *)app->win->ext)->btnh, true);
lv_obj_set_hidden(((lv_win_ext_t *)app->win->ext)->title, true);
lv_obj_set_hidden(lv_page_get_scrl(win_page), true);
/*Hide some elements to speed up the animation*/
lv_obj_set_hidden(((lv_win_ext_t *)app->win->ext)->btnh, true);
lv_obj_set_hidden(((lv_win_ext_t *)app->win->ext)->title, true);
lv_obj_set_hidden(lv_page_get_scrl(win_page), true);
anim_t a;
a.act_time = 0;
......@@ -981,6 +976,8 @@ static void lv_app_win_open_anim_cb(lv_obj_t * app_win)
lv_obj_set_hidden(((lv_win_ext_t *)app_win->ext)->btnh, false);
lv_obj_set_hidden(((lv_win_ext_t *)app_win->ext)->title, false);
lv_obj_set_hidden(lv_page_get_scrl(win_page), false);
lv_page_set_sb_mode(win_page, LV_PAGE_SB_MODE_AUTO);
}
/**
......
......@@ -47,6 +47,7 @@ static lv_obj_t * fsel_win;
static lv_obj_t * fsel_list;
static void * fsel_param;
static void (*fsel_ok_action)(void *, const char *);
static lv_style_t style_btn_symbol;
/**********************
* MACROS
......@@ -61,7 +62,8 @@ static void (*fsel_ok_action)(void *, const char *);
*/
void lv_app_fsel_init(void)
{
//TODO lv_lists_get(LV_LISTS_TRANSP, &fsel_lists);
lv_style_get(LV_STYLE_BTN_REL, &style_btn_symbol);
style_btn_symbol.font = font_get(LV_IMG_DEF_SYMBOL_FONT);
}
/**
......@@ -90,11 +92,14 @@ void lv_app_fsel_open(const char * path, const char * filter, void * param, void
/*Check filter: NULL and "" mean no filtering*/
if(fsel_filter == NULL) fsel_filter = "";
lv_app_style_t * app_style = lv_app_style_get();
/*Create a window for the File selector*/
fsel_win = lv_win_create(lv_scr_act(), NULL);
lv_obj_set_size(fsel_win, LV_HOR_RES, LV_VER_RES);
lv_win_set_styles_cbtn(fsel_win, &app_style->win_cbtn_rel, &app_style->win_cbtn_pr);
lv_win_add_ctrl_btn(fsel_win, "U:/icon_close", fsel_close_action);
lv_win_add_cbtn(fsel_win, SYMBOL_CLOSE, fsel_close_action);
fsel_refr(); /*Refresh the list*/
......@@ -138,31 +143,32 @@ static void fsel_refr(void)
/*Create a new list*/
fsel_list = lv_list_create(fsel_win, NULL);
lv_obj_set_width(fsel_list, lv_win_get_width(fsel_win));
//TODO lv_obj_set_style(fsel_list, lv_lists_get(LV_LISTS_TRANSP, NULL));
lv_list_set_style_img(fsel_list, &style_btn_symbol);
lv_obj_set_style(lv_page_get_scrl(fsel_list), lv_style_get(LV_STYLE_TRANSP_TIGHT, NULL));
lv_obj_set_drag_parent(fsel_list, true);
lv_obj_set_drag_parent(lv_page_get_scrl(fsel_list), true);
lv_cont_set_fit(fsel_list, false, true);
fs_res_t res = FS_RES_OK;
lv_obj_t * liste;
/*At empty path show the drivers */
if(fsel_path[0] == '\0') {
char drv[16];
char buf[2];
lv_obj_t * liste;
fs_get_letters(drv);
uint8_t i;
for(i = 0; drv[i] != '\0'; i++) {
buf[0] = drv[i];
buf[1] = '\0';
liste = lv_list_add(fsel_list, "U:/icon_driver", buf, fsel_drv_action);
liste = lv_list_add(fsel_list, SYMBOL_DRIVE, buf, fsel_drv_action);
/*Add long press action to choose the driver as a folder*/
if(fsel_filter[0] == '/') lv_btn_set_lpr_action(liste, fsel_drv_lpr_action);
}
}
/*List the files/folders with fs interface*/
else {
lv_list_add(fsel_list, "U:/icon_up", "Up", fsel_up_action);
liste = lv_list_add(fsel_list, SYMBOL_UP, "Up", fsel_up_action);
fs_readdir_t rd;
res = fs_readdir_init(&rd, fsel_path);
......@@ -173,7 +179,7 @@ static void fsel_refr(void)
/*At not first page add prev. page button */
if(fsel_file_cnt != 0) {
lv_list_add(fsel_list, "U:/icon_left", "Previous page", fsel_prev_action);
liste = lv_list_add(fsel_list, SYMBOL_LEFT, "Previous page", fsel_prev_action);
}
char fn[LV_APP_FSEL_FN_MAX_LEN];
......@@ -182,7 +188,7 @@ static void fsel_refr(void)
uint16_t file_cnt = 0;
while(file_cnt <= fsel_file_cnt) {
res = fs_readdir(&rd, fn);
if(res != FS_RES_OK || fn[0] == '\0'){
if(res != FS_RES_OK){
lv_app_notice_add("Can not read the path\nin File selector");
return;
}
......@@ -193,7 +199,7 @@ static void fsel_refr(void)
while(res == FS_RES_OK && fn[0] != '\0') {
if(fn[0] == '/') { /*Add a folder*/
lv_obj_t * liste;
liste = lv_list_add(fsel_list, "U:/icon_folder", &fn[1], fsel_folder_action);
liste = lv_list_add(fsel_list, SYMBOL_FOLDER, &fn[1], fsel_folder_action);
/*Add long press action to choose a folder*/
if(fsel_filter[0] == '/') lv_btn_set_lpr_action(liste, fsel_folder_lpr_action);
......@@ -204,7 +210,7 @@ static void fsel_refr(void)
else if(fsel_filter[0] == '\0' || /*No filtering or ...*/
(strcmp(fs_get_ext(fn), fsel_filter) == 0 && /*.. the filter matches*/
fsel_filter[0] != '/')) {
lv_list_add(fsel_list, "U:/icon_file", fn, fsel_file_action);
liste = lv_list_add(fsel_list, SYMBOL_FILE, fn, fsel_file_action);
fsel_file_cnt ++;
file_cnt ++;
}
......@@ -214,7 +220,7 @@ static void fsel_refr(void)
/*Show only LV_APP_FSEL_MAX_FILE elements and add a Next page button*/
if(fsel_file_cnt != 0 && fsel_file_cnt % LV_APP_FSEL_PAGE_SIZE == 0) {
lv_list_add(fsel_list, "U:/icon_right", "Next page", fsel_next_action);
liste = lv_list_add(fsel_list, SYMBOL_RIGHT, "Next page", fsel_next_action);
break;
}
}
......@@ -297,7 +303,7 @@ static lv_action_res_t fsel_prev_action(lv_obj_t * prev, lv_dispi_t * dispi)
*/
static lv_action_res_t fsel_drv_action(lv_obj_t * drv, lv_dispi_t * dispi)
{
sprintf(fsel_path, "%s:", lv_list_element_get_txt(drv));
sprintf(fsel_path, "%s:", lv_list_get_element_text(drv));
fsel_file_cnt = 0;
fsel_refr();
return LV_ACTION_RES_INV;
......@@ -311,7 +317,7 @@ static lv_action_res_t fsel_drv_action(lv_obj_t * drv, lv_dispi_t * dispi)
*/
static lv_action_res_t fsel_drv_lpr_action(lv_obj_t * drv, lv_dispi_t * dispi)
{
sprintf(fsel_path, "%s:", lv_list_element_get_txt(drv));
sprintf(fsel_path, "%s:", lv_list_get_element_text(drv));
if(fsel_ok_action != NULL) {
fsel_ok_action(fsel_param, fsel_path);
......@@ -330,7 +336,7 @@ static lv_action_res_t fsel_drv_lpr_action(lv_obj_t * drv, lv_dispi_t * dispi)
*/
static lv_action_res_t fsel_folder_action(lv_obj_t * folder, lv_dispi_t * dispi)
{
sprintf(fsel_path, "%s/%s", fsel_path, lv_list_element_get_txt(folder));
sprintf(fsel_path, "%s/%s", fsel_path, lv_list_get_element_text(folder));
fsel_file_cnt = 0;
fsel_refr();
return LV_ACTION_RES_INV;
......@@ -344,7 +350,7 @@ static lv_action_res_t fsel_folder_action(lv_obj_t * folder, lv_dispi_t * dispi)
*/
static lv_action_res_t fsel_folder_lpr_action(lv_obj_t * folder, lv_dispi_t * dispi)
{
sprintf(fsel_path, "%s/%s", fsel_path, lv_list_element_get_txt(folder));
sprintf(fsel_path, "%s/%s", fsel_path, lv_list_get_element_text(folder));
if(fsel_ok_action != NULL) {
fsel_ok_action(fsel_param, fsel_path);
......@@ -363,7 +369,7 @@ static lv_action_res_t fsel_folder_lpr_action(lv_obj_t * folder, lv_dispi_t * di
*/
static lv_action_res_t fsel_file_action(lv_obj_t * file, lv_dispi_t * dispi)
{
sprintf(fsel_path, "%s/%s", fsel_path, lv_list_element_get_txt(file));
sprintf(fsel_path, "%s/%s", fsel_path, lv_list_get_element_text(file));
if(fsel_ok_action != NULL) {
fsel_ok_action(fsel_param, fsel_path);
......
......@@ -35,7 +35,7 @@ void lv_app_fsel_init(void);
* @param filter show only files with a specific extension, e.g. "wav".
* "/" means filter to folders.
* @param param a free parameter which will be added to 'ok_action'
* @param ok_action an action to call when a file or folder is chosen
* @param ok_action an action to call when a file or folder is chosen (give 'param' and the path as parameters)
*/
void lv_app_fsel_open(const char * path, const char * filter, void * param,
void (*ok_action)(void *, const char *));
......
......@@ -63,6 +63,7 @@ static cord_t kb_ta_ori_size;
static uint8_t kb_mode;
static void (*kb_close_action)(lv_obj_t *);
static void (*kb_ok_action)(lv_obj_t *);
static lv_style_t style_bg;
static lv_style_t style_btn_rel;
static lv_style_t style_btn_pr;
/**********************
......@@ -78,8 +79,16 @@ static lv_style_t style_btn_pr;
*/
void lv_app_kb_init(void)
{
lv_style_get(LV_STYLE_PLAIN, &style_bg);
style_bg.hpad = 0;
style_bg.vpad = 0;
style_bg.opad = 0;
lv_style_get(LV_STYLE_BTN_REL, &style_btn_rel);
style_btn_rel.radius = 0;
style_btn_rel.bwidth = 1 * LV_DOWNSCALE;
lv_style_get(LV_STYLE_BTN_PR, &style_btn_pr);
style_btn_pr.radius = 0;
style_btn_pr.bwidth = 1 * LV_DOWNSCALE;
}
/**
......@@ -104,6 +113,7 @@ void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t
/*Create a button matrix for the keyboard */
kb_btnm = lv_btnm_create(lv_scr_act(), NULL);
lv_obj_set_style(kb_btnm, &style_bg);
lv_obj_set_size(kb_btnm, LV_HOR_RES, LV_VER_RES / 2);
lv_obj_align(kb_btnm, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
lv_btnm_set_action(kb_btnm, lv_app_kb_action);
......@@ -119,25 +129,29 @@ void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t
}
lv_btnm_set_styles_btn(kb_btnm, &style_btn_rel, &style_btn_pr);
/*Reduce the size of the window and align it to the top*/
kb_win = lv_app_win_get_from_obj(kb_ta);
lv_obj_set_height(kb_win, LV_VER_RES / 2);
lv_obj_set_y(kb_win, 0);
/*If the text area is higher then the new size of the window reduce its size too*/
cord_t win_h = lv_obj_get_height(kb_win);
kb_ta_ori_size = lv_obj_get_height(kb_ta);
if(lv_obj_get_height(kb_ta) > win_h) {
lv_obj_set_height(kb_ta, win_h);
kb_win = NULL;
kb_ta_ori_size = 0;
if(mode & LV_APP_KB_MODE_WIN_RESIZE) {
/*Reduce the size of the window and align it to the top*/
kb_win = lv_app_win_get_from_obj(kb_ta);
lv_obj_set_height(kb_win, LV_VER_RES / 2);
lv_obj_set_y(kb_win, 0);
/*If the text area is higher then the new size of the window reduce its size too*/
cord_t cont_h = lv_obj_get_height(kb_win) - lv_obj_get_height(lv_win_get_header(kb_win));
kb_ta_ori_size = lv_obj_get_height(kb_ta);
if(lv_obj_get_height(kb_ta) > cont_h - LV_DPI / 10) {
lv_obj_set_height(kb_ta, cont_h - LV_DPI / 10);
}
#if LV_APP_ANIM_LEVEL != 0
lv_page_focus(lv_win_get_content(kb_win), kb_ta, true);
#else
lv_page_focus(lv_win_get_page(kb_win), kb_ta, false);
#endif
}
lv_ta_set_cursor_pos(kb_ta, LV_TA_CUR_LAST);
#if LV_APP_ANIM_LEVEL != 0
lv_page_focus(lv_win_get_content(kb_win), kb_ta, true);
#else
lv_page_focus(lv_win_get_page(kb_win), kb_ta, false);
#endif
}
/**
......@@ -155,11 +169,11 @@ void lv_app_kb_close(bool ok)
}
/*Reset the modified sizes*/
lv_obj_set_height(kb_ta, kb_ta_ori_size);
lv_obj_set_size(kb_win, LV_HOR_RES, LV_VER_RES);
kb_win = NULL;
if((kb_mode & LV_APP_KB_MODE_WIN_RESIZE) && kb_win != NULL) {
lv_obj_set_height(kb_ta, kb_ta_ori_size);
lv_obj_set_size(kb_win, LV_HOR_RES, LV_VER_RES);
kb_win = NULL;
}
lv_obj_del(kb_btnm);
kb_btnm = NULL;
......@@ -229,11 +243,13 @@ static lv_action_res_t lv_app_kb_action(lv_obj_t * btnm, uint16_t i)
lv_ta_add_text(kb_ta, txt);
}
if(kb_mode & LV_APP_KB_MODE_WIN_RESIZE) {
#if LV_APP_ANIM_LEVEL != 0
lv_page_focus(lv_win_get_content(kb_win), kb_ta, true);
lv_page_focus(lv_win_get_content(kb_win), kb_ta, true);
#else
lv_page_focus(lv_win_get_page(kb_win), kb_ta, false);
lv_page_focus(lv_win_get_page(kb_win), kb_ta, false);
#endif
}
return LV_ACTION_RES_OK;
}
......
......@@ -23,6 +23,7 @@ typedef enum
{
LV_APP_KB_MODE_TXT = 0x01,
LV_APP_KB_MODE_NUM = 0x02,
LV_APP_KB_MODE_WIN_RESIZE = 0x04,
}lv_app_kb_mode_t;
/**********************
......
......@@ -198,7 +198,7 @@ static void my_win_close(lv_app_inst_t * app)
static lv_action_res_t ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi)
{
lv_ta_set_text(ta, ""); /*Clear the ta*/
lv_app_kb_open(ta, LV_APP_KB_MODE_TXT, NULL, kb_ok_action);
lv_app_kb_open(ta, LV_APP_KB_MODE_TXT | LV_APP_KB_MODE_WIN_RESIZE, NULL, kb_ok_action);
return LV_ACTION_RES_OK;
}
......
......@@ -113,6 +113,7 @@ static lv_app_dsc_t my_app_dsc =
};
static lv_style_t style_sc_label;
static lv_style_t style_btn_symbol;
/**********************
......@@ -133,6 +134,8 @@ const lv_app_dsc_t * lv_app_files_init(void)
memcpy(&style_sc_label, &app_style->sc_rec_rel, sizeof(lv_style_t));
style_sc_label.font = font_get(LV_APP_FONT_LARGE);
lv_style_get(LV_STYLE_BTN_REL, &style_btn_symbol);
style_btn_symbol.font = font_get(LV_IMG_DEF_SYMBOL_FONT);
return &my_app_dsc;
}
......@@ -350,7 +353,8 @@ static void win_create_list(lv_app_inst_t * app)
/*Create a new list*/
win_data->file_list = lv_list_create(app->win, NULL);
lv_obj_set_width(win_data->file_list, lv_win_get_width(app->win));
//TODO lv_obj_set_style(win_data->file_list, lv_lists_get(LV_LISTS_TRANSP, NULL));
lv_list_set_style_img(win_data->file_list, &style_btn_symbol);
lv_obj_set_style(lv_page_get_scrl(win_data->file_list), lv_style_get(LV_STYLE_TRANSP_TIGHT, NULL));
lv_obj_set_drag_parent(win_data->file_list, true);
lv_obj_set_drag_parent(lv_page_get_scrl(win_data->file_list), true);
lv_cont_set_fit(win_data->file_list, false, true);
......@@ -381,13 +385,13 @@ static void win_load_file_list(lv_app_inst_t * app)
for(i = 0; drv[i] != '\0'; i++) {
buf[0] = drv[i];
buf[1] = '\0';
liste = lv_list_add(win_data->file_list, "U:/icon_driver", buf, win_drv_action);
liste = lv_list_add(win_data->file_list, SYMBOL_DRIVE, buf, win_drv_action);
lv_obj_set_free_p(liste, app);
}
}
/*List the files/folders with fs interface*/
else {
liste = lv_list_add(win_data->file_list, "U:/icon_up", "Up", win_up_action);
liste = lv_list_add(win_data->file_list, SYMBOL_UP, "Up", win_up_action);
lv_obj_set_free_p(liste, app);
fs_readdir_t rd;
......@@ -399,7 +403,7 @@ static void win_load_file_list(lv_app_inst_t * app)
/*At not first page add prev. page button */
if(app_data->file_cnt != 0) {
liste = lv_list_add(win_data->file_list, "U:/icon_left", "Previous page", win_prev_action);
liste = lv_list_add(win_data->file_list, SYMBOL_LEFT, "Previous page", win_prev_action);
lv_obj_set_free_p(liste, app);
}
......@@ -409,7 +413,7 @@ static void win_load_file_list(lv_app_inst_t * app)
uint16_t file_cnt = 0;
while(file_cnt <= app_data->file_cnt) {
res = fs_readdir(&rd, fn);
if(res != FS_RES_OK || fn[0] == '\0'){
if(res != FS_RES_OK ){
lv_app_notice_add("Can not read\nthe path in Files");
return;
}
......@@ -420,13 +424,13 @@ static void win_load_file_list(lv_app_inst_t * app)
while(res == FS_RES_OK && fn[0] != '\0') {
if(fn[0] == '/') { /*Add a folder*/
lv_obj_t * liste;
liste = lv_list_add(win_data->file_list, "U:/icon_folder", &fn[1], win_folder_action);
liste = lv_list_add(win_data->file_list, SYMBOL_FOLDER, &fn[1], win_folder_action);
lv_obj_set_free_p(liste, app);
app_data->file_cnt ++;
}
/*Add a file*/
else {
liste = lv_list_add(win_data->file_list, "U:/icon_file", fn, win_file_action);
liste = lv_list_add(win_data->file_list, SYMBOL_FILE, fn, win_file_action);
lv_obj_set_free_p(liste, app);
app_data->file_cnt ++;
}
......@@ -436,7 +440,7 @@ static void win_load_file_list(lv_app_inst_t * app)
/*Show only LV_APP_FSEL_MAX_FILE elements and add a Next page button*/
if(app_data->file_cnt != 0 && app_data->file_cnt % LV_APP_FILES_PAGE_SIZE == 0) {
liste = lv_list_add(win_data->file_list, "U:/icon_right", "Next page", win_next_action);
liste = lv_list_add(win_data->file_list, SYMBOL_RIGHT, "Next page", win_next_action);
lv_obj_set_free_p(liste, app);
break;
}
......@@ -525,7 +529,7 @@ static lv_action_res_t win_drv_action(lv_obj_t * drv, lv_dispi_t * dispi)
{
lv_app_inst_t * app = lv_obj_get_free_p(drv);
my_app_data_t * app_data = app->app_data;
sprintf(app_data->path, "%s:", lv_list_element_get_txt(drv));
sprintf(app_data->path, "%s:", lv_list_get_element_text(drv));
app_data->file_cnt = 0;
lv_win_set_title(app->win, app_data->path);
my_sc_data_t * sc_data = app->sc_data;
......@@ -549,7 +553,7 @@ static lv_action_res_t win_folder_action(lv_obj_t * folder, lv_dispi_t * dispi)
{
lv_app_inst_t * app = lv_obj_get_free_p(folder);
my_app_data_t * app_data = app->app_data;
sprintf(app_data->path, "%s/%s", app_data->path, lv_list_element_get_txt(folder));
sprintf(app_data->path, "%s/%s", app_data->path, lv_list_get_element_text(folder));
app_data->file_cnt = 0;
lv_win_set_title(app->win, app_data->path);
......@@ -577,7 +581,7 @@ static lv_action_res_t win_file_action(lv_obj_t * file, lv_dispi_t * dispi)
my_app_data_t * app_data = app->app_data;
my_win_data_t * win_data = app->win_data;
sprintf(app_data->fn, "%s", lv_list_element_get_txt(file));
sprintf(app_data->fn, "%s", lv_list_get_element_text(file));
win_create_list(app);
......@@ -662,9 +666,9 @@ static lv_action_res_t win_send_settings_element_rel_action(lv_obj_t * element,
lv_app_notice_add("CRC sending is\nnot supported yet");
}
} else if(id == SEND_SETTINGS_CHUNK_SIZE) {
lv_app_kb_open(element, LV_APP_KB_MODE_NUM, send_settings_kb_close_action, send_settings_kb_ok_action);
lv_app_kb_open(element, LV_APP_KB_MODE_NUM | LV_APP_KB_MODE_WIN_RESIZE, send_settings_kb_close_action, send_settings_kb_ok_action);
} else if(id == SEND_SETTINGS_CHUNK_DELAY) {
lv_app_kb_open(element, LV_APP_KB_MODE_NUM, send_settings_kb_close_action, send_settings_kb_ok_action);
lv_app_kb_open(element, LV_APP_KB_MODE_NUM | LV_APP_KB_MODE_WIN_RESIZE, send_settings_kb_close_action, send_settings_kb_ok_action);
}
return LV_ACTION_RES_OK;
......
/**
* @file lv_app_example.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_app_phantom.h"
#if LV_APP_ENABLE != 0 && USE_LV_APP_PHANTOM != 0
#include "../lv_app/lv_app_util/lv_app_kb.h"
#include <stdio.h>
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Application specific data for an instance of this application*/
typedef struct
{
void (*com_listen)(lv_app_inst_t * app_send, lv_app_inst_t * app_rec,
lv_app_com_type_t type , const void * data, uint32_t size);
}my_app_data_t;
/*Application specific data a window of this application*/
typedef struct
{
}my_win_data_t;
/*Application specific data for a shortcut of this application*/
typedef struct
{
lv_obj_t * label;
}my_sc_data_t;
/**********************
* STATIC PROTOTYPES
**********************/
static void my_app_run(lv_app_inst_t * app, void * conf);
static void my_app_close(lv_app_inst_t * app);
static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec,
lv_app_com_type_t type , const void * data, uint32_t size);
/**********************
* STATIC VARIABLES
**********************/
static lv_app_dsc_t my_app_dsc =
{
.name = "Phantom",
.mode = LV_APP_MODE_NONE,
.app_run = my_app_run,
.app_close = my_app_close,
.com_rec = my_com_rec,
.win_open = NULL,
.win_close = NULL,
.sc_open = NULL,
.sc_close = NULL,
.app_data_size = sizeof(my_app_data_t),
.sc_data_size = sizeof(my_sc_data_t),
.win_data_size = sizeof(my_win_data_t),
};
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Initialize the application
* @return pointer to the application descriptor of this application
*/
const lv_app_dsc_t * lv_app_phantom_init(void)
{
return &my_app_dsc;
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Run an application according to 'app_dsc'
* @param app_dsc pointer to an application descriptor
* @param conf pointer to a lv_app_phantom_conf_t structure with configuration data or NULL if unused
* @return pointer to the opened application or NULL if any error occurred
*/
static void my_app_run(lv_app_inst_t * app, void * conf)
{
/*Initialize the application*/
my_app_data_t * app_data = app->app_data;
app_data->com_listen = NULL;
if(conf != NULL) {
lv_app_phantom_conf_t * my_conf = conf;
app_data->com_listen = my_conf->com_listen;
}
}
/**
* Close a running application.
* Close the Window and the Shortcut too if opened.
* Free all the allocated memory by this application.
* @param app pointer to an application
*/
static void my_app_close(lv_app_inst_t * app)
{
/*No dynamically allocated data in 'my_app_data'*/
}
/**
* Read the data have been sent to this application
* @param app_send pointer to an application which sent the message
* @param app_rec pointer to an application which is receiving the message
* @param type type of data from 'lv_app_com_type_t' enum
* @param data pointer to the sent data
* @param size length of 'data' in bytes
*/
static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec,
lv_app_com_type_t type , const void * data, uint32_t size)
{
my_app_data_t * app_data = app_rec->app_data;
if(app_data->com_listen != NULL) {
app_data->com_listen(app_send, app_rec, type, data, size);
}
}
/*--------------------
* OTHER FUNCTIONS
---------------------*/
#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0*/
/**
* @file lv_app_phantom.h
*
*/
#ifndef LV_APP_PHANTOM_H
#define LV_APP_PHANTOM_H
/*********************
* INCLUDES
*********************/
#include "lvgl/lv_app/lv_app.h"
#if LV_APP_ENABLE != 0 && USE_LV_APP_PHANTOM != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct
{
void (*com_listen)(lv_app_inst_t * app_send,
lv_app_inst_t * app_rec,
lv_app_com_type_t type ,
const void * data, uint32_t size);
}lv_app_phantom_conf_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
const lv_app_dsc_t * lv_app_phantom_init(void);
/**********************
* MACROS
**********************/
#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_PHANTOM != 0*/
#endif /* LV_APP_PHANTOM_H */
......@@ -83,8 +83,10 @@ static lv_app_dsc_t my_app_dsc =
static uint8_t mem_pct[LV_APP_SYSMON_PNUM];
static uint8_t cpu_pct[LV_APP_SYSMON_PNUM];
static lv_style_t cpu_bars;
static lv_style_t mem_bars;
static lv_style_t cpu_bar_bg;
static lv_style_t mem_bar_bg;
static lv_style_t cpu_bar_indic;
static lv_style_t mem_bar_indic;
#if USE_DYN_MEM != 0 && DM_CUSTOM == 0
static dm_mon_t mem_mon;
#endif
......@@ -109,23 +111,30 @@ const lv_app_dsc_t * lv_app_sysmon_init(void)
memset(cpu_pct, 0, sizeof(cpu_pct));
/*Create bar styles for the shortcut*/
lv_style_get(LV_STYLE_PRETTY_COLOR, &cpu_bars);
cpu_bars.gcolor = COLOR_MARRON;
cpu_bars.mcolor = COLOR_RED;
cpu_bars.bwidth = 0;
cpu_bars.ccolor = COLOR_MAKE(0x40, 0x00, 0x00);
cpu_bars.font = font_get(LV_APP_FONT_MEDIUM);
cpu_bars.line_space = 0;
cpu_bars.txt_align = 1;
cpu_bars.hpad = 0;
cpu_bars.vpad = 0;
memcpy(&mem_bars, &cpu_bars, sizeof(cpu_bars));
mem_bars.gcolor = COLOR_GREEN;
mem_bars.mcolor = COLOR_LIME;
mem_bars.ccolor = COLOR_MAKE(0x00, 0x40, 0x00);
lv_style_get(LV_STYLE_PRETTY, &cpu_bar_bg);
cpu_bar_bg.ccolor = COLOR_MAKE(0x40, 0x00, 0x00);
cpu_bar_bg.font = font_get(LV_APP_FONT_MEDIUM);
cpu_bar_bg.line_space = 0;
cpu_bar_bg.txt_align = 1;
cpu_bar_bg.hpad = 0;
cpu_bar_bg.vpad = 0;
memcpy(&mem_bar_bg, &cpu_bar_bg, sizeof(lv_style_t));
mem_bar_bg.ccolor = COLOR_MAKE(0x00, 0x40, 0x00);
lv_style_get(LV_STYLE_PRETTY_COLOR, &cpu_bar_indic);
cpu_bar_indic.gcolor = COLOR_MARRON;
cpu_bar_indic.mcolor = COLOR_RED;
cpu_bar_indic.bcolor = COLOR_BLACK;
//cpu_bar_indic.bwidth = 1 * LV_DOWNSCALE;
cpu_bar_indic.bopa = OPA_50;
cpu_bar_indic.hpad = 0 * LV_DOWNSCALE;
cpu_bar_indic.vpad = 0 * LV_DOWNSCALE;
memcpy(&mem_bar_indic, &cpu_bar_indic, sizeof(lv_style_t));
mem_bar_indic.gcolor = COLOR_GREEN;
mem_bar_indic.mcolor = COLOR_LIME;
return &my_app_dsc;
}
......@@ -186,7 +195,8 @@ static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc)
sc_data->bar_cpu = lv_bar_create(sc, NULL);
lv_obj_set_size(sc_data->bar_cpu, w, 5 * lv_obj_get_height(sc) / 8);
lv_obj_align(sc_data->bar_cpu, NULL, LV_ALIGN_IN_BOTTOM_LEFT, w, - lv_obj_get_height(sc) / 8);
lv_bar_set_style_indic(sc_data->bar_cpu, &cpu_bars);
lv_obj_set_style(sc_data->bar_cpu, &cpu_bar_bg);
lv_bar_set_style_indic(sc_data->bar_cpu, &cpu_bar_indic);
lv_obj_set_click(sc_data->bar_cpu, false);
lv_bar_set_range(sc_data->bar_cpu, 0, 100);
lv_obj_t * label = lv_label_create(sc_data->bar_cpu, NULL);
......@@ -195,7 +205,8 @@ static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc)
sc_data->bar_mem = lv_bar_create(sc, sc_data->bar_cpu);
lv_obj_align(sc_data->bar_mem, sc_data->bar_cpu, LV_ALIGN_OUT_RIGHT_MID, w, 0);
lv_bar_set_style_indic(sc_data->bar_mem, &mem_bars);
lv_obj_set_style(sc_data->bar_mem, &mem_bar_bg);
lv_bar_set_style_indic(sc_data->bar_mem, &mem_bar_indic);
label = lv_label_create(sc_data->bar_mem, NULL);
lv_label_set_text(label, "M\nE\nM");
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
......@@ -223,6 +234,8 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win)
{
my_win_data_t * win_data = app->win_data;
lv_cont_set_layout(lv_page_get_scrl(lv_win_get_page(win)), LV_CONT_LAYOUT_PRETTY);
/*Create a chart with two data lines*/
win_data->chart = lv_chart_create(win, NULL);
lv_obj_set_size(win_data->chart, LV_HOR_RES / 2, LV_VER_RES / 2);
......@@ -231,8 +244,8 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win)
lv_chart_set_range(win_data->chart, 0, 100);
lv_chart_set_type(win_data->chart, LV_CHART_LINE);
lv_chart_set_dl_width(win_data->chart, 2 * LV_DOWNSCALE);
win_data->cpu_dl = lv_chart_add_dataline(win_data->chart, COLOR_RED);
win_data->mem_dl = lv_chart_add_dataline(win_data->chart, COLOR_BLUE);
win_data->cpu_dl = lv_chart_add_data_line(win_data->chart, COLOR_RED);
win_data->mem_dl = lv_chart_add_data_line(win_data->chart, COLOR_BLUE);
uint16_t i;
for(i = 0; i < LV_APP_SYSMON_PNUM; i ++) {
......
......@@ -31,7 +31,7 @@
/*********************
* DEFINES
*********************/
#define OBJ_PAD (LV_DPI / 4)
#define OBJ_PAD (LV_DPI / 12)
/**********************
* TYPEDEFS
......@@ -144,9 +144,17 @@ static void my_app_run(lv_app_inst_t * app, void * conf)
{
/*Initialize the application*/
my_app_data_t * app_data = app->app_data;
app_data->com_type = LV_APP_COM_TYPE_CHAR;
app_data->format = LV_APP_TERMINAL_FORMAT_ASCII;
if(conf != NULL) {
app_data->com_type = ((lv_app_terminal_conf_t * ) conf)->com_type;
app_data->format = ((lv_app_terminal_conf_t * ) conf)->format;
} else {
app_data->com_type = LV_APP_COM_TYPE_CHAR;
app_data->format = LV_APP_TERMINAL_FORMAT_ASCII;
}
app_data->last_sender = NULL;
memset(app_data->txt, 0, sizeof(app_data->txt));
}
......@@ -326,7 +334,7 @@ static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win)
*/
static lv_action_res_t win_ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi)
{
lv_app_kb_open(ta, LV_APP_KB_MODE_TXT, NULL, win_ta_kb_ok_action);
lv_app_kb_open(ta, LV_APP_KB_MODE_TXT | LV_APP_KB_MODE_WIN_RESIZE, NULL, win_ta_kb_ok_action);
return LV_ACTION_RES_OK;
}
......
......@@ -28,7 +28,8 @@ typedef enum
typedef struct
{
lv_app_terminal_format_t format; /*Data display format*/
lv_app_com_type_t com_type; /*The listened communication type (channel) */
}lv_app_terminal_conf_t;
/**********************
......
......@@ -347,7 +347,6 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
cord_t row;
area_t act_area;
area_t mask_sub;
bool union_ok;
union_ok = area_union(&mask_sub, mask_p, cords_p);
......
......@@ -1234,7 +1234,7 @@ cord_t lv_obj_get_height(lv_obj_t * obj)
* @param obj pointer to an object
* @return the extended size attribute
*/
cord_t lv_obj_getext_size(lv_obj_t * obj)
cord_t lv_obj_get_ext_size(lv_obj_t * obj)
{
return obj->ext_size;
}
......
......@@ -551,7 +551,7 @@ cord_t lv_obj_get_height(lv_obj_t * obj);
* @param obj pointer to an object
* @return the extended size attribute
*/
cord_t lv_obj_getext_size(lv_obj_t * obj);
cord_t lv_obj_get_ext_size(lv_obj_t * obj);
/**
* Get the style pointer of an object
......
......@@ -43,7 +43,8 @@ typedef struct
opa_t opa; /*Opacity of the object*/
uint8_t glass :1; /*1: Do not inherit this style*/
uint8_t empty :1; /*Transparent background (border drawn)*/
uint8_t stype :3; /*Shadow type from 'lv_shadow_type_t'*/
uint8_t stype :2; /*Shadow type from 'lv_shadow_type_t'*/
uint8_t txt_align:2;
color_t mcolor; /*Main color of background*/
color_t gcolor; /*Gradient color of background*/
color_t bcolor; /*Border color of background*/
......@@ -58,7 +59,6 @@ typedef struct
const font_t * font;
cord_t letter_space;
cord_t line_space;
uint8_t txt_align;
opa_t img_recolor;
cord_t line_width;
}lv_style_t;
......
......@@ -244,8 +244,6 @@ static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t
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);
......
......@@ -396,7 +396,6 @@ static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_
ancestor_design_f(btnm, mask, mode);
lv_btnm_ext_t * ext = lv_obj_get_ext(btnm);
lv_style_t * style = lv_obj_get_style(btnm);
lv_style_t * btn_style;
area_t area_btnm;
......
......@@ -76,7 +76,13 @@ void lv_cb_set_text(lv_obj_t * cb, const char * txt);
*/
const char * lv_cb_get_text(lv_obj_t * cb);
/**
* Get the bullet (lv_btn) of a check box
* @param cb pointer to check box object
* @return pointer to the bullet of the check box (lv_btn)
*/
lv_obj_t * lv_cb_get_bullet(lv_obj_t * cb);
/**********************
* MACROS
**********************/
......
......@@ -139,7 +139,7 @@ bool lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param)
* @param color color of the data line
* @return pointer to the allocated data line (
*/
lv_chart_dl_t * lv_chart_add_dataline(lv_obj_t * chart, color_t color)
lv_chart_dl_t * lv_chart_add_data_line(lv_obj_t * chart, color_t color)
{
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
lv_chart_dl_t * dl = ll_ins_head(&ext->dl_ll);
......
......@@ -18,7 +18,6 @@
/*********************
* DEFINES
*********************/
#define LV_CHART_DL_NUM 8 /*Max data line number. Used in the style.*/
/**********************
* TYPEDEFS
......@@ -83,7 +82,7 @@ bool lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param);
* @param color color of the data line
* @return pointer to the allocated data line (
*/
lv_chart_dl_t * lv_chart_add_dataline(lv_obj_t * chart, color_t color);
lv_chart_dl_t * lv_chart_add_data_line(lv_obj_t * chart, color_t color);
/**
* Refresh a chart if its data line has changed
......
......@@ -30,9 +30,9 @@ typedef enum
LV_CONT_LAYOUT_COL_L, /*Column left align*/
LV_CONT_LAYOUT_COL_M, /*Column middle align*/
LV_CONT_LAYOUT_COL_R, /*Column right align*/
LV_CONT_LAYOUT_ROW_T, /*Row left align*/
LV_CONT_LAYOUT_ROW_T, /*Row top align*/
LV_CONT_LAYOUT_ROW_M, /*Row middle align*/
LV_CONT_LAYOUT_ROW_B, /*Row right align*/
LV_CONT_LAYOUT_ROW_B, /*Row bottom align*/
LV_CONT_LAYOUT_PRETTY, /*Put as many object as possible in row and begin a new row*/
LV_CONT_LAYOUT_GRID, /*Align same-sized object into a grid*/
}lv_cont_layout_t;
......
......@@ -36,8 +36,7 @@ static void lv_ddlist_pos_act_option(lv_obj_t * ddlist);
* STATIC VARIABLES
**********************/
static lv_design_f_t ancestor_design_f;
static const char * def_options[] = {"Option 1", "Option 2", "Option 3","Option 4", "Option 5", "Option 6",
"Option 7", "Option 8", "Option 9","Option 10", "Option 11", "Option 12",""};
static const char * def_options[] = {"Option 1", "Option 2", "Option 3", ""};
/**********************
* MACROS
**********************/
......@@ -87,7 +86,6 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_set_style(scrl, lv_style_get(LV_STYLE_TRANSP, NULL));
ext->opt_label = lv_label_create(new_ddlist, NULL);
lv_obj_set_style(ext->opt_label, lv_style_get(LV_STYLE_PRETTY, NULL));
lv_cont_set_fit(new_ddlist, true, false);
lv_page_set_rel_action(new_ddlist, lv_ddlist_rel_action);
lv_page_set_sb_mode(new_ddlist, LV_PAGE_SB_MODE_DRAG);
......@@ -258,7 +256,7 @@ bool lv_ddlist_get_auto_size(lv_obj_t * ddlist, bool auto_size)
* @param ddlist pointer to a drop down list object
* @return pointer the style of the select rectangle
*/
lv_style_t * lv_dlist_get_style_select(lv_obj_t * ddlist)
lv_style_t * lv_ddlist_get_style_select(lv_obj_t * ddlist)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
if(ext->style_sel == NULL) return lv_obj_get_style(ddlist);
......
......@@ -132,7 +132,7 @@ bool lv_ddlist_get_auto_size(lv_obj_t * ddlist, bool auto_size);
* @param ddlist pointer to a drop down list object
* @return pointer the style of the select rectangle
*/
lv_style_t * lv_dlist_get_style_select(lv_obj_t * ddlist);
lv_style_t * lv_ddlist_get_style_select(lv_obj_t * ddlist);
/**********************
* MACROS
......
......@@ -189,6 +189,9 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle, int16_t value)
ext->values[needle] = value;
/*To be consistent with bar set the first needle's value for the bar*/
if(needle == 0) lv_bar_set_value(gauge, value);
lv_obj_inv(gauge);
}
......@@ -309,6 +312,11 @@ static bool lv_gauge_design(lv_obj_t * gauge, const area_t * mask, lv_design_mod
int16_t min = lv_bar_get_min_value(gauge);
int16_t max = lv_bar_get_max_value(gauge);
/*To be consistent with bar use the bar value as the first needle*/
if(ext->needle_num != 0) {
ext->values[0] = lv_bar_get_value(gauge);
}
int16_t critical_val = ext->low_critical == 0 ? min : max;
uint8_t i;
......@@ -327,7 +335,8 @@ static bool lv_gauge_design(lv_obj_t * gauge, const area_t * mask, lv_design_mod
style_bg.gcolor = color_mix(style_critical->gcolor, style_base->gcolor, ratio);
style_bg.bcolor = color_mix(style_critical->bcolor, style_base->bcolor, ratio);
style_bg.scolor = color_mix(style_critical->scolor, style_base->scolor, ratio);
style_bg.swidth = (cord_t)((cord_t)(style_critical->swidth + style_base->swidth) * ratio) >> 8;
style_bg.swidth = (cord_t)(((cord_t)style_critical->swidth * ratio) + ((cord_t)style_base->swidth * (OPA_COVER - ratio))) >> 8;
style_bg.opa = (cord_t)(((uint16_t)style_critical->opa * ratio) + ((uint16_t)style_base->opa * (OPA_COVER - ratio))) >> 8;
lv_draw_rect(&gauge->cords, mask, &style_bg);
......
......@@ -68,6 +68,7 @@ lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy)
ext->h = lv_obj_get_height(new_img);
ext->transp = 0;
ext->upscale = 0;
ext->auto_size = 1;
/*Init the new object*/
lv_obj_set_signal_f(new_img, lv_img_signal);
......
......@@ -29,8 +29,8 @@
typedef enum
{
LV_LABEL_LONG_EXPAND, /*Expand the object size to the text size*/
LV_LABEL_LONG_BREAK, /*Keep the width and break the text and expand the object height*/
LV_LABEL_LONG_DOTS, /*Keep the size, break the text and write dots in the last line*/
LV_LABEL_LONG_BREAK, /*Keep the object width, break the too long lines and expand the object height*/
LV_LABEL_LONG_DOTS, /*Keep the object size, break the text and write dots in the last line*/
LV_LABEL_LONG_SCROLL, /*Expand the object size and scroll the text on the parent (move the label object)*/
}lv_label_long_mode_t;
......
......@@ -291,7 +291,7 @@ void lv_list_set_style_img(lv_obj_t * list, lv_style_t * style)
* @param liste pointer to list element
* @return pointer to the text
*/
const char * lv_list_element_get_txt(lv_obj_t * liste)
const char * lv_list_get_element_text(lv_obj_t * liste)
{
/*The last child is the label*/
lv_obj_t * label = lv_obj_get_child(liste, NULL);
......
......@@ -108,8 +108,8 @@ void lv_list_set_sb_out(lv_obj_t * list, bool out);
* @param ina pointer to a style for inactive state
*/
void lv_list_set_styles_btn(lv_obj_t * list, lv_style_t * rel, lv_style_t * pr,
lv_style_t * trel, lv_style_t * tpr,
lv_style_t * ina);
lv_style_t * trel, lv_style_t * tpr,
lv_style_t * ina);
/**
* Set the styles of the list element image (typically to set symbol font)
......@@ -123,7 +123,7 @@ void lv_list_set_style_img(lv_obj_t * list, lv_style_t * style);
* @param liste pointer to list element
* @return pointer to the text
*/
const char * lv_list_element_get_txt(lv_obj_t * liste);
const char * lv_list_get_element_text(lv_obj_t * liste);
/**
* Get the scroll bar outside attribute
......
......@@ -518,7 +518,7 @@ static bool lv_ta_scrling_design(lv_obj_t * scrling, const area_t * mask, lv_des
/*Draw the cursor too*/
lv_obj_t * ta = lv_obj_get_parent(scrling);
lv_ta_ext_t * ta_ext = lv_obj_get_ext(ta);
lv_style_t * ta_style = lv_obj_get_style(ta);
lv_style_t * scrl_style = lv_obj_get_style(lv_page_get_scrl(ta));
if(ta_ext->cursor_show != 0 && ta_ext->cursor_state == 0) {
uint16_t cur_pos = lv_ta_get_cursor_pos(ta);
......@@ -529,15 +529,15 @@ static bool lv_ta_scrling_design(lv_obj_t * scrling, const area_t * mask, lv_des
lv_style_t * labels_p = lv_obj_get_style(ta_ext->label);
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 + LV_DOWNSCALE ;
cur_area.x2 = letter_pos.x + ta_ext->label->cords.x1 + scrl_style->line_width ;
cur_area.y2 = letter_pos.y + ta_ext->label->cords.y1 + (font_get_height(labels_p->font) >> FONT_ANTIALIAS);
lv_style_t cur_rects;
lv_style_get(LV_STYLE_PLAIN, &cur_rects);
cur_rects.radius = 0;
cur_rects.bwidth = 0;
cur_rects.mcolor = ta_style->ccolor;
cur_rects.gcolor = ta_style->ccolor;
cur_rects.mcolor = scrl_style->ccolor;
cur_rects.gcolor = scrl_style->ccolor;
lv_draw_rect(&cur_area, mask, &cur_rects);
}
}
......
......@@ -208,7 +208,7 @@ bool lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
* @param rel_action a function pointer to call when the button is released
* @return pointer to the created button object
*/
lv_obj_t * lv_win_add_ctrl_btn(lv_obj_t * win, const char * img_path, lv_action_t rel_action)
lv_obj_t * lv_win_add_cbtn(lv_obj_t * win, const char * img_path, lv_action_t rel_action)
{
lv_win_ext_t * ext = lv_obj_get_ext(win);
......@@ -235,7 +235,7 @@ lv_obj_t * lv_win_add_ctrl_btn(lv_obj_t * win, const char * img_path, lv_action_
*/
lv_action_res_t lv_win_close_action(lv_obj_t * btn, lv_dispi_t * dispi)
{
lv_obj_t * win = lv_win_get_from_ctrl_btn(btn);
lv_obj_t * win = lv_win_get_from_cbtn(btn);
lv_obj_del(win);
......@@ -269,12 +269,12 @@ void lv_win_set_cbtn_size(lv_obj_t * win, cord_t size)
}
/**
* Set the style of the window control buttons in a given state
* Set the styles of the window control buttons in a given state
* @param win pointer to a window object
* @param rel spointer to the style in released state
* @param pr pointer to the style in pressed state
*/
void lv_win_set_style_cbtn(lv_obj_t * win, lv_style_t * rel, lv_style_t * pr)
void lv_win_set_styles_cbtn(lv_obj_t * win, lv_style_t * rel, lv_style_t * pr)
{
lv_win_ext_t * ext = lv_obj_get_ext(win);
ext->style_cbtn_rel = rel;
......@@ -356,7 +356,7 @@ cord_t lv_win_get_width(lv_obj_t * win)
* @param ctrl_btn pointer to a control button of a window
* @return pointer to the window of 'ctrl_btn'
*/
lv_obj_t * lv_win_get_from_ctrl_btn(lv_obj_t * ctrl_btn)
lv_obj_t * lv_win_get_from_cbtn(lv_obj_t * ctrl_btn)
{
lv_obj_t * ctrl_holder = lv_obj_get_parent(ctrl_btn);
lv_obj_t * header = lv_obj_get_parent(ctrl_holder);
......
......@@ -88,7 +88,7 @@ bool lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param);
* @param rel_action a function pointer to call when the button is released
* @return pointer to the created button object
*/
lv_obj_t * lv_win_add_ctrl_btn(lv_obj_t * win, const char * img_path, lv_action_t rel_action);
lv_obj_t * lv_win_add_cbtn(lv_obj_t * win, const char * img_path, lv_action_t rel_action);
/**
* A release action which can be assigned to a window control button to close it
......@@ -113,12 +113,12 @@ void lv_win_set_title(lv_obj_t * win, const char * title);
void lv_win_set_cbtn_size(lv_obj_t * win, cord_t size);
/**
* Set the style of the window control buttons in a given state
* Set the styles of the window control buttons in a given state
* @param win pointer to a window object
* @param rel spointer to the style in released state
* @param pr pointer to the style in pressed state
*/
void lv_win_set_style_cbtn(lv_obj_t * win, lv_style_t * rel, lv_style_t * pr);
void lv_win_set_styles_cbtn(lv_obj_t * win, lv_style_t * rel, lv_style_t * pr);
/**
* Get the title of a window
......@@ -158,10 +158,10 @@ cord_t lv_win_get_width(lv_obj_t * win);
/**
* Get the pointer of a widow from one of its control button.
* It is useful in the action of the control buttons where only button is known.
* @param ctrl_btn pointer to a control button of a window
* @return pointer to the window of 'ctrl_btn'
* @param cbtn pointer to a control button of a window
* @return pointer to the window of 'cbtn'
*/
lv_obj_t * lv_win_get_from_ctrl_btn(lv_obj_t * ctrl_btn);
lv_obj_t * lv_win_get_from_cbtn(lv_obj_t * cbtn);
/**********************
* MACROS
......
......@@ -34,7 +34,7 @@
#include "lv_objx/lv_label.h"
#include "lv_objx/lv_line.h"
#include "lv_objx/lv_page.h"
#include <lvgl/lv_objx/lv_cont.h>
#include "lv_objx/lv_cont.h"
#include "lv_objx/lv_list.h"
#include "lv_objx/lv_chart.h"
#include "lv_objx/lv_cb.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment