summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/app
diff options
context:
space:
mode:
Diffstat (limited to 'fw/fe310/eos/app')
-rw-r--r--fw/fe310/eos/app/app_form.c26
-rw-r--r--fw/fe310/eos/app/app_form.h2
-rw-r--r--fw/fe310/eos/app/app_root.c8
-rw-r--r--fw/fe310/eos/app/app_root.h2
-rw-r--r--fw/fe310/eos/app/app_status.c3
5 files changed, 15 insertions, 26 deletions
diff --git a/fw/fe310/eos/app/app_form.c b/fw/fe310/eos/app/app_form.c
index 5d59833..8daf09e 100644
--- a/fw/fe310/eos/app/app_form.c
+++ b/fw/fe310/eos/app/app_form.c
@@ -1,7 +1,5 @@
#include <stdlib.h>
-#include "unicode.h"
-
#include "eve/eve.h"
#include "eve/eve_kbd.h"
#include "eve/eve_font.h"
@@ -14,8 +12,6 @@
#include "app_form.h"
-static EVEFont font;
-
static void widgets_destroy(EVEWidget *widget, uint16_t widget_size) {
int i;
@@ -31,7 +27,6 @@ EVEForm *app_form_create(EVEWindow *window, EVEViewStack *stack, EVEWidgetSpec s
EVEWidget *widget;
EVELabel *label;
EVEForm *form;
- EVEFont *_font;
int w_size = 0;
int i, r;
@@ -42,6 +37,8 @@ EVEForm *app_form_create(EVEWindow *window, EVEViewStack *stack, EVEWidgetSpec s
if (form == NULL) {
return NULL;
}
+ if (destructor == NULL) destructor = app_form_destroy;
+ eve_form_init(form, window, stack, NULL, 0, action, destructor);
widgets = eve_malloc(w_size);
if (widgets == NULL) {
@@ -51,8 +48,7 @@ EVEForm *app_form_create(EVEWindow *window, EVEViewStack *stack, EVEWidgetSpec s
widget = widgets;
for (i=0; i<spec_size; i++) {
- _font = spec[i].widget.font ? spec[i].widget.font : &font;
- r = eve_widget_create(widget, spec[i].widget.type, &spec[i].widget.g, _font, &spec[i].widget.spec);
+ r = eve_widget_create(widget, spec[i].widget.type, &spec[i].widget.g, (EVEPage *)form, &spec[i].widget.spec);
if (r) {
widgets_destroy(widgets, i);
eve_free(widgets);
@@ -60,7 +56,7 @@ EVEForm *app_form_create(EVEWindow *window, EVEViewStack *stack, EVEWidgetSpec s
return NULL;
}
if (spec[i].label.title) {
- _font = spec[i].label.font ? spec[i].label.font : &font;
+ EVEFont *font = spec[i].label.font ? spec[i].label.font : eve_window_font(window);
label = eve_malloc(sizeof(EVELabel));
if (label == NULL) {
eve_widget_destroy(widget);
@@ -69,17 +65,15 @@ EVEForm *app_form_create(EVEWindow *window, EVEViewStack *stack, EVEWidgetSpec s
eve_free(form);
return NULL;
}
- eve_label_init(label, &spec[i].label.g, _font, spec[i].label.title);
+ eve_label_init(label, &spec[i].label.g, font, spec[i].label.title);
eve_widget_set_label(widget, label);
- if (label->g.w == 0) label->g.w = eve_font_str_w(_font, label->title);
+ if (label->g.w == 0) label->g.w = eve_font_str_w(font, label->title);
}
if (widget->label && (widget->label->g.w == 0)) eve_font_str_w(label->font, label->title) + APP_LABEL_MARGIN;
if (widget->g.w == 0) widget->g.w = window->g.w - (widget->label ? widget->label->g.w : 0);
widget = eve_widget_next(widget);
}
-
- if (destructor == NULL) destructor = app_form_destroy;
- eve_form_init(form, window, stack, widgets, spec_size, action, destructor);
+ eve_form_update(form, widgets, spec_size, NULL);
return form;
}
@@ -89,9 +83,3 @@ void app_form_destroy(EVEForm *form) {
eve_free(form->widget);
eve_free(form);
}
-
-void app_form_init(void) {
- eve_spi_start();
- eve_font_init(&font, APP_FONT_HANDLE);
- eve_spi_stop();
-}
diff --git a/fw/fe310/eos/app/app_form.h b/fw/fe310/eos/app/app_form.h
index 191e76d..ec0993c 100644
--- a/fw/fe310/eos/app/app_form.h
+++ b/fw/fe310/eos/app/app_form.h
@@ -1,8 +1,6 @@
#include <stdint.h>
-#define APP_FONT_HANDLE 31
#define APP_LABEL_MARGIN 10
EVEForm *app_form_create(EVEWindow *window, EVEViewStack *stack, EVEWidgetSpec spec[], uint16_t spec_size, eve_form_action_t action, eve_form_destructor_t destructor);
void app_form_destroy(EVEForm *form);
-void app_form_init(void); \ No newline at end of file
diff --git a/fw/fe310/eos/app/app_root.c b/fw/fe310/eos/app/app_root.c
index f30c8d4..7a6f5c3 100644
--- a/fw/fe310/eos/app/app_root.c
+++ b/fw/fe310/eos/app/app_root.c
@@ -1,7 +1,6 @@
#include <stdlib.h>
#include "net.h"
-#include "unicode.h"
#include "eve/eve.h"
#include "eve/eve_kbd.h"
@@ -22,6 +21,7 @@
#define KBD_H 225
static EVEKbd kbd;
+static EVEFont font;
static EVEWindowRoot win_root;
static EVEWindowKbd win_kbd;
static EVEWindow win_status;
@@ -46,11 +46,13 @@ void app_root_init(eve_view_constructor_t home_page) {
eve_brightness(0x40);
+ 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");
+ eve_window_init_root(&win_root, &g, "root", &font);
g.x = KBD_X;
g.y = KBD_Y;
@@ -64,7 +66,7 @@ void app_root_init(eve_view_constructor_t home_page) {
g.w = APP_SCREEN_W;
g.h = APP_STATUS_H;
eve_window_init(&win_status, &g, (EVEWindow *)&win_root, "status");
- eve_view_init(&view_status, &win_status, app_status_draw, app_status_touch, NULL);
+ eve_view_init(&view_status, &win_status, app_status_draw, app_status_touch, NULL, NULL);
g.x = 0;
g.y = APP_STATUS_H;
diff --git a/fw/fe310/eos/app/app_root.h b/fw/fe310/eos/app/app_root.h
index 2a51c77..a7907df 100644
--- a/fw/fe310/eos/app/app_root.h
+++ b/fw/fe310/eos/app/app_root.h
@@ -4,6 +4,8 @@
#define APP_SCREEN_H 800
#define APP_STATUS_H 60
+#define APP_FONT_HANDLE 31
+
EVEWindow *app_root(void);
void app_root_refresh(void);
diff --git a/fw/fe310/eos/app/app_status.c b/fw/fe310/eos/app/app_status.c
index 11cc36d..1d95728 100644
--- a/fw/fe310/eos/app/app_status.c
+++ b/fw/fe310/eos/app/app_status.c
@@ -1,9 +1,8 @@
#include <stdlib.h>
-#include "unicode.h"
-
#include "eve/eve.h"
#include "eve/eve_kbd.h"
+#include "eve/eve_font.h"
#include "eve/screen/window.h"