From 9347a5db9e0b6fb586fb4a4eb83d6f127a046aa8 Mon Sep 17 00:00:00 2001 From: Jaime Thomas Date: Fri, 31 Oct 2008 14:54:37 +0000 Subject: [PATCH] Get rid of ewl in the erase page... overcomplicating things with its usage. --- .../data/themes/default/groups/erase_disc.edc | 90 ++++++++++--- experimental/ecdb/trunk/src/ecdb_gui.c | 126 +++++++++--------- 2 files changed, 135 insertions(+), 81 deletions(-) diff --git a/experimental/ecdb/trunk/data/themes/default/groups/erase_disc.edc b/experimental/ecdb/trunk/data/themes/default/groups/erase_disc.edc index d60c056a..925a19ca 100644 --- a/experimental/ecdb/trunk/data/themes/default/groups/erase_disc.edc +++ b/experimental/ecdb/trunk/data/themes/default/groups/erase_disc.edc @@ -10,22 +10,6 @@ group { description { state: "default" 0.0; color: 0 0 0 0; - - rel1 { - relative: 0.0 0.0; - offset: -10 -10; - } - - rel2 { - relative: 0.0 0.0; - offset: 1 1; - } - } - - description { - state: "visible" 0.0; - visible: 1; - color: 0 0 0 0; rel1 { relative: 0.0 0.0; @@ -38,35 +22,99 @@ group { } } + description { + state: "before_show" 0.0; + color: 0 0 0 0; + + rel1 { + relative: 0.0 0.0; + offset: -33 -33; + } + + rel2 { + relative: 0.0 0.0; + offset: -1 -1; + } + } + description { state: "hide" 0.0; color: 0 0 0 0; rel1 { relative: 1.0 1.0; - offset: 1 1; + offset: -1 -1; } rel2 { relative: 1.0 1.0; - offset: 10 10; + offset: 33 33; } } } part { - name: "action_area"; + name: "ecdb/erase/return"; type: SWALLOW; + repeat_events: 1; + + description { + state: "default" 0.0; + + rel1 { + to: "bg"; + relative: 0.5 0.0; + offset: 10 10; + } + + rel2 { + to: "bg"; + relative: 1.0 0.3; + offset: -11 -11; + } + } + } + + part { + name: "ecdb/erase/begin"; + type: SWALLOW; + repeat_events: 1; description { state: "default" 0.0; rel1 { to: "bg"; + relative: 0.5 0.3; + offset: 10 10; } rel2 { to: "bg"; + relative: 1.0 0.6; + offset: -11 -11; + } + } + } + + part { + name: "ecdb/erase/speed"; + type: SWALLOW; + repeat_events: 1; + + description { + state: "default" 0.0; + + rel1 { + to: "bg"; + relative: 0.5 0.6; + offset: 10 10; + } + + rel2 { + to: "bg"; + relative: 1.0 0.9; + offset: -11 -11; } } } @@ -78,14 +126,14 @@ group { name: "erase_page,visible1"; signal: "ecdb,erase_page,visible"; source: "ecdb"; - action: STATE_SET "default" 0.0; + action: STATE_SET "before_show" 0.0; target: "bg"; after: "erase_page,visible2"; } program { name: "erase_page,visible2"; - action: STATE_SET "visible" 0.0; + action: STATE_SET "default" 0.0; target: "bg"; transition: DECELERATE 0.5; } diff --git a/experimental/ecdb/trunk/src/ecdb_gui.c b/experimental/ecdb/trunk/src/ecdb_gui.c index 211f777b..5b3b033e 100644 --- a/experimental/ecdb/trunk/src/ecdb_gui.c +++ b/experimental/ecdb/trunk/src/ecdb_gui.c @@ -1,13 +1,14 @@ #include "ecdb.h" static void ecdb_handle_typebuf(Evas_Object *gui); -static void ecdb_cb_welcome_page_buttons_focused(void *data, Evas_Object *o, +static void ecdb_cb_buttons_focused(void *data, Evas_Object *o, const char *emission, const char *source); static void ecdb_cb_welcome_page_buttons_clicked(void *data, Evas_Object *o, const char *emission, const char *source); +static void ecdb_cb_erase_page_buttons_clicked(void *data, Evas_Object *o, + const char *emission, const char *source); static void ecdb_cb_page_hide_finished(void *data, Evas_Object *o, const char *emission, const char *source); -static void ecdb_cb_return_main(Ewl_Widget *w, void *ev_data, void *data); static void ecdb_filelist_show(void); static void ecdb_welcome_page_show(void); static void ecdb_erase_page_show(void); @@ -292,7 +293,7 @@ ecdb_handle_typebuf(Evas_Object *gui) static void -ecdb_cb_welcome_page_buttons_focused(void *data, Evas_Object *o, +ecdb_cb_buttons_focused(void *data, Evas_Object *o, const char *emission, const char *source) { static char *old_source; @@ -339,6 +340,35 @@ ecdb_cb_welcome_page_buttons_clicked(void *data, Evas_Object *o, printf("Action: %s\n", source); } +static void +ecdb_cb_erase_page_buttons_clicked(void *data, Evas_Object *o, + const char *emission, const char *source) +{ + Evas_Object *swallow, *gui; + + gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui"); + swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), + "erase_page"); + if (!strcmp(source, "ecdb/erase/return")) + { + char *signal; + + signal = evas_object_data_get(swallow, "hide_signal"); + edje_object_signal_emit(swallow, signal, "ecdb"); + ecdb_welcome_page_show(); + } + else if (!strcmp(source, "ecdb/erase/begin")) + { + + } + else if (!strcmp(source, "ecdb/erage/speed")) + { + + } + + printf("Action: %s\n", source); +} + static void ecdb_welcome_page_show(void) { @@ -362,7 +392,7 @@ ecdb_welcome_page_show(void) evas_object_resize(swallow, w, h); edje_object_part_swallow(gui, "action_area", swallow); edje_object_signal_callback_add(swallow, "mouse,down,1", - "ecdb/*", ecdb_cb_welcome_page_buttons_focused, + "ecdb/*", ecdb_cb_buttons_focused, NULL); edje_object_signal_callback_add(swallow, "mouse,clicked,1", "ecdb/*", ecdb_cb_welcome_page_buttons_clicked, @@ -496,8 +526,6 @@ ecdb_erase_page_show(void) if (!swallow) { - Ewl_Widget *embed, *box, *b, *c; - Evas_Object *ewl_swallow; Evas_Coord x, y, w, h; swallow = edje_object_add(ecore_evas_get(em->main_win_ee)); @@ -512,52 +540,42 @@ ecdb_erase_page_show(void) evas_object_resize(swallow, w, h); edje_object_part_swallow(gui, "action_area", swallow); evas_object_show(swallow); - - embed = ewl_embed_new(); - ewl_object_fill_policy_set(EWL_OBJECT(embed), - EWL_FLAG_FILL_ALL); - ewl_swallow = ewl_embed_canvas_set(EWL_EMBED(embed), - ecore_evas_get(em->main_win_ee), - (void *)(long)ecore_evas_software_x11_window_get - (em->main_win_ee)); - ewl_embed_focus_set(EWL_EMBED(embed), TRUE); - ewl_widget_show(embed); - - box = ewl_vbox_new(); - ewl_container_child_append(EWL_CONTAINER(embed), box); - ewl_object_fill_policy_set(EWL_OBJECT(box), - EWL_FLAG_FILL_SHRINKABLE); - ewl_widget_show(box); - - b = ewl_button_new(); - ewl_button_label_set(EWL_BUTTON(b), "Return"); - ewl_container_child_append(EWL_CONTAINER(box), b); - ewl_callback_append(b, EWL_CALLBACK_CLICKED, - ecdb_cb_return_main, swallow); - ewl_widget_show(b); - - b = ewl_button_new(); - ewl_button_label_set(EWL_BUTTON(b), "Erase"); - ewl_container_child_append(EWL_CONTAINER(box), b); - ewl_widget_show(b); - - c = ewl_checkbutton_new(); - ewl_button_label_set(EWL_BUTTON(c), "Quick Erase?"); - ewl_container_child_append(EWL_CONTAINER(box), c); - ewl_widget_show(c); - - evas_object_name_set(ewl_swallow, "ewl_erase_page"); - edje_object_part_geometry_get(swallow, "active_area", - &x, &y, &w, &h); - evas_object_move(ewl_swallow, x, y); - evas_object_resize(ewl_swallow, w, h); - edje_object_part_swallow(swallow, "action_area", ewl_swallow); + edje_object_signal_callback_add(swallow, "mouse,down,1", + "ecdb/*", ecdb_cb_buttons_focused, + NULL); + edje_object_signal_callback_add(swallow, "mouse,clicked,1", + "ecdb/erase/*", + ecdb_cb_erase_page_buttons_clicked, NULL); edje_object_signal_callback_add(swallow, "hide,finished", "erase_page", ecdb_cb_page_hide_finished, NULL); - evas_object_show(ewl_swallow); - + evas_object_show(swallow); + int i; + char *labels[] = {"Return to Main Page", "Start Erase", + "Quick Erase"}; + char *ids[] = {"ecdb/erase/return", "ecdb/erase/begin", + "ecdb/erase/speed"}; + char *wtype[] = {"ecdb/button", "ecdb/button", "ecdb/check"}; + + for (i = 0; i < 3; i++) + { + Evas_Object *b; + b = edje_object_add(ecore_evas_get(em->main_win_ee)); + evas_object_name_set(b, ids[i]); + edje_object_file_set(b, em->theme_path, wtype[i]); + edje_object_part_geometry_get(swallow, ids[i], &x, + &y, &w, &h); + evas_object_move(b, x, y); + evas_object_resize(b, w, h); + edje_object_part_text_set(b, "label", labels[i]); + edje_object_part_swallow(swallow, ids[i], b); + evas_object_show(b); + + if (!strcmp("ecdb/button", wtype[i])) + ecdb_button_icon_swallow(ecore_evas_get( + em->main_win_ee), b, ids[i]); + } } else if (edje_object_part_swallow_get(gui, "action_area") != swallow) @@ -578,15 +596,3 @@ ecdb_cb_page_hide_finished(void *data, Evas_Object *o, const char *emission, ecdb_page_hide(source); } - -static void -ecdb_cb_return_main(Ewl_Widget *w, void *ev_data, void *data) -{ - Evas_Object *swallow = data; - char *signal; - - signal = evas_object_data_get(swallow, "hide_signal"); - edje_object_signal_emit(swallow, signal, "ecdb"); - ecdb_welcome_page_show(); -} -