From d7bdbcf7e6881065200b21a02522a68cf4fb9881 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Mon, 24 Aug 2020 18:12:41 +0200 Subject: fixed bug in form constructor; free widget improved --- fw/fe310/eos/app/root.c | 15 ++++++++------- fw/fe310/eos/app/root.h | 5 ++--- fw/fe310/eos/app/status.c | 2 -- fw/fe310/eos/eve/screen/form.c | 12 +++++++++++- fw/fe310/eos/eve/screen/form.h | 1 + fw/fe310/eos/eve/widget/freew.c | 10 +++++++++- fw/fe310/eos/eve/widget/freew.h | 5 +++-- fw/fe310/eos/eve/widget/strw.c | 7 ++++++- fw/fe310/eos/eve/widget/textw.c | 7 ++++++- 9 files changed, 46 insertions(+), 18 deletions(-) (limited to 'fw/fe310') diff --git a/fw/fe310/eos/app/root.c b/fw/fe310/eos/app/root.c index 160316f..8f7ad94 100644 --- a/fw/fe310/eos/app/root.c +++ b/fw/fe310/eos/app/root.c @@ -17,9 +17,9 @@ #include "status.h" #include "root.h" -EVEFont _app_font_default; -extern eve_page_constructor_t _app_home_page; +EVEFont *_app_font_default; +static EVEFont font; static EVEScreen screen; static EVEWindow win_status; static EVEWindow win_main; @@ -51,7 +51,7 @@ EVEForm *app_form_create(EVEWindow *window, EVEPageStack *stack, APPWidgetSpec s for (i=0; ilabel->g.x = 0; widget->label->g.y = h; } - if (w + widget->g.w >= form->p.v.window->g.w) { + if (w + widget->g.w > form->p.v.window->g.w) { h += _h; w = 0; _h = 0; @@ -123,3 +123,13 @@ void eve_form_update_g(EVEPage *page, EVEWidget *_widget) { widget = eve_widget_next(widget); } } + +EVEWidget *eve_form_widget(EVEForm *form, uint16_t idx) { + EVEWidget *w = form->widget; + int i; + + for (i=0; iw.putc = putc; } +void eve_freew_tag(EVEFreeWidget *widget) { + if (widget->tagN != EVE_TAG_NOTAG) { + eve_cmd_dl(TAG(widget->tagN)); + widget->tagN++; + } +} + int eve_freew_touch(EVEWidget *_widget, EVEPage *page, uint8_t tag0, int touch_idx) { EVEFreeWidget *widget = (EVEFreeWidget *)_widget; EVETouch *t; @@ -55,7 +62,8 @@ uint8_t eve_freew_draw(EVEWidget *_widget, EVEPage *page, uint8_t tag0) { EVEFreeWidget *widget = (EVEFreeWidget *)_widget; widget->tag0 = tag0; - widget->tagN = widget->_draw(widget, page, tag0); + widget->tagN = tag0; + widget->_draw(widget, page); return widget->tagN; } diff --git a/fw/fe310/eos/eve/widget/freew.h b/fw/fe310/eos/eve/widget/freew.h index 49f896f..3347e68 100644 --- a/fw/fe310/eos/eve/widget/freew.h +++ b/fw/fe310/eos/eve/widget/freew.h @@ -3,7 +3,7 @@ struct EVEFreeWidget; typedef int (*eve_freew_touch_t) (struct EVEFreeWidget *, EVEPage *, EVETouch *, uint16_t, uint8_t, int); -typedef uint8_t (*eve_freew_draw_t) (struct EVEFreeWidget *, EVEPage *, uint8_t); +typedef void (*eve_freew_draw_t) (struct EVEFreeWidget *, EVEPage *); typedef struct EVEFreeWidget { EVEWidget w; @@ -23,5 +23,6 @@ int eve_freew_create(EVEFreeWidget *widget, EVERect *g, EVEFreeSpec *spec); void eve_freew_init(EVEFreeWidget *widget, EVERect *g, eve_freew_touch_t touch, eve_freew_draw_t draw, eve_kbd_input_handler_t putc); void eve_freew_update(EVEFreeWidget *widget, eve_freew_touch_t touch, eve_freew_draw_t draw, eve_kbd_input_handler_t putc); +void eve_freew_tag(EVEFreeWidget *widget); int eve_freew_touch(EVEWidget *_widget, EVEPage *page, uint8_t tag0, int touch_idx); -uint8_t eve_freew_draw(EVEWidget *_widget, EVEPage *page, uint8_t tag0); \ No newline at end of file +uint8_t eve_freew_draw(EVEWidget *_widget, EVEPage *page, uint8_t tag0); diff --git a/fw/fe310/eos/eve/widget/strw.c b/fw/fe310/eos/eve/widget/strw.c index e973575..4344e7c 100644 --- a/fw/fe310/eos/eve/widget/strw.c +++ b/fw/fe310/eos/eve/widget/strw.c @@ -195,7 +195,12 @@ static void _draw_str(EVEStrWidget *widget, EVEWindow *window, uint16_t ch, uint if (!s) eve_cmd_dl(COLOR_MASK(0 ,0 ,0 ,0)); eve_cmd_dl(VERTEX2F(x + x1, _widget->g.y)); eve_cmd_dl(VERTEX2F(x + x2, _widget->g.y + widget->font->h)); - if (!s) eve_cmd_dl(COLOR_MASK(1 ,1 ,1 ,1)); + if (!s) { + eve_cmd_dl(COLOR_MASK(1 ,1 ,1 ,1)); + eve_cmd_dl(BEGIN(EVE_LINES)); + eve_cmd_dl(VERTEX2F(x + x1, _widget->g.y + widget->font->h)); + eve_cmd_dl(VERTEX2F(x + x2, _widget->g.y + widget->font->h)); + } eve_cmd_dl(END()); if (len) { if (s) eve_cmd_dl(COLOR_RGBC(window->color_bg)); diff --git a/fw/fe310/eos/eve/widget/textw.c b/fw/fe310/eos/eve/widget/textw.c index 5835a57..dd11c11 100644 --- a/fw/fe310/eos/eve/widget/textw.c +++ b/fw/fe310/eos/eve/widget/textw.c @@ -202,7 +202,12 @@ static void _draw_line(EVETextWidget *widget, EVEWindow *window, uint16_t l, uin if (!s) eve_cmd_dl(COLOR_MASK(0 ,0 ,0 ,0)); eve_cmd_dl(VERTEX2F(_widget->g.x + x1, _widget->g.y + l * widget->font->h)); eve_cmd_dl(VERTEX2F(_widget->g.x + x2, _widget->g.y + (l + 1) * widget->font->h)); - if (!s) eve_cmd_dl(COLOR_MASK(1 ,1 ,1 ,1)); + if (!s) { + eve_cmd_dl(COLOR_MASK(1 ,1 ,1 ,1)); + eve_cmd_dl(BEGIN(EVE_LINES)); + eve_cmd_dl(VERTEX2F(_widget->g.x + x1, _widget->g.y + (l + 1) * widget->font->h)); + eve_cmd_dl(VERTEX2F(_widget->g.x + x2, _widget->g.y + (l + 1) * widget->font->h)); + } eve_cmd_dl(END()); if (len) { if (s) eve_cmd_dl(COLOR_RGBC(window->color_bg)); -- cgit v1.2.3