From: <enl...@li...> - 2004-08-14 16:29:09
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : apps/elicit Dir : e17/apps/elicit/src Modified Files: Makefile.am callbacks.c callbacks.h elicit.c shots.c swatches.c themes.c Log Message: plug some leaks. optimize the pick/shoot callbacks. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- Makefile.am 12 May 2004 19:13:30 -0000 1.5 +++ Makefile.am 14 Aug 2004 16:29:02 -0000 1.6 @@ -9,10 +9,10 @@ elicit.c Elicit.h \ callbacks.c callbacks.h \ util.c util.h \ + conf.c conf.h \ swatches.c swatches.h \ shots.c shots.h \ - themes.c themes.h \ - conf.c conf.h + themes.c themes.h elicit_LDADD = @edje_libs@ @ecore_libs@ @edb_libs@ @evas_libs@ \ @esmart_libs@ @imlib2_libs@ -lesmart_draggies -lesmart_container =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/callbacks.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- callbacks.c 9 Jul 2004 15:53:54 -0000 1.15 +++ callbacks.c 14 Aug 2004 16:29:02 -0000 1.16 @@ -59,19 +59,8 @@ { el->flags.picking = 0; } - else if (!strcmp(sig, "mouse,move")) - { - if (el->flags.picking == 1) - { - elicit_util_color_at_pointer_get(&(el->color.r), &(el->color.g), &(el->color.b)); - evas_object_color_set(el->swatch, el->color.r, el->color.g, el->color.b, 255); - elicit_util_colors_set_from_rgb(el); - elicit_ui_update(el); - } - } } - void elicit_cb_shoot(void *data, Evas_Object *o, const char *sig, const char *src) { Elicit *el = data; @@ -85,28 +74,41 @@ { el->flags.shooting = 0; } - else if (!strcmp(sig, "mouse,move")) +} + +void elicit_cb_move(void *data, Evas_Object *o, const char *sig, const char *src) +{ + Elicit *el = data; + + if (el->flags.picking == 1) { - if (el->flags.shooting == 1) - { - Evas_Coord sw, sh; - double w, h; + elicit_util_color_at_pointer_get(&(el->color.r), &(el->color.g), &(el->color.b)); + evas_object_color_set(el->swatch, el->color.r, el->color.g, el->color.b, 255); + elicit_util_colors_set_from_rgb(el); + elicit_ui_update(el); + } - evas_object_geometry_get(el->shot, NULL, NULL, &sw, &sh); + if (el->flags.shooting == 1) + { + Evas_Coord sw, sh; + double w, h; - if (el->zoom < 1.0) el->zoom = 1.0; + evas_object_geometry_get(el->shot, NULL, NULL, &sw, &sh); - w = sw * (1 / el->zoom); - h = sh * (1 / el->zoom); - elicit_util_shoot(el->shot, (int)w, (int)h); - } + if (el->zoom < 1.0) el->zoom = 1.0; + + w = sw * (1 / el->zoom); + h = sh * (1 / el->zoom); + elicit_util_shoot(el->shot, (int)w, (int)h); } } + void elicit_cb_colors(void *data, Evas_Object *o, const char *sig, const char *src) { Elicit *el = data; + if (elicit_glob_match(sig, "*,start")) { el->flags.changing = 1; @@ -146,6 +148,8 @@ return; } } + free(theme); + edje_file_collection_list_free(groups); printf("Error: group %s does not exist in file %s\n", group, file); } @@ -295,6 +299,7 @@ elicit_cb_thaw(void *data, Evas_Object *o, const char *sig, const char *src) { Elicit *el = data; + edje_object_thaw(el->gui); } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/callbacks.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- callbacks.h 12 May 2004 19:13:30 -0000 1.6 +++ callbacks.h 14 Aug 2004 16:29:02 -0000 1.7 @@ -11,6 +11,7 @@ void elicit_cb_resize(Ecore_Evas *ee); void elicit_cb_pick(void *data, Evas_Object *o, const char *sig, const char *src); void elicit_cb_shoot(void *data, Evas_Object *o, const char *sig, const char *src); +void elicit_cb_move(void *data, Evas_Object *o, const char *sig, const char *src); void elicit_cb_colors(void *data, Evas_Object *o, const char *sig, const char *src); void elicit_cb_switch(void *data, Evas_Object *o, const char *sig, const char *src); void elicit_cb_copy(void *data, Evas_Object *o, const char *sig, const char *src); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/elicit.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- elicit.c 12 Aug 2004 22:26:30 -0000 1.18 +++ elicit.c 14 Aug 2004 16:29:02 -0000 1.19 @@ -27,7 +27,7 @@ return 1; } - ecore_app_args_set(argc, argv); + ecore_app_args_set(argc, (const char **)argv); el = calloc(1, sizeof(Elicit)); if (!el) @@ -95,6 +95,8 @@ int setup(int argc, char **argv, Elicit *el) { + char *theme; + elicit_config_init(el); ecore_evas_borderless_set(el->ee, 1); @@ -127,10 +129,14 @@ evas_object_name_set(el->draggie, "draggie"); evas_object_show(el->draggie); - elicit_ui_theme_set(el, elicit_config_theme_get(el), "elicit"); + theme = elicit_config_theme_get(el); + elicit_ui_theme_set(el, theme, "elicit"); + free(theme); + elicit_swatches_init(el); elicit_shots_init(el); elicit_themes_init(el); + elicit_ui_update(el); return 0; } @@ -171,8 +177,7 @@ /* set up edje callbacks */ edje_object_signal_callback_add(el->gui, "elicit,pick,*", "*", elicit_cb_pick, el); - edje_object_signal_callback_add(el->gui, "mouse,move", "*", elicit_cb_pick, el); - edje_object_signal_callback_add(el->gui, "mouse,move", "*", elicit_cb_shoot, el); + edje_object_signal_callback_add(el->gui, "mouse,move", "*", elicit_cb_move, el); edje_object_signal_callback_add(el->gui, "elicit,shoot,*", "*", elicit_cb_shoot, el); edje_object_signal_callback_add(el->gui, "elicit,quit", "*", elicit_cb_exit, el); edje_object_signal_callback_add(el->gui, "elicit,color,*", "*", elicit_cb_colors, el); @@ -205,7 +210,7 @@ elicit_ui_update_text(Elicit *el) { char buf[100]; - + snprintf(buf, sizeof(buf)-1, "%d", el->color.r); edje_object_part_text_set(el->gui, "red-val", buf); edje_object_part_text_set(el->gui, "red-val2", buf); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/shots.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- shots.c 12 Aug 2004 22:26:30 -0000 1.7 +++ shots.c 14 Aug 2004 16:29:02 -0000 1.8 @@ -11,7 +11,7 @@ el->shots.cont = esmart_container_new(el->evas); - dir = (char *)edje_object_data_get(el->gui, "swatches.direction"); + dir = (char *)edje_object_data_get(el->gui, "shots.direction"); if (dir && (dir[0] == 'h' || dir[0] == 'H')) el->shots.dir = CONTAINER_DIRECTION_HORIZONTAL; else @@ -147,6 +147,7 @@ void *data = NULL; int size = 0; Evas_Coord mw, mh; + char *theme; sh = calloc(1, sizeof(Elicit_Shot)); @@ -164,10 +165,12 @@ sh->obj = edje_object_add(el->evas); sh->shot = evas_object_image_add(el->evas); - + + theme = elicit_config_theme_get(el); edje_object_file_set(sh->obj, - elicit_theme_find(elicit_config_theme_get(el)), + elicit_theme_find(theme), "shot"); + free(theme); edje_object_size_min_get(sh->obj, &mw, &mh); if (mw != 0 && mh != 0) evas_object_resize(sh->obj, mw, mh); @@ -218,6 +221,7 @@ Evas_Coord mw, mh; double length; Evas_Coord w, h; + char *theme; /* don't save an empty shot */ if (!el->flags.shot_taken) return; @@ -228,10 +232,14 @@ sh->shot = evas_object_image_add(el->evas); sh->name = strdup("Unnamed"); + theme = elicit_config_theme_get(el); edje_object_file_set(sh->obj, - elicit_theme_find(elicit_config_theme_get(el)), + elicit_theme_find(theme), "shot"); - edje_object_size_min_get(sh->obj, &mw, &mh); + + free(theme); + edje_object_size_min_get(sh->obj, &mw, &mh); + if (mw != 0 && mh != 0) evas_object_resize(sh->obj, mw, mh); else =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/swatches.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- swatches.c 12 Aug 2004 22:26:30 -0000 1.7 +++ swatches.c 14 Aug 2004 16:29:02 -0000 1.8 @@ -124,6 +124,7 @@ int i; int r, g, b; char buf[PATH_MAX]; + char *theme; snprintf(buf, PATH_MAX, "%s/.e/apps/%s/swatches.db", getenv("HOME"), el->app_name); @@ -153,9 +154,12 @@ sw->obj = edje_object_add(el->evas); sw->rect = evas_object_rectangle_add(el->evas); + theme = elicit_config_theme_get(el); edje_object_file_set(sw->obj, - elicit_theme_find(elicit_config_theme_get(el)), + elicit_theme_find(theme), "swatch"); + free(theme); + edje_object_size_min_get(sw->obj, &mw, &mh); if (mw != 0 && mh != 0) evas_object_resize(sw->obj, mw, mh); @@ -200,6 +204,7 @@ Evas_Coord mw, mh; double length; Evas_Coord w, h; + char *theme; sw = calloc(1, sizeof(Elicit_Swatch)); @@ -210,9 +215,12 @@ sw->b = el->color.b; sw->name = strdup(el->color.hex); + theme = elicit_config_theme_get(el); edje_object_file_set(sw->obj, - elicit_theme_find(elicit_config_theme_get(el)), + elicit_theme_find(theme), "swatch"); + free(theme); + edje_object_size_min_get(sw->obj, &mw, &mh); if (mw != 0 && mh != 0) evas_object_resize(sw->obj, mw, mh); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/themes.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- themes.c 12 Aug 2004 22:26:30 -0000 1.2 +++ themes.c 14 Aug 2004 16:29:02 -0000 1.3 @@ -1,7 +1,6 @@ #include "Elicit.h" -void elicit_theme_load_cb(void *data, Evas_Object *o, const char *emission, const char *source); -void elicit_theme_name_show_cb(void *data, Evas_Object *o, const char *emission, const char *source); +void _elicit_themes_update_scroll_bar(Elicit *el); int elicit_themes_init(Elicit *el) @@ -43,6 +42,8 @@ } } + + ecore_idle_enterer_add(elicit_themes_scroll_idler, el); } void @@ -243,6 +244,7 @@ elicit_themes_scroll_idler(void *data) { Elicit *el = data; + if (el->themes.scrolling) { _elicit_themes_update_scroll_bar(el); |