summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/app/app_form.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-03-25 19:58:43 +0100
committerUros Majstorovic <majstor@majstor.org>2021-03-25 19:58:43 +0100
commit58232586e1ed65fc8a8e382796628aa087b5dc4c (patch)
treea2a174228ad0b217369820750a6c1d4f087d8d7b /fw/fe310/eos/app/app_form.c
parent95f69d4f83ad8f7fbb56349f29e902928510362b (diff)
uievt added to view
Diffstat (limited to 'fw/fe310/eos/app/app_form.c')
-rw-r--r--fw/fe310/eos/app/app_form.c26
1 files changed, 7 insertions, 19 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();
-}