Ephoto: Ecrustify Formatting

This commit is contained in:
Stephen 'Okra' Houston 2017-08-30 09:01:07 -05:00
parent ab43168f90
commit a705f9a626
20 changed files with 3270 additions and 3180 deletions

View File

@ -30,50 +30,50 @@ elm_main(int argc, char **argv)
if (argc > 2) if (argc > 2)
{ {
printf("Too Many Arguments!\n"); printf("Too Many Arguments!\n");
_ephoto_display_usage(); _ephoto_display_usage();
r = 1; r = 1;
goto end; goto end;
} }
else if (argc < 2) else if (argc < 2)
{ {
Evas_Object *win = ephoto_window_add(NULL); Evas_Object *win = ephoto_window_add(NULL);
if (!win) if (!win)
{ {
r = 1; r = 1;
goto end; goto end;
} }
} }
else if (!strncmp(argv[1], "--help", 6)) else if (!strncmp(argv[1], "--help", 6))
{ {
_ephoto_display_usage(); _ephoto_display_usage();
r = 0; r = 0;
goto end; goto end;
} }
else else
{ {
char *real = ecore_file_realpath(argv[1]); char *real = ecore_file_realpath(argv[1]);
if (!real) if (!real)
{ {
printf("invalid file or directory: '%s'\n", argv[1]); printf("invalid file or directory: '%s'\n", argv[1]);
r = 1; r = 1;
goto end; goto end;
} }
Evas_Object *win = ephoto_window_add(real); Evas_Object *win = ephoto_window_add(real);
free(real); free(real);
if (!win) if (!win)
{ {
r = 1; r = 1;
goto end; goto end;
} }
} }
elm_run(); elm_run();
end: end:
e_thumb_shutdown(); e_thumb_shutdown();
efreet_mime_shutdown(); efreet_mime_shutdown();
eio_shutdown(); eio_shutdown();
@ -86,8 +86,8 @@ static void
_ephoto_display_usage(void) _ephoto_display_usage(void)
{ {
printf("Ephoto Usage: \n" "ephoto --help : This page\n" printf("Ephoto Usage: \n" "ephoto --help : This page\n"
"ephoto filename : Specifies a file to open\n" "ephoto filename : Specifies a file to open\n"
"ephoto dirname : Specifies a directory to open\n"); "ephoto dirname : Specifies a directory to open\n");
} }
ELM_MAIN() ELM_MAIN()

View File

@ -31,148 +31,148 @@
#if HAVE_GETTEXT && ENABLE_NLS #if HAVE_GETTEXT && ENABLE_NLS
# include <libintl.h> # include <libintl.h>
# define _(string) gettext (string) # define _(string) gettext(string)
#else #else
# define _(string) (string) # define _(string) (string)
# define ngettext(String1, String2, Var) Var == 1 ? String1 : String2 # define ngettext(String1, String2, Var) Var == 1 ? String1 : String2
#endif #endif
# define USE_IPC # define USE_IPC
/*local types*/ /*local types*/
typedef struct _Ephoto_Config Ephoto_Config; typedef struct _Ephoto_Config Ephoto_Config;
typedef struct _Ephoto Ephoto; typedef struct _Ephoto Ephoto;
typedef struct _Ephoto_Entry Ephoto_Entry; typedef struct _Ephoto_Entry Ephoto_Entry;
typedef struct _Ephoto_Event_Entry_Create Ephoto_Event_Entry_Create; typedef struct _Ephoto_Event_Entry_Create Ephoto_Event_Entry_Create;
typedef enum _Ephoto_State Ephoto_State; typedef enum _Ephoto_State Ephoto_State;
typedef enum _Ephoto_Orient Ephoto_Orient; typedef enum _Ephoto_Orient Ephoto_Orient;
typedef enum _Ephoto_Sort Ephoto_Sort; typedef enum _Ephoto_Sort Ephoto_Sort;
typedef enum _Ephoto_Ipc_Domain Ephoto_Ipc_Domain; typedef enum _Ephoto_Ipc_Domain Ephoto_Ipc_Domain;
/*main window functions*/ /*main window functions*/
Evas_Object *ephoto_window_add(const char *path); Evas_Object *ephoto_window_add(const char *path);
void ephoto_title_set(Ephoto *ephoto, const char *title); void ephoto_title_set(Ephoto *ephoto, const char *title);
void ephoto_thumb_size_set(Ephoto *ephoto, int size); void ephoto_thumb_size_set(Ephoto *ephoto, int size);
Evas_Object *ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, Evas_Object *ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent,
Ephoto_Entry *entry); Ephoto_Entry *entry);
void ephoto_directory_set(Ephoto *ephoto, const char *path, void ephoto_directory_set(Ephoto *ephoto, const char *path,
Elm_Object_Item *expanded, Eina_Bool dirs_only, Eina_Bool thumbs_only); Elm_Object_Item *expanded, Eina_Bool dirs_only, Eina_Bool thumbs_only);
void ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle); void ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle);
/*config panel functions*/ /*config panel functions*/
Eina_Bool ephoto_config_init(Ephoto *em); Eina_Bool ephoto_config_init(Ephoto *em);
void ephoto_config_save(Ephoto *em); void ephoto_config_save(Ephoto *em);
void ephoto_config_free(Ephoto *em); void ephoto_config_free(Ephoto *em);
void ephoto_config_main(Ephoto *em); void ephoto_config_main(Ephoto *em);
/*single image functions*/ /*single image functions*/
Evas_Object *ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent); Evas_Object *ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_single_browser_show_controls(Ephoto *ephoto); void ephoto_single_browser_show_controls(Ephoto *ephoto);
void ephoto_single_browser_entries_set(Evas_Object *obj, Eina_List *entries); void ephoto_single_browser_entries_set(Evas_Object *obj, Eina_List *entries);
void ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry); void ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
void ephoto_single_browser_focus_set(Ephoto *ephoto); void ephoto_single_browser_focus_set(Ephoto *ephoto);
void ephoto_single_browser_path_pending_set(Evas_Object *obj, void ephoto_single_browser_path_pending_set(Evas_Object *obj,
const char *path); const char *path);
void ephoto_single_browser_path_pending_unset(Evas_Object *obj); void ephoto_single_browser_path_pending_unset(Evas_Object *obj);
void ephoto_single_browser_path_created(Evas_Object *obj, Ephoto_Entry *entry); void ephoto_single_browser_path_created(Evas_Object *obj, Ephoto_Entry *entry);
void ephoto_single_browser_image_data_update(Evas_Object *main, void ephoto_single_browser_image_data_update(Evas_Object *main,
Evas_Object *image, unsigned int *image_data, Evas_Coord w, Evas_Coord h); Evas_Object *image, unsigned int *image_data, Evas_Coord w, Evas_Coord h);
void ephoto_single_browser_image_data_done(Evas_Object *main, void ephoto_single_browser_image_data_done(Evas_Object *main,
unsigned int *image_data, Evas_Coord w, Evas_Coord h); unsigned int *image_data, Evas_Coord w, Evas_Coord h);
void ephoto_single_browser_cancel_editing(Evas_Object *main); void ephoto_single_browser_cancel_editing(Evas_Object *main);
void ephoto_single_browser_slideshow(Evas_Object *obj); void ephoto_single_browser_slideshow(Evas_Object *obj);
/* smart callbacks called: "back" - the user wants to go back to the previous /* smart callbacks called: "back" - the user wants to go back to the previous
* screen. */ * screen. */
/*slideshow functions*/ /*slideshow functions*/
Evas_Object *ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent); Evas_Object *ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_slideshow_entries_set(Evas_Object *obj, Eina_List *entries); void ephoto_slideshow_entries_set(Evas_Object *obj, Eina_List *entries);
void ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry); void ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
void ephoto_slideshow_show_controls(Ephoto *ephoto); void ephoto_slideshow_show_controls(Ephoto *ephoto);
/* smart callbacks called: "back" - the user wants to go back to the previous /* smart callbacks called: "back" - the user wants to go back to the previous
* screen. */ * screen. */
/*thumbnail browser functions*/ /*thumbnail browser functions*/
Evas_Object *ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent); Evas_Object *ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_thumb_browser_show_controls(Ephoto *ephoto); void ephoto_thumb_browser_show_controls(Ephoto *ephoto);
void ephoto_thumb_browser_insert(Ephoto *ephoto, Ephoto_Entry *entry); void ephoto_thumb_browser_insert(Ephoto *ephoto, Ephoto_Entry *entry);
void ephoto_thumb_browser_remove(Ephoto *ephoto, Ephoto_Entry *entry); void ephoto_thumb_browser_remove(Ephoto *ephoto, Ephoto_Entry *entry);
void ephoto_thumb_browser_update(Ephoto *ephoto, Ephoto_Entry *entry); void ephoto_thumb_browser_update(Ephoto *ephoto, Ephoto_Entry *entry);
void ephoto_thumb_browser_update_info_label(Ephoto *ephoto); void ephoto_thumb_browser_update_info_label(Ephoto *ephoto);
void ephoto_thumb_browser_slideshow(Evas_Object *obj); void ephoto_thumb_browser_slideshow(Evas_Object *obj);
void ephoto_thumb_browser_paste(Ephoto *ephoto, Elm_Object_Item *item); void ephoto_thumb_browser_paste(Ephoto *ephoto, Elm_Object_Item *item);
void ephoto_thumb_browser_clear(Ephoto *ephoto); void ephoto_thumb_browser_clear(Ephoto *ephoto);
void ephoto_thumb_browser_recalc(Ephoto *ephoto); void ephoto_thumb_browser_recalc(Ephoto *ephoto);
void ephoto_thumb_browser_dirs_only_set(Ephoto *ephoto, Eina_Bool dirs_only); void ephoto_thumb_browser_dirs_only_set(Ephoto *ephoto, Eina_Bool dirs_only);
/* smart callbacks called: "selected" - an item in the thumb browser is /* smart callbacks called: "selected" - an item in the thumb browser is
* selected. The selected Ephoto_Entry is passed as event_info argument. */ * selected. The selected Ephoto_Entry is passed as event_info argument. */
/*directory browser functions*/ /*directory browser functions*/
Evas_Object *ephoto_directory_browser_add(Ephoto *ephoto, Evas_Object *parent); Evas_Object *ephoto_directory_browser_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_directory_browser_initialize_structure(Ephoto *ephoto); void ephoto_directory_browser_initialize_structure(Ephoto *ephoto);
void ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir); void ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir);
void ephoto_directory_browser_clear(Ephoto *ephoto); void ephoto_directory_browser_clear(Ephoto *ephoto);
/*thumbnailing functions taken from enlightenment*/ /*thumbnailing functions taken from enlightenment*/
int e_thumb_init(void); int e_thumb_init(void);
int e_thumb_shutdown(void); int e_thumb_shutdown(void);
Evas_Object *e_thumb_icon_add(Evas *evas, Eina_Bool aspect); Evas_Object *e_thumb_icon_add(Evas *evas, Eina_Bool aspect);
void e_thumb_icon_file_set(Evas_Object *obj, const char *file, const char *key); void e_thumb_icon_file_set(Evas_Object *obj, const char *file, const char *key);
void e_thumb_icon_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h); void e_thumb_icon_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
void e_thumb_icon_begin(Evas_Object *obj); void e_thumb_icon_begin(Evas_Object *obj);
void e_thumb_icon_end(Evas_Object *obj); void e_thumb_icon_end(Evas_Object *obj);
void e_thumb_icon_rethumb(Evas_Object *obj); void e_thumb_icon_rethumb(Evas_Object *obj);
const char *e_thumb_sort_id_get(Evas_Object *obj); const char *e_thumb_sort_id_get(Evas_Object *obj);
void e_thumb_client_data(Ecore_Ipc_Event_Client_Data *e); void e_thumb_client_data(Ecore_Ipc_Event_Client_Data *e);
void e_thumb_client_del(Ecore_Ipc_Event_Client_Del *e); void e_thumb_client_del(Ecore_Ipc_Event_Client_Del *e);
int e_ipc_init(void); int e_ipc_init(void);
int e_ipc_shutdown(void); int e_ipc_shutdown(void);
/*editing functions*/ /*editing functions*/
Evas_Object *ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const char *title, Evas_Object *ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const char *title,
const char *data_name, void *data); const char *data_name, void *data);
void ephoto_editor_del(Evas_Object *obj, Evas_Object *parent); void ephoto_editor_del(Evas_Object *obj, Evas_Object *parent);
void ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, void ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
Evas_Object *image_parent, Evas_Object *image); Evas_Object *image_parent, Evas_Object *image);
void ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, void ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
Evas_Object *image); Evas_Object *image);
void ephoto_hsv_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, void ephoto_hsv_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
Evas_Object *image); Evas_Object *image);
void ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, void ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
Evas_Object *image); Evas_Object *image);
void ephoto_red_eye_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, void ephoto_red_eye_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
Evas_Object *image); Evas_Object *image);
void ephoto_scale_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, void ephoto_scale_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
Evas_Object *image, const char *file); Evas_Object *image, const char *file);
void ephoto_filter_blur(Ephoto *ephoto, Evas_Object *image); void ephoto_filter_blur(Ephoto *ephoto, Evas_Object *image);
void ephoto_filter_sharpen(Ephoto *ephoto, Evas_Object *image); void ephoto_filter_sharpen(Ephoto *ephoto, Evas_Object *image);
void ephoto_filter_dither(Ephoto *ephoto, Evas_Object *image); void ephoto_filter_dither(Ephoto *ephoto, Evas_Object *image);
void ephoto_filter_black_and_white(Ephoto *ephoto, Evas_Object *image); void ephoto_filter_black_and_white(Ephoto *ephoto, Evas_Object *image);
void ephoto_filter_old_photo(Ephoto *ephoto, Evas_Object *image); void ephoto_filter_old_photo(Ephoto *ephoto, Evas_Object *image);
void ephoto_filter_painting(Ephoto *ephoto, Evas_Object *image); void ephoto_filter_painting(Ephoto *ephoto, Evas_Object *image);
void ephoto_filter_posterize(Ephoto *ephoto, Evas_Object *image); void ephoto_filter_posterize(Ephoto *ephoto, Evas_Object *image);
void ephoto_filter_sketch(Ephoto *ephoto, Evas_Object *image); void ephoto_filter_sketch(Ephoto *ephoto, Evas_Object *image);
void ephoto_filter_invert(Ephoto *ephoto, Evas_Object *image); void ephoto_filter_invert(Ephoto *ephoto, Evas_Object *image);
void ephoto_filter_edge(Ephoto *ephoto, Evas_Object *image); void ephoto_filter_edge(Ephoto *ephoto, Evas_Object *image);
void ephoto_filter_emboss(Ephoto *ephoto, Evas_Object *image); void ephoto_filter_emboss(Ephoto *ephoto, Evas_Object *image);
void ephoto_filter_histogram_eq(Ephoto *ephoto, Evas_Object *image); void ephoto_filter_histogram_eq(Ephoto *ephoto, Evas_Object *image);
/*file functions*/ /*file functions*/
void ephoto_file_save_image(Ephoto *ephoto, Ephoto_Entry *entry, void ephoto_file_save_image(Ephoto *ephoto, Ephoto_Entry *entry,
Evas_Object *image); Evas_Object *image);
void ephoto_file_save_image_as(Ephoto *ephoto, Ephoto_Entry *entry, void ephoto_file_save_image_as(Ephoto *ephoto, Ephoto_Entry *entry,
Evas_Object *image); Evas_Object *image);
void ephoto_file_upload_image(Ephoto *ephoto, Ephoto_Entry *entry); void ephoto_file_upload_image(Ephoto *ephoto, Ephoto_Entry *entry);
void ephoto_file_new_dir(Ephoto *ephoto, const char *path); void ephoto_file_new_dir(Ephoto *ephoto, const char *path);
void ephoto_file_rename(Ephoto *ephoto, const char *path); void ephoto_file_rename(Ephoto *ephoto, const char *path);
void ephoto_file_move(Ephoto *ephoto, Eina_List *files, const char *path); void ephoto_file_move(Ephoto *ephoto, Eina_List *files, const char *path);
void ephoto_file_copy(Ephoto *ephoto, Eina_List *files, const char *path); void ephoto_file_copy(Ephoto *ephoto, Eina_List *files, const char *path);
void ephoto_file_paste(Ephoto *ephoto, Eina_List *files, Eina_Bool copy, void ephoto_file_paste(Ephoto *ephoto, Eina_List *files, Eina_Bool copy,
const char *path); const char *path);
void ephoto_file_delete(Ephoto *ephoto, Eina_List *files, void ephoto_file_delete(Ephoto *ephoto, Eina_List *files,
Eina_File_Type type); Eina_File_Type type);
void ephoto_file_empty_trash(Ephoto *ephoto, Eina_List *files); void ephoto_file_empty_trash(Ephoto *ephoto, Eina_List *files);
/*data types and structures*/ /*data types and structures*/
@ -211,25 +211,25 @@ enum _Ephoto_Ipc_Domain
struct _Ephoto_Config struct _Ephoto_Config
{ {
int config_version; int config_version;
int thumb_size; int thumb_size;
int thumb_gen_size; int thumb_gen_size;
int window_width; int window_width;
int window_height; int window_height;
double slideshow_timeout; double slideshow_timeout;
double left_size; double left_size;
double right_size; double right_size;
const char *directory; const char *directory;
const char *slideshow_transition; const char *slideshow_transition;
const char *open; const char *open;
Eina_Bool fsel_hide; Eina_Bool fsel_hide;
Eina_Bool prompts; Eina_Bool prompts;
Eina_Bool drop; Eina_Bool drop;
Eina_Bool movess; Eina_Bool movess;
Eina_Bool smooth; Eina_Bool smooth;
Eina_Bool firstrun; Eina_Bool firstrun;
Eina_Bool folders; Eina_Bool folders;
Eina_Bool thumbnail_aspect; Eina_Bool thumbnail_aspect;
Evas_Object *slide_time; Evas_Object *slide_time;
Evas_Object *slide_trans; Evas_Object *slide_trans;
Evas_Object *open_dir; Evas_Object *open_dir;
@ -245,47 +245,47 @@ struct _Ephoto_Config
struct _Ephoto struct _Ephoto
{ {
Evas_Object *win; Evas_Object *win;
Evas_Object *main; Evas_Object *main;
Evas_Object *layout; Evas_Object *layout;
Evas_Object *pager; Evas_Object *pager;
Evas_Object *statusbar; Evas_Object *statusbar;
Evas_Object *folders_button; Evas_Object *folders_button;
Evas_Object *folders_icon; Evas_Object *folders_icon;
Evas_Object *view_button; Evas_Object *view_button;
Evas_Object *controls_left; Evas_Object *controls_left;
Evas_Object *controls_right; Evas_Object *controls_right;
Evas_Object *infolabel; Evas_Object *infolabel;
Evas_Object *exit; Evas_Object *exit;
Evas_Object *thumb_browser; Evas_Object *thumb_browser;
Evas_Object *single_browser; Evas_Object *single_browser;
Evas_Object *slideshow; Evas_Object *slideshow;
Evas_Object *dir_browser; Evas_Object *dir_browser;
Evas_Object *file_popup; Evas_Object *file_popup;
Eina_Bool folders_toggle; Eina_Bool folders_toggle;
Eina_List *entries; Eina_List *entries;
Eina_List *selentries; Eina_List *selentries;
Eina_List *searchentries; Eina_List *searchentries;
Eina_List *thumbs; Eina_List *thumbs;
Eio_Monitor *monitor; Eio_Monitor *monitor;
Eina_List *monitor_handlers; Eina_List *monitor_handlers;
Eina_List *file_pos; Eina_List *file_pos;
Eina_List *upload_handlers; Eina_List *upload_handlers;
Ecore_Thread *file_thread; Ecore_Thread *file_thread;
Ecore_Con_Url *url_up; Ecore_Con_Url *url_up;
char *url_ret; char *url_ret;
char *upload_error; char *upload_error;
int file_errors; int file_errors;
const char *top_directory; const char *top_directory;
const char *config_path; const char *config_path;
const char *trash_path; const char *trash_path;
const char *destination; const char *destination;
int thumb_gen_size; int thumb_gen_size;
struct struct
{ {
@ -296,34 +296,34 @@ struct _Ephoto
Ecore_Job *change_dir; Ecore_Job *change_dir;
} job; } job;
Eio_File *ls; Eio_File *ls;
Evas_Object *prefs_win; Evas_Object *prefs_win;
Ephoto_State state, prev_state; Ephoto_State state, prev_state;
Ephoto_Config *config; Ephoto_Config *config;
Ephoto_Sort sort; Ephoto_Sort sort;
}; };
struct _Ephoto_Entry struct _Ephoto_Entry
{ {
const char *path; const char *path;
const char *basename; const char *basename;
const char *label; const char *label;
const char *sort_id; const char *sort_id;
double size; double size;
Ephoto *ephoto; Ephoto *ephoto;
Eio_Monitor *monitor; Eio_Monitor *monitor;
Eina_List *monitor_handlers; Eina_List *monitor_handlers;
Elm_Object_Item *item; Elm_Object_Item *item;
Elm_Object_Item *parent; Elm_Object_Item *parent;
Eina_List *free_listeners; Eina_List *free_listeners;
Eina_Bool is_dir; Eina_Bool is_dir;
Eina_Bool is_link; Eina_Bool is_link;
Eina_Bool no_delete; Eina_Bool no_delete;
Evas_Object *genlist; Evas_Object *genlist;
Evas_Object *gengrid; Evas_Object *gengrid;
Evas_Object *thumb; Evas_Object *thumb;
}; };
struct _Ephoto_Event_Entry_Create struct _Ephoto_Event_Entry_Create
@ -333,15 +333,15 @@ struct _Ephoto_Event_Entry_Create
/*ephoto file functions*/ /*ephoto file functions*/
Ephoto_Entry *ephoto_entry_new(Ephoto *ephoto, const char *path, Ephoto_Entry *ephoto_entry_new(Ephoto *ephoto, const char *path,
const char *label, Eina_File_Type type); const char *label, Eina_File_Type type);
Eina_Bool ephoto_entry_exists(Ephoto *ephoto, const char *path); Eina_Bool ephoto_entry_exists(Ephoto *ephoto, const char *path);
void ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry); void ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry);
void ephoto_entry_free_listener_add(Ephoto_Entry *entry, void ephoto_entry_free_listener_add(Ephoto_Entry *entry,
void (*cb) (void *data, const Ephoto_Entry *entry), const void *data); void (*cb)(void *data, const Ephoto_Entry *entry), const void *data);
void ephoto_entry_free_listener_del(Ephoto_Entry *entry, void ephoto_entry_free_listener_del(Ephoto_Entry *entry,
void (*cb) (void *data, const Ephoto_Entry *entry), const void *data); void (*cb)(void *data, const Ephoto_Entry *entry), const void *data);
void ephoto_entries_free(Ephoto *ephoto); void ephoto_entries_free(Ephoto *ephoto);
int ephoto_entries_cmp(const void *pa, const void *pb); int ephoto_entries_cmp(const void *pa, const void *pb);
/*check if image can be loaded*/ /*check if image can be loaded*/
static inline Eina_Bool static inline Eina_Bool
@ -361,20 +361,20 @@ _ephoto_eina_file_direct_info_image_useful(const Eina_File_Direct_Info *info)
bname = info->path + info->name_start; bname = info->path + info->name_start;
if (bname[0] == '.') if (bname[0] == '.')
return EINA_FALSE; return EINA_FALSE;
if ((info->type != EINA_FILE_REG) && (info->type != EINA_FILE_UNKNOWN) && if ((info->type != EINA_FILE_REG) && (info->type != EINA_FILE_UNKNOWN) &&
(info->type != EINA_FILE_LNK)) (info->type != EINA_FILE_LNK))
return EINA_FALSE; return EINA_FALSE;
type = strrchr(bname, '.'); type = strrchr(bname, '.');
if (!type) if (!type)
return EINA_FALSE; return EINA_FALSE;
count = sizeof(filters) / sizeof(filters[0]); count = sizeof(filters) / sizeof(filters[0]);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
if (!strcasecmp(type + 1, filters[i])) if (!strcasecmp(type + 1, filters[i]))
return evas_object_image_extension_can_load_get(bname); return evas_object_image_extension_can_load_get(bname);
} }
return EINA_FALSE; return EINA_FALSE;
} }
@ -393,7 +393,7 @@ _ephoto_file_image_can_save(const char *ext)
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
if (!strcasecmp(ext, filters[i])) if (!strcasecmp(ext, filters[i]))
return EINA_TRUE; return EINA_TRUE;
} }
return EINA_FALSE; return EINA_FALSE;
} }
@ -408,7 +408,7 @@ ephoto_normalize_color(int color)
static inline int static inline int
ephoto_mul_color_alpha(int color, int alpha) ephoto_mul_color_alpha(int color, int alpha)
{ {
return (alpha > 0 && alpha <= 255) ? (color * (255 /alpha)) : color; return (alpha > 0 && alpha <= 255) ? (color * (255 / alpha)) : color;
} }
static inline int static inline int
@ -427,15 +427,14 @@ extern int EPHOTO_EVENT_EDITOR_APPLY;
extern int EPHOTO_EVENT_EDITOR_CANCEL; extern int EPHOTO_EVENT_EDITOR_CANCEL;
extern int EPHOTO_EVENT_EDITOR_BACK; extern int EPHOTO_EVENT_EDITOR_BACK;
#define CRIT(...) EINA_LOG_CRIT(__VA_ARGS__)
#define CRIT(...) EINA_LOG_CRIT(__VA_ARGS__) #define ERR(...) EINA_LOG_ERR(__VA_ARGS__)
#define ERR(...) EINA_LOG_ERR(__VA_ARGS__) #define WRN(...) EINA_LOG_WARN(__VA_ARGS__)
#define WRN(...) EINA_LOG_WARN(__VA_ARGS__) #define INF(...) EINA_LOG_INFO(__VA_ARGS__)
#define INF(...) EINA_LOG_INFO(__VA_ARGS__) #define DBG(...) EINA_LOG_DBG(__VA_ARGS__)
#define DBG(...) EINA_LOG_DBG(__VA_ARGS__)
#define EPHOTO_WEIGHT evas_object_size_hint_weight_set #define EPHOTO_WEIGHT evas_object_size_hint_weight_set
#define EPHOTO_ALIGN evas_object_size_hint_align_set #define EPHOTO_ALIGN evas_object_size_hint_align_set
#define EPHOTO_EXPAND(X) EPHOTO_WEIGHT((X), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND) #define EPHOTO_EXPAND(X) EPHOTO_WEIGHT((X), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
#define EPHOTO_FILL(X) EPHOTO_ALIGN((X), EVAS_HINT_FILL, EVAS_HINT_FILL) #define EPHOTO_FILL(X) EPHOTO_ALIGN((X), EVAS_HINT_FILL, EVAS_HINT_FILL)
#endif #endif

View File

@ -3,24 +3,24 @@
typedef struct _Ephoto_BCG Ephoto_BCG; typedef struct _Ephoto_BCG Ephoto_BCG;
struct _Ephoto_BCG struct _Ephoto_BCG
{ {
Evas_Object *main; Evas_Object *main;
Evas_Object *parent; Evas_Object *parent;
Evas_Object *image; Evas_Object *image;
Evas_Object *editor; Evas_Object *editor;
Evas_Object *bslider; Evas_Object *bslider;
Evas_Object *cslider; Evas_Object *cslider;
Evas_Object *gslider; Evas_Object *gslider;
Eina_List *handlers; Eina_List *handlers;
int contrast; int contrast;
int brightness; int brightness;
double gamma; double gamma;
Evas_Coord w, h; Evas_Coord w, h;
unsigned int *original_im_data; unsigned int *original_im_data;
}; };
unsigned int * unsigned int *
_ephoto_bcg_adjust_brightness(Ephoto_BCG *ebcg, int brightness, _ephoto_bcg_adjust_brightness(Ephoto_BCG *ebcg, int brightness,
unsigned int *image_data) unsigned int *image_data)
{ {
unsigned int *im_data, *im_data_new, *p1, *p2; unsigned int *im_data, *im_data_new, *p1, *p2;
Evas_Coord x, y; Evas_Coord x, y;
@ -28,50 +28,50 @@ _ephoto_bcg_adjust_brightness(Ephoto_BCG *ebcg, int brightness,
im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
if (image_data) if (image_data)
memcpy(im_data, image_data, sizeof(unsigned int) * ebcg->w * ebcg->h); memcpy(im_data, image_data, sizeof(unsigned int) * ebcg->w * ebcg->h);
else else
memcpy(im_data, ebcg->original_im_data, memcpy(im_data, ebcg->original_im_data,
sizeof(unsigned int) * ebcg->w * ebcg->h); sizeof(unsigned int) * ebcg->w * ebcg->h);
ebcg->brightness = brightness; ebcg->brightness = brightness;
im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
for (y = 0; y < ebcg->h; y++) for (y = 0; y < ebcg->h; y++)
{ {
p1 = im_data + (y * ebcg->w); p1 = im_data + (y * ebcg->w);
p2 = im_data_new + (y * ebcg->w); p2 = im_data_new + (y * ebcg->w);
for (x = 0; x < ebcg->w; x++) for (x = 0; x < ebcg->w; x++)
{ {
b = (int) ((*p1) & 0xff); b = (int)((*p1) & 0xff);
g = (int) ((*p1 >> 8) & 0xff); g = (int)((*p1 >> 8) & 0xff);
r = (int) ((*p1 >> 16) & 0xff); r = (int)((*p1 >> 16) & 0xff);
a = (int) ((*p1 >> 24) & 0xff); a = (int)((*p1 >> 24) & 0xff);
b = ephoto_mul_color_alpha(b, a); b = ephoto_mul_color_alpha(b, a);
g = ephoto_mul_color_alpha(g, a); g = ephoto_mul_color_alpha(g, a);
r = ephoto_mul_color_alpha(r, a); r = ephoto_mul_color_alpha(r, a);
bb = (int) b + ebcg->brightness; bb = (int)b + ebcg->brightness;
gg = (int) g + ebcg->brightness; gg = (int)g + ebcg->brightness;
rr = (int) r + ebcg->brightness; rr = (int)r + ebcg->brightness;
bb = ephoto_normalize_color(bb); bb = ephoto_normalize_color(bb);
gg = ephoto_normalize_color(gg); gg = ephoto_normalize_color(gg);
rr = ephoto_normalize_color(rr); rr = ephoto_normalize_color(rr);
bb = ephoto_demul_color_alpha(bb, a); bb = ephoto_demul_color_alpha(bb, a);
gg = ephoto_demul_color_alpha(gg, a); gg = ephoto_demul_color_alpha(gg, a);
rr = ephoto_demul_color_alpha(rr, a); rr = ephoto_demul_color_alpha(rr, a);
*p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
p2++; p2++;
p1++; p1++;
} }
} }
ephoto_single_browser_image_data_update(ebcg->main, ebcg->image, ephoto_single_browser_image_data_update(ebcg->main, ebcg->image,
im_data_new, ebcg->w, ebcg->h); im_data_new, ebcg->w, ebcg->h);
free(im_data); free(im_data);
return im_data_new; return im_data_new;
} }
unsigned int * unsigned int *
_ephoto_bcg_adjust_contrast(Ephoto_BCG *ebcg, int contrast, _ephoto_bcg_adjust_contrast(Ephoto_BCG *ebcg, int contrast,
unsigned int *image_data) unsigned int *image_data)
{ {
unsigned int *im_data, *im_data_new, *p1, *p2; unsigned int *im_data, *im_data_new, *p1, *p2;
Evas_Coord x, y; Evas_Coord x, y;
@ -80,53 +80,53 @@ _ephoto_bcg_adjust_contrast(Ephoto_BCG *ebcg, int contrast,
im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
if (image_data) if (image_data)
memcpy(im_data, image_data, sizeof(unsigned int) * ebcg->w * ebcg->h); memcpy(im_data, image_data, sizeof(unsigned int) * ebcg->w * ebcg->h);
else else
memcpy(im_data, ebcg->original_im_data, memcpy(im_data, ebcg->original_im_data,
sizeof(unsigned int) * ebcg->w * ebcg->h); sizeof(unsigned int) * ebcg->w * ebcg->h);
ebcg->contrast = contrast; ebcg->contrast = contrast;
top = ((255 + (contrast)) * 259); top = ((255 + (contrast)) * 259);
bottom = ((259 - (contrast)) * 255); bottom = ((259 - (contrast)) * 255);
factor = (float) top / (float) bottom; factor = (float)top / (float)bottom;
im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
for (y = 0; y < ebcg->h; y++) for (y = 0; y < ebcg->h; y++)
{ {
p1 = im_data + (y * ebcg->w); p1 = im_data + (y * ebcg->w);
p2 = im_data_new + (y * ebcg->w); p2 = im_data_new + (y * ebcg->w);
for (x = 0; x < ebcg->w; x++) for (x = 0; x < ebcg->w; x++)
{ {
b = (int) ((*p1) & 0xff); b = (int)((*p1) & 0xff);
g = (int) ((*p1 >> 8) & 0xff); g = (int)((*p1 >> 8) & 0xff);
r = (int) ((*p1 >> 16) & 0xff); r = (int)((*p1 >> 16) & 0xff);
a = (int) ((*p1 >> 24) & 0xff); a = (int)((*p1 >> 24) & 0xff);
b = ephoto_mul_color_alpha(b, a); b = ephoto_mul_color_alpha(b, a);
g = ephoto_mul_color_alpha(g, a); g = ephoto_mul_color_alpha(g, a);
r = ephoto_mul_color_alpha(r, a); r = ephoto_mul_color_alpha(r, a);
bb = (int) ((factor * (b - 128)) + 128); bb = (int)((factor * (b - 128)) + 128);
gg = (int) ((factor * (g - 128)) + 128); gg = (int)((factor * (g - 128)) + 128);
rr = (int) ((factor * (r - 128)) + 128); rr = (int)((factor * (r - 128)) + 128);
bb = ephoto_normalize_color(bb); bb = ephoto_normalize_color(bb);
gg = ephoto_normalize_color(gg); gg = ephoto_normalize_color(gg);
rr = ephoto_normalize_color(rr); rr = ephoto_normalize_color(rr);
bb = ephoto_demul_color_alpha(bb, a); bb = ephoto_demul_color_alpha(bb, a);
gg = ephoto_demul_color_alpha(gg, a); gg = ephoto_demul_color_alpha(gg, a);
rr = ephoto_demul_color_alpha(rr, a); rr = ephoto_demul_color_alpha(rr, a);
*p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
p2++; p2++;
p1++; p1++;
} }
} }
ephoto_single_browser_image_data_update(ebcg->main, ebcg->image, ephoto_single_browser_image_data_update(ebcg->main, ebcg->image,
im_data_new, ebcg->w, ebcg->h); im_data_new, ebcg->w, ebcg->h);
free(im_data); free(im_data);
return im_data_new; return im_data_new;
} }
unsigned int * unsigned int *
_ephoto_bcg_adjust_gamma(Ephoto_BCG *ebcg, double gamma, _ephoto_bcg_adjust_gamma(Ephoto_BCG *ebcg, double gamma,
unsigned int *image_data) unsigned int *image_data)
{ {
unsigned int *im_data, *im_data_new, *p1, *p2; unsigned int *im_data, *im_data_new, *p1, *p2;
Evas_Coord x, y; Evas_Coord x, y;
@ -134,50 +134,50 @@ _ephoto_bcg_adjust_gamma(Ephoto_BCG *ebcg, double gamma,
im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
if (image_data) if (image_data)
memcpy(im_data, image_data, sizeof(unsigned int) * ebcg->w * ebcg->h); memcpy(im_data, image_data, sizeof(unsigned int) * ebcg->w * ebcg->h);
else else
memcpy(im_data, ebcg->original_im_data, memcpy(im_data, ebcg->original_im_data,
sizeof(unsigned int) * ebcg->w * ebcg->h); sizeof(unsigned int) * ebcg->w * ebcg->h);
ebcg->gamma = 1 / gamma; ebcg->gamma = 1 / gamma;
im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
for (y = 0; y < ebcg->h; y++) for (y = 0; y < ebcg->h; y++)
{ {
p1 = im_data + (y * ebcg->w); p1 = im_data + (y * ebcg->w);
p2 = im_data_new + (y * ebcg->w); p2 = im_data_new + (y * ebcg->w);
for (x = 0; x < ebcg->w; x++) for (x = 0; x < ebcg->w; x++)
{ {
b = (int) ((*p1) & 0xff); b = (int)((*p1) & 0xff);
g = (int) ((*p1 >> 8) & 0xff); g = (int)((*p1 >> 8) & 0xff);
r = (int) ((*p1 >> 16) & 0xff); r = (int)((*p1 >> 16) & 0xff);
a = (int) ((*p1 >> 24) & 0xff); a = (int)((*p1 >> 24) & 0xff);
b = ephoto_mul_color_alpha(b, a); b = ephoto_mul_color_alpha(b, a);
g = ephoto_mul_color_alpha(g, a); g = ephoto_mul_color_alpha(g, a);
r = ephoto_mul_color_alpha(r, a); r = ephoto_mul_color_alpha(r, a);
bb = (int) (pow(((double) b / 255), ebcg->gamma) * 255); bb = (int)(pow(((double)b / 255), ebcg->gamma) * 255);
gg = (int) (pow(((double) g / 255), ebcg->gamma) * 255); gg = (int)(pow(((double)g / 255), ebcg->gamma) * 255);
rr = (int) (pow(((double) r / 255), ebcg->gamma) * 255); rr = (int)(pow(((double)r / 255), ebcg->gamma) * 255);
bb = ephoto_normalize_color(bb); bb = ephoto_normalize_color(bb);
gg = ephoto_normalize_color(gg); gg = ephoto_normalize_color(gg);
rr = ephoto_normalize_color(rr); rr = ephoto_normalize_color(rr);
bb = ephoto_demul_color_alpha(bb, a); bb = ephoto_demul_color_alpha(bb, a);
gg = ephoto_demul_color_alpha(gg, a); gg = ephoto_demul_color_alpha(gg, a);
rr = ephoto_demul_color_alpha(rr, a); rr = ephoto_demul_color_alpha(rr, a);
*p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
p2++; p2++;
p1++; p1++;
} }
} }
ephoto_single_browser_image_data_update(ebcg->main, ebcg->image, ephoto_single_browser_image_data_update(ebcg->main, ebcg->image,
im_data_new, ebcg->w, ebcg->h); im_data_new, ebcg->w, ebcg->h);
free(im_data); free(im_data);
return im_data_new; return im_data_new;
} }
static void static void
_brightness_slider_changed(void *data, Evas_Object *obj, _brightness_slider_changed(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_BCG *ebcg = data; Ephoto_BCG *ebcg = data;
int brightness; int brightness;
@ -186,13 +186,13 @@ _brightness_slider_changed(void *data, Evas_Object *obj,
brightness = elm_slider_value_get(obj); brightness = elm_slider_value_get(obj);
image_data = _ephoto_bcg_adjust_brightness(ebcg, brightness, NULL); image_data = _ephoto_bcg_adjust_brightness(ebcg, brightness, NULL);
image_data_two = image_data_two =
_ephoto_bcg_adjust_contrast(ebcg, ebcg->contrast, image_data); _ephoto_bcg_adjust_contrast(ebcg, ebcg->contrast, image_data);
_ephoto_bcg_adjust_gamma(ebcg, ebcg->gamma, image_data_two); _ephoto_bcg_adjust_gamma(ebcg, ebcg->gamma, image_data_two);
} }
static void static void
_contrast_slider_changed(void *data, Evas_Object *obj, _contrast_slider_changed(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_BCG *ebcg = data; Ephoto_BCG *ebcg = data;
int contrast; int contrast;
@ -201,13 +201,13 @@ _contrast_slider_changed(void *data, Evas_Object *obj,
contrast = elm_slider_value_get(obj); contrast = elm_slider_value_get(obj);
image_data = _ephoto_bcg_adjust_contrast(ebcg, contrast, NULL); image_data = _ephoto_bcg_adjust_contrast(ebcg, contrast, NULL);
image_data_two = image_data_two =
_ephoto_bcg_adjust_brightness(ebcg, ebcg->brightness, image_data); _ephoto_bcg_adjust_brightness(ebcg, ebcg->brightness, image_data);
_ephoto_bcg_adjust_gamma(ebcg, ebcg->gamma, image_data_two); _ephoto_bcg_adjust_gamma(ebcg, ebcg->gamma, image_data_two);
} }
static void static void
_gamma_slider_changed(void *data, Evas_Object *obj, _gamma_slider_changed(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_BCG *ebcg = data; Ephoto_BCG *ebcg = data;
double gamma; double gamma;
@ -216,13 +216,13 @@ _gamma_slider_changed(void *data, Evas_Object *obj,
gamma = elm_slider_value_get(obj); gamma = elm_slider_value_get(obj);
image_data = _ephoto_bcg_adjust_gamma(ebcg, gamma, NULL); image_data = _ephoto_bcg_adjust_gamma(ebcg, gamma, NULL);
image_data_two = image_data_two =
_ephoto_bcg_adjust_brightness(ebcg, ebcg->brightness, image_data); _ephoto_bcg_adjust_brightness(ebcg, ebcg->brightness, image_data);
_ephoto_bcg_adjust_contrast(ebcg, ebcg->contrast, image_data_two); _ephoto_bcg_adjust_contrast(ebcg, ebcg->contrast, image_data_two);
} }
static Eina_Bool static Eina_Bool
_bcg_reset(void *data, int type EINA_UNUSED, _bcg_reset(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_BCG *ebcg = data; Ephoto_BCG *ebcg = data;
@ -239,7 +239,7 @@ _bcg_reset(void *data, int type EINA_UNUSED,
static Eina_Bool static Eina_Bool
_bcg_apply(void *data, int type EINA_UNUSED, _bcg_apply(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_BCG *ebcg = data; Ephoto_BCG *ebcg = data;
unsigned int *image_data; unsigned int *image_data;
@ -254,7 +254,7 @@ _bcg_apply(void *data, int type EINA_UNUSED,
else else
{ {
image_data = image_data =
evas_object_image_data_get(ebcg->image, EINA_FALSE); evas_object_image_data_get(ebcg->image, EINA_FALSE);
evas_object_image_size_get(ebcg->image, &w, &h); evas_object_image_size_get(ebcg->image, &w, &h);
ephoto_single_browser_image_data_done(ebcg->main, image_data, w, h); ephoto_single_browser_image_data_done(ebcg->main, image_data, w, h);
} }
@ -265,7 +265,7 @@ _bcg_apply(void *data, int type EINA_UNUSED,
static Eina_Bool static Eina_Bool
_bcg_cancel(void *data, int type EINA_UNUSED, _bcg_cancel(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_BCG *ebcg = data; Ephoto_BCG *ebcg = data;
@ -284,7 +284,7 @@ _bcg_cancel(void *data, int type EINA_UNUSED,
static void static void
_editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_BCG *ebcg = data; Ephoto_BCG *ebcg = data;
Ecore_Event_Handler *handler; Ecore_Event_Handler *handler;
@ -314,18 +314,18 @@ ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje
ebcg->parent = parent; ebcg->parent = parent;
ebcg->image = image; ebcg->image = image;
im_data = im_data =
evas_object_image_data_get(ebcg->image, evas_object_image_data_get(ebcg->image,
EINA_FALSE); EINA_FALSE);
evas_object_image_size_get(ebcg->image, &ebcg->w, evas_object_image_size_get(ebcg->image, &ebcg->w,
&ebcg->h); &ebcg->h);
ebcg->original_im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); ebcg->original_im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h);
memcpy(ebcg->original_im_data, im_data, memcpy(ebcg->original_im_data, im_data,
sizeof(unsigned int) * ebcg->w * ebcg->h); sizeof(unsigned int) * ebcg->w * ebcg->h);
ebcg->editor = ephoto_editor_add(ephoto, parent, _("Brightness/Contrast/Gamma"), ebcg->editor = ephoto_editor_add(ephoto, parent, _("Brightness/Contrast/Gamma"),
"ebcg", ebcg); "ebcg", ebcg);
evas_object_event_callback_add(ebcg->editor, EVAS_CALLBACK_DEL, _editor_del, evas_object_event_callback_add(ebcg->editor, EVAS_CALLBACK_DEL, _editor_del,
ebcg); ebcg);
slider = elm_slider_add(ebcg->editor); slider = elm_slider_add(ebcg->editor);
elm_object_text_set(slider, _("Gamma")); elm_object_text_set(slider, _("Gamma"));
@ -337,7 +337,7 @@ ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje
EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
evas_object_smart_callback_add(slider, "delay,changed", evas_object_smart_callback_add(slider, "delay,changed",
_gamma_slider_changed, ebcg); _gamma_slider_changed, ebcg);
elm_box_pack_start(ebcg->editor, slider); elm_box_pack_start(ebcg->editor, slider);
evas_object_show(slider); evas_object_show(slider);
ebcg->gslider = slider; ebcg->gslider = slider;
@ -352,7 +352,7 @@ ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje
EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
evas_object_smart_callback_add(slider, "delay,changed", evas_object_smart_callback_add(slider, "delay,changed",
_contrast_slider_changed, ebcg); _contrast_slider_changed, ebcg);
elm_box_pack_start(ebcg->editor, slider); elm_box_pack_start(ebcg->editor, slider);
evas_object_show(slider); evas_object_show(slider);
ebcg->cslider = slider; ebcg->cslider = slider;
@ -367,26 +367,27 @@ ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje
EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
evas_object_smart_callback_add(slider, "delay,changed", evas_object_smart_callback_add(slider, "delay,changed",
_brightness_slider_changed, ebcg); _brightness_slider_changed, ebcg);
elm_box_pack_start(ebcg->editor, slider); elm_box_pack_start(ebcg->editor, slider);
evas_object_show(slider); evas_object_show(slider);
ebcg->bslider = slider; ebcg->bslider = slider;
ebcg->handlers = ebcg->handlers =
eina_list_append(ebcg->handlers, eina_list_append(ebcg->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET,
_bcg_reset, ebcg)); _bcg_reset, ebcg));
ebcg->handlers = ebcg->handlers =
eina_list_append(ebcg->handlers, eina_list_append(ebcg->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY,
_bcg_apply, ebcg)); _bcg_apply, ebcg));
ebcg->handlers = ebcg->handlers =
eina_list_append(ebcg->handlers, eina_list_append(ebcg->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL,
_bcg_cancel, ebcg)); _bcg_cancel, ebcg));
return; return;
error: error:
return; return;
} }

View File

@ -3,18 +3,18 @@
typedef struct _Ephoto_Color Ephoto_Color; typedef struct _Ephoto_Color Ephoto_Color;
struct _Ephoto_Color struct _Ephoto_Color
{ {
Evas_Object *main; Evas_Object *main;
Evas_Object *parent; Evas_Object *parent;
Evas_Object *image; Evas_Object *image;
Evas_Object *editor; Evas_Object *editor;
Evas_Object *bslider; Evas_Object *bslider;
Evas_Object *gslider; Evas_Object *gslider;
Evas_Object *rslider; Evas_Object *rslider;
Eina_List *handlers; Eina_List *handlers;
int blue; int blue;
int green; int green;
int red; int red;
Evas_Coord w, h; Evas_Coord w, h;
unsigned int *original_im_data; unsigned int *original_im_data;
}; };
@ -35,10 +35,10 @@ _ephoto_apply_color_adjustment(Ephoto_Color *eco, unsigned int *image_data, int
im_data = malloc(sizeof(unsigned int) * eco->w * eco->h); im_data = malloc(sizeof(unsigned int) * eco->w * eco->h);
if (image_data) if (image_data)
memcpy(im_data, image_data, sizeof(unsigned int) * eco->w * eco->h); memcpy(im_data, image_data, sizeof(unsigned int) * eco->w * eco->h);
else else
memcpy(im_data, eco->original_im_data, memcpy(im_data, eco->original_im_data,
sizeof(unsigned int) * eco->w * eco->h); sizeof(unsigned int) * eco->w * eco->h);
im_data_new = malloc(sizeof(unsigned int) * eco->w * eco->h); im_data_new = malloc(sizeof(unsigned int) * eco->w * eco->h);
@ -48,32 +48,35 @@ _ephoto_apply_color_adjustment(Ephoto_Color *eco, unsigned int *image_data, int
p2 = im_data_new + (y * eco->w); p2 = im_data_new + (y * eco->w);
for (x = 0; x < eco->w; x++) for (x = 0; x < eco->w; x++)
{ {
b = (int) ((*p1) & 0xff); b = (int)((*p1) & 0xff);
g = (int) ((*p1 >> 8) & 0xff); g = (int)((*p1 >> 8) & 0xff);
r = (int) ((*p1 >> 16) & 0xff); r = (int)((*p1 >> 16) & 0xff);
a = (int) ((*p1 >> 24) & 0xff); a = (int)((*p1 >> 24) & 0xff);
b = ephoto_mul_color_alpha(b, a); b = ephoto_mul_color_alpha(b, a);
g = ephoto_mul_color_alpha(g, a); g = ephoto_mul_color_alpha(g, a);
r = ephoto_mul_color_alpha(r, a); r = ephoto_mul_color_alpha(r, a);
switch (color) switch (color)
{ {
case EPHOTO_COLOR_ADJUST_RED: case EPHOTO_COLOR_ADJUST_RED:
eco->red = adjust; eco->red = adjust;
cc = (int) r + eco->red; cc = (int)r + eco->red;
r = cc; r = cc;
break; break;
case EPHOTO_COLOR_ADJUST_BLUE:
eco->blue = adjust; case EPHOTO_COLOR_ADJUST_BLUE:
cc = (int) b + eco->blue; eco->blue = adjust;
b = cc; cc = (int)b + eco->blue;
break; b = cc;
case EPHOTO_COLOR_ADJUST_GREEN: break;
eco->green = adjust;
cc = (int) g + eco->green; case EPHOTO_COLOR_ADJUST_GREEN:
g = cc; eco->green = adjust;
break; cc = (int)g + eco->green;
default: g = cc;
break; break;
default:
break;
} }
b = ephoto_normalize_color(b); b = ephoto_normalize_color(b);
g = ephoto_normalize_color(g); g = ephoto_normalize_color(g);
@ -87,7 +90,7 @@ _ephoto_apply_color_adjustment(Ephoto_Color *eco, unsigned int *image_data, int
} }
} }
ephoto_single_browser_image_data_update(eco->main, eco->image, ephoto_single_browser_image_data_update(eco->main, eco->image,
im_data_new, eco->w, eco->h); im_data_new, eco->w, eco->h);
free(im_data); free(im_data);
return im_data_new; return im_data_new;
} }
@ -107,7 +110,7 @@ _red_slider_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
static void static void
_green_slider_changed(void *data, Evas_Object *obj, _green_slider_changed(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Color *eco = data; Ephoto_Color *eco = data;
int green; int green;
@ -121,7 +124,7 @@ _green_slider_changed(void *data, Evas_Object *obj,
static void static void
_blue_slider_changed(void *data, Evas_Object *obj, _blue_slider_changed(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Color *eco = data; Ephoto_Color *eco = data;
int blue; int blue;
@ -135,7 +138,7 @@ _blue_slider_changed(void *data, Evas_Object *obj,
static Eina_Bool static Eina_Bool
_color_reset(void *data, int type EINA_UNUSED, _color_reset(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Color *eco = data; Ephoto_Color *eco = data;
@ -152,7 +155,7 @@ _color_reset(void *data, int type EINA_UNUSED,
static Eina_Bool static Eina_Bool
_color_apply(void *data, int type EINA_UNUSED, _color_apply(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Color *eco = data; Ephoto_Color *eco = data;
unsigned int *image_data; unsigned int *image_data;
@ -167,7 +170,7 @@ _color_apply(void *data, int type EINA_UNUSED,
else else
{ {
image_data = image_data =
evas_object_image_data_get(eco->image, EINA_FALSE); evas_object_image_data_get(eco->image, EINA_FALSE);
evas_object_image_size_get(eco->image, &w, &h); evas_object_image_size_get(eco->image, &w, &h);
ephoto_single_browser_image_data_done(eco->main, image_data, w, h); ephoto_single_browser_image_data_done(eco->main, image_data, w, h);
} }
@ -178,7 +181,7 @@ _color_apply(void *data, int type EINA_UNUSED,
static Eina_Bool static Eina_Bool
_color_cancel(void *data, int type EINA_UNUSED, _color_cancel(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Color *eco = data; Ephoto_Color *eco = data;
@ -197,7 +200,7 @@ _color_cancel(void *data, int type EINA_UNUSED,
static void static void
_editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Color *eco = data; Ephoto_Color *eco = data;
Ecore_Event_Handler *handler; Ecore_Event_Handler *handler;
@ -227,18 +230,18 @@ ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Ob
eco->parent = parent; eco->parent = parent;
eco->image = image; eco->image = image;
im_data = im_data =
evas_object_image_data_get(eco->image, evas_object_image_data_get(eco->image,
EINA_FALSE); EINA_FALSE);
evas_object_image_size_get(eco->image, &eco->w, evas_object_image_size_get(eco->image, &eco->w,
&eco->h); &eco->h);
eco->original_im_data = malloc(sizeof(unsigned int) * eco->w * eco->h); eco->original_im_data = malloc(sizeof(unsigned int) * eco->w * eco->h);
memcpy(eco->original_im_data, im_data, memcpy(eco->original_im_data, im_data,
sizeof(unsigned int) * eco->w * eco->h); sizeof(unsigned int) * eco->w * eco->h);
eco->editor = ephoto_editor_add(ephoto, parent, _("Adjust Color Levels"), eco->editor = ephoto_editor_add(ephoto, parent, _("Adjust Color Levels"),
"eco", eco); "eco", eco);
evas_object_event_callback_add(eco->editor, EVAS_CALLBACK_DEL, _editor_del, evas_object_event_callback_add(eco->editor, EVAS_CALLBACK_DEL, _editor_del,
eco); eco);
slider = elm_slider_add(eco->editor); slider = elm_slider_add(eco->editor);
elm_object_text_set(slider, _("Blue")); elm_object_text_set(slider, _("Blue"));
@ -250,7 +253,7 @@ ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Ob
EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
evas_object_smart_callback_add(slider, "delay,changed", evas_object_smart_callback_add(slider, "delay,changed",
_blue_slider_changed, eco); _blue_slider_changed, eco);
elm_box_pack_start(eco->editor, slider); elm_box_pack_start(eco->editor, slider);
evas_object_show(slider); evas_object_show(slider);
eco->bslider = slider; eco->bslider = slider;
@ -265,7 +268,7 @@ ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Ob
EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
evas_object_smart_callback_add(slider, "delay,changed", evas_object_smart_callback_add(slider, "delay,changed",
_green_slider_changed, eco); _green_slider_changed, eco);
elm_box_pack_start(eco->editor, slider); elm_box_pack_start(eco->editor, slider);
evas_object_show(slider); evas_object_show(slider);
eco->gslider = slider; eco->gslider = slider;
@ -280,26 +283,27 @@ ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Ob
EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
evas_object_smart_callback_add(slider, "delay,changed", evas_object_smart_callback_add(slider, "delay,changed",
_red_slider_changed, eco); _red_slider_changed, eco);
elm_box_pack_start(eco->editor, slider); elm_box_pack_start(eco->editor, slider);
evas_object_show(slider); evas_object_show(slider);
eco->rslider = slider; eco->rslider = slider;
eco->handlers = eco->handlers =
eina_list_append(eco->handlers, eina_list_append(eco->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET,
_color_reset, eco)); _color_reset, eco));
eco->handlers = eco->handlers =
eina_list_append(eco->handlers, eina_list_append(eco->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY,
_color_apply, eco)); _color_apply, eco));
eco->handlers = eco->handlers =
eina_list_append(eco->handlers, eina_list_append(eco->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL,
_color_cancel, eco)); _color_cancel, eco));
return; return;
error: error:
return; return;
} }

View File

@ -2,14 +2,14 @@
#define CONFIG_VERSION 21 #define CONFIG_VERSION 21
static int _ephoto_config_load(Ephoto *ephoto); static int _ephoto_config_load(Ephoto *ephoto);
static Eina_Bool _ephoto_on_config_save(void *data); static Eina_Bool _ephoto_on_config_save(void *data);
static Eet_Data_Descriptor *edd = NULL; static Eet_Data_Descriptor *edd = NULL;
static void static void
_config_save_cb(void *data, Evas_Object *obj EINA_UNUSED, _config_save_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Evas_Object *popup = data; Evas_Object *popup = data;
Ephoto *ephoto = evas_object_data_get(popup, "ephoto"); Ephoto *ephoto = evas_object_data_get(popup, "ephoto");
@ -17,18 +17,18 @@ _config_save_cb(void *data, Evas_Object *obj EINA_UNUSED,
const char *text = elm_object_text_get(ephoto->config->open_dir); const char *text = elm_object_text_get(ephoto->config->open_dir);
if (!strcmp(text, _("Root Directory"))) if (!strcmp(text, _("Root Directory")))
path = "/"; path = "/";
else if (!strcmp(text, _("Home Directory"))) else if (!strcmp(text, _("Home Directory")))
path = eina_environment_home_get(); path = eina_environment_home_get();
else if (!strcmp(text, _("Last Open Directory"))) else if (!strcmp(text, _("Last Open Directory")))
path = "Last"; path = "Last";
else else
path = elm_object_text_get(ephoto->config->open_dir_custom); path = elm_object_text_get(ephoto->config->open_dir_custom);
if (ecore_file_is_dir(path) || !strcmp(path, "Last")) if (ecore_file_is_dir(path) || !strcmp(path, "Last"))
eina_stringshare_replace(&ephoto->config->open, path); eina_stringshare_replace(&ephoto->config->open, path);
if (strcmp(path, ephoto->config->directory) && strcmp(path, "Last") && if (strcmp(path, ephoto->config->directory) && strcmp(path, "Last") &&
ecore_file_exists(path)) ecore_file_exists(path))
{ {
char *rp = ecore_file_realpath(path); char *rp = ecore_file_realpath(path);
ephoto_directory_browser_clear(ephoto); ephoto_directory_browser_clear(ephoto);
@ -52,11 +52,11 @@ _config_save_cb(void *data, Evas_Object *obj EINA_UNUSED,
} }
if (elm_spinner_value_get(ephoto->config->slide_time) > 0) if (elm_spinner_value_get(ephoto->config->slide_time) > 0)
ephoto->config->slideshow_timeout = ephoto->config->slideshow_timeout =
elm_spinner_value_get(ephoto->config->slide_time); elm_spinner_value_get(ephoto->config->slide_time);
if (elm_object_text_get(ephoto->config->slide_trans)) if (elm_object_text_get(ephoto->config->slide_trans))
eina_stringshare_replace(&ephoto->config->slideshow_transition, eina_stringshare_replace(&ephoto->config->slideshow_transition,
elm_object_text_get(ephoto->config->slide_trans)); elm_object_text_get(ephoto->config->slide_trans));
evas_object_del(popup); evas_object_del(popup);
elm_object_focus_set(ephoto->pager, EINA_TRUE); elm_object_focus_set(ephoto->pager, EINA_TRUE);
@ -71,9 +71,9 @@ _open_hv_select(void *data, Evas_Object *obj, void *event_info)
elm_object_text_set(obj, elm_object_item_text_get(event_info)); elm_object_text_set(obj, elm_object_item_text_get(event_info));
if (!strcmp(elm_object_item_text_get(event_info), _("Custom Directory"))) if (!strcmp(elm_object_item_text_get(event_info), _("Custom Directory")))
elm_object_disabled_set(ephoto->config->open_dir_custom, EINA_FALSE); elm_object_disabled_set(ephoto->config->open_dir_custom, EINA_FALSE);
else else
elm_object_disabled_set(ephoto->config->open_dir_custom, EINA_TRUE); elm_object_disabled_set(ephoto->config->open_dir_custom, EINA_TRUE);
} }
static void static void
@ -90,7 +90,7 @@ _config_general(Ephoto *ephoto, Evas_Object *parent)
check = elm_check_add(table); check = elm_check_add(table);
elm_object_text_set(check, _("Show Folders On Start")); elm_object_text_set(check, _("Show Folders On Start"));
EPHOTO_ALIGN(check, EVAS_HINT_FILL, 0.5); EPHOTO_ALIGN(check, EVAS_HINT_FILL, 0.5);
elm_check_state_set(check, ephoto->config->folders); elm_check_state_set(check, ephoto->config->folders);
elm_table_pack(table, check, 0, 0, 1, 1); elm_table_pack(table, check, 0, 0, 1, 1);
evas_object_show(check); evas_object_show(check);
@ -156,13 +156,13 @@ _config_general(Ephoto *ephoto, Evas_Object *parent)
hoversel = elm_hoversel_add(table); hoversel = elm_hoversel_add(table);
elm_hoversel_hover_parent_set(hoversel, ephoto->win); elm_hoversel_hover_parent_set(hoversel, ephoto->win);
elm_hoversel_item_add(hoversel, _("Root Directory"), NULL, 0, elm_hoversel_item_add(hoversel, _("Root Directory"), NULL, 0,
_open_hv_select, ephoto); _open_hv_select, ephoto);
elm_hoversel_item_add(hoversel, _("Home Directory"), NULL, 0, elm_hoversel_item_add(hoversel, _("Home Directory"), NULL, 0,
_open_hv_select, ephoto); _open_hv_select, ephoto);
elm_hoversel_item_add(hoversel, _("Last Open Directory"), NULL, 0, elm_hoversel_item_add(hoversel, _("Last Open Directory"), NULL, 0,
_open_hv_select, ephoto); _open_hv_select, ephoto);
elm_hoversel_item_add(hoversel, _("Custom Directory"), NULL, 0, elm_hoversel_item_add(hoversel, _("Custom Directory"), NULL, 0,
_open_hv_select, ephoto); _open_hv_select, ephoto);
elm_object_text_set(hoversel, ephoto->config->open); elm_object_text_set(hoversel, ephoto->config->open);
evas_object_data_set(hoversel, "ephoto", ephoto); evas_object_data_set(hoversel, "ephoto", ephoto);
EPHOTO_WEIGHT(hoversel, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_WEIGHT(hoversel, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
@ -177,7 +177,7 @@ _config_general(Ephoto *ephoto, Evas_Object *parent)
elm_object_text_set(entry, _("Custom Directory")); elm_object_text_set(entry, _("Custom Directory"));
elm_object_disabled_set(entry, EINA_TRUE); elm_object_disabled_set(entry, EINA_TRUE);
elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF,
ELM_SCROLLER_POLICY_OFF); ELM_SCROLLER_POLICY_OFF);
EPHOTO_EXPAND(entry); EPHOTO_EXPAND(entry);
EPHOTO_FILL(entry); EPHOTO_FILL(entry);
elm_table_pack(table, entry, 0, 9, 1, 1); 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)
static void static void
_spinner_changed(void *data EINA_UNUSED, Evas_Object *obj, _spinner_changed(void *data EINA_UNUSED, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
double val; double val;
char buf[PATH_MAX]; char buf[PATH_MAX];
@ -281,13 +281,14 @@ _config_slideshow(Ephoto *ephoto, Evas_Object *parent)
evas_object_show(label); evas_object_show(label);
transitions = _ephoto_transitions_list_get(edje_object_data_get(elm_layout_edje_get transitions = _ephoto_transitions_list_get(edje_object_data_get(elm_layout_edje_get
(ephoto->slideshow), "transitions")); (ephoto->slideshow), "transitions"));
hoversel = elm_hoversel_add(table); hoversel = elm_hoversel_add(table);
elm_hoversel_hover_parent_set(hoversel, ephoto->win); elm_hoversel_hover_parent_set(hoversel, ephoto->win);
EINA_LIST_FOREACH(transitions, l, EINA_LIST_FOREACH(transitions, l,
transition) elm_hoversel_item_add(hoversel, transition, NULL, 0, transition)
_hv_select, transition); elm_hoversel_item_add(hoversel, transition, NULL, 0,
_hv_select, transition);
elm_hoversel_item_add(hoversel, "none", NULL, 0, _hv_select, NULL); elm_hoversel_item_add(hoversel, "none", NULL, 0, _hv_select, NULL);
elm_object_text_set(hoversel, ephoto->config->slideshow_transition); elm_object_text_set(hoversel, ephoto->config->slideshow_transition);
EPHOTO_EXPAND(hoversel); EPHOTO_EXPAND(hoversel);
@ -297,8 +298,6 @@ _config_slideshow(Ephoto *ephoto, Evas_Object *parent)
ephoto->config->slide_trans = hoversel; ephoto->config->slide_trans = hoversel;
} }
static Evas_Object * static Evas_Object *
_config_settings(Ephoto *ephoto, Evas_Object *parent, Eina_Bool slideshow) _config_settings(Ephoto *ephoto, Evas_Object *parent, Eina_Bool slideshow)
{ {
@ -330,7 +329,7 @@ _config_settings(Ephoto *ephoto, Evas_Object *parent, Eina_Bool slideshow)
static void static void
_link_anchor_bt(void *data, Evas_Object *obj, _link_anchor_bt(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
Evas_Object *av = data; Evas_Object *av = data;
@ -347,7 +346,7 @@ _link_anchor_bt(void *data, Evas_Object *obj,
static void static void
_copy_anchor_bt(void *data, Evas_Object *obj, _copy_anchor_bt(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
Evas_Object *av = data; Evas_Object *av = data;
@ -356,7 +355,7 @@ _copy_anchor_bt(void *data, Evas_Object *obj,
elm_entry_anchor_hover_end(av); elm_entry_anchor_hover_end(av);
snprintf(buf, PATH_MAX, "%s", link); snprintf(buf, PATH_MAX, "%s", link);
elm_cnp_selection_set(av, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_MARKUP, elm_cnp_selection_set(av, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_MARKUP,
buf, strlen(buf)); buf, strlen(buf));
} }
static void static void
@ -370,7 +369,7 @@ _link_anchor(void *data, Evas_Object *obj, void *event_info)
elm_object_text_set(button, _("Open Link In Browser")); elm_object_text_set(button, _("Open Link In Browser"));
elm_object_part_content_set(ei->hover, "middle", button); elm_object_part_content_set(ei->hover, "middle", button);
evas_object_smart_callback_add(button, "clicked", _link_anchor_bt, evas_object_smart_callback_add(button, "clicked", _link_anchor_bt,
av); av);
evas_object_data_set(button, "link", strdup(ei->anchor_info->name)); evas_object_data_set(button, "link", strdup(ei->anchor_info->name));
evas_object_show(button); evas_object_show(button);
@ -378,7 +377,7 @@ _link_anchor(void *data, Evas_Object *obj, void *event_info)
elm_object_text_set(button, _("Copy Link")); elm_object_text_set(button, _("Copy Link"));
elm_object_part_content_set(ei->hover, "bottom", button); elm_object_part_content_set(ei->hover, "bottom", button);
evas_object_smart_callback_add(button, "clicked", _copy_anchor_bt, evas_object_smart_callback_add(button, "clicked", _copy_anchor_bt,
av); av);
evas_object_data_set(button, "link", strdup(ei->anchor_info->name)); evas_object_data_set(button, "link", strdup(ei->anchor_info->name));
evas_object_show(button); evas_object_show(button);
} }
@ -414,53 +413,53 @@ _config_bindings(Evas_Object *parent)
EPHOTO_WEIGHT(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); EPHOTO_WEIGHT(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
EPHOTO_FILL(entry); EPHOTO_FILL(entry);
eina_strbuf_append_printf(sbuf, eina_strbuf_append_printf(sbuf,
_("<b><hilight>General Bindings</hilight></b><br/>" _("<b><hilight>General Bindings</hilight></b><br/>"
"<b>F1:</b> Settings Panel<br/>" "<b>F1:</b> Settings Panel<br/>"
"<b>F5:</b> Start Slideshow<br/>" "<b>F5:</b> Start Slideshow<br/>"
"<b>F11:</b> Toggle Fullscreen<br/>" "<b>F11:</b> Toggle Fullscreen<br/>"
"<b>Ctrl+Shift+f:</b> Toggle File Selector<br/><br/>" "<b>Ctrl+Shift+f:</b> Toggle File Selector<br/><br/>"
"<b><hilight>Thumbnail Browser Bindings</hilight></b><br/>" "<b><hilight>Thumbnail Browser Bindings</hilight></b><br/>"
"<b>Ctrl++:</b> Zoom In<br/>" "<b>Ctrl++:</b> Zoom In<br/>"
"<b>Ctrl+-:</b> Zoom Out<br/>" "<b>Ctrl+-:</b> Zoom Out<br/>"
"<b>Ctrl+Tab:</b> View Image<br/>" "<b>Ctrl+Tab:</b> View Image<br/>"
"<b>Ctrl+c:</b> Copy Image<br/>" "<b>Ctrl+c:</b> Copy Image<br/>"
"<b>Ctrl+x:</b> Cut Image<br/>" "<b>Ctrl+x:</b> Cut Image<br/>"
"<b>Ctrl+v:</b> Paste Image<br/>" "<b>Ctrl+v:</b> Paste Image<br/>"
"<b>Ctrl+a:</b> Select All<br/>" "<b>Ctrl+a:</b> Select All<br/>"
"<b>Ctrl+f:</b> Toggle Search<br/>" "<b>Ctrl+f:</b> Toggle Search<br/>"
"<b>Ctrl+Delete:</b> Delete Image<br/>" "<b>Ctrl+Delete:</b> Delete Image<br/>"
"<b>F2:</b> Rename Image<br/>" "<b>F2:</b> Rename Image<br/>"
"<b>Escape:</b> Clear Selection<br/><br/>" "<b>Escape:</b> Clear Selection<br/><br/>"
"<b><hilight>Single Browser Bindings</hilight></b><br/>" "<b><hilight>Single Browser Bindings</hilight></b><br/>"
"<b>Ctrl+Shift+0:</b> Zoom 1:1<br/>" "<b>Ctrl+Shift+0:</b> Zoom 1:1<br/>"
"<b>Ctrl++:</b> Zoom In<br/>" "<b>Ctrl++:</b> Zoom In<br/>"
"<b>Ctrl+-:</b> Zoom Out<br/>" "<b>Ctrl+-:</b> Zoom Out<br/>"
"<b>Ctrl+0:</b> Zoom Fit<br/>" "<b>Ctrl+0:</b> Zoom Fit<br/>"
"<b>Ctrl+Shift+l:</b> Rotate Counter Clockwise<br/>" "<b>Ctrl+Shift+l:</b> Rotate Counter Clockwise<br/>"
"<b>Ctrl+l:</b> Flip Horizontal<br/>" "<b>Ctrl+l:</b> Flip Horizontal<br/>"
"<b>Ctrl+Shift+r:</b> Rotate Clockwise<br/>" "<b>Ctrl+Shift+r:</b> Rotate Clockwise<br/>"
"<b>Ctrl+r:</b> Flip Vertical<br/>" "<b>Ctrl+r:</b> Flip Vertical<br/>"
"<b>Ctrl+Shift+s:</b> Save Image As<br/>" "<b>Ctrl+Shift+s:</b> Save Image As<br/>"
"<b>Ctrl+s:</b> Save Image<br/>" "<b>Ctrl+s:</b> Save Image<br/>"
"<b>Ctrl+u:</b> Reset Image<br/>" "<b>Ctrl+u:</b> Reset Image<br/>"
"<b>Ctrl+y:</b> Redo<br/>" "<b>Ctrl+y:</b> Redo<br/>"
"<b>Ctrl+Shift+z:</b> Redo<br/>" "<b>Ctrl+Shift+z:</b> Redo<br/>"
"<b>Ctrl+z:</b> Undo<br/>" "<b>Ctrl+z:</b> Undo<br/>"
"<b>Home:</b> Navigate First<br/>" "<b>Home:</b> Navigate First<br/>"
"<b>Left Arrow:</b> Navigate Previous<br/>" "<b>Left Arrow:</b> Navigate Previous<br/>"
"<b>Right Arrow:</b> Navigate Next<br/>" "<b>Right Arrow:</b> Navigate Next<br/>"
"<b>Space:</b> Navigate Next<br/>" "<b>Space:</b> Navigate Next<br/>"
"<b>End:</b> Navigate Last<br/>" "<b>End:</b> Navigate Last<br/>"
"<b>Ctrl+Delete:</b> Delete Image<br/>" "<b>Ctrl+Delete:</b> Delete Image<br/>"
"<b>F2</b> Rename Image<br/>" "<b>F2</b> Rename Image<br/>"
"<b>Escape:</b> Return to Thumbnail Browser<br/><br/>" "<b>Escape:</b> Return to Thumbnail Browser<br/><br/>"
"<b><hilight>Slideshow Bindings</hilight></b><br/>" "<b><hilight>Slideshow Bindings</hilight></b><br/>"
"<b>Space:</b> Play/Pause Slideshow<br/>" "<b>Space:</b> Play/Pause Slideshow<br/>"
"<b>Home:</b> Navigate First<br/>" "<b>Home:</b> Navigate First<br/>"
"<b>Left Arrow:</b> Navigate Previous<br/>" "<b>Left Arrow:</b> Navigate Previous<br/>"
"<b>Right Arrow:</b> Navigate Next<br/>" "<b>Right Arrow:</b> Navigate Next<br/>"
"<b>End:</b> Navigate Last<br/>" "<b>End:</b> Navigate Last<br/>"
"<b>Escape:</b> Quit Slideshow<br/>")); "<b>Escape:</b> Quit Slideshow<br/>"));
elm_object_text_set(entry, eina_strbuf_string_get(sbuf)); elm_object_text_set(entry, eina_strbuf_string_get(sbuf));
elm_object_content_set(scroller, entry); elm_object_content_set(scroller, entry);
evas_object_show(entry); evas_object_show(entry);
@ -523,63 +522,63 @@ _config_about(Evas_Object *parent)
EPHOTO_WEIGHT(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); EPHOTO_WEIGHT(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
EPHOTO_FILL(entry); EPHOTO_FILL(entry);
eina_strbuf_append_printf(sbuf, eina_strbuf_append_printf(sbuf,
_("Ephoto is a comprehensive image viewer based on the EFL. For more" _("Ephoto is a comprehensive image viewer based on the EFL. For more"
"information, please visit the Ephoto project page:<br/>" "information, please visit the Ephoto project page:<br/>"
"<a href=http://www.smhouston.us/ephoto/>" "<a href=http://www.smhouston.us/ephoto/>"
"http://www.smhouston.us/ephoto/</a><br/><br/>" "http://www.smhouston.us/ephoto/</a><br/><br/>"
"Ephoto also has a page on the Enlightenment wiki:<br/>" "Ephoto also has a page on the Enlightenment wiki:<br/>"
"<a href=https://phab.enlightenment.org/w/projects/ephoto>" "<a href=https://phab.enlightenment.org/w/projects/ephoto>"
"https://phab.enlightenment.org/w/projects/ephoto</a><br/><br/>" "https://phab.enlightenment.org/w/projects/ephoto</a><br/><br/>"
"Ephoto's source can be found through Enlightenment's git:<br/>" "Ephoto's source can be found through Enlightenment's git:<br/>"
"<a href=http://git.enlightenment.org/apps/ephoto.git>" "<a href=http://git.enlightenment.org/apps/ephoto.git>"
"http://git.enlightenment.org/apps/ephoto.git</a><br/><br/>" "http://git.enlightenment.org/apps/ephoto.git</a><br/><br/>"
"<b>Authors:</b><br/>")); "<b>Authors:</b><br/>"));
f = fopen(PACKAGE_DATA_DIR "/AUTHORS", "r"); f = fopen(PACKAGE_DATA_DIR "/AUTHORS", "r");
if (f) if (f)
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
while (fgets(buf, sizeof(buf), f)) while (fgets(buf, sizeof(buf), f))
{ {
int len; int len;
len = strlen(buf); len = strlen(buf);
if (len > 0) if (len > 0)
{ {
if (buf[len - 1] == '\n') if (buf[len - 1] == '\n')
{ {
buf[len - 1] = 0; buf[len - 1] = 0;
len--; len--;
} }
if (len > 0) if (len > 0)
{ {
char *p; char *p;
do do
{ {
p = strchr(buf, '<'); p = strchr(buf, '<');
if (p) if (p)
*p = 0; *p = 0;
} }
while (p); while (p);
do do
{ {
p = strchr(buf, '>'); p = strchr(buf, '>');
if (p) if (p)
*p = 0; *p = 0;
} }
while (p); while (p);
eina_strbuf_append_printf(sbuf, "%s<br/>", buf); eina_strbuf_append_printf(sbuf, "%s<br/>", buf);
} }
if (len == 0) if (len == 0)
eina_strbuf_append_printf(sbuf, "<br/>"); eina_strbuf_append_printf(sbuf, "<br/>");
} }
} }
fclose(f); fclose(f);
} }
elm_object_text_set(entry, eina_strbuf_string_get(sbuf)); elm_object_text_set(entry, eina_strbuf_string_get(sbuf));
evas_object_smart_callback_add(entry, "anchor,hover,opened", evas_object_smart_callback_add(entry, "anchor,hover,opened",
_link_anchor, entry); _link_anchor, entry);
elm_box_pack_end(box, entry); elm_box_pack_end(box, entry);
evas_object_show(entry); evas_object_show(entry);
@ -616,9 +615,9 @@ _ephoto_config_load(Ephoto *ephoto)
ef = eet_open(buf, EET_FILE_MODE_READ); ef = eet_open(buf, EET_FILE_MODE_READ);
if (!ef) if (!ef)
{ {
ephoto_config_free(ephoto); ephoto_config_free(ephoto);
ephoto->config = calloc(1, sizeof(Ephoto_Config)); ephoto->config = calloc(1, sizeof(Ephoto_Config));
return 0; return 0;
} }
ephoto->config = eet_data_read(ef, edd, "config"); ephoto->config = eet_data_read(ef, edd, "config");
@ -626,17 +625,17 @@ _ephoto_config_load(Ephoto *ephoto)
if (!ephoto->config || ephoto->config->config_version > CONFIG_VERSION) if (!ephoto->config || ephoto->config->config_version > CONFIG_VERSION)
{ {
ephoto_config_free(ephoto); ephoto_config_free(ephoto);
ephoto->config = calloc(1, sizeof(Ephoto_Config)); ephoto->config = calloc(1, sizeof(Ephoto_Config));
return 0; return 0;
} }
if (ephoto->config->config_version < CONFIG_VERSION) if (ephoto->config->config_version < CONFIG_VERSION)
{ {
ecore_file_unlink(buf); ecore_file_unlink(buf);
ephoto_config_free(ephoto); ephoto_config_free(ephoto);
ephoto->config = calloc(1, sizeof(Ephoto_Config)); ephoto->config = calloc(1, sizeof(Ephoto_Config));
return 0; return 0;
} }
return 1; return 1;
} }
@ -653,16 +652,16 @@ _ephoto_on_config_save(void *data)
ef = eet_open(buf2, EET_FILE_MODE_WRITE); ef = eet_open(buf2, EET_FILE_MODE_WRITE);
if (!ef) if (!ef)
goto save_end; goto save_end;
eet_data_write(ef, edd, "config", ephoto->config, 1); eet_data_write(ef, edd, "config", ephoto->config, 1);
if (eet_close(ef)) if (eet_close(ef))
goto save_end; goto save_end;
if (!ecore_file_mv(buf2, buf)) if (!ecore_file_mv(buf2, buf))
goto save_end; goto save_end;
save_end: save_end:
ecore_file_unlink(buf2); ecore_file_unlink(buf2);
return ECORE_CALLBACK_CANCEL; return ECORE_CALLBACK_CANCEL;
@ -713,28 +712,28 @@ ephoto_config_main(Ephoto *ephoto)
elm_icon_standard_set(ic, "preferences-system"); elm_icon_standard_set(ic, "preferences-system");
evas_object_show(ic); evas_object_show(ic);
settingsi = elm_list_item_append(list, _("General"), ic, NULL, settingsi = elm_list_item_append(list, _("General"), ic, NULL,
_list_clicked, settings); _list_clicked, settings);
ic = elm_icon_add(list); ic = elm_icon_add(list);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
elm_icon_standard_set(ic, "media-playback-start"); elm_icon_standard_set(ic, "media-playback-start");
evas_object_show(ic); evas_object_show(ic);
slideshowi = elm_list_item_append(list, _("Slideshow"), ic, NULL, slideshowi = elm_list_item_append(list, _("Slideshow"), ic, NULL,
_list_clicked, slideshow); _list_clicked, slideshow);
ic = elm_icon_add(list); ic = elm_icon_add(list);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
elm_icon_standard_set(ic, "input-keyboard"); elm_icon_standard_set(ic, "input-keyboard");
evas_object_show(ic); evas_object_show(ic);
kbi = elm_list_item_append(list, _("Bindings"), ic, NULL, kbi = elm_list_item_append(list, _("Bindings"), ic, NULL,
_list_clicked, kb); _list_clicked, kb);
ic = elm_icon_add(list); ic = elm_icon_add(list);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
elm_icon_standard_set(ic, "help-about"); elm_icon_standard_set(ic, "help-about");
evas_object_show(ic); evas_object_show(ic);
abouti = elm_list_item_append(list, _("About"), ic, NULL, abouti = elm_list_item_append(list, _("About"), ic, NULL,
_list_clicked, about); _list_clicked, about);
elm_list_go(list); elm_list_go(list);
@ -776,13 +775,13 @@ ephoto_config_init(Ephoto *ephoto)
Eet_Data_Descriptor_Class eddc; Eet_Data_Descriptor_Class eddc;
if (!eet_eina_stream_data_descriptor_class_set(&eddc, sizeof(eddc), if (!eet_eina_stream_data_descriptor_class_set(&eddc, sizeof(eddc),
"Ephoto_Config", sizeof(Ephoto_Config))) "Ephoto_Config", sizeof(Ephoto_Config)))
{ {
return EINA_FALSE; return EINA_FALSE;
} }
if (!edd) if (!edd)
edd = eet_data_descriptor_stream_new(&eddc); edd = eet_data_descriptor_stream_new(&eddc);
#undef T #undef T
#undef D #undef D
@ -812,28 +811,28 @@ ephoto_config_init(Ephoto *ephoto)
C_VAL(D, T, thumbnail_aspect, EET_T_INT); C_VAL(D, T, thumbnail_aspect, EET_T_INT);
switch (_ephoto_config_load(ephoto)) switch (_ephoto_config_load(ephoto))
{ {
case 0: case 0:
/* Start a new config */ /* Start a new config */
ephoto->config->config_version = CONFIG_VERSION; ephoto->config->config_version = CONFIG_VERSION;
ephoto->config->slideshow_timeout = 4.0; ephoto->config->slideshow_timeout = 4.0;
ephoto->config->slideshow_transition = eina_stringshare_add("fade"); ephoto->config->slideshow_transition = eina_stringshare_add("fade");
ephoto->config->window_width = 900*elm_config_scale_get(); ephoto->config->window_width = 900 * elm_config_scale_get();
ephoto->config->window_height = 500*elm_config_scale_get(); ephoto->config->window_height = 500 * elm_config_scale_get();
ephoto->config->fsel_hide = 0; ephoto->config->fsel_hide = 0;
ephoto->config->left_size = .25; ephoto->config->left_size = .25;
ephoto->config->right_size = .25; ephoto->config->right_size = .25;
ephoto->config->open = eina_stringshare_add(eina_environment_home_get()); ephoto->config->open = eina_stringshare_add(eina_environment_home_get());
ephoto->config->prompts = 1; ephoto->config->prompts = 1;
ephoto->config->drop = 0; ephoto->config->drop = 0;
ephoto->config->movess = 1; ephoto->config->movess = 1;
ephoto->config->smooth = 1; ephoto->config->smooth = 1;
ephoto->config->firstrun = 1; ephoto->config->firstrun = 1;
ephoto->config->folders = 1; ephoto->config->folders = 1;
ephoto->config->thumbnail_aspect = 0; ephoto->config->thumbnail_aspect = 0;
break; break;
default: default:
return EINA_TRUE; return EINA_TRUE;
} }
ephoto_config_save(ephoto); ephoto_config_save(ephoto);

View File

@ -13,17 +13,17 @@ struct _Ephoto_Cropper
Evas_Object *layout; Evas_Object *layout;
Evas_Object *cropw; Evas_Object *cropw;
Evas_Object *croph; Evas_Object *croph;
Eina_List *handlers; Eina_List *handlers;
Evas_Coord startx; Evas_Coord startx;
Evas_Coord starty; Evas_Coord starty;
Evas_Coord offsetx; Evas_Coord offsetx;
Evas_Coord offsety; Evas_Coord offsety;
Eina_Bool resizing; Eina_Bool resizing;
}; };
static void static void
_calculate_cropper_size(void *data, Evas_Object *obj EINA_UNUSED, _calculate_cropper_size(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source EINA_UNUSED) const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Edje_Message_Int_Set *msg; Edje_Message_Int_Set *msg;
@ -31,13 +31,13 @@ _calculate_cropper_size(void *data, Evas_Object *obj EINA_UNUSED,
double scalew, scaleh; double scalew, scaleh;
edje_object_part_geometry_get(elm_layout_edje_get(ec->layout), edje_object_part_geometry_get(elm_layout_edje_get(ec->layout),
"ephoto.swallow.image", 0, 0, &w, &h); "ephoto.swallow.image", 0, 0, &w, &h);
edje_object_part_geometry_get(elm_layout_edje_get(ec->layout), edje_object_part_geometry_get(elm_layout_edje_get(ec->layout),
"ephoto.swallow.cropper", 0, 0, &cw, &ch); "ephoto.swallow.cropper", 0, 0, &cw, &ch);
evas_object_image_size_get(ec->image, &iw, &ih); evas_object_image_size_get(ec->image, &iw, &ih);
scalew = (double) cw / (double) w; scalew = (double)cw / (double)w;
scaleh = (double) ch / (double) h; scaleh = (double)ch / (double)h;
nw = iw * scalew; nw = iw * scalew;
nh = ih * scaleh; nh = ih * scaleh;
@ -51,12 +51,12 @@ _calculate_cropper_size(void *data, Evas_Object *obj EINA_UNUSED,
msg->val[1] = nw; msg->val[1] = nw;
msg->val[2] = nh; msg->val[2] = nh;
edje_object_message_send(elm_layout_edje_get(ec->layout), edje_object_message_send(elm_layout_edje_get(ec->layout),
EDJE_MESSAGE_INT_SET, 1, msg); EDJE_MESSAGE_INT_SET, 1, msg);
} }
static void static void
_cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED, _cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Edje_Message_Int_Set *msgl, *msgr; Edje_Message_Int_Set *msgl, *msgr;
@ -66,11 +66,11 @@ _cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED,
mw = elm_slider_value_get(ec->cropw); mw = elm_slider_value_get(ec->cropw);
edje_object_part_geometry_get(elm_layout_edje_get(ec->layout), edje_object_part_geometry_get(elm_layout_edje_get(ec->layout),
"ephoto.swallow.image", &lx, 0, &lw, 0); "ephoto.swallow.image", &lx, 0, &lw, 0);
edje_object_part_geometry_get(elm_layout_edje_get(ec->layout), edje_object_part_geometry_get(elm_layout_edje_get(ec->layout),
"ephoto.swallow.cropper", &cx, 0, &cw, 0); "ephoto.swallow.cropper", &cx, 0, &cw, 0);
evas_object_image_size_get(ec->image, &iw, 0); evas_object_image_size_get(ec->image, &iw, 0);
scalew = (double) mw / (double) iw; scalew = (double)mw / (double)iw;
nw = lw * scalew; nw = lw * scalew;
left = (nw - cw) / 2; left = (nw - cw) / 2;
@ -78,13 +78,13 @@ _cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED,
if ((cx + cw + right) >= (lx + lw)) if ((cx + cw + right) >= (lx + lw))
{ {
right = (lx + lw) - (cx + cw); right = (lx + lw) - (cx + cw);
left += left - right; left += left - right;
} }
else if ((cx - left) <= lx) else if ((cx - left) <= lx)
{ {
left = cx - lx; left = cx - lx;
right += right - left; right += right - left;
} }
left *= -1; left *= -1;
@ -94,7 +94,7 @@ _cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED,
msgl->val[1] = left; msgl->val[1] = left;
msgl->val[2] = 0; msgl->val[2] = 0;
edje_object_message_send(elm_layout_edje_get(ec->layout), edje_object_message_send(elm_layout_edje_get(ec->layout),
EDJE_MESSAGE_INT_SET, 1, msgl); EDJE_MESSAGE_INT_SET, 1, msgl);
msgr = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); msgr = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int)));
msgr->count = 3; msgr->count = 3;
@ -102,12 +102,12 @@ _cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED,
msgr->val[1] = right; msgr->val[1] = right;
msgr->val[2] = 0; msgr->val[2] = 0;
edje_object_message_send(elm_layout_edje_get(ec->layout), edje_object_message_send(elm_layout_edje_get(ec->layout),
EDJE_MESSAGE_INT_SET, 1, msgr); EDJE_MESSAGE_INT_SET, 1, msgr);
} }
static void static void
_cropper_changed_height(void *data, Evas_Object *obj EINA_UNUSED, _cropper_changed_height(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Edje_Message_Int_Set *msgt, *msgb; Edje_Message_Int_Set *msgt, *msgb;
@ -117,25 +117,25 @@ _cropper_changed_height(void *data, Evas_Object *obj EINA_UNUSED,
mh = elm_slider_value_get(ec->croph); mh = elm_slider_value_get(ec->croph);
edje_object_part_geometry_get(elm_layout_edje_get(ec->layout), edje_object_part_geometry_get(elm_layout_edje_get(ec->layout),
"ephoto.swallow.image", 0, &ly, 0, &lh); "ephoto.swallow.image", 0, &ly, 0, &lh);
edje_object_part_geometry_get(elm_layout_edje_get(ec->layout), edje_object_part_geometry_get(elm_layout_edje_get(ec->layout),
"ephoto.swallow.cropper", 0, &cy, 0, &ch); "ephoto.swallow.cropper", 0, &cy, 0, &ch);
evas_object_image_size_get(ec->image, 0, &ih); evas_object_image_size_get(ec->image, 0, &ih);
scaleh = (double) mh / (double) ih; scaleh = (double)mh / (double)ih;
nh = lh * scaleh; nh = lh * scaleh;
top = (nh - ch) / 2; top = (nh - ch) / 2;
bottom = (nh - ch) / 2; bottom = (nh - ch) / 2;
if ((cy + ch + bottom) >= (ly + lh)) if ((cy + ch + bottom) >= (ly + lh))
{ {
bottom = (ly + lh) - (cy + ch); bottom = (ly + lh) - (cy + ch);
top += top - bottom; top += top - bottom;
} }
else if ((cy - top) <= ly) else if ((cy - top) <= ly)
{ {
top = cy - ly; top = cy - ly;
bottom += bottom - top; bottom += bottom - top;
} }
top *= -1; top *= -1;
@ -145,7 +145,7 @@ _cropper_changed_height(void *data, Evas_Object *obj EINA_UNUSED,
msgt->val[1] = 0; msgt->val[1] = 0;
msgt->val[2] = top; msgt->val[2] = top;
edje_object_message_send(elm_layout_edje_get(ec->layout), edje_object_message_send(elm_layout_edje_get(ec->layout),
EDJE_MESSAGE_INT_SET, 1, msgt); EDJE_MESSAGE_INT_SET, 1, msgt);
msgb = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); msgb = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int)));
msgb->count = 3; msgb->count = 3;
@ -153,12 +153,12 @@ _cropper_changed_height(void *data, Evas_Object *obj EINA_UNUSED,
msgb->val[1] = 0; msgb->val[1] = 0;
msgb->val[2] = bottom; msgb->val[2] = bottom;
edje_object_message_send(elm_layout_edje_get(ec->layout), edje_object_message_send(elm_layout_edje_get(ec->layout),
EDJE_MESSAGE_INT_SET, 1, msgb); EDJE_MESSAGE_INT_SET, 1, msgb);
} }
static void static void
_reset_crop(void *data, Evas_Object *obj EINA_UNUSED, _reset_crop(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Edje_Message_Int_Set *msg; Edje_Message_Int_Set *msg;
@ -169,12 +169,12 @@ _reset_crop(void *data, Evas_Object *obj EINA_UNUSED,
msg->val[1] = 0; msg->val[1] = 0;
msg->val[2] = 0; msg->val[2] = 0;
edje_object_message_send(elm_layout_edje_get(ec->layout), edje_object_message_send(elm_layout_edje_get(ec->layout),
EDJE_MESSAGE_INT_SET, 1, msg); EDJE_MESSAGE_INT_SET, 1, msg);
} }
static void static void
_apply_crop(void *data, Evas_Object *obj EINA_UNUSED, _apply_crop(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Evas_Object *edje = elm_layout_edje_get(ec->layout); Evas_Object *edje = elm_layout_edje_get(ec->layout);
@ -186,16 +186,16 @@ _apply_crop(void *data, Evas_Object *obj EINA_UNUSED,
edje_object_part_geometry_get(edje, "ephoto.swallow.image", &x, &y, &w, &h); edje_object_part_geometry_get(edje, "ephoto.swallow.image", &x, &y, &w, &h);
edje_object_part_geometry_get(edje, "ephoto.swallow.cropper", &cx, &cy, &cw, edje_object_part_geometry_get(edje, "ephoto.swallow.cropper", &cx, &cy, &cw,
&ch); &ch);
evas_object_image_size_get(ec->image, &iw, &ih); evas_object_image_size_get(ec->image, &iw, &ih);
idata = idata =
evas_object_image_data_get(ec->image, EINA_FALSE); evas_object_image_data_get(ec->image, EINA_FALSE);
scalex = (double) (cx-x) / (double) w; scalex = (double)(cx - x) / (double)w;
scaley = (double) (cy-y) / (double) h; scaley = (double)(cy - y) / (double)h;
scalew = (double) cw / (double) w; scalew = (double)cw / (double)w;
scaleh = (double) ch / (double) h; scaleh = (double)ch / (double)h;
nx = iw * scalex; nx = iw * scalex;
ny = ih * scaley; ny = ih * scaley;
@ -207,20 +207,20 @@ _apply_crop(void *data, Evas_Object *obj EINA_UNUSED,
for (i = 0; i < nh; i++) for (i = 0; i < nh; i++)
{ {
tmpy = (i + ny) * iw; tmpy = (i + ny) * iw;
for (j = 0; j < nw; j++) for (j = 0; j < nw; j++)
{ {
tmpx = j + nx; tmpx = j + nx;
ind = tmpy + tmpx; ind = tmpy + tmpx;
idata_new[index] = idata[ind]; idata_new[index] = idata[ind];
index++; index++;
} }
} }
elm_table_unpack(ec->image_parent, ec->box); elm_table_unpack(ec->image_parent, ec->box);
elm_layout_content_unset(ec->layout, "ephoto.swallow.image"); elm_layout_content_unset(ec->layout, "ephoto.swallow.image");
elm_table_pack(ec->image_parent, ec->image, 0, 0, 1, 1); elm_table_pack(ec->image_parent, ec->image, 0, 0, 1, 1);
ephoto_single_browser_image_data_done(ec->main, ephoto_single_browser_image_data_done(ec->main,
idata_new, nw, nh); idata_new, nw, nh);
evas_object_del(ec->cropper); evas_object_del(ec->cropper);
evas_object_del(ec->layout); evas_object_del(ec->layout);
evas_object_del(ec->box); evas_object_del(ec->box);
@ -229,7 +229,7 @@ _apply_crop(void *data, Evas_Object *obj EINA_UNUSED,
static void static void
_cancel_crop(void *data, Evas_Object *obj EINA_UNUSED, _cancel_crop(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
@ -245,7 +245,7 @@ _cancel_crop(void *data, Evas_Object *obj EINA_UNUSED,
static void static void
_cropper_both_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, _cropper_both_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source) const char *emission EINA_UNUSED, const char *source)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Edje_Message_Int_Set *msg; Edje_Message_Int_Set *msg;
@ -256,13 +256,13 @@ _cropper_both_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
evas_object_geometry_get(ec->layout, &lx, &ly, &lw, &lh); evas_object_geometry_get(ec->layout, &lx, &ly, &lw, &lh);
if (mx < lx) if (mx < lx)
mx = lx; mx = lx;
else if (mx > lx + lw) else if (mx > lx + lw)
mx = lx + lw; mx = lx + lw;
if (my < ly) if (my < ly)
my = ly; my = ly;
else if (my > ly + lh) else if (my > ly + lh)
my = ly + lh; my = ly + lh;
nx = mx - ec->startx; nx = mx - ec->startx;
ny = my - ec->starty; ny = my - ec->starty;
@ -272,36 +272,36 @@ _cropper_both_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int)));
msg->count = 3; msg->count = 3;
if (!strcmp(source, "handle1")) if (!strcmp(source, "handle1"))
msg->val[0] = 1; msg->val[0] = 1;
else if (!strcmp(source, "handle3")) else if (!strcmp(source, "handle3"))
msg->val[0] = 3; msg->val[0] = 3;
else if (!strcmp(source, "handle5")) else if (!strcmp(source, "handle5"))
msg->val[0] = 5; msg->val[0] = 5;
else if (!strcmp(source, "handle7")) else if (!strcmp(source, "handle7"))
msg->val[0] = 7; msg->val[0] = 7;
msg->val[1] = nx; msg->val[1] = nx;
msg->val[2] = ny; msg->val[2] = ny;
edje_object_message_send(elm_layout_edje_get(ec->layout), edje_object_message_send(elm_layout_edje_get(ec->layout),
EDJE_MESSAGE_INT_SET, 1, msg); EDJE_MESSAGE_INT_SET, 1, msg);
} }
static void static void
_cropper_both_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, _cropper_both_mouse_up(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source) const char *emission EINA_UNUSED, const char *source)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source, edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source,
_cropper_both_mouse_move, ec); _cropper_both_mouse_move, ec);
edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source, edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source,
_cropper_both_mouse_up, ec); _cropper_both_mouse_up, ec);
ec->resizing = 0; ec->resizing = 0;
} }
static void static void
_cropper_resize_both(void *data, Evas_Object *obj EINA_UNUSED, _cropper_resize_both(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source) const char *emission EINA_UNUSED, const char *source)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Evas_Coord mx, my, cx, cy; Evas_Coord mx, my, cx, cy;
@ -315,14 +315,14 @@ _cropper_resize_both(void *data, Evas_Object *obj EINA_UNUSED,
ec->starty = my; ec->starty = my;
edje_object_signal_callback_add(ec->cropper, "mouse,move", source, edje_object_signal_callback_add(ec->cropper, "mouse,move", source,
_cropper_both_mouse_move, ec); _cropper_both_mouse_move, ec);
edje_object_signal_callback_add(ec->cropper, "mouse,up,1", source, edje_object_signal_callback_add(ec->cropper, "mouse,up,1", source,
_cropper_both_mouse_up, ec); _cropper_both_mouse_up, ec);
} }
static void static void
_cropper_horiz_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, _cropper_horiz_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source) const char *emission EINA_UNUSED, const char *source)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Edje_Message_Int_Set *msg; Edje_Message_Int_Set *msg;
@ -333,9 +333,9 @@ _cropper_horiz_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
evas_object_geometry_get(ec->layout, &lx, 0, &lw, 0); evas_object_geometry_get(ec->layout, &lx, 0, &lw, 0);
if (mx < lx) if (mx < lx)
mx = lx; mx = lx;
else if (mx > lx + lw) else if (mx > lx + lw)
mx = lx + lw; mx = lx + lw;
nx = mx - ec->startx; nx = mx - ec->startx;
ec->startx = mx; ec->startx = mx;
@ -343,31 +343,31 @@ _cropper_horiz_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int)));
msg->count = 3; msg->count = 3;
if (!strcmp(source, "handle4")) if (!strcmp(source, "handle4"))
msg->val[0] = 4; msg->val[0] = 4;
else if (!strcmp(source, "handle8")) else if (!strcmp(source, "handle8"))
msg->val[0] = 8; msg->val[0] = 8;
msg->val[1] = nx; msg->val[1] = nx;
msg->val[2] = 0; msg->val[2] = 0;
edje_object_message_send(elm_layout_edje_get(ec->layout), edje_object_message_send(elm_layout_edje_get(ec->layout),
EDJE_MESSAGE_INT_SET, 1, msg); EDJE_MESSAGE_INT_SET, 1, msg);
} }
static void static void
_cropper_horiz_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, _cropper_horiz_mouse_up(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source) const char *emission EINA_UNUSED, const char *source)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source, edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source,
_cropper_horiz_mouse_move, ec); _cropper_horiz_mouse_move, ec);
edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source, edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source,
_cropper_horiz_mouse_up, ec); _cropper_horiz_mouse_up, ec);
ec->resizing = 0; ec->resizing = 0;
} }
static void static void
_cropper_resize_horiz(void *data, Evas_Object *obj EINA_UNUSED, _cropper_resize_horiz(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source EINA_UNUSED) const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Evas_Coord mx, my, cx, cy; Evas_Coord mx, my, cx, cy;
@ -381,14 +381,14 @@ _cropper_resize_horiz(void *data, Evas_Object *obj EINA_UNUSED,
ec->starty = my; ec->starty = my;
edje_object_signal_callback_add(ec->cropper, "mouse,move", source, edje_object_signal_callback_add(ec->cropper, "mouse,move", source,
_cropper_horiz_mouse_move, ec); _cropper_horiz_mouse_move, ec);
edje_object_signal_callback_add(ec->cropper, "mouse,up,1", source, edje_object_signal_callback_add(ec->cropper, "mouse,up,1", source,
_cropper_horiz_mouse_up, ec); _cropper_horiz_mouse_up, ec);
} }
static void static void
_cropper_vert_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, _cropper_vert_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source) const char *emission EINA_UNUSED, const char *source)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Edje_Message_Int_Set *msg; Edje_Message_Int_Set *msg;
@ -399,9 +399,9 @@ _cropper_vert_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
evas_object_geometry_get(ec->layout, 0, &ly, 0, &lh); evas_object_geometry_get(ec->layout, 0, &ly, 0, &lh);
if (my < ly) if (my < ly)
my = ly; my = ly;
else if (my > ly + lh) else if (my > ly + lh)
my = ly + lh; my = ly + lh;
ny = my - ec->starty; ny = my - ec->starty;
ec->starty = my; ec->starty = my;
@ -409,31 +409,31 @@ _cropper_vert_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int)));
msg->count = 3; msg->count = 3;
if (!strcmp(source, "handle2")) if (!strcmp(source, "handle2"))
msg->val[0] = 2; msg->val[0] = 2;
else if (!strcmp(source, "handle6")) else if (!strcmp(source, "handle6"))
msg->val[0] = 6; msg->val[0] = 6;
msg->val[1] = 0; msg->val[1] = 0;
msg->val[2] = ny; msg->val[2] = ny;
edje_object_message_send(elm_layout_edje_get(ec->layout), edje_object_message_send(elm_layout_edje_get(ec->layout),
EDJE_MESSAGE_INT_SET, 1, msg); EDJE_MESSAGE_INT_SET, 1, msg);
} }
static void static void
_cropper_vert_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, _cropper_vert_mouse_up(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source) const char *emission EINA_UNUSED, const char *source)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source, edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source,
_cropper_vert_mouse_move, ec); _cropper_vert_mouse_move, ec);
edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source, edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source,
_cropper_vert_mouse_up, ec); _cropper_vert_mouse_up, ec);
ec->resizing = 0; ec->resizing = 0;
} }
static void static void
_cropper_resize_vert(void *data, Evas_Object *obj EINA_UNUSED, _cropper_resize_vert(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source EINA_UNUSED) const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Evas_Coord mx, my, cx, cy; Evas_Coord mx, my, cx, cy;
@ -447,66 +447,66 @@ _cropper_resize_vert(void *data, Evas_Object *obj EINA_UNUSED,
ec->starty = my; ec->starty = my;
edje_object_signal_callback_add(ec->cropper, "mouse,move", source, edje_object_signal_callback_add(ec->cropper, "mouse,move", source,
_cropper_vert_mouse_move, ec); _cropper_vert_mouse_move, ec);
edje_object_signal_callback_add(ec->cropper, "mouse,up,1", source, edje_object_signal_callback_add(ec->cropper, "mouse,up,1", source,
_cropper_vert_mouse_up, ec); _cropper_vert_mouse_up, ec);
} }
static void static void
_cropper_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, _cropper_mouse_move(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source EINA_UNUSED) const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
if (!ec->resizing) if (!ec->resizing)
{ {
Edje_Message_Int_Set *msg; Edje_Message_Int_Set *msg;
Evas_Coord mx, my, cx, cy, cw, ch, nx, ny, lx, ly, lw, lh; Evas_Coord mx, my, cx, cy, cw, ch, nx, ny, lx, ly, lw, lh;
evas_pointer_canvas_xy_get(evas_object_evas_get(ec->cropper), evas_pointer_canvas_xy_get(evas_object_evas_get(ec->cropper),
&mx, &my); &mx, &my);
evas_object_geometry_get(ec->cropper, &cx, &cy, &cw, &ch); evas_object_geometry_get(ec->cropper, &cx, &cy, &cw, &ch);
evas_object_geometry_get(ec->layout, &lx, &ly, &lw, &lh); evas_object_geometry_get(ec->layout, &lx, &ly, &lw, &lh);
if (mx < lx) if (mx < lx)
mx = lx; mx = lx;
else if (mx > lx + lw) else if (mx > lx + lw)
mx = lx + lw; mx = lx + lw;
if (my < ly) if (my < ly)
my = ly; my = ly;
else if (my > ly + lh) else if (my > ly + lh)
my = ly + lh; my = ly + lh;
nx = mx - ec->startx; nx = mx - ec->startx;
ny = my - ec->starty; ny = my - ec->starty;
ec->startx = mx; ec->startx = mx;
ec->starty = my; ec->starty = my;
msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int)));
msg->count = 3; msg->count = 3;
msg->val[0] = 0; msg->val[0] = 0;
msg->val[1] = nx; msg->val[1] = nx;
msg->val[2] = ny; msg->val[2] = ny;
edje_object_message_send(elm_layout_edje_get(ec->layout), edje_object_message_send(elm_layout_edje_get(ec->layout),
EDJE_MESSAGE_INT_SET, 1, msg); EDJE_MESSAGE_INT_SET, 1, msg);
} }
} }
static void static void
_cropper_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, _cropper_mouse_up(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source EINA_UNUSED) const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
edje_object_signal_callback_del_full(ec->cropper, "mouse,move", "dragger", edje_object_signal_callback_del_full(ec->cropper, "mouse,move", "dragger",
_cropper_mouse_move, ec); _cropper_mouse_move, ec);
edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", "dragger", edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", "dragger",
_cropper_mouse_up, ec); _cropper_mouse_up, ec);
} }
static void static void
_cropper_move(void *data, Evas_Object *obj EINA_UNUSED, _cropper_move(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source EINA_UNUSED) const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Evas_Coord mx, my, cx, cy; Evas_Coord mx, my, cx, cy;
@ -519,14 +519,14 @@ _cropper_move(void *data, Evas_Object *obj EINA_UNUSED,
ec->offsety = my - cy; ec->offsety = my - cy;
edje_object_signal_callback_add(ec->cropper, "mouse,move", "dragger", edje_object_signal_callback_add(ec->cropper, "mouse,move", "dragger",
_cropper_mouse_move, ec); _cropper_mouse_move, ec);
edje_object_signal_callback_add(ec->cropper, "mouse,up,1", "dragger", edje_object_signal_callback_add(ec->cropper, "mouse,up,1", "dragger",
_cropper_mouse_up, ec); _cropper_mouse_up, ec);
} }
static void static void
_image_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _image_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Edje_Message_Int_Set *msg; Edje_Message_Int_Set *msg;
@ -540,31 +540,31 @@ _image_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
if (sw > sh) if (sw > sh)
{ {
nw = sw; nw = sw;
nh = ih * ((double) sw / (double) iw); nh = ih * ((double)sw / (double)iw);
if (nh > sh) if (nh > sh)
{ {
Evas_Coord onw, onh; Evas_Coord onw, onh;
onw = nw; onw = nw;
onh = nh; onh = nh;
nh = sh; nh = sh;
nw = onw * ((double) nh / (double) onh); nw = onw * ((double)nh / (double)onh);
} }
} }
else else
{ {
nh = sh; nh = sh;
nw = iw * ((double) sh / (double) ih); nw = iw * ((double)sh / (double)ih);
if (nw > sw) if (nw > sw)
{ {
Evas_Coord onw, onh; Evas_Coord onw, onh;
onw = nw; onw = nw;
onh = nh; onh = nh;
nw = sw; nw = sw;
nh = onh * ((double) nw / (double) onw); nh = onh * ((double)nw / (double)onw);
} }
} }
diffw = sw - nw; diffw = sw - nw;
diffh = sh - nh; diffh = sh - nh;
@ -582,12 +582,12 @@ _image_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
msg->val[1] = 0; msg->val[1] = 0;
msg->val[2] = 0; msg->val[2] = 0;
edje_object_message_send(elm_layout_edje_get(ec->layout), edje_object_message_send(elm_layout_edje_get(ec->layout),
EDJE_MESSAGE_INT_SET, 1, msg); EDJE_MESSAGE_INT_SET, 1, msg);
} }
static Eina_Bool static Eina_Bool
_crop_reset(void *data, int type EINA_UNUSED, _crop_reset(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
_reset_crop(data, NULL, NULL); _reset_crop(data, NULL, NULL);
@ -596,7 +596,7 @@ _crop_reset(void *data, int type EINA_UNUSED,
static Eina_Bool static Eina_Bool
_crop_apply(void *data, int type EINA_UNUSED, _crop_apply(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
_apply_crop(data, NULL, NULL); _apply_crop(data, NULL, NULL);
@ -605,7 +605,7 @@ _crop_apply(void *data, int type EINA_UNUSED,
static Eina_Bool static Eina_Bool
_crop_cancel(void *data, int type EINA_UNUSED, _crop_cancel(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
_cancel_crop(data, NULL, NULL); _cancel_crop(data, NULL, NULL);
@ -614,7 +614,7 @@ _crop_cancel(void *data, int type EINA_UNUSED,
static void static void
_editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Cropper *ec = data; Ephoto_Cropper *ec = data;
Ecore_Event_Handler *handler; Ecore_Event_Handler *handler;
@ -627,7 +627,7 @@ _editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void void
ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
Evas_Object *image_parent, Evas_Object *image) Evas_Object *image_parent, Evas_Object *image)
{ {
Ephoto_Cropper *ec; Ephoto_Cropper *ec;
Evas_Coord w, h; Evas_Coord w, h;
@ -655,7 +655,7 @@ ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
ec->layout = elm_layout_add(ec->box); ec->layout = elm_layout_add(ec->box);
elm_layout_file_set(ec->layout, PACKAGE_DATA_DIR "/themes/ephoto.edj", elm_layout_file_set(ec->layout, PACKAGE_DATA_DIR "/themes/ephoto.edj",
"ephoto,image,cropper,base"); "ephoto,image,cropper,base");
EPHOTO_EXPAND(ec->layout); EPHOTO_EXPAND(ec->layout);
EPHOTO_FILL(ec->layout); EPHOTO_FILL(ec->layout);
elm_box_pack_end(ec->box, ec->layout); elm_box_pack_end(ec->box, ec->layout);
@ -668,39 +668,39 @@ ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
ec->cropper = edje_object_add(evas_object_evas_get(ec->layout)); ec->cropper = edje_object_add(evas_object_evas_get(ec->layout));
edje_object_file_set(ec->cropper, PACKAGE_DATA_DIR "/themes/ephoto.edj", edje_object_file_set(ec->cropper, PACKAGE_DATA_DIR "/themes/ephoto.edj",
"ephoto,image,cropper"); "ephoto,image,cropper");
edje_object_signal_callback_add(elm_layout_edje_get(ec->layout), edje_object_signal_callback_add(elm_layout_edje_get(ec->layout),
"cropper,changed", "ephoto.swallow.cropper", _calculate_cropper_size, "cropper,changed", "ephoto.swallow.cropper", _calculate_cropper_size,
ec); ec);
elm_layout_content_set(ec->layout, "ephoto.swallow.cropper", ec->cropper); elm_layout_content_set(ec->layout, "ephoto.swallow.cropper", ec->cropper);
evas_object_show(ec->cropper); evas_object_show(ec->cropper);
edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "dragger", edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "dragger",
_cropper_move, ec); _cropper_move, ec);
edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle1", edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle1",
_cropper_resize_both, ec); _cropper_resize_both, ec);
edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle2", edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle2",
_cropper_resize_vert, ec); _cropper_resize_vert, ec);
edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle3", edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle3",
_cropper_resize_both, ec); _cropper_resize_both, ec);
edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle4", edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle4",
_cropper_resize_horiz, ec); _cropper_resize_horiz, ec);
edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle5", edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle5",
_cropper_resize_both, ec); _cropper_resize_both, ec);
edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle6", edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle6",
_cropper_resize_vert, ec); _cropper_resize_vert, ec);
edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle7", edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle7",
_cropper_resize_both, ec); _cropper_resize_both, ec);
edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle8", edje_object_signal_callback_add(ec->cropper, "mouse,down,1", "handle8",
_cropper_resize_horiz, ec); _cropper_resize_horiz, ec);
evas_object_event_callback_add(ec->layout, EVAS_CALLBACK_RESIZE, evas_object_event_callback_add(ec->layout, EVAS_CALLBACK_RESIZE,
_image_resize, ec); _image_resize, ec);
ec->editor = ephoto_editor_add(ephoto, parent, _("Crop Image"), ec->editor = ephoto_editor_add(ephoto, parent, _("Crop Image"),
"ec", ec); "ec", ec);
evas_object_event_callback_add(ec->editor, EVAS_CALLBACK_DEL, evas_object_event_callback_add(ec->editor, EVAS_CALLBACK_DEL,
_editor_del, ec); _editor_del, ec);
ec->croph = elm_slider_add(ec->editor); ec->croph = elm_slider_add(ec->editor);
elm_slider_min_max_set(ec->croph, 1, h); elm_slider_min_max_set(ec->croph, 1, h);
@ -712,7 +712,7 @@ ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
EPHOTO_ALIGN(ec->croph, EVAS_HINT_FILL, 0.5); EPHOTO_ALIGN(ec->croph, EVAS_HINT_FILL, 0.5);
elm_box_pack_start(ec->editor, ec->croph); elm_box_pack_start(ec->editor, ec->croph);
evas_object_smart_callback_add(ec->croph, "slider,drag,stop", evas_object_smart_callback_add(ec->croph, "slider,drag,stop",
_cropper_changed_height, ec); _cropper_changed_height, ec);
evas_object_show(ec->croph); evas_object_show(ec->croph);
ec->cropw = elm_slider_add(ec->editor); ec->cropw = elm_slider_add(ec->editor);
@ -725,24 +725,25 @@ ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
EPHOTO_ALIGN(ec->cropw, EVAS_HINT_FILL, 0.5); EPHOTO_ALIGN(ec->cropw, EVAS_HINT_FILL, 0.5);
elm_box_pack_start(ec->editor, ec->cropw); elm_box_pack_start(ec->editor, ec->cropw);
evas_object_smart_callback_add(ec->cropw, "slider,drag,stop", evas_object_smart_callback_add(ec->cropw, "slider,drag,stop",
_cropper_changed_width, ec); _cropper_changed_width, ec);
evas_object_show(ec->cropw); evas_object_show(ec->cropw);
ec->handlers = ec->handlers =
eina_list_append(ec->handlers, eina_list_append(ec->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET,
_crop_reset, ec)); _crop_reset, ec));
ec->handlers = ec->handlers =
eina_list_append(ec->handlers, eina_list_append(ec->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY,
_crop_apply, ec)); _crop_apply, ec));
ec->handlers = ec->handlers =
eina_list_append(ec->handlers, eina_list_append(ec->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL,
_crop_cancel, ec)); _crop_cancel, ec));
return; return;
error: error:
return; return;
} }

View File

@ -11,48 +11,48 @@ typedef struct _Ephoto_Directory_Browser Ephoto_Directory_Browser;
struct _Ephoto_Directory_Browser struct _Ephoto_Directory_Browser
{ {
Ephoto *ephoto; Ephoto *ephoto;
Evas_Object *main; Evas_Object *main;
Evas_Object *fsel; Evas_Object *fsel;
Evas_Object *fsel_back; Evas_Object *fsel_back;
Evas_Object *leftbox; Evas_Object *leftbox;
Elm_Object_Item *dir_current; Elm_Object_Item *dir_current;
Elm_Object_Item *last_sel; Elm_Object_Item *last_sel;
Eio_File *ls; Eio_File *ls;
Eina_Bool dirs_only; Eina_Bool dirs_only;
Eina_Bool thumbs_only; Eina_Bool thumbs_only;
Eio_Monitor *monitor; Eio_Monitor *monitor;
Eina_List *monitor_handlers; Eina_List *monitor_handlers;
Eina_List *handlers; Eina_List *handlers;
Eina_List *todo_items; Eina_List *todo_items;
Ecore_Job *change_dir_job; Ecore_Job *change_dir_job;
Ecore_Timer *click_timer; Ecore_Timer *click_timer;
Eina_Bool processing; Eina_Bool processing;
Eina_Bool initializing; Eina_Bool initializing;
struct struct
{ {
Ecore_Animator *todo_items; Ecore_Animator *todo_items;
int count; int count;
int processed; int processed;
} animator; } animator;
Eina_Bool main_deleted:1; Eina_Bool main_deleted : 1;
const char *back_directory; const char *back_directory;
}; };
static Elm_Genlist_Item_Class *_ephoto_dir_class; static Elm_Genlist_Item_Class *_ephoto_dir_class;
static Elm_Genlist_Item_Class *_ephoto_dir_tree_class; static Elm_Genlist_Item_Class *_ephoto_dir_tree_class;
static char * _drag_data_extract(char **drag_data); static char *_drag_data_extract(char **drag_data);
static Eina_Bool _monitor_cb(void *data, int type, static Eina_Bool _monitor_cb(void *data, int type,
void *event); void *event);
static void _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED, static void _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
Evas_Object *obj EINA_UNUSED, void *event_info); Evas_Object *obj EINA_UNUSED, void *event_info);
/*File Pane Callbacks*/ /*File Pane Callbacks*/
static void static void
_menu_dismissed_cb(void *data, Evas_Object *obj, _menu_dismissed_cb(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
@ -62,7 +62,7 @@ _menu_dismissed_cb(void *data, Evas_Object *obj,
static void static void
_menu_empty_cb(void *data, Evas_Object *obj EINA_UNUSED, _menu_empty_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
Eina_List *paths = NULL; Eina_List *paths = NULL;
@ -83,7 +83,7 @@ _menu_empty_cb(void *data, Evas_Object *obj EINA_UNUSED,
static Eina_Bool static Eina_Bool
_drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it, _drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it,
Elm_Selection_Data *ev, int xposret EINA_UNUSED, int yposret EINA_UNUSED) Elm_Selection_Data *ev, int xposret EINA_UNUSED, int yposret EINA_UNUSED)
{ {
if (!it) if (!it)
return EINA_FALSE; return EINA_FALSE;
@ -93,16 +93,16 @@ _drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it,
Ephoto_Directory_Browser *db = evas_object_data_get(obj, "directory_browser"); Ephoto_Directory_Browser *db = evas_object_data_get(obj, "directory_browser");
if (!ev->data) if (!ev->data)
return EINA_FALSE; return EINA_FALSE;
if (ev->len <= 0) if (ev->len <= 0)
return EINA_FALSE; return EINA_FALSE;
if (!path) if (!path)
return EINA_FALSE; return EINA_FALSE;
char *dd = strdup(ev->data); char *dd = strdup(ev->data);
if (!dd) if (!dd)
return EINA_FALSE; return EINA_FALSE;
char *s = _drag_data_extract(&dd); char *s = _drag_data_extract(&dd);
@ -110,8 +110,8 @@ _drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it,
{ {
if (evas_object_image_extension_can_load_get(s)) if (evas_object_image_extension_can_load_get(s))
files = eina_list_append(files, s); files = eina_list_append(files, s);
files = eina_list_append(files, s); files = eina_list_append(files, s);
s = _drag_data_extract(&dd); s = _drag_data_extract(&dd);
} }
free(dd); free(dd);
@ -128,7 +128,7 @@ _drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it,
static Elm_Object_Item * static Elm_Object_Item *
_drop_item_getcb(Evas_Object *obj, Evas_Coord x, Evas_Coord y, _drop_item_getcb(Evas_Object *obj, Evas_Coord x, Evas_Coord y,
int *xposret EINA_UNUSED, int *yposret) int *xposret EINA_UNUSED, int *yposret)
{ {
Elm_Object_Item *gli; Elm_Object_Item *gli;
@ -154,9 +154,9 @@ _drop_leave(void *data, Evas_Object *obj EINA_UNUSED)
static void static void
_drop_pos(void *data EINA_UNUSED, Evas_Object *cont EINA_UNUSED, _drop_pos(void *data EINA_UNUSED, Evas_Object *cont EINA_UNUSED,
Elm_Object_Item *it, Evas_Coord x EINA_UNUSED, Elm_Object_Item *it, Evas_Coord x EINA_UNUSED,
Evas_Coord y EINA_UNUSED, int xposret EINA_UNUSED, Evas_Coord y EINA_UNUSED, int xposret EINA_UNUSED,
int yposret EINA_UNUSED, Elm_Xdnd_Action action EINA_UNUSED) int yposret EINA_UNUSED, Elm_Xdnd_Action action EINA_UNUSED)
{ {
elm_genlist_item_selected_set(it, EINA_TRUE); elm_genlist_item_selected_set(it, EINA_TRUE);
} }
@ -167,42 +167,42 @@ _drag_data_extract(char **drag_data)
char *uri = NULL; char *uri = NULL;
if (!drag_data) if (!drag_data)
return uri; return uri;
char *p = *drag_data; char *p = *drag_data;
if (!p) if (!p)
return uri; return uri;
char *s = strstr(p, FILESEP); char *s = strstr(p, FILESEP);
if (s) if (s)
p += FILESEP_LEN; p += FILESEP_LEN;
s = strchr(p, '\n'); s = strchr(p, '\n');
uri = p; uri = p;
if (s) if (s)
{ {
if (s - p > 0) if (s - p > 0)
{ {
char *s1 = s - 1; char *s1 = s - 1;
if (s1[0] == '\r') if (s1[0] == '\r')
s1[0] = '\0'; s1[0] = '\0';
else else
{ {
char *s2 = s + 1; char *s2 = s + 1;
if (s2[0] == '\r') if (s2[0] == '\r')
{ {
s[0] = '\0'; s[0] = '\0';
s++; s++;
} }
else else
s[0] = '\0'; s[0] = '\0';
} }
} }
else else
s[0] = '\0'; s[0] = '\0';
s++; s++;
} }
else else
p = NULL; p = NULL;
@ -224,7 +224,7 @@ _entry_cmp(const void *pa, const void *pb)
static void static void
_on_list_expand_req(void *data, Evas_Object *obj EINA_UNUSED, _on_list_expand_req(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info) void *event_info)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
Elm_Object_Item *it = event_info; Elm_Object_Item *it = event_info;
@ -241,7 +241,7 @@ _on_list_expand_req(void *data, Evas_Object *obj EINA_UNUSED,
static void static void
_on_list_contract_req(void *data, Evas_Object *obj EINA_UNUSED, _on_list_contract_req(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info) void *event_info)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
Elm_Object_Item *it = event_info; Elm_Object_Item *it = event_info;
@ -307,9 +307,9 @@ _on_list_contracted(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
db->thumbs_only = 1; db->thumbs_only = 1;
db->dirs_only = 0; db->dirs_only = 0;
ephoto_directory_set(db->ephoto, path, NULL, ephoto_directory_set(db->ephoto, path, NULL,
db->dirs_only, db->thumbs_only); db->dirs_only, db->thumbs_only);
ephoto_title_set(db->ephoto, ephoto_title_set(db->ephoto,
db->ephoto->config->directory); db->ephoto->config->directory);
} }
static void static void
@ -326,7 +326,7 @@ _dir_job(void *data)
db->thumbs_only = 1; db->thumbs_only = 1;
db->dirs_only = 0; db->dirs_only = 0;
ephoto_directory_set(db->ephoto, path, NULL, ephoto_directory_set(db->ephoto, path, NULL,
db->dirs_only, db->thumbs_only); db->dirs_only, db->thumbs_only);
ephoto_title_set(db->ephoto, db->ephoto->config->directory); ephoto_title_set(db->ephoto, db->ephoto->config->directory);
} }
@ -342,7 +342,7 @@ _wait_job(void *data)
static void static void
_on_list_selected(void *data, Evas_Object *obj EINA_UNUSED, _on_list_selected(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info) void *event_info)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
Elm_Object_Item *it = event_info; Elm_Object_Item *it = event_info;
@ -357,7 +357,7 @@ _on_list_selected(void *data, Evas_Object *obj EINA_UNUSED,
static char * static char *
_dir_item_text_get(void *data, Evas_Object *obj EINA_UNUSED, _dir_item_text_get(void *data, Evas_Object *obj EINA_UNUSED,
const char *part EINA_UNUSED) const char *part EINA_UNUSED)
{ {
Ephoto_Entry *e = data; Ephoto_Entry *e = data;
@ -366,12 +366,12 @@ _dir_item_text_get(void *data, Evas_Object *obj EINA_UNUSED,
static Evas_Object * static Evas_Object *
_dir_item_icon_get(void *data, Evas_Object *obj, _dir_item_icon_get(void *data, Evas_Object *obj,
const char *part) const char *part)
{ {
Ephoto_Entry *entry = data; Ephoto_Entry *entry = data;
if (!strcmp(part, "elm.swallow.end")) if (!strcmp(part, "elm.swallow.end"))
return NULL; return NULL;
Evas_Object *ic = elm_icon_add(obj); Evas_Object *ic = elm_icon_add(obj);
if (entry->item) if (entry->item)
@ -428,7 +428,7 @@ _check_for_subdirs(Ephoto_Entry *entry)
static void static void
_trash_back(void *data, Evas_Object *obj EINA_UNUSED, _trash_back(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
@ -441,13 +441,13 @@ _trash_back(void *data, Evas_Object *obj EINA_UNUSED,
db->thumbs_only = 1; db->thumbs_only = 1;
db->dirs_only = 0; db->dirs_only = 0;
ephoto_directory_set(db->ephoto, db->back_directory, NULL, ephoto_directory_set(db->ephoto, db->back_directory, NULL,
db->dirs_only, db->thumbs_only); db->dirs_only, db->thumbs_only);
ephoto_title_set(db->ephoto, db->back_directory); ephoto_title_set(db->ephoto, db->back_directory);
} }
static void static void
_dir_go_trash(void *data, Evas_Object *obj EINA_UNUSED, _dir_go_trash(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
Evas_Object *ic, *but; Evas_Object *ic, *but;
@ -474,28 +474,28 @@ _dir_go_trash(void *data, Evas_Object *obj EINA_UNUSED,
elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE); elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE);
EPHOTO_EXPAND(db->fsel); EPHOTO_EXPAND(db->fsel);
EPHOTO_FILL(db->fsel); EPHOTO_FILL(db->fsel);
evas_object_size_hint_min_set(db->fsel, 195*elm_config_scale_get(), 0); evas_object_size_hint_min_set(db->fsel, 195 * elm_config_scale_get(), 0);
evas_object_smart_callback_add(db->fsel, "expand,request", evas_object_smart_callback_add(db->fsel, "expand,request",
_on_list_expand_req, db); _on_list_expand_req, db);
evas_object_smart_callback_add(db->fsel, "contract,request", evas_object_smart_callback_add(db->fsel, "contract,request",
_on_list_contract_req, db); _on_list_contract_req, db);
evas_object_smart_callback_add(db->fsel, "expanded", _on_list_expanded, db); evas_object_smart_callback_add(db->fsel, "expanded", _on_list_expanded, db);
evas_object_smart_callback_add(db->fsel, "contracted", _on_list_contracted, evas_object_smart_callback_add(db->fsel, "contracted", _on_list_contracted,
db); db);
evas_object_event_callback_add(db->fsel, EVAS_CALLBACK_MOUSE_UP, evas_object_event_callback_add(db->fsel, EVAS_CALLBACK_MOUSE_UP,
_fsel_mouse_up_cb, db); _fsel_mouse_up_cb, db);
evas_object_data_set(db->fsel, "directory_browser", db); evas_object_data_set(db->fsel, "directory_browser", db);
elm_box_pack_end(db->leftbox, db->fsel); elm_box_pack_end(db->leftbox, db->fsel);
evas_object_show(db->fsel); evas_object_show(db->fsel);
eina_stringshare_replace(&db->back_directory, eina_stringshare_replace(&db->back_directory,
db->ephoto->config->directory); db->ephoto->config->directory);
if (!ecore_file_exists(db->ephoto->trash_path)) if (!ecore_file_exists(db->ephoto->trash_path))
ecore_file_mkpath(db->ephoto->trash_path); ecore_file_mkpath(db->ephoto->trash_path);
db->thumbs_only = 0; db->thumbs_only = 0;
db->dirs_only = 0; db->dirs_only = 0;
ephoto_directory_set(db->ephoto, db->ephoto->trash_path, NULL, ephoto_directory_set(db->ephoto, db->ephoto->trash_path, NULL,
db->dirs_only, db->thumbs_only); db->dirs_only, db->thumbs_only);
ephoto_title_set(db->ephoto, _("Trash")); ephoto_title_set(db->ephoto, _("Trash"));
ephoto_directory_browser_top_dir_set(db->ephoto, db->ephoto->config->directory); ephoto_directory_browser_top_dir_set(db->ephoto, db->ephoto->config->directory);
} }
@ -544,7 +544,7 @@ _fsel_menu_go_home(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EI
static void static void
_fsel_menu_new_dir_cb(void *data, Evas_Object *obj EINA_UNUSED, _fsel_menu_new_dir_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
Elm_Object_Item *item = elm_genlist_selected_item_get(db->fsel); 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,
static void static void
_fsel_menu_paste_cb(void *data, Evas_Object *obj EINA_UNUSED, _fsel_menu_paste_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
Elm_Object_Item *item = elm_genlist_selected_item_get(db->fsel); 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,
static void static void
_fsel_menu_rename_cb(void *data, Evas_Object *obj EINA_UNUSED, _fsel_menu_rename_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
Elm_Object_Item *item = elm_genlist_selected_item_get(db->fsel); 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,
static void static void
_fsel_menu_delete_cb(void *data, Evas_Object *obj EINA_UNUSED, _fsel_menu_delete_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
Elm_Object_Item *item = elm_genlist_selected_item_get(db->fsel); 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,
static void static void
_fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED, _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
Evas_Object *obj EINA_UNUSED, void *event_info) Evas_Object *obj EINA_UNUSED, void *event_info)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
Evas_Object *menu; Evas_Object *menu;
@ -635,7 +635,7 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
ecore_timer_del(db->click_timer); ecore_timer_del(db->click_timer);
db->click_timer = NULL; db->click_timer = NULL;
elm_genlist_item_expanded_set(item, elm_genlist_item_expanded_set(item,
!elm_genlist_item_expanded_get(item)); !elm_genlist_item_expanded_get(item));
} }
} }
} }
@ -650,8 +650,7 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
} }
} }
if (info->button != 3) if (info->button != 3)
return; return;
if (item) if (item)
elm_genlist_item_selected_set(item, EINA_TRUE); elm_genlist_item_selected_set(item, EINA_TRUE);
@ -659,36 +658,36 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
menu = elm_menu_add(db->ephoto->win); menu = elm_menu_add(db->ephoto->win);
elm_menu_move(menu, x, y); elm_menu_move(menu, x, y);
elm_menu_item_add(menu, NULL, "computer", _("Root"), elm_menu_item_add(menu, NULL, "computer", _("Root"),
_fsel_menu_go_root, db->ephoto); _fsel_menu_go_root, db->ephoto);
elm_menu_item_add(menu, NULL, "user-home", _("Home"), elm_menu_item_add(menu, NULL, "user-home", _("Home"),
_fsel_menu_go_home, db->ephoto); _fsel_menu_go_home, db->ephoto);
if (strcmp(db->ephoto->config->directory, db->ephoto->trash_path)) if (strcmp(db->ephoto->config->directory, db->ephoto->trash_path))
{ {
elm_menu_item_add(menu, NULL, "folder-new", _("New Folder"), elm_menu_item_add(menu, NULL, "folder-new", _("New Folder"),
_fsel_menu_new_dir_cb, db); _fsel_menu_new_dir_cb, db);
} }
if (item) if (item)
{ {
elm_menu_item_add(menu, NULL, "edit", _("Rename"), elm_menu_item_add(menu, NULL, "edit", _("Rename"),
_fsel_menu_rename_cb, db); _fsel_menu_rename_cb, db);
elm_menu_item_add(menu, NULL, "edit-paste", _("Paste"), elm_menu_item_add(menu, NULL, "edit-paste", _("Paste"),
_fsel_menu_paste_cb, db); _fsel_menu_paste_cb, db);
} }
else if (!strcmp(db->ephoto->config->directory, db->ephoto->trash_path) && else if (!strcmp(db->ephoto->config->directory, db->ephoto->trash_path) &&
elm_genlist_first_item_get(db->fsel)) elm_genlist_first_item_get(db->fsel))
{ {
elm_menu_item_add(menu, NULL, "edit-delete", _("Empty Trash"), elm_menu_item_add(menu, NULL, "edit-delete", _("Empty Trash"),
_menu_empty_cb, db); _menu_empty_cb, db);
} }
if (strcmp(db->ephoto->config->directory, db->ephoto->trash_path) && item) if (strcmp(db->ephoto->config->directory, db->ephoto->trash_path) && item)
{ {
elm_menu_item_add(menu, NULL, "edit-delete", _("Delete"), elm_menu_item_add(menu, NULL, "edit-delete", _("Delete"),
_fsel_menu_delete_cb, db); _fsel_menu_delete_cb, db);
elm_menu_item_add(menu, NULL, "user-trash", _("Trash"), elm_menu_item_add(menu, NULL, "user-trash", _("Trash"),
_dir_go_trash, db); _dir_go_trash, db);
} }
evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb, evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb,
db); db);
evas_object_show(menu); evas_object_show(menu);
} }
@ -708,23 +707,23 @@ _ephoto_directory_view_add(Ephoto_Directory_Browser *db)
elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE); elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE);
EPHOTO_EXPAND(db->fsel); EPHOTO_EXPAND(db->fsel);
EPHOTO_FILL(db->fsel); EPHOTO_FILL(db->fsel);
evas_object_size_hint_min_set(db->fsel, 195*elm_config_scale_get(), 0); evas_object_size_hint_min_set(db->fsel, 195 * elm_config_scale_get(), 0);
evas_object_smart_callback_add(db->fsel, "expand,request", evas_object_smart_callback_add(db->fsel, "expand,request",
_on_list_expand_req, db); _on_list_expand_req, db);
evas_object_smart_callback_add(db->fsel, "contract,request", evas_object_smart_callback_add(db->fsel, "contract,request",
_on_list_contract_req, db); _on_list_contract_req, db);
evas_object_smart_callback_add(db->fsel, "expanded", _on_list_expanded, db); evas_object_smart_callback_add(db->fsel, "expanded", _on_list_expanded, db);
evas_object_smart_callback_add(db->fsel, "contracted", _on_list_contracted, evas_object_smart_callback_add(db->fsel, "contracted", _on_list_contracted,
db); db);
evas_object_event_callback_add(db->fsel, EVAS_CALLBACK_MOUSE_UP, evas_object_event_callback_add(db->fsel, EVAS_CALLBACK_MOUSE_UP,
_fsel_mouse_up_cb, db); _fsel_mouse_up_cb, db);
evas_object_data_set(db->fsel, "directory_browser", db); evas_object_data_set(db->fsel, "directory_browser", db);
elm_box_pack_end(db->leftbox, db->fsel); elm_box_pack_end(db->leftbox, db->fsel);
evas_object_show(db->fsel); evas_object_show(db->fsel);
elm_drop_item_container_add(db->fsel, ELM_SEL_FORMAT_TARGETS, elm_drop_item_container_add(db->fsel, ELM_SEL_FORMAT_TARGETS,
_drop_item_getcb, _drop_enter, db, _drop_leave, db, _drop_pos, db, _drop_item_getcb, _drop_enter, db, _drop_leave, db, _drop_pos, db,
_drop_dropcb, NULL); _drop_dropcb, NULL);
} }
/*Ephoto Populating Functions*/ /*Ephoto Populating Functions*/
@ -743,36 +742,36 @@ _monitor_add(Ephoto_Entry *e)
e->monitor = eio_monitor_add(rp); e->monitor = eio_monitor_add(rp);
e->monitor_handlers = e->monitor_handlers =
eina_list_append(e->monitor_handlers, eina_list_append(e->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, ecore_event_handler_add(EIO_MONITOR_FILE_CREATED,
_monitor_cb, e)); _monitor_cb, e));
e->monitor_handlers = e->monitor_handlers =
eina_list_append(e->monitor_handlers, eina_list_append(e->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED,
_monitor_cb, e)); _monitor_cb, e));
e->monitor_handlers = e->monitor_handlers =
eina_list_append(e->monitor_handlers, eina_list_append(e->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, ecore_event_handler_add(EIO_MONITOR_FILE_DELETED,
_monitor_cb, e)); _monitor_cb, e));
e->monitor_handlers = e->monitor_handlers =
eina_list_append(e->monitor_handlers, eina_list_append(e->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED, ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED,
_monitor_cb, e)); _monitor_cb, e));
e->monitor_handlers = e->monitor_handlers =
eina_list_append(e->monitor_handlers, eina_list_append(e->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED, ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
_monitor_cb, e)); _monitor_cb, e));
e->monitor_handlers = e->monitor_handlers =
eina_list_append(e->monitor_handlers, eina_list_append(e->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
_monitor_cb, e)); _monitor_cb, e));
free(rp); free(rp);
} }
static Eina_Bool static Eina_Bool
_monitor_cb(void *data, int type, _monitor_cb(void *data, int type,
void *event) void *event)
{ {
Elm_Object_Item *item; Elm_Object_Item *item;
Ephoto_Entry *entry = data; Ephoto_Entry *entry = data;
@ -813,17 +812,17 @@ _monitor_cb(void *data, int type,
ic = _ephoto_dir_class; ic = _ephoto_dir_class;
snprintf(buf, PATH_MAX, "%s", ev->filename); snprintf(buf, PATH_MAX, "%s", ev->filename);
e = ephoto_entry_new(entry->ephoto, ev->filename, basename(buf), e = ephoto_entry_new(entry->ephoto, ev->filename, basename(buf),
EINA_FILE_DIR); EINA_FILE_DIR);
e->genlist = entry->genlist; e->genlist = entry->genlist;
e->parent = entry->item; e->parent = entry->item;
if (!_check_for_subdirs(e)) if (!_check_for_subdirs(e))
e->item = e->item =
elm_genlist_item_sorted_insert(entry->genlist, ic, e, elm_genlist_item_sorted_insert(entry->genlist, ic, e,
e->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL); e->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL);
else else
e->item = e->item =
elm_genlist_item_sorted_insert(entry->genlist, ic, e, elm_genlist_item_sorted_insert(entry->genlist, ic, e,
e->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL); e->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL);
if (e->item) if (e->item)
_monitor_add(e); _monitor_add(e);
} }
@ -833,8 +832,8 @@ _monitor_cb(void *data, int type,
ic = _ephoto_dir_tree_class; ic = _ephoto_dir_tree_class;
parent = parent =
elm_genlist_item_insert_before(entry->genlist, ic, entry, elm_genlist_item_insert_before(entry->genlist, ic, entry,
entry->parent, entry->item, ELM_GENLIST_ITEM_TREE, NULL, NULL); entry->parent, entry->item, ELM_GENLIST_ITEM_TREE, NULL, NULL);
entry->no_delete = EINA_TRUE; entry->no_delete = EINA_TRUE;
elm_object_item_del(entry->item); elm_object_item_del(entry->item);
entry->item = parent; entry->item = parent;
@ -865,8 +864,8 @@ _monitor_cb(void *data, int type,
Elm_Object_Item *parent; Elm_Object_Item *parent;
ic = _ephoto_dir_class; ic = _ephoto_dir_class;
parent = parent =
elm_genlist_item_insert_before(entry->genlist, ic, entry, elm_genlist_item_insert_before(entry->genlist, ic, entry,
entry->parent, entry->item, ELM_GENLIST_ITEM_NONE, NULL, NULL); entry->parent, entry->item, ELM_GENLIST_ITEM_NONE, NULL, NULL);
entry->no_delete = EINA_TRUE; entry->no_delete = EINA_TRUE;
elm_object_item_del(entry->item); elm_object_item_del(entry->item);
@ -917,7 +916,7 @@ _monitor_cb(void *data, int type,
static Eina_Bool static Eina_Bool
_top_monitor_cb(void *data, int type, _top_monitor_cb(void *data, int type,
void *event) void *event)
{ {
Elm_Object_Item *item; Elm_Object_Item *item;
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
@ -951,12 +950,12 @@ _top_monitor_cb(void *data, int type,
} }
snprintf(buf, PATH_MAX, "%s", ev->filename); snprintf(buf, PATH_MAX, "%s", ev->filename);
e = ephoto_entry_new(db->ephoto, ev->filename, basename(buf), e = ephoto_entry_new(db->ephoto, ev->filename, basename(buf),
EINA_FILE_DIR); EINA_FILE_DIR);
e->genlist = db->fsel; e->genlist = db->fsel;
ic = _ephoto_dir_class; ic = _ephoto_dir_class;
e->item = e->item =
elm_genlist_item_append(db->fsel, ic, e, elm_genlist_item_append(db->fsel, ic, e,
NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
if (e->item) if (e->item)
_monitor_add(e); _monitor_add(e);
free(rp); free(rp);
@ -1018,53 +1017,53 @@ _todo_items_process(void *data)
return EINA_TRUE; return EINA_TRUE;
db->animator.todo_items = NULL; db->animator.todo_items = NULL;
db->processing = 0; db->processing = 0;
return EINA_FALSE; return EINA_FALSE;
} }
if ((db->ls) && (eina_list_count(db->todo_items) < TODO_ITEM_MIN_BATCH)) if ((db->ls) && (eina_list_count(db->todo_items) < TODO_ITEM_MIN_BATCH))
return EINA_TRUE; return EINA_TRUE;
db->animator.todo_items = NULL; db->animator.todo_items = NULL;
db->processing = 1; db->processing = 1;
EINA_LIST_FREE(db->todo_items, entry) EINA_LIST_FREE(db->todo_items, entry)
{ {
i++; i++;
if (i > TODO_ITEM_MIN_BATCH) if (i > TODO_ITEM_MIN_BATCH)
return EINA_TRUE; return EINA_TRUE;
if (entry->is_dir && !entry->item) if (entry->is_dir && !entry->item)
{ {
const Elm_Genlist_Item_Class *ic; const Elm_Genlist_Item_Class *ic;
if (_check_for_subdirs(entry)) if (_check_for_subdirs(entry))
{ {
ic = _ephoto_dir_tree_class; ic = _ephoto_dir_tree_class;
entry->item = entry->item =
elm_genlist_item_sorted_insert(db->fsel, ic, entry, elm_genlist_item_sorted_insert(db->fsel, ic, entry,
entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL); entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL);
} }
else else
{ {
ic = _ephoto_dir_class; ic = _ephoto_dir_class;
entry->item = entry->item =
elm_genlist_item_sorted_insert(db->fsel, ic, entry, elm_genlist_item_sorted_insert(db->fsel, ic, entry,
entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL); entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL);
} }
if (!entry->item) if (!entry->item)
{ {
ephoto_entry_free(db->ephoto, entry); ephoto_entry_free(db->ephoto, entry);
} }
else else
{ {
_monitor_add(entry); _monitor_add(entry);
entry->genlist = db->fsel; entry->genlist = db->fsel;
} }
} }
db->animator.processed++; db->animator.processed++;
} }
return EINA_TRUE; return EINA_TRUE;
} }
static Eina_Bool static Eina_Bool
_ephoto_dir_populate_start(void *data, int type EINA_UNUSED, _ephoto_dir_populate_start(void *data, int type EINA_UNUSED,
void *event EINA_UNUSED) void *event EINA_UNUSED)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
@ -1078,15 +1077,15 @@ _ephoto_dir_populate_start(void *data, int type EINA_UNUSED,
static Eina_Bool static Eina_Bool
_ephoto_dir_populate_end(void *data, int type EINA_UNUSED, _ephoto_dir_populate_end(void *data, int type EINA_UNUSED,
void *event EINA_UNUSED) void *event EINA_UNUSED)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
db->ls = NULL; db->ls = NULL;
if (db->main_deleted) if (db->main_deleted)
{ {
free(db); free(db);
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }
db->dirs_only = 0; db->dirs_only = 0;
ephoto_thumb_browser_dirs_only_set(db->ephoto, EINA_FALSE); ephoto_thumb_browser_dirs_only_set(db->ephoto, EINA_FALSE);
@ -1097,7 +1096,7 @@ _ephoto_dir_populate_end(void *data, int type EINA_UNUSED,
static Eina_Bool static Eina_Bool
_ephoto_dir_populate_error(void *data, int type EINA_UNUSED, _ephoto_dir_populate_error(void *data, int type EINA_UNUSED,
void *event EINA_UNUSED) void *event EINA_UNUSED)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
@ -1120,8 +1119,8 @@ _ephoto_dir_entry_create(void *data, int type EINA_UNUSED, void *event)
rp = ecore_file_realpath(e->path); rp = ecore_file_realpath(e->path);
if (e->is_dir) if (e->is_dir)
{ {
db->todo_items = eina_list_append(db->todo_items, e); db->todo_items = eina_list_append(db->todo_items, e);
db->animator.count++; db->animator.count++;
} }
else if (ecore_file_is_dir((const char *)rp)) else if (ecore_file_is_dir((const char *)rp))
{ {
@ -1129,7 +1128,7 @@ _ephoto_dir_entry_create(void *data, int type EINA_UNUSED, void *event)
db->animator.count++; db->animator.count++;
} }
if (!db->animator.todo_items) if (!db->animator.todo_items)
db->animator.todo_items = ecore_animator_add(_todo_items_process, db); db->animator.todo_items = ecore_animator_add(_todo_items_process, db);
free(rp); free(rp);
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
@ -1138,24 +1137,25 @@ _ephoto_dir_entry_create(void *data, int type EINA_UNUSED, void *event)
/*Ephoto Directory Browser Main Callbacks*/ /*Ephoto Directory Browser Main Callbacks*/
static void static void
_ephoto_main_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _ephoto_main_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Directory_Browser *db = data; Ephoto_Directory_Browser *db = data;
Ecore_Event_Handler *handler; Ecore_Event_Handler *handler;
_todo_items_free(db); _todo_items_free(db);
elm_drop_item_container_del(db->fsel); elm_drop_item_container_del(db->fsel);
EINA_LIST_FREE(db->handlers, handler) ecore_event_handler_del(handler); EINA_LIST_FREE(db->handlers, handler)
ecore_event_handler_del(handler);
if (db->animator.todo_items) if (db->animator.todo_items)
{ {
ecore_animator_del(db->animator.todo_items); ecore_animator_del(db->animator.todo_items);
db->animator.todo_items = NULL; db->animator.todo_items = NULL;
} }
if (db->ls) if (db->ls)
{ {
db->main_deleted = EINA_TRUE; db->main_deleted = EINA_TRUE;
eio_file_cancel(db->ls); eio_file_cancel(db->ls);
return; return;
} }
if (db->monitor) if (db->monitor)
{ {
@ -1170,7 +1170,7 @@ void
ephoto_directory_browser_clear(Ephoto *ephoto) ephoto_directory_browser_clear(Ephoto *ephoto)
{ {
Ephoto_Directory_Browser *db = Ephoto_Directory_Browser *db =
evas_object_data_get(ephoto->dir_browser, "directory_browser"); evas_object_data_get(ephoto->dir_browser, "directory_browser");
elm_genlist_clear(db->fsel); elm_genlist_clear(db->fsel);
} }
@ -1179,7 +1179,7 @@ void
ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir) ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir)
{ {
Ephoto_Directory_Browser *db = Ephoto_Directory_Browser *db =
evas_object_data_get(ephoto->dir_browser, "directory_browser"); evas_object_data_get(ephoto->dir_browser, "directory_browser");
Ecore_Event_Handler *handler; Ecore_Event_Handler *handler;
char *rp = ecore_file_realpath(dir); char *rp = ecore_file_realpath(dir);
@ -1195,29 +1195,29 @@ ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir)
ephoto->top_directory = eina_stringshare_add(dir); ephoto->top_directory = eina_stringshare_add(dir);
db->monitor = eio_monitor_add(rp); db->monitor = eio_monitor_add(rp);
db->monitor_handlers = db->monitor_handlers =
eina_list_append(db->monitor_handlers, eina_list_append(db->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, ecore_event_handler_add(EIO_MONITOR_FILE_CREATED,
_top_monitor_cb, db)); _top_monitor_cb, db));
db->monitor_handlers = db->monitor_handlers =
eina_list_append(db->monitor_handlers, eina_list_append(db->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED,
_top_monitor_cb, db)); _top_monitor_cb, db));
db->monitor_handlers = db->monitor_handlers =
eina_list_append(db->monitor_handlers, eina_list_append(db->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, ecore_event_handler_add(EIO_MONITOR_FILE_DELETED,
_top_monitor_cb, db)); _top_monitor_cb, db));
db->monitor_handlers = db->monitor_handlers =
eina_list_append(db->monitor_handlers, eina_list_append(db->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED, ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED,
_top_monitor_cb, db)); _top_monitor_cb, db));
db->monitor_handlers = db->monitor_handlers =
eina_list_append(db->monitor_handlers, eina_list_append(db->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED, ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
_top_monitor_cb, db)); _top_monitor_cb, db));
db->monitor_handlers = db->monitor_handlers =
eina_list_append(db->monitor_handlers, eina_list_append(db->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
_top_monitor_cb, db)); _top_monitor_cb, db));
free(rp); free(rp);
} }
@ -1225,7 +1225,7 @@ void
ephoto_directory_browser_initialize_structure(Ephoto *ephoto) ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
{ {
Ephoto_Directory_Browser *db = Ephoto_Directory_Browser *db =
evas_object_data_get(ephoto->dir_browser, "directory_browser"); evas_object_data_get(ephoto->dir_browser, "directory_browser");
Eina_List *dirs = NULL, *l; Eina_List *dirs = NULL, *l;
Elm_Object_Item *next = NULL, *cur = NULL; Elm_Object_Item *next = NULL, *cur = NULL;
char path[PATH_MAX], *dir, *end_dir; char path[PATH_MAX], *dir, *end_dir;
@ -1246,7 +1246,7 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
dir = ecore_file_dir_get(path); dir = ecore_file_dir_get(path);
dirs = eina_list_prepend(dirs, strdup(dir)); dirs = eina_list_prepend(dirs, strdup(dir));
memset(path, 0x00, sizeof(path)); memset(path, 0x00, sizeof(path));
snprintf(path, PATH_MAX, "%s", dir); snprintf(path, PATH_MAX, "%s", dir);
} }
free(dir); free(dir);
dir = NULL; dir = NULL;
@ -1276,7 +1276,7 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
if (strncmp(finfo->path + finfo->name_start, ".", 1)) if (strncmp(finfo->path + finfo->name_start, ".", 1))
{ {
Ephoto_Entry *entry = ephoto_entry_new(ephoto, finfo->path, Ephoto_Entry *entry = ephoto_entry_new(ephoto, finfo->path,
finfo->path+finfo->name_start, finfo->type); finfo->path + finfo->name_start, finfo->type);
entry->parent = cur; entry->parent = cur;
if (entry->is_dir && !entry->item) if (entry->is_dir && !entry->item)
{ {
@ -1285,17 +1285,17 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
{ {
ic = _ephoto_dir_tree_class; ic = _ephoto_dir_tree_class;
entry->item = entry->item =
elm_genlist_item_sorted_insert(db->fsel, ic, entry, elm_genlist_item_sorted_insert(db->fsel, ic, entry,
entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp,
NULL, NULL); NULL, NULL);
} }
else else
{ {
ic = _ephoto_dir_class; ic = _ephoto_dir_class;
entry->item = entry->item =
elm_genlist_item_sorted_insert(db->fsel, ic, entry, elm_genlist_item_sorted_insert(db->fsel, ic, entry,
entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp,
NULL, NULL); NULL, NULL);
} }
if (!entry->item) if (!entry->item)
{ {
@ -1370,36 +1370,37 @@ ephoto_directory_browser_add(Ephoto *ephoto, Evas_Object *parent)
db->main = box; db->main = box;
elm_box_horizontal_set(db->main, EINA_FALSE); elm_box_horizontal_set(db->main, EINA_FALSE);
evas_object_size_hint_min_set(db->main, 195*elm_config_scale_get(), 0); evas_object_size_hint_min_set(db->main, 195 * elm_config_scale_get(), 0);
evas_object_event_callback_add(db->main, EVAS_CALLBACK_DEL, evas_object_event_callback_add(db->main, EVAS_CALLBACK_DEL,
_ephoto_main_del, db); _ephoto_main_del, db);
evas_object_data_set(db->main, "directory_browser", db); evas_object_data_set(db->main, "directory_browser", db);
_ephoto_directory_view_add(db); _ephoto_directory_view_add(db);
db->handlers = db->handlers =
eina_list_append(db->handlers, eina_list_append(db->handlers,
ecore_event_handler_add(EPHOTO_EVENT_POPULATE_START, ecore_event_handler_add(EPHOTO_EVENT_POPULATE_START,
_ephoto_dir_populate_start, db)); _ephoto_dir_populate_start, db));
db->handlers = db->handlers =
eina_list_append(db->handlers, eina_list_append(db->handlers,
ecore_event_handler_add(EPHOTO_EVENT_POPULATE_END, ecore_event_handler_add(EPHOTO_EVENT_POPULATE_END,
_ephoto_dir_populate_end, db)); _ephoto_dir_populate_end, db));
db->handlers = db->handlers =
eina_list_append(db->handlers, eina_list_append(db->handlers,
ecore_event_handler_add(EPHOTO_EVENT_POPULATE_ERROR, ecore_event_handler_add(EPHOTO_EVENT_POPULATE_ERROR,
_ephoto_dir_populate_error, db)); _ephoto_dir_populate_error, db));
db->handlers = db->handlers =
eina_list_append(db->handlers, eina_list_append(db->handlers,
ecore_event_handler_add(EPHOTO_EVENT_ENTRY_CREATE, ecore_event_handler_add(EPHOTO_EVENT_ENTRY_CREATE,
_ephoto_dir_entry_create, db)); _ephoto_dir_entry_create, db));
return db->main; return db->main;
error: error:
evas_object_del(db->main); evas_object_del(db->main);
return NULL; return NULL;
} }

View File

@ -2,28 +2,28 @@
static void static void
_editor_reset(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _editor_reset(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
ecore_event_add(EPHOTO_EVENT_EDITOR_RESET, NULL, NULL, NULL); ecore_event_add(EPHOTO_EVENT_EDITOR_RESET, NULL, NULL, NULL);
} }
static void static void
_editor_apply(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _editor_apply(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
ecore_event_add(EPHOTO_EVENT_EDITOR_APPLY, NULL, NULL, NULL); ecore_event_add(EPHOTO_EVENT_EDITOR_APPLY, NULL, NULL, NULL);
} }
static void static void
_editor_cancel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _editor_cancel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
ecore_event_add(EPHOTO_EVENT_EDITOR_CANCEL, NULL, NULL, NULL); ecore_event_add(EPHOTO_EVENT_EDITOR_CANCEL, NULL, NULL, NULL);
} }
Evas_Object * Evas_Object *
ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const char *title, const char *data_name, ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const char *title, const char *data_name,
void *data) void *data)
{ {
Evas_Object *frame, *box, *ic, *button; Evas_Object *frame, *box, *ic, *button;
@ -32,7 +32,7 @@ ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const char *title, const
EPHOTO_WEIGHT(frame, ephoto->config->right_size, EVAS_HINT_EXPAND); EPHOTO_WEIGHT(frame, ephoto->config->right_size, EVAS_HINT_EXPAND);
EPHOTO_FILL(frame); EPHOTO_FILL(frame);
evas_object_data_set(frame, data_name, data); evas_object_data_set(frame, data_name, data);
elm_box_pack_end(parent, frame); elm_box_pack_end(parent, frame);
evas_object_show(frame); evas_object_show(frame);
box = elm_box_add(frame); box = elm_box_add(frame);
@ -45,8 +45,8 @@ ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const char *title, const
evas_object_show(box); evas_object_show(box);
ic = elm_icon_add(box); ic = elm_icon_add(box);
evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
20*elm_config_scale_get()); 20 * elm_config_scale_get());
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
elm_icon_standard_set(ic, "edit-undo"); elm_icon_standard_set(ic, "edit-undo");
@ -60,8 +60,8 @@ ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const char *title, const
evas_object_show(button); evas_object_show(button);
ic = elm_icon_add(box); ic = elm_icon_add(box);
evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
20*elm_config_scale_get()); 20 * elm_config_scale_get());
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
elm_icon_standard_set(ic, "document-save"); elm_icon_standard_set(ic, "document-save");
@ -75,8 +75,8 @@ ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const char *title, const
evas_object_show(button); evas_object_show(button);
ic = elm_icon_add(box); ic = elm_icon_add(box);
evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
20*elm_config_scale_get()); 20 * elm_config_scale_get());
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
elm_icon_standard_set(ic, "window-close"); elm_icon_standard_set(ic, "window-close");

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
#include "ephoto.h" #include "ephoto.h"
typedef enum _Ephoto_Image_Filter Ephoto_Image_Filter; typedef enum _Ephoto_Image_Filter Ephoto_Image_Filter;
typedef struct _Ephoto_Filter Ephoto_Filter; typedef struct _Ephoto_Filter Ephoto_Filter;
enum _Ephoto_Image_Filter enum _Ephoto_Image_Filter
{ {
@ -22,24 +22,24 @@ enum _Ephoto_Image_Filter
struct _Ephoto_Filter struct _Ephoto_Filter
{ {
Ephoto_Image_Filter filter; Ephoto_Image_Filter filter;
Ephoto *ephoto; Ephoto *ephoto;
Evas_Object *image; Evas_Object *image;
Evas_Object *popup; Evas_Object *popup;
Ecore_Thread *thread;; Ecore_Thread *thread;
Eina_List *queue; Eina_List *queue;
Evas_Coord w; Evas_Coord w;
Evas_Coord h; Evas_Coord h;
int rad; int rad;
int qpos; int qpos;
int qcount; int qcount;
double drad; double drad;
unsigned int *hist; unsigned int *hist;
unsigned int *cdf; unsigned int *cdf;
unsigned int *im_data; unsigned int *im_data;
unsigned int *im_data_new; unsigned int *im_data_new;
unsigned int *im_data_orig; unsigned int *im_data_orig;
unsigned int *im_data_two; unsigned int *im_data_two;
Eina_Bool save_data; Eina_Bool save_data;
}; };
static void _blur(void *data, Ecore_Thread *th EINA_UNUSED); static void _blur(void *data, Ecore_Thread *th EINA_UNUSED);
@ -56,14 +56,14 @@ static void _histogram_eq(void *data, Ecore_Thread *th EINA_UNUSED);
static Ephoto_Filter * static Ephoto_Filter *
_initialize_filter(Ephoto_Image_Filter filter, _initialize_filter(Ephoto_Image_Filter filter,
Ephoto *ephoto, Evas_Object *image) Ephoto *ephoto, Evas_Object *image)
{ {
Ephoto_Filter *ef = calloc(1, sizeof(Ephoto_Filter)); Ephoto_Filter *ef = calloc(1, sizeof(Ephoto_Filter));
Evas_Coord w, h; Evas_Coord w, h;
unsigned int *im_data; unsigned int *im_data;
im_data = im_data =
evas_object_image_data_get(image, EINA_FALSE); evas_object_image_data_get(image, EINA_FALSE);
evas_object_image_size_get(image, &w, &h); evas_object_image_size_get(image, &w, &h);
ef->filter = filter; ef->filter = filter;
@ -93,7 +93,7 @@ _create_hist(Ephoto_Filter *ef)
{ {
int i; int i;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
ef->hist[i] = 0; ef->hist[i] = 0;
} }
static Evas_Object * static Evas_Object *
@ -113,7 +113,7 @@ _processing(Evas_Object *main)
label = elm_label_add(box); label = elm_label_add(box);
elm_object_text_set(label, elm_object_text_set(label,
_("Please wait while this filter is applied to your image.")); _("Please wait while this filter is applied to your image."));
EPHOTO_EXPAND(label); EPHOTO_EXPAND(label);
EPHOTO_FILL(label); EPHOTO_FILL(label);
elm_box_pack_end(box, label); elm_box_pack_end(box, label);
@ -141,7 +141,7 @@ _thread_finished_cb(void *data, Ecore_Thread *th EINA_UNUSED)
if (ef->qcount == 0) if (ef->qcount == 0)
{ {
ephoto_single_browser_image_data_done(ef->ephoto->single_browser, ephoto_single_browser_image_data_done(ef->ephoto->single_browser,
ef->im_data_new, ef->w, ef->h); ef->im_data_new, ef->w, ef->h);
if (ef->popup) if (ef->popup)
{ {
evas_object_del(ef->popup); evas_object_del(ef->popup);
@ -165,14 +165,14 @@ _thread_finished_cb(void *data, Ecore_Thread *th EINA_UNUSED)
} }
ef->im_data_two = malloc(sizeof(unsigned int) * ef->w * ef->h); ef->im_data_two = malloc(sizeof(unsigned int) * ef->w * ef->h);
memcpy(ef->im_data_two, ef->im_data, memcpy(ef->im_data_two, ef->im_data,
sizeof(unsigned int) * ef->w * ef->h); sizeof(unsigned int) * ef->w * ef->h);
ef->save_data = EINA_FALSE; ef->save_data = EINA_FALSE;
} }
free(ef->im_data); free(ef->im_data);
ef->im_data = NULL; ef->im_data = NULL;
ef->im_data = malloc(sizeof(unsigned int) * ef->w * ef->h); ef->im_data = malloc(sizeof(unsigned int) * ef->w * ef->h);
memcpy(ef->im_data, ef->im_data_new, memcpy(ef->im_data, ef->im_data_new,
sizeof(unsigned int) * ef->w * ef->h); sizeof(unsigned int) * ef->w * ef->h);
if (ef->hist) if (ef->hist)
free(ef->hist); free(ef->hist);
ef->hist = NULL; ef->hist = NULL;
@ -180,18 +180,18 @@ _thread_finished_cb(void *data, Ecore_Thread *th EINA_UNUSED)
free(ef->cdf); free(ef->cdf);
ef->cdf = NULL; ef->cdf = NULL;
ef->qpos++; ef->qpos++;
if (ef->qpos-1 < ef->qcount) if (ef->qpos - 1 < ef->qcount)
{ {
free(ef->im_data_new); free(ef->im_data_new);
ef->im_data_new = NULL; ef->im_data_new = NULL;
ef->im_data_new = malloc(sizeof(unsigned int) * ef->w * ef->h); ef->im_data_new = malloc(sizeof(unsigned int) * ef->w * ef->h);
ef->thread = ecore_thread_run(eina_list_nth(ef->queue, ef->qpos-1), ef->thread = ecore_thread_run(eina_list_nth(ef->queue, ef->qpos - 1),
_thread_finished_cb, NULL, ef); _thread_finished_cb, NULL, ef);
} }
else else
{ {
ephoto_single_browser_image_data_done(ef->ephoto->single_browser, ephoto_single_browser_image_data_done(ef->ephoto->single_browser,
ef->im_data_new, ef->w, ef->h); ef->im_data_new, ef->w, ef->h);
if (ef->popup) if (ef->popup)
{ {
evas_object_del(ef->popup); evas_object_del(ef->popup);
@ -231,7 +231,7 @@ _blur_vertical(Ephoto_Filter *ef, double rad)
as[i] = (ef->im_data[i] >> 24) & 0xff; as[i] = (ef->im_data[i] >> 24) & 0xff;
} }
iarr = (double) 1 / (rad + rad + 1); iarr = (double)1 / (rad + rad + 1);
for (y = 0; y < h; y++) for (y = 0; y < h; y++)
{ {
int t, l, rr; int t, l, rr;
@ -274,17 +274,17 @@ _blur_vertical(Ephoto_Filter *ef, double rad)
valr += rs[r] - fr; valr += rs[r] - fr;
vala += as[r] - fa; vala += as[r] - fa;
bt = (int) round(valb * iarr); bt = (int)round(valb * iarr);
gt = (int) round(valg * iarr); gt = (int)round(valg * iarr);
rt = (int) round(valr * iarr); rt = (int)round(valr * iarr);
at = (int) round(vala * iarr); at = (int)round(vala * iarr);
bt = ephoto_normalize_color(bt); bt = ephoto_normalize_color(bt);
gt = ephoto_normalize_color(gt); gt = ephoto_normalize_color(gt);
rt = ephoto_normalize_color(rt); rt = ephoto_normalize_color(rt);
at = ephoto_normalize_color(at); at = ephoto_normalize_color(at);
ef->im_data_new[t++] = (at << 24) | (rt << 16) ef->im_data_new[t++] = (at << 24) | (rt << 16)
| (gt << 8) | bt; | (gt << 8) | bt;
} }
for (i = rad + 1; i < w - rad; i++) for (i = rad + 1; i < w - rad; i++)
{ {
@ -296,16 +296,16 @@ _blur_vertical(Ephoto_Filter *ef, double rad)
valr += rs[r] - rs[ll]; valr += rs[r] - rs[ll];
vala += as[r] - as[ll]; vala += as[r] - as[ll];
bt = (int) round(valb * iarr); bt = (int)round(valb * iarr);
gt = (int) round(valg * iarr); gt = (int)round(valg * iarr);
rt = (int) round(valr * iarr); rt = (int)round(valr * iarr);
at = (int) round(vala * iarr); at = (int)round(vala * iarr);
bt = ephoto_normalize_color(bt); bt = ephoto_normalize_color(bt);
gt = ephoto_normalize_color(gt); gt = ephoto_normalize_color(gt);
rt = ephoto_normalize_color(rt); rt = ephoto_normalize_color(rt);
at = ephoto_normalize_color(at); at = ephoto_normalize_color(at);
ef->im_data_new[t++] = (at << 24) | (rt << 16) ef->im_data_new[t++] = (at << 24) | (rt << 16)
| (gt << 8) | bt; | (gt << 8) | bt;
} }
for (i = w - rad; i < w; i++) for (i = w - rad; i < w; i++)
{ {
@ -316,16 +316,16 @@ _blur_vertical(Ephoto_Filter *ef, double rad)
valr += lvr - rs[ll]; valr += lvr - rs[ll];
vala += lva - as[ll]; vala += lva - as[ll];
bt = (int) round(valb * iarr); bt = (int)round(valb * iarr);
gt = (int) round(valg * iarr); gt = (int)round(valg * iarr);
rt = (int) round(valr * iarr); rt = (int)round(valr * iarr);
at = (int) round(vala * iarr); at = (int)round(vala * iarr);
bt = ephoto_normalize_color(bt); bt = ephoto_normalize_color(bt);
gt = ephoto_normalize_color(gt); gt = ephoto_normalize_color(gt);
rt = ephoto_normalize_color(rt); rt = ephoto_normalize_color(rt);
at = ephoto_normalize_color(at); at = ephoto_normalize_color(at);
ef->im_data_new[t++] = (at << 24) | (rt << 16) ef->im_data_new[t++] = (at << 24) | (rt << 16)
| (gt << 8) | bt; | (gt << 8) | bt;
} }
} }
free(bs); free(bs);
@ -399,16 +399,16 @@ _blur_horizontal(Ephoto_Filter *ef, double rad)
valr += rs[rr] - fr; valr += rs[rr] - fr;
vala += as[rr] - fa; vala += as[rr] - fa;
bt = (int) round(valb * iarr); bt = (int)round(valb * iarr);
gt = (int) round(valg * iarr); gt = (int)round(valg * iarr);
rt = (int) round(valr * iarr); rt = (int)round(valr * iarr);
at = (int) round(vala * iarr); at = (int)round(vala * iarr);
bt = ephoto_normalize_color(bt); bt = ephoto_normalize_color(bt);
gt = ephoto_normalize_color(gt); gt = ephoto_normalize_color(gt);
rt = ephoto_normalize_color(rt); rt = ephoto_normalize_color(rt);
at = ephoto_normalize_color(at); at = ephoto_normalize_color(at);
ef->im_data[t] = (at << 24) | (rt << 16) ef->im_data[t] = (at << 24) | (rt << 16)
| (gt << 8) | bt; | (gt << 8) | bt;
rr += w; rr += w;
t += w; t += w;
@ -418,18 +418,18 @@ _blur_horizontal(Ephoto_Filter *ef, double rad)
valb += bs[rr] - bs[l]; valb += bs[rr] - bs[l];
valg += gs[rr] - gs[l]; valg += gs[rr] - gs[l];
valr += rs[rr] - rs[l]; valr += rs[rr] - rs[l];
vala += as[rr] - as[l];; vala += as[rr] - as[l];
bt = (int) round(valb * iarr); bt = (int)round(valb * iarr);
gt = (int) round(valg * iarr); gt = (int)round(valg * iarr);
rt = (int) round(valr * iarr); rt = (int)round(valr * iarr);
at = (int) round(vala * iarr); at = (int)round(vala * iarr);
bt = ephoto_normalize_color(bt); bt = ephoto_normalize_color(bt);
gt = ephoto_normalize_color(gt); gt = ephoto_normalize_color(gt);
rt = ephoto_normalize_color(rt); rt = ephoto_normalize_color(rt);
at = ephoto_normalize_color(at); at = ephoto_normalize_color(at);
ef->im_data[t] = (at << 24) | (rt << 16) ef->im_data[t] = (at << 24) | (rt << 16)
| (gt << 8) | bt; | (gt << 8) | bt;
l += w; l += w;
rr += w; rr += w;
@ -442,16 +442,16 @@ _blur_horizontal(Ephoto_Filter *ef, double rad)
valr += lvr - rs[l]; valr += lvr - rs[l];
vala += lva - as[l]; vala += lva - as[l];
bt = (int) round(valb * iarr); bt = (int)round(valb * iarr);
gt = (int) round(valg * iarr); gt = (int)round(valg * iarr);
rt = (int) round(valr * iarr); rt = (int)round(valr * iarr);
at = (int) round(vala * iarr); at = (int)round(vala * iarr);
bt = ephoto_normalize_color(bt); bt = ephoto_normalize_color(bt);
gt = ephoto_normalize_color(gt); gt = ephoto_normalize_color(gt);
rt = ephoto_normalize_color(rt); rt = ephoto_normalize_color(rt);
at = ephoto_normalize_color(at); at = ephoto_normalize_color(at);
ef->im_data[t] = (at << 24) | (rt << 16) ef->im_data[t] = (at << 24) | (rt << 16)
| (gt << 8) | bt; | (gt << 8) | bt;
l += w; l += w;
t += w; t += w;
@ -482,7 +482,7 @@ _blur(void *data, Ecore_Thread *th EINA_UNUSED)
wl--; wl--;
wu = wl + 2; wu = wl + 2;
ideal = (12 * rad * rad - 3 * wl * wl - ideal = (12 * rad * rad - 3 * wl * wl -
4 * 3 * wl - 3 * 3) / (-4 * wl - 4); 4 * 3 * wl - 3 * 3) / (-4 * wl - 4);
m = round(ideal); m = round(ideal);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
@ -495,7 +495,7 @@ _blur(void *data, Ecore_Thread *th EINA_UNUSED)
rad = (sizes[i] - 1) / 2; rad = (sizes[i] - 1) / 2;
memcpy(ef->im_data_new, ef->im_data, memcpy(ef->im_data_new, ef->im_data,
sizeof(unsigned int) * w * h); sizeof(unsigned int) * w * h);
_blur_vertical(ef, rad); _blur_vertical(ef, rad);
_blur_horizontal(ef, rad); _blur_horizontal(ef, rad);
} }
@ -521,19 +521,19 @@ _sharpen(void *data, Ecore_Thread *th EINA_UNUSED)
p3 = ef->im_data_new + (y * w); p3 = ef->im_data_new + (y * w);
for (x = 1; x < (w - 1); x++) for (x = 1; x < (w - 1); x++)
{ {
b = (int) (*p1 & 0xff); b = (int)(*p1 & 0xff);
g = (int) ((*p1 >> 8) & 0xff); g = (int)((*p1 >> 8) & 0xff);
r = (int) ((*p1 >> 16) & 0xff); r = (int)((*p1 >> 16) & 0xff);
a = (int) ((*p1 >> 24) & 0xff); a = (int)((*p1 >> 24) & 0xff);
bb = (int) (*p2 & 0xff); bb = (int)(*p2 & 0xff);
gg = (int) ((*p2 >> 8) & 0xff); gg = (int)((*p2 >> 8) & 0xff);
rr = (int) ((*p2 >> 16) & 0xff); rr = (int)((*p2 >> 16) & 0xff);
aa = (int) ((*p2 >> 24) & 0xff); aa = (int)((*p2 >> 24) & 0xff);
bbb = (int) ((2 * bb) - b); bbb = (int)((2 * bb) - b);
ggg = (int) ((2 * gg) - g); ggg = (int)((2 * gg) - g);
rrr = (int) ((2 * rr) - r); rrr = (int)((2 * rr) - r);
aaa = (int) ((2 * aa) - a); aaa = (int)((2 * aa) - a);
bbb = ephoto_normalize_color(bbb); bbb = ephoto_normalize_color(bbb);
ggg = ephoto_normalize_color(ggg); ggg = ephoto_normalize_color(ggg);
@ -583,12 +583,12 @@ _dither(void *data, Ecore_Thread *th EINA_UNUSED)
gg = ephoto_demul_color_alpha(gg, a); gg = ephoto_demul_color_alpha(gg, a);
rr = ephoto_demul_color_alpha(rr, a); rr = ephoto_demul_color_alpha(rr, a);
ef->im_data_new[index] = (a << 24) | (rr << 16) | ef->im_data_new[index] = (a << 24) | (rr << 16) |
(gg << 8) | bb; (gg << 8) | bb;
errb = b - bb; errb = b - bb;
errg = g - gg; errg = g - gg;
errr = r - rr; errr = r - rr;
if ((x+1) < w) if ((x + 1) < w)
{ {
index = y * w + x + 1; index = y * w + x + 1;
b = (ef->im_data_new[index] & 0xff); b = (ef->im_data_new[index] & 0xff);
@ -608,9 +608,9 @@ _dither(void *data, Ecore_Thread *th EINA_UNUSED)
gg = ephoto_demul_color_alpha(gg, a); gg = ephoto_demul_color_alpha(gg, a);
rr = ephoto_demul_color_alpha(rr, a); rr = ephoto_demul_color_alpha(rr, a);
ef->im_data_new[index] = (a << 24) | (rr << 16) | ef->im_data_new[index] = (a << 24) | (rr << 16) |
(gg << 8) | bb; (gg << 8) | bb;
} }
if (x > 0 && (y+1) < h) if (x > 0 && (y + 1) < h)
{ {
index = (y + 1) * w + (x - 1); index = (y + 1) * w + (x - 1);
b = (ef->im_data_new[index] & 0xff); b = (ef->im_data_new[index] & 0xff);
@ -630,9 +630,9 @@ _dither(void *data, Ecore_Thread *th EINA_UNUSED)
gg = ephoto_demul_color_alpha(gg, a); gg = ephoto_demul_color_alpha(gg, a);
rr = ephoto_demul_color_alpha(rr, a); rr = ephoto_demul_color_alpha(rr, a);
ef->im_data_new[index] = (a << 24) | (rr << 16) | ef->im_data_new[index] = (a << 24) | (rr << 16) |
(gg << 8) | bb; (gg << 8) | bb;
} }
if ((y+1) < h) if ((y + 1) < h)
{ {
index = (y + 1) * w + x; index = (y + 1) * w + x;
b = (ef->im_data_new[index] & 0xff); b = (ef->im_data_new[index] & 0xff);
@ -652,9 +652,9 @@ _dither(void *data, Ecore_Thread *th EINA_UNUSED)
gg = ephoto_demul_color_alpha(gg, a); gg = ephoto_demul_color_alpha(gg, a);
rr = ephoto_demul_color_alpha(rr, a); rr = ephoto_demul_color_alpha(rr, a);
ef->im_data_new[index] = (a << 24) | (rr << 16) | ef->im_data_new[index] = (a << 24) | (rr << 16) |
(gg << 8) | bb; (gg << 8) | bb;
} }
if ((y+1) < h && (x+1) < w) if ((y + 1) < h && (x + 1) < w)
{ {
index = (y + 1) * w + (x + 1); index = (y + 1) * w + (x + 1);
b = (ef->im_data_new[index] & 0xff); b = (ef->im_data_new[index] & 0xff);
@ -674,7 +674,7 @@ _dither(void *data, Ecore_Thread *th EINA_UNUSED)
gg = ephoto_demul_color_alpha(gg, a); gg = ephoto_demul_color_alpha(gg, a);
rr = ephoto_demul_color_alpha(rr, a); rr = ephoto_demul_color_alpha(rr, a);
ef->im_data_new[index] = (a << 24) | (rr << 16) | ef->im_data_new[index] = (a << 24) | (rr << 16) |
(gg << 8) | bb; (gg << 8) | bb;
} }
} }
} }
@ -694,14 +694,14 @@ _grayscale(void *data, Ecore_Thread *th EINA_UNUSED)
for (x = 0; x < w; x++) for (x = 0; x < w; x++)
{ {
i = y * w + x; i = y * w + x;
b = (int) ((ef->im_data[i]) & 0xff); b = (int)((ef->im_data[i]) & 0xff);
g = (int) ((ef->im_data[i] >> 8) & 0xff); g = (int)((ef->im_data[i] >> 8) & 0xff);
r = (int) ((ef->im_data[i] >> 16) & 0xff); r = (int)((ef->im_data[i] >> 16) & 0xff);
a = (int) ((ef->im_data[i] >> 24) & 0xff); a = (int)((ef->im_data[i] >> 24) & 0xff);
b = ephoto_mul_color_alpha(b, a); b = ephoto_mul_color_alpha(b, a);
g = ephoto_mul_color_alpha(g, a); g = ephoto_mul_color_alpha(g, a);
r = ephoto_mul_color_alpha(r, a); r = ephoto_mul_color_alpha(r, a);
gray = (int) ((0.3 * r) + (0.59 * g) + (0.11 * b)); gray = (int)((0.3 * r) + (0.59 * g) + (0.11 * b));
if (a >= 0 && a < 255) if (a >= 0 && a < 255)
gray = (gray * a) / 255; gray = (gray * a) / 255;
ef->im_data_new[i] = (a << 24) | (gray << 16) | (gray << 8) | gray; ef->im_data_new[i] = (a << 24) | (gray << 16) | (gray << 8) | gray;
@ -731,11 +731,11 @@ _sepia(void *data, Ecore_Thread *th EINA_UNUSED)
b = ephoto_mul_color_alpha(b, a); b = ephoto_mul_color_alpha(b, a);
g = ephoto_mul_color_alpha(g, a); g = ephoto_mul_color_alpha(g, a);
r = ephoto_mul_color_alpha(r, a); r = ephoto_mul_color_alpha(r, a);
rr = (int) ((r * .393) + (g * .769) + (b * .189)); rr = (int)((r * .393) + (g * .769) + (b * .189));
rr = ephoto_normalize_color(rr); rr = ephoto_normalize_color(rr);
gg = ((r * .349) + (g * .686) + (b * .168)); gg = ((r * .349) + (g * .686) + (b * .168));
gg = ephoto_normalize_color(gg); gg = ephoto_normalize_color(gg);
bb = (int) ((r * .272) + (g * .534) + (b * .131)); bb = (int)((r * .272) + (g * .534) + (b * .131));
bb = ephoto_normalize_color(bb); bb = ephoto_normalize_color(bb);
bb = ephoto_demul_color_alpha(bb, a); bb = ephoto_demul_color_alpha(bb, a);
gg = ephoto_demul_color_alpha(gg, a); gg = ephoto_demul_color_alpha(gg, a);
@ -900,8 +900,8 @@ _sobel(void *data, Ecore_Thread *th EINA_UNUSED)
index = (y + i) * w + x + j; index = (y + i) * w + x + j;
pix = ef->im_data[index]; pix = ef->im_data[index];
hpval += pix * sobx[i+1][j+1]; hpval += pix * sobx[i + 1][j + 1];
vpval += pix * soby[i+1][j+1]; vpval += pix * soby[i + 1][j + 1];
} }
} }
} }
@ -938,7 +938,7 @@ _emboss(void *data, Ecore_Thread *th EINA_UNUSED)
{ {
p = ef->im_data_new + (y * w); p = ef->im_data_new + (y * w);
for (x = 0; x < w; x++) for (x = 0; x < w; x++)
{ {
int aa = 0, rr = 0, gg = 0, bb = 0; int aa = 0, rr = 0, gg = 0, bb = 0;
if (y > 0 && x > 0 && y < (h - 2) && x < (w - 2)) if (y > 0 && x > 0 && y < (h - 2) && x < (w - 2))
{ {
@ -949,14 +949,14 @@ _emboss(void *data, Ecore_Thread *th EINA_UNUSED)
int index, pix; int index, pix;
index = (y + i) * w + x + j; index = (y + i) * w + x + j;
pix = ef->im_data[index]; pix = ef->im_data[index];
bb += (int) ((pix) & 0xff) * bb += (int)((pix) & 0xff) *
emboss[i+1][j+1]; emboss[i + 1][j + 1];
gg += (int) ((pix >> 8) & 0xff) * gg += (int)((pix >> 8) & 0xff) *
emboss[i+1][j+1]; emboss[i + 1][j + 1];
rr += (int) ((pix >> 16) & 0xff) * rr += (int)((pix >> 16) & 0xff) *
emboss[i+1][j+1]; emboss[i + 1][j + 1];
aa += (int) ((pix >> 24) & 0xff) * aa += (int)((pix >> 24) & 0xff) *
emboss[i+1][j+1]; emboss[i + 1][j + 1];
} }
} }
} }
@ -997,7 +997,7 @@ _histogram_eq(void *data, Ecore_Thread *th EINA_UNUSED)
g = ephoto_mul_color_alpha(g, a); g = ephoto_mul_color_alpha(g, a);
r = ephoto_mul_color_alpha(r, a); r = ephoto_mul_color_alpha(r, a);
evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v); evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v);
norm = (int) round((double) v * (double) 255); norm = (int)round((double)v * (double)255);
ef->hist[norm] += 1; ef->hist[norm] += 1;
p1++; p1++;
} }
@ -1005,9 +1005,9 @@ _histogram_eq(void *data, Ecore_Thread *th EINA_UNUSED)
sum = 0; sum = 0;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
sum += ((double) ef->hist[i] / sum += ((double)ef->hist[i] /
(double) total); (double)total);
ef->cdf[i] = (int) round(sum * 255); ef->cdf[i] = (int)round(sum * 255);
} }
for (y = 0; y < h; y++) for (y = 0; y < h; y++)
{ {
@ -1023,8 +1023,8 @@ _histogram_eq(void *data, Ecore_Thread *th EINA_UNUSED)
g = ephoto_mul_color_alpha(g, a); g = ephoto_mul_color_alpha(g, a);
r = ephoto_mul_color_alpha(r, a); r = ephoto_mul_color_alpha(r, a);
evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v); evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v);
norm = (int) round((double) v * (double) 255); norm = (int)round((double)v * (double)255);
nv = (float) ef->cdf[norm] / (float) 255; nv = (float)ef->cdf[norm] / (float)255;
evas_color_hsv_to_rgb(hh, s, nv, &rr, &gg, &bb); evas_color_hsv_to_rgb(hh, s, nv, &rr, &gg, &bb);
bb = ephoto_normalize_color(bb); bb = ephoto_normalize_color(bb);
gg = ephoto_normalize_color(gg); gg = ephoto_normalize_color(gg);
@ -1043,22 +1043,22 @@ void
ephoto_filter_blur(Ephoto *ephoto, Evas_Object *image) ephoto_filter_blur(Ephoto *ephoto, Evas_Object *image)
{ {
Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_BLUR, Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_BLUR,
ephoto, image); ephoto, image);
ef->rad = 9; ef->rad = 9;
ef->popup = _processing(ephoto->win); ef->popup = _processing(ephoto->win);
ef->thread = ecore_thread_run(_blur, _thread_finished_cb, ef->thread = ecore_thread_run(_blur, _thread_finished_cb,
NULL, ef); NULL, ef);
} }
void void
ephoto_filter_sharpen(Ephoto *ephoto, Evas_Object *image) ephoto_filter_sharpen(Ephoto *ephoto, Evas_Object *image)
{ {
Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_SHARPEN, Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_SHARPEN,
ephoto, image); ephoto, image);
ef->im_data_orig = malloc(sizeof(unsigned int) * ef->w * ef->h); ef->im_data_orig = malloc(sizeof(unsigned int) * ef->w * ef->h);
memcpy(ef->im_data_orig, ef->im_data, memcpy(ef->im_data_orig, ef->im_data,
sizeof(unsigned int) * ef->w * ef->h); sizeof(unsigned int) * ef->w * ef->h);
ef->rad = 9; ef->rad = 9;
ef->qcount = 1; ef->qcount = 1;
@ -1066,61 +1066,61 @@ ephoto_filter_sharpen(Ephoto *ephoto, Evas_Object *image)
ef->queue = eina_list_append(ef->queue, _sharpen); ef->queue = eina_list_append(ef->queue, _sharpen);
ef->popup = _processing(ephoto->win); ef->popup = _processing(ephoto->win);
ef->thread = ecore_thread_run(_blur, _thread_finished_cb, ef->thread = ecore_thread_run(_blur, _thread_finished_cb,
NULL, ef); NULL, ef);
} }
void void
ephoto_filter_dither(Ephoto *ephoto, Evas_Object *image) ephoto_filter_dither(Ephoto *ephoto, Evas_Object *image)
{ {
Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_DITHER, Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_DITHER,
ephoto, image); ephoto, image);
memcpy(ef->im_data_new, ef->im_data, memcpy(ef->im_data_new, ef->im_data,
sizeof(unsigned int) * ef->w * ef->h); sizeof(unsigned int) * ef->w * ef->h);
ef->popup = _processing(ephoto->win); ef->popup = _processing(ephoto->win);
ef->thread = ecore_thread_run(_dither, _thread_finished_cb, ef->thread = ecore_thread_run(_dither, _thread_finished_cb,
NULL, ef); NULL, ef);
} }
void void
ephoto_filter_black_and_white(Ephoto *ephoto, Evas_Object *image) ephoto_filter_black_and_white(Ephoto *ephoto, Evas_Object *image)
{ {
Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_GRAYSCALE, Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_GRAYSCALE,
ephoto, image); ephoto, image);
ef->popup = _processing(ephoto->win); ef->popup = _processing(ephoto->win);
ef->thread = ecore_thread_run(_grayscale, _thread_finished_cb, ef->thread = ecore_thread_run(_grayscale, _thread_finished_cb,
NULL, ef); NULL, ef);
} }
void void
ephoto_filter_old_photo(Ephoto *ephoto, Evas_Object *image) ephoto_filter_old_photo(Ephoto *ephoto, Evas_Object *image)
{ {
Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_SEPIA, Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_SEPIA,
ephoto, image); ephoto, image);
ef->popup = _processing(ephoto->win); ef->popup = _processing(ephoto->win);
ef->thread = ecore_thread_run(_sepia, _thread_finished_cb, ef->thread = ecore_thread_run(_sepia, _thread_finished_cb,
NULL, ef); NULL, ef);
} }
void void
ephoto_filter_posterize(Ephoto *ephoto, Evas_Object *image) ephoto_filter_posterize(Ephoto *ephoto, Evas_Object *image)
{ {
Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_POSTERIZE, Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_POSTERIZE,
ephoto, image); ephoto, image);
ef->drad = 2.0; ef->drad = 2.0;
ef->popup = _processing(ephoto->win); ef->popup = _processing(ephoto->win);
ef->thread = ecore_thread_run(_posterize, _thread_finished_cb, ef->thread = ecore_thread_run(_posterize, _thread_finished_cb,
NULL, ef); NULL, ef);
} }
void void
ephoto_filter_painting(Ephoto *ephoto, Evas_Object *image) ephoto_filter_painting(Ephoto *ephoto, Evas_Object *image)
{ {
Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_PAINTING, Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_PAINTING,
ephoto, image); ephoto, image);
ef->rad = 5; ef->rad = 5;
ef->drad = 5.0; ef->drad = 5.0;
@ -1129,23 +1129,25 @@ ephoto_filter_painting(Ephoto *ephoto, Evas_Object *image)
ef->queue = eina_list_append(ef->queue, _posterize); ef->queue = eina_list_append(ef->queue, _posterize);
ef->popup = _processing(ephoto->win); ef->popup = _processing(ephoto->win);
ef->thread = ecore_thread_run(_blur, _thread_finished_cb, ef->thread = ecore_thread_run(_blur, _thread_finished_cb,
NULL, ef); NULL, ef);
} }
void ephoto_filter_invert(Ephoto *ephoto, Evas_Object *image) void
ephoto_filter_invert(Ephoto *ephoto, Evas_Object *image)
{ {
Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_INVERT, Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_INVERT,
ephoto, image); ephoto, image);
ef->popup = _processing(ephoto->win); ef->popup = _processing(ephoto->win);
ef->thread = ecore_thread_run(_negative, _thread_finished_cb, ef->thread = ecore_thread_run(_negative, _thread_finished_cb,
NULL, ef); NULL, ef);
} }
void ephoto_filter_sketch(Ephoto *ephoto, Evas_Object *image) void
ephoto_filter_sketch(Ephoto *ephoto, Evas_Object *image)
{ {
Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_SKETCH, Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_SKETCH,
ephoto, image); ephoto, image);
ef->rad = 4; ef->rad = 4;
ef->qpos = 0; ef->qpos = 0;
@ -1155,13 +1157,14 @@ void ephoto_filter_sketch(Ephoto *ephoto, Evas_Object *image)
ef->queue = eina_list_append(ef->queue, _dodge); ef->queue = eina_list_append(ef->queue, _dodge);
ef->popup = _processing(ephoto->win); ef->popup = _processing(ephoto->win);
ef->thread = ecore_thread_run(_grayscale, _thread_finished_cb, ef->thread = ecore_thread_run(_grayscale, _thread_finished_cb,
NULL, ef); NULL, ef);
} }
void ephoto_filter_edge(Ephoto *ephoto, Evas_Object *image) void
ephoto_filter_edge(Ephoto *ephoto, Evas_Object *image)
{ {
Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_SOBEL, Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_SOBEL,
ephoto, image); ephoto, image);
ef->rad = 3; ef->rad = 3;
ef->qpos = 0; ef->qpos = 0;
@ -1170,29 +1173,31 @@ void ephoto_filter_edge(Ephoto *ephoto, Evas_Object *image)
ef->queue = eina_list_append(ef->queue, _sobel); ef->queue = eina_list_append(ef->queue, _sobel);
ef->popup = _processing(ephoto->win); ef->popup = _processing(ephoto->win);
ef->thread = ecore_thread_run(_blur, _thread_finished_cb, ef->thread = ecore_thread_run(_blur, _thread_finished_cb,
NULL, ef); NULL, ef);
} }
void ephoto_filter_emboss(Ephoto *ephoto, Evas_Object *image) void
ephoto_filter_emboss(Ephoto *ephoto, Evas_Object *image)
{ {
Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_EMBOSS, Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_EMBOSS,
ephoto, image); ephoto, image);
ef->popup = _processing(ephoto->win); ef->popup = _processing(ephoto->win);
ef->thread = ecore_thread_run(_emboss, _thread_finished_cb, ef->thread = ecore_thread_run(_emboss, _thread_finished_cb,
NULL, ef); NULL, ef);
} }
void void
ephoto_filter_histogram_eq(Ephoto *ephoto, Evas_Object *image) ephoto_filter_histogram_eq(Ephoto *ephoto, Evas_Object *image)
{ {
Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_EQUALIZE, Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_EQUALIZE,
ephoto, image); ephoto, image);
ef->hist = malloc(sizeof(unsigned int) * 256); ef->hist = malloc(sizeof(unsigned int) * 256);
ef->cdf = malloc(sizeof(unsigned int) * 256); ef->cdf = malloc(sizeof(unsigned int) * 256);
_create_hist(ef); _create_hist(ef);
ef->popup = _processing(ephoto->win); ef->popup = _processing(ephoto->win);
ef->thread = ecore_thread_run(_histogram_eq, _thread_finished_cb, ef->thread = ecore_thread_run(_histogram_eq, _thread_finished_cb,
NULL, ef); NULL, ef);
} }

View File

@ -3,18 +3,18 @@
typedef struct _Ephoto_HSV Ephoto_HSV; typedef struct _Ephoto_HSV Ephoto_HSV;
struct _Ephoto_HSV struct _Ephoto_HSV
{ {
Evas_Object *main; Evas_Object *main;
Evas_Object *parent; Evas_Object *parent;
Evas_Object *image; Evas_Object *image;
Evas_Object *editor; Evas_Object *editor;
Evas_Object *hslider; Evas_Object *hslider;
Evas_Object *sslider; Evas_Object *sslider;
Evas_Object *vslider; Evas_Object *vslider;
Eina_List *handlers; Eina_List *handlers;
double hue; double hue;
double saturation; double saturation;
double value; double value;
Evas_Coord w, h; Evas_Coord w, h;
unsigned int *original_im_data; unsigned int *original_im_data;
}; };
@ -28,54 +28,54 @@ _ephoto_hsv_adjust_hue(Ephoto_HSV *ehsv, double hue, unsigned int *image_data)
im_data = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h); im_data = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h);
if (image_data) if (image_data)
memcpy(im_data, image_data, sizeof(unsigned int) * ehsv->w * ehsv->h); memcpy(im_data, image_data, sizeof(unsigned int) * ehsv->w * ehsv->h);
else else
memcpy(im_data, ehsv->original_im_data, memcpy(im_data, ehsv->original_im_data,
sizeof(unsigned int) * ehsv->w * ehsv->h); sizeof(unsigned int) * ehsv->w * ehsv->h);
im_data_new = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h); im_data_new = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h);
for (y = 0; y < ehsv->h; y++) for (y = 0; y < ehsv->h; y++)
{ {
p1 = im_data + (y * ehsv->w); p1 = im_data + (y * ehsv->w);
p2 = im_data_new + (y * ehsv->w); p2 = im_data_new + (y * ehsv->w);
for (x = 0; x < ehsv->w; x++) for (x = 0; x < ehsv->w; x++)
{ {
b = (int) ((*p1) & 0xff); b = (int)((*p1) & 0xff);
g = (int) ((*p1 >> 8) & 0xff); g = (int)((*p1 >> 8) & 0xff);
r = (int) ((*p1 >> 16) & 0xff); r = (int)((*p1 >> 16) & 0xff);
a = (int) ((*p1 >> 24) & 0xff); a = (int)((*p1 >> 24) & 0xff);
b = ephoto_mul_color_alpha(b, a); b = ephoto_mul_color_alpha(b, a);
g = ephoto_mul_color_alpha(g, a); g = ephoto_mul_color_alpha(g, a);
r = ephoto_mul_color_alpha(r, a); r = ephoto_mul_color_alpha(r, a);
evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v); evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v);
hh += hue; hh += hue;
if (hh < 0) if (hh < 0)
hh += 360; hh += 360;
if (hh > 360) if (hh > 360)
hh -= 360; hh -= 360;
evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb); evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb);
bb = ephoto_normalize_color(bb); bb = ephoto_normalize_color(bb);
gg = ephoto_normalize_color(gg); gg = ephoto_normalize_color(gg);
rr = ephoto_normalize_color(rr); rr = ephoto_normalize_color(rr);
bb = ephoto_demul_color_alpha(bb, a); bb = ephoto_demul_color_alpha(bb, a);
gg = ephoto_demul_color_alpha(gg, a); gg = ephoto_demul_color_alpha(gg, a);
rr = ephoto_demul_color_alpha(rr, a); rr = ephoto_demul_color_alpha(rr, a);
*p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
p2++; p2++;
p1++; p1++;
} }
} }
ehsv->hue = hue; ehsv->hue = hue;
ephoto_single_browser_image_data_update(ehsv->main, ehsv->image, ephoto_single_browser_image_data_update(ehsv->main, ehsv->image,
im_data_new, ehsv->w, ehsv->h); im_data_new, ehsv->w, ehsv->h);
free(im_data); free(im_data);
return im_data_new; return im_data_new;
} }
unsigned int * unsigned int *
_ephoto_hsv_adjust_saturation(Ephoto_HSV *ehsv, double saturation, _ephoto_hsv_adjust_saturation(Ephoto_HSV *ehsv, double saturation,
unsigned int *image_data) unsigned int *image_data)
{ {
unsigned int *im_data, *im_data_new, *p1, *p2; unsigned int *im_data, *im_data_new, *p1, *p2;
Evas_Coord x, y; Evas_Coord x, y;
@ -84,54 +84,54 @@ _ephoto_hsv_adjust_saturation(Ephoto_HSV *ehsv, double saturation,
im_data = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h); im_data = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h);
if (image_data) if (image_data)
memcpy(im_data, image_data, sizeof(unsigned int) * ehsv->w * ehsv->h); memcpy(im_data, image_data, sizeof(unsigned int) * ehsv->w * ehsv->h);
else else
memcpy(im_data, ehsv->original_im_data, memcpy(im_data, ehsv->original_im_data,
sizeof(unsigned int) * ehsv->w * ehsv->h); sizeof(unsigned int) * ehsv->w * ehsv->h);
im_data_new = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h); im_data_new = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h);
for (y = 0; y < ehsv->h; y++) for (y = 0; y < ehsv->h; y++)
{ {
p1 = im_data + (y * ehsv->w); p1 = im_data + (y * ehsv->w);
p2 = im_data_new + (y * ehsv->w); p2 = im_data_new + (y * ehsv->w);
for (x = 0; x < ehsv->w; x++) for (x = 0; x < ehsv->w; x++)
{ {
b = (int) ((*p1) & 0xff); b = (int)((*p1) & 0xff);
g = (int) ((*p1 >> 8) & 0xff); g = (int)((*p1 >> 8) & 0xff);
r = (int) ((*p1 >> 16) & 0xff); r = (int)((*p1 >> 16) & 0xff);
a = (int) ((*p1 >> 24) & 0xff); a = (int)((*p1 >> 24) & 0xff);
b = ephoto_mul_color_alpha(b, a); b = ephoto_mul_color_alpha(b, a);
g = ephoto_mul_color_alpha(g, a); g = ephoto_mul_color_alpha(g, a);
r = ephoto_mul_color_alpha(r, a); r = ephoto_mul_color_alpha(r, a);
evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v); evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v);
s += s * ((float) saturation / 100); s += s * ((float)saturation / 100);
if (s < 0) if (s < 0)
s = 0; s = 0;
if (s > 1) if (s > 1)
s = 1; s = 1;
evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb); evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb);
bb = ephoto_normalize_color(bb); bb = ephoto_normalize_color(bb);
gg = ephoto_normalize_color(gg); gg = ephoto_normalize_color(gg);
rr = ephoto_normalize_color(rr); rr = ephoto_normalize_color(rr);
bb = ephoto_demul_color_alpha(bb, a); bb = ephoto_demul_color_alpha(bb, a);
gg = ephoto_demul_color_alpha(gg, a); gg = ephoto_demul_color_alpha(gg, a);
rr = ephoto_demul_color_alpha(rr, a); rr = ephoto_demul_color_alpha(rr, a);
*p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
p2++; p2++;
p1++; p1++;
} }
} }
ehsv->saturation = saturation; ehsv->saturation = saturation;
ephoto_single_browser_image_data_update(ehsv->main, ehsv->image, ephoto_single_browser_image_data_update(ehsv->main, ehsv->image,
im_data_new, ehsv->w, ehsv->h); im_data_new, ehsv->w, ehsv->h);
free(im_data); free(im_data);
return im_data_new; return im_data_new;
} }
unsigned int * unsigned int *
_ephoto_hsv_adjust_value(Ephoto_HSV *ehsv, double value, _ephoto_hsv_adjust_value(Ephoto_HSV *ehsv, double value,
unsigned int *image_data) unsigned int *image_data)
{ {
unsigned int *im_data, *im_data_new, *p1, *p2; unsigned int *im_data, *im_data_new, *p1, *p2;
Evas_Coord x, y; Evas_Coord x, y;
@ -140,47 +140,47 @@ _ephoto_hsv_adjust_value(Ephoto_HSV *ehsv, double value,
im_data = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h); im_data = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h);
if (image_data) if (image_data)
memcpy(im_data, image_data, sizeof(unsigned int) * ehsv->w * ehsv->h); memcpy(im_data, image_data, sizeof(unsigned int) * ehsv->w * ehsv->h);
else else
memcpy(im_data, ehsv->original_im_data, memcpy(im_data, ehsv->original_im_data,
sizeof(unsigned int) * ehsv->w * ehsv->h); sizeof(unsigned int) * ehsv->w * ehsv->h);
im_data_new = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h); im_data_new = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h);
for (y = 0; y < ehsv->h; y++) for (y = 0; y < ehsv->h; y++)
{ {
p1 = im_data + (y * ehsv->w); p1 = im_data + (y * ehsv->w);
p2 = im_data_new + (y * ehsv->w); p2 = im_data_new + (y * ehsv->w);
for (x = 0; x < ehsv->w; x++) for (x = 0; x < ehsv->w; x++)
{ {
b = (int) ((*p1) & 0xff); b = (int)((*p1) & 0xff);
g = (int) ((*p1 >> 8) & 0xff); g = (int)((*p1 >> 8) & 0xff);
r = (int) ((*p1 >> 16) & 0xff); r = (int)((*p1 >> 16) & 0xff);
a = (int) ((*p1 >> 24) & 0xff); a = (int)((*p1 >> 24) & 0xff);
b = ephoto_mul_color_alpha(b, a); b = ephoto_mul_color_alpha(b, a);
g = ephoto_mul_color_alpha(g, a); g = ephoto_mul_color_alpha(g, a);
r = ephoto_mul_color_alpha(r, a); r = ephoto_mul_color_alpha(r, a);
evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v); evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v);
v += (v * ((float) value / 100)); v += (v * ((float)value / 100));
if (v < 0) if (v < 0)
v = 0; v = 0;
if (v > 1) if (v > 1)
v = 1; v = 1;
evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb); evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb);
bb = ephoto_normalize_color(bb); bb = ephoto_normalize_color(bb);
gg = ephoto_normalize_color(gg); gg = ephoto_normalize_color(gg);
rr = ephoto_normalize_color(rr); rr = ephoto_normalize_color(rr);
bb = ephoto_demul_color_alpha(bb, a); bb = ephoto_demul_color_alpha(bb, a);
gg = ephoto_demul_color_alpha(gg, a); gg = ephoto_demul_color_alpha(gg, a);
rr = ephoto_demul_color_alpha(rr, a); rr = ephoto_demul_color_alpha(rr, a);
*p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
p2++; p2++;
p1++; p1++;
} }
} }
ehsv->value = value; ehsv->value = value;
ephoto_single_browser_image_data_update(ehsv->main, ehsv->image, ephoto_single_browser_image_data_update(ehsv->main, ehsv->image,
im_data_new, ehsv->w, ehsv->h); im_data_new, ehsv->w, ehsv->h);
free(im_data); free(im_data);
return im_data_new; return im_data_new;
} }
@ -195,13 +195,13 @@ _hue_slider_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
hue = elm_slider_value_get(obj); hue = elm_slider_value_get(obj);
image_data = _ephoto_hsv_adjust_hue(ehsv, hue, NULL); image_data = _ephoto_hsv_adjust_hue(ehsv, hue, NULL);
image_data_two = image_data_two =
_ephoto_hsv_adjust_saturation(ehsv, ehsv->saturation, image_data); _ephoto_hsv_adjust_saturation(ehsv, ehsv->saturation, image_data);
_ephoto_hsv_adjust_value(ehsv, ehsv->value, image_data_two); _ephoto_hsv_adjust_value(ehsv, ehsv->value, image_data_two);
} }
static void static void
_saturation_slider_changed(void *data, Evas_Object *obj, _saturation_slider_changed(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_HSV *ehsv = data; Ephoto_HSV *ehsv = data;
double saturation; double saturation;
@ -215,7 +215,7 @@ _saturation_slider_changed(void *data, Evas_Object *obj,
static void static void
_value_slider_changed(void *data, Evas_Object *obj, _value_slider_changed(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_HSV *ehsv = data; Ephoto_HSV *ehsv = data;
double value; double value;
@ -229,7 +229,7 @@ _value_slider_changed(void *data, Evas_Object *obj,
static Eina_Bool static Eina_Bool
_hsv_reset(void *data, int type EINA_UNUSED, _hsv_reset(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_HSV *ehsv = data; Ephoto_HSV *ehsv = data;
@ -246,7 +246,7 @@ _hsv_reset(void *data, int type EINA_UNUSED,
static Eina_Bool static Eina_Bool
_hsv_apply(void *data, int type EINA_UNUSED, _hsv_apply(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_HSV *ehsv = data; Ephoto_HSV *ehsv = data;
unsigned int *image_data; unsigned int *image_data;
@ -261,7 +261,7 @@ _hsv_apply(void *data, int type EINA_UNUSED,
else else
{ {
image_data = image_data =
evas_object_image_data_get(ehsv->image, EINA_FALSE); evas_object_image_data_get(ehsv->image, EINA_FALSE);
evas_object_image_size_get(ehsv->image, &w, &h); evas_object_image_size_get(ehsv->image, &w, &h);
ephoto_single_browser_image_data_done(ehsv->main, image_data, w, h); ephoto_single_browser_image_data_done(ehsv->main, image_data, w, h);
} }
@ -272,7 +272,7 @@ _hsv_apply(void *data, int type EINA_UNUSED,
static Eina_Bool static Eina_Bool
_hsv_cancel(void *data, int type EINA_UNUSED, _hsv_cancel(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_HSV *ehsv = data; Ephoto_HSV *ehsv = data;
@ -291,7 +291,7 @@ _hsv_cancel(void *data, int type EINA_UNUSED,
static void static void
_editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_HSV *ehsv = data; Ephoto_HSV *ehsv = data;
Ecore_Event_Handler *handler; Ecore_Event_Handler *handler;
@ -321,18 +321,18 @@ ephoto_hsv_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje
ehsv->parent = parent; ehsv->parent = parent;
ehsv->image = image; ehsv->image = image;
im_data = im_data =
evas_object_image_data_get(ehsv->image, evas_object_image_data_get(ehsv->image,
EINA_FALSE); EINA_FALSE);
evas_object_image_size_get(ehsv->image, &ehsv->w, evas_object_image_size_get(ehsv->image, &ehsv->w,
&ehsv->h); &ehsv->h);
ehsv->original_im_data = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h); ehsv->original_im_data = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h);
memcpy(ehsv->original_im_data, im_data, memcpy(ehsv->original_im_data, im_data,
sizeof(unsigned int) * ehsv->w * ehsv->h); sizeof(unsigned int) * ehsv->w * ehsv->h);
ehsv->editor = ephoto_editor_add(ephoto, parent, _("Hue/Saturation/Value"), ehsv->editor = ephoto_editor_add(ephoto, parent, _("Hue/Saturation/Value"),
"ehsv", ehsv); "ehsv", ehsv);
evas_object_event_callback_add(ehsv->editor, EVAS_CALLBACK_DEL, _editor_del, evas_object_event_callback_add(ehsv->editor, EVAS_CALLBACK_DEL, _editor_del,
ehsv); ehsv);
slider = elm_slider_add(ehsv->editor); slider = elm_slider_add(ehsv->editor);
elm_object_text_set(slider, _("Value")); elm_object_text_set(slider, _("Value"));
@ -344,7 +344,7 @@ ephoto_hsv_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje
EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
evas_object_smart_callback_add(slider, "delay,changed", _value_slider_changed, evas_object_smart_callback_add(slider, "delay,changed", _value_slider_changed,
ehsv); ehsv);
elm_box_pack_start(ehsv->editor, slider); elm_box_pack_start(ehsv->editor, slider);
evas_object_show(slider); evas_object_show(slider);
ehsv->vslider = slider; ehsv->vslider = slider;
@ -359,7 +359,7 @@ ephoto_hsv_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje
EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
evas_object_smart_callback_add(slider, "delay,changed", evas_object_smart_callback_add(slider, "delay,changed",
_saturation_slider_changed, ehsv); _saturation_slider_changed, ehsv);
elm_box_pack_start(ehsv->editor, slider); elm_box_pack_start(ehsv->editor, slider);
evas_object_show(slider); evas_object_show(slider);
ehsv->sslider = slider; ehsv->sslider = slider;
@ -374,25 +374,26 @@ ephoto_hsv_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje
EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
evas_object_smart_callback_add(slider, "delay,changed", evas_object_smart_callback_add(slider, "delay,changed",
_hue_slider_changed, ehsv); _hue_slider_changed, ehsv);
elm_box_pack_start(ehsv->editor, slider); elm_box_pack_start(ehsv->editor, slider);
evas_object_show(slider); evas_object_show(slider);
ehsv->hslider = slider; ehsv->hslider = slider;
ehsv->handlers = ehsv->handlers =
eina_list_append(ehsv->handlers, eina_list_append(ehsv->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET,
_hsv_reset, ehsv)); _hsv_reset, ehsv));
ehsv->handlers = ehsv->handlers =
eina_list_append(ehsv->handlers, eina_list_append(ehsv->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY,
_hsv_apply, ehsv)); _hsv_apply, ehsv));
ehsv->handlers = ehsv->handlers =
eina_list_append(ehsv->handlers, eina_list_append(ehsv->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL,
_hsv_cancel, ehsv)); _hsv_cancel, ehsv));
return; return;
error: error:
return; return;
} }

View File

@ -1,6 +1,6 @@
#include "ephoto.h" #include "ephoto.h"
#undef ERR #undef ERR
#define ERR(...) do { printf(__VA_ARGS__); putc('\n', stdout); } while(0) #define ERR(...) do { printf(__VA_ARGS__); putc('\n', stdout); } while (0)
#ifdef USE_IPC #ifdef USE_IPC
/* local subsystem functions */ /* local subsystem functions */
@ -22,7 +22,7 @@ e_ipc_init(void)
snprintf(port_str, sizeof(port_str), "%d", port); snprintf(port_str, sizeof(port_str), "%d", port);
setenv("EPHOTO_IPC_PORT", port_str, 1); setenv("EPHOTO_IPC_PORT", port_str, 1);
_e_ipc_server = ecore_ipc_server_add _e_ipc_server = ecore_ipc_server_add
(ECORE_IPC_LOCAL_SYSTEM, "ephoto", port, NULL); (ECORE_IPC_LOCAL_SYSTEM, "ephoto", port, NULL);
if (!_e_ipc_server) if (!_e_ipc_server)
{ {
ERR("Couldn't create Ephoto IPC server port=%d", port); ERR("Couldn't create Ephoto IPC server port=%d", port);

View File

@ -12,17 +12,17 @@ int EPHOTO_EVENT_EDITOR_BACK = 0;
typedef struct _Ephoto_Entry_Free_Listener Ephoto_Entry_Free_Listener; typedef struct _Ephoto_Entry_Free_Listener Ephoto_Entry_Free_Listener;
struct _Ephoto_Entry_Free_Listener struct _Ephoto_Entry_Free_Listener
{ {
void (*cb) (void *data, const Ephoto_Entry *dead); void (*cb)(void *data, const Ephoto_Entry *dead);
const void *data; const void *data;
}; };
typedef struct _Ephoto_Dir_Data Ephoto_Dir_Data; typedef struct _Ephoto_Dir_Data Ephoto_Dir_Data;
struct _Ephoto_Dir_Data struct _Ephoto_Dir_Data
{ {
Ephoto *ephoto; Ephoto *ephoto;
Elm_Object_Item *expanded; Elm_Object_Item *expanded;
Eina_Bool dirs_only; Eina_Bool dirs_only;
Eina_Bool thumbs_only; Eina_Bool thumbs_only;
}; };
static void static void
@ -72,13 +72,13 @@ _ephoto_single_browser_show(Ephoto *ephoto, Ephoto_Entry *entry)
{ {
if (ephoto->selentries) if (ephoto->selentries)
ephoto_single_browser_entries_set(ephoto->single_browser, ephoto_single_browser_entries_set(ephoto->single_browser,
ephoto->selentries); ephoto->selentries);
else if (ephoto->searchentries) else if (ephoto->searchentries)
ephoto_single_browser_entries_set(ephoto->single_browser, ephoto_single_browser_entries_set(ephoto->single_browser,
ephoto->searchentries); ephoto->searchentries);
else else
ephoto_single_browser_entries_set(ephoto->single_browser, ephoto_single_browser_entries_set(ephoto->single_browser,
ephoto->entries); ephoto->entries);
ephoto_single_browser_entry_set(ephoto->single_browser, entry); ephoto_single_browser_entry_set(ephoto->single_browser, entry);
evas_object_hide(ephoto->slideshow); evas_object_hide(ephoto->slideshow);
@ -122,7 +122,7 @@ _ephoto_slideshow_show(Ephoto *ephoto, Ephoto_Entry *entry)
static void static void
_ephoto_single_browser_back(void *data, Evas_Object *obj EINA_UNUSED, _ephoto_single_browser_back(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info) void *event_info)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
Ephoto_Entry *entry = event_info; Ephoto_Entry *entry = event_info;
@ -133,25 +133,25 @@ _ephoto_single_browser_back(void *data, Evas_Object *obj EINA_UNUSED,
static void static void
_ephoto_slideshow_back(void *data, Evas_Object *obj EINA_UNUSED, _ephoto_slideshow_back(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info) void *event_info)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
Ephoto_Entry *entry = event_info; Ephoto_Entry *entry = event_info;
switch (ephoto->prev_state) switch (ephoto->prev_state)
{ {
case EPHOTO_STATE_SINGLE: case EPHOTO_STATE_SINGLE:
_ephoto_single_browser_show(ephoto, entry); _ephoto_single_browser_show(ephoto, entry);
break; break;
case EPHOTO_STATE_THUMB: case EPHOTO_STATE_THUMB:
ephoto->selentries = NULL; ephoto->selentries = NULL;
_ephoto_thumb_browser_show(ephoto, entry); _ephoto_thumb_browser_show(ephoto, entry);
break; break;
default: default:
ephoto->selentries = NULL; ephoto->selentries = NULL;
_ephoto_thumb_browser_show(ephoto, entry); _ephoto_thumb_browser_show(ephoto, entry);
} }
if (ephoto->folders_toggle) if (ephoto->folders_toggle)
{ {
@ -164,7 +164,7 @@ _ephoto_slideshow_back(void *data, Evas_Object *obj EINA_UNUSED,
static void static void
_ephoto_thumb_browser_view(void *data, Evas_Object *obj EINA_UNUSED, _ephoto_thumb_browser_view(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info) void *event_info)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
Ephoto_Entry *entry = event_info; Ephoto_Entry *entry = event_info;
@ -174,7 +174,7 @@ _ephoto_thumb_browser_view(void *data, Evas_Object *obj EINA_UNUSED,
static void static void
_ephoto_thumb_browser_changed_directory(void *data, _ephoto_thumb_browser_changed_directory(void *data,
Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
@ -185,7 +185,7 @@ _ephoto_thumb_browser_changed_directory(void *data,
static void static void
_ephoto_thumb_browser_slideshow(void *data, Evas_Object *obj EINA_UNUSED, _ephoto_thumb_browser_slideshow(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info) void *event_info)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
Ephoto_Entry *entry = event_info; Ephoto_Entry *entry = event_info;
@ -195,7 +195,7 @@ _ephoto_thumb_browser_slideshow(void *data, Evas_Object *obj EINA_UNUSED,
static void static void
_ephoto_single_browser_slideshow(void *data, Evas_Object *obj EINA_UNUSED, _ephoto_single_browser_slideshow(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info) void *event_info)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
Ephoto_Entry *entry = event_info; Ephoto_Entry *entry = event_info;
@ -205,7 +205,7 @@ _ephoto_single_browser_slideshow(void *data, Evas_Object *obj EINA_UNUSED,
static void static void
_win_free(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _win_free(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
Ecore_Event_Handler *handler; Ecore_Event_Handler *handler;
@ -213,7 +213,7 @@ _win_free(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
if (ephoto->file_thread) if (ephoto->file_thread)
ecore_thread_cancel(ephoto->file_thread); ecore_thread_cancel(ephoto->file_thread);
if (eina_list_count(ephoto->file_pos)) if (eina_list_count(ephoto->file_pos))
eina_list_free(ephoto->file_pos); eina_list_free(ephoto->file_pos);
if (ephoto->upload_handlers) if (ephoto->upload_handlers)
EINA_LIST_FREE(ephoto->upload_handlers, handler) EINA_LIST_FREE(ephoto->upload_handlers, handler)
ecore_event_handler_del(handler); ecore_event_handler_del(handler);
@ -245,7 +245,7 @@ _win_free(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
static void static void
_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
Evas_Coord w, h; Evas_Coord w, h;
@ -255,14 +255,14 @@ _resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
evas_object_geometry_get(ephoto->win, 0, 0, &w, &h); evas_object_geometry_get(ephoto->win, 0, 0, &w, &h);
if (w && h) if (w && h)
{ {
ephoto->config->window_width = w; ephoto->config->window_width = w;
ephoto->config->window_height = h; ephoto->config->window_height = h;
} }
} }
static void static void
_folder_icon_clicked(void *data, Evas_Object *obj, _folder_icon_clicked(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
int ret = 0; int ret = 0;
@ -273,7 +273,7 @@ _folder_icon_clicked(void *data, Evas_Object *obj,
elm_box_pack_start(ephoto->layout, ephoto->dir_browser); elm_box_pack_start(ephoto->layout, ephoto->dir_browser);
ephoto->folders_toggle = EINA_TRUE; ephoto->folders_toggle = EINA_TRUE;
ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open"); ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open");
if (!ret) if (!ret)
elm_object_text_set(obj, _("Hide Folders")); elm_object_text_set(obj, _("Hide Folders"));
elm_object_tooltip_text_set(obj, _("Hide Folders")); elm_object_tooltip_text_set(obj, _("Hide Folders"));
} }
@ -283,7 +283,7 @@ _folder_icon_clicked(void *data, Evas_Object *obj,
elm_box_unpack(ephoto->layout, ephoto->dir_browser); elm_box_unpack(ephoto->layout, ephoto->dir_browser);
ephoto->folders_toggle = EINA_FALSE; ephoto->folders_toggle = EINA_FALSE;
ret = elm_icon_standard_set(ephoto->folders_icon, "folder"); ret = elm_icon_standard_set(ephoto->folders_icon, "folder");
if (!ret) if (!ret)
elm_object_text_set(obj, _("Show Folders")); elm_object_text_set(obj, _("Show Folders"));
elm_object_tooltip_text_set(obj, _("Show Folders")); elm_object_tooltip_text_set(obj, _("Show Folders"));
} }
@ -292,7 +292,7 @@ _folder_icon_clicked(void *data, Evas_Object *obj,
/*Ephoto Thumb Browser Main Callbacks*/ /*Ephoto Thumb Browser Main Callbacks*/
static void static void
_slideshow_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, _slideshow_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
@ -302,10 +302,9 @@ _slideshow_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED,
ephoto_single_browser_slideshow(ephoto->single_browser); ephoto_single_browser_slideshow(ephoto->single_browser);
} }
static void static void
_settings_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, _settings_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
@ -314,7 +313,7 @@ _settings_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED,
static void static void
_exit_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, _exit_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
@ -331,11 +330,11 @@ ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle)
{ {
evas_object_show(ephoto->dir_browser); evas_object_show(ephoto->dir_browser);
elm_box_pack_end(ephoto->layout, ephoto->dir_browser); elm_box_pack_end(ephoto->layout, ephoto->dir_browser);
ephoto->folders_toggle = EINA_TRUE; ephoto->folders_toggle = EINA_TRUE;
ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open"); ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open");
if (!ret) if (!ret)
elm_object_text_set(ephoto->folders_button, _("Hide Folders")); elm_object_text_set(ephoto->folders_button, _("Hide Folders"));
elm_object_tooltip_text_set(ephoto->folders_button, _("Hide Folders")); elm_object_tooltip_text_set(ephoto->folders_button, _("Hide Folders"));
} }
else if (ephoto->folders_toggle) else if (ephoto->folders_toggle)
{ {
@ -345,7 +344,7 @@ ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle)
ret = elm_icon_standard_set(ephoto->folders_icon, "folder"); ret = elm_icon_standard_set(ephoto->folders_icon, "folder");
if (!ret) if (!ret)
elm_object_text_set(ephoto->folders_button, _("Show Folders")); elm_object_text_set(ephoto->folders_button, _("Show Folders"));
elm_object_tooltip_text_set(ephoto->folders_button, _("Show Folders")); elm_object_tooltip_text_set(ephoto->folders_button, _("Show Folders"));
} }
} }
@ -375,26 +374,26 @@ ephoto_window_add(const char *path)
ephoto->win = elm_win_util_standard_add("ephoto", "Ephoto"); ephoto->win = elm_win_util_standard_add("ephoto", "Ephoto");
if (!ephoto->win) if (!ephoto->win)
{ {
free(ephoto); free(ephoto);
return NULL; return NULL;
} }
evas_object_event_callback_add(ephoto->win, EVAS_CALLBACK_FREE, evas_object_event_callback_add(ephoto->win, EVAS_CALLBACK_FREE,
_win_free, ephoto); _win_free, ephoto);
evas_object_event_callback_add(ephoto->win, EVAS_CALLBACK_RESIZE, evas_object_event_callback_add(ephoto->win, EVAS_CALLBACK_RESIZE,
_resize_cb, ephoto); _resize_cb, ephoto);
elm_win_autodel_set(ephoto->win, EINA_TRUE); elm_win_autodel_set(ephoto->win, EINA_TRUE);
if (!ephoto_config_init(ephoto)) if (!ephoto_config_init(ephoto))
{ {
evas_object_del(ephoto->win); evas_object_del(ephoto->win);
return NULL; return NULL;
} }
if ((ephoto->config->thumb_gen_size != 128) && if ((ephoto->config->thumb_gen_size != 128) &&
(ephoto->config->thumb_gen_size != 256) && (ephoto->config->thumb_gen_size != 256) &&
(ephoto->config->thumb_gen_size != 512)) (ephoto->config->thumb_gen_size != 512))
ephoto_thumb_size_set(ephoto, ephoto->config->thumb_size); ephoto_thumb_size_set(ephoto, ephoto->config->thumb_size);
ephoto->main = elm_table_add(ephoto->win); ephoto->main = elm_table_add(ephoto->win);
elm_table_homogeneous_set(ephoto->main, EINA_FALSE); elm_table_homogeneous_set(ephoto->main, EINA_FALSE);
@ -420,37 +419,37 @@ ephoto_window_add(const char *path)
ephoto->thumb_browser = ephoto_thumb_browser_add(ephoto, ephoto->layout); ephoto->thumb_browser = ephoto_thumb_browser_add(ephoto, ephoto->layout);
if (!ephoto->thumb_browser) if (!ephoto->thumb_browser)
{ {
evas_object_del(ephoto->win); evas_object_del(ephoto->win);
return NULL; return NULL;
} }
elm_table_pack(ephoto->pager, ephoto->thumb_browser, 0, 0, 1, 1); elm_table_pack(ephoto->pager, ephoto->thumb_browser, 0, 0, 1, 1);
evas_object_smart_callback_add(ephoto->thumb_browser, "view", evas_object_smart_callback_add(ephoto->thumb_browser, "view",
_ephoto_thumb_browser_view, ephoto); _ephoto_thumb_browser_view, ephoto);
evas_object_smart_callback_add(ephoto->thumb_browser, "changed,directory", evas_object_smart_callback_add(ephoto->thumb_browser, "changed,directory",
_ephoto_thumb_browser_changed_directory, ephoto); _ephoto_thumb_browser_changed_directory, ephoto);
evas_object_smart_callback_add(ephoto->thumb_browser, "slideshow", evas_object_smart_callback_add(ephoto->thumb_browser, "slideshow",
_ephoto_thumb_browser_slideshow, ephoto); _ephoto_thumb_browser_slideshow, ephoto);
ephoto->single_browser = ephoto_single_browser_add(ephoto, ephoto->layout); ephoto->single_browser = ephoto_single_browser_add(ephoto, ephoto->layout);
if (!ephoto->single_browser) if (!ephoto->single_browser)
{ {
evas_object_del(ephoto->win); evas_object_del(ephoto->win);
return NULL; return NULL;
} }
elm_table_pack(ephoto->pager, ephoto->single_browser, 0, 0, 1, 1); elm_table_pack(ephoto->pager, ephoto->single_browser, 0, 0, 1, 1);
evas_object_smart_callback_add(ephoto->single_browser, "back", evas_object_smart_callback_add(ephoto->single_browser, "back",
_ephoto_single_browser_back, ephoto); _ephoto_single_browser_back, ephoto);
evas_object_smart_callback_add(ephoto->single_browser, "slideshow", evas_object_smart_callback_add(ephoto->single_browser, "slideshow",
_ephoto_single_browser_slideshow, ephoto); _ephoto_single_browser_slideshow, ephoto);
ephoto->slideshow = ephoto_slideshow_add(ephoto, ephoto->layout); ephoto->slideshow = ephoto_slideshow_add(ephoto, ephoto->layout);
if (!ephoto->slideshow) if (!ephoto->slideshow)
{ {
evas_object_del(ephoto->win); evas_object_del(ephoto->win);
return NULL; return NULL;
} }
elm_table_pack(ephoto->pager, ephoto->slideshow, 0, 0, 1, 1); elm_table_pack(ephoto->pager, ephoto->slideshow, 0, 0, 1, 1);
evas_object_smart_callback_add(ephoto->slideshow, "back", evas_object_smart_callback_add(ephoto->slideshow, "back",
_ephoto_slideshow_back, ephoto); _ephoto_slideshow_back, ephoto);
ephoto->dir_browser = ephoto_directory_browser_add(ephoto, ephoto->layout); ephoto->dir_browser = ephoto_directory_browser_add(ephoto, ephoto->layout);
EPHOTO_WEIGHT(ephoto->dir_browser, ephoto->config->left_size, EVAS_HINT_EXPAND); EPHOTO_WEIGHT(ephoto->dir_browser, ephoto->config->left_size, EVAS_HINT_EXPAND);
@ -459,8 +458,8 @@ ephoto_window_add(const char *path)
evas_object_show(ephoto->dir_browser); evas_object_show(ephoto->dir_browser);
ephoto->statusbar = elm_box_add(ephoto->main); ephoto->statusbar = elm_box_add(ephoto->main);
evas_object_size_hint_min_set(ephoto->statusbar, 20*elm_config_scale_get(), evas_object_size_hint_min_set(ephoto->statusbar, 20 * elm_config_scale_get(),
20*elm_config_scale_get()); 20 * elm_config_scale_get());
elm_box_horizontal_set(ephoto->statusbar, EINA_TRUE); elm_box_horizontal_set(ephoto->statusbar, EINA_TRUE);
EPHOTO_WEIGHT(ephoto->statusbar, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_WEIGHT(ephoto->statusbar, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
EPHOTO_FILL(ephoto->statusbar); EPHOTO_FILL(ephoto->statusbar);
@ -468,8 +467,8 @@ ephoto_window_add(const char *path)
evas_object_show(ephoto->statusbar); evas_object_show(ephoto->statusbar);
ic = elm_icon_add(ephoto->statusbar); ic = elm_icon_add(ephoto->statusbar);
evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
20*elm_config_scale_get()); 20 * elm_config_scale_get());
ret = elm_icon_standard_set(ic, "folder"); ret = elm_icon_standard_set(ic, "folder");
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
ephoto->folders_icon = ic; ephoto->folders_icon = ic;
@ -511,8 +510,8 @@ ephoto_window_add(const char *path)
evas_object_show(ephoto->controls_right); evas_object_show(ephoto->controls_right);
ic = elm_icon_add(ephoto->statusbar); ic = elm_icon_add(ephoto->statusbar);
evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
20*elm_config_scale_get()); 20 * elm_config_scale_get());
ret = elm_icon_standard_set(ic, "media-playback-start"); ret = elm_icon_standard_set(ic, "media-playback-start");
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
@ -521,15 +520,15 @@ ephoto_window_add(const char *path)
if (!ret) if (!ret)
elm_object_text_set(but, _("Slideshow")); elm_object_text_set(but, _("Slideshow"));
evas_object_smart_callback_add(but, "clicked", evas_object_smart_callback_add(but, "clicked",
_slideshow_icon_clicked, ephoto); _slideshow_icon_clicked, ephoto);
elm_object_tooltip_text_set(but, _("Slideshow")); elm_object_tooltip_text_set(but, _("Slideshow"));
elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_TOP); elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_TOP);
elm_box_pack_end(ephoto->statusbar, but); elm_box_pack_end(ephoto->statusbar, but);
evas_object_show(but); evas_object_show(but);
ic = elm_icon_add(ephoto->statusbar); ic = elm_icon_add(ephoto->statusbar);
evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
20*elm_config_scale_get()); 20 * elm_config_scale_get());
ret = elm_icon_standard_set(ic, "preferences-other"); ret = elm_icon_standard_set(ic, "preferences-other");
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
@ -538,15 +537,15 @@ ephoto_window_add(const char *path)
if (!ret) if (!ret)
elm_object_text_set(but, _("Settings")); elm_object_text_set(but, _("Settings"));
evas_object_smart_callback_add(but, "clicked", evas_object_smart_callback_add(but, "clicked",
_settings_icon_clicked, ephoto); _settings_icon_clicked, ephoto);
elm_object_tooltip_text_set(but, _("Settings")); elm_object_tooltip_text_set(but, _("Settings"));
elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_TOP); elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_TOP);
elm_box_pack_end(ephoto->statusbar, but); elm_box_pack_end(ephoto->statusbar, but);
evas_object_show(but); evas_object_show(but);
ic = elm_icon_add(ephoto->statusbar); ic = elm_icon_add(ephoto->statusbar);
evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
20*elm_config_scale_get()); 20 * elm_config_scale_get());
ret = elm_icon_standard_set(ic, "application-exit"); ret = elm_icon_standard_set(ic, "application-exit");
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
@ -555,29 +554,29 @@ ephoto_window_add(const char *path)
if (!ret) if (!ret)
elm_object_text_set(ephoto->exit, _("Exit")); elm_object_text_set(ephoto->exit, _("Exit"));
evas_object_smart_callback_add(ephoto->exit, "clicked", evas_object_smart_callback_add(ephoto->exit, "clicked",
_exit_icon_clicked, ephoto); _exit_icon_clicked, ephoto);
elm_object_tooltip_text_set(ephoto->exit, _("Exit")); elm_object_tooltip_text_set(ephoto->exit, _("Exit"));
elm_object_tooltip_orient_set(ephoto->exit, ELM_TOOLTIP_ORIENT_TOP); elm_object_tooltip_orient_set(ephoto->exit, ELM_TOOLTIP_ORIENT_TOP);
evas_object_hide(ephoto->exit); evas_object_hide(ephoto->exit);
if ((!path) || (!ecore_file_exists(path))) if ((!path) || (!ecore_file_exists(path)))
{ {
if (ephoto->config->open) if (ephoto->config->open)
{ {
if (!strcmp(ephoto->config->open, "Last")) if (!strcmp(ephoto->config->open, "Last"))
path = ephoto->config->directory; path = ephoto->config->directory;
else else
path = ephoto->config->open; path = ephoto->config->open;
if ((path) && (!ecore_file_exists(path))) if ((path) && (!ecore_file_exists(path)))
path = NULL; path = NULL;
} }
else if (!ephoto->config->open || path) else if (!ephoto->config->open || path)
{ {
if (getcwd(buf, sizeof(buf))) if (getcwd(buf, sizeof(buf)))
path = buf; path = buf;
else else
path = eina_environment_home_get(); path = eina_environment_home_get();
} }
} }
if (ecore_file_is_dir(path)) if (ecore_file_is_dir(path))
@ -585,22 +584,22 @@ ephoto_window_add(const char *path)
char *rp = ecore_file_realpath(path); char *rp = ecore_file_realpath(path);
eina_stringshare_replace(&ephoto->config->directory, rp); eina_stringshare_replace(&ephoto->config->directory, rp);
free(rp); free(rp);
_ephoto_thumb_browser_show(ephoto, NULL); _ephoto_thumb_browser_show(ephoto, NULL);
} }
else else
{ {
char *dir = ecore_file_dir_get(path); char *dir = ecore_file_dir_get(path);
char *rp = ecore_file_realpath(dir); char *rp = ecore_file_realpath(dir);
eina_stringshare_replace(&ephoto->config->directory, rp); eina_stringshare_replace(&ephoto->config->directory, rp);
free(rp); free(rp);
free(dir); free(dir);
ephoto_single_browser_path_pending_set(ephoto->single_browser, path); ephoto_single_browser_path_pending_set(ephoto->single_browser, path);
evas_object_hide(ephoto->thumb_browser); evas_object_hide(ephoto->thumb_browser);
evas_object_hide(ephoto->slideshow); evas_object_hide(ephoto->slideshow);
evas_object_show(ephoto->single_browser); evas_object_show(ephoto->single_browser);
ephoto_single_browser_show_controls(ephoto); ephoto_single_browser_show_controls(ephoto);
ephoto->state = EPHOTO_STATE_SINGLE; ephoto->state = EPHOTO_STATE_SINGLE;
} }
snprintf(config, PATH_MAX, "%s/.config/ephoto", eina_environment_home_get()); snprintf(config, PATH_MAX, "%s/.config/ephoto", eina_environment_home_get());
@ -611,7 +610,7 @@ ephoto_window_add(const char *path)
ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory); ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory);
ephoto_directory_browser_initialize_structure(ephoto); ephoto_directory_browser_initialize_structure(ephoto);
evas_object_resize(ephoto->win, ephoto->config->window_width, evas_object_resize(ephoto->win, ephoto->config->window_width,
ephoto->config->window_height); ephoto->config->window_height);
evas_object_show(ephoto->win); evas_object_show(ephoto->win);
if (!ephoto->config->folders) if (!ephoto->config->folders)
@ -620,17 +619,17 @@ ephoto_window_add(const char *path)
elm_box_unpack(ephoto->layout, ephoto->dir_browser); elm_box_unpack(ephoto->layout, ephoto->dir_browser);
ephoto->folders_toggle = EINA_FALSE; ephoto->folders_toggle = EINA_FALSE;
ret = elm_icon_standard_set(ephoto->folders_icon, "folder"); ret = elm_icon_standard_set(ephoto->folders_icon, "folder");
if (!ret) if (!ret)
elm_object_text_set(ephoto->folders_button, _("Show Folders")); elm_object_text_set(ephoto->folders_button, _("Show Folders"));
elm_object_tooltip_text_set(ephoto->folders_button, _("Show Folders")); elm_object_tooltip_text_set(ephoto->folders_button, _("Show Folders"));
} }
else else
{ {
ephoto->folders_toggle = EINA_TRUE; ephoto->folders_toggle = EINA_TRUE;
ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open"); ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open");
if (!ret) if (!ret)
elm_object_text_set(ephoto->folders_button, _("Hide Folders")); elm_object_text_set(ephoto->folders_button, _("Hide Folders"));
elm_object_tooltip_text_set(ephoto->folders_button, _("Hide Folders")); elm_object_tooltip_text_set(ephoto->folders_button, _("Hide Folders"));
} }
if (ephoto->config->firstrun) if (ephoto->config->firstrun)
{ {
@ -648,11 +647,11 @@ ephoto_title_set(Ephoto *ephoto, const char *title)
if (title) if (title)
{ {
snprintf(buf, sizeof(buf), "Ephoto - %s", title); snprintf(buf, sizeof(buf), "Ephoto - %s", title);
elm_win_title_set(ephoto->win, buf); elm_win_title_set(ephoto->win, buf);
} }
else else
elm_win_title_set(ephoto->win, "Ephoto"); elm_win_title_set(ephoto->win, "Ephoto");
} }
int int
@ -667,38 +666,43 @@ ephoto_entries_cmp(const void *pa, const void *pb)
modb = ecore_file_mod_time(b->path); modb = ecore_file_mod_time(b->path);
switch (a->ephoto->sort) switch (a->ephoto->sort)
{ {
case EPHOTO_SORT_ALPHABETICAL_ASCENDING: case EPHOTO_SORT_ALPHABETICAL_ASCENDING:
return i; return i;
case EPHOTO_SORT_ALPHABETICAL_DESCENDING:
return i * -1; case EPHOTO_SORT_ALPHABETICAL_DESCENDING:
case EPHOTO_SORT_MODTIME_ASCENDING: return i * -1;
if (moda < modb)
return -1; case EPHOTO_SORT_MODTIME_ASCENDING:
else if (moda > modb) if (moda < modb)
return 1; return -1;
else else if (moda > modb)
return i; return 1;
case EPHOTO_SORT_MODTIME_DESCENDING: else
if (moda < modb) return i;
return 1;
else if (moda > modb) case EPHOTO_SORT_MODTIME_DESCENDING:
return -1; if (moda < modb)
else return 1;
return i * -1; else if (moda > modb)
case EPHOTO_SORT_SIMILARITY: return -1;
if (!a->sort_id || !b->sort_id) else
return 0; return i * -1;
else
return strcmp(a->sort_id, b->sort_id); case EPHOTO_SORT_SIMILARITY:
default: if (!a->sort_id || !b->sort_id)
return i; return 0;
else
return strcmp(a->sort_id, b->sort_id);
default:
return i;
} }
return i; return i;
} }
static void static void
_ephoto_populate_main(void *data, Eio_File *handler EINA_UNUSED, _ephoto_populate_main(void *data, Eio_File *handler EINA_UNUSED,
const Eina_File_Direct_Info *info) const Eina_File_Direct_Info *info)
{ {
Ephoto_Dir_Data *ed = data; Ephoto_Dir_Data *ed = data;
Ephoto_Entry *e; Ephoto_Entry *e;
@ -707,7 +711,7 @@ _ephoto_populate_main(void *data, Eio_File *handler EINA_UNUSED,
if (ephoto_entry_exists(ed->ephoto, info->path)) if (ephoto_entry_exists(ed->ephoto, info->path))
return; return;
e = ephoto_entry_new(ed->ephoto, info->path, info->path + info->name_start, e = ephoto_entry_new(ed->ephoto, info->path, info->path + info->name_start,
info->type); info->type);
if (e->is_dir) if (e->is_dir)
e->parent = ed->expanded; e->parent = ed->expanded;
@ -715,26 +719,26 @@ _ephoto_populate_main(void *data, Eio_File *handler EINA_UNUSED,
{ {
if (ed->ephoto->sort != EPHOTO_SORT_SIMILARITY) if (ed->ephoto->sort != EPHOTO_SORT_SIMILARITY)
{ {
if (!ed->ephoto->entries) if (!ed->ephoto->entries)
ed->ephoto->entries = eina_list_append(ed->ephoto->entries, e); ed->ephoto->entries = eina_list_append(ed->ephoto->entries, e);
else else
{ {
int near_cmp; int near_cmp;
Eina_List *near_node = Eina_List *near_node =
eina_list_search_sorted_near_list(ed->ephoto->entries, eina_list_search_sorted_near_list(ed->ephoto->entries,
ephoto_entries_cmp, e, &near_cmp); ephoto_entries_cmp, e, &near_cmp);
if (near_cmp < 0) if (near_cmp < 0)
ed->ephoto->entries = ed->ephoto->entries =
eina_list_append_relative_list(ed->ephoto->entries, e, eina_list_append_relative_list(ed->ephoto->entries, e,
near_node); near_node);
else else
ed->ephoto->entries = ed->ephoto->entries =
eina_list_prepend_relative_list(ed->ephoto->entries, e, eina_list_prepend_relative_list(ed->ephoto->entries, e,
near_node); near_node);
} }
} }
e->parent = NULL; e->parent = NULL;
} }
ev = calloc(1, sizeof(Ephoto_Event_Entry_Create)); ev = calloc(1, sizeof(Ephoto_Event_Entry_Create));
ev->entry = e; ev->entry = e;
@ -744,14 +748,14 @@ _ephoto_populate_main(void *data, Eio_File *handler EINA_UNUSED,
static Eina_Bool static Eina_Bool
_ephoto_populate_filter(void *data, Eio_File *handler EINA_UNUSED, _ephoto_populate_filter(void *data, Eio_File *handler EINA_UNUSED,
const Eina_File_Direct_Info *info) const Eina_File_Direct_Info *info)
{ {
Ephoto_Dir_Data *ed = data; Ephoto_Dir_Data *ed = data;
const char *bname = info->path + info->name_start; const char *bname = info->path + info->name_start;
char *rp; char *rp;
if (bname[0] == '.') if (bname[0] == '.')
return EINA_FALSE; return EINA_FALSE;
rp = ecore_file_realpath(info->path); rp = ecore_file_realpath(info->path);
if (info->type == EINA_FILE_DIR && !ed->thumbs_only) if (info->type == EINA_FILE_DIR && !ed->thumbs_only)
{ {
@ -787,7 +791,7 @@ _ephoto_populate_end(void *data, Eio_File *handler EINA_UNUSED)
if (eina_list_count(ed->ephoto->entries)) if (eina_list_count(ed->ephoto->entries))
ephoto_single_browser_entries_set(ed->ephoto->single_browser, ephoto_single_browser_entries_set(ed->ephoto->single_browser,
ed->ephoto->entries); ed->ephoto->entries);
ecore_event_add(EPHOTO_EVENT_POPULATE_END, NULL, NULL, NULL); ecore_event_add(EPHOTO_EVENT_POPULATE_END, NULL, NULL, NULL);
free(ed); free(ed);
} }
@ -814,9 +818,9 @@ _ephoto_populate_entries(Ephoto_Dir_Data *ed)
ed->ephoto->entries = NULL; ed->ephoto->entries = NULL;
ed->ephoto->ls = ed->ephoto->ls =
eio_file_stat_ls(ed->ephoto->config->directory, _ephoto_populate_filter, eio_file_stat_ls(ed->ephoto->config->directory, _ephoto_populate_filter,
_ephoto_populate_main, _ephoto_populate_end, _ephoto_populate_error, _ephoto_populate_main, _ephoto_populate_end, _ephoto_populate_error,
ed); ed);
ecore_event_add(EPHOTO_EVENT_POPULATE_START, NULL, NULL, NULL); ecore_event_add(EPHOTO_EVENT_POPULATE_START, NULL, NULL, NULL);
} }
@ -832,7 +836,7 @@ _ephoto_change_dir(void *data)
static Eina_Bool static Eina_Bool
_monitor_cb(void *data, int type, _monitor_cb(void *data, int type,
void *event) void *event)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
Eio_Monitor_Event *ev = event; Eio_Monitor_Event *ev = event;
@ -860,7 +864,7 @@ _monitor_cb(void *data, int type,
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
snprintf(buf, PATH_MAX, "%s", ev->filename); snprintf(buf, PATH_MAX, "%s", ev->filename);
entry = ephoto_entry_new(ephoto, ev->filename, basename(buf), entry = ephoto_entry_new(ephoto, ev->filename, basename(buf),
EINA_FILE_REG); EINA_FILE_REG);
ephoto_single_browser_path_created(ephoto->single_browser, entry); ephoto_single_browser_path_created(ephoto->single_browser, entry);
if (!ephoto->entries) if (!ephoto->entries)
{ {
@ -870,17 +874,17 @@ _monitor_cb(void *data, int type,
{ {
int near_cmp; int near_cmp;
Eina_List *near_node = Eina_List *near_node =
eina_list_search_sorted_near_list(ephoto->entries, eina_list_search_sorted_near_list(ephoto->entries,
ephoto_entries_cmp, entry, &near_cmp); ephoto_entries_cmp, entry, &near_cmp);
if (near_cmp < 0) if (near_cmp < 0)
ephoto->entries = ephoto->entries =
eina_list_append_relative_list(ephoto->entries, entry, eina_list_append_relative_list(ephoto->entries, entry,
near_node); near_node);
else else
ephoto->entries = ephoto->entries =
eina_list_prepend_relative_list(ephoto->entries, entry, eina_list_prepend_relative_list(ephoto->entries, entry,
near_node); near_node);
} }
ephoto_thumb_browser_insert(ephoto, entry); ephoto_thumb_browser_insert(ephoto, entry);
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
@ -920,7 +924,7 @@ _monitor_cb(void *data, int type,
void void
ephoto_directory_set(Ephoto *ephoto, const char *path, Evas_Object *expanded, ephoto_directory_set(Ephoto *ephoto, const char *path, Evas_Object *expanded,
Eina_Bool dirs_only, Eina_Bool thumbs_only) Eina_Bool dirs_only, Eina_Bool thumbs_only)
{ {
Ephoto_Dir_Data *ed; Ephoto_Dir_Data *ed;
Ecore_Event_Handler *handler; Ecore_Event_Handler *handler;
@ -947,7 +951,7 @@ ephoto_directory_set(Ephoto *ephoto, const char *path, Evas_Object *expanded,
eina_stringshare_replace(&ephoto->config->directory, rp); eina_stringshare_replace(&ephoto->config->directory, rp);
if (ed->ephoto->job.change_dir) if (ed->ephoto->job.change_dir)
ecore_job_del(ed->ephoto->job.change_dir); ecore_job_del(ed->ephoto->job.change_dir);
ed->ephoto->job.change_dir = ecore_job_add(_ephoto_change_dir, ed); ed->ephoto->job.change_dir = ecore_job_add(_ephoto_change_dir, ed);
if (ephoto->monitor) if (ephoto->monitor)
{ {
@ -957,17 +961,17 @@ ephoto_directory_set(Ephoto *ephoto, const char *path, Evas_Object *expanded,
} }
ephoto->monitor = eio_monitor_add(path); ephoto->monitor = eio_monitor_add(path);
ephoto->monitor_handlers = ephoto->monitor_handlers =
eina_list_append(ephoto->monitor_handlers, eina_list_append(ephoto->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, ecore_event_handler_add(EIO_MONITOR_FILE_CREATED,
_monitor_cb, ephoto)); _monitor_cb, ephoto));
ephoto->monitor_handlers = ephoto->monitor_handlers =
eina_list_append(ephoto->monitor_handlers, eina_list_append(ephoto->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED,
_monitor_cb, ephoto)); _monitor_cb, ephoto));
ephoto->monitor_handlers = ephoto->monitor_handlers =
eina_list_append(ephoto->monitor_handlers, eina_list_append(ephoto->monitor_handlers,
ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, ecore_event_handler_add(EIO_MONITOR_FILE_DELETED,
_monitor_cb, ephoto)); _monitor_cb, ephoto));
free(rp); free(rp);
} }
@ -979,17 +983,17 @@ _thumb_gen_size_changed_timer_cb(void *data)
Evas_Object *o; Evas_Object *o;
if (ephoto->config->thumb_gen_size == ephoto->thumb_gen_size) if (ephoto->config->thumb_gen_size == ephoto->thumb_gen_size)
goto end; goto end;
ephoto->config->thumb_gen_size = ephoto->thumb_gen_size; ephoto->config->thumb_gen_size = ephoto->thumb_gen_size;
EINA_LIST_FOREACH(ephoto->thumbs, l, o) EINA_LIST_FOREACH(ephoto->thumbs, l, o)
{ {
e_thumb_icon_size_set(o, ephoto->thumb_gen_size, e_thumb_icon_size_set(o, ephoto->thumb_gen_size,
ephoto->thumb_gen_size); ephoto->thumb_gen_size);
e_thumb_icon_rethumb(o); e_thumb_icon_rethumb(o);
} }
end: end:
ephoto->timer.thumb_regen = NULL; ephoto->timer.thumb_regen = NULL;
return EINA_FALSE; return EINA_FALSE;
} }
@ -999,25 +1003,25 @@ ephoto_thumb_size_set(Ephoto *ephoto, int size)
{ {
if (ephoto->config->thumb_size != size) if (ephoto->config->thumb_size != size)
{ {
ephoto->config->thumb_size = size; ephoto->config->thumb_size = size;
} }
if (size <= 128) if (size <= 128)
ephoto->thumb_gen_size = 128; ephoto->thumb_gen_size = 128;
else if (size <= 256) else if (size <= 256)
ephoto->thumb_gen_size = 256; ephoto->thumb_gen_size = 256;
else else
ephoto->thumb_gen_size = 512; ephoto->thumb_gen_size = 512;
if (ephoto->timer.thumb_regen) if (ephoto->timer.thumb_regen)
ecore_timer_del(ephoto->timer.thumb_regen); ecore_timer_del(ephoto->timer.thumb_regen);
ephoto->timer.thumb_regen = ephoto->timer.thumb_regen =
ecore_timer_loop_add(0.1, _thumb_gen_size_changed_timer_cb, ephoto); ecore_timer_loop_add(0.1, _thumb_gen_size_changed_timer_cb, ephoto);
} }
static void static void
_thumb_gen_cb(void *data, Evas_Object *obj EINA_UNUSED, _thumb_gen_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_data EINA_UNUSED) void *event_data EINA_UNUSED)
{ {
Ephoto_Entry *entry = data; Ephoto_Entry *entry = data;
const char *id; const char *id;
@ -1054,24 +1058,24 @@ _thumb_gen_cb(void *data, Evas_Object *obj EINA_UNUSED,
{ {
int near_cmp; int near_cmp;
Eina_List *near_node = Eina_List *near_node =
eina_list_search_sorted_near_list(entry->ephoto->entries, eina_list_search_sorted_near_list(entry->ephoto->entries,
ephoto_entries_cmp, entry, &near_cmp); ephoto_entries_cmp, entry, &near_cmp);
if (near_cmp < 0) if (near_cmp < 0)
entry->ephoto->entries = entry->ephoto->entries =
eina_list_append_relative_list(entry->ephoto->entries, entry, eina_list_append_relative_list(entry->ephoto->entries, entry,
near_node); near_node);
else else
entry->ephoto->entries = entry->ephoto->entries =
eina_list_prepend_relative_list(entry->ephoto->entries, entry, eina_list_prepend_relative_list(entry->ephoto->entries, entry,
near_node); near_node);
} }
} }
} }
static void static void
_thumb_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, _thumb_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto *ephoto = data; Ephoto *ephoto = data;
@ -1085,16 +1089,16 @@ ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, Ephoto_Entry *entry)
if (entry->path) if (entry->path)
{ {
const char *ext = strrchr(entry->path, '.'); const char *ext = strrchr(entry->path, '.');
if (ext) if (ext)
{ {
ext++; ext++;
if ((strcasecmp(ext, "edj") == 0)) if ((strcasecmp(ext, "edj") == 0))
{ {
const char *group = NULL; const char *group = NULL;
o = elm_icon_add(parent); o = elm_icon_add(parent);
if (edje_file_group_exists(entry->path, "e/desktop/background")) if (edje_file_group_exists(entry->path, "e/desktop/background"))
group = "e/desktop/background"; group = "e/desktop/background";
else else
@ -1106,14 +1110,14 @@ ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, Ephoto_Entry *entry)
} }
elm_image_file_set(o, entry->path, group); elm_image_file_set(o, entry->path, group);
} }
} }
if (!o) if (!o)
{ {
o = e_thumb_icon_add(parent, ephoto->config->thumbnail_aspect); o = e_thumb_icon_add(parent, ephoto->config->thumbnail_aspect);
evas_object_smart_callback_add(o, "e_thumb_gen", _thumb_gen_cb, entry); evas_object_smart_callback_add(o, "e_thumb_gen", _thumb_gen_cb, entry);
e_thumb_icon_file_set(o, entry->path, NULL); e_thumb_icon_file_set(o, entry->path, NULL);
e_thumb_icon_size_set(o, ephoto->thumb_gen_size, e_thumb_icon_size_set(o, ephoto->thumb_gen_size,
ephoto->thumb_gen_size); ephoto->thumb_gen_size);
e_thumb_icon_begin(o); e_thumb_icon_begin(o);
entry->thumb = o; entry->thumb = o;
} }
@ -1129,7 +1133,7 @@ ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, Ephoto_Entry *entry)
Ephoto_Entry * Ephoto_Entry *
ephoto_entry_new(Ephoto *ephoto, const char *path, const char *label, ephoto_entry_new(Ephoto *ephoto, const char *path, const char *label,
Eina_File_Type type) Eina_File_Type type)
{ {
Ephoto_Entry *entry; Ephoto_Entry *entry;
char *rp; char *rp;
@ -1179,7 +1183,7 @@ ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry)
EINA_LIST_FREE(entry->free_listeners, fl) EINA_LIST_FREE(entry->free_listeners, fl)
{ {
fl->cb((void *) fl->data, entry); fl->cb((void *)fl->data, entry);
free(fl); free(fl);
} }
if (!entry->is_dir) if (!entry->is_dir)
@ -1190,7 +1194,7 @@ ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry)
{ {
node = eina_list_data_find_list(ephoto->selentries, entry); node = eina_list_data_find_list(ephoto->selentries, entry);
ephoto->selentries = eina_list_remove_list(ephoto->selentries, ephoto->selentries = eina_list_remove_list(ephoto->selentries,
node); node);
} }
if (entry->sort_id) if (entry->sort_id)
eina_stringshare_del(entry->sort_id); eina_stringshare_del(entry->sort_id);
@ -1207,8 +1211,8 @@ ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry)
} }
void void
ephoto_entry_free_listener_add(Ephoto_Entry *entry, void (*cb) (void *data, ephoto_entry_free_listener_add(Ephoto_Entry *entry, void (*cb)(void *data,
const Ephoto_Entry *entry), const void *data) const Ephoto_Entry *entry), const void *data)
{ {
Ephoto_Entry_Free_Listener *fl; Ephoto_Entry_Free_Listener *fl;
@ -1219,8 +1223,8 @@ ephoto_entry_free_listener_add(Ephoto_Entry *entry, void (*cb) (void *data,
} }
void void
ephoto_entry_free_listener_del(Ephoto_Entry *entry, void (*cb) (void *data, ephoto_entry_free_listener_del(Ephoto_Entry *entry, void (*cb)(void *data,
const Ephoto_Entry *entry), const void *data) const Ephoto_Entry *entry), const void *data)
{ {
Eina_List *l; Eina_List *l;
Ephoto_Entry_Free_Listener *fl; Ephoto_Entry_Free_Listener *fl;
@ -1228,12 +1232,12 @@ ephoto_entry_free_listener_del(Ephoto_Entry *entry, void (*cb) (void *data,
EINA_LIST_FOREACH(entry->free_listeners, l, fl) EINA_LIST_FOREACH(entry->free_listeners, l, fl)
{ {
if ((fl->cb == cb) && (fl->data == data)) if ((fl->cb == cb) && (fl->data == data))
{ {
if (eina_list_data_find(entry->free_listeners, l)) if (eina_list_data_find(entry->free_listeners, l))
{ {
entry->free_listeners = entry->free_listeners =
eina_list_remove_list(entry->free_listeners, l); eina_list_remove_list(entry->free_listeners, l);
break; break;
} }
} }
} }
@ -1248,3 +1252,4 @@ ephoto_entries_free(Ephoto *ephoto)
ephoto_entry_free(ephoto, entry); ephoto_entry_free(ephoto, entry);
ephoto->entries = NULL; ephoto->entries = NULL;
} }

View File

@ -3,21 +3,21 @@
typedef struct _Ephoto_Reye Ephoto_Reye; typedef struct _Ephoto_Reye Ephoto_Reye;
struct _Ephoto_Reye struct _Ephoto_Reye
{ {
Evas_Object *main; Evas_Object *main;
Evas_Object *parent; Evas_Object *parent;
Evas_Object *image; Evas_Object *image;
Evas_Object *editor; Evas_Object *editor;
Evas_Object *rslider; Evas_Object *rslider;
Eina_List *handlers; Eina_List *handlers;
int rad; int rad;
Evas_Coord w, h; Evas_Coord w, h;
unsigned int *original_im_data; unsigned int *original_im_data;
unsigned int *edited_im_data; unsigned int *edited_im_data;
}; };
static void static void
_reye_clicked(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _reye_clicked(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_data EINA_UNUSED) void *event_data EINA_UNUSED)
{ {
Ephoto_Reye *er = data; Ephoto_Reye *er = data;
unsigned int *im_data, *p1; unsigned int *im_data, *p1;
@ -30,14 +30,14 @@ _reye_clicked(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
evas_pointer_canvas_xy_get(evas_object_evas_get(er->image), &xpos, &ypos); evas_pointer_canvas_xy_get(evas_object_evas_get(er->image), &xpos, &ypos);
evas_object_geometry_get(er->image, &imx, &imy, &imw, &imh); evas_object_geometry_get(er->image, &imx, &imy, &imw, &imh);
xadj = xpos-imx; xadj = xpos - imx;
yadj = ypos-imy; yadj = ypos - imy;
if (xadj < 0) xadj = 0; if (xadj < 0) xadj = 0;
if (yadj < 0) yadj = 0; if (yadj < 0) yadj = 0;
scalex = (double) (xadj) / (double) imw; scalex = (double)(xadj) / (double)imw;
scaley = (double) (yadj) / (double) imh; scaley = (double)(yadj) / (double)imh;
nx = er->w * scalex; nx = er->w * scalex;
ny = er->h * scaley; ny = er->h * scaley;
@ -48,42 +48,42 @@ _reye_clicked(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
im_data = malloc(sizeof(unsigned int) * er->w * er->h); im_data = malloc(sizeof(unsigned int) * er->w * er->h);
if (er->edited_im_data) if (er->edited_im_data)
memcpy(im_data, er->edited_im_data, memcpy(im_data, er->edited_im_data,
sizeof(unsigned int) * er->w * er->h); sizeof(unsigned int) * er->w * er->h);
else else
memcpy(im_data, er->original_im_data, memcpy(im_data, er->original_im_data,
sizeof(unsigned int) * er->w * er->h); sizeof(unsigned int) * er->w * er->h);
for (yy = -er->rad; yy <= er->rad; yy++) for (yy = -er->rad; yy <= er->rad; yy++)
{ {
for (xx = -er->rad; xx <= er->rad; xx++) for (xx = -er->rad; xx <= er->rad; xx++)
{ {
if ((xx * xx) + (yy * yy) <= (er->rad * er->rad)) if ((xx * xx) + (yy * yy) <= (er->rad * er->rad))
{ {
nnx = nx + xx; nnx = nx + xx;
nny = ny + yy; nny = ny + yy;
p1 = im_data + (nny * er->w) + nnx; p1 = im_data + (nny * er->w) + nnx;
b = (int) ((*p1) & 0xff); b = (int)((*p1) & 0xff);
g = (int) ((*p1 >> 8) & 0xff); g = (int)((*p1 >> 8) & 0xff);
r = (int) ((*p1 >> 16) & 0xff); r = (int)((*p1 >> 16) & 0xff);
a = (int) ((*p1 >> 24) & 0xff); a = (int)((*p1 >> 24) & 0xff);
b = ephoto_mul_color_alpha(b, a); b = ephoto_mul_color_alpha(b, a);
g = ephoto_mul_color_alpha(g, a); g = ephoto_mul_color_alpha(g, a);
r = ephoto_mul_color_alpha(r, a); r = ephoto_mul_color_alpha(r, a);
r = (int) ((g+b)/2); r = (int)((g + b) / 2);
b = ephoto_normalize_color(b); b = ephoto_normalize_color(b);
g = ephoto_normalize_color(g); g = ephoto_normalize_color(g);
r = ephoto_normalize_color(r); r = ephoto_normalize_color(r);
b = ephoto_demul_color_alpha(b, a); b = ephoto_demul_color_alpha(b, a);
g = ephoto_demul_color_alpha(g, a); g = ephoto_demul_color_alpha(g, a);
r = ephoto_demul_color_alpha(r, a); r = ephoto_demul_color_alpha(r, a);
*p1 = (a << 24) | (r << 16) | (g << 8) | b; *p1 = (a << 24) | (r << 16) | (g << 8) | b;
} }
} }
} }
er->edited_im_data = im_data; er->edited_im_data = im_data;
ephoto_single_browser_image_data_update(er->main, er->image, ephoto_single_browser_image_data_update(er->main, er->image,
im_data, er->w, er->h); im_data, er->w, er->h);
} }
static void static void
@ -96,7 +96,7 @@ _radius_slider_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSE
static Eina_Bool static Eina_Bool
_reye_reset(void *data, int type EINA_UNUSED, _reye_reset(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Reye *er = data; Ephoto_Reye *er = data;
@ -108,14 +108,14 @@ _reye_reset(void *data, int type EINA_UNUSED,
er->edited_im_data = NULL; er->edited_im_data = NULL;
} }
ephoto_single_browser_image_data_update(er->main, er->image, ephoto_single_browser_image_data_update(er->main, er->image,
er->original_im_data, er->w, er->h); er->original_im_data, er->w, er->h);
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }
static Eina_Bool static Eina_Bool
_reye_apply(void *data, int type EINA_UNUSED, _reye_apply(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Reye *er = data; Ephoto_Reye *er = data;
unsigned int *image_data; unsigned int *image_data;
@ -128,7 +128,7 @@ _reye_apply(void *data, int type EINA_UNUSED,
else else
{ {
image_data = image_data =
evas_object_image_data_get(er->image, EINA_FALSE); evas_object_image_data_get(er->image, EINA_FALSE);
evas_object_image_size_get(er->image, &w, &h); evas_object_image_size_get(er->image, &w, &h);
ephoto_single_browser_image_data_done(er->main, image_data, w, h); ephoto_single_browser_image_data_done(er->main, image_data, w, h);
} }
@ -139,7 +139,7 @@ _reye_apply(void *data, int type EINA_UNUSED,
static Eina_Bool static Eina_Bool
_reye_cancel(void *data, int type EINA_UNUSED, _reye_cancel(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Reye *er = data; Ephoto_Reye *er = data;
@ -159,7 +159,7 @@ _reye_cancel(void *data, int type EINA_UNUSED,
static void static void
_editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Reye *er = data; Ephoto_Reye *er = data;
Ecore_Event_Handler *handler; Ecore_Event_Handler *handler;
@ -188,21 +188,21 @@ ephoto_red_eye_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_
er->parent = parent; er->parent = parent;
er->image = image; er->image = image;
im_data = im_data =
evas_object_image_data_get(er->image, evas_object_image_data_get(er->image,
EINA_FALSE); EINA_FALSE);
evas_object_image_size_get(er->image, &er->w, evas_object_image_size_get(er->image, &er->w,
&er->h); &er->h);
er->original_im_data = malloc(sizeof(unsigned int) * er->w * er->h); er->original_im_data = malloc(sizeof(unsigned int) * er->w * er->h);
memcpy(er->original_im_data, im_data, memcpy(er->original_im_data, im_data,
sizeof(unsigned int) * er->w * er->h); sizeof(unsigned int) * er->w * er->h);
evas_object_event_callback_add(er->image, EVAS_CALLBACK_MOUSE_UP, evas_object_event_callback_add(er->image, EVAS_CALLBACK_MOUSE_UP,
_reye_clicked, er); _reye_clicked, er);
er->editor = ephoto_editor_add(ephoto, parent, _("Red Eye Removal"), er->editor = ephoto_editor_add(ephoto, parent, _("Red Eye Removal"),
"ereye", er); "ereye", er);
evas_object_event_callback_add(er->editor, EVAS_CALLBACK_DEL, _editor_del, evas_object_event_callback_add(er->editor, EVAS_CALLBACK_DEL, _editor_del,
er); er);
slider = elm_slider_add(er->editor); slider = elm_slider_add(er->editor);
elm_object_text_set(slider, _("Radius")); elm_object_text_set(slider, _("Radius"));
@ -214,7 +214,7 @@ ephoto_red_eye_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_
EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_WEIGHT(slider, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5); EPHOTO_ALIGN(slider, EVAS_HINT_FILL, 0.5);
evas_object_smart_callback_add(slider, "delay,changed", evas_object_smart_callback_add(slider, "delay,changed",
_radius_slider_changed, er); _radius_slider_changed, er);
elm_box_pack_start(er->editor, slider); elm_box_pack_start(er->editor, slider);
evas_object_show(slider); evas_object_show(slider);
er->rslider = slider; er->rslider = slider;
@ -227,20 +227,21 @@ ephoto_red_eye_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_
evas_object_show(label); evas_object_show(label);
er->handlers = er->handlers =
eina_list_append(er->handlers, eina_list_append(er->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET,
_reye_reset, er)); _reye_reset, er));
er->handlers = er->handlers =
eina_list_append(er->handlers, eina_list_append(er->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY,
_reye_apply, er)); _reye_apply, er));
er->handlers = er->handlers =
eina_list_append(er->handlers, eina_list_append(er->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL,
_reye_cancel, er)); _reye_cancel, er));
return; return;
error: error:
return; return;
} }

View File

@ -3,27 +3,27 @@
typedef struct _Ephoto_Scale Ephoto_Scale; typedef struct _Ephoto_Scale Ephoto_Scale;
struct _Ephoto_Scale struct _Ephoto_Scale
{ {
Evas_Object *main; Evas_Object *main;
Evas_Object *parent; Evas_Object *parent;
Evas_Object *image; Evas_Object *image;
Evas_Object *editor; Evas_Object *editor;
Evas_Object *scalew; Evas_Object *scalew;
Evas_Object *scaleh; Evas_Object *scaleh;
Evas_Object *aspect; Evas_Object *aspect;
Eina_Stringshare *tmp_file; Eina_Stringshare *tmp_file;
Eina_List *handlers; Eina_List *handlers;
double aspectw; double aspectw;
double aspecth; double aspecth;
Evas_Coord w, h; Evas_Coord w, h;
unsigned int *original_im_data; unsigned int *original_im_data;
}; };
static void _scale_width_changed(void *data, Evas_Object *obj EINA_UNUSED, static void _scale_width_changed(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED); void *event_info EINA_UNUSED);
static void static void
_scale_height_changed(void *data, Evas_Object *obj EINA_UNUSED, _scale_height_changed(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Scale *es = data; Ephoto_Scale *es = data;
double nw; double nw;
@ -31,27 +31,27 @@ _scale_height_changed(void *data, Evas_Object *obj EINA_UNUSED,
if (!elm_check_state_get(es->aspect)) if (!elm_check_state_get(es->aspect))
return; return;
evas_object_smart_callback_del(es->scalew, "changed", evas_object_smart_callback_del(es->scalew, "changed",
_scale_width_changed); _scale_width_changed);
nw = round(es->aspectw * elm_spinner_value_get(es->scaleh)); nw = round(es->aspectw * elm_spinner_value_get(es->scaleh));
if (nw <= 1) if (nw <= 1)
{ {
double nh; double nh;
evas_object_smart_callback_del(es->scaleh, "changed", evas_object_smart_callback_del(es->scaleh, "changed",
_scale_height_changed); _scale_height_changed);
nh = round(es->aspecth * 1); nh = round(es->aspecth * 1);
elm_spinner_value_set(es->scaleh, nh); elm_spinner_value_set(es->scaleh, nh);
evas_object_smart_callback_add(es->scaleh, "changed", evas_object_smart_callback_add(es->scaleh, "changed",
_scale_height_changed, es); _scale_height_changed, es);
nw = 1; nw = 1;
} }
elm_spinner_value_set(es->scalew, nw); elm_spinner_value_set(es->scalew, nw);
evas_object_smart_callback_add(es->scalew, "changed", evas_object_smart_callback_add(es->scalew, "changed",
_scale_width_changed, es); _scale_width_changed, es);
} }
static void static void
_scale_width_changed(void *data, Evas_Object *obj EINA_UNUSED, _scale_width_changed(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Scale *es = data; Ephoto_Scale *es = data;
double nh; double nh;
@ -59,28 +59,28 @@ _scale_width_changed(void *data, Evas_Object *obj EINA_UNUSED,
if (!elm_check_state_get(es->aspect)) if (!elm_check_state_get(es->aspect))
return; return;
evas_object_smart_callback_del(es->scaleh, "changed", evas_object_smart_callback_del(es->scaleh, "changed",
_scale_height_changed); _scale_height_changed);
nh = round(es->aspecth * elm_spinner_value_get(es->scalew)); nh = round(es->aspecth * elm_spinner_value_get(es->scalew));
if (nh <= 1) if (nh <= 1)
{ {
double nw; double nw;
evas_object_smart_callback_del(es->scalew, "changed", evas_object_smart_callback_del(es->scalew, "changed",
_scale_width_changed); _scale_width_changed);
nw = round(es->aspectw * 1); nw = round(es->aspectw * 1);
elm_spinner_value_set(es->scalew, nw); elm_spinner_value_set(es->scalew, nw);
evas_object_smart_callback_add(es->scalew, "changed", evas_object_smart_callback_add(es->scalew, "changed",
_scale_width_changed, es); _scale_width_changed, es);
nh = 1; nh = 1;
} }
elm_spinner_value_set(es->scaleh, nh); elm_spinner_value_set(es->scaleh, nh);
evas_object_smart_callback_add(es->scaleh, "changed", evas_object_smart_callback_add(es->scaleh, "changed",
_scale_height_changed, es); _scale_height_changed, es);
} }
static Eina_Bool static Eina_Bool
_es_reset(void *data, int type EINA_UNUSED, _es_reset(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Scale *es = data; Ephoto_Scale *es = data;
@ -88,13 +88,13 @@ _es_reset(void *data, int type EINA_UNUSED,
elm_spinner_value_set(es->scaleh, es->h); elm_spinner_value_set(es->scaleh, es->h);
es->aspectw = (double)es->w / (double)es->h; es->aspectw = (double)es->w / (double)es->h;
es->aspecth = (double)es->h / (double)es->w; es->aspecth = (double)es->h / (double)es->w;
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }
static Eina_Bool static Eina_Bool
_es_apply(void *data, int type EINA_UNUSED, _es_apply(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Scale *es = data; Ephoto_Scale *es = data;
const unsigned int *image_data; const unsigned int *image_data;
@ -116,7 +116,7 @@ _es_apply(void *data, int type EINA_UNUSED,
w = round(elm_spinner_value_get(es->scalew)); w = round(elm_spinner_value_get(es->scalew));
h = round(elm_spinner_value_get(es->scaleh)); h = round(elm_spinner_value_get(es->scaleh));
evas_object_image_file_get(es->image, evas_object_image_file_get(es->image,
NULL, &key); NULL, &key);
ee = ecore_evas_buffer_new(1, 1); ee = ecore_evas_buffer_new(1, 1);
eecanvas = ecore_evas_get(ee); eecanvas = ecore_evas_get(ee);
@ -153,7 +153,7 @@ _es_apply(void *data, int type EINA_UNUSED,
static Eina_Bool static Eina_Bool
_es_cancel(void *data, int type EINA_UNUSED, _es_cancel(void *data, int type EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Scale *es = data; Ephoto_Scale *es = data;
@ -165,7 +165,7 @@ _es_cancel(void *data, int type EINA_UNUSED,
static void static void
_editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Scale *es = data; Ephoto_Scale *es = data;
Ecore_Event_Handler *handler; Ecore_Event_Handler *handler;
@ -180,7 +180,7 @@ _editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void void
ephoto_scale_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, ephoto_scale_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
Evas_Object *image, const char *file) Evas_Object *image, const char *file)
{ {
Ephoto_Scale *es; Ephoto_Scale *es;
unsigned int *im_data; unsigned int *im_data;
@ -196,28 +196,28 @@ ephoto_scale_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
es->image = image; es->image = image;
snprintf(buf, PATH_MAX, "%s/temp.%s", ephoto->config_path, snprintf(buf, PATH_MAX, "%s/temp.%s", ephoto->config_path,
strrchr(file, '.')+1); strrchr(file, '.') + 1);
es->tmp_file = eina_stringshare_add(buf); es->tmp_file = eina_stringshare_add(buf);
if (ecore_file_exists(es->tmp_file)) if (ecore_file_exists(es->tmp_file))
ecore_file_unlink(es->tmp_file); ecore_file_unlink(es->tmp_file);
evas_object_image_save(es->image, es->tmp_file, evas_object_image_save(es->image, es->tmp_file,
NULL, NULL); NULL, NULL);
im_data = im_data =
evas_object_image_data_get(es->image, evas_object_image_data_get(es->image,
EINA_FALSE); EINA_FALSE);
evas_object_image_size_get(es->image, &es->w, evas_object_image_size_get(es->image, &es->w,
&es->h); &es->h);
es->original_im_data = malloc(sizeof(unsigned int) * es->w * es->h); es->original_im_data = malloc(sizeof(unsigned int) * es->w * es->h);
memcpy(es->original_im_data, im_data, memcpy(es->original_im_data, im_data,
sizeof(unsigned int) * es->w * es->h); sizeof(unsigned int) * es->w * es->h);
es->aspectw = (double)es->w / (double)es->h; es->aspectw = (double)es->w / (double)es->h;
es->aspecth = (double)es->h / (double)es->w; es->aspecth = (double)es->h / (double)es->w;
es->editor = ephoto_editor_add(ephoto, parent, _("Scale Image"), es->editor = ephoto_editor_add(ephoto, parent, _("Scale Image"),
"es", es); "es", es);
evas_object_event_callback_add(es->editor, EVAS_CALLBACK_DEL, _editor_del, evas_object_event_callback_add(es->editor, EVAS_CALLBACK_DEL, _editor_del,
es); es);
es->aspect = elm_check_add(es->editor); es->aspect = elm_check_add(es->editor);
elm_object_text_set(es->aspect, _("Keep Aspect")); elm_object_text_set(es->aspect, _("Keep Aspect"));
@ -255,21 +255,21 @@ ephoto_scale_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent,
evas_object_show(es->scalew); evas_object_show(es->scalew);
es->handlers = es->handlers =
eina_list_append(es->handlers, eina_list_append(es->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET,
_es_reset, es)); _es_reset, es));
es->handlers = es->handlers =
eina_list_append(es->handlers, eina_list_append(es->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY,
_es_apply, es)); _es_apply, es));
es->handlers = es->handlers =
eina_list_append(es->handlers, eina_list_append(es->handlers,
ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL,
_es_cancel, es)); _es_cancel, es));
return; return;
error: error:
return; return;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
#include "ephoto.h" #include "ephoto.h"
typedef enum _Ephoto_Slideshow_Move Ephoto_Slideshow_Move; typedef enum _Ephoto_Slideshow_Move Ephoto_Slideshow_Move;
typedef struct _Ephoto_Slideshow Ephoto_Slideshow; typedef struct _Ephoto_Slideshow Ephoto_Slideshow;
enum _Ephoto_Slideshow_Move enum _Ephoto_Slideshow_Move
{ {
@ -33,39 +33,39 @@ enum _Ephoto_Slideshow_Move
struct _Ephoto_Slideshow struct _Ephoto_Slideshow
{ {
Ephoto *ephoto; Ephoto *ephoto;
Evas_Object *current_item; Evas_Object *current_item;
Evas_Object *old_item; Evas_Object *old_item;
Evas_Object *slideshow; Evas_Object *slideshow;
Evas_Object *event; Evas_Object *event;
Evas_Object *notify; Evas_Object *notify;
Evas_Object *notify_box; Evas_Object *notify_box;
Eina_List *entries; Eina_List *entries;
Evas_Object *pause; Evas_Object *pause;
Evas_Object *pause_after; Evas_Object *pause_after;
Evas_Object *fullscreen; Evas_Object *fullscreen;
Evas_Object *fullscreen_after; Evas_Object *fullscreen_after;
Evas_Object *exit; Evas_Object *exit;
Ephoto_Entry *entry; Ephoto_Entry *entry;
Eina_Bool playing; Eina_Bool playing;
Eina_Bool timer_end; Eina_Bool timer_end;
Ecore_Timer *timer; Ecore_Timer *timer;
Ephoto_Slideshow_Move move; Ephoto_Slideshow_Move move;
float timeout; float timeout;
int current; int current;
}; };
static Evas_Object *_slideshow_item_get(Ephoto_Slideshow *ss, static Evas_Object *_slideshow_item_get(Ephoto_Slideshow *ss,
Ephoto_Entry *entry, Evas_Object *parent); Ephoto_Entry *entry, Evas_Object *parent);
static Eina_Bool _slideshow_transition(void *data); static Eina_Bool _slideshow_transition(void *data);
static void _slideshow_play(Ephoto_Slideshow *ss); static void _slideshow_play(Ephoto_Slideshow *ss);
static void _slideshow_pause(Ephoto_Slideshow *ss); static void _slideshow_pause(Ephoto_Slideshow *ss);
static Evas_Object *_add_icon(Evas_Object *parent, const char *icon, static Evas_Object *_add_icon(Evas_Object *parent, const char *icon,
const char *label, Evas_Object *before); const char *label, Evas_Object *before);
static void static void
_image_shown(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _image_shown(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_data EINA_UNUSED) void *event_data EINA_UNUSED)
{ {
Ephoto_Entry *entry = data; Ephoto_Entry *entry = data;
@ -77,55 +77,79 @@ _slideshow_move_end_get(Ephoto_Slideshow *ss)
{ {
switch (ss->move) switch (ss->move)
{ {
case EPHOTO_SLIDESHOW_MOVE_LEFT_TO_RIGHT: case EPHOTO_SLIDESHOW_MOVE_LEFT_TO_RIGHT:
return "ephoto,slideshow,move,left,to,right"; return "ephoto,slideshow,move,left,to,right";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_TO_LEFT:
return "ephoto,slideshow,move,right,to,left"; case EPHOTO_SLIDESHOW_MOVE_RIGHT_TO_LEFT:
case EPHOTO_SLIDESHOW_MOVE_TOP_TO_BOTTOM: return "ephoto,slideshow,move,right,to,left";
return "ephoto,slideshow,move,top,to,bottom";
case EPHOTO_SLIDESHOW_MOVE_BOTTOM_TO_TOP: case EPHOTO_SLIDESHOW_MOVE_TOP_TO_BOTTOM:
return "ephoto,slideshow,move,bottom,to,top"; return "ephoto,slideshow,move,top,to,bottom";
case EPHOTO_SLIDESHOW_MOVE_LEFT_IN:
return "ephoto,slideshow,move,left,in"; case EPHOTO_SLIDESHOW_MOVE_BOTTOM_TO_TOP:
case EPHOTO_SLIDESHOW_MOVE_RIGHT_IN: return "ephoto,slideshow,move,bottom,to,top";
return "ephoto,slideshow,move,right,in";
case EPHOTO_SLIDESHOW_MOVE_TOP_IN: case EPHOTO_SLIDESHOW_MOVE_LEFT_IN:
return "ephoto,slideshow,move,top,in"; return "ephoto,slideshow,move,left,in";
case EPHOTO_SLIDESHOW_MOVE_BOTTOM_IN:
return "ephoto,slideshow,move,bottom,in"; case EPHOTO_SLIDESHOW_MOVE_RIGHT_IN:
case EPHOTO_SLIDESHOW_MOVE_LEFT_OUT: return "ephoto,slideshow,move,right,in";
return "ephoto,slideshow,move,left,out";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_OUT: case EPHOTO_SLIDESHOW_MOVE_TOP_IN:
return "ephoto,slideshow,move,right,out"; return "ephoto,slideshow,move,top,in";
case EPHOTO_SLIDESHOW_MOVE_TOP_OUT:
return "ephoto,slideshow,move,top,out"; case EPHOTO_SLIDESHOW_MOVE_BOTTOM_IN:
case EPHOTO_SLIDESHOW_MOVE_BOTTOM_OUT: return "ephoto,slideshow,move,bottom,in";
return "ephoto,slideshow,move,bottom,out";
case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER: case EPHOTO_SLIDESHOW_MOVE_LEFT_OUT:
return "ephoto,slideshow,move,left,top,corner"; return "ephoto,slideshow,move,left,out";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER:
return "ephoto,slideshow,move,right,top,corner"; case EPHOTO_SLIDESHOW_MOVE_RIGHT_OUT:
case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER: return "ephoto,slideshow,move,right,out";
return "ephoto,slideshow,move,right,bottom,corner";
case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER: case EPHOTO_SLIDESHOW_MOVE_TOP_OUT:
return "ephoto,slideshow,move,left,bottom,corner"; return "ephoto,slideshow,move,top,out";
case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_IN:
return "ephoto,slideshow,move,left,top,corner,in"; case EPHOTO_SLIDESHOW_MOVE_BOTTOM_OUT:
case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_IN: return "ephoto,slideshow,move,bottom,out";
return "ephoto,slideshow,move,right,top,corner,in";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER_IN: case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER:
return "ephoto,slideshow,move,right,bottom,corner,in"; return "ephoto,slideshow,move,left,top,corner";
case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER_IN:
return "ephoto,slideshow,move,left,bottom,corner,in"; case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER:
case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_OUT: return "ephoto,slideshow,move,right,top,corner";
return "ephoto,slideshow,move,left,top,corner,out";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_OUT: case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER:
return "ephoto,slideshow,move,right,top,corner,out"; return "ephoto,slideshow,move,right,bottom,corner";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER_OUT:
return "ephoto,slideshow,move,right,bottom,corner,out"; case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER:
case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER_OUT: return "ephoto,slideshow,move,left,bottom,corner";
return "ephoto,slideshow,move,left,bottom,corner,out";
default: return "default"; case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_IN:
return "ephoto,slideshow,move,left,top,corner,in";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_IN:
return "ephoto,slideshow,move,right,top,corner,in";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER_IN:
return "ephoto,slideshow,move,right,bottom,corner,in";
case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER_IN:
return "ephoto,slideshow,move,left,bottom,corner,in";
case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_OUT:
return "ephoto,slideshow,move,left,top,corner,out";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_OUT:
return "ephoto,slideshow,move,right,top,corner,out";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER_OUT:
return "ephoto,slideshow,move,right,bottom,corner,out";
case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER_OUT:
return "ephoto,slideshow,move,left,bottom,corner,out";
default: return "default";
} }
} }
@ -134,55 +158,79 @@ _slideshow_move_start_get(Ephoto_Slideshow *ss)
{ {
switch (ss->move) switch (ss->move)
{ {
case EPHOTO_SLIDESHOW_MOVE_LEFT_TO_RIGHT: case EPHOTO_SLIDESHOW_MOVE_LEFT_TO_RIGHT:
return "ephoto,slideshow,default,left,to,right"; return "ephoto,slideshow,default,left,to,right";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_TO_LEFT:
return "ephoto,slideshow,default,right,to,left"; case EPHOTO_SLIDESHOW_MOVE_RIGHT_TO_LEFT:
case EPHOTO_SLIDESHOW_MOVE_TOP_TO_BOTTOM: return "ephoto,slideshow,default,right,to,left";
return "ephoto,slideshow,default,top,to,bottom";
case EPHOTO_SLIDESHOW_MOVE_BOTTOM_TO_TOP: case EPHOTO_SLIDESHOW_MOVE_TOP_TO_BOTTOM:
return "ephoto,slideshow,default,bottom,to,top"; return "ephoto,slideshow,default,top,to,bottom";
case EPHOTO_SLIDESHOW_MOVE_LEFT_IN:
return "ephoto,slideshow,default,left,in"; case EPHOTO_SLIDESHOW_MOVE_BOTTOM_TO_TOP:
case EPHOTO_SLIDESHOW_MOVE_RIGHT_IN: return "ephoto,slideshow,default,bottom,to,top";
return "ephoto,slideshow,default,right,in";
case EPHOTO_SLIDESHOW_MOVE_TOP_IN: case EPHOTO_SLIDESHOW_MOVE_LEFT_IN:
return "ephoto,slideshow,default,top,in"; return "ephoto,slideshow,default,left,in";
case EPHOTO_SLIDESHOW_MOVE_BOTTOM_IN:
return "ephoto,slideshow,default,bottom,in"; case EPHOTO_SLIDESHOW_MOVE_RIGHT_IN:
case EPHOTO_SLIDESHOW_MOVE_LEFT_OUT: return "ephoto,slideshow,default,right,in";
return "ephoto,slideshow,default,left,out";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_OUT: case EPHOTO_SLIDESHOW_MOVE_TOP_IN:
return "ephoto,slideshow,default,right,out"; return "ephoto,slideshow,default,top,in";
case EPHOTO_SLIDESHOW_MOVE_TOP_OUT:
return "ephoto,slideshow,default,top,out"; case EPHOTO_SLIDESHOW_MOVE_BOTTOM_IN:
case EPHOTO_SLIDESHOW_MOVE_BOTTOM_OUT: return "ephoto,slideshow,default,bottom,in";
return "ephoto,slideshow,default,bottom,out";
case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER: case EPHOTO_SLIDESHOW_MOVE_LEFT_OUT:
return "ephoto,slideshow,default,left,top,corner"; return "ephoto,slideshow,default,left,out";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER:
return "ephoto,slideshow,default,right,top,corner"; case EPHOTO_SLIDESHOW_MOVE_RIGHT_OUT:
case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER: return "ephoto,slideshow,default,right,out";
return "ephoto,slideshow,default,right,bottom,corner";
case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER: case EPHOTO_SLIDESHOW_MOVE_TOP_OUT:
return "ephoto,slideshow,default,left,bottom,corner"; return "ephoto,slideshow,default,top,out";
case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_IN:
return "ephoto,slideshow,default,left,top,corner,in"; case EPHOTO_SLIDESHOW_MOVE_BOTTOM_OUT:
case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_IN: return "ephoto,slideshow,default,bottom,out";
return "ephoto,slideshow,default,right,top,corner,in";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER_IN: case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER:
return "ephoto,slideshow,default,right,bottom,corner,in"; return "ephoto,slideshow,default,left,top,corner";
case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER_IN:
return "ephoto,slideshow,default,left,bottom,corner,in"; case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER:
case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_OUT: return "ephoto,slideshow,default,right,top,corner";
return "ephoto,slideshow,default,left,top,corner,out";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_OUT: case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER:
return "ephoto,slideshow,default,right,top,corner,out"; return "ephoto,slideshow,default,right,bottom,corner";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER_OUT:
return "ephoto,slideshow,default,right,bottom,corner,out"; case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER:
case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER_OUT: return "ephoto,slideshow,default,left,bottom,corner";
return "ephoto,slideshow,default,left,bottom,corner,out";
default: return "default"; case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_IN:
return "ephoto,slideshow,default,left,top,corner,in";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_IN:
return "ephoto,slideshow,default,right,top,corner,in";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER_IN:
return "ephoto,slideshow,default,right,bottom,corner,in";
case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER_IN:
return "ephoto,slideshow,default,left,bottom,corner,in";
case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_OUT:
return "ephoto,slideshow,default,left,top,corner,out";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_OUT:
return "ephoto,slideshow,default,right,top,corner,out";
case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER_OUT:
return "ephoto,slideshow,default,right,bottom,corner,out";
case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER_OUT:
return "ephoto,slideshow,default,left,bottom,corner,out";
default: return "default";
} }
} }
@ -203,85 +251,109 @@ _slideshow_move_randomize(Ephoto_Slideshow *ss)
switch (i) switch (i)
{ {
case 0: case 0:
ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TO_RIGHT; ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TO_RIGHT;
break; break;
case 1:
ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TO_LEFT; case 1:
break; ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TO_LEFT;
case 2: break;
ss->move = EPHOTO_SLIDESHOW_MOVE_TOP_TO_BOTTOM;
break; case 2:
case 3: ss->move = EPHOTO_SLIDESHOW_MOVE_TOP_TO_BOTTOM;
ss->move = EPHOTO_SLIDESHOW_MOVE_BOTTOM_TO_TOP; break;
break;
case 4: case 3:
ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_IN; ss->move = EPHOTO_SLIDESHOW_MOVE_BOTTOM_TO_TOP;
break; break;
case 5:
ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_IN; case 4:
break; ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_IN;
case 6: break;
ss->move = EPHOTO_SLIDESHOW_MOVE_TOP_IN;
break; case 5:
case 7: ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_IN;
ss->move = EPHOTO_SLIDESHOW_MOVE_BOTTOM_IN; break;
break;
case 8: case 6:
ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_OUT; ss->move = EPHOTO_SLIDESHOW_MOVE_TOP_IN;
break; break;
case 9:
ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_OUT; case 7:
break; ss->move = EPHOTO_SLIDESHOW_MOVE_BOTTOM_IN;
case 10: break;
ss->move = EPHOTO_SLIDESHOW_MOVE_TOP_OUT;
break; case 8:
case 11: ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_OUT;
ss->move = EPHOTO_SLIDESHOW_MOVE_BOTTOM_OUT; break;
break;
case 12: case 9:
ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER; ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_OUT;
break; break;
case 13:
ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER; case 10:
break; ss->move = EPHOTO_SLIDESHOW_MOVE_TOP_OUT;
case 14: break;
ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER;
break; case 11:
case 15: ss->move = EPHOTO_SLIDESHOW_MOVE_BOTTOM_OUT;
ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER; break;
break;
case 16: case 12:
ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_IN; ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER;
break; break;
case 17:
ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_IN; case 13:
break; ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER;
case 18: break;
ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER_IN;
break; case 14:
case 19: ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER;
ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER_IN; break;
break;
case 20: case 15:
ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_OUT; ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER;
break; break;
case 21:
ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_OUT; case 16:
break; ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_IN;
case 22: break;
ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER_OUT;
break; case 17:
case 23: ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_IN;
ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER_OUT; break;
break;
default: ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TO_RIGHT; case 18:
ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER_IN;
break;
case 19:
ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER_IN;
break;
case 20:
ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_OUT;
break;
case 21:
ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_OUT;
break;
case 22:
ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER_OUT;
break;
case 23:
ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER_OUT;
break;
default: ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TO_RIGHT;
} }
} }
static void static void
_on_transition_raise(void *data, Evas_Object *obj EINA_UNUSED, _on_transition_raise(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source EINA_UNUSED) const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{ {
Ephoto_Slideshow *ss = data; Ephoto_Slideshow *ss = data;
@ -290,7 +362,7 @@ _on_transition_raise(void *data, Evas_Object *obj EINA_UNUSED,
static void static void
_on_transition_end(void *data, Evas_Object *obj EINA_UNUSED, _on_transition_end(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source EINA_UNUSED) const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{ {
Ephoto_Slideshow *ss = data; Ephoto_Slideshow *ss = data;
@ -305,7 +377,7 @@ _on_transition_end(void *data, Evas_Object *obj EINA_UNUSED,
elm_layout_content_unset(ss->slideshow, "ephoto.swallow.slideshow.item2"); elm_layout_content_unset(ss->slideshow, "ephoto.swallow.slideshow.item2");
} }
elm_layout_content_set(ss->slideshow, "ephoto.swallow.slideshow.item", elm_layout_content_set(ss->slideshow, "ephoto.swallow.slideshow.item",
ss->current_item); ss->current_item);
evas_object_raise(ss->current_item); evas_object_raise(ss->current_item);
evas_object_show(ss->current_item); evas_object_show(ss->current_item);
elm_layout_signal_emit(ss->slideshow, "ephoto,transition,done", "ephoto"); elm_layout_signal_emit(ss->slideshow, "ephoto,transition,done", "ephoto");
@ -328,23 +400,23 @@ _slideshow_item_get(Ephoto_Slideshow *ss, Ephoto_Entry *entry, Evas_Object *pare
if (ext) if (ext)
{ {
ext++; ext++;
if ((strcasecmp(ext, "edj") == 0)) if ((strcasecmp(ext, "edj") == 0))
{ {
if (edje_file_group_exists(entry->path, "e/desktop/background")) if (edje_file_group_exists(entry->path, "e/desktop/background"))
group = "e/desktop/background"; group = "e/desktop/background";
else else
{ {
Eina_List *g = edje_file_collection_list(entry->path); Eina_List *g = edje_file_collection_list(entry->path);
group = eina_list_data_get(g); group = eina_list_data_get(g);
edje_file_collection_list_free(g); edje_file_collection_list_free(g);
} }
} }
} }
layout = elm_layout_add(parent); layout = elm_layout_add(parent);
elm_layout_file_set(layout, PACKAGE_DATA_DIR "/themes/ephoto.edj", elm_layout_file_set(layout, PACKAGE_DATA_DIR "/themes/ephoto.edj",
"ephoto,slideshow,item"); "ephoto,slideshow,item");
EPHOTO_EXPAND(layout); EPHOTO_EXPAND(layout);
EPHOTO_FILL(layout); EPHOTO_FILL(layout);
evas_object_data_set(layout, "entry", entry); evas_object_data_set(layout, "entry", entry);
@ -357,7 +429,7 @@ _slideshow_item_get(Ephoto_Slideshow *ss, Ephoto_Entry *entry, Evas_Object *pare
EPHOTO_EXPAND(image); EPHOTO_EXPAND(image);
EPHOTO_FILL(image); EPHOTO_FILL(image);
evas_object_event_callback_add(image, EVAS_CALLBACK_SHOW, _image_shown, evas_object_event_callback_add(image, EVAS_CALLBACK_SHOW, _image_shown,
entry); entry);
evas_object_image_size_get(elm_image_object_get(image), &w, &h); evas_object_image_size_get(elm_image_object_get(image), &w, &h);
evas_object_geometry_get(parent, 0, 0, &sw, &sh); evas_object_geometry_get(parent, 0, 0, &sw, &sh);
if (w < sw && h < sh) if (w < sw && h < sh)
@ -371,7 +443,7 @@ _slideshow_item_get(Ephoto_Slideshow *ss, Ephoto_Entry *entry, Evas_Object *pare
msg->count = 1; msg->count = 1;
msg->val[0] = (float)ss->timeout; msg->val[0] = (float)ss->timeout;
edje_object_message_send(elm_layout_edje_get(layout), edje_object_message_send(elm_layout_edje_get(layout),
EDJE_MESSAGE_FLOAT_SET, 1, msg); EDJE_MESSAGE_FLOAT_SET, 1, msg);
return layout; return layout;
} }
@ -393,9 +465,9 @@ _slideshow_transition(void *data)
ss->old_item = ss->current_item; ss->old_item = ss->current_item;
ss->current_item = _slideshow_item_get(ss, eina_list_nth(ss->entries, ss->current), ss->current_item = _slideshow_item_get(ss, eina_list_nth(ss->entries, ss->current),
ss->slideshow); ss->slideshow);
elm_layout_content_set(ss->slideshow, "ephoto.swallow.slideshow.item2", elm_layout_content_set(ss->slideshow, "ephoto.swallow.slideshow.item2",
ss->current_item); ss->current_item);
evas_object_show(ss->current_item); evas_object_show(ss->current_item);
snprintf(buf, PATH_MAX, "ephoto,%s", ss->ephoto->config->slideshow_transition); snprintf(buf, PATH_MAX, "ephoto,%s", ss->ephoto->config->slideshow_transition);
@ -423,9 +495,9 @@ _slideshow_play(Ephoto_Slideshow *ss)
if (!eina_list_nth(ss->entries, ss->current)) if (!eina_list_nth(ss->entries, ss->current))
ss->current = 0; ss->current = 0;
ss->current_item = _slideshow_item_get(ss, eina_list_nth(ss->entries, ss->current), ss->current_item = _slideshow_item_get(ss, eina_list_nth(ss->entries, ss->current),
ss->slideshow); ss->slideshow);
elm_layout_content_set(ss->slideshow, "ephoto.swallow.slideshow.item", elm_layout_content_set(ss->slideshow, "ephoto.swallow.slideshow.item",
ss->current_item); ss->current_item);
evas_object_raise(ss->current_item); evas_object_raise(ss->current_item);
evas_object_show(ss->current_item); evas_object_show(ss->current_item);
} }
@ -435,7 +507,7 @@ _slideshow_play(Ephoto_Slideshow *ss)
msg->count = 1; msg->count = 1;
msg->val[0] = (float)ss->timeout; msg->val[0] = (float)ss->timeout;
edje_object_message_send(elm_layout_edje_get(ss->current_item), edje_object_message_send(elm_layout_edje_get(ss->current_item),
EDJE_MESSAGE_FLOAT_SET, 1, msg); EDJE_MESSAGE_FLOAT_SET, 1, msg);
if (ss->ephoto->config->movess) if (ss->ephoto->config->movess)
{ {
@ -459,7 +531,7 @@ _slideshow_pause(Ephoto_Slideshow *ss)
static void static void
_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Slideshow *ss = data; Ephoto_Slideshow *ss = data;
Ephoto_Entry *entry; Ephoto_Entry *entry;
@ -475,13 +547,13 @@ _mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
evas_object_hide(ss->ephoto->exit); evas_object_hide(ss->ephoto->exit);
} }
if (ss->current_item) if (ss->current_item)
entry = evas_object_data_get(ss->current_item, "entry"); entry = evas_object_data_get(ss->current_item, "entry");
else else
entry = ss->entry; entry = ss->entry;
if (ss->event) if (ss->event)
{ {
evas_object_del(ss->event); evas_object_del(ss->event);
ss->event = NULL; ss->event = NULL;
} }
evas_object_del(ss->notify_box); evas_object_del(ss->notify_box);
evas_object_del(ss->notify); evas_object_del(ss->notify);
@ -517,12 +589,12 @@ _entry_free(void *data, const Ephoto_Entry *entry EINA_UNUSED)
static void static void
_slideshow_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _slideshow_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Slideshow *ss = data; Ephoto_Slideshow *ss = data;
if (ss->entry) if (ss->entry)
ephoto_entry_free_listener_del(ss->entry, _entry_free, ss); ephoto_entry_free_listener_del(ss->entry, _entry_free, ss);
free(ss); free(ss);
} }
@ -543,13 +615,13 @@ _back(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
evas_object_hide(ss->ephoto->exit); evas_object_hide(ss->ephoto->exit);
} }
if (ss->current_item) if (ss->current_item)
entry = evas_object_data_get(ss->current_item, "entry"); entry = evas_object_data_get(ss->current_item, "entry");
else else
entry = ss->entry; entry = ss->entry;
if (ss->event) if (ss->event)
{ {
evas_object_del(ss->event); evas_object_del(ss->event);
ss->event = NULL; ss->event = NULL;
} }
evas_object_del(ss->notify_box); evas_object_del(ss->notify_box);
evas_object_del(ss->notify); evas_object_del(ss->notify);
@ -615,26 +687,26 @@ _pause(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
if (ss->playing) if (ss->playing)
{ {
_slideshow_pause(ss); _slideshow_pause(ss);
ss->pause = ss->pause =
_add_icon(ss->notify_box, "media-playback-start", _("Play"), _add_icon(ss->notify_box, "media-playback-start", _("Play"),
ss->pause_after); ss->pause_after);
evas_object_smart_callback_add(ss->pause, "clicked", _pause, ss); evas_object_smart_callback_add(ss->pause, "clicked", _pause, ss);
ss->playing = 0; ss->playing = 0;
} }
else else
{ {
_slideshow_play(ss); _slideshow_play(ss);
ss->pause = ss->pause =
_add_icon(ss->notify_box, "media-playback-pause", _("Pause"), _add_icon(ss->notify_box, "media-playback-pause", _("Pause"),
ss->pause_after); ss->pause_after);
evas_object_smart_callback_add(ss->pause, "clicked", _pause, ss); evas_object_smart_callback_add(ss->pause, "clicked", _pause, ss);
ss->playing = 1; ss->playing = 1;
} }
} }
static void static void
_previous(void *data, Evas_Object *obj EINA_UNUSED, _previous(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Slideshow *ss = data; Ephoto_Slideshow *ss = data;
@ -665,7 +737,7 @@ _last(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
static void static void
_fullscreen(void *data, Evas_Object *obj EINA_UNUSED, _fullscreen(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Slideshow *ss = data; Ephoto_Slideshow *ss = data;
@ -673,22 +745,22 @@ _fullscreen(void *data, Evas_Object *obj EINA_UNUSED,
if (elm_win_fullscreen_get(ss->ephoto->win)) if (elm_win_fullscreen_get(ss->ephoto->win))
{ {
ss->fullscreen = ss->fullscreen =
_add_icon(ss->notify_box, "view-fullscreen", _("Fullscreen"), _add_icon(ss->notify_box, "view-fullscreen", _("Fullscreen"),
ss->fullscreen_after); ss->fullscreen_after);
evas_object_smart_callback_add(ss->fullscreen, "clicked", evas_object_smart_callback_add(ss->fullscreen, "clicked",
_fullscreen, ss); _fullscreen, ss);
elm_win_fullscreen_set(ss->ephoto->win, EINA_FALSE); elm_win_fullscreen_set(ss->ephoto->win, EINA_FALSE);
elm_box_unpack(ss->notify_box, ss->exit); elm_box_unpack(ss->notify_box, ss->exit);
evas_object_hide(ss->exit); evas_object_hide(ss->exit);
} }
else else
{ {
ss->fullscreen = ss->fullscreen =
_add_icon(ss->notify_box, "view-restore", _("Normal"), _add_icon(ss->notify_box, "view-restore", _("Normal"),
ss->fullscreen_after); ss->fullscreen_after);
evas_object_smart_callback_add(ss->fullscreen, "clicked", evas_object_smart_callback_add(ss->fullscreen, "clicked",
_fullscreen, ss); _fullscreen, ss);
elm_win_fullscreen_set(ss->ephoto->win, EINA_TRUE); elm_win_fullscreen_set(ss->ephoto->win, EINA_TRUE);
elm_box_pack_end(ss->notify_box, ss->exit); elm_box_pack_end(ss->notify_box, ss->exit);
evas_object_show(ss->exit); evas_object_show(ss->exit);
@ -697,7 +769,7 @@ _fullscreen(void *data, Evas_Object *obj EINA_UNUSED,
static void static void
_settings(void *data, Evas_Object *obj EINA_UNUSED, _settings(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Slideshow *ss = data; Ephoto_Slideshow *ss = data;
@ -706,7 +778,7 @@ _settings(void *data, Evas_Object *obj EINA_UNUSED,
static void static void
_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info) void *event_info)
{ {
Ephoto_Slideshow *ss = data; Ephoto_Slideshow *ss = data;
Evas_Event_Key_Down *ev = event_info; Evas_Event_Key_Down *ev = event_info;
@ -717,7 +789,7 @@ _key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
if (!strcmp(k, "Escape") || !strcmp(k, "F5")) if (!strcmp(k, "Escape") || !strcmp(k, "F5"))
{ {
_back(ss, NULL, NULL); _back(ss, NULL, NULL);
} }
else if (!strcmp(k, "F1")) else if (!strcmp(k, "F1"))
{ {
@ -725,27 +797,27 @@ _key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
} }
else if (!strcmp(k, "F11")) else if (!strcmp(k, "F11"))
{ {
_fullscreen(ss, NULL, NULL); _fullscreen(ss, NULL, NULL);
} }
else if (!strcmp(k, "space")) else if (!strcmp(k, "space"))
{ {
_pause(ss, NULL, NULL); _pause(ss, NULL, NULL);
} }
else if (!strcmp(k, "Home")) else if (!strcmp(k, "Home"))
{ {
_first(ss, NULL, NULL); _first(ss, NULL, NULL);
} }
else if (!strcmp(k, "End")) else if (!strcmp(k, "End"))
{ {
_last(ss, NULL, NULL); _last(ss, NULL, NULL);
} }
else if (!strcmp(k, "Left")) else if (!strcmp(k, "Left"))
{ {
_previous(ss, NULL, NULL); _previous(ss, NULL, NULL);
} }
else if (!strcmp(k, "Right")) else if (!strcmp(k, "Right"))
{ {
_next(ss, NULL, NULL); _next(ss, NULL, NULL);
} }
} }
@ -756,8 +828,8 @@ _add_icon(Evas_Object *parent, const char *icon, const char *label, Evas_Object
int ret; int ret;
ic = elm_icon_add(parent); ic = elm_icon_add(parent);
evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
20*elm_config_scale_get()); 20 * elm_config_scale_get());
ret = elm_icon_standard_set(ic, icon); ret = elm_icon_standard_set(ic, icon);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
@ -779,7 +851,7 @@ _add_icon(Evas_Object *parent, const char *icon, const char *label, Evas_Object
static void static void
_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Slideshow *ss = data; Ephoto_Slideshow *ss = data;
@ -792,7 +864,7 @@ _mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
static void static void
_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Slideshow *ss = data; Ephoto_Slideshow *ss = data;
@ -802,7 +874,7 @@ _mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
static void static void
_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
Ephoto_Slideshow *ss = data; Ephoto_Slideshow *ss = data;
@ -826,9 +898,9 @@ ephoto_slideshow_show_controls(Ephoto *ephoto)
elm_box_horizontal_set(ss->notify_box, EINA_TRUE); elm_box_horizontal_set(ss->notify_box, EINA_TRUE);
EPHOTO_WEIGHT(ss->notify, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_WEIGHT(ss->notify, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
evas_object_event_callback_add(ss->notify_box, EVAS_CALLBACK_MOUSE_IN, _mouse_in, evas_object_event_callback_add(ss->notify_box, EVAS_CALLBACK_MOUSE_IN, _mouse_in,
ss); ss);
evas_object_event_callback_add(ss->notify_box, EVAS_CALLBACK_MOUSE_OUT, _mouse_out, evas_object_event_callback_add(ss->notify_box, EVAS_CALLBACK_MOUSE_OUT, _mouse_out,
ss); ss);
elm_object_content_set(ss->notify, ss->notify_box); elm_object_content_set(ss->notify, ss->notify_box);
evas_object_show(ss->notify_box); evas_object_show(ss->notify_box);
@ -839,22 +911,22 @@ ephoto_slideshow_show_controls(Ephoto *ephoto)
but = _add_icon(ss->notify_box, "go-previous", _("Previous"), NULL); but = _add_icon(ss->notify_box, "go-previous", _("Previous"), NULL);
evas_object_smart_callback_add(but, "clicked", _previous, ss); evas_object_smart_callback_add(but, "clicked", _previous, ss);
ss->pause = ss->pause =
_add_icon(ss->notify_box, "media-playback-start", _("Play"), NULL); _add_icon(ss->notify_box, "media-playback-start", _("Play"), NULL);
evas_object_smart_callback_add(ss->pause, "clicked", _pause, ss); evas_object_smart_callback_add(ss->pause, "clicked", _pause, ss);
ss->pause_after = ss->pause_after =
_add_icon(ss->notify_box, "go-next", _("Next"), NULL); _add_icon(ss->notify_box, "go-next", _("Next"), NULL);
evas_object_smart_callback_add(ss->pause_after, "clicked", _next, evas_object_smart_callback_add(ss->pause_after, "clicked", _next,
ss); ss);
but = _add_icon(ss->notify_box, "go-last", _("Last"), NULL); but = _add_icon(ss->notify_box, "go-last", _("Last"), NULL);
evas_object_smart_callback_add(but, "clicked", _last, ss); evas_object_smart_callback_add(but, "clicked", _last, ss);
ss->fullscreen = ss->fullscreen =
_add_icon(ss->notify_box, "view-fullscreen", _("Fullscreen"), NULL); _add_icon(ss->notify_box, "view-fullscreen", _("Fullscreen"), NULL);
evas_object_smart_callback_add(ss->fullscreen, "clicked", _fullscreen, ss); evas_object_smart_callback_add(ss->fullscreen, "clicked", _fullscreen, ss);
ss->fullscreen_after = ss->fullscreen_after =
_add_icon(ss->notify_box, "preferences-other", _("Settings"), NULL); _add_icon(ss->notify_box, "preferences-other", _("Settings"), NULL);
evas_object_smart_callback_add(ss->fullscreen_after, "clicked", _settings, ss); evas_object_smart_callback_add(ss->fullscreen_after, "clicked", _settings, ss);
ss->exit = ss->exit =
_add_icon(ss->notify_box, "application-exit", _("Exit"), NULL); _add_icon(ss->notify_box, "application-exit", _("Exit"), NULL);
evas_object_smart_callback_add(ss->exit, "clicked", _fullscreen, ss); evas_object_smart_callback_add(ss->exit, "clicked", _fullscreen, ss);
elm_box_unpack(ss->notify_box, ss->exit); elm_box_unpack(ss->notify_box, ss->exit);
@ -887,23 +959,23 @@ ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent)
ss->timer_end = EINA_TRUE; ss->timer_end = EINA_TRUE;
elm_layout_file_set(slideshow, PACKAGE_DATA_DIR "/themes/ephoto.edj", elm_layout_file_set(slideshow, PACKAGE_DATA_DIR "/themes/ephoto.edj",
"ephoto,slideshow,base"); "ephoto,slideshow,base");
evas_object_event_callback_add(slideshow, EVAS_CALLBACK_DEL, _slideshow_del, evas_object_event_callback_add(slideshow, EVAS_CALLBACK_DEL, _slideshow_del,
ss); ss);
evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_DOWN, evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_DOWN,
_mouse_down, ss); _mouse_down, ss);
evas_object_data_set(slideshow, "slideshow", ss); evas_object_data_set(slideshow, "slideshow", ss);
EPHOTO_EXPAND(slideshow); EPHOTO_EXPAND(slideshow);
EPHOTO_FILL(slideshow); EPHOTO_FILL(slideshow);
evas_object_event_callback_add(ss->slideshow, EVAS_CALLBACK_MOUSE_MOVE, evas_object_event_callback_add(ss->slideshow, EVAS_CALLBACK_MOUSE_MOVE,
_mouse_move, ss); _mouse_move, ss);
edje_object_signal_callback_add(elm_layout_edje_get(ss->slideshow), edje_object_signal_callback_add(elm_layout_edje_get(ss->slideshow),
"ephoto,transition,raise", "ephoto", _on_transition_raise, ss); "ephoto,transition,raise", "ephoto", _on_transition_raise, ss);
edje_object_signal_callback_add(elm_layout_edje_get(ss->slideshow), edje_object_signal_callback_add(elm_layout_edje_get(ss->slideshow),
"ephoto,transition,end", "ephoto", _on_transition_end, ss); "ephoto,transition,end", "ephoto", _on_transition_end, ss);
return ss->slideshow; return ss->slideshow;
error: error:
evas_object_del(slideshow); evas_object_del(slideshow);
return NULL; return NULL;
} }
@ -923,28 +995,28 @@ ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
Ephoto_Slideshow *ss = evas_object_data_get(obj, "slideshow"); Ephoto_Slideshow *ss = evas_object_data_get(obj, "slideshow");
if (!entry) if (!entry)
return; return;
if (ss->entry) if (ss->entry)
ephoto_entry_free_listener_del(ss->entry, _entry_free, ss); ephoto_entry_free_listener_del(ss->entry, _entry_free, ss);
ss->entry = entry; ss->entry = entry;
ss->current = eina_list_data_idx(ss->entries, ss->entry); ss->current = eina_list_data_idx(ss->entries, ss->entry);
if (entry) if (entry)
ephoto_entry_free_listener_add(entry, _entry_free, ss); ephoto_entry_free_listener_add(entry, _entry_free, ss);
ss->timeout = ss->ephoto->config->slideshow_timeout; ss->timeout = ss->ephoto->config->slideshow_timeout;
_slideshow_play(ss); _slideshow_play(ss);
if (ss->pause) if (ss->pause)
{ {
evas_object_del(ss->pause); evas_object_del(ss->pause);
ss->pause = ss->pause =
_add_icon(ss->notify_box, "media-playback-pause", _("Pause"), _add_icon(ss->notify_box, "media-playback-pause", _("Pause"),
ss->pause_after); ss->pause_after);
evas_object_smart_callback_add(ss->pause, "clicked", _pause, ss); evas_object_smart_callback_add(ss->pause, "clicked", _pause, ss);
ss->playing = 1; ss->playing = 1;
} }
if (ss->fullscreen) if (ss->fullscreen)
{ {
@ -952,28 +1024,28 @@ ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
if (!elm_win_fullscreen_get(ss->ephoto->win)) if (!elm_win_fullscreen_get(ss->ephoto->win))
{ {
ss->fullscreen = ss->fullscreen =
_add_icon(ss->notify_box, "view-fullscreen", _("Fullscreen"), _add_icon(ss->notify_box, "view-fullscreen", _("Fullscreen"),
ss->fullscreen_after); ss->fullscreen_after);
evas_object_smart_callback_add(ss->fullscreen, "clicked", evas_object_smart_callback_add(ss->fullscreen, "clicked",
_fullscreen, ss); _fullscreen, ss);
elm_box_unpack(ss->notify_box, ss->exit); elm_box_unpack(ss->notify_box, ss->exit);
evas_object_hide(ss->exit); evas_object_hide(ss->exit);
} }
else else
{ {
ss->fullscreen = ss->fullscreen =
_add_icon(ss->notify_box, "view-restore", _("Normal"), _add_icon(ss->notify_box, "view-restore", _("Normal"),
ss->fullscreen_after); ss->fullscreen_after);
evas_object_smart_callback_add(ss->fullscreen, "clicked", evas_object_smart_callback_add(ss->fullscreen, "clicked",
_fullscreen, ss); _fullscreen, ss);
elm_box_pack_end(ss->notify_box, ss->exit); elm_box_pack_end(ss->notify_box, ss->exit);
evas_object_show(ss->exit); evas_object_show(ss->exit);
} }
} }
if (ss->event) if (ss->event)
{ {
evas_object_del(ss->event); evas_object_del(ss->event);
ss->event = NULL; ss->event = NULL;
} }
ss->event = evas_object_rectangle_add(ss->ephoto->win); ss->event = evas_object_rectangle_add(ss->ephoto->win);
evas_object_smart_member_add(ss->event, ss->ephoto->win); evas_object_smart_member_add(ss->event, ss->ephoto->win);
@ -981,7 +1053,8 @@ ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
evas_object_repeat_events_set(ss->event, EINA_TRUE); evas_object_repeat_events_set(ss->event, EINA_TRUE);
evas_object_show(ss->event); evas_object_show(ss->event);
evas_object_event_callback_add(ss->event, EVAS_CALLBACK_KEY_DOWN, _key_down, evas_object_event_callback_add(ss->event, EVAS_CALLBACK_KEY_DOWN, _key_down,
ss); ss);
evas_object_raise(ss->event); evas_object_raise(ss->event);
elm_object_focus_set(ss->event, EINA_TRUE); elm_object_focus_set(ss->event, EINA_TRUE);
} }

View File

@ -61,7 +61,7 @@ e_thumb_shutdown(void)
_exe_del_handler = NULL; _exe_del_handler = NULL;
_thumbnailers = eina_list_free(_thumbnailers); _thumbnailers = eina_list_free(_thumbnailers);
EINA_LIST_FREE(_thumbnailers_exe, exe_free) EINA_LIST_FREE(_thumbnailers_exe, exe_free)
ecore_exe_free(exe_free); ecore_exe_free(exe_free);
_thumb_queue = eina_list_free(_thumb_queue); _thumb_queue = eina_list_free(_thumb_queue);
_objid = 0; _objid = 0;
eina_hash_free(_thumbs); eina_hash_free(_thumbs);
@ -439,3 +439,4 @@ _e_thumb_cb_exe_event_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev
} }
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }

File diff suppressed because it is too large Load Diff

View File

@ -122,7 +122,7 @@ _e_ipc_init(void)
return 0; return 0;
} }
_e_ipc_server = ecore_ipc_server_connect _e_ipc_server = ecore_ipc_server_connect
(ECORE_IPC_LOCAL_SYSTEM, "ephoto", port, NULL); (ECORE_IPC_LOCAL_SYSTEM, "ephoto", port, NULL);
if (!_e_ipc_server) if (!_e_ipc_server)
{ {
printf("Error: could not connect to Ephoto IPC port=%d\n", port); printf("Error: could not connect to Ephoto IPC port=%d\n", port);
@ -138,7 +138,7 @@ _e_ipc_init(void)
static Eina_Bool static Eina_Bool
_e_ipc_cb_server_add(void *data EINA_UNUSED, _e_ipc_cb_server_add(void *data EINA_UNUSED,
int type EINA_UNUSED, int type EINA_UNUSED,
void *event) void *event)
{ {
Ecore_Ipc_Event_Server_Add *e; Ecore_Ipc_Event_Server_Add *e;
@ -152,8 +152,8 @@ _e_ipc_cb_server_add(void *data EINA_UNUSED,
} }
static Eina_Bool static Eina_Bool
_e_ipc_cb_server_del(void *data EINA_UNUSED, _e_ipc_cb_server_del(void *data EINA_UNUSED,
int type EINA_UNUSED, int type EINA_UNUSED,
void *event EINA_UNUSED) void *event EINA_UNUSED)
{ {
/* quit now */ /* quit now */
@ -163,7 +163,7 @@ _e_ipc_cb_server_del(void *data EINA_UNUSED,
static Eina_Bool static Eina_Bool
_e_ipc_cb_server_data(void *data EINA_UNUSED, _e_ipc_cb_server_data(void *data EINA_UNUSED,
int type EINA_UNUSED, int type EINA_UNUSED,
void *event) void *event)
{ {
Ecore_Ipc_Event_Server_Data *e; Ecore_Ipc_Event_Server_Data *e;
@ -480,16 +480,16 @@ _e_thumb_generate(E_Thumb *eth)
int hi, si, vi; int hi, si, vi;
float h, s, v; float h, s, v;
const int pat2[4] = const int pat2[4] =
{ {
0, 3, 1, 2 0, 3, 1, 2
}; };
const int pat1[16] = const int pat1[16] =
{ {
5, 10, 6, 9, 5, 10, 6, 9,
0, 15, 3, 12, 0, 15, 3, 12,
1, 14, 7, 8, 1, 14, 7, 8,
4, 11, 2, 13 4, 11, 2, 13
}; };
/* ww = hh = 1 here */ /* ww = hh = 1 here */
data3 = malloc(sizeof(unsigned int)); data3 = malloc(sizeof(unsigned int));
@ -577,7 +577,8 @@ end:
/* will free all */ /* will free all */
if (edje) evas_object_del(edje); if (edje) evas_object_del(edje);
if (ee_im) ecore_evas_free(ee_im); if (ee_im) ecore_evas_free(ee_im);
else if (im) evas_object_del(im); else if (im)
evas_object_del(im);
if (im2) evas_object_del(im2); if (im2) evas_object_del(im2);
if (bg) evas_object_del(bg); if (bg) evas_object_del(bg);
ecore_evas_free(ee); ecore_evas_free(ee);
@ -621,7 +622,7 @@ e_sha1_sum(unsigned char *data, int size, unsigned char *dst)
buf[63] = (size) & 0xff; buf[63] = (size) & 0xff;
} }
buf[idx] = *d; buf[idx] = *d;
idx++;; idx++;
if ((idx == 64) || (left == 1)) if ((idx == 64) || (left == 1))
{ {
if ((left == 1) && (idx < 64)) buf[idx] = 0x80; if ((left == 1) && (idx < 64)) buf[idx] = 0x80;