Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_border.c e_int_border_border.c e_theme.c e_theme.h e_widget_ilist.c e_widget_ilist.h Log Message: finish off border selector dialog =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v retrieving revision 1.461 retrieving revision 1.462 diff -u -3 -r1.461 -r1.462 --- e_border.c 6 Nov 2005 08:03:13 -0000 1.461 +++ e_border.c 11 Nov 2005 04:26:25 -0000 1.462 @@ -4808,6 +4808,9 @@ snprintf(buf, sizeof(buf), "widgets/border/%s/border", bd->client.border.name); ok = e_theme_edje_object_set(o, "base/theme/borders", buf); + if ((!ok) && (strcmp(bd->client.border.name, "borderless"))) + ok = e_theme_edje_object_set(o, "base/theme/borders", + "widgets/border/default/border"); if (ok) { const char *shape_option; =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_int_border_border.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_int_border_border.c 6 Nov 2005 10:13:43 -0000 1.2 +++ e_int_border_border.c 11 Nov 2005 04:26:25 -0000 1.3 @@ -5,6 +5,7 @@ /* PROTOTYPES - same all the time */ typedef struct _CFData CFData; +typedef struct _CFBorder CFBorder; static void *_create_data(E_Config_Dialog *cfd); static void _free_data(E_Config_Dialog *cfd, CFData *cfdata); @@ -15,7 +16,15 @@ struct _CFData { E_Border *border; + char *bordername; int remember_border; + Evas_List *cfblist; +}; + +struct _CFBorder +{ + CFData *cfdata; + const char *bordername; }; /* a nice easy setup function that does the dirty work */ @@ -45,6 +54,7 @@ if ((cfdata->border->remember) && (cfdata->border->remember->apply & E_REMEMBER_APPLY_BORDER)) cfdata->remember_border = 1; + cfdata->bordername = strdup(cfdata->border->client.border.name); } static void * @@ -67,6 +77,12 @@ { /* Free the cfdata */ cfdata->border->border_border_dialog = NULL; + E_FREE(cfdata->bordername); + while (cfdata->cfblist) + { + E_FREE(cfdata->cfblist->data); + cfdata->cfblist = evas_list_remove_list(cfdata->cfblist, cfdata->cfblist); + } free(cfdata); } @@ -107,6 +123,13 @@ } } } + if ((!cfdata->border->lock_border) && (!cfdata->border->shaded)) + { + if (cfdata->border->client.border.name) free(cfdata->border->client.border.name); + cfdata->border->client.border.name = strdup(cfdata->bordername); + cfdata->border->client.border.changed = 1; + cfdata->border->changed = 1; + } e_config_save_queue(); return 1; /* Apply was OK */ } @@ -118,53 +141,58 @@ /* generate the core widget layout for a basic dialog */ Evas_Object *o, *ob, *oi, *oj, *orect; Evas_Coord wmw, wmh; + Evas_List *borders, *l; + int sel, n; + CFBorder *cfb; _fill_data(cfdata); o = e_widget_list_add(evas, 0, 0); - oi = e_widget_ilist_add(evas, 80, 48); + oi = e_widget_ilist_add(evas, 80, 48, &(cfdata->bordername)); + + sel = 0; + borders = e_theme_border_list(); - ob = e_livethumb_add(evas); - e_livethumb_vsize_set(ob, 160, 96); - oj = edje_object_add(e_livethumb_evas_get(ob)); - e_theme_edje_object_set(oj, "base/theme/borders", "widgets/border/default/border"); - e_livethumb_thumb_set(ob, oj); - orect = evas_object_rectangle_add(e_livethumb_evas_get(ob)); - evas_object_color_set(orect, 255, 255, 255, 128); - evas_object_show(orect); - edje_object_part_swallow(oj, "client", orect); - e_widget_ilist_append(oi, ob, "default", NULL, NULL); - - orect = evas_object_rectangle_add(e_livethumb_evas_get(ob)); - evas_object_color_set(orect, 255, 255, 255, 128); - e_widget_ilist_append(oi, orect, "borderless", NULL, NULL); - - ob = e_icon_add(evas); - e_icon_file_set(ob, "/home/raster/C/stuff/icons/cd.png"); - e_widget_ilist_append(oi, ob, "Item 2", NULL, NULL); - ob = e_icon_add(evas); - e_icon_file_set(ob, "/home/raster/C/stuff/icons/cd.png"); - e_widget_ilist_append(oi, ob, "Item 3", NULL, NULL); - ob = e_icon_add(evas); - e_icon_file_set(ob, "/home/raster/C/stuff/icons/cd.png"); - e_widget_ilist_append(oi, ob, "Item 4", NULL, NULL); + cfb = E_NEW(CFBorder, 1); + cfb->cfdata = cfdata; + cfb->bordername = "borderless"; + cfdata->cfblist = evas_list_append(cfdata->cfblist, cfb); + orect = evas_object_rectangle_add(evas); + evas_object_color_set(orect, 0, 0, 0, 128); + e_widget_ilist_append(oi, orect, "borderless", NULL, NULL, "borderless"); + + for (n = 1, l = borders; l; l = l->next, n++) + { + char buf[4096]; + + cfb = E_NEW(CFBorder, 1); + cfb->cfdata = cfdata; + cfb->bordername = l->data; + cfdata->cfblist = evas_list_append(cfdata->cfblist, cfb); + ob = e_livethumb_add(evas); + e_livethumb_vsize_set(ob, 160, 96); + oj = edje_object_add(e_livethumb_evas_get(ob)); + snprintf(buf, sizeof(buf), "widgets/border/%s/border", + (char *)l->data); + e_theme_edje_object_set(oj, "base/theme/borders", buf); + e_livethumb_thumb_set(ob, oj); + orect = evas_object_rectangle_add(e_livethumb_evas_get(ob)); + evas_object_color_set(orect, 0, 0, 0, 128); + evas_object_show(orect); + edje_object_part_swallow(oj, "client", orect); + e_widget_ilist_append(oi, ob, (char *)l->data, NULL, NULL, l->data); + if (!strcmp(cfdata->border->client.border.name, (char *)l->data)) + sel = n; + } + e_widget_ilist_select_set(oi, sel); + e_widget_min_size_get(oi, &wmw, &wmh); - e_widget_min_size_set(oi, wmw, 150); + e_widget_min_size_set(oi, wmw, 250); e_widget_ilist_go(oi); + e_widget_list_object_append(o, oi, 1, 1, 0.5); -/* - of = e_widget_framelist_add(evas, _("Generic Locks"), 0); - ob = e_widget_check_add(evas, _("Lock the Window so it does only what I tell it to"), &(cfdata->do_what_i_say)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("Protect this window from me accidentally changing it"), &(cfdata->protect_from_me)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("Protect this window from being accidentally closed because it is important"), &(cfdata->important_window)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("Do not allow the border to change on this window"), &(cfdata->keep_my_border)); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - */ + ob = e_widget_check_add(evas, _("Remember this Border for this window next time it appears"), &(cfdata->remember_border)); e_widget_list_object_append(o, ob, 0, 0, 1.0); return o; =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_theme.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- e_theme.c 28 Sep 2005 19:01:33 -0000 1.16 +++ e_theme.c 11 Nov 2005 04:26:25 -0000 1.17 @@ -14,7 +14,9 @@ static Evas_Bool _e_theme_mappings_free_cb(Evas_Hash *hash, const char *key, void *data, void *fdata); static void _e_theme_category_register(const char *category); -static void _e_theme_transition_register(const char *transition); +static Evas_List *_e_theme_collection_item_register(Evas_List *list, const char *name); +static Evas_List *_e_theme_collection_items_find(const char *base, const char *collname); + /* local subsystem globals */ static Evas_Hash *mappings = NULL; @@ -22,6 +24,7 @@ static Evas_List *categories = NULL; static Evas_List *transitions = NULL; +static Evas_List *borders = NULL; /* externally accessible functions */ @@ -48,60 +51,8 @@ } /* Find transitions */ - category = strdup("base/theme/transitions"); - if (category) - { - do - { - res = evas_hash_find(mappings, category); - if (res) - { - char *str; - - /* if found check cached path */ - str = res->cache; - if (!str) - { - /* no cached path */ - str = res->file; - /* if its not an absolute path find it */ - if (str[0] != '/') - str = e_path_find(path_themes, str); - /* save cached value */ - if (str) res->cache = str; - } - if (str) - { - Evas_List *coll, *l; - coll = edje_file_collection_list(str); - if (coll) - { - for (l = coll; l; l = l->next) - { - if (!strncmp(l->data, "transitions", 11)) - { - char *trans; - - trans = strdup(l->data); - p = strchr(trans, '/'); - if (p) - { - p++; - _e_theme_transition_register(p); - } - free(trans); - } - } - edje_file_collection_list_free(coll); - } - } - } - p = strrchr(category, '/'); - if (p) *p = 0; - } - while (p); - free(category); - } + transitions = _e_theme_collection_items_find("base/theme/transitions", "transitions"); + borders = _e_theme_collection_items_find("base/theme/borders", "widgets/border"); return 1; } @@ -164,6 +115,11 @@ free(transitions->data); transitions = evas_list_remove_list(transitions, transitions); } + while (borders) + { + free(borders->data); + borders = evas_list_remove_list(borders, borders); + } return 1; } @@ -450,6 +406,25 @@ return transitions; } +int +e_theme_border_find(const char *border) +{ + Evas_List *l; + + for (l = borders; l; l = l->next) + { + if (!strcmp(border, l->data)) + return 1; + } + return 0; +} + +Evas_List * +e_theme_border_list(void) +{ + return borders; +} + /* local subsystem functions */ static Evas_Bool @@ -478,16 +453,82 @@ categories = evas_list_append(categories, strdup(category)); } -static void -_e_theme_transition_register(const char *transition) +static Evas_List * +_e_theme_collection_item_register(Evas_List *list, const char *name) { Evas_List *l; - for (l = transitions; l; l = l->next) + for (l = list; l; l = l->next) { - if (!strcmp(transition, l->data)) - return; + if (!strcmp(name, l->data)) return list; } + list = evas_list_append(list, strdup(name)); + return list; +} - transitions = evas_list_append(transitions, strdup(transition)); +static Evas_List * +_e_theme_collection_items_find(const char *base, const char *collname) +{ + Evas_List *list = NULL; + E_Theme_Result *res; + char *category, *p, *p2; + int collname_len; + + collname_len = strlen(collname); + category = strdup(base); + if (category) + { + do + { + res = evas_hash_find(mappings, category); + if (res) + { + char *str; + + /* if found check cached path */ + str = res->cache; + if (!str) + { + /* no cached path */ + str = res->file; + /* if its not an absolute path find it */ + if (str[0] != '/') str = e_path_find(path_themes, str); + /* save cached value */ + if (str) res->cache = str; + } + if (str) + { + Evas_List *coll, *l; + + coll = edje_file_collection_list(str); + if (coll) + { + for (l = coll; l; l = l->next) + { + if (!strncmp(l->data, collname, collname_len)) + { + char *trans; + + trans = strdup(l->data); + p = trans + collname_len + 1; + if (*p) + { + p2 = strchr(p, '/'); + if (p2) *p2 = 0; + list = _e_theme_collection_item_register(list, p); + } + free(trans); + } + } + edje_file_collection_list_free(coll); + } + } + } + p = strrchr(category, '/'); + if (p) *p = 0; + } + while (p); + free(category); + } + return list; } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_theme.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- e_theme.h 28 Sep 2005 18:17:35 -0000 1.6 +++ e_theme.h 11 Nov 2005 04:26:25 -0000 1.7 @@ -22,6 +22,8 @@ EAPI Evas_List *e_theme_category_list(void); EAPI int e_theme_transition_find(const char *transition); EAPI Evas_List *e_theme_transition_list(void); +EAPI int e_theme_border_find(const char *border); +EAPI Evas_List *e_theme_border_list(void); #endif #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_widget_ilist.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_widget_ilist.c 6 Nov 2005 09:59:12 -0000 1.2 +++ e_widget_ilist.c 11 Nov 2005 04:26:25 -0000 1.3 @@ -4,9 +4,18 @@ #include "e.h" typedef struct _E_Widget_Data E_Widget_Data; +typedef struct _E_Widget_Callback E_Widget_Callback; struct _E_Widget_Data { Evas_Object *o_widget, *o_scrollframe, *o_ilist; + Evas_List *callbacks; + char **value; +}; +struct _E_Widget_Callback +{ + void (*func) (void *data); + void *data; + char *value; }; static void _e_wid_del_hook(Evas_Object *obj); @@ -17,7 +26,7 @@ /* externally accessible functions */ Evas_Object * -e_widget_ilist_add(Evas *evas, int icon_w, int icon_h) +e_widget_ilist_add(Evas *evas, int icon_w, int icon_h, char **value) { Evas_Object *obj, *o; E_Widget_Data *wd; @@ -29,6 +38,8 @@ e_widget_focus_hook_set(obj, _e_wid_focus_hook); wd = calloc(1, sizeof(E_Widget_Data)); e_widget_data_set(obj, wd); + + wd->value = value; o = e_scrollframe_add(evas); wd->o_scrollframe = o; @@ -51,14 +62,19 @@ } void -e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data) +e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data, char *val) { E_Widget_Data *wd; Evas_Coord mw, mh, vw, vh, w, h; + E_Widget_Callback *wcb; wd = e_widget_data_get(obj); - /* FIXME: need to actually store the callback and call it */ - e_ilist_append(wd->o_ilist, icon, label, _e_wid_cb_item_sel, wd, data); + wcb = E_NEW(E_Widget_Callback, 1); + wcb->func = func; + wcb->data = data; + if (val) wcb->value = strdup(val); + wd->callbacks = evas_list_append(wd->callbacks, wcb); + e_ilist_append(wd->o_ilist, icon, label, _e_wid_cb_item_sel, wd, wcb); if (icon) evas_object_show(icon); e_ilist_min_size_get(wd->o_ilist, &mw, &mh); evas_object_resize(wd->o_ilist, mw, mh); @@ -74,6 +90,15 @@ } void +e_widget_ilist_select_set(Evas_Object *obj, int n) +{ + E_Widget_Data *wd; + + wd = e_widget_data_get(obj); + e_ilist_select_set(wd->o_ilist, n); +} + +void e_widget_ilist_go(Evas_Object *obj) { E_Widget_Data *wd; @@ -88,6 +113,15 @@ E_Widget_Data *wd; wd = e_widget_data_get(obj); + while (wd->callbacks) + { + E_Widget_Callback *wcb; + + wcb = wd->callbacks->data; + if (wcb->value) free(wcb->value); + free(wcb); + wd->callbacks = evas_list_remove_list(wd->callbacks, wd->callbacks); + } free(wd); } @@ -128,11 +162,25 @@ { E_Widget_Data *wd; Evas_Coord x, y, w, h; - + E_Widget_Callback *wcb; + wd = data; + wcb = data2; e_ilist_selected_geometry_get(wd->o_ilist, &x, &y, &w, &h); e_scrollframe_child_region_show(wd->o_scrollframe, x, y, w, h); - if (wd->o_widget) e_widget_change(wd->o_widget); + if (wd->o_widget) + { + e_widget_change(wd->o_widget); + if (wd->value) + { + if (*(wd->value)) free(*(wd->value)); + if (wcb->value) + *(wd->value) = strdup(wcb->value); + else + *(wd->value) = NULL; + } + if (wcb->func) wcb->func(wcb->data); + } } static void =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_widget_ilist.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- e_widget_ilist.h 6 Nov 2005 08:03:13 -0000 1.1 +++ e_widget_ilist.h 11 Nov 2005 04:26:25 -0000 1.2 @@ -6,8 +6,9 @@ #ifndef E_WIDGET_ILIST_H #define E_WIDGET_ILIST_H -EAPI Evas_Object *e_widget_ilist_add(Evas *evas, int icon_w, int icon_h); -EAPI void e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data); +EAPI Evas_Object *e_widget_ilist_add(Evas *evas, int icon_w, int icon_h, char **value); +EAPI void e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data, char *val); +EAPI void e_widget_ilist_select_set(Evas_Object *obj, int n); EAPI void e_widget_ilist_go(Evas_Object *obj); #endif ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs