summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen 'Okra' Houston <smhouston88@gmail.com>2017-08-30 09:01:07 -0500
committerStephen 'Okra' Houston <smhouston88@gmail.com>2017-08-30 09:01:07 -0500
commita705f9a62690e3135295faeeb3f13eba2ac1eb3f (patch)
treea53e31c4abe21daf25d56561ed99f7339321d117
parentab43168f907cc3da747fab8297edec2b9a6515d6 (diff)
Ephoto: Ecrustify Formatting
-rw-r--r--src/bin/ephoto.c60
-rw-r--r--src/bin/ephoto.h401
-rw-r--r--src/bin/ephoto_bcg.c261
-rw-r--r--src/bin/ephoto_color.c130
-rw-r--r--src/bin/ephoto_config.c343
-rw-r--r--src/bin/ephoto_cropper.c369
-rw-r--r--src/bin/ephoto_directory_browser.c459
-rw-r--r--src/bin/ephoto_editor.c22
-rw-r--r--src/bin/ephoto_file.c750
-rw-r--r--src/bin/ephoto_filters.c285
-rw-r--r--src/bin/ephoto_hsv.c275
-rw-r--r--src/bin/ephoto_ipc.c4
-rw-r--r--src/bin/ephoto_main.c431
-rw-r--r--src/bin/ephoto_red_eye.c125
-rw-r--r--src/bin/ephoto_scale.c96
-rw-r--r--src/bin/ephoto_single_browser.c1054
-rw-r--r--src/bin/ephoto_slideshow.c663
-rw-r--r--src/bin/ephoto_thumb.c3
-rw-r--r--src/bin/ephoto_thumb_browser.c790
-rw-r--r--src/bin/ephoto_thumbnailer.c33
20 files changed, 3322 insertions, 3232 deletions
diff --git a/src/bin/ephoto.c b/src/bin/ephoto.c
index b4de0a9..826648f 100644
--- a/src/bin/ephoto.c
+++ b/src/bin/ephoto.c
@@ -30,50 +30,50 @@ elm_main(int argc, char **argv)
30 30
31 if (argc > 2) 31 if (argc > 2)
32 { 32 {
33 printf("Too Many Arguments!\n"); 33 printf("Too Many Arguments!\n");
34 _ephoto_display_usage(); 34 _ephoto_display_usage();
35 r = 1; 35 r = 1;
36 goto end; 36 goto end;
37 } 37 }
38 else if (argc < 2) 38 else if (argc < 2)
39 { 39 {
40 Evas_Object *win = ephoto_window_add(NULL); 40 Evas_Object *win = ephoto_window_add(NULL);
41 41
42 if (!win) 42 if (!win)
43 { 43 {
44 r = 1; 44 r = 1;
45 goto end; 45 goto end;
46 } 46 }
47 } 47 }
48 else if (!strncmp(argv[1], "--help", 6)) 48 else if (!strncmp(argv[1], "--help", 6))
49 { 49 {
50 _ephoto_display_usage(); 50 _ephoto_display_usage();
51 r = 0; 51 r = 0;
52 goto end; 52 goto end;
53 } 53 }
54 else 54 else
55 { 55 {
56 char *real = ecore_file_realpath(argv[1]); 56 char *real = ecore_file_realpath(argv[1]);
57 57
58 if (!real) 58 if (!real)
59 { 59 {
60 printf("invalid file or directory: '%s'\n", argv[1]); 60 printf("invalid file or directory: '%s'\n", argv[1]);
61 r = 1; 61 r = 1;
62 goto end; 62 goto end;
63 } 63 }
64 Evas_Object *win = ephoto_window_add(real); 64 Evas_Object *win = ephoto_window_add(real);
65 65
66 free(real); 66 free(real);
67 if (!win) 67 if (!win)
68 { 68 {
69 r = 1; 69 r = 1;
70 goto end; 70 goto end;
71 } 71 }
72 } 72 }
73 73
74 elm_run(); 74 elm_run();
75 75
76 end: 76end:
77 e_thumb_shutdown(); 77 e_thumb_shutdown();
78 efreet_mime_shutdown(); 78 efreet_mime_shutdown();
79 eio_shutdown(); 79 eio_shutdown();
@@ -86,8 +86,8 @@ static void
86_ephoto_display_usage(void) 86_ephoto_display_usage(void)
87{ 87{
88 printf("Ephoto Usage: \n" "ephoto --help : This page\n" 88 printf("Ephoto Usage: \n" "ephoto --help : This page\n"
89 "ephoto filename : Specifies a file to open\n" 89 "ephoto filename : Specifies a file to open\n"
90 "ephoto dirname : Specifies a directory to open\n"); 90 "ephoto dirname : Specifies a directory to open\n");
91} 91}
92 92
93ELM_MAIN() 93ELM_MAIN()
diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h
index 8450a09..92af7a2 100644
--- a/src/bin/ephoto.h
+++ b/src/bin/ephoto.h
@@ -31,148 +31,148 @@
31 31
32#if HAVE_GETTEXT && ENABLE_NLS 32#if HAVE_GETTEXT && ENABLE_NLS
33# include <libintl.h> 33# include <libintl.h>
34# define _(string) gettext (string) 34# define _(string) gettext(string)
35#else 35#else
36# define _(string) (string) 36# define _(string) (string)
37# define ngettext(String1, String2, Var) Var == 1 ? String1 : String2 37# define ngettext(String1, String2, Var) Var == 1 ? String1 : String2
38#endif 38#endif
39 39
40# define USE_IPC 40# define USE_IPC
41 41
42/*local types*/ 42/*local types*/
43typedef struct _Ephoto_Config Ephoto_Config; 43typedef struct _Ephoto_Config Ephoto_Config;
44typedef struct _Ephoto Ephoto; 44typedef struct _Ephoto Ephoto;
45typedef struct _Ephoto_Entry Ephoto_Entry; 45typedef struct _Ephoto_Entry Ephoto_Entry;
46typedef struct _Ephoto_Event_Entry_Create Ephoto_Event_Entry_Create; 46typedef struct _Ephoto_Event_Entry_Create Ephoto_Event_Entry_Create;
47 47
48typedef enum _Ephoto_State Ephoto_State; 48typedef enum _Ephoto_State Ephoto_State;
49typedef enum _Ephoto_Orient Ephoto_Orient; 49typedef enum _Ephoto_Orient Ephoto_Orient;
50typedef enum _Ephoto_Sort Ephoto_Sort; 50typedef enum _Ephoto_Sort Ephoto_Sort;
51typedef enum _Ephoto_Ipc_Domain Ephoto_Ipc_Domain; 51typedef enum _Ephoto_Ipc_Domain Ephoto_Ipc_Domain;
52 52
53/*main window functions*/ 53/*main window functions*/
54Evas_Object *ephoto_window_add(const char *path); 54Evas_Object *ephoto_window_add(const char *path);
55void ephoto_title_set(Ephoto *ephoto, const char *title); 55void ephoto_title_set(Ephoto *ephoto, const char *title);
56void ephoto_thumb_size_set(Ephoto *ephoto, int size); 56void ephoto_thumb_size_set(Ephoto *ephoto, int size);
57Evas_Object *ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, 57Evas_Object *ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent,
58 Ephoto_Entry *entry); 58 Ephoto_Entry *entry);
59void ephoto_directory_set(Ephoto *ephoto, const char *path, 59void ephoto_directory_set(Ephoto *ephoto, const char *path,
60 Elm_Object_Item *expanded, Eina_Bool dirs_only, Eina_Bool thumbs_only); 60 Elm_Object_Item *expanded, Eina_Bool dirs_only, Eina_Bool thumbs_only);
61void ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle); 61void ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle);
62 62
63/*config panel functions*/ 63/*config panel functions*/
64Eina_Bool ephoto_config_init(Ephoto *em); 64Eina_Bool ephoto_config_init(Ephoto *em);
65void ephoto_config_save(Ephoto *em); 65void ephoto_config_save(Ephoto *em);
66void ephoto_config_free(Ephoto *em); 66void ephoto_config_free(Ephoto *em);
67void ephoto_config_main(Ephoto *em); 67void ephoto_config_main(Ephoto *em);
68 68
69/*single image functions*/ 69/*single image functions*/
70Evas_Object *ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent); 70Evas_Object *ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent);
71void ephoto_single_browser_show_controls(Ephoto *ephoto); 71void ephoto_single_browser_show_controls(Ephoto *ephoto);
72void ephoto_single_browser_entries_set(Evas_Object *obj, Eina_List *entries); 72void ephoto_single_browser_entries_set(Evas_Object *obj, Eina_List *entries);
73void ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry); 73void ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
74void ephoto_single_browser_focus_set(Ephoto *ephoto); 74void ephoto_single_browser_focus_set(Ephoto *ephoto);
75void ephoto_single_browser_path_pending_set(Evas_Object *obj, 75void ephoto_single_browser_path_pending_set(Evas_Object *obj,
76 const char *path); 76 const char *path);
77void ephoto_single_browser_path_pending_unset(Evas_Object *obj); 77void ephoto_single_browser_path_pending_unset(Evas_Object *obj);
78void ephoto_single_browser_path_created(Evas_Object *obj, Ephoto_Entry *entry); 78void ephoto_single_browser_path_created(Evas_Object *obj, Ephoto_Entry *entry);
79void ephoto_single_browser_image_data_update(Evas_Object *main, 79void ephoto_single_browser_image_data_update(Evas_Object *main,
80 Evas_Object *image, unsigned int *image_data, Evas_Coord w, Evas_Coord h); 80 Evas_Object *image, unsigned int *image_data, Evas_Coord w, Evas_Coord h);
81void ephoto_single_browser_image_data_done(Evas_Object *main, 81void ephoto_single_browser_image_data_done(Evas_Object *main,
82 unsigned int *image_data, Evas_Coord w, Evas_Coord h); 82 unsigned int *image_data, Evas_Coord w, Evas_Coord h);
83void ephoto_single_browser_cancel_editing(Evas_Object *main); 83void ephoto_single_browser_cancel_editing(Evas_Object *main);
84void ephoto_single_browser_slideshow(Evas_Object *obj); 84void ephoto_single_browser_slideshow(Evas_Object *obj);
85/* smart callbacks called: "back" - the user wants to go back to the previous 85/* smart callbacks called: "back" - the user wants to go back to the previous
86 * screen. */ 86 * screen. */
87 87
88/*slideshow functions*/ 88/*slideshow functions*/
89Evas_Object *ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent); 89Evas_Object *ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent);
90void ephoto_slideshow_entries_set(Evas_Object *obj, Eina_List *entries); 90void ephoto_slideshow_entries_set(Evas_Object *obj, Eina_List *entries);
91void ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry); 91void ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
92void ephoto_slideshow_show_controls(Ephoto *ephoto); 92void ephoto_slideshow_show_controls(Ephoto *ephoto);
93/* smart callbacks called: "back" - the user wants to go back to the previous 93/* smart callbacks called: "back" - the user wants to go back to the previous
94 * screen. */ 94 * screen. */
95 95
96/*thumbnail browser functions*/ 96/*thumbnail browser functions*/
97Evas_Object *ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent); 97Evas_Object *ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent);
98void ephoto_thumb_browser_show_controls(Ephoto *ephoto); 98void ephoto_thumb_browser_show_controls(Ephoto *ephoto);
99void ephoto_thumb_browser_insert(Ephoto *ephoto, Ephoto_Entry *entry); 99void ephoto_thumb_browser_insert(Ephoto *ephoto, Ephoto_Entry *entry);
100void ephoto_thumb_browser_remove(Ephoto *ephoto, Ephoto_Entry *entry); 100void ephoto_thumb_browser_remove(Ephoto *ephoto, Ephoto_Entry *entry);
101void ephoto_thumb_browser_update(Ephoto *ephoto, Ephoto_Entry *entry); 101void ephoto_thumb_browser_update(Ephoto *ephoto, Ephoto_Entry *entry);
102void ephoto_thumb_browser_update_info_label(Ephoto *ephoto); 102void ephoto_thumb_browser_update_info_label(Ephoto *ephoto);
103void ephoto_thumb_browser_slideshow(Evas_Object *obj); 103void ephoto_thumb_browser_slideshow(Evas_Object *obj);
104void ephoto_thumb_browser_paste(Ephoto *ephoto, Elm_Object_Item *item); 104void ephoto_thumb_browser_paste(Ephoto *ephoto, Elm_Object_Item *item);
105void ephoto_thumb_browser_clear(Ephoto *ephoto); 105void ephoto_thumb_browser_clear(Ephoto *ephoto);
106void ephoto_thumb_browser_recalc(Ephoto *ephoto); 106void ephoto_thumb_browser_recalc(Ephoto *ephoto);
107void ephoto_thumb_browser_dirs_only_set(Ephoto *ephoto, Eina_Bool dirs_only); 107void ephoto_thumb_browser_dirs_only_set(Ephoto *ephoto, Eina_Bool dirs_only);
108/* smart callbacks called: "selected" - an item in the thumb browser is 108/* smart callbacks called: "selected" - an item in the thumb browser is
109 * selected. The selected Ephoto_Entry is passed as event_info argument. */ 109 * selected. The selected Ephoto_Entry is passed as event_info argument. */
110 110
111/*directory browser functions*/ 111/*directory browser functions*/
112Evas_Object *ephoto_directory_browser_add(Ephoto *ephoto, Evas_Object *parent); 112Evas_Object *ephoto_directory_browser_add(Ephoto *ephoto, Evas_Object *parent);
113void ephoto_directory_browser_initialize_structure(Ephoto *ephoto); 113void ephoto_directory_browser_initialize_structure(Ephoto *ephoto);
114void ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir); 114void ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir);
115void ephoto_directory_browser_clear(Ephoto *ephoto); 115void ephoto_directory_browser_clear(Ephoto *ephoto);
116 116
117/*thumbnailing functions taken from enlightenment*/ 117/*thumbnailing functions taken from enlightenment*/
118int e_thumb_init(void); 118int e_thumb_init(void);
119int e_thumb_shutdown(void); 119int e_thumb_shutdown(void);
120Evas_Object *e_thumb_icon_add(Evas *evas, Eina_Bool aspect); 120Evas_Object *e_thumb_icon_add(Evas *evas, Eina_Bool aspect);
121void e_thumb_icon_file_set(Evas_Object *obj, const char *file, const char *key); 121void e_thumb_icon_file_set(Evas_Object *obj, const char *file, const char *key);
122void e_thumb_icon_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h); 122void e_thumb_icon_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
123void e_thumb_icon_begin(Evas_Object *obj); 123void e_thumb_icon_begin(Evas_Object *obj);
124void e_thumb_icon_end(Evas_Object *obj); 124void e_thumb_icon_end(Evas_Object *obj);
125void e_thumb_icon_rethumb(Evas_Object *obj); 125void e_thumb_icon_rethumb(Evas_Object *obj);
126const char *e_thumb_sort_id_get(Evas_Object *obj); 126const char *e_thumb_sort_id_get(Evas_Object *obj);
127void e_thumb_client_data(Ecore_Ipc_Event_Client_Data *e); 127void e_thumb_client_data(Ecore_Ipc_Event_Client_Data *e);
128void e_thumb_client_del(Ecore_Ipc_Event_Client_Del *e); 128void e_thumb_client_del(Ecore_Ipc_Event_Client_Del *e);
129int e_ipc_init(void); 129int e_ipc_init(void);
130int e_ipc_shutdown(void); 130int e_ipc_shutdown(void);
131 131
132/*editing functions*/ 132/*editing functions*/
133Evas_Object *ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const char *title, 133Evas_Object *ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const char *title,
134 const char *data_name, void *data); 134 const char *data_name, void *data);
135void ephoto_editor_del(Evas_Object *obj, Evas_Object *parent); 135void ephoto_editor_del(Evas_Object *obj, Evas_Object *parent);
136void ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, 136void ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
137 Evas_Object *image_parent, Evas_Object *image); 137 Evas_Object *image_parent, Evas_Object *image);
138void ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, 138void ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
139 Evas_Object *image); 139 Evas_Object *image);
140void ephoto_hsv_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, 140void ephoto_hsv_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
141 Evas_Object *image); 141 Evas_Object *image);
142void ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, 142void ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
143 Evas_Object *image); 143 Evas_Object *image);
144void ephoto_red_eye_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, 144void ephoto_red_eye_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
145 Evas_Object *image); 145 Evas_Object *image);
146void ephoto_scale_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, 146void ephoto_scale_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
147 Evas_Object *image, const char *file); 147 Evas_Object *image, const char *file);
148void ephoto_filter_blur(Ephoto *ephoto, Evas_Object *image); 148void ephoto_filter_blur(Ephoto *ephoto, Evas_Object *image);
149void ephoto_filter_sharpen(Ephoto *ephoto, Evas_Object *image); 149void ephoto_filter_sharpen(Ephoto *ephoto, Evas_Object *image);
150void ephoto_filter_dither(Ephoto *ephoto, Evas_Object *image); 150void ephoto_filter_dither(Ephoto *ephoto, Evas_Object *image);
151void ephoto_filter_black_and_white(Ephoto *ephoto, Evas_Object *image); 151void ephoto_filter_black_and_white(Ephoto *ephoto, Evas_Object *image);
152void ephoto_filter_old_photo(Ephoto *ephoto, Evas_Object *image); 152void ephoto_filter_old_photo(Ephoto *ephoto, Evas_Object *image);
153void ephoto_filter_painting(Ephoto *ephoto, Evas_Object *image); 153void ephoto_filter_painting(Ephoto *ephoto, Evas_Object *image);
154void ephoto_filter_posterize(Ephoto *ephoto, Evas_Object *image); 154void ephoto_filter_posterize(Ephoto *ephoto, Evas_Object *image);
155void ephoto_filter_sketch(Ephoto *ephoto, Evas_Object *image); 155void ephoto_filter_sketch(Ephoto *ephoto, Evas_Object *image);
156void ephoto_filter_invert(Ephoto *ephoto, Evas_Object *image); 156void ephoto_filter_invert(Ephoto *ephoto, Evas_Object *image);
157void ephoto_filter_edge(Ephoto *ephoto, Evas_Object *image); 157void ephoto_filter_edge(Ephoto *ephoto, Evas_Object *image);
158void ephoto_filter_emboss(Ephoto *ephoto, Evas_Object *image); 158void ephoto_filter_emboss(Ephoto *ephoto, Evas_Object *image);
159void ephoto_filter_histogram_eq(Ephoto *ephoto, Evas_Object *image); 159void ephoto_filter_histogram_eq(Ephoto *ephoto, Evas_Object *image);
160 160
161/*file functions*/ 161/*file functions*/
162void ephoto_file_save_image(Ephoto *ephoto, Ephoto_Entry *entry, 162void ephoto_file_save_image(Ephoto *ephoto, Ephoto_Entry *entry,
163 Evas_Object *image); 163 Evas_Object *image);
164void ephoto_file_save_image_as(Ephoto *ephoto, Ephoto_Entry *entry, 164void ephoto_file_save_image_as(Ephoto *ephoto, Ephoto_Entry *entry,
165 Evas_Object *image); 165 Evas_Object *image);
166void ephoto_file_upload_image(Ephoto *ephoto, Ephoto_Entry *entry); 166void ephoto_file_upload_image(Ephoto *ephoto, Ephoto_Entry *entry);
167void ephoto_file_new_dir(Ephoto *ephoto, const char *path); 167void ephoto_file_new_dir(Ephoto *ephoto, const char *path);
168void ephoto_file_rename(Ephoto *ephoto, const char *path); 168void ephoto_file_rename(Ephoto *ephoto, const char *path);
169void ephoto_file_move(Ephoto *ephoto, Eina_List *files, const char *path); 169void ephoto_file_move(Ephoto *ephoto, Eina_List *files, const char *path);
170void ephoto_file_copy(Ephoto *ephoto, Eina_List *files, const char *path); 170void ephoto_file_copy(Ephoto *ephoto, Eina_List *files, const char *path);
171void ephoto_file_paste(Ephoto *ephoto, Eina_List *files, Eina_Bool copy, 171void ephoto_file_paste(Ephoto *ephoto, Eina_List *files, Eina_Bool copy,
172 const char *path); 172 const char *path);
173void ephoto_file_delete(Ephoto *ephoto, Eina_List *files, 173void ephoto_file_delete(Ephoto *ephoto, Eina_List *files,
174 Eina_File_Type type); 174 Eina_File_Type type);
175void ephoto_file_empty_trash(Ephoto *ephoto, Eina_List *files); 175void ephoto_file_empty_trash(Ephoto *ephoto, Eina_List *files);
176 176
177/*data types and structures*/ 177/*data types and structures*/
178 178
@@ -211,25 +211,25 @@ enum _Ephoto_Ipc_Domain
211 211
212struct _Ephoto_Config 212struct _Ephoto_Config
213{ 213{
214 int config_version; 214 int config_version;
215 int thumb_size; 215 int thumb_size;
216 int thumb_gen_size; 216 int thumb_gen_size;
217 int window_width; 217 int window_width;
218 int window_height; 218 int window_height;
219 double slideshow_timeout; 219 double slideshow_timeout;
220 double left_size; 220 double left_size;
221 double right_size; 221 double right_size;
222 const char *directory; 222 const char *directory;
223 const char *slideshow_transition; 223 const char *slideshow_transition;
224 const char *open; 224 const char *open;
225 Eina_Bool fsel_hide; 225 Eina_Bool fsel_hide;
226 Eina_Bool prompts; 226 Eina_Bool prompts;
227 Eina_Bool drop; 227 Eina_Bool drop;
228 Eina_Bool movess; 228 Eina_Bool movess;
229 Eina_Bool smooth; 229 Eina_Bool smooth;
230 Eina_Bool firstrun; 230 Eina_Bool firstrun;
231 Eina_Bool folders; 231 Eina_Bool folders;
232 Eina_Bool thumbnail_aspect; 232 Eina_Bool thumbnail_aspect;
233 Evas_Object *slide_time; 233 Evas_Object *slide_time;
234 Evas_Object *slide_trans; 234 Evas_Object *slide_trans;
235 Evas_Object *open_dir; 235 Evas_Object *open_dir;
@@ -245,47 +245,47 @@ struct _Ephoto_Config
245 245
246struct _Ephoto 246struct _Ephoto
247{ 247{
248 Evas_Object *win; 248 Evas_Object *win;
249 Evas_Object *main; 249 Evas_Object *main;
250 Evas_Object *layout; 250 Evas_Object *layout;
251 Evas_Object *pager; 251 Evas_Object *pager;
252 Evas_Object *statusbar; 252 Evas_Object *statusbar;
253 Evas_Object *folders_button; 253 Evas_Object *folders_button;
254 Evas_Object *folders_icon; 254 Evas_Object *folders_icon;
255 Evas_Object *view_button; 255 Evas_Object *view_button;
256 Evas_Object *controls_left; 256 Evas_Object *controls_left;
257 Evas_Object *controls_right; 257 Evas_Object *controls_right;
258 Evas_Object *infolabel; 258 Evas_Object *infolabel;
259 Evas_Object *exit; 259 Evas_Object *exit;
260 260
261 Evas_Object *thumb_browser; 261 Evas_Object *thumb_browser;
262 Evas_Object *single_browser; 262 Evas_Object *single_browser;
263 Evas_Object *slideshow; 263 Evas_Object *slideshow;
264 Evas_Object *dir_browser; 264 Evas_Object *dir_browser;
265 Evas_Object *file_popup; 265 Evas_Object *file_popup;
266 266
267 Eina_Bool folders_toggle; 267 Eina_Bool folders_toggle;
268 Eina_List *entries; 268 Eina_List *entries;
269 Eina_List *selentries; 269 Eina_List *selentries;
270 Eina_List *searchentries; 270 Eina_List *searchentries;
271 Eina_List *thumbs; 271 Eina_List *thumbs;
272 272
273 Eio_Monitor *monitor; 273 Eio_Monitor *monitor;
274 Eina_List *monitor_handlers; 274 Eina_List *monitor_handlers;
275 Eina_List *file_pos; 275 Eina_List *file_pos;
276 Eina_List *upload_handlers; 276 Eina_List *upload_handlers;
277 Ecore_Thread *file_thread; 277 Ecore_Thread *file_thread;
278 Ecore_Con_Url *url_up; 278 Ecore_Con_Url *url_up;
279 char *url_ret; 279 char *url_ret;
280 char *upload_error; 280 char *upload_error;
281 int file_errors; 281 int file_errors;
282 282
283 const char *top_directory; 283 const char *top_directory;
284 const char *config_path; 284 const char *config_path;
285 const char *trash_path; 285 const char *trash_path;
286 const char *destination; 286 const char *destination;
287 287
288 int thumb_gen_size; 288 int thumb_gen_size;
289 289
290 struct 290 struct
291 { 291 {
@@ -296,34 +296,34 @@ struct _Ephoto
296 Ecore_Job *change_dir; 296 Ecore_Job *change_dir;
297 } job; 297 } job;
298 298
299 Eio_File *ls; 299 Eio_File *ls;
300 300
301 Evas_Object *prefs_win; 301 Evas_Object *prefs_win;
302 Ephoto_State state, prev_state; 302 Ephoto_State state, prev_state;
303 303
304 Ephoto_Config *config; 304 Ephoto_Config *config;
305 Ephoto_Sort sort; 305 Ephoto_Sort sort;
306}; 306};
307 307
308struct _Ephoto_Entry 308struct _Ephoto_Entry
309{ 309{
310 const char *path; 310 const char *path;
311 const char *basename; 311 const char *basename;
312 const char *label; 312 const char *label;
313 const char *sort_id; 313 const char *sort_id;
314 double size; 314 double size;
315 Ephoto *ephoto; 315 Ephoto *ephoto;
316 Eio_Monitor *monitor; 316 Eio_Monitor *monitor;
317 Eina_List *monitor_handlers; 317 Eina_List *monitor_handlers;
318 Elm_Object_Item *item; 318 Elm_Object_Item *item;
319 Elm_Object_Item *parent; 319 Elm_Object_Item *parent;
320 Eina_List *free_listeners; 320 Eina_List *free_listeners;
321 Eina_Bool is_dir; 321 Eina_Bool is_dir;
322 Eina_Bool is_link; 322 Eina_Bool is_link;
323 Eina_Bool no_delete; 323 Eina_Bool no_delete;
324 Evas_Object *genlist; 324 Evas_Object *genlist;
325 Evas_Object *gengrid; 325 Evas_Object *gengrid;
326 Evas_Object *thumb; 326 Evas_Object *thumb;
327}; 327};
328 328
329struct _Ephoto_Event_Entry_Create 329struct _Ephoto_Event_Entry_Create
@@ -333,15 +333,15 @@ struct _Ephoto_Event_Entry_Create
333 333
334/*ephoto file functions*/ 334/*ephoto file functions*/
335Ephoto_Entry *ephoto_entry_new(Ephoto *ephoto, const char *path, 335Ephoto_Entry *ephoto_entry_new(Ephoto *ephoto, const char *path,
336 const char *label, Eina_File_Type type); 336 const char *label, Eina_File_Type type);
337Eina_Bool ephoto_entry_exists(Ephoto *ephoto, const char *path); 337Eina_Bool ephoto_entry_exists(Ephoto *ephoto, const char *path);
338void ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry); 338void ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry);
339void ephoto_entry_free_listener_add(Ephoto_Entry *entry, 339void ephoto_entry_free_listener_add(Ephoto_Entry *entry,
340 void (*cb) (void *data, const Ephoto_Entry *entry), const void *data); 340 void (*cb)(void *data, const Ephoto_Entry *entry), const void *data);
341void ephoto_entry_free_listener_del(Ephoto_Entry *entry, 341void ephoto_entry_free_listener_del(Ephoto_Entry *entry,
342 void (*cb) (void *data, const Ephoto_Entry *entry), const void *data); 342 void (*cb)(void *data, const Ephoto_Entry *entry), const void *data);
343void ephoto_entries_free(Ephoto *ephoto); 343void ephoto_entries_free(Ephoto *ephoto);
344int ephoto_entries_cmp(const void *pa, const void *pb); 344int ephoto_entries_cmp(const void *pa, const void *pb);
345 345
346/*check if image can be loaded*/ 346/*check if image can be loaded*/
347static inline Eina_Bool 347static inline Eina_Bool
@@ -361,20 +361,20 @@ _ephoto_eina_file_direct_info_image_useful(const Eina_File_Direct_Info *info)
361 361
362 bname = info->path + info->name_start; 362 bname = info->path + info->name_start;
363 if (bname[0] == '.') 363 if (bname[0] == '.')
364 return EINA_FALSE; 364 return EINA_FALSE;
365 if ((info->type != EINA_FILE_REG) && (info->type != EINA_FILE_UNKNOWN) && 365 if ((info->type != EINA_FILE_REG) && (info->type != EINA_FILE_UNKNOWN) &&
366 (info->type != EINA_FILE_LNK)) 366 (info->type != EINA_FILE_LNK))
367 return EINA_FALSE; 367 return EINA_FALSE;
368 368
369 type = strrchr(bname, '.'); 369 type = strrchr(bname, '.');
370 if (!type) 370 if (!type)
371 return EINA_FALSE; 371 return EINA_FALSE;
372 count = sizeof(filters) / sizeof(filters[0]); 372 count = sizeof(filters) / sizeof(filters[0]);
373 373
374 for (i = 0; i < count; i++) 374 for (i = 0; i < count; i++)
375 { 375 {
376 if (!strcasecmp(type + 1, filters[i])) 376 if (!strcasecmp(type + 1, filters[i]))
377 return evas_object_image_extension_can_load_get(bname); 377 return evas_object_image_extension_can_load_get(bname);
378 } 378 }
379 return EINA_FALSE; 379 return EINA_FALSE;
380} 380}
@@ -393,7 +393,7 @@ _ephoto_file_image_can_save(const char *ext)
393 for (i = 0; i < count; i++) 393 for (i = 0; i < count; i++)
394 { 394 {
395 if (!strcasecmp(ext, filters[i])) 395 if (!strcasecmp(ext, filters[i]))
396 return EINA_TRUE; 396 return EINA_TRUE;
397 } 397 }
398 return EINA_FALSE; 398 return EINA_FALSE;
399} 399}
@@ -408,7 +408,7 @@ ephoto_normalize_color(int color)
408static inline int 408static inline int
409ephoto_mul_color_alpha(int color, int alpha) 409ephoto_mul_color_alpha(int color, int alpha)
410{ 410{
411 return (alpha > 0 && alpha <= 255) ? (color * (255 /alpha)) : color; 411 return (alpha > 0 && alpha <= 255) ? (color * (255 / alpha)) : color;
412} 412}
413 413
414static inline int 414static inline int
@@ -427,15 +427,14 @@ extern int EPHOTO_EVENT_EDITOR_APPLY;
427extern int EPHOTO_EVENT_EDITOR_CANCEL; 427extern int EPHOTO_EVENT_EDITOR_CANCEL;
428extern int EPHOTO_EVENT_EDITOR_BACK; 428extern int EPHOTO_EVENT_EDITOR_BACK;
429 429
430 430#define CRIT(...) EINA_LOG_CRIT(__VA_ARGS__)
431#define CRIT(...) EINA_LOG_CRIT(__VA_ARGS__) 431#define ERR(...) EINA_LOG_ERR(__VA_ARGS__)
432#define ERR(...) EINA_LOG_ERR(__VA_ARGS__) 432#define WRN(...) EINA_LOG_WARN(__VA_ARGS__)
433#define WRN(...) EINA_LOG_WARN(__VA_ARGS__) 433#define INF(...) EINA_LOG_INFO(__VA_ARGS__)
434#define INF(...) EINA_LOG_INFO(__VA_ARGS__) 434#define DBG(...) EINA_LOG_DBG(__VA_ARGS__)
435#define DBG(...) EINA_LOG_DBG(__VA_ARGS__)
436#define EPHOTO_WEIGHT evas_object_size_hint_weight_set 435#define EPHOTO_WEIGHT evas_object_size_hint_weight_set
437#define EPHOTO_ALIGN evas_object_size_hint_align_set 436#define EPHOTO_ALIGN evas_object_size_hint_align_set
438#define EPHOTO_EXPAND(X) EPHOTO_WEIGHT((X), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND) 437#define EPHOTO_EXPAND(X) EPHOTO_WEIGHT((X), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
439#define EPHOTO_FILL(X) EPHOTO_ALIGN((X), EVAS_HINT_FILL, EVAS_HINT_FILL) 438#define EPHOTO_FILL(X) EPHOTO_ALIGN((X), EVAS_HINT_FILL, EVAS_HINT_FILL)
440 439
441#endif 440#endif
diff --git a/src/bin/ephoto_bcg.c b/src/bin/ephoto_bcg.c
index 4bd0815..9c4fa11 100644
--- a/src/bin/ephoto_bcg.c
+++ b/src/bin/ephoto_bcg.c
@@ -3,24 +3,24 @@
3typedef struct _Ephoto_BCG Ephoto_BCG; 3typedef struct _Ephoto_BCG Ephoto_BCG;
4struct _Ephoto_BCG 4struct _Ephoto_BCG
5{ 5{
6 Evas_Object *main; 6 Evas_Object *main;
7 Evas_Object *parent; 7 Evas_Object *parent;
8 Evas_Object *image; 8 Evas_Object *image;
9 Evas_Object *editor; 9 Evas_Object *editor;
10 Evas_Object *bslider; 10 Evas_Object *bslider;
11 Evas_Object *cslider; 11 Evas_Object *cslider;
12 Evas_Object *gslider; 12 Evas_Object *gslider;
13 Eina_List *handlers; 13 Eina_List *handlers;
14 int contrast; 14 int contrast;
15 int brightness; 15 int brightness;
16 double gamma; 16 double gamma;
17 Evas_Coord w, h; 17 Evas_Coord w, h;
18 unsigned int *original_im_data; 18 unsigned int *original_im_data;
19}; 19};
20 20
21unsigned int * 21unsigned int *
22_ephoto_bcg_adjust_brightness(Ephoto_BCG *ebcg, int brightness, 22_ephoto_bcg_adjust_brightness(Ephoto_BCG *ebcg, int brightness,
23 unsigned int *image_data) 23 unsigned int *image_data)
24{ 24{
25 unsigned int *im_data, *im_data_new, *p1, *p2; 25 unsigned int *im_data, *im_data_new, *p1, *p2;
26 Evas_Coord x, y; 26 Evas_Coord x, y;
@@ -28,50 +28,50 @@ _ephoto_bcg_adjust_brightness(Ephoto_BCG *ebcg, int brightness,
28 28
29 im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); 29 im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
30 if (image_data) 30 if (image_data)
31 memcpy(im_data, image_data, sizeof(unsigned int) * ebcg->w * ebcg->h); 31 memcpy(im_data, image_data, sizeof(unsigned int) * ebcg->w * ebcg->h);
32 else 32 else
33 memcpy(im_data, ebcg->original_im_data, 33 memcpy(im_data, ebcg->original_im_data,
34 sizeof(unsigned int) * ebcg->w * ebcg->h); 34 sizeof(unsigned int) * ebcg->w * ebcg->h);
35 35
36 ebcg->brightness = brightness; 36 ebcg->brightness = brightness;
37 im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); 37 im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
38 38
39 for (y = 0; y < ebcg->h; y++) 39 for (y = 0; y < ebcg->h; y++)
40 { 40 {
41 p1 = im_data + (y * ebcg->w); 41 p1 = im_data + (y * ebcg->w);
42 p2 = im_data_new + (y * ebcg->w); 42 p2 = im_data_new + (y * ebcg->w);
43 for (x = 0; x < ebcg->w; x++) 43 for (x = 0; x < ebcg->w; x++)
44 { 44 {
45 b = (int) ((*p1) & 0xff); 45 b = (int)((*p1) & 0xff);
46 g = (int) ((*p1 >> 8) & 0xff); 46 g = (int)((*p1 >> 8) & 0xff);
47 r = (int) ((*p1 >> 16) & 0xff); 47 r = (int)((*p1 >> 16) & 0xff);
48 a = (int) ((*p1 >> 24) & 0xff); 48 a = (int)((*p1 >> 24) & 0xff);
49 b = ephoto_mul_color_alpha(b, a); 49 b = ephoto_mul_color_alpha(b, a);
50 g = ephoto_mul_color_alpha(g, a); 50 g = ephoto_mul_color_alpha(g, a);
51 r = ephoto_mul_color_alpha(r, a); 51 r = ephoto_mul_color_alpha(r, a);
52 bb = (int) b + ebcg->brightness; 52 bb = (int)b + ebcg->brightness;
53 gg = (int) g + ebcg->brightness; 53 gg = (int)g + ebcg->brightness;
54 rr = (int) r + ebcg->brightness; 54 rr = (int)r + ebcg->brightness;
55 bb = ephoto_normalize_color(bb); 55 bb = ephoto_normalize_color(bb);
56 gg = ephoto_normalize_color(gg); 56 gg = ephoto_normalize_color(gg);
57 rr = ephoto_normalize_color(rr); 57 rr = ephoto_normalize_color(rr);
58 bb = ephoto_demul_color_alpha(bb, a); 58 bb = ephoto_demul_color_alpha(bb, a);
59 gg = ephoto_demul_color_alpha(gg, a); 59 gg = ephoto_demul_color_alpha(gg, a);
60 rr = ephoto_demul_color_alpha(rr, a); 60 rr = ephoto_demul_color_alpha(rr, a);
61 *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; 61 *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
62 p2++; 62 p2++;
63 p1++; 63 p1++;
64 } 64 }
65 } 65 }
66 ephoto_single_browser_image_data_update(ebcg->main, ebcg->image, 66 ephoto_single_browser_image_data_update(ebcg->main, ebcg->image,
67 im_data_new, ebcg->w, ebcg->h); 67 im_data_new, ebcg->w, ebcg->h);
68 free(im_data); 68 free(im_data);
69 return im_data_new; 69 return im_data_new;
70} 70}
71 71
72unsigned int * 72unsigned int *
73_ephoto_bcg_adjust_contrast(Ephoto_BCG *ebcg, int contrast, 73_ephoto_bcg_adjust_contrast(Ephoto_BCG *ebcg, int contrast,
74 unsigned int *image_data) 74 unsigned int *image_data)
75{ 75{
76 unsigned int *im_data, *im_data_new, *p1, *p2; 76 unsigned int *im_data, *im_data_new, *p1, *p2;
77 Evas_Coord x, y; 77 Evas_Coord x, y;
@@ -80,53 +80,53 @@ _ephoto_bcg_adjust_contrast(Ephoto_BCG *ebcg, int contrast,
80 80
81 im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); 81 im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
82 if (image_data) 82 if (image_data)
83 memcpy(im_data, image_data, sizeof(unsigned int) * ebcg->w * ebcg->h); 83 memcpy(im_data, image_data, sizeof(unsigned int) * ebcg->w * ebcg->h);
84 else 84 else
85 memcpy(im_data, ebcg->original_im_data, 85 memcpy(im_data, ebcg->original_im_data,
86 sizeof(unsigned int) * ebcg->w * ebcg->h); 86 sizeof(unsigned int) * ebcg->w * ebcg->h);
87 87
88 ebcg->contrast = contrast; 88 ebcg->contrast = contrast;
89 top = ((255 + (contrast)) * 259); 89 top = ((255 + (contrast)) * 259);
90 bottom = ((259 - (contrast)) * 255); 90 bottom = ((259 - (contrast)) * 255);
91 factor = (float) top / (float) bottom; 91 factor = (float)top / (float)bottom;
92 im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); 92 im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
93 93
94 for (y = 0; y < ebcg->h; y++) 94 for (y = 0; y < ebcg->h; y++)
95 { 95 {
96 p1 = im_data + (y * ebcg->w); 96 p1 = im_data + (y * ebcg->w);
97 p2 = im_data_new + (y * ebcg->w); 97 p2 = im_data_new + (y * ebcg->w);
98 for (x = 0; x < ebcg->w; x++) 98 for (x = 0; x < ebcg->w; x++)
99 { 99 {
100 b = (int) ((*p1) & 0xff); 100 b = (int)((*p1) & 0xff);
101 g = (int) ((*p1 >> 8) & 0xff); 101 g = (int)((*p1 >> 8) & 0xff);
102 r = (int) ((*p1 >> 16) & 0xff); 102 r = (int)((*p1 >> 16) & 0xff);
103 a = (int) ((*p1 >> 24) & 0xff); 103 a = (int)((*p1 >> 24) & 0xff);
104 b = ephoto_mul_color_alpha(b, a); 104 b = ephoto_mul_color_alpha(b, a);
105 g = ephoto_mul_color_alpha(g, a); 105 g = ephoto_mul_color_alpha(g, a);
106 r = ephoto_mul_color_alpha(r, a); 106 r = ephoto_mul_color_alpha(r, a);
107 bb = (int) ((factor * (b - 128)) + 128); 107 bb = (int)((factor * (b - 128)) + 128);
108 gg = (int) ((factor * (g - 128)) + 128); 108 gg = (int)((factor * (g - 128)) + 128);
109 rr = (int) ((factor * (r - 128)) + 128); 109 rr = (int)((factor * (r - 128)) + 128);
110 bb = ephoto_normalize_color(bb); 110 bb = ephoto_normalize_color(bb);
111 gg = ephoto_normalize_color(gg); 111 gg = ephoto_normalize_color(gg);
112 rr = ephoto_normalize_color(rr); 112 rr = ephoto_normalize_color(rr);
113 bb = ephoto_demul_color_alpha(bb, a); 113 bb = ephoto_demul_color_alpha(bb, a);
114 gg = ephoto_demul_color_alpha(gg, a); 114 gg = ephoto_demul_color_alpha(gg, a);
115 rr = ephoto_demul_color_alpha(rr, a); 115 rr = ephoto_demul_color_alpha(rr, a);
116 *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; 116 *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
117 p2++; 117 p2++;
118 p1++; 118 p1++;
119 } 119 }
120 } 120 }
121 ephoto_single_browser_image_data_update(ebcg->main, ebcg->image, 121 ephoto_single_browser_image_data_update(ebcg->main, ebcg->image,
122 im_data_new, ebcg->w, ebcg->h); 122 im_data_new, ebcg->w, ebcg->h);
123 free(im_data); 123 free(im_data);
124 return im_data_new; 124 return im_data_new;
125} 125}
126 126
127unsigned int * 127unsigned int *
128_ephoto_bcg_adjust_gamma(Ephoto_BCG *ebcg, double gamma, 128_ephoto_bcg_adjust_gamma(Ephoto_BCG *ebcg, double gamma,
129 unsigned int *image_data) 129 unsigned int *image_data)
130{ 130{
131 unsigned int *im_data, *im_data_new, *p1, *p2; 131 unsigned int *im_data, *im_data_new, *p1, *p2;
132 Evas_Coord x, y; 132 Evas_Coord x, y;
@@ -134,50 +134,50 @@ _ephoto_bcg_adjust_gamma(Ephoto_BCG *ebcg, double gamma,
134 134
135 im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); 135 im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
136 if (image_data) 136 if (image_data)
137 memcpy(im_data, image_data, sizeof(unsigned int) * ebcg->w * ebcg->h); 137 memcpy(im_data, image_data, sizeof(unsigned int) * ebcg->w * ebcg->h);
138 else 138 else
139 memcpy(im_data, ebcg->original_im_data, 139 memcpy(im_data, ebcg->original_im_data,
140 sizeof(unsigned int) * ebcg->w * ebcg->h); 140 sizeof(unsigned int) * ebcg->w * ebcg->h);
141 141
142 ebcg->gamma = 1 / gamma; 142 ebcg->gamma = 1 / gamma;
143 im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); 143 im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
144 144
145 for (y = 0; y < ebcg->h; y++) 145 for (y = 0; y < ebcg->h; y++)
146 { 146 {
147 p1 = im_data + (y * ebcg->w); 147 p1 = im_data + (y * ebcg->w);
148 p2 = im_data_new + (y * ebcg->w); 148 p2 = im_data_new + (y * ebcg->w);
149 for (x = 0; x < ebcg->w; x++) 149 for (x = 0; x < ebcg->w; x++)
150 { 150 {
151 b = (int) ((*p1) & 0xff); 151 b = (int)((*p1) & 0xff);
152 g = (int) ((*p1 >> 8) & 0xff); 152 g = (int)((*p1 >> 8) & 0xff);
153 r = (int) ((*p1 >> 16) & 0xff); 153 r = (int)((*p1 >> 16) & 0xff);
154 a = (int) ((*p1 >> 24) & 0xff); 154 a = (int)((*p1 >> 24) & 0xff);
155 b = ephoto_mul_color_alpha(b, a); 155 b = ephoto_mul_color_alpha(b, a);
156 g = ephoto_mul_color_alpha(g, a); 156 g = ephoto_mul_color_alpha(g, a);
157 r = ephoto_mul_color_alpha(r, a); 157 r = ephoto_mul_color_alpha(r, a);
158 bb = (int) (pow(((double) b / 255), ebcg->gamma) * 255); 158 bb = (int)(pow(((double)b / 255), ebcg->gamma) * 255);
159 gg = (int) (pow(((double) g / 255), ebcg->gamma) * 255); 159 gg = (int)(pow(((double)g / 255), ebcg->gamma) * 255);
160 rr = (int) (pow(((double) r / 255), ebcg->gamma) * 255); 160 rr = (int)(pow(((double)r / 255), ebcg->gamma) * 255);
161 bb = ephoto_normalize_color(bb); 161 bb = ephoto_normalize_color(bb);
162 gg = ephoto_normalize_color(gg); 162 gg = ephoto_normalize_color(gg);
163 rr = ephoto_normalize_color(rr); 163 rr = ephoto_normalize_color(rr);
164 bb = ephoto_demul_color_alpha(bb, a); 164 bb = ephoto_demul_color_alpha(bb, a);
165 gg = ephoto_demul_color_alpha(gg, a); 165 gg = ephoto_demul_color_alpha(gg, a);
166 rr = ephoto_demul_color_alpha(rr, a); 166 rr = ephoto_demul_color_alpha(rr, a);
167 *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; 167 *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
168 p2++; 168 p2++;
169 p1++; 169 p1++;
170 } 170 }
171 } 171 }
172 ephoto_single_browser_image_data_update(ebcg->main, ebcg->image, 172 ephoto_single_browser_image_data_update(ebcg->main, ebcg->image,
173 im_data_new, ebcg->w, ebcg->h); 173 im_data_new, ebcg->w, ebcg->h);
174 free(im_data); 174 free(im_data);
175 return im_data_new; 175 return im_data_new;
176} 176}
177 177
178static void 178static void
179_brightness_slider_changed(void *data, Evas_Object *obj, 179_brightness_slider_changed(void *data, Evas_Object *obj,
180 void *event_info EINA_UNUSED) 180 void *event_info EINA_UNUSED)
181{ 181{
182 Ephoto_BCG *ebcg = data; 182 Ephoto_BCG *ebcg = data;
183 int brightness; 183 int brightness;
@@ -186,13 +186,13 @@ _brightness_slider_changed(void *data, Evas_Object *obj,
186 brightness = elm_slider_value_get(obj); 186 brightness = elm_slider_value_get(obj);
187 image_data = _ephoto_bcg_adjust_brightness(ebcg, brightness, NULL); 187 image_data = _ephoto_bcg_adjust_brightness(ebcg, brightness, NULL);
188 image_data_two = 188 image_data_two =
189 _ephoto_bcg_adjust_contrast(ebcg, ebcg->contrast, image_data); 189 _ephoto_bcg_adjust_contrast(ebcg, ebcg->contrast, image_data);
190 _ephoto_bcg_adjust_gamma(ebcg, ebcg->gamma, image_data_two); 190 _ephoto_bcg_adjust_gamma(ebcg, ebcg->gamma, image_data_two);
191} 191}
192 192
193static void 193static void
194_contrast_slider_changed(void *data, Evas_Object *obj, 194_contrast_slider_changed(void *data, Evas_Object *obj,
195 void *event_info EINA_UNUSED) 195 void *event_info EINA_UNUSED)
196{ 196{
197 Ephoto_BCG *ebcg = data; 197 Ephoto_BCG *ebcg = data;
198 int contrast; 198 int contrast;
@@ -201,13 +201,13 @@ _contrast_slider_changed(void *data, Evas_Object *obj,
201 contrast = elm_slider_value_get(obj); 201 contrast = elm_slider_value_get(obj);
202 image_data = _ephoto_bcg_adjust_contrast(ebcg, contrast, NULL); 202 image_data = _ephoto_bcg_adjust_contrast(ebcg, contrast, NULL);
203 image_data_two = 203 image_data_two =
204 _ephoto_bcg_adjust_brightness(ebcg, ebcg->brightness, image_data); 204 _ephoto_bcg_adjust_brightness(ebcg, ebcg->brightness, image_data);
205 _ephoto_bcg_adjust_gamma(ebcg, ebcg->gamma, image_data_two); 205 _ephoto_bcg_adjust_gamma(ebcg, ebcg->gamma, image_data_two);
206} 206}
207 207
208static void 208static void
209_gamma_slider_changed(void *data, Evas_Object *obj, 209_gamma_slider_changed(void *data, Evas_Object *obj,
210 void *event_info EINA_UNUSED) 210 void *event_info EINA_UNUSED)
211{ 211{
212 Ephoto_BCG *ebcg = data; 212 Ephoto_BCG *ebcg = data;
213 double gamma; 213 double gamma;
@@ -216,13 +216,13 @@ _gamma_slider_changed(void *data, Evas_Object *obj,
216 gamma = elm_slider_value_get(obj); 216 gamma = elm_slider_value_get(obj);
217 image_data = _ephoto_bcg_adjust_gamma(ebcg, gamma, NULL); 217 image_data = _ephoto_bcg_adjust_gamma(ebcg, gamma, NULL);
218 image_data_two = 218 image_data_two =
219 _ephoto_bcg_adjust_brightness(ebcg, ebcg->brightness, image_data); 219 _ephoto_bcg_adjust_brightness(ebcg, ebcg->brightness, image_data);
220 _ephoto_bcg_adjust_contrast(ebcg, ebcg->contrast, image_data_two); 220 _ephoto_bcg_adjust_contrast(ebcg, ebcg->contrast, image_data_two);
221} 221}
222 222
223static Eina_Bool 223static Eina_Bool
224_bcg_reset(void *data, int type EINA_UNUSED, 224_bcg_reset(void *data, int type EINA_UNUSED,
225 void *event_info EINA_UNUSED) 225 void *event_info EINA_UNUSED)
226{ 226{
227 Ephoto_BCG *ebcg = data; 227 Ephoto_BCG *ebcg = data;
228 228
@@ -239,7 +239,7 @@ _bcg_reset(void *data, int type EINA_UNUSED,
239 239
240static Eina_Bool 240static Eina_Bool
241_bcg_apply(void *data, int type EINA_UNUSED, 241_bcg_apply(void *data, int type EINA_UNUSED,
242 void *event_info EINA_UNUSED) 242 void *event_info EINA_UNUSED)
243{ 243{
244 Ephoto_BCG *ebcg = data; 244 Ephoto_BCG *ebcg = data;
245 unsigned int *image_data; 245 unsigned int *image_data;
@@ -254,7 +254,7 @@ _bcg_apply(void *data, int type EINA_UNUSED,
254 else 254 else
255 { 255 {
256 image_data = 256 image_data =
257 evas_object_image_data_get(ebcg->image, EINA_FALSE); 257 evas_object_image_data_get(ebcg->image, EINA_FALSE);
258 evas_object_image_size_get(ebcg->image, &w, &h); 258 evas_object_image_size_get(ebcg->image, &w, &h);
259 ephoto_single_browser_image_data_done(ebcg->main, image_data, w, h); 259 ephoto_single_browser_image_data_done(ebcg->main, image_data, w, h);
260 } 260 }
@@ -265,7 +265,7 @@ _bcg_apply(void *data, int type EINA_UNUSED,
265 265
266static Eina_Bool 266static Eina_Bool
267_bcg_cancel(void *data, int type EINA_UNUSED, 267_bcg_cancel(void *data, int type EINA_UNUSED,
268 void *event_info EINA_UNUSED) 268 void *event_info EINA_UNUSED)
269{ 269{
270 Ephoto_BCG *ebcg = data; 270 Ephoto_BCG *ebcg = data;
271 271
@@ -284,7 +284,7 @@ _bcg_cancel(void *data, int type EINA_UNUSED,
284 284
285static void 285static void
286_editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 286_editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
287 void *event_info EINA_UNUSED) 287 void *event_info EINA_UNUSED)
288{ 288{
289 Ephoto_BCG *ebcg = data; 289 Ephoto_BCG *ebcg = data;
290 Ecore_Event_Handler *handler; 290 Ecore_Event_Handler *handler;
@@ -314,18 +314,18 @@ ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje
314 ebcg->parent = parent; 314 ebcg->parent = parent;
315 ebcg->image = image; 315 ebcg->image = image;
316 im_data = 316 im_data =
317 evas_object_image_data_get(ebcg->image, 317 evas_object_image_data_get(ebcg->image,
318 EINA_FALSE); 318 EINA_FALSE);
319 evas_object_image_size_get(ebcg->image, &ebcg->w, 319 evas_object_image_size_get(ebcg->image, &ebcg->w,
320 &ebcg->h); 320 &ebcg->h);
321 ebcg->original_im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); 321 ebcg->original_im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
322 memcpy(ebcg->original_im_data, im_data, 322 memcpy(ebcg->original_im_data, im_data,
323 sizeof(unsigned int) * ebcg->w * ebcg->h); 323 sizeof(unsigned int) * ebcg->w * ebcg->h);
324 324
325 ebcg->editor = ephoto_editor_add(ephoto, parent, _("Brightness/Contrast/Gamma"), 325 ebcg->editor = ephoto_editor_add(ephoto, parent, _("Brightness/Contrast/Gamma"),
326 "ebcg", ebcg); 326 "ebcg", ebcg);
327 evas_object_event_callback_add(ebcg->editor, EVAS_CALLBACK_DEL, _editor_del, 327 evas_object_event_callback_add(ebcg->editor, EVAS_CALLBACK_DEL, _editor_del,
328 ebcg); 328 ebcg);
329 329
330 slider = elm_slider_add(ebcg->editor); 330 slider = elm_slider_add(ebcg->editor);
331 elm_object_text_set(slider, _("Gamma")); 331 elm_object_text_set(slider, _("Gamma"));
@@ -337,7 +337,7 @@ ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje
337 EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 337 EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
338 EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); 338 EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
339 evas_object_smart_callback_add(slider, "delay,changed", 339 evas_object_smart_callback_add(slider, "delay,changed",
340 _gamma_slider_changed, ebcg); 340 _gamma_slider_changed, ebcg);
341 elm_box_pack_start(ebcg->editor, slider); 341 elm_box_pack_start(ebcg->editor, slider);
342 evas_object_show(slider); 342 evas_object_show(slider);
343 ebcg->gslider = slider; 343 ebcg->gslider = slider;
@@ -352,7 +352,7 @@ ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje
352 EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 352 EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
353 EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); 353 EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
354 evas_object_smart_callback_add(slider, "delay,changed", 354 evas_object_smart_callback_add(slider, "delay,changed",
355 _contrast_slider_changed, ebcg); 355 _contrast_slider_changed, ebcg);
356 elm_box_pack_start(ebcg->editor, slider); 356 elm_box_pack_start(ebcg->editor, slider);
357 evas_object_show(slider); 357 evas_object_show(slider);
358 ebcg->cslider = slider; 358 ebcg->cslider = slider;
@@ -367,26 +367,27 @@ ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje
367 EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 367 EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
368 EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); 368 EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
369 evas_object_smart_callback_add(slider, "delay,changed", 369 evas_object_smart_callback_add(slider, "delay,changed",
370 _brightness_slider_changed, ebcg); 370 _brightness_slider_changed, ebcg);
371 elm_box_pack_start(ebcg->editor, slider); 371 elm_box_pack_start(ebcg->editor, slider);
372 evas_object_show(slider); 372 evas_object_show(slider);
373 ebcg->bslider = slider; 373 ebcg->bslider = slider;
374 374
375 ebcg->handlers = 375 ebcg->handlers =
376 eina_list_append(ebcg->handlers, 376 eina_list_append(ebcg->handlers,
377 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, 377 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET,
378 _bcg_reset, ebcg)); 378 _bcg_reset, ebcg));
379 ebcg->handlers = 379 ebcg->handlers =
380 eina_list_append(ebcg->handlers, 380 eina_list_append(ebcg->handlers,
381 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, 381 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY,
382 _bcg_apply, ebcg)); 382 _bcg_apply, ebcg));
383 ebcg->handlers = 383 ebcg->handlers =
384 eina_list_append(ebcg->handlers, 384 eina_list_append(ebcg->handlers,
385 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, 385 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL,
386 _bcg_cancel, ebcg)); 386 _bcg_cancel, ebcg));
387 387
388 return; 388 return;
389 389
390 error: 390error:
391 return; 391 return;
392} 392}
393
diff --git a/src/bin/ephoto_color.c b/src/bin/ephoto_color.c
index 15d0465..36a0f20 100644
--- a/src/bin/ephoto_color.c
+++ b/src/bin/ephoto_color.c
@@ -3,18 +3,18 @@
3typedef struct _Ephoto_Color Ephoto_Color; 3typedef struct _Ephoto_Color Ephoto_Color;
4struct _Ephoto_Color 4struct _Ephoto_Color
5{ 5{
6 Evas_Object *main; 6 Evas_Object *main;
7 Evas_Object *parent; 7 Evas_Object *parent;
8 Evas_Object *image; 8 Evas_Object *image;
9 Evas_Object *editor; 9 Evas_Object *editor;
10 Evas_Object *bslider; 10 Evas_Object *bslider;
11 Evas_Object *gslider; 11 Evas_Object *gslider;
12 Evas_Object *rslider; 12 Evas_Object *rslider;
13 Eina_List *handlers; 13 Eina_List *handlers;
14 int blue; 14 int blue;
15 int green; 15 int green;
16 int red; 16 int red;
17 Evas_Coord w, h; 17 Evas_Coord w, h;
18 unsigned int *original_im_data; 18 unsigned int *original_im_data;
19}; 19};
20 20
@@ -35,10 +35,10 @@ _ephoto_apply_color_adjustment(Ephoto_Color *eco, unsigned int *image_data, int
35 35
36 im_data = malloc(sizeof(unsigned int) * eco->w * eco->h); 36 im_data = malloc(sizeof(unsigned int) * eco->w * eco->h);
37 if (image_data) 37 if (image_data)
38 memcpy(im_data, image_data, sizeof(unsigned int) * eco->w * eco->h); 38 memcpy(im_data, image_data, sizeof(unsigned int) * eco->w * eco->h);
39 else 39 else
40 memcpy(im_data, eco->original_im_data, 40 memcpy(im_data, eco->original_im_data,
41 sizeof(unsigned int) * eco->w * eco->h); 41 sizeof(unsigned int) * eco->w * eco->h);
42 42
43 im_data_new = malloc(sizeof(unsigned int) * eco->w * eco->h); 43 im_data_new = malloc(sizeof(unsigned int) * eco->w * eco->h);
44 44
@@ -48,32 +48,35 @@ _ephoto_apply_color_adjustment(Ephoto_Color *eco, unsigned int *image_data, int
48 p2 = im_data_new + (y * eco->w); 48 p2 = im_data_new + (y * eco->w);
49 for (x = 0; x < eco->w; x++) 49 for (x = 0; x < eco->w; x++)
50 { 50 {
51 b = (int) ((*p1) & 0xff); 51 b = (int)((*p1) & 0xff);
52 g = (int) ((*p1 >> 8) & 0xff); 52 g = (int)((*p1 >> 8) & 0xff);
53 r = (int) ((*p1 >> 16) & 0xff); 53 r = (int)((*p1 >> 16) & 0xff);
54 a = (int) ((*p1 >> 24) & 0xff); 54 a = (int)((*p1 >> 24) & 0xff);
55 b = ephoto_mul_color_alpha(b, a); 55 b = ephoto_mul_color_alpha(b, a);
56 g = ephoto_mul_color_alpha(g, a); 56 g = ephoto_mul_color_alpha(g, a);
57 r = ephoto_mul_color_alpha(r, a); 57 r = ephoto_mul_color_alpha(r, a);
58 switch (color) 58 switch (color)
59 { 59 {
60 case EPHOTO_COLOR_ADJUST_RED: 60 case EPHOTO_COLOR_ADJUST_RED:
61 eco->red = adjust; 61 eco->red = adjust;
62 cc = (int) r + eco->red; 62 cc = (int)r + eco->red;
63 r = cc; 63 r = cc;
64 break; 64 break;
65 case EPHOTO_COLOR_ADJUST_BLUE: 65
66 eco->blue = adjust; 66 case EPHOTO_COLOR_ADJUST_BLUE:
67 cc = (int) b + eco->blue; 67 eco->blue = adjust;
68 b = cc; 68 cc = (int)b + eco->blue;
69 break; 69 b = cc;
70 case EPHOTO_COLOR_ADJUST_GREEN: 70 break;
71 eco->green = adjust; 71
72 cc = (int) g + eco->green; 72 case EPHOTO_COLOR_ADJUST_GREEN:
73 g = cc; 73 eco->green = adjust;
74 break; 74 cc = (int)g + eco->green;
75 default: 75 g = cc;
76 break; 76 break;
77
78 default:
79 break;
77 } 80 }
78 b = ephoto_normalize_color(b); 81 b = ephoto_normalize_color(b);
79 g = ephoto_normalize_color(g); 82 g = ephoto_normalize_color(g);
@@ -87,7 +90,7 @@ _ephoto_apply_color_adjustment(Ephoto_Color *eco, unsigned int *image_data, int
87 } 90 }
88 } 91 }
89 ephoto_single_browser_image_data_update(eco->main, eco->image, 92 ephoto_single_browser_image_data_update(eco->main, eco->image,
90 im_data_new, eco->w, eco->h); 93 im_data_new, eco->w, eco->h);
91 free(im_data); 94 free(im_data);
92 return im_data_new; 95 return im_data_new;
93} 96}
@@ -107,7 +110,7 @@ _red_slider_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
107 110
108static void 111static void
109_green_slider_changed(void *data, Evas_Object *obj, 112_green_slider_changed(void *data, Evas_Object *obj,
110 void *event_info EINA_UNUSED) 113 void *event_info EINA_UNUSED)
111{ 114{
112 Ephoto_Color *eco = data; 115 Ephoto_Color *eco = data;
113 int green; 116 int green;
@@ -121,7 +124,7 @@ _green_slider_changed(void *data, Evas_Object *obj,
121 124
122static void 125static void
123_blue_slider_changed(void *data, Evas_Object *obj, 126_blue_slider_changed(void *data, Evas_Object *obj,
124 void *event_info EINA_UNUSED) 127 void *event_info EINA_UNUSED)
125{ 128{
126 Ephoto_Color *eco = data; 129 Ephoto_Color *eco = data;
127 int blue; 130 int blue;
@@ -135,7 +138,7 @@ _blue_slider_changed(void *data, Evas_Object *obj,
135 138
136static Eina_Bool 139static Eina_Bool
137_color_reset(void *data, int type EINA_UNUSED, 140_color_reset(void *data, int type EINA_UNUSED,
138 void *event_info EINA_UNUSED) 141 void *event_info EINA_UNUSED)
139{ 142{
140 Ephoto_Color *eco = data; 143 Ephoto_Color *eco = data;
141 144
@@ -152,7 +155,7 @@ _color_reset(void *data, int type EINA_UNUSED,
152 155
153static Eina_Bool 156static Eina_Bool
154_color_apply(void *data, int type EINA_UNUSED, 157_color_apply(void *data, int type EINA_UNUSED,
155 void *event_info EINA_UNUSED) 158 void *event_info EINA_UNUSED)
156{ 159{
157 Ephoto_Color *eco = data; 160 Ephoto_Color *eco = data;
158 unsigned int *image_data; 161 unsigned int *image_data;
@@ -167,7 +170,7 @@ _color_apply(void *data, int type EINA_UNUSED,
167 else 170 else
168 { 171 {
169 image_data = 172 image_data =
170 evas_object_image_data_get(eco->image, EINA_FALSE); 173 evas_object_image_data_get(eco->image, EINA_FALSE);
171 evas_object_image_size_get(eco->image, &w, &h); 174 evas_object_image_size_get(eco->image, &w, &h);
172 ephoto_single_browser_image_data_done(eco->main, image_data, w, h); 175 ephoto_single_browser_image_data_done(eco->main, image_data, w, h);
173 } 176 }
@@ -178,7 +181,7 @@ _color_apply(void *data, int type EINA_UNUSED,
178 181
179static Eina_Bool 182static Eina_Bool
180_color_cancel(void *data, int type EINA_UNUSED, 183_color_cancel(void *data, int type EINA_UNUSED,
181 void *event_info EINA_UNUSED) 184 void *event_info EINA_UNUSED)
182{ 185{
183 Ephoto_Color *eco = data; 186 Ephoto_Color *eco = data;
184 187
@@ -197,7 +200,7 @@ _color_cancel(void *data, int type EINA_UNUSED,
197 200
198static void 201static void
199_editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 202_editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
200 void *event_info EINA_UNUSED) 203 void *event_info EINA_UNUSED)
201{ 204{
202 Ephoto_Color *eco = data; 205 Ephoto_Color *eco = data;
203 Ecore_Event_Handler *handler; 206 Ecore_Event_Handler *handler;
@@ -227,18 +230,18 @@ ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Ob
227 eco->parent = parent; 230 eco->parent = parent;
228 eco->image = image; 231 eco->image = image;
229 im_data = 232 im_data =
230 evas_object_image_data_get(eco->image, 233 evas_object_image_data_get(eco->image,
231 EINA_FALSE); 234 EINA_FALSE);
232 evas_object_image_size_get(eco->image, &eco->w, 235 evas_object_image_size_get(eco->image, &eco->w,
233 &eco->h); 236 &eco->h);
234 eco->original_im_data = malloc(sizeof(unsigned int) * eco->w * eco->h); 237 eco->original_im_data = malloc(sizeof(unsigned int) * eco->w * eco->h);
235 memcpy(eco->original_im_data, im_data, 238 memcpy(eco->original_im_data, im_data,
236 sizeof(unsigned int) * eco->w * eco->h); 239 sizeof(unsigned int) * eco->w * eco->h);
237 240
238 eco->editor = ephoto_editor_add(ephoto, parent, _("Adjust Color Levels"), 241 eco->editor = ephoto_editor_add(ephoto, parent, _("Adjust Color Levels"),
239 "eco", eco); 242 "eco", eco);
240 evas_object_event_callback_add(eco->editor, EVAS_CALLBACK_DEL, _editor_del, 243 evas_object_event_callback_add(eco->editor, EVAS_CALLBACK_DEL, _editor_del,
241 eco); 244 eco);
242 245
243 slider = elm_slider_add(eco->editor); 246 slider = elm_slider_add(eco->editor);
244 elm_object_text_set(slider, _("Blue")); 247 elm_object_text_set(slider, _("Blue"));
@@ -250,7 +253,7 @@ ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Ob
250 EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 253 EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
251 EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); 254 EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
252 evas_object_smart_callback_add(slider, "delay,changed", 255 evas_object_smart_callback_add(slider, "delay,changed",
253 _blue_slider_changed, eco); 256 _blue_slider_changed, eco);
254 elm_box_pack_start(eco->editor, slider); 257 elm_box_pack_start(eco->editor, slider);
255 evas_object_show(slider); 258 evas_object_show(slider);
256 eco->bslider = slider; 259 eco->bslider = slider;
@@ -265,7 +268,7 @@ ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Ob
265 EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 268 EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
266 EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); 269 EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
267 evas_object_smart_callback_add(slider, "delay,changed", 270 evas_object_smart_callback_add(slider, "delay,changed",
268 _green_slider_changed, eco); 271 _green_slider_changed, eco);
269 elm_box_pack_start(eco->editor, slider); 272 elm_box_pack_start(eco->editor, slider);
270 evas_object_show(slider); 273 evas_object_show(slider);
271 eco->gslider = slider; 274 eco->gslider = slider;
@@ -280,26 +283,27 @@ ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Ob
280 EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 283 EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
281 EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); 284 EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
282 evas_object_smart_callback_add(slider, "delay,changed", 285 evas_object_smart_callback_add(slider, "delay,changed",
283 _red_slider_changed, eco); 286 _red_slider_changed, eco);
284 elm_box_pack_start(eco->editor, slider); 287 elm_box_pack_start(eco->editor, slider);
285 evas_object_show(slider); 288 evas_object_show(slider);
286 eco->rslider = slider; 289 eco->rslider = slider;
287 290
288 eco->handlers = 291 eco->handlers =
289 eina_list_append(eco->handlers, 292 eina_list_append(eco->handlers,
290 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, 293 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET,
291 _color_reset, eco)); 294 _color_reset, eco));
292 eco->handlers = 295 eco->handlers =
293 eina_list_append(eco->handlers, 296 eina_list_append(eco->handlers,
294 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, 297 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY,
295 _color_apply, eco)); 298 _color_apply, eco));
296 eco->handlers = 299 eco->handlers =
297 eina_list_append(eco->handlers, 300 eina_list_append(eco->handlers,
298 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, 301 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL,
299 _color_cancel, eco)); 302 _color_cancel, eco));
300 303
301 return; 304 return;
302 305
303 error: 306error:
304 return; 307 return;
305} 308}
309
diff --git a/src/bin/ephoto_config.c b/src/bin/ephoto_config.c
index 2781547..93f4ed8 100644
--- a/src/bin/ephoto_config.c
+++ b/src/bin/ephoto_config.c
@@ -2,14 +2,14 @@
2 2
3#define CONFIG_VERSION 21 3#define CONFIG_VERSION 21
4 4
5static int _ephoto_config_load(Ephoto *ephoto); 5static int _ephoto_config_load(Ephoto *ephoto);
6static Eina_Bool _ephoto_on_config_save(void *data); 6static Eina_Bool _ephoto_on_config_save(void *data);
7 7
8static Eet_Data_Descriptor *edd = NULL; 8static Eet_Data_Descriptor *edd = NULL;
9 9
10static void 10static void
11_config_save_cb(void *data, Evas_Object *obj EINA_UNUSED, 11_config_save_cb(void *data, Evas_Object *obj EINA_UNUSED,
12 void *event_info EINA_UNUSED) 12 void *event_info EINA_UNUSED)
13{ 13{
14 Evas_Object *popup = data; 14 Evas_Object *popup = data;
15 Ephoto *ephoto = evas_object_data_get(popup, "ephoto"); 15 Ephoto *ephoto = evas_object_data_get(popup, "ephoto");
@@ -17,18 +17,18 @@ _config_save_cb(void *data, Evas_Object *obj EINA_UNUSED,
17 const char *text = elm_object_text_get(ephoto->config->open_dir); 17 const char *text = elm_object_text_get(ephoto->config->open_dir);
18 18
19 if (!strcmp(text, _("Root Directory"))) 19 if (!strcmp(text, _("Root Directory")))
20 path = "/"; 20 path = "/";
21 else if (!strcmp(text, _("Home Directory"))) 21 else if (!strcmp(text, _("Home Directory")))
22 path = eina_environment_home_get(); 22 path = eina_environment_home_get();
23 else if (!strcmp(text, _("Last Open Directory"))) 23 else if (!strcmp(text, _("Last Open Directory")))
24 path = "Last"; 24 path = "Last";
25 else 25 else
26 path = elm_object_text_get(ephoto->config->open_dir_custom); 26 path = elm_object_text_get(ephoto->config->open_dir_custom);
27 27
28 if (ecore_file_is_dir(path) || !strcmp(path, "Last")) 28 if (ecore_file_is_dir(path) || !strcmp(path, "Last"))
29 eina_stringshare_replace(&ephoto->config->open, path); 29 eina_stringshare_replace(&ephoto->config->open, path);
30 if (strcmp(path, ephoto->config->directory) && strcmp(path, "Last") && 30 if (strcmp(path, ephoto->config->directory) && strcmp(path, "Last") &&
31 ecore_file_exists(path)) 31 ecore_file_exists(path))
32 { 32 {
33 char *rp = ecore_file_realpath(path); 33 char *rp = ecore_file_realpath(path);
34 ephoto_directory_browser_clear(ephoto); 34 ephoto_directory_browser_clear(ephoto);
@@ -52,11 +52,11 @@ _config_save_cb(void *data, Evas_Object *obj EINA_UNUSED,
52 } 52 }
53 53
54 if (elm_spinner_value_get(ephoto->config->slide_time) > 0) 54 if (elm_spinner_value_get(ephoto->config->slide_time) > 0)
55 ephoto->config->slideshow_timeout = 55 ephoto->config->slideshow_timeout =
56 elm_spinner_value_get(ephoto->config->slide_time); 56 elm_spinner_value_get(ephoto->config->slide_time);
57 if (elm_object_text_get(ephoto->config->slide_trans)) 57 if (elm_object_text_get(ephoto->config->slide_trans))
58 eina_stringshare_replace(&ephoto->config->slideshow_transition, 58 eina_stringshare_replace(&ephoto->config->slideshow_transition,
59 elm_object_text_get(ephoto->config->slide_trans)); 59 elm_object_text_get(ephoto->config->slide_trans));
60 60
61 evas_object_del(popup); 61 evas_object_del(popup);
62 elm_object_focus_set(ephoto->pager, EINA_TRUE); 62 elm_object_focus_set(ephoto->pager, EINA_TRUE);
@@ -71,9 +71,9 @@ _open_hv_select(void *data, Evas_Object *obj, void *event_info)
71 elm_object_text_set(obj, elm_object_item_text_get(event_info)); 71 elm_object_text_set(obj, elm_object_item_text_get(event_info));
72 72
73 if (!strcmp(elm_object_item_text_get(event_info), _("Custom Directory"))) 73 if (!strcmp(elm_object_item_text_get(event_info), _("Custom Directory")))
74 elm_object_disabled_set(ephoto->config->open_dir_custom, EINA_FALSE); 74 elm_object_disabled_set(ephoto->config->open_dir_custom, EINA_FALSE);
75 else 75 else
76 elm_object_disabled_set(ephoto->config->open_dir_custom, EINA_TRUE); 76 elm_object_disabled_set(ephoto->config->open_dir_custom, EINA_TRUE);
77} 77}
78 78
79static void 79static void
@@ -90,7 +90,7 @@ _config_general(Ephoto *ephoto, Evas_Object *parent)
90 90
91 check = elm_check_add(table); 91 check = elm_check_add(table);
92 elm_object_text_set(check, _("Show Folders On Start")); 92 elm_object_text_set(check, _("Show Folders On Start"));
93 EPHOTO_ALIGN(check, EVAS_HINT_FILL, 0.5); 93 EPHOTO_ALIGN(check, EVAS_HINT_FILL, 0.5);
94 elm_check_state_set(check, ephoto->config->folders); 94 elm_check_state_set(check, ephoto->config->folders);
95 elm_table_pack(table, check, 0, 0, 1, 1); 95 elm_table_pack(table, check, 0, 0, 1, 1);
96 evas_object_show(check); 96 evas_object_show(check);
@@ -156,13 +156,13 @@ _config_general(Ephoto *ephoto, Evas_Object *parent)
156 hoversel = elm_hoversel_add(table); 156 hoversel = elm_hoversel_add(table);
157 elm_hoversel_hover_parent_set(hoversel, ephoto->win); 157 elm_hoversel_hover_parent_set(hoversel, ephoto->win);
158 elm_hoversel_item_add(hoversel, _("Root Directory"), NULL, 0, 158 elm_hoversel_item_add(hoversel, _("Root Directory"), NULL, 0,
159 _open_hv_select, ephoto); 159 _open_hv_select, ephoto);
160 elm_hoversel_item_add(hoversel, _("Home Directory"), NULL, 0, 160 elm_hoversel_item_add(hoversel, _("Home Directory"), NULL, 0,
161 _open_hv_select, ephoto); 161 _open_hv_select, ephoto);
162 elm_hoversel_item_add(hoversel, _("Last Open Directory"), NULL, 0, 162 elm_hoversel_item_add(hoversel, _("Last Open Directory"), NULL, 0,
163 _open_hv_select, ephoto); 163 _open_hv_select, ephoto);
164 elm_hoversel_item_add(hoversel, _("Custom Directory"), NULL, 0, 164 elm_hoversel_item_add(hoversel, _("Custom Directory"), NULL, 0,
165 _open_hv_select, ephoto); 165 _open_hv_select, ephoto);
166 elm_object_text_set(hoversel, ephoto->config->open); 166 elm_object_text_set(hoversel, ephoto->config->open);
167 evas_object_data_set(hoversel, "ephoto", ephoto); 167 evas_object_data_set(hoversel, "ephoto", ephoto);
168 EPHOTO_WEIGHT(hoversel, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 168 EPHOTO_WEIGHT(hoversel, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
@@ -177,7 +177,7 @@ _config_general(Ephoto *ephoto, Evas_Object *parent)
177 elm_object_text_set(entry, _("Custom Directory")); 177 elm_object_text_set(entry, _("Custom Directory"));
178 elm_object_disabled_set(entry, EINA_TRUE); 178 elm_object_disabled_set(entry, EINA_TRUE);
179 elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, 179 elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF,
180 ELM_SCROLLER_POLICY_OFF); 180 ELM_SCROLLER_POLICY_OFF);
181 EPHOTO_EXPAND(entry); 181 EPHOTO_EXPAND(entry);
182 EPHOTO_FILL(entry); 182 EPHOTO_FILL(entry);
183 elm_table_pack(table, entry, 0, 9, 1, 1); 183 elm_table_pack(table, entry, 0, 9, 1, 1);
@@ -193,7 +193,7 @@ _hv_select(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
193 193
194static void 194static void
195_spinner_changed(void *data EINA_UNUSED, Evas_Object *obj, 195_spinner_changed(void *data EINA_UNUSED, Evas_Object *obj,
196 void *event_info EINA_UNUSED) 196 void *event_info EINA_UNUSED)
197{ 197{
198 double val; 198 double val;
199 char buf[PATH_MAX]; 199 char buf[PATH_MAX];
@@ -281,13 +281,14 @@ _config_slideshow(Ephoto *ephoto, Evas_Object *parent)
281 evas_object_show(label); 281 evas_object_show(label);
282 282
283 transitions = _ephoto_transitions_list_get(edje_object_data_get(elm_layout_edje_get 283 transitions = _ephoto_transitions_list_get(edje_object_data_get(elm_layout_edje_get
284 (ephoto->slideshow), "transitions")); 284 (ephoto->slideshow), "transitions"));
285 285
286 hoversel = elm_hoversel_add(table); 286 hoversel = elm_hoversel_add(table);
287 elm_hoversel_hover_parent_set(hoversel, ephoto->win); 287 elm_hoversel_hover_parent_set(hoversel, ephoto->win);
288 EINA_LIST_FOREACH(transitions, l, 288 EINA_LIST_FOREACH(transitions, l,
289 transition) elm_hoversel_item_add(hoversel, transition, NULL, 0, 289 transition)
290 _hv_select, transition); 290 elm_hoversel_item_add(hoversel, transition, NULL, 0,
291 _hv_select, transition);
291 elm_hoversel_item_add(hoversel, "none", NULL, 0, _hv_select, NULL); 292 elm_hoversel_item_add(hoversel, "none", NULL, 0, _hv_select, NULL);
292 elm_object_text_set(hoversel, ephoto->config->slideshow_transition); 293 elm_object_text_set(hoversel, ephoto->config->slideshow_transition);
293 EPHOTO_EXPAND(hoversel); 294 EPHOTO_EXPAND(hoversel);
@@ -297,8 +298,6 @@ _config_slideshow(Ephoto *ephoto, Evas_Object *parent)
297 ephoto->config->slide_trans = hoversel; 298 ephoto->config->slide_trans = hoversel;
298} 299}
299 300
300
301
302static Evas_Object * 301static Evas_Object *
303_config_settings(Ephoto *ephoto, Evas_Object *parent, Eina_Bool slideshow) 302_config_settings(Ephoto *ephoto, Evas_Object *parent, Eina_Bool slideshow)
304{ 303{
@@ -330,7 +329,7 @@ _config_settings(Ephoto *ephoto, Evas_Object *parent, Eina_Bool slideshow)
330 329
331static void 330static void
332_link_anchor_bt(void *data, Evas_Object *obj, 331_link_anchor_bt(void *data, Evas_Object *obj,
333 void *event_info EINA_UNUSED) 332 void *event_info EINA_UNUSED)
334{ 333{
335 char buf[PATH_MAX]; 334 char buf[PATH_MAX];
336 Evas_Object *av = data; 335 Evas_Object *av = data;
@@ -347,7 +346,7 @@ _link_anchor_bt(void *data, Evas_Object *obj,
347 346
348static void 347static void
349_copy_anchor_bt(void *data, Evas_Object *obj, 348_copy_anchor_bt(void *data, Evas_Object *obj,
350 void *event_info EINA_UNUSED) 349 void *event_info EINA_UNUSED)
351{ 350{
352 char buf[PATH_MAX]; 351 char buf[PATH_MAX];
353 Evas_Object *av = data; 352 Evas_Object *av = data;
@@ -356,7 +355,7 @@ _copy_anchor_bt(void *data, Evas_Object *obj,
356 elm_entry_anchor_hover_end(av); 355 elm_entry_anchor_hover_end(av);
357 snprintf(buf, PATH_MAX, "%s", link); 356 snprintf(buf, PATH_MAX, "%s", link);
358 elm_cnp_selection_set(av, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_MARKUP, 357 elm_cnp_selection_set(av, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_MARKUP,
359 buf, strlen(buf)); 358 buf, strlen(buf));
360} 359}
361 360
362static void 361static void
@@ -370,7 +369,7 @@ _link_anchor(void *data, Evas_Object *obj, void *event_info)
370 elm_object_text_set(button, _("Open Link In Browser")); 369 elm_object_text_set(button, _("Open Link In Browser"));
371 elm_object_part_content_set(ei->hover, "middle", button); 370 elm_object_part_content_set(ei->hover, "middle", button);
372 evas_object_smart_callback_add(button, "clicked", _link_anchor_bt, 371 evas_object_smart_callback_add(button, "clicked", _link_anchor_bt,
373 av); 372 av);
374 evas_object_data_set(button, "link", strdup(ei->anchor_info->name)); 373 evas_object_data_set(button, "link", strdup(ei->anchor_info->name));
375 evas_object_show(button); 374 evas_object_show(button);
376 375
@@ -378,7 +377,7 @@ _link_anchor(void *data, Evas_Object *obj, void *event_info)
378 elm_object_text_set(button, _("Copy Link")); 377 elm_object_text_set(button, _("Copy Link"));
379 elm_object_part_content_set(ei->hover, "bottom", button); 378 elm_object_part_content_set(ei->hover, "bottom", button);
380 evas_object_smart_callback_add(button, "clicked", _copy_anchor_bt, 379 evas_object_smart_callback_add(button, "clicked", _copy_anchor_bt,
381 av); 380 av);
382 evas_object_data_set(button, "link", strdup(ei->anchor_info->name)); 381 evas_object_data_set(button, "link", strdup(ei->anchor_info->name));
383 evas_object_show(button); 382 evas_object_show(button);
384} 383}
@@ -414,53 +413,53 @@ _config_bindings(Evas_Object *parent)
414 EPHOTO_WEIGHT(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); 413 EPHOTO_WEIGHT(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
415 EPHOTO_FILL(entry); 414 EPHOTO_FILL(entry);
416 eina_strbuf_append_printf(sbuf, 415 eina_strbuf_append_printf(sbuf,
417 _("<b><hilight>General Bindings</hilight></b><br/>" 416 _("<b><hilight>General Bindings</hilight></b><br/>"
418 "<b>F1:</b> Settings Panel<br/>" 417 "<b>F1:</b> Settings Panel<br/>"
419 "<b>F5:</b> Start Slideshow<br/>" 418 "<b>F5:</b> Start Slideshow<br/>"
420 "<b>F11:</b> Toggle Fullscreen<br/>" 419 "<b>F11:</b> Toggle Fullscreen<br/>"
421 "<b>Ctrl+Shift+f:</b> Toggle File Selector<br/><br/>" 420 "<b>Ctrl+Shift+f:</b> Toggle File Selector<br/><br/>"
422 "<b><hilight>Thumbnail Browser Bindings</hilight></b><br/>" 421 "<b><hilight>Thumbnail Browser Bindings</hilight></b><br/>"
423 "<b>Ctrl++:</b> Zoom In<br/>" 422 "<b>Ctrl++:</b> Zoom In<br/>"
424 "<b>Ctrl+-:</b> Zoom Out<br/>" 423 "<b>Ctrl+-:</b> Zoom Out<br/>"
425 "<b>Ctrl+Tab:</b> View Image<br/>" 424 "<b>Ctrl+Tab:</b> View Image<br/>"
426 "<b>Ctrl+c:</b> Copy Image<br/>" 425 "<b>Ctrl+c:</b> Copy Image<br/>"
427 "<b>Ctrl+x:</b> Cut Image<br/>" 426 "<b>Ctrl+x:</b> Cut Image<br/>"
428 "<b>Ctrl+v:</b> Paste Image<br/>" 427 "<b>Ctrl+v:</b> Paste Image<br/>"
429 "<b>Ctrl+a:</b> Select All<br/>" 428 "<b>Ctrl+a:</b> Select All<br/>"
430 "<b>Ctrl+f:</b> Toggle Search<br/>" 429 "<b>Ctrl+f:</b> Toggle Search<br/>"
431 "<b>Ctrl+Delete:</b> Delete Image<br/>" 430 "<b>Ctrl+Delete:</b> Delete Image<br/>"
432 "<b>F2:</b> Rename Image<br/>" 431 "<b>F2:</b> Rename Image<br/>"
433 "<b>Escape:</b> Clear Selection<br/><br/>" 432 "<b>Escape:</b> Clear Selection<br/><br/>"
434 "<b><hilight>Single Browser Bindings</hilight></b><br/>" 433 "<b><hilight>Single Browser Bindings</hilight></b><br/>"
435 "<b>Ctrl+Shift+0:</b> Zoom 1:1<br/>" 434 "<b>Ctrl+Shift+0:</b> Zoom 1:1<br/>"
436 "<b>Ctrl++:</b> Zoom In<br/>" 435 "<b>Ctrl++:</b> Zoom In<br/>"
437 "<b>Ctrl+-:</b> Zoom Out<br/>" 436 "<b>Ctrl+-:</b> Zoom Out<br/>"
438 "<b>Ctrl+0:</b> Zoom Fit<br/>" 437 "<b>Ctrl+0:</b> Zoom Fit<br/>"
439 "<b>Ctrl+Shift+l:</b> Rotate Counter Clockwise<br/>" 438 "<b>Ctrl+Shift+l:</b> Rotate Counter Clockwise<br/>"
440 "<b>Ctrl+l:</b> Flip Horizontal<br/>" 439 "<b>Ctrl+l:</b> Flip Horizontal<br/>"
441 "<b>Ctrl+Shift+r:</b> Rotate Clockwise<br/>" 440 "<b>Ctrl+Shift+r:</b> Rotate Clockwise<br/>"
442 "<b>Ctrl+r:</b> Flip Vertical<br/>" 441 "<b>Ctrl+r:</b> Flip Vertical<br/>"
443 "<b>Ctrl+Shift+s:</b> Save Image As<br/>" 442 "<b>Ctrl+Shift+s:</b> Save Image As<br/>"
444 "<b>Ctrl+s:</b> Save Image<br/>" 443 "<b>Ctrl+s:</b> Save Image<br/>"
445 "<b>Ctrl+u:</b> Reset Image<br/>" 444 "<b>Ctrl+u:</b> Reset Image<br/>"
446 "<b>Ctrl+y:</b> Redo<br/>" 445 "<b>Ctrl+y:</b> Redo<br/>"
447 "<b>Ctrl+Shift+z:</b> Redo<br/>" 446 "<b>Ctrl+Shift+z:</b> Redo<br/>"
448 "<b>Ctrl+z:</b> Undo<br/>" 447 "<b>Ctrl+z:</b> Undo<br/>"
449 "<b>Home:</b> Navigate First<br/>" 448 "<b>Home:</b> Navigate First<br/>"
450 "<b>Left Arrow:</b> Navigate Previous<br/>" 449 "<b>Left Arrow:</b> Navigate Previous<br/>"
451 "<b>Right Arrow:</b> Navigate Next<br/>" 450 "<b>Right Arrow:</b> Navigate Next<br/>"
452 "<b>Space:</b> Navigate Next<br/>" 451 "<b>Space:</b> Navigate Next<br/>"
453 "<b>End:</b> Navigate Last<br/>" 452 "<b>End:</b> Navigate Last<br/>"
454 "<b>Ctrl+Delete:</b> Delete Image<br/>" 453 "<b>Ctrl+Delete:</b> Delete Image<br/>"
455 "<b>F2</b> Rename Image<br/>" 454 "<b>F2</b> Rename Image<br/>"
456 "<b>Escape:</b> Return to Thumbnail Browser<br/><br/>" 455 "<b>Escape:</b> Return to Thumbnail Browser<br/><br/>"
457 "<b><hilight>Slideshow Bindings</hilight></b><br/>" 456 "<b><hilight>Slideshow Bindings</hilight></b><br/>"
458 "<b>Space:</b> Play/Pause Slideshow<br/>" 457 "<b>Space:</b> Play/Pause Slideshow<br/>"
459 "<b>Home:</b> Navigate First<br/>" 458 "<b>Home:</b> Navigate First<br/>"
460 "<b>Left Arrow:</b> Navigate Previous<br/>" 459 "<b>Left Arrow:</b> Navigate Previous<br/>"
461 "<b>Right Arrow:</b> Navigate Next<br/>" 460 "<b>Right Arrow:</b> Navigate Next<br/>"
462 "<b>End:</b> Navigate Last<br/>" 461 "<b>End:</b> Navigate Last<br/>"
463 "<b>Escape:</b> Quit Slideshow<br/>")); 462 "<b>Escape:</b> Quit Slideshow<br/>"));
464 elm_object_text_set(entry, eina_strbuf_string_get(sbuf)); 463 elm_object_text_set(entry, eina_strbuf_string_get(sbuf));
465 elm_object_content_set(scroller, entry); 464 elm_object_content_set(scroller, entry);
466 evas_object_show(entry); 465 evas_object_show(entry);
@@ -523,63 +522,63 @@ _config_about(Evas_Object *parent)
523 EPHOTO_WEIGHT(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); 522 EPHOTO_WEIGHT(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
524 EPHOTO_FILL(entry); 523 EPHOTO_FILL(entry);
525 eina_strbuf_append_printf(sbuf, 524 eina_strbuf_append_printf(sbuf,
526 _("Ephoto is a comprehensive image viewer based on the EFL. For more" 525 _("Ephoto is a comprehensive image viewer based on the EFL. For more"
527 "information, please visit the Ephoto project page:<br/>" 526 "information, please visit the Ephoto project page:<br/>"
528 "<a href=http://www.smhouston.us/ephoto/>" 527 "<a href=http://www.smhouston.us/ephoto/>"
529 "http://www.smhouston.us/ephoto/</a><br/><br/>" 528 "http://www.smhouston.us/ephoto/</a><br/><br/>"
530 "Ephoto also has a page on the Enlightenment wiki:<br/>" 529 "Ephoto also has a page on the Enlightenment wiki:<br/>"
531 "<a href=https://phab.enlightenment.org/w/projects/ephoto>" 530 "<a href=https://phab.enlightenment.org/w/projects/ephoto>"
532 "https://phab.enlightenment.org/w/projects/ephoto</a><br/><br/>" 531 "https://phab.enlightenment.org/w/projects/ephoto</a><br/><br/>"
533 "Ephoto's source can be found through Enlightenment's git:<br/>" 532 "Ephoto's source can be found through Enlightenment's git:<br/>"
534 "<a href=http://git.enlightenment.org/apps/ephoto.git>" 533 "<a href=http://git.enlightenment.org/apps/ephoto.git>"
535 "http://git.enlightenment.org/apps/ephoto.git</a><br/><br/>" 534 "http://git.enlightenment.org/apps/ephoto.git</a><br/><br/>"
536 "<b>Authors:</b><br/>")); 535 "<b>Authors:</b><br/>"));
537 f = fopen(PACKAGE_DATA_DIR "/AUTHORS", "r"); 536 f = fopen(PACKAGE_DATA_DIR "/AUTHORS", "r");
538 if (f) 537 if (f)
539 { 538 {
540 char buf[PATH_MAX]; 539 char buf[PATH_MAX];
541 540
542 while (fgets(buf, sizeof(buf), f)) 541 while (fgets(buf, sizeof(buf), f))
543 { 542 {
544 int len; 543 int len;
545 544
546 len = strlen(buf); 545 len = strlen(buf);
547 if (len > 0) 546 if (len > 0)
548 { 547 {
549 if (buf[len - 1] == '\n') 548 if (buf[len - 1] == '\n')
550 { 549 {
551 buf[len - 1] = 0; 550 buf[len - 1] = 0;
552 len--; 551 len--;
553 } 552 }
554 if (len > 0) 553 if (len > 0)
555 { 554 {
556 char *p; 555 char *p;
557 556
558 do 557 do
559 { 558 {
560 p = strchr(buf, '<'); 559 p = strchr(buf, '<');
561 if (p) 560 if (p)
562 *p = 0; 561 *p = 0;
563 } 562 }
564 while (p); 563 while (p);
565 do 564 do
566 { 565 {
567 p = strchr(buf, '>'); 566 p = strchr(buf, '>');
568 if (p) 567 if (p)
569 *p = 0; 568 *p = 0;
570 } 569 }
571 while (p); 570 while (p);
572 eina_strbuf_append_printf(sbuf, "%s<br/>", buf); 571 eina_strbuf_append_printf(sbuf, "%s<br/>", buf);
573 } 572 }
574 if (len == 0) 573 if (len == 0)
575 eina_strbuf_append_printf(sbuf, "<br/>"); 574 eina_strbuf_append_printf(sbuf, "<br/>");
576 } 575 }
577 } 576 }
578 fclose(f); 577 fclose(f);
579 } 578 }
580 elm_object_text_set(entry, eina_strbuf_string_get(sbuf)); 579 elm_object_text_set(entry, eina_strbuf_string_get(sbuf));
581 evas_object_smart_callback_add(entry, "anchor,hover,opened", 580 evas_object_smart_callback_add(entry, "anchor,hover,opened",
582 _link_anchor, entry); 581 _link_anchor, entry);
583 elm_box_pack_end(box, entry); 582 elm_box_pack_end(box, entry);
584 evas_object_show(entry); 583 evas_object_show(entry);
585 584
@@ -616,9 +615,9 @@ _ephoto_config_load(Ephoto *ephoto)
616 ef = eet_open(buf, EET_FILE_MODE_READ); 615 ef = eet_open(buf, EET_FILE_MODE_READ);
617 if (!ef) 616 if (!ef)
618 { 617 {
619 ephoto_config_free(ephoto); 618 ephoto_config_free(ephoto);
620 ephoto->config = calloc(1, sizeof(Ephoto_Config)); 619 ephoto->config = calloc(1, sizeof(Ephoto_Config));
621 return 0; 620 return 0;
622 } 621 }
623 622
624 ephoto->config = eet_data_read(ef, edd, "config"); 623 ephoto->config = eet_data_read(ef, edd, "config");
@@ -626,17 +625,17 @@ _ephoto_config_load(Ephoto *ephoto)
626 625
627 if (!ephoto->config || ephoto->config->config_version > CONFIG_VERSION) 626 if (!ephoto->config || ephoto->config->config_version > CONFIG_VERSION)
628 { 627 {
629 ephoto_config_free(ephoto); 628 ephoto_config_free(ephoto);
630 ephoto->config = calloc(1, sizeof(Ephoto_Config)); 629 ephoto->config = calloc(1, sizeof(Ephoto_Config));
631 return 0; 630 return 0;
632 } 631 }
633 632
634 if (ephoto->config->config_version < CONFIG_VERSION) 633 if (ephoto->config->config_version < CONFIG_VERSION)
635 { 634 {
636 ecore_file_unlink(buf); 635 ecore_file_unlink(buf);
637 ephoto_config_free(ephoto); 636 ephoto_config_free(ephoto);
638 ephoto->config = calloc(1, sizeof(Ephoto_Config)); 637 ephoto->config = calloc(1, sizeof(Ephoto_Config));
639 return 0; 638 return 0;
640 } 639 }
641 return 1; 640 return 1;
642} 641}
@@ -653,16 +652,16 @@ _ephoto_on_config_save(void *data)
653 652
654 ef = eet_open(buf2, EET_FILE_MODE_WRITE); 653 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
655 if (!ef) 654 if (!ef)
656 goto save_end; 655 goto save_end;
657 656
658 eet_data_write(ef, edd, "config", ephoto->config, 1); 657 eet_data_write(ef, edd, "config", ephoto->config, 1);
659 if (eet_close(ef)) 658 if (eet_close(ef))
660 goto save_end; 659 goto save_end;
661 660
662 if (!ecore_file_mv(buf2, buf)) 661 if (!ecore_file_mv(buf2, buf))
663 goto save_end; 662 goto save_end;
664 663
665 save_end: 664save_end:
666 ecore_file_unlink(buf2); 665 ecore_file_unlink(buf2);
667 666
668 return ECORE_CALLBACK_CANCEL; 667 return ECORE_CALLBACK_CANCEL;
@@ -713,28 +712,28 @@ ephoto_config_main(Ephoto *ephoto)
713 elm_icon_standard_set(ic, "preferences-system"); 712 elm_icon_standard_set(ic, "preferences-system");
714 evas_object_show(ic); 713 evas_object_show(ic);
715 settingsi = elm_list_item_append(list, _("General"), ic, NULL, 714 settingsi = elm_list_item_append(list, _("General"), ic, NULL,
716 _list_clicked, settings); 715 _list_clicked, settings);
717 716
718 ic = elm_icon_add(list); 717 ic = elm_icon_add(list);
719 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); 718 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
720 elm_icon_standard_set(ic, "media-playback-start"); 719 elm_icon_standard_set(ic, "media-playback-start");
721 evas_object_show(ic); 720 evas_object_show(ic);
722 slideshowi = elm_list_item_append(list, _("Slideshow"), ic, NULL, 721 slideshowi = elm_list_item_append(list, _("Slideshow"), ic, NULL,
723 _list_clicked, slideshow); 722 _list_clicked, slideshow);
724 723
725 ic = elm_icon_add(list); 724 ic = elm_icon_add(list);
726 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); 725 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
727 elm_icon_standard_set(ic, "input-keyboard"); 726 elm_icon_standard_set(ic, "input-keyboard");
728 evas_object_show(ic); 727 evas_object_show(ic);
729 kbi = elm_list_item_append(list, _("Bindings"), ic, NULL, 728 kbi = elm_list_item_append(list, _("Bindings"), ic, NULL,
730 _list_clicked, kb); 729 _list_clicked, kb);
731 730
732 ic = elm_icon_add(list); 731 ic = elm_icon_add(list);
733 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); 732 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
734 elm_icon_standard_set(ic, "help-about"); 733 elm_icon_standard_set(ic, "help-about");
735 evas_object_show(ic); 734 evas_object_show(ic);
736 abouti = elm_list_item_append(list, _("About"), ic, NULL, 735 abouti = elm_list_item_append(list, _("About"), ic, NULL,
737 _list_clicked, about); 736 _list_clicked, about);
738 737
739 elm_list_go(list); 738 elm_list_go(list);
740 739
@@ -776,13 +775,13 @@ ephoto_config_init(Ephoto *ephoto)
776 Eet_Data_Descriptor_Class eddc; 775 Eet_Data_Descriptor_Class eddc;
777 776
778 if (!eet_eina_stream_data_descriptor_class_set(&eddc, sizeof(eddc), 777 if (!eet_eina_stream_data_descriptor_class_set(&eddc, sizeof(eddc),
779 "Ephoto_Config", sizeof(Ephoto_Config))) 778 "Ephoto_Config", sizeof(Ephoto_Config)))
780 { 779 {
781 return EINA_FALSE; 780 return EINA_FALSE;
782 } 781 }
783 782
784 if (!edd) 783 if (!edd)
785 edd = eet_data_descriptor_stream_new(&eddc); 784 edd = eet_data_descriptor_stream_new(&eddc);
786 785
787#undef T 786#undef T
788#undef D 787#undef D
@@ -812,28 +811,28 @@ ephoto_config_init(Ephoto *ephoto)
812 C_VAL(D, T, thumbnail_aspect, EET_T_INT); 811 C_VAL(D, T, thumbnail_aspect, EET_T_INT);
813 switch (_ephoto_config_load(ephoto)) 812 switch (_ephoto_config_load(ephoto))
814 { 813 {
815 case 0: 814 case 0:
816 /* Start a new config */ 815 /* Start a new config */
817 ephoto->config->config_version = CONFIG_VERSION; 816 ephoto->config->config_version = CONFIG_VERSION;
818 ephoto->config->slideshow_timeout = 4.0; 817 ephoto->config->slideshow_timeout = 4.0;
819 ephoto->config->slideshow_transition = eina_stringshare_add("fade"); 818 ephoto->config->slideshow_transition = eina_stringshare_add("fade");
820 ephoto->config->window_width = 900*elm_config_scale_get(); 819 ephoto->config->window_width = 900 * elm_config_scale_get();
821 ephoto->config->window_height = 500*elm_config_scale_get(); 820 ephoto->config->window_height = 500 * elm_config_scale_get();
822 ephoto->config->fsel_hide = 0; 821 ephoto->config->fsel_hide = 0;
823 ephoto->config->left_size = .25; 822 ephoto->config->left_size = .25;
824 ephoto->config->right_size = .25; 823 ephoto->config->right_size = .25;
825 ephoto->config->open = eina_stringshare_add(eina_environment_home_get()); 824 ephoto->config->open = eina_stringshare_add(eina_environment_home_get());
826 ephoto->config->prompts = 1; 825 ephoto->config->prompts = 1;
827 ephoto->config->drop = 0; 826 ephoto->config->drop = 0;
828 ephoto->config->movess = 1; 827 ephoto->config->movess = 1;
829 ephoto->config->smooth = 1; 828 ephoto->config->smooth = 1;
830 ephoto->config->firstrun = 1; 829 ephoto->config->firstrun = 1;
831 ephoto->config->folders = 1; 830 ephoto->config->folders = 1;
832 ephoto->config->thumbnail_aspect = 0; 831 ephoto->config->thumbnail_aspect = 0;
833 break; 832 break;
834 833
835 default: 834 default:
836 return EINA_TRUE; 835 return EINA_TRUE;
837 } 836 }
838 837
839 ephoto_config_save(ephoto); 838 ephoto_config_save(ephoto);
diff --git a/src/bin/ephoto_cropper.c b/src/bin/ephoto_cropper.c
index e76df59..ddee2d5 100644
--- a/src/bin/ephoto_cropper.c
+++ b/src/bin/ephoto_cropper.c
@@ -13,17 +13,17 @@ struct _Ephoto_Cropper
13 Evas_Object *layout; 13 Evas_Object *layout;
14 Evas_Object *cropw; 14 Evas_Object *cropw;
15 Evas_Object *croph; 15 Evas_Object *croph;
16 Eina_List *handlers; 16 Eina_List *handlers;
17 Evas_Coord startx; 17 Evas_Coord startx;
18 Evas_Coord starty; 18 Evas_Coord starty;
19 Evas_Coord offsetx; 19 Evas_Coord offsetx;
20 Evas_Coord offsety; 20 Evas_Coord offsety;
21 Eina_Bool resizing; 21 Eina_Bool resizing;
22}; 22};
23 23
24static void 24static void
25_calculate_cropper_size(void *data, Evas_Object *obj EINA_UNUSED, 25_calculate_cropper_size(void *data, Evas_Object *obj EINA_UNUSED,
26 const char *emission EINA_UNUSED, const char *source EINA_UNUSED) 26 const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
27{ 27{
28 Ephoto_Cropper *ec = data; 28 Ephoto_Cropper *ec = data;
29 Edje_Message_Int_Set *msg; 29 Edje_Message_Int_Set *msg;
@@ -31,13 +31,13 @@ _calculate_cropper_size(void *data, Evas_Object *obj EINA_UNUSED,
31 double scalew, scaleh; 31 double scalew, scaleh;
32 32
33 edje_object_part_geometry_get(elm_layout_edje_get(ec->layout), 33 edje_object_part_geometry_get(elm_layout_edje_get(ec->layout),
34 "ephoto.swallow.image", 0, 0, &w, &h); 34 "ephoto.swallow.image", 0, 0, &w, &h);
35 edje_object_part_geometry_get(elm_layout_edje_get(ec->layout), 35 edje_object_part_geometry_get(elm_layout_edje_get(ec->layout),
36 "ephoto.swallow.cropper", 0, 0, &cw, &ch); 36 "ephoto.swallow.cropper", 0, 0, &cw, &ch);
37 evas_object_image_size_get(ec->image, &iw, &ih); 37 evas_object_image_size_get(ec->image, &iw, &ih);
38 38
39 scalew = (double) cw / (double) w; 39 scalew = (double)cw / (double)w;
40 scaleh = (double) ch / (double) h; 40 scaleh = (double)ch / (double)h;
41 41
42 nw = iw * scalew; 42 nw = iw * scalew;
43 nh = ih * scaleh; 43 nh = ih * scaleh;
@@ -51,12 +51,12 @@ _calculate_cropper_size(void *data, Evas_Object *obj EINA_UNUSED,
51 msg->val[1] = nw; 51 msg->val[1] = nw;
52 msg->val[2] = nh; 52 msg->val[2] = nh;
53 edje_object_message_send(elm_layout_edje_get(ec->layout), 53 edje_object_message_send(elm_layout_edje_get(ec->layout),
54 EDJE_MESSAGE_INT_SET, 1, msg); 54 EDJE_MESSAGE_INT_SET, 1, msg);
55} 55}
56 56
57static void 57static void
58_cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED, 58_cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED,
59 void *event_info EINA_UNUSED) 59 void *event_info EINA_UNUSED)
60{ 60{
61 Ephoto_Cropper *ec = data; 61 Ephoto_Cropper *ec = data;
62 Edje_Message_Int_Set *msgl, *msgr; 62 Edje_Message_Int_Set *msgl, *msgr;
@@ -66,11 +66,11 @@ _cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED,
66 mw = elm_slider_value_get(ec->cropw); 66 mw = elm_slider_value_get(ec->cropw);
67 67
68 edje_object_part_geometry_get(elm_layout_edje_get(ec->layout), 68 edje_object_part_geometry_get(elm_layout_edje_get(ec->layout),
69 "ephoto.swallow.image", &lx, 0, &lw, 0); 69 "ephoto.swallow.image", &lx, 0, &lw, 0);
70 edje_object_part_geometry_get(elm_layout_edje_get(ec->layout), 70 edje_object_part_geometry_get(elm_layout_edje_get(ec->layout),
71 "ephoto.swallow.cropper", &cx, 0, &cw, 0); 71 "ephoto.swallow.cropper", &cx, 0, &cw, 0);
72 evas_object_image_size_get(ec->image, &iw, 0); 72 evas_object_image_size_get(ec->image, &iw, 0);
73 scalew = (double) mw / (double) iw; 73 scalew = (double)mw / (double)iw;
74 74
75 nw = lw * scalew; 75 nw = lw * scalew;
76 left = (nw - cw) / 2; 76 left = (nw - cw) / 2;
@@ -78,13 +78,13 @@ _cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED,
78 78
79 if ((cx + cw + right) >= (lx + lw)) 79 if ((cx + cw + right) >= (lx + lw))
80 { 80 {
81 right = (lx + lw) - (cx + cw); 81 right = (lx + lw) - (cx + cw);
82 left += left - right; 82 left += left - right;
83 } 83 }
84 else if ((cx - left) <= lx) 84 else if ((cx - left) <= lx)
85 { 85 {
86 left = cx - lx; 86 left = cx - lx;
87 right += right - left; 87 right += right - left;
88 } 88 }
89 left *= -1; 89 left *= -1;
90 90
@@ -94,7 +94,7 @@ _cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED,
94 msgl->val[1] = left; 94 msgl->val[1] = left;
95 msgl->val[2] = 0; 95 msgl->val[2] = 0;
96 edje_object_message_send(elm_layout_edje_get(ec->layout), 96 edje_object_message_send(elm_layout_edje_get(ec->layout),
97 EDJE_MESSAGE_INT_SET, 1, msgl); 97 EDJE_MESSAGE_INT_SET, 1, msgl);
98 98
99 msgr = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); 99 msgr = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int)));
100 msgr->count = 3; 100 msgr->count = 3;
@@ -102,12 +102,12 @@ _cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED,
102 msgr->val[1] = right; 102 msgr->val[1] = right;
103 msgr->val[2] = 0; 103 msgr->val[2] = 0;
104 edje_object_message_send(elm_layout_edje_get(ec->layout), 104 edje_object_message_send(elm_layout_edje_get(ec->layout),
105 EDJE_MESSAGE_INT_SET, 1, msgr); 105 EDJE_MESSAGE_INT_SET, 1, msgr);
106} 106}
107 107
108static void 108static void
109_cropper_changed_height(void *data, Evas_Object *obj EINA_UNUSED, 109_cropper_changed_height(void *data, Evas_Object *obj EINA_UNUSED,
110 void *event_info EINA_UNUSED) 110 void *event_info EINA_UNUSED)
111{ 111{
112 Ephoto_Cropper *ec = data; 112 Ephoto_Cropper *ec = data;
113 Edje_Message_Int_Set *msgt, *msgb; 113 Edje_Message_Int_Set *msgt, *msgb;
@@ -117,25 +117,25 @@ _cropper_changed_height(void *data, Evas_Object *obj EINA_UNUSED,
117 mh = elm_slider_value_get(ec->croph); 117 mh = elm_slider_value_get(ec->croph);
118 118
119 edje_object_part_geometry_get(elm_layout_edje_get(ec->layout), 119 edje_object_part_geometry_get(elm_layout_edje_get(ec->layout),
120 "ephoto.swallow.image", 0, &ly, 0, &lh); 120 "ephoto.swallow.image", 0, &ly, 0, &lh);
121 edje_object_part_geometry_get(elm_layout_edje_get(ec->layout), 121 edje_object_part_geometry_get(elm_layout_edje_get(ec->layout),
122 "ephoto.swallow.cropper", 0, &cy, 0, &ch); 122 "ephoto.swallow.cropper", 0, &cy, 0, &ch);
123 evas_object_image_size_get(ec->image, 0, &ih); 123 evas_object_image_size_get(ec->image, 0, &ih);
124 124
125 scaleh = (double) mh / (double) ih; 125 scaleh = (double)mh / (double)ih;
126 nh = lh * scaleh; 126 nh = lh * scaleh;
127 top = (nh - ch) / 2; 127 top = (nh - ch) / 2;
128 bottom = (nh - ch) / 2; 128 bottom = (nh - ch) / 2;
129 129
130 if ((cy + ch + bottom) >= (ly + lh)) 130 if ((cy + ch + bottom) >= (ly + lh))
131 { 131 {
132 bottom = (ly + lh) - (cy + ch); 132 bottom = (ly + lh) - (cy + ch);
133 top += top - bottom; 133 top += top - bottom;
134 } 134 }
135 else if ((cy - top) <= ly) 135 else if ((cy - top) <= ly)
136 { 136 {
137 top = cy - ly; 137 top = cy - ly;
138 bottom += bottom - top; 138 bottom += bottom - top;
139 } 139 }
140 top *= -1; 140 top *= -1;
141 141
@@ -145,7 +145,7 @@ _cropper_changed_height(void *data, Evas_Object *obj EINA_UNUSED,
145 msgt->val[1] = 0; 145 msgt->val[1] = 0;
146 msgt->val[2] = top; 146 msgt->val[2] = top;
147 edje_object_message_send(elm_layout_edje_get(ec->layout), 147 edje_object_message_send(elm_layout_edje_get(ec->layout),
148 EDJE_MESSAGE_INT_SET, 1, msgt); 148 EDJE_MESSAGE_INT_SET, 1, msgt);
149 149
150 msgb = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); 150 msgb = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int)));
151 msgb->count = 3; 151 msgb->count = 3;
@@ -153,12 +153,12 @@ _cropper_changed_height(void *data, Evas_Object *obj EINA_UNUSED,
153 msgb->val[1] = 0; 153 msgb->val[1] = 0;
154 msgb->val[2] = bottom; 154 msgb->val[2] = bottom;
155 edje_object_message_send(elm_layout_edje_get(ec->layout), 155 edje_object_message_send(elm_layout_edje_get(ec->layout),
156 EDJE_MESSAGE_INT_SET, 1, msgb); 156 EDJE_MESSAGE_INT_SET, 1, msgb);
157} 157}
158 158
159static void 159static void
160_reset_crop(void *data, Evas_Object *obj EINA_UNUSED, 160_reset_crop(void *data, Evas_Object *obj EINA_UNUSED,
161 void *event_info EINA_UNUSED) 161 void *event_info EINA_UNUSED)
162{ 162{
163 Ephoto_Cropper *ec = data; 163 Ephoto_Cropper *ec = data;
164 Edje_Message_Int_Set *msg; 164 Edje_Message_Int_Set *msg;
@@ -169,12 +169,12 @@ _reset_crop(void *data, Evas_Object *obj EINA_UNUSED,
169 msg->val[1] = 0; 169 msg->val[1] = 0;
170 msg->val[2] = 0; 170 msg->val[2] = 0;
171 edje_object_message_send(elm_layout_edje_get(ec->layout), 171 edje_object_message_send(elm_layout_edje_get(ec->layout),
172 EDJE_MESSAGE_INT_SET, 1, msg); 172 EDJE_MESSAGE_INT_SET, 1, msg);
173} 173}
174 174
175static void 175static void
176_apply_crop(void *data, Evas_Object *obj EINA_UNUSED, 176_apply_crop(void *data, Evas_Object *obj EINA_UNUSED,
177 void *event_info EINA_UNUSED) 177 void *event_info EINA_UNUSED)
178{ 178{
179 Ephoto_Cropper *ec = data; 179 Ephoto_Cropper *ec = data;
180 Evas_Object *edje = elm_layout_edje_get(ec->layout); 180 Evas_Object *edje = elm_layout_edje_get(ec->layout);
@@ -186,16 +186,16 @@ _apply_crop(void *data, Evas_Object *obj EINA_UNUSED,
186 186
187 edje_object_part_geometry_get(edje, "ephoto.swallow.image", &x, &y, &w, &h); 187 edje_object_part_geometry_get(edje, "ephoto.swallow.image", &x, &y, &w, &h);
188 edje_object_part_geometry_get(edje, "ephoto.swallow.cropper", &cx, &cy, &cw, 188 edje_object_part_geometry_get(edje, "ephoto.swallow.cropper", &cx, &cy, &cw,
189 &ch); 189 &ch);
190 evas_object_image_size_get(ec->image, &iw, &ih); 190 evas_object_image_size_get(ec->image, &iw, &ih);
191 191
192 idata = 192 idata =
193 evas_object_image_data_get(ec->image, EINA_FALSE); 193 evas_object_image_data_get(ec->image, EINA_FALSE);
194 194
195 scalex = (double) (cx-x) / (double) w; 195 scalex = (double)(cx - x) / (double)w;
196 scaley = (double) (cy-y) / (double) h; 196 scaley = (double)(cy - y) / (double)h;
197 scalew = (double) cw / (double) w; 197 scalew = (double)cw / (double)w;
198 scaleh = (double) ch / (double) h; 198 scaleh = (double)ch / (double)h;
199 199
200 nx = iw * scalex; 200 nx = iw * scalex;
201 ny = ih * scaley; 201 ny = ih * scaley;
@@ -207,20 +207,20 @@ _apply_crop(void *data, Evas_Object *obj EINA_UNUSED,
207 207
208 for (i = 0; i < nh; i++) 208 for (i = 0; i < nh; i++)
209 { 209 {
210 tmpy = (i + ny) * iw; 210 tmpy = (i + ny) * iw;
211 for (j = 0; j < nw; j++) 211 for (j = 0; j < nw; j++)
212 { 212 {
213 tmpx = j + nx; 213 tmpx = j + nx;
214 ind = tmpy + tmpx; 214 ind = tmpy + tmpx;
215 idata_new[index] = idata[ind]; 215 idata_new[index] = idata[ind];
216 index++; 216 index++;
217 } 217 }
218 } 218 }
219 elm_table_unpack(ec->image_parent, ec->box); 219 elm_table_unpack(ec->image_parent, ec->box);
220 elm_layout_content_unset(ec->layout, "ephoto.swallow.image"); 220 elm_layout_content_unset(ec->layout, "ephoto.swallow.image");
221 elm_table_pack(ec->image_parent, ec->image, 0, 0, 1, 1); 221 elm_table_pack(ec->image_parent, ec->image, 0, 0, 1, 1);
222 ephoto_single_browser_image_data_done(ec->main, 222 ephoto_single_browser_image_data_done(ec->main,
223 idata_new, nw, nh); 223 idata_new, nw, nh);
224 evas_object_del(ec->cropper); 224 evas_object_del(ec->cropper);
225 evas_object_del(ec->layout); 225 evas_object_del(ec->layout);
226 evas_object_del(ec->box); 226 evas_object_del(ec->box);
@@ -229,7 +229,7 @@ _apply_crop(void *data, Evas_Object *obj EINA_UNUSED,
229 229
230static void 230static void
231_cancel_crop(void *data, Evas_Object *obj EINA_UNUSED, 231_cancel_crop(void *data, Evas_Object *obj EINA_UNUSED,
232 void *event_info EINA_UNUSED) 232 void *event_info EINA_UNUSED)
233{ 233{
234 Ephoto_Cropper *ec = data; 234 Ephoto_Cropper *ec = data;
235 235
@@ -245,7 +245,7 @@ _cancel_crop(void *data, Evas_Object *obj EINA_UNUSED,
245 245
246static void 246static void
247_cropper_both_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, 247_cropper_both_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
248 const char *emission EINA_UNUSED, const char *source) 248 const char *emission EINA_UNUSED, const char *source)
249{ 249{
250 Ephoto_Cropper *ec = data; 250 Ephoto_Cropper *ec = data;
251 Edje_Message_Int_Set *msg; 251 Edje_Message_Int_Set *msg;
@@ -256,13 +256,13 @@ _cropper_both_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
256 evas_object_geometry_get(ec->layout, &lx, &ly, &lw, &lh); 256 evas_object_geometry_get(ec->layout, &lx, &ly, &lw, &lh);
257 257
258 if (mx < lx) 258 if (mx < lx)
259 mx = lx; 259 mx = lx;
260 else if (mx > lx + lw) 260 else if (mx > lx + lw)
261 mx = lx + lw; 261 mx = lx + lw;
262 if (my < ly) 262 if (my < ly)
263 my = ly; 263 my = ly;
264 else if (my > ly + lh) 264 else if (my > ly + lh)
265 my = ly + lh; 265 my = ly + lh;
266 266
267 nx = mx - ec->startx; 267 nx = mx - ec->startx;
268 ny = my - ec->starty; 268 ny = my - ec->starty;
@@ -272,36 +272,36 @@ _cropper_both_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
272 msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); 272 msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int)));
273 msg->count = 3; 273 msg->count = 3;
274 if (!strcmp(source, "handle1")) 274 if (!strcmp(source, "handle1"))
275 msg->val[0] = 1; 275 msg->val[0] = 1;
276 else if (!strcmp(source, "handle3")) 276 else if (!strcmp(source, "handle3"))
277 msg->val[0] = 3; 277 msg->val[0] = 3;
278 else if (!strcmp(source, "handle5")) 278 else if (!strcmp(source, "handle5"))
279 msg->val[0] = 5; 279 msg->val[0] = 5;
280 else if (!strcmp(source, "handle7")) 280 else if (!strcmp(source, "handle7"))
281 msg->val[0] = 7; 281 msg->val[0] = 7;
282 282
283 msg->val[1] = nx; 283 msg->val[1] = nx;
284 msg->val[2] = ny; 284 msg->val[2] = ny;
285 edje_object_message_send(elm_layout_edje_get(ec->layout), 285 edje_object_message_send(elm_layout_edje_get(ec->layout),
286 EDJE_MESSAGE_INT_SET, 1, msg); 286 EDJE_MESSAGE_INT_SET, 1, msg);
287} 287}
288 288
289static void 289static void
290_cropper_both_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, 290_cropper_both_mouse_up(void *data, Evas_Object *obj EINA_UNUSED,
291 const char *emission EINA_UNUSED, const char *source) 291 const char *emission EINA_UNUSED, const char *source)
292{ 292{
293 Ephoto_Cropper *ec = data; 293 Ephoto_Cropper *ec = data;
294 294
295 edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source, 295 edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source,
296 _cropper_both_mouse_move, ec); 296 _cropper_both_mouse_move, ec);
297 edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source, 297 edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source,
298 _cropper_both_mouse_up, ec); 298 _cropper_both_mouse_up, ec);
299 ec->resizing = 0; 299 ec->resizing = 0;
300} 300}
301 301
302static void 302static void
303_cropper_resize_both(void *data, Evas_Object *obj EINA_UNUSED, 303_cropper_resize_both(void *data, Evas_Object *obj EINA_UNUSED,
304 const char *emission EINA_UNUSED, const char *source) 304 const char *emission EINA_UNUSED, const char *source)
305{ 305{
306 Ephoto_Cropper *ec = data; 306 Ephoto_Cropper *ec = data;
307 Evas_Coord mx, my, cx, cy; 307 Evas_Coord mx, my, cx, cy;
@@ -315,14 +315,14 @@ _cropper_resize_both(void *data, Evas_Object *obj EINA_UNUSED,
315 ec->starty = my; 315 ec->starty = my;
316 316
317 edje_object_signal_callback_add(ec->cropper, "mouse,move", source, 317 edje_object_signal_callback_add(ec->cropper, "mouse,move", source,
318 _cropper_both_mouse_move, ec); 318 _cropper_both_mouse_move, ec);
319 edje_object_signal_callback_add(ec->cropper, "mouse,up,1", source, 319 edje_object_signal_callback_add(ec->cropper, "mouse,up,1", source,
320 _cropper_both_mouse_up, ec); 320 _cropper_both_mouse_up, ec);
321} 321}
322 322
323static void 323static void
324_cropper_horiz_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, 324_cropper_horiz_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
325 const char *emission EINA_UNUSED, const char *source) 325 const char *emission EINA_UNUSED, const char *source)
326{ 326{
327 Ephoto_Cropper *ec = data; 327 Ephoto_Cropper *ec = data;
328 Edje_Message_Int_Set *msg; 328 Edje_Message_Int_Set *msg;
@@ -333,9 +333,9 @@ _cropper_horiz_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
333 evas_object_geometry_get(ec->layout, &lx, 0, &lw, 0); 333 evas_object_geometry_get(ec->layout, &lx, 0, &lw, 0);
334 334
335 if (mx < lx) 335 if (mx < lx)
336 mx = lx; 336 mx = lx;
337 else if (mx > lx + lw) 337 else if (mx > lx + lw)
338 mx = lx + lw; 338 mx = lx + lw;
339 339
340 nx = mx - ec->startx; 340 nx = mx - ec->startx;
341 ec->startx = mx; 341 ec->startx = mx;
@@ -343,31 +343,31 @@ _cropper_horiz_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
343 msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); 343 msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int)));
344 msg->count = 3; 344 msg->count = 3;
345 if (!strcmp(source, "handle4")) 345 if (!strcmp(source, "handle4"))
346 msg->val[0] = 4; 346 msg->val[0] = 4;
347 else if (!strcmp(source, "handle8")) 347 else if (!strcmp(source, "handle8"))
348 msg->val[0] = 8; 348 msg->val[0] = 8;
349 msg->val[1] = nx; 349 msg->val[1] = nx;
350 msg->val[2] = 0; 350 msg->val[2] = 0;
351 edje_object_message_send(elm_layout_edje_get(ec->layout), 351 edje_object_message_send(elm_layout_edje_get(ec->layout),
352 EDJE_MESSAGE_INT_SET, 1, msg); 352 EDJE_MESSAGE_INT_SET, 1, msg);
353} 353}
354 354
355static void 355static void
356_cropper_horiz_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, 356_cropper_horiz_mouse_up(void *data, Evas_Object *obj EINA_UNUSED,
357 const char *emission EINA_UNUSED, const char *source) 357 const char *emission EINA_UNUSED, const char *source)
358{ 358{
359 Ephoto_Cropper *ec = data; 359 Ephoto_Cropper *ec = data;
360 360
361 edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source, 361 edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source,
362 _cropper_horiz_mouse_move, ec); 362 _cropper_horiz_mouse_move, ec);
363 edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source, 363 edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source,
364 _cropper_horiz_mouse_up, ec); 364 _cropper_horiz_mouse_up, ec);
365 ec->resizing = 0; 365 ec->resizing = 0;
366} 366}
367 367
368static void 368static void
369_cropper_resize_horiz(void *data, Evas_Object *obj EINA_UNUSED, 369_cropper_resize_horiz(void *data, Evas_Object *obj EINA_UNUSED,
370 const char *emission EINA_UNUSED, const char *source EINA_UNUSED) 370 const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
371{ 371{
372 Ephoto_Cropper *ec = data; 372 Ephoto_Cropper *ec = data;
373 Evas_Coord mx, my, cx, cy; 373 Evas_Coord mx, my, cx, cy;
@@ -381,14 +381,14 @@ _cropper_resize_horiz(void *data, Evas_Object *obj EINA_UNUSED,
381 ec->starty = my; 381 ec->starty = my;
382 382
383 edje_object_signal_callback_add(ec->cropper, "mouse,move", source, 383 edje_object_signal_callback_add(ec->cropper, "mouse,move", source,
384 _cropper_horiz_mouse_move, ec); 384 _cropper_horiz_mouse_move, ec);
385 edje_object_signal_callback_add(ec->cropper, "mouse,up,1", source, 385 edje_object_signal_callback_add(ec->cropper, "mouse,up,1", source,
386 _cropper_horiz_mouse_up, ec); 386 _cropper_horiz_mouse_up, ec);
387} 387}
388 388
389static void 389static void
390_cropper_vert_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, 390_cropper_vert_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
391 const char *emission EINA_UNUSED, const char *source) 391 const char *emission EINA_UNUSED, const char *source)
392{ 392{
393 Ephoto_Cropper *ec = data; 393 Ephoto_Cropper *ec = data;
394 Edje_Message_Int_Set *msg; 394 Edje_Message_Int_Set *msg;
@@ -399,9 +399,9 @@ _cropper_vert_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
399 evas_object_geometry_get(ec->layout, 0, &ly, 0, &lh); 399 evas_object_geometry_get(ec->layout, 0, &ly, 0, &lh);
400 400
401 if (my < ly) 401 if (my < ly)
402 my = ly; 402 my = ly;
403 else if (my > ly + lh) 403 else if (my > ly + lh)
404 my = ly + lh; 404 my = ly + lh;
405 405
406 ny = my - ec->starty; 406 ny = my - ec->starty;
407 ec->starty = my; 407 ec->starty = my;
@@ -409,31 +409,31 @@ _cropper_vert_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
409 msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); 409 msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int)));
410 msg->count = 3; 410 msg->count = 3;
411 if (!strcmp(source, "handle2")) 411 if (!strcmp(source, "handle2"))
412 msg->val[0] = 2; 412 msg->val[0] = 2;
413 else if (!strcmp(source, "handle6")) 413 else if (!strcmp(source, "handle6"))
414 msg->val[0] = 6; 414 msg->val[0] = 6;
415 msg->val[1] = 0; 415 msg->val[1] = 0;
416 msg->val[2] = ny; 416 msg->val[2] = ny;
417 edje_object_message_send(elm_layout_edje_get(ec->layout), 417 edje_object_message_send(elm_layout_edje_get(ec->layout),
418 EDJE_MESSAGE_INT_SET, 1, msg); 418 EDJE_MESSAGE_INT_SET, 1, msg);
419} 419}
420 420
421static void 421static void
422_cropper_vert_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, 422_cropper_vert_mouse_up(void *data, Evas_Object *obj EINA_UNUSED,
423 const char *emission EINA_UNUSED, const char *source) 423 const char *emission EINA_UNUSED, const char *source)
424{ 424{
425 Ephoto_Cropper *ec = data; 425 Ephoto_Cropper *ec = data;
426 426
427 edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source, 427 edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source,
428 _cropper_vert_mouse_move, ec); 428 _cropper_vert_mouse_move, ec);
429 edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source, 429 edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source,
430 _cropper_vert_mouse_up, ec); 430 _cropper_vert_mouse_up, ec);
431 ec->resizing = 0; 431 ec->resizing = 0;
432} 432}
433 433
434static void 434static void
435_cropper_resize_vert(void *data, Evas_Object *obj EINA_UNUSED, 435_cropper_resize_vert(void *data, Evas_Object *obj EINA_UNUSED,
436 const char *emission EINA_UNUSED, const char *source EINA_UNUSED) 436 const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
437{ 437{
438 Ephoto_Cropper *ec = data; 438 Ephoto_Cropper *ec = data;
439 Evas_Coord mx, my, cx, cy; 439 Evas_Coord mx, my, cx, cy;
@@ -447,66 +447,66 @@ _cropper_resize_vert(void *data, Evas_Object *obj EINA_UNUSED,
447 ec->starty = my; 447 ec->starty = my;
448 448
449 edje_object_signal_callback_add(ec->cropper, "mouse,move", source, 449 edje_object_signal_callback_add(ec->cropper, "mouse,move", source,
450 _cropper_vert_mouse_move, ec); 450 _cropper_vert_mouse_move, ec);
451 edje_object_signal_callback_add(ec->cropper, "mouse,up,1", source, 451 edje_object_signal_callback_add(ec->cropper, "mouse,up,1", source,
452 _cropper_vert_mouse_up, ec); 452 _cropper_vert_mouse_up, ec);
453} 453}
454 454
455static void 455static void
456_cropper_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, 456_cropper_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
457 const char *emission EINA_UNUSED, const char *source EINA_UNUSED) 457 const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
458{ 458{
459 Ephoto_Cropper *ec = data; 459 Ephoto_Cropper *ec = data;
460 460
461 if (!ec->resizing) 461 if (!ec->resizing)
462 { 462 {
463 Edje_Message_Int_Set *msg; 463 Edje_Message_Int_Set *msg;
464 Evas_Coord mx, my, cx, cy, cw, ch, nx, ny, lx, ly, lw, lh; 464 Evas_Coord mx, my, cx, cy, cw, ch, nx, ny, lx, ly, lw, lh;
465 465
466 evas_pointer_canvas_xy_get(evas_object_evas_get(ec->cropper), 466 evas_pointer_canvas_xy_get(evas_object_evas_get(ec->cropper),
467 &mx, &my); 467 &mx, &my);
468 evas_object_geometry_get(ec->cropper, &cx, &cy, &cw, &ch); 468 evas_object_geometry_get(ec->cropper, &cx, &cy, &cw, &ch);
469 evas_object_geometry_get(ec->layout, &lx, &ly, &lw, &lh); 469 evas_object_geometry_get(ec->layout, &lx, &ly, &lw, &lh);
470 470
471 if (mx < lx) 471 if (mx < lx)
472 mx = lx; 472 mx = lx;
473 else if (mx > lx + lw) 473 else if (mx > lx + lw)
474 mx = lx + lw; 474 mx = lx + lw;
475 if (my < ly) 475 if (my < ly)
476 my = ly; 476 my = ly;
477 else if (my > ly + lh) 477 else if (my > ly + lh)
478 my = ly + lh; 478 my = ly + lh;
479 479
480 nx = mx - ec->startx; 480 nx = mx - ec->startx;
481 ny = my - ec->starty; 481 ny = my - ec->starty;
482 ec->startx = mx; 482 ec->startx = mx;
483 ec->starty = my; 483 ec->starty = my;
484 484
485 msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); 485 msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int)));
486 msg->count = 3; 486 msg->count = 3;
487 msg->val[0] = 0; 487 msg->val[0] = 0;
488 msg->val[1] = nx; 488 msg->val[1] = nx;
489 msg->val[2] = ny; 489 msg->val[2] = ny;
490 edje_object_message_send(elm_layout_edje_get(ec->layout), 490 edje_object_message_send(elm_layout_edje_get(ec->layout),
491 EDJE_MESSAGE_INT_SET, 1, msg); 491 EDJE_MESSAGE_INT_SET, 1, msg);
492 } 492 }
493} 493}
494 494
495static void 495static void
496_cropper_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, 496_cropper_mouse_up(void *data, Evas_Object *obj EINA_UNUSED,
497 const char *emission EINA_UNUSED, const char *source EINA_UNUSED) 497 const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
498{ 498{
499 Ephoto_Cropper *ec = data; 499 Ephoto_Cropper *ec = data;
500 500
501 edje_object_signal_callback_del_full(ec->cropper, "mouse,move", "dragger", 501 edje_object_signal_callback_del_full(ec->cropper, "mouse,move", "dragger",
502 _cropper_mouse_move, ec); 502 _cropper_mouse_move, ec);
503 edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", "dragger", 503 edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", "dragger",
504 _cropper_mouse_up, ec); 504 _cropper_mouse_up, ec);
505} 505}
506 506
507static void 507static void
508_cropper_move(void *data, Evas_Object *obj EINA_UNUSED, 508_cropper_move(void *data, Evas_Object *obj EINA_UNUSED,
509 const char *emission EINA_UNUSED, const char *source EINA_UNUSED) 509 const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
510{ 510{
511 Ephoto_Cropper *ec = data; 511 Ephoto_Cropper *ec = data;
512 Evas_Coord mx, my, cx, cy; 512 Evas_Coord mx, my, cx, cy;
@@ -519,14 +519,14 @@ _cropper_move(void *data, Evas_Object *obj EINA_UNUSED,
519 ec->offsety = my - cy; 519 ec->offsety = my - cy;
520 520
521 edje_object_signal_callback_add(ec->cropper, "mouse,move", "dragger", 521 edje_object_signal_callback_add(ec->cropper, "mouse,move", "dragger",
522 _cropper_mouse_move, ec); 522 _cropper_mouse_move, ec);
523 edje_object_signal_callback_add(ec->cropper, "mouse,up,1", "dragger", 523 edje_object_signal_callback_add(ec->cropper, "mouse,up,1", "dragger",
524 _cropper_mouse_up, ec); 524 _cropper_mouse_up, ec);
525} 525}
526 526
527static void 527static void
528_image_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 528_image_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
529 void *event_info EINA_UNUSED) 529 void *event_info EINA_UNUSED)
530{ 530{
531 Ephoto_Cropper *ec = data; 531 Ephoto_Cropper *ec = data;
532 Edje_Message_Int_Set *msg; 532 Edje_Message_Int_Set *msg;
@@ -540,31 +540,31 @@ _image_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
540 540
541 if (sw > sh) 541 if (sw > sh)
542 { 542 {
543 nw = sw; 543 nw = sw;
544 nh = ih * ((double) sw / (double) iw); 544 nh = ih * ((double)sw / (double)iw);
545 if (nh > sh) 545 if (nh > sh)
546 { 546 {
547 Evas_Coord onw, onh; 547 Evas_Coord onw, onh;
548 548
549 onw = nw; 549 onw = nw;
550 onh = nh; 550 onh = nh;
551 nh = sh; 551 nh = sh;
552 nw = onw * ((double) nh / (double) onh); 552 nw = onw * ((double)nh / (double)onh);
553 } 553 }
554 } 554 }
555 else 555 else
556 { 556 {
557 nh = sh; 557 nh = sh;
558 nw = iw * ((double) sh / (double) ih); 558 nw = iw * ((double)sh / (double)ih);
559 if (nw > sw) 559 if (nw > sw)
560 { 560 {
561 Evas_Coord onw, onh; 561 Evas_Coord onw, onh;
562 562
563 onw = nw; 563 onw = nw;
564 onh = nh; 564 onh = nh;
565 nw = sw; 565 nw = sw;
566 nh = onh * ((double) nw / (double) onw); 566 nh = onh * ((double)nw / (double)onw);
567 } 567 }
568 } 568 }
569 diffw = sw - nw; 569 diffw = sw - nw;
570 diffh = sh - nh; 570 diffh = sh - nh;
@@ -582,12 +582,12 @@ _image_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
582 msg->val[1] = 0; 582 msg->val[1] = 0;
583 msg->val[2] = 0; 583 msg->val[2] = 0;
584 edje_object_message_send(elm_layout_edje_get(ec->layout), 584 edje_object_message_send(elm_layout_edje_get(ec->layout),
585 EDJE_MESSAGE_INT_SET, 1, msg); 585 EDJE_MESSAGE_INT_SET, 1, msg);
586} 586}
587 587
588static Eina_Bool 588static Eina_Bool
589_crop_reset(void *data, int type EINA_UNUSED, 589_crop_reset(void *data, int type EINA_UNUSED,
590 void *event_info EINA_UNUSED) 590 void *event_info EINA_UNUSED)
591{ 591{
592 _reset_crop(data, NULL, NULL); 592 _reset_crop(data, NULL, NULL);
593 593
@@ -596,7 +596,7 @@ _crop_reset(void *data, int type EINA_UNUSED,
596 596
597static Eina_Bool 597static Eina_Bool
598_crop_apply(void *data, int type EINA_UNUSED, 598_crop_apply(void *data, int type EINA_UNUSED,
599 void *event_info EINA_UNUSED) 599 void *event_info EINA_UNUSED)
600{ 600{
601 _apply_crop(data, NULL, NULL); 601 _apply_crop(data, NULL, NULL);
602 602
@@ -605,7 +605,7 @@ _crop_apply(void *data, int type EINA_UNUSED,
605 605
606static Eina_Bool 606static Eina_Bool
607_crop_cancel(void *data, int type EINA_UNUSED, 607_crop_cancel(void *data, int type EINA_UNUSED,
608 void *event_info EINA_UNUSED) 608 void *event_info EINA_UNUSED)
609{ 609{
610 _cancel_crop(data, NULL, NULL); 610 _cancel_crop(data, NULL, NULL);
611 611
@@ -614,7 +614,7 @@ _crop_cancel(void *data, int type EINA_UNUSED,
614 614
615static void 615static void
616_editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 616_editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
617 void *event_info EINA_UNUSED) 617 void *event_info EINA_UNUSED)
618{ 618{
619 Ephoto_Cropper *ec = data; 619 Ephoto_Cropper *ec = data;
620 Ecore_Event_Handler *handler; 620 Ecore_Event_Handler *handler;
@@ -627,7 +627,7 @@ _editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
627 627
628void 628void
629ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, 629ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
630 Evas_Object *image_parent, Evas_Object *image) 630 Evas_Object *image_parent, Evas_Object *image)
631{ 631{
632 Ephoto_Cropper *ec; 632 Ephoto_Cropper *ec;
633 Evas_Coord w, h; 633 Evas_Coord w, h;
@@ -655,7 +655,7 @@ ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
655 655
656 ec->layout = elm_layout_add(ec->box); 656 ec->layout = elm_layout_add(ec->box);
657 elm_layout_file_set(ec->layout, PACKAGE_DATA_DIR "/themes/ephoto.edj", 657 elm_layout_file_set(ec->layout, PACKAGE_DATA_DIR "/themes/ephoto.edj",
658 "ephoto,image,cropper,base"); 658 "ephoto,image,cropper,base");
659 EPHOTO_EXPAND(ec->layout); 659 EPHOTO_EXPAND(ec->layout);
660 EPHOTO_FILL(ec->layout); 660 EPHOTO_FILL(ec->layout);
661 elm_box_pack_end(ec->box, ec->layout); 661 elm_box_pack_end(ec->box, ec->layout);
@@ -668,39 +668,39 @@ ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
668 668
669 ec->cropper = edje_object_add(evas_object_evas_get(ec->layout)); 669 ec->cropper = edje_object_add(evas_object_evas_get(ec->layout));
670 edje_object_file_set(ec->cropper, PACKAGE_DATA_DIR "/themes/ephoto.edj", 670 edje_object_file_set(ec->cropper, PACKAGE_DATA_DIR "/themes/ephoto.edj",
671 "ephoto,image,cropper"); 671 "ephoto,image,cropper");
672 edje_object_signal_callback_add(elm_layout_edje_get(ec->layout), 672 edje_object_signal_callback_add(elm_layout_edje_get(ec->layout),
673 "cropper,changed", "ephoto.swallow.cropper", _calculate_cropper_size, 673 "cropper,changed", "ephoto.swallow.cropper", _calculate_cropper_size,
674 ec); 674 ec);
675 elm_layout_content_set(ec->layout, "ephoto.swallow.cropper", ec->cropper); 675 elm_layout_content_set(ec->layout, "ephoto.swallow.cropper", ec->cropper);
676 evas_object_show(ec->cropper); 676 evas_object_show(ec->cropper);
677 677
678 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "dragger", 678 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "dragger",
679 _cropper_move, ec); 679 _cropper_move, ec);
680 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle1", 680 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle1",
681 _cropper_resize_both, ec); 681 _cropper_resize_both, ec);
682 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle2", 682 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle2",
683 _cropper_resize_vert, ec); 683 _cropper_resize_vert, ec);
684 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle3", 684 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle3",
685 _cropper_resize_both, ec); 685 _cropper_resize_both, ec);
686 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle4", 686 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle4",
687 _cropper_resize_horiz, ec); 687 _cropper_resize_horiz, ec);
688 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle5", 688 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle5",
689 _cropper_resize_both, ec); 689 _cropper_resize_both, ec);
690 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle6", 690 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle6",
691 _cropper_resize_vert, ec); 691 _cropper_resize_vert, ec);
692 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle7", 692 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle7",
693 _cropper_resize_both, ec); 693 _cropper_resize_both, ec);
694 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle8", 694 edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle8",
695 _cropper_resize_horiz, ec); 695 _cropper_resize_horiz, ec);
696 696
697 evas_object_event_callback_add(ec->layout, EVAS_CALLBACK_RESIZE, 697 evas_object_event_callback_add(ec->layout, EVAS_CALLBACK_RESIZE,
698 _image_resize, ec); 698 _image_resize, ec);
699 699
700 ec->editor = ephoto_editor_add(ephoto, parent, _("Crop Image"), 700 ec->editor = ephoto_editor_add(ephoto, parent, _("Crop Image"),
701 "ec", ec); 701 "ec", ec);
702 evas_object_event_callback_add(ec->editor, EVAS_CALLBACK_DEL, 702 evas_object_event_callback_add(ec->editor, EVAS_CALLBACK_DEL,
703 _editor_del, ec); 703 _editor_del, ec);
704 704
705 ec->croph = elm_slider_add(ec->editor); 705 ec->croph = elm_slider_add(ec->editor);
706 elm_slider_min_max_set(ec->croph, 1, h); 706 elm_slider_min_max_set(ec->croph, 1, h);
@@ -712,7 +712,7 @@ ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
712 EPHOTO_ALIGN(ec->croph, EVAS_HINT_FILL, 0.5); 712 EPHOTO_ALIGN(ec->croph, EVAS_HINT_FILL, 0.5);
713 elm_box_pack_start(ec->editor, ec->croph); 713 elm_box_pack_start(ec->editor, ec->croph);
714 evas_object_smart_callback_add(ec->croph, "slider,drag,stop", 714 evas_object_smart_callback_add(ec->croph, "slider,drag,stop",
715 _cropper_changed_height, ec); 715 _cropper_changed_height, ec);
716 evas_object_show(ec->croph); 716 evas_object_show(ec->croph);
717 717
718 ec->cropw = elm_slider_add(ec->editor); 718 ec->cropw = elm_slider_add(ec->editor);
@@ -725,24 +725,25 @@ ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
725 EPHOTO_ALIGN(ec->cropw, EVAS_HINT_FILL, 0.5); 725 EPHOTO_ALIGN(ec->cropw, EVAS_HINT_FILL, 0.5);
726 elm_box_pack_start(ec->editor, ec->cropw); 726 elm_box_pack_start(ec->editor, ec->cropw);
727 evas_object_smart_callback_add(ec->cropw, "slider,drag,stop", 727 evas_object_smart_callback_add(ec->cropw, "slider,drag,stop",
728 _cropper_changed_width, ec); 728 _cropper_changed_width, ec);
729 evas_object_show(ec->cropw); 729 evas_object_show(ec->cropw);
730 730
731 ec->handlers = 731 ec->handlers =
732 eina_list_append(ec->handlers, 732 eina_list_append(ec->handlers,
733 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, 733 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET,
734 _crop_reset, ec)); 734 _crop_reset, ec));
735 ec->handlers = 735 ec->handlers =
736 eina_list_append(ec->handlers, 736 eina_list_append(ec->handlers,
737 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, 737 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY,
738 _crop_apply, ec)); 738 _crop_apply, ec));
739 ec->handlers = 739 ec->handlers =
740 eina_list_append(ec->handlers, 740 eina_list_append(ec->handlers,
741 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, 741 ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL,
742 _crop_cancel, ec)); 742 _crop_cancel, ec));
743 743
744 return; 744 return;
745 745
746 error: 746error:
747 return; 747 return;
748} 748}
749
diff --git a/src/bin/ephoto_directory_browser.c b/src/bin/ephoto_directory_browser.c
index aa8eaef..b7d8288 100644
--- a/src/bin/ephoto_directory_browser.c
+++ b/src/bin/ephoto_directory_browser.c
@@ -11,48 +11,48 @@ typedef struct _Ephoto_Directory_Browser Ephoto_Directory_Browser;
11 11
12struct _Ephoto_Directory_Browser 12struct _Ephoto_Directory_Browser
13{ 13{
14 Ephoto *ephoto; 14 Ephoto *ephoto;
15 Evas_Object *main; 15 Evas_Object *main;
16 Evas_Object *fsel; 16 Evas_Object *fsel;
17 Evas_Object *fsel_back; 17 Evas_Object *fsel_back;
18 Evas_Object *leftbox; 18 Evas_Object *leftbox;
19 Elm_Object_Item *dir_current; 19 Elm_Object_Item *dir_current;
20 Elm_Object_Item *last_sel; 20 Elm_Object_Item *last_sel;
21 Eio_File *ls; 21 Eio_File *ls;
22 Eina_Bool dirs_only; 22 Eina_Bool dirs_only;
23 Eina_Bool thumbs_only; 23 Eina_Bool thumbs_only;
24 Eio_Monitor *monitor; 24 Eio_Monitor *monitor;
25 Eina_List *monitor_handlers; 25 Eina_List *monitor_handlers;
26 Eina_List *handlers; 26 Eina_List *handlers;
27 Eina_List *todo_items; 27 Eina_List *todo_items;
28 Ecore_Job *change_dir_job; 28 Ecore_Job *change_dir_job;
29 Ecore_Timer *click_timer; 29 Ecore_Timer *click_timer;
30 Eina_Bool processing; 30 Eina_Bool processing;
31 Eina_Bool initializing; 31 Eina_Bool initializing;
32 struct 32 struct
33 { 33 {
34 Ecore_Animator *todo_items; 34 Ecore_Animator *todo_items;
35 int count; 35 int count;
36 int processed; 36 int processed;
37 } animator; 37 } animator;
38 Eina_Bool main_deleted:1; 38 Eina_Bool main_deleted : 1;
39 const char *back_directory; 39 const char *back_directory;
40}; 40};
41 41
42static Elm_Genlist_Item_Class *_ephoto_dir_class; 42static Elm_Genlist_Item_Class *_ephoto_dir_class;
43static Elm_Genlist_Item_Class *_ephoto_dir_tree_class; 43static Elm_Genlist_Item_Class *_ephoto_dir_tree_class;
44 44
45static char * _drag_data_extract(char **drag_data); 45static char *_drag_data_extract(char **drag_data);
46 46
47static Eina_Bool _monitor_cb(void *data, int type, 47static Eina_Bool _monitor_cb(void *data, int type,
48 void *event); 48 void *event);
49static void _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED, 49static void _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
50 Evas_Object *obj EINA_UNUSED, void *event_info); 50 Evas_Object *obj EINA_UNUSED, void *event_info);
51 51
52/*File Pane Callbacks*/ 52/*File Pane Callbacks*/
53static void 53static void
54_menu_dismissed_cb(void *data, Evas_Object *obj, 54_menu_dismissed_cb(void *data, Evas_Object *obj,
55 void *event_info EINA_UNUSED) 55 void *event_info EINA_UNUSED)
56{ 56{
57 Ephoto_Directory_Browser *db = data; 57 Ephoto_Directory_Browser *db = data;
58 58
@@ -62,7 +62,7 @@ _menu_dismissed_cb(void *data, Evas_Object *obj,
62 62
63static void 63static void
64_menu_empty_cb(void *data, Evas_Object *obj EINA_UNUSED, 64_menu_empty_cb(void *data, Evas_Object *obj EINA_UNUSED,
65 void *event_info EINA_UNUSED) 65 void *event_info EINA_UNUSED)
66{ 66{
67 Ephoto_Directory_Browser *db = data; 67 Ephoto_Directory_Browser *db = data;
68 Eina_List *paths = NULL; 68 Eina_List *paths = NULL;
@@ -83,7 +83,7 @@ _menu_empty_cb(void *data, Evas_Object *obj EINA_UNUSED,
83 83
84static Eina_Bool 84static Eina_Bool
85_drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it, 85_drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it,
86 Elm_Selection_Data *ev, int xposret EINA_UNUSED, int yposret EINA_UNUSED) 86 Elm_Selection_Data *ev, int xposret EINA_UNUSED, int yposret EINA_UNUSED)
87{ 87{
88 if (!it) 88 if (!it)
89 return EINA_FALSE; 89 return EINA_FALSE;
@@ -93,16 +93,16 @@ _drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it,
93 Ephoto_Directory_Browser *db = evas_object_data_get(obj, "directory_browser"); 93 Ephoto_Directory_Browser *db = evas_object_data_get(obj, "directory_browser");
94 94
95 if (!ev->data) 95 if (!ev->data)
96 return EINA_FALSE; 96 return EINA_FALSE;
97 if (ev->len <= 0) 97 if (ev->len <= 0)
98 return EINA_FALSE; 98 return EINA_FALSE;
99 if (!path) 99 if (!path)
100 return EINA_FALSE; 100 return EINA_FALSE;
101 101
102 char *dd = strdup(ev->data); 102 char *dd = strdup(ev->data);
103 103
104 if (!dd) 104 if (!dd)
105 return EINA_FALSE; 105 return EINA_FALSE;
106 106
107 char *s = _drag_data_extract(&dd); 107 char *s = _drag_data_extract(&dd);
108 108
@@ -110,8 +110,8 @@ _drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it,
110 { 110 {
111 if (evas_object_image_extension_can_load_get(s)) 111 if (evas_object_image_extension_can_load_get(s))
112 files = eina_list_append(files, s); 112 files = eina_list_append(files, s);
113 files = eina_list_append(files, s); 113 files = eina_list_append(files, s);
114 s = _drag_data_extract(&dd); 114 s = _drag_data_extract(&dd);
115 } 115 }
116 free(dd); 116 free(dd);
117 117
@@ -128,7 +128,7 @@ _drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it,
128 128
129static Elm_Object_Item * 129static Elm_Object_Item *
130_drop_item_getcb(Evas_Object *obj, Evas_Coord x, Evas_Coord y, 130_drop_item_getcb(Evas_Object *obj, Evas_Coord x, Evas_Coord y,
131 int *xposret EINA_UNUSED, int *yposret) 131 int *xposret EINA_UNUSED, int *yposret)
132{ 132{
133 Elm_Object_Item *gli; 133 Elm_Object_Item *gli;
134 134
@@ -154,9 +154,9 @@ _drop_leave(void *data, Evas_Object *obj EINA_UNUSED)
154 154
155static void 155static void
156_drop_pos(void *data EINA_UNUSED, Evas_Object *cont EINA_UNUSED, 156_drop_pos(void *data EINA_UNUSED, Evas_Object *cont EINA_UNUSED,
157 Elm_Object_Item *it, Evas_Coord x EINA_UNUSED, 157 Elm_Object_Item *it, Evas_Coord x EINA_UNUSED,
158 Evas_Coord y EINA_UNUSED, int xposret EINA_UNUSED, 158 Evas_Coord y EINA_UNUSED, int xposret EINA_UNUSED,
159 int yposret EINA_UNUSED, Elm_Xdnd_Action action EINA_UNUSED) 159 int yposret EINA_UNUSED, Elm_Xdnd_Action action EINA_UNUSED)
160{ 160{
161 elm_genlist_item_selected_set(it, EINA_TRUE); 161 elm_genlist_item_selected_set(it, EINA_TRUE);
162} 162}
@@ -167,42 +167,42 @@ _drag_data_extract(char **drag_data)
167 char *uri = NULL; 167 char *uri = NULL;
168 168
169 if (!drag_data) 169 if (!drag_data)
170 return uri; 170 return uri;
171 171
172 char *p = *drag_data; 172 char *p = *drag_data;
173 173
174 if (!p) 174 if (!p)
175 return uri; 175 return uri;
176 char *s = strstr(p, FILESEP); 176 char *s = strstr(p, FILESEP);
177 177
178 if (s) 178 if (s)
179 p += FILESEP_LEN; 179 p += FILESEP_LEN;
180 s = strchr(p, '\n'); 180 s = strchr(p, '\n');
181 uri = p; 181 uri = p;
182 if (s) 182 if (s)
183 { 183 {
184 if (s - p > 0) 184 if (s - p > 0)
185 { 185 {
186 char *s1 = s - 1; 186 char *s1 = s - 1;
187 187
188 if (s1[0] == '\r') 188 if (s1[0] == '\r')
189 s1[0] = '\0'; 189 s1[0] = '\0';
190 else 190 else
191 { 191 {
192 char *s2 = s + 1; 192 char *s2 = s + 1;
193 193
194 if (s2[0] == '\r') 194 if (s2[0] == '\r')
195 { 195 {
196 s[0] = '\0'; 196 s[0] = '\0';
197 s++; 197 s++;
198 } 198 }
199 else 199 else
200 s[0] = '\0'; 200 s[0] = '\0';
201 } 201 }
202 } 202 }
203 else 203 else
204 s[0] = '\0'; 204 s[0] = '\0';
205 s++; 205 s++;
206 } 206 }
207 else 207 else
208 p = NULL; 208 p = NULL;
@@ -224,7 +224,7 @@ _entry_cmp(const void *pa, const void *pb)
224 224
225static void 225static void
226_on_list_expand_req(void *data, Evas_Object *obj EINA_UNUSED, 226_on_list_expand_req(void *data, Evas_Object *obj EINA_UNUSED,
227 void *event_info) 227 void *event_info)
228{ 228{
229 Ephoto_Directory_Browser *db = data; 229 Ephoto_Directory_Browser *db = data;
230 Elm_Object_Item *it = event_info; 230 Elm_Object_Item *it = event_info;
@@ -241,7 +241,7 @@ _on_list_expand_req(void *data, Evas_Object *obj EINA_UNUSED,
241 241
242static void 242static void
243_on_list_contract_req(void *data, Evas_Object *obj EINA_UNUSED, 243_on_list_contract_req(void *data, Evas_Object *obj EINA_UNUSED,
244 void *event_info) 244 void *event_info)
245{ 245{
246 Ephoto_Directory_Browser *db = data; 246 Ephoto_Directory_Browser *db = data;
247 Elm_Object_Item *it = event_info; 247 Elm_Object_Item *it = event_info;
@@ -307,9 +307,9 @@ _on_list_contracted(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
307 db->thumbs_only = 1; 307 db->thumbs_only = 1;
308 db->dirs_only = 0; 308 db->dirs_only = 0;
309 ephoto_directory_set(db->ephoto, path, NULL, 309 ephoto_directory_set(db->ephoto, path, NULL,
310 db->dirs_only, db->thumbs_only); 310 db->dirs_only, db->thumbs_only);
311 ephoto_title_set(db->ephoto, 311 ephoto_title_set(db->ephoto,
312 db->ephoto->config->directory); 312 db->ephoto->config->directory);
313} 313}
314 314
315static void 315static void
@@ -326,7 +326,7 @@ _dir_job(void *data)
326 db->thumbs_only = 1; 326 db->thumbs_only = 1;
327 db->dirs_only = 0; 327 db->dirs_only = 0;
328 ephoto_directory_set(db->ephoto, path, NULL, 328 ephoto_directory_set(db->ephoto, path, NULL,
329 db->dirs_only, db->thumbs_only); 329 db->dirs_only, db->thumbs_only);
330 ephoto_title_set(db->ephoto, db->ephoto->config->directory); 330 ephoto_title_set(db->ephoto, db->ephoto->config->directory);
331} 331}
332 332
@@ -342,7 +342,7 @@ _wait_job(void *data)
342 342
343static void 343static void
344_on_list_selected(void *data, Evas_Object *obj EINA_UNUSED, 344_on_list_selected(void *data, Evas_Object *obj EINA_UNUSED,
345 void *event_info) 345 void *event_info)
346{ 346{
347 Ephoto_Directory_Browser *db = data; 347 Ephoto_Directory_Browser *db = data;
348 Elm_Object_Item *it = event_info; 348 Elm_Object_Item *it = event_info;
@@ -357,7 +357,7 @@ _on_list_selected(void *data, Evas_Object *obj EINA_UNUSED,
357 357
358static char * 358static char *
359_dir_item_text_get(void *data, Evas_Object *obj EINA_UNUSED, 359_dir_item_text_get(void *data, Evas_Object *obj EINA_UNUSED,
360 const char *part EINA_UNUSED) 360 const char *part EINA_UNUSED)
361{ 361{
362 Ephoto_Entry *e = data; 362 Ephoto_Entry *e = data;
363 363
@@ -366,12 +366,12 @@ _dir_item_text_get(void *data, Evas_Object *obj EINA_UNUSED,
366 366
367static Evas_Object * 367static Evas_Object *
368_dir_item_icon_get(void *data, Evas_Object *obj, 368_dir_item_icon_get(void *data, Evas_Object *obj,
369 const char *part) 369 const char *part)
370{ 370{
371 Ephoto_Entry *entry = data; 371 Ephoto_Entry *entry = data;
372 372
373 if (!strcmp(part, "elm.swallow.end")) 373 if (!strcmp(part, "elm.swallow.end"))
374 return NULL; 374 return NULL;
375 Evas_Object *ic = elm_icon_add(obj); 375 Evas_Object *ic = elm_icon_add(obj);
376 376
377 if (entry->item) 377 if (entry->item)
@@ -428,7 +428,7 @@ _check_for_subdirs(Ephoto_Entry *entry)
428 428
429static void 429static void
430_trash_back(void *data, Evas_Object *obj EINA_UNUSED, 430_trash_back(void *data, Evas_Object *obj EINA_UNUSED,
431 void *event_info EINA_UNUSED) 431 void *event_info EINA_UNUSED)
432{ 432{
433 Ephoto_Directory_Browser *db = data; 433 Ephoto_Directory_Browser *db = data;
434 434
@@ -441,13 +441,13 @@ _trash_back(void *data, Evas_Object *obj EINA_UNUSED,
441 db->thumbs_only = 1; 441 db->thumbs_only = 1;
442 db->dirs_only = 0; 442 db->dirs_only = 0;
443 ephoto_directory_set(db->ephoto, db->back_directory, NULL, 443 ephoto_directory_set(db->ephoto, db->back_directory, NULL,
444 db->dirs_only, db->thumbs_only); 444 db->dirs_only, db->thumbs_only);
445 ephoto_title_set(db->ephoto, db->back_directory); 445 ephoto_title_set(db->ephoto, db->back_directory);
446} 446}
447 447
448static void 448static void
449_dir_go_trash(void *data, Evas_Object *obj EINA_UNUSED, 449_dir_go_trash(void *data, Evas_Object *obj EINA_UNUSED,
450 void *event_info EINA_UNUSED) 450 void *event_info EINA_UNUSED)
451{ 451{
452 Ephoto_Directory_Browser *db = data; 452 Ephoto_Directory_Browser *db = data;
453 Evas_Object *ic, *but; 453 Evas_Object *ic, *but;
@@ -474,28 +474,28 @@ _dir_go_trash(void *data, Evas_Object *obj EINA_UNUSED,
474 elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE); 474 elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE);
475 EPHOTO_EXPAND(db->fsel); 475 EPHOTO_EXPAND(db->fsel);
476 EPHOTO_FILL(db->fsel); 476 EPHOTO_FILL(db->fsel);
477 evas_object_size_hint_min_set(db->fsel, 195*elm_config_scale_get(), 0); 477 evas_object_size_hint_min_set(db->fsel, 195 * elm_config_scale_get(), 0);
478 evas_object_smart_callback_add(db->fsel, "expand,request", 478 evas_object_smart_callback_add(db->fsel, "expand,request",
479 _on_list_expand_req, db); 479 _on_list_expand_req, db);
480 evas_object_smart_callback_add(db->fsel, "contract,request", 480 evas_object_smart_callback_add(db->fsel, "contract,request",
481 _on_list_contract_req, db); 481 _on_list_contract_req, db);
482 evas_object_smart_callback_add(db->fsel, "expanded", _on_list_expanded, db); 482 evas_object_smart_callback_add(db->fsel, "expanded", _on_list_expanded, db);
483 evas_object_smart_callback_add(db->fsel, "contracted", _on_list_contracted, 483 evas_object_smart_callback_add(db->fsel, "contracted", _on_list_contracted,
484 db); 484 db);
485 evas_object_event_callback_add(db->fsel, EVAS_CALLBACK_MOUSE_UP, 485 evas_object_event_callback_add(db->fsel, EVAS_CALLBACK_MOUSE_UP,
486 _fsel_mouse_up_cb, db); 486 _fsel_mouse_up_cb, db);
487 evas_object_data_set(db->fsel, "directory_browser", db); 487 evas_object_data_set(db->fsel, "directory_browser", db);
488 elm_box_pack_end(db->leftbox, db->fsel); 488 elm_box_pack_end(db->leftbox, db->fsel);
489 evas_object_show(db->fsel); 489 evas_object_show(db->fsel);
490 490
491 eina_stringshare_replace(&db->back_directory, 491 eina_stringshare_replace(&db->back_directory,
492 db->ephoto->config->directory); 492 db->ephoto->config->directory);
493 if (!ecore_file_exists(db->ephoto->trash_path)) 493 if (!ecore_file_exists(db->ephoto->trash_path))
494 ecore_file_mkpath(db->ephoto->trash_path); 494 ecore_file_mkpath(db->ephoto->trash_path);
495 db->thumbs_only = 0; 495 db->thumbs_only = 0;
496 db->dirs_only = 0; 496 db->dirs_only = 0;
497 ephoto_directory_set(db->ephoto, db->ephoto->trash_path, NULL, 497 ephoto_directory_set(db->ephoto, db->ephoto->trash_path, NULL,
498 db->dirs_only, db->thumbs_only); 498 db->dirs_only, db->thumbs_only);
499 ephoto_title_set(db->ephoto, _("Trash")); 499 ephoto_title_set(db->ephoto, _("Trash"));
500 ephoto_directory_browser_top_dir_set(db->ephoto, db->ephoto->config->directory); 500 ephoto_directory_browser_top_dir_set(db->ephoto, db->ephoto->config->directory);
501} 501}
@@ -544,7 +544,7 @@ _fsel_menu_go_home(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EI
544 544
545static void 545static void
546_fsel_menu_new_dir_cb(void *data, Evas_Object *obj EINA_UNUSED, 546_fsel_menu_new_dir_cb(void *data, Evas_Object *obj EINA_UNUSED,
547 void *event_info EINA_UNUSED) 547 void *event_info EINA_UNUSED)
548{ 548{
549 Ephoto_Directory_Browser *db = data; 549 Ephoto_Directory_Browser *db = data;
550 Elm_Object_Item *item = elm_genlist_selected_item_get(db->fsel); 550 Elm_Object_Item *item = elm_genlist_selected_item_get(db->fsel);
@@ -565,7 +565,7 @@ _fsel_menu_new_dir_cb(void *data, Evas_Object *obj EINA_UNUSED,
565 565
566static void 566static void
567_fsel_menu_paste_cb(void *data, Evas_Object *obj EINA_UNUSED, 567_fsel_menu_paste_cb(void *data, Evas_Object *obj EINA_UNUSED,
568 void *event_info EINA_UNUSED) 568 void *event_info EINA_UNUSED)
569{ 569{
570 Ephoto_Directory_Browser *db = data; 570 Ephoto_Directory_Browser *db = data;
571 Elm_Object_Item *item = elm_genlist_selected_item_get(db->fsel); 571 Elm_Object_Item *item = elm_genlist_selected_item_get(db->fsel);
@@ -575,7 +575,7 @@ _fsel_menu_paste_cb(void *data, Evas_Object *obj EINA_UNUSED,
575 575
576static void 576static void
577_fsel_menu_rename_cb(void *data, Evas_Object *obj EINA_UNUSED, 577_fsel_menu_rename_cb(void *data, Evas_Object *obj EINA_UNUSED,
578 void *event_info EINA_UNUSED) 578 void *event_info EINA_UNUSED)
579{ 579{
580 Ephoto_Directory_Browser *db = data; 580 Ephoto_Directory_Browser *db = data;
581 Elm_Object_Item *item = elm_genlist_selected_item_get(db->fsel); 581 Elm_Object_Item *item = elm_genlist_selected_item_get(db->fsel);
@@ -593,7 +593,7 @@ _fsel_menu_rename_cb(void *data, Evas_Object *obj EINA_UNUSED,
593 593
594static void 594static void
595_fsel_menu_delete_cb(void *data, Evas_Object *obj EINA_UNUSED, 595_fsel_menu_delete_cb(void *data, Evas_Object *obj EINA_UNUSED,
596 void *event_info EINA_UNUSED) 596 void *event_info EINA_UNUSED)
597{ 597{
598 Ephoto_Directory_Browser *db = data; 598 Ephoto_Directory_Browser *db = data;
599 Elm_Object_Item *item = elm_genlist_selected_item_get(db->fsel); 599 Elm_Object_Item *item = elm_genlist_selected_item_get(db->fsel);
@@ -613,7 +613,7 @@ _fsel_menu_delete_cb(void *data, Evas_Object *obj EINA_UNUSED,
613 613
614static void 614static void
615_fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED, 615_fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
616 Evas_Object *obj EINA_UNUSED, void *event_info) 616 Evas_Object *obj EINA_UNUSED, void *event_info)
617{ 617{
618 Ephoto_Directory_Browser *db = data; 618 Ephoto_Directory_Browser *db = data;
619 Evas_Object *menu; 619 Evas_Object *menu;
@@ -635,7 +635,7 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
635 ecore_timer_del(db->click_timer); 635 ecore_timer_del(db->click_timer);
636 db->click_timer = NULL; 636 db->click_timer = NULL;
637 elm_genlist_item_expanded_set(item, 637 elm_genlist_item_expanded_set(item,
638 !elm_genlist_item_expanded_get(item)); 638 !elm_genlist_item_expanded_get(item));
639 } 639 }
640 } 640 }
641 } 641 }
@@ -650,8 +650,7 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
650 } 650 }
651 } 651 }
652 if (info->button != 3) 652 if (info->button != 3)
653 return; 653 return;
654
655 654
656 if (item) 655 if (item)
657 elm_genlist_item_selected_set(item, EINA_TRUE); 656 elm_genlist_item_selected_set(item, EINA_TRUE);
@@ -659,36 +658,36 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
659 menu = elm_menu_add(db->ephoto->win); 658 menu = elm_menu_add(db->ephoto->win);
660 elm_menu_move(menu, x, y); 659 elm_menu_move(menu, x, y);
661 elm_menu_item_add(menu, NULL, "computer", _("Root"), 660 elm_menu_item_add(menu, NULL, "computer", _("Root"),
662 _fsel_menu_go_root, db->ephoto); 661 _fsel_menu_go_root, db->ephoto);
663 elm_menu_item_add(menu, NULL, "user-home", _("Home"), 662 elm_menu_item_add(menu, NULL, "user-home", _("Home"),
664 _fsel_menu_go_home, db->ephoto); 663 _fsel_menu_go_home, db->ephoto);
665 if (strcmp(db->ephoto->config->directory, db->ephoto->trash_path)) 664 if (strcmp(db->ephoto->config->directory, db->ephoto->trash_path))
666 { 665 {
667 elm_menu_item_add(menu, NULL, "folder-new", _("New Folder"), 666 elm_menu_item_add(menu, NULL, "folder-new", _("New Folder"),
668 _fsel_menu_new_dir_cb, db); 667 _fsel_menu_new_dir_cb, db);
669 } 668 }
670 if (item) 669 if (item)
671 { 670 {
672 elm_menu_item_add(menu, NULL, "edit", _("Rename"), 671 elm_menu_item_add(menu, NULL, "edit", _("Rename"),
673 _fsel_menu_rename_cb, db); 672 _fsel_menu_rename_cb, db);
674 elm_menu_item_add(menu, NULL, "edit-paste", _("Paste"), 673 elm_menu_item_add(menu, NULL, "edit-paste", _("Paste"),
675 _fsel_menu_paste_cb, db); 674 _fsel_menu_paste_cb, db);
676 } 675 }
677 else if (!strcmp(db->ephoto->config->directory, db->ephoto->trash_path) && 676 else if (!strcmp(db->ephoto->config->directory, db->ephoto->trash_path) &&
678 elm_genlist_first_item_get(db->fsel)) 677 elm_genlist_first_item_get(db->fsel))
679 { 678 {
680 elm_menu_item_add(menu, NULL, "edit-delete", _("Empty Trash"), 679 elm_menu_item_add(menu, NULL, "edit-delete", _("Empty Trash"),
681 _menu_empty_cb, db); 680 _menu_empty_cb, db);
682 } 681 }
683 if (strcmp(db->ephoto->config->directory, db->ephoto->trash_path) && item) 682 if (strcmp(db->ephoto->config->directory, db->ephoto->trash_path) && item)
684 { 683 {
685 elm_menu_item_add(menu, NULL, "edit-delete", _("Delete"), 684 elm_menu_item_add(menu, NULL, "edit-delete", _("Delete"),
686 _fsel_menu_delete_cb, db); 685 _fsel_menu_delete_cb, db);
687 elm_menu_item_add(menu, NULL, "user-trash", _("Trash"), 686 elm_menu_item_add(menu, NULL, "user-trash", _("Trash"),
688 _dir_go_trash, db); 687 _dir_go_trash, db);
689 } 688 }
690 evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb, 689 evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb,
691 db); 690 db);
692 evas_object_show(menu); 691 evas_object_show(menu);
693} 692}
694 693
@@ -708,23 +707,23 @@ _ephoto_directory_view_add(Ephoto_Directory_Browser *db)
708 elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE); 707 elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE);
709 EPHOTO_EXPAND(db->fsel); 708 EPHOTO_EXPAND(db->fsel);
710 EPHOTO_FILL(db->fsel); 709 EPHOTO_FILL(db->fsel);
711 evas_object_size_hint_min_set(db->fsel, 195*elm_config_scale_get(), 0); 710 evas_object_size_hint_min_set(db->fsel, 195 * elm_config_scale_get(), 0);
712 evas_object_smart_callback_add(db->fsel, "expand,request", 711 evas_object_smart_callback_add(db->fsel, "expand,request",
713 _on_list_expand_req, db); 712 _on_list_expand_req, db);
714 evas_object_smart_callback_add(db->fsel, "contract,request", 713 evas_object_smart_callback_add(db->fsel, "contract,request",
715 _on_list_contract_req, db); 714 _on_list_contract_req, db);
716 evas_object_smart_callback_add(db->fsel, "expanded", _on_list_expanded, db); 715 evas_object_smart_callback_add(db->fsel, "expanded", _on_list_expanded, db);
717 evas_object_smart_callback_add(db->fsel, "contracted", _on_list_contracted, 716 evas_object_smart_callback_add(db->fsel, "contracted", _on_list_contracted,
718 db); 717 db);
719 evas_object_event_callback_add(db->fsel, EVAS_CALLBACK_MOUSE_UP, 718 evas_object_event_callback_add(db->fsel, EVAS_CALLBACK_MOUSE_UP,
720 _fsel_mouse_up_cb, db); 719 _fsel_mouse_up_cb, db);
721 evas_object_data_set(db->fsel, "directory_browser", db); 720 evas_object_data_set(db->fsel, "directory_browser", db);
722 elm_box_pack_end(db->leftbox, db->fsel); 721 elm_box_pack_end(db->leftbox, db->fsel);
723 evas_object_show(db->fsel); 722 evas_object_show(db->fsel);
724 723
725 elm_drop_item_container_add(db->fsel, ELM_SEL_FORMAT_TARGETS, 724 elm_drop_item_container_add(db->fsel, ELM_SEL_FORMAT_TARGETS,
726 _drop_item_getcb, _drop_enter, db, _drop_leave, db, _drop_pos, db, 725 _drop_item_getcb, _drop_enter, db, _drop_leave, db, _drop_pos, db,
727 _drop_dropcb, NULL); 726 _drop_dropcb, NULL);
728} 727}
729 728
730/*Ephoto Populating Functions*/ 729/*Ephoto Populating Functions*/
@@ -743,36 +742,36 @@ _monitor_add(Ephoto_Entry *e)
743 742
744 e->monitor = eio_monitor_add(rp); 743 e->monitor = eio_monitor_add(rp);
745 e->monitor_handlers = 744 e->monitor_handlers =
746 eina_list_append(e->monitor_handlers, 745 eina_list_append(e->monitor_handlers,
747 ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, 746 ecore_event_handler_add(EIO_MONITOR_FILE_CREATED,
748 _monitor_cb, e)); 747 _monitor_cb, e));
749 e->monitor_handlers = 748 e->monitor_handlers =
750 eina_list_append(e->monitor_handlers, 749 eina_list_append(e->monitor_handlers,
751 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, 750 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED,
752 _monitor_cb, e)); 751 _monitor_cb, e));
753 e->monitor_handlers = 752 e->monitor_handlers =
754 eina_list_append(e->monitor_handlers, 753 eina_list_append(e->monitor_handlers,
755 ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, 754 ecore_event_handler_add(EIO_MONITOR_FILE_DELETED,
756 _monitor_cb, e)); 755 _monitor_cb, e));
757 e->monitor_handlers = 756 e->monitor_handlers =
758 eina_list_append(e->monitor_handlers, 757 eina_list_append(e->monitor_handlers,
759 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED, 758 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED,
760 _monitor_cb, e)); 759 _monitor_cb, e));
761 e->monitor_handlers = 760 e->monitor_handlers =
762 eina_list_append(e->monitor_handlers, 761 eina_list_append(e->monitor_handlers,
763 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED, 762 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
764 _monitor_cb, e)); 763 _monitor_cb, e));
765 e->monitor_handlers = 764 e->monitor_handlers =
766 eina_list_append(e->monitor_handlers, 765 eina_list_append(e->monitor_handlers,
767 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, 766 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
768 _monitor_cb, e)); 767 _monitor_cb, e));
769 768
770 free(rp); 769 free(rp);
771} 770}
772 771
773static Eina_Bool 772static Eina_Bool
774_monitor_cb(void *data, int type, 773_monitor_cb(void *data, int type,
775 void *event) 774 void *event)
776{ 775{
777 Elm_Object_Item *item; 776 Elm_Object_Item *item;
778 Ephoto_Entry *entry = data; 777 Ephoto_Entry *entry = data;
@@ -813,17 +812,17 @@ _monitor_cb(void *data, int type,
813 ic = _ephoto_dir_class; 812 ic = _ephoto_dir_class;
814 snprintf(buf, PATH_MAX, "%s", ev->filename); 813 snprintf(buf, PATH_MAX, "%s", ev->filename);
815 e = ephoto_entry_new(entry->ephoto, ev->filename, basename(buf), 814 e = ephoto_entry_new(entry->ephoto, ev->filename, basename(buf),
816 EINA_FILE_DIR); 815 EINA_FILE_DIR);
817 e->genlist = entry->genlist; 816 e->genlist = entry->genlist;
818 e->parent = entry->item; 817 e->parent = entry->item;
819 if (!_check_for_subdirs(e)) 818 if (!_check_for_subdirs(e))
820 e->item = 819 e->item =
821 elm_genlist_item_sorted_insert(entry->genlist, ic, e, 820 elm_genlist_item_sorted_insert(entry->genlist, ic, e,
822 e->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL); 821 e->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL);
823 else 822 else
824 e->item = 823 e->item =
825 elm_genlist_item_sorted_insert(entry->genlist, ic, e, 824 elm_genlist_item_sorted_insert(entry->genlist, ic, e,
826 e->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL); 825 e->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL);
827 if (e->item) 826 if (e->item)
828 _monitor_add(e); 827 _monitor_add(e);
829 } 828 }
@@ -833,8 +832,8 @@ _monitor_cb(void *data, int type,
833 832
834 ic = _ephoto_dir_tree_class; 833 ic = _ephoto_dir_tree_class;
835 parent = 834 parent =
836 elm_genlist_item_insert_before(entry->genlist, ic, entry, 835 elm_genlist_item_insert_before(entry->genlist, ic, entry,
837 entry->parent, entry->item, ELM_GENLIST_ITEM_TREE, NULL, NULL); 836 entry->parent, entry->item, ELM_GENLIST_ITEM_TREE, NULL, NULL);
838 entry->no_delete = EINA_TRUE; 837 entry->no_delete = EINA_TRUE;
839 elm_object_item_del(entry->item); 838 elm_object_item_del(entry->item);
840 entry->item = parent; 839 entry->item = parent;
@@ -865,8 +864,8 @@ _monitor_cb(void *data, int type,
865 Elm_Object_Item *parent; 864 Elm_Object_Item *parent;
866 ic = _ephoto_dir_class; 865 ic = _ephoto_dir_class;
867 parent = 866 parent =
868 elm_genlist_item_insert_before(entry->genlist, ic, entry, 867 elm_genlist_item_insert_before(entry->genlist, ic, entry,
869 entry->parent, entry->item, ELM_GENLIST_ITEM_NONE, NULL, NULL); 868 entry->parent, entry->item, ELM_GENLIST_ITEM_NONE, NULL, NULL);
870 869
871 entry->no_delete = EINA_TRUE; 870 entry->no_delete = EINA_TRUE;
872 elm_object_item_del(entry->item); 871 elm_object_item_del(entry->item);
@@ -917,7 +916,7 @@ _monitor_cb(void *data, int type,
917 916
918static Eina_Bool 917static Eina_Bool
919_top_monitor_cb(void *data, int type, 918_top_monitor_cb(void *data, int type,
920 void *event) 919 void *event)
921{ 920{
922 Elm_Object_Item *item; 921 Elm_Object_Item *item;
923 Ephoto_Directory_Browser *db = data; 922 Ephoto_Directory_Browser *db = data;
@@ -951,12 +950,12 @@ _top_monitor_cb(void *data, int type,
951 } 950 }
952 snprintf(buf, PATH_MAX, "%s", ev->filename); 951 snprintf(buf, PATH_MAX, "%s", ev->filename);
953 e = ephoto_entry_new(db->ephoto, ev->filename, basename(buf), 952 e = ephoto_entry_new(db->ephoto, ev->filename, basename(buf),
954 EINA_FILE_DIR); 953 EINA_FILE_DIR);
955 e->genlist = db->fsel; 954 e->genlist = db->fsel;
956 ic = _ephoto_dir_class; 955 ic = _ephoto_dir_class;
957 e->item = 956 e->item =
958 elm_genlist_item_append(db->fsel, ic, e, 957 elm_genlist_item_append(db->fsel, ic, e,
959 NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); 958 NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
960 if (e->item) 959 if (e->item)
961 _monitor_add(e); 960 _monitor_add(e);
962 free(rp); 961 free(rp);
@@ -1018,53 +1017,53 @@ _todo_items_process(void *data)
1018 return EINA_TRUE; 1017 return EINA_TRUE;
1019 db->animator.todo_items = NULL; 1018 db->animator.todo_items = NULL;
1020 db->processing = 0; 1019 db->processing = 0;
1021 return EINA_FALSE; 1020 return EINA_FALSE;
1022 } 1021 }
1023 if ((db->ls) && (eina_list_count(db->todo_items) < TODO_ITEM_MIN_BATCH)) 1022 if ((db->ls) && (eina_list_count(db->todo_items) < TODO_ITEM_MIN_BATCH))
1024 return EINA_TRUE; 1023 return EINA_TRUE;
1025 1024
1026 db->animator.todo_items = NULL; 1025 db->animator.todo_items = NULL;
1027 db->processing = 1; 1026 db->processing = 1;
1028 EINA_LIST_FREE(db->todo_items, entry) 1027 EINA_LIST_FREE(db->todo_items, entry)
1029 { 1028 {
1030 i++; 1029 i++;
1031 if (i > TODO_ITEM_MIN_BATCH) 1030 if (i > TODO_ITEM_MIN_BATCH)
1032 return EINA_TRUE; 1031 return EINA_TRUE;
1033 if (entry->is_dir && !entry->item) 1032 if (entry->is_dir && !entry->item)
1034 { 1033 {
1035 const Elm_Genlist_Item_Class *ic; 1034 const Elm_Genlist_Item_Class *ic;
1036 if (_check_for_subdirs(entry)) 1035 if (_check_for_subdirs(entry))
1037 { 1036 {
1038 ic = _ephoto_dir_tree_class; 1037 ic = _ephoto_dir_tree_class;
1039 entry->item = 1038 entry->item =
1040 elm_genlist_item_sorted_insert(db->fsel, ic, entry, 1039 elm_genlist_item_sorted_insert(db->fsel, ic, entry,
1041 entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL); 1040 entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL);
1042 } 1041 }
1043 else 1042 else
1044 { 1043 {
1045 ic = _ephoto_dir_class; 1044 ic = _ephoto_dir_class;
1046 entry->item = 1045 entry->item =
1047 elm_genlist_item_sorted_insert(db->fsel, ic, entry, 1046 elm_genlist_item_sorted_insert(db->fsel, ic, entry,
1048 entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL); 1047 entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL);
1049 } 1048 }
1050 if (!entry->item) 1049 if (!entry->item)
1051 { 1050 {
1052 ephoto_entry_free(db->ephoto, entry); 1051 ephoto_entry_free(db->ephoto, entry);
1053 } 1052 }
1054 else 1053 else
1055 { 1054 {
1056 _monitor_add(entry); 1055 _monitor_add(entry);
1057 entry->genlist = db->fsel; 1056 entry->genlist = db->fsel;
1058 } 1057 }
1059 } 1058 }
1060 db->animator.processed++; 1059 db->animator.processed++;
1061 } 1060 }
1062 return EINA_TRUE; 1061 return EINA_TRUE;
1063} 1062}
1064 1063
1065static Eina_Bool 1064static Eina_Bool
1066_ephoto_dir_populate_start(void *data, int type EINA_UNUSED, 1065_ephoto_dir_populate_start(void *data, int type EINA_UNUSED,
1067 void *event EINA_UNUSED) 1066 void *event EINA_UNUSED)
1068{ 1067{
1069 Ephoto_Directory_Browser *db = data; 1068 Ephoto_Directory_Browser *db = data;
1070 1069
@@ -1078,15 +1077,15 @@ _ephoto_dir_populate_start(void *data, int type EINA_UNUSED,
1078 1077
1079static Eina_Bool 1078static Eina_Bool
1080_ephoto_dir_populate_end(void *data, int type EINA_UNUSED, 1079_ephoto_dir_populate_end(void *data, int type EINA_UNUSED,
1081 void *event EINA_UNUSED) 1080 void *event EINA_UNUSED)
1082{ 1081{
1083 Ephoto_Directory_Browser *db = data; 1082 Ephoto_Directory_Browser *db = data;
1084 1083
1085 db->ls = NULL; 1084 db->ls = NULL;
1086 if (db->main_deleted) 1085 if (db->main_deleted)
1087 { 1086 {
1088 free(db); 1087 free(db);
1089 return ECORE_CALLBACK_PASS_ON; 1088 return ECORE_CALLBACK_PASS_ON;
1090 } 1089 }
1091 db->dirs_only = 0; 1090 db->dirs_only = 0;
1092 ephoto_thumb_browser_dirs_only_set(db->ephoto, EINA_FALSE); 1091 ephoto_thumb_browser_dirs_only_set(db->ephoto, EINA_FALSE);
@@ -1097,7 +1096,7 @@ _ephoto_dir_populate_end(void *data, int type EINA_UNUSED,
1097 1096
1098static Eina_Bool 1097static Eina_Bool
1099_ephoto_dir_populate_error(void *data, int type EINA_UNUSED, 1098_ephoto_dir_populate_error(void *data, int type EINA_UNUSED,
1100 void *event EINA_UNUSED) 1099 void *event EINA_UNUSED)
1101{ 1100{
1102 Ephoto_Directory_Browser *db = data; 1101 Ephoto_Directory_Browser *db = data;
1103 1102
@@ -1120,8 +1119,8 @@ _ephoto_dir_entry_create(void *data, int type EINA_UNUSED, void *event)
1120 rp = ecore_file_realpath(e->path); 1119 rp = ecore_file_realpath(e->path);
1121 if (e->is_dir) 1120 if (e->is_dir)
1122 { 1121 {
1123 db->todo_items = eina_list_append(db->todo_items, e); 1122 db->todo_items = eina_list_append(db->todo_items, e);
1124 db->animator.count++; 1123 db->animator.count++;
1125 } 1124 }
1126 else if (ecore_file_is_dir((const char *)rp)) 1125 else if (ecore_file_is_dir((const char *)rp))
1127 { 1126 {
@@ -1129,7 +1128,7 @@ _ephoto_dir_entry_create(void *data, int type EINA_UNUSED, void *event)
1129 db->animator.count++; 1128 db->animator.count++;
1130 } 1129 }
1131 if (!db->animator.todo_items) 1130 if (!db->animator.todo_items)
1132 db->animator.todo_items = ecore_animator_add(_todo_items_process, db); 1131 db->animator.todo_items = ecore_animator_add(_todo_items_process, db);
1133 1132
1134 free(rp); 1133 free(rp);
1135 return ECORE_CALLBACK_PASS_ON; 1134 return ECORE_CALLBACK_PASS_ON;
@@ -1138,24 +1137,25 @@ _ephoto_dir_entry_create(void *data, int type EINA_UNUSED, void *event)
1138/*Ephoto Directory Browser Main Callbacks*/ 1137/*Ephoto Directory Browser Main Callbacks*/
1139static void 1138static void
1140_ephoto_main_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 1139_ephoto_main_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1141 void *event_info EINA_UNUSED) 1140 void *event_info EINA_UNUSED)
1142{ 1141{
1143 Ephoto_Directory_Browser *db = data; 1142 Ephoto_Directory_Browser *db = data;
1144 Ecore_Event_Handler *handler; 1143 Ecore_Event_Handler *handler;
1145 1144
1146 _todo_items_free(db); 1145 _todo_items_free(db);
1147 elm_drop_item_container_del(db->fsel); 1146 elm_drop_item_container_del(db->fsel);
1148 EINA_LIST_FREE(db->handlers, handler) ecore_event_handler_del(handler); 1147 EINA_LIST_FREE(db->handlers, handler)
1148 ecore_event_handler_del(handler);
1149 if (db->animator.todo_items) 1149 if (db->animator.todo_items)
1150 { 1150 {
1151 ecore_animator_del(db->animator.todo_items); 1151 ecore_animator_del(db->animator.todo_items);
1152 db->animator.todo_items = NULL; 1152 db->animator.todo_items = NULL;
1153 } 1153 }
1154 if (db->ls) 1154 if (db->ls)
1155 { 1155 {
1156 db->main_deleted = EINA_TRUE; 1156 db->main_deleted = EINA_TRUE;
1157 eio_file_cancel(db->ls); 1157 eio_file_cancel(db->ls);
1158 return; 1158 return;
1159 } 1159 }
1160 if (db->monitor) 1160 if (db->monitor)
1161 { 1161 {
@@ -1170,7 +1170,7 @@ void
1170ephoto_directory_browser_clear(Ephoto *ephoto) 1170ephoto_directory_browser_clear(Ephoto *ephoto)
1171{ 1171{
1172 Ephoto_Directory_Browser *db = 1172 Ephoto_Directory_Browser *db =
1173 evas_object_data_get(ephoto->dir_browser, "directory_browser"); 1173 evas_object_data_get(ephoto->dir_browser, "directory_browser");
1174 1174
1175 elm_genlist_clear(db->fsel); 1175 elm_genlist_clear(db->fsel);
1176} 1176}
@@ -1179,7 +1179,7 @@ void
1179ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir) 1179ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir)
1180{ 1180{
1181 Ephoto_Directory_Browser *db = 1181 Ephoto_Directory_Browser *db =
1182 evas_object_data_get(ephoto->dir_browser, "directory_browser"); 1182 evas_object_data_get(ephoto->dir_browser, "directory_browser");
1183 Ecore_Event_Handler *handler; 1183 Ecore_Event_Handler *handler;
1184 char *rp = ecore_file_realpath(dir); 1184 char *rp = ecore_file_realpath(dir);
1185 1185
@@ -1195,29 +1195,29 @@ ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir)
1195 ephoto->top_directory = eina_stringshare_add(dir); 1195 ephoto->top_directory = eina_stringshare_add(dir);
1196 db->monitor = eio_monitor_add(rp); 1196 db->monitor = eio_monitor_add(rp);
1197 db->monitor_handlers = 1197 db->monitor_handlers =
1198 eina_list_append(db->monitor_handlers, 1198 eina_list_append(db->monitor_handlers,
1199 ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, 1199 ecore_event_handler_add(EIO_MONITOR_FILE_CREATED,
1200 _top_monitor_cb, db)); 1200 _top_monitor_cb, db));
1201 db->monitor_handlers = 1201 db->monitor_handlers =
1202 eina_list_append(db->monitor_handlers, 1202 eina_list_append(db->monitor_handlers,
1203 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, 1203 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED,
1204 _top_monitor_cb, db)); 1204 _top_monitor_cb, db));
1205 db->monitor_handlers = 1205 db->monitor_handlers =
1206 eina_list_append(db->monitor_handlers, 1206 eina_list_append(db->monitor_handlers,
1207 ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, 1207 ecore_event_handler_add(EIO_MONITOR_FILE_DELETED,
1208 _top_monitor_cb, db)); 1208 _top_monitor_cb, db));
1209 db->monitor_handlers = 1209 db->monitor_handlers =
1210 eina_list_append(db->monitor_handlers, 1210 eina_list_append(db->monitor_handlers,
1211 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED, 1211 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED,
1212 _top_monitor_cb, db)); 1212 _top_monitor_cb, db));
1213 db->monitor_handlers = 1213 db->monitor_handlers =
1214 eina_list_append(db->monitor_handlers, 1214 eina_list_append(db->monitor_handlers,
1215 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED, 1215 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
1216 _top_monitor_cb, db)); 1216 _top_monitor_cb, db));
1217 db->monitor_handlers = 1217 db->monitor_handlers =
1218 eina_list_append(db->monitor_handlers, 1218 eina_list_append(db->monitor_handlers,
1219 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, 1219 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
1220 _top_monitor_cb, db)); 1220 _top_monitor_cb, db));
1221 free(rp); 1221 free(rp);
1222} 1222}
1223 1223
@@ -1225,7 +1225,7 @@ void
1225ephoto_directory_browser_initialize_structure(Ephoto *ephoto) 1225ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
1226{ 1226{
1227 Ephoto_Directory_Browser *db = 1227 Ephoto_Directory_Browser *db =
1228 evas_object_data_get(ephoto->dir_browser, "directory_browser"); 1228 evas_object_data_get(ephoto->dir_browser, "directory_browser");
1229 Eina_List *dirs = NULL, *l; 1229 Eina_List *dirs = NULL, *l;
1230 Elm_Object_Item *next = NULL, *cur = NULL; 1230 Elm_Object_Item *next = NULL, *cur = NULL;
1231 char path[PATH_MAX], *dir, *end_dir; 1231 char path[PATH_MAX], *dir, *end_dir;
@@ -1246,7 +1246,7 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
1246 dir = ecore_file_dir_get(path); 1246 dir = ecore_file_dir_get(path);
1247 dirs = eina_list_prepend(dirs, strdup(dir)); 1247 dirs = eina_list_prepend(dirs, strdup(dir));
1248 memset(path, 0x00, sizeof(path)); 1248 memset(path, 0x00, sizeof(path));
1249 snprintf(path, PATH_MAX, "%s", dir); 1249 snprintf(path, PATH_MAX, "%s", dir);
1250 } 1250 }
1251 free(dir); 1251 free(dir);
1252 dir = NULL; 1252 dir = NULL;
@@ -1276,7 +1276,7 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
1276 if (strncmp(finfo->path + finfo->name_start, ".", 1)) 1276 if (strncmp(finfo->path + finfo->name_start, ".", 1))
1277 { 1277 {
1278 Ephoto_Entry *entry = ephoto_entry_new(ephoto, finfo->path, 1278 Ephoto_Entry *entry = ephoto_entry_new(ephoto, finfo->path,
1279 finfo->path+finfo->name_start, finfo->type); 1279 finfo->path + finfo->name_start, finfo->type);
1280 entry->parent = cur; 1280 entry->parent = cur;
1281 if (entry->is_dir && !entry->item) 1281 if (entry->is_dir && !entry->item)
1282 { 1282 {
@@ -1285,17 +1285,17 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
1285 { 1285 {
1286 ic = _ephoto_dir_tree_class; 1286 ic = _ephoto_dir_tree_class;
1287 entry->item = 1287 entry->item =
1288 elm_genlist_item_sorted_insert(db->fsel, ic, entry, 1288 elm_genlist_item_sorted_insert(db->fsel, ic, entry,
1289 entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, 1289 entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp,
1290 NULL, NULL); 1290 NULL, NULL);
1291 } 1291 }
1292 else 1292 else
1293 { 1293 {
1294 ic = _ephoto_dir_class; 1294 ic = _ephoto_dir_class;
1295 entry->item = 1295 entry->item =
1296 elm_genlist_item_sorted_insert(db->fsel, ic, entry, 1296 elm_genlist_item_sorted_insert(db->fsel, ic, entry,
1297 entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, 1297 entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp,
1298 NULL, NULL); 1298 NULL, NULL);
1299 } 1299 }
1300 if (!entry->item) 1300 if (!entry->item)
1301 { 1301 {
@@ -1370,36 +1370,37 @@ ephoto_directory_browser_add(Ephoto *ephoto, Evas_Object *parent)
1370 db->main = box; 1370 db->main = box;
1371 1371
1372 elm_box_horizontal_set(db->main, EINA_FALSE); 1372 elm_box_horizontal_set(db->main, EINA_FALSE);
1373 evas_object_size_hint_min_set(db->main, 195*elm_config_scale_get(), 0); 1373 evas_object_size_hint_min_set(db->main, 195 * elm_config_scale_get(), 0);
1374 evas_object_event_callback_add(db->main, EVAS_CALLBACK_DEL, 1374 evas_object_event_callback_add(db->main, EVAS_CALLBACK_DEL,
1375 _ephoto_main_del, db); 1375 _ephoto_main_del, db);
1376 evas_object_data_set(db->main, "directory_browser", db); 1376 evas_object_data_set(db->main, "directory_browser", db);
1377 1377
1378 _ephoto_directory_view_add(db); 1378 _ephoto_directory_view_add(db);
1379 1379
1380 db->handlers = 1380 db->handlers =
1381 eina_list_append(db->handlers, 1381 eina_list_append(db->handlers,
1382 ecore_event_handler_add(EPHOTO_EVENT_POPULATE_START, 1382 ecore_event_handler_add(EPHOTO_EVENT_POPULATE_START,
1383 _ephoto_dir_populate_start, db)); 1383 _ephoto_dir_populate_start, db));
1384 1384
1385 db->handlers = 1385 db->handlers =
1386 eina_list_append(db->handlers, 1386 eina_list_append(db->handlers,
1387 ecore_event_handler_add(EPHOTO_EVENT_POPULATE_END, 1387 ecore_event_handler_add(EPHOTO_EVENT_POPULATE_END,
1388 _ephoto_dir_populate_end, db)); 1388 _ephoto_dir_populate_end, db));
1389 1389
1390 db->handlers = 1390 db->handlers =
1391 eina_list_append(db->handlers, 1391 eina_list_append(db->handlers,
1392 ecore_event_handler_add(EPHOTO_EVENT_POPULATE_ERROR, 1392 ecore_event_handler_add(EPHOTO_EVENT_POPULATE_ERROR,
1393 _ephoto_dir_populate_error, db)); 1393 _ephoto_dir_populate_error, db));
1394 1394
1395 db->handlers = 1395 db->handlers =
1396 eina_list_append(db->handlers, 1396 eina_list_append(db->handlers,
1397 ecore_event_handler_add(EPHOTO_EVENT_ENTRY_CREATE, 1397 ecore_event_handler_add(EPHOTO_EVENT_ENTRY_CREATE,
1398 _ephoto_dir_entry_create, db)); 1398 _ephoto_dir_entry_create, db));
1399 1399
1400 return db->main; 1400 return db->main;
1401 1401
1402 error: 1402error:
1403 evas_object_del(db->main); 1403 evas_object_del(db->main);
1404 return NULL; 1404 return NULL;
1405} 1405}
1406
diff --git a/src/bin/ephoto_editor.c b/src/bin/ephoto_editor.c
index 358fd3c..21a1f05 100644
--- a/src/bin/ephoto_editor.c
+++ b/src/bin/ephoto_editor.c
@@ -2,28 +2,28 @@
2 2
3static void 3static void
4_editor_reset(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 4_editor_reset(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
5 void *event_info EINA_UNUSED) 5 void *event_info EINA_UNUSED)
6{ 6{
7 ecore_event_add(EPHOTO_EVENT_EDITOR_RESET, NULL, NULL, NULL); 7 ecore_event_add(EPHOTO_EVENT_EDITOR_RESET, NULL, NULL, NULL);
8} 8}
9 9
10static void 10static void
11_editor_apply(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 11_editor_apply(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
12 void *event_info EINA_UNUSED) 12 void *event_info EINA_UNUSED)
13{ 13{
14 ecore_event_add(EPHOTO_EVENT_EDITOR_APPLY, NULL, NULL, NULL); 14 ecore_event_add(EPHOTO_EVENT_EDITOR_APPLY, NULL, NULL, NULL);
15}