From 676d7ee77ec9aa122852c69c27048879b104d882 Mon Sep 17 00:00:00 2001 From: Jaime Thomas Date: Sat, 21 Feb 2009 01:23:34 +0000 Subject: [PATCH] The config dialog is now accessable. A bit more work done on the slide_in tab, but it still a bit glitchy. --- .../data/themes/default/groups/window.edc | 91 +++++-- .../data/themes/default/images/icon_about.png | Bin 0 -> 5520 bytes .../data/themes/default/images/images.edc | 1 + experimental/ecdb/trunk/src/ecdb.c | 7 + .../ecdb/trunk/src/ecdb_config_dialog.c | 237 ++++++++++++++---- experimental/ecdb/trunk/src/ecdb_gui.c | 16 +- 6 files changed, 292 insertions(+), 60 deletions(-) create mode 100644 experimental/ecdb/trunk/data/themes/default/images/icon_about.png diff --git a/experimental/ecdb/trunk/data/themes/default/groups/window.edc b/experimental/ecdb/trunk/data/themes/default/groups/window.edc index 65890901..b293cdb9 100644 --- a/experimental/ecdb/trunk/data/themes/default/groups/window.edc +++ b/experimental/ecdb/trunk/data/themes/default/groups/window.edc @@ -4,12 +4,14 @@ group { min: 640 390; script { - public settings_time_id = 0; - const Float:show_timeout = 1.0; + public settings_time_id; + public in_transition; + const Float:show_timeout = 1.5; public show_settings(val) { + set_int(in_transition, 1); run_program(PROGRAM:"settings,show"); - run_program(PROGRAM:"about_icon,show"); + run_program(PROGRAM:"icons,show"); if (get_int(settings_time_id) != 0) { cancel_timer(get_int(settings_time_id)); } @@ -374,8 +376,8 @@ group { description { state: "visible" 0.0; inherit: "default" 0.0; - min: 72 72; - max: 72 72; + min: 140 72; + max: 140 72; color: 0 0 0 128; } } @@ -392,6 +394,47 @@ group { min: 0 0; max: 0 0; color: 255 255 255 0; + align: 0.0 0.0; + + rel1 { + to: "config_icon"; + relative: 1.0 0.0; + offset: 4 4; + } + + rel2 { + to: "config_icon"; + relative: 1.0 1.0; + offset: -5 -5; + } + + image { + normal: "icon_about.png"; + } + } + + description { + state: "visible" 0.0; + inherit: "default" 0.0; + min: 64 64; + max: 64 64; + color: 255 255 255 255; + } + } + + part { + name: "config_icon"; + type: IMAGE; + mouse_events: 1; + repeat_events: 1; + scale: 1; + + description { + state: "default" 0.0; + min: 0 0; + max: 0 0; + color: 255 255 255 0; + align: 0.0 0.0; rel1 { to: "settings_tab"; @@ -418,6 +461,7 @@ group { color: 255 255 255 255; } } + } programs { @@ -433,8 +477,6 @@ group { program { name: "settings,deactivate"; - signal: "mouse,out"; - source: "settings_tab"; action: STATE_SET "default" 0.0; target: "settings_tab"; transition: DECELERATE 0.3; @@ -445,40 +487,61 @@ group { signal: "mouse,out"; source: "settings_tab"; script { - run_program(PROGRAM:"about_icon,hide"); - if (get_int(settings_time_id) != 0) { - cancel_timer(get_int(settings_time_id)); - set_int(settings_time_id, 0); + if (!get_int(in_transition)) + { + run_program(PROGRAM:"settings,deactivate") + run_program(PROGRAM:"icons,hide"); + if (get_int(settings_time_id) != 0) { + cancel_timer(get_int(settings_time_id)); + set_int(settings_time_id, 0); + } } } } program { - name: "about_icon,hide"; + name: "icons,hide"; action: STATE_SET "default" 0.0; target: "about_icon"; + target: "config_icon"; transition: DECELERATE 0.3; } program { - name: "about_icon,show"; + name: "icons,show"; action: STATE_SET "visible" 0.0; target: "about_icon"; + target: "config_icon"; transition: DECELERATE 0.3; } program { - name: "icon,clicked"; + name: "about_icon,clicked"; signal: "mouse,clicked,1"; source: "about_icon"; action: SIGNAL_EMIT "ecdb/about/show" "ecdb"; } + program { + name: "config_icon,clicked"; + signal: "mouse,clicked,1"; + source: "config_icon"; + action: SIGNAL_EMIT "ecdb/config/show" "ecdb"; + } + program { name: "settings,show"; action: STATE_SET "visible" 0.0; target: "settings_tab"; transition: DECELERATE 0.3; + after: "settings,after"; + } + + program { + name: "settings,after"; + script { + set_int(in_transition, 0); + } } program { diff --git a/experimental/ecdb/trunk/data/themes/default/images/icon_about.png b/experimental/ecdb/trunk/data/themes/default/images/icon_about.png new file mode 100644 index 0000000000000000000000000000000000000000..d9a0dfd55f6b0a772efc677b20af42927a0f7532 GIT binary patch literal 5520 zcmWky2R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Pya2t{T~0(EowcSeX#h})clIq<_${nT3>u?9#k{$uy`_Fpgn4cu2#3ax_0x8OzWt#pT;zQIw=awRn7$!H(o*(Z +#include static void destroy_cb(Ewl_Widget *w, void *event, void *data); static void conf_clicked_cb(Ewl_Widget *w, void *event, void *data); @@ -14,12 +9,15 @@ static void scale_cb(Ewl_Widget *w, void *event, void *data); static void fps_cb(Ewl_Widget *w, void *event, void *data); static void engine_cb(Ewl_Widget *w, void *event, void *data); static void theme_cb(Ewl_Widget *w, void *event, void *data); -static Config_Data *theme_data_init(void); -static Config_Data *engine_data_init(void); -static int theme_data_return_active(Config_Data *data); -static int engine_data_return_active(Config_Data *data); +static void combo_cb(Ewl_Widget *w, void *event, void *data); +static void use_scale_cb(Ewl_Widget *w, void *event, void *data); +static Eina_List *theme_data_init(void); +static Eina_List *engine_data_init(void); +static int theme_data_return_active(Eina_List *data); +static int engine_data_return_active(Eina_List *data); static unsigned int model_data_count(void *data); static void *model_data_fetch(void *data, unsigned int row, unsigned int col); +static char *theme_cut_suffix(const char *file); static Ewl_Widget *conf_win = NULL; @@ -31,7 +29,8 @@ ecdb_config_dialog_show(void) Ewl_Widget *combo; Ewl_Model *model; Ewl_View *view; - Config_Data *data; + Eina_List *data; + int use_scale; /* Only show one config window */ if (conf_win) @@ -53,7 +52,7 @@ ecdb_config_dialog_show(void) ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_TOP); main_box = ewl_vbox_new(); ewl_container_child_append(EWL_CONTAINER(conf_win), main_box); - ewl_object_fill_policy_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_CENTER); + ewl_object_fill_policy_set(EWL_OBJECT(main_box), EWL_FLAG_FILL_HSHRINKABLE); ewl_widget_show(main_box); /* Setup and show the stock icons */ @@ -102,20 +101,35 @@ ecdb_config_dialog_show(void) ewl_object_fill_policy_set(EWL_OBJECT(l), EWL_FLAG_FILL_NONE); ewl_widget_show(l); + use_scale = ecore_config_boolean_get("use_scale"); + o = ewl_hseeker_new(); ewl_range_minimum_value_set(EWL_RANGE(o), 0.0); ewl_range_maximum_value_set(EWL_RANGE(o), 2.0); - ewl_range_step_set(EWL_RANGE(o), 0.1); + ewl_range_step_set(EWL_RANGE(o), 0.25); ewl_range_value_set(EWL_RANGE(o), em->scalef); ewl_container_child_append(EWL_CONTAINER(border_box), o); ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, scale_cb, l); - scale_cb(o, NULL, NULL); + if (!use_scale) + ewl_widget_disable(o); + scale_cb(o, NULL, l); ewl_widget_show(o); + // Store this widget as we use it as a parameter later + l = o; + + o = ewl_checkbutton_new(); + ewl_button_label_set(EWL_BUTTON(o), "Use scaling?"); + ewl_container_child_append(EWL_CONTAINER(border_box), o); + ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT); + ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), use_scale); + ewl_widget_show(o); + ewl_callback_append(o, EWL_CALLBACK_CLICKED, use_scale_cb, l); + /* FPS */ hbox = ewl_grid_new(); ewl_container_child_append(EWL_CONTAINER(border_box), hbox); - ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_FILL); + ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL); ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 1); ewl_widget_show(hbox); @@ -134,18 +148,18 @@ ecdb_config_dialog_show(void) o = ewl_hseeker_new(); ewl_range_minimum_value_set(EWL_RANGE(o), 10.0); ewl_range_maximum_value_set(EWL_RANGE(o), 100.0); - ewl_range_step_set(EWL_RANGE(o), 5.0); + ewl_range_step_set(EWL_RANGE(o), 15.0); ewl_range_value_set(EWL_RANGE(o), em->fps); ewl_container_child_append(EWL_CONTAINER(border_box), o); ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, fps_cb, l); - fps_cb(o, NULL, NULL); + fps_cb(o, NULL, l); ewl_widget_show(o); /* Setup and show the border box */ border_box = ewl_border_new(); ewl_border_label_set(EWL_BORDER(border_box), "Rendering Engine"); ewl_container_child_append(EWL_CONTAINER(main_box), border_box); - ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_FILL); + ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_NORMAL); ewl_object_alignment_set(EWL_OBJECT(border_box), EWL_FLAG_ALIGN_CENTER); ewl_object_alignment_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_TOP); ewl_widget_show(border_box); @@ -161,6 +175,7 @@ ecdb_config_dialog_show(void) combo = ewl_combo_new(); ewl_container_child_append(EWL_CONTAINER(border_box), combo); ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED, engine_cb, NULL); + ewl_callback_append(combo, EWL_CALLBACK_DESTROY, combo_cb, data); ewl_mvc_model_set(EWL_MVC(combo), model); ewl_mvc_view_set(EWL_MVC(combo), view); ewl_mvc_data_set(EWL_MVC(combo), data); @@ -182,6 +197,7 @@ ecdb_config_dialog_show(void) combo = ewl_combo_new(); ewl_container_child_append(EWL_CONTAINER(border_box), combo); ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED, theme_cb, NULL); + ewl_callback_append(combo, EWL_CALLBACK_DESTROY, combo_cb, data); ewl_mvc_model_set(EWL_MVC(combo), model); ewl_mvc_view_set(EWL_MVC(combo), view); ewl_mvc_data_set(EWL_MVC(combo), data); @@ -225,95 +241,228 @@ scale_cb(Ewl_Widget *w, void *event __UNUSED__, void *data) value = ewl_range_value_get(EWL_RANGE(w)); ecore_config_float_set("scale", value); - snprintf(buffer, 10, "%f", value); + snprintf(buffer, 10, "%.1f", value); ewl_label_text_set(EWL_LABEL(data), buffer); } static void fps_cb(Ewl_Widget *w, void *event __UNUSED__, void *data) { - double value; + int value; char buffer[10]; value = ewl_range_value_get(EWL_RANGE(w)); ecore_config_int_set("frame_rate", value); - snprintf(buffer, 10, "%f", value); + snprintf(buffer, 10, "%d", value); ewl_label_text_set(EWL_LABEL(data), buffer); } static void engine_cb(Ewl_Widget *w, void *event __UNUSED__, void *data) { - Config_Data *d; + Eina_List *l; Ewl_Selection_Idx *idx; + char *eng; - d = ewl_mvc_data_get(EWL_MVC(w)); + l = ewl_mvc_data_get(EWL_MVC(w)); idx = ewl_mvc_selected_get(EWL_MVC(w)); + if (!idx) + return; free(em->engine); - ecore_config_string_set("engine", d->array[idx->row]); - em->engine = strdup(d->array[idx->row]); + eng = eina_list_nth(l, idx->row); + ecore_config_string_set("engine", eng); + em->engine = strdup(eng); free(idx); } static void theme_cb(Ewl_Widget *w, void *event __UNUSED__, void *data) { - Config_Data *d; + Eina_List *l; Ewl_Selection_Idx *idx; + char *theme; - d = ewl_mvc_data_get(EWL_MVC(w)); + l = ewl_mvc_data_get(EWL_MVC(w)); idx = ewl_mvc_selected_get(EWL_MVC(w)); + if (!idx) + return; free(em->theme_path); - ecore_config_theme_set("theme", d->array[idx->row]); - em->theme_path = ecore_config_theme_with_path_get("theme"); + theme = eina_list_nth(l, idx->row); + ecore_config_theme_set("theme", theme); + em->theme_path = strdup(theme); free(idx); } -static Config_Data * +static Eina_List * theme_data_init(void) { - Config_Data *ret; + Eina_List *ret = NULL; + char *dirs; + char **dirs_array; + struct dirent *file; + DIR *rep; + int i = 0; - ret = malloc(sizeof(Config_Data)); + dirs = ecore_config_theme_search_path_get(); + dirs_array = ecore_str_split(dirs, "|", -1); + free(dirs); + + if (!dirs_array) + { + printf("No possible theme paths!\n"); + return NULL; + } + + while ((dirs = dirs_array[i])) + { + rep = opendir(dirs); + if (rep) + { + while ((file = readdir(rep))) + { + if ((strlen(file->d_name) > 4) && + (ecore_str_has_suffix(file->d_name, ".edj"))) + ret = eina_list_append(ret, theme_cut_suffix(file->d_name)); + } + closedir(rep); + } + i++; + } + + free(*dirs_array); + free(dirs_array); + + if (!ret) + { + printf("No themes available!\n"); + return NULL; + } return ret; } static int -theme_data_return_active(Config_Data *data) +theme_data_return_active(Eina_List *l) { - return 0; + int i; + char *theme, *tmp_theme; + + theme = ecore_config_theme_get("theme"); + + EINA_LIST_FOREACH(l, l, tmp_theme) + { + if (!strcmp(tmp_theme, theme)) + break; + i++; + } + + free(theme); + return i; } -static Config_Data * +static Eina_List * engine_data_init(void) { - Config_Data *ret; + Eina_List *l, *ret = NULL; + char *eng; + int i; + const char *accepted_engines[] = {"software_x11", "xrender_x11", + "opengl_x11", NULL}; - ret = malloc(sizeof(Config_Data)); + l = ecore_evas_engines_get(); + + EINA_LIST_FOREACH(l, l, eng) + { + for (i = 0; accepted_engines[i]; i++) + { + if (!strcmp(accepted_engines[i], eng)) + { + ret = eina_list_append(ret, strdup(eng)); + break; + } + } + } + + ecore_evas_engines_free(l); return ret; } static int -engine_data_return_active(Config_Data *data) +engine_data_return_active(Eina_List *l) { - return 0; + int i = 0; + char *eng, *tmp_eng; + + eng = ecore_config_string_get("engine"); + + EINA_LIST_FOREACH(l, l, tmp_eng) + { + if (!strcmp(tmp_eng, eng)) + break; + i++; + } + + free(eng); + return i; } static unsigned int model_data_count(void *data) { - Config_Data *cd = data; - return cd->count; + Eina_List *l = data; + return eina_list_count(l); } static void * model_data_fetch(void *data, unsigned int row, unsigned int col __UNUSED__) { - Config_Data *cd = data; - return cd->array[row]; + Eina_List *l = data; + return eina_list_nth(l, row); +} + +static char * +theme_cut_suffix(const char *file) +{ + char *new_file, *pt, *end; + + end = strrchr(file, '.'); + + new_file = malloc(end - file + 1); + pt = new_file; + + while (file != end) + *pt++ = *file++; + + *pt = '\0'; + + return new_file; +} + +static void +combo_cb(Ewl_Widget *w, void *event __UNUSED__, void *data) +{ + char *str; + + EINA_LIST_FREE(data, str) + free(str); + + eina_list_free(data); +} + +static void +use_scale_cb(Ewl_Widget *w, void *event __UNUSED__, void *data) +{ + int use_scale; + + use_scale = ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)); + ecore_config_boolean_set("use_scale", use_scale); + + if (use_scale) + ewl_widget_enable(EWL_WIDGET(data)); + else + ewl_widget_disable(EWL_WIDGET(data)); } diff --git a/experimental/ecdb/trunk/src/ecdb_gui.c b/experimental/ecdb/trunk/src/ecdb_gui.c index c832cce0..f76d2e62 100644 --- a/experimental/ecdb/trunk/src/ecdb_gui.c +++ b/experimental/ecdb/trunk/src/ecdb_gui.c @@ -13,6 +13,8 @@ static void _filelist_del(Ewl_Widget *w, void *ev_data, void *data); static void ecdb_welcome_page_show_about(void *data, Evas_Object *o, const char *emission, const char *source); +static void ecdb_welcome_page_show_config(void *data, Evas_Object *o, + const char *emission, const char *source); static void ecdb_welcome_page_show_about(void *data __UNUSED__, Evas_Object *o __UNUSED__, @@ -22,6 +24,14 @@ ecdb_welcome_page_show_about(void *data __UNUSED__, Evas_Object *o __UNUSED__, ecdb_about_show(); } +static void +ecdb_welcome_page_show_config(void *data __UNUSED__, Evas_Object *o __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + ecdb_config_dialog_show(); +} + static void _filelist_del(Ewl_Widget *w, void *ev_data __UNUSED__, void *data __UNUSED__) { @@ -223,14 +233,16 @@ ecdb_create_main_gui(void) edje_frametime_set(1.0 / (double)em->fps); ecore_evas_show(em->main_win_ee); - /* Make this configurable at some point */ - edje_scale_set(em->scalef); + if (ecore_config_boolean_get("use_scale")) + edje_scale_set(em->scalef); em->page = calloc(1, sizeof(Ecdb_Page)); em->page->gui = edje_object_add(ecore_evas_get(em->main_win_ee)); edje_object_file_set(em->page->gui, em->theme_path, "ecdb/window"); edje_object_signal_callback_add(em->page->gui, "ecdb/about/show", "ecdb", ecdb_welcome_page_show_about, NULL); + edje_object_signal_callback_add(em->page->gui, "ecdb/config/show", + "ecdb", ecdb_welcome_page_show_config, NULL); edje_object_size_min_get(em->page->gui, &mw, &mh); if (mw <= 0) mw = 400; if (mh <= 0) mh = 300;