1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#include <stdlib.h>
#include <dev/net.h>
#include <eve/eve.h>
#include <eve/eve_kbd.h>
#include <eve/eve_font.h>
#include <eve/screen/window.h>
#include <eve/screen/page.h>
#include <eve/screen/form.h>
#include "status.h"
#include "app.h"
#define KBD_X 0
#define KBD_Y 629
#define KBD_W 480
#define KBD_H 225
static EVEKbd kbd;
static EVEFont font;
static EVEWindowRoot win_root;
static EVEWindowKbd win_kbd;
static EVEWindow win_status;
static EVEWindow win_main;
static EVEView view_status;
static EVEViewStack view_stack;
EVEWindowRoot *app_root(void) {
return &win_root;
}
EVEViewStack *app_stack(void){
return &view_stack;
}
EVEFont *app_font(void) {
return &font;
}
void app_refresh(void) {
eve_select();
eve_window_root_draw(app_root());
eve_deselect();
}
EVEView *app_search_view(char *name) {
EVEWindow *win = eve_window_search(&win_root.w, name);
if (win) return win->view;
return NULL;
}
eve_view_constructor_t app_current_view(void) {
return eve_stack_get(&view_stack);
}
void app_init(eve_view_constructor_t home_page, int b) {
EVERect g;
eve_select();
if (b >= 0) eve_brightness(b);
eve_font_init(&font, APP_FONT_HANDLE);
g.x = 0;
g.y = 0;
g.w = APP_SCREEN_W;
g.h = APP_SCREEN_H;
eve_window_init_root(&win_root, &g, "root", &font);
g.x = KBD_X;
g.y = KBD_Y;
g.w = KBD_W;
g.h = KBD_H;
eve_kbd_init(&kbd, &g, win_root.mem_next, &win_root.mem_next);
eve_window_init_kbd(&win_kbd, &g, &win_root, "kbd", &kbd);
g.x = 0;
g.y = 0;
g.w = APP_SCREEN_W;
g.h = APP_STATUS_H;
eve_window_init(&win_status, &g, (EVEWindow *)&win_root, "status");
app_status_init(&view_status, &win_status);
g.x = 0;
g.y = APP_STATUS_H;
g.w = APP_SCREEN_W;
g.h = APP_SCREEN_H - APP_STATUS_H;
eve_window_init(&win_main, &g, (EVEWindow *)&win_root, "main");
eve_stack_init(&view_stack);
eve_stack_create_view(&view_stack, &win_main, home_page);
eve_window_append(&win_status);
eve_window_append(&win_main);
eve_window_root_draw(&win_root);
eve_deselect();
eos_net_acquire_for_evt(EOS_EVT_EVE | EVE_ETYPE_INTR, 1);
// eos_net_acquire_for_evt(EOS_EVT_TIMER | EOS_TIMER_ETYPE_EVE, 1);
}
|