From fbcceab72ca633f548b8af85ff798419fb8185c7 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Tue, 14 Apr 2015 08:20:32 +0200 Subject: Use themed seperated, more comments Added some random 'TODO' comments and re-arranged some minor things. Also added a 'function pointer' for multiscreens. Signed-off-by: Olliver Schinagl --- src/eulogium.c | 45 ++++++++++----------------------------------- src/eulogium.h | 3 ++- 2 files changed, 12 insertions(+), 36 deletions(-) diff --git a/src/eulogium.c b/src/eulogium.c index 90fc1b2..2a7af90 100644 --- a/src/eulogium.c +++ b/src/eulogium.c @@ -101,21 +101,10 @@ Evas_Object *eulogium_split_screen(Evas_Object *parent, Evas_Object *top, Evas_O evas_object_size_hint_weight_set(top, 0, 48); elm_box_pack_end(box, top); -#if 0 /* FIXME use themed seperator */ - object = elm_separator_add(eulogium->navi); + object = elm_separator_add(box); elm_separator_horizontal_set(object, EINA_TRUE); evas_object_show(object); - elm_table_pack(table, object, 1, 5, 1, 1); -#else - object = evas_object_rectangle_add(evas_object_evas_get(parent)); - evas_object_color_set(object, 0x33, 0x99, 0xff, 0xff); - evas_object_size_hint_min_set(object, 1, 0); - evas_object_size_hint_padding_set(object, 3, 6, 1, 1); - evas_object_size_hint_align_set(object, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(object, 0, 2); - evas_object_show(object); elm_box_pack_end(box, object); -#endif evas_object_size_hint_align_set(bottom, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(bottom, 0, 14); @@ -172,20 +161,10 @@ elm_progressbar_value_set(eulogium->print.progress, 0.5); evas_object_show(eulogium->print.progress); elm_table_pack(table, eulogium->print.progress, 0, 3, 3, 1); -#if 0 /* FIXME use themed seperator */ object = elm_separator_add(eulogium->navi); elm_separator_horizontal_set(object, EINA_TRUE); evas_object_show(object); elm_table_pack(table, object, 0, 4, 3, 1); -#else - object = evas_object_rectangle_add(evas_object_evas_get(eulogium->navi)); - evas_object_color_set(object, 0x33, 0x99, 0xff, 0xff); - evas_object_size_hint_min_set(object, 0, 1); - evas_object_size_hint_padding_set(object, 1, 1, 1, 1); - evas_object_size_hint_align_set(object, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_show(object); - elm_table_pack(table, object, 0, 4, 3, 1); -#endif object = elm_button_add(table); elm_object_text_set(object, "TUNE"); /* create tune button */ @@ -193,20 +172,10 @@ elm_progressbar_value_set(eulogium->print.progress, 0.5); evas_object_show(object); elm_table_pack(table, object, 0, 5, 1, 1); -#if 0 /* FIXME use themed seperator */ object = elm_separator_add(eulogium->navi); elm_separator_horizontal_set(object, EINA_TRUE); evas_object_show(object); elm_table_pack(table, object, 1, 5, 1, 1); -#else - object = evas_object_rectangle_add(evas_object_evas_get(eulogium->navi)); - evas_object_color_set(object, 0x33, 0x99, 0xff, 0xff); - evas_object_size_hint_min_set(object, 1, 0); - evas_object_size_hint_padding_set(object, 1, 1, 1, 1); - evas_object_size_hint_align_set(object, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_show(object); - elm_table_pack(table, object, 1, 5, 1, 1); -#endif object = elm_button_add(table); elm_object_text_set(object, "PAUSE"); /* create pause button */ @@ -520,7 +489,7 @@ static void _cb_material_set(void *data, Evas_Object *obj EINA_UNUSED, void *eve printf("Material: %s selected\n", (char *)data); } -Evas_Object *eulogium_multi_screen_menu(struct eulogium_data *eulogium, Evas_Object *parent, struct multi_screen_data *screen_data, uint_fast8_t pagenum, Eina_Bool pageindex) +Evas_Object *eulogium_multi_screen_menu(struct eulogium_data *eulogium, Evas_Object *parent, struct multi_screen_data *screen_data, uint_fast8_t pagenum, Eina_Bool pageindex) /* TODO swap parent/eulogium */ { Evas_Object *object; Evas_Object *_top, *_bottom; @@ -543,6 +512,7 @@ Evas_Object *eulogium_multi_screen_menu(struct eulogium_data *eulogium, Evas_Obj snprintf(buf, sizeof(buf), "%d/%d", pagenum + 1, screen_data->count); elm_object_text_set(object, buf); evas_object_show(object); + evas_object_size_hint_weight_set(object, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(object, 1.0, 0); elm_box_pack_end(_top, object); } @@ -550,6 +520,7 @@ Evas_Object *eulogium_multi_screen_menu(struct eulogium_data *eulogium, Evas_Obj if (screen_data->screen[pagenum].text) { object = elm_label_add(_top); elm_object_text_set(object, screen_data->screen[pagenum].text); + evas_object_size_hint_align_set(object, 0.5, 0.5); evas_object_show(object); elm_box_pack_end(_top, object); } @@ -798,6 +769,7 @@ static struct multi_screen screen[] = { { .type = NONE, .text = "Welcome
to your new Ultimaker", + .func = NULL, .data = NULL, .prev_button = "Skip Wizzard!", .next_button = "Continue", @@ -805,6 +777,7 @@ static struct multi_screen screen[] = { { .type = MATERIAL, .text = "Choose material", + .func = NULL, .data = NULL, .prev_button = "Skip Wizzard!", .next_button = "Continue", @@ -812,6 +785,7 @@ static struct multi_screen screen[] = { { .type = FUNC, .text = "Level bed", + .func = NULL, .data = "Bed leveling call", .prev_button = "Skip Wizzard!", .next_button = "Continue", @@ -819,6 +793,7 @@ static struct multi_screen screen[] = { { .type = PROGRESS, .text = "Heating ...", + .func = NULL, .data = "progress object", .prev_button = "Skip Wizzard!", .next_button = "Continue", @@ -826,6 +801,7 @@ static struct multi_screen screen[] = { { .type = NONE, .text = "Lets print!", + .func = NULL, .data = NULL, .prev_button = NULL, .next_button = "Let's Print!", @@ -944,6 +920,7 @@ EAPI_MAIN int elm_main(int argc, char **argv) #if (ELM_VERSION_MAJOR > 1) || (ELM_VERSION_MINOR >= 10) elm_config_accel_preference_set("accel"); #endif + elm_theme_overlay_add(NULL, "./default.edj"); #if 0 /* TODO make icon */ icon = evas_object_image_add(evas_object_evas_get(win)); @@ -958,7 +935,6 @@ EAPI_MAIN int elm_main(int argc, char **argv) if (!window) return EXIT_FAILURE; elm_win_title_set(window, PACKAGE_NAME); - evas_object_resize(window, 128, 64); evas_object_repeat_events_set(window, EINA_TRUE); elm_win_autodel_set(window, EINA_TRUE); evas_object_smart_callback_add(window, "delete,request", _cb_eulogium_exit, NULL); @@ -967,7 +943,6 @@ EAPI_MAIN int elm_main(int argc, char **argv) object = elm_bg_add(window); if (!object) return EXIT_FAILURE; - elm_bg_color_set(object, 0, 0, 0); evas_object_size_hint_weight_set(object, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(object, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_win_resize_object_add(window, object); diff --git a/src/eulogium.h b/src/eulogium.h index 72b09bc..fdfc8b3 100644 --- a/src/eulogium.h +++ b/src/eulogium.h @@ -11,7 +11,7 @@ enum screen_type { FUNC, MATERIAL, PROGRESS, - END, /* sentinel */ + END, /* last screen */ }; struct print_data { @@ -50,6 +50,7 @@ struct multi_text { struct multi_screen { enum screen_type type; char *text; + void (*func)(void *data); void *data; char *prev_button; char *next_button; -- cgit v0.12