From: Enlightenment C. <no...@cv...> - 2006-08-08 15:41:49
|
Enlightenment CVS committal Author : raster Project : e17 Module : apps/e Dir : e17/apps/e/src/bin Modified Files: Makefile.am e_configure.c e_includes.h e_int_config_wallpaper.c e_int_config_wallpaper_import.c Removed Files: e_int_config_background.c e_int_config_background.h e_int_config_background_import.c e_int_config_background_import.h Log Message: much improved importer - not done yet... =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/Makefile.am,v retrieving revision 1.132 retrieving revision 1.133 diff -u -3 -r1.132 -r1.133 --- Makefile.am 7 Aug 2006 20:25:34 -0000 1.132 +++ Makefile.am 8 Aug 2006 20:41:45 -0000 1.133 @@ -129,8 +129,6 @@ e_widget_slider.h \ e_int_config_window_manipulation.h \ e_int_config_window_display.h \ -e_int_config_background.h \ -e_int_config_background_import.h \ e_int_config_theme.h \ e_int_config_menus.h \ e_int_config_keybindings.h \ @@ -274,8 +272,6 @@ e_widget_slider.c \ e_int_config_window_manipulation.c \ e_int_config_window_display.c \ -e_int_config_background.c \ -e_int_config_background_import.c \ e_int_config_theme.c \ e_int_config_menus.c \ e_int_config_keybindings.c \ =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_configure.c,v retrieving revision 1.48 retrieving revision 1.49 diff -u -3 -r1.48 -r1.49 --- e_configure.c 7 Aug 2006 20:25:34 -0000 1.48 +++ e_configure.c 8 Aug 2006 20:41:46 -0000 1.49 @@ -64,7 +64,6 @@ /* add items here */ e_configure_header_item_add(eco, "enlightenment/appearance", _("Appearance")); -// e_configure_standard_item_add(eco, "enlightenment/background", _("Wallpaper"), e_int_config_background); e_configure_standard_item_add(eco, "enlightenment/background", _("Wallpaper"), e_int_config_wallpaper); e_configure_standard_item_add(eco, "enlightenment/themes", _("Theme"), e_int_config_theme); e_configure_standard_item_add(eco, "enlightenment/fonts", _("Fonts"), e_int_config_fonts); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_includes.h,v retrieving revision 1.111 retrieving revision 1.112 diff -u -3 -r1.111 -r1.112 --- e_includes.h 7 Aug 2006 20:25:34 -0000 1.111 +++ e_includes.h 8 Aug 2006 20:41:46 -0000 1.112 @@ -102,8 +102,6 @@ #include "e_widget_slider.h" #include "e_int_config_window_manipulation.h" #include "e_int_config_window_display.h" -#include "e_int_config_background.h" -#include "e_int_config_background_import.h" #include "e_int_config_theme.h" #include "e_int_config_menus.h" #include "e_int_config_keybindings.h" =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_wallpaper.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- e_int_config_wallpaper.c 7 Aug 2006 20:25:34 -0000 1.1 +++ e_int_config_wallpaper.c 8 Aug 2006 20:41:46 -0000 1.2 @@ -507,7 +507,7 @@ e_widget_table_object_append(ot, ol, 2, 0, 1, 1, 1, 1, 1, 1); il = e_widget_list_add(evas, 0, 0); - o = e_widget_check_add(evas, _("Theme Wallpaper"), &cfdata->use_theme_bg); + o = e_widget_check_add(evas, _("Use Theme Wallpaper"), &cfdata->use_theme_bg); cfdata->o_theme_bg = o; evas_object_smart_callback_add(o, "changed", _cb_theme_wallpaper, cfdata); @@ -677,7 +677,7 @@ e_widget_table_object_append(ot, ol, 2, 0, 1, 1, 1, 1, 1, 1); il = e_widget_list_add(evas, 0, 0); - o = e_widget_check_add(evas, _("Theme Wallpaper"), &cfdata->use_theme_bg); + o = e_widget_check_add(evas, _("Use Theme Wallpaper"), &cfdata->use_theme_bg); cfdata->o_theme_bg = o; evas_object_smart_callback_add(o, "changed", _cb_theme_wallpaper, cfdata); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_wallpaper_import.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_int_config_wallpaper_import.c 7 Aug 2006 20:30:10 -0000 1.2 +++ e_int_config_wallpaper_import.c 8 Aug 2006 20:41:46 -0000 1.3 @@ -1,87 +1,11 @@ #include "e.h" -/* FIXME: redo this... */ - #define IMPORT_STRETCH 0 #define IMPORT_TILE 1 #define IMPORT_CENTER 2 -/* FIXME handle these 2 */ #define IMPORT_SCALE_ASPECT_IN 3 #define IMPORT_SCALE_ASPECT_OUT 4 -/* Personally I hate having to define this twice, but Tileing needs a fill */ -#define IMG_EDC_TMPL_TILE \ -"images {\n" \ -" image: \"%s\" LOSSY 90;\n" \ -"}\n" \ -"collections {\n" \ -" group {\n" \ -" name: \"desktop/background\";\n" \ -" max: %d %d;\n" \ -" parts {\n" \ -" part {\n" \ -" name: \"background_image\";\n" \ -" type: IMAGE;\n" \ -" mouse_events: 0;\n" \ -" description {\n" \ -" state: \"default\" 0.0;\n" \ -" visible: 1;\n" \ -" rel1 {\n" \ -" relative: 0.0 0.0;\n" \ -" offset: 0 0;\n" \ -" }\n" \ -" rel2 {\n" \ -" relative: 1.0 1.0;\n" \ -" offset: -1 -1;\n" \ -" }\n" \ -" image {\n" \ -" normal: \"%s\";\n" \ -" }\n" \ -" fill {\n" \ -" size {\n" \ -" relative: 0.0 0.0;\n" \ -" offset: %d %d;\n" \ -" }\n" \ -" }\n" \ -" }\n" \ -" }\n" \ -" }\n" \ -" }\n" \ -"}\n" - -#define IMG_EDC_TMPL \ -"images {\n" \ -" image: \"%s\" LOSSY 90;\n" \ -"}\n" \ -"collections {\n" \ -" group {\n" \ -" name: \"desktop/background\";\n" \ -" max: %d %d;\n" \ -" parts {\n" \ -" part {\n" \ -" name: \"background_image\";\n" \ -" type: IMAGE;\n" \ -" mouse_events: 0;\n" \ -" description {\n" \ -" state: \"default\" 0.0;\n" \ -" visible: 1;\n" \ -" rel1 {\n" \ -" relative: 0.0 0.0;\n" \ -" offset: 0 0;\n" \ -" }\n" \ -" rel2 {\n" \ -" relative: 1.0 1.0;\n" \ -" offset: -1 -1;\n" \ -" }\n" \ -" image {\n" \ -" normal: \"%s\";\n" \ -" }\n" \ -" }\n" \ -" }\n" \ -" }\n" \ -" }\n" \ -"}\n" - typedef struct _Import Import; struct _Import @@ -110,6 +34,8 @@ { char *file; int method; + int perfect; + double quality; }; static Ecore_Event_Handler *_import_edje_cc_exit_handler = NULL; @@ -131,7 +57,7 @@ Evas *evas; E_Win *win; Import *import; - Evas_Object *o, *of, *ofm, *ord; + Evas_Object *o, *of, *ofm, *ord, *ot; E_Radio_Group *rg; Evas_Coord w, h; E_Config_Dialog_Data *cfdata; @@ -148,7 +74,9 @@ } cfdata = E_NEW(E_Config_Dialog_Data, 1); - cfdata->method = 0; + cfdata->method = IMPORT_STRETCH; + cfdata->perfect = 0; + cfdata->quality = 90.0; import->cfdata = cfdata; import->win = win; @@ -198,16 +126,30 @@ import->fsel_obj = ofm; e_widget_list_object_append(o, ofm, 1, 1, 0.5); - of = e_widget_frametable_add(evas, _("Options"), 0); + ot = e_widget_table_add(evas, 0); + + of = e_widget_frametable_add(evas, _("Fill and Stretch Options"), 1); rg = e_widget_radio_group_new(&cfdata->method); - ord = e_widget_radio_add(evas, _("Center Image"), IMPORT_CENTER, rg); + ord = e_widget_radio_icon_add(evas, _("Stretch"), "enlightenment/wallpaper_stretch", 24, 24, IMPORT_STRETCH, rg); + e_widget_frametable_object_append(of, ord, 0, 0, 1, 1, 1, 0, 1, 0); + ord = e_widget_radio_icon_add(evas, _("Center"), "enlightenment/wallpaper_center", 24, 24, IMPORT_CENTER, rg); + e_widget_frametable_object_append(of, ord, 1, 0, 1, 1, 1, 0, 1, 0); + ord = e_widget_radio_icon_add(evas, _("Tile"), "enlightenment/wallpaper_tile", 24, 24, IMPORT_TILE, rg); + e_widget_frametable_object_append(of, ord, 2, 0, 1, 1, 1, 0, 1, 0); + ord = e_widget_radio_icon_add(evas, _("Within"), "enlightenment/wallpaper_scale_aspect_in", 24, 24, IMPORT_SCALE_ASPECT_IN, rg); + e_widget_frametable_object_append(of, ord, 3, 0, 1, 1, 1, 0, 1, 0); + ord = e_widget_radio_icon_add(evas, _("Fill"), "enlightenment/wallpaper_scale_aspect_out", 24, 24, IMPORT_SCALE_ASPECT_OUT, rg); + e_widget_frametable_object_append(of, ord, 4, 0, 1, 1, 1, 0, 1, 0); + e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 1, 1, 0); + + of = e_widget_frametable_add(evas, _("File Quality"), 0); + ord = e_widget_slider_add(evas, 1, 0, _("%3.0f%%"), 0.0, 100.0, 1.0, 0, &(cfdata->quality), NULL, 150); e_widget_frametable_object_append(of, ord, 0, 0, 1, 1, 1, 0, 1, 0); - ord = e_widget_radio_add(evas, _("Scale Image"), IMPORT_STRETCH, rg); - e_widget_frametable_object_append(of, ord, 0, 1, 1, 1, 1, 0, 1, 0); - ord = e_widget_radio_add(evas, _("Tile Image"), IMPORT_TILE, rg); - e_widget_frametable_object_append(of, ord, 0, 2, 1, 1, 1, 0, 1, 0); + ord = e_widget_check_add(evas, _("Perfect"), &(cfdata->perfect)); + e_widget_frametable_object_append(of, ord, 1, 0, 1, 1, 0, 0, 0, 0); + e_widget_table_object_append(ot, of, 0, 1, 1, 1, 1, 1, 1, 0); - e_widget_list_object_append(o, of, 0, 0, 0.5); + e_widget_list_object_append(o, ot, 0, 0, 0.5); e_widget_min_size_get(o, &w, &h); edje_extern_object_min_size_set(o, w, h); @@ -228,8 +170,8 @@ edje_object_part_swallow(import->bg_obj, "buttons_swallow", o); edje_object_size_min_calc(import->bg_obj, &w, &h); - evas_object_resize(import->bg_obj, w + 64, h + 128); - e_win_resize(win, w + 64, h + 128); + evas_object_resize(import->bg_obj, w, h + 128); + e_win_resize(win, w, h + 128); e_win_size_min_set(win, w, h); e_win_size_max_set(win, 99999, 99999); e_win_show(win); @@ -280,7 +222,7 @@ int fd; int w = 0, h = 0; const char *file; - char buf[4096], cmd[4096], tmpn[4096], ipart[4096]; + char buf[4096], cmd[4096], tmpn[4096], ipart[4096], enc[128]; char *imgdir = NULL, *homedir, *fstrip; FILE *f; @@ -326,19 +268,85 @@ evas_object_image_size_get(img, &w, &h); evas_object_del(img); + fstrip = strdup(e_util_filename_escape(file)); + if (import->cfdata->perfect) + snprintf(enc, sizeof(enc), "COMP"); + else + snprintf(enc, sizeof(enc), "LOSSY %1.0f", import->cfdata->quality); switch (import->cfdata->method) { - case IMPORT_CENTER: - fprintf(f, IMG_EDC_TMPL, file, w, h, file); + case IMPORT_STRETCH: + fprintf(f, + "images { image: \"%s\" %s; }\n" + "collections {\n" + "group { name: \"desktop/background\";\n" + "max: %i %i;\n" + "parts { part { name: \"bg\"; mouse_events: 0;\n" + "description { state: \"default\" 0.0;\n" + "image { normal: \"%s\"; }\n" + "} } } } }\n" + , fstrip, enc, w, h, fstrip); break; case IMPORT_TILE: - fprintf(f, IMG_EDC_TMPL_TILE, file, w, h, file, w, h); + fprintf(f, + "images { image: \"%s\" %s; }\n" + "collections {\n" + "group { name: \"desktop/background\";\n" + "max: %i %i;\n" + "parts { part { name: \"bg\"; mouse_events: 0;\n" + "description { state: \"default\" 0.0;\n" + "image { normal: \"%s\"; }\n" + "fill { size {\n" + "relative: 0.0 0.0;\n" + "offset: %i %i;\n" + "} } } } } } }\n" + , fstrip, enc, w, h, fstrip, w, h); break; - case IMPORT_STRETCH: - fprintf(f, IMG_EDC_TMPL, file, w, h, file); + case IMPORT_CENTER: + fprintf(f, + "images { image: \"%s\" %s; }\n" + "collections {\n" + "group { name: \"desktop/background\";\n" + "max: %i %i;\n" + "parts { part { name: \"bg\"; mouse_events: 0;\n" + "description { state: \"default\" 0.0;\n" + "min: %i %i; max: %i %i\n" + "image { normal: \"%s\"; }\n" + "} } } } }\n" + , fstrip, enc, w, h, w, h, w, h, fstrip); + break; + case IMPORT_SCALE_ASPECT_IN: + fprintf(f, + "images { image: \"%s\" %s; }\n" + "collections {\n" + "group { name: \"desktop/background\";\n" + "max: %i %i;\n" + "parts { part { name: \"bg\"; mouse_events: 0;\n" + "description { state: \"default\" 0.0;\n" + "aspect: %1.9f %1.9f; aspect_preference: BOTH;\n" + "image { normal: \"%s\"; }\n" + "} } } } }\n" + , fstrip, enc, w, h, (double)w / (double)h, (double)w / (double)h, fstrip); + break; + case IMPORT_SCALE_ASPECT_OUT: + fprintf(f, + "images { image: \"%s\" %s; }\n" + "collections {\n" + "group { name: \"desktop/background\";\n" + "max: %i %i;\n" + "parts { part { name: \"bg\"; mouse_events: 0;\n" + "description { state: \"default\" 0.0;\n" + "aspect: %1.9f %1.9f; aspect_preference: NONE;\n" + "image { normal: \"%s\"; }\n" + "} } } } }\n" + , fstrip, enc, w, h, (double)w / (double)h, (double)w / (double)h, fstrip); + break; + default: + /* won't happen */ break; } - + free(fstrip); + fclose(f); snprintf(cmd, sizeof(cmd), "edje_cc -v %s %s %s", |