From b5aa60b256dd2b328515779883ba365aba3d995f Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Tue, 9 Jun 2020 00:32:34 +0200 Subject: EVEView iface fixed; screen keyboard window implemented --- code/fe310/eos/eve/screen/form.c | 24 +++++++++--------------- code/fe310/eos/eve/screen/page.c | 2 +- code/fe310/eos/eve/screen/screen.c | 20 ++++++++++++++++++-- code/fe310/eos/eve/screen/screen.h | 9 +-------- code/fe310/eos/eve/screen/window.c | 34 ++++++++++++++++++++++------------ code/fe310/eos/eve/screen/window.h | 3 ++- 6 files changed, 53 insertions(+), 39 deletions(-) (limited to 'code/fe310/eos/eve/screen') diff --git a/code/fe310/eos/eve/screen/form.c b/code/fe310/eos/eve/screen/form.c index bdf910a..ae381e6 100644 --- a/code/fe310/eos/eve/screen/form.c +++ b/code/fe310/eos/eve/screen/form.c @@ -45,6 +45,7 @@ int eve_form_touch(EVEView *v, uint8_t tag0, int touch_idx) { form->widget_f = widget; } widget = eve_widget_next(widget); + memset(&focus, 0, sizeof(focus)); } eve_page_focus(&form->p, &focus); @@ -54,24 +55,17 @@ int eve_form_touch(EVEView *v, uint8_t tag0, int touch_idx) { uint8_t eve_form_draw(EVEView *v, uint8_t tag0) { EVEForm *form = (EVEForm *)v; EVEWidget *widget = form->widget; - int i, j; - uint8_t tagN, _tagN = 0; + int i; + uint8_t tagN = tag0; for (i=0; iwidget_size; i++) { - tagN = widget->draw(widget, &form->p, tag0); - if (tagN) { - for (j=tag0; j<=tagN; j++) { - eve_touch_set_opt(j, eve_touch_get_opt(j) | EVE_TOUCH_OPT_TRACK | EVE_TOUCH_OPT_TRACK_XY | EVE_TOUCH_OPT_TRACK_EXT); - } - if (tagN < 0xfe) { - tag0 = tagN + 1; - } else { - tag0 = 0; - } - _tagN = tagN; - } + tagN = widget->draw(widget, &form->p, tagN); widget = eve_widget_next(widget); } - return _tagN; + for (i=tag0; iwindow, &g); + eve_window_visible_g(page->window, &g); g.x -= page->window->g.x; g.y -= page->window->g.y; diff --git a/code/fe310/eos/eve/screen/screen.c b/code/fe310/eos/eve/screen/screen.c index 9827323..d31cd2c 100644 --- a/code/fe310/eos/eve/screen/screen.c +++ b/code/fe310/eos/eve/screen/screen.c @@ -22,11 +22,11 @@ EVEKbd *eve_screen_get_kbd(EVEScreen *screen) { } void eve_screen_show_kbd(EVEScreen *screen) { - screen->kbd_active = 1; + if (screen->kbd && screen->kbd_win) screen->kbd_win->g.y = screen->h - screen->kbd->g.h; } void eve_screen_hide_kbd(EVEScreen *screen) { - screen->kbd_active = 0; + if (screen->kbd && screen->kbd_win) screen->kbd_win->g.y = screen->h; } int eve_screen_win_insert(EVEScreen *screen, EVEWindow *window, int idx) { @@ -69,5 +69,21 @@ void eve_screen_win_append(EVEScreen *screen, EVEWindow *window) { } void eve_screen_handle_touch(EVEScreen *screen, uint8_t tag0, int touch_idx) { + EVEWindow *w; + int a; + uint8_t tagN = 0x80; + eve_touch_clear_opt(); + + w = screen->win_head; + while(w) { + if (eve_window_visible(w)) a = w->view->touch(w->view, tag0, touch_idx); + w = w->next; + } + + w = screen->win_head; + while(w) { + if (eve_window_visible(w)) tagN = w->view->draw(w->view, tagN); + w = w->next; + } } diff --git a/code/fe310/eos/eve/screen/screen.h b/code/fe310/eos/eve/screen/screen.h index 9fa155a..d6bc5e8 100644 --- a/code/fe310/eos/eve/screen/screen.h +++ b/code/fe310/eos/eve/screen/screen.h @@ -2,20 +2,13 @@ struct EVEWindow; -typedef struct EVERect { - int16_t x; - int16_t y; - uint16_t w; - uint16_t h; -} EVERect; - typedef struct EVEScreen { uint16_t w; uint16_t h; struct EVEWindow *win_head; struct EVEWindow *win_tail; EVEKbd *kbd; - char kbd_active; + struct EVEWindow *kbd_win; } EVEScreen; int eve_screen_init(EVEScreen *screen, uint16_t w, uint16_t h); diff --git a/code/fe310/eos/eve/screen/window.c b/code/fe310/eos/eve/screen/window.c index 8341e8a..5c329a9 100644 --- a/code/fe310/eos/eve/screen/window.c +++ b/code/fe310/eos/eve/screen/window.c @@ -17,22 +17,32 @@ void eve_window_init(EVEWindow *window, EVERect *g, EVEView *view, EVEScreen *sc window->screen = screen; } -void eve_window_get_visible(EVEWindow *window, EVERect *g) { +int eve_window_visible(EVEWindow *window) { + if (window->g.x >= window->screen->w) return 0; + if (window->g.y >= window->screen->h) return 0; + if ((window->g.x + window->g.w) <= 0) return 0; + if ((window->g.y + window->g.h) <= 0) return 0; + return 1; +} + +void eve_window_visible_g(EVEWindow *window, EVERect *g) { EVEWindow *w = window->next; *g = window->g; while (w) { - if (w->g.x > g->x) g->w = MIN(g->w, w->g.x - g->x); - if (w->g.y > g->y) g->h = MIN(g->h, w->g.y - g->y); - if (w->g.x + w->g.w < g->x + g->w) { - uint16_t x0 = g->w - MIN(g->w, (g->x + g->w) - (w->g.x + w->g.w)); - g->x += x0; - g->w -= x0; - } - if (w->g.y + w->g.h < g->y + g->h) { - uint16_t y0 = g->h - MIN(g->h, (g->y + g->h) - (w->g.y + w->g.h)); - g->y += y0; - g->h -= y0; + if (eve_window_visible(w)) { + if (w->g.x > g->x) g->w = MIN(g->w, w->g.x - g->x); + if (w->g.y > g->y) g->h = MIN(g->h, w->g.y - g->y); + if (w->g.x + w->g.w < g->x + g->w) { + uint16_t x0 = g->w - MIN(g->w, (g->x + g->w) - (w->g.x + w->g.w)); + g->x += x0; + g->w -= x0; + } + if (w->g.y + w->g.h < g->y + g->h) { + uint16_t y0 = g->h - MIN(g->h, (g->y + g->h) - (w->g.y + w->g.h)); + g->y += y0; + g->h -= y0; + } } w = w->next; } diff --git a/code/fe310/eos/eve/screen/window.h b/code/fe310/eos/eve/screen/window.h index f3a1c77..78aabde 100644 --- a/code/fe310/eos/eve/screen/window.h +++ b/code/fe310/eos/eve/screen/window.h @@ -18,4 +18,5 @@ typedef struct EVEWindow { } EVEWindow; void eve_window_init(EVEWindow *window, EVERect *g, EVEView *view, EVEScreen *screen); -void eve_window_get_visible(EVEWindow *window, EVERect *g); +int eve_window_visible(EVEWindow *window); +void eve_window_visible_g(EVEWindow *window, EVERect *g); -- cgit v1.2.3