From bebdbe654be85ec6d23a777504e49715e3e5c779 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Tue, 13 Nov 2007 06:00:33 +0000 Subject: [PATCH] cedric patch - as per email. SVN revision: 32650 --- src/bin/engine_software_sdl.c | 15 ++++++++++-- src/bin/image_blend_border.c | 2 +- src/bin/image_blend_border_recolor.c | 2 +- src/bin/image_blend_nearest_scaled.c | 2 +- src/bin/image_blend_nearest_solid_scaled.c | 2 +- src/bin/image_blend_occlude1.c | 4 +-- src/bin/image_blend_occlude1_many.c | 4 +-- src/bin/image_blend_occlude1_very_many.c | 4 +-- src/bin/image_blend_occlude2.c | 4 +-- src/bin/image_blend_occlude2_few.c | 4 +-- src/bin/image_blend_occlude2_many.c | 4 +-- src/bin/image_blend_occlude2_very_many.c | 4 +-- src/bin/image_blend_occlude3.c | 4 +-- src/bin/image_blend_occlude3_few.c | 4 +-- src/bin/image_blend_occlude3_many.c | 4 +-- src/bin/image_blend_occlude3_very_many.c | 4 +-- src/bin/image_blend_smooth_scaled.c | 2 +- src/bin/image_blend_smooth_solid_scaled.c | 2 +- src/bin/image_blend_solid_border.c | 2 +- src/bin/image_blend_solid_unscaled.c | 2 +- src/bin/image_blend_unscaled.c | 2 +- src/bin/image_crossfade.c | 4 +-- src/bin/image_data_ycbcr601pl.c | 2 +- src/bin/image_data_ycbcr601pl_wide_stride.c | 2 +- src/bin/image_quality_scale.c | 2 +- src/bin/main.c | 27 +++++++++++++++++++++ src/bin/main.h | 1 + src/bin/ui.c | 24 ++++-------------- 28 files changed, 82 insertions(+), 57 deletions(-) diff --git a/src/bin/engine_software_sdl.c b/src/bin/engine_software_sdl.c index 766d68b..188daf7 100644 --- a/src/bin/engine_software_sdl.c +++ b/src/bin/engine_software_sdl.c @@ -1,3 +1,4 @@ +#include #include "main.h" #include @@ -16,11 +17,15 @@ engine_software_sdl_args(int argc, char **argv) { i++; if (!strcmp(argv[i], "sdl")) ok = 1; + if (!strcmp(argv[i], "sdl-16")) ok = 2; } } if (!ok) return 0; + if (ok == 1) evas_output_method_set(evas, evas_render_method_lookup("software_sdl")); + else + evas_output_method_set(evas, evas_render_method_lookup("software_16_sdl")); einfo = (Evas_Engine_Info_SDL *) evas_engine_info_get(evas); @@ -98,8 +103,14 @@ engine_software_sdl_loop(void) else evas_key_lock_on(evas, "Scroll_Lock"); break; - case SDLK_ESCAPE: evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL); break; - case SDLK_RETURN: evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL); break; + case SDLK_s: + case SDLK_ESCAPE: + evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL); + break; + case SDLK_KP_ENTER: + case SDLK_RETURN: + evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL); + break; case SDLK_LEFT: evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL); break; case SDLK_RIGHT: evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL); break; case SDLK_q: diff --git a/src/bin/image_blend_border.c b/src/bin/image_blend_border.c index 5b711f3..e946334 100644 --- a/src/bin/image_blend_border.c +++ b/src/bin/image_blend_border.c @@ -25,7 +25,7 @@ static void _setup(void) { o = evas_object_image_add(evas); o_images[i] = o; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/bar.png", NULL); + evas_object_image_file_set(o, build_path("bar.png"), NULL); evas_object_image_border_set(o, 8, 8, 8, 8); evas_object_show(o); } diff --git a/src/bin/image_blend_border_recolor.c b/src/bin/image_blend_border_recolor.c index d73d7d2..f1047dd 100644 --- a/src/bin/image_blend_border_recolor.c +++ b/src/bin/image_blend_border_recolor.c @@ -25,7 +25,7 @@ static void _setup(void) { o = evas_object_image_add(evas); o_images[i] = o; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/pan.png", NULL); + evas_object_image_file_set(o, build_path("pan.png"), NULL); evas_object_color_set(o, 64, 64, 64, 255); evas_object_image_border_set(o, 3, 3, 3, 3); evas_object_show(o); diff --git a/src/bin/image_blend_nearest_scaled.c b/src/bin/image_blend_nearest_scaled.c index f40317c..9f09e75 100644 --- a/src/bin/image_blend_nearest_scaled.c +++ b/src/bin/image_blend_nearest_scaled.c @@ -25,7 +25,7 @@ static void _setup(void) { o = evas_object_image_add(evas); o_images[i] = o; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); evas_object_image_smooth_scale_set(o, 0); evas_object_show(o); } diff --git a/src/bin/image_blend_nearest_solid_scaled.c b/src/bin/image_blend_nearest_solid_scaled.c index 16480c7..ddb1e51 100644 --- a/src/bin/image_blend_nearest_solid_scaled.c +++ b/src/bin/image_blend_nearest_solid_scaled.c @@ -25,7 +25,7 @@ static void _setup(void) { o = evas_object_image_add(evas); o_images[i] = o; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); evas_object_image_smooth_scale_set(o, 0); evas_object_show(o); } diff --git a/src/bin/image_blend_occlude1.c b/src/bin/image_blend_occlude1.c index e3268a7..5020ad6 100644 --- a/src/bin/image_blend_occlude1.c +++ b/src/bin/image_blend_occlude1.c @@ -27,12 +27,12 @@ static void _setup(void) o = evas_object_image_add(evas); o_images[i] = o; if (i < (OBNUM / 2)) - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); else { Evas_Coord x, y; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8); y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8); evas_object_move(o, x, y); diff --git a/src/bin/image_blend_occlude1_many.c b/src/bin/image_blend_occlude1_many.c index 8553649..3fe8b77 100644 --- a/src/bin/image_blend_occlude1_many.c +++ b/src/bin/image_blend_occlude1_many.c @@ -30,12 +30,12 @@ static void _setup(void) o = evas_object_image_add(evas); o_images[i] = o; if (i < (OBNUM / 2)) - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); else { Evas_Coord x, y; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8); y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8); evas_object_move(o, x, y); diff --git a/src/bin/image_blend_occlude1_very_many.c b/src/bin/image_blend_occlude1_very_many.c index df50345..837557b 100644 --- a/src/bin/image_blend_occlude1_very_many.c +++ b/src/bin/image_blend_occlude1_very_many.c @@ -30,12 +30,12 @@ static void _setup(void) o = evas_object_image_add(evas); o_images[i] = o; if (i < (OBNUM / 2)) - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); else { Evas_Coord x, y; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8); y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8); evas_object_move(o, x, y); diff --git a/src/bin/image_blend_occlude2.c b/src/bin/image_blend_occlude2.c index 9cb4293..3647eac 100644 --- a/src/bin/image_blend_occlude2.c +++ b/src/bin/image_blend_occlude2.c @@ -27,12 +27,12 @@ static void _setup(void) o = evas_object_image_add(evas); o_images[i] = o; if (i & 0x1) - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); else { Evas_Coord x, y; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8); y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8); evas_object_move(o, x, y); diff --git a/src/bin/image_blend_occlude2_few.c b/src/bin/image_blend_occlude2_few.c index 12ab692..d717852 100644 --- a/src/bin/image_blend_occlude2_few.c +++ b/src/bin/image_blend_occlude2_few.c @@ -30,12 +30,12 @@ static void _setup(void) o = evas_object_image_add(evas); o_images[i] = o; if (i & 0x1) - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); else { Evas_Coord x, y; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8); y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8); evas_object_move(o, x, y); diff --git a/src/bin/image_blend_occlude2_many.c b/src/bin/image_blend_occlude2_many.c index b362fbe..de2f1f7 100644 --- a/src/bin/image_blend_occlude2_many.c +++ b/src/bin/image_blend_occlude2_many.c @@ -30,12 +30,12 @@ static void _setup(void) o = evas_object_image_add(evas); o_images[i] = o; if (i & 0x1) - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); else { Evas_Coord x, y; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8); y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8); evas_object_move(o, x, y); diff --git a/src/bin/image_blend_occlude2_very_many.c b/src/bin/image_blend_occlude2_very_many.c index d4c34c6..30b5880 100644 --- a/src/bin/image_blend_occlude2_very_many.c +++ b/src/bin/image_blend_occlude2_very_many.c @@ -30,12 +30,12 @@ static void _setup(void) o = evas_object_image_add(evas); o_images[i] = o; if (i & 0x1) - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); else { Evas_Coord x, y; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8); y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8); evas_object_move(o, x, y); diff --git a/src/bin/image_blend_occlude3.c b/src/bin/image_blend_occlude3.c index e2cd0ce..46d9836 100644 --- a/src/bin/image_blend_occlude3.c +++ b/src/bin/image_blend_occlude3.c @@ -27,12 +27,12 @@ static void _setup(void) o = evas_object_image_add(evas); o_images[i] = o; if (i > (OBNUM / 2)) - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); else { Evas_Coord x, y; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8); y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8); evas_object_move(o, x, y); diff --git a/src/bin/image_blend_occlude3_few.c b/src/bin/image_blend_occlude3_few.c index 5a7e20f..2d38fae 100644 --- a/src/bin/image_blend_occlude3_few.c +++ b/src/bin/image_blend_occlude3_few.c @@ -30,12 +30,12 @@ static void _setup(void) o = evas_object_image_add(evas); o_images[i] = o; if (i > (OBNUM / 2)) - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); else { Evas_Coord x, y; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8); y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8); evas_object_move(o, x, y); diff --git a/src/bin/image_blend_occlude3_many.c b/src/bin/image_blend_occlude3_many.c index a0beec1..7979a43 100644 --- a/src/bin/image_blend_occlude3_many.c +++ b/src/bin/image_blend_occlude3_many.c @@ -30,12 +30,12 @@ static void _setup(void) o = evas_object_image_add(evas); o_images[i] = o; if (i > (OBNUM / 2)) - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); else { Evas_Coord x, y; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8); y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8); evas_object_move(o, x, y); diff --git a/src/bin/image_blend_occlude3_very_many.c b/src/bin/image_blend_occlude3_very_many.c index c6a0f22..d7797df 100644 --- a/src/bin/image_blend_occlude3_very_many.c +++ b/src/bin/image_blend_occlude3_very_many.c @@ -30,12 +30,12 @@ static void _setup(void) o = evas_object_image_add(evas); o_images[i] = o; if (i > (OBNUM / 2)) - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); else { Evas_Coord x, y; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8); y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8); evas_object_move(o, x, y); diff --git a/src/bin/image_blend_smooth_scaled.c b/src/bin/image_blend_smooth_scaled.c index 33a31e0..7c86bdb 100644 --- a/src/bin/image_blend_smooth_scaled.c +++ b/src/bin/image_blend_smooth_scaled.c @@ -25,7 +25,7 @@ static void _setup(void) { o = evas_object_image_add(evas); o_images[i] = o; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); evas_object_image_smooth_scale_set(o, 1); evas_object_show(o); } diff --git a/src/bin/image_blend_smooth_solid_scaled.c b/src/bin/image_blend_smooth_solid_scaled.c index e44ba5c..c5d9e0b 100644 --- a/src/bin/image_blend_smooth_solid_scaled.c +++ b/src/bin/image_blend_smooth_solid_scaled.c @@ -25,7 +25,7 @@ static void _setup(void) { o = evas_object_image_add(evas); o_images[i] = o; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); evas_object_image_smooth_scale_set(o, 1); evas_object_show(o); } diff --git a/src/bin/image_blend_solid_border.c b/src/bin/image_blend_solid_border.c index 40877e2..7662606 100644 --- a/src/bin/image_blend_solid_border.c +++ b/src/bin/image_blend_solid_border.c @@ -25,7 +25,7 @@ static void _setup(void) { o = evas_object_image_add(evas); o_images[i] = o; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/frame.png", NULL); + evas_object_image_file_set(o, build_path("frame.png"), NULL); evas_object_image_border_set(o, 8, 8, 8, 8); evas_object_show(o); } diff --git a/src/bin/image_blend_solid_unscaled.c b/src/bin/image_blend_solid_unscaled.c index e18ae20..b7f20a5 100644 --- a/src/bin/image_blend_solid_unscaled.c +++ b/src/bin/image_blend_solid_unscaled.c @@ -25,7 +25,7 @@ static void _setup(void) { o = evas_object_image_add(evas); o_images[i] = o; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL); + evas_object_image_file_set(o, build_path("image.png"), NULL); evas_object_image_fill_set(o, 0, 0, 120, 160); evas_object_resize(o, 120, 160); evas_object_show(o); diff --git a/src/bin/image_blend_unscaled.c b/src/bin/image_blend_unscaled.c index 6bac74d..db37283 100644 --- a/src/bin/image_blend_unscaled.c +++ b/src/bin/image_blend_unscaled.c @@ -25,7 +25,7 @@ static void _setup(void) { o = evas_object_image_add(evas); o_images[i] = o; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); evas_object_image_fill_set(o, 0, 0, 120, 160); evas_object_resize(o, 120, 160); evas_object_show(o); diff --git a/src/bin/image_crossfade.c b/src/bin/image_crossfade.c index 619f804..c1139a5 100644 --- a/src/bin/image_crossfade.c +++ b/src/bin/image_crossfade.c @@ -24,14 +24,14 @@ static void _setup(void) o = evas_object_image_add(evas); o_images[0] = o; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/im1.png", NULL); + evas_object_image_file_set(o, build_path("im1.png"), NULL); evas_object_image_fill_set(o, 0, 0, 720, 420); evas_object_resize(o, 720, 420); evas_object_show(o); o = evas_object_image_add(evas); o_images[1] = o; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/im2.png", NULL); + evas_object_image_file_set(o, build_path("im2.png"), NULL); evas_object_image_fill_set(o, 0, 0, 720, 420); evas_object_resize(o, 720, 420); evas_object_show(o); diff --git a/src/bin/image_data_ycbcr601pl.c b/src/bin/image_data_ycbcr601pl.c index de0de83..55f68a8 100644 --- a/src/bin/image_data_ycbcr601pl.c +++ b/src/bin/image_data_ycbcr601pl.c @@ -38,7 +38,7 @@ static void _setup(void) yp = malloc(640 * 480); up = malloc(320 * 240); vp = malloc(320 * 240); - f = fopen(PACKAGE_DATA_DIR"/data/tp.yuv", "rb"); + f = fopen(build_path("tp.yuv"), "rb"); if (f) { fread(yp, 640 * 480, 1, f); diff --git a/src/bin/image_data_ycbcr601pl_wide_stride.c b/src/bin/image_data_ycbcr601pl_wide_stride.c index 5a78f17..3651977 100644 --- a/src/bin/image_data_ycbcr601pl_wide_stride.c +++ b/src/bin/image_data_ycbcr601pl_wide_stride.c @@ -38,7 +38,7 @@ static void _setup(void) yp = malloc(640 * 480); up = malloc(320 * 240); vp = malloc(320 * 240); - f = fopen(PACKAGE_DATA_DIR"/data/tp.yuv", "rb"); + f = fopen(build_path("tp.yuv"), "rb"); if (f) { fread(yp, 640 * 480, 1, f); diff --git a/src/bin/image_quality_scale.c b/src/bin/image_quality_scale.c index 6ef3f5a..5c1b3ea 100644 --- a/src/bin/image_quality_scale.c +++ b/src/bin/image_quality_scale.c @@ -26,7 +26,7 @@ static void _setup(void) { o = evas_object_image_add(evas); o_images[i] = o; - evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/tp.png", NULL); + evas_object_image_file_set(o, build_path("tp.png"), NULL); evas_object_image_fill_set(o, 0, 0, 640, 480); evas_object_resize(o, 640, 480); evas_object_show(o); diff --git a/src/bin/main.c b/src/bin/main.c index 30dcf5a..b972b68 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -1075,9 +1075,36 @@ get_time(void) } #endif + +const char * +build_path(const char *filename) +{ + static char path[4096]; + static char buffer[4096]; + static int init = 0; + + if (!init) + { + char *prefix; + + prefix = getenv("EXPEDITE_DATA_DIR"); + if (!prefix) + strcpy(path, PACKAGE_DATA_DIR"/data/"); + else + snprintf(path, 4096, "%s/", prefix); + + init = 1; + } + + snprintf(buffer, 4096, "%s%s", path, filename); + + return buffer; +} + int engine_abort(void) { + fprintf(stderr, "go: %i\n", go); go = 0; return go; } diff --git a/src/bin/main.h b/src/bin/main.h index 5a8735b..3c9ff5c 100644 --- a/src/bin/main.h +++ b/src/bin/main.h @@ -55,6 +55,7 @@ extern int win_w, win_h; void srnd(void); unsigned int rnd(void); double get_time(void); +const char *build_path(const char *filename); void engine_loop(void); int engine_abort(void); diff --git a/src/bin/ui.c b/src/bin/ui.c index 4df6e33..07dd97c 100644 --- a/src/bin/ui.c +++ b/src/bin/ui.c @@ -208,13 +208,11 @@ _ui_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) static void _ui_menu_item_add(char *icon, char *text, void (*func) (void)) { - char buf[4096]; Menu_Item *mi; mi = malloc(sizeof(Menu_Item)); - snprintf(buf, 4096, "%s%s", data_dir, icon); mi->o_icon = evas_object_image_add(evas); - evas_object_image_file_set(mi->o_icon, buf, NULL); + evas_object_image_file_set(mi->o_icon, build_path(icon), NULL); evas_object_resize(mi->o_icon, 32, 32); evas_object_image_fill_set(mi->o_icon, 0, 0, 32, 32); mi->icon = strdup(icon); @@ -227,16 +225,8 @@ _ui_menu_item_add(char *icon, char *text, void (*func) (void)) static void _ui_setup(void) { - char buf[4096]; Evas_Object *o; Evas_Coord x, y, w, h; - char *prefix; - - prefix = getenv("EXPEDITE_DATA_DIR"); - if (!prefix) - strcpy(data_dir, PACKAGE_DATA_DIR"/data/"); - else - snprintf(data_dir, 4096, "%s/", prefix); o = evas_object_rectangle_add(evas); evas_object_move(o, 0, 0); @@ -299,8 +289,7 @@ _ui_setup(void) o = evas_object_image_add(evas); evas_object_move(o, (win_w - 120) / 2, ((win_h - 160) / 2)); - snprintf(buf, 4096, "%s%s", data_dir, "logo.png"); - evas_object_image_file_set(o, buf, NULL); + evas_object_image_file_set(o, build_path("logo.png"), NULL); evas_object_image_fill_set(o, 0, 0, 120, 160); evas_object_resize(o, 120, 160); evas_object_layer_set(o, -98); @@ -317,16 +306,14 @@ _ui_setup(void) o = evas_object_image_add(evas); evas_object_move(o, 0, 0); - snprintf(buf, 4096, "%s%s", data_dir, "icon_sel.png"); - evas_object_image_file_set(o, buf, NULL); + evas_object_image_file_set(o, build_path("icon_sel.png"), NULL); evas_object_resize(o, 56, 56); evas_object_image_fill_set(o, 0, 0, 56, 56); o_menu_icon_sel = o; o = evas_object_image_add(evas); evas_object_move(o, 0, 0); - snprintf(buf, 4096, "%s%s", data_dir, "text_sel.png"); - evas_object_image_file_set(o, buf, NULL); + evas_object_image_file_set(o, build_path("text_sel.png"), NULL); evas_object_resize(o, 96, 32); evas_object_image_fill_set(o, 0, 0, 96, 32); evas_object_image_border_set(o, 8, 8, 8, 8); @@ -334,8 +321,7 @@ _ui_setup(void) o = evas_object_image_add(evas); evas_object_move(o, 0, 0); - snprintf(buf, 4096, "%s%s", data_dir, "icon_sel2.png"); - evas_object_image_file_set(o, buf, NULL); + evas_object_image_file_set(o, build_path("icon_sel2.png"), NULL); evas_object_resize(o, 56, 41); evas_object_image_fill_set(o, 0, 0, 56, 41); o_menu_icon_sel2 = o;