diff options
author | Uros Majstorovic <majstor@majstor.org> | 2020-07-02 20:32:50 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2020-07-02 20:32:50 +0200 |
commit | dabbf944711eef384dcc87b2d49843bedcb1e84a (patch) | |
tree | bab3fc421c7df9c200ec054ed4a2ec103376f383 /code/fe310/eos/eve/screen | |
parent | d3d239fa9cb25b4a3656c09dbb38f5743d51a213 (diff) |
copy/paste for text widget implemented
Diffstat (limited to 'code/fe310/eos/eve/screen')
-rw-r--r-- | code/fe310/eos/eve/screen/font.c | 15 | ||||
-rw-r--r-- | code/fe310/eos/eve/screen/font.h | 5 | ||||
-rw-r--r-- | code/fe310/eos/eve/screen/form.c | 6 |
3 files changed, 18 insertions, 8 deletions
diff --git a/code/fe310/eos/eve/screen/font.c b/code/fe310/eos/eve/screen/font.c index 1441961..ae0ac88 100644 --- a/code/fe310/eos/eve/screen/font.c +++ b/code/fe310/eos/eve/screen/font.c @@ -14,7 +14,7 @@ void eve_font_init(EVEFont *font, uint8_t font_id) { eve_readb(p, font->w_ch, 128); } -uint16_t eve_font_string_width(EVEFont *font, char *s) { +uint16_t eve_font_strw(EVEFont *font, char *s) { uint16_t r = 0; while (*s) { @@ -25,6 +25,17 @@ uint16_t eve_font_string_width(EVEFont *font, char *s) { return r; } -uint8_t eve_font_height(EVEFont *font) { +uint16_t eve_font_bufw(EVEFont *font, char *buf, uint16_t buf_len) { + int i; + uint16_t r = 0; + + for (i=0; i<buf_len; i++) { + r += font->w_ch[*(buf + i)]; + } + + return r; +} + +uint8_t eve_font_h(EVEFont *font) { return font->h; }
\ No newline at end of file diff --git a/code/fe310/eos/eve/screen/font.h b/code/fe310/eos/eve/screen/font.h index a46c942..7de3ff5 100644 --- a/code/fe310/eos/eve/screen/font.h +++ b/code/fe310/eos/eve/screen/font.h @@ -8,5 +8,6 @@ typedef struct EVEFont { } EVEFont; void eve_font_init(EVEFont *font, uint8_t font_id); -uint16_t eve_font_string_width(EVEFont *font, char *s); -uint8_t eve_font_height(EVEFont *font); +uint16_t eve_font_strw(EVEFont *font, char *s); +uint16_t eve_font_bufw(EVEFont *font, char *buf, uint16_t buf_len); +uint8_t eve_font_h(EVEFont *font); diff --git a/code/fe310/eos/eve/screen/form.c b/code/fe310/eos/eve/screen/form.c index 442b329..f84b0d7 100644 --- a/code/fe310/eos/eve/screen/form.c +++ b/code/fe310/eos/eve/screen/form.c @@ -33,11 +33,10 @@ int eve_form_touch(EVEView *v, uint8_t tag0, int touch_idx) { for (i=0; i<form->widget_size; i++) { if (eve_page_rect_visible(&form->p, &widget->g)) { int a; - EVERect r = {0,0,0,0}; - a = widget->touch(widget, &form->p, tag0, touch_idx, &r); + a = widget->touch(widget, &form->p, tag0, touch_idx, &focus); ret = ret || a; - if (r.w && r.h && (widget_f != widget)) { + if (focus.w && focus.h && (widget_f != widget)) { EVEKbd *kbd = eve_screen_get_kbd(form->p.window->screen); if (kbd) { @@ -51,7 +50,6 @@ int eve_form_touch(EVEView *v, uint8_t tag0, int touch_idx) { } } widget_f = widget; - focus = r; } } widget = eve_widget_next(widget); |