diff options
Diffstat (limited to 'fw/fe310/eos/app')
-rw-r--r-- | fw/fe310/eos/app/Makefile | 2 | ||||
-rw-r--r-- | fw/fe310/eos/app/app_form.c | 85 | ||||
-rw-r--r-- | fw/fe310/eos/app/app_form.h | 6 | ||||
-rw-r--r-- | fw/fe310/eos/app/app_root.c | 6 | ||||
-rw-r--r-- | fw/fe310/eos/app/app_root.h | 2 | ||||
-rw-r--r-- | fw/fe310/eos/app/app_status.c | 2 |
6 files changed, 6 insertions, 97 deletions
diff --git a/fw/fe310/eos/app/Makefile b/fw/fe310/eos/app/Makefile index 9560fd7..e0eee28 100644 --- a/fw/fe310/eos/app/Makefile +++ b/fw/fe310/eos/app/Makefile @@ -2,7 +2,7 @@ include ../../common.mk CFLAGS += -I.. -obj = app_root.o app_status.o app_form.o +obj = app_root.o app_status.o %.o: %.c %.h diff --git a/fw/fe310/eos/app/app_form.c b/fw/fe310/eos/app/app_form.c deleted file mode 100644 index 8daf09e..0000000 --- a/fw/fe310/eos/app/app_form.c +++ /dev/null @@ -1,85 +0,0 @@ -#include <stdlib.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 "eve/widget/widgets.h" - -#include "app_form.h" - -static void widgets_destroy(EVEWidget *widget, uint16_t widget_size) { - int i; - - for (i=0; i<widget_size; i++) { - if (widget->label) eve_free(widget->label); - eve_widget_destroy(widget); - widget = eve_widget_next(widget); - } -} - -EVEForm *app_form_create(EVEWindow *window, EVEViewStack *stack, EVEWidgetSpec spec[], uint16_t spec_size, eve_form_action_t action, eve_form_destructor_t destructor) { - EVEWidget *widgets; - EVEWidget *widget; - EVELabel *label; - EVEForm *form; - int w_size = 0; - int i, r; - - for (i=0; i<spec_size; i++) { - w_size += eve_widget_size(spec[i].widget.type); - } - form = eve_malloc(sizeof(EVEForm)); - 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) { - eve_free(form); - return NULL; - } - - widget = widgets; - for (i=0; i<spec_size; i++) { - 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); - eve_free(form); - return NULL; - } - if (spec[i].label.title) { - 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); - widgets_destroy(widgets, i); - eve_free(widgets); - eve_free(form); - return NULL; - } - 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 (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); - } - eve_form_update(form, widgets, spec_size, NULL); - - return form; -} - -void app_form_destroy(EVEForm *form) { - widgets_destroy(form->widget, form->widget_size); - eve_free(form->widget); - eve_free(form); -} diff --git a/fw/fe310/eos/app/app_form.h b/fw/fe310/eos/app/app_form.h deleted file mode 100644 index ec0993c..0000000 --- a/fw/fe310/eos/app/app_form.h +++ /dev/null @@ -1,6 +0,0 @@ -#include <stdint.h> - -#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); diff --git a/fw/fe310/eos/app/app_root.c b/fw/fe310/eos/app/app_root.c index 7a6f5c3..1b46ea8 100644 --- a/fw/fe310/eos/app/app_root.c +++ b/fw/fe310/eos/app/app_root.c @@ -29,8 +29,8 @@ static EVEWindow win_main; static EVEView view_status; static EVEViewStack view_stack; -EVEWindow *app_root(void) { - return (EVEWindow *)&win_root; +EVEWindowRoot *app_root(void) { + return &win_root; } void app_root_refresh(void) { @@ -80,7 +80,7 @@ void app_root_init(eve_view_constructor_t home_page) { eve_window_append(&win_status); eve_window_append(&win_main); - eve_window_root_draw((EVEWindow *)&win_root); + eve_window_root_draw(&win_root); eve_spi_stop(); diff --git a/fw/fe310/eos/app/app_root.h b/fw/fe310/eos/app/app_root.h index a7907df..7a44565 100644 --- a/fw/fe310/eos/app/app_root.h +++ b/fw/fe310/eos/app/app_root.h @@ -6,7 +6,7 @@ #define APP_FONT_HANDLE 31 -EVEWindow *app_root(void); +EVEWindowRoot *app_root(void); void app_root_refresh(void); void app_root_init(eve_view_constructor_t home_page); diff --git a/fw/fe310/eos/app/app_status.c b/fw/fe310/eos/app/app_status.c index 1d95728..4ab0a97 100644 --- a/fw/fe310/eos/app/app_status.c +++ b/fw/fe310/eos/app/app_status.c @@ -9,7 +9,7 @@ #include "app_status.h" uint8_t app_status_draw(EVEView *view, uint8_t tag0) { - return eve_view_clear(view, tag0); + return eve_view_clear(view, tag0, 0); } int app_status_touch(EVEView *view, EVETouch *touch, uint16_t evt, uint8_t tag0) { |