summaryrefslogtreecommitdiff
path: root/code/fe310/eos/eve/screen
diff options
context:
space:
mode:
Diffstat (limited to 'code/fe310/eos/eve/screen')
-rw-r--r--code/fe310/eos/eve/screen/form.c24
-rw-r--r--code/fe310/eos/eve/screen/page.c2
-rw-r--r--code/fe310/eos/eve/screen/screen.c20
-rw-r--r--code/fe310/eos/eve/screen/screen.h9
-rw-r--r--code/fe310/eos/eve/screen/window.c34
-rw-r--r--code/fe310/eos/eve/screen/window.h3
6 files changed, 53 insertions, 39 deletions
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; i<form->widget_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; i<tagN; i++) {
+ eve_touch_set_opt(i, eve_touch_get_opt(i) | EVE_TOUCH_OPT_TRACK | EVE_TOUCH_OPT_TRACK_XY | EVE_TOUCH_OPT_TRACK_EXT);
+ }
+
+ return tagN;
}
diff --git a/code/fe310/eos/eve/screen/page.c b/code/fe310/eos/eve/screen/page.c
index 66c7c13..fbd9327 100644
--- a/code/fe310/eos/eve/screen/page.c
+++ b/code/fe310/eos/eve/screen/page.c
@@ -23,7 +23,7 @@ void eve_page_init(EVEPage *page, eve_view_touch_t touch, eve_view_draw_t draw,
void eve_page_focus(EVEPage *page, EVERect *f) {
EVERect g;
- eve_window_get_visible(page->window, &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);