diff options
author | Uros Majstorovic <majstor@majstor.org> | 2020-08-24 18:12:41 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2020-08-24 18:12:41 +0200 |
commit | d7bdbcf7e6881065200b21a02522a68cf4fb9881 (patch) | |
tree | 67712572568ae37a215d872bf1921939b7164a20 /fw/fe310/eos/eve | |
parent | 1e5eb7cb910e6f23c69c2c986b6373e9f9abb980 (diff) |
fixed bug in form constructor; free widget improved
Diffstat (limited to 'fw/fe310/eos/eve')
-rw-r--r-- | fw/fe310/eos/eve/screen/form.c | 12 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/form.h | 1 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/freew.c | 10 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/freew.h | 5 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/strw.c | 7 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/textw.c | 7 |
6 files changed, 36 insertions, 6 deletions
diff --git a/fw/fe310/eos/eve/screen/form.c b/fw/fe310/eos/eve/screen/form.c index 52cfdc6..5837a99 100644 --- a/fw/fe310/eos/eve/screen/form.c +++ b/fw/fe310/eos/eve/screen/form.c @@ -109,7 +109,7 @@ void eve_form_update_g(EVEPage *page, EVEWidget *_widget) { widget->label->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; i<idx; i++) { + w = eve_widget_next(w); + } + return w; +} diff --git a/fw/fe310/eos/eve/screen/form.h b/fw/fe310/eos/eve/screen/form.h index 91a4f8a..b6e59ff 100644 --- a/fw/fe310/eos/eve/screen/form.h +++ b/fw/fe310/eos/eve/screen/form.h @@ -13,3 +13,4 @@ int eve_form_touch(EVEView *v, uint8_t tag0, int touch_idx); uint8_t eve_form_draw(EVEView *v, uint8_t tag0); int eve_form_handle_evt(EVEPage *page, struct EVEWidget *widget, EVETouch *touch, uint16_t evt, uint8_t tag0, int touch_idx); void eve_form_update_g(EVEPage *page, struct EVEWidget *widget); +struct EVEWidget *eve_form_widget(EVEForm *form, uint16_t idx); diff --git a/fw/fe310/eos/eve/widget/freew.c b/fw/fe310/eos/eve/widget/freew.c index 55f91cb..51d1ead 100644 --- a/fw/fe310/eos/eve/widget/freew.c +++ b/fw/fe310/eos/eve/widget/freew.c @@ -34,6 +34,13 @@ void eve_freew_update(EVEFreeWidget *widget, eve_freew_touch_t touch, eve_freew_ if (putc) widget->w.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)); |