From daa87d92b3df433578e53284a8c88083e24f8623 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sat, 27 Mar 2021 22:08:31 +0100 Subject: form/app cleanup; scroll infrastructure --- fw/fe310/eos/app/Makefile | 2 +- fw/fe310/eos/app/app_form.c | 85 ------------------------------------------- fw/fe310/eos/app/app_form.h | 6 --- fw/fe310/eos/app/app_root.c | 6 +-- fw/fe310/eos/app/app_root.h | 2 +- fw/fe310/eos/app/app_status.c | 2 +- 6 files changed, 6 insertions(+), 97 deletions(-) delete mode 100644 fw/fe310/eos/app/app_form.c delete mode 100644 fw/fe310/eos/app/app_form.h (limited to 'fw/fe310/eos/app') 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 - -#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; ilabel) 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; ig.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 - -#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) { -- cgit v1.2.3